diff --git a/common/item_instance.h b/common/item_instance.h index 263bf676d..297908a50 100644 --- a/common/item_instance.h +++ b/common/item_instance.h @@ -61,7 +61,7 @@ class SharedDatabase; namespace EQ { class InventoryProfile; - + class ItemInstance { public: ///////////////////////// diff --git a/world/client.h b/world/client.h index aca958d6f..3631cf129 100644 --- a/world/client.h +++ b/world/client.h @@ -1,4 +1,4 @@ -/* EQ::: Everquest Server Emulator +/* EQ Everquest Server Emulator Copyright (C) 2001-2002 EQ:: Development Team (http://EQ::.org) This program is free software; you can redistribute it and/or modify diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 307560cf4..eb365b8a9 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1290,23 +1290,24 @@ bool ZoneDatabase::GetTradeRecipe( //length limit on buf2 if(index == 214) { //Maximum number of recipe matches (19 * 215 = 4096) - LogError("GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched [{}] of [{}] possible entries", index + 1, results.RowCount()); + LogError("GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched [{}] of [{}] possible entries", index + 1, results.RowCount()); break; } } query = StringFormat("SELECT tre.recipe_id " "FROM tradeskill_recipe_entries AS tre " - "WHERE tre.recipe_id IN (%s) " - "GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u " - "AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum); + "WHERE tre.recipe_id IN (%s) " + "GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u " + "AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum + ); results = QueryDatabase(query); - if (!results.Success()) { - LogError("Error in GetTradeRecipe, re-query: [{}]", query.c_str()); - LogError("Error in GetTradeRecipe, error: [{}]", results.ErrorMessage().c_str()); - return false; - } - } + if (!results.Success()) { + LogError("Error in GetTradeRecipe, re-query: [{}]", query.c_str()); + LogError("Error in GetTradeRecipe, error: [{}]", results.ErrorMessage().c_str()); + return false; + } + } if (results.RowCount() < 1) return false; @@ -1373,23 +1374,30 @@ bool ZoneDatabase::GetTradeRecipe( } for (auto row = results.begin(); row != results.end(); ++row) { - int ccnt = 0; + int component_count = 0; for (int x = EQ::invbag::SLOT_BEGIN; x < EQ::invtype::WORLD_SIZE; x++) { const EQ::ItemInstance* inst = container->GetItem(x); if(!inst) continue; - const EQ::ItemData* item = GetItem(inst->GetItem()->ID); + const EQ::ItemData* item = database.GetItem(inst->GetItem()->ID); if (!item) continue; if (item->ID == atoi(row[0])) { - ccnt++; + component_count++; } + + LogTradeskills( + "[GetTradeRecipe] Component count loop [{}] item [{}] recipe component_count [{}]", + component_count, + item->ID, + atoi(row[1]) + ); } - if (ccnt != atoi(row[1])) { + if (component_count != atoi(row[1])) { return false; } }