Compare commits
2 Commits
54653282aa
...
e8bba85cd2
| Author | SHA1 | Date | |
|---|---|---|---|
| e8bba85cd2 | |||
| fbb434563d |
@@ -90,6 +90,9 @@ def server_command_builder(
|
||||
required_apoints: int = 0,
|
||||
cataclysm: int = 0,
|
||||
):
|
||||
available_nations = get_nations()
|
||||
|
||||
# TODO change < ranges to =<
|
||||
if (not ((random_map == 0) ^ (mapfile == ""))) or random_map not in {0, 10, 15, 20}:
|
||||
return "ERROR_MAP"
|
||||
|
||||
@@ -106,6 +109,32 @@ def server_command_builder(
|
||||
if required_apoints == 0:
|
||||
required_apoints = thrones[0] + (2 * thrones[1]) + (3 * thrones[2]) - 1
|
||||
|
||||
if not (0 <= research_difficulty < 5):
|
||||
return "ERROR_RESEARCH"
|
||||
if not (4 < hof_size < 16):
|
||||
return "ERROR_HOF"
|
||||
if not (2 < global_slots < 10):
|
||||
return "ERROR_GLOBALS"
|
||||
if not (0 <= inde_strength <= 9):
|
||||
return "ERROR_INDEP"
|
||||
if not (0 <= magic_sites <= 75):
|
||||
return "ERROR_MAGICSITES"
|
||||
if not (1 <= event_rarity <= 2):
|
||||
return "ERROR_EVENTS"
|
||||
if not (50 <= richness <= 300):
|
||||
return "ERROR_RICHNESS"
|
||||
if not (50 <= recruitment <= 300):
|
||||
return "ERROR_RECRUITMENT"
|
||||
if not (50 <= resources <= 300):
|
||||
return "ERROR_RESOURCES"
|
||||
if not (50 <= supplies <= 300):
|
||||
return "ERROR_SUPPLIES"
|
||||
if not (1 <= start_prov <= 9):
|
||||
return "ERROR_STARTPROV"
|
||||
if not (0 <= story_events <= 2):
|
||||
return "ERROR_STORYEVENTS"
|
||||
if not (1 <= new_ai_lvl <= 6):
|
||||
return "ERROR_NEWAIS"
|
||||
command = [
|
||||
SERVER_PATH,
|
||||
"-TS ",
|
||||
@@ -119,7 +148,10 @@ def server_command_builder(
|
||||
]
|
||||
if team_game:
|
||||
for team in teams:
|
||||
# TODO Check valid inputs
|
||||
# TODO Can team have more than one disciple and pretender?
|
||||
if team[0] not in available_nations[era]:
|
||||
return "ERROR_INVALID_NATION"
|
||||
|
||||
command.append(
|
||||
" --team " + str(team[0]) + " " + str(team[1]) + " " + str(team[2])
|
||||
)
|
||||
@@ -132,7 +164,14 @@ def server_command_builder(
|
||||
command.append(" --cataclysm " + str(cataclysm))
|
||||
if conq_all:
|
||||
command.append(" --conqall")
|
||||
|
||||
if not research_difficulty == 2:
|
||||
command.append(" --research " + str(research_difficulty))
|
||||
if not random_start_research:
|
||||
command.append(" --norandres ")
|
||||
if not hof_size == 10:
|
||||
command.append(" --hof_size " + str(hof_size))
|
||||
if not global_slots == 5:
|
||||
command.append(" --globals " + str(global_slots))
|
||||
return command
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user