Loot changes

This commit is contained in:
dingo
2026-01-20 16:23:00 -05:00
parent 5bc1c6e0f9
commit a39f4a0a98
20 changed files with 791 additions and 50 deletions
+24
View File
@@ -12,6 +12,7 @@ signal loot_received(items: Array)
signal player_died
signal loot_chest_spawned(chest_data: Dictionary)
signal loot_chest_state_received(chest_data: Dictionary)
signal mob_loot_state_received(mob_data: Dictionary)
signal death_loot_lost(data: Dictionary)
signal dungeon_list_received(data: Dictionary)
signal crafting_skills_updated(skills: Dictionary)
@@ -163,6 +164,8 @@ func _on_message_received(opcode: int, data: Dictionary):
_handle_loot_chest_spawned(data)
OpCodes.LOOT_CHEST_STATE:
_handle_loot_chest_state(data)
OpCodes.MOB_LOOT_STATE:
_handle_mob_loot_state(data)
OpCodes.PLAYER_DEATH_LOOT_LOST:
_handle_death_loot_lost(data)
OpCodes.DUNGEON_LIST_RESPONSE:
@@ -543,6 +546,9 @@ func send_unequip_item(slot: String):
func send_use_item(slot_index: int):
Network.send_message(OpCodes.USE_ITEM, {"SlotIndex": slot_index})
func send_stack_items(source_slot: int, target_slot: int):
Network.send_message(OpCodes.STACK_ITEMS, {"SourceSlot": source_slot, "TargetSlot": target_slot})
func send_chat(message: String):
Network.send_message(OpCodes.CHAT_SEND, {"Message": message})
@@ -605,6 +611,11 @@ func _handle_loot_chest_state(data: Dictionary):
print("[GameState] Loot chest state received")
loot_chest_state_received.emit(data)
func _handle_mob_loot_state(data: Dictionary):
print("[GameState] Mob loot state received for mob: ", data.get("mobName", "Unknown"))
# Signal will be connected by mob loot UI
mob_loot_state_received.emit(data)
func _handle_death_loot_lost(data: Dictionary):
print("[GameState] Death loot lost: ", data)
death_loot_lost.emit(data)
@@ -626,6 +637,19 @@ 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})
# Mob loot actions
func request_mob_loot(mob_id: int):
Network.send_message(OpCodes.MOB_LOOT_REQUEST, {"mobId": mob_id})
func take_mob_loot_item(mob_id: int, item_index: int):
Network.send_message(OpCodes.MOB_LOOT_TAKE_ITEM, {
"mobId": mob_id,
"itemIndex": item_index
})
func take_all_mob_loot(mob_id: int):
Network.send_message(OpCodes.MOB_LOOT_TAKE_ALL, {"mobId": mob_id})
# Dungeon list handler
func _handle_dungeon_list(data: Dictionary):
print("[GameState] Received dungeon list")
+17
View File
@@ -81,6 +81,9 @@ const DROP_ITEM = 255
## Client -> Server: Assign item to hotbar slot
const HOTBAR_ASSIGN = 256
## Client -> Server: Stack two consumable items together
const STACK_ITEMS = 257
# ===== Chat (260-269) =====
## Client -> Server: Send chat message
@@ -117,6 +120,20 @@ const LOOT_CHEST_REMOVED = 276
## Server -> Client: Notify player what loot they lost on death
const PLAYER_DEATH_LOOT_LOST = 280
# ===== Mob Loot (290-299) =====
## Client -> Server: Request loot from a dead mob
const MOB_LOOT_REQUEST = 290
## Server -> Client: Mob loot contents response
const MOB_LOOT_STATE = 291
## Client -> Server: Take specific item from mob
const MOB_LOOT_TAKE_ITEM = 292
## Client -> Server: Take all items from mob
const MOB_LOOT_TAKE_ALL = 293
# ===== Dungeon Core (300-309) =====
## Client -> Server: Request to enter a dungeon