Crafting v5
This commit is contained in:
@@ -704,19 +704,35 @@ func _on_discover_pressed():
|
||||
# Count ingredients by definition ID, using the quantity in each slot
|
||||
var ingredient_counts = {}
|
||||
for item in items:
|
||||
# Server sends "definitionId" (camelCase)
|
||||
var def_id = item.get("definitionId", 0)
|
||||
var qty = item.get("quantity", 1)
|
||||
|
||||
print("[Crafting] Item in grid: name=%s, definitionId=%s, qty=%s, all_keys=%s" % [
|
||||
item.get("name", "?"), def_id, qty, item.keys()])
|
||||
|
||||
if def_id == 0 or def_id == null:
|
||||
print("[Crafting] ERROR: Item missing definitionId!")
|
||||
_show_result("Error: Item has no definition ID", Color.RED)
|
||||
return
|
||||
|
||||
if not ingredient_counts.has(def_id):
|
||||
ingredient_counts[def_id] = 0
|
||||
ingredient_counts[def_id] += qty
|
||||
|
||||
if ingredient_counts.is_empty():
|
||||
_show_result("No valid ingredients found!", Color.RED)
|
||||
return
|
||||
|
||||
var ingredients = []
|
||||
for def_id in ingredient_counts:
|
||||
ingredients.append({
|
||||
"itemDefinitionId": def_id,
|
||||
"quantity": ingredient_counts[def_id]
|
||||
"itemDefinitionId": int(def_id),
|
||||
"quantity": int(ingredient_counts[def_id])
|
||||
})
|
||||
|
||||
print("[Crafting] Sending discovery request: skill=%d, ingredients=%s" % [selected_skill_type, ingredients])
|
||||
|
||||
print("[Crafting] Attempting discovery with skill %d: %s" % [selected_skill_type, ingredients])
|
||||
|
||||
if GameState:
|
||||
|
||||
Reference in New Issue
Block a user