From 11e531fef2acf29c87478f66f49c8312591bb58e Mon Sep 17 00:00:00 2001 From: Carl Date: Sat, 6 Jun 2026 18:54:35 +0200 Subject: [PATCH] Halfway added victory condition selection, lost my mind halfway through and have to get a beer now. --- webui.py | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/webui.py b/webui.py index 0d375d8..c7e3d12 100644 --- a/webui.py +++ b/webui.py @@ -77,9 +77,9 @@ def creator_page(): ) ) - # client_start = ui.checkbox("Allow clients to start the game") checkbox_container = ui.row() with checkbox_container: + client_start = ui.checkbox("Allow clients to start the game", value=True) team_game = ui.checkbox("Disciple Game") clustered_start = ui.checkbox("Clustered Spawns (Disciple games only)") random_start_research = ui.checkbox("Random Start Research") @@ -100,6 +100,22 @@ def creator_page(): event_rarity = ui.toggle({1: "Common", 2: "Rare"}, value=1) random_map = ui.toggle([10, 15, 20], value=15) story_events = ui.toggle({0: "None", 1: "Some", 2: "All"}, value=2) + + ui.label("Victory Condition") + # I have to do this to pass by reference?? This is absurd. + conq_all = [True] + thrones = [(0, 0, 0)] + required_apoints = [0] + with ui.row(): + ui.radio({1: "Conquest", 2: "Thrones Of Ascension"}).props( + "inline" + ).on_value_change( + lambda e: handle_thrones( + e, throne_container, conq_all, thrones, required_apoints + ) + ) + + throne_container = ui.row() with ui.row(): ui.label("Gold Multiplier:").classes("w-36") richness = ui.input( @@ -163,11 +179,29 @@ def creator_page(): resources=int(resources.value), richness=int(richness.value), supplies=int(supplies.value), + story_events=int(story_events.value), + conq_all=conq_all, ) ), ) +def handle_thrones(value, throne_container, conq_all, thrones, required_apoints): + if value == 1: + throne_container.clear() + conq_all[0] = False + return + with throne_container: + with ui.row(): + thrones = ( + ui.input(label="Level 1"), + ui.input(label="Level 2"), + ui.input(label="Level 3"), + ) + required_apoints = ui.input(label="Required Ascension Points") + return False, thrones, required_apoints + + def create_ai_table(era, table_container, ai_slots): # TODO: move this somewhere else AI_LEVELS = [