Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Work In Progress] Marine Training Cost & Time Transformer #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion X3_Customizer/Transforms/T_Obj_Code/Marines.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,44 @@ def Make_Terran_Stations_Make_Terran_Marines(
)
Apply_Obj_Patch(patch)

return
return

@File_Manager.Transform_Wrapper('L/x3story.obj', LU = False, TC = False)
def Set_Marine_Training_Cost_And_Time_Divisors(
cost_divisor = 5,
time_divisor = 5,
):
'''
The higher the divisor the cheaper/faster training will be
The lower the divisor the more expensive/slower training will be
'''

# Each skill has a max value of 100, so any value over 100 will always result in 0
max_count = 100

cost_divisor = max(1, min(int(cost_divisor), max_count))
time_divisor = max(1, min(int(time_divisor), max_count))

# Convert to hex strings, 1 byte each.
cost_divisor = Int_To_Hex_String(cost_divisor, 1)
time_divisor = Int_To_Hex_String(time_divisor, 1)

patch_fields = [
['32' '000D3C7F' '0D' '0002' '05' '..' '51' '02' '46' '0D' '0004' '06' '1388',
'32' '000D3C7F' '0D' '0002' '05'+cost_divisor+'51' '02' '46' '0D' '0004' '06' '1388'],
['32' '000D3D3F' '0D' '0002' '05' '..' '51' '02' '46' '0D' '0004' '06' '012C',
'32' '000D3D3F' '0D' '0002' '05'+time_divisor+'51' '02' '46' '0D' '0004' '06' '012C'],
]

patch_list = []
for ref_code, replacement in patch_fields:
patch_list.append( Obj_Patch(
#offsets = [offset],
ref_code = ref_code,
new_code = replacement,
))

# Apply the patches.
Apply_Obj_Patch_Group(patch_list)

return