Public feed
#889931
Index: src/game/GuildHandler.cpp
===================================================================
--- src/game/GuildHandler.cpp (revision 5129)
+++ src/game/GuildHandler.cpp (working copy)
@@ -1219,6 +1219,7 @@
pGuild->StoreItem(BankTabDst, &BankTabSlotDst, pItemDst);
pItemDst->FSetState(ITEM_NEW);
pItemSrc->SetCount(pItemSrc->GetCount()-SplitedAmount);
+ pItemSrc->FSetState(ITEM_CHANGED);
pItemSrc->SaveToDB();
pItemDst->SaveToDB();
CharacterDatabase.PExecute("REPLACE INTO `guild_bank_item` (`guildid`,`TabId`,`SlotId`,`item_guid`) "
@@ -1232,9 +1233,6 @@
{
pGuild->EmptyBankSlot(BankTab, BankTabSlot);// 'empty' moved to BankTabSlot
- CharacterDatabase.PExecute("DELETE FROM `guild_bank_item` WHERE `guildid`='%u' AND `TabId`='%u' AND `SlotId`='%u'",
- GuildId, uint32(BankTabDst), uint32(BankTabSlotDst));
-
pGuild->StoreItem(BankTabDst, &BankTabSlotDst, pItemSrc);
// pItemSrc moved to BankTabSlotDst
@@ -1275,6 +1273,7 @@
}
else
{
+ pItemSrc->FSetState(ITEM_CHANGED);
pItemSrc->SaveToDB();
}
@@ -1342,10 +1341,10 @@
uint32 Count = pItemBank->GetCount();
uint16 Dest;
uint8 msg;
- msg = GetPlayer()->CanStoreItem(NULL_BAG, NULL_SLOT, Dest, pItemBank, false);
+ msg = pl->CanStoreItem(NULL_BAG, NULL_SLOT, Dest, pItemBank, false);
if( msg == EQUIP_ERR_OK )
{
- Item *pItemStacked = GetPlayer()->StoreItem(Dest, pItemBank, true); // This cause item state to change
+ Item *pItemStacked = pl->StoreItem(Dest, pItemBank, true); // This cause item state to change
pGuild->EmptyBankSlot(BankTab, BankTabSlot);// Delete from bank table
if (pItemStacked == pItemBank) // In case stacked to player, do not execute
{
@@ -1361,12 +1360,12 @@
}
else
{
- GetPlayer()->SendEquipError( msg, pItemBank, NULL );
+ pl->SendEquipError( msg, pItemBank, NULL );
CharacterDatabase.RollbackTransaction();
return;
}
pGuild->LogBankEvent(GUILD_BANK_LOG_WITHDRAW_ITEM, BankTab, pl->GetGUIDLow(), Entry, Count);
- pGuild->MemberItemWithdraw(BankTab, GetPlayer()->GetGUIDLow());
+ pGuild->MemberItemWithdraw(BankTab, pl->GetGUIDLow());
CharacterDatabase.CommitTransaction();
pGuild->DisplayGuildBankContent(this, BankTab);
return;
@@ -1443,7 +1442,6 @@
pItemBank->SetCount(pItemBank->GetCount()-SplitedAmount);
pItemChar->SetState(ITEM_CHANGED);
pItemChar->SaveToDB();
- pItemBank->FSetState(ITEM_CHANGED);
if (pItemBank->GetCount() == 0) // We emptied the bank slot
{
pItemBank->RemoveFromWorld();
@@ -1451,7 +1449,10 @@
pGuild->EmptyBankSlot(BankTab, BankTabSlot);
}
else
+ {
+ pItemBank->FSetState(ITEM_CHANGED);
pItemBank->SaveToDB();
+ }
}
else // Bank <-> Char swap items
{
@@ -1469,7 +1470,7 @@
return;
}
- // if can store in invnetory
+ // if can store in inventory
// check possibility store in bank
// prevent unexpected merge in bank item
@@ -1528,8 +1529,14 @@
//first be sure char item is saved
pItemChar->SaveToDB();
// autostore can be set or not
- pGuild->StoreItem(BankTab, &BankTabSlot, pItemChar);
+ Item *pRetItem = pGuild->StoreItem(BankTab, &BankTabSlot, pItemChar);
+ if (pRetItem == pItemChar)
+ {
+ sLog.outDebug("Failed to put item in bank");
+ CharacterDatabase.RollbackTransaction();
+ return;
+ }
pItemChar->RemoveFromUpdateQueueOf(pl);
pItemChar->DestroyForPlayer(pl);
pl->RemoveItem(PlayerBag, PlayerSlot, true);
@@ -1544,6 +1551,12 @@
}
else
{
+ if (pGuild->GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab)==0)
+ {
+ sLog.outDebug("GUILDBANK: Player tried to swap an item with no withdraw right!!");
+ CharacterDatabase.RollbackTransaction();
+ return;
+ }
if(pItemChar->GetEntry()==pItemBank->GetEntry() && pItemBank->GetCount() < pItemBank->GetMaxStackCount())
{
if(SplitedAmount + pItemBank->GetCount() > pItemBank->GetMaxStackCount())