Browse Source

Better output, add Character Stuff Wonderland to whitelist

modded
parent
commit
8a4d3d11a4
Signed by: hristoast GPG Key ID: 5FC7664AD47AA1C5
  1. 43
      reset-cells.py

43
reset-cells.py

@ -7,19 +7,11 @@ import sys
DESC = "Remove all cells except those whitelisted or used by RealEstate.lua"
PROG = "tes3mp-reset-cells"
VERSION = 2
VERSION = 3
# TODO: dehardcode this
TES3MP_DIR = os.path.abspath(
os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), "..")
)
BETTERVANILLALEVELING_DATA = os.path.join(
TES3MP_DIR,
"lua",
"CoreScripts",
"data",
"custom",
"__config_BetterVanillaLeveling.json",
)
VISUALHARVEST_DATA = os.path.join(
TES3MP_DIR, "lua", "CoreScripts", "data", "custom", "__data_VisualHarvesting.json"
)
@ -32,6 +24,7 @@ REALESTATE_CELLS_FILE = os.path.join(
WHITELIST = [
"Abandoned Flat, Training Facility",
"Archery Arena",
"Character Stuff Wonderland",
"Enchanting Storage",
"Hidden Lab",
"Thaumaturgical Studies and Practices",
@ -79,19 +72,33 @@ def remove_cells(celldir: str, realestate_cells_file: str, whitelist: list):
for re_cell in realestate_cells:
if re_cell in cells_to_rm:
print("Ignoring cell: " + re_cell)
print(
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ " Ignoring cell: "
+ re_cell
)
cells_to_rm.remove(re_cell)
except FileNotFoundError:
sys.stderr.write("RealEstate files were not found.\n")
sys.stderr.write(
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ " RealEstate files were not found.\n"
)
sys.exit(1)
for c in cells_to_rm:
if c != ".gitkeep":
print("Deleting cell: " + c)
print(
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ " Deleting cell: "
+ c
)
try:
os.remove(os.path.join(cells_dir, c + ".json"))
except FileNotFoundError:
print("Couildn't delete {}, is it a real file?".format(c + ".json"))
print(
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ " Couildn't delete {}, is it a real file?".format(c + ".json")
)
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + " CELL RESET DONE!")
@ -100,9 +107,15 @@ def reset_qh_data():
try:
with open(VISUALHARVEST_DATA, "w") as f:
f.write("{}")
print("VisualHarvesting data has been reset!")
print(
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ " VisualHarvesting data has been reset!"
)
except FileNotFoundError:
sys.stderr.write("VisualHarvesting pick data was not found.\n")
sys.stderr.write(
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ " VisualHarvesting pick data was not found.\n"
)
sys.exit(1)

Loading…
Cancel
Save