cpypasta / cotw-mod-builder

A tool to create custom mods for COTW.
44 stars 2 forks source link

[Request] A less intense version of Increased Level Progression #2

Open Tahvohck opened 8 months ago

Tahvohck commented 8 months ago

I'd like to request a less intense version of Increased Level Progression that keeps the alternating point rewards structure all the way to level 60 so there's a total of 30 of each skill/perk points. I like the idea of having to make choices, but I'd like to be able to at least unlock tier 5 in both the stalker and ambusher trees (28 points total). I'd make the file and submit a PR but I can't get deca-gui to successfully unpack the game, so I can't analyze the bin myself.

Tahvohck commented 8 months ago

Verrasse on the GZ Modding discord got a working deca database and I was able to figure out what needed to be done. What follows is an updated version of Increased Level Progression that gives a few options for how to modify the level progression. Did it this way because it's late at night and I don't want to go through the whole process of forking for this when I should have been in bed hours ago.

edit: Realized there was a bug in my loops. All the points were a level too late, I'm not used to working with raw binary offsets. Code should be correct now.

from typing import List
from modbuilder import mods

DEBUG=False
NAME = "Increase Level Progression"
DESCRIPTION = "Increases skill and perk points you gain when increasing your character's level. This mod will increase the progession such that you are able to unlock every skill and perk. This mod will not change your existing character's skill and perk points."
FILE = "settings/hp_settings/player_rewards.bin"
points_array = ["22 (default)", "29", "44"]
OPTIONS = [
  { "name": "Skill points", "style": "list", "default": points_array[0], "initial": points_array },
  { "name": "Perk points",  "style": "list", "default": points_array[0], "initial": points_array }
]

def format(options: dict) -> str:
  skill_progression = options['skill_points']
  perk_progression = options['perk_points']
  return f"Increase Level Progression (sk: {skill_progression}, pk: {perk_progression})"

def process(options: dict) -> None:
  skill_progression = options['skill_points']
  perks_progression = options['perk_points']

  CellIndex_offset = 504
  skill_offset = 2
  perks_offset = 3

  clear_indices = []
  skill_indices = []

  if skill_progression == points_array[1]:
    clear_indices = [CellIndex_offset + ((row_idx * 5 + skill_offset) * 4) for row_idx in range(38,60,1)]
    skill_indices = [CellIndex_offset + ((row_idx * 5 + skill_offset) * 4) for row_idx in range(38,60,2)]
  elif skill_progression == points_array[2]:
    clear_indices = [CellIndex_offset + ((row_idx * 5 + skill_offset) * 4) for row_idx in range(38,60,1)]
    skill_indices = [CellIndex_offset + ((row_idx * 5 + skill_offset) * 4) for row_idx in range(38,60,2)]
    skill_indices += [CellIndex_offset + ((row_idx * 5 + skill_offset) * 4) for row_idx in range(3,34,2)]

  mods.update_file_at_offsets(FILE, clear_indices, 7)   # Cell index #7 is blank/false, clear everything after level 38
  mods.update_file_at_offsets(FILE, skill_indices, 11)  # Cell index #11 is 1/true

  clear_indices = []
  perks_indices = []

  if perks_progression == points_array[1]:
    clear_indices = [CellIndex_offset + ((row_idx * 5 + perks_offset) * 4) for row_idx in range(39,60,1)]
    perks_indices = [CellIndex_offset + ((row_idx * 5 + perks_offset) * 4) for row_idx in range(39,60,2)]
  elif perks_progression == points_array[2]:
    clear_indices = [CellIndex_offset + ((row_idx * 5 + perks_offset) * 4) for row_idx in range(39,60,1)]
    perks_indices = [CellIndex_offset + ((row_idx * 5 + perks_offset) * 4) for row_idx in range(39,60,2)]
    perks_indices += [CellIndex_offset + ((row_idx * 5 + perks_offset) * 4) for row_idx in range(4,33,2)]

  mods.update_file_at_offsets(FILE, clear_indices, 7)
  mods.update_file_at_offsets(FILE, perks_indices, 11)