mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +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
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue