Core: header cleanup, split realmlist, boost compatibility, cotire, remove stormlib/zlib and stormlib/bzip2 and instead use dep sources
This commit is contained in:
1 parent
7fff6c424f
commit
5ff847159c
1243 files changed
+29780
-36517
No files matched your search
@@ -16,20 +16,28 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Guild.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "AchievementMgr.h"
|
||||
#include "Bag.h"
|
||||
#include "CalendarMgr.h"
|
||||
#include "CharacterCache.h"
|
||||
#include "Chat.h"
|
||||
#include "Config.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildFinderMgr.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#define MAX_GUILD_BANK_TAB_TEXT_LEN 500
|
||||
#define EMBLEM_PRICE 10 * GOLD
|
||||
@@ -232,7 +240,7 @@ void Guild::EventLogEntry::WritePacket(WorldPacket& data, ByteBuffer& content) c
|
||||
content.WriteByteSeq(guid1[4]);
|
||||
|
||||
// Event timestamp
|
||||
content << uint32(::time(NULL) - m_timestamp);
|
||||
content << uint32(::time(nullptr) - m_timestamp);
|
||||
|
||||
content.WriteByteSeq(guid1[7]);
|
||||
content.WriteByteSeq(guid1[3]);
|
||||
@@ -314,7 +322,7 @@ void Guild::BankEventLogEntry::WritePacket(WorldPacket& data, ByteBuffer& conten
|
||||
if (hasItem)
|
||||
content << uint32(m_itemOrMoney);
|
||||
|
||||
content << uint32(time(NULL) - m_timestamp);
|
||||
content << uint32(time(nullptr) - m_timestamp);
|
||||
|
||||
if (IsMoneyEvent())
|
||||
content << uint64(m_itemOrMoney);
|
||||
@@ -488,6 +496,11 @@ void Guild::RankInfo::SetBankTabSlotsAndRights(GuildBankRightsAndSlots rightsAnd
|
||||
}
|
||||
|
||||
// BankTab
|
||||
Guild::BankTab::BankTab(ObjectGuid::LowType guildId, uint8 tabId) : m_guildId(guildId), m_tabId(tabId)
|
||||
{
|
||||
memset(m_items, 0, GUILD_BANK_MAX_SLOTS * sizeof(Item*));
|
||||
}
|
||||
|
||||
void Guild::BankTab::LoadFromDB(Field* fields)
|
||||
{
|
||||
m_name = fields[2].GetString();
|
||||
@@ -549,6 +562,12 @@ void Guild::BankTab::Delete(SQLTransaction& trans, bool removeItemsFromDB)
|
||||
}
|
||||
}
|
||||
|
||||
void Guild::BankTab::WriteInfoPacket(WorldPacket& data) const
|
||||
{
|
||||
data << m_name;
|
||||
data << m_icon;
|
||||
}
|
||||
|
||||
void Guild::BankTab::SetInfo(std::string const& name, std::string const& icon)
|
||||
{
|
||||
if (m_name == name && m_icon == icon)
|
||||
@@ -634,6 +653,25 @@ void Guild::BankTab::SendText(Guild const* guild, WorldSession* session) const
|
||||
}
|
||||
|
||||
// Member
|
||||
Guild::Member::Member(ObjectGuid::LowType guildId, ObjectGuid guid, uint8 rankId) :
|
||||
m_guildId(guildId),
|
||||
m_guid(guid),
|
||||
m_zoneId(0),
|
||||
m_level(0),
|
||||
m_class(0),
|
||||
m_flags(GUILDMEMBER_STATUS_NONE),
|
||||
m_logoutTime(::time(nullptr)),
|
||||
m_accountId(0),
|
||||
m_rankId(rankId),
|
||||
m_achievementPoints(0),
|
||||
m_totalActivity(0),
|
||||
m_weekActivity(0),
|
||||
m_totalReputation(0),
|
||||
m_weekReputation(0)
|
||||
{
|
||||
memset(m_bankWithdraw, 0, (GUILD_BANK_MAX_TABS + 1) * sizeof(int32));
|
||||
}
|
||||
|
||||
void Guild::Member::SetStats(Player* player)
|
||||
{
|
||||
m_name = player->GetName();
|
||||
@@ -757,6 +795,16 @@ bool Guild::Member::CheckStats() const
|
||||
return true;
|
||||
}
|
||||
|
||||
Player* Guild::Member::FindPlayer() const
|
||||
{
|
||||
return ObjectAccessor::FindPlayer(m_guid);
|
||||
}
|
||||
|
||||
Player* Guild::Member::FindConnectedPlayer() const
|
||||
{
|
||||
return ObjectAccessor::FindConnectedPlayer(m_guid);
|
||||
}
|
||||
|
||||
// Decreases amount of money/slots left for today.
|
||||
// If (tabId == GUILD_BANK_MAX_TABS) decrease money amount.
|
||||
// Otherwise decrease remaining items amount for specified tab.
|
||||
@@ -836,6 +884,15 @@ void EmblemInfo::SaveToDB(ObjectGuid::LowType guildId) const
|
||||
}
|
||||
|
||||
// MoveItemData
|
||||
Guild::MoveItemData::MoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) : m_pGuild(guild), m_pPlayer(player),
|
||||
m_container(container), m_slotId(slotId), m_pItem(nullptr), m_pClonedItem(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
Guild::MoveItemData::~MoveItemData()
|
||||
{
|
||||
}
|
||||
|
||||
bool Guild::MoveItemData::CheckItem(uint32& splitedAmount)
|
||||
{
|
||||
ASSERT(m_pItem);
|
||||
@@ -945,7 +1002,7 @@ inline InventoryResult Guild::PlayerMoveItemData::CanStore(Item* pItem, bool swa
|
||||
bool Guild::BankMoveItemData::InitItem()
|
||||
{
|
||||
m_pItem = m_pGuild->_GetItem(m_container, m_slotId);
|
||||
return (m_pItem != NULL);
|
||||
return (m_pItem != nullptr);
|
||||
}
|
||||
|
||||
bool Guild::BankMoveItemData::HasStoreRights(MoveItemData* pOther) const
|
||||
@@ -1169,12 +1226,13 @@ Guild::Guild():
|
||||
m_bankMoney(0),
|
||||
m_eventLog(nullptr),
|
||||
m_newsLog(nullptr),
|
||||
m_achievementMgr(this),
|
||||
_level(1),
|
||||
_experience(0),
|
||||
_todayExperience(0)
|
||||
{
|
||||
memset(&m_bankEventLog, 0, (GUILD_BANK_MAX_TABS + 1) * sizeof(LogHolder*));
|
||||
|
||||
m_achievementMgr = new AchievementMgr<Guild>(this);
|
||||
}
|
||||
|
||||
Guild::~Guild()
|
||||
@@ -1199,6 +1257,8 @@ Guild::~Guild()
|
||||
delete itr->second;
|
||||
itr->second = nullptr;
|
||||
}
|
||||
|
||||
delete m_achievementMgr;
|
||||
}
|
||||
|
||||
// Creates new guild with default data and saves it to database.
|
||||
@@ -1328,7 +1388,7 @@ void Guild::SaveToDB()
|
||||
stmt->setUInt32(3, GetId());
|
||||
trans->Append(stmt);
|
||||
|
||||
m_achievementMgr.SaveToDB(trans);
|
||||
m_achievementMgr->SaveToDB(trans);
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
@@ -1460,7 +1520,7 @@ void Guild::HandleRoster(WorldSession* session)
|
||||
memberData.WriteByteSeq(guid[4]);
|
||||
memberData << uint8(0); // unk
|
||||
memberData.WriteByteSeq(guid[1]);
|
||||
memberData << float(member->IsOnline() ? 0.0f : float(::time(NULL) - member->GetLogoutTime()) / DAY);
|
||||
memberData << float(member->IsOnline() ? 0.0f : float(::time(nullptr) - member->GetLogoutTime()) / DAY);
|
||||
|
||||
if (offNoteLength)
|
||||
memberData.WriteString(member->GetOfficerNote());
|
||||
@@ -1588,7 +1648,7 @@ void Guild::HandleSetAchievementTracking(WorldSession* session, std::set<uint32>
|
||||
}
|
||||
|
||||
member->SetTrackedCriteriaIds(criteriaIds);
|
||||
m_achievementMgr.SendAllTrackedCriterias(player, member->GetTrackedCriteriaIds());
|
||||
m_achievementMgr->SendAllTrackedCriterias(player, member->GetTrackedCriteriaIds());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1634,7 +1694,7 @@ void Guild::HandleSetInfo(WorldSession* session, std::string const& info)
|
||||
}
|
||||
}
|
||||
|
||||
void Guild::HandleSetEmblem(WorldSession* session, const EmblemInfo& emblemInfo)
|
||||
void Guild::HandleSetEmblem(WorldSession* session, EmblemInfo const& emblemInfo)
|
||||
{
|
||||
Player* player = session->GetPlayer();
|
||||
if (!_IsLeader(player))
|
||||
@@ -1704,7 +1764,7 @@ void Guild::HandleSetMemberNote(WorldSession* session, std::string const& note,
|
||||
}
|
||||
}
|
||||
|
||||
void Guild::HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string const& name, uint32 rights, uint32 moneyPerDay, const GuildBankRightsAndSlotsVec& rightsAndSlots)
|
||||
void Guild::HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string const& name, uint32 rights, uint32 moneyPerDay, GuildBankRightsAndSlotsVec const& rightsAndSlots)
|
||||
{
|
||||
// Only leader can modify ranks
|
||||
if (!_IsLeader(session->GetPlayer()))
|
||||
@@ -1868,7 +1928,7 @@ void Guild::HandleInviteMember(WorldSession* session, std::string const& name)
|
||||
data.WriteByteSeq(newGuildGuid[5]);
|
||||
data.WriteByteSeq(newGuildGuid[3]);
|
||||
data.WriteByteSeq(oldGuildGuid[4]);
|
||||
pInvitee->GetSession()->SendPacket(&data);
|
||||
pInvitee->SendDirectMessage(&data);
|
||||
TC_LOG_DEBUG("guild", "SMSG_GUILD_INVITE [%s]", pInvitee->GetName().c_str());
|
||||
}
|
||||
|
||||
@@ -2389,7 +2449,7 @@ void Guild::SendLoginInfo(WorldSession* session)
|
||||
|
||||
SendGuildReputationWeeklyCap(session, member->GetWeekReputation());
|
||||
|
||||
m_achievementMgr.SendAllAchievementData(player);
|
||||
m_achievementMgr->SendAllAchievementData(player);
|
||||
|
||||
member->SetStats(player);
|
||||
member->AddFlag(GUILDMEMBER_STATUS_ONLINE);
|
||||
@@ -2661,7 +2721,7 @@ void Guild::BroadcastToGuild(WorldSession* session, bool officerOnly, std::strin
|
||||
if (Player* player = itr->second->FindConnectedPlayer())
|
||||
if (player->GetSession() && _HasRankRight(player, officerOnly ? GR_RIGHT_OFFCHATLISTEN : GR_RIGHT_GCHATLISTEN) &&
|
||||
!player->GetSocial()->HasIgnore(session->GetPlayer()->GetGUID()))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2670,13 +2730,13 @@ void Guild::BroadcastAddonToGuild(WorldSession* session, bool officerOnly, std::
|
||||
if (session && session->GetPlayer() && _HasRankRight(session->GetPlayer(), officerOnly ? GR_RIGHT_OFFCHATSPEAK : GR_RIGHT_GCHATSPEAK))
|
||||
{
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, officerOnly ? CHAT_MSG_OFFICER : CHAT_MSG_GUILD, LANG_ADDON, session->GetPlayer(), NULL, msg, 0, "", DEFAULT_LOCALE, prefix);
|
||||
ChatHandler::BuildChatPacket(data, officerOnly ? CHAT_MSG_OFFICER : CHAT_MSG_GUILD, LANG_ADDON, session->GetPlayer(), nullptr, msg, 0, "", DEFAULT_LOCALE, prefix);
|
||||
for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
if (Player* player = itr->second->FindPlayer())
|
||||
if (player->GetSession() && _HasRankRight(player, officerOnly ? GR_RIGHT_OFFCHATLISTEN : GR_RIGHT_GCHATLISTEN) &&
|
||||
!player->GetSocial()->HasIgnore(session->GetPlayer()->GetGUID()) &&
|
||||
player->GetSession()->IsAddonRegistered(prefix))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2685,14 +2745,14 @@ void Guild::BroadcastPacketToRank(WorldPacket* packet, uint8 rankId) const
|
||||
for (auto itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
if (itr->second->IsRank(rankId))
|
||||
if (Player* player = itr->second->FindConnectedPlayer())
|
||||
player->GetSession()->SendPacket(packet);
|
||||
player->SendDirectMessage(packet);
|
||||
}
|
||||
|
||||
void Guild::BroadcastPacket(WorldPacket* packet) const
|
||||
{
|
||||
for (auto itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
if (Player* player = itr->second->FindPlayer())
|
||||
player->GetSession()->SendPacket(packet);
|
||||
player->SendDirectMessage(packet);
|
||||
}
|
||||
|
||||
void Guild::BroadcastPacketIfTrackingAchievement(WorldPacket* packet, uint32 criteriaId) const
|
||||
@@ -2700,7 +2760,7 @@ void Guild::BroadcastPacketIfTrackingAchievement(WorldPacket* packet, uint32 cri
|
||||
for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
if (itr->second->IsTrackingCriteriaId(criteriaId))
|
||||
if (Player* player = itr->second->FindPlayer())
|
||||
player->GetSession()->SendPacket(packet);
|
||||
player->SendDirectMessage(packet);
|
||||
}
|
||||
|
||||
void Guild::MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 maxLevel, uint32 minRank)
|
||||
@@ -2736,6 +2796,21 @@ void Guild::MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 max
|
||||
session->SendPacket(&data);
|
||||
}
|
||||
|
||||
bool Guild::_HasRankRight(Player const* player, uint32 right) const
|
||||
{
|
||||
if (player)
|
||||
if (Member const* member = GetMember(player->GetGUID()))
|
||||
return (_GetRankRights(member->GetRankId()) & right) != GR_RIGHT_EMPTY;
|
||||
return false;
|
||||
}
|
||||
|
||||
void Guild::_DeleteMemberFromDB(SQLTransaction& trans, ObjectGuid::LowType lowguid) const
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_MEMBER);
|
||||
stmt->setUInt32(0, lowguid);
|
||||
CharacterDatabase.ExecuteOrAppend(trans, stmt);
|
||||
}
|
||||
|
||||
// Members handling
|
||||
bool Guild::AddMember(SQLTransaction& trans, ObjectGuid guid, uint8 rankId)
|
||||
{
|
||||
@@ -3035,7 +3110,7 @@ bool Guild::_IsLeader(Player* player) const
|
||||
{
|
||||
if (player->GetGUID() == m_leaderGuid)
|
||||
return true;
|
||||
if (const Member* member = GetMember(player->GetGUID()))
|
||||
if (Member const* member = GetMember(player->GetGUID()))
|
||||
return member->IsRank(GR_GUILDMASTER);
|
||||
return false;
|
||||
}
|
||||
@@ -3104,21 +3179,21 @@ void Guild::_SetRankBankTabRightsAndSlots(uint8 rankId, GuildBankRightsAndSlots
|
||||
|
||||
inline std::string Guild::_GetRankName(uint8 rankId) const
|
||||
{
|
||||
if (const RankInfo* rankInfo = GetRankInfo(rankId))
|
||||
if (RankInfo const* rankInfo = GetRankInfo(rankId))
|
||||
return rankInfo->GetName();
|
||||
return "<unknown>";
|
||||
}
|
||||
|
||||
inline uint32 Guild::_GetRankRights(uint8 rankId) const
|
||||
{
|
||||
if (const RankInfo* rankInfo = GetRankInfo(rankId))
|
||||
if (RankInfo const* rankInfo = GetRankInfo(rankId))
|
||||
return rankInfo->GetRights();
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int32 Guild::_GetRankBankMoneyPerDay(uint8 rankId) const
|
||||
{
|
||||
if (const RankInfo* rankInfo = GetRankInfo(rankId))
|
||||
if (RankInfo const* rankInfo = GetRankInfo(rankId))
|
||||
return rankInfo->GetBankMoneyPerDay();
|
||||
return 0;
|
||||
}
|
||||
@@ -3126,14 +3201,14 @@ inline int32 Guild::_GetRankBankMoneyPerDay(uint8 rankId) const
|
||||
inline int32 Guild::_GetRankBankTabSlotsPerDay(uint8 rankId, uint8 tabId) const
|
||||
{
|
||||
if (tabId < _GetPurchasedTabsSize())
|
||||
if (const RankInfo* rankInfo = GetRankInfo(rankId))
|
||||
if (RankInfo const* rankInfo = GetRankInfo(rankId))
|
||||
return rankInfo->GetBankTabSlotsPerDay(tabId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int8 Guild::_GetRankBankTabRights(uint8 rankId, uint8 tabId) const
|
||||
{
|
||||
if (const RankInfo* rankInfo = GetRankInfo(rankId))
|
||||
if (RankInfo const* rankInfo = GetRankInfo(rankId))
|
||||
return rankInfo->GetBankTabRights(tabId);
|
||||
return 0;
|
||||
}
|
||||
@@ -3186,7 +3261,7 @@ inline void Guild::_UpdateMemberWithdrawSlots(SQLTransaction& trans, ObjectGuid
|
||||
|
||||
inline bool Guild::_MemberHasTabRights(ObjectGuid guid, uint8 tabId, uint32 rights) const
|
||||
{
|
||||
if (const Member* member = GetMember(guid))
|
||||
if (Member const* member = GetMember(guid))
|
||||
{
|
||||
// Leader always has full rights
|
||||
if (member->IsRank(GR_GUILDMASTER) || m_leaderGuid == guid)
|
||||
@@ -3437,14 +3512,14 @@ void Guild::_SendBankContentUpdate(uint8 tabId, SlotIds slots) const
|
||||
if (Player* player = itr->second->FindPlayer())
|
||||
{
|
||||
data.put<uint32>(rempos, uint32(_GetMemberRemainingSlots(itr->second, tabId)));
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
TC_LOG_DEBUG("guild", "WORLD: Sent (SMSG_GUILD_BANK_LIST)");
|
||||
}
|
||||
}
|
||||
|
||||
void Guild::_BroadcastEvent(GuildEvents guildEvent, ObjectGuid guid, const char* param1, const char* param2, const char* param3) const
|
||||
void Guild::_BroadcastEvent(GuildEvents guildEvent, ObjectGuid guid, char const* param1, char const* param2, char const* param3) const
|
||||
{
|
||||
uint8 count = !param3 ? (!param2 ? (!param1 ? 0 : 1) : 2) : 3;
|
||||
|
||||
@@ -3624,7 +3699,7 @@ void Guild::GiveXP(uint32 xp, Player* source)
|
||||
|
||||
WorldPacket data(SMSG_GUILD_XP_GAIN, 8);
|
||||
data << uint64(xp);
|
||||
source->GetSession()->SendPacket(&data);
|
||||
source->SendDirectMessage(&data);
|
||||
|
||||
_experience += xp;
|
||||
_todayExperience += xp;
|
||||
@@ -3659,13 +3734,13 @@ void Guild::GiveXP(uint32 xp, Player* source)
|
||||
}
|
||||
|
||||
AddGuildNews(GUILD_NEWS_LEVEL_UP, ObjectGuid::Empty, 0, _level);
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_GUILD_LEVEL, GetLevel(), 0, 0, NULL, source);
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_GUILD_LEVEL, GetLevel(), 0, 0, nullptr, source);
|
||||
|
||||
++oldLevel;
|
||||
}
|
||||
}
|
||||
|
||||
void Guild::SendGuildXP(WorldSession* session /* = NULL */) const
|
||||
void Guild::SendGuildXP(WorldSession* session /* = nullptr */) const
|
||||
{
|
||||
//Member const* member = GetMember(session->GetGUID().GetCounter());
|
||||
|
||||
@@ -3698,7 +3773,7 @@ void Guild::ResetTimes(bool weekly)
|
||||
{
|
||||
//SendGuildXP(player->GetSession());
|
||||
WorldPacket data(SMSG_GUILD_MEMBER_DAILY_RESET, 0); // tells the client to request bank withdrawal limit
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3721,12 +3796,12 @@ void Guild::AddGuildNews(uint8 type, ObjectGuid guid, uint32 flags, uint32 value
|
||||
|
||||
bool Guild::HasAchieved(uint32 achievementId) const
|
||||
{
|
||||
return m_achievementMgr.HasAchieved(achievementId);
|
||||
return m_achievementMgr->HasAchieved(achievementId);
|
||||
}
|
||||
|
||||
void Guild::UpdateAchievementCriteria(AchievementCriteriaTypes type, uint64 miscValue1, uint64 miscValue2, uint64 miscValue3, Unit* unit, Player* player)
|
||||
{
|
||||
m_achievementMgr.UpdateAchievementCriteria(type, miscValue1, miscValue2, miscValue3, unit, player);
|
||||
m_achievementMgr->UpdateAchievementCriteria(type, miscValue1, miscValue2, miscValue3, unit, player);
|
||||
}
|
||||
|
||||
void Guild::HandleNewsSetSticky(WorldSession* session, uint32 newsId, bool sticky)
|
||||
|
||||
Reference in new issue
Block a user