Crafting v5

This commit is contained in:
dingo
2025-12-24 08:18:29 -05:00
parent dd5ffa3b54
commit ca38c5a4e8
+18 -2
View File
@@ -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: