encode port into patch, also reverse defaulting order for server;
cmd args overwrite yaml now
This commit is contained in:
parent
44086152a2
commit
8b02103b93
|
@ -28,10 +28,10 @@ if __name__ == "__main__":
|
|||
|
||||
ModuleUpdate.update()
|
||||
|
||||
from Utils import parse_yaml, get_public_ipv4
|
||||
from Utils import parse_yaml, get_public_ipv4, get_options
|
||||
from Patch import create_patch_file
|
||||
|
||||
options = parse_yaml(open("host.yaml").read())
|
||||
options = get_options()
|
||||
|
||||
multi_mystery_options = options["multi_mystery_options"]
|
||||
output_path = multi_mystery_options["output_path"]
|
||||
|
@ -49,6 +49,7 @@ if __name__ == "__main__":
|
|||
meta_file_path = multi_mystery_options["meta_file_path"]
|
||||
teams = multi_mystery_options["teams"]
|
||||
rom_file = options["general_options"]["rom_file"]
|
||||
port = options["server_options"]["port"]
|
||||
|
||||
|
||||
py_version = f"{sys.version_info.major}.{sys.version_info.minor}"
|
||||
|
@ -140,7 +141,7 @@ if __name__ == "__main__":
|
|||
zipname = os.path.join(output_path, f"ER_{seedname}.{typical_zip_ending}")
|
||||
|
||||
print(f"Creating zipfile {zipname}")
|
||||
ipv4 = get_public_ipv4()
|
||||
ipv4 = get_public_ipv4() + ":" + str(port)
|
||||
with zipfile.ZipFile(zipname, "w", compression=compression, compresslevel=9) as zf:
|
||||
for file in os.listdir(output_path):
|
||||
if file.endswith(".sfc") and seedname in file:
|
||||
|
|
|
@ -237,8 +237,6 @@ def forfeit_player(ctx: Context, team: int, slot: int):
|
|||
|
||||
|
||||
def register_location_checks(ctx: Context, team: int, slot: int, locations):
|
||||
|
||||
|
||||
found_items = False
|
||||
for location in locations:
|
||||
if (location, slot) in ctx.locations:
|
||||
|
@ -624,22 +622,20 @@ async def forward_port(port: int):
|
|||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--host', default=None)
|
||||
parser.add_argument('--port', default=38281, type=int)
|
||||
parser.add_argument('--password', default=None)
|
||||
parser.add_argument('--multidata', default=None)
|
||||
parser.add_argument('--savefile', default=None)
|
||||
parser.add_argument('--disable_save', default=False, action='store_true')
|
||||
parser.add_argument('--loglevel', default='info', choices=['debug', 'info', 'warning', 'error', 'critical'])
|
||||
parser.add_argument('--location_check_points', default=1, type=int)
|
||||
parser.add_argument('--hint_cost', default=1000, type=int)
|
||||
parser.add_argument('--disable_item_cheat', default=False, action='store_true')
|
||||
parser.add_argument('--port_forward', default=False, action='store_true')
|
||||
defaults = Utils.get_options()["server_options"]
|
||||
parser.add_argument('--host', default=defaults["host"])
|
||||
parser.add_argument('--port', default=defaults["port"], type=int)
|
||||
parser.add_argument('--password', default=defaults["password"])
|
||||
parser.add_argument('--multidata', default=defaults["multidata"])
|
||||
parser.add_argument('--savefile', default=defaults["savefile"])
|
||||
parser.add_argument('--disable_save', default=defaults["disable_save"], action='store_true')
|
||||
parser.add_argument('--loglevel', default=defaults["loglevel"],
|
||||
choices=['debug', 'info', 'warning', 'error', 'critical'])
|
||||
parser.add_argument('--location_check_points', default=defaults["location_check_points"], type=int)
|
||||
parser.add_argument('--hint_cost', default=defaults["hint_cost"], type=int)
|
||||
parser.add_argument('--disable_item_cheat', default=defaults["disable_item_cheat"], action='store_true')
|
||||
parser.add_argument('--port_forward', default=defaults["port_forward"], action='store_true')
|
||||
args = parser.parse_args()
|
||||
file_options = Utils.get_options()["server_options"]
|
||||
for key, value in file_options.items():
|
||||
if value is not None:
|
||||
setattr(args, key, value)
|
||||
return args
|
||||
|
||||
|
||||
|
|
14
host.yaml
14
host.yaml
|
@ -6,21 +6,21 @@ general_options:
|
|||
#these overwrite command line arguments!
|
||||
server_options:
|
||||
host: null
|
||||
port: null
|
||||
port: 38281
|
||||
password: null
|
||||
multidata: null
|
||||
savefile: null
|
||||
disable_save: null
|
||||
loglevel: null
|
||||
disable_save: false
|
||||
loglevel: "info"
|
||||
#automatically forward the port that is used, then close that port after 24 hours
|
||||
port_forward: null
|
||||
port_forward: false
|
||||
#Disallow !getitem. Old /getitem cannot be blocked this way
|
||||
disable_item_cheat: null
|
||||
disable_item_cheat: false
|
||||
#Client hint system
|
||||
#points given to player for each acquired item
|
||||
location_check_points: null
|
||||
location_check_points: 1
|
||||
#point cost to receive a hint via !hint for players
|
||||
hint_cost: null #set to 0 if you want free hints
|
||||
hint_cost: 1000 #set to 0 if you want free hints
|
||||
#options for MultiMystery.py
|
||||
multi_mystery_options:
|
||||
#teams, however, note that there is currently no way to supply names for teams 2+ through MultiMystery
|
||||
|
|
Loading…
Reference in New Issue