Dungeon Browser

This commit is contained in:
dingo
2025-12-17 15:13:26 -05:00
parent 69c5b38098
commit 229c4cfad1
10 changed files with 333 additions and 2 deletions
+18
View File
@@ -13,6 +13,7 @@ signal player_died
signal loot_chest_spawned(chest_data: Dictionary)
signal loot_chest_state_received(chest_data: Dictionary)
signal death_loot_lost(data: Dictionary)
signal dungeon_list_received(data: Dictionary)
# Use constants instead of enum to avoid type issues
const STATE_AUTH = 0
@@ -133,6 +134,8 @@ func _on_message_received(opcode: int, data: Dictionary):
_handle_loot_chest_state(data)
OpCodes.PLAYER_DEATH_LOOT_LOST:
_handle_death_loot_lost(data)
OpCodes.DUNGEON_LIST_RESPONSE:
_handle_dungeon_list(data)
_:
print("[GameState] Unhandled opcode: ", opcode)
@@ -467,3 +470,18 @@ func take_all_loot_chest(chest_id: int):
func close_loot_chest(chest_id: int):
Network.send_message(OpCodes.LOOT_CHEST_CLOSE, {"ChestId": chest_id})
# Dungeon list handler
func _handle_dungeon_list(data: Dictionary):
print("[GameState] Received dungeon list")
dungeon_list_received.emit(data)
# Dungeon browser actions
func request_dungeon_list():
Network.send_message(OpCodes.DUNGEON_LIST_REQUEST, {})
func create_dungeon(tier: int):
Network.send_message(OpCodes.DUNGEON_CREATE, {"Tier": tier})
func join_dungeon(dungeon_id: String):
Network.send_message(OpCodes.DUNGEON_JOIN, {"DungeonId": dungeon_id})