aboutsummaryrefslogtreecommitdiff
path: root/src/game/Spell.cpp
diff options
context:
space:
mode:
authorSpp <none@none>2010-03-09 21:11:54 +0100
committerSpp <none@none>2010-03-09 21:11:54 +0100
commit9df357f5d99a8204b866b1148b433734642cf47b (patch)
tree691311268683b4d2e16fdd4a3d0168334f1a79e4 /src/game/Spell.cpp
parent6c725aa5305f57d0fd8f4257db45f39c15c9d39e (diff)
Fix enchant items in trade window.
Original patch by Kierkegaard closes issue #985 --HG-- branch : trunk
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r--src/game/Spell.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index f0c5acc48eb..7f2b0a76017 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -208,18 +208,16 @@ void SpellCastTargets::Update(Unit* caster)
NULL;
m_itemTarget = NULL;
- if(caster->GetTypeId() == TYPEID_PLAYER)
+ if (caster->GetTypeId() == TYPEID_PLAYER)
{
if(m_targetMask & TARGET_FLAG_ITEM)
m_itemTarget = caster->ToPlayer()->GetItemByGuid(m_itemTargetGUID);
- else if(m_targetMask & TARGET_FLAG_TRADE_ITEM)
- {
- // here it is not guid but slot
- Player* pTrader = caster->ToPlayer()->GetTrader();
- if(pTrader && m_itemTargetGUID < TRADE_SLOT_COUNT)
- m_itemTarget = pTrader->GetItemByGuid(m_itemTargetGUID);
- }
- if(m_itemTarget)
+ else if (m_targetMask & TARGET_FLAG_TRADE_ITEM)
+ if (m_itemTargetGUID == TRADE_SLOT_NONTRADED) // here it is not guid but slot. Also prevent hacking slots
+ if (Player* pTrader = caster->ToPlayer()->GetTrader())
+ m_itemTarget = pTrader->GetItemByTradeSlot(m_itemTargetGUID);
+
+ if (m_itemTarget)
m_itemTargetEntry = m_itemTarget->GetEntry();
}
}