diff options
author | click <none@none> | 2010-09-27 05:41:13 +0200 |
---|---|---|
committer | click <none@none> | 2010-09-27 05:41:13 +0200 |
commit | 88420cdcd1963371e9576533a6a8f2b811ffc793 (patch) | |
tree | 3c992a56f2bad5dd3d8cd76bb160365715367c05 | |
parent | ee705bba3216ffa2ee20030225aca336b47ed20f (diff) |
Core/Spells: Do not allow adding USE-enhancements on items that already has a Use: spell. Fixes a possible exploit (original fix by Leak)
(Cleaned up to adhere to codingstandards)
Closes issue 4185.
--HG--
branch : trunk
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index b8b8c0a2c81..a18011da109 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3423,6 +3423,25 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex) SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return; + + // Prevent applying enchanements with Use: spell on items that already have a Use: effect, this is usually blocked from client side and + // can only be bypassed with memory manipulation. + for (int s = 0; s < 3; ++s) + { + if (pEnchant->type[s] == ITEM_ENCHANTMENT_TYPE_USE_SPELL) + { + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + { + ItemPrototype const *proto = itemTarget->GetProto(); + if (proto->Spells[i].SpellId && proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE) + { + sLog.outError("Exploiting attempt: Player %s(GUID: %u) tried to apply an enchanement with Use: spell on an item that already has a Use: effect," + " this should be blocked from client side.", p_caster->GetName(), p_caster->GetGUIDLow()); + return; + } + } + } + } // item can be in trade slot and have owner diff. from caster Player* item_owner = itemTarget->GetOwner(); |