diff options
| author | leak <leakzx@googlemail.com> | 2011-05-04 10:08:09 +0200 |
|---|---|---|
| committer | leak <leakzx@googlemail.com> | 2011-05-04 10:08:09 +0200 |
| commit | ea06dcf418d6207f1344ad50c54689f89923b9ea (patch) | |
| tree | a07b6d87b29677ef23191b1e91f37f3a15a06c45 /src/server/game/Server/Protocol | |
| parent | 6d63f92bdb88d8159353215f186c611b2d90965d (diff) | |
Core/ObjectMgr: Refactor guild related functions into dedicated class
Diffstat (limited to 'src/server/game/Server/Protocol')
5 files changed, 18 insertions, 13 deletions
diff --git a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp index fd7b6b0d9ec..9f5eddc4bbe 100755 --- a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp @@ -20,6 +20,7 @@ #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "ArenaTeamMgr.h" +#include "GuildMgr.h" #include "SystemConfig.h" #include "World.h" #include "WorldPacket.h" @@ -598,7 +599,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; @@ -773,7 +774,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) if (pCurrChar->GetGuildId() != 0) { - if (Guild* pGuild = sObjectMgr->GetGuildById(pCurrChar->GetGuildId())) + if (Guild* pGuild = sGuildMgr->GetGuildById(pCurrChar->GetGuildId())) pGuild->SendLoginInfo(this); else { diff --git a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp index e4db813fe62..60452102faa 100755 --- a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp @@ -19,6 +19,7 @@ #include "Common.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" +#include "GuildMgr.h" #include "World.h" #include "WorldPacket.h" #include "WorldSession.h" @@ -314,7 +315,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) { if (GetPlayer()->GetGuildId()) { - if (Guild *guild = sObjectMgr->GetGuildById(GetPlayer()->GetGuildId())) + if (Guild *guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId())) { sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, guild); @@ -326,7 +327,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) { if (GetPlayer()->GetGuildId()) { - if (Guild *guild = sObjectMgr->GetGuildById(GetPlayer()->GetGuildId())) + if (Guild *guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId())) { sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, guild); diff --git a/src/server/game/Server/Protocol/Handlers/GuildHandler.cpp b/src/server/game/Server/Protocol/Handlers/GuildHandler.cpp index 625cd3f6160..cddf7cf0f98 100755 --- a/src/server/game/Server/Protocol/Handlers/GuildHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/GuildHandler.cpp @@ -21,6 +21,7 @@ #include "WorldSession.h" #include "World.h" #include "ObjectMgr.h" +#include "GuildMgr.h" #include "Log.h" #include "Opcodes.h" #include "Guild.h" @@ -32,7 +33,7 @@ inline Guild* _GetPlayerGuild(WorldSession* session, bool sendError = false) { if (uint32 guildId = session->GetPlayer()->GetGuildId()) // If guild id = 0, player is not in guild - if (Guild* pGuild = sObjectMgr->GetGuildById(guildId)) // Find guild by id + if (Guild* pGuild = sGuildMgr->GetGuildById(guildId)) // Find guild by id return pGuild; if (sendError) Guild::SendCommandResult(session, GUILD_CREATE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD); @@ -46,7 +47,7 @@ void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket) uint32 guildId; recvPacket >> guildId; // Use received guild id to access guild method (not player's guild id) - if (Guild* pGuild = sObjectMgr->GetGuildById(guildId)) + if (Guild* pGuild = sGuildMgr->GetGuildById(guildId)) pGuild->HandleQuery(this); else Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD); @@ -63,7 +64,7 @@ void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket) { Guild* pGuild = new Guild(); if (pGuild->Create(GetPlayer(), name)) - sObjectMgr->AddGuild(pGuild); + sGuildMgr->AddGuild(pGuild); else delete pGuild; } @@ -99,7 +100,7 @@ void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/) // Player cannot be in guild if (!GetPlayer()->GetGuildId()) // Guild where player was invited must exist - if (Guild* pGuild = sObjectMgr->GetGuildById(GetPlayer()->GetGuildIdInvited())) + if (Guild* pGuild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildIdInvited())) pGuild->HandleAcceptMember(this); } diff --git a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp index ae51b2335ed..3a7cb84dcdc 100755 --- a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp @@ -26,6 +26,7 @@ #include "GossipDef.h" #include "World.h" #include "ObjectMgr.h" +#include "GuildMgr.h" #include "WorldSession.h" #include "BigNumber.h" #include "SHA1.h" @@ -299,7 +300,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; diff --git a/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp b/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp index 8a456a9ec1f..eeebcae31a2 100755 --- a/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp @@ -23,6 +23,7 @@ #include "World.h" #include "ObjectMgr.h" #include "ArenaTeamMgr.h" +#include "GuildMgr.h" #include "Log.h" #include "Opcodes.h" #include "Guild.h" @@ -155,7 +156,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) if (type == GUILD_CHARTER_TYPE) { - if (sObjectMgr->GetGuildByName(name)) + if (sGuildMgr->GetGuildByName(name)) { Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_NAME_EXISTS_S, name); return; @@ -405,7 +406,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data) if (type == GUILD_CHARTER_TYPE) { - if (sObjectMgr->GetGuildByName(newname)) + if (sGuildMgr->GetGuildByName(newname)) { Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_NAME_EXISTS_S, newname); return; @@ -750,7 +751,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) } // Check if guild name is already taken - if (sObjectMgr->GetGuildByName(name)) + if (sGuildMgr->GetGuildByName(name)) { Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_NAME_EXISTS_S, name); return; @@ -822,7 +823,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) } // Register guild and add guild master - sObjectMgr->AddGuild(guild); + sGuildMgr->AddGuild(guild); // Add members from signatures for (uint8 i = 0; i < signatures; ++i) |
