mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-31 09:33:47 +00:00
fix(Core): Fix guild bank update broadcasts (#13520)
Fix guild bank update broadcasts
This commit is contained in:
@@ -1798,8 +1798,14 @@ void Guild::SendBankTabData(WorldSession* session, uint8 tabId, bool sendAllSlot
|
|||||||
_SendBankContent(session, tabId, sendAllSlots);
|
_SendBankContent(session, tabId, sendAllSlots);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::SendBankTabsInfo(WorldSession* session, bool sendAllSlots /*= false*/) const
|
void Guild::SendBankTabsInfo(WorldSession* session, bool sendAllSlots /*= false*/)
|
||||||
{
|
{
|
||||||
|
Member* member = GetMember(session->GetPlayer()->GetGUID());
|
||||||
|
if (!member)
|
||||||
|
return;
|
||||||
|
|
||||||
|
member->SubscribeToGuildBankUpdatePackets();
|
||||||
|
|
||||||
_SendBankList(session, 0, sendAllSlots);
|
_SendBankList(session, 0, sendAllSlots);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1809,12 +1815,17 @@ void Guild::SendBankTabText(WorldSession* session, uint8 tabId) const
|
|||||||
tab->SendText(this, session);
|
tab->SendText(this, session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::SendPermissions(WorldSession* session) const
|
void Guild::SendPermissions(WorldSession* session)
|
||||||
{
|
{
|
||||||
Member const* member = GetMember(session->GetPlayer()->GetGUID());
|
Member* member = GetMember(session->GetPlayer()->GetGUID());
|
||||||
if (!member)
|
if (!member)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// We are unsubscribing here since it is the only reliable way to handle /reload from player as
|
||||||
|
// GuildPermissionsQuery is sent on each reload, and we don't want to send partial changes while client
|
||||||
|
// doesn't know the full state
|
||||||
|
member->UnsubscribeFromGuildBankUpdatePackets();
|
||||||
|
|
||||||
uint8 rankId = member->GetRankId();
|
uint8 rankId = member->GetRankId();
|
||||||
|
|
||||||
WorldPackets::Guild::GuildPermissionsQueryResults queryResult;
|
WorldPackets::Guild::GuildPermissionsQueryResults queryResult;
|
||||||
@@ -1857,8 +1868,6 @@ void Guild::SendLoginInfo(WorldSession* session)
|
|||||||
|
|
||||||
LOG_DEBUG("guild", "SMSG_GUILD_EVENT [{}] MOTD", session->GetPlayerInfo());
|
LOG_DEBUG("guild", "SMSG_GUILD_EVENT [{}] MOTD", session->GetPlayerInfo());
|
||||||
|
|
||||||
SendBankTabsInfo(session);
|
|
||||||
|
|
||||||
Player* player = session->GetPlayer();
|
Player* player = session->GetPlayer();
|
||||||
|
|
||||||
HandleRoster(session);
|
HandleRoster(session);
|
||||||
@@ -2878,13 +2887,17 @@ void Guild::_SendBankList(WorldSession* session /* = nullptr*/, uint8 tabId /*=
|
|||||||
LOG_DEBUG("guild", "SMSG_GUILD_BANK_LIST [{}]: TabId: {}, FullSlots: {}, slots: {}",
|
LOG_DEBUG("guild", "SMSG_GUILD_BANK_LIST [{}]: TabId: {}, FullSlots: {}, slots: {}",
|
||||||
session->GetPlayerInfo(), tabId, sendAllSlots, packet.WithdrawalsRemaining);
|
session->GetPlayerInfo(), tabId, sendAllSlots, packet.WithdrawalsRemaining);
|
||||||
}
|
}
|
||||||
else /// @todo - Probably this is just sent to session + those that have sent CMSG_GUILD_BANKER_ACTIVATE
|
else
|
||||||
{
|
{
|
||||||
packet.Write();
|
packet.Write();
|
||||||
for (auto const& [guid, member] : m_members)
|
for (auto const& [guid, member] : m_members)
|
||||||
{
|
{
|
||||||
|
if (!member.ShouldReceiveBankPartialUpdatePackets())
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!_MemberHasTabRights(member.GetGUID(), tabId, GUILD_BANK_RIGHT_VIEW_TAB))
|
if (!_MemberHasTabRights(member.GetGUID(), tabId, GUILD_BANK_RIGHT_VIEW_TAB))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Player* player = member.FindPlayer();
|
Player* player = member.FindPlayer();
|
||||||
if (!player)
|
if (!player)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -306,7 +306,8 @@ public: // pussywizard: public class Member
|
|||||||
m_class(0),
|
m_class(0),
|
||||||
m_flags(GUILDMEMBER_STATUS_NONE),
|
m_flags(GUILDMEMBER_STATUS_NONE),
|
||||||
m_accountId(0),
|
m_accountId(0),
|
||||||
m_rankId(rankId)
|
m_rankId(rankId),
|
||||||
|
receiveGuildBankUpdatePackets(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,6 +354,10 @@ public: // pussywizard: public class Member
|
|||||||
|
|
||||||
inline Player* FindPlayer() const { return ObjectAccessor::FindConnectedPlayer(m_guid); }
|
inline Player* FindPlayer() const { return ObjectAccessor::FindConnectedPlayer(m_guid); }
|
||||||
|
|
||||||
|
void SubscribeToGuildBankUpdatePackets() { receiveGuildBankUpdatePackets = true; }
|
||||||
|
void UnsubscribeFromGuildBankUpdatePackets() { receiveGuildBankUpdatePackets = false; }
|
||||||
|
[[nodiscard]] bool ShouldReceiveBankPartialUpdatePackets() const { return receiveGuildBankUpdatePackets; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32 m_guildId;
|
uint32 m_guildId;
|
||||||
// Fields from characters table
|
// Fields from characters table
|
||||||
@@ -371,6 +376,8 @@ public: // pussywizard: public class Member
|
|||||||
std::string m_officerNote;
|
std::string m_officerNote;
|
||||||
|
|
||||||
std::array<int32, GUILD_BANK_MAX_TABS + 1> m_bankWithdraw = {};
|
std::array<int32, GUILD_BANK_MAX_TABS + 1> m_bankWithdraw = {};
|
||||||
|
|
||||||
|
bool receiveGuildBankUpdatePackets;
|
||||||
};
|
};
|
||||||
|
|
||||||
// pussywizard: public GetMember
|
// pussywizard: public GetMember
|
||||||
@@ -718,10 +725,10 @@ public:
|
|||||||
void SendInfo(WorldSession* session) const;
|
void SendInfo(WorldSession* session) const;
|
||||||
void SendEventLog(WorldSession* session) const;
|
void SendEventLog(WorldSession* session) const;
|
||||||
void SendBankLog(WorldSession* session, uint8 tabId) const;
|
void SendBankLog(WorldSession* session, uint8 tabId) const;
|
||||||
void SendBankTabsInfo(WorldSession* session, bool showTabs = false) const;
|
void SendBankTabsInfo(WorldSession* session, bool showTabs = false);
|
||||||
void SendBankTabData(WorldSession* session, uint8 tabId, bool sendAllSlots) const;
|
void SendBankTabData(WorldSession* session, uint8 tabId, bool sendAllSlots) const;
|
||||||
void SendBankTabText(WorldSession* session, uint8 tabId) const;
|
void SendBankTabText(WorldSession* session, uint8 tabId) const;
|
||||||
void SendPermissions(WorldSession* session) const;
|
void SendPermissions(WorldSession* session);
|
||||||
void SendMoneyInfo(WorldSession* session) const;
|
void SendMoneyInfo(WorldSession* session) const;
|
||||||
void SendLoginInfo(WorldSession* session);
|
void SendLoginInfo(WorldSession* session);
|
||||||
|
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ void WorldSession::HandleGuildBankerActivate(WorldPackets::Guild::GuildBankActiv
|
|||||||
guild->SendBankTabsInfo(this, packet.FullUpdate);
|
guild->SendBankTabsInfo(this, packet.FullUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when opening guild bank tab only (first one)
|
// Called when opening guild bank tab only
|
||||||
void WorldSession::HandleGuildBankQueryTab(WorldPackets::Guild::GuildBankQueryTab& packet)
|
void WorldSession::HandleGuildBankQueryTab(WorldPackets::Guild::GuildBankQueryTab& packet)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("guild", "CMSG_GUILD_BANK_QUERY_TAB [{}]: Go: [{}], TabId: {}, ShowTabs: {}"
|
LOG_DEBUG("guild", "CMSG_GUILD_BANK_QUERY_TAB [{}]: Go: [{}], TabId: {}, ShowTabs: {}"
|
||||||
|
|||||||
Reference in New Issue
Block a user