mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-03 15:47:04 +01:00
Core/Guilds: Send correct opcode when purchasing a new tab and fix data not being saved in db after purchasing the new tab
This commit is contained in:
@@ -639,7 +639,7 @@ void LFGQueue::FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueu
|
||||
std::string sguid = o.str();
|
||||
|
||||
for (LfgCompatibleContainer::const_iterator itr = CompatibleMapStore.begin(); itr != CompatibleMapStore.end(); ++itr)
|
||||
if (itr->second.compatibility == LFG_COMPATIBLES_WITH_LESS_PLAYERS &&
|
||||
if (itr->second.compatibility == LFG_COMPATIBLES_WITH_LESS_PLAYERS &&
|
||||
std::string::npos != itr->first.find(sguid))
|
||||
{
|
||||
UpdateBestCompatibleInQueue(itrQueue, itr->first, itr->second.roles);
|
||||
@@ -650,7 +650,7 @@ void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQu
|
||||
{
|
||||
LfgQueueData& queueData = itrQueue->second;
|
||||
|
||||
uint8 storedSize = queueData.bestCompatible.empty() ? 0 :
|
||||
uint8 storedSize = queueData.bestCompatible.empty() ? 0 :
|
||||
std::count(queueData.bestCompatible.begin(), queueData.bestCompatible.end(), '|') + 1;
|
||||
|
||||
uint8 size = std::count(key.begin(), key.end(), '|') + 1;
|
||||
|
||||
@@ -42,7 +42,7 @@ struct LfgCompatibilityData
|
||||
compatibility(_compatibility), roles(_roles) { }
|
||||
|
||||
LfgCompatibility compatibility;
|
||||
LfgRolesMap roles;
|
||||
LfgRolesMap roles;
|
||||
};
|
||||
|
||||
/// Stores player or group queue info
|
||||
|
||||
@@ -29,6 +29,56 @@
|
||||
#define MAX_GUILD_BANK_TAB_TEXT_LEN 500
|
||||
#define EMBLEM_PRICE 10 * GOLD
|
||||
|
||||
std::string _GetGuildEventString(GuildEvents event)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case GE_PROMOTION:
|
||||
return "Member promotion";
|
||||
case GE_DEMOTION:
|
||||
return "Member demotion";
|
||||
case GE_MOTD:
|
||||
return "Guild MOTD";
|
||||
case GE_JOINED:
|
||||
return "Member joined";
|
||||
case GE_LEFT:
|
||||
return "Member left";
|
||||
case GE_REMOVED:
|
||||
return "Member removed";
|
||||
case GE_LEADER_IS:
|
||||
return "Leader is";
|
||||
case GE_LEADER_CHANGED:
|
||||
return "Leader changed";
|
||||
case GE_DISBANDED:
|
||||
return "Guild disbanded";
|
||||
case GE_TABARDCHANGE:
|
||||
return "Tabard change";
|
||||
case GE_RANK_UPDATED:
|
||||
return "Rank updated";
|
||||
case GE_RANK_DELETED:
|
||||
return "Rank deleted";
|
||||
case GE_SIGNED_ON:
|
||||
return "Member signed on";
|
||||
case GE_SIGNED_OFF:
|
||||
return "Member signed off";
|
||||
case GE_GUILDBANKBAGSLOTS_CHANGED:
|
||||
return "Bank bag slots changed";
|
||||
case GE_BANK_TAB_PURCHASED:
|
||||
return "Bank tab purchased";
|
||||
case GE_BANK_TAB_UPDATED:
|
||||
return "Bank tab updated";
|
||||
case GE_BANK_MONEY_SET:
|
||||
return "Bank money set";
|
||||
case GE_BANK_MONEY_CHANGED:
|
||||
return "Bank money changed";
|
||||
case GE_BANK_TEXT_CHANGED:
|
||||
return "Bank tab text changed";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "<None>";
|
||||
}
|
||||
|
||||
inline uint32 _GetGuildBankTabPrice(uint8 tabId)
|
||||
{
|
||||
switch (tabId)
|
||||
@@ -1428,24 +1478,21 @@ void Guild::HandleBuyBankTab(WorldSession* session, uint8 tabId)
|
||||
if (_GetPurchasedTabsSize() >= GUILD_BANK_MAX_TABS)
|
||||
return;
|
||||
|
||||
if (tabId != _GetPurchasedTabsSize())
|
||||
return;
|
||||
if (tabId != _GetPurchasedTabsSize())
|
||||
return;
|
||||
|
||||
uint32 tabCost = _GetGuildBankTabPrice(tabId) * GOLD;
|
||||
if (!tabCost)
|
||||
return;
|
||||
uint32 tabCost = _GetGuildBankTabPrice(tabId) * GOLD;
|
||||
if (!tabCost)
|
||||
return;
|
||||
|
||||
if (!player->HasEnoughMoney(tabCost)) // Should not happen, this is checked by client
|
||||
return;
|
||||
if (!player->HasEnoughMoney(tabCost)) // Should not happen, this is checked by client
|
||||
return;
|
||||
|
||||
player->ModifyMoney(-int32(tabCost));
|
||||
player->ModifyMoney(-int32(tabCost));
|
||||
|
||||
uint8 rankId = member->GetRankId();
|
||||
_CreateNewBankTab();
|
||||
_SetRankBankMoneyPerDay(rankId, uint32(GUILD_WITHDRAW_MONEY_UNLIMITED));
|
||||
GuildBankRightsAndSlots rightsAndSlots(tabId);
|
||||
_SetRankBankTabRightsAndSlots(rankId, rightsAndSlots);
|
||||
SendBankTabsInfo(session);
|
||||
_BroadcastEvent(GE_BANK_TAB_PURCHASED, 0);
|
||||
SendPermissions(session); /// Hack to force client to update permissions
|
||||
}
|
||||
|
||||
void Guild::HandleInviteMember(WorldSession* session, std::string const& name)
|
||||
@@ -2299,6 +2346,10 @@ void Guild::_CreateNewBankTab()
|
||||
stmt->setUInt8 (1, tabId);
|
||||
trans->Append(stmt);
|
||||
|
||||
++tabId;
|
||||
for (Ranks::iterator itr = m_ranks.begin(); itr != m_ranks.end(); ++itr)
|
||||
(*itr).CreateMissingTabsIfNeeded(tabId, trans, false);
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
@@ -2734,7 +2785,9 @@ void Guild::_BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* par
|
||||
data << uint64(guid);
|
||||
|
||||
BroadcastPacket(&data);
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_EVENT [Broadcast] Event: %u", guildEvent);
|
||||
|
||||
if (sLog->ShouldLog(LOG_FILTER_GUILD, LOG_LEVEL_DEBUG))
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_EVENT [Broadcast] Event: %s (%u)", _GetGuildEventString(guildEvent).c_str(), guildEvent);
|
||||
}
|
||||
|
||||
void Guild::_SendBankList(WorldSession* session /* = NULL*/, uint8 tabId /*= 0*/, bool sendAllSlots /*= false*/, SlotIds *slots /*= NULL*/) const
|
||||
|
||||
@@ -114,7 +114,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) sent a chatmessage with an invalid language/message type combination",
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) sent a chatmessage with an invalid language/message type combination",
|
||||
GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
|
||||
|
||||
recvData.rfinish();
|
||||
|
||||
Reference in New Issue
Block a user