6.5 KiB
6.5 KiB
In [ ]:
# Convert all health values
track = 0
for filename in files:
file = open(filename, 'r')
lines = file.readlines()
for idx, line in enumerate(lines):
check = re.match("^(\s*)Health = ([0-9]+),$", line)
if check is not None:
white = check.group(1)
value = check.group(2)
num = int(value)
lines[idx] = f"{white}Health = {num * 30}, -- ({value}) * 30\n"
maxcheck = re.match("^(\s*)MaxHealth = ([0-9]+),$", lines[idx + 1])
assert maxcheck is not None
white = maxcheck.group(1)
value = maxcheck.group(2)
num = int(value)
lines[idx + 1] = f"{white}MaxHealth = {num * 30},\n"
track += 1
file.close()
out = open(filename, 'w')
out.writelines(lines)
out.close()
print(track)In [ ]:
# Swap all armor types to Normal
track = 0
for filename in files:
file = open(filename, 'r')
lines = file.readlines()
for idx, line in enumerate(lines):
check = re.match("^(\s*)ArmorType = '(\w+)',$", line)
if check is not None:
white = check.group(1)
value = check.group(2)
lines[idx] = f"{white}ArmorType = 'Normal', -- '{value}'\n"
file.close()
out = open(filename, 'w')
out.writelines(lines)
out.close()
print(track)In [ ]:
# Update weapon damage
track = 0
for filename in files:
file = open(filename, 'r')
lines = file.readlines()
for idx, line in enumerate(lines):
check = re.match("^(\s*)Damage = (.+),$", line)
if check is not None:
second = re.match("^(\s*)DisplayName = '(.+)',$", lines[idx + 4])
if second is None:
print(f'missed dn {filename}:{idx + 4}')
continue
third = re.match("^(\s*)BallisticArc = '(.+)',$", lines[idx - 2])
if third is None:
print(f'missed ba {filename}:{idx - 2}')
continue
white = check.group(1)
second_white = second.group(1)
third_white = third.group(1)
damage = check.group(2)
display = second.group(2)
number = 0
ballistic = ""
if display is "Particle Projector Cannon":
number = 10
if display is "Small Laser":
number = 3
if display is "Medium Laser":
number = 5
if display is "Large Laser":
number = 8
if display is "Short Range Missiles":
number = 2
if display is "Long Range Missiles":
number = 1
if display is "Autocannon/2":
number = 2
ballistic = "RULEUBA_LowArc"
if display is "Autocannon/5":
number = 5
ballistic = "RULEUBA_LowArc"
if display is "Autocannon/10":
number = 10
ballistic = "RULEUBA_LowArc"
if display is "Autocannon/20":
number = 20
ballistic = "RULEUBA_LowArc"
track += 1
lines[idx] = f"{white}Damage = {number * 30}, -- ({number}) * 30\n"
if len(ballistic) > 0:
lines[idx - 2] = f"{third_white}BallisticArc = '{ballistic}',\n"
file.close()
# out = open(filename, 'w')
# out.writelines(lines)
# out.close()
print(track)In [ ]:
# Split cluster damage types
track = 0
for filename in files:
file = open(filename, 'r')
lines = file.readlines()
for idx, line in enumerate(lines):
check = re.match("^(\s*)(DamageType) = '(.+)',$", line)
if check is not None and check.group(3) == "BTCluster":
white = check.group(1)
label = check.group(2)
second = re.match("^(\s*)(DisplayName) = '(.+)',$", lines[idx + 1])
if second is not None:
if second.group(3) == "Long Range Missles" or second.group(3) == "Short Range Missles":
lines[idx] = f"{white}{label} = 'BTClusterMissile',\n"
if second.group(3) == "LB 10-X Autocannon" or second.group(3) == "LBX5_rounds":
lines[idx] = f"{white}{label} = 'BTClusterBallistic',\n"
file.close()
out = open(filename, 'w')
out.writelines(lines)
out.close()
print(track)