* Combine container size is checked before displaying favorite recipes or when searching for a recipe. This fixes an issue where you could combine any recipe in a 2 slot container or in any container smaller than the number of required components.

* World containers that do not have ID values default to size 10 based as all world containers that are not transmitting ID values appear to have 10 slots.
This commit is contained in:
Daerath 2018-01-21 10:17:31 -05:00
parent 26532c03ac
commit 7892fed6d9

View File

@ -11690,10 +11690,15 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app)
// make where clause segment for container(s)
std::string containers;
if (tsf->some_id == 0)
uint32 combineObjectSlots;
if (tsf->some_id == 0) {
containers += StringFormat(" = %u ", tsf->object_type); // world combiner so no item number
else
combineObjectSlots = 10;
}
else {
containers += StringFormat(" in (%u, %u) ", tsf->object_type, tsf->some_id); // container in inventory
combineObjectSlots = database.GetItem(tsf->some_id)->BagSlots;
}
std::string favoriteIDs; //gotta be big enough for 500 IDs
bool first = true;
@ -11725,8 +11730,8 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app)
"((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) "
"OR (tr.must_learn & 0x3 = 0)) "
"GROUP BY tr.id "
"HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 "
"LIMIT 100 ", CharacterID(), favoriteIDs.c_str(), containers.c_str());
"HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 AND SUM(tre.componentcount) <= %u "
"LIMIT 100 ", CharacterID(), favoriteIDs.c_str(), containers.c_str(), combineObjectSlots);
TradeskillSearchResults(query, tsf->object_type, tsf->some_id);
return;
@ -11748,13 +11753,16 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app)
// make where clause segment for container(s)
char containers[30];
uint32 combineObjectSlots;
if (rss->some_id == 0) {
// world combiner so no item number
snprintf(containers, 29, "= %u", rss->object_type);
combineObjectSlots = 10;
}
else {
// container in inventory
snprintf(containers, 29, "in (%u,%u)", rss->object_type, rss->some_id);
combineObjectSlots = database.GetItem(rss->some_id)->BagSlots;
}
std::string searchClause;
@ -11779,10 +11787,10 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app)
"AND crl.madecount IS NOT NULL) "
"OR (tr.must_learn & 0x3 = 0)) "
"GROUP BY tr.id "
"HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 "
"HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 AND SUM(tre.componentcount) <= %u "
"LIMIT 200 ",
CharacterID(), searchClause.c_str(),
rss->mintrivial, rss->maxtrivial, containers);
rss->mintrivial, rss->maxtrivial, containers, combineObjectSlots);
TradeskillSearchResults(query, rss->object_type, rss->some_id);
return;
}