Merge pull request #1553 from Natedog2012/tradeskill_fix

[Tradeskill] Fix logic in taught tradeskill recipes
This commit is contained in:
Natedog2012 2021-09-29 19:05:41 -05:00 committed by GitHub
commit dd765238f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 10 deletions

View File

@ -12198,7 +12198,8 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app)
tr.name, tr.name,
tr.trivial, tr.trivial,
SUM(tre.componentcount), SUM(tre.componentcount),
tr.tradeskill tr.tradeskill,
tr.must_learn
FROM FROM
tradeskill_recipe AS tr tradeskill_recipe AS tr
LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id = tre.recipe_id 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.name,
tr.trivial, tr.trivial,
SUM(tre.componentcount), SUM(tre.componentcount),
tr.tradeskill tr.tradeskill,
tr.must_learn
FROM FROM
tradeskill_recipe AS tr tradeskill_recipe AS tr
LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id = tre.recipe_id 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) { for (auto row = results.begin(); row != results.end(); ++row) {
if (row == nullptr || row[0] == nullptr || row[1] == nullptr || row[2] == nullptr || row[3] == nullptr || 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; continue;
} }
@ -790,27 +790,36 @@ void Client::SendTradeskillSearchResults(
const char *name = row[1]; const char *name = row[1];
uint32 trivial = (uint32) atoi(row[2]); uint32 trivial = (uint32) atoi(row[2]);
uint32 comp_count = (uint32) atoi(row[3]); 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 // Skip the recipes that exceed the threshold in skill difference
// Recipes that have either been made before or were // Recipes that have either been made before or were
// explicitly learned are excempt from that limit // explicitly learned are excempt from that limit
auto character_learned_recipe = CharacterRecipeListRepository::GetRecipe(
character_learned_recipe_list,
recipe_id
);
if (RuleB(Skills, UseLimitTradeskillSearchSkillDiff) && if (RuleB(Skills, UseLimitTradeskillSearchSkillDiff) &&
((int32) trivial - (int32) GetSkill((EQ::skills::SkillType) tradeskill)) > ((int32) trivial - (int32) GetSkill((EQ::skills::SkillType) tradeskill)) >
RuleI(Skills, MaxTradeskillSearchSkillDiff)) { RuleI(Skills, MaxTradeskillSearchSkillDiff)) {
LogTradeskills("Checking limit recipe_id [{}] name [{}]", recipe_id, name); 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) { if (character_learned_recipe.made_count == 0) {
continue; 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)); auto outapp = new EQApplicationPacket(OP_RecipeReply, sizeof(RecipeReply_Struct));
RecipeReply_Struct *reply = (RecipeReply_Struct *) outapp->pBuffer; RecipeReply_Struct *reply = (RecipeReply_Struct *) outapp->pBuffer;
@ -1489,7 +1498,7 @@ bool ZoneDatabase::GetTradeRecipe(
recipe_id recipe_id
); );
if (character_learned_recipe.made_count > 0) { if (character_learned_recipe.recipe_id) { //If this exists we learned it
LogTradeskills("[GetTradeRecipe] made_count [{}]", character_learned_recipe.made_count); LogTradeskills("[GetTradeRecipe] made_count [{}]", character_learned_recipe.made_count);
spec->has_learnt = true; spec->has_learnt = true;