diff options
Diffstat (limited to 'src')
54 files changed, 414 insertions, 354 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 470eb54b584..2b3f3dd7305 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -569,7 +569,7 @@ void SmartAI::JustReachedHome() void SmartAI::EnterCombat(Unit* enemy) { - me->InterruptNonMeleeSpells(false);//msut be before ProcessEvents + me->InterruptNonMeleeSpells(false); // must be before ProcessEvents GetScript()->ProcessEventsFor(SMART_EVENT_AGGRO, enemy); me->GetPosition(&mLastOOCPos); } diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index 69c413108ff..ebe9a9af36b 100755 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -23,10 +23,10 @@ #include "Util.h" #include "SHA1.h" -AccountMgr::AccountMgr() {} -AccountMgr::~AccountMgr() {} +namespace AccountMgr +{ -AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password) +AccountOpResult CreateAccount(std::string username, std::string password) { if (utf8length(username) > MAX_ACCOUNT_STR) return AOR_NAME_TOO_LONG; // username's too long @@ -43,7 +43,7 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass return AOR_OK; // everything's fine } -AccountOpResult AccountMgr::DeleteAccount(uint32 accountId) +AccountOpResult DeleteAccount(uint32 accountId) { QueryResult result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accountId); if (!result) @@ -89,7 +89,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accountId) return AOR_OK; } -AccountOpResult AccountMgr::ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword) +AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword) { QueryResult result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accountId); if (!result) @@ -113,7 +113,7 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accountId, std::string newUser return AOR_OK; } -AccountOpResult AccountMgr::ChangePassword(uint32 accountId, std::string newPassword) +AccountOpResult ChangePassword(uint32 accountId, std::string newPassword) { std::string username; @@ -133,20 +133,20 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accountId, std::string newPass return AOR_OK; } -uint32 AccountMgr::GetId(std::string username) +uint32 GetId(std::string username) { LoginDatabase.EscapeString(username); QueryResult result = LoginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str()); return (result) ? (*result)[0].GetUInt32() : 0; } -uint32 AccountMgr::GetSecurity(uint32 accountId) +uint32 GetSecurity(uint32 accountId) { QueryResult result = LoginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u'", accountId); return (result) ? (*result)[0].GetUInt32() : 0; } -uint32 AccountMgr::GetSecurity(uint64 accountId, int32 realmId) +uint32 GetSecurity(uint64 accountId, int32 realmId) { QueryResult result = (realmId == -1) ? LoginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u' AND RealmID = '%d'", accountId, realmId) @@ -154,7 +154,7 @@ uint32 AccountMgr::GetSecurity(uint64 accountId, int32 realmId) return (result) ? (*result)[0].GetUInt32() : 0; } -bool AccountMgr::GetName(uint32 accountId, std::string& name) +bool GetName(uint32 accountId, std::string& name) { QueryResult result = LoginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", accountId); if (result) @@ -166,7 +166,7 @@ bool AccountMgr::GetName(uint32 accountId, std::string& name) return false; } -bool AccountMgr::CheckPassword(uint32 accountId, std::string password) +bool CheckPassword(uint32 accountId, std::string password) { std::string username; @@ -180,14 +180,14 @@ bool AccountMgr::CheckPassword(uint32 accountId, std::string password) return (result) ? true : false; } -uint32 AccountMgr::GetCharactersCount(uint32 accountId) +uint32 GetCharactersCount(uint32 accountId) { // check character count QueryResult result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%d'", accountId); return (result) ? (*result)[0].GetUInt32() : 0; } -bool AccountMgr::normalizeString(std::string& utf8String) +bool normalizeString(std::string& utf8String) { wchar_t buffer[MAX_ACCOUNT_STR+1]; @@ -205,7 +205,7 @@ bool AccountMgr::normalizeString(std::string& utf8String) return WStrToUtf8(buffer, maxLength, utf8String); } -std::string AccountMgr::CalculateShaPassHash(std::string& name, std::string& password) +std::string CalculateShaPassHash(std::string& name, std::string& password) { SHA1Hash sha; sha.Initialize(); @@ -220,3 +220,29 @@ std::string AccountMgr::CalculateShaPassHash(std::string& name, std::string& pas return encoded; } +bool IsPlayerAccount(uint32 gmlevel) +{ + return gmlevel == SEC_PLAYER; +} + +bool IsModeratorAccount(uint32 gmlevel) +{ + return gmlevel >= SEC_MODERATOR && gmlevel <= SEC_CONSOLE; +} + +bool IsGMAccount(uint32 gmlevel) +{ + return gmlevel >= SEC_GAMEMASTER && gmlevel <= SEC_CONSOLE; +} + +bool IsAdminAccount(uint32 gmlevel) +{ + return gmlevel >= SEC_ADMINISTRATOR && gmlevel <= SEC_CONSOLE; +} + +bool IsConsoleAccount(uint32 gmlevel) +{ + return gmlevel == SEC_CONSOLE; +} + +} // Namespace AccountMgr diff --git a/src/server/game/Accounts/AccountMgr.h b/src/server/game/Accounts/AccountMgr.h index 3eaa0df93b3..aca24e9522f 100755 --- a/src/server/game/Accounts/AccountMgr.h +++ b/src/server/game/Accounts/AccountMgr.h @@ -19,10 +19,9 @@ #ifndef _ACCMGR_H #define _ACCMGR_H +#include "Define.h" #include <string> -#include "Common.h" - enum AccountOpResult { AOR_OK, @@ -35,12 +34,8 @@ enum AccountOpResult #define MAX_ACCOUNT_STR 16 -class AccountMgr +namespace AccountMgr { - public: - AccountMgr(); - ~AccountMgr(); - AccountOpResult CreateAccount(std::string username, std::string password); AccountOpResult DeleteAccount(uint32 accountId); AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword); @@ -54,8 +49,12 @@ class AccountMgr uint32 GetCharactersCount(uint32 accountId); std::string CalculateShaPassHash(std::string& name, std::string& password); - static bool normalizeString(std::string& utf8String); + bool normalizeString(std::string& utf8String); + bool IsPlayerAccount(uint32 gmlevel); + bool IsModeratorAccount(uint32 gmlevel); + bool IsGMAccount(uint32 gmlevel); + bool IsAdminAccount(uint32 gmlevel); + bool IsConsoleAccount(uint32 gmlevel); }; -#define sAccountMgr ACE_Singleton<AccountMgr, ACE_Null_Mutex>::instance() #endif diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 9224f4ad677..f0282d71169 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -110,15 +110,15 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction, SQLTransaction& else { bidder_accId = sObjectMgr->GetPlayerAccountIdByGUID(bidder_guid); - bidder_security = sAccountMgr->GetSecurity(bidder_accId, realmID); + bidder_security = AccountMgr::GetSecurity(bidder_accId, realmID); - if (bidder_security > SEC_PLAYER) // not do redundant DB requests + if (!AccountMgr::IsPlayerAccount(bidder_security)) // not do redundant DB requests { if (!sObjectMgr->GetPlayerNameByGUID(bidder_guid, bidder_name)) bidder_name = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN); } } - if (bidder_security > SEC_PLAYER) + if (!AccountMgr::IsPlayerAccount(bidder_security)) { std::string owner_name; if (!sObjectMgr->GetPlayerNameByGUID(auction->owner, owner_name)) diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index d39018e69a4..d2665b65226 100755 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -22,6 +22,7 @@ #include "SocialMgr.h" #include "World.h" #include "DatabaseEnv.h" +#include "AccountMgr.h" Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) : m_announce(true), m_ownership(true), m_name(name), m_password(""), m_flags(0), m_channelId(channel_id), m_ownerGUID(0), m_Team(Team) @@ -173,7 +174,7 @@ void Channel::Join(uint64 p, const char *pass) if (plr) { if (HasFlag(CHANNEL_FLAG_LFG) && - sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER && plr->GetGroup()) + sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && AccountMgr::IsPlayerAccount(plr->GetSession()->GetSecurity()) && plr->GetGroup()) { MakeNotInLfg(&data); SendToOne(&data, p); @@ -183,7 +184,7 @@ void Channel::Join(uint64 p, const char *pass) plr->JoinedChannel(this); } - if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) + if (m_announce && (!plr || !AccountMgr::IsGMAccount(plr->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) { MakeJoined(&data, p); SendToAll(&data); @@ -245,7 +246,7 @@ void Channel::Leave(uint64 p, bool send) bool changeowner = players[p].IsOwner(); players.erase(p); - if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) + if (m_announce && (!plr || !AccountMgr::IsGMAccount(plr->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) { WorldPacket data; MakeLeft(&data, p); @@ -283,7 +284,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban) MakeNotMember(&data); SendToOne(&data, good); } - else if (!players[good].IsModerator() && sec < SEC_GAMEMASTER) + else if (!players[good].IsModerator() && !AccountMgr::IsGMAccount(sec)) { WorldPacket data; MakeNotModerator(&data); @@ -298,7 +299,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban) MakePlayerNotFound(&data, badname); SendToOne(&data, good); } - else if (sec < SEC_GAMEMASTER && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID) + else if (!AccountMgr::IsGMAccount(sec) && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID) { WorldPacket data; MakeNotOwner(&data); @@ -347,7 +348,7 @@ void Channel::UnBan(uint64 good, const char *badname) MakeNotMember(&data); SendToOne(&data, good); } - else if (!players[good].IsModerator() && sec < SEC_GAMEMASTER) + else if (!players[good].IsModerator() && !AccountMgr::IsGMAccount(sec)) { WorldPacket data; MakeNotModerator(&data); @@ -390,7 +391,7 @@ void Channel::Password(uint64 p, const char *pass) MakeNotMember(&data); SendToOne(&data, p); } - else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER) + else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec)) { WorldPacket data; MakeNotModerator(&data); @@ -422,7 +423,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) MakeNotMember(&data); SendToOne(&data, p); } - else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER) + else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec)) { WorldPacket data; MakeNotModerator(&data); @@ -452,7 +453,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) // allow make moderator from another team only if both is GMs // at this moment this only way to show channel post for GM from another team - if ((plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) && + if ((!AccountMgr::IsGMAccount(plr->GetSession()->GetSecurity()) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) && plr->GetTeam() != newp->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) { WorldPacket data; @@ -492,7 +493,7 @@ void Channel::SetOwner(uint64 p, const char *newname) return; } - if (sec < SEC_GAMEMASTER && p != m_ownerGUID) + if (!AccountMgr::IsGMAccount(sec) && p != m_ownerGUID) { WorldPacket data; MakeNotOwner(&data); @@ -566,7 +567,7 @@ void Channel::List(Player* player) // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all - if (plr && (player->GetSession()->GetSecurity() > SEC_PLAYER || plr->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) && + if (plr && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || plr->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) && plr->IsVisibleGloballyFor(player)) { data << uint64(i->first); @@ -594,7 +595,7 @@ void Channel::Announce(uint64 p) MakeNotMember(&data); SendToOne(&data, p); } - else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER) + else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec)) { WorldPacket data; MakeNotModerator(&data); diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index cecbd223ed9..25f1fadba47 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -510,13 +510,13 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac return false; // ignore only for non-players for non strong checks (when allow apply command at least to same sec level) - if (m_session->GetSecurity() > SEC_PLAYER && !strong && !sWorld->getBoolConfig(CONFIG_GM_LOWER_SECURITY)) + if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity()) && !strong && !sWorld->getBoolConfig(CONFIG_GM_LOWER_SECURITY)) return false; if (target) target_sec = target->GetSecurity(); else if (target_account) - target_sec = sAccountMgr->GetSecurity(target_account, realmID); + target_sec = AccountMgr::GetSecurity(target_account, realmID); else return true; // caller must report error for (target == NULL && target_account == 0) @@ -696,7 +696,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, co // table[i].Name == "" is special case: send original command to handler if ((table[i].Handler)(this, table[i].Name[0] != '\0' ? text : oldtext)) { - if (table[i].SecurityLevel > SEC_PLAYER) + if (!AccountMgr::IsPlayerAccount(table[i].SecurityLevel)) { // chat case if (m_session) @@ -786,7 +786,7 @@ int ChatHandler::ParseCommands(const char* text) std::string fullcmd = text; - if (m_session && m_session->GetSecurity() <= SEC_PLAYER && sWorld->getBoolConfig(CONFIG_ALLOW_PLAYER_COMMANDS) == 0) + if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity()) && !sWorld->getBoolConfig(CONFIG_ALLOW_PLAYER_COMMANDS)) return 0; /// chat case (.command or !command format) @@ -811,7 +811,7 @@ int ChatHandler::ParseCommands(const char* text) if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd)) { - if (m_session && m_session->GetSecurity() == SEC_PLAYER) + if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity())) return 0; SendSysMessage(LANG_NO_CMD); diff --git a/src/server/game/Chat/Commands/Level0.cpp b/src/server/game/Chat/Commands/Level0.cpp index a61ae629666..ad15cc99de9 100755 --- a/src/server/game/Chat/Commands/Level0.cpp +++ b/src/server/game/Chat/Commands/Level0.cpp @@ -129,7 +129,7 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/) Player* player = m_session->GetPlayer(); // save GM account without delay and output message - if (m_session->GetSecurity() > SEC_PLAYER) + if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity())) { if (Player *target = getSelectedPlayer()) target->SaveToDB(); diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 5f2b39fcb4f..334911be09d 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -1933,7 +1933,7 @@ bool ChatHandler::HandleReviveCommand(const char *args) if (target) { - target->ResurrectPlayer(target->GetSession()->GetSecurity() > SEC_PLAYER ? 1.0f : 0.5f); + target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f); target->SpawnCorpseBones(); target->SaveToDB(); } @@ -3065,7 +3065,7 @@ bool ChatHandler::HandleBanInfoAccountCommand(const char *args) return false; } - uint32 accountid = sAccountMgr->GetId(account_name); + uint32 accountid = AccountMgr::GetId(account_name); if (!accountid) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); @@ -3342,7 +3342,7 @@ bool ChatHandler::HandleBanListHelper(QueryResult result) account_name = fields[1].GetString(); // "character" case, name need extract from another DB else - sAccountMgr->GetName (account_id, account_name); + AccountMgr::GetName (account_id, account_name); // No SQL injection. id is uint32. QueryResult banInfo = LoginDatabase.PQuery("SELECT bandate, unbandate, bannedby, banreason FROM account_banned WHERE id = %u ORDER BY unbandate", account_id); @@ -3505,7 +3505,7 @@ bool ChatHandler::HandlePDumpLoadCommand(const char *args) return false; } - uint32 account_id = sAccountMgr->GetId(account_name); + uint32 account_id = AccountMgr::GetId(account_name); if (!account_id) { account_id = atoi(account); // use original string @@ -3517,7 +3517,7 @@ bool ChatHandler::HandlePDumpLoadCommand(const char *args) } } - if (!sAccountMgr->GetName(account_id, account_name)) + if (!AccountMgr::GetName(account_id, account_name)) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); SetSentErrorMessage(true); diff --git a/src/server/game/Chat/Commands/TicketCommands.cpp b/src/server/game/Chat/Commands/TicketCommands.cpp index a80910ee20a..2ae4632d172 100755 --- a/src/server/game/Chat/Commands/TicketCommands.cpp +++ b/src/server/game/Chat/Commands/TicketCommands.cpp @@ -169,9 +169,9 @@ bool ChatHandler::HandleGMTicketAssignToCommand(const char* args) // Get target information uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target.c_str()); uint64 targetAccId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); - uint32 targetGmLevel = sAccountMgr->GetSecurity(targetAccId, realmID); + uint32 targetGmLevel = AccountMgr::GetSecurity(targetAccId, realmID); // Target must exist and have administrative rights - if (!targetGuid || targetGmLevel == SEC_PLAYER) + if (!targetGuid || AccountMgr::IsPlayerAccount(targetGmLevel)) { SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A); return true; @@ -191,7 +191,7 @@ bool ChatHandler::HandleGMTicketAssignToCommand(const char* args) } // Assign ticket SQLTransaction trans = SQLTransaction(NULL); - ticket->SetAssignedTo(targetGuid, targetGmLevel == SEC_ADMINISTRATOR); + ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(targetGmLevel)); ticket->SaveToDB(trans); sTicketMgr->UpdateLastChange(); @@ -227,7 +227,7 @@ bool ChatHandler::HandleGMTicketUnAssignCommand(const char* args) { uint64 guid = ticket->GetAssignedToGUID(); uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(guid); - security = sAccountMgr->GetSecurity(accountId, realmID); + security = AccountMgr::GetSecurity(accountId, realmID); } // Check security Player* player = m_session->GetPlayer(); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f1bfb3e1421..01903e81e76 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -73,6 +73,7 @@ #include "CharacterDatabaseCleaner.h" #include "InstanceScript.h" #include <cmath> +#include "AccountMgr.h" #define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS) @@ -654,7 +655,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa //m_pad = 0; // players always accept - if (GetSession()->GetSecurity() == SEC_PLAYER) + if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity())) SetAcceptWhispers(true); m_curSelection = 0; @@ -996,7 +997,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL) : sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL); - if (GetSession()->GetSecurity() >= SEC_MODERATOR) + if (!AccountMgr::IsPlayerAccount(GetSession()->GetSecurity())) { uint32 gm_level = sWorld->getIntConfig(CONFIG_START_GM_LEVEL); if (gm_level > start_level) @@ -2085,7 +2086,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return false; } - if ((GetSession()->GetSecurity() < SEC_GAMEMASTER) && sDisableMgr->IsDisabledFor(DISABLE_TYPE_MAP, mapid, this)) + if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && sDisableMgr->IsDisabledFor(DISABLE_TYPE_MAP, mapid, this)) { sLog->outError("Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid); SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED); @@ -3116,7 +3117,7 @@ void Player::InitTalentForLevel() // if used more that have then reset if (m_usedTalentCount > talentPointsForLevel) { - if (GetSession()->GetSecurity() < SEC_ADMINISTRATOR) + if (!AccountMgr::IsAdminAccount(GetSession()->GetSecurity())) resetTalents(true); else SetFreeTalentPoints(0); @@ -16510,7 +16511,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // check name limitations if (ObjectMgr::CheckPlayerName(m_name) != CHAR_NAME_SUCCESS || - (GetSession()->GetSecurity() == SEC_PLAYER && sObjectMgr->IsReservedName(m_name))) + (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && sObjectMgr->IsReservedName(m_name))) { CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME), guid); return false; @@ -17038,7 +17039,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) outDebugValues(); // GM state - if (GetSession()->GetSecurity() > SEC_PLAYER) + if (!AccountMgr::IsPlayerAccount(GetSession()->GetSecurity())) { switch (sWorld->getIntConfig(CONFIG_GM_LOGIN_STATE)) { @@ -18940,7 +18941,7 @@ void Player::outDebugValues() const void Player::UpdateSpeakTime() { // ignore chat spam protection for GMs in any mode - if (GetSession()->GetSecurity() > SEC_PLAYER) + if (!AccountMgr::IsPlayerAccount(GetSession()->GetSecurity())) return; time_t current = time (NULL); @@ -19490,8 +19491,6 @@ void Player::PetSpellInitialize() data << uint32(cooldown); // category cooldown } - data.hexlike(); - GetSession()->SendPacket(&data); } @@ -21120,7 +21119,7 @@ bool Player::IsVisibleGloballyFor(Player* u) const return true; // GMs are visible for higher gms (or players are visible for gms) - if (u->GetSession()->GetSecurity() > SEC_PLAYER) + if (!AccountMgr::IsPlayerAccount(u->GetSession()->GetSecurity())) return GetSession()->GetSecurity() <= u->GetSession()->GetSecurity(); // non faction visibility non-breakable for non-GMs diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 3d19fe65f19..452f263d478 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1138,7 +1138,7 @@ class Player : public Unit, public GridObject<Player> void SetAcceptWhispers(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; } bool isGameMaster() const { return m_ExtraFlags & PLAYER_EXTRA_GM_ON; } void SetGameMaster(bool on); - bool isGMChat() const { return GetSession()->GetSecurity() >= SEC_MODERATOR && (m_ExtraFlags & PLAYER_EXTRA_GM_CHAT); } + bool isGMChat() const { return m_ExtraFlags & PLAYER_EXTRA_GM_CHAT; } void SetGMChat(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_CHAT; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_CHAT; } bool isTaxiCheater() const { return m_ExtraFlags & PLAYER_EXTRA_TAXICHEAT; } void SetTaxiCheater(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_TAXICHEAT; else m_ExtraFlags &= ~PLAYER_EXTRA_TAXICHEAT; } diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index 9733d5e80bb..31152f35efe 100755 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.cpp @@ -25,6 +25,7 @@ #include "ObjectMgr.h" #include "World.h" #include "Util.h" +#include "AccountMgr.h" PlayerSocial::PlayerSocial() { @@ -197,7 +198,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri // PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all if (pFriend && pFriend->GetName() && - (security > SEC_PLAYER || + (!AccountMgr::IsPlayerAccount(security) || ((pFriend->GetTeam() == team || allowTwoSideWhoList) && (pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList))) && pFriend->IsVisibleGloballyFor(player)) { @@ -276,7 +277,7 @@ void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet) // PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all if (pFriend && pFriend->IsInWorld() && - (pFriend->GetSession()->GetSecurity() > SEC_PLAYER || + (!AccountMgr::IsPlayerAccount(pFriend->GetSession()->GetSecurity()) || ((pFriend->GetTeam() == team || allowTwoSideWhoList) && security <= gmLevelInWhoList)) && player->IsVisibleGloballyFor(pFriend)) { diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 63aa0f88b14..43e8a69344c 100755 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -24,6 +24,7 @@ #include "Config.h" #include "SocialMgr.h" #include "Log.h" +#include "AccountMgr.h" #define MAX_GUILD_BANK_TAB_TEXT_LEN 500 #define EMBLEM_PRICE 10 * GOLD @@ -937,7 +938,7 @@ void Guild::BankMoveItemData::LogBankEvent(SQLTransaction& trans, MoveItemData* void Guild::BankMoveItemData::LogAction(MoveItemData* pFrom) const { MoveItemData::LogAction(pFrom); - if (!pFrom->IsBank() && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE) && m_pPlayer->GetSession()->GetSecurity() > SEC_PLAYER) // TODO: move to scripts + if (!pFrom->IsBank() && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE) && !AccountMgr::IsPlayerAccount(m_pPlayer->GetSession()->GetSecurity())) // TODO: move to scripts sLog->outCommand(m_pPlayer->GetSession()->GetAccountId(), "GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u)", m_pPlayer->GetName(), m_pPlayer->GetSession()->GetAccountId(), @@ -1630,7 +1631,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount) player->ModifyMoney(-int32(amount)); player->SaveGoldToDB(trans); // Log GM action (TODO: move to scripts) - if (player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(player->GetSession()->GetAccountId(), "GM %s (Account: %u) deposit money (Amount: %u) to pGuild bank (Guild ID %u)", diff --git a/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp b/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp index 589ad0a5c10..4b6e26e410a 100755 --- a/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp @@ -27,6 +27,7 @@ #include "Opcodes.h" #include "UpdateMask.h" #include "Util.h" +#include "AccountMgr.h" //please DO NOT use iterator++, because it is slower than ++iterator!!! //post-incrementation is always slower than pre-incrementation ! @@ -204,7 +205,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) return; } - if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (AccountMgr::IsGMAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)", GetPlayerName(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), count); diff --git a/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp b/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp index 5bccf511da3..beb55b72c9f 100755 --- a/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp @@ -629,7 +629,6 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA"); - //recv_data.hexlike(); uint64 guid; // arena Battlemaster guid uint8 arenaslot; // 2v2, 3v3 or 5v5 diff --git a/src/server/game/Server/Protocol/Handlers/CalendarHandler.cpp b/src/server/game/Server/Protocol/Handlers/CalendarHandler.cpp index 2377450c282..8a56d5f56ad 100755 --- a/src/server/game/Server/Protocol/Handlers/CalendarHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/CalendarHandler.cpp @@ -127,21 +127,18 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket & /*recv_data*/) */ sLog->outDebug(LOG_FILTER_NETWORKIO, "Sending calendar"); - data.hexlike(); SendPacket(&data); } void WorldSession::HandleCalendarGetEvent(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GET_EVENT"); - recv_data.hexlike(); recv_data.read_skip<uint64>(); // unk } void WorldSession::HandleCalendarGuildFilter(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GUILD_FILTER"); - recv_data.hexlike(); recv_data.read_skip<uint32>(); // unk1 recv_data.read_skip<uint32>(); // unk2 recv_data.read_skip<uint32>(); // unk3 @@ -150,14 +147,12 @@ void WorldSession::HandleCalendarGuildFilter(WorldPacket &recv_data) void WorldSession::HandleCalendarArenaTeam(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_ARENA_TEAM"); - recv_data.hexlike(); recv_data.read_skip<uint32>(); // unk } void WorldSession::HandleCalendarAddEvent(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_ADD_EVENT"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //std::string unk1, unk2; @@ -193,7 +188,6 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket &recv_data) void WorldSession::HandleCalendarUpdateEvent(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_UPDATE_EVENT"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data >> uint64 @@ -212,7 +206,6 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket &recv_data) void WorldSession::HandleCalendarRemoveEvent(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_REMOVE_EVENT"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data >> uint64 @@ -224,7 +217,6 @@ void WorldSession::HandleCalendarRemoveEvent(WorldPacket &recv_data) void WorldSession::HandleCalendarCopyEvent(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_COPY_EVENT"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data >> uint64 @@ -236,7 +228,6 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket &recv_data) void WorldSession::HandleCalendarEventInvite(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_INVITE"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data >> uint64 @@ -250,7 +241,6 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket &recv_data) void WorldSession::HandleCalendarEventRsvp(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_RSVP"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data >> uint64 @@ -262,7 +252,6 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket &recv_data) void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_REMOVE_INVITE"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data.readPackGUID(guid) @@ -274,7 +263,6 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket &recv_data) void WorldSession::HandleCalendarEventStatus(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_STATUS"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data.readPackGUID(guid) @@ -287,7 +275,6 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket &recv_data) void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_MODERATOR_STATUS"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data.readPackGUID(guid) @@ -300,7 +287,6 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket &recv_data) void WorldSession::HandleCalendarComplain(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_COMPLAIN"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data >> uint64 diff --git a/src/server/game/Server/Protocol/Handlers/ChannelHandler.cpp b/src/server/game/Server/Protocol/Handlers/ChannelHandler.cpp index 841ed7ee331..e2b5a6b1165 100755 --- a/src/server/game/Server/Protocol/Handlers/ChannelHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ChannelHandler.cpp @@ -60,7 +60,6 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket) void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); uint32 unk; std::string channelname; @@ -81,7 +80,6 @@ void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket) void WorldSession::HandleChannelList(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname; recvPacket >> channelname; @@ -93,7 +91,6 @@ void WorldSession::HandleChannelList(WorldPacket& recvPacket) void WorldSession::HandleChannelPassword(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, pass; recvPacket >> channelname; @@ -107,7 +104,6 @@ void WorldSession::HandleChannelPassword(WorldPacket& recvPacket) void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, newp; recvPacket >> channelname; @@ -124,7 +120,6 @@ void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket) void WorldSession::HandleChannelOwner(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname; recvPacket >> channelname; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) @@ -135,7 +130,6 @@ void WorldSession::HandleChannelOwner(WorldPacket& recvPacket) void WorldSession::HandleChannelModerator(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -152,7 +146,6 @@ void WorldSession::HandleChannelModerator(WorldPacket& recvPacket) void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -169,7 +162,6 @@ void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket) void WorldSession::HandleChannelMute(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -186,7 +178,6 @@ void WorldSession::HandleChannelMute(WorldPacket& recvPacket) void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -204,7 +195,6 @@ void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket) void WorldSession::HandleChannelInvite(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -221,7 +211,6 @@ void WorldSession::HandleChannelInvite(WorldPacket& recvPacket) void WorldSession::HandleChannelKick(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -237,7 +226,6 @@ void WorldSession::HandleChannelKick(WorldPacket& recvPacket) void WorldSession::HandleChannelBan(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -254,7 +242,6 @@ void WorldSession::HandleChannelBan(WorldPacket& recvPacket) void WorldSession::HandleChannelUnban(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -272,7 +259,6 @@ void WorldSession::HandleChannelUnban(WorldPacket& recvPacket) void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname; recvPacket >> channelname; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) @@ -289,7 +275,6 @@ void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket) void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname; recvPacket >> channelname; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) @@ -308,7 +293,6 @@ void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket) void WorldSession::HandleSetChannelWatch(WorldPacket &recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname; recvPacket >> channelname; /*if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) diff --git a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp index 1d6e9bf5722..05bb5e7d411 100755 --- a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp @@ -42,6 +42,7 @@ #include "Util.h" #include "ScriptMgr.h" #include "Battleground.h" +#include "AccountMgr.h" class LoginQueryHolder : public SQLQueryHolder { @@ -279,7 +280,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) WorldPacket data(SMSG_CHAR_CREATE, 1); // returned with diff.values in all cases - if (GetSecurity() == SEC_PLAYER) + if (AccountMgr::IsPlayerAccount(GetSecurity())) { if (uint32 mask = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED)) { @@ -337,7 +338,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) return; } - if (GetSecurity() == SEC_PLAYER) + if (AccountMgr::IsPlayerAccount(GetSecurity())) { uint32 raceMaskDisabled = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK); if ((1 << (race_ - 1)) & raceMaskDisabled) @@ -374,7 +375,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) return; } - if (GetSecurity() == SEC_PLAYER && sObjectMgr->IsReservedName(name)) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && sObjectMgr->IsReservedName(name)) { data << (uint8)CHAR_NAME_RESERVED; SendPacket(&data); @@ -383,7 +384,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) // speedup check for heroic class disabled case uint32 heroic_free_slots = sWorld->getIntConfig(CONFIG_HEROIC_CHARACTERS_PER_REALM); - if (heroic_free_slots == 0 && GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT) + if (heroic_free_slots == 0 && AccountMgr::IsPlayerAccount(GetSecurity()) && class_ == CLASS_DEATH_KNIGHT) { data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT; SendPacket(&data); @@ -392,7 +393,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) // speedup check for heroic class disabled case uint32 req_level_for_heroic = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER); - if (GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT; SendPacket(&data); @@ -492,7 +493,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte } } - bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER; + bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || !AccountMgr::IsPlayerAccount(GetSecurity()); uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS); _charCreateCallback.FreeResult(); @@ -516,7 +517,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte bool haveSameRace = false; uint32 heroicReqLevel = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER); bool hasHeroicReqLevel = (heroicReqLevel == 0); - bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER; + bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || !AccountMgr::IsPlayerAccount(GetSecurity()); uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS); if (result) @@ -527,7 +528,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte Field* field = result->Fetch(); uint8 accRace = field[1].GetUInt8(); - if (GetSecurity() == SEC_PLAYER && createInfo->Class == CLASS_DEATH_KNIGHT) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && createInfo->Class == CLASS_DEATH_KNIGHT) { uint8 accClass = field[2].GetUInt8(); if (accClass == CLASS_DEATH_KNIGHT) @@ -588,7 +589,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte if (!haveSameRace) haveSameRace = createInfo->Race == accRace; - if (GetSecurity() == SEC_PLAYER && createInfo->Class == CLASS_DEATH_KNIGHT) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && createInfo->Class == CLASS_DEATH_KNIGHT) { uint8 acc_class = field[2].GetUInt8(); if (acc_class == CLASS_DEATH_KNIGHT) @@ -618,7 +619,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte } } - if (GetSecurity() == SEC_PLAYER && createInfo->Class == CLASS_DEATH_KNIGHT && !hasHeroicReqLevel) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && createInfo->Class == CLASS_DEATH_KNIGHT && !hasHeroicReqLevel) { WorldPacket data(SMSG_CHAR_CREATE, 1); data << uint8(CHAR_CREATE_LEVEL_REQUIREMENT); @@ -1121,7 +1122,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) } // check name limitations - if (GetSecurity() == SEC_PLAYER && sObjectMgr->IsReservedName(newname)) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && sObjectMgr->IsReservedName(newname)) { WorldPacket data(SMSG_CHAR_RENAME, 1); data << uint8(CHAR_NAME_RESERVED); @@ -1383,7 +1384,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) } // check name limitations - if (GetSecurity() == SEC_PLAYER && sObjectMgr->IsReservedName(newname)) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && sObjectMgr->IsReservedName(newname)) { WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1); data << uint8(CHAR_NAME_RESERVED); @@ -1487,7 +1488,6 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data) return; sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_USE"); - recv_data.hexlike(); for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) { @@ -1575,7 +1575,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) return; } - if (GetSecurity() == SEC_PLAYER) + if (AccountMgr::IsPlayerAccount(GetSecurity())) { uint32 raceMaskDisabled = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK); if ((1 << (race - 1)) & raceMaskDisabled) @@ -1606,7 +1606,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) } // check name limitations - if (GetSecurity() == SEC_PLAYER && sObjectMgr->IsReservedName(newname)) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && sObjectMgr->IsReservedName(newname)) { WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); data << uint8(CHAR_NAME_RESERVED); diff --git a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp index becd81022c4..4f4c6ea700b 100755 --- a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp @@ -39,6 +39,7 @@ #include "SpellAuraEffects.h" #include "Util.h" #include "ScriptMgr.h" +#include "AccountMgr.h" bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg, uint32 lang) { @@ -48,7 +49,7 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg if (sWorld->getBoolConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING)) stripLineInvisibleChars(msg); - if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && GetSecurity() < SEC_MODERATOR + if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && AccountMgr::IsPlayerAccount(GetSecurity()) && !ChatHandler(this).isValidChatMessage(msg.c_str())) { sLog->outError("Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName(), @@ -269,24 +270,20 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) } Player* receiver = sObjectAccessor->FindPlayerByName(to.c_str()); - uint32 senderSecurity = GetSecurity(); - uint32 receiverSecurity = receiver ? receiver->GetSession()->GetSecurity() : SEC_PLAYER; - if (!receiver || (senderSecurity == SEC_PLAYER && receiverSecurity > SEC_PLAYER && !receiver->isAcceptWhispers() && !receiver->IsInWhisperWhiteList(sender->GetGUID()))) + bool senderIsPlayer = AccountMgr::IsPlayerAccount(GetSecurity()); + bool receiverIsPlayer = AccountMgr::IsPlayerAccount(receiver ? receiver->GetSession()->GetSecurity() : SEC_PLAYER); + if (!receiver || (senderIsPlayer && !receiverIsPlayer && !receiver->isAcceptWhispers() && !receiver->IsInWhisperWhiteList(sender->GetGUID()))) { SendPlayerNotFoundNotice(to); return; } - if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && senderSecurity == SEC_PLAYER && receiverSecurity == SEC_PLAYER) - { - uint32 senderFaction = GetPlayer()->GetTeam(); - uint32 receiverFaction = receiver->GetTeam(); - if (senderFaction != receiverFaction) + if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && senderIsPlayer && receiverIsPlayer) + if (GetPlayer()->GetTeam() != receiver->GetTeam()) { SendWrongFactionNotice(); return; } - } if (GetPlayer()->HasAura(1852) && !receiver->isGameMaster()) { @@ -295,7 +292,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) } // If player is a Gamemaster and doesn't accept whisper, we auto-whitelist every player that the Gamemaster is talking to - if (senderSecurity > SEC_PLAYER && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID())) + if (!senderIsPlayer && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID())) sender->AddWhisperWhiteList(receiver->GetGUID()); GetPlayer()->Whisper(msg, lang, receiver->GetGUID()); @@ -420,10 +417,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) } break; case CHAT_MSG_CHANNEL: { - if (_player->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ)) + if (AccountMgr::IsPlayerAccount(GetSecurity())) { - SendNotification(GetTrinityString(LANG_CHANNEL_REQ), sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ)); - return; + if (_player->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ)) + { + SendNotification(GetTrinityString(LANG_CHANNEL_REQ), sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ)); + return; + } } if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) diff --git a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp index b1afc3d6c97..e114972661f 100755 --- a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp @@ -1051,7 +1051,6 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_WRAP_ITEM"); uint8 gift_bag, gift_slot, item_bag, item_slot; - //recv_data.hexlike(); recv_data >> gift_bag >> gift_slot; // paper recv_data >> item_bag >> item_slot; // item diff --git a/src/server/game/Server/Protocol/Handlers/LootHandler.cpp b/src/server/game/Server/Protocol/Handlers/LootHandler.cpp index 196679a4c73..7caf8f9ef07 100755 --- a/src/server/game/Server/Protocol/Handlers/LootHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/LootHandler.cpp @@ -158,6 +158,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/) if (loot) { + loot->NotifyMoneyRemoved(); if (shareMoney && player->GetGroup()) //item, pickpocket and players can be looted only single player { Group* group = player->GetGroup(); @@ -177,28 +178,27 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/) for (std::vector<Player*>::const_iterator i = playersNear.begin(); i != playersNear.end(); ++i) { + (*i)->ModifyMoney(goldPerPlayer); + (*i)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, goldPerPlayer); + WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4 + 1); data << uint32(goldPerPlayer); - data << uint8(0); // Controls the text displayed 0 is "Your share is...", 1 "You loot..." + data << uint8(playersNear.size() > 1 ? 0 : 1); // Controls the text displayed in chat. 0 is "Your share is..." and 1 is "You loot..." (*i)->GetSession()->SendPacket(&data); - - (*i)->ModifyMoney(goldPerPlayer); - (*i)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, goldPerPlayer); } } else { + player->ModifyMoney(loot->gold); + player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, loot->gold); + WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4 + 1); data << uint32(loot->gold); - data << uint8(1); + data << uint8(1); // "You loot..." SendPacket(&data); - - player->ModifyMoney(loot->gold); - player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, loot->gold); } loot->gold = 0; - loot->NotifyMoneyRemoved(); } } diff --git a/src/server/game/Server/Protocol/Handlers/MailHandler.cpp b/src/server/game/Server/Protocol/Handlers/MailHandler.cpp index 5b601ba15b1..ffaa846767e 100755 --- a/src/server/game/Server/Protocol/Handlers/MailHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MailHandler.cpp @@ -27,6 +27,7 @@ #include "Language.h" #include "DBCStores.h" #include "Item.h" +#include "AccountMgr.h" void WorldSession::HandleSendMail(WorldPacket & recv_data) { @@ -160,7 +161,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) } } - if (!accountBound && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && pl->GetTeam() != rc_team && GetSecurity() == SEC_PLAYER) + if (!accountBound && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && pl->GetTeam() != rc_team && AccountMgr::IsPlayerAccount(GetSecurity())) { pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM); return; @@ -246,7 +247,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) for (uint8 i = 0; i < items_count; ++i) { Item* item = items[i]; - if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (!AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) to player: %s (Account: %u)", GetPlayerName(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), receiver.c_str(), rc_account); @@ -266,7 +267,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) needItemDelay = pl->GetSession()->GetAccountId() != rc_account; } - if (money > 0 && GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (money > 0 && !AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail money: %u to player: %s (Account: %u)", GetPlayerName(), GetAccountId(), money, receiver.c_str(), rc_account); @@ -440,7 +441,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data) uint32 sender_accId = 0; - if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (!AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { std::string sender_name; if (receive) diff --git a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp index b53aa79dde8..4ee91aaae19 100755 --- a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp @@ -50,6 +50,7 @@ #include "InstanceScript.h" #include "GameObjectAI.h" #include "Group.h" +#include "AccountMgr.h" void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) { @@ -167,7 +168,6 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) void WorldSession::HandleWhoOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message"); - //recv_data.hexlike(); uint32 matchcount = 0; @@ -243,7 +243,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data) HashMapHolder<Player>::MapType& m = sObjectAccessor->GetPlayers(); for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { - if (security == SEC_PLAYER) + if (AccountMgr::IsPlayerAccount(security)) { // player can see member of other team only if CONFIG_ALLOW_TWO_SIDE_WHO_LIST if (itr->second->GetTeam() != team && !allowTwoSideWhoList) @@ -561,13 +561,13 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult result, std::string team = Player::TeamForRace((*result)[1].GetUInt8()); friendAcctid = (*result)[2].GetUInt32(); - if (GetSecurity() >= SEC_MODERATOR || sWorld->getBoolConfig(CONFIG_ALLOW_GM_FRIEND) || sAccountMgr->GetSecurity(friendAcctid, realmID) < SEC_MODERATOR) + if (!AccountMgr::IsPlayerAccount(GetSecurity()) || sWorld->getBoolConfig(CONFIG_ALLOW_GM_FRIEND) || AccountMgr::IsPlayerAccount(AccountMgr::GetSecurity(friendAcctid, realmID))) { if (friendGuid) { if (friendGuid == GetPlayer()->GetGUID()) friendResult = FRIEND_SELF; - else if (GetPlayer()->GetTeam() != team && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && GetSecurity() < SEC_MODERATOR) + else if (GetPlayer()->GetTeam() != team && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && AccountMgr::IsPlayerAccount(GetSecurity())) friendResult = FRIEND_ENEMY; else if (GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid))) friendResult = FRIEND_ALREADY; @@ -1275,7 +1275,7 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) sLog->outStaticDebug("Time %u sec, map=%u, x=%f, y=%f, z=%f, orient=%f", time/1000, mapid, PositionX, PositionY, PositionZ, Orientation); - if (GetSecurity() >= SEC_ADMINISTRATOR) + if (AccountMgr::IsAdminAccount(GetSecurity())) GetPlayer()->TeleportTo(mapid, PositionX, PositionY, PositionZ, Orientation); else SendNotification(LANG_YOU_NOT_HAVE_PERMISSION); @@ -1288,7 +1288,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) std::string charname; recv_data >> charname; - if (GetSecurity() < SEC_ADMINISTRATOR) + if (!AccountMgr::IsAdminAccount(GetSecurity())) { SendNotification(LANG_YOU_NOT_HAVE_PERMISSION); return; @@ -1340,7 +1340,6 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) void WorldSession::HandleComplainOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_COMPLAIN"); - recv_data.hexlike(); uint8 spam_type; // 0 - mail, 1 - chat uint64 spammer_guid; @@ -1401,7 +1400,6 @@ void WorldSession::HandleRealmSplitOpcode(WorldPacket & recv_data) void WorldSession::HandleFarSightOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_FAR_SIGHT"); - //recv_data.hexlike(); uint8 apply; recv_data >> apply; @@ -1626,7 +1624,6 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket & recv_data) { // fly mode on/off sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_MOVE_SET_CAN_FLY_ACK"); - //recv_data.hexlike(); uint64 guid; // guid - unused recv_data.readPackGUID(guid); diff --git a/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp b/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp index 050f07e043b..6bcad1ce106 100755 --- a/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp @@ -243,7 +243,6 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) { uint16 opcode = recv_data.GetOpcode(); - recv_data.hexlike(); Unit *mover = _player->m_mover; diff --git a/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp b/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp index b0ab7ec6e9f..92ea0cac5f3 100755 --- a/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp @@ -59,7 +59,6 @@ enum CharterCosts void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_BUY"); - recv_data.hexlike(); uint64 guidNPC; uint32 clientIndex; // 1 for guild and arenaslot+1 for arenas in client @@ -246,7 +245,6 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data) { // ok sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_SHOW_SIGNATURES"); - //recv_data.hexlike(); uint8 signs = 0; uint64 petitionguid; @@ -298,7 +296,6 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data) void WorldSession::HandlePetitionQueryOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_QUERY"); // ok - //recv_data.hexlike(); uint32 guildguid; uint64 petitionguid; @@ -378,7 +375,6 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode MSG_PETITION_RENAME"); // ok - //recv_data.hexlike(); uint64 petitionguid; uint32 type; @@ -446,7 +442,6 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data) void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_SIGN"); // ok - //recv_data.hexlike(); Field *fields; uint64 petitionguid; @@ -571,7 +566,6 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode MSG_PETITION_DECLINE"); // ok - //recv_data.hexlike(); uint64 petitionguid; uint64 ownerguid; @@ -597,7 +591,6 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data) void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_OFFER_PETITION"); // ok - //recv_data.hexlike(); uint8 signs = 0; uint64 petitionguid, plguid; diff --git a/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp b/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp index 88cff4fc7cf..0a738f4c99c 100755 --- a/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp @@ -402,7 +402,6 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data) void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data) { sLog->outDetail("WORLD: Received CMSG_PAGE_TEXT_QUERY"); - recv_data.hexlike(); uint32 pageID; recv_data >> pageID; diff --git a/src/server/game/Server/Protocol/Handlers/TradeHandler.cpp b/src/server/game/Server/Protocol/Handlers/TradeHandler.cpp index 9dce42d6202..2e0e9f49f2b 100755 --- a/src/server/game/Server/Protocol/Handlers/TradeHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/TradeHandler.cpp @@ -28,6 +28,7 @@ #include "Spell.h" #include "SocialMgr.h" #include "Language.h" +#include "AccountMgr.h" void WorldSession::SendTradeStatus(TradeStatus status) { @@ -151,7 +152,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) { // logging sLog->outDebug(LOG_FILTER_NETWORKIO, "partner storing: %u", myItems[i]->GetGUIDLow()); - if (_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (!AccountMgr::IsPlayerAccount(_player->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)", _player->GetName(), _player->GetSession()->GetAccountId(), @@ -169,7 +170,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) { // logging sLog->outDebug(LOG_FILTER_NETWORKIO, "player storing: %u", hisItems[i]->GetGUIDLow()); - if (trader->GetSession()->GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (!AccountMgr::IsPlayerAccount(trader->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(trader->GetSession()->GetAccountId(), "GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)", trader->GetName(), trader->GetSession()->GetAccountId(), @@ -459,14 +460,14 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) // logging money if (sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { - if (_player->GetSession()->GetSecurity() > SEC_PLAYER && my_trade->GetMoney() > 0) + if (!AccountMgr::IsPlayerAccount(_player->GetSession()->GetSecurity()) && my_trade->GetMoney() > 0) { sLog->outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)", _player->GetName(), _player->GetSession()->GetAccountId(), my_trade->GetMoney(), trader->GetName(), trader->GetSession()->GetAccountId()); } - if (trader->GetSession()->GetSecurity() > SEC_PLAYER && his_trade->GetMoney() > 0) + if (!AccountMgr::IsPlayerAccount(trader->GetSession()->GetSecurity()) && his_trade->GetMoney() > 0) { sLog->outCommand(trader->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)", trader->GetName(), trader->GetSession()->GetAccountId(), diff --git a/src/server/game/Server/Protocol/Handlers/VehicleHandler.cpp b/src/server/game/Server/Protocol/Handlers/VehicleHandler.cpp index 2fcfcc25672..c6215d8e3b1 100644 --- a/src/server/game/Server/Protocol/Handlers/VehicleHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/VehicleHandler.cpp @@ -26,7 +26,6 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE"); - recv_data.hexlike(); uint64 vehicleGUID = _player->GetCharmGUID(); @@ -52,7 +51,6 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data) void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE"); - recv_data.hexlike(); Unit* vehicle_base = GetPlayer()->GetVehicleBase(); if (!vehicle_base) @@ -212,7 +210,6 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) void WorldSession::HandleRequestVehicleExit(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_REQUEST_VEHICLE_EXIT"); - recv_data.hexlike(); if (Vehicle* vehicle = GetPlayer()->GetVehicle()) { diff --git a/src/server/game/Server/Protocol/Handlers/VoiceChatHandler.cpp b/src/server/game/Server/Protocol/Handlers/VoiceChatHandler.cpp index e2b5fe96ae1..de65d165bff 100755 --- a/src/server/game/Server/Protocol/Handlers/VoiceChatHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/VoiceChatHandler.cpp @@ -28,14 +28,12 @@ void WorldSession::HandleVoiceSessionEnableOpcode(WorldPacket & recv_data) // uint8 isVoiceEnabled, uint8 isMicrophoneEnabled recv_data.read_skip<uint8>(); recv_data.read_skip<uint8>(); - recv_data.hexlike(); } void WorldSession::HandleChannelVoiceOnOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CHANNEL_VOICE_ON"); // Enable Voice button in channel context menu - recv_data.hexlike(); } void WorldSession::HandleSetActiveVoiceChannel(WorldPacket & recv_data) @@ -43,6 +41,5 @@ void WorldSession::HandleSetActiveVoiceChannel(WorldPacket & recv_data) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SET_ACTIVE_VOICE_CHANNEL"); recv_data.read_skip<uint32>(); recv_data.read_skip<char*>(); - recv_data.hexlike(); } diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 74187686fe6..2f58d476ce2 100755 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -44,6 +44,7 @@ #include "Log.h" #include "WorldLog.h" #include "ScriptMgr.h" +#include "AccountMgr.h" #if defined(__GNUC__) #pragma pack(1) @@ -935,7 +936,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) // Check locked state for server AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit(); sLog->outDebug(LOG_FILTER_NETWORKIO, "Allowed Level: %u Player Level %u", allowedAccountType, AccountTypes(security)); - if (allowedAccountType > SEC_PLAYER && AccountTypes(security) < allowedAccountType) + if (AccountTypes(security) < allowedAccountType) { WorldPacket Packet (SMSG_AUTH_RESPONSE, 1); Packet << uint8 (AUTH_UNAVAILABLE); @@ -1039,7 +1040,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) { ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1); - if (m_Session && m_Session->GetSecurity() == SEC_PLAYER) + if (m_Session && AccountMgr::IsPlayerAccount(m_Session->GetSecurity())) { Player* _player = m_Session->GetPlayer(); sLog->outError("WorldSocket::HandlePing: Player (account: %u, GUID: %u, name: %s) kicked for over-speed pings (address: %s)", diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index d1aee5b884e..2642ed6a7ed 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -61,6 +61,7 @@ #include "Vehicle.h" #include "ScriptMgr.h" #include "GameObjectAI.h" +#include "AccountMgr.h" pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= { @@ -722,6 +723,14 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex) } break; } + case SPELLFAMILY_MAGE: + { + // Deep Freeze should deal damage to permanently stun-immune targets. + if (m_spellInfo->Id == 71757) + if (unitTarget->GetTypeId() != TYPEID_UNIT || !(unitTarget->IsImmunedToSpellEffect(sSpellMgr->GetSpellInfo(44572), 0))) + return; + break; + } } if (m_originalCaster && damage > 0 && apply_direct_bonus) @@ -2725,17 +2734,17 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) if (gameObjTarget) { GameObjectTemplate const* goInfo = gameObjTarget->GetGOInfo(); - // Arathi Basin banner opening ! + // Arathi Basin banner opening. // TODO: Verify correctness of this check if ((goInfo->type == GAMEOBJECT_TYPE_BUTTON && goInfo->button.noDamageImmune) || (goInfo->type == GAMEOBJECT_TYPE_GOOBER && goInfo->goober.losOK)) { //CanUseBattlegroundObject() already called in CheckCast() // in battleground check if (Battleground *bg = player->GetBattleground()) - { - bg->EventPlayerClickedOnFlag(player, gameObjTarget); - return; - } + { + bg->EventPlayerClickedOnFlag(player, gameObjTarget); + return; + } } else if (goInfo->type == GAMEOBJECT_TYPE_FLAGSTAND) { @@ -3433,7 +3442,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex) if (!item_owner) return; - if (item_owner != p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(p_caster->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)", p_caster->GetName(), p_caster->GetSession()->GetAccountId(), @@ -3494,7 +3503,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex) if (!item_owner) return; - if (item_owner != p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(p_caster->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)", p_caster->GetName(), p_caster->GetSession()->GetAccountId(), @@ -3624,7 +3633,7 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) if (!item_owner) return; - if (item_owner != p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(p_caster->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(temp): %s (Entry: %d) for player: %s (Account: %u)", p_caster->GetName(), p_caster->GetSession()->GetAccountId(), diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 85139061303..ece4bd36da1 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2979,6 +2979,9 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_NEARBY_ENTRY; spellInfo->EffectImplicitTargetB[0] = TARGET_DEST_NEARBY_ENTRY; break; + case 19465: // Improved Stings, only rank 2 of this spell has target for effect 2 = TARGET_DST_DB + spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_CASTER; + break; case 59725: // Improved Spell Reflection - aoe aura // Target entry seems to be wrong for this spell :/ spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER_AREA_PARTY; @@ -3229,6 +3232,11 @@ void SpellMgr::LoadDbcDataCorrections() // that will be clear if we get more spells with problem like this spellInfo->AttributesEx |= SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY; break; + case 62584: // Lifebinder's Gift + case 64185: // Lifebinder's Gift + spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_NEARBY_ENTRY; + spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_NEARBY_ENTRY; + break; // ENDOF ULDUAR SPELLS // // TRIAL OF THE CRUSADER SPELLS diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index 7961c705d5b..37da6512d21 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -382,7 +382,7 @@ void fixNULLfields(std::string &line) DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, std::string name, uint32 guid) { - uint32 charcount = sAccountMgr->GetCharactersCount(account); + uint32 charcount = AccountMgr::GetCharactersCount(account); if (charcount >= 10) return DUMP_TOO_MANY_CHARS; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index aa4ce9444ae..d16e49b6b36 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -260,7 +260,7 @@ World::AddSession_(WorldSession* s) if (decrease_session) --Sessions; - if (pLimit > 0 && Sessions >= pLimit && s->GetSecurity() == SEC_PLAYER && !HasRecentlyDisconnected(s)) + if (pLimit > 0 && Sessions >= pLimit && AccountMgr::IsPlayerAccount(s->GetSecurity()) && !HasRecentlyDisconnected(s)) { AddQueuedPlayer (s); UpdateMaxSessionCounters(); @@ -2037,7 +2037,7 @@ void World::SendGlobalGMMessage(WorldPacket* packet, WorldSession* self, uint32 itr->second->GetPlayer() && itr->second->GetPlayer()->IsInWorld() && itr->second != self && - itr->second->GetSecurity() > SEC_PLAYER && + !AccountMgr::IsPlayerAccount(itr->second->GetSecurity()) && (team == 0 || itr->second->GetPlayer()->GetTeam() == team)) { itr->second->SendPacket(packet); @@ -2134,7 +2134,7 @@ void World::SendGMText(int32 string_id, ...) if (!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld()) continue; - if (itr->second->GetSecurity() < SEC_MODERATOR) + if (AccountMgr::IsPlayerAccount(itr->second->GetSecurity())) continue; wt_do(itr->second->GetPlayer()); @@ -2298,7 +2298,7 @@ bool World::RemoveBanAccount(BanMode mode, std::string nameOrIP) { uint32 account = 0; if (mode == BAN_ACCOUNT) - account = sAccountMgr->GetId(nameOrIP); + account = AccountMgr::GetId(nameOrIP); else if (mode == BAN_CHARACTER) account = sObjectMgr->GetPlayerAccountIdByPlayerName(nameOrIP); diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 17bc0daec5b..11238850958 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -99,11 +99,11 @@ public: if (!szAcc || !szPassword) return false; - // normalized in sAccountMgr->CreateAccount + // normalized in AccountMgr::CreateAccount std::string account_name = szAcc; std::string password = szPassword; - AccountOpResult result = sAccountMgr->CreateAccount(account_name, password); + AccountOpResult result = AccountMgr::CreateAccount(account_name, password); switch(result) { case AOR_OK: @@ -150,7 +150,7 @@ public: return false; } - uint32 account_id = sAccountMgr->GetId(account_name); + uint32 account_id = AccountMgr::GetId(account_name); if (!account_id) { handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); @@ -164,7 +164,7 @@ public: if (handler->HasLowerSecurityAccount (NULL, account_id, true)) return false; - AccountOpResult result = sAccountMgr->DeleteAccount(account_id); + AccountOpResult result = AccountMgr::DeleteAccount(account_id); switch(result) { case AOR_OK: @@ -282,7 +282,7 @@ public: return false; } - if (!sAccountMgr->CheckPassword(handler->GetSession()->GetAccountId(), std::string(old_pass))) + if (!AccountMgr::CheckPassword(handler->GetSession()->GetAccountId(), std::string(old_pass))) { handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD); handler->SetSentErrorMessage(true); @@ -296,7 +296,7 @@ public: return false; } - AccountOpResult result = sAccountMgr->ChangePassword(handler->GetSession()->GetAccountId(), std::string(new_pass)); + AccountOpResult result = AccountMgr::ChangePassword(handler->GetSession()->GetAccountId(), std::string(new_pass)); switch(result) { case AOR_OK: @@ -342,7 +342,7 @@ public: return false; account_id = player->GetSession()->GetAccountId(); - sAccountMgr->GetName(account_id, account_name); + AccountMgr::GetName(account_id, account_name); szExp = szAcc; } else @@ -356,7 +356,7 @@ public: return false; } - account_id = sAccountMgr->GetId(account_name); + account_id = AccountMgr::GetId(account_name); if (!account_id) { handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); @@ -429,17 +429,17 @@ public: } // handler->getSession() == NULL only for console - targetAccountId = (isAccountNameGiven) ? sAccountMgr->GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId(); + targetAccountId = (isAccountNameGiven) ? AccountMgr::GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId(); int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2); uint32 plSecurity; if (handler->GetSession()) - plSecurity = sAccountMgr->GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID); + plSecurity = AccountMgr::GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID); else plSecurity = SEC_CONSOLE; // can set security level only for target with less security and to less security that we have // This is also reject self apply in fact - targetSecurity = sAccountMgr->GetSecurity(targetAccountId, gmRealmID); + targetSecurity = AccountMgr::GetSecurity(targetAccountId, gmRealmID); if (targetSecurity >= plSecurity || gm >= plSecurity) { handler->SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); @@ -448,7 +448,7 @@ public: } // Check and abort if the target gm has a higher rank on one of the realms and the new realm is -1 - if (gmRealmID == -1 && plSecurity != SEC_CONSOLE) + if (gmRealmID == -1 && !AccountMgr::IsConsoleAccount(plSecurity)) { QueryResult result = LoginDatabase.PQuery("SELECT * FROM account_access WHERE id = '%u' AND gmlevel > '%d'", targetAccountId, gm); if (result) @@ -501,7 +501,7 @@ public: return false; } - uint32 targetAccountId = sAccountMgr->GetId(account_name); + uint32 targetAccountId = AccountMgr::GetId(account_name); if (!targetAccountId) { handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); @@ -521,7 +521,7 @@ public: return false; } - AccountOpResult result = sAccountMgr->ChangePassword(targetAccountId, szPassword1); + AccountOpResult result = AccountMgr::ChangePassword(targetAccountId, szPassword1); switch (result) { diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index a520eac1ee7..780b4e549a9 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ObjectMgr.h" #include "Chat.h" +#include "AccountMgr.h" class gm_commandscript : public CommandScript { @@ -56,10 +57,11 @@ public: { if (!*args) { - if (handler->GetSession()->GetPlayer()->isGMChat()) - handler->GetSession()->SendNotification(LANG_GM_CHAT_ON); + WorldSession* session = handler->GetSession(); + if (!AccountMgr::IsPlayerAccount(session->GetSecurity()) && session->GetPlayer()->isGMChat()) + session->SendNotification(LANG_GM_CHAT_ON); else - handler->GetSession()->SendNotification(LANG_GM_CHAT_OFF); + session->SendNotification(LANG_GM_CHAT_OFF); return true; } @@ -120,7 +122,7 @@ public: for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { AccountTypes itr_sec = itr->second->GetSession()->GetSecurity(); - if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) && + if ((itr->second->isGameMaster() || (!AccountMgr::IsPlayerAccount(itr_sec) && itr_sec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) && (!handler->GetSession() || itr->second->IsVisibleGloballyFor(handler->GetSession()->GetPlayer()))) { if (first) diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index b99cd3b180f..472c5922460 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -42,7 +42,7 @@ enum eSpells SPELL_RESURRECT = 24173, //We will not use this spell. //Zealot Lor'Khan Spells - SPELL_SHIELD = 25045, + SPELL_SHIELD = 20545, SPELL_BLOODLUST = 24185, SPELL_GREATERHEAL = 24208, SPELL_DISARM = 6713, diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp index 3bbe7b125af..2558b03beb6 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp @@ -116,6 +116,7 @@ class boss_baltharus_the_warborn : public CreatureScript { me->InterruptNonMeleeSpells(false); _EnterCombat(); + events.Reset(); events.SetPhase(PHASE_COMBAT); events.ScheduleEvent(EVENT_CLEAVE, 11000, 0, PHASE_COMBAT); events.ScheduleEvent(EVENT_ENERVATING_BRAND, 13000, 0, PHASE_COMBAT); @@ -228,16 +229,18 @@ class npc_baltharus_the_warborn_clone : public CreatureScript struct npc_baltharus_the_warborn_cloneAI : public ScriptedAI { - npc_baltharus_the_warborn_cloneAI(Creature* creature) : ScriptedAI(creature) + npc_baltharus_the_warborn_cloneAI(Creature* creature) : ScriptedAI(creature), + _instance(creature->GetInstanceScript()) { - _instance = (InstanceScript*)creature->GetInstanceScript(); } void EnterCombat(Unit* /*who*/) { DoZoneInCombat(); + _events.Reset(); _events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000)); _events.ScheduleEvent(EVENT_BLADE_TEMPEST, urand(18000, 25000)); + _events.ScheduleEvent(EVENT_ENERVATING_BRAND, urand(10000, 15000)); } void DamageTaken(Unit* /*attacker*/, uint32& damage) @@ -280,6 +283,12 @@ class npc_baltharus_the_warborn_clone : public CreatureScript DoCastVictim(SPELL_BLADE_TEMPEST); _events.ScheduleEvent(EVENT_BLADE_TEMPEST, 24000); break; + case EVENT_ENERVATING_BRAND: + for (uint8 i = 0; i < RAID_MODE<uint8>(4, 8, 8, 10); i++) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true)) + DoCast(target, SPELL_ENERVATING_BRAND); + _events.ScheduleEvent(EVENT_ENERVATING_BRAND, 26000); + break; default: break; } @@ -299,59 +308,6 @@ class npc_baltharus_the_warborn_clone : public CreatureScript } }; -class spell_baltharus_enervating_brand : public SpellScriptLoader -{ - public: - spell_baltharus_enervating_brand() : SpellScriptLoader("spell_baltharus_enervating_brand") { } - - class spell_baltharus_enervating_brand_AuraScript : public AuraScript - { - PrepareAuraScript(spell_baltharus_enervating_brand_AuraScript); - - void HandleTriggerSpell(AuraEffect const* aurEff) - { - PreventDefaultAction(); - Unit* target = GetTarget(); - uint32 triggerSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; - target->CastSpell(target, triggerSpellId, true); - - if (Unit* caster = GetCaster()) - if (target->GetDistance(caster) <= 12.0f) - target->CastSpell(caster, SPELL_SIPHONED_MIGHT, true); - } - - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_baltharus_enervating_brand_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const - { - return new spell_baltharus_enervating_brand_AuraScript(); - } -}; - -class EnervatingBrandSelector -{ - public: - explicit EnervatingBrandSelector(Unit* caster) : _caster(caster) {} - - bool operator()(Unit* unit) - { - if (_caster->GetDistance(unit) > 12.0f) - return true; - - if (unit->GetTypeId() != TYPEID_PLAYER) - return true; - - return false; - } - - private: - Unit* _caster; -}; - class spell_baltharus_enervating_brand_trigger : public SpellScriptLoader { public: @@ -361,16 +317,18 @@ class spell_baltharus_enervating_brand_trigger : public SpellScriptLoader { PrepareSpellScript(spell_baltharus_enervating_brand_trigger_SpellScript); - void FilterTargets(std::list<Unit*>& unitList) + void CheckDistance() { - unitList.remove_if(EnervatingBrandSelector(GetCaster())); - unitList.push_back(GetCaster()); + if (Unit* caster = GetOriginalCaster()) + { + if (Unit* target = GetHitUnit()) + target->CastSpell(caster, SPELL_SIPHONED_MIGHT, true); + } } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_baltharus_enervating_brand_trigger_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_baltharus_enervating_brand_trigger_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ALLY); + OnHit += SpellHitFn(spell_baltharus_enervating_brand_trigger_SpellScript::CheckDistance); } }; @@ -384,6 +342,5 @@ void AddSC_boss_baltharus_the_warborn() { new boss_baltharus_the_warborn(); new npc_baltharus_the_warborn_clone(); - new spell_baltharus_enervating_brand(); new spell_baltharus_enervating_brand_trigger(); } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp index cc1e4051bbc..d0c59627be7 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp @@ -81,6 +81,7 @@ class boss_saviana_ragefire : public CreatureScript { _EnterCombat(); Talk(SAY_AGGRO); + events.Reset(); events.ScheduleEvent(EVENT_ENRAGE, 20000, EVENT_GROUP_LAND_PHASE); events.ScheduleEvent(EVENT_FLAME_BREATH, 14000, EVENT_GROUP_LAND_PHASE); events.ScheduleEvent(EVENT_FLIGHT, 60000); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp index ca6509060c3..abfaaa0229d 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp @@ -206,9 +206,17 @@ class instance_ruby_sanctum : public InstanceMapScript case DATA_GENERAL_ZARITHRIAN: if (GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE && GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE) HandleGameObject(FlameWallsGUID, state != IN_PROGRESS); + /* if (state == DONE) if (Creature* halionController = instance->SummonCreature(NPC_HALION_CONTROLLER, HalionControllerSpawnPos)) halionController->AI()->DoAction(ACTION_INTRO_HALION); + */ + break; + case DATA_HALION: + /* + if (state != IN_PROGRESS) + HandleGameObject(FlameRingGUID, true); + */ break; default: break; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h index 0acffc50272..52a4c67e544 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h @@ -81,11 +81,13 @@ enum CreaturesIds NPC_ORB_ROTATION_FOCUS = 40091, NPC_SHADOW_ORB_N = 40083, NPC_SHADOW_ORB_S = 40100, + NPC_METEOR_STRIKE_MARK = 40029, NPC_METEOR_STRIKE_NORTH = 40041, NPC_METEOR_STRIKE_EAST = 40042, NPC_METEOR_STRIKE_WEST = 40043, NPC_METEOR_STRIKE_SOUTH = 40044, NPC_METEOR_STRIKE_FLAME = 40055, + NPC_COMBUSTION = 40001, // Xerestrasza NPC_XERESTRASZA = 40429, diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp index 7fc24a75d61..1cc10ed475d 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp @@ -41,12 +41,12 @@ void OPvPCapturePointEP_EWT::ChangeState() if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_EWT_A)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_EWT, 0); } else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_EWT_H)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_EWT, 0); } uint32 artkit = 21; @@ -57,14 +57,14 @@ void OPvPCapturePointEP_EWT::ChangeState() m_TowerState = EP_TS_A; artkit = 2; SummonSupportUnitAtNorthpassTower(ALLIANCE); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = ALLIANCE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_EWT, ALLIANCE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; artkit = 1; SummonSupportUnitAtNorthpassTower(HORDE); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = HORDE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_EWT, HORDE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_H)); break; case OBJECTIVESTATE_NEUTRAL: @@ -179,12 +179,12 @@ void OPvPCapturePointEP_NPT::ChangeState() if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_A)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, 0); } else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_H)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, 0); } uint32 artkit = 21; @@ -195,14 +195,14 @@ void OPvPCapturePointEP_NPT::ChangeState() m_TowerState = EP_TS_A; artkit = 2; SummonGO(ALLIANCE); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = ALLIANCE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, ALLIANCE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; artkit = 1; SummonGO(HORDE); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = HORDE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, HORDE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H)); break; case OBJECTIVESTATE_NEUTRAL: @@ -322,12 +322,12 @@ void OPvPCapturePointEP_CGT::ChangeState() if( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_A)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_CGT, 0); } else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_H)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_CGT, 0); } uint32 artkit = 21; @@ -338,14 +338,14 @@ void OPvPCapturePointEP_CGT::ChangeState() m_TowerState = EP_TS_A; artkit = 2; LinkGraveYard(ALLIANCE); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = ALLIANCE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_CGT, ALLIANCE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; artkit = 1; LinkGraveYard(HORDE); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = HORDE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_CGT, HORDE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_H)); break; case OBJECTIVESTATE_NEUTRAL: @@ -451,12 +451,12 @@ void OPvPCapturePointEP_PWT::ChangeState() if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_A)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, 0); } else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_H)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, 0); } uint32 artkit = 21; @@ -467,14 +467,14 @@ void OPvPCapturePointEP_PWT::ChangeState() m_TowerState = EP_TS_A; SummonFlightMaster(ALLIANCE); artkit = 2; - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = ALLIANCE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, ALLIANCE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; SummonFlightMaster(HORDE); artkit = 1; - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = HORDE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, HORDE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H)); break; case OBJECTIVESTATE_NEUTRAL: @@ -714,6 +714,11 @@ void OutdoorPvPEP::BuffTeams() } } +void OutdoorPvPEP::SetControlledState(uint32 index, uint32 state) +{ + EP_Controls[index] = state; +} + void OutdoorPvPEP::FillInitialWorldStates(WorldPacket & data) { data << EP_UI_TOWER_COUNT_A << m_AllianceTowersControlled; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h index f196e65725c..042d2b70f58 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h @@ -184,8 +184,6 @@ class OutdoorPvPEP; class OPvPCapturePointEP_EWT : public OPvPCapturePoint { - friend class OutdoorPvPEP; - public: OPvPCapturePointEP_EWT(OutdoorPvP * pvp); @@ -215,8 +213,6 @@ class OPvPCapturePointEP_EWT : public OPvPCapturePoint class OPvPCapturePointEP_NPT : public OPvPCapturePoint { - friend class OutdoorPvPEP; - public: OPvPCapturePointEP_NPT(OutdoorPvP * pvp); @@ -246,8 +242,6 @@ class OPvPCapturePointEP_NPT : public OPvPCapturePoint class OPvPCapturePointEP_CGT : public OPvPCapturePoint { - friend class OutdoorPvPEP; - public: OPvPCapturePointEP_CGT(OutdoorPvP * pvp); @@ -277,8 +271,6 @@ class OPvPCapturePointEP_CGT : public OPvPCapturePoint class OPvPCapturePointEP_PWT : public OPvPCapturePoint { - friend class OutdoorPvPEP; - public: OPvPCapturePointEP_PWT(OutdoorPvP * pvp); @@ -308,11 +300,6 @@ class OPvPCapturePointEP_PWT : public OPvPCapturePoint class OutdoorPvPEP : public OutdoorPvP { - friend class OPvPCapturePointEP_EWT; - friend class OPvPCapturePointEP_NPT; - friend class OPvPCapturePointEP_PWT; - friend class OPvPCapturePointEP_CGT; - public: OutdoorPvPEP(); @@ -330,6 +317,8 @@ class OutdoorPvPEP : public OutdoorPvP void BuffTeams(); + void SetControlledState(uint32 index, uint32 state); + private: // how many towers are controlled diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp index 2d26ab80e5c..3c7c473e663 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp @@ -173,14 +173,14 @@ void OPvPCapturePointHP::ChangeState() break; case OBJECTIVESTATE_ALLIANCE: field = HP_MAP_A[m_TowerType]; - if (((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled) - ((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled--; + if (uint32 alliance_towers = ((OutdoorPvPHP*)m_PvP)->GetAllianceTowersControlled()) + ((OutdoorPvPHP*)m_PvP)->SetAllianceTowersControlled(--alliance_towers); sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(HP_LANG_LOSE_A[m_TowerType])); break; case OBJECTIVESTATE_HORDE: field = HP_MAP_H[m_TowerType]; - if (((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled) - ((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled--; + if (uint32 horde_towers = ((OutdoorPvPHP*)m_PvP)->GetHordeTowersControlled()) + ((OutdoorPvPHP*)m_PvP)->SetHordeTowersControlled(--horde_towers); sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(HP_LANG_LOSE_H[m_TowerType])); break; case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: @@ -211,21 +211,27 @@ void OPvPCapturePointHP::ChangeState() field = HP_MAP_N[m_TowerType]; break; case OBJECTIVESTATE_ALLIANCE: + { field = HP_MAP_A[m_TowerType]; artkit = 2; artkit2 = HP_TowerArtKit_A[m_TowerType]; - if (((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled<3) - ((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled++; + uint32 alliance_towers = ((OutdoorPvPHP*)m_PvP)->GetAllianceTowersControlled(); + if (alliance_towers < 3) + ((OutdoorPvPHP*)m_PvP)->SetAllianceTowersControlled(++alliance_towers); sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(HP_LANG_CAPTURE_A[m_TowerType])); break; + } case OBJECTIVESTATE_HORDE: + { field = HP_MAP_H[m_TowerType]; artkit = 1; artkit2 = HP_TowerArtKit_H[m_TowerType]; - if (((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled<3) - ((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled++; + uint32 horde_towers = ((OutdoorPvPHP*)m_PvP)->GetHordeTowersControlled(); + if (horde_towers < 3) + ((OutdoorPvPHP*)m_PvP)->SetHordeTowersControlled(++horde_towers); sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(HP_LANG_CAPTURE_H[m_TowerType])); break; + } case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: field = HP_MAP_N[m_TowerType]; break; @@ -331,6 +337,26 @@ void OutdoorPvPHP::HandleKillImpl(Player* player, Unit* killed) player->CastSpell(player, HordePlayerKillReward, true); } +uint32 OutdoorPvPHP::GetAllianceTowersControlled() const +{ + return m_AllianceTowersControlled; +} + +void OutdoorPvPHP::SetAllianceTowersControlled(uint32 count) +{ + m_AllianceTowersControlled = count; +} + +uint32 OutdoorPvPHP::GetHordeTowersControlled() const +{ + return m_HordeTowersControlled; +} + +void OutdoorPvPHP::SetHordeTowersControlled(uint32 count) +{ + m_HordeTowersControlled = count; +} + class OutdoorPvP_hellfire_peninsula : public OutdoorPvPScript { public: diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h index da18f639ba1..1d19652d5b1 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h @@ -108,8 +108,6 @@ class OPvPCapturePointHP : public OPvPCapturePoint class OutdoorPvPHP : public OutdoorPvP { - friend class OPvPCapturePointHP; - public: OutdoorPvPHP(); @@ -127,6 +125,12 @@ class OutdoorPvPHP : public OutdoorPvP void HandleKillImpl(Player* player, Unit* killed); + uint32 GetAllianceTowersControlled() const; + void SetAllianceTowersControlled(uint32 count); + + uint32 GetHordeTowersControlled() const; + void SetHordeTowersControlled(uint32 count); + private: // how many towers are controlled diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index 03b50f77a50..dacd63e93a6 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -63,14 +63,10 @@ uint32 OPvPCapturePointNA::GetAliveGuardsCount() case NA_NPC_GUARD_13: case NA_NPC_GUARD_14: case NA_NPC_GUARD_15: - { - if (Creature* cr = HashMapHolder<Creature>::Find(itr->second)) - { + if (Creature const * const cr = HashMapHolder<Creature>::Find(itr->second)) if (cr->isAlive()) ++cnt; - } - } - break; + break; default: break; } @@ -78,6 +74,11 @@ uint32 OPvPCapturePointNA::GetAliveGuardsCount() return cnt; } +uint32 OPvPCapturePointNA::GetControllingFaction() const +{ + return m_ControllingFaction; +} + void OPvPCapturePointNA::SpawnNPCsForTeam(uint32 team) { const creature_type * creatures = NULL; @@ -223,7 +224,7 @@ bool OutdoorPvPNA::SetupOutdoorPvP() void OutdoorPvPNA::HandlePlayerEnterZone(Player* player, uint32 zone) { // add buffs - if (player->GetTeam() == m_obj->m_ControllingFaction) + if (player->GetTeam() == m_obj->GetControllingFaction()) player->CastSpell(player, NA_CAPTURE_BUFF, true); OutdoorPvP::HandlePlayerEnterZone(player, zone); } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h index 7ddb47ac437..8d706ecdd23 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h @@ -252,8 +252,6 @@ class OutdoorPvPNA; class OPvPCapturePointNA : public OPvPCapturePoint { - friend class OutdoorPvPNA; - public: OPvPCapturePointNA(OutdoorPvP * pvp); @@ -275,6 +273,7 @@ class OPvPCapturePointNA : public OPvPCapturePoint int32 HandleOpenGo(Player* player, uint64 guid); uint32 GetAliveGuardsCount(); + uint32 GetControllingFaction() const; protected: @@ -312,8 +311,6 @@ class OPvPCapturePointNA : public OPvPCapturePoint class OutdoorPvPNA : public OutdoorPvP { - friend class OPvPCapturePointNA; - public: OutdoorPvPNA(); diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp index 666df2360c5..63214ecebef 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp @@ -208,6 +208,31 @@ void OutdoorPvPTF::HandlePlayerLeaveZone(Player* player, uint32 zone) OutdoorPvP::HandlePlayerLeaveZone(player, zone); } +uint32 OutdoorPvPTF::GetAllianceTowersControlled() const +{ + return m_AllianceTowersControlled; +} + +void OutdoorPvPTF::SetAllianceTowersControlled(uint32 count) +{ + m_AllianceTowersControlled = count; +} + +uint32 OutdoorPvPTF::GetHordeTowersControlled() const +{ + return m_HordeTowersControlled; +} + +void OutdoorPvPTF::SetHordeTowersControlled(uint32 count) +{ + m_HordeTowersControlled = count; +} + +bool OutdoorPvPTF::IsLocked() const +{ + return m_IsLocked; +} + bool OutdoorPvPTF::SetupOutdoorPvP() { m_AllianceTowersControlled = 0; @@ -236,10 +261,10 @@ bool OutdoorPvPTF::SetupOutdoorPvP() bool OPvPCapturePointTF::Update(uint32 diff) { // can update even in locked state if gathers the controlling faction - bool canupdate = ((((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled > 0) && m_activePlayers[0].size() > m_activePlayers[1].size()) || - ((((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled > 0) && m_activePlayers[0].size() < m_activePlayers[1].size()); + bool canupdate = ((((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled() > 0) && m_activePlayers[0].size() > m_activePlayers[1].size()) || + ((((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled() > 0) && m_activePlayers[0].size() < m_activePlayers[1].size()); // if gathers the other faction, then only update if the pvp is unlocked - canupdate = canupdate || !((OutdoorPvPTF*)m_PvP)->m_IsLocked; + canupdate = canupdate || !((OutdoorPvPTF*)m_PvP)->IsLocked(); return canupdate && OPvPCapturePoint::Update(diff); } @@ -248,15 +273,15 @@ void OPvPCapturePointTF::ChangeState() // if changing from controlling alliance to horde if (m_OldState == OBJECTIVESTATE_ALLIANCE) { - if (((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled) - ((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled--; + if (uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled()) + ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(--alliance_towers); sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOSE_A)); } // if changing from controlling horde to alliance else if (m_OldState == OBJECTIVESTATE_HORDE) { - if (((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled) - ((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled--; + if (uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled()) + ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(--horde_towers); sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOSE_H)); } @@ -265,23 +290,29 @@ void OPvPCapturePointTF::ChangeState() switch(m_State) { case OBJECTIVESTATE_ALLIANCE: + { m_TowerState = TF_TOWERSTATE_A; artkit = 2; - if (((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled<TF_TOWER_NUM) - ((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled++; + uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled(); + if (alliance_towers < TF_TOWER_NUM) + ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(++alliance_towers); sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A)); for (PlayerSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr) (*itr)->AreaExploredOrEventHappens(TF_ALLY_QUEST); break; + } case OBJECTIVESTATE_HORDE: + { m_TowerState = TF_TOWERSTATE_H; artkit = 1; - if (((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled<TF_TOWER_NUM) - ((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled++; + uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled(); + if (horde_towers < TF_TOWER_NUM) + ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(++horde_towers); sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H)); for (PlayerSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr) (*itr)->AreaExploredOrEventHappens(TF_HORDE_QUEST); break; + } case OBJECTIVESTATE_NEUTRAL: case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h index f8257e490f6..cf85c41c4dd 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h @@ -150,8 +150,6 @@ class OPvPCapturePointTF : public OPvPCapturePoint class OutdoorPvPTF : public OutdoorPvP { - friend class OPvPCapturePointTF; - public: OutdoorPvPTF(); @@ -167,6 +165,14 @@ class OutdoorPvPTF : public OutdoorPvP void SendRemoveWorldStates(Player* player); + uint32 GetAllianceTowersControlled() const; + void SetAllianceTowersControlled(uint32 count); + + uint32 GetHordeTowersControlled() const; + void SetHordeTowersControlled(uint32 count); + + bool IsLocked() const; + private: bool m_IsLocked; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp index 22811b84f75..f631e39e119 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp @@ -76,32 +76,38 @@ void OPvPCapturePointZM_Beacon::ChangeState() // if changing from controlling alliance to horde if (m_OldState == OBJECTIVESTATE_ALLIANCE) { - if (((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled) - ((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled--; + if (uint32 alliance_towers = ((OutdoorPvPZM*)m_PvP)->GetAllianceTowersControlled()) + ((OutdoorPvPZM*)m_PvP)->SetAllianceTowersControlled(--alliance_towers); sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(ZMBeaconLoseA[m_TowerType])); } // if changing from controlling horde to alliance else if (m_OldState == OBJECTIVESTATE_HORDE) { - if (((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled) - ((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled--; + if (uint32 horde_towers = ((OutdoorPvPZM*)m_PvP)->GetHordeTowersControlled()) + ((OutdoorPvPZM*)m_PvP)->SetHordeTowersControlled(--horde_towers); sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(ZMBeaconLoseH[m_TowerType])); } switch(m_State) { case OBJECTIVESTATE_ALLIANCE: + { m_TowerState = ZM_TOWERSTATE_A; - if (((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled<ZM_NUM_BEACONS) - ((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled++; + uint32 alliance_towers = ((OutdoorPvPZM*)m_PvP)->GetAllianceTowersControlled(); + if (alliance_towers < ZM_NUM_BEACONS) + ((OutdoorPvPZM*)m_PvP)->SetAllianceTowersControlled(++alliance_towers); sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(ZMBeaconCaptureA[m_TowerType])); break; + } case OBJECTIVESTATE_HORDE: + { m_TowerState = ZM_TOWERSTATE_H; - if (((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled<ZM_NUM_BEACONS) - ((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled++; + uint32 horde_towers = ((OutdoorPvPZM*)m_PvP)->GetHordeTowersControlled(); + if (horde_towers < ZM_NUM_BEACONS) + ((OutdoorPvPZM*)m_PvP)->SetHordeTowersControlled(++horde_towers); sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(ZMBeaconCaptureH[m_TowerType])); break; + } case OBJECTIVESTATE_NEUTRAL: case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: @@ -143,12 +149,12 @@ void OutdoorPvPZM::HandlePlayerEnterZone(Player* player, uint32 zone) { if (player->GetTeam() == ALLIANCE) { - if (m_GraveYard->m_GraveYardState & ZM_GRAVEYARD_A) + if (m_GraveYard->GetGraveYardState() & ZM_GRAVEYARD_A) player->CastSpell(player, ZM_CAPTURE_BUFF, true); } else { - if (m_GraveYard->m_GraveYardState & ZM_GRAVEYARD_H) + if (m_GraveYard->GetGraveYardState() & ZM_GRAVEYARD_H) player->CastSpell(player, ZM_CAPTURE_BUFF, true); } OutdoorPvP::HandlePlayerEnterZone(player, zone); @@ -382,6 +388,31 @@ bool OPvPCapturePointZM_GraveYard::HandleDropFlag(Player* /*player*/, uint32 spe return false; } +uint32 OPvPCapturePointZM_GraveYard::GetGraveYardState() const +{ + return m_GraveYardState; +} + +uint32 OutdoorPvPZM::GetAllianceTowersControlled() const +{ + return m_AllianceTowersControlled; +} + +void OutdoorPvPZM::SetAllianceTowersControlled(uint32 count) +{ + m_AllianceTowersControlled = count; +} + +uint32 OutdoorPvPZM::GetHordeTowersControlled() const +{ + return m_HordeTowersControlled; +} + +void OutdoorPvPZM::SetHordeTowersControlled(uint32 count) +{ + m_HordeTowersControlled = count; +} + void OutdoorPvPZM::FillInitialWorldStates(WorldPacket &data) { data << ZM_WORLDSTATE_UNK_1 << uint32(1); diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h index ed181f81bef..e703090990c 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h @@ -168,8 +168,6 @@ class OutdoorPvPZM; class OPvPCapturePointZM_Beacon : public OPvPCapturePoint { - friend class OutdoorPvPZM; - public: OPvPCapturePointZM_Beacon(OutdoorPvP * pvp, ZM_BeaconType type); @@ -201,8 +199,6 @@ enum ZM_GraveYardState class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint { - friend class OutdoorPvPZM; - public: OPvPCapturePointZM_GraveYard(OutdoorPvP * pvp); @@ -225,6 +221,8 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso); + uint32 GetGraveYardState() const; + private: uint32 m_GraveYardState; @@ -238,8 +236,6 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint class OutdoorPvPZM : public OutdoorPvP { - friend class OPvPCapturePointZM_Beacon; - public: OutdoorPvPZM(); @@ -257,6 +253,12 @@ class OutdoorPvPZM : public OutdoorPvP void HandleKillImpl(Player* player, Unit* killed); + uint32 GetAllianceTowersControlled() const; + void SetAllianceTowersControlled(uint32 count); + + uint32 GetHordeTowersControlled() const; + void SetHordeTowersControlled(uint32 count); + private: OPvPCapturePointZM_GraveYard * m_GraveYard; diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index 5af2a4972db..f5e55ecccb9 100755 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -155,7 +155,7 @@ bool ChatHandler::GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::s info.accountId = fields[2].GetUInt32(); // account name will be empty for not existed account - sAccountMgr->GetName(info.accountId, info.accountName); + AccountMgr::GetName(info.accountId, info.accountName); info.deleteDate = time_t(fields[3].GetUInt32()); @@ -278,7 +278,7 @@ void ChatHandler::HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo } // check character count - uint32 charcount = sAccountMgr->GetCharactersCount(delInfo.accountId); + uint32 charcount = AccountMgr::GetCharactersCount(delInfo.accountId); if (charcount >= 10) { PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId); @@ -350,7 +350,7 @@ bool ChatHandler::HandleCharacterDeletedRestoreCommand(const char* args) if (newAccount && newAccount != delInfo.accountId) { delInfo.accountId = newAccount; - sAccountMgr->GetName(newAccount, delInfo.accountName); + AccountMgr::GetName(newAccount, delInfo.accountName); } HandleCharacterDeletedRestoreHelper(delInfo); @@ -466,7 +466,7 @@ bool ChatHandler::HandleCharacterEraseCommand(const char* args){ } std::string account_name; - sAccountMgr->GetName (account_id, account_name); + AccountMgr::GetName (account_id, account_name); Player::DeleteFromDB(character_guid, account_id, true, true); PSendSysMessage(LANG_CHARACTER_DELETED, character_name.c_str(), GUID_LOPART(character_guid), account_name.c_str(), account_id); diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp index 6ea3157b457..994fccbd7ad 100755 --- a/src/server/worldserver/RemoteAccess/RASocket.cpp +++ b/src/server/worldserver/RemoteAccess/RASocket.cpp @@ -213,7 +213,7 @@ int RASocket::check_password(const std::string& user, const std::string& pass) AccountMgr::normalizeString(safe_pass); LoginDatabase.EscapeString(safe_pass); - std::string hash = sAccountMgr->CalculateShaPassHash(safe_user, safe_pass); + std::string hash = AccountMgr::CalculateShaPassHash(safe_user, safe_pass); QueryResult check = LoginDatabase.PQuery( "SELECT 1 FROM account WHERE username = '%s' AND sha_pass_hash = '%s'", diff --git a/src/server/worldserver/TCSoap/TCSoap.cpp b/src/server/worldserver/TCSoap/TCSoap.cpp index 603b4824408..a7a4048c34b 100755 --- a/src/server/worldserver/TCSoap/TCSoap.cpp +++ b/src/server/worldserver/TCSoap/TCSoap.cpp @@ -82,20 +82,20 @@ int ns1__executeCommand(soap* soap, char* command, char** result) return 401; } - uint32 accountId = sAccountMgr->GetId(soap->userid); + uint32 accountId = AccountMgr::GetId(soap->userid); if(!accountId) { sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: Client used invalid username '%s'", soap->userid); return 401; } - if(!sAccountMgr->CheckPassword(accountId, soap->passwd)) + if(!AccountMgr::CheckPassword(accountId, soap->passwd)) { sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: invalid password for account '%s'", soap->userid); return 401; } - if(sAccountMgr->GetSecurity(accountId) < SEC_ADMINISTRATOR) + if(AccountMgr::GetSecurity(accountId) < SEC_ADMINISTRATOR) { sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: %s's gmlevel is too low", soap->userid); return 403; |