Fix SendTradeskillSearchResults row count was incorrect format. Remove extra database hits from last commit.

This commit is contained in:
Natedog2012 2021-09-22 21:43:47 -05:00
parent 9aac12f517
commit bf8d94eb35
2 changed files with 19 additions and 16 deletions

View File

@ -12198,7 +12198,8 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app)
tr.name,
tr.trivial,
SUM(tre.componentcount),
tr.tradeskill
tr.tradeskill,
tr.must_learn
FROM
tradeskill_recipe AS tr
LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id = tre.recipe_id
@ -12298,7 +12299,8 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app)
tr.name,
tr.trivial,
SUM(tre.componentcount),
tr.tradeskill
tr.tradeskill,
tr.must_learn
FROM
tradeskill_recipe AS tr
LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id = tre.recipe_id

View File

@ -782,7 +782,7 @@ void Client::SendTradeskillSearchResults(
for (auto row = results.begin(); row != results.end(); ++row) {
if (row == nullptr || row[0] == nullptr || row[1] == nullptr || row[2] == nullptr || row[3] == nullptr ||
row[5] == nullptr) {
row[4] == nullptr || row[5] == nullptr) {
continue;
}
@ -790,35 +790,36 @@ void Client::SendTradeskillSearchResults(
const char *name = row[1];
uint32 trivial = (uint32) atoi(row[2]);
uint32 comp_count = (uint32) atoi(row[3]);
uint32 tradeskill = (uint16) atoi(row[5]);
uint32 tradeskill = (uint16) atoi(row[4]);
uint32 must_learn = (uint16) atoi(row[5]);
// Skip the recipes that exceed the threshold in skill difference
// Recipes that have either been made before or were
// explicitly learned are excempt from that limit
auto character_learned_recipe = CharacterRecipeListRepository::GetRecipe(
character_learned_recipe_list,
recipe_id
);
if (RuleB(Skills, UseLimitTradeskillSearchSkillDiff) &&
((int32) trivial - (int32) GetSkill((EQ::skills::SkillType) tradeskill)) >
RuleI(Skills, MaxTradeskillSearchSkillDiff)) {
LogTradeskills("Checking limit recipe_id [{}] name [{}]", recipe_id, name);
auto character_learned_recipe = CharacterRecipeListRepository::GetRecipe(
character_learned_recipe_list,
recipe_id
);
if (character_learned_recipe.made_count == 0) {
continue;
}
}
//Check if we need to learn it before sending them the recipe..
DBTradeskillRecipe_Struct spec;
if (content_db.GetTradeRecipe(recipe_id, objtype, someid, this->CharacterID(), &spec)) {
if ((spec.must_learn & 0xf) && !spec.has_learnt) {
continue;
}
//Skip recipes that must be learned
if ((must_learn & 0xf) && !character_learned_recipe.recipe_id) {
continue;
}
auto outapp = new EQApplicationPacket(OP_RecipeReply, sizeof(RecipeReply_Struct));
RecipeReply_Struct *reply = (RecipeReply_Struct *) outapp->pBuffer;