*Cleanup, search through the talent map instead of spell chains for talent ranks during spec swaps.

Also properly set talent state upon talent reset, and only reset talents that exist in the active spec. Refs #367, #326

--HG--
branch : trunk
This commit is contained in:
maximius committed 2009-11-20 22:38:01 -08:00
1 parent 75e37c7599
commit c16e08faed
4 files changed
+69 -62

No files matched your search

+14 -9
View File
@@ -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);