aboutsummaryrefslogtreecommitdiff
path: root/src/game/Item.cpp
diff options
context:
space:
mode:
authorTrazom62 <none@none>2010-05-31 19:10:26 +0200
committerTrazom62 <none@none>2010-05-31 19:10:26 +0200
commit15847b2f2f8be359f7d152a9f088c4a4052e9622 (patch)
tree7ebe081787b9a60cabd2f66c58578d58b93ec104 /src/game/Item.cpp
parent1a636d3af87ff1390925c407f93e49bb687027b6 (diff)
Fix exploit with swaping already looted items.
Patch by Vladimir from idea of Zhenya. Fixes issue #702. --HG-- branch : trunk
Diffstat (limited to 'src/game/Item.cpp')
-rw-r--r--src/game/Item.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/game/Item.cpp b/src/game/Item.cpp
index cbb27666033..4cfd9484f9f 100644
--- a/src/game/Item.cpp
+++ b/src/game/Item.cpp
@@ -705,6 +705,9 @@ bool Item::IsEquipped() const
bool Item::CanBeTraded(bool mail) const
{
+ if (m_lootGenerated)
+ return false;
+
if ((!mail || !IsBoundAccountWide()) && IsSoulBound())
return false;
@@ -766,6 +769,23 @@ bool Item::IsBoundByEnchant() const
return false;
}
+uint8 Item::CanBeMergedPartlyWith(ItemPrototype const* proto) const
+{
+ // not allow merge looting currently items
+ if (m_lootGenerated)
+ return EQUIP_ERR_ALREADY_LOOTED;
+
+ // check item type
+ if (GetEntry() != proto->ItemId)
+ return EQUIP_ERR_ITEM_CANT_STACK;
+
+ // check free space (full stacks can't be target of merge
+ if (GetCount() >= proto->GetMaxStackSize())
+ return EQUIP_ERR_ITEM_CANT_STACK;
+
+ return EQUIP_ERR_OK;
+}
+
bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
{
ItemPrototype const* proto = GetProto();