aboutsummaryrefslogtreecommitdiff
path: root/src/game/Guild.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Guild.cpp')
-rw-r--r--src/game/Guild.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp
index a39dff1183d..495d64f786f 100644
--- a/src/game/Guild.cpp
+++ b/src/game/Guild.cpp
@@ -1085,7 +1085,7 @@ void Guild::DisplayGuildBankTabsInfo(WorldSession *session)
data << uint64(GetGuildBankMoney());
data << uint8(0); // TabInfo packet must be for TabId 0
- //data << uint32(0xFFFFFFFF); // bit 9 must be set for this packet to work
+ //data << uint32(0xFFFFFFFF); // bit 9 must be set for this packet to work
data << uint32(0);
data << uint8(1); // Tell Client this is a TabInfo packet
data << uint8(m_PurchasedTabs); // here is the number of tabs
@@ -1739,7 +1739,7 @@ Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pIte
return lastItem;
}
-// Return stored item (if stored to stack, it can diff. from pItem). And pItem ca be deleted in this case.
+// Return stored item (if stored to stack, it can diff. from pItem). And pItem can be deleted in this case.
Item* Guild::_StoreItem( uint8 tab, uint8 slot, Item *pItem, uint32 count, bool clone )
{
if (!pItem)
@@ -1765,15 +1765,15 @@ Item* Guild::_StoreItem( uint8 tab, uint8 slot, Item *pItem, uint32 count, bool
pItem->SetUInt64Value(ITEM_FIELD_OWNER, 0);
AddGBankItemToDB(GetId(), tab, slot, pItem->GetGUIDLow(), pItem->GetEntry());
pItem->FSetState(ITEM_NEW);
- pItem->SaveToDB(); // not in onventory and can be save standalone
+ pItem->SaveToDB(); // not in inventory and can be save standalone
return pItem;
}
else
{
- pItem2->SetCount( pItem2->GetCount() + count );
+ pItem2->SetCount(pItem2->GetCount() + count);
pItem2->FSetState(ITEM_CHANGED);
- pItem2->SaveToDB(); // not in onventory and can be save standalone
+ pItem2->SaveToDB(); // not in inventory and can be save standalone
if (!clone)
{
@@ -1981,7 +1981,7 @@ void Guild::SendGuildBankTabText(WorldSession *session, uint8 TabId)
BroadcastPacket(&data);
}
-void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTabDst, uint8 BankTabSlotDst, uint32 SplitedAmount )
+void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTabDst, uint8 BankTabSlotDst, uint32 SplitedAmount)
{
// empty operation
if (BankTab == BankTabDst && BankTabSlot == BankTabSlotDst)
@@ -1991,9 +1991,14 @@ void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankT
if (!pItemSrc) // may prevent crash
return;
- if (SplitedAmount > pItemSrc->GetCount())
- return; // cheating?
- else if (SplitedAmount == pItemSrc->GetCount())
+ if (pItemSrc->GetCount() == 0)
+ {
+ sLog.outCrash("Guild::SwapItems: Player %s(GUIDLow: %u) tried to move item %u from tab %u slot %u to tab %u slot %u, but item %u has a stack of zero!",
+ pl->GetName(), pl->GetGUIDLow(), pItemSrc->GetEntry(), BankTab, BankTabSlot, BankTabDst, BankTabSlotDst, pItemSrc->GetEntry());
+ //return; // Commented out for now, uncomment when it's verified that this causes a crash!!
+ }
+
+ if (SplitedAmount >= pItemSrc->GetCount())
SplitedAmount = 0; // no split
Item *pItemDst = GetItem(BankTabDst, BankTabSlotDst);