mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Guild bank hopefully fixed.
This commit is contained in:
parent
eba214eb8a
commit
57126880cf
6 changed files with 126 additions and 202 deletions
|
|
@ -643,22 +643,21 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder)
|
|||
if(guild)
|
||||
{
|
||||
data.Initialize(SMSG_GUILD_EVENT, (2+guild->GetMOTD().size()+1));
|
||||
data << (uint8)GE_MOTD;
|
||||
data << (uint8)1;
|
||||
data << uint8(GE_MOTD);
|
||||
data << uint8(1);
|
||||
data << guild->GetMOTD();
|
||||
SendPacket(&data);
|
||||
DEBUG_LOG( "WORLD: Sent guild-motd (SMSG_GUILD_EVENT)" );
|
||||
|
||||
guild->DisplayGuildBankTabsInfo(this);
|
||||
|
||||
data.Initialize(SMSG_GUILD_EVENT, (5+10)); // we guess size
|
||||
data<<(uint8)GE_SIGNED_ON;
|
||||
data<<(uint8)1;
|
||||
data<<pCurrChar->GetName();
|
||||
data<<pCurrChar->GetGUID();
|
||||
data << uint8(GE_SIGNED_ON);
|
||||
data << uint8(1);
|
||||
data << pCurrChar->GetName();
|
||||
data << pCurrChar->GetGUID();
|
||||
guild->BroadcastPacket(&data);
|
||||
DEBUG_LOG( "WORLD: Sent guild-signed-on (SMSG_GUILD_EVENT)" );
|
||||
|
||||
// Increment online members of the guild
|
||||
guild->IncOnlineMemberCount();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -673,9 +672,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder)
|
|||
data << uint32(0);
|
||||
SendPacket(&data);
|
||||
|
||||
if(!pCurrChar->isAlive())
|
||||
pCurrChar->SendCorpseReclaimDelay(true);
|
||||
|
||||
pCurrChar->SendInitialPacketsBeforeAddToMap();
|
||||
|
||||
//Show cinematic at the first time that player login
|
||||
|
|
|
|||
|
|
@ -45,15 +45,12 @@ Guild::Guild()
|
|||
m_CreatedMonth = 0;
|
||||
m_CreatedDay = 0;
|
||||
|
||||
m_EventLogLoaded = false;
|
||||
m_GuildBankLoaded = false;
|
||||
m_OnlineMembers = 0;
|
||||
m_GuildBankMoney = 0;
|
||||
m_PurchasedTabs = 0;
|
||||
|
||||
m_GuildEventLogNextGuid = 0;
|
||||
m_GuildBankEventLogNextGuid_Money = 0;
|
||||
for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; i++)
|
||||
for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
|
||||
m_GuildBankEventLogNextGuid_Item[i] = 0;
|
||||
}
|
||||
|
||||
|
|
@ -305,9 +302,9 @@ bool Guild::LoadRanksFromDB(QueryResult *guildRanksResult)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (guildId > m_Id)
|
||||
//we loaded all ranks for this guild already, break cycle
|
||||
if (guildId > m_Id) //we loaded all ranks for this guild already, break cycle
|
||||
break;
|
||||
|
||||
uint32 rankID = fields[1].GetUInt32();
|
||||
std::string rankName = fields[2].GetCppString();
|
||||
uint32 rankRights = fields[3].GetUInt32();
|
||||
|
|
@ -316,12 +313,12 @@ bool Guild::LoadRanksFromDB(QueryResult *guildRanksResult)
|
|||
if (rankID != m_Ranks.size()) // guild_rank.ids are sequence 0,1,2,3..
|
||||
broken_ranks = true;
|
||||
|
||||
//first rank is guildmaster, prevent loss leader rights
|
||||
// first rank is guildmaster, prevent loss leader rights
|
||||
if (m_Ranks.empty())
|
||||
rankRights |= GR_RIGHT_ALL;
|
||||
|
||||
AddRank(rankName,rankRights,rankMoney);
|
||||
}while( guildRanksResult->NextRow() );
|
||||
AddRank(rankName, rankRights, rankMoney);
|
||||
} while( guildRanksResult->NextRow() );
|
||||
|
||||
if (m_Ranks.size() < GUILD_RANKS_MIN_COUNT) // if too few ranks, renew them
|
||||
{
|
||||
|
|
@ -419,7 +416,7 @@ bool Guild::LoadMembersFromDB(QueryResult *guildMembersResult)
|
|||
|
||||
members[GUID_LOPART(guid)] = newmember;
|
||||
|
||||
}while (guildMembersResult->NextRow());
|
||||
} while (guildMembersResult->NextRow());
|
||||
|
||||
if (members.empty())
|
||||
return false;
|
||||
|
|
@ -580,7 +577,7 @@ void Guild::BroadcastToOfficers(WorldSession *session, const std::string& msg, u
|
|||
for(MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
{
|
||||
WorldPacket data;
|
||||
ChatHandler::FillMessageData(&data, session, CHAT_MSG_OFFICER, language, NULL, 0, msg.c_str(),NULL);
|
||||
ChatHandler::FillMessageData(&data, session, CHAT_MSG_OFFICER, language, NULL, 0, msg.c_str(), NULL);
|
||||
|
||||
Player *pl = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER));
|
||||
|
||||
|
|
@ -789,7 +786,7 @@ void Guild::Query(WorldSession *session)
|
|||
data << m_Id;
|
||||
data << m_Name;
|
||||
|
||||
for (size_t i = 0 ; i < 10; ++i) // show always 10 ranks
|
||||
for (size_t i = 0 ; i < GUILD_RANKS_MAX_COUNT; ++i) // show always 10 ranks
|
||||
{
|
||||
if (i < m_Ranks.size())
|
||||
data << m_Ranks[i].Name;
|
||||
|
|
@ -826,14 +823,6 @@ void Guild::UpdateLogoutTime(uint64 guid)
|
|||
return;
|
||||
|
||||
itr->second.LogoutTime = time(NULL);
|
||||
|
||||
if (m_OnlineMembers > 0)
|
||||
--m_OnlineMembers;
|
||||
else
|
||||
{
|
||||
UnloadGuildBank();
|
||||
UnloadGuildEventLog();
|
||||
}
|
||||
}
|
||||
|
||||
// *************************************************
|
||||
|
|
@ -842,10 +831,6 @@ void Guild::UpdateLogoutTime(uint64 guid)
|
|||
// Display guild eventlog
|
||||
void Guild::DisplayGuildEventLog(WorldSession *session)
|
||||
{
|
||||
// Load guild eventlog, if not already done
|
||||
if (!m_EventLogLoaded)
|
||||
LoadGuildEventLogFromDB();
|
||||
|
||||
// Sending result
|
||||
WorldPacket data(MSG_GUILD_EVENT_LOG_QUERY, 0);
|
||||
// count, max count == 100
|
||||
|
|
@ -872,10 +857,6 @@ void Guild::DisplayGuildEventLog(WorldSession *session)
|
|||
// Load guild eventlog from DB
|
||||
void Guild::LoadGuildEventLogFromDB()
|
||||
{
|
||||
// Return if already loaded
|
||||
if (m_EventLogLoaded)
|
||||
return;
|
||||
|
||||
// 0 1 2 3 4 5
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp FROM guild_eventlog WHERE guildid=%u ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_EVENTLOG_MAX_RECORDS);
|
||||
if (!result)
|
||||
|
|
@ -908,18 +889,6 @@ void Guild::LoadGuildEventLogFromDB()
|
|||
|
||||
} while( result->NextRow() );
|
||||
delete result;
|
||||
|
||||
m_EventLogLoaded = true;
|
||||
}
|
||||
|
||||
// Unload guild eventlog
|
||||
void Guild::UnloadGuildEventLog()
|
||||
{
|
||||
if (!m_EventLogLoaded)
|
||||
return;
|
||||
|
||||
m_GuildEventLog.clear();
|
||||
m_EventLogLoaded = false;
|
||||
}
|
||||
|
||||
// Add entry to guild eventlog
|
||||
|
|
@ -953,20 +922,20 @@ void Guild::DisplayGuildBankContent(WorldSession *session, uint8 TabId)
|
|||
{
|
||||
GuildBankTab const* tab = m_TabListMap[TabId];
|
||||
|
||||
if (!IsMemberHaveRights(session->GetPlayer()->GetGUIDLow(),TabId,GUILD_BANK_RIGHT_VIEW_TAB))
|
||||
if (!IsMemberHaveRights(session->GetPlayer()->GetGUIDLow(), TabId, GUILD_BANK_RIGHT_VIEW_TAB))
|
||||
return;
|
||||
|
||||
WorldPacket data(SMSG_GUILD_BANK_LIST,1200);
|
||||
WorldPacket data(SMSG_GUILD_BANK_LIST, 1200);
|
||||
|
||||
data << uint64(GetGuildBankMoney());
|
||||
data << uint8(TabId);
|
||||
// remaining slots for today
|
||||
data << uint32(GetMemberSlotWithdrawRem(session->GetPlayer()->GetGUIDLow(), TabId));
|
||||
data << uint8(0); // Tell client this is a tab content packet
|
||||
data << uint8(0); // Tell client that there's no tab info in this packet
|
||||
|
||||
data << uint8(GUILD_BANK_MAX_SLOTS);
|
||||
|
||||
for (int i=0; i<GUILD_BANK_MAX_SLOTS; ++i)
|
||||
for (int i = 0; i < GUILD_BANK_MAX_SLOTS; ++i)
|
||||
AppendDisplayGuildBankSlot(data, tab, i);
|
||||
|
||||
session->SendPacket(&data);
|
||||
|
|
@ -974,14 +943,14 @@ void Guild::DisplayGuildBankContent(WorldSession *session, uint8 TabId)
|
|||
sLog.outDebug("WORLD: Sent (SMSG_GUILD_BANK_LIST)");
|
||||
}
|
||||
|
||||
void Guild::DisplayGuildBankMoneyUpdate()
|
||||
void Guild::DisplayGuildBankMoneyUpdate(WorldSession *session)
|
||||
{
|
||||
WorldPacket data(SMSG_GUILD_BANK_LIST, 8+1+4+1+1);
|
||||
|
||||
data << uint64(GetGuildBankMoney());
|
||||
data << uint8(0); // TabId, default 0
|
||||
data << uint32(0); // slot withdrow, default 0
|
||||
data << uint8(0); // Tell client this is a tab content packet
|
||||
data << uint32(GetMemberSlotWithdrawRem(session->GetPlayer()->GetGUIDLow(), 0));
|
||||
data << uint8(0); // Tell that there's no tab info in this packet
|
||||
data << uint8(0); // not send items
|
||||
BroadcastPacket(&data);
|
||||
|
||||
|
|
@ -992,25 +961,24 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, int32 slot1, int32 slot2)
|
|||
{
|
||||
GuildBankTab const* tab = m_TabListMap[TabId];
|
||||
|
||||
WorldPacket data(SMSG_GUILD_BANK_LIST,1200);
|
||||
WorldPacket data(SMSG_GUILD_BANK_LIST, 1200);
|
||||
|
||||
data << uint64(GetGuildBankMoney());
|
||||
data << uint8(TabId);
|
||||
// remaining slots for today
|
||||
|
||||
size_t rempos = data.wpos();
|
||||
data << uint32(0); // will be filled later
|
||||
data << uint8(0); // Tell client this is a tab content packet
|
||||
data << uint32(0); // item withdraw amount, will be filled later
|
||||
data << uint8(0); // Tell client that there's no tab info in this packet
|
||||
|
||||
if (slot2 == -1) // single item in slot1
|
||||
{
|
||||
data << uint8(1);
|
||||
data << uint8(1); // item count
|
||||
|
||||
AppendDisplayGuildBankSlot(data, tab, slot1);
|
||||
}
|
||||
else // 2 items (in slot1 and slot2)
|
||||
{
|
||||
data << uint8(2);
|
||||
data << uint8(2); // item count
|
||||
|
||||
if (slot1 > slot2)
|
||||
std::swap(slot1,slot2);
|
||||
|
|
@ -1040,15 +1008,14 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, GuildItemPosCountVec cons
|
|||
{
|
||||
GuildBankTab const* tab = m_TabListMap[TabId];
|
||||
|
||||
WorldPacket data(SMSG_GUILD_BANK_LIST,1200);
|
||||
WorldPacket data(SMSG_GUILD_BANK_LIST, 1200);
|
||||
|
||||
data << uint64(GetGuildBankMoney());
|
||||
data << uint8(TabId);
|
||||
// remaining slots for today
|
||||
|
||||
size_t rempos = data.wpos();
|
||||
data << uint32(0); // will be filled later
|
||||
data << uint8(0); // Tell client this is a tab content packet
|
||||
data << uint32(0); // item withdraw amount, will be filled later
|
||||
data << uint8(0); // Tell client that there's no tab info in this packet
|
||||
|
||||
data << uint8(slots.size()); // updates count
|
||||
|
||||
|
|
@ -1084,16 +1051,12 @@ Item* Guild::GetItem(uint8 TabId, uint8 SlotId)
|
|||
|
||||
void Guild::DisplayGuildBankTabsInfo(WorldSession *session)
|
||||
{
|
||||
// Time to load bank if not already done
|
||||
if (!m_GuildBankLoaded)
|
||||
LoadGuildBankFromDB();
|
||||
|
||||
WorldPacket data(SMSG_GUILD_BANK_LIST, 500);
|
||||
|
||||
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 << uint8(1); // Tell Client this is a TabInfo packet
|
||||
data << uint32(GetMemberSlotWithdrawRem(session->GetPlayer()->GetGUIDLow(), 0));
|
||||
data << uint8(1); // Tell client that this packet includes tab info
|
||||
|
||||
data << uint8(m_PurchasedTabs); // here is the number of tabs
|
||||
|
||||
|
|
@ -1148,17 +1111,11 @@ uint32 Guild::GetBankRights(uint32 rankId, uint8 TabId) const
|
|||
}
|
||||
|
||||
// *************************************************
|
||||
// Guild bank loading/unloading related
|
||||
// Guild bank loading related
|
||||
|
||||
// This load should be called when the bank is first accessed by a guild member
|
||||
// This load should be called on startup only
|
||||
void Guild::LoadGuildBankFromDB()
|
||||
{
|
||||
if (m_GuildBankLoaded)
|
||||
return;
|
||||
|
||||
m_GuildBankLoaded = true;
|
||||
LoadGuildBankEventLogFromDB();
|
||||
|
||||
// 0 1 2 3
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT TabId, TabName, TabIcon, TabText FROM guild_bank_tab WHERE guildid='%u' ORDER BY TabId", m_Id);
|
||||
if (!result)
|
||||
|
|
@ -1235,29 +1192,6 @@ void Guild::LoadGuildBankFromDB()
|
|||
delete result;
|
||||
}
|
||||
|
||||
// This unload should be called when the last member of the guild gets offline
|
||||
void Guild::UnloadGuildBank()
|
||||
{
|
||||
if (!m_GuildBankLoaded)
|
||||
return;
|
||||
for (uint8 i = 0 ; i < m_PurchasedTabs ; ++i )
|
||||
{
|
||||
for (uint8 j = 0 ; j < GUILD_BANK_MAX_SLOTS ; ++j)
|
||||
{
|
||||
if (m_TabListMap[i]->Slots[j])
|
||||
{
|
||||
m_TabListMap[i]->Slots[j]->RemoveFromWorld();
|
||||
delete m_TabListMap[i]->Slots[j];
|
||||
}
|
||||
}
|
||||
delete m_TabListMap[i];
|
||||
}
|
||||
m_TabListMap.clear();
|
||||
|
||||
UnloadGuildBankEventLog();
|
||||
m_GuildBankLoaded = false;
|
||||
}
|
||||
|
||||
// *************************************************
|
||||
// Money deposit/withdraw related
|
||||
|
||||
|
|
@ -1330,7 +1264,7 @@ bool Guild::IsMemberHaveRights(uint32 LowGuid, uint8 TabId, uint32 rights) const
|
|||
if (itr->second.RankId == GR_GUILDMASTER)
|
||||
return true;
|
||||
|
||||
return (GetBankRights(itr->second.RankId,TabId) & rights)==rights;
|
||||
return (GetBankRights(itr->second.RankId,TabId) & rights) == rights;
|
||||
}
|
||||
|
||||
uint32 Guild::GetMemberSlotWithdrawRem(uint32 LowGuid, uint8 TabId)
|
||||
|
|
@ -1342,7 +1276,7 @@ uint32 Guild::GetMemberSlotWithdrawRem(uint32 LowGuid, uint8 TabId)
|
|||
if (itr->second.RankId == GR_GUILDMASTER)
|
||||
return WITHDRAW_SLOT_UNLIMITED;
|
||||
|
||||
if ((GetBankRights(itr->second.RankId,TabId) & GUILD_BANK_RIGHT_VIEW_TAB)!=GUILD_BANK_RIGHT_VIEW_TAB)
|
||||
if ((GetBankRights(itr->second.RankId,TabId) & GUILD_BANK_RIGHT_VIEW_TAB) != GUILD_BANK_RIGHT_VIEW_TAB)
|
||||
return 0;
|
||||
|
||||
uint32 curTime = uint32(time(NULL)/MINUTE);
|
||||
|
|
@ -1350,7 +1284,7 @@ uint32 Guild::GetMemberSlotWithdrawRem(uint32 LowGuid, uint8 TabId)
|
|||
{
|
||||
itr->second.BankResetTimeTab[TabId] = curTime;
|
||||
itr->second.BankRemSlotsTab[TabId] = GetBankSlotPerDay(itr->second.RankId, TabId);
|
||||
CharacterDatabase.PExecute("UPDATE guild_member SET BankResetTimeTab%u='%u',BankRemSlotsTab%u='%u' WHERE guildid='%u' AND guid='%u'",
|
||||
CharacterDatabase.PExecute("UPDATE guild_member SET BankResetTimeTab%u='%u', BankRemSlotsTab%u='%u' WHERE guildid='%u' AND guid='%u'",
|
||||
uint32(TabId), itr->second.BankResetTimeTab[TabId], uint32(TabId), itr->second.BankRemSlotsTab[TabId], m_Id, LowGuid);
|
||||
}
|
||||
return itr->second.BankRemSlotsTab[TabId];
|
||||
|
|
@ -1371,7 +1305,7 @@ uint32 Guild::GetMemberMoneyWithdrawRem(uint32 LowGuid)
|
|||
{
|
||||
itr->second.BankResetTimeMoney = curTime;
|
||||
itr->second.BankRemMoney = GetBankMoneyPerDay(itr->second.RankId);
|
||||
CharacterDatabase.PExecute("UPDATE guild_member SET BankResetTimeMoney='%u',BankRemMoney='%u' WHERE guildid='%u' AND guid='%u'",
|
||||
CharacterDatabase.PExecute("UPDATE guild_member SET BankResetTimeMoney='%u', BankRemMoney='%u' WHERE guildid='%u' AND guid='%u'",
|
||||
itr->second.BankResetTimeMoney, itr->second.BankRemMoney, m_Id, LowGuid);
|
||||
}
|
||||
return itr->second.BankRemMoney;
|
||||
|
|
@ -1496,7 +1430,7 @@ void Guild::LoadGuildBankEventLogFromDB()
|
|||
|
||||
//uint32 configCount = sWorld.getConfig(CONFIG_GUILD_BANK_EVENT_LOG_COUNT);
|
||||
//cycle through all purchased guild bank item tabs
|
||||
for (uint32 tabId = 0; tabId < m_PurchasedTabs; tabId++)
|
||||
for (uint32 tabId = 0; tabId < m_PurchasedTabs; ++tabId)
|
||||
{
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid, ItemOrMoney, ItemStackCount, DestTabId, TimeStamp FROM guild_bank_eventlog WHERE guildid='%u' AND TabId='%u' ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, tabId, GUILD_BANK_MAX_LOGS);
|
||||
|
|
@ -1576,14 +1510,6 @@ void Guild::LoadGuildBankEventLogFromDB()
|
|||
delete result;
|
||||
}
|
||||
|
||||
void Guild::UnloadGuildBankEventLog()
|
||||
{
|
||||
m_GuildBankEventLog_Money.clear();
|
||||
|
||||
for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
|
||||
m_GuildBankEventLog_Item[i].clear();
|
||||
}
|
||||
|
||||
void Guild::DisplayGuildBankLogs(WorldSession *session, uint8 TabId)
|
||||
{
|
||||
if (TabId > GUILD_BANK_MAX_TABS)
|
||||
|
|
@ -1709,23 +1635,30 @@ void Guild::AppendDisplayGuildBankSlot( WorldPacket& data, GuildBankTab const *t
|
|||
data << uint32(entry);
|
||||
if (entry)
|
||||
{
|
||||
// random item property id +8
|
||||
data << (uint32) pItem->GetItemRandomPropertyId();
|
||||
data << uint32(0); // 3.3.0 (0x8000, 0x8020)
|
||||
data << uint32(pItem->GetItemRandomPropertyId()); // random item property id + 8
|
||||
|
||||
if (pItem->GetItemRandomPropertyId())
|
||||
// SuffixFactor +4
|
||||
data << (uint32) pItem->GetItemSuffixFactor();
|
||||
// +12 // ITEM_FIELD_STACK_COUNT
|
||||
data << uint32(pItem->GetCount());
|
||||
data << uint32(0); // +16 // Unknown value
|
||||
data << uint8(0); // unknown 2.4.2
|
||||
if (uint32 Enchant0 = pItem->GetEnchantmentId(PERM_ENCHANTMENT_SLOT))
|
||||
data << uint32(pItem->GetItemSuffixFactor()); // SuffixFactor + 4
|
||||
|
||||
data << uint32(pItem->GetCount()); // +12 ITEM_FIELD_STACK_COUNT
|
||||
data << uint32(0); // +16 Unknown value
|
||||
data << uint8(0); // +20
|
||||
|
||||
uint8 enchCount = 0;
|
||||
size_t enchCountPos = data.wpos();
|
||||
|
||||
data << uint8(enchCount); // number of enchantments
|
||||
for(uint32 i = PERM_ENCHANTMENT_SLOT; i < MAX_ENCHANTMENT_SLOT; ++i)
|
||||
{
|
||||
data << uint8(1); // number of enchantments (max 3) why max 3?
|
||||
data << uint8(PERM_ENCHANTMENT_SLOT); // enchantment slot (range: 0:2)
|
||||
data << uint32(Enchant0); // enchantment id
|
||||
if(uint32 enchId = pItem->GetEnchantmentId(EnchantmentSlot(i)))
|
||||
{
|
||||
data << uint8(i);
|
||||
data << uint32(enchId);
|
||||
++enchCount;
|
||||
}
|
||||
else
|
||||
data << uint8(0); // no enchantments (0)
|
||||
}
|
||||
data.put<uint8>(enchCountPos, enchCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1745,11 +1678,11 @@ Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pIte
|
|||
|
||||
if (itr == dest.end())
|
||||
{
|
||||
lastItem = _StoreItem(tabId,slot,pItem,count,false);
|
||||
lastItem = _StoreItem(tabId, slot, pItem, count, false);
|
||||
break;
|
||||
}
|
||||
|
||||
lastItem = _StoreItem(tabId,slot,pItem,count,true);
|
||||
lastItem = _StoreItem(tabId, slot, pItem, count, true);
|
||||
}
|
||||
|
||||
return lastItem;
|
||||
|
|
@ -1781,7 +1714,7 @@ 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;
|
||||
}
|
||||
|
|
@ -1789,7 +1722,7 @@ Item* Guild::_StoreItem( uint8 tab, uint8 slot, Item *pItem, uint32 count, bool
|
|||
{
|
||||
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)
|
||||
{
|
||||
|
|
@ -1842,7 +1775,7 @@ uint8 Guild::_CanStoreItem_InSpecificSlot( uint8 tab, uint8 slot, GuildItemPosCo
|
|||
if (need_space > count)
|
||||
need_space = count;
|
||||
|
||||
GuildItemPosCount newPosition = GuildItemPosCount(slot,need_space);
|
||||
GuildItemPosCount newPosition = GuildItemPosCount(slot, need_space);
|
||||
if (!newPosition.isContainedIn(dest))
|
||||
{
|
||||
dest.push_back(newPosition);
|
||||
|
|
@ -1854,7 +1787,7 @@ uint8 Guild::_CanStoreItem_InSpecificSlot( uint8 tab, uint8 slot, GuildItemPosCo
|
|||
|
||||
uint8 Guild::_CanStoreItem_InTab( uint8 tab, GuildItemPosCountVec &dest, uint32& count, bool merge, Item* pSrcItem, uint8 skip_slot ) const
|
||||
{
|
||||
for (uint32 j = 0; j < GUILD_BANK_MAX_SLOTS; j++)
|
||||
for (uint32 j = 0; j < GUILD_BANK_MAX_SLOTS; ++j)
|
||||
{
|
||||
// skip specific slot already processed in first called _CanStoreItem_InSpecificSlot
|
||||
if (j == skip_slot)
|
||||
|
|
@ -1878,7 +1811,7 @@ uint8 Guild::_CanStoreItem_InTab( uint8 tab, GuildItemPosCountVec &dest, uint32&
|
|||
if (need_space > count)
|
||||
need_space = count;
|
||||
|
||||
GuildItemPosCount newPosition = GuildItemPosCount(j,need_space);
|
||||
GuildItemPosCount newPosition = GuildItemPosCount(j, need_space);
|
||||
if (!newPosition.isContainedIn(dest))
|
||||
{
|
||||
dest.push_back(newPosition);
|
||||
|
|
@ -1895,7 +1828,7 @@ uint8 Guild::_CanStoreItem_InTab( uint8 tab, GuildItemPosCountVec &dest, uint32&
|
|||
if (need_space > count)
|
||||
need_space = count;
|
||||
|
||||
GuildItemPosCount newPosition = GuildItemPosCount(j,need_space);
|
||||
GuildItemPosCount newPosition = GuildItemPosCount(j, need_space);
|
||||
if (!newPosition.isContainedIn(dest))
|
||||
{
|
||||
dest.push_back(newPosition);
|
||||
|
|
@ -1930,12 +1863,12 @@ uint8 Guild::CanStoreItem( uint8 tab, uint8 slot, GuildItemPosCountVec &dest, ui
|
|||
return EQUIP_ERR_OK;
|
||||
}
|
||||
|
||||
// not specific slot or have spece for partly store only in specific slot
|
||||
// not specific slot or have space for partly store only in specific slot
|
||||
|
||||
// search stack in tab for merge to
|
||||
if (pItem->GetMaxStackCount() > 1)
|
||||
{
|
||||
uint8 res = _CanStoreItem_InTab(tab,dest,count,true,pItem,slot);
|
||||
uint8 res = _CanStoreItem_InTab(tab, dest, count, true, pItem, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
return res;
|
||||
|
||||
|
|
@ -1944,7 +1877,7 @@ uint8 Guild::CanStoreItem( uint8 tab, uint8 slot, GuildItemPosCountVec &dest, ui
|
|||
}
|
||||
|
||||
// search free slot in bag for place to
|
||||
uint8 res = _CanStoreItem_InTab(tab,dest,count,false,pItem,slot);
|
||||
uint8 res = _CanStoreItem_InTab(tab, dest, count, false, pItem, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
return res;
|
||||
|
||||
|
|
@ -1966,7 +1899,7 @@ void Guild::SetGuildBankTabText(uint8 TabId, std::string text)
|
|||
if (m_TabListMap[TabId]->Text == text)
|
||||
return;
|
||||
|
||||
utf8truncate(text,500); // DB and client size limitation
|
||||
utf8truncate(text, 500); // DB and client size limitation
|
||||
|
||||
m_TabListMap[TabId]->Text = text;
|
||||
|
||||
|
|
@ -2023,7 +1956,7 @@ void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankT
|
|||
if (SplitedAmount)
|
||||
{ // Bank -> Bank item split (in empty or non empty slot
|
||||
GuildItemPosCountVec dest;
|
||||
uint8 msg = CanStoreItem(BankTabDst,BankTabSlotDst,dest,SplitedAmount,pItemSrc,false);
|
||||
uint8 msg = CanStoreItem(BankTabDst, BankTabSlotDst, dest, SplitedAmount, pItemSrc, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pl->SendEquipError( msg, pItemSrc, NULL );
|
||||
|
|
@ -2044,13 +1977,13 @@ void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankT
|
|||
pItemSrc->SetCount( pItemSrc->GetCount() - SplitedAmount );
|
||||
pItemSrc->FSetState(ITEM_CHANGED);
|
||||
pItemSrc->SaveToDB(); // not in inventory and can be save standalone
|
||||
StoreItem(BankTabDst,dest,pNewItem);
|
||||
StoreItem(BankTabDst, dest, pNewItem);
|
||||
CharacterDatabase.CommitTransaction();
|
||||
}
|
||||
else // non split
|
||||
{
|
||||
GuildItemPosCountVec gDest;
|
||||
uint8 msg = CanStoreItem(BankTabDst,BankTabSlotDst,gDest,pItemSrc->GetCount(),pItemSrc,false);
|
||||
uint8 msg = CanStoreItem(BankTabDst,BankTabSlotDst,gDest,pItemSrc->GetCount(), pItemSrc, false);
|
||||
if (msg == EQUIP_ERR_OK) // merge to
|
||||
{
|
||||
CharacterDatabase.BeginTransaction();
|
||||
|
|
@ -2063,7 +1996,7 @@ void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankT
|
|||
else // swap
|
||||
{
|
||||
gDest.clear();
|
||||
msg = CanStoreItem(BankTabDst,BankTabSlotDst,gDest,pItemSrc->GetCount(),pItemSrc,true);
|
||||
msg = CanStoreItem(BankTabDst, BankTabSlotDst, gDest, pItemSrc->GetCount(), pItemSrc, true);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pl->SendEquipError( msg, pItemSrc, NULL );
|
||||
|
|
@ -2071,7 +2004,7 @@ void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankT
|
|||
}
|
||||
|
||||
GuildItemPosCountVec gSrc;
|
||||
msg = CanStoreItem(BankTab,BankTabSlot,gSrc,pItemDst->GetCount(),pItemDst,true);
|
||||
msg = CanStoreItem(BankTab, BankTabSlot, gSrc, pItemDst->GetCount(), pItemDst, true);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pl->SendEquipError( msg, pItemDst, NULL );
|
||||
|
|
@ -2101,9 +2034,9 @@ void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankT
|
|||
CharacterDatabase.CommitTransaction();
|
||||
}
|
||||
}
|
||||
DisplayGuildBankContentUpdate(BankTab,BankTabSlot,BankTab == BankTabDst ? BankTabSlotDst : -1);
|
||||
DisplayGuildBankContentUpdate(BankTab, BankTabSlot, BankTab == BankTabDst ? BankTabSlotDst : -1);
|
||||
if (BankTab != BankTabDst)
|
||||
DisplayGuildBankContentUpdate(BankTabDst,BankTabSlotDst);
|
||||
DisplayGuildBankContentUpdate(BankTabDst, BankTabSlotDst);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2152,7 +2085,7 @@ void Guild::MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, u
|
|||
pItemBank->SetCount(pItemBank->GetCount()-SplitedAmount);
|
||||
pItemBank->FSetState(ITEM_CHANGED);
|
||||
pItemBank->SaveToDB(); // not in inventory and can be save standalone
|
||||
pl->MoveItemToInventory(dest,pNewItem,true);
|
||||
pl->MoveItemToInventory(dest, pNewItem, true);
|
||||
pl->SaveInventoryAndGoldToDB();
|
||||
|
||||
MemberItemWithdraw(BankTab, pl->GetGUIDLow());
|
||||
|
|
@ -2173,7 +2106,7 @@ void Guild::MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, u
|
|||
LogBankEvent(GUILD_BANK_LOG_WITHDRAW_ITEM, BankTab, pl->GetGUIDLow(), pItemBank->GetEntry(), pItemBank->GetCount());
|
||||
|
||||
RemoveItem(BankTab, BankTabSlot);
|
||||
pl->MoveItemToInventory(dest,pItemBank,true);
|
||||
pl->MoveItemToInventory(dest, pItemBank, true);
|
||||
pl->SaveInventoryAndGoldToDB();
|
||||
|
||||
MemberItemWithdraw(BankTab, pl->GetGUIDLow());
|
||||
|
|
@ -2225,7 +2158,7 @@ void Guild::MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, u
|
|||
{
|
||||
sLog.outCommand(pl->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
|
||||
pl->GetName(),pl->GetSession()->GetAccountId(),
|
||||
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
|
||||
pItemChar->GetProto()->Name1, pItemChar->GetEntry(), pItemChar->GetCount(),
|
||||
m_Id);
|
||||
}
|
||||
}
|
||||
|
|
@ -2244,14 +2177,14 @@ void Guild::MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, u
|
|||
|
||||
if (pItemChar)
|
||||
StoreItem(BankTab, gDest, pItemChar);
|
||||
pl->MoveItemToInventory(iDest,pItemBank,true);
|
||||
pl->MoveItemToInventory(iDest, pItemBank, true);
|
||||
pl->SaveInventoryAndGoldToDB();
|
||||
|
||||
MemberItemWithdraw(BankTab, pl->GetGUIDLow());
|
||||
CharacterDatabase.CommitTransaction();
|
||||
}
|
||||
}
|
||||
DisplayGuildBankContentUpdate(BankTab,BankTabSlot);
|
||||
DisplayGuildBankContentUpdate(BankTab, BankTabSlot);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2281,7 +2214,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot,
|
|||
if (SplitedAmount)
|
||||
{ // Char -> Bank split to empty or non-empty slot (partly move)
|
||||
GuildItemPosCountVec dest;
|
||||
uint8 msg = CanStoreItem(BankTab,BankTabSlot,dest,SplitedAmount,pItemChar,false);
|
||||
uint8 msg = CanStoreItem(BankTab, BankTabSlot, dest, SplitedAmount, pItemChar, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pl->SendEquipError( msg, pItemChar, NULL );
|
||||
|
|
@ -2300,7 +2233,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot,
|
|||
{
|
||||
sLog.outCommand(pl->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
|
||||
pl->GetName(),pl->GetSession()->GetAccountId(),
|
||||
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),SplitedAmount,m_Id);
|
||||
pItemChar->GetProto()->Name1, pItemChar->GetEntry(), SplitedAmount, m_Id);
|
||||
}
|
||||
|
||||
CharacterDatabase.BeginTransaction();
|
||||
|
|
@ -2313,12 +2246,12 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot,
|
|||
StoreItem(BankTab, dest, pNewItem);
|
||||
CharacterDatabase.CommitTransaction();
|
||||
|
||||
DisplayGuildBankContentUpdate(BankTab,dest);
|
||||
DisplayGuildBankContentUpdate(BankTab, dest);
|
||||
}
|
||||
else // Char -> Bank swap with empty or non-empty (move)
|
||||
{
|
||||
GuildItemPosCountVec dest;
|
||||
uint8 msg = CanStoreItem(BankTab,BankTabSlot,dest,pItemChar->GetCount(),pItemChar,false);
|
||||
uint8 msg = CanStoreItem(BankTab, BankTabSlot, dest, pItemChar->GetCount(), pItemChar, false);
|
||||
if (msg == EQUIP_ERR_OK) // merge
|
||||
{
|
||||
// logging item move to bank
|
||||
|
|
@ -2326,7 +2259,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot,
|
|||
{
|
||||
sLog.outCommand(pl->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
|
||||
pl->GetName(),pl->GetSession()->GetAccountId(),
|
||||
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
|
||||
pItemChar->GetProto()->Name1, pItemChar->GetEntry(), pItemChar->GetCount(),
|
||||
m_Id);
|
||||
}
|
||||
|
||||
|
|
@ -2336,11 +2269,11 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot,
|
|||
pl->MoveItemFromInventory(PlayerBag, PlayerSlot, true);
|
||||
pItemChar->DeleteFromInventoryDB();
|
||||
|
||||
StoreItem(BankTab,dest,pItemChar);
|
||||
StoreItem(BankTab, dest, pItemChar);
|
||||
pl->SaveInventoryAndGoldToDB();
|
||||
CharacterDatabase.CommitTransaction();
|
||||
|
||||
DisplayGuildBankContentUpdate(BankTab,dest);
|
||||
DisplayGuildBankContentUpdate(BankTab, dest);
|
||||
}
|
||||
else // Char <-> Bank swap items (posible NULL bank item)
|
||||
{
|
||||
|
|
@ -2356,7 +2289,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot,
|
|||
}
|
||||
|
||||
GuildItemPosCountVec gDest;
|
||||
msg = CanStoreItem(BankTab,BankTabSlot,gDest,pItemChar->GetCount(),pItemChar,true);
|
||||
msg = CanStoreItem(BankTab, BankTabSlot, gDest, pItemChar->GetCount(), pItemChar, true);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pl->SendEquipError( msg, pItemChar, NULL );
|
||||
|
|
@ -2376,7 +2309,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot,
|
|||
{
|
||||
sLog.outCommand(pl->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
|
||||
pl->GetName(),pl->GetSession()->GetAccountId(),
|
||||
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
|
||||
pItemChar->GetProto()->Name1, pItemChar->GetEntry(), pItemChar->GetCount(),
|
||||
m_Id);
|
||||
}
|
||||
|
||||
|
|
@ -2390,22 +2323,22 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot,
|
|||
if (pItemBank)
|
||||
RemoveItem(BankTab, BankTabSlot);
|
||||
|
||||
StoreItem(BankTab,gDest,pItemChar);
|
||||
StoreItem(BankTab, gDest, pItemChar);
|
||||
if (pItemBank)
|
||||
pl->MoveItemToInventory(iDest,pItemBank,true);
|
||||
pl->MoveItemToInventory(iDest, pItemBank, true);
|
||||
pl->SaveInventoryAndGoldToDB();
|
||||
if (pItemBank)
|
||||
MemberItemWithdraw(BankTab, pl->GetGUIDLow());
|
||||
CharacterDatabase.CommitTransaction();
|
||||
|
||||
DisplayGuildBankContentUpdate(BankTab,gDest);
|
||||
DisplayGuildBankContentUpdate(BankTab, gDest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GuildItemPosCount::isContainedIn(GuildItemPosCountVec const &vec) const
|
||||
{
|
||||
for(GuildItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end();++itr)
|
||||
for(GuildItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end(); ++itr)
|
||||
if (itr->Slot == this->Slot)
|
||||
return true;
|
||||
|
||||
|
|
|
|||
|
|
@ -383,14 +383,13 @@ class Guild
|
|||
void UpdateLogoutTime(uint64 guid);
|
||||
// Guild EventLog
|
||||
void LoadGuildEventLogFromDB();
|
||||
void UnloadGuildEventLog();
|
||||
void DisplayGuildEventLog(WorldSession *session);
|
||||
void LogGuildEvent(uint8 EventType, uint32 PlayerGuid1, uint32 PlayerGuid2, uint8 NewRank);
|
||||
|
||||
// ** Guild bank **
|
||||
// Content & item deposit/withdraw
|
||||
void DisplayGuildBankContent(WorldSession *session, uint8 TabId);
|
||||
void DisplayGuildBankMoneyUpdate();
|
||||
void DisplayGuildBankMoneyUpdate(WorldSession *session);
|
||||
|
||||
void SwapItems( Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTabDst, uint8 BankTabSlotDst, uint32 SplitedAmount);
|
||||
void MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 PlayerBag, uint8 PlayerSlot, uint32 SplitedAmount);
|
||||
|
|
@ -406,11 +405,8 @@ class Guild
|
|||
uint32 GetBankRights(uint32 rankId, uint8 TabId) const;
|
||||
bool IsMemberHaveRights(uint32 LowGuid, uint8 TabId,uint32 rights) const;
|
||||
bool CanMemberViewTab(uint32 LowGuid, uint8 TabId) const;
|
||||
// Load/unload
|
||||
// Load
|
||||
void LoadGuildBankFromDB();
|
||||
void UnloadGuildBank();
|
||||
bool IsGuildBankLoaded() const { return m_GuildBankLoaded; }
|
||||
void IncOnlineMemberCount() { ++m_OnlineMembers; }
|
||||
// Money deposit/withdraw
|
||||
void SendMoneyInfo(WorldSession *session, uint32 LowGuid);
|
||||
bool MemberMoneyWithdraw(uint32 amount, uint32 LowGuid);
|
||||
|
|
@ -428,7 +424,6 @@ class Guild
|
|||
bool LoadBankRightsFromDB(QueryResult *guildBankTabRightsResult);
|
||||
// Guild Bank Event Logs
|
||||
void LoadGuildBankEventLogFromDB();
|
||||
void UnloadGuildBankEventLog();
|
||||
void DisplayGuildBankLogs(WorldSession *session, uint8 TabId);
|
||||
void LogBankEvent(uint8 EventType, uint8 TabId, uint32 PlayerGuidLow, uint32 ItemOrMoney, uint8 ItemStackCount=0, uint8 DestTabId=0);
|
||||
bool AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry );
|
||||
|
|
@ -469,9 +464,6 @@ class Guild
|
|||
uint32 m_GuildBankEventLogNextGuid_Money;
|
||||
uint32 m_GuildBankEventLogNextGuid_Item[GUILD_BANK_MAX_TABS];
|
||||
|
||||
bool m_GuildBankLoaded;
|
||||
bool m_EventLogLoaded;
|
||||
uint32 m_OnlineMembers;
|
||||
uint64 m_GuildBankMoney;
|
||||
uint8 m_PurchasedTabs;
|
||||
|
||||
|
|
|
|||
|
|
@ -887,7 +887,7 @@ void WorldSession::HandleGuildBankQueryTab( WorldPacket & recv_data )
|
|||
if (!pGuild)
|
||||
return;
|
||||
|
||||
if (!pGuild->IsGuildBankLoaded() || TabId >= pGuild->GetPurchasedTabs())
|
||||
if (TabId >= pGuild->GetPurchasedTabs())
|
||||
return;
|
||||
|
||||
// Let's update the amount of gold the player can withdraw before displaying the content
|
||||
|
|
@ -921,7 +921,7 @@ void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data )
|
|||
if (!pGuild)
|
||||
return;
|
||||
|
||||
if (!pGuild->IsGuildBankLoaded() || !pGuild->GetPurchasedTabs())
|
||||
if (!pGuild->GetPurchasedTabs())
|
||||
return;
|
||||
|
||||
CharacterDatabase.BeginTransaction();
|
||||
|
|
@ -944,7 +944,7 @@ void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data )
|
|||
|
||||
pGuild->DisplayGuildBankTabsInfo(this);
|
||||
pGuild->DisplayGuildBankContent(this, 0);
|
||||
pGuild->DisplayGuildBankMoneyUpdate();
|
||||
pGuild->DisplayGuildBankMoneyUpdate(this);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data )
|
||||
|
|
@ -969,7 +969,7 @@ void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data )
|
|||
if(!pGuild)
|
||||
return;
|
||||
|
||||
if (!pGuild->IsGuildBankLoaded() || !pGuild->GetPurchasedTabs())
|
||||
if (!pGuild->GetPurchasedTabs())
|
||||
return;
|
||||
|
||||
if (pGuild->GetGuildBankMoney()<money) // not enough money in bank
|
||||
|
|
@ -997,7 +997,7 @@ void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data )
|
|||
pGuild->SendMoneyInfo(this, GetPlayer()->GetGUIDLow());
|
||||
pGuild->DisplayGuildBankTabsInfo(this);
|
||||
pGuild->DisplayGuildBankContent(this, 0);
|
||||
pGuild->DisplayGuildBankMoneyUpdate();
|
||||
pGuild->DisplayGuildBankMoneyUpdate(this);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
|
||||
|
|
@ -1026,7 +1026,7 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
Guild *pGuild = sObjectMgr.GetGuildById(GuildId);
|
||||
if (!pGuild || !pGuild->IsGuildBankLoaded())
|
||||
if (!pGuild)
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent additional spam at rejected packet
|
||||
return;
|
||||
|
|
@ -1128,7 +1128,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data )
|
|||
return;
|
||||
|
||||
// m_PurchasedTabs = 0 when buying Tab 0, that is why this check can be made
|
||||
if (!pGuild->IsGuildBankLoaded() || TabId != pGuild->GetPurchasedTabs())
|
||||
if (TabId != pGuild->GetPurchasedTabs())
|
||||
return;
|
||||
|
||||
uint32 TabCost = GetGuildBankTabPrice(TabId) * GOLD;
|
||||
|
|
@ -1177,7 +1177,7 @@ void WorldSession::HandleGuildBankUpdateTab( WorldPacket & recv_data )
|
|||
if (!pGuild)
|
||||
return;
|
||||
|
||||
if (!pGuild->IsGuildBankLoaded() || TabId >= pGuild->GetPurchasedTabs())
|
||||
if (TabId >= pGuild->GetPurchasedTabs())
|
||||
return;
|
||||
|
||||
pGuild->SetGuildBankTabInfo(TabId, Name, IconIndex);
|
||||
|
|
@ -1200,9 +1200,6 @@ void WorldSession::HandleGuildBankLogQuery( WorldPacket & recv_data )
|
|||
if (!pGuild)
|
||||
return;
|
||||
|
||||
if (!pGuild->IsGuildBankLoaded())
|
||||
return;
|
||||
|
||||
// GUILD_BANK_MAX_TABS send by client for money log
|
||||
if (TabId >= pGuild->GetPurchasedTabs() && TabId != GUILD_BANK_MAX_TABS)
|
||||
return;
|
||||
|
|
@ -1225,7 +1222,7 @@ void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recv_data)
|
|||
if (!pGuild)
|
||||
return;
|
||||
|
||||
if (!pGuild->IsGuildBankLoaded() || TabId >= pGuild->GetPurchasedTabs())
|
||||
if (TabId >= pGuild->GetPurchasedTabs())
|
||||
return;
|
||||
|
||||
pGuild->SendGuildBankTabText(this, TabId);
|
||||
|
|
@ -1248,7 +1245,7 @@ void WorldSession::HandleSetGuildBankTabText(WorldPacket &recv_data)
|
|||
if (!pGuild)
|
||||
return;
|
||||
|
||||
if (!pGuild->IsGuildBankLoaded() || TabId >= pGuild->GetPurchasedTabs())
|
||||
if (TabId >= pGuild->GetPurchasedTabs())
|
||||
return;
|
||||
|
||||
pGuild->SetGuildBankTabText(TabId, Text);
|
||||
|
|
|
|||
|
|
@ -3021,9 +3021,11 @@ void ObjectMgr::LoadGuilds()
|
|||
delete newGuild;
|
||||
continue;
|
||||
}
|
||||
newGuild->LoadGuildEventLogFromDB();
|
||||
newGuild->LoadGuildBankEventLogFromDB();
|
||||
newGuild->LoadGuildBankFromDB();
|
||||
AddGuild(newGuild);
|
||||
|
||||
}while( result->NextRow() );
|
||||
} while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
delete guildRanksResult;
|
||||
|
|
|
|||
|
|
@ -18713,8 +18713,6 @@ void Player::SendInitialPacketsBeforeAddToMap()
|
|||
{
|
||||
GetSocial()->SendSocialList();
|
||||
|
||||
// guild bank list wtf?
|
||||
|
||||
// Homebind
|
||||
WorldPacket data(SMSG_BINDPOINTUPDATE, 5*4);
|
||||
data << m_homebindX << m_homebindY << m_homebindZ;
|
||||
|
|
@ -18725,11 +18723,13 @@ void Player::SendInitialPacketsBeforeAddToMap()
|
|||
// SMSG_SET_PROFICIENCY
|
||||
// SMSG_SET_PCT_SPELL_MODIFIER
|
||||
// SMSG_SET_FLAT_SPELL_MODIFIER
|
||||
// SMSG_UPDATE_AURA_DURATION
|
||||
|
||||
SendTalentsInfoData(false);
|
||||
|
||||
// SMSG_INSTANCE_DIFFICULTY
|
||||
data.Initialize(SMSG_INSTANCE_DIFFICULTY, 4+4);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
GetSession()->SendPacket(&data);
|
||||
|
||||
SendInitialSpells();
|
||||
|
||||
|
|
@ -18739,11 +18739,16 @@ void Player::SendInitialPacketsBeforeAddToMap()
|
|||
|
||||
SendInitialActionButtons();
|
||||
m_reputationMgr.SendInitialReputations();
|
||||
// SMSG_INIT_WORLD_STATES
|
||||
m_achievementMgr.SendAllAchievementData();
|
||||
|
||||
if(!isAlive())
|
||||
SendCorpseReclaimDelay(true);
|
||||
|
||||
SendInitWorldStates(GetZoneId(), GetAreaId());
|
||||
|
||||
SendEquipmentSetList();
|
||||
|
||||
m_achievementMgr.SendAllAchievementData();
|
||||
|
||||
data.Initialize(SMSG_LOGIN_SETTIMESPEED, 4 + 4 + 4);
|
||||
data << uint32(secsToTimeBitFields(sWorld.GetGameTime()));
|
||||
data << (float)0.01666667f; // game speed
|
||||
|
|
@ -18752,7 +18757,6 @@ void Player::SendInitialPacketsBeforeAddToMap()
|
|||
|
||||
// SMSG_TALENTS_INFO x 2 for pet (unspent points and talents in separate packets...)
|
||||
// SMSG_PET_GUIDS
|
||||
// SMSG_UPDATE_WORLD_STATE
|
||||
// SMSG_POWER_UPDATE
|
||||
|
||||
// set fly flag if in fly form or taxi flight to prevent visually drop at ground in showup moment
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue