aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Loot/Loot.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2025-12-24 11:20:46 +0100
committerShauren <shauren.trinity@gmail.com>2025-12-24 11:20:46 +0100
commit3f1085245cece16c5a3110f56bcfb39f94e12f6c (patch)
treeb278ec61b4456b13f3ff1cfaaec28b4582822cb8 /src/server/game/Loot/Loot.cpp
parent06dee8eabfa02879c5c22b4f083272b84d59d93f (diff)
Core/Items: Replace hardcoded spell id 483 and 55884 checks with item_template.spelltrigger ITEM_SPELLTRIGGER_LEARN_SPELL_ID3.3.5
Diffstat (limited to 'src/server/game/Loot/Loot.cpp')
-rw-r--r--src/server/game/Loot/Loot.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/server/game/Loot/Loot.cpp b/src/server/game/Loot/Loot.cpp
index e4ba699e0ce..7052e47d154 100644
--- a/src/server/game/Loot/Loot.cpp
+++ b/src/server/game/Loot/Loot.cpp
@@ -89,12 +89,33 @@ bool LootItem::AllowedForPlayer(Player const* player, bool isGivenByMasterLooter
}
// Don't allow loot for players without profession or those who already know the recipe
- if (pProto->HasFlag(ITEM_FLAG_HIDE_UNUSABLE_RECIPE) && (!player->HasSkill(pProto->RequiredSkill) || player->HasSpell(pProto->Spells[1].SpellId)))
- return false;
+ if (pProto->HasFlag(ITEM_FLAG_HIDE_UNUSABLE_RECIPE))
+ {
+ if (!player->HasSkill(pProto->RequiredSkill))
+ return false;
+
+ for (_Spell const& itemEffect : pProto->Spells)
+ {
+ if (itemEffect.SpellTrigger != ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
+ continue;
+
+ if (player->HasSpell(itemEffect.SpellId))
+ return false;
+ }
+ }
// Don't allow to loot soulbound recipes that the player has already learned
- if (pProto->Class == ITEM_CLASS_RECIPE && pProto->Bonding == BIND_WHEN_PICKED_UP && pProto->Spells[1].SpellId != 0 && player->HasSpell(pProto->Spells[1].SpellId))
- return false;
+ if (pProto->Class == ITEM_CLASS_RECIPE && pProto->Bonding == BIND_WHEN_PICKED_UP)
+ {
+ for (_Spell const& itemEffect : pProto->Spells)
+ {
+ if (itemEffect.SpellTrigger != ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
+ continue;
+
+ if (player->HasSpell(itemEffect.SpellId))
+ return false;
+ }
+ }
if (needs_quest && !freeforall && player->GetGroup() && (player->GetGroup()->GetLootMethod() == GROUP_LOOT || player->GetGroup()->GetLootMethod() == ROUND_ROBIN) && !ownerGuid.IsEmpty() && ownerGuid != player->GetGUID())
return false;