Advertisement
Guest User

Untitled

a guest
Apr 10th, 2020
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.97 KB | None | 0 0
  1. import shutil
  2.  
  3. def doubleBanditMax():
  4.     with open("Modules/SandBox/ModuleData/partyTemplates.xml") as f:
  5.         party_templates = [_ for _ in f.readlines()]
  6.  
  7.     if "<!-- DOUBLED BANDIT COUNTS -->" in "".join(party_templates):
  8.         print "Already doubled."
  9.         return
  10.  
  11.     bandits = [
  12.         "looter",
  13.         "bandit",
  14.         "raider",
  15.         "trader",
  16.         "caravan"
  17.     ]
  18.    
  19.     out_lines = []
  20.     added_comment = False
  21.     for line in party_templates:
  22.         if "max_value" in line and 'max_value="1"' not in line:
  23.             for b in bandits:
  24.                 if b in line:
  25.                     parts = line.split("max_value=")
  26.                     num_parts = parts[1].split('"')
  27.                     num = int(num_parts[1]) * 2
  28.                     num_parts[1] = str(num)
  29.                     num_part = '"'.join(num_parts)
  30.                     parts[1] = num_part
  31.                     line = "max_value=".join(parts)
  32.  
  33.                     if not added_comment:
  34.                         line += "<!-- DOUBLED BANDIT COUNTS -->"
  35.                         added_comment = True
  36.                     break
  37.  
  38.         out_lines.append(line)
  39.  
  40.     with open("Modules/SandBox/ModuleData/partyTemplates.xml", "w") as f:
  41.         f.write("".join(out_lines).replace("\r", ""))
  42.  
  43. def propogate():
  44.     shutil.copy("StoryMode_modded.dll", "Modules/StoryMode/bin/Win64_Shipping_Client/StoryMode.dll")
  45.     shutil.copy("SandBox_modded.dll", "Modules/SandBox/bin/Win64_Shipping_Client/SandBox.dll")
  46.     shutil.copy("TaleWorlds.CampaignSystem_modded.dll", "bin/Win64_Shipping_Client/TaleWorlds.CampaignSystem.dll")
  47.  
  48. def backup():
  49.     shutil.copy("Modules/StoryMode/bin/Win64_Shipping_Client/StoryMode.dll", "StoryMode.dll")
  50.     shutil.copy("Modules/SandBox/bin/Win64_Shipping_Client/SandBox.dll", "SandBox.dll")
  51.     shutil.copy("bin/Win64_Shipping_Client/TaleWorlds.CampaignSystem.dll", "TaleWorlds.CampaignSystem.dll")
  52.  
  53. # Do the things
  54. propogate()
  55. doubleBanditMax()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement