aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/AI/CoreAI/UnitAI.cpp24
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp2
-rwxr-xr-xsrc/server/game/Accounts/AccountMgr.cpp54
-rwxr-xr-xsrc/server/game/Accounts/AccountMgr.h17
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp6
-rwxr-xr-xsrc/server/game/Chat/Channels/Channel.cpp25
-rwxr-xr-xsrc/server/game/Chat/Chat.cpp10
-rwxr-xr-xsrc/server/game/Chat/Commands/Level0.cpp2
-rwxr-xr-xsrc/server/game/Chat/Commands/Level3.cpp10
-rwxr-xr-xsrc/server/game/Chat/Commands/TicketCommands.cpp8
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp23
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h2
-rwxr-xr-xsrc/server/game/Entities/Player/SocialMgr.cpp5
-rwxr-xr-xsrc/server/game/Guilds/Guild.cpp5
-rwxr-xr-xsrc/server/game/Scripting/MapScripts.cpp1
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp3
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp1
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/CalendarHandler.cpp14
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/ChannelHandler.cpp16
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/CharacterHandler.cpp52
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/ChatHandler.cpp28
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/ItemHandler.cpp1
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/LootHandler.cpp18
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/MailHandler.cpp9
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/MiscHandler.cpp17
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/MovementHandler.cpp1
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp7
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/QueryHandler.cpp1
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/SpellHandler.cpp2
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/TradeHandler.cpp9
-rw-r--r--src/server/game/Server/Protocol/Handlers/VehicleHandler.cpp3
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/VoiceChatHandler.cpp3
-rwxr-xr-xsrc/server/game/Server/WorldSocket.cpp5
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraDefines.h2
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp2
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp5
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp25
-rw-r--r--src/server/game/Spells/SpellInfo.cpp4
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp8
-rw-r--r--src/server/game/Tools/PlayerDump.cpp2
-rwxr-xr-xsrc/server/game/World/World.cpp8
-rw-r--r--src/server/scripts/Commands/cs_account.cpp28
-rw-r--r--src/server/scripts/Commands/cs_gm.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp2
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp79
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp1
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp8
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h2
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp37
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPEP.h15
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp42
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPHP.h8
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp15
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPNA.h5
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp53
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPTF.h10
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp51
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPZM.h14
-rw-r--r--src/server/scripts/World/npcs_special.cpp826
-rwxr-xr-xsrc/server/worldserver/CommandLine/CliRunnable.cpp8
-rwxr-xr-xsrc/server/worldserver/RemoteAccess/RASocket.cpp2
-rwxr-xr-xsrc/server/worldserver/TCSoap/TCSoap.cpp6
62 files changed, 878 insertions, 784 deletions
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp
index b6517e3396b..39bdf219880 100755
--- a/src/server/game/AI/CoreAI/UnitAI.cpp
+++ b/src/server/game/AI/CoreAI/UnitAI.cpp
@@ -43,27 +43,17 @@ void UnitAI::DoMeleeAttackIfReady()
return;
Unit *victim = me->getVictim();
- if (!victim || !victim->IsInWorld())
- return;
-
//Make sure our attack is ready and we aren't currently casting before checking distance
- if (me->isAttackReady())
+ if (me->isAttackReady() && me->IsWithinMeleeRange(victim))
{
- //If we are within range melee the target
- if (me->IsWithinMeleeRange(victim))
- {
- me->AttackerStateUpdate(victim);
- me->resetAttackTimer();
- }
+ me->AttackerStateUpdate(victim);
+ me->resetAttackTimer();
}
- if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK))
+
+ if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK) && me->IsWithinMeleeRange(victim))
{
- //If we are within range melee the target
- if (me->IsWithinMeleeRange(victim))
- {
- me->AttackerStateUpdate(victim, OFF_ATTACK);
- me->resetAttackTimer(OFF_ATTACK);
- }
+ me->AttackerStateUpdate(victim, OFF_ATTACK);
+ me->resetAttackTimer(OFF_ATTACK);
}
}
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 6c310021045..89516bf45c9 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)
@@ -1762,7 +1763,7 @@ void Player::Update(uint32 p_time)
}
// not auto-free ghost from body in instances
- if (m_deathTimer > 0 && !GetBaseMap()->Instanceable() && !HasAuraType(SPELL_AURA_PREVENT_RESSURECTION))
+ if (m_deathTimer > 0 && !GetBaseMap()->Instanceable() && !HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
{
if (p_time >= m_deathTimer)
{
@@ -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);
@@ -5187,7 +5188,7 @@ void Player::KillPlayer()
//SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_IN_PVP);
SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE);
- ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sMapStore.LookupEntry(GetMapId())->Instanceable() && !HasAuraType(SPELL_AURA_PREVENT_RESSURECTION));
+ ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sMapStore.LookupEntry(GetMapId())->Instanceable() && !HasAuraType(SPELL_AURA_PREVENT_RESURRECTION));
// 6 minutes until repop at graveyard
m_deathTimer = 6 * MINUTE * IN_MILLISECONDS;
@@ -16517,7 +16518,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;
@@ -17045,7 +17046,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))
{
@@ -18947,7 +18948,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);
@@ -19497,8 +19498,6 @@ void Player::PetSpellInitialize()
data << uint32(cooldown); // category cooldown
}
- data.hexlike();
-
GetSession()->SendPacket(&data);
}
@@ -21127,7 +21126,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 6ed14e607d3..5ec32002854 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/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index f5e6f3f320e..8efca3a8658 100755
--- a/src/server/game/Scripting/MapScripts.cpp
+++ b/src/server/game/Scripting/MapScripts.cpp
@@ -306,6 +306,7 @@ void Map::ScriptsProcess()
source = player->GetItemByGuid(step.sourceGUID);
break;
case HIGHGUID_UNIT:
+ case HIGHGUID_VEHICLE:
source = HashMapHolder<Creature>::Find(step.sourceGUID);
break;
case HIGHGUID_PET:
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 69024837d61..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);
@@ -636,12 +637,11 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
sLog->outDebug(LOG_FILTER_NETWORKIO, "Character creation %s (account %u) has unhandled tail data: [%u]", createInfo->Name.c_str(), GetAccountId(), unk);
}
- Player* pNewChar = new Player(this);
- if (!pNewChar->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PLAYER), createInfo))
+ Player newChar(this);
+ if (!newChar.Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PLAYER), createInfo))
{
// Player not create (race/class/etc problem?)
- pNewChar->CleanupsBeforeDelete();
- delete pNewChar;
+ newChar.CleanupsBeforeDelete();
WorldPacket data(SMSG_CHAR_CREATE, 1);
data << uint8(CHAR_CREATE_ERROR);
@@ -653,12 +653,12 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
}
if ((haveSameRace && skipCinematics == 1) || skipCinematics == 2)
- pNewChar->setCinematic(1); // not show intro
+ newChar.setCinematic(1); // not show intro
- pNewChar->SetAtLoginFlag(AT_LOGIN_FIRST); // First login
+ newChar.SetAtLoginFlag(AT_LOGIN_FIRST); // First login
// Player created, save it now
- pNewChar->SaveToDB();
+ newChar.SaveToDB();
createInfo->CharCount += 1;
SQLTransaction trans = LoginDatabase.BeginTransaction();
@@ -676,18 +676,17 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
LoginDatabase.CommitTransaction(trans);
- pNewChar->CleanupsBeforeDelete();
+ newChar.CleanupsBeforeDelete();
WorldPacket data(SMSG_CHAR_CREATE, 1);
data << uint8(CHAR_CREATE_SUCCESS);
SendPacket(&data);
std::string IP_str = GetRemoteAddress();
- sLog->outDetail("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), pNewChar->GetGUIDLow());
- sLog->outChar("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), pNewChar->GetGUIDLow());
- sScriptMgr->OnPlayerCreate(pNewChar);
+ sLog->outDetail("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
+ sLog->outChar("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
+ sScriptMgr->OnPlayerCreate(&newChar);
- delete pNewChar; // created only to call SaveToDB()
delete createInfo;
_charCreateCallback.SetParam(NULL);
_charCreateCallback.FreeResult();
@@ -1123,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);
@@ -1385,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);
@@ -1489,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)
{
@@ -1577,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)
@@ -1608,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 f5cd293e9ee..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)
{
@@ -60,7 +61,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data)
if (GetPlayer()->isAlive() || GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
return;
- if (GetPlayer()->HasAuraType(SPELL_AURA_PREVENT_RESSURECTION))
+ if (GetPlayer()->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
return; // silently return, client should display the error by itself
// the world update order is sessions, players, creatures
@@ -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/SpellHandler.cpp b/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp
index 3978d582e84..6400bee0f06 100755
--- a/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp
@@ -537,7 +537,7 @@ void WorldSession::HandleSelfResOpcode(WorldPacket & /*recv_data*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SELF_RES"); // empty opcode
- if (_player->HasAuraType(SPELL_AURA_PREVENT_RESSURECTION))
+ if (_player->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
return; // silent return, client should display error by itself and not send this opcode
if (_player->GetUInt32Value(PLAYER_SELF_RES_SPELL))
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/Auras/SpellAuraDefines.h b/src/server/game/Spells/Auras/SpellAuraDefines.h
index 727e48b2041..7c0be84bf50 100755
--- a/src/server/game/Spells/Auras/SpellAuraDefines.h
+++ b/src/server/game/Spells/Auras/SpellAuraDefines.h
@@ -373,7 +373,7 @@ enum AuraType
SPELL_AURA_311 = 311,
SPELL_AURA_312 = 312,
SPELL_AURA_313 = 313,
- SPELL_AURA_PREVENT_RESSURECTION = 314,
+ SPELL_AURA_PREVENT_RESURRECTION = 314,
SPELL_AURA_UNDERWATER_WALKING = 315,
SPELL_AURA_PERIODIC_HASTE = 316,
TOTAL_AURAS = 317
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 8a3402b743c..faabbcc50ce 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -367,7 +367,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNULL, //311 0 spells in 3.3.5
&AuraEffect::HandleNULL, //312 0 spells in 3.3.5
&AuraEffect::HandleNULL, //313 0 spells in 3.3.5
- &AuraEffect::HandlePreventResurrection, //314 SPELL_AURA_PREVENT_RESSURECTION todo
+ &AuraEffect::HandlePreventResurrection, //314 SPELL_AURA_PREVENT_RESURRECTION todo
&AuraEffect::HandleNoImmediateEffect, //315 SPELL_AURA_UNDERWATER_WALKING todo
&AuraEffect::HandleNoImmediateEffect, //316 SPELL_AURA_PERIODIC_HASTE implemented in AuraEffect::CalculatePeriodic
};
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 6d10f40ae58..d456cfdcf47 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -4752,6 +4752,11 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_DONT_REPORT;
}
+ // Don't check explicit target for passive spells (workaround) (check should be skipped only for learn case)
+ // those spells may have incorrect target entries or not filled at all (for example 15332)
+ // such spells when learned are not targeting anyone using targeting system, they should apply directly to caster instead
+ // also, such casts shouldn't be sent to client
+ if (!((m_spellInfo->Attributes & SPELL_ATTR0_PASSIVE) && !m_targets.GetUnitTarget() || m_targets.GetUnitTarget() == m_caster))
{
// Check explicit target for m_originalCaster - todo: get rid of such workarounds
SpellCastResult castResult = m_spellInfo->CheckExplicitTarget(m_originalCaster ? m_originalCaster : m_caster, m_targets.GetObjectTarget(), m_targets.GetItemTarget());
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/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 3e374b62cd1..ea9146ae5f1 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -1714,7 +1714,7 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, Unit const* target, b
}
}
- if (target->HasAuraType(SPELL_AURA_PREVENT_RESSURECTION))
+ if (target->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
if (HasEffect(SPELL_EFFECT_SELF_RESURRECT) || HasEffect(SPELL_EFFECT_RESURRECT) || HasEffect(SPELL_EFFECT_RESURRECT_NEW))
return SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED;
@@ -2505,7 +2505,7 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const
case SPELL_AURA_PERIODIC_LEECH:
case SPELL_AURA_MOD_STALKED:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
- case SPELL_AURA_PREVENT_RESSURECTION:
+ case SPELL_AURA_PREVENT_RESURRECTION:
return false;
case SPELL_AURA_PERIODIC_DAMAGE: // used in positive spells also.
// part of negative spell if casted at self (prevent cancel)
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/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 5ceab74efd1..e95211412ff 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -60,9 +60,9 @@ enum SpawnType
struct SpawnAssociation
{
- uint32 m_uiThisCreatureEntry;
- uint32 m_uiSpawnedCreatureEntry;
- SpawnType m_SpawnType;
+ uint32 thisCreatureEntry;
+ uint32 spawnedCreatureEntry;
+ SpawnType spawnType;
};
enum eEnums
@@ -71,10 +71,10 @@ enum eEnums
AURA_DURATION_TIME_LEFT = 5000
};
-const float RANGE_TRIPWIRE = 15.0f;
-const float RANGE_GUARDS_MARK = 50.0f;
+float const RANGE_TRIPWIRE = 15.0f;
+float const RANGE_GUARDS_MARK = 50.0f;
-SpawnAssociation m_aSpawnAssociations[] =
+SpawnAssociation spawnAssociations[] =
{
{2614, 15241, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Alliance)
{2615, 15242, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Horde)
@@ -114,51 +114,51 @@ public:
{
npc_air_force_botsAI(Creature* creature) : ScriptedAI(creature)
{
- m_pSpawnAssoc = NULL;
- m_uiSpawnedGUID = 0;
+ SpawnAssoc = NULL;
+ SpawnedGUID = 0;
// find the correct spawnhandling
- static uint32 uiEntryCount = sizeof(m_aSpawnAssociations)/sizeof(SpawnAssociation);
+ static uint32 entryCount = sizeof(spawnAssociations) / sizeof(SpawnAssociation);
- for (uint8 i=0; i<uiEntryCount; ++i)
+ for (uint8 i = 0; i < entryCount; ++i)
{
- if (m_aSpawnAssociations[i].m_uiThisCreatureEntry == creature->GetEntry())
+ if (spawnAssociations[i].thisCreatureEntry == creature->GetEntry())
{
- m_pSpawnAssoc = &m_aSpawnAssociations[i];
+ SpawnAssoc = &spawnAssociations[i];
break;
}
}
- if (!m_pSpawnAssoc)
+ if (!SpawnAssoc)
sLog->outErrorDb("TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", creature->GetEntry());
else
{
- CreatureTemplate const* spawnedTemplate = sObjectMgr->GetCreatureTemplate(m_pSpawnAssoc->m_uiSpawnedCreatureEntry);
+ CreatureTemplate const* spawnedTemplate = sObjectMgr->GetCreatureTemplate(SpawnAssoc->spawnedCreatureEntry);
if (!spawnedTemplate)
{
- m_pSpawnAssoc = NULL;
- sLog->outErrorDb("TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", m_pSpawnAssoc->m_uiSpawnedCreatureEntry);
+ SpawnAssoc = NULL;
+ sLog->outErrorDb("TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry);
return;
}
}
}
- SpawnAssociation* m_pSpawnAssoc;
- uint64 m_uiSpawnedGUID;
+ SpawnAssociation* SpawnAssoc;
+ uint64 SpawnedGUID;
void Reset() {}
Creature* SummonGuard()
{
- Creature* summoned = me->SummonCreature(m_pSpawnAssoc->m_uiSpawnedCreatureEntry, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000);
+ Creature* summoned = me->SummonCreature(SpawnAssoc->spawnedCreatureEntry, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000);
if (summoned)
- m_uiSpawnedGUID = summoned->GetGUID();
+ SpawnedGUID = summoned->GetGUID();
else
{
- sLog->outErrorDb("TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", m_pSpawnAssoc->m_uiSpawnedCreatureEntry);
- m_pSpawnAssoc = NULL;
+ sLog->outErrorDb("TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry);
+ SpawnAssoc = NULL;
}
return summoned;
@@ -166,7 +166,7 @@ public:
Creature* GetSummonedGuard()
{
- Creature* creature = Unit::GetCreature(*me, m_uiSpawnedGUID);
+ Creature* creature = Unit::GetCreature(*me, SpawnedGUID);
if (creature && creature->isAlive())
return creature;
@@ -176,57 +176,55 @@ public:
void MoveInLineOfSight(Unit* who)
{
- if (!m_pSpawnAssoc)
+ if (!SpawnAssoc)
return;
if (who->isTargetableForAttack() && me->IsHostileTo(who))
{
- Player* playerTarget = who->GetTypeId() == TYPEID_PLAYER ? CAST_PLR(who) : NULL;
+ Player* playerTarget = who->ToPlayer();
// airforce guards only spawn for players
if (!playerTarget)
return;
- Creature* pLastSpawnedGuard = m_uiSpawnedGUID == 0 ? NULL : GetSummonedGuard();
+ Creature* lastSpawnedGuard = SpawnedGUID == 0 ? NULL : GetSummonedGuard();
// prevent calling Unit::GetUnit at next MoveInLineOfSight call - speedup
- if (!pLastSpawnedGuard)
- m_uiSpawnedGUID = 0;
+ if (!lastSpawnedGuard)
+ SpawnedGUID = 0;
- switch(m_pSpawnAssoc->m_SpawnType)
+ switch(SpawnAssoc->spawnType)
{
case SPAWNTYPE_ALARMBOT:
{
if (!who->IsWithinDistInMap(me, RANGE_GUARDS_MARK))
return;
- Aura* pMarkAura = who->GetAura(SPELL_GUARDS_MARK);
- if (pMarkAura)
+ Aura* markAura = who->GetAura(SPELL_GUARDS_MARK);
+ if (markAura)
{
// the target wasn't able to move out of our range within 25 seconds
- if (!pLastSpawnedGuard)
+ if (!lastSpawnedGuard)
{
- pLastSpawnedGuard = SummonGuard();
+ lastSpawnedGuard = SummonGuard();
- if (!pLastSpawnedGuard)
+ if (!lastSpawnedGuard)
return;
}
- if (pMarkAura->GetDuration() < AURA_DURATION_TIME_LEFT)
- {
- if (!pLastSpawnedGuard->getVictim())
- pLastSpawnedGuard->AI()->AttackStart(who);
- }
+ if (markAura->GetDuration() < AURA_DURATION_TIME_LEFT)
+ if (!lastSpawnedGuard->getVictim())
+ lastSpawnedGuard->AI()->AttackStart(who);
}
else
{
- if (!pLastSpawnedGuard)
- pLastSpawnedGuard = SummonGuard();
+ if (!lastSpawnedGuard)
+ lastSpawnedGuard = SummonGuard();
- if (!pLastSpawnedGuard)
+ if (!lastSpawnedGuard)
return;
- pLastSpawnedGuard->CastSpell(who, SPELL_GUARDS_MARK, true);
+ lastSpawnedGuard->CastSpell(who, SPELL_GUARDS_MARK, true);
}
break;
}
@@ -235,18 +233,16 @@ public:
if (!who->IsWithinDistInMap(me, RANGE_TRIPWIRE))
return;
- if (!pLastSpawnedGuard)
- pLastSpawnedGuard = SummonGuard();
+ if (!lastSpawnedGuard)
+ lastSpawnedGuard = SummonGuard();
- if (!pLastSpawnedGuard)
+ if (!lastSpawnedGuard)
return;
// ROOFTOP only triggers if the player is on the ground
- if (!playerTarget->IsFlying())
- {
- if (!pLastSpawnedGuard->getVictim())
- pLastSpawnedGuard->AI()->AttackStart(who);
- }
+ if (!playerTarget->IsFlying() && !lastSpawnedGuard->getVictim())
+ lastSpawnedGuard->AI()->AttackStart(who);
+
break;
}
}
@@ -254,7 +250,7 @@ public:
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_air_force_botsAI(creature);
}
@@ -283,16 +279,16 @@ public:
bool OnGossipHello(Player* player, Creature* creature)
{
if (player->GetQuestStatus(QUEST_BODY_HEART_A) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(QUEST_BODY_HEART_H) == QUEST_STATUS_INCOMPLETE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_GRANT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_GRANT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->SEND_GOSSIP_MENU(TEXT_ID_DEFAULT, creature->GetGUID());
return true;
}
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
- if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
+ if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
player->SEND_GOSSIP_MENU(TEXT_ID_PROGRESS, creature->GetGUID());
player->AreaExploredOrEventHappens(player->GetTeam() == ALLIANCE ? QUEST_BODY_HEART_A : QUEST_BODY_HEART_H);
@@ -332,7 +328,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 const diff)
{
// Reset flags after a certain time has passed so that the next player has to start the 'event' again
if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
@@ -341,7 +337,9 @@ public:
{
EnterEvadeMode();
return;
- } else ResetFlagTimer -= diff;
+ }
+ else
+ ResetFlagTimer -= diff;
}
if (UpdateVictim())
@@ -353,7 +351,7 @@ public:
switch(emote)
{
case TEXT_EMOTE_CHICKEN:
- if (player->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_NONE && rand()%30 == 1)
+ if (player->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_NONE && rand() % 30 == 1)
{
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
me->setFaction(FACTION_FRIENDLY);
@@ -372,22 +370,22 @@ public:
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_chicken_cluckAI(creature);
}
- bool OnQuestAccept(Player* /*player*/, Creature* creature, const Quest *_Quest)
+ bool OnQuestAccept(Player* /*player*/, Creature* creature, Quest const* quest)
{
- if (_Quest->GetQuestId() == QUEST_CLUCK)
+ if (quest->GetQuestId() == QUEST_CLUCK)
CAST_AI(npc_chicken_cluck::npc_chicken_cluckAI, creature->AI())->Reset();
return true;
}
- bool OnQuestComplete(Player* /*player*/, Creature* creature, const Quest *_Quest)
+ bool OnQuestComplete(Player* /*player*/, Creature* creature, Quest const* quest)
{
- if (_Quest->GetQuestId() == QUEST_CLUCK)
+ if (quest->GetQuestId() == QUEST_CLUCK)
CAST_AI(npc_chicken_cluck::npc_chicken_cluckAI, creature->AI())->Reset();
return true;
@@ -411,13 +409,13 @@ public:
{
npc_dancing_flamesAI(Creature* c) : ScriptedAI(c) {}
- bool active;
- uint32 can_iteract;
+ bool Active;
+ uint32 CanIteract;
void Reset()
{
- active = true;
- can_iteract = 3500;
+ Active = true;
+ CanIteract = 3500;
DoCast(me, SPELL_BRAZIER, true);
DoCast(me, SPELL_FIERY_AURA, false);
float x, y, z;
@@ -430,16 +428,18 @@ public:
me->SendMessageToSet(&data, true);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 const diff)
{
- if (!active)
+ if (!Active)
{
- if (can_iteract <= diff)
+ if (CanIteract <= diff)
{
- active = true;
- can_iteract = 3500;
+ Active = true;
+ CanIteract = 3500;
me->HandleEmoteCommand(EMOTE_ONESHOT_DANCE);
- } else can_iteract -= diff;
+ }
+ else
+ CanIteract -= diff;
}
}
@@ -450,29 +450,35 @@ public:
if (me->IsWithinLOS(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()) && me->IsWithinDistInMap(player, 30.0f))
{
me->SetInFront(player);
- active = false;
+ Active = false;
WorldPacket data;
me->BuildHeartBeatMsg(&data);
me->SendMessageToSet(&data, true);
switch(emote)
{
- case TEXT_EMOTE_KISS: me->HandleEmoteCommand(EMOTE_ONESHOT_SHY); break;
- case TEXT_EMOTE_WAVE: me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break;
- case TEXT_EMOTE_BOW: me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break;
- case TEXT_EMOTE_JOKE: me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); break;
+ case TEXT_EMOTE_KISS:
+ me->HandleEmoteCommand(EMOTE_ONESHOT_SHY);
+ break;
+ case TEXT_EMOTE_WAVE:
+ me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE);
+ break;
+ case TEXT_EMOTE_BOW:
+ me->HandleEmoteCommand(EMOTE_ONESHOT_BOW);
+ break;
+ case TEXT_EMOTE_JOKE:
+ me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);
+ break;
case TEXT_EMOTE_DANCE:
- {
if (!player->HasAura(SPELL_SEDUCTION))
DoCast(player, SPELL_SEDUCTION, true);
- }
- break;
+ break;
}
}
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_dancing_flamesAI(creature);
}
@@ -528,14 +534,14 @@ static Location HordeCoords[]=
#define H_RUNTOY -3508.48f
#define H_RUNTOZ 62.96f
-const uint32 AllianceSoldierId[3] =
+uint32 const AllianceSoldierId[3] =
{
12938, // 12938 Injured Alliance Soldier
12936, // 12936 Badly injured Alliance Soldier
12937 // 12937 Critically injured Alliance Soldier
};
-const uint32 HordeSoldierId[3] =
+uint32 const HordeSoldierId[3] =
{
12923, //12923 Injured Soldier
12924, //12924 Badly injured Soldier
@@ -556,7 +562,7 @@ public:
uint64 PlayerGUID;
- uint32 SummonPatient_Timer;
+ uint32 SummonPatientTimer;
uint32 SummonPatientCount;
uint32 PatientDiedCount;
uint32 PatientSavedCount;
@@ -570,7 +576,7 @@ public:
{
PlayerGUID = 0;
- SummonPatient_Timer = 10000;
+ SummonPatientTimer = 10000;
SummonPatientCount = 0;
PatientDiedCount = 0;
PatientSavedCount = 0;
@@ -587,7 +593,7 @@ public:
{
PlayerGUID = player->GetGUID();
- SummonPatient_Timer = 10000;
+ SummonPatientTimer = 10000;
SummonPatientCount = 0;
PatientDiedCount = 0;
PatientSavedCount = 0;
@@ -608,7 +614,7 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
- void PatientDied(Location* Point)
+ void PatientDied(Location* point)
{
Player* player = Unit::GetPlayer(*me, PlayerGUID);
if (player && ((player->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (player->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)))
@@ -626,14 +632,14 @@ public:
return;
}
- Coordinates.push_back(Point);
+ Coordinates.push_back(point);
}
else
// If no player or player abandon quest in progress
Reset();
}
- void PatientSaved(Creature* /*soldier*/, Player* player, Location* Point)
+ void PatientSaved(Creature* /*soldier*/, Player* player, Location* point)
{
if (player && PlayerGUID == player->GetGUID())
{
@@ -648,8 +654,8 @@ public:
std::list<uint64>::const_iterator itr;
for (itr = Patients.begin(); itr != Patients.end(); ++itr)
{
- if (Creature* Patient = Unit::GetCreature((*me), *itr))
- Patient->setDeathState(JUST_DIED);
+ if (Creature* patient = Unit::GetCreature((*me), *itr))
+ patient->setDeathState(JUST_DIED);
}
}
@@ -662,17 +668,17 @@ public:
return;
}
- Coordinates.push_back(Point);
+ Coordinates.push_back(point);
}
}
}
- void UpdateAI(const uint32 diff);
+ void UpdateAI(uint32 const diff);
void EnterCombat(Unit* /*who*/){}
};
- bool OnQuestAccept(Player* player, Creature* creature, Quest const *quest)
+ bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest)
{
if ((quest->GetQuestId() == 6624) || (quest->GetQuestId() == 6622))
CAST_AI(npc_doctor::npc_doctorAI, creature->AI())->BeginEvent(player);
@@ -680,7 +686,7 @@ public:
return true;
}
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_doctorAI(creature);
}
@@ -699,12 +705,12 @@ public:
{
npc_injured_patientAI(Creature* c) : ScriptedAI(c) {}
- uint64 Doctorguid;
+ uint64 DoctorGUID;
Location* Coord;
void Reset()
{
- Doctorguid = 0;
+ DoctorGUID = 0;
Coord = NULL;
//no select
@@ -737,14 +743,14 @@ public:
void EnterCombat(Unit* /*who*/){}
- void SpellHit(Unit* caster, const SpellInfo *spell)
+ void SpellHit(Unit* caster, SpellInfo const* spell)
{
if (caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && spell->Id == 20804)
{
if ((CAST_PLR(caster)->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (CAST_PLR(caster)->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE))
- if (Doctorguid)
- if (Creature* Doctor = Unit::GetCreature(*me, Doctorguid))
- CAST_AI(npc_doctor::npc_doctorAI, Doctor->AI())->PatientSaved(me, CAST_PLR(caster), Coord);
+ if (DoctorGUID)
+ if (Creature* doctor = Unit::GetCreature(*me, DoctorGUID))
+ CAST_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientSaved(me, CAST_PLR(caster), Coord);
//make not selectable
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -776,13 +782,11 @@ public:
}
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 const /*diff*/)
{
//lower HP on every world tick makes it a useful counter, not officlone though
if (me->isAlive() && me->GetHealth() > 6)
- {
me->ModifyHealth(-5);
- }
if (me->isAlive() && me->GetHealth() <= 6)
{
@@ -791,22 +795,20 @@ public:
me->setDeathState(JUST_DIED);
me->SetFlag(UNIT_DYNAMIC_FLAGS, 32);
- if (Doctorguid)
- {
- if (Creature* Doctor = Unit::GetCreature((*me), Doctorguid))
- CAST_AI(npc_doctor::npc_doctorAI, Doctor->AI())->PatientDied(Coord);
- }
+ if (DoctorGUID)
+ if (Creature* doctor = Unit::GetCreature((*me), DoctorGUID))
+ CAST_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientDied(Coord);
}
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_injured_patientAI(creature);
}
};
-void npc_doctor::npc_doctorAI::UpdateAI(const uint32 diff)
+void npc_doctor::npc_doctorAI::UpdateAI(uint32 const diff)
{
if (Event && SummonPatientCount >= 20)
{
@@ -816,42 +818,46 @@ void npc_doctor::npc_doctorAI::UpdateAI(const uint32 diff)
if (Event)
{
- if (SummonPatient_Timer <= diff)
+ if (SummonPatientTimer <= diff)
{
if (Coordinates.empty())
return;
- std::vector<Location*>::iterator itr = Coordinates.begin()+rand()%Coordinates.size();
+ std::vector<Location*>::iterator itr = Coordinates.begin() + rand() % Coordinates.size();
uint32 patientEntry = 0;
switch(me->GetEntry())
{
- case DOCTOR_ALLIANCE: patientEntry = AllianceSoldierId[rand()%3]; break;
- case DOCTOR_HORDE: patientEntry = HordeSoldierId[rand()%3]; break;
- default:
- sLog->outError("TSCR: Invalid entry for Triage doctor. Please check your database");
- return;
+ case DOCTOR_ALLIANCE:
+ patientEntry = AllianceSoldierId[rand() % 3];
+ break;
+ case DOCTOR_HORDE:
+ patientEntry = HordeSoldierId[rand() % 3];
+ break;
+ default:
+ sLog->outError("TSCR: Invalid entry for Triage doctor. Please check your database");
+ return;
}
- if (Location* Point = *itr)
+ if (Location* point = *itr)
{
- if (Creature* Patient = me->SummonCreature(patientEntry, Point->x, Point->y, Point->z, Point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
+ if (Creature* Patient = me->SummonCreature(patientEntry, point->x, point->y, point->z, point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
{
//303, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND)
Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
Patients.push_back(Patient->GetGUID());
- CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Doctorguid = me->GetGUID();
-
- if (Point)
- CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = Point;
+ CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->DoctorGUID = me->GetGUID();
+ CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = point;
Coordinates.erase(itr);
}
}
- SummonPatient_Timer = 10000;
+ SummonPatientTimer = 10000;
++SummonPatientCount;
- } else SummonPatient_Timer -= diff;
+ }
+ else
+ SummonPatientTimer -= diff;
}
}
@@ -901,19 +907,19 @@ public:
{
npc_garments_of_questsAI(Creature* c) : npc_escortAI(c) {Reset();}
- uint64 caster;
+ uint64 CasterGUID;
- bool bIsHealed;
- bool bCanRun;
+ bool IsHealed;
+ bool CanRun;
uint32 RunAwayTimer;
void Reset()
{
- caster = 0;
+ CasterGUID = 0;
- bIsHealed = false;
- bCanRun = false;
+ IsHealed = false;
+ CanRun = false;
RunAwayTimer = 5000;
@@ -924,7 +930,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void SpellHit(Unit* pCaster, const SpellInfo *Spell)
+ void SpellHit(Unit* caster, SpellInfo const* Spell)
{
if (Spell->Id == SPELL_LESSER_HEAL_R2 || Spell->Id == SPELL_FORTITUDE_R1)
{
@@ -933,126 +939,136 @@ public:
return;
//nothing to be done now
- if (bIsHealed && bCanRun)
+ if (IsHealed && CanRun)
return;
- if (pCaster->GetTypeId() == TYPEID_PLAYER)
+ if (Player* player = caster->ToPlayer())
{
switch(me->GetEntry())
{
case ENTRY_SHAYA:
- if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_MOON) == QUEST_STATUS_INCOMPLETE)
+ if (player->GetQuestStatus(QUEST_MOON) == QUEST_STATUS_INCOMPLETE)
{
- if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1)
+ if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1)
{
- DoScriptText(SAY_SHAYA_THANKS, me, pCaster);
- bCanRun = true;
+ DoScriptText(SAY_SHAYA_THANKS, me, caster);
+ CanRun = true;
}
- else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
+ else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
{
- caster = pCaster->GetGUID();
+ CasterGUID = caster->GetGUID();
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_COMMON_HEALED, me, pCaster);
- bIsHealed = true;
+ DoScriptText(SAY_COMMON_HEALED, me, caster);
+ IsHealed = true;
}
}
break;
case ENTRY_ROBERTS:
- if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_LIGHT_1) == QUEST_STATUS_INCOMPLETE)
+ if (player->GetQuestStatus(QUEST_LIGHT_1) == QUEST_STATUS_INCOMPLETE)
{
- if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1)
+ if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1)
{
- DoScriptText(SAY_ROBERTS_THANKS, me, pCaster);
- bCanRun = true;
+ DoScriptText(SAY_ROBERTS_THANKS, me, caster);
+ CanRun = true;
}
- else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
+ else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
{
- caster = pCaster->GetGUID();
+ CasterGUID = caster->GetGUID();
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_COMMON_HEALED, me, pCaster);
- bIsHealed = true;
+ DoScriptText(SAY_COMMON_HEALED, me, caster);
+ IsHealed = true;
}
}
break;
case ENTRY_DOLF:
- if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_LIGHT_2) == QUEST_STATUS_INCOMPLETE)
+ if (player->GetQuestStatus(QUEST_LIGHT_2) == QUEST_STATUS_INCOMPLETE)
{
- if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1)
+ if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1)
{
- DoScriptText(SAY_DOLF_THANKS, me, pCaster);
- bCanRun = true;
+ DoScriptText(SAY_DOLF_THANKS, me, caster);
+ CanRun = true;
}
- else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
+ else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
{
- caster = pCaster->GetGUID();
+ CasterGUID = caster->GetGUID();
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_COMMON_HEALED, me, pCaster);
- bIsHealed = true;
+ DoScriptText(SAY_COMMON_HEALED, me, caster);
+ IsHealed = true;
}
}
break;
case ENTRY_KORJA:
- if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_SPIRIT) == QUEST_STATUS_INCOMPLETE)
+ if (player->GetQuestStatus(QUEST_SPIRIT) == QUEST_STATUS_INCOMPLETE)
{
- if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1)
+ if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1)
{
- DoScriptText(SAY_KORJA_THANKS, me, pCaster);
- bCanRun = true;
+ DoScriptText(SAY_KORJA_THANKS, me, caster);
+ CanRun = true;
}
- else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
+ else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
{
- caster = pCaster->GetGUID();
+ CasterGUID = caster->GetGUID();
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_COMMON_HEALED, me, pCaster);
- bIsHealed = true;
+ DoScriptText(SAY_COMMON_HEALED, me, caster);
+ IsHealed = true;
}
}
break;
case ENTRY_DG_KEL:
- if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_DARKNESS) == QUEST_STATUS_INCOMPLETE)
+ if (player->GetQuestStatus(QUEST_DARKNESS) == QUEST_STATUS_INCOMPLETE)
{
- if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1)
+ if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1)
{
- DoScriptText(SAY_DG_KEL_THANKS, me, pCaster);
- bCanRun = true;
+ DoScriptText(SAY_DG_KEL_THANKS, me, caster);
+ CanRun = true;
}
- else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
+ else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
{
- caster = pCaster->GetGUID();
+ CasterGUID = caster->GetGUID();
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_COMMON_HEALED, me, pCaster);
- bIsHealed = true;
+ DoScriptText(SAY_COMMON_HEALED, me, caster);
+ IsHealed = true;
}
}
break;
}
//give quest credit, not expect any special quest objectives
- if (bCanRun)
- CAST_PLR(pCaster)->TalkedToCreature(me->GetEntry(), me->GetGUID());
+ if (CanRun)
+ player->TalkedToCreature(me->GetEntry(), me->GetGUID());
}
}
}
- void WaypointReached(uint32 /*uiPoint*/)
+ void WaypointReached(uint32 /*point*/)
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 const diff)
{
- if (bCanRun && !me->isInCombat())
+ if (CanRun && !me->isInCombat())
{
if (RunAwayTimer <= diff)
{
- if (Unit* pUnit = Unit::GetUnit(*me, caster))
+ if (Unit* unit = Unit::GetUnit(*me, CasterGUID))
{
switch(me->GetEntry())
{
- case ENTRY_SHAYA: DoScriptText(SAY_SHAYA_GOODBYE, me, pUnit); break;
- case ENTRY_ROBERTS: DoScriptText(SAY_ROBERTS_GOODBYE, me, pUnit); break;
- case ENTRY_DOLF: DoScriptText(SAY_DOLF_GOODBYE, me, pUnit); break;
- case ENTRY_KORJA: DoScriptText(SAY_KORJA_GOODBYE, me, pUnit); break;
- case ENTRY_DG_KEL: DoScriptText(SAY_DG_KEL_GOODBYE, me, pUnit); break;
+ case ENTRY_SHAYA:
+ DoScriptText(SAY_SHAYA_GOODBYE, me, unit);
+ break;
+ case ENTRY_ROBERTS:
+ DoScriptText(SAY_ROBERTS_GOODBYE, me, unit);
+ break;
+ case ENTRY_DOLF:
+ DoScriptText(SAY_DOLF_GOODBYE, me, unit);
+ break;
+ case ENTRY_KORJA:
+ DoScriptText(SAY_KORJA_GOODBYE, me, unit);
+ break;
+ case ENTRY_DG_KEL:
+ DoScriptText(SAY_DG_KEL_GOODBYE, me, unit);
+ break;
}
Start(false, true, true);
@@ -1061,14 +1077,16 @@ public:
EnterEvadeMode(); //something went wrong
RunAwayTimer = 30000;
- } else RunAwayTimer -= diff;
+ }
+ else
+ RunAwayTimer -= diff;
}
npc_escortAI::UpdateAI(diff);
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_garments_of_questsAI(creature);
}
@@ -1098,7 +1116,7 @@ public:
{
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 const /*diff*/)
{
if (!UpdateVictim())
return;
@@ -1111,7 +1129,7 @@ public:
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_guardianAI(creature);
}
@@ -1143,16 +1161,16 @@ public:
if (player->HasItemCount(ITEM_KT_SIGNET, 1) && (!player->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_A) ||
!player->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_H) || !player->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_N)))
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT_TO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT_TO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
- bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction)
+ bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
- if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
+ if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_TELEPORT_DALARAN, false);
@@ -1175,8 +1193,7 @@ public:
if (creature->isQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
- bool canBuy;
- canBuy = false;
+ bool canBuy = false;
uint32 vendor = creature->GetEntry();
uint8 race = player->getRace();
@@ -1246,10 +1263,10 @@ public:
return true;
}
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
- if (uiAction == GOSSIP_ACTION_TRADE)
+ if (action == GOSSIP_ACTION_TRADE)
player->GetSession()->SendListInventory(creature->GetGUID());
return true;
@@ -1285,7 +1302,7 @@ public:
if (player->getClass() == CLASS_ROGUE && player->getLevel() >= 24 && !player->HasItemCount(17126, 1) && !player->GetQuestRewardStatus(6681))
{
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ROGUE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ROGUE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->SEND_GOSSIP_MENU(5996, creature->GetGUID());
} else
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
@@ -1293,12 +1310,12 @@ public:
return true;
}
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
- switch(uiAction)
+ switch(action)
{
- case GOSSIP_ACTION_INFO_DEF+1:
+ case GOSSIP_ACTION_INFO_DEF + 1:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, 21100, false);
break;
@@ -1391,106 +1408,106 @@ public:
player->SEND_GOSSIP_MENU(7393, creature->GetGUID());
else
{
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_SAYGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_SAYGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->SEND_GOSSIP_MENU(7339, creature->GetGUID());
}
return true;
}
- void SendAction(Player* player, Creature* creature, uint32 uiAction)
+ void SendAction(Player* player, Creature* creature, uint32 action)
{
- switch(uiAction)
+ switch(action)
{
- case GOSSIP_ACTION_INFO_DEF+1:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
+ case GOSSIP_ACTION_INFO_DEF + 1:
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
player->SEND_GOSSIP_MENU(7340, creature->GetGUID());
break;
- case GOSSIP_ACTION_INFO_DEF+2:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE5, GOSSIP_SENDER_MAIN+1, GOSSIP_ACTION_INFO_DEF);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE6, GOSSIP_SENDER_MAIN+2, GOSSIP_ACTION_INFO_DEF);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE7, GOSSIP_SENDER_MAIN+3, GOSSIP_ACTION_INFO_DEF);
+ case GOSSIP_ACTION_INFO_DEF + 2:
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE5, GOSSIP_SENDER_MAIN + 1, GOSSIP_ACTION_INFO_DEF);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE6, GOSSIP_SENDER_MAIN + 2, GOSSIP_ACTION_INFO_DEF);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE7, GOSSIP_SENDER_MAIN + 3, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(7341, creature->GetGUID());
break;
- case GOSSIP_ACTION_INFO_DEF+3:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE8, GOSSIP_SENDER_MAIN+4, GOSSIP_ACTION_INFO_DEF);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE9, GOSSIP_SENDER_MAIN+5, GOSSIP_ACTION_INFO_DEF);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE10, GOSSIP_SENDER_MAIN+2, GOSSIP_ACTION_INFO_DEF);
+ case GOSSIP_ACTION_INFO_DEF + 3:
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE8, GOSSIP_SENDER_MAIN + 4, GOSSIP_ACTION_INFO_DEF);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE9, GOSSIP_SENDER_MAIN + 5, GOSSIP_ACTION_INFO_DEF);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE10, GOSSIP_SENDER_MAIN + 2, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(7361, creature->GetGUID());
break;
- case GOSSIP_ACTION_INFO_DEF+4:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE11, GOSSIP_SENDER_MAIN+6, GOSSIP_ACTION_INFO_DEF);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE12, GOSSIP_SENDER_MAIN+7, GOSSIP_ACTION_INFO_DEF);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE13, GOSSIP_SENDER_MAIN+8, GOSSIP_ACTION_INFO_DEF);
+ case GOSSIP_ACTION_INFO_DEF + 4:
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE11, GOSSIP_SENDER_MAIN + 6, GOSSIP_ACTION_INFO_DEF);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE12, GOSSIP_SENDER_MAIN + 7, GOSSIP_ACTION_INFO_DEF);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE13, GOSSIP_SENDER_MAIN + 8, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(7362, creature->GetGUID());
break;
- case GOSSIP_ACTION_INFO_DEF+5:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE14, GOSSIP_SENDER_MAIN+5, GOSSIP_ACTION_INFO_DEF);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE15, GOSSIP_SENDER_MAIN+4, GOSSIP_ACTION_INFO_DEF);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE16, GOSSIP_SENDER_MAIN+3, GOSSIP_ACTION_INFO_DEF);
+ case GOSSIP_ACTION_INFO_DEF + 5:
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE14, GOSSIP_SENDER_MAIN + 5, GOSSIP_ACTION_INFO_DEF);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE15, GOSSIP_SENDER_MAIN + 4, GOSSIP_ACTION_INFO_DEF);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE16, GOSSIP_SENDER_MAIN + 3, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(7363, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE17, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE17, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
player->SEND_GOSSIP_MENU(7364, creature->GetGUID());
break;
- case GOSSIP_ACTION_INFO_DEF+6:
+ case GOSSIP_ACTION_INFO_DEF + 6:
creature->CastSpell(player, SPELL_FORTUNE, false);
player->SEND_GOSSIP_MENU(7365, creature->GetGUID());
break;
}
}
- bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction)
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
- switch(uiSender)
+ switch(sender)
{
case GOSSIP_SENDER_MAIN:
- SendAction(player, creature, uiAction);
+ SendAction(player, creature, action);
break;
- case GOSSIP_SENDER_MAIN+1:
+ case GOSSIP_SENDER_MAIN + 1:
creature->CastSpell(player, SPELL_DMG, false);
player->AddSpellCooldown(SPELL_DMG, 0, time(NULL) + 7200);
- SendAction(player, creature, uiAction);
+ SendAction(player, creature, action);
break;
- case GOSSIP_SENDER_MAIN+2:
+ case GOSSIP_SENDER_MAIN + 2:
creature->CastSpell(player, SPELL_RES, false);
player->AddSpellCooldown(SPELL_RES, 0, time(NULL) + 7200);
- SendAction(player, creature, uiAction);
+ SendAction(player, creature, action);
break;
- case GOSSIP_SENDER_MAIN+3:
+ case GOSSIP_SENDER_MAIN + 3:
creature->CastSpell(player, SPELL_ARM, false);
player->AddSpellCooldown(SPELL_ARM, 0, time(NULL) + 7200);
- SendAction(player, creature, uiAction);
+ SendAction(player, creature, action);
break;
- case GOSSIP_SENDER_MAIN+4:
+ case GOSSIP_SENDER_MAIN + 4:
creature->CastSpell(player, SPELL_SPI, false);
player->AddSpellCooldown(SPELL_SPI, 0, time(NULL) + 7200);
- SendAction(player, creature, uiAction);
+ SendAction(player, creature, action);
break;
- case GOSSIP_SENDER_MAIN+5:
+ case GOSSIP_SENDER_MAIN + 5:
creature->CastSpell(player, SPELL_INT, false);
player->AddSpellCooldown(SPELL_INT, 0, time(NULL) + 7200);
- SendAction(player, creature, uiAction);
+ SendAction(player, creature, action);
break;
- case GOSSIP_SENDER_MAIN+6:
+ case GOSSIP_SENDER_MAIN + 6:
creature->CastSpell(player, SPELL_STM, false);
player->AddSpellCooldown(SPELL_STM, 0, time(NULL) + 7200);
- SendAction(player, creature, uiAction);
+ SendAction(player, creature, action);
break;
- case GOSSIP_SENDER_MAIN+7:
+ case GOSSIP_SENDER_MAIN + 7:
creature->CastSpell(player, SPELL_STR, false);
player->AddSpellCooldown(SPELL_STR, 0, time(NULL) + 7200);
- SendAction(player, creature, uiAction);
+ SendAction(player, creature, action);
break;
- case GOSSIP_SENDER_MAIN+8:
+ case GOSSIP_SENDER_MAIN + 8:
creature->CastSpell(player, SPELL_AGI, false);
player->AddSpellCooldown(SPELL_AGI, 0, time(NULL) + 7200);
- SendAction(player, creature, uiAction);
+ SendAction(player, creature, action);
break;
}
return true;
@@ -1525,7 +1542,7 @@ public:
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_steam_tonkAI(creature);
}
@@ -1556,18 +1573,19 @@ public:
void AttackStart(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 const diff)
{
if (ExplosionTimer <= diff)
{
DoCast(me, SPELL_TONK_MINE_DETONATE, true);
me->setDeathState(DEAD); // unsummon it
- } else
+ }
+ else
ExplosionTimer -= diff;
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_tonk_mineAI(creature);
}
@@ -1595,7 +1613,7 @@ public:
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_brewfest_revelerAI(creature);
}
@@ -1627,15 +1645,21 @@ public:
player->CastSpell(player, 26218, false);
switch (urand(0, 2))
{
- case 0: me->CastSpell(player, 26207, false); break;
- case 1: me->CastSpell(player, 26206, false); break;
- case 2: me->CastSpell(player, 45036, false); break;
+ case 0:
+ me->CastSpell(player, 26207, false);
+ break;
+ case 1:
+ me->CastSpell(player, 26206, false);
+ break;
+ case 2:
+ me->CastSpell(player, 45036, false);
+ break;
}
}
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_winter_revelerAI(creature);
}
@@ -1674,12 +1698,9 @@ public:
{
SpellTimer = 0;
- CreatureTemplate const *Info = me->GetCreatureInfo();
+ CreatureTemplate const* Info = me->GetCreatureInfo();
- if (Info->Entry == C_VIPER)
- IsViper = true;
- else
- IsViper = false;
+ IsViper = Info->Entry == C_VIPER ? true : false;
me->SetMaxHealth(uint32(107 * (me->getLevel() - 40) * 0.025f));
//Add delta to make them not all hit the same time
@@ -1715,7 +1736,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 const diff)
{
if (!UpdateVictim())
return;
@@ -1741,14 +1762,17 @@ public:
{
if (urand(0, 2) == 0) //33% chance to cast
DoCast(me->getVictim(), SPELL_DEADLY_POISON);
- SpellTimer = VENOMOUS_SNAKE_TIMER + (rand() %5)*100;
+ SpellTimer = VENOMOUS_SNAKE_TIMER + (rand() % 5) * 100;
}
- } else SpellTimer -= diff;
+ }
+ else
+ SpellTimer -= diff;
+
DoMeleeAttackIfReady();
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_snake_trap_serpentsAI(creature);
}
@@ -1772,27 +1796,33 @@ public:
struct mob_mojoAI : public ScriptedAI
{
mob_mojoAI(Creature* c) : ScriptedAI(c) {Reset();}
- uint32 hearts;
- uint64 victimGUID;
+
+ uint32 Hearts;
+ uint64 VictimGUID;
+
void Reset()
{
- victimGUID = 0;
- hearts = 15000;
+ VictimGUID = 0;
+ Hearts = 15000;
if (Unit* own = me->GetOwner())
me->GetMotionMaster()->MoveFollow(own, 0, 0);
}
+
void EnterCombat(Unit* /*who*/){}
- void UpdateAI(const uint32 diff)
+
+ void UpdateAI(uint32 const diff)
{
if (me->HasAura(20372))
{
- if (hearts <= diff)
+ if (Hearts <= diff)
{
me->RemoveAurasDueToSpell(20372);
- hearts = 15000;
- } hearts -= diff;
+ Hearts = 15000;
+ }
+ Hearts -= diff;
}
}
+
void ReceiveEmote(Player* player, uint32 emote)
{
me->HandleEmoteCommand(emote);
@@ -1802,38 +1832,50 @@ public:
if (emote == TEXT_EMOTE_KISS)
{
std::string whisp = "";
- switch (rand()%8)
+ switch (rand() % 8)
{
- case 0:whisp.append(SAY_RANDOM_MOJO0);break;
- case 1:whisp.append(SAY_RANDOM_MOJO1);break;
- case 2:whisp.append(SAY_RANDOM_MOJO2);break;
- case 3:whisp.append(SAY_RANDOM_MOJO3);break;
- case 4:whisp.append(SAY_RANDOM_MOJO4);break;
- case 5:whisp.append(SAY_RANDOM_MOJO5);break;
+ case 0:
+ whisp.append(SAY_RANDOM_MOJO0);
+ break;
+ case 1:
+ whisp.append(SAY_RANDOM_MOJO1);
+ break;
+ case 2:
+ whisp.append(SAY_RANDOM_MOJO2);
+ break;
+ case 3:
+ whisp.append(SAY_RANDOM_MOJO3);
+ break;
+ case 4:
+ whisp.append(SAY_RANDOM_MOJO4);
+ break;
+ case 5:
+ whisp.append(SAY_RANDOM_MOJO5);
+ break;
case 6:
whisp.append(SAY_RANDOM_MOJO6a);
whisp.append(player->GetName());
whisp.append(SAY_RANDOM_MOJO6b);
break;
- case 7:whisp.append(SAY_RANDOM_MOJO7);break;
+ case 7:
+ whisp.append(SAY_RANDOM_MOJO7);
+ break;
}
+
me->MonsterWhisper(whisp.c_str(), player->GetGUID());
- if (victimGUID)
- {
- Player* victim = Unit::GetPlayer(*me, victimGUID);
- if (victim)
+ if (VictimGUID)
+ if (Player* victim = Unit::GetPlayer(*me, VictimGUID))
victim->RemoveAura(43906);//remove polymorph frog thing
- }
me->AddAura(43906, player);//add polymorph frog thing
- victimGUID = player->GetGUID();
+ VictimGUID = player->GetGUID();
DoCast(me, 20372, true);//tag.hearts
me->GetMotionMaster()->MoveFollow(player, 0, 0);
- hearts = 15000;
+ Hearts = 15000;
}
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new mob_mojoAI(creature);
}
@@ -1879,7 +1921,7 @@ public:
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_mirror_imageAI(creature);
}
@@ -1894,23 +1936,23 @@ public:
{
npc_ebon_gargoyleAI(Creature* c) : CasterAI(c) {}
- uint32 despawnTimer;
+ uint32 DespawnTimer;
void InitializeAI()
{
CasterAI::InitializeAI();
- uint64 owner_guid = me->GetOwnerGUID();
- if (!owner_guid)
+ uint64 ownerGuid = me->GetOwnerGUID();
+ if (!ownerGuid)
return;
// Not needed to be despawned now
- despawnTimer = 0;
+ DespawnTimer = 0;
// Find victim of Summon Gargoyle spell
std::list<Unit*> targets;
Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 30);
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targets, u_check);
me->VisitNearbyObject(30, searcher);
for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
- if ((*iter)->GetAura(49206, owner_guid))
+ if ((*iter)->GetAura(49206, ownerGuid))
{
me->Attack((*iter), false);
break;
@@ -1925,7 +1967,7 @@ public:
}
// Fly away when dismissed
- void SpellHit(Unit* source, const SpellInfo *spell)
+ void SpellHit(Unit* source, SpellInfo const* spell)
{
if (spell->Id != 50515 || !me->isAlive())
return;
@@ -1952,26 +1994,24 @@ public:
me->GetMotionMaster()->MovePoint(0, x, y, z);
// Despawn as soon as possible
- despawnTimer = 4 * IN_MILLISECONDS;
+ DespawnTimer = 4 * IN_MILLISECONDS;
}
void UpdateAI(const uint32 diff)
{
- if (despawnTimer > 0)
+ if (DespawnTimer > 0)
{
- if (despawnTimer > diff)
- despawnTimer -= diff;
+ if (DespawnTimer > diff)
+ DespawnTimer -= diff;
else
- {
me->DespawnOrUnsummon();
- }
return;
}
CasterAI::UpdateAI(diff);
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_ebon_gargoyleAI(creature);
}
@@ -1992,7 +2032,7 @@ public:
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_lightwellAI(creature);
}
@@ -2013,20 +2053,20 @@ public:
{
npc_training_dummyAI(Creature* creature) : Scripted_NoMovementAI(creature)
{
- uiEntry = creature->GetEntry();
+ Entry = creature->GetEntry();
}
- uint32 uiEntry;
- uint32 uiResetTimer;
- uint32 uiDespawnTimer;
+ uint32 Entry;
+ uint32 ResetTimer;
+ uint32 DespawnTimer;
void Reset()
{
me->SetControlled(true, UNIT_STAT_STUNNED);//disable rotate
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);//imune to knock aways like blast wave
- uiResetTimer = 5000;
- uiDespawnTimer = 15000;
+ ResetTimer = 5000;
+ DespawnTimer = 15000;
}
void EnterEvadeMode()
@@ -2037,19 +2077,19 @@ public:
Reset();
}
- void DamageTaken(Unit* /*done_by*/, uint32 &damage)
+ void DamageTaken(Unit* /*doneBy*/, uint32& damage)
{
- uiResetTimer = 5000;
+ ResetTimer = 5000;
damage = 0;
}
void EnterCombat(Unit* /*who*/)
{
- if (uiEntry != NPC_ADVANCED_TARGET_DUMMY && uiEntry != NPC_TARGET_DUMMY)
+ if (Entry != NPC_ADVANCED_TARGET_DUMMY && Entry != NPC_TARGET_DUMMY)
return;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 const diff)
{
if (!UpdateVictim())
return;
@@ -2057,23 +2097,23 @@ public:
if (!me->HasUnitState(UNIT_STAT_STUNNED))
me->SetControlled(true, UNIT_STAT_STUNNED);//disable rotate
- if (uiEntry != NPC_ADVANCED_TARGET_DUMMY && uiEntry != NPC_TARGET_DUMMY)
+ if (Entry != NPC_ADVANCED_TARGET_DUMMY && Entry != NPC_TARGET_DUMMY)
{
- if (uiResetTimer <= uiDiff)
+ if (ResetTimer <= diff)
{
EnterEvadeMode();
- uiResetTimer = 5000;
+ ResetTimer = 5000;
}
else
- uiResetTimer -= uiDiff;
+ ResetTimer -= diff;
return;
}
else
{
- if (uiDespawnTimer <= uiDiff)
+ if (DespawnTimer <= diff)
me->DespawnOrUnsummon();
else
- uiDespawnTimer -= uiDiff;
+ DespawnTimer -= diff;
}
}
void MoveInLineOfSight(Unit* /*who*/){return;}
@@ -2100,24 +2140,24 @@ public:
{
npc_shadowfiendAI(Creature* creature) : ScriptedAI(creature) {}
- void DamageTaken(Unit* /*killer*/, uint32 &damage)
+ void DamageTaken(Unit* /*killer*/, uint32& damage)
{
if (me->isSummon())
if (Unit* owner = me->ToTempSummon()->GetSummoner())
- {
- if (owner->HasAura(GLYPH_OF_SHADOWFIEND))
- if (damage >= me->GetHealth())
- owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true);
- }
+ if (owner->HasAura(GLYPH_OF_SHADOWFIEND) && damage >= me->GetHealth())
+ owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true);
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 const /*diff*/)
{
+ if (!UpdateVictim())
+ return;
+
DoMeleeAttackIfReady();
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_shadowfiendAI(creature);
}
@@ -2154,11 +2194,11 @@ public:
{
if (player == creature->ToTempSummon()->GetSummoner())
{
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
player->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, creature->GetGUID());
}
@@ -2166,12 +2206,12 @@ public:
return true;
}
- bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction)
+ bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
bool roll = urand(0, 1);
- switch(uiAction)
+ switch(action)
{
case GOSSIP_ACTION_INFO_DEF + 1: //Borean Tundra
player->CLOSE_GOSSIP_MENU();
@@ -2229,9 +2269,9 @@ public:
if (player->getClass() == CLASS_HUNTER)
{
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
if (player->GetPet() && player->GetPet()->getPetType() == HUNTER_PET)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
player->PlayerTalkClass->SendGossipMenu(TEXT_ISHUNTER, creature->GetGUID());
return true;
@@ -2240,17 +2280,17 @@ public:
return true;
}
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
- switch(uiAction)
+ switch(action)
{
case GOSSIP_ACTION_INFO_DEF + 1:
player->PlayerTalkClass->SendGossipMenu(TEXT_PETINFO, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF + 2:
{
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET_CONFIRM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET_CONFIRM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
player->PlayerTalkClass->SendGossipMenu(TEXT_CONFIRM, creature->GetGUID());
}
break;
@@ -2311,61 +2351,61 @@ public:
{
// Arcatraz Key
if (player->GetQuestRewardStatus(QUEST_HOW_TO_BRAKE_IN_TO_THE_ARCATRAZ) && !player->HasItemCount(ITEM_ARCATRAZ_KEY, 1, true))
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_ARCATRAZ_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +1);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_ARCATRAZ_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
// Shadowforge Key
if (player->GetQuestRewardStatus(QUEST_DARK_IRON_LEGACY) && !player->HasItemCount(ITEM_SHADOWFORGE_KEY, 1, true))
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SHADOWFORGE_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +2);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SHADOWFORGE_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
// Skeleton Key
if ((player->GetQuestRewardStatus(QUEST_THE_KEY_TO_SCHOLOMANCE_A) || player->GetQuestRewardStatus(QUEST_THE_KEY_TO_SCHOLOMANCE_H)) &&
!player->HasItemCount(ITEM_SKELETON_KEY, 1, true))
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SKELETON_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +3);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SKELETON_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
// Shatered Halls Key
if ((player->GetQuestRewardStatus(QUEST_HOTTER_THAN_HELL_A) || player->GetQuestRewardStatus(QUEST_HOTTER_THAN_HELL_H)) &&
!player->HasItemCount(ITEM_SHATTERED_HALLS_KEY, 1, true))
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SHATTERED_HALLS_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +4);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SHATTERED_HALLS_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
// Master's Key
if (player->GetQuestRewardStatus(QUEST_RETURN_TO_KHAGDAR) && !player->HasItemCount(ITEM_THE_MASTERS_KEY, 1, true))
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_THE_MASTERS_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +5);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_THE_MASTERS_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
// Violet Hold Key
if (player->GetQuestRewardStatus(QUEST_CONTAINMENT) && !player->HasItemCount(ITEM_VIOLET_HOLD_KEY, 1, true))
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_VIOLET_HOLD_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +6);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_VIOLET_HOLD_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
- bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction)
+ bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
- switch(uiAction)
+ switch(action)
{
- case GOSSIP_ACTION_INFO_DEF+1:
+ case GOSSIP_ACTION_INFO_DEF + 1:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_ARCATRAZ_KEY, false);
break;
- case GOSSIP_ACTION_INFO_DEF+2:
+ case GOSSIP_ACTION_INFO_DEF + 2:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_SHADOWFORGE_KEY, false);
break;
- case GOSSIP_ACTION_INFO_DEF+3:
+ case GOSSIP_ACTION_INFO_DEF + 3:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_SKELETON_KEY, false);
break;
- case GOSSIP_ACTION_INFO_DEF+4:
+ case GOSSIP_ACTION_INFO_DEF + 4:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_SHATTERED_HALLS_KEY, false);
break;
- case GOSSIP_ACTION_INFO_DEF+5:
+ case GOSSIP_ACTION_INFO_DEF + 5:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_THE_MASTERS_KEY, false);
break;
- case GOSSIP_ACTION_INFO_DEF+6:
+ case GOSSIP_ACTION_INFO_DEF + 6:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_VIOLET_HOLD_KEY, false);
break;
@@ -2433,23 +2473,23 @@ public:
bool OnGossipHello(Player* player, Creature* creature)
{
- bool m_bLostBloodKnight = false;
- bool m_bLostHand = false;
- bool m_bLostProtector = false;
- bool m_bLostIllidari = false;
- bool m_bLostSummer = false;
+ bool lostBloodKnight = false;
+ bool lostHand = false;
+ bool lostProtector = false;
+ bool lostIllidari = false;
+ bool lostSummer = false;
//Tabard of the Blood Knight
if (player->GetQuestRewardStatus(QUEST_TRUE_MASTERS_OF_LIGHT) && !player->HasItemCount(ITEM_TABARD_OF_THE_BLOOD_KNIGHT, 1, true))
- m_bLostBloodKnight = true;
+ lostBloodKnight = true;
//Tabard of the Hand
if (player->GetQuestRewardStatus(QUEST_THE_UNWRITTEN_PROPHECY) && !player->HasItemCount(ITEM_TABARD_OF_THE_HAND, 1, true))
- m_bLostHand = true;
+ lostHand = true;
//Tabard of the Protector
if (player->GetQuestRewardStatus(QUEST_INTO_THE_BREACH) && !player->HasItemCount(ITEM_TABARD_OF_THE_PROTECTOR, 1, true))
- m_bLostProtector = true;
+ lostProtector = true;
//Green Trophy Tabard of the Illidari
//Purple Trophy Tabard of the Illidari
@@ -2457,38 +2497,38 @@ public:
(!player->HasItemCount(ITEM_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) &&
!player->HasItemCount(ITEM_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) &&
!player->HasItemCount(ITEM_OFFERING_OF_THE_SHATAR, 1, true)))
- m_bLostIllidari = true;
+ lostIllidari = true;
//Tabard of Summer Skies
//Tabard of Summer Flames
if (player->GetQuestRewardStatus(QUEST_SHARDS_OF_AHUNE) &&
!player->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_SKIES, 1, true) &&
!player->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_FLAMES, 1, true))
- m_bLostSummer = true;
+ lostSummer = true;
- if (m_bLostBloodKnight || m_bLostHand || m_bLostProtector || m_bLostIllidari || m_bLostSummer)
+ if (lostBloodKnight || lostHand || lostProtector || lostIllidari || lostSummer)
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
- if (m_bLostBloodKnight)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_BLOOD_KNIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +1);
+ if (lostBloodKnight)
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_BLOOD_KNIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
- if (m_bLostHand)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_HAND, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +2);
+ if (lostHand)
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_HAND, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
- if (m_bLostProtector)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_PROTECTOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
+ if (lostProtector)
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_PROTECTOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
- if (m_bLostIllidari)
+ if (lostIllidari)
{
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
}
- if (m_bLostSummer)
+ if (lostSummer)
{
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_SKIES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_FLAMES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_SKIES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_FLAMES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7);
}
player->SEND_GOSSIP_MENU(13583, creature->GetGUID());
@@ -2499,39 +2539,39 @@ public:
return true;
}
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
- switch(uiAction)
+ switch(action)
{
case GOSSIP_ACTION_TRADE:
player->GetSession()->SendListInventory(creature->GetGUID());
break;
- case GOSSIP_ACTION_INFO_DEF+1:
+ case GOSSIP_ACTION_INFO_DEF + 1:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_TABARD_OF_THE_BLOOD_KNIGHT, false);
break;
- case GOSSIP_ACTION_INFO_DEF+2:
+ case GOSSIP_ACTION_INFO_DEF + 2:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_TABARD_OF_THE_HAND, false);
break;
- case GOSSIP_ACTION_INFO_DEF+3:
+ case GOSSIP_ACTION_INFO_DEF + 3:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_TABARD_OF_THE_PROTECTOR, false);
break;
- case GOSSIP_ACTION_INFO_DEF+4:
+ case GOSSIP_ACTION_INFO_DEF + 4:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, false);
break;
- case GOSSIP_ACTION_INFO_DEF+5:
+ case GOSSIP_ACTION_INFO_DEF + 5:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, false);
break;
- case GOSSIP_ACTION_INFO_DEF+6:
+ case GOSSIP_ACTION_INFO_DEF + 6:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_TABARD_OF_SUMMER_SKIES, false);
break;
- case GOSSIP_ACTION_INFO_DEF+7:
+ case GOSSIP_ACTION_INFO_DEF + 7:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_TABARD_OF_SUMMER_FLAMES, false);
break;
@@ -2544,10 +2584,10 @@ public:
## npc_experience
######*/
-#define EXP_COST 100000//10 00 00 copper (10golds)
+#define EXP_COST 100000 //10 00 00 copper (10golds)
#define GOSSIP_TEXT_EXP 14736
-#define GOSSIP_XP_OFF "I no longer wish to gain experience."
-#define GOSSIP_XP_ON "I wish to start gaining experience again."
+#define GOSSIP_XP_OFF "I no longer wish to gain experience."
+#define GOSSIP_XP_ON "I wish to start gaining experience again."
class npc_experience : public CreatureScript
{
@@ -2556,19 +2596,19 @@ public:
bool OnGossipHello(Player* player, Creature* creature)
{
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_OFF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_ON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_OFF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_ON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
player->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXT_EXP, creature->GetGUID());
return true;
}
- bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction)
+ bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
bool noXPGain = player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN);
bool doSwitch = false;
- switch(uiAction)
+ switch(action)
{
case GOSSIP_ACTION_INFO_DEF + 1://xp off
{
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;