mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[11430] Introduce GuildMgr
Move all guild-related functions from our overpowered ObjectMgr to GuildMgr. Thx leak for idea.
This commit is contained in:
parent
e47031b55c
commit
6498941ead
23 changed files with 313 additions and 206 deletions
|
|
@ -620,7 +620,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
|
|||
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_ACHIEVEMENT_UPDATES, "AchievementMgr::SendAchievementEarned(%u)", achievement->ID);
|
||||
|
||||
if(Guild* guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()))
|
||||
if (Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId()))
|
||||
{
|
||||
MaNGOS::AchievementChatBuilder say_builder(*GetPlayer(), CHAT_MSG_GUILD_ACHIEVEMENT, LANG_ACHIEVEMENT_EARNED,achievement->ID);
|
||||
MaNGOS::LocalizedPacketDo<MaNGOS::AchievementChatBuilder> say_do(say_builder);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "Auth/md5.h"
|
||||
#include "ObjectAccessor.h"
|
||||
|
|
@ -494,7 +495,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
|
|||
std::string name;
|
||||
|
||||
// is guild leader
|
||||
if(sObjectMgr.GetGuildByLeader(guid))
|
||||
if (sGuildMgr.GetGuildByLeader(guid))
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_DELETE, 1);
|
||||
data << (uint8)CHAR_DELETE_FAILED_GUILD_LEADER;
|
||||
|
|
@ -657,7 +658,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder)
|
|||
|
||||
if(pCurrChar->GetGuildId() != 0)
|
||||
{
|
||||
Guild* guild = sObjectMgr.GetGuildById(pCurrChar->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(pCurrChar->GetGuildId());
|
||||
if(guild)
|
||||
{
|
||||
data.Initialize(SMSG_GUILD_EVENT, (1+1+guild->GetMOTD().size()+1));
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "ChannelMgr.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Player.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "Language.h"
|
||||
|
|
@ -278,7 +279,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
break;
|
||||
|
||||
if (GetPlayer()->GetGuildId())
|
||||
if (Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()))
|
||||
if (Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId()))
|
||||
guild->BroadcastToGuild(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
|
||||
} break;
|
||||
|
||||
|
|
@ -300,7 +301,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
break;
|
||||
|
||||
if (GetPlayer()->GetGuildId())
|
||||
if (Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()))
|
||||
if (Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId()))
|
||||
guild->BroadcastToOfficers(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
|
||||
} break;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "Opcodes.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "Util.h"
|
||||
|
|
@ -104,7 +105,7 @@ Guild::~Guild()
|
|||
|
||||
bool Guild::Create(Player* leader, std::string gname)
|
||||
{
|
||||
if (sObjectMgr.GetGuildByName(gname))
|
||||
if (sGuildMgr.GetGuildByName(gname))
|
||||
return false;
|
||||
|
||||
WorldSession* lSession = leader->GetSession();
|
||||
|
|
@ -707,7 +708,7 @@ void Guild::Disband()
|
|||
CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE guildid = '%u'", m_Id);
|
||||
CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE guildid = '%u'", m_Id);
|
||||
CharacterDatabase.CommitTransaction();
|
||||
sObjectMgr.RemoveGuild(m_Id);
|
||||
sGuildMgr.RemoveGuild(m_Id);
|
||||
}
|
||||
|
||||
void Guild::Roster(WorldSession *session /*= NULL*/)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "Common.h"
|
||||
#include "Item.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
class Item;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "Log.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "GossipDef.h"
|
||||
#include "SocialMgr.h"
|
||||
|
||||
|
|
@ -34,7 +35,7 @@ void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket)
|
|||
uint32 guildId;
|
||||
recvPacket >> guildId;
|
||||
|
||||
if(Guild *guild = sObjectMgr.GetGuildById(guildId))
|
||||
if (Guild* guild = sGuildMgr.GetGuildById(guildId))
|
||||
{
|
||||
guild->Query(this);
|
||||
return;
|
||||
|
|
@ -60,7 +61,7 @@ void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket)
|
|||
return;
|
||||
}
|
||||
|
||||
sObjectMgr.AddGuild(guild);
|
||||
sGuildMgr.AddGuild(guild);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -81,7 +82,7 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
|
|||
return;
|
||||
}
|
||||
|
||||
Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if(!guild)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
|
|
@ -143,7 +144,7 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
|
|||
if (!normalizePlayerName(plName))
|
||||
return;
|
||||
|
||||
Guild* guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if (!guild)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
|
|
@ -190,7 +191,7 @@ void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/)
|
|||
|
||||
DEBUG_LOG("WORLD: Received CMSG_GUILD_ACCEPT");
|
||||
|
||||
guild = sObjectMgr.GetGuildById(player->GetGuildIdInvited());
|
||||
guild = sGuildMgr.GetGuildById(player->GetGuildIdInvited());
|
||||
if (!guild || player->GetGuildId())
|
||||
return;
|
||||
|
||||
|
|
@ -218,7 +219,7 @@ void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/)
|
|||
{
|
||||
DEBUG_LOG("WORLD: Received CMSG_GUILD_INFO");
|
||||
|
||||
Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if(!guild)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
|
|
@ -237,7 +238,7 @@ void WorldSession::HandleGuildRosterOpcode(WorldPacket& /*recvPacket*/)
|
|||
{
|
||||
DEBUG_LOG("WORLD: Received CMSG_GUILD_ROSTER");
|
||||
|
||||
if(Guild* guild = sObjectMgr.GetGuildById(_player->GetGuildId()))
|
||||
if (Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId()))
|
||||
guild->Roster(this);
|
||||
}
|
||||
|
||||
|
|
@ -251,7 +252,7 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
|
|||
if(!normalizePlayerName(plName))
|
||||
return;
|
||||
|
||||
Guild* guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if (!guild)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
|
|
@ -304,7 +305,7 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
|
|||
if(!normalizePlayerName(plName))
|
||||
return;
|
||||
|
||||
Guild* guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
|
||||
if(!guild)
|
||||
{
|
||||
|
|
@ -359,7 +360,7 @@ void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/)
|
|||
{
|
||||
DEBUG_LOG("WORLD: Received CMSG_GUILD_LEAVE");
|
||||
|
||||
Guild *guild = sObjectMgr.GetGuildById(_player->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId());
|
||||
if (!guild)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
|
|
@ -391,7 +392,7 @@ void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/)
|
|||
{
|
||||
DEBUG_LOG("WORLD: Received CMSG_GUILD_DISBAND");
|
||||
|
||||
Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if (!guild)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
|
|
@ -421,7 +422,7 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
|
|||
if(!normalizePlayerName(name))
|
||||
return;
|
||||
|
||||
Guild *guild = sObjectMgr.GetGuildById(oldLeader->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(oldLeader->GetGuildId());
|
||||
|
||||
if (!guild)
|
||||
{
|
||||
|
|
@ -466,7 +467,7 @@ void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket)
|
|||
else
|
||||
MOTD = "";
|
||||
|
||||
Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if (!guild)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
|
|
@ -493,7 +494,7 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket)
|
|||
if(!normalizePlayerName(name))
|
||||
return;
|
||||
|
||||
Guild* guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
|
||||
if (!guild)
|
||||
{
|
||||
|
|
@ -531,7 +532,7 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket)
|
|||
if (!normalizePlayerName(plName))
|
||||
return;
|
||||
|
||||
Guild* guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
|
||||
if (!guild)
|
||||
{
|
||||
|
|
@ -566,7 +567,7 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
|
|||
|
||||
DEBUG_LOG("WORLD: Received CMSG_GUILD_RANK");
|
||||
|
||||
Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if (!guild)
|
||||
{
|
||||
recvPacket.rpos(recvPacket.wpos()); // set to end to avoid warnings spam
|
||||
|
|
@ -617,7 +618,7 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket)
|
|||
std::string rankname;
|
||||
recvPacket >> rankname;
|
||||
|
||||
Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if (!guild)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
|
|
@ -643,7 +644,7 @@ void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/)
|
|||
{
|
||||
DEBUG_LOG("WORLD: Received CMSG_GUILD_DEL_RANK");
|
||||
|
||||
Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if (!guild)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
|
|
@ -680,7 +681,7 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket)
|
|||
std::string GINFO;
|
||||
recvPacket >> GINFO;
|
||||
|
||||
Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if(!guild)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
|
|
@ -719,7 +720,7 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
|
|||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if (!guild)
|
||||
{
|
||||
//"You are not part of a guild!";
|
||||
|
|
@ -756,7 +757,7 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */)
|
|||
DEBUG_LOG("WORLD: Received (MSG_GUILD_EVENT_LOG_QUERY)");
|
||||
|
||||
if(uint32 GuildId = GetPlayer()->GetGuildId())
|
||||
if(Guild *pGuild = sObjectMgr.GetGuildById(GuildId))
|
||||
if (Guild* pGuild = sGuildMgr.GetGuildById(GuildId))
|
||||
pGuild->DisplayGuildEventLog(this);
|
||||
}
|
||||
|
||||
|
|
@ -767,7 +768,7 @@ void WorldSession::HandleGuildBankMoneyWithdrawn( WorldPacket & /* recv_data */
|
|||
DEBUG_LOG("WORLD: Received (MSG_GUILD_BANK_MONEY_WITHDRAWN)");
|
||||
|
||||
if(uint32 GuildId = GetPlayer()->GetGuildId())
|
||||
if(Guild *pGuild = sObjectMgr.GetGuildById(GuildId))
|
||||
if (Guild* pGuild = sGuildMgr.GetGuildById(GuildId))
|
||||
pGuild->SendMoneyInfo(this, GetPlayer()->GetGUIDLow());
|
||||
}
|
||||
|
||||
|
|
@ -777,7 +778,7 @@ void WorldSession::HandleGuildPermissions( WorldPacket& /* recv_data */ )
|
|||
|
||||
if(uint32 GuildId = GetPlayer()->GetGuildId())
|
||||
{
|
||||
if(Guild *pGuild = sObjectMgr.GetGuildById(GuildId))
|
||||
if (Guild* pGuild = sGuildMgr.GetGuildById(GuildId))
|
||||
{
|
||||
uint32 rankId = GetPlayer()->GetRank();
|
||||
|
||||
|
|
@ -813,7 +814,7 @@ void WorldSession::HandleGuildBankerActivate( WorldPacket & recv_data )
|
|||
|
||||
if (uint32 GuildId = GetPlayer()->GetGuildId())
|
||||
{
|
||||
if(Guild *pGuild = sObjectMgr.GetGuildById(GuildId))
|
||||
if (Guild* pGuild = sGuildMgr.GetGuildById(GuildId))
|
||||
{
|
||||
pGuild->DisplayGuildBankTabsInfo(this); // this also will load guild bank if not yet
|
||||
return;
|
||||
|
|
@ -839,7 +840,7 @@ void WorldSession::HandleGuildBankQueryTab( WorldPacket & recv_data )
|
|||
if (!GuildId)
|
||||
return;
|
||||
|
||||
Guild *pGuild = sObjectMgr.GetGuildById(GuildId);
|
||||
Guild* pGuild = sGuildMgr.GetGuildById(GuildId);
|
||||
if (!pGuild)
|
||||
return;
|
||||
|
||||
|
|
@ -873,7 +874,7 @@ void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data )
|
|||
if (!GuildId)
|
||||
return;
|
||||
|
||||
Guild *pGuild = sObjectMgr.GetGuildById(GuildId);
|
||||
Guild* pGuild = sGuildMgr.GetGuildById(GuildId);
|
||||
if (!pGuild)
|
||||
return;
|
||||
|
||||
|
|
@ -921,7 +922,7 @@ void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data )
|
|||
if (GuildId == 0)
|
||||
return;
|
||||
|
||||
Guild *pGuild = sObjectMgr.GetGuildById(GuildId);
|
||||
Guild* pGuild = sGuildMgr.GetGuildById(GuildId);
|
||||
if(!pGuild)
|
||||
return;
|
||||
|
||||
|
|
@ -981,7 +982,7 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
Guild *pGuild = sObjectMgr.GetGuildById(GuildId);
|
||||
Guild* pGuild = sGuildMgr.GetGuildById(GuildId);
|
||||
if (!pGuild)
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent additional spam at rejected packet
|
||||
|
|
@ -1079,7 +1080,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data )
|
|||
if (!GuildId)
|
||||
return;
|
||||
|
||||
Guild *pGuild = sObjectMgr.GetGuildById(GuildId);
|
||||
Guild* pGuild = sGuildMgr.GetGuildById(GuildId);
|
||||
if(!pGuild)
|
||||
return;
|
||||
|
||||
|
|
@ -1129,7 +1130,7 @@ void WorldSession::HandleGuildBankUpdateTab( WorldPacket & recv_data )
|
|||
if (!GuildId)
|
||||
return;
|
||||
|
||||
Guild *pGuild = sObjectMgr.GetGuildById(GuildId);
|
||||
Guild* pGuild = sGuildMgr.GetGuildById(GuildId);
|
||||
if (!pGuild)
|
||||
return;
|
||||
|
||||
|
|
@ -1152,7 +1153,7 @@ void WorldSession::HandleGuildBankLogQuery( WorldPacket & recv_data )
|
|||
if (!GuildId)
|
||||
return;
|
||||
|
||||
Guild *pGuild = sObjectMgr.GetGuildById(GuildId);
|
||||
Guild* pGuild = sGuildMgr.GetGuildById(GuildId);
|
||||
if (!pGuild)
|
||||
return;
|
||||
|
||||
|
|
@ -1174,7 +1175,7 @@ void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recv_data)
|
|||
if (!GuildId)
|
||||
return;
|
||||
|
||||
Guild *pGuild = sObjectMgr.GetGuildById(GuildId);
|
||||
Guild* pGuild = sGuildMgr.GetGuildById(GuildId);
|
||||
if (!pGuild)
|
||||
return;
|
||||
|
||||
|
|
@ -1197,7 +1198,7 @@ void WorldSession::HandleSetGuildBankTabText(WorldPacket &recv_data)
|
|||
if (!GuildId)
|
||||
return;
|
||||
|
||||
Guild *pGuild = sObjectMgr.GetGuildById(GuildId);
|
||||
Guild* pGuild = sGuildMgr.GetGuildById(GuildId);
|
||||
if (!pGuild)
|
||||
return;
|
||||
|
||||
|
|
|
|||
166
src/game/GuildMgr.cpp
Normal file
166
src/game/GuildMgr.cpp
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
/*
|
||||
* Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "GuildMgr.h"
|
||||
#include "Guild.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "World.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(GuildMgr);
|
||||
|
||||
GuildMgr::GuildMgr()
|
||||
{
|
||||
}
|
||||
|
||||
GuildMgr::~GuildMgr()
|
||||
{
|
||||
for (GuildMap::iterator itr = m_GuildMap.begin(); itr != m_GuildMap.end(); ++itr)
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
void GuildMgr::AddGuild(Guild* guild)
|
||||
{
|
||||
m_GuildMap[guild->GetId()] = guild;
|
||||
}
|
||||
|
||||
void GuildMgr::RemoveGuild(uint32 guildId)
|
||||
{
|
||||
m_GuildMap.erase(guildId);
|
||||
}
|
||||
|
||||
Guild* GuildMgr::GetGuildById(uint32 guildId) const
|
||||
{
|
||||
GuildMap::const_iterator itr = m_GuildMap.find(guildId);
|
||||
if (itr != m_GuildMap.end())
|
||||
return itr->second;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Guild* GuildMgr::GetGuildByName(std::string const& name) const
|
||||
{
|
||||
for(GuildMap::const_iterator itr = m_GuildMap.begin(); itr != m_GuildMap.end(); ++itr)
|
||||
if (itr->second->GetName() == name)
|
||||
return itr->second;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Guild* GuildMgr::GetGuildByLeader(ObjectGuid const& guid) const
|
||||
{
|
||||
for(GuildMap::const_iterator itr = m_GuildMap.begin(); itr != m_GuildMap.end(); ++itr)
|
||||
if (itr->second->GetLeaderGuid() == guid)
|
||||
return itr->second;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::string GuildMgr::GetGuildNameById(uint32 guildId) const
|
||||
{
|
||||
GuildMap::const_iterator itr = m_GuildMap.find(guildId);
|
||||
if (itr != m_GuildMap.end())
|
||||
return itr->second->GetName();
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
void GuildMgr::LoadGuilds()
|
||||
{
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT guild.guildid,guild.name,leaderguid,EmblemStyle,EmblemColor,BorderStyle,BorderColor,"
|
||||
// 7 8 9 10 11 12
|
||||
"BackgroundColor,info,motd,createdate,BankMoney,(SELECT COUNT(guild_bank_tab.guildid) FROM guild_bank_tab WHERE guild_bank_tab.guildid = guild.guildid) "
|
||||
"FROM guild ORDER BY guildid ASC");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
barGoLink bar(1);
|
||||
|
||||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u guild definitions", count);
|
||||
return;
|
||||
}
|
||||
|
||||
// load guild ranks
|
||||
// 0 1 2 3 4
|
||||
QueryResult* guildRanksResult = CharacterDatabase.Query("SELECT guildid,rid,rname,rights,BankMoneyPerDay FROM guild_rank ORDER BY guildid ASC, rid ASC");
|
||||
|
||||
// load guild members
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult* guildMembersResult = CharacterDatabase.Query("SELECT guildid,guild_member.guid,rank,pnote,offnote,BankResetTimeMoney,BankRemMoney,"
|
||||
// 7 8 9 10 11 12
|
||||
"BankResetTimeTab0,BankRemSlotsTab0,BankResetTimeTab1,BankRemSlotsTab1,BankResetTimeTab2,BankRemSlotsTab2,"
|
||||
// 13 14 15 16 17 18
|
||||
"BankResetTimeTab3,BankRemSlotsTab3,BankResetTimeTab4,BankRemSlotsTab4,BankResetTimeTab5,BankRemSlotsTab5,"
|
||||
// 19 20 21 22 23 24
|
||||
"characters.name, characters.level, characters.class, characters.zone, characters.logout_time, characters.account "
|
||||
"FROM guild_member LEFT JOIN characters ON characters.guid = guild_member.guid ORDER BY guildid ASC");
|
||||
|
||||
// load guild bank tab rights
|
||||
// 0 1 2 3 4
|
||||
QueryResult* guildBankTabRightsResult = CharacterDatabase.Query("SELECT guildid,TabId,rid,gbright,SlotPerDay FROM guild_bank_right ORDER BY guildid ASC, TabId ASC");
|
||||
|
||||
barGoLink bar((int)result->GetRowCount());
|
||||
|
||||
do
|
||||
{
|
||||
//Field *fields = result->Fetch();
|
||||
|
||||
bar.step();
|
||||
++count;
|
||||
|
||||
Guild* newGuild = new Guild;
|
||||
if (!newGuild->LoadGuildFromDB(result) ||
|
||||
!newGuild->LoadRanksFromDB(guildRanksResult) ||
|
||||
!newGuild->LoadMembersFromDB(guildMembersResult) ||
|
||||
!newGuild->LoadBankRightsFromDB(guildBankTabRightsResult) ||
|
||||
!newGuild->CheckGuildStructure()
|
||||
)
|
||||
{
|
||||
newGuild->Disband();
|
||||
delete newGuild;
|
||||
continue;
|
||||
}
|
||||
|
||||
newGuild->LoadGuildEventLogFromDB();
|
||||
newGuild->LoadGuildBankEventLogFromDB();
|
||||
newGuild->LoadGuildBankFromDB();
|
||||
AddGuild(newGuild);
|
||||
} while(result->NextRow());
|
||||
|
||||
delete result;
|
||||
delete guildRanksResult;
|
||||
delete guildMembersResult;
|
||||
delete guildBankTabRightsResult;
|
||||
|
||||
//delete unused LogGuid records in guild_eventlog and guild_bank_eventlog table
|
||||
//you can comment these lines if you don't plan to change CONFIG_UINT32_GUILD_EVENT_LOG_COUNT and CONFIG_UINT32_GUILD_BANK_EVENT_LOG_COUNT
|
||||
CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE LogGuid > '%u'", sWorld.getConfig(CONFIG_UINT32_GUILD_EVENT_LOG_COUNT));
|
||||
CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE LogGuid > '%u'", sWorld.getConfig(CONFIG_UINT32_GUILD_BANK_EVENT_LOG_COUNT));
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u guild definitions", count);
|
||||
}
|
||||
50
src/game/GuildMgr.h
Normal file
50
src/game/GuildMgr.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _GUILDMGR_H
|
||||
#define _GUILDMGR_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Policies/Singleton.h"
|
||||
|
||||
class Guild;
|
||||
class ObjectGuid;
|
||||
|
||||
class GuildMgr
|
||||
{
|
||||
typedef UNORDERED_MAP<uint32, Guild*> GuildMap;
|
||||
|
||||
GuildMap m_GuildMap;
|
||||
public:
|
||||
GuildMgr();
|
||||
~GuildMgr();
|
||||
|
||||
void AddGuild(Guild* guild);
|
||||
void RemoveGuild(uint32 guildId);
|
||||
|
||||
Guild* GetGuildById(uint32 guildId) const;
|
||||
Guild* GetGuildByName(std::string const& name) const;
|
||||
Guild* GetGuildByLeader(ObjectGuid const& guid) const;
|
||||
std::string GetGuildNameById(uint32 guildId) const;
|
||||
|
||||
void LoadGuilds();
|
||||
};
|
||||
|
||||
#define sGuildMgr MaNGOS::Singleton<GuildMgr>::Instance()
|
||||
|
||||
#endif // _GUILDMGR_H
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
#include "Chat.h"
|
||||
#include "Log.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "MapManager.h"
|
||||
#include "MassMailMgr.h"
|
||||
|
|
@ -3553,16 +3554,16 @@ bool ChatHandler::HandleGuildCreateCommand(char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
Guild *guild = new Guild;
|
||||
if (!guild->Create (target,guildname))
|
||||
Guild* guild = new Guild;
|
||||
if (!guild->Create(target, guildname))
|
||||
{
|
||||
delete guild;
|
||||
SendSysMessage (LANG_GUILD_NOT_CREATED);
|
||||
SetSentErrorMessage (true);
|
||||
SendSysMessage(LANG_GUILD_NOT_CREATED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
sObjectMgr.AddGuild (guild);
|
||||
sGuildMgr.AddGuild(guild);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3581,7 +3582,7 @@ bool ChatHandler::HandleGuildInviteCommand(char *args)
|
|||
return false;
|
||||
|
||||
std::string glName = guildStr;
|
||||
Guild* targetGuild = sObjectMgr.GetGuildByName (glName);
|
||||
Guild* targetGuild = sGuildMgr.GetGuildByName(glName);
|
||||
if (!targetGuild)
|
||||
return false;
|
||||
|
||||
|
|
@ -3603,7 +3604,7 @@ bool ChatHandler::HandleGuildUninviteCommand(char *args)
|
|||
if (!glId)
|
||||
return false;
|
||||
|
||||
Guild* targetGuild = sObjectMgr.GetGuildById (glId);
|
||||
Guild* targetGuild = sGuildMgr.GetGuildById(glId);
|
||||
if (!targetGuild)
|
||||
return false;
|
||||
|
||||
|
|
@ -3625,7 +3626,7 @@ bool ChatHandler::HandleGuildRankCommand(char *args)
|
|||
if (!glId)
|
||||
return false;
|
||||
|
||||
Guild* targetGuild = sObjectMgr.GetGuildById (glId);
|
||||
Guild* targetGuild = sGuildMgr.GetGuildById(glId);
|
||||
if (!targetGuild)
|
||||
return false;
|
||||
|
||||
|
|
@ -3655,7 +3656,7 @@ bool ChatHandler::HandleGuildDeleteCommand(char* args)
|
|||
|
||||
std::string gld = guildStr;
|
||||
|
||||
Guild* targetGuild = sObjectMgr.GetGuildByName (gld);
|
||||
Guild* targetGuild = sGuildMgr.GetGuildByName(gld);
|
||||
if (!targetGuild)
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
|
|||
if (!(wplayer_name.empty() || wpname.find(wplayer_name) != std::wstring::npos))
|
||||
continue;
|
||||
|
||||
std::string gname = sObjectMgr.GetGuildNameById(itr->second->GetGuildId());
|
||||
std::string gname = sGuildMgr.GetGuildNameById(itr->second->GetGuildId());
|
||||
std::wstring wgname;
|
||||
if(!Utf8toWStr(gname,wgname))
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include "Creature.h"
|
||||
#include "Pet.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Chat.h"
|
||||
|
||||
enum StableResultCode
|
||||
|
|
@ -874,7 +875,7 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data )
|
|||
uint32 GuildId = _player->GetGuildId();
|
||||
if (!GuildId)
|
||||
return;
|
||||
Guild *pGuild = sObjectMgr.GetGuildById(GuildId);
|
||||
Guild* pGuild = sGuildMgr.GetGuildById(GuildId);
|
||||
if (!pGuild)
|
||||
return;
|
||||
pGuild->LogBankEvent(GUILD_BANK_LOG_REPAIR_MONEY, 0, _player->GetGUIDLow(), TotalCost);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include "UpdateMask.h"
|
||||
#include "World.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
#include "ArenaTeam.h"
|
||||
#include "Transports.h"
|
||||
#include "ProgressBar.h"
|
||||
|
|
@ -172,13 +171,10 @@ ObjectMgr::~ObjectMgr()
|
|||
for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
|
||||
delete[] playerInfo[race][class_].levelInfo;
|
||||
|
||||
// free group and guild objects
|
||||
// free objects
|
||||
for (GroupMap::iterator itr = mGroupMap.begin(); itr != mGroupMap.end(); ++itr)
|
||||
delete itr->second;
|
||||
|
||||
for (GuildMap::iterator itr = mGuildMap.begin(); itr != mGuildMap.end(); ++itr)
|
||||
delete itr->second;
|
||||
|
||||
for (ArenaTeamMap::iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
|
||||
delete itr->second;
|
||||
|
||||
|
|
@ -201,42 +197,6 @@ Group* ObjectMgr::GetGroupById(uint32 id) const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Guild* ObjectMgr::GetGuildById(uint32 GuildId) const
|
||||
{
|
||||
GuildMap::const_iterator itr = mGuildMap.find(GuildId);
|
||||
if (itr != mGuildMap.end())
|
||||
return itr->second;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Guild * ObjectMgr::GetGuildByName(const std::string& guildname) const
|
||||
{
|
||||
for(GuildMap::const_iterator itr = mGuildMap.begin(); itr != mGuildMap.end(); ++itr)
|
||||
if (itr->second->GetName() == guildname)
|
||||
return itr->second;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::string ObjectMgr::GetGuildNameById(uint32 GuildId) const
|
||||
{
|
||||
GuildMap::const_iterator itr = mGuildMap.find(GuildId);
|
||||
if (itr != mGuildMap.end())
|
||||
return itr->second->GetName();
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
Guild* ObjectMgr::GetGuildByLeader(ObjectGuid guid) const
|
||||
{
|
||||
for(GuildMap::const_iterator itr = mGuildMap.begin(); itr != mGuildMap.end(); ++itr)
|
||||
if (itr->second->GetLeaderGuid() == guid)
|
||||
return itr->second;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ArenaTeam* ObjectMgr::GetArenaTeamById(uint32 arenateamid) const
|
||||
{
|
||||
ArenaTeamMap::const_iterator itr = mArenaTeamMap.find(arenateamid);
|
||||
|
|
@ -3330,89 +3290,6 @@ void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, Play
|
|||
}
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadGuilds()
|
||||
{
|
||||
Guild *newGuild;
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT guild.guildid,guild.name,leaderguid,EmblemStyle,EmblemColor,BorderStyle,BorderColor,"
|
||||
// 7 8 9 10 11 12
|
||||
"BackgroundColor,info,motd,createdate,BankMoney,(SELECT COUNT(guild_bank_tab.guildid) FROM guild_bank_tab WHERE guild_bank_tab.guildid = guild.guildid) "
|
||||
"FROM guild ORDER BY guildid ASC");
|
||||
|
||||
if( !result )
|
||||
{
|
||||
|
||||
barGoLink bar( 1 );
|
||||
|
||||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u guild definitions", count );
|
||||
return;
|
||||
}
|
||||
|
||||
// load guild ranks
|
||||
// 0 1 2 3 4
|
||||
QueryResult *guildRanksResult = CharacterDatabase.Query("SELECT guildid,rid,rname,rights,BankMoneyPerDay FROM guild_rank ORDER BY guildid ASC, rid ASC");
|
||||
|
||||
// load guild members
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *guildMembersResult = CharacterDatabase.Query("SELECT guildid,guild_member.guid,rank,pnote,offnote,BankResetTimeMoney,BankRemMoney,"
|
||||
// 7 8 9 10 11 12
|
||||
"BankResetTimeTab0,BankRemSlotsTab0,BankResetTimeTab1,BankRemSlotsTab1,BankResetTimeTab2,BankRemSlotsTab2,"
|
||||
// 13 14 15 16 17 18
|
||||
"BankResetTimeTab3,BankRemSlotsTab3,BankResetTimeTab4,BankRemSlotsTab4,BankResetTimeTab5,BankRemSlotsTab5,"
|
||||
// 19 20 21 22 23 24
|
||||
"characters.name, characters.level, characters.class, characters.zone, characters.logout_time, characters.account "
|
||||
"FROM guild_member LEFT JOIN characters ON characters.guid = guild_member.guid ORDER BY guildid ASC");
|
||||
|
||||
// load guild bank tab rights
|
||||
// 0 1 2 3 4
|
||||
QueryResult *guildBankTabRightsResult = CharacterDatabase.Query("SELECT guildid,TabId,rid,gbright,SlotPerDay FROM guild_bank_right ORDER BY guildid ASC, TabId ASC");
|
||||
|
||||
barGoLink bar( (int)result->GetRowCount() );
|
||||
|
||||
do
|
||||
{
|
||||
//Field *fields = result->Fetch();
|
||||
|
||||
bar.step();
|
||||
++count;
|
||||
|
||||
newGuild = new Guild;
|
||||
if (!newGuild->LoadGuildFromDB(result) ||
|
||||
!newGuild->LoadRanksFromDB(guildRanksResult) ||
|
||||
!newGuild->LoadMembersFromDB(guildMembersResult) ||
|
||||
!newGuild->LoadBankRightsFromDB(guildBankTabRightsResult) ||
|
||||
!newGuild->CheckGuildStructure()
|
||||
)
|
||||
{
|
||||
newGuild->Disband();
|
||||
delete newGuild;
|
||||
continue;
|
||||
}
|
||||
newGuild->LoadGuildEventLogFromDB();
|
||||
newGuild->LoadGuildBankEventLogFromDB();
|
||||
newGuild->LoadGuildBankFromDB();
|
||||
AddGuild(newGuild);
|
||||
} while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
delete guildRanksResult;
|
||||
delete guildMembersResult;
|
||||
delete guildBankTabRightsResult;
|
||||
|
||||
//delete unused LogGuid records in guild_eventlog and guild_bank_eventlog table
|
||||
//you can comment these lines if you don't plan to change CONFIG_UINT32_GUILD_EVENT_LOG_COUNT and CONFIG_UINT32_GUILD_BANK_EVENT_LOG_COUNT
|
||||
CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE LogGuid > '%u'", sWorld.getConfig(CONFIG_UINT32_GUILD_EVENT_LOG_COUNT));
|
||||
CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE LogGuid > '%u'", sWorld.getConfig(CONFIG_UINT32_GUILD_BANK_EVENT_LOG_COUNT));
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u guild definitions", count );
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadArenaTeams()
|
||||
{
|
||||
uint32 count = 0;
|
||||
|
|
@ -8837,16 +8714,6 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
|||
return true;
|
||||
}
|
||||
|
||||
void ObjectMgr::AddGuild( Guild* guild )
|
||||
{
|
||||
mGuildMap[guild->GetId()] = guild ;
|
||||
}
|
||||
|
||||
void ObjectMgr::RemoveGuild( uint32 Id )
|
||||
{
|
||||
mGuildMap.erase(Id);
|
||||
}
|
||||
|
||||
void ObjectMgr::AddGroup( Group* group )
|
||||
{
|
||||
mGroupMap[group->GetId()] = group ;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@
|
|||
#include <limits>
|
||||
|
||||
class Group;
|
||||
class Guild;
|
||||
class ArenaTeam;
|
||||
class Item;
|
||||
|
||||
|
|
@ -441,8 +440,6 @@ class ObjectMgr
|
|||
|
||||
typedef UNORDERED_MAP<uint32, Group*> GroupMap;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, Guild*> GuildMap;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, ArenaTeam*> ArenaTeamMap;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, Quest*> QuestMap;
|
||||
|
|
@ -470,13 +467,6 @@ class ObjectMgr
|
|||
void AddGroup(Group* group);
|
||||
void RemoveGroup(Group* group);
|
||||
|
||||
Guild* GetGuildByLeader(ObjectGuid guid) const;
|
||||
Guild* GetGuildById(uint32 GuildId) const;
|
||||
Guild* GetGuildByName(const std::string& guildname) const;
|
||||
std::string GetGuildNameById(uint32 GuildId) const;
|
||||
void AddGuild(Guild* guild);
|
||||
void RemoveGuild(uint32 Id);
|
||||
|
||||
ArenaTeam* GetArenaTeamById(uint32 arenateamid) const;
|
||||
ArenaTeam* GetArenaTeamByName(const std::string& arenateamname) const;
|
||||
ArenaTeam* GetArenaTeamByCaptain(ObjectGuid guid) const;
|
||||
|
|
@ -626,7 +616,6 @@ class ObjectMgr
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void LoadGuilds();
|
||||
void LoadArenaTeams();
|
||||
void LoadGroups();
|
||||
void LoadQuests();
|
||||
|
|
@ -1075,7 +1064,6 @@ class ObjectMgr
|
|||
typedef std::pair<CreatureModelRaceMap::const_iterator, CreatureModelRaceMap::const_iterator> CreatureModelRaceMapBounds;
|
||||
|
||||
GroupMap mGroupMap;
|
||||
GuildMap mGuildMap;
|
||||
ArenaTeamMap mArenaTeamMap;
|
||||
|
||||
QuestAreaTriggerMap mQuestAreaTriggerMap;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "Log.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "ArenaTeam.h"
|
||||
#include "GossipDef.h"
|
||||
#include "SocialMgr.h"
|
||||
|
|
@ -146,7 +147,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
|
|||
|
||||
if(type == 9)
|
||||
{
|
||||
if(sObjectMgr.GetGuildByName(name))
|
||||
if (sGuildMgr.GetGuildByName(name))
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, name, ERR_GUILD_NAME_EXISTS_S);
|
||||
return;
|
||||
|
|
@ -403,7 +404,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
|
|||
|
||||
if(type == 9)
|
||||
{
|
||||
if(sObjectMgr.GetGuildByName(newname))
|
||||
if (sGuildMgr.GetGuildByName(newname))
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, newname, ERR_GUILD_NAME_EXISTS_S);
|
||||
return;
|
||||
|
|
@ -794,7 +795,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
|
||||
if(type == 9)
|
||||
{
|
||||
if(sObjectMgr.GetGuildByName(name))
|
||||
if (sGuildMgr.GetGuildByName(name))
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, name, ERR_GUILD_NAME_EXISTS_S);
|
||||
delete result;
|
||||
|
|
@ -835,7 +836,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
}
|
||||
|
||||
// register guild and add guildmaster
|
||||
sObjectMgr.AddGuild(guild);
|
||||
sGuildMgr.AddGuild(guild);
|
||||
|
||||
// add members
|
||||
for(uint8 i = 0; i < signs; ++i)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "Formulas.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Pet.h"
|
||||
#include "Util.h"
|
||||
#include "Transports.h"
|
||||
|
|
@ -4178,7 +4179,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
|||
|
||||
// remove from guild
|
||||
if (uint32 guildId = GetGuildIdFromDB(playerguid))
|
||||
if (Guild* guild = sObjectMgr.GetGuildById(guildId))
|
||||
if (Guild* guild = sGuildMgr.GetGuildById(guildId))
|
||||
guild->DelMember(playerguid);
|
||||
|
||||
// remove from arena teams
|
||||
|
|
@ -4827,7 +4828,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
|
|||
return TotalCost;
|
||||
}
|
||||
|
||||
Guild *pGuild = sObjectMgr.GetGuildById(GetGuildId());
|
||||
Guild* pGuild = sGuildMgr.GetGuildById(GetGuildId());
|
||||
if (!pGuild)
|
||||
return TotalCost;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "AuctionHouseMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "CreatureEventAIMgr.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "DBCStores.h"
|
||||
|
|
@ -1219,7 +1220,7 @@ void World::SetInitialWorldSettings()
|
|||
sLog.outString();
|
||||
|
||||
sLog.outString( "Loading Guilds..." );
|
||||
sObjectMgr.LoadGuilds();
|
||||
sGuildMgr.LoadGuilds();
|
||||
|
||||
sLog.outString( "Loading ArenaTeams..." );
|
||||
sObjectMgr.LoadArenaTeams();
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "ObjectMgr.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "World.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
#include "MapManager.h"
|
||||
|
|
@ -426,7 +427,7 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
stmt.PExecute(uint32(0), GetAccountId());
|
||||
|
||||
///- If the player is in a guild, update the guild roster and broadcast a logout message to other guild members
|
||||
if (Guild *guild = sObjectMgr.GetGuildById(_player->GetGuildId()))
|
||||
if (Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId()))
|
||||
{
|
||||
if (MemberSlot* slot = guild->GetMemberSlot(_player->GetObjectGuid()))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,5 +9,6 @@
|
|||
#include "SQLStorages.h"
|
||||
#include "Opcodes.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11429"
|
||||
#define REVISION_NR "11430"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -418,6 +418,7 @@
|
|||
<ClCompile Include="..\..\src\game\GuardAI.cpp" />
|
||||
<ClCompile Include="..\..\src\game\Guild.cpp" />
|
||||
<ClCompile Include="..\..\src\game\GuildHandler.cpp" />
|
||||
<ClCompile Include="..\..\src\game\GuildMgr.cpp" />
|
||||
<ClCompile Include="..\..\src\game\HomeMovementGenerator.cpp" />
|
||||
<ClCompile Include="..\..\src\game\HostileRefManager.cpp" />
|
||||
<ClCompile Include="..\..\src\game\IdleMovementGenerator.cpp" />
|
||||
|
|
@ -578,6 +579,7 @@
|
|||
<ClInclude Include="..\..\src\game\GroupRefManager.h" />
|
||||
<ClInclude Include="..\..\src\game\GuardAI.h" />
|
||||
<ClInclude Include="..\..\src\game\Guild.h" />
|
||||
<ClInclude Include="..\..\src\game\GuildMgr.h" />
|
||||
<ClInclude Include="..\..\src\game\HomeMovementGenerator.h" />
|
||||
<ClInclude Include="..\..\src\game\HostileRefManager.h" />
|
||||
<ClInclude Include="..\..\src\game\IdleMovementGenerator.h" />
|
||||
|
|
|
|||
|
|
@ -141,6 +141,9 @@
|
|||
<ClCompile Include="..\..\src\game\GuildHandler.cpp">
|
||||
<Filter>World/Handlers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\game\GuildMgr.cpp">
|
||||
<Filter>World/Handlers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\game\InstanceData.cpp">
|
||||
<Filter>World/Handlers</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -567,6 +570,9 @@
|
|||
<ClInclude Include="..\..\src\game\Group.h">
|
||||
<Filter>World/Handlers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\game\GuildMgr.h">
|
||||
<Filter>World/Handlers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\game\InstanceData.h">
|
||||
<Filter>World/Handlers</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
|||
|
|
@ -797,6 +797,14 @@
|
|||
RelativePath="..\..\src\game\GuildHandler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\GuildMgr.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\GuildMgr.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\InstanceData.cpp"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -790,6 +790,14 @@
|
|||
RelativePath="..\..\src\game\GuildHandler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\GuildMgr.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\GuildMgr.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\InstanceData.cpp"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue