aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/AccountMgr.cpp36
-rw-r--r--src/game/AchievementMgr.cpp318
-rw-r--r--src/game/AddonMgr.cpp2
-rw-r--r--src/game/ArenaTeam.cpp50
-rw-r--r--src/game/ArenaTeam.h4
-rw-r--r--src/game/ArenaTeamHandler.cpp68
-rw-r--r--src/game/Bag.cpp24
-rw-r--r--src/game/BattleGround.cpp64
-rw-r--r--src/game/BattleGroundAB.cpp2
-rw-r--r--src/game/BattleGroundABG.cpp2
-rw-r--r--src/game/BattleGroundAV.cpp298
-rw-r--r--src/game/BattleGroundBE.cpp2
-rw-r--r--src/game/BattleGroundEY.cpp4
-rw-r--r--src/game/BattleGroundHandler.cpp14
-rw-r--r--src/game/BattleGroundIC.cpp2
-rw-r--r--src/game/BattleGroundMgr.cpp34
-rw-r--r--src/game/BattleGroundSA.cpp94
-rw-r--r--src/game/BattleGroundWS.cpp48
-rw-r--r--src/game/Cell.h10
-rw-r--r--src/game/CellImpl.h10
-rw-r--r--src/game/Channel.cpp156
-rw-r--r--src/game/Channel.h14
-rw-r--r--src/game/ChannelHandler.cpp98
-rw-r--r--src/game/ChannelMgr.cpp12
-rw-r--r--src/game/CharacterHandler.cpp174
-rw-r--r--src/game/Chat.cpp6
-rw-r--r--src/game/ChatHandler.cpp138
-rw-r--r--src/game/CombatAI.cpp54
-rw-r--r--src/game/CombatHandler.cpp8
-rw-r--r--src/game/ConfusedMovementGenerator.cpp14
-rw-r--r--src/game/ConfusedMovementGenerator.h2
-rw-r--r--src/game/Corpse.cpp20
-rw-r--r--src/game/Creature.cpp408
-rw-r--r--src/game/Creature.h16
-rw-r--r--src/game/CreatureAI.cpp44
-rw-r--r--src/game/CreatureAIImpl.h2
-rw-r--r--src/game/CreatureAISelector.cpp34
-rw-r--r--src/game/CreatureEventAI.cpp28
-rw-r--r--src/game/CreatureEventAIMgr.cpp18
-rw-r--r--src/game/CreatureGroups.cpp44
-rw-r--r--src/game/DBCStores.cpp110
-rw-r--r--src/game/DBCStructure.h50
-rw-r--r--src/game/Debugcmds.cpp104
-rw-r--r--src/game/DestinationHolderImp.h16
-rw-r--r--src/game/DuelHandler.cpp10
-rw-r--r--src/game/DynamicObject.cpp14
-rw-r--r--src/game/FleeingMovementGenerator.cpp60
-rw-r--r--src/game/GameEventMgr.cpp202
-rw-r--r--src/game/GameObject.cpp236
-rw-r--r--src/game/GameObject.h2
-rw-r--r--src/game/GlobalEvents.cpp6
-rw-r--r--src/game/GossipDef.cpp10
-rw-r--r--src/game/GridDefines.h12
-rw-r--r--src/game/GridNotifiers.cpp74
-rw-r--r--src/game/GridNotifiers.h78
-rw-r--r--src/game/GridNotifiersImpl.h124
-rw-r--r--src/game/GridStates.cpp10
-rw-r--r--src/game/GridStates.h2
-rw-r--r--src/game/Group.cpp272
-rw-r--r--src/game/Group.h22
-rw-r--r--src/game/GroupHandler.cpp154
-rw-r--r--src/game/GuardAI.cpp26
-rw-r--r--src/game/Guild.cpp2
-rw-r--r--src/game/Guild.h6
-rw-r--r--src/game/GuildHandler.cpp138
-rw-r--r--src/game/HomeMovementGenerator.cpp6
-rw-r--r--src/game/HostileRefManager.cpp8
-rw-r--r--src/game/IdleMovementGenerator.cpp16
-rw-r--r--src/game/InstanceData.cpp4
-rw-r--r--src/game/InstanceSaveMgr.cpp74
-rw-r--r--src/game/ItemEnchantmentMgr.cpp6
-rw-r--r--src/game/ItemHandler.cpp228
-rw-r--r--src/game/LFGHandler.cpp94
-rw-r--r--src/game/Level0.cpp26
-rw-r--r--src/game/Level1.cpp272
-rw-r--r--src/game/Level2.cpp686
-rw-r--r--src/game/Level3.cpp916
-rw-r--r--src/game/LootHandler.cpp46
-rw-r--r--src/game/LootMgr.cpp80
-rw-r--r--src/game/Mail.h2
-rw-r--r--src/game/Map.cpp390
-rw-r--r--src/game/Map.h14
-rw-r--r--src/game/MapInstanced.cpp30
-rw-r--r--src/game/MapManager.cpp8
-rw-r--r--src/game/MapManager.h4
-rw-r--r--src/game/MapReference.h2
-rw-r--r--src/game/MiscHandler.cpp230
-rw-r--r--src/game/MotionMaster.cpp68
-rw-r--r--src/game/MotionMaster.h4
-rw-r--r--src/game/MovementHandler.cpp104
-rw-r--r--src/game/NPCHandler.cpp110
-rw-r--r--src/game/Object.cpp380
-rw-r--r--src/game/Object.h26
-rw-r--r--src/game/ObjectAccessor.cpp14
-rw-r--r--src/game/ObjectAccessor.h4
-rw-r--r--src/game/ObjectGridLoader.cpp18
-rw-r--r--src/game/ObjectMgr.cpp1218
-rw-r--r--src/game/ObjectMgr.h60
-rw-r--r--src/game/Opcodes.h8
-rw-r--r--src/game/OutdoorPvP.cpp116
-rw-r--r--src/game/OutdoorPvP.h2
-rw-r--r--src/game/OutdoorPvPEP.cpp110
-rw-r--r--src/game/OutdoorPvPHP.cpp40
-rw-r--r--src/game/OutdoorPvPMgr.cpp40
-rw-r--r--src/game/OutdoorPvPNA.cpp96
-rw-r--r--src/game/OutdoorPvPSI.cpp32
-rw-r--r--src/game/OutdoorPvPTF.cpp32
-rw-r--r--src/game/OutdoorPvPZM.cpp68
-rw-r--r--src/game/PassiveAI.cpp4
-rw-r--r--src/game/Path.h2
-rw-r--r--src/game/Pet.cpp156
-rw-r--r--src/game/PetAI.cpp40
-rw-r--r--src/game/PetHandler.cpp154
-rw-r--r--src/game/PetitionsHandler.cpp148
-rw-r--r--src/game/Player.cpp2500
-rw-r--r--src/game/Player.h30
-rw-r--r--src/game/PlayerDump.cpp128
-rw-r--r--src/game/PointMovementGenerator.cpp14
-rw-r--r--src/game/PoolHandler.cpp6
-rw-r--r--src/game/QueryHandler.cpp32
-rw-r--r--src/game/QuestDef.cpp6
-rw-r--r--src/game/QuestHandler.cpp104
-rw-r--r--src/game/RandomMovementGenerator.cpp26
-rw-r--r--src/game/ReactorAI.cpp8
-rw-r--r--src/game/ReputationMgr.cpp78
-rw-r--r--src/game/ScriptMgr.cpp18
-rw-r--r--src/game/ScriptedCreature.cpp44
-rw-r--r--src/game/ScriptedCreature.h2
-rw-r--r--src/game/ScriptedEscortAI.cpp2
-rw-r--r--src/game/SharedDefines.h2
-rw-r--r--src/game/SkillExtraItems.cpp14
-rw-r--r--src/game/SkillHandler.cpp4
-rw-r--r--src/game/SocialMgr.cpp22
-rw-r--r--src/game/Spell.cpp1364
-rw-r--r--src/game/Spell.h36
-rw-r--r--src/game/SpellAuraEffects.cpp946
-rw-r--r--src/game/SpellAuraEffects.h4
-rw-r--r--src/game/SpellAuras.cpp122
-rw-r--r--src/game/SpellEffects.cpp870
-rw-r--r--src/game/SpellHandler.cpp8
-rw-r--r--src/game/SpellMgr.cpp236
-rw-r--r--src/game/SpellMgr.h76
-rw-r--r--src/game/StatSystem.cpp84
-rw-r--r--src/game/TargetedMovementGenerator.cpp38
-rw-r--r--src/game/TargetedMovementGenerator.h2
-rw-r--r--src/game/TaxiHandler.cpp26
-rw-r--r--src/game/TemporarySummon.cpp54
-rw-r--r--src/game/ThreatManager.cpp42
-rw-r--r--src/game/TicketHandler.cpp8
-rw-r--r--src/game/Totem.cpp12
-rw-r--r--src/game/TotemAI.cpp4
-rw-r--r--src/game/TradeHandler.cpp58
-rw-r--r--src/game/Transports.cpp36
-rw-r--r--src/game/Traveller.h12
-rw-r--r--src/game/Unit.cpp576
-rw-r--r--src/game/Unit.h24
-rw-r--r--src/game/UnitAI.cpp44
-rw-r--r--src/game/UnitAI.h2
-rw-r--r--src/game/UpdateData.cpp2
-rw-r--r--src/game/UpdateMask.h4
-rw-r--r--src/game/Vehicle.cpp100
-rw-r--r--src/game/WaypointManager.cpp10
-rw-r--r--src/game/WaypointManager.h2
-rw-r--r--src/game/WaypointMovementGenerator.cpp2
-rw-r--r--src/game/Weather.cpp28
-rw-r--r--src/game/World.cpp18
-rw-r--r--src/game/World.h4
-rw-r--r--src/game/WorldLog.cpp12
-rw-r--r--src/game/WorldSession.cpp92
-rw-r--r--src/game/WorldSession.h2
-rw-r--r--src/game/WorldSocket.cpp14
-rw-r--r--src/game/WorldSocketMgr.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/alterac_valley/alterac_valley.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/alterac_valley/boss_balinda.cpp8
-rw-r--r--src/scripts/eastern_kingdoms/alterac_valley/boss_drekthar.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/alterac_valley/boss_galvangar.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/alterac_valley/boss_vanndar.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp4
-rw-r--r--src/scripts/eastern_kingdoms/blackrock_depths/boss_magmus.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/blackwing_lair/boss_nefarian.cpp4
-rw-r--r--src/scripts/eastern_kingdoms/duskwood.cpp6
-rw-r--r--src/scripts/eastern_kingdoms/gnomeregan/gnomeregan.cpp8
-rw-r--r--src/scripts/eastern_kingdoms/karazhan/boss_curator.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/karazhan/boss_moroes.cpp4
-rw-r--r--src/scripts/eastern_kingdoms/karazhan/boss_netherspite.cpp36
-rw-r--r--src/scripts/eastern_kingdoms/karazhan/boss_nightbane.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/karazhan/boss_terestian_illhoof.cpp10
-rw-r--r--src/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp28
-rw-r--r--src/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp18
-rw-r--r--src/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp8
-rw-r--r--src/scripts/eastern_kingdoms/scarlet_monastery/boss_headless_horseman.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/silverpine_forest.cpp10
-rw-r--r--src/scripts/eastern_kingdoms/sunken_temple/instance_sunken_temple.cpp12
-rw-r--r--src/scripts/eastern_kingdoms/sunwell_plateau/boss_brutallus.cpp4
-rw-r--r--src/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp4
-rw-r--r--src/scripts/eastern_kingdoms/sunwell_plateau/boss_kalecgos.cpp46
-rw-r--r--src/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp8
-rw-r--r--src/scripts/eastern_kingdoms/sunwell_plateau/boss_muru.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/sunwell_plateau/instance_sunwell_plateau.cpp4
-rw-r--r--src/scripts/kalimdor/azuremyst_isle.cpp10
-rw-r--r--src/scripts/kalimdor/blackfathom_depths/blackfathom_deeps.cpp8
-rw-r--r--src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.cpp6
-rw-r--r--src/scripts/kalimdor/caverns_of_time/dark_portal/dark_portal.cpp2
-rw-r--r--src/scripts/kalimdor/caverns_of_time/dark_portal/instance_dark_portal.cpp2
-rw-r--r--src/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp2
-rw-r--r--src/scripts/kalimdor/durotar.cpp2
-rw-r--r--src/scripts/kalimdor/silithus.cpp76
-rw-r--r--src/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp2
-rw-r--r--src/scripts/kalimdor/thousand_needles.cpp2
-rw-r--r--src/scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp2
-rw-r--r--src/scripts/northrend/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp4
-rw-r--r--src/scripts/northrend/azjol_nerub/azjol_nerub/boss_anubarak.cpp4
-rw-r--r--src/scripts/northrend/borean_tundra.cpp22
-rw-r--r--src/scripts/northrend/crusaders_coliseum/trial_of_the_champion/boss_grand_champions.cpp8
-rw-r--r--src/scripts/northrend/crusaders_coliseum/trial_of_the_champion/trial_of_the_champion.cpp8
-rw-r--r--src/scripts/northrend/draktharon_keep/boss_novos.cpp2
-rw-r--r--src/scripts/northrend/gundrak/boss_drakkari_colossus.cpp6
-rw-r--r--src/scripts/northrend/gundrak/boss_eck.cpp4
-rw-r--r--src/scripts/northrend/gundrak/boss_moorabi.cpp2
-rw-r--r--src/scripts/northrend/howling_fjord.cpp16
-rw-r--r--src/scripts/northrend/naxxramas/boss_patchwerk.cpp6
-rw-r--r--src/scripts/northrend/naxxramas/boss_razuvious.cpp2
-rw-r--r--src/scripts/northrend/naxxramas/boss_sapphiron.cpp12
-rw-r--r--src/scripts/northrend/nexus/nexus/boss_keristrasza.cpp2
-rw-r--r--src/scripts/northrend/nexus/oculus/boss_drakos.cpp16
-rw-r--r--src/scripts/northrend/nexus/oculus/oculus.cpp8
-rw-r--r--src/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp8
-rw-r--r--src/scripts/northrend/storm_peaks.cpp10
-rw-r--r--src/scripts/northrend/ulduar/halls_of_stone/boss_maiden_of_grief.cpp2
-rw-r--r--src/scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp2
-rw-r--r--src/scripts/northrend/ulduar/halls_of_stone/halls_of_stone.cpp2
-rw-r--r--src/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp34
-rw-r--r--src/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp8
-rw-r--r--src/scripts/northrend/ulduar/ulduar/boss_razorscale.cpp2
-rw-r--r--src/scripts/northrend/ulduar/ulduar/ulduar_teleporter.cpp14
-rw-r--r--src/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp26
-rw-r--r--src/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp2
-rw-r--r--src/scripts/northrend/vault_of_archavon/boss_emalon.cpp6
-rw-r--r--src/scripts/northrend/violet_hold/boss_erekem.cpp2
-rw-r--r--src/scripts/northrend/violet_hold/boss_moragg.cpp2
-rw-r--r--src/scripts/northrend/zuldrak.cpp2
-rw-r--r--src/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp2
-rw-r--r--src/scripts/outland/black_temple/boss_illidan.cpp16
-rw-r--r--src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp24
-rw-r--r--src/scripts/outland/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp24
-rw-r--r--src/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp2
-rw-r--r--src/scripts/outland/netherstorm.cpp8
-rw-r--r--src/scripts/outland/shadowmoon_valley.cpp2
-rw-r--r--src/scripts/outland/tempest_keep/the_eye/boss_astromancer.cpp2
-rw-r--r--src/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp8
-rw-r--r--src/scripts/world/go_scripts.cpp10
-rw-r--r--src/scripts/world/npcs_special.cpp6
254 files changed, 9517 insertions, 9517 deletions
diff --git a/src/game/AccountMgr.cpp b/src/game/AccountMgr.cpp
index 40b1291397c..c6fb9a18fca 100644
--- a/src/game/AccountMgr.cpp
+++ b/src/game/AccountMgr.cpp
@@ -39,18 +39,18 @@ AccountMgr::~AccountMgr()
AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password)
{
- if(utf8length(username) > MAX_ACCOUNT_STR)
+ if (utf8length(username) > MAX_ACCOUNT_STR)
return AOR_NAME_TOO_LONG; // username's too long
normalizeString(username);
normalizeString(password);
- if(GetId(username))
+ if (GetId(username))
{
return AOR_NAME_ALREDY_EXIST; // username does already exist
}
- if(!loginDatabase.PExecute("INSERT INTO account(username,sha_pass_hash,joindate) VALUES('%s','%s',NOW())", username.c_str(), CalculateShaPassHash(username, password).c_str()))
+ if (!loginDatabase.PExecute("INSERT INTO account(username,sha_pass_hash,joindate) VALUES('%s','%s',NOW())", username.c_str(), CalculateShaPassHash(username, password).c_str()))
return AOR_DB_INTERNAL_ERROR; // unexpected error
loginDatabase.Execute("INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist,account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL");
@@ -60,7 +60,7 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass
AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
{
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accid);
- if(!result)
+ if (!result)
return AOR_NAME_NOT_EXIST; // account doesn't exist
result = CharacterDatabase.PQuery("SELECT guid FROM characters WHERE account='%d'",accid);
@@ -73,7 +73,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
uint64 guid = MAKE_NEW_GUID(guidlo, 0, HIGHGUID_PLAYER);
// kick if player currently
- if(Player* p = ObjectAccessor::GetObjectInWorld(guid, (Player*)NULL))
+ if (Player* p = ObjectAccessor::GetObjectInWorld(guid, (Player*)NULL))
{
WorldSession* s = p->GetSession();
s->KickPlayer(); // mark session to remove at next session list update
@@ -97,7 +97,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
loginDatabase.CommitTransaction();
- if(!res)
+ if (!res)
return AOR_DB_INTERNAL_ERROR; // unexpected error;
return AOR_OK;
@@ -106,13 +106,13 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname, std::string new_passwd)
{
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accid);
- if(!result)
+ if (!result)
return AOR_NAME_NOT_EXIST; // account doesn't exist
- if(utf8length(new_uname) > MAX_ACCOUNT_STR)
+ if (utf8length(new_uname) > MAX_ACCOUNT_STR)
return AOR_NAME_TOO_LONG;
- if(utf8length(new_passwd) > MAX_ACCOUNT_STR)
+ if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
return AOR_PASS_TOO_LONG;
normalizeString(new_uname);
@@ -121,7 +121,7 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname,
std::string safe_new_uname = new_uname;
loginDatabase.escape_string(safe_new_uname);
- if(!loginDatabase.PExecute("UPDATE account SET v='0',s='0',username='%s',sha_pass_hash='%s' WHERE id='%d'", safe_new_uname.c_str(),
+ if (!loginDatabase.PExecute("UPDATE account SET v='0',s='0',username='%s',sha_pass_hash='%s' WHERE id='%d'", safe_new_uname.c_str(),
CalculateShaPassHash(new_uname, new_passwd).c_str(), accid))
return AOR_DB_INTERNAL_ERROR; // unexpected error
@@ -132,7 +132,7 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
{
std::string username;
- if(!GetName(accid, username))
+ if (!GetName(accid, username))
return AOR_NAME_NOT_EXIST; // account doesn't exist
if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
@@ -142,7 +142,7 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
normalizeString(new_passwd);
// also reset s and v to force update at next realmd login
- if(!loginDatabase.PExecute("UPDATE account SET v='0', s='0', sha_pass_hash='%s' WHERE id='%d'",
+ if (!loginDatabase.PExecute("UPDATE account SET v='0', s='0', sha_pass_hash='%s' WHERE id='%d'",
CalculateShaPassHash(username, new_passwd).c_str(), accid))
return AOR_DB_INTERNAL_ERROR; // unexpected error
@@ -153,7 +153,7 @@ uint32 AccountMgr::GetId(std::string username)
{
loginDatabase.escape_string(username);
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str());
- if(!result)
+ if (!result)
return 0;
else
{
@@ -165,7 +165,7 @@ uint32 AccountMgr::GetId(std::string username)
uint32 AccountMgr::GetSecurity(uint32 acc_id)
{
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u'", acc_id);
- if(result)
+ if (result)
{
uint32 sec = (*result)[0].GetUInt32();
return sec;
@@ -179,7 +179,7 @@ uint32 AccountMgr::GetSecurity(uint32 acc_id, int32 realm_id)
QueryResult_AutoPtr result = (realm_id == -1)
? loginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u' AND RealmID = '%d'", acc_id, realm_id)
: loginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u' AND (RealmID = '%d' OR RealmID = '-1')", acc_id, realm_id);
- if(result)
+ if (result)
{
uint32 sec = (*result)[0].GetUInt32();
return sec;
@@ -191,7 +191,7 @@ uint32 AccountMgr::GetSecurity(uint32 acc_id, int32 realm_id)
bool AccountMgr::GetName(uint32 acc_id, std::string &name)
{
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id);
- if(result)
+ if (result)
{
name = (*result)[0].GetCppString();
return true;
@@ -203,7 +203,7 @@ bool AccountMgr::GetName(uint32 acc_id, std::string &name)
bool AccountMgr::CheckPassword(uint32 accid, std::string passwd)
{
std::string username;
- if(!GetName(accid, username))
+ if (!GetName(accid, username))
return false;
normalizeString(username);
@@ -221,7 +221,7 @@ bool AccountMgr::normalizeString(std::string& utf8str)
wchar_t wstr_buf[MAX_ACCOUNT_STR+1];
size_t wstr_len = MAX_ACCOUNT_STR;
- if(!Utf8toWStr(utf8str,wstr_buf,wstr_len))
+ if (!Utf8toWStr(utf8str,wstr_buf,wstr_len))
return false;
std::transform( &wstr_buf[0], wstr_buf+wstr_len, &wstr_buf[0], wcharToUpperOnlyLatin );
diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index 29ef589bf24..dd2ad673d54 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -75,7 +75,7 @@ namespace Trinity
bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
{
- if(dataType >= MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE)
+ if (dataType >= MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE)
{
sLog.outErrorDb( "Table `achievement_criteria_data` for criteria (Entry: %u) have wrong data type (%u), ignore.", criteria->ID,dataType);
return false;
@@ -229,7 +229,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
}
return true;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK:
- if(drunk.state >= MAX_DRUNKEN)
+ if (drunk.state >= MAX_DRUNKEN)
{
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK (%u) have unknown drunken state in value1 (%u), ignore.",
criteria->ID, criteria->requiredType,dataType,drunk.state);
@@ -274,9 +274,9 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE:
if (!target || target->GetTypeId() != TYPEID_PLAYER)
return false;
- if(classRace.class_id && classRace.class_id != target->ToPlayer()->getClass())
+ if (classRace.class_id && classRace.class_id != target->ToPlayer()->getClass())
return false;
- if(classRace.race_id && classRace.race_id != target->ToPlayer()->getRace())
+ if (classRace.race_id && classRace.race_id != target->ToPlayer()->getRace())
return false;
return true;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH:
@@ -325,7 +325,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
case ACHIEVEMENT_CRITERIA_DATA_TYPE_BG_LOSS_TEAM_SCORE:
{
BattleGround* bg = source->GetBattleGround();
- if(!bg)
+ if (!bg)
return false;
return bg->IsTeamScoreInRange(source->GetTeam()==ALLIANCE ? HORDE : ALLIANCE,bg_loss_team_score.min_score,bg_loss_team_score.max_score);
}
@@ -363,7 +363,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
bool AchievementCriteriaDataSet::Meets(Player const* source, Unit const* target, uint32 miscvalue /*= 0*/) const
{
for (Storage::const_iterator itr = storage.begin(); itr != storage.end(); ++itr)
- if(!itr->Meets(criteria_id, source, target, miscvalue))
+ if (!itr->Meets(criteria_id, source, target, miscvalue))
return false;
return true;
@@ -404,7 +404,7 @@ void AchievementMgr::Reset()
void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1, uint32 miscvalue2)
{
- if((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES)==0)
+ if ((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES)==0)
sLog.outDetail("AchievementMgr::ResetAchievementCriteria(%u, %u, %u)", type, miscvalue1, miscvalue2);
if (!sWorld.getConfig(CONFIG_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER)
@@ -452,18 +452,18 @@ void AchievementMgr::DeleteFromDB(uint32 lowguid)
void AchievementMgr::SaveToDB()
{
- if(!m_completedAchievements.empty())
+ if (!m_completedAchievements.empty())
{
bool need_execute = false;
std::ostringstream ssdel;
std::ostringstream ssins;
for (CompletedAchievementMap::iterator iter = m_completedAchievements.begin(); iter!=m_completedAchievements.end(); ++iter)
{
- if(!iter->second.changed)
+ if (!iter->second.changed)
continue;
/// first new/changed record prefix
- if(!need_execute)
+ if (!need_execute)
{
ssdel << "DELETE FROM character_achievement WHERE guid = " << GetPlayer()->GetGUIDLow() << " AND achievement IN (";
ssins << "INSERT INTO character_achievement (guid, achievement, date) VALUES ";
@@ -484,17 +484,17 @@ void AchievementMgr::SaveToDB()
iter->second.changed = false;
}
- if(need_execute)
+ if (need_execute)
ssdel << ")";
- if(need_execute)
+ if (need_execute)
{
CharacterDatabase.Execute( ssdel.str().c_str() );
CharacterDatabase.Execute( ssins.str().c_str() );
}
}
- if(!m_criteriaProgress.empty())
+ if (!m_criteriaProgress.empty())
{
/// prepare deleting and insert
bool need_execute_del = false;
@@ -503,13 +503,13 @@ void AchievementMgr::SaveToDB()
std::ostringstream ssins;
for (CriteriaProgressMap::iterator iter = m_criteriaProgress.begin(); iter!=m_criteriaProgress.end(); ++iter)
{
- if(!iter->second.changed)
+ if (!iter->second.changed)
continue;
// deleted data (including 0 progress state)
{
/// first new/changed record prefix (for any counter value)
- if(!need_execute_del)
+ if (!need_execute_del)
{
ssdel << "DELETE FROM character_achievement_progress WHERE guid = " << GetPlayer()->GetGUIDLow() << " AND criteria IN (";
need_execute_del = true;
@@ -523,10 +523,10 @@ void AchievementMgr::SaveToDB()
}
// store data only for real progress
- if(iter->second.counter != 0)
+ if (iter->second.counter != 0)
{
/// first new/changed record prefix
- if(!need_execute_ins)
+ if (!need_execute_ins)
{
ssins << "INSERT INTO character_achievement_progress (guid, criteria, counter, date) VALUES ";
need_execute_ins = true;
@@ -543,14 +543,14 @@ void AchievementMgr::SaveToDB()
iter->second.changed = false;
}
- if(need_execute_del) // DELETE ... IN (.... _)_
+ if (need_execute_del) // DELETE ... IN (.... _)_
ssdel << ")";
- if(need_execute_del || need_execute_ins)
+ if (need_execute_del || need_execute_ins)
{
- if(need_execute_del)
+ if (need_execute_del)
CharacterDatabase.Execute( ssdel.str().c_str() );
- if(need_execute_ins)
+ if (need_execute_ins)
CharacterDatabase.Execute( ssins.str().c_str() );
}
}
@@ -558,7 +558,7 @@ void AchievementMgr::SaveToDB()
void AchievementMgr::LoadFromDB(QueryResult_AutoPtr achievementResult, QueryResult_AutoPtr criteriaResult)
{
- if(achievementResult)
+ if (achievementResult)
{
do
{
@@ -567,7 +567,7 @@ void AchievementMgr::LoadFromDB(QueryResult_AutoPtr achievementResult, QueryResu
uint32 achievement_id = fields[0].GetUInt32();
// don't must happen: cleanup at server startup in achievementmgr.LoadCompletedAchievements()
- if(!sAchievementStore.LookupEntry(achievement_id))
+ if (!sAchievementStore.LookupEntry(achievement_id))
continue;
CompletedAchievementData& ca = m_completedAchievements[achievement_id];
@@ -576,7 +576,7 @@ void AchievementMgr::LoadFromDB(QueryResult_AutoPtr achievementResult, QueryResu
} while (achievementResult->NextRow());
}
- if(criteriaResult)
+ if (criteriaResult)
{
do
{
@@ -609,22 +609,22 @@ void AchievementMgr::LoadFromDB(QueryResult_AutoPtr achievementResult, QueryResu
void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
{
- if(GetPlayer()->GetSession()->PlayerLoading())
+ if (GetPlayer()->GetSession()->PlayerLoading())
return;
#ifdef TRINITY_DEBUG
- if((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES)==0)
+ if ((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES)==0)
sLog.outDebug("AchievementMgr::SendAchievementEarned(%u)", achievement->ID);
#endif
- if(Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()))
+ if (Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()))
{
Trinity::AchievementChatBuilder say_builder(*GetPlayer(), CHAT_MSG_GUILD_ACHIEVEMENT, LANG_ACHIEVEMENT_EARNED,achievement->ID);
Trinity::LocalizedPacketDo<Trinity::AchievementChatBuilder> say_do(say_builder);
guild->BroadcastWorker(say_do,GetPlayer());
}
- if(achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_KILL|ACHIEVEMENT_FLAG_REALM_FIRST_REACH))
+ if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_KILL|ACHIEVEMENT_FLAG_REALM_FIRST_REACH))
{
// broadcast realm first reached
WorldPacket data(SMSG_SERVER_FIRST_ACHIEVEMENT, strlen(GetPlayer()->GetName())+1+8+4+4);
@@ -701,7 +701,7 @@ static const uint32 achievIdForDangeon[][4] =
*/
void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1, uint32 miscvalue2, Unit *unit, uint32 time)
{
- if((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES)==0)
+ if ((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES)==0)
sLog.outDetail("AchievementMgr::UpdateAchievementCriteria(%u, %u, %u, %u)", type, miscvalue1, miscvalue2, time);
if (!sWorld.getConfig(CONFIG_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER)
@@ -739,7 +739,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN:
case ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS:
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
break;
@@ -753,7 +753,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED:
case ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED:
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
SetCriteriaProgress(achievementCriteria, miscvalue1, PROGRESS_ACCUMULATE);
break;
@@ -765,7 +765,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED:
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
SetCriteriaProgress(achievementCriteria, miscvalue1, PROGRESS_HIGHEST);
break;
@@ -800,14 +800,14 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
{
if (bg->GetTypeID() != BATTLEGROUND_AB)
continue;
- if(!((BattleGroundAB*)bg)->IsTeamScores500Disadvantage(GetPlayer()->GetTeam()))
+ if (!((BattleGroundAB*)bg)->IsTeamScores500Disadvantage(GetPlayer()->GetTeam()))
continue;
break;
}
case 156: // AB, win while controlling all 5 flags (all nodes)
case 784: // EY, win while holding 4 bases (all nodes)
{
- if(!bg->IsAllNodesConrolledByTeam(GetPlayer()->GetTeam()))
+ if (!bg->IsAllNodesConrolledByTeam(GetPlayer()->GetTeam()))
continue;
break;
}
@@ -823,14 +823,14 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE:
{
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
- if(achievementCriteria->kill_creature.creatureID != miscvalue1)
+ if (achievementCriteria->kill_creature.creatureID != miscvalue1)
continue;
// those requirements couldn't be found in the dbc
AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
- if(!data || !data->Meets(GetPlayer(),unit))
+ if (!data || !data->Meets(GetPlayer(),unit))
continue;
SetCriteriaProgress(achievementCriteria, miscvalue2, PROGRESS_ACCUMULATE);
@@ -841,27 +841,27 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
break;
case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL:
// update at loading or specific skill update
- if(miscvalue1 && miscvalue1 != achievementCriteria->reach_skill_level.skillID)
+ if (miscvalue1 && miscvalue1 != achievementCriteria->reach_skill_level.skillID)
continue;
- if(uint32 skillvalue = GetPlayer()->GetBaseSkillValue(achievementCriteria->reach_skill_level.skillID))
+ if (uint32 skillvalue = GetPlayer()->GetBaseSkillValue(achievementCriteria->reach_skill_level.skillID))
SetCriteriaProgress(achievementCriteria, skillvalue);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL:
// update at loading or specific skill update
- if(miscvalue1 && miscvalue1 != achievementCriteria->learn_skill_level.skillID)
+ if (miscvalue1 && miscvalue1 != achievementCriteria->learn_skill_level.skillID)
continue;
- if(uint32 maxSkillvalue = GetPlayer()->GetPureMaxSkillValue(achievementCriteria->learn_skill_level.skillID))
+ if (uint32 maxSkillvalue = GetPlayer()->GetPureMaxSkillValue(achievementCriteria->learn_skill_level.skillID))
SetCriteriaProgress(achievementCriteria, maxSkillvalue);
break;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT:
- if(m_completedAchievements.find(achievementCriteria->complete_achievement.linkedAchievement) != m_completedAchievements.end())
+ if (m_completedAchievements.find(achievementCriteria->complete_achievement.linkedAchievement) != m_completedAchievements.end())
SetCriteriaProgress(achievementCriteria, 1);
break;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT:
{
uint32 counter =0;
for (QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); itr++)
- if(itr->second.m_rewarded)
+ if (itr->second.m_rewarded)
counter++;
SetCriteriaProgress(achievementCriteria, counter);
break;
@@ -869,14 +869,14 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE:
{
// speedup for non-login case
- if(miscvalue1 && miscvalue1 != achievementCriteria->complete_quests_in_zone.zoneID)
+ if (miscvalue1 && miscvalue1 != achievementCriteria->complete_quests_in_zone.zoneID)
continue;
uint32 counter =0;
for (QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); itr++)
{
Quest const* quest = objmgr.GetQuestTemplate(itr->first);
- if(itr->second.m_rewarded && quest && quest->GetZoneOrSort() >= 0 && uint32(quest->GetZoneOrSort()) == achievementCriteria->complete_quests_in_zone.zoneID)
+ if (itr->second.m_rewarded && quest && quest->GetZoneOrSort() >= 0 && uint32(quest->GetZoneOrSort()) == achievementCriteria->complete_quests_in_zone.zoneID)
counter++;
}
SetCriteriaProgress(achievementCriteria, counter);
@@ -884,39 +884,39 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
}
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND:
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
- if(GetPlayer()->GetMapId() != achievementCriteria->complete_battleground.mapID)
+ if (GetPlayer()->GetMapId() != achievementCriteria->complete_battleground.mapID)
continue;
SetCriteriaProgress(achievementCriteria, miscvalue1, PROGRESS_ACCUMULATE);
break;
case ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP:
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
- if(GetPlayer()->GetMapId() != achievementCriteria->death_at_map.mapID)
+ if (GetPlayer()->GetMapId() != achievementCriteria->death_at_map.mapID)
continue;
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
break;
case ACHIEVEMENT_CRITERIA_TYPE_DEATH:
{
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
// skip wrong arena achievements, if not achievIdByArenaSlot then normal total death counter
bool notfit = false;
for (int j = 0; j < MAX_ARENA_SLOT; ++j)
{
- if(achievIdByArenaSlot[j] == achievement->ID)
+ if (achievIdByArenaSlot[j] == achievement->ID)
{
BattleGround* bg = GetPlayer()->GetBattleGround();
- if(!bg || !bg->isArena() || ArenaTeam::GetSlotByType(bg->GetArenaType()) != j)
+ if (!bg || !bg->isArena() || ArenaTeam::GetSlotByType(bg->GetArenaType()) != j)
notfit = true;
break;
}
}
- if(notfit)
+ if (notfit)
continue;
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
@@ -925,35 +925,35 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON:
{
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
Map const* map = GetPlayer()->IsInWorld() ? GetPlayer()->GetMap() : MapManager::Instance().FindMap(GetPlayer()->GetMapId(), GetPlayer()->GetInstanceId());
- if(!map || !map->IsDungeon())
+ if (!map || !map->IsDungeon())
continue;
// search case
bool found = false;
for (int j = 0; achievIdForDangeon[j][0]; ++j)
{
- if(achievIdForDangeon[j][0] == achievement->ID)
+ if (achievIdForDangeon[j][0] == achievement->ID)
{
- if(map->IsRaid())
+ if (map->IsRaid())
{
// if raid accepted (ignore difficulty)
- if(!achievIdForDangeon[j][2])
+ if (!achievIdForDangeon[j][2])
break; // for
}
- else if(GetPlayer()->GetDungeonDifficulty()==DUNGEON_DIFFICULTY_NORMAL)
+ else if (GetPlayer()->GetDungeonDifficulty()==DUNGEON_DIFFICULTY_NORMAL)
{
// dungeon in normal mode accepted
- if(!achievIdForDangeon[j][1])
+ if (!achievIdForDangeon[j][1])
break; // for
}
else
{
// dungeon in heroic mode accepted
- if(!achievIdForDangeon[j][3])
+ if (!achievIdForDangeon[j][3])
break; // for
}
@@ -961,11 +961,11 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
break; // for
}
}
- if(!found)
+ if (!found)
continue;
//FIXME: work only for instances where max==min for players
- if(((InstanceMap*)map)->GetMaxPlayers() != achievementCriteria->death_in_dungeon.manLimit)
+ if (((InstanceMap*)map)->GetMaxPlayers() != achievementCriteria->death_in_dungeon.manLimit)
continue;
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
break;
@@ -973,19 +973,19 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
}
case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE:
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
- if(miscvalue1 != achievementCriteria->killed_by_creature.creatureEntry)
+ if (miscvalue1 != achievementCriteria->killed_by_creature.creatureEntry)
continue;
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
break;
case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER:
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
// if team check required: must kill by opposition faction
- if(achievement->ID==318 && miscvalue2==GetPlayer()->GetTeam())
+ if (achievement->ID==318 && miscvalue2==GetPlayer()->GetTeam())
continue;
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
@@ -993,12 +993,12 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING:
{
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
// those requirements couldn't be found in the dbc
AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
- if(!data || !data->Meets(GetPlayer(),unit))
+ if (!data || !data->Meets(GetPlayer(),unit))
continue;
// miscvalue1 is the ingame fallheight*100 as stored in dbc
@@ -1007,9 +1007,9 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
}
case ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM:
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
- if(miscvalue2 != achievementCriteria->death_from.type)
+ if (miscvalue2 != achievementCriteria->death_from.type)
continue;
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
break;
@@ -1024,7 +1024,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
else
{
// login case.
- if(!GetPlayer()->GetQuestRewardStatus(achievementCriteria->complete_quest.questID))
+ if (!GetPlayer()->GetQuestRewardStatus(achievementCriteria->complete_quest.questID))
continue;
}
@@ -1040,7 +1040,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
{
// those requirements couldn't be found in the dbc
AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
- if(!data || !data->Meets(GetPlayer(),unit))
+ if (!data || !data->Meets(GetPlayer(),unit))
continue;
break;
}
@@ -1059,10 +1059,10 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
// those requirements couldn't be found in the dbc
AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
- if(!data)
+ if (!data)
continue;
- if(!data->Meets(GetPlayer(),unit))
+ if (!data->Meets(GetPlayer(),unit))
continue;
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
@@ -1076,20 +1076,20 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
// those requirements couldn't be found in the dbc
AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
- if(!data)
+ if (!data)
continue;
- if(!data->Meets(GetPlayer(),unit))
+ if (!data->Meets(GetPlayer(),unit))
continue;
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
break;
}
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
- if(miscvalue1 && miscvalue1!=achievementCriteria->learn_spell.spellID)
+ if (miscvalue1 && miscvalue1!=achievementCriteria->learn_spell.spellID)
continue;
- if(GetPlayer()->HasSpell(achievementCriteria->learn_spell.spellID))
+ if (GetPlayer()->HasSpell(achievementCriteria->learn_spell.spellID))
SetCriteriaProgress(achievementCriteria, 1);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
@@ -1102,11 +1102,11 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
continue;
// zone specific
- if(achievementCriteria->loot_type.lootTypeCount==1)
+ if (achievementCriteria->loot_type.lootTypeCount==1)
{
// those requirements couldn't be found in the dbc
AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
- if(!data || !data->Meets(GetPlayer(),unit))
+ if (!data || !data->Meets(GetPlayer(),unit))
continue;
}
@@ -1115,7 +1115,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
}
case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM:
// speedup for non-login case
- if(miscvalue1 && achievementCriteria->own_item.itemID != miscvalue1)
+ if (miscvalue1 && achievementCriteria->own_item.itemID != miscvalue1)
continue;
SetCriteriaProgress(achievementCriteria, GetPlayer()->GetItemCount(achievementCriteria->own_item.itemID, true));
break;
@@ -1125,11 +1125,11 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
continue;
// additional requirements
- if(achievementCriteria->win_rated_arena.flag==ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE)
+ if (achievementCriteria->win_rated_arena.flag==ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE)
{
// those requirements couldn't be found in the dbc
AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
- if(!data || !data->Meets(GetPlayer(),unit,miscvalue1))
+ if (!data || !data->Meets(GetPlayer(),unit,miscvalue1))
{
// reset the progress as we have a win without the requirement.
SetCriteriaProgress(achievementCriteria, 0);
@@ -1141,48 +1141,48 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
break;
case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM:
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
- if(achievementCriteria->use_item.itemID != miscvalue1)
+ if (achievementCriteria->use_item.itemID != miscvalue1)
continue;
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM:
// You _have_ to loot that item, just owning it when logging in does _not_ count!
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
- if(miscvalue1 != achievementCriteria->own_item.itemID)
+ if (miscvalue1 != achievementCriteria->own_item.itemID)
continue;
SetCriteriaProgress(achievementCriteria, miscvalue2, PROGRESS_ACCUMULATE);
break;
case ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA:
{
WorldMapOverlayEntry const* worldOverlayEntry = sWorldMapOverlayStore.LookupEntry(achievementCriteria->explore_area.areaReference);
- if(!worldOverlayEntry)
+ if (!worldOverlayEntry)
break;
bool matchFound = false;
for (int j = 0; j < MAX_WORLD_MAP_OVERLAY_AREA_IDX; ++j)
{
uint32 area_id = worldOverlayEntry->areatableID[j];
- if(!area_id) // array have 0 only in empty tail
+ if (!area_id) // array have 0 only in empty tail
break;
int32 exploreFlag = GetAreaFlagByAreaID(area_id);
- if(exploreFlag < 0)
+ if (exploreFlag < 0)
continue;
uint32 playerIndexOffset = uint32(exploreFlag) / 32;
uint32 mask = 1<< (uint32(exploreFlag) % 32);
- if(GetPlayer()->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + playerIndexOffset) & mask)
+ if (GetPlayer()->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + playerIndexOffset) & mask)
{
matchFound = true;
break;
}
}
- if(matchFound)
+ if (matchFound)
SetCriteriaProgress(achievementCriteria, 1);
break;
}
@@ -1208,7 +1208,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP:
{
// skip for login case
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
SetCriteriaProgress(achievementCriteria, 1);
break;
@@ -1257,15 +1257,15 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE:
{
// miscvalue1 = emote
- if(!miscvalue1)
+ if (!miscvalue1)
continue;
- if(miscvalue1 != achievementCriteria->do_emote.emoteID)
+ if (miscvalue1 != achievementCriteria->do_emote.emoteID)
continue;
- if(achievementCriteria->do_emote.count)
+ if (achievementCriteria->do_emote.count)
{
// those requirements couldn't be found in the dbc
AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
- if(!data || !data->Meets(GetPlayer(),unit))
+ if (!data || !data->Meets(GetPlayer(),unit))
continue;
}
@@ -1280,11 +1280,11 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
if (achievementCriteria->healing_done.flag == ACHIEVEMENT_CRITERIA_CONDITION_MAP)
{
- if(GetPlayer()->GetMapId() != achievementCriteria->healing_done.mapid)
+ if (GetPlayer()->GetMapId() != achievementCriteria->healing_done.mapid)
continue;
// map specific case (BG in fact) expected player targeted damage/heal
- if(!unit || unit->GetTypeId() != TYPEID_PLAYER)
+ if (!unit || unit->GetTypeId() != TYPEID_PLAYER)
continue;
}
@@ -1330,7 +1330,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spellIter->first);
for (SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter)
{
- if(skillIter->second->skillId == achievementCriteria->learn_skillline_spell.skillLine)
+ if (skillIter->second->skillId == achievementCriteria->learn_skillline_spell.skillLine)
spellCount++;
}
}
@@ -1444,7 +1444,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS:
break; // Not implemented yet :(
}
- if(IsCompletedCriteria(achievementCriteria,achievement))
+ if (IsCompletedCriteria(achievementCriteria,achievement))
CompletedCriteriaFor(achievement);
// check again the completeness for SUMM and REQ COUNT achievements,
@@ -1455,10 +1455,10 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
CompletedAchievement(achievement);
}
- if(AchievementEntryList const* achRefList = achievementmgr.GetAchievementByReferencedId(achievement->ID))
+ if (AchievementEntryList const* achRefList = achievementmgr.GetAchievementByReferencedId(achievement->ID))
{
for (AchievementEntryList::const_iterator itr = achRefList->begin(); itr != achRefList->end(); ++itr)
- if(IsCompletedAchievement(*itr))
+ if (IsCompletedAchievement(*itr))
CompletedAchievement(*itr);
}
}
@@ -1470,18 +1470,18 @@ static const uint32 achievIdByRace[MAX_RACES] = { 0, 1408, 1410, 1407, 1409,
bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achievementCriteria, AchievementEntry const* achievement)
{
// counter can never complete
- if(achievement->flags & ACHIEVEMENT_FLAG_COUNTER)
+ if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER)
return false;
- if(achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_REACH | ACHIEVEMENT_FLAG_REALM_FIRST_KILL))
+ if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_REACH | ACHIEVEMENT_FLAG_REALM_FIRST_KILL))
{
// someone on this realm has already completed that achievement
- if(achievementmgr.IsRealmCompleted(achievement))
+ if (achievementmgr.IsRealmCompleted(achievement))
return false;
}
CriteriaProgressMap::const_iterator itr = m_criteriaProgress.find(achievementCriteria->ID);
- if(itr == m_criteriaProgress.end())
+ if (itr == m_criteriaProgress.end())
return false;
CriteriaProgress const* progress = &itr->second;
@@ -1496,12 +1496,12 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
{
// skip wrong class achievements
for (int i = 1; i < MAX_CLASSES; ++i)
- if(achievIdByClass[i] == achievement->ID && i != GetPlayer()->getClass())
+ if (achievIdByClass[i] == achievement->ID && i != GetPlayer()->getClass())
return false;
// skip wrong race achievements
for (int i = 1; i < MAX_RACES; ++i)
- if(achievIdByRace[i] == achievement->ID && i != GetPlayer()->getRace())
+ if (achievIdByRace[i] == achievement->ID && i != GetPlayer()->getRace())
return false;
// appropriate class/race or not class/race specific
@@ -1620,7 +1620,7 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
void AchievementMgr::CompletedCriteriaFor(AchievementEntry const* achievement)
{
// counter can never complete
- if(achievement->flags & ACHIEVEMENT_FLAG_COUNTER)
+ if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER)
return;
// already completed and stored
@@ -1634,7 +1634,7 @@ void AchievementMgr::CompletedCriteriaFor(AchievementEntry const* achievement)
bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
{
// counter can never complete
- if(entry->flags & ACHIEVEMENT_FLAG_COUNTER)
+ if (entry->flags & ACHIEVEMENT_FLAG_COUNTER)
return false;
// for achievement with referenced achievement criterias get from referenced and counter from self
@@ -1642,7 +1642,7 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
uint32 achievmentForTestCount = entry->count;
AchievementCriteriaEntryList const* cList = achievementmgr.GetAchievementCriteriaByAchievement(achievmentForTestId);
- if(!cList)
+ if (!cList)
return false;
uint32 count = 0;
@@ -1655,7 +1655,7 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
AchievementCriteriaEntry const* criteria = *itr;
CriteriaProgressMap::const_iterator itrProgress = m_criteriaProgress.find(criteria->ID);
- if(itrProgress == m_criteriaProgress.end())
+ if (itrProgress == m_criteriaProgress.end())
continue;
CriteriaProgress const* progress = &itrProgress->second;
@@ -1677,18 +1677,18 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
bool completed = IsCompletedCriteria(criteria,entry);
// found an uncompleted criteria, but DONT return false yet - there might be a completed criteria with ACHIEVEMENT_CRITERIA_COMPLETE_FLAG_ALL
- if(completed)
+ if (completed)
++count;
else
completed_all = false;
// completed as have req. count of completed criterias
- if(achievmentForTestCount > 0 && achievmentForTestCount <= count)
+ if (achievmentForTestCount > 0 && achievmentForTestCount <= count)
return true;
}
// all criterias completed requirement
- if(completed_all && achievmentForTestCount==0)
+ if (completed_all && achievmentForTestCount==0)
return true;
return false;
@@ -1696,17 +1696,17 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry, uint32 changeValue, ProgressType ptype)
{
- if((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES)==0)
+ if ((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES)==0)
sLog.outDetail("AchievementMgr::SetCriteriaProgress(%u, %u) for (GUID:%u)", entry->ID, changeValue, m_player->GetGUIDLow());
CriteriaProgress *progress = NULL;
CriteriaProgressMap::iterator iter = m_criteriaProgress.find(entry->ID);
- if(iter == m_criteriaProgress.end())
+ if (iter == m_criteriaProgress.end())
{
// not create record for 0 counter
- if(changeValue == 0)
+ if (changeValue == 0)
return;
progress = &m_criteriaProgress[entry->ID];
@@ -1736,7 +1736,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
}
// not update (not mark as changed) if counter will have same value
- if(progress->counter == newValue)
+ if (progress->counter == newValue)
return;
progress->counter = newValue;
@@ -1744,10 +1744,10 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
progress->changed = true;
- if(entry->timeLimit)
+ if (entry->timeLimit)
{
time_t now = time(NULL);
- if(time_t(progress->date + entry->timeLimit) < now)
+ if (time_t(progress->date + entry->timeLimit) < now)
progress->counter = 1;
// also it seems illogical, the timeframe will be extended at every criteria update
@@ -1760,10 +1760,10 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
{
sLog.outDetail("AchievementMgr::CompletedAchievement(%u)", achievement->ID);
- if(!sWorld.getConfig(CONFIG_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER)
+ if (!sWorld.getConfig(CONFIG_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER)
return;
- if(achievement->flags & ACHIEVEMENT_FLAG_COUNTER || HasAchieved(achievement))
+ if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER || HasAchieved(achievement))
return;
SendAchievementEarned(achievement);
@@ -1773,7 +1773,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
// don't insert for ACHIEVEMENT_FLAG_REALM_FIRST_KILL since otherwise only the first group member would reach that achievement
// TODO: where do set this instead?
- if(!(achievement->flags & ACHIEVEMENT_FLAG_REALM_FIRST_KILL))
+ if (!(achievement->flags & ACHIEVEMENT_FLAG_REALM_FIRST_KILL))
achievementmgr.SetRealmCompleted(achievement);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT);
@@ -1782,18 +1782,18 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
AchievementReward const* reward = achievementmgr.GetAchievementReward(achievement);
// no rewards
- if(!reward)
+ if (!reward)
return;
// titles
- if(uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == HORDE ? 0 : 1])
+ if (uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == HORDE ? 0 : 1])
{
- if(CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId))
+ if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId))
GetPlayer()->SetTitle(titleEntry);
}
// mail
- if(reward->sender)
+ if (reward->sender)
{
Item* item = reward->itemId ? Item::CreateItem(reward->itemId,1,GetPlayer ()) : NULL;
@@ -1804,7 +1804,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
std::string text = reward->text;
if ( loc_idx >= 0 )
{
- if(AchievementRewardLocale const* loc = achievementmgr.GetAchievementRewardLocale(achievement))
+ if (AchievementRewardLocale const* loc = achievementmgr.GetAchievementRewardLocale(achievement))
{
if (loc->subject.size() > size_t(loc_idx) && !loc->subject[loc_idx].empty())
subject = loc->subject[loc_idx];
@@ -1817,7 +1817,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
MailDraft draft(subject, itemTextId);
- if(item)
+ if (item)
{
// save new item before send
item->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted
@@ -1837,7 +1837,7 @@ void AchievementMgr::SendAllAchievementData()
bool send = false;
WorldPacket data(SMSG_ALL_ACHIEVEMENT_DATA);
- if( size < 0x8000 )
+ if ( size < 0x8000 )
data.resize( size );
else
data.resize( 0x7fff );
@@ -1853,7 +1853,7 @@ void AchievementMgr::SendAllAchievementData()
data.clear();
send = false;
- if( !cAchievements )
+ if ( !cAchievements )
{
for (; iter != m_completedAchievements.end() && !send; ++iter)
{
@@ -1862,7 +1862,7 @@ void AchievementMgr::SendAllAchievementData()
send = data.size() > 0x7f00;
}
- if( iter == m_completedAchievements.end() )
+ if ( iter == m_completedAchievements.end() )
cAchievements = true;
}
@@ -1879,7 +1879,7 @@ void AchievementMgr::SendAllAchievementData()
send = data.size() > 0x7f00;
}
- if( iter2 == m_criteriaProgress.end() )
+ if ( iter2 == m_criteriaProgress.end() )
cProgress = true;
data << int32(-1);
@@ -1935,7 +1935,7 @@ AchievementCriteriaEntryList const& AchievementGlobalMgr::GetAchievementCriteria
void AchievementGlobalMgr::LoadAchievementCriteriaList()
{
- if(sAchievementCriteriaStore.GetNumRows()==0)
+ if (sAchievementCriteriaStore.GetNumRows()==0)
{
barGoLink bar(1);
bar.step();
@@ -1951,7 +1951,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
bar.step();
AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId);
- if(!criteria)
+ if (!criteria)
continue;
m_AchievementCriteriasByType[criteria->requiredType].push_back(criteria);
@@ -1964,7 +1964,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
void AchievementGlobalMgr::LoadAchievementReferenceList()
{
- if(sAchievementStore.GetNumRows()==0)
+ if (sAchievementStore.GetNumRows()==0)
{
barGoLink bar(1);
bar.step();
@@ -1981,7 +1981,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
bar.step();
AchievementEntry const* achievement = sAchievementStore.LookupEntry(entryId);
- if(!achievement || !achievement->refAchievement)
+ if (!achievement || !achievement->refAchievement)
continue;
m_AchievementListByReferencedId[achievement->refAchievement].push_back(achievement);
@@ -1998,7 +1998,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT criteria_id, type, value1, value2 FROM achievement_criteria_data");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
bar.step();
@@ -2051,13 +2051,13 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId)
{
AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId);
- if(!criteria)
+ if (!criteria)
continue;
switch(criteria->requiredType)
{
case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG:
- if(!criteria->win_bg.additionalRequirement1_type)
+ if (!criteria->win_bg.additionalRequirement1_type)
continue;
break;
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE:
@@ -2065,7 +2065,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST:
{
AchievementEntry const* achievement = sAchievementStore.LookupEntry(criteria->referredAchievement);
- if(!achievement)
+ if (!achievement)
continue;
// exist many achievements with this criteria, use at this moment hardcoded check to skil simple case
@@ -2087,30 +2087,30 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: // any cases
break;
case ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA: // need skip generic cases
- if(criteria->win_rated_arena.flag!=ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE)
+ if (criteria->win_rated_arena.flag!=ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE)
continue;
break;
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM: // any cases
break;
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: // need skip generic cases
- if(criteria->do_emote.count==0)
+ if (criteria->do_emote.count==0)
continue;
break;
case ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL: // skip statistics
- if(criteria->win_duel.duelCount==0)
+ if (criteria->win_duel.duelCount==0)
continue;
break;
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: // any cases
break;
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: // need skip generic cases
- if(criteria->loot_type.lootTypeCount!=1)
+ if (criteria->loot_type.lootTypeCount!=1)
continue;
break;
default: // type not use DB data, ignore
continue;
}
- if(!GetCriteriaDataSet(criteria))
+ if (!GetCriteriaDataSet(criteria))
sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement);
}
@@ -2122,7 +2122,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
{
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT achievement FROM character_achievement GROUP BY achievement");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
bar.step();
@@ -2139,7 +2139,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
Field *fields = result->Fetch();
uint32 achievement_id = fields[0].GetUInt32();
- if(!sAchievementStore.LookupEntry(achievement_id))
+ if (!sAchievementStore.LookupEntry(achievement_id))
{
// we will remove not existed achievement for all characters
sLog.outError("Not existed achievement %u data removed from table `character_achievement`.",achievement_id);
@@ -2161,7 +2161,7 @@ void AchievementGlobalMgr::LoadRewards()
// 0 1 2 3 4 5 6
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, title_A, title_H, item, sender, subject, text FROM achievement_reward");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
@@ -2292,7 +2292,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
uint32 entry = fields[0].GetUInt32();
- if(m_achievementRewards.find(entry)==m_achievementRewards.end())
+ if (m_achievementRewards.find(entry)==m_achievementRewards.end())
{
sLog.outErrorDb( "Table `locales_achievement_reward` (Entry: %u) has locale strings for not existed achievement reward .", entry);
continue;
@@ -2303,24 +2303,24 @@ void AchievementGlobalMgr::LoadRewardLocales()
for (int i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[1+2*(i-1)].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = objmgr.GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.subject.size() <= size_t(idx))
+ if (data.subject.size() <= size_t(idx))
data.subject.resize(idx+1);
data.subject[idx] = str;
}
}
str = fields[1+2*(i-1)+1].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = objmgr.GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.text.size() <= size_t(idx))
+ if (data.text.size() <= size_t(idx))
data.text.resize(idx+1);
data.text[idx] = str;
diff --git a/src/game/AddonMgr.cpp b/src/game/AddonMgr.cpp
index a8f914b69ae..f0b5ae40891 100644
--- a/src/game/AddonMgr.cpp
+++ b/src/game/AddonMgr.cpp
@@ -43,7 +43,7 @@ AddonMgr::~AddonMgr()
void AddonMgr::LoadFromDB()
{
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name, crc FROM addons");
- if(!result)
+ if (!result)
{
sLog.outErrorDb("The table `addons` is empty");
return;
diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp
index dd7201ecf52..da46ab8ce50 100644
--- a/src/game/ArenaTeam.cpp
+++ b/src/game/ArenaTeam.cpp
@@ -28,7 +28,7 @@ void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot)
personal_rating = 0;
else
personal_rating += mod;
- if(plr)
+ if (plr)
plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING, personal_rating);
}
@@ -62,9 +62,9 @@ ArenaTeam::~ArenaTeam()
bool ArenaTeam::Create(uint64 captainGuid, uint32 type, std::string ArenaTeamName)
{
- if(!objmgr.GetPlayer(captainGuid)) // player not exist
+ if (!objmgr.GetPlayer(captainGuid)) // player not exist
return false;
- if(objmgr.GetArenaTeamByName(ArenaTeamName)) // arena team with this name already exist
+ if (objmgr.GetArenaTeamByName(ArenaTeamName)) // arena team with this name already exist
return false;
sLog.outDebug("GUILD: creating arena team %s to leader: %u", ArenaTeamName.c_str(), GUID_LOPART(captainGuid));
@@ -100,13 +100,13 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
uint8 plClass;
// arena team is full (can't have more than type * 2 players!)
- if(GetMembersSize() >= GetType() * 2)
+ if (GetMembersSize() >= GetType() * 2)
return false;
Player *pl = objmgr.GetPlayer(PlayerGuid);
- if(pl)
+ if (pl)
{
- if(pl->GetArenaTeamId(GetSlot()))
+ if (pl->GetArenaTeamId(GetSlot()))
{
sLog.outError("Arena::AddMember() : player already in this sized team");
return false;
@@ -119,14 +119,14 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
{
// 0 1
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name, class FROM characters WHERE guid='%u'", GUID_LOPART(PlayerGuid));
- if(!result)
+ if (!result)
return false;
plName = (*result)[0].GetCppString();
plClass = (*result)[1].GetUInt8();
// check if player already in arenateam of that size
- if(Player::GetArenaTeamIdFromDB(PlayerGuid, GetType()) != 0)
+ if (Player::GetArenaTeamIdFromDB(PlayerGuid, GetType()) != 0)
{
sLog.outError("Arena::AddMember() : player already in this sized team");
return false;
@@ -162,14 +162,14 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
CharacterDatabase.PExecute("INSERT INTO arena_team_member (arenateamid, guid, personal_rating) VALUES ('%u', '%u', '%u')", m_TeamId, GUID_LOPART(newmember.guid), newmember.personal_rating );
- if(pl)
+ if (pl)
{
pl->SetInArenaTeam(m_TeamId, GetSlot(), GetType());
pl->SetArenaTeamIdInvited(0);
pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING, newmember.personal_rating );
// hide promote/remove buttons
- if(m_CaptainGuid != PlayerGuid)
+ if (m_CaptainGuid != PlayerGuid)
pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 1);
sLog.outArena("Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", pl->GetName(), pl->GetGUIDLow(), GetType(), GetId());
}
@@ -178,7 +178,7 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
bool ArenaTeam::LoadArenaTeamFromDB(QueryResult_AutoPtr arenaTeamDataResult)
{
- if(!arenaTeamDataResult)
+ if (!arenaTeamDataResult)
return false;
Field *fields = arenaTeamDataResult->Fetch();
@@ -205,7 +205,7 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult_AutoPtr arenaTeamDataResult)
bool ArenaTeam::LoadMembersFromDB(QueryResult_AutoPtr arenaTeamMembersResult)
{
- if(!arenaTeamMembersResult)
+ if (!arenaTeamMembersResult)
return false;
bool captainPresentInTeam = false;
@@ -253,7 +253,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult_AutoPtr arenaTeamMembersResult)
m_members.push_back(newmember);
}while (arenaTeamMembersResult->NextRow());
- if(Empty() || !captainPresentInTeam)
+ if (Empty() || !captainPresentInTeam)
{
// arena team is empty or captain is not in team, delete from db
sLog.outErrorDb("ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", m_TeamId);
@@ -267,7 +267,7 @@ void ArenaTeam::SetCaptain(const uint64& guid)
{
// disable remove/promote buttons
Player *oldcaptain = objmgr.GetPlayer(GetCaptain());
- if(oldcaptain)
+ if (oldcaptain)
oldcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 1);
// set new captain
@@ -278,7 +278,7 @@ void ArenaTeam::SetCaptain(const uint64& guid)
// enable remove/promote buttons
Player *newcaptain = objmgr.GetPlayer(guid);
- if(newcaptain)
+ if (newcaptain)
{
newcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 0);
sLog.outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", oldcaptain->GetName(), oldcaptain->GetGUIDLow(), newcaptain->GetName(), newcaptain->GetGUIDLow(), GetId(), GetType());
@@ -296,7 +296,7 @@ void ArenaTeam::DelMember(uint64 guid)
}
}
- if(Player *player = objmgr.GetPlayer(guid))
+ if (Player *player = objmgr.GetPlayer(guid))
{
player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0);
// delete all info regarding this team
@@ -325,7 +325,7 @@ void ArenaTeam::Disband(WorldSession *session)
if (session)
{
- if(Player *player = session->GetPlayer())
+ if (Player *player = session->GetPlayer())
sLog.outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
}
@@ -364,7 +364,7 @@ void ArenaTeam::Roster(WorldSession *session)
data << uint32(itr->games_season); // played this season
data << uint32(itr->wins_season); // wins this season
data << uint32(itr->personal_rating); // personal rating
- if(unk308)
+ if (unk308)
{
data << float(0.0); // 308 unk
data << float(0.0); // 308 unk
@@ -410,7 +410,7 @@ void ArenaTeam::NotifyStatsChanged()
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
Player * plr = objmgr.GetPlayer(itr->guid);
- if(plr)
+ if (plr)
Stats(plr->GetSession());
}
}
@@ -418,7 +418,7 @@ void ArenaTeam::NotifyStatsChanged()
void ArenaTeam::InspectStats(WorldSession *session, uint64 guid)
{
ArenaTeamMember* member = GetMember(guid);
- if(!member)
+ if (!member)
return;
WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8+1+4*6);
@@ -483,7 +483,7 @@ void ArenaTeam::BroadcastPacket(WorldPacket *packet)
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
Player *player = objmgr.GetPlayer(itr->guid);
- if(player)
+ if (player)
player->GetSession()->SendPacket(packet);
}
}
@@ -505,7 +505,7 @@ uint8 ArenaTeam::GetSlotByType( uint32 type )
bool ArenaTeam::HaveMember( const uint64& guid ) const
{
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
- if(itr->guid == guid)
+ if (itr->guid == guid)
return true;
return false;
@@ -605,7 +605,7 @@ void ArenaTeam::MemberLost(Player * plr, uint32 againstRating)
// called for each participant of a match after losing
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
- if(itr->guid == plr->GetGUID())
+ if (itr->guid == plr->GetGUID())
{
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, againstRating);
@@ -629,7 +629,7 @@ void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstRating)
// called for offline player after ending rated arena match!
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
- if(itr->guid == guid)
+ if (itr->guid == guid)
{
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, againstRating);
@@ -653,7 +653,7 @@ void ArenaTeam::MemberWon(Player * plr, uint32 againstRating)
// called for each participant after winning a match
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
- if(itr->guid == plr->GetGUID())
+ if (itr->guid == plr->GetGUID())
{
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, againstRating);
diff --git a/src/game/ArenaTeam.h b/src/game/ArenaTeam.h
index ffbb36c5d44..e270beca4fc 100644
--- a/src/game/ArenaTeam.h
+++ b/src/game/ArenaTeam.h
@@ -156,7 +156,7 @@ class ArenaTeam
ArenaTeamMember* GetMember(const uint64& guid)
{
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
- if(itr->guid == guid)
+ if (itr->guid == guid)
return &(*itr);
return NULL;
@@ -165,7 +165,7 @@ class ArenaTeam
ArenaTeamMember* GetMember(const std::string& name)
{
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
- if(itr->name == name)
+ if (itr->name == name)
return &(*itr);
return NULL;
diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp
index a3de4097a8f..3e25cf07985 100644
--- a/src/game/ArenaTeamHandler.cpp
+++ b/src/game/ArenaTeamHandler.cpp
@@ -37,13 +37,13 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recv_data)
recv_data >> guid;
sLog.outDebug("Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)));
- if(Player *plr = objmgr.GetPlayer(guid))
+ if (Player *plr = objmgr.GetPlayer(guid))
{
for (uint8 i = 0; i < MAX_ARENA_SLOT; ++i)
{
- if(uint32 a_id = plr->GetArenaTeamId(i))
+ if (uint32 a_id = plr->GetArenaTeamId(i))
{
- if(ArenaTeam *at = objmgr.GetArenaTeamById(a_id))
+ if (ArenaTeam *at = objmgr.GetArenaTeamById(a_id))
at->InspectStats(this, plr->GetGUID());
}
}
@@ -57,7 +57,7 @@ void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recv_data)
uint32 ArenaTeamId;
recv_data >> ArenaTeamId;
- if(ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId))
+ if (ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId))
{
arenateam->Query(this);
arenateam->Stats(this);
@@ -71,7 +71,7 @@ void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recv_data)
uint32 ArenaTeamId; // arena team id
recv_data >> ArenaTeamId;
- if(ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId))
+ if (ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId))
arenateam->Roster(this);
}
@@ -86,35 +86,35 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data)
recv_data >> ArenaTeamId >> Invitedname;
- if(!Invitedname.empty())
+ if (!Invitedname.empty())
{
- if(!normalizePlayerName(Invitedname))
+ if (!normalizePlayerName(Invitedname))
return;
player = ObjectAccessor::Instance().FindPlayerByName(Invitedname.c_str());
}
- if(!player)
+ if (!player)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", Invitedname, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
- if(player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
+ if (player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", player->GetName(), ERR_ARENA_TEAM_PLAYER_TO_LOW);
return;
}
ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId);
- if(!arenateam)
+ if (!arenateam)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM);
return;
}
// OK result but not send invite
- if(player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
+ if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
return;
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != GetPlayer()->GetTeam())
@@ -123,19 +123,19 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data)
return;
}
- if(player->GetArenaTeamId(arenateam->GetSlot()))
+ if (player->GetArenaTeamId(arenateam->GetSlot()))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", player->GetName(), ERR_ALREADY_IN_ARENA_TEAM_S);
return;
}
- if(player->GetArenaTeamIdInvited())
+ if (player->GetArenaTeamIdInvited())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S);
return;
}
- if(arenateam->GetMembersSize() >= arenateam->GetType() * 2)
+ if (arenateam->GetMembersSize() >= arenateam->GetType() * 2)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,arenateam->GetName(),"",ERR_ARENA_TEAM_FULL);
return;
@@ -158,10 +158,10 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/)
sLog.outDebug("CMSG_ARENA_TEAM_ACCEPT"); // empty opcode
ArenaTeam *at = objmgr.GetArenaTeamById(_player->GetArenaTeamIdInvited());
- if(!at)
+ if (!at)
return;
- if(_player->GetArenaTeamId(at->GetSlot()))
+ if (_player->GetArenaTeamId(at->GetSlot()))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ALREADY_IN_ARENA_TEAM); // already in arena team that size
return;
@@ -173,7 +173,7 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/)
return;
}
- if(!at->AddMember(_player->GetGUID()))
+ if (!at->AddMember(_player->GetGUID()))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ARENA_TEAM_INTERNAL);// arena team not found
return;
@@ -200,10 +200,10 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
recv_data >> ArenaTeamId;
ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId);
- if(!at)
+ if (!at)
return;
- if(_player->GetGUID() == at->GetCaptain() && at->GetMembersSize() > 1)
+ if (_player->GetGUID() == at->GetCaptain() && at->GetMembersSize() > 1)
{
// check for correctness
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
@@ -211,7 +211,7 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
}
// arena team has only one member (=captain)
- if(_player->GetGUID() == at->GetCaptain())
+ if (_player->GetGUID() == at->GetCaptain())
{
at->Disband(this);
delete at;
@@ -236,12 +236,12 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recv_data)
uint32 ArenaTeamId; // arena team id
recv_data >> ArenaTeamId;
- if(ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId))
+ if (ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId))
{
- if(at->GetCaptain() != _player->GetGUID())
+ if (at->GetCaptain() != _player->GetGUID())
return;
- if(at->IsFighting())
+ if (at->IsFighting())
return;
at->Disband(this);
@@ -260,26 +260,26 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recv_data)
recv_data >> name;
ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId);
- if(!at) // arena team not found
+ if (!at) // arena team not found
return;
- if(at->GetCaptain() != _player->GetGUID())
+ if (at->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
- if(!normalizePlayerName(name))
+ if (!normalizePlayerName(name))
return;
ArenaTeamMember* member = at->GetMember(name);
- if(!member) // member not found
+ if (!member) // member not found
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
- if(at->GetCaptain() == member->guid)
+ if (at->GetCaptain() == member->guid)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
@@ -304,26 +304,26 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recv_data)
recv_data >> name;
ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId);
- if(!at) // arena team not found
+ if (!at) // arena team not found
return;
- if(at->GetCaptain() != _player->GetGUID())
+ if (at->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
- if(!normalizePlayerName(name))
+ if (!normalizePlayerName(name))
return;
ArenaTeamMember* member = at->GetMember(name);
- if(!member) // member not found
+ if (!member) // member not found
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
- if(at->GetCaptain() == member->guid) // target player already captain
+ if (at->GetCaptain() == member->guid) // target player already captain
return;
at->SetCaptain(member->guid);
@@ -374,7 +374,7 @@ void WorldSession::SendNotInArenaTeamPacket(uint8 type)
WorldPacket data(SMSG_ARENA_ERROR, 4+1); // 886 - You are not in a %uv%u arena team
uint32 unk = 0;
data << uint32(unk); // unk(0)
- if(!unk)
+ if (!unk)
data << uint8(type); // team type (2=2v2,3=3v3,5=5v5), can be used for custom types...
SendPacket(&data);
}
diff --git a/src/game/Bag.cpp b/src/game/Bag.cpp
index e71bfc02fd0..c56e0c71007 100644
--- a/src/game/Bag.cpp
+++ b/src/game/Bag.cpp
@@ -41,7 +41,7 @@ Bag::~Bag()
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
if (Item *item = m_bagslot[i])
{
- if(item->IsInWorld())
+ if (item->IsInWorld())
{
sLog.outCrash("Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.",
item->GetEntry(), (uint32)item->GetSlot(), (uint32)item->GetBagSlot(),
@@ -57,14 +57,14 @@ void Bag::AddToWorld()
Item::AddToWorld();
for (uint32 i = 0; i < GetBagSize(); ++i)
- if(m_bagslot[i])
+ if (m_bagslot[i])
m_bagslot[i]->AddToWorld();
}
void Bag::RemoveFromWorld()
{
for (uint32 i = 0; i < GetBagSize(); ++i)
- if(m_bagslot[i])
+ if (m_bagslot[i])
m_bagslot[i]->RemoveFromWorld();
Item::RemoveFromWorld();
@@ -74,7 +74,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
{
ItemPrototype const * itemProto = objmgr.GetItemPrototype(itemid);
- if(!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE)
+ if (!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE)
return false;
Object::_Create( guidlow, 0, HIGHGUID_CONTAINER );
@@ -110,7 +110,7 @@ void Bag::SaveToDB()
bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult_AutoPtr result)
{
- if(!Item::LoadFromDB(guid, owner_guid, result))
+ if (!Item::LoadFromDB(guid, owner_guid, result))
return false;
// cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
@@ -177,7 +177,7 @@ void Bag::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) co
Item::BuildCreateUpdateBlockForPlayer( data, target );
for (uint32 i = 0; i < GetBagSize(); ++i)
- if(m_bagslot[i])
+ if (m_bagslot[i])
m_bagslot[i]->BuildCreateUpdateBlockForPlayer( data, target );
}
@@ -198,16 +198,16 @@ uint32 Bag::GetItemCount( uint32 item, Item* eItem ) const
for (uint32 i=0; i < GetBagSize(); ++i)
{
pItem = m_bagslot[i];
- if( pItem && pItem != eItem && pItem->GetEntry() == item )
+ if ( pItem && pItem != eItem && pItem->GetEntry() == item )
count += pItem->GetCount();
}
- if(eItem && eItem->GetProto()->GemProperties)
+ if (eItem && eItem->GetProto()->GemProperties)
{
for (uint32 i=0; i < GetBagSize(); ++i)
{
pItem = m_bagslot[i];
- if( pItem && pItem != eItem && pItem->GetProto()->Socket[0].Color )
+ if ( pItem && pItem != eItem && pItem->GetProto()->Socket[0].Color )
count += pItem->GetGemCountWithID(item);
}
}
@@ -218,8 +218,8 @@ uint32 Bag::GetItemCount( uint32 item, Item* eItem ) const
uint8 Bag::GetSlotByItemGUID(uint64 guid) const
{
for (uint32 i = 0; i < GetBagSize(); ++i)
- if(m_bagslot[i] != 0)
- if(m_bagslot[i]->GetGUID() == guid)
+ if (m_bagslot[i] != 0)
+ if (m_bagslot[i]->GetGUID() == guid)
return i;
return NULL_SLOT;
@@ -227,7 +227,7 @@ uint8 Bag::GetSlotByItemGUID(uint64 guid) const
Item* Bag::GetItemByPos( uint8 slot ) const
{
- if( slot < GetBagSize() )
+ if ( slot < GetBagSize() )
return m_bagslot[slot];
return NULL;
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp
index caa9549be36..c4a37c51483 100644
--- a/src/game/BattleGround.cpp
+++ b/src/game/BattleGround.cpp
@@ -530,7 +530,7 @@ void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *
continue;
uint32 team = itr->second.Team;
- if(!team) team = plr->GetTeam();
+ if (!team) team = plr->GetTeam();
if (team == TeamID)
plr->GetSession()->SendPacket(packet);
@@ -561,7 +561,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
}
uint32 team = itr->second.Team;
- if(!team) team = plr->GetTeam();
+ if (!team) team = plr->GetTeam();
if (team == TeamID)
{
@@ -586,7 +586,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
}
uint32 team = itr->second.Team;
- if(!team) team = plr->GetTeam();
+ if (!team) team = plr->GetTeam();
if (team == TeamID)
plr->CastSpell(plr, SpellID, true);
@@ -599,7 +599,7 @@ void BattleGround::YellToAll(Creature* creature, const char* text, uint32 langua
{
WorldPacket data(SMSG_MESSAGECHAT, 200);
Player *plr = objmgr.GetPlayer(itr->first);
- if(!plr)
+ if (!plr)
{
sLog.outError("BattleGround: Player " UI64FMTD " not found!", itr->first);
continue;
@@ -624,7 +624,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID)
}
uint32 team = itr->second.Team;
- if(!team) team = plr->GetTeam();
+ if (!team) team = plr->GetTeam();
if (team == TeamID)
UpdatePlayerScore(plr, SCORE_BONUS_HONOR, Honor);
@@ -651,7 +651,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
}
uint32 team = itr->second.Team;
- if(!team) team = plr->GetTeam();
+ if (!team) team = plr->GetTeam();
if (team == TeamID)
plr->GetReputationMgr().ModifyReputation(factionEntry, Reputation);
@@ -755,7 +755,7 @@ void BattleGround::EndBattleGround(uint32 winner)
}
// should remove spirit of redemption
- if(plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
+ if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if (!plr->isAlive())
@@ -771,7 +771,7 @@ void BattleGround::EndBattleGround(uint32 winner)
}
//this line is obsolete - team is set ALWAYS
- //if(!team) team = plr->GetTeam();
+ //if (!team) team = plr->GetTeam();
// per player calculation
if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
@@ -800,7 +800,7 @@ void BattleGround::EndBattleGround(uint32 winner)
RewardQuestComplete(plr);
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1);
}
- else if(winner)
+ else if (winner)
RewardMark(plr,ITEM_LOSER_COUNT);
plr->SetHealth(plr->GetMaxHealth());
@@ -892,7 +892,7 @@ void BattleGround::RewardSpellCast(Player *plr, uint32 spell_id)
return;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outError("Battleground reward casting spell %u not exist.",spell_id);
return;
@@ -911,16 +911,16 @@ void BattleGround::RewardItem(Player *plr, uint32 item_id, uint32 count)
uint32 no_space_count = 0;
uint8 msg = plr->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, item_id, count, &no_space_count );
- if( msg == EQUIP_ERR_ITEM_NOT_FOUND)
+ if ( msg == EQUIP_ERR_ITEM_NOT_FOUND)
{
sLog.outErrorDb("Battleground reward item (Entry %u) not exist in `item_template`.",item_id);
return;
}
- if( msg != EQUIP_ERR_OK ) // convert to possible store amount
+ if ( msg != EQUIP_ERR_OK ) // convert to possible store amount
count -= no_space_count;
- if( count != 0 && !dest.empty()) // can add some
+ if ( count != 0 && !dest.empty()) // can add some
if (Item* item = plr->StoreNewItem( dest, item_id, true, 0))
plr->SendNewItem(item,count,true,false);
@@ -1021,10 +1021,10 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
Player *plr = objmgr.GetPlayer(guid);
// should remove spirit of redemption
- if(plr && plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
+ if (plr && plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
- if(plr && !plr->isAlive()) // resurrect on exit
+ if (plr && !plr->isAlive()) // resurrect on exit
{
plr->ResurrectPlayer(1.0f);
plr->SpawnCorpseBones();
@@ -1032,7 +1032,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
RemovePlayer(plr, guid); // BG subclass specific code
- if(participant) // if the player was a match participant, remove auras, calc rating, update queue
+ if (participant) // if the player was a match participant, remove auras, calc rating, update queue
{
BattleGroundTypeId bgTypeId = GetTypeID();
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
@@ -1040,7 +1040,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
{
plr->ClearAfkReports();
- if(!team) team = plr->GetTeam();
+ if (!team) team = plr->GetTeam();
// if arena, remove the specific arena auras
if (isArena())
@@ -1087,7 +1087,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
// remove from raid group if player is member
if (Group *group = GetBgRaid(team))
{
- if( !group->RemoveMember(guid, 0) ) // group was disbanded
+ if ( !group->RemoveMember(guid, 0) ) // group was disbanded
{
SetBgRaid(team, NULL);
delete group;
@@ -1163,7 +1163,7 @@ void BattleGround::StartBattleGround()
// This must be done here, because we need to have already invited some players when first BG::Update() method is executed
// and it doesn't matter if we call StartBattleGround() more times, because m_BattleGrounds is a map and instance id never changes
sBattleGroundMgr.AddBattleGround(GetInstanceID(), GetTypeID(), this);
- if(m_IsRated)
+ if (m_IsRated)
sLog.outArena("Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]);
}
@@ -1204,7 +1204,7 @@ void BattleGround::AddPlayer(Player *plr)
plr->RemoveArenaSpellCooldowns();
plr->RemoveArenaAuras();
plr->RemoveArenaEnchantments(TEMP_ENCHANTMENT_SLOT);
- if(team == ALLIANCE) // gold
+ if (team == ALLIANCE) // gold
{
if (plr->GetTeam() == HORDE)
plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG,true);
@@ -1222,7 +1222,7 @@ void BattleGround::AddPlayer(Player *plr)
plr->DestroyConjuredItems(true);
plr->UnsummonPetTemporaryIfAny();
- if(GetStatus() == STATUS_WAIT_JOIN) // not started yet
+ if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
{
plr->CastSpell(plr, SPELL_ARENA_PREPARATION, true);
@@ -1232,7 +1232,7 @@ void BattleGround::AddPlayer(Player *plr)
}
else
{
- if(GetStatus() == STATUS_WAIT_JOIN) // not started yet
+ if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells.
}
@@ -1251,7 +1251,7 @@ void BattleGround::AddPlayer(Player *plr)
void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team)
{
Group* group = GetBgRaid(team);
- if(!group) // first player joined
+ if (!group) // first player joined
{
group = new Group;
SetBgRaid(team, group);
@@ -1368,7 +1368,7 @@ uint32 BattleGround::GetFreeSlotsForTeam(uint32 Team) const
if (otherTeam == GetInvitedCount(Team))
diff = 1;
// allow join more ppl if the other side has more players
- else if(otherTeam > GetInvitedCount(Team))
+ else if (otherTeam > GetInvitedCount(Team))
diff = otherTeam - GetInvitedCount(Team);
// difference based on max players per team (don't allow inviting more)
@@ -1406,7 +1406,7 @@ void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
//this procedure is called from virtual function implemented in bg subclass
BattleGroundScoreMap::const_iterator itr = m_PlayerScores.find(Source->GetGUID());
- if(itr == m_PlayerScores.end()) // player not found...
+ if (itr == m_PlayerScores.end()) // player not found...
return;
switch(type)
@@ -1484,7 +1484,7 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float
// and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created
// so we must create it specific for this instance
GameObject * go = new GameObject;
- if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry, GetBgMap(),
+ if (!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry, GetBgMap(),
PHASEMASK_NORMAL, x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,GO_STATE_READY))
{
sLog.outErrorDb("Gameobject template %u not found in database! BattleGround not created!", entry);
@@ -1559,7 +1559,7 @@ void BattleGround::DoorOpen(uint32 type)
GameObject* BattleGround::GetBGObject(uint32 type)
{
GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]);
- if(!obj)
+ if (!obj)
sLog.outError("couldn't get gameobject %i",type);
return obj;
}
@@ -1567,7 +1567,7 @@ GameObject* BattleGround::GetBGObject(uint32 type)
Creature* BattleGround::GetBGCreature(uint32 type)
{
Creature *creature = GetBgMap()->GetCreature(m_BgCreatures[type]);
- if(!creature)
+ if (!creature)
sLog.outError("couldn't get creature %i",type);
return creature;
}
@@ -1887,7 +1887,7 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const
void BattleGround::SetHoliday(bool is_holiday)
{
- if(is_holiday)
+ if (is_holiday)
m_HonorMode = BG_HOLIDAY;
else
m_HonorMode = BG_NORMAL;
@@ -1896,7 +1896,7 @@ void BattleGround::SetHoliday(bool is_holiday)
int32 BattleGround::GetObjectType(uint64 guid)
{
for (uint32 i = 0; i < m_BgObjects.size(); ++i)
- if(m_BgObjects[i] == guid)
+ if (m_BgObjects[i] == guid)
return i;
sLog.outError("BattleGround: cheating? a player used a gameobject which isnt supposed to be a usable object!");
return -1;
@@ -1923,8 +1923,8 @@ void BattleGround::UpdateArenaWorldState()
void BattleGround::SetBgRaid( uint32 TeamID, Group *bg_raid )
{
Group* &old_raid = TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE];
- if(old_raid) old_raid->SetBattlegroundGroup(NULL);
- if(bg_raid) bg_raid->SetBattlegroundGroup(this);
+ if (old_raid) old_raid->SetBattlegroundGroup(NULL);
+ if (bg_raid) bg_raid->SetBattlegroundGroup(this);
old_raid = bg_raid;
}
diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp
index b400ebc4c9e..e4aa99e4c8d 100644
--- a/src/game/BattleGroundAB.cpp
+++ b/src/game/BattleGroundAB.cpp
@@ -668,7 +668,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
void BattleGroundAB::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
- if( itr == m_PlayerScores.end() ) // player not found...
+ if ( itr == m_PlayerScores.end() ) // player not found...
return;
switch(type)
diff --git a/src/game/BattleGroundABG.cpp b/src/game/BattleGroundABG.cpp
index f0ae47482f1..434fed6f119 100644
--- a/src/game/BattleGroundABG.cpp
+++ b/src/game/BattleGroundABG.cpp
@@ -74,7 +74,7 @@ void BattleGroundABG::UpdatePlayerScore(Player* Source, uint32 type, uint32 valu
std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
- if(itr == m_PlayerScores.end()) // player not found...
+ if (itr == m_PlayerScores.end()) // player not found...
return;
BattleGround::UpdatePlayerScore(Source,type,value);
diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp
index 4ab1cc3bb91..4a4e30ab329 100644
--- a/src/game/BattleGroundAV.cpp
+++ b/src/game/BattleGroundAV.cpp
@@ -51,7 +51,7 @@ const uint16 BattleGroundAV::GetBonusHonor(uint8 kills) //TODO: move this functi
void BattleGroundAV::HandleKillPlayer(Player *player, Player *killer)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
BattleGround::HandleKillPlayer(player, killer);
@@ -61,10 +61,10 @@ void BattleGroundAV::HandleKillPlayer(Player *player, Player *killer)
void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
{
sLog.outDebug("bg_av HandleKillUnit %i",unit->GetEntry());
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint32 entry = unit->GetEntry();
- if(entry == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0])
+ if (entry == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0])
{
CastSpellOnTeam(23658,HORDE); //this is a spell which finishes a quest where a player has to kill the boss
RewardReputationToTeam(729,BG_AV_REP_BOSS,HORDE);
@@ -78,9 +78,9 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_BOSS),ALLIANCE);
EndBattleGround(ALLIANCE);
}
- else if(entry == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0])
+ else if (entry == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0])
{
- if(!m_CaptainAlive[0])
+ if (!m_CaptainAlive[0])
{
sLog.outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
return;
@@ -93,13 +93,13 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
for (uint8 i=0; i<=9; i++)
SpawnBGObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+i,RESPAWN_IMMEDIATELY);
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
- if(creature)
+ if (creature)
YellToAll(creature,GetTrinityString(LANG_BG_AV_A_CAPTAIN_DEAD),LANG_UNIVERSAL);
}
else if ( entry == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0] )
{
- if(!m_CaptainAlive[1])
+ if (!m_CaptainAlive[1])
{
sLog.outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
return;
@@ -112,7 +112,7 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
for (uint8 i=0; i<=9; i++)
SpawnBGObject(BG_AV_OBJECT_BURN_BUILDING_HORDE+i,RESPAWN_IMMEDIATELY);
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
- if(creature)
+ if (creature)
YellToAll(creature,GetTrinityString(LANG_BG_AV_H_CAPTAIN_DEAD),LANG_UNIVERSAL);
}
else if ( entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_N_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_A_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_H_4][0])
@@ -135,7 +135,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
case AV_QUEST_H_SCRAPS1:
case AV_QUEST_H_SCRAPS2:
m_Team_QuestStatus[team][0]+=20;
- if(m_Team_QuestStatus[team][0] == 500 || m_Team_QuestStatus[team][0] == 1000 || m_Team_QuestStatus[team][0] == 1500) //25,50,75 turn ins
+ if (m_Team_QuestStatus[team][0] == 500 || m_Team_QuestStatus[team][0] == 1000 || m_Team_QuestStatus[team][0] == 1500) //25,50,75 turn ins
{
sLog.outDebug("BG_AV Quest %i completed starting with unit upgrading..",questid);
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
@@ -151,21 +151,21 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
case AV_QUEST_H_COMMANDER1:
m_Team_QuestStatus[team][1]++;
RewardReputationToTeam(team,1,player->GetTeam());
- if(m_Team_QuestStatus[team][1] == 30)
+ if (m_Team_QuestStatus[team][1] == 30)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
break;
case AV_QUEST_A_COMMANDER2:
case AV_QUEST_H_COMMANDER2:
m_Team_QuestStatus[team][2]++;
RewardReputationToTeam(team,1,player->GetTeam());
- if(m_Team_QuestStatus[team][2] == 60)
+ if (m_Team_QuestStatus[team][2] == 60)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
break;
case AV_QUEST_A_COMMANDER3:
case AV_QUEST_H_COMMANDER3:
m_Team_QuestStatus[team][3]++;
RewardReputationToTeam(team,1,player->GetTeam());
- if(m_Team_QuestStatus[team][1] == 120)
+ if (m_Team_QuestStatus[team][1] == 120)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
break;
case AV_QUEST_A_BOSS1:
@@ -174,46 +174,46 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
case AV_QUEST_A_BOSS2:
case AV_QUEST_H_BOSS2:
m_Team_QuestStatus[team][4]++;
- if(m_Team_QuestStatus[team][4] >= 200)
+ if (m_Team_QuestStatus[team][4] >= 200)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
break;
case AV_QUEST_A_NEAR_MINE:
case AV_QUEST_H_NEAR_MINE:
m_Team_QuestStatus[team][5]++;
- if(m_Team_QuestStatus[team][5] == 28)
+ if (m_Team_QuestStatus[team][5] == 28)
{
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
- if(m_Team_QuestStatus[team][6] == 7)
+ if (m_Team_QuestStatus[team][6] == 7)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here - ground assault ready",questid);
}
break;
case AV_QUEST_A_OTHER_MINE:
case AV_QUEST_H_OTHER_MINE:
m_Team_QuestStatus[team][6]++;
- if(m_Team_QuestStatus[team][6] == 7)
+ if (m_Team_QuestStatus[team][6] == 7)
{
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
- if(m_Team_QuestStatus[team][5] == 20)
+ if (m_Team_QuestStatus[team][5] == 20)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here - ground assault ready",questid);
}
break;
case AV_QUEST_A_RIDER_HIDE:
case AV_QUEST_H_RIDER_HIDE:
m_Team_QuestStatus[team][7]++;
- if(m_Team_QuestStatus[team][7] == 25)
+ if (m_Team_QuestStatus[team][7] == 25)
{
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
- if(m_Team_QuestStatus[team][8] == 25)
+ if (m_Team_QuestStatus[team][8] == 25)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here - rider assault ready",questid);
}
break;
case AV_QUEST_A_RIDER_TAME:
case AV_QUEST_H_RIDER_TAME:
m_Team_QuestStatus[team][8]++;
- if(m_Team_QuestStatus[team][8] == 25)
+ if (m_Team_QuestStatus[team][8] == 25)
{
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
- if(m_Team_QuestStatus[team][7] == 25)
+ if (m_Team_QuestStatus[team][7] == 25)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here - rider assault ready",questid);
}
break;
@@ -231,14 +231,14 @@ void BattleGroundAV::UpdateScore(uint16 team, int16 points )
m_Team_Scores[teamindex] += points;
UpdateWorldState(((teamindex==BG_TEAM_HORDE)?AV_Horde_Score:AV_Alliance_Score), m_Team_Scores[teamindex]);
- if( points < 0)
+ if ( points < 0)
{
- if( m_Team_Scores[teamindex] < 1)
+ if ( m_Team_Scores[teamindex] < 1)
{
m_Team_Scores[teamindex]=0;
EndBattleGround(((teamindex==BG_TEAM_HORDE)?ALLIANCE:HORDE));
}
- else if(!m_IsInformedNearVictory[teamindex] && m_Team_Scores[teamindex] < SEND_MSG_NEAR_LOSE)
+ else if (!m_IsInformedNearVictory[teamindex] && m_Team_Scores[teamindex] < SEND_MSG_NEAR_LOSE)
{
SendMessageToAll(teamindex==BG_TEAM_HORDE?LANG_BG_AV_H_NEAR_LOSE:LANG_BG_AV_A_NEAR_LOSE, teamindex==BG_TEAM_HORDE ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE);
PlaySoundToAll(AV_SOUND_NEAR_VICTORY);
@@ -274,7 +274,7 @@ Creature* BattleGroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
if ((isStatic && cinfoid>=10 && cinfoid<=14) || (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid<=AV_NPC_A_GRAVEDEFENSE3) ||
(cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3))))
{
- if(!isStatic && ((cinfoid>=AV_NPC_A_GRAVEDEFENSE0 && cinfoid<=AV_NPC_A_GRAVEDEFENSE3)
+ if (!isStatic && ((cinfoid>=AV_NPC_A_GRAVEDEFENSE0 && cinfoid<=AV_NPC_A_GRAVEDEFENSE3)
|| (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3)))
{
CreatureData &data = objmgr.NewOrExistCreatureData(creature->GetDBTableGUIDLow());
@@ -299,28 +299,28 @@ void BattleGroundAV::Update(uint32 diff)
{
BattleGround::Update(diff);
- if(GetStatus() == STATUS_IN_PROGRESS)
+ if (GetStatus() == STATUS_IN_PROGRESS)
{
for (uint8 i=0; i<=1; i++)//0=alliance, 1=horde
{
- if(!m_CaptainAlive[i])
+ if (!m_CaptainAlive[i])
continue;
- if(m_CaptainBuffTimer[i] > diff)
+ if (m_CaptainBuffTimer[i] > diff)
m_CaptainBuffTimer[i] -= diff;
else
{
- if(i==0)
+ if (i==0)
{
CastSpellOnTeam(AV_BUFF_A_CAPTAIN,ALLIANCE);
Creature* creature = GetBGCreature(AV_CPLACE_MAX + 61);
- if(creature)
+ if (creature)
YellToAll(creature,LANG_BG_AV_A_CAPTAIN_BUFF,LANG_COMMON);
}
else
{
CastSpellOnTeam(AV_BUFF_H_CAPTAIN,HORDE);
Creature* creature = GetBGCreature(AV_CPLACE_MAX + 59); //TODO: make the captains a dynamic creature
- if(creature)
+ if (creature)
YellToAll(creature,LANG_BG_AV_H_CAPTAIN_BUFF,LANG_ORCISH);
}
m_CaptainBuffTimer[i] = 120000 + urand(0,4)* 60000; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times
@@ -330,26 +330,26 @@ void BattleGroundAV::Update(uint32 diff)
m_Mine_Timer -=diff;
for (uint8 mine=0; mine <2; mine++)
{
- if(m_Mine_Owner[mine] == ALLIANCE || m_Mine_Owner[mine] == HORDE)
+ if (m_Mine_Owner[mine] == ALLIANCE || m_Mine_Owner[mine] == HORDE)
{
- if( m_Mine_Timer <= 0)
+ if ( m_Mine_Timer <= 0)
UpdateScore(m_Mine_Owner[mine],1);
- if(m_Mine_Reclaim_Timer[mine] > diff)
+ if (m_Mine_Reclaim_Timer[mine] > diff)
m_Mine_Reclaim_Timer[mine] -= diff;
else{ //we don't need to set this timer to 0 cause this codepart wont get called when this thing is 0
ChangeMineOwner(mine,AV_NEUTRAL_TEAM);
}
}
}
- if( m_Mine_Timer <= 0)
+ if ( m_Mine_Timer <= 0)
m_Mine_Timer=AV_MINE_TICK_TIMER; //this is at the end, cause we need to update both mines
//looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
- if(m_Nodes[i].State == POINT_ASSAULTED) //maybe remove this
+ if (m_Nodes[i].State == POINT_ASSAULTED) //maybe remove this
{
- if(m_Nodes[i].Timer > diff)
+ if (m_Nodes[i].Timer > diff)
m_Nodes[i].Timer -= diff;
else
EventPlayerDestroyedPoint( i);
@@ -386,7 +386,7 @@ void BattleGroundAV::AddPlayer(Player *plr)
//create score and add it to map, default values are set in constructor
BattleGroundAVScore* sc = new BattleGroundAVScore;
m_PlayerScores[plr->GetGUID()] = sc;
- if(m_MaxLevel==0)
+ if (m_MaxLevel==0)
m_MaxLevel=(plr->getLevel()%10 == 0)? plr->getLevel() : (plr->getLevel()-(plr->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information..
}
@@ -399,9 +399,9 @@ void BattleGroundAV::EndBattleGround(uint32 winner)
uint8 rep[2]={0,0}; //0=ally 1=horde
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i)
{
- if(m_Nodes[i].State == POINT_CONTROLED)
+ if (m_Nodes[i].State == POINT_CONTROLED)
{
- if(m_Nodes[i].Owner == ALLIANCE)
+ if (m_Nodes[i].Owner == ALLIANCE)
{
rep[0] += BG_AV_REP_SURVIVING_TOWER;
kills[0] += BG_AV_KILL_SURVIVING_TOWER;
@@ -416,14 +416,14 @@ void BattleGroundAV::EndBattleGround(uint32 winner)
for (int i=0; i<=1; i++) //0=ally 1=horde
{
- if(m_CaptainAlive[i])
+ if (m_CaptainAlive[i])
{
kills[i] += BG_AV_KILL_SURVIVING_CAPTAIN;
rep[i] += BG_AV_REP_SURVIVING_CAPTAIN;
}
- if(rep[i] != 0)
+ if (rep[i] != 0)
RewardReputationToTeam((i == 0)?730:729,rep[i],(i == 0)?ALLIANCE:HORDE);
- if(kills[i] != 0)
+ if (kills[i] != 0)
RewardHonorToTeam(GetBonusHonor(kills[i]),(i == 0)?ALLIANCE:HORDE);
}
@@ -433,7 +433,7 @@ void BattleGroundAV::EndBattleGround(uint32 winner)
void BattleGroundAV::RemovePlayer(Player* plr,uint64 /*guid*/)
{
- if(!plr)
+ if (!plr)
{
sLog.outError("bg_AV no player at remove");
return;
@@ -455,13 +455,13 @@ void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
case 95:
case 2608:
- if(Source->GetTeam() != ALLIANCE)
+ if (Source->GetTeam() != ALLIANCE)
Source->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal");
else
Source->LeaveBattleground();
break;
case 2606:
- if(Source->GetTeam() != HORDE)
+ if (Source->GetTeam() != HORDE)
Source->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal");
else
Source->LeaveBattleground();
@@ -488,7 +488,7 @@ void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
- if(itr == m_PlayerScores.end()) // player not found...
+ if (itr == m_PlayerScores.end()) // player not found...
return;
switch(type)
@@ -532,11 +532,11 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
UpdateNodeWorldState(node);
uint32 owner = m_Nodes[node].Owner;
- if( IsTower(node) )
+ if ( IsTower(node) )
{
uint8 tmp = node-BG_AV_NODES_DUNBALDAR_SOUTH;
//despawn marshal
- if(m_BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp])
+ if (m_BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp])
DelCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp);
else
sLog.outError("BG_AV: playerdestroyedpoint: marshal %i doesn't exist",AV_CPLACE_A_MARSHAL_SOUTH + tmp);
@@ -553,14 +553,14 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
}
else
{
- if( owner == ALLIANCE )
+ if ( owner == ALLIANCE )
SpawnBGObject(object-11, RESPAWN_IMMEDIATELY);
else
SpawnBGObject(object+11, RESPAWN_IMMEDIATELY);
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node,RESPAWN_ONE_DAY);
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node,RESPAWN_IMMEDIATELY);
PopulateNode(node);
- if(node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
+ if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
{
for (uint8 i = 0; i < 4; i++)
{
@@ -571,13 +571,13 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
}
//send a nice message to all :)
char buf[256];
- if(IsTower(node))
+ if (IsTower(node))
sprintf(buf, GetTrinityString(LANG_BG_AV_TOWER_TAKEN) , GetNodeName(node),( owner == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE) );
else
sprintf(buf, GetTrinityString(LANG_BG_AV_GRAVE_TAKEN) , GetNodeName(node),( owner == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) :GetTrinityString(LANG_BG_AV_HORDE) );
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
- if(creature)
+ if (creature)
YellToAll(creature,buf,LANG_UNIVERSAL);
}
@@ -585,25 +585,25 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
{ //mine=0 northmine mine=1 southmin
//changing the owner results in setting respawntim to infinite for current creatures, spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them
assert(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
- if(team != ALLIANCE && team != HORDE)
+ if (team != ALLIANCE && team != HORDE)
team = AV_NEUTRAL_TEAM;
else
PlaySoundToAll((team==ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD);
- if(m_Mine_Owner[mine] == team && !initial)
+ if (m_Mine_Owner[mine] == team && !initial)
return;
m_Mine_PrevOwner[mine] = m_Mine_Owner[mine];
m_Mine_Owner[mine] = team;
- if(!initial)
+ if (!initial)
{
sLog.outDebug("bg_av depopulating mine %i (0=north,1=south)",mine);
- if(mine==AV_SOUTH_MINE)
+ if (mine==AV_SOUTH_MINE)
for (uint16 i=AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++)
- if( m_BgCreatures[i] )
+ if ( m_BgCreatures[i] )
DelCreature(i); //TODO just set the respawntime to 999999
for (uint16 i=((mine==AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MIN:AV_CPLACE_MINE_S_1_MIN); i <= ((mine==AV_NORTH_MINE)?AV_CPLACE_MINE_N_3:AV_CPLACE_MINE_S_3); i++)
- if( m_BgCreatures[i] )
+ if ( m_BgCreatures[i] )
DelCreature(i); //TODO here also
}
SendMineWorldStates(mine);
@@ -611,9 +611,9 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
sLog.outDebug("bg_av populating mine %i (0=north,1=south)",mine);
uint16 miner;
//also neutral team exists.. after a big time, the neutral team tries to conquer the mine
- if(mine==AV_NORTH_MINE)
+ if (mine==AV_NORTH_MINE)
{
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
miner = AV_NPC_N_MINE_A_1;
else if (team == HORDE)
miner = AV_NPC_N_MINE_H_1;
@@ -623,7 +623,7 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
else
{
uint16 cinfo;
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
miner = AV_NPC_S_MINE_A_1;
else if (team == HORDE)
miner = AV_NPC_S_MINE_H_1;
@@ -631,7 +631,7 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
miner = AV_NPC_S_MINE_N_1;
//vermin
sLog.outDebug("spawning vermin");
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
cinfo = AV_NPC_S_MINE_A_3;
else if (team == HORDE)
cinfo = AV_NPC_S_MINE_H_3;
@@ -651,18 +651,18 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
// {
//TODO: add gameobject-update code
// }
- if(team == ALLIANCE || team == HORDE)
+ if (team == ALLIANCE || team == HORDE)
{
m_Mine_Reclaim_Timer[mine]=AV_MINE_RECLAIM_TIMER;
char buf[256];
sprintf(buf, GetTrinityString(LANG_BG_AV_MINE_TAKEN), GetTrinityString(( mine == AV_NORTH_MINE ) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH), ( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
- if(creature)
+ if (creature)
YellToAll(creature,buf,LANG_UNIVERSAL);
}
else
{
- if(mine==AV_SOUTH_MINE) //i think this gets called all the time
+ if (mine==AV_SOUTH_MINE) //i think this gets called all the time
{
Creature* creature = GetBGCreature(AV_CPLACE_MINE_S_3);
YellToAll(creature,LANG_BG_AV_S_MINE_BOSS_CLAIMS,LANG_UNIVERSAL);
@@ -673,9 +673,9 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
bool BattleGroundAV::PlayerCanDoMineQuest(int32 GOId,uint32 team)
{
- if(GOId == BG_AV_OBJECTID_MINE_N)
+ if (GOId == BG_AV_OBJECTID_MINE_N)
return (m_Mine_Owner[AV_NORTH_MINE]==team);
- if(GOId == BG_AV_OBJECTID_MINE_S)
+ if (GOId == BG_AV_OBJECTID_MINE_S)
return (m_Mine_Owner[AV_SOUTH_MINE]==team);
return true; //cause it's no mine'object it is ok if this is true
}
@@ -687,7 +687,7 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + ( 4 * node );
uint32 creatureid;
- if(IsTower(node))
+ if (IsTower(node))
creatureid=(owner==ALLIANCE)?AV_NPC_A_TOWERDEFENSE:AV_NPC_H_TOWERDEFENSE;
else
{
@@ -701,9 +701,9 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
else
creatureid = ( owner == ALLIANCE )? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3;
//spiritguide
- if( m_BgCreatures[node] )
+ if ( m_BgCreatures[node] )
DelCreature(node);
- if( !AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner))
+ if ( !AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner))
sLog.outError("AV: couldn't spawn spiritguide at node %i",node);
}
@@ -716,29 +716,29 @@ void BattleGroundAV::DePopulateNode(BG_AV_Nodes node)
{
uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + ( 4 * node );
for (uint8 i=0; i<4; i++)
- if( m_BgCreatures[c_place+i] )
+ if ( m_BgCreatures[c_place+i] )
DelCreature(c_place+i);
//spiritguide
- if( !IsTower(node) && m_BgCreatures[node] )
+ if ( !IsTower(node) && m_BgCreatures[node] )
DelCreature(node);
}
const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object)
{
sLog.outDebug("bg_AV getnodethroughobject %i",object);
- if( object <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER )
+ if ( object <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER )
return BG_AV_Nodes(object);
- if( object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT )
+ if ( object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT )
return BG_AV_Nodes(object - 11);
- if( object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER )
+ if ( object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER )
return BG_AV_Nodes(object - 7);
- if( object <= BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER )
+ if ( object <= BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER )
return BG_AV_Nodes(object -22);
- if( object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT )
+ if ( object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT )
return BG_AV_Nodes(object - 33);
- if( object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER )
+ if ( object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER )
return BG_AV_Nodes(object - 29);
- if( object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE )
+ if ( object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE )
return BG_AV_NODES_SNOWFALL_GRAVE;
sLog.outError("BattleGroundAV: ERROR! GetPlace got a wrong object :(");
assert(false);
@@ -748,29 +748,29 @@ const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object)
const uint32 BattleGroundAV::GetObjectThroughNode(BG_AV_Nodes node)
{ //this function is the counterpart to GetNodeThroughObject()
sLog.outDebug("bg_AV GetObjectThroughNode %i",node);
- if( m_Nodes[node].Owner == ALLIANCE )
+ if ( m_Nodes[node].Owner == ALLIANCE )
{
- if( m_Nodes[node].State == POINT_ASSAULTED )
+ if ( m_Nodes[node].State == POINT_ASSAULTED )
{
- if( node <= BG_AV_NODES_FROSTWOLF_HUT )
+ if ( node <= BG_AV_NODES_FROSTWOLF_HUT )
return node+11;
- if( node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER)
+ if ( node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER)
return node+7;
}
else if ( m_Nodes[node].State == POINT_CONTROLED )
- if( node <= BG_AV_NODES_STONEHEART_BUNKER )
+ if ( node <= BG_AV_NODES_STONEHEART_BUNKER )
return node;
}
else if ( m_Nodes[node].Owner == HORDE )
{
- if( m_Nodes[node].State == POINT_ASSAULTED )
- if( node <= BG_AV_NODES_STONEHEART_BUNKER )
+ if ( m_Nodes[node].State == POINT_ASSAULTED )
+ if ( node <= BG_AV_NODES_STONEHEART_BUNKER )
return node+22;
else if ( m_Nodes[node].State == POINT_CONTROLED )
{
- if( node <= BG_AV_NODES_FROSTWOLF_HUT )
+ if ( node <= BG_AV_NODES_FROSTWOLF_HUT )
return node+33;
- if( node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER)
+ if ( node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER)
return node+29;
}
}
@@ -785,11 +785,11 @@ const uint32 BattleGroundAV::GetObjectThroughNode(BG_AV_Nodes node)
void BattleGroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target_obj)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
int32 object = GetObjectType(target_obj->GetGUID());
sLog.outDebug("BG_AV using gameobject %i with type %i",target_obj->GetEntry(),object);
- if(object < 0)
+ if (object < 0)
return;
switch(target_obj->GetEntry())
{
@@ -819,28 +819,28 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
uint32 owner = m_Nodes[node].Owner; //maybe should name it prevowner
uint32 team = player->GetTeam();
- if(owner == player->GetTeam() || m_Nodes[node].State != POINT_ASSAULTED)
+ if (owner == player->GetTeam() || m_Nodes[node].State != POINT_ASSAULTED)
return;
- if(m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM)
+ if (m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM)
{ //until snowfall doesn't belong to anyone it is better handled in assault-code
assert(node == BG_AV_NODES_SNOWFALL_GRAVE); //currently the only neutral grave
EventPlayerAssaultsPoint(player,object);
return;
}
sLog.outDebug("player defends point object: %i node: %i",object,node);
- if(m_Nodes[node].PrevOwner != team)
+ if (m_Nodes[node].PrevOwner != team)
{
sLog.outError("BG_AV: player defends point which doesn't belong to his team %i",node);
return;
}
//spawn new go :)
- if(m_Nodes[node].Owner == ALLIANCE)
+ if (m_Nodes[node].Owner == ALLIANCE)
SpawnBGObject(object+22, RESPAWN_IMMEDIATELY); //spawn horde banner
else
SpawnBGObject(object-22, RESPAWN_IMMEDIATELY); //spawn alliance banner
- if(!IsTower(node))
+ if (!IsTower(node))
{
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node,RESPAWN_ONE_DAY);
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(team)+3*node,RESPAWN_IMMEDIATELY);
@@ -852,7 +852,7 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
PopulateNode(node);
UpdateNodeWorldState(node);
- if(IsTower(node))
+ if (IsTower(node))
{
//spawn big flag+aura on top of tower
SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team == ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
@@ -860,7 +860,7 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team == ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnBGObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team == HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
}
- else if(node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
+ else if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
{
for (uint8 i = 0; i < 4; i++)
{
@@ -872,11 +872,11 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
char buf[256];
sprintf(buf, GetTrinityString(( IsTower(node) ) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node),( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
- if(creature)
+ if (creature)
YellToAll(creature,buf,LANG_UNIVERSAL);
//update the statistic for the defending player
UpdatePlayerScore(player, ( IsTower(node) ) ? SCORE_TOWERS_DEFENDED : SCORE_GRAVEYARDS_DEFENDED, 1);
- if(IsTower(node))
+ if (IsTower(node))
PlaySoundToAll(AV_SOUND_BOTH_TOWER_DEFEND);
else
PlaySoundToAll((team==ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD);
@@ -890,31 +890,31 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
uint32 owner = m_Nodes[node].Owner; //maybe name it prevowner
uint32 team = player->GetTeam();
sLog.outDebug("bg_av: player assaults point object %i node %i",object,node);
- if(owner == team || team == m_Nodes[node].TotalOwner)
+ if (owner == team || team == m_Nodes[node].TotalOwner)
return; //surely a gm used this object
- if(node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall is a bit special in capping + it gets eyecandy stuff
+ if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall is a bit special in capping + it gets eyecandy stuff
{
- if(object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) //initial capping
+ if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) //initial capping
{
assert(owner == AV_NEUTRAL_TEAM && m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM);
- if( team == ALLIANCE )
+ if ( team == ALLIANCE )
SpawnBGObject(BG_AV_OBJECT_FLAG_C_A_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY);
else
SpawnBGObject(BG_AV_OBJECT_FLAG_C_H_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY);
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node,RESPAWN_IMMEDIATELY); //neutral aura spawn
}
- else if(m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM) //recapping, when no team owns this node realy
+ else if (m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM) //recapping, when no team owns this node realy
{
assert(m_Nodes[node].State != POINT_CONTROLED);
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
SpawnBGObject(object-11, RESPAWN_IMMEDIATELY);
else
SpawnBGObject(object+11, RESPAWN_IMMEDIATELY);
}
//eyecandy
uint32 spawn,despawn;
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
{
despawn = ( m_Nodes[node].State == POINT_ASSAULTED )?BG_AV_OBJECT_SNOW_EYECANDY_PH : BG_AV_OBJECT_SNOW_EYECANDY_H;
spawn = BG_AV_OBJECT_SNOW_EYECANDY_PA;
@@ -932,14 +932,14 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
}
//if snowfall gots capped it can be handled like all other graveyards
- if( m_Nodes[node].TotalOwner != AV_NEUTRAL_TEAM)
+ if ( m_Nodes[node].TotalOwner != AV_NEUTRAL_TEAM)
{
assert(m_Nodes[node].Owner != AV_NEUTRAL_TEAM);
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
SpawnBGObject(object-22, RESPAWN_IMMEDIATELY);
else
SpawnBGObject(object+22, RESPAWN_IMMEDIATELY);
- if(IsTower(node))
+ if (IsTower(node))
{ //spawning/despawning of bigflag+aura
SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team==ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnBGObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team==HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
@@ -953,16 +953,16 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node,RESPAWN_ONE_DAY); //teeamaura despawn
// Those who are waiting to resurrect at this object are taken to the closest own object's graveyard
std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]];
- if( !ghost_list.empty() )
+ if ( !ghost_list.empty() )
{
Player *plr;
WorldSafeLocsEntry const *ClosestGrave = NULL;
for (std::vector<uint64>::iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
{
plr = objmgr.GetPlayer(*ghost_list.begin());
- if( !plr )
+ if ( !plr )
continue;
- if(!ClosestGrave)
+ if (!ClosestGrave)
ClosestGrave = GetClosestGraveYard(plr);
else
plr->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation());
@@ -981,7 +981,7 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
char buf[256];
sprintf(buf, ( IsTower(node) ) ? GetTrinityString(LANG_BG_AV_TOWER_ASSAULTED) : GetTrinityString(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node), ( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE ));
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
- if(creature)
+ if (creature)
YellToAll(creature,buf,LANG_UNIVERSAL);
//update the statistic for the assaulting player
UpdatePlayerScore(player, ( IsTower(node) ) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1);
@@ -1010,11 +1010,11 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data)
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j,ALLIANCE)]) << uint32((m_Nodes[i].Owner == ALLIANCE && stateok)?1:0);
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j,HORDE)]) << uint32((m_Nodes[i].Owner == HORDE && stateok)?1:0);
}
- if(m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == AV_NEUTRAL_TEAM) //cause neutral teams aren't handled generic
+ if (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == AV_NEUTRAL_TEAM) //cause neutral teams aren't handled generic
data << uint32(AV_SNOWFALL_N) << uint32(1);
data << uint32(AV_Alliance_Score) << uint32(m_Team_Scores[0]);
data << uint32(AV_Horde_Score) << uint32(m_Team_Scores[1]);
- if(GetStatus() == STATUS_IN_PROGRESS){ //only if game started the teamscores are displayed
+ if (GetStatus() == STATUS_IN_PROGRESS){ //only if game started the teamscores are displayed
data << uint32(AV_SHOW_A_SCORE) << uint32(1);
data << uint32(AV_SHOW_H_SCORE) << uint32(1);
}
@@ -1032,18 +1032,18 @@ const uint8 BattleGroundAV::GetWorldStateType(uint8 state, uint16 team) //this i
//neutral stuff cant get handled (currently its only snowfall)
assert(team != AV_NEUTRAL_TEAM);
//a_c a_a h_c h_a the positions in worldstate-array
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
{
- if(state==POINT_CONTROLED || state==POINT_DESTROYED)
+ if (state==POINT_CONTROLED || state==POINT_DESTROYED)
return 0;
- if(state==POINT_ASSAULTED)
+ if (state==POINT_ASSAULTED)
return 1;
}
- if(team == HORDE)
+ if (team == HORDE)
{
- if(state==POINT_DESTROYED || state==POINT_CONTROLED)
+ if (state==POINT_DESTROYED || state==POINT_CONTROLED)
return 2;
- if(state==POINT_ASSAULTED)
+ if (state==POINT_ASSAULTED)
return 3;
}
sLog.outError("BG_AV: should update a strange worldstate state:%i team:%i",state,team);
@@ -1053,7 +1053,7 @@ const uint8 BattleGroundAV::GetWorldStateType(uint8 state, uint16 team) //this i
void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
{
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State,m_Nodes[node].Owner)],1);
- if(m_Nodes[node].PrevOwner == AV_NEUTRAL_TEAM) //currently only snowfall is supported as neutral node (i don't want to make an extra row (neutral states) in worldstatesarray just for one node
+ if (m_Nodes[node].PrevOwner == AV_NEUTRAL_TEAM) //currently only snowfall is supported as neutral node (i don't want to make an extra row (neutral states) in worldstatesarray just for one node
UpdateWorldState(AV_SNOWFALL_N,0);
else
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState,m_Nodes[node].PrevOwner)],0);
@@ -1068,28 +1068,28 @@ void BattleGroundAV::SendMineWorldStates(uint32 mine)
uint8 owner,prevowner,mine2; //those variables are needed to access the right worldstate in the BG_AV_MineWorldStates array
mine2 = (mine==AV_NORTH_MINE)?0:1;
- if(m_Mine_PrevOwner[mine] == ALLIANCE)
+ if (m_Mine_PrevOwner[mine] == ALLIANCE)
prevowner = 0;
- else if(m_Mine_PrevOwner[mine] == HORDE)
+ else if (m_Mine_PrevOwner[mine] == HORDE)
prevowner = 2;
else
prevowner = 1;
- if(m_Mine_Owner[mine] == ALLIANCE)
+ if (m_Mine_Owner[mine] == ALLIANCE)
owner = 0;
- else if(m_Mine_Owner[mine] == HORDE)
+ else if (m_Mine_Owner[mine] == HORDE)
owner = 2;
else
owner = 1;
UpdateWorldState(BG_AV_MineWorldStates[mine2][owner],1);
- if( prevowner != owner)
+ if ( prevowner != owner)
UpdateWorldState(BG_AV_MineWorldStates[mine2][prevowner],0);
}
WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player)
{
WorldSafeLocsEntry const* good_entry = NULL;
- if( GetStatus() == STATUS_IN_PROGRESS)
+ if ( GetStatus() == STATUS_IN_PROGRESS)
{
// Is there any occupied node for this team?
float mindist = 9999999.0f;
@@ -1098,10 +1098,10 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player)
if (m_Nodes[i].Owner != player->GetTeam() || m_Nodes[i].State != POINT_CONTROLED)
continue;
WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[i] );
- if( !entry )
+ if ( !entry )
continue;
float dist = (entry->x - player->GetPositionX())*(entry->x - player->GetPositionX())+(entry->y - player->GetPositionY())*(entry->y - player->GetPositionY());
- if( mindist > dist )
+ if ( mindist > dist )
{
mindist = dist;
good_entry = entry;
@@ -1109,7 +1109,7 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player)
}
}
// If not, place ghost on starting location
- if( !good_entry )
+ if ( !good_entry )
good_entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[GetTeamIndexByTeamId(player->GetTeam())+7] );
return good_entry;
@@ -1118,7 +1118,7 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player)
bool BattleGroundAV::SetupBattleGround()
{
// Create starting objects
- if(
+ if (
// alliance gates
!AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0][0],BG_AV_DoorPositons[0][1],BG_AV_DoorPositons[0][2],BG_AV_DoorPositons[0][3],0,0,sin(BG_AV_DoorPositons[0][3]/2),cos(BG_AV_DoorPositons[0][3]/2),RESPAWN_IMMEDIATELY)
// horde gates
@@ -1131,9 +1131,9 @@ bool BattleGroundAV::SetupBattleGround()
//spawn node-objects
for (uint8 i = BG_AV_NODES_FIRSTAID_STATION ; i < BG_AV_NODES_MAX; ++i)
{
- if( i <= BG_AV_NODES_FROSTWOLF_HUT )
+ if ( i <= BG_AV_NODES_FROSTWOLF_HUT )
{
- if( !AddObject(i,BG_AV_OBJECTID_BANNER_A_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
+ if ( !AddObject(i,BG_AV_OBJECTID_BANNER_A_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(i+11,BG_AV_OBJECTID_BANNER_CONT_A_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(i+33,BG_AV_OBJECTID_BANNER_H_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(i+22,BG_AV_OBJECTID_BANNER_CONT_H_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
@@ -1148,9 +1148,9 @@ bool BattleGroundAV::SetupBattleGround()
}
else //towers
{
- if( i <= BG_AV_NODES_STONEHEART_BUNKER ) //alliance towers
+ if ( i <= BG_AV_NODES_STONEHEART_BUNKER ) //alliance towers
{
- if( !AddObject(i,BG_AV_OBJECTID_BANNER_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
+ if ( !AddObject(i,BG_AV_OBJECTID_BANNER_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(i+22,BG_AV_OBJECTID_BANNER_CONT_H,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_A,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_N,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY)
@@ -1163,7 +1163,7 @@ bool BattleGroundAV::SetupBattleGround()
}
else //horde towers
{
- if( !AddObject(i+7,BG_AV_OBJECTID_BANNER_CONT_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
+ if ( !AddObject(i+7,BG_AV_OBJECTID_BANNER_CONT_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(i+29,BG_AV_OBJECTID_BANNER_H,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_N,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_H,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY)
@@ -1176,7 +1176,7 @@ bool BattleGroundAV::SetupBattleGround()
}
for (uint8 j=0; j<=9; j++) //burning aura
{
- if(!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j,BG_AV_OBJECTID_FIRE,BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2),RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j,BG_AV_OBJECTID_FIRE,BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!5.%i",i);
return false;
@@ -1188,9 +1188,9 @@ bool BattleGroundAV::SetupBattleGround()
{
for (uint8 j=0; j<=9; j++)
{
- if(j<5)
+ if (j<5)
{
- if(!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,BG_AV_OBJECTID_SMOKE,BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,BG_AV_OBJECTID_SMOKE,BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!6.%i",i);
return false;
@@ -1198,7 +1198,7 @@ bool BattleGroundAV::SetupBattleGround()
}
else
{
- if(!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,BG_AV_OBJECTID_FIRE,BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,BG_AV_OBJECTID_FIRE,BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!7.%i",i);
return false;
@@ -1208,7 +1208,7 @@ bool BattleGroundAV::SetupBattleGround()
}
for (uint16 i= 0; i<=(BG_AV_OBJECT_MINE_SUPPLY_N_MAX-BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i++)
{
- if(!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i,BG_AV_OBJECTID_MINE_N,BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2),RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i,BG_AV_OBJECTID_MINE_N,BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some mine supplies BattleGround not created!7.5.%i",i);
return false;
@@ -1216,21 +1216,21 @@ bool BattleGroundAV::SetupBattleGround()
}
for (uint16 i= 0 ; i<=(BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++)
{
- if(!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i,BG_AV_OBJECTID_MINE_S,BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2),RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i,BG_AV_OBJECTID_MINE_S,BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some mine supplies BattleGround not created!7.6.%i",i);
return false;
}
}
- if(!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N ,BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3],0,0,sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N ,BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3],0,0,sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!8");
return false;
}
for (uint8 i = 0; i < 4; i++)
{
- if(!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
+ if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY))
@@ -1253,7 +1253,7 @@ bool BattleGroundAV::SetupBattleGround()
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
for (i = BG_AV_OBJECT_FLAG_H_ICEBLOOD_GRAVE; i <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER ; i++){
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
- if(i<=BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT)
+ if (i<=BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT)
SpawnBGObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+3*GetNodeThroughObject(i),RESPAWN_IMMEDIATELY);
}
for (i = BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_TFLAG_A_STONEHEART_BUNKER; i+=2)
@@ -1275,7 +1275,7 @@ bool BattleGroundAV::SetupBattleGround()
sLog.outDebug("BG_AV start poputlating nodes");
for (BG_AV_Nodes i= BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i )
{
- if(m_Nodes[i].Owner)
+ if (m_Nodes[i].Owner)
PopulateNode(i);
}
//all creatures which don't get despawned through the script are static
@@ -1413,7 +1413,7 @@ void BattleGroundAV::ResetBGSubclass()
m_Mine_Timer=AV_MINE_TICK_TIMER;
for (uint16 i = 0; i < AV_CPLACE_MAX+AV_STATICCPLACE_MAX; i++)
- if(m_BgCreatures[i])
+ if (m_BgCreatures[i])
DelCreature(i);
}
diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp
index e6548f557b8..992587a4f18 100644
--- a/src/game/BattleGroundBE.cpp
+++ b/src/game/BattleGroundBE.cpp
@@ -177,7 +177,7 @@ void BattleGroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
- if(itr == m_PlayerScores.end()) // player not found...
+ if (itr == m_PlayerScores.end()) // player not found...
return;
//there is nothing special in this score
diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp
index e20ee99efc9..f45bf4c4d30 100644
--- a/src/game/BattleGroundEY.cpp
+++ b/src/game/BattleGroundEY.cpp
@@ -374,7 +374,7 @@ void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
if (GetStatus() != STATUS_IN_PROGRESS)
return;
- if(!Source->isAlive()) //hack code, must be removed later
+ if (!Source->isAlive()) //hack code, must be removed later
return;
switch(Trigger)
@@ -789,7 +789,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
void BattleGroundEY::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
- if(itr == m_PlayerScores.end()) // player not found
+ if (itr == m_PlayerScores.end()) // player not found
return;
switch(type)
diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp
index 78a9409764c..f3b10bdf444 100644
--- a/src/game/BattleGroundHandler.cpp
+++ b/src/game/BattleGroundHandler.cpp
@@ -45,7 +45,7 @@ void WorldSession::HandleBattlemasterHelloOpcode( WorldPacket & recv_data )
if (!unit)
return;
- if(!unit->isBattleMaster()) // it's not battlemaster
+ if (!unit->isBattleMaster()) // it's not battlemaster
return;
// Stop the npc if moving
@@ -162,7 +162,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *member = itr->getSource();
- if(!member) continue; // this should never happen
+ if (!member) continue; // this should never happen
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId); // add to queue
@@ -198,7 +198,7 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv
sLog.outDebug("WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message");
BattleGround *bg = _player->GetBattleGround();
- if(!bg) // can't be received if player not in battleground
+ if (!bg) // can't be received if player not in battleground
return;
switch( bg->GetTypeID() )
@@ -543,7 +543,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data )
if (!unit)
return;
- if(!unit->isSpiritService()) // it's not spirit service
+ if (!unit->isSpiritService()) // it's not spirit service
return;
if (bg)
@@ -564,7 +564,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data )
if (!unit)
return;
- if(!unit->isSpiritService()) // it's not spirit service
+ if (!unit->isSpiritService()) // it's not spirit service
return;
if (bg)
@@ -593,7 +593,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
if (!unit)
return;
- if(!unit->isBattleMaster()) // it's not battle master
+ if (!unit->isBattleMaster()) // it's not battle master
return;
uint8 arenatype = 0;
@@ -710,7 +710,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *member = itr->getSource();
- if(!member) continue;
+ if (!member) continue;
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId);// add to queue
diff --git a/src/game/BattleGroundIC.cpp b/src/game/BattleGroundIC.cpp
index 73783e3b1ab..5d503460670 100644
--- a/src/game/BattleGroundIC.cpp
+++ b/src/game/BattleGroundIC.cpp
@@ -76,7 +76,7 @@ void BattleGroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
- if(itr == m_PlayerScores.end()) // player not found...
+ if (itr == m_PlayerScores.end()) // player not found...
return;
BattleGround::UpdatePlayerScore(Source,type,value);
diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp
index 46a2f05e021..a3e3ac72576 100644
--- a/src/game/BattleGroundMgr.cpp
+++ b/src/game/BattleGroundMgr.cpp
@@ -183,7 +183,7 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleG
if (isRated && sWorld.getConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE))
{
ArenaTeam *Team = objmgr.GetArenaTeamById(arenateamid);
- if(Team)
+ if (Team)
sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, Team->GetName().c_str(), ginfo->ArenaType, ginfo->ArenaType, ginfo->ArenaTeamRating);
}
@@ -195,7 +195,7 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleG
for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *member = itr->getSource();
- if(!member)
+ if (!member)
continue; // this should never happen
PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetGUID()];
pl_info.LastOnlineTime = lastOnlineTime;
@@ -378,7 +378,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
if (group->ArenaType && group->IsRated && group->Players.empty() && sWorld.getConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE))
{
ArenaTeam *Team = objmgr.GetArenaTeamById(group->ArenaTeamId);
- if(Team)
+ if (Team)
sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, Team->GetName().c_str(), group->ArenaType, group->ArenaType, group->ArenaTeamRating);
}
@@ -668,7 +668,7 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGround
uint32 j = BG_TEAM_ALLIANCE;
if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
j = BG_TEAM_HORDE;
- if( sWorld.getConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) != 0
+ if ( sWorld.getConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) != 0
&& m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers )
{
//we will try to invite more groups to team with less players indexed by j
@@ -757,7 +757,7 @@ should be called from BattleGround::RemovePlayer function in some cases
void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, uint8 arenaType, bool isRated, uint32 arenaRating)
{
//if no players in queue - do nothing
- if( m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() &&
+ if ( m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() &&
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty() &&
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() &&
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty() )
@@ -771,7 +771,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
next = itr;
++next;
// DO NOT allow queue manager to invite new player to arena
- if( (*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id &&
+ if ( (*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id &&
(*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE )
{
BattleGround* bg = *itr; //we have to store battleground pointer here, because when battleground is full, it is removed from free queue (not yet implemented!!)
@@ -949,7 +949,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
for (; itr_team[i] != m_QueuedGroups[bracket_id][i].end(); ++(itr_team[i]))
{
// if group match conditions, then add it to pool
- if( !(*itr_team[i])->IsInvitedToBGInstanceGUID
+ if ( !(*itr_team[i])->IsInvitedToBGInstanceGUID
&& (((*itr_team[i])->ArenaTeamRating >= arenaMinRating && (*itr_team[i])->ArenaTeamRating <= arenaMaxRating)
|| (*itr_team[i])->JoinTime < discardTime) )
{
@@ -969,7 +969,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
++itr_team[BG_TEAM_ALLIANCE];
for (; itr_team[BG_TEAM_ALLIANCE] != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++(itr_team[BG_TEAM_ALLIANCE]))
{
- if( !(*itr_team[BG_TEAM_ALLIANCE])->IsInvitedToBGInstanceGUID
+ if ( !(*itr_team[BG_TEAM_ALLIANCE])->IsInvitedToBGInstanceGUID
&& (((*itr_team[BG_TEAM_ALLIANCE])->ArenaTeamRating >= arenaMinRating && (*itr_team[BG_TEAM_ALLIANCE])->ArenaTeamRating <= arenaMaxRating)
|| (*itr_team[BG_TEAM_ALLIANCE])->JoinTime < discardTime) )
{
@@ -985,7 +985,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
++itr_team[BG_TEAM_HORDE];
for (; itr_team[BG_TEAM_HORDE] != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++(itr_team[BG_TEAM_HORDE]))
{
- if( !(*itr_team[BG_TEAM_HORDE])->IsInvitedToBGInstanceGUID
+ if ( !(*itr_team[BG_TEAM_HORDE])->IsInvitedToBGInstanceGUID
&& (((*itr_team[BG_TEAM_HORDE])->ArenaTeamRating >= arenaMinRating && (*itr_team[BG_TEAM_HORDE])->ArenaTeamRating <= arenaMaxRating)
|| (*itr_team[BG_TEAM_HORDE])->JoinTime < discardTime) )
{
@@ -1236,7 +1236,7 @@ void BattleGroundMgr::Update(uint32 diff)
{
if (m_AutoDistributionTimeChecker < diff)
{
- if(time(NULL) > m_NextAutoDistributionTime)
+ if (time(NULL) > m_NextAutoDistributionTime)
{
DistributeArenaPoints();
m_NextAutoDistributionTime = time(NULL) + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS);
@@ -1307,7 +1307,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
data->Initialize(MSG_PVP_LOG_DATA, (1+1+4+40*bg->GetPlayerScoresSize()));
*data << uint8(type); // type (battleground=0/arena=1)
- if(type) // arena
+ if (type) // arena
{
// it seems this must be according to BG_WINNER_A/H and _NOT_ BG_TEAM_A/H
for (int i = 1; i >= 0; --i)
@@ -1510,7 +1510,7 @@ uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeI
uint32 lastId = 0;
for (std::set<uint32>::iterator itr = m_ClientBattleGroundIds[bgTypeId][bracket_id].begin(); itr != m_ClientBattleGroundIds[bgTypeId][bracket_id].end();)
{
- if( (++lastId) != *itr) //if there is a gap between the ids, we will break..
+ if ( (++lastId) != *itr) //if there is a gap between the ids, we will break..
break;
lastId = *itr;
}
@@ -1850,7 +1850,7 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
*data << uint64(guid); // battlemaster guid
*data << uint8(fromWhere); // from where you joined
*data << uint32(bgTypeId); // battleground id
- if(bgTypeId == BATTLEGROUND_AA) // arena
+ if (bgTypeId == BATTLEGROUND_AA) // arena
{
*data << uint8(4); // unk
*data << uint8(0); // unk
@@ -1865,10 +1865,10 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
uint32 count = 0;
*data << uint32(0); // number of bg instances
- if(BattleGround* bgTemplate = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId))
+ if (BattleGround* bgTemplate = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId))
{
// expected bracket entry
- if(PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(),plr->getLevel()))
+ if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(),plr->getLevel()))
{
BattleGroundBracketId bracketId = bracketEntry->GetBracketId();
for (std::set<uint32>::iterator itr = m_ClientBattleGroundIds[bgTypeId][bracketId].begin(); itr != m_ClientBattleGroundIds[bgTypeId][bracketId].end();++itr)
@@ -2026,7 +2026,7 @@ void BattleGroundMgr::SetHolidayWeekends(uint32 mask)
{
for (uint32 bgtype = 1; bgtype < MAX_BATTLEGROUND_TYPE_ID; ++bgtype)
{
- if(BattleGround * bg = GetBattleGroundTemplate(BattleGroundTypeId(bgtype)))
+ if (BattleGround * bg = GetBattleGroundTemplate(BattleGroundTypeId(bgtype)))
{
bg->SetHoliday(mask & (1 << bgtype));
}
@@ -2133,7 +2133,7 @@ void BattleGroundMgr::DoCompleteAchievement(uint32 achievement, Player * player)
{
AchievementEntry const* AE = GetAchievementStore()->LookupEntry(achievement);
- if(!player)
+ if (!player)
{
//Map::PlayerList const &PlayerList = this->GetPlayers();
//GroupsQueueType::iterator group = SelectedGroups.begin();
diff --git a/src/game/BattleGroundSA.cpp b/src/game/BattleGroundSA.cpp
index d896aa29b1f..9fdbd940cfe 100644
--- a/src/game/BattleGroundSA.cpp
+++ b/src/game/BattleGroundSA.cpp
@@ -75,7 +75,7 @@ bool BattleGroundSA::ResetObjs()
for (uint8 i = 0; i < BG_SA_CENTRAL_FLAG; i++)
{
- if(!AddObject(i,BG_SA_ObjEntries[i],
+ if (!AddObject(i,BG_SA_ObjEntries[i],
BG_SA_ObjSpawnlocs[i][0],BG_SA_ObjSpawnlocs[i][1],
BG_SA_ObjSpawnlocs[i][2],BG_SA_ObjSpawnlocs[i][3],
0,0,0,0,RESPAWN_ONE_DAY))
@@ -86,7 +86,7 @@ bool BattleGroundSA::ResetObjs()
//By capturing GYs.
for (uint8 i = 0; i < BG_SA_NPC_SPARKLIGHT; i++)
{
- if(!AddCreature(BG_SA_NpcEntries[i], i, (attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE),
+ if (!AddCreature(BG_SA_NpcEntries[i], i, (attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE),
BG_SA_NpcSpawnlocs[i][0],BG_SA_NpcSpawnlocs[i][1],
BG_SA_NpcSpawnlocs[i][2],BG_SA_NpcSpawnlocs[i][3]))
return false;
@@ -121,13 +121,13 @@ bool BattleGroundSA::ResetObjs()
WorldSafeLocsEntry const *sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
- if(!sg)
+ if (!sg)
{
sLog.outError("SOTA: Can't find GY entry %u",BG_SA_GYEntries[i]);
return false;
}
- if(i == BG_SA_BEACH_GY)
+ if (i == BG_SA_BEACH_GY)
{
GraveyardStatus[i] = attackers;
AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE )? HORDE : ALLIANCE));
@@ -135,7 +135,7 @@ bool BattleGroundSA::ResetObjs()
else
{
GraveyardStatus[i] = ((attackers == TEAM_HORDE )? TEAM_ALLIANCE : TEAM_HORDE);
- if(!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE )? ALLIANCE : HORDE) ))
+ if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE )? ALLIANCE : HORDE) ))
sLog.outError("SOTA: couldn't spawn GY: %u",i);
}
}
@@ -159,7 +159,7 @@ bool BattleGroundSA::ResetObjs()
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE , GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0 );
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE , GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0 );
- if(attackers == TEAM_ALLIANCE)
+ if (attackers == TEAM_ALLIANCE)
{
UpdateWorldState(BG_SA_ALLY_ATTACKS, 1);
UpdateWorldState(BG_SA_HORDE_ATTACKS, 0);
@@ -199,7 +199,7 @@ bool BattleGroundSA::ResetObjs()
void BattleGroundSA::StartShips()
{
- if(ShipsStarted)
+ if (ShipsStarted)
return;
DoorOpen(BG_SA_BOAT_ONE);
@@ -209,9 +209,9 @@ void BattleGroundSA::StartShips()
{
for ( BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end();itr++)
{
- if(Player* p = objmgr.GetPlayer(itr->first))
+ if (Player* p = objmgr.GetPlayer(itr->first))
{
- if(p->GetTeamId() != attackers)
+ if (p->GetTeamId() != attackers)
continue;
UpdateData data;
@@ -230,23 +230,23 @@ void BattleGroundSA::Update(uint32 diff)
BattleGround::Update(diff);
TotalTime += diff;
- if(status == BG_SA_WARMUP || status == BG_SA_SECOND_WARMUP)
+ if (status == BG_SA_WARMUP || status == BG_SA_SECOND_WARMUP)
{
- if(TotalTime >= BG_SA_WARMUPLENGTH)
+ if (TotalTime >= BG_SA_WARMUPLENGTH)
{
TotalTime = 0;
ToggleTimer();
status = (status == BG_SA_WARMUP) ? BG_SA_ROUND_ONE : BG_SA_ROUND_TWO;
}
- if(TotalTime >= BG_SA_BOAT_START)
+ if (TotalTime >= BG_SA_BOAT_START)
StartShips();
return;
}
else if (GetStatus() == STATUS_IN_PROGRESS)
{
- if(status == BG_SA_ROUND_ONE)
+ if (status == BG_SA_ROUND_ONE)
{
- if(TotalTime >= BG_SA_ROUNDLENGTH)
+ if (TotalTime >= BG_SA_ROUNDLENGTH)
{
RoundScores[0].time = TotalTime;
TotalTime = 0;
@@ -259,23 +259,23 @@ void BattleGroundSA::Update(uint32 diff)
return;
}
}
- else if(status == BG_SA_ROUND_TWO)
+ else if (status == BG_SA_ROUND_TWO)
{
- if(TotalTime >= BG_SA_ROUNDLENGTH)
+ if (TotalTime >= BG_SA_ROUNDLENGTH)
{
RoundScores[1].time = TotalTime;
RoundScores[1].winner = (attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
if (RoundScores[0].time == RoundScores[1].time)
EndBattleGround(NULL);
- else if(RoundScores[0].time < RoundScores[1].time)
+ else if (RoundScores[0].time < RoundScores[1].time)
EndBattleGround(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
else
EndBattleGround(RoundScores[1].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
return;
}
}
- if(status == BG_SA_ROUND_ONE || status == BG_SA_ROUND_TWO)
+ if (status == BG_SA_ROUND_ONE || status == BG_SA_ROUND_TWO)
SendTime();
}
}
@@ -334,13 +334,13 @@ void BattleGroundSA::AddPlayer(Player *plr)
//create score and add it to map, default values are set in constructor
BattleGroundSAScore* sc = new BattleGroundSAScore;
- if(!ShipsStarted)
+ if (!ShipsStarted)
{
- if(plr->GetTeamId() == attackers)
+ if (plr->GetTeamId() == attackers)
{
plr->CastSpell(plr,12438,true);//Without this player falls before boat loads...
- if(urand(0,1))
+ if (urand(0,1))
plr->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
else
plr->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
@@ -351,7 +351,7 @@ void BattleGroundSA::AddPlayer(Player *plr)
}
else
{
- if(plr->GetTeamId() == attackers)
+ if (plr->GetTeamId() == attackers)
plr->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0);
else
plr->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
@@ -374,12 +374,12 @@ void BattleGroundSA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
void BattleGroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
- if(itr == m_PlayerScores.end()) // player not found...
+ if (itr == m_PlayerScores.end()) // player not found...
return;
- if(type == SCORE_DESTROYED_DEMOLISHER)
+ if (type == SCORE_DESTROYED_DEMOLISHER)
((BattleGroundSAScore*)itr->second)->demolishers_destroyed += value;
- else if(type == SCORE_DESTROYED_WALL)
+ else if (type == SCORE_DESTROYED_WALL)
((BattleGroundSAScore*)itr->second)->gates_destroyed += value;
else
BattleGround::UpdatePlayerScore(Source,type,value);
@@ -389,10 +389,10 @@ void BattleGroundSA::TeleportPlayers()
{
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
- if(Player *plr = objmgr.GetPlayer(itr->first))
+ if (Player *plr = objmgr.GetPlayer(itr->first))
{
// should remove spirit of redemption
- if(plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
+ if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if (!plr->isAlive())
@@ -405,11 +405,11 @@ void BattleGroundSA::TeleportPlayers()
plr->SetPower(POWER_MANA, plr->GetMaxPower(POWER_MANA));
plr->CombatStopWithPets(true);
- if(plr->GetTeamId() == attackers)
+ if (plr->GetTeamId() == attackers)
{
plr->CastSpell(plr,12438,true); //Without this player falls before boat loads...
- if(urand(0,1))
+ if (urand(0,1))
plr->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
else
plr->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
@@ -449,10 +449,10 @@ void BattleGroundSA::EventPlayerDamagedGO(Player* plr, GameObject* go, uint32 ev
void BattleGroundSA::HandleKillUnit(Creature* unit, Player* killer)
{
- if(!unit)
+ if (!unit)
return;
- if(unit->GetEntry() == 28781) //Demolisher
+ if (unit->GetEntry() == 28781) //Demolisher
UpdatePlayerScore(killer, SCORE_DESTROYED_DEMOLISHER, 1);
}
@@ -462,30 +462,30 @@ void BattleGroundSA::HandleKillUnit(Creature* unit, Player* killer)
*/
void BattleGroundSA::OverrideGunFaction()
{
- if(!m_BgCreatures[0])
+ if (!m_BgCreatures[0])
return;
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++)
{
- if(Creature* gun = GetBGCreature(i))
+ if (Creature* gun = GetBGCreature(i))
gun->setFaction(BG_SA_Factions[attackers? TEAM_ALLIANCE : TEAM_HORDE]);
}
for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4;i++)
{
- if(Creature* dem = GetBGCreature(i))
+ if (Creature* dem = GetBGCreature(i))
dem->setFaction(BG_SA_Factions[attackers]);
}
}
void BattleGroundSA::DestroyGate(uint32 i, Player* pl)
{
- if(!GateStatus[i])
+ if (!GateStatus[i])
return;
- if(GameObject* g = GetBGObject(i))
+ if (GameObject* g = GetBGObject(i))
{
- if(g->GetGOValue()->building.health == 0)
+ if (g->GetGOValue()->building.health == 0)
{
GateStatus[i] = BG_SA_GATE_DESTROYED;
uint32 uws;
@@ -514,7 +514,7 @@ void BattleGroundSA::DestroyGate(uint32 i, Player* pl)
break;
}
- if(i < 5)
+ if (i < 5)
DelObject(i+9);
UpdateWorldState(uws, GateStatus[i]);
UpdatePlayerScore(pl,SCORE_DESTROYED_WALL, 1);
@@ -531,7 +531,7 @@ WorldSafeLocsEntry const* BattleGroundSA::GetClosestGraveYard(Player* player)
player->GetPosition(x,y,z);
- if(player->GetTeamId() == attackers)
+ if (player->GetTeamId() == attackers)
safeloc = BG_SA_GYEntries[BG_SA_BEACH_GY];
else
safeloc = BG_SA_GYEntries[BG_SA_DEFENDER_LAST_GY];
@@ -541,11 +541,11 @@ WorldSafeLocsEntry const* BattleGroundSA::GetClosestGraveYard(Player* player)
for (uint8 i = BG_SA_RIGHT_CAPTURABLE_GY; i < BG_SA_MAX_GY; i++)
{
- if(GraveyardStatus[i] != player->GetTeamId())
+ if (GraveyardStatus[i] != player->GetTeamId())
continue;
dist = sqrt((ret->x - x)*(ret->x - x) + (ret->y - y)*(ret->y - y)+(ret->z - z)*(ret->z - z));
- if(dist < nearest)
+ if (dist < nearest)
{
ret = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
nearest = dist;
@@ -626,11 +626,11 @@ void BattleGroundSA::CaptureGraveyard(BG_SA_Graveyards i)
void BattleGroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
{
- if(object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC])
+ if (object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC])
{
- if(Source->GetTeamId() == attackers)
+ if (Source->GetTeamId() == attackers)
{
- if(status == BG_SA_ROUND_ONE)
+ if (status == BG_SA_ROUND_ONE)
{
RoundScores[0].winner = attackers;
RoundScores[0].time = TotalTime;
@@ -640,13 +640,13 @@ void BattleGroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
ToggleTimer();
ResetObjs();
}
- else if(status == BG_SA_ROUND_TWO)
+ else if (status == BG_SA_ROUND_TWO)
{
RoundScores[1].winner = attackers;
RoundScores[1].time = TotalTime;ToggleTimer();
- if(RoundScores[0].time == RoundScores[1].time)
+ if (RoundScores[0].time == RoundScores[1].time)
EndBattleGround(NULL);
- else if(RoundScores[0].time < RoundScores[1].time)
+ else if (RoundScores[0].time < RoundScores[1].time)
EndBattleGround(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
else
EndBattleGround(RoundScores[1].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp
index 6ac73567b07..58776e6b5b8 100644
--- a/src/game/BattleGroundWS.cpp
+++ b/src/game/BattleGroundWS.cpp
@@ -139,25 +139,25 @@ void BattleGroundWS::Update(uint32 diff)
m_BothFlagsKept = false;
}
}
- if(m_BothFlagsKept)
+ if (m_BothFlagsKept)
{
m_FlagSpellForceTimer += diff;
- if(m_FlagDebuffState == 0 && m_FlagSpellForceTimer >= 600000) //10 minutes
+ if (m_FlagDebuffState == 0 && m_FlagSpellForceTimer >= 600000) //10 minutes
{
- if(Player * plr = objmgr.GetPlayer(m_FlagKeepers[0]))
+ if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[0]))
plr->CastSpell(plr,WS_SPELL_FOCUSED_ASSAULT,true);
- if(Player * plr = objmgr.GetPlayer(m_FlagKeepers[1]))
+ if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[1]))
plr->CastSpell(plr,WS_SPELL_FOCUSED_ASSAULT,true);
m_FlagDebuffState = 1;
}
- else if(m_FlagDebuffState == 1 && m_FlagSpellForceTimer >= 900000) //15 minutes
+ else if (m_FlagDebuffState == 1 && m_FlagSpellForceTimer >= 900000) //15 minutes
{
- if(Player * plr = objmgr.GetPlayer(m_FlagKeepers[0]))
+ if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[0]))
{
plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
plr->CastSpell(plr,WS_SPELL_BRUTAL_ASSAULT,true);
}
- if(Player * plr = objmgr.GetPlayer(m_FlagKeepers[1]))
+ if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[1]))
{
plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
plr->CastSpell(plr,WS_SPELL_BRUTAL_ASSAULT,true);
@@ -282,9 +282,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
- if(m_FlagDebuffState == 1)
+ if (m_FlagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
- if(m_FlagDebuffState == 2)
+ if (m_FlagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(ALLIANCE, 1);
@@ -300,9 +300,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
- if(m_FlagDebuffState == 1)
+ if (m_FlagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
- if(m_FlagDebuffState == 2)
+ if (m_FlagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(HORDE, 1);
@@ -325,7 +325,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
- if(!m_FirstFlagCaptureTeam)
+ if (!m_FirstFlagCaptureTeam)
SetFirstFlagCapture(Source->GetTeam());
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
@@ -390,9 +390,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
{
SetHordeFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
- if(m_FlagDebuffState == 1)
+ if (m_FlagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
- if(m_FlagDebuffState == 2)
+ if (m_FlagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND;
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
@@ -407,9 +407,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
{
SetAllianceFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
- if(m_FlagDebuffState == 1)
+ if (m_FlagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
- if(m_FlagDebuffState == 2)
+ if (m_FlagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND;
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
@@ -446,7 +446,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
ChatMsg type;
//alliance flag picked up from base
- if(Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
+ if (Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
&& this->m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID())
{
message_id = LANG_BG_WS_PICKEDUP_AF;
@@ -459,7 +459,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
- if(m_FlagState[1] == BG_WS_FLAG_STATE_ON_PLAYER)
+ if (m_FlagState[1] == BG_WS_FLAG_STATE_ON_PLAYER)
m_BothFlagsKept = true;
}
@@ -477,7 +477,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
- if(m_FlagState[0] == BG_WS_FLAG_STATE_ON_PLAYER)
+ if (m_FlagState[0] == BG_WS_FLAG_STATE_ON_PLAYER)
m_BothFlagsKept = true;
}
@@ -505,9 +505,9 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
- if(m_FlagDebuffState == 1)
+ if (m_FlagDebuffState == 1)
Source->CastSpell(Source,WS_SPELL_FOCUSED_ASSAULT,true);
- if(m_FlagDebuffState == 2)
+ if (m_FlagDebuffState == 2)
Source->CastSpell(Source,WS_SPELL_BRUTAL_ASSAULT,true);
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
}
@@ -539,9 +539,9 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
- if(m_FlagDebuffState == 1)
+ if (m_FlagDebuffState == 1)
Source->CastSpell(Source,WS_SPELL_FOCUSED_ASSAULT,true);
- if(m_FlagDebuffState == 2)
+ if (m_FlagDebuffState == 2)
Source->CastSpell(Source,WS_SPELL_BRUTAL_ASSAULT,true);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
}
@@ -758,7 +758,7 @@ void BattleGroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
- if(itr == m_PlayerScores.end()) // player not found
+ if (itr == m_PlayerScores.end()) // player not found
return;
switch(type)
diff --git a/src/game/Cell.h b/src/game/Cell.h
index 78b12f1bf35..23d5f56c417 100644
--- a/src/game/Cell.h
+++ b/src/game/Cell.h
@@ -79,29 +79,29 @@ struct Cell
Compute(x, y);
cell.Compute(old_x, old_y);
- if( std::abs(int(x-old_x)) > 1 || std::abs(int(y-old_y)) > 1)
+ if ( std::abs(int(x-old_x)) > 1 || std::abs(int(y-old_y)) > 1)
{
data.Part.reserved = ALL_DISTRICT;
cell.data.Part.reserved = ALL_DISTRICT;
return;
}
- if( x < old_x )
+ if ( x < old_x )
{
data.Part.reserved |= LEFT_DISTRICT;
cell.data.Part.reserved |= RIGHT_DISTRICT;
}
- else if( old_x < x )
+ else if ( old_x < x )
{
data.Part.reserved |= RIGHT_DISTRICT;
cell.data.Part.reserved |= LEFT_DISTRICT;
}
- if( y < old_y )
+ if ( y < old_y )
{
data.Part.reserved |= UPPER_DISTRICT;
cell.data.Part.reserved |= LOWER_DISTRICT;
}
- else if( old_y < y )
+ else if ( old_y < y )
{
data.Part.reserved |= LOWER_DISTRICT;
cell.data.Part.reserved |= UPPER_DISTRICT;
diff --git a/src/game/CellImpl.h b/src/game/CellImpl.h
index 5ab4859541a..dad233722e4 100644
--- a/src/game/CellImpl.h
+++ b/src/game/CellImpl.h
@@ -45,7 +45,7 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v
return;
uint16 district = (District)this->data.Part.reserved;
- if(district == CENTER_DISTRICT)
+ if (district == CENTER_DISTRICT)
{
m.Visit(*this, visitor);
return;
@@ -132,7 +132,7 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v
inline int CellHelper(const float radius)
{
- if(radius < 1.0f)
+ if (radius < 1.0f)
return 0;
return (int)ceilf(radius/SIZE_OF_GRID_CELL);
@@ -145,7 +145,7 @@ inline CellArea Cell::CalculateCellArea(const WorldObject &obj, float radius)
inline CellArea Cell::CalculateCellArea(float x, float y, float radius)
{
- if(radius <= 0.0f)
+ if (radius <= 0.0f)
return CellArea();
//lets calculate object coord offsets from cell borders.
@@ -222,7 +222,7 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v
{
CellPair cell_pair(x,y);
//lets skip standing cell since we already visited it
- if(cell_pair != standing_cell)
+ if (cell_pair != standing_cell)
{
Cell r_zone(cell_pair);
r_zone.data.Part.nocreate = this->data.Part.nocreate;
@@ -265,7 +265,7 @@ Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const Cel
//if x_shift == 0 then we have too small cell area, which were already
//visited at previous step, so just return from procedure...
- if(x_shift == 0)
+ if (x_shift == 0)
return;
uint32 y_start = end_cell.y_coord;
diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp
index c09a6fc30e8..f8f59e596fb 100644
--- a/src/game/Channel.cpp
+++ b/src/game/Channel.cpp
@@ -29,20 +29,20 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
{
// set special flags if built-in channel
ChatChannelsEntry const* ch = GetChannelEntryFor(channel_id);
- if(ch) // it's built-in channel
+ if (ch) // it's built-in channel
{
channel_id = ch->ChannelID; // built-in channel
m_announce = false; // no join/leave announces
m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels
- if(ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
+ if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
m_flags |= CHANNEL_FLAG_TRADE;
- if(ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
+ if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
m_flags |= CHANNEL_FLAG_CITY;
- if(ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
+ if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
m_flags |= CHANNEL_FLAG_LFG;
else // for all other channels
m_flags |= CHANNEL_FLAG_NOT_LFG;
@@ -75,7 +75,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
for (iter = tokens.begin(); iter != tokens.end(); ++iter)
{
uint64 banned_guid = atol((*iter).c_str());
- if(banned_guid)
+ if (banned_guid)
{
sLog.outDebug("Channel(%s) loaded banned guid: %u",name.c_str(), banned_guid);
banned.insert(banned_guid);
@@ -134,9 +134,9 @@ void Channel::_UpdateBanListInDB() const
void Channel::Join(uint64 p, const char *pass)
{
WorldPacket data;
- if(IsOn(p))
+ if (IsOn(p))
{
- if(!IsConstant()) // non send error message for built-in channels
+ if (!IsConstant()) // non send error message for built-in channels
{
MakePlayerAlreadyMember(&data, p);
SendToOne(&data, p);
@@ -144,14 +144,14 @@ void Channel::Join(uint64 p, const char *pass)
return;
}
- if(IsBanned(p))
+ if (IsBanned(p))
{
MakeBanned(&data);
SendToOne(&data, p);
return;
}
- if(m_password.length() > 0 && strcmp(pass, m_password.c_str()))
+ if (m_password.length() > 0 && strcmp(pass, m_password.c_str()))
{
MakeWrongPassword(&data);
SendToOne(&data, p);
@@ -160,9 +160,9 @@ void Channel::Join(uint64 p, const char *pass)
Player *plr = objmgr.GetPlayer(p);
- if(plr)
+ if (plr)
{
- if(HasFlag(CHANNEL_FLAG_LFG) &&
+ if (HasFlag(CHANNEL_FLAG_LFG) &&
sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER &&
(plr->GetGroup() || plr->m_lookingForGroup.Empty()) )
{
@@ -171,13 +171,13 @@ void Channel::Join(uint64 p, const char *pass)
return;
}
- if(plr->GetGuildId() && (GetFlags() == 0x38))
+ if (plr->GetGuildId() && (GetFlags() == 0x38))
return;
plr->JoinedChannel(this);
}
- if(m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ))
+ if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ))
{
MakeJoined(&data, p);
SendToAll(&data);
@@ -196,13 +196,13 @@ void Channel::Join(uint64 p, const char *pass)
JoinNotify(p);
// if no owner first logged will become
- if(!IsConstant() && !m_ownerGUID)
+ if (!IsConstant() && !m_ownerGUID)
{
SetOwner(p, (players.size() > 1 ? true : false));
players[p].SetModerator(true);
}
/*
- else if(!IsConstant() && m_ownerGUID && plr && m_ownerGUID == plr->GetGUID() ))
+ else if (!IsConstant() && m_ownerGUID && plr && m_ownerGUID == plr->GetGUID() ))
{
SetOwner(p, (players.size() > 1 ? true : false));
players[p].SetModerator(true);
@@ -211,9 +211,9 @@ void Channel::Join(uint64 p, const char *pass)
void Channel::Leave(uint64 p, bool send)
{
- if(!IsOn(p))
+ if (!IsOn(p))
{
- if(send)
+ if (send)
{
WorldPacket data;
MakeNotMember(&data);
@@ -224,12 +224,12 @@ void Channel::Leave(uint64 p, bool send)
{
Player *plr = objmgr.GetPlayer(p);
- if(send)
+ if (send)
{
WorldPacket data;
MakeYouLeft(&data);
SendToOne(&data, p);
- if(plr)
+ if (plr)
plr->LeftChannel(this);
data.clear();
}
@@ -237,7 +237,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.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ))
+ if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ))
{
WorldPacket data;
MakeLeft(&data, p);
@@ -246,7 +246,7 @@ void Channel::Leave(uint64 p, bool send)
LeaveNotify(p);
- if(changeowner)
+ if (changeowner)
{
uint64 newowner = !players.empty() ? players.begin()->second.player : 0;
players[newowner].SetModerator(true);
@@ -259,16 +259,16 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
{
AccountTypes sec = SEC_PLAYER;
Player *gplr = objmgr.GetPlayer(good);
- if(gplr)
+ if (gplr)
sec = gplr->GetSession()->GetSecurity();
- if(!IsOn(good))
+ if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
}
- else if(!players[good].IsModerator() && sec < SEC_GAMEMASTER)
+ else if (!players[good].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -277,13 +277,13 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
else
{
Player *bad = objmgr.GetPlayer(badname);
- if(bad == NULL || !IsOn(bad->GetGUID()))
+ if (bad == NULL || !IsOn(bad->GetGUID()))
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
SendToOne(&data, good);
}
- else if(sec < SEC_GAMEMASTER && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID)
+ else if (sec < SEC_GAMEMASTER && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID)
{
WorldPacket data;
MakeNotOwner(&data);
@@ -295,7 +295,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
WorldPacket data;
- if(ban && !IsBanned(bad->GetGUID()))
+ if (ban && !IsBanned(bad->GetGUID()))
{
banned.insert(bad->GetGUID());
MakePlayerBanned(&data, bad->GetGUID(), good);
@@ -309,7 +309,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
players.erase(bad->GetGUID());
bad->LeftChannel(this);
- if(changeowner)
+ if (changeowner)
{
uint64 newowner = !players.empty() ? good : false;
players[newowner].SetModerator(true);
@@ -323,16 +323,16 @@ void Channel::UnBan(uint64 good, const char *badname)
{
uint32 sec = 0;
Player *gplr = objmgr.GetPlayer(good);
- if(gplr)
+ if (gplr)
sec = gplr->GetSession()->GetSecurity();
- if(!IsOn(good))
+ if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
}
- else if(!players[good].IsModerator() && sec < SEC_GAMEMASTER)
+ else if (!players[good].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -341,7 +341,7 @@ void Channel::UnBan(uint64 good, const char *badname)
else
{
Player *bad = objmgr.GetPlayer(badname);
- if(bad == NULL || !IsBanned(bad->GetGUID()))
+ if (bad == NULL || !IsBanned(bad->GetGUID()))
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
@@ -365,24 +365,24 @@ void Channel::Password(uint64 p, const char *pass)
std::string plName;
uint32 sec = 0;
Player *plr = objmgr.GetPlayer(p);
- if(plr)
+ if (plr)
sec = plr->GetSession()->GetSecurity();
ChatHandler chat(plr);
- if(!m_public && sec <= SEC_MODERATOR)
+ if (!m_public && sec <= SEC_MODERATOR)
{
chat.PSendSysMessage(LANG_CHANNEL_NOT_PUBLIC);
return;
}
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
- else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
+ else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -408,13 +408,13 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
uint32 sec = plr->GetSession()->GetSecurity();
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
- else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
+ else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -423,7 +423,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
else
{
Player *newp = objmgr.GetPlayer(p2n);
- if(!newp)
+ if (!newp)
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
@@ -432,10 +432,10 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
}
PlayerInfo inf = players[newp->GetGUID()];
- if(p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod)
+ if (p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod)
return;
- if(!IsOn(newp->GetGUID()))
+ if (!IsOn(newp->GetGUID()))
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
@@ -445,7 +445,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 ( (plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) &&
plr->GetTeam() != newp->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL) )
{
WorldPacket data;
@@ -454,7 +454,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
return;
}
- if(m_ownerGUID == newp->GetGUID() && m_ownerGUID != p)
+ if (m_ownerGUID == newp->GetGUID() && m_ownerGUID != p)
{
WorldPacket data;
MakeNotOwner(&data);
@@ -462,7 +462,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
return;
}
- if(mod)
+ if (mod)
SetModerator(newp->GetGUID(), set);
else
SetMute(newp->GetGUID(), set);
@@ -477,7 +477,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
uint32 sec = plr->GetSession()->GetSecurity();
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@@ -485,7 +485,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
return;
}
- if(sec < SEC_GAMEMASTER && p != m_ownerGUID)
+ if (sec < SEC_GAMEMASTER && p != m_ownerGUID)
{
WorldPacket data;
MakeNotOwner(&data);
@@ -494,7 +494,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
}
Player *newp = objmgr.GetPlayer(newname);
- if(newp == NULL || !IsOn(newp->GetGUID()))
+ if (newp == NULL || !IsOn(newp->GetGUID()))
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
@@ -502,7 +502,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
return;
}
- if(newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
+ if (newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
@@ -516,7 +516,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
void Channel::SendWhoOwner(uint64 p)
{
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@@ -534,7 +534,7 @@ void Channel::List(Player* player)
{
uint64 p = player->GetGUID();
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@@ -578,16 +578,16 @@ void Channel::Announce(uint64 p)
{
uint32 sec = 0;
Player *plr = objmgr.GetPlayer(p);
- if(plr)
+ if (plr)
sec = plr->GetSession()->GetSecurity();
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
- else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
+ else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -598,7 +598,7 @@ void Channel::Announce(uint64 p)
m_announce = !m_announce;
WorldPacket data;
- if(m_announce)
+ if (m_announce)
MakeAnnouncementsOn(&data, p);
else
MakeAnnouncementsOff(&data, p);
@@ -613,16 +613,16 @@ void Channel::Moderate(uint64 p)
{
uint32 sec = 0;
Player *plr = objmgr.GetPlayer(p);
- if(plr)
+ if (plr)
sec = plr->GetSession()->GetSecurity();
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
- else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
+ else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -633,7 +633,7 @@ void Channel::Moderate(uint64 p)
m_moderate = !m_moderate;
WorldPacket data;
- if(m_moderate)
+ if (m_moderate)
MakeModerationOn(&data, p);
else
MakeModerationOff(&data, p);
@@ -645,29 +645,29 @@ void Channel::Moderate(uint64 p)
void Channel::Say(uint64 p, const char *what, uint32 lang)
{
- if(!what)
+ if (!what)
return;
if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
lang = LANG_UNIVERSAL;
uint32 sec = 0;
Player *plr = objmgr.GetPlayer(p);
- if(plr)
+ if (plr)
sec = plr->GetSession()->GetSecurity();
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
- else if(players[p].IsMuted())
+ else if (players[p].IsMuted())
{
WorldPacket data;
MakeMuted(&data);
SendToOne(&data, p);
}
- else if(m_moderate && !players[p].IsModerator() && sec < SEC_GAMEMASTER)
+ else if (m_moderate && !players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -694,7 +694,7 @@ void Channel::Say(uint64 p, const char *what, uint32 lang)
void Channel::Invite(uint64 p, const char *newname)
{
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@@ -703,7 +703,7 @@ void Channel::Invite(uint64 p, const char *newname)
}
Player *newp = objmgr.GetPlayer(newname);
- if(!newp)
+ if (!newp)
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
@@ -723,7 +723,7 @@ void Channel::Invite(uint64 p, const char *newname)
return;
}
- if(IsOn(newp->GetGUID()))
+ if (IsOn(newp->GetGUID()))
{
WorldPacket data;
MakePlayerAlreadyMember(&data, newp->GetGUID());
@@ -732,7 +732,7 @@ void Channel::Invite(uint64 p, const char *newname)
}
WorldPacket data;
- if(!newp->GetSocial()->HasIgnore(GUID_LOPART(p)))
+ if (!newp->GetSocial()->HasIgnore(GUID_LOPART(p)))
{
MakeInvite(&data, p);
SendToOne(&data, newp->GetGUID());
@@ -744,16 +744,16 @@ void Channel::Invite(uint64 p, const char *newname)
void Channel::SetOwner(uint64 guid, bool exclaim)
{
- if(m_ownerGUID)
+ if (m_ownerGUID)
{
// [] will re-add player after it possible removed
PlayerList::iterator p_itr = players.find(m_ownerGUID);
- if(p_itr != players.end())
+ if (p_itr != players.end())
p_itr->second.SetOwner(false);
}
m_ownerGUID = guid;
- if(m_ownerGUID)
+ if (m_ownerGUID)
{
uint8 oldFlag = GetPlayerFlags(m_ownerGUID);
players[m_ownerGUID].SetModerator(true);
@@ -763,7 +763,7 @@ void Channel::SetOwner(uint64 guid, bool exclaim)
MakeModeChange(&data, m_ownerGUID, oldFlag);
SendToAll(&data);
- if(exclaim)
+ if (exclaim)
{
MakeOwnerChanged(&data, m_ownerGUID);
SendToAll(&data);
@@ -779,9 +779,9 @@ void Channel::SendToAll(WorldPacket *data, uint64 p)
for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
{
Player *plr = objmgr.GetPlayer(i->first);
- if(plr)
+ if (plr)
{
- if(!p || !plr->GetSocial()->HasIgnore(GUID_LOPART(p)))
+ if (!p || !plr->GetSocial()->HasIgnore(GUID_LOPART(p)))
plr->GetSession()->SendPacket(data);
}
}
@@ -791,10 +791,10 @@ void Channel::SendToAllButOne(WorldPacket *data, uint64 who)
{
for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
{
- if(i->first != who)
+ if (i->first != who)
{
Player *plr = objmgr.GetPlayer(i->first);
- if(plr)
+ if (plr)
plr->GetSession()->SendPacket(data);
}
}
@@ -803,7 +803,7 @@ void Channel::SendToAllButOne(WorldPacket *data, uint64 who)
void Channel::SendToOne(WorldPacket *data, uint64 who)
{
Player *plr = objmgr.GetPlayer(who);
- if(plr)
+ if (plr)
plr->GetSession()->SendPacket(data);
}
@@ -906,7 +906,7 @@ void Channel::MakeChannelOwner(WorldPacket *data)
{
std::string name = "";
- if(!objmgr.GetPlayerNameByGUID(m_ownerGUID, name) || name.empty())
+ if (!objmgr.GetPlayerNameByGUID(m_ownerGUID, name) || name.empty())
name = "PLAYER_NOT_FOUND";
MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE);
@@ -1081,7 +1081,7 @@ void Channel::JoinNotify(uint64 guid)
{
WorldPacket data;
- if(IsConstant())
+ if (IsConstant())
data.Initialize(SMSG_USERLIST_ADD, 8+1+1+4+GetName().size()+1);
else
data.Initialize(SMSG_USERLIST_UPDATE, 8+1+1+4+GetName().size()+1);
diff --git a/src/game/Channel.h b/src/game/Channel.h
index 680cfed3296..d0b5923e30e 100644
--- a/src/game/Channel.h
+++ b/src/game/Channel.h
@@ -126,23 +126,23 @@ class Channel
uint8 flags;
bool HasFlag(uint8 flag) { return flags & flag; }
- void SetFlag(uint8 flag) { if(!HasFlag(flag)) flags |= flag; }
+ void SetFlag(uint8 flag) { if (!HasFlag(flag)) flags |= flag; }
bool IsOwner() { return flags & MEMBER_FLAG_OWNER; }
void SetOwner(bool state)
{
- if(state) flags |= MEMBER_FLAG_OWNER;
+ if (state) flags |= MEMBER_FLAG_OWNER;
else flags &= ~MEMBER_FLAG_OWNER;
}
bool IsModerator() { return flags & MEMBER_FLAG_MODERATOR; }
void SetModerator(bool state)
{
- if(state) flags |= MEMBER_FLAG_MODERATOR;
+ if (state) flags |= MEMBER_FLAG_MODERATOR;
else flags &= ~MEMBER_FLAG_MODERATOR;
}
bool IsMuted() { return flags & MEMBER_FLAG_MUTED; }
void SetMuted(bool state)
{
- if(state) flags |= MEMBER_FLAG_MUTED;
+ if (state) flags |= MEMBER_FLAG_MUTED;
else flags &= ~MEMBER_FLAG_MUTED;
}
};
@@ -216,7 +216,7 @@ class Channel
uint8 GetPlayerFlags(uint64 p) const
{
PlayerList::const_iterator p_itr = players.find(p);
- if(p_itr == players.end())
+ if (p_itr == players.end())
return 0;
return p_itr->second.flags;
@@ -224,7 +224,7 @@ class Channel
void SetModerator(uint64 p, bool set)
{
- if(players[p].IsModerator() != set)
+ if (players[p].IsModerator() != set)
{
uint8 oldFlag = GetPlayerFlags(p);
players[p].SetModerator(set);
@@ -237,7 +237,7 @@ class Channel
void SetMute(uint64 p, bool set)
{
- if(players[p].IsMuted() != set)
+ if (players[p].IsMuted() != set)
{
uint8 oldFlag = GetPlayerFlags(p);
players[p].SetMuted(set);
diff --git a/src/game/ChannelHandler.cpp b/src/game/ChannelHandler.cpp
index e9e333ac387..0f615579cb6 100644
--- a/src/game/ChannelHandler.cpp
+++ b/src/game/ChannelHandler.cpp
@@ -34,14 +34,14 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket)
recvPacket >> channel_id >> unknown1 >> unknown2;
recvPacket >> channelname;
- if(channelname.empty())
+ if (channelname.empty())
return;
recvPacket >> pass;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
cMgr->team = _player->GetTeam();
- if(Channel *chn = cMgr->GetJoinChannel(channelname, channel_id))
+ if (Channel *chn = cMgr->GetJoinChannel(channelname, channel_id))
chn->Join(_player->GetGUID(), pass.c_str());
}
}
@@ -56,12 +56,12 @@ void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket)
recvPacket >> unk; // channel id?
recvPacket >> channelname;
- if(channelname.empty())
+ if (channelname.empty())
return;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Leave(_player->GetGUID(), true);
cMgr->LeftChannel(channelname);
}
@@ -74,8 +74,8 @@ void WorldSession::HandleChannelList(WorldPacket& recvPacket)
std::string channelname;
recvPacket >> channelname;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->List(_player);
}
@@ -88,8 +88,8 @@ void WorldSession::HandleChannelPassword(WorldPacket& recvPacket)
recvPacket >> pass;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Password(_player->GetGUID(), pass.c_str());
}
@@ -102,11 +102,11 @@ void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket)
recvPacket >> newp;
- if(!normalizePlayerName(newp))
+ if (!normalizePlayerName(newp))
return;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->SetOwner(_player->GetGUID(), newp.c_str());
}
@@ -116,8 +116,8 @@ void WorldSession::HandleChannelOwner(WorldPacket& recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->SendWhoOwner(_player->GetGUID());
}
@@ -130,11 +130,11 @@ void WorldSession::HandleChannelModerator(WorldPacket& recvPacket)
recvPacket >> otp;
- if(!normalizePlayerName(otp))
+ if (!normalizePlayerName(otp))
return;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->SetModerator(_player->GetGUID(), otp.c_str());
}
@@ -147,11 +147,11 @@ void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket)
recvPacket >> otp;
- if(!normalizePlayerName(otp))
+ if (!normalizePlayerName(otp))
return;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->UnsetModerator(_player->GetGUID(), otp.c_str());
}
@@ -164,11 +164,11 @@ void WorldSession::HandleChannelMute(WorldPacket& recvPacket)
recvPacket >> otp;
- if(!normalizePlayerName(otp))
+ if (!normalizePlayerName(otp))
return;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->SetMute(_player->GetGUID(), otp.c_str());
}
@@ -182,11 +182,11 @@ void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket)
recvPacket >> otp;
- if(!normalizePlayerName(otp))
+ if (!normalizePlayerName(otp))
return;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->UnsetMute(_player->GetGUID(), otp.c_str());
}
@@ -199,11 +199,11 @@ void WorldSession::HandleChannelInvite(WorldPacket& recvPacket)
recvPacket >> otp;
- if(!normalizePlayerName(otp))
+ if (!normalizePlayerName(otp))
return;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Invite(_player->GetGUID(), otp.c_str());
}
@@ -215,11 +215,11 @@ void WorldSession::HandleChannelKick(WorldPacket& recvPacket)
recvPacket >> channelname;
recvPacket >> otp;
- if(!normalizePlayerName(otp))
+ if (!normalizePlayerName(otp))
return;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Kick(_player->GetGUID(), otp.c_str());
}
@@ -232,11 +232,11 @@ void WorldSession::HandleChannelBan(WorldPacket& recvPacket)
recvPacket >> otp;
- if(!normalizePlayerName(otp))
+ if (!normalizePlayerName(otp))
return;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Ban(_player->GetGUID(), otp.c_str());
}
@@ -250,11 +250,11 @@ void WorldSession::HandleChannelUnban(WorldPacket& recvPacket)
recvPacket >> otp;
- if(!normalizePlayerName(otp))
+ if (!normalizePlayerName(otp))
return;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->UnBan(_player->GetGUID(), otp.c_str());
}
@@ -264,8 +264,8 @@ void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Announce(_player->GetGUID());
}
@@ -275,8 +275,8 @@ void WorldSession::HandleChannelModerate(WorldPacket& recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Moderate(_player->GetGUID());
}
@@ -286,8 +286,8 @@ void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->List(_player);
}
@@ -297,9 +297,9 @@ void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
{
WorldPacket data(SMSG_CHANNEL_MEMBER_COUNT, chn->GetName().size()+1+1+4);
data << chn->GetName();
@@ -316,8 +316,8 @@ void WorldSession::HandleSetChannelWatch(WorldPacket &recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
- /*if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if(Channel *chn = cMgr->GetChannel(channelname, _player))
+ /*if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->JoinNotify(_player->GetGUID());*/
}
diff --git a/src/game/ChannelMgr.cpp b/src/game/ChannelMgr.cpp
index 90c1b62f69a..18011a742ee 100644
--- a/src/game/ChannelMgr.cpp
+++ b/src/game/ChannelMgr.cpp
@@ -28,9 +28,9 @@ ChannelMgr* channelMgr(uint32 team)
if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
return &Trinity::Singleton<AllianceChannelMgr>::Instance(); // cross-faction
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
return &Trinity::Singleton<AllianceChannelMgr>::Instance();
- if(team == HORDE)
+ if (team == HORDE)
return &Trinity::Singleton<HordeChannelMgr>::Instance();
return NULL;
@@ -68,9 +68,9 @@ Channel *ChannelMgr::GetChannel(std::string name, Player *p, bool pkt)
ChannelMap::const_iterator i = channels.find(wname);
- if(i == channels.end())
+ if (i == channels.end())
{
- if(pkt)
+ if (pkt)
{
WorldPacket data;
MakeNotOnPacket(&data,name);
@@ -91,12 +91,12 @@ void ChannelMgr::LeftChannel(std::string name)
ChannelMap::const_iterator i = channels.find(wname);
- if(i == channels.end())
+ if (i == channels.end())
return;
Channel* channel = i->second;
- if(channel->GetNumPlayers() == 0 && !channel->IsConstant())
+ if (channel->GetNumPlayers() == 0 && !channel->IsConstant())
{
channels.erase(wname);
delete channel;
diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp
index 3b0981422c8..58952daaa72 100644
--- a/src/game/CharacterHandler.cpp
+++ b/src/game/CharacterHandler.cpp
@@ -84,7 +84,7 @@ bool LoginQueryHolder::Initialize()
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, "SELECT map,zone,position_x,position_y,position_z FROM character_homebind WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS, "SELECT spell,item,time FROM character_spell_cooldown WHERE guid = '%u'", GUID_LOPART(m_guid));
- if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED))
+ if (sWorld.getConfig(CONFIG_DECLINED_NAMES_USED))
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = '%u'",GUID_LOPART(m_guid));
// in other case still be dummy query
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGUILD, "SELECT guildid,rank FROM guild_member WHERE guid = '%u'", GUID_LOPART(m_guid));
@@ -111,7 +111,7 @@ class CharacterHandler
void HandleCharEnumCallback(QueryResult_AutoPtr result, uint32 account)
{
WorldSession * session = sWorld.FindSession(account);
- if(!session)
+ if (!session)
return;
session->HandleCharEnum(result);
}
@@ -119,7 +119,7 @@ class CharacterHandler
{
if (!holder) return;
WorldSession *session = sWorld.FindSession(((LoginQueryHolder*)holder)->GetAccountId());
- if(!session)
+ if (!session)
{
delete holder;
return;
@@ -136,13 +136,13 @@ void WorldSession::HandleCharEnum(QueryResult_AutoPtr result)
data << num;
- if( result )
+ if ( result )
{
do
{
uint32 guidlow = (*result)[0].GetUInt32();
sLog.outDetail("Loading char guid %u from account %u.",guidlow,GetAccountId());
- if(Player::BuildEnumData(result, &data))
+ if (Player::BuildEnumData(result, &data))
++num;
}
while ( result->NextRow() );
@@ -195,9 +195,9 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
WorldPacket data(SMSG_CHAR_CREATE, 1); // returned with diff.values in all cases
- if(GetSecurity() == SEC_PLAYER)
+ if (GetSecurity() == SEC_PLAYER)
{
- if(uint32 mask = sWorld.getConfig(CONFIG_CHARACTERS_CREATING_DISABLED))
+ if (uint32 mask = sWorld.getConfig(CONFIG_CHARACTERS_CREATING_DISABLED))
{
bool disabled = false;
@@ -208,7 +208,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
case HORDE: disabled = mask & (1<<1); break;
}
- if(disabled)
+ if (disabled)
{
data << (uint8)CHAR_CREATE_DISABLED;
SendPacket( &data );
@@ -220,7 +220,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_);
ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_);
- if( !classEntry || !raceEntry )
+ if ( !classEntry || !raceEntry )
{
data << (uint8)CHAR_CREATE_FAILED;
SendPacket( &data );
@@ -309,7 +309,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
// speedup check for heroic class disabled case
uint32 heroic_free_slots = sWorld.getConfig(CONFIG_HEROIC_CHARACTERS_PER_REALM);
- if(heroic_free_slots==0 && GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
+ if (heroic_free_slots==0 && GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
@@ -318,7 +318,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
// speedup check for heroic class disabled case
uint32 req_level_for_heroic = sWorld.getConfig(CONFIG_MIN_LEVEL_FOR_HEROIC_CHARACTER_CREATING);
- if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
+ if (GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
{
data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT;
SendPacket( &data );
@@ -333,26 +333,26 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
// if 0 then allowed creating without any characters
bool have_req_level_for_heroic = (req_level_for_heroic==0);
- if(!AllowTwoSideAccounts || skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT)
+ if (!AllowTwoSideAccounts || skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT)
{
QueryResult_AutoPtr result2 = CharacterDatabase.PQuery("SELECT level,race,class FROM characters WHERE account = '%u' %s",
GetAccountId(), (skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT) ? "" : "LIMIT 1");
- if(result2)
+ if (result2)
{
uint32 team_= Player::TeamForRace(race_);
Field* field = result2->Fetch();
uint8 acc_race = field[1].GetUInt32();
- if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
+ if (GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
{
uint8 acc_class = field[2].GetUInt32();
- if(acc_class == CLASS_DEATH_KNIGHT)
+ if (acc_class == CLASS_DEATH_KNIGHT)
{
- if(heroic_free_slots > 0)
+ if (heroic_free_slots > 0)
--heroic_free_slots;
- if(heroic_free_slots==0)
+ if (heroic_free_slots==0)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
@@ -360,10 +360,10 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
}
}
- if(!have_req_level_for_heroic)
+ if (!have_req_level_for_heroic)
{
uint32 acc_level = field[0].GetUInt32();
- if(acc_level >= req_level_for_heroic)
+ if (acc_level >= req_level_for_heroic)
have_req_level_for_heroic = true;
}
}
@@ -373,10 +373,10 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
if (!AllowTwoSideAccounts)
{
uint32 acc_team=0;
- if(acc_race > 0)
+ if (acc_race > 0)
acc_team = Player::TeamForRace(acc_race);
- if(acc_team != team_)
+ if (acc_team != team_)
{
data << (uint8)CHAR_CREATE_PVP_TEAMS_VIOLATION;
SendPacket( &data );
@@ -388,24 +388,24 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
// TODO: check if cinematic already shown? (already logged in?; cinematic field)
while ((skipCinematics == 1 && !have_same_race) || class_ == CLASS_DEATH_KNIGHT)
{
- if(!result2->NextRow())
+ if (!result2->NextRow())
break;
field = result2->Fetch();
acc_race = field[1].GetUInt32();
- if(!have_same_race)
+ if (!have_same_race)
have_same_race = race_ == acc_race;
- if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
+ if (GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
{
uint8 acc_class = field[2].GetUInt32();
- if(acc_class == CLASS_DEATH_KNIGHT)
+ if (acc_class == CLASS_DEATH_KNIGHT)
{
- if(heroic_free_slots > 0)
+ if (heroic_free_slots > 0)
--heroic_free_slots;
- if(heroic_free_slots==0)
+ if (heroic_free_slots==0)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
@@ -413,10 +413,10 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
}
}
- if(!have_req_level_for_heroic)
+ if (!have_req_level_for_heroic)
{
uint32 acc_level = field[0].GetUInt32();
- if(acc_level >= req_level_for_heroic)
+ if (acc_level >= req_level_for_heroic)
have_req_level_for_heroic = true;
}
}
@@ -424,7 +424,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
}
}
- if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && !have_req_level_for_heroic)
+ if (GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && !have_req_level_for_heroic)
{
data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT;
SendPacket( &data );
@@ -436,7 +436,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
recv_data >> gender >> skin >> face;
recv_data >> hairStyle >> hairColor >> facialHair >> outfitId;
- if(recv_data.rpos() < recv_data.wpos())
+ if (recv_data.rpos() < recv_data.wpos())
{
uint8 unk;
recv_data >> unk;
@@ -444,7 +444,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
}
Player * pNewChar = new Player(this);
- if(!pNewChar->Create( objmgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId ))
+ if (!pNewChar->Create( objmgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId ))
{
// Player not create (race/class problem?)
pNewChar->CleanupsBeforeDelete();
@@ -485,14 +485,14 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
recv_data >> guid;
// can't delete loaded character
- if(objmgr.GetPlayer(guid))
+ if (objmgr.GetPlayer(guid))
return;
uint32 accountId = 0;
std::string name;
// is guild leader
- if(objmgr.GetGuildByLeader(guid))
+ if (objmgr.GetGuildByLeader(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
data << (uint8)CHAR_DELETE_FAILED_GUILD_LEADER;
@@ -501,7 +501,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
}
// is arena team captain
- if(objmgr.GetArenaTeamByCaptain(guid))
+ if (objmgr.GetArenaTeamByCaptain(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
data << (uint8)CHAR_DELETE_FAILED_ARENA_CAPTAIN;
@@ -510,7 +510,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
}
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT account,name FROM characters WHERE guid='%u'", GUID_LOPART(guid));
- if(result)
+ if (result)
{
Field *fields = result->Fetch();
accountId = fields[0].GetUInt32();
@@ -518,14 +518,14 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
}
// prevent deleting other players' characters using cheating tools
- if(accountId != GetAccountId())
+ if (accountId != GetAccountId())
return;
std::string IP_str = GetRemoteAddress();
sLog.outDetail("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid));
sLog.outChar("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid));
- if(sLog.IsOutCharDump()) // optimize GetPlayerDump call
+ if (sLog.IsOutCharDump()) // optimize GetPlayerDump call
{
std::string dump = PlayerDumpWriter().GetDump(GUID_LOPART(guid));
sLog.outCharDump(dump.c_str(),GetAccountId(),GUID_LOPART(guid),name.c_str());
@@ -540,7 +540,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data )
{
- if(PlayerLoading() || GetPlayer() != NULL)
+ if (PlayerLoading() || GetPlayer() != NULL)
{
sLog.outError("Player tryes to login again, AccountId = %d",GetAccountId());
return;
@@ -554,7 +554,7 @@ void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data )
recv_data >> playerGuid;
LoginQueryHolder *holder = new LoginQueryHolder(GetAccountId(), playerGuid);
- if(!holder->Initialize())
+ if (!holder->Initialize())
{
delete holder; // delete all unprocessed queries
m_playerLoading = false;
@@ -573,7 +573,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
ChatHandler chH = ChatHandler(pCurrChar);
// "GetAccountId()==db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools)
- if(!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder))
+ if (!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder))
{
KickPlayer(); // disconnect client, player no set to session and it will not deleted or saved at kick
delete pCurrChar; // delete it manually
@@ -637,7 +637,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
DEBUG_LOG( "WORLD: Sent motd (SMSG_MOTD)" );
// send server info
- if(sWorld.getConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
+ if (sWorld.getConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
chH.PSendSysMessage(_FULLVERSION);
DEBUG_LOG( "WORLD: Sent server info" );
@@ -646,22 +646,22 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
//QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow());
QueryResult_AutoPtr resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD);
- if(resultGuild)
+ if (resultGuild)
{
Field *fields = resultGuild->Fetch();
pCurrChar->SetInGuild(fields[0].GetUInt32());
pCurrChar->SetRank(fields[1].GetUInt32());
}
- else if(pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership
+ else if (pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership
{
pCurrChar->SetInGuild(0);
pCurrChar->SetRank(0);
}
- if(pCurrChar->GetGuildId() != 0)
+ if (pCurrChar->GetGuildId() != 0)
{
Guild* guild = objmgr.GetGuildById(pCurrChar->GetGuildId());
- if(guild)
+ if (guild)
{
data.Initialize(SMSG_GUILD_EVENT, (2+guild->GetMOTD().size()+1));
data << uint8(GE_MOTD);
@@ -696,11 +696,11 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->SendInitialPacketsBeforeAddToMap();
//Show cinematic at the first time that player login
- if( !pCurrChar->getCinematic() )
+ if ( !pCurrChar->getCinematic() )
{
pCurrChar->setCinematic(1);
- if(ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(pCurrChar->getClass()))
+ if (ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(pCurrChar->getClass()))
{
if (cEntry->CinematicSequence)
pCurrChar->SendCinematicStart(cEntry->CinematicSequence);
@@ -716,7 +716,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
if (!pCurrChar->GetMap()->Add(pCurrChar))
{
AreaTrigger const* at = objmgr.GetGoBackTrigger(pCurrChar->GetMapId());
- if(at)
+ if (at)
pCurrChar->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, pCurrChar->GetOrientation());
else
pCurrChar->TeleportTo(pCurrChar->m_homebindMapId, pCurrChar->m_homebindX, pCurrChar->m_homebindY, pCurrChar->m_homebindZ, pCurrChar->GetOrientation());
@@ -732,7 +732,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->SetInGameTime( getMSTime() );
// announce group about member online (must be after add to player list to receive announce to self)
- if(Group *group = pCurrChar->GetGroup())
+ if (Group *group = pCurrChar->GetGroup())
{
//pCurrChar->groupInfo.group->SendInit(this); // useless
group->SendUpdate();
@@ -748,7 +748,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
if (pCurrChar->m_deathState != ALIVE)
{
// not blizz like, we must correctly save and load player instead...
- if(pCurrChar->getRace() == RACE_NIGHTELF)
+ if (pCurrChar->getRace() == RACE_NIGHTELF)
pCurrChar->CastSpell(pCurrChar, 20584, true, 0);// auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form)
pCurrChar->CastSpell(pCurrChar, 8326, true, 0); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?)
@@ -758,27 +758,27 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->ContinueTaxiFlight();
// reset for all pets before pet loading
- if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
+ if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
Pet::resetTalentsForAllPetsOf(pCurrChar);
// Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned)
pCurrChar->LoadPet();
// Set FFA PvP for non GM in non-rest mode
- if(sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_RESTING) )
+ if (sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_RESTING) )
pCurrChar->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
- if(pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
+ if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
pCurrChar->SetContestedPvP();
// Apply at_login requests
- if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
+ if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
{
pCurrChar->resetSpells();
SendNotification(LANG_RESET_SPELLS);
}
- if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_TALENTS))
+ if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_TALENTS))
{
pCurrChar->resetTalents(true);
pCurrChar->SendTalentsInfoData(false); // original talents send already in to SendInitialPacketsBeforeAddToMap, resend reset state
@@ -789,20 +789,20 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->RemoveAtLoginFlag(AT_LOGIN_FIRST);
// show time before shutdown if shutdown planned.
- if(sWorld.IsShutdowning())
+ if (sWorld.IsShutdowning())
sWorld.ShutdownMsg(true,pCurrChar);
- if(sWorld.getConfig(CONFIG_ALL_TAXI_PATHS))
+ if (sWorld.getConfig(CONFIG_ALL_TAXI_PATHS))
pCurrChar->SetTaxiCheater(true);
- if(pCurrChar->isGameMaster())
+ if (pCurrChar->isGameMaster())
SendNotification(LANG_GM_ON);
std::string IP_str = GetRemoteAddress();
sLog.outChar("Account: %d (IP: %s) Login Character:[%s] (guid:%u)",
GetAccountId(),IP_str.c_str(),pCurrChar->GetName() ,pCurrChar->GetGUIDLow());
- if(!pCurrChar->IsStandState() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED))
+ if (!pCurrChar->IsStandState() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED))
pCurrChar->SetStandState(UNIT_STAND_STATE_STAND);
m_playerLoading = false;
@@ -840,7 +840,7 @@ void WorldSession::HandleSetFactionCheat( WorldPacket & /*recv_data*/ )
for (itr = GetPlayer()->factions.begin(); itr != GetPlayer()->factions.end(); ++itr)
{
- if(itr->ReputationListID == FactionID)
+ if (itr->ReputationListID == FactionID)
{
itr->Standing += Standing;
itr->Flags = (itr->Flags | 1);
@@ -970,7 +970,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data)
void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult_AutoPtr result, uint32 accountId, std::string newname)
{
WorldSession * session = sWorld.FindSession(accountId);
- if(!session)
+ if (!session)
return;
if (!result)
@@ -1005,7 +1005,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
// not accept declined names for unsupported languages
std::string name;
- if(!objmgr.GetPlayerNameByGUID(guid, name))
+ if (!objmgr.GetPlayerNameByGUID(guid, name))
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1015,7 +1015,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
}
std::wstring wname;
- if(!Utf8toWStr(name, wname))
+ if (!Utf8toWStr(name, wname))
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1024,7 +1024,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
return;
}
- if(!isCyrillicCharacter(wname[0])) // name already stored as only single alphabet using
+ if (!isCyrillicCharacter(wname[0])) // name already stored as only single alphabet using
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1038,7 +1038,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
recv_data >> name2;
- if(name2 != name) // character have different name
+ if (name2 != name) // character have different name
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1050,7 +1050,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
recv_data >> declinedname.name[i];
- if(!normalizePlayerName(declinedname.name[i]))
+ if (!normalizePlayerName(declinedname.name[i]))
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1060,7 +1060,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
}
}
- if(!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname, 0), declinedname))
+ if (!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname, 0), declinedname))
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1093,17 +1093,17 @@ void WorldSession::HandleAlterAppearance( WorldPacket & recv_data )
BarberShopStyleEntry const* bs_hair = sBarberShopStyleStore.LookupEntry(Hair);
- if(!bs_hair || bs_hair->type != 0 || bs_hair->race != _player->getRace() || bs_hair->gender != _player->getGender())
+ if (!bs_hair || bs_hair->type != 0 || bs_hair->race != _player->getRace() || bs_hair->gender != _player->getGender())
return;
BarberShopStyleEntry const* bs_facialHair = sBarberShopStyleStore.LookupEntry(FacialHair);
- if(!bs_facialHair || bs_facialHair->type != 2 || bs_facialHair->race != _player->getRace() || bs_facialHair->gender != _player->getGender())
+ if (!bs_facialHair || bs_facialHair->type != 2 || bs_facialHair->race != _player->getRace() || bs_facialHair->gender != _player->getGender())
return;
BarberShopStyleEntry const* bs_skinColor = sBarberShopStyleStore.LookupEntry(SkinColor);
- if( bs_skinColor && (bs_skinColor->type != 3 || bs_skinColor->race != _player->getRace() || bs_skinColor->gender != _player->getGender()))
+ if ( bs_skinColor && (bs_skinColor->type != 3 || bs_skinColor->race != _player->getRace() || bs_skinColor->gender != _player->getGender()))
return;
uint32 Cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, bs_skinColor);
@@ -1111,7 +1111,7 @@ void WorldSession::HandleAlterAppearance( WorldPacket & recv_data )
// 0 - ok
// 1,3 - not enough money
// 2 - you have to seat on barber chair
- if(_player->GetMoney() < Cost)
+ if (_player->GetMoney() < Cost)
{
WorldPacket data(SMSG_BARBER_SHOP_RESULT, 4);
data << uint32(1); // no money
@@ -1144,15 +1144,15 @@ void WorldSession::HandleRemoveGlyph( WorldPacket & recv_data )
uint32 slot;
recv_data >> slot;
- if(slot >= MAX_GLYPH_SLOT_INDEX)
+ if (slot >= MAX_GLYPH_SLOT_INDEX)
{
sLog.outDebug("Client sent wrong glyph slot number in opcode CMSG_REMOVE_GLYPH %u", slot);
return;
}
- if(uint32 glyph = _player->GetGlyph(slot))
+ if (uint32 glyph = _player->GetGlyph(slot))
{
- if(GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
+ if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
{
_player->RemoveAurasDueToSpell(gp->SpellId);
_player->SetGlyph(slot, 0);
@@ -1232,7 +1232,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
}
CharacterDatabase.escape_string(newname);
- if(QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid ='%u'", GUID_LOPART(guid)))
+ if (QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid ='%u'", GUID_LOPART(guid)))
{
std::string oldname = result->Fetch()[0].GetCppString();
std::string IP_str = GetRemoteAddress();
@@ -1260,12 +1260,12 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
sLog.outDebug("CMSG_EQUIPMENT_SET_SAVE");
uint64 setGuid;
- if(!recv_data.readPackGUID(setGuid))
+ if (!recv_data.readPackGUID(setGuid))
return;
uint32 index;
recv_data >> index;
- if(index >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
+ if (index >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
return;
std::string name;
@@ -1284,15 +1284,15 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
uint64 itemGuid;
- if(!recv_data.readPackGUID(itemGuid))
+ if (!recv_data.readPackGUID(itemGuid))
return;
Item *item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
- if(!item && itemGuid) // cheating check 1
+ if (!item && itemGuid) // cheating check 1
return;
- if(item && item->GetGUID() != itemGuid) // cheating check 2
+ if (item && item->GetGUID() != itemGuid) // cheating check 2
return;
eqSet.Items[i] = GUID_LOPART(itemGuid);
@@ -1306,7 +1306,7 @@ void WorldSession::HandleEquipmentSetDelete(WorldPacket &recv_data)
sLog.outDebug("CMSG_EQUIPMENT_SET_DELETE");
uint64 setGuid;
- if(!recv_data.readPackGUID(setGuid))
+ if (!recv_data.readPackGUID(setGuid))
return;
_player->DeleteEquipmentSet(setGuid);
@@ -1320,7 +1320,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
uint64 itemGuid;
- if(!recv_data.readPackGUID(itemGuid))
+ if (!recv_data.readPackGUID(itemGuid))
return;
uint8 srcbag, srcslot;
@@ -1332,15 +1332,15 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8);
- if(!item)
+ if (!item)
{
Item *uItem = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
- if(!uItem)
+ if (!uItem)
continue;
ItemPosCountVec sDest;
uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, sDest, uItem, false );
- if(msg == EQUIP_ERR_OK)
+ if (msg == EQUIP_ERR_OK)
{
_player->RemoveItem(INVENTORY_SLOT_BAG_0, i, true);
_player->StoreItem( sDest, uItem, true );
@@ -1351,7 +1351,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
continue;
}
- if(item->GetPos() == dstpos)
+ if (item->GetPos() == dstpos)
continue;
_player->SwapItem(item->GetPos(), dstpos);
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index 207306efb5f..a5ca1191bf8 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -1320,11 +1320,11 @@ valid examples:
negativeNumber = false;
while ((c = reader.get())!=':')
{
- if(c >='0' && c<='9')
+ if (c >='0' && c<='9')
{
propertyId*=10;
propertyId += c-'0';
- } else if(c == '-')
+ } else if (c == '-')
negativeNumber = true;
else
return false;
@@ -1339,7 +1339,7 @@ valid examples:
if (!itemProperty)
return false;
}
- else if(propertyId < 0)
+ else if (propertyId < 0)
{
itemSuffix = sItemRandomSuffixStore.LookupEntry(-propertyId);
if (!itemSuffix)
diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp
index a95eee32789..5bef3131f65 100644
--- a/src/game/ChatHandler.cpp
+++ b/src/game/ChatHandler.cpp
@@ -45,7 +45,7 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg
if (lang != LANG_ADDON)
{
// strip invisible characters for non-addon messages
- if(sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
+ if (sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
stripLineInvisibleChars(msg);
if (sWorld.getConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && GetSecurity() < SEC_MODERATOR
@@ -70,7 +70,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
recv_data >> type;
recv_data >> lang;
- if(type >= MAX_CHAT_MSG_TYPE)
+ if (type >= MAX_CHAT_MSG_TYPE)
{
sLog.outError("CHAT: Wrong message type received: %u", type);
return;
@@ -80,39 +80,39 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
// prevent talking at unknown language (cheating)
LanguageDesc const* langDesc = GetLanguageDescByID(lang);
- if(!langDesc)
+ if (!langDesc)
{
SendNotification(LANG_UNKNOWN_LANGUAGE);
return;
}
- if(langDesc->skill_id != 0 && !_player->HasSkill(langDesc->skill_id))
+ if (langDesc->skill_id != 0 && !_player->HasSkill(langDesc->skill_id))
{
// also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)
Unit::AuraEffectList const& langAuras = _player->GetAuraEffectsByType(SPELL_AURA_COMPREHEND_LANGUAGE);
bool foundAura = false;
for (Unit::AuraEffectList::const_iterator i = langAuras.begin(); i != langAuras.end(); ++i)
{
- if((*i)->GetMiscValue() == int32(lang))
+ if ((*i)->GetMiscValue() == int32(lang))
{
foundAura = true;
break;
}
}
- if(!foundAura)
+ if (!foundAura)
{
SendNotification(LANG_NOT_LEARNED_LANGUAGE);
return;
}
}
- if(lang == LANG_ADDON)
+ if (lang == LANG_ADDON)
{
- if(sWorld.getConfig(CONFIG_CHATLOG_ADDON))
+ if (sWorld.getConfig(CONFIG_CHATLOG_ADDON))
{
std::string msg = "";
recv_data >> msg;
- if(msg.empty())
+ if (msg.empty())
{
sLog.outDebug("Player %s send empty addon msg", GetPlayer()->GetName());
return;
@@ -123,7 +123,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
}
// Disabled addon channel?
- if(!sWorld.getConfig(CONFIG_ADDON_CHANNEL))
+ if (!sWorld.getConfig(CONFIG_ADDON_CHANNEL))
return;
}
// LANG_ADDON should not be changed nor be affected by flood control
@@ -146,13 +146,13 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
case CHAT_MSG_RAID_LEADER:
case CHAT_MSG_RAID_WARNING:
// allow two side chat at group channel if two side group allowed
- if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
+ if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
lang = LANG_UNIVERSAL;
break;
case CHAT_MSG_GUILD:
case CHAT_MSG_OFFICER:
// allow two side chat at guild channel if two side guild allowed
- if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
+ if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
lang = LANG_UNIVERSAL;
break;
}
@@ -160,7 +160,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
// but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)
Unit::AuraEffectList const& ModLangAuras = _player->GetAuraEffectsByType(SPELL_AURA_MOD_LANGUAGE);
- if(!ModLangAuras.empty())
+ if (!ModLangAuras.empty())
lang = ModLangAuras.front()->GetMiscValue();
}
@@ -193,7 +193,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
- if(msg.empty())
+ if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
@@ -208,14 +208,14 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
- if(msg.empty())
+ if (msg.empty())
break;
- if(type == CHAT_MSG_SAY)
+ if (type == CHAT_MSG_SAY)
GetPlayer()->Say(msg, lang);
- else if(type == CHAT_MSG_EMOTE)
+ else if (type == CHAT_MSG_EMOTE)
GetPlayer()->TextEmote(msg);
- else if(type == CHAT_MSG_YELL)
+ else if (type == CHAT_MSG_YELL)
GetPlayer()->Yell(msg, lang);
} break;
@@ -234,10 +234,10 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
- if(msg.empty())
+ if (msg.empty())
break;
- if(!normalizePlayerName(to))
+ if (!normalizePlayerName(to))
{
SendPlayerNotFoundNotice(to);
break;
@@ -256,7 +256,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
{
uint32 sidea = GetPlayer()->GetTeam();
uint32 sideb = player->GetTeam();
- if( sidea != sideb )
+ if ( sidea != sideb )
{
SendPlayerNotFoundNotice(to);
return;
@@ -278,7 +278,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
- if(msg.empty())
+ if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
@@ -287,26 +287,26 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
- if(msg.empty())
+ if (msg.empty())
break;
// if player is in battleground, he cannot say to battleground members by /p
Group *group = GetPlayer()->GetOriginalGroup();
- if(!group)
+ if (!group)
{
group = _player->GetGroup();
- if(!group || group->isBGGroup())
+ if (!group || group->isBGGroup())
return;
}
- if((type == CHAT_MSG_PARTY_LEADER) && !group->IsLeader(_player->GetGUID()))
+ if ((type == CHAT_MSG_PARTY_LEADER) && !group->IsLeader(_player->GetGUID()))
return;
WorldPacket data;
ChatHandler::FillMessageData(&data, this, type, lang, NULL, 0, msg.c_str(), NULL);
group->BroadcastPacket(&data, false, group->GetMemberGroup(GetPlayer()->GetGUID()));
- if(sWorld.getConfig(CONFIG_CHATLOG_PARTY))
+ if (sWorld.getConfig(CONFIG_CHATLOG_PARTY))
sLog.outChat("[PARTY] Player %s tells group with leader %s: %s",
GetPlayer()->GetName(), group->GetLeaderName(), msg.c_str());
} break;
@@ -316,7 +316,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
- if(msg.empty())
+ if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
@@ -325,7 +325,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
- if(msg.empty())
+ if (msg.empty())
break;
if (GetPlayer()->GetGuildId())
@@ -335,7 +335,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (guild)
guild->BroadcastToGuild(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
- if(lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHATLOG_GUILD))
+ if (lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHATLOG_GUILD))
{
sLog.outChat("[GUILD] Player %s tells guild %s: %s",
GetPlayer()->GetName(), guild->GetName().c_str(), msg.c_str());
@@ -354,7 +354,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
- if(msg.empty())
+ if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
@@ -363,7 +363,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
- if(msg.empty())
+ if (msg.empty())
break;
if (GetPlayer()->GetGuildId())
@@ -373,7 +373,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (guild)
guild->BroadcastToOfficers(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
- if(sWorld.getConfig(CONFIG_CHATLOG_GUILD))
+ if (sWorld.getConfig(CONFIG_CHATLOG_GUILD))
sLog.outChat("[OFFICER] Player %s tells guild %s officers: %s",
GetPlayer()->GetName(), guild->GetName().c_str(), msg.c_str());
}
@@ -384,7 +384,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
- if(msg.empty())
+ if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
@@ -393,15 +393,15 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
- if(msg.empty())
+ if (msg.empty())
break;
// if player is in battleground, he cannot say to battleground members by /ra
Group *group = GetPlayer()->GetOriginalGroup();
- if(!group)
+ if (!group)
{
group = GetPlayer()->GetGroup();
- if(!group || group->isBGGroup() || !group->isRaidGroup())
+ if (!group || group->isBGGroup() || !group->isRaidGroup())
return;
}
@@ -409,7 +409,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
ChatHandler::FillMessageData(&data, this, CHAT_MSG_RAID, lang, "", 0, msg.c_str(), NULL);
group->BroadcastPacket(&data, false);
- if(sWorld.getConfig(CONFIG_CHATLOG_RAID))
+ if (sWorld.getConfig(CONFIG_CHATLOG_RAID))
sLog.outChat("[RAID] Player %s tells raid with leader %s: %s",
GetPlayer()->GetName(), group->GetLeaderName(), msg.c_str());
} break;
@@ -418,7 +418,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
- if(msg.empty())
+ if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
@@ -427,15 +427,15 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
- if(msg.empty())
+ if (msg.empty())
break;
// if player is in battleground, he cannot say to battleground members by /ra
Group *group = GetPlayer()->GetOriginalGroup();
- if(!group)
+ if (!group)
{
group = GetPlayer()->GetGroup();
- if(!group || group->isBGGroup() || !group->isRaidGroup() || !group->IsLeader(_player->GetGUID()))
+ if (!group || group->isBGGroup() || !group->isRaidGroup() || !group->IsLeader(_player->GetGUID()))
return;
}
@@ -443,7 +443,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
ChatHandler::FillMessageData(&data, this, CHAT_MSG_RAID_LEADER, lang, "", 0, msg.c_str(), NULL);
group->BroadcastPacket(&data, false);
- if(sWorld.getConfig(CONFIG_CHATLOG_RAID))
+ if (sWorld.getConfig(CONFIG_CHATLOG_RAID))
sLog.outChat("[RAID] Leader player %s tells raid: %s",
GetPlayer()->GetName(), msg.c_str());
} break;
@@ -455,11 +455,11 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
- if(msg.empty())
+ if (msg.empty())
break;
Group *group = GetPlayer()->GetGroup();
- if(!group || !group->isRaidGroup() || !(group->IsLeader(GetPlayer()->GetGUID()) || group->IsAssistant(GetPlayer()->GetGUID())) || group->isBGGroup())
+ if (!group || !group->isRaidGroup() || !(group->IsLeader(GetPlayer()->GetGUID()) || group->IsAssistant(GetPlayer()->GetGUID())) || group->isBGGroup())
return;
WorldPacket data;
@@ -467,7 +467,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
ChatHandler::FillMessageData(&data, this, CHAT_MSG_RAID_WARNING, lang, "", 0, msg.c_str(), NULL);
group->BroadcastPacket(&data, false);
- if(sWorld.getConfig(CONFIG_CHATLOG_RAID))
+ if (sWorld.getConfig(CONFIG_CHATLOG_RAID))
sLog.outChat("[RAID] Leader player %s warns raid with: %s",
GetPlayer()->GetName(), msg.c_str());
} break;
@@ -480,19 +480,19 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
- if(msg.empty())
+ if (msg.empty())
break;
//battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
Group *group = GetPlayer()->GetGroup();
- if(!group || !group->isBGGroup())
+ if (!group || !group->isBGGroup())
return;
WorldPacket data;
ChatHandler::FillMessageData(&data, this, CHAT_MSG_BATTLEGROUND, lang, "", 0, msg.c_str(), NULL);
group->BroadcastPacket(&data, false);
- if(sWorld.getConfig(CONFIG_CHATLOG_BGROUND))
+ if (sWorld.getConfig(CONFIG_CHATLOG_BGROUND))
sLog.outChat("[BATTLEGROUND] Player %s tells battleground with leader %s: %s",
GetPlayer()->GetName(), group->GetLeaderName(), msg.c_str());
} break;
@@ -505,19 +505,19 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
- if(msg.empty())
+ if (msg.empty())
break;
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
Group *group = GetPlayer()->GetGroup();
- if(!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetGUID()))
+ if (!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetGUID()))
return;
WorldPacket data;
ChatHandler::FillMessageData(&data, this, CHAT_MSG_BATTLEGROUND_LEADER, lang, "", 0, msg.c_str(), NULL);
group->BroadcastPacket(&data, false);
- if(sWorld.getConfig(CONFIG_CHATLOG_BGROUND))
+ if (sWorld.getConfig(CONFIG_CHATLOG_BGROUND))
sLog.outChat("[RAID] Leader player %s tells battleground: %s",
GetPlayer()->GetName(), msg.c_str());
} break;
@@ -537,24 +537,24 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
return;
}
- if(msg.empty())
+ if (msg.empty())
break;
- if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
- if(Channel *chn = cMgr->GetChannel(channel, _player))
+ if (Channel *chn = cMgr->GetChannel(channel, _player))
{
chn->Say(_player->GetGUID(), msg.c_str(), lang);
- if((chn->HasFlag(CHANNEL_FLAG_TRADE) ||
+ if ((chn->HasFlag(CHANNEL_FLAG_TRADE) ||
chn->HasFlag(CHANNEL_FLAG_GENERAL) ||
chn->HasFlag(CHANNEL_FLAG_CITY) ||
chn->HasFlag(CHANNEL_FLAG_LFG)) &&
sWorld.getConfig(CONFIG_CHATLOG_SYSCHAN))
sLog.outChat("[SYSCHAN] Player %s tells channel %s: %s",
GetPlayer()->GetName(), chn->GetName().c_str(), msg.c_str());
- else if(sWorld.getConfig(CONFIG_CHATLOG_CHANNEL))
+ else if (sWorld.getConfig(CONFIG_CHATLOG_CHANNEL))
sLog.outChat("[CHANNEL] Player %s tells channel %s: %s",
GetPlayer()->GetName(), chn->GetName().c_str(), msg.c_str());
}
@@ -566,16 +566,16 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
- if((msg.empty() || !_player->isAFK()) && !_player->isInCombat() )
+ if ((msg.empty() || !_player->isAFK()) && !_player->isInCombat() )
{
- if(!_player->isAFK())
+ if (!_player->isAFK())
{
- if(msg.empty())
+ if (msg.empty())
msg = GetTrinityString(LANG_PLAYER_AFK_DEFAULT);
_player->afkMsg = msg;
}
_player->ToggleAFK();
- if(_player->isAFK() && _player->isDND())
+ if (_player->isAFK() && _player->isDND())
_player->ToggleDND();
}
} break;
@@ -585,16 +585,16 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
- if(msg.empty() || !_player->isDND())
+ if (msg.empty() || !_player->isDND())
{
- if(!_player->isDND())
+ if (!_player->isDND())
{
- if(msg.empty())
+ if (msg.empty())
msg = GetTrinityString(LANG_PLAYER_DND_DEFAULT);
_player->dndMsg = msg;
}
_player->ToggleDND();
- if(_player->isDND() && _player->isAFK())
+ if (_player->isDND() && _player->isAFK())
_player->ToggleAFK();
}
} break;
@@ -607,7 +607,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
void WorldSession::HandleEmoteOpcode( WorldPacket & recv_data )
{
- if(!GetPlayer()->isAlive())
+ if (!GetPlayer()->isAlive())
return;
uint32 emote;
@@ -633,7 +633,7 @@ namespace Trinity
data << (uint32)i_text_emote;
data << i_emote_num;
data << (uint32)namlen;
- if( namlen > 1 )
+ if ( namlen > 1 )
data.append(nam, namlen);
else
data << (uint8)0x00;
@@ -649,7 +649,7 @@ namespace Trinity
void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data )
{
- if(!GetPlayer()->isAlive())
+ if (!GetPlayer()->isAlive())
return;
if (!GetPlayer()->CanSpeak())
@@ -715,7 +715,7 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data )
recv_data >> unk; // probably related to spam reporting
Player *player = objmgr.GetPlayer(iguid);
- if(!player || !player->GetSession())
+ if (!player || !player->GetSession())
return;
WorldPacket data;
diff --git a/src/game/CombatAI.cpp b/src/game/CombatAI.cpp
index 0f330b216bb..f1fe1423572 100644
--- a/src/game/CombatAI.cpp
+++ b/src/game/CombatAI.cpp
@@ -24,7 +24,7 @@
int AggressorAI::Permissible(const Creature *creature)
{
// have some hostile factions, it will be selected by IsHostileTo check at MoveInLineOfSight
- if( !creature->isCivilian() && !creature->IsNeutralToAll() )
+ if ( !creature->isCivilian() && !creature->IsNeutralToAll() )
return PERMIT_BASE_PROACTIVE;
return PERMIT_BASE_NO;
@@ -32,7 +32,7 @@ int AggressorAI::Permissible(const Creature *creature)
void AggressorAI::UpdateAI(const uint32 /*diff*/)
{
- if(!UpdateVictim())
+ if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
@@ -62,7 +62,7 @@ int AOEAI::Permissible(const Creature *creature)
void CombatAI::InitializeAI()
{
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
- if(me->m_spells[i] && GetSpellStore()->LookupEntry(me->m_spells[i]))
+ if (me->m_spells[i] && GetSpellStore()->LookupEntry(me->m_spells[i]))
spells.push_back(me->m_spells[i]);
CreatureAI::InitializeAI();
@@ -76,7 +76,7 @@ void CombatAI::Reset()
void CombatAI::JustDied(Unit *killer)
{
for (SpellVct::iterator i = spells.begin(); i != spells.end(); ++i)
- if(AISpellInfo[*i].condition == AICOND_DIE)
+ if (AISpellInfo[*i].condition == AICOND_DIE)
me->CastSpell(killer, *i, true);
}
@@ -84,24 +84,24 @@ void CombatAI::EnterCombat(Unit *who)
{
for (SpellVct::iterator i = spells.begin(); i != spells.end(); ++i)
{
- if(AISpellInfo[*i].condition == AICOND_AGGRO)
+ if (AISpellInfo[*i].condition == AICOND_AGGRO)
me->CastSpell(who, *i, false);
- else if(AISpellInfo[*i].condition == AICOND_COMBAT)
+ else if (AISpellInfo[*i].condition == AICOND_COMBAT)
events.ScheduleEvent(*i, AISpellInfo[*i].cooldown + rand()%AISpellInfo[*i].cooldown);
}
}
void CombatAI::UpdateAI(const uint32 diff)
{
- if(!UpdateVictim())
+ if (!UpdateVictim())
return;
events.Update(diff);
- if(me->hasUnitState(UNIT_STAT_CASTING))
+ if (me->hasUnitState(UNIT_STAT_CASTING))
return;
- if(uint32 spellId = events.ExecuteEvent())
+ if (uint32 spellId = events.ExecuteEvent())
{
DoCast(spellId);
events.ScheduleEvent(spellId, AISpellInfo[spellId].cooldown + rand()%AISpellInfo[spellId].cooldown);
@@ -135,7 +135,7 @@ void CasterAI::EnterCombat(Unit *who)
uint32 count = 0;
for (SpellVct::iterator itr = spells.begin(); itr != spells.end(); ++itr, ++count)
{
- if(AISpellInfo[*itr].condition == AICOND_AGGRO)
+ if (AISpellInfo[*itr].condition == AICOND_AGGRO)
me->CastSpell(who, *itr, false);
else if (AISpellInfo[*itr].condition == AICOND_COMBAT)
{
@@ -152,15 +152,15 @@ void CasterAI::EnterCombat(Unit *who)
void CasterAI::UpdateAI(const uint32 diff)
{
- if(!UpdateVictim())
+ if (!UpdateVictim())
return;
events.Update(diff);
- if(me->hasUnitState(UNIT_STAT_CASTING))
+ if (me->hasUnitState(UNIT_STAT_CASTING))
return;
- if(uint32 spellId = events.ExecuteEvent())
+ if (uint32 spellId = events.ExecuteEvent())
{
DoCast(spellId);
uint32 casttime = me->GetCurrentSpellCastTime(spellId);
@@ -176,7 +176,7 @@ ArchorAI::ArchorAI(Creature *c) : CreatureAI(c)
{
ASSERT(me->m_spells[0]);
m_minRange = GetSpellMinRange(me->m_spells[0], false);
- if(!m_minRange)
+ if (!m_minRange)
m_minRange = MELEE_RANGE;
me->m_CombatDistance = GetSpellMaxRange(me->m_spells[0], false);
me->m_SightDistance = me->m_CombatDistance;
@@ -184,30 +184,30 @@ ArchorAI::ArchorAI(Creature *c) : CreatureAI(c)
void ArchorAI::AttackStart(Unit *who)
{
- if(!who)
+ if (!who)
return;
- if(me->IsWithinCombatRange(who, m_minRange))
+ if (me->IsWithinCombatRange(who, m_minRange))
{
- if(me->Attack(who, true) && !who->IsFlying())
+ if (me->Attack(who, true) && !who->IsFlying())
me->GetMotionMaster()->MoveChase(who);
}
else
{
- if(me->Attack(who, false) && !who->IsFlying())
+ if (me->Attack(who, false) && !who->IsFlying())
me->GetMotionMaster()->MoveChase(who, me->m_CombatDistance);
}
- if(who->IsFlying())
+ if (who->IsFlying())
me->GetMotionMaster()->MoveIdle();
}
void ArchorAI::UpdateAI(const uint32 diff)
{
- if(!UpdateVictim())
+ if (!UpdateVictim())
return;
- if(!me->IsWithinCombatRange(me->getVictim(), m_minRange))
+ if (!me->IsWithinCombatRange(me->getVictim(), m_minRange))
DoSpellAttackIfReady(me->m_spells[0]);
else
DoMeleeAttackIfReady();
@@ -228,7 +228,7 @@ TurretAI::TurretAI(Creature *c) : CreatureAI(c)
bool TurretAI::CanAIAttack(const Unit *who) const
{
// TODO: use one function to replace it
- if(!me->IsWithinCombatRange(me->getVictim(), me->m_CombatDistance)
+ if (!me->IsWithinCombatRange(me->getVictim(), me->m_CombatDistance)
|| m_minRange && me->IsWithinCombatRange(me->getVictim(), m_minRange))
return false;
return true;
@@ -236,19 +236,19 @@ bool TurretAI::CanAIAttack(const Unit *who) const
void TurretAI::AttackStart(Unit *who)
{
- if(who)
+ if (who)
me->Attack(who, false);
}
void TurretAI::UpdateAI(const uint32 diff)
{
- if(!UpdateVictim())
+ if (!UpdateVictim())
return;
DoSpellAttackIfReady(me->m_spells[0]);
- //if(!DoSpellAttackIfReady(me->m_spells[0]))
- //if(HostileReference *ref = me->getThreatManager().getCurrentVictim())
+ //if (!DoSpellAttackIfReady(me->m_spells[0]))
+ //if (HostileReference *ref = me->getThreatManager().getCurrentVictim())
//ref->removeReference();
}
@@ -277,6 +277,6 @@ void AOEAI::AttackStart(Unit *who)
void AOEAI::UpdateAI(const uint32 diff)
{
- if(!me->HasAura(me->m_spells[0]))
+ if (!me->HasAura(me->m_spells[0]))
me->CastSpell(me, me->m_spells[0],false);
} \ No newline at end of file
diff --git a/src/game/CombatHandler.cpp b/src/game/CombatHandler.cpp
index c564b6dfa3f..a10e59893b9 100644
--- a/src/game/CombatHandler.cpp
+++ b/src/game/CombatHandler.cpp
@@ -35,9 +35,9 @@ void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data )
Unit *pEnemy = ObjectAccessor::GetUnit(*_player, guid);
- if(!pEnemy)
+ if (!pEnemy)
{
- if(!IS_UNIT_GUID(guid))
+ if (!IS_UNIT_GUID(guid))
sLog.outError("WORLD: Object %u (TypeID: %u) isn't player, pet or creature",GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)));
else
sLog.outError( "WORLD: Enemy %s %u not found",GetLogNameForGuid(guid),GUID_LOPART(guid));
@@ -47,7 +47,7 @@ void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data )
return;
}
- if(!_player->canAttack(pEnemy))
+ if (!_player->canAttack(pEnemy))
{
sLog.outError( "WORLD: Enemy %s %u is friendly",(IS_PLAYER_GUID(guid) ? "player" : "creature"),GUID_LOPART(guid));
@@ -71,7 +71,7 @@ void WorldSession::HandleSetSheathedOpcode( WorldPacket & recv_data )
//sLog.outDebug( "WORLD: Recvd CMSG_SETSHEATHED Message guidlow:%u value1:%u", GetPlayer()->GetGUIDLow(), sheathed );
- if(sheathed >= MAX_SHEATH_STATE)
+ if (sheathed >= MAX_SHEATH_STATE)
{
sLog.outError("Unknown sheath state %u ??",sheathed);
return;
diff --git a/src/game/ConfusedMovementGenerator.cpp b/src/game/ConfusedMovementGenerator.cpp
index 51d0899e4d6..a1c95c5c2a0 100644
--- a/src/game/ConfusedMovementGenerator.cpp
+++ b/src/game/ConfusedMovementGenerator.cpp
@@ -119,19 +119,19 @@ template<class T>
bool
ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
{
- if(!&unit)
+ if (!&unit)
return true;
- if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
+ if (unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
return true;
- if( i_nextMoveTime.Passed() )
+ if ( i_nextMoveTime.Passed() )
{
// currently moving, update location
Traveller<T> traveller(unit);
- if( i_destinationHolder.UpdateTraveller(traveller, diff))
+ if ( i_destinationHolder.UpdateTraveller(traveller, diff))
{
- if( i_destinationHolder.HasArrived())
+ if ( i_destinationHolder.HasArrived())
{
// arrived, stop and wait a bit
unit.clearUnitState(UNIT_STAT_MOVE);
@@ -145,7 +145,7 @@ ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
{
// waiting for next move
i_nextMoveTime.Update(diff);
- if( i_nextMoveTime.Passed() )
+ if ( i_nextMoveTime.Passed() )
{
// start moving
assert( i_nextMove <= MAX_CONF_WAYPOINTS );
@@ -165,7 +165,7 @@ ConfusedMovementGenerator<T>::Finalize(T &unit)
{
unit.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
unit.clearUnitState(UNIT_STAT_CONFUSED);
- if(unit.GetTypeId() == TYPEID_UNIT && unit.getVictim())
+ if (unit.GetTypeId() == TYPEID_UNIT && unit.getVictim())
unit.SetUInt64Value(UNIT_FIELD_TARGET, unit.getVictim()->GetGUID());
}
diff --git a/src/game/ConfusedMovementGenerator.h b/src/game/ConfusedMovementGenerator.h
index 4aa54776b45..e1a71151d37 100644
--- a/src/game/ConfusedMovementGenerator.h
+++ b/src/game/ConfusedMovementGenerator.h
@@ -41,7 +41,7 @@ class ConfusedMovementGenerator
bool GetDestination(float &x, float &y, float &z) const
{
- if(i_destinationHolder.HasArrived()) return false;
+ if (i_destinationHolder.HasArrived()) return false;
i_destinationHolder.GetDestination(x,y,z);
return true;
}
diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp
index e3dd399a032..3e658e9c5dc 100644
--- a/src/game/Corpse.cpp
+++ b/src/game/Corpse.cpp
@@ -53,7 +53,7 @@ Corpse::~Corpse()
void Corpse::AddToWorld()
{
///- Register the corpse for guid lookup
- if(!IsInWorld())
+ if (!IsInWorld())
ObjectAccessor::Instance().AddObject(this);
Object::AddToWorld();
@@ -62,7 +62,7 @@ void Corpse::AddToWorld()
void Corpse::RemoveFromWorld()
{
///- Remove the corpse from the accessor
- if(IsInWorld())
+ if (IsInWorld())
ObjectAccessor::Instance().RemoveObject(this);
Object::RemoveFromWorld();
@@ -81,7 +81,7 @@ bool Corpse::Create( uint32 guidlow, Player *owner)
Relocate(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ(), owner->GetOrientation());
- if(!IsPositionValid())
+ if (!IsPositionValid())
{
sLog.outError("Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
guidlow, owner->GetName(), owner->GetPositionX(), owner->GetPositionY());
@@ -145,7 +145,7 @@ void Corpse::DeleteBonesFromWorld()
void Corpse::DeleteFromDB()
{
- if(GetType() == CORPSE_BONES)
+ if (GetType() == CORPSE_BONES)
// only specific bones
CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%d'", GetGUIDLow());
else
@@ -161,7 +161,7 @@ bool Corpse::LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId)
// 0 1 2 3 4 5 6 7 8 9
result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,data,time,corpse_type,instance,phaseMask FROM corpse WHERE guid = '%u'",guid);
- if( !result )
+ if ( !result )
{
sLog.outError("Corpse (GUID: %u) not found in table `corpse`, can't load. ",guid);
return false;
@@ -169,7 +169,7 @@ bool Corpse::LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId)
Field *fields = result->Fetch();
- if(!LoadFromDB(guid, fields))
+ if (!LoadFromDB(guid, fields))
{
if (!external)
delete result;
@@ -193,7 +193,7 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields)
Object::_Create(guid, 0, HIGHGUID_CORPSE);
- if(!LoadValues( fields[5].GetString() ))
+ if (!LoadValues( fields[5].GetString() ))
{
sLog.outError("Corpse #%d have broken data in `data` field. Can't be loaded.",guid);
return false;
@@ -202,13 +202,13 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields)
m_time = time_t(fields[6].GetUInt64());
m_type = CorpseType(fields[7].GetUInt32());
- if(m_type >= MAX_CORPSE_TYPE)
+ if (m_type >= MAX_CORPSE_TYPE)
{
sLog.outError("Corpse (guidlow %d, owner %d) have wrong corpse type, not load.",GetGUIDLow(),GUID_LOPART(GetOwnerGUID()));
return false;
}
- if(m_type != CORPSE_BONES)
+ if (m_type != CORPSE_BONES)
m_isWorldObject = true;
uint32 instanceid = fields[8].GetUInt32();
@@ -224,7 +224,7 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields)
SetPhaseMask(phaseMask, false);
Relocate(positionX, positionY, positionZ, ort);
- if(!IsPositionValid())
+ if (!IsPositionValid())
{
sLog.outError("Corpse (guidlow %d, owner %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), GetPositionX(), GetPositionY());
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index e4f3e2e7b89..42557af7c99 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -64,7 +64,7 @@ bool VendorItemData::RemoveItem( uint32 item_id )
{
for (VendorItemList::iterator i = m_items.begin(); i != m_items.end(); ++i )
{
- if((*i)->item==item_id)
+ if ((*i)->item==item_id)
{
m_items.erase(i);
return true;
@@ -84,7 +84,7 @@ size_t VendorItemData::FindItemSlot(uint32 item_id) const
VendorItem const* VendorItemData::FindItem(uint32 item_id) const
{
for (VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i )
- if((*i)->item==item_id)
+ if ((*i)->item==item_id)
return *i;
return NULL;
}
@@ -104,16 +104,16 @@ uint32 CreatureInfo::GetRandomValidModelId() const
uint32 CreatureInfo::GetFirstValidModelId() const
{
- if(Modelid1) return Modelid1;
- if(Modelid2) return Modelid2;
- if(Modelid3) return Modelid3;
- if(Modelid4) return Modelid4;
+ if (Modelid1) return Modelid1;
+ if (Modelid2) return Modelid2;
+ if (Modelid3) return Modelid3;
+ if (Modelid4) return Modelid4;
return 0;
}
bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
- if(Unit* victim = Unit::GetUnit(m_owner, m_victim))
+ if (Unit* victim = Unit::GetUnit(m_owner, m_victim))
{
while (!m_assistants.empty())
{
@@ -124,7 +124,7 @@ bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
assistant->SetNoCallAssistance(true);
assistant->CombatStart(victim);
- if(assistant->IsAIEnabled)
+ if (assistant->IsAIEnabled)
assistant->AI()->AttackStart(victim);
}
}
@@ -176,39 +176,39 @@ Creature::~Creature()
{
m_vendorItemCounts.clear();
- if(i_AI)
+ if (i_AI)
{
delete i_AI;
i_AI = NULL;
}
- //if(m_uint32Values)
+ //if (m_uint32Values)
// sLog.outError("Deconstruct Creature Entry = %u", GetEntry());
}
void Creature::AddToWorld()
{
///- Register the creature for guid lookup
- if(!IsInWorld())
+ if (!IsInWorld())
{
- if(m_zoneScript)
+ if (m_zoneScript)
m_zoneScript->OnCreatureCreate(this, true);
ObjectAccessor::Instance().AddObject(this);
Unit::AddToWorld();
SearchFormation();
AIM_Initialize();
- if(IsVehicle())
+ if (IsVehicle())
GetVehicleKit()->Install();
}
}
void Creature::RemoveFromWorld()
{
- if(IsInWorld())
+ if (IsInWorld())
{
- if(m_zoneScript)
+ if (m_zoneScript)
m_zoneScript->OnCreatureCreate(this, false);
- if(m_formation)
+ if (m_formation)
formation_mgr.RemoveCreatureFromGroup(m_formation, this);
Unit::RemoveFromWorld();
ObjectAccessor::Instance().RemoveObject(this);
@@ -220,22 +220,22 @@ void Creature::DisappearAndDie()
DestroyForNearbyPlayers();
//SetVisibility(VISIBILITY_OFF);
//ObjectAccessor::UpdateObjectVisibility(this);
- if(isAlive())
+ if (isAlive())
setDeathState(JUST_DIED);
RemoveCorpse();
}
void Creature::SearchFormation()
{
- if(isSummon())
+ if (isSummon())
return;
uint32 lowguid = GetDBTableGUIDLow();
- if(!lowguid)
+ if (!lowguid)
return;
CreatureGroupInfoType::iterator frmdata = CreatureGroupMap.find(lowguid);
- if(frmdata != CreatureGroupMap.end())
+ if (frmdata != CreatureGroupMap.end())
formation_mgr.AddCreatureToGroup(frmdata->second->leaderGUID, this);
}
@@ -266,7 +266,7 @@ void Creature::RemoveCorpse()
bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
{
CreatureInfo const *normalInfo = objmgr.GetCreatureTemplate(Entry);
- if(!normalInfo)
+ if (!normalInfo)
{
sLog.outErrorDb("Creature::UpdateEntry creature entry %u does not exist.", Entry);
return false;
@@ -325,11 +325,11 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
SetByteValue(UNIT_FIELD_BYTES_0, 2, minfo->gender);
// Load creature equipment
- if(!data || data->equipmentId == 0)
+ if (!data || data->equipmentId == 0)
{ // use default from the template
LoadEquipment(cinfo->equipmentId);
}
- else if(data && data->equipmentId != -1)
+ else if (data && data->equipmentId != -1)
{ // override, -1 means no equipment
LoadEquipment(data->equipmentId);
}
@@ -350,7 +350,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
// checked at loading
m_defaultMovementType = MovementGeneratorType(cinfo->MovementType);
- if(!m_respawnradius && m_defaultMovementType==RANDOM_MOTION_TYPE)
+ if (!m_respawnradius && m_defaultMovementType==RANDOM_MOTION_TYPE)
m_defaultMovementType = IDLE_MOTION_TYPE;
for (uint8 i=0; i < CREATURE_MAX_SPELLS; ++i)
@@ -361,7 +361,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data )
{
- if(!InitEntry(Entry,team,data))
+ if (!InitEntry(Entry,team,data))
return false;
CreatureInfo const* cInfo = GetCreatureInfo();
@@ -377,7 +377,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data )
else
setFaction(cInfo->faction_A);
- if(cInfo->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT)
+ if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT)
SetUInt32Value(UNIT_NPC_FLAGS,cInfo->npcflag | gameeventmgr.GetNPCFlag(this));
else
SetUInt32Value(UNIT_NPC_FLAGS,cInfo->npcflag);
@@ -415,28 +415,28 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data )
}
// HACK: trigger creature is always not selectable
- if(isTrigger())
+ if (isTrigger())
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- if(isTotem() || isTrigger()
+ if (isTotem() || isTrigger()
|| GetCreatureType() == CREATURE_TYPE_CRITTER)
SetReactState(REACT_PASSIVE);
- /*else if(isCivilian())
+ /*else if (isCivilian())
SetReactState(REACT_DEFENSIVE);*/
else
SetReactState(REACT_AGGRESSIVE);
- if(cInfo->flags_extra & CREATURE_FLAG_EXTRA_NO_TAUNT)
+ if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_NO_TAUNT)
{
ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true);
}
// TODO: In fact monster move flags should be set - not movement flags.
- if(cInfo->InhabitType & INHABIT_AIR)
+ if (cInfo->InhabitType & INHABIT_AIR)
AddUnitMovementFlag(MOVEMENTFLAG_FLY_MODE | MOVEMENTFLAG_FLYING);
- if(cInfo->InhabitType & INHABIT_WATER)
+ if (cInfo->InhabitType & INHABIT_WATER)
AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
return true;
@@ -444,7 +444,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data )
void Creature::Update(uint32 diff)
{
- if(m_GlobalCooldown <= diff)
+ if (m_GlobalCooldown <= diff)
m_GlobalCooldown = 0;
else
m_GlobalCooldown -= diff;
@@ -461,15 +461,15 @@ void Creature::Update(uint32 diff)
break;
case DEAD:
{
- if( m_respawnTime <= time(NULL) )
+ if ( m_respawnTime <= time(NULL) )
{
- if(!GetLinkedCreatureRespawnTime()) // Can respawn
+ if (!GetLinkedCreatureRespawnTime()) // Can respawn
Respawn();
else // the master is dead
{
- if(uint32 targetGuid = objmgr.GetLinkedRespawnGuid(m_DBTableGuid))
+ if (uint32 targetGuid = objmgr.GetLinkedRespawnGuid(m_DBTableGuid))
{
- if(targetGuid == m_DBTableGuid) // if linking self, never respawn (check delayed to next day)
+ if (targetGuid == m_DBTableGuid) // if linking self, never respawn (check delayed to next day)
SetRespawnTime(DAY);
else
m_respawnTime = (time(NULL)>GetLinkedCreatureRespawnTime()? time(NULL):GetLinkedCreatureRespawnTime())+urand(5,MINUTE); // else copy time from master and add a little
@@ -519,7 +519,7 @@ void Creature::Update(uint32 diff)
{
if (m_isDeadByDefault)
{
- if( m_deathTimer <= diff )
+ if ( m_deathTimer <= diff )
{
RemoveCorpse();
DEBUG_LOG("Removing alive corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY));
@@ -534,18 +534,18 @@ void Creature::Update(uint32 diff)
// creature can be dead after Unit::Update call
// CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
- if(!isAlive())
+ if (!isAlive())
break;
// if creature is charmed, switch to charmed AI
- if(NeedChangeAI)
+ if (NeedChangeAI)
{
UpdateCharmAI();
NeedChangeAI = false;
IsAIEnabled = true;
}
- if(!IsInEvadeMode() && IsAIEnabled)
+ if (!IsInEvadeMode() && IsAIEnabled)
{
// do not allow the AI to be changed during update
m_AI_locked = true;
@@ -555,12 +555,12 @@ void Creature::Update(uint32 diff)
// creature can be dead after UpdateAI call
// CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
- if(!isAlive())
+ if (!isAlive())
break;
- if(m_regenTimer > 0)
+ if (m_regenTimer > 0)
{
- if(diff >= m_regenTimer)
+ if (diff >= m_regenTimer)
m_regenTimer = 0;
else
m_regenTimer -= diff;
@@ -574,24 +574,24 @@ void Creature::Update(uint32 diff)
!getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself() || // or the victim/owner/charmer is not a player
!getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()->isGameMaster()); // or the victim/owner/charmer is not a GameMaster
- /*if(m_regenTimer <= diff)
+ /*if (m_regenTimer <= diff)
{*/
- if(!bInCombat || bIsPolymorphed) // regenerate health if not in combat or if polymorphed
+ if (!bInCombat || bIsPolymorphed) // regenerate health if not in combat or if polymorphed
RegenerateHealth();
- if(getPowerType() == POWER_ENERGY)
+ if (getPowerType() == POWER_ENERGY)
{
- if(!IsVehicle() || GetVehicleKit()->GetVehicleInfo()->m_powerType != POWER_PYRITE)
+ if (!IsVehicle() || GetVehicleKit()->GetVehicleInfo()->m_powerType != POWER_PYRITE)
Regenerate(POWER_ENERGY);
}
else
RegenerateMana();
- /*if(!bIsPolymorphed) // only increase the timer if not polymorphed
+ /*if (!bIsPolymorphed) // only increase the timer if not polymorphed
m_regenTimer += CREATURE_REGEN_INTERVAL - diff;
}
else
- if(!bIsPolymorphed) // if polymorphed, skip the timer
+ if (!bIsPolymorphed) // if polymorphed, skip the timer
m_regenTimer -= diff;*/
m_regenTimer = CREATURE_REGEN_INTERVAL;
break;
@@ -617,7 +617,7 @@ void Creature::RegenerateMana()
// Combat and any controlled creature
if (isInCombat() || GetCharmerOrOwnerGUID())
{
- if(!IsUnderLastManaUseEffect())
+ if (!IsUnderLastManaUseEffect())
{
float ManaIncreaseRate = sWorld.getRate(RATE_POWER_MANA);
float Spirit = GetStat(STAT_SPIRIT);
@@ -653,12 +653,12 @@ void Creature::RegenerateHealth()
uint32 addvalue = 0;
// Not only pet, but any controlled creature
- if(GetCharmerOrOwnerGUID())
+ if (GetCharmerOrOwnerGUID())
{
float HealthIncreaseRate = sWorld.getRate(RATE_HEALTH);
float Spirit = GetStat(STAT_SPIRIT);
- if( GetPower(POWER_MANA) > 0 )
+ if ( GetPower(POWER_MANA) > 0 )
addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate);
else
addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate);
@@ -681,7 +681,7 @@ void Creature::DoFleeToGetAssistance()
if (!getVictim())
return;
- if(HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
+ if (HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
return;
float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
@@ -703,7 +703,7 @@ void Creature::DoFleeToGetAssistance()
SetNoSearchAssistance(true);
UpdateSpeed(MOVE_RUN, false);
- if(!pCreature)
+ if (!pCreature)
//SetFeared(true, getVictim()->GetGUID(), 0 ,sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
//TODO: use 31365
SetControlled(true, UNIT_STAT_FLEEING);
@@ -715,7 +715,7 @@ void Creature::DoFleeToGetAssistance()
bool Creature::AIM_Initialize(CreatureAI* ai)
{
// make sure nothing can change the AI during AI update
- if(m_AI_locked)
+ if (m_AI_locked)
{
sLog.outDebug("AIM_Initialize: failed to init, locked.");
return false;
@@ -726,7 +726,7 @@ bool Creature::AIM_Initialize(CreatureAI* ai)
Motion_Initialize();
i_AI = ai ? ai : FactorySelector::selectAI(this);
- if(oldAI) delete oldAI;
+ if (oldAI) delete oldAI;
IsAIEnabled = true;
i_AI->InitializeAI();
return true;
@@ -734,14 +734,14 @@ bool Creature::AIM_Initialize(CreatureAI* ai)
void Creature::Motion_Initialize()
{
- if(!m_formation)
+ if (!m_formation)
i_motionMaster.Initialize();
- else if(m_formation->getLeader() == this)
+ else if (m_formation->getLeader() == this)
{
m_formation->FormationReset(false);
i_motionMaster.Initialize();
}
- else if(m_formation->isFormed())
+ else if (m_formation->isFormed())
i_motionMaster.MoveIdle(MOTION_SLOT_IDLE); //wait the order of leader
else
i_motionMaster.Initialize();
@@ -755,7 +755,7 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry,
Relocate(x, y, z, ang);
- if(!IsPositionValid())
+ if (!IsPositionValid())
{
sLog.outError("Creature (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)",guidlow,Entry,x,y);
return false;
@@ -813,12 +813,12 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry,
bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
{
- if(!isTrainer())
+ if (!isTrainer())
return false;
TrainerSpellData const* trainer_spells = GetTrainerSpells();
- if((!trainer_spells || trainer_spells->spellList.empty()) && GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS)
+ if ((!trainer_spells || trainer_spells->spellList.empty()) && GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS)
{
sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.",
GetGUIDLow(),GetEntry());
@@ -828,9 +828,9 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
switch(GetCreatureInfo()->trainer_type)
{
case TRAINER_TYPE_CLASS:
- if(pPlayer->getClass()!=GetCreatureInfo()->trainer_class)
+ if (pPlayer->getClass()!=GetCreatureInfo()->trainer_class)
{
- if(msg)
+ if (msg)
{
pPlayer->PlayerTalkClass->ClearMenus();
switch(GetCreatureInfo()->trainer_class)
@@ -850,7 +850,7 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
}
break;
case TRAINER_TYPE_PETS:
- if(pPlayer->getClass()!=CLASS_HUNTER)
+ if (pPlayer->getClass()!=CLASS_HUNTER)
{
pPlayer->PlayerTalkClass->ClearMenus();
pPlayer->PlayerTalkClass->SendGossipMenu(3620,GetGUID());
@@ -858,9 +858,9 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
}
break;
case TRAINER_TYPE_MOUNTS:
- if(GetCreatureInfo()->trainer_race && pPlayer->getRace() != GetCreatureInfo()->trainer_race)
+ if (GetCreatureInfo()->trainer_race && pPlayer->getRace() != GetCreatureInfo()->trainer_race)
{
- if(msg)
+ if (msg)
{
pPlayer->PlayerTalkClass->ClearMenus();
switch(GetCreatureInfo()->trainer_class)
@@ -881,9 +881,9 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
}
break;
case TRAINER_TYPE_TRADESKILLS:
- if(GetCreatureInfo()->trainer_spell && !pPlayer->HasSpell(GetCreatureInfo()->trainer_spell))
+ if (GetCreatureInfo()->trainer_spell && !pPlayer->HasSpell(GetCreatureInfo()->trainer_spell))
{
- if(msg)
+ if (msg)
{
pPlayer->PlayerTalkClass->ClearMenus();
pPlayer->PlayerTalkClass->SendGossipMenu(11031,GetGUID());
@@ -899,14 +899,14 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const
{
- if(!isBattleMaster())
+ if (!isBattleMaster())
return false;
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(GetEntry());
- if(!msg)
+ if (!msg)
return pPlayer->GetBGAccessByLevel(bgTypeId);
- if(!pPlayer->GetBGAccessByLevel(bgTypeId))
+ if (!pPlayer->GetBGAccessByLevel(bgTypeId))
{
pPlayer->PlayerTalkClass->ClearMenus();
switch(bgTypeId)
@@ -979,7 +979,7 @@ void Creature::SetLootRecipient(Unit *unit)
}
Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself();
- if(!player) // normal creature, no player involved
+ if (!player) // normal creature, no player involved
return;
m_lootRecipient = player->GetGUID();
@@ -1012,7 +1012,7 @@ void Creature::SaveToDB()
// this should only be used when the creature has already been loaded
// preferably after adding to map, because mapid may not be valid otherwise
CreatureData const *data = objmgr.GetCreatureData(m_DBTableGuid);
- if(!data)
+ if (!data)
{
sLog.outError("Creature::SaveToDB failed, cannot get creature data!");
return;
@@ -1200,15 +1200,15 @@ float Creature::GetSpellDamageMod(int32 Rank)
bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint32 team, const CreatureData *data)
{
SetZoneScript();
- if(m_zoneScript && data)
+ if (m_zoneScript && data)
{
Entry = m_zoneScript->GetCreatureEntry(guidlow, data);
- if(!Entry)
+ if (!Entry)
return false;
}
CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(Entry);
- if(!cinfo)
+ if (!cinfo)
{
sLog.outErrorDb("Creature entry %u does not exist.", Entry);
return false;
@@ -1216,15 +1216,15 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint3
SetOriginalEntry(Entry);
- if(!vehId)
+ if (!vehId)
vehId = cinfo->VehicleId;
- if(vehId && !CreateVehicleKit(vehId))
+ if (vehId && !CreateVehicleKit(vehId))
vehId = 0;
Object::_Create(guidlow, Entry, vehId ? HIGHGUID_VEHICLE : HIGHGUID_UNIT);
- if(!UpdateEntry(Entry, team, data))
+ if (!UpdateEntry(Entry, team, data))
return false;
return true;
@@ -1234,7 +1234,7 @@ bool Creature::LoadFromDB(uint32 guid, Map *map)
{
CreatureData const* data = objmgr.GetCreatureData(guid);
- if(!data)
+ if (!data)
{
sLog.outErrorDb("Creature (GUID: %u) not found in table `creature`, can't load. ",guid);
return false;
@@ -1250,7 +1250,7 @@ bool Creature::LoadFromDB(uint32 guid, Map *map)
guid = objmgr.GenerateLowGuid(HIGHGUID_UNIT);
uint16 team = 0;
- if(!Create(guid,map,data->phaseMask,data->id,0,team,data->posX,data->posY,data->posZ,data->orientation,data))
+ if (!Create(guid,map,data->phaseMask,data->id,0,team,data->posX,data->posY,data->posZ,data->orientation,data))
return false;
//We should set first home position, because then AI calls home movement
@@ -1263,22 +1263,22 @@ bool Creature::LoadFromDB(uint32 guid, Map *map)
m_deathState = m_isDeadByDefault ? DEAD : ALIVE;
m_respawnTime = objmgr.GetCreatureRespawnTime(m_DBTableGuid,GetInstanceId());
- if(m_respawnTime) // respawn on Update
+ if (m_respawnTime) // respawn on Update
{
m_deathState = DEAD;
- if(canFly())
+ if (canFly())
{
float tz = map->GetHeight(data->posX,data->posY,data->posZ,false);
- if(data->posZ - tz > 0.1)
+ if (data->posZ - tz > 0.1)
Relocate(data->posX,data->posY,tz);
}
}
uint32 curhealth = data->curhealth;
- if(curhealth)
+ if (curhealth)
{
curhealth = uint32(curhealth*_GetHealthMod(GetCreatureInfo()->rank));
- if(curhealth < 1)
+ if (curhealth < 1)
curhealth = 1;
}
@@ -1295,7 +1295,7 @@ bool Creature::LoadFromDB(uint32 guid, Map *map)
void Creature::LoadEquipment(uint32 equip_entry, bool force)
{
- if(equip_entry == 0)
+ if (equip_entry == 0)
{
if (force)
{
@@ -1320,7 +1320,7 @@ bool Creature::hasQuest(uint32 quest_id) const
QuestRelations const& qr = objmgr.mCreatureQuestRelations;
for (QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr)
{
- if(itr->second==quest_id)
+ if (itr->second==quest_id)
return true;
}
return false;
@@ -1331,7 +1331,7 @@ bool Creature::hasInvolvedQuest(uint32 quest_id) const
QuestRelations const& qr = objmgr.mCreatureQuestInvolvedRelations;
for (QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr)
{
- if(itr->second==quest_id)
+ if (itr->second==quest_id)
return true;
}
return false;
@@ -1359,11 +1359,11 @@ void Creature::DeleteFromDB()
bool Creature::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance) const
{
// not in world
- if(!IsInWorld() || !u->IsInWorld())
+ if (!IsInWorld() || !u->IsInWorld())
return false;
// all dead creatures/players not visible for any creatures
- if(!u->isAlive() || !isAlive())
+ if (!u->isAlive() || !isAlive())
return false;
// Always can see self
@@ -1371,18 +1371,18 @@ bool Creature::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bo
return true;
// phased visibility (both must phased in same way)
- if(!InSamePhase(u))
+ if (!InSamePhase(u))
return false;
// always seen by owner
- if(GetGUID() == u->GetCharmerOrOwnerGUID())
+ if (GetGUID() == u->GetCharmerOrOwnerGUID())
return true;
- if(u->GetVisibility() == VISIBILITY_OFF) //GM
+ if (u->GetVisibility() == VISIBILITY_OFF) //GM
return false;
// invisible aura
- if((m_invisibilityMask || u->m_invisibilityMask) && !canDetectInvisibilityOf(u))
+ if ((m_invisibilityMask || u->m_invisibilityMask) && !canDetectInvisibilityOf(u))
return false;
// unit got in stealth in this moment and must ignore old detected state
@@ -1390,10 +1390,10 @@ bool Creature::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bo
// return false;
// GM invisibility checks early, invisibility if any detectable, so if not stealth then visible
- if(u->GetVisibility() == VISIBILITY_GROUP_STEALTH)
+ if (u->GetVisibility() == VISIBILITY_GROUP_STEALTH)
{
//do not know what is the use of this detect
- if(!detect || !canDetectStealthOf(u, GetDistance(u)))
+ if (!detect || !canDetectStealthOf(u, GetDistance(u)))
return false;
}
@@ -1404,30 +1404,30 @@ bool Creature::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bo
bool Creature::canStartAttack(Unit const* who, bool force) const
{
- if(isCivilian())
+ if (isCivilian())
return false;
- if(!canFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE + m_CombatDistance))
+ if (!canFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE + m_CombatDistance))
//|| who->IsControlledByPlayer() && who->IsFlying()))
// we cannot check flying for other creatures, too much map/vmap calculation
// TODO: should switch to range attack
return false;
- if(!force)
+ if (!force)
{
- if(!_IsTargetAcceptable(who))
+ if (!_IsTargetAcceptable(who))
return false;
- if(who->isInCombat())
- if(Unit *victim = who->getAttackerForHelper())
- if(IsWithinDistInMap(victim, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS)))
+ if (who->isInCombat())
+ if (Unit *victim = who->getAttackerForHelper())
+ if (IsWithinDistInMap(victim, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS)))
force = true;
- if(!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance)))
+ if (!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance)))
return false;
}
- if(!canCreatureAttack(who, force))
+ if (!canCreatureAttack(who, force))
return false;
return IsWithinLOSInMap(who);
@@ -1436,7 +1436,7 @@ bool Creature::canStartAttack(Unit const* who, bool force) const
float Creature::GetAttackDistance(Unit const* pl) const
{
float aggroRate = sWorld.getRate(RATE_CREATURE_AGGRO);
- if(aggroRate==0)
+ if (aggroRate==0)
return 0.0f;
uint32 playerlevel = pl->getLevelForTarget(this);
@@ -1455,7 +1455,7 @@ float Creature::GetAttackDistance(Unit const* pl) const
// radius grow if playlevel < creaturelevel
RetDistance -= (float)leveldif;
- if(creaturelevel+5 <= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
+ if (creaturelevel+5 <= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
{
// detect range auras
RetDistance += GetTotalAuraModifier(SPELL_AURA_MOD_DETECT_RANGE);
@@ -1465,7 +1465,7 @@ float Creature::GetAttackDistance(Unit const* pl) const
}
// "Minimum Aggro Radius for a mob seems to be combat range (5 yards)"
- if(RetDistance < 5)
+ if (RetDistance < 5)
RetDistance = 5;
return (RetDistance*aggroRate);
@@ -1473,24 +1473,24 @@ float Creature::GetAttackDistance(Unit const* pl) const
void Creature::setDeathState(DeathState s)
{
- if((s == JUST_DIED && !m_isDeadByDefault)||(s == JUST_ALIVED && m_isDeadByDefault))
+ if ((s == JUST_DIED && !m_isDeadByDefault)||(s == JUST_ALIVED && m_isDeadByDefault))
{
m_deathTimer = m_corpseDelay*IN_MILISECONDS;
// always save boss respawn time at death to prevent crash cheating
- if(sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY) || isWorldBoss())
+ if (sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY) || isWorldBoss())
SaveRespawnTime();
}
Unit::setDeathState(s);
- if(s == JUST_DIED)
+ if (s == JUST_DIED)
{
SetUInt64Value(UNIT_FIELD_TARGET,0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
setActive(false);
- if(!isPet() && GetCreatureInfo()->SkinLootId)
+ if (!isPet() && GetCreatureInfo()->SkinLootId)
if ( LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId) )
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
@@ -1501,7 +1501,7 @@ void Creature::setDeathState(DeathState s)
}
//Dismiss group if is leader
- if(m_formation && m_formation->getLeader() == this)
+ if (m_formation && m_formation->getLeader() == this)
m_formation->FormationReset(true);
if ((canFly() || IsFlying()) && FallGround())
@@ -1509,27 +1509,27 @@ void Creature::setDeathState(DeathState s)
Unit::setDeathState(CORPSE);
}
- else if(s == JUST_ALIVED)
+ else if (s == JUST_ALIVED)
{
- //if(isPet())
+ //if (isPet())
// setActive(true);
SetHealth(GetMaxHealth());
SetLootRecipient(NULL);
ResetPlayerDamageReq();
CreatureInfo const *cinfo = GetCreatureInfo();
AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
- if(GetCreatureInfo()->InhabitType & INHABIT_AIR)
+ if (GetCreatureInfo()->InhabitType & INHABIT_AIR)
AddUnitMovementFlag(MOVEMENTFLAG_FLY_MODE | MOVEMENTFLAG_FLYING);
- if(GetCreatureInfo()->InhabitType & INHABIT_WATER)
+ if (GetCreatureInfo()->InhabitType & INHABIT_WATER)
AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag);
clearUnitState(UNIT_STAT_ALL_STATE);
SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool));
LoadCreaturesAddon(true);
Motion_Initialize();
- if(GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask)
+ if (GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask)
SetPhaseMask(GetCreatureData()->phaseMask, false);
- if(m_vehicleKit) m_vehicleKit->Reset();
+ if (m_vehicleKit) m_vehicleKit->Reset();
Unit::setDeathState(ALIVE);
}
}
@@ -1555,17 +1555,17 @@ void Creature::Respawn(bool force)
{
DestroyForNearbyPlayers();
- if(force)
+ if (force)
{
- if(isAlive())
+ if (isAlive())
setDeathState(JUST_DIED);
- else if(getDeathState() != CORPSE)
+ else if (getDeathState() != CORPSE)
setDeathState(CORPSE);
}
RemoveCorpse();
- if(getDeathState()==DEAD)
+ if (getDeathState()==DEAD)
{
if (m_DBTableGuid)
objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),0);
@@ -1575,7 +1575,7 @@ void Creature::Respawn(bool force)
lootForPickPocketed = false;
lootForBody = false;
- if(m_originalEntry != GetEntry())
+ if (m_originalEntry != GetEntry())
UpdateEntry(m_originalEntry);
CreatureInfo const *cinfo = GetCreatureInfo();
@@ -1650,15 +1650,15 @@ bool Creature::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index)
SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
{
- if(!pVictim)
+ if (!pVictim)
return NULL;
for (uint32 i=0; i < CREATURE_MAX_SPELLS; ++i)
{
- if(!m_spells[i])
+ if (!m_spells[i])
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i] );
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outError("WORLD: unknown spell id %i", m_spells[i]);
continue;
@@ -1667,7 +1667,7 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
bool bcontinue = true;
for (uint32 j=0; j<3; j++)
{
- if( (spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE ) ||
+ if ( (spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE ) ||
(spellInfo->Effect[j] == SPELL_EFFECT_INSTAKILL) ||
(spellInfo->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
(spellInfo->Effect[j] == SPELL_EFFECT_HEALTH_LEECH )
@@ -1677,21 +1677,21 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
break;
}
}
- if(bcontinue) continue;
+ if (bcontinue) continue;
- if(spellInfo->manaCost > GetPower(POWER_MANA))
+ if (spellInfo->manaCost > GetPower(POWER_MANA))
continue;
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
float range = GetSpellMaxRangeForHostile(srange);
float minrange = GetSpellMinRangeForHostile(srange);
float dist = GetDistance(pVictim);
- //if(!isInFront( pVictim, range ) && spellInfo->AttributesEx )
+ //if (!isInFront( pVictim, range ) && spellInfo->AttributesEx )
// continue;
- if( dist > range || dist < minrange )
+ if ( dist > range || dist < minrange )
continue;
- if(spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
+ if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
continue;
- if(spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
+ if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
continue;
return spellInfo;
}
@@ -1700,15 +1700,15 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
{
- if(!pVictim)
+ if (!pVictim)
return NULL;
for (uint32 i=0; i < CREATURE_MAX_SPELLS; ++i)
{
- if(!m_spells[i])
+ if (!m_spells[i])
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i] );
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outError("WORLD: unknown spell id %i", m_spells[i]);
continue;
@@ -1717,27 +1717,27 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
bool bcontinue = true;
for (uint32 j=0; j<3; j++)
{
- if( (spellInfo->Effect[j] == SPELL_EFFECT_HEAL ) )
+ if ( (spellInfo->Effect[j] == SPELL_EFFECT_HEAL ) )
{
bcontinue = false;
break;
}
}
- if(bcontinue) continue;
+ if (bcontinue) continue;
- if(spellInfo->manaCost > GetPower(POWER_MANA))
+ if (spellInfo->manaCost > GetPower(POWER_MANA))
continue;
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
float range = GetSpellMaxRangeForFriend(srange);
float minrange = GetSpellMinRangeForFriend( srange);
float dist = GetDistance(pVictim);
- //if(!isInFront( pVictim, range ) && spellInfo->AttributesEx )
+ //if (!isInFront( pVictim, range ) && spellInfo->AttributesEx )
// continue;
- if( dist > range || dist < minrange )
+ if ( dist > range || dist < minrange )
continue;
- if(spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
+ if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
continue;
- if(spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
+ if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
continue;
return spellInfo;
}
@@ -1747,35 +1747,35 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
bool Creature::IsVisibleInGridForPlayer(Player const* pl) const
{
// gamemaster in GM mode see all, including ghosts
- if(pl->isGameMaster())
+ if (pl->isGameMaster())
return true;
// Trigger shouldn't be visible for players
- if(isTrigger())
+ if (isTrigger())
return false;
// Live player (or with not release body see live creatures or death creatures with corpse disappearing time > 0
- if(pl->isAlive() || pl->GetDeathTimer() > 0)
+ if (pl->isAlive() || pl->GetDeathTimer() > 0)
{
- if( GetEntry() == VISUAL_WAYPOINT )
+ if ( GetEntry() == VISUAL_WAYPOINT )
return false;
return (isAlive() || m_deathTimer > 0 || (m_isDeadByDefault && m_deathState==CORPSE));
}
// Dead player see live creatures near own corpse
- if(isAlive())
+ if (isAlive())
{
Corpse *corpse = pl->GetCorpse();
- if(corpse)
+ if (corpse)
{
// 20 - aggro distance for same level, 25 - max additional distance if player level less that creature level
- if(corpse->IsWithinDistInMap(this,(20+25)*sWorld.getRate(RATE_CREATURE_AGGRO)))
+ if (corpse->IsWithinDistInMap(this,(20+25)*sWorld.getRate(RATE_CREATURE_AGGRO)))
return true;
}
}
// Dead player see Spirit Healer or Spirit Guide
- if(isSpiritService())
+ if (isSpiritService())
return true;
// and not see any other
@@ -1819,13 +1819,13 @@ void Creature::SendAIReaction(AiReaction reactionType)
void Creature::CallAssistance()
{
- if( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed())
+ if ( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed())
{
SetNoCallAssistance(true);
float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
- if(radius > 0)
+ if (radius > 0)
{
std::list<Creature*> assistList;
@@ -1879,7 +1879,7 @@ void Creature::CallForHelp(float fRadius)
bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /*= true*/) const
{
// is it true?
- if(!HasReactState(REACT_AGGRESSIVE))
+ if (!HasReactState(REACT_AGGRESSIVE))
return false;
// we don't need help from zombies :)
@@ -1947,37 +1947,37 @@ bool Creature::_IsTargetAcceptable(const Unit *target) const
void Creature::SaveRespawnTime()
{
- if(isSummon() || !m_DBTableGuid || m_creatureData && !m_creatureData->dbData)
+ if (isSummon() || !m_DBTableGuid || m_creatureData && !m_creatureData->dbData)
return;
- if(m_respawnTime > time(NULL)) // dead (no corpse)
+ if (m_respawnTime > time(NULL)) // dead (no corpse)
objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),m_respawnTime);
- else if(m_deathTimer > 0) // dead (corpse)
+ else if (m_deathTimer > 0) // dead (corpse)
objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),time(NULL)+m_respawnDelay+m_deathTimer/IN_MILISECONDS);
}
// this should not be called by petAI or
bool Creature::canCreatureAttack(Unit const *pVictim, bool force) const
{
- if(!pVictim->IsInMap(this))
+ if (!pVictim->IsInMap(this))
return false;
- if(!canAttack(pVictim, force))
+ if (!canAttack(pVictim, force))
return false;
- if(!pVictim->isInAccessiblePlaceFor(this))
+ if (!pVictim->isInAccessiblePlaceFor(this))
return false;
- if(IsAIEnabled && !AI()->CanAIAttack(pVictim))
+ if (IsAIEnabled && !AI()->CanAIAttack(pVictim))
return false;
- if(sMapStore.LookupEntry(GetMapId())->IsDungeon())
+ if (sMapStore.LookupEntry(GetMapId())->IsDungeon())
return true;
//Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick.
float dist = std::max(GetAttackDistance(pVictim), (float)sWorld.getConfig(CONFIG_THREAT_RADIUS)) + m_CombatDistance;
- if(Unit *unit = GetCharmerOrOwner())
+ if (Unit *unit = GetCharmerOrOwner())
return pVictim->IsWithinDist(unit, dist);
else
return pVictim->IsInDist(&m_homePosition, dist);
@@ -1987,7 +1987,7 @@ CreatureDataAddon const* Creature::GetCreatureAddon() const
{
if (m_DBTableGuid)
{
- if(CreatureDataAddon const* addon = ObjectMgr::GetCreatureAddon(m_DBTableGuid))
+ if (CreatureDataAddon const* addon = ObjectMgr::GetCreatureAddon(m_DBTableGuid))
return addon;
}
@@ -1999,7 +1999,7 @@ CreatureDataAddon const* Creature::GetCreatureAddon() const
bool Creature::LoadCreaturesAddon(bool reload)
{
CreatureDataAddon const *cainfo = GetCreatureAddon();
- if(!cainfo)
+ if (!cainfo)
return false;
if (cainfo->mount != 0)
@@ -2041,7 +2041,7 @@ bool Creature::LoadCreaturesAddon(bool reload)
if (cainfo->path_id != 0)
m_path_id = cainfo->path_id;
- if(cainfo->auras)
+ if (cainfo->auras)
{
for (CreatureDataAddonAura const* cAura = cainfo->auras; cAura->spell_id; ++cAura)
{
@@ -2053,9 +2053,9 @@ bool Creature::LoadCreaturesAddon(bool reload)
}
// skip already applied aura
- if(HasAura(cAura->spell_id))
+ if (HasAura(cAura->spell_id))
{
- if(!reload)
+ if (!reload)
sLog.outErrorDb("Creature (GUID: %u Entry: %u) has duplicate aura (spell %u) in `auras` field.",GetGUIDLow(),GetEntry(),cAura->spell_id);
continue;
@@ -2128,17 +2128,17 @@ void Creature::_AddCreatureCategoryCooldown(uint32 category, time_t apply_time)
void Creature::AddCreatureSpellCooldown(uint32 spellid)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);
- if(!spellInfo)
+ if (!spellInfo)
return;
uint32 cooldown = GetSpellRecoveryTime(spellInfo);
- if(Player *modOwner = GetSpellModOwner())
+ if (Player *modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellid, SPELLMOD_COOLDOWN, cooldown);
- if(cooldown)
+ if (cooldown)
_AddCreatureSpellCooldown(spellid, time(NULL) + cooldown/IN_MILISECONDS);
- if(spellInfo->Category)
+ if (spellInfo->Category)
_AddCreatureCategoryCooldown(spellInfo->Category, time(NULL));
m_GlobalCooldown = spellInfo->StartRecoveryTime;
@@ -2147,7 +2147,7 @@ void Creature::AddCreatureSpellCooldown(uint32 spellid)
bool Creature::HasCategoryCooldown(uint32 spell_id) const
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
- if(!spellInfo)
+ if (!spellInfo)
return false;
// check global cooldown if spell affected by it
@@ -2168,7 +2168,7 @@ bool Creature::HasSpell(uint32 spellID) const
{
uint8 i;
for (i = 0; i < CREATURE_MAX_SPELLS; ++i)
- if(spellID == m_spells[i])
+ if (spellID == m_spells[i])
break;
return i < CREATURE_MAX_SPELLS; //broke before end of iteration of known spells
}
@@ -2176,9 +2176,9 @@ bool Creature::HasSpell(uint32 spellID) const
time_t Creature::GetRespawnTimeEx() const
{
time_t now = time(NULL);
- if(m_respawnTime > now) // dead (no corpse)
+ if (m_respawnTime > now) // dead (no corpse)
return m_respawnTime;
- else if(m_deathTimer > 0) // dead (corpse)
+ else if (m_deathTimer > 0) // dead (corpse)
return now+m_respawnDelay+m_deathTimer/IN_MILISECONDS;
else
return now;
@@ -2193,9 +2193,9 @@ void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float*
x = data->posX;
y = data->posY;
z = data->posZ;
- if(ori)
+ if (ori)
*ori = data->orientation;
- if(dist)
+ if (dist)
*dist = data->spawndist;
return;
@@ -2205,9 +2205,9 @@ void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float*
x = GetPositionX();
y = GetPositionY();
z = GetPositionZ();
- if(ori)
+ if (ori)
*ori = GetOrientation();
- if(dist)
+ if (dist)
*dist = 0;
}
@@ -2234,13 +2234,13 @@ void Creature::AllLootRemovedFromCorpse()
uint8 Creature::getLevelForTarget(Unit const* target) const
{
- if(!isWorldBoss())
+ if (!isWorldBoss())
return Unit::getLevelForTarget(target);
uint16 level = target->getLevel()+sWorld.getConfig(CONFIG_WORLD_BOSS_LEVEL_DIFF);
- if(level < 1)
+ if (level < 1)
return 1;
- if(level > 255)
+ if (level > 255)
return 255;
return level;
}
@@ -2267,27 +2267,27 @@ VendorItemData const* Creature::GetVendorItems() const
uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem)
{
- if(!vItem->maxcount)
+ if (!vItem->maxcount)
return vItem->maxcount;
VendorItemCounts::iterator itr = m_vendorItemCounts.begin();
for (; itr != m_vendorItemCounts.end(); ++itr)
- if(itr->itemId==vItem->item)
+ if (itr->itemId==vItem->item)
break;
- if(itr == m_vendorItemCounts.end())
+ if (itr == m_vendorItemCounts.end())
return vItem->maxcount;
VendorItemCount* vCount = &*itr;
time_t ptime = time(NULL);
- if( vCount->lastIncrementTime + vItem->incrtime <= ptime )
+ if ( vCount->lastIncrementTime + vItem->incrtime <= ptime )
{
ItemPrototype const* pProto = objmgr.GetItemPrototype(vItem->item);
uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
- if((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount )
+ if ((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount )
{
m_vendorItemCounts.erase(itr);
return vItem->maxcount;
@@ -2302,15 +2302,15 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem)
uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 used_count)
{
- if(!vItem->maxcount)
+ if (!vItem->maxcount)
return 0;
VendorItemCounts::iterator itr = m_vendorItemCounts.begin();
for (; itr != m_vendorItemCounts.end(); ++itr)
- if(itr->itemId==vItem->item)
+ if (itr->itemId==vItem->item)
break;
- if(itr == m_vendorItemCounts.end())
+ if (itr == m_vendorItemCounts.end())
{
int32 new_count = vItem->maxcount > used_count ? vItem->maxcount-used_count : 0;
m_vendorItemCounts.push_back(VendorItemCount(vItem->item,new_count));
@@ -2321,12 +2321,12 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us
time_t ptime = time(NULL);
- if( vCount->lastIncrementTime + vItem->incrtime <= ptime )
+ if ( vCount->lastIncrementTime + vItem->incrtime <= ptime )
{
ItemPrototype const* pProto = objmgr.GetItemPrototype(vItem->item);
uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
- if((vCount->count + diff * pProto->BuyCount) < vItem->maxcount )
+ if ((vCount->count + diff * pProto->BuyCount) < vItem->maxcount )
vCount->count += diff * pProto->BuyCount;
else
vCount->count = vItem->maxcount;
@@ -2360,10 +2360,10 @@ const char* Creature::GetNameForLocaleIdx(int32 loc_idx) const
const CreatureData* Creature::GetLinkedRespawnCreatureData() const
{
- if(!m_DBTableGuid) // only hard-spawned creatures from DB can have a linked master
+ if (!m_DBTableGuid) // only hard-spawned creatures from DB can have a linked master
return NULL;
- if(uint32 targetGuid = objmgr.GetLinkedRespawnGuid(m_DBTableGuid))
+ if (uint32 targetGuid = objmgr.GetLinkedRespawnGuid(m_DBTableGuid))
return objmgr.GetCreatureData(targetGuid);
return NULL;
@@ -2372,20 +2372,20 @@ const CreatureData* Creature::GetLinkedRespawnCreatureData() const
// returns master's remaining respawn time if any
time_t Creature::GetLinkedCreatureRespawnTime() const
{
- if(!m_DBTableGuid) // only hard-spawned creatures from DB can have a linked master
+ if (!m_DBTableGuid) // only hard-spawned creatures from DB can have a linked master
return 0;
- if(uint32 targetGuid = objmgr.GetLinkedRespawnGuid(m_DBTableGuid))
+ if (uint32 targetGuid = objmgr.GetLinkedRespawnGuid(m_DBTableGuid))
{
Map* targetMap = NULL;
- if(const CreatureData* data = objmgr.GetCreatureData(targetGuid))
+ if (const CreatureData* data = objmgr.GetCreatureData(targetGuid))
{
- if(data->mapid == GetMapId()) // look up on the same map
+ if (data->mapid == GetMapId()) // look up on the same map
targetMap = GetMap();
else // it shouldn't be instanceable map here
targetMap = MapManager::Instance().FindMap(data->mapid);
}
- if(targetMap)
+ if (targetMap)
return objmgr.GetCreatureRespawnTime(targetGuid,targetMap->GetInstanceId());
}
diff --git a/src/game/Creature.h b/src/game/Creature.h
index 737da768302..0a07c17b77b 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -146,11 +146,11 @@ struct CreatureInfo
// helpers
SkillType GetRequiredLootSkill() const
{
- if(type_flags & CREATURE_TYPEFLAGS_HERBLOOT)
+ if (type_flags & CREATURE_TYPEFLAGS_HERBLOOT)
return SKILL_HERBALISM;
- else if(type_flags & CREATURE_TYPEFLAGS_MININGLOOT)
+ else if (type_flags & CREATURE_TYPEFLAGS_MININGLOOT)
return SKILL_MINING;
- else if(type_flags & CREATURE_TYPEFLAGS_ENGINEERLOOT)
+ else if (type_flags & CREATURE_TYPEFLAGS_ENGINEERLOOT)
return SKILL_ENGINERING;
else
return SKILL_SKINNING; // normal case
@@ -158,7 +158,7 @@ struct CreatureInfo
bool isTameable(bool exotic) const
{
- if(type != CREATURE_TYPE_BEAST || family == 0 || (type_flags & CREATURE_TYPEFLAGS_TAMEABLE)==0)
+ if (type != CREATURE_TYPE_BEAST || family == 0 || (type_flags & CREATURE_TYPEFLAGS_TAMEABLE)==0)
return false;
// if can tame exotic then can tame any temable
@@ -323,7 +323,7 @@ struct VendorItemData
VendorItem* GetItem(uint32 slot) const
{
- if(slot>=m_items.size()) return NULL;
+ if (slot>=m_items.size()) return NULL;
return m_items[slot];
}
bool Empty() const { return m_items.empty(); }
@@ -440,7 +440,7 @@ class Creature : public Unit, public GridObject<Creature>
// redefine Unit::IsImmunedToSpellEffect
bool isElite() const
{
- if(isPet())
+ if (isPet())
return false;
uint32 rank = GetCreatureInfo()->rank;
@@ -449,7 +449,7 @@ class Creature : public Unit, public GridObject<Creature>
bool isWorldBoss() const
{
- if(isPet())
+ if (isPet())
return false;
return GetCreatureInfo()->rank == CREATURE_ELITE_WORLDBOSS;
@@ -641,7 +641,7 @@ class Creature : public Unit, public GridObject<Creature>
bool IsDamageEnoughForLootingAndReward() const { return m_PlayerDamageReq == 0; }
void LowerPlayerDamageReq(uint32 unDamage)
{
- if(m_PlayerDamageReq)
+ if (m_PlayerDamageReq)
m_PlayerDamageReq > unDamage ? m_PlayerDamageReq -= unDamage : m_PlayerDamageReq = 0;
}
void ResetPlayerDamageReq() { m_PlayerDamageReq = GetHealth() / 2; }
diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp
index 1451cf46d6f..fb11f63ee55 100644
--- a/src/game/CreatureAI.cpp
+++ b/src/game/CreatureAI.cpp
@@ -41,7 +41,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature)
if (!creature)
creature = me;
- if(!creature->CanHaveThreatList())
+ if (!creature->CanHaveThreatList())
return;
Map *map = creature->GetMap();
@@ -51,24 +51,24 @@ void CreatureAI::DoZoneInCombat(Creature* creature)
return;
}
- if(!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
+ if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
{
- if(Unit *target = creature->SelectNearestTarget(50))
+ if (Unit *target = creature->SelectNearestTarget(50))
creature->AI()->AttackStart(target);
- else if(creature->isSummon())
+ else if (creature->isSummon())
{
- if(Unit *summoner = creature->ToTempSummon()->GetSummoner())
+ if (Unit *summoner = creature->ToTempSummon()->GetSummoner())
{
Unit *target = summoner->getAttackerForHelper();
- if(!target && summoner->CanHaveThreatList() && !summoner->getThreatManager().isThreatListEmpty())
+ if (!target && summoner->CanHaveThreatList() && !summoner->getThreatManager().isThreatListEmpty())
target = summoner->getThreatManager().getHostilTarget();
- if(target && (creature->IsFriendlyTo(summoner) || creature->IsHostileTo(target)))
+ if (target && (creature->IsFriendlyTo(summoner) || creature->IsHostileTo(target)))
creature->AI()->AttackStart(target);
}
}
}
- if(!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
+ if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
{
sLog.outError("DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry());
return;
@@ -76,17 +76,17 @@ void CreatureAI::DoZoneInCombat(Creature* creature)
Map::PlayerList const &PlList = map->GetPlayers();
- if(PlList.isEmpty())
+ if (PlList.isEmpty())
return;
for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
{
- if(Player* pPlayer = i->getSource())
+ if (Player* pPlayer = i->getSource())
{
- if(pPlayer->isGameMaster())
+ if (pPlayer->isGameMaster())
continue;
- if(pPlayer->isAlive())
+ if (pPlayer->isAlive())
{
creature->SetInCombatWith(pPlayer);
pPlayer->SetInCombatWith(creature);
@@ -108,7 +108,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature)
// MoveInLineOfSight can be called inside another MoveInLineOfSight and cause stack overflow
void CreatureAI::MoveInLineOfSight_Safe(Unit *who)
{
- if(m_MoveInLineOfSight_locked == true)
+ if (m_MoveInLineOfSight_locked == true)
return;
m_MoveInLineOfSight_locked = true;
MoveInLineOfSight(who);
@@ -117,15 +117,15 @@ void CreatureAI::MoveInLineOfSight_Safe(Unit *who)
void CreatureAI::MoveInLineOfSight(Unit *who)
{
- if(me->getVictim())
+ if (me->getVictim())
return;
if (me->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET) // non-combat pets should just stand there and look good;)
return;
- if(me->canStartAttack(who, false))
+ if (me->canStartAttack(who, false))
AttackStart(who);
- //else if(who->getVictim() && me->IsFriendlyTo(who)
+ //else if (who->getVictim() && me->IsFriendlyTo(who)
// && me->IsWithinDistInMap(who, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))
// && me->canStartAttack(who->getVictim(), true)) // TODO: if we use true, it will not attack it when it arrives
// me->GetMotionMaster()->MoveChase(who->getVictim());
@@ -133,7 +133,7 @@ void CreatureAI::MoveInLineOfSight(Unit *who)
void CreatureAI::SelectNearestTarget(Unit *who)
{
- if(me->getVictim() && me->GetDistanceOrder(who, me->getVictim()) && me->canAttack(who))
+ if (me->getVictim() && me->GetDistanceOrder(who, me->getVictim()) && me->canAttack(who))
{
me->getThreatManager().modifyThreatPercent(me->getVictim(), -100);
me->AddThreat(who, 1000000.0f);
@@ -142,14 +142,14 @@ void CreatureAI::SelectNearestTarget(Unit *who)
void CreatureAI::EnterEvadeMode()
{
- if(!_EnterEvadeMode())
+ if (!_EnterEvadeMode())
return;
sLog.outDebug("Creature %u enters evade mode.", me->GetEntry());
- if(!me->GetVehicle()) // otherwise me will be in evade mode forever
+ if (!me->GetVehicle()) // otherwise me will be in evade mode forever
{
- if(Unit *owner = me->GetCharmerOrOwner())
+ if (Unit *owner = me->GetCharmerOrOwner())
{
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, m_creature->GetFollowAngle(), MOTION_SLOT_ACTIVE);
@@ -160,12 +160,12 @@ void CreatureAI::EnterEvadeMode()
Reset();
- if(me->IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons!
+ if (me->IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons!
me->GetVehicleKit()->Reset();
}
/*void CreatureAI::AttackedBy( Unit* attacker )
{
- if(!m_creature->getVictim())
+ if (!m_creature->getVictim())
AttackStart(attacker);
}*/
diff --git a/src/game/CreatureAIImpl.h b/src/game/CreatureAIImpl.h
index 3aaf9849591..45bc4e0dab0 100644
--- a/src/game/CreatureAIImpl.h
+++ b/src/game/CreatureAIImpl.h
@@ -532,7 +532,7 @@ inline bool CreatureAI::UpdateVictim()
if (!me->HasReactState(REACT_PASSIVE))
{
- if(Unit *victim = me->SelectVictim())
+ if (Unit *victim = me->SelectVictim())
AttackStart(victim);
return me->getVictim();
}
diff --git a/src/game/CreatureAISelector.cpp b/src/game/CreatureAISelector.cpp
index 8dd256eca6a..257e2966c30 100644
--- a/src/game/CreatureAISelector.cpp
+++ b/src/game/CreatureAISelector.cpp
@@ -38,45 +38,45 @@ namespace FactorySelector
const CreatureAICreator *ai_factory = NULL;
CreatureAIRegistry &ai_registry(CreatureAIRepository::Instance());
- if(creature->isPet())
+ if (creature->isPet())
ai_factory = ai_registry.GetRegistryItem("PetAI");
//scriptname in db
- if(!ai_factory)
- if(CreatureAI* scriptedAI = sScriptMgr.GetAI(creature))
+ if (!ai_factory)
+ if (CreatureAI* scriptedAI = sScriptMgr.GetAI(creature))
return scriptedAI;
// AIname in db
std::string ainame=creature->GetAIName();
- if(!ai_factory && !ainame.empty())
+ if (!ai_factory && !ainame.empty())
ai_factory = ai_registry.GetRegistryItem( ainame.c_str() );
// select by NPC flags
- if(!ai_factory)
+ if (!ai_factory)
{
- if(creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN) && ((Guardian*)creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER)
+ if (creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN) && ((Guardian*)creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER)
ai_factory = ai_registry.GetRegistryItem("PetAI");
- else if(creature->IsVehicle() || creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK))
+ else if (creature->IsVehicle() || creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK))
ai_factory = ai_registry.GetRegistryItem("NullCreatureAI");
- else if(creature->isGuard())
+ else if (creature->isGuard())
ai_factory = ai_registry.GetRegistryItem("GuardAI");
- else if(creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
+ else if (creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
ai_factory = ai_registry.GetRegistryItem("PetAI");
- else if(creature->isTotem())
+ else if (creature->isTotem())
ai_factory = ai_registry.GetRegistryItem("TotemAI");
- else if(creature->isTrigger())
+ else if (creature->isTrigger())
{
- if(creature->m_spells[0])
+ if (creature->m_spells[0])
ai_factory = ai_registry.GetRegistryItem("TriggerAI");
else
ai_factory = ai_registry.GetRegistryItem("NullCreatureAI");
}
- else if(creature->GetCreatureType() == CREATURE_TYPE_CRITTER && !creature->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
+ else if (creature->GetCreatureType() == CREATURE_TYPE_CRITTER && !creature->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
ai_factory = ai_registry.GetRegistryItem("CritterAI");
}
// select by permit check
- if(!ai_factory)
+ if (!ai_factory)
{
int best_val = -1;
typedef CreatureAIRegistry::RegistryMapType RMT;
@@ -87,7 +87,7 @@ namespace FactorySelector
const SelectableAI *p = dynamic_cast<const SelectableAI *>(factory);
assert( p != NULL );
int val = p->Permit(creature);
- if( val > best_val )
+ if ( val > best_val )
{
best_val = val;
ai_factory = p;
@@ -108,7 +108,7 @@ namespace FactorySelector
assert( creature->GetCreatureInfo() != NULL );
const MovementGeneratorCreator *mv_factory = mv_registry.GetRegistryItem( creature->GetDefaultMovementType());
- /* if( mv_factory == NULL )
+ /* if ( mv_factory == NULL )
{
int best_val = -1;
std::vector<std::string> l;
@@ -119,7 +119,7 @@ namespace FactorySelector
const SelectableMovement *p = dynamic_cast<const SelectableMovement *>(factory);
assert( p != NULL );
int val = p->Permit(creature);
- if( val > best_val )
+ if ( val > best_val )
{
best_val = val;
mv_factory = p;
diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp
index e1203ef35cc..74ed23304f6 100644
--- a/src/game/CreatureEventAI.cpp
+++ b/src/game/CreatureEventAI.cpp
@@ -71,7 +71,7 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c)
if ((*i).event_flags & EFLAG_DEBUG_ONLY)
continue;
#endif
- if(m_creature->GetMap()->IsDungeon())
+ if (m_creature->GetMap()->IsDungeon())
{
if ((1 << (m_creature->GetMap()->GetSpawnMode()+1)) & (*i).event_flags)
{
@@ -296,7 +296,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
//Note: checked only aura for effect 0, if need check aura for effect 1/2 then
// possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx)
Aura const * aura = m_creature->GetAura(event.buffed.spellId);
- if(!aura || aura->GetStackAmount() < event.buffed.amount)
+ if (!aura || aura->GetStackAmount() < event.buffed.amount)
return false;
//Repeat Timers
@@ -312,7 +312,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
//Note: checked only aura for effect 0, if need check aura for effect 1/2 then
// possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx)
Aura const * aura = pActionInvoker->GetAura(event.buffed.spellId);
- if(!aura || aura->GetStackAmount() < event.buffed.amount)
+ if (!aura || aura->GetStackAmount() < event.buffed.amount)
return false;
//Repeat Timers
@@ -457,9 +457,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
bool canCast = !caster->IsNonMeleeSpellCasted(false) || (action.cast.castFlags & (CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS));
// If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them
- if(action.cast.castFlags & CAST_AURA_NOT_PRESENT)
+ if (action.cast.castFlags & CAST_AURA_NOT_PRESENT)
{
- if(target->HasAura(action.cast.spellId))
+ if (target->HasAura(action.cast.spellId))
return;
}
@@ -527,7 +527,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{
std::list<HostileReference*>& threatList = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
- if(Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid()))
+ if (Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid()))
m_creature->getThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent);
break;
}
@@ -567,7 +567,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
case ACTION_T_COMBAT_MOVEMENT:
// ignore no affect case
- if(CombatMovementEnabled==(action.combat_movement.state!=0))
+ if (CombatMovementEnabled==(action.combat_movement.state!=0))
return;
CombatMovementEnabled = action.combat_movement.state != 0;
@@ -818,7 +818,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
{
- if(action.invincibility_hp_level.is_percent)
+ if (action.invincibility_hp_level.is_percent)
InvinceabilityHpLevel = m_creature->GetMaxHealth()*action.invincibility_hp_level.hp_level/100;
else
InvinceabilityHpLevel = action.invincibility_hp_level.hp_level;
@@ -1003,7 +1003,7 @@ void CreatureEventAI::AttackStart(Unit *who)
void CreatureEventAI::MoveInLineOfSight(Unit *who)
{
- if(me->getVictim())
+ if (me->getVictim())
return;
//Check for OOC LOS Event
@@ -1238,7 +1238,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
sLog.outDebug("CreatureEventAI: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u",textEntry,(*i).second.SoundId,(*i).second.Type,(*i).second.Language,(*i).second.Emote);
- if((*i).second.SoundId)
+ if ((*i).second.SoundId)
{
if (GetSoundEntriesStore()->LookupEntry((*i).second.SoundId))
pSource->PlayDirectSound((*i).second.SoundId);
@@ -1246,7 +1246,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.",textEntry,(*i).second.SoundId);
}
- if((*i).second.Emote)
+ if ((*i).second.Emote)
{
if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER)
{
@@ -1341,9 +1341,9 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
void CreatureEventAI::DamageTaken( Unit* done_by, uint32& damage )
{
- if(InvinceabilityHpLevel > 0 && m_creature->GetHealth() < InvinceabilityHpLevel+damage)
+ if (InvinceabilityHpLevel > 0 && m_creature->GetHealth() < InvinceabilityHpLevel+damage)
{
- if(m_creature->GetHealth() <= InvinceabilityHpLevel)
+ if (m_creature->GetHealth() <= InvinceabilityHpLevel)
damage = 0;
else
damage = m_creature->GetHealth() - InvinceabilityHpLevel;
@@ -1352,7 +1352,7 @@ void CreatureEventAI::DamageTaken( Unit* done_by, uint32& damage )
bool CreatureEventAI::SpawnedEventConditionsCheck(CreatureEventAI_Event const& event)
{
- if(event.event_type != EVENT_T_SPAWNED)
+ if (event.event_type != EVENT_T_SPAWNED)
return false;
switch (event.spawned.condition)
diff --git a/src/game/CreatureEventAIMgr.cpp b/src/game/CreatureEventAIMgr.cpp
index 78c6885f5f2..4fa7517d848 100644
--- a/src/game/CreatureEventAIMgr.cpp
+++ b/src/game/CreatureEventAIMgr.cpp
@@ -136,7 +136,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
temp.orientation = fields[4].GetFloat();
temp.SpawnTimeSecs = fields[5].GetUInt32();
- if(!Trinity::IsValidMapCoord(temp.position_x,temp.position_y,temp.position_z,temp.orientation))
+ if (!Trinity::IsValidMapCoord(temp.position_x,temp.position_y,temp.position_z,temp.orientation))
{
sLog.outErrorDb("CreatureEventAI: Summon id %u have wrong coordinates (%f,%f,%f,%f), skipping.", i,temp.position_x,temp.position_y,temp.position_z,temp.orientation);
continue;
@@ -286,11 +286,11 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case SPAWNED_EVENT_ALWAY:
break;
case SPAWNED_EVENT_MAP:
- if(!sMapStore.LookupEntry(temp.spawned.conditionValue1))
+ if (!sMapStore.LookupEntry(temp.spawned.conditionValue1))
sLog.outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
break;
case SPAWNED_EVENT_ZONE:
- if(!GetAreaEntryByAreaID(temp.spawned.conditionValue1))
+ if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1))
sLog.outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
default:
sLog.outErrorDb("CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition);
@@ -659,9 +659,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
break;
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
- if(action.invincibility_hp_level.is_percent)
+ if (action.invincibility_hp_level.is_percent)
{
- if(action.invincibility_hp_level.hp_level > 100)
+ if (action.invincibility_hp_level.hp_level > 100)
{
sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level);
action.invincibility_hp_level.hp_level = 100;
@@ -705,20 +705,20 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
m_CreatureEventAI_Event_Map[creature_id].push_back(temp);
++Count;
- if(CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(temp.creature_id))
+ if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(temp.creature_id))
{
- if(!cInfo->AIName || !cInfo->AIName[0])
+ if (!cInfo->AIName || !cInfo->AIName[0])
{
//sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but its AIName is empty. Set to EventAI as default.", cInfo->Entry);
size_t len = strlen("EventAI")+1;
const_cast<CreatureInfo*>(cInfo)->AIName = new char[len];
strncpy(const_cast<char*>(cInfo->AIName), "EventAI", len);
}
- if(strcmp(cInfo->AIName, "EventAI"))
+ if (strcmp(cInfo->AIName, "EventAI"))
{
//sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but it has AIName %s. EventAI script will be overriden.", cInfo->Entry, cInfo->AIName);
}
- if(cInfo->ScriptID)
+ if (cInfo->ScriptID)
{
//sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but it also has C++ script. EventAI script will be overriden.", cInfo->Entry);
}
diff --git a/src/game/CreatureGroups.cpp b/src/game/CreatureGroups.cpp
index 72efb6ef136..2af4b1cce03 100644
--- a/src/game/CreatureGroups.cpp
+++ b/src/game/CreatureGroups.cpp
@@ -34,13 +34,13 @@ CreatureGroupInfoType CreatureGroupMap;
void CreatureGroupManager::AddCreatureToGroup(uint32 groupId, Creature *member)
{
Map *map = member->FindMap();
- if(!map)
+ if (!map)
return;
CreatureGroupHolderType::iterator itr = map->CreatureGroupHolder.find(groupId);
//Add member to an existing group
- if(itr != map->CreatureGroupHolder.end())
+ if (itr != map->CreatureGroupHolder.end())
{
sLog.outDebug("Group found: %u, inserting creature GUID: %u, Group InstanceID %u", groupId, member->GetGUIDLow(), member->GetInstanceId());
itr->second->AddMember(member);
@@ -60,10 +60,10 @@ void CreatureGroupManager::RemoveCreatureFromGroup(CreatureGroup *group, Creatur
sLog.outDebug("Deleting member pointer to GUID: %u from group %u", group->GetId(), member->GetDBTableGUIDLow());
group->RemoveMember(member);
- if(group->isEmpty())
+ if (group->isEmpty())
{
Map *map = member->FindMap();
- if(!map)
+ if (!map)
return;
sLog.outDebug("Deleting group with InstanceID %u", member->GetInstanceId());
@@ -80,7 +80,7 @@ void CreatureGroupManager::LoadCreatureFormations()
//Check Integrity of the table
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT MAX(leaderGUID) FROM creature_formations");
- if(!result)
+ if (!result)
{
sLog.outErrorDb(" ...an error occured while loading the table creature_formations ( maybe it doesn't exist ?)\n");
return;
@@ -89,7 +89,7 @@ void CreatureGroupManager::LoadCreatureFormations()
//Get group data
result = WorldDatabase.PQuery("SELECT leaderGUID, memberGUID, dist, angle, groupAI FROM creature_formations ORDER BY leaderGUID");
- if(!result)
+ if (!result)
{
sLog.outErrorDb("The table creature_formations is empty or corrupted");
return;
@@ -112,7 +112,7 @@ void CreatureGroupManager::LoadCreatureFormations()
uint32 memberGUID = fields[1].GetUInt32();
group_member->groupAI = fields[4].GetUInt8();
//If creature is group leader we may skip loading of dist/angle
- if(group_member->leaderGUID != memberGUID)
+ if (group_member->leaderGUID != memberGUID)
{
group_member->follow_dist = fields[2].GetFloat();
group_member->follow_angle = fields[3].GetFloat() * M_PI / 180;
@@ -126,7 +126,7 @@ void CreatureGroupManager::LoadCreatureFormations()
// check data correctness
{
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE guid = %u", group_member->leaderGUID);
- if(!result)
+ if (!result)
{
sLog.outErrorDb("creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID);
delete group_member;
@@ -134,7 +134,7 @@ void CreatureGroupManager::LoadCreatureFormations()
}
result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE guid = %u", memberGUID);
- if(!result)
+ if (!result)
{
sLog.outErrorDb("creature_formations table member guid %u incorrect (not exist)", memberGUID);
delete group_member;
@@ -156,7 +156,7 @@ void CreatureGroup::AddMember(Creature *member)
sLog.outDebug("CreatureGroup::AddMember: Adding unit GUID: %u.", member->GetGUIDLow());
//Check if it is a leader
- if(member->GetDBTableGUIDLow() == m_groupID)
+ if (member->GetDBTableGUIDLow() == m_groupID)
{
sLog.outDebug("Unit GUID: %u is formation leader. Adding group.", member->GetGUIDLow());
m_leader = member;
@@ -168,7 +168,7 @@ void CreatureGroup::AddMember(Creature *member)
void CreatureGroup::RemoveMember(Creature *member)
{
- if(m_leader == member)
+ if (m_leader == member)
m_leader = NULL;
m_members.erase(member);
@@ -178,10 +178,10 @@ void CreatureGroup::RemoveMember(Creature *member)
void CreatureGroup::MemberAttackStart(Creature *member, Unit *target)
{
uint8 groupAI = CreatureGroupMap[member->GetDBTableGUIDLow()]->groupAI;
- if(!groupAI)
+ if (!groupAI)
return;
- if(groupAI == 1 && member != m_leader)
+ if (groupAI == 1 && member != m_leader)
return;
for (CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
@@ -190,16 +190,16 @@ void CreatureGroup::MemberAttackStart(Creature *member, Unit *target)
//sLog.outDebug("AI:%u:Group member found: %u, attacked by %s.", groupAI, itr->second->GetGUIDLow(), member->getVictim()->GetName());
//Skip one check
- if(itr->first == member)
+ if (itr->first == member)
continue;
- if(!itr->first->isAlive())
+ if (!itr->first->isAlive())
continue;
- if(itr->first->getVictim())
+ if (itr->first->getVictim())
continue;
- if(itr->first->canAttack(target))
+ if (itr->first->canAttack(target))
itr->first->AI()->AttackStart(target);
}
}
@@ -208,9 +208,9 @@ void CreatureGroup::FormationReset(bool dismiss)
{
for (CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
- if(itr->first != m_leader && itr->first->isAlive())
+ if (itr->first != m_leader && itr->first->isAlive())
{
- if(dismiss)
+ if (dismiss)
itr->first->GetMotionMaster()->Initialize();
else
itr->first->GetMotionMaster()->MoveIdle(MOTION_SLOT_IDLE);
@@ -222,7 +222,7 @@ void CreatureGroup::FormationReset(bool dismiss)
void CreatureGroup::LeaderMoveTo(float x, float y, float z)
{
- if(!m_leader)
+ if (!m_leader)
return;
float pathangle = atan2(m_leader->GetPositionY() - y, m_leader->GetPositionX() - x);
@@ -230,7 +230,7 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z)
for (CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
Creature *member = itr->first;
- if(member == m_leader || !member->isAlive() || member->getVictim())
+ if (member == m_leader || !member->isAlive() || member->getVictim())
continue;
float angle = itr->second->follow_angle;
@@ -245,7 +245,7 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z)
member->UpdateGroundPositionZ(dx, dy, dz);
- if(member->IsWithinDist(m_leader, dist + MAX_DESYNC))
+ if (member->IsWithinDist(m_leader, dist + MAX_DESYNC))
member->SetUnitMovementFlags(m_leader->GetUnitMovementFlags());
else
member->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp
index a574efc3e1b..f6a7671b1b0 100644
--- a/src/game/DBCStores.cpp
+++ b/src/game/DBCStores.cpp
@@ -183,16 +183,16 @@ inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList
if (custom_entries)
sql = new SqlDbc(&filename,custom_entries, idname,storage.GetFormat());
- if(storage.Load(dbc_filename.c_str(), sql))
+ if (storage.Load(dbc_filename.c_str(), sql))
{
bar.step();
for (uint8 i = 0; i < MAX_LOCALE; ++i)
{
- if(!(availableDbcLocales & (1 << i)))
+ if (!(availableDbcLocales & (1 << i)))
continue;
std::string dbc_filename_loc = dbc_path + localeNames[i] + "/" + filename;
- if(!storage.LoadStringsFrom(dbc_filename_loc.c_str()))
+ if (!storage.LoadStringsFrom(dbc_filename_loc.c_str()))
availableDbcLocales &= ~(1<<i); // mark as not available for speedup next checks
}
}
@@ -200,7 +200,7 @@ inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList
{
// sort problematic dbc to (1) non compatible and (2) non-existed
FILE * f=fopen(dbc_filename.c_str(),"rb");
- if(f)
+ if (f)
{
char buf[100];
snprintf(buf,100," (exist, but have %d fields instead " SIZEFMTD ") Wrong client version DBC file?",storage.GetFieldCount(),strlen(storage.GetFormat()));
@@ -230,13 +230,13 @@ void LoadDBCStores(const std::string& dataPath)
// must be after sAreaStore loading
for (uint32 i = 0; i < sAreaStore.GetNumRows(); ++i) // areaflag numbered from 0
{
- if(AreaTableEntry const* area = sAreaStore.LookupEntry(i))
+ if (AreaTableEntry const* area = sAreaStore.LookupEntry(i))
{
// fill AreaId->DBC records
sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(area->ID),area->exploreFlag));
// fill MapId->DBC records ( skip sub zones and continents )
- if(area->zone==0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571 )
+ if (area->zone==0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571 )
sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid,area->exploreFlag));
}
}
@@ -280,13 +280,13 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGameObjectDisplayInfoStore, dbcPath,"GameObjectDisplayInfo.dbc");
for (uint32 i = 0; i < sGameObjectDisplayInfoStore.GetNumRows(); ++i)
{
- if(GameObjectDisplayInfoEntry const * info = sGameObjectDisplayInfoStore.LookupEntry(i))
+ if (GameObjectDisplayInfoEntry const * info = sGameObjectDisplayInfoStore.LookupEntry(i))
{
- if(info->maxX < info->minX)
+ if (info->maxX < info->minX)
std::swap(*(float*)(&info->maxX), *(float*)(&info->minX));
- if(info->maxY < info->minY)
+ if (info->maxY < info->minY)
std::swap(*(float*)(&info->maxY), *(float*)(&info->minY));
- if(info->maxZ < info->minZ)
+ if (info->maxZ < info->minZ)
std::swap(*(float*)(&info->maxZ), *(float*)(&info->minZ));
}
}
@@ -325,7 +325,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMapDifficultyStore, dbcPath,"MapDifficulty.dbc");
// fill data
for (uint32 i = 1; i < sMapDifficultyStore.GetNumRows(); ++i)
- if(MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i))
+ if (MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i))
sMapDifficultyMap[MAKE_PAIR32(entry->MapId,entry->Difficulty)] = MapDifficulty(entry->resetTime,entry->maxPlayers);
sMapDifficultyStore.Clear();
@@ -349,7 +349,7 @@ void LoadDBCStores(const std::string& dataPath)
for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
{
SpellEntry const * spell = sSpellStore.LookupEntry(i);
- if(spell && spell->Category)
+ if (spell && spell->Category)
sSpellCategoryStore[spell->Category].insert(i);
}
@@ -357,25 +357,25 @@ void LoadDBCStores(const std::string& dataPath)
{
SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j);
- if(!skillLine)
+ if (!skillLine)
continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);
- if(spellInfo && IsPassiveSpell(spellInfo->Id))
+ if (spellInfo && IsPassiveSpell(spellInfo->Id))
{
for (uint32 i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i)
{
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(i);
- if(!cFamily)
+ if (!cFamily)
continue;
- if(skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1])
+ if (skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1])
continue;
- if(spellInfo->spellLevel)
+ if (spellInfo->spellLevel)
continue;
- if(skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL)
+ if (skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL)
continue;
sPetFamilySpellsStore[i].insert(spellInfo->Id);
@@ -402,7 +402,7 @@ void LoadDBCStores(const std::string& dataPath)
TalentEntry const *talentInfo = sTalentStore.LookupEntry(i);
if (!talentInfo) continue;
for (int j = 0; j < MAX_TALENT_RANK; j++)
- if(talentInfo->RankID[j])
+ if (talentInfo->RankID[j])
sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i,j);
}
@@ -414,7 +414,7 @@ void LoadDBCStores(const std::string& dataPath)
for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId)
{
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentTabId );
- if(!talentTabInfo)
+ if (!talentTabInfo)
continue;
// prevent memory corruption; otherwise cls will become 12 below
@@ -433,7 +433,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTaxiPathStore, dbcPath,"TaxiPath.dbc");
for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
- if(TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
+ if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID,entry->price);
uint32 pathCount = sTaxiPathStore.GetNumRows();
@@ -443,7 +443,7 @@ void LoadDBCStores(const std::string& dataPath)
std::vector<uint32> pathLength;
pathLength.resize(pathCount); // 0 and some other indexes not used
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
- if(TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
+ if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
{
if (pathLength[entry->path] < entry->index + 1)
pathLength[entry->path] = entry->index + 1;
@@ -454,7 +454,7 @@ void LoadDBCStores(const std::string& dataPath)
sTaxiPathNodesByPath[i].resize(pathLength[i]);
// fill data
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
- if(TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
+ if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
sTaxiPathNodesByPath[entry->path][entry->index] = TaxiPathNode(entry->mapid,entry->x,entry->y,entry->z,entry->actionFlag,entry->delay);
sTaxiPathNodeStore.Clear();
@@ -463,9 +463,9 @@ void LoadDBCStores(const std::string& dataPath)
{
std::set<uint32> spellPaths;
for (uint32 i = 1; i < sSpellStore.GetNumRows (); ++i)
- if(SpellEntry const* sInfo = sSpellStore.LookupEntry (i))
+ if (SpellEntry const* sInfo = sSpellStore.LookupEntry (i))
for (int j=0; j < 3; ++j)
- if(sInfo->Effect[j]==123 /*SPELL_EFFECT_SEND_TAXI*/)
+ if (sInfo->Effect[j]==123 /*SPELL_EFFECT_SEND_TAXI*/)
spellPaths.insert(sInfo->EffectMiscValue[j]);
memset(sTaxiNodesMask,0,sizeof(sTaxiNodesMask));
@@ -473,24 +473,24 @@ void LoadDBCStores(const std::string& dataPath)
for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
{
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
- if(!node)
+ if (!node)
continue;
TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(i);
- if(src_i!=sTaxiPathSetBySource.end() && !src_i->second.empty())
+ if (src_i!=sTaxiPathSetBySource.end() && !src_i->second.empty())
{
bool ok = false;
for (TaxiPathSetForSource::const_iterator dest_i = src_i->second.begin(); dest_i != src_i->second.end(); ++dest_i)
{
// not spell path
- if(spellPaths.find(dest_i->second.ID)==spellPaths.end())
+ if (spellPaths.find(dest_i->second.ID)==spellPaths.end())
{
ok = true;
break;
}
}
- if(!ok)
+ if (!ok)
continue;
}
@@ -518,12 +518,12 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldSafeLocsStore, dbcPath,"WorldSafeLocs.dbc");
// error checks
- if(bad_dbc_files.size() >= DBCFilesCount )
+ if (bad_dbc_files.size() >= DBCFilesCount )
{
sLog.outError("\nIncorrect DataDir value in Trinityd.conf or ALL required *.dbc files (%d) not found by path: %sdbc",DBCFilesCount,dataPath.c_str());
exit(1);
}
- else if(!bad_dbc_files.empty() )
+ else if (!bad_dbc_files.empty() )
{
std::string str;
for (std::list<std::string>::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)
@@ -534,7 +534,7 @@ void LoadDBCStores(const std::string& dataPath)
}
// Check loaded DBC files proper version
- if( !sSpellStore.LookupEntry(74445) || // last added spell in 3.3.2
+ if ( !sSpellStore.LookupEntry(74445) || // last added spell in 3.3.2
!sMapStore.LookupEntry(718) || // last map added in 3.3.2
!sGemPropertiesStore.LookupEntry(1629) || // last gem property added in 3.3.2
!sItemExtendedCostStore.LookupEntry(2982) || // last item extended cost added in 3.3.2
@@ -553,14 +553,14 @@ SimpleFactionsList const* GetFactionTeamList(uint32 faction, bool &isTeamMember)
{
for (FactionTeamMap::const_iterator itr = sFactionTeamMap.begin(); itr != sFactionTeamMap.end(); ++itr)
{
- if(itr->first == faction)
+ if (itr->first == faction)
{
isTeamMember = false;
return &itr->second;
}
for (SimpleFactionsList::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
{
- if((*itr2) == faction)
+ if ((*itr2) == faction)
{
isTeamMember = true;
return &itr->second;
@@ -572,10 +572,10 @@ SimpleFactionsList const* GetFactionTeamList(uint32 faction, bool &isTeamMember)
char* GetPetName(uint32 petfamily, uint32 dbclang)
{
- if(!petfamily)
+ if (!petfamily)
return NULL;
CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(petfamily);
- if(!pet_family)
+ if (!pet_family)
return NULL;
return pet_family->Name[dbclang]?pet_family->Name[dbclang]:NULL;
}
@@ -583,7 +583,7 @@ char* GetPetName(uint32 petfamily, uint32 dbclang)
TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
{
TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId);
- if(itr==sTalentSpellPosMap.end())
+ if (itr==sTalentSpellPosMap.end())
return NULL;
return &itr->second;
@@ -591,7 +591,7 @@ TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
uint32 GetTalentSpellCost(uint32 spellId)
{
- if(TalentSpellPos const* pos = GetTalentSpellPos(spellId))
+ if (TalentSpellPos const* pos = GetTalentSpellPos(spellId))
return pos->rank+1;
return 0;
@@ -600,7 +600,7 @@ uint32 GetTalentSpellCost(uint32 spellId)
int32 GetAreaFlagByAreaID(uint32 area_id)
{
AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id);
- if(i == sAreaFlagByAreaID.end())
+ if (i == sAreaFlagByAreaID.end())
return -1;
return i->second;
@@ -609,7 +609,7 @@ int32 GetAreaFlagByAreaID(uint32 area_id)
AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id)
{
int32 areaflag = GetAreaFlagByAreaID(area_id);
- if(areaflag < 0)
+ if (areaflag < 0)
return NULL;
return sAreaStore.LookupEntry(areaflag);
@@ -617,10 +617,10 @@ AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id)
AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_id)
{
- if(area_flag)
+ if (area_flag)
return sAreaStore.LookupEntry(area_flag);
- if(MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
+ if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
return GetAreaEntryByAreaID(mapEntry->linked_zone);
return NULL;
@@ -629,7 +629,7 @@ AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_i
uint32 GetAreaFlagByMapId(uint32 mapid)
{
AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid);
- if(i == sAreaFlagByMapID.end())
+ if (i == sAreaFlagByMapID.end())
return 0;
else
return i->second;
@@ -637,10 +637,10 @@ uint32 GetAreaFlagByMapId(uint32 mapid)
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
{
- if(mapid != 530 && mapid != 571) // speed for most cases
+ if (mapid != 530 && mapid != 571) // speed for most cases
return mapid;
- if(WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId))
+ if (WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId))
return wma->virtual_map_id >= 0 ? wma->virtual_map_id : wma->map_id;
return mapid;
@@ -649,11 +649,11 @@ uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId)
{
mapid = GetVirtualMapForMapAndZone(mapid,zoneId);
- if(mapid < 2)
+ if (mapid < 2)
return CONTENT_1_60;
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
- if(!mapEntry)
+ if (!mapEntry)
return CONTENT_1_60;
switch(mapEntry->Expansion())
@@ -670,7 +670,7 @@ ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id)
for (uint32 i = 0; i < sChatChannelsStore.GetNumRows(); ++i)
{
ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(i);
- if(ch && ch->ChannelID == channel_id)
+ if (ch && ch->ChannelID == channel_id)
return ch;
}
return NULL;
@@ -678,19 +678,19 @@ ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id)
bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId)
{
- if(requiredTotemCategoryId==0)
+ if (requiredTotemCategoryId==0)
return true;
- if(itemTotemCategoryId==0)
+ if (itemTotemCategoryId==0)
return false;
TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(itemTotemCategoryId);
- if(!itemEntry)
+ if (!itemEntry)
return false;
TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId);
- if(!reqEntry)
+ if (!reqEntry)
return false;
- if(itemEntry->categoryType!=reqEntry->categoryType)
+ if (itemEntry->categoryType!=reqEntry->categoryType)
return false;
return (itemEntry->categoryMask & reqEntry->categoryMask)==reqEntry->categoryMask;
@@ -701,7 +701,7 @@ void Zone2MapCoordinates(float& x,float& y,uint32 zone)
WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone);
// if not listed then map coordinates (instance)
- if(!maEntry)
+ if (!maEntry)
return;
std::swap(x,y); // at client map coords swapped
@@ -714,7 +714,7 @@ void Map2ZoneCoordinates(float& x,float& y,uint32 zone)
WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone);
// if not listed then map coordinates (instance)
- if(!maEntry)
+ if (!maEntry)
return;
x = (x-maEntry->x1)/((maEntry->x2-maEntry->x1)/100);
diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h
index 7c3c7c9fca4..f369e86a4b2 100644
--- a/src/game/DBCStructure.h
+++ b/src/game/DBCStructure.h
@@ -835,9 +835,9 @@ struct FactionTemplateEntry
// helpers
bool IsFriendlyTo(FactionTemplateEntry const& entry) const
{
- if(ID == entry.ID)
+ if (ID == entry.ID)
return true;
- if(entry.faction)
+ if (entry.faction)
{
for (int i = 0; i < 4; ++i)
if (enemyFaction[i] == entry.faction)
@@ -850,9 +850,9 @@ struct FactionTemplateEntry
}
bool IsHostileTo(FactionTemplateEntry const& entry) const
{
- if(ID == entry.ID)
+ if (ID == entry.ID)
return false;
- if(entry.faction)
+ if (entry.faction)
{
for (int i = 0; i < 4; ++i)
if (enemyFaction[i] == entry.faction)
@@ -1148,7 +1148,7 @@ struct MapEntry
bool GetEntrancePos(int32 &mapid, float &x, float &y) const
{
- if(entrance_map < 0)
+ if (entrance_map < 0)
return false;
mapid = entrance_map;
x = entrance_x;
@@ -1248,12 +1248,12 @@ struct ScalingStatValuesEntry
{
if (mask & 0x4001F)
{
- if(mask & 0x00000001) return ssdMultiplier[0];
- if(mask & 0x00000002) return ssdMultiplier[1];
- if(mask & 0x00000004) return ssdMultiplier[2];
- if(mask & 0x00000008) return ssdMultiplier2;
- if(mask & 0x00000010) return ssdMultiplier[3];
- if(mask & 0x00040000) return ssdMultiplier3;
+ if (mask & 0x00000001) return ssdMultiplier[0];
+ if (mask & 0x00000002) return ssdMultiplier[1];
+ if (mask & 0x00000004) return ssdMultiplier[2];
+ if (mask & 0x00000008) return ssdMultiplier2;
+ if (mask & 0x00000010) return ssdMultiplier[3];
+ if (mask & 0x00040000) return ssdMultiplier3;
}
return 0;
}
@@ -1262,15 +1262,15 @@ struct ScalingStatValuesEntry
{
if (mask & 0x00F001E0)
{
- if(mask & 0x00000020) return armorMod[0];
- if(mask & 0x00000040) return armorMod[1];
- if(mask & 0x00000080) return armorMod[2];
- if(mask & 0x00000100) return armorMod[3];
+ if (mask & 0x00000020) return armorMod[0];
+ if (mask & 0x00000040) return armorMod[1];
+ if (mask & 0x00000080) return armorMod[2];
+ if (mask & 0x00000100) return armorMod[3];
- if(mask & 0x00100000) return armorMod2[0]; // cloth
- if(mask & 0x00200000) return armorMod2[1]; // leather
- if(mask & 0x00400000) return armorMod2[2]; // mail
- if(mask & 0x00800000) return armorMod2[3]; // plate
+ if (mask & 0x00100000) return armorMod2[0]; // cloth
+ if (mask & 0x00200000) return armorMod2[1]; // leather
+ if (mask & 0x00400000) return armorMod2[2]; // mail
+ if (mask & 0x00800000) return armorMod2[3]; // plate
}
return 0;
}
@@ -1278,12 +1278,12 @@ struct ScalingStatValuesEntry
{
if (mask&0x7E00)
{
- if(mask & 0x00000200) return dpsMod[0];
- if(mask & 0x00000400) return dpsMod[1];
- if(mask & 0x00000800) return dpsMod[2];
- if(mask & 0x00001000) return dpsMod[3];
- if(mask & 0x00002000) return dpsMod[4];
- if(mask & 0x00004000) return dpsMod[5]; // not used?
+ if (mask & 0x00000200) return dpsMod[0];
+ if (mask & 0x00000400) return dpsMod[1];
+ if (mask & 0x00000800) return dpsMod[2];
+ if (mask & 0x00001000) return dpsMod[3];
+ if (mask & 0x00002000) return dpsMod[4];
+ if (mask & 0x00004000) return dpsMod[5]; // not used?
}
return 0;
}
diff --git a/src/game/Debugcmds.cpp b/src/game/Debugcmds.cpp
index 8695d70fef9..2f827610657 100644
--- a/src/game/Debugcmds.cpp
+++ b/src/game/Debugcmds.cpp
@@ -136,7 +136,7 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/)
player = m_session->GetPlayer();
else
player = (Player*)unit;
- if(!unit) unit = player;
+ if (!unit) unit = player;
std::ifstream ifs("opcode.txt");
if (ifs.bad())
@@ -152,57 +152,57 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/)
std::string type;
ifs >> type;
- if(type == "")
+ if (type == "")
break;
- if(type == "uint8")
+ if (type == "uint8")
{
uint16 val1;
ifs >> val1;
data << uint8(val1);
}
- else if(type == "uint16")
+ else if (type == "uint16")
{
uint16 val2;
ifs >> val2;
data << val2;
}
- else if(type == "uint32")
+ else if (type == "uint32")
{
uint32 val3;
ifs >> val3;
data << val3;
}
- else if(type == "uint64")
+ else if (type == "uint64")
{
uint64 val4;
ifs >> val4;
data << val4;
}
- else if(type == "float")
+ else if (type == "float")
{
float val5;
ifs >> val5;
data << val5;
}
- else if(type == "string")
+ else if (type == "string")
{
std::string val6;
ifs >> val6;
data << val6;
}
- else if(type == "appitsguid")
+ else if (type == "appitsguid")
{
data.append(unit->GetPackGUID());
}
- else if(type == "appmyguid")
+ else if (type == "appmyguid")
{
data.append(player->GetPackGUID());
}
- else if(type == "appgoguid")
+ else if (type == "appgoguid")
{
GameObject *obj = GetNearbyGameObject();
- if(!obj)
+ if (!obj)
{
PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, 0);
SetSentErrorMessage(true);
@@ -211,10 +211,10 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/)
}
data.append(obj->GetPackGUID());
}
- else if(type == "goguid")
+ else if (type == "goguid")
{
GameObject *obj = GetNearbyGameObject();
- if(!obj)
+ if (!obj)
{
PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, 0);
SetSentErrorMessage(true);
@@ -223,21 +223,21 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/)
}
data << uint64(obj->GetGUID());
}
- else if(type == "myguid")
+ else if (type == "myguid")
{
data << uint64(player->GetGUID());
}
- else if(type == "itsguid")
+ else if (type == "itsguid")
{
data << uint64(unit->GetGUID());
}
- else if(type == "pos")
+ else if (type == "pos")
{
data << unit->GetPositionX();
data << unit->GetPositionY();
data << unit->GetPositionZ();
}
- else if(type == "mypos")
+ else if (type == "mypos")
{
data << player->GetPositionX();
data << player->GetPositionY();
@@ -439,7 +439,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
SendSysMessage(state_str.c_str());
for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
{
- if(i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
+ if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
continue;
Item *item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
@@ -468,7 +468,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
for (size_t i = 0; i < updateQueue.size(); ++i)
{
Item *item = updateQueue[i];
- if(!item) continue;
+ if (!item) continue;
Bag *container = item->GetContainer();
uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0);
@@ -494,7 +494,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
std::vector<Item *> &updateQueue = player->GetItemUpdateQueue();
for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
{
- if(i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
+ if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
continue;
Item *item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
@@ -545,7 +545,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
error = true; continue;
}
- if(item->IsBag())
+ if (item->IsBag())
{
Bag *bag = (Bag*)item;
for (uint8 j = 0; j < bag->GetBagSize(); ++j)
@@ -611,7 +611,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
for (size_t i = 0; i < updateQueue.size(); ++i)
{
Item *item = updateQueue[i];
- if(!item) continue;
+ if (!item) continue;
if (item->GetOwnerGUID() != player->GetGUID())
{
@@ -662,7 +662,7 @@ bool ChatHandler::HandleDebugArenaCommand(const char * /*args*/)
bool ChatHandler::HandleDebugThreatList(const char * /*args*/)
{
Creature* target = getSelectedCreature();
- if(!target || target->isTotem() || target->isPet())
+ if (!target || target->isTotem() || target->isPet())
return false;
std::list<HostileReference*>& tlist = target->getThreatManager().getThreatList();
@@ -672,7 +672,7 @@ bool ChatHandler::HandleDebugThreatList(const char * /*args*/)
for (itr = tlist.begin(); itr != tlist.end(); ++itr)
{
Unit* unit = (*itr)->getTarget();
- if(!unit)
+ if (!unit)
continue;
++cnt;
PSendSysMessage(" %u. %s (guid %u) - threat %f",cnt,unit->GetName(), unit->GetGUIDLow(), (*itr)->getThreat());
@@ -684,14 +684,14 @@ bool ChatHandler::HandleDebugThreatList(const char * /*args*/)
bool ChatHandler::HandleDebugHostileRefList(const char * /*args*/)
{
Unit* target = getSelectedUnit();
- if(!target)
+ if (!target)
target = m_session->GetPlayer();
HostileReference* ref = target->getHostileRefManager().getFirst();
uint32 cnt = 0;
PSendSysMessage("Hostil reference list of %s (guid %u)",target->GetName(), target->GetGUIDLow());
while (ref)
{
- if(Unit * unit = ref->getSource()->getOwner())
+ if (Unit * unit = ref->getSource()->getOwner())
{
++cnt;
PSendSysMessage(" %u. %s (guid %u) - threat %f",cnt,unit->GetName(), unit->GetGUIDLow(), ref->getThreat());
@@ -705,14 +705,14 @@ bool ChatHandler::HandleDebugHostileRefList(const char * /*args*/)
bool ChatHandler::HandleDebugSetVehicleId(const char *args)
{
Unit* target = getSelectedUnit();
- if(!target || target->IsVehicle())
+ if (!target || target->IsVehicle())
return false;
- if(!args)
+ if (!args)
return false;
char* i = strtok((char*)args, " ");
- if(!i)
+ if (!i)
return false;
uint32 id = (uint32)atoi(i);
@@ -724,14 +724,14 @@ bool ChatHandler::HandleDebugSetVehicleId(const char *args)
bool ChatHandler::HandleDebugEnterVehicle(const char * args)
{
Unit* target = getSelectedUnit();
- if(!target || !target->IsVehicle())
+ if (!target || !target->IsVehicle())
return false;
- if(!args)
+ if (!args)
return false;
char* i = strtok((char*)args, " ");
- if(!i)
+ if (!i)
return false;
char* j = strtok(NULL, " ");
@@ -739,7 +739,7 @@ bool ChatHandler::HandleDebugEnterVehicle(const char * args)
uint32 entry = (uint32)atoi(i);
int8 seatId = j ? (int8)atoi(j) : -1;
- if(!entry)
+ if (!entry)
m_session->GetPlayer()->EnterVehicle(target, seatId);
else
{
@@ -747,7 +747,7 @@ bool ChatHandler::HandleDebugEnterVehicle(const char * args)
Trinity::AllCreaturesOfEntryInRange check(m_session->GetPlayer(), entry, 20.0f);
Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(m_session->GetPlayer(), passenger, check);
m_session->GetPlayer()->VisitNearbyObject(30.0f, searcher);
- if(!passenger || passenger == target)
+ if (!passenger || passenger == target)
return false;
passenger->EnterVehicle(target, seatId);
}
@@ -772,7 +772,7 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
float x, y, z, o = m_session->GetPlayer()->GetOrientation();
m_session->GetPlayer()->GetClosePoint(x, y, z, m_session->GetPlayer()->GetObjectSize());
- if(!i)
+ if (!i)
return m_session->GetPlayer()->SummonCreature(entry, x, y, z, o);
uint32 id = (uint32)atoi(i);
@@ -791,7 +791,7 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
Map *map = m_session->GetPlayer()->GetMap();
- if(!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, m_session->GetPlayer()->GetPhaseMask(), entry, id, m_session->GetPlayer()->GetTeam(), x, y, z, o))
+ if (!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, m_session->GetPlayer()->GetPhaseMask(), entry, id, m_session->GetPlayer()->GetTeam(), x, y, z, o))
{
delete v;
return false;
@@ -945,7 +945,7 @@ bool ChatHandler::HandleDebugSetAuraStateCommand(const char* args)
bool ChatHandler::HandleDebugSetValueCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char* px = strtok((char*)args, " ");
@@ -956,7 +956,7 @@ bool ChatHandler::HandleDebugSetValueCommand(const char* args)
return false;
WorldObject* target = getSelectedObject();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@@ -966,7 +966,7 @@ bool ChatHandler::HandleDebugSetValueCommand(const char* args)
uint64 guid = target->GetGUID();
uint32 Opcode = (uint32)atoi(px);
- if(Opcode >= target->GetValuesCount())
+ if (Opcode >= target->GetValuesCount())
{
PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount());
return false;
@@ -974,9 +974,9 @@ bool ChatHandler::HandleDebugSetValueCommand(const char* args)
uint32 iValue;
float fValue;
bool isint32 = true;
- if(pz)
+ if (pz)
isint32 = (bool)atoi(pz);
- if(isint32)
+ if (isint32)
{
iValue = (uint32)atoi(py);
sLog.outDebug(GetTrinityString(LANG_SET_UINT), GUID_LOPART(guid), Opcode, iValue);
@@ -996,7 +996,7 @@ bool ChatHandler::HandleDebugSetValueCommand(const char* args)
bool ChatHandler::HandleDebugGetValueCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char* px = strtok((char*)args, " ");
@@ -1006,7 +1006,7 @@ bool ChatHandler::HandleDebugGetValueCommand(const char* args)
return false;
Unit* target = getSelectedUnit();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@@ -1016,7 +1016,7 @@ bool ChatHandler::HandleDebugGetValueCommand(const char* args)
uint64 guid = target->GetGUID();
uint32 Opcode = (uint32)atoi(px);
- if(Opcode >= target->GetValuesCount())
+ if (Opcode >= target->GetValuesCount())
{
PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount());
return false;
@@ -1024,10 +1024,10 @@ bool ChatHandler::HandleDebugGetValueCommand(const char* args)
uint32 iValue;
float fValue;
bool isint32 = true;
- if(pz)
+ if (pz)
isint32 = (bool)atoi(pz);
- if(isint32)
+ if (isint32)
{
iValue = target->GetUInt32Value( Opcode );
sLog.outDebug(GetTrinityString(LANG_GET_UINT), GUID_LOPART(guid), Opcode, iValue);
@@ -1045,7 +1045,7 @@ bool ChatHandler::HandleDebugGetValueCommand(const char* args)
bool ChatHandler::HandleDebugMod32ValueCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char* px = strtok((char*)args, " ");
@@ -1057,7 +1057,7 @@ bool ChatHandler::HandleDebugMod32ValueCommand(const char* args)
uint32 Opcode = (uint32)atoi(px);
int Value = atoi(py);
- if(Opcode >= m_session->GetPlayer()->GetValuesCount())
+ if (Opcode >= m_session->GetPlayer()->GetValuesCount())
{
PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, m_session->GetPlayer()->GetGUIDLow(), m_session->GetPlayer( )->GetValuesCount());
return false;
@@ -1077,7 +1077,7 @@ bool ChatHandler::HandleDebugMod32ValueCommand(const char* args)
bool ChatHandler::HandleDebugUpdateCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
uint32 updateIndex;
@@ -1093,13 +1093,13 @@ bool ChatHandler::HandleDebugUpdateCommand(const char* args)
return false;
}
- if(!pUpdateIndex)
+ if (!pUpdateIndex)
{
return true;
}
updateIndex = atoi(pUpdateIndex);
//check updateIndex
- if(chr->GetTypeId() == TYPEID_PLAYER)
+ if (chr->GetTypeId() == TYPEID_PLAYER)
{
if (updateIndex>=PLAYER_END) return true;
}
diff --git a/src/game/DestinationHolderImp.h b/src/game/DestinationHolderImp.h
index 223f69ec01e..116209ca5dc 100644
--- a/src/game/DestinationHolderImp.h
+++ b/src/game/DestinationHolderImp.h
@@ -36,7 +36,7 @@ DestinationHolder<TRAVELLER>::_findOffSetPoint(float x1, float y1, float x2, flo
* hence x = x2 - (offset/d)*(x2-x1)
* like wise offset/d = (y2-y)/(y2-y1);
*/
- if( offset == 0 )
+ if ( offset == 0 )
{
x = x2;
y = y2;
@@ -46,7 +46,7 @@ DestinationHolder<TRAVELLER>::_findOffSetPoint(float x1, float y1, float x2, flo
double x_diff = double(x2 - x1);
double y_diff = double(y2 - y1);
double distance_d = (double)((x_diff*x_diff) + (y_diff * y_diff));
- if(distance_d == 0)
+ if (distance_d == 0)
{
x = x2;
y = y2;
@@ -78,7 +78,7 @@ template<typename TRAVELLER>
uint32
DestinationHolder<TRAVELLER>::StartTravel(TRAVELLER &traveller, bool sendMove)
{
- if(!i_destSet) return 0;
+ if (!i_destSet) return 0;
i_fromX = traveller.GetPositionX();
i_fromY = traveller.GetPositionY();
@@ -86,7 +86,7 @@ DestinationHolder<TRAVELLER>::StartTravel(TRAVELLER &traveller, bool sendMove)
i_totalTravelTime = traveller.GetTotalTrevelTimeTo(i_destX,i_destY,i_destZ);
i_timeElapsed = 0;
- if(sendMove)
+ if (sendMove)
traveller.MoveTo(i_destX, i_destY, i_destZ, i_totalTravelTime);
return i_totalTravelTime;
}
@@ -99,12 +99,12 @@ DestinationHolder<TRAVELLER>::UpdateTraveller(TRAVELLER &traveller, uint32 diff,
// Update every TRAVELLER_UPDATE_INTERVAL
i_tracker.Update(diff);
- if(!i_tracker.Passed())
+ if (!i_tracker.Passed())
return false;
else
ResetUpdate();
- if(!i_destSet) return true;
+ if (!i_destSet) return true;
float x, y, z;
if (!micro_movement)
@@ -172,7 +172,7 @@ DestinationHolder<TRAVELLER>::GetLocationNow(const Map * map, float &x, float &y
const float groundDist = sqrt(distanceX*distanceX + distanceY*distanceY);
const float zDist = fabs(i_fromZ - z) + 0.000001f;
const float slope = groundDist / zDist;
- if(slope < 1.0f) // This prevents the ground returned by GetHeight to be used when in cave
+ if (slope < 1.0f) // This prevents the ground returned by GetHeight to be used when in cave
z = z2; // a climb or jump of more than 45 is denied
}
}
@@ -198,7 +198,7 @@ template<typename TRAVELLER>
void
DestinationHolder<TRAVELLER>::GetLocationNowNoMicroMovement(float &x, float &y, float &z) const
{
- if( HasArrived() )
+ if ( HasArrived() )
{
x = i_destX;
y = i_destY;
diff --git a/src/game/DuelHandler.cpp b/src/game/DuelHandler.cpp
index 812afc45235..0014802b1cb 100644
--- a/src/game/DuelHandler.cpp
+++ b/src/game/DuelHandler.cpp
@@ -32,7 +32,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
Player *pl;
Player *plTarget;
- if(!GetPlayer()->duel) // ignore accept from duel-sender
+ if (!GetPlayer()->duel) // ignore accept from duel-sender
return;
recvPacket >> guid;
@@ -40,7 +40,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
pl = GetPlayer();
plTarget = pl->duel->opponent;
- if(pl == pl->duel->initiator || !plTarget || pl == plTarget || pl->duel->startTime != 0 || plTarget->duel->startTime != 0)
+ if (pl == pl->duel->initiator || !plTarget || pl == plTarget || pl->duel->startTime != 0 || plTarget->duel->startTime != 0)
return;
//sLog.outDebug( "WORLD: received CMSG_DUEL_ACCEPTED" );
@@ -60,14 +60,14 @@ void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket)
//sLog.outDebug( "WORLD: received CMSG_DUEL_CANCELLED" );
// no duel requested
- if(!GetPlayer()->duel)
+ if (!GetPlayer()->duel)
return;
// player surrendered in a duel using /forfeit
- if(GetPlayer()->duel->startTime != 0)
+ if (GetPlayer()->duel->startTime != 0)
{
GetPlayer()->CombatStopWithPets(true);
- if(GetPlayer()->duel->opponent)
+ if (GetPlayer()->duel->opponent)
GetPlayer()->duel->opponent->CombatStopWithPets(true);
GetPlayer()->CastSpell(GetPlayer(), 7267, true); // beg
diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp
index ac2c4b8ada4..16b0e3b5a2b 100644
--- a/src/game/DynamicObject.cpp
+++ b/src/game/DynamicObject.cpp
@@ -44,7 +44,7 @@ DynamicObject::DynamicObject() : WorldObject()
void DynamicObject::AddToWorld()
{
///- Register the dynamicObject for guid lookup
- if(!IsInWorld())
+ if (!IsInWorld())
{
ObjectAccessor::Instance().AddObject(this);
WorldObject::AddToWorld();
@@ -54,13 +54,13 @@ void DynamicObject::AddToWorld()
void DynamicObject::RemoveFromWorld()
{
///- Remove the dynamicObject from the accessor
- if(IsInWorld())
+ if (IsInWorld())
{
- if(m_isWorldObject)
+ if (m_isWorldObject)
{
- if(Unit *caster = GetCaster())
+ if (Unit *caster = GetCaster())
{
- if(caster->GetTypeId() == TYPEID_PLAYER)
+ if (caster->GetTypeId() == TYPEID_PLAYER)
caster->ToPlayer()->SetViewpoint(this, false);
}
else
@@ -77,7 +77,7 @@ bool DynamicObject::Create(uint32 guidlow, Unit *caster, uint32 spellId, const P
{
SetMap(caster->GetMap());
Relocate(pos);
- if(!IsPositionValid())
+ if (!IsPositionValid())
{
sLog.outError("DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",spellId,GetPositionX(),GetPositionY());
return false;
@@ -132,7 +132,7 @@ void DynamicObject::Update(uint32 p_time)
}
else
{
- if(GetDuration() > int32(p_time))
+ if (GetDuration() > int32(p_time))
m_duration -= p_time;
else
expired = true;
diff --git a/src/game/FleeingMovementGenerator.cpp b/src/game/FleeingMovementGenerator.cpp
index bb18fdb60aa..1d50de1b1a7 100644
--- a/src/game/FleeingMovementGenerator.cpp
+++ b/src/game/FleeingMovementGenerator.cpp
@@ -32,17 +32,17 @@ template<class T>
void
FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
{
- if( !&owner )
+ if ( !&owner )
return;
- if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
+ if ( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
return;
- if(!_setMoveData(owner))
+ if (!_setMoveData(owner))
return;
float x, y, z;
- if(!_getPoint(owner, x, y, z))
+ if (!_getPoint(owner, x, y, z))
return;
owner.addUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
@@ -53,7 +53,7 @@ FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
template<>
bool FleeingMovementGenerator<Creature>::GetDestination(float &x, float &y, float &z) const
{
- if(i_destinationHolder.HasArrived())
+ if (i_destinationHolder.HasArrived())
return false;
i_destinationHolder.GetDestination(x, y, z);
@@ -70,7 +70,7 @@ template<class T>
bool
FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
{
- if(!&owner)
+ if (!&owner)
return false;
x = owner.GetPositionX();
@@ -82,7 +82,7 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
//primitive path-finding
for (uint8 i = 0; i < 18; ++i)
{
- if(i_only_forward && i > 2)
+ if (i_only_forward && i > 2)
break;
float distance = 5.0f;
@@ -161,11 +161,11 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
temp_y = y + distance * sin(angle);
Trinity::NormalizeMapCoord(temp_x);
Trinity::NormalizeMapCoord(temp_y);
- if( owner.IsWithinLOS(temp_x,temp_y,z))
+ if ( owner.IsWithinLOS(temp_x,temp_y,z))
{
bool is_water_now = _map->IsInWater(x,y,z);
- if(is_water_now && _map->IsInWater(temp_x,temp_y,z))
+ if (is_water_now && _map->IsInWater(temp_x,temp_y,z))
{
x = temp_x;
y = temp_y;
@@ -173,19 +173,19 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
}
float new_z = _map->GetHeight(temp_x,temp_y,z,true);
- if(new_z <= INVALID_HEIGHT)
+ if (new_z <= INVALID_HEIGHT)
continue;
bool is_water_next = _map->IsInWater(temp_x,temp_y,new_z);
- if((is_water_now && !is_water_next && !is_land_ok) || (!is_water_now && is_water_next && !is_water_ok))
+ if ((is_water_now && !is_water_next && !is_land_ok) || (!is_water_now && is_water_next && !is_water_ok))
continue;
- if( !(new_z - z) || distance / fabs(new_z - z) > 1.0f)
+ if ( !(new_z - z) || distance / fabs(new_z - z) > 1.0f)
{
float new_z_left = _map->GetHeight(temp_x + 1.0f*cos(angle+M_PI/2),temp_y + 1.0f*sin(angle+M_PI/2),z,true);
float new_z_right = _map->GetHeight(temp_x + 1.0f*cos(angle-M_PI/2),temp_y + 1.0f*sin(angle-M_PI/2),z,true);
- if(fabs(new_z_left - new_z) < 1.2f && fabs(new_z_right - new_z) < 1.2f)
+ if (fabs(new_z_left - new_z) < 1.2f && fabs(new_z_right - new_z) < 1.2f)
{
x = temp_x;
y = temp_y;
@@ -206,9 +206,9 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner)
{
float cur_dist_xyz = owner.GetDistance(i_caster_x, i_caster_y, i_caster_z);
- if(i_to_distance_from_caster > 0.0f)
+ if (i_to_distance_from_caster > 0.0f)
{
- if((i_last_distance_from_caster > i_to_distance_from_caster && cur_dist_xyz < i_to_distance_from_caster) ||
+ if ((i_last_distance_from_caster > i_to_distance_from_caster && cur_dist_xyz < i_to_distance_from_caster) ||
// if we reach lower distance
(i_last_distance_from_caster > i_to_distance_from_caster && cur_dist_xyz > i_last_distance_from_caster) ||
// if we can't be close
@@ -236,10 +236,10 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner)
Unit * fright = ObjectAccessor::GetUnit(owner, i_frightGUID);
- if(fright)
+ if (fright)
{
cur_dist = fright->GetDistance(&owner);
- if(cur_dist < cur_dist_xyz)
+ if (cur_dist < cur_dist_xyz)
{
i_caster_x = fright->GetPositionX();
i_caster_y = fright->GetPositionY();
@@ -264,18 +264,18 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner)
//get angle and 'distance from caster' to run
float angle;
- if(i_cur_angle == 0.0f && i_last_distance_from_caster == 0.0f) //just started, first time
+ if (i_cur_angle == 0.0f && i_last_distance_from_caster == 0.0f) //just started, first time
{
angle = rand_norm()*(1.0f - cur_dist/MIN_QUIET_DISTANCE) * M_PI/3 + rand_norm()*M_PI*2/3;
i_to_distance_from_caster = MIN_QUIET_DISTANCE;
i_only_forward = true;
}
- else if(cur_dist < MIN_QUIET_DISTANCE)
+ else if (cur_dist < MIN_QUIET_DISTANCE)
{
angle = M_PI/6 + rand_norm()*M_PI*2/3;
i_to_distance_from_caster = cur_dist*2/3 + rand_norm()*(MIN_QUIET_DISTANCE - cur_dist*2/3);
}
- else if(cur_dist > MAX_QUIET_DISTANCE)
+ else if (cur_dist > MAX_QUIET_DISTANCE)
{
angle = rand_norm()*M_PI/3 + M_PI*2/3;
i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + rand_norm()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f);
@@ -299,7 +299,7 @@ template<class T>
void
FleeingMovementGenerator<T>::Initialize(T &owner)
{
- if(!&owner)
+ if (!&owner)
return;
_Init(owner);
@@ -309,7 +309,7 @@ FleeingMovementGenerator<T>::Initialize(T &owner)
owner.SetUInt64Value(UNIT_FIELD_TARGET, 0);
owner.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
- if(Unit * fright = ObjectAccessor::GetUnit(owner, i_frightGUID))
+ if (Unit * fright = ObjectAccessor::GetUnit(owner, i_frightGUID))
{
i_caster_x = fright->GetPositionX();
i_caster_y = fright->GetPositionY();
@@ -333,7 +333,7 @@ template<>
void
FleeingMovementGenerator<Creature>::_Init(Creature &owner)
{
- if(!&owner)
+ if (!&owner)
return;
is_water_ok = owner.canSwim();
@@ -354,7 +354,7 @@ FleeingMovementGenerator<T>::Finalize(T &owner)
{
owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
owner.clearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
- if(owner.GetTypeId() == TYPEID_UNIT && owner.getVictim())
+ if (owner.GetTypeId() == TYPEID_UNIT && owner.getVictim())
owner.SetUInt64Value(UNIT_FIELD_TARGET, owner.getVictim()->GetGUID());
}
@@ -369,16 +369,16 @@ template<class T>
bool
FleeingMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
{
- if( !&owner || !owner.isAlive() )
+ if ( !&owner || !owner.isAlive() )
return false;
- if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
+ if ( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
return true;
Traveller<T> traveller(owner);
i_nextCheckTime.Update(time_diff);
- if( (owner.IsStopped() && !i_destinationHolder.HasArrived()) || !i_destinationHolder.HasDestination() )
+ if ( (owner.IsStopped() && !i_destinationHolder.HasArrived()) || !i_destinationHolder.HasDestination() )
{
_setTargetLocation(owner);
return true;
@@ -387,7 +387,7 @@ FleeingMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
if (i_destinationHolder.UpdateTraveller(traveller, time_diff))
{
i_destinationHolder.ResetUpdate(50);
- if(i_nextCheckTime.Passed() && i_destinationHolder.HasArrived())
+ if (i_nextCheckTime.Passed() && i_destinationHolder.HasArrived())
{
_setTargetLocation(owner);
return true;
@@ -427,10 +427,10 @@ void TimedFleeingMovementGenerator::Finalize(Unit &owner)
bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32 & time_diff)
{
- if( !owner.isAlive() )
+ if ( !owner.isAlive() )
return false;
- if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
+ if ( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
return true;
i_totalFleeTime.Update(time_diff);
diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp
index 30e06eefb7d..3f96b7fd9d8 100644
--- a/src/game/GameEventMgr.cpp
+++ b/src/game/GameEventMgr.cpp
@@ -60,7 +60,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
time_t currenttime = time(NULL);
for (std::set<uint16>::const_iterator itr = mGameEvent[entry].prerequisite_events.begin(); itr != mGameEvent[entry].prerequisite_events.end(); ++itr)
{
- if( (mGameEvent[*itr].state != GAMEEVENT_WORLD_NEXTPHASE && mGameEvent[*itr].state != GAMEEVENT_WORLD_FINISHED) || // if prereq not in nextphase or finished state, then can't start this one
+ if ( (mGameEvent[*itr].state != GAMEEVENT_WORLD_NEXTPHASE && mGameEvent[*itr].state != GAMEEVENT_WORLD_FINISHED) || // if prereq not in nextphase or finished state, then can't start this one
mGameEvent[*itr].nextstart > currenttime) // if not in nextphase state for long enough, can't start this one
return false;
}
@@ -107,13 +107,13 @@ uint32 GameEventMgr::NextCheck(uint16 entry) const
void GameEventMgr::StartInternalEvent(uint16 event_id)
{
- if(event_id < 1 || event_id >= mGameEvent.size())
+ if (event_id < 1 || event_id >= mGameEvent.size())
return;
- if(!mGameEvent[event_id].isValid())
+ if (!mGameEvent[event_id].isValid())
return;
- if(m_ActiveEvents.find(event_id) != m_ActiveEvents.end())
+ if (m_ActiveEvents.find(event_id) != m_ActiveEvents.end())
return;
StartEvent(event_id);
@@ -121,22 +121,22 @@ void GameEventMgr::StartInternalEvent(uint16 event_id)
bool GameEventMgr::StartEvent( uint16 event_id, bool overwrite )
{
- if(mGameEvent[event_id].state == GAMEEVENT_NORMAL
+ if (mGameEvent[event_id].state == GAMEEVENT_NORMAL
|| mGameEvent[event_id].state == GAMEEVENT_INTERNAL)
{
AddActiveEvent(event_id);
ApplyNewEvent(event_id);
- if(overwrite)
+ if (overwrite)
{
mGameEvent[event_id].start = time(NULL);
- if(mGameEvent[event_id].end <= mGameEvent[event_id].start)
+ if (mGameEvent[event_id].end <= mGameEvent[event_id].start)
mGameEvent[event_id].end = mGameEvent[event_id].start+mGameEvent[event_id].length;
}
return false;
}
else
{
- if( mGameEvent[event_id].state == GAMEEVENT_WORLD_INACTIVE )
+ if ( mGameEvent[event_id].state == GAMEEVENT_WORLD_INACTIVE )
// set to conditions phase
mGameEvent[event_id].state = GAMEEVENT_WORLD_CONDITIONS;
@@ -152,7 +152,7 @@ bool GameEventMgr::StartEvent( uint16 event_id, bool overwrite )
// force game event update to set the update timer if conditions were met from a command
// this update is needed to possibly start events dependent on the started one
// or to scedule another update where the next event will be started
- if(overwrite && conditions_met)
+ if (overwrite && conditions_met)
sWorld.ForceGameEventUpdate();
return conditions_met;
@@ -166,16 +166,16 @@ void GameEventMgr::StopEvent( uint16 event_id, bool overwrite )
RemoveActiveEvent(event_id);
UnApplyEvent(event_id);
- if(overwrite && !serverwide_evt)
+ if (overwrite && !serverwide_evt)
{
mGameEvent[event_id].start = time(NULL) - mGameEvent[event_id].length * MINUTE;
- if(mGameEvent[event_id].end <= mGameEvent[event_id].start)
+ if (mGameEvent[event_id].end <= mGameEvent[event_id].start)
mGameEvent[event_id].end = mGameEvent[event_id].start+mGameEvent[event_id].length;
}
- else if(serverwide_evt)
+ else if (serverwide_evt)
{
// if finished world event, then only gm command can stop it
- if(overwrite || mGameEvent[event_id].state != GAMEEVENT_WORLD_FINISHED)
+ if (overwrite || mGameEvent[event_id].state != GAMEEVENT_WORLD_FINISHED)
{
// reset conditions
mGameEvent[event_id].nextstart = 0;
@@ -230,7 +230,7 @@ void GameEventMgr::LoadFromDB()
bar.step();
uint16 event_id = fields[0].GetUInt16();
- if(event_id==0)
+ if (event_id==0)
{
sLog.outErrorDb("`game_event` game event id (%i) is reserved and can't be used.",event_id);
continue;
@@ -248,15 +248,15 @@ void GameEventMgr::LoadFromDB()
pGameEvent.state = (GameEventState)(fields[7].GetUInt8());
pGameEvent.nextstart = 0;
- if(pGameEvent.length==0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check
+ if (pGameEvent.length==0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check
{
sLog.outErrorDb("`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.",event_id);
continue;
}
- if(pGameEvent.holiday_id)
+ if (pGameEvent.holiday_id)
{
- if(!sHolidaysStore.LookupEntry(pGameEvent.holiday_id))
+ if (!sHolidaysStore.LookupEntry(pGameEvent.holiday_id))
{
sLog.outErrorDb("`game_event` game event id (%i) have not existed holiday id %u.",event_id,pGameEvent.holiday_id);
pGameEvent.holiday_id = 0;
@@ -299,13 +299,13 @@ void GameEventMgr::LoadFromDB()
uint16 event_id = fields[0].GetUInt16();
- if(event_id >= mGameEvent.size())
+ if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_save` game event id (%i) is out of range compared to max event id in `game_event`",event_id);
continue;
}
- if(mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL)
+ if (mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL)
{
mGameEvent[event_id].state = (GameEventState)(fields[1].GetUInt8());
mGameEvent[event_id].nextstart = time_t(fields[2].GetUInt64());
@@ -348,16 +348,16 @@ void GameEventMgr::LoadFromDB()
uint16 event_id = fields[0].GetUInt16();
- if(event_id >= mGameEvent.size())
+ if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_prerequisite` game event id (%i) is out of range compared to max event id in `game_event`",event_id);
continue;
}
- if(mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL)
+ if (mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL)
{
uint16 prerequisite_event = fields[1].GetUInt16();
- if(prerequisite_event >= mGameEvent.size())
+ if (prerequisite_event >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`",prerequisite_event);
continue;
@@ -387,7 +387,7 @@ void GameEventMgr::LoadFromDB()
"FROM creature JOIN game_event_creature ON creature.guid = game_event_creature.guid");
count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar(1);
bar.step();
@@ -410,7 +410,7 @@ void GameEventMgr::LoadFromDB()
int32 internal_event_id = mGameEvent.size() + event_id - 1;
- if(internal_event_id < 0 || internal_event_id >= mGameEventCreatureGuids.size())
+ if (internal_event_id < 0 || internal_event_id >= mGameEventCreatureGuids.size())
{
sLog.outErrorDb("`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -436,7 +436,7 @@ void GameEventMgr::LoadFromDB()
"FROM gameobject JOIN game_event_gameobject ON gameobject.guid=game_event_gameobject.guid");
count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar(1);
bar.step();
@@ -459,7 +459,7 @@ void GameEventMgr::LoadFromDB()
int32 internal_event_id = mGameEvent.size() + event_id - 1;
- if(internal_event_id < 0 || internal_event_id >= mGameEventGameobjectGuids.size())
+ if (internal_event_id < 0 || internal_event_id >= mGameEventGameobjectGuids.size())
{
sLog.outErrorDb("`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -487,7 +487,7 @@ void GameEventMgr::LoadFromDB()
"FROM creature JOIN game_event_model_equip ON creature.guid=game_event_model_equip.guid");
count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar(1);
bar.step();
@@ -507,7 +507,7 @@ void GameEventMgr::LoadFromDB()
uint32 guid = fields[0].GetUInt32();
uint16 event_id = fields[1].GetUInt16();
- if(event_id >= mGameEventModelEquip.size())
+ if (event_id >= mGameEventModelEquip.size())
{
sLog.outErrorDb("`game_event_model_equip` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -521,9 +521,9 @@ void GameEventMgr::LoadFromDB()
newModelEquipSet.equipement_id_prev = 0;
newModelEquipSet.modelid_prev = 0;
- if(newModelEquipSet.equipment_id > 0)
+ if (newModelEquipSet.equipment_id > 0)
{
- if(!objmgr.GetEquipmentInfo(newModelEquipSet.equipment_id))
+ if (!objmgr.GetEquipmentInfo(newModelEquipSet.equipment_id))
{
sLog.outErrorDb("Table `game_event_model_equip` have creature (Guid: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", guid, newModelEquipSet.equipment_id);
continue;
@@ -547,7 +547,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT id, quest, event FROM game_event_creature_quest");
count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar(1);
bar.step();
@@ -568,7 +568,7 @@ void GameEventMgr::LoadFromDB()
uint32 quest = fields[1].GetUInt32();
uint16 event_id = fields[2].GetUInt16();
- if(event_id >= mGameEventCreatureQuests.size())
+ if (event_id >= mGameEventCreatureQuests.size())
{
sLog.outErrorDb("`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -592,7 +592,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT id, quest, event FROM game_event_gameobject_quest");
count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -613,7 +613,7 @@ void GameEventMgr::LoadFromDB()
uint32 quest = fields[1].GetUInt32();
uint16 event_id = fields[2].GetUInt16();
- if(event_id >= mGameEventGameObjectQuests.size())
+ if (event_id >= mGameEventGameObjectQuests.size())
{
sLog.outErrorDb("`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -636,7 +636,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT quest, event_id, condition_id, num FROM game_event_quest_condition");
count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -658,7 +658,7 @@ void GameEventMgr::LoadFromDB()
uint32 condition = fields[2].GetUInt32();
float num = fields[3].GetFloat();
- if(event_id >= mGameEvent.size())
+ if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -682,7 +682,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT event_id, condition_id, req_num, max_world_state_field, done_world_state_field FROM game_event_condition");
count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -702,7 +702,7 @@ void GameEventMgr::LoadFromDB()
uint16 event_id = fields[0].GetUInt16();
uint32 condition = fields[1].GetUInt32();
- if(event_id >= mGameEvent.size())
+ if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -728,7 +728,7 @@ void GameEventMgr::LoadFromDB()
result = CharacterDatabase.Query("SELECT event_id, condition_id, done FROM game_event_condition_save");
count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -748,14 +748,14 @@ void GameEventMgr::LoadFromDB()
uint16 event_id = fields[0].GetUInt16();
uint32 condition = fields[1].GetUInt32();
- if(event_id >= mGameEvent.size())
+ if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
}
std::map<uint32, GameEventFinishCondition>::iterator itr = mGameEvent[event_id].conditions.find(condition);
- if(itr != mGameEvent[event_id].conditions.end())
+ if (itr != mGameEvent[event_id].conditions.end())
{
itr->second.done = fields[2].GetFloat();
}
@@ -781,7 +781,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT guid, event_id, npcflag FROM game_event_npcflag");
count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -802,7 +802,7 @@ void GameEventMgr::LoadFromDB()
uint16 event_id = fields[1].GetUInt16();
uint32 npcflag = fields[2].GetUInt32();
- if(event_id >= mGameEvent.size())
+ if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -826,7 +826,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT event, guid, item, maxcount, incrtime, ExtendedCost FROM game_event_npc_vendor");
count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -845,7 +845,7 @@ void GameEventMgr::LoadFromDB()
bar3.step();
uint16 event_id = fields[0].GetUInt16();
- if(event_id >= mGameEventVendors.size())
+ if (event_id >= mGameEventVendors.size())
{
sLog.outErrorDb("`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -863,7 +863,7 @@ void GameEventMgr::LoadFromDB()
NPCFlagList& flist = mGameEventNPCFlags[event_id];
for (NPCFlagList::const_iterator itr = flist.begin(); itr != flist.end(); ++itr)
{
- if(itr->first == guid)
+ if (itr->first == guid)
{
event_npc_flag = itr->second;
break;
@@ -872,11 +872,11 @@ void GameEventMgr::LoadFromDB()
// get creature entry
newEntry.entry = 0;
- if( CreatureData const* data = objmgr.GetCreatureData(guid) )
+ if ( CreatureData const* data = objmgr.GetCreatureData(guid) )
newEntry.entry = data->id;
// check validity with event's npcflag
- if(!objmgr.IsVendorItemValid(newEntry.entry, newEntry.item, newEntry.maxcount, newEntry.incrtime, newEntry.ExtendedCost, NULL, NULL, event_npc_flag))
+ if (!objmgr.IsVendorItemValid(newEntry.entry, newEntry.item, newEntry.maxcount, newEntry.incrtime, newEntry.ExtendedCost, NULL, NULL, event_npc_flag))
continue;
++count;
vendors.push_back(newEntry);
@@ -894,7 +894,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT guid, event_id, textid FROM game_event_npc_gossip");
count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -915,7 +915,7 @@ void GameEventMgr::LoadFromDB()
uint16 event_id = fields[1].GetUInt16();
uint32 textid = fields[2].GetUInt32();
- if(event_id >= mGameEvent.size())
+ if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_npc_gossip` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -940,7 +940,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT event, bgflag FROM game_event_battleground_holiday");
count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -960,7 +960,7 @@ void GameEventMgr::LoadFromDB()
uint16 event_id = fields[0].GetUInt16();
- if(event_id >= mGameEvent.size())
+ if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -988,7 +988,7 @@ void GameEventMgr::LoadFromDB()
"FROM pool_template JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry");
count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar2(1);
bar2.step();
@@ -1011,7 +1011,7 @@ void GameEventMgr::LoadFromDB()
int32 internal_event_id = mGameEvent.size() + event_id - 1;
- if(internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size())
+ if (internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size())
{
sLog.outErrorDb("`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -1043,7 +1043,7 @@ uint32 GameEventMgr::GetNPCFlag(Creature * cr)
for (NPCFlagList::iterator itr = mGameEventNPCFlags[*e_itr].begin();
itr != mGameEventNPCFlags[*e_itr].end();
++ itr)
- if(itr->first == guid)
+ if (itr->first == guid)
mask |= itr->second;
}
@@ -1053,8 +1053,8 @@ uint32 GameEventMgr::GetNPCFlag(Creature * cr)
uint32 GameEventMgr::GetNpcTextId(uint32 guid)
{
GuidEventNpcGossipIdMap::iterator itr = mNPCGossipIds.find(guid);
- if(itr != mNPCGossipIds.end())
- if(IsActiveEvent(itr->second.first))
+ if (itr != mNPCGossipIds.end())
+ if (IsActiveEvent(itr->second.first))
return itr->second.second;
return 0;
}
@@ -1090,7 +1090,7 @@ uint32 GameEventMgr::Update() // return the next e
// save the state of this gameevent
SaveWorldEventStateToDB(itr);
// queue for deactivation
- if(IsActiveEvent(itr))
+ if (IsActiveEvent(itr))
deactivate.insert(itr);
// go to next event, this no longer needs an event update timer
continue;
@@ -1130,7 +1130,7 @@ uint32 GameEventMgr::Update() // return the next e
// start the event
// returns true the started event completed
// in that case, initiate next update in 1 second
- if(StartEvent(*itr))
+ if (StartEvent(*itr))
nextEventDelay = 0;
for (std::set<uint16>::iterator itr = deactivate.begin(); itr != deactivate.end(); ++itr)
StopEvent(*itr);
@@ -1194,14 +1194,14 @@ void GameEventMgr::UpdateEventNPCFlags(uint16 event_id)
for (NPCFlagList::iterator itr = mGameEventNPCFlags[event_id].begin(); itr != mGameEventNPCFlags[event_id].end(); ++itr)
{
// get the creature data from the low guid to get the entry, to be able to find out the whole guid
- if( CreatureData const* data = objmgr.GetCreatureData(itr->first) )
+ if ( CreatureData const* data = objmgr.GetCreatureData(itr->first) )
{
Creature * cr = HashMapHolder<Creature>::Find(MAKE_NEW_GUID(itr->first,data->id,HIGHGUID_UNIT));
// if we found the creature, modify its npcflag
- if(cr)
+ if (cr)
{
uint32 npcflag = GetNPCFlag(cr);
- if(const CreatureInfo * ci = cr->GetCreatureInfo())
+ if (const CreatureInfo * ci = cr->GetCreatureInfo())
npcflag |= ci->npcflag;
cr->SetUInt32Value(UNIT_NPC_FLAGS,npcflag);
// reset gossip options, since the flag change might have added / removed some
@@ -1224,7 +1224,7 @@ void GameEventMgr::UpdateEventNPCVendor(uint16 event_id, bool activate)
{
for (NPCVendorList::iterator itr = mGameEventVendors[event_id].begin(); itr != mGameEventVendors[event_id].end(); ++itr)
{
- if(activate)
+ if (activate)
objmgr.AddVendorItem(itr->entry, itr->item, itr->maxcount, itr->incrtime, itr->ExtendedCost, false);
else
objmgr.RemoveVendorItem(itr->entry, itr->item, false);
@@ -1235,7 +1235,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
{
int32 internal_event_id = mGameEvent.size() + event_id - 1;
- if(internal_event_id < 0 || internal_event_id >= mGameEventCreatureGuids.size())
+ if (internal_event_id < 0 || internal_event_id >= mGameEventCreatureGuids.size())
{
sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventCreatureGuids.size());
return;
@@ -1263,7 +1263,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
}
}
- if(internal_event_id < 0 || internal_event_id >= mGameEventGameobjectGuids.size())
+ if (internal_event_id < 0 || internal_event_id >= mGameEventGameobjectGuids.size())
{
sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventGameobjectGuids.size());
return;
@@ -1294,7 +1294,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
}
}
- if(internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size())
+ if (internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size())
{
sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size());
return;
@@ -1308,7 +1308,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
{
int32 internal_event_id = mGameEvent.size() + event_id - 1;
- if(internal_event_id < 0 || internal_event_id >= mGameEventCreatureGuids.size())
+ if (internal_event_id < 0 || internal_event_id >= mGameEventCreatureGuids.size())
{
sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventCreatureGuids.size());
return;
@@ -1317,19 +1317,19 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
for (GuidList::iterator itr = mGameEventCreatureGuids[internal_event_id].begin(); itr != mGameEventCreatureGuids[internal_event_id].end(); ++itr)
{
// check if it's needed by another event, if so, don't remove
- if( event_id > 0 && hasCreatureActiveEventExcept(*itr,event_id) )
+ if ( event_id > 0 && hasCreatureActiveEventExcept(*itr,event_id) )
continue;
// Remove the creature from grid
- if( CreatureData const* data = objmgr.GetCreatureData(*itr) )
+ if ( CreatureData const* data = objmgr.GetCreatureData(*itr) )
{
objmgr.RemoveCreatureFromGrid(*itr, data);
- if( Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL) )
+ if ( Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL) )
pCreature->AddObjectToRemoveList();
}
}
- if(internal_event_id < 0 || internal_event_id >= mGameEventGameobjectGuids.size())
+ if (internal_event_id < 0 || internal_event_id >= mGameEventGameobjectGuids.size())
{
sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventGameobjectGuids.size());
return;
@@ -1338,18 +1338,18 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin(); itr != mGameEventGameobjectGuids[internal_event_id].end(); ++itr)
{
// check if it's needed by another event, if so, don't remove
- if( event_id >0 && hasGameObjectActiveEventExcept(*itr,event_id) )
+ if ( event_id >0 && hasGameObjectActiveEventExcept(*itr,event_id) )
continue;
// Remove the gameobject from grid
- if(GameObjectData const* data = objmgr.GetGOData(*itr))
+ if (GameObjectData const* data = objmgr.GetGOData(*itr))
{
objmgr.RemoveGameobjectFromGrid(*itr, data);
- if( GameObject* pGameobject = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL) )
+ if ( GameObject* pGameobject = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL) )
pGameobject->AddObjectToRemoveList();
}
}
- if(internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size())
+ if (internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size())
{
sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size());
return;
@@ -1367,7 +1367,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate)
{
// Remove the creature from grid
CreatureData const* data = objmgr.GetCreatureData(itr->first);
- if(!data)
+ if (!data)
continue;
// Update if spawned
@@ -1445,11 +1445,11 @@ bool GameEventMgr::hasCreatureQuestActiveEventExcept(uint32 quest_id, uint16 eve
{
for (ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr)
{
- if((*e_itr) != event_id)
+ if ((*e_itr) != event_id)
for (QuestRelList::iterator itr = mGameEventCreatureQuests[*e_itr].begin();
itr != mGameEventCreatureQuests[*e_itr].end();
++ itr)
- if(itr->second == quest_id)
+ if (itr->second == quest_id)
return true;
}
return false;
@@ -1459,11 +1459,11 @@ bool GameEventMgr::hasGameObjectQuestActiveEventExcept(uint32 quest_id, uint16 e
{
for (ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr)
{
- if((*e_itr) != event_id)
+ if ((*e_itr) != event_id)
for (QuestRelList::iterator itr = mGameEventGameObjectQuests[*e_itr].begin();
itr != mGameEventGameObjectQuests[*e_itr].end();
++ itr)
- if(itr->second == quest_id)
+ if (itr->second == quest_id)
return true;
}
return false;
@@ -1472,13 +1472,13 @@ bool GameEventMgr::hasCreatureActiveEventExcept(uint32 creature_id, uint16 event
{
for (ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr)
{
- if((*e_itr) != event_id)
+ if ((*e_itr) != event_id)
{
int32 internal_event_id = mGameEvent.size() + (*e_itr) - 1;
for (GuidList::iterator itr = mGameEventCreatureGuids[internal_event_id].begin();
itr != mGameEventCreatureGuids[internal_event_id].end();
++ itr)
- if(*itr == creature_id)
+ if (*itr == creature_id)
return true;
}
}
@@ -1488,13 +1488,13 @@ bool GameEventMgr::hasGameObjectActiveEventExcept(uint32 go_id, uint16 event_id)
{
for (ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr)
{
- if((*e_itr) != event_id)
+ if ((*e_itr) != event_id)
{
int32 internal_event_id = mGameEvent.size() + (*e_itr) - 1;
for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin();
itr != mGameEventGameobjectGuids[internal_event_id].end();
++ itr)
- if(*itr == go_id)
+ if (*itr == go_id)
return true;
}
}
@@ -1511,7 +1511,7 @@ void GameEventMgr::UpdateEventQuests(uint16 event_id, bool activate)
CreatureQuestMap.insert(QuestRelations::value_type(itr->first, itr->second));
else
{
- if(!hasCreatureQuestActiveEventExcept(itr->second,event_id))
+ if (!hasCreatureQuestActiveEventExcept(itr->second,event_id))
{
// Remove the pair(id,quest) from the multimap
QuestRelations::iterator qitr = CreatureQuestMap.find(itr->first);
@@ -1536,7 +1536,7 @@ void GameEventMgr::UpdateEventQuests(uint16 event_id, bool activate)
GameObjectQuestMap.insert(QuestRelations::value_type(itr->first, itr->second));
else
{
- if(!hasGameObjectQuestActiveEventExcept(itr->second,event_id))
+ if (!hasGameObjectQuestActiveEventExcept(itr->second,event_id))
{
// Remove the pair(id,quest) from the multimap
QuestRelations::iterator qitr = GameObjectQuestMap.find(itr->first);
@@ -1565,28 +1565,28 @@ void GameEventMgr::HandleQuestComplete(uint32 quest_id)
// translate the quest to event and condition
QuestIdToEventConditionMap::iterator itr = mQuestToEventConditions.find(quest_id);
// quest is registered
- if(itr != mQuestToEventConditions.end())
+ if (itr != mQuestToEventConditions.end())
{
uint16 event_id = itr->second.event_id;
uint32 condition = itr->second.condition;
float num = itr->second.num;
// the event is not active, so return, don't increase condition finishes
- if(!IsActiveEvent(event_id))
+ if (!IsActiveEvent(event_id))
return;
// not in correct phase, return
- if(mGameEvent[event_id].state != GAMEEVENT_WORLD_CONDITIONS)
+ if (mGameEvent[event_id].state != GAMEEVENT_WORLD_CONDITIONS)
return;
std::map<uint32,GameEventFinishCondition>::iterator citr = mGameEvent[event_id].conditions.find(condition);
// condition is registered
- if(citr != mGameEvent[event_id].conditions.end())
+ if (citr != mGameEvent[event_id].conditions.end())
{
// increase the done count, only if less then the req
- if(citr->second.done < citr->second.reqNum)
+ if (citr->second.done < citr->second.reqNum)
{
citr->second.done += num;
// check max limit
- if(citr->second.done > citr->second.reqNum)
+ if (citr->second.done > citr->second.reqNum)
citr->second.done = citr->second.reqNum;
// save the change to db
CharacterDatabase.BeginTransaction();
@@ -1594,7 +1594,7 @@ void GameEventMgr::HandleQuestComplete(uint32 quest_id)
CharacterDatabase.PExecute("INSERT INTO game_event_condition_save (event_id, condition_id, done) VALUES (%u,%u,%f)",event_id,condition,citr->second.done);
CharacterDatabase.CommitTransaction();
// check if all conditions are met, if so, update the event state
- if(CheckOneGameEventConditions(event_id))
+ if (CheckOneGameEventConditions(event_id))
{
// changed, save to DB the gameevent state
SaveWorldEventStateToDB(event_id);
@@ -1609,13 +1609,13 @@ void GameEventMgr::HandleQuestComplete(uint32 quest_id)
bool GameEventMgr::CheckOneGameEventConditions(uint16 event_id)
{
for (std::map<uint32,GameEventFinishCondition>::iterator itr = mGameEvent[event_id].conditions.begin(); itr != mGameEvent[event_id].conditions.end(); ++itr)
- if(itr->second.done < itr->second.reqNum)
+ if (itr->second.done < itr->second.reqNum)
// return false if a condition doesn't match
return false;
// set the phase
mGameEvent[event_id].state = GAMEEVENT_WORLD_NEXTPHASE;
// set the followup events' start time
- if(!mGameEvent[event_id].nextstart)
+ if (!mGameEvent[event_id].nextstart)
{
time_t currenttime = time(NULL);
mGameEvent[event_id].nextstart = currenttime + mGameEvent[event_id].length * 60;
@@ -1627,7 +1627,7 @@ void GameEventMgr::SaveWorldEventStateToDB(uint16 event_id)
{
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM game_event_save WHERE event_id = '%u'",event_id);
- if(mGameEvent[event_id].nextstart)
+ if (mGameEvent[event_id].nextstart)
CharacterDatabase.PExecute("INSERT INTO game_event_save (event_id, state, next_start) VALUES ('%u','%u',FROM_UNIXTIME("UI64FMTD"))",event_id,mGameEvent[event_id].state,(uint64)(mGameEvent[event_id].nextstart));
else
CharacterDatabase.PExecute("INSERT INTO game_event_save (event_id, state, next_start) VALUES ('%u','%u','0000-00-00 00:00:00')",event_id,mGameEvent[event_id].state);
@@ -1640,8 +1640,8 @@ void GameEventMgr::HandleWorldEventGossip(Player *plr, Creature *c)
// find the npc's gossip id (if set) in an active game event
// if present, send the event's world states
GuidEventNpcGossipIdMap::iterator itr = mNPCGossipIds.find(c->GetDBTableGUIDLow());
- if(itr != mNPCGossipIds.end())
- if(IsActiveEvent(itr->second.first))
+ if (itr != mNPCGossipIds.end())
+ if (IsActiveEvent(itr->second.first))
// send world state updates to the player about the progress
SendWorldStateUpdate(plr, itr->second.first);
}
@@ -1651,9 +1651,9 @@ void GameEventMgr::SendWorldStateUpdate(Player * plr, uint16 event_id)
std::map<uint32,GameEventFinishCondition>::iterator itr;
for (itr = mGameEvent[event_id].conditions.begin(); itr !=mGameEvent[event_id].conditions.end(); ++itr)
{
- if(itr->second.done_world_state)
+ if (itr->second.done_world_state)
plr->SendUpdateWorldState(itr->second.done_world_state, (uint32)(itr->second.done));
- if(itr->second.max_world_state)
+ if (itr->second.max_world_state)
plr->SendUpdateWorldState(itr->second.max_world_state, (uint32)(itr->second.reqNum));
}
}
@@ -1664,7 +1664,7 @@ void GameEventMgr::SendWorldStateUpdate(Player * plr, uint16 event_id)
GameEventMgr::ActiveEvents const& ae = gameeventmgr.GetActiveEventList();
for (GameEventMgr::ActiveEvents::const_iterator itr = ae.begin(); itr != ae.end(); ++itr)
- if(events[*itr].holiday_id == id)
+ if (events[*itr].holiday_id == id)
return true;
return false;
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
index 47036aa38c5..a834d6aea62 100644
--- a/src/game/GameObject.cpp
+++ b/src/game/GameObject.cpp
@@ -70,7 +70,7 @@ GameObject::GameObject() : WorldObject(), m_goValue(new GameObjectValue)
GameObject::~GameObject()
{
delete m_goValue;
- //if(m_uint32Values) // field array can be not exist if GameOBject not loaded
+ //if (m_uint32Values) // field array can be not exist if GameOBject not loaded
// CleanupsBeforeDelete();
}
@@ -79,26 +79,26 @@ void GameObject::CleanupsBeforeDelete(bool finalCleanup)
if (IsInWorld())
RemoveFromWorld();
- if(m_uint32Values) // field array can be not exist if GameOBject not loaded
+ if (m_uint32Values) // field array can be not exist if GameOBject not loaded
{
// Possible crash at access to deleted GO in Unit::m_gameobj
- if(uint64 owner_guid = GetOwnerGUID())
+ if (uint64 owner_guid = GetOwnerGUID())
{
Unit* owner = NULL;
// Object may be deleted while player is not in world, skip this check for now.
- /*if(IS_PLAYER_GUID(owner_guid))
+ /*if (IS_PLAYER_GUID(owner_guid))
owner = ObjectAccessor::GetObjectInWorld(owner_guid, (Player*)NULL);
else*/
owner = ObjectAccessor::GetUnit(*this,owner_guid);
- if(owner)
+ if (owner)
owner->RemoveGameObject(this,false);
else
{
const char * ownerType = "creature";
- if(IS_PLAYER_GUID(owner_guid))
+ if (IS_PLAYER_GUID(owner_guid))
ownerType = "player";
- else if(IS_PET_GUID(owner_guid))
+ else if (IS_PET_GUID(owner_guid))
ownerType = "pet";
sLog.outError("Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.",
@@ -111,9 +111,9 @@ void GameObject::CleanupsBeforeDelete(bool finalCleanup)
void GameObject::AddToWorld()
{
///- Register the gameobject for guid lookup
- if(!IsInWorld())
+ if (!IsInWorld())
{
- if(m_zoneScript)
+ if (m_zoneScript)
m_zoneScript->OnGameObjectCreate(this, true);
ObjectAccessor::Instance().AddObject(this);
@@ -124,17 +124,17 @@ void GameObject::AddToWorld()
void GameObject::RemoveFromWorld()
{
///- Remove the gameobject from the accessor
- if(IsInWorld())
+ if (IsInWorld())
{
- if(m_zoneScript)
+ if (m_zoneScript)
m_zoneScript->OnGameObjectCreate(this, false);
// Possible crash at access to deleted GO in Unit::m_gameobj
- if(uint64 owner_guid = GetOwnerGUID())
+ if (uint64 owner_guid = GetOwnerGUID())
{
- if(Unit * owner = GetOwner(false))
+ if (Unit * owner = GetOwner(false))
owner->RemoveGameObject(this,false);
- else if(!IS_PLAYER_GUID(owner_guid))
+ else if (!IS_PLAYER_GUID(owner_guid))
sLog.outError("Delete GameObject (GUID: %u Entry: %u ) that have references in not found creature %u GO list. Crash possible later.",GetGUIDLow(),GetGOInfo()->id,GUID_LOPART(owner_guid));
}
WorldObject::RemoveFromWorld();
@@ -148,7 +148,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
SetMap(map);
Relocate(x,y,z,ang);
- if(!IsPositionValid())
+ if (!IsPositionValid())
{
sLog.outError("Gameobject (GUID: %u Entry: %u ) not created. Suggested coordinates isn't valid (X: %f Y: %f)",guidlow,name_id,x,y);
return false;
@@ -245,11 +245,11 @@ void GameObject::Update(uint32 diff)
case GAMEOBJECT_TYPE_FISHINGNODE:
{
// fishing code (bobber ready)
- if( time(NULL) > m_respawnTime - FISHING_BOBBER_READY_TIME )
+ if ( time(NULL) > m_respawnTime - FISHING_BOBBER_READY_TIME )
{
// splash bobber (bobber ready now)
Unit* caster = GetOwner();
- if(caster && caster->GetTypeId() == TYPEID_PLAYER)
+ if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{
SetGoState(GO_STATE_ACTIVE);
SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);
@@ -288,7 +288,7 @@ void GameObject::Update(uint32 diff)
case GAMEOBJECT_TYPE_FISHINGNODE: // can't fish now
{
Unit* caster = GetOwner();
- if(caster && caster->GetTypeId() == TYPEID_PLAYER)
+ if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{
caster->FinishSpell(CURRENT_CHANNELED_SPELL);
@@ -323,19 +323,19 @@ void GameObject::Update(uint32 diff)
}
}
- if(isSpawned())
+ if (isSpawned())
{
// traps can have time and can not have
GameObjectInfo const* goInfo = GetGOInfo();
- if(goInfo->type == GAMEOBJECT_TYPE_TRAP)
+ if (goInfo->type == GAMEOBJECT_TYPE_TRAP)
{
- if(m_cooldownTime >= time(NULL))
+ if (m_cooldownTime >= time(NULL))
return;
// Type 2 - Bomb ( will go away after casting it's spell )
- if(goInfo->trap.charges == 2)
+ if (goInfo->trap.charges == 2)
{
- if(goInfo->trap.spellId)
+ if (goInfo->trap.spellId)
CastSpell(NULL, goInfo->trap.spellId); // FIXME: null target won't work for target type 1
SetLootState(GO_JUST_DEACTIVATED);
break;
@@ -348,31 +348,31 @@ void GameObject::Update(uint32 diff)
//FIXME: this is activation radius (in different casting radius that must be selected from spell data)
//TODO: move activated state code (cast itself) to GO_ACTIVATED, in this place only check activating and set state
float radius = (goInfo->trap.radius)/2; // TODO rename radius to diameter (goInfo->trap.radius) should be (goInfo->trap.diameter)
- if(!radius)
+ if (!radius)
{
- if(goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call)
+ if (goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call)
return;
else
{
- if(m_respawnTime > 0)
+ if (m_respawnTime > 0)
break;
radius = goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3
IsBattleGroundTrap = true;
- if(!radius)
+ if (!radius)
return;
}
}
// Note: this hack with search required until GO casting not implemented
// search unfriendly creature
- if(owner) // hunter trap
+ if (owner) // hunter trap
{
Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck checker(this, owner, radius);
Trinity::UnitSearcher<Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck> searcher(this, ok, checker);
VisitNearbyGridObject(radius, searcher);
- if(!ok) VisitNearbyWorldObject(radius, searcher);
+ if (!ok) VisitNearbyWorldObject(radius, searcher);
}
else // environmental trap
{
@@ -388,24 +388,24 @@ void GameObject::Update(uint32 diff)
if (ok)
{
// some traps do not have spell but should be triggered
- if(goInfo->trap.spellId)
+ if (goInfo->trap.spellId)
CastSpell(ok, goInfo->trap.spellId);
m_cooldownTime = time(NULL) + 4; // 4 seconds
- if(owner) // || goInfo->trap.charges == 1)
+ if (owner) // || goInfo->trap.charges == 1)
SetLootState(GO_JUST_DEACTIVATED);
- if(IsBattleGroundTrap && ok->GetTypeId() == TYPEID_PLAYER)
+ if (IsBattleGroundTrap && ok->GetTypeId() == TYPEID_PLAYER)
{
//BattleGround gameobjects case
- if(ok->ToPlayer()->InBattleGround())
- if(BattleGround *bg = ok->ToPlayer()->GetBattleGround())
+ if (ok->ToPlayer()->InBattleGround())
+ if (BattleGround *bg = ok->ToPlayer()->GetBattleGround())
bg->HandleTriggerBuff(GetGUID());
}
}
}
- else if(uint32 max_charges = goInfo->GetCharges())
+ else if (uint32 max_charges = goInfo->GetCharges())
{
if (m_usetimes >= max_charges)
{
@@ -460,7 +460,7 @@ void GameObject::Update(uint32 diff)
{
uint32 spellId = GetGOInfo()->goober.spellId;
- if(spellId)
+ if (spellId)
{
std::set<uint32>::const_iterator it = m_unique_users.begin();
std::set<uint32>::const_iterator end = m_unique_users.end();
@@ -479,9 +479,9 @@ void GameObject::Update(uint32 diff)
//any return here in case battleground traps
}
- if(GetOwnerGUID())
+ if (GetOwnerGUID())
{
- if(Unit* owner = GetOwner(false))
+ if (Unit* owner = GetOwner(false))
{
owner->RemoveGameObject(this, false);
SetRespawnTime(0);
@@ -501,10 +501,10 @@ void GameObject::Update(uint32 diff)
loot.clear();
SetLootState(GO_READY);
- if(!m_respawnDelayTime)
+ if (!m_respawnDelayTime)
return;
- if(!m_spawnedByDefault)
+ if (!m_spawnedByDefault)
{
m_respawnTime = 0;
UpdateObjectVisibility();
@@ -514,7 +514,7 @@ void GameObject::Update(uint32 diff)
m_respawnTime = time(NULL) + m_respawnDelayTime;
// if option not set then object will be saved at grid unload
- if(sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
+ if (sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
SaveRespawnTime();
UpdateObjectVisibility();
@@ -527,10 +527,10 @@ void GameObject::Update(uint32 diff)
void GameObject::Refresh()
{
// not refresh despawned not casted GO (despawned casted GO destroyed in all cases anyway)
- if(m_respawnTime > 0 && m_spawnedByDefault)
+ if (m_respawnTime > 0 && m_spawnedByDefault)
return;
- if(isSpawned())
+ if (isSpawned())
GetMap()->Add(this);
}
@@ -578,7 +578,7 @@ void GameObject::SaveToDB()
// this should only be used when the gameobject has already been loaded
// preferably after adding to map, because mapid may not be valid otherwise
GameObjectData const *data = objmgr.GetGOData(m_DBTableGuid);
- if(!data)
+ if (!data)
{
sLog.outError("GameObject::SaveToDB failed, cannot get gameobject data!");
return;
@@ -647,7 +647,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
{
GameObjectData const* data = objmgr.GetGOData(guid);
- if( !data )
+ if ( !data )
{
sLog.outErrorDb("Gameobject (GUID: %u) not found in table `gameobject`, can't load. ",guid);
return false;
@@ -676,11 +676,11 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
if (!Create(guid,entry, map, phaseMask, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state, artKit) )
return false;
- if(data->spawntimesecs >= 0)
+ if (data->spawntimesecs >= 0)
{
m_spawnedByDefault = true;
- if(!GetGOInfo()->GetDespawnPossibility() && !GetGOInfo()->IsDespawnAtAction())
+ if (!GetGOInfo()->GetDespawnPossibility() && !GetGOInfo()->IsDespawnAtAction())
{
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);
m_respawnDelayTime = 0;
@@ -692,7 +692,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
m_respawnTime = objmgr.GetGORespawnTime(m_DBTableGuid, map->GetInstanceId());
// ready to respawn
- if(m_respawnTime && m_respawnTime <= time(NULL))
+ if (m_respawnTime && m_respawnTime <= time(NULL))
{
m_respawnTime = 0;
objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0);
@@ -732,7 +732,7 @@ bool GameObject::hasQuest(uint32 quest_id) const
QuestRelations const& qr = objmgr.mGOQuestRelations;
for (QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr)
{
- if(itr->second==quest_id)
+ if (itr->second==quest_id)
return true;
}
return false;
@@ -743,7 +743,7 @@ bool GameObject::hasInvolvedQuest(uint32 quest_id) const
QuestRelations const& qr = objmgr.mGOQuestInvolvedRelations;
for (QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr)
{
- if(itr->second==quest_id)
+ if (itr->second==quest_id)
return true;
}
return false;
@@ -753,7 +753,7 @@ bool GameObject::IsTransport() const
{
// If something is marked as a transport, don't transmit an out of range packet for it.
GameObjectInfo const * gInfo = GetGOInfo();
- if(!gInfo) return false;
+ if (!gInfo) return false;
return gInfo->type == GAMEOBJECT_TYPE_TRANSPORT || gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT;
}
@@ -762,7 +762,7 @@ bool GameObject::IsDynTransport() const
{
// If something is marked as a transport, don't transmit an out of range packet for it.
GameObjectInfo const * gInfo = GetGOInfo();
- if(!gInfo) return false;
+ if (!gInfo) return false;
return gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT || (gInfo->type == GAMEOBJECT_TYPE_TRANSPORT && !gInfo->transport.pause);
}
@@ -776,32 +776,32 @@ Unit* GameObject::GetOwner(bool inWorld) const
void GameObject::SaveRespawnTime()
{
- if(m_goData && m_goData->dbData && m_respawnTime > time(NULL) && m_spawnedByDefault)
+ if (m_goData && m_goData->dbData && m_respawnTime > time(NULL) && m_spawnedByDefault)
objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),m_respawnTime);
}
bool GameObject::isVisibleForInState(Player const* u, bool inVisibleList) const
{
// Not in world
- if(!IsInWorld() || !u->IsInWorld())
+ if (!IsInWorld() || !u->IsInWorld())
return false;
// Transport always visible at this step implementation
- if(IsTransport() && IsInMap(u))
+ if (IsTransport() && IsInMap(u))
return true;
// quick check visibility false cases for non-GM-mode
- if(!u->isGameMaster())
+ if (!u->isGameMaster())
{
// despawned and then not visible for non-GM in GM-mode
- if(!isSpawned())
+ if (!isSpawned())
return false;
// special invisibility cases
- if(GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP && GetGOInfo()->trap.stealthed)
+ if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP && GetGOInfo()->trap.stealthed)
{
Unit *owner = GetOwner();
- if(owner && u->IsHostileTo(owner) && !canDetectTrap(u, GetDistance(u)))
+ if (owner && u->IsHostileTo(owner) && !canDetectTrap(u, GetDistance(u)))
return false;
}
}
@@ -813,13 +813,13 @@ bool GameObject::isVisibleForInState(Player const* u, bool inVisibleList) const
bool GameObject::canDetectTrap(Player const* u, float distance) const
{
- if(u->hasUnitState(UNIT_STAT_STUNNED))
+ if (u->hasUnitState(UNIT_STAT_STUNNED))
return false;
- if(distance < GetGOInfo()->size) //collision
+ if (distance < GetGOInfo()->size) //collision
return true;
- if(!u->HasInArc(M_PI, this)) //behind
+ if (!u->HasInArc(M_PI, this)) //behind
return false;
- if(u->HasAuraType(SPELL_AURA_DETECT_STEALTH))
+ if (u->HasAuraType(SPELL_AURA_DETECT_STEALTH))
return true;
//Visible distance is modified by -Level Diff (every level diff = 0.25f in visible distance)
@@ -834,7 +834,7 @@ bool GameObject::canDetectTrap(Player const* u, float distance) const
void GameObject::Respawn()
{
- if(m_spawnedByDefault && m_respawnTime > 0)
+ if (m_spawnedByDefault && m_respawnTime > 0)
{
m_respawnTime = time(NULL);
objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0);
@@ -883,7 +883,7 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
return;
SpellEntry const* trapSpell = sSpellStore.LookupEntry(trapInfo->trap.spellId);
- if(!trapSpell) // checked at load already
+ if (!trapSpell) // checked at load already
return;
float range;
@@ -917,7 +917,7 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
// found correct GO
// FIXME: when GO casting will be implemented trap must cast spell to target
- if(trapGO)
+ if (trapGO)
target->CastSpell(target,trapSpell,true, 0, 0, GetGUID());
}
@@ -949,10 +949,10 @@ void GameObject::ResetDoorOrButton()
void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = false */)
{
- if(m_lootState != GO_READY)
+ if (m_lootState != GO_READY)
return;
- if(!time_to_restore)
+ if (!time_to_restore)
time_to_restore = GetGOInfo()->GetAutoCloseTime();
SwitchDoorOrButton(true,alternative);
@@ -965,33 +965,33 @@ void GameObject::SetGoArtKit(uint8 kit)
{
SetByteValue(GAMEOBJECT_BYTES_1, 2, kit);
GameObjectData *data = const_cast<GameObjectData*>(objmgr.GetGOData(m_DBTableGuid));
- if(data)
+ if (data)
data->artKit = kit;
}
void GameObject::SetGoArtKit(uint8 artkit, GameObject *go, uint32 lowguid)
{
const GameObjectData *data = NULL;
- if(go)
+ if (go)
{
go->SetGoArtKit(artkit);
data = go->GetGOData();
}
- else if(lowguid)
+ else if (lowguid)
data = objmgr.GetGOData(lowguid);
- if(data)
+ if (data)
const_cast<GameObjectData*>(data)->artKit = artkit;
}
void GameObject::SwitchDoorOrButton(bool activate, bool alternative /* = false */)
{
- if(activate)
+ if (activate)
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
else
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
- if(GetGoState() == GO_STATE_READY) //if closed -> open
+ if (GetGoState() == GO_STATE_READY) //if closed -> open
SetGoState(alternative ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_ACTIVE);
else //if open -> close
SetGoState(GO_STATE_READY);
@@ -1030,10 +1030,10 @@ void GameObject::Use(Unit* user)
case GAMEOBJECT_TYPE_CHAIR: //7
{
GameObjectInfo const* info = GetGOInfo();
- if(!info)
+ if (!info)
return;
- if(user->GetTypeId() != TYPEID_PLAYER)
+ if (user->GetTypeId() != TYPEID_PLAYER)
return;
if (!ChairListSlots.size()) // this is called once at first chair use to make list of available slots
@@ -1066,9 +1066,9 @@ void GameObject::Use(Unit* user)
float x_i = GetPositionX() + relativeDistance * cos(orthogonalOrientation);
float y_i = GetPositionY() + relativeDistance * sin(orthogonalOrientation);
- if(itr->second)
- if(Player* ChairUser = objmgr.GetPlayer(itr->second))
- if(ChairUser->IsSitState() && ChairUser->getStandState() != UNIT_STAND_STATE_SIT && ChairUser->GetExactDist2d(x_i, y_i) < 0.1f)
+ if (itr->second)
+ if (Player* ChairUser = objmgr.GetPlayer(itr->second))
+ if (ChairUser->IsSitState() && ChairUser->getStandState() != UNIT_STAND_STATE_SIT && ChairUser->GetExactDist2d(x_i, y_i) < 0.1f)
continue; // This seat is already occupied by ChairUser. NOTE: Not sure if the ChairUser->getStandState() != UNIT_STAND_STATE_SIT check is required.
else
itr->second = 0; // This seat is unoccupied.
@@ -1087,7 +1087,7 @@ void GameObject::Use(Unit* user)
helper->MonsterSay(output.str().c_str(), LANG_UNIVERSAL, 0);
*/
- if(thisDistance <= lowestDist)
+ if (thisDistance <= lowestDist)
{
nearest_slot = itr->first;
lowestDist = thisDistance;
@@ -1096,7 +1096,7 @@ void GameObject::Use(Unit* user)
}
}
- if(found_free_slot)
+ if (found_free_slot)
{
ChairSlotAndUser::iterator itr = ChairListSlots.find(nearest_slot);
if (itr != ChairListSlots.end())
@@ -1117,7 +1117,7 @@ void GameObject::Use(Unit* user)
{
GameObjectInfo const* info = GetGOInfo();
- if(user->GetTypeId() == TYPEID_PLAYER)
+ if (user->GetTypeId() == TYPEID_PLAYER)
{
Player* player = (Player*)user;
@@ -1180,10 +1180,10 @@ void GameObject::Use(Unit* user)
case GAMEOBJECT_TYPE_CAMERA: //13
{
GameObjectInfo const* info = GetGOInfo();
- if(!info)
+ if (!info)
return;
- if(user->GetTypeId() != TYPEID_PLAYER)
+ if (user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1199,12 +1199,12 @@ void GameObject::Use(Unit* user)
//fishing bobber
case GAMEOBJECT_TYPE_FISHINGNODE: //17
{
- if(user->GetTypeId() != TYPEID_PLAYER)
+ if (user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
- if(player->GetGUID() != GetOwnerGUID())
+ if (player->GetGUID() != GetOwnerGUID())
return;
switch(getLootState())
@@ -1215,11 +1215,11 @@ void GameObject::Use(Unit* user)
GetZoneAndAreaId(zone,subzone);
int32 zone_skill = objmgr.GetFishingBaseSkillLevel( subzone );
- if(!zone_skill)
+ if (!zone_skill)
zone_skill = objmgr.GetFishingBaseSkillLevel( zone );
//provide error, no fishable zone or area should be 0
- if(!zone_skill)
+ if (!zone_skill)
sLog.outErrorDb("Fishable areaId %u are not properly defined in `skill_fishing_base_level`.",subzone);
int32 skill = player->GetSkillValue(SKILL_FISHING);
@@ -1280,7 +1280,7 @@ void GameObject::Use(Unit* user)
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
{
- if(user->GetTypeId() != TYPEID_PLAYER)
+ if (user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1289,27 +1289,27 @@ void GameObject::Use(Unit* user)
GameObjectInfo const* info = GetGOInfo();
- if( !caster || caster->GetTypeId() != TYPEID_PLAYER )
+ if ( !caster || caster->GetTypeId() != TYPEID_PLAYER )
return;
// accept only use by player from same group for caster except caster itself
- if(caster->ToPlayer()==player || !caster->ToPlayer()->IsInSameRaidWith(player))
+ if (caster->ToPlayer()==player || !caster->ToPlayer()->IsInSameRaidWith(player))
return;
AddUniqueUse(player);
// full amount unique participants including original summoner
- if(GetUniqueUseCount() < info->summoningRitual.reqParticipants)
+ if (GetUniqueUseCount() < info->summoningRitual.reqParticipants)
return;
// in case summoning ritual caster is GO creator
spellCaster = caster;
- if(!caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
+ if (!caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
return;
spellId = info->summoningRitual.spellId;
- if(spellId==62330) // GO store not existed spell, replace by expected
+ if (spellId==62330) // GO store not existed spell, replace by expected
{
// spell have reagent and mana cost but it not expected use its
// it triggered spell in fact casted at currently channeled GO
@@ -1331,16 +1331,16 @@ void GameObject::Use(Unit* user)
SetUInt32Value(GAMEOBJECT_FLAGS,2);
GameObjectInfo const* info = GetGOInfo();
- if(!info)
+ if (!info)
return;
- if(info->spellcaster.partyOnly)
+ if (info->spellcaster.partyOnly)
{
Unit* caster = GetOwner();
- if( !caster || caster->GetTypeId() != TYPEID_PLAYER )
+ if ( !caster || caster->GetTypeId() != TYPEID_PLAYER )
return;
- if(user->GetTypeId() != TYPEID_PLAYER || !user->ToPlayer()->IsInSameRaidWith(caster->ToPlayer()))
+ if (user->GetTypeId() != TYPEID_PLAYER || !user->ToPlayer()->IsInSameRaidWith(caster->ToPlayer()))
return;
}
@@ -1353,7 +1353,7 @@ void GameObject::Use(Unit* user)
{
GameObjectInfo const* info = GetGOInfo();
- if(user->GetTypeId() != TYPEID_PLAYER)
+ if (user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1361,7 +1361,7 @@ void GameObject::Use(Unit* user)
Player* targetPlayer = ObjectAccessor::FindPlayer(player->GetSelection());
// accept only use by player from same group for caster except caster itself
- if(!targetPlayer || targetPlayer == player || !targetPlayer->IsInSameGroupWith(player))
+ if (!targetPlayer || targetPlayer == player || !targetPlayer->IsInSameGroupWith(player))
return;
//required lvl checks!
@@ -1372,7 +1372,7 @@ void GameObject::Use(Unit* user)
if (level < info->meetingstone.minLevel)
return;
- if(info->id==194097)
+ if (info->id==194097)
spellId = 61994; // Ritual of Summoning
else
spellId = 59782; // Summoning Stone Effect
@@ -1391,7 +1391,7 @@ void GameObject::Use(Unit* user)
{
// in battleground check
BattleGround *bg = player->GetBattleGround();
- if(!bg)
+ if (!bg)
return;
// BG flag click
// AB:
@@ -1431,15 +1431,15 @@ void GameObject::Use(Unit* user)
{
case 179785: // Silverwing Flag
// check if it's correct bg
- if(bg->GetTypeID() == BATTLEGROUND_WS)
+ if (bg->GetTypeID() == BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag(player, this);
break;
case 179786: // Warsong Flag
- if(bg->GetTypeID() == BATTLEGROUND_WS)
+ if (bg->GetTypeID() == BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag(player, this);
break;
case 184142: // Netherstorm Flag
- if(bg->GetTypeID() == BATTLEGROUND_EY)
+ if (bg->GetTypeID() == BATTLEGROUND_EY)
bg->EventPlayerClickedOnFlag(player, this);
break;
}
@@ -1481,7 +1481,7 @@ void GameObject::Use(Unit* user)
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellId );
if (!spellInfo)
{
- if(user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr.HandleCustomSpell((Player*)user,spellId,this))
+ if (user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr.HandleCustomSpell((Player*)user,spellId,this))
sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u )", spellId,GetEntry(),GetGoType());
else
sLog.outDebug("WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId);
@@ -1503,26 +1503,26 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
bool self = false;
for (uint8 i = 0; i < 3; ++i)
{
- if(spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_CASTER)
+ if (spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_CASTER)
{
self = true;
break;
}
}
- if(self)
+ if (self)
{
- if(target)
+ if (target)
target->CastSpell(target, spellInfo, true);
return;
}
//summon world trigger
Creature *trigger = SummonTrigger(GetPositionX(), GetPositionY(), GetPositionZ(), 0, 1);
- if(!trigger) return;
+ if (!trigger) return;
trigger->SetVisibility(VISIBILITY_OFF); //should this be true?
- if(Unit *owner = GetOwner())
+ if (Unit *owner = GetOwner())
{
trigger->setFaction(owner->getFaction());
trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, owner->GetGUID());
@@ -1573,10 +1573,10 @@ void GameObject::TakenDamage(uint32 damage, Unit *who)
return;
Player* pwho = NULL;
- if(who && who->GetTypeId() == TYPEID_PLAYER)
+ if (who && who->GetTypeId() == TYPEID_PLAYER)
pwho = (Player*)who;
- if(who && who->IsVehicle())
+ if (who && who->IsVehicle())
pwho = (Player*)who->GetCharmerOrOwner();
if (m_goValue->building.health > damage)
@@ -1586,16 +1586,16 @@ void GameObject::TakenDamage(uint32 damage, Unit *who)
if (HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED)) // from damaged to destroyed
{
- if(!m_goValue->building.health)
+ if (!m_goValue->building.health)
{
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED);
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED);
SetUInt32Value(GAMEOBJECT_DISPLAYID, m_goInfo->building.destroyedDisplayId);
EventInform(m_goInfo->building.destroyedEvent);
- if(pwho)
+ if (pwho)
{
- if(BattleGround* bg = pwho->GetBattleGround())
+ if (BattleGround* bg = pwho->GetBattleGround())
bg->EventPlayerDamagedGO(pwho, this, m_goInfo->building.destroyedEvent);
}
}
@@ -1626,7 +1626,7 @@ void GameObject::Rebuild()
void GameObject::EventInform(uint32 eventId)
{
- if(eventId && m_zoneScript)
+ if (eventId && m_zoneScript)
m_zoneScript->ProcessEvent(this, eventId);
}
@@ -1661,7 +1661,7 @@ void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3
m_rotation = rotation;
- if(rotation2 == 0.0f && rotation3 == 0.0f)
+ if (rotation2 == 0.0f && rotation3 == 0.0f)
{
rotation2 = f_rot1;
rotation3 = f_rot2;
diff --git a/src/game/GameObject.h b/src/game/GameObject.h
index 1f914a39006..8b8673a5d61 100644
--- a/src/game/GameObject.h
+++ b/src/game/GameObject.h
@@ -643,7 +643,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
time_t GetRespawnTimeEx() const
{
time_t now = time(NULL);
- if(m_respawnTime > now)
+ if (m_respawnTime > now)
return m_respawnTime;
else
return now;
diff --git a/src/game/GlobalEvents.cpp b/src/game/GlobalEvents.cpp
index defdd96f1f9..9f72e96936c 100644
--- a/src/game/GlobalEvents.cpp
+++ b/src/game/GlobalEvents.cpp
@@ -34,7 +34,7 @@
static void CorpsesEraseCallBack(QueryResult_AutoPtr result, bool bones)
{
- if(!result)
+ if (!result)
return;
do
@@ -51,9 +51,9 @@ static void CorpsesEraseCallBack(QueryResult_AutoPtr result, bool bones)
sLog.outDebug("[Global event] Removing %s %u (X:%f Y:%f Map:%u).",(bones?"bones":"corpse"),guidlow,positionX,positionY,mapid);
/// Resurrectable - convert corpses to bones
- if(!bones)
+ if (!bones)
{
- if(!ObjectAccessor::Instance().ConvertCorpseForPlayer(player_guid))
+ if (!ObjectAccessor::Instance().ConvertCorpseForPlayer(player_guid))
{
sLog.outDebug("Corpse %u not found in world or bones creating forbidden. Delete from DB.",guidlow);
CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow);
diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp
index 9bff0d4eb7e..e15557a486c 100644
--- a/src/game/GossipDef.cpp
+++ b/src/game/GossipDef.cpp
@@ -211,7 +211,7 @@ void PlayerMenu::SendPointOfInterest( float X, float Y, uint32 Icon, uint32 Flag
void PlayerMenu::SendPointOfInterest( uint32 poi_id )
{
PointOfInterest const* poi = objmgr.GetPointOfInterest(poi_id);
- if(!poi)
+ if (!poi)
{
sLog.outErrorDb("Requested send not existed POI (Id: %u), ignore.",poi_id);
return;
@@ -372,7 +372,7 @@ bool QuestMenu::HasItem( uint32 questid )
{
for (QuestMenuItemList::const_iterator i = m_qItems.begin(); i != m_qItems.end(); ++i)
{
- if(i->m_qId==questid)
+ if (i->m_qId==questid)
{
return true;
}
@@ -406,7 +406,7 @@ void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, const std::string& Titl
int loc_idx = pSession->GetSessionDbLocaleIndex();
if (loc_idx >= 0)
{
- if(QuestLocale const *ql = objmgr.GetQuestLocale(questID))
+ if (QuestLocale const *ql = objmgr.GetQuestLocale(questID))
{
if (ql->Title.size() > loc_idx && !ql->Title[loc_idx].empty())
title=ql->Title[loc_idx];
@@ -717,7 +717,7 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID,
uint32 EmoteCount = 0;
for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
- if(pQuest->OfferRewardEmote[i] <= 0)
+ if (pQuest->OfferRewardEmote[i] <= 0)
break;
++EmoteCount;
}
@@ -820,7 +820,7 @@ void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID
data << uint32(0x00); // unknown
- if(Completable)
+ if (Completable)
data << pQuest->GetCompleteEmote();
else
data << pQuest->GetIncompleteEmote();
diff --git a/src/game/GridDefines.h b/src/game/GridDefines.h
index 0357d8ca8ae..e0f2d72277f 100644
--- a/src/game/GridDefines.h
+++ b/src/game/GridDefines.h
@@ -89,7 +89,7 @@ struct CoordPair
void operator<<(const uint32 val)
{
- if( x_coord > val )
+ if ( x_coord > val )
x_coord -= val;
else
x_coord = 0;
@@ -97,7 +97,7 @@ struct CoordPair
void operator>>(const uint32 val)
{
- if( x_coord+val < LIMIT )
+ if ( x_coord+val < LIMIT )
x_coord += val;
else
x_coord = LIMIT - 1;
@@ -105,7 +105,7 @@ struct CoordPair
void operator-=(const uint32 val)
{
- if( y_coord > val )
+ if ( y_coord > val )
y_coord -= val;
else
y_coord = 0;
@@ -113,7 +113,7 @@ struct CoordPair
void operator+=(const uint32 val)
{
- if( y_coord+val < LIMIT )
+ if ( y_coord+val < LIMIT )
y_coord += val;
else
y_coord = LIMIT - 1;
@@ -164,9 +164,9 @@ namespace Trinity
inline void NormalizeMapCoord(float &c)
{
- if(c > MAP_HALFSIZE - 0.5)
+ if (c > MAP_HALFSIZE - 0.5)
c = MAP_HALFSIZE - 0.5;
- else if(c < -(MAP_HALFSIZE - 0.5))
+ else if (c < -(MAP_HALFSIZE - 0.5))
c = -(MAP_HALFSIZE - 0.5);
}
diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp
index 4f26c173d8e..0c4971feb33 100644
--- a/src/game/GridNotifiers.cpp
+++ b/src/game/GridNotifiers.cpp
@@ -39,13 +39,13 @@ VisibleNotifier::SendToSelf()
if (Transport* transport = i_player.GetTransport())
for (Transport::PlayerSet::const_iterator itr = transport->GetPassengers().begin();itr!=transport->GetPassengers().end();++itr)
{
- if(vis_guids.find((*itr)->GetGUID()) != vis_guids.end())
+ if (vis_guids.find((*itr)->GetGUID()) != vis_guids.end())
{
vis_guids.erase((*itr)->GetGUID());
i_player.UpdateVisibilityOf((*itr), i_data, i_visibleNow);
- if(!(*itr)->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
+ if (!(*itr)->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
(*itr)->UpdateVisibilityOf(&i_player);
}
}
@@ -55,15 +55,15 @@ VisibleNotifier::SendToSelf()
i_player.m_clientGUIDs.erase(*it);
i_data.AddOutOfRangeGUID(*it);
- if(IS_PLAYER_GUID(*it))
+ if (IS_PLAYER_GUID(*it))
{
Player* plr = ObjectAccessor::FindPlayer(*it);
- if(plr && plr->IsInWorld() && !plr->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
+ if (plr && plr->IsInWorld() && !plr->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
plr->UpdateVisibilityOf(&i_player);
}
}
- if(!i_data.HasData())
+ if (!i_data.HasData())
return;
WorldPacket packet;
@@ -79,15 +79,15 @@ VisibleChangesNotifier::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
{
- if(iter->getSource() == &i_object)
+ if (iter->getSource() == &i_object)
continue;
iter->getSource()->UpdateVisibilityOf(&i_object);
- if(!iter->getSource()->GetSharedVisionList().empty())
+ if (!iter->getSource()->GetSharedVisionList().empty())
for (SharedVisionList::const_iterator i = iter->getSource()->GetSharedVisionList().begin();
i != iter->getSource()->GetSharedVisionList().end(); ++i)
- if((*i)->m_seer == iter->getSource())
+ if ((*i)->m_seer == iter->getSource())
(*i)->UpdateVisibilityOf(&i_object);
}
}
@@ -96,10 +96,10 @@ void
VisibleChangesNotifier::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
- if(!iter->getSource()->GetSharedVisionList().empty())
+ if (!iter->getSource()->GetSharedVisionList().empty())
for (SharedVisionList::const_iterator i = iter->getSource()->GetSharedVisionList().begin();
i != iter->getSource()->GetSharedVisionList().end(); ++i)
- if((*i)->m_seer == iter->getSource())
+ if ((*i)->m_seer == iter->getSource())
(*i)->UpdateVisibilityOf(&i_object);
}
@@ -107,19 +107,19 @@ void
VisibleChangesNotifier::Visit(DynamicObjectMapType &m)
{
for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
- if(IS_PLAYER_GUID(iter->getSource()->GetCasterGUID()))
- if(Player* caster = (Player*)iter->getSource()->GetCaster())
- if(caster->m_seer == iter->getSource())
+ if (IS_PLAYER_GUID(iter->getSource()->GetCasterGUID()))
+ if (Player* caster = (Player*)iter->getSource()->GetCaster())
+ if (caster->m_seer == iter->getSource())
caster->UpdateVisibilityOf(&i_object);
}
inline void CreatureUnitRelocationWorker(Creature* c, Unit* u)
{
- if(!u->isAlive() || !c->isAlive() || c == u || u->isInFlight())
+ if (!u->isAlive() || !c->isAlive() || c == u || u->isInFlight())
return;
- if(c->HasReactState(REACT_AGGRESSIVE) && !c->hasUnitState(UNIT_STAT_SIGHTLESS))
- if(c->_IsWithinDist(u, c->m_SightDistance, true) && c->IsAIEnabled)
+ if (c->HasReactState(REACT_AGGRESSIVE) && !c->hasUnitState(UNIT_STAT_SIGHTLESS))
+ if (c->_IsWithinDist(u, c->m_SightDistance, true) && c->IsAIEnabled)
c->AI()->MoveInLineOfSight_Safe(u);
}
@@ -163,7 +163,7 @@ void CreatureRelocationNotifier::Visit(PlayerMapType &m)
{
Player * pl = iter->getSource();
- if(!pl->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
+ if (!pl->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
pl->UpdateVisibilityOf(&i_creature);
CreatureUnitRelocationWorker(&i_creature, pl);
@@ -172,7 +172,7 @@ void CreatureRelocationNotifier::Visit(PlayerMapType &m)
void CreatureRelocationNotifier::Visit(CreatureMapType &m)
{
- if(!i_creature.isAlive())
+ if (!i_creature.isAlive())
return;
for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
@@ -180,7 +180,7 @@ void CreatureRelocationNotifier::Visit(CreatureMapType &m)
Creature* c = iter->getSource();
CreatureUnitRelocationWorker(&i_creature, c);
- if(!c->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
+ if (!c->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
CreatureUnitRelocationWorker(c, &i_creature);
}
}
@@ -190,7 +190,7 @@ void DelayedUnitRelocation::Visit(CreatureMapType &m)
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
Creature * unit = iter->getSource();
- if(!unit->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
+ if (!unit->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
continue;
CreatureRelocationNotifier relocate(*unit);
@@ -210,10 +210,10 @@ void DelayedUnitRelocation::Visit(PlayerMapType &m)
Player * player = iter->getSource();
WorldObject const *viewPoint = player->m_seer;
- if(!viewPoint->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
+ if (!viewPoint->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
continue;
- if(player != viewPoint && !viewPoint->IsPositionValid())
+ if (player != viewPoint && !viewPoint->IsPositionValid())
continue;
CellPair pair2(Trinity::ComputeCellPair(viewPoint->GetPositionX(), viewPoint->GetPositionY()));
@@ -237,7 +237,7 @@ void AIRelocationNotifier::Visit(CreatureMapType &m)
{
Creature *c = iter->getSource();
CreatureUnitRelocationWorker(c, &i_unit);
- if(isCreature)
+ if (isCreature)
CreatureUnitRelocationWorker((Creature*)&i_unit, c);
}
}
@@ -248,10 +248,10 @@ MessageDistDeliverer::Visit(PlayerMapType &m)
for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
Player *target = iter->getSource();
- if(!target->InSamePhase(i_phaseMask))
+ if (!target->InSamePhase(i_phaseMask))
continue;
- if(target->GetExactDistSq(i_source) > i_distSq)
+ if (target->GetExactDistSq(i_source) > i_distSq)
continue;
// Send packet to all who are sharing the player's vision
@@ -259,11 +259,11 @@ MessageDistDeliverer::Visit(PlayerMapType &m)
{
SharedVisionList::const_iterator i = target->GetSharedVisionList().begin();
for (; i != target->GetSharedVisionList().end(); ++i)
- if((*i)->m_seer == target)
+ if ((*i)->m_seer == target)
SendPacket(*i);
}
- if(target->m_seer == target || target->GetVehicle())
+ if (target->m_seer == target || target->GetVehicle())
SendPacket(target);
}
}
@@ -273,10 +273,10 @@ MessageDistDeliverer::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
- if(!iter->getSource()->InSamePhase(i_phaseMask))
+ if (!iter->getSource()->InSamePhase(i_phaseMask))
continue;
- if(iter->getSource()->GetExactDistSq(i_source) > i_distSq)
+ if (iter->getSource()->GetExactDistSq(i_source) > i_distSq)
continue;
// Send packet to all who are sharing the creature's vision
@@ -284,7 +284,7 @@ MessageDistDeliverer::Visit(CreatureMapType &m)
{
SharedVisionList::const_iterator i = iter->getSource()->GetSharedVisionList().begin();
for (; i != iter->getSource()->GetSharedVisionList().end(); ++i)
- if((*i)->m_seer == iter->getSource())
+ if ((*i)->m_seer == iter->getSource())
SendPacket(*i);
}
}
@@ -295,10 +295,10 @@ MessageDistDeliverer::Visit(DynamicObjectMapType &m)
{
for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
- if(!iter->getSource()->InSamePhase(i_phaseMask))
+ if (!iter->getSource()->InSamePhase(i_phaseMask))
continue;
- if(iter->getSource()->GetExactDistSq(i_source) > i_distSq)
+ if (iter->getSource()->GetExactDistSq(i_source) > i_distSq)
continue;
if (IS_PLAYER_GUID(iter->getSource()->GetCasterGUID()))
@@ -315,7 +315,7 @@ MessageDistDeliverer::Visit(DynamicObjectMapType &m)
void
MessageDistDeliverer::VisitObject(Player* plr)
{
- if( !i_ownTeamOnly || (i_source.GetTypeId() == TYPEID_PLAYER && plr->GetTeam() == ((Player&)i_source).GetTeam()) )
+ if ( !i_ownTeamOnly || (i_source.GetTypeId() == TYPEID_PLAYER && plr->GetTeam() == ((Player&)i_source).GetTeam()) )
{
SendPacket(plr);
}
@@ -327,7 +327,7 @@ ObjectUpdater::Visit(GridRefManager<T> &m)
{
for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
{
- if(iter->getSource()->IsInWorld())
+ if (iter->getSource()->IsInWorld())
iter->getSource()->Update(i_timeDiff);
}
}
@@ -335,15 +335,15 @@ ObjectUpdater::Visit(GridRefManager<T> &m)
bool CannibalizeObjectCheck::operator()(Corpse* u)
{
// ignore bones
- if(u->GetType()==CORPSE_BONES)
+ if (u->GetType()==CORPSE_BONES)
return false;
Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGUID());
- if( !owner || i_funit->IsFriendlyTo(owner))
+ if ( !owner || i_funit->IsFriendlyTo(owner))
return false;
- if(i_funit->IsWithinDistInMap(u, i_range) )
+ if (i_funit->IsWithinDistInMap(u, i_range) )
return true;
return false;
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h
index 49d2bd38d02..4d73b1d5c0b 100644
--- a/src/game/GridNotifiers.h
+++ b/src/game/GridNotifiers.h
@@ -142,7 +142,7 @@ namespace Trinity
void SendPacket(Player* plr)
{
// never send packet to self
- if(plr == i_source || (team && plr->GetTeam() != team) || skipped_receiver == plr)
+ if (plr == i_source || (team && plr->GetTeam() != team) || skipped_receiver == plr)
return;
plr->GetSession()->SendPacket(i_message);
@@ -213,34 +213,34 @@ namespace Trinity
void Visit(GameObjectMapType &m)
{
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
void Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
void Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
void Visit(CorpseMapType &m)
{
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
void Visit(DynamicObjectMapType &m)
{
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
@@ -408,7 +408,7 @@ namespace Trinity
void Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
@@ -459,7 +459,7 @@ namespace Trinity
void Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
@@ -542,7 +542,7 @@ namespace Trinity
CannibalizeObjectCheck(Unit* funit, float range) : i_funit(funit), i_range(range) {}
bool operator()(Player* u)
{
- if( i_funit->IsFriendlyTo(u) || u->isAlive() || u->isInFlight() )
+ if ( i_funit->IsFriendlyTo(u) || u->isAlive() || u->isInFlight() )
return false;
return i_funit->IsWithinDistInMap(u, i_range);
@@ -582,10 +582,10 @@ namespace Trinity
GameObjectFocusCheck(Unit const* unit,uint32 focusId) : i_unit(unit), i_focusId(focusId) {}
bool operator()(GameObject* go) const
{
- if(go->GetGOInfo()->type != GAMEOBJECT_TYPE_SPELL_FOCUS)
+ if (go->GetGOInfo()->type != GAMEOBJECT_TYPE_SPELL_FOCUS)
return false;
- if(go->GetGOInfo()->spellFocus.focusId != i_focusId)
+ if (go->GetGOInfo()->spellFocus.focusId != i_focusId)
return false;
float dist = (go->GetGOInfo()->spellFocus.dist)/2;
@@ -604,7 +604,7 @@ namespace Trinity
NearestGameObjectFishingHole(WorldObject const& obj, float range) : i_obj(obj), i_range(range) {}
bool operator()(GameObject* go)
{
- if(go->GetGOInfo()->type == GAMEOBJECT_TYPE_FISHINGHOLE && go->isSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, go->GetGOInfo()->fishinghole.radius))
+ if (go->GetGOInfo()->type == GAMEOBJECT_TYPE_FISHINGHOLE && go->isSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, go->GetGOInfo()->fishinghole.radius))
{
i_range = i_obj.GetDistance(go);
return true;
@@ -626,7 +626,7 @@ namespace Trinity
NearestGameObjectCheck(WorldObject const& obj) : i_obj(obj), i_range(999) {}
bool operator()(GameObject* go)
{
- if(i_obj.IsWithinDistInMap(go, i_range))
+ if (i_obj.IsWithinDistInMap(go, i_range))
{
i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
return true;
@@ -649,7 +649,7 @@ namespace Trinity
NearestGameObjectEntryInObjectRangeCheck(WorldObject const& obj,uint32 entry, float range) : i_obj(obj), i_entry(entry), i_range(range) {}
bool operator()(GameObject* go)
{
- if(go->GetEntry() == i_entry && i_obj.IsWithinDistInMap(go, i_range))
+ if (go->GetEntry() == i_entry && i_obj.IsWithinDistInMap(go, i_range))
{
i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
return true;
@@ -687,7 +687,7 @@ namespace Trinity
MostHPMissingInRange(Unit const* obj, float range, uint32 hp) : i_obj(obj), i_range(range), i_hp(hp) {}
bool operator()(Unit* u)
{
- if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
+ if (u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
{
i_hp = u->GetMaxHealth() - u->GetHealth();
return true;
@@ -706,7 +706,7 @@ namespace Trinity
FriendlyCCedInRange(Unit const* obj, float range) : i_obj(obj), i_range(range) {}
bool operator()(Unit* u)
{
- if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
+ if (u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
(u->isFeared() || u->isCharmed() || u->isFrozen() || u->hasUnitState(UNIT_STAT_STUNNED) || u->hasUnitState(UNIT_STAT_CONFUSED)))
{
return true;
@@ -724,7 +724,7 @@ namespace Trinity
FriendlyMissingBuffInRange(Unit const* obj, float range, uint32 spellid) : i_obj(obj), i_range(range), i_spell(spellid) {}
bool operator()(Unit* u)
{
- if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
+ if (u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
!(u->HasAura(i_spell)))
{
return true;
@@ -743,7 +743,7 @@ namespace Trinity
AnyUnfriendlyUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) {}
bool operator()(Unit* u)
{
- if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u))
+ if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u))
return true;
else
return false;
@@ -760,10 +760,10 @@ namespace Trinity
AnyUnfriendlyNoTotemUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) {}
bool operator()(Unit* u)
{
- if(!u->isAlive())
+ if (!u->isAlive())
return false;
- if(u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
+ if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
return false;
return i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u);
@@ -812,7 +812,7 @@ namespace Trinity
AnyFriendlyUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) {}
bool operator()(Unit* u)
{
- if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsFriendlyTo(u))
+ if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsFriendlyTo(u))
return true;
else
return false;
@@ -829,7 +829,7 @@ namespace Trinity
AnyUnitInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {}
bool operator()(Unit* u)
{
- if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range))
+ if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range))
return true;
return false;
@@ -846,7 +846,7 @@ namespace Trinity
NearestAttackableUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) {}
bool operator()(Unit* u)
{
- if( u->isTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) &&
+ if ( u->isTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) &&
!i_funit->IsFriendlyTo(u) && u->isVisibleForOrDetect(i_funit,false) )
{
i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
@@ -872,7 +872,7 @@ namespace Trinity
{
Unit const* check = i_funit;
Unit const* owner = i_funit->GetOwner();
- if(owner)
+ if (owner)
check = owner;
i_targetForPlayer = ( check->GetTypeId() == TYPEID_PLAYER );
}
@@ -881,10 +881,10 @@ namespace Trinity
// Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems
if (!u->isTargetableForAttack())
return false;
- if(u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
+ if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
return false;
- if(( i_targetForPlayer ? !i_funit->IsFriendlyTo(u) : i_funit->IsHostileTo(u) )&& i_obj->IsWithinDistInMap(u, i_range))
+ if (( i_targetForPlayer ? !i_funit->IsFriendlyTo(u) : i_funit->IsHostileTo(u) )&& i_obj->IsWithinDistInMap(u, i_range))
return true;
return false;
@@ -951,17 +951,17 @@ namespace Trinity
bool operator()(Unit* u)
{
// TODO: addthreat for every enemy in range?
- if(!m_creature->IsWithinDistInMap(u, m_range))
+ if (!m_creature->IsWithinDistInMap(u, m_range))
return false;
- if(m_force)
+ if (m_force)
{
- if(!m_creature->canAttack(u))
+ if (!m_creature->canAttack(u))
return false;
}
else
{
- if(!m_creature->canStartAttack(u, false))
+ if (!m_creature->canStartAttack(u, false))
return false;
}
@@ -985,18 +985,18 @@ namespace Trinity
}
bool operator()(Creature* u)
{
- if(u == i_funit)
+ if (u == i_funit)
return false;
if ( !u->CanAssistTo(i_funit, i_enemy) )
return false;
// too far
- if( !i_funit->IsWithinDistInMap(u, i_range) )
+ if ( !i_funit->IsWithinDistInMap(u, i_range) )
return false;
// only if see assisted creature
- if( !i_funit->IsWithinLOSInMap(u) )
+ if ( !i_funit->IsWithinLOSInMap(u) )
return false;
return true;
@@ -1015,15 +1015,15 @@ namespace Trinity
bool operator()(Creature* u)
{
- if(u == i_obj)
+ if (u == i_obj)
return false;
- if(!u->CanAssistTo(i_obj,i_enemy))
+ if (!u->CanAssistTo(i_obj,i_enemy))
return false;
- if(!i_obj->IsWithinDistInMap(u, i_range))
+ if (!i_obj->IsWithinDistInMap(u, i_range))
return false;
- if(!i_obj->IsWithinLOSInMap(u))
+ if (!i_obj->IsWithinLOSInMap(u))
return false;
i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
@@ -1072,7 +1072,7 @@ namespace Trinity
AnyPlayerInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {}
bool operator()(Player* u)
{
- if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range))
+ if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range))
return true;
return false;
@@ -1088,7 +1088,7 @@ namespace Trinity
AllFriendlyCreaturesInGrid(Unit const* obj) : pUnit(obj) {}
bool operator() (Unit* u)
{
- if(u->isAlive() && u->GetVisibility() == VISIBILITY_ON && u->IsFriendlyTo(pUnit))
+ if (u->isAlive() && u->GetVisibility() == VISIBILITY_ON && u->IsFriendlyTo(pUnit))
return true;
return false;
diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h
index a9a7e9f031f..1765ed381fe 100644
--- a/src/game/GridNotifiersImpl.h
+++ b/src/game/GridNotifiersImpl.h
@@ -45,7 +45,7 @@ inline void
Trinity::ObjectUpdater::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
- if(iter->getSource()->IsInWorld() && !iter->getSource()->isSpiritService())
+ if (iter->getSource()->IsInWorld() && !iter->getSource()->isSpiritService())
iter->getSource()->Update(i_timeDiff);
}
@@ -57,12 +57,12 @@ template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(GameObjectMapType &m)
{
// already found
- if(i_object)
+ if (i_object)
return;
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if(!itr->getSource()->InSamePhase(i_phaseMask))
+ if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if (i_check(itr->getSource()))
@@ -77,15 +77,15 @@ template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(PlayerMapType &m)
{
// already found
- if(i_object)
+ if (i_object)
return;
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if(!itr->getSource()->InSamePhase(i_phaseMask))
+ if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
- if(i_check(itr->getSource()))
+ if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -97,15 +97,15 @@ template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(CreatureMapType &m)
{
// already found
- if(i_object)
+ if (i_object)
return;
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if(!itr->getSource()->InSamePhase(i_phaseMask))
+ if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
- if(i_check(itr->getSource()))
+ if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -117,15 +117,15 @@ template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(CorpseMapType &m)
{
// already found
- if(i_object)
+ if (i_object)
return;
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if(!itr->getSource()->InSamePhase(i_phaseMask))
+ if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
- if(i_check(itr->getSource()))
+ if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -137,15 +137,15 @@ template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType &m)
{
// already found
- if(i_object)
+ if (i_object)
return;
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if(!itr->getSource()->InSamePhase(i_phaseMask))
+ if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
- if(i_check(itr->getSource()))
+ if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -157,8 +157,8 @@ template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
- if(i_check(itr->getSource()))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
+ if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -166,8 +166,8 @@ template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
- if(i_check(itr->getSource()))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
+ if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -175,8 +175,8 @@ template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(CorpseMapType &m)
{
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
- if(i_check(itr->getSource()))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
+ if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -184,8 +184,8 @@ template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(GameObjectMapType &m)
{
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
- if(i_check(itr->getSource()))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
+ if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -193,8 +193,8 @@ template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType &m)
{
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
- if(i_check(itr->getSource()))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
+ if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -204,15 +204,15 @@ template<class Check>
void Trinity::GameObjectSearcher<Check>::Visit(GameObjectMapType &m)
{
// already found
- if(i_object)
+ if (i_object)
return;
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if(!itr->getSource()->InSamePhase(i_phaseMask))
+ if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
- if(i_check(itr->getSource()))
+ if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -225,10 +225,10 @@ void Trinity::GameObjectLastSearcher<Check>::Visit(GameObjectMapType &m)
{
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if(!itr->getSource()->InSamePhase(i_phaseMask))
+ if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
- if(i_check(itr->getSource()))
+ if (i_check(itr->getSource()))
i_object = itr->getSource();
}
}
@@ -237,8 +237,8 @@ template<class Check>
void Trinity::GameObjectListSearcher<Check>::Visit(GameObjectMapType &m)
{
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
- if(i_check(itr->getSource()))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
+ if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -248,15 +248,15 @@ template<class Check>
void Trinity::UnitSearcher<Check>::Visit(CreatureMapType &m)
{
// already found
- if(i_object)
+ if (i_object)
return;
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if(!itr->getSource()->InSamePhase(i_phaseMask))
+ if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
- if(i_check(itr->getSource()))
+ if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -268,15 +268,15 @@ template<class Check>
void Trinity::UnitSearcher<Check>::Visit(PlayerMapType &m)
{
// already found
- if(i_object)
+ if (i_object)
return;
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if(!itr->getSource()->InSamePhase(i_phaseMask))
+ if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
- if(i_check(itr->getSource()))
+ if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -289,10 +289,10 @@ void Trinity::UnitLastSearcher<Check>::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if(!itr->getSource()->InSamePhase(i_phaseMask))
+ if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
- if(i_check(itr->getSource()))
+ if (i_check(itr->getSource()))
i_object = itr->getSource();
}
}
@@ -302,10 +302,10 @@ void Trinity::UnitLastSearcher<Check>::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if(!itr->getSource()->InSamePhase(i_phaseMask))
+ if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
- if(i_check(itr->getSource()))
+ if (i_check(itr->getSource()))
i_object = itr->getSource();
}
}
@@ -314,8 +314,8 @@ template<class Check>
void Trinity::UnitListSearcher<Check>::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
- if(i_check(itr->getSource()))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
+ if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -323,8 +323,8 @@ template<class Check>
void Trinity::UnitListSearcher<Check>::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
- if(i_check(itr->getSource()))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
+ if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -334,15 +334,15 @@ template<class Check>
void Trinity::CreatureSearcher<Check>::Visit(CreatureMapType &m)
{
// already found
- if(i_object)
+ if (i_object)
return;
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if(!itr->getSource()->InSamePhase(i_phaseMask))
+ if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
- if(i_check(itr->getSource()))
+ if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -355,10 +355,10 @@ void Trinity::CreatureLastSearcher<Check>::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if(!itr->getSource()->InSamePhase(i_phaseMask))
+ if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
- if(i_check(itr->getSource()))
+ if (i_check(itr->getSource()))
i_object = itr->getSource();
}
}
@@ -367,8 +367,8 @@ template<class Check>
void Trinity::CreatureListSearcher<Check>::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
- if( i_check(itr->getSource()))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
+ if ( i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -376,8 +376,8 @@ template<class Check>
void Trinity::PlayerListSearcher<Check>::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if(itr->getSource()->InSamePhase(i_phaseMask))
- if( i_check(itr->getSource()))
+ if (itr->getSource()->InSamePhase(i_phaseMask))
+ if ( i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -385,15 +385,15 @@ template<class Check>
void Trinity::PlayerSearcher<Check>::Visit(PlayerMapType &m)
{
// already found
- if(i_object)
+ if (i_object)
return;
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if(!itr->getSource()->InSamePhase(i_phaseMask))
+ if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
- if(i_check(itr->getSource()))
+ if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -409,9 +409,9 @@ void Trinity::LocalizedPacketDo<Builder>::operator()( Player* p )
WorldPacket* data;
// create if not cached yet
- if(i_data_cache.size() < cache_idx+1 || !i_data_cache[cache_idx])
+ if (i_data_cache.size() < cache_idx+1 || !i_data_cache[cache_idx])
{
- if(i_data_cache.size() < cache_idx+1)
+ if (i_data_cache.size() < cache_idx+1)
i_data_cache.resize(cache_idx+1);
data = new WorldPacket(SMSG_MESSAGECHAT, 200);
@@ -434,9 +434,9 @@ void Trinity::LocalizedPacketListDo<Builder>::operator()( Player* p )
WorldPacketList* data_list;
// create if not cached yet
- if(i_data_cache.size() < cache_idx+1 || i_data_cache[cache_idx].empty())
+ if (i_data_cache.size() < cache_idx+1 || i_data_cache[cache_idx].empty())
{
- if(i_data_cache.size() < cache_idx+1)
+ if (i_data_cache.size() < cache_idx+1)
i_data_cache.resize(cache_idx+1);
data_list = &i_data_cache[cache_idx];
diff --git a/src/game/GridStates.cpp b/src/game/GridStates.cpp
index 9ce41672027..94a1393bfa1 100644
--- a/src/game/GridStates.cpp
+++ b/src/game/GridStates.cpp
@@ -33,9 +33,9 @@ ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 &x, c
{
// Only check grid activity every (grid_expiry/10) ms, because it's really useless to do it every cycle
info.UpdateTimeTracker(t_diff);
- if( info.getTimeTracker().Passed() )
+ if ( info.getTimeTracker().Passed() )
{
- if( grid.ActiveObjectsInGrid() == 0 && !m.ActiveObjectsNearGrid(x, y) )
+ if ( grid.ActiveObjectsInGrid() == 0 && !m.ActiveObjectsNearGrid(x, y) )
{
ObjectGridStoper stoper(grid);
stoper.StopN();
@@ -60,12 +60,12 @@ IdleState::Update(Map &m, NGridType &grid, GridInfo &, const uint32 &x, const ui
void
RemovalState::Update(Map &m, NGridType &grid, GridInfo &info, const uint32 &x, const uint32 &y, const uint32 &t_diff) const
{
- if(!info.getUnloadLock())
+ if (!info.getUnloadLock())
{
info.UpdateTimeTracker(t_diff);
- if( info.getTimeTracker().Passed() )
+ if ( info.getTimeTracker().Passed() )
{
- if( !m.UnloadGrid(x, y, false) )
+ if ( !m.UnloadGrid(x, y, false) )
{
sLog.outDebug("Grid[%u,%u] for map %u differed unloading due to players or active objects nearby", x, y, m.GetId());
m.ResetGridExpiry(grid);
diff --git a/src/game/GridStates.h b/src/game/GridStates.h
index 5bcc041ef5c..c2a75ec45b7 100644
--- a/src/game/GridStates.h
+++ b/src/game/GridStates.h
@@ -32,7 +32,7 @@ class GridState
GridState() { i_Magic = MAGIC_TESTVAL; }
bool checkMagic()
{
- if(i_Magic != MAGIC_TESTVAL)
+ if (i_Magic != MAGIC_TESTVAL)
{
sLog.outError("!!! GridState: Magic value gone !!!");
return false;
diff --git a/src/game/Group.cpp b/src/game/Group.cpp
index d1aff29b218..968c9edcca1 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp
@@ -50,11 +50,11 @@ Group::Group()
Group::~Group()
{
- if(m_bgGroup)
+ if (m_bgGroup)
{
sLog.outDebug("Group::~Group: battleground group being deleted.");
- if(m_bgGroup->GetBgRaid(ALLIANCE) == this) m_bgGroup->SetBgRaid(ALLIANCE, NULL);
- else if(m_bgGroup->GetBgRaid(HORDE) == this) m_bgGroup->SetBgRaid(HORDE, NULL);
+ if (m_bgGroup->GetBgRaid(ALLIANCE) == this) m_bgGroup->SetBgRaid(ALLIANCE, NULL);
+ else if (m_bgGroup->GetBgRaid(HORDE) == this) m_bgGroup->SetBgRaid(HORDE, NULL);
else sLog.outError("Group::~Group: battleground group is not linked to the correct battleground.");
}
Rolls::iterator itr;
@@ -94,10 +94,10 @@ bool Group::Create(const uint64 &guid, const char * name)
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
- if(!isBGGroup())
+ if (!isBGGroup())
{
Player *leader = objmgr.GetPlayer(guid);
- if(leader)
+ if (leader)
{
m_dungeonDifficulty = leader->GetDungeonDifficulty();
m_raidDifficulty = leader->GetRaidDifficulty();
@@ -115,33 +115,33 @@ bool Group::Create(const uint64 &guid, const char * name)
GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], isRaidGroup(), uint32(m_dungeonDifficulty), m_raidDifficulty);
}
- if(!AddMember(guid, name))
+ if (!AddMember(guid, name))
return false;
- if(!isBGGroup()) CharacterDatabase.CommitTransaction();
+ if (!isBGGroup()) CharacterDatabase.CommitTransaction();
return true;
}
bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult_AutoPtr result, bool loadMembers)
{
- if(isBGGroup())
+ if (isBGGroup())
return false;
bool external = true;
- if(!result)
+ if (!result)
{
external = false;
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13
result = CharacterDatabase.PQuery("SELECT lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty FROM groups WHERE leaderGuid ='%u'", GUID_LOPART(leaderGuid));
- if(!result)
+ if (!result)
return false;
}
m_leaderGuid = leaderGuid;
// group leader not exist
- if(!objmgr.GetPlayerNameByGUID(m_leaderGuid, m_leaderName))
+ if (!objmgr.GetPlayerNameByGUID(m_leaderGuid, m_leaderName))
return false;
m_groupType = (*result)[11].GetBool() ? GROUPTYPE_RAID : GROUPTYPE_NORMAL;
@@ -166,10 +166,10 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult_AutoPtr result
for (int i=0; i<TARGETICONCOUNT; ++i)
m_targetIcons[i] = (*result)[3+i].GetUInt64();
- if(loadMembers)
+ if (loadMembers)
{
result = CharacterDatabase.PQuery("SELECT memberGuid, memberFlags, subgroup FROM group_member WHERE leaderGuid ='%u'", GUID_LOPART(leaderGuid));
- if(!result)
+ if (!result)
return false;
do
@@ -177,7 +177,7 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult_AutoPtr result
LoadMemberFromDB((*result)[0].GetUInt32(), (*result)[1].GetUInt8(), (*result)[2].GetUInt8());
} while ( result->NextRow() );
// group too small
- if(GetMembersCount() < 2)
+ if (GetMembersCount() < 2)
return false;
}
@@ -190,7 +190,7 @@ bool Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup)
member.guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
// skip non-existed member
- if(!objmgr.GetPlayerNameByGUID(member.guid, member.name))
+ if (!objmgr.GetPlayerNameByGUID(member.guid, member.name))
return false;
member.group = subgroup;
@@ -209,24 +209,24 @@ void Group::ConvertToRaid()
_initRaidSubGroupsCounter();
- if(!isBGGroup())
+ if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE groups SET isRaid = 1 WHERE leaderGuid='%u'", GUID_LOPART(m_leaderGuid));
SendUpdate();
// update quest related GO states (quest activity dependent from raid membership)
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
- if(Player* player = objmgr.GetPlayer(citr->guid))
+ if (Player* player = objmgr.GetPlayer(citr->guid))
player->UpdateForQuestWorldObjects();
}
bool Group::AddInvite(Player *player)
{
- if( !player || player->GetGroupInvite() )
+ if ( !player || player->GetGroupInvite() )
return false;
Group* group = player->GetGroup();
- if( group && group->isBGGroup() )
+ if ( group && group->isBGGroup() )
group = player->GetOriginalGroup();
- if( group )
+ if ( group )
return false;
RemoveInvite(player);
@@ -240,7 +240,7 @@ bool Group::AddInvite(Player *player)
bool Group::AddLeaderInvite(Player *player)
{
- if(!AddInvite(player))
+ if (!AddInvite(player))
return false;
m_leaderGuid = player->GetGUID();
@@ -268,7 +268,7 @@ Player* Group::GetInvited(const uint64& guid) const
{
for (InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
{
- if((*itr)->GetGUID() == guid)
+ if ((*itr)->GetGUID() == guid)
return (*itr);
}
return NULL;
@@ -278,7 +278,7 @@ Player* Group::GetInvited(const std::string& name) const
{
for (InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
{
- if((*itr)->GetName() == name)
+ if ((*itr)->GetName() == name)
return (*itr);
}
return NULL;
@@ -286,14 +286,14 @@ Player* Group::GetInvited(const std::string& name) const
bool Group::AddMember(const uint64 &guid, const char* name)
{
- if(!_addMember(guid, name))
+ if (!_addMember(guid, name))
return false;
SendUpdate();
Player *player = objmgr.GetPlayer(guid);
- if(player)
+ if (player)
{
- if(!IsLeader(player->GetGUID()) && !isBGGroup())
+ if (!IsLeader(player->GetGUID()) && !isBGGroup())
{
// reset the new member's instances, unless he is currently in one of them
// including raid/heroic instances that they are not permanently bound to!
@@ -318,7 +318,7 @@ bool Group::AddMember(const uint64 &guid, const char* name)
UpdatePlayerOutOfRange(player);
// quest related GO state dependent from raid memebership
- if(isRaidGroup())
+ if (isRaidGroup())
player->UpdateForQuestWorldObjects();
}
@@ -330,26 +330,26 @@ uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
BroadcastGroupUpdate();
// remove member and change leader (if need) only if strong more 2 members _before_ member remove
- if(GetMembersCount() > (isBGGroup() ? 1 : 2)) // in BG group case allow 1 members group
+ if (GetMembersCount() > (isBGGroup() ? 1 : 2)) // in BG group case allow 1 members group
{
bool leaderChanged = _removeMember(guid);
- if(Player *player = objmgr.GetPlayer( guid ))
+ if (Player *player = objmgr.GetPlayer( guid ))
{
// quest related GO state dependent from raid membership
- if(isRaidGroup())
+ if (isRaidGroup())
player->UpdateForQuestWorldObjects();
WorldPacket data;
- if(method == 1)
+ if (method == 1)
{
data.Initialize( SMSG_GROUP_UNINVITE, 0 );
player->GetSession()->SendPacket( &data );
}
//we already removed player from group and in player->GetGroup() is his original group!
- if( Group* group = player->GetGroup() )
+ if ( Group* group = player->GetGroup() )
{
group->SendUpdate();
}
@@ -364,7 +364,7 @@ uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
_homebindIfInstance(player);
}
- if(leaderChanged)
+ if (leaderChanged)
{
WorldPacket data(SMSG_GROUP_SET_LEADER, (m_memberSlots.front().name.size()+1));
data << m_memberSlots.front().name;
@@ -384,7 +384,7 @@ void Group::ChangeLeader(const uint64 &guid)
{
member_citerator slot = _getMemberCSlot(guid);
- if(slot==m_memberSlots.end())
+ if (slot==m_memberSlots.end())
return;
_setLeader(guid);
@@ -402,38 +402,38 @@ void Group::Disband(bool hideDestroy)
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
{
player = objmgr.GetPlayer(citr->guid);
- if(!player)
+ if (!player)
continue;
//we cannot call _removeMember because it would invalidate member iterator
//if we are removing player from battleground raid
- if( isBGGroup() )
+ if ( isBGGroup() )
player->RemoveFromBattleGroundRaid();
else
{
//we can remove player who is in battleground from his original group
- if( player->GetOriginalGroup() == this )
+ if ( player->GetOriginalGroup() == this )
player->SetOriginalGroup(NULL);
else
player->SetGroup(NULL);
}
// quest related GO state dependent from raid membership
- if(isRaidGroup())
+ if (isRaidGroup())
player->UpdateForQuestWorldObjects();
- if(!player->GetSession())
+ if (!player->GetSession())
continue;
WorldPacket data;
- if(!hideDestroy)
+ if (!hideDestroy)
{
data.Initialize(SMSG_GROUP_DESTROYED, 0);
player->GetSession()->SendPacket(&data);
}
//we already removed player from group and in player->GetGroup() is his original group, send update
- if( Group* group = player->GetGroup() )
+ if ( Group* group = player->GetGroup() )
{
group->SendUpdate();
}
@@ -452,7 +452,7 @@ void Group::Disband(bool hideDestroy)
RemoveAllInvites();
- if(!isBGGroup())
+ if (!isBGGroup())
{
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM groups WHERE leaderGuid='%u'", GUID_LOPART(m_leaderGuid));
@@ -485,10 +485,10 @@ void Group::SendLootStartRoll(uint32 CountDown, const Roll &r)
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr)
{
Player *p = objmgr.GetPlayer(itr->first);
- if(!p || !p->GetSession())
+ if (!p || !p->GetSession())
continue;
- if(itr->second != NOT_VALID)
+ if (itr->second != NOT_VALID)
p->GetSession()->SendPacket( &data );
}
}
@@ -509,10 +509,10 @@ void Group::SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uin
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr)
{
Player *p = objmgr.GetPlayer(itr->first);
- if(!p || !p->GetSession())
+ if (!p || !p->GetSession())
continue;
- if(itr->second != NOT_VALID)
+ if (itr->second != NOT_VALID)
p->GetSession()->SendPacket( &data );
}
}
@@ -532,10 +532,10 @@ void Group::SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid,
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr)
{
Player *p = objmgr.GetPlayer(itr->first);
- if(!p || !p->GetSession())
+ if (!p || !p->GetSession())
continue;
- if(itr->second != NOT_VALID)
+ if (itr->second != NOT_VALID)
p->GetSession()->SendPacket( &data );
}
}
@@ -552,10 +552,10 @@ void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r)
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr)
{
Player *p = objmgr.GetPlayer(itr->first);
- if(!p || !p->GetSession())
+ if (!p || !p->GetSession())
continue;
- if(itr->second != NOT_VALID)
+ if (itr->second != NOT_VALID)
p->GetSession()->SendPacket( &data );
}
}
@@ -907,7 +907,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
player->SendEquipError(msg, NULL, NULL);
}
}
- else if(rollvote == DISENCHANT)
+ else if (rollvote == DISENCHANT)
{
item->is_looted = true;
roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
@@ -933,13 +933,13 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
void Group::SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid)
{
- if(id >= TARGETICONCOUNT)
+ if (id >= TARGETICONCOUNT)
return;
// clean other icons
- if( targetGuid != 0 )
+ if ( targetGuid != 0 )
for (int i=0; i<TARGETICONCOUNT; ++i)
- if( m_targetIcons[i] == targetGuid )
+ if ( m_targetIcons[i] == targetGuid )
SetTargetIcon(i, 0, 0);
m_targetIcons[id] = targetGuid;
@@ -957,19 +957,19 @@ void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_lev
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* member = itr->getSource();
- if(!member || !member->isAlive()) // only for alive
+ if (!member || !member->isAlive()) // only for alive
continue;
- if(!member->IsAtGroupRewardDistance(victim)) // at req. distance
+ if (!member->IsAtGroupRewardDistance(victim)) // at req. distance
continue;
++count;
sum_level += member->getLevel();
- if(!member_with_max_level || member_with_max_level->getLevel() < member->getLevel())
+ if (!member_with_max_level || member_with_max_level->getLevel() < member->getLevel())
member_with_max_level = member;
uint32 gray_level = Trinity::XP::GetGrayLevel(member->getLevel());
- if( victim->getLevel() > gray_level && (!not_gray_member_with_max_level
+ if ( victim->getLevel() > gray_level && (!not_gray_member_with_max_level
|| not_gray_member_with_max_level->getLevel() < member->getLevel()))
not_gray_member_with_max_level = member;
}
@@ -977,7 +977,7 @@ void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_lev
void Group::SendTargetIconList(WorldSession *session)
{
- if(!session)
+ if (!session)
return;
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+TARGETICONCOUNT*9));
@@ -985,7 +985,7 @@ void Group::SendTargetIconList(WorldSession *session)
for (int i=0; i<TARGETICONCOUNT; ++i)
{
- if(m_targetIcons[i] == 0)
+ if (m_targetIcons[i] == 0)
continue;
data << uint8(i);
@@ -1049,7 +1049,7 @@ void Group::SendUpdate()
void Group::UpdatePlayerOutOfRange(Player* pPlayer)
{
- if(!pPlayer || !pPlayer->IsInWorld())
+ if (!pPlayer || !pPlayer->IsInWorld())
return;
Player *player;
@@ -1069,7 +1069,7 @@ void Group::BroadcastPacket(WorldPacket *packet, bool ignorePlayersInBGRaid, int
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *pl = itr->getSource();
- if(!pl || (ignore != 0 && pl->GetGUID() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this) )
+ if (!pl || (ignore != 0 && pl->GetGUID() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this) )
continue;
if (pl->GetSession() && (group==-1 || itr->getSubGroup()==group))
@@ -1082,8 +1082,8 @@ void Group::BroadcastReadyCheck(WorldPacket *packet)
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *pl = itr->getSource();
- if(pl && pl->GetSession())
- if(IsLeader(pl->GetGUID()) || IsAssistant(pl->GetGUID()))
+ if (pl && pl->GetSession())
+ if (IsLeader(pl->GetGUID()) || IsAssistant(pl->GetGUID()))
pl->GetSession()->SendPacket(packet);
}
}
@@ -1128,10 +1128,10 @@ bool Group::_addMember(const uint64 &guid, const char* name)
bool Group::_addMember(const uint64 &guid, const char* name, uint8 group)
{
- if(IsFull())
+ if (IsFull())
return false;
- if(!guid)
+ if (!guid)
return false;
Player *player = objmgr.GetPlayer(guid);
@@ -1145,11 +1145,11 @@ bool Group::_addMember(const uint64 &guid, const char* name, uint8 group)
SubGroupCounterIncrease(group);
- if(player)
+ if (player)
{
player->SetGroupInvite(NULL);
//if player is in group and he is being added to BG raid group, then call SetBattleGroundRaid()
- if( player->GetGroup() && isBGGroup() )
+ if ( player->GetGroup() && isBGGroup() )
player->SetBattleGroundRaid(this, group);
//if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
else if ( player->GetGroup() )
@@ -1159,17 +1159,17 @@ bool Group::_addMember(const uint64 &guid, const char* name, uint8 group)
player->SetGroup(this, group);
// if the same group invites the player back, cancel the homebind timer
InstanceGroupBind *bind = GetBoundInstance(player);
- if(bind && bind->save->GetInstanceId() == player->GetInstanceId())
+ if (bind && bind->save->GetInstanceId() == player->GetInstanceId())
player->m_InstanceValid = true;
}
- if(!isRaidGroup()) // reset targetIcons for non-raid-groups
+ if (!isRaidGroup()) // reset targetIcons for non-raid-groups
{
for (int i=0; i<TARGETICONCOUNT; ++i)
m_targetIcons[i] = 0;
}
- if(!isBGGroup())
+ if (!isBGGroup())
{
// insert into group table
CharacterDatabase.PExecute("INSERT INTO group_member(leaderGuid,memberGuid,memberFlags,subgroup) VALUES('%u','%u','%u','%u')", GUID_LOPART(m_leaderGuid), GUID_LOPART(member.guid), member.flags, member.group);
@@ -1184,12 +1184,12 @@ bool Group::_removeMember(const uint64 &guid)
if (player)
{
//if we are removing player from battleground raid
- if( isBGGroup() )
+ if ( isBGGroup() )
player->RemoveFromBattleGroundRaid();
else
{
//we can remove player who is in battleground from his original group
- if( player->GetOriginalGroup() == this )
+ if ( player->GetOriginalGroup() == this )
player->SetOriginalGroup(NULL);
else
player->SetGroup(NULL);
@@ -1206,12 +1206,12 @@ bool Group::_removeMember(const uint64 &guid)
m_memberSlots.erase(slot);
}
- if(!isBGGroup())
+ if (!isBGGroup())
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid='%u'", GUID_LOPART(guid));
- if(m_leaderGuid == guid) // leader was removed
+ if (m_leaderGuid == guid) // leader was removed
{
- if(GetMembersCount() > 0)
+ if (GetMembersCount() > 0)
_setLeader(m_memberSlots.front().guid);
return true;
}
@@ -1222,10 +1222,10 @@ bool Group::_removeMember(const uint64 &guid)
void Group::_setLeader(const uint64 &guid)
{
member_witerator slot = _getMemberWSlot(guid);
- if(slot==m_memberSlots.end())
+ if (slot==m_memberSlots.end())
return;
- if(!isBGGroup())
+ if (!isBGGroup())
{
// TODO: set a time limit to have this function run rarely cause it can be slow
CharacterDatabase.BeginTransaction();
@@ -1242,13 +1242,13 @@ void Group::_setLeader(const uint64 &guid)
);
Player *player = objmgr.GetPlayer(slot->guid);
- if(player)
+ if (player)
{
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end();)
{
- if(itr->second.perm)
+ if (itr->second.perm)
{
itr->second.save->RemoveGroup(this);
m_boundInstances[i].erase(itr++);
@@ -1284,7 +1284,7 @@ void Group::_removeRolls(const uint64 &guid)
{
Roll* roll = *it;
Roll::PlayerVote::iterator itr2 = roll->playerVote.find(guid);
- if(itr2 == roll->playerVote.end())
+ if (itr2 == roll->playerVote.end())
continue;
if (itr2->second == GREED || itr2->second == DISENCHANT) --roll->totalGreed;
@@ -1301,14 +1301,14 @@ void Group::_removeRolls(const uint64 &guid)
bool Group::_setMembersGroup(const uint64 &guid, const uint8 &group)
{
member_witerator slot = _getMemberWSlot(guid);
- if(slot==m_memberSlots.end())
+ if (slot==m_memberSlots.end())
return false;
slot->group = group;
SubGroupCounterIncrease(group);
- if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid));
+ if (!isBGGroup()) CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid));
return true;
}
@@ -1321,7 +1321,7 @@ bool Group::_setAssistantFlag(const uint64 &guid, const bool &apply)
ToggleGroupMemberFlag(slot, MEMBER_FLAG_ASSISTANT, apply);
- if(!isBGGroup())
+ if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE group_member SET memberFlags='%u' WHERE memberGuid='%u'", slot->flags, GUID_LOPART(guid));
return true;
}
@@ -1335,7 +1335,7 @@ bool Group::_setMainTank(const uint64 &guid, const bool &apply)
RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINTANK); // Remove main tank flag from current if any.
ToggleGroupMemberFlag(slot, MEMBER_FLAG_MAINTANK, apply); // And apply main tank flag on new main tank.
- if(!isBGGroup())
+ if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE group_member SET memberFlags='%u' WHERE memberGuid='%u'", slot->flags, GUID_LOPART(guid));
return true;
}
@@ -1349,14 +1349,14 @@ bool Group::_setMainAssistant(const uint64 &guid, const bool &apply)
RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINASSIST); // Remove main assist flag from current if any.
ToggleGroupMemberFlag(slot, MEMBER_FLAG_MAINASSIST, apply); // Apply main assist flag on new main assist.
- if(!isBGGroup())
+ if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE group_member SET memberFlags='%u' WHERE memberGuid='%u'", slot->flags, GUID_LOPART(guid));
return true;
}
bool Group::SameSubGroup(Player const* member1, Player const* member2) const
{
- if(!member1 || !member2) return false;
+ if (!member1 || !member2) return false;
if (member1->GetGroup() != this || member2->GetGroup() != this) return false;
else return member1->GetSubGroup() == member2->GetSubGroup();
}
@@ -1364,7 +1364,7 @@ bool Group::SameSubGroup(Player const* member1, Player const* member2) const
// allows setting subgroup for offline members
void Group::ChangeMembersGroup(const uint64 &guid, const uint8 &group)
{
- if(!isRaidGroup())
+ if (!isRaidGroup())
return;
Player *player = objmgr.GetPlayer(guid);
@@ -1375,7 +1375,7 @@ void Group::ChangeMembersGroup(const uint64 &guid, const uint8 &group)
SubGroupCounterDecrease(prevSubGroup);
- if(_setMembersGroup(guid, group))
+ if (_setMembersGroup(guid, group))
SendUpdate();
}
else
@@ -1386,12 +1386,12 @@ void Group::ChangeMembersGroup(const uint64 &guid, const uint8 &group)
// only for online members
void Group::ChangeMembersGroup(Player *player, const uint8 &group)
{
- if(!player || !isRaidGroup())
+ if (!player || !isRaidGroup())
return;
- if(_setMembersGroup(player->GetGUID(), group))
+ if (_setMembersGroup(player->GetGUID(), group))
{
uint8 prevSubGroup = player->GetSubGroup();
- if( player->GetGroup() == this )
+ if ( player->GetGroup() == this )
player->GetGroupRef().setSubGroup(group);
//if player is in BG raid, it is possible that he is also in normal raid - and that normal raid is stored in m_originalGroup reference
else
@@ -1488,19 +1488,19 @@ uint32 Group::CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleG
{
// check for min / max count
uint32 memberscount = GetMembersCount();
- if(memberscount < MinPlayerCount)
+ if (memberscount < MinPlayerCount)
return BG_JOIN_ERR_GROUP_NOT_ENOUGH;
- if(memberscount > MaxPlayerCount)
+ if (memberscount > MaxPlayerCount)
return BG_JOIN_ERR_GROUP_TOO_MANY;
// get a player as reference, to compare other players' stats to (arena team id, queue id based on level, etc.)
Player * reference = GetFirstMember()->getSource();
// no reference found, can't join this way
- if(!reference)
+ if (!reference)
return BG_JOIN_ERR_OFFLINE_MEMBER;
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgOrTemplate->GetMapId(),reference->getLevel());
- if(!bracketEntry)
+ if (!bracketEntry)
return BG_JOIN_ERR_OFFLINE_MEMBER;
uint32 arenaTeamId = reference->GetArenaTeamId(arenaSlot);
@@ -1511,26 +1511,26 @@ uint32 Group::CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleG
{
Player *member = itr->getSource();
// offline member? don't let join
- if(!member)
+ if (!member)
return BG_JOIN_ERR_OFFLINE_MEMBER;
// don't allow cross-faction join as group
- if(member->GetTeam() != team)
+ if (member->GetTeam() != team)
return BG_JOIN_ERR_MIXED_FACTION;
// not in the same battleground level braket, don't let join
PvPDifficultyEntry const* memberBracketEntry = GetBattlegroundBracketByLevel(bracketEntry->mapId,member->getLevel());
- if(memberBracketEntry != bracketEntry)
+ if (memberBracketEntry != bracketEntry)
return BG_JOIN_ERR_MIXED_LEVELS;
// don't let join rated matches if the arena team id doesn't match
- if(isRated && member->GetArenaTeamId(arenaSlot) != arenaTeamId)
+ if (isRated && member->GetArenaTeamId(arenaSlot) != arenaTeamId)
return BG_JOIN_ERR_MIXED_ARENATEAM;
// don't let join if someone from the group is already in that bg queue
- if(member->InBattleGroundQueueForBattleGroundQueueType(bgQueueTypeId))
+ if (member->InBattleGroundQueueForBattleGroundQueueType(bgQueueTypeId))
return BG_JOIN_ERR_GROUP_MEMBER_ALREADY_IN_QUEUE;
// check for deserter debuff in case not arena queue
- if(bgOrTemplate->GetTypeID() != BATTLEGROUND_AA && !member->CanJoinToBattleground())
+ if (bgOrTemplate->GetTypeID() != BATTLEGROUND_AA && !member->CanJoinToBattleground())
return BG_JOIN_ERR_GROUP_DESERTER;
// check if member can join any more battleground queues
- if(!member->HasFreeBattleGroundQueueId())
+ if (!member->HasFreeBattleGroundQueueId())
return BG_JOIN_ERR_ALL_QUEUES_USED;
}
return BG_JOIN_ERR_OK;
@@ -1549,13 +1549,13 @@ void Roll::targetObjectBuildLink()
void Group::SetDungeonDifficulty(Difficulty difficulty)
{
m_dungeonDifficulty = difficulty;
- if(!isBGGroup())
+ if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE groups SET difficulty = %u WHERE leaderGuid ='%u'", m_dungeonDifficulty, GUID_LOPART(m_leaderGuid));
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *player = itr->getSource();
- if(!player->GetSession() || player->getLevel() < LEVELREQUIREMENT_HEROIC)
+ if (!player->GetSession() || player->getLevel() < LEVELREQUIREMENT_HEROIC)
continue;
player->SetDungeonDifficulty(difficulty);
player->SendDungeonDifficulty(true);
@@ -1565,13 +1565,13 @@ void Group::SetDungeonDifficulty(Difficulty difficulty)
void Group::SetRaidDifficulty(Difficulty difficulty)
{
m_raidDifficulty = difficulty;
- if(!isBGGroup())
+ if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE groups SET raiddifficulty = %u WHERE leaderGuid ='%u'", m_raidDifficulty, GUID_LOPART(m_leaderGuid));
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *player = itr->getSource();
- if(!player->GetSession() || player->getLevel() < LEVELREQUIREMENT_HEROIC)
+ if (!player->GetSession() || player->getLevel() < LEVELREQUIREMENT_HEROIC)
continue;
player->SetRaidDifficulty(difficulty);
player->SendRaidDifficulty(true);
@@ -1583,9 +1583,9 @@ bool Group::InCombatToInstance(uint32 instanceId)
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *pPlayer = itr->getSource();
- if(pPlayer && pPlayer->getAttackers().size() && pPlayer->GetInstanceId() == instanceId && (pPlayer->GetMap()->IsRaidOrHeroicDungeon()))
+ if (pPlayer && pPlayer->getAttackers().size() && pPlayer->GetInstanceId() == instanceId && (pPlayer->GetMap()->IsRaidOrHeroicDungeon()))
for (std::set<Unit*>::const_iterator i = pPlayer->getAttackers().begin(); i!=pPlayer->getAttackers().end(); ++i)
- if((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
+ if ((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
return true;
}
return false;
@@ -1593,7 +1593,7 @@ bool Group::InCombatToInstance(uint32 instanceId)
void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
{
- if(isBGGroup())
+ if (isBGGroup())
return;
// method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND
@@ -1605,13 +1605,13 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
{
InstanceSave *p = itr->second.save;
const MapEntry *entry = sMapStore.LookupEntry(itr->first);
- if(!entry || entry->IsRaid() != isRaid || !p->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND)
+ if (!entry || entry->IsRaid() != isRaid || !p->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND)
{
++itr;
continue;
}
- if(method == INSTANCE_RESET_ALL)
+ if (method == INSTANCE_RESET_ALL)
{
// the "reset all instances" method can only reset normal maps
if (entry->map_type == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC)
@@ -1624,24 +1624,24 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
bool isEmpty = true;
// if the map is loaded, reset it
Map *map = MapManager::Instance().FindMap(p->GetMapId(), p->GetInstanceId());
- if(map && map->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !p->CanReset()))
+ if (map && map->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !p->CanReset()))
{
- if(p->CanReset())
+ if (p->CanReset())
isEmpty = ((InstanceMap*)map)->Reset(method);
else
isEmpty = !map->HavePlayers();
}
- if(SendMsgTo)
+ if (SendMsgTo)
{
- if(isEmpty) SendMsgTo->SendResetInstanceSuccess(p->GetMapId());
+ if (isEmpty) SendMsgTo->SendResetInstanceSuccess(p->GetMapId());
else SendMsgTo->SendResetInstanceFailed(0, p->GetMapId());
}
- if(isEmpty || method == INSTANCE_RESET_GROUP_DISBAND || method == INSTANCE_RESET_CHANGE_DIFFICULTY)
+ if (isEmpty || method == INSTANCE_RESET_GROUP_DISBAND || method == INSTANCE_RESET_CHANGE_DIFFICULTY)
{
// do not reset the instance, just unbind if others are permanently bound to it
- if(p->CanReset()) p->DeleteFromDB();
+ if (p->CanReset()) p->DeleteFromDB();
else CharacterDatabase.PExecute("DELETE FROM group_instance WHERE instance = '%u'", p->GetInstanceId());
// i don't know for sure if hash_map iterators
m_boundInstances[diff].erase(itr);
@@ -1659,18 +1659,18 @@ InstanceGroupBind* Group::GetBoundInstance(Player* player)
{
uint32 mapid = player->GetMapId();
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
- if(!mapEntry)
+ if (!mapEntry)
return NULL;
Difficulty difficulty = player->GetDifficulty(mapEntry->IsRaid());
// some instances only have one difficulty
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid,difficulty);
- if(!mapDiff)
+ if (!mapDiff)
difficulty = DUNGEON_DIFFICULTY_NORMAL;
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid);
- if(itr != m_boundInstances[difficulty].end())
+ if (itr != m_boundInstances[difficulty].end())
return &itr->second;
else
return NULL;
@@ -1683,11 +1683,11 @@ InstanceGroupBind* Group::GetBoundInstance(Map* aMap)
// some instances only have one difficulty
MapDifficulty const* mapDiff = GetMapDifficultyData(aMap->GetId(),difficulty);
- if(!mapDiff)
+ if (!mapDiff)
return NULL;
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(aMap->GetId());
- if(itr != m_boundInstances[difficulty].end())
+ if (itr != m_boundInstances[difficulty].end())
return &itr->second;
else
return NULL;
@@ -1696,27 +1696,27 @@ InstanceGroupBind* Group::GetBoundInstance(Map* aMap)
InstanceGroupBind* Group::BindToInstance(InstanceSave *save, bool permanent, bool load)
{
- if(save && !isBGGroup())
+ if (save && !isBGGroup())
{
InstanceGroupBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()];
- if(bind.save)
+ if (bind.save)
{
// when a boss is killed or when copying the players's binds to the group
- if(permanent != bind.perm || save != bind.save)
- if(!load) CharacterDatabase.PExecute("UPDATE group_instance SET instance = '%u', permanent = '%u' WHERE leaderGuid = '%u' AND instance = '%u'", save->GetInstanceId(), permanent, GUID_LOPART(GetLeaderGUID()), bind.save->GetInstanceId());
+ if (permanent != bind.perm || save != bind.save)
+ if (!load) CharacterDatabase.PExecute("UPDATE group_instance SET instance = '%u', permanent = '%u' WHERE leaderGuid = '%u' AND instance = '%u'", save->GetInstanceId(), permanent, GUID_LOPART(GetLeaderGUID()), bind.save->GetInstanceId());
}
else
- if(!load) CharacterDatabase.PExecute("INSERT INTO group_instance (leaderGuid, instance, permanent) VALUES ('%u', '%u', '%u')", GUID_LOPART(GetLeaderGUID()), save->GetInstanceId(), permanent);
+ if (!load) CharacterDatabase.PExecute("INSERT INTO group_instance (leaderGuid, instance, permanent) VALUES ('%u', '%u', '%u')", GUID_LOPART(GetLeaderGUID()), save->GetInstanceId(), permanent);
- if(bind.save != save)
+ if (bind.save != save)
{
- if(bind.save) bind.save->RemoveGroup(this);
+ if (bind.save) bind.save->RemoveGroup(this);
save->AddGroup(this);
}
bind.save = save;
bind.perm = permanent;
- if(!load) sLog.outDebug("Group::BindToInstance: %d is now bound to map %d, instance %d, difficulty %d", GUID_LOPART(GetLeaderGUID()), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
+ if (!load) sLog.outDebug("Group::BindToInstance: %d is now bound to map %d, instance %d, difficulty %d", GUID_LOPART(GetLeaderGUID()), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
return &bind;
}
else
@@ -1726,9 +1726,9 @@ InstanceGroupBind* Group::BindToInstance(InstanceSave *save, bool permanent, boo
void Group::UnbindInstance(uint32 mapid, uint8 difficulty, bool unload)
{
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid);
- if(itr != m_boundInstances[difficulty].end())
+ if (itr != m_boundInstances[difficulty].end())
{
- if(!unload) CharacterDatabase.PExecute("DELETE FROM group_instance WHERE leaderGuid = '%u' AND instance = '%u'", GUID_LOPART(GetLeaderGUID()), itr->second.save->GetInstanceId());
+ if (!unload) CharacterDatabase.PExecute("DELETE FROM group_instance WHERE leaderGuid = '%u' AND instance = '%u'", GUID_LOPART(GetLeaderGUID()), itr->second.save->GetInstanceId());
itr->second.save->RemoveGroup(this); // save can become invalid
m_boundInstances[difficulty].erase(itr);
}
@@ -1736,13 +1736,13 @@ void Group::UnbindInstance(uint32 mapid, uint8 difficulty, bool unload)
void Group::_homebindIfInstance(Player *player)
{
- if(player && !player->isGameMaster() && sMapStore.LookupEntry(player->GetMapId())->IsDungeon())
+ if (player && !player->isGameMaster() && sMapStore.LookupEntry(player->GetMapId())->IsDungeon())
{
// leaving the group in an instance, the homebind timer is started
// unless the player is permanently saved to the instance
InstanceSave *save = sInstanceSaveManager.GetInstanceSave(player->GetInstanceId());
InstancePlayerBind *playerBind = save ? player->GetBoundInstance(save->GetMapId(), save->GetDifficulty()) : NULL;
- if(!playerBind || !playerBind->perm)
+ if (!playerBind || !playerBind->perm)
player->m_InstanceValid = false;
}
}
@@ -1755,7 +1755,7 @@ void Group::BroadcastGroupUpdate(void)
{
Player *pp = objmgr.GetPlayer(citr->guid);
- if(pp && pp->IsInWorld())
+ if (pp && pp->IsInWorld())
{
pp->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);
pp->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE);
diff --git a/src/game/Group.h b/src/game/Group.h
index a95a09047ca..d003b371922 100644
--- a/src/game/Group.h
+++ b/src/game/Group.h
@@ -206,7 +206,7 @@ class Group
{
for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
{
- if(itr->name == name)
+ if (itr->name == name)
{
return itr->guid;
}
@@ -216,7 +216,7 @@ class Group
bool IsAssistant(uint64 guid) const
{
member_citerator mslot = _getMemberCSlot(guid);
- if(mslot==m_memberSlots.end())
+ if (mslot==m_memberSlots.end())
return false;
return mslot->flags & MEMBER_FLAG_ASSISTANT;
@@ -227,7 +227,7 @@ class Group
bool SameSubGroup(uint64 guid1,const uint64& guid2) const
{
member_citerator mslot2 = _getMemberCSlot(guid2);
- if(mslot2==m_memberSlots.end())
+ if (mslot2==m_memberSlots.end())
return false;
return SameSubGroup(guid1,&*mslot2);
@@ -236,7 +236,7 @@ class Group
bool SameSubGroup(uint64 guid1, MemberSlot const* slot2) const
{
member_citerator mslot1 = _getMemberCSlot(guid1);
- if(mslot1==m_memberSlots.end() || !slot2)
+ if (mslot1==m_memberSlots.end() || !slot2)
return false;
return (mslot1->group==slot2->group);
@@ -256,7 +256,7 @@ class Group
uint8 GetMemberGroup(uint64 guid) const
{
member_citerator mslot = _getMemberCSlot(guid);
- if(mslot==m_memberSlots.end())
+ if (mslot==m_memberSlots.end())
return (MAXRAIDSIZE/MAXGROUPSIZE+1);
return mslot->group;
@@ -273,25 +273,25 @@ class Group
void SetAssistant(uint64 guid, const bool &apply)
{
- if(!isRaidGroup())
+ if (!isRaidGroup())
return;
- if(_setAssistantFlag(guid, apply))
+ if (_setAssistantFlag(guid, apply))
SendUpdate();
}
void SetMainTank(uint64 guid, const bool &apply)
{
- if(!isRaidGroup())
+ if (!isRaidGroup())
return;
- if(_setMainTank(guid, apply))
+ if (_setMainTank(guid, apply))
SendUpdate();
}
void SetMainAssistant(uint64 guid, const bool &apply)
{
- if(!isRaidGroup())
+ if (!isRaidGroup())
return;
- if(_setMainAssistant(guid, apply))
+ if (_setMainAssistant(guid, apply))
SendUpdate();
}
diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp
index 819be6dd96e..da5e2796552 100644
--- a/src/game/GroupHandler.cpp
+++ b/src/game/GroupHandler.cpp
@@ -64,7 +64,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
// attempt add selected player
// cheating
- if(!normalizePlayerName(membername))
+ if (!normalizePlayerName(membername))
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_CANT_FIND_TARGET);
return;
@@ -73,7 +73,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
Player *player = objmgr.GetPlayer(membername.c_str());
// no player
- if(!player)
+ if (!player)
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_CANT_FIND_TARGET);
return;
@@ -86,53 +86,53 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
return;
}
// can't group with
- if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeam() != player->GetTeam())
+ if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeam() != player->GetTeam())
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_TARGET_UNFRIENDLY);
return;
}
- if(GetPlayer()->GetInstanceId() != 0 && player->GetInstanceId() != 0 && GetPlayer()->GetInstanceId() != player->GetInstanceId() && GetPlayer()->GetMapId() == player->GetMapId())
+ if (GetPlayer()->GetInstanceId() != 0 && player->GetInstanceId() != 0 && GetPlayer()->GetInstanceId() != player->GetInstanceId() && GetPlayer()->GetMapId() == player->GetMapId())
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_NOT_IN_YOUR_INSTANCE);
return;
}
// just ignore us
- if(player->GetInstanceId() != 0 && player->GetDungeonDifficulty() != GetPlayer()->GetDungeonDifficulty())
+ if (player->GetInstanceId() != 0 && player->GetDungeonDifficulty() != GetPlayer()->GetDungeonDifficulty())
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_TARGET_IGNORE_YOU);
return;
}
- if(player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
+ if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_TARGET_IGNORE_YOU);
return;
}
Group *group = GetPlayer()->GetGroup();
- if( group && group->isBGGroup() )
+ if ( group && group->isBGGroup() )
group = GetPlayer()->GetOriginalGroup();
Group *group2 = player->GetGroup();
- if( group2 && group2->isBGGroup() )
+ if ( group2 && group2->isBGGroup() )
group2 = player->GetOriginalGroup();
// player already in another group or invited
- if( group2 || player->GetGroupInvite() )
+ if ( group2 || player->GetGroupInvite() )
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_ALREADY_IN_GROUP);
return;
}
- if(group)
+ if (group)
{
// not have permissions for invite
- if(group->isRaidGroup() && !group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
+ if (group->isRaidGroup() && !group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
{
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_YOU_NOT_LEADER);
return;
}
// not have place
- if(group->IsFull())
+ if (group->IsFull())
{
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_PARTY_FULL);
return;
@@ -142,16 +142,16 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
// ok, but group not exist, start a new group
// but don't create and save the group to the DB until
// at least one person joins
- if(!group)
+ if (!group)
{
group = new Group;
// new group: if can't add then delete
- if(!group->AddLeaderInvite(GetPlayer()))
+ if (!group->AddLeaderInvite(GetPlayer()))
{
delete group;
return;
}
- if(!group->AddInvite(player))
+ if (!group->AddInvite(player))
{
delete group;
return;
@@ -160,7 +160,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
else
{
// already existed group: if can't add then just leave
- if(!group->AddInvite(player))
+ if (!group->AddInvite(player))
{
return;
}
@@ -180,7 +180,7 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ )
Group *group = GetPlayer()->GetGroupInvite();
if (!group) return;
- if(group->GetLeaderGUID() == GetPlayer()->GetGUID())
+ if (group->GetLeaderGUID() == GetPlayer()->GetGUID())
{
sLog.outError("HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
return;
@@ -193,7 +193,7 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ )
/********************/
// not have place
- if(group->IsFull())
+ if (group->IsFull())
{
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_PARTY_FULL);
return;
@@ -202,16 +202,16 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ )
Player* leader = objmgr.GetPlayer(group->GetLeaderGUID());
// forming a new group, create it
- if(!group->IsCreated())
+ if (!group->IsCreated())
{
- if( leader )
+ if ( leader )
group->RemoveInvite(leader);
group->Create(group->GetLeaderGUID(), group->GetLeaderName());
objmgr.AddGroup(group);
}
// everything's fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
- if(!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
+ if (!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
return;
group->BroadcastGroupUpdate();
@@ -228,7 +228,7 @@ void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )
// uninvite, group can be deleted
GetPlayer()->UninviteFromGroup();
- if(!leader || !leader->GetSession())
+ if (!leader || !leader->GetSession())
return;
// report
@@ -243,30 +243,30 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
recv_data >> guid;
//can't uninvite yourself
- if(guid == GetPlayer()->GetGUID())
+ if (guid == GetPlayer()->GetGUID())
{
sLog.outError("WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
return;
}
PartyResult res = GetPlayer()->CanUninviteFromGroup();
- if(res != PARTY_RESULT_OK)
+ if (res != PARTY_RESULT_OK)
{
SendPartyResult(PARTY_OP_LEAVE, "", res);
return;
}
Group* grp = GetPlayer()->GetGroup();
- if(!grp)
+ if (!grp)
return;
- if(grp->IsMember(guid))
+ if (grp->IsMember(guid))
{
Player::RemoveFromGroup(grp,guid);
return;
}
- if(Player* plr = grp->GetInvited(guid))
+ if (Player* plr = grp->GetInvited(guid))
{
plr->UninviteFromGroup();
return;
@@ -281,34 +281,34 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
recv_data >> membername;
// player not found
- if(!normalizePlayerName(membername))
+ if (!normalizePlayerName(membername))
return;
// can't uninvite yourself
- if(GetPlayer()->GetName() == membername)
+ if (GetPlayer()->GetName() == membername)
{
sLog.outError("WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
return;
}
PartyResult res = GetPlayer()->CanUninviteFromGroup();
- if(res != PARTY_RESULT_OK)
+ if (res != PARTY_RESULT_OK)
{
SendPartyResult(PARTY_OP_LEAVE, "", res);
return;
}
Group* grp = GetPlayer()->GetGroup();
- if(!grp)
+ if (!grp)
return;
- if(uint64 guid = grp->GetMemberGUID(membername))
+ if (uint64 guid = grp->GetMemberGUID(membername))
{
Player::RemoveFromGroup(grp,guid);
return;
}
- if(Player* plr = grp->GetInvited(membername))
+ if (Player* plr = grp->GetInvited(membername))
{
plr->UninviteFromGroup();
return;
@@ -320,7 +320,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data )
{
Group *group = GetPlayer()->GetGroup();
- if(!group)
+ if (!group)
return;
uint64 guid;
@@ -339,10 +339,10 @@ void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data )
void WorldSession::HandleGroupDisbandOpcode( WorldPacket & /*recv_data*/ )
{
- if(!GetPlayer()->GetGroup())
+ if (!GetPlayer()->GetGroup())
return;
- if(_player->InBattleGround())
+ if (_player->InBattleGround())
{
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_INVITE_RESTRICTED);
return;
@@ -360,7 +360,7 @@ void WorldSession::HandleGroupDisbandOpcode( WorldPacket & /*recv_data*/ )
void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
{
Group *group = GetPlayer()->GetGroup();
- if(!group)
+ if (!group)
return;
uint32 lootMethod;
@@ -369,7 +369,7 @@ void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
recv_data >> lootMethod >> lootMaster >> lootThreshold;
/** error handling **/
- if(!group->IsLeader(GetPlayer()->GetGUID()))
+ if (!group->IsLeader(GetPlayer()->GetGUID()))
return;
/********************/
@@ -382,7 +382,7 @@ void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
void WorldSession::HandleLootRoll( WorldPacket &recv_data )
{
- if(!GetPlayer()->GetGroup())
+ if (!GetPlayer()->GetGroup())
return;
uint64 Guid;
@@ -395,7 +395,7 @@ void WorldSession::HandleLootRoll( WorldPacket &recv_data )
//sLog.outDebug("WORLD RECIEVE CMSG_LOOT_ROLL, From:%u, Numberofplayers:%u, Choise:%u", (uint32)Guid, NumberOfPlayers, Choise);
Group* group = GetPlayer()->GetGroup();
- if(!group)
+ if (!group)
return;
// everything's fine, do it
@@ -414,7 +414,7 @@ void WorldSession::HandleLootRoll( WorldPacket &recv_data )
void WorldSession::HandleMinimapPingOpcode(WorldPacket& recv_data)
{
- if(!GetPlayer()->GetGroup())
+ if (!GetPlayer()->GetGroup())
return;
float x, y;
@@ -441,7 +441,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data)
recv_data >> maximum;
/** error handling **/
- if(minimum > maximum || maximum > 10000) // < 32768 for urand call
+ if (minimum > maximum || maximum > 10000) // < 32768 for urand call
return;
/********************/
@@ -455,7 +455,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data)
data << uint32(maximum);
data << uint32(roll);
data << uint64(GetPlayer()->GetGUID());
- if(GetPlayer()->GetGroup())
+ if (GetPlayer()->GetGroup())
GetPlayer()->GetGroup()->BroadcastPacket(&data, false);
else
SendPacket(&data);
@@ -464,7 +464,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data)
void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data )
{
Group *group = GetPlayer()->GetGroup();
- if(!group)
+ if (!group)
return;
uint8 x;
@@ -474,13 +474,13 @@ void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data )
/********************/
// everything's fine, do it
- if(x == 0xFF) // target icon request
+ if (x == 0xFF) // target icon request
{
group->SendTargetIconList(this);
}
else // target icon update
{
- if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
+ if (!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
return;
uint64 guid;
@@ -492,14 +492,14 @@ void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data )
void WorldSession::HandleGroupRaidConvertOpcode( WorldPacket & /*recv_data*/ )
{
Group *group = GetPlayer()->GetGroup();
- if(!group)
+ if (!group)
return;
- if(_player->InBattleGround())
+ if (_player->InBattleGround())
return;
/** error handling **/
- if(!group->IsLeader(GetPlayer()->GetGUID()) || group->GetMembersCount() < 2)
+ if (!group->IsLeader(GetPlayer()->GetGUID()) || group->GetMembersCount() < 2)
return;
/********************/
@@ -512,7 +512,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
{
// we will get correct pointer for group here, so we don't have to check if group is BG raid
Group *group = GetPlayer()->GetGroup();
- if(!group)
+ if (!group)
return;
std::string name;
@@ -531,7 +531,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
/********************/
Player *movedPlayer=objmgr.GetPlayer(name.c_str());
- if(!movedPlayer)
+ if (!movedPlayer)
return;
//Do not allow leader to change group of player in combat
@@ -545,7 +545,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data )
{
Group *group = GetPlayer()->GetGroup();
- if(!group)
+ if (!group)
return;
uint64 guid;
@@ -592,13 +592,13 @@ void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
{
Group *group = GetPlayer()->GetGroup();
- if(!group)
+ if (!group)
return;
- if(recv_data.empty()) // request
+ if (recv_data.empty()) // request
{
/** error handling **/
- if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
+ if (!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
return;
/********************/
@@ -625,10 +625,10 @@ void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
void WorldSession::HandleRaidReadyCheckFinishedOpcode( WorldPacket & /*recv_data*/ )
{
//Group* group = GetPlayer()->GetGroup();
- //if(!group)
+ //if (!group)
// return;
- //if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
+ //if (!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
// return;
// Is any reaction need?
@@ -700,7 +700,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
*data << uint64(auramask);
for (uint32 i = 0; i < MAX_AURAS; ++i)
{
- if(auramask & (uint64(1) << i))
+ if (auramask & (uint64(1) << i))
{
AuraApplication const * aurApp = player->GetVisibleAura(i);
*data << uint32(aurApp ? aurApp->GetBase()->GetId() : 0);
@@ -712,7 +712,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
Pet *pet = player->GetPet();
if (mask & GROUP_UPDATE_FLAG_PET_GUID)
{
- if(pet)
+ if (pet)
*data << (uint64) pet->GetGUID();
else
*data << (uint64) 0;
@@ -720,7 +720,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_NAME)
{
- if(pet)
+ if (pet)
*data << pet->GetName();
else
*data << (uint8) 0;
@@ -728,7 +728,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_MODEL_ID)
{
- if(pet)
+ if (pet)
*data << (uint16) pet->GetDisplayId();
else
*data << (uint16) 0;
@@ -736,7 +736,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_CUR_HP)
{
- if(pet)
+ if (pet)
*data << (uint32) pet->GetHealth();
else
*data << (uint32) 0;
@@ -744,7 +744,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_MAX_HP)
{
- if(pet)
+ if (pet)
*data << (uint32) pet->GetMaxHealth();
else
*data << (uint32) 0;
@@ -752,7 +752,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_POWER_TYPE)
{
- if(pet)
+ if (pet)
*data << (uint8) pet->getPowerType();
else
*data << (uint8) 0;
@@ -760,7 +760,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_CUR_POWER)
{
- if(pet)
+ if (pet)
*data << (uint16) pet->GetPower(pet->getPowerType());
else
*data << (uint16) 0;
@@ -768,7 +768,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_MAX_POWER)
{
- if(pet)
+ if (pet)
*data << (uint16) pet->GetMaxPower(pet->getPowerType());
else
*data << (uint16) 0;
@@ -776,7 +776,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_VEHICLE_SEAT)
{
- if(player->GetVehicle()){
+ if (player->GetVehicle()){
Vehicle* vv=player->GetVehicle();
*data << (uint32) vv->GetVehicleInfo()->m_seatID[player->m_movementInfo.t_seat];
}
@@ -784,13 +784,13 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_AURAS)
{
- if(pet)
+ if (pet)
{
const uint64& auramask = pet->GetAuraUpdateMaskForRaid();
*data << uint64(auramask);
for (uint32 i = 0; i < MAX_AURAS; ++i)
{
- if(auramask & (uint64(1) << i))
+ if (auramask & (uint64(1) << i))
{
AuraApplication const * aurApp = player->GetVisibleAura(i);
*data << uint32(aurApp ? aurApp->GetBase()->GetId() : 0);
@@ -811,7 +811,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
recv_data >> Guid;
Player *player = objmgr.GetPlayer(Guid);
- if(!player)
+ if (!player)
{
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3+4+2);
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
@@ -829,7 +829,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
data.append(player->GetPackGUID());
uint32 mask1 = 0x00040BFF; // common mask, real flags used 0x000040BFF
- if(pet)
+ if (pet)
mask1 = 0x7FFFFFFF; // for hunters and other classes with pets
Powers powerType = player->getPowerType();
@@ -850,7 +850,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
data << (uint64) auramask; // placeholder
for (uint8 i = 0; i < MAX_AURAS; ++i)
{
- if(AuraApplication * aurApp = player->GetVisibleAura(i))
+ if (AuraApplication * aurApp = player->GetVisibleAura(i))
{
auramask |= (uint64(1) << i);
data << (uint32) aurApp->GetBase()->GetId();
@@ -859,7 +859,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
}
data.put<uint64>(maskPos,auramask); // GROUP_UPDATE_FLAG_AURAS
- if(pet)
+ if (pet)
{
Powers petpowertype = pet->getPowerType();
data << (uint64) pet->GetGUID(); // GROUP_UPDATE_FLAG_PET_GUID
@@ -876,7 +876,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
data << (uint64) petauramask; // placeholder
for (uint8 i = 0; i < MAX_AURAS; ++i)
{
- if(AuraApplication * auraApp = pet->GetVisibleAura(i))
+ if (AuraApplication * auraApp = pet->GetVisibleAura(i))
{
petauramask |= (uint64(1) << i);
data << (uint32) auraApp->GetBase()->GetId();
@@ -913,13 +913,13 @@ void WorldSession::HandleOptOutOfLootOpcode( WorldPacket & recv_data )
recv_data >> unkn;
// ignore if player not loaded
- if(!GetPlayer()) // needed because STATUS_AUTHED
+ if (!GetPlayer()) // needed because STATUS_AUTHED
{
- if(unkn!=0)
+ if (unkn!=0)
sLog.outError("CMSG_GROUP_PASS_ON_LOOT value<>0 for not-loaded character!");
return;
}
- if(unkn!=0)
+ if (unkn!=0)
sLog.outError("CMSG_GROUP_PASS_ON_LOOT: activation not implemented!");
}
diff --git a/src/game/GuardAI.cpp b/src/game/GuardAI.cpp
index b571f63a624..b01fd1b67df 100644
--- a/src/game/GuardAI.cpp
+++ b/src/game/GuardAI.cpp
@@ -27,7 +27,7 @@
int GuardAI::Permissible(const Creature *creature)
{
- if( creature->isGuard())
+ if ( creature->isGuard())
return PERMIT_BASE_SPECIAL;
return PERMIT_BASE_NO;
@@ -43,12 +43,12 @@ void GuardAI::MoveInLineOfSight(Unit *u)
if ( !m_creature->canFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE )
return;
- if( !m_creature->getVictim() && m_creature->canAttack(u) &&
+ if ( !m_creature->getVictim() && m_creature->canAttack(u) &&
( u->IsHostileToPlayers() || m_creature->IsHostileTo(u) /*|| u->getVictim() && m_creature->IsFriendlyTo(u->getVictim())*/ ) &&
u->isInAccessiblePlaceFor(m_creature))
{
float attackRadius = m_creature->GetAttackDistance(u);
- if(m_creature->IsWithinDistInMap(u,attackRadius))
+ if (m_creature->IsWithinDistInMap(u,attackRadius))
{
//Need add code to let guard support player
AttackStart(u);
@@ -59,7 +59,7 @@ void GuardAI::MoveInLineOfSight(Unit *u)
void GuardAI::EnterEvadeMode()
{
- if( !m_creature->isAlive() )
+ if ( !m_creature->isAlive() )
{
DEBUG_LOG("Creature stopped attacking because he's dead [guid=%u]", m_creature->GetGUIDLow());
m_creature->GetMotionMaster()->MoveIdle();
@@ -74,19 +74,19 @@ void GuardAI::EnterEvadeMode()
Unit* victim = ObjectAccessor::GetUnit(*m_creature, i_victimGuid );
- if( !victim )
+ if ( !victim )
{
DEBUG_LOG("Creature stopped attacking because victim is non exist [guid=%u]", m_creature->GetGUIDLow());
}
- else if( !victim ->isAlive() )
+ else if ( !victim ->isAlive() )
{
DEBUG_LOG("Creature stopped attacking because victim is dead [guid=%u]", m_creature->GetGUIDLow());
}
- else if( victim ->HasStealthAura() )
+ else if ( victim ->HasStealthAura() )
{
DEBUG_LOG("Creature stopped attacking because victim is using stealth [guid=%u]", m_creature->GetGUIDLow());
}
- else if( victim ->isInFlight() )
+ else if ( victim ->isInFlight() )
{
DEBUG_LOG("Creature stopped attacking because victim is flying away [guid=%u]", m_creature->GetGUIDLow());
}
@@ -102,21 +102,21 @@ void GuardAI::EnterEvadeMode()
i_state = STATE_NORMAL;
// Remove TargetedMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead
- if( m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE )
+ if ( m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE )
m_creature->GetMotionMaster()->MoveTargetedHome();
}
void GuardAI::UpdateAI(const uint32 /*diff*/)
{
// update i_victimGuid if m_creature->getVictim() !=0 and changed
- if(!UpdateVictim())
+ if (!UpdateVictim())
return;
i_victimGuid = m_creature->getVictim()->GetGUID();
- if( m_creature->isAttackReady() )
+ if ( m_creature->isAttackReady() )
{
- if( m_creature->IsWithinMeleeRange(m_creature->getVictim()))
+ if ( m_creature->IsWithinMeleeRange(m_creature->getVictim()))
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
@@ -132,7 +132,7 @@ bool GuardAI::IsVisible(Unit *pl) const
void GuardAI::JustDied(Unit *killer)
{
- if(Player* pkiller = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
+ if (Player* pkiller = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
m_creature->SendZoneUnderAttackMessage(pkiller);
}
diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp
index 8a0821bf6ad..9b5d6f884a2 100644
--- a/src/game/Guild.cpp
+++ b/src/game/Guild.cpp
@@ -1601,7 +1601,7 @@ void Guild::AppendDisplayGuildBankSlot( WorldPacket& data, GuildBankTab const *t
data << uint8(enchCount); // number of enchantments
for (uint32 i = PERM_ENCHANTMENT_SLOT; i < MAX_ENCHANTMENT_SLOT; ++i)
{
- if(uint32 enchId = pItem->GetEnchantmentId(EnchantmentSlot(i)))
+ if (uint32 enchId = pItem->GetEnchantmentId(EnchantmentSlot(i)))
{
data << uint8(i);
data << uint32(enchId);
diff --git a/src/game/Guild.h b/src/game/Guild.h
index 1438689670c..2fc52144d1b 100644
--- a/src/game/Guild.h
+++ b/src/game/Guild.h
@@ -341,8 +341,8 @@ class Guild
void BroadcastWorker(Do& _do, Player* except = NULL)
{
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
- if(Player *player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
- if(player != except)
+ if (Player *player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
+ if (player != except)
_do(player);
}
@@ -367,7 +367,7 @@ class Guild
{
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
{
- if(itr->second.Name == name)
+ if (itr->second.Name == name)
{
guid = itr->first;
return &itr->second;
diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp
index 62ce50e0477..f32fa8b37fa 100644
--- a/src/game/GuildHandler.cpp
+++ b/src/game/GuildHandler.cpp
@@ -36,7 +36,7 @@ void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket)
uint32 guildId;
recvPacket >> guildId;
- if(Guild *guild = objmgr.GetGuildById(guildId))
+ if (Guild *guild = objmgr.GetGuildById(guildId))
{
guild->Query(this);
return;
@@ -52,11 +52,11 @@ void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket)
std::string gname;
recvPacket >> gname;
- if(GetPlayer()->GetGuildId()) // already in guild
+ if (GetPlayer()->GetGuildId()) // already in guild
return;
Guild *guild = new Guild;
- if(!guild->Create(GetPlayer(), gname))
+ if (!guild->Create(GetPlayer(), gname))
{
delete guild;
return;
@@ -74,24 +74,24 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
Player * player = NULL;
recvPacket >> Invitedname;
- if(normalizePlayerName(Invitedname))
+ if (normalizePlayerName(Invitedname))
player = ObjectAccessor::Instance().FindPlayerByName(Invitedname.c_str());
- if(!player)
+ if (!player)
{
SendGuildCommandResult(GUILD_INVITE_S, Invitedname, GUILD_PLAYER_NOT_FOUND);
return;
}
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
- if(!guild)
+ if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
// OK result but not send invite
- if(player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
+ if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
return;
// not let enemies sign guild charter
@@ -101,21 +101,21 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
return;
}
- if(player->GetGuildId())
+ if (player->GetGuildId())
{
plname = player->GetName();
SendGuildCommandResult(GUILD_INVITE_S, plname, ALREADY_IN_GUILD);
return;
}
- if(player->GetGuildIdInvited())
+ if (player->GetGuildIdInvited())
{
plname = player->GetName();
SendGuildCommandResult(GUILD_INVITE_S, plname, ALREADY_INVITED_TO_GUILD);
return;
}
- if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_INVITE))
+ if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_INVITE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -142,17 +142,17 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
std::string plName;
recvPacket >> plName;
- if(!normalizePlayerName(plName))
+ if (!normalizePlayerName(plName))
return;
Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
- if(!guild)
+ if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
- if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_REMOVE))
+ if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_REMOVE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -160,20 +160,20 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
uint64 plGuid;
MemberSlot* slot = guild->GetMemberSlot(plName, plGuid);
- if(!slot)
+ if (!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
- if(slot->RankId == GR_GUILDMASTER)
+ if (slot->RankId == GR_GUILDMASTER)
{
SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE);
return;
}
//do not allow to kick player with same or higher rights
- if(GetPlayer()->GetRank() >= slot->RankId)
+ if (GetPlayer()->GetRank() >= slot->RankId)
{
SendGuildCommandResult(GUILD_QUIT_S, plName, GUILD_RANK_TOO_HIGH_S);
return;
@@ -199,14 +199,14 @@ void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/)
sLog.outDebug("WORLD: Received CMSG_GUILD_ACCEPT");
guild = objmgr.GetGuildById(player->GetGuildIdInvited());
- if(!guild || player->GetGuildId())
+ if (!guild || player->GetGuildId())
return;
// not let enemies sign guild charter
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != objmgr.GetPlayerTeamByGUID(guild->GetLeader()))
return;
- if(!guild->AddMember(GetPlayer()->GetGUID(),guild->GetLowestRank()))
+ if (!guild->AddMember(GetPlayer()->GetGUID(),guild->GetLowestRank()))
return;
// Put record into guildlog
guild->LogGuildEvent(GUILD_EVENT_LOG_JOIN_GUILD, GetPlayer()->GetGUIDLow(), 0, 0);
@@ -234,7 +234,7 @@ void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/)
sLog.outDebug("WORLD: Received CMSG_GUILD_INFO");
guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
- if(!guild)
+ if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
@@ -253,7 +253,7 @@ void WorldSession::HandleGuildRosterOpcode(WorldPacket& /*recvPacket*/)
{
sLog.outDebug("WORLD: Received CMSG_GUILD_ROSTER");
- if(Guild* guild = objmgr.GetGuildById(_player->GetGuildId()))
+ if (Guild* guild = objmgr.GetGuildById(_player->GetGuildId()))
guild->Roster(this);
}
@@ -264,17 +264,17 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
std::string plName;
recvPacket >> plName;
- if(!normalizePlayerName(plName))
+ if (!normalizePlayerName(plName))
return;
Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
- if(!guild)
+ if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
- if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_PROMOTE))
+ if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_PROMOTE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -283,13 +283,13 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
uint64 plGuid;
MemberSlot* slot = guild->GetMemberSlot(plName, plGuid);
- if(!slot)
+ if (!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
- if(plGuid == GetPlayer()->GetGUID())
+ if (plGuid == GetPlayer()->GetGUID())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_NAME_INVALID);
return;
@@ -298,7 +298,7 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
//allow to promote only to lower rank than member's rank
//guildmaster's rank = 0
//GetPlayer()->GetRank() + 1 is highest rank that current player can promote to
- if(GetPlayer()->GetRank() + 1 >= slot->RankId)
+ if (GetPlayer()->GetRank() + 1 >= slot->RankId)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_RANK_TOO_HIGH_S);
return;
@@ -326,18 +326,18 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
std::string plName;
recvPacket >> plName;
- if(!normalizePlayerName(plName))
+ if (!normalizePlayerName(plName))
return;
Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
- if(!guild)
+ if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
- if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_DEMOTE))
+ if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_DEMOTE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -352,21 +352,21 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
return;
}
- if(plGuid == GetPlayer()->GetGUID())
+ if (plGuid == GetPlayer()->GetGUID())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_NAME_INVALID);
return;
}
//do not allow to demote same or higher rank
- if(GetPlayer()->GetRank() >= slot->RankId)
+ if (GetPlayer()->GetRank() >= slot->RankId)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_RANK_TOO_HIGH_S);
return;
}
//do not allow to demote lowest rank
- if(slot->RankId >= guild->GetLowestRank())
+ if (slot->RankId >= guild->GetLowestRank())
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_ALREADY_LOWEST_RANK_S);
return;
@@ -392,19 +392,19 @@ void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/)
sLog.outDebug("WORLD: Received CMSG_GUILD_LEAVE");
Guild *guild = objmgr.GetGuildById(_player->GetGuildId());
- if(!guild)
+ if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
- if(_player->GetGUID() == guild->GetLeader() && guild->GetMemberSize() > 1)
+ if (_player->GetGUID() == guild->GetLeader() && guild->GetMemberSize() > 1)
{
SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE);
return;
}
- if(_player->GetGUID() == guild->GetLeader())
+ if (_player->GetGUID() == guild->GetLeader())
{
guild->Disband();
return;
@@ -430,13 +430,13 @@ void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/)
sLog.outDebug("WORLD: Received CMSG_GUILD_DISBAND");
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
- if(!guild)
+ if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
- if(GetPlayer()->GetGUID() != guild->GetLeader())
+ if (GetPlayer()->GetGUID() != guild->GetLeader())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -456,7 +456,7 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
Player *oldLeader = GetPlayer();
- if(!normalizePlayerName(name))
+ if (!normalizePlayerName(name))
return;
Guild *guild = objmgr.GetGuildById(oldLeader->GetGuildId());
@@ -467,7 +467,7 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
return;
}
- if( oldLeader->GetGUID() != guild->GetLeader())
+ if ( oldLeader->GetGUID() != guild->GetLeader())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -501,19 +501,19 @@ void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket)
std::string MOTD;
- if(!recvPacket.empty())
+ if (!recvPacket.empty())
recvPacket >> MOTD;
else
MOTD = "";
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
- if(!guild)
+ if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
- if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_SETMOTD))
+ if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_SETMOTD))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -537,7 +537,7 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket)
std::string name,PNOTE;
recvPacket >> name;
- if(!normalizePlayerName(name))
+ if (!normalizePlayerName(name))
return;
Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
@@ -575,7 +575,7 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket)
std::string plName, OFFNOTE;
recvPacket >> plName;
- if(!normalizePlayerName(plName))
+ if (!normalizePlayerName(plName))
return;
Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
@@ -615,13 +615,13 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
sLog.outDebug("WORLD: Received CMSG_GUILD_RANK");
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
- if(!guild)
+ if (!guild)
{
recvPacket.rpos(recvPacket.wpos()); // set to end to avoid warnings spam
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
- else if(GetPlayer()->GetGUID() != guild->GetLeader())
+ else if (GetPlayer()->GetGUID() != guild->GetLeader())
{
recvPacket.rpos(recvPacket.wpos()); // set to end to avoid warnings spam
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
@@ -665,19 +665,19 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket)
recvPacket >> rankname;
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
- if(!guild)
+ if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
- if(GetPlayer()->GetGUID() != guild->GetLeader())
+ if (GetPlayer()->GetGUID() != guild->GetLeader())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
- if(guild->GetRanksSize() >= GUILD_RANKS_MAX_COUNT) // client not let create more 10 than ranks
+ if (guild->GetRanksSize() >= GUILD_RANKS_MAX_COUNT) // client not let create more 10 than ranks
return;
guild->CreateRank(rankname, GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
@@ -691,12 +691,12 @@ void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/)
sLog.outDebug("WORLD: Received CMSG_GUILD_DEL_RANK");
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
- if(!guild)
+ if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
- else if(GetPlayer()->GetGUID() != guild->GetLeader())
+ else if (GetPlayer()->GetGUID() != guild->GetLeader())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -728,13 +728,13 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket)
recvPacket >> GINFO;
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
- if(!guild)
+ if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
- if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_MODIFY_GUILD_INFO))
+ if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_MODIFY_GUILD_INFO))
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PERMISSIONS);
return;
@@ -764,11 +764,11 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
- if(!guild)
+ if (!guild)
{
//"You are not part of a guild!";
SendSaveGuildEmblem(ERR_GUILDEMBLEM_NOGUILD);
@@ -782,7 +782,7 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
return;
}
- if(GetPlayer()->GetMoney() < 10*GOLD)
+ if (GetPlayer()->GetMoney() < 10*GOLD)
{
//"You can't afford to do that."
SendSaveGuildEmblem(ERR_GUILDEMBLEM_NOTENOUGHMONEY);
@@ -802,8 +802,8 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */)
{
// empty
sLog.outDebug("WORLD: Received (MSG_GUILD_EVENT_LOG_QUERY)");
- if(uint32 GuildId = GetPlayer()->GetGuildId())
- if(Guild *pGuild = objmgr.GetGuildById(GuildId))
+ if (uint32 GuildId = GetPlayer()->GetGuildId())
+ if (Guild *pGuild = objmgr.GetGuildById(GuildId))
pGuild->DisplayGuildEventLog(this);
}
@@ -812,8 +812,8 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */)
void WorldSession::HandleGuildBankMoneyWithdrawn( WorldPacket & /* recv_data */ )
{
sLog.outDebug("WORLD: Received (MSG_GUILD_BANK_MONEY_WITHDRAWN)");
- if(uint32 GuildId = GetPlayer()->GetGuildId())
- if(Guild *pGuild = objmgr.GetGuildById(GuildId))
+ if (uint32 GuildId = GetPlayer()->GetGuildId())
+ if (Guild *pGuild = objmgr.GetGuildById(GuildId))
pGuild->SendMoneyInfo(this, GetPlayer()->GetGUIDLow());
}
@@ -821,9 +821,9 @@ void WorldSession::HandleGuildPermissions( WorldPacket& /* recv_data */ )
{
sLog.outDebug("WORLD: Received (MSG_GUILD_PERMISSIONS)");
- if(uint32 GuildId = GetPlayer()->GetGuildId())
+ if (uint32 GuildId = GetPlayer()->GetGuildId())
{
- if(Guild *pGuild = objmgr.GetGuildById(GuildId))
+ if (Guild *pGuild = objmgr.GetGuildById(GuildId))
{
uint32 rankId = GetPlayer()->GetRank();
@@ -859,7 +859,7 @@ void WorldSession::HandleGuildBankerActivate( WorldPacket & recv_data )
if (uint32 GuildId = GetPlayer()->GetGuildId())
{
- if(Guild *pGuild = objmgr.GetGuildById(GuildId))
+ if (Guild *pGuild = objmgr.GetGuildById(GuildId))
{
pGuild->DisplayGuildBankTabsInfo(this); // this also will load guild bank if not yet
return;
@@ -935,7 +935,7 @@ void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data )
CharacterDatabase.CommitTransaction();
// logging money
- if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
+ if (_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
{
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)",
_player->GetName(),_player->GetSession()->GetAccountId(),money,GuildId);
@@ -968,7 +968,7 @@ void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data )
return;
Guild *pGuild = objmgr.GetGuildById(GuildId);
- if(!pGuild)
+ if (!pGuild)
return;
if (!pGuild->GetPurchasedTabs())
@@ -1098,7 +1098,7 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
// Player <-> Bank
// allow work with inventory only
- if(!Player::IsInventoryPos(PlayerBag, PlayerSlot) && !(PlayerBag == NULL_BAG && PlayerSlot == NULL_SLOT) )
+ if (!Player::IsInventoryPos(PlayerBag, PlayerSlot) && !(PlayerBag == NULL_BAG && PlayerSlot == NULL_SLOT) )
{
_player->SendEquipError( EQUIP_ERR_NONE, NULL, NULL );
return;
@@ -1129,7 +1129,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data )
return;
Guild *pGuild = objmgr.GetGuildById(GuildId);
- if(!pGuild)
+ if (!pGuild)
return;
// m_PurchasedTabs = 0 when buying Tab 0, that is why this check can be made
@@ -1166,10 +1166,10 @@ void WorldSession::HandleGuildBankUpdateTab( WorldPacket & recv_data )
recv_data >> Name;
recv_data >> IconIndex;
- if(Name.empty())
+ if (Name.empty())
return;
- if(IconIndex.empty())
+ if (IconIndex.empty())
return;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
diff --git a/src/game/HomeMovementGenerator.cpp b/src/game/HomeMovementGenerator.cpp
index 964d986152b..cd3961a538c 100644
--- a/src/game/HomeMovementGenerator.cpp
+++ b/src/game/HomeMovementGenerator.cpp
@@ -43,10 +43,10 @@ HomeMovementGenerator<Creature>::Reset(Creature &)
void
HomeMovementGenerator<Creature>::_setTargetLocation(Creature & owner)
{
- if( !&owner )
+ if ( !&owner )
return;
- if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) )
+ if ( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) )
return;
float x, y, z;
@@ -70,7 +70,7 @@ HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff
owner.AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
// restore orientation of not moving creature at returning to home
- if(owner.GetDefaultMovementType()==IDLE_MOTION_TYPE)
+ if (owner.GetDefaultMovementType()==IDLE_MOTION_TYPE)
{
//sLog.outDebug("Entering HomeMovement::GetDestination(z,y,z)");
owner.SetOrientation(ori);
diff --git a/src/game/HostileRefManager.cpp b/src/game/HostileRefManager.cpp
index 5e0ccaf15b0..64fc19c78d4 100644
--- a/src/game/HostileRefManager.cpp
+++ b/src/game/HostileRefManager.cpp
@@ -43,7 +43,7 @@ void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry co
while (ref != NULL)
{
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
- if(pVictim == getOwner())
+ if (pVictim == getOwner())
ref->addThreat(threat / size); // It is faster to modify the threat durectly if possible
else
ref->getSource()->addThreat(pVictim, threat / size);
@@ -139,7 +139,7 @@ void HostileRefManager::deleteReferencesForFaction(uint32 faction)
while (ref)
{
HostileReference* nextRef = ref->next();
- if(ref->getSource()->getOwner()->getFactionTemplateEntry()->faction == faction)
+ if (ref->getSource()->getOwner()->getFactionTemplateEntry()->faction == faction)
{
ref->removeReference();
delete ref;
@@ -157,7 +157,7 @@ void HostileRefManager::deleteReference(Unit *pCreature)
while (ref)
{
HostileReference* nextRef = ref->next();
- if(ref->getSource()->getOwner() == pCreature)
+ if (ref->getSource()->getOwner() == pCreature)
{
ref->removeReference();
delete ref;
@@ -176,7 +176,7 @@ void HostileRefManager::setOnlineOfflineState(Unit *pCreature, bool bIsOnline)
while (ref)
{
HostileReference* nextRef = ref->next();
- if(ref->getSource()->getOwner() == pCreature)
+ if (ref->getSource()->getOwner() == pCreature)
{
ref->setOnlineOfflineState(bIsOnline);
break;
diff --git a/src/game/IdleMovementGenerator.cpp b/src/game/IdleMovementGenerator.cpp
index 111d88e223b..0fa911003e4 100644
--- a/src/game/IdleMovementGenerator.cpp
+++ b/src/game/IdleMovementGenerator.cpp
@@ -28,23 +28,23 @@ IdleMovementGenerator si_idleMovement;
// But it should not be sent otherwise there are many redundent packets
void IdleMovementGenerator::Initialize(Unit &owner)
{
- if(owner.hasUnitState(UNIT_STAT_MOVE))
+ if (owner.hasUnitState(UNIT_STAT_MOVE))
owner.StopMoving();
}
void
IdleMovementGenerator::Reset(Unit& owner)
{
- if(owner.hasUnitState(UNIT_STAT_MOVE))
+ if (owner.hasUnitState(UNIT_STAT_MOVE))
owner.StopMoving();
}
void RotateMovementGenerator::Initialize(Unit& owner)
{
- if(owner.hasUnitState(UNIT_STAT_MOVE))
+ if (owner.hasUnitState(UNIT_STAT_MOVE))
owner.StopMoving();
- if(owner.getVictim())
+ if (owner.getVictim())
owner.SetInFront(owner.getVictim());
owner.addUnitState(UNIT_STAT_ROTATING);
@@ -55,7 +55,7 @@ void RotateMovementGenerator::Initialize(Unit& owner)
bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff)
{
float angle = owner.GetOrientation();
- if(m_direction == ROTATE_DIRECTION_LEFT)
+ if (m_direction == ROTATE_DIRECTION_LEFT)
{
angle += (float)diff * M_PI * 2 / m_maxDuration;
while (angle >= M_PI * 2 ) angle -= M_PI * 2;
@@ -68,7 +68,7 @@ bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff)
owner.SetOrientation(angle);
owner.SendMovementFlagUpdate(); // this is a hack. we do not have anything correct to send in the beginning
- if(m_duration > diff)
+ if (m_duration > diff)
m_duration -= diff;
else
return false;
@@ -79,7 +79,7 @@ bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff)
void RotateMovementGenerator::Finalize(Unit &unit)
{
unit.clearUnitState(UNIT_STAT_ROTATING);
- if(unit.GetTypeId() == TYPEID_UNIT)
+ if (unit.GetTypeId() == TYPEID_UNIT)
unit.ToCreature()->AI()->MovementInform(ROTATE_MOTION_TYPE, 0);
}
@@ -98,7 +98,7 @@ DistractMovementGenerator::Finalize(Unit& owner)
bool
DistractMovementGenerator::Update(Unit& owner, const uint32& time_diff)
{
- if(time_diff > m_timer)
+ if (time_diff > m_timer)
return false;
m_timer -= time_diff;
diff --git a/src/game/InstanceData.cpp b/src/game/InstanceData.cpp
index 2da09cbea04..5aacf436159 100644
--- a/src/game/InstanceData.cpp
+++ b/src/game/InstanceData.cpp
@@ -203,7 +203,7 @@ bool InstanceData::SetBossState(uint32 id, EncounterState state)
if (state == DONE)
for (MinionSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
- if((*i)->isWorldBoss() && (*i)->isAlive())
+ if ((*i)->isWorldBoss() && (*i)->isAlive())
return false;
bossInfo->state = state;
@@ -224,7 +224,7 @@ bool InstanceData::SetBossState(uint32 id, EncounterState state)
std::string InstanceData::LoadBossState(const char * data)
{
- if(!data)
+ if (!data)
return NULL;
std::istringstream loadStream(data);
uint32 buff;
diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp
index 97014cc6796..87898488fe9 100644
--- a/src/game/InstanceSaveMgr.cpp
+++ b/src/game/InstanceSaveMgr.cpp
@@ -79,7 +79,7 @@ InstanceSaveManager::~InstanceSaveManager()
*/
InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instanceId, Difficulty difficulty, time_t resetTime, bool canReset, bool load)
{
- if(InstanceSave *old_save = GetInstanceSave(instanceId))
+ if (InstanceSave *old_save = GetInstanceSave(instanceId))
return old_save;
const MapEntry* entry = sMapStore.LookupEntry(mapId);
@@ -101,11 +101,11 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
return NULL;
}
- if(!resetTime)
+ if (!resetTime)
{
// initialize reset time
// for normal instances if no creatures are killed the instance will reset in two hours
- if(entry->map_type == MAP_RAID || difficulty > DUNGEON_DIFFICULTY_NORMAL)
+ if (entry->map_type == MAP_RAID || difficulty > DUNGEON_DIFFICULTY_NORMAL)
resetTime = GetResetTimeFor(mapId,difficulty);
else
{
@@ -118,7 +118,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
sLog.outDebug("InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d", mapId, instanceId);
InstanceSave *save = new InstanceSave(mapId, instanceId, difficulty, resetTime, canReset);
- if(!load) save->SaveToDB();
+ if (!load) save->SaveToDB();
m_instanceSaveById[instanceId] = save;
return save;
@@ -143,10 +143,10 @@ void InstanceSaveManager::DeleteInstanceFromDB(uint32 instanceid)
void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId)
{
InstanceSaveHashMap::iterator itr = m_instanceSaveById.find( InstanceId );
- if(itr != m_instanceSaveById.end())
+ if (itr != m_instanceSaveById.end())
{
// save the resettime for normal instances only when they get unloaded
- if(time_t resettime = itr->second->GetResetTimeForDB())
+ if (time_t resettime = itr->second->GetResetTimeForDB())
CharacterDatabase.PExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", (uint64)resettime, InstanceId);
delete itr->second;
m_instanceSaveById.erase(itr);
@@ -174,13 +174,13 @@ void InstanceSave::SaveToDB()
std::string data;
Map *map = MapManager::Instance().FindMap(GetMapId(),m_instanceid);
- if(map)
+ if (map)
{
assert(map->IsDungeon());
- if(InstanceData *iData = ((InstanceMap*)map)->GetInstanceData())
+ if (InstanceData *iData = ((InstanceMap*)map)->GetInstanceData())
{
data = iData->GetSaveData();
- if(!data.empty())
+ if (!data.empty())
CharacterDatabase.escape_string(data);
}
}
@@ -192,7 +192,7 @@ time_t InstanceSave::GetResetTimeForDB()
{
// only save the reset time for normal instances
const MapEntry *entry = sMapStore.LookupEntry(GetMapId());
- if(!entry || entry->map_type == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC)
+ if (!entry || entry->map_type == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC)
return 0;
else
return GetResetTime();
@@ -217,9 +217,9 @@ void InstanceSave::DeleteFromDB()
/* true if the instance save is still valid */
bool InstanceSave::UnloadIfEmpty()
{
- if(m_playerList.empty() && m_groupList.empty())
+ if (m_playerList.empty() && m_groupList.empty())
{
- if(!sInstanceSaveManager.lock_instLists)
+ if (!sInstanceSaveManager.lock_instLists)
sInstanceSaveManager.RemoveInstanceSave(GetInstanceId());
return false;
}
@@ -239,7 +239,7 @@ void InstanceSaveManager::_DelHelper(DatabaseType &db, const char *fields, const
va_end(ap);
QueryResult_AutoPtr result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail);
- if(result)
+ if (result)
{
do
{
@@ -416,11 +416,11 @@ void InstanceSaveManager::LoadResetTimes()
ResetTimeMapDiffInstances mapDiffResetInstances;
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance WHERE resettime > 0");
- if( result )
+ if ( result )
{
do
{
- if(time_t resettime = time_t((*result)[3].GetUInt64()))
+ if (time_t resettime = time_t((*result)[3].GetUInt64()))
{
uint32 id = (*result)[0].GetUInt32();
uint32 mapid = (*result)[1].GetUInt32();
@@ -433,7 +433,7 @@ void InstanceSaveManager::LoadResetTimes()
// update reset time for normal instances with the max creature respawn time + X hours
result = WorldDatabase.Query("SELECT MAX(respawntime), instance FROM creature_respawn WHERE instance > 0 GROUP BY instance");
- if( result )
+ if ( result )
{
do
{
@@ -441,7 +441,7 @@ void InstanceSaveManager::LoadResetTimes()
uint32 instance = fields[1].GetUInt32();
time_t resettime = time_t(fields[0].GetUInt64() + 2 * HOUR);
InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance);
- if(itr != instResetTime.end() && itr->second.second != resettime)
+ if (itr != instResetTime.end() && itr->second.second != resettime)
{
CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", uint64(resettime), instance);
itr->second.second = resettime;
@@ -452,14 +452,14 @@ void InstanceSaveManager::LoadResetTimes()
// schedule the reset times
for (InstResetTimeMapDiffType::iterator itr = instResetTime.begin(); itr != instResetTime.end(); ++itr)
- if(itr->second.second > now)
+ if (itr->second.second > now)
ScheduleReset(true, itr->second.second, InstResetEvent(0, PAIR32_LOPART(itr->second.first),Difficulty(PAIR32_HIPART(itr->second.first)),itr->first));
}
// load the global respawn times for raid/heroic instances
uint32 diff = sWorld.getConfig(CONFIG_INSTANCE_RESET_TIME_HOUR) * HOUR;
result = CharacterDatabase.Query("SELECT mapid, difficulty, resettime FROM instance_reset");
- if(result)
+ if (result)
{
do
{
@@ -469,7 +469,7 @@ void InstanceSaveManager::LoadResetTimes()
uint64 oldresettime = fields[2].GetUInt64();
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid,difficulty);
- if(!mapDiff)
+ if (!mapDiff)
{
sLog.outError("InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty);
CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u' AND difficulty = '%u'", mapid,difficulty);
@@ -478,7 +478,7 @@ void InstanceSaveManager::LoadResetTimes()
// update the reset time if the hour in the configs changes
uint64 newresettime = (oldresettime / DAY) * DAY + diff;
- if(oldresettime != newresettime)
+ if (oldresettime != newresettime)
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u' AND difficulty = '%u'", newresettime, mapid, difficulty);
SetResetTimeFor(mapid,difficulty,newresettime);
@@ -506,14 +506,14 @@ void InstanceSaveManager::LoadResetTimes()
period = DAY;
time_t t = GetResetTimeFor(mapid,difficulty);
- if(!t)
+ if (!t)
{
// initialize the reset time
t = today + period + diff;
CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','%u','"UI64FMTD"')", mapid, difficulty, (uint64)t);
}
- if(t < now)
+ if (t < now)
{
// assume that expired instances have already been cleaned
// calculate the next reset time
@@ -528,7 +528,7 @@ void InstanceSaveManager::LoadResetTimes()
uint8 type = 1;
static int tim[4] = {3600, 900, 300, 60};
for (; type < 4; type++)
- if(t - tim[type-1] > now)
+ if (t - tim[type-1] > now)
break;
ScheduleReset(true, t - tim[type-1], InstResetEvent(type, mapid, difficulty, -1));
@@ -543,7 +543,7 @@ void InstanceSaveManager::LoadResetTimes()
void InstanceSaveManager::ScheduleReset(bool add, time_t time, InstResetEvent event)
{
- if(add) m_resetTimeQueue.insert(std::pair<time_t, InstResetEvent>(time, event));
+ if (add) m_resetTimeQueue.insert(std::pair<time_t, InstResetEvent>(time, event));
else
{
// find the event in the queue and remove it
@@ -551,13 +551,13 @@ void InstanceSaveManager::ScheduleReset(bool add, time_t time, InstResetEvent ev
std::pair<ResetTimeQueue::iterator, ResetTimeQueue::iterator> range;
range = m_resetTimeQueue.equal_range(time);
for (itr = range.first; itr != range.second; ++itr)
- if(itr->second == event) { m_resetTimeQueue.erase(itr); return; }
+ if (itr->second == event) { m_resetTimeQueue.erase(itr); return; }
// in case the reset time changed (should happen very rarely), we search the whole queue
- if(itr == range.second)
+ if (itr == range.second)
{
for (itr = m_resetTimeQueue.begin(); itr != m_resetTimeQueue.end(); ++itr)
- if(itr->second == event) { m_resetTimeQueue.erase(itr); return; }
- if(itr == m_resetTimeQueue.end())
+ if (itr->second == event) { m_resetTimeQueue.erase(itr); return; }
+ if (itr == m_resetTimeQueue.end())
sLog.outError("InstanceSaveManager::ScheduleReset: cannot cancel the reset, the event(%d,%d,%d) was not found!", event.type, event.mapid, event.instanceId);
}
}
@@ -569,7 +569,7 @@ void InstanceSaveManager::Update()
while (!m_resetTimeQueue.empty() && (t = m_resetTimeQueue.begin()->first) < now)
{
InstResetEvent &event = m_resetTimeQueue.begin()->second;
- if(event.type == 0)
+ if (event.type == 0)
{
// for individual normal instances, max creature respawn + X hours
_ResetInstance(event.mapid, event.instanceId);
@@ -580,7 +580,7 @@ void InstanceSaveManager::Update()
// global reset/warning for a certain map
time_t resetTime = GetResetTimeFor(event.mapid,event.difficulty);
_ResetOrWarnAll(event.mapid, event.difficulty, event.type != 4, resetTime - now);
- if(event.type != 4)
+ if (event.type != 4)
{
// schedule the next warning/reset
event.type++;
@@ -618,15 +618,15 @@ void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId)
{
sLog.outDebug("InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId);
Map *map = (MapInstanced*)MapManager::Instance().CreateBaseMap(mapid);
- if(!map->Instanceable())
+ if (!map->Instanceable())
return;
InstanceSaveHashMap::iterator itr = m_instanceSaveById.find(instanceId);
- if(itr != m_instanceSaveById.end()) _ResetSave(itr);
+ if (itr != m_instanceSaveById.end()) _ResetSave(itr);
DeleteInstanceFromDB(instanceId); // even if save not loaded
Map* iMap = ((MapInstanced*)map)->FindMap(instanceId);
- if(iMap && iMap->IsDungeon()) ((InstanceMap*)iMap)->Reset(INSTANCE_RESET_RESPAWN_DELAY);
+ if (iMap && iMap->IsDungeon()) ((InstanceMap*)iMap)->Reset(INSTANCE_RESET_RESPAWN_DELAY);
else objmgr.DeleteRespawnTimeForInstance(instanceId); // even if map is not loaded
}
@@ -639,7 +639,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
uint64 now = (uint64)time(NULL);
- if(!warn)
+ if (!warn)
{
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid,difficulty);
if (!mapDiff || !mapDiff->resetTime)
@@ -687,8 +687,8 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
for (mitr = instMaps.begin(); mitr != instMaps.end(); ++mitr)
{
Map *map2 = mitr->second;
- if(!map2->IsDungeon()) continue;
- if(warn) ((InstanceMap*)map2)->SendResetWarnings(timeLeft);
+ if (!map2->IsDungeon()) continue;
+ if (warn) ((InstanceMap*)map2)->SendResetWarnings(timeLeft);
else ((InstanceMap*)map2)->Reset(INSTANCE_RESET_GLOBAL);
}
diff --git a/src/game/ItemEnchantmentMgr.cpp b/src/game/ItemEnchantmentMgr.cpp
index e1d6135d6b0..fd4fdd505e8 100644
--- a/src/game/ItemEnchantmentMgr.cpp
+++ b/src/game/ItemEnchantmentMgr.cpp
@@ -126,13 +126,13 @@ uint32 GenerateEnchSuffixFactor(uint32 item_id)
{
ItemPrototype const *itemProto = objmgr.GetItemPrototype(item_id);
- if(!itemProto)
+ if (!itemProto)
return 0;
- if(!itemProto->RandomSuffix)
+ if (!itemProto->RandomSuffix)
return 0;
RandomPropertiesPointsEntry const *randomProperty = sRandomPropertiesPointsStore.LookupEntry(itemProto->ItemLevel);
- if(!randomProperty)
+ if (!randomProperty)
return 0;
uint32 suffixFactor;
diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp
index 8d7b06227c3..d323f84d016 100644
--- a/src/game/ItemHandler.cpp
+++ b/src/game/ItemHandler.cpp
@@ -41,19 +41,19 @@ void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data )
uint16 src = ( (srcbag << 8) | srcslot );
uint16 dst = ( (dstbag << 8) | dstslot );
- if(src==dst)
+ if (src==dst)
return;
if (count==0)
return; //check count - if zero it's fake packet
- if(!_player->IsValidPos(srcbag,srcslot))
+ if (!_player->IsValidPos(srcbag,srcslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
}
- if(!_player->IsValidPos(dstbag,dstslot))
+ if (!_player->IsValidPos(dstbag,dstslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return;
@@ -71,16 +71,16 @@ void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data )
//sLog.outDebug("STORAGE: receive srcslot = %u, dstslot = %u", srcslot, dstslot);
// prevent attempt swap same item to current position generated by client at special checting sequence
- if(srcslot==dstslot)
+ if (srcslot==dstslot)
return;
- if(!_player->IsValidPos(INVENTORY_SLOT_BAG_0,srcslot))
+ if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0,srcslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
}
- if(!_player->IsValidPos(INVENTORY_SLOT_BAG_0,dstslot))
+ if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0,dstslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return;
@@ -99,13 +99,13 @@ void WorldSession::HandleAutoEquipItemSlotOpcode( WorldPacket & recv_data )
recv_data >> itemguid >> dstslot;
// cheating attempt, client should never send opcode in that case
- if(!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, dstslot))
+ if (!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, dstslot))
return;
Item* item = _player->GetItemByGuid(itemguid);
uint16 dstpos = dstslot | (INVENTORY_SLOT_BAG_0 << 8);
- if(!item || item->GetPos() == dstpos)
+ if (!item || item->GetPos() == dstpos)
return;
_player->SwapItem(item->GetPos(), dstpos);
@@ -123,16 +123,16 @@ void WorldSession::HandleSwapItem( WorldPacket & recv_data )
uint16 dst = ( (dstbag << 8) | dstslot );
// prevent attempt swap same item to current position generated by client at special checting sequence
- if(src==dst)
+ if (src==dst)
return;
- if(!_player->IsValidPos(srcbag,srcslot))
+ if (!_player->IsValidPos(srcbag,srcslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
}
- if(!_player->IsValidPos(dstbag,dstslot))
+ if (!_player->IsValidPos(dstbag,dstslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return;
@@ -150,10 +150,10 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
//sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
Item *pSrcItem = _player->GetItemByPos( srcbag, srcslot );
- if( !pSrcItem )
+ if ( !pSrcItem )
return; // only at cheat
- if(pSrcItem->m_lootGenerated) // prevent swap looting item
+ if (pSrcItem->m_lootGenerated) // prevent swap looting item
{
//best error message found for attempting to swap while looting
_player->SendEquipError( EQUIP_ERR_CANT_DO_RIGHT_NOW, pSrcItem, NULL );
@@ -162,18 +162,18 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
uint16 dest;
uint8 msg = _player->CanEquipItem( NULL_SLOT, dest, pSrcItem, !pSrcItem->IsBag() );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pSrcItem, NULL );
return;
}
uint16 src = pSrcItem->GetPos();
- if(dest==src) // prevent equip in same slot, only at cheat
+ if (dest==src) // prevent equip in same slot, only at cheat
return;
Item *pDstItem = _player->GetItemByPos( dest );
- if( !pDstItem ) // empty slot, simple case
+ if ( !pDstItem ) // empty slot, simple case
{
_player->RemoveItem( srcbag, srcslot, true );
_player->EquipItem( dest, pSrcItem, true );
@@ -185,7 +185,7 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
uint8 dstslot = pDstItem->GetSlot();
msg = _player->CanUnequipItem( dest, !pSrcItem->IsBag() );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pDstItem, NULL );
return;
@@ -194,30 +194,30 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
// check dest->src move possibility
ItemPosCountVec sSrc;
uint16 eSrc = 0;
- if( _player->IsInventoryPos( src ) )
+ if ( _player->IsInventoryPos( src ) )
{
msg = _player->CanStoreItem( srcbag, srcslot, sSrc, pDstItem, true );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
msg = _player->CanStoreItem( srcbag, NULL_SLOT, sSrc, pDstItem, true );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, sSrc, pDstItem, true );
}
- else if( _player->IsBankPos( src ) )
+ else if ( _player->IsBankPos( src ) )
{
msg = _player->CanBankItem( srcbag, srcslot, sSrc, pDstItem, true );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
msg = _player->CanBankItem( srcbag, NULL_SLOT, sSrc, pDstItem, true );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, sSrc, pDstItem, true );
}
- else if( _player->IsEquipmentPos( src ) )
+ else if ( _player->IsEquipmentPos( src ) )
{
msg = _player->CanEquipItem( srcslot, eSrc, pDstItem, true);
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
msg = _player->CanUnequipItem( eSrc, true);
}
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pDstItem, pSrcItem );
return;
@@ -231,11 +231,11 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
_player->EquipItem(dest, pSrcItem, true);
// add to src
- if( _player->IsInventoryPos( src ) )
+ if ( _player->IsInventoryPos( src ) )
_player->StoreItem(sSrc, pDstItem, true);
- else if( _player->IsBankPos( src ) )
+ else if ( _player->IsBankPos( src ) )
_player->BankItem(sSrc, pDstItem, true);
- else if( _player->IsEquipmentPos( src ) )
+ else if ( _player->IsEquipmentPos( src ) )
_player->EquipItem(eSrc, pDstItem, true);
_player->AutoUnequipOffhandIfNeed();
@@ -253,10 +253,10 @@ void WorldSession::HandleDestroyItemOpcode( WorldPacket & recv_data )
uint16 pos = (bag << 8) | slot;
// prevent drop unequipable items (in combat, for example) and non-empty bags
- if(_player->IsEquipmentPos(pos) || _player->IsBagPos(pos))
+ if (_player->IsEquipmentPos(pos) || _player->IsBagPos(pos))
{
uint8 msg = _player->CanUnequipItem( pos, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, _player->GetItemByPos(pos), NULL );
return;
@@ -264,13 +264,13 @@ void WorldSession::HandleDestroyItemOpcode( WorldPacket & recv_data )
}
Item *pItem = _player->GetItemByPos( bag, slot );
- if(!pItem)
+ if (!pItem)
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
}
- if(count)
+ if (count)
{
uint32 i_count = count;
_player->DestroyItemCount( pItem, i_count, true );
@@ -289,7 +289,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
sLog.outDetail("STORAGE: Item Query = %u", item);
ItemPrototype const *pProto = objmgr.GetItemPrototype( item );
- if( pProto )
+ if ( pProto )
{
std::string Name = pProto->Name1;
std::string Description = pProto->Description;
@@ -370,7 +370,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
// send DBC data for cooldowns in same way as it used in Spell::SendSpellCooldown
// use `item_template` or if not set then only use spell cooldowns
SpellEntry const* spell = sSpellStore.LookupEntry(pProto->Spells[s].SpellId);
- if(spell)
+ if (spell)
{
bool db_data = pProto->Spells[s].SpellCooldown >= 0 || pProto->Spells[s].SpellCategoryCooldown >= 0;
@@ -378,7 +378,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
data << pProto->Spells[s].SpellTrigger;
data << uint32(-abs(pProto->Spells[s].SpellCharges));
- if(db_data)
+ if (db_data)
{
data << uint32(pProto->Spells[s].SpellCooldown);
data << uint32(pProto->Spells[s].SpellCategory);
@@ -452,12 +452,12 @@ void WorldSession::HandleReadItem( WorldPacket & recv_data )
//sLog.outDetail("STORAGE: Read bag = %u, slot = %u", bag, slot);
Item *pItem = _player->GetItemByPos( bag, slot );
- if( pItem && pItem->GetProto()->PageText )
+ if ( pItem && pItem->GetProto()->PageText )
{
WorldPacket data;
uint8 msg = _player->CanUseItem( pItem );
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
{
data.Initialize (SMSG_READ_ITEM_OK, 8);
sLog.outDetail("STORAGE: Item page sent");
@@ -496,7 +496,7 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
recv_data >> vendorguid >> itemguid >> count;
- if(!itemguid)
+ if (!itemguid)
return;
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR);
@@ -508,42 +508,42 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Item *pItem = _player->GetItemByGuid( itemguid );
- if( pItem )
+ if ( pItem )
{
// prevent sell not owner item
- if(_player->GetGUID()!=pItem->GetOwnerGUID())
+ if (_player->GetGUID()!=pItem->GetOwnerGUID())
{
_player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
return;
}
// prevent sell non empty bag by drag-and-drop at vendor's item list
- if(pItem->IsBag() && !((Bag*)pItem)->IsEmpty())
+ if (pItem->IsBag() && !((Bag*)pItem)->IsEmpty())
{
_player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
return;
}
// prevent sell currently looted item
- if(_player->GetLootGUID()==pItem->GetGUID())
+ if (_player->GetLootGUID()==pItem->GetGUID())
{
_player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
return;
}
// special case at auto sell (sell all)
- if(count==0)
+ if (count==0)
{
count = pItem->GetCount();
}
else
{
// prevent sell more items that exist in stack (possible only not from client)
- if(count > pItem->GetCount())
+ if (count > pItem->GetCount())
{
_player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
return;
@@ -551,11 +551,11 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
}
ItemPrototype const *pProto = pItem->GetProto();
- if( pProto )
+ if ( pProto )
{
- if( pProto->SellPrice > 0 )
+ if ( pProto->SellPrice > 0 )
{
- if(count < pItem->GetCount()) // need split items
+ if (count < pItem->GetCount()) // need split items
{
Item *pNewItem = pItem->CloneItem( count, _player );
if (!pNewItem)
@@ -567,12 +567,12 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
pItem->SetCount( pItem->GetCount() - count );
_player->ItemRemovedQuestCheck( pItem->GetEntry(), count );
- if( _player->IsInWorld() )
+ if ( _player->IsInWorld() )
pItem->SendUpdateToPlayer( _player );
pItem->SetState(ITEM_CHANGED, _player);
_player->AddItemToBuyBackSlot( pNewItem );
- if( _player->IsInWorld() )
+ if ( _player->IsInWorld() )
pNewItem->SendUpdateToPlayer( _player );
}
else
@@ -611,14 +611,14 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Item *pItem = _player->GetItemFromBuyBackSlot( slot );
- if( pItem )
+ if ( pItem )
{
uint32 price = _player->GetUInt32Value( PLAYER_FIELD_BUYBACK_PRICE_1 + slot - BUYBACK_SLOT_START );
- if( _player->GetMoney() < price )
+ if ( _player->GetMoney() < price )
{
_player->SendBuyError( BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, pItem->GetEntry(), 0);
return;
@@ -626,7 +626,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
ItemPosCountVec dest;
uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
{
_player->ModifyMoney( -(int32)price );
_player->RemoveItemFromBuyBackSlot( slot, false );
@@ -695,7 +695,7 @@ void WorldSession::HandleListInventoryOpcode( WorldPacket & recv_data )
recv_data >> guid;
- if(!GetPlayer()->isAlive())
+ if (!GetPlayer()->isAlive())
return;
sLog.outDebug( "WORLD: Recvd CMSG_LIST_INVENTORY" );
@@ -716,14 +716,14 @@ void WorldSession::SendListInventory( uint64 vendorguid )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// Stop the npc if moving
pCreature->StopMoving();
VendorItemData const* vItems = pCreature->GetVendorItems();
- if(!vItems)
+ if (!vItems)
{
_player->SendSellError( SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
return;
@@ -740,11 +740,11 @@ void WorldSession::SendListInventory( uint64 vendorguid )
for (int i = 0; i < numitems; ++i )
{
- if(VendorItem const* crItem = vItems->GetItem(i))
+ if (VendorItem const* crItem = vItems->GetItem(i))
{
- if(ItemPrototype const *pProto = objmgr.GetItemPrototype(crItem->item))
+ if (ItemPrototype const *pProto = objmgr.GetItemPrototype(crItem->item))
{
- if((pProto->AllowableClass & _player->getClassMask()) == 0 && pProto->Bonding == BIND_WHEN_PICKED_UP && !_player->isGameMaster())
+ if ((pProto->AllowableClass & _player->getClassMask()) == 0 && pProto->Bonding == BIND_WHEN_PICKED_UP && !_player->isGameMaster())
continue;
// Only display items in vendor lists for the team the
// player is on. If GM on, display all items.
@@ -786,10 +786,10 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
//sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u", srcbag, srcslot, dstbag);
Item *pItem = _player->GetItemByPos( srcbag, srcslot );
- if( !pItem )
+ if ( !pItem )
return;
- if(!_player->IsValidPos(dstbag,NULL_SLOT))
+ if (!_player->IsValidPos(dstbag,NULL_SLOT))
{
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return;
@@ -798,10 +798,10 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
uint16 src = pItem->GetPos();
// check unequip potability for equipped items and bank bags
- if(_player->IsEquipmentPos ( src ) || _player->IsBagPos ( src ))
+ if (_player->IsEquipmentPos ( src ) || _player->IsBagPos ( src ))
{
uint8 msg = _player->CanUnequipItem( src, !_player->IsBagPos ( src ));
- if(msg != EQUIP_ERR_OK)
+ if (msg != EQUIP_ERR_OK)
{
_player->SendEquipError( msg, pItem, NULL );
return;
@@ -810,14 +810,14 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
ItemPosCountVec dest;
uint8 msg = _player->CanStoreItem( dstbag, NULL_SLOT, dest, pItem, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
}
// no-op: placed in same slot
- if(dest.size()==1 && dest[0].pos==src)
+ if (dest.size()==1 && dest[0].pos==src)
{
// just remove grey item state
_player->SendEquipError( EQUIP_ERR_NONE, pItem, NULL );
@@ -838,7 +838,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
// cheating protection
/* not critical if "cheated", and check skip allow by slots in bank windows open by .bank command.
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER);
- if(!pCreature)
+ if (!pCreature)
{
sLog.outDebug( "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
return;
@@ -854,7 +854,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
BankBagSlotPricesEntry const* slotEntry = sBankBagSlotPricesStore.LookupEntry(slot);
- if(!slotEntry)
+ if (!slotEntry)
return;
uint32 price = slotEntry->price;
@@ -877,12 +877,12 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
Item *pItem = _player->GetItemByPos( srcbag, srcslot );
- if( !pItem )
+ if ( !pItem )
return;
ItemPosCountVec dest;
uint8 msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
@@ -901,14 +901,14 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
Item *pItem = _player->GetItemByPos( srcbag, srcslot );
- if( !pItem )
+ if ( !pItem )
return;
- if(_player->IsBankPos(srcbag, srcslot)) // moving from bank to inventory
+ if (_player->IsBankPos(srcbag, srcslot)) // moving from bank to inventory
{
ItemPosCountVec dest;
uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
@@ -921,7 +921,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
{
ItemPosCountVec dest;
uint8 msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
@@ -934,7 +934,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data)
{
- if(!GetPlayer()->isAlive())
+ if (!GetPlayer()->isAlive())
{
GetPlayer()->SendEquipError( EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL );
return;
@@ -945,7 +945,7 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data)
recv_data >> item;
- if(!item)
+ if (!item)
GetPlayer()->RemoveAmmo();
else
GetPlayer()->SetAmmo(item);
@@ -981,7 +981,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
sLog.outDebug("WORLD: CMSG_ITEM_NAME_QUERY %u", itemid);
ItemPrototype const *pProto = objmgr.GetItemPrototype( itemid );
- if( pProto )
+ if ( pProto )
{
std::string Name;
Name = pProto->Name1;
@@ -1009,7 +1009,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
/* else
{
// listed in dbc or not expected to exist unknown item
- if(sItemStore.LookupEntry(itemid))
+ if (sItemStore.LookupEntry(itemid))
sLog.outErrorDb("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (item listed in Item.dbc but not exist in DB)", itemid);
else
sLog.outError("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (unknown item, not listed in Item.dbc)", itemid);
@@ -1029,13 +1029,13 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
sLog.outDebug("WRAP: receive gift_bag = %u, gift_slot = %u, item_bag = %u, item_slot = %u", gift_bag, gift_slot, item_bag, item_slot);
Item *gift = _player->GetItemByPos( gift_bag, gift_slot );
- if(!gift)
+ if (!gift)
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL );
return;
}
- if(!gift->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPER))// cheating: non-wrapper wrapper
+ if (!gift->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPER))// cheating: non-wrapper wrapper
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL );
return;
@@ -1043,50 +1043,50 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
Item *item = _player->GetItemByPos( item_bag, item_slot );
- if( !item )
+ if ( !item )
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, item, NULL );
return;
}
- if(item==gift) // not possable with pacjket from real client
+ if (item==gift) // not possable with pacjket from real client
{
_player->SendEquipError( EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL );
return;
}
- if(item->IsEquipped())
+ if (item->IsEquipped())
{
_player->SendEquipError( EQUIP_ERR_EQUIPPED_CANT_BE_WRAPPED, item, NULL );
return;
}
- if(item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
+ if (item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
{
_player->SendEquipError( EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL );
return;
}
- if(item->IsBag())
+ if (item->IsBag())
{
_player->SendEquipError( EQUIP_ERR_BAGS_CANT_BE_WRAPPED, item, NULL );
return;
}
- if(item->IsSoulBound())
+ if (item->IsSoulBound())
{
_player->SendEquipError( EQUIP_ERR_BOUND_CANT_BE_WRAPPED, item, NULL );
return;
}
- if(item->GetMaxStackCount() != 1)
+ if (item->GetMaxStackCount() != 1)
{
_player->SendEquipError( EQUIP_ERR_STACKABLE_CANT_BE_WRAPPED, item, NULL );
return;
}
// maybe not correct check (it is better than nothing)
- if(item->GetProto()->MaxCount>0)
+ if (item->GetProto()->MaxCount>0)
{
_player->SendEquipError( EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, NULL );
return;
@@ -1109,7 +1109,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
item->SetUInt32Value(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
item->SetState(ITEM_CHANGED, _player);
- if(item->GetState()==ITEM_NEW) // save new item, to have alway for `character_gifts` record in `item_instance`
+ if (item->GetState()==ITEM_NEW) // save new item, to have alway for `character_gifts` record in `item_instance`
{
// after save it will be impossible to remove the item from the queue
item->RemoveFromUpdateQueueOf(_player);
@@ -1129,7 +1129,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
uint64 gem_guids[MAX_GEM_SOCKETS];
recv_data >> item_guid;
- if(!item_guid)
+ if (!item_guid)
return;
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
@@ -1141,11 +1141,11 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
return;
Item *itemTarget = _player->GetItemByGuid(item_guid);
- if(!itemTarget) //missing item to socket
+ if (!itemTarget) //missing item to socket
return;
ItemPrototype const* itemProto = itemTarget->GetProto();
- if(!itemProto)
+ if (!itemProto)
return;
//this slot is excepted when applying / removing meta gem bonus
@@ -1168,11 +1168,11 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
if (!itemProto->Socket[i].Color)
{
// no prismatic socket
- if(!itemTarget->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT))
+ if (!itemTarget->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT))
return;
// not first not-colored (not normaly used) socket
- if(i!=0 && !itemProto->Socket[i-1].Color && (i+1 >= MAX_GEM_SOCKETS || itemProto->Socket[i+1].Color))
+ if (i!=0 && !itemProto->Socket[i-1].Color && (i+1 >= MAX_GEM_SOCKETS || itemProto->Socket[i+1].Color))
return;
// ok, this is first not colored socket for item with prismatic socket
@@ -1198,7 +1198,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
// check unique-equipped conditions
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
{
- if(!Gems[i])
+ if (!Gems[i])
continue;
// continue check for case when attempt add 2 similar unique equipped gems in one item.
@@ -1209,7 +1209,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
{
for (int j = 0; j < MAX_GEM_SOCKETS; ++j)
{
- if(i==j) // skip self
+ if (i==j) // skip self
continue;
if (Gems[j])
@@ -1220,9 +1220,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
return;
}
}
- else if(OldEnchants[j])
+ else if (OldEnchants[j])
{
- if(SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
+ if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
{
if (iGemProto->ItemId == enchantEntry->GemID)
{
@@ -1239,7 +1239,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
int32 limit_newcount = 0;
if (iGemProto->ItemLimitCategory)
{
- if(ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(iGemProto->ItemLimitCategory))
+ if (ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(iGemProto->ItemLimitCategory))
{
for (int j = 0; j < MAX_GEM_SOCKETS; ++j)
{
@@ -1248,8 +1248,8 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
// destroyed gem
if (OldEnchants[j])
{
- if(SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
- if(ItemPrototype const* jProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID))
+ if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
+ if (ItemPrototype const* jProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID))
if (iGemProto->ItemLimitCategory == jProto->ItemLimitCategory)
--limit_newcount;
}
@@ -1259,16 +1259,16 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
++limit_newcount;
}
// existed gem
- else if(OldEnchants[j])
+ else if (OldEnchants[j])
{
- if(SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
- if(ItemPrototype const* jProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID))
+ if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
+ if (ItemPrototype const* jProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID))
if (iGemProto->ItemLimitCategory == jProto->ItemLimitCategory)
++limit_newcount;
}
}
- if(limit_newcount > 0 && uint32(limit_newcount) > limitEntry->maxCount)
+ if (limit_newcount > 0 && uint32(limit_newcount) > limitEntry->maxCount)
{
_player->SendEquipError( EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL );
return;
@@ -1277,9 +1277,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
}
// for equipped item check all equipment for duplicate equipped gems
- if(itemTarget->IsEquipped())
+ if (itemTarget->IsEquipped())
{
- if(uint8 res = _player->CanEquipUniqueItem(Gems[i],slot,limit_newcount >= 0 ? limit_newcount : 0))
+ if (uint8 res = _player->CanEquipUniqueItem(Gems[i],slot,limit_newcount >= 0 ? limit_newcount : 0))
{
_player->SendEquipError( res, itemTarget, NULL );
return;
@@ -1298,10 +1298,10 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
{
- if(GemEnchants[i])
+ if (GemEnchants[i])
{
itemTarget->SetEnchantment(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT+i), GemEnchants[i],0,0);
- if(Item* guidItem = _player->GetItemByGuid(gem_guids[i]))
+ if (Item* guidItem = _player->GetItemByGuid(gem_guids[i]))
_player->DestroyItem(guidItem->GetBagSlot(), guidItem->GetSlot(), true );
}
}
@@ -1310,7 +1310,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
_player->ApplyEnchantment(itemTarget,EnchantmentSlot(enchant_slot),true);
bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();//current socketbonus state
- if(SocketBonusActivated ^ SocketBonusToBeActivated) //if there was a change...
+ if (SocketBonusActivated ^ SocketBonusToBeActivated) //if there was a change...
{
_player->ApplyEnchantment(itemTarget,BONUS_ENCHANTMENT_SLOT,false);
itemTarget->SetEnchantment(BONUS_ENCHANTMENT_SLOT, (SocketBonusToBeActivated ? itemTarget->GetProto()->socketBonus : 0), 0, 0);
@@ -1330,15 +1330,15 @@ void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data)
recv_data >> eslot;
// apply only to equipped item
- if(!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0,eslot))
+ if (!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0,eslot))
return;
Item* item = GetPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, eslot);
- if(!item)
+ if (!item)
return;
- if(!item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
+ if (!item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
return;
GetPlayer()->ApplyEnchantment(item,TEMP_ENCHANTMENT_SLOT,false);
diff --git a/src/game/LFGHandler.cpp b/src/game/LFGHandler.cpp
index 72d1db5a5f9..61e31420f5d 100644
--- a/src/game/LFGHandler.cpp
+++ b/src/game/LFGHandler.cpp
@@ -29,7 +29,7 @@
static void AttemptJoin(Player* _player)
{
// skip not can autojoin cases and player group case
- if(!_player->m_lookingForGroup.canAutoJoin() || _player->GetGroup())
+ if (!_player->m_lookingForGroup.canAutoJoin() || _player->GetGroup())
return;
ObjectAccessor::Guard guard(*HashMapHolder<Player>::GetLock());
@@ -39,26 +39,26 @@ static void AttemptJoin(Player* _player)
Player *plr = iter->second;
// skip enemies and self
- if(!plr || plr==_player || plr->GetTeam() != _player->GetTeam())
+ if (!plr || plr==_player || plr->GetTeam() != _player->GetTeam())
continue;
//skip players not in world
- if(!plr->IsInWorld())
+ if (!plr->IsInWorld())
continue;
// skip not auto add, not group leader cases
- if(!plr->GetSession()->LookingForGroup_auto_add || plr->GetGroup() && plr->GetGroup()->GetLeaderGUID()!=plr->GetGUID())
+ if (!plr->GetSession()->LookingForGroup_auto_add || plr->GetGroup() && plr->GetGroup()->GetLeaderGUID()!=plr->GetGUID())
continue;
// skip non auto-join or empty slots, or non compatible slots
- if(!plr->m_lookingForGroup.more.canAutoJoin() || !_player->m_lookingForGroup.HaveInSlot(plr->m_lookingForGroup.more))
+ if (!plr->m_lookingForGroup.more.canAutoJoin() || !_player->m_lookingForGroup.HaveInSlot(plr->m_lookingForGroup.more))
continue;
// attempt create group, or skip
- if(!plr->GetGroup())
+ if (!plr->GetGroup())
{
Group* group = new Group;
- if(!group->Create(plr->GetGUID(), plr->GetName()))
+ if (!group->Create(plr->GetGUID(), plr->GetName()))
{
delete group;
continue;
@@ -68,16 +68,16 @@ static void AttemptJoin(Player* _player)
}
// stop at success join
- if(plr->GetGroup()->AddMember(_player->GetGUID(), _player->GetName()))
+ if (plr->GetGroup()->AddMember(_player->GetGUID(), _player->GetName()))
{
- if( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
+ if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
_player->LeaveLFGChannel();
break;
}
// full
else
{
- if( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER )
+ if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER )
plr->LeaveLFGChannel();
}
}
@@ -86,10 +86,10 @@ static void AttemptJoin(Player* _player)
static void AttemptAddMore(Player* _player)
{
// skip not group leader case
- if(_player->GetGroup() && _player->GetGroup()->GetLeaderGUID()!=_player->GetGUID())
+ if (_player->GetGroup() && _player->GetGroup()->GetLeaderGUID()!=_player->GetGUID())
return;
- if(!_player->m_lookingForGroup.more.canAutoJoin())
+ if (!_player->m_lookingForGroup.more.canAutoJoin())
return;
ObjectAccessor::Guard guard(*HashMapHolder<Player>::GetLock());
@@ -99,24 +99,24 @@ static void AttemptAddMore(Player* _player)
Player *plr = iter->second;
// skip enemies and self
- if(!plr || plr==_player || plr->GetTeam() != _player->GetTeam())
+ if (!plr || plr==_player || plr->GetTeam() != _player->GetTeam())
continue;
- if(!plr->IsInWorld())
+ if (!plr->IsInWorld())
continue;
// skip not auto join or in group
- if(!plr->GetSession()->LookingForGroup_auto_join || plr->GetGroup() )
+ if (!plr->GetSession()->LookingForGroup_auto_join || plr->GetGroup() )
continue;
- if(!plr->m_lookingForGroup.HaveInSlot(_player->m_lookingForGroup.more))
+ if (!plr->m_lookingForGroup.HaveInSlot(_player->m_lookingForGroup.more))
continue;
// attempt create group if need, or stop attempts
- if(!_player->GetGroup())
+ if (!_player->GetGroup())
{
Group* group = new Group;
- if(!group->Create(_player->GetGUID(), _player->GetName()))
+ if (!group->Create(_player->GetGUID(), _player->GetName()))
{
delete group;
return; // can't create group (??)
@@ -126,22 +126,22 @@ static void AttemptAddMore(Player* _player)
}
// stop at join fail (full)
- if(!_player->GetGroup()->AddMember(plr->GetGUID(), plr->GetName()) )
+ if (!_player->GetGroup()->AddMember(plr->GetGUID(), plr->GetName()) )
{
- if( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
+ if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
_player->LeaveLFGChannel();
break;
}
// joined
- if( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER )
+ if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER )
plr->LeaveLFGChannel();
// and group full
- if(_player->GetGroup()->IsFull() )
+ if (_player->GetGroup()->IsFull() )
{
- if( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
+ if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
_player->LeaveLFGChannel();
break;
@@ -154,7 +154,7 @@ void WorldSession::HandleLfgSetAutoJoinOpcode( WorldPacket & /*recv_data*/ )
sLog.outDebug("CMSG_LFG_SET_AUTOJOIN");
LookingForGroup_auto_join = true;
- if(!_player) // needed because STATUS_AUTHED
+ if (!_player) // needed because STATUS_AUTHED
return;
AttemptJoin(_player);
@@ -171,7 +171,7 @@ void WorldSession::HandleLfmSetAutoFillOpcode( WorldPacket & /*recv_data*/ )
sLog.outDebug("CMSG_LFM_SET_AUTOFILL");
LookingForGroup_auto_add = true;
- if(!_player) // needed because STATUS_AUTHED
+ if (!_player) // needed because STATUS_AUTHED
return;
AttemptAddMore(_player);
@@ -191,7 +191,7 @@ void WorldSession::HandleLfgClearOpcode( WorldPacket & /*recv_data */ )
for (int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
_player->m_lookingForGroup.slots[i].Clear();
- if( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
+ if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
_player->LeaveLFGChannel();
SendLfgUpdate(0, 0, 0);
@@ -221,7 +221,7 @@ void WorldSession::HandleSetLfmOpcode( WorldPacket & recv_data )
_player->m_lookingForGroup.more.Set(entry,type);
sLog.outDebug("LFM set: temp %u, zone %u, type %u", temp, entry, type);
- if(LookingForGroup_auto_add)
+ if (LookingForGroup_auto_add)
AttemptAddMore(_player);
SendLfgResult(type, entry, 1);
@@ -248,10 +248,10 @@ void WorldSession::HandleLookingForGroup(WorldPacket& recv_data)
recv_data >> type >> entry >> unk;
sLog.outDebug("MSG_LOOKING_FOR_GROUP: type %u, entry %u, unk %u", type, entry, unk);
- if(LookingForGroup_auto_add)
+ if (LookingForGroup_auto_add)
AttemptAddMore(_player);
- if(LookingForGroup_auto_join)
+ if (LookingForGroup_auto_join)
AttemptJoin(_player);
SendLfgResult(type, entry, 0);
@@ -267,7 +267,7 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
data << uint32(entry); // entry from LFGDungeons.dbc
data << uint8(0);
- if(uint8)
+ if (uint8)
{
uint32 count1;
for (count1)
@@ -282,15 +282,15 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
{
uint64 // not player guid
uint32 flags;
- if(flags & 0x2)
+ if (flags & 0x2)
{
string
}
- if(flags & 0x10)
+ if (flags & 0x10)
{
uint8
}
- if(flags & 0x20)
+ if (flags & 0x20)
{
for (3)
{
@@ -309,13 +309,13 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
{
Player *plr = iter->second;
- if(!plr || plr->GetTeam() != _player->GetTeam())
+ if (!plr || plr->GetTeam() != _player->GetTeam())
continue;
- if(!plr->IsInWorld())
+ if (!plr->IsInWorld())
continue;
- if(!plr->m_lookingForGroup.HaveInSlot(entry, type))
+ if (!plr->m_lookingForGroup.HaveInSlot(entry, type))
continue;
++number;
@@ -325,7 +325,7 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
uint32 flags = 0x1FF;
data << uint32(flags); // flags
- if(flags & 0x1)
+ if (flags & 0x1)
{
data << uint8(plr->getLevel());
data << uint8(plr->getClass());
@@ -356,28 +356,28 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
data << uint32(0); // unk
}
- if(flags & 0x2)
+ if (flags & 0x2)
data << plr->m_lookingForGroup.comment; // comment
- if(flags & 0x4)
+ if (flags & 0x4)
data << uint8(0); // unk
- if(flags & 0x8)
+ if (flags & 0x8)
data << uint64(0); // guid from count2 block, not player guid
- if(flags & 0x10)
+ if (flags & 0x10)
data << uint8(0); // unk
- if(flags & 0x20)
+ if (flags & 0x20)
data << uint8(plr->m_lookingForGroup.roles); // roles
- if(flags & 0x40)
+ if (flags & 0x40)
data << uint32(plr->GetZoneId()); // areaid
- if(flags & 0x100)
+ if (flags & 0x100)
data << uint8(0); // LFG/LFM flag?
- if(flags & 0x80)
+ if (flags & 0x80)
{
for (uint8 j = 0; j < MAX_LOOKING_FOR_GROUP_SLOT; ++j)
{
@@ -404,14 +404,14 @@ void WorldSession::HandleSetLfgOpcode( WorldPacket & recv_data )
entry = ( temp & 0x00FFFFFF);
type = ( (temp >> 24) & 0x000000FF);
- if(slot >= MAX_LOOKING_FOR_GROUP_SLOT)
+ if (slot >= MAX_LOOKING_FOR_GROUP_SLOT)
return;
_player->m_lookingForGroup.slots[slot].Set(entry, type);
_player->m_lookingForGroup.roles = roles;
sLog.outDebug("LFG set: looknumber %u, temp %X, type %u, entry %u", slot, temp, type, entry);
- if(LookingForGroup_auto_join)
+ if (LookingForGroup_auto_join)
AttemptJoin(_player);
//SendLfgResult(type, entry, 0);
diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp
index 3117bfaacb0..94533d3354b 100644
--- a/src/game/Level0.cpp
+++ b/src/game/Level0.cpp
@@ -34,14 +34,14 @@
bool ChatHandler::HandleHelpCommand(const char* args)
{
char* cmd = strtok((char*)args, " ");
- if(!cmd)
+ if (!cmd)
{
ShowHelpForCommand(getCommandTable(), "help");
ShowHelpForCommand(getCommandTable(), "");
}
else
{
- if(!ShowHelpForCommand(getCommandTable(), cmd))
+ if (!ShowHelpForCommand(getCommandTable(), cmd))
SendSysMessage(LANG_NO_HELP_CMD);
}
@@ -65,21 +65,21 @@ bool ChatHandler::HandleStartCommand(const char* /*args*/)
{
Player *chr = m_session->GetPlayer();
- if(chr->isInFlight())
+ if (chr->isInFlight())
{
SendSysMessage(LANG_YOU_IN_FLIGHT);
SetSentErrorMessage(true);
return false;
}
- if(chr->isInCombat())
+ if (chr->isInCombat())
{
SendSysMessage(LANG_YOU_IN_COMBAT);
SetSentErrorMessage(true);
return false;
}
- if((chr->isDead()) || (chr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)))
+ if ((chr->isDead()) || (chr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)))
{
// if player is dead and stuck, send ghost to graveyard
chr->RepopAtGraveyard();
@@ -103,7 +103,7 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
uint32 updateTime = sWorld.GetUpdateTime();
PSendSysMessage(_FULLVERSION);
- //if(m_session)
+ //if (m_session)
// full = _FULLVERSION(REVISION_DATE,REVISION_TIME,"|cffffffff|Hurl:" REVISION_ID "|h" REVISION_ID "|h|r");
//else
// full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_ID);
@@ -129,7 +129,7 @@ bool ChatHandler::HandleDismountCommand(const char* /*args*/)
return false;
}
- if(m_session->GetPlayer( )->isInFlight())
+ if (m_session->GetPlayer( )->isInFlight())
{
SendSysMessage(LANG_YOU_IN_FLIGHT);
SetSentErrorMessage(true);
@@ -146,7 +146,7 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/)
Player *player=m_session->GetPlayer();
// save GM account without delay and output message (testing, etc)
- if(m_session->GetSecurity() > SEC_PLAYER)
+ if (m_session->GetSecurity() > SEC_PLAYER)
{
player->SaveToDB();
SendSysMessage(LANG_PLAYER_SAVED);
@@ -173,7 +173,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= sWorld.getConfig(CONFIG_GM_LEVEL_IN_GM_LIST))) &&
(!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())))
{
- if(first)
+ if (first)
{
SendSysMessage(LANG_GMS_ON_SRV);
first = false;
@@ -183,7 +183,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
}
}
- if(first)
+ if (first)
SendSysMessage(LANG_GMS_NOT_LOGGED);
return true;
@@ -191,7 +191,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
bool ChatHandler::HandleAccountPasswordCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char *old_pass = strtok ((char*)args, " ");
@@ -242,7 +242,7 @@ bool ChatHandler::HandleAccountPasswordCommand(const char* args)
bool ChatHandler::HandleAccountAddonCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char *szExp = strtok((char*)args," ");
@@ -250,7 +250,7 @@ bool ChatHandler::HandleAccountAddonCommand(const char* args)
uint32 account_id = m_session->GetAccountId();
int expansion=atoi(szExp); //get int anyway (0 if error)
- if(expansion < 0 || expansion > sWorld.getConfig(CONFIG_EXPANSION))
+ if (expansion < 0 || expansion > sWorld.getConfig(CONFIG_EXPANSION))
return false;
// No SQL injection
diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp
index 360810801a1..77aa0e49b75 100644
--- a/src/game/Level1.cpp
+++ b/src/game/Level1.cpp
@@ -43,11 +43,11 @@
//-----------------------Npc Commands-----------------------
bool ChatHandler::HandleNpcSayCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
Creature* pCreature = getSelectedCreature();
- if(!pCreature)
+ if (!pCreature)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -70,11 +70,11 @@ bool ChatHandler::HandleNpcSayCommand(const char* args)
bool ChatHandler::HandleNpcYellCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
Creature* pCreature = getSelectedCreature();
- if(!pCreature)
+ if (!pCreature)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -92,12 +92,12 @@ bool ChatHandler::HandleNpcYellCommand(const char* args)
//show text emote by creature in chat
bool ChatHandler::HandleNpcTextEmoteCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
Creature* pCreature = getSelectedCreature();
- if(!pCreature)
+ if (!pCreature)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -112,7 +112,7 @@ bool ChatHandler::HandleNpcTextEmoteCommand(const char* args)
// make npc whisper to player
bool ChatHandler::HandleNpcWhisperCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char* receiver_str = strtok((char*)args, " ");
@@ -121,7 +121,7 @@ bool ChatHandler::HandleNpcWhisperCommand(const char* args)
uint64 guid = m_session->GetPlayer()->GetSelection();
Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(guid);
- if(!pCreature || !receiver_str || !text)
+ if (!pCreature || !receiver_str || !text)
{
return false;
}
@@ -141,7 +141,7 @@ bool ChatHandler::HandleNpcWhisperCommand(const char* args)
bool ChatHandler::HandleNameAnnounceCommand(const char* args)
{
WorldPacket data;
- if(!*args)
+ if (!*args)
return false;
sWorld.SendWorldText(LANG_ANNOUNCE_COLOR, m_session->GetPlayer()->GetName(), args);
@@ -151,7 +151,7 @@ bool ChatHandler::HandleNameAnnounceCommand(const char* args)
bool ChatHandler::HandleGMNameAnnounceCommand(const char* args)
{
WorldPacket data;
- if(!*args)
+ if (!*args)
return false;
sWorld.SendGMText(LANG_GM_ANNOUNCE_COLOR, m_session->GetPlayer()->GetName(), args);
@@ -161,7 +161,7 @@ bool ChatHandler::HandleGMNameAnnounceCommand(const char* args)
// global announce
bool ChatHandler::HandleAnnounceCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
sWorld.SendWorldText(LANG_SYSTEMMESSAGE,args);
@@ -171,7 +171,7 @@ bool ChatHandler::HandleAnnounceCommand(const char* args)
// announce to logged in GMs
bool ChatHandler::HandleGMAnnounceCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
sWorld.SendGMText(LANG_GM_BROADCAST,args);
@@ -181,7 +181,7 @@ bool ChatHandler::HandleGMAnnounceCommand(const char* args)
//notification player at the screen
bool ChatHandler::HandleNotifyCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
std::string str = GetTrinityString(LANG_GLOBAL_NOTIFY);
@@ -197,7 +197,7 @@ bool ChatHandler::HandleNotifyCommand(const char* args)
//notification GM at the screen
bool ChatHandler::HandleGMNotifyCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
std::string str = GetTrinityString(LANG_GM_NOTIFY);
@@ -213,9 +213,9 @@ bool ChatHandler::HandleGMNotifyCommand(const char* args)
//Enable\Dissable GM Mode
bool ChatHandler::HandleGMCommand(const char* args)
{
- if(!*args)
+ if (!*args)
{
- if(m_session->GetPlayer()->isGameMaster())
+ if (m_session->GetPlayer()->isGameMaster())
m_session->SendNotification(LANG_GM_ON);
else
m_session->SendNotification(LANG_GM_OFF);
@@ -254,9 +254,9 @@ bool ChatHandler::HandleGMCommand(const char* args)
// Enables or disables hiding of the staff badge
bool ChatHandler::HandleGMChatCommand(const char* args)
{
- if(!*args)
+ if (!*args)
{
- if(m_session->GetPlayer()->isGMChat())
+ if (m_session->GetPlayer()->isGMChat())
m_session->SendNotification(LANG_GM_CHAT_ON);
else
m_session->SendNotification(LANG_GM_CHAT_OFF);
@@ -300,7 +300,7 @@ bool ChatHandler::HandleGMTicketListCommand(const char* args)
SendSysMessage(LANG_COMMAND_TICKETSHOWLIST);
for (GmTicketList::iterator itr = objmgr.m_GMTicketList.begin(); itr != objmgr.m_GMTicketList.end(); ++itr)
{
- if((*itr)->closed != 0)
+ if ((*itr)->closed != 0)
continue;
std::string gmname;
std::stringstream ss;
@@ -308,7 +308,7 @@ bool ChatHandler::HandleGMTicketListCommand(const char* args)
ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, (*itr)->name.c_str());
ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - (*itr)->createtime, true, false)).c_str());
ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - (*itr)->timestamp, true, false)).c_str());
- if(objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname))
+ if (objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname))
{
ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
}
@@ -322,7 +322,7 @@ bool ChatHandler::HandleGMTicketListOnlineCommand(const char* args)
SendSysMessage(LANG_COMMAND_TICKETSHOWONLINELIST);
for (GmTicketList::iterator itr = objmgr.m_GMTicketList.begin(); itr != objmgr.m_GMTicketList.end(); ++itr)
{
- if((*itr)->closed != 0 || !objmgr.GetPlayer((*itr)->playerGuid))
+ if ((*itr)->closed != 0 || !objmgr.GetPlayer((*itr)->playerGuid))
continue;
std::string gmname;
@@ -331,7 +331,7 @@ bool ChatHandler::HandleGMTicketListOnlineCommand(const char* args)
ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, (*itr)->name.c_str());
ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - (*itr)->createtime, true, false)).c_str());
ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - (*itr)->timestamp, true, false)).c_str());
- if(objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname))
+ if (objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname))
{
ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
}
@@ -345,7 +345,7 @@ bool ChatHandler::HandleGMTicketListClosedCommand(const char* args)
SendSysMessage(LANG_COMMAND_TICKETSHOWCLOSEDLIST);
for (GmTicketList::iterator itr = objmgr.m_GMTicketList.begin(); itr != objmgr.m_GMTicketList.end(); ++itr)
{
- if((*itr)->closed == 0)
+ if ((*itr)->closed == 0)
continue;
std::string gmname;
@@ -354,7 +354,7 @@ bool ChatHandler::HandleGMTicketListClosedCommand(const char* args)
ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, (*itr)->name.c_str());
ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - (*itr)->createtime, true, false)).c_str());
ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - (*itr)->timestamp, true, false)).c_str());
- if(objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname))
+ if (objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname))
{
ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
}
@@ -365,12 +365,12 @@ bool ChatHandler::HandleGMTicketListClosedCommand(const char* args)
bool ChatHandler::HandleGMTicketGetByIdCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
uint64 tguid = atoi(args);
GM_Ticket *ticket = objmgr.GetGMTicket(tguid);
- if(!ticket || ticket->closed != 0)
+ if (!ticket || ticket->closed != 0)
{
SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
@@ -382,12 +382,12 @@ bool ChatHandler::HandleGMTicketGetByIdCommand(const char* args)
ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str());
ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - ticket->createtime, true, false)).c_str());
ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - ticket->timestamp, true, false)).c_str());
- if(objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname))
+ if (objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname))
{
ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
}
ss << PGetParseString(LANG_COMMAND_TICKETLISTMESSAGE, ticket->message.c_str());
- if(ticket->comment != "")
+ if (ticket->comment != "")
{
ss << PGetParseString(LANG_COMMAND_TICKETLISTCOMMENT, ticket->comment.c_str());
}
@@ -397,21 +397,21 @@ bool ChatHandler::HandleGMTicketGetByIdCommand(const char* args)
bool ChatHandler::HandleGMTicketGetByNameCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
std::string name = (char*)args;
normalizePlayerName(name);
Player *plr = objmgr.GetPlayer(name.c_str());
- if(!plr)
+ if (!plr)
{
SendSysMessage(LANG_NO_PLAYERS_FOUND);
return true;
}
GM_Ticket *ticket = objmgr.GetGMTicketByPlayer(plr->GetGUID());
- if(!ticket)
+ if (!ticket)
{
SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
@@ -423,12 +423,12 @@ bool ChatHandler::HandleGMTicketGetByNameCommand(const char* args)
ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str());
ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - ticket->createtime, true, false)).c_str());
ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - ticket->timestamp, true, false)).c_str());
- if(objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname))
+ if (objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname))
{
ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
}
ss << PGetParseString(LANG_COMMAND_TICKETLISTMESSAGE, ticket->message.c_str());
- if(ticket->comment != "")
+ if (ticket->comment != "")
{
ss << PGetParseString(LANG_COMMAND_TICKETLISTCOMMENT, ticket->comment.c_str());
}
@@ -438,17 +438,17 @@ bool ChatHandler::HandleGMTicketGetByNameCommand(const char* args)
bool ChatHandler::HandleGMTicketCloseByIdCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
uint64 tguid = atoi(args);
GM_Ticket *ticket = objmgr.GetGMTicket(tguid);
- if(!ticket || ticket->closed != 0)
+ if (!ticket || ticket->closed != 0)
{
SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
- if(ticket && ticket->assignedToGM != 0 && ticket->assignedToGM != m_session->GetPlayer()->GetGUID())
+ if (ticket && ticket->assignedToGM != 0 && ticket->assignedToGM != m_session->GetPlayer()->GetGUID())
{
PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->guid);
return true;
@@ -461,7 +461,7 @@ bool ChatHandler::HandleGMTicketCloseByIdCommand(const char* args)
Player *plr = objmgr.GetPlayer(ticket->playerGuid);
objmgr.RemoveGMTicket(ticket, m_session->GetPlayer()->GetGUID());
- if(!plr || !plr->IsInWorld())
+ if (!plr || !plr->IsInWorld())
return true;
// send abandon ticket
@@ -473,24 +473,24 @@ bool ChatHandler::HandleGMTicketCloseByIdCommand(const char* args)
bool ChatHandler::HandleGMTicketAssignToCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char* tguid = strtok((char*)args, " ");
uint64 ticketGuid = atoi(tguid);
char* targetgm = strtok( NULL, " ");
- if(!targetgm)
+ if (!targetgm)
return false;
std::string targm = targetgm;
- if(!normalizePlayerName(targm))
+ if (!normalizePlayerName(targm))
return false;
Player *cplr = m_session->GetPlayer();
GM_Ticket *ticket = objmgr.GetGMTicket(ticketGuid);
- if(!ticket || ticket->closed != 0)
+ if (!ticket || ticket->closed != 0)
{
SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
@@ -500,13 +500,13 @@ bool ChatHandler::HandleGMTicketAssignToCommand(const char* args)
uint64 accid = objmgr.GetPlayerAccountIdByGUID(tarGUID);
uint32 gmlevel = accmgr.GetSecurity(accid, realmID);
- if(!tarGUID || gmlevel == SEC_PLAYER)
+ if (!tarGUID || gmlevel == SEC_PLAYER)
{
SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A);
return true;
}
- if(ticket->assignedToGM == tarGUID)
+ if (ticket->assignedToGM == tarGUID)
{
PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->guid);
return true;
@@ -514,7 +514,7 @@ bool ChatHandler::HandleGMTicketAssignToCommand(const char* args)
std::string gmname;
objmgr.GetPlayerNameByGUID(tarGUID, gmname);
- if(ticket->assignedToGM != 0 && ticket->assignedToGM != cplr->GetGUID())
+ if (ticket->assignedToGM != 0 && ticket->assignedToGM != cplr->GetGUID())
{
PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->guid, gmname.c_str());
return true;
@@ -532,19 +532,19 @@ bool ChatHandler::HandleGMTicketAssignToCommand(const char* args)
bool ChatHandler::HandleGMTicketUnAssignCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
uint64 ticketGuid = atoi(args);
Player *cplr = m_session->GetPlayer();
GM_Ticket *ticket = objmgr.GetGMTicket(ticketGuid);
- if(!ticket|| ticket->closed != 0)
+ if (!ticket|| ticket->closed != 0)
{
SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
- if(ticket->assignedToGM == 0)
+ if (ticket->assignedToGM == 0)
{
PSendSysMessage(LANG_COMMAND_TICKETNOTASSIGNED, ticket->guid);
return true;
@@ -553,7 +553,7 @@ bool ChatHandler::HandleGMTicketUnAssignCommand(const char* args)
std::string gmname;
objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname);
Player *plr = objmgr.GetPlayer(ticket->assignedToGM);
- if(plr && plr->IsInWorld() && plr->GetSession()->GetSecurity() > cplr->GetSession()->GetSecurity())
+ if (plr && plr->IsInWorld() && plr->GetSession()->GetSecurity() > cplr->GetSession()->GetSecurity())
{
SendSysMessage(LANG_COMMAND_TICKETUNASSIGNSECURITY);
return true;
@@ -572,25 +572,25 @@ bool ChatHandler::HandleGMTicketUnAssignCommand(const char* args)
bool ChatHandler::HandleGMTicketCommentCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char* tguid = strtok((char*)args, " ");
uint64 ticketGuid = atoi(tguid);
char* comment = strtok( NULL, "\n");
- if(!comment)
+ if (!comment)
return false;
Player *cplr = m_session->GetPlayer();
GM_Ticket *ticket = objmgr.GetGMTicket(ticketGuid);
- if(!ticket || ticket->closed != 0)
+ if (!ticket || ticket->closed != 0)
{
PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
- if(ticket->assignedToGM != 0 && ticket->assignedToGM != cplr->GetGUID())
+ if (ticket->assignedToGM != 0 && ticket->assignedToGM != cplr->GetGUID())
{
PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->guid);
return true;
@@ -603,7 +603,7 @@ bool ChatHandler::HandleGMTicketCommentCommand(const char* args)
std::stringstream ss;
ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid);
ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str());
- if(objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname))
+ if (objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname))
{
ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
}
@@ -614,17 +614,17 @@ bool ChatHandler::HandleGMTicketCommentCommand(const char* args)
bool ChatHandler::HandleGMTicketDeleteByIdCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
uint64 ticketGuid = atoi(args);
GM_Ticket *ticket = objmgr.GetGMTicket(ticketGuid);
- if(!ticket)
+ if (!ticket)
{
SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
- if(ticket->closed == 0)
+ if (ticket->closed == 0)
{
SendSysMessage(LANG_COMMAND_TICKETCLOSEFIRST);
return true;
@@ -637,7 +637,7 @@ bool ChatHandler::HandleGMTicketDeleteByIdCommand(const char* args)
SendGlobalGMSysMessage(ss.str().c_str());
Player *plr = objmgr.GetPlayer(ticket->playerGuid);
objmgr.RemoveGMTicket(ticket, -1, true);
- if(plr && plr->IsInWorld())
+ if (plr && plr->IsInWorld())
{
// Force abandon ticket
WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
@@ -691,10 +691,10 @@ bool ChatHandler::HandleGPSCommand(const char* args)
if (*args)
{
uint64 guid = extractGuidFromLink((char*)args);
- if(guid)
+ if (guid)
obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*m_session->GetPlayer(),guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
- if(!obj)
+ if (!obj)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
@@ -705,7 +705,7 @@ bool ChatHandler::HandleGPSCommand(const char* args)
{
obj = getSelectedUnit();
- if(!obj)
+ if (!obj)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@@ -944,7 +944,7 @@ bool ChatHandler::HandleGonameCommand(const char* args)
if (!_player->GetMap()->IsBattleGroundOrArena())
_player->SetBattleGroundEntryPoint();
}
- else if(cMap->IsDungeon())
+ else if (cMap->IsDungeon())
{
Map* pMap = _player->GetMap();
@@ -985,7 +985,7 @@ bool ChatHandler::HandleGonameCommand(const char* args)
_player->BindToInstance(save, !save->CanReset());
}
- if(cMap->IsRaid())
+ if (cMap->IsRaid())
_player->SetRaidDifficulty(target->GetRaidDifficulty());
else
_player->SetDungeonDifficulty(target->GetDungeonDifficulty());
@@ -1049,7 +1049,7 @@ bool ChatHandler::HandleGonameCommand(const char* args)
bool ChatHandler::HandleRecallCommand(const char* args)
{
Player* target;
- if(!extractPlayerTarget((char*)args,&target))
+ if (!extractPlayerTarget((char*)args,&target))
return false;
// check online security
@@ -1064,7 +1064,7 @@ bool ChatHandler::HandleRecallCommand(const char* args)
}
// stop flight if need
- if(target->isInFlight())
+ if (target->isInFlight())
{
target->GetMotionMaster()->MovementExpired();
target->CleanupAfterTaxiFlight();
@@ -1114,7 +1114,7 @@ bool ChatHandler::HandleModifyHPCommand(const char* args)
//Edit Player Mana
bool ChatHandler::HandleModifyManaCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
// char* pmana = strtok((char*)args, " ");
@@ -1162,7 +1162,7 @@ bool ChatHandler::HandleModifyManaCommand(const char* args)
//Edit Player Energy
bool ChatHandler::HandleModifyEnergyCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
// char* pmana = strtok((char*)args, " ");
@@ -1213,7 +1213,7 @@ bool ChatHandler::HandleModifyEnergyCommand(const char* args)
//Edit Player Rage
bool ChatHandler::HandleModifyRageCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
// char* pmana = strtok((char*)args, " ");
@@ -1262,7 +1262,7 @@ bool ChatHandler::HandleModifyRageCommand(const char* args)
// Edit Player Runic Power
bool ChatHandler::HandleModifyRunicPowerCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
int32 rune = atoi((char*)args)*10;
@@ -1296,22 +1296,22 @@ bool ChatHandler::HandleModifyRunicPowerCommand(const char* args)
//Edit Player Faction
bool ChatHandler::HandleModifyFactionCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char* pfactionid = extractKeyFromLink((char*)args,"Hfaction");
Creature* chr = getSelectedCreature();
- if(!chr)
+ if (!chr)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
return false;
}
- if(!pfactionid)
+ if (!pfactionid)
{
- if(chr)
+ if (chr)
{
uint32 factionid = chr->getFaction();
uint32 flag = chr->GetUInt32Value(UNIT_FIELD_FLAGS);
@@ -1322,7 +1322,7 @@ bool ChatHandler::HandleModifyFactionCommand(const char* args)
return true;
}
- if( !chr )
+ if ( !chr )
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
@@ -1341,7 +1341,7 @@ bool ChatHandler::HandleModifyFactionCommand(const char* args)
char* pnpcflag = strtok(NULL, " ");
uint32 npcflag;
- if(!pnpcflag)
+ if (!pnpcflag)
npcflag = chr->GetUInt32Value(UNIT_NPC_FLAGS);
else
npcflag = atoi(pnpcflag);
@@ -1349,12 +1349,12 @@ bool ChatHandler::HandleModifyFactionCommand(const char* args)
char* pdyflag = strtok(NULL, " ");
uint32 dyflag;
- if(!pdyflag)
+ if (!pdyflag)
dyflag = chr->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
else
dyflag = atoi(pdyflag);
- if(!sFactionTemplateStore.LookupEntry(factionid))
+ if (!sFactionTemplateStore.LookupEntry(factionid))
{
PSendSysMessage(LANG_WRONG_FACTION, factionid);
SetSentErrorMessage(true);
@@ -1374,7 +1374,7 @@ bool ChatHandler::HandleModifyFactionCommand(const char* args)
//Edit Player Spell
bool ChatHandler::HandleModifySpellCommand(const char* args)
{
- if(!*args) return false;
+ if (!*args) return false;
char* pspellflatid = strtok((char*)args, " ");
if (!pspellflatid)
return false;
@@ -1394,7 +1394,7 @@ bool ChatHandler::HandleModifySpellCommand(const char* args)
uint8 spellflatid = atoi(pspellflatid);
uint8 op = atoi(pop);
uint16 val = atoi(pval);
- if(!pmark)
+ if (!pmark)
mark = 65535;
else
mark = atoi(pmark);
@@ -1436,14 +1436,14 @@ bool ChatHandler::HandleModifyTalentCommand (const char* args)
return false;
Unit* target = getSelectedUnit();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
}
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
// check online security
if (HasLowerSecurity((Player*)target, 0))
@@ -1452,10 +1452,10 @@ bool ChatHandler::HandleModifyTalentCommand (const char* args)
target->ToPlayer()->SendTalentsInfoData(false);
return true;
}
- else if(target->ToCreature()->isPet())
+ else if (target->ToCreature()->isPet())
{
Unit *owner = target->GetOwner();
- if(owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)target)->IsPermanentPetFor(owner->ToPlayer()))
+ if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)target)->IsPermanentPetFor(owner->ToPlayer()))
{
// check online security
if (HasLowerSecurity((Player*)owner, 0))
@@ -1546,7 +1546,7 @@ bool ChatHandler::HandleModifyASpeedCommand(const char* args)
std::string chrNameLink = GetNameLink(chr);
- if(chr->isInFlight())
+ if (chr->isInFlight())
{
PSendSysMessage(LANG_CHAR_IN_FLIGHT,chrNameLink.c_str());
SetSentErrorMessage(true);
@@ -1594,7 +1594,7 @@ bool ChatHandler::HandleModifySpeedCommand(const char* args)
std::string chrNameLink = GetNameLink(chr);
- if(chr->isInFlight())
+ if (chr->isInFlight())
{
PSendSysMessage(LANG_CHAR_IN_FLIGHT,chrNameLink.c_str());
SetSentErrorMessage(true);
@@ -1639,7 +1639,7 @@ bool ChatHandler::HandleModifySwimCommand(const char* args)
std::string chrNameLink = GetNameLink(chr);
- if(chr->isInFlight())
+ if (chr->isInFlight())
{
PSendSysMessage(LANG_CHAR_IN_FLIGHT,chrNameLink.c_str());
SetSentErrorMessage(true);
@@ -1684,7 +1684,7 @@ bool ChatHandler::HandleModifyBWalkCommand(const char* args)
std::string chrNameLink = GetNameLink(chr);
- if(chr->isInFlight())
+ if (chr->isInFlight())
{
PSendSysMessage(LANG_CHAR_IN_FLIGHT,chrNameLink.c_str());
SetSentErrorMessage(true);
@@ -1774,7 +1774,7 @@ bool ChatHandler::HandleModifyScaleCommand(const char* args)
//Enable Player mount
bool ChatHandler::HandleModifyMountCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
uint16 mId = 1147;
@@ -2098,7 +2098,7 @@ bool ChatHandler::HandleModifyMoneyCommand(const char* args)
//Edit Unit field
bool ChatHandler::HandleModifyBitCommand(const char* args)
{
- if( !*args )
+ if ( !*args )
return false;
Unit *unit = getSelectedUnit();
@@ -2156,7 +2156,7 @@ bool ChatHandler::HandleModifyHonorCommand (const char* args)
return false;
Player *target = getSelectedPlayer();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
@@ -2178,7 +2178,7 @@ bool ChatHandler::HandleModifyHonorCommand (const char* args)
bool ChatHandler::HandleTeleCommand(const char * args)
{
- if(!*args)
+ if (!*args)
return false;
Player* _player = m_session->GetPlayer();
@@ -2201,7 +2201,7 @@ bool ChatHandler::HandleTeleCommand(const char * args)
}
MapEntry const * me = sMapStore.LookupEntry(tele->mapId);
- if(!me || me->IsBattleGroundOrArena())
+ if (!me || me->IsBattleGroundOrArena())
{
SendSysMessage(LANG_CANNOT_TELE_TO_BG);
SetSentErrorMessage(true);
@@ -2209,7 +2209,7 @@ bool ChatHandler::HandleTeleCommand(const char * args)
}
// stop flight if need
- if(_player->isInFlight())
+ if (_player->isInFlight())
{
_player->GetMotionMaster()->MovementExpired();
_player->CleanupAfterTaxiFlight();
@@ -2277,7 +2277,7 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args)
SendSysMessage (ss.str ().c_str());
- if(!found)
+ if (!found)
found = true;
}
}
@@ -2292,7 +2292,7 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args)
//Find tele in game_tele order by name
bool ChatHandler::HandleLookupTeleCommand(const char * args)
{
- if(!*args)
+ if (!*args)
{
SendSysMessage(LANG_COMMAND_TELE_PARAMETER);
SetSentErrorMessage(true);
@@ -2300,13 +2300,13 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args)
}
char const* str = strtok((char*)args, " ");
- if(!str)
+ if (!str)
return false;
std::string namepart = str;
std::wstring wnamepart;
- if(!Utf8toWStr(namepart,wnamepart))
+ if (!Utf8toWStr(namepart,wnamepart))
return false;
// converting string that we try to find to lower case
@@ -2319,7 +2319,7 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args)
{
GameTele const* tele = &itr->second;
- if(tele->wnameLow.find(wnamepart) == std::wstring::npos)
+ if (tele->wnameLow.find(wnamepart) == std::wstring::npos)
continue;
if (m_session)
@@ -2328,7 +2328,7 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args)
reply << " " << itr->first << " " << tele->name << "\n";
}
- if(reply.str().empty())
+ if (reply.str().empty())
SendSysMessage(LANG_COMMAND_TELE_NOLOCATION);
else
PSendSysMessage(LANG_COMMAND_TELE_LOCATION,reply.str().c_str());
@@ -2339,7 +2339,7 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args)
//Enable\Dissable accept whispers (for GM)
bool ChatHandler::HandleWhispersCommand(const char* args)
{
- if(!*args)
+ if (!*args)
{
PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, m_session->GetPlayer()->isAcceptWhispers() ? GetTrinityString(LANG_ON) : GetTrinityString(LANG_OFF));
return true;
@@ -2382,11 +2382,11 @@ bool ChatHandler::HandleSendMailCommand(const char* args)
Player* target;
uint64 target_guid;
std::string target_name;
- if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
+ if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
return false;
char* tail1 = strtok(NULL, "");
- if(!tail1)
+ if (!tail1)
return false;
char* msgSubject = extractQuotedArg(tail1);
@@ -2394,7 +2394,7 @@ bool ChatHandler::HandleSendMailCommand(const char* args)
return false;
char* tail2 = strtok(NULL, "");
- if(!tail2)
+ if (!tail2)
return false;
char* msgText = extractQuotedArg(tail2);
@@ -2424,18 +2424,18 @@ bool ChatHandler::HandleTeleNameCommand(const char * args)
char* nameStr;
char* teleStr;
extractOptFirstArg((char*)args,&nameStr,&teleStr);
- if(!teleStr)
+ if (!teleStr)
return false;
Player* target;
uint64 target_guid;
std::string target_name;
- if(!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
+ if (!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
return false;
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
GameTele const* tele = extractGameTeleFromLink(teleStr);
- if(!tele)
+ if (!tele)
{
SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
SetSentErrorMessage(true);
@@ -2443,7 +2443,7 @@ bool ChatHandler::HandleTeleNameCommand(const char * args)
}
/* MapEntry const * me = sMapStore.LookupEntry(tele->mapId);
- if(!me || me->IsBattleGroundOrArena())
+ if (!me || me->IsBattleGroundOrArena())
{
SendSysMessage(LANG_CANNOT_TELE_TO_BG);
SetSentErrorMessage(true);
@@ -2460,7 +2460,7 @@ bool ChatHandler::HandleTeleNameCommand(const char * args)
std::string chrNameLink = playerLink(target_name);
- if(target->IsBeingTeleported()==true)
+ if (target->IsBeingTeleported()==true)
{
PSendSysMessage(LANG_IS_TELEPORTED, chrNameLink.c_str());
SetSentErrorMessage(true);
@@ -2472,7 +2472,7 @@ bool ChatHandler::HandleTeleNameCommand(const char * args)
ChatHandler(target).PSendSysMessage(LANG_TELEPORTED_TO_BY, GetNameLink().c_str());
// stop flight if need
- if(target->isInFlight())
+ if (target->isInFlight())
{
target->GetMotionMaster()->MovementExpired();
target->CleanupAfterTaxiFlight();
@@ -2502,7 +2502,7 @@ bool ChatHandler::HandleTeleNameCommand(const char * args)
//Teleport group to given game_tele.entry
bool ChatHandler::HandleTeleGroupCommand(const char * args)
{
- if(!*args)
+ if (!*args)
return false;
Player *player = getSelectedPlayer();
@@ -2519,7 +2519,7 @@ bool ChatHandler::HandleTeleGroupCommand(const char * args)
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
GameTele const* tele = extractGameTeleFromLink((char*)args);
- if(!tele)
+ if (!tele)
{
SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
SetSentErrorMessage(true);
@@ -2527,7 +2527,7 @@ bool ChatHandler::HandleTeleGroupCommand(const char * args)
}
MapEntry const * me = sMapStore.LookupEntry(tele->mapId);
- if(!me || me->IsBattleGroundOrArena())
+ if (!me || me->IsBattleGroundOrArena())
{
SendSysMessage(LANG_CANNOT_TELE_TO_BG);
SetSentErrorMessage(true);
@@ -2537,7 +2537,7 @@ bool ChatHandler::HandleTeleGroupCommand(const char * args)
std::string nameLink = GetNameLink(player);
Group *grp = player->GetGroup();
- if(!grp)
+ if (!grp)
{
PSendSysMessage(LANG_NOT_IN_GROUP,nameLink.c_str());
SetSentErrorMessage(true);
@@ -2548,7 +2548,7 @@ bool ChatHandler::HandleTeleGroupCommand(const char * args)
{
Player *pl = itr->getSource();
- if(!pl || !pl->GetSession() )
+ if (!pl || !pl->GetSession() )
continue;
// check online security
@@ -2557,7 +2557,7 @@ bool ChatHandler::HandleTeleGroupCommand(const char * args)
std::string plNameLink = GetNameLink(pl);
- if(pl->IsBeingTeleported())
+ if (pl->IsBeingTeleported())
{
PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
continue;
@@ -2568,7 +2568,7 @@ bool ChatHandler::HandleTeleGroupCommand(const char * args)
ChatHandler(pl).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str());
// stop flight if need
- if(pl->isInFlight())
+ if (pl->isInFlight())
{
pl->GetMotionMaster()->MovementExpired();
pl->CleanupAfterTaxiFlight();
@@ -2587,7 +2587,7 @@ bool ChatHandler::HandleTeleGroupCommand(const char * args)
bool ChatHandler::HandleGroupgoCommand(const char* args)
{
Player* target;
- if(!extractPlayerTarget((char*)args,&target))
+ if (!extractPlayerTarget((char*)args,&target))
return false;
// check online security
@@ -2598,7 +2598,7 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
std::string nameLink = GetNameLink(target);
- if(!grp)
+ if (!grp)
{
PSendSysMessage(LANG_NOT_IN_GROUP,nameLink.c_str());
SetSentErrorMessage(true);
@@ -2623,7 +2623,7 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
{
Player *pl = itr->getSource();
- if(!pl || pl==m_session->GetPlayer() || !pl->GetSession() )
+ if (!pl || pl==m_session->GetPlayer() || !pl->GetSession() )
continue;
// check online security
@@ -2632,7 +2632,7 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
std::string plNameLink = GetNameLink(pl);
- if(pl->IsBeingTeleported()==true)
+ if (pl->IsBeingTeleported()==true)
{
PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
SetSentErrorMessage(true);
@@ -2657,7 +2657,7 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
ChatHandler(pl).PSendSysMessage(LANG_SUMMONED_BY, GetNameLink().c_str());
// stop flight if need
- if(pl->isInFlight())
+ if (pl->isInFlight())
{
pl->GetMotionMaster()->MovementExpired();
pl->CleanupAfterTaxiFlight();
@@ -2723,7 +2723,7 @@ bool ChatHandler::HandleGoTaxinodeCommand(const char* args)
//teleport at coordinates
bool ChatHandler::HandleGoXYCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
Player* _player = m_session->GetPlayer();
@@ -2742,7 +2742,7 @@ bool ChatHandler::HandleGoXYCommand(const char* args)
mapid = (uint32)atoi(pmapid);
else mapid = _player->GetMapId();
- if(!MapManager::IsValidMapCoord(mapid,x,y))
+ if (!MapManager::IsValidMapCoord(mapid,x,y))
{
PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid);
SetSentErrorMessage(true);
@@ -2750,7 +2750,7 @@ bool ChatHandler::HandleGoXYCommand(const char* args)
}
// stop flight if need
- if(_player->isInFlight())
+ if (_player->isInFlight())
{
_player->GetMotionMaster()->MovementExpired();
_player->CleanupAfterTaxiFlight();
@@ -2770,7 +2770,7 @@ bool ChatHandler::HandleGoXYCommand(const char* args)
//teleport at coordinates, including Z
bool ChatHandler::HandleGoXYZCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
Player* _player = m_session->GetPlayer();
@@ -2792,7 +2792,7 @@ bool ChatHandler::HandleGoXYZCommand(const char* args)
else
mapid = _player->GetMapId();
- if(!MapManager::IsValidMapCoord(mapid,x,y,z))
+ if (!MapManager::IsValidMapCoord(mapid,x,y,z))
{
PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid);
SetSentErrorMessage(true);
@@ -2800,7 +2800,7 @@ bool ChatHandler::HandleGoXYZCommand(const char* args)
}
// stop flight if need
- if(_player->isInFlight())
+ if (_player->isInFlight())
{
_player->GetMotionMaster()->MovementExpired();
_player->CleanupAfterTaxiFlight();
@@ -2817,7 +2817,7 @@ bool ChatHandler::HandleGoXYZCommand(const char* args)
//teleport at coordinates
bool ChatHandler::HandleGoZoneXYCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
Player* _player = m_session->GetPlayer();
@@ -2842,7 +2842,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args)
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaid);
- if( x<0 || x>100 || y<0 || y>100 || !areaEntry )
+ if ( x<0 || x>100 || y<0 || y>100 || !areaEntry )
{
PSendSysMessage(LANG_INVALID_ZONE_COORD,x,y,areaid);
SetSentErrorMessage(true);
@@ -2854,7 +2854,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args)
Map const *map = MapManager::Instance().CreateBaseMap(zoneEntry->mapid);
- if(map->Instanceable())
+ if (map->Instanceable())
{
PSendSysMessage(LANG_INVALID_ZONE_MAP,areaEntry->ID,areaEntry->area_name[GetSessionDbcLocale()],map->GetId(),map->GetMapName());
SetSentErrorMessage(true);
@@ -2863,7 +2863,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args)
Zone2MapCoordinates(x,y,zoneEntry->ID);
- if(!MapManager::IsValidMapCoord(zoneEntry->mapid,x,y))
+ if (!MapManager::IsValidMapCoord(zoneEntry->mapid,x,y))
{
PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,zoneEntry->mapid);
SetSentErrorMessage(true);
@@ -2871,7 +2871,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args)
}
// stop flight if need
- if(_player->isInFlight())
+ if (_player->isInFlight())
{
_player->GetMotionMaster()->MovementExpired();
_player->CleanupAfterTaxiFlight();
@@ -2889,7 +2889,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args)
//teleport to grid
bool ChatHandler::HandleGoGridCommand(const char* args)
{
- if(!*args) return false;
+ if (!*args) return false;
Player* _player = m_session->GetPlayer();
char* px = strtok((char*)args, " ");
@@ -2910,7 +2910,7 @@ bool ChatHandler::HandleGoGridCommand(const char* args)
float x = (grid_x-CENTER_GRID_ID+0.5f)*SIZE_OF_GRIDS;
float y = (grid_y-CENTER_GRID_ID+0.5f)*SIZE_OF_GRIDS;
- if(!MapManager::IsValidMapCoord(mapid,x,y))
+ if (!MapManager::IsValidMapCoord(mapid,x,y))
{
PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid);
SetSentErrorMessage(true);
@@ -2918,7 +2918,7 @@ bool ChatHandler::HandleGoGridCommand(const char* args)
}
// stop flight if need
- if(_player->isInFlight())
+ if (_player->isInFlight())
{
_player->GetMotionMaster()->MovementExpired();
_player->CleanupAfterTaxiFlight();
@@ -2936,10 +2936,10 @@ bool ChatHandler::HandleGoGridCommand(const char* args)
bool ChatHandler::HandleModifyDrunkCommand(const char* args)
{
- if(!*args) return false;
+ if (!*args) return false;
uint32 drunklevel = (uint32)atoi(args);
- if(drunklevel > 100)
+ if (drunklevel > 100)
drunklevel = 100;
uint16 drunkMod = drunklevel * 0xFFFF / 100;
diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp
index a5f885aba96..c59c4f30df7 100644
--- a/src/game/Level2.cpp
+++ b/src/game/Level2.cpp
@@ -52,31 +52,31 @@ bool ChatHandler::HandleMuteCommand(const char* args)
char* nameStr;
char* delayStr;
extractOptFirstArg((char*)args,&nameStr,&delayStr);
- if(!delayStr)
+ if (!delayStr)
return false;
char *mutereason = strtok(NULL, "\r");
std::string mutereasonstr = "No reason";
- if(mutereason != NULL)
+ if (mutereason != NULL)
mutereasonstr = mutereason;
Player* target;
uint64 target_guid;
std::string target_name;
- if(!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
+ if (!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
return false;
uint32 account_id = target ? target->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(target_guid);
// find only player from same account if any
- if(!target)
- if(WorldSession* session = sWorld.FindSession(account_id))
+ if (!target)
+ if (WorldSession* session = sWorld.FindSession(account_id))
target = session->GetPlayer();
uint32 notspeaktime = (uint32) atoi(delayStr);
// must have strong lesser security level
- if(HasLowerSecurity (target,target_guid,true))
+ if (HasLowerSecurity (target,target_guid,true))
return false;
time_t mutetime = time(NULL) + notspeaktime*60;
@@ -86,7 +86,7 @@ bool ChatHandler::HandleMuteCommand(const char* args)
loginDatabase.PExecute("UPDATE account SET mutetime = " UI64FMTD " WHERE id = '%u'",uint64(mutetime), account_id );
- if(target)
+ if (target)
ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime, mutereasonstr.c_str());
std::string nameLink = playerLink(target_name);
@@ -102,23 +102,23 @@ bool ChatHandler::HandleUnmuteCommand(const char* args)
Player* target;
uint64 target_guid;
std::string target_name;
- if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
+ if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
return false;
uint32 account_id = target ? target->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(target_guid);
// find only player from same account if any
- if(!target)
- if(WorldSession* session = sWorld.FindSession(account_id))
+ if (!target)
+ if (WorldSession* session = sWorld.FindSession(account_id))
target = session->GetPlayer();
// must have strong lesser security level
- if(HasLowerSecurity (target,target_guid,true))
+ if (HasLowerSecurity (target,target_guid,true))
return false;
if (target)
{
- if(target->CanSpeak())
+ if (target->CanSpeak())
{
SendSysMessage(LANG_CHAT_ALREADY_ENABLED);
SetSentErrorMessage(true);
@@ -130,7 +130,7 @@ bool ChatHandler::HandleUnmuteCommand(const char* args)
loginDatabase.PExecute("UPDATE account SET mutetime = '0' WHERE id = '%u'", account_id );
- if(target)
+ if (target)
ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED);
std::string nameLink = playerLink(target_name);
@@ -141,20 +141,20 @@ bool ChatHandler::HandleUnmuteCommand(const char* args)
bool ChatHandler::HandleGoTicketCommand(const char * args)
{
- if(!*args)
+ if (!*args)
return false;
char *cstrticket_id = strtok((char*)args, " ");
- if(!cstrticket_id)
+ if (!cstrticket_id)
return false;
uint64 ticket_id = atoi(cstrticket_id);
- if(!ticket_id)
+ if (!ticket_id)
return false;
GM_Ticket *ticket = objmgr.GetGMTicket(ticket_id);
- if(!ticket)
+ if (!ticket)
{
SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
@@ -169,7 +169,7 @@ bool ChatHandler::HandleGoTicketCommand(const char * args)
mapid = ticket->map;
Player* _player = m_session->GetPlayer();
- if(_player->isInFlight())
+ if (_player->isInFlight())
{
_player->GetMotionMaster()->MovementExpired();
_player->CleanupAfterTaxiFlight();
@@ -194,7 +194,7 @@ bool ChatHandler::HandleGoTriggerCommand(const char* args)
int32 i_atId = atoi(atId);
- if(!i_atId)
+ if (!i_atId)
return false;
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(i_atId);
@@ -205,7 +205,7 @@ bool ChatHandler::HandleGoTriggerCommand(const char* args)
return false;
}
- if(!MapManager::IsValidMapCoord(at->mapid,at->x,at->y,at->z))
+ if (!MapManager::IsValidMapCoord(at->mapid,at->x,at->y,at->z))
{
PSendSysMessage(LANG_INVALID_TARGET_COORD,at->x,at->y,at->mapid);
SetSentErrorMessage(true);
@@ -213,7 +213,7 @@ bool ChatHandler::HandleGoTriggerCommand(const char* args)
}
// stop flight if need
- if(_player->isInFlight())
+ if (_player->isInFlight())
{
_player->GetMotionMaster()->MovementExpired();
_player->CleanupAfterTaxiFlight();
@@ -239,7 +239,7 @@ bool ChatHandler::HandleGoGraveyardCommand(const char* args)
int32 i_gyId = atoi(gyId);
- if(!i_gyId)
+ if (!i_gyId)
return false;
WorldSafeLocsEntry const* gy = sWorldSafeLocsStore.LookupEntry(i_gyId);
@@ -250,7 +250,7 @@ bool ChatHandler::HandleGoGraveyardCommand(const char* args)
return false;
}
- if(!MapManager::IsValidMapCoord(gy->map_id,gy->x,gy->y,gy->z))
+ if (!MapManager::IsValidMapCoord(gy->map_id,gy->x,gy->y,gy->z))
{
PSendSysMessage(LANG_INVALID_TARGET_COORD,gy->x,gy->y,gy->map_id);
SetSentErrorMessage(true);
@@ -258,7 +258,7 @@ bool ChatHandler::HandleGoGraveyardCommand(const char* args)
}
// stop flight if need
- if(_player->isInFlight())
+ if (_player->isInFlight())
{
_player->GetMotionMaster()->MovementExpired();
_player->CleanupAfterTaxiFlight();
@@ -284,7 +284,7 @@ bool ChatHandler::HandleGoGraveyardCommand(const char* args)
//teleport to creature
bool ChatHandler::HandleGoCreatureCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
Player* _player = m_session->GetPlayer();
@@ -296,22 +296,22 @@ bool ChatHandler::HandleGoCreatureCommand(const char* args)
std::ostringstream whereClause;
// User wants to teleport to the NPC's template entry
- if( strcmp(pParam1, "id") == 0 )
+ if ( strcmp(pParam1, "id") == 0 )
{
//sLog.outError("DEBUG: ID found");
// Get the "creature_template.entry"
// number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
char* tail = strtok(NULL,"");
- if(!tail)
+ if (!tail)
return false;
char* cId = extractKeyFromLink(tail,"Hcreature_entry");
- if(!cId)
+ if (!cId)
return false;
int32 tEntry = atoi(cId);
//sLog.outError("DEBUG: ID value: %d", tEntry);
- if(!tEntry)
+ if (!tEntry)
return false;
whereClause << "WHERE id = '" << tEntry << "'";
@@ -323,7 +323,7 @@ bool ChatHandler::HandleGoCreatureCommand(const char* args)
int32 guid = atoi(pParam1);
// Number is invalid - maybe the user specified the mob's name
- if(!guid)
+ if (!guid)
{
std::string name = pParam1;
WorldDatabase.escape_string(name);
@@ -353,7 +353,7 @@ bool ChatHandler::HandleGoCreatureCommand(const char* args)
float ort = fields[3].GetFloat();
int mapid = fields[4].GetUInt16();
- if(!MapManager::IsValidMapCoord(mapid,x,y,z,ort))
+ if (!MapManager::IsValidMapCoord(mapid,x,y,z,ort))
{
PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid);
SetSentErrorMessage(true);
@@ -361,7 +361,7 @@ bool ChatHandler::HandleGoCreatureCommand(const char* args)
}
// stop flight if need
- if(_player->isInFlight())
+ if (_player->isInFlight())
{
_player->GetMotionMaster()->MovementExpired();
_player->CleanupAfterTaxiFlight();
@@ -377,18 +377,18 @@ bool ChatHandler::HandleGoCreatureCommand(const char* args)
//teleport to gameobject
bool ChatHandler::HandleGoObjectCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
Player* _player = m_session->GetPlayer();
// number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hgameobject");
- if(!cId)
+ if (!cId)
return false;
int32 guid = atoi(cId);
- if(!guid)
+ if (!guid)
return false;
float x, y, z, ort;
@@ -410,7 +410,7 @@ bool ChatHandler::HandleGoObjectCommand(const char* args)
return false;
}
- if(!MapManager::IsValidMapCoord(mapid,x,y,z,ort))
+ if (!MapManager::IsValidMapCoord(mapid,x,y,z,ort))
{
PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid);
SetSentErrorMessage(true);
@@ -418,7 +418,7 @@ bool ChatHandler::HandleGoObjectCommand(const char* args)
}
// stop flight if need
- if(_player->isInFlight())
+ if (_player->isInFlight())
{
_player->GetMotionMaster()->MovementExpired();
_player->CleanupAfterTaxiFlight();
@@ -436,16 +436,16 @@ bool ChatHandler::HandleGameObjectTargetCommand(const char* args)
Player* pl = m_session->GetPlayer();
QueryResult_AutoPtr result;
GameEventMgr::ActiveEvents const& activeEventsList = gameeventmgr.GetActiveEventList();
- if(*args)
+ if (*args)
{
// number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hgameobject_entry");
- if(!cId)
+ if (!cId)
return false;
uint32 id = atol(cId);
- if(id)
+ if (id)
result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE map = '%i' AND id = '%u' ORDER BY order_ ASC LIMIT 1",
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(),id);
else
@@ -531,10 +531,10 @@ bool ChatHandler::HandleGameObjectTargetCommand(const char* args)
PSendSysMessage(LANG_GAMEOBJECT_DETAIL, lowguid, goI->name, lowguid, id, x, y, z, mapid, o, phase);
- if(target)
+ if (target)
{
int32 curRespawnDelay = target->GetRespawnTimeEx()-time(NULL);
- if(curRespawnDelay < 0)
+ if (curRespawnDelay < 0)
curRespawnDelay = 0;
std::string curRespawnDelayStr = secsToTimeString(curRespawnDelay,true);
@@ -550,11 +550,11 @@ bool ChatHandler::HandleGameObjectDeleteCommand(const char* args)
{
// number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hgameobject");
- if(!cId)
+ if (!cId)
return false;
uint32 lowguid = atoi(cId);
- if(!lowguid)
+ if (!lowguid)
return false;
GameObject* obj = NULL;
@@ -563,7 +563,7 @@ bool ChatHandler::HandleGameObjectDeleteCommand(const char* args)
if (GameObjectData const* go_data = objmgr.GetGOData(lowguid))
obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id);
- if(!obj)
+ if (!obj)
{
PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
SetSentErrorMessage(true);
@@ -571,10 +571,10 @@ bool ChatHandler::HandleGameObjectDeleteCommand(const char* args)
}
uint64 owner_guid = obj->GetOwnerGUID();
- if(owner_guid)
+ if (owner_guid)
{
Unit* owner = ObjectAccessor::GetUnit(*m_session->GetPlayer(),owner_guid);
- if(!owner || !IS_PLAYER_GUID(owner_guid))
+ if (!owner || !IS_PLAYER_GUID(owner_guid))
{
PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(owner_guid), obj->GetGUIDLow());
SetSentErrorMessage(true);
@@ -598,11 +598,11 @@ bool ChatHandler::HandleGameObjectTurnCommand(const char* args)
{
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hgameobject");
- if(!cId)
+ if (!cId)
return false;
uint32 lowguid = atoi(cId);
- if(!lowguid)
+ if (!lowguid)
return false;
GameObject* obj = NULL;
@@ -611,7 +611,7 @@ bool ChatHandler::HandleGameObjectTurnCommand(const char* args)
if (GameObjectData const* go_data = objmgr.GetGOData(lowguid))
obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id);
- if(!obj)
+ if (!obj)
{
PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
SetSentErrorMessage(true);
@@ -649,11 +649,11 @@ bool ChatHandler::HandleGameObjectMoveCommand(const char* args)
{
// number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hgameobject");
- if(!cId)
+ if (!cId)
return false;
uint32 lowguid = atoi(cId);
- if(!lowguid)
+ if (!lowguid)
return false;
GameObject* obj = NULL;
@@ -662,7 +662,7 @@ bool ChatHandler::HandleGameObjectMoveCommand(const char* args)
if (GameObjectData const* go_data = objmgr.GetGOData(lowguid))
obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id);
- if(!obj)
+ if (!obj)
{
PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
SetSentErrorMessage(true);
@@ -682,14 +682,14 @@ bool ChatHandler::HandleGameObjectMoveCommand(const char* args)
}
else
{
- if(!py || !pz)
+ if (!py || !pz)
return false;
float x = (float)atof(px);
float y = (float)atof(py);
float z = (float)atof(pz);
- if(!MapManager::IsValidMapCoord(obj->GetMapId(),x,y,z))
+ if (!MapManager::IsValidMapCoord(obj->GetMapId(),x,y,z))
{
PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,obj->GetMapId());
SetSentErrorMessage(true);
@@ -717,11 +717,11 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args)
// number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hgameobject_entry");
- if(!cId)
+ if (!cId)
return false;
uint32 id = atol(cId);
- if(!id)
+ if (!id)
return false;
char* spawntimeSecs = strtok(NULL, " ");
@@ -754,13 +754,13 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args)
GameObject* pGameObj = new GameObject;
uint32 db_lowGUID = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT);
- if(!pGameObj->Create(db_lowGUID, gInfo->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
+ if (!pGameObj->Create(db_lowGUID, gInfo->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
{
delete pGameObj;
return false;
}
- if( spawntimeSecs )
+ if ( spawntimeSecs )
{
uint32 value = atoi((char*)spawntimeSecs);
pGameObj->SetRespawnTime(value);
@@ -771,7 +771,7 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args)
pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()),chr->GetPhaseMaskForSpawn());
// this will generate a new guid if the object is in an instance
- if(!pGameObj->LoadFromDB(db_lowGUID, map))
+ if (!pGameObj->LoadFromDB(db_lowGUID, map))
{
delete pGameObj;
return false;
@@ -793,11 +793,11 @@ bool ChatHandler::HandleGameObjectPhaseCommand(const char* args)
{
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hgameobject");
- if(!cId)
+ if (!cId)
return false;
uint32 lowguid = atoi(cId);
- if(!lowguid)
+ if (!lowguid)
return false;
GameObject* obj = NULL;
@@ -806,7 +806,7 @@ bool ChatHandler::HandleGameObjectPhaseCommand(const char* args)
if (GameObjectData const* go_data = objmgr.GetGOData(lowguid))
obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id);
- if(!obj)
+ if (!obj)
{
PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
SetSentErrorMessage(true);
@@ -853,7 +853,7 @@ bool ChatHandler::HandleGameObjectNearCommand(const char* args)
GameObjectInfo const * gInfo = objmgr.GetGameObjectInfo(entry);
- if(!gInfo)
+ if (!gInfo)
continue;
PSendSysMessage(LANG_GO_LIST_CHAT, guid, guid, gInfo->name, x, y, z, mapid);
@@ -888,7 +888,7 @@ bool ChatHandler::HandleModifyRepCommand(const char * args)
Player* target = NULL;
target = getSelectedPlayer();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
@@ -900,7 +900,7 @@ bool ChatHandler::HandleModifyRepCommand(const char * args)
return false;
char* factionTxt = extractKeyFromLink((char*)args,"Hfaction");
- if(!factionTxt)
+ if (!factionTxt)
return false;
uint32 factionId = atoi(factionTxt);
@@ -915,7 +915,7 @@ bool ChatHandler::HandleModifyRepCommand(const char * args)
{
std::string rankStr = rankTxt;
std::wstring wrankStr;
- if(!Utf8toWStr(rankStr,wrankStr))
+ if (!Utf8toWStr(rankStr,wrankStr))
return false;
wstrToLower( wrankStr );
@@ -924,16 +924,16 @@ bool ChatHandler::HandleModifyRepCommand(const char * args)
for (; r < MAX_REPUTATION_RANK; ++r)
{
std::string rank = GetTrinityString(ReputationRankStrIndex[r]);
- if(rank.empty())
+ if (rank.empty())
continue;
std::wstring wrank;
- if(!Utf8toWStr(rank,wrank))
+ if (!Utf8toWStr(rank,wrank))
continue;
wstrToLower(wrank);
- if(wrank.substr(0,wrankStr.size())==wrankStr)
+ if (wrank.substr(0,wrankStr.size())==wrankStr)
{
char *deltaTxt = strtok(NULL, " ");
if (deltaTxt)
@@ -985,10 +985,10 @@ bool ChatHandler::HandleModifyRepCommand(const char * args)
//add spawn of creature
bool ChatHandler::HandleNpcAddCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char* charID = extractKeyFromLink((char*)args,"Hcreature_entry");
- if(!charID)
+ if (!charID)
return false;
char* team = strtok(NULL, " ");
@@ -1057,7 +1057,7 @@ bool ChatHandler::HandleNpcAddVendorItemCommand(const char* args)
uint32 vendor_entry = vendor ? vendor->GetEntry() : 0;
- if(!objmgr.IsVendorItemValid(vendor_entry,itemId,maxcount,incrtime,extendedcost,m_session->GetPlayer()))
+ if (!objmgr.IsVendorItemValid(vendor_entry,itemId,maxcount,incrtime,extendedcost,m_session->GetPlayer()))
{
SetSentErrorMessage(true);
return false;
@@ -1094,7 +1094,7 @@ bool ChatHandler::HandleNpcDelVendorItemCommand(const char* args)
}
uint32 itemId = atol(pitem);
- if(!objmgr.RemoveVendorItem(vendor->GetEntry(),itemId))
+ if (!objmgr.RemoveVendorItem(vendor->GetEntry(),itemId))
{
PSendSysMessage(LANG_ITEM_NOT_IN_LIST,itemId);
SetSentErrorMessage(true);
@@ -1110,7 +1110,7 @@ bool ChatHandler::HandleNpcDelVendorItemCommand(const char* args)
//add move for creature
bool ChatHandler::HandleNpcAddMoveCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char* guid_str = strtok((char*)args, " ");
@@ -1121,15 +1121,15 @@ bool ChatHandler::HandleNpcAddMoveCommand(const char* args)
Creature* pCreature = NULL;
/* FIXME: impossible without entry
- if(lowguid)
+ if (lowguid)
pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_GUID(lowguid,HIGHGUID_UNIT));
*/
// attempt check creature existence by DB data
- if(!pCreature)
+ if (!pCreature)
{
CreatureData const* data = objmgr.GetCreatureData(lowguid);
- if(!data)
+ if (!data)
{
PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid);
SetSentErrorMessage(true);
@@ -1144,7 +1144,7 @@ bool ChatHandler::HandleNpcAddMoveCommand(const char* args)
int wait = wait_str ? atoi(wait_str) : 0;
- if(wait < 0)
+ if (wait < 0)
wait = 0;
Player* player = m_session->GetPlayer();
@@ -1153,11 +1153,11 @@ bool ChatHandler::HandleNpcAddMoveCommand(const char* args)
// update movement type
WorldDatabase.PExecuteLog("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", WAYPOINT_MOTION_TYPE,lowguid);
- if(pCreature && pCreature->GetWaypointPath())
+ if (pCreature && pCreature->GetWaypointPath())
{
pCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
pCreature->GetMotionMaster()->Initialize();
- if(pCreature->isAlive()) // dead creature will reset movement generator at respawn
+ if (pCreature->isAlive()) // dead creature will reset movement generator at respawn
{
pCreature->setDeathState(JUST_DIED);
pCreature->Respawn();
@@ -1185,16 +1185,16 @@ bool ChatHandler::HandleNpcChangeLevelCommand(const char* args)
}
Creature* pCreature = getSelectedCreature();
- if(!pCreature)
+ if (!pCreature)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
return false;
}
- if(pCreature->isPet())
+ if (pCreature->isPet())
{
- if(((Pet*)pCreature)->getPetType()==HUNTER_PET)
+ if (((Pet*)pCreature)->getPetType()==HUNTER_PET)
{
pCreature->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(lvl)/4);
pCreature->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
@@ -1222,7 +1222,7 @@ bool ChatHandler::HandleNpcFlagCommand(const char* args)
Creature* pCreature = getSelectedCreature();
- if(!pCreature)
+ if (!pCreature)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -1242,15 +1242,15 @@ bool ChatHandler::HandleNpcDeleteCommand(const char* args)
{
Creature* unit = NULL;
- if(*args)
+ if (*args)
{
// number or [name] Shift-click form |color|Hcreature:creature_guid|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hcreature");
- if(!cId)
+ if (!cId)
return false;
uint32 lowguid = atoi(cId);
- if(!lowguid)
+ if (!lowguid)
return false;
if (CreatureData const* cr_data = objmgr.GetCreatureData(lowguid))
@@ -1259,7 +1259,7 @@ bool ChatHandler::HandleNpcDeleteCommand(const char* args)
else
unit = getSelectedCreature();
- if(!unit || unit->isPet() || unit->isTotem())
+ if (!unit || unit->isPet() || unit->isTotem())
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -1283,25 +1283,25 @@ bool ChatHandler::HandleNpcMoveCommand(const char* args)
Creature* pCreature = getSelectedCreature();
- if(!pCreature)
+ if (!pCreature)
{
// number or [name] Shift-click form |color|Hcreature:creature_guid|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hcreature");
- if(!cId)
+ if (!cId)
return false;
lowguid = atoi(cId);
/* FIXME: impossibel without entry
- if(lowguid)
+ if (lowguid)
pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_GUID(lowguid,HIGHGUID_UNIT));
*/
// Attempting creature load from DB data
- if(!pCreature)
+ if (!pCreature)
{
CreatureData const* data = objmgr.GetCreatureData(lowguid);
- if(!data)
+ if (!data)
{
PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid);
SetSentErrorMessage(true);
@@ -1310,7 +1310,7 @@ bool ChatHandler::HandleNpcMoveCommand(const char* args)
uint32 map_id = data->mapid;
- if(m_session->GetPlayer()->GetMapId()!=map_id)
+ if (m_session->GetPlayer()->GetMapId()!=map_id)
{
PSendSysMessage(LANG_COMMAND_CREATUREATSAMEMAP, lowguid);
SetSentErrorMessage(true);
@@ -1334,7 +1334,7 @@ bool ChatHandler::HandleNpcMoveCommand(const char* args)
if (pCreature)
{
- if(CreatureData const* data = objmgr.GetCreatureData(pCreature->GetDBTableGUIDLow()))
+ if (CreatureData const* data = objmgr.GetCreatureData(pCreature->GetDBTableGUIDLow()))
{
const_cast<CreatureData*>(data)->posX = x;
const_cast<CreatureData*>(data)->posY = y;
@@ -1343,7 +1343,7 @@ bool ChatHandler::HandleNpcMoveCommand(const char* args)
}
pCreature->GetMap()->CreatureRelocation(pCreature,x, y, z,o);
pCreature->GetMotionMaster()->Initialize();
- if(pCreature->isAlive()) // dead creature will reset movement generator at respawn
+ if (pCreature->isAlive()) // dead creature will reset movement generator at respawn
{
pCreature->setDeathState(JUST_DIED);
pCreature->Respawn();
@@ -1369,7 +1369,7 @@ bool ChatHandler::HandleNpcMoveCommand(const char* args)
*/
bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
// 3 arguments:
@@ -1385,13 +1385,13 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args)
bool doNotDelete = false;
- if(!guid_str)
+ if (!guid_str)
return false;
uint32 lowguid = 0;
Creature* pCreature = NULL;
- if( dontdel_str )
+ if ( dontdel_str )
{
//sLog.outError("DEBUG: All 3 params are set");
@@ -1399,7 +1399,7 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args)
// GUID
// type
// doNotDEL
- if( stricmp( dontdel_str, "NODEL" ) == 0 )
+ if ( stricmp( dontdel_str, "NODEL" ) == 0 )
{
//sLog.outError("DEBUG: doNotDelete = true;");
doNotDelete = true;
@@ -1408,10 +1408,10 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args)
else
{
// Only 2 params - but maybe NODEL is set
- if( type_str )
+ if ( type_str )
{
sLog.outError("DEBUG: Only 2 params ");
- if( stricmp( type_str, "NODEL" ) == 0 )
+ if ( stricmp( type_str, "NODEL" ) == 0 )
{
//sLog.outError("DEBUG: type_str, NODEL ");
doNotDelete = true;
@@ -1420,11 +1420,11 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args)
}
}
- if(!type_str) // case .setmovetype $move_type (with selected creature)
+ if (!type_str) // case .setmovetype $move_type (with selected creature)
{
type_str = guid_str;
pCreature = getSelectedCreature();
- if(!pCreature || pCreature->isPet())
+ if (!pCreature || pCreature->isPet())
return false;
lowguid = pCreature->GetDBTableGUIDLow();
}
@@ -1433,15 +1433,15 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args)
lowguid = atoi((char*)guid_str);
/* impossible without entry
- if(lowguid)
+ if (lowguid)
pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_GUID(lowguid,HIGHGUID_UNIT));
*/
// attempt check creature existence by DB data
- if(!pCreature)
+ if (!pCreature)
{
CreatureData const* data = objmgr.GetCreatureData(lowguid);
- if(!data)
+ if (!data)
{
PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid);
SetSentErrorMessage(true);
@@ -1461,35 +1461,35 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args)
std::string type = type_str;
- if(type == "stay")
+ if (type == "stay")
move_type = IDLE_MOTION_TYPE;
- else if(type == "random")
+ else if (type == "random")
move_type = RANDOM_MOTION_TYPE;
- else if(type == "way")
+ else if (type == "way")
move_type = WAYPOINT_MOTION_TYPE;
else
return false;
// update movement type
- //if(doNotDelete == false)
+ //if (doNotDelete == false)
// WaypointMgr.DeletePath(lowguid);
- if(pCreature)
+ if (pCreature)
{
// update movement type
- if(doNotDelete == false)
+ if (doNotDelete == false)
pCreature->LoadPath(0);
pCreature->SetDefaultMovementType(move_type);
pCreature->GetMotionMaster()->Initialize();
- if(pCreature->isAlive()) // dead creature will reset movement generator at respawn
+ if (pCreature->isAlive()) // dead creature will reset movement generator at respawn
{
pCreature->setDeathState(JUST_DIED);
pCreature->Respawn();
}
pCreature->SaveToDB();
}
- if( doNotDelete == false )
+ if ( doNotDelete == false )
{
PSendSysMessage(LANG_MOVE_TYPE_SET,type_str);
}
@@ -1511,7 +1511,7 @@ bool ChatHandler::HandleNpcSetModelCommand(const char* args)
Creature *pCreature = getSelectedCreature();
- if(!pCreature || pCreature->isPet())
+ if (!pCreature || pCreature->isPet())
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -1542,7 +1542,7 @@ bool ChatHandler::HandleNpcFactionIdCommand(const char* args)
Creature* pCreature = getSelectedCreature();
- if(!pCreature)
+ if (!pCreature)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -1554,7 +1554,7 @@ bool ChatHandler::HandleNpcFactionIdCommand(const char* args)
// faction is set in creature_template - not inside creature
// update in memory
- if(CreatureInfo const *cinfo = pCreature->GetCreatureInfo())
+ if (CreatureInfo const *cinfo = pCreature->GetCreatureInfo())
{
const_cast<CreatureInfo*>(cinfo)->faction_A = factionId;
const_cast<CreatureInfo*>(cinfo)->faction_H = factionId;
@@ -1568,7 +1568,7 @@ bool ChatHandler::HandleNpcFactionIdCommand(const char* args)
//set spawn dist of creature
bool ChatHandler::HandleNpcSpawnDistCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
float option = atof((char*)args);
@@ -1593,7 +1593,7 @@ bool ChatHandler::HandleNpcSpawnDistCommand(const char* args)
pCreature->SetRespawnRadius((float)option);
pCreature->SetDefaultMovementType(mtype);
pCreature->GetMotionMaster()->Initialize();
- if(pCreature->isAlive()) // dead creature will reset movement generator at respawn
+ if (pCreature->isAlive()) // dead creature will reset movement generator at respawn
{
pCreature->setDeathState(JUST_DIED);
pCreature->Respawn();
@@ -1606,7 +1606,7 @@ bool ChatHandler::HandleNpcSpawnDistCommand(const char* args)
//spawn time handling
bool ChatHandler::HandleNpcSpawnTimeCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char* stime = strtok((char*)args, " ");
@@ -1643,7 +1643,7 @@ bool ChatHandler::HandleNpcFollowCommand(const char* /*args*/)
Player *player = m_session->GetPlayer();
Creature *creature = getSelectedCreature();
- if(!creature)
+ if (!creature)
{
PSendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -1662,7 +1662,7 @@ bool ChatHandler::HandleNpcUnFollowCommand(const char* /*args*/)
Player *player = m_session->GetPlayer();
Creature *creature = getSelectedCreature();
- if(!creature)
+ if (!creature)
{
PSendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -1680,7 +1680,7 @@ bool ChatHandler::HandleNpcUnFollowCommand(const char* /*args*/)
TargetedMovementGenerator<Creature> const* mgen
= static_cast<TargetedMovementGenerator<Creature> const*>((creature->GetMotionMaster()->top()));
- if(mgen->GetTarget()!=player)
+ if (mgen->GetTarget()!=player)
{
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU);
SetSentErrorMessage(true);
@@ -1706,7 +1706,7 @@ bool ChatHandler::HandleNpcTameCommand(const char* /*args*/)
Player *player = m_session->GetPlayer ();
- if(player->GetPetGUID ())
+ if (player->GetPetGUID ())
{
SendSysMessage (LANG_YOU_ALREADY_HAVE_PET);
SetSentErrorMessage (true);
@@ -1775,7 +1775,7 @@ bool ChatHandler::HandleNpcSetPhaseCommand(const char* args)
}
Creature* pCreature = getSelectedCreature();
- if(!pCreature)
+ if (!pCreature)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -1784,7 +1784,7 @@ bool ChatHandler::HandleNpcSetPhaseCommand(const char* args)
pCreature->SetPhaseMask(phasemask,true);
- if(!pCreature->isPet())
+ if (!pCreature->isPet())
pCreature->SaveToDB();
return true;
@@ -1796,7 +1796,7 @@ bool ChatHandler::HandleNpcSetDeathStateCommand(const char* args)
return false;
Creature* pCreature = getSelectedCreature();
- if(!pCreature || pCreature->isPet())
+ if (!pCreature || pCreature->isPet())
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -1825,10 +1825,10 @@ bool ChatHandler::HandleNpcSetDeathStateCommand(const char* args)
bool ChatHandler::HandleNpcNameCommand(const char* /*args*/)
{
/* Temp. disabled
- if(!*args)
+ if (!*args)
return false;
- if(strlen((char*)args)>75)
+ if (strlen((char*)args)>75)
{
PSendSysMessage(LANG_TOO_LONG_NAME, strlen((char*)args)-75);
return true;
@@ -1836,7 +1836,7 @@ bool ChatHandler::HandleNpcNameCommand(const char* /*args*/)
for (uint8 i = 0; i < strlen(args); ++i)
{
- if(!isalpha(args[i]) && args[i]!=' ')
+ if (!isalpha(args[i]) && args[i]!=' ')
{
SendSysMessage(LANG_CHARS_ONLY);
return false;
@@ -1853,7 +1853,7 @@ bool ChatHandler::HandleNpcNameCommand(const char* /*args*/)
Creature* pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(), guid);
- if(!pCreature)
+ if (!pCreature)
{
SendSysMessage(LANG_SELECT_CREATURE);
return true;
@@ -1873,10 +1873,10 @@ bool ChatHandler::HandleNpcSubNameCommand(const char* /*args*/)
{
/* Temp. disabled
- if(!*args)
+ if (!*args)
args = "";
- if(strlen((char*)args)>75)
+ if (strlen((char*)args)>75)
{
PSendSysMessage(LANG_TOO_LONG_SUBNAME, strlen((char*)args)-75);
@@ -1885,7 +1885,7 @@ bool ChatHandler::HandleNpcSubNameCommand(const char* /*args*/)
for (uint8 i = 0; i < strlen(args); i++)
{
- if(!isalpha(args[i]) && args[i]!=' ')
+ if (!isalpha(args[i]) && args[i]!=' ')
{
SendSysMessage(LANG_CHARS_ONLY);
return false;
@@ -1901,7 +1901,7 @@ bool ChatHandler::HandleNpcSubNameCommand(const char* /*args*/)
Creature* pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(), guid);
- if(!pCreature)
+ if (!pCreature)
{
SendSysMessage(LANG_SELECT_CREATURE);
return true;
@@ -1918,7 +1918,7 @@ bool ChatHandler::HandleNpcSubNameCommand(const char* /*args*/)
//move item to other slot
bool ChatHandler::HandleItemMoveCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
uint8 srcslot, dstslot;
@@ -1933,13 +1933,13 @@ bool ChatHandler::HandleItemMoveCommand(const char* args)
srcslot = (uint8)atoi(pParam1);
dstslot = (uint8)atoi(pParam2);
- if(srcslot==dstslot)
+ if (srcslot==dstslot)
return true;
- if(!m_session->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0,srcslot))
+ if (!m_session->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0,srcslot))
return false;
- if(!m_session->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0,dstslot))
+ if (!m_session->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0,dstslot))
return false;
uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcslot);
@@ -1954,7 +1954,7 @@ bool ChatHandler::HandleItemMoveCommand(const char* args)
bool ChatHandler::HandleDeMorphCommand(const char* /*args*/)
{
Unit *target = getSelectedUnit();
- if(!target)
+ if (!target)
target = m_session->GetPlayer();
// check online security
@@ -1975,7 +1975,7 @@ bool ChatHandler::HandleModifyMorphCommand(const char* args)
uint16 display_id = (uint16)atoi((char*)args);
Unit *target = getSelectedUnit();
- if(!target)
+ if (!target)
target = m_session->GetPlayer();
// check online security
@@ -1994,22 +1994,22 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
char* kickReason = strtok(NULL, "\n");
std::string reason = "No Reason";
std::string kicker = "Console";
- if(kickReason)
+ if (kickReason)
reason = kickReason;
- if(m_session)
+ if (m_session)
kicker = m_session->GetPlayer()->GetName();
- if(!kickName)
+ if (!kickName)
{
Player* player = getSelectedPlayer();
- if(!player)
+ if (!player)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
}
- if(player==m_session->GetPlayer())
+ if (player==m_session->GetPlayer())
{
SendSysMessage(LANG_COMMAND_KICKSELF);
SetSentErrorMessage(true);
@@ -2020,7 +2020,7 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
if (HasLowerSecurity(player, 0))
return false;
- if(sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
+ if (sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
{
sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, player->GetName(), kicker.c_str(), reason.c_str());
}
@@ -2034,14 +2034,14 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
else
{
std::string name = extractPlayerNameFromLink((char*)kickName);
- if(name.empty())
+ if (name.empty())
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
- if(m_session && name==m_session->GetPlayer()->GetName())
+ if (m_session && name==m_session->GetPlayer()->GetName())
{
SendSysMessage(LANG_COMMAND_KICKSELF);
SetSentErrorMessage(true);
@@ -2049,14 +2049,14 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
}
Player* player = objmgr.GetPlayer(kickName);
- if(!player)
+ if (!player)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
- if(HasLowerSecurity(player, 0))
+ if (HasLowerSecurity(player, 0))
{
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); //maybe replacement string for this later on
SetSentErrorMessage(true);
@@ -2065,9 +2065,9 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
std::string nameLink = playerLink(name);
- if(sWorld.KickPlayer(name))
+ if (sWorld.KickPlayer(name))
{
- if(sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
+ if (sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
{
sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, nameLink.c_str(), kicker.c_str(), reason.c_str());
}
@@ -2083,7 +2083,7 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
}
}*/
Player* target;
- if(!extractPlayerTarget((char*)args,&target))
+ if (!extractPlayerTarget((char*)args,&target))
return false;
if (m_session && target==m_session->GetPlayer())
@@ -2112,7 +2112,7 @@ bool ChatHandler::HandleModifyPhaseCommand(const char* args)
uint32 phasemask = (uint32)atoi((char*)args);
Unit *target = getSelectedUnit();
- if(!target)
+ if (!target)
target = m_session->GetPlayer();
// check online security
@@ -2131,9 +2131,9 @@ bool ChatHandler::HandleGOInfoCommand(const char* args)
uint32 displayid = 0;
std::string name;
- if(!*args)
+ if (!*args)
{
- if(WorldObject * obj = getSelectedObject())
+ if (WorldObject * obj = getSelectedObject())
entry = obj->GetEntry();
}
else
@@ -2141,7 +2141,7 @@ bool ChatHandler::HandleGOInfoCommand(const char* args)
GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(entry);
- if(!goinfo)
+ if (!goinfo)
return false;
type = goinfo->type;
@@ -2162,7 +2162,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
Player* target;
uint64 target_guid;
std::string target_name;
- if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
+ if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
return false;
uint32 accId = 0;
@@ -2174,7 +2174,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
uint8 Class;
// get additional information from Player object
- if(target)
+ if (target)
{
// check online security
if (HasLowerSecurity(target, 0))
@@ -2220,17 +2220,17 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
"LEFT JOIN account_access aa "
"ON (a.id = aa.id) "
"WHERE a.id = '%u'",accId);
- if(result)
+ if (result)
{
Field* fields = result->Fetch();
username = fields[0].GetCppString();
security = fields[1].GetUInt32();
email = fields[2].GetCppString();
- if(email.empty())
+ if (email.empty())
email = "-";
- if(!m_session || m_session->GetSecurity() >= security)
+ if (!m_session || m_session->GetSecurity() >= security)
{
last_ip = fields[3].GetCppString();
last_login = fields[4].GetCppString();
@@ -2314,7 +2314,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args)
char* path_number = NULL;
uint32 pathid = 0;
- if(*args)
+ if (*args)
path_number = strtok((char*)args, " ");
uint32 point = 0;
@@ -2322,7 +2322,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args)
if (!path_number)
{
- if(target)
+ if (target)
pathid = target->GetWaypointPath();
else
{
@@ -2339,7 +2339,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args)
// path_id -> ID of the Path
// point -> number of the waypoint (if not 0)
- if(!pathid)
+ if (!pathid)
{
sLog.outDebug("DEBUG: HandleWpAddCommand - Current creature haven't loaded path.");
PSendSysMessage("%s%s|r", "|cffff33ff", "Current creature haven't loaded path.");
@@ -2350,7 +2350,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args)
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT MAX(point) FROM waypoint_data WHERE id = '%u'",pathid);
- if( result )
+ if ( result )
point = (*result)[0].GetUInt32();
Player* player = m_session->GetPlayer();
@@ -2365,13 +2365,13 @@ bool ChatHandler::HandleWpAddCommand(const char* args)
bool ChatHandler::HandleWpLoadPathCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
// optional
char* path_number = NULL;
- if(*args)
+ if (*args)
path_number = strtok((char*)args, " ");
uint32 pathid = 0;
@@ -2382,14 +2382,14 @@ bool ChatHandler::HandleWpLoadPathCommand(const char *args)
if (!path_number)
sLog.outDebug("DEBUG: HandleWpLoadPathCommand - No path number provided");
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
return false;
}
- if(target->GetEntry() == 1)
+ if (target->GetEntry() == 1)
{
PSendSysMessage("%s%s|r", "|cffff33ff", "You want to load path to a waypoint? Aren't you?");
SetSentErrorMessage(true);
@@ -2398,7 +2398,7 @@ bool ChatHandler::HandleWpLoadPathCommand(const char *args)
pathid = atoi(path_number);
- if(!pathid)
+ if (!pathid)
{
PSendSysMessage("%s%s|r", "|cffff33ff", "No vallid path number provided.");
return true;
@@ -2407,7 +2407,7 @@ bool ChatHandler::HandleWpLoadPathCommand(const char *args)
guidlow = target->GetDBTableGUIDLow();
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT guid FROM creature_addon WHERE guid = '%u'",guidlow);
- if( result )
+ if ( result )
WorldDatabase.PExecute("UPDATE creature_addon SET path_id = '%u' WHERE guid = '%u'", pathid, guidlow);
else
WorldDatabase.PExecute("INSERT INTO creature_addon(guid,path_id) VALUES ('%u','%u')", guidlow, pathid);
@@ -2424,12 +2424,12 @@ bool ChatHandler::HandleWpLoadPathCommand(const char *args)
bool ChatHandler::HandleReloadAllPaths(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
uint32 id = atoi(args);
- if(!id)
+ if (!id)
return false;
PSendSysMessage("%s%s|r|cff00ffff%u|r", "|cff00ff00", "Loading Path: ", id);
@@ -2442,15 +2442,15 @@ bool ChatHandler::HandleWpUnLoadPathCommand(const char *args)
uint32 guidlow = 0;
Creature* target = getSelectedCreature();
- if(!target)
+ if (!target)
{
PSendSysMessage("%s%s|r", "|cff33ffff", "You must select target.");
return true;
}
- if(target->GetCreatureAddon())
+ if (target->GetCreatureAddon())
{
- if(target->GetCreatureAddon()->path_id != 0)
+ if (target->GetCreatureAddon()->path_id != 0)
{
WorldDatabase.PExecute("DELETE FROM creature_addon WHERE guid = %u", target->GetGUIDLow());
target->UpdateWaypointID(0);
@@ -2469,28 +2469,28 @@ bool ChatHandler::HandleWpUnLoadPathCommand(const char *args)
bool ChatHandler::HandleWpEventCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char* show_str = strtok((char*)args, " ");
std::string show = show_str;
// Check
- if( (show != "add") && (show != "mod") && (show != "del") && (show != "listid")) return false;
+ if ( (show != "add") && (show != "mod") && (show != "del") && (show != "listid")) return false;
char* arg_id = strtok(NULL, " ");
uint32 id = 0;
- if(show == "add")
+ if (show == "add")
{
- if(arg_id)
+ if (arg_id)
id = atoi(arg_id);
- if(id)
+ if (id)
{
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT id FROM waypoint_scripts WHERE guid = %u", id);
- if( !result )
+ if ( !result )
{
WorldDatabase.PExecute("INSERT INTO waypoint_scripts(guid)VALUES(%u)", id);
PSendSysMessage("%s%s%u|r", "|cff00ff00", "Wp Event: New waypoint event added: ", id);
@@ -2509,9 +2509,9 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
return true;
}
- if(show == "listid")
+ if (show == "listid")
{
- if(!arg_id)
+ if (!arg_id)
{
PSendSysMessage("%s%s|r", "|cff33ffff","Wp Event: You must provide waypoint script id.");
return true;
@@ -2525,7 +2525,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = %u", id);
- if( !result )
+ if ( !result )
{
PSendSysMessage("%s%s%u|r", "|cff33ffff", "Wp Event: No waypoint scripts found on id: ", id);
return true;
@@ -2552,13 +2552,13 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
while (result->NextRow());
}
- if(show == "del")
+ if (show == "del")
{
id = atoi(arg_id);
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT guid FROM waypoint_scripts WHERE guid = %u", id);
- if( result )
+ if ( result )
{
WorldDatabase.PExecuteLog("DELETE FROM waypoint_scripts WHERE guid = %u", id);
PSendSysMessage("%s%s%u|r","|cff00ff00","Wp Event: Waypoint script removed: ", id);
@@ -2569,9 +2569,9 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
return true;
}
- if(show == "mod")
+ if (show == "mod")
{
- if(!arg_id)
+ if (!arg_id)
{
SendSysMessage("|cffff33ffERROR: Waypoint script guid not present.|r");
return true;
@@ -2579,7 +2579,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
id = atoi(arg_id);
- if(!id)
+ if (!id)
{
SendSysMessage("|cffff33ffERROR: No vallid waypoint script id not present.|r");
return true;
@@ -2587,7 +2587,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
char* arg_2 = strtok(NULL," ");
- if(!arg_2)
+ if (!arg_2)
{
SendSysMessage("|cffff33ffERROR: No argument present.|r");
return true;
@@ -2595,7 +2595,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
std::string arg_string = arg_2;
- if( (arg_string != "setid") && (arg_string != "delay") && (arg_string != "command")
+ if ( (arg_string != "setid") && (arg_string != "delay") && (arg_string != "command")
&& (arg_string != "datalong") && (arg_string != "datalong2") && (arg_string != "dataint") && (arg_string != "posx")
&& (arg_string != "posy") && (arg_string != "posz") && (arg_string != "orientation"))
{
@@ -2607,7 +2607,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
std::string arg_str_2 = arg_2;
arg_3 = strtok(NULL," ");
- if(!arg_3)
+ if (!arg_3)
{
SendSysMessage("|cffff33ffERROR: No additional argument present.|r");
return true;
@@ -2615,7 +2615,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
float coord;
- if(arg_str_2 == "setid")
+ if (arg_str_2 == "setid")
{
uint32 newid = atoi(arg_3);
PSendSysMessage("%s%s|r|cff00ffff%u|r|cff00ff00%s|r|cff00ffff%u|r","|cff00ff00","Wp Event: Wypoint scipt guid: ", newid," id changed: ", id);
@@ -2626,13 +2626,13 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
{
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT id FROM waypoint_scripts WHERE guid='%u'",id);
- if(!result)
+ if (!result)
{
SendSysMessage("|cffff33ffERROR: You have selected an non existing waypoint script guid.|r");
return true;
}
- if(arg_str_2 == "posx")
+ if (arg_str_2 == "posx")
{
coord = atof(arg_3);
WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET x='%f' WHERE guid='%u'",
@@ -2640,7 +2640,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
PSendSysMessage("|cff00ff00Waypoint script:|r|cff00ffff %u|r|cff00ff00 position_x updated.|r", id);
return true;
}
- else if(arg_str_2 == "posy")
+ else if (arg_str_2 == "posy")
{
coord = atof(arg_3);
WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET y='%f' WHERE guid='%u'",
@@ -2648,7 +2648,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
PSendSysMessage("|cff00ff00Waypoint script: %u position_y updated.|r", id);
return true;
}
- else if(arg_str_2 == "posz")
+ else if (arg_str_2 == "posz")
{
coord = atof(arg_3);
WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET z='%f' WHERE guid='%u'",
@@ -2656,7 +2656,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 position_z updated.|r", id);
return true;
}
- else if(arg_str_2 == "orientation")
+ else if (arg_str_2 == "orientation")
{
coord = atof(arg_3);
WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET o='%f' WHERE guid='%u'",
@@ -2664,7 +2664,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 orientation updated.|r", id);
return true;
}
- else if(arg_str_2 == "dataint")
+ else if (arg_str_2 == "dataint")
{
WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET %s='%u' WHERE guid='%u'",
arg_2, atoi(arg_3), id);
@@ -2688,7 +2688,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
{
sLog.outDebug("DEBUG: HandleWpModifyCommand");
- if(!*args)
+ if (!*args)
return false;
// first arg: add del text emote spell waittime move
@@ -2701,7 +2701,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
std::string show = show_str;
// Check
// Remember: "show" must also be the name of a column!
- if( (show != "delay") && (show != "action") && (show != "action_chance")
+ if ( (show != "delay") && (show != "action") && (show != "action_chance")
&& (show != "move_flag") && (show != "del") && (show != "move") && (show != "wpadd")
)
{
@@ -2719,7 +2719,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
uint32 wpGuid = 0;
Creature* target = getSelectedCreature();
- if(!target || target->GetEntry() != VISUAL_WAYPOINT)
+ if (!target || target->GetEntry() != VISUAL_WAYPOINT)
{
SendSysMessage("|cffff33ffERROR: You must select a waypoint.|r");
return false;
@@ -2731,7 +2731,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
wpGuid = target->GetGUIDLow();
// Did the user select a visual spawnpoint?
- if(wpGuid)
+ if (wpGuid)
wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
// attempt check creature existence by DB data
else
@@ -2745,7 +2745,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
{
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid);
- if(!result)
+ if (!result)
{
sLog.outDebug("DEBUG: HandleWpModifyCommand - No waypoint found - used 'wpguid'");
@@ -2759,7 +2759,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
const char* maxDIFF = "0.01";
result = WorldDatabase.PQuery( "SELECT id, point FROM waypoint_data WHERE (abs(position_x - %f) <= %s ) and (abs(position_y - %f) <= %s ) and (abs(position_z - %f) <= %s )",
wpCreature->GetPositionX(), maxDIFF, wpCreature->GetPositionY(), maxDIFF, wpCreature->GetPositionZ(), maxDIFF);
- if(!result)
+ if (!result)
{
PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, wpGuid);
return true;
@@ -2783,20 +2783,20 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
sLog.outDebug("DEBUG: HandleWpModifyCommand - Parameters parsed - now execute the command");
// Check for argument
- if(show != "del" && show != "move" && arg_str == NULL)
+ if (show != "del" && show != "move" && arg_str == NULL)
{
PSendSysMessage(LANG_WAYPOINT_ARGUMENTREQ, show_str);
return false;
}
- if(show == "del" && target)
+ if (show == "del" && target)
{
PSendSysMessage("|cff00ff00DEBUG: wp modify del, PathID: |r|cff00ffff%u|r", pathid);
// wpCreature
Creature* wpCreature = NULL;
- if( wpGuid != 0 )
+ if ( wpGuid != 0 )
{
wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
wpCreature->CombatStop();
@@ -2813,7 +2813,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
return true;
} // del
- if(show == "move" && target)
+ if (show == "move" && target)
{
PSendSysMessage("|cff00ff00DEBUG: wp move, PathID: |r|cff00ffff%u|r", pathid);
@@ -2825,7 +2825,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
// What to do:
// Move the visual spawnpoint
// Respawn the owner of the waypoints
- if( wpGuid != 0 )
+ if ( wpGuid != 0 )
{
wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
wpCreature->CombatStop();
@@ -2857,7 +2857,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
const char *text = arg_str;
- if( text == 0 )
+ if ( text == 0 )
{
// show_str check for present in list of correct values, no sql injection possible
WorldDatabase.PExecuteLog("UPDATE waypoint_data SET %s=NULL WHERE id='%u' AND point='%u'",
@@ -2880,7 +2880,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
{
sLog.outDebug("DEBUG: HandleWpShowCommand");
- if(!*args)
+ if (!*args)
return false;
// first arg: on, off, first, last
@@ -2903,7 +2903,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
// No PathID provided
// -> Player must have selected a creature
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -2918,7 +2918,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
// PathID provided
// Warn if player also selected a creature
// -> Creature selection is ignored <-
- if(target)
+ if (target)
SendSysMessage(LANG_WAYPOINT_CREATSELECTED);
pathid = atoi((char*)guid_str);
@@ -2934,10 +2934,10 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
//PSendSysMessage("wpshow - show: %s", show);
// Show info for the selected waypoint
- if(show == "info")
+ if (show == "info")
{
// Check if the user did specify a visual waypoint
- if( target->GetEntry() != VISUAL_WAYPOINT )
+ if ( target->GetEntry() != VISUAL_WAYPOINT )
{
PSendSysMessage(LANG_WAYPOINT_VP_SELECT);
SetSentErrorMessage(true);
@@ -2946,7 +2946,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT id, point, delay, move_flag, action, action_chance FROM waypoint_data WHERE wpguid = %u", target->GetGUIDLow());
- if(!result)
+ if (!result)
{
SendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM);
return true;
@@ -2974,11 +2974,11 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
return true;
}
- if(show == "on")
+ if (show == "on")
{
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT point, position_x,position_y,position_z FROM waypoint_data WHERE id = '%u'", pathid);
- if(!result)
+ if (!result)
{
SendSysMessage("|cffff33ffPath no found.|r");
SetSentErrorMessage(true);
@@ -2990,7 +2990,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
// Delete all visuals for this NPC
QueryResult_AutoPtr result2 = WorldDatabase.PQuery( "SELECT wpguid FROM waypoint_data WHERE id = '%u' and wpguid <> 0", pathid);
- if(result2)
+ if (result2)
{
bool hasError = false;
do
@@ -2999,7 +2999,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
uint32 wpguid = fields[0].GetUInt32();
Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpguid,VISUAL_WAYPOINT,HIGHGUID_UNIT));
- if(!pCreature)
+ if (!pCreature)
{
PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, wpguid);
hasError = true;
@@ -3015,7 +3015,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
}
while ( result2->NextRow() );
- if( hasError )
+ if ( hasError )
{
PSendSysMessage(LANG_WAYPOINT_TOOFAR1);
PSendSysMessage(LANG_WAYPOINT_TOOFAR2);
@@ -3054,7 +3054,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
wpCreature->LoadFromDB(wpCreature->GetDBTableGUIDLow(),map);
map->Add(wpCreature);
- if(target)
+ if (target)
{
wpCreature->SetDisplayId(target->GetDisplayId());
wpCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5);
@@ -3067,12 +3067,12 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
return true;
}
- if(show == "first")
+ if (show == "first")
{
PSendSysMessage("|cff00ff00DEBUG: wp first, GUID: %u|r", pathid);
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT position_x,position_y,position_z FROM waypoint_data WHERE point='1' AND id = '%u'",pathid);
- if(!result)
+ if (!result)
{
PSendSysMessage(LANG_WAYPOINT_NOTFOUND, pathid);
SetSentErrorMessage(true);
@@ -3101,7 +3101,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
pCreature->LoadFromDB(pCreature->GetDBTableGUIDLow(), map);
map->Add(pCreature);
- if(target)
+ if (target)
{
pCreature->SetDisplayId(target->GetDisplayId());
pCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5);
@@ -3110,18 +3110,18 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
return true;
}
- if(show == "last")
+ if (show == "last")
{
PSendSysMessage("|cff00ff00DEBUG: wp last, PathID: |r|cff00ffff%u|r", pathid);
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT MAX(point) FROM waypoint_data WHERE id = '%u'",pathid);
- if( result )
+ if ( result )
Maxpoint = (*result)[0].GetUInt32();
else
Maxpoint = 0;
result = WorldDatabase.PQuery( "SELECT position_x,position_y,position_z FROM waypoint_data WHERE point ='%u' AND id = '%u'",Maxpoint, pathid);
- if(!result)
+ if (!result)
{
PSendSysMessage(LANG_WAYPOINT_NOTFOUNDLAST, pathid);
SetSentErrorMessage(true);
@@ -3149,7 +3149,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
pCreature->LoadFromDB(pCreature->GetDBTableGUIDLow(), map);
map->Add(pCreature);
- if(target)
+ if (target)
{
pCreature->SetDisplayId(target->GetDisplayId());
pCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5);
@@ -3158,10 +3158,10 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
return true;
}
- if(show == "off")
+ if (show == "off")
{
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE id = '%u'", 1);
- if(!result)
+ if (!result)
{
SendSysMessage(LANG_WAYPOINT_VP_NOTFOUND);
SetSentErrorMessage(true);
@@ -3173,7 +3173,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
Field *fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(guid,VISUAL_WAYPOINT,HIGHGUID_UNIT));
- if(!pCreature)
+ if (!pCreature)
{
PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid);
hasError = true;
@@ -3191,7 +3191,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
WorldDatabase.PExecuteLog("UPDATE waypoint_data SET wpguid = '0'");
//WorldDatabase.PExecuteLog("UPDATE creature_movement SET wpguid = '0' WHERE wpguid <> '0'");
- if( hasError )
+ if ( hasError )
{
PSendSysMessage(LANG_WAYPOINT_TOOFAR1);
PSendSysMessage(LANG_WAYPOINT_TOOFAR2);
@@ -3214,10 +3214,10 @@ bool ChatHandler::HandleCharacterRenameCommand(const char* args)
Player* target;
uint64 target_guid;
std::string target_name;
- if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
+ if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
return false;
- if(target)
+ if (target)
{
// check online security
if (HasLowerSecurity(target, 0))
@@ -3247,10 +3247,10 @@ bool ChatHandler::HandleCharacterCustomizeCommand(const char* args)
Player* target;
uint64 target_guid;
std::string target_name;
- if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
+ if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
return false;
- if(target)
+ if (target)
{
PSendSysMessage(LANG_CUSTOMIZE_PLAYER, GetNameLink(target).c_str());
target->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
@@ -3270,7 +3270,7 @@ bool ChatHandler::HandleCharacterCustomizeCommand(const char* args)
bool ChatHandler::HandleCharacterReputationCommand(const char* args)
{
Player* target;
- if(!extractPlayerTarget((char*)args,&target))
+ if (!extractPlayerTarget((char*)args,&target))
return false;
LocaleConstant loc = GetSessionDbcLocale();
@@ -3290,17 +3290,17 @@ bool ChatHandler::HandleCharacterReputationCommand(const char* args)
ss << " " << rankName << " (" << target->GetReputationMgr().GetReputation(factionEntry) << ")";
- if(itr->second.Flags & FACTION_FLAG_VISIBLE)
+ if (itr->second.Flags & FACTION_FLAG_VISIBLE)
ss << GetTrinityString(LANG_FACTION_VISIBLE);
- if(itr->second.Flags & FACTION_FLAG_AT_WAR)
+ if (itr->second.Flags & FACTION_FLAG_AT_WAR)
ss << GetTrinityString(LANG_FACTION_ATWAR);
- if(itr->second.Flags & FACTION_FLAG_PEACE_FORCED)
+ if (itr->second.Flags & FACTION_FLAG_PEACE_FORCED)
ss << GetTrinityString(LANG_FACTION_PEACE_FORCED);
- if(itr->second.Flags & FACTION_FLAG_HIDDEN)
+ if (itr->second.Flags & FACTION_FLAG_HIDDEN)
ss << GetTrinityString(LANG_FACTION_HIDDEN);
- if(itr->second.Flags & FACTION_FLAG_INVISIBLE_FORCED)
+ if (itr->second.Flags & FACTION_FLAG_INVISIBLE_FORCED)
ss << GetTrinityString(LANG_FACTION_INVISIBLE_FORCED);
- if(itr->second.Flags & FACTION_FLAG_INACTIVE)
+ if (itr->second.Flags & FACTION_FLAG_INACTIVE)
ss << GetTrinityString(LANG_FACTION_INACTIVE);
SendSysMessage(ss.str().c_str());
@@ -3326,7 +3326,7 @@ bool ChatHandler::HandleHonorAddCommand(const char* args)
return false;
Player *target = getSelectedPlayer();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
@@ -3345,7 +3345,7 @@ bool ChatHandler::HandleHonorAddCommand(const char* args)
bool ChatHandler::HandleHonorAddKillCommand(const char* /*args*/)
{
Unit *target = getSelectedUnit();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
@@ -3363,7 +3363,7 @@ bool ChatHandler::HandleHonorAddKillCommand(const char* /*args*/)
bool ChatHandler::HandleHonorUpdateCommand(const char* /*args*/)
{
Player *target = getSelectedPlayer();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
@@ -3380,14 +3380,14 @@ bool ChatHandler::HandleHonorUpdateCommand(const char* /*args*/)
bool ChatHandler::HandleLookupEventCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
std::string namepart = args;
std::wstring wnamepart;
// converting string that we try to find to lower case
- if(!Utf8toWStr(namepart,wnamepart))
+ if (!Utf8toWStr(namepart,wnamepart))
return false;
wstrToLower(wnamepart);
@@ -3402,19 +3402,19 @@ bool ChatHandler::HandleLookupEventCommand(const char* args)
GameEventData const& eventData = events[id];
std::string descr = eventData.description;
- if(descr.empty())
+ if (descr.empty())
continue;
if (Utf8FitTo(descr, wnamepart))
{
char const* active = activeEvents.find(id) != activeEvents.end() ? GetTrinityString(LANG_ACTIVE) : "";
- if(m_session)
+ if (m_session)
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,id,id,eventData.description.c_str(),active );
else
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,id,eventData.description.c_str(),active );
- if(!found)
+ if (!found)
found = true;
}
}
@@ -3439,7 +3439,7 @@ bool ChatHandler::HandleEventActiveListCommand(const char* args)
uint32 event_id = *itr;
GameEventData const& eventData = events[event_id];
- if(m_session)
+ if (m_session)
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,event_id,event_id,eventData.description.c_str(),active );
else
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,event_id,eventData.description.c_str(),active );
@@ -3455,19 +3455,19 @@ bool ChatHandler::HandleEventActiveListCommand(const char* args)
bool ChatHandler::HandleEventInfoCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
// id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hgameevent");
- if(!cId)
+ if (!cId)
return false;
uint32 event_id = atoi(cId);
GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap();
- if(event_id >=events.size())
+ if (event_id >=events.size())
{
SendSysMessage(LANG_EVENT_NOT_EXIST);
SetSentErrorMessage(true);
@@ -3475,7 +3475,7 @@ bool ChatHandler::HandleEventInfoCommand(const char* args)
}
GameEventData const& eventData = events[event_id];
- if(!eventData.isValid())
+ if (!eventData.isValid())
{
SendSysMessage(LANG_EVENT_NOT_EXIST);
SetSentErrorMessage(true);
@@ -3504,19 +3504,19 @@ bool ChatHandler::HandleEventInfoCommand(const char* args)
bool ChatHandler::HandleEventStartCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
// id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hgameevent");
- if(!cId)
+ if (!cId)
return false;
int32 event_id = atoi(cId);
GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap();
- if(event_id < 1 || event_id >=events.size())
+ if (event_id < 1 || event_id >=events.size())
{
SendSysMessage(LANG_EVENT_NOT_EXIST);
SetSentErrorMessage(true);
@@ -3524,7 +3524,7 @@ bool ChatHandler::HandleEventStartCommand(const char* args)
}
GameEventData const& eventData = events[event_id];
- if(!eventData.isValid())
+ if (!eventData.isValid())
{
SendSysMessage(LANG_EVENT_NOT_EXIST);
SetSentErrorMessage(true);
@@ -3532,7 +3532,7 @@ bool ChatHandler::HandleEventStartCommand(const char* args)
}
GameEventMgr::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList();
- if(activeEvents.find(event_id) != activeEvents.end())
+ if (activeEvents.find(event_id) != activeEvents.end())
{
PSendSysMessage(LANG_EVENT_ALREADY_ACTIVE,event_id);
SetSentErrorMessage(true);
@@ -3545,19 +3545,19 @@ bool ChatHandler::HandleEventStartCommand(const char* args)
bool ChatHandler::HandleEventStopCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
// id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hgameevent");
- if(!cId)
+ if (!cId)
return false;
int32 event_id = atoi(cId);
GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap();
- if(event_id < 1 || event_id >=events.size())
+ if (event_id < 1 || event_id >=events.size())
{
SendSysMessage(LANG_EVENT_NOT_EXIST);
SetSentErrorMessage(true);
@@ -3565,7 +3565,7 @@ bool ChatHandler::HandleEventStopCommand(const char* args)
}
GameEventData const& eventData = events[event_id];
- if(!eventData.isValid())
+ if (!eventData.isValid())
{
SendSysMessage(LANG_EVENT_NOT_EXIST);
SetSentErrorMessage(true);
@@ -3574,7 +3574,7 @@ bool ChatHandler::HandleEventStopCommand(const char* args)
GameEventMgr::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList();
- if(activeEvents.find(event_id) == activeEvents.end())
+ if (activeEvents.find(event_id) == activeEvents.end())
{
PSendSysMessage(LANG_EVENT_NOT_ACTIVE,event_id);
SetSentErrorMessage(true);
@@ -3588,7 +3588,7 @@ bool ChatHandler::HandleEventStopCommand(const char* args)
bool ChatHandler::HandleCombatStopCommand(const char* args)
{
Player* target;
- if(!extractPlayerTarget((char*)args,&target))
+ if (!extractPlayerTarget((char*)args,&target))
return false;
// check online security
@@ -3611,11 +3611,11 @@ void ChatHandler::HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id)
continue;
// wrong skill
- if( skillLine->skillId != skill_id)
+ if ( skillLine->skillId != skill_id)
continue;
// not high rank
- if(skillLine->forward_spellid )
+ if (skillLine->forward_spellid )
continue;
// skip racial skills
@@ -3623,11 +3623,11 @@ void ChatHandler::HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id)
continue;
// skip wrong class skills
- if( skillLine->classmask && (skillLine->classmask & classmask) == 0)
+ if ( skillLine->classmask && (skillLine->classmask & classmask) == 0)
continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);
- if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,player,false))
+ if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo,player,false))
continue;
player->learnSpell(skillLine->spellId,false);
@@ -3640,7 +3640,7 @@ bool ChatHandler::HandleLearnAllCraftsCommand(const char* /*args*/)
for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i)
{
SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(i);
- if( !skillInfo )
+ if ( !skillInfo )
continue;
if ((skillInfo->categoryId == SKILL_CATEGORY_PROFESSION || skillInfo->categoryId == SKILL_CATEGORY_SECONDARY) &&
@@ -3660,7 +3660,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args)
// Example: .learn all_recipes enchanting
Player* target = getSelectedPlayer();
- if( !target )
+ if ( !target )
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
return false;
@@ -3671,7 +3671,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args)
std::wstring wnamepart;
- if(!Utf8toWStr(args,wnamepart))
+ if (!Utf8toWStr(args,wnamepart))
return false;
uint32 counter = 0; // Counter for figure out that we found smth.
@@ -3695,7 +3695,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args)
int loc = GetSessionDbcLocale();
name = skillInfo->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
if (!Utf8FitTo(name, wnamepart))
@@ -3703,11 +3703,11 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args)
loc = 0;
for (; loc < MAX_LOCALE; ++loc)
{
- if(loc==GetSessionDbcLocale())
+ if (loc==GetSessionDbcLocale())
continue;
name = skillInfo->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
if (Utf8FitTo(name, wnamepart))
@@ -3715,14 +3715,14 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args)
}
}
- if(loc < MAX_LOCALE)
+ if (loc < MAX_LOCALE)
{
targetSkillInfo = skillInfo;
break;
}
}
- if(!targetSkillInfo)
+ if (!targetSkillInfo)
return false;
HandleLearnSkillRecipesHelper(target,targetSkillInfo->id);
@@ -3788,7 +3788,7 @@ bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args)
bool ChatHandler::LookupPlayerSearchCommand(QueryResult_AutoPtr result, int32 limit)
{
- if(!result)
+ if (!result)
{
PSendSysMessage(LANG_NO_PLAYERS_FOUND);
SetSentErrorMessage(true);
@@ -3803,7 +3803,7 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult_AutoPtr result, int32 li
std::string acc_name = fields[1].GetCppString();
QueryResult_AutoPtr chars = CharacterDatabase.PQuery("SELECT guid,name FROM characters WHERE account = '%u'", acc_id);
- if(chars)
+ if (chars)
{
PSendSysMessage(LANG_LOOKUP_PLAYER_ACCOUNT,acc_name.c_str(),acc_id);
@@ -3823,7 +3823,7 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult_AutoPtr result, int32 li
}
} while (result->NextRow());
- if(i==0) // empty accounts only
+ if (i==0) // empty accounts only
{
PSendSysMessage(LANG_NO_PLAYERS_FOUND);
SetSentErrorMessage(true);
@@ -3843,7 +3843,7 @@ bool ChatHandler::HandleServerCorpsesCommand(const char* /*args*/)
bool ChatHandler::HandleRepairitemsCommand(const char* args)
{
Player* target;
- if(!extractPlayerTarget((char*)args,&target))
+ if (!extractPlayerTarget((char*)args,&target))
return false;
// check online security
@@ -3854,19 +3854,19 @@ bool ChatHandler::HandleRepairitemsCommand(const char* args)
target->DurabilityRepairAll(false, 0, false);
PSendSysMessage(LANG_YOU_REPAIR_ITEMS, GetNameLink(target).c_str());
- if(needReportToTarget(target))
+ if (needReportToTarget(target))
ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, GetNameLink().c_str());
return true;
}
bool ChatHandler::HandleWaterwalkCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
Player *player = getSelectedPlayer();
- if(!player)
+ if (!player)
{
PSendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
@@ -3888,7 +3888,7 @@ bool ChatHandler::HandleWaterwalkCommand(const char* args)
}
PSendSysMessage(LANG_YOU_SET_WATERWALK, args, GetNameLink(player).c_str());
- if(needReportToTarget(player))
+ if (needReportToTarget(player))
ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, GetNameLink().c_str());
return true;
}
@@ -3898,7 +3898,7 @@ bool ChatHandler::HandleCreatePetCommand(const char* args)
Player *player = m_session->GetPlayer();
Creature *creatureTarget = getSelectedCreature();
- if(!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
+ if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
{
PSendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -3907,14 +3907,14 @@ bool ChatHandler::HandleCreatePetCommand(const char* args)
CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(creatureTarget->GetEntry());
// Creatures with family 0 crashes the server
- if(cInfo->family == 0)
+ if (cInfo->family == 0)
{
PSendSysMessage("This creature cannot be tamed. (family id: 0).");
SetSentErrorMessage(true);
return false;
}
- if(player->GetPetGUID())
+ if (player->GetPetGUID())
{
PSendSysMessage("You already have a pet");
SetSentErrorMessage(true);
@@ -3924,10 +3924,10 @@ bool ChatHandler::HandleCreatePetCommand(const char* args)
// Everything looks OK, create new pet
Pet* pet = new Pet(player, HUNTER_PET);
- if(!pet)
+ if (!pet)
return false;
- if(!pet->CreateBaseAtCreature(creatureTarget))
+ if (!pet->CreateBaseAtCreature(creatureTarget))
{
delete pet;
PSendSysMessage("Error 1");
@@ -3941,7 +3941,7 @@ bool ChatHandler::HandleCreatePetCommand(const char* args)
pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID());
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());
- if(!pet->InitStatsForLevel(creatureTarget->getLevel()))
+ if (!pet->InitStatsForLevel(creatureTarget->getLevel()))
{
sLog.outError("ERROR: InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
PSendSysMessage("Error 2");
@@ -3971,13 +3971,13 @@ bool ChatHandler::HandleCreatePetCommand(const char* args)
bool ChatHandler::HandlePetLearnCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
Player *plr = m_session->GetPlayer();
Pet *pet = plr->GetPet();
- if(!pet)
+ if (!pet)
{
PSendSysMessage("You have no pet");
SetSentErrorMessage(true);
@@ -3986,11 +3986,11 @@ bool ChatHandler::HandlePetLearnCommand(const char* args)
uint32 spellId = extractSpellIdFromLink((char*)args);
- if(!spellId || !sSpellStore.LookupEntry(spellId))
+ if (!spellId || !sSpellStore.LookupEntry(spellId))
return false;
// Check if pet already has it
- if(pet->HasSpell(spellId))
+ if (pet->HasSpell(spellId))
{
PSendSysMessage("Pet already has spell: %u", spellId);
SetSentErrorMessage(true);
@@ -3999,7 +3999,7 @@ bool ChatHandler::HandlePetLearnCommand(const char* args)
// Check if spell is valid
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
- if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
+ if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
{
PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spellId);
SetSentErrorMessage(true);
@@ -4014,13 +4014,13 @@ bool ChatHandler::HandlePetLearnCommand(const char* args)
bool ChatHandler::HandlePetUnlearnCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
Player *plr = m_session->GetPlayer();
Pet *pet = plr->GetPet();
- if(!pet)
+ if (!pet)
{
PSendSysMessage("You have no pet");
SetSentErrorMessage(true);
@@ -4029,7 +4029,7 @@ bool ChatHandler::HandlePetUnlearnCommand(const char *args)
uint32 spellId = extractSpellIdFromLink((char*)args);
- if(pet->HasSpell(spellId))
+ if (pet->HasSpell(spellId))
pet->removeSpell(spellId, false);
else
PSendSysMessage("Pet doesn't have that spell");
@@ -4039,13 +4039,13 @@ bool ChatHandler::HandlePetUnlearnCommand(const char *args)
bool ChatHandler::HandlePetTpCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
Player *plr = m_session->GetPlayer();
Pet *pet = plr->GetPet();
- if(!pet)
+ if (!pet)
{
PSendSysMessage("You have no pet");
SetSentErrorMessage(true);
@@ -4062,15 +4062,15 @@ bool ChatHandler::HandlePetTpCommand(const char *args)
bool ChatHandler::HandleActivateObjectCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
char* cId = extractKeyFromLink((char*)args,"Hgameobject");
- if(!cId)
+ if (!cId)
return false;
uint32 lowguid = atoi(cId);
- if(!lowguid)
+ if (!lowguid)
return false;
GameObject* obj = NULL;
@@ -4079,7 +4079,7 @@ bool ChatHandler::HandleActivateObjectCommand(const char *args)
if (GameObjectData const* go_data = objmgr.GetGOData(lowguid))
obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id);
- if(!obj)
+ if (!obj)
{
PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
SetSentErrorMessage(true);
@@ -4098,7 +4098,7 @@ bool ChatHandler::HandleActivateObjectCommand(const char *args)
// add creature, temp only
bool ChatHandler::HandleTempAddSpwCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char* charID = strtok((char*)args, " ");
if (!charID)
@@ -4107,7 +4107,7 @@ bool ChatHandler::HandleTempAddSpwCommand(const char* args)
Player *chr = m_session->GetPlayer();
uint32 id = atoi(charID);
- if(!id)
+ if (!id)
return false;
chr->SummonCreature(id, *chr, TEMPSUMMON_CORPSE_DESPAWN, 120);
@@ -4118,7 +4118,7 @@ bool ChatHandler::HandleTempAddSpwCommand(const char* args)
// add go, temp only
bool ChatHandler::HandleTempGameObjectCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
char* charID = strtok((char*)args, " ");
if (!charID)
@@ -4129,7 +4129,7 @@ bool ChatHandler::HandleTempGameObjectCommand(const char* args)
char* spawntime = strtok(NULL, " ");
uint32 spawntm = 300;
- if( spawntime )
+ if ( spawntime )
spawntm = atoi((char*)spawntime);
float x = chr->GetPositionX();
@@ -4155,7 +4155,7 @@ bool ChatHandler::HandleNpcAddFormationCommand(const char* args)
uint32 leaderGUID = (uint32) atoi((char*)args);
Creature *pCreature = getSelectedCreature();
- if(!pCreature || !pCreature->GetDBTableGUIDLow())
+ if (!pCreature || !pCreature->GetDBTableGUIDLow())
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -4163,7 +4163,7 @@ bool ChatHandler::HandleNpcAddFormationCommand(const char* args)
}
uint32 lowguid = pCreature->GetDBTableGUIDLow();
- if(pCreature->GetFormation())
+ if (pCreature->GetFormation())
{
PSendSysMessage("Selected creature is already member of group %u", pCreature->GetFormation()->GetId());
return false;
@@ -4201,21 +4201,21 @@ bool ChatHandler::HandleNpcSetLinkCommand(const char* args)
Creature* pCreature = getSelectedCreature();
- if(!pCreature)
+ if (!pCreature)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
return false;
}
- if(!pCreature->GetDBTableGUIDLow())
+ if (!pCreature->GetDBTableGUIDLow())
{
PSendSysMessage("Selected creature isn't in creature table", pCreature->GetGUIDLow());
SetSentErrorMessage(true);
return false;
}
- if(!objmgr.SetCreatureLinkedRespawn(pCreature->GetDBTableGUIDLow(), linkguid))
+ if (!objmgr.SetCreatureLinkedRespawn(pCreature->GetDBTableGUIDLow(), linkguid))
{
PSendSysMessage("Selected creature can't link with guid '%u'", linkguid);
SetSentErrorMessage(true);
@@ -4228,7 +4228,7 @@ bool ChatHandler::HandleNpcSetLinkCommand(const char* args)
bool ChatHandler::HandleLookupTitleCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
// can be NULL in console call
@@ -4240,7 +4240,7 @@ bool ChatHandler::HandleLookupTitleCommand(const char* args)
std::string namepart = args;
std::wstring wnamepart;
- if(!Utf8toWStr(namepart,wnamepart))
+ if (!Utf8toWStr(namepart,wnamepart))
return false;
// converting string that we try to find to lower case
@@ -4252,11 +4252,11 @@ bool ChatHandler::HandleLookupTitleCommand(const char* args)
for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
{
CharTitlesEntry const *titleInfo = sCharTitlesStore.LookupEntry(id);
- if(titleInfo)
+ if (titleInfo)
{
int loc = GetSessionDbcLocale();
std::string name = titleInfo->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
if (!Utf8FitTo(name, wnamepart))
@@ -4264,11 +4264,11 @@ bool ChatHandler::HandleLookupTitleCommand(const char* args)
loc = 0;
for (; loc < MAX_LOCALE; ++loc)
{
- if(loc==GetSessionDbcLocale())
+ if (loc==GetSessionDbcLocale())
continue;
name = titleInfo->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
if (Utf8FitTo(name, wnamepart))
@@ -4276,7 +4276,7 @@ bool ChatHandler::HandleLookupTitleCommand(const char* args)
}
}
- if(loc < MAX_LOCALE)
+ if (loc < MAX_LOCALE)
{
char const* knownStr = target && target->HasTitle(titleInfo) ? GetTrinityString(LANG_KNOWN) : "";
@@ -4306,7 +4306,7 @@ bool ChatHandler::HandleTitlesAddCommand(const char* args)
{
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
char* id_p = extractKeyFromLink((char*)args,"Htitle");
- if(!id_p)
+ if (!id_p)
return false;
int32 id = atoi(id_p);
@@ -4318,7 +4318,7 @@ bool ChatHandler::HandleTitlesAddCommand(const char* args)
}
Player * target = getSelectedPlayer();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
@@ -4330,7 +4330,7 @@ bool ChatHandler::HandleTitlesAddCommand(const char* args)
return false;
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
- if(!titleInfo)
+ if (!titleInfo)
{
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
SetSentErrorMessage(true);
@@ -4353,7 +4353,7 @@ bool ChatHandler::HandleTitlesRemoveCommand(const char* args)
{
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
char* id_p = extractKeyFromLink((char*)args,"Htitle");
- if(!id_p)
+ if (!id_p)
return false;
int32 id = atoi(id_p);
@@ -4365,7 +4365,7 @@ bool ChatHandler::HandleTitlesRemoveCommand(const char* args)
}
Player * target = getSelectedPlayer();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
@@ -4377,7 +4377,7 @@ bool ChatHandler::HandleTitlesRemoveCommand(const char* args)
return false;
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
- if(!titleInfo)
+ if (!titleInfo)
{
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
SetSentErrorMessage(true);
@@ -4406,7 +4406,7 @@ bool ChatHandler::HandleTitlesRemoveCommand(const char* args)
//Edit Player KnownTitles
bool ChatHandler::HandleTitlesSetMaskCommand(const char* args)
{
- if(!*args)
+ if (!*args)
return false;
uint64 titles = 0;
@@ -4428,7 +4428,7 @@ bool ChatHandler::HandleTitlesSetMaskCommand(const char* args)
uint64 titles2 = titles;
for (uint32 i = 1; i < sCharTitlesStore.GetNumRows(); ++i)
- if(CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i))
+ if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i))
titles2 &= ~(uint64(1) << tEntry->bit_index);
titles &= ~titles2; // remove not existed titles
@@ -4448,7 +4448,7 @@ bool ChatHandler::HandleTitlesSetMaskCommand(const char* args)
bool ChatHandler::HandleCharacterTitlesCommand(const char* args)
{
Player* target;
- if(!extractPlayerTarget((char*)args,&target))
+ if (!extractPlayerTarget((char*)args,&target))
return false;
LocaleConstant loc = GetSessionDbcLocale();
@@ -4462,7 +4462,7 @@ bool ChatHandler::HandleCharacterTitlesCommand(const char* args)
if (titleInfo && target->HasTitle(titleInfo))
{
std::string name = titleInfo->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE)==titleInfo->bit_index
@@ -4486,7 +4486,7 @@ bool ChatHandler::HandleTitlesCurrentCommand(const char* args)
{
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
char* id_p = extractKeyFromLink((char*)args,"Htitle");
- if(!id_p)
+ if (!id_p)
return false;
int32 id = atoi(id_p);
@@ -4498,7 +4498,7 @@ bool ChatHandler::HandleTitlesCurrentCommand(const char* args)
}
Player * target = getSelectedPlayer();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
@@ -4510,7 +4510,7 @@ bool ChatHandler::HandleTitlesCurrentCommand(const char* args)
return false;
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
- if(!titleInfo)
+ if (!titleInfo)
{
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
SetSentErrorMessage(true);
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 36471278b34..c237bccf4e5 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -617,7 +617,7 @@ bool ChatHandler::HandleReloadAllQuestCommand(const char* /*args*/)
bool ChatHandler::HandleReloadAllScriptsCommand(const char*)
{
- if(sWorld.IsScriptScheduled())
+ if (sWorld.IsScriptScheduled())
{
PSendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
@@ -1135,19 +1135,19 @@ bool ChatHandler::HandleReloadItemRequiredTragetCommand(const char*)
bool ChatHandler::HandleReloadGameObjectScriptsCommand(const char* arg)
{
- if(sWorld.IsScriptScheduled())
+ if (sWorld.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
- if(*arg!='a')
+ if (*arg!='a')
sLog.outString( "Re-Loading Scripts from `gameobject_scripts`...");
objmgr.LoadGameObjectScripts();
- if(*arg!='a')
+ if (*arg!='a')
SendGlobalGMSysMessage("DB table `gameobject_scripts` reloaded.");
return true;
@@ -1155,19 +1155,19 @@ bool ChatHandler::HandleReloadGameObjectScriptsCommand(const char* arg)
bool ChatHandler::HandleReloadEventScriptsCommand(const char* arg)
{
- if(sWorld.IsScriptScheduled())
+ if (sWorld.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
- if(*arg!='a')
+ if (*arg!='a')
sLog.outString( "Re-Loading Scripts from `event_scripts`...");
objmgr.LoadEventScripts();
- if(*arg!='a')
+ if (*arg!='a')
SendGlobalGMSysMessage("DB table `event_scripts` reloaded.");
return true;
@@ -1175,19 +1175,19 @@ bool ChatHandler::HandleReloadEventScriptsCommand(const char* arg)
bool ChatHandler::HandleReloadWpScriptsCommand(const char* arg)
{
- if(sWorld.IsScriptScheduled())
+ if (sWorld.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
- if(*arg!='a')
+ if (*arg!='a')
sLog.outString( "Re-Loading Scripts from `waypoint_scripts`...");
objmgr.LoadWaypointScripts();
- if(*arg!='a')
+ if (*arg!='a')
SendGlobalGMSysMessage("DB table `waypoint_scripts` reloaded.");
return true;
@@ -1220,19 +1220,19 @@ bool ChatHandler::HandleReloadEventAIScriptsCommand(const char* arg)
bool ChatHandler::HandleReloadQuestEndScriptsCommand(const char* arg)
{
- if(sWorld.IsScriptScheduled())
+ if (sWorld.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
- if(*arg!='a')
+ if (*arg!='a')
sLog.outString( "Re-Loading Scripts from `quest_end_scripts`...");
objmgr.LoadQuestEndScripts();
- if(*arg!='a')
+ if (*arg!='a')
SendGlobalGMSysMessage("DB table `quest_end_scripts` reloaded.");
return true;
@@ -1240,19 +1240,19 @@ bool ChatHandler::HandleReloadQuestEndScriptsCommand(const char* arg)
bool ChatHandler::HandleReloadQuestStartScriptsCommand(const char* arg)
{
- if(sWorld.IsScriptScheduled())
+ if (sWorld.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
- if(*arg!='a')
+ if (*arg!='a')
sLog.outString( "Re-Loading Scripts from `quest_start_scripts`...");
objmgr.LoadQuestStartScripts();
- if(*arg!='a')
+ if (*arg!='a')
SendGlobalGMSysMessage("DB table `quest_start_scripts` reloaded.");
return true;
@@ -1260,19 +1260,19 @@ bool ChatHandler::HandleReloadQuestStartScriptsCommand(const char* arg)
bool ChatHandler::HandleReloadSpellScriptsCommand(const char* arg)
{
- if(sWorld.IsScriptScheduled())
+ if (sWorld.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
- if(*arg!='a')
+ if (*arg!='a')
sLog.outString( "Re-Loading Scripts from `spell_scripts`...");
objmgr.LoadSpellScripts();
- if(*arg!='a')
+ if (*arg!='a')
SendGlobalGMSysMessage("DB table `spell_scripts` reloaded.");
return true;
@@ -1403,7 +1403,7 @@ bool ChatHandler::HandleReloadAuctionsCommand(const char *args)
bool ChatHandler::HandleAccountSetGmLevelCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
std::string targetAccountName;
@@ -1497,7 +1497,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char *args)
/// Set password for account
bool ChatHandler::HandleAccountSetPasswordCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
///- Get the command line arguments
@@ -1563,7 +1563,7 @@ bool ChatHandler::HandleAccountSetPasswordCommand(const char *args)
bool ChatHandler::HandleMaxSkillCommand(const char* /*args*/)
{
Player* SelectedPlayer = getSelectedPlayer();
- if(!SelectedPlayer)
+ if (!SelectedPlayer)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
@@ -2319,7 +2319,7 @@ bool ChatHandler::HandleLearnAllCommand(const char* /*args*/)
continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
- if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer()))
+ if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer()))
{
PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spell);
continue;
@@ -2359,7 +2359,7 @@ bool ChatHandler::HandleLearnAllGMCommand(const char* /*args*/)
uint32 spell = atol((char*)gmSpellList[gmSpellIter++]);
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
- if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer()))
+ if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer()))
{
PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spell);
continue;
@@ -2382,35 +2382,35 @@ bool ChatHandler::HandleLearnAllMyClassCommand(const char* /*args*/)
bool ChatHandler::HandleLearnAllMySpellsCommand(const char* /*args*/)
{
ChrClassesEntry const* clsEntry = sChrClassesStore.LookupEntry(m_session->GetPlayer()->getClass());
- if(!clsEntry)
+ if (!clsEntry)
return true;
uint32 family = clsEntry->spellfamily;
for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(i);
- if(!spellInfo)
+ if (!spellInfo)
continue;
// skip server-side/triggered spells
- if(spellInfo->spellLevel==0)
+ if (spellInfo->spellLevel==0)
continue;
// skip wrong class/race skills
- if(!m_session->GetPlayer()->IsSpellFitByClassAndRace(spellInfo->Id))
+ if (!m_session->GetPlayer()->IsSpellFitByClassAndRace(spellInfo->Id))
continue;
// skip other spell families
- if( spellInfo->SpellFamilyName != family)
+ if ( spellInfo->SpellFamilyName != family)
continue;
// skip spells with first rank learned as talent (and all talents then also)
uint32 first_rank = spellmgr.GetFirstSpellInChain(spellInfo->Id);
- if(GetTalentSpellCost(first_rank) > 0 )
+ if (GetTalentSpellCost(first_rank) > 0 )
continue;
// skip broken spells
- if(!SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false))
+ if (!SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false))
continue;
m_session->GetPlayer()->learnSpell(i,false);
@@ -2428,32 +2428,32 @@ bool ChatHandler::HandleLearnAllMyTalentsCommand(const char* /*args*/)
for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i)
{
TalentEntry const *talentInfo = sTalentStore.LookupEntry(i);
- if(!talentInfo)
+ if (!talentInfo)
continue;
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentInfo->TalentTab );
- if(!talentTabInfo)
+ if (!talentTabInfo)
continue;
- if( (classMask & talentTabInfo->ClassMask) == 0 )
+ if ( (classMask & talentTabInfo->ClassMask) == 0 )
continue;
// search highest talent rank
uint32 spellId = 0;
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
{
- if(talentInfo->RankID[rank] != 0)
+ if (talentInfo->RankID[rank] != 0)
{
spellId = talentInfo->RankID[rank];
break;
}
}
- if(!spellId) // ??? none spells in talent
+ if (!spellId) // ??? none spells in talent
continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
- if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false))
+ if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false))
continue;
// learn highest rank of talent and learn all non-talent spell ranks (recursive by tree)
@@ -2472,7 +2472,7 @@ bool ChatHandler::HandleLearnAllMyPetTalentsCommand(const char* /*args*/)
Player* player = m_session->GetPlayer();
Pet* pet = player->GetPet();
- if(!pet)
+ if (!pet)
{
SendSysMessage(LANG_NO_PET_FOUND);
SetSentErrorMessage(true);
@@ -2480,7 +2480,7 @@ bool ChatHandler::HandleLearnAllMyPetTalentsCommand(const char* /*args*/)
}
CreatureInfo const *ci = pet->GetCreatureInfo();
- if(!ci)
+ if (!ci)
{
SendSysMessage(LANG_WRONG_PET_TYPE);
SetSentErrorMessage(true);
@@ -2488,14 +2488,14 @@ bool ChatHandler::HandleLearnAllMyPetTalentsCommand(const char* /*args*/)
}
CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(ci->family);
- if(!pet_family)
+ if (!pet_family)
{
SendSysMessage(LANG_WRONG_PET_TYPE);
SetSentErrorMessage(true);
return false;
}
- if(pet_family->petTalentType < 0) // not hunter pet
+ if (pet_family->petTalentType < 0) // not hunter pet
{
SendSysMessage(LANG_WRONG_PET_TYPE);
SetSentErrorMessage(true);
@@ -2505,15 +2505,15 @@ bool ChatHandler::HandleLearnAllMyPetTalentsCommand(const char* /*args*/)
for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i)
{
TalentEntry const *talentInfo = sTalentStore.LookupEntry(i);
- if(!talentInfo)
+ if (!talentInfo)
continue;
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentInfo->TalentTab );
- if(!talentTabInfo)
+ if (!talentTabInfo)
continue;
// prevent learn talent for different family (cheating)
- if(((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask)==0)
+ if (((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask)==0)
continue;
// search highest talent rank
@@ -2521,18 +2521,18 @@ bool ChatHandler::HandleLearnAllMyPetTalentsCommand(const char* /*args*/)
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
{
- if(talentInfo->RankID[rank]!=0)
+ if (talentInfo->RankID[rank]!=0)
{
spellid = talentInfo->RankID[rank];
break;
}
}
- if(!spellid) // ??? none spells in talent
+ if (!spellid) // ??? none spells in talent
continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid);
- if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false))
+ if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false))
continue;
// learn highest rank of talent and learn all non-talent spell ranks (recursive by tree)
@@ -2558,7 +2558,7 @@ bool ChatHandler::HandleLearnAllLangCommand(const char* /*args*/)
bool ChatHandler::HandleLearnAllDefaultCommand(const char *args)
{
Player* target;
- if(!extractPlayerTarget((char*)args,&target))
+ if (!extractPlayerTarget((char*)args,&target))
return false;
target->learnDefaultSpells();
@@ -2572,7 +2572,7 @@ bool ChatHandler::HandleLearnCommand(const char *args)
{
Player* targetPlayer = getSelectedPlayer();
- if(!targetPlayer)
+ if (!targetPlayer)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
@@ -2581,14 +2581,14 @@ bool ChatHandler::HandleLearnCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = extractSpellIdFromLink((char*)args);
- if(!spell || !sSpellStore.LookupEntry(spell))
+ if (!spell || !sSpellStore.LookupEntry(spell))
return false;
char const* allStr = strtok(NULL," ");
bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
- if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer()))
+ if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer()))
{
PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spell);
SetSentErrorMessage(true);
@@ -2597,7 +2597,7 @@ bool ChatHandler::HandleLearnCommand(const char *args)
if (!allRanks && targetPlayer->HasSpell(spell))
{
- if(targetPlayer == m_session->GetPlayer())
+ if (targetPlayer == m_session->GetPlayer())
SendSysMessage(LANG_YOU_KNOWN_SPELL);
else
PSendSysMessage(LANG_TARGET_KNOWN_SPELL,GetNameLink(targetPlayer).c_str());
@@ -2605,13 +2605,13 @@ bool ChatHandler::HandleLearnCommand(const char *args)
return false;
}
- if(allRanks)
+ if (allRanks)
targetPlayer->learnSpellHighRank(spell);
else
targetPlayer->learnSpell(spell,false);
uint32 first_spell = spellmgr.GetFirstSpellInChain(spell);
- if(GetTalentSpellCost(first_spell))
+ if (GetTalentSpellCost(first_spell))
targetPlayer->SendTalentsInfoData(false);
return true;
@@ -2624,11 +2624,11 @@ bool ChatHandler::HandleAddItemCommand(const char *args)
uint32 itemId = 0;
- if(args[0]=='[') // [name] manual form
+ if (args[0]=='[') // [name] manual form
{
char* citemName = strtok((char*)args, "]");
- if(citemName && citemName[0])
+ if (citemName && citemName[0])
{
std::string itemName = citemName+1;
WorldDatabase.escape_string(itemName);
@@ -2647,7 +2647,7 @@ bool ChatHandler::HandleAddItemCommand(const char *args)
else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
{
char* cId = extractKeyFromLink((char*)args,"Hitem");
- if(!cId)
+ if (!cId)
return false;
itemId = atol(cId);
}
@@ -2664,13 +2664,13 @@ bool ChatHandler::HandleAddItemCommand(const char *args)
Player* pl = m_session->GetPlayer();
Player* plTarget = getSelectedPlayer();
- if(!plTarget)
+ if (!plTarget)
plTarget = pl;
sLog.outDetail(GetTrinityString(LANG_ADDITEM), itemId, count);
ItemPrototype const *pProto = objmgr.GetItemPrototype(itemId);
- if(!pProto)
+ if (!pProto)
{
PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
SetSentErrorMessage(true);
@@ -2691,10 +2691,10 @@ bool ChatHandler::HandleAddItemCommand(const char *args)
// check space and find places
ItemPosCountVec dest;
uint8 msg = plTarget->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount );
- if( msg != EQUIP_ERR_OK ) // convert to possible store amount
+ if ( msg != EQUIP_ERR_OK ) // convert to possible store amount
count -= noSpaceForCount;
- if( count == 0 || dest.empty()) // can't add any
+ if ( count == 0 || dest.empty()) // can't add any
{
PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount );
SetSentErrorMessage(true);
@@ -2704,19 +2704,19 @@ bool ChatHandler::HandleAddItemCommand(const char *args)
Item* item = plTarget->StoreNewItem( dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
// remove binding (let GM give it to another player later)
- if(pl==plTarget)
+ if (pl==plTarget)
for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
- if(Item* item1 = pl->GetItemByPos(itr->pos))
+ if (Item* item1 = pl->GetItemByPos(itr->pos))
item1->SetBinding( false );
- if(count > 0 && item)
+ if (count > 0 && item)
{
pl->SendNewItem(item,count,false,true);
- if(pl!=plTarget)
+ if (pl!=plTarget)
plTarget->SendNewItem(item,count,true,false);
}
- if(noSpaceForCount > 0)
+ if (noSpaceForCount > 0)
PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
return true;
@@ -2743,7 +2743,7 @@ bool ChatHandler::HandleAddItemSetCommand(const char *args)
Player* pl = m_session->GetPlayer();
Player* plTarget = getSelectedPlayer();
- if(!plTarget)
+ if (!plTarget)
plTarget = pl;
sLog.outDetail(GetTrinityString(LANG_ADDITEMSET), itemsetId);
@@ -2793,15 +2793,15 @@ bool ChatHandler::HandleAddItemSetCommand(const char *args)
bool ChatHandler::HandleListItemCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
char* cId = extractKeyFromLink((char*)args,"Hitem");
- if(!cId)
+ if (!cId)
return false;
uint32 item_id = atol(cId);
- if(!item_id)
+ if (!item_id)
{
PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id);
SetSentErrorMessage(true);
@@ -2809,7 +2809,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
}
ItemPrototype const* itemProto = objmgr.GetItemPrototype(item_id);
- if(!itemProto)
+ if (!itemProto)
{
PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id);
SetSentErrorMessage(true);
@@ -2819,7 +2819,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
char* c_count = strtok(NULL, " ");
int count = c_count ? atol(c_count) : 10;
- if(count < 0)
+ if (count < 0)
return false;
QueryResult_AutoPtr result;
@@ -2827,7 +2827,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
// inventory case
uint32 inv_count = 0;
result=CharacterDatabase.PQuery("SELECT COUNT(item_template) FROM character_inventory WHERE item_template='%u'",item_id);
- if(result)
+ if (result)
inv_count = (*result)[0].GetUInt32();
result=CharacterDatabase.PQuery(
@@ -2837,7 +2837,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
"WHERE ci.item_template='%u' AND ci.guid = characters.guid LIMIT %u ",
item_id,uint32(count));
- if(result)
+ if (result)
{
do
{
@@ -2850,11 +2850,11 @@ bool ChatHandler::HandleListItemCommand(const char *args)
std::string owner_name = fields[5].GetCppString();
char const* item_pos = 0;
- if(Player::IsEquipmentPos(item_bag,item_slot))
+ if (Player::IsEquipmentPos(item_bag,item_slot))
item_pos = "[equipped]";
- else if(Player::IsInventoryPos(item_bag,item_slot))
+ else if (Player::IsInventoryPos(item_bag,item_slot))
item_pos = "[in inventory]";
- else if(Player::IsBankPos(item_bag,item_slot))
+ else if (Player::IsBankPos(item_bag,item_slot))
item_pos = "[in bank]";
else
item_pos = "";
@@ -2865,19 +2865,19 @@ bool ChatHandler::HandleListItemCommand(const char *args)
int64 res_count = result->GetRowCount();
- if(count > res_count)
+ if (count > res_count)
count-=res_count;
- else if(count)
+ else if (count)
count = 0;
}
// mail case
uint32 mail_count = 0;
result=CharacterDatabase.PQuery("SELECT COUNT(item_template) FROM mail_items WHERE item_template='%u'", item_id);
- if(result)
+ if (result)
mail_count = (*result)[0].GetUInt32();
- if(count > 0)
+ if (count > 0)
{
result=CharacterDatabase.PQuery(
// 0 1 2 3 4 5 6
@@ -2889,7 +2889,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
else
result = QueryResult_AutoPtr(NULL);
- if(result)
+ if (result)
{
do
{
@@ -2910,19 +2910,19 @@ bool ChatHandler::HandleListItemCommand(const char *args)
int64 res_count = result->GetRowCount();
- if(count > res_count)
+ if (count > res_count)
count-=res_count;
- else if(count)
+ else if (count)
count = 0;
}
// auction case
uint32 auc_count = 0;
result=CharacterDatabase.PQuery("SELECT COUNT(item_template) FROM auctionhouse WHERE item_template='%u'",item_id);
- if(result)
+ if (result)
auc_count = (*result)[0].GetUInt32();
- if(count > 0)
+ if (count > 0)
{
result=CharacterDatabase.PQuery(
// 0 1 2 3
@@ -2933,7 +2933,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
else
result = QueryResult_AutoPtr(NULL);
- if(result)
+ if (result)
{
do
{
@@ -2952,7 +2952,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
// guild bank case
uint32 guild_count = 0;
result=CharacterDatabase.PQuery("SELECT COUNT(item_entry) FROM guild_bank_item WHERE item_entry='%u'",item_id);
- if(result)
+ if (result)
guild_count = (*result)[0].GetUInt32();
result=CharacterDatabase.PQuery(
@@ -2961,7 +2961,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
"FROM guild_bank_item AS gi, guild WHERE gi.item_entry='%u' AND gi.guildid = guild.guildid LIMIT %u ",
item_id,uint32(count));
- if(result)
+ if (result)
{
do
{
@@ -2977,13 +2977,13 @@ bool ChatHandler::HandleListItemCommand(const char *args)
int64 res_count = result->GetRowCount();
- if(count > res_count)
+ if (count > res_count)
count-=res_count;
- else if(count)
+ else if (count)
count = 0;
}
- if(inv_count+mail_count+auc_count+guild_count == 0)
+ if (inv_count+mail_count+auc_count+guild_count == 0)
{
SendSysMessage(LANG_COMMAND_NOITEMFOUND);
SetSentErrorMessage(true);
@@ -2997,16 +2997,16 @@ bool ChatHandler::HandleListItemCommand(const char *args)
bool ChatHandler::HandleListObjectCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
// number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hgameobject_entry");
- if(!cId)
+ if (!cId)
return false;
uint32 go_id = atol(cId);
- if(!go_id)
+ if (!go_id)
{
PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id);
SetSentErrorMessage(true);
@@ -3014,7 +3014,7 @@ bool ChatHandler::HandleListObjectCommand(const char *args)
}
GameObjectInfo const * gInfo = objmgr.GetGameObjectInfo(go_id);
- if(!gInfo)
+ if (!gInfo)
{
PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id);
SetSentErrorMessage(true);
@@ -3024,17 +3024,17 @@ bool ChatHandler::HandleListObjectCommand(const char *args)
char* c_count = strtok(NULL, " ");
int count = c_count ? atol(c_count) : 10;
- if(count < 0)
+ if (count < 0)
return false;
QueryResult_AutoPtr result;
uint32 obj_count = 0;
result=WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'",go_id);
- if(result)
+ if (result)
obj_count = (*result)[0].GetUInt32();
- if(m_session)
+ if (m_session)
{
Player* pl = m_session->GetPlayer();
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
@@ -3070,19 +3070,19 @@ bool ChatHandler::HandleGameObjectStateCommand(const char *args)
{
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
char* cId = extractKeyFromLink((char*)args, "Hgameobject");
- if(!cId)
+ if (!cId)
return false;
uint32 lowguid = atoi(cId);
- if(!lowguid)
+ if (!lowguid)
return false;
GameObject* gobj = NULL;
- if(GameObjectData const* goData = objmgr.GetGOData(lowguid))
+ if (GameObjectData const* goData = objmgr.GetGOData(lowguid))
gobj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, goData->id);
- if(!gobj)
+ if (!gobj)
{
PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
SetSentErrorMessage(true);
@@ -3090,15 +3090,15 @@ bool ChatHandler::HandleGameObjectStateCommand(const char *args)
}
char* ctype = strtok(NULL, " ");
- if(!ctype)
+ if (!ctype)
return false;
int32 type = atoi(ctype);
- if(type < 0)
+ if (type < 0)
{
- if(type == -1)
+ if (type == -1)
gobj->SendObjectDeSpawnAnim(gobj->GetGUID());
- else if(type == -2)
+ else if (type == -2)
{
return false;
}
@@ -3106,14 +3106,14 @@ bool ChatHandler::HandleGameObjectStateCommand(const char *args)
}
char* cstate = strtok(NULL, " ");
- if(!cstate)
+ if (!cstate)
return false;
int32 state = atoi(cstate);
- if(type < 4)
+ if (type < 4)
gobj->SetByteValue(GAMEOBJECT_BYTES_1, type, state);
- else if(type == 4)
+ else if (type == 4)
{
WorldPacket data(SMSG_GAMEOBJECT_CUSTOM_ANIM,8+4);
data << gobj->GetGUID();
@@ -3127,16 +3127,16 @@ bool ChatHandler::HandleGameObjectStateCommand(const char *args)
bool ChatHandler::HandleListCreatureCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
// number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hcreature_entry");
- if(!cId)
+ if (!cId)
return false;
uint32 cr_id = atol(cId);
- if(!cr_id)
+ if (!cr_id)
{
PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id);
SetSentErrorMessage(true);
@@ -3144,7 +3144,7 @@ bool ChatHandler::HandleListCreatureCommand(const char *args)
}
CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(cr_id);
- if(!cInfo)
+ if (!cInfo)
{
PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id);
SetSentErrorMessage(true);
@@ -3154,17 +3154,17 @@ bool ChatHandler::HandleListCreatureCommand(const char *args)
char* c_count = strtok(NULL, " ");
int count = c_count ? atol(c_count) : 10;
- if(count < 0)
+ if (count < 0)
return false;
QueryResult_AutoPtr result;
uint32 cr_count = 0;
result=WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'",cr_id);
- if(result)
+ if (result)
cr_count = (*result)[0].GetUInt32();
- if(m_session)
+ if (m_session)
{
Player* pl = m_session->GetPlayer();
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
@@ -3198,14 +3198,14 @@ bool ChatHandler::HandleListCreatureCommand(const char *args)
bool ChatHandler::HandleLookupItemCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
std::string namepart = args;
std::wstring wnamepart;
// converting string that we try to find to lower case
- if(!Utf8toWStr(namepart,wnamepart))
+ if (!Utf8toWStr(namepart,wnamepart))
return false;
wstrToLower(wnamepart);
@@ -3216,7 +3216,7 @@ bool ChatHandler::HandleLookupItemCommand(const char *args)
for (uint32 id = 0; id < sItemStorage.MaxEntry; id++)
{
ItemPrototype const *pProto = sItemStorage.LookupEntry<ItemPrototype >(id);
- if(!pProto)
+ if (!pProto)
continue;
int loc_idx = GetSessionDbLocaleIndex();
@@ -3236,7 +3236,7 @@ bool ChatHandler::HandleLookupItemCommand(const char *args)
else
PSendSysMessage(LANG_ITEM_LIST_CONSOLE, id, name.c_str());
- if(!found)
+ if (!found)
found = true;
continue;
@@ -3246,7 +3246,7 @@ bool ChatHandler::HandleLookupItemCommand(const char *args)
}
std::string name = pProto->Name1;
- if(name.empty())
+ if (name.empty())
continue;
if (Utf8FitTo(name, wnamepart))
@@ -3256,7 +3256,7 @@ bool ChatHandler::HandleLookupItemCommand(const char *args)
else
PSendSysMessage(LANG_ITEM_LIST_CONSOLE, id, name.c_str());
- if(!found)
+ if (!found)
found = true;
}
}
@@ -3269,13 +3269,13 @@ bool ChatHandler::HandleLookupItemCommand(const char *args)
bool ChatHandler::HandleLookupItemSetCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
std::string namepart = args;
std::wstring wnamepart;
- if(!Utf8toWStr(namepart,wnamepart))
+ if (!Utf8toWStr(namepart,wnamepart))
return false;
// converting string that we try to find to lower case
@@ -3287,11 +3287,11 @@ bool ChatHandler::HandleLookupItemSetCommand(const char *args)
for (uint32 id = 0; id < sItemSetStore.GetNumRows(); id++)
{
ItemSetEntry const *set = sItemSetStore.LookupEntry(id);
- if(set)
+ if (set)
{
int loc = GetSessionDbcLocale();
std::string name = set->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
if (!Utf8FitTo(name, wnamepart))
@@ -3299,11 +3299,11 @@ bool ChatHandler::HandleLookupItemSetCommand(const char *args)
loc = 0;
for (; loc < MAX_LOCALE; ++loc)
{
- if(loc==GetSessionDbcLocale())
+ if (loc==GetSessionDbcLocale())
continue;
name = set->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
if (Utf8FitTo(name, wnamepart))
@@ -3311,7 +3311,7 @@ bool ChatHandler::HandleLookupItemSetCommand(const char *args)
}
}
- if(loc < MAX_LOCALE)
+ if (loc < MAX_LOCALE)
{
// send item set in "id - [namedlink locale]" format
if (m_session)
@@ -3319,7 +3319,7 @@ bool ChatHandler::HandleLookupItemSetCommand(const char *args)
else
PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE,id,name.c_str(),localeNames[loc]);
- if(!found)
+ if (!found)
found = true;
}
}
@@ -3331,7 +3331,7 @@ bool ChatHandler::HandleLookupItemSetCommand(const char *args)
bool ChatHandler::HandleLookupSkillCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
// can be NULL in console call
@@ -3340,7 +3340,7 @@ bool ChatHandler::HandleLookupSkillCommand(const char *args)
std::string namepart = args;
std::wstring wnamepart;
- if(!Utf8toWStr(namepart,wnamepart))
+ if (!Utf8toWStr(namepart,wnamepart))
return false;
// converting string that we try to find to lower case
@@ -3352,11 +3352,11 @@ bool ChatHandler::HandleLookupSkillCommand(const char *args)
for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); id++)
{
SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(id);
- if(skillInfo)
+ if (skillInfo)
{
int loc = GetSessionDbcLocale();
std::string name = skillInfo->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
if (!Utf8FitTo(name, wnamepart))
@@ -3364,11 +3364,11 @@ bool ChatHandler::HandleLookupSkillCommand(const char *args)
loc = 0;
for (; loc < MAX_LOCALE; ++loc)
{
- if(loc==GetSessionDbcLocale())
+ if (loc==GetSessionDbcLocale())
continue;
name = skillInfo->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
if (Utf8FitTo(name, wnamepart))
@@ -3376,11 +3376,11 @@ bool ChatHandler::HandleLookupSkillCommand(const char *args)
}
}
- if(loc < MAX_LOCALE)
+ if (loc < MAX_LOCALE)
{
char valStr[50] = "";
char const* knownStr = "";
- if(target && target->HasSkill(id))
+ if (target && target->HasSkill(id))
{
knownStr = GetTrinityString(LANG_KNOWN);
uint32 curValue = target->GetPureSkillValue(id);
@@ -3398,7 +3398,7 @@ bool ChatHandler::HandleLookupSkillCommand(const char *args)
else
PSendSysMessage(LANG_SKILL_LIST_CONSOLE,id,name.c_str(),localeNames[loc],knownStr,valStr);
- if(!found)
+ if (!found)
found = true;
}
}
@@ -3410,7 +3410,7 @@ bool ChatHandler::HandleLookupSkillCommand(const char *args)
bool ChatHandler::HandleLookupSpellCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
// can be NULL at console call
@@ -3419,7 +3419,7 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
std::string namepart = args;
std::wstring wnamepart;
- if(!Utf8toWStr(namepart,wnamepart))
+ if (!Utf8toWStr(namepart,wnamepart))
return false;
// converting string that we try to find to lower case
@@ -3431,11 +3431,11 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
for (uint32 id = 0; id < sSpellStore.GetNumRows(); id++)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(id);
- if(spellInfo)
+ if (spellInfo)
{
int loc = GetSessionDbcLocale();
std::string name = spellInfo->SpellName[loc];
- if(name.empty())
+ if (name.empty())
continue;
if (!Utf8FitTo(name, wnamepart))
@@ -3443,11 +3443,11 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
loc = 0;
for (; loc < MAX_LOCALE; ++loc)
{
- if(loc==GetSessionDbcLocale())
+ if (loc==GetSessionDbcLocale())
continue;
name = spellInfo->SpellName[loc];
- if(name.empty())
+ if (name.empty())
continue;
if (Utf8FitTo(name, wnamepart))
@@ -3455,7 +3455,7 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
}
}
- if(loc < MAX_LOCALE)
+ if (loc < MAX_LOCALE)
{
bool known = target && target->HasSpell(id);
bool learn = (spellInfo->Effect[0] == SPELL_EFFECT_LEARN_SPELL);
@@ -3478,7 +3478,7 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
ss << id << " - " << name;
// include rank in link name
- if(rank)
+ if (rank)
ss << GetTrinityString(LANG_SPELL_RANK) << rank;
if (m_session)
@@ -3486,20 +3486,20 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
else
ss << " " << localeNames[loc];
- if(talent)
+ if (talent)
ss << GetTrinityString(LANG_TALENT);
- if(passive)
+ if (passive)
ss << GetTrinityString(LANG_PASSIVE);
- if(learn)
+ if (learn)
ss << GetTrinityString(LANG_LEARN);
- if(known)
+ if (known)
ss << GetTrinityString(LANG_KNOWN);
- if(active)
+ if (active)
ss << GetTrinityString(LANG_ACTIVE);
SendSysMessage(ss.str().c_str());
- if(!found)
+ if (!found)
found = true;
}
}
@@ -3511,7 +3511,7 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
bool ChatHandler::HandleLookupQuestCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
// can be NULL at console call
@@ -3521,7 +3521,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char *args)
std::wstring wnamepart;
// converting string that we try to find to lower case
- if(!Utf8toWStr(namepart,wnamepart))
+ if (!Utf8toWStr(namepart,wnamepart))
return false;
wstrToLower(wnamepart);
@@ -3547,18 +3547,18 @@ bool ChatHandler::HandleLookupQuestCommand(const char *args)
{
char const* statusStr = "";
- if(target)
+ if (target)
{
QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId());
- if(status == QUEST_STATUS_COMPLETE)
+ if (status == QUEST_STATUS_COMPLETE)
{
- if(target->GetQuestRewardStatus(qinfo->GetQuestId()))
+ if (target->GetQuestRewardStatus(qinfo->GetQuestId()))
statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
else
statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
}
- else if(status == QUEST_STATUS_INCOMPLETE)
+ else if (status == QUEST_STATUS_INCOMPLETE)
statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
}
@@ -3567,7 +3567,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char *args)
else
PSendSysMessage(LANG_QUEST_LIST_CONSOLE,qinfo->GetQuestId(),title.c_str(),statusStr);
- if(!found)
+ if (!found)
found = true;
continue;
@@ -3577,25 +3577,25 @@ bool ChatHandler::HandleLookupQuestCommand(const char *args)
}
std::string title = qinfo->GetTitle();
- if(title.empty())
+ if (title.empty())
continue;
if (Utf8FitTo(title, wnamepart))
{
char const* statusStr = "";
- if(target)
+ if (target)
{
QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId());
- if(status == QUEST_STATUS_COMPLETE)
+ if (status == QUEST_STATUS_COMPLETE)
{
- if(target->GetQuestRewardStatus(qinfo->GetQuestId()))
+ if (target->GetQuestRewardStatus(qinfo->GetQuestId()))
statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
else
statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
}
- else if(status == QUEST_STATUS_INCOMPLETE)
+ else if (status == QUEST_STATUS_INCOMPLETE)
statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
}
@@ -3604,7 +3604,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char *args)
else
PSendSysMessage(LANG_QUEST_LIST_CONSOLE,qinfo->GetQuestId(),title.c_str(),statusStr);
- if(!found)
+ if (!found)
found = true;
}
}
@@ -3634,7 +3634,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
for (uint32 id = 0; id< sCreatureStorage.MaxEntry; ++id)
{
CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo> (id);
- if(!cInfo)
+ if (!cInfo)
continue;
int loc_idx = GetSessionDbLocaleIndex();
@@ -3654,7 +3654,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
else
PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str ());
- if(!found)
+ if (!found)
found = true;
continue;
@@ -3674,7 +3674,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
else
PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str ());
- if(!found)
+ if (!found)
found = true;
}
}
@@ -3687,14 +3687,14 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
bool ChatHandler::HandleLookupObjectCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
std::string namepart = args;
std::wstring wnamepart;
// converting string that we try to find to lower case
- if(!Utf8toWStr(namepart,wnamepart))
+ if (!Utf8toWStr(namepart,wnamepart))
return false;
wstrToLower(wnamepart);
@@ -3704,7 +3704,7 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args)
for (uint32 id = 0; id< sGOStorage.MaxEntry; id++ )
{
GameObjectInfo const* gInfo = sGOStorage.LookupEntry<GameObjectInfo>(id);
- if(!gInfo)
+ if (!gInfo)
continue;
int loc_idx = GetSessionDbLocaleIndex();
@@ -3724,7 +3724,7 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args)
else
PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str());
- if(!found)
+ if (!found)
found = true;
continue;
@@ -3734,22 +3734,22 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args)
}
std::string name = gInfo->name;
- if(name.empty())
+ if (name.empty())
continue;
- if(Utf8FitTo(name, wnamepart))
+ if (Utf8FitTo(name, wnamepart))
{
if (m_session)
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str());
else
PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str());
- if(!found)
+ if (!found)
found = true;
}
}
- if(!found)
+ if (!found)
SendSysMessage(LANG_COMMAND_NOGAMEOBJECTFOUND);
return true;
@@ -3783,7 +3783,7 @@ bool ChatHandler::HandleLookupFactionCommand(const char *args)
int loc = GetSessionDbcLocale();
std::string name = factionEntry->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
if (!Utf8FitTo(name, wnamepart))
@@ -3791,11 +3791,11 @@ bool ChatHandler::HandleLookupFactionCommand(const char *args)
loc = 0;
for (; loc < MAX_LOCALE; ++loc)
{
- if(loc==GetSessionDbcLocale())
+ if (loc==GetSessionDbcLocale())
continue;
name = factionEntry->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
if (Utf8FitTo(name, wnamepart))
@@ -3803,7 +3803,7 @@ bool ChatHandler::HandleLookupFactionCommand(const char *args)
}
}
- if(loc < MAX_LOCALE)
+ if (loc < MAX_LOCALE)
{
// send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format
// or "id - [faction] [no reputation]" format
@@ -3820,17 +3820,17 @@ bool ChatHandler::HandleLookupFactionCommand(const char *args)
ss << " " << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ")";
- if(repState->Flags & FACTION_FLAG_VISIBLE)
+ if (repState->Flags & FACTION_FLAG_VISIBLE)
ss << GetTrinityString(LANG_FACTION_VISIBLE);
- if(repState->Flags & FACTION_FLAG_AT_WAR)
+ if (repState->Flags & FACTION_FLAG_AT_WAR)
ss << GetTrinityString(LANG_FACTION_ATWAR);
- if(repState->Flags & FACTION_FLAG_PEACE_FORCED)
+ if (repState->Flags & FACTION_FLAG_PEACE_FORCED)
ss << GetTrinityString(LANG_FACTION_PEACE_FORCED);
- if(repState->Flags & FACTION_FLAG_HIDDEN)
+ if (repState->Flags & FACTION_FLAG_HIDDEN)
ss << GetTrinityString(LANG_FACTION_HIDDEN);
- if(repState->Flags & FACTION_FLAG_INVISIBLE_FORCED)
+ if (repState->Flags & FACTION_FLAG_INVISIBLE_FORCED)
ss << GetTrinityString(LANG_FACTION_INVISIBLE_FORCED);
- if(repState->Flags & FACTION_FLAG_INACTIVE)
+ if (repState->Flags & FACTION_FLAG_INACTIVE)
ss << GetTrinityString(LANG_FACTION_INACTIVE);
}
else
@@ -3838,7 +3838,7 @@ bool ChatHandler::HandleLookupFactionCommand(const char *args)
SendSysMessage(ss.str().c_str());
- if(!found)
+ if (!found)
found = true;
}
}
@@ -3851,13 +3851,13 @@ bool ChatHandler::HandleLookupFactionCommand(const char *args)
bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
{
- if(!*args)
+ if (!*args)
return false;
std::string namepart = args;
std::wstring wnamepart;
- if(!Utf8toWStr(namepart,wnamepart))
+ if (!Utf8toWStr(namepart,wnamepart))
return false;
// converting string that we try to find to lower case
@@ -3869,11 +3869,11 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++)
{
TaxiNodesEntry const *nodeEntry = sTaxiNodesStore.LookupEntry(id);
- if(nodeEntry)
+ if (nodeEntry)
{
int loc = GetSessionDbcLocale();
std::string name = nodeEntry->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
if (!Utf8FitTo(name, wnamepart))
@@ -3881,11 +3881,11 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
loc = 0;
for (; loc < MAX_LOCALE; ++loc)
{
- if(loc==GetSessionDbcLocale())
+ if (loc==GetSessionDbcLocale())
continue;
name = nodeEntry->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
if (Utf8FitTo(name, wnamepart))
@@ -3893,7 +3893,7 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
}
}
- if(loc < MAX_LOCALE)
+ if (loc < MAX_LOCALE)
{
// send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format
if (m_session)
@@ -3903,7 +3903,7 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
PSendSysMessage (LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[loc],
nodeEntry->map_id,nodeEntry->x,nodeEntry->y,nodeEntry->z);
- if(!found)
+ if (!found)
found = true;
}
}
@@ -3915,14 +3915,14 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
bool ChatHandler::HandleLookupMapCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
/*std::string namepart = args;
std::wstring wnamepart;
// converting string that we try to find to lower case
- if(!Utf8toWStr(namepart, wnamepart))
+ if (!Utf8toWStr(namepart, wnamepart))
return false;
wstrToLower(wnamepart);
@@ -3933,42 +3933,42 @@ bool ChatHandler::HandleLookupMapCommand(const char *args)
for (uint32 id = 0; id < sMapStore.GetNumRows(); id++)
{
MapEntry const* MapInfo = sMapStore.LookupEntry(id);
- if(MapInfo)
+ if (MapInfo)
{
uint8 loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale();
std::string name = MapInfo->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
- if(!Utf8FitTo(name, wnamepart))
+ if (!Utf8FitTo(name, wnamepart))
{
loc = LOCALE_enUS;
for (; loc < MAX_LOCALE; loc++)
{
- if(m_session && loc == m_session->GetSessionDbcLocale())
+ if (m_session && loc == m_session->GetSessionDbcLocale())
continue;
name = MapInfo->name[loc];
- if(name.empty())
+ if (name.empty())
continue;
- if(Utf8FitTo(name, wnamepart))
+ if (Utf8FitTo(name, wnamepart))
break;
}
}
- if(loc < MAX_LOCALE)
+ if (loc < MAX_LOCALE)
{
// send map in "id - [name][Continent][Instance/Battleground/Arena][Raid reset time:][Heroic reset time:][Mountable]" format
std::ostringstream ss;
- if(m_session)
+ if (m_session)
ss << id << " - |cffffffff|Hmap:" << id << "|h[" << name << "]";
else // console
ss << id << " - [" << name << "]";
- if(MapInfo->IsContinent())
+ if (MapInfo->IsContinent())
ss << GetTrinityString(LANG_CONTINENT);
switch(MapInfo->map_type)
@@ -3978,42 +3978,42 @@ bool ChatHandler::HandleLookupMapCommand(const char *args)
case MAP_ARENA: ss << GetTrinityString(LANG_ARENA); break;
}
- if(MapInfo->IsRaid())
+ if (MapInfo->IsRaid())
ss << GetTrinityString(LANG_RAID);
- if(MapInfo->SupportsHeroicMode())
+ if (MapInfo->SupportsHeroicMode())
ss << GetTrinityString(LANG_HEROIC);
uint32 ResetTimeRaid = MapInfo->resetTimeRaid;
std::string ResetTimeRaidStr;
- if(ResetTimeRaid)
+ if (ResetTimeRaid)
ResetTimeRaidStr = secsToTimeString(ResetTimeRaid, true, false);
uint32 ResetTimeHeroic = MapInfo->resetTimeHeroic;
std::string ResetTimeHeroicStr;
- if(ResetTimeHeroic)
+ if (ResetTimeHeroic)
ResetTimeHeroicStr = secsToTimeString(ResetTimeHeroic, true, false);
- if(MapInfo->IsMountAllowed())
+ if (MapInfo->IsMountAllowed())
ss << GetTrinityString(LANG_MOUNTABLE);
- if(ResetTimeRaid && !ResetTimeHeroic)
+ if (ResetTimeRaid && !ResetTimeHeroic)
PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str());
- else if(!ResetTimeRaid && ResetTimeHeroic)
+ else if (!ResetTimeRaid && ResetTimeHeroic)
PSendSysMessage(ss.str().c_str(), ResetTimeHeroicStr.c_str());
- else if(ResetTimeRaid && ResetTimeHeroic)
+ else if (ResetTimeRaid && ResetTimeHeroic)
PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str(), ResetTimeHeroicStr.c_str());
else
SendSysMessage(ss.str().c_str());
- if(!found)
+ if (!found)
found = true;
}
}
}
- if(!found)
+ if (!found)
SendSysMessage(LANG_COMMAND_NOMAPFOUND);
*/
return true;
@@ -4029,20 +4029,20 @@ bool ChatHandler::HandleLookupMapCommand(const char *args)
*/
bool ChatHandler::HandleGuildCreateCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
// if not guild name only (in "") then player name
Player* target;
- if(!extractPlayerTarget(*args!='"' ? (char*)args : NULL, &target))
+ if (!extractPlayerTarget(*args!='"' ? (char*)args : NULL, &target))
return false;
char* tailStr = *args!='"' ? strtok(NULL, "") : (char*)args;
- if(!tailStr)
+ if (!tailStr)
return false;
char* guildStr = extractQuotedArg(tailStr);
- if(!guildStr)
+ if (!guildStr)
return false;
std::string guildname = guildStr;
@@ -4068,20 +4068,20 @@ bool ChatHandler::HandleGuildCreateCommand(const char *args)
bool ChatHandler::HandleGuildInviteCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
// if not guild name only (in "") then player name
uint64 target_guid;
- if(!extractPlayerTarget(*args!='"' ? (char*)args : NULL, NULL, &target_guid))
+ if (!extractPlayerTarget(*args!='"' ? (char*)args : NULL, NULL, &target_guid))
return false;
char* tailStr = *args!='"' ? strtok(NULL, "") : (char*)args;
- if(!tailStr)
+ if (!tailStr)
return false;
char* guildStr = extractQuotedArg(tailStr);
- if(!guildStr)
+ if (!guildStr)
return false;
std::string glName = guildStr;
@@ -4100,7 +4100,7 @@ bool ChatHandler::HandleGuildUninviteCommand(const char *args)
{
Player* target;
uint64 target_guid;
- if(!extractPlayerTarget((char*)args,&target,&target_guid))
+ if (!extractPlayerTarget((char*)args,&target,&target_guid))
return false;
uint32 glId = target ? target->GetGuildId () : Player::GetGuildIdFromDB (target_guid);
@@ -4120,13 +4120,13 @@ bool ChatHandler::HandleGuildRankCommand(const char *args)
char* nameStr;
char* rankStr;
extractOptFirstArg((char*)args,&nameStr,&rankStr);
- if(!rankStr)
+ if (!rankStr)
return false;
Player* target;
uint64 target_guid;
std::string target_name;
- if(!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
+ if (!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
return false;
uint32 glId = target ? target->GetGuildId () : Player::GetGuildIdFromDB (target_guid);
@@ -4151,7 +4151,7 @@ bool ChatHandler::HandleGuildDeleteCommand(const char *args)
return false;
char* guildStr = extractQuotedArg((char*)args);
- if(!guildStr)
+ if (!guildStr)
return false;
std::string gld = guildStr;
@@ -4172,10 +4172,10 @@ bool ChatHandler::HandleGetDistanceCommand(const char *args)
if (*args)
{
uint64 guid = extractGuidFromLink((char*)args);
- if(guid)
+ if (guid)
obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*m_session->GetPlayer(),guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
- if(!obj)
+ if (!obj)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
@@ -4186,7 +4186,7 @@ bool ChatHandler::HandleGetDistanceCommand(const char *args)
{
obj = getSelectedUnit();
- if(!obj)
+ if (!obj)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@@ -4202,22 +4202,22 @@ bool ChatHandler::HandleDieCommand(const char* /*args*/)
{
Unit* target = getSelectedUnit();
- if(!target || !m_session->GetPlayer()->GetSelection())
+ if (!target || !m_session->GetPlayer()->GetSelection())
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
return false;
}
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
- if(HasLowerSecurity((Player*)target,0,false))
+ if (HasLowerSecurity((Player*)target,0,false))
return false;
}
- if( target->isAlive() )
+ if ( target->isAlive() )
{
- if(sWorld.getConfig(CONFIG_DIE_COMMAND_MODE))
+ if (sWorld.getConfig(CONFIG_DIE_COMMAND_MODE))
m_session->GetPlayer()->Kill(target);
else
m_session->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
@@ -4248,7 +4248,7 @@ bool ChatHandler::HandleDamageCommand(const char * args)
return false;
int32 damage_int = atoi((char*)damageStr);
- if(damage_int <=0)
+ if (damage_int <=0)
return true;
uint32 damage = damage_int;
@@ -4265,7 +4265,7 @@ bool ChatHandler::HandleDamageCommand(const char * args)
}
uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL;
- if(school >= MAX_SPELL_SCHOOL)
+ if (school >= MAX_SPELL_SCHOOL)
return false;
SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
@@ -4311,7 +4311,7 @@ bool ChatHandler::HandleModifyArenaCommand(const char * args)
return false;
Player *target = getSelectedPlayer();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
@@ -4331,7 +4331,7 @@ bool ChatHandler::HandleReviveCommand(const char *args)
{
Player* target;
uint64 target_guid;
- if(!extractPlayerTarget((char*)args,&target,&target_guid))
+ if (!extractPlayerTarget((char*)args,&target,&target_guid))
return false;
if (target)
@@ -4350,7 +4350,7 @@ bool ChatHandler::HandleReviveCommand(const char *args)
bool ChatHandler::HandleAuraCommand(const char *args)
{
Unit *target = getSelectedUnit();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@@ -4369,7 +4369,7 @@ bool ChatHandler::HandleAuraCommand(const char *args)
bool ChatHandler::HandleUnAuraCommand(const char *args)
{
Unit *target = getSelectedUnit();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@@ -4385,7 +4385,7 @@ bool ChatHandler::HandleUnAuraCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spellID = extractSpellIdFromLink((char*)args);
- if(!spellID)
+ if (!spellID)
return false;
target->RemoveAurasDueToSpell(spellID);
@@ -4395,7 +4395,7 @@ bool ChatHandler::HandleUnAuraCommand(const char *args)
bool ChatHandler::HandleLinkGraveCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
char* px = strtok((char*)args, " ");
@@ -4419,7 +4419,7 @@ bool ChatHandler::HandleLinkGraveCommand(const char *args)
WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id);
- if(!graveyard )
+ if (!graveyard )
{
PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, g_id);
SetSentErrorMessage(true);
@@ -4431,14 +4431,14 @@ bool ChatHandler::HandleLinkGraveCommand(const char *args)
uint32 zoneId = player->GetZoneId();
AreaTableEntry const *areaEntry = GetAreaEntryByAreaID(zoneId);
- if(!areaEntry || areaEntry->zone !=0 )
+ if (!areaEntry || areaEntry->zone !=0 )
{
PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, g_id,zoneId);
SetSentErrorMessage(true);
return false;
}
- if(objmgr.AddGraveYardLink(g_id,zoneId,g_team))
+ if (objmgr.AddGraveYardLink(g_id,zoneId,g_team))
PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, g_id,zoneId);
else
PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, g_id,zoneId);
@@ -4452,7 +4452,7 @@ bool ChatHandler::HandleNearGraveCommand(const char *args)
size_t argslen = strlen(args);
- if(!*args)
+ if (!*args)
g_team = 0;
else if (strncmp((char*)args,"horde",argslen)==0)
g_team = HORDE;
@@ -4467,7 +4467,7 @@ bool ChatHandler::HandleNearGraveCommand(const char *args)
WorldSafeLocsEntry const* graveyard = objmgr.GetClosestGraveYard(
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(),player->GetMapId(),g_team);
- if(graveyard)
+ if (graveyard)
{
uint32 g_id = graveyard->ID;
@@ -4483,11 +4483,11 @@ bool ChatHandler::HandleNearGraveCommand(const char *args)
std::string team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM);
- if(g_team == 0)
+ if (g_team == 0)
team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
- else if(g_team == HORDE)
+ else if (g_team == HORDE)
team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
- else if(g_team == ALLIANCE)
+ else if (g_team == ALLIANCE)
team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, g_id,team_name.c_str(),zone_id);
@@ -4496,14 +4496,14 @@ bool ChatHandler::HandleNearGraveCommand(const char *args)
{
std::string team_name;
- if(g_team == 0)
+ if (g_team == 0)
team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
- else if(g_team == HORDE)
+ else if (g_team == HORDE)
team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
- else if(g_team == ALLIANCE)
+ else if (g_team == ALLIANCE)
team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
- if(g_team == ~uint32(0))
+ if (g_team == ~uint32(0))
PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id);
else
PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id,team_name.c_str());
@@ -4515,7 +4515,7 @@ bool ChatHandler::HandleNearGraveCommand(const char *args)
//-----------------------Npc Commands-----------------------
bool ChatHandler::HandleNpcAllowMovementCommand(const char* /*args*/)
{
- if(sWorld.getAllowMovement())
+ if (sWorld.getAllowMovement())
{
sWorld.SetAllowMovement(false);
SendSysMessage(LANG_CREATURE_MOVE_DISABLED);
@@ -4534,18 +4534,18 @@ bool ChatHandler::HandleNpcChangeEntryCommand(const char *args)
return false;
uint32 newEntryNum = atoi(args);
- if(!newEntryNum)
+ if (!newEntryNum)
return false;
Unit* unit = getSelectedUnit();
- if(!unit || unit->GetTypeId() != TYPEID_UNIT)
+ if (!unit || unit->GetTypeId() != TYPEID_UNIT)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
return false;
}
Creature* creature = unit->ToCreature();
- if(creature->UpdateEntry(newEntryNum))
+ if (creature->UpdateEntry(newEntryNum))
SendSysMessage(LANG_DONE);
else
SendSysMessage(LANG_ERROR);
@@ -4556,7 +4556,7 @@ bool ChatHandler::HandleNpcInfoCommand(const char* /*args*/)
{
Creature* target = getSelectedCreature();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -4571,7 +4571,7 @@ bool ChatHandler::HandleNpcInfoCommand(const char* /*args*/)
CreatureInfo const* cInfo = target->GetCreatureInfo();
int32 curRespawnDelay = target->GetRespawnTimeEx()-time(NULL);
- if(curRespawnDelay < 0)
+ if (curRespawnDelay < 0)
curRespawnDelay = 0;
std::string curRespawnDelayStr = secsToTimeString(curRespawnDelay,true);
std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(),true);
@@ -4586,8 +4586,8 @@ bool ChatHandler::HandleNpcInfoCommand(const char* /*args*/)
PSendSysMessage(LANG_NPCINFO_PHASEMASK, target->GetPhaseMask());
PSendSysMessage(LANG_NPCINFO_ARMOR, target->GetArmor());
PSendSysMessage(LANG_NPCINFO_POSITION,float(target->GetPositionX()), float(target->GetPositionY()), float(target->GetPositionZ()));
- if(const CreatureData* const linked = target->GetLinkedRespawnCreatureData())
- if(CreatureInfo const *master = GetCreatureInfo(linked->id))
+ if (const CreatureData* const linked = target->GetLinkedRespawnCreatureData())
+ if (CreatureInfo const *master = GetCreatureInfo(linked->id))
PSendSysMessage(LANG_NPCINFO_LINKGUID, objmgr.GetLinkedRespawnGuid(target->GetDBTableGUIDLow()), linked->id, master->Name);
if ((npcflags & UNIT_NPC_FLAG_VENDOR) )
@@ -4608,7 +4608,7 @@ bool ChatHandler::HandleNpcPlayEmoteCommand(const char *args)
uint32 emote = atoi((char*)args);
Creature* target = getSelectedCreature();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
@@ -4636,7 +4636,7 @@ bool ChatHandler::HandleNpcAddWeaponCommand(const char* /*args*/)
Creature *pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(), guid);
- if(!pCreature)
+ if (!pCreature)
{
SendSysMessage(LANG_SELECT_CREATURE);
return true;
@@ -4656,7 +4656,7 @@ bool ChatHandler::HandleNpcAddWeaponCommand(const char* /*args*/)
ItemPrototype* tmpItem = objmgr.GetItemPrototype(ItemID);
bool added = false;
- if(tmpItem)
+ if (tmpItem)
{
switch(SlotID)
{
@@ -4678,7 +4678,7 @@ bool ChatHandler::HandleNpcAddWeaponCommand(const char* /*args*/)
break;
}
- if(added)
+ if (added)
PSendSysMessage(LANG_ITEM_ADDED_TO_SLOT,ItemID,tmpItem->Name1,SlotID);
}
else
@@ -4755,19 +4755,19 @@ bool ChatHandler::HandleHoverCommand(const char *args)
void ChatHandler::HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel)
{
- if(player)
+ if (player)
{
player->GiveLevel(newlevel);
player->InitTalentForLevel();
player->SetUInt32Value(PLAYER_XP,0);
- if(needReportToTarget(player))
+ if (needReportToTarget(player))
{
- if(oldlevel == newlevel)
+ if (oldlevel == newlevel)
ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET,GetNameLink().c_str());
- else if(oldlevel < newlevel)
+ else if (oldlevel < newlevel)
ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP,GetNameLink().c_str(),newlevel);
- else // if(oldlevel > newlevel)
+ else // if (oldlevel > newlevel)
ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN,GetNameLink().c_str(),newlevel);
}
}
@@ -4783,11 +4783,11 @@ bool ChatHandler::HandleCharacterLevelCommand(const char *args)
char* nameStr;
char* levelStr;
extractOptFirstArg((char*)args,&nameStr,&levelStr);
- if(!levelStr)
+ if (!levelStr)
return false;
// exception opt second arg: .character level $name
- if(isalpha(levelStr[0]))
+ if (isalpha(levelStr[0]))
{
nameStr = levelStr;
levelStr = NULL; // current level will used
@@ -4796,21 +4796,21 @@ bool ChatHandler::HandleCharacterLevelCommand(const char *args)
Player* target;
uint64 target_guid;
std::string target_name;
- if(!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
+ if (!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
return false;
int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(target_guid);
int32 newlevel = levelStr ? atoi(levelStr) : oldlevel;
- if(newlevel < 1)
+ if (newlevel < 1)
return false; // invalid level
- if(newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
+ if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
newlevel = STRONG_MAX_LEVEL;
HandleCharacterLevel(target,target_guid,oldlevel,newlevel);
- if(!m_session || m_session->GetPlayer() != target) // including player==NULL
+ if (!m_session || m_session->GetPlayer() != target) // including player==NULL
{
std::string nameLink = playerLink(target_name);
PSendSysMessage(LANG_YOU_CHANGE_LVL,nameLink.c_str(),newlevel);
@@ -4826,7 +4826,7 @@ bool ChatHandler::HandleLevelUpCommand(const char *args)
extractOptFirstArg((char*)args,&nameStr,&levelStr);
// exception opt second arg: .character level $name
- if(levelStr && isalpha(levelStr[0]))
+ if (levelStr && isalpha(levelStr[0]))
{
nameStr = levelStr;
levelStr = NULL; // current level will used
@@ -4835,22 +4835,22 @@ bool ChatHandler::HandleLevelUpCommand(const char *args)
Player* target;
uint64 target_guid;
std::string target_name;
- if(!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
+ if (!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
return false;
int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(target_guid);
int32 addlevel = levelStr ? atoi(levelStr) : 1;
int32 newlevel = oldlevel + addlevel;
- if(newlevel < 1)
+ if (newlevel < 1)
newlevel = 1;
- if(newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
+ if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
newlevel = STRONG_MAX_LEVEL;
HandleCharacterLevel(target,target_guid,oldlevel,newlevel);
- if(!m_session || m_session->GetPlayer() != target) // including chr==NULL
+ if (!m_session || m_session->GetPlayer() != target) // including chr==NULL
{
std::string nameLink = playerLink(target_name);
PSendSysMessage(LANG_YOU_CHANGE_LVL,nameLink.c_str(),newlevel);
@@ -4876,7 +4876,7 @@ bool ChatHandler::HandleShowAreaCommand(const char *args)
int offset = area / 32;
uint32 val = (uint32)(1 << (area % 32));
- if(area<0 || offset >= 128)
+ if (area<0 || offset >= 128)
{
SendSysMessage(LANG_BAD_VALUE);
SetSentErrorMessage(true);
@@ -4907,7 +4907,7 @@ bool ChatHandler::HandleHideAreaCommand(const char *args)
int offset = area / 32;
uint32 val = (uint32)(1 << (area % 32));
- if(area<0 || offset >= 128)
+ if (area<0 || offset >= 128)
{
SendSysMessage(LANG_BAD_VALUE);
SetSentErrorMessage(true);
@@ -4930,7 +4930,7 @@ bool ChatHandler::HandleBankCommand(const char* /*args*/)
bool ChatHandler::HandleChangeWeather(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
//Weather is OFF
@@ -4956,9 +4956,9 @@ bool ChatHandler::HandleChangeWeather(const char *args)
Weather* wth = sWorld.FindWeather(zoneid);
- if(!wth)
+ if (!wth)
wth = sWorld.AddWeather(zoneid);
- if(!wth)
+ if (!wth)
{
SendSysMessage(LANG_NO_WEATHER);
SetSentErrorMessage(true);
@@ -4972,11 +4972,11 @@ bool ChatHandler::HandleChangeWeather(const char *args)
bool ChatHandler::HandleDebugSet32Bit(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
WorldObject* target = getSelectedObject();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@@ -5005,7 +5005,7 @@ bool ChatHandler::HandleDebugSet32Bit(const char *args)
bool ChatHandler::HandleTeleAddCommand(const char * args)
{
- if(!*args)
+ if (!*args)
return false;
Player *player=m_session->GetPlayer();
@@ -5014,7 +5014,7 @@ bool ChatHandler::HandleTeleAddCommand(const char * args)
std::string name = args;
- if(objmgr.GetGameTele(name))
+ if (objmgr.GetGameTele(name))
{
SendSysMessage(LANG_COMMAND_TP_ALREADYEXIST);
SetSentErrorMessage(true);
@@ -5029,7 +5029,7 @@ bool ChatHandler::HandleTeleAddCommand(const char * args)
tele.mapId = player->GetMapId();
tele.name = name;
- if(objmgr.AddGameTele(tele))
+ if (objmgr.AddGameTele(tele))
{
SendSysMessage(LANG_COMMAND_TP_ADDED);
}
@@ -5045,12 +5045,12 @@ bool ChatHandler::HandleTeleAddCommand(const char * args)
bool ChatHandler::HandleTeleDelCommand(const char * args)
{
- if(!*args)
+ if (!*args)
return false;
std::string name = args;
- if(!objmgr.DeleteGameTele(name))
+ if (!objmgr.DeleteGameTele(name))
{
SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
SetSentErrorMessage(true);
@@ -5064,7 +5064,7 @@ bool ChatHandler::HandleTeleDelCommand(const char * args)
bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
{
Unit *unit = getSelectedUnit();
- if(!unit)
+ if (!unit)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@@ -5134,7 +5134,7 @@ bool ChatHandler::HandleResetAchievementsCommand (const char * args)
if (!extractPlayerTarget((char*)args,&target,&target_guid))
return false;
- if(target)
+ if (target)
target->GetAchievementMgr().Reset();
else
AchievementMgr::DeleteFromDB(GUID_LOPART(target_guid));
@@ -5161,7 +5161,7 @@ bool ChatHandler::HandleResetHonorCommand (const char * args)
static bool HandleResetStatsOrLevelHelper(Player* player)
{
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(player->getClass());
- if(!cEntry)
+ if (!cEntry)
{
sLog.outError("Class %u not found in DBC (Wrong DBC files?)",player->getClass());
return false;
@@ -5170,7 +5170,7 @@ static bool HandleResetStatsOrLevelHelper(Player* player)
uint8 powertype = cEntry->powerType;
// reset m_form if no aura
- if(!player->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT))
+ if (!player->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT))
player->m_form = FORM_NONE;
player->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE );
@@ -5181,7 +5181,7 @@ static bool HandleResetStatsOrLevelHelper(Player* player)
player->SetUInt32Value(UNIT_FIELD_BYTES_0, ( ( player->getRace() ) | ( player->getClass() << 8 ) | ( player->getGender() << 16 ) | ( powertype << 24 ) ) );
// reset only if player not in some form;
- if(player->m_form==FORM_NONE)
+ if (player->m_form==FORM_NONE)
player->InitDisplayIds();
player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP );
@@ -5199,10 +5199,10 @@ static bool HandleResetStatsOrLevelHelper(Player* player)
bool ChatHandler::HandleResetLevelCommand(const char * args)
{
Player* target;
- if(!extractPlayerTarget((char*)args,&target))
+ if (!extractPlayerTarget((char*)args,&target))
return false;
- if(!HandleResetStatsOrLevelHelper(target))
+ if (!HandleResetStatsOrLevelHelper(target))
return false;
// set starting level
@@ -5223,7 +5223,7 @@ bool ChatHandler::HandleResetLevelCommand(const char * args)
target->_ApplyAllLevelScaleItemMods(true);
// reset level for pet
- if(Pet* pet = target->GetPet())
+ if (Pet* pet = target->GetPet())
pet->SynchronizeLevelWithOwner();
return true;
@@ -5252,15 +5252,15 @@ bool ChatHandler::HandleResetSpellsCommand(const char * args)
Player* target;
uint64 target_guid;
std::string target_name;
- if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
+ if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
return false;
- if(target)
+ if (target)
{
target->resetSpells(/* bool myClassOnly */);
ChatHandler(target).SendSysMessage(LANG_RESET_SPELLS);
- if(!m_session || m_session->GetPlayer() != target)
+ if (!m_session || m_session->GetPlayer() != target)
PSendSysMessage(LANG_RESET_SPELLS_ONLINE,GetNameLink(target).c_str());
}
else
@@ -5284,13 +5284,13 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
if (!*args && creature && creature->isPet())
{
Unit *owner = creature->GetOwner();
- if(owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)creature)->IsPermanentPetFor(owner->ToPlayer()))
+ if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)creature)->IsPermanentPetFor(owner->ToPlayer()))
{
((Pet *)creature)->resetTalents(true);
owner->ToPlayer()->SendTalentsInfoData(true);
ChatHandler(owner->ToPlayer()).SendSysMessage(LANG_RESET_PET_TALENTS);
- if(!m_session || m_session->GetPlayer()!=owner->ToPlayer())
+ if (!m_session || m_session->GetPlayer()!=owner->ToPlayer())
PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE,GetNameLink(owner->ToPlayer()).c_str());
}
return true;
@@ -5311,7 +5311,7 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
Pet* pet = target->GetPet();
Pet::resetTalentsForAllPetsOf(target,pet);
- if(pet)
+ if (pet)
target->SendTalentsInfoData(true);
return true;
}
@@ -5331,7 +5331,7 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
bool ChatHandler::HandleResetAllCommand(const char * args)
{
- if(!*args)
+ if (!*args)
return false;
std::string casename = args;
@@ -5339,18 +5339,18 @@ bool ChatHandler::HandleResetAllCommand(const char * args)
AtLoginFlags atLogin;
// Command specially created as single command to prevent using short case names
- if(casename=="spells")
+ if (casename=="spells")
{
atLogin = AT_LOGIN_RESET_SPELLS;
sWorld.SendWorldText(LANG_RESETALL_SPELLS);
- if(!m_session)
+ if (!m_session)
SendSysMessage(LANG_RESETALL_SPELLS);
}
- else if(casename=="talents")
+ else if (casename=="talents")
{
atLogin = AtLoginFlags(AT_LOGIN_RESET_TALENTS | AT_LOGIN_RESET_PET_TALENTS);
sWorld.SendWorldText(LANG_RESETALL_TALENTS);
- if(!m_session)
+ if (!m_session)
SendSysMessage(LANG_RESETALL_TALENTS);
}
else
@@ -5378,7 +5378,7 @@ bool ChatHandler::HandleServerShutDownCancelCommand(const char* /*args*/)
bool ChatHandler::HandleServerShutDownCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
char* time_str = strtok ((char*) args, " ");
@@ -5413,7 +5413,7 @@ bool ChatHandler::HandleServerShutDownCommand(const char *args)
bool ChatHandler::HandleServerRestartCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
char* time_str = strtok ((char*) args, " ");
@@ -5448,7 +5448,7 @@ bool ChatHandler::HandleServerRestartCommand(const char *args)
bool ChatHandler::HandleServerIdleRestartCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
char* time_str = strtok ((char*) args, " ");
@@ -5483,7 +5483,7 @@ bool ChatHandler::HandleServerIdleRestartCommand(const char *args)
bool ChatHandler::HandleServerIdleShutDownCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
char* time_str = strtok ((char*) args, " ");
@@ -5492,7 +5492,7 @@ bool ChatHandler::HandleServerIdleShutDownCommand(const char *args)
int32 time = atoi (time_str);
///- Prevent interpret wrong arg value as 0 secs shutdown time
- if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0)
+ if (time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0)
return false;
if (exitcode_str)
@@ -5519,7 +5519,7 @@ bool ChatHandler::HandleServerIdleShutDownCommand(const char *args)
bool ChatHandler::HandleQuestAdd(const char *args)
{
Player* player = getSelectedPlayer();
- if(!player)
+ if (!player)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
@@ -5529,14 +5529,14 @@ bool ChatHandler::HandleQuestAdd(const char *args)
// .addquest #entry'
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hquest");
- if(!cId)
+ if (!cId)
return false;
uint32 entry = atol(cId);
Quest const* pQuest = objmgr.GetQuestTemplate(entry);
- if(!pQuest)
+ if (!pQuest)
{
PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND,entry);
SetSentErrorMessage(true);
@@ -5559,7 +5559,7 @@ bool ChatHandler::HandleQuestAdd(const char *args)
}
// ok, normal (creature/GO starting) quest
- if( player->CanAddQuest( pQuest, true ) )
+ if ( player->CanAddQuest( pQuest, true ) )
{
player->AddQuest( pQuest, NULL );
@@ -5573,7 +5573,7 @@ bool ChatHandler::HandleQuestAdd(const char *args)
bool ChatHandler::HandleQuestRemove(const char *args)
{
Player* player = getSelectedPlayer();
- if(!player)
+ if (!player)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
@@ -5583,14 +5583,14 @@ bool ChatHandler::HandleQuestRemove(const char *args)
// .removequest #entry'
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hquest");
- if(!cId)
+ if (!cId)
return false;
uint32 entry = atol(cId);
Quest const* pQuest = objmgr.GetQuestTemplate(entry);
- if(!pQuest)
+ if (!pQuest)
{
PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
SetSentErrorMessage(true);
@@ -5601,7 +5601,7 @@ bool ChatHandler::HandleQuestRemove(const char *args)
for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot )
{
uint32 quest = player->GetQuestSlotQuestId(slot);
- if(quest==entry)
+ if (quest==entry)
{
player->SetQuestSlot(slot,0);
@@ -5623,7 +5623,7 @@ bool ChatHandler::HandleQuestRemove(const char *args)
bool ChatHandler::HandleQuestComplete(const char *args)
{
Player* player = getSelectedPlayer();
- if(!player)
+ if (!player)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
@@ -5633,7 +5633,7 @@ bool ChatHandler::HandleQuestComplete(const char *args)
// .quest complete #entry
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hquest");
- if(!cId)
+ if (!cId)
return false;
uint32 entry = atol(cId);
@@ -5641,7 +5641,7 @@ bool ChatHandler::HandleQuestComplete(const char *args)
Quest const* pQuest = objmgr.GetQuestTemplate(entry);
// If player doesn't have the quest
- if(!pQuest || player->GetQuestStatus(entry) == QUEST_STATUS_NONE)
+ if (!pQuest || player->GetQuestStatus(entry) == QUEST_STATUS_NONE)
{
PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
SetSentErrorMessage(true);
@@ -5653,14 +5653,14 @@ bool ChatHandler::HandleQuestComplete(const char *args)
{
uint32 id = pQuest->ReqItemId[x];
uint32 count = pQuest->ReqItemCount[x];
- if(!id || !count)
+ if (!id || !count)
continue;
uint32 curItemCount = player->GetItemCount(id,true);
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, id, count-curItemCount );
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
{
Item* item = player->StoreNewItem( dest, id, true);
player->SendNewItem(item,count-curItemCount,true,false);
@@ -5673,18 +5673,18 @@ bool ChatHandler::HandleQuestComplete(const char *args)
uint32 creature = pQuest->ReqCreatureOrGOId[i];
uint32 creaturecount = pQuest->ReqCreatureOrGOCount[i];
- if(uint32 spell_id = pQuest->ReqSpell[i])
+ if (uint32 spell_id = pQuest->ReqSpell[i])
{
for (uint16 z = 0; z < creaturecount; ++z)
player->CastedCreatureOrGO(creature,0,spell_id);
}
- else if(creature > 0)
+ else if (creature > 0)
{
- if(CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(creature))
+ if (CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(creature))
for (uint16 z = 0; z < creaturecount; ++z)
player->KilledMonster(cInfo,0);
}
- else if(creature < 0)
+ else if (creature < 0)
{
for (uint16 z = 0; z < creaturecount; ++z)
player->CastedCreatureOrGO(creature,0,0);
@@ -5692,28 +5692,28 @@ bool ChatHandler::HandleQuestComplete(const char *args)
}
// If the quest requires reputation to complete
- if(uint32 repFaction = pQuest->GetRepObjectiveFaction())
+ if (uint32 repFaction = pQuest->GetRepObjectiveFaction())
{
uint32 repValue = pQuest->GetRepObjectiveValue();
uint32 curRep = player->GetReputationMgr().GetReputation(repFaction);
- if(curRep < repValue)
- if(FactionEntry const *factionEntry = sFactionStore.LookupEntry(repFaction))
+ if (curRep < repValue)
+ if (FactionEntry const *factionEntry = sFactionStore.LookupEntry(repFaction))
player->GetReputationMgr().SetReputation(factionEntry,repValue);
}
// If the quest requires a SECOND reputation to complete
- if(uint32 repFaction = pQuest->GetRepObjectiveFaction2())
+ if (uint32 repFaction = pQuest->GetRepObjectiveFaction2())
{
uint32 repValue2 = pQuest->GetRepObjectiveValue2();
uint32 curRep = player->GetReputationMgr().GetReputation(repFaction);
- if(curRep < repValue2)
- if(FactionEntry const *factionEntry = sFactionStore.LookupEntry(repFaction))
+ if (curRep < repValue2)
+ if (FactionEntry const *factionEntry = sFactionStore.LookupEntry(repFaction))
player->GetReputationMgr().SetReputation(factionEntry,repValue2);
}
// If the quest requires money
int32 ReqOrRewMoney = pQuest->GetRewOrReqMoney();
- if(ReqOrRewMoney < 0)
+ if (ReqOrRewMoney < 0)
player->ModifyMoney(-ReqOrRewMoney);
player->CompleteQuest(entry);
@@ -5747,17 +5747,17 @@ bool ChatHandler::HandleBanHelper(BanMode mode, const char *args)
std::string nameOrIP = cnameOrIP;
char* duration = strtok (NULL," ");
- if(!duration || !atoi(duration))
+ if (!duration || !atoi(duration))
return false;
char* reason = strtok (NULL,"");
- if(!reason)
+ if (!reason)
return false;
switch(mode)
{
case BAN_ACCOUNT:
- if(!AccountMgr::normalizeString(nameOrIP))
+ if (!AccountMgr::normalizeString(nameOrIP))
{
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,nameOrIP.c_str());
SetSentErrorMessage(true);
@@ -5765,7 +5765,7 @@ bool ChatHandler::HandleBanHelper(BanMode mode, const char *args)
}
break;
case BAN_CHARACTER:
- if(!normalizePlayerName(nameOrIP))
+ if (!normalizePlayerName(nameOrIP))
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
@@ -5773,7 +5773,7 @@ bool ChatHandler::HandleBanHelper(BanMode mode, const char *args)
}
break;
case BAN_IP:
- if(!IsIPAddress(nameOrIP.c_str()))
+ if (!IsIPAddress(nameOrIP.c_str()))
return false;
break;
}
@@ -5781,7 +5781,7 @@ bool ChatHandler::HandleBanHelper(BanMode mode, const char *args)
switch(sWorld.BanAccount(mode, nameOrIP, duration, reason,m_session ? m_session->GetPlayerName() : ""))
{
case BAN_SUCCESS:
- if(atoi(duration)>0)
+ if (atoi(duration)>0)
PSendSysMessage(LANG_BAN_YOUBANNED,nameOrIP.c_str(),secsToTimeString(TimeStringToSecs(duration),true).c_str(),reason);
else
PSendSysMessage(LANG_BAN_YOUPERMBANNED,nameOrIP.c_str(),reason);
@@ -5829,7 +5829,7 @@ bool ChatHandler::HandleUnBanHelper(BanMode mode, const char *args)
return false;
char* cnameOrIP = strtok ((char*)args, " ");
- if(!cnameOrIP)
+ if (!cnameOrIP)
return false;
std::string nameOrIP = cnameOrIP;
@@ -5837,7 +5837,7 @@ bool ChatHandler::HandleUnBanHelper(BanMode mode, const char *args)
switch(mode)
{
case BAN_ACCOUNT:
- if(!AccountMgr::normalizeString(nameOrIP))
+ if (!AccountMgr::normalizeString(nameOrIP))
{
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,nameOrIP.c_str());
SetSentErrorMessage(true);
@@ -5845,7 +5845,7 @@ bool ChatHandler::HandleUnBanHelper(BanMode mode, const char *args)
}
break;
case BAN_CHARACTER:
- if(!normalizePlayerName(nameOrIP))
+ if (!normalizePlayerName(nameOrIP))
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
@@ -5853,12 +5853,12 @@ bool ChatHandler::HandleUnBanHelper(BanMode mode, const char *args)
}
break;
case BAN_IP:
- if(!IsIPAddress(nameOrIP.c_str()))
+ if (!IsIPAddress(nameOrIP.c_str()))
return false;
break;
}
- if(sWorld.RemoveBanAccount(mode,nameOrIP))
+ if (sWorld.RemoveBanAccount(mode,nameOrIP))
PSendSysMessage(LANG_UNBAN_UNBANNED,nameOrIP.c_str());
else
PSendSysMessage(LANG_UNBAN_ERROR,nameOrIP.c_str());
@@ -5872,11 +5872,11 @@ bool ChatHandler::HandleBanInfoAccountCommand(const char *args)
return false;
char* cname = strtok((char*)args, "");
- if(!cname)
+ if (!cname)
return false;
std::string account_name = cname;
- if(!AccountMgr::normalizeString(account_name))
+ if (!AccountMgr::normalizeString(account_name))
{
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
SetSentErrorMessage(true);
@@ -5884,7 +5884,7 @@ bool ChatHandler::HandleBanInfoAccountCommand(const char *args)
}
uint32 accountid = accmgr.GetId(account_name);
- if(!accountid)
+ if (!accountid)
{
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
return true;
@@ -5897,13 +5897,13 @@ bool ChatHandler::HandleBanInfoCharacterCommand(const char *args)
{
Player* target;
uint64 target_guid;
- if(!extractPlayerTarget((char*)args,&target,&target_guid))
+ if (!extractPlayerTarget((char*)args,&target,&target_guid))
return false;
uint32 accountid = target ? target->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(target_guid);
std::string accountname;
- if(!accmgr.GetName(accountid,accountname))
+ if (!accmgr.GetName(accountid,accountname))
{
PSendSysMessage(LANG_BANINFO_NOCHARACTER);
return true;
@@ -5915,7 +5915,7 @@ bool ChatHandler::HandleBanInfoCharacterCommand(const char *args)
bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname)
{
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate,banreason,bannedby FROM account_banned WHERE id = '%u' ORDER BY bandate ASC",accountid);
- if(!result)
+ if (!result)
{
PSendSysMessage(LANG_BANINFO_NOACCOUNTBAN, accountname);
return true;
@@ -5928,7 +5928,7 @@ bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname)
time_t unbandate = time_t(fields[3].GetUInt64());
bool active = false;
- if(fields[2].GetBool() && (fields[1].GetUInt64() == (uint64)0 ||unbandate >= time(NULL)) )
+ if (fields[2].GetBool() && (fields[1].GetUInt64() == (uint64)0 ||unbandate >= time(NULL)) )
active = true;
bool permanent = (fields[1].GetUInt64() == (uint64)0);
std::string bantime = permanent?GetTrinityString(LANG_BANINFO_INFINITE):secsToTimeString(fields[1].GetUInt64(), true);
@@ -5945,7 +5945,7 @@ bool ChatHandler::HandleBanInfoIPCommand(const char *args)
return false;
char* cIP = strtok ((char*)args, "");
- if(!cIP)
+ if (!cIP)
return false;
if (!IsIPAddress(cIP))
@@ -5955,7 +5955,7 @@ bool ChatHandler::HandleBanInfoIPCommand(const char *args)
loginDatabase.escape_string(IP);
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason,bannedby,unbandate-bandate FROM ip_banned WHERE ip = '%s'",IP.c_str());
- if(!result)
+ if (!result)
{
PSendSysMessage(LANG_BANINFO_NOIP);
return true;
@@ -5975,7 +5975,7 @@ bool ChatHandler::HandleBanListCharacterCommand(const char *args)
loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");
char* cFilter = strtok ((char*)args, " ");
- if(!cFilter)
+ if (!cFilter)
return false;
std::string filter = cFilter;
@@ -6000,7 +6000,7 @@ bool ChatHandler::HandleBanListAccountCommand(const char *args)
QueryResult_AutoPtr result;
- if(filter.empty())
+ if (filter.empty())
{
result = loginDatabase.Query("SELECT account.id, username FROM account, account_banned"
" WHERE account.id = account_banned.id AND active = 1 GROUP BY account.id");
@@ -6026,7 +6026,7 @@ bool ChatHandler::HandleBanListHelper(QueryResult_AutoPtr result)
PSendSysMessage(LANG_BANLIST_MATCHINGACCOUNT);
// Chat short output
- if(m_session)
+ if (m_session)
{
do
{
@@ -6034,7 +6034,7 @@ bool ChatHandler::HandleBanListHelper(QueryResult_AutoPtr result)
uint32 accountid = fields[0].GetUInt32();
QueryResult_AutoPtr banresult = loginDatabase.PQuery("SELECT account.username FROM account,account_banned WHERE account_banned.id='%u' AND account_banned.id=account.id",accountid);
- if(banresult)
+ if (banresult)
{
Field* fields2 = banresult->Fetch();
PSendSysMessage("%s",fields2[0].GetString());
@@ -6056,7 +6056,7 @@ bool ChatHandler::HandleBanListHelper(QueryResult_AutoPtr result)
std::string account_name;
// "account" case, name can be get in same query
- if(result->GetFieldCount() > 1)
+ if (result->GetFieldCount() > 1)
account_name = fields[1].GetCppString();
// "character" case, name need extract from another DB
else
@@ -6105,7 +6105,7 @@ bool ChatHandler::HandleBanListIPCommand(const char *args)
QueryResult_AutoPtr result;
- if(filter.empty())
+ if (filter.empty())
{
result = loginDatabase.Query ("SELECT ip,bandate,unbandate,bannedby,banreason FROM ip_banned"
" WHERE (bandate=unbandate OR unbandate>UNIX_TIMESTAMP())"
@@ -6118,7 +6118,7 @@ bool ChatHandler::HandleBanListIPCommand(const char *args)
" ORDER BY unbandate",filter.c_str() );
}
- if(!result)
+ if (!result)
{
PSendSysMessage(LANG_BANLIST_NOIP);
return true;
@@ -6126,7 +6126,7 @@ bool ChatHandler::HandleBanListIPCommand(const char *args)
PSendSysMessage(LANG_BANLIST_MATCHINGIP);
// Chat short output
- if(m_session)
+ if (m_session)
{
do
{
@@ -6174,16 +6174,16 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
// accept only explicitly selected target (not implicitly self targeting case)
Unit* target = getSelectedUnit();
- if(pl->GetSelection() && target)
+ if (pl->GetSelection() && target)
{
- if(target->GetTypeId()!=TYPEID_UNIT || target->isPet())
+ if (target->GetTypeId()!=TYPEID_UNIT || target->isPet())
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
return false;
}
- if(target->isDead())
+ if (target->isDead())
target->ToCreature()->Respawn();
return true;
}
@@ -6234,15 +6234,15 @@ bool ChatHandler::HandlePDumpLoadCommand(const char *args)
return false;
char * file = strtok((char*)args, " ");
- if(!file)
+ if (!file)
return false;
char * account = strtok(NULL, " ");
- if(!account)
+ if (!account)
return false;
std::string account_name = account;
- if(!AccountMgr::normalizeString(account_name))
+ if (!AccountMgr::normalizeString(account_name))
{
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
SetSentErrorMessage(true);
@@ -6250,10 +6250,10 @@ bool ChatHandler::HandlePDumpLoadCommand(const char *args)
}
uint32 account_id = accmgr.GetId(account_name);
- if(!account_id)
+ if (!account_id)
{
account_id = atoi(account); // use original string
- if(!account_id)
+ if (!account_id)
{
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
SetSentErrorMessage(true);
@@ -6261,7 +6261,7 @@ bool ChatHandler::HandlePDumpLoadCommand(const char *args)
}
}
- if(!accmgr.GetName(account_id,account_name))
+ if (!accmgr.GetName(account_id,account_name))
{
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
SetSentErrorMessage(true);
@@ -6347,7 +6347,7 @@ bool ChatHandler::HandlePDumpWriteCommand(const char *args)
char* file = strtok((char*)args, " ");
char* p2 = strtok(NULL, " ");
- if(!file || !p2)
+ if (!file || !p2)
return false;
uint32 guid;
@@ -6357,7 +6357,7 @@ bool ChatHandler::HandlePDumpWriteCommand(const char *args)
else
{
std::string name = extractPlayerNameFromLink(p2);
- if(name.empty())
+ if (name.empty())
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
@@ -6367,7 +6367,7 @@ bool ChatHandler::HandlePDumpWriteCommand(const char *args)
guid = objmgr.GetPlayerGUIDByName(name);
}
- if(!objmgr.GetPlayerAccountIdByGUID(guid))
+ if (!objmgr.GetPlayerAccountIdByGUID(guid))
{
PSendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
@@ -6395,7 +6395,7 @@ bool ChatHandler::HandlePDumpWriteCommand(const char *args)
bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
{
Unit* unit = getSelectedUnit();
- if(!unit)
+ if (!unit)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@@ -6408,7 +6408,7 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
{
MovementGenerator* mg = mm->GetMotionSlot(i);
- if(!mg)
+ if (!mg)
{
SendSysMessage("Empty");
continue;
@@ -6422,11 +6422,11 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
case CONFUSED_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_CONFUSED); break;
case TARGETED_MOTION_TYPE:
{
- if(unit->GetTypeId() == TYPEID_PLAYER)
+ if (unit->GetTypeId() == TYPEID_PLAYER)
{
TargetedMovementGenerator<Player> const* mgen = static_cast<TargetedMovementGenerator<Player> const*>(mg);
Unit* target = mgen->GetTarget();
- if(target)
+ if (target)
PSendSysMessage(LANG_MOVEGENS_TARGETED_PLAYER,target->GetName(),target->GetGUIDLow());
else
SendSysMessage(LANG_MOVEGENS_TARGETED_NULL);
@@ -6435,7 +6435,7 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
{
TargetedMovementGenerator<Creature> const* mgen = static_cast<TargetedMovementGenerator<Creature> const*>(mg);
Unit* target = mgen->GetTarget();
- if(target)
+ if (target)
PSendSysMessage(LANG_MOVEGENS_TARGETED_CREATURE,target->GetName(),target->GetGUIDLow());
else
SendSysMessage(LANG_MOVEGENS_TARGETED_NULL);
@@ -6443,7 +6443,7 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
break;
}
case HOME_MOTION_TYPE:
- if(unit->GetTypeId() == TYPEID_UNIT)
+ if (unit->GetTypeId() == TYPEID_UNIT)
{
float x,y,z;
mg->GetDestination(x,y,z);
@@ -6472,34 +6472,34 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
bool ChatHandler::HandleServerPLimitCommand(const char *args)
{
- if(*args)
+ if (*args)
{
char* param = strtok((char*)args, " ");
- if(!param)
+ if (!param)
return false;
int l = strlen(param);
- if( strncmp(param,"player",l) == 0 )
+ if ( strncmp(param,"player",l) == 0 )
sWorld.SetPlayerLimit(-SEC_PLAYER);
- else if(strncmp(param,"moderator",l) == 0 )
+ else if (strncmp(param,"moderator",l) == 0 )
sWorld.SetPlayerLimit(-SEC_MODERATOR);
- else if(strncmp(param,"gamemaster",l) == 0 )
+ else if (strncmp(param,"gamemaster",l) == 0 )
sWorld.SetPlayerLimit(-SEC_GAMEMASTER);
- else if(strncmp(param,"administrator",l) == 0 )
+ else if (strncmp(param,"administrator",l) == 0 )
sWorld.SetPlayerLimit(-SEC_ADMINISTRATOR);
- else if(strncmp(param,"reset",l) == 0 )
+ else if (strncmp(param,"reset",l) == 0 )
sWorld.SetPlayerLimit( sConfig.GetIntDefault("PlayerLimit", DEFAULT_PLAYER_LIMIT) );
else
{
int val = atoi(param);
- if(val < -SEC_ADMINISTRATOR) val = -SEC_ADMINISTRATOR;
+ if (val < -SEC_ADMINISTRATOR) val = -SEC_ADMINISTRATOR;
sWorld.SetPlayerLimit(val);
}
// kick all low security level players
- if(sWorld.GetPlayerAmountLimit() > SEC_PLAYER)
+ if (sWorld.GetPlayerAmountLimit() > SEC_PLAYER)
sWorld.KickAllLess(sWorld.GetPlayerSecurityLimit());
}
@@ -6522,12 +6522,12 @@ bool ChatHandler::HandleServerPLimitCommand(const char *args)
bool ChatHandler::HandleCastCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
Unit* target = getSelectedUnit();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@@ -6536,14 +6536,14 @@ bool ChatHandler::HandleCastCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = extractSpellIdFromLink((char*)args);
- if(!spell)
+ if (!spell)
return false;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
- if(!spellInfo)
+ if (!spellInfo)
return false;
- if(!SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer()))
+ if (!SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer()))
{
PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spell);
SetSentErrorMessage(true);
@@ -6551,10 +6551,10 @@ bool ChatHandler::HandleCastCommand(const char *args)
}
char* trig_str = strtok(NULL, " ");
- if(trig_str)
+ if (trig_str)
{
int l = strlen(trig_str);
- if(strncmp(trig_str,"triggered",l) != 0 )
+ if (strncmp(trig_str,"triggered",l) != 0 )
return false;
}
@@ -6569,7 +6569,7 @@ bool ChatHandler::HandleCastBackCommand(const char *args)
{
Creature* caster = getSelectedCreature();
- if(!caster)
+ if (!caster)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@@ -6579,14 +6579,14 @@ bool ChatHandler::HandleCastBackCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = extractSpellIdFromLink((char*)args);
- if(!spell || !sSpellStore.LookupEntry(spell))
+ if (!spell || !sSpellStore.LookupEntry(spell))
return false;
char* trig_str = strtok(NULL, " ");
- if(trig_str)
+ if (trig_str)
{
int l = strlen(trig_str);
- if(strncmp(trig_str,"triggered",l) != 0 )
+ if (strncmp(trig_str,"triggered",l) != 0 )
return false;
}
@@ -6601,19 +6601,19 @@ bool ChatHandler::HandleCastBackCommand(const char *args)
bool ChatHandler::HandleCastDistCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = extractSpellIdFromLink((char*)args);
- if(!spell)
+ if (!spell)
return false;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
- if(!spellInfo)
+ if (!spellInfo)
return false;
- if(!SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer()))
+ if (!SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer()))
{
PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spell);
SetSentErrorMessage(true);
@@ -6624,14 +6624,14 @@ bool ChatHandler::HandleCastDistCommand(const char *args)
float dist = 0;
- if(distStr)
+ if (distStr)
sscanf(distStr, "%f", &dist);
char* trig_str = strtok(NULL, " ");
- if(trig_str)
+ if (trig_str)
{
int l = strlen(trig_str);
- if(strncmp(trig_str,"triggered",l) != 0 )
+ if (strncmp(trig_str,"triggered",l) != 0 )
return false;
}
@@ -6648,14 +6648,14 @@ bool ChatHandler::HandleCastTargetCommand(const char *args)
{
Creature* caster = getSelectedCreature();
- if(!caster)
+ if (!caster)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
return false;
}
- if(!caster->getVictim())
+ if (!caster->getVictim())
{
SendSysMessage(LANG_SELECTED_TARGET_NOT_HAVE_VICTIM);
SetSentErrorMessage(true);
@@ -6664,14 +6664,14 @@ bool ChatHandler::HandleCastTargetCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = extractSpellIdFromLink((char*)args);
- if(!spell || !sSpellStore.LookupEntry(spell))
+ if (!spell || !sSpellStore.LookupEntry(spell))
return false;
char* trig_str = strtok(NULL, " ");
- if(trig_str)
+ if (trig_str)
{
int l = strlen(trig_str);
- if(strncmp(trig_str,"triggered",l) != 0 )
+ if (strncmp(trig_str,"triggered",l) != 0 )
return false;
}
@@ -6693,13 +6693,13 @@ bool ChatHandler::HandleComeToMeCommand(const char *args)
{
char* newFlagStr = strtok((char*)args, " ");
- if(!newFlagStr)
+ if (!newFlagStr)
return false;
uint32 newFlags = (uint32)strtoul(newFlagStr, NULL, 0);
Creature* caster = getSelectedCreature();
- if(!caster)
+ if (!caster)
{
m_session->GetPlayer()->SetUnitMovementFlags(newFlags);
SendSysMessage(LANG_SELECT_CREATURE);
@@ -6717,12 +6717,12 @@ bool ChatHandler::HandleComeToMeCommand(const char *args)
bool ChatHandler::HandleCastSelfCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
Unit* target = getSelectedUnit();
- if(!target)
+ if (!target)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@@ -6731,14 +6731,14 @@ bool ChatHandler::HandleCastSelfCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = extractSpellIdFromLink((char*)args);
- if(!spell)
+ if (!spell)
return false;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
- if(!spellInfo)
+ if (!spellInfo)
return false;
- if(!SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer()))
+ if (!SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer()))
{
PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spell);
SetSentErrorMessage(true);
@@ -6754,8 +6754,8 @@ std::string GetTimeString(uint32 time)
{
uint16 days = time / DAY, hours = (time % DAY) / HOUR, minute = (time % HOUR) / MINUTE;
std::ostringstream ss;
- if(days) ss << days << "d ";
- if(hours) ss << hours << "h ";
+ if (days) ss << days << "d ";
+ if (hours) ss << hours << "h ";
ss << minute << "m";
return ss.str();
}
@@ -6779,7 +6779,7 @@ bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/)
PSendSysMessage("player binds: %d", counter);
counter = 0;
Group *group = player->GetGroup();
- if(group)
+ if (group)
{
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
@@ -6799,11 +6799,11 @@ bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/)
bool ChatHandler::HandleInstanceUnbindCommand(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
std::string cmd = args;
- if(cmd == "all")
+ if (cmd == "all")
{
Player* player = getSelectedPlayer();
if (!player) player = m_session->GetPlayer();
@@ -6813,7 +6813,7 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char *args)
Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();)
{
- if(itr->first != player->GetMapId())
+ if (itr->first != player->GetMapId())
{
InstanceSave *save = itr->second.save;
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
@@ -6868,7 +6868,7 @@ bool ChatHandler::HandleGMListFullCommand(const char* /*args*/)
{
///- Get the accounts with GM Level >0
QueryResult_AutoPtr result = loginDatabase.Query("SELECT a.username,aa.gmlevel FROM account a, account_access aa WHERE a.id=aa.id AND aa.gmlevel > 0");
- if(result)
+ if (result)
{
SendSysMessage(LANG_GMLIST);
SendSysMessage("========================");
@@ -6902,13 +6902,13 @@ bool ChatHandler::HandleServerSetClosedCommand(const char *args)
{
std::string arg = args;
- if(args == "on")
+ if (args == "on")
{
SendSysMessage(LANG_WORLD_CLOSED);
sWorld.SetClosed(true);
return true;
}
- if(args == "off")
+ if (args == "off")
{
SendSysMessage(LANG_WORLD_OPENED);
sWorld.SetClosed(false);
@@ -6927,16 +6927,16 @@ bool ChatHandler::HandleAccountSetAddonCommand(const char *args)
char *szAcc = strtok((char*)args," ");
char *szExp = strtok(NULL," ");
- if(!szAcc)
+ if (!szAcc)
return false;
std::string account_name;
uint32 account_id;
- if(!szExp)
+ if (!szExp)
{
Player* player = getSelectedPlayer();
- if(!player)
+ if (!player)
return false;
account_id = player->GetSession()->GetAccountId();
@@ -6947,7 +6947,7 @@ bool ChatHandler::HandleAccountSetAddonCommand(const char *args)
{
///- Convert Account name to Upper Format
account_name = szAcc;
- if(!AccountMgr::normalizeString(account_name))
+ if (!AccountMgr::normalizeString(account_name))
{
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
SetSentErrorMessage(true);
@@ -6955,7 +6955,7 @@ bool ChatHandler::HandleAccountSetAddonCommand(const char *args)
}
account_id = accmgr.GetId(account_name);
- if(!account_id)
+ if (!account_id)
{
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
SetSentErrorMessage(true);
@@ -6971,7 +6971,7 @@ bool ChatHandler::HandleAccountSetAddonCommand(const char *args)
return false;
int expansion = atoi(szExp); //get int anyway (0 if error)
- if(expansion < 0 || expansion > sWorld.getConfig(CONFIG_EXPANSION))
+ if (expansion < 0 || expansion > sWorld.getConfig(CONFIG_EXPANSION))
return false;
// No SQL injection
@@ -6987,11 +6987,11 @@ bool ChatHandler::HandleSendItemsCommand(const char *args)
Player* receiver;
uint64 receiver_guid;
std::string receiver_name;
- if(!extractPlayerTarget((char*)args,&receiver,&receiver_guid,&receiver_name))
+ if (!extractPlayerTarget((char*)args,&receiver,&receiver_guid,&receiver_name))
return false;
char* tail1 = strtok(NULL, "");
- if(!tail1)
+ if (!tail1)
return false;
char* msgSubject = extractQuotedArg(tail1);
@@ -6999,7 +6999,7 @@ bool ChatHandler::HandleSendItemsCommand(const char *args)
return false;
char* tail2 = strtok(NULL, "");
- if(!tail2)
+ if (!tail2)
return false;
char* msgText = extractQuotedArg(tail2);
@@ -7029,11 +7029,11 @@ bool ChatHandler::HandleSendItemsCommand(const char *args)
char* itemCountStr = strtok(NULL, " ");
uint32 item_id = atoi(itemIdStr);
- if(!item_id)
+ if (!item_id)
return false;
ItemPrototype const* item_proto = objmgr.GetItemPrototype(item_id);
- if(!item_proto)
+ if (!item_proto)
{
PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id);
SetSentErrorMessage(true);
@@ -7056,7 +7056,7 @@ bool ChatHandler::HandleSendItemsCommand(const char *args)
items.push_back(ItemPair(item_id,item_count));
- if(items.size() > MAX_MAIL_ITEMS)
+ if (items.size() > MAX_MAIL_ITEMS)
{
PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS);
SetSentErrorMessage(true);
@@ -7074,7 +7074,7 @@ bool ChatHandler::HandleSendItemsCommand(const char *args)
for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr)
{
- if(Item* item = Item::CreateItem(itr->first,itr->second,m_session ? m_session->GetPlayer() : 0))
+ if (Item* item = Item::CreateItem(itr->first,itr->second,m_session ? m_session->GetPlayer() : 0))
{
item->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted
draft.AddItem(item);
@@ -7096,7 +7096,7 @@ bool ChatHandler::HandleSendMoneyCommand(const char *args)
Player* receiver;
uint64 receiver_guid;
std::string receiver_name;
- if(!extractPlayerTarget((char*)args,&receiver,&receiver_guid,&receiver_name))
+ if (!extractPlayerTarget((char*)args,&receiver,&receiver_guid,&receiver_name))
return false;
char* tail1 = strtok(NULL, "");
@@ -7190,7 +7190,7 @@ bool ChatHandler::HandleModifyGenderCommand(const char *args)
}
PlayerInfo const* info = objmgr.GetPlayerInfo(player->getRace(), player->getClass());
- if(!info)
+ if (!info)
return false;
char const* gender_str = (char*)args;
@@ -7198,7 +7198,7 @@ bool ChatHandler::HandleModifyGenderCommand(const char *args)
Gender gender;
- if(!strncmp(gender_str, "male", gender_len)) // MALE
+ if (!strncmp(gender_str, "male", gender_len)) // MALE
{
if (player->getGender() == GENDER_MALE)
return true;
@@ -7238,12 +7238,12 @@ bool ChatHandler::HandleModifyGenderCommand(const char *args)
bool ChatHandler::HandleChannelSetPublic(const char *args)
{
- if(!*args)
+ if (!*args)
return false;
std::string channel = strtok((char*)args, " ");
uint32 val = atoi((char*)args);
- if(val)
+ if (val)
{
CharacterDatabase.PExecute("UPDATE channels SET m_public = 1 WHERE m_name LIKE '%s'", channel);
val = 1;
diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp
index 1b7ee1940c8..645faeaa447 100644
--- a/src/game/LootHandler.cpp
+++ b/src/game/LootHandler.cpp
@@ -83,7 +83,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
- if( !ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
+ if ( !ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
{
player->SendLootRelease(lguid);
return;
@@ -98,7 +98,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
LootItem *item = loot->LootItemInSlot(lootSlot,player,&qitem,&ffaitem,&conditem);
- if(!item)
+ if (!item)
{
player->SendEquipError( EQUIP_ERR_ALREADY_LOOTED, NULL, NULL );
return;
@@ -137,7 +137,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
else
{
//not freeforall, notify everyone
- if(conditem)
+ if (conditem)
conditem->is_looted=true;
loot->NotifyItemRemoved(lootSlot);
}
@@ -164,7 +164,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
Player *player = GetPlayer();
uint64 guid = player->GetLootGUID();
- if(!guid)
+ if (!guid)
return;
Loot *pLoot = NULL;
@@ -192,7 +192,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
}
case HIGHGUID_ITEM:
{
- if(Item *item = GetPlayer()->GetItemByGuid(guid))
+ if (Item *item = GetPlayer()->GetItemByGuid(guid))
pLoot = &item->loot;
break;
}
@@ -211,7 +211,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
return; // unlootable type
}
- if( pLoot )
+ if ( pLoot )
{
if (!IS_ITEM_GUID(guid) && player->GetGroup()) //item can be looted only single player
{
@@ -221,7 +221,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* playerGroup = itr->getSource();
- if(!playerGroup)
+ if (!playerGroup)
continue;
if (player->IsWithinDistInMap(playerGroup,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
playersNear.push_back(playerGroup);
@@ -257,7 +257,7 @@ void WorldSession::HandleLootOpcode( WorldPacket & recv_data )
recv_data >> guid;
// Check possible cheat
- if(!_player->isAlive())
+ if (!_player->isAlive())
return;
GetPlayer()->SendLoot(guid, LOOT_CORPSE);
@@ -271,7 +271,7 @@ void WorldSession::HandleLootReleaseOpcode( WorldPacket & recv_data )
// use internal stored guid
recv_data.read_skip<uint64>(); // guid;
- if(uint64 lguid = GetPlayer()->GetLootGUID())
+ if (uint64 lguid = GetPlayer()->GetLootGUID())
DoLootRelease(lguid);
}
@@ -306,13 +306,13 @@ void WorldSession::DoLootRelease(uint64 lguid)
else if (loot->isLooted() || go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE)
{
// GO is mineral vein? so it is not removed after its looted
- if(go->GetGoType() == GAMEOBJECT_TYPE_CHEST)
+ if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST)
{
uint32 go_min = go->GetGOInfo()->chest.minSuccessOpens;
uint32 go_max = go->GetGOInfo()->chest.maxSuccessOpens;
// only vein pass this check
- if(go_min != 0 && go_max > go_min)
+ if (go_min != 0 && go_max > go_min)
{
float amount_rate = sWorld.getRate(RATE_MINING_AMOUNT);
float min_amount = go_min*amount_rate;
@@ -321,19 +321,19 @@ void WorldSession::DoLootRelease(uint64 lguid)
go->AddUse();
float uses = float(go->GetUseCount());
- if(uses < max_amount)
+ if (uses < max_amount)
{
- if(uses >= min_amount)
+ if (uses >= min_amount)
{
float chance_rate = sWorld.getRate(RATE_MINING_NEXT);
int32 ReqValue = 175;
LockEntry const *lockInfo = sLockStore.LookupEntry(go->GetGOInfo()->chest.lockId);
- if(lockInfo)
+ if (lockInfo)
ReqValue = lockInfo->Skill[0];
float skill = float(player->GetSkillValue(SKILL_MINING))/(ReqValue+25);
double chance = pow(0.8*chance_rate,4*(1/double(max_amount))*double(uses));
- if(roll_chance_f(100*chance+skill))
+ if (roll_chance_f(100*chance+skill))
{
go->SetLootState(GO_READY);
}
@@ -478,41 +478,41 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
recv_data >> lootguid >> slotid >> target_playerguid;
- if(!_player->GetGroup() || _player->GetGroup()->GetLooterGuid() != _player->GetGUID())
+ if (!_player->GetGroup() || _player->GetGroup()->GetLooterGuid() != _player->GetGUID())
{
_player->SendLootRelease(GetPlayer()->GetLootGUID());
return;
}
Player *target = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(target_playerguid, 0, HIGHGUID_PLAYER));
- if(!target)
+ if (!target)
return;
sLog.outDebug("WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName());
- if(_player->GetLootGUID() != lootguid)
+ if (_player->GetLootGUID() != lootguid)
return;
Loot *pLoot = NULL;
- if(IS_CRE_OR_VEH_GUID(GetPlayer()->GetLootGUID()))
+ if (IS_CRE_OR_VEH_GUID(GetPlayer()->GetLootGUID()))
{
Creature *pCreature = GetPlayer()->GetMap()->GetCreature(lootguid);
- if(!pCreature)
+ if (!pCreature)
return;
pLoot = &pCreature->loot;
}
- else if(IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
+ else if (IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
{
GameObject *pGO = GetPlayer()->GetMap()->GetGameObject(lootguid);
- if(!pGO)
+ if (!pGO)
return;
pLoot = &pGO->loot;
}
- if(!pLoot)
+ if (!pLoot)
return;
if (slotid > pLoot->items.size())
diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp
index 9c7fc68f51f..e4734f9b901 100644
--- a/src/game/LootMgr.cpp
+++ b/src/game/LootMgr.cpp
@@ -122,13 +122,13 @@ void LootStore::LoadLootTable()
uint32 cond_value1 = fields[8].GetUInt32();
uint32 cond_value2 = fields[9].GetUInt32();
- if(maxcount > std::numeric_limits<uint8>::max())
+ if (maxcount > std::numeric_limits<uint8>::max())
{
sLog.outErrorDb("Table '%s' entry %d item %d: maxcount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount,std::numeric_limits<uint8>::max());
continue; // error already printed to log/console.
}
- if(!PlayerCondition::IsValid(condition,cond_value1, cond_value2))
+ if (!PlayerCondition::IsValid(condition,cond_value1, cond_value2))
{
sLog.outErrorDb("... in table '%s' entry %u item %u", GetName(), entry, item);
continue; // error already printed to log/console.
@@ -178,7 +178,7 @@ void LootStore::LoadLootTable()
bool LootStore::HaveQuestLootFor(uint32 loot_id) const
{
LootTemplateMap::const_iterator itr = m_LootTemplates.find(loot_id);
- if(itr == m_LootTemplates.end())
+ if (itr == m_LootTemplates.end())
return false;
// scan loot for quest items
@@ -239,10 +239,10 @@ void LootStore::ReportNotExistedId(uint32 id) const
// RATE_DROP_ITEMS is no longer used for all types of entries
bool LootStoreItem::Roll(bool rate) const
{
- if(chance >= 100.0f)
+ if (chance >= 100.0f)
return true;
- if(mincountOrRef < 0) // reference case
+ if (mincountOrRef < 0) // reference case
return roll_chance_f(chance* (rate ? sWorld.getRate(RATE_DROP_ITEM_REFERENCED) : 1.0f));
ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid);
@@ -255,7 +255,7 @@ bool LootStoreItem::Roll(bool rate) const
// Checks correctness of values
bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
{
- if(group >= 1 << 7) // it stored in 7 bit field
+ if (group >= 1 << 7) // it stored in 7 bit field
{
sLog.outErrorDb("Table '%s' entry %d item %d: group (%u) must be less %u - skipped", store.GetName(), entry, itemid, group, 1 << 7);
return false;
@@ -270,26 +270,26 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
if (mincountOrRef > 0) // item (quest or non-quest) entry, maybe grouped
{
ItemPrototype const *proto = objmgr.GetItemPrototype(itemid);
- if(!proto)
+ if (!proto)
{
sLog.outErrorDb("Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid);
return false;
}
- if( chance == 0 && group == 0) // Zero chance is allowed for grouped entries only
+ if ( chance == 0 && group == 0) // Zero chance is allowed for grouped entries only
{
sLog.outErrorDb("Table '%s' entry %d item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid);
return false;
}
- if( chance != 0 && chance < 0.000001f ) // loot with low chance
+ if ( chance != 0 && chance < 0.000001f ) // loot with low chance
{
sLog.outErrorDb("Table '%s' entry %d item %d: low chance (%f) - skipped",
store.GetName(), entry, itemid, chance);
return false;
}
- if( maxcount < mincountOrRef) // wrong max count
+ if ( maxcount < mincountOrRef) // wrong max count
{
sLog.outErrorDb("Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincountOrRef);
return false;
@@ -300,7 +300,7 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
{
if (needs_quest)
sLog.outErrorDb("Table '%s' entry %d item %d: quest chance will be treated as non-quest chance", store.GetName(), entry, itemid);
- else if( chance == 0 ) // no chance for the reference
+ else if ( chance == 0 ) // no chance for the reference
{
sLog.outErrorDb("Table '%s' entry %d item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid);
return false;
@@ -413,7 +413,7 @@ bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner,
roundRobinPlayer = loot_owner->GetGUID();
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
- if(Player* pl = itr->getSource())
+ if (Player* pl = itr->getSource())
FillNotNormalLootFor(pl);
for (uint8 i = 0; i < items.size(); ++i)
@@ -454,7 +454,7 @@ QuestItemList* Loot::FillFFALoot(Player* player)
for (uint8 i = 0; i < items.size(); ++i)
{
LootItem &item = items[i];
- if(!item.is_looted && item.freeforall && item.AllowedForPlayer(player) )
+ if (!item.is_looted && item.freeforall && item.AllowedForPlayer(player) )
{
ql->push_back(QuestItem(i));
++unlootedCount;
@@ -512,10 +512,10 @@ QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player)
for (uint8 i = 0; i < items.size(); ++i)
{
LootItem &item = items[i];
- if(!item.is_looted && !item.freeforall && item.conditionId && item.AllowedForPlayer(player))
+ if (!item.is_looted && !item.freeforall && item.conditionId && item.AllowedForPlayer(player))
{
ql->push_back(QuestItem(i));
- if(!item.is_counted)
+ if (!item.is_counted)
{
++unlootedCount;
item.is_counted = true;
@@ -543,7 +543,7 @@ void Loot::NotifyItemRemoved(uint8 lootIndex)
{
i_next = i;
++i_next;
- if(Player* pl = ObjectAccessor::FindPlayer(*i))
+ if (Player* pl = ObjectAccessor::FindPlayer(*i))
pl->SendNotifyLootItemRemoved(lootIndex);
else
PlayersLooting.erase(i);
@@ -558,7 +558,7 @@ void Loot::NotifyMoneyRemoved()
{
i_next = i;
++i_next;
- if(Player* pl = ObjectAccessor::FindPlayer(*i))
+ if (Player* pl = ObjectAccessor::FindPlayer(*i))
pl->SendNotifyLootMoneyRemoved();
else
PlayersLooting.erase(i);
@@ -577,7 +577,7 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
{
i_next = i;
++i_next;
- if(Player* pl = ObjectAccessor::FindPlayer(*i))
+ if (Player* pl = ObjectAccessor::FindPlayer(*i))
{
QuestItemMap::const_iterator pq = PlayerQuestItems.find(pl->GetGUIDLow());
if (pq != PlayerQuestItems.end() && pq->second)
@@ -623,7 +623,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite
if (itr != PlayerQuestItems.end() && questSlot < itr->second->size())
{
QuestItem *qitem2 = &itr->second->at(questSlot);
- if(qitem)
+ if (qitem)
*qitem = qitem2;
item = &quest_items[qitem2->index];
is_looted = qitem2->is_looted;
@@ -633,33 +633,33 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite
{
item = &items[lootSlot];
is_looted = item->is_looted;
- if(item->freeforall)
+ if (item->freeforall)
{
QuestItemMap::const_iterator itr = PlayerFFAItems.find(player->GetGUIDLow());
if (itr != PlayerFFAItems.end())
{
for (QuestItemList::const_iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter)
- if(iter->index==lootSlot)
+ if (iter->index==lootSlot)
{
QuestItem *ffaitem2 = (QuestItem*)&(*iter);
- if(ffaitem)
+ if (ffaitem)
*ffaitem = ffaitem2;
is_looted = ffaitem2->is_looted;
break;
}
}
}
- else if(item->conditionId)
+ else if (item->conditionId)
{
QuestItemMap::const_iterator itr = PlayerNonQuestNonFFAConditionalItems.find(player->GetGUIDLow());
if (itr != PlayerNonQuestNonFFAConditionalItems.end())
{
for (QuestItemList::const_iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter)
{
- if(iter->index==lootSlot)
+ if (iter->index==lootSlot)
{
QuestItem *conditem2 = (QuestItem*)&(*iter);
- if(conditem)
+ if (conditem)
*conditem = conditem2;
is_looted = conditem2->is_looted;
break;
@@ -669,7 +669,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite
}
}
- if(is_looted)
+ if (is_looted)
return NULL;
return item;
@@ -1072,7 +1072,7 @@ void LootTemplate::LootGroup::Verify(LootStore const& lootstore, uint32 id, uint
sLog.outErrorDb("Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance);
}
- if(chance >= 100.0f && !EqualChanced.empty())
+ if (chance >= 100.0f && !EqualChanced.empty())
{
sLog.outErrorDb("Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance);
}
@@ -1082,22 +1082,22 @@ void LootTemplate::LootGroup::CheckLootRefs(LootTemplateMap const& store, LootId
{
for (LootStoreItemList::const_iterator ieItr=ExplicitlyChanced.begin(); ieItr != ExplicitlyChanced.end(); ++ieItr)
{
- if(ieItr->mincountOrRef < 0)
+ if (ieItr->mincountOrRef < 0)
{
- if(!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
+ if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
- else if(ref_set)
+ else if (ref_set)
ref_set->erase(-ieItr->mincountOrRef);
}
}
for (LootStoreItemList::const_iterator ieItr=EqualChanced.begin(); ieItr != EqualChanced.end(); ++ieItr)
{
- if(ieItr->mincountOrRef < 0)
+ if (ieItr->mincountOrRef < 0)
{
- if(!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
+ if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
- else if(ref_set)
+ else if (ref_set)
ref_set->erase(-ieItr->mincountOrRef);
}
}
@@ -1151,7 +1151,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint16
++_item_counter;
if (_proto->InventoryType == 0 && _item_counter == 3) // Non-equippable items are limited to 3 drops
continue;
- else if(_proto->InventoryType != 0 && _item_counter == 1) // Equippable item are limited to 1 drop
+ else if (_proto->InventoryType != 0 && _item_counter == 1) // Equippable item are limited to 1 drop
continue;
}
if (_item != loot.items.end())
@@ -1192,7 +1192,7 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con
if (i->mincountOrRef < 0) // References
{
LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef);
- if( Referenced ==store.end())
+ if ( Referenced ==store.end())
continue; // Error message [should be] already printed at loading stage
if (Referenced->second->HasQuestDrop(store, i->group))
return true;
@@ -1407,9 +1407,9 @@ void LoadLootTemplates_Pickpocketing()
// remove real entries and check existence loot
for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
{
- if(CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
+ if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
{
- if(uint32 lootid = cInfo->pickpocketLootId)
+ if (uint32 lootid = cInfo->pickpocketLootId)
{
if (ids_set.find(lootid) == ids_set.end())
LootTemplates_Pickpocketing.ReportNotExistedId(lootid);
@@ -1455,7 +1455,7 @@ void LoadLootTemplates_Mail()
// remove real entries and check existence loot
for (uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i)
- if(sMailTemplateStore.LookupEntry(i))
+ if (sMailTemplateStore.LookupEntry(i))
if (ids_set.find(i) != ids_set.end())
ids_set.erase(i);
@@ -1498,11 +1498,11 @@ void LoadLootTemplates_Spell()
for (uint32 spell_id = 1; spell_id < sSpellStore.GetNumRows(); ++spell_id)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry (spell_id);
- if(!spellInfo)
+ if (!spellInfo)
continue;
// possible cases
- if( !IsLootCraftingSpell(spellInfo))
+ if ( !IsLootCraftingSpell(spellInfo))
continue;
if (ids_set.find(spell_id) == ids_set.end())
diff --git a/src/game/Mail.h b/src/game/Mail.h
index 44957749490..3832f34c07a 100644
--- a/src/game/Mail.h
+++ b/src/game/Mail.h
@@ -186,7 +186,7 @@ struct Mail
{
for (std::vector<MailItemInfo>::iterator itr = items.begin(); itr != items.end(); ++itr)
{
- if(itr->item_guid == item_guid)
+ if (itr->item_guid == item_guid)
{
items.erase(itr);
return true;
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index 044f37da71d..a3b7eea375d 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -71,7 +71,7 @@ Map::~Map()
obj->ResetMap();
}
- if(!m_scriptSchedule.empty())
+ if (!m_scriptSchedule.empty())
sWorld.DecreaseScheduledScriptCount(m_scriptSchedule.size());
}
@@ -83,7 +83,7 @@ bool Map::ExistMap(uint32 mapid,int gx,int gy)
FILE *pf=fopen(tmp,"rb");
- if(!pf)
+ if (!pf)
{
sLog.outError("Check existing of map file '%s': not exist!",tmp);
delete[] tmp;
@@ -108,13 +108,13 @@ bool Map::ExistMap(uint32 mapid,int gx,int gy)
bool Map::ExistVMap(uint32 mapid,int gx,int gy)
{
- if(VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager())
+ if (VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager())
{
- if(vmgr->isMapLoadingEnabled())
+ if (vmgr->isMapLoadingEnabled())
{
// x and y are swapped !! => fixed now
bool exists = vmgr->existsMap((sWorld.GetDataPath()+ "vmaps").c_str(), mapid, gx,gy);
- if(!exists)
+ if (!exists)
{
std::string name = vmgr->getDirFileName(mapid,gx,gy);
sLog.outError("VMap file '%s' is missing or point to wrong version vmap file, redo vmaps with latest vmap_assembler.exe program", (sWorld.GetDataPath()+"vmaps/"+name).c_str());
@@ -146,9 +146,9 @@ void Map::LoadVMap(int gx,int gy)
void Map::LoadMap(int gx,int gy, bool reload)
{
- if( i_InstanceId != 0 )
+ if ( i_InstanceId != 0 )
{
- if(GridMaps[gx][gy])
+ if (GridMaps[gx][gy])
return;
// load grid map for base map
@@ -160,11 +160,11 @@ void Map::LoadMap(int gx,int gy, bool reload)
return;
}
- if(GridMaps[gx][gy] && !reload)
+ if (GridMaps[gx][gy] && !reload)
return;
//map already load, delete it before reloading (Is it necessary? Do we really need the ability the reload maps during runtime?)
- if(GridMaps[gx][gy])
+ if (GridMaps[gx][gy])
{
sLog.outDetail("Unloading already loaded map %u before reloading.",GetId());
delete (GridMaps[gx][gy]);
@@ -189,7 +189,7 @@ void Map::LoadMap(int gx,int gy, bool reload)
void Map::LoadMapAndVMap(int gx,int gy)
{
LoadMap(gx,gy);
- if(i_InstanceId == 0)
+ if (i_InstanceId == 0)
LoadVMap(gx, gy); // Only load the data for the base map
}
@@ -242,7 +242,7 @@ void Map::InitVisibilityDistance()
template<class T>
void Map::AddToGrid(T* obj, NGridType *grid, Cell const& cell)
{
- if(obj->m_isWorldObject)
+ if (obj->m_isWorldObject)
(*grid)(cell.CellX(), cell.CellY()).template AddWorldObject<T>(obj);
else
(*grid)(cell.CellX(), cell.CellY()).template AddGridObject<T>(obj);
@@ -251,7 +251,7 @@ void Map::AddToGrid(T* obj, NGridType *grid, Cell const& cell)
template<>
void Map::AddToGrid(Creature* obj, NGridType *grid, Cell const& cell)
{
- if(obj->m_isWorldObject)
+ if (obj->m_isWorldObject)
(*grid)(cell.CellX(), cell.CellY()).AddWorldObject(obj);
else
(*grid)(cell.CellX(), cell.CellY()).AddGridObject(obj);
@@ -262,7 +262,7 @@ void Map::AddToGrid(Creature* obj, NGridType *grid, Cell const& cell)
template<class T>
void Map::RemoveFromGrid(T* obj, NGridType *grid, Cell const& cell)
{
- if(obj->m_isWorldObject)
+ if (obj->m_isWorldObject)
(*grid)(cell.CellX(), cell.CellY()).template RemoveWorldObject<T>(obj);
else
(*grid)(cell.CellX(), cell.CellY()).template RemoveGridObject<T>(obj);
@@ -272,14 +272,14 @@ template<class T>
void Map::SwitchGridContainers(T* obj, bool on)
{
CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
- if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
+ if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
{
sLog.outError("Map::SwitchGridContainers: Object " I64FMT " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
return;
}
Cell cell(p);
- if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) )
+ if ( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) )
return;
DEBUG_LOG("Switch object " I64FMT " from grid[%u,%u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
@@ -288,11 +288,11 @@ void Map::SwitchGridContainers(T* obj, bool on)
GridType &grid = (*ngrid)(cell.CellX(), cell.CellY());
- if(on)
+ if (on)
{
grid.RemoveGridObject<T>(obj);
grid.AddWorldObject<T>(obj);
- /*if(!grid.RemoveGridObject<T>(obj, obj->GetGUID())
+ /*if (!grid.RemoveGridObject<T>(obj, obj->GetGUID())
|| !grid.AddWorldObject<T>(obj, obj->GetGUID()))
{
assert(false);
@@ -302,7 +302,7 @@ void Map::SwitchGridContainers(T* obj, bool on)
{
grid.RemoveWorldObject<T>(obj);
grid.AddGridObject<T>(obj);
- /*if(!grid.RemoveWorldObject<T>(obj, obj->GetGUID())
+ /*if (!grid.RemoveWorldObject<T>(obj, obj->GetGUID())
|| !grid.AddGridObject<T>(obj, obj->GetGUID()))
{
assert(false);
@@ -331,10 +331,10 @@ void Map::DeleteFromWorld(Player* pl)
void
Map::EnsureGridCreated(const GridPair &p)
{
- if(!getNGrid(p.x_coord, p.y_coord))
+ if (!getNGrid(p.x_coord, p.y_coord))
{
Guard guard(*this);
- if(!getNGrid(p.x_coord, p.y_coord))
+ if (!getNGrid(p.x_coord, p.y_coord))
{
sLog.outDebug("Creating grid[%u,%u] for map %u instance %u", p.x_coord, p.y_coord, GetId(), i_InstanceId);
@@ -350,7 +350,7 @@ Map::EnsureGridCreated(const GridPair &p)
int gx = (MAX_NUMBER_OF_GRIDS - 1) - p.x_coord;
int gy = (MAX_NUMBER_OF_GRIDS - 1) - p.y_coord;
- if(!GridMaps[gx][gy])
+ if (!GridMaps[gx][gy])
LoadMapAndVMap(gx,gy);
}
}
@@ -373,7 +373,7 @@ Map::EnsureGridLoadedAtEnter(const Cell &cell, Player *player)
}
// refresh grid state & timer
- if( grid->GetGridState() != GRID_STATE_ACTIVE )
+ if ( grid->GetGridState() != GRID_STATE_ACTIVE )
{
ResetGridExpiry(*grid, 0.1f);
grid->SetGridState(GRID_STATE_ACTIVE);
@@ -386,7 +386,7 @@ bool Map::EnsureGridLoaded(const Cell &cell)
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
assert(grid != NULL);
- if( !isGridObjectDataLoaded(cell.GridX(), cell.GridY()) )
+ if ( !isGridObjectDataLoaded(cell.GridX(), cell.GridY()) )
{
sLog.outDebug("Loading grid[%u,%u] for map %u instance %u", cell.GridX(), cell.GridY(), GetId(), i_InstanceId);
@@ -415,7 +415,7 @@ bool Map::Add(Player *player)
// Check if we are adding to correct map
assert (player->GetMap() == this);
CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
- if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
+ if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
{
sLog.outError("Map::Add: Player (GUID: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), p.x_coord, p.y_coord);
return false;
@@ -445,20 +445,20 @@ void
Map::Add(T *obj)
{
CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
- if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
+ if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
{
sLog.outError("Map::Add: Object " UI64FMTD " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
return;
}
Cell cell(p);
- if(obj->IsInWorld()) // need some clean up later
+ if (obj->IsInWorld()) // need some clean up later
{
obj->UpdateObjectVisibility(true);
return;
}
- if(obj->isActiveObject())
+ if (obj->isActiveObject())
EnsureGridLoadedAtEnter(cell);
else
EnsureGridCreated(GridPair(cell.GridX(), cell.GridY()));
@@ -470,7 +470,7 @@ Map::Add(T *obj)
//obj->SetMap(this);
obj->AddToWorld();
- if(obj->isActiveObject())
+ if (obj->isActiveObject())
AddToActive(obj);
DEBUG_LOG("Object %u enters grid[%u,%u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY());
@@ -485,7 +485,7 @@ void Map::MessageBroadcast(Player *player, WorldPacket *msg, bool to_self)
{
CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
- if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
+ if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
{
sLog.outError("Map::MessageBroadcast: Player (GUID: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), p.x_coord, p.y_coord);
return;
@@ -495,7 +495,7 @@ void Map::MessageBroadcast(Player *player, WorldPacket *msg, bool to_self)
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
- if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) )
+ if ( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) )
return;
Trinity::MessageDeliverer post_man(*player, msg, to_self);
@@ -508,7 +508,7 @@ void Map::MessageBroadcast(WorldObject *obj, WorldPacket *msg)
{
CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
- if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
+ if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
{
sLog.outError("Map::MessageBroadcast: Object (GUID: %u TypeId: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
return;
@@ -518,7 +518,7 @@ void Map::MessageBroadcast(WorldObject *obj, WorldPacket *msg)
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
- if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) )
+ if ( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) )
return;
//TODO: currently on continents when Visibility.Distance.InFlight > Visibility.Distance.Continents
@@ -533,7 +533,7 @@ void Map::MessageDistBroadcast(Player *player, WorldPacket *msg, float dist, boo
{
CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
- if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
+ if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
{
sLog.outError("Map::MessageBroadcast: Player (GUID: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), p.x_coord, p.y_coord);
return;
@@ -543,7 +543,7 @@ void Map::MessageDistBroadcast(Player *player, WorldPacket *msg, float dist, boo
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
- if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) )
+ if ( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) )
return;
Trinity::MessageDistDeliverer post_man(*player, msg, dist, to_self, own_team_only);
@@ -556,7 +556,7 @@ void Map::MessageDistBroadcast(WorldObject *obj, WorldPacket *msg, float dist)
{
CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
- if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
+ if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
{
sLog.outError("Map::MessageBroadcast: Object (GUID: %u TypeId: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
return;
@@ -566,7 +566,7 @@ void Map::MessageDistBroadcast(WorldObject *obj, WorldPacket *msg, float dist)
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
- if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) )
+ if ( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) )
return;
Trinity::ObjectMessageDistDeliverer post_man(*obj, msg, dist);
@@ -587,7 +587,7 @@ void Map::Update(const uint32 &t_diff)
for (m_mapRefIter = m_mapRefManager.begin(); m_mapRefIter != m_mapRefManager.end(); ++m_mapRefIter)
{
Player* plr = m_mapRefIter->getSource();
- if(plr && plr->IsInWorld())
+ if (plr && plr->IsInWorld())
plr->Update(t_diff);
}
@@ -702,7 +702,7 @@ void Map::Update(const uint32 &t_diff)
MoveAllCreaturesInMoveList();
- if(!m_mapRefManager.isEmpty() || !m_activeNonPlayers.empty())
+ if (!m_mapRefManager.isEmpty() || !m_activeNonPlayers.empty())
ProcessRelocationNotifies(t_diff);
}
@@ -741,7 +741,7 @@ void Map::ProcessRelocationNotifies(const uint32 & diff)
for (uint32 y = cell_min.y_coord; y < cell_max.y_coord; ++y)
{
uint32 cell_id = (y * TOTAL_NUMBER_OF_CELLS_PER_MAP) + x;
- if(!isCellMarked(cell_id))
+ if (!isCellMarked(cell_id))
continue;
CellPair pair(x,y);
@@ -782,7 +782,7 @@ void Map::ProcessRelocationNotifies(const uint32 & diff)
for (uint32 y = cell_min.y_coord; y < cell_max.y_coord; ++y)
{
uint32 cell_id = (y * TOTAL_NUMBER_OF_CELLS_PER_MAP) + x;
- if(!isCellMarked(cell_id))
+ if (!isCellMarked(cell_id))
continue;
CellPair pair(x,y);
@@ -801,7 +801,7 @@ void Map::Remove(Player *player, bool remove)
SendRemoveTransports(player);
CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
- if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
+ if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
sLog.outCrash("Map::Remove: Player is in invalid cell!");
else
{
@@ -866,7 +866,7 @@ Map::Remove(T *obj, bool remove)
if (remove)
{
// if option set then object already saved at this moment
- if(!sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
+ if (!sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
obj->SaveRespawnTime();
DeleteFromWorld(obj);
}
@@ -892,7 +892,7 @@ Map::PlayerRelocation(Player *player, float x, float y, float z, float orientati
NGridType* oldGrid = getNGrid(old_cell.GridX(), old_cell.GridY());
RemoveFromGrid(player, oldGrid,old_cell);
- if( old_cell.DiffGrid(new_cell) )
+ if ( old_cell.DiffGrid(new_cell) )
EnsureGridLoadedAtEnter(new_cell, player);
NGridType* newGrid = getNGrid(new_cell.GridX(), new_cell.GridY());
@@ -987,7 +987,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell)
if (old_cell.DiffCell(new_cell))
{
#ifdef TRINITY_DEBUG
- if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
+ if ((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
sLog.outDebug("Creature (GUID: %u Entry: %u) moved in grid[%u,%u] from cell[%u,%u] to cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.CellX(), new_cell.CellY());
#endif
@@ -997,7 +997,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell)
else
{
#ifdef TRINITY_DEBUG
- if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
+ if ((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
sLog.outDebug("Creature (GUID: %u Entry: %u) move in same grid[%u,%u]cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY());
#endif
}
@@ -1011,7 +1011,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell)
EnsureGridLoadedAtEnter(new_cell);
#ifdef TRINITY_DEBUG
- if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
+ if ((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
sLog.outDebug("Active creature (GUID: %u Entry: %u) moved from grid[%u,%u]cell[%u,%u] to grid[%u,%u]cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
#endif
@@ -1025,7 +1025,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell)
if (loaded(GridPair(new_cell.GridX(), new_cell.GridY())))
{
#ifdef TRINITY_DEBUG
- if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
+ if ((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
sLog.outDebug("Creature (GUID: %u Entry: %u) moved from grid[%u,%u]cell[%u,%u] to grid[%u,%u]cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
#endif
@@ -1056,12 +1056,12 @@ bool Map::CreatureRespawnRelocation(Creature *c)
c->GetMotionMaster()->Clear();
#ifdef TRINITY_DEBUG
- if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
+ if ((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
sLog.outDebug("Creature (GUID: %u Entry: %u) will moved from grid[%u,%u]cell[%u,%u] to respawn grid[%u,%u]cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), c->GetCurrentCell().GridX(), c->GetCurrentCell().GridY(), c->GetCurrentCell().CellX(), c->GetCurrentCell().CellY(), resp_cell.GridX(), resp_cell.GridY(), resp_cell.CellX(), resp_cell.CellY());
#endif
// teleport it to respawn point (like normal respawn if player see)
- if(CreatureCellRelocation(c,resp_cell))
+ if (CreatureCellRelocation(c,resp_cell))
{
c->Relocate(resp_x, resp_y, resp_z, resp_o);
c->GetMotionMaster()->Initialize(); // prevent possible problems with default move generators
@@ -1079,14 +1079,14 @@ bool Map::UnloadGrid(const uint32 &x, const uint32 &y, bool unloadAll)
assert( grid != NULL);
{
- if(!unloadAll && ActiveObjectsNearGrid(x, y) )
+ if (!unloadAll && ActiveObjectsNearGrid(x, y) )
return false;
sLog.outDebug("Unloading grid[%u,%u] for map %u", x,y, GetId());
ObjectGridUnloader unloader(*grid);
- if(!unloadAll)
+ if (!unloadAll)
{
// Finish creature moves, remove and delete all creatures with delayed remove before moving to respawn grids
// Must know real mob position before move
@@ -1119,7 +1119,7 @@ bool Map::UnloadGrid(const uint32 &x, const uint32 &y, bool unloadAll)
{
if (i_InstanceId == 0)
{
- if(GridMaps[gx][gy])
+ if (GridMaps[gx][gy])
{
GridMaps[gx][gy]->unloadData();
delete GridMaps[gx][gy];
@@ -1138,12 +1138,12 @@ bool Map::UnloadGrid(const uint32 &x, const uint32 &y, bool unloadAll)
void Map::RemoveAllPlayers()
{
- if(HavePlayers())
+ if (HavePlayers())
{
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
{
Player* plr = itr->getSource();
- if(!plr->IsBeingTeleportedFar())
+ if (!plr->IsBeingTeleportedFar())
{
// this is happening for bg
sLog.outError("Map::UnloadAll: player %s is still in map %u during unload, should not happen!", plr->GetName(), GetId());
@@ -1685,12 +1685,12 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps) const
{
// find raw .map surface under Z coordinates
float mapHeight;
- if(GridMap *gmap = const_cast<Map*>(this)->GetGrid(x, y))
+ if (GridMap *gmap = const_cast<Map*>(this)->GetGrid(x, y))
{
float _mapheight = gmap->getHeight(x,y);
// look from a bit higher pos to find the floor, ignore under surface case
- if(z + 2.0f > _mapheight)
+ if (z + 2.0f > _mapheight)
mapHeight = _mapheight;
else
mapHeight = VMAP_INVALID_HEIGHT_VALUE;
@@ -1699,10 +1699,10 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps) const
mapHeight = VMAP_INVALID_HEIGHT_VALUE;
float vmapHeight;
- if(pUseVmaps)
+ if (pUseVmaps)
{
VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
- if(vmgr->isHeightCalcEnabled())
+ if (vmgr->isHeightCalcEnabled())
{
// look from a bit higher pos to find the floor
vmapHeight = vmgr->getHeight(GetId(), x, y, z + 2.0f);
@@ -1716,15 +1716,15 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps) const
// mapHeight set for any above raw ground Z or <= INVALID_HEIGHT
// vmapheight set for any under Z value or <= INVALID_HEIGHT
- if( vmapHeight > INVALID_HEIGHT )
+ if ( vmapHeight > INVALID_HEIGHT )
{
- if( mapHeight > INVALID_HEIGHT )
+ if ( mapHeight > INVALID_HEIGHT )
{
// we have mapheight and vmapheight and must select more appropriate
// we are already under the surface or vmap height above map heigt
// or if the distance of the vmap height is less the land height distance
- if( z < mapHeight || vmapHeight > mapHeight || fabs(mapHeight-z) > fabs(vmapHeight-z) )
+ if ( z < mapHeight || vmapHeight > mapHeight || fabs(mapHeight-z) > fabs(vmapHeight-z) )
return vmapHeight;
else
return mapHeight; // better use .map surface height
@@ -1735,9 +1735,9 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps) const
}
else
{
- if(!pUseVmaps)
+ if (!pUseVmaps)
return mapHeight; // explicitly use map data (if have)
- else if(mapHeight > INVALID_HEIGHT && (z < mapHeight + 2 || z == MAX_HEIGHT))
+ else if (mapHeight > INVALID_HEIGHT && (z < mapHeight + 2 || z == MAX_HEIGHT))
return mapHeight; // explicitly use map data if original z < mapHeight but map found (z+2 > mapHeight)
else
return VMAP_INVALID_HEIGHT_VALUE; // we not have any height
@@ -1766,7 +1766,7 @@ float Map::GetVmapHeight(float x, float y, float z) const
uint16 Map::GetAreaFlag(float x, float y, float z) const
{
uint16 areaflag;
- if(GridMap *gmap = const_cast<Map*>(this)->GetGrid(x, y))
+ if (GridMap *gmap = const_cast<Map*>(this)->GetGrid(x, y))
areaflag = gmap->getArea(x, y);
// this used while not all *.map files generated (instances)
else
@@ -1809,18 +1809,18 @@ uint16 Map::GetAreaFlag(float x, float y, float z) const
case 1984: // Plaguelands: The Scarlet Enclave
case 2076: // Death's Breach (Plaguelands: The Scarlet Enclave)
case 2745: // The Noxious Pass (Plaguelands: The Scarlet Enclave)
- if(z > 350.0f) areaflag = 2048; break;
+ if (z > 350.0f) areaflag = 2048; break;
// Acherus: The Ebon Hold (Eastern Plaguelands)
case 856: // The Noxious Glade (Eastern Plaguelands)
case 2456: // Death's Breach (Eastern Plaguelands)
- if(z > 350.0f) areaflag = 1950; break;
+ if (z > 350.0f) areaflag = 1950; break;
// Dalaran
case 2492: // Forlorn Woods (Crystalsong Forest)
case 2371: // Valley of Echoes (Icecrown Glacier)
if (x > 5568.0f && x < 6022.0f && y > 374.0f && y < 918.0f && z > 563.0f)
{
areaflag = 2153;
- if(y - 1.41f * x + 7649.55f > 0) // Violet Hold
+ if (y - 1.41f * x + 7649.55f > 0) // Violet Hold
{
if (y < 595.0f)
areaflag = 2540;
@@ -1906,7 +1906,7 @@ uint16 Map::GetAreaFlag(float x, float y, float z) const
// Undercity (cave and ground zone, part of royal quarter)
case 607: // Ruins of Lordaeron (Tirisfal Glades)
// ground and near to ground (by city walls)
- if(z > 0.0f)
+ if (z > 0.0f)
{
if (x > 1510.0f && x < 1839.0f && y > 29.77f && y < 433.0f) areaflag = 685;
}
@@ -1928,7 +1928,7 @@ uint16 Map::GetAreaFlag(float x, float y, float z) const
// Makers' Overlook (ground and cave)
else if (x > 5634.48f && x < 5774.53f && y < 3475.0f && z > 300.0f)
{
- if(y > 3380.26f || (y > 3265.0f && z < 360.0f))
+ if (y > 3380.26f || (y > 3265.0f && z < 360.0f))
areaflag = 2187;
}
break;
@@ -1955,7 +1955,7 @@ uint16 Map::GetAreaFlag(float x, float y, float z) const
uint8 Map::GetTerrainType(float x, float y ) const
{
- if(GridMap *gmap = const_cast<Map*>(this)->GetGrid(x, y))
+ if (GridMap *gmap = const_cast<Map*>(this)->GetGrid(x, y))
return gmap->getTerrainType(x, y);
else
return 0;
@@ -1963,7 +1963,7 @@ uint8 Map::GetTerrainType(float x, float y ) const
ZLiquidStatus Map::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data) const
{
- if(GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
+ if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
return gmap->getLiquidStatus(x, y, z, ReqLiquidType, data);
else
return LIQUID_MAP_NO_WATER;
@@ -1971,7 +1971,7 @@ ZLiquidStatus Map::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidTyp
float Map::GetWaterLevel(float x, float y ) const
{
- if(GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
+ if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
return gmap->getLiquidLevel(x, y);
else
return 0;
@@ -1991,7 +1991,7 @@ uint32 Map::GetZoneIdByAreaFlag(uint16 areaflag,uint32 map_id)
{
AreaTableEntry const *entry = GetAreaEntryByAreaFlagAndMap(areaflag,map_id);
- if( entry )
+ if ( entry )
return ( entry->zone != 0 ) ? entry->zone : entry->ID;
else
return 0;
@@ -2036,7 +2036,7 @@ bool Map::CheckGridIntegrity(Creature* c, bool moved) const
CellPair xy_val = Trinity::ComputeCellPair(c->GetPositionX(), c->GetPositionY());
Cell xy_cell(xy_val);
- if(xy_cell != cur_cell)
+ if (xy_cell != cur_cell)
{
sLog.outDebug("Creature (GUID: %u) X: %f Y: %f (%s) in grid[%u,%u]cell[%u,%u] instead grid[%u,%u]cell[%u,%u]",
c->GetGUIDLow(),
@@ -2111,7 +2111,7 @@ void Map::SendInitSelf( Player * player )
UpdateData data;
// attach to player data current transport data
- if(Transport* transport = player->GetTransport())
+ if (Transport* transport = player->GetTransport())
{
transport->BuildCreateUpdateBlockForPlayer(&data, player);
}
@@ -2120,11 +2120,11 @@ void Map::SendInitSelf( Player * player )
player->BuildCreateUpdateBlockForPlayer(&data, player);
// build other passengers at transport also (they always visible and marked as visible and will not send at visibility update at add to map
- if(Transport* transport = player->GetTransport())
+ if (Transport* transport = player->GetTransport())
{
for (Transport::PlayerSet::const_iterator itr = transport->GetPassengers().begin(); itr!=transport->GetPassengers().end(); ++itr)
{
- if(player!=(*itr) && player->HaveAtClient(*itr))
+ if (player!=(*itr) && player->HaveAtClient(*itr))
{
(*itr)->BuildCreateUpdateBlockForPlayer(&data, player);
}
@@ -2152,7 +2152,7 @@ void Map::SendInitTransports( Player * player )
for (MapManager::TransportSet::const_iterator i = tset.begin(); i != tset.end(); ++i)
{
// send data for current transport in other place
- if((*i) != player->GetTransport() && (*i)->GetMapId()==GetId())
+ if ((*i) != player->GetTransport() && (*i)->GetMapId()==GetId())
{
(*i)->BuildCreateUpdateBlockForPlayer(&transData, player);
}
@@ -2178,7 +2178,7 @@ void Map::SendRemoveTransports( Player * player )
// except used transport
for (MapManager::TransportSet::const_iterator i = tset.begin(); i != tset.end(); ++i)
- if((*i) != player->GetTransport() && (*i)->GetMapId()!=GetId())
+ if ((*i) != player->GetTransport() && (*i)->GetMapId()!=GetId())
(*i)->BuildOutOfRangeUpdateBlock(&transData);
WorldPacket packet;
@@ -2188,7 +2188,7 @@ void Map::SendRemoveTransports( Player * player )
inline void Map::setNGrid(NGridType *grid, uint32 x, uint32 y)
{
- if(x >= MAX_NUMBER_OF_GRIDS || y >= MAX_NUMBER_OF_GRIDS)
+ if (x >= MAX_NUMBER_OF_GRIDS || y >= MAX_NUMBER_OF_GRIDS)
{
sLog.outError("map::setNGrid() Invalid grid coordinates found: %d, %d!",x,y);
assert(false);
@@ -2230,9 +2230,9 @@ void Map::AddObjectToSwitchList(WorldObject *obj, bool on)
assert(obj->GetMapId()==GetId() && obj->GetInstanceId()==GetInstanceId());
std::map<WorldObject*, bool>::iterator itr = i_objectsToSwitch.find(obj);
- if(itr == i_objectsToSwitch.end())
+ if (itr == i_objectsToSwitch.end())
i_objectsToSwitch.insert(itr, std::make_pair(obj, on));
- else if(itr->second != on)
+ else if (itr->second != on)
i_objectsToSwitch.erase(itr);
else
assert(false);
@@ -2250,7 +2250,7 @@ void Map::RemoveAllObjectsInRemoveList()
switch(obj->GetTypeId())
{
case TYPEID_UNIT:
- if(!obj->ToCreature()->isPet())
+ if (!obj->ToCreature()->isPet())
SwitchGridContainers(obj->ToCreature(), on);
break;
}
@@ -2300,7 +2300,7 @@ uint32 Map::GetPlayersCountExceptGMs() const
{
uint32 count = 0;
for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
- if(!itr->getSource()->isGameMaster())
+ if (!itr->getSource()->isGameMaster())
++count;
return count;
}
@@ -2356,12 +2356,12 @@ void Map::AddToActive( Creature* c )
AddToActiveHelper(c);
// also not allow unloading spawn grid to prevent creating creature clone at load
- if(!c->isPet() && c->GetDBTableGUIDLow())
+ if (!c->isPet() && c->GetDBTableGUIDLow())
{
float x,y,z;
c->GetRespawnCoord(x,y,z);
GridPair p = Trinity::ComputeGridPair(x, y);
- if(getNGrid(p.x_coord, p.y_coord))
+ if (getNGrid(p.x_coord, p.y_coord))
getNGrid(p.x_coord, p.y_coord)->incUnloadActiveLock();
else
{
@@ -2377,12 +2377,12 @@ void Map::RemoveFromActive( Creature* c )
RemoveFromActiveHelper(c);
// also allow unloading spawn grid
- if(!c->isPet() && c->GetDBTableGUIDLow())
+ if (!c->isPet() && c->GetDBTableGUIDLow())
{
float x,y,z;
c->GetRespawnCoord(x,y,z);
GridPair p = Trinity::ComputeGridPair(x, y);
- if(getNGrid(p.x_coord, p.y_coord))
+ if (getNGrid(p.x_coord, p.y_coord))
getNGrid(p.x_coord, p.y_coord)->decUnloadActiveLock();
else
{
@@ -2420,7 +2420,7 @@ InstanceMap::InstanceMap(uint32 id, time_t expiry, uint32 InstanceId, uint8 Spaw
InstanceMap::~InstanceMap()
{
- if(i_data)
+ if (i_data)
{
delete i_data;
i_data = NULL;
@@ -2439,7 +2439,7 @@ void InstanceMap::InitVisibilityDistance()
*/
bool InstanceMap::CanEnter(Player *player)
{
- if(player->GetMapRef().getTarget() == this)
+ if (player->GetMapRef().getTarget() == this)
{
sLog.outError("InstanceMap::CanEnter - player %s(%u) already in map %d,%d,%d!", player->GetName(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode());
assert(false);
@@ -2461,7 +2461,7 @@ bool InstanceMap::CanEnter(Player *player)
// cannot enter while an encounter is in progress on raids
/*Group *pGroup = player->GetGroup();
- if(!player->isGameMaster() && pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->GetMapId() != GetId())*/
+ if (!player->isGameMaster() && pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->GetMapId() != GetId())*/
if (IsRaid() && GetInstanceData() && GetInstanceData()->IsEncounterInProgress())
{
player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT);
@@ -2483,15 +2483,15 @@ bool InstanceMap::Add(Player *player)
{
Guard guard(*this);
// Check moved to void WorldSession::HandleMoveWorldportAckOpcode()
- //if(!CanEnter(player))
+ //if (!CanEnter(player))
//return false;
// Dungeon only code
- if(IsDungeon())
+ if (IsDungeon())
{
// get or create an instance save for the map
InstanceSave *mapSave = sInstanceSaveManager.GetInstanceSave(GetInstanceId());
- if(!mapSave)
+ if (!mapSave)
{
sLog.outDetail("InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId());
mapSave = sInstanceSaveManager.AddInstanceSave(GetId(), GetInstanceId(), Difficulty(GetSpawnMode()), 0, true);
@@ -2499,10 +2499,10 @@ bool InstanceMap::Add(Player *player)
// check for existing instance binds
InstancePlayerBind *playerBind = player->GetBoundInstance(GetId(), Difficulty(GetSpawnMode()));
- if(playerBind && playerBind->perm)
+ if (playerBind && playerBind->perm)
{
// cannot enter other instances if bound permanently
- if(playerBind->save != mapSave)
+ if (playerBind->save != mapSave)
{
sLog.outError("InstanceMap::Add: player %s(%d) is permanently bound to instance %d,%d,%d,%d,%d,%d but he is being put in instance %d,%d,%d,%d,%d,%d", player->GetName(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset());
return false;
@@ -2511,31 +2511,31 @@ bool InstanceMap::Add(Player *player)
else
{
Group *pGroup = player->GetGroup();
- if(pGroup)
+ if (pGroup)
{
// solo saves should be reset when entering a group
InstanceGroupBind *groupBind = pGroup->GetBoundInstance(this);
- if(playerBind)
+ if (playerBind)
{
sLog.outError("InstanceMap::Add: player %s(%d) is being put in instance %d,%d,%d,%d,%d,%d but he is in group %d and is bound to instance %d,%d,%d,%d,%d,%d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(pGroup->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset());
- if(groupBind) sLog.outError("InstanceMap::Add: the group is bound to instance %d,%d,%d,%d,%d,%d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset());
+ if (groupBind) sLog.outError("InstanceMap::Add: the group is bound to instance %d,%d,%d,%d,%d,%d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset());
//assert(false);
return false;
}
// bind to the group or keep using the group save
- if(!groupBind)
+ if (!groupBind)
pGroup->BindToInstance(mapSave, false);
else
{
// cannot jump to a different instance without resetting it
- if(groupBind->save != mapSave)
+ if (groupBind->save != mapSave)
{
sLog.outError("InstanceMap::Add: player %s(%d) is being put in instance %d,%d,%d but he is in group %d which is bound to instance %d,%d,%d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(pGroup->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty());
- if(mapSave)
+ if (mapSave)
sLog.outError("MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount());
else
sLog.outError("MapSave NULL");
- if(groupBind->save)
+ if (groupBind->save)
sLog.outError("GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount());
else
sLog.outError("GroupBind save NULL");
@@ -2543,7 +2543,7 @@ bool InstanceMap::Add(Player *player)
}
// if the group/leader is permanently bound to the instance
// players also become permanently bound when they enter
- if(groupBind->perm)
+ if (groupBind->perm)
{
WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4);
data << uint32(0);
@@ -2555,7 +2555,7 @@ bool InstanceMap::Add(Player *player)
else
{
// set up a solo bind or continue using it
- if(!playerBind)
+ if (!playerBind)
player->BindToInstance(mapSave, false);
else
// cannot jump to a different instance without resetting it
@@ -2731,7 +2731,7 @@ void InstanceMap::SetResetSchedule(bool on)
// only for normal instances
// the reset time is only scheduled when there are no payers inside
// it is assumed that the reset time will rarely (if ever) change while the reset is scheduled
- if(IsDungeon() && !HavePlayers() && !IsRaidOrHeroicDungeon())
+ if (IsDungeon() && !HavePlayers() && !IsRaidOrHeroicDungeon())
{
InstanceSave *save = sInstanceSaveManager.GetInstanceSave(GetInstanceId());
if (!save) sLog.outError("InstanceMap::SetResetSchedule: cannot turn schedule %s, no save available for instance %d of %d", on ? "on" : "off", GetInstanceId(), GetId());
@@ -2746,9 +2746,9 @@ MapDifficulty const* InstanceMap::GetMapDifficulty() const
uint32 InstanceMap::GetMaxPlayers() const
{
- if(MapDifficulty const* mapDiff = GetMapDifficulty())
+ if (MapDifficulty const* mapDiff = GetMapDifficulty())
{
- if(mapDiff->maxPlayers || IsRegularDifficulty()) // Normal case (expect that regular difficulty always have correct maxplayers)
+ if (mapDiff->maxPlayers || IsRegularDifficulty()) // Normal case (expect that regular difficulty always have correct maxplayers)
return mapDiff->maxPlayers;
else // DBC have 0 maxplayers for heroic instances with expansion < 2
{ // The heroic entry exists, so we don't have to check anything, simply return normal max players
@@ -2808,7 +2808,7 @@ bool BattleGroundMap::Add(Player * player)
{
Guard guard(*this);
//Check moved to void WorldSession::HandleMoveWorldportAckOpcode()
- //if(!CanEnter(player))
+ //if (!CanEnter(player))
//return false;
// reset instance validity, battleground maps do not homebind
player->m_InstanceValid = true;
@@ -2896,7 +2896,7 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
sWorld.IncreaseScheduledScriptsCount();
///- If effects should be immediate, launch the script execution
- if(delay == 0 && !i_scriptLock)
+ if (delay == 0 && !i_scriptLock)
{
i_scriptLock = true;
ScriptsProcess();
@@ -2919,7 +2919,7 @@ void Map::ScriptsProcess()
Object* source = NULL;
- if(step.sourceGUID)
+ if (step.sourceGUID)
{
switch(GUID_HIPART(step.sourceGUID))
{
@@ -2927,7 +2927,7 @@ void Map::ScriptsProcess()
// case HIGHGUID_CONTAINER: ==HIGHGUID_ITEM
{
Player* player = HashMapHolder<Player>::Find(step.ownerGUID);
- if(player)
+ if (player)
source = player->GetItemByGuid(step.sourceGUID);
break;
}
@@ -2952,7 +2952,7 @@ void Map::ScriptsProcess()
case HIGHGUID_MO_TRANSPORT:
for (MapManager::TransportSet::iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter)
{
- if((*iter)->GetGUID() == step.sourceGUID)
+ if ((*iter)->GetGUID() == step.sourceGUID)
{
source = reinterpret_cast<Object*>(*iter);
break;
@@ -2965,11 +2965,11 @@ void Map::ScriptsProcess()
}
}
- //if(source && !source->IsInWorld()) source = NULL;
+ //if (source && !source->IsInWorld()) source = NULL;
Object* target = NULL;
- if(step.targetGUID)
+ if (step.targetGUID)
{
switch(GUID_HIPART(step.targetGUID))
{
@@ -2997,24 +2997,24 @@ void Map::ScriptsProcess()
}
}
- //if(target && !target->IsInWorld()) target = NULL;
+ //if (target && !target->IsInWorld()) target = NULL;
switch (step.script->command)
{
case SCRIPT_COMMAND_TALK:
{
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_TALK call for NULL creature.");
break;
}
- if(source->GetTypeId()!=TYPEID_UNIT)
+ if (source->GetTypeId()!=TYPEID_UNIT)
{
sLog.outError("SCRIPT_COMMAND_TALK call for non-creature (TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
}
- if(step.script->datalong > 4)
+ if (step.script->datalong > 4)
{
sLog.outError("SCRIPT_COMMAND_TALK invalid chat type (%u), skipping.",step.script->datalong);
break;
@@ -3029,7 +3029,7 @@ void Map::ScriptsProcess()
source->ToCreature()->Say(step.script->dataint, LANG_UNIVERSAL, unit_target);
break;
case 1: // Whisper
- if(!unit_target)
+ if (!unit_target)
{
sLog.outError("SCRIPT_COMMAND_TALK attempt to whisper (%u) NULL, skipping.",step.script->datalong);
break;
@@ -3052,13 +3052,13 @@ void Map::ScriptsProcess()
}
case SCRIPT_COMMAND_EMOTE:
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_EMOTE call for NULL creature.");
break;
}
- if(source->GetTypeId()!=TYPEID_UNIT)
+ if (source->GetTypeId()!=TYPEID_UNIT)
{
sLog.outError("SCRIPT_COMMAND_EMOTE call for non-creature (TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
@@ -3070,12 +3070,12 @@ void Map::ScriptsProcess()
((Creature *)source)->HandleEmoteCommand(step.script->datalong);
break;
case SCRIPT_COMMAND_FIELD_SET:
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_FIELD_SET call for NULL object.");
break;
}
- if(step.script->datalong <= OBJECT_FIELD_ENTRY || step.script->datalong >= source->GetValuesCount())
+ if (step.script->datalong <= OBJECT_FIELD_ENTRY || step.script->datalong >= source->GetValuesCount())
{
sLog.outError("SCRIPT_COMMAND_FIELD_SET call for wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u).",
step.script->datalong,source->GetValuesCount(),source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
@@ -3085,13 +3085,13 @@ void Map::ScriptsProcess()
source->SetUInt32Value(step.script->datalong, step.script->datalong2);
break;
case SCRIPT_COMMAND_MOVE_TO:
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_MOVE_TO call for NULL creature.");
break;
}
- if(source->GetTypeId()!=TYPEID_UNIT)
+ if (source->GetTypeId()!=TYPEID_UNIT)
{
sLog.outError("SCRIPT_COMMAND_MOVE_TO call for non-creature (TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
@@ -3100,12 +3100,12 @@ void Map::ScriptsProcess()
source->ToCreature()->GetMap()->CreatureRelocation((source->ToCreature()), step.script->x, step.script->y, step.script->z, 0);
break;
case SCRIPT_COMMAND_FLAG_SET:
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_FLAG_SET call for NULL object.");
break;
}
- if(step.script->datalong <= OBJECT_FIELD_ENTRY || step.script->datalong >= source->GetValuesCount())
+ if (step.script->datalong <= OBJECT_FIELD_ENTRY || step.script->datalong >= source->GetValuesCount())
{
sLog.outError("SCRIPT_COMMAND_FLAG_SET call for wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u).",
step.script->datalong,source->GetValuesCount(),source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
@@ -3115,12 +3115,12 @@ void Map::ScriptsProcess()
source->SetFlag(step.script->datalong, step.script->datalong2);
break;
case SCRIPT_COMMAND_FLAG_REMOVE:
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_FLAG_REMOVE call for NULL object.");
break;
}
- if(step.script->datalong <= OBJECT_FIELD_ENTRY || step.script->datalong >= source->GetValuesCount())
+ if (step.script->datalong <= OBJECT_FIELD_ENTRY || step.script->datalong >= source->GetValuesCount())
{
sLog.outError("SCRIPT_COMMAND_FLAG_REMOVE call for wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u).",
step.script->datalong,source->GetValuesCount(),source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
@@ -3140,7 +3140,7 @@ void Map::ScriptsProcess()
}
// must be only Player
- if((!target || target->GetTypeId() != TYPEID_PLAYER) && (!source || source->GetTypeId() != TYPEID_PLAYER))
+ if ((!target || target->GetTypeId() != TYPEID_PLAYER) && (!source || source->GetTypeId() != TYPEID_PLAYER))
{
sLog.outError("SCRIPT_COMMAND_TELEPORT_TO call for non-player (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0);
break;
@@ -3162,7 +3162,7 @@ void Map::ScriptsProcess()
}
// must be only Player
- if((!target || target->GetTypeId() != TYPEID_PLAYER) && (!source || source->GetTypeId() != TYPEID_PLAYER))
+ if ((!target || target->GetTypeId() != TYPEID_PLAYER) && (!source || source->GetTypeId() != TYPEID_PLAYER))
{
sLog.outError("SCRIPT_COMMAND_KILL_CREDIT call for non-player (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0);
break;
@@ -3184,13 +3184,13 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
{
- if(!step.script->datalong) // creature not specified
+ if (!step.script->datalong) // creature not specified
{
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE call for NULL creature.");
break;
}
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE call for NULL world object.");
break;
@@ -3198,7 +3198,7 @@ void Map::ScriptsProcess()
WorldObject* summoner = dynamic_cast<WorldObject*>(source);
- if(!summoner)
+ if (!summoner)
{
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE call for non-WorldObject (TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
@@ -3221,13 +3221,13 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
{
- if(!step.script->datalong) // gameobject not specified
+ if (!step.script->datalong) // gameobject not specified
{
sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT call for NULL gameobject.");
break;
}
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT call for NULL world object.");
break;
@@ -3235,7 +3235,7 @@ void Map::ScriptsProcess()
WorldObject* summoner = dynamic_cast<WorldObject*>(source);
- if(!summoner)
+ if (!summoner)
{
sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT call for non-WorldObject (TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
@@ -3260,7 +3260,7 @@ void Map::ScriptsProcess()
break;
}
- if( go->GetGoType()==GAMEOBJECT_TYPE_FISHINGNODE ||
+ if ( go->GetGoType()==GAMEOBJECT_TYPE_FISHINGNODE ||
go->GetGoType()==GAMEOBJECT_TYPE_DOOR ||
go->GetGoType()==GAMEOBJECT_TYPE_BUTTON ||
go->GetGoType()==GAMEOBJECT_TYPE_TRAP )
@@ -3269,7 +3269,7 @@ void Map::ScriptsProcess()
break;
}
- if( go->isSpawned() )
+ if ( go->isSpawned() )
break; //gameobject already spawned
go->SetLootState(GO_READY);
@@ -3280,19 +3280,19 @@ void Map::ScriptsProcess()
}
case SCRIPT_COMMAND_OPEN_DOOR:
{
- if(!step.script->datalong) // door not specified
+ if (!step.script->datalong) // door not specified
{
sLog.outError("SCRIPT_COMMAND_OPEN_DOOR call for NULL door.");
break;
}
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_OPEN_DOOR call for NULL unit.");
break;
}
- if(!source->isType(TYPEMASK_UNIT)) // must be any Unit (creature or player)
+ if (!source->isType(TYPEMASK_UNIT)) // must be any Unit (creature or player)
{
sLog.outError("SCRIPT_COMMAND_OPEN_DOOR call for non-unit (TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
@@ -3329,25 +3329,25 @@ void Map::ScriptsProcess()
door->UseDoorOrButton(time_to_close);
- if(target && target->isType(TYPEMASK_GAMEOBJECT) && ((GameObject*)target)->GetGoType()==GAMEOBJECT_TYPE_BUTTON)
+ if (target && target->isType(TYPEMASK_GAMEOBJECT) && ((GameObject*)target)->GetGoType()==GAMEOBJECT_TYPE_BUTTON)
((GameObject*)target)->UseDoorOrButton(time_to_close);
break;
}
case SCRIPT_COMMAND_CLOSE_DOOR:
{
- if(!step.script->datalong) // guid for door not specified
+ if (!step.script->datalong) // guid for door not specified
{
sLog.outError("SCRIPT_COMMAND_CLOSE_DOOR call for NULL door.");
break;
}
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_CLOSE_DOOR call for NULL unit.");
break;
}
- if(!source->isType(TYPEMASK_UNIT)) // must be any Unit (creature or player)
+ if (!source->isType(TYPEMASK_UNIT)) // must be any Unit (creature or player)
{
sLog.outError("SCRIPT_COMMAND_CLOSE_DOOR call for non-unit (TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
@@ -3379,25 +3379,25 @@ void Map::ScriptsProcess()
break;
}
- if( door->GetGoState() == GO_STATE_READY )
+ if ( door->GetGoState() == GO_STATE_READY )
break; //door already closed
door->UseDoorOrButton(time_to_open);
- if(target && target->isType(TYPEMASK_GAMEOBJECT) && ((GameObject*)target)->GetGoType()==GAMEOBJECT_TYPE_BUTTON)
+ if (target && target->isType(TYPEMASK_GAMEOBJECT) && ((GameObject*)target)->GetGoType()==GAMEOBJECT_TYPE_BUTTON)
((GameObject*)target)->UseDoorOrButton(time_to_open);
break;
}
case SCRIPT_COMMAND_QUEST_EXPLORED:
{
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED call for NULL source.");
break;
}
- if(!target)
+ if (!target)
{
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED call for NULL target.");
break;
@@ -3407,9 +3407,9 @@ void Map::ScriptsProcess()
WorldObject* worldObject;
Player* player;
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
- if(source->GetTypeId()!=TYPEID_UNIT && source->GetTypeId()!=TYPEID_GAMEOBJECT)
+ if (source->GetTypeId()!=TYPEID_UNIT && source->GetTypeId()!=TYPEID_GAMEOBJECT)
{
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED call for non-creature and non-gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
@@ -3420,13 +3420,13 @@ void Map::ScriptsProcess()
}
else
{
- if(target->GetTypeId()!=TYPEID_UNIT && target->GetTypeId()!=TYPEID_GAMEOBJECT)
+ if (target->GetTypeId()!=TYPEID_UNIT && target->GetTypeId()!=TYPEID_GAMEOBJECT)
{
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED call for non-creature and non-gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.",target->GetTypeId(),target->GetEntry(),target->GetGUIDLow());
break;
}
- if(source->GetTypeId() != TYPEID_PLAYER)
+ if (source->GetTypeId() != TYPEID_PLAYER)
{
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED call for non-player(TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
@@ -3437,7 +3437,7 @@ void Map::ScriptsProcess()
}
// quest id and flags checked at script loading
- if( (worldObject->GetTypeId()!=TYPEID_UNIT || ((Unit*)worldObject)->isAlive()) &&
+ if ( (worldObject->GetTypeId()!=TYPEID_UNIT || ((Unit*)worldObject)->isAlive()) &&
(step.script->datalong2==0 || worldObject->IsWithinDistInMap(player,float(step.script->datalong2))) )
player->AreaExploredOrEventHappens(step.script->datalong);
else
@@ -3448,25 +3448,25 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_ACTIVATE_OBJECT:
{
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_ACTIVATE_OBJECT must have source caster.");
break;
}
- if(!source->isType(TYPEMASK_UNIT))
+ if (!source->isType(TYPEMASK_UNIT))
{
sLog.outError("SCRIPT_COMMAND_ACTIVATE_OBJECT source caster isn't unit (TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
}
- if(!target)
+ if (!target)
{
sLog.outError("SCRIPT_COMMAND_ACTIVATE_OBJECT call for NULL gameobject.");
break;
}
- if(target->GetTypeId()!=TYPEID_GAMEOBJECT)
+ if (target->GetTypeId()!=TYPEID_GAMEOBJECT)
{
sLog.outError("SCRIPT_COMMAND_ACTIVATE_OBJECT call for non-gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.",target->GetTypeId(),target->GetEntry(),target->GetGUIDLow());
break;
@@ -3484,13 +3484,13 @@ void Map::ScriptsProcess()
{
Object* cmdTarget = step.script->datalong2 ? source : target;
- if(!cmdTarget)
+ if (!cmdTarget)
{
sLog.outError("SCRIPT_COMMAND_REMOVE_AURA call for NULL %s.",step.script->datalong2 ? "source" : "target");
break;
}
- if(!cmdTarget->isType(TYPEMASK_UNIT))
+ if (!cmdTarget->isType(TYPEMASK_UNIT))
{
sLog.outError("SCRIPT_COMMAND_REMOVE_AURA %s isn't unit (TypeId: %u, Entry: %u, GUID: %u), skipping.",step.script->datalong2 ? "source" : "target",cmdTarget->GetTypeId(),cmdTarget->GetEntry(),cmdTarget->GetGUIDLow());
break;
@@ -3502,7 +3502,7 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_CAST_SPELL:
{
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_CAST_SPELL must have source caster.");
break;
@@ -3510,7 +3510,7 @@ void Map::ScriptsProcess()
Object* cmdTarget = step.script->datalong2 & 0x01 ? source : target;
- if(cmdTarget && !cmdTarget->isType(TYPEMASK_UNIT))
+ if (cmdTarget && !cmdTarget->isType(TYPEMASK_UNIT))
{
sLog.outError("SCRIPT_COMMAND_CAST_SPELL %s isn't unit (TypeId: %u, Entry: %u. GUID: %u), skipping.",step.script->datalong2 & 0x01 ? "source" : "target",cmdTarget->GetTypeId(),cmdTarget->GetEntry(),cmdTarget->GetGUIDLow());
break;
@@ -3520,13 +3520,13 @@ void Map::ScriptsProcess()
Object* cmdSource = step.script->datalong2 & 0x02 ? target : source;
- if(!cmdSource)
+ if (!cmdSource)
{
sLog.outError("SCRIPT_COMMAND_CAST_SPELL %u call for NULL %s.", step.script->datalong, step.script->datalong2 & 0x02 ? "target" : "source");
break;
}
- if(!cmdSource->isType(TYPEMASK_UNIT))
+ if (!cmdSource->isType(TYPEMASK_UNIT))
{
sLog.outError("SCRIPT_COMMAND_CAST_SPELL %s isn't unit (TypeId: %u, Entry: %u, GUID: %u), skipping.",step.script->datalong2 & 0x02 ? "target" : "source", cmdSource->GetTypeId(),cmdSource->GetEntry(),cmdSource->GetGUIDLow());
break;
@@ -3542,19 +3542,19 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_LOAD_PATH:
{
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_START_MOVE is tried to apply to NON-existing unit.");
break;
}
- if(!source->isType(TYPEMASK_UNIT))
+ if (!source->isType(TYPEMASK_UNIT))
{
sLog.outError("SCRIPT_COMMAND_START_MOVE source mover isn't unit (TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
}
- if(!WaypointMgr.GetPath(step.script->datalong))
+ if (!WaypointMgr.GetPath(step.script->datalong))
{
sLog.outError("SCRIPT_COMMAND_START_MOVE source mover has an invallid path, skipping.", step.script->datalong2);
break;
@@ -3566,7 +3566,7 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT:
{
- if(!step.script->datalong || !step.script->datalong2)
+ if (!step.script->datalong || !step.script->datalong2)
{
sLog.outError("SCRIPT_COMMAND_CALLSCRIPT calls invalid db_script_id or lowguid not present: skipping.");
break;
@@ -3574,7 +3574,7 @@ void Map::ScriptsProcess()
//our target
Creature* target = NULL;
- if(source) //using grid searcher
+ if (source) //using grid searcher
{
CellPair p(Trinity::ComputeCellPair(((Unit*)source)->GetPositionX(), ((Unit*)source)->GetPositionY()));
Cell cell(p);
@@ -3589,11 +3589,11 @@ void Map::ScriptsProcess()
}
else //check hashmap holders
{
- if(CreatureData const* data = objmgr.GetCreatureData(step.script->datalong))
+ if (CreatureData const* data = objmgr.GetCreatureData(step.script->datalong))
target = ObjectAccessor::GetObjectInWorld<Creature>(data->mapid, data->posX, data->posY, MAKE_NEW_GUID(step.script->datalong, data->id, HIGHGUID_UNIT), target);
}
//sLog.outDebug("attempting to pass target...");
- if(!target)
+ if (!target)
break;
//sLog.outDebug("target passed");
//Lets choose our ScriptMap map
@@ -3623,7 +3623,7 @@ void Map::ScriptsProcess()
break;
}
//if no scriptmap present...
- if(!datamap)
+ if (!datamap)
break;
uint32 script_id = step.script->datalong2;
@@ -3634,7 +3634,7 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_KILL:
{
- if(!source || source->ToCreature()->isDead())
+ if (!source || source->ToCreature()->isDead())
break;
source->ToCreature()->DealDamage((source->ToCreature()), source->ToCreature()->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
@@ -3649,14 +3649,14 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_PLAY_SOUND:
{
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_PLAY_SOUND call for NULL creature.");
break;
}
WorldObject* pSource = dynamic_cast<WorldObject*>(source);
- if(!pSource)
+ if (!pSource)
{
sLog.outError("SCRIPT_COMMAND_PLAY_SOUND call for non-world object (TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
@@ -3664,15 +3664,15 @@ void Map::ScriptsProcess()
// bitmask: 0/1=anyone/target, 0/2=with distance dependent
Player* pTarget = NULL;
- if(step.script->datalong2 & 1)
+ if (step.script->datalong2 & 1)
{
- if(!target)
+ if (!target)
{
sLog.outError("SCRIPT_COMMAND_PLAY_SOUND in targeted mode call for NULL target.");
break;
}
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
{
sLog.outError("SCRIPT_COMMAND_PLAY_SOUND in targeted mode call for non-player (TypeId: %u, Entry: %u, GUID: %u), skipping.",target->GetTypeId(),target->GetEntry(),target->GetGUIDLow());
break;
@@ -3682,7 +3682,7 @@ void Map::ScriptsProcess()
}
// bitmask: 0/1=anyone/target, 0/2=with distance dependent
- if(step.script->datalong2 & 2)
+ if (step.script->datalong2 & 2)
pSource->PlayDistanceSound(step.script->datalong,pTarget);
else
pSource->PlayDirectSound(step.script->datalong,pTarget);
@@ -3691,7 +3691,7 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_ORIENTATION:
{
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_ORIENTATION call for NULL creature.");
break;
@@ -3704,7 +3704,7 @@ void Map::ScriptsProcess()
}
case SCRIPT_COMMAND_EQUIP:
{
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_EQUIP call for NULL creature.");
break;
@@ -3716,7 +3716,7 @@ void Map::ScriptsProcess()
}
case SCRIPT_COMMAND_MODEL:
{
- if(!source)
+ if (!source)
{
sLog.outError("SCRIPT_COMMAND_MODEL call for NULL creature.");
break;
@@ -3742,16 +3742,16 @@ Creature*
Map::GetCreature(uint64 guid)
{
Creature * ret = NULL;
- if(IS_CRE_OR_VEH_GUID(guid))
+ if (IS_CRE_OR_VEH_GUID(guid))
ret = ObjectAccessor::GetObjectInWorld(guid, (Creature*)NULL);
- if(!ret)
+ if (!ret)
return NULL;
- if(ret->GetMapId() != GetId())
+ if (ret->GetMapId() != GetId())
return NULL;
- if(ret->GetInstanceId() != GetInstanceId())
+ if (ret->GetInstanceId() != GetInstanceId())
return NULL;
return ret;
@@ -3761,11 +3761,11 @@ GameObject*
Map::GetGameObject(uint64 guid)
{
GameObject * ret = ObjectAccessor::GetObjectInWorld(guid, (GameObject*)NULL);
- if(!ret)
+ if (!ret)
return NULL;
- if(ret->GetMapId() != GetId())
+ if (ret->GetMapId() != GetId())
return NULL;
- if(ret->GetInstanceId() != GetInstanceId())
+ if (ret->GetInstanceId() != GetInstanceId())
return NULL;
return ret;
}
@@ -3774,17 +3774,17 @@ DynamicObject*
Map::GetDynamicObject(uint64 guid)
{
DynamicObject * ret = ObjectAccessor::GetObjectInWorld(guid, (DynamicObject*)NULL);
- if(!ret)
+ if (!ret)
return NULL;
- if(ret->GetMapId() != GetId())
+ if (ret->GetMapId() != GetId())
return NULL;
- if(ret->GetInstanceId() != GetInstanceId())
+ if (ret->GetInstanceId() != GetInstanceId())
return NULL;
return ret;
}
void Map::UpdateIteratorBack(Player *player)
{
- if(m_mapRefIter == player->GetMapRef())
+ if (m_mapRefIter == player->GetMapRef())
m_mapRefIter = m_mapRefIter->nocheck_prev();
}
diff --git a/src/game/Map.h b/src/game/Map.h
index 682e05533f9..f89a685fd2b 100644
--- a/src/game/Map.h
+++ b/src/game/Map.h
@@ -248,8 +248,8 @@ class Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockabl
// currently unused for normal maps
bool CanUnload(uint32 diff)
{
- if(!m_unloadTimer) return false;
- if(m_unloadTimer <= diff) return true;
+ if (!m_unloadTimer) return false;
+ if (m_unloadTimer <= diff) return true;
m_unloadTimer -= diff;
return false;
}
@@ -368,7 +368,7 @@ class Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockabl
bool IsBattleGroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattleGroundOrArena(); }
bool GetEntrancePos(int32 &mapid, float &x, float &y)
{
- if(!i_mapEntry)
+ if (!i_mapEntry)
return false;
return i_mapEntry->GetEntrancePos(mapid, x, y);
}
@@ -538,12 +538,12 @@ class Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockabl
void RemoveFromActiveHelper(T* obj)
{
// Map::Update for active object in proccess
- if(m_activeNonPlayersIter != m_activeNonPlayers.end())
+ if (m_activeNonPlayersIter != m_activeNonPlayers.end())
{
ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj);
- if(itr == m_activeNonPlayers.end())
+ if (itr == m_activeNonPlayers.end())
return;
- if(itr==m_activeNonPlayersIter)
+ if (itr==m_activeNonPlayersIter)
++m_activeNonPlayersIter;
m_activeNonPlayers.erase(itr);
}
@@ -634,7 +634,7 @@ Map::Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor)
const uint32 cell_x = cell.CellX();
const uint32 cell_y = cell.CellY();
- if( !cell.NoCreate() || loaded(GridPair(x,y)) )
+ if ( !cell.NoCreate() || loaded(GridPair(x,y)) )
{
EnsureGridLoaded(cell);
getNGrid(x, y)->Visit(cell_x, cell_y, visitor);
diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp
index e7d7187d0b5..da5ec2d85a3 100644
--- a/src/game/MapInstanced.cpp
+++ b/src/game/MapInstanced.cpp
@@ -36,7 +36,7 @@ MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, DUNGEO
void MapInstanced::InitVisibilityDistance()
{
- if(m_InstancedMaps.empty())
+ if (m_InstancedMaps.empty())
return;
//initialize visibility distances for all instance copies
for (InstancedMaps::iterator i = m_InstancedMaps.begin(); i != m_InstancedMaps.end(); ++i)
@@ -55,9 +55,9 @@ void MapInstanced::Update(const uint32& t)
while (i != m_InstancedMaps.end())
{
- if(i->second->CanUnload(t))
+ if (i->second->CanUnload(t))
{
- if(!DestroyInstance(i)) // iterator incremented
+ if (!DestroyInstance(i)) // iterator incremented
{
//m_unloadTimer
}
@@ -122,20 +122,20 @@ void MapInstanced::UnloadAll()
*/
Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player)
{
- if(GetId() != mapId || !player)
+ if (GetId() != mapId || !player)
return NULL;
Map* map = NULL;
uint32 NewInstanceId = 0; // instanceId of the resulting map
- if(IsBattleGroundOrArena())
+ if (IsBattleGroundOrArena())
{
// instantiate or find existing bg map for player
// the instance id is set in battlegroundid
NewInstanceId = player->GetBattleGroundId();
- if(!NewInstanceId) return NULL;
+ if (!NewInstanceId) return NULL;
map = _FindMap(NewInstanceId);
- if(!map)
+ if (!map)
map = CreateBattleGround(NewInstanceId, player->GetBattleGround());
}
else
@@ -145,21 +145,21 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player)
// the player's permanent player bind is taken into consideration first
// then the player's group bind and finally the solo bind.
- if(!pBind || !pBind->perm)
+ if (!pBind || !pBind->perm)
{
InstanceGroupBind *groupBind = NULL;
Group *group = player->GetGroup();
// use the player's difficulty setting (it may not be the same as the group's)
- if(group && (groupBind = group->GetBoundInstance(this)))
+ if (group && (groupBind = group->GetBoundInstance(this)))
pSave = groupBind->save;
}
- if(pSave)
+ if (pSave)
{
// solo/perm/group
NewInstanceId = pSave->GetInstanceId();
map = _FindMap(NewInstanceId);
// it is possible that the save exists but the map doesn't
- if(!map)
+ if (!map)
map = CreateInstance(NewInstanceId, pSave, pSave->GetDifficulty());
}
else
@@ -183,13 +183,13 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save,
// make sure we have a valid map id
const MapEntry* entry = sMapStore.LookupEntry(GetId());
- if(!entry)
+ if (!entry)
{
sLog.outError("CreateInstance: no entry for map %d", GetId());
assert(false);
}
const InstanceTemplate * iTemplate = objmgr.GetInstanceTemplate(GetId());
- if(!iTemplate)
+ if (!iTemplate)
{
sLog.outError("CreateInstance: no instance template for map %d", GetId());
assert(false);
@@ -236,7 +236,7 @@ BattleGroundMap* MapInstanced::CreateBattleGround(uint32 InstanceId, BattleGroun
bool MapInstanced::DestroyInstance(InstancedMaps::iterator &itr)
{
itr->second->RemoveAllPlayers();
- if(itr->second->HavePlayers())
+ if (itr->second->HavePlayers())
{
++itr;
return false;
@@ -244,7 +244,7 @@ bool MapInstanced::DestroyInstance(InstancedMaps::iterator &itr)
itr->second->UnloadAll();
// should only unload VMaps if this is the last instance and grid unloading is enabled
- if(m_InstancedMaps.size() <= 1 && sWorld.getConfig(CONFIG_GRID_UNLOAD))
+ if (m_InstancedMaps.size() <= 1 && sWorld.getConfig(CONFIG_GRID_UNLOAD))
{
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(itr->second->GetId());
// in that case, unload grids of the base map, too
diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp
index c0b3adf59fb..fadac236448 100644
--- a/src/game/MapManager.cpp
+++ b/src/game/MapManager.cpp
@@ -136,7 +136,7 @@ Map* MapManager::_createBaseMap(uint32 id)
Map* MapManager::CreateMap(uint32 id, const WorldObject* obj, uint32 instanceId)
{
ASSERT(obj);
- //if(!obj->IsInWorld()) sLog.outError("GetMap: called for map %d with object (typeid %d, guid %d, mapid %d, instanceid %d) who is not in world!", id, obj->GetTypeId(), obj->GetGUIDLow(), obj->GetMapId(), obj->GetInstanceId());
+ //if (!obj->IsInWorld()) sLog.outError("GetMap: called for map %d with object (typeid %d, guid %d, mapid %d, instanceid %d) who is not in world!", id, obj->GetTypeId(), obj->GetGUIDLow(), obj->GetMapId(), obj->GetInstanceId());
Map *m = _createBaseMap(id);
if (m && (obj->GetTypeId() == TYPEID_PLAYER) && m->Instanceable()) m = ((MapInstanced*)m)->CreateInstance(id, (Player*)obj);
@@ -159,11 +159,11 @@ Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
{
const MapEntry *entry = sMapStore.LookupEntry(mapid);
- if(!entry)
+ if (!entry)
return false;
const char *mapName = entry->name[player->GetSession()->GetSessionDbcLocale()];
- if(entry->map_type == MAP_INSTANCE || entry->map_type == MAP_RAID)
+ if (entry->map_type == MAP_INSTANCE || entry->map_type == MAP_RAID)
{
if (entry->map_type == MAP_RAID)
{
@@ -375,7 +375,7 @@ uint32 MapManager::GetNumInstances()
continue;
MapInstanced::InstancedMaps &maps = ((MapInstanced *)map)->GetInstancedMaps();
for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr)
- if(mitr->second->IsDungeon()) ret++;
+ if (mitr->second->IsDungeon()) ret++;
}
return ret;
}
diff --git a/src/game/MapManager.h b/src/game/MapManager.h
index 3f01c7e2f34..8f66178d607 100644
--- a/src/game/MapManager.h
+++ b/src/game/MapManager.h
@@ -67,7 +67,7 @@ class MapManager : public Trinity::Singleton<MapManager, Trinity::ClassLevelLock
void SetGridCleanUpDelay(uint32 t)
{
- if( t < MIN_GRID_DELAY )
+ if ( t < MIN_GRID_DELAY )
i_gridCleanUpDelay = MIN_GRID_DELAY;
else
i_gridCleanUpDelay = t;
@@ -75,7 +75,7 @@ class MapManager : public Trinity::Singleton<MapManager, Trinity::ClassLevelLock
void SetMapUpdateInterval(uint32 t)
{
- if( t > MIN_MAP_UPDATE_DELAY )
+ if ( t > MIN_MAP_UPDATE_DELAY )
t = MIN_MAP_UPDATE_DELAY;
i_timer.SetInterval(t);
diff --git a/src/game/MapReference.h b/src/game/MapReference.h
index 3cdd29c3cda..7cd4fcde76c 100644
--- a/src/game/MapReference.h
+++ b/src/game/MapReference.h
@@ -34,7 +34,7 @@ class MapReference : public Reference<Map, Player>
void targetObjectDestroyLink()
{
// called from unlink()
- if(isValid()) getTarget()->m_mapRefManager.decSize();
+ if (isValid()) getTarget()->m_mapRefManager.decSize();
}
void sourceObjectDestroyLink()
{
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index 3644ea5e6c9..f2210976d80 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -55,7 +55,7 @@ void WorldSession::HandleRepopRequestOpcode( WorldPacket & recv_data )
recv_data.read_skip<uint8>();
- if(GetPlayer()->isAlive()||GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
+ if (GetPlayer()->isAlive()||GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
return;
// the world update order is sessions, players, creatures
@@ -63,7 +63,7 @@ void WorldSession::HandleRepopRequestOpcode( WorldPacket & recv_data )
// creatures can kill players
// so if the server is lagging enough the player can
// release spirit after he's killed but before he is updated
- if(GetPlayer()->getDeathState() == JUST_DIED)
+ if (GetPlayer()->getDeathState() == JUST_DIED)
{
sLog.outDebug("HandleRepopRequestOpcode: got request after player %s(%d) was killed and before he was updated", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
GetPlayer()->KillPlayer();
@@ -86,7 +86,7 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
recv_data >> guid >> menuId >> gossipListId;
- if(_player->PlayerTalkClass->GossipOptionCoded(gossipListId))
+ if (_player->PlayerTalkClass->GossipOptionCoded(gossipListId))
{
// recheck
sLog.outBasic("reading string");
@@ -96,7 +96,7 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
Creature *unit = NULL;
GameObject *go = NULL;
- if(IS_CRE_OR_VEH_GUID(guid))
+ if (IS_CRE_OR_VEH_GUID(guid))
{
unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
if (!unit)
@@ -105,7 +105,7 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
return;
}
}
- else if(IS_GAMEOBJECT_GUID(guid))
+ else if (IS_GAMEOBJECT_GUID(guid))
{
go = _player->GetMap()->GetGameObject(guid);
if (!go)
@@ -121,14 +121,14 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
- if(!code.empty())
+ if (!code.empty())
{
- if(unit)
+ if (unit)
{
- if(!sScriptMgr.GossipSelectWithCode( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str()) )
+ if (!sScriptMgr.GossipSelectWithCode( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str()) )
_player->OnGossipSelect(unit, gossipListId, menuId);
}
else
@@ -136,9 +136,9 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
}
else
{
- if(unit)
+ if (unit)
{
- if(!sScriptMgr.GossipSelect( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)) )
+ if (!sScriptMgr.GossipSelect( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)) )
_player->OnGossipSelect(unit, gossipListId, menuId);
}
else
@@ -236,7 +236,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
}
//do not process players which are not in world
- if(!(itr->second->IsInWorld()))
+ if (!(itr->second->IsInWorld()))
continue;
// check if target is globally visible for player
@@ -263,7 +263,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
bool z_show = true;
for (uint32 i = 0; i < zones_count; ++i)
{
- if(zoneids[i] == pzoneid)
+ if (zoneids[i] == pzoneid)
{
z_show = true;
break;
@@ -276,7 +276,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
std::string pname = itr->second->GetName();
std::wstring wpname;
- if(!Utf8toWStr(pname,wpname))
+ if (!Utf8toWStr(pname,wpname))
continue;
wstrToLower(wpname);
@@ -285,7 +285,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
std::string gname = objmgr.GetGuildNameById(itr->second->GetGuildId());
std::wstring wgname;
- if(!Utf8toWStr(gname,wgname))
+ if (!Utf8toWStr(gname,wgname))
continue;
wstrToLower(wgname);
@@ -293,7 +293,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
continue;
std::string aname;
- if(AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId()))
+ if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId()))
aname = areaEntry->area_name[GetSessionDbcLocale()];
bool s_show = true;
@@ -343,7 +343,7 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ )
DoLootRelease(lguid);
//Can not logout if...
- if( GetPlayer()->isInCombat() || //...is in combat
+ if ( GetPlayer()->isInCombat() || //...is in combat
GetPlayer()->duel || //...is in Duel
GetPlayer()->HasAura(9454) || //...is frozen by GM via freeze command
//...is jumping ...is falling
@@ -367,7 +367,7 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ )
}
// not set flags if player can't free move to prevent lost state at logout cancel
- if(GetPlayer()->CanFreeMove())
+ if (GetPlayer()->CanFreeMove())
{
GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT);
@@ -400,7 +400,7 @@ void WorldSession::HandleLogoutCancelOpcode( WorldPacket & /*recv_data*/ )
SendPacket( &data );
// not remove flags if can't free move - its not set in Logout request code.
- if(GetPlayer()->CanFreeMove())
+ if (GetPlayer()->CanFreeMove())
{
//!we can move again
data.Initialize( SMSG_FORCE_MOVE_UNROOT, 8 ); // guess size
@@ -421,7 +421,7 @@ void WorldSession::HandleLogoutCancelOpcode( WorldPacket & /*recv_data*/ )
void WorldSession::HandleTogglePvP( WorldPacket & recv_data )
{
// this opcode can be used in two ways: Either set explicit new status or toggle old status
- if(recv_data.size() == 1)
+ if (recv_data.size() == 1)
{
bool newPvPStatus;
recv_data >> newPvPStatus;
@@ -434,18 +434,18 @@ void WorldSession::HandleTogglePvP( WorldPacket & recv_data )
GetPlayer()->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER);
}
- if(GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP))
+ if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP))
{
- if(!GetPlayer()->IsPvP() || GetPlayer()->pvpInfo.endTimer != 0)
+ if (!GetPlayer()->IsPvP() || GetPlayer()->pvpInfo.endTimer != 0)
GetPlayer()->UpdatePvP(true, true);
}
else
{
- if(!GetPlayer()->pvpInfo.inHostileArea && GetPlayer()->IsPvP())
+ if (!GetPlayer()->pvpInfo.inHostileArea && GetPlayer()->IsPvP())
GetPlayer()->pvpInfo.endTimer = time(NULL); // start toggle-off
}
- //if(OutdoorPvP * pvp = _player->GetOutdoorPvP())
+ //if (OutdoorPvP * pvp = _player->GetOutdoorPvP())
// pvp->HandlePlayerActivityChanged(_player);
}
@@ -473,10 +473,10 @@ void WorldSession::HandleSetTargetOpcode( WorldPacket & recv_data )
// update reputation list if need
Unit* unit = ObjectAccessor::GetUnit(*_player, guid );
- if(!unit)
+ if (!unit)
return;
- if(FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction()))
+ if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction()))
_player->GetReputationMgr().SetVisible(factionTemplateEntry);
}
@@ -489,10 +489,10 @@ void WorldSession::HandleSetSelectionOpcode( WorldPacket & recv_data )
// update reputation list if need
Unit* unit = ObjectAccessor::GetUnit(*_player, guid );
- if(!unit)
+ if (!unit)
return;
- if(FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction()))
+ if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction()))
_player->GetReputationMgr().SetVisible(factionTemplateEntry);
}
@@ -525,7 +525,7 @@ void WorldSession::HandleAddFriendOpcode( WorldPacket & recv_data )
recv_data >> friendNote;
- if(!normalizePlayerName(friendName))
+ if (!normalizePlayerName(friendName))
return;
CharacterDatabase.escape_string(friendName); // prevent SQL injection - normal name don't must changed by this call
@@ -545,13 +545,13 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult_AutoPtr result, uin
WorldSession * session = sWorld.FindSession(accountId);
- if(!session || !session->GetPlayer())
+ if (!session || !session->GetPlayer())
return;
friendResult = FRIEND_NOT_FOUND;
friendGuid = 0;
- if(result)
+ if (result)
{
friendGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
team = Player::TeamForRace((*result)[1].GetUInt8());
@@ -559,22 +559,22 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult_AutoPtr result, uin
if ( session->GetSecurity() >= SEC_MODERATOR || sWorld.getConfig(CONFIG_ALLOW_GM_FRIEND) || accmgr.GetSecurity(friendAcctid) < SEC_MODERATOR)
{
- if(friendGuid)
+ if (friendGuid)
{
- if(friendGuid==session->GetPlayer()->GetGUID())
+ if (friendGuid==session->GetPlayer()->GetGUID())
friendResult = FRIEND_SELF;
- else if(session->GetPlayer()->GetTeam() != team && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && session->GetSecurity() < SEC_MODERATOR)
+ else if (session->GetPlayer()->GetTeam() != team && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && session->GetSecurity() < SEC_MODERATOR)
friendResult = FRIEND_ENEMY;
- else if(session->GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid)))
+ else if (session->GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid)))
friendResult = FRIEND_ALREADY;
else
{
Player* pFriend = ObjectAccessor::FindPlayer(friendGuid);
- if( pFriend && pFriend->IsInWorld() && pFriend->IsVisibleGloballyFor(session->GetPlayer()))
+ if ( pFriend && pFriend->IsInWorld() && pFriend->IsVisibleGloballyFor(session->GetPlayer()))
friendResult = FRIEND_ADDED_ONLINE;
else
friendResult = FRIEND_ADDED_OFFLINE;
- if(!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false))
+ if (!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false))
{
friendResult = FRIEND_LIST_FULL;
sLog.outDebug( "WORLD: %s's friend list is full.", session->GetPlayer()->GetName());
@@ -613,7 +613,7 @@ void WorldSession::HandleAddIgnoreOpcode( WorldPacket & recv_data )
recv_data >> IgnoreName;
- if(!normalizePlayerName(IgnoreName))
+ if (!normalizePlayerName(IgnoreName))
return;
CharacterDatabase.escape_string(IgnoreName); // prevent SQL injection - normal name don't must changed by this call
@@ -631,28 +631,28 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(QueryResult_AutoPtr result, uin
WorldSession * session = sWorld.FindSession(accountId);
- if(!session || !session->GetPlayer())
+ if (!session || !session->GetPlayer())
return;
ignoreResult = FRIEND_IGNORE_NOT_FOUND;
IgnoreGuid = 0;
- if(result)
+ if (result)
{
IgnoreGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
- if(IgnoreGuid)
+ if (IgnoreGuid)
{
- if(IgnoreGuid==session->GetPlayer()->GetGUID()) //not add yourself
+ if (IgnoreGuid==session->GetPlayer()->GetGUID()) //not add yourself
ignoreResult = FRIEND_IGNORE_SELF;
- else if( session->GetPlayer()->GetSocial()->HasIgnore(GUID_LOPART(IgnoreGuid)) )
+ else if ( session->GetPlayer()->GetSocial()->HasIgnore(GUID_LOPART(IgnoreGuid)) )
ignoreResult = FRIEND_IGNORE_ALREADY;
else
{
ignoreResult = FRIEND_IGNORE_ADDED;
// ignore list full
- if(!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(IgnoreGuid), true))
+ if (!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(IgnoreGuid), true))
ignoreResult = FRIEND_IGNORE_FULL;
}
}
@@ -696,7 +696,7 @@ void WorldSession::HandleBugOpcode( WorldPacket & recv_data )
recv_data >> typelen >> type;
- if( suggestion == 0 )
+ if ( suggestion == 0 )
sLog.outDebug( "WORLD: Received CMSG_BUG [Bug Report]" );
else
sLog.outDebug( "WORLD: Received CMSG_BUG [Suggestion]" );
@@ -720,7 +720,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data)
return;
// body not released yet
- if(!GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
+ if (!GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
return;
Corpse *corpse = GetPlayer()->GetCorpse();
@@ -729,7 +729,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data)
return;
// prevent resurrect before 30-sec delay after body release not finished
- if(corpse->GetGhostTime() + GetPlayer()->GetCorpseReclaimDelay(corpse->GetType()==CORPSE_RESURRECTABLE_PVP) > time(NULL))
+ if (corpse->GetGhostTime() + GetPlayer()->GetCorpseReclaimDelay(corpse->GetType()==CORPSE_RESURRECTABLE_PVP) > time(NULL))
return;
if (!corpse->IsWithinDistInMap(GetPlayer(), CORPSE_RECLAIM_RADIUS, true))
@@ -749,7 +749,7 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data)
{
sLog.outDetail("WORLD: Received CMSG_RESURRECT_RESPONSE");
- if(GetPlayer()->isAlive())
+ if (GetPlayer()->isAlive())
return;
uint64 guid;
@@ -757,13 +757,13 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data)
recv_data >> guid;
recv_data >> status;
- if(status == 0)
+ if (status == 0)
{
GetPlayer()->clearResurrectRequestData(); // reject
return;
}
- if(!GetPlayer()->isRessurectRequestedBy(guid))
+ if (!GetPlayer()->isRessurectRequestedBy(guid))
return;
GetPlayer()->ResurectUsingRequestData();
@@ -795,14 +795,14 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
recv_data >> Trigger_ID;
sLog.outDebug("Trigger ID:%u",Trigger_ID);
- if(GetPlayer()->isInFlight())
+ if (GetPlayer()->isInFlight())
{
sLog.outDebug("Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u",GetPlayer()->GetName(),GetPlayer()->GetGUIDLow(), Trigger_ID);
return;
}
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
- if(!atEntry)
+ if (!atEntry)
{
sLog.outDebug("Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u",GetPlayer()->GetName(),GetPlayer()->GetGUIDLow(), Trigger_ID);
return;
@@ -823,7 +823,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
{
// if we have radius check it
float dist = pl->GetDistance(atEntry->x,atEntry->y,atEntry->z);
- if(dist > atEntry->radius + delta)
+ if (dist > atEntry->radius + delta)
{
sLog.outDebug("Player '%s' (GUID: %u) too far (radius: %f distance: %f), ignore Area Trigger ID: %u",
pl->GetName(), pl->GetGUIDLow(), atEntry->radius, dist, Trigger_ID);
@@ -852,7 +852,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
float dz = pl->GetPositionZ() - atEntry->z;
float dx = rotPlayerX - atEntry->x;
float dy = rotPlayerY - atEntry->y;
- if( (fabs(dx) > atEntry->box_x/2 + delta) ||
+ if ( (fabs(dx) > atEntry->box_x/2 + delta) ||
(fabs(dy) > atEntry->box_y/2 + delta) ||
(fabs(dz) > atEntry->box_z/2 + delta) )
{
@@ -862,55 +862,55 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
}
}
- if(sScriptMgr.AreaTrigger(GetPlayer(), atEntry))
+ if (sScriptMgr.AreaTrigger(GetPlayer(), atEntry))
return;
uint32 quest_id = objmgr.GetQuestForAreaTrigger( Trigger_ID );
- if( quest_id && GetPlayer()->isAlive() && GetPlayer()->IsActiveQuest(quest_id) )
+ if ( quest_id && GetPlayer()->isAlive() && GetPlayer()->IsActiveQuest(quest_id) )
{
Quest const* pQuest = objmgr.GetQuestTemplate(quest_id);
- if( pQuest )
+ if ( pQuest )
{
- if(GetPlayer()->GetQuestStatus(quest_id) == QUEST_STATUS_INCOMPLETE)
+ if (GetPlayer()->GetQuestStatus(quest_id) == QUEST_STATUS_INCOMPLETE)
GetPlayer()->AreaExploredOrEventHappens( quest_id );
}
}
- if(objmgr.IsTavernAreaTrigger(Trigger_ID))
+ if (objmgr.IsTavernAreaTrigger(Trigger_ID))
{
// set resting flag we are in the inn
GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
GetPlayer()->InnEnter(time(NULL), atEntry->mapid, atEntry->x, atEntry->y, atEntry->z);
GetPlayer()->SetRestType(REST_TYPE_IN_TAVERN);
- if(sWorld.IsFFAPvPRealm())
+ if (sWorld.IsFFAPvPRealm())
GetPlayer()->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
return;
}
- if(GetPlayer()->InBattleGround())
+ if (GetPlayer()->InBattleGround())
{
BattleGround* bg = GetPlayer()->GetBattleGround();
- if(bg)
- if(bg->GetStatus() == STATUS_IN_PROGRESS)
+ if (bg)
+ if (bg->GetStatus() == STATUS_IN_PROGRESS)
bg->HandleAreaTrigger(GetPlayer(), Trigger_ID);
return;
}
- if(OutdoorPvP * pvp = GetPlayer()->GetOutdoorPvP())
+ if (OutdoorPvP * pvp = GetPlayer()->GetOutdoorPvP())
{
- if(pvp->HandleAreaTrigger(_player, Trigger_ID))
+ if (pvp->HandleAreaTrigger(_player, Trigger_ID))
return;
}
// NULL if all values default (non teleport trigger)
AreaTrigger const* at = objmgr.GetAreaTrigger(Trigger_ID);
- if(!at)
+ if (!at)
return;
- if(!GetPlayer()->Satisfy(objmgr.GetAccessRequirement(at->access_id), at->target_mapId, true))
+ if (!GetPlayer()->Satisfy(objmgr.GetAccessRequirement(at->access_id), at->target_mapId, true))
return;
GetPlayer()->TeleportTo(at->target_mapId,at->target_X,at->target_Y,at->target_Z,at->target_Orientation,TELE_TO_NOT_LEAVE_TRANSPORT);
@@ -925,10 +925,10 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
sLog.outDebug("UAD: type %u, time %u, decompressedSize %u", type, timestamp, decompressedSize);
- if(type > NUM_ACCOUNT_DATA_TYPES)
+ if (type > NUM_ACCOUNT_DATA_TYPES)
return;
- if(decompressedSize == 0) // erase
+ if (decompressedSize == 0) // erase
{
SetAccountData(AccountDataType(type), 0, "");
@@ -940,7 +940,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
return;
}
- if(decompressedSize > 0xFFFF)
+ if (decompressedSize > 0xFFFF)
{
recv_data.rpos(recv_data.wpos()); // unnneded warning spam in this case
sLog.outError("UAD: Account data packet too big, size %u", decompressedSize);
@@ -951,7 +951,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
dest.resize(decompressedSize);
uLongf realSize = decompressedSize;
- if(uncompress(const_cast<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(recv_data.contents() + recv_data.rpos()), recv_data.size() - recv_data.rpos()) != Z_OK)
+ if (uncompress(const_cast<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(recv_data.contents() + recv_data.rpos()), recv_data.size() - recv_data.rpos()) != Z_OK)
{
recv_data.rpos(recv_data.wpos()); // unnneded warning spam in this case
sLog.outError("UAD: Failed to decompress account data");
@@ -980,7 +980,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
sLog.outDebug("RAD: type %u", type);
- if(type > NUM_ACCOUNT_DATA_TYPES)
+ if (type > NUM_ACCOUNT_DATA_TYPES)
return;
AccountData *adata = GetAccountData(AccountDataType(type));
@@ -992,7 +992,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
ByteBuffer dest;
dest.resize(destSize);
- if(size && compress(const_cast<uint8*>(dest.contents()), &destSize, (uint8*)adata->Data.c_str(), size) != Z_OK)
+ if (size && compress(const_cast<uint8*>(dest.contents()), &destSize, (uint8*)adata->Data.c_str(), size) != Z_OK)
{
sLog.outDebug("RAD: Failed to compress account data");
return;
@@ -1066,7 +1066,7 @@ void WorldSession::HandleMoveTimeSkippedOpcode( WorldPacket & recv_data )
DEBUG_LOG( "WORLD: Time Lag/Synchronization Resent/Update" );
uint64 guid;
- if(!recv_data.readPackGUID(guid))
+ if (!recv_data.readPackGUID(guid))
{
recv_data.rpos(recv_data.wpos());
return;
@@ -1104,7 +1104,7 @@ void WorldSession::HandleMoveUnRootAck(WorldPacket& recv_data)
recv_data >> guid;
// now can skip not our packet
- if(_player->GetGUID() != guid)
+ if (_player->GetGUID() != guid)
{
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
return;
@@ -1130,7 +1130,7 @@ void WorldSession::HandleMoveRootAck(WorldPacket& recv_data)
recv_data >> guid;
// now can skip not our packet
- if(_player->GetGUID() != guid)
+ if (_player->GetGUID() != guid)
{
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
return;
@@ -1151,9 +1151,9 @@ void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data)
recv_data >> ActionBar;
- if(!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED)
+ if (!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED)
{
- if(ActionBar!=0)
+ if (ActionBar!=0)
sLog.outError("WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored",uint32(ActionBar));
return;
}
@@ -1192,7 +1192,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
_player->SetSelection(guid);
Player *plr = objmgr.GetPlayer(guid);
- if(!plr) // wrong player
+ if (!plr) // wrong player
return;
uint32 talent_points = 0x47;
@@ -1200,7 +1200,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
WorldPacket data(SMSG_INSPECT_TALENT, guid_size+4+talent_points);
data.append(plr->GetPackGUID());
- if(sWorld.getConfig(CONFIG_TALENTS_INSPECTING) || _player->isGameMaster())
+ if (sWorld.getConfig(CONFIG_TALENTS_INSPECTING) || _player->isGameMaster())
{
plr->BuildPlayerTalentsInfoData(&data);
}
@@ -1223,7 +1223,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data)
Player *player = objmgr.GetPlayer(guid);
- if(!player)
+ if (!player)
{
sLog.outError("InspectHonorStats: WTF, player not found...");
return;
@@ -1260,7 +1260,7 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data)
recv_data >> Orientation; // o (3.141593 = 180 degrees)
//sLog.outDebug("Received opcode CMSG_WORLD_TELEPORT");
- if(GetPlayer()->isInFlight())
+ if (GetPlayer()->isInFlight())
{
sLog.outDebug("Player '%s' (GUID: %u) in flight, ignore worldport command.",GetPlayer()->GetName(),GetPlayer()->GetGUIDLow());
return;
@@ -1287,7 +1287,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
return;
}
- if(charname.empty() || !normalizePlayerName (charname))
+ if (charname.empty() || !normalizePlayerName (charname))
{
SendNotification(LANG_NEED_CHARACTER_NAME);
return;
@@ -1295,7 +1295,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
Player *plr = objmgr.GetPlayer(charname.c_str());
- if(!plr)
+ if (!plr)
{
SendNotification(LANG_PLAYER_NOT_EXIST_OR_OFFLINE, charname.c_str());
return;
@@ -1304,7 +1304,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
uint32 accid = plr->GetSession()->GetAccountId();
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT username,email,last_ip FROM account WHERE id=%u", accid);
- if(!result)
+ if (!result)
{
SendNotification(LANG_ACCOUNT_FOR_PLAYER_NOT_FOUND, charname.c_str());
return;
@@ -1312,13 +1312,13 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
Field *fields = result->Fetch();
std::string acc = fields[0].GetCppString();
- if(acc.empty())
+ if (acc.empty())
acc = "Unknown";
std::string email = fields[1].GetCppString();
- if(email.empty())
+ if (email.empty())
email = "Unknown";
std::string lastip = fields[2].GetCppString();
- if(lastip.empty())
+ if (lastip.empty())
lastip = "Unknown";
std::string msg = charname + "'s " + "account is " + acc + ", e-mail: " + email + ", last ip: " + lastip;
@@ -1407,7 +1407,7 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data )
break;
case 1:
sLog.outDebug("Added FarSight " I64FMT " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow());
- if(WorldObject *target = _player->GetViewpoint())
+ if (WorldObject *target = _player->GetViewpoint())
_player->SetSeer(target);
else
sLog.outError("Player %s requests non-existing seer", _player->GetName());
@@ -1428,9 +1428,9 @@ void WorldSession::HandleSetTitleOpcode( WorldPacket & recv_data )
recv_data >> title;
// -1 at none
- if(title > 0 && title < MAX_TITLE_INDEX)
+ if (title > 0 && title < MAX_TITLE_INDEX)
{
- if(!GetPlayer()->HasTitle(title))
+ if (!GetPlayer()->HasTitle(title))
return;
}
else
@@ -1456,9 +1456,9 @@ void WorldSession::HandleResetInstancesOpcode( WorldPacket & /*recv_data*/ )
{
sLog.outDebug("WORLD: CMSG_RESET_INSTANCES");
Group *pGroup = _player->GetGroup();
- if(pGroup)
+ if (pGroup)
{
- if(pGroup->IsLeader(_player->GetGUID()))
+ if (pGroup->IsLeader(_player->GetGUID()))
{
pGroup->ResetInstances(INSTANCE_RESET_ALL, false, _player);
pGroup->ResetInstances(INSTANCE_RESET_ALL, true,_player);
@@ -1478,42 +1478,42 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data )
uint32 mode;
recv_data >> mode;
- if(mode >= MAX_DUNGEON_DIFFICULTY)
+ if (mode >= MAX_DUNGEON_DIFFICULTY)
{
sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
return;
}
- if(Difficulty(mode) == _player->GetDungeonDifficulty())
+ if (Difficulty(mode) == _player->GetDungeonDifficulty())
return;
// cannot reset while in an instance
Map *map = _player->GetMap();
- if(map && map->IsDungeon())
+ if (map && map->IsDungeon())
{
sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
return;
}
- if(_player->getLevel() < LEVELREQUIREMENT_HEROIC)
+ if (_player->getLevel() < LEVELREQUIREMENT_HEROIC)
return;
Group *pGroup = _player->GetGroup();
- if(pGroup)
+ if (pGroup)
{
- if(pGroup->IsLeader(_player->GetGUID()))
+ if (pGroup->IsLeader(_player->GetGUID()))
{
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupGuy = itr->getSource();
- if(!pGroupGuy)
+ if (!pGroupGuy)
continue;
- if(!pGroupGuy->IsInMap(pGroupGuy))
+ if (!pGroupGuy->IsInMap(pGroupGuy))
return;
map = pGroupGuy->GetMap();
- if(map && map->IsRaidOrHeroicDungeon() )
+ if (map && map->IsRaidOrHeroicDungeon() )
{
sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
return;
@@ -1539,7 +1539,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data )
uint32 mode;
recv_data >> mode;
- if(mode >= MAX_RAID_DIFFICULTY)
+ if (mode >= MAX_RAID_DIFFICULTY)
{
sLog.outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
return;
@@ -1547,34 +1547,34 @@ void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data )
// cannot reset while in an instance
Map *map = _player->GetMap();
- if(map && map->IsDungeon())
+ if (map && map->IsDungeon())
{
sLog.outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
return;
}
- if(Difficulty(mode) == _player->GetRaidDifficulty())
+ if (Difficulty(mode) == _player->GetRaidDifficulty())
return;
- if(_player->getLevel() < LEVELREQUIREMENT_HEROIC)
+ if (_player->getLevel() < LEVELREQUIREMENT_HEROIC)
return;
Group *pGroup = _player->GetGroup();
- if(pGroup)
+ if (pGroup)
{
- if(pGroup->IsLeader(_player->GetGUID()))
+ if (pGroup->IsLeader(_player->GetGUID()))
{
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupGuy = itr->getSource();
- if(!pGroupGuy)
+ if (!pGroupGuy)
continue;
- if(!pGroupGuy->IsInMap(pGroupGuy))
+ if (!pGroupGuy->IsInMap(pGroupGuy))
return;
map = pGroupGuy->GetMap();
- if(map && map->IsRaidOrHeroicDungeon() )
+ if (map && map->IsRaidOrHeroicDungeon() )
{
sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
return;
@@ -1604,7 +1604,7 @@ void WorldSession::HandleCancelMountAuraOpcode( WorldPacket & /*recv_data*/ )
return;
}
- if(_player->isInFlight()) // not blizz like; no any messages on blizz
+ if (_player->isInFlight()) // not blizz like; no any messages on blizz
{
ChatHandler(this).SendSysMessage(LANG_YOU_IN_FLIGHT);
return;
@@ -1621,7 +1621,7 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode( WorldPacket & recv_data )
//recv_data.hexlike();
uint64 guid; // guid - unused
- if(!recv_data.readPackGUID(guid))
+ if (!recv_data.readPackGUID(guid))
return;
recv_data.read_skip<uint32>(); // unk
@@ -1654,11 +1654,11 @@ void WorldSession::HandleSetTaxiBenchmarkOpcode( WorldPacket & recv_data )
void WorldSession::HandleQueryInspectAchievements( WorldPacket & recv_data )
{
uint64 guid;
- if(!recv_data.readPackGUID(guid))
+ if (!recv_data.readPackGUID(guid))
return;
Player *player = objmgr.GetPlayer(guid);
- if(!player)
+ if (!player)
return;
player->GetAchievementMgr().SendRespondInspectAchievements(_player);
diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp
index f1fd4e8468e..8c0f222c154 100644
--- a/src/game/MotionMaster.cpp
+++ b/src/game/MotionMaster.cpp
@@ -47,7 +47,7 @@ MotionMaster::Initialize()
{
MovementGenerator *curr = top();
pop();
- if(curr) DirectDelete(curr);
+ if (curr) DirectDelete(curr);
}
InitDefault();
@@ -56,7 +56,7 @@ MotionMaster::Initialize()
// set new default movement generator
void MotionMaster::InitDefault()
{
- if(i_owner->GetTypeId() == TYPEID_UNIT)
+ if (i_owner->GetTypeId() == TYPEID_UNIT)
{
MovementGenerator* movement = FactorySelector::selectMovementGenerator(i_owner->ToCreature());
Mutate(movement == NULL ? &si_idleMovement : movement, MOTION_SLOT_IDLE);
@@ -74,7 +74,7 @@ MotionMaster::~MotionMaster()
{
MovementGenerator *curr = top();
pop();
- if(curr) DirectDelete(curr);
+ if (curr) DirectDelete(curr);
}
}
@@ -122,7 +122,7 @@ MotionMaster::DirectClean(bool reset)
{
MovementGenerator *curr = top();
pop();
- if(curr) DirectDelete(curr);
+ if (curr) DirectDelete(curr);
}
if (needInitTop())
@@ -239,7 +239,7 @@ MotionMaster::MoveChase(Unit* target, float dist, float angle)
return;
i_owner->clearUnitState(UNIT_STAT_FOLLOW);
- if(i_owner->GetTypeId() == TYPEID_PLAYER)
+ if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) chase to %s (GUID: %u)",
i_owner->GetGUIDLow(),
@@ -265,7 +265,7 @@ MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slo
return;
i_owner->addUnitState(UNIT_STAT_FOLLOW);
- if(i_owner->GetTypeId() == TYPEID_PLAYER)
+ if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) follow to %s (GUID: %u)", i_owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
@@ -285,7 +285,7 @@ MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slo
void
MotionMaster::MovePoint(uint32 id, float x, float y, float z)
{
- if(i_owner->GetTypeId() == TYPEID_PLAYER)
+ if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), id, x, y, z );
Mutate(new PointMovementGenerator<Player>(id,x,y,z), MOTION_SLOT_ACTIVE);
@@ -301,7 +301,7 @@ MotionMaster::MovePoint(uint32 id, float x, float y, float z)
void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ)
{
//this function may make players fall below map
- if(i_owner->GetTypeId() == TYPEID_PLAYER)
+ if (i_owner->GetTypeId() == TYPEID_PLAYER)
return;
float x, y, z;
@@ -313,7 +313,7 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa
void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ)
{
//this function may make players fall below map
- if(i_owner->GetTypeId() == TYPEID_PLAYER)
+ if (i_owner->GetTypeId() == TYPEID_PLAYER)
return;
float x, y, z;
@@ -329,7 +329,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee
i_owner->addUnitState(UNIT_STAT_CHARGING | UNIT_STAT_JUMPING);
i_owner->m_TempSpeed = speedXY;
- if(i_owner->GetTypeId() == TYPEID_PLAYER)
+ if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) jump to point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z );
Mutate(new PointMovementGenerator<Player>(0,x,y,z), MOTION_SLOT_CONTROLLED);
@@ -347,12 +347,12 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee
void
MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id)
{
- if(Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE)
+ if (Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE)
return;
i_owner->addUnitState(UNIT_STAT_CHARGING);
i_owner->m_TempSpeed = speed;
- if(i_owner->GetTypeId() == TYPEID_PLAYER)
+ if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z );
Mutate(new PointMovementGenerator<Player>(id,x,y,z), MOTION_SLOT_CONTROLLED);
@@ -376,7 +376,7 @@ void MotionMaster::MoveFall(float z, uint32 id)
void
MotionMaster::MoveSeekAssistance(float x, float y, float z)
{
- if(i_owner->GetTypeId() == TYPEID_PLAYER)
+ if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
sLog.outError("Player (GUID: %u) attempt to seek assistance",i_owner->GetGUIDLow());
}
@@ -393,7 +393,7 @@ MotionMaster::MoveSeekAssistance(float x, float y, float z)
void
MotionMaster::MoveSeekAssistanceDistract(uint32 time)
{
- if(i_owner->GetTypeId() == TYPEID_PLAYER)
+ if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
sLog.outError("Player (GUID: %u) attempt to call distract after assistance",i_owner->GetGUIDLow());
}
@@ -408,13 +408,13 @@ MotionMaster::MoveSeekAssistanceDistract(uint32 time)
void
MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
{
- if(!enemy)
+ if (!enemy)
return;
- if(i_owner->HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
+ if (i_owner->HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
return;
- if(i_owner->GetTypeId() == TYPEID_PLAYER)
+ if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) flee from %s (GUID: %u)", i_owner->GetGUIDLow(),
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
@@ -438,7 +438,7 @@ MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
void
MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
{
- if(i_owner->GetTypeId() == TYPEID_PLAYER)
+ if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) taxi to (Path %u node %u)", i_owner->GetGUIDLow(), path, pathnode);
FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(path,pathnode);
@@ -454,10 +454,10 @@ MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
void
MotionMaster::MoveDistract(uint32 timer)
{
- if(Impl[MOTION_SLOT_CONTROLLED])
+ if (Impl[MOTION_SLOT_CONTROLLED])
return;
- if(i_owner->GetTypeId() == TYPEID_PLAYER)
+ if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) distracted (timer: %u)", i_owner->GetGUIDLow(), timer);
}
@@ -473,20 +473,20 @@ MotionMaster::MoveDistract(uint32 timer)
void MotionMaster::Mutate(MovementGenerator *m, MovementSlot slot)
{
- if(MovementGenerator *curr = Impl[slot])
+ if (MovementGenerator *curr = Impl[slot])
{
Impl[slot] = NULL; // in case a new one is generated in this slot during directdelete
- if(i_top == slot && (m_cleanFlag & MMCF_UPDATE))
+ if (i_top == slot && (m_cleanFlag & MMCF_UPDATE))
DelayedDelete(curr);
else
DirectDelete(curr);
}
- else if(i_top < slot)
+ else if (i_top < slot)
{
i_top = slot;
}
- if(i_top > slot)
+ if (i_top > slot)
needInit[slot] = true;
else
{
@@ -498,7 +498,7 @@ void MotionMaster::Mutate(MovementGenerator *m, MovementSlot slot)
void MotionMaster::MovePath(uint32 path_id, bool repeatable)
{
- if(!path_id)
+ if (!path_id)
return;
//We set waypoint movement as new default movement generator
// clear ALL movement generators (including default)
@@ -507,7 +507,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
MovementGenerator *curr = top();
curr->Finalize(*i_owner);
pop();
- if( !isStatic( curr ) )
+ if ( !isStatic( curr ) )
delete curr;
}*/
@@ -522,7 +522,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
void MotionMaster::MoveRotate(uint32 time, RotateDirection direction)
{
- if(!time)
+ if (!time)
return;
Mutate(new RotateMovementGenerator(time, direction), MOTION_SLOT_ACTIVE);
@@ -537,14 +537,14 @@ void MotionMaster::propagateSpeedChange()
}*/
for (int i = 0; i <= i_top; ++i)
{
- if(Impl[i])
+ if (Impl[i])
Impl[i]->unitSpeedChanged();
}
}
MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const
{
- if(empty())
+ if (empty())
return IDLE_MOTION_TYPE;
return top()->GetMovementGeneratorType();
@@ -552,7 +552,7 @@ MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const
MovementGeneratorType MotionMaster::GetMotionSlotType(int slot) const
{
- if(!Impl[slot])
+ if (!Impl[slot])
return NULL_MOTION_TYPE;
else
return Impl[slot]->GetMovementGeneratorType();
@@ -566,7 +566,7 @@ void MotionMaster::InitTop()
void MotionMaster::DirectDelete(_Ty curr)
{
- if(isStatic(curr))
+ if (isStatic(curr))
return;
curr->Finalize(*i_owner);
delete curr;
@@ -575,16 +575,16 @@ void MotionMaster::DirectDelete(_Ty curr)
void MotionMaster::DelayedDelete(_Ty curr)
{
sLog.outCrash("Unit (Entry %u) is trying to delete its updating MG (Type %u)!", i_owner->GetEntry(), curr->GetMovementGeneratorType());
- if(isStatic(curr))
+ if (isStatic(curr))
return;
- if(!m_expList)
+ if (!m_expList)
m_expList = new ExpireList();
m_expList->push_back(curr);
}
bool MotionMaster::GetDestination(float &x, float &y, float &z)
{
- if(empty())
+ if (empty())
return false;
return top()->GetDestination(x,y,z);
diff --git a/src/game/MotionMaster.h b/src/game/MotionMaster.h
index 9133da7d7b5..c4082ba086a 100644
--- a/src/game/MotionMaster.h
+++ b/src/game/MotionMaster.h
@@ -121,7 +121,7 @@ class MotionMaster //: private std::stack<MovementGenerator *>
{
if (m_cleanFlag & MMCF_UPDATE)
{
- if(reset)
+ if (reset)
m_cleanFlag |= MMCF_RESET;
else
m_cleanFlag &= ~MMCF_RESET;
@@ -134,7 +134,7 @@ class MotionMaster //: private std::stack<MovementGenerator *>
{
if (m_cleanFlag & MMCF_UPDATE)
{
- if(reset)
+ if (reset)
m_cleanFlag |= MMCF_RESET;
else
m_cleanFlag &= ~MMCF_RESET;
diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp
index 13dc0a39fa2..4e5ecd21885 100644
--- a/src/game/MovementHandler.cpp
+++ b/src/game/MovementHandler.cpp
@@ -43,14 +43,14 @@ void WorldSession::HandleMoveWorldportAckOpcode( WorldPacket & /*recv_data*/ )
void WorldSession::HandleMoveWorldportAckOpcode()
{
// ignore unexpected far teleports
- if(!GetPlayer()->IsBeingTeleportedFar())
+ if (!GetPlayer()->IsBeingTeleportedFar())
return;
// get the teleport destination
WorldLocation &loc = GetPlayer()->GetTeleportDest();
// possible errors in the coordinate validity check
- if(!MapManager::IsValidMapCoord(loc))
+ if (!MapManager::IsValidMapCoord(loc))
{
LogoutPlayer(false);
return;
@@ -61,14 +61,14 @@ void WorldSession::HandleMoveWorldportAckOpcode()
InstanceTemplate const* mInstance = objmgr.GetInstanceTemplate(loc.GetMapId());
// reset instance validity, except if going to an instance inside an instance
- if(GetPlayer()->m_InstanceValid == false && !mInstance)
+ if (GetPlayer()->m_InstanceValid == false && !mInstance)
GetPlayer()->m_InstanceValid = true;
GetPlayer()->SetSemaphoreTeleportFar(false);
Map * oldMap = GetPlayer()->GetMap();
assert(oldMap);
- if(GetPlayer()->IsInWorld())
+ if (GetPlayer()->IsInWorld())
{
sLog.outCrash("Player is still in world when teleported out of map %u! to new map %u", oldMap->GetId(), loc.GetMapId());
oldMap->Remove(GetPlayer(), false);
@@ -91,7 +91,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->SetMap(newMap);
GetPlayer()->SendInitialPacketsBeforeAddToMap();
- if(!GetPlayer()->GetMap()->Add(GetPlayer()))
+ if (!GetPlayer()->GetMap()->Add(GetPlayer()))
{
sLog.outError("WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.GetMapId());
GetPlayer()->ResetMap();
@@ -102,10 +102,10 @@ void WorldSession::HandleMoveWorldportAckOpcode()
// battleground state prepare (in case join to BG), at relogin/tele player not invited
// only add to bg group and object, if the player was invited (else he entered through command)
- if(_player->InBattleGround())
+ if (_player->InBattleGround())
{
// cleanup setting if outdated
- if(!mEntry->IsBattleGroundOrArena())
+ if (!mEntry->IsBattleGroundOrArena())
{
// We're not in BG
_player->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE);
@@ -113,9 +113,9 @@ void WorldSession::HandleMoveWorldportAckOpcode()
_player->SetBGTeam(0);
}
// join to bg case
- else if(BattleGround *bg = _player->GetBattleGround())
+ else if (BattleGround *bg = _player->GetBattleGround())
{
- if(_player->IsInvitedForBattleGroundInstance(_player->GetBattleGroundId()))
+ if (_player->IsInvitedForBattleGroundInstance(_player->GetBattleGroundId()))
bg->AddPlayer(_player);
}
}
@@ -123,9 +123,9 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->SendInitialPacketsAfterAddToMap();
// flight fast teleport case
- if(GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
+ if (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
{
- if(!_player->InBattleGround())
+ if (!_player->InBattleGround())
{
// short preparations to continue flight
FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
@@ -142,7 +142,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
Corpse *corpse = GetPlayer()->GetCorpse();
if (corpse && corpse->GetType() != CORPSE_BONES && corpse->GetMapId() == GetPlayer()->GetMapId())
{
- if( mEntry->IsDungeon() )
+ if ( mEntry->IsDungeon() )
{
GetPlayer()->ResurrectPlayer(0.5f,false);
GetPlayer()->SpawnCorpseBones();
@@ -153,7 +153,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
if (mInstance)
{
Difficulty diff = GetPlayer()->GetDifficulty(mEntry->IsRaid());
- if(MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->MapID,diff))
+ if (MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->MapID,diff))
{
if (mapDiff->resetTime)
{
@@ -177,7 +177,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->UpdateZone(newzone, newarea);
// honorless target
- if(GetPlayer()->pvpInfo.inHostileArea)
+ if (GetPlayer()->pvpInfo.inHostileArea)
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
// resummon pet
@@ -192,7 +192,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
sLog.outDebug("MSG_MOVE_TELEPORT_ACK");
uint64 guid;
- if(!recv_data.readPackGUID(guid))
+ if (!recv_data.readPackGUID(guid))
return;
uint32 flags, time;
@@ -203,10 +203,10 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
Unit *mover = _player->m_mover;
Player *plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL;
- if(!plMover || !plMover->IsBeingTeleportedNear())
+ if (!plMover || !plMover->IsBeingTeleportedNear())
return;
- if(guid != plMover->GetGUID())
+ if (guid != plMover->GetGUID())
return;
plMover->SetSemaphoreTeleportNear(false);
@@ -222,10 +222,10 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
plMover->UpdateZone(newzone, newarea);
// new zone
- if(old_zone != newzone)
+ if (old_zone != newzone)
{
// honorless target
- if(plMover->pvpInfo.inHostileArea)
+ if (plMover->pvpInfo.inHostileArea)
plMover->CastSpell(plMover, 2479, true);
}
@@ -258,7 +258,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
/* extract packet */
uint64 guid;
- if(!recv_data.readPackGUID(guid))
+ if (!recv_data.readPackGUID(guid))
return;
MovementInfo movementInfo;
@@ -266,7 +266,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
ReadMovementInfo(recv_data, &movementInfo);
/*----------------*/
- /* if(recv_data.size() != recv_data.rpos())
+ /* if (recv_data.size() != recv_data.rpos())
{
sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is " SIZEFMTD " bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), recv_data.GetOpcode(), recv_data.size() - recv_data.rpos());
KickPlayer();*/
@@ -399,10 +399,10 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
}
/*else // creature charmed
{
- if(mover->canFly())
+ if (mover->canFly())
{
bool flying = mover->IsFlying();
- if(flying != ((mover->GetByteValue(UNIT_FIELD_BYTES_1, 3) & 0x02) ? true : false))
+ if (flying != ((mover->GetByteValue(UNIT_FIELD_BYTES_1, 3) & 0x02) ? true : false))
mover->SetFlying(flying);
}
}*/
@@ -421,11 +421,11 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
uint32 unk1;
float newspeed;
- if(!recv_data.readPackGUID(guid))
+ if (!recv_data.readPackGUID(guid))
return;
// now can skip not our packet
- if(_player->GetGUID() != guid)
+ if (_player->GetGUID() != guid)
{
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
return;
@@ -467,16 +467,16 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
// skip all forced speed changes except last and unexpected
// in run/mounted case used one ACK and it must be skipped.m_forced_speed_changes[MOVE_RUN} store both.
- if(_player->m_forced_speed_changes[force_move_type] > 0)
+ if (_player->m_forced_speed_changes[force_move_type] > 0)
{
--_player->m_forced_speed_changes[force_move_type];
- if(_player->m_forced_speed_changes[force_move_type] > 0)
+ if (_player->m_forced_speed_changes[force_move_type] > 0)
return;
}
if (!_player->GetTransport() && fabs(_player->GetSpeed(move_type) - newspeed) > 0.01f)
{
- if(_player->GetSpeed(move_type) > newspeed) // must be greater - just correct
+ if (_player->GetSpeed(move_type) > newspeed) // must be greater - just correct
{
sLog.outError("%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value",
move_type_name[move_type], _player->GetName(), _player->GetSpeed(move_type), newspeed);
@@ -498,11 +498,11 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data)
uint64 guid;
recv_data >> guid;
- if(GetPlayer()->IsInWorld())
- if(Unit *mover = ObjectAccessor::GetUnit(*GetPlayer(), guid))
+ if (GetPlayer()->IsInWorld())
+ if (Unit *mover = ObjectAccessor::GetUnit(*GetPlayer(), guid))
{
GetPlayer()->SetMover(mover);
- if(mover != GetPlayer() && mover->canFly())
+ if (mover != GetPlayer() && mover->canFly())
{
WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12);
data.append(mover->GetPackGUID());
@@ -522,10 +522,10 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recv_data)
sLog.outDebug("WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER");
uint64 old_mover_guid;
- if(!recv_data.readPackGUID(old_mover_guid))
+ if (!recv_data.readPackGUID(old_mover_guid))
return;
- /*if(_player->m_mover->GetGUID() == old_mover_guid)
+ /*if (_player->m_mover->GetGUID() == old_mover_guid)
{
sLog.outError("HandleMoveNotActiveMover: incorrect mover guid: mover is " I64FMT " and should be " I64FMT " instead of " I64FMT, _player->m_mover->GetGUID(), _player->GetGUID(), old_mover_guid);
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
@@ -547,7 +547,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
uint64 vehicleGUID = _player->GetCharmGUID();
- if(!vehicleGUID) // something wrong here...
+ if (!vehicleGUID) // something wrong here...
{
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
return;
@@ -555,7 +555,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
uint64 guid;
- if(!recv_data.readPackGUID(guid))
+ if (!recv_data.readPackGUID(guid))
return;
MovementInfo mi;
@@ -575,7 +575,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
recv_data.hexlike();
Unit* vehicle_base = GetPlayer()->GetVehicleBase();
- if(!vehicle_base)
+ if (!vehicle_base)
return;
switch (recv_data.GetOpcode())
@@ -589,24 +589,24 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
case CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE:
{
uint64 guid; // current vehicle guid
- if(!recv_data.readPackGUID(guid) || vehicle_base->GetGUID() != guid)
+ if (!recv_data.readPackGUID(guid) || vehicle_base->GetGUID() != guid)
return;
ReadMovementInfo(recv_data, &vehicle_base->m_movementInfo);
uint64 accessory; // accessory guid
- if(!recv_data.readPackGUID(accessory))
+ if (!recv_data.readPackGUID(accessory))
return;
int8 seatId;
recv_data >> seatId;
- if(!accessory)
+ if (!accessory)
GetPlayer()->ChangeSeat(-1, seatId > 0); // prev/next
- else if(Unit *vehUnit = Unit::GetUnit(*GetPlayer(), accessory))
+ else if (Unit *vehUnit = Unit::GetUnit(*GetPlayer(), accessory))
{
- if(Vehicle *vehicle = vehUnit->GetVehicleKit())
- if(vehicle->HasEmptySeat(seatId))
+ if (Vehicle *vehicle = vehUnit->GetVehicleKit())
+ if (vehicle->HasEmptySeat(seatId))
GetPlayer()->EnterVehicle(vehicle, seatId);
}
}
@@ -614,7 +614,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
case CMSG_REQUEST_VEHICLE_SWITCH_SEAT:
{
uint64 guid; // current vehicle guid
- if(!recv_data.readPackGUID(guid) || vehicle_base->GetGUID() != guid)
+ if (!recv_data.readPackGUID(guid) || vehicle_base->GetGUID() != guid)
return;
int8 seatId;
@@ -634,13 +634,13 @@ void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data)
uint64 guid;
data >> guid;
- if(Player* pl=ObjectAccessor::FindPlayer(guid))
+ if (Player* pl=ObjectAccessor::FindPlayer(guid))
{
if (!pl->GetVehicleKit())
return;
if (!pl->IsInRaidWith(_player))
return;
- if(!pl->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
+ if (!pl->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
return;
_player->EnterVehicle(pl);
}
@@ -648,13 +648,13 @@ void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data)
void WorldSession::HandleEjectPasenger(WorldPacket &data)
{
- if(data.GetOpcode()==CMSG_EJECT_PASSENGER)
+ if (data.GetOpcode()==CMSG_EJECT_PASSENGER)
{
- if(Vehicle* Vv= _player->GetVehicleKit())
+ if (Vehicle* Vv= _player->GetVehicleKit())
{
uint64 guid;
data >> guid;
- if(Player* Pl=ObjectAccessor::FindPlayer(guid))
+ if (Player* Pl=ObjectAccessor::FindPlayer(guid))
Pl->ExitVehicle();
}
}
@@ -682,7 +682,7 @@ void WorldSession::HandleMoveKnockBackAck( WorldPacket & recv_data )
sLog.outDebug("CMSG_MOVE_KNOCK_BACK_ACK");
uint64 guid; // guid - unused
- if(!recv_data.readPackGUID(guid))
+ if (!recv_data.readPackGUID(guid))
return;
recv_data.read_skip<uint32>(); // unk
@@ -696,7 +696,7 @@ void WorldSession::HandleMoveHoverAck( WorldPacket& recv_data )
sLog.outDebug("CMSG_MOVE_HOVER_ACK");
uint64 guid; // guid - unused
- if(!recv_data.readPackGUID(guid))
+ if (!recv_data.readPackGUID(guid))
return;
recv_data.read_skip<uint32>(); // unk
@@ -712,7 +712,7 @@ void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recv_data)
sLog.outDebug("CMSG_MOVE_WATER_WALK_ACK");
uint64 guid; // guid - unused
- if(!recv_data.readPackGUID(guid))
+ if (!recv_data.readPackGUID(guid))
return;
recv_data.read_skip<uint32>(); // unk
@@ -725,7 +725,7 @@ void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recv_data)
void WorldSession::HandleSummonResponseOpcode(WorldPacket& recv_data)
{
- if(!_player->isAlive() || _player->isInCombat() )
+ if (!_player->isAlive() || _player->isInCombat() )
return;
uint64 summoner_guid;
diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp
index 085ab57f6a1..cc20f57e562 100644
--- a/src/game/NPCHandler.cpp
+++ b/src/game/NPCHandler.cpp
@@ -51,7 +51,7 @@ void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendTabardVendorActivate(guid);
@@ -80,7 +80,7 @@ void WorldSession::HandleBankerActivateOpcode( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendShowBank(guid);
@@ -119,11 +119,11 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// trainer list loaded at check;
- if(!unit->isCanTrainingOf(_player,true))
+ if (!unit->isCanTrainingOf(_player,true))
return;
CreatureInfo const *ci = unit->GetCreatureInfo();
@@ -135,7 +135,7 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle )
}
TrainerSpellData const* trainer_spells = unit->GetTrainerSpells();
- if(!trainer_spells)
+ if (!trainer_spells)
{
sLog.outDebug( "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)",
GUID_LOPART(guid), unit->GetEntry());
@@ -164,7 +164,7 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle )
{
if (!tSpell->learnedSpell[i])
continue;
- if(!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell[i]))
+ if (!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell[i]))
{
valid = false;
break;
@@ -243,31 +243,31 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
- if(!unit->isCanTrainingOf(_player,true))
+ if (!unit->isCanTrainingOf(_player,true))
return;
// check present spell in trainer spell list
TrainerSpellData const* trainer_spells = unit->GetTrainerSpells();
- if(!trainer_spells)
+ if (!trainer_spells)
return;
// not found, cheat?
TrainerSpell const* trainer_spell = trainer_spells->Find(spellId);
- if(!trainer_spell)
+ if (!trainer_spell)
return;
// can't be learn, cheat? Or double learn with lags...
- if(_player->GetTrainerSpellState(trainer_spell) != TRAINER_SPELL_GREEN)
+ if (_player->GetTrainerSpellState(trainer_spell) != TRAINER_SPELL_GREEN)
return;
// apply reputation discount
uint32 nSpellCost = uint32(floor(trainer_spell->spellCost * _player->GetReputationPriceDiscount(unit)));
// check money requirement
- if(_player->GetMoney() < nSpellCost )
+ if (_player->GetMoney() < nSpellCost )
return;
_player->ModifyMoney( -int32(nSpellCost) );
@@ -281,7 +281,7 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data )
SendPacket(&data);
// learn explicitly or cast explicitly
- if(trainer_spell->IsCastable())
+ if (trainer_spell->IsCastable())
//FIXME: prof. spell entry in trainer list not marked gray until list re-open.
_player->CastSpell(_player,trainer_spell->spell,true);
else
@@ -308,10 +308,10 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
GetPlayer()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK);
// remove fake death
- //if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ //if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
// GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
- if( unit->isArmorer() || unit->isCivilian() || unit->isQuestGiver() || unit->isServiceProvider())
+ if ( unit->isArmorer() || unit->isCivilian() || unit->isQuestGiver() || unit->isServiceProvider())
{
unit->StopMoving();
}
@@ -320,7 +320,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
if (unit->isSpiritGuide())
{
BattleGround *bg = _player->GetBattleGround();
- if(bg)
+ if (bg)
{
bg->AddPlayerToResurrectQueue(unit->GetGUID(), _player->GetGUID());
sBattleGroundMgr.SendAreaSpiritHealerQueryOpcode(_player, bg, unit->GetGUID());
@@ -328,7 +328,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
}
}
- if(!sScriptMgr.GossipHello(_player, unit))
+ if (!sScriptMgr.GossipHello(_player, unit))
{
_player->TalkedToCreature(unit->GetEntry(), unit->GetGUID());
_player->PrepareGossipMenu(unit, unit->GetCreatureInfo()->GossipMenuId);
@@ -347,7 +347,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
recv_data >> guid >> unk >> option;
- if(_player->PlayerTalkClass->GossipOptionCoded( option ))
+ if (_player->PlayerTalkClass->GossipOptionCoded( option ))
{
sLog.outDebug("reading string");
recv_data >> code;
@@ -362,10 +362,10 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
- if(!code.empty())
+ if (!code.empty())
{
if (!Script->GossipSelectWithCode(_player, unit, _player->PlayerTalkClass->GossipOptionSender (option), _player->PlayerTalkClass->GossipOptionAction( option ), code.c_str()))
unit->OnGossipSelect (_player, option);
@@ -393,7 +393,7 @@ void WorldSession::HandleSpiritHealerActivateOpcode( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendSpiritResurrect();
@@ -408,7 +408,7 @@ void WorldSession::SendSpiritResurrect()
// get corpse nearest graveyard
WorldSafeLocsEntry const *corpseGrave = NULL;
Corpse *corpse = _player->GetCorpse();
- if(corpse)
+ if (corpse)
corpseGrave = objmgr.GetClosestGraveYard(
corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetMapId(), _player->GetTeam() );
@@ -416,12 +416,12 @@ void WorldSession::SendSpiritResurrect()
_player->SpawnCorpseBones();
// teleport to nearest from corpse graveyard, if different from nearest to player ghost
- if(corpseGrave)
+ if (corpseGrave)
{
WorldSafeLocsEntry const *ghostGrave = objmgr.GetClosestGraveYard(
_player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), _player->GetMapId(), _player->GetTeam() );
- if(corpseGrave != ghostGrave)
+ if (corpseGrave != ghostGrave)
_player->TeleportTo(corpseGrave->map_id, corpseGrave->x, corpseGrave->y, corpseGrave->z, _player->GetOrientation());
// or update at original position
else
@@ -437,7 +437,7 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data )
uint64 npcGUID;
recv_data >> npcGUID;
- if(!GetPlayer()->IsInWorld() || !GetPlayer()->isAlive())
+ if (!GetPlayer()->IsInWorld() || !GetPlayer()->isAlive())
return;
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID,UNIT_NPC_FLAG_INNKEEPER);
@@ -448,7 +448,7 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendBindPoint(unit);
@@ -457,7 +457,7 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data )
void WorldSession::SendBindPoint(Creature *npc)
{
// prevent set homebind to instances in any case
- if(GetPlayer()->GetMap()->Instanceable())
+ if (GetPlayer()->GetMap()->Instanceable())
return;
uint32 bindspell = 3286;
@@ -518,11 +518,11 @@ void WorldSession::HandleListStabledPetsOpcode( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// remove mounts this fix bug where getting pet from stable while mounted deletes pet.
- if(GetPlayer()->IsMounted())
+ if (GetPlayer()->IsMounted())
GetPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED);
SendStablePet(npcGUID);
@@ -545,7 +545,7 @@ void WorldSession::SendStablePet(uint64 guid )
uint8 num = 0; // counter for place holder
// not let move dead pet in slot
- if(pet && pet->isAlive() && pet->getPetType()==HUNTER_PET)
+ if (pet && pet->isAlive() && pet->getPetType()==HUNTER_PET)
{
data << uint32(pet->GetCharmInfo()->GetPetNumber());
data << uint32(pet->GetEntry());
@@ -559,7 +559,7 @@ void WorldSession::SendStablePet(uint64 guid )
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT owner, id, entry, level, name FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot",
_player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
- if(result)
+ if (result)
{
do
{
@@ -586,7 +586,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
recv_data >> npcGUID;
- if(!GetPlayer()->isAlive())
+ if (!GetPlayer()->isAlive())
return;
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
@@ -597,13 +597,13 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Pet *pet = _player->GetPet();
// can't place in stable dead pet
- if(!pet||!pet->isAlive()||pet->getPetType()!=HUNTER_PET)
+ if (!pet||!pet->isAlive()||pet->getPetType()!=HUNTER_PET)
{
WorldPacket data(SMSG_STABLE_RESULT, 1);
data << uint8(0x06);
@@ -615,7 +615,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT owner,slot,id FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot ",
_player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
- if(result)
+ if (result)
{
do
{
@@ -624,7 +624,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
uint32 slot = fields[1].GetUInt32();
// slots ordered in query, and if not equal then free
- if(slot!=free_slot)
+ if (slot!=free_slot)
break;
// this slot not free, skip
@@ -633,7 +633,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
}
WorldPacket data(SMSG_STABLE_RESULT, 1);
- if( free_slot > 0 && free_slot <= GetPlayer()->m_stableSlots)
+ if ( free_slot > 0 && free_slot <= GetPlayer()->m_stableSlots)
{
_player->RemovePet(pet,PetSaveMode(free_slot));
data << uint8(0x08);
@@ -660,7 +660,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
uint32 creature_id = 0;
@@ -668,14 +668,14 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
{
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT entry FROM character_pet WHERE owner = '%u' AND id = '%u' AND slot >='%u' AND slot <= '%u'",
_player->GetGUIDLow(),petnumber,PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
- if(result)
+ if (result)
{
Field *fields = result->Fetch();
creature_id = fields[0].GetUInt32();
}
}
- if(!creature_id)
+ if (!creature_id)
{
WorldPacket data(SMSG_STABLE_RESULT, 1);
data << uint8(0x06);
@@ -684,7 +684,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
}
CreatureInfo const* creatureInfo = objmgr.GetCreatureTemplate(creature_id);
- if(!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
+ if (!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
{
WorldPacket data(SMSG_STABLE_RESULT, 1);
data << uint8(0x06);
@@ -693,7 +693,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
}
Pet* pet = _player->GetPet();
- if(pet && pet->isAlive())
+ if (pet && pet->isAlive())
{
WorldPacket data(SMSG_STABLE_RESULT, 1);
data << uint8(0x06);
@@ -702,11 +702,11 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
}
// delete dead pet
- if(pet)
+ if (pet)
_player->RemovePet(pet,PET_SAVE_AS_DELETED);
Pet *newpet = new Pet(_player, HUNTER_PET);
- if(!newpet->LoadPetFromDB(_player,creature_id,petnumber))
+ if (!newpet->LoadPetFromDB(_player,creature_id,petnumber))
{
delete newpet;
newpet = NULL;
@@ -736,15 +736,15 @@ void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
WorldPacket data(SMSG_STABLE_RESULT, 200);
- if(GetPlayer()->m_stableSlots < MAX_PET_STABLES)
+ if (GetPlayer()->m_stableSlots < MAX_PET_STABLES)
{
StableSlotPricesEntry const *SlotPrice = sStableSlotPricesStore.LookupEntry(GetPlayer()->m_stableSlots+1);
- if(_player->GetMoney() >= SlotPrice->Price)
+ if (_player->GetMoney() >= SlotPrice->Price)
{
++GetPlayer()->m_stableSlots;
_player->ModifyMoney(-int32(SlotPrice->Price));
@@ -780,20 +780,20 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
WorldPacket data(SMSG_STABLE_RESULT, 200); // guess size
Pet* pet = _player->GetPet();
- if(!pet || pet->getPetType()!=HUNTER_PET)
+ if (!pet || pet->getPetType()!=HUNTER_PET)
return;
// find swapped pet slot in stable
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT slot,entry FROM character_pet WHERE owner = '%u' AND id = '%u'",
_player->GetGUIDLow(),pet_number);
- if(!result)
+ if (!result)
return;
Field *fields = result->Fetch();
@@ -801,7 +801,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
uint32 slot = fields[0].GetUInt32();
uint32 creature_id = fields[1].GetUInt32();
- if(!creature_id)
+ if (!creature_id)
{
WorldPacket data(SMSG_STABLE_RESULT, 1);
data << uint8(0x06);
@@ -810,7 +810,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
}
CreatureInfo const* creatureInfo = objmgr.GetCreatureTemplate(creature_id);
- if(!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
+ if (!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
{
WorldPacket data(SMSG_STABLE_RESULT, 1);
data << uint8(0x06);
@@ -823,7 +823,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
// summon unstabled pet
Pet *newpet = new Pet(_player);
- if(!newpet->LoadPetFromDB(_player,creature_id,pet_number))
+ if (!newpet->LoadPetFromDB(_player,creature_id,pet_number))
{
delete newpet;
data << uint8(0x06);
@@ -851,7 +851,7 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// reputation discount
@@ -864,7 +864,7 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data )
Item* item = _player->GetItemByGuid(itemGUID);
- if(item)
+ if (item)
TotalCost= _player->DurabilityRepair(item->GetPos(),true,discountMod,guildBank>0?true:false);
}
else
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 2f279eed98d..5a1ff0315ab 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -84,9 +84,9 @@ Object::Object( ) : m_PackGUID(sizeof(uint64)+1)
WorldObject::~WorldObject()
{
// this may happen because there are many !create/delete
- if(m_isWorldObject && m_currMap)
+ if (m_isWorldObject && m_currMap)
{
- if(GetTypeId() == TYPEID_CORPSE)
+ if (GetTypeId() == TYPEID_CORPSE)
{
sLog.outCrash("Object::~Object Corpse guid="UI64FMTD", type=%d, entry=%u deleted but still in map!!", GetGUID(), ((Corpse*)this)->GetType(), GetEntry());
assert(false);
@@ -97,23 +97,23 @@ WorldObject::~WorldObject()
Object::~Object( )
{
- if(IsInWorld())
+ if (IsInWorld())
{
sLog.outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry());
- if(isType(TYPEMASK_ITEM))
+ if (isType(TYPEMASK_ITEM))
sLog.outCrash("Item slot %u", ((Item*)this)->GetSlot());
assert(false);
RemoveFromWorld();
}
- if(m_objectUpdated)
+ if (m_objectUpdated)
{
sLog.outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry());
assert(false);
ObjectAccessor::Instance().RemoveUpdateObject(this);
}
- if(m_uint32Values)
+ if (m_uint32Values)
{
//DEBUG_LOG("Object desctr 1 check (%p)",(void*)this);
delete [] m_uint32Values;
@@ -135,7 +135,7 @@ void Object::_InitValues()
void Object::_Create( uint32 guidlow, uint32 entry, HighGuid guidhigh )
{
- if(!m_uint32Values) _InitValues();
+ if (!m_uint32Values) _InitValues();
uint64 guid = MAKE_NEW_GUID(guidlow, entry, guidhigh);
SetUInt64Value( OBJECT_FIELD_GUID, guid );
@@ -171,28 +171,28 @@ void Object::BuildMovementUpdateBlock(UpdateData * data, uint32 flags ) const
void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
{
- if(!target)
+ if (!target)
return;
uint8 updatetype = UPDATETYPE_CREATE_OBJECT;
uint16 flags = m_updateFlag;
/** lower flag1 **/
- if(target == this) // building packet for yourself
+ if (target == this) // building packet for yourself
flags |= UPDATEFLAG_SELF;
- if(flags & UPDATEFLAG_HAS_POSITION)
+ if (flags & UPDATEFLAG_HAS_POSITION)
{
// UPDATETYPE_CREATE_OBJECT2 dynamic objects, corpses...
- if(isType(TYPEMASK_DYNAMICOBJECT) || isType(TYPEMASK_CORPSE) || isType(TYPEMASK_PLAYER))
+ if (isType(TYPEMASK_DYNAMICOBJECT) || isType(TYPEMASK_CORPSE) || isType(TYPEMASK_PLAYER))
updatetype = UPDATETYPE_CREATE_OBJECT2;
// UPDATETYPE_CREATE_OBJECT2 for pets...
- if(target->GetPetGUID() == GetGUID())
+ if (target->GetPetGUID() == GetGUID())
updatetype = UPDATETYPE_CREATE_OBJECT2;
// UPDATETYPE_CREATE_OBJECT2 for some gameobject types...
- if(isType(TYPEMASK_GAMEOBJECT))
+ if (isType(TYPEMASK_GAMEOBJECT))
{
switch(((GameObject*)this)->GetGoType())
{
@@ -210,9 +210,9 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c
}
}
- if(isType(TYPEMASK_UNIT))
+ if (isType(TYPEMASK_UNIT))
{
- if(((Unit*)this)->getVictim())
+ if (((Unit*)this)->getVictim())
flags |= UPDATEFLAG_HAS_TARGET;
}
}
@@ -295,7 +295,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
*data << ((Unit*)this)->GetSpeed( MOVE_PITCH_RATE );
// 0x08000000
- if(GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->isInFlight())
+ if (GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->isInFlight())
{
//WPAssert(this->ToPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE);
@@ -305,20 +305,20 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
*data << uint32(flags3); // splines flag?
- if(flags3 & 0x20000) // may be orientation
+ if (flags3 & 0x20000) // may be orientation
{
*data << (float)0;
}
else
{
- if(flags3 & 0x8000) // probably x,y,z coords there
+ if (flags3 & 0x8000) // probably x,y,z coords there
{
*data << (float)0;
*data << (float)0;
*data << (float)0;
}
- if(flags3 & 0x10000) // probably guid there
+ if (flags3 & 0x10000) // probably guid there
{
*data << uint64(0);
}
@@ -361,7 +361,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
}
else
{
- if(flags & UPDATEFLAG_POSITION)
+ if (flags & UPDATEFLAG_POSITION)
{
*data << uint8(0); // unk PGUID!
*data << ((WorldObject*)this)->GetPositionX();
@@ -372,7 +372,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
*data << ((WorldObject*)this)->GetPositionZ();
*data << ((WorldObject*)this)->GetOrientation();
- if(GetTypeId() == TYPEID_CORPSE)
+ if (GetTypeId() == TYPEID_CORPSE)
*data << float(((WorldObject*)this)->GetOrientation());
else
*data << float(0);
@@ -383,7 +383,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
if (flags & UPDATEFLAG_HAS_POSITION)
{
// 0x02
- if(flags & UPDATEFLAG_TRANSPORT && ((GameObject*)this)->GetGoType() == GAMEOBJECT_TYPE_MO_TRANSPORT)
+ if (flags & UPDATEFLAG_TRANSPORT && ((GameObject*)this)->GetGoType() == GAMEOBJECT_TYPE_MO_TRANSPORT)
{
*data << (float)0;
*data << (float)0;
@@ -402,7 +402,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
}
// 0x8
- if(flags & UPDATEFLAG_LOWGUID)
+ if (flags & UPDATEFLAG_LOWGUID)
{
switch(GetTypeId())
{
@@ -416,14 +416,14 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
break;
case TYPEID_UNIT:
{
- if(this->ToCreature()->canFly())
+ if (this->ToCreature()->canFly())
flags |= MOVEMENTFLAG_LEVITATING;
*data << uint32(0x0000000B); // unk, can be 0xB or 0xC
break;
}
case TYPEID_PLAYER:
- if(flags & UPDATEFLAG_SELF)
+ if (flags & UPDATEFLAG_SELF)
*data << uint32(0x0000002F); // unk, can be 0x15 or 0x22
else
*data << uint32(0x00000008); // unk, can be 0x7 or 0x8
@@ -435,36 +435,36 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
}
// 0x10
- if(flags & UPDATEFLAG_HIGHGUID)
+ if (flags & UPDATEFLAG_HIGHGUID)
{
// not high guid
*data << uint32(0x00000000); // unk
}
// 0x4
- if(flags & UPDATEFLAG_HAS_TARGET) // packed guid (current target guid)
+ if (flags & UPDATEFLAG_HAS_TARGET) // packed guid (current target guid)
{
- if(Unit *victim = ((Unit*)this)->getVictim())
+ if (Unit *victim = ((Unit*)this)->getVictim())
data->append(victim->GetPackGUID());
else
*data << uint8(0);
}
// 0x2
- if(flags & UPDATEFLAG_TRANSPORT)
+ if (flags & UPDATEFLAG_TRANSPORT)
{
*data << uint32(getMSTime()); // ms time
}
// 0x80
- if(flags & UPDATEFLAG_VEHICLE) // unused for now
+ if (flags & UPDATEFLAG_VEHICLE) // unused for now
{
*data << uint32(((Unit*)this)->GetVehicleKit()->GetVehicleInfo()->m_ID); // vehicle id
*data << float(0); // facing adjustment
}
// 0x200
- if(flags & UPDATEFLAG_ROTATION)
+ if (flags & UPDATEFLAG_ROTATION)
{
*data << uint64(((GameObject*)this)->GetRotation());
}
@@ -472,7 +472,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *updateMask, Player *target) const
{
- if(!target)
+ if (!target)
return;
bool IsActivateToQuest = false;
@@ -490,7 +490,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
}
else if (isType(TYPEMASK_UNIT))
{
- if( ((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK))
+ if ( ((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK))
{
updateMask->SetBit(UNIT_FIELD_AURASTATE);
}
@@ -509,7 +509,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
}
else if (isType(TYPEMASK_UNIT))
{
- if( ((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK))
+ if ( ((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK))
{
updateMask->SetBit(UNIT_FIELD_AURASTATE);
}
@@ -522,11 +522,11 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
data->append( updateMask->GetMask(), updateMask->GetLength() );
// 2 specialized loops for speed optimization in non-unit case
- if(isType(TYPEMASK_UNIT)) // unit (creature/player) case
+ if (isType(TYPEMASK_UNIT)) // unit (creature/player) case
{
for (uint16 index = 0; index < m_valuesCount; ++index )
{
- if( updateMask->GetBit( index ) )
+ if ( updateMask->GetBit( index ) )
{
if (index == UNIT_NPC_FLAGS)
{
@@ -567,31 +567,31 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
*data << uint32(m_floatValues[ index ]);
}
// Gamemasters should be always able to select units - remove not selectable flag
- else if(index == UNIT_FIELD_FLAGS)
+ else if (index == UNIT_FIELD_FLAGS)
{
- if(target->isGameMaster())
+ if (target->isGameMaster())
*data << (m_uint32Values[ index ] & ~UNIT_FLAG_NOT_SELECTABLE);
else
*data << m_uint32Values[ index ];
}
// use modelid_a if not gm, _h if gm for CREATURE_FLAG_EXTRA_TRIGGER creatures
- else if(index == UNIT_FIELD_DISPLAYID)
+ else if (index == UNIT_FIELD_DISPLAYID)
{
- if(GetTypeId() == TYPEID_UNIT)
+ if (GetTypeId() == TYPEID_UNIT)
{
const CreatureInfo* cinfo = this->ToCreature()->GetCreatureInfo();
- if(cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
+ if (cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
{
- if(target->isGameMaster())
+ if (target->isGameMaster())
{
- if(cinfo->Modelid1)
+ if (cinfo->Modelid1)
*data << cinfo->Modelid1;
else
*data << 17519; // world invisible trigger's model
}
else
{
- if(cinfo->Modelid3)
+ if (cinfo->Modelid3)
*data << cinfo->Modelid3;
else
*data << 11686; // world invisible trigger's model
@@ -635,16 +635,16 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
*data << dynamicFlags;
}
// FG: pretend that OTHER players in own group are friendly ("blue")
- else if(index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE)
+ else if (index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE)
{
- if(((Unit*)this)->IsControlledByPlayer() && target != this && sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && ((Unit*)this)->IsInRaidWith(target))
+ if (((Unit*)this)->IsControlledByPlayer() && target != this && sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && ((Unit*)this)->IsInRaidWith(target))
{
FactionTemplateEntry const *ft1, *ft2;
ft1 = ((Unit*)this)->getFactionTemplateEntry();
ft2 = target->getFactionTemplateEntry();
- if(ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
+ if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
{
- if(index == UNIT_FIELD_BYTES_2)
+ if (index == UNIT_FIELD_BYTES_2)
{
// Allow targetting opposite faction in party when enabled in config
*data << ( m_uint32Values[ index ] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8) ); // this flag is at uint8 offset 1 !!
@@ -670,16 +670,16 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
}
}
}
- else if(isType(TYPEMASK_GAMEOBJECT)) // gameobject case
+ else if (isType(TYPEMASK_GAMEOBJECT)) // gameobject case
{
for (uint16 index = 0; index < m_valuesCount; ++index )
{
- if( updateMask->GetBit( index ) )
+ if ( updateMask->GetBit( index ) )
{
// send in current format (float as float, uint32 as uint32)
if (index == GAMEOBJECT_DYNAMIC )
{
- if(IsActivateToQuest )
+ if (IsActivateToQuest )
{
switch(((GameObject*)this)->GetGoType())
{
@@ -715,7 +715,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
{
for (uint16 index = 0; index < m_valuesCount; ++index )
{
- if( updateMask->GetBit( index ) )
+ if ( updateMask->GetBit( index ) )
{
// send in current format (float as float, uint32 as uint32)
*data << m_uint32Values[ index ];
@@ -728,9 +728,9 @@ void Object::ClearUpdateMask(bool remove)
{
memcpy(m_uint32Values_mirror, m_uint32Values, m_valuesCount*sizeof(uint32));
- if(m_objectUpdated)
+ if (m_objectUpdated)
{
- if(remove)
+ if (remove)
ObjectAccessor::Instance().RemoveUpdateObject(this);
m_objectUpdated = false;
}
@@ -740,7 +740,7 @@ void Object::BuildFieldsUpdate(Player *pl, UpdateDataMapType &data_map) const
{
UpdateDataMapType::iterator iter = data_map.find(pl);
- if( iter == data_map.end() )
+ if ( iter == data_map.end() )
{
std::pair<UpdateDataMapType::iterator, bool> p = data_map.insert( UpdateDataMapType::value_type(pl, UpdateData()) );
assert(p.second);
@@ -752,11 +752,11 @@ void Object::BuildFieldsUpdate(Player *pl, UpdateDataMapType &data_map) const
bool Object::LoadValues(const char* data)
{
- if(!m_uint32Values) _InitValues();
+ if (!m_uint32Values) _InitValues();
Tokens tokens = StrSplit(data, " ");
- if(tokens.size() != m_valuesCount)
+ if (tokens.size() != m_valuesCount)
return false;
Tokens::iterator iter;
@@ -776,7 +776,7 @@ void Object::_SetUpdateBits(UpdateMask *updateMask, Player* /*target*/) const
for (uint16 index = 0; index < m_valuesCount; ++index, ++value, ++mirror)
{
- if(*mirror != *value)
+ if (*mirror != *value)
updateMask->SetBit(index);
}
}
@@ -787,7 +787,7 @@ void Object::_SetCreateBits(UpdateMask *updateMask, Player* /*target*/) const
for (uint16 index = 0; index < m_valuesCount; ++index, ++value)
{
- if(*value)
+ if (*value)
updateMask->SetBit(index);
}
}
@@ -796,13 +796,13 @@ void Object::SetInt32Value( uint16 index, int32 value )
{
ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
- if(m_int32Values[ index ] != value)
+ if (m_int32Values[ index ] != value)
{
m_int32Values[ index ] = value;
- if(m_inWorld)
+ if (m_inWorld)
{
- if(!m_objectUpdated)
+ if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
m_objectUpdated = true;
@@ -815,13 +815,13 @@ void Object::SetUInt32Value( uint16 index, uint32 value )
{
ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
- if(m_uint32Values[ index ] != value)
+ if (m_uint32Values[ index ] != value)
{
m_uint32Values[ index ] = value;
- if(m_inWorld)
+ if (m_inWorld)
{
- if(!m_objectUpdated)
+ if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
m_objectUpdated = true;
@@ -840,14 +840,14 @@ void Object::UpdateUInt32Value( uint16 index, uint32 value )
void Object::SetUInt64Value( uint16 index, const uint64 &value )
{
ASSERT( index + 1 < m_valuesCount || PrintIndexError( index, true ) );
- if(*((uint64*)&(m_uint32Values[ index ])) != value)
+ if (*((uint64*)&(m_uint32Values[ index ])) != value)
{
m_uint32Values[ index ] = *((uint32*)&value);
m_uint32Values[ index + 1 ] = *(((uint32*)&value) + 1);
- if(m_inWorld)
+ if (m_inWorld)
{
- if(!m_objectUpdated)
+ if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
m_objectUpdated = true;
@@ -859,14 +859,14 @@ void Object::SetUInt64Value( uint16 index, const uint64 &value )
bool Object::AddUInt64Value(uint16 index, const uint64 &value)
{
ASSERT( index + 1 < m_valuesCount || PrintIndexError( index , true ) );
- if(value && !*((uint64*)&(m_uint32Values[index])))
+ if (value && !*((uint64*)&(m_uint32Values[index])))
{
m_uint32Values[ index ] = *((uint32*)&value);
m_uint32Values[ index + 1 ] = *(((uint32*)&value) + 1);
- if(m_inWorld)
+ if (m_inWorld)
{
- if(!m_objectUpdated)
+ if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
m_objectUpdated = true;
@@ -880,14 +880,14 @@ bool Object::AddUInt64Value(uint16 index, const uint64 &value)
bool Object::RemoveUInt64Value(uint16 index, const uint64 &value)
{
ASSERT( index + 1 < m_valuesCount || PrintIndexError( index , true ) );
- if(value && *((uint64*)&(m_uint32Values[index])) == value)
+ if (value && *((uint64*)&(m_uint32Values[index])) == value)
{
m_uint32Values[ index ] = 0;
m_uint32Values[ index + 1 ] = 0;
- if(m_inWorld)
+ if (m_inWorld)
{
- if(!m_objectUpdated)
+ if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
m_objectUpdated = true;
@@ -902,13 +902,13 @@ void Object::SetFloatValue( uint16 index, float value )
{
ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
- if(m_floatValues[ index ] != value)
+ if (m_floatValues[ index ] != value)
{
m_floatValues[ index ] = value;
- if(m_inWorld)
+ if (m_inWorld)
{
- if(!m_objectUpdated)
+ if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
m_objectUpdated = true;
@@ -921,20 +921,20 @@ void Object::SetByteValue( uint16 index, uint8 offset, uint8 value )
{
ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
- if(offset > 4)
+ if (offset > 4)
{
sLog.outError("Object::SetByteValue: wrong offset %u", offset);
return;
}
- if(uint8(m_uint32Values[ index ] >> (offset * 8)) != value)
+ if (uint8(m_uint32Values[ index ] >> (offset * 8)) != value)
{
m_uint32Values[ index ] &= ~uint32(uint32(0xFF) << (offset * 8));
m_uint32Values[ index ] |= uint32(uint32(value) << (offset * 8));
- if(m_inWorld)
+ if (m_inWorld)
{
- if(!m_objectUpdated)
+ if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
m_objectUpdated = true;
@@ -947,20 +947,20 @@ void Object::SetUInt16Value( uint16 index, uint8 offset, uint16 value )
{
ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
- if(offset > 2)
+ if (offset > 2)
{
sLog.outError("Object::SetUInt16Value: wrong offset %u", offset);
return;
}
- if(uint16(m_uint32Values[ index ] >> (offset * 16)) != value)
+ if (uint16(m_uint32Values[ index ] >> (offset * 16)) != value)
{
m_uint32Values[ index ] &= ~uint32(uint32(0xFFFF) << (offset * 16));
m_uint32Values[ index ] |= uint32(uint32(value) << (offset * 16));
- if(m_inWorld)
+ if (m_inWorld)
{
- if(!m_objectUpdated)
+ if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
m_objectUpdated = true;
@@ -971,7 +971,7 @@ void Object::SetUInt16Value( uint16 index, uint8 offset, uint16 value )
void Object::SetStatFloatValue( uint16 index, float value)
{
- if(value < 0)
+ if (value < 0)
value = 0.0f;
SetFloatValue(index, value);
@@ -979,7 +979,7 @@ void Object::SetStatFloatValue( uint16 index, float value)
void Object::SetStatInt32Value( uint16 index, int32 value)
{
- if(value < 0)
+ if (value < 0)
value = 0;
SetUInt32Value(index, uint32(value));
@@ -989,7 +989,7 @@ void Object::ApplyModUInt32Value(uint16 index, int32 val, bool apply)
{
int32 cur = GetUInt32Value(index);
cur += (apply ? val : -val);
- if(cur < 0)
+ if (cur < 0)
cur = 0;
SetUInt32Value(index, cur);
}
@@ -1012,7 +1012,7 @@ void Object::ApplyModPositiveFloatValue(uint16 index, float val, bool apply)
{
float cur = GetFloatValue(index);
cur += (apply ? val : -val);
- if(cur < 0)
+ if (cur < 0)
cur = 0;
SetFloatValue(index, cur);
}
@@ -1023,13 +1023,13 @@ void Object::SetFlag( uint16 index, uint32 newFlag )
uint32 oldval = m_uint32Values[ index ];
uint32 newval = oldval | newFlag;
- if(oldval != newval)
+ if (oldval != newval)
{
m_uint32Values[ index ] = newval;
- if(m_inWorld)
+ if (m_inWorld)
{
- if(!m_objectUpdated)
+ if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
m_objectUpdated = true;
@@ -1044,13 +1044,13 @@ void Object::RemoveFlag( uint16 index, uint32 oldFlag )
uint32 oldval = m_uint32Values[ index ];
uint32 newval = oldval & ~oldFlag;
- if(oldval != newval)
+ if (oldval != newval)
{
m_uint32Values[ index ] = newval;
- if(m_inWorld)
+ if (m_inWorld)
{
- if(!m_objectUpdated)
+ if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
m_objectUpdated = true;
@@ -1063,19 +1063,19 @@ void Object::SetByteFlag( uint16 index, uint8 offset, uint8 newFlag )
{
ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
- if(offset > 4)
+ if (offset > 4)
{
sLog.outError("Object::SetByteFlag: wrong offset %u", offset);
return;
}
- if(!(uint8(m_uint32Values[ index ] >> (offset * 8)) & newFlag))
+ if (!(uint8(m_uint32Values[ index ] >> (offset * 8)) & newFlag))
{
m_uint32Values[ index ] |= uint32(uint32(newFlag) << (offset * 8));
- if(m_inWorld)
+ if (m_inWorld)
{
- if(!m_objectUpdated)
+ if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
m_objectUpdated = true;
@@ -1088,19 +1088,19 @@ void Object::RemoveByteFlag( uint16 index, uint8 offset, uint8 oldFlag )
{
ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
- if(offset > 4)
+ if (offset > 4)
{
sLog.outError("Object::RemoveByteFlag: wrong offset %u", offset);
return;
}
- if(uint8(m_uint32Values[ index ] >> (offset * 8)) & oldFlag)
+ if (uint8(m_uint32Values[ index ] >> (offset * 8)) & oldFlag)
{
m_uint32Values[ index ] &= ~uint32(uint32(oldFlag) << (offset * 8));
- if(m_inWorld)
+ if (m_inWorld)
{
- if(!m_objectUpdated)
+ if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
m_objectUpdated = true;
@@ -1137,7 +1137,7 @@ WorldObject::WorldObject()
void WorldObject::SetWorldObject(bool on)
{
- if(!IsInWorld())
+ if (!IsInWorld())
return;
GetMap()->AddObjectToSwitchList(this, on);
@@ -1145,33 +1145,33 @@ void WorldObject::SetWorldObject(bool on)
void WorldObject::setActive( bool on )
{
- if(m_isActive == on)
+ if (m_isActive == on)
return;
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
return;
m_isActive = on;
- if(!IsInWorld())
+ if (!IsInWorld())
return;
Map *map = FindMap();
- if(!map)
+ if (!map)
return;
- if(on)
+ if (on)
{
- if(GetTypeId() == TYPEID_UNIT)
+ if (GetTypeId() == TYPEID_UNIT)
map->AddToActive(this->ToCreature());
- else if(GetTypeId() == TYPEID_DYNAMICOBJECT)
+ else if (GetTypeId() == TYPEID_DYNAMICOBJECT)
map->AddToActive((DynamicObject*)this);
}
else
{
- if(GetTypeId() == TYPEID_UNIT)
+ if (GetTypeId() == TYPEID_UNIT)
map->RemoveFromActive(this->ToCreature());
- else if(GetTypeId() == TYPEID_DYNAMICOBJECT)
+ else if (GetTypeId() == TYPEID_DYNAMICOBJECT)
map->RemoveFromActive((DynamicObject*)this);
}
}
@@ -1220,7 +1220,7 @@ bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool
float dx = GetPositionX() - obj->GetPositionX();
float dy = GetPositionY() - obj->GetPositionY();
float distsq = dx*dx + dy*dy;
- if(is3D)
+ if (is3D)
{
float dz = GetPositionZ() - obj->GetPositionZ();
distsq += dz*dz;
@@ -1252,7 +1252,7 @@ bool WorldObject::GetDistanceOrder(WorldObject const* obj1, WorldObject const* o
float dx1 = GetPositionX() - obj1->GetPositionX();
float dy1 = GetPositionY() - obj1->GetPositionY();
float distsq1 = dx1*dx1 + dy1*dy1;
- if(is3D)
+ if (is3D)
{
float dz1 = GetPositionZ() - obj1->GetPositionZ();
distsq1 += dz1*dz1;
@@ -1261,7 +1261,7 @@ bool WorldObject::GetDistanceOrder(WorldObject const* obj1, WorldObject const* o
float dx2 = GetPositionX() - obj2->GetPositionX();
float dy2 = GetPositionY() - obj2->GetPositionY();
float distsq2 = dx2*dx2 + dy2*dy2;
- if(is3D)
+ if (is3D)
{
float dz2 = GetPositionZ() - obj2->GetPositionZ();
distsq2 += dz2*dz2;
@@ -1275,7 +1275,7 @@ bool WorldObject::IsInRange(WorldObject const* obj, float minRange, float maxRan
float dx = GetPositionX() - obj->GetPositionX();
float dy = GetPositionY() - obj->GetPositionY();
float distsq = dx*dx + dy*dy;
- if(is3D)
+ if (is3D)
{
float dz = GetPositionZ() - obj->GetPositionZ();
distsq += dz*dz;
@@ -1284,10 +1284,10 @@ bool WorldObject::IsInRange(WorldObject const* obj, float minRange, float maxRan
float sizefactor = GetObjectSize() + obj->GetObjectSize();
// check only for real range
- if(minRange > 0.0f)
+ if (minRange > 0.0f)
{
float mindist = minRange + sizefactor;
- if(distsq < mindist * mindist)
+ if (distsq < mindist * mindist)
return false;
}
@@ -1304,10 +1304,10 @@ bool WorldObject::IsInRange2d(float x, float y, float minRange, float maxRange)
float sizefactor = GetObjectSize();
// check only for real range
- if(minRange > 0.0f)
+ if (minRange > 0.0f)
{
float mindist = minRange + sizefactor;
- if(distsq < mindist * mindist)
+ if (distsq < mindist * mindist)
return false;
}
@@ -1325,10 +1325,10 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m
float sizefactor = GetObjectSize();
// check only for real range
- if(minRange > 0.0f)
+ if (minRange > 0.0f)
{
float mindist = minRange + sizefactor;
- if(distsq < mindist * mindist)
+ if (distsq < mindist * mindist)
return false;
}
@@ -1338,7 +1338,7 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m
float Position::GetAngle(const Position *obj) const
{
- if(!obj) return 0;
+ if (!obj) return 0;
return GetAngle( obj->GetPositionX(), obj->GetPositionY() );
}
@@ -1358,7 +1358,7 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos)
float dx = GetPositionX() - x;
float dy = GetPositionY() - y;
- if(dx < 0.001f && dy < 0.001f)
+ if (dx < 0.001f && dy < 0.001f)
{
float angle = rand_norm()*2*M_PI;
vcos = cos(angle);
@@ -1375,7 +1375,7 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos)
bool Position::HasInArc(float arc, const Position *obj) const
{
// always have self in arc
- if(obj == this)
+ if (obj == this)
return true;
// move arc to range 0.. 2*pi
@@ -1387,7 +1387,7 @@ bool Position::HasInArc(float arc, const Position *obj) const
float angle = GetAngle( obj );
angle -= m_orientation;
- //if(angle > 100 || angle < -100)
+ //if (angle > 100 || angle < -100)
//{
// sLog.outCrash("Invalid Angle %f: this %u %u %f %f %f %f, that %u %u %f %f %f %f", angle,
// GetEntry(), GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation(),
@@ -1409,13 +1409,13 @@ bool Position::HasInArc(float arc, const Position *obj) const
bool WorldObject::IsInBetween(const WorldObject *obj1, const WorldObject *obj2, float size) const
{
- if(GetPositionX() > std::max(obj1->GetPositionX(), obj2->GetPositionX())
+ if (GetPositionX() > std::max(obj1->GetPositionX(), obj2->GetPositionX())
|| GetPositionX() < std::min(obj1->GetPositionX(), obj2->GetPositionX())
|| GetPositionY() > std::max(obj1->GetPositionY(), obj2->GetPositionY())
|| GetPositionY() < std::min(obj1->GetPositionY(), obj2->GetPositionY()))
return false;
- if(!size)
+ if (!size)
size = GetObjectSize() / 2;
float angle = obj1->GetAngle(this) - obj1->GetAngle(obj2);
@@ -1434,7 +1434,7 @@ bool WorldObject::isInBack(WorldObject const* target, float distance, float arc)
void WorldObject::GetRandomPoint(const Position &pos, float distance, float &rand_x, float &rand_y, float &rand_z) const
{
- if(!distance)
+ if (!distance)
{
pos.GetPosition(rand_x, rand_y, rand_z);
return;
@@ -1456,7 +1456,7 @@ void WorldObject::GetRandomPoint(const Position &pos, float distance, float &ran
void WorldObject::UpdateGroundPositionZ(float x, float y, float &z) const
{
float new_z = GetBaseMap()->GetHeight(x,y,z,true);
- if(new_z > INVALID_HEIGHT)
+ if (new_z > INVALID_HEIGHT)
z = new_z+ 0.05f; // just to be sure that we are not a few pixel under the surface
}
@@ -1489,7 +1489,7 @@ void WorldObject::MonsterTextEmote(const char* text, uint64 TargetGuid, bool IsB
void WorldObject::MonsterWhisper(const char* text, uint64 receiver, bool IsBossWhisper)
{
Player *player = objmgr.GetPlayer(receiver);
- if(!player || !player->GetSession())
+ if (!player || !player->GetSession())
return;
WorldPacket data(SMSG_MESSAGECHAT, 200);
@@ -1511,9 +1511,9 @@ void WorldObject::SendPlaySound(uint32 Sound, bool OnlySelf)
void Object::ForceValuesUpdateAtIndex(uint32 i)
{
m_uint32Values_mirror[i] = GetUInt32Value(i) + 1; // makes server think the field changed
- if(m_inWorld)
+ if (m_inWorld)
{
- if(!m_objectUpdated)
+ if (!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
m_objectUpdated = true;
@@ -1584,7 +1584,7 @@ void WorldObject::MonsterYellToZone(int32 textId, uint32 language, uint64 Target
Map::PlayerList const& pList = GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
- if(itr->getSource()->GetZoneId()==zoneid)
+ if (itr->getSource()->GetZoneId()==zoneid)
say_do(itr->getSource());
}
@@ -1606,7 +1606,7 @@ void WorldObject::MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossE
void WorldObject::MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper)
{
Player *player = objmgr.GetPlayer(receiver);
- if(!player || !player->GetSession())
+ if (!player || !player->GetSession())
return;
uint32 loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
@@ -1627,7 +1627,7 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const*
*data << (uint32)(strlen(name)+1);
*data << name;
*data << (uint64)targetGuid; // Unit Target
- if( targetGuid && !IS_PLAYER_GUID(targetGuid) )
+ if ( targetGuid && !IS_PLAYER_GUID(targetGuid) )
{
*data << (uint32)1; // target name length
*data << (uint8)0; // target name
@@ -1673,9 +1673,9 @@ void WorldObject::SetMap(Map * map)
{
ASSERT(map);
ASSERT(!IsInWorld() || GetTypeId() == TYPEID_CORPSE);
- if(m_currMap == map) // command add npc: first create, than loadfromdb
+ if (m_currMap == map) // command add npc: first create, than loadfromdb
return;
- if(m_currMap)
+ if (m_currMap)
{
sLog.outCrash("WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId());
assert(false);
@@ -1683,7 +1683,7 @@ void WorldObject::SetMap(Map * map)
m_currMap = map;
m_mapId = map->GetId();
m_InstanceId = map->GetInstanceId();
- if(m_isWorldObject)
+ if (m_isWorldObject)
m_currMap->AddWorldObject(this);
}
@@ -1691,7 +1691,7 @@ void WorldObject::ResetMap()
{
ASSERT(m_currMap);
ASSERT(!IsInWorld());
- if(m_isWorldObject)
+ if (m_isWorldObject)
m_currMap->RemoveWorldObject(this);
m_currMap = NULL;
//maybe not for corpse
@@ -1710,7 +1710,7 @@ void WorldObject::AddObjectToRemoveList()
assert(m_uint32Values);
Map* map = FindMap();
- if(!map)
+ if (!map)
{
sLog.outError("Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).",GetTypeId(),GetEntry(),GetGUIDLow(),GetMapId());
return;
@@ -1722,7 +1722,7 @@ void WorldObject::AddObjectToRemoveList()
TempSummon *Map::SummonCreature(uint32 entry, const Position &pos, SummonPropertiesEntry const *properties, uint32 duration, Unit *summoner, uint32 vehId)
{
uint32 mask = UNIT_MASK_SUMMON;
- if(properties)
+ if (properties)
{
switch(properties->Category)
{
@@ -1744,7 +1744,7 @@ TempSummon *Map::SummonCreature(uint32 entry, const Position &pos, SummonPropert
case SUMMON_TYPE_MINIPET:
mask = UNIT_MASK_MINION; break;
default:
- if(properties->Flags & 512) // Mirror Image, Summon Gargoyle
+ if (properties->Flags & 512) // Mirror Image, Summon Gargoyle
mask = UNIT_MASK_GUARDIAN;
break;
}
@@ -1753,10 +1753,10 @@ TempSummon *Map::SummonCreature(uint32 entry, const Position &pos, SummonPropert
}
uint32 phase = PHASEMASK_NORMAL, team = 0;
- if(summoner)
+ if (summoner)
{
phase = summoner->GetPhaseMask();
- if(summoner->GetTypeId() == TYPEID_PLAYER)
+ if (summoner->GetTypeId() == TYPEID_PLAYER)
team = summoner->ToPlayer()->GetTeam();
}
@@ -1771,7 +1771,7 @@ TempSummon *Map::SummonCreature(uint32 entry, const Position &pos, SummonPropert
default: return NULL;
}
- if(!summon->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, vehId, team, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()))
+ if (!summon->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, vehId, team, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()))
{
delete summon;
return NULL;
@@ -1790,20 +1790,20 @@ TempSummon *Map::SummonCreature(uint32 entry, const Position &pos, SummonPropert
void WorldObject::SetZoneScript()
{
- if(Map *map = FindMap())
+ if (Map *map = FindMap())
{
- if(map->IsDungeon())
+ if (map->IsDungeon())
m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceData();
- else if(!map->IsBattleGroundOrArena())
+ else if (!map->IsBattleGroundOrArena())
m_zoneScript = sOutdoorPvPMgr.GetZoneScript(GetZoneId());
}
}
TempSummon* WorldObject::SummonCreature(uint32 entry, const Position &pos, TempSummonType spwtype, uint32 duration, uint32 vehId) const
{
- if(Map *map = FindMap())
+ if (Map *map = FindMap())
{
- if(TempSummon *summon = map->SummonCreature(entry, pos, NULL, duration, isType(TYPEMASK_UNIT) ? (Unit*)this : NULL))
+ if (TempSummon *summon = map->SummonCreature(entry, pos, NULL, duration, isType(TYPEMASK_UNIT) ? (Unit*)this : NULL))
{
summon->SetTempSummonType(spwtype);
return summon;
@@ -1817,13 +1817,13 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
{
Pet* pet = new Pet(this, petType);
- if(petType == SUMMON_PET && pet->LoadPetFromDB(this, entry))
+ if (petType == SUMMON_PET && pet->LoadPetFromDB(this, entry))
{
// Remove Demonic Sacrifice auras (known pet)
Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr!=auraClassScripts.end();)
{
- if((*itr)->GetMiscValue()==2228)
+ if ((*itr)->GetMiscValue()==2228)
{
RemoveAurasDueToSpell((*itr)->GetId());
itr = auraClassScripts.begin();
@@ -1832,21 +1832,21 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
++itr;
}
- if(duration > 0)
+ if (duration > 0)
pet->SetDuration(duration);
return NULL;
}
// petentry==0 for hunter "call pet" (current pet summoned if any)
- if(!entry)
+ if (!entry)
{
delete pet;
return NULL;
}
pet->Relocate(x, y, z, ang);
- if(!pet->IsPositionValid())
+ if (!pet->IsPositionValid())
{
sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)",pet->GetGUIDLow(),pet->GetEntry(),pet->GetPositionX(),pet->GetPositionY());
delete pet;
@@ -1855,7 +1855,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
Map *map = GetMap();
uint32 pet_number = objmgr.GeneratePetNumber();
- if(!pet->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number))
+ if (!pet->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number))
{
sLog.outError("no such creature entry %u", entry);
delete pet;
@@ -1898,13 +1898,13 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
break;
}
- if(petType == SUMMON_PET)
+ if (petType == SUMMON_PET)
{
// Remove Demonic Sacrifice auras (known pet)
Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr!=auraClassScripts.end();)
{
- if((*itr)->GetMiscValue()==2228)
+ if ((*itr)->GetMiscValue()==2228)
{
RemoveAurasDueToSpell((*itr)->GetId());
itr = auraClassScripts.begin();
@@ -1914,7 +1914,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
}
}
- if(duration > 0)
+ if (duration > 0)
pet->SetDuration(duration);
//ObjectAccessor::UpdateObjectVisibility(pet);
@@ -1924,24 +1924,24 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
{
- if(!IsInWorld())
+ if (!IsInWorld())
return NULL;
GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(entry);
- if(!goinfo)
+ if (!goinfo)
{
sLog.outErrorDb("Gameobject template %u not found in database!", entry);
return NULL;
}
Map *map = GetMap();
GameObject *go = new GameObject();
- if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, GetPhaseMask(), x,y,z,ang,rotation0,rotation1,rotation2,rotation3,100,GO_STATE_READY))
+ if (!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, GetPhaseMask(), x,y,z,ang,rotation0,rotation1,rotation2,rotation3,100,GO_STATE_READY))
{
delete go;
return NULL;
}
go->SetRespawnTime(respawnTime);
- if(GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT) //not sure how to handle this
+ if (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT) //not sure how to handle this
((Unit*)this)->AddGameObject(go);
else
go->SetSpawnedByDefault(false);
@@ -1954,17 +1954,17 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3
{
TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
Creature* summon = SummonCreature(WORLD_TRIGGER, x, y, z, ang, summonType, duration);
- if(!summon)
+ if (!summon)
return NULL;
//summon->SetName(GetName());
- if(GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT)
+ if (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT)
{
summon->setFaction(((Unit*)this)->getFaction());
summon->SetLevel(((Unit*)this)->getLevel());
}
- if(GetAI)
+ if (GetAI)
summon->AIM_Initialize(GetAI(summon));
return summon;
}
@@ -2030,12 +2030,12 @@ namespace Trinity
void operator()(Creature* c) const
{
// skip self or target
- if(c==i_searcher || c==&i_object)
+ if (c==i_searcher || c==&i_object)
return;
float x,y,z;
- if( !c->isAlive() || c->hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) ||
+ if ( !c->isAlive() || c->hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) ||
!c->GetMotionMaster()->GetDestination(x,y,z) )
{
x = c->GetPositionX();
@@ -2049,7 +2049,7 @@ namespace Trinity
void operator()(T* u) const
{
// skip self or target
- if(u==i_searcher || u==&i_object)
+ if (u==i_searcher || u==&i_object)
return;
float x,y;
@@ -2064,7 +2064,7 @@ namespace Trinity
void add(WorldObject* u, float x, float y) const
{
// u is too nearest/far away to i_object
- if(!i_object.IsInRange2d(x,y,i_selector.m_dist - i_selector.m_size,i_selector.m_dist + i_selector.m_size))
+ if (!i_object.IsInRange2d(x,y,i_selector.m_dist - i_selector.m_size,i_selector.m_dist + i_selector.m_size))
return;
float angle = i_object.GetAngle(u)-i_angle;
@@ -2107,7 +2107,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y,
/*
// if detection disabled, return first point
- if(!sWorld.getConfig(CONFIG_DETECT_POS_COLLISION))
+ if (!sWorld.getConfig(CONFIG_DETECT_POS_COLLISION))
{
UpdateGroundPositionZ(x,y,z); // update to LOS height if available
return;
@@ -2140,11 +2140,11 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y,
}
// maybe can just place in primary position
- if( selector.CheckOriginal() )
+ if ( selector.CheckOriginal() )
{
UpdateGroundPositionZ(x,y,z); // update to LOS height if available
- if(IsWithinLOS(x,y,z))
+ if (IsWithinLOS(x,y,z))
return;
first_los_conflict = true; // first point have LOS problems
@@ -2153,13 +2153,13 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y,
float angle; // candidate of angle for free pos
// special case when one from list empty and then empty side preferred
- if(selector.FirstAngle(angle))
+ if (selector.FirstAngle(angle))
{
GetNearPoint2D(x,y,distance2d,absAngle+angle);
z = GetPositionZ();
UpdateGroundPositionZ(x,y,z); // update to LOS height if available
- if(IsWithinLOS(x,y,z))
+ if (IsWithinLOS(x,y,z))
return;
}
@@ -2173,14 +2173,14 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y,
z = GetPositionZ();
UpdateGroundPositionZ(x,y,z); // update to LOS height if available
- if(IsWithinLOS(x,y,z))
+ if (IsWithinLOS(x,y,z))
return;
}
// BAD NEWS: not free pos (or used or have LOS problems)
// Attempt find _used_ pos without LOS problem
- if(!first_los_conflict)
+ if (!first_los_conflict)
{
x = first_x;
y = first_y;
@@ -2190,15 +2190,15 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y,
}
// special case when one from list empty and then empty side preferred
- if( selector.IsNonBalanced() )
+ if ( selector.IsNonBalanced() )
{
- if(!selector.FirstAngle(angle)) // _used_ pos
+ if (!selector.FirstAngle(angle)) // _used_ pos
{
GetNearPoint2D(x,y,distance2d,absAngle+angle);
z = GetPositionZ();
UpdateGroundPositionZ(x,y,z); // update to LOS height if available
- if(IsWithinLOS(x,y,z))
+ if (IsWithinLOS(x,y,z))
return;
}
}
@@ -2213,7 +2213,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y,
z = GetPositionZ();
UpdateGroundPositionZ(x,y,z); // update to LOS height if available
- if(IsWithinLOS(x,y,z))
+ if (IsWithinLOS(x,y,z))
return;
}
@@ -2240,7 +2240,7 @@ void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update)
{
m_phaseMask = newPhaseMask;
- if(update && IsInWorld())
+ if (update && IsInWorld())
UpdateObjectVisibility();
}
@@ -2267,7 +2267,7 @@ void WorldObject::PlayDirectSound( uint32 sound_id, Player* target /*= NULL*/ )
void WorldObject::DestroyForNearbyPlayers()
{
- if(!IsInWorld())
+ if (!IsInWorld())
return;
std::list<Player*> targets;
@@ -2278,13 +2278,13 @@ void WorldObject::DestroyForNearbyPlayers()
{
Player *plr = (*iter);
- if(plr == this)
+ if (plr == this)
continue;
- if(!plr->HaveAtClient(this))
+ if (!plr->HaveAtClient(this))
continue;
- if(isType(TYPEMASK_UNIT) && ((Unit*)this)->GetCharmerGUID() == plr->GetGUID()) // TODO: this is for puppet
+ if (isType(TYPEMASK_UNIT) && ((Unit*)this)->GetCharmerGUID() == plr->GetGUID()) // TODO: this is for puppet
continue;
DestroyForPlayer(plr);
@@ -2336,10 +2336,10 @@ struct WorldObjectChangeAccumulator
for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
uint64 guid = iter->getSource()->GetCasterGUID();
- if(IS_PLAYER_GUID(guid))
+ if (IS_PLAYER_GUID(guid))
{
//Caster may be NULL if DynObj is in removelist
- if(Player *caster = ObjectAccessor::FindPlayer(guid))
+ if (Player *caster = ObjectAccessor::FindPlayer(guid))
if (caster->GetUInt64Value(PLAYER_FARSIGHT) == iter->getSource()->GetGUID())
BuildPacket(caster);
}
diff --git a/src/game/Object.h b/src/game/Object.h
index c7a1ca76bf7..ca4c443c9cd 100644
--- a/src/game/Object.h
+++ b/src/game/Object.h
@@ -126,7 +126,7 @@ class Object
const bool IsInWorld() const { return m_inWorld; }
virtual void AddToWorld()
{
- if(m_inWorld)
+ if (m_inWorld)
return;
assert(m_uint32Values);
@@ -138,7 +138,7 @@ class Object
}
virtual void RemoveFromWorld()
{
- if(!m_inWorld)
+ if (!m_inWorld)
return;
m_inWorld = false;
@@ -236,7 +236,7 @@ class Object
void ToggleFlag( uint16 index, uint32 flag)
{
- if(HasFlag(index, flag))
+ if (HasFlag(index, flag))
RemoveFlag(index, flag);
else
SetFlag(index, flag);
@@ -244,7 +244,7 @@ class Object
bool HasFlag( uint16 index, uint32 flag ) const
{
- if( index >= m_valuesCount && !PrintIndexError( index , false ) ) return false;
+ if ( index >= m_valuesCount && !PrintIndexError( index , false ) ) return false;
return (m_uint32Values[ index ] & flag) != 0;
}
@@ -253,7 +253,7 @@ class Object
void ToggleFlag( uint16 index, uint8 offset, uint8 flag )
{
- if(HasByteFlag(index, offset, flag))
+ if (HasByteFlag(index, offset, flag))
RemoveByteFlag(index, offset, flag);
else
SetByteFlag(index, offset, flag);
@@ -268,7 +268,7 @@ class Object
void ApplyModFlag( uint16 index, uint32 flag, bool apply)
{
- if(apply) SetFlag(index,flag); else RemoveFlag(index,flag);
+ if (apply) SetFlag(index,flag); else RemoveFlag(index,flag);
}
void SetFlag64( uint16 index, uint64 newFlag )
@@ -287,7 +287,7 @@ class Object
void ToggleFlag64( uint16 index, uint64 flag)
{
- if(HasFlag64(index, flag))
+ if (HasFlag64(index, flag))
RemoveFlag64(index, flag);
else
SetFlag64(index, flag);
@@ -301,7 +301,7 @@ class Object
void ApplyModFlag64( uint16 index, uint64 flag, bool apply)
{
- if(apply) SetFlag64(index,flag); else RemoveFlag64(index,flag);
+ if (apply) SetFlag64(index,flag); else RemoveFlag64(index,flag);
}
void ClearUpdateMask(bool remove);
@@ -318,10 +318,10 @@ class Object
// FG: some hacky helpers
void ForceValuesUpdateAtIndex(uint32);
- Player* ToPlayer(){ if(GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Player*>(this); else return NULL; }
- const Player* ToPlayer() const { if(GetTypeId() == TYPEID_PLAYER) return (const Player*)((Player*)this); else return NULL; }
- Creature* ToCreature(){ if(GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(this); else return NULL; }
- const Creature* ToCreature() const {if(GetTypeId() == TYPEID_UNIT) return (const Creature*)((Creature*)this); else return NULL; }
+ Player* ToPlayer(){ if (GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Player*>(this); else return NULL; }
+ const Player* ToPlayer() const { if (GetTypeId() == TYPEID_PLAYER) return (const Player*)((Player*)this); else return NULL; }
+ Creature* ToCreature(){ if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(this); else return NULL; }
+ const Creature* ToCreature() const {if (GetTypeId() == TYPEID_UNIT) return (const Creature*)((Creature*)this); else return NULL; }
protected:
@@ -643,7 +643,7 @@ class WorldObject : public Object, public WorldLocation
TempSummon* SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, uint32 vehId = 0) const;
TempSummon* SummonCreature(uint32 id, float x, float y, float z, float ang = 0, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0)
{
- if(!x && !y && !z)
+ if (!x && !y && !z)
{
GetClosePoint(x, y, z, GetObjectSize());
ang = GetOrientation();
diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp
index 867b9df4e3e..d4de7d6515e 100644
--- a/src/game/ObjectAccessor.cpp
+++ b/src/game/ObjectAccessor.cpp
@@ -111,24 +111,24 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, uint64 guid, u
return ((Player const&)p).GetItemByGuid(guid);
break;
case HIGHGUID_PLAYER:
- if(typemask & TYPEMASK_PLAYER)
+ if (typemask & TYPEMASK_PLAYER)
return FindPlayer(guid);
break;
case HIGHGUID_GAMEOBJECT:
- if(typemask & TYPEMASK_GAMEOBJECT)
+ if (typemask & TYPEMASK_GAMEOBJECT)
return p.GetMap()->GetGameObject(guid);
break;
case HIGHGUID_UNIT:
case HIGHGUID_VEHICLE:
- if(typemask & TYPEMASK_UNIT)
+ if (typemask & TYPEMASK_UNIT)
return p.GetMap()->GetCreature(guid);
break;
case HIGHGUID_PET:
- if(typemask & TYPEMASK_UNIT)
+ if (typemask & TYPEMASK_UNIT)
return GetPet(guid);
break;
case HIGHGUID_DYNAMICOBJECT:
- if(typemask & TYPEMASK_DYNAMICOBJECT)
+ if (typemask & TYPEMASK_DYNAMICOBJECT)
return p.GetMap()->GetDynamicObject(guid);
break;
case HIGHGUID_TRANSPORT:
@@ -255,7 +255,7 @@ void ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair, GridType& grid,
Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia)
{
Corpse* corpse = GetCorpseForPlayerGUID(player_guid);
- if(!corpse)
+ if (!corpse)
{
//in fact this function is called from several places
//even when player doesn't have a corpse, not an error
@@ -275,7 +275,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia
// remove resurrectable corpse from grid object registry (loaded state checked into call)
// do not load the map if it's not loaded
//Map *map = MapManager::Instance().FindMap(corpse->GetMapId(), corpse->GetInstanceId());
- //if(map)
+ //if (map)
// map->Remove(corpse, false);
// remove corpse from DB
diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h
index 9134dd730f7..1a8afaf7a3a 100644
--- a/src/game/ObjectAccessor.h
+++ b/src/game/ObjectAccessor.h
@@ -130,7 +130,7 @@ class ObjectAccessor : public Trinity::Singleton<ObjectAccessor, Trinity::ClassL
if (IS_PLAYER_GUID(guid))
{
Unit* u = (Unit*)HashMapHolder<Player>::Find(guid);
- if(!u)
+ if (!u)
return NULL;
return u;
@@ -154,7 +154,7 @@ class ObjectAccessor : public Trinity::Singleton<ObjectAccessor, Trinity::ClassL
}
CellPair q = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
- if(q.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || q.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
+ if (q.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || q.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
{
sLog.outError("ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord);
return NULL;
diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp
index 0e6ab9ab1ee..ab69d9a966b 100644
--- a/src/game/ObjectGridLoader.cpp
+++ b/src/game/ObjectGridLoader.cpp
@@ -68,7 +68,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m)
CellPair resp_val = Trinity::ComputeCellPair(resp_x, resp_y);
Cell resp_cell(resp_val);
- if(cur_cell.DiffGrid(resp_cell))
+ if (cur_cell.DiffGrid(resp_cell))
{
c->GetMap()->CreatureRespawnRelocation(c);
// false result ignored: will be unload with other creatures at grid
@@ -105,7 +105,7 @@ template<> void addUnitState(Creature *obj, CellPair const& cell_pair)
Cell cell(cell_pair);
obj->SetCurrentCell(cell);
- if(obj->isSpiritService())
+ if (obj->isSpiritService())
obj->setDeathState(DEAD);
}
@@ -115,7 +115,7 @@ void AddObjectHelper(CellPair &cell, GridRefManager<T> &m, uint32 &count, Map* m
obj->GetGridRef().link(&m, obj);
addUnitState(obj,cell);
obj->AddToWorld();
- if(obj->isActiveObject())
+ if (obj->isActiveObject())
map->AddToActive(obj);
++count;
@@ -129,7 +129,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> &
T* obj = new T;
uint32 guid = *i_guid;
//sLog.outString("DEBUG: LoadHelper from table: %s for (guid: %u) Loading",table,guid);
- if(!obj->LoadFromDB(guid, map))
+ if (!obj->LoadFromDB(guid, map))
{
delete obj;
continue;
@@ -141,18 +141,18 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> &
void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType &m, uint32 &count, Map* map)
{
- if(cell_corpses.empty())
+ if (cell_corpses.empty())
return;
for (CellCorpseSet::const_iterator itr = cell_corpses.begin(); itr != cell_corpses.end(); ++itr)
{
- if(itr->second != map->GetInstanceId())
+ if (itr->second != map->GetInstanceId())
continue;
uint32 player_guid = itr->first;
Corpse *obj = ObjectAccessor::Instance().GetCorpseForPlayerGUID(player_guid);
- if(!obj)
+ if (!obj)
continue;
// TODO: this is a hack
@@ -264,7 +264,7 @@ ObjectGridUnloader::Visit(GridRefManager<T> &m)
{
T *obj = m.getFirst()->getSource();
// if option set then object already saved at this moment
- if(!sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
+ if (!sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
obj->SaveRespawnTime();
///- object will get delinked from the manager when deleted
delete obj;
@@ -285,7 +285,7 @@ ObjectGridStoper::Visit(CreatureMapType &m)
for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
{
iter->getSource()->RemoveAllDynObjects();
- if(iter->getSource()->isInCombat())
+ if (iter->getSource()->isInCombat())
{
iter->getSource()->CombatStop();
iter->getSource()->DeleteThreatList();
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index 3d3fe7723b4..3585e0dbc47 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -61,20 +61,20 @@ ScriptMapMap sWaypointScripts;
bool normalizePlayerName(std::string& name)
{
- if(name.empty())
+ if (name.empty())
return false;
wchar_t wstr_buf[MAX_INTERNAL_PLAYER_NAME+1];
size_t wstr_len = MAX_INTERNAL_PLAYER_NAME;
- if(!Utf8toWStr(name,&wstr_buf[0],wstr_len))
+ if (!Utf8toWStr(name,&wstr_buf[0],wstr_len))
return false;
wstr_buf[0] = wcharToUpper(wstr_buf[0]);
for (size_t i = 1; i < wstr_len; ++i)
wstr_buf[i] = wcharToLower(wstr_buf[i]);
- if(!WStrToUtf8(wstr_buf,wstr_len,name))
+ if (!WStrToUtf8(wstr_buf,wstr_len,name))
return false;
return true;
@@ -107,7 +107,7 @@ LanguageDesc const* GetLanguageDescByID(uint32 lang)
{
for (uint8 i = 0; i < LANGUAGES_COUNT; ++i)
{
- if(uint32(lang_description[i].lang_id) == lang)
+ if (uint32(lang_description[i].lang_id) == lang)
return &lang_description[i];
}
@@ -116,17 +116,17 @@ LanguageDesc const* GetLanguageDescByID(uint32 lang)
bool SpellClickInfo::IsFitToRequirements(Player const* player, Creature const * clickNpc) const
{
- if(questStart)
+ if (questStart)
{
// not in expected required quest state
if (!player || ((!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart)))
return false;
}
- if(questEnd)
+ if (questEnd)
{
// not in expected forbidden quest state
- if(!player || player->GetQuestRewardStatus(questEnd))
+ if (!player || player->GetQuestRewardStatus(questEnd))
return false;
}
@@ -322,7 +322,7 @@ void ObjectMgr::LoadCreatureLocales()
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,name_loc1,subname_loc1,name_loc2,subname_loc2,name_loc3,subname_loc3,name_loc4,subname_loc4,name_loc5,subname_loc5,name_loc6,subname_loc6,name_loc7,subname_loc7,name_loc8,subname_loc8 FROM locales_creature");
- if(!result)
+ if (!result)
return;
barGoLink bar(result->GetRowCount());
@@ -339,24 +339,24 @@ void ObjectMgr::LoadCreatureLocales()
for (uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[1+2*(i-1)].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.Name.size() <= idx)
+ if (data.Name.size() <= idx)
data.Name.resize(idx+1);
data.Name[idx] = str;
}
}
str = fields[1+2*(i-1)+1].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.SubName.size() <= idx)
+ if (data.SubName.size() <= idx)
data.SubName.resize(idx+1);
data.SubName[idx] = str;
@@ -380,7 +380,7 @@ void ObjectMgr::LoadNpcOptionLocales()
"option_text_loc7,box_text_loc7,option_text_loc8,box_text_loc8 "
"FROM locales_gossip_menu_option");
- if(!result)
+ if (!result)
return;
barGoLink bar(result->GetRowCount());
@@ -398,24 +398,24 @@ void ObjectMgr::LoadNpcOptionLocales()
for (uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[1+2*(i-1)].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.OptionText.size() <= idx)
+ if (data.OptionText.size() <= idx)
data.OptionText.resize(idx+1);
data.OptionText[idx] = str;
}
}
str = fields[1+2*(i-1)+1].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.BoxText.size() <= idx)
+ if (data.BoxText.size() <= idx)
data.BoxText.resize(idx+1);
data.BoxText[idx] = str;
@@ -434,7 +434,7 @@ void ObjectMgr::LoadPointOfInterestLocales()
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,icon_name_loc1,icon_name_loc2,icon_name_loc3,icon_name_loc4,icon_name_loc5,icon_name_loc6,icon_name_loc7,icon_name_loc8 FROM locales_points_of_interest");
- if(!result)
+ if (!result)
return;
barGoLink bar(result->GetRowCount());
@@ -451,13 +451,13 @@ void ObjectMgr::LoadPointOfInterestLocales()
for (uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[i].GetCppString();
- if(str.empty())
+ if (str.empty())
continue;
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.IconName.size() <= idx)
+ if (data.IconName.size() <= idx)
data.IconName.resize(idx+1);
data.IconName[idx] = str;
@@ -610,12 +610,12 @@ void ObjectMgr::LoadCreatureTemplates()
if (cInfo->Modelid1)
{
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid1);
- if(!displayEntry)
+ if (!displayEntry)
{
sLog.outErrorDb("Creature (Entry: %u) has non-existing Modelid1 id (%u), can crash client", cInfo->Entry, cInfo->Modelid1);
const_cast<CreatureInfo*>(cInfo)->Modelid1 = 0;
}
- else if(!displayScaleEntry)
+ else if (!displayScaleEntry)
displayScaleEntry = displayEntry;
CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid1);
@@ -626,12 +626,12 @@ void ObjectMgr::LoadCreatureTemplates()
if (cInfo->Modelid2)
{
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid2);
- if(!displayEntry)
+ if (!displayEntry)
{
sLog.outErrorDb("Creature (Entry: %u) has non-existing Modelid2 id (%u), can crash client", cInfo->Entry, cInfo->Modelid2);
const_cast<CreatureInfo*>(cInfo)->Modelid2 = 0;
}
- else if(!displayScaleEntry)
+ else if (!displayScaleEntry)
displayScaleEntry = displayEntry;
CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid2);
@@ -642,12 +642,12 @@ void ObjectMgr::LoadCreatureTemplates()
if (cInfo->Modelid3)
{
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid3);
- if(!displayEntry)
+ if (!displayEntry)
{
sLog.outErrorDb("Creature (Entry: %u) has non-existing Modelid3 id (%u), can crash client", cInfo->Entry, cInfo->Modelid3);
const_cast<CreatureInfo*>(cInfo)->Modelid3 = 0;
}
- else if(!displayScaleEntry)
+ else if (!displayScaleEntry)
displayScaleEntry = displayEntry;
CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid3);
@@ -658,12 +658,12 @@ void ObjectMgr::LoadCreatureTemplates()
if (cInfo->Modelid4)
{
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid4);
- if(!displayEntry)
+ if (!displayEntry)
{
sLog.outErrorDb("Creature (Entry: %u) has non-existing Modelid4 id (%u), can crash client", cInfo->Entry, cInfo->Modelid4);
const_cast<CreatureInfo*>(cInfo)->Modelid4 = 0;
}
- else if(!displayScaleEntry)
+ else if (!displayScaleEntry)
displayScaleEntry = displayEntry;
CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid4);
@@ -676,9 +676,9 @@ void ObjectMgr::LoadCreatureTemplates()
for (int k = 0; k < MAX_KILL_CREDIT; ++k)
{
- if(cInfo->KillCredit[k])
+ if (cInfo->KillCredit[k])
{
- if(!GetCreatureTemplate(cInfo->KillCredit[k]))
+ if (!GetCreatureTemplate(cInfo->KillCredit[k]))
{
sLog.outErrorDb("Creature (Entry: %u) has not existed creature entry in `KillCredit%d` (%u)",cInfo->Entry,k+1,cInfo->KillCredit[k]);
const_cast<CreatureInfo*>(cInfo)->KillCredit[k] = 0;
@@ -692,41 +692,41 @@ void ObjectMgr::LoadCreatureTemplates()
const_cast<CreatureInfo*>(cInfo)->unit_class = UNIT_CLASS_WARRIOR;
}
- if(cInfo->dmgschool >= MAX_SPELL_SCHOOL)
+ if (cInfo->dmgschool >= MAX_SPELL_SCHOOL)
{
sLog.outErrorDb("Creature (Entry: %u) has invalid spell school value (%u) in `dmgschool`",cInfo->Entry,cInfo->dmgschool);
const_cast<CreatureInfo*>(cInfo)->dmgschool = SPELL_SCHOOL_NORMAL;
}
- if(cInfo->baseattacktime == 0)
+ if (cInfo->baseattacktime == 0)
const_cast<CreatureInfo*>(cInfo)->baseattacktime = BASE_ATTACK_TIME;
- if(cInfo->rangeattacktime == 0)
+ if (cInfo->rangeattacktime == 0)
const_cast<CreatureInfo*>(cInfo)->rangeattacktime = BASE_ATTACK_TIME;
- if(cInfo->npcflag & UNIT_NPC_FLAG_SPELLCLICK)
+ if (cInfo->npcflag & UNIT_NPC_FLAG_SPELLCLICK)
{
sLog.outErrorDb("Creature (Entry: %u) has dynamic flag UNIT_NPC_FLAG_SPELLCLICK (%u) set, it expect to be set by code base at `npc_spellclick_spells` content.",cInfo->Entry,UNIT_NPC_FLAG_SPELLCLICK);
const_cast<CreatureInfo*>(cInfo)->npcflag &= ~UNIT_NPC_FLAG_SPELLCLICK;
}
- if((cInfo->npcflag & UNIT_NPC_FLAG_TRAINER) && cInfo->trainer_type >= MAX_TRAINER_TYPE)
+ if ((cInfo->npcflag & UNIT_NPC_FLAG_TRAINER) && cInfo->trainer_type >= MAX_TRAINER_TYPE)
sLog.outErrorDb("Creature (Entry: %u) has wrong trainer type %u",cInfo->Entry,cInfo->trainer_type);
- if(cInfo->type && !sCreatureTypeStore.LookupEntry(cInfo->type))
+ if (cInfo->type && !sCreatureTypeStore.LookupEntry(cInfo->type))
{
sLog.outErrorDb("Creature (Entry: %u) has invalid creature type (%u) in `type`",cInfo->Entry,cInfo->type);
const_cast<CreatureInfo*>(cInfo)->type = CREATURE_TYPE_HUMANOID;
}
// must exist or used hidden but used in data horse case
- if(cInfo->family && !sCreatureFamilyStore.LookupEntry(cInfo->family) && cInfo->family != CREATURE_FAMILY_HORSE_CUSTOM )
+ if (cInfo->family && !sCreatureFamilyStore.LookupEntry(cInfo->family) && cInfo->family != CREATURE_FAMILY_HORSE_CUSTOM )
{
sLog.outErrorDb("Creature (Entry: %u) has invalid creature family (%u) in `family`",cInfo->Entry,cInfo->family);
const_cast<CreatureInfo*>(cInfo)->family = 0;
}
- if(cInfo->InhabitType <= 0 || cInfo->InhabitType > INHABIT_ANYWHERE)
+ if (cInfo->InhabitType <= 0 || cInfo->InhabitType > INHABIT_ANYWHERE)
{
sLog.outErrorDb("Creature (Entry: %u) has wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly",cInfo->Entry,cInfo->InhabitType);
const_cast<CreatureInfo*>(cInfo)->InhabitType = INHABIT_ANYWHERE;
@@ -739,31 +739,31 @@ void ObjectMgr::LoadCreatureTemplates()
sLog.outErrorDb("Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId);
}
- if(cInfo->PetSpellDataId)
+ if (cInfo->PetSpellDataId)
{
CreatureSpellDataEntry const* spellDataId = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId);
- if(!spellDataId)
+ if (!spellDataId)
sLog.outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u)", cInfo->Entry, cInfo->PetSpellDataId);
}
for (uint8 j = 0; j < CREATURE_MAX_SPELLS; ++j)
{
- if(cInfo->spells[j] && !sSpellStore.LookupEntry(cInfo->spells[j]))
+ if (cInfo->spells[j] && !sSpellStore.LookupEntry(cInfo->spells[j]))
{
sLog.outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0", cInfo->Entry, j+1,cInfo->spells[j]);
const_cast<CreatureInfo*>(cInfo)->spells[j] = 0;
}
}
- if(cInfo->MovementType >= MAX_DB_MOTION_TYPE)
+ if (cInfo->MovementType >= MAX_DB_MOTION_TYPE)
{
sLog.outErrorDb("Creature (Entry: %u) has wrong movement generator type (%u), ignore and set to IDLE.",cInfo->Entry,cInfo->MovementType);
const_cast<CreatureInfo*>(cInfo)->MovementType = IDLE_MOTION_TYPE;
}
- if(cInfo->equipmentId > 0) // 0 no equipment
+ if (cInfo->equipmentId > 0) // 0 no equipment
{
- if(!GetEquipmentInfo(cInfo->equipmentId))
+ if (!GetEquipmentInfo(cInfo->equipmentId))
{
sLog.outErrorDb("Table `creature_template` have creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", cInfo->Entry, cInfo->equipmentId);
const_cast<CreatureInfo*>(cInfo)->equipmentId = 0;
@@ -771,15 +771,15 @@ void ObjectMgr::LoadCreatureTemplates()
}
/// if not set custom creature scale then load scale from CreatureDisplayInfo.dbc
- if(cInfo->scale <= 0.0f)
+ if (cInfo->scale <= 0.0f)
{
- if(displayScaleEntry)
+ if (displayScaleEntry)
const_cast<CreatureInfo*>(cInfo)->scale = displayScaleEntry->scale;
else
const_cast<CreatureInfo*>(cInfo)->scale = 1.0f;
}
- if(cInfo->expansion > (MAX_CREATURE_BASE_HP - 1))
+ if (cInfo->expansion > (MAX_CREATURE_BASE_HP - 1))
{
sLog.outErrorDb("Table `creature_template` have creature (Entry: %u) with expansion %u ignore and set to NULL.", cInfo->expansion);
const_cast<CreatureInfo*>(cInfo)->expansion = 0;
@@ -795,7 +795,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
char *p,*s;
std::map<uint32, uint32> val;
s=p=(char*)reinterpret_cast<char const*>(addon->auras);
- if(p)
+ if (p)
{
uint32 currSpellId = 0;
bool spell = true;
@@ -835,7 +835,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
}
// empty list
- if(val.empty())
+ if (val.empty())
{
addon->auras = NULL;
return;
@@ -898,7 +898,7 @@ void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entry
for (uint32 i = 1; i < creatureaddons.MaxEntry; ++i)
{
CreatureDataAddon const* addon = creatureaddons.LookupEntry<CreatureDataAddon>(i);
- if(!addon)
+ if (!addon)
continue;
if (addon->mount)
@@ -929,8 +929,8 @@ void ObjectMgr::LoadCreatureAddons()
// check entry ids
for (uint32 i = 1; i < sCreatureInfoAddonStorage.MaxEntry; ++i)
- if(CreatureDataAddon const* addon = sCreatureInfoAddonStorage.LookupEntry<CreatureDataAddon>(i))
- if(!sCreatureStorage.LookupEntry<CreatureInfo>(addon->guidOrEntry))
+ if (CreatureDataAddon const* addon = sCreatureInfoAddonStorage.LookupEntry<CreatureDataAddon>(i))
+ if (!sCreatureStorage.LookupEntry<CreatureInfo>(addon->guidOrEntry))
sLog.outErrorDb("Creature (Entry: %u) does not exist but has a record in `%s`",addon->guidOrEntry, sCreatureInfoAddonStorage.GetTableName());
sLog.outString( "Loading Creature Addon Data..." );
@@ -938,8 +938,8 @@ void ObjectMgr::LoadCreatureAddons()
// check entry ids
for (uint32 i = 1; i < sCreatureDataAddonStorage.MaxEntry; ++i)
- if(CreatureDataAddon const* addon = sCreatureDataAddonStorage.LookupEntry<CreatureDataAddon>(i))
- if(mCreatureDataMap.find(addon->guidOrEntry)==mCreatureDataMap.end())
+ if (CreatureDataAddon const* addon = sCreatureDataAddonStorage.LookupEntry<CreatureDataAddon>(i))
+ if (mCreatureDataMap.find(addon->guidOrEntry)==mCreatureDataMap.end())
sLog.outErrorDb("Creature (GUID: %u) does not exist but has a record in `creature_addon`",addon->guidOrEntry);
}
@@ -956,24 +956,24 @@ void ObjectMgr::LoadEquipmentTemplates()
{
EquipmentInfo const* eqInfo = sEquipmentStorage.LookupEntry<EquipmentInfo>(i);
- if(!eqInfo)
+ if (!eqInfo)
continue;
for (uint8 j=0; j<3; j++)
{
- if(!eqInfo->equipentry[j])
+ if (!eqInfo->equipentry[j])
continue;
ItemEntry const *dbcitem = sItemStore.LookupEntry(eqInfo->equipentry[j]);
- if(!dbcitem)
+ if (!dbcitem)
{
sLog.outErrorDb("Unknown item (entry=%u) in creature_equip_template.equipentry%u for entry = %u, forced to 0.", eqInfo->equipentry[j], j+1, i);
const_cast<EquipmentInfo*>(eqInfo)->equipentry[j] = 0;
continue;
}
- if(dbcitem->InventoryType != INVTYPE_WEAPON &&
+ if (dbcitem->InventoryType != INVTYPE_WEAPON &&
dbcitem->InventoryType != INVTYPE_SHIELD &&
dbcitem->InventoryType != INVTYPE_RANGED &&
dbcitem->InventoryType != INVTYPE_2HWEAPON &&
@@ -1009,7 +1009,7 @@ uint32 ObjectMgr::ChooseDisplayId(uint32 team, const CreatureInfo *cinfo, const
else
return data->displayid;
- /*if(!team)
+ /*if (!team)
{
switch(cinfo->Entry)
{
@@ -1033,14 +1033,14 @@ uint32 ObjectMgr::ChooseDisplayId(uint32 team, const CreatureInfo *cinfo, const
CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32 display_id)
{
CreatureModelInfo const *minfo = GetCreatureModelInfo(display_id);
- if(!minfo)
+ if (!minfo)
return NULL;
// If a model for another gender exists, 50% chance to use it
- if(minfo->modelid_other_gender != 0 && urand(0,1) == 0)
+ if (minfo->modelid_other_gender != 0 && urand(0,1) == 0)
{
CreatureModelInfo const *minfo_tmp = GetCreatureModelInfo(minfo->modelid_other_gender);
- if(!minfo_tmp)
+ if (!minfo_tmp)
{
sLog.outErrorDb("Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", minfo->modelid, minfo->modelid_other_gender);
return minfo; // not fatal, just use the previous one
@@ -1086,10 +1086,10 @@ void ObjectMgr::LoadCreatureModelInfo()
for (uint32 i = 1; i < sCreatureModelStorage.MaxEntry; ++i)
{
CreatureModelInfo const* mInfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(i);
- if(!mInfo)
+ if (!mInfo)
continue;
- if(mInfo->combat_reach < 0.1f)
+ if (mInfo->combat_reach < 0.1f)
{
//sLog.outErrorDb("Creature model (Entry: %u) has invalid combat reach (%f), setting it to 0.5", mInfo->modelid, mInfo->combat_reach);
const_cast<CreatureModelInfo*>(mInfo)->combat_reach = DEFAULT_COMBAT_REACH;
@@ -1102,7 +1102,7 @@ bool ObjectMgr::CheckCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid) const
const CreatureData* const slave = GetCreatureData(guid);
const CreatureData* const master = GetCreatureData(linkedGuid);
- if(!slave || !master) // they must have a corresponding entry in db
+ if (!slave || !master) // they must have a corresponding entry in db
{
sLog.outError("LinkedRespawn: Creature '%u' linking to '%u' which doesn't exist",guid,linkedGuid);
return false;
@@ -1110,14 +1110,14 @@ bool ObjectMgr::CheckCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid) const
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
- if(master->mapid != slave->mapid // link only to same map
+ if (master->mapid != slave->mapid // link only to same map
&& (!map || map->Instanceable())) // or to unistanced world
{
sLog.outError("LinkedRespawn: Creature '%u' linking to '%u' on an unpermitted map",guid,linkedGuid);
return false;
}
- if(!(master->spawnMask & slave->spawnMask) // they must have a possibility to meet (normal/heroic difficulty)
+ if (!(master->spawnMask & slave->spawnMask) // they must have a possibility to meet (normal/heroic difficulty)
&& (!map || map->Instanceable()))
{
sLog.outError("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask",guid,linkedGuid);
@@ -1132,7 +1132,7 @@ void ObjectMgr::LoadCreatureLinkedRespawn()
mCreatureLinkedRespawnMap.clear();
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT guid, linkedGuid FROM creature_linked_respawn ORDER BY guid ASC");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
@@ -1153,7 +1153,7 @@ void ObjectMgr::LoadCreatureLinkedRespawn()
uint32 guid = fields[0].GetUInt32();
uint32 linkedGuid = fields[1].GetUInt32();
- if(CheckCreatureLinkedRespawn(guid,linkedGuid))
+ if (CheckCreatureLinkedRespawn(guid,linkedGuid))
mCreatureLinkedRespawnMap[guid] = linkedGuid;
} while (result->NextRow());
@@ -1164,17 +1164,17 @@ void ObjectMgr::LoadCreatureLinkedRespawn()
bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid)
{
- if(!guid)
+ if (!guid)
return false;
- if(!linkedGuid) // we're removing the linking
+ if (!linkedGuid) // we're removing the linking
{
mCreatureLinkedRespawnMap.erase(guid);
WorldDatabase.DirectPExecute("DELETE FROM creature_linked_respawn WHERE guid = '%u'",guid);
return true;
}
- if(CheckCreatureLinkedRespawn(guid,linkedGuid)) // we add/change linking
+ if (CheckCreatureLinkedRespawn(guid,linkedGuid)) // we add/change linking
{
mCreatureLinkedRespawnMap[guid] = linkedGuid;
WorldDatabase.DirectPExecute("REPLACE INTO creature_linked_respawn (guid,linkedGuid) VALUES ('%u','%u')",guid,linkedGuid);
@@ -1195,7 +1195,7 @@ void ObjectMgr::LoadCreatures()
"FROM creature LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid "
"LEFT OUTER JOIN pool_creature ON creature.guid = pool_creature.guid");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
@@ -1217,7 +1217,7 @@ void ObjectMgr::LoadCreatures()
// build single time for check spawnmask
std::map<uint32,uint32> spawnMasks;
for (uint32 i = 0; i < sMapStore.GetNumRows(); ++i)
- if(sMapStore.LookupEntry(i))
+ if (sMapStore.LookupEntry(i))
for (int k = 0; k < MAX_DIFFICULTY; ++k)
if (GetMapDifficultyData(i,Difficulty(k)))
spawnMasks[i] |= (1 << k);
@@ -1236,7 +1236,7 @@ void ObjectMgr::LoadCreatures()
uint32 entry = fields[ 1].GetUInt32();
CreatureInfo const* cInfo = GetCreatureTemplate(entry);
- if(!cInfo)
+ if (!cInfo)
{
sLog.outErrorDb("Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry);
continue;
@@ -1265,7 +1265,7 @@ void ObjectMgr::LoadCreatures()
int16 PoolId = fields[19].GetInt16();
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
- if(!mapEntry)
+ if (!mapEntry)
{
sLog.outErrorDb("Table `creature` have creature (GUID: %u) that spawned at not existed map (Id: %u), skipped.",guid, data.mapid );
continue;
@@ -1288,62 +1288,62 @@ void ObjectMgr::LoadCreatures()
continue;
// I do not know why but in db most display id are not zero
- /*if(data.displayid == 11686 || data.displayid == 24719)
+ /*if (data.displayid == 11686 || data.displayid == 24719)
{
(const_cast<CreatureInfo*>(cInfo))->flags_extra |= CREATURE_FLAG_EXTRA_TRIGGER;
}
- else if(data.displayid == cInfo->DisplayID_A || data.displayid == cInfo->DisplayID_A2
+ else if (data.displayid == cInfo->DisplayID_A || data.displayid == cInfo->DisplayID_A2
|| data.displayid == cInfo->DisplayID_H || data.displayid == cInfo->DisplayID_H2)
data.displayid = 0;
*/
- if(data.equipmentId > 0) // -1 no equipment, 0 use default
+ if (data.equipmentId > 0) // -1 no equipment, 0 use default
{
- if(!GetEquipmentInfo(data.equipmentId))
+ if (!GetEquipmentInfo(data.equipmentId))
{
sLog.outErrorDb("Table `creature` have creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", data.id, data.equipmentId);
data.equipmentId = -1;
}
}
- if(cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
+ if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
{
- if(!mapEntry || !mapEntry->IsDungeon())
+ if (!mapEntry || !mapEntry->IsDungeon())
sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.",guid,data.id);
}
- if(data.spawndist < 0.0f)
+ if (data.spawndist < 0.0f)
{
sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.",guid,data.id );
data.spawndist = 0.0f;
}
- else if(data.movementType == RANDOM_MOTION_TYPE)
+ else if (data.movementType == RANDOM_MOTION_TYPE)
{
- if(data.spawndist == 0.0f)
+ if (data.spawndist == 0.0f)
{
sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `spawndist`=0, replace by idle movement type (0).",guid,data.id );
data.movementType = IDLE_MOTION_TYPE;
}
- else if(cInfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
+ else if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
data.movementType = IDLE_MOTION_TYPE;
}
- else if(data.movementType == IDLE_MOTION_TYPE)
+ else if (data.movementType == IDLE_MOTION_TYPE)
{
- if(data.spawndist != 0.0f)
+ if (data.spawndist != 0.0f)
{
sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.",guid,data.id );
data.spawndist = 0.0f;
}
}
- if(data.phaseMask==0)
+ if (data.phaseMask==0)
{
sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.",guid,data.id );
data.phaseMask = 1;
}
- //if(entry == 32307 || entry == 32308)
- /*if(entry == 30739 || entry == 30740)
+ //if (entry == 32307 || entry == 32308)
+ /*if (entry == 30739 || entry == 30740)
{
gameEvent = 51;
uint32 guid2 = objmgr.GenerateLowGuid(HIGHGUID_UNIT);
@@ -1372,7 +1372,7 @@ void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data)
uint8 mask = data->spawnMask;
for (uint8 i = 0; mask != 0; i++, mask >>= 1)
{
- if(mask & 1)
+ if (mask & 1)
{
CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
@@ -1388,7 +1388,7 @@ void ObjectMgr::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data)
uint8 mask = data->spawnMask;
for (uint8 i = 0; mask != 0; i++, mask >>= 1)
{
- if(mask & 1)
+ if (mask & 1)
{
CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
@@ -1406,7 +1406,7 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float
return 0;
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(mapId));
- if(!map)
+ if (!map)
return 0;
uint32 guid = GenerateLowGuid(HIGHGUID_GAMEOBJECT);
@@ -1433,7 +1433,7 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float
// Spawn if necessary (loaded grids only)
// We use spawn coords to spawn
- if(!map->Instanceable() && map->IsLoaded(x, y))
+ if (!map->Instanceable() && map->IsLoaded(x, y))
{
GameObject *go = new GameObject;
if (!go->LoadFromDB(guid, map))
@@ -1466,13 +1466,13 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos)
AddCreatureToGrid(guid, &data);
// Spawn if necessary (loaded grids only)
- if(Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(mapId)))
+ if (Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(mapId)))
{
// We use spawn coords to spawn
- if(!map->Instanceable() && map->IsLoaded(data.posX, data.posY))
+ if (!map->Instanceable() && map->IsLoaded(data.posX, data.posY))
{
Creature *creature = new Creature;
- if(!creature->LoadFromDB(guid, map))
+ if (!creature->LoadFromDB(guid, map))
{
sLog.outError("AddCreature: cannot add creature entry %u to map", guid);
delete creature;
@@ -1487,7 +1487,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos)
uint32 ObjectMgr::AddCreData(uint32 entry, uint32 team, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay)
{
CreatureInfo const *cInfo = GetCreatureTemplate(entry);
- if(!cInfo)
+ if (!cInfo)
return 0;
uint32 level = cInfo->minlevel == cInfo->maxlevel ? cInfo->minlevel : urand(cInfo->minlevel, cInfo->maxlevel); // Only used for extracting creature base stats
@@ -1517,13 +1517,13 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 team, uint32 mapId, float x, f
AddCreatureToGrid(guid, &data);
// Spawn if necessary (loaded grids only)
- if(Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(mapId)))
+ if (Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(mapId)))
{
// We use spawn coords to spawn
- if(!map->Instanceable() && !map->IsRemovalGrid(x, y))
+ if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
{
Creature* creature = new Creature;
- if(!creature->LoadFromDB(guid, map))
+ if (!creature->LoadFromDB(guid, map))
{
sLog.outError("AddCreature: cannot add creature entry %u to map", entry);
delete creature;
@@ -1547,7 +1547,7 @@ void ObjectMgr::LoadGameobjects()
"FROM gameobject LEFT OUTER JOIN game_event_gameobject ON gameobject.guid = game_event_gameobject.guid "
"LEFT OUTER JOIN pool_gameobject ON gameobject.guid = pool_gameobject.guid");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
@@ -1561,7 +1561,7 @@ void ObjectMgr::LoadGameobjects()
// build single time for check spawnmask
std::map<uint32,uint32> spawnMasks;
for (uint32 i = 0; i < sMapStore.GetNumRows(); ++i)
- if(sMapStore.LookupEntry(i))
+ if (sMapStore.LookupEntry(i))
for (int k = 0; k < MAX_DIFFICULTY; ++k)
if (GetMapDifficultyData(i,Difficulty(k)))
spawnMasks[i] |= (1 << k);
@@ -1577,7 +1577,7 @@ void ObjectMgr::LoadGameobjects()
uint32 entry = fields[ 1].GetUInt32();
GameObjectInfo const* gInfo = GetGameObjectInfo(entry);
- if(!gInfo)
+ if (!gInfo)
{
sLog.outErrorDb("Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry);
continue;
@@ -1617,7 +1617,7 @@ void ObjectMgr::LoadGameobjects()
data.spawntimesecs = fields[11].GetInt32();
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
- if(!mapEntry)
+ if (!mapEntry)
{
sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) that spawned at not existed map (Id: %u), skip", guid, data.id, data.mapid);
continue;
@@ -1687,7 +1687,7 @@ void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data)
uint8 mask = data->spawnMask;
for (uint8 i = 0; mask != 0; i++, mask >>= 1)
{
- if(mask & 1)
+ if (mask & 1)
{
CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
@@ -1703,7 +1703,7 @@ void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data
uint8 mask = data->spawnMask;
for (uint8 i = 0; mask != 0; i++, mask >>= 1)
{
- if(mask & 1)
+ if (mask & 1)
{
CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
@@ -1760,7 +1760,7 @@ void ObjectMgr::LoadGameobjectRespawnTimes()
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT guid,respawntime,instance FROM gameobject_respawn");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
@@ -1800,7 +1800,7 @@ uint64 ObjectMgr::GetPlayerGUIDByName(std::string name) const
// Player name safe to sending to DB (checked at login) and this function using
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT guid FROM characters WHERE name = '%s'", name.c_str());
- if(result)
+ if (result)
guid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
return guid;
@@ -1809,7 +1809,7 @@ uint64 ObjectMgr::GetPlayerGUIDByName(std::string name) const
bool ObjectMgr::GetPlayerNameByGUID(const uint64 &guid, std::string &name) const
{
// prevent DB access for online player
- if(Player* player = GetPlayer(guid))
+ if (Player* player = GetPlayer(guid))
{
name = player->GetName();
return true;
@@ -1817,7 +1817,7 @@ bool ObjectMgr::GetPlayerNameByGUID(const uint64 &guid, std::string &name) const
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid = '%u'", GUID_LOPART(guid));
- if(result)
+ if (result)
{
name = (*result)[0].GetCppString();
return true;
@@ -1829,14 +1829,14 @@ bool ObjectMgr::GetPlayerNameByGUID(const uint64 &guid, std::string &name) const
uint32 ObjectMgr::GetPlayerTeamByGUID(const uint64 &guid) const
{
// prevent DB access for online player
- if(Player* player = GetPlayer(guid))
+ if (Player* player = GetPlayer(guid))
{
return Player::TeamForRace(player->getRace());
}
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT race FROM characters WHERE guid = '%u'", GUID_LOPART(guid));
- if(result)
+ if (result)
{
uint8 race = (*result)[0].GetUInt8();
return Player::TeamForRace(race);
@@ -1848,13 +1848,13 @@ uint32 ObjectMgr::GetPlayerTeamByGUID(const uint64 &guid) const
uint32 ObjectMgr::GetPlayerAccountIdByGUID(const uint64 &guid) const
{
// prevent DB access for online player
- if(Player* player = GetPlayer(guid))
+ if (Player* player = GetPlayer(guid))
{
return player->GetSession()->GetAccountId();
}
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE guid = '%u'", GUID_LOPART(guid));
- if(result)
+ if (result)
{
uint32 acc = (*result)[0].GetUInt32();
return acc;
@@ -1866,7 +1866,7 @@ uint32 ObjectMgr::GetPlayerAccountIdByGUID(const uint64 &guid) const
uint32 ObjectMgr::GetPlayerAccountIdByPlayerName(const std::string& name) const
{
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", name.c_str());
- if(result)
+ if (result)
{
uint32 acc = (*result)[0].GetUInt32();
return acc;
@@ -1881,7 +1881,7 @@ void ObjectMgr::LoadItemLocales()
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,name_loc1,description_loc1,name_loc2,description_loc2,name_loc3,description_loc3,name_loc4,description_loc4,name_loc5,description_loc5,name_loc6,description_loc6,name_loc7,description_loc7,name_loc8,description_loc8 FROM locales_item");
- if(!result)
+ if (!result)
return;
barGoLink bar(result->GetRowCount());
@@ -1898,12 +1898,12 @@ void ObjectMgr::LoadItemLocales()
for (uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[1+2*(i-1)].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.Name.size() <= idx)
+ if (data.Name.size() <= idx)
data.Name.resize(idx+1);
data.Name[idx] = str;
@@ -1911,12 +1911,12 @@ void ObjectMgr::LoadItemLocales()
}
str = fields[1+2*(i-1)+1].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.Description.size() <= idx)
+ if (data.Description.size() <= idx)
data.Description.resize(idx+1);
data.Description[idx] = str;
@@ -1968,7 +1968,7 @@ void ObjectMgr::LoadItemPrototypes()
}
/* disabled: have some strange wrong cases for Subclass values.
for enable also uncomment Subclass field in ItemEntry structure and in Itemfmt[]
- if(proto->SubClass != dbcitem->SubClass)
+ if (proto->SubClass != dbcitem->SubClass)
{
sLog.outErrorDb("Item (Entry: %u) not correct (Class: %u, Sub: %u) pair, must be (Class: %u, Sub: %u) (still using DB value).",i,proto->Class,proto->SubClass,dbcitem->Class,dbcitem->SubClass);
// It safe let use Subclass from DB
@@ -2058,10 +2058,10 @@ void ObjectMgr::LoadItemPrototypes()
if (req)
{
- if(!(proto->AllowableClass & CLASSMASK_ALL_PLAYABLE))
+ if (!(proto->AllowableClass & CLASSMASK_ALL_PLAYABLE))
sLog.outErrorDb("Item (Entry: %u) not have in `AllowableClass` any playable classes (%u) and can't be equipped or use.",i,proto->AllowableClass);
- if(!(proto->AllowableRace & RACEMASK_ALL_PLAYABLE))
+ if (!(proto->AllowableRace & RACEMASK_ALL_PLAYABLE))
sLog.outErrorDb("Item (Entry: %u) not have in `AllowableRace` any playable races (%u) and can't be equipped or use.",i,proto->AllowableRace);
}
}
@@ -2138,7 +2138,7 @@ void ObjectMgr::LoadItemPrototypes()
for (uint8 j = 0; j < MAX_ITEM_PROTO_DAMAGES; ++j)
{
- if(proto->Damage[j].DamageType >= MAX_SPELL_SCHOOL)
+ if (proto->Damage[j].DamageType >= MAX_SPELL_SCHOOL)
{
sLog.outErrorDb("Item (Entry: %u) has wrong dmg_type%d (%u)",i,j+1,proto->Damage[j].DamageType);
const_cast<ItemPrototype*>(proto)->Damage[j].DamageType = 0;
@@ -2220,7 +2220,7 @@ void ObjectMgr::LoadItemPrototypes()
const_cast<ItemPrototype*>(proto)->Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
}
- if(proto->Spells[j].SpellId)
+ if (proto->Spells[j].SpellId)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(proto->Spells[j].SpellId);
if (!spellInfo)
@@ -2350,12 +2350,12 @@ void ObjectMgr::LoadItemPrototypes()
for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j)
{
- if(entry->ItemId[j] <= 0)
+ if (entry->ItemId[j] <= 0)
continue;
uint32 item_id = entry->ItemId[j];
- if(!GetItemPrototype(item_id))
+ if (!GetItemPrototype(item_id))
notFoundOutfit.insert(item_id);
}
}
@@ -2543,16 +2543,16 @@ void ObjectMgr::LoadPetLevelInfo()
Field* fields = result->Fetch();
uint32 creature_id = fields[0].GetUInt32();
- if(!sCreatureStorage.LookupEntry<CreatureInfo>(creature_id))
+ if (!sCreatureStorage.LookupEntry<CreatureInfo>(creature_id))
{
sLog.outErrorDb("Wrong creature id %u in `pet_levelstats` table, ignoring.",creature_id);
continue;
}
uint32 current_level = fields[1].GetUInt32();
- if(current_level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
+ if (current_level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
{
- if(current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
+ if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
sLog.outErrorDb("Wrong (> %u) level %u in `pet_levelstats` table, ignoring.",STRONG_MAX_LEVEL,current_level);
else
{
@@ -2561,7 +2561,7 @@ void ObjectMgr::LoadPetLevelInfo()
}
continue;
}
- else if(current_level < 1)
+ else if (current_level < 1)
{
sLog.outErrorDb("Wrong (<1) level %u in `pet_levelstats` table, ignoring.",current_level);
continue;
@@ -2569,7 +2569,7 @@ void ObjectMgr::LoadPetLevelInfo()
PetLevelInfo*& pInfoMapEntry = petInfo[creature_id];
- if(pInfoMapEntry==NULL)
+ if (pInfoMapEntry==NULL)
pInfoMapEntry = new PetLevelInfo[sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)];
// data for level 1 stored in [0] array element, ...
@@ -2599,7 +2599,7 @@ void ObjectMgr::LoadPetLevelInfo()
PetLevelInfo* pInfo = itr->second;
// fatal error if no level 1 data
- if(!pInfo || pInfo[0].health == 0 )
+ if (!pInfo || pInfo[0].health == 0 )
{
sLog.outErrorDb("Creature %u does not have pet stats data for Level 1!",itr->first);
exit(1);
@@ -2608,7 +2608,7 @@ void ObjectMgr::LoadPetLevelInfo()
// fill level gaps
for (uint8 level = 1; level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
{
- if(pInfo[level].health == 0)
+ if (pInfo[level].health == 0)
{
sLog.outErrorDb("Creature %u has no data for Level %i pet stats data, using data of Level %i.",itr->first,level+1, level);
pInfo[level] = pInfo[level-1];
@@ -2619,11 +2619,11 @@ void ObjectMgr::LoadPetLevelInfo()
PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) const
{
- if(level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
+ if (level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
level = sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL);
PetLevelInfoMap::const_iterator itr = petInfo.find(creature_id);
- if(itr == petInfo.end())
+ if (itr == petInfo.end())
return NULL;
return &itr->second[level-1]; // data for level 1 stored in [0] array element, ...
@@ -2662,39 +2662,39 @@ void ObjectMgr::LoadPlayerInfo()
float positionY = fields[5].GetFloat();
float positionZ = fields[6].GetFloat();
- if(current_race >= MAX_RACES)
+ if (current_race >= MAX_RACES)
{
sLog.outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.",current_race);
continue;
}
ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race);
- if(!rEntry)
+ if (!rEntry)
{
sLog.outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.",current_race);
continue;
}
- if(current_class >= MAX_CLASSES)
+ if (current_class >= MAX_CLASSES)
{
sLog.outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.",current_class);
continue;
}
- if(!sChrClassesStore.LookupEntry(current_class))
+ if (!sChrClassesStore.LookupEntry(current_class))
{
sLog.outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.",current_class);
continue;
}
// accept DB data only for valid position (and non instanceable)
- if( !MapManager::IsValidMapCoord(mapId,positionX,positionY,positionZ) )
+ if ( !MapManager::IsValidMapCoord(mapId,positionX,positionY,positionZ) )
{
sLog.outErrorDb("Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.",current_class,current_race);
continue;
}
- if( sMapStore.LookupEntry(mapId)->Instanceable() )
+ if ( sMapStore.LookupEntry(mapId)->Instanceable() )
{
sLog.outErrorDb("Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.",current_class,current_race);
continue;
@@ -2746,14 +2746,14 @@ void ObjectMgr::LoadPlayerInfo()
Field* fields = result->Fetch();
uint32 current_race = fields[0].GetUInt32();
- if(current_race >= MAX_RACES)
+ if (current_race >= MAX_RACES)
{
sLog.outErrorDb("Wrong race %u in `playercreateinfo_item` table, ignoring.",current_race);
continue;
}
uint32 current_class = fields[1].GetUInt32();
- if(current_class >= MAX_CLASSES)
+ if (current_class >= MAX_CLASSES)
{
sLog.outErrorDb("Wrong class %u in `playercreateinfo_item` table, ignoring.",current_class);
continue;
@@ -2763,7 +2763,7 @@ void ObjectMgr::LoadPlayerInfo()
uint32 item_id = fields[2].GetUInt32();
- if(!GetItemPrototype(item_id))
+ if (!GetItemPrototype(item_id))
{
sLog.outErrorDb("Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.",item_id,current_race,current_class);
continue;
@@ -2771,7 +2771,7 @@ void ObjectMgr::LoadPlayerInfo()
uint32 amount = fields[3].GetUInt32();
- if(!amount)
+ if (!amount)
{
sLog.outErrorDb("Item id %u (class %u race %u) have amount==0 in `playercreateinfo_item` table, ignoring.",item_id,current_race,current_class);
continue;
@@ -2794,7 +2794,7 @@ void ObjectMgr::LoadPlayerInfo()
{
QueryResult_AutoPtr result = QueryResult_AutoPtr(NULL);
- if(sWorld.getConfig(CONFIG_START_ALL_SPELLS))
+ if (sWorld.getConfig(CONFIG_START_ALL_SPELLS))
result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell_custom");
else
result = WorldDatabase.Query("SELECT race, class, Spell FROM playercreateinfo_spell");
@@ -2818,20 +2818,20 @@ void ObjectMgr::LoadPlayerInfo()
Field* fields = result->Fetch();
uint32 current_race = fields[0].GetUInt32();
- if(current_race >= MAX_RACES)
+ if (current_race >= MAX_RACES)
{
sLog.outErrorDb("Wrong race %u in `playercreateinfo_spell` table, ignoring.",current_race);
continue;
}
uint32 current_class = fields[1].GetUInt32();
- if(current_class >= MAX_CLASSES)
+ if (current_class >= MAX_CLASSES)
{
sLog.outErrorDb("Wrong class %u in `playercreateinfo_spell` table, ignoring.",current_class);
continue;
}
- if(!current_race || !current_class)
+ if (!current_race || !current_class)
{
uint32 min_race = current_race ? current_race : 1;
uint32 max_race = current_race ? current_race + 1 : MAX_RACES;
@@ -2879,14 +2879,14 @@ void ObjectMgr::LoadPlayerInfo()
Field* fields = result->Fetch();
uint32 current_race = fields[0].GetUInt32();
- if(current_race >= MAX_RACES)
+ if (current_race >= MAX_RACES)
{
sLog.outErrorDb("Wrong race %u in `playercreateinfo_action` table, ignoring.",current_race);
continue;
}
uint32 current_class = fields[1].GetUInt32();
- if(current_class >= MAX_CLASSES)
+ if (current_class >= MAX_CLASSES)
{
sLog.outErrorDb("Wrong class %u in `playercreateinfo_action` table, ignoring.",current_class);
continue;
@@ -2930,16 +2930,16 @@ void ObjectMgr::LoadPlayerInfo()
Field* fields = result->Fetch();
uint32 current_class = fields[0].GetUInt32();
- if(current_class >= MAX_CLASSES)
+ if (current_class >= MAX_CLASSES)
{
sLog.outErrorDb("Wrong class %u in `player_classlevelstats` table, ignoring.",current_class);
continue;
}
uint8 current_level = fields[1].GetUInt8();
- if(current_level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
+ if (current_level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
{
- if(current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
+ if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
sLog.outErrorDb("Wrong (> %u) level %u in `player_classlevelstats` table, ignoring.",STRONG_MAX_LEVEL,current_level);
else
{
@@ -2951,7 +2951,7 @@ void ObjectMgr::LoadPlayerInfo()
PlayerClassInfo* pClassInfo = &playerClassInfo[current_class];
- if(!pClassInfo->levelInfo)
+ if (!pClassInfo->levelInfo)
pClassInfo->levelInfo = new PlayerClassLevelInfo[sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)];
PlayerClassLevelInfo* pClassLevelInfo = &pClassInfo->levelInfo[current_level-1];
@@ -2972,13 +2972,13 @@ void ObjectMgr::LoadPlayerInfo()
for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
{
// skip non existed classes
- if(!sChrClassesStore.LookupEntry(class_))
+ if (!sChrClassesStore.LookupEntry(class_))
continue;
PlayerClassInfo* pClassInfo = &playerClassInfo[class_];
// fatal error if no level 1 data
- if(!pClassInfo->levelInfo || pClassInfo->levelInfo[0].basehealth == 0 )
+ if (!pClassInfo->levelInfo || pClassInfo->levelInfo[0].basehealth == 0 )
{
sLog.outErrorDb("Class %i Level 1 does not have health/mana data!",class_);
exit(1);
@@ -2987,7 +2987,7 @@ void ObjectMgr::LoadPlayerInfo()
// fill level gaps
for (uint8 level = 1; level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
{
- if(pClassInfo->levelInfo[level].basehealth == 0)
+ if (pClassInfo->levelInfo[level].basehealth == 0)
{
sLog.outErrorDb("Class %i Level %i does not have health/mana data. Using stats data of level %i.",class_,level+1, level);
pClassInfo->levelInfo[level] = pClassInfo->levelInfo[level-1];
@@ -3020,23 +3020,23 @@ void ObjectMgr::LoadPlayerInfo()
Field* fields = result->Fetch();
uint32 current_race = fields[0].GetUInt32();
- if(current_race >= MAX_RACES)
+ if (current_race >= MAX_RACES)
{
sLog.outErrorDb("Wrong race %u in `player_levelstats` table, ignoring.",current_race);
continue;
}
uint32 current_class = fields[1].GetUInt32();
- if(current_class >= MAX_CLASSES)
+ if (current_class >= MAX_CLASSES)
{
sLog.outErrorDb("Wrong class %u in `player_levelstats` table, ignoring.",current_class);
continue;
}
uint32 current_level = fields[2].GetUInt32();
- if(current_level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
+ if (current_level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
{
- if(current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
+ if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
sLog.outErrorDb("Wrong (> %u) level %u in `player_levelstats` table, ignoring.",STRONG_MAX_LEVEL,current_level);
else
{
@@ -3048,7 +3048,7 @@ void ObjectMgr::LoadPlayerInfo()
PlayerInfo* pInfo = &playerInfo[current_race][current_class];
- if(!pInfo->levelInfo)
+ if (!pInfo->levelInfo)
pInfo->levelInfo = new PlayerLevelInfo[sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)];
PlayerLevelInfo* pLevelInfo = &pInfo->levelInfo[current_level-1];
@@ -3071,19 +3071,19 @@ void ObjectMgr::LoadPlayerInfo()
for (int race = 0; race < MAX_RACES; ++race)
{
// skip non existed races
- if(!sChrRacesStore.LookupEntry(race))
+ if (!sChrRacesStore.LookupEntry(race))
continue;
for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
{
// skip non existed classes
- if(!sChrClassesStore.LookupEntry(class_))
+ if (!sChrClassesStore.LookupEntry(class_))
continue;
PlayerInfo* pInfo = &playerInfo[race][class_];
// skip non loaded combinations
- if(!pInfo->displayId_m || !pInfo->displayId_f)
+ if (!pInfo->displayId_m || !pInfo->displayId_f)
continue;
// skip expansion races if not playing with expansion
@@ -3095,7 +3095,7 @@ void ObjectMgr::LoadPlayerInfo()
continue;
// fatal error if no level 1 data
- if(!pInfo->levelInfo || pInfo->levelInfo[0].stats[0] == 0 )
+ if (!pInfo->levelInfo || pInfo->levelInfo[0].stats[0] == 0 )
{
sLog.outErrorDb("Race %i Class %i Level 1 does not have stats data!",race,class_);
exit(1);
@@ -3104,7 +3104,7 @@ void ObjectMgr::LoadPlayerInfo()
// fill level gaps
for (uint8 level = 1; level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
{
- if(pInfo->levelInfo[level].stats[0] == 0)
+ if (pInfo->levelInfo[level].stats[0] == 0)
{
sLog.outErrorDb("Race %i Class %i Level %i does not have stats data. Using stats data of level %i.",race,class_,level+1, level);
pInfo->levelInfo[level] = pInfo->levelInfo[level-1];
@@ -3144,9 +3144,9 @@ void ObjectMgr::LoadPlayerInfo()
uint32 current_level = fields[0].GetUInt32();
uint32 current_xp = fields[1].GetUInt32();
- if(current_level >= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
+ if (current_level >= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
{
- if(current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
+ if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
sLog.outErrorDb("Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL,current_level);
else
{
@@ -3370,7 +3370,7 @@ void ObjectMgr::LoadArenaTeams()
"EmblemColor,BorderStyle,BorderColor, rating,games,wins,played,wins2,rank "
"FROM arena_team LEFT JOIN arena_team_stats ON arena_team.arenateamid = arena_team_stats.arenateamid ORDER BY arena_team.arenateamid ASC" );
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
@@ -3421,7 +3421,7 @@ void ObjectMgr::LoadGroups()
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty, leaderGuid FROM groups");
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
@@ -3442,7 +3442,7 @@ void ObjectMgr::LoadGroups()
leaderGuid = MAKE_NEW_GUID(fields[14].GetUInt32(),0,HIGHGUID_PLAYER);
group = new Group;
- if(!group->LoadGroupFromDB(leaderGuid, result, false))
+ if (!group->LoadGroupFromDB(leaderGuid, result, false))
{
group->Disband();
delete group;
@@ -3460,7 +3460,7 @@ void ObjectMgr::LoadGroups()
leaderGuid = 0;
// 2 3 4 1 1
result = CharacterDatabase.Query("SELECT memberGuid, memberFlags, subgroup, leaderGuid FROM group_member ORDER BY leaderGuid");
- if(!result)
+ if (!result)
{
barGoLink bar2( 1 );
bar2.step();
@@ -3474,10 +3474,10 @@ void ObjectMgr::LoadGroups()
Field *fields = result->Fetch();
count++;
leaderGuid = MAKE_NEW_GUID(fields[3].GetUInt32(), 0, HIGHGUID_PLAYER);
- if(!group || group->GetLeaderGUID() != leaderGuid)
+ if (!group || group->GetLeaderGUID() != leaderGuid)
{
group = GetGroupByLeader(leaderGuid);
- if(!group)
+ if (!group)
{
sLog.outErrorDb("Incorrect entry in group_member table : no group with leader %d for member %d!", fields[3].GetUInt32(), fields[0].GetUInt32());
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%d'", fields[0].GetUInt32());
@@ -3485,7 +3485,7 @@ void ObjectMgr::LoadGroups()
}
}
- if(!group->LoadMemberFromDB(fields[0].GetUInt32(), fields[1].GetUInt8(), fields[2].GetUInt8()))
+ if (!group->LoadMemberFromDB(fields[0].GetUInt32(), fields[1].GetUInt8(), fields[2].GetUInt8()))
{
sLog.outErrorDb("Incorrect entry in group_member table : member %d cannot be added to player %d's group!", fields[0].GetUInt32(), fields[3].GetUInt32());
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%d'", fields[0].GetUInt32());
@@ -3497,7 +3497,7 @@ void ObjectMgr::LoadGroups()
// TODO: maybe delete from the DB before loading in this case
for (GroupSet::iterator itr = mGroupSet.begin(); itr != mGroupSet.end();)
{
- if((*itr)->GetMembersCount() < 2)
+ if ((*itr)->GetMembersCount() < 2)
{
(*itr)->Disband();
delete *itr;
@@ -3519,7 +3519,7 @@ void ObjectMgr::LoadGroups()
"FROM group_instance LEFT JOIN instance ON instance = id ORDER BY leaderGuid"
);
- if(!result)
+ if (!result)
{
barGoLink bar2( 1 );
bar2.step();
@@ -3533,10 +3533,10 @@ void ObjectMgr::LoadGroups()
Field *fields = result->Fetch();
count++;
leaderGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
- if(!group || group->GetLeaderGUID() != leaderGuid)
+ if (!group || group->GetLeaderGUID() != leaderGuid)
{
group = GetGroupByLeader(leaderGuid);
- if(!group)
+ if (!group)
{
sLog.outErrorDb("Incorrect entry in group_instance table : no group with leader %d", fields[0].GetUInt32());
continue;
@@ -3544,14 +3544,14 @@ void ObjectMgr::LoadGroups()
}
MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt32());
- if(!mapEntry || !mapEntry->IsDungeon())
+ if (!mapEntry || !mapEntry->IsDungeon())
{
sLog.outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt32());
continue;
}
uint32 diff = fields[4].GetUInt8();
- if(diff >= (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
+ if (diff >= (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
{
sLog.outErrorDb("Wrong dungeon difficulty use in group_instance table: %d", diff + 1);
diff = 0; // default for both difficaly types
@@ -3615,7 +3615,7 @@ void ObjectMgr::LoadQuests()
// 142 143
"StartScript, CompleteScript"
" FROM quest_template");
- if(result == NULL)
+ if (result == NULL)
{
barGoLink bar( 1 );
bar.step();
@@ -3648,7 +3648,7 @@ void ObjectMgr::LoadQuests()
// additional quest integrity checks (GO, creature_template and item_template must be loaded already)
- if( qinfo->GetQuestMethod() >= 3 )
+ if ( qinfo->GetQuestMethod() >= 3 )
{
sLog.outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.",qinfo->GetQuestId(),qinfo->GetQuestMethod());
}
@@ -3660,21 +3660,21 @@ void ObjectMgr::LoadQuests()
qinfo->QuestFlags &= QUEST_TRINITY_FLAGS_DB_ALLOWED;
}
- if(qinfo->QuestFlags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY))
+ if (qinfo->QuestFlags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY))
{
- if(!(qinfo->QuestFlags & QUEST_TRINITY_FLAGS_REPEATABLE))
+ if (!(qinfo->QuestFlags & QUEST_TRINITY_FLAGS_REPEATABLE))
{
sLog.outErrorDb("Daily Quest %u not marked as repeatable in `SpecialFlags`, added.",qinfo->GetQuestId());
qinfo->QuestFlags |= QUEST_TRINITY_FLAGS_REPEATABLE;
}
}
- if(qinfo->QuestFlags & QUEST_FLAGS_AUTO_REWARDED)
+ if (qinfo->QuestFlags & QUEST_FLAGS_AUTO_REWARDED)
{
// at auto-reward can be rewarded only RewChoiceItemId[0]
for (uint8 j = 1; j < QUEST_REWARD_CHOICES_COUNT; ++j )
{
- if(uint32 id = qinfo->RewChoiceItemId[j])
+ if (uint32 id = qinfo->RewChoiceItemId[j])
{
sLog.outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but item from `RewChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_AUTO_REWARDED.",
qinfo->GetQuestId(),j+1,id,j+1);
@@ -3684,9 +3684,9 @@ void ObjectMgr::LoadQuests()
}
// client quest log visual (area case)
- if( qinfo->ZoneOrSort > 0 )
+ if ( qinfo->ZoneOrSort > 0 )
{
- if(!GetAreaEntryByAreaID(qinfo->ZoneOrSort))
+ if (!GetAreaEntryByAreaID(qinfo->ZoneOrSort))
{
sLog.outErrorDb("Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.",
qinfo->GetQuestId(),qinfo->ZoneOrSort);
@@ -3694,30 +3694,30 @@ void ObjectMgr::LoadQuests()
}
}
// client quest log visual (sort case)
- if( qinfo->ZoneOrSort < 0 )
+ if ( qinfo->ZoneOrSort < 0 )
{
QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->ZoneOrSort));
- if( !qSort )
+ if ( !qSort )
{
sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.",
qinfo->GetQuestId(),qinfo->ZoneOrSort);
// no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check)
}
//check SkillOrClass value (class case).
- if( ClassByQuestSort(-int32(qinfo->ZoneOrSort)) )
+ if ( ClassByQuestSort(-int32(qinfo->ZoneOrSort)) )
{
// SkillOrClass should not have class case when class case already set in ZoneOrSort.
- if(qinfo->SkillOrClass < 0)
+ if (qinfo->SkillOrClass < 0)
{
sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i (class sort case) and `SkillOrClass` = %i (class case), redundant.",
qinfo->GetQuestId(),qinfo->ZoneOrSort,qinfo->SkillOrClass);
}
}
//check for proper SkillOrClass value (skill case)
- if(int32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort)))
+ if (int32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort)))
{
// skill is positive value in SkillOrClass
- if(qinfo->SkillOrClass != skill_id )
+ if (qinfo->SkillOrClass != skill_id )
{
sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i (skill sort case) but `SkillOrClass` does not have a corresponding value (%i).",
qinfo->GetQuestId(),qinfo->ZoneOrSort,skill_id);
@@ -3727,34 +3727,34 @@ void ObjectMgr::LoadQuests()
}
// SkillOrClass (class case)
- if( qinfo->SkillOrClass < 0 )
+ if ( qinfo->SkillOrClass < 0 )
{
- if( !sChrClassesStore.LookupEntry(-int32(qinfo->SkillOrClass)) )
+ if ( !sChrClassesStore.LookupEntry(-int32(qinfo->SkillOrClass)) )
{
sLog.outErrorDb("Quest %u has `SkillOrClass` = %i (class case) but class (%i) does not exist",
qinfo->GetQuestId(),qinfo->SkillOrClass,-qinfo->SkillOrClass);
}
}
// SkillOrClass (skill case)
- if( qinfo->SkillOrClass > 0 )
+ if ( qinfo->SkillOrClass > 0 )
{
- if( !sSkillLineStore.LookupEntry(qinfo->SkillOrClass) )
+ if ( !sSkillLineStore.LookupEntry(qinfo->SkillOrClass) )
{
sLog.outErrorDb("Quest %u has `SkillOrClass` = %u (skill case) but skill (%i) does not exist",
qinfo->GetQuestId(),qinfo->SkillOrClass,qinfo->SkillOrClass);
}
}
- if( qinfo->RequiredSkillValue )
+ if ( qinfo->RequiredSkillValue )
{
- if( qinfo->RequiredSkillValue > sWorld.GetConfigMaxSkillValue() )
+ if ( qinfo->RequiredSkillValue > sWorld.GetConfigMaxSkillValue() )
{
sLog.outErrorDb("Quest %u has `RequiredSkillValue` = %u but max possible skill is %u, quest can't be done.",
qinfo->GetQuestId(),qinfo->RequiredSkillValue,sWorld.GetConfigMaxSkillValue());
// no changes, quest can't be done for this requirement
}
- if( qinfo->SkillOrClass <= 0 )
+ if ( qinfo->SkillOrClass <= 0 )
{
sLog.outErrorDb("Quest %u has `RequiredSkillValue` = %u but `SkillOrClass` = %i (class case), value ignored.",
qinfo->GetQuestId(),qinfo->RequiredSkillValue,qinfo->SkillOrClass);
@@ -3763,77 +3763,77 @@ void ObjectMgr::LoadQuests()
}
// else Skill quests can have 0 skill level, this is ok
- if(qinfo->RepObjectiveFaction2 && !sFactionStore.LookupEntry(qinfo->RepObjectiveFaction2))
+ if (qinfo->RepObjectiveFaction2 && !sFactionStore.LookupEntry(qinfo->RepObjectiveFaction2))
{
sLog.outErrorDb("Quest %u has `RepObjectiveFaction2` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(),qinfo->RepObjectiveFaction2,qinfo->RepObjectiveFaction2);
// no changes, quest can't be done for this requirement
}
- if(qinfo->RepObjectiveFaction && !sFactionStore.LookupEntry(qinfo->RepObjectiveFaction))
+ if (qinfo->RepObjectiveFaction && !sFactionStore.LookupEntry(qinfo->RepObjectiveFaction))
{
sLog.outErrorDb("Quest %u has `RepObjectiveFaction` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(),qinfo->RepObjectiveFaction,qinfo->RepObjectiveFaction);
// no changes, quest can't be done for this requirement
}
- if(qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction))
+ if (qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction))
{
sLog.outErrorDb("Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(),qinfo->RequiredMinRepFaction,qinfo->RequiredMinRepFaction);
// no changes, quest can't be done for this requirement
}
- if(qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction))
+ if (qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction))
{
sLog.outErrorDb("Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(),qinfo->RequiredMaxRepFaction,qinfo->RequiredMaxRepFaction);
// no changes, quest can't be done for this requirement
}
- if(qinfo->RequiredMinRepValue && qinfo->RequiredMinRepValue > ReputationMgr::Reputation_Cap)
+ if (qinfo->RequiredMinRepValue && qinfo->RequiredMinRepValue > ReputationMgr::Reputation_Cap)
{
sLog.outErrorDb("Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.",
qinfo->GetQuestId(),qinfo->RequiredMinRepValue,ReputationMgr::Reputation_Cap);
// no changes, quest can't be done for this requirement
}
- if(qinfo->RequiredMinRepValue && qinfo->RequiredMaxRepValue && qinfo->RequiredMaxRepValue <= qinfo->RequiredMinRepValue)
+ if (qinfo->RequiredMinRepValue && qinfo->RequiredMaxRepValue && qinfo->RequiredMaxRepValue <= qinfo->RequiredMinRepValue)
{
sLog.outErrorDb("Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.",
qinfo->GetQuestId(),qinfo->RequiredMaxRepValue,qinfo->RequiredMinRepValue);
// no changes, quest can't be done for this requirement
}
- if(!qinfo->RepObjectiveFaction && qinfo->RepObjectiveValue > 0 )
+ if (!qinfo->RepObjectiveFaction && qinfo->RepObjectiveValue > 0 )
{
sLog.outErrorDb("Quest %u has `RepObjectiveValue` = %d but `RepObjectiveFaction` is 0, value has no effect",
qinfo->GetQuestId(),qinfo->RepObjectiveValue);
// warning
}
- if(!qinfo->RepObjectiveFaction2 && qinfo->RepObjectiveValue2 > 0 )
+ if (!qinfo->RepObjectiveFaction2 && qinfo->RepObjectiveValue2 > 0 )
{
sLog.outErrorDb("Quest %u has `RepObjectiveValue2` = %d but `RepObjectiveFaction2` is 0, value has no effect",
qinfo->GetQuestId(),qinfo->RepObjectiveValue2);
// warning
}
- if(!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue > 0 )
+ if (!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue > 0 )
{
sLog.outErrorDb("Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect",
qinfo->GetQuestId(),qinfo->RequiredMinRepValue);
// warning
}
- if(!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue > 0 )
+ if (!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue > 0 )
{
sLog.outErrorDb("Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect",
qinfo->GetQuestId(),qinfo->RequiredMaxRepValue);
// warning
}
- if(qinfo->CharTitleId && !sCharTitlesStore.LookupEntry(qinfo->CharTitleId))
+ if (qinfo->CharTitleId && !sCharTitlesStore.LookupEntry(qinfo->CharTitleId))
{
sLog.outErrorDb("Quest %u has `CharTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.",
qinfo->GetQuestId(),qinfo->GetCharTitleId(),qinfo->GetCharTitleId());
@@ -3841,38 +3841,38 @@ void ObjectMgr::LoadQuests()
// quest can't reward this title
}
- if(qinfo->SrcItemId)
+ if (qinfo->SrcItemId)
{
- if(!sItemStorage.LookupEntry<ItemPrototype>(qinfo->SrcItemId))
+ if (!sItemStorage.LookupEntry<ItemPrototype>(qinfo->SrcItemId))
{
sLog.outErrorDb("Quest %u has `SrcItemId` = %u but item with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(),qinfo->SrcItemId,qinfo->SrcItemId);
qinfo->SrcItemId = 0; // quest can't be done for this requirement
}
- else if(qinfo->SrcItemCount==0)
+ else if (qinfo->SrcItemCount==0)
{
sLog.outErrorDb("Quest %u has `SrcItemId` = %u but `SrcItemCount` = 0, set to 1 but need fix in DB.",
qinfo->GetQuestId(),qinfo->SrcItemId);
qinfo->SrcItemCount = 1; // update to 1 for allow quest work for backward compatibility with DB
}
}
- else if(qinfo->SrcItemCount>0)
+ else if (qinfo->SrcItemCount>0)
{
sLog.outErrorDb("Quest %u has `SrcItemId` = 0 but `SrcItemCount` = %u, useless value.",
qinfo->GetQuestId(),qinfo->SrcItemCount);
qinfo->SrcItemCount=0; // no quest work changes in fact
}
- if(qinfo->SrcSpell)
+ if (qinfo->SrcSpell)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->SrcSpell);
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outErrorDb("Quest %u has `SrcSpell` = %u but spell %u doesn't exist, quest can't be done.",
qinfo->GetQuestId(),qinfo->SrcSpell,qinfo->SrcSpell);
qinfo->SrcSpell = 0; // quest can't be done for this requirement
}
- else if(!SpellMgr::IsSpellValid(spellInfo))
+ else if (!SpellMgr::IsSpellValid(spellInfo))
{
sLog.outErrorDb("Quest %u has `SrcSpell` = %u but spell %u is broken, quest can't be done.",
qinfo->GetQuestId(),qinfo->SrcSpell,qinfo->SrcSpell);
@@ -3883,9 +3883,9 @@ void ObjectMgr::LoadQuests()
for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j )
{
uint32 id = qinfo->ReqItemId[j];
- if(id)
+ if (id)
{
- if(qinfo->ReqItemCount[j]==0)
+ if (qinfo->ReqItemCount[j]==0)
{
sLog.outErrorDb("Quest %u has `ReqItemId%d` = %u but `ReqItemCount%d` = 0, quest can't be done.",
qinfo->GetQuestId(),j+1,id,j+1);
@@ -3894,14 +3894,14 @@ void ObjectMgr::LoadQuests()
qinfo->SetFlag(QUEST_TRINITY_FLAGS_DELIVER);
- if(!sItemStorage.LookupEntry<ItemPrototype>(id))
+ if (!sItemStorage.LookupEntry<ItemPrototype>(id))
{
sLog.outErrorDb("Quest %u has `ReqItemId%d` = %u but item with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(),j+1,id,id);
qinfo->ReqItemCount[j] = 0; // prevent incorrect work of quest
}
}
- else if(qinfo->ReqItemCount[j]>0)
+ else if (qinfo->ReqItemCount[j]>0)
{
sLog.outErrorDb("Quest %u has `ReqItemId%d` = 0 but `ReqItemCount%d` = %u, quest can't be done.",
qinfo->GetQuestId(),j+1,j+1,qinfo->ReqItemCount[j]);
@@ -3912,9 +3912,9 @@ void ObjectMgr::LoadQuests()
for (uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j )
{
uint32 id = qinfo->ReqSourceId[j];
- if(id)
+ if (id)
{
- if(!sItemStorage.LookupEntry<ItemPrototype>(id))
+ if (!sItemStorage.LookupEntry<ItemPrototype>(id))
{
sLog.outErrorDb("Quest %u has `ReqSourceId%d` = %u but item with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(),j+1,id,id);
@@ -3923,7 +3923,7 @@ void ObjectMgr::LoadQuests()
}
else
{
- if(qinfo->ReqSourceCount[j]>0)
+ if (qinfo->ReqSourceCount[j]>0)
{
sLog.outErrorDb("Quest %u has `ReqSourceId%d` = 0 but `ReqSourceCount%d` = %u.",
qinfo->GetQuestId(),j+1,j+1,qinfo->ReqSourceCount[j]);
@@ -3935,17 +3935,17 @@ void ObjectMgr::LoadQuests()
for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j )
{
uint32 id = qinfo->ReqSpell[j];
- if(id)
+ if (id)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(id);
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outErrorDb("Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.",
qinfo->GetQuestId(),j+1,id,id);
continue;
}
- if(!qinfo->ReqCreatureOrGOId[j])
+ if (!qinfo->ReqCreatureOrGOId[j])
{
bool found = false;
for (uint8 k = 0; k < 3; ++k)
@@ -3958,9 +3958,9 @@ void ObjectMgr::LoadQuests()
}
}
- if(found)
+ if (found)
{
- if(!qinfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
+ if (!qinfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and ReqCreatureOrGOId%d = 0, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags or ReqCreatureOrGOId%d must be fixed, quest modified to enable objective.",spellInfo->Id,qinfo->QuestId,j+1,j+1);
@@ -3981,34 +3981,34 @@ void ObjectMgr::LoadQuests()
for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j )
{
int32 id = qinfo->ReqCreatureOrGOId[j];
- if(id < 0 && !sGOStorage.LookupEntry<GameObjectInfo>(-id))
+ if (id < 0 && !sGOStorage.LookupEntry<GameObjectInfo>(-id))
{
sLog.outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %i but gameobject %u does not exist, quest can't be done.",
qinfo->GetQuestId(),j+1,id,uint32(-id));
qinfo->ReqCreatureOrGOId[j] = 0; // quest can't be done for this requirement
}
- if(id > 0 && !sCreatureStorage.LookupEntry<CreatureInfo>(id))
+ if (id > 0 && !sCreatureStorage.LookupEntry<CreatureInfo>(id))
{
sLog.outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %i but creature with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(),j+1,id,uint32(id));
qinfo->ReqCreatureOrGOId[j] = 0; // quest can't be done for this requirement
}
- if(id)
+ if (id)
{
// In fact SpeakTo and Kill are quite same: either you can speak to mob:SpeakTo or you can't:Kill/Cast
qinfo->SetFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO);
- if(!qinfo->ReqCreatureOrGOCount[j])
+ if (!qinfo->ReqCreatureOrGOCount[j])
{
sLog.outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %u but `ReqCreatureOrGOCount%d` = 0, quest can't be done.",
qinfo->GetQuestId(),j+1,id,j+1);
// no changes, quest can be incorrectly done, but we already report this
}
}
- else if(qinfo->ReqCreatureOrGOCount[j]>0)
+ else if (qinfo->ReqCreatureOrGOCount[j]>0)
{
sLog.outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = 0 but `ReqCreatureOrGOCount%d` = %u.",
qinfo->GetQuestId(),j+1,j+1,qinfo->ReqCreatureOrGOCount[j]);
@@ -4019,23 +4019,23 @@ void ObjectMgr::LoadQuests()
for (uint8 j = 0; j < QUEST_REWARD_CHOICES_COUNT; ++j )
{
uint32 id = qinfo->RewChoiceItemId[j];
- if(id)
+ if (id)
{
- if(!sItemStorage.LookupEntry<ItemPrototype>(id))
+ if (!sItemStorage.LookupEntry<ItemPrototype>(id))
{
sLog.outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
qinfo->GetQuestId(),j+1,id,id);
qinfo->RewChoiceItemId[j] = 0; // no changes, quest will not reward this
}
- if(!qinfo->RewChoiceItemCount[j])
+ if (!qinfo->RewChoiceItemCount[j])
{
sLog.outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but `RewChoiceItemCount%d` = 0, quest can't be done.",
qinfo->GetQuestId(),j+1,id,j+1);
// no changes, quest can't be done
}
}
- else if(qinfo->RewChoiceItemCount[j]>0)
+ else if (qinfo->RewChoiceItemCount[j]>0)
{
sLog.outErrorDb("Quest %u has `RewChoiceItemId%d` = 0 but `RewChoiceItemCount%d` = %u.",
qinfo->GetQuestId(),j+1,j+1,qinfo->RewChoiceItemCount[j]);
@@ -4046,23 +4046,23 @@ void ObjectMgr::LoadQuests()
for (uint8 j = 0; j < QUEST_REWARDS_COUNT; ++j )
{
uint32 id = qinfo->RewItemId[j];
- if(id)
+ if (id)
{
- if(!sItemStorage.LookupEntry<ItemPrototype>(id))
+ if (!sItemStorage.LookupEntry<ItemPrototype>(id))
{
sLog.outErrorDb("Quest %u has `RewItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
qinfo->GetQuestId(),j+1,id,id);
qinfo->RewItemId[j] = 0; // no changes, quest will not reward this item
}
- if(!qinfo->RewItemCount[j])
+ if (!qinfo->RewItemCount[j])
{
sLog.outErrorDb("Quest %u has `RewItemId%d` = %u but `RewItemCount%d` = 0, quest will not reward this item.",
qinfo->GetQuestId(),j+1,id,j+1);
// no changes
}
}
- else if(qinfo->RewItemCount[j]>0)
+ else if (qinfo->RewItemCount[j]>0)
{
sLog.outErrorDb("Quest %u has `RewItemId%d` = 0 but `RewItemCount%d` = %u.",
qinfo->GetQuestId(),j+1,j+1,qinfo->RewItemCount[j]);
@@ -4078,7 +4078,7 @@ void ObjectMgr::LoadQuests()
{
sLog.outErrorDb("Quest %u has RewRepValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewRepValueId[j]);
}
- if(!sFactionStore.LookupEntry(qinfo->RewRepFaction[j]))
+ if (!sFactionStore.LookupEntry(qinfo->RewRepFaction[j]))
{
sLog.outErrorDb("Quest %u has `RewRepFaction%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(),j+1,qinfo->RewRepFaction[j] ,qinfo->RewRepFaction[j] );
qinfo->RewRepFaction[j] = 0; // quest will not reward this
@@ -4086,7 +4086,7 @@ void ObjectMgr::LoadQuests()
}
- else if(qinfo->RewRepValue[j]!=0)
+ else if (qinfo->RewRepValue[j]!=0)
{
sLog.outErrorDb("Quest %u has `RewRepFaction%d` = 0 but `RewRepValue%d` = %i.",
qinfo->GetQuestId(),j+1,j+1,qinfo->RewRepValue[j]);
@@ -4095,25 +4095,25 @@ void ObjectMgr::LoadQuests()
}
- if(qinfo->RewSpell)
+ if (qinfo->RewSpell)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->RewSpell);
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u does not exist, spell removed as display reward.",
qinfo->GetQuestId(),qinfo->RewSpell,qinfo->RewSpell);
qinfo->RewSpell = 0; // no spell reward will display for this quest
}
- else if(!SpellMgr::IsSpellValid(spellInfo))
+ else if (!SpellMgr::IsSpellValid(spellInfo))
{
sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is broken, quest will not have a spell reward.",
qinfo->GetQuestId(),qinfo->RewSpell,qinfo->RewSpell);
qinfo->RewSpell = 0; // no spell reward will display for this quest
}
- else if(GetTalentSpellCost(qinfo->RewSpell))
+ else if (GetTalentSpellCost(qinfo->RewSpell))
{
sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is talent, quest will not have a spell reward.",
qinfo->GetQuestId(),qinfo->RewSpell,qinfo->RewSpell);
@@ -4121,25 +4121,25 @@ void ObjectMgr::LoadQuests()
}
}
- if(qinfo->RewSpellCast > 0)
+ if (qinfo->RewSpellCast > 0)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->RewSpellCast);
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outErrorDb("Quest %u has `RewSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.",
qinfo->GetQuestId(),qinfo->RewSpellCast,qinfo->RewSpellCast);
qinfo->RewSpellCast = 0; // no spell will be casted on player
}
- else if(!SpellMgr::IsSpellValid(spellInfo))
+ else if (!SpellMgr::IsSpellValid(spellInfo))
{
sLog.outErrorDb("Quest %u has `RewSpellCast` = %u but spell %u is broken, quest will not have a spell reward.",
qinfo->GetQuestId(),qinfo->RewSpellCast,qinfo->RewSpellCast);
qinfo->RewSpellCast = 0; // no spell will be casted on player
}
- else if(GetTalentSpellCost(qinfo->RewSpellCast))
+ else if (GetTalentSpellCost(qinfo->RewSpellCast))
{
sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is talent, quest will not have a spell reward.",
qinfo->GetQuestId(),qinfo->RewSpellCast,qinfo->RewSpellCast);
@@ -4171,7 +4171,7 @@ void ObjectMgr::LoadQuests()
if (qinfo->NextQuestInChain)
{
QuestMap::iterator qNextItr = mQuestTemplates.find(qinfo->NextQuestInChain);
- if(qNextItr == mQuestTemplates.end())
+ if (qNextItr == mQuestTemplates.end())
{
sLog.outErrorDb("Quest %u has `NextQuestInChain` = %u but quest %u does not exist, quest chain will not work.",
qinfo->GetQuestId(),qinfo->NextQuestInChain ,qinfo->NextQuestInChain );
@@ -4182,7 +4182,7 @@ void ObjectMgr::LoadQuests()
}
// fill additional data stores
- if(qinfo->PrevQuestId)
+ if (qinfo->PrevQuestId)
{
if (mQuestTemplates.find(abs(qinfo->GetPrevQuestId())) == mQuestTemplates.end())
{
@@ -4194,7 +4194,7 @@ void ObjectMgr::LoadQuests()
}
}
- if(qinfo->NextQuestId)
+ if (qinfo->NextQuestId)
{
QuestMap::iterator qNextItr = mQuestTemplates.find(abs(qinfo->GetNextQuestId()));
if (qNextItr == mQuestTemplates.end())
@@ -4208,9 +4208,9 @@ void ObjectMgr::LoadQuests()
}
}
- if(qinfo->ExclusiveGroup)
+ if (qinfo->ExclusiveGroup)
mExclusiveQuestGroups.insert(std::pair<int32, uint32>(qinfo->ExclusiveGroup, qinfo->GetQuestId()));
- if(qinfo->LimitTime)
+ if (qinfo->LimitTime)
qinfo->SetFlag(QUEST_TRINITY_FLAGS_TIMED);
}
@@ -4218,12 +4218,12 @@ void ObjectMgr::LoadQuests()
for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(i);
- if(!spellInfo)
+ if (!spellInfo)
continue;
for (uint8 j = 0; j < 3; ++j)
{
- if(spellInfo->Effect[j] != SPELL_EFFECT_QUEST_COMPLETE)
+ if (spellInfo->Effect[j] != SPELL_EFFECT_QUEST_COMPLETE)
continue;
uint32 quest_id = spellInfo->EffectMiscValue[j];
@@ -4231,10 +4231,10 @@ void ObjectMgr::LoadQuests()
Quest const* quest = GetQuestTemplate(quest_id);
// some quest referenced in spells not exist (outdated spells)
- if(!quest)
+ if (!quest)
continue;
- if(!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
+ if (!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u , but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.",spellInfo->Id,quest_id);
@@ -4264,7 +4264,7 @@ void ObjectMgr::LoadQuestLocales()
" FROM locales_quest"
);
- if(!result)
+ if (!result)
return;
barGoLink bar(result->GetRowCount());
@@ -4281,84 +4281,84 @@ void ObjectMgr::LoadQuestLocales()
for (uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[1+11*(i-1)].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.Title.size() <= idx)
+ if (data.Title.size() <= idx)
data.Title.resize(idx+1);
data.Title[idx] = str;
}
}
str = fields[1+11*(i-1)+1].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.Details.size() <= idx)
+ if (data.Details.size() <= idx)
data.Details.resize(idx+1);
data.Details[idx] = str;
}
}
str = fields[1+11*(i-1)+2].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.Objectives.size() <= idx)
+ if (data.Objectives.size() <= idx)
data.Objectives.resize(idx+1);
data.Objectives[idx] = str;
}
}
str = fields[1+11*(i-1)+3].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.OfferRewardText.size() <= idx)
+ if (data.OfferRewardText.size() <= idx)
data.OfferRewardText.resize(idx+1);
data.OfferRewardText[idx] = str;
}
}
str = fields[1+11*(i-1)+4].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.RequestItemsText.size() <= idx)
+ if (data.RequestItemsText.size() <= idx)
data.RequestItemsText.resize(idx+1);
data.RequestItemsText[idx] = str;
}
}
str = fields[1+11*(i-1)+5].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.EndText.size() <= idx)
+ if (data.EndText.size() <= idx)
data.EndText.resize(idx+1);
data.EndText[idx] = str;
}
}
str = fields[1+11*(i-1)+6].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.CompletedText.size() <= idx)
+ if (data.CompletedText.size() <= idx)
data.CompletedText.resize(idx+1);
data.CompletedText[idx] = str;
@@ -4368,12 +4368,12 @@ void ObjectMgr::LoadQuestLocales()
for (uint8 k = 0; k < 4; ++k)
{
str = fields[1+11*(i-1)+7+k].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.ObjectiveText[k].size() <= idx)
+ if (data.ObjectiveText[k].size() <= idx)
data.ObjectiveText[k].resize(idx+1);
data.ObjectiveText[k][idx] = str;
@@ -4389,7 +4389,7 @@ void ObjectMgr::LoadQuestLocales()
void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
{
- if(sWorld.IsScriptScheduled()) // function don't must be called in time scripts use.
+ if (sWorld.IsScriptScheduled()) // function don't must be called in time scripts use.
return;
sLog.outString( "%s :", tablename);
@@ -4400,7 +4400,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
uint32 count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
bar.step();
@@ -4434,29 +4434,29 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
{
case SCRIPT_COMMAND_TALK:
{
- if(tmp.datalong > 4)
+ if (tmp.datalong > 4)
{
sLog.outErrorDb("Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u",tablename,tmp.datalong,tmp.id);
continue;
}
- if(tmp.dataint==0)
+ if (tmp.dataint==0)
{
sLog.outErrorDb("Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u",tablename,tmp.dataint,tmp.id);
continue;
}
- if(tmp.dataint < MIN_DB_SCRIPT_STRING_ID || tmp.dataint >= MAX_DB_SCRIPT_STRING_ID)
+ if (tmp.dataint < MIN_DB_SCRIPT_STRING_ID || tmp.dataint >= MAX_DB_SCRIPT_STRING_ID)
{
sLog.outErrorDb("Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u",tablename,tmp.dataint,MIN_DB_SCRIPT_STRING_ID,MAX_DB_SCRIPT_STRING_ID,tmp.id);
continue;
}
- // if(!objmgr.GetMangosStringLocale(tmp.dataint)) will checked after db_script_string loading
+ // if (!objmgr.GetMangosStringLocale(tmp.dataint)) will checked after db_script_string loading
break;
}
case SCRIPT_COMMAND_EMOTE:
{
- if(!sEmotesStore.LookupEntry(tmp.datalong))
+ if (!sEmotesStore.LookupEntry(tmp.datalong))
{
sLog.outErrorDb("Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u",tablename,tmp.datalong,tmp.id);
continue;
@@ -4466,13 +4466,13 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
case SCRIPT_COMMAND_TELEPORT_TO:
{
- if(!sMapStore.LookupEntry(tmp.datalong))
+ if (!sMapStore.LookupEntry(tmp.datalong))
{
sLog.outErrorDb("Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",tablename,tmp.datalong,tmp.id);
continue;
}
- if(!Trinity::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o))
+ if (!Trinity::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o))
{
sLog.outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",tablename,tmp.x,tmp.y,tmp.id);
continue;
@@ -4492,13 +4492,13 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
{
- if(!Trinity::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o))
+ if (!Trinity::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o))
{
sLog.outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",tablename,tmp.x,tmp.y,tmp.id);
continue;
}
- if(!GetCreatureTemplate(tmp.datalong))
+ if (!GetCreatureTemplate(tmp.datalong))
{
sLog.outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",tablename,tmp.datalong,tmp.id);
continue;
@@ -4509,20 +4509,20 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
{
GameObjectData const* data = GetGOData(tmp.datalong);
- if(!data)
+ if (!data)
{
sLog.outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",tablename,tmp.datalong,tmp.id);
continue;
}
GameObjectInfo const* info = GetGameObjectInfo(data->id);
- if(!info)
+ if (!info)
{
sLog.outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",tablename,tmp.datalong,data->id,tmp.id);
continue;
}
- if( info->type==GAMEOBJECT_TYPE_FISHINGNODE ||
+ if ( info->type==GAMEOBJECT_TYPE_FISHINGNODE ||
info->type==GAMEOBJECT_TYPE_FISHINGHOLE ||
info->type==GAMEOBJECT_TYPE_DOOR ||
info->type==GAMEOBJECT_TYPE_BUTTON ||
@@ -4537,20 +4537,20 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
case SCRIPT_COMMAND_CLOSE_DOOR:
{
GameObjectData const* data = GetGOData(tmp.datalong);
- if(!data)
+ if (!data)
{
sLog.outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u",tablename,tmp.datalong,(tmp.command==SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"),tmp.id);
continue;
}
GameObjectInfo const* info = GetGameObjectInfo(data->id);
- if(!info)
+ if (!info)
{
sLog.outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u",tablename,tmp.datalong,data->id,(tmp.command==SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"),tmp.id);
continue;
}
- if( info->type!=GAMEOBJECT_TYPE_DOOR)
+ if ( info->type!=GAMEOBJECT_TYPE_DOOR)
{
sLog.outErrorDb("Table `%s` has gameobject type (%u) non supported by command %s for script id %u",tablename,info->id,(tmp.command==SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"),tmp.id);
continue;
@@ -4561,13 +4561,13 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
case SCRIPT_COMMAND_QUEST_EXPLORED:
{
Quest const* quest = GetQuestTemplate(tmp.datalong);
- if(!quest)
+ if (!quest)
{
sLog.outErrorDb("Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",tablename,tmp.datalong,tmp.id);
continue;
}
- if(!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
+ if (!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
sLog.outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.",tablename,tmp.datalong,tmp.id);
@@ -4577,21 +4577,21 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
// continue; - quest objective requirement set and command can be allowed
}
- if(float(tmp.datalong2) > DEFAULT_VISIBILITY_DISTANCE)
+ if (float(tmp.datalong2) > DEFAULT_VISIBILITY_DISTANCE)
{
sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",
tablename,tmp.datalong2,tmp.id);
continue;
}
- if(tmp.datalong2 && float(tmp.datalong2) > DEFAULT_VISIBILITY_DISTANCE)
+ if (tmp.datalong2 && float(tmp.datalong2) > DEFAULT_VISIBILITY_DISTANCE)
{
sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check",
tablename,tmp.datalong2,tmp.id,DEFAULT_VISIBILITY_DISTANCE);
continue;
}
- if(tmp.datalong2 && float(tmp.datalong2) < INTERACTION_DISTANCE)
+ if (tmp.datalong2 && float(tmp.datalong2) < INTERACTION_DISTANCE)
{
sLog.outErrorDb("Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check",
tablename,tmp.datalong2,tmp.id,INTERACTION_DISTANCE);
@@ -4603,13 +4603,13 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
case SCRIPT_COMMAND_REMOVE_AURA:
{
- if(!sSpellStore.LookupEntry(tmp.datalong))
+ if (!sSpellStore.LookupEntry(tmp.datalong))
{
sLog.outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u",
tablename,tmp.datalong,tmp.id);
continue;
}
- if(tmp.datalong2 & ~0x1) // 1 bits (0,1)
+ if (tmp.datalong2 & ~0x1) // 1 bits (0,1)
{
sLog.outErrorDb("Table `%s` using unknown flags in datalong2 (%u)i n SCRIPT_COMMAND_CAST_SPELL for script id %u",
tablename,tmp.datalong2,tmp.id);
@@ -4619,13 +4619,13 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
}
case SCRIPT_COMMAND_CAST_SPELL:
{
- if(!sSpellStore.LookupEntry(tmp.datalong))
+ if (!sSpellStore.LookupEntry(tmp.datalong))
{
sLog.outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u",
tablename,tmp.datalong,tmp.id);
continue;
}
- if(tmp.datalong2 & ~0x3) // 2 bits
+ if (tmp.datalong2 & ~0x3) // 2 bits
{
sLog.outErrorDb("Table `%s` using unknown flags in datalong2 (%u)i n SCRIPT_COMMAND_CAST_SPELL for script id %u",
tablename,tmp.datalong2,tmp.id);
@@ -4656,7 +4656,7 @@ void ObjectMgr::LoadGameObjectScripts()
// check ids
for (ScriptMapMap::const_iterator itr = sGameObjectScripts.begin(); itr != sGameObjectScripts.end(); ++itr)
{
- if(!GetGOData(itr->first))
+ if (!GetGOData(itr->first))
sLog.outErrorDb("Table `gameobject_scripts` has not existing gameobject (GUID: %u) as script id",itr->first);
}
}
@@ -4668,7 +4668,7 @@ void ObjectMgr::LoadQuestEndScripts()
// check ids
for (ScriptMapMap::const_iterator itr = sQuestEndScripts.begin(); itr != sQuestEndScripts.end(); ++itr)
{
- if(!GetQuestTemplate(itr->first))
+ if (!GetQuestTemplate(itr->first))
sLog.outErrorDb("Table `quest_end_scripts` has not existing quest (Id: %u) as script id",itr->first);
}
}
@@ -4680,7 +4680,7 @@ void ObjectMgr::LoadQuestStartScripts()
// check ids
for (ScriptMapMap::const_iterator itr = sQuestStartScripts.begin(); itr != sQuestStartScripts.end(); ++itr)
{
- if(!GetQuestTemplate(itr->first))
+ if (!GetQuestTemplate(itr->first))
sLog.outErrorDb("Table `quest_start_scripts` has not existing quest (Id: %u) as script id",itr->first);
}
}
@@ -4694,7 +4694,7 @@ void ObjectMgr::LoadSpellScripts()
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first);
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outErrorDb("Table `spell_scripts` has not existing spell (Id: %u) as script id",itr->first);
continue;
@@ -4705,17 +4705,17 @@ void ObjectMgr::LoadSpellScripts()
for (uint8 i=0; i<3; ++i)
{
// skip empty effects
- if( !spellInfo->Effect[i] )
+ if ( !spellInfo->Effect[i] )
continue;
- if( spellInfo->Effect[i] == SPELL_EFFECT_SCRIPT_EFFECT )
+ if ( spellInfo->Effect[i] == SPELL_EFFECT_SCRIPT_EFFECT )
{
found = true;
break;
}
}
- if(!found)
+ if (!found)
sLog.outErrorDb("Table `spell_scripts` has unsupported spell (Id: %u) without SPELL_EFFECT_SCRIPT_EFFECT (%u) spell effect",itr->first,SPELL_EFFECT_SCRIPT_EFFECT);
}
}
@@ -4757,7 +4757,7 @@ void ObjectMgr::LoadEventScripts()
{
for (uint8 j=0; j<3; ++j)
{
- if( spell->Effect[j] == SPELL_EFFECT_SEND_EVENT )
+ if ( spell->Effect[j] == SPELL_EFFECT_SEND_EVENT )
{
if (spell->EffectMiscValue[j])
evt_scripts.insert(spell->EffectMiscValue[j]);
@@ -4783,7 +4783,7 @@ void ObjectMgr::LoadWaypointScripts()
for (ScriptMapMap::const_iterator itr = sWaypointScripts.begin(); itr != sWaypointScripts.end(); ++itr)
{
QueryResult_AutoPtr query = WorldDatabase.PQuery("SELECT * FROM waypoint_scripts WHERE id = %u", itr->first);
- if(!query || !query->GetRowCount())
+ if (!query || !query->GetRowCount())
sLog.outErrorDb("There is no waypoint which links to the waypoint script %u", itr->first);
}
}
@@ -4801,7 +4801,7 @@ void ObjectMgr::LoadItemTexts()
uint32 count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
bar.step();
@@ -4880,7 +4880,7 @@ void ObjectMgr::LoadPageTextLocales()
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,text_loc1,text_loc2,text_loc3,text_loc4,text_loc5,text_loc6,text_loc7,text_loc8 FROM locales_page_text");
- if(!result)
+ if (!result)
return;
barGoLink bar(result->GetRowCount());
@@ -4897,13 +4897,13 @@ void ObjectMgr::LoadPageTextLocales()
for (uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[i].GetCppString();
- if(str.empty())
+ if (str.empty())
continue;
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.Text.size() <= idx)
+ if (data.Text.size() <= idx)
data.Text.resize(idx+1);
data.Text[idx] = str;
@@ -4933,13 +4933,13 @@ void ObjectMgr::LoadInstanceTemplate()
for (uint32 i = 0; i < sInstanceTemplate.MaxEntry; i++)
{
InstanceTemplate* temp = (InstanceTemplate*)GetInstanceTemplate(i);
- if(!temp)
+ if (!temp)
continue;
- if(!MapManager::IsValidMAP(temp->map))
+ if (!MapManager::IsValidMAP(temp->map))
sLog.outErrorDb("ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", temp->map);
- if(!MapManager::IsValidMapCoord(temp->parent,temp->startLocX,temp->startLocY,temp->startLocZ,temp->startLocO))
+ if (!MapManager::IsValidMapCoord(temp->parent,temp->startLocX,temp->startLocY,temp->startLocZ,temp->startLocO))
{
sLog.outErrorDb("ObjectMgr::LoadInstanceTemplate: bad parent entrance coordinates for map id %d template!", temp->map);
temp->parent = 0; // will have wrong continent 0 parent, at least existed
@@ -4953,7 +4953,7 @@ void ObjectMgr::LoadInstanceTemplate()
GossipText const *ObjectMgr::GetGossipText(uint32 Text_ID) const
{
GossipTextMap::const_iterator itr = mGossipText.find(Text_ID);
- if(itr != mGossipText.end())
+ if (itr != mGossipText.end())
return &itr->second;
return NULL;
}
@@ -4963,7 +4963,7 @@ void ObjectMgr::LoadGossipText()
QueryResult_AutoPtr result = WorldDatabase.Query( "SELECT * FROM npc_text" );
int count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
bar.step();
@@ -4987,7 +4987,7 @@ void ObjectMgr::LoadGossipText()
bar.step();
uint32 Text_ID = fields[cic++].GetUInt32();
- if(!Text_ID)
+ if (!Text_ID)
{
sLog.outErrorDb("Table `npc_text` has record wit reserved id 0, ignore.");
continue;
@@ -5030,7 +5030,7 @@ void ObjectMgr::LoadNpcTextLocales()
"Text0_0_loc8,Text0_1_loc8,Text1_0_loc8,Text1_1_loc8,Text2_0_loc8,Text2_1_loc8,Text3_0_loc8,Text3_1_loc1,Text4_0_loc8,Text4_1_loc8,Text5_0_loc8,Text5_1_loc8,Text6_0_loc8,Text6_1_loc8,Text7_0_loc8,Text7_1_loc8 "
" FROM locales_npc_text");
- if(!result)
+ if (!result)
return;
barGoLink bar(result->GetRowCount());
@@ -5049,24 +5049,24 @@ void ObjectMgr::LoadNpcTextLocales()
for (uint8 j=0; j<8; ++j)
{
std::string str0 = fields[1+8*2*(i-1)+2*j].GetCppString();
- if(!str0.empty())
+ if (!str0.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.Text_0[j].size() <= idx)
+ if (data.Text_0[j].size() <= idx)
data.Text_0[j].resize(idx+1);
data.Text_0[j][idx] = str0;
}
}
std::string str1 = fields[1+8*2*(i-1)+2*j+1].GetCppString();
- if(!str1.empty())
+ if (!str1.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.Text_1[j].size() <= idx)
+ if (data.Text_1[j].size() <= idx)
data.Text_1[j].resize(idx+1);
data.Text_1[j][idx] = str1;
@@ -5139,7 +5139,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
if (has_items)
{
QueryResult_AutoPtr resultItems = CharacterDatabase.PQuery("SELECT item_guid,item_template FROM mail_items WHERE mail_id='%u'", m->messageID);
- if(resultItems)
+ if (resultItems)
{
do
{
@@ -5190,7 +5190,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
uint32 count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
bar.step();
@@ -5213,7 +5213,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
uint32 quest_ID = fields[1].GetUInt32();
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(trigger_ID);
- if(!atEntry)
+ if (!atEntry)
{
sLog.outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.",trigger_ID);
continue;
@@ -5221,13 +5221,13 @@ void ObjectMgr::LoadQuestAreaTriggers()
Quest const* quest = GetQuestTemplate(quest_ID);
- if(!quest)
+ if (!quest)
{
sLog.outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not existing quest %u",trigger_ID,quest_ID);
continue;
}
- if(!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
+ if (!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
sLog.outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.",trigger_ID,quest_ID);
@@ -5253,7 +5253,7 @@ void ObjectMgr::LoadTavernAreaTriggers()
uint32 count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
bar.step();
@@ -5275,7 +5275,7 @@ void ObjectMgr::LoadTavernAreaTriggers()
uint32 Trigger_ID = fields[0].GetUInt32();
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
- if(!atEntry)
+ if (!atEntry)
{
sLog.outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.",Trigger_ID);
continue;
@@ -5295,7 +5295,7 @@ void ObjectMgr::LoadAreaTriggerScripts()
uint32 count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
bar.step();
@@ -5318,7 +5318,7 @@ void ObjectMgr::LoadAreaTriggerScripts()
const char *scriptName = fields[1].GetString();
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
- if(!atEntry)
+ if (!atEntry)
{
sLog.outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.",Trigger_ID);
continue;
@@ -5340,20 +5340,20 @@ uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid, u
{
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
- if(!node || node->map_id != mapid || !node->MountCreatureID[team == ALLIANCE ? 1 : 0] && node->MountCreatureID[0] != 32981) // dk flight
+ if (!node || node->map_id != mapid || !node->MountCreatureID[team == ALLIANCE ? 1 : 0] && node->MountCreatureID[0] != 32981) // dk flight
continue;
uint8 field = (uint8)((i - 1) / 32);
uint32 submask = 1<<((i-1)%32);
// skip not taxi network nodes
- if((sTaxiNodesMask[field] & submask)==0)
+ if ((sTaxiNodesMask[field] & submask)==0)
continue;
float dist2 = (node->x - x)*(node->x - x)+(node->y - y)*(node->y - y)+(node->z - z)*(node->z - z);
- if(found)
+ if (found)
{
- if(dist2 < dist)
+ if (dist2 < dist)
{
dist = dist2;
id = i;
@@ -5373,7 +5373,7 @@ uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid, u
void ObjectMgr::GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost)
{
TaxiPathSetBySource::iterator src_i = sTaxiPathSetBySource.find(source);
- if(src_i==sTaxiPathSetBySource.end())
+ if (src_i==sTaxiPathSetBySource.end())
{
path = 0;
cost = 0;
@@ -5383,7 +5383,7 @@ void ObjectMgr::GetTaxiPath( uint32 source, uint32 destination, uint32 &path, ui
TaxiPathSetForSource& pathSet = src_i->second;
TaxiPathSetForSource::iterator dest_i = pathSet.find(destination);
- if(dest_i==pathSet.end())
+ if (dest_i==pathSet.end())
{
path = 0;
cost = 0;
@@ -5401,7 +5401,7 @@ uint32 ObjectMgr::GetTaxiMountDisplayId( uint32 id, uint32 team, bool allowed_al
// select mount creature id
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id);
- if(node)
+ if (node)
{
if (team == ALLIANCE)
mount_entry = node->MountCreatureID[1];
@@ -5436,7 +5436,7 @@ uint32 ObjectMgr::GetTaxiMountDisplayId( uint32 id, uint32 team, bool allowed_al
void ObjectMgr::GetTaxiPathNodes( uint32 path, Path &pathnodes, std::vector<uint32>& mapIds)
{
- if(path >= sTaxiPathNodesByPath.size())
+ if (path >= sTaxiPathNodesByPath.size())
return;
TaxiPathNodeList& nodeList = sTaxiPathNodesByPath[path];
@@ -5456,7 +5456,7 @@ void ObjectMgr::GetTaxiPathNodes( uint32 path, Path &pathnodes, std::vector<uint
void ObjectMgr::GetTransportPathNodes( uint32 path, TransportPath &pathnodes )
{
- if(path >= sTaxiPathNodesByPath.size())
+ if (path >= sTaxiPathNodesByPath.size())
return;
TaxiPathNodeList& nodeList = sTaxiPathNodesByPath[path];
@@ -5482,7 +5482,7 @@ void ObjectMgr::LoadGraveyardZones()
uint32 count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
bar.step();
@@ -5506,32 +5506,32 @@ void ObjectMgr::LoadGraveyardZones()
uint32 team = fields[2].GetUInt32();
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(safeLocId);
- if(!entry)
+ if (!entry)
{
sLog.outErrorDb("Table `game_graveyard_zone` has record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.",safeLocId);
continue;
}
AreaTableEntry const *areaEntry = GetAreaEntryByAreaID(zoneId);
- if(!areaEntry)
+ if (!areaEntry)
{
sLog.outErrorDb("Table `game_graveyard_zone` has record for not existing zone id (%u), skipped.",zoneId);
continue;
}
- if(areaEntry->zone != 0)
+ if (areaEntry->zone != 0)
{
sLog.outErrorDb("Table `game_graveyard_zone` has record subzone id (%u) instead of zone, skipped.",zoneId);
continue;
}
- if(team!=0 && team!=HORDE && team!=ALLIANCE)
+ if (team!=0 && team!=HORDE && team!=ALLIANCE)
{
sLog.outErrorDb("Table `game_graveyard_zone` has record for non player faction (%u), skipped.",team);
continue;
}
- if(!AddGraveYardLink(safeLocId,zoneId,team,false))
+ if (!AddGraveYardLink(safeLocId,zoneId,team,false))
sLog.outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.",safeLocId,zoneId);
} while ( result->NextRow() );
@@ -5556,7 +5556,7 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
MapEntry const* map = sMapStore.LookupEntry(MapId);
// not need to check validity of map object; MapId _MUST_ be valid here
- if(graveLow==graveUp && !map->IsBattleArena())
+ if (graveLow==graveUp && !map->IsBattleArena())
{
//sLog.outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.",zoneId,team);
return NULL;
@@ -5582,7 +5582,7 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
GraveYardData const& data = itr->second;
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(data.safeLocId);
- if(!entry)
+ if (!entry)
{
sLog.outErrorDb("Table `game_graveyard_zone` has record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.",data.safeLocId);
continue;
@@ -5590,11 +5590,11 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
// skip enemy faction graveyard
// team == 0 case can be at call from .neargrave
- if(data.team != 0 && team != 0 && data.team != team)
+ if (data.team != 0 && team != 0 && data.team != team)
continue;
// find now nearest graveyard at other map
- if(MapId != entry->map_id)
+ if (MapId != entry->map_id)
{
// if find graveyard at different map from where entrance placed (or no entrance data), use any first
if (!mapEntry ||
@@ -5610,9 +5610,9 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
// at entrance map calculate distance (2D);
float dist2 = (entry->x - mapEntry->entrance_x)*(entry->x - mapEntry->entrance_x)
+(entry->y - mapEntry->entrance_y)*(entry->y - mapEntry->entrance_y);
- if(foundEntr)
+ if (foundEntr)
{
- if(dist2 < distEntr)
+ if (dist2 < distEntr)
{
distEntr = dist2;
entryEntr = entry;
@@ -5629,9 +5629,9 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
else
{
float dist2 = (entry->x - x)*(entry->x - x)+(entry->y - y)*(entry->y - y)+(entry->z - z)*(entry->z - z);
- if(foundNear)
+ if (foundNear)
{
- if(dist2 < distNear)
+ if (dist2 < distNear)
{
distNear = dist2;
entryNear = entry;
@@ -5646,10 +5646,10 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
}
}
- if(entryNear)
+ if (entryNear)
return entryNear;
- if(entryEntr)
+ if (entryEntr)
return entryEntr;
return entryFar;
@@ -5662,7 +5662,7 @@ GraveYardData const* ObjectMgr::FindGraveYardData(uint32 id, uint32 zoneId)
for (GraveYardMap::const_iterator itr = graveLow; itr != graveUp; ++itr)
{
- if(itr->second.safeLocId==id)
+ if (itr->second.safeLocId==id)
return &itr->second;
}
@@ -5671,7 +5671,7 @@ GraveYardData const* ObjectMgr::FindGraveYardData(uint32 id, uint32 zoneId)
bool ObjectMgr::AddGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool inDB)
{
- if(FindGraveYardData(id,zoneId))
+ if (FindGraveYardData(id,zoneId))
return false;
// add link to loaded data
@@ -5682,7 +5682,7 @@ bool ObjectMgr::AddGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool inD
mGraveYardMap.insert(GraveYardMap::value_type(zoneId,data));
// add link to DB
- if(inDB)
+ if (inDB)
{
WorldDatabase.PExecuteLog("INSERT INTO game_graveyard_zone ( id,ghost_zone,faction) "
"VALUES ('%u', '%u','%u')",id,zoneId,team);
@@ -5695,7 +5695,7 @@ void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool
{
GraveYardMap::iterator graveLow = mGraveYardMap.lower_bound(zoneId);
GraveYardMap::iterator graveUp = mGraveYardMap.upper_bound(zoneId);
- if(graveLow==graveUp)
+ if (graveLow==graveUp)
{
//sLog.outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.",zoneId,team);
return;
@@ -5710,12 +5710,12 @@ void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool
GraveYardData & data = itr->second;
// skip not matching safezone id
- if(data.safeLocId != id)
+ if (data.safeLocId != id)
continue;
// skip enemy faction graveyard at same map (normal area, city, or battleground)
// team == 0 case can be at call from .neargrave
- if(data.team != 0 && team != 0 && data.team != team)
+ if (data.team != 0 && team != 0 && data.team != team)
continue;
found = true;
@@ -5723,14 +5723,14 @@ void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool
}
// no match, return
- if(!found)
+ if (!found)
return;
// remove from links
mGraveYardMap.erase(itr);
// remove link from DB
- if(inDB)
+ if (inDB)
{
WorldDatabase.PExecute("DELETE FROM game_graveyard_zone WHERE id = '%u' AND ghost_zone = '%u' AND faction = '%u'",id,zoneId,team);
}
@@ -5746,7 +5746,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
// 0 1 2 3 4 5 6
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, access_id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
@@ -5780,20 +5780,20 @@ void ObjectMgr::LoadAreaTriggerTeleports()
at.target_Orientation = fields[6].GetFloat();
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
- if(!atEntry)
+ if (!atEntry)
{
sLog.outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.",Trigger_ID);
continue;
}
MapEntry const* mapEntry = sMapStore.LookupEntry(at.target_mapId);
- if(!mapEntry)
+ if (!mapEntry)
{
sLog.outErrorDb("Area trigger (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.",Trigger_ID,at.target_mapId);
continue;
}
- if(at.target_X==0 && at.target_Y==0 && at.target_Z==0)
+ if (at.target_X==0 && at.target_Y==0 && at.target_Z==0)
{
sLog.outErrorDb("Area trigger (ID:%u) target coordinates not provided.",Trigger_ID);
continue;
@@ -5815,7 +5815,7 @@ void ObjectMgr::LoadAccessRequirements()
// 0 1 2 3 4 5 6 7 8 9 10 11 12
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, level_min, level_max, item, item2, heroic_key, heroic_key2, quest_done, quest_failed_text, heroic_quest_done, heroic_quest_failed_text, heroic_level_min, status FROM access_requirement");
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
@@ -5854,60 +5854,60 @@ void ObjectMgr::LoadAccessRequirements()
ar.heroicQuestFailedText = fields[10].GetCppString();
ar.status = fields[12].GetUInt8();
- if(ar.item)
+ if (ar.item)
{
ItemPrototype const *pProto = GetItemPrototype(ar.item);
- if(!pProto)
+ if (!pProto)
{
sLog.outError("Key item %u does not exist for requirement %u, removing key requirement.", ar.item, requiremt_ID);
ar.item = 0;
}
}
- if(ar.item2)
+ if (ar.item2)
{
ItemPrototype const *pProto = GetItemPrototype(ar.item2);
- if(!pProto)
+ if (!pProto)
{
sLog.outError("Second item %u does not exist for requirement %u, removing key requirement.", ar.item2, requiremt_ID);
ar.item2 = 0;
}
}
- if(ar.heroicKey)
+ if (ar.heroicKey)
{
ItemPrototype const *pProto = GetItemPrototype(ar.heroicKey);
- if(!pProto)
+ if (!pProto)
{
sLog.outError("Heroic key %u not exist for trigger %u, remove key requirement.", ar.heroicKey, requiremt_ID);
ar.heroicKey = 0;
}
}
- if(ar.heroicKey2)
+ if (ar.heroicKey2)
{
ItemPrototype const *pProto = GetItemPrototype(ar.heroicKey2);
- if(!pProto)
+ if (!pProto)
{
sLog.outError("Second heroic key %u not exist for trigger %u, remove key requirement.", ar.heroicKey2, requiremt_ID);
ar.heroicKey2 = 0;
}
}
- if(ar.heroicQuest)
+ if (ar.heroicQuest)
{
QuestMap::iterator qReqItr = mQuestTemplates.find(ar.heroicQuest);
- if(qReqItr == mQuestTemplates.end())
+ if (qReqItr == mQuestTemplates.end())
{
sLog.outErrorDb("Required Heroic Quest %u not exist for trigger %u, remove heroic quest done requirement.",ar.heroicQuest,requiremt_ID);
ar.heroicQuest = 0;
}
}
- if(ar.quest)
+ if (ar.quest)
{
QuestMap::iterator qReqItr = mQuestTemplates.find(ar.quest);
- if(qReqItr == mQuestTemplates.end())
+ if (qReqItr == mQuestTemplates.end())
{
sLog.outErrorDb("Required Quest %u not exist for trigger %u, remove quest done requirement.",ar.quest,requiremt_ID);
ar.quest = 0;
@@ -5928,13 +5928,13 @@ void ObjectMgr::LoadAccessRequirements()
AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 Map) const
{
const MapEntry *mapEntry = sMapStore.LookupEntry(Map);
- if(!mapEntry) return NULL;
+ if (!mapEntry) return NULL;
for (AreaTriggerMap::const_iterator itr = mAreaTriggers.begin(); itr != mAreaTriggers.end(); ++itr)
{
- if(itr->second.target_mapId == mapEntry->entrance_map)
+ if (itr->second.target_mapId == mapEntry->entrance_map)
{
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
- if(atEntry && atEntry->mapid == Map)
+ if (atEntry && atEntry->mapid == Map)
return &itr->second;
}
}
@@ -5948,10 +5948,10 @@ AreaTrigger const* ObjectMgr::GetMapEntranceTrigger(uint32 Map) const
{
for (AreaTriggerMap::const_iterator itr = mAreaTriggers.begin(); itr != mAreaTriggers.end(); ++itr)
{
- if(itr->second.target_mapId == Map)
+ if (itr->second.target_mapId == Map)
{
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
- if(atEntry)
+ if (atEntry)
return &itr->second;
}
}
@@ -5961,15 +5961,15 @@ AreaTrigger const* ObjectMgr::GetMapEntranceTrigger(uint32 Map) const
void ObjectMgr::SetHighestGuids()
{
QueryResult_AutoPtr result = CharacterDatabase.Query( "SELECT MAX(guid) FROM characters" );
- if( result )
+ if ( result )
m_hiCharGuid = (*result)[0].GetUInt32()+1;
result = WorldDatabase.Query( "SELECT MAX(guid) FROM creature" );
- if( result )
+ if ( result )
m_hiCreatureGuid = (*result)[0].GetUInt32()+1;
result = CharacterDatabase.Query( "SELECT MAX(guid) FROM item_instance" );
- if( result )
+ if ( result )
m_hiItemGuid = (*result)[0].GetUInt32()+1;
// Cleanup other tables from not existed guids (>=m_hiItemGuid)
@@ -5979,23 +5979,23 @@ void ObjectMgr::SetHighestGuids()
CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE item_guid >= '%u'", m_hiItemGuid);
result = WorldDatabase.Query("SELECT MAX(guid) FROM gameobject" );
- if( result )
+ if ( result )
m_hiGoGuid = (*result)[0].GetUInt32()+1;
result = CharacterDatabase.Query("SELECT MAX(id) FROM auctionhouse" );
- if( result )
+ if ( result )
m_auctionid = (*result)[0].GetUInt32()+1;
result = CharacterDatabase.Query( "SELECT MAX(id) FROM mail" );
- if( result )
+ if ( result )
m_mailid = (*result)[0].GetUInt32()+1;
result = CharacterDatabase.Query( "SELECT MAX(id) FROM item_text" );
- if( result )
+ if ( result )
m_ItemTextId = (*result)[0].GetUInt32()+1;
result = CharacterDatabase.Query( "SELECT MAX(guid) FROM corpse" );
- if( result )
+ if ( result )
m_hiCorpseGuid = (*result)[0].GetUInt32()+1;
result = CharacterDatabase.Query("SELECT MAX(arenateamid) FROM arena_team");
@@ -6013,7 +6013,7 @@ void ObjectMgr::SetHighestGuids()
uint32 ObjectMgr::GenerateArenaTeamId()
{
- if(m_arenaTeamId>=0xFFFFFFFE)
+ if (m_arenaTeamId>=0xFFFFFFFE)
{
sLog.outError("Arena team ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
@@ -6023,7 +6023,7 @@ uint32 ObjectMgr::GenerateArenaTeamId()
uint32 ObjectMgr::GenerateAuctionID()
{
- if(m_auctionid>=0xFFFFFFFE)
+ if (m_auctionid>=0xFFFFFFFE)
{
sLog.outError("Auctions ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
@@ -6033,7 +6033,7 @@ uint32 ObjectMgr::GenerateAuctionID()
uint64 ObjectMgr::GenerateEquipmentSetGuid()
{
- if(m_equipmentSetGuid>=0xFFFFFFFFFFFFFFFEll)
+ if (m_equipmentSetGuid>=0xFFFFFFFFFFFFFFFEll)
{
sLog.outError("EquipmentSet guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
@@ -6043,7 +6043,7 @@ uint64 ObjectMgr::GenerateEquipmentSetGuid()
uint32 ObjectMgr::GenerateGuildId()
{
- if(m_guildId>=0xFFFFFFFE)
+ if (m_guildId>=0xFFFFFFFE)
{
sLog.outError("Guild ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
@@ -6053,7 +6053,7 @@ uint32 ObjectMgr::GenerateGuildId()
uint32 ObjectMgr::GenerateMailID()
{
- if(m_mailid>=0xFFFFFFFE)
+ if (m_mailid>=0xFFFFFFFE)
{
sLog.outError("Mail ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
@@ -6063,7 +6063,7 @@ uint32 ObjectMgr::GenerateMailID()
uint32 ObjectMgr::GenerateItemTextID()
{
- if(m_ItemTextId>=0xFFFFFFFE)
+ if (m_ItemTextId>=0xFFFFFFFE)
{
sLog.outError("Item text ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
@@ -6090,56 +6090,56 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
switch(guidhigh)
{
case HIGHGUID_ITEM:
- if(m_hiItemGuid>=0xFFFFFFFE)
+ if (m_hiItemGuid>=0xFFFFFFFE)
{
sLog.outError("Item guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return m_hiItemGuid++;
case HIGHGUID_UNIT:
- if(m_hiCreatureGuid>=0x00FFFFFE)
+ if (m_hiCreatureGuid>=0x00FFFFFE)
{
sLog.outError("Creature guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return m_hiCreatureGuid++;
case HIGHGUID_PET:
- if(m_hiPetGuid>=0x00FFFFFE)
+ if (m_hiPetGuid>=0x00FFFFFE)
{
sLog.outError("Pet guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return m_hiPetGuid++;
case HIGHGUID_VEHICLE:
- if(m_hiVehicleGuid>=0x00FFFFFF)
+ if (m_hiVehicleGuid>=0x00FFFFFF)
{
sLog.outError("Vehicle guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return m_hiVehicleGuid++;
case HIGHGUID_PLAYER:
- if(m_hiCharGuid>=0xFFFFFFFE)
+ if (m_hiCharGuid>=0xFFFFFFFE)
{
sLog.outError("Players guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return m_hiCharGuid++;
case HIGHGUID_GAMEOBJECT:
- if(m_hiGoGuid>=0x00FFFFFE)
+ if (m_hiGoGuid>=0x00FFFFFE)
{
sLog.outError("Gameobject guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return m_hiGoGuid++;
case HIGHGUID_CORPSE:
- if(m_hiCorpseGuid>=0xFFFFFFFE)
+ if (m_hiCorpseGuid>=0xFFFFFFFE)
{
sLog.outError("Corpse guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return m_hiCorpseGuid++;
case HIGHGUID_DYNAMICOBJECT:
- if(m_hiDoGuid>=0xFFFFFFFE)
+ if (m_hiDoGuid>=0xFFFFFFFE)
{
sLog.outError("DynamicObject guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
@@ -6162,7 +6162,7 @@ void ObjectMgr::LoadGameObjectLocales()
"castbarcaption_loc1,castbarcaption_loc2,castbarcaption_loc3,castbarcaption_loc4,"
"castbarcaption_loc5,castbarcaption_loc6,castbarcaption_loc7,castbarcaption_loc8 FROM locales_gameobject");
- if(!result)
+ if (!result)
return;
barGoLink bar(result->GetRowCount());
@@ -6179,12 +6179,12 @@ void ObjectMgr::LoadGameObjectLocales()
for (uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[i].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.Name.size() <= idx)
+ if (data.Name.size() <= idx)
data.Name.resize(idx+1);
data.Name[idx] = str;
@@ -6195,12 +6195,12 @@ void ObjectMgr::LoadGameObjectLocales()
for (uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[i+(MAX_LOCALE-1)].GetCppString();
- if(!str.empty())
+ if (!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
- if(idx >= 0)
+ if (idx >= 0)
{
- if(data.CastBarCaption.size() <= idx)
+ if (data.CastBarCaption.size() <= idx)
data.CastBarCaption.resize(idx+1);
data.CastBarCaption[idx] = str;
@@ -6578,7 +6578,7 @@ void ObjectMgr::LoadCorpses()
// 0 1 2 3 4 5 6 7 8 9 10
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT position_x, position_y, position_z, orientation, map, data, time, corpse_type, instance, phaseMask, guid FROM corpse WHERE corpse_type <> 0");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
@@ -6626,7 +6626,7 @@ void ObjectMgr::LoadReputationOnKill()
"IsTeamAward1, MaxStanding1, RewOnKillRepValue1, IsTeamAward2, MaxStanding2, RewOnKillRepValue2, TeamDependent "
"FROM creature_onkill_reputation");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
@@ -6699,7 +6699,7 @@ void ObjectMgr::LoadPointsOfInterest()
// 0 1 2 3 4 5 6
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, x, y, icon, flags, data, icon_name FROM points_of_interest");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
@@ -6749,7 +6749,7 @@ void ObjectMgr::LoadQuestPOI()
// 0 1 2 3
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT questId, id, objIndex, mapid, WorldMapAreaId, FloorId, unk3, unk4 FROM quest_poi order by questId");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
@@ -6780,7 +6780,7 @@ void ObjectMgr::LoadQuestPOI()
QueryResult_AutoPtr points = WorldDatabase.PQuery("SELECT x, y FROM quest_poi_points WHERE questId='%u' AND id='%i'", questId, id);
- if(points)
+ if (points)
{
do
{
@@ -6809,7 +6809,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
// 0 1 2 3 4 5 6 7 8
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT npc_entry, spell_id, quest_start, quest_start_active, quest_end, cast_flags, aura_required, aura_forbidden, user_type FROM npc_spellclick_spells");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
@@ -6835,7 +6835,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
continue;
}
- if(!(cInfo->npcflag & UNIT_NPC_FLAG_SPELLCLICK))
+ if (!(cInfo->npcflag & UNIT_NPC_FLAG_SPELLCLICK))
const_cast<CreatureInfo*>(cInfo)->npcflag |= UNIT_NPC_FLAG_SPELLCLICK;
uint32 spellid = fields[1].GetUInt32();
@@ -6873,7 +6873,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
// quest might be 0 to enable spellclick independent of any quest
if (quest_start)
{
- if(mQuestTemplates.find(quest_start) == mQuestTemplates.end())
+ if (mQuestTemplates.find(quest_start) == mQuestTemplates.end())
{
sLog.outErrorDb("Table npc_spellclick_spells references unknown start quest %u. Skipping entry.", quest_start);
continue;
@@ -6886,7 +6886,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
// quest might be 0 to enable spellclick active infinity after start quest
if (quest_end)
{
- if(mQuestTemplates.find(quest_end) == mQuestTemplates.end())
+ if (mQuestTemplates.find(quest_end) == mQuestTemplates.end())
{
sLog.outErrorDb("Table npc_spellclick_spells references unknown end quest %u. Skipping entry.", quest_end);
continue;
@@ -6926,7 +6926,7 @@ void ObjectMgr::LoadWeatherZoneChances()
// 0 1 2 3 4 5 6 7 8 9 10 11 12
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT zone, spring_rain_chance, spring_snow_chance, spring_storm_chance, summer_rain_chance, summer_snow_chance, summer_storm_chance, fall_rain_chance, fall_snow_chance, fall_storm_chance, winter_rain_chance, winter_snow_chance, winter_storm_chance FROM game_weather");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
@@ -6954,19 +6954,19 @@ void ObjectMgr::LoadWeatherZoneChances()
wzc.data[season].snowChance = fields[season * (MAX_WEATHER_TYPE-1) + 2].GetUInt32();
wzc.data[season].stormChance = fields[season * (MAX_WEATHER_TYPE-1) + 3].GetUInt32();
- if(wzc.data[season].rainChance > 100)
+ if (wzc.data[season].rainChance > 100)
{
wzc.data[season].rainChance = 25;
sLog.outErrorDb("Weather for zone %u season %u has wrong rain chance > 100%%",zone_id,season);
}
- if(wzc.data[season].snowChance > 100)
+ if (wzc.data[season].snowChance > 100)
{
wzc.data[season].snowChance = 25;
sLog.outErrorDb("Weather for zone %u season %u has wrong snow chance > 100%%",zone_id,season);
}
- if(wzc.data[season].stormChance > 100)
+ if (wzc.data[season].stormChance > 100)
{
wzc.data[season].stormChance = 25;
sLog.outErrorDb("Weather for zone %u season %u has wrong storm chance > 100%%",zone_id,season);
@@ -6984,7 +6984,7 @@ void ObjectMgr::SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t
{
mCreatureRespawnTimes[MAKE_PAIR64(loguid,instance)] = t;
WorldDatabase.PExecute("DELETE FROM creature_respawn WHERE guid = '%u' AND instance = '%u'", loguid, instance);
- if(t)
+ if (t)
WorldDatabase.PExecute("INSERT INTO creature_respawn VALUES ( '%u', '" UI64FMTD "', '%u' )", loguid, uint64(t), instance);
}
@@ -6992,7 +6992,7 @@ void ObjectMgr::DeleteCreatureData(uint32 guid)
{
// remove mapid*cellid -> guid_set map
CreatureData const* data = GetCreatureData(guid);
- if(data)
+ if (data)
RemoveCreatureFromGrid(guid, data);
mCreatureDataMap.erase(guid);
@@ -7002,7 +7002,7 @@ void ObjectMgr::SaveGORespawnTime(uint32 loguid, uint32 instance, time_t t)
{
mGORespawnTimes[MAKE_PAIR64(loguid,instance)] = t;
WorldDatabase.PExecute("DELETE FROM gameobject_respawn WHERE guid = '%u' AND instance = '%u'", loguid, instance);
- if(t)
+ if (t)
WorldDatabase.PExecute("INSERT INTO gameobject_respawn VALUES ( '%u', '" UI64FMTD "', '%u' )", loguid, uint64(t), instance);
}
@@ -7015,7 +7015,7 @@ void ObjectMgr::DeleteRespawnTimeForInstance(uint32 instance)
next = itr;
++next;
- if(GUID_HIPART(itr->first)==instance)
+ if (GUID_HIPART(itr->first)==instance)
mGORespawnTimes.erase(itr);
}
@@ -7024,7 +7024,7 @@ void ObjectMgr::DeleteRespawnTimeForInstance(uint32 instance)
next = itr;
++next;
- if(GUID_HIPART(itr->first)==instance)
+ if (GUID_HIPART(itr->first)==instance)
mCreatureRespawnTimes.erase(itr);
}
@@ -7036,7 +7036,7 @@ void ObjectMgr::DeleteGOData(uint32 guid)
{
// remove mapid*cellid -> guid_set map
GameObjectData const* data = GetGOData(guid);
- if(data)
+ if (data)
RemoveGameobjectFromGrid(guid, data);
mGameObjectDataMap.erase(guid);
@@ -7085,7 +7085,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map,char const* table)
uint32 id = fields[0].GetUInt32();
uint32 quest = fields[1].GetUInt32();
- if(mQuestTemplates.find(quest) == mQuestTemplates.end())
+ if (mQuestTemplates.find(quest) == mQuestTemplates.end())
{
sLog.outErrorDb("Table `%s: Quest %u listed for entry %u does not exist.",table,quest,id);
continue;
@@ -7107,9 +7107,9 @@ void ObjectMgr::LoadGameobjectQuestRelations()
for (QuestRelations::iterator itr = mGOQuestRelations.begin(); itr != mGOQuestRelations.end(); ++itr)
{
GameObjectInfo const* goInfo = GetGameObjectInfo(itr->first);
- if(!goInfo)
+ if (!goInfo)
sLog.outErrorDb("Table `gameobject_questrelation` have data for not existed gameobject entry (%u) and existed quest %u",itr->first,itr->second);
- else if(goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
+ else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
sLog.outErrorDb("Table `gameobject_questrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER",itr->first,itr->second);
}
}
@@ -7121,9 +7121,9 @@ void ObjectMgr::LoadGameobjectInvolvedRelations()
for (QuestRelations::iterator itr = mGOQuestInvolvedRelations.begin(); itr != mGOQuestInvolvedRelations.end(); ++itr)
{
GameObjectInfo const* goInfo = GetGameObjectInfo(itr->first);
- if(!goInfo)
+ if (!goInfo)
sLog.outErrorDb("Table `gameobject_involvedrelation` have data for not existed gameobject entry (%u) and existed quest %u",itr->first,itr->second);
- else if(goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
+ else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
sLog.outErrorDb("Table `gameobject_involvedrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER",itr->first,itr->second);
}
}
@@ -7135,9 +7135,9 @@ void ObjectMgr::LoadCreatureQuestRelations()
for (QuestRelations::iterator itr = mCreatureQuestRelations.begin(); itr != mCreatureQuestRelations.end(); ++itr)
{
CreatureInfo const* cInfo = GetCreatureTemplate(itr->first);
- if(!cInfo)
+ if (!cInfo)
sLog.outErrorDb("Table `creature_questrelation` have data for not existed creature entry (%u) and existed quest %u",itr->first,itr->second);
- else if(!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
+ else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
sLog.outErrorDb("Table `creature_questrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER",itr->first,itr->second);
}
}
@@ -7149,9 +7149,9 @@ void ObjectMgr::LoadCreatureInvolvedRelations()
for (QuestRelations::iterator itr = mCreatureQuestInvolvedRelations.begin(); itr != mCreatureQuestInvolvedRelations.end(); ++itr)
{
CreatureInfo const* cInfo = GetCreatureTemplate(itr->first);
- if(!cInfo)
+ if (!cInfo)
sLog.outErrorDb("Table `creature_involvedrelation` have data for not existed creature entry (%u) and existed quest %u",itr->first,itr->second);
- else if(!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
+ else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
sLog.outErrorDb("Table `creature_involvedrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER",itr->first,itr->second);
}
}
@@ -7164,7 +7164,7 @@ void ObjectMgr::LoadReservedPlayersNames()
uint32 count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
bar.step();
@@ -7184,7 +7184,7 @@ void ObjectMgr::LoadReservedPlayersNames()
std::string name= fields[0].GetCppString();
std::wstring wstr;
- if(!Utf8toWStr (name,wstr))
+ if (!Utf8toWStr (name,wstr))
{
sLog.outError("Table `reserved_name` have invalid name: %s", name.c_str() );
continue;
@@ -7203,7 +7203,7 @@ void ObjectMgr::LoadReservedPlayersNames()
bool ObjectMgr::IsReservedName( const std::string& name ) const
{
std::wstring wstr;
- if(!Utf8toWStr (name,wstr))
+ if (!Utf8toWStr (name,wstr))
return false;
wstrToLower(wstr);
@@ -7250,34 +7250,34 @@ static LanguageType GetRealmLanguageType(bool create)
bool isValidString(std::wstring wstr, uint32 strictMask, bool numericOrSpace, bool create = false)
{
- if(strictMask==0) // any language, ignore realm
+ if (strictMask==0) // any language, ignore realm
{
- if(isExtendedLatinString(wstr,numericOrSpace))
+ if (isExtendedLatinString(wstr,numericOrSpace))
return true;
- if(isCyrillicString(wstr,numericOrSpace))
+ if (isCyrillicString(wstr,numericOrSpace))
return true;
- if(isEastAsianString(wstr,numericOrSpace))
+ if (isEastAsianString(wstr,numericOrSpace))
return true;
return false;
}
- if(strictMask & 0x2) // realm zone specific
+ if (strictMask & 0x2) // realm zone specific
{
LanguageType lt = GetRealmLanguageType(create);
- if(lt & LT_EXTENDEN_LATIN)
- if(isExtendedLatinString(wstr,numericOrSpace))
+ if (lt & LT_EXTENDEN_LATIN)
+ if (isExtendedLatinString(wstr,numericOrSpace))
return true;
- if(lt & LT_CYRILLIC)
- if(isCyrillicString(wstr,numericOrSpace))
+ if (lt & LT_CYRILLIC)
+ if (isCyrillicString(wstr,numericOrSpace))
return true;
- if(lt & LT_EAST_ASIA)
- if(isEastAsianString(wstr,numericOrSpace))
+ if (lt & LT_EAST_ASIA)
+ if (isEastAsianString(wstr,numericOrSpace))
return true;
}
- if(strictMask & 0x1) // basic Latin
+ if (strictMask & 0x1) // basic Latin
{
- if(isBasicLatinString(wstr,numericOrSpace))
+ if (isBasicLatinString(wstr,numericOrSpace))
return true;
}
@@ -7287,18 +7287,18 @@ bool isValidString(std::wstring wstr, uint32 strictMask, bool numericOrSpace, bo
uint8 ObjectMgr::CheckPlayerName( const std::string& name, bool create )
{
std::wstring wname;
- if(!Utf8toWStr(name,wname))
+ if (!Utf8toWStr(name,wname))
return CHAR_NAME_INVALID_CHARACTER;
- if(wname.size() > MAX_PLAYER_NAME)
+ if (wname.size() > MAX_PLAYER_NAME)
return CHAR_NAME_TOO_LONG;
uint32 minName = sWorld.getConfig(CONFIG_MIN_PLAYER_NAME);
- if(wname.size() < minName)
+ if (wname.size() < minName)
return CHAR_NAME_TOO_SHORT;
uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_PLAYER_NAMES);
- if(!isValidString(wname,strictMask,false,create))
+ if (!isValidString(wname,strictMask,false,create))
return CHAR_NAME_MIXED_LANGUAGES;
return CHAR_NAME_SUCCESS;
@@ -7307,14 +7307,14 @@ uint8 ObjectMgr::CheckPlayerName( const std::string& name, bool create )
bool ObjectMgr::IsValidCharterName( const std::string& name )
{
std::wstring wname;
- if(!Utf8toWStr(name,wname))
+ if (!Utf8toWStr(name,wname))
return false;
- if(wname.size() > MAX_CHARTER_NAME)
+ if (wname.size() > MAX_CHARTER_NAME)
return false;
uint32 minName = sWorld.getConfig(CONFIG_MIN_CHARTER_NAME);
- if(wname.size() < minName)
+ if (wname.size() < minName)
return false;
uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_CHARTER_NAMES);
@@ -7325,18 +7325,18 @@ bool ObjectMgr::IsValidCharterName( const std::string& name )
PetNameInvalidReason ObjectMgr::CheckPetName( const std::string& name )
{
std::wstring wname;
- if(!Utf8toWStr(name,wname))
+ if (!Utf8toWStr(name,wname))
return PET_NAME_INVALID;
- if(wname.size() > MAX_PET_NAME)
+ if (wname.size() > MAX_PET_NAME)
return PET_NAME_TOO_LONG;
uint32 minName = sWorld.getConfig(CONFIG_MIN_PET_NAME);
- if(wname.size() < minName)
+ if (wname.size() < minName)
return PET_NAME_TOO_SHORT;
uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_PET_NAMES);
- if(!isValidString(wname,strictMask,false))
+ if (!isValidString(wname,strictMask,false))
return PET_NAME_MIXED_LANGUAGES;
return PET_NAME_SUCCESS;
@@ -7344,11 +7344,11 @@ PetNameInvalidReason ObjectMgr::CheckPetName( const std::string& name )
int ObjectMgr::GetIndexForLocale( LocaleConstant loc )
{
- if(loc==LOCALE_enUS)
+ if (loc==LOCALE_enUS)
return -1;
for (size_t i=0; i < m_LocalForIndex.size(); ++i)
- if(m_LocalForIndex[i]==loc)
+ if (m_LocalForIndex[i]==loc)
return i;
return -1;
@@ -7364,11 +7364,11 @@ LocaleConstant ObjectMgr::GetLocaleForIndex(int i)
int ObjectMgr::GetOrNewIndexForLocale( LocaleConstant loc )
{
- if(loc==LOCALE_enUS)
+ if (loc==LOCALE_enUS)
return -1;
for (size_t i=0; i < m_LocalForIndex.size(); ++i)
- if(m_LocalForIndex[i]==loc)
+ if (m_LocalForIndex[i]==loc)
return i;
m_LocalForIndex.push_back(loc);
@@ -7379,7 +7379,7 @@ void ObjectMgr::LoadGameObjectForQuests()
{
mGameObjectForQuestSet.clear(); // need for reload case
- if( !sGOStorage.MaxEntry )
+ if ( !sGOStorage.MaxEntry )
{
barGoLink bar( 1 );
bar.step();
@@ -7396,7 +7396,7 @@ void ObjectMgr::LoadGameObjectForQuests()
{
bar.step();
GameObjectInfo const* goInfo = sGOStorage.LookupEntry<GameObjectInfo>(go_entry);
- if(!goInfo)
+ if (!goInfo)
continue;
switch(goInfo->type)
@@ -7407,7 +7407,7 @@ void ObjectMgr::LoadGameObjectForQuests()
uint32 loot_id = goInfo->GetLootId();
// find quest loot for GO
- if(LootTemplates_Gameobject.HaveQuestLootFor(loot_id))
+ if (LootTemplates_Gameobject.HaveQuestLootFor(loot_id))
{
mGameObjectForQuestSet.insert(go_entry);
++count;
@@ -7416,7 +7416,7 @@ void ObjectMgr::LoadGameObjectForQuests()
}
case GAMEOBJECT_TYPE_GOOBER:
{
- if(goInfo->goober.questId) //quests objects
+ if (goInfo->goober.questId) //quests objects
{
mGameObjectForQuestSet.insert(go_entry);
count++;
@@ -7551,15 +7551,15 @@ const char *ObjectMgr::GetTrinityString(int32 entry, int locale_idx) const
{
// locale_idx==-1 -> default, locale_idx >= 0 in to idx+1
// Content[0] always exist if exist TrinityStringLocale
- if(TrinityStringLocale const *msl = GetTrinityStringLocale(entry))
+ if (TrinityStringLocale const *msl = GetTrinityStringLocale(entry))
{
- if(msl->Content.size() > locale_idx+1 && !msl->Content[locale_idx+1].empty())
+ if (msl->Content.size() > locale_idx+1 && !msl->Content[locale_idx+1].empty())
return msl->Content[locale_idx+1].c_str();
else
return msl->Content[0].c_str();
}
- if(entry > 0)
+ if (entry > 0)
sLog.outErrorDb("Entry %i not found in `trinity_string` table.",entry);
else
sLog.outErrorDb("Trinity string entry %i not found in DB.",entry);
@@ -7575,7 +7575,7 @@ void ObjectMgr::LoadSpellDisabledEntrys()
uint32 total_count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
bar.step();
@@ -7593,17 +7593,17 @@ void ObjectMgr::LoadSpellDisabledEntrys()
bar.step();
fields = result->Fetch();
uint32 spellid = fields[0].GetUInt32();
- if(!sSpellStore.LookupEntry(spellid))
+ if (!sSpellStore.LookupEntry(spellid))
{
sLog.outErrorDb("Spell entry %u from `spell_disabled` doesn't exist in dbc, ignoring.",spellid);
continue;
}
uint32 disable_mask = fields[1].GetUInt32();
- if(disable_mask & SPELL_DISABLE_PLAYER)
+ if (disable_mask & SPELL_DISABLE_PLAYER)
m_DisabledPlayerSpells.insert(spellid);
- if(disable_mask & SPELL_DISABLE_CREATURE)
+ if (disable_mask & SPELL_DISABLE_CREATURE)
m_DisabledCreatureSpells.insert(spellid);
- if(disable_mask & SPELL_DISABLE_PET)
+ if (disable_mask & SPELL_DISABLE_PET)
m_DisabledPetSpells.insert(spellid);
++total_count;
} while ( result->NextRow() );
@@ -7619,7 +7619,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
uint32 count = 0;
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,skill FROM skill_fishing_base_level");
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
@@ -7641,7 +7641,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
int32 skill = fields[1].GetInt32();
AreaTableEntry const* fArea = GetAreaEntryByAreaID(entry);
- if(!fArea)
+ if (!fArea)
{
sLog.outErrorDb("AreaId %u defined in `skill_fishing_base_level` does not exist",entry);
continue;
@@ -7669,7 +7669,7 @@ uint16 ObjectMgr::GetConditionId( ConditionType condition, uint32 value1, uint32
mConditions.push_back(lc);
- if(mConditions.size() > 0xFFFF)
+ if (mConditions.size() > 0xFFFF)
{
sLog.outError("Conditions store overflow! Current and later loaded conditions will ignored!");
return 0;
@@ -7683,10 +7683,10 @@ bool ObjectMgr::CheckDeclinedNames( std::wstring mainpart, DeclinedName const& n
for (uint8 i =0; i < MAX_DECLINED_NAME_CASES; ++i)
{
std::wstring wname;
- if(!Utf8toWStr(names.name[i],wname))
+ if (!Utf8toWStr(names.name[i],wname))
return false;
- if(mainpart!=GetMainPartOfName(wname,i+1))
+ if (mainpart!=GetMainPartOfName(wname,i+1))
return false;
}
return true;
@@ -7695,7 +7695,7 @@ bool ObjectMgr::CheckDeclinedNames( std::wstring mainpart, DeclinedName const& n
uint32 ObjectMgr::GetAreaTriggerScriptId(uint32 trigger_id)
{
AreaTriggerScriptMap::const_iterator i = mAreaTriggerScripts.find(trigger_id);
- if(i!= mAreaTriggerScripts.end())
+ if (i!= mAreaTriggerScripts.end())
return i->second;
return 0;
}
@@ -7703,7 +7703,7 @@ uint32 ObjectMgr::GetAreaTriggerScriptId(uint32 trigger_id)
// Checks if player meets the condition
bool PlayerCondition::Meets(Player const * player) const
{
- if( !player )
+ if ( !player )
return false; // player not present, return false
switch (condition)
@@ -7752,7 +7752,7 @@ bool PlayerCondition::Meets(Player const * player) const
{
Unit::AuraApplicationMap const& auras = player->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
- if((itr->second->GetBase()->GetSpellProto()->Attributes & 0x1000010) && itr->second->GetBase()->GetSpellProto()->SpellVisual[0]==3580)
+ if ((itr->second->GetBase()->GetSpellProto()->Attributes & 0x1000010) && itr->second->GetBase()->GetSpellProto()->SpellVisual[0]==3580)
return true;
return false;
}
@@ -7763,7 +7763,7 @@ bool PlayerCondition::Meets(Player const * player) const
case CONDITION_INSTANCE_DATA:
{
Map *map = player->GetMap();
- if(map && map->IsDungeon() && ((InstanceMap*)map)->GetInstanceData())
+ if (map && map->IsDungeon() && ((InstanceMap*)map)->GetInstanceData())
return ((InstanceMap*)map)->GetInstanceData()->GetData(value1) == value2;
}
default:
@@ -7774,7 +7774,7 @@ bool PlayerCondition::Meets(Player const * player) const
// Verification of condition values validity
bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 value2)
{
- if( condition >= MAX_CONDITION) // Wrong condition type
+ if ( condition >= MAX_CONDITION) // Wrong condition type
{
sLog.outErrorDb("Condition has bad type of %u, skipped ", condition );
return false;
@@ -7784,12 +7784,12 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
{
case CONDITION_AURA:
{
- if(!sSpellStore.LookupEntry(value1))
+ if (!sSpellStore.LookupEntry(value1))
{
sLog.outErrorDb("Aura condition requires to have non existing spell (Id: %d), skipped", value1);
return false;
}
- if(value2 > 2)
+ if (value2 > 2)
{
sLog.outErrorDb("Aura condition requires to have non existing effect index (%u) (must be 0..2), skipped", value2);
return false;
@@ -7799,7 +7799,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
case CONDITION_ITEM:
{
ItemPrototype const *proto = objmgr.GetItemPrototype(value1);
- if(!proto)
+ if (!proto)
{
sLog.outErrorDb("Item condition requires to have non existing item (%u), skipped", value1);
return false;
@@ -7809,7 +7809,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
case CONDITION_ITEM_EQUIPPED:
{
ItemPrototype const *proto = objmgr.GetItemPrototype(value1);
- if(!proto)
+ if (!proto)
{
sLog.outErrorDb("ItemEquipped condition requires to have non existing item (%u) equipped, skipped", value1);
return false;
@@ -7819,12 +7819,12 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
case CONDITION_ZONEID:
{
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(value1);
- if(!areaEntry)
+ if (!areaEntry)
{
sLog.outErrorDb("Zone condition requires to be in non existing area (%u), skipped", value1);
return false;
}
- if(areaEntry->zone != 0)
+ if (areaEntry->zone != 0)
{
sLog.outErrorDb("Zone condition requires to be in area (%u) which is a subzone but zone expected, skipped", value1);
return false;
@@ -7834,7 +7834,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
case CONDITION_REPUTATION_RANK:
{
FactionEntry const* factionEntry = sFactionStore.LookupEntry(value1);
- if(!factionEntry)
+ if (!factionEntry)
{
sLog.outErrorDb("Reputation condition requires to have reputation non existing faction (%u), skipped", value1);
return false;
@@ -7874,26 +7874,26 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
sLog.outErrorDb("Quest condition specifies non-existing quest (%u), skipped", value1);
return false;
}
- if(value2)
+ if (value2)
sLog.outErrorDb("Quest condition has useless data in value2 (%u)!", value2);
break;
}
case CONDITION_AD_COMMISSION_AURA:
{
- if(value1)
+ if (value1)
sLog.outErrorDb("Quest condition has useless data in value1 (%u)!", value1);
- if(value2)
+ if (value2)
sLog.outErrorDb("Quest condition has useless data in value2 (%u)!", value2);
break;
}
case CONDITION_NO_AURA:
{
- if(!sSpellStore.LookupEntry(value1))
+ if (!sSpellStore.LookupEntry(value1))
{
sLog.outErrorDb("Aura condition requires to have non existing spell (Id: %d), skipped", value1);
return false;
}
- if(value2 > 2)
+ if (value2 > 2)
{
sLog.outErrorDb("Aura condition requires to have non existing effect index (%u) (must be 0..2), skipped", value2);
return false;
@@ -7903,7 +7903,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
case CONDITION_ACTIVE_EVENT:
{
GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap();
- if(value1 >=events.size() || !events[value1].isValid())
+ if (value1 >=events.size() || !events[value1].isValid())
{
sLog.outErrorDb("Active event condition requires existed event id (%u), skipped", value1);
return false;
@@ -7925,22 +7925,22 @@ SkillRangeType GetSkillRangeType(SkillLineEntry const *pSkill, bool racial)
{
case SKILL_CATEGORY_LANGUAGES: return SKILL_RANGE_LANGUAGE;
case SKILL_CATEGORY_WEAPON:
- if(pSkill->id!=SKILL_FIST_WEAPONS)
+ if (pSkill->id!=SKILL_FIST_WEAPONS)
return SKILL_RANGE_LEVEL;
else
return SKILL_RANGE_MONO;
case SKILL_CATEGORY_ARMOR:
case SKILL_CATEGORY_CLASS:
- if(pSkill->id != SKILL_LOCKPICKING)
+ if (pSkill->id != SKILL_LOCKPICKING)
return SKILL_RANGE_MONO;
else
return SKILL_RANGE_LEVEL;
case SKILL_CATEGORY_SECONDARY:
case SKILL_CATEGORY_PROFESSION:
// not set skills for professions and racial abilities
- if(IsProfessionSkill(pSkill->id))
+ if (IsProfessionSkill(pSkill->id))
return SKILL_RANGE_RANK;
- else if(racial)
+ else if (racial)
return SKILL_RANGE_NONE;
else
return SKILL_RANGE_MONO;
@@ -7958,7 +7958,7 @@ void ObjectMgr::LoadGameTele()
uint32 count = 0;
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, map, name FROM game_tele");
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
@@ -7988,13 +7988,13 @@ void ObjectMgr::LoadGameTele()
gt.mapId = fields[5].GetUInt32();
gt.name = fields[6].GetCppString();
- if(!MapManager::IsValidMapCoord(gt.mapId,gt.position_x,gt.position_y,gt.position_z,gt.orientation))
+ if (!MapManager::IsValidMapCoord(gt.mapId,gt.position_x,gt.position_y,gt.position_z,gt.orientation))
{
sLog.outErrorDb("Wrong position for id %u (name: %s) in `game_tele` table, ignoring.",id,gt.name.c_str());
continue;
}
- if(!Utf8toWStr(gt.name,gt.wnameLow))
+ if (!Utf8toWStr(gt.name,gt.wnameLow))
{
sLog.outErrorDb("Wrong UTF8 name for id %u in `game_tele` table, ignoring.",id);
continue;
@@ -8016,7 +8016,7 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
{
// explicit name case
std::wstring wname;
- if(!Utf8toWStr(name,wname))
+ if (!Utf8toWStr(name,wname))
return false;
// converting string that we try to find to lower case
@@ -8026,7 +8026,7 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
const GameTele* alt = NULL;
for (GameTeleMap::const_iterator itr = m_GameTeleMap.begin(); itr != m_GameTeleMap.end(); ++itr)
{
- if(itr->second.wnameLow == wname)
+ if (itr->second.wnameLow == wname)
return &itr->second;
else if (alt == NULL && itr->second.wnameLow.find(wname) != std::wstring::npos)
alt = &itr->second;
@@ -8040,13 +8040,13 @@ bool ObjectMgr::AddGameTele(GameTele& tele)
// find max id
uint32 new_id = 0;
for (GameTeleMap::const_iterator itr = m_GameTeleMap.begin(); itr != m_GameTeleMap.end(); ++itr)
- if(itr->first > new_id)
+ if (itr->first > new_id)
new_id = itr->first;
// use next
++new_id;
- if(!Utf8toWStr(tele.name,tele.wnameLow))
+ if (!Utf8toWStr(tele.name,tele.wnameLow))
return false;
wstrToLower( tele.wnameLow );
@@ -8061,7 +8061,7 @@ bool ObjectMgr::DeleteGameTele(const std::string& name)
{
// explicit name case
std::wstring wname;
- if(!Utf8toWStr(name,wname))
+ if (!Utf8toWStr(name,wname))
return false;
// converting string that we try to find to lower case
@@ -8069,7 +8069,7 @@ bool ObjectMgr::DeleteGameTele(const std::string& name)
for (GameTeleMap::iterator itr = m_GameTeleMap.begin(); itr != m_GameTeleMap.end(); ++itr)
{
- if(itr->second.wnameLow == wname)
+ if (itr->second.wnameLow == wname)
{
WorldDatabase.PExecuteLog("DELETE FROM game_tele WHERE name = '%s'",itr->second.name.c_str());
m_GameTeleMap.erase(itr);
@@ -8087,7 +8087,7 @@ void ObjectMgr::LoadMailLevelRewards()
uint32 count = 0;
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT level, raceMask, mailTemplateId, senderEntry FROM mail_level_reward");
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
@@ -8111,25 +8111,25 @@ void ObjectMgr::LoadMailLevelRewards()
uint32 mailTemplateId = fields[2].GetUInt32();
uint32 senderEntry = fields[3].GetUInt32();
- if(level > MAX_LEVEL)
+ if (level > MAX_LEVEL)
{
sLog.outErrorDb("Table `mail_level_reward` have data for level %u that more supported by client (%u), ignoring.",level,MAX_LEVEL);
continue;
}
- if(!(raceMask & RACEMASK_ALL_PLAYABLE))
+ if (!(raceMask & RACEMASK_ALL_PLAYABLE))
{
sLog.outErrorDb("Table `mail_level_reward` have raceMask (%u) for level %u that not include any player races, ignoring.",raceMask,level);
continue;
}
- if(!sMailTemplateStore.LookupEntry(mailTemplateId))
+ if (!sMailTemplateStore.LookupEntry(mailTemplateId))
{
sLog.outErrorDb("Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.",mailTemplateId,level);
continue;
}
- if(!GetCreatureTemplateStore(senderEntry))
+ if (!GetCreatureTemplateStore(senderEntry))
{
sLog.outErrorDb("Table `mail_level_reward` have not existed sender creature entry (%u) for level %u that invalid not include any player races, ignoring.",senderEntry,level);
continue;
@@ -8149,13 +8149,13 @@ bool ObjectMgr::AddSpellToTrainer(int32 entry, int32 spell, Field *fields, std::
{
CreatureInfo const* cInfo = GetCreatureTemplate(entry);
- if(!cInfo && entry > 0)
+ if (!cInfo && entry > 0)
{
sLog.outErrorDb("Table `npc_trainer` have entry for not existed creature template (Entry: %u), ignore", entry);
return false;
}
- if(!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER))
+ if (!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER))
{
if (skip_trainers->find(entry) == skip_trainers->end())
{
@@ -8166,21 +8166,21 @@ bool ObjectMgr::AddSpellToTrainer(int32 entry, int32 spell, Field *fields, std::
}
SpellEntry const *spellinfo = sSpellStore.LookupEntry(spell);
- if(!spellinfo)
+ if (!spellinfo)
{
sLog.outErrorDb("Table `npc_trainer` for Trainer (Entry: %u ) has non existing spell %u, ignore", entry,spell);
return false;
}
- if(!SpellMgr::IsSpellValid(spellinfo))
+ if (!SpellMgr::IsSpellValid(spellinfo))
{
sLog.outErrorDb("Table `npc_trainer` for Trainer (Entry: %u) has broken learning spell %u, ignore", entry, spell);
return false;
}
- if(GetTalentSpellCost(spell))
+ if (GetTalentSpellCost(spell))
{
- if(talentIds->count(spell)==0)
+ if (talentIds->count(spell)==0)
{
sLog.outErrorDb("Table `npc_trainer` has talent as learning spell %u, ignore", spell);
talentIds->insert(spell);
@@ -8197,14 +8197,14 @@ bool ObjectMgr::AddSpellToTrainer(int32 entry, int32 spell, Field *fields, std::
trainerSpell.reqSkillValue = fields[4].GetUInt32();
trainerSpell.reqLevel = fields[5].GetUInt32();
- if(!trainerSpell.reqLevel)
+ if (!trainerSpell.reqLevel)
trainerSpell.reqLevel = spellinfo->spellLevel;
// calculate learned spell for profession case when stored cast-spell
trainerSpell.learnedSpell[0] = spell;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if(spellinfo->Effect[i] != SPELL_EFFECT_LEARN_SPELL)
+ if (spellinfo->Effect[i] != SPELL_EFFECT_LEARN_SPELL)
continue;
if (trainerSpell.learnedSpell[0] == spell)
trainerSpell.learnedSpell[0] = 0;
@@ -8223,7 +8223,7 @@ bool ObjectMgr::AddSpellToTrainer(int32 entry, int32 spell, Field *fields, std::
{
if (!trainerSpell.learnedSpell[i])
continue;
- if(SpellMgr::IsProfessionSpell(trainerSpell.learnedSpell[i]))
+ if (SpellMgr::IsProfessionSpell(trainerSpell.learnedSpell[i]))
{
data.trainerType = 2;
break;
@@ -8274,7 +8274,7 @@ void ObjectMgr::LoadTrainerSpell()
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, spell,spellcost,reqskill,reqskillvalue,reqlevel FROM npc_trainer");
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
@@ -8313,7 +8313,7 @@ int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *s
{
// find all items from the reference vendor
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT entry, item, maxcount, incrtime, ExtendedCost FROM npc_vendor WHERE entry='%d'", item);
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
@@ -8341,7 +8341,7 @@ int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *s
uint32 incrtime = fields[3].GetUInt32();
uint32 ExtendedCost = fields[4].GetUInt32();
- if(!IsVendorItemValid(vendor,item_id,maxcount,incrtime,ExtendedCost,NULL,skip_vendors))
+ if (!IsVendorItemValid(vendor,item_id,maxcount,incrtime,ExtendedCost,NULL,skip_vendors))
continue;
VendorItemData& vList = m_mCacheVendorItemMap[vendor];
@@ -8365,7 +8365,7 @@ void ObjectMgr::LoadVendors()
std::set<uint32> skip_vendors;
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, item, maxcount, incrtime, ExtendedCost FROM npc_vendor");
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
@@ -8396,7 +8396,7 @@ void ObjectMgr::LoadVendors()
uint32 incrtime = fields[3].GetUInt32();
uint32 ExtendedCost = fields[4].GetUInt32();
- if(!IsVendorItemValid(entry,item_id,maxcount,incrtime,ExtendedCost,NULL,&skip_vendors))
+ if (!IsVendorItemValid(entry,item_id,maxcount,incrtime,ExtendedCost,NULL,&skip_vendors))
continue;
VendorItemData& vList = m_mCacheVendorItemMap[entry];
@@ -8417,7 +8417,7 @@ void ObjectMgr::LoadNpcTextId()
m_mCacheNpcTextIdMap.clear();
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT npc_guid, textid FROM npc_gossip");
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
@@ -8468,7 +8468,7 @@ void ObjectMgr::LoadGossipMenu()
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, text_id, "
"cond_1, cond_1_val_1, cond_1_val_2, cond_2, cond_2_val_1, cond_2_val_2 FROM gossip_menu");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
@@ -8669,79 +8669,79 @@ void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, int32 maxcount, uint32
VendorItemData& vList = m_mCacheVendorItemMap[entry];
vList.AddItem(item,maxcount,incrtime,extendedcost);
- if(savetodb) WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')",entry, item, maxcount,incrtime,extendedcost);
+ if (savetodb) WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')",entry, item, maxcount,incrtime,extendedcost);
}
bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item, bool savetodb)
{
CacheVendorItemMap::iterator iter = m_mCacheVendorItemMap.find(entry);
- if(iter == m_mCacheVendorItemMap.end())
+ if (iter == m_mCacheVendorItemMap.end())
return false;
- if(!iter->second.FindItem(item))
+ if (!iter->second.FindItem(item))
return false;
iter->second.RemoveItem(item);
- if(savetodb) WorldDatabase.PExecuteLog("DELETE FROM npc_vendor WHERE entry='%u' AND item='%u'",entry, item);
+ if (savetodb) WorldDatabase.PExecuteLog("DELETE FROM npc_vendor WHERE entry='%u' AND item='%u'",entry, item);
return true;
}
bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors, uint32 ORnpcflag ) const
{
CreatureInfo const* cInfo = GetCreatureTemplate(vendor_entry);
- if(!cInfo)
+ if (!cInfo)
{
- if(pl)
+ if (pl)
ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
else
sLog.outErrorDb("Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry);
return false;
}
- if(!((cInfo->npcflag | ORnpcflag) & UNIT_NPC_FLAG_VENDOR))
+ if (!((cInfo->npcflag | ORnpcflag) & UNIT_NPC_FLAG_VENDOR))
{
- if(!skip_vendors || skip_vendors->count(vendor_entry)==0)
+ if (!skip_vendors || skip_vendors->count(vendor_entry)==0)
{
- if(pl)
+ if (pl)
ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
else
sLog.outErrorDb("Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry);
- if(skip_vendors)
+ if (skip_vendors)
skip_vendors->insert(vendor_entry);
}
return false;
}
- if(!GetItemPrototype(item_id))
+ if (!GetItemPrototype(item_id))
{
- if(pl)
+ if (pl)
ChatHandler(pl).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id);
else
sLog.outErrorDb("Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore",vendor_entry,item_id);
return false;
}
- if(ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
+ if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
{
- if(pl)
+ if (pl)
ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST,ExtendedCost);
else
sLog.outErrorDb("Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore",item_id,ExtendedCost,vendor_entry);
return false;
}
- if(maxcount > 0 && incrtime == 0)
+ if (maxcount > 0 && incrtime == 0)
{
- if(pl)
+ if (pl)
ChatHandler(pl).PSendSysMessage("MaxCount!=0 (%u) but IncrTime==0", maxcount);
else
sLog.outErrorDb( "Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry);
return false;
}
- else if(maxcount==0 && incrtime > 0)
+ else if (maxcount==0 && incrtime > 0)
{
- if(pl)
+ if (pl)
ChatHandler(pl).PSendSysMessage("MaxCount==0 but IncrTime<>=0");
else
sLog.outErrorDb( "Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry);
@@ -8749,21 +8749,21 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, int32 ma
}
VendorItemData const* vItems = GetNpcVendorItemList(vendor_entry);
- if(!vItems)
+ if (!vItems)
return true; // later checks for non-empty lists
- if(vItems->FindItem(item_id))
+ if (vItems->FindItem(item_id))
{
- if(pl)
+ if (pl)
ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST,item_id);
else
sLog.outErrorDb( "Table `(game_event_)npc_vendor` has duplicate items %u for vendor (Entry: %u), ignore", item_id, vendor_entry);
return false;
}
- if(vItems->GetItemCount() >= MAX_VENDOR_ITEMS)
+ if (vItems->GetItemCount() >= MAX_VENDOR_ITEMS)
{
- if(pl)
+ if (pl)
ChatHandler(pl).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS);
else
sLog.outErrorDb( "Table `npc_vendor` has too many items (%u >= %i) for vendor (Entry: %u), ignore", vItems->GetItemCount(), MAX_VENDOR_ITEMS, vendor_entry);
@@ -8818,10 +8818,10 @@ uint32 ObjectMgr::GetScriptId(const char *name)
{
// use binary search to find the script name in the sorted vector
// assume "" is the first element
- if(!name) return 0;
+ if (!name) return 0;
ScriptNameMap::const_iterator itr =
std::lower_bound(m_scriptNames.begin(), m_scriptNames.end(), name);
- if(itr == m_scriptNames.end() || *itr != name) return 0;
+ if (itr == m_scriptNames.end() || *itr != name) return 0;
return itr - m_scriptNames.begin();
}
@@ -8835,7 +8835,7 @@ void ObjectMgr::CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids)
{
case SCRIPT_COMMAND_TALK:
{
- if(!GetTrinityStringLocale (itrM->second.dataint))
+ if (!GetTrinityStringLocale (itrM->second.dataint))
sLog.outErrorDb( "Table `db_script_string` not has string id %u used db script (ID: %u)", itrM->second.dataint, itrMM->first);
if (ids.find(itrM->second.dataint) != ids.end())
@@ -8853,7 +8853,7 @@ void ObjectMgr::LoadDbScriptStrings()
std::set<int32> ids;
for (int32 i = MIN_DB_SCRIPT_STRING_ID; i < MAX_DB_SCRIPT_STRING_ID; ++i)
- if(GetTrinityStringLocale(i))
+ if (GetTrinityStringLocale(i))
ids.insert(i);
CheckScripts(sQuestEndScripts,ids);
@@ -8912,7 +8912,7 @@ void ObjectMgr::LoadTransportEvents()
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, waypoint_id, event_id FROM transport_events");
- if( !result )
+ if ( !result )
{
barGoLink bar1( 1 );
bar1.step();
@@ -8958,7 +8958,7 @@ uint64 ObjectMgr::GenerateGMTicketId()
void ObjectMgr::LoadGMTickets()
{
- if(!m_GMTicketList.empty())
+ if (!m_GMTicketList.empty())
{
for (GmTicketList::const_iterator itr = m_GMTicketList.begin(); itr != m_GMTicketList.end(); ++itr)
delete *itr;
@@ -8968,7 +8968,7 @@ void ObjectMgr::LoadGMTickets()
QueryResult_AutoPtr result = CharacterDatabase.Query( "SELECT guid, playerGuid, name, message, createtime, map, posX, posY, posZ, timestamp, closed, assignedto, comment FROM gm_tickets" );
- if(!result)
+ if (!result)
{
barGoLink bar(1);
bar.step();
@@ -9006,7 +9006,7 @@ void ObjectMgr::LoadGMTickets()
result = CharacterDatabase.PQuery("SELECT MAX(guid) from gm_tickets");
- if(result)
+ if (result)
{
Field *fields = result->Fetch();
m_GMticketid = fields[0].GetUInt64();
@@ -9017,7 +9017,7 @@ void ObjectMgr::LoadGMTickets()
void ObjectMgr::AddOrUpdateGMTicket(GM_Ticket &ticket, bool create)
{
- if(create)
+ if (create)
m_GMTicketList.push_back(&ticket);
_AddOrUpdateGMTicket(ticket);
@@ -9052,9 +9052,9 @@ void ObjectMgr::_AddOrUpdateGMTicket(GM_Ticket &ticket)
void ObjectMgr::RemoveGMTicket(GM_Ticket *ticket, int64 source, bool permanently)
{
for (GmTicketList::iterator i = m_GMTicketList.begin(); i != m_GMTicketList.end(); ++i)
- if((*i)->guid == ticket->guid)
+ if ((*i)->guid == ticket->guid)
{
- if(permanently)
+ if (permanently)
{
CharacterDatabase.PExecute("DELETE FROM gm_tickets WHERE guid = '%u'", ticket->guid);
i = m_GMTicketList.erase(i);
diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h
index 783a859418f..272c7a1753d 100644
--- a/src/game/ObjectMgr.h
+++ b/src/game/ObjectMgr.h
@@ -479,17 +479,17 @@ class ObjectMgr
PlayerClassInfo const* GetPlayerClassInfo(uint32 class_) const
{
- if(class_ >= MAX_CLASSES) return NULL;
+ if (class_ >= MAX_CLASSES) return NULL;
return &playerClassInfo[class_];
}
void GetPlayerClassLevelInfo(uint32 class_,uint8 level, PlayerClassLevelInfo* info) const;
PlayerInfo const* GetPlayerInfo(uint32 race, uint32 class_) const
{
- if(race >= MAX_RACES) return NULL;
- if(class_ >= MAX_CLASSES) return NULL;
+ if (race >= MAX_RACES) return NULL;
+ if (class_ >= MAX_CLASSES) return NULL;
PlayerInfo const* info = &playerInfo[race][class_];
- if(info->displayId_m==0 || info->displayId_f==0) return NULL;
+ if (info->displayId_m==0 || info->displayId_f==0) return NULL;
return info;
}
void GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, PlayerLevelInfo* info) const;
@@ -516,7 +516,7 @@ class ObjectMgr
uint32 GetQuestForAreaTrigger(uint32 Trigger_ID) const
{
QuestAreaTriggerMap::const_iterator itr = mQuestAreaTriggerMap.find(Trigger_ID);
- if(itr != mQuestAreaTriggerMap.end())
+ if (itr != mQuestAreaTriggerMap.end())
return itr->second;
return 0;
}
@@ -541,7 +541,7 @@ class ObjectMgr
AreaTrigger const* GetAreaTrigger(uint32 trigger) const
{
AreaTriggerMap::const_iterator itr = mAreaTriggers.find( trigger );
- if( itr != mAreaTriggers.end( ) )
+ if ( itr != mAreaTriggers.end( ) )
return &itr->second;
return NULL;
}
@@ -549,7 +549,7 @@ class ObjectMgr
AccessRequirement const* GetAccessRequirement(uint32 requirement) const
{
AccessRequirementMap::const_iterator itr = mAccessRequirements.find( requirement );
- if( itr != mAccessRequirements.end( ) )
+ if ( itr != mAccessRequirements.end( ) )
return &itr->second;
return NULL;
}
@@ -562,7 +562,7 @@ class ObjectMgr
ReputationOnKillEntry const* GetReputationOnKilEntry(uint32 id) const
{
RepOnKillMap::const_iterator itr = mRepOnKill.find(id);
- if(itr != mRepOnKill.end())
+ if (itr != mRepOnKill.end())
return &itr->second;
return NULL;
}
@@ -570,7 +570,7 @@ class ObjectMgr
PointOfInterest const* GetPointOfInterest(uint32 id) const
{
PointOfInterestMap::const_iterator itr = mPointsOfInterest.find(id);
- if(itr != mPointsOfInterest.end())
+ if (itr != mPointsOfInterest.end())
return &itr->second;
return NULL;
}
@@ -578,7 +578,7 @@ class ObjectMgr
QuestPOIVector const* GetQuestPOIVector(uint32 questId)
{
QuestPOIMap::const_iterator itr = mQuestPOIMap.find(questId);
- if(itr != mQuestPOIMap.end())
+ if (itr != mQuestPOIMap.end())
return &itr->second;
return NULL;
}
@@ -749,7 +749,7 @@ class ObjectMgr
WeatherZoneChances const* GetWeatherChances(uint32 zone_id) const
{
WeatherZoneMap::const_iterator itr = mWeatherZoneMap.find(zone_id);
- if(itr != mWeatherZoneMap.end())
+ if (itr != mWeatherZoneMap.end())
return &itr->second;
else
return NULL;
@@ -763,7 +763,7 @@ class ObjectMgr
CreatureData const* GetCreatureData(uint32 guid) const
{
CreatureDataMap::const_iterator itr = mCreatureDataMap.find(guid);
- if(itr==mCreatureDataMap.end()) return NULL;
+ if (itr==mCreatureDataMap.end()) return NULL;
return &itr->second;
}
CreatureData& NewOrExistCreatureData(uint32 guid) { return mCreatureDataMap[guid]; }
@@ -771,55 +771,55 @@ class ObjectMgr
uint32 GetLinkedRespawnGuid(uint32 guid) const
{
CreatureLinkedRespawnMap::const_iterator itr = mCreatureLinkedRespawnMap.find(guid);
- if(itr == mCreatureLinkedRespawnMap.end()) return 0;
+ if (itr == mCreatureLinkedRespawnMap.end()) return 0;
return itr->second;
}
CreatureLocale const* GetCreatureLocale(uint32 entry) const
{
CreatureLocaleMap::const_iterator itr = mCreatureLocaleMap.find(entry);
- if(itr==mCreatureLocaleMap.end()) return NULL;
+ if (itr==mCreatureLocaleMap.end()) return NULL;
return &itr->second;
}
GameObjectLocale const* GetGameObjectLocale(uint32 entry) const
{
GameObjectLocaleMap::const_iterator itr = mGameObjectLocaleMap.find(entry);
- if(itr==mGameObjectLocaleMap.end()) return NULL;
+ if (itr==mGameObjectLocaleMap.end()) return NULL;
return &itr->second;
}
ItemLocale const* GetItemLocale(uint32 entry) const
{
ItemLocaleMap::const_iterator itr = mItemLocaleMap.find(entry);
- if(itr==mItemLocaleMap.end()) return NULL;
+ if (itr==mItemLocaleMap.end()) return NULL;
return &itr->second;
}
QuestLocale const* GetQuestLocale(uint32 entry) const
{
QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry);
- if(itr==mQuestLocaleMap.end()) return NULL;
+ if (itr==mQuestLocaleMap.end()) return NULL;
return &itr->second;
}
NpcTextLocale const* GetNpcTextLocale(uint32 entry) const
{
NpcTextLocaleMap::const_iterator itr = mNpcTextLocaleMap.find(entry);
- if(itr==mNpcTextLocaleMap.end()) return NULL;
+ if (itr==mNpcTextLocaleMap.end()) return NULL;
return &itr->second;
}
PageTextLocale const* GetPageTextLocale(uint32 entry) const
{
PageTextLocaleMap::const_iterator itr = mPageTextLocaleMap.find(entry);
- if(itr==mPageTextLocaleMap.end()) return NULL;
+ if (itr==mPageTextLocaleMap.end()) return NULL;
return &itr->second;
}
GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const
{
GossipMenuItemsLocaleMap::const_iterator itr = mGossipMenuItemsLocaleMap.find(entry);
- if(itr==mGossipMenuItemsLocaleMap.end()) return NULL;
+ if (itr==mGossipMenuItemsLocaleMap.end()) return NULL;
return &itr->second;
}
PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const
{
PointOfInterestLocaleMap::const_iterator itr = mPointOfInterestLocaleMap.find(poi_id);
- if(itr==mPointOfInterestLocaleMap.end()) return NULL;
+ if (itr==mPointOfInterestLocaleMap.end()) return NULL;
return &itr->second;
}
@@ -835,7 +835,7 @@ class ObjectMgr
GameObjectData const* GetGOData(uint32 guid) const
{
GameObjectDataMap::const_iterator itr = mGameObjectDataMap.find(guid);
- if(itr==mGameObjectDataMap.end()) return NULL;
+ if (itr==mGameObjectDataMap.end()) return NULL;
return &itr->second;
}
GameObjectData& NewGOData(uint32 guid) { return mGameObjectDataMap[guid]; }
@@ -844,7 +844,7 @@ class ObjectMgr
TrinityStringLocale const* GetTrinityStringLocale(int32 entry) const
{
TrinityStringLocaleMap::const_iterator itr = mTrinityStringLocaleMap.find(entry);
- if(itr==mTrinityStringLocaleMap.end()) return NULL;
+ if (itr==mTrinityStringLocaleMap.end()) return NULL;
return &itr->second;
}
const char *GetTrinityString(int32 entry, int locale_idx) const;
@@ -892,7 +892,7 @@ class ObjectMgr
uint16 GetConditionId(ConditionType condition, uint32 value1, uint32 value2);
bool IsPlayerMeetToCondition(Player const* player, uint16 condition_id) const
{
- if(condition_id >= mConditions.size())
+ if (condition_id >= mConditions.size())
return false;
return mConditions[condition_id].Meets(player);
@@ -901,7 +901,7 @@ class ObjectMgr
GameTele const* GetGameTele(uint32 id) const
{
GameTeleMap::const_iterator itr = m_GameTeleMap.find(id);
- if(itr==m_GameTeleMap.end()) return NULL;
+ if (itr==m_GameTeleMap.end()) return NULL;
return &itr->second;
}
GameTele const* GetGameTele(const std::string& name) const;
@@ -912,7 +912,7 @@ class ObjectMgr
uint32 GetNpcGossip(uint32 entry) const
{
CacheNpcTextIdMap::const_iterator iter = m_mCacheNpcTextIdMap.find(entry);
- if(iter == m_mCacheNpcTextIdMap.end())
+ if (iter == m_mCacheNpcTextIdMap.end())
return 0;
return iter->second;
@@ -921,7 +921,7 @@ class ObjectMgr
TrainerSpellData const* GetNpcTrainerSpells(uint32 entry) const
{
CacheTrainerSpellMap::const_iterator iter = m_mCacheTrainerSpellMap.find(entry);
- if(iter == m_mCacheTrainerSpellMap.end())
+ if (iter == m_mCacheTrainerSpellMap.end())
return NULL;
return &iter->second;
@@ -930,7 +930,7 @@ class ObjectMgr
VendorItemData const* GetNpcVendorItemList(uint32 entry) const
{
CacheVendorItemMap::const_iterator iter = m_mCacheVendorItemMap.find(entry);
- if(iter == m_mCacheVendorItemMap.end())
+ if (iter == m_mCacheVendorItemMap.end())
return NULL;
return &iter->second;
@@ -959,7 +959,7 @@ class ObjectMgr
GM_Ticket *GetGMTicket(uint64 ticketGuid)
{
for (GmTicketList::const_iterator i = m_GMTicketList.begin(); i != m_GMTicketList.end(); ++i)
- if((*i) && (*i)->guid == ticketGuid)
+ if ((*i) && (*i)->guid == ticketGuid)
return (*i);
return NULL;
@@ -967,7 +967,7 @@ class ObjectMgr
GM_Ticket *GetGMTicketByPlayer(uint64 playerGuid)
{
for (GmTicketList::const_iterator i = m_GMTicketList.begin(); i != m_GMTicketList.end(); ++i)
- if((*i) && (*i)->playerGuid == playerGuid && (*i)->closed == 0)
+ if ((*i) && (*i)->playerGuid == playerGuid && (*i)->closed == 0)
return (*i);
return NULL;
diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h
index 38631a2c196..4d3be8220c2 100644
--- a/src/game/Opcodes.h
+++ b/src/game/Opcodes.h
@@ -900,15 +900,15 @@ enum Opcodes
CMSG_LFG_LEAVE = 0x35D, // CMSG LeaveLFG
CMSG_SEARCH_LFG_JOIN = 0x35E, // CMSG SearchLFGJoin
CMSG_SEARCH_LFG_LEAVE = 0x35F, // CMSG SearchLFGLeave
- SMSG_UPDATE_LFG_LIST = 0x360, // SMSG uint32, uint32, if(uint8) { uint32 count, for (count) { uint64} }, uint32 count2, uint32, for (count2) { uint64, uint32 flags, if(flags & 0x2) {string}, if(flags & 0x10) {for (3) uint8}, if(flags & 0x80) {uint64, uint32}}, uint32 count3, uint32, for (count3) {uint64, uint32 flags, if(flags & 0x1) {uint8, uint8, uint8, for (3) uint8, uint32, uint32, uint32, uint32, uint32, uint32, float, float, uint32, uint32, uint32, uint32, uint32, float, uint32, uint32, uint32, uint32, uint32, uint32}, if(flags&0x2) string, if(flags&0x4) uint8, if(flags&0x8) uint64, if(flags&0x10) uint8, if(flags&0x20) uint32, if(flags&0x40) uint8, if(flags& 0x80) {uint64, uint32}}
+ SMSG_UPDATE_LFG_LIST = 0x360, // SMSG uint32, uint32, if (uint8) { uint32 count, for (count) { uint64} }, uint32 count2, uint32, for (count2) { uint64, uint32 flags, if (flags & 0x2) {string}, if (flags & 0x10) {for (3) uint8}, if (flags & 0x80) {uint64, uint32}}, uint32 count3, uint32, for (count3) {uint64, uint32 flags, if (flags & 0x1) {uint8, uint8, uint8, for (3) uint8, uint32, uint32, uint32, uint32, uint32, uint32, float, float, uint32, uint32, uint32, uint32, uint32, float, uint32, uint32, uint32, uint32, uint32, uint32}, if (flags&0x2) string, if (flags&0x4) uint8, if (flags&0x8) uint64, if (flags&0x10) uint8, if (flags&0x20) uint32, if (flags&0x40) uint8, if (flags& 0x80) {uint64, uint32}}
SMSG_LFG_PROPOSAL_DECLINED = 0x361, // SMSG uint32, uint8, uint32, uint32, uint8, for (uint8) {uint32,uint8,uint8,uint8,uint8}
CMSG_LFG_PROPOSAL_RESULT = 0x362, // CMSG AcceptProposal, RejectProposal
SMSG_LFG_ROLE_CHECK = 0x363, // SMSG uint32, uint8, for (uint8) uint32, uint8, for (uint8) { uint64, uint8, uint32, uint8, }
- SMSG_LFG_ROLE_CHECK_FAILED_RESULT = 0x364, // SMSG uint32 unk, uint32, if(unk==6) { uint8 count, for (count) uint64 }
+ SMSG_LFG_ROLE_CHECK_FAILED_RESULT = 0x364, // SMSG uint32 unk, uint32, if (unk==6) { uint8 count, for (count) uint64 }
SMSG_LFG_QUEUE_STATUS_UPDATE = 0x365, // SMSG uint32 dungeon, uint32 lfgtype, uint32, uint32, uint32, uint32, uint8, uint8, uint8, uint8
CMSG_SET_LFG_COMMENT = 0x366, // CMSG SetLFGComment
- SMSG_LFG_LFG_PROPOSAL_INFO = 0x367, // SMSG uint8, if(uint8) { uint8, uint8, uint8, uint8, if(uint8) for (uint8) uint32, string}
- SMSG_LFG_LFG_PROPOSAL_INFO2 = 0x368, // SMSG uint8, if(uint8) { uint8, uint8, uint8, for (3) uint8, uint8, if(uint8) for (uint8) uint32, string}
+ SMSG_LFG_LFG_PROPOSAL_INFO = 0x367, // SMSG uint8, if (uint8) { uint8, uint8, uint8, uint8, if (uint8) for (uint8) uint32, string}
+ SMSG_LFG_LFG_PROPOSAL_INFO2 = 0x368, // SMSG uint8, if (uint8) { uint8, uint8, uint8, for (3) uint8, uint8, if (uint8) for (uint8) uint32, string}
SMSG_LFG_UPDATE_LIST = 0x369, // SMSG uint8
CMSG_LFG_SET_ROLES = 0x36A, // CMSG SetLFGRoles
CMSG_LFG_SET_NEEDS = 0x36B, // CMSG SetLFGNeeds
diff --git a/src/game/OutdoorPvP.cpp b/src/game/OutdoorPvP.cpp
index 1d89a4fa63e..7f2566f518a 100644
--- a/src/game/OutdoorPvP.cpp
+++ b/src/game/OutdoorPvP.cpp
@@ -40,7 +40,7 @@ m_maxSpeed(0), m_capturePoint(NULL)
bool OPvPCapturePoint::HandlePlayerEnter(Player * plr)
{
- if(m_capturePoint)
+ if (m_capturePoint)
{
plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
@@ -51,14 +51,14 @@ bool OPvPCapturePoint::HandlePlayerEnter(Player * plr)
void OPvPCapturePoint::HandlePlayerLeave(Player * plr)
{
- if(m_capturePoint)
+ if (m_capturePoint)
plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
m_activePlayers[plr->GetTeamId()].erase(plr);
}
void OPvPCapturePoint::SendChangePhase()
{
- if(!m_capturePoint)
+ if (!m_capturePoint)
return;
// send this too, sometimes the slider disappears, dunno why :(
@@ -71,10 +71,10 @@ void OPvPCapturePoint::SendChangePhase()
void OPvPCapturePoint::AddGO(uint32 type, uint32 guid, uint32 entry)
{
- if(!entry)
+ if (!entry)
{
const GameObjectData *data = objmgr.GetGOData(guid);
- if(!data)
+ if (!data)
return;
entry = data->id;
}
@@ -84,10 +84,10 @@ void OPvPCapturePoint::AddGO(uint32 type, uint32 guid, uint32 entry)
void OPvPCapturePoint::AddCre(uint32 type, uint32 guid, uint32 entry)
{
- if(!entry)
+ if (!entry)
{
const CreatureData *data = objmgr.GetCreatureData(guid);
- if(!data)
+ if (!data)
return;
entry = data->id;
}
@@ -97,7 +97,7 @@ void OPvPCapturePoint::AddCre(uint32 type, uint32 guid, uint32 entry)
bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
{
- if(uint32 guid = objmgr.AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3))
+ if (uint32 guid = objmgr.AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3))
{
AddGO(type, guid, entry);
return true;
@@ -108,7 +108,7 @@ bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x,
bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 team, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay)
{
- if(uint32 guid = objmgr.AddCreData(entry, team, map, x, y, z, o, spawntimedelay))
+ if (uint32 guid = objmgr.AddCreData(entry, team, map, x, y, z, o, spawntimedelay))
{
AddCre(type, guid, entry);
return true;
@@ -123,14 +123,14 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl
// check info existence
GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(entry);
- if(!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT)
+ if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT)
{
sLog.outError("OutdoorPvP: GO %u is not capture point!", entry);
return false;
}
m_capturePointGUID = objmgr.AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3);
- if(!m_capturePointGUID)
+ if (!m_capturePointGUID)
return false;
// get the needed values from goinfo
@@ -144,14 +144,14 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl
bool OPvPCapturePoint::DelCreature(uint32 type)
{
- if(!m_Creatures[type])
+ if (!m_Creatures[type])
{
sLog.outDebug("opvp creature type %u was already deleted",type);
return false;
}
Creature *cr = HashMapHolder<Creature>::Find(m_Creatures[type]);
- if(!cr)
+ if (!cr)
{
// can happen when closing the core
m_Creatures[type] = 0;
@@ -165,7 +165,7 @@ bool OPvPCapturePoint::DelCreature(uint32 type)
// explicit removal from map
// beats me why this is needed, but with the recent removal "cleanup" some creatures stay in the map if "properly" deleted
// so this is a big fat workaround, if AddObjectToRemoveList and DoDelayedMovesAndRemoves worked correctly, this wouldn't be needed
- //if(Map * map = MapManager::Instance().FindMap(cr->GetMapId()))
+ //if (Map * map = MapManager::Instance().FindMap(cr->GetMapId()))
// map->Remove(cr,false);
// delete respawn time for this creature
WorldDatabase.PExecute("DELETE FROM creature_respawn WHERE guid = '%u'", guid);
@@ -178,11 +178,11 @@ bool OPvPCapturePoint::DelCreature(uint32 type)
bool OPvPCapturePoint::DelObject(uint32 type)
{
- if(!m_Objects[type])
+ if (!m_Objects[type])
return false;
GameObject *obj = HashMapHolder<GameObject>::Find(m_Objects[type]);
- if(!obj)
+ if (!obj)
{
m_Objects[type] = 0;
return false;
@@ -201,7 +201,7 @@ bool OPvPCapturePoint::DelCapturePoint()
objmgr.DeleteGOData(m_capturePointGUID);
m_capturePointGUID = 0;
- if(m_capturePoint)
+ if (m_capturePoint)
{
m_capturePoint->SetRespawnTime(0); // not save respawn time
m_capturePoint->Delete();
@@ -245,7 +245,7 @@ void OutdoorPvP::HandlePlayerLeaveZone(Player * plr, uint32 zone)
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
itr->second->HandlePlayerLeave(plr);
// remove the world state information from the player (we can't keep everyone up to date, so leave out those who are not in the concerning zones)
- if(!plr->GetSession()->PlayerLogout())
+ if (!plr->GetSession()->PlayerLogout())
SendRemoveWorldStates(plr);
m_players[plr->GetTeamId()].erase(plr);
sLog.outDebug("Player %s left an outdoorpvp zone", plr->GetName());
@@ -260,7 +260,7 @@ bool OutdoorPvP::Update(uint32 diff)
bool objective_changed = false;
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
{
- if(itr->second->Update(diff))
+ if (itr->second->Update(diff))
objective_changed = true;
}
return objective_changed;
@@ -268,7 +268,7 @@ bool OutdoorPvP::Update(uint32 diff)
bool OPvPCapturePoint::Update(uint32 diff)
{
- if(!m_capturePoint)
+ if (!m_capturePoint)
return false;
float radius = m_capturePoint->GetGOInfo()->capturePoint.radius;
@@ -279,7 +279,7 @@ bool OPvPCapturePoint::Update(uint32 diff)
{
Player *player = *itr;
++itr;
- if(!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
+ if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
HandlePlayerLeave(player);
}
}
@@ -291,28 +291,28 @@ bool OPvPCapturePoint::Update(uint32 diff)
for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
{
- if((*itr)->IsOutdoorPvPActive())
+ if ((*itr)->IsOutdoorPvPActive())
{
- if(m_activePlayers[(*itr)->GetTeamId()].insert(*itr).second)
+ if (m_activePlayers[(*itr)->GetTeamId()].insert(*itr).second)
HandlePlayerEnter(*itr);
}
}
// get the difference of numbers
float fact_diff = ((float)m_activePlayers[0].size() - (float)m_activePlayers[1].size()) * diff / OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL;
- if(!fact_diff)
+ if (!fact_diff)
return false;
uint32 Challenger = 0;
float maxDiff = m_maxSpeed * diff;
- if(fact_diff < 0)
+ if (fact_diff < 0)
{
// horde is in majority, but it's already horde-controlled -> no change
- if(m_State == OBJECTIVESTATE_HORDE && m_value <= -m_maxValue)
+ if (m_State == OBJECTIVESTATE_HORDE && m_value <= -m_maxValue)
return false;
- if(fact_diff < -maxDiff)
+ if (fact_diff < -maxDiff)
fact_diff = -maxDiff;
Challenger = HORDE;
@@ -320,10 +320,10 @@ bool OPvPCapturePoint::Update(uint32 diff)
else
{
// ally is in majority, but it's already ally-controlled -> no change
- if(m_State == OBJECTIVESTATE_ALLIANCE && m_value >= m_maxValue)
+ if (m_State == OBJECTIVESTATE_ALLIANCE && m_value >= m_maxValue)
return false;
- if(fact_diff > maxDiff)
+ if (fact_diff > maxDiff)
fact_diff = maxDiff;
Challenger = ALLIANCE;
@@ -336,47 +336,47 @@ bool OPvPCapturePoint::Update(uint32 diff)
m_value += fact_diff;
- if(m_value < -m_minValue) // red
+ if (m_value < -m_minValue) // red
{
- if(m_value < -m_maxValue)
+ if (m_value < -m_maxValue)
m_value = -m_maxValue;
m_State = OBJECTIVESTATE_HORDE;
m_team = TEAM_HORDE;
}
- else if(m_value > m_minValue) // blue
+ else if (m_value > m_minValue) // blue
{
- if(m_value > m_maxValue)
+ if (m_value > m_maxValue)
m_value = m_maxValue;
m_State = OBJECTIVESTATE_ALLIANCE;
m_team = TEAM_ALLIANCE;
}
- else if(oldValue * m_value <= 0) // grey, go through mid point
+ else if (oldValue * m_value <= 0) // grey, go through mid point
{
// if challenger is ally, then n->a challenge
- if(Challenger == ALLIANCE)
+ if (Challenger == ALLIANCE)
m_State = OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE;
// if challenger is horde, then n->h challenge
- else if(Challenger == HORDE)
+ else if (Challenger == HORDE)
m_State = OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE;
m_team = TEAM_NEUTRAL;
}
else // grey, did not go through mid point
{
// old phase and current are on the same side, so one team challenges the other
- if(Challenger == ALLIANCE && (m_OldState == OBJECTIVESTATE_HORDE || m_OldState == OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE))
+ if (Challenger == ALLIANCE && (m_OldState == OBJECTIVESTATE_HORDE || m_OldState == OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE))
m_State = OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE;
- else if(Challenger == HORDE && (m_OldState == OBJECTIVESTATE_ALLIANCE || m_OldState == OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE))
+ else if (Challenger == HORDE && (m_OldState == OBJECTIVESTATE_ALLIANCE || m_OldState == OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE))
m_State = OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE;
m_team = TEAM_NEUTRAL;
}
- if(m_value != oldValue)
+ if (m_value != oldValue)
SendChangePhase();
- if(m_OldState != m_State)
+ if (m_OldState != m_State)
{
//sLog.outError("%u->%u", m_OldState, m_State);
- if(oldTeam != m_team)
+ if (oldTeam != m_team)
ChangeTeam(oldTeam);
ChangeState();
return true;
@@ -387,7 +387,7 @@ bool OPvPCapturePoint::Update(uint32 diff)
void OutdoorPvP::SendUpdateWorldState(uint32 field, uint32 value)
{
- if(m_sendUpdate)
+ if (m_sendUpdate)
for (int i = 0; i < 2; ++i)
for (PlayerSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
(*itr)->SendUpdateWorldState(field, value);
@@ -427,22 +427,22 @@ void OPvPCapturePoint::SendObjectiveComplete(uint32 id,uint64 guid)
void OutdoorPvP::HandleKill(Player *killer, Unit * killed)
{
- if(Group * pGroup = killer->GetGroup())
+ if (Group * pGroup = killer->GetGroup())
{
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *pGroupGuy = itr->getSource();
- if(!pGroupGuy)
+ if (!pGroupGuy)
continue;
// skip if too far away
- if(!pGroupGuy->IsAtGroupRewardDistance(killed))
+ if (!pGroupGuy->IsAtGroupRewardDistance(killed))
continue;
// creature kills must be notified, even if not inside objective / not outdoor pvp active
// player kills only count if active and inside objective
- if(( pGroupGuy->IsOutdoorPvPActive() && IsInsideObjective(pGroupGuy) ) || killed->GetTypeId() == TYPEID_UNIT)
+ if (( pGroupGuy->IsOutdoorPvPActive() && IsInsideObjective(pGroupGuy) ) || killed->GetTypeId() == TYPEID_UNIT)
{
HandleKillImpl(pGroupGuy, killed);
}
@@ -451,7 +451,7 @@ void OutdoorPvP::HandleKill(Player *killer, Unit * killed)
else
{
// creature kills must be notified, even if not inside objective / not outdoor pvp active
- if(killer && (( killer->IsOutdoorPvPActive() && IsInsideObjective(killer) ) || killed->GetTypeId() == TYPEID_UNIT))
+ if (killer && (( killer->IsOutdoorPvPActive() && IsInsideObjective(killer) ) || killed->GetTypeId() == TYPEID_UNIT))
{
HandleKillImpl(killer, killed);
}
@@ -461,7 +461,7 @@ void OutdoorPvP::HandleKill(Player *killer, Unit * killed)
bool OutdoorPvP::IsInsideObjective(Player *plr) const
{
for (OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
- if(itr->second->IsInsideObjective(plr))
+ if (itr->second->IsInsideObjective(plr))
return true;
return false;
@@ -475,7 +475,7 @@ bool OPvPCapturePoint::IsInsideObjective(Player *plr) const
bool OutdoorPvP::HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
- if(itr->second->HandleCustomSpell(plr,spellId,go))
+ if (itr->second->HandleCustomSpell(plr,spellId,go))
return true;
return false;
@@ -483,7 +483,7 @@ bool OutdoorPvP::HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go)
bool OPvPCapturePoint::HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go)
{
- if(!plr->IsOutdoorPvPActive())
+ if (!plr->IsOutdoorPvPActive())
return false;
return false;
}
@@ -491,7 +491,7 @@ bool OPvPCapturePoint::HandleCustomSpell(Player *plr, uint32 spellId, GameObject
bool OutdoorPvP::HandleOpenGo(Player *plr, uint64 guid)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
- if(itr->second->HandleOpenGo(plr,guid) >= 0)
+ if (itr->second->HandleOpenGo(plr,guid) >= 0)
return true;
return false;
@@ -500,7 +500,7 @@ bool OutdoorPvP::HandleOpenGo(Player *plr, uint64 guid)
bool OutdoorPvP::HandleGossipOption(Player * plr, uint64 guid, uint32 id)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
- if(itr->second->HandleGossipOption(plr, guid, id))
+ if (itr->second->HandleGossipOption(plr, guid, id))
return true;
return false;
@@ -509,7 +509,7 @@ bool OutdoorPvP::HandleGossipOption(Player * plr, uint64 guid, uint32 id)
bool OutdoorPvP::CanTalkTo(Player * plr, Creature * c, GossipMenuItems gso)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
- if(itr->second->CanTalkTo(plr, c, gso))
+ if (itr->second->CanTalkTo(plr, c, gso))
return true;
return false;
@@ -518,7 +518,7 @@ bool OutdoorPvP::CanTalkTo(Player * plr, Creature * c, GossipMenuItems gso)
bool OutdoorPvP::HandleDropFlag(Player * plr, uint32 id)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
- if(itr->second->HandleDropFlag(plr, id))
+ if (itr->second->HandleDropFlag(plr, id))
return true;
return false;
@@ -542,7 +542,7 @@ bool OPvPCapturePoint::HandleDropFlag(Player * plr, uint32 id)
int32 OPvPCapturePoint::HandleOpenGo(Player *plr, uint64 guid)
{
std::map<uint64,uint32>::iterator itr = m_ObjectTypes.find(guid);
- if(itr != m_ObjectTypes.end())
+ if (itr != m_ObjectTypes.end())
{
return itr->second;
}
@@ -574,7 +574,7 @@ bool OutdoorPvP::HasPlayer(Player *plr) const
void OutdoorPvP::TeamCastSpell(TeamId team, int32 spellId)
{
- if(spellId > 0)
+ if (spellId > 0)
for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
(*itr)->CastSpell(*itr, (uint32)spellId, true);
else
@@ -590,9 +590,9 @@ void OutdoorPvP::TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2)
void OutdoorPvP::OnGameObjectCreate(GameObject *go, bool add)
{
- if(go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT)
+ if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT)
return;
- if(OPvPCapturePoint *cp = GetCapturePoint(go->GetDBTableGUIDLow()))
+ if (OPvPCapturePoint *cp = GetCapturePoint(go->GetDBTableGUIDLow()))
cp->m_capturePoint = add ? go : NULL;
}
diff --git a/src/game/OutdoorPvP.h b/src/game/OutdoorPvP.h
index 3df12e22fa6..1de8b6db7fb 100644
--- a/src/game/OutdoorPvP.h
+++ b/src/game/OutdoorPvP.h
@@ -246,7 +246,7 @@ protected:
OPvPCapturePoint * GetCapturePoint(uint32 lowguid) const
{
OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
- if(itr != m_capturePoints.end())
+ if (itr != m_capturePoints.end())
return itr->second;
return NULL;
}
diff --git a/src/game/OutdoorPvPEP.cpp b/src/game/OutdoorPvPEP.cpp
index 856bd81075f..1ffa05c5a2c 100644
--- a/src/game/OutdoorPvPEP.cpp
+++ b/src/game/OutdoorPvPEP.cpp
@@ -37,10 +37,10 @@ OPvPCapturePointEP_EWT::OPvPCapturePointEP_EWT(OutdoorPvP *pvp)
void OPvPCapturePointEP_EWT::ChangeState()
{
- if(fabs(m_value) == m_maxValue) // state won't change, only phase when maxed out!
+ if (fabs(m_value) == m_maxValue) // state won't change, only phase when maxed out!
{
// if changing from controlling alliance to horde or vice versa
- if( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State )
+ if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State )
{
sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_EWT_A));
((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0;
@@ -56,24 +56,24 @@ void OPvPCapturePointEP_EWT::ChangeState()
switch(m_State)
{
case OBJECTIVESTATE_ALLIANCE:
- if(m_value == m_maxValue)
+ if (m_value == m_maxValue)
m_TowerState = EP_TS_A;
else
m_TowerState = EP_TS_A_P;
artkit = 2;
SummonSupportUnitAtNorthpassTower(ALLIANCE);
((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = ALLIANCE;
- if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_A));
+ if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_A));
break;
case OBJECTIVESTATE_HORDE:
- if(m_value == -m_maxValue)
+ if (m_value == -m_maxValue)
m_TowerState = EP_TS_H;
else
m_TowerState = EP_TS_H_P;
artkit = 1;
SummonSupportUnitAtNorthpassTower(HORDE);
((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = HORDE;
- if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_H));
+ if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_H));
break;
case OBJECTIVESTATE_NEUTRAL:
m_TowerState = EP_TS_N;
@@ -90,11 +90,11 @@ void OPvPCapturePointEP_EWT::ChangeState()
GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_EWT_FLAGS]);
- if(flag)
+ if (flag)
{
flag->SetGoArtKit(artkit);
}
- if(flag2)
+ if (flag2)
{
flag2->SetGoArtKit(artkit);
}
@@ -102,7 +102,7 @@ void OPvPCapturePointEP_EWT::ChangeState()
UpdateTowerState();
// complete quest objective
- if(m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
+ if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
SendObjectiveComplete(EP_EWT_CM, 0);
}
}
@@ -142,7 +142,7 @@ void OPvPCapturePointEP_EWT::UpdateTowerState()
bool OPvPCapturePointEP_EWT::HandlePlayerEnter(Player *plr)
{
- if(OPvPCapturePoint::HandlePlayerEnter(plr))
+ if (OPvPCapturePoint::HandlePlayerEnter(plr))
{
plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1);
uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f);
@@ -161,11 +161,11 @@ void OPvPCapturePointEP_EWT::HandlePlayerLeave(Player *plr)
void OPvPCapturePointEP_EWT::SummonSupportUnitAtNorthpassTower(uint32 team)
{
- if(m_UnitsSummonedSide != team)
+ if (m_UnitsSummonedSide != team)
{
m_UnitsSummonedSide = team;
const creature_type * ct = NULL;
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
ct=EP_EWT_Summons_A;
else
ct=EP_EWT_Summons_H;
@@ -188,10 +188,10 @@ OPvPCapturePointEP_NPT::OPvPCapturePointEP_NPT(OutdoorPvP *pvp)
void OPvPCapturePointEP_NPT::ChangeState()
{
- if(fabs(m_value) == m_maxValue) // state won't change, only phase when maxed out!
+ if (fabs(m_value) == m_maxValue) // state won't change, only phase when maxed out!
{
// if changing from controlling alliance to horde or vice versa
- if( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State )
+ if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State )
{
sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_NPT_A));
((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0;
@@ -207,24 +207,24 @@ void OPvPCapturePointEP_NPT::ChangeState()
switch(m_State)
{
case OBJECTIVESTATE_ALLIANCE:
- if(m_value == m_maxValue)
+ if (m_value == m_maxValue)
m_TowerState = EP_TS_A;
else
m_TowerState = EP_TS_A_P;
artkit = 2;
SummonGO(ALLIANCE);
((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = ALLIANCE;
- if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A));
+ if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A));
break;
case OBJECTIVESTATE_HORDE:
- if(m_value == -m_maxValue)
+ if (m_value == -m_maxValue)
m_TowerState = EP_TS_H;
else
m_TowerState = EP_TS_H_P;
artkit = 1;
SummonGO(HORDE);
((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = HORDE;
- if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H));
+ if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H));
break;
case OBJECTIVESTATE_NEUTRAL:
m_TowerState = EP_TS_N;
@@ -243,11 +243,11 @@ void OPvPCapturePointEP_NPT::ChangeState()
GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_NPT_FLAGS]);
- if(flag)
+ if (flag)
{
flag->SetGoArtKit(artkit);
}
- if(flag2)
+ if (flag2)
{
flag2->SetGoArtKit(artkit);
}
@@ -255,7 +255,7 @@ void OPvPCapturePointEP_NPT::ChangeState()
UpdateTowerState();
// complete quest objective
- if(m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
+ if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
SendObjectiveComplete(EP_NPT_CM, 0);
}
}
@@ -295,7 +295,7 @@ void OPvPCapturePointEP_NPT::UpdateTowerState()
bool OPvPCapturePointEP_NPT::HandlePlayerEnter(Player *plr)
{
- if(OPvPCapturePoint::HandlePlayerEnter(plr))
+ if (OPvPCapturePoint::HandlePlayerEnter(plr))
{
plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1);
uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f);
@@ -314,13 +314,13 @@ void OPvPCapturePointEP_NPT::HandlePlayerLeave(Player *plr)
void OPvPCapturePointEP_NPT::SummonGO(uint32 team)
{
- if(m_SummonedGOSide != team)
+ if (m_SummonedGOSide != team)
{
m_SummonedGOSide = team;
DelObject(EP_NPT_BUFF);
AddObject(EP_NPT_BUFF,EP_NPT_LordaeronShrine.entry,EP_NPT_LordaeronShrine.map,EP_NPT_LordaeronShrine.x,EP_NPT_LordaeronShrine.y,EP_NPT_LordaeronShrine.z,EP_NPT_LordaeronShrine.o,EP_NPT_LordaeronShrine.rot0,EP_NPT_LordaeronShrine.rot1,EP_NPT_LordaeronShrine.rot2,EP_NPT_LordaeronShrine.rot3);
GameObject * go = HashMapHolder<GameObject>::Find(m_Objects[EP_NPT_BUFF]);
- if(go)
+ if (go)
go->SetUInt32Value(GAMEOBJECT_FACTION,(team == ALLIANCE ? 84 : 83));
}
}
@@ -335,10 +335,10 @@ OPvPCapturePointEP_CGT::OPvPCapturePointEP_CGT(OutdoorPvP *pvp)
void OPvPCapturePointEP_CGT::ChangeState()
{
- if(fabs(m_value) == m_maxValue) // state won't change, only phase when maxed out!
+ if (fabs(m_value) == m_maxValue) // state won't change, only phase when maxed out!
{
// if changing from controlling alliance to horde or vice versa
- if( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State )
+ if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State )
{
sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_CGT_A));
((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = 0;
@@ -354,24 +354,24 @@ void OPvPCapturePointEP_CGT::ChangeState()
switch(m_State)
{
case OBJECTIVESTATE_ALLIANCE:
- if(m_value == m_maxValue)
+ if (m_value == m_maxValue)
m_TowerState = EP_TS_A;
else
m_TowerState = EP_TS_A_P;
artkit = 2;
LinkGraveYard(ALLIANCE);
((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = ALLIANCE;
- if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_A));
+ if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_A));
break;
case OBJECTIVESTATE_HORDE:
- if(m_value == -m_maxValue)
+ if (m_value == -m_maxValue)
m_TowerState = EP_TS_H;
else
m_TowerState = EP_TS_H_P;
artkit = 1;
LinkGraveYard(HORDE);
((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = HORDE;
- if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_H));
+ if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_H));
break;
case OBJECTIVESTATE_NEUTRAL:
m_TowerState = EP_TS_N;
@@ -388,11 +388,11 @@ void OPvPCapturePointEP_CGT::ChangeState()
GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_CGT_FLAGS]);
- if(flag)
+ if (flag)
{
flag->SetGoArtKit(artkit);
}
- if(flag2)
+ if (flag2)
{
flag2->SetGoArtKit(artkit);
}
@@ -400,7 +400,7 @@ void OPvPCapturePointEP_CGT::ChangeState()
UpdateTowerState();
// complete quest objective
- if(m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
+ if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
SendObjectiveComplete(EP_CGT_CM, 0);
}
}
@@ -440,7 +440,7 @@ void OPvPCapturePointEP_CGT::UpdateTowerState()
bool OPvPCapturePointEP_CGT::HandlePlayerEnter(Player *plr)
{
- if(OPvPCapturePoint::HandlePlayerEnter(plr))
+ if (OPvPCapturePoint::HandlePlayerEnter(plr))
{
plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1);
uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f);
@@ -459,7 +459,7 @@ void OPvPCapturePointEP_CGT::HandlePlayerLeave(Player *plr)
void OPvPCapturePointEP_CGT::LinkGraveYard(uint32 team)
{
- if(m_GraveyardSide != team)
+ if (m_GraveyardSide != team)
{
m_GraveyardSide = team;
objmgr.RemoveGraveYardLink(EP_GraveYardId,EP_GraveYardZone,team,false);
@@ -477,10 +477,10 @@ OPvPCapturePointEP_PWT::OPvPCapturePointEP_PWT(OutdoorPvP *pvp)
void OPvPCapturePointEP_PWT::ChangeState()
{
- if(fabs(m_value) == m_maxValue) // state won't change, only phase when maxed out!
+ if (fabs(m_value) == m_maxValue) // state won't change, only phase when maxed out!
{
// if changing from controlling alliance to horde or vice versa
- if( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State )
+ if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State )
{
sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_PWT_A));
((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0;
@@ -496,24 +496,24 @@ void OPvPCapturePointEP_PWT::ChangeState()
switch(m_State)
{
case OBJECTIVESTATE_ALLIANCE:
- if(m_value == m_maxValue)
+ if (m_value == m_maxValue)
m_TowerState = EP_TS_A;
else
m_TowerState = EP_TS_A_P;
SummonFlightMaster(ALLIANCE);
artkit = 2;
((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = ALLIANCE;
- if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A));
+ if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A));
break;
case OBJECTIVESTATE_HORDE:
- if(m_value == -m_maxValue)
+ if (m_value == -m_maxValue)
m_TowerState = EP_TS_H;
else
m_TowerState = EP_TS_H_P;
SummonFlightMaster(HORDE);
artkit = 1;
((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = HORDE;
- if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H));
+ if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H));
break;
case OBJECTIVESTATE_NEUTRAL:
m_TowerState = EP_TS_N;
@@ -532,11 +532,11 @@ void OPvPCapturePointEP_PWT::ChangeState()
GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_PWT_FLAGS]);
- if(flag)
+ if (flag)
{
flag->SetGoArtKit(artkit);
}
- if(flag2)
+ if (flag2)
{
flag2->SetGoArtKit(artkit);
}
@@ -544,7 +544,7 @@ void OPvPCapturePointEP_PWT::ChangeState()
UpdateTowerState();
// complete quest objective
- if(m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
+ if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
SendObjectiveComplete(EP_PWT_CM, 0);
}
}
@@ -584,7 +584,7 @@ void OPvPCapturePointEP_PWT::UpdateTowerState()
bool OPvPCapturePointEP_PWT::HandlePlayerEnter(Player *plr)
{
- if(OPvPCapturePoint::HandlePlayerEnter(plr))
+ if (OPvPCapturePoint::HandlePlayerEnter(plr))
{
plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1);
uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f);
@@ -603,7 +603,7 @@ void OPvPCapturePointEP_PWT::HandlePlayerLeave(Player *plr)
void OPvPCapturePointEP_PWT::SummonFlightMaster(uint32 team)
{
- if(m_FlightMasterSpawned != team)
+ if (m_FlightMasterSpawned != team)
{
m_FlightMasterSpawned = team;
DelCreature(EP_PWT_FLIGHTMASTER);
@@ -634,15 +634,15 @@ bool OutdoorPvPEP::SetupOutdoorPvP()
bool OutdoorPvPEP::Update(uint32 diff)
{
- if(OutdoorPvP::Update(diff))
+ if (OutdoorPvP::Update(diff))
{
m_AllianceTowersControlled = 0;
m_HordeTowersControlled = 0;
for (int i = 0; i < EP_TOWER_NUM; ++i)
{
- if(EP_Controls[i] == ALLIANCE)
+ if (EP_Controls[i] == ALLIANCE)
++m_AllianceTowersControlled;
- else if(EP_Controls[i] == HORDE)
+ else if (EP_Controls[i] == HORDE)
++m_HordeTowersControlled;
SendUpdateWorldState(EP_UI_TOWER_COUNT_A,m_AllianceTowersControlled);
SendUpdateWorldState(EP_UI_TOWER_COUNT_H,m_HordeTowersControlled);
@@ -656,14 +656,14 @@ bool OutdoorPvPEP::Update(uint32 diff)
void OutdoorPvPEP::HandlePlayerEnterZone(Player * plr, uint32 zone)
{
// add buffs
- if(plr->GetTeam() == ALLIANCE)
+ if (plr->GetTeam() == ALLIANCE)
{
- if(m_AllianceTowersControlled && m_AllianceTowersControlled < 5)
+ if (m_AllianceTowersControlled && m_AllianceTowersControlled < 5)
plr->CastSpell(plr,EP_AllianceBuffs[m_AllianceTowersControlled-1],true);
}
else
{
- if(m_HordeTowersControlled && m_HordeTowersControlled < 5)
+ if (m_HordeTowersControlled && m_HordeTowersControlled < 5)
plr->CastSpell(plr,EP_HordeBuffs[m_HordeTowersControlled-1],true);
}
OutdoorPvP::HandlePlayerEnterZone(plr,zone);
@@ -672,7 +672,7 @@ void OutdoorPvPEP::HandlePlayerEnterZone(Player * plr, uint32 zone)
void OutdoorPvPEP::HandlePlayerLeaveZone(Player * plr, uint32 zone)
{
// remove buffs
- if(plr->GetTeam() == ALLIANCE)
+ if (plr->GetTeam() == ALLIANCE)
{
for (int i = 0; i < 4; ++i)
plr->RemoveAurasDueToSpell(EP_AllianceBuffs[i]);
@@ -693,7 +693,7 @@ void OutdoorPvPEP::BuffTeams()
{
for (int i = 0; i < 4; ++i)
plr->RemoveAurasDueToSpell(EP_AllianceBuffs[i]);
- if(m_AllianceTowersControlled && m_AllianceTowersControlled < 5)
+ if (m_AllianceTowersControlled && m_AllianceTowersControlled < 5)
plr->CastSpell(plr,EP_AllianceBuffs[m_AllianceTowersControlled-1],true);
}
}
@@ -703,7 +703,7 @@ void OutdoorPvPEP::BuffTeams()
{
for (int i = 0; i < 4; ++i)
plr->RemoveAurasDueToSpell(EP_HordeBuffs[i]);
- if(m_HordeTowersControlled && m_HordeTowersControlled < 5)
+ if (m_HordeTowersControlled && m_HordeTowersControlled < 5)
plr->CastSpell(plr,EP_HordeBuffs[m_HordeTowersControlled-1],true);
}
}
diff --git a/src/game/OutdoorPvPHP.cpp b/src/game/OutdoorPvPHP.cpp
index fa1b89180a5..a3bb1b8f5f8 100644
--- a/src/game/OutdoorPvPHP.cpp
+++ b/src/game/OutdoorPvPHP.cpp
@@ -84,14 +84,14 @@ bool OutdoorPvPHP::SetupOutdoorPvP()
void OutdoorPvPHP::HandlePlayerEnterZone(Player * plr, uint32 zone)
{
// add buffs
- if(plr->GetTeam() == ALLIANCE)
+ if (plr->GetTeam() == ALLIANCE)
{
- if(m_AllianceTowersControlled >=3)
+ if (m_AllianceTowersControlled >=3)
plr->CastSpell(plr,AllianceBuff,true);
}
else
{
- if(m_HordeTowersControlled >=3)
+ if (m_HordeTowersControlled >=3)
plr->CastSpell(plr,HordeBuff,true);
}
OutdoorPvP::HandlePlayerEnterZone(plr,zone);
@@ -100,7 +100,7 @@ void OutdoorPvPHP::HandlePlayerEnterZone(Player * plr, uint32 zone)
void OutdoorPvPHP::HandlePlayerLeaveZone(Player * plr, uint32 zone)
{
// remove buffs
- if(plr->GetTeam() == ALLIANCE)
+ if (plr->GetTeam() == ALLIANCE)
{
plr->RemoveAurasDueToSpell(AllianceBuff);
}
@@ -114,11 +114,11 @@ void OutdoorPvPHP::HandlePlayerLeaveZone(Player * plr, uint32 zone)
bool OutdoorPvPHP::Update(uint32 diff)
{
bool changed = false;
- if(changed = OutdoorPvP::Update(diff))
+ if (changed = OutdoorPvP::Update(diff))
{
- if(m_AllianceTowersControlled == 3)
+ if (m_AllianceTowersControlled == 3)
TeamApplyBuff(TEAM_ALLIANCE, AllianceBuff, HordeBuff);
- else if(m_HordeTowersControlled == 3)
+ else if (m_HordeTowersControlled == 3)
TeamApplyBuff(TEAM_HORDE, HordeBuff, AllianceBuff);
else
{
@@ -173,13 +173,13 @@ void OPvPCapturePointHP::ChangeState()
break;
case OBJECTIVESTATE_ALLIANCE:
field = HP_MAP_A[m_TowerType];
- if(((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled)
+ if (((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled)
((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled--;
sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetTrinityStringForDBCLocale(HP_LANG_LOOSE_A[m_TowerType]));
break;
case OBJECTIVESTATE_HORDE:
field = HP_MAP_H[m_TowerType];
- if(((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled)
+ if (((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled)
((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled--;
sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetTrinityStringForDBCLocale(HP_LANG_LOOSE_H[m_TowerType]));
break;
@@ -198,7 +198,7 @@ void OPvPCapturePointHP::ChangeState()
}
// send world state update
- if(field)
+ if (field)
{
m_PvP->SendUpdateWorldState(field, 0);
field = 0;
@@ -214,7 +214,7 @@ void OPvPCapturePointHP::ChangeState()
field = HP_MAP_A[m_TowerType];
artkit = 2;
artkit2 = HP_TowerArtKit_A[m_TowerType];
- if(((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled<3)
+ if (((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled<3)
((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled++;
sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetTrinityStringForDBCLocale(HP_LANG_CAPTURE_A[m_TowerType]));
break;
@@ -222,7 +222,7 @@ void OPvPCapturePointHP::ChangeState()
field = HP_MAP_H[m_TowerType];
artkit = 1;
artkit2 = HP_TowerArtKit_H[m_TowerType];
- if(((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled<3)
+ if (((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled<3)
((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled++;
sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetTrinityStringForDBCLocale(HP_LANG_CAPTURE_H[m_TowerType]));
break;
@@ -246,21 +246,21 @@ void OPvPCapturePointHP::ChangeState()
GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[m_TowerType]);
- if(flag)
+ if (flag)
{
flag->SetGoArtKit(artkit);
}
- if(flag2)
+ if (flag2)
{
flag2->SetGoArtKit(artkit2);
}
// send world state update
- if(field)
+ if (field)
m_PvP->SendUpdateWorldState(field, 1);
// complete quest objective
- if(m_State == OBJECTIVESTATE_ALLIANCE || m_State == OBJECTIVESTATE_HORDE)
+ if (m_State == OBJECTIVESTATE_ALLIANCE || m_State == OBJECTIVESTATE_HORDE)
SendObjectiveComplete(HP_CREDITMARKER[m_TowerType], 0);
}
@@ -303,7 +303,7 @@ void OPvPCapturePointHP::FillInitialWorldStates(WorldPacket &data)
bool OPvPCapturePointHP::HandlePlayerEnter(Player *plr)
{
- if(OPvPCapturePoint::HandlePlayerEnter(plr))
+ if (OPvPCapturePoint::HandlePlayerEnter(plr))
{
plr->SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 1);
uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f);
@@ -322,11 +322,11 @@ void OPvPCapturePointHP::HandlePlayerLeave(Player *plr)
void OutdoorPvPHP::HandleKillImpl(Player *plr, Unit * killed)
{
- if(killed->GetTypeId() != TYPEID_PLAYER)
+ if (killed->GetTypeId() != TYPEID_PLAYER)
return;
- if(plr->GetTeam() == ALLIANCE && killed->ToPlayer()->GetTeam() != ALLIANCE)
+ if (plr->GetTeam() == ALLIANCE && killed->ToPlayer()->GetTeam() != ALLIANCE)
plr->CastSpell(plr,AlliancePlayerKillReward,true);
- else if(plr->GetTeam() == HORDE && killed->ToPlayer()->GetTeam() != HORDE)
+ else if (plr->GetTeam() == HORDE && killed->ToPlayer()->GetTeam() != HORDE)
plr->CastSpell(plr,HordePlayerKillReward,true);
}
diff --git a/src/game/OutdoorPvPMgr.cpp b/src/game/OutdoorPvPMgr.cpp
index 7779cdc7caa..91b6c853f65 100644
--- a/src/game/OutdoorPvPMgr.cpp
+++ b/src/game/OutdoorPvPMgr.cpp
@@ -50,7 +50,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
// create new opvp
OutdoorPvP * pOP = new OutdoorPvPHP;
// respawn, init variables
- if(!pOP->SetupOutdoorPvP())
+ if (!pOP->SetupOutdoorPvP())
{
sLog.outDebug("OutdoorPvP : HP init failed.");
delete pOP;
@@ -63,7 +63,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
pOP = new OutdoorPvPNA;
// respawn, init variables
- if(!pOP->SetupOutdoorPvP())
+ if (!pOP->SetupOutdoorPvP())
{
sLog.outDebug("OutdoorPvP : NA init failed.");
delete pOP;
@@ -76,7 +76,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
pOP = new OutdoorPvPTF;
// respawn, init variables
- if(!pOP->SetupOutdoorPvP())
+ if (!pOP->SetupOutdoorPvP())
{
sLog.outDebug("OutdoorPvP : TF init failed.");
delete pOP;
@@ -89,7 +89,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
pOP = new OutdoorPvPZM;
// respawn, init variables
- if(!pOP->SetupOutdoorPvP())
+ if (!pOP->SetupOutdoorPvP())
{
sLog.outDebug("OutdoorPvP : ZM init failed.");
delete pOP;
@@ -102,7 +102,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
pOP = new OutdoorPvPSI;
// respawn, init variables
- if(!pOP->SetupOutdoorPvP())
+ if (!pOP->SetupOutdoorPvP())
{
sLog.outDebug("OutdoorPvP : SI init failed.");
delete pOP;
@@ -115,7 +115,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
pOP = new OutdoorPvPEP;
// respawn, init variables
- if(!pOP->SetupOutdoorPvP())
+ if (!pOP->SetupOutdoorPvP())
{
sLog.outDebug("OutdoorPvP : EP init failed.");
delete pOP;
@@ -135,10 +135,10 @@ void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP *handle)
void OutdoorPvPMgr::HandlePlayerEnterZone(Player *plr, uint32 zoneid)
{
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
- if(itr == m_OutdoorPvPMap.end())
+ if (itr == m_OutdoorPvPMap.end())
return;
- if(itr->second->HasPlayer(plr))
+ if (itr->second->HasPlayer(plr))
return;
itr->second->HandlePlayerEnterZone(plr, zoneid);
@@ -148,11 +148,11 @@ void OutdoorPvPMgr::HandlePlayerEnterZone(Player *plr, uint32 zoneid)
void OutdoorPvPMgr::HandlePlayerLeaveZone(Player *plr, uint32 zoneid)
{
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
- if(itr == m_OutdoorPvPMap.end())
+ if (itr == m_OutdoorPvPMap.end())
return;
// teleport: remove once in removefromworld, once in updatezone
- if(!itr->second->HasPlayer(plr))
+ if (!itr->second->HasPlayer(plr))
return;
itr->second->HandlePlayerLeaveZone(plr, zoneid);
@@ -162,7 +162,7 @@ void OutdoorPvPMgr::HandlePlayerLeaveZone(Player *plr, uint32 zoneid)
OutdoorPvP * OutdoorPvPMgr::GetOutdoorPvPToZoneId(uint32 zoneid)
{
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
- if(itr == m_OutdoorPvPMap.end())
+ if (itr == m_OutdoorPvPMap.end())
{
// no handle for this zone, return
return NULL;
@@ -173,7 +173,7 @@ OutdoorPvP * OutdoorPvPMgr::GetOutdoorPvPToZoneId(uint32 zoneid)
void OutdoorPvPMgr::Update(uint32 diff)
{
m_UpdateTimer += diff;
- if(m_UpdateTimer > OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL)
+ if (m_UpdateTimer > OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL)
{
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
(*itr)->Update(m_UpdateTimer);
@@ -185,7 +185,7 @@ bool OutdoorPvPMgr::HandleCustomSpell(Player *plr, uint32 spellId, GameObject *
{
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
{
- if((*itr)->HandleCustomSpell(plr,spellId,go))
+ if ((*itr)->HandleCustomSpell(plr,spellId,go))
return true;
}
return false;
@@ -194,7 +194,7 @@ bool OutdoorPvPMgr::HandleCustomSpell(Player *plr, uint32 spellId, GameObject *
ZoneScript * OutdoorPvPMgr::GetZoneScript(uint32 zoneId)
{
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneId);
- if(itr != m_OutdoorPvPMap.end())
+ if (itr != m_OutdoorPvPMap.end())
return itr->second;
else
return NULL;
@@ -204,7 +204,7 @@ bool OutdoorPvPMgr::HandleOpenGo(Player *plr, uint64 guid)
{
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
{
- if((*itr)->HandleOpenGo(plr,guid))
+ if ((*itr)->HandleOpenGo(plr,guid))
return true;
}
return false;
@@ -214,7 +214,7 @@ void OutdoorPvPMgr::HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid
{
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
{
- if((*itr)->HandleGossipOption(plr,guid,gossipid))
+ if ((*itr)->HandleGossipOption(plr,guid,gossipid))
return;
}
}
@@ -223,7 +223,7 @@ bool OutdoorPvPMgr::CanTalkTo(Player * plr, Creature * c, GossipMenuItems gso)
{
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
{
- if((*itr)->CanTalkTo(plr,c,gso))
+ if ((*itr)->CanTalkTo(plr,c,gso))
return true;
}
return false;
@@ -233,7 +233,7 @@ void OutdoorPvPMgr::HandleDropFlag(Player *plr, uint32 spellId)
{
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
{
- if((*itr)->HandleDropFlag(plr,spellId))
+ if ((*itr)->HandleDropFlag(plr,spellId))
return;
}
}
@@ -241,9 +241,9 @@ void OutdoorPvPMgr::HandleDropFlag(Player *plr, uint32 spellId)
void OutdoorPvPMgr::HandlePlayerResurrects(Player *plr, uint32 zoneid)
{
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
- if(itr == m_OutdoorPvPMap.end())
+ if (itr == m_OutdoorPvPMap.end())
return;
- if(itr->second->HasPlayer(plr))
+ if (itr->second->HasPlayer(plr))
itr->second->HandlePlayerResurrects(plr, zoneid);
}
diff --git a/src/game/OutdoorPvPNA.cpp b/src/game/OutdoorPvPNA.cpp
index 377940e512d..7f976479b3c 100644
--- a/src/game/OutdoorPvPNA.cpp
+++ b/src/game/OutdoorPvPNA.cpp
@@ -31,10 +31,10 @@ OutdoorPvPNA::OutdoorPvPNA()
void OutdoorPvPNA::HandleKillImpl(Player *plr, Unit * killed)
{
- if(killed->GetTypeId() == TYPEID_PLAYER && plr->GetTeam() != killed->ToPlayer()->GetTeam())
+ if (killed->GetTypeId() == TYPEID_PLAYER && plr->GetTeam() != killed->ToPlayer()->GetTeam())
{
plr->KilledMonsterCredit(NA_CREDIT_MARKER,0); // 0 guid, btw it isn't even used in killedmonster function :S
- if(plr->GetTeam() == ALLIANCE)
+ if (plr->GetTeam() == ALLIANCE)
plr->CastSpell(plr,NA_KILL_TOKEN_ALLIANCE,true);
else
plr->CastSpell(plr,NA_KILL_TOKEN_HORDE,true);
@@ -64,14 +64,14 @@ uint32 OPvPCapturePointNA::GetAliveGuardsCount()
case NA_NPC_GUARD_14:
case NA_NPC_GUARD_15:
{
- if(Creature * cr = HashMapHolder<Creature>::Find(itr->second))
+ if (Creature * cr = HashMapHolder<Creature>::Find(itr->second))
{
- if(cr->isAlive())
+ if (cr->isAlive())
++cnt;
}
else if (CreatureData const * cd = objmgr.GetCreatureData(GUID_LOPART(itr->second)))
{
- if(!cd->is_dead)
+ if (!cd->is_dead)
++cnt;
}
}
@@ -86,9 +86,9 @@ uint32 OPvPCapturePointNA::GetAliveGuardsCount()
void OPvPCapturePointNA::SpawnNPCsForTeam(uint32 team)
{
const creature_type * creatures = NULL;
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
creatures=AllianceControlNPCs;
- else if(team == HORDE)
+ else if (team == HORDE)
creatures=HordeControlNPCs;
else
return;
@@ -105,15 +105,15 @@ void OPvPCapturePointNA::DeSpawnNPCs()
void OPvPCapturePointNA::SpawnGOsForTeam(uint32 team)
{
const go_type * gos = NULL;
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
gos=AllianceControlGOs;
- else if(team == HORDE)
+ else if (team == HORDE)
gos=HordeControlGOs;
else
return;
for (int i = 0; i < NA_CONTROL_GO_NUM; ++i)
{
- if( i == NA_ROOST_S ||
+ if ( i == NA_ROOST_S ||
i == NA_ROOST_W ||
i == NA_ROOST_N ||
i == NA_ROOST_E ||
@@ -136,15 +136,15 @@ void OPvPCapturePointNA::DeSpawnGOs()
void OPvPCapturePointNA::FactionTakeOver(uint32 team)
{
- if(m_ControllingFaction)
+ if (m_ControllingFaction)
objmgr.RemoveGraveYardLink(NA_HALAA_GRAVEYARD,NA_HALAA_GRAVEYARD_ZONE,m_ControllingFaction,false);
- if(m_ControllingFaction == ALLIANCE)
+ if (m_ControllingFaction == ALLIANCE)
sWorld.SendZoneText(NA_HALAA_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_NA_LOOSE_A));
- else if(m_ControllingFaction == HORDE)
+ else if (m_ControllingFaction == HORDE)
sWorld.SendZoneText(NA_HALAA_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_NA_LOOSE_H));
m_ControllingFaction = team;
- if(m_ControllingFaction)
+ if (m_ControllingFaction)
objmgr.AddGraveYardLink(NA_HALAA_GRAVEYARD,NA_HALAA_GRAVEYARD_ZONE,m_ControllingFaction,false);
DeSpawnGOs();
DeSpawnNPCs();
@@ -153,7 +153,7 @@ void OPvPCapturePointNA::FactionTakeOver(uint32 team)
m_GuardsAlive = NA_GUARDS_MAX;
m_capturable = false;
this->UpdateHalaaWorldState();
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
{
m_WyvernStateSouth = WYVERN_NEU_HORDE;
m_WyvernStateNorth = WYVERN_NEU_HORDE;
@@ -185,7 +185,7 @@ void OPvPCapturePointNA::FactionTakeOver(uint32 team)
bool OPvPCapturePointNA::HandlePlayerEnter(Player *plr)
{
- if(OPvPCapturePoint::HandlePlayerEnter(plr))
+ if (OPvPCapturePoint::HandlePlayerEnter(plr))
{
plr->SendUpdateWorldState(NA_UI_TOWER_SLIDER_DISPLAY, 1);
uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f);
@@ -218,7 +218,7 @@ bool OutdoorPvPNA::SetupOutdoorPvP()
// halaa
m_obj = new OPvPCapturePointNA(this);
- if(!m_obj)
+ if (!m_obj)
return false;
AddCapturePoint(m_obj);
@@ -228,7 +228,7 @@ bool OutdoorPvPNA::SetupOutdoorPvP()
void OutdoorPvPNA::HandlePlayerEnterZone(Player * plr, uint32 zone)
{
// add buffs
- if(plr->GetTeam() == m_obj->m_ControllingFaction)
+ if (plr->GetTeam() == m_obj->m_ControllingFaction)
plr->CastSpell(plr,NA_CAPTURE_BUFF,true);
OutdoorPvP::HandlePlayerEnterZone(plr,zone);
}
@@ -247,12 +247,12 @@ void OutdoorPvPNA::FillInitialWorldStates(WorldPacket &data)
void OPvPCapturePointNA::FillInitialWorldStates(WorldPacket &data)
{
- if(m_ControllingFaction == ALLIANCE)
+ if (m_ControllingFaction == ALLIANCE)
{
data << NA_UI_HORDE_GUARDS_SHOW << uint32(0);
data << NA_UI_ALLIANCE_GUARDS_SHOW << uint32(1);
}
- else if(m_ControllingFaction == HORDE)
+ else if (m_ControllingFaction == HORDE)
{
data << NA_UI_HORDE_GUARDS_SHOW << uint32(1);
data << NA_UI_ALLIANCE_GUARDS_SHOW << uint32(0);
@@ -377,7 +377,7 @@ bool OPvPCapturePointNA::HandleCustomSpell(Player * plr, uint32 spellId, GameObj
break;
}
- if(retval)
+ if (retval)
{
//Adding items
uint32 noSpaceForCount = 0;
@@ -389,17 +389,17 @@ bool OPvPCapturePointNA::HandleCustomSpell(Player * plr, uint32 spellId, GameObj
uint32 itemid = 24538;
// bomb id count
uint8 msg = plr->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemid, count, &noSpaceForCount );
- if( msg != EQUIP_ERR_OK ) // convert to possible store amount
+ if ( msg != EQUIP_ERR_OK ) // convert to possible store amount
count -= noSpaceForCount;
- if( count == 0 || dest.empty()) // can't add any
+ if ( count == 0 || dest.empty()) // can't add any
{
return true;
}
Item* item = plr->StoreNewItem( dest, itemid, true);
- if(count > 0 && item)
+ if (count > 0 && item)
{
plr->SendNewItem(item,count,true,false);
}
@@ -412,12 +412,12 @@ bool OPvPCapturePointNA::HandleCustomSpell(Player * plr, uint32 spellId, GameObj
int32 OPvPCapturePointNA::HandleOpenGo(Player *plr, uint64 guid)
{
uint32 retval = OPvPCapturePoint::HandleOpenGo(plr, guid);
- if(retval>=0)
+ if (retval>=0)
{
const go_type * gos = NULL;
- if(m_ControllingFaction == ALLIANCE)
+ if (m_ControllingFaction == ALLIANCE)
gos=AllianceControlGOs;
- else if(m_ControllingFaction == HORDE)
+ else if (m_ControllingFaction == HORDE)
gos=HordeControlGOs;
else
return -1;
@@ -433,7 +433,7 @@ int32 OPvPCapturePointNA::HandleOpenGo(Player *plr, uint64 guid)
del = NA_DESTROYED_ROOST_S;
add = NA_ROOST_S;
add2 = NA_BOMB_WAGON_S;
- if(m_ControllingFaction == HORDE)
+ if (m_ControllingFaction == HORDE)
m_WyvernStateSouth = WYVERN_ALLIANCE;
else
m_WyvernStateSouth = WYVERN_HORDE;
@@ -443,7 +443,7 @@ int32 OPvPCapturePointNA::HandleOpenGo(Player *plr, uint64 guid)
del = NA_DESTROYED_ROOST_N;
add = NA_ROOST_N;
add2 = NA_BOMB_WAGON_N;
- if(m_ControllingFaction == HORDE)
+ if (m_ControllingFaction == HORDE)
m_WyvernStateNorth = WYVERN_ALLIANCE;
else
m_WyvernStateNorth = WYVERN_HORDE;
@@ -453,7 +453,7 @@ int32 OPvPCapturePointNA::HandleOpenGo(Player *plr, uint64 guid)
del = NA_DESTROYED_ROOST_W;
add = NA_ROOST_W;
add2 = NA_BOMB_WAGON_W;
- if(m_ControllingFaction == HORDE)
+ if (m_ControllingFaction == HORDE)
m_WyvernStateWest = WYVERN_ALLIANCE;
else
m_WyvernStateWest = WYVERN_HORDE;
@@ -463,7 +463,7 @@ int32 OPvPCapturePointNA::HandleOpenGo(Player *plr, uint64 guid)
del = NA_DESTROYED_ROOST_E;
add = NA_ROOST_E;
add2 = NA_BOMB_WAGON_E;
- if(m_ControllingFaction == HORDE)
+ if (m_ControllingFaction == HORDE)
m_WyvernStateEast = WYVERN_ALLIANCE;
else
m_WyvernStateEast = WYVERN_HORDE;
@@ -473,7 +473,7 @@ int32 OPvPCapturePointNA::HandleOpenGo(Player *plr, uint64 guid)
del = NA_BOMB_WAGON_S;
del2 = NA_ROOST_S;
add = NA_DESTROYED_ROOST_S;
- if(m_ControllingFaction == HORDE)
+ if (m_ControllingFaction == HORDE)
m_WyvernStateSouth = WYVERN_NEU_ALLIANCE;
else
m_WyvernStateSouth = WYVERN_NEU_HORDE;
@@ -483,7 +483,7 @@ int32 OPvPCapturePointNA::HandleOpenGo(Player *plr, uint64 guid)
del = NA_BOMB_WAGON_N;
del2 = NA_ROOST_N;
add = NA_DESTROYED_ROOST_N;
- if(m_ControllingFaction == HORDE)
+ if (m_ControllingFaction == HORDE)
m_WyvernStateNorth = WYVERN_NEU_ALLIANCE;
else
m_WyvernStateNorth = WYVERN_NEU_HORDE;
@@ -493,7 +493,7 @@ int32 OPvPCapturePointNA::HandleOpenGo(Player *plr, uint64 guid)
del = NA_BOMB_WAGON_W;
del2 = NA_ROOST_W;
add = NA_DESTROYED_ROOST_W;
- if(m_ControllingFaction == HORDE)
+ if (m_ControllingFaction == HORDE)
m_WyvernStateWest = WYVERN_NEU_ALLIANCE;
else
m_WyvernStateWest = WYVERN_NEU_HORDE;
@@ -503,7 +503,7 @@ int32 OPvPCapturePointNA::HandleOpenGo(Player *plr, uint64 guid)
del = NA_BOMB_WAGON_E;
del2 = NA_ROOST_E;
add = NA_DESTROYED_ROOST_E;
- if(m_ControllingFaction == HORDE)
+ if (m_ControllingFaction == HORDE)
m_WyvernStateEast = WYVERN_NEU_ALLIANCE;
else
m_WyvernStateEast = WYVERN_NEU_HORDE;
@@ -514,16 +514,16 @@ int32 OPvPCapturePointNA::HandleOpenGo(Player *plr, uint64 guid)
break;
}
- if(del>-1)
+ if (del>-1)
DelObject(del);
- if(del2>-1)
+ if (del2>-1)
DelObject(del2);
- if(add>-1)
+ if (add>-1)
AddObject(add,gos[add].entry,gos[add].map,gos[add].x,gos[add].y,gos[add].z,gos[add].o,gos[add].rot0,gos[add].rot1,gos[add].rot2,gos[add].rot3);
- if(add2>-1)
+ if (add2>-1)
AddObject(add2,gos[add2].entry,gos[add2].map,gos[add2].x,gos[add2].y,gos[add2].z,gos[add2].o,gos[add2].rot0,gos[add2].rot1,gos[add2].rot2,gos[add2].rot3);
return retval;
@@ -535,32 +535,32 @@ bool OPvPCapturePointNA::Update(uint32 diff)
{
// let the controlling faction advance in phase
bool capturable = false;
- if(m_ControllingFaction == ALLIANCE && m_activePlayers[0].size() > m_activePlayers[1].size())
+ if (m_ControllingFaction == ALLIANCE && m_activePlayers[0].size() > m_activePlayers[1].size())
capturable = true;
- else if(m_ControllingFaction == HORDE && m_activePlayers[0].size() < m_activePlayers[1].size())
+ else if (m_ControllingFaction == HORDE && m_activePlayers[0].size() < m_activePlayers[1].size())
capturable = true;
- if(m_GuardCheckTimer < diff)
+ if (m_GuardCheckTimer < diff)
{
m_GuardCheckTimer = NA_GUARD_CHECK_TIME;
uint32 cnt = GetAliveGuardsCount();
- if(cnt != m_GuardsAlive)
+ if (cnt != m_GuardsAlive)
{
m_GuardsAlive = cnt;
- if(m_GuardsAlive == 0)
+ if (m_GuardsAlive == 0)
m_capturable = true;
// update the guard count for the players in zone
m_PvP->SendUpdateWorldState(NA_UI_GUARDS_LEFT,m_GuardsAlive);
}
} else m_GuardCheckTimer -= diff;
- if(m_capturable || capturable)
+ if (m_capturable || capturable)
{
- if(m_RespawnTimer < diff)
+ if (m_RespawnTimer < diff)
{
// if the guards have been killed, then the challenger has one hour to take over halaa.
// in case they fail to do it, the guards are respawned, and they have to start again.
- if(m_ControllingFaction)
+ if (m_ControllingFaction)
FactionTakeOver(m_ControllingFaction);
m_RespawnTimer = NA_RESPAWN_TIME;
} else m_RespawnTimer -= diff;
@@ -605,7 +605,7 @@ void OPvPCapturePointNA::ChangeState()
}
GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
- if(flag)
+ if (flag)
{
flag->SetGoArtKit(artkit);
}
diff --git a/src/game/OutdoorPvPSI.cpp b/src/game/OutdoorPvPSI.cpp
index d6ddb8231e7..43e24adf555 100644
--- a/src/game/OutdoorPvPSI.cpp
+++ b/src/game/OutdoorPvPSI.cpp
@@ -69,7 +69,7 @@ bool OutdoorPvPSI::Update(uint32 diff)
void OutdoorPvPSI::HandlePlayerEnterZone(Player * plr, uint32 zone)
{
- if(plr->GetTeam() == m_LastController)
+ if (plr->GetTeam() == m_LastController)
plr->CastSpell(plr,SI_CENARION_FAVOR,true);
OutdoorPvP::HandlePlayerEnterZone(plr,zone);
}
@@ -86,12 +86,12 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player *plr, uint32 trigger)
switch(trigger)
{
case SI_AREATRIGGER_A:
- if(plr->GetTeam() == ALLIANCE && plr->HasAura(SI_SILITHYST_FLAG))
+ if (plr->GetTeam() == ALLIANCE && plr->HasAura(SI_SILITHYST_FLAG))
{
// remove aura
plr->RemoveAurasDueToSpell(SI_SILITHYST_FLAG);
++ m_Gathered_A;
- if(m_Gathered_A >= SI_MAX_RESOURCES)
+ if (m_Gathered_A >= SI_MAX_RESOURCES)
{
TeamApplyBuff(TEAM_ALLIANCE, SI_CENARION_FAVOR);
sWorld.SendZoneText(OutdoorPvPSIBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_SI_CAPTURE_A));
@@ -111,12 +111,12 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player *plr, uint32 trigger)
}
return true;
case SI_AREATRIGGER_H:
- if(plr->GetTeam() == HORDE && plr->HasAura(SI_SILITHYST_FLAG))
+ if (plr->GetTeam() == HORDE && plr->HasAura(SI_SILITHYST_FLAG))
{
// remove aura
plr->RemoveAurasDueToSpell(SI_SILITHYST_FLAG);
++ m_Gathered_H;
- if(m_Gathered_H >= SI_MAX_RESOURCES)
+ if (m_Gathered_H >= SI_MAX_RESOURCES)
{
TeamApplyBuff(TEAM_HORDE, SI_CENARION_FAVOR);
sWorld.SendZoneText(OutdoorPvPSIBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_SI_CAPTURE_H));
@@ -141,7 +141,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player *plr, uint32 trigger)
bool OutdoorPvPSI::HandleDropFlag(Player *plr, uint32 spellId)
{
- if(spellId == SI_SILITHYST_FLAG)
+ if (spellId == SI_SILITHYST_FLAG)
{
// if it was dropped away from the player's turn-in point, then create a silithyst mound, if it was dropped near the areatrigger, then it was dispelled by the outdoorpvp, so do nothing
switch(plr->GetTeam())
@@ -149,21 +149,21 @@ bool OutdoorPvPSI::HandleDropFlag(Player *plr, uint32 spellId)
case ALLIANCE:
{
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(SI_AREATRIGGER_A);
- if(atEntry)
+ if (atEntry)
{
// 5.0f is safe-distance
- if(plr->GetDistance(atEntry->x,atEntry->y,atEntry->z) > 5.0f + atEntry->radius)
+ if (plr->GetDistance(atEntry->x,atEntry->y,atEntry->z) > 5.0f + atEntry->radius)
{
// he dropped it further, summon mound
GameObject * go = new GameObject;
Map * map = plr->GetMap();
- if(!map)
+ if (!map)
{
delete go;
return true;
}
- if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),SI_SILITHYST_MOUND, map, plr->GetPhaseMask(), plr->GetPositionX(),plr->GetPositionY(),plr->GetPositionZ(),plr->GetOrientation(),0,0,0,0,100,GO_STATE_READY))
+ if (!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),SI_SILITHYST_MOUND, map, plr->GetPhaseMask(), plr->GetPositionX(),plr->GetPositionY(),plr->GetPositionZ(),plr->GetOrientation(),0,0,0,0,100,GO_STATE_READY))
{
delete go;
}
@@ -179,20 +179,20 @@ bool OutdoorPvPSI::HandleDropFlag(Player *plr, uint32 spellId)
case HORDE:
{
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(SI_AREATRIGGER_H);
- if(atEntry)
+ if (atEntry)
{
// 5.0f is safe-distance
- if(plr->GetDistance(atEntry->x,atEntry->y,atEntry->z) > 5.0f + atEntry->radius)
+ if (plr->GetDistance(atEntry->x,atEntry->y,atEntry->z) > 5.0f + atEntry->radius)
{
// he dropped it further, summon mound
GameObject * go = new GameObject;
Map * map = plr->GetMap();
- if(!map)
+ if (!map)
{
delete go;
return true;
}
- if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),SI_SILITHYST_MOUND, map, plr->GetPhaseMask() ,plr->GetPositionX(),plr->GetPositionY(),plr->GetPositionZ(),plr->GetOrientation(),0,0,0,0,100,GO_STATE_READY))
+ if (!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),SI_SILITHYST_MOUND, map, plr->GetPhaseMask() ,plr->GetPositionX(),plr->GetPositionY(),plr->GetPositionZ(),plr->GetOrientation(),0,0,0,0,100,GO_STATE_READY))
{
delete go;
}
@@ -213,10 +213,10 @@ bool OutdoorPvPSI::HandleDropFlag(Player *plr, uint32 spellId)
bool OutdoorPvPSI::HandleCustomSpell(Player *plr, uint32 spellId, GameObject *go)
{
- if(!go || spellId != SI_SILITHYST_FLAG_GO_SPELL)
+ if (!go || spellId != SI_SILITHYST_FLAG_GO_SPELL)
return false;
plr->CastSpell(plr,SI_SILITHYST_FLAG,true);
- if(go->GetGOInfo()->id == SI_SILITHYST_MOUND)
+ if (go->GetGOInfo()->id == SI_SILITHYST_MOUND)
{
// despawn go
go->SetRespawnTime(0);
diff --git a/src/game/OutdoorPvPTF.cpp b/src/game/OutdoorPvPTF.cpp
index 16d13b6b2e6..4c0e6122e14 100644
--- a/src/game/OutdoorPvPTF.cpp
+++ b/src/game/OutdoorPvPTF.cpp
@@ -101,7 +101,7 @@ void OPvPCapturePointTF::UpdateTowerState()
bool OPvPCapturePointTF::HandlePlayerEnter(Player *plr)
{
- if(OPvPCapturePoint::HandlePlayerEnter(plr))
+ if (OPvPCapturePoint::HandlePlayerEnter(plr))
{
plr->SendUpdateWorldState(TF_UI_TOWER_SLIDER_DISPLAY, 1);
uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f);
@@ -122,9 +122,9 @@ bool OutdoorPvPTF::Update(uint32 diff)
{
bool changed = false;
- if(changed = OutdoorPvP::Update(diff))
+ if (changed = OutdoorPvP::Update(diff))
{
- if(m_AllianceTowersControlled == TF_TOWER_NUM)
+ if (m_AllianceTowersControlled == TF_TOWER_NUM)
{
TeamApplyBuff(TEAM_ALLIANCE, TF_CAPTURE_BUFF);
m_IsLocked = true;
@@ -133,7 +133,7 @@ bool OutdoorPvPTF::Update(uint32 diff)
SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_ALLIANCE,uint32(1));
SendUpdateWorldState(TF_UI_TOWERS_CONTROLLED_DISPLAY, uint32(0));
}
- else if(m_HordeTowersControlled == TF_TOWER_NUM)
+ else if (m_HordeTowersControlled == TF_TOWER_NUM)
{
TeamApplyBuff(TEAM_HORDE, TF_CAPTURE_BUFF);
m_IsLocked = true;
@@ -150,10 +150,10 @@ bool OutdoorPvPTF::Update(uint32 diff)
SendUpdateWorldState(TF_UI_TOWER_COUNT_A, m_AllianceTowersControlled);
SendUpdateWorldState(TF_UI_TOWER_COUNT_H, m_HordeTowersControlled);
}
- if(m_IsLocked)
+ if (m_IsLocked)
{
// lock timer is down, release lock
- if(m_LockTimer < diff)
+ if (m_LockTimer < diff)
{
m_LockTimer = TF_LOCK_TIME;
m_LockTimerUpdate = 0;
@@ -166,7 +166,7 @@ bool OutdoorPvPTF::Update(uint32 diff)
else
{
// worldstateui update timer is down, update ui with new time data
- if(m_LockTimerUpdate < diff)
+ if (m_LockTimerUpdate < diff)
{
m_LockTimerUpdate = TF_LOCK_TIME_UPDATE;
uint32 minutes_left = m_LockTimer / 60000;
@@ -187,14 +187,14 @@ bool OutdoorPvPTF::Update(uint32 diff)
void OutdoorPvPTF::HandlePlayerEnterZone(Player * plr, uint32 zone)
{
- if(plr->GetTeam() == ALLIANCE)
+ if (plr->GetTeam() == ALLIANCE)
{
- if(m_AllianceTowersControlled >= TF_TOWER_NUM)
+ if (m_AllianceTowersControlled >= TF_TOWER_NUM)
plr->CastSpell(plr,TF_CAPTURE_BUFF,true);
}
else
{
- if(m_HordeTowersControlled >= TF_TOWER_NUM)
+ if (m_HordeTowersControlled >= TF_TOWER_NUM)
plr->CastSpell(plr,TF_CAPTURE_BUFF,true);
}
OutdoorPvP::HandlePlayerEnterZone(plr,zone);
@@ -245,16 +245,16 @@ bool OPvPCapturePointTF::Update(uint32 diff)
void OPvPCapturePointTF::ChangeState()
{
// if changing from controlling alliance to horde
- if( m_OldState == OBJECTIVESTATE_ALLIANCE )
+ if ( m_OldState == OBJECTIVESTATE_ALLIANCE )
{
- if(((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled)
+ if (((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled)
((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled--;
sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOOSE_A));
}
// if changing from controlling horde to alliance
else if ( m_OldState == OBJECTIVESTATE_HORDE )
{
- if(((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled)
+ if (((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled)
((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled--;
sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOOSE_H));
}
@@ -266,14 +266,14 @@ void OPvPCapturePointTF::ChangeState()
case OBJECTIVESTATE_ALLIANCE:
m_TowerState = TF_TOWERSTATE_A;
artkit = 2;
- if(((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled<TF_TOWER_NUM)
+ if (((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled<TF_TOWER_NUM)
((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled++;
sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A));
break;
case OBJECTIVESTATE_HORDE:
m_TowerState = TF_TOWERSTATE_H;
artkit = 1;
- if(((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled<TF_TOWER_NUM)
+ if (((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled<TF_TOWER_NUM)
((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled++;
sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H));
break;
@@ -287,7 +287,7 @@ void OPvPCapturePointTF::ChangeState()
}
GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
- if(flag)
+ if (flag)
{
flag->SetGoArtKit(artkit);
}
diff --git a/src/game/OutdoorPvPZM.cpp b/src/game/OutdoorPvPZM.cpp
index 559223a920a..ad447b1b2cb 100644
--- a/src/game/OutdoorPvPZM.cpp
+++ b/src/game/OutdoorPvPZM.cpp
@@ -54,7 +54,7 @@ void OPvPCapturePointZM_Beacon::UpdateTowerState()
bool OPvPCapturePointZM_Beacon::HandlePlayerEnter(Player *plr)
{
- if(OPvPCapturePoint::HandlePlayerEnter(plr))
+ if (OPvPCapturePoint::HandlePlayerEnter(plr))
{
plr->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 1);
uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f);
@@ -74,16 +74,16 @@ void OPvPCapturePointZM_Beacon::HandlePlayerLeave(Player *plr)
void OPvPCapturePointZM_Beacon::ChangeState()
{
// if changing from controlling alliance to horde
- if( m_OldState == OBJECTIVESTATE_ALLIANCE )
+ if ( m_OldState == OBJECTIVESTATE_ALLIANCE )
{
- if(((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled)
+ if (((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled)
((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled--;
sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(ZMBeaconLooseA[m_TowerType]));
}
// if changing from controlling horde to alliance
else if ( m_OldState == OBJECTIVESTATE_HORDE )
{
- if(((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled)
+ if (((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled)
((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled--;
sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(ZMBeaconLooseH[m_TowerType]));
}
@@ -92,13 +92,13 @@ void OPvPCapturePointZM_Beacon::ChangeState()
{
case OBJECTIVESTATE_ALLIANCE:
m_TowerState = ZM_TOWERSTATE_A;
- if(((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled<ZM_NUM_BEACONS)
+ if (((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled<ZM_NUM_BEACONS)
((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled++;
sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(ZMBeaconCaptureA[m_TowerType]));
break;
case OBJECTIVESTATE_HORDE:
m_TowerState = ZM_TOWERSTATE_H;
- if(((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled<ZM_NUM_BEACONS)
+ if (((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled<ZM_NUM_BEACONS)
((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled++;
sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(ZMBeaconCaptureH[m_TowerType]));
break;
@@ -127,11 +127,11 @@ void OPvPCapturePointZM_Beacon::SendChangePhase()
bool OutdoorPvPZM::Update(uint32 diff)
{
bool changed = false;
- if(changed = OutdoorPvP::Update(diff))
+ if (changed = OutdoorPvP::Update(diff))
{
- if(m_AllianceTowersControlled == ZM_NUM_BEACONS)
+ if (m_AllianceTowersControlled == ZM_NUM_BEACONS)
m_GraveYard->SetBeaconState(ALLIANCE);
- else if(m_HordeTowersControlled == ZM_NUM_BEACONS)
+ else if (m_HordeTowersControlled == ZM_NUM_BEACONS)
m_GraveYard->SetBeaconState(HORDE);
else
m_GraveYard->SetBeaconState(0);
@@ -141,14 +141,14 @@ bool OutdoorPvPZM::Update(uint32 diff)
void OutdoorPvPZM::HandlePlayerEnterZone(Player * plr, uint32 zone)
{
- if(plr->GetTeam() == ALLIANCE)
+ if (plr->GetTeam() == ALLIANCE)
{
- if(m_GraveYard->m_GraveYardState & ZM_GRAVEYARD_A)
+ if (m_GraveYard->m_GraveYardState & ZM_GRAVEYARD_A)
plr->CastSpell(plr,ZM_CAPTURE_BUFF,true);
}
else
{
- if(m_GraveYard->m_GraveYardState & ZM_GRAVEYARD_H)
+ if (m_GraveYard->m_GraveYardState & ZM_GRAVEYARD_H)
plr->CastSpell(plr,ZM_CAPTURE_BUFF,true);
}
OutdoorPvP::HandlePlayerEnterZone(plr,zone);
@@ -192,12 +192,12 @@ bool OutdoorPvPZM::SetupOutdoorPvP()
void OutdoorPvPZM::HandleKillImpl(Player *plr, Unit * killed)
{
- if(killed->GetTypeId() != TYPEID_PLAYER)
+ if (killed->GetTypeId() != TYPEID_PLAYER)
return;
- if(plr->GetTeam() == ALLIANCE && killed->ToPlayer()->GetTeam() != ALLIANCE)
+ if (plr->GetTeam() == ALLIANCE && killed->ToPlayer()->GetTeam() != ALLIANCE)
plr->CastSpell(plr,ZM_AlliancePlayerKillReward,true);
- else if(plr->GetTeam() == HORDE && killed->ToPlayer()->GetTeam() != HORDE)
+ else if (plr->GetTeam() == HORDE && killed->ToPlayer()->GetTeam() != HORDE)
plr->CastSpell(plr,ZM_HordePlayerKillReward,true);
}
@@ -211,11 +211,11 @@ bool OPvPCapturePointZM_GraveYard::Update(uint32 diff)
int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player *plr, uint64 guid)
{
uint32 retval = OPvPCapturePoint::HandleOpenGo(plr, guid);
- if(retval>=0)
+ if (retval>=0)
{
- if(plr->HasAura(ZM_BATTLE_STANDARD_A) && m_GraveYardState != ZM_GRAVEYARD_A)
+ if (plr->HasAura(ZM_BATTLE_STANDARD_A) && m_GraveYardState != ZM_GRAVEYARD_A)
{
- if(m_GraveYardState == ZM_GRAVEYARD_H)
+ if (m_GraveYardState == ZM_GRAVEYARD_H)
sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_LOOSE_GY_H));
m_GraveYardState = ZM_GRAVEYARD_A;
DelObject(0); // only one gotype is used in the whole outdoor pvp, no need to call it a constant
@@ -226,9 +226,9 @@ int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player *plr, uint64 guid)
plr->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A);
sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_A));
}
- else if(plr->HasAura(ZM_BATTLE_STANDARD_H) && m_GraveYardState != ZM_GRAVEYARD_H)
+ else if (plr->HasAura(ZM_BATTLE_STANDARD_H) && m_GraveYardState != ZM_GRAVEYARD_H)
{
- if(m_GraveYardState == ZM_GRAVEYARD_A)
+ if (m_GraveYardState == ZM_GRAVEYARD_A)
sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_LOOSE_GY_A));
m_GraveYardState = ZM_GRAVEYARD_H;
DelObject(0); // only one gotype is used in the whole outdoor pvp, no need to call it a constant
@@ -284,7 +284,7 @@ void OPvPCapturePointZM_GraveYard::FillInitialWorldStates(WorldPacket &data)
void OPvPCapturePointZM_GraveYard::SetBeaconState(uint32 controlling_faction)
{
// nothing to do here
- if(m_BothControllingFaction == controlling_faction)
+ if (m_BothControllingFaction == controlling_faction)
return;
m_BothControllingFaction = controlling_faction;
@@ -292,27 +292,27 @@ void OPvPCapturePointZM_GraveYard::SetBeaconState(uint32 controlling_faction)
{
case ALLIANCE:
// if ally already controls the gy and taken back both beacons, return, nothing to do for us
- if(m_GraveYardState & ZM_GRAVEYARD_A)
+ if (m_GraveYardState & ZM_GRAVEYARD_A)
return;
// ally doesn't control the gy, but controls the side beacons -> add gossip option, add neutral banner
break;
case HORDE:
// if horde already controls the gy and taken back both beacons, return, nothing to do for us
- if(m_GraveYardState & ZM_GRAVEYARD_H)
+ if (m_GraveYardState & ZM_GRAVEYARD_H)
return;
// horde doesn't control the gy, but controls the side beacons -> add gossip option, add neutral banner
break;
default:
// if the graveyard is not neutral, then leave it that way
// if the graveyard is neutral, then we have to dispel the buff from the flag carrier
- if(m_GraveYardState & ZM_GRAVEYARD_N)
+ if (m_GraveYardState & ZM_GRAVEYARD_N)
{
// gy was neutral, thus neutral banner was spawned, it is possible that someone was taking the flag to the gy
- if(m_FlagCarrierGUID)
+ if (m_FlagCarrierGUID)
{
// remove flag from carrier, reset flag carrier guid
Player * p = objmgr.GetPlayer(m_FlagCarrierGUID);
- if(p)
+ if (p)
{
p->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A);
p->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_H);
@@ -330,11 +330,11 @@ bool OPvPCapturePointZM_GraveYard::CanTalkTo(Player * plr, Creature * c, GossipM
{
uint64 guid = c->GetGUID();
std::map<uint64,uint32>::iterator itr = m_CreatureTypes.find(guid);
- if(itr != m_CreatureTypes.end())
+ if (itr != m_CreatureTypes.end())
{
- if(itr->second == ZM_ALLIANCE_FIELD_SCOUT && plr->GetTeam() == ALLIANCE && m_BothControllingFaction == ALLIANCE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_A)
+ if (itr->second == ZM_ALLIANCE_FIELD_SCOUT && plr->GetTeam() == ALLIANCE && m_BothControllingFaction == ALLIANCE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_A)
return true;
- else if(itr->second == ZM_HORDE_FIELD_SCOUT && plr->GetTeam() == HORDE && m_BothControllingFaction == HORDE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_H)
+ else if (itr->second == ZM_HORDE_FIELD_SCOUT && plr->GetTeam() == HORDE && m_BothControllingFaction == HORDE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_H)
return true;
}
return false;
@@ -343,20 +343,20 @@ bool OPvPCapturePointZM_GraveYard::CanTalkTo(Player * plr, Creature * c, GossipM
bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid)
{
std::map<uint64,uint32>::iterator itr = m_CreatureTypes.find(guid);
- if(itr != m_CreatureTypes.end())
+ if (itr != m_CreatureTypes.end())
{
Creature * cr = HashMapHolder<Creature>::Find(guid);
- if(!cr)
+ if (!cr)
return true;
// if the flag is already taken, then return
- if(m_FlagCarrierGUID)
+ if (m_FlagCarrierGUID)
return true;
- if(itr->second == ZM_ALLIANCE_FIELD_SCOUT)
+ if (itr->second == ZM_ALLIANCE_FIELD_SCOUT)
{
cr->CastSpell(plr,ZM_BATTLE_STANDARD_A,true);
m_FlagCarrierGUID = plr->GetGUID();
}
- else if(itr->second == ZM_HORDE_FIELD_SCOUT)
+ else if (itr->second == ZM_HORDE_FIELD_SCOUT)
{
cr->CastSpell(plr,ZM_BATTLE_STANDARD_H,true);
m_FlagCarrierGUID = plr->GetGUID();
diff --git a/src/game/PassiveAI.cpp b/src/game/PassiveAI.cpp
index 54f0db87ac7..274a6a72e51 100644
--- a/src/game/PassiveAI.cpp
+++ b/src/game/PassiveAI.cpp
@@ -39,9 +39,9 @@ void PossessedAI::AttackStart(Unit *target)
void PossessedAI::UpdateAI(const uint32 diff)
{
- if(me->getVictim())
+ if (me->getVictim())
{
- if(!me->canAttack(me->getVictim()))
+ if (!me->canAttack(me->getVictim()))
me->AttackStop();
else
DoMeleeAttackIfReady();
diff --git a/src/game/Path.h b/src/game/Path.h
index a222156daf5..591c0d2eda2 100644
--- a/src/game/Path.h
+++ b/src/game/Path.h
@@ -67,7 +67,7 @@ class Path
len += sqrtf( xd*xd + yd*yd + zd*zd );
}
- if(curnode > 0)
+ if (curnode > 0)
{
xd = x - i_nodes[curnode-1].x;
yd = y - i_nodes[curnode-1].y;
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index 25cef895e51..f1984eb93e7 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -48,7 +48,7 @@ m_resetTalentsCost(0), m_resetTalentsTime(0), m_usedTalentCount(0), m_auraRaidUp
m_declinedname(NULL), m_owner(owner)
{
m_unitTypeMask |= UNIT_MASK_PET;
- if(type == HUNTER_PET)
+ if (type == HUNTER_PET)
m_unitTypeMask |= UNIT_MASK_HUNTER_PET;
if (!(m_unitTypeMask & UNIT_MASK_CONTROLABLE_GUARDIAN))
@@ -71,7 +71,7 @@ Pet::~Pet()
void Pet::AddToWorld()
{
///- Register the pet for guid lookup
- if(!IsInWorld())
+ if (!IsInWorld())
{
///- Register the pet for guid lookup
ObjectAccessor::Instance().AddObject(this);
@@ -94,7 +94,7 @@ void Pet::AddToWorld()
void Pet::RemoveFromWorld()
{
///- Remove the pet from the accessor
- if(IsInWorld())
+ if (IsInWorld())
{
///- Don't call the function for Creature, normal mobs + totems go in a different storage
Unit::RemoveFromWorld();
@@ -133,7 +133,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
"FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u') ",
ownerid,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT);
- if(!result)
+ if (!result)
return false;
Field *fields = result->Fetch();
@@ -153,10 +153,10 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
return false;
PetType pet_type = PetType(fields[18].GetUInt8());
- if(pet_type==HUNTER_PET)
+ if (pet_type==HUNTER_PET)
{
CreatureInfo const* creatureInfo = objmgr.GetCreatureTemplate(petentry);
- if(!creatureInfo || !creatureInfo->isTameable(owner->CanTameExoticPets()))
+ if (!creatureInfo || !creatureInfo->isTameable(owner->CanTameExoticPets()))
return false;
}
@@ -224,7 +224,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
setPowerType(POWER_FOCUS);
break;
default:
- if(!IsPetGhoul())
+ if (!IsPetGhoul())
sLog.outError("Pet have incorrect type (%u) for pet loading.", getPetType());
break;
}
@@ -238,7 +238,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
SetCanModifyStats(true);
InitStatsForLevel(petlevel);
- if(getPetType() == SUMMON_PET && !current) //all (?) summon pets come with full health when called, but not when they are current
+ if (getPetType() == SUMMON_PET && !current) //all (?) summon pets come with full health when called, but not when they are current
{
SetHealth(GetMaxHealth());
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
@@ -247,7 +247,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
{
uint32 savedhealth = fields[10].GetUInt32();
uint32 savedmana = fields[11].GetUInt32();
- if(!savedhealth && getPetType() == HUNTER_PET)
+ if (!savedhealth && getPetType() == HUNTER_PET)
setDeathState(JUST_DIED);
else
{
@@ -260,7 +260,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
// 0=current
// 1..MAX_PET_STABLES in stable slot
// PET_SAVE_NOT_IN_SLOT(100) = not stable slot (summoning))
- if(fields[7].GetUInt32() != 0)
+ if (fields[7].GetUInt32() != 0)
{
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u' AND id <> '%u'",
@@ -313,18 +313,18 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
owner->PetSpellInitialize();
- if(owner->GetGroup())
+ if (owner->GetGroup())
owner->SetGroupUpdateFlag(GROUP_UPDATE_PET);
owner->SendTalentsInfoData(true);
- if(getPetType() == HUNTER_PET)
+ if (getPetType() == HUNTER_PET)
{
result = CharacterDatabase.PQuery("SELECT genitive, dative, accusative, instrumental, prepositional FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'", owner->GetGUIDLow(), GetCharmInfo()->GetPetNumber());
- if(result)
+ if (result)
{
- if(m_declinedname)
+ if (m_declinedname)
delete m_declinedname;
m_declinedname = new DeclinedName;
@@ -337,7 +337,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
}
//set last used pet number (for use in BG's)
- if(owner->GetTypeId() == TYPEID_PLAYER && isControlled() && !isTemporarySummoned() && (getPetType() == SUMMON_PET || getPetType() == HUNTER_PET))
+ if (owner->GetTypeId() == TYPEID_PLAYER && isControlled() && !isTemporarySummoned() && (getPetType() == SUMMON_PET || getPetType() == HUNTER_PET))
owner->ToPlayer()->SetLastPetNumber(pet_number);
m_loading = false;
@@ -356,7 +356,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
return;
// not save not player pets
- if(!IS_PLAYER_GUID(GetOwnerGUID()))
+ if (!IS_PLAYER_GUID(GetOwnerGUID()))
return;
Player* pOwner = (Player*)GetOwner();
@@ -368,7 +368,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
pOwner->GetTemporaryUnsummonedPetNumber() != m_charmInfo->GetPetNumber())
{
// pet will lost anyway at restore temporary unsummoned
- if(getPetType()==HUNTER_PET)
+ if (getPetType()==HUNTER_PET)
return;
// for warlock case
@@ -379,7 +379,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
uint32 curmana = GetPower(POWER_MANA);
// stable and not in slot saves
- if(mode > PET_SAVE_AS_CURRENT)
+ if (mode > PET_SAVE_AS_CURRENT)
{
RemoveAllAuras();
}
@@ -389,7 +389,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
_SaveAuras();
// current/stable/not_in_slot
- if(mode >= PET_SAVE_AS_CURRENT)
+ if (mode >= PET_SAVE_AS_CURRENT)
{
uint32 owner = GUID_LOPART(GetOwnerGUID());
std::string name = m_name;
@@ -399,12 +399,12 @@ void Pet::SavePetToDB(PetSaveMode mode)
CharacterDatabase.PExecute("DELETE FROM character_pet WHERE owner = '%u' AND id = '%u'", owner,m_charmInfo->GetPetNumber() );
// prevent duplicate using slot (except PET_SAVE_NOT_IN_SLOT)
- if(mode <= PET_SAVE_LAST_STABLE_SLOT)
+ if (mode <= PET_SAVE_LAST_STABLE_SLOT)
CharacterDatabase.PExecute("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u'",
PET_SAVE_NOT_IN_SLOT, owner, uint32(mode) );
// prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT
- if(getPetType()==HUNTER_PET && (mode==PET_SAVE_AS_CURRENT||mode > PET_SAVE_LAST_STABLE_SLOT))
+ if (getPetType()==HUNTER_PET && (mode==PET_SAVE_AS_CURRENT||mode > PET_SAVE_LAST_STABLE_SLOT))
CharacterDatabase.PExecute("DELETE FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u')",
owner,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT);
// save pet
@@ -461,9 +461,9 @@ void Pet::DeleteFromDB(uint32 guidlow)
void Pet::setDeathState(DeathState s) // overwrite virtual Creature::setDeathState and Unit::setDeathState
{
Creature::setDeathState(s);
- if(getDeathState()==CORPSE)
+ if (getDeathState()==CORPSE)
{
- if(getPetType() == HUNTER_PET)
+ if (getPetType() == HUNTER_PET)
{
// pet corpse non lootable and non skinnable
SetUInt32Value( UNIT_DYNAMIC_FLAGS, 0x00 );
@@ -471,13 +471,13 @@ void Pet::setDeathState(DeathState s) // overwrite virtual
//lose happiness when died and not in BG/Arena
MapEntry const* mapEntry = sMapStore.LookupEntry(GetMapId());
- if(!mapEntry || (mapEntry->map_type != MAP_ARENA && mapEntry->map_type != MAP_BATTLEGROUND))
+ if (!mapEntry || (mapEntry->map_type != MAP_ARENA && mapEntry->map_type != MAP_BATTLEGROUND))
ModifyPower(POWER_HAPPINESS, -HAPPINESS_LEVEL_SIZE);
//SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
}
}
- else if(getDeathState()==ALIVE)
+ else if (getDeathState()==ALIVE)
{
//RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
CastPetAuras(true);
@@ -496,7 +496,7 @@ void Pet::Update(uint32 diff)
{
case CORPSE:
{
- if(getPetType() != HUNTER_PET || m_deathTimer <= diff )
+ if (getPetType() != HUNTER_PET || m_deathTimer <= diff )
{
Remove(PET_SAVE_NOT_IN_SLOT); //hunters' pets never get removed because of death, NEVER!
return;
@@ -507,16 +507,16 @@ void Pet::Update(uint32 diff)
{
// unsummon pet that lost owner
Player* owner = GetOwner();
- if(!owner || (!IsWithinDistInMap(owner, GetMap()->GetVisibilityDistance()) && !isPossessed()) || isControlled() && !owner->GetPetGUID())
- //if(!owner || (!IsWithinDistInMap(owner, GetMap()->GetVisibilityDistance()) && (owner->GetCharmGUID() && (owner->GetCharmGUID() != GetGUID()))) || (isControlled() && !owner->GetPetGUID()))
+ if (!owner || (!IsWithinDistInMap(owner, GetMap()->GetVisibilityDistance()) && !isPossessed()) || isControlled() && !owner->GetPetGUID())
+ //if (!owner || (!IsWithinDistInMap(owner, GetMap()->GetVisibilityDistance()) && (owner->GetCharmGUID() && (owner->GetCharmGUID() != GetGUID()))) || (isControlled() && !owner->GetPetGUID()))
{
Remove(PET_SAVE_NOT_IN_SLOT, true);
return;
}
- if(isControlled())
+ if (isControlled())
{
- if( owner->GetPetGUID() != GetGUID() )
+ if ( owner->GetPetGUID() != GetGUID() )
{
sLog.outError("Pet %u is not pet of owner %u, removed", GetEntry(), m_owner->GetName());
Remove(getPetType()==HUNTER_PET?PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT);
@@ -524,9 +524,9 @@ void Pet::Update(uint32 diff)
}
}
- if(m_duration > 0)
+ if (m_duration > 0)
{
- if(m_duration > diff)
+ if (m_duration > diff)
m_duration -= diff;
else
{
@@ -536,9 +536,9 @@ void Pet::Update(uint32 diff)
}
//regenerate focus for hunter pets or energy for deathknight's ghoul
- if(m_regenTimer)
+ if (m_regenTimer)
{
- if(m_regenTimer > diff)
+ if (m_regenTimer > diff)
m_regenTimer -= diff;
else
{
@@ -547,13 +547,13 @@ void Pet::Update(uint32 diff)
case POWER_FOCUS:
Regenerate(POWER_FOCUS);
m_regenTimer += PET_FOCUS_REGEN_INTERVAL - diff;
- if(!m_regenTimer) ++m_regenTimer;
+ if (!m_regenTimer) ++m_regenTimer;
break;
// in creature::update
//case POWER_ENERGY:
// Regenerate(POWER_ENERGY);
// m_regenTimer += CREATURE_REGEN_INTERVAL - diff;
- // if(!m_regenTimer) ++m_regenTimer;
+ // if (!m_regenTimer) ++m_regenTimer;
// break;
default:
m_regenTimer = 0;
@@ -562,10 +562,10 @@ void Pet::Update(uint32 diff)
}
}
- if(getPetType() != HUNTER_PET)
+ if (getPetType() != HUNTER_PET)
break;
- if(m_happinessTimer <= diff)
+ if (m_happinessTimer <= diff)
{
LooseHappiness();
m_happinessTimer = 7500;
@@ -626,16 +626,16 @@ void Pet::LooseHappiness()
if (curValue <= 0)
return;
int32 addvalue = 670; //value is 70/35/17/8/4 (per min) * 1000 / 8 (timer 7.5 secs)
- if(isInCombat()) //we know in combat happiness fades faster, multiplier guess
+ if (isInCombat()) //we know in combat happiness fades faster, multiplier guess
addvalue = int32(addvalue * 1.5);
ModifyPower(POWER_HAPPINESS, -addvalue);
}
HappinessState Pet::GetHappinessState()
{
- if(GetPower(POWER_HAPPINESS) < HAPPINESS_LEVEL_SIZE)
+ if (GetPower(POWER_HAPPINESS) < HAPPINESS_LEVEL_SIZE)
return UNHAPPY;
- else if(GetPower(POWER_HAPPINESS) >= HAPPINESS_LEVEL_SIZE * 2)
+ else if (GetPower(POWER_HAPPINESS) >= HAPPINESS_LEVEL_SIZE * 2)
return HAPPY;
else
return CONTENT;
@@ -646,17 +646,17 @@ bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
uint8 activecount = 1;
uint32 chainstartstore[ACTIVE_SPELLS_MAX];
- if(IsPassiveSpell(spellid))
+ if (IsPassiveSpell(spellid))
return true;
chainstartstore[0] = spellmgr.GetFirstSpellInChain(spellid);
for (PetSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
{
- if(itr->second.state == PETSPELL_REMOVED)
+ if (itr->second.state == PETSPELL_REMOVED)
continue;
- if(IsPassiveSpell(itr->first))
+ if (IsPassiveSpell(itr->first))
continue;
uint32 chainstart = spellmgr.GetFirstSpellInChain(itr->first);
@@ -665,14 +665,14 @@ bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
for (x = 0; x < activecount; x++)
{
- if(chainstart == chainstartstore[x])
+ if (chainstart == chainstartstore[x])
break;
}
- if(x == activecount) //spellchain not yet saved -> add active count
+ if (x == activecount) //spellchain not yet saved -> add active count
{
++activecount;
- if(activecount > ACTIVE_SPELLS_MAX)
+ if (activecount > ACTIVE_SPELLS_MAX)
return false;
chainstartstore[x] = chainstart;
}
@@ -687,13 +687,13 @@ void Pet::Remove(PetSaveMode mode, bool returnreagent)
void Pet::GivePetXP(uint32 xp)
{
- if(getPetType() != HUNTER_PET)
+ if (getPetType() != HUNTER_PET)
return;
if ( xp < 1 )
return;
- if(!isAlive())
+ if (!isAlive())
return;
uint8 level = getLevel();
@@ -741,7 +741,7 @@ void Pet::GivePetLevel(uint8 level)
bool Pet::CreateBaseAtCreature(Creature* creature)
{
- if(!creature)
+ if (!creature)
{
sLog.outError("CRITICAL: NULL pointer parsed into CreateBaseAtCreature()");
return false;
@@ -750,12 +750,12 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
sLog.outDebug("Create pet");
uint32 pet_number = objmgr.GeneratePetNumber();
- if(!Create(guid, creature->GetMap(), creature->GetPhaseMask(), creature->GetEntry(), pet_number))
+ if (!Create(guid, creature->GetMap(), creature->GetPhaseMask(), creature->GetEntry(), pet_number))
return false;
Relocate(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
- if(!IsPositionValid())
+ if (!IsPositionValid())
{
sLog.outError("Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)",
GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY());
@@ -763,7 +763,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
}
CreatureInfo const *cinfo = GetCreatureInfo();
- if(!cinfo)
+ if (!cinfo)
{
sLog.outError("CreateBaseAtCreature() failed, creatureInfo is missing!");
return false;
@@ -779,12 +779,12 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(creature->getLevel())*PET_XP_FACTOR);
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
- if(CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cinfo->family))
+ if (CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cinfo->family))
SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]);
else
SetName(creature->GetNameForLocaleIdx(objmgr.GetDBCLocaleIndex()));
- if(cinfo->type == CREATURE_TYPE_BEAST)
+ if (cinfo->type == CREATURE_TYPE_BEAST)
{
SetUInt32Value(UNIT_FIELD_BYTES_0, 0x02020100);
SetSheath(SHEATH_STATE_MELEE);
@@ -804,13 +804,13 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
//Determine pet type
PetType petType = MAX_PET_TYPE;
- if(isPet() && m_owner->GetTypeId() == TYPEID_PLAYER)
+ if (isPet() && m_owner->GetTypeId() == TYPEID_PLAYER)
{
- if((m_owner->getClass() == CLASS_WARLOCK)
+ if ((m_owner->getClass() == CLASS_WARLOCK)
|| (m_owner->getClass() == CLASS_SHAMAN) // Fire Elemental
|| (m_owner->getClass() == CLASS_DEATH_KNIGHT)) // Risen Ghoul
petType = SUMMON_PET;
- else if(m_owner->getClass() == CLASS_HUNTER)
+ else if (m_owner->getClass() == CLASS_HUNTER)
{
petType = HUNTER_PET;
m_unitTypeMask |= UNIT_MASK_HUNTER_PET;
@@ -833,7 +833,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
//scale
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cinfo->family);
- if(cFamily && cFamily->minScale > 0.0f && petType==HUNTER_PET)
+ if (cFamily && cFamily->minScale > 0.0f && petType==HUNTER_PET)
{
float scale;
if (getLevel() >= cFamily->maxScaleLevel)
@@ -924,7 +924,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
{
//40% damage bonus of mage's frost damage
float val = m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) * 0.4;
- if(val < 0)
+ if (val < 0)
val = 0;
SetBonusDamage( int32(val));
break;
@@ -988,7 +988,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(m_owner->GetArmor()) * 0.35f); // Bonus Armor (35% of player armor)
SetModifierValue(UNIT_MOD_STAT_STAMINA, BASE_VALUE,float(m_owner->GetStat(STAT_STAMINA)) * 0.3f); // Bonus Stamina (30% of player stamina)
- if(!HasAura(58877))//prevent apply twice for the 2 wolves
+ if (!HasAura(58877))//prevent apply twice for the 2 wolves
AddAura(58877, this);//Spirit Hunt, passive, Spirit Wolves' attacks heal them and their master for 150% of damage done.
break;
}
@@ -1048,13 +1048,13 @@ bool Pet::HaveInDiet(ItemPrototype const* item) const
uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel)
{
// -5 or greater food level
- if(getLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect
+ if (getLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect
return 35000;
// -10..-6
- else if(getLevel() <= itemlevel + 10) //pure guess, but sounds good
+ else if (getLevel() <= itemlevel + 10) //pure guess, but sounds good
return 17000;
// -14..-11
- else if(getLevel() <= itemlevel + 14) //level 55 food gets green on 70, makes sense to me
+ else if (getLevel() <= itemlevel + 14) //level 55 food gets green on 70, makes sense to me
return 8000;
// -15 or less
else
@@ -1068,7 +1068,7 @@ void Pet::_LoadSpellCooldowns()
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT spell,time FROM pet_spell_cooldown WHERE guid = '%u'",m_charmInfo->GetPetNumber());
- if(result)
+ if (result)
{
time_t curTime = time(NULL);
@@ -1083,14 +1083,14 @@ void Pet::_LoadSpellCooldowns()
uint32 spell_id = fields[0].GetUInt32();
time_t db_time = (time_t)fields[1].GetUInt64();
- if(!sSpellStore.LookupEntry(spell_id))
+ if (!sSpellStore.LookupEntry(spell_id))
{
sLog.outError("Pet %u have unknown spell %u in `pet_spell_cooldown`, skipping.",m_charmInfo->GetPetNumber(),spell_id);
continue;
}
// skip outdated cooldown
- if(db_time <= curTime)
+ if (db_time <= curTime)
continue;
data << uint32(spell_id);
@@ -1102,7 +1102,7 @@ void Pet::_LoadSpellCooldowns()
}
while (result->NextRow());
- if(!m_CreatureSpellCooldowns.empty() && GetOwner())
+ if (!m_CreatureSpellCooldowns.empty() && GetOwner())
((Player*)GetOwner())->GetSession()->SendPacket(&data);
}
}
@@ -1202,7 +1202,7 @@ void Pet::_LoadAuras(uint32 timediff)
uint8 remaincharges = fields[13].GetUInt8();
SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid);
- if(!spellproto)
+ if (!spellproto)
{
sLog.outError("Unknown aura (spellid %u), ignore.",spellid);
continue;
@@ -1218,9 +1218,9 @@ void Pet::_LoadAuras(uint32 timediff)
}
// prevent wrong values of remaincharges
- if(spellproto->procCharges)
+ if (spellproto->procCharges)
{
- if(remaincharges <= 0 || remaincharges > spellproto->procCharges)
+ if (remaincharges <= 0 || remaincharges > spellproto->procCharges)
remaincharges = spellproto->procCharges;
}
else
@@ -1358,7 +1358,7 @@ bool Pet::addSpell(uint32 spell_id,ActiveStates active /*= ACT_DECIDE*/, PetSpel
}
}
}
- else if(spellmgr.GetSpellRank(spell_id)!=0)
+ else if (spellmgr.GetSpellRank(spell_id)!=0)
{
for (PetSpellMap::const_iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2)
{
@@ -1392,7 +1392,7 @@ bool Pet::addSpell(uint32 spell_id,ActiveStates active /*= ACT_DECIDE*/, PetSpel
else
m_charmInfo->AddSpellToActionBar(spell_id);
- if(newspell.active == ACT_ENABLED)
+ if (newspell.active == ACT_ENABLED)
ToggleAutocast(spell_id, true);
uint32 talentCost = GetTalentSpellCost(spell_id);
@@ -1444,7 +1444,7 @@ void Pet::InitLevelupSpellsForLevel()
int32 petSpellsId = GetCreatureInfo()->PetSpellDataId ? -(int32)GetCreatureInfo()->PetSpellDataId : GetEntry();
// default spells (can be not learned if pet level (as owner level decrease result for example) less first possible in normal game)
- if(PetDefaultSpellsEntry const *defSpells = spellmgr.GetPetDefaultSpellsEntry(petSpellsId))
+ if (PetDefaultSpellsEntry const *defSpells = spellmgr.GetPetDefaultSpellsEntry(petSpellsId))
{
for (uint8 i = 0; i < MAX_CREATURE_SPELL_DATA_SLOT; ++i)
{
@@ -1688,7 +1688,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
uint32 id = fields[0].GetUInt32();
- if(need_comma)
+ if (need_comma)
ss << ",";
ss << id;
@@ -1731,7 +1731,7 @@ void Pet::InitTalentForLevel()
uint8 level = getLevel();
uint32 talentPointsForLevel = GetMaxTalentPointsForLevel(level);
// Reset talents in case low level (on level down) or wrong points for level (hunter can unlearn TP increase talent)
- if(talentPointsForLevel == 0 || m_usedTalentCount > talentPointsForLevel)
+ if (talentPointsForLevel == 0 || m_usedTalentCount > talentPointsForLevel)
resetTalents(true); // Remove all talent points
SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount);
@@ -1808,10 +1808,10 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
if (i < m_autospells.size())
{
m_autospells.erase(itr2);
- if(itr->second.active != ACT_DISABLED)
+ if (itr->second.active != ACT_DISABLED)
{
itr->second.active = ACT_DISABLED;
- if(itr->second.state != PETSPELL_NEW)
+ if (itr->second.state != PETSPELL_NEW)
itr->second.state = PETSPELL_CHANGED;
}
}
diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp
index 65c95e97ed2..04245dc04ba 100644
--- a/src/game/PetAI.cpp
+++ b/src/game/PetAI.cpp
@@ -32,7 +32,7 @@
int PetAI::Permissible(const Creature *creature)
{
- if( creature->isPet())
+ if ( creature->isPet())
return PERMIT_BASE_SPECIAL;
return PERMIT_BASE_NO;
@@ -51,7 +51,7 @@ void PetAI::EnterEvadeMode()
bool PetAI::_needToStop() const
{
// This is needed for charmed creatures, as once their target was reset other effects can trigger threat
- if(m_creature->isCharmed() && m_creature->getVictim() == m_creature->GetCharmer())
+ if (m_creature->isCharmed() && m_creature->getVictim() == m_creature->GetCharmer())
return true;
return !m_creature->canAttack(m_creature->getVictim());
@@ -59,7 +59,7 @@ bool PetAI::_needToStop() const
void PetAI::_stopAttack()
{
- if( !m_creature->isAlive() )
+ if ( !m_creature->isAlive() )
{
DEBUG_LOG("Creature stoped attacking cuz his dead [guid=%u]", m_creature->GetGUIDLow());
m_creature->GetMotionMaster()->Clear();
@@ -82,16 +82,16 @@ void PetAI::UpdateAI(const uint32 diff)
Unit* owner = m_creature->GetCharmerOrOwner();
- if(m_updateAlliesTimer <= diff)
+ if (m_updateAlliesTimer <= diff)
// UpdateAllies self set update timer
UpdateAllies();
else
m_updateAlliesTimer -= diff;
// m_creature->getVictim() can't be used for check in case stop fighting, m_creature->getVictim() clear at Unit death etc.
- if( m_creature->getVictim() )
+ if ( m_creature->getVictim() )
{
- if( _needToStop() )
+ if ( _needToStop() )
{
DEBUG_LOG("Pet AI stoped attacking [guid=%u]", m_creature->GetGUIDLow());
_stopAttack();
@@ -100,7 +100,7 @@ void PetAI::UpdateAI(const uint32 diff)
DoMeleeAttackIfReady();
}
- else if(owner && m_creature->GetCharmInfo()) //no victim
+ else if (owner && m_creature->GetCharmInfo()) //no victim
{
Unit *nextTarget = SelectNextTarget();
@@ -112,7 +112,7 @@ void PetAI::UpdateAI(const uint32 diff)
else if (owner && !m_creature->hasUnitState(UNIT_STAT_FOLLOW)) // no charm info and no victim
m_creature->GetMotionMaster()->MoveFollow(owner,PET_FOLLOW_DIST, m_creature->GetFollowAngle());
- if(!me->GetCharmInfo())
+ if (!me->GetCharmInfo())
return;
// Autocast (casted only in combat or persistent spells in any state)
@@ -177,10 +177,10 @@ void PetAI::UpdateAI(const uint32 diff)
Unit* Target = ObjectAccessor::GetUnit(*m_creature,*tar);
//only buff targets that are in combat, unless the spell can only be cast while out of combat
- if(!Target)
+ if (!Target)
continue;
- if(spell->CanAutoCast(Target))
+ if (spell->CanAutoCast(Target))
{
targetSpellStore.push_back(std::make_pair<Unit*, Spell*>(Target, spell));
spellUsed = true;
@@ -205,13 +205,13 @@ void PetAI::UpdateAI(const uint32 diff)
SpellCastTargets targets;
targets.setUnitTarget( target );
- if( !m_creature->HasInArc(M_PI, target) )
+ if ( !m_creature->HasInArc(M_PI, target) )
{
m_creature->SetInFront(target);
- if(target && target->GetTypeId() == TYPEID_PLAYER)
+ if (target && target->GetTypeId() == TYPEID_PLAYER)
m_creature->SendUpdateToPlayer(target->ToPlayer());
- if(owner && owner->GetTypeId() == TYPEID_PLAYER)
+ if (owner && owner->GetTypeId() == TYPEID_PLAYER)
m_creature->SendUpdateToPlayer(owner->ToPlayer());
}
@@ -233,29 +233,29 @@ void PetAI::UpdateAllies()
m_updateAlliesTimer = 10*IN_MILISECONDS; //update friendly targets every 10 seconds, lesser checks increase performance
- if(!owner)
+ if (!owner)
return;
- else if(owner->GetTypeId() == TYPEID_PLAYER)
+ else if (owner->GetTypeId() == TYPEID_PLAYER)
pGroup = owner->ToPlayer()->GetGroup();
//only pet and owner/not in group->ok
- if(m_AllySet.size() == 2 && !pGroup)
+ if (m_AllySet.size() == 2 && !pGroup)
return;
//owner is in group; group members filled in already (no raid -> subgroupcount = whole count)
- if(pGroup && !pGroup->isRaidGroup() && m_AllySet.size() == (pGroup->GetMembersCount() + 2))
+ if (pGroup && !pGroup->isRaidGroup() && m_AllySet.size() == (pGroup->GetMembersCount() + 2))
return;
m_AllySet.clear();
m_AllySet.insert(m_creature->GetGUID());
- if(pGroup) //add group
+ if (pGroup) //add group
{
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* Target = itr->getSource();
- if(!Target || !pGroup->SameSubGroup((Player*)owner, Target))
+ if (!Target || !pGroup->SameSubGroup((Player*)owner, Target))
continue;
- if(Target->GetGUID() == owner->GetGUID())
+ if (Target->GetGUID() == owner->GetGUID())
continue;
m_AllySet.insert(Target->GetGUID());
diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp
index 548349691e9..71b182bd99a 100644
--- a/src/game/PetHandler.cpp
+++ b/src/game/PetHandler.cpp
@@ -47,13 +47,13 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
// used also for charmed creature
Unit* pet= ObjectAccessor::GetUnit(*_player, guid1);
sLog.outDetail("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)) );
- if(!pet)
+ if (!pet)
{
sLog.outError( "Pet %u not exist.", uint32(GUID_LOPART(guid1)) );
return;
}
- if(pet != GetPlayer()->GetFirstControlled())
+ if (pet != GetPlayer()->GetFirstControlled())
{
sLog.outError("HandlePetAction.Pet %u isn't pet of player %s.", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName() );
return;
@@ -63,17 +63,17 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
return;
//TODO: allow control charmed player?
- if(pet->GetTypeId() == TYPEID_PLAYER && !(flag == ACT_COMMAND && spellid == COMMAND_ATTACK))
+ if (pet->GetTypeId() == TYPEID_PLAYER && !(flag == ACT_COMMAND && spellid == COMMAND_ATTACK))
return;
- if(GetPlayer()->m_Controlled.size() == 1)
+ if (GetPlayer()->m_Controlled.size() == 1)
HandlePetActionHelper(pet, guid1, spellid, flag, guid2);
else
{
//If a pet is dismissed, m_Controlled will change
std::vector<Unit*> controlled;
for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
- if((*itr)->GetEntry() == pet->GetEntry() && (*itr)->isAlive())
+ if ((*itr)->GetEntry() == pet->GetEntry() && (*itr)->isAlive())
controlled.push_back(*itr);
for (std::vector<Unit*>::iterator itr = controlled.begin(); itr != controlled.end(); ++itr)
HandlePetActionHelper(*itr, guid1, spellid, flag, guid2);
@@ -83,7 +83,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2)
{
CharmInfo *charmInfo = pet->GetCharmInfo();
- if(!charmInfo)
+ if (!charmInfo)
{
sLog.outError("WorldSession::HandlePetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
return;
@@ -129,29 +129,29 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
// only place where pet can be player
Unit *TargetUnit = ObjectAccessor::GetUnit(*_player, guid2);
- if(!TargetUnit)
+ if (!TargetUnit)
return;
- if(!pet->canAttack(TargetUnit))
+ if (!pet->canAttack(TargetUnit))
return;
// Not let attack through obstructions
- if(sWorld.getConfig(CONFIG_PET_LOS))
+ if (sWorld.getConfig(CONFIG_PET_LOS))
{
- if(!pet->IsWithinLOSInMap(TargetUnit))
+ if (!pet->IsWithinLOSInMap(TargetUnit))
return;
}
pet->clearUnitState(UNIT_STAT_FOLLOW);
// This is true if pet has no target or has target but targets differs.
- if(pet->getVictim() != TargetUnit || ( pet->getVictim() == TargetUnit && !pet->GetCharmInfo()->IsCommandAttack() ))
+ if (pet->getVictim() != TargetUnit || ( pet->getVictim() == TargetUnit && !pet->GetCharmInfo()->IsCommandAttack() ))
{
if (pet->getVictim())
pet->AttackStop();
- if(pet->GetTypeId() != TYPEID_PLAYER && pet->ToCreature()->IsAIEnabled)
+ if (pet->GetTypeId() != TYPEID_PLAYER && pet->ToCreature()->IsAIEnabled)
{
charmInfo->SetIsCommandAttack(true);
charmInfo->SetIsAtStay(false);
@@ -161,7 +161,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
pet->ToCreature()->AI()->AttackStart(TargetUnit);
//10% chance to play special pet attack talk, else growl
- if(pet->ToCreature()->isPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10)
+ if (pet->ToCreature()->isPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10)
pet->SendPetTalk((uint32)PET_TALK_ATTACK);
else
{
@@ -171,7 +171,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
}
else // charmed player
{
- if(pet->getVictim() && pet->getVictim() != TargetUnit)
+ if (pet->getVictim() && pet->getVictim() != TargetUnit)
pet->AttackStop();
charmInfo->SetIsCommandAttack(true);
@@ -186,20 +186,20 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
break;
}
case COMMAND_ABANDON: // abandon (hunter pet) or dismiss (summoned pet)
- if(pet->GetCharmerGUID() == GetPlayer()->GetGUID())
+ if (pet->GetCharmerGUID() == GetPlayer()->GetGUID())
_player->StopCastingCharm();
- else if(pet->GetOwnerGUID() == GetPlayer()->GetGUID())
+ else if (pet->GetOwnerGUID() == GetPlayer()->GetGUID())
{
assert(pet->GetTypeId() == TYPEID_UNIT);
- if(pet->isPet())
+ if (pet->isPet())
{
- if(((Pet*)pet)->getPetType() == HUNTER_PET)
+ if (((Pet*)pet)->getPetType() == HUNTER_PET)
GetPlayer()->RemovePet((Pet*)pet, PET_SAVE_AS_DELETED);
else
//dismissing a summoned pet is like killing them (this prevents returning a soulshard...)
pet->setDeathState(CORPSE);
}
- else if(pet->HasUnitTypeMask(UNIT_MASK_MINION))
+ else if (pet->HasUnitTypeMask(UNIT_MASK_MINION))
{
((Minion*)pet)->UnSummon();
}
@@ -217,7 +217,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
case REACT_DEFENSIVE: //recovery
case REACT_AGGRESSIVE: //activete
- if(pet->GetTypeId() == TYPEID_UNIT)
+ if (pet->GetTypeId() == TYPEID_UNIT)
pet->ToCreature()->SetReactState( ReactStates(spellid) );
break;
}
@@ -228,12 +228,12 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
{
Unit* unit_target = NULL;
- if(guid2)
+ if (guid2)
unit_target = ObjectAccessor::GetUnit(*_player,guid2);
// do not cast unknown spells
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid );
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outError("WORLD: unknown PET spell id %i", spellid);
return;
@@ -245,12 +245,12 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
for (uint32 i = 0; i < 3; ++i)
{
- if(spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENEMY_SRC || spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENEMY_DST || spellInfo->EffectImplicitTargetA[i] == TARGET_DEST_DYNOBJ_ENEMY)
+ if (spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENEMY_SRC || spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENEMY_DST || spellInfo->EffectImplicitTargetA[i] == TARGET_DEST_DYNOBJ_ENEMY)
return;
}
// do not cast not learned spells
- if(!pet->HasSpell(spellid) || IsPassiveSpell(spellid))
+ if (!pet->HasSpell(spellid) || IsPassiveSpell(spellid))
return;
// Clear the flags as if owner clicked 'attack'. AI will reset them
@@ -268,27 +268,27 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
SpellCastResult result = spell->CheckPetCast(unit_target);
//auto turn to target unless possessed
- if(result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->isPossessed() && !pet->IsVehicle())
+ if (result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->isPossessed() && !pet->IsVehicle())
{
- if(unit_target)
+ if (unit_target)
{
pet->SetInFront(unit_target);
if (unit_target->GetTypeId() == TYPEID_PLAYER)
pet->SendUpdateToPlayer( (Player*)unit_target );
}
- else if(Unit *unit_target2 = spell->m_targets.getUnitTarget())
+ else if (Unit *unit_target2 = spell->m_targets.getUnitTarget())
{
pet->SetInFront(unit_target2);
if (unit_target2->GetTypeId() == TYPEID_PLAYER)
pet->SendUpdateToPlayer( (Player*)unit_target2 );
}
if (Unit* powner = pet->GetCharmerOrOwner())
- if(powner->GetTypeId() == TYPEID_PLAYER)
+ if (powner->GetTypeId() == TYPEID_PLAYER)
pet->SendUpdateToPlayer(powner->ToPlayer());
result = SPELL_CAST_OK;
}
- if(result == SPELL_CAST_OK)
+ if (result == SPELL_CAST_OK)
{
pet->ToCreature()->AddCreatureSpellCooldown(spellid);
@@ -296,14 +296,14 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
//10% chance to play special pet attack talk, else growl
//actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
- if(pet->ToCreature()->isPet() && (((Pet*)pet)->getPetType() == SUMMON_PET) && (pet != unit_target) && (urand(0, 100) < 10))
+ if (pet->ToCreature()->isPet() && (((Pet*)pet)->getPetType() == SUMMON_PET) && (pet != unit_target) && (urand(0, 100) < 10))
pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
else
{
pet->SendPetAIReaction(guid1);
}
- if( unit_target && !GetPlayer()->IsFriendlyTo(unit_target) && !pet->isPossessed() && !pet->IsVehicle())
+ if ( unit_target && !GetPlayer()->IsFriendlyTo(unit_target) && !pet->isPossessed() && !pet->IsVehicle())
{
// This is true if pet has no target or has target but targets differs.
if (pet->getVictim() != unit_target)
@@ -320,12 +320,12 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
}
else
{
- if(pet->isPossessed() || pet->IsVehicle())
+ if (pet->isPossessed() || pet->IsVehicle())
Spell::SendCastResult(GetPlayer(),spellInfo,0,result);
else
pet->SendPetCastFail(spellid, result);
- if(!pet->ToCreature()->HasSpellCooldown(spellid))
+ if (!pet->ToCreature()->HasSpellCooldown(spellid))
GetPlayer()->SendClearCooldown(spellid, pet);
spell->finish(false);
@@ -358,7 +358,7 @@ void WorldSession::HandlePetNameQuery( WorldPacket & recv_data )
void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber)
{
Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid);
- if(!pet)
+ if (!pet)
{
WorldPacket data(SMSG_PET_NAME_QUERY_RESPONSE, (4+4+7+1));
data << uint32(petnumber);
@@ -376,7 +376,7 @@ void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber)
data << name.c_str();
data << uint32(pet->GetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP));
- if( pet->isPet() && ((Pet*)pet)->GetDeclinedNames() )
+ if ( pet->isPet() && ((Pet*)pet)->GetDeclinedNames() )
{
data << uint8(1);
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
@@ -399,14 +399,14 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
Unit* pet = ObjectAccessor::GetUnit(*_player, petguid);
- if(!pet || pet != _player->GetFirstControlled())
+ if (!pet || pet != _player->GetFirstControlled())
{
sLog.outError( "HandlePetSetAction: Unknown pet or pet owner." );
return;
}
CharmInfo *charmInfo = pet->GetCharmInfo();
- if(!charmInfo)
+ if (!charmInfo)
{
sLog.outError("WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
return;
@@ -426,7 +426,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
uint8 act_state = UNIT_ACTION_BUTTON_TYPE(data[i]);
//ignore invalid position
- if(position[i] >= MAX_UNIT_ACTION_BAR_INDEX)
+ if (position[i] >= MAX_UNIT_ACTION_BAR_INDEX)
return;
// in the normal case, command and reaction buttons can only be moved, not removed
@@ -445,7 +445,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
if (move_command)
{
uint8 act_state_0 = UNIT_ACTION_BUTTON_TYPE(data[0]);
- if(act_state_0 == ACT_COMMAND || act_state_0 == ACT_REACTION)
+ if (act_state_0 == ACT_COMMAND || act_state_0 == ACT_REACTION)
{
uint32 spell_id_0 = UNIT_ACTION_BUTTON_ACTION(data[0]);
UnitActionBarEntry const* actionEntry_1 = charmInfo->GetActionBarEntry(position[1]);
@@ -455,7 +455,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
}
uint8 act_state_1 = UNIT_ACTION_BUTTON_TYPE(data[1]);
- if(act_state_1 == ACT_COMMAND || act_state_1 == ACT_REACTION)
+ if (act_state_1 == ACT_COMMAND || act_state_1 == ACT_REACTION)
{
uint32 spell_id_1 = UNIT_ACTION_BUTTON_ACTION(data[1]);
UnitActionBarEntry const* actionEntry_0 = charmInfo->GetActionBarEntry(position[0]);
@@ -473,20 +473,20 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
sLog.outDetail( "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position[i], spell_id, uint32(act_state));
//if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add
- if(!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id)))
+ if (!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id)))
{
//sign for autocast
- if(act_state == ACT_ENABLED && spell_id)
+ if (act_state == ACT_ENABLED && spell_id)
{
- if(pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isPet())
+ if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isPet())
((Pet*)pet)->ToggleAutocast(spell_id, true);
else
charmInfo->ToggleCreatureAutocast(spell_id, true);
}
//sign for no/turn off autocast
- else if(act_state == ACT_DISABLED && spell_id)
+ else if (act_state == ACT_DISABLED && spell_id)
{
- if(pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isPet())
+ if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isPet())
((Pet*)pet)->ToggleAutocast(spell_id, false);
else
charmInfo->ToggleCreatureAutocast(spell_id, false);
@@ -514,19 +514,19 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data )
Pet* pet = ObjectAccessor::GetPet(petguid);
// check it!
- if( !pet || !pet->isPet() || ((Pet*)pet)->getPetType()!= HUNTER_PET ||
+ if ( !pet || !pet->isPet() || ((Pet*)pet)->getPetType()!= HUNTER_PET ||
!pet->HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ||
pet->GetOwnerGUID() != _player->GetGUID() || !pet->GetCharmInfo() )
return;
PetNameInvalidReason res = ObjectMgr::CheckPetName(name);
- if(res != PET_NAME_SUCCESS)
+ if (res != PET_NAME_SUCCESS)
{
SendPetNameInvalid(res, name, NULL);
return;
}
- if(objmgr.IsReservedName(name))
+ if (objmgr.IsReservedName(name))
{
SendPetNameInvalid(PET_NAME_RESERVED, name, NULL);
return;
@@ -535,12 +535,12 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data )
pet->SetName(name);
Unit *owner = pet->GetOwner();
- if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup())
+ if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup())
owner->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_NAME);
pet->RemoveByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED);
- if(isdeclined)
+ if (isdeclined)
{
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
@@ -549,7 +549,7 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data )
std::wstring wname;
Utf8toWStr(name, wname);
- if(!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname,0),declinedname))
+ if (!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname,0),declinedname))
{
SendPetNameInvalid(PET_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME, name, &declinedname);
return;
@@ -557,7 +557,7 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data )
}
CharacterDatabase.BeginTransaction();
- if(isdeclined)
+ if (isdeclined)
{
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
CharacterDatabase.escape_string(declinedname.name[i]);
@@ -579,16 +579,16 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
recv_data >> guid; //pet guid
sLog.outDetail( "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid) );
- if(!_player->IsInWorld())
+ if (!_player->IsInWorld())
return;
// pet/charmed
Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
- if(pet)
+ if (pet)
{
- if(pet->isPet())
+ if (pet->isPet())
{
- if(pet->GetGUID() == _player->GetPetGUID())
+ if (pet->GetGUID() == _player->GetPetGUID())
{
uint32 feelty = pet->GetPower(POWER_HAPPINESS);
pet->SetPower(POWER_HAPPINESS ,(feelty-50000) > 0 ?(feelty-50000) : 0);
@@ -596,7 +596,7 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
_player->RemovePet((Pet*)pet,PET_SAVE_AS_DELETED);
}
- else if(pet->GetGUID() == _player->GetCharmGUID())
+ else if (pet->GetGUID() == _player->GetCharmGUID())
_player->StopCastingCharm();
}
}
@@ -609,32 +609,32 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
uint8 state; //1 for on, 0 for off
recvPacket >> guid >> spellid >> state;
- if(!_player->GetGuardianPet() && !_player->GetCharm())
+ if (!_player->GetGuardianPet() && !_player->GetCharm())
return;
- if(ObjectAccessor::FindPlayer(guid))
+ if (ObjectAccessor::FindPlayer(guid))
return;
Creature* pet=ObjectAccessor::GetCreatureOrPetOrVehicle(*_player,guid);
- if(!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharm()))
+ if (!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharm()))
{
sLog.outError( "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );
return;
}
// do not add not learned spells/ passive spells
- if(!pet->HasSpell(spellid) || IsAutocastableSpell(spellid))
+ if (!pet->HasSpell(spellid) || IsAutocastableSpell(spellid))
return;
CharmInfo *charmInfo = pet->GetCharmInfo();
- if(!charmInfo)
+ if (!charmInfo)
{
sLog.outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
return;
}
- if(pet->isPet())
+ if (pet->isPet())
((Pet*)pet)->ToggleAutocast(spellid, state);
else
pet->GetCharmInfo()->ToggleCreatureAutocast(spellid, state);
@@ -656,19 +656,19 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
sLog.outDebug("WORLD: CMSG_PET_CAST_SPELL, cast_count: %u, spellid %u, unk_flags %u", cast_count, spellid, unk_flags);
// This opcode is also sent from charmed and possessed units (players and creatures)
- if(!_player->GetGuardianPet() && !_player->GetCharm())
+ if (!_player->GetGuardianPet() && !_player->GetCharm())
return;
Unit* caster = ObjectAccessor::GetUnit(*_player, guid);
- if(!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm()))
+ if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm()))
{
sLog.outError( "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );
return;
}
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outError("WORLD: unknown PET spell id %i", spellid);
return;
@@ -682,11 +682,11 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
}
// do not cast not learned spells
- if(!caster->HasSpell(spellid) || IsPassiveSpell(spellid))
+ if (!caster->HasSpell(spellid) || IsPassiveSpell(spellid))
return;
SpellCastTargets targets;
- if(!targets.read(&recvPacket,caster))
+ if (!targets.read(&recvPacket,caster))
return;
caster->clearUnitState(UNIT_STAT_FOLLOW);
@@ -697,22 +697,22 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
// TODO: need to check victim?
SpellCastResult result;
- if(caster->m_movedPlayer)
+ if (caster->m_movedPlayer)
result = spell->CheckPetCast(caster->m_movedPlayer->GetSelectedUnit());
else
result = spell->CheckPetCast(NULL);
- if(result == SPELL_CAST_OK)
+ if (result == SPELL_CAST_OK)
{
- if(caster->GetTypeId() == TYPEID_UNIT)
+ if (caster->GetTypeId() == TYPEID_UNIT)
{
Creature* pet = caster->ToCreature();
pet->AddCreatureSpellCooldown(spellid);
- if(pet->isPet())
+ if (pet->isPet())
{
Pet* p = (Pet*)pet;
// 10% chance to play special pet attack talk, else growl
// actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
- if(p->getPetType() == SUMMON_PET && (urand(0, 100) < 10))
+ if (p->getPetType() == SUMMON_PET && (urand(0, 100) < 10))
pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
else
pet->SendPetAIReaction(guid);
@@ -724,14 +724,14 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
else
{
caster->SendPetCastFail(spellid, result);
- if(caster->GetTypeId() == TYPEID_PLAYER)
+ if (caster->GetTypeId() == TYPEID_PLAYER)
{
- if(!caster->ToPlayer()->HasSpellCooldown(spellid))
+ if (!caster->ToPlayer()->HasSpellCooldown(spellid))
GetPlayer()->SendClearCooldown(spellid, caster);
}
else
{
- if(!caster->ToCreature()->HasSpellCooldown(spellid))
+ if (!caster->ToCreature()->HasSpellCooldown(spellid))
GetPlayer()->SendClearCooldown(spellid, caster);
}
@@ -745,7 +745,7 @@ void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, Dec
WorldPacket data(SMSG_PET_NAME_INVALID, 4 + name.size() + 1 + 1);
data << uint32(error);
data << name;
- if(declinedName)
+ if (declinedName)
{
data << uint8(1);
for (uint32 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp
index 76582672adb..cc6775ea65d 100644
--- a/src/game/PetitionsHandler.cpp
+++ b/src/game/PetitionsHandler.cpp
@@ -90,17 +90,17 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
uint32 charterid = 0;
uint32 cost = 0;
uint32 type = 0;
- if(pCreature->isTabardDesigner())
+ if (pCreature->isTabardDesigner())
{
// if tabard designer, then trying to buy a guild charter.
// do not let if already in guild.
- if(_player->GetGuildId())
+ if (_player->GetGuildId())
return;
charterid = GUILD_CHARTER;
@@ -110,7 +110,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
else
{
// TODO: find correct opcode
- if(_player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
+ if (_player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
{
SendNotification(LANG_ARENA_ONE_TOOLOW, sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL));
return;
@@ -138,21 +138,21 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
return;
}
- if(_player->GetArenaTeamId(clientIndex - 1)) // arenaSlot+1 as received from client
+ if (_player->GetArenaTeamId(clientIndex - 1)) // arenaSlot+1 as received from client
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM);
return;
}
}
- if(type == 9)
+ if (type == 9)
{
- if(objmgr.GetGuildByName(name))
+ if (objmgr.GetGuildByName(name))
{
SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_EXISTS);
return;
}
- if(objmgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name))
+ if (objmgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name))
{
SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_INVALID);
return;
@@ -160,12 +160,12 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
}
else
{
- if(objmgr.GetArenaTeamByName(name))
+ if (objmgr.GetArenaTeamByName(name))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S);
return;
}
- if(objmgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name))
+ if (objmgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_INVALID);
return;
@@ -173,13 +173,13 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
}
ItemPrototype const *pProto = objmgr.GetItemPrototype(charterid);
- if(!pProto)
+ if (!pProto)
{
_player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, charterid, 0);
return;
}
- if(_player->GetMoney() < cost)
+ if (_player->GetMoney() < cost)
{ //player hasn't got enough money
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, charterid, 0);
return;
@@ -187,7 +187,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
ItemPosCountVec dest;
uint8 msg = _player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, charterid, pProto->BuyCount );
- if(msg != EQUIP_ERR_OK)
+ if (msg != EQUIP_ERR_OK)
{
_player->SendBuyError(msg, pCreature, charterid, 0);
return;
@@ -195,7 +195,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
_player->ModifyMoney(-(int32)cost);
Item *charter = _player->StoreNewItem(dest, charterid, true);
- if(!charter)
+ if (!charter)
return;
charter->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1, charter->GetGUIDLow());
@@ -247,7 +247,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
uint32 petitionguid_low = GUID_LOPART(petitionguid);
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", petitionguid_low);
- if(!result)
+ if (!result)
{
sLog.outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName());
return;
@@ -256,13 +256,13 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
uint32 type = fields[0].GetUInt32();
// if guild petition and has guild => error, return;
- if(type==9 && _player->GetGuildId())
+ if (type==9 && _player->GetGuildId())
return;
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", petitionguid_low);
// result==NULL also correct in case no sign yet
- if(result)
+ if (result)
signs = result->GetRowCount();
sLog.outDebug("CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionguid_low);
@@ -313,7 +313,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
" type "
"FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid), GUID_LOPART(petitionguid));
- if(result)
+ if (result)
{
Field* fields = result->Fetch();
ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
@@ -332,7 +332,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
data << uint64(ownerguid); // charter owner guid
data << name; // name (guild/arena team)
data << uint8(0); // some string
- if(type == 9)
+ if (type == 9)
{
data << uint32(9);
data << uint32(9);
@@ -358,7 +358,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
data << uint32(0); // 14
- if(type == 9)
+ if (type == 9)
data << uint32(0); // 15 0 - guild, 1 - arena team
else
data << uint32(1);
@@ -379,12 +379,12 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
recv_data >> newname; // new name
Item *item = _player->GetItemByGuid(petitionguid);
- if(!item)
+ if (!item)
return;
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
- if(result)
+ if (result)
{
Field* fields = result->Fetch();
type = fields[0].GetUInt32();
@@ -395,14 +395,14 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
return;
}
- if(type == 9)
+ if (type == 9)
{
- if(objmgr.GetGuildByName(newname))
+ if (objmgr.GetGuildByName(newname))
{
SendGuildCommandResult(GUILD_CREATE_S, newname, GUILD_NAME_EXISTS);
return;
}
- if(objmgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname))
+ if (objmgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname))
{
SendGuildCommandResult(GUILD_CREATE_S, newname, GUILD_NAME_INVALID);
return;
@@ -410,12 +410,12 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
}
else
{
- if(objmgr.GetArenaTeamByName(newname))
+ if (objmgr.GetArenaTeamByName(newname))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, newname, "", ERR_ARENA_TEAM_NAME_EXISTS_S);
return;
}
- if(objmgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname))
+ if (objmgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, newname, "", ERR_ARENA_TEAM_NAME_INVALID);
return;
@@ -451,7 +451,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
" type "
"FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid), GUID_LOPART(petitionguid));
- if(!result)
+ if (!result)
{
sLog.outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName());
return;
@@ -463,38 +463,38 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
uint32 type = fields[2].GetUInt32();
uint32 plguidlo = _player->GetGUIDLow();
- if(GUID_LOPART(ownerguid) == plguidlo)
+ if (GUID_LOPART(ownerguid) == plguidlo)
return;
// not let enemies sign guild charter
- if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != objmgr.GetPlayerTeamByGUID(ownerguid))
+ if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != objmgr.GetPlayerTeamByGUID(ownerguid))
{
- if(type != 9)
+ if (type != 9)
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
else
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_NOT_ALLIED);
return;
}
- if(type != 9)
+ if (type != 9)
{
- if(_player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
+ if (_player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName(), ERR_ARENA_TEAM_PLAYER_TO_LOW);
return;
}
uint8 slot = ArenaTeam::GetSlotByType(type);
- if(slot >= MAX_ARENA_SLOT)
+ if (slot >= MAX_ARENA_SLOT)
return;
- if(_player->GetArenaTeamId(slot))
+ if (_player->GetArenaTeamId(slot))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_IN_ARENA_TEAM_S);
return;
}
- if(_player->GetArenaTeamIdInvited())
+ if (_player->GetArenaTeamIdInvited())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S);
return;
@@ -502,26 +502,26 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
}
else
{
- if(_player->GetGuildId())
+ if (_player->GetGuildId())
{
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ALREADY_IN_GUILD);
return;
}
- if(_player->GetGuildIdInvited())
+ if (_player->GetGuildIdInvited())
{
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ALREADY_INVITED_TO_GUILD);
return;
}
}
- if(++signs > type) // client signs maximum
+ if (++signs > type) // client signs maximum
return;
//client doesn't allow to sign petition two times by one character, but not check sign by another character from same account
//not allow sign another player from already sign player account
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE player_account = '%u' AND petitionguid = '%u'", GetAccountId(), GUID_LOPART(petitionguid));
- if(result)
+ if (result)
{
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4));
data << petitionguid;
@@ -532,7 +532,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
SendPacket(&data);
// update for owner if online
- if(Player *owner = objmgr.GetPlayer(ownerguid))
+ if (Player *owner = objmgr.GetPlayer(ownerguid))
owner->GetSession()->SendPacket(&data);
return;
}
@@ -551,11 +551,11 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
// update signs count on charter, required testing...
//Item *item = _player->GetItemByGuid(petitionguid));
- //if(item)
+ //if (item)
// item->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1+1, signs);
// update for owner if online
- if(Player *owner = objmgr.GetPlayer(ownerguid))
+ if (Player *owner = objmgr.GetPlayer(ownerguid))
owner->GetSession()->SendPacket(&data);
}
@@ -570,14 +570,14 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data)
sLog.outDebug("Petition %u declined by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow());
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT ownerguid FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
- if(!result)
+ if (!result)
return;
Field *fields = result->Fetch();
ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
Player *owner = objmgr.GetPlayer(ownerguid);
- if(owner) // petition owner online
+ if (owner) // petition owner online
{
WorldPacket data(MSG_PETITION_DECLINE, 8);
data << _player->GetGUID();
@@ -613,16 +613,16 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != player->GetTeam() )
{
- if(type != 9)
+ if (type != 9)
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
else
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_NOT_ALLIED);
return;
}
- if(type != 9)
+ if (type != 9)
{
- if(player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
+ if (player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
{
// player is too low level to join an arena team
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName(), "", ERR_ARENA_TEAM_PLAYER_TO_LOW);
@@ -630,17 +630,17 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
}
uint8 slot = ArenaTeam::GetSlotByType(type);
- if(slot >= MAX_ARENA_SLOT)
+ if (slot >= MAX_ARENA_SLOT)
return;
- if(player->GetArenaTeamId(slot))
+ if (player->GetArenaTeamId(slot))
{
// player is already in an arena team
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName(), "", ERR_ALREADY_IN_ARENA_TEAM_S);
return;
}
- if(player->GetArenaTeamIdInvited())
+ if (player->GetArenaTeamIdInvited())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S);
return;
@@ -648,13 +648,13 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
}
else
{
- if(player->GetGuildId())
+ if (player->GetGuildId())
{
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ALREADY_IN_GUILD);
return;
}
- if(player->GetGuildIdInvited())
+ if (player->GetGuildIdInvited())
{
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ALREADY_INVITED_TO_GUILD);
return;
@@ -663,7 +663,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
// result==NULL also correct charter without signs
- if(result)
+ if (result)
signs = result->GetRowCount();
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12));
@@ -704,7 +704,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
// data
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT ownerguid, name, type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
- if(result)
+ if (result)
{
Field *fields = result->Fetch();
ownerguidlo = fields[0].GetUInt32();
@@ -717,9 +717,9 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
return;
}
- if(type == 9)
+ if (type == 9)
{
- if(_player->GetGuildId())
+ if (_player->GetGuildId())
{
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
data << (uint32)PETITION_TURN_ALREADY_IN_GUILD; // already in guild
@@ -730,10 +730,10 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
else
{
uint8 slot = ArenaTeam::GetSlotByType(type);
- if(slot >= MAX_ARENA_SLOT)
+ if (slot >= MAX_ARENA_SLOT)
return;
- if(_player->GetArenaTeamId(slot))
+ if (_player->GetArenaTeamId(slot))
{
//data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
//data << (uint32)PETITION_TURN_ALREADY_IN_GUILD; // already in guild
@@ -743,24 +743,24 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
}
}
- if(_player->GetGUIDLow() != ownerguidlo)
+ if (_player->GetGUIDLow() != ownerguidlo)
return;
// signs
uint8 signs;
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
- if(result)
+ if (result)
signs = result->GetRowCount();
else
signs = 0;
uint32 count;
- //if(signs < sWorld.getConfig(CONFIG_MIN_PETITION_SIGNS))
- if(type == 9)
+ //if (signs < sWorld.getConfig(CONFIG_MIN_PETITION_SIGNS))
+ if (type == 9)
count = sWorld.getConfig(CONFIG_MIN_PETITION_SIGNS);
else
count = type-1;
- if(signs < count)
+ if (signs < count)
{
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
data << (uint32)PETITION_TURN_NEED_MORE_SIGNATURES; // need more signatures...
@@ -768,9 +768,9 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
return;
}
- if(type == 9)
+ if (type == 9)
{
- if(objmgr.GetGuildByName(name))
+ if (objmgr.GetGuildByName(name))
{
SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_EXISTS);
return;
@@ -778,7 +778,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
}
else
{
- if(objmgr.GetArenaTeamByName(name))
+ if (objmgr.GetArenaTeamByName(name))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S);
return;
@@ -787,7 +787,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
// and at last charter item check
Item *item = _player->GetItemByGuid(petitionguid);
- if(!item)
+ if (!item)
return;
// OK!
@@ -795,10 +795,10 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
// delete charter item
_player->DestroyItem(item->GetBagSlot(),item->GetSlot(), true);
- if(type == 9) // create guild
+ if (type == 9) // create guild
{
Guild* guild = new Guild;
- if(!guild->Create(_player, name))
+ if (!guild->Create(_player, name))
{
delete guild;
return;
@@ -818,7 +818,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
else // or arena team
{
ArenaTeam* at = new ArenaTeam;
- if(!at->Create(_player->GetGUID(), type, name))
+ if (!at->Create(_player->GetGUID(), type, name))
{
sLog.outError("PetitionsHandler: arena team create failed.");
delete at;
@@ -879,11 +879,11 @@ void WorldSession::SendPetitionShowList(uint64 guid)
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
uint8 count = 0;
- if(pCreature->isTabardDesigner())
+ if (pCreature->isTabardDesigner())
count = 1;
else
count = 3;
@@ -891,7 +891,7 @@ void WorldSession::SendPetitionShowList(uint64 guid)
WorldPacket data(SMSG_PETITION_SHOWLIST, 8+1+4*6);
data << guid; // npc guid
data << count; // count
- if(count == 1)
+ if (count == 1)
{
data << uint32(1); // index
data << uint32(GUILD_CHARTER); // charter entry
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 63bdbc51c9f..8ef25a4fc7d 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -178,7 +178,7 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level
case HORDE: SetTaximaskNode(99); break;
}
// level dependent taxi hubs
- if(level>=68)
+ if (level>=68)
SetTaximaskNode(213); //Shattered Sun Staging Area
}
@@ -198,7 +198,7 @@ void PlayerTaxi::LoadTaxiMask(const char* data)
void PlayerTaxi::AppendTaximaskTo( ByteBuffer& data, bool all )
{
- if(all)
+ if (all)
{
for (uint8 i=0; i<TaxiMaskSize; i++)
data << uint32(sTaxiNodesMask[i]); // all existed nodes
@@ -222,11 +222,11 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString( const std::string& values, uint
AddTaxiDestination(node);
}
- if(m_TaxiDestinations.empty())
+ if (m_TaxiDestinations.empty())
return true;
// Check integrity
- if(m_TaxiDestinations.size() < 2)
+ if (m_TaxiDestinations.size() < 2)
return false;
for (size_t i = 1; i < m_TaxiDestinations.size(); ++i)
@@ -234,12 +234,12 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString( const std::string& values, uint
uint32 cost;
uint32 path;
objmgr.GetTaxiPath(m_TaxiDestinations[i-1],m_TaxiDestinations[i],path,cost);
- if(!path)
+ if (!path)
return false;
}
// can't load taxi path without mount set (quest taxi path?)
- if(!objmgr.GetTaxiMountDisplayId(GetTaxiSource(),team,true))
+ if (!objmgr.GetTaxiMountDisplayId(GetTaxiSource(),team,true))
return false;
return true;
@@ -247,7 +247,7 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString( const std::string& values, uint
std::string PlayerTaxi::SaveTaxiDestinationsToString()
{
- if(m_TaxiDestinations.empty())
+ if (m_TaxiDestinations.empty())
return "";
std::ostringstream ss;
@@ -260,7 +260,7 @@ std::string PlayerTaxi::SaveTaxiDestinationsToString()
uint32 PlayerTaxi::GetCurrentTaxiPath() const
{
- if(m_TaxiDestinations.size() < 2)
+ if (m_TaxiDestinations.size() < 2)
return 0;
uint32 path;
@@ -304,7 +304,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
//m_pad = 0;
// players always accept
- if(GetSession()->GetSecurity() == SEC_PLAYER)
+ if (GetSession()->GetSecurity() == SEC_PLAYER)
SetAcceptWhispers(true);
m_curSelection = 0;
@@ -508,7 +508,7 @@ Player::~Player ()
// Note: buy back item already deleted from DB when player was saved
for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; ++i)
{
- if(m_items[i])
+ if (m_items[i])
delete m_items[i];
}
@@ -532,7 +532,7 @@ Player::~Player ()
delete PlayerTalkClass;
for (size_t x = 0; x < ItemSetEff.size(); x++)
- if(ItemSetEff[x])
+ if (ItemSetEff[x])
delete ItemSetEff[x];
delete m_declinedname;
@@ -566,7 +566,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
m_name = name;
PlayerInfo const* info = objmgr.GetPlayerInfo(race, class_);
- if(!info)
+ if (!info)
{
sLog.outError("Player have incorrect race/class pair. Can't be loaded.");
return false;
@@ -578,7 +578,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
Relocate(info->positionX,info->positionY,info->positionZ);
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(class_);
- if(!cEntry)
+ if (!cEntry)
{
sLog.outError("Class %u not found in DBC (Wrong DBC files?)",class_);
return false;
@@ -597,7 +597,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
SetUInt32Value(UNIT_FIELD_BYTES_0, ( RaceClassGender | ( powertype << 24 ) ) );
InitDisplayIds();
- if(sWorld.getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || sWorld.getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP)
+ if (sWorld.getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || sWorld.getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP)
{
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP );
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE );
@@ -634,7 +634,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
if (GetSession()->GetSecurity() >= SEC_MODERATOR)
{
uint32 gm_level = sWorld.getConfig(CONFIG_START_GM_LEVEL);
- if(gm_level > start_level)
+ if (gm_level > start_level)
start_level = gm_level;
}
@@ -647,14 +647,14 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
SetUInt32Value (PLAYER_FIELD_ARENA_CURRENCY, sWorld.getConfig(CONFIG_START_ARENA_POINTS));
// start with every map explored
- if(sWorld.getConfig(CONFIG_START_ALL_EXPLORED))
+ if (sWorld.getConfig(CONFIG_START_ALL_EXPLORED))
{
for (uint8 i=0; i<64; i++)
SetFlag(PLAYER_EXPLORED_ZONES_1+i,0xFFFFFFFF);
}
//Reputations if "StartAllReputation" is enabled, -- TODO: Fix this in a better way
- if(sWorld.getConfig(CONFIG_START_ALL_REP))
+ if (sWorld.getConfig(CONFIG_START_ALL_REP))
{
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(942),42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(935),42999);
@@ -717,7 +717,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
SetPower(POWER_MANA,GetMaxPower(POWER_MANA));
}
- if(getPowerType() == POWER_RUNIC_POWER)
+ if (getPowerType() == POWER_RUNIC_POWER)
{
SetPower(POWER_RUNE, 8);
SetMaxPower(POWER_RUNE, 8);
@@ -736,9 +736,9 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
CharStartOutfitEntry const* oEntry = NULL;
for (uint32 i = 1; i < sCharStartOutfitStore.GetNumRows(); ++i)
{
- if(CharStartOutfitEntry const* entry = sCharStartOutfitStore.LookupEntry(i))
+ if (CharStartOutfitEntry const* entry = sCharStartOutfitStore.LookupEntry(i))
{
- if(entry->RaceClassGender == RaceClassGender)
+ if (entry->RaceClassGender == RaceClassGender)
{
oEntry = entry;
break;
@@ -746,11 +746,11 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
}
}
- if(oEntry)
+ if (oEntry)
{
for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j)
{
- if(oEntry->ItemId[j] <= 0)
+ if (oEntry->ItemId[j] <= 0)
continue;
uint32 item_id = oEntry->ItemId[j];
@@ -764,7 +764,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
uint32 count = iProto->BuyCount;
// special amount for food/drink
- if(iProto->Class==ITEM_CLASS_CONSUMABLE && iProto->SubClass==ITEM_SUBCLASS_FOOD)
+ if (iProto->Class==ITEM_CLASS_CONSUMABLE && iProto->SubClass==ITEM_SUBCLASS_FOOD)
{
switch(iProto->Spells[0].SpellCategory)
{
@@ -775,11 +775,11 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
count = 2;
break;
}
- if(iProto->Stackable < count)
+ if (iProto->Stackable < count)
count = iProto->Stackable;
}
// special amount for daggers
- else if(iProto->Class==ITEM_CLASS_WEAPON && iProto->SubClass==ITEM_SUBCLASS_WEAPON_DAGGER)
+ else if (iProto->Class==ITEM_CLASS_WEAPON && iProto->SubClass==ITEM_SUBCLASS_WEAPON_DAGGER)
{
count = 2; // will placed to 2 slots
}
@@ -796,12 +796,12 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
// or ammo not equipped in special bag
for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++)
{
- if(Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
+ if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
{
uint16 eDest;
// equip offhand weapon/shield if it attempt equipped before main-hand weapon
uint8 msg = CanEquipItem( NULL_SLOT, eDest, pItem, false );
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
{
RemoveItem(INVENTORY_SLOT_BAG_0, i,true);
EquipItem( eDest, pItem, true);
@@ -811,7 +811,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
{
ItemPosCountVec sDest;
msg = CanStoreItem( NULL_BAG, NULL_SLOT, sDest, pItem, false );
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
{
RemoveItem(INVENTORY_SLOT_BAG_0, i,true);
pItem = StoreItem( sDest, pItem, true);
@@ -819,7 +819,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
// if this is ammo then use it
msg = CanUseAmmo( pItem->GetEntry() );
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
SetAmmo( pItem->GetEntry() );
}
}
@@ -838,7 +838,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
{
uint16 eDest;
uint8 msg = CanEquipNewItem( NULL_SLOT, eDest, titem_id, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
break;
EquipNewItem( eDest, titem_id, true);
@@ -846,14 +846,14 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
--titem_amount;
}
- if(titem_amount == 0)
+ if (titem_amount == 0)
return true; // equipped
// attempt store
ItemPosCountVec sDest;
// store in main bag to simplify second pass (special bags can be not equipped yet at this moment)
uint8 msg = CanStoreNewItem( INVENTORY_SLOT_BAG_0, NULL_SLOT, sDest, titem_id, titem_amount );
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
{
StoreNewItem( sDest, titem_id, true, Item::GenerateItemRandomPropertyId(titem_id) );
return true; // stored
@@ -892,7 +892,7 @@ void Player::StopMirrorTimer(MirrorTimerType Type)
uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
{
- if(!isAlive() || isGameMaster())
+ if (!isAlive() || isGameMaster())
return 0;
// Absorb, resist some environmental damage type
@@ -917,9 +917,9 @@ uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
uint32 final_damage = DealDamage(this, damage, NULL, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
- if(!isAlive())
+ if (!isAlive())
{
- if(type==DAMAGE_FALL) // DealDamage not apply item durability loss at self damage
+ if (type==DAMAGE_FALL) // DealDamage not apply item durability loss at self damage
{
DEBUG_LOG("We are fall to death, loosing 10 percents durability");
DurabilityLossAll(0.10f,false);
@@ -1094,11 +1094,11 @@ void Player::HandleSobering()
DrunkenState Player::GetDrunkenstateByValue(uint16 value)
{
- if(value >= 23000)
+ if (value >= 23000)
return DRUNKEN_SMASHED;
- if(value >= 12800)
+ if (value >= 12800)
return DRUNKEN_DRUNK;
- if(value & 0xFFFE)
+ if (value & 0xFFFE)
return DRUNKEN_TIPSY;
return DRUNKEN_SOBER;
}
@@ -1113,12 +1113,12 @@ void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId)
uint32 newDrunkenState = Player::GetDrunkenstateByValue(m_drunk);
// special drunk invisibility detection
- if(newDrunkenState >= DRUNKEN_DRUNK)
+ if (newDrunkenState >= DRUNKEN_DRUNK)
m_detectInvisibilityMask |= (1<<6);
else
m_detectInvisibilityMask &= ~(1<<6);
- if(newDrunkenState == oldDrunkenState)
+ if (newDrunkenState == oldDrunkenState)
return;
WorldPacket data(SMSG_CROSSED_INEBRIATION_THRESHOLD, (8+4+4));
@@ -1150,7 +1150,7 @@ void Player::Update( uint32 p_time )
if (/*m_pad ||*/ m_spellModTakingSpell)
{
//sLog.outCrash("Player has m_pad %u during update!", m_pad);
- //if(m_spellModTakingSpell)
+ //if (m_spellModTakingSpell)
sLog.outCrash("Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id);
return;
m_spellModTakingSpell = NULL;
@@ -1267,7 +1267,7 @@ void Player::Update( uint32 p_time )
/*Unit *owner = pVictim->GetOwner();
Unit *u = owner ? owner : pVictim;
- if(u->IsPvP() && (!duel || duel->opponent != u))
+ if (u->IsPvP() && (!duel || duel->opponent != u))
{
UpdatePvP(true);
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
@@ -1323,7 +1323,7 @@ void Player::Update( uint32 p_time )
if (m_timeSyncTimer > 0)
{
- if(p_time >= m_timeSyncTimer)
+ if (p_time >= m_timeSyncTimer)
SendTimeSync();
else
m_timeSyncTimer -= p_time;
@@ -1383,9 +1383,9 @@ void Player::Update( uint32 p_time )
}
// not auto-free ghost from body in instances
- if(m_deathTimer > 0 && !GetBaseMap()->Instanceable())
+ if (m_deathTimer > 0 && !GetBaseMap()->Instanceable())
{
- if(p_time >= m_deathTimer)
+ if (p_time >= m_deathTimer)
{
m_deathTimer = 0;
BuildPlayerRepop();
@@ -1403,7 +1403,7 @@ void Player::Update( uint32 p_time )
Pet* pet = GetPet();
if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && !pet->isPossessed())
- //if(pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGUID() && (pet->GetGUID() != GetCharmGUID())))
+ //if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGUID() && (pet->GetGUID() != GetCharmGUID())))
RemovePet(pet, PET_SAVE_NOT_IN_SLOT, true);
//we should execute delayed teleports only for alive(!) players
@@ -1443,7 +1443,7 @@ void Player::setDeathState(DeathState s)
ressSpellId = GetUInt32Value(PLAYER_SELF_RES_SPELL);
// passive spell
- if(!ressSpellId)
+ if (!ressSpellId)
ressSpellId = GetResurrectionSpellId();
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP, 1);
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH, 1);
@@ -1682,13 +1682,13 @@ void Player::TeleportOutOfMap(Map *oldMap)
bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options)
{
- if(!MapManager::IsValidMapCoord(mapid, x, y, z, orientation))
+ if (!MapManager::IsValidMapCoord(mapid, x, y, z, orientation))
{
sLog.outError("TeleportTo: invalid map %d or absent instance template.", mapid);
return false;
}
- if((GetSession()->GetSecurity() < SEC_GAMEMASTER) && !sWorld.IsAllowedMap(mapid))
+ if ((GetSession()->GetSecurity() < SEC_GAMEMASTER) && !sWorld.IsAllowedMap(mapid))
{
sLog.outError("Player %s tried to enter a forbidden map", GetName());
return false;
@@ -1754,7 +1754,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
SetDelayedTeleportFlag(IsCanDelayTeleport());
//if teleport spell is casted in Unit::Update() func
//then we need to delay it until update process will be finished
- if(IsHasDelayedTeleport())
+ if (IsHasDelayedTeleport())
{
SetSemaphoreTeleportNear(true);
//lets save teleport destination for player
@@ -1766,7 +1766,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
if (!(options & TELE_TO_NOT_UNSUMMON_PET))
{
//same map, only remove pet if out of range for new position
- if(pet && !pet->IsWithinDist3d(x,y,z, GetMap()->GetVisibilityDistance()))
+ if (pet && !pet->IsWithinDist3d(x,y,z, GetMap()->GetVisibilityDistance()))
UnsummonPetTemporaryIfAny();
}
@@ -1781,7 +1781,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// at client packet MSG_MOVE_TELEPORT_ACK
SetSemaphoreTeleportNear(true);
// near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing
- if(!GetSession()->PlayerLogout())
+ if (!GetSession()->PlayerLogout())
{
Position oldPos;
GetPosition(&oldPos);
@@ -1815,7 +1815,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
SetDelayedTeleportFlag(IsCanDelayTeleport());
//if teleport spell is casted in Unit::Update() func
//then we need to delay it until update process will be finished
- if(IsHasDelayedTeleport())
+ if (IsHasDelayedTeleport())
{
SetSemaphoreTeleportFar(true);
//lets save teleport destination for player
@@ -1831,7 +1831,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
ResetContestedPvP();
// remove player from battleground on far teleport (when changing maps)
- if(BattleGround const* bg = GetBattleGround())
+ if (BattleGround const* bg = GetBattleGround())
{
// Note: at battleground join battleground id set before teleport
// and we already will found "current" battleground
@@ -1849,8 +1849,8 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// stop spellcasting
// not attempt interrupt teleportation spell at caster teleport
- if(!(options & TELE_TO_SPELL))
- if(IsNonMeleeSpellCasted(true))
+ if (!(options & TELE_TO_SPELL))
+ if (IsNonMeleeSpellCasted(true))
InterruptNonMeleeSpells(true);
//remove auras before removing from map...
@@ -1878,7 +1878,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
}
// remove from old map now
- if(oldmap)
+ if (oldmap)
oldmap->Remove(this, false);
// new final coordinates
@@ -1981,14 +1981,14 @@ void Player::AddToWorld()
Unit::AddToWorld();
for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
- if(m_items[i])
+ if (m_items[i])
m_items[i]->AddToWorld();
}
void Player::RemoveFromWorld()
{
// cleanup
- if(IsInWorld())
+ if (IsInWorld())
{
///- Release charmed creatures, unsummon totems and remove pets/guardians
StopCastingCharm();
@@ -2033,15 +2033,15 @@ void Player::RegenerateAll()
Regenerate(POWER_MANA);
// Runes act as cooldowns, and they don't need to send any data
- if(getClass() == CLASS_DEATH_KNIGHT)
+ if (getClass() == CLASS_DEATH_KNIGHT)
for (uint32 i = 0; i < MAX_RUNES; ++i)
- if(uint32 cd = GetRuneCooldown(i))
+ if (uint32 cd = GetRuneCooldown(i))
SetRuneCooldown(i, (cd > m_regenTimer) ? cd - m_regenTimer : 0);
if (m_regenTimerCount >= 2000)
{
// Not in combat or they have regeneration
- if( !isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) ||
+ if ( !isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) ||
HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT) || IsPolymorphed() )
{
RegenerateHealth();
@@ -2143,7 +2143,7 @@ void Player::Regenerate(Powers power)
if (addvalue < 0.0f)
{
- if(curValue > integerValue)
+ if (curValue > integerValue)
{
curValue -= integerValue;
m_powerFraction[power] = addvalue + integerValue;
@@ -2166,7 +2166,7 @@ void Player::Regenerate(Powers power)
else
m_powerFraction[power] = addvalue - integerValue;
}
- if(m_regenTimerCount >= 2000)
+ if (m_regenTimerCount >= 2000)
SetPower(power, curValue);
else
UpdateUInt32Value(UNIT_FIELD_POWER1 + power, curValue);
@@ -2319,7 +2319,7 @@ bool Player::IsUnderWater() const
void Player::SetInWater(bool apply)
{
- if(m_isInWater==apply)
+ if (m_isInWater==apply)
return;
//define player in water by opcodes
@@ -2337,7 +2337,7 @@ void Player::SetInWater(bool apply)
void Player::SetGameMaster(bool on)
{
- if(on)
+ if (on)
{
m_ExtraFlags |= PLAYER_EXTRA_GM_ON;
setFaction(35);
@@ -2374,7 +2374,7 @@ void Player::SetGameMaster(bool on)
}
// restore FFA PvP Server state
- if(sWorld.IsFFAPvPRealm())
+ if (sWorld.IsFFAPvPRealm())
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
// restore FFA PvP area state, remove not allowed for GM mounts
@@ -2388,14 +2388,14 @@ void Player::SetGameMaster(bool on)
void Player::SetGMVisible(bool on)
{
- if(on)
+ if (on)
{
m_ExtraFlags &= ~PLAYER_EXTRA_GM_INVISIBLE; //remove flag
// Reapply stealth/invisibility if active or show if not any
- if(HasAuraType(SPELL_AURA_MOD_STEALTH))
+ if (HasAuraType(SPELL_AURA_MOD_STEALTH))
SetVisibility(VISIBILITY_GROUP_STEALTH);
- //else if(HasAuraType(SPELL_AURA_MOD_INVISIBILITY))
+ //else if (HasAuraType(SPELL_AURA_MOD_INVISIBILITY))
// SetVisibility(VISIBILITY_GROUP_INVISIBILITY);
else
SetVisibility(VISIBILITY_ON);
@@ -2433,14 +2433,14 @@ bool Player::IsInSameGroupWith(Player const* p) const
void Player::UninviteFromGroup()
{
Group* group = GetGroupInvite();
- if(!group)
+ if (!group)
return;
group->RemoveInvite(this);
- if(group->GetMembersCount() <= 1) // group has just 1 member => disband
+ if (group->GetMembersCount() <= 1) // group has just 1 member => disband
{
- if(group->IsCreated())
+ if (group->IsCreated())
{
group->Disband(true);
objmgr.RemoveGroup(group);
@@ -2454,7 +2454,7 @@ void Player::UninviteFromGroup()
void Player::RemoveFromGroup(Group* group, uint64 guid)
{
- if(group)
+ if (group)
{
if (group->RemoveMember(guid, 0) <= 1)
{
@@ -2472,7 +2472,7 @@ void Player::SendLogXPGain(uint32 GivenXP, Unit* victim, uint32 RestXP)
data << uint64(victim ? victim->GetGUID() : 0); // guid
data << uint32(GivenXP+RestXP); // given experience
data << uint8(victim ? 0 : 1); // 00-kill_xp type, 01-non_kill_xp type
- if(victim)
+ if (victim)
{
data << uint32(GivenXP); // experience without rested bonus
data << float(1); // 1 - none 0 - 100% group bonus output
@@ -2486,10 +2486,10 @@ void Player::GiveXP(uint32 xp, Unit* victim)
if ( xp < 1 )
return;
- if(!isAlive())
+ if (!isAlive())
return;
- if(HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN))
+ if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN))
return;
uint8 level = getLevel();
@@ -2497,12 +2497,12 @@ void Player::GiveXP(uint32 xp, Unit* victim)
// Favored experience increase START
uint32 zone = GetZoneId();
float favored_exp_mult = 0;
- if( (HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714) ) favored_exp_mult = 0.05; // Thrallmar's Favor and Honor Hold's Favor
+ if ( (HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714) ) favored_exp_mult = 0.05; // Thrallmar's Favor and Honor Hold's Favor
xp *= (1 + favored_exp_mult);
// Favored experience increase END
// XP to money conversion processed in Player::RewardQuest
- if(level >= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
+ if (level >= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
return;
// XP resting bonus for kill
@@ -2590,14 +2590,14 @@ void Player::GiveLevel(uint8 level)
UpdateAllStats();
- if(sWorld.getConfig(CONFIG_ALWAYS_MAXSKILL)) // Max weapon skill when leveling up
+ if (sWorld.getConfig(CONFIG_ALWAYS_MAXSKILL)) // Max weapon skill when leveling up
UpdateSkillsToMaxSkillsForLevel();
// set current level health and mana/energy to maximum after applying all mods.
SetHealth(GetMaxHealth());
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
- if(GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
+ if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE));
SetPower(POWER_FOCUS, 0);
SetPower(POWER_HAPPINESS, 0);
@@ -2621,7 +2621,7 @@ void Player::InitTalentForLevel()
if (level < 10)
{
// Remove all talent points
- if(m_usedTalentCount > 0) // Free any used talents
+ if (m_usedTalentCount > 0) // Free any used talents
{
resetTalents(true);
SetFreeTalentPoints(0);
@@ -2638,7 +2638,7 @@ void Player::InitTalentForLevel()
uint32 talentPointsForLevel = CalculateTalentsPoints();
// if used more that have then reset
- if(m_usedTalentCount > talentPointsForLevel)
+ if (m_usedTalentCount > talentPointsForLevel)
{
if (GetSession()->GetSecurity() < SEC_ADMINISTRATOR)
resetTalents(true);
@@ -2650,7 +2650,7 @@ void Player::InitTalentForLevel()
SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount);
}
- if(!GetSession()->PlayerLoading())
+ if (!GetSession()->PlayerLoading())
SendTalentsInfoData(false); // update at client
}
@@ -2803,7 +2803,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetHealth(GetMaxHealth());
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
- if(GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
+ if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE));
SetPower(POWER_FOCUS, 0);
SetPower(POWER_HAPPINESS, 0);
@@ -2829,10 +2829,10 @@ void Player::SendInitialSpells()
for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
{
- if(itr->second->state == PLAYERSPELL_REMOVED)
+ if (itr->second->state == PLAYERSPELL_REMOVED)
continue;
- if(!itr->second->active || itr->second->disabled)
+ if (!itr->second->active || itr->second->disabled)
continue;
data << uint32(itr->first);
@@ -2848,7 +2848,7 @@ void Player::SendInitialSpells()
for (SpellCooldowns::const_iterator itr=m_spellCooldowns.begin(); itr!=m_spellCooldowns.end(); ++itr)
{
SpellEntry const *sEntry = sSpellStore.LookupEntry(itr->first);
- if(!sEntry)
+ if (!sEntry)
continue;
data << uint32(itr->first);
@@ -2857,7 +2857,7 @@ void Player::SendInitialSpells()
data << uint16(sEntry->Category); // spell category
// send infinity cooldown in special format
- if(itr->second.end >= infTime)
+ if (itr->second.end >= infTime)
{
data << uint32(1); // cooldown
data << uint32(0x80000000); // category cooldown
@@ -2866,7 +2866,7 @@ void Player::SendInitialSpells()
time_t cooldown = itr->second.end > curTime ? (itr->second.end-curTime)*IN_MILISECONDS : 0;
- if(sEntry->Category) // may be wrong, but anyway better than nothing...
+ if (sEntry->Category) // may be wrong, but anyway better than nothing...
{
data << uint32(0); // cooldown
data << uint32(cooldown); // category cooldown
@@ -2904,7 +2904,7 @@ void Player::SendMailResult(uint32 mailId, MailResponseType mailAction, MailResp
data << (uint32) mailError;
if ( mailError == MAIL_ERR_EQUIP_ERROR )
data << (uint32) equipError;
- else if( mailAction == MAIL_ITEM_TAKEN )
+ else if ( mailAction == MAIL_ITEM_TAKEN )
{
data << (uint32) item_guid; // item guid low?
data << (uint32) item_count; // item count?
@@ -2929,26 +2929,26 @@ void Player::UpdateNextMailTimeAndUnreads()
unReadMails = 0;
for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
{
- if((*itr)->deliver_time > cTime)
+ if ((*itr)->deliver_time > cTime)
{
- if(!m_nextMailDelivereTime || m_nextMailDelivereTime > (*itr)->deliver_time)
+ if (!m_nextMailDelivereTime || m_nextMailDelivereTime > (*itr)->deliver_time)
m_nextMailDelivereTime = (*itr)->deliver_time;
}
- else if(((*itr)->checked & MAIL_CHECK_MASK_READ) == 0)
+ else if (((*itr)->checked & MAIL_CHECK_MASK_READ) == 0)
++unReadMails;
}
}
void Player::AddNewMailDeliverTime(time_t deliver_time)
{
- if(deliver_time <= time(NULL)) // ready now
+ if (deliver_time <= time(NULL)) // ready now
{
++unReadMails;
SendNewMail();
}
else // not ready and no have ready mails
{
- if(!m_nextMailDelivereTime || m_nextMailDelivereTime > deliver_time)
+ if (!m_nextMailDelivereTime || m_nextMailDelivereTime > deliver_time)
m_nextMailDelivereTime = deliver_time;
}
}
@@ -2959,7 +2959,7 @@ bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning)
if (!spellInfo)
{
// do character spell book cleanup (all characters)
- if(!IsInWorld() && !learning) // spell load case
+ if (!IsInWorld() && !learning) // spell load case
{
sLog.outError("Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.",spell_id);
CharacterDatabase.PExecute("DELETE FROM character_talent WHERE spell = '%u'",spell_id);
@@ -2970,10 +2970,10 @@ bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning)
return false;
}
- if(!SpellMgr::IsSpellValid(spellInfo,this,false))
+ if (!SpellMgr::IsSpellValid(spellInfo,this,false))
{
// do character spell book cleanup (all characters)
- if(!IsInWorld() && !learning) // spell load case
+ if (!IsInWorld() && !learning) // spell load case
{
sLog.outError("Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.",spell_id);
CharacterDatabase.PExecute("DELETE FROM character_talent WHERE spell = '%u'",spell_id);
@@ -3022,7 +3022,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if (!spellInfo)
{
// do character spell book cleanup (all characters)
- if(!IsInWorld() && !learning) // spell load case
+ if (!IsInWorld() && !learning) // spell load case
{
sLog.outError("Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.",spell_id);
CharacterDatabase.PExecute("DELETE FROM character_spell WHERE spell = '%u'",spell_id);
@@ -3033,10 +3033,10 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
return false;
}
- if(!SpellMgr::IsSpellValid(spellInfo,this,false))
+ if (!SpellMgr::IsSpellValid(spellInfo,this,false))
{
// do character spell book cleanup (all characters)
- if(!IsInWorld() && !learning) // spell load case
+ if (!IsInWorld() && !learning) // spell load case
{
sLog.outError("Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.",spell_id);
CharacterDatabase.PExecute("DELETE FROM character_spell WHERE spell = '%u'",spell_id);
@@ -3062,11 +3062,11 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
{
uint32 next_active_spell_id = 0;
// fix activate state for non-stackable low rank (and find next spell for !active case)
- if(!SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0)
+ if (!SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0)
{
- if(uint32 next = spellmgr.GetNextSpellInChain(spell_id))
+ if (uint32 next = spellmgr.GetNextSpellInChain(spell_id))
{
- if(HasSpell(next))
+ if (HasSpell(next))
{
// high rank already known so this must !active
active = false;
@@ -3076,10 +3076,10 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
}
// not do anything if already known in expected state
- if(itr->second->state != PLAYERSPELL_REMOVED && itr->second->active == active &&
+ if (itr->second->state != PLAYERSPELL_REMOVED && itr->second->active == active &&
itr->second->dependent == dependent && itr->second->disabled == disabled)
{
- if(!IsInWorld() && !learning) // explicitly load from DB and then exist in it already and set correctly
+ if (!IsInWorld() && !learning) // explicitly load from DB and then exist in it already and set correctly
itr->second->state = PLAYERSPELL_UNCHANGED;
return false;
@@ -3095,23 +3095,23 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
}
// update active state for known spell
- if(itr->second->active != active && itr->second->state != PLAYERSPELL_REMOVED && !itr->second->disabled)
+ if (itr->second->active != active && itr->second->state != PLAYERSPELL_REMOVED && !itr->second->disabled)
{
itr->second->active = active;
- if(!IsInWorld() && !learning && !dependent_set) // explicitly load from DB and then exist in it already and set correctly
+ if (!IsInWorld() && !learning && !dependent_set) // explicitly load from DB and then exist in it already and set correctly
itr->second->state = PLAYERSPELL_UNCHANGED;
- else if(itr->second->state != PLAYERSPELL_NEW)
+ else if (itr->second->state != PLAYERSPELL_NEW)
itr->second->state = PLAYERSPELL_CHANGED;
- if(active)
+ if (active)
{
if (IsPassiveSpell(spell_id) && IsNeedCastPassiveSpellAtLearn(spellInfo))
CastSpell (this,spell_id,true);
}
- else if(IsInWorld())
+ else if (IsInWorld())
{
- if(next_active_spell_id)
+ if (next_active_spell_id)
{
// update spell ranks in spellbook and action bar
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
@@ -3130,13 +3130,13 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
return active; // learn (show in spell book if active now)
}
- if(itr->second->disabled != disabled && itr->second->state != PLAYERSPELL_REMOVED)
+ if (itr->second->disabled != disabled && itr->second->state != PLAYERSPELL_REMOVED)
{
- if(itr->second->state != PLAYERSPELL_NEW)
+ if (itr->second->state != PLAYERSPELL_NEW)
itr->second->state = PLAYERSPELL_CHANGED;
itr->second->disabled = disabled;
- if(disabled)
+ if (disabled)
return false;
disabled_case = true;
@@ -3155,7 +3155,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
default: // known not saved yet spell (new or modified)
{
// can be in case spell loading but learned at some previous spell loading
- if(!IsInWorld() && !learning && !dependent_set)
+ if (!IsInWorld() && !learning && !dependent_set)
itr->second->state = PLAYERSPELL_UNCHANGED;
return false;
@@ -3163,18 +3163,18 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
}
}
- if(!disabled_case) // skip new spell adding if spell already known (disabled spells case)
+ if (!disabled_case) // skip new spell adding if spell already known (disabled spells case)
{
// talent: unlearn all other talent ranks (high and low)
- if(TalentSpellPos const *talentPos = GetTalentSpellPos(spell_id))
+ if (TalentSpellPos const *talentPos = GetTalentSpellPos(spell_id))
{
- if(TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentPos->talent_id ))
+ if (TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentPos->talent_id ))
{
for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank)
{
// skip learning spell and no rank spell case
uint32 rankSpellId = talentInfo->RankID[rank];
- if(!rankSpellId || rankSpellId == spell_id)
+ if (!rankSpellId || rankSpellId == spell_id)
continue;
removeSpell(rankSpellId,false,false);
@@ -3182,9 +3182,9 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
}
}
// non talent spell: learn low ranks (recursive call)
- else if(uint32 prev_spell = spellmgr.GetPrevSpellInChain(spell_id))
+ else if (uint32 prev_spell = spellmgr.GetPrevSpellInChain(spell_id))
{
- if(!IsInWorld() || disabled) // at spells loading, no output, but allow save
+ if (!IsInWorld() || disabled) // at spells loading, no output, but allow save
addSpell(prev_spell,active,true,true,disabled);
else // at normal learning
learnSpell(prev_spell,true);
@@ -3197,21 +3197,21 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
newspell->disabled = disabled;
// replace spells in action bars and spellbook to bigger rank if only one spell rank must be accessible
- if(newspell->active && !newspell->disabled && !SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0)
+ if (newspell->active && !newspell->disabled && !SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0)
{
for (PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2 )
{
- if(itr2->second->state == PLAYERSPELL_REMOVED) continue;
+ if (itr2->second->state == PLAYERSPELL_REMOVED) continue;
SpellEntry const *i_spellInfo = sSpellStore.LookupEntry(itr2->first);
- if(!i_spellInfo) continue;
+ if (!i_spellInfo) continue;
- if( spellmgr.IsRankSpellDueToSpell(spellInfo,itr2->first) )
+ if ( spellmgr.IsRankSpellDueToSpell(spellInfo,itr2->first) )
{
- if(itr2->second->active)
+ if (itr2->second->active)
{
- if(spellmgr.IsHighRankOfSpell(spell_id,itr2->first))
+ if (spellmgr.IsHighRankOfSpell(spell_id,itr2->first))
{
- if(IsInWorld()) // not send spell (re-/over-)learn packets at loading
+ if (IsInWorld()) // not send spell (re-/over-)learn packets at loading
{
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
data << uint32(itr2->first);
@@ -3221,13 +3221,13 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
// mark old spell as disable (SMSG_SUPERCEDED_SPELL replace it in client by new)
itr2->second->active = false;
- if(itr2->second->state != PLAYERSPELL_NEW)
+ if (itr2->second->state != PLAYERSPELL_NEW)
itr2->second->state = PLAYERSPELL_CHANGED;
superceded_old = true; // new spell replace old in action bars and spell book.
}
- else if(spellmgr.IsHighRankOfSpell(itr2->first,spell_id))
+ else if (spellmgr.IsHighRankOfSpell(itr2->first,spell_id))
{
- if(IsInWorld()) // not send spell (re-/over-)learn packets at loading
+ if (IsInWorld()) // not send spell (re-/over-)learn packets at loading
{
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
data << uint32(spell_id);
@@ -3237,7 +3237,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
// mark new spell as disable (not learned yet for client and will not learned)
newspell->active = false;
- if(newspell->state != PLAYERSPELL_NEW)
+ if (newspell->state != PLAYERSPELL_NEW)
newspell->state = PLAYERSPELL_CHANGED;
}
}
@@ -3279,7 +3279,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
// update free primary prof.points (if any, can be none in case GM .learn prof. learning)
if (uint32 freeProfs = GetFreePrimaryProfessionPoints())
{
- if(spellmgr.IsPrimaryProfessionFirstRankSpell(spell_id))
+ if (spellmgr.IsPrimaryProfessionFirstRankSpell(spell_id))
SetFreePrimaryProfessions(freeProfs-1);
}
@@ -3554,7 +3554,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
if (!pSkill)
continue;
- if(_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL &&
+ if (_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL &&
pSkill->categoryId != SKILL_CATEGORY_CLASS ||// not unlearn class skills (spellbook/talent pages)
// lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL
((pSkill->id == SKILL_LOCKPICKING || pSkill->id == SKILL_RUNEFORGING) && _spell_idx->second->max_value == 0))
@@ -3679,7 +3679,7 @@ void Player::RemoveArenaSpellCooldowns()
++next;
SpellEntry const * entry = sSpellStore.LookupEntry(itr->first);
// check if spellentry is present and if the cooldown is less than 10 mins
- if( entry &&
+ if ( entry &&
entry->RecoveryTime <= 10 * MINUTE * IN_MILISECONDS &&
entry->CategoryRecoveryTime <= 10 * MINUTE * IN_MILISECONDS )
{
@@ -3718,14 +3718,14 @@ void Player::_LoadSpellCooldowns(QueryResult_AutoPtr result)
uint32 item_id = fields[1].GetUInt32();
time_t db_time = (time_t)fields[2].GetUInt64();
- if(!sSpellStore.LookupEntry(spell_id))
+ if (!sSpellStore.LookupEntry(spell_id))
{
sLog.outError("Player %u has unknown spell %u in `character_spell_cooldown`, skipping.",GetGUIDLow(),spell_id);
continue;
}
// skip outdated cooldown
- if(db_time <= curTime)
+ if (db_time <= curTime)
continue;
AddSpellCooldown(spell_id, item_id, db_time);
@@ -3749,9 +3749,9 @@ void Player::_SaveSpellCooldowns()
// remove outdated and save active
for (SpellCooldowns::iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end();)
{
- if(itr->second.end <= curTime)
+ if (itr->second.end <= curTime)
m_spellCooldowns.erase(itr++);
- else if(itr->second.end <= infTime) // not save locked cooldowns, it will be reset or set at reload
+ else if (itr->second.end <= infTime) // not save locked cooldowns, it will be reset or set at reload
{
if (first_round)
{
@@ -3776,18 +3776,18 @@ void Player::_SaveSpellCooldowns()
uint32 Player::resetTalentsCost() const
{
// The first time reset costs 1 gold
- if(m_resetTalentsCost < 1*GOLD)
+ if (m_resetTalentsCost < 1*GOLD)
return 1*GOLD;
// then 5 gold
- else if(m_resetTalentsCost < 5*GOLD)
+ else if (m_resetTalentsCost < 5*GOLD)
return 5*GOLD;
// After that it increases in increments of 5 gold
- else if(m_resetTalentsCost < 10*GOLD)
+ else if (m_resetTalentsCost < 10*GOLD)
return 10*GOLD;
else
{
uint32 months = (sWorld.GetGameTime() - m_resetTalentsTime)/MONTH;
- if(months > 0)
+ if (months > 0)
{
// This cost will be reduced by a rate of 5 gold per month
int32 new_cost = int32(m_resetTalentsCost) - 5*GOLD*months;
@@ -3799,7 +3799,7 @@ uint32 Player::resetTalentsCost() const
// After that it increases in increments of 5 gold
int32 new_cost = m_resetTalentsCost + 5*GOLD;
// until it hits a cap of 50 gold.
- if(new_cost > 50*GOLD)
+ if (new_cost > 50*GOLD)
new_cost = 50*GOLD;
return new_cost;
}
@@ -3885,9 +3885,9 @@ bool Player::resetTalents(bool no_cost)
//FIXME: remove pet before or after unlearn spells? for now after unlearn to allow removing of talent related, pet affecting auras
RemovePet(NULL,PET_SAVE_NOT_IN_SLOT, true);
/* when prev line will dropped use next line
- if(Pet* pet = GetPet())
+ if (Pet* pet = GetPet())
{
- if(pet->getPetType()==HUNTER_PET && !pet->GetCreatureInfo()->isTameable(CanTameExoticPets()))
+ if (pet->getPetType()==HUNTER_PET && !pet->GetCreatureInfo()->isTameable(CanTameExoticPets()))
RemovePet(NULL,PET_SAVE_NOT_IN_SLOT, true);
}
*/
@@ -3906,19 +3906,19 @@ Mail* Player::GetMail(uint32 id)
void Player::_SetCreateBits(UpdateMask *updateMask, Player *target) const
{
- if(target == this)
+ if (target == this)
Object::_SetCreateBits(updateMask, target);
else
{
for (uint16 index = 0; index < m_valuesCount; index++)
- if(GetUInt32Value(index) != 0 && updateVisualBits.GetBit(index))
+ if (GetUInt32Value(index) != 0 && updateVisualBits.GetBit(index))
updateMask->SetBit(index);
}
}
void Player::_SetUpdateBits(UpdateMask *updateMask, Player *target) const
{
- if(target == this)
+ if (target == this)
Object::_SetUpdateBits(updateMask, target);
else
{
@@ -4021,24 +4021,24 @@ void Player::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target )
{
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
- if(m_items[i] == NULL)
+ if (m_items[i] == NULL)
continue;
m_items[i]->BuildCreateUpdateBlockForPlayer( data, target );
}
- if(target == this)
+ if (target == this)
{
for (uint8 i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
{
- if(m_items[i] == NULL)
+ if (m_items[i] == NULL)
continue;
m_items[i]->BuildCreateUpdateBlockForPlayer( data, target );
}
for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
{
- if(m_items[i] == NULL)
+ if (m_items[i] == NULL)
continue;
m_items[i]->BuildCreateUpdateBlockForPlayer( data, target );
@@ -4054,24 +4054,24 @@ void Player::DestroyForPlayer( Player *target, bool anim ) const
for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
{
- if(m_items[i] == NULL)
+ if (m_items[i] == NULL)
continue;
m_items[i]->DestroyForPlayer( target );
}
- if(target == this)
+ if (target == this)
{
for (uint8 i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
{
- if(m_items[i] == NULL)
+ if (m_items[i] == NULL)
continue;
m_items[i]->DestroyForPlayer( target );
}
for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
{
- if(m_items[i] == NULL)
+ if (m_items[i] == NULL)
continue;
m_items[i]->DestroyForPlayer( target );
@@ -4110,7 +4110,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
if (!trainer_spell->learnedSpell[i])
continue;
- if(!HasSpell(trainer_spell->learnedSpell[i]))
+ if (!HasSpell(trainer_spell->learnedSpell[i]))
{
hasSpell = false;
break;
@@ -4121,11 +4121,11 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
return TRAINER_SPELL_GRAY;
// check skill requirement
- if(trainer_spell->reqSkill && GetBaseSkillValue(trainer_spell->reqSkill) < trainer_spell->reqSkillValue)
+ if (trainer_spell->reqSkill && GetBaseSkillValue(trainer_spell->reqSkill) < trainer_spell->reqSkillValue)
return TRAINER_SPELL_RED;
// check level requirement
- if(getLevel() < trainer_spell->reqLevel)
+ if (getLevel() < trainer_spell->reqLevel)
return TRAINER_SPELL_RED;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i)
@@ -4134,13 +4134,13 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
continue;
// check race/class requirement
- if(!IsSpellFitByClassAndRace(trainer_spell->learnedSpell[i]))
+ if (!IsSpellFitByClassAndRace(trainer_spell->learnedSpell[i]))
return TRAINER_SPELL_RED;
- if(SpellChainNode const* spell_chain = spellmgr.GetSpellChainNode(trainer_spell->learnedSpell[i]))
+ if (SpellChainNode const* spell_chain = spellmgr.GetSpellChainNode(trainer_spell->learnedSpell[i]))
{
// check prev.rank requirement
- if(spell_chain->prev && !HasSpell(spell_chain->prev))
+ if (spell_chain->prev && !HasSpell(spell_chain->prev))
return TRAINER_SPELL_RED;
}
@@ -4148,7 +4148,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
for (SpellsRequiringSpellMap::const_iterator itr = spellsRequired.first; itr != spellsRequired.second; ++itr)
{
// check additional spell requirement
- if(!HasSpell(itr->second))
+ if (!HasSpell(itr->second))
return TRAINER_SPELL_RED;
}
}
@@ -4159,7 +4159,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
{
if (!trainer_spell->learnedSpell[i])
continue;
- if((spellmgr.IsPrimaryProfessionFirstRankSpell(trainer_spell->learnedSpell[i])) && (GetFreePrimaryProfessionPoints() == 0))
+ if ((spellmgr.IsPrimaryProfessionFirstRankSpell(trainer_spell->learnedSpell[i])) && (GetFreePrimaryProfessionPoints() == 0))
return TRAINER_SPELL_GREEN_DISABLED;
}
@@ -4176,10 +4176,10 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
// remove from guild
uint32 guildId = GetGuildIdFromDB(playerguid);
- if(guildId != 0)
+ if (guildId != 0)
{
Guild* guild = objmgr.GetGuildById(guildId);
- if(guild)
+ if (guild)
guild->DelMember(guid);
}
@@ -4188,11 +4188,11 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
// the player was uninvited already on logout so just remove from group
QueryResult_AutoPtr resultGroup = CharacterDatabase.PQuery("SELECT leaderGuid FROM group_member WHERE memberGuid='%u'", guid);
- if(resultGroup)
+ if (resultGroup)
{
uint64 leaderGuid = MAKE_NEW_GUID((*resultGroup)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
Group* group = objmgr.GetGroupByLeader(leaderGuid);
- if(group)
+ if (group)
{
RemoveFromGroup(group, playerguid);
}
@@ -4203,7 +4203,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
// return back all mails with COD and Item 0 1 2 3 4 5 6 7
QueryResult_AutoPtr resultMail = CharacterDatabase.PQuery("SELECT id,messageType,mailTemplateId,sender,subject,itemTextId,money,has_items FROM mail WHERE receiver='%u' AND has_items<>0 AND cod<>0", guid);
- if(resultMail)
+ if (resultMail)
{
do
{
@@ -4225,7 +4225,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
// mail not from player
if (mailType != MAIL_NORMAL)
{
- if(has_items)
+ if (has_items)
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE mail_id = '%u'", mail_id);
continue;
}
@@ -4234,11 +4234,11 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
if (mailTemplateId)
draft = MailDraft(mailTemplateId,false); // itesm already included
- if(has_items)
+ if (has_items)
{
// data needs to be at first place for Item::LoadFromDB
QueryResult_AutoPtr resultItems = CharacterDatabase.PQuery("SELECT data,item_guid,item_template FROM mail_items JOIN item_instance ON item_guid = guid WHERE mail_id='%u'", mail_id);
- if(resultItems)
+ if (resultItems)
{
do
{
@@ -4248,14 +4248,14 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
uint32 item_template = fields2[2].GetUInt32();
ItemPrototype const* itemProto = objmgr.GetItemPrototype(item_template);
- if(!itemProto)
+ if (!itemProto)
{
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", item_guidlow);
continue;
}
Item *pItem = NewItemOrBag(itemProto);
- if(!pItem->LoadFromDB(item_guidlow, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER),resultItems))
+ if (!pItem->LoadFromDB(item_guidlow, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER),resultItems))
{
pItem->FSetState(ITEM_REMOVED);
pItem->SaveToDB(); // it also deletes item object !
@@ -4335,7 +4335,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
CharacterDatabase.CommitTransaction();
//loginDatabase.PExecute("UPDATE realmcharacters SET numchars = numchars - 1 WHERE acctid = %d AND realmid = %d", accountId, realmID);
- if(updateRealmChars) sWorld.UpdateRealmCharCount(accountId);
+ if (updateRealmChars) sWorld.UpdateRealmCharCount(accountId);
}
void Player::SetMovement(PlayerMovementType pType)
@@ -4375,7 +4375,7 @@ void Player::BuildPlayerRepop()
// there we must send 888 opcode
// the player cannot have a corpse already, only bones which are not returned by GetCorpse
- if(GetCorpse())
+ if (GetCorpse())
{
sLog.outError("BuildPlayerRepop: player %s(%d) already has a corpse", GetName(), GetGUIDLow());
assert(false);
@@ -4384,7 +4384,7 @@ void Player::BuildPlayerRepop()
// create a corpse and place it at the player's location
CreateCorpse();
Corpse *corpse = GetCorpse();
- if(!corpse)
+ if (!corpse)
{
sLog.outError("Error creating corpse for Player %s [%u]", GetName(), GetGUIDLow());
return;
@@ -4395,7 +4395,7 @@ void Player::BuildPlayerRepop()
SetHealth( 1 );
SetMovement(MOVE_WATER_WALK);
- if(!GetSession()->isLogingOut())
+ if (!GetSession()->isLogingOut())
SetMovement(MOVE_UNROOT);
// BG - remove insignia related
@@ -4439,7 +4439,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
m_deathTimer = 0;
// set health/powers (0- will be set in caller)
- if(restore_percent>0.0f)
+ if (restore_percent>0.0f)
{
SetHealth(uint32(GetMaxHealth()*restore_percent));
SetPower(POWER_MANA, uint32(GetMaxPower(POWER_MANA)*restore_percent));
@@ -4456,7 +4456,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
// update visibility
UpdateObjectVisibility();
- if(!applySickness)
+ if (!applySickness)
return;
//Characters from level 1-10 are not affected by resurrection sickness.
@@ -4465,17 +4465,17 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
//Characters level 20 and up suffer from ten minutes of sickness.
int32 startLevel = sWorld.getConfig(CONFIG_DEATH_SICKNESS_LEVEL);
- if(int32(getLevel()) >= startLevel)
+ if (int32(getLevel()) >= startLevel)
{
// set resurrection sickness
CastSpell(this, 15007, true);
// not full duration
- if(int32(getLevel()) < startLevel+9)
+ if (int32(getLevel()) < startLevel+9)
{
int32 delta = (int32(getLevel()) - startLevel + 1)*MINUTE;
- if(Aura * aur = GetAura(15007, GetGUID()))
+ if (Aura * aur = GetAura(15007, GetGUID()))
{
aur->SetDuration(delta*IN_MILISECONDS);
}
@@ -4505,19 +4505,19 @@ bool Player::FallGround(uint8 FallMode)
GetMotionMaster()->MoveFall(ground_Z, EVENT_FALL_GROUND);
// Below formula for falling damage is from Player::HandleFall
- if(FallMode == 2 && z_diff >= 14.57f)
+ if (FallMode == 2 && z_diff >= 14.57f)
{
uint32 damage = std::min(GetMaxHealth(), (uint32)((0.018f*z_diff-0.2426f)*GetMaxHealth()*sWorld.getRate(RATE_DAMAGE_FALL)));
- if(damage > 0) EnvironmentalDamage(DAMAGE_FALL, damage);
+ if (damage > 0) EnvironmentalDamage(DAMAGE_FALL, damage);
}
- else if(FallMode == 0)
+ else if (FallMode == 0)
Unit::setDeathState(DEAD_FALLING);
return true;
}
void Player::KillPlayer()
{
- if(IsFlying() && !GetTransport()) FallGround();
+ if (IsFlying() && !GetTransport()) FallGround();
SetMovement(MOVE_ROOT);
@@ -4551,7 +4551,7 @@ void Player::CreateCorpse()
Corpse *corpse = new Corpse( (m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH) ? CORPSE_RESURRECTABLE_PVP : CORPSE_RESURRECTABLE_PVE );
SetPvPDeath(false);
- if(!corpse->Create(objmgr.GenerateLowGuid(HIGHGUID_CORPSE), this))
+ if (!corpse->Create(objmgr.GenerateLowGuid(HIGHGUID_CORPSE), this))
{
delete corpse;
return;
@@ -4575,11 +4575,11 @@ void Player::CreateCorpse()
corpse->SetUInt32Value( CORPSE_FIELD_BYTES_2, _cfb2 );
uint32 flags = CORPSE_FLAG_UNK2;
- if(HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM))
+ if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM))
flags |= CORPSE_FLAG_HIDE_HELM;
- if(HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK))
+ if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK))
flags |= CORPSE_FLAG_HIDE_CLOAK;
- if(InBattleGround() && !InArena())
+ if (InBattleGround() && !InArena())
flags |= CORPSE_FLAG_LOOTABLE; // to be able to remove insignia
corpse->SetUInt32Value( CORPSE_FIELD_FLAGS, flags );
@@ -4592,7 +4592,7 @@ void Player::CreateCorpse()
uint32 _cfi;
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; i++)
{
- if(m_items[i])
+ if (m_items[i])
{
iDisplayID = m_items[i]->GetProto()->DisplayInfoID;
iIventoryType = m_items[i]->GetProto()->InventoryType;
@@ -4605,7 +4605,7 @@ void Player::CreateCorpse()
// we don't SaveToDB for players in battlegrounds so don't do it for corpses either
const MapEntry *entry = sMapStore.LookupEntry(corpse->GetMapId());
assert(entry);
- if(entry->map_type != MAP_BATTLEGROUND)
+ if (entry->map_type != MAP_BATTLEGROUND)
corpse->SaveToDB();
// register for player, but not show
@@ -4614,7 +4614,7 @@ void Player::CreateCorpse()
void Player::SpawnCorpseBones()
{
- if(ObjectAccessor::Instance().ConvertCorpseForPlayer(GetGUID()))
+ if (ObjectAccessor::Instance().ConvertCorpseForPlayer(GetGUID()))
if (!GetSession()->PlayerLogoutWithSave()) // at logout we will already store the player
SaveToDB(); // prevent loading as ghost without corpse
}
@@ -4627,42 +4627,42 @@ Corpse* Player::GetCorpse() const
void Player::DurabilityLossAll(double percent, bool inventory)
{
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++)
- if(Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
+ if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
DurabilityLoss(pItem,percent);
- if(inventory)
+ if (inventory)
{
// bags not have durability
// for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++)
- if(Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
+ if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
DurabilityLoss(pItem,percent);
// keys not have durability
//for (int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++)
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
- if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
+ if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
for (uint32 j = 0; j < pBag->GetBagSize(); j++)
- if(Item* pItem = GetItemByPos( i, j ))
+ if (Item* pItem = GetItemByPos( i, j ))
DurabilityLoss(pItem,percent);
}
}
void Player::DurabilityLoss(Item* item, double percent)
{
- if(!item )
+ if (!item )
return;
uint32 pMaxDurability = item ->GetUInt32Value(ITEM_FIELD_MAXDURABILITY);
- if(!pMaxDurability)
+ if (!pMaxDurability)
return;
uint32 pDurabilityLoss = uint32(pMaxDurability*percent);
- if(pDurabilityLoss < 1 )
+ if (pDurabilityLoss < 1 )
pDurabilityLoss = 1;
DurabilityPointsLoss(item,pDurabilityLoss);
@@ -4671,25 +4671,25 @@ void Player::DurabilityLoss(Item* item, double percent)
void Player::DurabilityPointsLossAll(int32 points, bool inventory)
{
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++)
- if(Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
+ if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
DurabilityPointsLoss(pItem,points);
- if(inventory)
+ if (inventory)
{
// bags not have durability
// for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++)
- if(Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
+ if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
DurabilityPointsLoss(pItem,points);
// keys not have durability
//for (int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++)
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
- if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
+ if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
for (uint32 j = 0; j < pBag->GetBagSize(); j++)
- if(Item* pItem = GetItemByPos( i, j ))
+ if (Item* pItem = GetItemByPos( i, j ))
DurabilityPointsLoss(pItem,points);
}
}
@@ -4723,7 +4723,7 @@ void Player::DurabilityPointsLoss(Item* item, int32 points)
void Player::DurabilityPointLossForEquipSlot(EquipmentSlots slot)
{
- if(Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, slot ))
+ if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, slot ))
DurabilityPointsLoss(pItem,1);
}
@@ -4748,24 +4748,24 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
Item* item = GetItemByPos(pos);
uint32 TotalCost = 0;
- if(!item)
+ if (!item)
return TotalCost;
uint32 maxDurability = item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY);
- if(!maxDurability)
+ if (!maxDurability)
return TotalCost;
uint32 curDurability = item->GetUInt32Value(ITEM_FIELD_DURABILITY);
- if(cost)
+ if (cost)
{
uint32 LostDurability = maxDurability - curDurability;
- if(LostDurability>0)
+ if (LostDurability>0)
{
ItemPrototype const *ditemProto = item->GetProto();
DurabilityCostsEntry const *dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel);
- if(!dcost)
+ if (!dcost)
{
sLog.outError("RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel);
return TotalCost;
@@ -4773,7 +4773,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
uint32 dQualitymodEntryId = (ditemProto->Quality+1)*2;
DurabilityQualityEntry const *dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId);
- if(!dQualitymodEntry)
+ if (!dQualitymodEntry)
{
sLog.outError("RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId);
return TotalCost;
@@ -4834,7 +4834,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
item->SetState(ITEM_CHANGED, this);
// reapply mods for total broken and repaired item if equipped
- if(IsEquipmentPos(pos) && !curDurability)
+ if (IsEquipmentPos(pos) && !curDurability)
_ApplyItemMods(item,pos & 255, true);
return TotalCost;
}
@@ -4856,7 +4856,7 @@ void Player::RepopAtGraveyard()
WorldSafeLocsEntry const *ClosestGrave = NULL;
// Special handle for battleground maps
- if( BattleGround *bg = GetBattleGround() )
+ if ( BattleGround *bg = GetBattleGround() )
ClosestGrave = bg->GetClosestGraveYard(this);
else
ClosestGrave = objmgr.GetClosestGraveYard( GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam() );
@@ -4866,10 +4866,10 @@ void Player::RepopAtGraveyard()
// if no grave found, stay at the current location
// and don't show spirit healer location
- if(ClosestGrave)
+ if (ClosestGrave)
{
TeleportTo(ClosestGrave->map_id, ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, GetOrientation());
- if(isDead()) // not send if alive, because it used in TeleportTo()
+ if (isDead()) // not send if alive, because it used in TeleportTo()
{
WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4*4); // show spirit healer position on minimap
data << ClosestGrave->map_id;
@@ -4879,7 +4879,7 @@ void Player::RepopAtGraveyard()
GetSession()->SendPacket(&data);
}
}
- else if(GetPositionZ() < -500.0f)
+ else if (GetPositionZ() < -500.0f)
TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GetOrientation());
}
@@ -4909,15 +4909,15 @@ void Player::CleanupChannels()
void Player::UpdateLocalChannels(uint32 newZone )
{
- if(m_channels.empty())
+ if (m_channels.empty())
return;
AreaTableEntry const* current_zone = GetAreaEntryByAreaID(newZone);
- if(!current_zone)
+ if (!current_zone)
return;
ChannelMgr* cMgr = channelMgr(GetTeam());
- if(!cMgr)
+ if (!cMgr)
return;
std::string current_zone_name = current_zone->area_name[GetSession()->GetSessionDbcLocale()];
@@ -4927,14 +4927,14 @@ void Player::UpdateLocalChannels(uint32 newZone )
next = i; ++next;
// skip non built-in channels
- if(!(*i)->IsConstant())
+ if (!(*i)->IsConstant())
continue;
ChatChannelsEntry const* ch = GetChannelEntryFor((*i)->GetChannelId());
- if(!ch)
+ if (!ch)
continue;
- if((ch->flags & 4) == 4) // global channel without zone name in pattern
+ if ((ch->flags & 4) == 4) // global channel without zone name in pattern
continue;
// new channel
@@ -4942,7 +4942,7 @@ void Player::UpdateLocalChannels(uint32 newZone )
snprintf(new_channel_name_buf,100,ch->pattern[m_session->GetSessionDbcLocale()],current_zone_name.c_str());
Channel* new_channel = cMgr->GetJoinChannel(new_channel_name_buf,ch->ChannelID);
- if((*i)!=new_channel)
+ if ((*i)!=new_channel)
{
new_channel->Join(GetGUID(),""); // will output Changed Channel: N. Name
@@ -4960,7 +4960,7 @@ void Player::LeaveLFGChannel()
{
for (JoinedChannelsList::iterator i = m_channels.begin(); i != m_channels.end(); ++i )
{
- if((*i)->IsLFG())
+ if ((*i)->IsLFG())
{
(*i)->Leave(GetGUID());
break;
@@ -4972,7 +4972,7 @@ void Player::UpdateDefense()
{
uint32 defense_skill_gain = sWorld.getConfig(CONFIG_SKILL_GAIN_DEFENSE);
- if(UpdateSkill(SKILL_DEFENSE,defense_skill_gain))
+ if (UpdateSkill(SKILL_DEFENSE,defense_skill_gain))
{
// update dependent from defense skill part
UpdateDefenseBonusesMod();
@@ -4981,7 +4981,7 @@ void Player::UpdateDefense()
void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply)
{
- if(modGroup >= BASEMOD_END || modType >= MOD_END)
+ if (modGroup >= BASEMOD_END || modType >= MOD_END)
{
sLog.outError("ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!");
return;
@@ -4995,7 +4995,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa
m_auraBaseMod[modGroup][modType] += apply ? amount : -amount;
break;
case PCT_MOD:
- if(amount <= -100.0f)
+ if (amount <= -100.0f)
amount = -200.0f;
val = (100.0f + amount) / 100.0f;
@@ -5003,7 +5003,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa
break;
}
- if(!CanModifyStats())
+ if (!CanModifyStats())
return;
switch(modGroup)
@@ -5018,13 +5018,13 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa
float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const
{
- if(modGroup >= BASEMOD_END || modType > MOD_END)
+ if (modGroup >= BASEMOD_END || modType > MOD_END)
{
sLog.outError("trial to access non existed BaseModGroup or wrong BaseModType!");
return 0.0f;
}
- if(modType == PCT_MOD && m_auraBaseMod[modGroup][PCT_MOD] <= 0.0f)
+ if (modType == PCT_MOD && m_auraBaseMod[modGroup][PCT_MOD] <= 0.0f)
return 0.0f;
return m_auraBaseMod[modGroup][modType];
@@ -5032,13 +5032,13 @@ float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const
float Player::GetTotalBaseModValue(BaseModGroup modGroup) const
{
- if(modGroup >= BASEMOD_END)
+ if (modGroup >= BASEMOD_END)
{
sLog.outError("wrong BaseModGroup in GetTotalBaseModValue()!");
return 0.0f;
}
- if(m_auraBaseMod[modGroup][PCT_MOD] <= 0.0f)
+ if (m_auraBaseMod[modGroup][PCT_MOD] <= 0.0f)
return 0.0f;
return m_auraBaseMod[modGroup][FLAT_MOD] * m_auraBaseMod[modGroup][PCT_MOD];
@@ -5279,18 +5279,18 @@ void Player::UpdateRating(CombatRating cr)
UpdateSpellHitChances();
break;
case CR_CRIT_MELEE:
- if(affectStats)
+ if (affectStats)
{
UpdateCritPercentage(BASE_ATTACK);
UpdateCritPercentage(OFF_ATTACK);
}
break;
case CR_CRIT_RANGED:
- if(affectStats)
+ if (affectStats)
UpdateCritPercentage(RANGED_ATTACK);
break;
case CR_CRIT_SPELL:
- if(affectStats)
+ if (affectStats)
UpdateAllSpellCritChances();
break;
case CR_HIT_TAKEN_MELEE: // Implemented in Unit::MeleeMissChanceCalc
@@ -5312,14 +5312,14 @@ void Player::UpdateRating(CombatRating cr)
case CR_WEAPON_SKILL_RANGED:
break;
case CR_EXPERTISE:
- if(affectStats)
+ if (affectStats)
{
UpdateExpertise(BASE_ATTACK);
UpdateExpertise(OFF_ATTACK);
}
break;
case CR_ARMOR_PENETRATION:
- if(affectStats)
+ if (affectStats)
UpdateArmorPenetration(amount);
break;
}
@@ -5336,10 +5336,10 @@ void Player::SetRegularAttackTime()
for (uint8 i = 0; i < MAX_ATTACK; ++i)
{
Item *tmpitem = GetWeaponForAttack(WeaponAttackType(i));
- if(tmpitem && !tmpitem->IsBroken())
+ if (tmpitem && !tmpitem->IsBroken())
{
ItemPrototype const *proto = tmpitem->GetProto();
- if(proto->Delay)
+ if (proto->Delay)
SetAttackTime(WeaponAttackType(i), proto->Delay);
else
SetAttackTime(WeaponAttackType(i), BASE_ATTACK_TIME);
@@ -5350,14 +5350,14 @@ void Player::SetRegularAttackTime()
//skill+step, checking for max value
bool Player::UpdateSkill(uint32 skill_id, uint32 step)
{
- if(!skill_id)
+ if (!skill_id)
return false;
- if(skill_id == SKILL_FIST_WEAPONS)
+ if (skill_id == SKILL_FIST_WEAPONS)
skill_id = SKILL_UNARMED;
SkillStatusMap::iterator itr = mSkillStatus.find(skill_id);
- if(itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
+ if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return false;
uint32 valueIndex = PLAYER_SKILL_VALUE_INDEX(itr->second.pos);
@@ -5371,11 +5371,11 @@ bool Player::UpdateSkill(uint32 skill_id, uint32 step)
if (value < max)
{
uint32 new_value = value+step;
- if(new_value > max)
+ if (new_value > max)
new_value = max;
SetUInt32Value(valueIndex,MAKE_SKILL_VALUE(new_value,max));
- if(itr->second.uState != SKILL_NEW)
+ if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL,skill_id);
return true;
@@ -5442,7 +5442,7 @@ bool Player::UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLeve
case SKILL_INSCRIPTION:
return UpdateSkillPro(SkillId, SkillGainChance(SkillValue, RedLevel+100, RedLevel+50, RedLevel+25)*Multiplicator,gathering_skill_gain);
case SKILL_SKINNING:
- if( sWorld.getConfig(CONFIG_SKILL_CHANCE_SKINNING_STEPS)==0)
+ if ( sWorld.getConfig(CONFIG_SKILL_CHANCE_SKINNING_STEPS)==0)
return UpdateSkillPro(SkillId, SkillGainChance(SkillValue, RedLevel+100, RedLevel+50, RedLevel+25)*Multiplicator,gathering_skill_gain);
else
return UpdateSkillPro(SkillId, (SkillGainChance(SkillValue, RedLevel+100, RedLevel+50, RedLevel+25)*Multiplicator) >> (SkillValue/sWorld.getConfig(CONFIG_SKILL_CHANCE_SKINNING_STEPS)), gathering_skill_gain);
@@ -5479,14 +5479,14 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
if ( !SkillId )
return false;
- if(Chance <= 0) // speedup in 0 chance case
+ if (Chance <= 0) // speedup in 0 chance case
{
sLog.outDebug("Player::UpdateSkillPro Chance=%3.1f%% missed", Chance/10.0);
return false;
}
SkillStatusMap::iterator itr = mSkillStatus.find(SkillId);
- if(itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
+ if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return false;
uint32 valueIndex = PLAYER_SKILL_VALUE_INDEX(itr->second.pos);
@@ -5503,15 +5503,15 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
if ( Roll <= Chance )
{
uint32 new_value = SkillValue+step;
- if(new_value > MaxValue)
+ if (new_value > MaxValue)
new_value = MaxValue;
SetUInt32Value(valueIndex,MAKE_SKILL_VALUE(new_value,MaxValue));
- if(itr->second.uState != SKILL_NEW)
+ if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
for (uint32* bsl = &bonusSkillLevels[0]; *bsl; ++bsl)
{
- if((SkillValue < *bsl && new_value >= *bsl))
+ if ((SkillValue < *bsl && new_value >= *bsl))
{
learnSkillRewardedSpells( SkillId, new_value);
break;
@@ -5530,16 +5530,16 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType)
{
// no skill gain in pvp
Unit *pVictim = getVictim();
- if(pVictim && pVictim->GetTypeId() == TYPEID_PLAYER)
+ if (pVictim && pVictim->GetTypeId() == TYPEID_PLAYER)
return;
- if(IsInFeralForm())
+ if (IsInFeralForm())
return; // always maximized SKILL_FERAL_COMBAT in fact
- if(m_form == FORM_TREE)
+ if (m_form == FORM_TREE)
return; // use weapon but not skill up
- if(pVictim && pVictim->GetTypeId() == TYPEID_UNIT && (pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN))
+ if (pVictim && pVictim->GetTypeId() == TYPEID_UNIT && (pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN))
return;
uint32 weapon_skill_gain = sWorld.getConfig(CONFIG_SKILL_GAIN_WEAPON);
@@ -5552,7 +5552,7 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType)
if (!tmpitem)
UpdateSkill(SKILL_UNARMED,weapon_skill_gain);
- else if(tmpitem->GetProto()->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
+ else if (tmpitem->GetProto()->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
UpdateSkill(tmpitem->GetSkill(),weapon_skill_gain);
break;
}
@@ -5573,7 +5573,7 @@ void Player::UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, bool de
uint8 plevel = getLevel(); // if defense than pVictim == attacker
uint8 greylevel = Trinity::XP::GetGrayLevel(plevel);
uint8 moblevel = pVictim->getLevelForTarget(this);
- if(moblevel < greylevel)
+ if (moblevel < greylevel)
return;
if (moblevel > plevel + 5)
@@ -5608,7 +5608,7 @@ void Player::UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, bool de
void Player::ModifySkillBonus(uint32 skillid,int32 val, bool talent)
{
SkillStatusMap::const_iterator itr = mSkillStatus.find(skillid);
- if(itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
+ if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return;
uint32 bonusIndex = PLAYER_SKILL_BONUS_INDEX(itr->second.pos);
@@ -5617,7 +5617,7 @@ void Player::ModifySkillBonus(uint32 skillid,int32 val, bool talent)
int16 temp_bonus = SKILL_TEMP_BONUS(bonus_val);
int16 perm_bonus = SKILL_PERM_BONUS(bonus_val);
- if(talent) // permanent bonus stored in high part
+ if (talent) // permanent bonus stored in high part
SetUInt32Value(bonusIndex,MAKE_SKILL_BONUS(temp_bonus,perm_bonus+val));
else // temporary/item bonus stored in low part
SetUInt32Value(bonusIndex,MAKE_SKILL_BONUS(temp_bonus+val,perm_bonus));
@@ -5632,7 +5632,7 @@ void Player::UpdateSkillsForLevel()
for (SkillStatusMap::iterator itr = mSkillStatus.begin(); itr != mSkillStatus.end(); ++itr)
{
- if(itr->second.uState == SKILL_DELETED)
+ if (itr->second.uState == SKILL_DELETED)
continue;
uint32 pskill = itr->first;
@@ -5655,13 +5655,13 @@ void Player::UpdateSkillsForLevel()
if (alwaysMaxSkill)
{
SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(maxSkill,maxSkill));
- if(itr->second.uState != SKILL_NEW)
+ if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
}
- else if(max != maxconfskill) /// update max skill value if current max skill not maximized
+ else if (max != maxconfskill) /// update max skill value if current max skill not maximized
{
SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(val,maxSkill));
- if(itr->second.uState != SKILL_NEW)
+ if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
}
}
@@ -5672,7 +5672,7 @@ void Player::UpdateSkillsToMaxSkillsForLevel()
{
for (SkillStatusMap::iterator itr = mSkillStatus.begin(); itr != mSkillStatus.end(); ++itr)
{
- if(itr->second.uState == SKILL_DELETED)
+ if (itr->second.uState == SKILL_DELETED)
continue;
uint32 pskill = itr->first;
@@ -5685,7 +5685,7 @@ void Player::UpdateSkillsToMaxSkillsForLevel()
if (max > 1)
{
SetUInt32Value(valueIndex,MAKE_SKILL_VALUE(max,max));
- if(itr->second.uState != SKILL_NEW)
+ if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
}
if (pskill == SKILL_DEFENSE)
@@ -5703,12 +5703,12 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal)
SkillStatusMap::iterator itr = mSkillStatus.find(id);
//has skill
- if(itr != mSkillStatus.end() && itr->second.uState != SKILL_DELETED)
+ if (itr != mSkillStatus.end() && itr->second.uState != SKILL_DELETED)
{
if (currVal)
{
SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos),MAKE_SKILL_VALUE(currVal,maxVal));
- if(itr->second.uState != SKILL_NEW)
+ if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
learnSkillRewardedSpells(id, currVal);
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL,id);
@@ -5722,14 +5722,14 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal)
SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos),0);
// mark as deleted or simply remove from map if not saved yet
- if(itr->second.uState != SKILL_NEW)
+ if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_DELETED;
else
mSkillStatus.erase(itr);
// remove all spells that related to this skill
for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j)
- if(SkillLineAbilityEntry const *pAbility = sSkillLineAbilityStore.LookupEntry(j))
+ if (SkillLineAbilityEntry const *pAbility = sSkillLineAbilityStore.LookupEntry(j))
if (pAbility->skillId == id)
removeSpell(spellmgr.GetFirstSpellInChain(pAbility->spellId));
}
@@ -5755,7 +5755,7 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal)
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL,id);
// insert new entry or update if not deleted old entry yet
- if(itr != mSkillStatus.end())
+ if (itr != mSkillStatus.end())
{
itr->second.pos = i;
itr->second.uState = SKILL_CHANGED;
@@ -5787,7 +5787,7 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal)
bool Player::HasSkill(uint32 skill) const
{
- if(!skill)
+ if (!skill)
return false;
SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
@@ -5800,7 +5800,7 @@ uint16 Player::GetSkillValue(uint32 skill) const
return 0;
SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
- if(itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
+ if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
uint32 bonus = GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos));
@@ -5817,7 +5817,7 @@ uint16 Player::GetMaxSkillValue(uint32 skill) const
return 0;
SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
- if(itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
+ if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
uint32 bonus = GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos));
@@ -5830,11 +5830,11 @@ uint16 Player::GetMaxSkillValue(uint32 skill) const
uint16 Player::GetPureMaxSkillValue(uint32 skill) const
{
- if(!skill)
+ if (!skill)
return 0;
SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
- if(itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
+ if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
return SKILL_MAX(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos)));
@@ -5842,11 +5842,11 @@ uint16 Player::GetPureMaxSkillValue(uint32 skill) const
uint16 Player::GetBaseSkillValue(uint32 skill) const
{
- if(!skill)
+ if (!skill)
return 0;
SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
- if(itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
+ if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
int32 result = int32(SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
@@ -5856,11 +5856,11 @@ uint16 Player::GetBaseSkillValue(uint32 skill) const
uint16 Player::GetPureSkillValue(uint32 skill) const
{
- if(!skill)
+ if (!skill)
return 0;
SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
- if(itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
+ if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
return SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos)));
@@ -5872,7 +5872,7 @@ int16 Player::GetSkillPermBonusValue(uint32 skill) const
return 0;
SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
- if(itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
+ if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
return SKILL_PERM_BONUS(GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos)));
@@ -5884,7 +5884,7 @@ int16 Player::GetSkillTempBonusValue(uint32 skill) const
return 0;
SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
- if(itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
+ if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
return SKILL_TEMP_BONUS(GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos)));
@@ -5914,13 +5914,13 @@ void Player::SendActionButtons(uint32 state) const
ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type)
{
- if(button >= MAX_ACTION_BUTTONS)
+ if (button >= MAX_ACTION_BUTTONS)
{
sLog.outError( "Action %u not added into button %u for player %s: button must be < 144", action, button, GetName() );
return NULL;
}
- if(action >= MAX_ACTION_BUTTON_ACTION_VALUE)
+ if (action >= MAX_ACTION_BUTTON_ACTION_VALUE)
{
sLog.outError( "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE );
return NULL;
@@ -5973,7 +5973,7 @@ void Player::removeActionButton(uint8 button)
buttonItr->second.canRemoveByClient = true;
return;
}
- if(buttonItr->second.uState==ACTIONBUTTON_NEW)
+ if (buttonItr->second.uState==ACTIONBUTTON_NEW)
m_actionButtons.erase(buttonItr); // new and not saved
else
buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save
@@ -5986,9 +5986,9 @@ bool Player::SetPosition(float x, float y, float z, float orientation, bool tele
if (!Unit::SetPosition(x, y, z, orientation, teleport))
return false;
- //if(movementInfo.flags & MOVEMENTFLAG_MOVING)
+ //if (movementInfo.flags & MOVEMENTFLAG_MOVING)
// mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE);
- //if(movementInfo.flags & MOVEMENTFLAG_TURNING)
+ //if (movementInfo.flags & MOVEMENTFLAG_TURNING)
// mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
//AURA_INTERRUPT_FLAG_JUMP not sure
@@ -5999,7 +5999,7 @@ bool Player::SetPosition(float x, float y, float z, float orientation, bool tele
// code block for underwater state update
UpdateUnderwaterState(GetMap(), x, y, z);
- if(GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE))
+ if (GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE))
GetSession()->SendCancelTrade();
CheckExploreSystem();
@@ -6084,20 +6084,20 @@ void Player::CheckExploreSystem()
if (isInFlight())
return;
- if(!m_AreaID)
+ if (!m_AreaID)
m_AreaID = GetAreaId();
- if(m_AreaID != GetAreaId())
+ if (m_AreaID != GetAreaId())
{
m_AreaID = GetAreaId();
GetSession()->HandleOnAreaChange(GetAreaEntryByAreaID(m_AreaID));
}
uint16 areaFlag = GetBaseMap()->GetAreaFlag(GetPositionX(),GetPositionY(),GetPositionZ());
- if(areaFlag==0xffff)
+ if (areaFlag==0xffff)
return;
int offset = areaFlag / 32;
- if(offset >= 128)
+ if (offset >= 128)
{
sLog.outError("Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < 128 ).",areaFlag,GetPositionX(),GetPositionY(),offset,offset);
return;
@@ -6106,18 +6106,18 @@ void Player::CheckExploreSystem()
uint32 val = (uint32)(1 << (areaFlag % 32));
uint32 currFields = GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
- if( !(currFields & val) )
+ if ( !(currFields & val) )
{
SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, (uint32)(currFields | val));
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA);
AreaTableEntry const *p = GetAreaEntryByAreaFlagAndMap(areaFlag,GetMapId());
- if(!p)
+ if (!p)
{
sLog.outError("PLAYER: Player %u discovered unknown area (x: %f y: %f map: %u", GetGUIDLow(), GetPositionX(),GetPositionY(),GetMapId());
}
- else if(p->area_level > 0)
+ else if (p->area_level > 0)
{
uint32 area = p->ID;
if (getLevel() >= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
@@ -6158,7 +6158,7 @@ void Player::CheckExploreSystem()
uint32 Player::TeamForRace(uint8 race)
{
ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race);
- if(!rEntry)
+ if (!rEntry)
{
sLog.outError("Race %u not found in DBC: wrong DBC files?",uint32(race));
return ALLIANCE;
@@ -6177,7 +6177,7 @@ uint32 Player::TeamForRace(uint8 race)
uint32 Player::getFactionForRace(uint8 race)
{
ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race);
- if(!rEntry)
+ if (!rEntry)
{
sLog.outError("Race %u not found in DBC: wrong DBC files?",uint32(race));
return 0;
@@ -6224,35 +6224,35 @@ int32 Player::CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, in
//Calculates how many reputation points player gains in victim's enemy factions
void Player::RewardReputation(Unit *pVictim, float rate)
{
- if(!pVictim || pVictim->GetTypeId() == TYPEID_PLAYER)
+ if (!pVictim || pVictim->GetTypeId() == TYPEID_PLAYER)
return;
- if(pVictim->ToCreature()->IsReputationGainDisabled())
+ if (pVictim->ToCreature()->IsReputationGainDisabled())
return;
ReputationOnKillEntry const* Rep = objmgr.GetReputationOnKilEntry(pVictim->ToCreature()->GetCreatureInfo()->Entry);
- if(!Rep)
+ if (!Rep)
return;
uint32 ChampioningFaction = 0;
- if(GetChampioningFaction())
+ if (GetChampioningFaction())
{
// support for: Championing - http://www.wowwiki.com/Championing
Map const *pMap = GetMap();
- if(pMap && pMap->IsDungeon())
+ if (pMap && pMap->IsDungeon())
{
bool Heroic = ((InstanceMap*)pMap)->GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC;
InstanceTemplate const *pInstance = objmgr.GetInstanceTemplate(pMap->GetId());
- if(pInstance)
+ if (pInstance)
{
AccessRequirement const *pAccessRequirement = objmgr.GetAccessRequirement(pInstance->access_id);
- if(pAccessRequirement)
+ if (pAccessRequirement)
{
- if(!pMap->IsRaid() && ((!Heroic && pAccessRequirement->levelMin == 80) || (Heroic && pAccessRequirement->heroicLevelMin == 80)))
+ if (!pMap->IsRaid() && ((!Heroic && pAccessRequirement->levelMin == 80) || (Heroic && pAccessRequirement->heroicLevelMin == 80)))
ChampioningFaction = GetChampioningFaction();
}
}
@@ -6264,13 +6264,13 @@ void Player::RewardReputation(Unit *pVictim, float rate)
uint32 team = GetTeam();
float favored_rep_mult = 0;
- if( (HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714) ) favored_rep_mult = 0.25; // Thrallmar's Favor and Honor Hold's Favor
- else if( HasAura(30754) && (Rep->repfaction1 == 609 || Rep->repfaction2 == 609) && !ChampioningFaction ) favored_rep_mult = 0.25; // Cenarion Favor
+ if ( (HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714) ) favored_rep_mult = 0.25; // Thrallmar's Favor and Honor Hold's Favor
+ else if ( HasAura(30754) && (Rep->repfaction1 == 609 || Rep->repfaction2 == 609) && !ChampioningFaction ) favored_rep_mult = 0.25; // Cenarion Favor
- if(favored_rep_mult > 0) favored_rep_mult *= 2; // Multiplied by 2 because the reputation is divided by 2 for some reason (See "donerep1 / 2" and "donerep2 / 2") -- if you know why this is done, please update/explain :)
+ if (favored_rep_mult > 0) favored_rep_mult *= 2; // Multiplied by 2 because the reputation is divided by 2 for some reason (See "donerep1 / 2" and "donerep2 / 2") -- if you know why this is done, please update/explain :)
// Favored reputation increase END
- if(Rep->repfaction1 && (!Rep->team_dependent || team == ALLIANCE))
+ if (Rep->repfaction1 && (!Rep->team_dependent || team == ALLIANCE))
{
int32 donerep1 = CalculateReputationGain(pVictim->getLevel(), Rep->repvalue1, ChampioningFaction ? ChampioningFaction : Rep->repfaction1, false);
donerep1 = int32(donerep1*(rate + favored_rep_mult));
@@ -6283,12 +6283,12 @@ void Player::RewardReputation(Unit *pVictim, float rate)
/*if (factionEntry1 && Rep->is_teamaward1)
{
FactionEntry const *team1_factionEntry = sFactionStore.LookupEntry(factionEntry1->team);
- if(team1_factionEntry)
+ if (team1_factionEntry)
GetReputationMgr().ModifyReputation(team1_factionEntry, donerep1 / 2);
}*/
}
- if(Rep->repfaction2 && (!Rep->team_dependent || team == HORDE))
+ if (Rep->repfaction2 && (!Rep->team_dependent || team == HORDE))
{
int32 donerep2 = CalculateReputationGain(pVictim->getLevel(), Rep->repvalue2, ChampioningFaction ? ChampioningFaction : Rep->repfaction2, false);
donerep2 = int32(donerep2*(rate + favored_rep_mult));
@@ -6301,7 +6301,7 @@ void Player::RewardReputation(Unit *pVictim, float rate)
/*if (factionEntry2 && Rep->is_teamaward2)
{
FactionEntry const *team2_factionEntry = sFactionStore.LookupEntry(factionEntry2->team);
- if(team2_factionEntry)
+ if (team2_factionEntry)
GetReputationMgr().ModifyReputation(team2_factionEntry, donerep2 / 2);
}*/
}
@@ -6356,14 +6356,14 @@ void Player::UpdateHonorFields()
uint64 now = time(NULL);
uint64 today = uint64(time(NULL) / DAY) * DAY;
- if(m_lastHonorUpdateTime < today)
+ if (m_lastHonorUpdateTime < today)
{
uint64 yesterday = today - DAY;
uint16 kills_today = PAIR32_LOPART(GetUInt32Value(PLAYER_FIELD_KILLS));
// update yesterday's contribution
- if(m_lastHonorUpdateTime >= yesterday )
+ if (m_lastHonorUpdateTime >= yesterday )
{
SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION));
@@ -6388,19 +6388,19 @@ void Player::UpdateHonorFields()
bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvptoken)
{
// do not reward honor in arenas, but enable onkill spellproc
- if(InArena())
+ if (InArena())
{
- if(!uVictim || uVictim == this || uVictim->GetTypeId() != TYPEID_PLAYER)
+ if (!uVictim || uVictim == this || uVictim->GetTypeId() != TYPEID_PLAYER)
return false;
- if( GetBGTeam() == uVictim->ToPlayer()->GetBGTeam() )
+ if ( GetBGTeam() == uVictim->ToPlayer()->GetBGTeam() )
return false;
return true;
}
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
- if(HasAura(SPELL_AURA_PLAYER_INACTIVE))
+ if (HasAura(SPELL_AURA_PLAYER_INACTIVE))
return false;
uint64 victim_guid = 0;
@@ -6412,21 +6412,21 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt
UpdateHonorFields();
// do not reward honor in arenas, but return true to enable onkill spellproc
- if(InBattleGround() && GetBattleGround() && GetBattleGround()->isArena())
+ if (InBattleGround() && GetBattleGround() && GetBattleGround()->isArena())
return true;
- if(honor <= 0)
+ if (honor <= 0)
{
- if(!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
+ if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
return false;
victim_guid = uVictim->GetGUID();
- if( uVictim->GetTypeId() == TYPEID_PLAYER )
+ if ( uVictim->GetTypeId() == TYPEID_PLAYER )
{
Player *pVictim = uVictim->ToPlayer();
- if( GetTeam() == pVictim->GetTeam() && !sWorld.IsFFAPvPRealm() )
+ if ( GetTeam() == pVictim->GetTeam() && !sWorld.IsFFAPvPRealm() )
return false;
float f = 1; //need for total kills (?? need more info)
@@ -6459,7 +6459,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt
k_grey = Trinity::XP::GetGrayLevel(k_level);
- if(v_level<=k_grey)
+ if (v_level<=k_grey)
return false;
float diff_level = (k_level == k_grey) ? 1 : ((float(v_level) - float(k_grey)) / (float(k_level) - float(k_grey)));
@@ -6491,7 +6491,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt
{
honor *= sWorld.getRate(RATE_HONOR);
- if(groupsize > 1)
+ if (groupsize > 1)
honor /= groupsize;
// apply honor multiplier from aura (not stacking-get highest)
@@ -6516,16 +6516,16 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt
ApplyModUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, uint32(honor), true);
- if( sWorld.getConfig(CONFIG_PVP_TOKEN_ENABLE) && pvptoken )
+ if ( sWorld.getConfig(CONFIG_PVP_TOKEN_ENABLE) && pvptoken )
{
- if(!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
+ if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
return true;
- if(uVictim->GetTypeId() == TYPEID_PLAYER)
+ if (uVictim->GetTypeId() == TYPEID_PLAYER)
{
// Check if allowed to receive it in current map
uint8 MapType = sWorld.getConfig(CONFIG_PVP_TOKEN_MAP_TYPE);
- if( (MapType == 1 && !InBattleGround() && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
+ if ( (MapType == 1 && !InBattleGround() && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
|| (MapType == 2 && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
|| (MapType == 3 && !InBattleGround()) )
return true;
@@ -6537,10 +6537,10 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt
// check space and find places
ItemPosCountVec dest;
uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount );
- if( msg != EQUIP_ERR_OK ) // convert to possible store amount
+ if ( msg != EQUIP_ERR_OK ) // convert to possible store amount
count = noSpaceForCount;
- if( count == 0 || dest.empty()) // can't add any
+ if ( count == 0 || dest.empty()) // can't add any
{
// -- TODO: Send to mailbox if no space
ChatHandler(this).PSendSysMessage("You don't have any space in your bags for a token.");
@@ -6558,7 +6558,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt
void Player::ModifyHonorPoints(int32 value)
{
- if(value < 0)
+ if (value < 0)
{
if (GetHonorPoints() > sWorld.getConfig(CONFIG_MAX_HONOR_POINTS))
SetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY, sWorld.getConfig(CONFIG_MAX_HONOR_POINTS) + value);
@@ -6571,7 +6571,7 @@ void Player::ModifyHonorPoints(int32 value)
void Player::ModifyArenaPoints(int32 value)
{
- if(value < 0)
+ if (value < 0)
{
if (GetArenaPoints() > sWorld.getConfig(CONFIG_MAX_ARENA_POINTS))
SetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY, sWorld.getConfig(CONFIG_MAX_ARENA_POINTS) + value);
@@ -6585,7 +6585,7 @@ void Player::ModifyArenaPoints(int32 value)
uint32 Player::GetGuildIdFromDB(uint64 guid)
{
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT guildid FROM guild_member WHERE guid='%u'", GUID_LOPART(guid));
- if(!result)
+ if (!result)
return 0;
uint32 id = result->Fetch()[0].GetUInt32();
@@ -6595,7 +6595,7 @@ uint32 Player::GetGuildIdFromDB(uint64 guid)
uint32 Player::GetRankFromDB(uint64 guid)
{
QueryResult_AutoPtr result = CharacterDatabase.PQuery( "SELECT rank FROM guild_member WHERE guid='%u'", GUID_LOPART(guid) );
- if( result )
+ if ( result )
{
uint32 v = result->Fetch()[0].GetUInt32();
return v;
@@ -6607,7 +6607,7 @@ uint32 Player::GetRankFromDB(uint64 guid)
uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type)
{
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT arena_team_member.arenateamid FROM arena_team_member JOIN arena_team ON arena_team_member.arenateamid = arena_team.arenateamid WHERE guid='%u' AND type='%u' LIMIT 1", GUID_LOPART(guid), type);
- if(!result)
+ if (!result)
return 0;
uint32 id = (*result)[0].GetUInt32();
@@ -6627,7 +6627,7 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
{
// stored zone is zero, use generic and slow zone detection
result = CharacterDatabase.PQuery("SELECT map,position_x,position_y,position_z FROM characters WHERE guid='%u'", guidLow);
- if( !result )
+ if ( !result )
return 0;
fields = result->Fetch();
uint32 map = fields[0].GetUInt32();
@@ -6723,7 +6723,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
}
pvpInfo.inNoPvPArea = false;
- if(zone->IsSanctuary()) // in sanctuary
+ if (zone->IsSanctuary()) // in sanctuary
{
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
pvpInfo.inNoPvPArea = true;
@@ -6732,7 +6732,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
else
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
- if(zone->flags & AREA_FLAG_CAPITAL) // in capital city
+ if (zone->flags & AREA_FLAG_CAPITAL) // in capital city
{
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
SetRestType(REST_TYPE_IN_CITY);
@@ -6741,11 +6741,11 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
}
else // anywhere else
{
- if(HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING)) // but resting (walk from city or maybe in tavern or leave tavern recently)
+ if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING)) // but resting (walk from city or maybe in tavern or leave tavern recently)
{
- if(GetRestType() == REST_TYPE_IN_TAVERN) // has been in tavern. Is still in?
+ if (GetRestType() == REST_TYPE_IN_TAVERN) // has been in tavern. Is still in?
{
- if(GetMapId() != GetInnPosMapId() || sqrt((GetPositionX()-GetInnPosX())*(GetPositionX()-GetInnPosX())+(GetPositionY()-GetInnPosY())*(GetPositionY()-GetInnPosY())+(GetPositionZ()-GetInnPosZ())*(GetPositionZ()-GetInnPosZ()))>40)
+ if (GetMapId() != GetInnPosMapId() || sqrt((GetPositionX()-GetInnPosX())*(GetPositionX()-GetInnPosX())+(GetPositionY()-GetInnPosY())*(GetPositionY()-GetInnPosY())+(GetPositionZ()-GetInnPosZ())*(GetPositionZ()-GetInnPosZ()))>40)
{
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
SetRestType(REST_TYPE_NO);
@@ -6876,7 +6876,7 @@ void Player::DuelComplete(DuelCompleteType type)
//Remove Duel Flag object
GameObject* obj = GetMap()->GetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER));
- if(obj)
+ if (obj)
duel->initiator->RemoveGameObject(obj,true);
/* remove auras */
@@ -6901,18 +6901,18 @@ void Player::DuelComplete(DuelCompleteType type)
}
// cleanup combo points
- if(GetComboTarget()==duel->opponent->GetGUID())
+ if (GetComboTarget()==duel->opponent->GetGUID())
ClearComboPoints();
- else if(GetComboTarget()==duel->opponent->GetPetGUID())
+ else if (GetComboTarget()==duel->opponent->GetPetGUID())
ClearComboPoints();
- if(duel->opponent->GetComboTarget()==GetGUID())
+ if (duel->opponent->GetComboTarget()==GetGUID())
duel->opponent->ClearComboPoints();
- else if(duel->opponent->GetComboTarget()==GetPetGUID())
+ else if (duel->opponent->GetComboTarget()==GetPetGUID())
duel->opponent->ClearComboPoints();
// Honor points after duel (the winner) - ImpConfig
- if(uint32 amount = sWorld.getConfig(CONFIG_HONOR_AFTER_DUEL))
+ if (uint32 amount = sWorld.getConfig(CONFIG_HONOR_AFTER_DUEL))
duel->opponent->RewardHonor(NULL,1,amount);
//cleanups
@@ -6931,7 +6931,7 @@ void Player::DuelComplete(DuelCompleteType type)
void Player::_ApplyItemMods(Item *item, uint8 slot,bool apply)
{
- if(slot >= INVENTORY_SLOT_BAG_END || !item)
+ if (slot >= INVENTORY_SLOT_BAG_END || !item)
return;
ItemPrototype const *proto = item->GetProto();
@@ -7006,7 +7006,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
val = proto->ItemStat[i].ItemStatValue;
}
- if(val == 0)
+ if (val == 0)
continue;
switch (statType)
@@ -7157,7 +7157,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
}
// Apply Spell Power from ScalingStatValue if set
- if(ssv)
+ if (ssv)
{
if (int32 spellbonus = ssv->getSpellBonus(proto->ScalingStatValue))
ApplySpellPowerBonus(spellbonus, apply);
@@ -7218,13 +7218,13 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
WeaponAttackType attType = BASE_ATTACK;
float damage = 0.0f;
- if( slot == EQUIPMENT_SLOT_RANGED && (
+ if ( slot == EQUIPMENT_SLOT_RANGED && (
proto->InventoryType == INVTYPE_RANGED || proto->InventoryType == INVTYPE_THROWN ||
proto->InventoryType == INVTYPE_RANGEDRIGHT ))
{
attType = RANGED_ATTACK;
}
- else if(slot==EQUIPMENT_SLOT_OFFHAND)
+ else if (slot==EQUIPMENT_SLOT_OFFHAND)
{
attType = OFF_ATTACK;
}
@@ -7262,27 +7262,27 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
ApplyFeralAPBonus(feral_bonus, apply);
}
// Druids get feral AP bonus from weapon dps (lso use DPS from ScalingStatValue)
- if(getClass() == CLASS_DRUID)
+ if (getClass() == CLASS_DRUID)
{
int32 feral_bonus = proto->getFeralBonus(extraDPS);
if (feral_bonus > 0)
ApplyFeralAPBonus(feral_bonus, apply);
}
- if(IsInFeralForm() || !CanUseAttackType(attType))
+ if (IsInFeralForm() || !CanUseAttackType(attType))
return;
if (proto->Delay)
{
- if(slot == EQUIPMENT_SLOT_RANGED)
+ if (slot == EQUIPMENT_SLOT_RANGED)
SetAttackTime(RANGED_ATTACK, apply ? proto->Delay: BASE_ATTACK_TIME);
- else if(slot==EQUIPMENT_SLOT_MAINHAND)
+ else if (slot==EQUIPMENT_SLOT_MAINHAND)
SetAttackTime(BASE_ATTACK, apply ? proto->Delay: BASE_ATTACK_TIME);
- else if(slot==EQUIPMENT_SLOT_OFFHAND)
+ else if (slot==EQUIPMENT_SLOT_OFFHAND)
SetAttackTime(OFF_ATTACK, apply ? proto->Delay: BASE_ATTACK_TIME);
}
- if(CanModifyStats() && (damage || proto->Delay))
+ if (CanModifyStats() && (damage || proto->Delay))
UpdateDamagePhysical(attType);
}
@@ -7364,11 +7364,11 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType att
void Player::ApplyItemEquipSpell(Item *item, bool apply, bool form_change)
{
- if(!item)
+ if (!item)
return;
ItemPrototype const *proto = item->GetProto();
- if(!proto)
+ if (!proto)
return;
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
@@ -7414,10 +7414,10 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply
}
else
{
- if(form_change) // check aura compatibility
+ if (form_change) // check aura compatibility
{
// Cannot be used in this stance/form
- if(GetErrorAtShapeshiftedCast(spellInfo, m_form)==SPELL_CAST_OK)
+ if (GetErrorAtShapeshiftedCast(spellInfo, m_form)==SPELL_CAST_OK)
return; // and remove only not compatible at form change
}
@@ -7432,7 +7432,7 @@ void Player::UpdateEquipSpellsAtFormChange()
{
for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
{
- if(m_items[i] && !m_items[i]->IsBroken())
+ if (m_items[i] && !m_items[i]->IsBroken())
{
ApplyItemEquipSpell(m_items[i],false,true); // remove spells that not fit to form
ApplyItemEquipSpell(m_items[i],true,true); // add spells that fit form but not active
@@ -7443,13 +7443,13 @@ void Player::UpdateEquipSpellsAtFormChange()
for (size_t setindex = 0; setindex < ItemSetEff.size(); ++setindex)
{
ItemSetEffect* eff = ItemSetEff[setindex];
- if(!eff)
+ if (!eff)
continue;
for (uint32 y=0; y<8; ++y)
{
SpellEntry const* spellInfo = eff->spells[y];
- if(!spellInfo)
+ if (!spellInfo)
continue;
ApplyEquipSpell(spellInfo,NULL,false,true); // remove spells that not fit to form
@@ -7556,10 +7556,10 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32
{
uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot));
SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
- if(!pEnchant) continue;
+ if (!pEnchant) continue;
for (uint8 s = 0; s < 3; ++s)
{
- if(pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
+ if (pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
continue;
SpellEnchantProcEntry const* entry = spellmgr.GetSpellEnchantProcEvent(enchant_id);
@@ -7567,7 +7567,7 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32
if (entry && entry->procEx)
{
// Check hit/crit/dodge/parry requirement
- if((entry->procEx & procEx) == 0)
+ if ((entry->procEx & procEx) == 0)
continue;
}
else
@@ -7589,9 +7589,9 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32
if (entry)
{
- if(entry->PPMChance)
+ if (entry->PPMChance)
chance = GetPPMProcChance(proto->Delay, entry->PPMChance, spellInfo);
- else if(entry->customChance)
+ else if (entry->customChance)
chance = entry->customChance;
}
@@ -7600,7 +7600,7 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32
if (roll_chance_f(chance))
{
- if(IsPositiveSpell(pEnchant->spellid[s]))
+ if (IsPositiveSpell(pEnchant->spellid[s]))
CastSpell(this, pEnchant->spellid[s], true, item);
else
CastSpell(target, pEnchant->spellid[s], true, item);
@@ -7651,7 +7651,7 @@ void Player::CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 c
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellData.SpellId);
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring",proto->ItemId, spellData.SpellId);
continue;
@@ -7675,7 +7675,7 @@ void Player::CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 c
continue;
for (uint8 s = 0; s < 3; ++s)
{
- if(pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_USE_SPELL)
+ if (pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_USE_SPELL)
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(pEnchant->spellid[s]);
@@ -8356,7 +8356,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
case 2257: // Deeprun Tram
break;
case 139: // Eastern Plaguelands
- if(pvp && pvp->GetTypeId() == OUTDOOR_PVP_EP)
+ if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_EP)
pvp->FillInitialWorldStates(data);
else
{
@@ -8590,7 +8590,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
// any of these needs change! the client remembers the prev setting!
// ON EVERY ZONE LEAVE, RESET THE OLD ZONE'S WORLD STATE, BUT AT LEAST THE UI STUFF!
case 3483: // Hellfire Peninsula
- if(pvp && pvp->GetTypeId() == OUTDOOR_PVP_HP)
+ if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_HP)
pvp->FillInitialWorldStates(data);
else
{
@@ -8613,7 +8613,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
}
break;
case 3518: // Nagrand
- if(pvp && pvp->GetTypeId() == OUTDOOR_PVP_NA)
+ if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_NA)
pvp->FillInitialWorldStates(data);
else
{
@@ -8654,7 +8654,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
}
break;
case 3519: // Terokkar Forest
- if(pvp && pvp->GetTypeId() == OUTDOOR_PVP_TF)
+ if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_TF)
pvp->FillInitialWorldStates(data);
else
{
@@ -8688,7 +8688,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
}
break;
case 3521: // Zangarmarsh
- if(pvp && pvp->GetTypeId() == OUTDOOR_PVP_ZM)
+ if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_ZM)
pvp->FillInitialWorldStates(data);
else
{
@@ -8820,7 +8820,7 @@ uint32 Player::GetXPRestBonus(uint32 xp)
{
uint32 rested_bonus = (uint32)GetRestBonus(); // xp for each rested bonus
- if(rested_bonus > xp) // max rested_bonus == xp or (r+x) = 200% xp
+ if (rested_bonus > xp) // max rested_bonus == xp or (r+x) = 200% xp
rested_bonus = xp;
SetRestBonus( GetRestBonus() - rested_bonus);
@@ -9068,7 +9068,7 @@ uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap
for (uint8 i = 0; i < 4; ++i)
if (slots[i] != NULL_SLOT && !GetItemByPos(INVENTORY_SLOT_BAG_0, slots[i]))
// in case 2hand equipped weapon (without titan grip) offhand slot empty but not free
- if(slots[i] != EQUIPMENT_SLOT_OFFHAND || !IsTwoHandUsed())
+ if (slots[i] != EQUIPMENT_SLOT_OFFHAND || !IsTwoHandUsed())
return slots[i];
// if not found free and can swap return first appropriate from used
@@ -9116,7 +9116,7 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const
if (pItem->GetEntry() == item)
{
tempcount += pItem->GetCount();
- if(tempcount >= count)
+ if (tempcount >= count)
return EQUIP_ERR_OK;
}
@@ -9152,7 +9152,7 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const
if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i))
count += pBag->GetItemCount(item,skipItem);
- if(skipItem && skipItem->GetProto()->GemProperties)
+ if (skipItem && skipItem->GetProto()->GemProperties)
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i))
if (pItem != skipItem && pItem->GetProto()->Socket[0].Color)
@@ -9280,33 +9280,33 @@ uint8 Player::GetAttackBySlot( uint8 slot )
bool Player::IsInventoryPos( uint8 bag, uint8 slot )
{
- if( bag == INVENTORY_SLOT_BAG_0 && slot == NULL_SLOT )
+ if ( bag == INVENTORY_SLOT_BAG_0 && slot == NULL_SLOT )
return true;
- if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= INVENTORY_SLOT_ITEM_START && slot < INVENTORY_SLOT_ITEM_END ) )
+ if ( bag == INVENTORY_SLOT_BAG_0 && ( slot >= INVENTORY_SLOT_ITEM_START && slot < INVENTORY_SLOT_ITEM_END ) )
return true;
- if( bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END )
+ if ( bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END )
return true;
- if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END ) )
+ if ( bag == INVENTORY_SLOT_BAG_0 && ( slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END ) )
return true;
return false;
}
bool Player::IsEquipmentPos( uint8 bag, uint8 slot )
{
- if( bag == INVENTORY_SLOT_BAG_0 && ( slot < EQUIPMENT_SLOT_END ) )
+ if ( bag == INVENTORY_SLOT_BAG_0 && ( slot < EQUIPMENT_SLOT_END ) )
return true;
- if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END ) )
+ if ( bag == INVENTORY_SLOT_BAG_0 && ( slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END ) )
return true;
return false;
}
bool Player::IsBankPos( uint8 bag, uint8 slot )
{
- if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= BANK_SLOT_ITEM_START && slot < BANK_SLOT_ITEM_END ) )
+ if ( bag == INVENTORY_SLOT_BAG_0 && ( slot >= BANK_SLOT_ITEM_START && slot < BANK_SLOT_ITEM_END ) )
return true;
- if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END ) )
+ if ( bag == INVENTORY_SLOT_BAG_0 && ( slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END ) )
return true;
- if( bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END )
+ if ( bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END )
return true;
return false;
}
@@ -9315,9 +9315,9 @@ bool Player::IsBagPos( uint16 pos )
{
uint8 bag = pos >> 8;
uint8 slot = pos & 255;
- if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END ) )
+ if ( bag == INVENTORY_SLOT_BAG_0 && ( slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END ) )
return true;
- if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END ) )
+ if ( bag == INVENTORY_SLOT_BAG_0 && ( slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END ) )
return true;
return false;
}
@@ -9325,7 +9325,7 @@ bool Player::IsBagPos( uint16 pos )
bool Player::IsValidPos( uint8 bag, uint8 slot )
{
// post selected
- if(bag == NULL_BAG)
+ if (bag == NULL_BAG)
return true;
if (bag == INVENTORY_SLOT_BAG_0)
@@ -9365,7 +9365,7 @@ bool Player::IsValidPos( uint8 bag, uint8 slot )
if (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)
{
Bag* pBag = (Bag*)GetItemByPos (INVENTORY_SLOT_BAG_0, bag);
- if(!pBag)
+ if (!pBag)
return false;
// any post selected
@@ -9376,10 +9376,10 @@ bool Player::IsValidPos( uint8 bag, uint8 slot )
}
// bank bag content slots
- if( bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END )
+ if ( bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END )
{
Bag* pBag = (Bag*)GetItemByPos (INVENTORY_SLOT_BAG_0, bag);
- if(!pBag)
+ if (!pBag)
return false;
// any post selected
@@ -9399,63 +9399,63 @@ bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++)
{
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
- if( pItem && pItem->GetEntry() == item )
+ if ( pItem && pItem->GetEntry() == item )
{
tempcount += pItem->GetCount();
- if( tempcount >= count )
+ if ( tempcount >= count )
return true;
}
}
for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
{
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
- if( pItem && pItem->GetEntry() == item )
+ if ( pItem && pItem->GetEntry() == item )
{
tempcount += pItem->GetCount();
- if( tempcount >= count )
+ if ( tempcount >= count )
return true;
}
}
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
{
- if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
+ if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
{
for (uint32 j = 0; j < pBag->GetBagSize(); j++)
{
Item* pItem = GetItemByPos( i, j );
- if( pItem && pItem->GetEntry() == item )
+ if ( pItem && pItem->GetEntry() == item )
{
tempcount += pItem->GetCount();
- if( tempcount >= count )
+ if ( tempcount >= count )
return true;
}
}
}
}
- if(inBankAlso)
+ if (inBankAlso)
{
for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++)
{
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
- if( pItem && pItem->GetEntry() == item )
+ if ( pItem && pItem->GetEntry() == item )
{
tempcount += pItem->GetCount();
- if( tempcount >= count )
+ if ( tempcount >= count )
return true;
}
}
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
{
- if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
+ if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
{
for (uint32 j = 0; j < pBag->GetBagSize(); j++)
{
Item* pItem = GetItemByPos( i, j );
- if( pItem && pItem->GetEntry() == item )
+ if ( pItem && pItem->GetEntry() == item )
{
tempcount += pItem->GetCount();
- if( tempcount >= count )
+ if ( tempcount >= count )
return true;
}
}
@@ -9471,14 +9471,14 @@ bool Player::HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except
uint32 tempcount = 0;
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{
- if(i == except_slot)
+ if (i == except_slot)
continue;
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
- if( pItem && pItem->GetEntry() == item)
+ if ( pItem && pItem->GetEntry() == item)
{
tempcount += pItem->GetCount();
- if( tempcount >= count )
+ if ( tempcount >= count )
return true;
}
}
@@ -9488,14 +9488,14 @@ bool Player::HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except
{
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{
- if(i == except_slot)
+ if (i == except_slot)
continue;
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
- if( pItem && pItem->GetProto()->Socket[0].Color)
+ if ( pItem && pItem->GetProto()->Socket[0].Color)
{
tempcount += pItem->GetGemCountWithID(item);
- if( tempcount >= count )
+ if ( tempcount >= count )
return true;
}
}
@@ -9509,7 +9509,7 @@ bool Player::HasItemOrGemWithLimitCategoryEquipped( uint32 limitCategory, uint32
uint32 tempcount = 0;
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{
- if(i == except_slot)
+ if (i == except_slot)
continue;
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
@@ -9523,14 +9523,14 @@ bool Player::HasItemOrGemWithLimitCategoryEquipped( uint32 limitCategory, uint32
if (pProto->ItemLimitCategory == limitCategory)
{
tempcount += pItem->GetCount();
- if( tempcount >= count )
+ if ( tempcount >= count )
return true;
}
- if( pProto->Socket[0].Color)
+ if ( pProto->Socket[0].Color)
{
tempcount += pItem->GetGemCountWithLimitCategory(limitCategory);
- if( tempcount >= count )
+ if ( tempcount >= count )
return true;
}
}
@@ -9614,13 +9614,13 @@ uint8 Player::CountItemWithLimitCategory(uint32 limitCategory, Item* skipItem) c
{
Item *pItem = GetItemByPos( i, j );
- if(!pItem)
+ if (!pItem)
continue;
- if(pItem == skipItem)
+ if (pItem == skipItem)
continue;
- if(pItem->GetProto()->ItemLimitCategory == limitCategory)
+ if (pItem->GetProto()->ItemLimitCategory == limitCategory)
tempcount += pItem->GetCount();
}
}
@@ -9633,7 +9633,7 @@ uint8 Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem,
ItemPrototype const *pProto = objmgr.GetItemPrototype(entry);
if (!pProto)
{
- if(no_space_count)
+ if (no_space_count)
*no_space_count = count;
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
}
@@ -9681,23 +9681,23 @@ bool Player::HasItemTotemCategory( uint32 TotemCategory ) const
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
{
pItem = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, i );
- if( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory ))
+ if ( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory ))
return true;
}
for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
{
pItem = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, i );
- if( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory ))
+ if ( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory ))
return true;
}
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
{
- if(Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
+ if (Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
{
for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
{
pItem = GetUseableItemByPos( i, j );
- if( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory ))
+ if ( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory ))
return true;
}
}
@@ -9821,7 +9821,7 @@ uint8 Player::_CanStoreItem_InBag( uint8 bag, ItemPosCountVec &dest, ItemPrototy
if (pItem2->GetEntry() == pProto->ItemId && pItem2->GetCount() < pProto->GetMaxStackSize())
{
uint32 need_space = pProto->GetMaxStackSize() - pItem2->GetCount();
- if(need_space > count)
+ if (need_space > count)
need_space = count;
ItemPosCount newPosition = ItemPosCount((bag << 8) | j, need_space);
@@ -10039,7 +10039,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
}
// search free slot in bag for place to
- if(bag == INVENTORY_SLOT_BAG_0) // inventory
+ if (bag == INVENTORY_SLOT_BAG_0) // inventory
{
// search free slot - keyring case
if (pProto->BagFamily & BAG_FAMILY_MASK_KEYS)
@@ -10377,7 +10377,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
{
- if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
+ if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
{
for (uint32 j = 0; j < pBag->GetBagSize(); j++)
{
@@ -10402,11 +10402,11 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
ItemPrototype const *pProto = pItem->GetProto();
// strange item
- if( !pProto )
+ if ( !pProto )
return EQUIP_ERR_ITEM_NOT_FOUND;
// item it 'bind'
- if(pItem->IsBindedNotWith(this))
+ if (pItem->IsBindedNotWith(this))
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
Bag *pBag;
@@ -10414,18 +10414,18 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
// item is 'one item only'
uint8 res = CanTakeMoreSimilarItems(pItem);
- if(res != EQUIP_ERR_OK)
+ if (res != EQUIP_ERR_OK)
return res;
// search stack for merge to
- if( pProto->Stackable != 1 )
+ if ( pProto->Stackable != 1 )
{
bool b_found = false;
for (int t = KEYRING_SLOT_START; t < KEYRING_SLOT_END; ++t)
{
pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t );
- if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_keys[t-KEYRING_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
+ if ( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_keys[t-KEYRING_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
{
inv_keys[t-KEYRING_SLOT_START] += pItem->GetCount();
b_found = true;
@@ -10437,7 +10437,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
for (int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t)
{
pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t );
- if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_tokens[t-CURRENCYTOKEN_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
+ if ( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_tokens[t-CURRENCYTOKEN_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
{
inv_tokens[t-CURRENCYTOKEN_SLOT_START] += pItem->GetCount();
b_found = true;
@@ -10449,7 +10449,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
for (int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t)
{
pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t );
- if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_slot_items[t-INVENTORY_SLOT_ITEM_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
+ if ( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_slot_items[t-INVENTORY_SLOT_ITEM_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
{
inv_slot_items[t-INVENTORY_SLOT_ITEM_START] += pItem->GetCount();
b_found = true;
@@ -10461,12 +10461,12 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
{
pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t );
- if( pBag && ItemCanGoIntoBag(pItem->GetProto(), pBag->GetProto()))
+ if ( pBag && ItemCanGoIntoBag(pItem->GetProto(), pBag->GetProto()))
{
for (uint32 j = 0; j < pBag->GetBagSize(); j++)
{
pItem2 = GetItemByPos( t, j );
- if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_bags[t-INVENTORY_SLOT_BAG_START][j] + pItem->GetCount() <= pProto->GetMaxStackSize())
+ if ( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_bags[t-INVENTORY_SLOT_BAG_START][j] + pItem->GetCount() <= pProto->GetMaxStackSize())
{
inv_bags[t-INVENTORY_SLOT_BAG_START][j] += pItem->GetCount();
b_found = true;
@@ -10479,15 +10479,15 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
}
// special bag case
- if( pProto->BagFamily )
+ if ( pProto->BagFamily )
{
bool b_found = false;
- if(pProto->BagFamily & BAG_FAMILY_MASK_KEYS)
+ if (pProto->BagFamily & BAG_FAMILY_MASK_KEYS)
{
uint32 keyringSize = GetMaxKeyringSize();
for (uint32 t = KEYRING_SLOT_START; t < KEYRING_SLOT_START+keyringSize; ++t)
{
- if( inv_keys[t-KEYRING_SLOT_START] == 0 )
+ if ( inv_keys[t-KEYRING_SLOT_START] == 0 )
{
inv_keys[t-KEYRING_SLOT_START] = 1;
b_found = true;
@@ -10498,11 +10498,11 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
if (b_found) continue;
- if(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
+ if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
{
for (uint32 t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t)
{
- if( inv_tokens[t-CURRENCYTOKEN_SLOT_START] == 0 )
+ if ( inv_tokens[t-CURRENCYTOKEN_SLOT_START] == 0 )
{
inv_tokens[t-CURRENCYTOKEN_SLOT_START] = 1;
b_found = true;
@@ -10516,17 +10516,17 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
{
pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t );
- if( pBag )
+ if ( pBag )
{
pBagProto = pBag->GetProto();
// not plain container check
- if( pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER) &&
+ if ( pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER) &&
ItemCanGoIntoBag(pProto,pBagProto) )
{
for (uint32 j = 0; j < pBag->GetBagSize(); j++)
{
- if( inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0 )
+ if ( inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0 )
{
inv_bags[t-INVENTORY_SLOT_BAG_START][j] = 1;
b_found = true;
@@ -10543,7 +10543,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
bool b_found = false;
for (int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t)
{
- if( inv_slot_items[t-INVENTORY_SLOT_ITEM_START] == 0 )
+ if ( inv_slot_items[t-INVENTORY_SLOT_ITEM_START] == 0 )
{
inv_slot_items[t-INVENTORY_SLOT_ITEM_START] = 1;
b_found = true;
@@ -10556,17 +10556,17 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
{
pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t );
- if( pBag )
+ if ( pBag )
{
pBagProto = pBag->GetProto();
// special bag already checked
- if( pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER))
+ if ( pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER))
continue;
for (uint32 j = 0; j < pBag->GetBagSize(); j++)
{
- if( inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0 )
+ if ( inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0 )
{
inv_bags[t-INVENTORY_SLOT_BAG_START][j] = 1;
b_found = true;
@@ -10589,7 +10589,7 @@ uint8 Player::CanEquipNewItem( uint8 slot, uint16 &dest, uint32 item, bool swap
{
dest = 0;
Item *pItem = Item::CreateItem( item, 1, this );
- if( pItem )
+ if ( pItem )
{
uint8 result = CanEquipItem(slot, dest, pItem, swap );
delete pItem;
@@ -10602,22 +10602,22 @@ uint8 Player::CanEquipNewItem( uint8 slot, uint16 &dest, uint32 item, bool swap
uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading ) const
{
dest = 0;
- if( pItem )
+ if ( pItem )
{
sLog.outDebug( "STORAGE: CanEquipItem slot = %u, item = %u, count = %u", slot, pItem->GetEntry(), pItem->GetCount());
ItemPrototype const *pProto = pItem->GetProto();
- if( pProto )
+ if ( pProto )
{
- if(pItem->IsBindedNotWith(this))
+ if (pItem->IsBindedNotWith(this))
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
// check count of items (skip for auto move for same player from bank)
uint8 res = CanTakeMoreSimilarItems(pItem);
- if(res != EQUIP_ERR_OK)
+ if (res != EQUIP_ERR_OK)
return res;
// check this only in game
- if(not_loading)
+ if (not_loading)
{
// May be here should be more stronger checks; STUNNED checked
// ROOT, CONFUSED, DISTRACTED, FLEEING this needs to be checked.
@@ -10627,20 +10627,20 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
// do not allow equipping gear except weapons, offhands, projectiles, relics in
// - combat
// - in-progress arenas
- if( !pProto->CanChangeEquipStateInCombat() )
+ if ( !pProto->CanChangeEquipStateInCombat() )
{
- if( isInCombat() )
+ if ( isInCombat() )
return EQUIP_ERR_NOT_IN_COMBAT;
- if(BattleGround* bg = GetBattleGround())
- if( bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS )
+ if (BattleGround* bg = GetBattleGround())
+ if ( bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS )
return EQUIP_ERR_NOT_DURING_ARENA_MATCH;
}
- if(isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer != 0)
+ if (isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer != 0)
return EQUIP_ERR_CANT_DO_RIGHT_NOW; // maybe exist better err
- if(IsNonMeleeSpellCasted(false))
+ if (IsNonMeleeSpellCasted(false))
return EQUIP_ERR_CANT_DO_RIGHT_NOW;
}
@@ -10736,35 +10736,35 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
uint8 Player::CanUnequipItem( uint16 pos, bool swap ) const
{
// Applied only to equipped items and bank bags
- if(!IsEquipmentPos(pos) && !IsBagPos(pos))
+ if (!IsEquipmentPos(pos) && !IsBagPos(pos))
return EQUIP_ERR_OK;
Item* pItem = GetItemByPos(pos);
// Applied only to existed equipped item
- if( !pItem )
+ if ( !pItem )
return EQUIP_ERR_OK;
sLog.outDebug( "STORAGE: CanUnequipItem slot = %u, item = %u, count = %u", pos, pItem->GetEntry(), pItem->GetCount());
ItemPrototype const *pProto = pItem->GetProto();
- if( !pProto )
+ if ( !pProto )
return EQUIP_ERR_ITEM_NOT_FOUND;
// do not allow unequipping gear except weapons, offhands, projectiles, relics in
// - combat
// - in-progress arenas
- if( !pProto->CanChangeEquipStateInCombat() )
+ if ( !pProto->CanChangeEquipStateInCombat() )
{
- if( isInCombat() )
+ if ( isInCombat() )
return EQUIP_ERR_NOT_IN_COMBAT;
- if(BattleGround* bg = GetBattleGround())
- if( bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS )
+ if (BattleGround* bg = GetBattleGround())
+ if ( bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS )
return EQUIP_ERR_NOT_DURING_ARENA_MATCH;
}
- if(!swap && pItem->IsBag() && !((Bag*)pItem)->IsEmpty())
+ if (!swap && pItem->IsBag() && !((Bag*)pItem)->IsEmpty())
return EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS;
return EQUIP_ERR_OK;
@@ -10822,61 +10822,61 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p
// not specific slot or have space for partly store only in specific slot
// in specific bag
- if( bag != NULL_BAG )
+ if ( bag != NULL_BAG )
{
- if( pProto->InventoryType == INVTYPE_BAG )
+ if ( pProto->InventoryType == INVTYPE_BAG )
{
Bag *pBag = (Bag*)pItem;
- if( pBag && !pBag->IsEmpty() )
+ if ( pBag && !pBag->IsEmpty() )
return EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG;
}
// search stack in bag for merge to
- if( pProto->Stackable != 1 )
+ if ( pProto->Stackable != 1 )
{
- if( bag == INVENTORY_SLOT_BAG_0 )
+ if ( bag == INVENTORY_SLOT_BAG_0 )
{
res = _CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START,BANK_SLOT_ITEM_END,dest,pProto,count,true,pItem,bag,slot);
- if(res!=EQUIP_ERR_OK)
+ if (res!=EQUIP_ERR_OK)
return res;
- if(count==0)
+ if (count==0)
return EQUIP_ERR_OK;
}
else
{
res = _CanStoreItem_InBag(bag,dest,pProto,count,true,false,pItem,NULL_BAG,slot);
- if(res!=EQUIP_ERR_OK)
+ if (res!=EQUIP_ERR_OK)
res = _CanStoreItem_InBag(bag,dest,pProto,count,true,true,pItem,NULL_BAG,slot);
- if(res!=EQUIP_ERR_OK)
+ if (res!=EQUIP_ERR_OK)
return res;
- if(count==0)
+ if (count==0)
return EQUIP_ERR_OK;
}
}
// search free slot in bag
- if( bag == INVENTORY_SLOT_BAG_0 )
+ if ( bag == INVENTORY_SLOT_BAG_0 )
{
res = _CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START,BANK_SLOT_ITEM_END,dest,pProto,count,false,pItem,bag,slot);
- if(res!=EQUIP_ERR_OK)
+ if (res!=EQUIP_ERR_OK)
return res;
- if(count==0)
+ if (count==0)
return EQUIP_ERR_OK;
}
else
{
res = _CanStoreItem_InBag(bag, dest, pProto, count, false, false, pItem, NULL_BAG, slot);
- if(res != EQUIP_ERR_OK)
+ if (res != EQUIP_ERR_OK)
res = _CanStoreItem_InBag(bag, dest, pProto, count, false, true, pItem, NULL_BAG, slot);
- if(res != EQUIP_ERR_OK)
+ if (res != EQUIP_ERR_OK)
return res;
- if(count == 0)
+ if (count == 0)
return EQUIP_ERR_OK;
}
}
@@ -10884,26 +10884,26 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p
// not specific bag or have space for partly store only in specific bag
// search stack for merge to
- if( pProto->Stackable != 1 )
+ if ( pProto->Stackable != 1 )
{
// in slots
res = _CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START,BANK_SLOT_ITEM_END,dest,pProto,count,true,pItem,bag,slot);
- if(res != EQUIP_ERR_OK)
+ if (res != EQUIP_ERR_OK)
return res;
- if(count == 0)
+ if (count == 0)
return EQUIP_ERR_OK;
// in special bags
- if( pProto->BagFamily )
+ if ( pProto->BagFamily )
{
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
{
res = _CanStoreItem_InBag(i,dest,pProto,count,true,false,pItem,bag,slot);
- if(res!=EQUIP_ERR_OK)
+ if (res!=EQUIP_ERR_OK)
continue;
- if(count==0)
+ if (count==0)
return EQUIP_ERR_OK;
}
}
@@ -10911,43 +10911,43 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
{
res = _CanStoreItem_InBag(i,dest,pProto,count,true,true,pItem,bag,slot);
- if(res!=EQUIP_ERR_OK)
+ if (res!=EQUIP_ERR_OK)
continue;
- if(count==0)
+ if (count==0)
return EQUIP_ERR_OK;
}
}
// search free place in special bag
- if( pProto->BagFamily )
+ if ( pProto->BagFamily )
{
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
{
res = _CanStoreItem_InBag(i,dest,pProto,count,false,false,pItem,bag,slot);
- if(res!=EQUIP_ERR_OK)
+ if (res!=EQUIP_ERR_OK)
continue;
- if(count==0)
+ if (count==0)
return EQUIP_ERR_OK;
}
}
// search free space
res = _CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START,BANK_SLOT_ITEM_END,dest,pProto,count,false,pItem,bag,slot);
- if(res!=EQUIP_ERR_OK)
+ if (res!=EQUIP_ERR_OK)
return res;
- if(count==0)
+ if (count==0)
return EQUIP_ERR_OK;
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
{
res = _CanStoreItem_InBag(i,dest,pProto,count,false,true,pItem,bag,slot);
- if(res!=EQUIP_ERR_OK)
+ if (res!=EQUIP_ERR_OK)
continue;
- if(count==0)
+ if (count==0)
return EQUIP_ERR_OK;
}
return EQUIP_ERR_BANK_FULL;
@@ -11030,20 +11030,20 @@ bool Player::CanUseItem( ItemPrototype const *pProto )
{
// Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player
- if( pProto )
+ if ( pProto )
{
- if( (pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0 )
+ if ( (pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0 )
return false;
- if( pProto->RequiredSkill != 0 )
+ if ( pProto->RequiredSkill != 0 )
{
- if( GetSkillValue( pProto->RequiredSkill ) == 0 )
+ if ( GetSkillValue( pProto->RequiredSkill ) == 0 )
return false;
- else if( GetSkillValue( pProto->RequiredSkill ) < pProto->RequiredSkillRank )
+ else if ( GetSkillValue( pProto->RequiredSkill ) < pProto->RequiredSkillRank )
return false;
}
- if( pProto->RequiredSpell != 0 && !HasSpell( pProto->RequiredSpell ) )
+ if ( pProto->RequiredSpell != 0 && !HasSpell( pProto->RequiredSpell ) )
return false;
- if( getLevel() < pProto->RequiredLevel )
+ if ( getLevel() < pProto->RequiredLevel )
return false;
return true;
}
@@ -11053,34 +11053,34 @@ bool Player::CanUseItem( ItemPrototype const *pProto )
uint8 Player::CanUseAmmo( uint32 item ) const
{
sLog.outDebug( "STORAGE: CanUseAmmo item = %u", item);
- if( !isAlive() )
+ if ( !isAlive() )
return EQUIP_ERR_YOU_ARE_DEAD;
- //if( isStunned() )
+ //if ( isStunned() )
// return EQUIP_ERR_YOU_ARE_STUNNED;
ItemPrototype const *pProto = objmgr.GetItemPrototype( item );
- if( pProto )
+ if ( pProto )
{
- if( pProto->InventoryType!= INVTYPE_AMMO )
+ if ( pProto->InventoryType!= INVTYPE_AMMO )
return EQUIP_ERR_ONLY_AMMO_CAN_GO_HERE;
- if( (pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0 )
+ if ( (pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0 )
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
- if( pProto->RequiredSkill != 0 )
+ if ( pProto->RequiredSkill != 0 )
{
- if( GetSkillValue( pProto->RequiredSkill ) == 0 )
+ if ( GetSkillValue( pProto->RequiredSkill ) == 0 )
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
- else if( GetSkillValue( pProto->RequiredSkill ) < pProto->RequiredSkillRank )
+ else if ( GetSkillValue( pProto->RequiredSkill ) < pProto->RequiredSkillRank )
return EQUIP_ERR_ERR_CANT_EQUIP_SKILL;
}
- if( pProto->RequiredSpell != 0 && !HasSpell( pProto->RequiredSpell ) )
+ if ( pProto->RequiredSpell != 0 && !HasSpell( pProto->RequiredSpell ) )
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
- /*if( GetReputationMgr().GetReputation() < pProto->RequiredReputation )
+ /*if ( GetReputationMgr().GetReputation() < pProto->RequiredReputation )
return EQUIP_ERR_CANT_EQUIP_REPUTATION;
*/
- if( getLevel() < pProto->RequiredLevel )
+ if ( getLevel() < pProto->RequiredLevel )
return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
// Requires No Ammo
- if(HasAura(46699))
+ if (HasAura(46699))
return EQUIP_ERR_BAG_FULL6;
return EQUIP_ERR_OK;
@@ -11090,18 +11090,18 @@ uint8 Player::CanUseAmmo( uint32 item ) const
void Player::SetAmmo( uint32 item )
{
- if(!item)
+ if (!item)
return;
// already set
- if( GetUInt32Value(PLAYER_AMMO_ID) == item )
+ if ( GetUInt32Value(PLAYER_AMMO_ID) == item )
return;
// check ammo
- if(item)
+ if (item)
{
uint8 msg = CanUseAmmo( item );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
SendEquipError( msg, NULL, NULL );
return;
@@ -11119,7 +11119,7 @@ void Player::RemoveAmmo()
m_ammoDPS = 0.0f;
- if(CanModifyStats())
+ if (CanModifyStats())
UpdateDamagePhysical(RANGED_ATTACK);
}
@@ -11131,11 +11131,11 @@ Item* Player::StoreNewItem( ItemPosCountVec const& dest, uint32 item, bool updat
count += itr->count;
Item *pItem = Item::CreateItem( item, count, this );
- if( pItem )
+ if ( pItem )
{
ItemAddedQuestCheck( item, count );
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, count);
- if(randomPropertyId)
+ if (randomPropertyId)
pItem->SetItemRandomProperties(randomPropertyId);
pItem = StoreItem( dest, pItem, update );
}
@@ -11144,7 +11144,7 @@ Item* Player::StoreNewItem( ItemPosCountVec const& dest, uint32 item, bool updat
Item* Player::StoreItem( ItemPosCountVec const& dest, Item* pItem, bool update )
{
- if( !pItem )
+ if ( !pItem )
return NULL;
Item* lastItem = pItem;
@@ -11156,7 +11156,7 @@ Item* Player::StoreItem( ItemPosCountVec const& dest, Item* pItem, bool update )
++itr;
- if(itr == dest.end())
+ if (itr == dest.end())
{
lastItem = _StoreItem(pos,pItem,count,false,update);
break;
@@ -11171,7 +11171,7 @@ Item* Player::StoreItem( ItemPosCountVec const& dest, Item* pItem, bool update )
// Return stored item (if stored to stack, it can diff. from pItem). And pItem ca be deleted in this case.
Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, bool update )
{
- if( !pItem )
+ if ( !pItem )
return NULL;
uint8 bag = pos >> 8;
@@ -11221,7 +11221,7 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo
else if (Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag ))
{
pBag->StoreItem( slot, pItem, update );
- if( IsInWorld() && update )
+ if ( IsInWorld() && update )
{
pItem->AddToWorld();
pItem->SendUpdateToPlayer( this );
@@ -11294,21 +11294,21 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update )
Item *pItem2 = GetItemByPos( bag, slot );
- if( !pItem2 )
+ if ( !pItem2 )
{
VisualizeItem( slot, pItem);
- if(isAlive())
+ if (isAlive())
{
ItemPrototype const *pProto = pItem->GetProto();
// item set bonuses applied only at equip and removed at unequip, and still active for broken items
- if(pProto && pProto->ItemSet)
+ if (pProto && pProto->ItemSet)
AddItemsSetItem(this, pItem);
_ApplyItemMods(pItem, slot, true);
- if(pProto && isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer == 0)
+ if (pProto && isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer == 0)
{
uint32 cooldownSpell = 6119;
@@ -11333,7 +11333,7 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update )
}
}
- if( IsInWorld() && update )
+ if ( IsInWorld() && update )
{
pItem->AddToWorld();
pItem->SendUpdateToPlayer( this );
@@ -11343,10 +11343,10 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update )
// update expertise and armor penetration - passive auras may need it
- if( slot == EQUIPMENT_SLOT_MAINHAND )
+ if ( slot == EQUIPMENT_SLOT_MAINHAND )
UpdateExpertise(BASE_ATTACK);
- else if( slot == EQUIPMENT_SLOT_OFFHAND )
+ else if ( slot == EQUIPMENT_SLOT_OFFHAND )
UpdateExpertise(OFF_ATTACK);
switch(slot)
@@ -11362,12 +11362,12 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update )
else
{
pItem2->SetCount( pItem2->GetCount() + pItem->GetCount() );
- if( IsInWorld() && update )
+ if ( IsInWorld() && update )
pItem2->SendUpdateToPlayer( this );
// delete item (it not in any slot currently)
//pItem->DeleteFromDB();
- if( IsInWorld() && update )
+ if ( IsInWorld() && update )
{
pItem->RemoveFromWorld();
pItem->DestroyForPlayer( this );
@@ -11395,7 +11395,7 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update )
void Player::QuickEquipItem( uint16 pos, Item *pItem)
{
- if( pItem )
+ if ( pItem )
{
AddEnchantmentDurations(pItem);
AddItemDurations(pItem);
@@ -11403,7 +11403,7 @@ void Player::QuickEquipItem( uint16 pos, Item *pItem)
uint8 slot = pos & 255;
VisualizeItem( slot, pItem);
- if( IsInWorld() )
+ if ( IsInWorld() )
{
pItem->AddToWorld();
pItem->SendUpdateToPlayer( this );
@@ -11416,7 +11416,7 @@ void Player::QuickEquipItem( uint16 pos, Item *pItem)
void Player::SetVisibleItemSlot(uint8 slot, Item *pItem)
{
- if(pItem)
+ if (pItem)
{
SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (slot * 2), pItem->GetEntry());
SetUInt16Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (slot * 2), 0, pItem->GetEnchantmentId(PERM_ENCHANTMENT_SLOT));
@@ -11431,11 +11431,11 @@ void Player::SetVisibleItemSlot(uint8 slot, Item *pItem)
void Player::VisualizeItem( uint8 slot, Item *pItem)
{
- if(!pItem)
+ if (!pItem)
return;
// check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory)
- if( pItem->GetProto()->Bonding == BIND_WHEN_EQUIPED || pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetProto()->Bonding == BIND_QUEST_ITEM )
+ if ( pItem->GetProto()->Bonding == BIND_WHEN_EQUIPED || pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetProto()->Bonding == BIND_QUEST_ITEM )
pItem->SetBinding( true );
sLog.outDebug( "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry());
@@ -11447,7 +11447,7 @@ void Player::VisualizeItem( uint8 slot, Item *pItem)
pItem->SetSlot( slot );
pItem->SetContainer( NULL );
- if( slot < EQUIPMENT_SLOT_END )
+ if ( slot < EQUIPMENT_SLOT_END )
SetVisibleItemSlot(slot, pItem);
pItem->SetState(ITEM_CHANGED, this);
@@ -11475,13 +11475,13 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update)
ItemPrototype const *pProto = pItem->GetProto();
// item set bonuses applied only at equip and removed at unequip, and still active for broken items
- if(pProto && pProto->ItemSet)
+ if (pProto && pProto->ItemSet)
RemoveItemsSetItem(this, pProto);
_ApplyItemMods(pItem, slot, false);
// remove item dependent auras and casts (only weapon and armor slots)
- if(slot < EQUIPMENT_SLOT_END)
+ if (slot < EQUIPMENT_SLOT_END)
{
RemoveItemDependentAurasAndCasts(pItem);
@@ -11533,7 +11533,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update)
pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, 0);
// pItem->SetUInt64Value(ITEM_FIELD_OWNER, 0); not clear owner at remove (it will be set at store). This used in mail and auction code
pItem->SetSlot(NULL_SLOT);
- if(IsInWorld() && update)
+ if (IsInWorld() && update)
pItem->SendUpdateToPlayer(this);
}
}
@@ -11541,13 +11541,13 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update)
// Common operation need to remove item from inventory without delete in trade, auction, guild bank, mail....
void Player::MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
{
- if(Item* it = GetItemByPos(bag,slot))
+ if (Item* it = GetItemByPos(bag,slot))
{
ItemRemovedQuestCheck(it->GetEntry(), it->GetCount());
RemoveItem(bag, slot, update);
it->SetNotRefundable(this, false);
it->RemoveFromUpdateQueueOf(this);
- if(it->IsInWorld())
+ if (it->IsInWorld())
{
it->RemoveFromWorld();
it->DestroyForPlayer(this);
@@ -11566,10 +11566,10 @@ void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool
Item* pLastItem = StoreItem(dest, pItem, update);
// only set if not merged to existed stack (pItem can be deleted already but we can compare pointers any way)
- if(pLastItem == pItem)
+ if (pLastItem == pItem)
{
// update owner for last item (this can be original item with wrong owner
- if(pLastItem->GetOwnerGUID() != GetGUID())
+ if (pLastItem->GetOwnerGUID() != GetGUID())
pLastItem->SetOwnerGUID(GetGUID());
// if this original item then it need create record in inventory
@@ -11581,7 +11581,7 @@ void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool
void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
{
Item *pItem = GetItemByPos(bag, slot);
- if(pItem)
+ if (pItem)
{
sLog.outDebug( "STORAGE: DestroyItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry());
@@ -11648,7 +11648,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
m_items[slot] = NULL;
}
- else if(Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag ))
+ else if (Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag ))
pBag->RemoveItem(slot, update);
if (IsInWorld() && update)
@@ -11729,11 +11729,11 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
// in inventory bags
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
{
- if(Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
+ if (Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
{
for (uint32 j = 0; j < pBag->GetBagSize(); j++)
{
- if(Item* pItem = pBag->GetItemByPos(j))
+ if (Item* pItem = pBag->GetItemByPos(j))
{
if (pItem->GetEntry() == item)
{
@@ -11887,12 +11887,12 @@ Item* Player::GetItemByEntry(uint32 entry) const
void Player::DestroyItemCount( Item* pItem, uint32 &count, bool update )
{
- if(!pItem)
+ if (!pItem)
return;
sLog.outDebug( "STORAGE: DestroyItemCount item (GUID: %u, Entry: %u) count = %u", pItem->GetGUIDLow(),pItem->GetEntry(), count);
- if( pItem->GetCount() <= count )
+ if ( pItem->GetCount() <= count )
{
count -= pItem->GetCount();
@@ -11903,7 +11903,7 @@ void Player::DestroyItemCount( Item* pItem, uint32 &count, bool update )
ItemRemovedQuestCheck( pItem->GetEntry(), count);
pItem->SetCount( pItem->GetCount() - count );
count = 0;
- if( IsInWorld() & update )
+ if ( IsInWorld() & update )
pItem->SendUpdateToPlayer( this );
pItem->SetState(ITEM_CHANGED, this);
}
@@ -11918,27 +11918,27 @@ void Player::SplitItem( uint16 src, uint16 dst, uint32 count )
uint8 dstslot = dst & 255;
Item *pSrcItem = GetItemByPos( srcbag, srcslot );
- if( !pSrcItem )
+ if ( !pSrcItem )
{
SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, NULL );
return;
}
// not let split all items (can be only at cheating)
- if(pSrcItem->GetCount() == count)
+ if (pSrcItem->GetCount() == count)
{
SendEquipError( EQUIP_ERR_COULDNT_SPLIT_ITEMS, pSrcItem, NULL );
return;
}
// not let split more existed items (can be only at cheating)
- if(pSrcItem->GetCount() < count)
+ if (pSrcItem->GetCount() < count)
{
SendEquipError( EQUIP_ERR_TRIED_TO_SPLIT_MORE_THAN_COUNT, pSrcItem, NULL );
return;
}
- if(pSrcItem->m_lootGenerated) // prevent split looting item (item
+ if (pSrcItem->m_lootGenerated) // prevent split looting item (item
{
//best error message found for attempting to split while looting
SendEquipError( EQUIP_ERR_COULDNT_SPLIT_ITEMS, pSrcItem, NULL );
@@ -11947,20 +11947,20 @@ void Player::SplitItem( uint16 src, uint16 dst, uint32 count )
sLog.outDebug( "STORAGE: SplitItem bag = %u, slot = %u, item = %u, count = %u", dstbag, dstslot, pSrcItem->GetEntry(), count);
Item *pNewItem = pSrcItem->CloneItem( count, this );
- if( !pNewItem )
+ if ( !pNewItem )
{
SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, NULL );
return;
}
- if( IsInventoryPos( dst ) )
+ if ( IsInventoryPos( dst ) )
{
// change item amount before check (for unique max count check)
pSrcItem->SetCount( pSrcItem->GetCount() - count );
ItemPosCountVec dest;
uint8 msg = CanStoreItem( dstbag, dstslot, dest, pNewItem, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
delete pNewItem;
pSrcItem->SetCount( pSrcItem->GetCount() + count );
@@ -11968,19 +11968,19 @@ void Player::SplitItem( uint16 src, uint16 dst, uint32 count )
return;
}
- if( IsInWorld() )
+ if ( IsInWorld() )
pSrcItem->SendUpdateToPlayer( this );
pSrcItem->SetState(ITEM_CHANGED, this);
StoreItem( dest, pNewItem, true);
}
- else if( IsBankPos ( dst ) )
+ else if ( IsBankPos ( dst ) )
{
// change item amount before check (for unique max count check)
pSrcItem->SetCount( pSrcItem->GetCount() - count );
ItemPosCountVec dest;
uint8 msg = CanBankItem( dstbag, dstslot, dest, pNewItem, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
delete pNewItem;
pSrcItem->SetCount( pSrcItem->GetCount() + count );
@@ -11988,19 +11988,19 @@ void Player::SplitItem( uint16 src, uint16 dst, uint32 count )
return;
}
- if( IsInWorld() )
+ if ( IsInWorld() )
pSrcItem->SendUpdateToPlayer( this );
pSrcItem->SetState(ITEM_CHANGED, this);
BankItem( dest, pNewItem, true);
}
- else if( IsEquipmentPos ( dst ) )
+ else if ( IsEquipmentPos ( dst ) )
{
// change item amount before check (for unique max count check), provide space for splitted items
pSrcItem->SetCount( pSrcItem->GetCount() - count );
uint16 dest;
uint8 msg = CanEquipItem( dstslot, dest, pNewItem, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
delete pNewItem;
pSrcItem->SetCount( pSrcItem->GetCount() + count );
@@ -12008,7 +12008,7 @@ void Player::SplitItem( uint16 src, uint16 dst, uint32 count )
return;
}
- if( IsInWorld() )
+ if ( IsInWorld() )
pSrcItem->SendUpdateToPlayer( this );
pSrcItem->SetState(ITEM_CHANGED, this);
EquipItem( dest, pNewItem, true);
@@ -12027,12 +12027,12 @@ void Player::SwapItem( uint16 src, uint16 dst )
Item *pSrcItem = GetItemByPos( srcbag, srcslot );
Item *pDstItem = GetItemByPos( dstbag, dstslot );
- if( !pSrcItem )
+ if ( !pSrcItem )
return;
sLog.outDebug( "STORAGE: SwapItem bag = %u, slot = %u, item = %u", dstbag, dstslot, pSrcItem->GetEntry());
- if(!isAlive() )
+ if (!isAlive() )
{
SendEquipError( EQUIP_ERR_YOU_ARE_DEAD, pSrcItem, pDstItem );
return;
@@ -12040,7 +12040,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
// SRC checks
- if(pSrcItem->m_lootGenerated) // prevent swap looting item
+ if (pSrcItem->m_lootGenerated) // prevent swap looting item
{
//best error message found for attempting to swap while looting
SendEquipError( EQUIP_ERR_CANT_DO_RIGHT_NOW, pSrcItem, NULL );
@@ -12048,11 +12048,11 @@ void Player::SwapItem( uint16 src, uint16 dst )
}
// check unequip potability for equipped items and bank bags
- if(IsEquipmentPos ( src ) || IsBagPos ( src ))
+ if (IsEquipmentPos ( src ) || IsBagPos ( src ))
{
// bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later)
uint8 msg = CanUnequipItem( src, !IsBagPos ( src ) || IsBagPos ( dst ) || (pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty()));
- if(msg != EQUIP_ERR_OK)
+ if (msg != EQUIP_ERR_OK)
{
SendEquipError( msg, pSrcItem, pDstItem );
return;
@@ -12060,7 +12060,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
}
// prevent put equipped/bank bag in self
- if( IsBagPos ( src ) && srcslot == dstbag)
+ if ( IsBagPos ( src ) && srcslot == dstbag)
{
SendEquipError( EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG, pSrcItem, pDstItem );
return;
@@ -12070,7 +12070,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
if (pDstItem)
{
- if(pDstItem->m_lootGenerated) // prevent swap looting item
+ if (pDstItem->m_lootGenerated) // prevent swap looting item
{
//best error message found for attempting to swap while looting
SendEquipError( EQUIP_ERR_CANT_DO_RIGHT_NOW, pDstItem, NULL );
@@ -12078,11 +12078,11 @@ void Player::SwapItem( uint16 src, uint16 dst )
}
// check unequip potability for equipped items and bank bags
- if(IsEquipmentPos ( dst ) || IsBagPos ( dst ))
+ if (IsEquipmentPos ( dst ) || IsBagPos ( dst ))
{
// bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later)
uint8 msg = CanUnequipItem( dst, !IsBagPos ( dst ) || IsBagPos ( src ) || (pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty()));
- if(msg != EQUIP_ERR_OK)
+ if (msg != EQUIP_ERR_OK)
{
SendEquipError( msg, pSrcItem, pDstItem );
return;
@@ -12094,13 +12094,13 @@ void Player::SwapItem( uint16 src, uint16 dst )
// or swap empty bag with another empty or not empty bag (with items exchange)
// Move case
- if( !pDstItem )
+ if ( !pDstItem )
{
- if( IsInventoryPos( dst ) )
+ if ( IsInventoryPos( dst ) )
{
ItemPosCountVec dest;
uint8 msg = CanStoreItem( dstbag, dstslot, dest, pSrcItem, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
SendEquipError( msg, pSrcItem, NULL );
return;
@@ -12109,11 +12109,11 @@ void Player::SwapItem( uint16 src, uint16 dst )
RemoveItem(srcbag, srcslot, true);
StoreItem( dest, pSrcItem, true);
}
- else if( IsBankPos ( dst ) )
+ else if ( IsBankPos ( dst ) )
{
ItemPosCountVec dest;
uint8 msg = CanBankItem( dstbag, dstslot, dest, pSrcItem, false);
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
SendEquipError( msg, pSrcItem, NULL );
return;
@@ -12122,11 +12122,11 @@ void Player::SwapItem( uint16 src, uint16 dst )
RemoveItem(srcbag, srcslot, true);
BankItem( dest, pSrcItem, true);
}
- else if( IsEquipmentPos ( dst ) )
+ else if ( IsEquipmentPos ( dst ) )
{
uint16 dest;
uint8 msg = CanEquipItem( dstslot, dest, pSrcItem, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
SendEquipError( msg, pSrcItem, NULL );
return;
@@ -12141,32 +12141,32 @@ void Player::SwapItem( uint16 src, uint16 dst )
}
// attempt merge to / fill target item
- if(!pSrcItem->IsBag() && !pDstItem->IsBag())
+ if (!pSrcItem->IsBag() && !pDstItem->IsBag())
{
uint8 msg;
ItemPosCountVec sDest;
uint16 eDest;
- if( IsInventoryPos( dst ) )
+ if ( IsInventoryPos( dst ) )
msg = CanStoreItem( dstbag, dstslot, sDest, pSrcItem, false );
- else if( IsBankPos ( dst ) )
+ else if ( IsBankPos ( dst ) )
msg = CanBankItem( dstbag, dstslot, sDest, pSrcItem, false );
- else if( IsEquipmentPos ( dst ) )
+ else if ( IsEquipmentPos ( dst ) )
msg = CanEquipItem( dstslot, eDest, pSrcItem, false );
else
return;
// can be merge/fill
- if(msg == EQUIP_ERR_OK)
+ if (msg == EQUIP_ERR_OK)
{
- if( pSrcItem->GetCount() + pDstItem->GetCount() <= pSrcItem->GetProto()->GetMaxStackSize())
+ if ( pSrcItem->GetCount() + pDstItem->GetCount() <= pSrcItem->GetProto()->GetMaxStackSize())
{
RemoveItem(srcbag, srcslot, true);
- if( IsInventoryPos( dst ) )
+ if ( IsInventoryPos( dst ) )
StoreItem( sDest, pSrcItem, true);
- else if( IsBankPos ( dst ) )
+ else if ( IsBankPos ( dst ) )
BankItem( sDest, pSrcItem, true);
- else if( IsEquipmentPos ( dst ) )
+ else if ( IsEquipmentPos ( dst ) )
{
EquipItem( eDest, pSrcItem, true);
AutoUnequipOffhandIfNeed();
@@ -12178,7 +12178,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
pDstItem->SetCount( pSrcItem->GetProto()->GetMaxStackSize());
pSrcItem->SetState(ITEM_CHANGED, this);
pDstItem->SetState(ITEM_CHANGED, this);
- if( IsInWorld() )
+ if ( IsInWorld() )
{
pSrcItem->SendUpdateToPlayer( this );
pDstItem->SendUpdateToPlayer( this );
@@ -12194,18 +12194,18 @@ void Player::SwapItem( uint16 src, uint16 dst )
// check src->dest move possibility
ItemPosCountVec sDest;
uint16 eDest = 0;
- if( IsInventoryPos( dst ) )
+ if ( IsInventoryPos( dst ) )
msg = CanStoreItem( dstbag, dstslot, sDest, pSrcItem, true );
- else if( IsBankPos( dst ) )
+ else if ( IsBankPos( dst ) )
msg = CanBankItem( dstbag, dstslot, sDest, pSrcItem, true );
- else if( IsEquipmentPos( dst ) )
+ else if ( IsEquipmentPos( dst ) )
{
msg = CanEquipItem( dstslot, eDest, pSrcItem, true );
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
msg = CanUnequipItem( eDest, true );
}
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
SendEquipError( msg, pSrcItem, pDstItem );
return;
@@ -12214,41 +12214,41 @@ void Player::SwapItem( uint16 src, uint16 dst )
// check dest->src move possibility
ItemPosCountVec sDest2;
uint16 eDest2 = 0;
- if( IsInventoryPos( src ) )
+ if ( IsInventoryPos( src ) )
msg = CanStoreItem( srcbag, srcslot, sDest2, pDstItem, true );
- else if( IsBankPos( src ) )
+ else if ( IsBankPos( src ) )
msg = CanBankItem( srcbag, srcslot, sDest2, pDstItem, true );
- else if( IsEquipmentPos( src ) )
+ else if ( IsEquipmentPos( src ) )
{
msg = CanEquipItem( srcslot, eDest2, pDstItem, true);
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
msg = CanUnequipItem( eDest2, true);
}
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
SendEquipError( msg, pDstItem, pSrcItem );
return;
}
// Check bag swap with item exchange (one from empty in not bag possition (equipped (not possible in fact) or store)
- if(pSrcItem->IsBag() && pDstItem->IsBag())
+ if (pSrcItem->IsBag() && pDstItem->IsBag())
{
Bag* emptyBag = NULL;
Bag* fullBag = NULL;
- if(((Bag*)pSrcItem)->IsEmpty() && !IsBagPos(src))
+ if (((Bag*)pSrcItem)->IsEmpty() && !IsBagPos(src))
{
emptyBag = (Bag*)pSrcItem;
fullBag = (Bag*)pDstItem;
}
- else if(((Bag*)pDstItem)->IsEmpty() && !IsBagPos(dst))
+ else if (((Bag*)pDstItem)->IsEmpty() && !IsBagPos(dst))
{
emptyBag = (Bag*)pDstItem;
fullBag = (Bag*)pSrcItem;
}
// bag swap (with items exchange) case
- if(emptyBag && fullBag)
+ if (emptyBag && fullBag)
{
ItemPrototype const* emptyProto = emptyBag->GetProto();
@@ -12429,7 +12429,7 @@ void Player::RemoveItemFromBuyBackSlot( uint32 slot, bool del )
if (pItem)
{
pItem->RemoveFromWorld();
- if(del)
+ if (del)
pItem->SetState(ITEM_REMOVED, this);
}
@@ -12441,7 +12441,7 @@ void Player::RemoveItemFromBuyBackSlot( uint32 slot, bool del )
SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, 0);
// if current backslot is filled set to now free slot
- if(m_items[m_currentBuybackSlot])
+ if (m_items[m_currentBuybackSlot])
m_currentBuybackSlot = slot;
}
}
@@ -12743,7 +12743,7 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool
// Search enchant_amount
for (int k = 0; k < 3; ++k)
{
- if(item_rand->enchant_id[k] == enchant_id)
+ if (item_rand->enchant_id[k] == enchant_id)
{
basepoints = int32((item_rand->prefix[k] * item->GetItemSuffixFactor()) / 10000 );
break;
@@ -12765,11 +12765,11 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool
if (!enchant_amount)
{
ItemRandomSuffixEntry const *item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId()));
- if(item_rand)
+ if (item_rand)
{
for (int k = 0; k < 3; ++k)
{
- if(item_rand->enchant_id[k] == enchant_id)
+ if (item_rand->enchant_id[k] == enchant_id)
{
enchant_amount = uint32((item_rand->prefix[k] * item->GetItemSuffixFactor()) / 10000 );
break;
@@ -12785,11 +12785,11 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool
if (!enchant_amount)
{
ItemRandomSuffixEntry const *item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId()));
- if(item_rand_suffix)
+ if (item_rand_suffix)
{
for (int k = 0; k < 3; ++k)
{
- if(item_rand_suffix->enchant_id[k] == enchant_id)
+ if (item_rand_suffix->enchant_id[k] == enchant_id)
{
enchant_amount = uint32((item_rand_suffix->prefix[k] * item->GetItemSuffixFactor()) / 10000 );
break;
@@ -12980,15 +12980,15 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool
}
case ITEM_ENCHANTMENT_TYPE_TOTEM: // Shaman Rockbiter Weapon
{
- if(getClass() == CLASS_SHAMAN)
+ if (getClass() == CLASS_SHAMAN)
{
float addValue = 0.0f;
- if(item->GetSlot() == EQUIPMENT_SLOT_MAINHAND)
+ if (item->GetSlot() == EQUIPMENT_SLOT_MAINHAND)
{
addValue = float(enchant_amount * item->GetProto()->Delay / 1000.0f);
HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, addValue, apply);
}
- else if(item->GetSlot() == EQUIPMENT_SLOT_OFFHAND )
+ else if (item->GetSlot() == EQUIPMENT_SLOT_OFFHAND )
{
addValue = float(enchant_amount * item->GetProto()->Delay / 1000.0f);
HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, addValue, apply);
@@ -13010,19 +13010,19 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool
}
// visualize enchantment at player and equipped items
- if(slot == PERM_ENCHANTMENT_SLOT)
+ if (slot == PERM_ENCHANTMENT_SLOT)
SetUInt16Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (item->GetSlot() * 2), 0, apply ? item->GetEnchantmentId(slot) : 0);
- if(slot == TEMP_ENCHANTMENT_SLOT)
+ if (slot == TEMP_ENCHANTMENT_SLOT)
SetUInt16Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (item->GetSlot() * 2), 1, apply ? item->GetEnchantmentId(slot) : 0);
- if(apply_dur)
+ if (apply_dur)
{
- if(apply)
+ if (apply)
{
// set duration
uint32 duration = item->GetEnchantmentDuration(slot);
- if(duration > 0)
+ if (duration > 0)
AddEnchantmentDuration(item, slot, duration);
}
else
@@ -13051,7 +13051,7 @@ void Player::SendItemDurations()
void Player::SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast)
{
- if(!item) // prevent crash
+ if (!item) // prevent crash
return;
// last check 2.0.10
@@ -13142,7 +13142,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId)
bCanTalk = false;
break;
case GOSSIP_OPTION_LEARNDUALSPEC:
- if(!(GetSpecsCount() == 1 && pCreature->isCanTrainingAndResetTalentsOf(this) && !(getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL))))
+ if (!(GetSpecsCount() == 1 && pCreature->isCanTrainingAndResetTalentsOf(this) && !(getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL))))
bCanTalk = false;
break;
case GOSSIP_OPTION_UNLEARNTALENTS:
@@ -13351,7 +13351,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
GetSession()->SendTrainerList(guid);
break;
case GOSSIP_OPTION_LEARNDUALSPEC:
- if(GetSpecsCount() == 1 && !(getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL)))
+ if (GetSpecsCount() == 1 && !(getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL)))
{
if (GetMoney() < 10000000)
{
@@ -13473,7 +13473,7 @@ void Player::PrepareQuestMenu( uint64 guid )
// pets also can have quests
Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
- if( pCreature )
+ if ( pCreature )
{
pObject = (Object*)pCreature;
pObjectQR = &objmgr.mCreatureQuestRelations;
@@ -13486,7 +13486,7 @@ void Player::PrepareQuestMenu( uint64 guid )
Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId());
ASSERT(_map);
GameObject *pGameObject = _map->GetGameObject(guid);
- if( pGameObject )
+ if ( pGameObject )
{
pObject = (Object*)pGameObject;
pObjectQR = &objmgr.mGOQuestRelations;
@@ -13515,7 +13515,7 @@ void Player::PrepareQuestMenu( uint64 guid )
{
uint32 quest_id = i->second;
Quest const* pQuest = objmgr.GetQuestTemplate(quest_id);
- if(!pQuest) continue;
+ if (!pQuest) continue;
QuestStatus status = GetQuestStatus( quest_id );
@@ -13581,7 +13581,7 @@ void Player::SendPreparedQuest(uint64 guid)
{
qe = gossiptext->Options[0].Emotes[0];
- if(!gossiptext->Options[0].Text_0.empty())
+ if (!gossiptext->Options[0].Text_0.empty())
{
title = gossiptext->Options[0].Text_0;
@@ -13631,7 +13631,7 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest )
QuestRelations* pObjectQIR;
Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this,guid);
- if( pCreature )
+ if ( pCreature )
{
pObject = (Object*)pCreature;
pObjectQR = &objmgr.mCreatureQuestRelations;
@@ -13644,7 +13644,7 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest )
Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId());
ASSERT(_map);
GameObject *pGameObject = _map->GetGameObject(guid);
- if( pGameObject )
+ if ( pGameObject )
{
pObject = (Object*)pGameObject;
pObjectQR = &objmgr.mGOQuestRelations;
@@ -13666,7 +13666,7 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest )
bool Player::CanSeeStartQuest( Quest const *pQuest )
{
- if( SatisfyQuestRace( pQuest, false ) && SatisfyQuestSkillOrClass( pQuest, false ) &&
+ if ( SatisfyQuestRace( pQuest, false ) && SatisfyQuestSkillOrClass( pQuest, false ) &&
SatisfyQuestExclusiveGroup( pQuest, false ) && SatisfyQuestReputation( pQuest, false ) &&
SatisfyQuestPreviousQuest( pQuest, false ) && SatisfyQuestNextChain( pQuest, false ) &&
SatisfyQuestPrevChain( pQuest, false ) && SatisfyQuestDay( pQuest, false ) )
@@ -13689,20 +13689,20 @@ bool Player::CanTakeQuest( Quest const *pQuest, bool msg )
bool Player::CanAddQuest( Quest const *pQuest, bool msg )
{
- if( !SatisfyQuestLog( msg ) )
+ if ( !SatisfyQuestLog( msg ) )
return false;
uint32 srcitem = pQuest->GetSrcItemId();
- if( srcitem > 0 )
+ if ( srcitem > 0 )
{
uint32 count = pQuest->GetSrcItemCount();
ItemPosCountVec dest;
uint8 msg2 = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, srcitem, count );
// player already have max number (in most case 1) source item, no additional item needed and quest can be added.
- if( msg2 == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS )
+ if ( msg2 == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS )
return true;
- else if( msg2 != EQUIP_ERR_OK )
+ else if ( msg2 != EQUIP_ERR_OK )
{
SendEquipError( msg2, NULL, NULL );
return false;
@@ -13713,15 +13713,15 @@ bool Player::CanAddQuest( Quest const *pQuest, bool msg )
bool Player::CanCompleteQuest( uint32 quest_id )
{
- if( quest_id )
+ if ( quest_id )
{
QuestStatusData& q_status = mQuestStatus[quest_id];
- if( q_status.m_status == QUEST_STATUS_COMPLETE )
+ if ( q_status.m_status == QUEST_STATUS_COMPLETE )
return false; // not allow re-complete quest
Quest const* qInfo = objmgr.GetQuestTemplate(quest_id);
- if(!qInfo)
+ if (!qInfo)
return false;
// auto complete quest
@@ -13735,7 +13735,7 @@ bool Player::CanCompleteQuest( uint32 quest_id )
{
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
{
- if( qInfo->ReqItemCount[i]!= 0 && q_status.m_itemcount[i] < qInfo->ReqItemCount[i] )
+ if ( qInfo->ReqItemCount[i]!= 0 && q_status.m_itemcount[i] < qInfo->ReqItemCount[i] )
return false;
}
}
@@ -13744,10 +13744,10 @@ bool Player::CanCompleteQuest( uint32 quest_id )
{
for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
{
- if( qInfo->ReqCreatureOrGOId[i] == 0 )
+ if ( qInfo->ReqCreatureOrGOId[i] == 0 )
continue;
- if( qInfo->ReqCreatureOrGOCount[i] != 0 && q_status.m_creatureOrGOcount[i] < qInfo->ReqCreatureOrGOCount[i] )
+ if ( qInfo->ReqCreatureOrGOCount[i] != 0 && q_status.m_creatureOrGOcount[i] < qInfo->ReqCreatureOrGOCount[i] )
return false;
}
}
@@ -13783,15 +13783,15 @@ bool Player::CanCompleteRepeatableQuest( Quest const *pQuest )
// Solve problem that player don't have the quest and try complete it.
// if repeatable she must be able to complete event if player don't have it.
// Seem that all repeatable quest are DELIVER Flag so, no need to add more.
- if( !CanTakeQuest(pQuest, false) )
+ if ( !CanTakeQuest(pQuest, false) )
return false;
if (pQuest->HasFlag( QUEST_TRINITY_FLAGS_DELIVER) )
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
- if( pQuest->ReqItemId[i] && pQuest->ReqItemCount[i] && !HasItemCount(pQuest->ReqItemId[i],pQuest->ReqItemCount[i]) )
+ if ( pQuest->ReqItemId[i] && pQuest->ReqItemCount[i] && !HasItemCount(pQuest->ReqItemId[i],pQuest->ReqItemCount[i]) )
return false;
- if( !CanRewardQuest(pQuest, false) )
+ if ( !CanRewardQuest(pQuest, false) )
return false;
return true;
@@ -13800,15 +13800,15 @@ bool Player::CanCompleteRepeatableQuest( Quest const *pQuest )
bool Player::CanRewardQuest( Quest const *pQuest, bool msg )
{
// not auto complete quest and not completed quest (only cheating case, then ignore without message)
- if(!pQuest->IsAutoComplete() && GetQuestStatus(pQuest->GetQuestId()) != QUEST_STATUS_COMPLETE)
+ if (!pQuest->IsAutoComplete() && GetQuestStatus(pQuest->GetQuestId()) != QUEST_STATUS_COMPLETE)
return false;
// daily quest can't be rewarded (25 daily quest already completed)
- if(!SatisfyQuestDay(pQuest,true))
+ if (!SatisfyQuestDay(pQuest,true))
return false;
// rewarded and not repeatable quest (only cheating case, then ignore without message)
- if(GetQuestRewardStatus(pQuest->GetQuestId()))
+ if (GetQuestRewardStatus(pQuest->GetQuestId()))
return false;
// prevent receive reward with quest items in bank
@@ -13816,10 +13816,10 @@ bool Player::CanRewardQuest( Quest const *pQuest, bool msg )
{
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
{
- if( pQuest->ReqItemCount[i]!= 0 &&
+ if ( pQuest->ReqItemCount[i]!= 0 &&
GetItemCount(pQuest->ReqItemId[i]) < pQuest->ReqItemCount[i] )
{
- if(msg)
+ if (msg)
SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return false;
}
@@ -13827,7 +13827,7 @@ bool Player::CanRewardQuest( Quest const *pQuest, bool msg )
}
// prevent receive reward with low money and GetRewOrReqMoney() < 0
- if(pQuest->GetRewOrReqMoney() < 0 && GetMoney() < uint32(-pQuest->GetRewOrReqMoney()) )
+ if (pQuest->GetRewOrReqMoney() < 0 && GetMoney() < uint32(-pQuest->GetRewOrReqMoney()) )
return false;
return true;
@@ -13836,16 +13836,16 @@ bool Player::CanRewardQuest( Quest const *pQuest, bool msg )
bool Player::CanRewardQuest( Quest const *pQuest, uint32 reward, bool msg )
{
// prevent receive reward with quest items in bank or for not completed quest
- if(!CanRewardQuest(pQuest,msg))
+ if (!CanRewardQuest(pQuest,msg))
return false;
if ( pQuest->GetRewChoiceItemsCount() > 0 )
{
- if( pQuest->RewChoiceItemId[reward] )
+ if ( pQuest->RewChoiceItemId[reward] )
{
ItemPosCountVec dest;
uint8 res = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, pQuest->RewChoiceItemId[reward], pQuest->RewChoiceItemCount[reward] );
- if( res != EQUIP_ERR_OK )
+ if ( res != EQUIP_ERR_OK )
{
SendEquipError( res, NULL, NULL );
return false;
@@ -13857,11 +13857,11 @@ bool Player::CanRewardQuest( Quest const *pQuest, uint32 reward, bool msg )
{
for (uint32 i = 0; i < pQuest->GetRewItemsCount(); ++i)
{
- if( pQuest->RewItemId[i] )
+ if ( pQuest->RewItemId[i] )
{
ItemPosCountVec dest;
uint8 res = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, pQuest->RewItemId[i], pQuest->RewItemCount[i] );
- if( res != EQUIP_ERR_OK )
+ if ( res != EQUIP_ERR_OK )
{
SendEquipError( res, NULL, NULL );
return false;
@@ -13902,21 +13902,21 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
GiveQuestSourceItem( pQuest );
AdjustQuestReqItemCount( pQuest, questStatusData );
- if( pQuest->GetRepObjectiveFaction() )
- if(FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->GetRepObjectiveFaction()))
+ if ( pQuest->GetRepObjectiveFaction() )
+ if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->GetRepObjectiveFaction()))
GetReputationMgr().SetVisible(factionEntry);
- if( pQuest->GetRepObjectiveFaction2() )
- if(FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->GetRepObjectiveFaction2()))
+ if ( pQuest->GetRepObjectiveFaction2() )
+ if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->GetRepObjectiveFaction2()))
GetReputationMgr().SetVisible(factionEntry);
uint32 qtime = 0;
- if( pQuest->HasFlag( QUEST_TRINITY_FLAGS_TIMED ) )
+ if ( pQuest->HasFlag( QUEST_TRINITY_FLAGS_TIMED ) )
{
uint32 limittime = pQuest->GetLimitTime();
// shared timed quest
- if(questGiver && questGiver->GetTypeId() == TYPEID_PLAYER)
+ if (questGiver && questGiver->GetTypeId() == TYPEID_PLAYER)
limittime = questGiver->ToPlayer()->getQuestStatusMap()[quest_id].m_timer / IN_MILISECONDS;
AddTimedQuest( quest_id );
@@ -13932,19 +13932,19 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
questStatusData.uState = QUEST_CHANGED;
//starting initial quest script
- if(questGiver && pQuest->GetQuestStartScript()!=0)
+ if (questGiver && pQuest->GetQuestStartScript()!=0)
GetMap()->ScriptsStart(sQuestStartScripts, pQuest->GetQuestStartScript(), questGiver, this);
// Some spells applied at quest activation
SpellAreaForQuestMapBounds saBounds = spellmgr.GetSpellAreaForQuestMapBounds(quest_id,true);
- if(saBounds.first != saBounds.second)
+ if (saBounds.first != saBounds.second)
{
uint32 zone, area;
GetZoneAndAreaId(zone,area);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
- if(itr->second->autocast && itr->second->IsFitToRequirements(this,zone,area))
- if( !HasAura(itr->second->spellId) )
+ if (itr->second->autocast && itr->second->IsFitToRequirements(this,zone,area))
+ if ( !HasAura(itr->second->spellId) )
CastSpell(this,itr->second->spellId,true);
}
@@ -13953,17 +13953,17 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
void Player::CompleteQuest( uint32 quest_id )
{
- if( quest_id )
+ if ( quest_id )
{
SetQuestStatus( quest_id, QUEST_STATUS_COMPLETE );
uint16 log_slot = FindQuestSlot( quest_id );
- if( log_slot < MAX_QUEST_LOG_SIZE)
+ if ( log_slot < MAX_QUEST_LOG_SIZE)
SetQuestSlotState(log_slot,QUEST_STATE_COMPLETE);
- if(Quest const* qInfo = objmgr.GetQuestTemplate(quest_id))
+ if (Quest const* qInfo = objmgr.GetQuestTemplate(quest_id))
{
- if( qInfo->HasFlag(QUEST_FLAGS_AUTO_REWARDED) )
+ if ( qInfo->HasFlag(QUEST_FLAGS_AUTO_REWARDED) )
RewardQuest(qInfo,0,this,false);
else
SendQuestComplete( quest_id );
@@ -13973,12 +13973,12 @@ void Player::CompleteQuest( uint32 quest_id )
void Player::IncompleteQuest( uint32 quest_id )
{
- if( quest_id )
+ if ( quest_id )
{
SetQuestStatus( quest_id, QUEST_STATUS_INCOMPLETE );
uint16 log_slot = FindQuestSlot( quest_id );
- if( log_slot < MAX_QUEST_LOG_SIZE)
+ if ( log_slot < MAX_QUEST_LOG_SIZE)
RemoveQuestSlotState(log_slot,QUEST_STATE_COMPLETE);
}
}
@@ -14127,25 +14127,25 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
// remove auras from spells with quest reward state limitations
SpellAreaForQuestMapBounds saEndBounds = spellmgr.GetSpellAreaForQuestEndMapBounds(quest_id);
- if(saEndBounds.first != saEndBounds.second)
+ if (saEndBounds.first != saEndBounds.second)
{
GetZoneAndAreaId(zone,area);
for (SpellAreaForAreaMap::const_iterator itr = saEndBounds.first; itr != saEndBounds.second; ++itr)
- if(!itr->second->IsFitToRequirements(this,zone,area))
+ if (!itr->second->IsFitToRequirements(this,zone,area))
RemoveAurasDueToSpell(itr->second->spellId);
}
// Some spells applied at quest reward
SpellAreaForQuestMapBounds saBounds = spellmgr.GetSpellAreaForQuestMapBounds(quest_id,false);
- if(saBounds.first != saBounds.second)
+ if (saBounds.first != saBounds.second)
{
- if(!zone || !area)
+ if (!zone || !area)
GetZoneAndAreaId(zone,area);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
- if(itr->second->autocast && itr->second->IsFitToRequirements(this,zone,area))
- if( !HasAura(itr->second->spellId) )
+ if (itr->second->autocast && itr->second->IsFitToRequirements(this,zone,area))
+ if ( !HasAura(itr->second->spellId) )
CastSpell(this,itr->second->spellId,true);
}
@@ -14204,7 +14204,7 @@ bool Player::SatisfyQuestSkillOrClass(Quest const* qInfo, bool msg)
uint8 reqSortClass = ClassByQuestSort(questSort);
// check class sort cases in zoneOrSort
- if( reqSortClass != 0 && getClass() != reqSortClass)
+ if ( reqSortClass != 0 && getClass() != reqSortClass)
{
if (msg)
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
@@ -14223,10 +14223,10 @@ bool Player::SatisfyQuestSkillOrClass(Quest const* qInfo, bool msg)
}
}
// check skill
- else if(skillOrClass > 0)
+ else if (skillOrClass > 0)
{
uint32 reqSkill = skillOrClass;
- if(GetSkillValue(reqSkill) < qInfo->GetRequiredSkillValue())
+ if (GetSkillValue(reqSkill) < qInfo->GetRequiredSkillValue())
{
if (msg)
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
@@ -14241,13 +14241,13 @@ bool Player::SatisfyQuestLevel(Quest const* qInfo, bool msg)
{
if (getLevel() < qInfo->GetMinLevel())
{
- if(msg)
+ if (msg)
SendCanTakeQuestResponse(INVALIDREASON_QUEST_FAILED_LOW_LEVEL);
return false;
}
else if (qInfo->GetMaxLevel() > 0 && getLevel() > qInfo->GetMaxLevel())
{
- if(msg)
+ if (msg)
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); // There doesn't seem to be a specific response for too high player level
return false;
}
@@ -14406,7 +14406,7 @@ bool Player::SatisfyQuestStatus( Quest const* qInfo, bool msg )
QuestStatusMap::iterator itr = mQuestStatus.find( qInfo->GetQuestId() );
if ( itr != mQuestStatus.end() && itr->second.m_status != QUEST_STATUS_NONE )
{
- if( msg )
+ if ( msg )
SendCanTakeQuestResponse( INVALIDREASON_QUEST_ALREADY_ON );
return false;
}
@@ -14427,7 +14427,7 @@ bool Player::SatisfyQuestTimed(Quest const* qInfo, bool msg)
bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg )
{
// non positive exclusive group, if > 0 then can be start if any other quest in exclusive group already started/completed
- if(qInfo->GetExclusiveGroup() <= 0)
+ if (qInfo->GetExclusiveGroup() <= 0)
return true;
ObjectMgr::ExclusiveQuestGroups::iterator iter = objmgr.mExclusiveQuestGroups.lower_bound(qInfo->GetExclusiveGroup());
@@ -14440,14 +14440,14 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg )
uint32 exclude_Id = iter->second;
// skip checked quest id, only state of other quests in group is interesting
- if(exclude_Id == qInfo->GetQuestId())
+ if (exclude_Id == qInfo->GetQuestId())
continue;
// not allow have daily quest if daily quest from exclusive group already recently completed
Quest const* Nquest = objmgr.GetQuestTemplate(exclude_Id);
- if( !SatisfyQuestDay(Nquest, false) )
+ if ( !SatisfyQuestDay(Nquest, false) )
{
- if( msg )
+ if ( msg )
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
return false;
}
@@ -14455,10 +14455,10 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg )
QuestStatusMap::iterator i_exstatus = mQuestStatus.find( exclude_Id );
// alternative quest already started or completed
- if( i_exstatus != mQuestStatus.end()
+ if ( i_exstatus != mQuestStatus.end()
&& (i_exstatus->second.m_status == QUEST_STATUS_COMPLETE || i_exstatus->second.m_status == QUEST_STATUS_INCOMPLETE) )
{
- if( msg )
+ if ( msg )
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
return false;
}
@@ -14468,15 +14468,15 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg )
bool Player::SatisfyQuestNextChain( Quest const* qInfo, bool msg )
{
- if(!qInfo->GetNextQuestInChain())
+ if (!qInfo->GetNextQuestInChain())
return true;
// next quest in chain already started or completed
QuestStatusMap::iterator itr = mQuestStatus.find( qInfo->GetNextQuestInChain() );
- if( itr != mQuestStatus.end()
+ if ( itr != mQuestStatus.end()
&& (itr->second.m_status == QUEST_STATUS_COMPLETE || itr->second.m_status == QUEST_STATUS_INCOMPLETE) )
{
- if( msg )
+ if ( msg )
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
return false;
}
@@ -14490,7 +14490,7 @@ bool Player::SatisfyQuestNextChain( Quest const* qInfo, bool msg )
bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg )
{
// No previous quest in chain
- if( qInfo->prevChainQuests.empty())
+ if ( qInfo->prevChainQuests.empty())
return true;
for (Quest::PrevChainQuests::const_iterator iter = qInfo->prevChainQuests.begin(); iter != qInfo->prevChainQuests.end(); ++iter )
@@ -14499,13 +14499,13 @@ bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg )
QuestStatusMap::iterator i_prevstatus = mQuestStatus.find( prevId );
- if( i_prevstatus != mQuestStatus.end() )
+ if ( i_prevstatus != mQuestStatus.end() )
{
// If any of the previous quests in chain active, return false
- if( i_prevstatus->second.m_status == QUEST_STATUS_INCOMPLETE
+ if ( i_prevstatus->second.m_status == QUEST_STATUS_INCOMPLETE
|| (i_prevstatus->second.m_status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus(prevId)))
{
- if( msg )
+ if ( msg )
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
return false;
}
@@ -14513,7 +14513,7 @@ bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg )
// check for all quests further down the chain
// only necessary if there are quest chains with more than one quest that can be skipped
- //if( !SatisfyQuestPrevChain( prevId, msg ) )
+ //if ( !SatisfyQuestPrevChain( prevId, msg ) )
// return false;
}
@@ -14523,23 +14523,23 @@ bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg )
bool Player::SatisfyQuestDay( Quest const* qInfo, bool msg )
{
- if(!qInfo->IsDaily())
+ if (!qInfo->IsDaily())
return true;
bool have_slot = false;
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
{
uint32 id = GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx);
- if(qInfo->GetQuestId()==id)
+ if (qInfo->GetQuestId()==id)
return false;
- if(!id)
+ if (!id)
have_slot = true;
}
- if(!have_slot)
+ if (!have_slot)
{
- if( msg )
+ if ( msg )
SendCanTakeQuestResponse( INVALIDREASON_DAILY_QUESTS_REMAINING );
return false;
}
@@ -14550,22 +14550,22 @@ bool Player::SatisfyQuestDay( Quest const* qInfo, bool msg )
bool Player::GiveQuestSourceItem( Quest const *pQuest )
{
uint32 srcitem = pQuest->GetSrcItemId();
- if( srcitem > 0 )
+ if ( srcitem > 0 )
{
uint32 count = pQuest->GetSrcItemCount();
- if( count <= 0 )
+ if ( count <= 0 )
count = 1;
ItemPosCountVec dest;
uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, srcitem, count );
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
{
Item * item = StoreNewItem(dest, srcitem, true);
SendNewItem(item, count, true, false);
return true;
}
// player already have max amount required item, just report success
- else if( msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS )
+ else if ( msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS )
return true;
else
SendEquipError( msg, NULL, NULL );
@@ -14610,7 +14610,7 @@ bool Player::GetQuestRewardStatus(uint32 quest_id) const
{
// for repeatable quests: rewarded field is set after first reward only to prevent getting XP more than once
QuestStatusMap::const_iterator itr = mQuestStatus.find(quest_id);
- if(itr != mQuestStatus.end() && itr->second.m_status != QUEST_STATUS_NONE
+ if (itr != mQuestStatus.end() && itr->second.m_status != QUEST_STATUS_NONE
&& !qInfo->IsRepeatable())
return itr->second.m_rewarded;
@@ -14752,7 +14752,7 @@ void Player::ItemAddedQuestCheck( uint32 entry, uint32 count)
continue;
Quest const* qInfo = objmgr.GetQuestTemplate(questid);
- if( !qInfo || !qInfo->HasFlag(QUEST_TRINITY_FLAGS_DELIVER))
+ if ( !qInfo || !qInfo->HasFlag(QUEST_TRINITY_FLAGS_DELIVER))
continue;
for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
@@ -14784,12 +14784,12 @@ void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count)
for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
{
uint32 questid = GetQuestSlotQuestId(i);
- if(!questid)
+ if (!questid)
continue;
Quest const* qInfo = objmgr.GetQuestTemplate(questid);
if (!qInfo)
continue;
- if( !qInfo->HasFlag(QUEST_TRINITY_FLAGS_DELIVER))
+ if ( !qInfo->HasFlag(QUEST_TRINITY_FLAGS_DELIVER))
continue;
for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
@@ -14854,7 +14854,7 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid)
continue;
// just if !ingroup || !noraidgroup || raidgroup
QuestStatusData& q_status = mQuestStatus[questid];
- if(q_status.m_status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->GetType() == QUEST_TYPE_RAID))
+ if (q_status.m_status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->GetType() == QUEST_TYPE_RAID))
{
if (qInfo->HasFlag( QUEST_TRINITY_FLAGS_KILL_OR_CAST))
{
@@ -14902,7 +14902,7 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id)
for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
{
uint32 questid = GetQuestSlotQuestId(i);
- if(!questid)
+ if (!questid)
continue;
Quest const* qInfo = objmgr.GetQuestTemplate(questid);
@@ -15064,7 +15064,7 @@ void Player::ReputationChanged(FactionEntry const* factionEntry)
{
for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
{
- if(uint32 questid = GetQuestSlotQuestId(i))
+ if (uint32 questid = GetQuestSlotQuestId(i))
{
if (Quest const* qInfo = objmgr.GetQuestTemplate(questid))
{
@@ -15077,7 +15077,7 @@ void Player::ReputationChanged(FactionEntry const* factionEntry)
if (CanCompleteQuest(questid))
CompleteQuest(questid);
}
- else if(q_status.m_status == QUEST_STATUS_COMPLETE)
+ else if (q_status.m_status == QUEST_STATUS_COMPLETE)
{
if (GetReputationMgr().GetReputation(factionEntry) < qInfo->GetRepObjectiveValue())
IncompleteQuest(questid);
@@ -15092,7 +15092,7 @@ void Player::ReputationChanged2(FactionEntry const* factionEntry)
{
for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
{
- if(uint32 questid = GetQuestSlotQuestId(i))
+ if (uint32 questid = GetQuestSlotQuestId(i))
{
if (Quest const* qInfo = objmgr.GetQuestTemplate(questid))
{
@@ -15105,7 +15105,7 @@ void Player::ReputationChanged2(FactionEntry const* factionEntry)
if (CanCompleteQuest(questid))
CompleteQuest(questid);
}
- else if(q_status.m_status == QUEST_STATUS_COMPLETE)
+ else if (q_status.m_status == QUEST_STATUS_COMPLETE)
{
if (GetReputationMgr().GetReputation(factionEntry) < qInfo->GetRepObjectiveValue2())
IncompleteQuest(questid);
@@ -15125,7 +15125,7 @@ bool Player::HasQuestForItem(uint32 itemid) const
continue;
QuestStatusMap::const_iterator qs_itr = mQuestStatus.find(questid);
- if(qs_itr == mQuestStatus.end())
+ if (qs_itr == mQuestStatus.end())
continue;
QuestStatusData const& q_status = qs_itr->second;
@@ -15176,7 +15176,7 @@ bool Player::HasQuestForItem(uint32 itemid) const
void Player::SendQuestComplete(uint32 quest_id)
{
- if(quest_id)
+ if (quest_id)
{
WorldPacket data(SMSG_QUESTUPDATE_COMPLETE, 4);
data << uint32(quest_id);
@@ -15215,7 +15215,7 @@ void Player::SendQuestReward( Quest const *pQuest, uint32 XP, Object * questGive
void Player::SendQuestFailed( uint32 quest_id )
{
- if( quest_id )
+ if ( quest_id )
{
WorldPacket data( SMSG_QUESTGIVER_QUEST_FAILED, 4+4 );
data << uint32(quest_id);
@@ -15227,7 +15227,7 @@ void Player::SendQuestFailed( uint32 quest_id )
void Player::SendQuestTimerFailed( uint32 quest_id )
{
- if( quest_id )
+ if ( quest_id )
{
WorldPacket data( SMSG_QUESTUPDATE_FAILEDTIMER, 4 );
data << uint32(quest_id);
@@ -15273,7 +15273,7 @@ void Player::SendQuestConfirmAccept(const Quest* pQuest, Player* pReceiver)
void Player::SendPushToPartyResponse( Player *pPlayer, uint32 msg )
{
- if( pPlayer )
+ if ( pPlayer )
{
WorldPacket data( MSG_QUEST_PUSH_RESULT, (8+1) );
data << uint64(pPlayer->GetGUID());
@@ -15311,7 +15311,7 @@ void Player::SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, u
GetSession()->SendPacket(&data);
uint16 log_slot = FindQuestSlot( pQuest->GetQuestId() );
- if( log_slot < MAX_QUEST_LOG_SIZE)
+ if ( log_slot < MAX_QUEST_LOG_SIZE)
SetQuestSlotCounter(log_slot,creatureOrGO_idx,GetQuestSlotCounter(log_slot,creatureOrGO_idx)+add_count);
}
@@ -15373,10 +15373,10 @@ bool Player::MinimalLoadFromDB( QueryResult_AutoPtr result, uint32 guid )
void Player::_LoadDeclinedNames(QueryResult_AutoPtr result)
{
- if(!result)
+ if (!result)
return;
- if(m_declinedname)
+ if (m_declinedname)
delete m_declinedname;
m_declinedname = new DeclinedName;
@@ -15403,7 +15403,7 @@ void Player::_LoadArenaTeamInfo(QueryResult_AutoPtr result)
uint32 personal_rating = fields[4].GetUInt32();
ArenaTeam* aTeam = objmgr.GetArenaTeamById(arenateamid);
- if(!aTeam)
+ if (!aTeam)
{
sLog.outError("Player::_LoadArenaTeamInfo: couldn't load arenateam %u", arenateamid);
continue;
@@ -15447,7 +15447,7 @@ void Player::_LoadEquipmentSets(QueryResult_AutoPtr result)
++count;
- if(count >= MAX_EQUIPMENT_SET_INDEX) // client limit
+ if (count >= MAX_EQUIPMENT_SET_INDEX) // client limit
break;
} while (result->NextRow());
}
@@ -15475,7 +15475,7 @@ void Player::_LoadBGData(QueryResult_AutoPtr result)
bool Player::LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float& o, bool& in_flight, uint64 guid)
{
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,taxi_path FROM characters WHERE guid = '%u'",GUID_LOPART(guid));
- if(!result)
+ if (!result)
return false;
Field *fields = result->Fetch();
@@ -15493,7 +15493,7 @@ bool Player::LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float&
bool Player::LoadValuesArrayFromDB(Tokens& data, uint64 guid)
{
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT data FROM characters WHERE guid='%u'",GUID_LOPART(guid));
- if( !result )
+ if ( !result )
return false;
Field *fields = result->Fetch();
@@ -15505,7 +15505,7 @@ bool Player::LoadValuesArrayFromDB(Tokens& data, uint64 guid)
uint32 Player::GetUInt32ValueFromArray(Tokens const& data, uint16 index)
{
- if(index >= data.size())
+ if (index >= data.size())
return 0;
return (uint32)atoi(data[index].c_str());
@@ -15523,7 +15523,7 @@ float Player::GetFloatValueFromArray(Tokens const& data, uint16 index)
uint32 Player::GetUInt32ValueFromDB(uint16 index, uint64 guid)
{
Tokens data;
- if(!LoadValuesArrayFromDB(data,guid))
+ if (!LoadValuesArrayFromDB(data,guid))
return 0;
return GetUInt32ValueFromArray(data,index);
@@ -15552,7 +15552,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
//"health, power1, power2, power3, power4, power5, power6, power7, instance_id, speccount, activespec FROM characters WHERE guid = '%u'", guid);
QueryResult_AutoPtr result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM);
- if(!result)
+ if (!result)
{
sLog.outError("Player (GUID: %u) not found in table `characters`, can't load. ",guid);
return false;
@@ -15564,7 +15564,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
// check if the character's account in the db and the logged in account match.
// player should be able to load/delete character only with correct account!
- if( dbAccountId != GetSession()->GetAccountId() )
+ if ( dbAccountId != GetSession()->GetAccountId() )
{
sLog.outError("Player (GUID: %u) loading from wrong account (is: %u, should be: %u)",guid,GetSession()->GetAccountId(),dbAccountId);
return false;
@@ -15582,7 +15582,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
return false;
}
- if(!LoadValues( fields[2].GetString()))
+ if (!LoadValues( fields[2].GetString()))
{
sLog.outError("Player #%d have broken data in `data` field. Can't be loaded.", GUID_LOPART(guid));
return false;
@@ -15636,7 +15636,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
setFactionForRace(getRace());
// load home bind and check in same time class/race pair, it used later for restore broken positions
- if(!_LoadHomeBind(holder->GetResult(PLAYER_LOGIN_QUERY_LOADHOMEBIND)))
+ if (!_LoadHomeBind(holder->GetResult(PLAYER_LOGIN_QUERY_LOADHOMEBIND)))
return false;
InitPrimaryProfessions(); // to max set before any spell loaded
@@ -15648,7 +15648,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
uint32 instanceId = fields[59].GetFloat();
uint32 difficulty = fields[39].GetUInt32();
- if(difficulty >= MAX_DUNGEON_DIFFICULTY)
+ if (difficulty >= MAX_DUNGEON_DIFFICULTY)
difficulty = DUNGEON_DIFFICULTY_NORMAL;
SetDungeonDifficulty(Difficulty(difficulty)); // may be changed in _LoadGroup
std::string taxi_nodes = fields[38].GetCppString();
@@ -15669,11 +15669,11 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
for (uint32 arena_slot = 0; arena_slot < MAX_ARENA_SLOT; ++arena_slot)
{
uint32 arena_team_id = GetArenaTeamId(arena_slot);
- if(!arena_team_id)
+ if (!arena_team_id)
continue;
- if(ArenaTeam * at = objmgr.GetArenaTeamById(arena_team_id))
- if(at->HaveMember(GetGUID()))
+ if (ArenaTeam * at = objmgr.GetArenaTeamById(arena_team_id))
+ if (at->HaveMember(GetGUID()))
continue;
// arena team not exist or not member, cleanup fields
@@ -15692,7 +15692,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
_LoadBGData(holder->GetResult(PLAYER_LOGIN_QUERY_LOADBGDATA));
MapEntry const * mapEntry = sMapStore.LookupEntry(mapId);
- if(!mapEntry || !IsPositionValid())
+ if (!mapEntry || !IsPositionValid())
{
sLog.outError("Player (guidlow %d) have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.",guid,mapId,GetPositionX(),GetPositionY(),GetPositionZ(),GetOrientation());
RelocateToHomebind();
@@ -15701,12 +15701,12 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
else if (mapEntry && mapEntry->IsBattleGroundOrArena())
{
BattleGround *currentBg = NULL;
- if(m_bgData.bgInstanceID) //saved in BattleGround
+ if (m_bgData.bgInstanceID) //saved in BattleGround
currentBg = sBattleGroundMgr.GetBattleGround(m_bgData.bgInstanceID, BATTLEGROUND_TYPE_NONE);
bool player_at_bg = currentBg && currentBg->IsPlayerInBattleGround(GetGUID());
- if(player_at_bg && currentBg->GetStatus() != STATUS_WAIT_LEAVE)
+ if (player_at_bg && currentBg->GetStatus() != STATUS_WAIT_LEAVE)
{
BattleGroundQueueTypeId bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType());
AddBattleGroundQueueId(bgQueueTypeId);
@@ -15730,7 +15730,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
const WorldLocation& _loc = GetBattleGroundEntryPoint();
mapId = _loc.GetMapId(); instanceId = 0;
- if(mapId == MAPID_INVALID) // Battleground Entry Point not found (???)
+ if (mapId == MAPID_INVALID) // Battleground Entry Point not found (???)
{
sLog.outError("Player (guidlow %d) was in BG in database, but BG was not found, and entry point was invalid! Teleport to default race/class locations.",guid);
RelocateToHomebind();
@@ -15753,7 +15753,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
m_movementInfo.t_z = fields[29].GetFloat();
m_movementInfo.t_o = fields[30].GetFloat();
- if( !Trinity::IsValidMapCoord(
+ if ( !Trinity::IsValidMapCoord(
GetPositionX()+m_movementInfo.t_x,GetPositionY()+m_movementInfo.t_y,
GetPositionZ()+m_movementInfo.t_z,GetOrientation()+m_movementInfo.t_o) ||
// transport size limited
@@ -15769,7 +15769,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
{
for (MapManager::TransportSet::iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter)
{
- if( (*iter)->GetGUIDLow() == transGUID)
+ if ( (*iter)->GetGUIDLow() == transGUID)
{
m_transport = *iter;
m_transport->AddPassenger(this);
@@ -15777,7 +15777,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
break;
}
}
- if(!m_transport)
+ if (!m_transport)
{
sLog.outError("Player (guidlow %d) have problems with transport guid (%u). Teleport to default race/class locations.",
guid,transGUID);
@@ -15792,19 +15792,19 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
instanceId = 0;
// Not finish taxi flight path
- if(m_bgData.HasTaxiPath())
+ if (m_bgData.HasTaxiPath())
{
for (int i = 0; i < 2; ++i)
m_taxi.AddTaxiDestination(m_bgData.taxiPath[i]);
}
- else if(!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes,GetTeam()))
+ else if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes,GetTeam()))
{
// problems with taxi path loading
TaxiNodesEntry const* nodeEntry = NULL;
- if(uint32 node_id = m_taxi.GetTaxiSource())
+ if (uint32 node_id = m_taxi.GetTaxiSource())
nodeEntry = sTaxiNodesStore.LookupEntry(node_id);
- if(!nodeEntry) // don't know taxi start node, to homebind
+ if (!nodeEntry) // don't know taxi start node, to homebind
{
sLog.outError("Character %u have wrong data in taxi destination list, teleport to homebind.",GetGUIDLow());
RelocateToHomebind();
@@ -15836,16 +15836,16 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
// Map could be changed before
mapEntry = sMapStore.LookupEntry(mapId);
// client without expansion support
- if(mapEntry && GetSession()->Expansion() < mapEntry->Expansion())
+ if (mapEntry && GetSession()->Expansion() < mapEntry->Expansion())
{
sLog.outDebug("Player %s using client without required expansion tried login at non accessible map %u", GetName(), mapId);
RelocateToHomebind();
}
- // fix crash (because of if(Map *map = _FindMap(instanceId)) in MapInstanced::CreateInstance)
- if(instanceId)
- if(InstanceSave * save = GetInstanceSave(mapId, mapEntry->IsRaid()))
- if(save->GetInstanceId() != instanceId)
+ // fix crash (because of if (Map *map = _FindMap(instanceId)) in MapInstanced::CreateInstance)
+ if (instanceId)
+ if (InstanceSave * save = GetInstanceSave(mapId, mapEntry->IsRaid()))
+ if (save->GetInstanceId() != instanceId)
instanceId = 0;
// NOW player must have valid map
@@ -15856,7 +15856,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
{
instanceId = 0;
AreaTrigger const* at = objmgr.GetGoBackTrigger(mapId);
- if(at)
+ if (at)
{
sLog.outError("Player (guidlow %d) is teleported to gobacktrigger (Map: %u X: %f Y: %f Z: %f O: %f).",guid,mapId,GetPositionX(),GetPositionY(),GetPositionZ(),GetOrientation());
Relocate(at->target_X, at->target_Y, at->target_Z, GetOrientation());
@@ -15869,7 +15869,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
}
map = MapManager::Instance().CreateMap(mapId, this, 0);
- if(!map)
+ if (!map)
{
PlayerInfo const *info = objmgr.GetPlayerInfo(getRace(), getClass());
mapId = info->mapId;
@@ -15885,10 +15885,10 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
}
// if the player is in an instance and it has been reset in the meantime teleport him to the entrance
- if(instanceId && !sInstanceSaveManager.GetInstanceSave(instanceId))
+ if (instanceId && !sInstanceSaveManager.GetInstanceSave(instanceId))
{
AreaTrigger const* at = objmgr.GetMapEntranceTrigger(mapId);
- if(at)
+ if (at)
Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation);
else
{
@@ -16097,7 +16097,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
case 0: break; // disable
case 1: SetGameMaster(true); break; // enable
case 2: // save state
- if(extraflags & PLAYER_EXTRA_GM_ON)
+ if (extraflags & PLAYER_EXTRA_GM_ON)
SetGameMaster(true);
break;
}
@@ -16108,7 +16108,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
case 0: SetGMVisible(false); break; // invisible
case 1: break; // visible
case 2: // save state
- if(extraflags & PLAYER_EXTRA_GM_INVISIBLE)
+ if (extraflags & PLAYER_EXTRA_GM_INVISIBLE)
SetGMVisible(false);
break;
}
@@ -16119,7 +16119,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
case 0: break; // disable
case 1: SetAcceptTicket(true); break; // enable
case 2: // save state
- if(extraflags & PLAYER_EXTRA_GM_ACCEPT_TICKETS)
+ if (extraflags & PLAYER_EXTRA_GM_ACCEPT_TICKETS)
SetAcceptTicket(true);
break;
}*/
@@ -16130,7 +16130,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
case 0: break; // disable
case 1: SetGMChat(true); break; // enable
case 2: // save state
- if(extraflags & PLAYER_EXTRA_GM_CHAT)
+ if (extraflags & PLAYER_EXTRA_GM_CHAT)
SetGMChat(true);
break;
}
@@ -16141,7 +16141,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
case 0: break; // disable
case 1: SetAcceptWhispers(true); break; // enable
case 2: // save state
- if(extraflags & PLAYER_EXTRA_ACCEPT_WHISPERS)
+ if (extraflags & PLAYER_EXTRA_ACCEPT_WHISPERS)
SetAcceptWhispers(true);
break;
}
@@ -16220,7 +16220,7 @@ void Player::_LoadActions(QueryResult_AutoPtr result, bool startup)
uint32 action = fields[1].GetUInt32();
uint8 type = fields[2].GetUInt8();
- if(ActionButton* ab = addActionButton(button, action, type))
+ if (ActionButton* ab = addActionButton(button, action, type))
ab->uState = ACTIONBUTTON_UNCHANGED;
else
{
@@ -16281,7 +16281,7 @@ void Player::_LoadAuras(QueryResult_AutoPtr result, uint32 timediff)
// prevent wrong values of remaincharges
if (spellproto->procCharges)
{
- if(remaincharges <= 0 || remaincharges > spellproto->procCharges)
+ if (remaincharges <= 0 || remaincharges > spellproto->procCharges)
remaincharges = spellproto->procCharges;
}
else
@@ -16538,7 +16538,7 @@ void Player::_LoadInventory(QueryResult_AutoPtr result, uint32 timediff)
draft.SendMailTo(this, MailSender(this, MAIL_STATIONERY_GM));
}
}
- //if(isAlive())
+ //if (isAlive())
_ApplyAllItemMods();
}
@@ -16751,7 +16751,7 @@ void Player::_LoadQuestStatus(QueryResult_AutoPtr result)
SetTitle(titleEntry);
}
- if(pQuest->GetBonusTalents())
+ if (pQuest->GetBonusTalents())
m_questRewardTalentCount += pQuest->GetBonusTalents();
}
@@ -16874,7 +16874,7 @@ void Player::_LoadBoundInstances(QueryResult_AutoPtr result)
continue;
}
- if(difficulty >= MAX_DIFFICULTY)
+ if (difficulty >= MAX_DIFFICULTY)
{
sLog.outError("_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId);
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND instance = '%d'", GetGUIDLow(), instanceId);
@@ -16882,7 +16882,7 @@ void Player::_LoadBoundInstances(QueryResult_AutoPtr result)
}
MapDifficulty const* mapDiff = GetMapDifficultyData(mapId,Difficulty(difficulty));
- if(!mapDiff)
+ if (!mapDiff)
{
sLog.outError("_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId);
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND instance = '%d'", GetGUIDLow(), instanceId);
@@ -16908,7 +16908,7 @@ InstancePlayerBind* Player::GetBoundInstance(uint32 mapid, Difficulty difficulty
{
// some instances only have one difficulty
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid,difficulty);
- if(!mapDiff)
+ if (!mapDiff)
return NULL;
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid);
@@ -16923,8 +16923,8 @@ InstanceSave * Player::GetInstanceSave(uint32 mapid, bool raid)
InstancePlayerBind *pBind = GetBoundInstance(mapid, GetDifficulty(raid));
InstanceSave *pSave = pBind ? pBind->save : NULL;
if (!pBind || !pBind->perm)
- if(Group *group = GetGroup())
- if(InstanceGroupBind *groupBind = group->GetBoundInstance(this))
+ if (Group *group = GetGroup())
+ if (InstanceGroupBind *groupBind = group->GetBoundInstance(this))
pSave = groupBind->save;
return pSave;
@@ -16940,7 +16940,7 @@ void Player::UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficu
{
if (itr != m_boundInstances[difficulty].end())
{
- if(!unload) CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%u' AND instance = '%u'", GetGUIDLow(), itr->second.save->GetInstanceId());
+ if (!unload) CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%u' AND instance = '%u'", GetGUIDLow(), itr->second.save->GetInstanceId());
itr->second.save->RemovePlayer(this); // save can become invalid
m_boundInstances[difficulty].erase(itr++);
}
@@ -16948,7 +16948,7 @@ void Player::UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficu
InstancePlayerBind* Player::BindToInstance(InstanceSave *save, bool permanent, bool load)
{
- if(save)
+ if (save)
{
InstancePlayerBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()];
if (bind.save)
@@ -16964,7 +16964,7 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave *save, bool permanent, b
if (bind.save != save)
{
- if(bind.save)
+ if (bind.save)
bind.save->RemovePlayer(this);
save->AddPlayer(this);
}
@@ -16997,7 +16997,7 @@ void Player::SendRaidInfo()
{
for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
{
- if(itr->second.perm)
+ if (itr->second.perm)
{
InstanceSave *save = itr->second.save;
data << uint32(save->GetMapId()); // map id
@@ -17062,7 +17062,7 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, uint64 player
bool has_binds = false;
bool has_solo = false;
- if(player)
+ if (player)
{
player_guid = player->GetGUID();
if (!group)
@@ -17096,10 +17096,10 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, uint64 player
}
// if the player's not online we don't know what binds it has
- if(!player || !group || has_binds)
+ if (!player || !group || has_binds)
CharacterDatabase.PExecute("INSERT INTO group_instance SELECT guid, instance, permanent FROM character_instance WHERE guid = '%u'", GUID_LOPART(player_guid));
// the following should not get executed when changing leaders
- if(!player || has_solo)
+ if (!player || has_solo)
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND permanent = 0", GUID_LOPART(player_guid));
}
@@ -17114,7 +17114,7 @@ bool Player::Satisfy(AccessRequirement const *ar, uint32 target_map, bool report
{
if (ar->levelMin && getLevel() < ar->levelMin)
LevelMin = ar->levelMin;
- if(ar->heroicLevelMin && GetDungeonDifficulty() == DUNGEON_DIFFICULTY_HEROIC && getLevel() < ar->heroicLevelMin)
+ if (ar->heroicLevelMin && GetDungeonDifficulty() == DUNGEON_DIFFICULTY_HEROIC && getLevel() < ar->heroicLevelMin)
LevelMin = ar->heroicLevelMin;
if (ar->levelMax && getLevel() > ar->levelMax)
LevelMax = ar->levelMax;
@@ -17127,11 +17127,11 @@ bool Player::Satisfy(AccessRequirement const *ar, uint32 target_map, bool report
(!ar->item2 || !HasItemCount(ar->item2, 1)))
missingItem = ar->item;
}
- else if(ar->item2 && !HasItemCount(ar->item2, 1))
+ else if (ar->item2 && !HasItemCount(ar->item2, 1))
missingItem = ar->item2;
MapEntry const* mapEntry = sMapStore.LookupEntry(target_map);
- if(!mapEntry)
+ if (!mapEntry)
return false;
bool closed = false;
@@ -17164,7 +17164,7 @@ bool Player::Satisfy(AccessRequirement const *ar, uint32 target_map, bool report
uint32 missingKey = 0;
uint32 missingHeroicQuest = 0;
- if(!isNormalTargetMap)
+ if (!isNormalTargetMap)
{
if (ar->heroicKey)
{
@@ -17180,7 +17180,7 @@ bool Player::Satisfy(AccessRequirement const *ar, uint32 target_map, bool report
}
uint32 missingQuest = 0;
- if(ar->quest && !GetQuestRewardStatus(ar->quest))
+ if (ar->quest && !GetQuestRewardStatus(ar->quest))
missingQuest = ar->quest;
if (LevelMin || LevelMax || missingItem || missingKey || missingQuest || missingHeroicQuest)
@@ -17227,7 +17227,7 @@ bool Player::_LoadHomeBind(QueryResult_AutoPtr result)
MapEntry const* bindMapEntry = sMapStore.LookupEntry(m_homebindMapId);
// accept saved data only for valid position (and non instanceable), and accessable
- if( MapManager::IsValidMapCoord(m_homebindMapId,m_homebindX,m_homebindY,m_homebindZ) &&
+ if ( MapManager::IsValidMapCoord(m_homebindMapId,m_homebindX,m_homebindY,m_homebindZ) &&
!bindMapEntry->Instanceable() && GetSession()->Expansion() >= bindMapEntry->Expansion())
ok = true;
else
@@ -17588,7 +17588,7 @@ void Player::_SaveInventory()
for (size_t i = 0; i < m_itemUpdateQueue.size(); i++)
{
Item *item = m_itemUpdateQueue[i];
- if(!item) continue;
+ if (!item) continue;
Bag *container = item->GetContainer();
uint32 bag_guid = container ? container->GetGUIDLow() : 0;
@@ -17625,7 +17625,7 @@ void Player::_SaveMail()
{
CharacterDatabase.PExecute("UPDATE mail SET itemTextId = '%u',has_items = '%u',expire_time = '" UI64FMTD "', deliver_time = '" UI64FMTD "',money = '%u',cod = '%u',checked = '%u' WHERE id = '%u'",
m->itemTextId, m->HasItems() ? 1 : 0, (uint64)m->expire_time, (uint64)m->deliver_time, m->money, m->COD, m->checked, m->messageID);
- if(m->removedItems.size())
+ if (m->removedItems.size())
{
for (std::vector<uint32>::iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2)
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid = '%u'", *itr2);
@@ -17687,7 +17687,7 @@ void Player::_SaveQuestStatus()
void Player::_SaveDailyQuestStatus()
{
- if(!m_DailyQuestChanged)
+ if (!m_DailyQuestChanged)
return;
m_DailyQuestChanged = false;
@@ -17697,7 +17697,7 @@ void Player::_SaveDailyQuestStatus()
// we don't need transactions here.
CharacterDatabase.PExecute("DELETE FROM character_queststatus_daily WHERE guid = '%u'",GetGUIDLow());
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
- if(GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx))
+ if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx))
CharacterDatabase.PExecute("INSERT INTO character_queststatus_daily (guid,quest,time) VALUES ('%u', '%u','" UI64FMTD "')",
GetGUIDLow(), GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx),uint64(m_lastDailyQuestTime));
}
@@ -17707,13 +17707,13 @@ void Player::_SaveSkills()
// we don't need transactions here.
for ( SkillStatusMap::iterator itr = mSkillStatus.begin(); itr != mSkillStatus.end(); )
{
- if(itr->second.uState == SKILL_UNCHANGED)
+ if (itr->second.uState == SKILL_UNCHANGED)
{
++itr;
continue;
}
- if(itr->second.uState == SKILL_DELETED)
+ if (itr->second.uState == SKILL_DELETED)
{
CharacterDatabase.PExecute("DELETE FROM character_skills WHERE guid = '%u' AND skill = '%u' ", GetGUIDLow(), itr->first );
mSkillStatus.erase(itr++);
@@ -17768,7 +17768,7 @@ void Player::_SaveSpells()
void Player::outDebugValues() const
{
- if(!sLog.IsOutDebug()) // optimize disabled debug output
+ if (!sLog.IsOutDebug()) // optimize disabled debug output
return;
sLog.outDebug("HP is: \t\t\t%u\t\tMP is: \t\t\t%u",GetMaxHealth(), GetMaxPower(POWER_MANA));
@@ -17792,22 +17792,22 @@ void Player::outDebugValues() const
void Player::UpdateSpeakTime()
{
// ignore chat spam protection for GMs in any mode
- if(GetSession()->GetSecurity() > SEC_PLAYER)
+ if (GetSession()->GetSecurity() > SEC_PLAYER)
return;
time_t current = time (NULL);
- if(m_speakTime > current)
+ if (m_speakTime > current)
{
uint32 max_count = sWorld.getConfig(CONFIG_CHATFLOOD_MESSAGE_COUNT);
- if(!max_count)
+ if (!max_count)
return;
++m_speakCount;
- if(m_speakCount >= max_count)
+ if (m_speakCount >= max_count)
{
// prevent overwrite mute time, if message send just before mutes set, for example.
time_t new_mute = current + sWorld.getConfig(CONFIG_CHATFLOOD_MUTE_TIME);
- if(GetSession()->m_muteTime < new_mute)
+ if (GetSession()->m_muteTime < new_mute)
GetSession()->m_muteTime = new_mute;
m_speakCount = 0;
@@ -17878,7 +17878,7 @@ void Player::SetUInt32ValueInArray(Tokens& tokens,uint16 index, uint32 value)
char buf[11];
snprintf(buf,11,"%u",value);
- if(index >= tokens.size())
+ if (index >= tokens.size())
return;
tokens[index] = buf;
@@ -17887,10 +17887,10 @@ void Player::SetUInt32ValueInArray(Tokens& tokens,uint16 index, uint32 value)
void Player::SetUInt32ValueInDB(uint16 index, uint32 value, uint64 guid)
{
Tokens tokens;
- if(!LoadValuesArrayFromDB(tokens,guid))
+ if (!LoadValuesArrayFromDB(tokens,guid))
return;
- if(index >= tokens.size())
+ if (index >= tokens.size())
return;
char buf[11];
@@ -17911,7 +17911,7 @@ void Player::Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8
{
// 0
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT playerBytes2 FROM characters WHERE guid = '%u'", GUID_LOPART(guid));
- if(!result)
+ if (!result)
return;
Field* fields = result->Fetch();
@@ -18001,16 +18001,16 @@ void Player::ResetInstances(uint8 method, bool isRaid)
{
InstanceSave *p = itr->second.save;
const MapEntry *entry = sMapStore.LookupEntry(itr->first);
- if(!entry || entry->IsRaid() != isRaid || !p->CanReset())
+ if (!entry || entry->IsRaid() != isRaid || !p->CanReset())
{
++itr;
continue;
}
- if(method == INSTANCE_RESET_ALL)
+ if (method == INSTANCE_RESET_ALL)
{
// the "reset all instances" method can only reset normal maps
- if(entry->map_type == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC)
+ if (entry->map_type == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC)
{
++itr;
continue;
@@ -18019,15 +18019,15 @@ void Player::ResetInstances(uint8 method, bool isRaid)
// if the map is loaded, reset it
Map *map = MapManager::Instance().FindMap(p->GetMapId(), p->GetInstanceId());
- if(map && map->IsDungeon())
- if(!((InstanceMap*)map)->Reset(method))
+ if (map && map->IsDungeon())
+ if (!((InstanceMap*)map)->Reset(method))
{
++itr;
continue;
}
// since this is a solo instance there should not be any players inside
- if(method == INSTANCE_RESET_ALL || method == INSTANCE_RESET_CHANGE_DIFFICULTY)
+ if (method == INSTANCE_RESET_ALL || method == INSTANCE_RESET_CHANGE_DIFFICULTY)
SendResetInstanceSuccess(p->GetMapId());
p->DeleteFromDB();
@@ -18061,7 +18061,7 @@ void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId)
///checks the 15 afk reports per 5 minutes limit
void Player::UpdateAfkReport(time_t currTime)
{
- if(m_bgData.bgAfkReportedTimer <= currTime)
+ if (m_bgData.bgAfkReportedTimer <= currTime)
{
m_bgData.bgAfkReportedCount = 0;
m_bgData.bgAfkReportedTimer = currTime+5*MINUTE;
@@ -18070,9 +18070,9 @@ void Player::UpdateAfkReport(time_t currTime)
void Player::UpdateContestedPvP(uint32 diff)
{
- if(!m_contestedPvPTimer||isInCombat())
+ if (!m_contestedPvPTimer||isInCombat())
return;
- if(m_contestedPvPTimer <= diff)
+ if (m_contestedPvPTimer <= diff)
{
ResetContestedPvP();
}
@@ -18082,9 +18082,9 @@ void Player::UpdateContestedPvP(uint32 diff)
void Player::UpdatePvPFlag(time_t currTime)
{
- if(!IsPvP())
+ if (!IsPvP())
return;
- if(pvpInfo.endTimer == 0 || currTime < (pvpInfo.endTimer + 300))
+ if (pvpInfo.endTimer == 0 || currTime < (pvpInfo.endTimer + 300))
return;
UpdatePvP(false);
@@ -18092,7 +18092,7 @@ void Player::UpdatePvPFlag(time_t currTime)
void Player::UpdateDuelFlag(time_t currTime)
{
- if(!duel || duel->startTimer == 0 ||currTime < duel->startTimer + 3)
+ if (!duel || duel->startTimer == 0 ||currTime < duel->startTimer + 3)
return;
SetUInt32Value(PLAYER_DUEL_TEAM, 1);
@@ -18106,9 +18106,9 @@ void Player::UpdateDuelFlag(time_t currTime)
Pet* Player::GetPet() const
{
- if(uint64 pet_guid = GetPetGUID())
+ if (uint64 pet_guid = GetPetGUID())
{
- if(!IS_PET_GUID(pet_guid))
+ if (!IS_PET_GUID(pet_guid))
return NULL;
Pet* pet = ObjectAccessor::GetPet(pet_guid);
@@ -18116,7 +18116,7 @@ Pet* Player::GetPet() const
if (!pet)
return NULL;
- if(IsInWorld() && pet)
+ if (IsInWorld() && pet)
return pet;
//there may be a guardian in slot
@@ -18129,35 +18129,35 @@ Pet* Player::GetPet() const
void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
{
- if(!pet)
+ if (!pet)
pet = GetPet();
- if(pet)
+ if (pet)
{
sLog.outDebug("RemovePet %u, %u, %u", pet->GetEntry(), mode, returnreagent);
- if(pet->m_removed)
+ if (pet->m_removed)
return;
}
- if(returnreagent && (pet || m_temporaryUnsummonedPetNumber) && !InBattleGround())
+ if (returnreagent && (pet || m_temporaryUnsummonedPetNumber) && !InBattleGround())
{
//returning of reagents only for players, so best done here
uint32 spellId = pet ? pet->GetUInt32Value(UNIT_CREATED_BY_SPELL) : m_oldpetspell;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
- if(spellInfo)
+ if (spellInfo)
{
for (uint32 i = 0; i < 7; ++i)
{
- if(spellInfo->Reagent[i] > 0)
+ if (spellInfo->Reagent[i] > 0)
{
ItemPosCountVec dest; //for succubus, voidwalker, felhunter and felguard credit soulshard when despawn reason other than death (out of range, logout)
uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, spellInfo->Reagent[i], spellInfo->ReagentCount[i] );
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
{
Item* item = StoreNewItem( dest, spellInfo->Reagent[i], true);
- if(IsInWorld())
+ if (IsInWorld())
SendNewItem(item,spellInfo->ReagentCount[i],true,false);
}
}
@@ -18166,12 +18166,12 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
m_temporaryUnsummonedPetNumber = 0;
}
- if(!pet || pet->GetOwnerGUID()!=GetGUID())
+ if (!pet || pet->GetOwnerGUID()!=GetGUID())
return;
pet->CombatStop();
- if(returnreagent)
+ if (returnreagent)
{
switch(pet->GetEntry())
{
@@ -18193,13 +18193,13 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
pet->AddObjectToRemoveList();
pet->m_removed = true;
- if(pet->isControlled())
+ if (pet->isControlled())
{
WorldPacket data(SMSG_PET_SPELLS, 8);
data << uint64(0);
GetSession()->SendPacket(&data);
- if(GetGroup())
+ if (GetGroup())
SetGroupUpdateFlag(GROUP_UPDATE_PET);
}
}
@@ -18207,23 +18207,23 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
void Player::StopCastingCharm()
{
Unit* charm = GetCharm();
- if(!charm)
+ if (!charm)
return;
- if(charm->GetTypeId() == TYPEID_UNIT)
+ if (charm->GetTypeId() == TYPEID_UNIT)
{
- if(charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_PUPPET))
+ if (charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_PUPPET))
((Puppet*)charm)->UnSummon();
- else if(charm->IsVehicle())
+ else if (charm->IsVehicle())
ExitVehicle();
}
- if(GetCharmGUID())
+ if (GetCharmGUID())
charm->RemoveCharmAuras();
- if(GetCharmGUID())
+ if (GetCharmGUID())
{
sLog.outCrash("Player %s (GUID: " UI64FMTD " is not able to uncharm unit (GUID: " UI64FMTD " Entry: %u, Type: %u)", GetName(), GetGUID(), GetCharmGUID(), charm->GetEntry(), charm->GetTypeId());
- if(charm->GetCharmerGUID())
+ if (charm->GetCharmerGUID())
{
sLog.outCrash("Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID());
assert(false);
@@ -18251,7 +18251,7 @@ void Player::Say(const std::string& text, const uint32 language)
BuildPlayerChat(&data, CHAT_MSG_SAY, text, language);
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true);
- if(sWorld.getConfig(CONFIG_CHATLOG_PUBLIC))
+ if (sWorld.getConfig(CONFIG_CHATLOG_PUBLIC))
sLog.outChat("[SAY] Player %s says (language %u): %s",
GetName(), language, text.c_str());
}
@@ -18262,7 +18262,7 @@ void Player::Yell(const std::string& text, const uint32 language)
BuildPlayerChat(&data, CHAT_MSG_YELL, text, language);
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true);
- if(sWorld.getConfig(CONFIG_CHATLOG_PUBLIC))
+ if (sWorld.getConfig(CONFIG_CHATLOG_PUBLIC))
sLog.outChat("[YELL] Player %s yells (language %u): %s",
GetName(), language, text.c_str());
}
@@ -18273,7 +18273,7 @@ void Player::TextEmote(const std::string& text)
BuildPlayerChat(&data, CHAT_MSG_EMOTE, text, LANG_UNIVERSAL);
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true, !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT));
- if(sWorld.getConfig(CONFIG_CHATLOG_PUBLIC))
+ if (sWorld.getConfig(CONFIG_CHATLOG_PUBLIC))
sLog.outChat("[TEXTEMOTE] Player %s emotes: %s",
GetName(), text.c_str());
}
@@ -18285,12 +18285,12 @@ void Player::Whisper(const std::string& text, uint32 language,uint64 receiver)
Player *rPlayer = objmgr.GetPlayer(receiver);
- if(sWorld.getConfig(CONFIG_CHATLOG_WHISPER))
+ if (sWorld.getConfig(CONFIG_CHATLOG_WHISPER))
sLog.outChat("[WHISPER] Player %s tells %s: %s",
GetName(), rPlayer->GetName(), text.c_str());
// when player you are whispering to is dnd, he cannot receive your message, unless you are in gm mode
- if(!rPlayer->isDND() || isGameMaster())
+ if (!rPlayer->isDND() || isGameMaster())
{
WorldPacket data(SMSG_MESSAGECHAT, 200);
BuildPlayerChat(&data, CHAT_MSG_WHISPER, text, language);
@@ -18310,18 +18310,18 @@ void Player::Whisper(const std::string& text, uint32 language,uint64 receiver)
ChatHandler(this).PSendSysMessage(LANG_PLAYER_DND, rPlayer->GetName(), rPlayer->dndMsg.c_str());
}
- if(!isAcceptWhispers() && !isGameMaster() && !rPlayer->isGameMaster())
+ if (!isAcceptWhispers() && !isGameMaster() && !rPlayer->isGameMaster())
{
SetAcceptWhispers(true);
ChatHandler(this).SendSysMessage(LANG_COMMAND_WHISPERON);
}
// announce to player that player he is whispering to is afk
- if(rPlayer->isAFK())
+ if (rPlayer->isAFK())
ChatHandler(this).PSendSysMessage(LANG_PLAYER_AFK, rPlayer->GetName(), rPlayer->afkMsg.c_str());
// if player whisper someone, auto turn of dnd to be able to receive an answer
- if(isDND() && !rPlayer->isGameMaster())
+ if (isDND() && !rPlayer->isGameMaster())
ToggleDND();
}
@@ -18329,7 +18329,7 @@ void Player::PetSpellInitialize()
{
Pet* pet = GetPet();
- if(!pet)
+ if (!pet)
return;
sLog.outDebug("Pet Spells Groups");
@@ -18356,7 +18356,7 @@ void Player::PetSpellInitialize()
// spells loop
for (PetSpellMap::iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr)
{
- if(itr->second.state == PETSPELL_REMOVED)
+ if (itr->second.state == PETSPELL_REMOVED)
continue;
data << uint32(MAKE_UNIT_ACTION_BUTTON(itr->first,itr->second.active));
@@ -18399,12 +18399,12 @@ void Player::PetSpellInitialize()
void Player::PossessSpellInitialize()
{
Unit* charm = GetCharm();
- if(!charm)
+ if (!charm)
return;
CharmInfo *charmInfo = charm->GetCharmInfo();
- if(!charmInfo)
+ if (!charmInfo)
{
sLog.outError("Player::PossessSpellInitialize(): charm ("UI64FMTD") has no charminfo!", charm->GetGUID());
return;
@@ -18427,7 +18427,7 @@ void Player::PossessSpellInitialize()
void Player::VehicleSpellInitialize()
{
Creature* veh = GetVehicleCreatureBase();
- if(!veh)
+ if (!veh)
return;
// GetPosition_ is not a member of 'Vehicle', SetPosition is a member of 'Player': SetPosition(GetVehicle()->GetPositionX(), GetVehicle()->GetPositionY(), GetVehicle()->GetPositionZ(), GetVehicle()->GetOrientation());
@@ -18443,14 +18443,14 @@ void Player::VehicleSpellInitialize()
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
{
uint32 spellId = veh->ToCreature()->m_spells[i];
- if(!spellId)
+ if (!spellId)
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
- if(!spellInfo)
+ if (!spellInfo)
continue;
- if(IsPassiveSpell(spellId))
+ if (IsPassiveSpell(spellId))
{
veh->CastSpell(veh, spellId, true);
data << uint16(0) << uint8(0) << uint8(i+8);
@@ -18470,25 +18470,25 @@ void Player::VehicleSpellInitialize()
void Player::CharmSpellInitialize()
{
Unit* charm = GetFirstControlled();
- if(!charm)
+ if (!charm)
return;
CharmInfo *charmInfo = charm->GetCharmInfo();
- if(!charmInfo)
+ if (!charmInfo)
{
sLog.outError("Player::CharmSpellInitialize(): the player's charm ("UI64FMTD") has no charminfo!", charm->GetGUID());
return;
}
uint8 addlist = 0;
- if(charm->GetTypeId() != TYPEID_PLAYER)
+ if (charm->GetTypeId() != TYPEID_PLAYER)
{
CreatureInfo const *cinfo = charm->ToCreature()->GetCreatureInfo();
- //if(cinfo && cinfo->type == CREATURE_TYPE_DEMON && getClass() == CLASS_WARLOCK)
+ //if (cinfo && cinfo->type == CREATURE_TYPE_DEMON && getClass() == CLASS_WARLOCK)
{
for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
{
- if(charmInfo->GetCharmSpell(i)->GetAction())
+ if (charmInfo->GetCharmSpell(i)->GetAction())
++addlist;
}
}
@@ -18499,7 +18499,7 @@ void Player::CharmSpellInitialize()
data << uint16(0);
data << uint32(0);
- if(charm->GetTypeId() != TYPEID_PLAYER)
+ if (charm->GetTypeId() != TYPEID_PLAYER)
data << uint8(charm->ToCreature()->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0);
else
data << uint8(0) << uint8(0) << uint16(0);
@@ -18508,12 +18508,12 @@ void Player::CharmSpellInitialize()
data << uint8(addlist);
- if(addlist)
+ if (addlist)
{
for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
{
CharmSpellEntry *cspell = charmInfo->GetCharmSpell(i);
- if(cspell->GetAction())
+ if (cspell->GetAction())
data << uint32(cspell->packedData);
}
}
@@ -18719,11 +18719,11 @@ void Player::SendProficiency(uint8 pr1, uint32 pr2)
void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
{
QueryResult_AutoPtr result = QueryResult_AutoPtr(NULL);
- if(type==10)
+ if (type==10)
result = CharacterDatabase.PQuery("SELECT ownerguid,petitionguid FROM petition_sign WHERE playerguid = '%u'", GUID_LOPART(guid));
else
result = CharacterDatabase.PQuery("SELECT ownerguid,petitionguid FROM petition_sign WHERE playerguid = '%u' AND type = '%u'", GUID_LOPART(guid), type);
- if(result)
+ if (result)
{
do // this part effectively does nothing, since the deletion / modification only takes place _after_ the PetitionQuery. Though I don't know if the result remains intact if I execute the delete query beforehand.
{ // and SendPetitionQueryOpcode reads data from the DB
@@ -18733,19 +18733,19 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
// send update if charter owner in game
Player* owner = objmgr.GetPlayer(ownerguid);
- if(owner)
+ if (owner)
owner->GetSession()->SendPetitionQueryOpcode(petitionguid);
} while ( result->NextRow() );
- if(type==10)
+ if (type==10)
CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE playerguid = '%u'", GUID_LOPART(guid));
else
CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE playerguid = '%u' AND type = '%u'", GUID_LOPART(guid), type);
}
CharacterDatabase.BeginTransaction();
- if(type == 10)
+ if (type == 10)
{
CharacterDatabase.PExecute("DELETE FROM petition WHERE ownerguid = '%u'", GUID_LOPART(guid));
CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE ownerguid = '%u'", GUID_LOPART(guid));
@@ -18761,17 +18761,17 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
void Player::LeaveAllArenaTeams(uint64 guid)
{
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT arena_team_member.arenateamid FROM arena_team_member JOIN arena_team ON arena_team_member.arenateamid = arena_team.arenateamid WHERE guid='%u'", GUID_LOPART(guid));
- if(!result)
+ if (!result)
return;
do
{
Field *fields = result->Fetch();
uint32 at_id = fields[0].GetUInt32();
- if(at_id != 0)
+ if (at_id != 0)
{
ArenaTeam * at = objmgr.GetArenaTeamById(at_id);
- if(at)
+ if (at)
at->DelMember(guid);
}
} while (result->NextRow());
@@ -18780,23 +18780,23 @@ void Player::LeaveAllArenaTeams(uint64 guid)
void Player::SetRestBonus (float rest_bonus_new)
{
// Prevent resting on max level
- if(getLevel() >= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
+ if (getLevel() >= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
rest_bonus_new = 0;
- if(rest_bonus_new < 0)
+ if (rest_bonus_new < 0)
rest_bonus_new = 0;
float rest_bonus_max = (float)GetUInt32Value(PLAYER_NEXT_LEVEL_XP)*1.5/2;
- if(rest_bonus_new > rest_bonus_max)
+ if (rest_bonus_new > rest_bonus_max)
m_rest_bonus = rest_bonus_max;
else
m_rest_bonus = rest_bonus_new;
// update data for client
- if(m_rest_bonus>10)
+ if (m_rest_bonus>10)
SetByteValue(PLAYER_BYTES_2, 3, 0x01); // Set Reststate = Rested
- else if(m_rest_bonus<=1)
+ else if (m_rest_bonus<=1)
SetByteValue(PLAYER_BYTES_2, 3, 0x02); // Set Reststate = Normal
//RestTickUpdate
@@ -18812,7 +18812,7 @@ void Player::HandleStealthedUnitsDetection()
for (std::list<Unit*>::const_iterator i = stealthedUnits.begin(); i != stealthedUnits.end(); ++i)
{
- if((*i)==this)
+ if ((*i)==this)
continue;
bool hasAtClient = HaveAtClient((*i));
@@ -18820,13 +18820,13 @@ void Player::HandleStealthedUnitsDetection()
if (hasDetected)
{
- if(!hasAtClient)
+ if (!hasAtClient)
{
(*i)->SendUpdateToPlayer(this);
m_clientGUIDs.insert((*i)->GetGUID());
#ifdef TRINITY_DEBUG
- if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
+ if ((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
sLog.outDebug("Object %u (Type: %u) is detected in stealth by player %u. Distance = %f",(*i)->GetGUIDLow(),(*i)->GetTypeId(),GetGUIDLow(),GetDistance(*i));
#endif
@@ -18837,7 +18837,7 @@ void Player::HandleStealthedUnitsDetection()
}
else
{
- if(hasAtClient)
+ if (hasAtClient)
{
(*i)->DestroyForPlayer(this);
m_clientGUIDs.erase((*i)->GetGUID());
@@ -18848,11 +18848,11 @@ void Player::HandleStealthedUnitsDetection()
bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc /*= NULL*/, uint32 spellid /*= 0*/)
{
- if(nodes.size() < 2)
+ if (nodes.size() < 2)
return false;
// not let cheating with start flight in time of logout process || while in combat || has type state: stunned || has type state: root
- if(GetSession()->isLogingOut() || isInCombat() || hasUnitState(UNIT_STAT_STUNNED) || hasUnitState(UNIT_STAT_ROOT))
+ if (GetSession()->isLogingOut() || isInCombat() || hasUnitState(UNIT_STAT_STUNNED) || hasUnitState(UNIT_STAT_ROOT))
{
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
data << uint32(ERR_TAXIPLAYERBUSY);
@@ -18860,14 +18860,14 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
return false;
}
- if(HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
+ if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
return false;
// taximaster case
- if(npc)
+ if (npc)
{
// not let cheating with start flight mounted
- if(IsMounted())
+ if (IsMounted())
{
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
data << uint32(ERR_TAXIPLAYERALREADYMOUNTED);
@@ -18875,7 +18875,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
return false;
}
- if( m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW )
+ if ( m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW )
{
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
data << uint32(ERR_TAXIPLAYERSHAPESHIFTED);
@@ -18884,7 +18884,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
}
// not let cheating with start flight in time of logout process || if casting not finished || while in combat || if not use Spell's with EffectSendTaxi
- if(IsNonMeleeSpellCasted(false))
+ if (IsNonMeleeSpellCasted(false))
{
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
data << uint32(ERR_TAXIPLAYERBUSY);
@@ -18897,7 +18897,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
{
RemoveAurasByType(SPELL_AURA_MOUNTED);
- if( m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW )
+ if ( m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW )
RemoveAurasDueToSpell(m_ShapeShiftFormSpellId);
if (Spell* spell = GetCurrentSpell(CURRENT_GENERIC_SPELL))
@@ -18979,7 +18979,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
lastnode = nodes[i];
objmgr.GetTaxiPath(prevnode, lastnode, path, cost);
- if(!path)
+ if (!path)
{
m_taxi.ClearTaxiDestinations();
return false;
@@ -18987,7 +18987,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
totalcost += cost;
- if(prevnode == sourcenode)
+ if (prevnode == sourcenode)
sourcepath = path;
m_taxi.AddTaxiDestination(lastnode);
@@ -19018,7 +19018,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
if (npc)
totalcost = (uint32)ceil(totalcost*GetReputationPriceDiscount(npc));
- if(money < totalcost)
+ if (money < totalcost)
{
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
data << uint32(ERR_TAXINOTENOUGHMONEY);
@@ -19056,7 +19056,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
bool Player::ActivateTaxiPathTo( uint32 taxi_path_id, uint32 spellid /*= 0*/ )
{
TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(taxi_path_id);
- if(!entry)
+ if (!entry)
return false;
std::vector<uint32> nodes;
@@ -19104,7 +19104,7 @@ void Player::ContinueTaxiFlight()
TaxiPathNode const& prevNode = nodeList[i-1];
// skip nodes at another map
- if(node.mapid != GetMapId())
+ if (node.mapid != GetMapId())
continue;
distPrev = distNext;
@@ -19119,7 +19119,7 @@ void Player::ContinueTaxiFlight()
(node.y-prevNode.y)*(node.y-prevNode.y)+
(node.z-prevNode.z)*(node.z-prevNode.z);
- if(distNext + distPrev < distNodes)
+ if (distNext + distPrev < distNodes)
{
startNode = i;
break;
@@ -19152,10 +19152,10 @@ void Player::ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs )
if (spellInfo->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE)
continue;
- if(spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE)
+ if (spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE)
continue;
- if((idSchoolMask & GetSpellSchoolMask(spellInfo)) && GetSpellCooldownDelay(unSpellId) < unTimeMs )
+ if ((idSchoolMask & GetSpellSchoolMask(spellInfo)) && GetSpellCooldownDelay(unSpellId) < unTimeMs )
{
data << uint32(unSpellId);
data << uint32(unTimeMs); // in m.secs
@@ -19168,7 +19168,7 @@ void Player::ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs )
void Player::InitDataForForm(bool reapplyMods)
{
SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(m_form);
- if(ssEntry && ssEntry->attackSpeed)
+ if (ssEntry && ssEntry->attackSpeed)
{
SetAttackTime(BASE_ATTACK,ssEntry->attackSpeed);
SetAttackTime(OFF_ATTACK,ssEntry->attackSpeed);
@@ -19182,21 +19182,21 @@ void Player::InitDataForForm(bool reapplyMods)
case FORM_GHOUL:
case FORM_CAT:
{
- if(getPowerType()!=POWER_ENERGY)
+ if (getPowerType()!=POWER_ENERGY)
setPowerType(POWER_ENERGY);
break;
}
case FORM_BEAR:
case FORM_DIREBEAR:
{
- if(getPowerType()!=POWER_RAGE)
+ if (getPowerType()!=POWER_RAGE)
setPowerType(POWER_RAGE);
break;
}
default: // 0, for example
{
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(getClass());
- if(cEntry && cEntry->powerType < MAX_POWERS && uint32(getPowerType()) != cEntry->powerType)
+ if (cEntry && cEntry->powerType < MAX_POWERS && uint32(getPowerType()) != cEntry->powerType)
setPowerType(Powers(cEntry->powerType));
break;
}
@@ -19213,7 +19213,7 @@ void Player::InitDataForForm(bool reapplyMods)
void Player::InitDisplayIds()
{
PlayerInfo const *info = objmgr.GetPlayerInfo(getRace(), getClass());
- if(!info)
+ if (!info)
{
sLog.outError("Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow());
return;
@@ -19243,7 +19243,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint
if (count < 1) count = 1;
// cheating attempt
- if(slot > MAX_BAG_SIZE && slot !=NULL_SLOT)
+ if (slot > MAX_BAG_SIZE && slot !=NULL_SLOT)
return false;
if (!isAlive())
@@ -19265,7 +19265,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint
}
VendorItemData const* vItems = pCreature->GetVendorItems();
- if(!vItems || vItems->Empty())
+ if (!vItems || vItems->Empty())
{
SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
return false;
@@ -19330,7 +19330,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint
// item base price
for (uint8 i = 0; i < 5; ++i)
{
- if(iece->reqitem[i] && !HasItemCount(iece->reqitem[i], (iece->reqitemcount[i] * count)))
+ if (iece->reqitem[i] && !HasItemCount(iece->reqitem[i], (iece->reqitemcount[i] * count)))
{
SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL);
return false;
@@ -19338,7 +19338,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint
}
// check for personal arena rating requirement
- if( GetMaxPersonalArenaRatingRequirement(iece->reqarenaslot) < iece->reqpersonalarenarating )
+ if ( GetMaxPersonalArenaRatingRequirement(iece->reqarenaslot) < iece->reqpersonalarenarating )
{
// probably not the proper equip err
SendEquipError(EQUIP_ERR_CANT_EQUIP_RANK,NULL,NULL);
@@ -19435,7 +19435,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint
for (uint8 i = 0; i < 5; ++i)
{
- if(iece->reqitem[i])
+ if (iece->reqitem[i])
DestroyItemCount(iece->reqitem[i], iece->reqitemcount[i] * count, true);
}
}
@@ -19482,12 +19482,12 @@ uint32 Player::GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot)
uint32 max_personal_rating = 0;
for (uint8 i = minarenaslot; i < MAX_ARENA_SLOT; ++i)
{
- if(ArenaTeam * at = objmgr.GetArenaTeamById(GetArenaTeamId(i)))
+ if (ArenaTeam * at = objmgr.GetArenaTeamById(GetArenaTeamId(i)))
{
uint32 p_rating = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (i * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING);
uint32 t_rating = at->GetRating();
p_rating = p_rating < t_rating ? p_rating : t_rating;
- if(max_personal_rating < p_rating)
+ if (max_personal_rating < p_rating)
max_personal_rating = p_rating;
}
}
@@ -19499,7 +19499,7 @@ void Player::UpdateHomebindTime(uint32 time)
// GMs never get homebind timer online
if (m_InstanceValid || isGameMaster())
{
- if(m_HomebindTimer) // instance valid, but timer not reset
+ if (m_HomebindTimer) // instance valid, but timer not reset
{
// hide reminder
WorldPacket data(SMSG_RAID_GROUP_ONLY, 4+4);
@@ -19538,48 +19538,48 @@ void Player::UpdateHomebindTime(uint32 time)
void Player::UpdatePvPState(bool onlyFFA)
{
// TODO: should we always synchronize UNIT_FIELD_BYTES_2, 1 of controller and controlled?
- if(!pvpInfo.inNoPvPArea && !isGameMaster()
+ if (!pvpInfo.inNoPvPArea && !isGameMaster()
&& (pvpInfo.inFFAPvPArea || sWorld.IsFFAPvPRealm()))
{
- if(!HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
+ if (!HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
{
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
for (ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
(*itr)->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
}
}
- else if(HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
+ else if (HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
{
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
for (ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
(*itr)->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
}
- if(onlyFFA)
+ if (onlyFFA)
return;
- if(pvpInfo.inHostileArea) // in hostile area
+ if (pvpInfo.inHostileArea) // in hostile area
{
- if(!IsPvP() || pvpInfo.endTimer != 0)
+ if (!IsPvP() || pvpInfo.endTimer != 0)
UpdatePvP(true, true);
}
else // in friendly area
{
- if(IsPvP() && !HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_IN_PVP) && pvpInfo.endTimer == 0)
+ if (IsPvP() && !HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_IN_PVP) && pvpInfo.endTimer == 0)
pvpInfo.endTimer = time(0); // start toggle-off
}
}
void Player::UpdatePvP(bool state, bool override)
{
- if(!state || override)
+ if (!state || override)
{
SetPvP(state);
pvpInfo.endTimer = 0;
}
else
{
- if(pvpInfo.endTimer != 0)
+ if (pvpInfo.endTimer != 0)
pvpInfo.endTimer = time(NULL);
else
SetPvP(state);
@@ -19597,13 +19597,13 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it
// cooldown information stored in item prototype
// This used in same way in WorldSession::HandleItemQuerySingleOpcode data sending to client.
- if(itemId)
+ if (itemId)
{
- if(ItemPrototype const* proto = ObjectMgr::GetItemPrototype(itemId))
+ if (ItemPrototype const* proto = ObjectMgr::GetItemPrototype(itemId))
{
for (uint8 idx = 0; idx < 5; ++idx)
{
- if(proto->Spells[idx].SpellId == spellInfo->Id)
+ if (proto->Spells[idx].SpellId == spellInfo->Id)
{
cat = proto->Spells[idx].SpellCategory;
rec = proto->Spells[idx].SpellCooldown;
@@ -19615,7 +19615,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it
}
// if no cooldown found above then base at DBC data
- if(rec < 0 && catrec < 0)
+ if (rec < 0 && catrec < 0)
{
cat = spellInfo->Category;
rec = spellInfo->RecoveryTime;
@@ -19628,7 +19628,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it
time_t recTime;
// overwrite time for selected category
- if(infinityCooldown)
+ if (infinityCooldown)
{
// use +MONTH as infinity mark for spell cooldown (will checked as MONTH/2 at save ans skipped)
// but not allow ignore until reset or re-login
@@ -19643,10 +19643,10 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it
rec = GetAttackTime(RANGED_ATTACK);
// Now we have cooldown data (if found any), time to apply mods
- if(rec > 0)
+ if (rec > 0)
ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, rec, spell);
- if(catrec > 0)
+ if (catrec > 0)
ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, catrec, spell);
// replace negative cooldowns by 0
@@ -19654,7 +19654,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it
if (catrec < 0) catrec = 0;
// no cooldown after applying spell mods
- if( rec == 0 && catrec == 0)
+ if ( rec == 0 && catrec == 0)
return;
catrecTime = catrec ? curTime+catrec/IN_MILISECONDS : 0;
@@ -19662,18 +19662,18 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it
}
// self spell cooldown
- if(recTime > 0)
+ if (recTime > 0)
AddSpellCooldown(spellInfo->Id, itemId, recTime);
// category spells
if (cat && catrec > 0)
{
SpellCategoryStore::const_iterator i_scstore = sSpellCategoryStore.find(cat);
- if(i_scstore != sSpellCategoryStore.end())
+ if (i_scstore != sSpellCategoryStore.end())
{
for (SpellCategorySet::const_iterator i_scset = i_scstore->second.begin(); i_scset != i_scstore->second.end(); ++i_scset)
{
- if(*i_scset == spellInfo->Id) // skip main spell, already handled above
+ if (*i_scset == spellInfo->Id) // skip main spell, already handled above
continue;
AddSpellCooldown(*i_scset, itemId, catrecTime);
@@ -19705,17 +19705,17 @@ void Player::SendCooldownEvent(SpellEntry const *spellInfo, uint32 itemId, Spell
void Player::UpdatePotionCooldown(Spell* spell)
{
// no potion used i combat or still in combat
- if(!m_lastPotionId || isInCombat())
+ if (!m_lastPotionId || isInCombat())
return;
// Call not from spell cast, send cooldown event for item spells if no in combat
- if(!spell)
+ if (!spell)
{
// spell/item pair let set proper cooldown (except not existed charged spell cooldown spellmods for potions)
- if(ItemPrototype const* proto = ObjectMgr::GetItemPrototype(m_lastPotionId))
+ if (ItemPrototype const* proto = ObjectMgr::GetItemPrototype(m_lastPotionId))
for (uint8 idx = 0; idx < 5; ++idx)
- if(proto->Spells[idx].SpellId && proto->Spells[idx].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE)
- if(SpellEntry const* spellInfo = sSpellStore.LookupEntry(proto->Spells[idx].SpellId))
+ if (proto->Spells[idx].SpellId && proto->Spells[idx].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE)
+ if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(proto->Spells[idx].SpellId))
SendCooldownEvent(spellInfo,m_lastPotionId);
}
// from spell cases (m_lastPotionId set in Spell::SendSpellCooldown)
@@ -19728,12 +19728,12 @@ void Player::UpdatePotionCooldown(Spell* spell)
//slot to be excluded while counting
bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
{
- if(!enchantmentcondition)
+ if (!enchantmentcondition)
return true;
SpellItemEnchantmentConditionEntry const *Condition = sSpellItemEnchantmentConditionStore.LookupEntry(enchantmentcondition);
- if(!Condition)
+ if (!Condition)
return true;
uint8 curcount[4] = {0, 0, 0, 0};
@@ -19749,30 +19749,30 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+3; ++enchant_slot)
{
uint32 enchant_id = pItem2->GetEnchantmentId(EnchantmentSlot(enchant_slot));
- if(!enchant_id)
+ if (!enchant_id)
continue;
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
- if(!enchantEntry)
+ if (!enchantEntry)
continue;
uint32 gemid = enchantEntry->GemID;
- if(!gemid)
+ if (!gemid)
continue;
ItemPrototype const* gemProto = sItemStorage.LookupEntry<ItemPrototype>(gemid);
- if(!gemProto)
+ if (!gemProto)
continue;
GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties);
- if(!gemProperty)
+ if (!gemProperty)
continue;
uint8 GemColor = gemProperty->color;
for (uint8 b = 0, tmpcolormask = 1; b < 4; b++, tmpcolormask <<= 1)
{
- if(tmpcolormask & GemColor)
+ if (tmpcolormask & GemColor)
++curcount[b];
}
}
@@ -19783,7 +19783,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
for (uint8 i = 0; i < 5; i++)
{
- if(!Condition->Color[i])
+ if (!Condition->Color[i])
continue;
uint32 _cur_gem = curcount[Condition->Color[i] - 1];
@@ -19816,31 +19816,31 @@ void Player::CorrectMetaGemEnchants(uint8 exceptslot, bool apply)
for (uint32 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
{
//enchants for the slot being socketed are handled by Player::ApplyItemMods
- if(slot == exceptslot)
+ if (slot == exceptslot)
continue;
Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, slot );
- if(!pItem || !pItem->GetProto()->Socket[0].Color)
+ if (!pItem || !pItem->GetProto()->Socket[0].Color)
continue;
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+3; ++enchant_slot)
{
uint32 enchant_id = pItem->GetEnchantmentId(EnchantmentSlot(enchant_slot));
- if(!enchant_id)
+ if (!enchant_id)
continue;
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
- if(!enchantEntry)
+ if (!enchantEntry)
continue;
uint32 condition = enchantEntry->EnchantmentCondition;
- if(condition)
+ if (condition)
{
//was enchant active with/without item?
bool wasactive = EnchantmentFitsRequirements(condition, apply ? exceptslot : -1);
//should it now be?
- if(wasactive ^ EnchantmentFitsRequirements(condition, apply ? -1 : exceptslot))
+ if (wasactive ^ EnchantmentFitsRequirements(condition, apply ? -1 : exceptslot))
{
// ignore item gem conditions
//if state changed, (dis)apply enchant
@@ -19858,28 +19858,28 @@ void Player::ToggleMetaGemsActive(uint8 exceptslot, bool apply)
for (int slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
{
//enchants for the slot being socketed are handled by WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
- if(slot == exceptslot)
+ if (slot == exceptslot)
continue;
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, slot );
- if(!pItem || !pItem->GetProto()->Socket[0].Color) //if item has no sockets or no item is equipped go to next item
+ if (!pItem || !pItem->GetProto()->Socket[0].Color) //if item has no sockets or no item is equipped go to next item
continue;
//cycle all (gem)enchants
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+3; ++enchant_slot)
{
uint32 enchant_id = pItem->GetEnchantmentId(EnchantmentSlot(enchant_slot));
- if(!enchant_id) //if no enchant go to next enchant(slot)
+ if (!enchant_id) //if no enchant go to next enchant(slot)
continue;
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
- if(!enchantEntry)
+ if (!enchantEntry)
continue;
//only metagems to be (de)activated, so only enchants with condition
uint32 condition = enchantEntry->EnchantmentCondition;
- if(condition)
+ if (condition)
ApplyEnchantment(pItem,EnchantmentSlot(enchant_slot), apply);
}
}
@@ -19913,7 +19913,7 @@ void Player::SetBattleGroundEntryPoint()
m_bgData.mountSpell = 0;
// If map is dungeon find linked graveyard
- if(GetMap()->IsDungeon())
+ if (GetMap()->IsDungeon())
{
if (const WorldSafeLocsEntry* entry = objmgr.GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam()))
{
@@ -19937,17 +19937,17 @@ void Player::SetBattleGroundEntryPoint()
void Player::LeaveBattleground(bool teleportToEntryPoint)
{
- if(BattleGround *bg = GetBattleGround())
+ if (BattleGround *bg = GetBattleGround())
{
bg->RemovePlayerAtLeave(GetGUID(), teleportToEntryPoint, true);
// call after remove to be sure that player resurrected for correct cast
- if( bg->isBattleGround() && !isGameMaster() && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER) )
+ if ( bg->isBattleGround() && !isGameMaster() && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER) )
{
- if( bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN )
+ if ( bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN )
{
//lets check if player was teleported from BG and schedule delayed Deserter spell cast
- if(IsBeingTeleportedFar())
+ if (IsBeingTeleportedFar())
{
ScheduleDelayedOperation(DELAYED_SPELL_CAST_DESERTER);
return;
@@ -19971,7 +19971,7 @@ bool Player::CanJoinToBattleground() const
bool Player::CanReportAfkDueToLimit()
{
// a player can complain about 15 people per 5 minutes
- if(m_bgData.bgAfkReportedCount++ >= 15)
+ if (m_bgData.bgAfkReportedCount++ >= 15)
return false;
return true;
@@ -19981,15 +19981,15 @@ bool Player::CanReportAfkDueToLimit()
void Player::ReportedAfkBy(Player* reporter)
{
BattleGround *bg = GetBattleGround();
- if(!bg || bg != reporter->GetBattleGround() || GetTeam() != reporter->GetTeam())
+ if (!bg || bg != reporter->GetBattleGround() || GetTeam() != reporter->GetTeam())
return;
// check if player has 'Idle' or 'Inactive' debuff
- if(m_bgData.bgAfkReporter.find(reporter->GetGUIDLow())==m_bgData.bgAfkReporter.end() && !HasAura(43680) && !HasAura(43681) && reporter->CanReportAfkDueToLimit())
+ if (m_bgData.bgAfkReporter.find(reporter->GetGUIDLow())==m_bgData.bgAfkReporter.end() && !HasAura(43680) && !HasAura(43681) && reporter->CanReportAfkDueToLimit())
{
m_bgData.bgAfkReporter.insert(reporter->GetGUIDLow());
// 3 players have to complain to apply debuff
- if(m_bgData.bgAfkReporter.size() >= 3)
+ if (m_bgData.bgAfkReporter.size() >= 3)
{
// cast 'Idle' spell
CastSpell(this, 43680, true);
@@ -20014,7 +20014,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
return true;
// phased visibility (both must phased in same way)
- if(!InSamePhase(u))
+ if (!InSamePhase(u))
return false;
// player visible for other player if not logout and at same transport
@@ -20026,46 +20026,46 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
&& GetTransport() == u->ToPlayer()->GetTransport();
// not in world
- if(!at_same_transport && (!IsInWorld() || !u->IsInWorld()))
+ if (!at_same_transport && (!IsInWorld() || !u->IsInWorld()))
return false;
// forbidden to seen (at GM respawn command)
- //if(u->GetVisibility() == VISIBILITY_RESPAWN)
+ //if (u->GetVisibility() == VISIBILITY_RESPAWN)
// return false;
Map& _map = *u->GetMap();
// Grid dead/alive checks
// non visible at grid for any stealth state
- if(!u->IsVisibleInGridForPlayer(this))
+ if (!u->IsVisibleInGridForPlayer(this))
return false;
// always seen by owner
- if(uint64 guid = u->GetCharmerOrOwnerGUID())
- if(GetGUID() == guid)
+ if (uint64 guid = u->GetCharmerOrOwnerGUID())
+ if (GetGUID() == guid)
return true;
- if(uint64 guid = GetUInt64Value(PLAYER_FARSIGHT))
- if(u->GetGUID() == guid)
+ if (uint64 guid = GetUInt64Value(PLAYER_FARSIGHT))
+ if (u->GetGUID() == guid)
return true;
// different visible distance checks
- if(isInFlight()) // what see player in flight
+ if (isInFlight()) // what see player in flight
{
if (!m_seer->IsWithinDistInMap(u, _map.GetVisibilityDistance() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
return false;
}
- else if(!u->isAlive()) // distance for show body
+ else if (!u->isAlive()) // distance for show body
{
if (!m_seer->IsWithinDistInMap(u, _map.GetVisibilityDistance() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
return false;
}
- else if(u->GetTypeId() == TYPEID_PLAYER) // distance for show player
+ else if (u->GetTypeId() == TYPEID_PLAYER) // distance for show player
{
// Players far than max visible distance for player or not in our map are not visible too
if (!at_same_transport && !m_seer->IsWithinDistInMap(u, _map.GetVisibilityDistance() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
return false;
}
- else if(u->GetCharmerOrOwnerGUID()) // distance for show pet/charmed
+ else if (u->GetCharmerOrOwnerGUID()) // distance for show pet/charmed
{
// Pet/charmed far than max visible distance for player or not in our map are not visible too
if (!m_seer->IsWithinDistInMap(u, _map.GetVisibilityDistance() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
@@ -20081,12 +20081,12 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
return false;
}
- if(u->GetVisibility() == VISIBILITY_OFF)
+ if (u->GetVisibility() == VISIBILITY_OFF)
{
// GMs see any players, not higher GMs and all units
- if(isGameMaster())
+ if (isGameMaster())
{
- if(u->GetTypeId() == TYPEID_PLAYER)
+ if (u->GetTypeId() == TYPEID_PLAYER)
return u->ToPlayer()->GetSession()->GetSecurity() <= GetSession()->GetSecurity();
else
return true;
@@ -20095,33 +20095,33 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
}
// GM's can see everyone with invisibilitymask with less or equal security level
- if(m_mover->m_invisibilityMask || u->m_invisibilityMask)
+ if (m_mover->m_invisibilityMask || u->m_invisibilityMask)
{
- if(isGameMaster())
+ if (isGameMaster())
{
- if(u->GetTypeId() == TYPEID_PLAYER)
+ if (u->GetTypeId() == TYPEID_PLAYER)
return u->ToPlayer()->GetSession()->GetSecurity() <= GetSession()->GetSecurity();
else
return true;
}
// player see other player with stealth/invisibility only if he in same group or raid or same team (raid/team case dependent from conf setting)
- if(!m_mover->canDetectInvisibilityOf(u))
- if(!(u->GetTypeId() == TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(const_cast<Player*>(u->ToPlayer() ))))
+ if (!m_mover->canDetectInvisibilityOf(u))
+ if (!(u->GetTypeId() == TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(const_cast<Player*>(u->ToPlayer() ))))
return false;
}
// GM invisibility checks early, invisibility if any detectable, so if not stealth then visible
- if(u->GetVisibility() == VISIBILITY_GROUP_STEALTH && !isGameMaster())
+ if (u->GetVisibility() == VISIBILITY_GROUP_STEALTH && !isGameMaster())
{
// if player is dead then he can't detect anyone in any cases
//do not know what is the use of this detect
// stealth and detected and visible for some seconds
- if(!isAlive())
+ if (!isAlive())
detect = false;
- if(m_DetectInvTimer < 300 || !HaveAtClient(u))
- if(!(u->GetTypeId() == TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(const_cast<Player*>(u->ToPlayer()))))
- if(!detect || !m_mover->canDetectStealthOf(u, GetDistance(u)))
+ if (m_DetectInvTimer < 300 || !HaveAtClient(u))
+ if (!(u->GetTypeId() == TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(const_cast<Player*>(u->ToPlayer()))))
+ if (!detect || !m_mover->canDetectStealthOf(u, GetDistance(u)))
return false;
}
@@ -20134,7 +20134,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
bool Player::IsVisibleInGridForPlayer( Player const * pl ) const
{
// gamemaster in GM mode see all, including ghosts
- if(pl->isGameMaster() && GetSession()->GetSecurity() <= pl->GetSession()->GetSecurity())
+ if (pl->isGameMaster() && GetSession()->GetSecurity() <= pl->GetSession()->GetSecurity())
return true;
// It seems in battleground everyone sees everyone, except the enemy-faction ghosts
@@ -20146,23 +20146,23 @@ bool Player::IsVisibleInGridForPlayer( Player const * pl ) const
}
// Live player see live player or dead player with not realized corpse
- if(pl->isAlive() || pl->m_deathTimer > 0)
+ if (pl->isAlive() || pl->m_deathTimer > 0)
{
return isAlive() || m_deathTimer > 0;
}
// Ghost see other friendly ghosts, that's for sure
- if(!(isAlive() || m_deathTimer > 0) && IsFriendlyTo(pl))
+ if (!(isAlive() || m_deathTimer > 0) && IsFriendlyTo(pl))
return true;
// Dead player see live players near own corpse
- if(isAlive())
+ if (isAlive())
{
Corpse *corpse = pl->GetCorpse();
- if(corpse)
+ if (corpse)
{
// 20 - aggro distance for same level, 25 - max additional distance if player level less that creature level
- if(corpse->IsWithinDistInMap(this,(20+25)*sWorld.getRate(RATE_CREATURE_AGGRO)))
+ if (corpse->IsWithinDistInMap(this,(20+25)*sWorld.getRate(RATE_CREATURE_AGGRO)))
return true;
}
}
@@ -20173,7 +20173,7 @@ bool Player::IsVisibleInGridForPlayer( Player const * pl ) const
bool Player::IsVisibleGloballyFor( Player* u ) const
{
- if(!u)
+ if (!u)
return false;
// Always can see self
@@ -20205,7 +20205,7 @@ inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, T* target, std::set
template<>
inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, GameObject* target, std::set<Unit*>& v)
{
- if(!target->IsTransport())
+ if (!target->IsTransport())
s64.insert(target->GetGUID());
}
@@ -20237,9 +20237,9 @@ inline void BeforeVisibilityDestroy<Creature>(Creature* t, Player* p)
void Player::UpdateVisibilityOf(WorldObject* target)
{
- if(HaveAtClient(target))
+ if (HaveAtClient(target))
{
- if(!target->isVisibleForInState(this, true))
+ if (!target->isVisibleForInState(this, true))
{
if (target->GetTypeId()==TYPEID_UNIT)
BeforeVisibilityDestroy<Creature>(target->ToCreature(),this);
@@ -20248,29 +20248,29 @@ void Player::UpdateVisibilityOf(WorldObject* target)
m_clientGUIDs.erase(target->GetGUID());
#ifdef TRINITY_DEBUG
- if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
+ if ((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
sLog.outDebug("Object %u (Type: %u) out of range for player %u. Distance = %f",target->GetGUIDLow(),target->GetTypeId(),GetGUIDLow(),GetDistance(target));
#endif
}
}
else
{
- if(target->isVisibleForInState(this,false))
+ if (target->isVisibleForInState(this,false))
{
- //if(target->isType(TYPEMASK_UNIT) && ((Unit*)target)->m_Vehicle)
+ //if (target->isType(TYPEMASK_UNIT) && ((Unit*)target)->m_Vehicle)
// UpdateVisibilityOf(((Unit*)target)->m_Vehicle);
target->SendUpdateToPlayer(this);
m_clientGUIDs.insert(target->GetGUID());
#ifdef TRINITY_DEBUG
- if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
+ if ((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
sLog.outDebug("Object %u (Type: %u) is visible now for player %u. Distance = %f",target->GetGUIDLow(),target->GetTypeId(),GetGUIDLow(),GetDistance(target));
#endif
// target aura duration for caster show only if target exist at caster client
// send data at target visibility change (adding to client)
- if(target->isType(TYPEMASK_UNIT))
+ if (target->isType(TYPEMASK_UNIT))
SendInitialVisiblePackets((Unit*)target);
}
}
@@ -20279,11 +20279,11 @@ void Player::UpdateVisibilityOf(WorldObject* target)
void Player::SendInitialVisiblePackets(Unit* target)
{
SendAurasForTarget(target);
- if(target->isAlive())
+ if (target->isAlive())
{
- if(target->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE)
+ if (target->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE)
target->SendMonsterMoveWithSpeedToCurrentDestination(this);
- if(target->hasUnitState(UNIT_STAT_MELEE_ATTACKING) && target->getVictim())
+ if (target->hasUnitState(UNIT_STAT_MELEE_ATTACKING) && target->getVictim())
target->SendMeleeAttackStart(target->getVictim());
}
}
@@ -20291,9 +20291,9 @@ void Player::SendInitialVisiblePackets(Unit* target)
template<class T>
void Player::UpdateVisibilityOf(T* target, UpdateData& data, std::set<Unit*>& visibleNow)
{
- if(HaveAtClient(target))
+ if (HaveAtClient(target))
{
- if(!target->isVisibleForInState(this,true))
+ if (!target->isVisibleForInState(this,true))
{
BeforeVisibilityDestroy<T>(target,this);
@@ -20301,23 +20301,23 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, std::set<Unit*>& vi
m_clientGUIDs.erase(target->GetGUID());
#ifdef TRINITY_DEBUG
- if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
+ if ((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
sLog.outDebug("Object %u (Type: %u, Entry: %u) is out of range for player %u. Distance = %f",target->GetGUIDLow(),target->GetTypeId(),target->GetEntry(),GetGUIDLow(),GetDistance(target));
#endif
}
}
- else //if(visibleNow.size() < 30 || target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsVehicle())
+ else //if (visibleNow.size() < 30 || target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsVehicle())
{
- if(target->isVisibleForInState(this,false))
+ if (target->isVisibleForInState(this,false))
{
- //if(target->isType(TYPEMASK_UNIT) && ((Unit*)target)->m_Vehicle)
+ //if (target->isType(TYPEMASK_UNIT) && ((Unit*)target)->m_Vehicle)
// UpdateVisibilityOf(((Unit*)target)->m_Vehicle, data, visibleNow);
target->BuildCreateUpdateBlockForPlayer(&data, this);
UpdateVisibilityOf_helper(m_clientGUIDs,target,visibleNow);
#ifdef TRINITY_DEBUG
- if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
+ if ((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
sLog.outDebug("Object %u (Type: %u, Entry: %u) is visible now for player %u. Distance = %f",target->GetGUIDLow(),target->GetTypeId(),target->GetEntry(),GetGUIDLow(),GetDistance(target));
#endif
}
@@ -20358,14 +20358,14 @@ void Player::InitPrimaryProfessions()
Unit * Player::GetSelectedUnit() const
{
- if(m_curSelection)
+ if (m_curSelection)
return ObjectAccessor::GetUnit(*this, m_curSelection);
return NULL;
}
Player * Player::GetSelectedPlayer() const
{
- if(m_curSelection)
+ if (m_curSelection)
return ObjectAccessor::GetPlayer(*this, m_curSelection);
return NULL;
}
@@ -20376,7 +20376,7 @@ void Player::SendComboPoints()
if (combotarget)
{
WorldPacket data;
- if(m_mover != this)
+ if (m_mover != this)
{
data.Initialize(SMSG_PET_UPDATE_COMBO_POINTS, m_mover->GetPackGUID().size()+combotarget->GetPackGUID().size()+1);
data.append(m_mover->GetPackGUID());
@@ -20391,7 +20391,7 @@ void Player::SendComboPoints()
void Player::AddComboPoints(Unit* target, int8 count, Spell * spell)
{
- if(!count)
+ if (!count)
return;
int8 * comboPoints = spell ? &spell->m_comboPointGain : &m_comboPoints;
@@ -20428,7 +20428,7 @@ void Player::AddComboPoints(Unit* target, int8 count, Spell * spell)
void Player::GainSpellComboPoints(int8 count)
{
- if(!count)
+ if (!count)
return;
m_comboPoints += count;
@@ -20440,7 +20440,7 @@ void Player::GainSpellComboPoints(int8 count)
void Player::ClearComboPoints()
{
- if(!m_comboTarget)
+ if (!m_comboTarget)
return;
// without combopoints lost (duration checked in aura)
@@ -20450,7 +20450,7 @@ void Player::ClearComboPoints()
SendComboPoints();
- if(Unit* target = ObjectAccessor::GetUnit(*this,m_comboTarget))
+ if (Unit* target = ObjectAccessor::GetUnit(*this,m_comboTarget))
target->RemoveComboPointHolder(GetGUIDLow());
m_comboTarget = 0;
@@ -20458,7 +20458,7 @@ void Player::ClearComboPoints()
void Player::SetGroup(Group *group, int8 subgroup)
{
- if(group == NULL)
+ if (group == NULL)
m_group.unlink();
else
{
@@ -20542,15 +20542,15 @@ void Player::SendInitialPacketsAfterAddToMap()
for (AuraType const* itr = &auratypes[0]; itr && itr[0] != SPELL_AURA_NONE; ++itr)
{
Unit::AuraEffectList const& auraList = GetAuraEffectsByType(*itr);
- if(!auraList.empty())
+ if (!auraList.empty())
auraList.front()->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
}
- if(HasAuraType(SPELL_AURA_MOD_STUN))
+ if (HasAuraType(SPELL_AURA_MOD_STUN))
SetMovement(MOVE_ROOT);
// manual send package (have code in HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); that don't must be re-applied.
- if(HasAuraType(SPELL_AURA_MOD_ROOT))
+ if (HasAuraType(SPELL_AURA_MOD_ROOT))
{
WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 10);
data2.append(GetPackGUID());
@@ -20567,12 +20567,12 @@ void Player::SendUpdateToOutOfRangeGroupMembers()
{
if (m_groupUpdateMask == GROUP_UPDATE_FLAG_NONE)
return;
- if(Group* group = GetGroup())
+ if (Group* group = GetGroup())
group->UpdatePlayerOutOfRange(this);
m_groupUpdateMask = GROUP_UPDATE_FLAG_NONE;
m_auraRaidUpdateMask = 0;
- if(Pet *pet = GetPet())
+ if (Pet *pet = GetPet())
pet->ResetAuraUpdateMaskForRaid();
}
@@ -20597,11 +20597,11 @@ void Player::SendInstanceResetWarning( uint32 mapid, Difficulty difficulty, uint
{
// type of warning, based on the time remaining until reset
uint32 type;
- if(time > 3600)
+ if (time > 3600)
type = RAID_INSTANCE_WELCOME;
- else if(time > 900 && time <= 3600)
+ else if (time > 900 && time <= 3600)
type = RAID_INSTANCE_WARNING_HOURS;
- else if(time > 300 && time <= 900)
+ else if (time > 300 && time <= 900)
type = RAID_INSTANCE_WARNING_MIN;
else
type = RAID_INSTANCE_WARNING_MIN_SOON;
@@ -20611,7 +20611,7 @@ void Player::SendInstanceResetWarning( uint32 mapid, Difficulty difficulty, uint
data << uint32(mapid);
data << uint32(difficulty); // difficulty
data << uint32(time);
- if(type == RAID_INSTANCE_WELCOME)
+ if (type == RAID_INSTANCE_WELCOME)
{
data << uint8(0); // is your (1)
data << uint8(0); // is extended (1), ignored if prev field is 0
@@ -20626,11 +20626,11 @@ void Player::ApplyEquipCooldown( Item * pItem )
_Spell const& spellData = pItem->GetProto()->Spells[i];
// no spell
- if( !spellData.SpellId )
+ if ( !spellData.SpellId )
continue;
// wrong triggering type (note: ITEM_SPELLTRIGGER_ON_NO_DELAY_USE not have cooldown)
- if( spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE )
+ if ( spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE )
continue;
AddSpellCooldown(spellData.SpellId, pItem->GetEntry(), time(NULL) + 30);
@@ -20645,7 +20645,7 @@ void Player::ApplyEquipCooldown( Item * pItem )
void Player::resetSpells(bool myClassOnly)
{
// not need after this call
- if(HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
+ if (HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
RemoveAtLoginFlag(AT_LOGIN_RESET_SPELLS,true);
// make full copy of map (spells removed and marked as deleted at another spell remove
@@ -20654,41 +20654,41 @@ void Player::resetSpells(bool myClassOnly)
uint32 family;
- if(myClassOnly)
+ if (myClassOnly)
{
ChrClassesEntry const* clsEntry = sChrClassesStore.LookupEntry(getClass());
- if(!clsEntry)
+ if (!clsEntry)
return;
family = clsEntry->spellfamily;
}
for (PlayerSpellMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter)
{
- if(myClassOnly)
+ if (myClassOnly)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(iter->first);
- if(!spellInfo)
+ if (!spellInfo)
continue;
// skip server-side/triggered spells
- if(spellInfo->spellLevel == 0)
+ if (spellInfo->spellLevel == 0)
continue;
// skip wrong class/race skills
- if(!IsSpellFitByClassAndRace(spellInfo->Id))
+ if (!IsSpellFitByClassAndRace(spellInfo->Id))
continue;
// skip other spell families
- if(spellInfo->SpellFamilyName != family)
+ if (spellInfo->SpellFamilyName != family)
continue;
// skip spells with first rank learned as talent (and all talents then also)
uint32 first_rank = spellmgr.GetFirstSpellInChain(spellInfo->Id);
- if(GetTalentSpellCost(first_rank) > 0)
+ if (GetTalentSpellCost(first_rank) > 0)
continue;
// skip broken spells
- if(!SpellMgr::IsSpellValid(spellInfo,this,false))
+ if (!SpellMgr::IsSpellValid(spellInfo,this,false))
continue;
}
removeSpell(iter->first,false,false); // only iter->first can be accessed, object by iter->second can be deleted already
@@ -20706,7 +20706,7 @@ void Player::learnDefaultSpells()
{
uint32 tspell = *itr;
sLog.outDebug("PLAYER (Class: %u Race: %u): Adding initial spell, id = %u",uint32(getClass()),uint32(getRace()), tspell);
- if(!IsInWorld()) // will send in INITIAL_SPELLS in list anyway at map add
+ if (!IsInWorld()) // will send in INITIAL_SPELLS in list anyway at map add
addSpell(tspell,true,true,true,false);
else // but send in normal spell in game learn case
learnSpell(tspell,true);
@@ -20719,7 +20719,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
uint32 src_spell_id = quest->GetSrcSpell();
// skip quests without rewarded spell
- if( !spell_id )
+ if ( !spell_id )
return;
// if RewSpellCast = -1 we remove aura do to SrcSpell from player.
@@ -20730,14 +20730,14 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
}
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
- if(!spellInfo)
+ if (!spellInfo)
return;
// check learned spells state
bool found = false;
for (uint8 i = 0; i < 3; ++i)
{
- if(spellInfo->Effect[i] == SPELL_EFFECT_LEARN_SPELL && !HasSpell(spellInfo->EffectTriggerSpell[i]))
+ if (spellInfo->Effect[i] == SPELL_EFFECT_LEARN_SPELL && !HasSpell(spellInfo->EffectTriggerSpell[i]))
{
found = true;
break;
@@ -20745,20 +20745,20 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
}
// skip quests with not teaching spell or already known spell
- if(!found)
+ if (!found)
return;
// prevent learn non first rank unknown profession and second specialization for same profession)
uint32 learned_0 = spellInfo->EffectTriggerSpell[0];
- if( spellmgr.GetSpellRank(learned_0) > 1 && !HasSpell(learned_0) )
+ if ( spellmgr.GetSpellRank(learned_0) > 1 && !HasSpell(learned_0) )
{
// not have first rank learned (unlearned prof?)
uint32 first_spell = spellmgr.GetFirstSpellInChain(learned_0);
- if( !HasSpell(first_spell) )
+ if ( !HasSpell(first_spell) )
return;
SpellEntry const *learnedInfo = sSpellStore.LookupEntry(learned_0);
- if(!learnedInfo)
+ if (!learnedInfo)
return;
SpellsRequiringSpellMapBounds spellsRequired = spellmgr.GetSpellsRequiredForSpellBounds(learned_0);
@@ -20767,20 +20767,20 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
uint32 profSpell = itr2->second;
// specialization
- if(learnedInfo->Effect[0]==SPELL_EFFECT_TRADE_SKILL && learnedInfo->Effect[1]==0 && profSpell)
+ if (learnedInfo->Effect[0]==SPELL_EFFECT_TRADE_SKILL && learnedInfo->Effect[1]==0 && profSpell)
{
// search other specialization for same prof
for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
{
- if(itr->second->state == PLAYERSPELL_REMOVED || itr->first==learned_0)
+ if (itr->second->state == PLAYERSPELL_REMOVED || itr->first==learned_0)
continue;
SpellEntry const *itrInfo = sSpellStore.LookupEntry(itr->first);
- if(!itrInfo)
+ if (!itrInfo)
return;
// compare only specializations
- if(itrInfo->Effect[0]!=SPELL_EFFECT_TRADE_SKILL || itrInfo->Effect[1]!=0)
+ if (itrInfo->Effect[0]!=SPELL_EFFECT_TRADE_SKILL || itrInfo->Effect[1]!=0)
continue;
// compare same chain spells
@@ -20800,11 +20800,11 @@ void Player::learnQuestRewardedSpells()
for (QuestStatusMap::const_iterator itr = mQuestStatus.begin(); itr != mQuestStatus.end(); ++itr)
{
// skip no rewarded quests
- if(!itr->second.m_rewarded)
+ if (!itr->second.m_rewarded)
continue;
Quest const* quest = objmgr.GetQuestTemplate(itr->first);
- if( !quest )
+ if ( !quest )
continue;
learnQuestRewardedSpells(quest);
@@ -20843,7 +20843,7 @@ void Player::learnSkillRewardedSpells(uint32 skill_id, uint32 skill_value )
void Player::SendAurasForTarget(Unit *target)
{
- if(!target || target->GetVisibleAuras()->empty()) // speedup things
+ if (!target || target->GetVisibleAuras()->empty()) // speedup things
return;
WorldPacket data(SMSG_AURA_UPDATE_ALL);
@@ -20867,10 +20867,10 @@ void Player::SendAurasForTarget(Unit *target)
// charges
data << uint8(aura->GetStackAmount() > 1 ? aura->GetStackAmount() : (aura->GetCharges()) ? aura->GetCharges() : 1);
- if(!(flags & AFLAG_CASTER))
+ if (!(flags & AFLAG_CASTER))
data.appendPackGUID(aura->GetCasterGUID());
- if(flags & AFLAG_DURATION) // include aura duration
+ if (flags & AFLAG_DURATION) // include aura duration
{
data << uint32(aura->GetMaxDuration());
data << uint32(aura->GetDuration());
@@ -20884,7 +20884,7 @@ void Player::SetDailyQuestStatus( uint32 quest_id )
{
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
{
- if(!GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx))
+ if (!GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx))
{
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx,quest_id);
m_lastDailyQuestTime = time(NULL); // last daily quest time
@@ -20906,7 +20906,7 @@ void Player::ResetDailyQuestStatus()
BattleGround* Player::GetBattleGround() const
{
- if(GetBattleGroundId()==0)
+ if (GetBattleGroundId()==0)
return NULL;
return sBattleGroundMgr.GetBattleGround(GetBattleGroundId(), m_bgData.bgTypeID);
@@ -20915,7 +20915,7 @@ BattleGround* Player::GetBattleGround() const
bool Player::InArena() const
{
BattleGround *bg = GetBattleGround();
- if(!bg || !bg->isArena())
+ if (!bg || !bg->isArena())
return false;
return true;
@@ -20925,7 +20925,7 @@ bool Player::GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const
{
// get a template bg instead of running one
BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
- if(!bg)
+ if (!bg)
return false;
// limit check leel to dbc compatible level range
@@ -20933,7 +20933,7 @@ bool Player::GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const
if (level > DEFAULT_MAX_LEVEL)
level = DEFAULT_MAX_LEVEL;
- if(level < bg->GetMinLevel() || level > bg->GetMaxLevel())
+ if (level < bg->GetMinLevel() || level > bg->GetMaxLevel())
return false;
return true;
@@ -21034,12 +21034,12 @@ void Player::UpdateForQuestWorldObjects()
continue;
// check if this unit requires quest specific flags
- if(!obj->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_SPELLCLICK))
+ if (!obj->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_SPELLCLICK))
continue;
SpellClickInfoMapBounds clickPair = objmgr.GetSpellClickInfoMapBounds(obj->GetEntry());
for (SpellClickInfoMap::const_iterator _itr = clickPair.first; _itr != clickPair.second; ++_itr)
- if(_itr->second.questStart || _itr->second.questEnd)
+ if (_itr->second.questStart || _itr->second.questEnd)
{
obj->BuildCreateUpdateBlockForPlayer(&udata,this);
break;
@@ -21085,7 +21085,7 @@ void Player::RemoveItemDurations(Item *item)
{
for (ItemDurationList::iterator itr = m_itemDuration.begin(); itr != m_itemDuration.end(); ++itr)
{
- if(*itr == item)
+ if (*itr == item)
{
m_itemDuration.erase(itr);
break;
@@ -21149,8 +21149,8 @@ bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item cons
case ITEM_CLASS_WEAPON:
{
for (uint8 i= EQUIPMENT_SLOT_MAINHAND; i < EQUIPMENT_SLOT_TABARD; ++i)
- if(Item *item = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, i ))
- if(item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
+ if (Item *item = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, i ))
+ if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
return true;
break;
}
@@ -21158,18 +21158,18 @@ bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item cons
{
// tabard not have dependent spells
for (uint8 i= EQUIPMENT_SLOT_START; i< EQUIPMENT_SLOT_MAINHAND; ++i)
- if(Item *item = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, i ))
- if(item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
+ if (Item *item = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, i ))
+ if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
return true;
// shields can be equipped to offhand slot
- if(Item *item = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
- if(item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
+ if (Item *item = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
+ if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
return true;
// ranged slot can have some armor subclasses
- if(Item *item = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
- if(item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
+ if (Item *item = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
+ if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
return true;
break;
@@ -21208,14 +21208,14 @@ void Player::RemoveItemDependentAurasAndCasts( Item * pItem )
// skip passive (passive item dependent spells work in another way) and not self applied auras
SpellEntry const* spellInfo = aura->GetSpellProto();
- if(aura->IsPassive() || aura->GetCasterGUID() != GetGUID())
+ if (aura->IsPassive() || aura->GetCasterGUID() != GetGUID())
{
++itr;
continue;
}
// skip if not item dependent or have alternative item
- if(HasItemFitToSpellReqirements(spellInfo,pItem))
+ if (HasItemFitToSpellReqirements(spellInfo,pItem))
{
++itr;
continue;
@@ -21281,10 +21281,10 @@ bool Player::isHonorOrXPTarget(Unit* pVictim)
uint8 k_grey = Trinity::XP::GetGrayLevel(getLevel());
// Victim level less gray level
- if(v_level <= k_grey)
+ if (v_level <= k_grey)
return false;
- if(pVictim->GetTypeId() == TYPEID_UNIT)
+ if (pVictim->GetTypeId() == TYPEID_UNIT)
{
if (pVictim->ToCreature()->isTotem() ||
pVictim->ToCreature()->isPet() ||
@@ -21302,7 +21302,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
uint32 xp = 0;
bool honored_kill = false;
- if(Group *pGroup = GetGroup())
+ if (Group *pGroup = GetGroup())
{
uint32 count = 0;
uint32 sum_level = 0;
@@ -21311,7 +21311,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
pGroup->GetDataForXPAtKill(pVictim,count,sum_level,member_with_max_level,not_gray_member_with_max_level);
- if(member_with_max_level)
+ if (member_with_max_level)
{
// PvP kills doesn't yield experience
// also no XP gained if there is no member below gray level
@@ -21325,18 +21325,18 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupGuy = itr->getSource();
- if(!pGroupGuy)
+ if (!pGroupGuy)
continue;
- if(!pGroupGuy->IsAtGroupRewardDistance(pVictim))
+ if (!pGroupGuy->IsAtGroupRewardDistance(pVictim))
continue; // member (alive or dead) or his corpse at req. distance
// honor can be in PvP and !PvP (racial leader) cases (for alive)
- if(pGroupGuy->isAlive() && pGroupGuy->RewardHonor(pVictim,count, -1, true) && pGroupGuy==this)
+ if (pGroupGuy->isAlive() && pGroupGuy->RewardHonor(pVictim,count, -1, true) && pGroupGuy==this)
honored_kill = true;
// xp and reputation only in !PvP case
- if(!PvP)
+ if (!PvP)
{
float rate = group_rate * float(pGroupGuy->getLevel()) / sum_level;
@@ -21345,7 +21345,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
pGroupGuy->RewardReputation(pVictim,is_dungeon ? 1.0f : rate);
// XP updated only for alive group member
- if(pGroupGuy->isAlive() && not_gray_member_with_max_level &&
+ if (pGroupGuy->isAlive() && not_gray_member_with_max_level &&
pGroupGuy->getLevel() <= not_gray_member_with_max_level->getLevel())
{
uint32 itr_xp = (member_with_max_level == not_gray_member_with_max_level) ? uint32(xp*rate) : uint32((xp*rate/2)+1);
@@ -21356,15 +21356,15 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
itr_xp = uint32(itr_xp*(1.0f + (*i)->GetAmount() / 100.0f));
pGroupGuy->GiveXP(itr_xp, pVictim);
- if(Pet* pet = pGroupGuy->GetPet())
+ if (Pet* pet = pGroupGuy->GetPet())
pet->GivePetXP(itr_xp/2);
}
// quest objectives updated only for alive group member or dead but with not released body
- if(pGroupGuy->isAlive()|| !pGroupGuy->GetCorpse())
+ if (pGroupGuy->isAlive()|| !pGroupGuy->GetCorpse())
{
// normal creature (not pet/etc) can be only in !PvP case
- if(pVictim->GetTypeId() == TYPEID_UNIT)
+ if (pVictim->GetTypeId() == TYPEID_UNIT)
pGroupGuy->KilledMonster(pVictim->ToCreature()->GetCreatureInfo(), pVictim->GetGUID());
}
}
@@ -21376,11 +21376,11 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
xp = (PvP || GetVehicle()) ? 0 : Trinity::XP::Gain(this, pVictim);
// honor can be in PvP and !PvP (racial leader) cases
- if(RewardHonor(pVictim,1, -1, true))
+ if (RewardHonor(pVictim,1, -1, true))
honored_kill = true;
// xp and reputation only in !PvP case
- if(!PvP)
+ if (!PvP)
{
RewardReputation(pVictim,1);
@@ -21391,11 +21391,11 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
GiveXP(xp, pVictim);
- if(Pet* pet = GetPet())
+ if (Pet* pet = GetPet())
pet->GivePetXP(xp);
// normal creature (not pet/etc) can be only in !PvP case
- if(pVictim->GetTypeId() == TYPEID_UNIT)
+ if (pVictim->GetTypeId() == TYPEID_UNIT)
KilledMonster(pVictim->ToCreature()->GetCreatureInfo(), pVictim->GetGUID());
}
}
@@ -21409,19 +21409,19 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar
uint64 creature_guid = (pRewardSource->GetTypeId() == TYPEID_UNIT) ? pRewardSource->GetGUID() : uint64(0);
// prepare data for near group iteration
- if(Group *pGroup = GetGroup())
+ if (Group *pGroup = GetGroup())
{
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupGuy = itr->getSource();
- if(!pGroupGuy)
+ if (!pGroupGuy)
continue;
- if(!pGroupGuy->IsAtGroupRewardDistance(pRewardSource))
+ if (!pGroupGuy->IsAtGroupRewardDistance(pRewardSource))
continue; // member (alive or dead) or his corpse at req. distance
// quest objectives updated only for alive group member or dead but with not released body
- if(pGroupGuy->isAlive()|| !pGroupGuy->GetCorpse())
+ if (pGroupGuy->isAlive()|| !pGroupGuy->GetCorpse())
pGroupGuy->KilledMonsterCredit(creature_id, creature_guid);
}
}
@@ -21434,10 +21434,10 @@ bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const
if (!pRewardSource)
return false;
const WorldObject* player = GetCorpse();
- if(!player || isAlive())
+ if (!player || isAlive())
player = this;
- if(player->GetMapId() != pRewardSource->GetMapId() || player->GetInstanceId() != pRewardSource->GetInstanceId())
+ if (player->GetMapId() != pRewardSource->GetMapId() || player->GetInstanceId() != pRewardSource->GetInstanceId())
return false;
return pRewardSource->GetDistance(player) <= sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE);
@@ -21448,7 +21448,7 @@ uint32 Player::GetBaseWeaponSkillValue (WeaponAttackType attType) const
Item* item = GetWeaponForAttack(attType,true);
// unarmed only with base attack
- if(attType != BASE_ATTACK && !item)
+ if (attType != BASE_ATTACK && !item)
return 0;
// weapon skill or (unarmed for base attack and for fist weapons)
@@ -21459,12 +21459,12 @@ uint32 Player::GetBaseWeaponSkillValue (WeaponAttackType attType) const
void Player::ResurectUsingRequestData()
{
/// Teleport before resurrecting by player, otherwise the player might get attacked from creatures near his corpse
- if(IS_PLAYER_GUID(m_resurrectGUID))
+ if (IS_PLAYER_GUID(m_resurrectGUID))
TeleportTo(m_resurrectMap, m_resurrectX, m_resurrectY, m_resurrectZ, GetOrientation());
//we cannot resurrect player when we triggered far teleport
//player will be resurrected upon teleportation
- if(IsBeingTeleportedFar())
+ if (IsBeingTeleportedFar())
{
ScheduleDelayedOperation(DELAYED_RESURRECT_PLAYER);
return;
@@ -21472,12 +21472,12 @@ void Player::ResurectUsingRequestData()
ResurrectPlayer(0.0f,false);
- if(GetMaxHealth() > m_resurrectHealth)
+ if (GetMaxHealth() > m_resurrectHealth)
SetHealth( m_resurrectHealth );
else
SetHealth( GetMaxHealth() );
- if(GetMaxPower(POWER_MANA) > m_resurrectMana)
+ if (GetMaxPower(POWER_MANA) > m_resurrectMana)
SetPower(POWER_MANA, m_resurrectMana );
else
SetPower(POWER_MANA, GetMaxPower(POWER_MANA) );
@@ -21495,7 +21495,7 @@ void Player::SetClientControl(Unit* target, uint8 allowMove)
data.append(target->GetPackGUID());
data << uint8(allowMove);
GetSession()->SendPacket(&data);
- if(target == this)
+ if (target == this)
SetMover(this);
}
@@ -21504,8 +21504,8 @@ void Player::UpdateZoneDependentAuras( uint32 newZone )
// Some spells applied at enter into zone (with subzones), aura removed in UpdateAreaDependentAuras that called always at zone->area update
SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAreaMapBounds(newZone);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
- if(itr->second->autocast && itr->second->IsFitToRequirements(this,newZone,0))
- if( !HasAura(itr->second->spellId) )
+ if (itr->second->autocast && itr->second->IsFitToRequirements(this,newZone,0))
+ if ( !HasAura(itr->second->spellId) )
CastSpell(this,itr->second->spellId,true);
}
@@ -21515,7 +21515,7 @@ void Player::UpdateAreaDependentAuras( uint32 newArea )
for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
{
// use m_zoneUpdateId for speed: UpdateArea called from UpdateZone or instead UpdateZone in both cases m_zoneUpdateId up-to-date
- if(spellmgr.GetSpellAllowedInLocationError(iter->second->GetSpellProto(),GetMapId(),m_zoneUpdateId,newArea,this) != SPELL_CAST_OK)
+ if (spellmgr.GetSpellAllowedInLocationError(iter->second->GetSpellProto(),GetMapId(),m_zoneUpdateId,newArea,this) != SPELL_CAST_OK)
RemoveOwnedAura(iter);
else
++iter;
@@ -21524,11 +21524,11 @@ void Player::UpdateAreaDependentAuras( uint32 newArea )
// some auras applied at subzone enter
SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAreaMapBounds(newArea);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
- if(itr->second->autocast && itr->second->IsFitToRequirements(this,m_zoneUpdateId,newArea))
- if( !HasAura(itr->second->spellId) )
+ if (itr->second->autocast && itr->second->IsFitToRequirements(this,m_zoneUpdateId,newArea))
+ if ( !HasAura(itr->second->spellId) )
CastSpell(this,itr->second->spellId,true);
- if(newArea == 4273 && GetVehicle() && GetPositionX() > 400) // Ulduar
+ if (newArea == 4273 && GetVehicle() && GetPositionX() > 400) // Ulduar
{
switch(GetVehicleBase()->GetEntry())
{
@@ -21543,12 +21543,12 @@ void Player::UpdateAreaDependentAuras( uint32 newArea )
uint32 Player::GetCorpseReclaimDelay(bool pvp) const
{
- if(pvp)
+ if (pvp)
{
- if(!sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP))
+ if (!sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP))
return copseReclaimDelay[0];
}
- else if(!sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) )
+ else if (!sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) )
return 0;
time_t now = time(NULL);
@@ -21567,11 +21567,11 @@ void Player::UpdateCorpseReclaimDelay()
return;
time_t now = time(NULL);
- if(now < m_deathExpireTime)
+ if (now < m_deathExpireTime)
{
// full and partly periods 1..3
uint32 count = (m_deathExpireTime - now)/DEATH_EXPIRE_STEP +1;
- if(count < MAX_DEATH_COUNT)
+ if (count < MAX_DEATH_COUNT)
m_deathExpireTime = now+(count+1)*DEATH_EXPIRE_STEP;
else
m_deathExpireTime = now+MAX_DEATH_COUNT*DEATH_EXPIRE_STEP;
@@ -21583,27 +21583,27 @@ void Player::UpdateCorpseReclaimDelay()
void Player::SendCorpseReclaimDelay(bool load)
{
Corpse* corpse = GetCorpse();
- if(load && !corpse)
+ if (load && !corpse)
return;
bool pvp;
- if(corpse)
+ if (corpse)
pvp = (corpse->GetType() == CORPSE_RESURRECTABLE_PVP);
else
pvp = (m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH);
uint32 delay;
- if(load)
+ if (load)
{
- if(corpse->GetGhostTime() > m_deathExpireTime)
+ if (corpse->GetGhostTime() > m_deathExpireTime)
return;
uint32 count;
- if( pvp && sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) ||
+ if ( pvp && sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) ||
!pvp && sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) )
{
count = (m_deathExpireTime-corpse->GetGhostTime())/DEATH_EXPIRE_STEP;
- if(count>=MAX_DEATH_COUNT)
+ if (count>=MAX_DEATH_COUNT)
count = MAX_DEATH_COUNT-1;
}
else
@@ -21612,7 +21612,7 @@ void Player::SendCorpseReclaimDelay(bool load)
time_t expected_time = corpse->GetGhostTime()+copseReclaimDelay[count];
time_t now = time(NULL);
- if(now >= expected_time)
+ if (now >= expected_time)
return;
delay = expected_time-now;
@@ -21620,7 +21620,7 @@ void Player::SendCorpseReclaimDelay(bool load)
else
delay = GetCorpseReclaimDelay(pvp);
- if(!delay) return;
+ if (!delay) return;
//! corpse reclaim delay 30 * 1000ms or longer at often deaths
WorldPacket data(SMSG_CORPSE_RECLAIM_DELAY, 4);
@@ -21631,7 +21631,7 @@ void Player::SendCorpseReclaimDelay(bool load)
Player* Player::GetNextRandomRaidMember(float radius)
{
Group *pGroup = GetGroup();
- if(!pGroup)
+ if (!pGroup)
return NULL;
std::vector<Player*> nearMembers;
@@ -21642,7 +21642,7 @@ Player* Player::GetNextRandomRaidMember(float radius)
Player* Target = itr->getSource();
// IsHostileTo check duel and controlled by enemy
- if( Target && Target != this && IsWithinDistInMap(Target, radius) &&
+ if ( Target && Target != this && IsWithinDistInMap(Target, radius) &&
!Target->HasInvisibilityAura() && !IsHostileTo(Target) )
nearMembers.push_back(Target);
}
@@ -21657,13 +21657,13 @@ Player* Player::GetNextRandomRaidMember(float radius)
PartyResult Player::CanUninviteFromGroup() const
{
const Group* grp = GetGroup();
- if(!grp)
+ if (!grp)
return PARTY_RESULT_YOU_NOT_IN_GROUP;
- if(!grp->IsLeader(GetGUID()) && !grp->IsAssistant(GetGUID()))
+ if (!grp->IsLeader(GetGUID()) && !grp->IsAssistant(GetGUID()))
return PARTY_RESULT_YOU_NOT_LEADER;
- if(InBattleGround())
+ if (InBattleGround())
return PARTY_RESULT_INVITE_RESTRICTED;
return PARTY_RESULT_OK;
@@ -21683,7 +21683,7 @@ void Player::RemoveFromBattleGroundRaid()
{
//remove existing reference
m_group.unlink();
- if( Group* group = GetOriginalGroup() )
+ if ( Group* group = GetOriginalGroup() )
{
m_group.link(group, this);
m_group.setSubGroup(GetOriginalSubGroup());
@@ -21693,7 +21693,7 @@ void Player::RemoveFromBattleGroundRaid()
void Player::SetOriginalGroup(Group *group, int8 subgroup)
{
- if( group == NULL )
+ if ( group == NULL )
m_originalGroup.unlink();
else
{
@@ -21752,7 +21752,7 @@ void Player::UpdateUnderwaterState( Map* m, float x, float y, float z )
void Player::SetCanParry( bool value )
{
- if(m_canParry==value)
+ if (m_canParry==value)
return;
m_canParry = value;
@@ -21761,7 +21761,7 @@ void Player::SetCanParry( bool value )
void Player::SetCanBlock( bool value )
{
- if(m_canBlock==value)
+ if (m_canBlock==value)
return;
m_canBlock = value;
@@ -21771,7 +21771,7 @@ void Player::SetCanBlock( bool value )
bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const
{
for (ItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end(); ++itr)
- if(itr->pos == pos)
+ if (itr->pos == pos)
return true;
return false;
}
@@ -21782,9 +21782,9 @@ bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const
void Player::StopCastingBindSight()
{
- if(WorldObject* target = GetViewpoint())
+ if (WorldObject* target = GetViewpoint())
{
- if(target->isType(TYPEMASK_UNIT))
+ if (target->isType(TYPEMASK_UNIT))
{
((Unit*)target)->RemoveAura(SPELL_AURA_BIND_SIGHT, GetGUID());
((Unit*)target)->RemoveAura(SPELL_AURA_MOD_POSSESS, GetGUID());
@@ -21795,11 +21795,11 @@ void Player::StopCastingBindSight()
void Player::SetViewpoint(WorldObject* target, bool apply)
{
- if(apply)
+ if (apply)
{
sLog.outDebug("Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName(), target->GetEntry(), target->GetTypeId());
- if(!AddUInt64Value(PLAYER_FARSIGHT, target->GetGUID()))
+ if (!AddUInt64Value(PLAYER_FARSIGHT, target->GetGUID()))
{
sLog.outCrash("Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName());
return;
@@ -21808,20 +21808,20 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
// farsight dynobj or puppet may be very far away
UpdateVisibilityOf(target);
- if(target->isType(TYPEMASK_UNIT) && !GetVehicle())
+ if (target->isType(TYPEMASK_UNIT) && !GetVehicle())
((Unit*)target)->AddPlayerToVision(this);
}
else
{
sLog.outDebug("Player::CreateViewpoint: Player %s remove seer", GetName());
- if(!RemoveUInt64Value(PLAYER_FARSIGHT, target->GetGUID()))
+ if (!RemoveUInt64Value(PLAYER_FARSIGHT, target->GetGUID()))
{
sLog.outCrash("Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName());
return;
}
- if(target->isType(TYPEMASK_UNIT) && !GetVehicle())
+ if (target->isType(TYPEMASK_UNIT) && !GetVehicle())
((Unit*)target)->RemovePlayerFromVision(this);
//must immediately set seer back otherwise may crash
@@ -21834,7 +21834,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
WorldObject* Player::GetViewpoint() const
{
- if(uint64 guid = GetUInt64Value(PLAYER_FARSIGHT))
+ if (uint64 guid = GetUInt64Value(PLAYER_FARSIGHT))
return (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*this, guid, TYPEMASK_SEER);
return NULL;
}
@@ -21869,7 +21869,7 @@ uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 n
{
uint8 level = getLevel();
- if(level > GT_MAX_LEVEL)
+ if (level > GT_MAX_LEVEL)
level = GT_MAX_LEVEL; // max level in this dbc
uint8 hairstyle = GetByteValue(PLAYER_BYTES, 2);
@@ -21877,26 +21877,26 @@ uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 n
uint8 facialhair = GetByteValue(PLAYER_BYTES_2, 0);
uint8 skincolor = GetByteValue(PLAYER_BYTES, 0);
- if((hairstyle == newhairstyle) && (haircolor == newhaircolor) && (facialhair == newfacialhair) && (!newSkin || (newSkin->hair_id == skincolor)))
+ if ((hairstyle == newhairstyle) && (haircolor == newhaircolor) && (facialhair == newfacialhair) && (!newSkin || (newSkin->hair_id == skincolor)))
return 0;
GtBarberShopCostBaseEntry const *bsc = sGtBarberShopCostBaseStore.LookupEntry(level - 1);
- if(!bsc) // shouldn't happen
+ if (!bsc) // shouldn't happen
return 0xFFFFFFFF;
float cost = 0;
- if(hairstyle != newhairstyle)
+ if (hairstyle != newhairstyle)
cost += bsc->cost; // full price
- if((haircolor != newhaircolor) && (hairstyle == newhairstyle))
+ if ((haircolor != newhaircolor) && (hairstyle == newhairstyle))
cost += bsc->cost * 0.5f; // +1/2 of price
- if(facialhair != newfacialhair)
+ if (facialhair != newfacialhair)
cost += bsc->cost * 0.75f; // +3/4 of price
- if(newSkin && skincolor != newSkin->hair_id)
+ if (newSkin && skincolor != newSkin->hair_id)
cost += bsc->cost * 0.75f; // +5/6 of price
return uint32(cost);
@@ -21905,23 +21905,23 @@ uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 n
void Player::InitGlyphsForLevel()
{
for (uint32 i = 0; i < sGlyphSlotStore.GetNumRows(); ++i)
- if(GlyphSlotEntry const * gs = sGlyphSlotStore.LookupEntry(i))
- if(gs->Order)
+ if (GlyphSlotEntry const * gs = sGlyphSlotStore.LookupEntry(i))
+ if (gs->Order)
SetGlyphSlot(gs->Order - 1, gs->Id);
uint8 level = getLevel();
uint32 value = 0;
// 0x3F = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 for 80 level
- if(level >= 15)
+ if (level >= 15)
value |= (0x01 | 0x02);
- if(level >= 30)
+ if (level >= 30)
value |= 0x08;
- if(level >= 50)
+ if (level >= 50)
value |= 0x04;
- if(level >= 70)
+ if (level >= 70)
value |= 0x10;
- if(level >= 80)
+ if (level >= 80)
value |= 0x20;
SetUInt32Value(PLAYER_GLYPHS_ENABLED, value);
@@ -21935,7 +21935,7 @@ bool Player::isTotalImmune()
for (AuraEffectList::const_iterator itr = immune.begin(); itr != immune.end(); ++itr)
{
immuneMask |= (*itr)->GetMiscValue();
- if( immuneMask & SPELL_SCHOOL_MASK_ALL ) // total immunity
+ if ( immuneMask & SPELL_SCHOOL_MASK_ALL ) // total immunity
return true;
}
return false;
@@ -21956,16 +21956,16 @@ void Player::SetTitle(CharTitlesEntry const* title, bool lost)
uint32 fieldIndexOffset = title->bit_index / 32;
uint32 flag = 1 << (title->bit_index % 32);
- if(lost)
+ if (lost)
{
- if(!HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag))
+ if (!HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag))
return;
RemoveFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
}
else
{
- if(HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag))
+ if (HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag))
return;
SetFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
@@ -22008,25 +22008,25 @@ void Player::UpdateCharmedAI()
Creature *charmer = GetCharmer()->ToCreature();
//kill self if charm aura has infinite duration
- if(charmer->IsInEvadeMode())
+ if (charmer->IsInEvadeMode())
{
AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_MOD_CHARM);
for (AuraEffectList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
- if((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->GetBase()->IsPermanent())
+ if ((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->GetBase()->IsPermanent())
{
charmer->DealDamage(this, GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
return;
}
}
- if(!charmer->isInCombat())
+ if (!charmer->isInCombat())
GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
Unit *target = getVictim();
- if(!target || !charmer->canAttack(target))
+ if (!target || !charmer->canAttack(target))
{
target = charmer->SelectNearestTarget();
- if(!target)
+ if (!target)
return;
GetMotionMaster()->MoveChase(target);
@@ -22042,7 +22042,7 @@ uint32 Player::GetRuneBaseCooldown(uint8 index)
AuraEffectList const& regenAura = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = regenAura.begin();i != regenAura.end(); ++i)
{
- if((*i)->GetMiscValue() == POWER_RUNE && (*i)->GetMiscValueB() == rune)
+ if ((*i)->GetMiscValue() == POWER_RUNE && (*i)->GetMiscValueB() == rune)
cooldown = cooldown*(100-(*i)->GetAmount())/100;
}
@@ -22116,7 +22116,7 @@ static RuneType runeSlotTypes[MAX_RUNES] = {
void Player::InitRunes()
{
- if(getClass() != CLASS_DEATH_KNIGHT)
+ if (getClass() != CLASS_DEATH_KNIGHT)
return;
m_runes = new Runes;
@@ -22158,11 +22158,11 @@ void Player::AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore cons
ItemPosCountVec dest;
uint8 msg = CanStoreNewItem (bag,slot,dest,lootItem->itemid,lootItem->count);
- if(msg != EQUIP_ERR_OK && slot != NULL_SLOT)
+ if (msg != EQUIP_ERR_OK && slot != NULL_SLOT)
msg = CanStoreNewItem( bag, NULL_SLOT,dest,lootItem->itemid,lootItem->count);
- if( msg != EQUIP_ERR_OK && bag != NULL_BAG)
+ if ( msg != EQUIP_ERR_OK && bag != NULL_BAG)
msg = CanStoreNewItem( NULL_BAG, NULL_SLOT,dest,lootItem->itemid,lootItem->count);
- if(msg != EQUIP_ERR_OK)
+ if (msg != EQUIP_ERR_OK)
{
SendEquipError( msg, NULL, NULL );
continue;
@@ -22177,13 +22177,13 @@ uint32 Player::CalculateTalentsPoints() const
{
uint32 base_talent = getLevel() < 10 ? 0 : getLevel()-9;
- if(getClass() != CLASS_DEATH_KNIGHT || GetMapId() != 609)
+ if (getClass() != CLASS_DEATH_KNIGHT || GetMapId() != 609)
return uint32(base_talent * sWorld.getRate(RATE_TALENT));
uint32 talentPointsForLevel = getLevel() < 56 ? 0 : getLevel() - 55;
talentPointsForLevel += m_questRewardTalentCount;
- if(talentPointsForLevel > base_talent)
+ if (talentPointsForLevel > base_talent)
talentPointsForLevel = base_talent;
return uint32(talentPointsForLevel * sWorld.getRate(RATE_TALENT));
@@ -22200,7 +22200,7 @@ void Player::learnSpellHighRank(uint32 spellid)
{
learnSpell(spellid,false);
- if(uint32 next = spellmgr.GetNextSpellInChain(spellid))
+ if (uint32 next = spellmgr.GetNextSpellInChain(spellid))
learnSpellHighRank(next);
}
@@ -22221,7 +22221,7 @@ void Player::_LoadSkills(QueryResult_AutoPtr result)
uint16 max = fields[2].GetUInt16();
SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(skill);
- if(!pSkill)
+ if (!pSkill)
{
sLog.outError("Character %u has skill %u that does not exist.", GetGUIDLow(), skill);
continue;
@@ -22239,7 +22239,7 @@ void Player::_LoadSkills(QueryResult_AutoPtr result)
default:
break;
}
- if(value == 0)
+ if (value == 0)
{
sLog.outError("Character %u has skill %u with value 0. Will be deleted.", GetGUIDLow(), skill);
CharacterDatabase.PExecute("DELETE FROM character_skills WHERE guid = '%u' AND skill = '%u' ", GetGUIDLow(), skill );
@@ -22261,7 +22261,7 @@ void Player::_LoadSkills(QueryResult_AutoPtr result)
++count;
- if(count >= PLAYER_MAX_SKILLS) // client limit
+ if (count >= PLAYER_MAX_SKILLS) // client limit
{
sLog.outError("Character %u has more than %u skills.", PLAYER_MAX_SKILLS);
break;
@@ -22448,7 +22448,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
{
uint32 CurTalentPoints = GetFreeTalentPoints();
- if(CurTalentPoints == 0)
+ if (CurTalentPoints == 0)
return;
if (talentRank >= MAX_TALENT_RANK)
@@ -22456,23 +22456,23 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentId );
- if(!talentInfo)
+ if (!talentInfo)
return;
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentInfo->TalentTab );
- if(!talentTabInfo)
+ if (!talentTabInfo)
return;
// prevent learn talent for different class (cheating)
- if( (getClassMask() & talentTabInfo->ClassMask) == 0 )
+ if ( (getClassMask() & talentTabInfo->ClassMask) == 0 )
return;
// find current max talent rank (0~5)
uint8 curtalent_maxrank = 0; // 0 = not learned any rank
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
{
- if(talentInfo->RankID[rank] && HasSpell(talentInfo->RankID[rank]))
+ if (talentInfo->RankID[rank] && HasSpell(talentInfo->RankID[rank]))
{
curtalent_maxrank = (rank + 1);
break;
@@ -22480,17 +22480,17 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
}
// we already have same or higher talent rank learned
- if(curtalent_maxrank >= (talentRank + 1))
+ if (curtalent_maxrank >= (talentRank + 1))
return;
// check if we have enough talent points
- if(CurTalentPoints < (talentRank - curtalent_maxrank + 1))
+ if (CurTalentPoints < (talentRank - curtalent_maxrank + 1))
return;
// Check if it requires another talent
if (talentInfo->DependsOn > 0)
{
- if(TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn))
+ if (TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn))
{
bool hasEnoughRank = false;
for (uint8 rank = talentInfo->DependsOnRank; rank < MAX_TALENT_RANK; rank++)
@@ -22535,19 +22535,19 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
}
// not have required min points spent in talent tree
- if(spentPoints < (talentInfo->Row * MAX_TALENT_RANK))
+ if (spentPoints < (talentInfo->Row * MAX_TALENT_RANK))
return;
// spell not set in talent.dbc
uint32 spellid = talentInfo->RankID[talentRank];
- if( spellid == 0 )
+ if ( spellid == 0 )
{
sLog.outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank);
return;
}
// already known
- if(HasSpell(spellid))
+ if (HasSpell(spellid))
return;
// learn! (other talent ranks will unlearned at learning)
@@ -22564,15 +22564,15 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
{
Pet *pet = GetPet();
- if(!pet)
+ if (!pet)
return;
- if(petGuid != pet->GetGUID())
+ if (petGuid != pet->GetGUID())
return;
uint32 CurTalentPoints = pet->GetFreeTalentPoints();
- if(CurTalentPoints == 0)
+ if (CurTalentPoints == 0)
return;
if (talentRank >= MAX_PET_TALENT_RANK)
@@ -22580,36 +22580,36 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentId);
- if(!talentInfo)
+ if (!talentInfo)
return;
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
- if(!talentTabInfo)
+ if (!talentTabInfo)
return;
CreatureInfo const *ci = pet->GetCreatureInfo();
- if(!ci)
+ if (!ci)
return;
CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(ci->family);
- if(!pet_family)
+ if (!pet_family)
return;
- if(pet_family->petTalentType < 0) // not hunter pet
+ if (pet_family->petTalentType < 0) // not hunter pet
return;
// prevent learn talent for different family (cheating)
- if(!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask))
+ if (!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask))
return;
// find current max talent rank (0~5)
uint8 curtalent_maxrank = 0; // 0 = not learned any rank
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
{
- if(talentInfo->RankID[rank] && pet->HasSpell(talentInfo->RankID[rank]))
+ if (talentInfo->RankID[rank] && pet->HasSpell(talentInfo->RankID[rank]))
{
curtalent_maxrank = (rank + 1);
break;
@@ -22617,17 +22617,17 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
}
// we already have same or higher talent rank learned
- if(curtalent_maxrank >= (talentRank + 1))
+ if (curtalent_maxrank >= (talentRank + 1))
return;
// check if we have enough talent points
- if(CurTalentPoints < (talentRank - curtalent_maxrank + 1))
+ if (CurTalentPoints < (talentRank - curtalent_maxrank + 1))
return;
// Check if it requires another talent
if (talentInfo->DependsOn > 0)
{
- if(TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn))
+ if (TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn))
{
bool hasEnoughRank = false;
for (uint8 rank = talentInfo->DependsOnRank; rank < MAX_TALENT_RANK; rank++)
@@ -22672,19 +22672,19 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
}
// not have required min points spent in talent tree
- if(spentPoints < (talentInfo->Row * MAX_PET_TALENT_RANK))
+ if (spentPoints < (talentInfo->Row * MAX_PET_TALENT_RANK))
return;
// spell not set in talent.dbc
uint32 spellid = talentInfo->RankID[talentRank];
- if( spellid == 0 )
+ if ( spellid == 0 )
{
sLog.outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank);
return;
}
// already known
- if(pet->HasSpell(spellid))
+ if (pet->HasSpell(spellid))
return;
// learn! (other talent ranks will unlearned at learning)
@@ -22697,9 +22697,9 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
void Player::UpdateKnownCurrencies(uint32 itemId, bool apply)
{
- if(CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemId))
+ if (CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemId))
{
- if(apply)
+ if (apply)
SetFlag64(PLAYER_FIELD_KNOWN_CURRENCIES,(1LL << (ctEntry->BitIndex-1)));
else
RemoveFlag64(PLAYER_FIELD_KNOWN_CURRENCIES,(1LL << (ctEntry->BitIndex-1)));
@@ -22715,10 +22715,10 @@ void Player::UpdateFallInformationIfNeed( MovementInfo const& minfo,uint16 opcod
void Player::UnsummonPetTemporaryIfAny()
{
Pet* pet = GetPet();
- if(!pet)
+ if (!pet)
return;
- if(!m_temporaryUnsummonedPetNumber && pet->isControlled() && !pet->isTemporarySummoned() )
+ if (!m_temporaryUnsummonedPetNumber && pet->isControlled() && !pet->isTemporarySummoned() )
{
m_temporaryUnsummonedPetNumber = pet->GetCharmInfo()->GetPetNumber();
m_oldpetspell = pet->GetUInt32Value(UNIT_CREATED_BY_SPELL);
@@ -22729,18 +22729,18 @@ void Player::UnsummonPetTemporaryIfAny()
void Player::ResummonPetTemporaryUnSummonedIfAny()
{
- if(!m_temporaryUnsummonedPetNumber)
+ if (!m_temporaryUnsummonedPetNumber)
return;
// not resummon in not appropriate state
- if(IsPetNeedBeTemporaryUnsummoned())
+ if (IsPetNeedBeTemporaryUnsummoned())
return;
- if(GetPetGUID())
+ if (GetPetGUID())
return;
Pet* NewPet = new Pet(this);
- if(!NewPet->LoadPetFromDB(this, 0, m_temporaryUnsummonedPetNumber, true))
+ if (!NewPet->LoadPetFromDB(this, 0, m_temporaryUnsummonedPetNumber, true))
delete NewPet;
m_temporaryUnsummonedPetNumber = 0;
@@ -22748,15 +22748,15 @@ void Player::ResummonPetTemporaryUnSummonedIfAny()
bool Player::canSeeSpellClickOn(Creature const *c) const
{
- if(!c->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_SPELLCLICK))
+ if (!c->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_SPELLCLICK))
return false;
SpellClickInfoMapBounds clickPair = objmgr.GetSpellClickInfoMapBounds(c->GetEntry());
- if(clickPair.first == clickPair.second)
+ if (clickPair.first == clickPair.second)
return true;
for (SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
- if(itr->second.IsFitToRequirements(this, c))
+ if (itr->second.IsFitToRequirements(this, c))
return true;
return false;
@@ -22768,7 +22768,7 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket *data)
*data << uint8(m_specsCount); // talent group count (0, 1 or 2)
*data << uint8(m_activeSpec); // talent group index (0 or 1)
- if(m_specsCount)
+ if (m_specsCount)
{
// loop through all specs (only 1 for now)
for (uint32 specIdx = 0; specIdx < m_specsCount; ++specIdx)
@@ -22787,18 +22787,18 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket *data)
for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
{
TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
- if(!talentInfo)
+ if (!talentInfo)
continue;
// skip another tab talents
- if(talentInfo->TalentTab != talentTabId)
+ if (talentInfo->TalentTab != talentTabId)
continue;
// find max talent rank (0~4)
int8 curtalent_maxrank = -1;
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
{
- if(talentInfo->RankID[rank] && HasTalent(talentInfo->RankID[rank], specIdx))
+ if (talentInfo->RankID[rank] && HasTalent(talentInfo->RankID[rank], specIdx))
{
curtalent_maxrank = rank;
break;
@@ -22806,7 +22806,7 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket *data)
}
// not learned talent
- if(curtalent_maxrank < 0)
+ if (curtalent_maxrank < 0)
continue;
*data << uint32(talentInfo->TalentID); // Talent.dbc
@@ -22837,7 +22837,7 @@ void Player::BuildPetTalentsInfoData(WorldPacket *data)
*data << uint8(talentIdCount); // [PH], talentIdCount
Pet *pet = GetPet();
- if(!pet)
+ if (!pet)
return;
unspentTalentPoints = pet->GetFreeTalentPoints();
@@ -22845,37 +22845,37 @@ void Player::BuildPetTalentsInfoData(WorldPacket *data)
data->put<uint32>(pointsPos, unspentTalentPoints); // put real points
CreatureInfo const *ci = pet->GetCreatureInfo();
- if(!ci)
+ if (!ci)
return;
CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(ci->family);
- if(!pet_family || pet_family->petTalentType < 0)
+ if (!pet_family || pet_family->petTalentType < 0)
return;
for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId)
{
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentTabId );
- if(!talentTabInfo)
+ if (!talentTabInfo)
continue;
- if(!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask))
+ if (!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask))
continue;
for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
{
TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
- if(!talentInfo)
+ if (!talentInfo)
continue;
// skip another tab talents
- if(talentInfo->TalentTab != talentTabId)
+ if (talentInfo->TalentTab != talentTabId)
continue;
// find max talent rank (0~4)
int8 curtalent_maxrank = -1;
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
{
- if(talentInfo->RankID[rank] && pet->HasSpell(talentInfo->RankID[rank]))
+ if (talentInfo->RankID[rank] && pet->HasSpell(talentInfo->RankID[rank]))
{
curtalent_maxrank = rank;
break;
@@ -22883,7 +22883,7 @@ void Player::BuildPetTalentsInfoData(WorldPacket *data)
}
// not learned talent
- if(curtalent_maxrank < 0)
+ if (curtalent_maxrank < 0)
continue;
*data << uint32(talentInfo->TalentID); // Talent.dbc
@@ -22902,7 +22902,7 @@ void Player::SendTalentsInfoData(bool pet)
{
WorldPacket data(SMSG_TALENTS_INFO, 50);
data << uint8(pet ? 1 : 0);
- if(pet)
+ if (pet)
BuildPetTalentsInfoData(&data);
else
BuildPlayerTalentsInfoData(&data);
@@ -22919,7 +22919,7 @@ void Player::BuildEnchantmentsInfoData(WorldPacket *data)
{
Item *item = GetItemByPos(INVENTORY_SLOT_BAG_0, i);
- if(!item)
+ if (!item)
continue;
slotUsedMask |= (1 << i);
@@ -22934,7 +22934,7 @@ void Player::BuildEnchantmentsInfoData(WorldPacket *data)
{
uint32 enchId = item->GetEnchantmentId(EnchantmentSlot(j));
- if(!enchId)
+ if (!enchId)
continue;
enchantmentMask |= (1 << j);
@@ -22960,7 +22960,7 @@ void Player::SendEquipmentSetList()
data << uint32(count); // count placeholder
for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
{
- if(itr->second.state==EQUIPMENT_SET_DELETED)
+ if (itr->second.state==EQUIPMENT_SET_DELETED)
continue;
data.appendPackGUID(itr->second.Guid);
data << uint32(itr->first);
@@ -22977,20 +22977,20 @@ void Player::SendEquipmentSetList()
void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset)
{
- if(eqset.Guid != 0)
+ if (eqset.Guid != 0)
{
bool found = false;
for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
{
- if((itr->second.Guid == eqset.Guid) && (itr->first == index))
+ if ((itr->second.Guid == eqset.Guid) && (itr->first == index))
{
found = true;
break;
}
}
- if(!found) // something wrong...
+ if (!found) // something wrong...
{
sLog.outError("Player %s tried to save equipment set "UI64FMTD" (index %u), but that equipment set not found!", GetName(), eqset.Guid, index);
return;
@@ -23003,7 +23003,7 @@ void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset)
eqslot = eqset;
- if(eqset.Guid == 0)
+ if (eqset.Guid == 0)
{
eqslot.Guid = objmgr.GenerateEquipmentSetGuid();
@@ -23065,9 +23065,9 @@ void Player::DeleteEquipmentSet(uint64 setGuid)
{
for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
{
- if(itr->second.Guid == setGuid)
+ if (itr->second.Guid == setGuid)
{
- if(itr->second.state == EQUIPMENT_SET_NEW)
+ if (itr->second.state == EQUIPMENT_SET_NEW)
m_EquipmentSets.erase(itr);
else
itr->second.state = EQUIPMENT_SET_DELETED;
@@ -23080,7 +23080,7 @@ void Player::RemoveAtLoginFlag( AtLoginFlags f, bool in_db_also /*= false*/ )
{
m_atLoginFlags &= ~f;
- if(in_db_also)
+ if (in_db_also)
CharacterDatabase.PExecute("UPDATE characters set at_login = at_login & ~ %u WHERE guid ='%u'", uint32(f), GetGUIDLow());
}
diff --git a/src/game/Player.h b/src/game/Player.h
index 460de713491..e9849d5f7ee 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -308,7 +308,7 @@ struct Runes
void SetRuneState(uint8 index, bool set = true)
{
- if(set)
+ if (set)
runeState |= (1 << index); // usable
else
runeState &= ~(1 << index); // on cooldown
@@ -370,7 +370,7 @@ struct LookingForGroup
bool HaveInSlot(uint32 _entry, uint32 _type) const
{
for (uint8 i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
- if(slots[i].Is(_entry, _type))
+ if (slots[i].Is(_entry, _type))
return true;
return false;
}
@@ -378,7 +378,7 @@ struct LookingForGroup
bool canAutoJoin() const
{
for (uint8 i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
- if(slots[i].canAutoJoin())
+ if (slots[i].canAutoJoin())
return true;
return false;
}
@@ -386,7 +386,7 @@ struct LookingForGroup
bool Empty() const
{
for (uint8 i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
- if(!slots[i].Empty())
+ if (!slots[i].Empty())
return false;
return more.Empty();
}
@@ -1053,16 +1053,16 @@ class Player : public Unit, public GridObject<Player>
void ContinueTaxiFlight();
// mount_id can be used in scripting calls
bool isAcceptWhispers() const { return m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS; }
- void SetAcceptWhispers(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; }
+ 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); }
- void SetGMChat(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_GM_CHAT; else 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; }
+ void SetTaxiCheater(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_TAXICHEAT; else m_ExtraFlags &= ~PLAYER_EXTRA_TAXICHEAT; }
bool isGMVisible() const { return !(m_ExtraFlags & PLAYER_EXTRA_GM_INVISIBLE); }
void SetGMVisible(bool on);
- void SetPvPDeath(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
+ void SetPvPDeath(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
void GiveXP(uint32 xp, Unit* victim);
void GiveLevel(uint8 level);
@@ -1159,7 +1159,7 @@ class Player : public Unit, public GridObject<Player>
}
uint8 CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec& dest, Item *pItem, bool swap = false ) const
{
- if(!pItem)
+ if (!pItem)
return EQUIP_ERR_ITEM_NOT_FOUND;
uint32 count = pItem->GetCount();
return _CanStoreItem( bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL );
@@ -1448,13 +1448,13 @@ class Player : public Unit, public GridObject<Player>
void ModifyMoney( int32 d )
{
d = GetSession()->HandleOnGetMoney(d);
- if(d < 0)
+ if (d < 0)
SetMoney (GetMoney() > uint32(-d) ? GetMoney() + d : 0);
else
SetMoney (GetMoney() < uint32(MAX_MONEY_AMOUNT - d) ? GetMoney() + d : MAX_MONEY_AMOUNT);
// "At Gold Limit"
- if(GetMoney() >= MAX_MONEY_AMOUNT)
+ if (GetMoney() >= MAX_MONEY_AMOUNT)
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD,NULL,NULL);
}
void SetMoney( uint32 value )
@@ -2572,7 +2572,7 @@ class Player : public Unit, public GridObject<Player>
void ScheduleDelayedOperation(uint32 operation)
{
- if(operation < DELAYED_END)
+ if (operation < DELAYED_END)
m_DelayedOperations |= operation;
}
@@ -2638,7 +2638,7 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
if (!mod->ownerAura)
assert(mod->charges == 0);
- if(!IsAffectedBySpellmod(spellInfo,mod,spell))
+ if (!IsAffectedBySpellmod(spellInfo,mod,spell))
continue;
if (mod->type == SPELLMOD_FLAT)
@@ -2646,11 +2646,11 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
else if (mod->type == SPELLMOD_PCT)
{
// skip percent mods for null basevalue (most important for spell mods with charges )
- if(basevalue == T(0))
+ if (basevalue == T(0))
continue;
// special case (skip >10sec spell casts for instant cast setting)
- if( mod->op==SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100)
+ if ( mod->op==SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100)
continue;
totalmul *= 1.0f + (float)mod->value / 100.0f;
diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp
index ffa3babc179..472f80a77ad 100644
--- a/src/game/PlayerDump.cpp
+++ b/src/game/PlayerDump.cpp
@@ -70,7 +70,7 @@ static bool findtoknth(std::string &str, int n, std::string::size_type &s, std::
{
int i; s = e = 0;
std::string::size_type size = str.size();
- for (i = 1; s < size && i < n; s++) if(str[s] == ' ') ++i;
+ for (i = 1; s < size && i < n; s++) if (str[s] == ' ') ++i;
if (i < n)
return false;
@@ -82,7 +82,7 @@ static bool findtoknth(std::string &str, int n, std::string::size_type &s, std::
std::string gettoknth(std::string &str, int n)
{
std::string::size_type s = 0, e = 0;
- if(!findtoknth(str, n, s, e))
+ if (!findtoknth(str, n, s, e))
return "";
return str.substr(s, e-s);
@@ -124,12 +124,12 @@ std::string gettablename(std::string &str)
bool changenth(std::string &str, int n, const char *with, bool insert = false, bool nonzero = false)
{
std::string::size_type s, e;
- if(!findnth(str,n,s,e))
+ if (!findnth(str,n,s,e))
return false;
- if(nonzero && str.substr(s,e-s) == "0")
+ if (nonzero && str.substr(s,e-s) == "0")
return true; // not an error
- if(!insert)
+ if (!insert)
str.replace(s,e-s, with);
else
str.insert(s, with);
@@ -140,7 +140,7 @@ bool changenth(std::string &str, int n, const char *with, bool insert = false, b
std::string getnth(std::string &str, int n)
{
std::string::size_type s, e;
- if(!findnth(str,n,s,e))
+ if (!findnth(str,n,s,e))
return "";
return str.substr(s, e-s);
@@ -149,11 +149,11 @@ std::string getnth(std::string &str, int n)
bool changetoknth(std::string &str, int n, const char *with, bool insert = false, bool nonzero = false)
{
std::string::size_type s = 0, e = 0;
- if(!findtoknth(str, n, s, e))
+ if (!findtoknth(str, n, s, e))
return false;
- if(nonzero && str.substr(s,e-s) == "0")
+ if (nonzero && str.substr(s,e-s) == "0")
return true; // not an error
- if(!insert)
+ if (!insert)
str.replace(s, e-s, with);
else
str.insert(s, with);
@@ -164,7 +164,7 @@ bool changetoknth(std::string &str, int n, const char *with, bool insert = false
uint32 registerNewGuid(uint32 oldGuid, std::map<uint32, uint32> &guidMap, uint32 hiGuid)
{
std::map<uint32, uint32>::const_iterator itr = guidMap.find(oldGuid);
- if(itr != guidMap.end())
+ if (itr != guidMap.end())
return itr->second;
uint32 newguid = hiGuid + guidMap.size();
@@ -200,7 +200,7 @@ bool changetokGuid(std::string &str, int n, std::map<uint32, uint32> &guidMap, u
std::string CreateDumpString(char const* tableName, QueryResult_AutoPtr result)
{
- if(!tableName || !result) return "";
+ if (!tableName || !result) return "";
std::ostringstream ss;
ss << "INSERT INTO "<< _TABLE_SIM_ << tableName << _TABLE_SIM_ << " VALUES (";
Field *fields = result->Fetch();
@@ -234,14 +234,14 @@ std::string PlayerDumpWriter::GenerateWhereStr(char const* field, GUIDs const& g
{
wherestr << *itr;
- if(wherestr.str().size() > MAX_QUERY_LEN - 50) // near to max query
+ if (wherestr.str().size() > MAX_QUERY_LEN - 50) // near to max query
{
++itr;
break;
}
GUIDs::const_iterator itr2 = itr;
- if(++itr2 != guids.end())
+ if (++itr2 != guids.end())
wherestr << "','";
}
wherestr << "')";
@@ -252,7 +252,7 @@ void StoreGUID(QueryResult_AutoPtr result,uint32 field,std::set<uint32>& guids)
{
Field* fields = result->Fetch();
uint32 guid = fields[field].GetUInt32();
- if(guid)
+ if (guid)
guids.insert(guid);
}
@@ -261,7 +261,7 @@ void StoreGUID(QueryResult_AutoPtr result,uint32 data,uint32 field, std::set<uin
Field* fields = result->Fetch();
std::string dataStr = fields[data].GetCppString();
uint32 guid = atoi(gettoknth(dataStr, field).c_str());
- if(guid)
+ if (guid)
guids.insert(guid);
}
@@ -284,25 +284,25 @@ void PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl
}
// for guid set stop if set is empty
- if(guids && guids->empty())
+ if (guids && guids->empty())
return; // nothing to do
// setup for guids case start position
GUIDs::const_iterator guids_itr;
- if(guids)
+ if (guids)
guids_itr = guids->begin();
do
{
std::string wherestr;
- if(guids) // set case, get next guids string
+ if (guids) // set case, get next guids string
wherestr = GenerateWhereStr(fieldname,*guids,guids_itr);
else // not set case, get single guid string
wherestr = GenerateWhereStr(fieldname,guid);
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT * FROM %s WHERE %s", tableFrom, wherestr.c_str());
- if(!result)
+ if (!result)
return;
do
@@ -343,20 +343,20 @@ std::string PlayerDumpWriter::GetDump(uint32 guid)
// revision check guard
/*
QueryNamedResult* result = CharacterDatabase.QueryNamed("SELECT * FROM character_db_version LIMIT 1");
- if(result)
+ if (result)
{
QueryFieldNames const& namesMap = result->GetFieldNames();
std::string reqName;
for (QueryFieldNames::const_iterator itr = namesMap.begin(); itr != namesMap.end(); ++itr)
{
- if(itr->substr(0,9)=="required_")
+ if (itr->substr(0,9)=="required_")
{
reqName = *itr;
break;
}
}
- if(!reqName.empty())
+ if (!reqName.empty())
{
// this will fail at wrong character DB version
dump += "UPDATE character_db_version SET "+reqName+" = 1 WHERE FALSE;\n\n";
@@ -462,9 +462,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
CharacterDatabase.BeginTransaction();
while (!feof(fin))
{
- if(!fgets(buf, 32000, fin))
+ if (!fgets(buf, 32000, fin))
{
- if(feof(fin)) break;
+ if (feof(fin)) break;
ROLLBACK(DUMP_FILE_BROKEN);
}
@@ -472,18 +472,18 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
// skip empty strings
size_t nw_pos = line.find_first_not_of(" \t\n\r\7");
- if(nw_pos==std::string::npos)
+ if (nw_pos==std::string::npos)
continue;
// skip NOTE
- if(line.substr(nw_pos,15)=="IMPORTANT NOTE:")
+ if (line.substr(nw_pos,15)=="IMPORTANT NOTE:")
continue;
// add required_ check
/*
- if(line.substr(nw_pos,41)=="UPDATE character_db_version SET required_")
+ if (line.substr(nw_pos,41)=="UPDATE character_db_version SET required_")
{
- if(!CharacterDatabase.Execute(line.c_str()))
+ if (!CharacterDatabase.Execute(line.c_str()))
ROLLBACK(DUMP_FILE_BROKEN);
continue;
@@ -492,7 +492,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
// determine table name and load type
std::string tn = gettablename(line);
- if(tn.empty())
+ if (tn.empty())
{
sLog.outError("LoadPlayerDump: Can't extract table name from line: '%s'!", line.c_str());
ROLLBACK(DUMP_FILE_BROKEN);
@@ -519,25 +519,25 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
switch(type)
{
case DTT_CHAR_TABLE:
- if(!changenth(line, 1, newguid))
+ if (!changenth(line, 1, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
break;
case DTT_CHARACTER: // character t.
{
- if(!changenth(line, 1, newguid))
+ if (!changenth(line, 1, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
// guid, data field:guid, items
- if(!changenth(line, 2, chraccount))
+ if (!changenth(line, 2, chraccount))
ROLLBACK(DUMP_FILE_BROKEN);
std::string vals = getnth(line, 3);
- if(!changetoknth(vals, OBJECT_FIELD_GUID+1, newguid))
+ if (!changetoknth(vals, OBJECT_FIELD_GUID+1, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
for (uint16 field = PLAYER_FIELD_INV_SLOT_HEAD; field < PLAYER_FARSIGHT; field++)
- if(!changetokGuid(vals, field+1, items, objmgr.m_hiItemGuid, true))
+ if (!changetokGuid(vals, field+1, items, objmgr.m_hiItemGuid, true))
ROLLBACK(DUMP_FILE_BROKEN);
- if(!changenth(line, 3, vals.c_str()))
+ if (!changenth(line, 3, vals.c_str()))
ROLLBACK(DUMP_FILE_BROKEN);
if (name == "")
{
@@ -548,51 +548,51 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
result = CharacterDatabase.PQuery("SELECT 1 FROM characters WHERE name = '%s'", name.c_str());
if (result)
{
- if(!changenth(line, 37, "1")) // rename on login: `at_login` field 37 in raw field list
+ if (!changenth(line, 37, "1")) // rename on login: `at_login` field 37 in raw field list
ROLLBACK(DUMP_FILE_BROKEN);
}
}
- else if(!changenth(line, 4, name.c_str()))
+ else if (!changenth(line, 4, name.c_str()))
ROLLBACK(DUMP_FILE_BROKEN);
break;
}
case DTT_INVENTORY: // character_inventory t.
{
- if(!changenth(line, 1, newguid))
+ if (!changenth(line, 1, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
// bag, item
- if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid, true))
+ if (!changeGuid(line, 2, items, objmgr.m_hiItemGuid, true))
ROLLBACK(DUMP_FILE_BROKEN);
- if(!changeGuid(line, 4, items, objmgr.m_hiItemGuid))
+ if (!changeGuid(line, 4, items, objmgr.m_hiItemGuid))
ROLLBACK(DUMP_FILE_BROKEN);
break;
}
case DTT_ITEM: // item_instance t.
{
// item, owner, data field:item, owner guid
- if(!changeGuid(line, 1, items, objmgr.m_hiItemGuid))
+ if (!changeGuid(line, 1, items, objmgr.m_hiItemGuid))
ROLLBACK(DUMP_FILE_BROKEN);
- if(!changenth(line, 2, newguid))
+ if (!changenth(line, 2, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
std::string vals = getnth(line,3);
- if(!changetokGuid(vals, OBJECT_FIELD_GUID+1, items, objmgr.m_hiItemGuid))
+ if (!changetokGuid(vals, OBJECT_FIELD_GUID+1, items, objmgr.m_hiItemGuid))
ROLLBACK(DUMP_FILE_BROKEN);
- if(!changetoknth(vals, ITEM_FIELD_OWNER+1, newguid))
+ if (!changetoknth(vals, ITEM_FIELD_OWNER+1, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
- if(!changetokGuid(vals, ITEM_FIELD_ITEM_TEXT_ID+1, itemTexts, objmgr.m_ItemTextId,true))
+ if (!changetokGuid(vals, ITEM_FIELD_ITEM_TEXT_ID+1, itemTexts, objmgr.m_ItemTextId,true))
ROLLBACK(DUMP_FILE_BROKEN);
- if(!changenth(line, 3, vals.c_str()))
+ if (!changenth(line, 3, vals.c_str()))
ROLLBACK(DUMP_FILE_BROKEN);
break;
}
case DTT_ITEM_GIFT: // character_gift
{
// guid,item_guid,
- if(!changenth(line, 1, newguid))
+ if (!changenth(line, 1, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
- if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid))
+ if (!changeGuid(line, 2, items, objmgr.m_hiItemGuid))
ROLLBACK(DUMP_FILE_BROKEN);
break;
}
@@ -600,8 +600,8 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
{
//store a map of old pet id to new inserted pet id for use by type 5 tables
snprintf(currpetid, 20, "%s", getnth(line, 1).c_str());
- if(strlen(lastpetid)==0) snprintf(lastpetid, 20, "%s", currpetid);
- if(strcmp(lastpetid,currpetid)!=0)
+ if (strlen(lastpetid)==0) snprintf(lastpetid, 20, "%s", currpetid);
+ if (strcmp(lastpetid,currpetid)!=0)
{
snprintf(newpetid, 20, "%d", objmgr.GeneratePetNumber());
snprintf(lastpetid, 20, "%s", currpetid);
@@ -609,15 +609,15 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid));
- if(petids_iter == petids.end())
+ if (petids_iter == petids.end())
{
petids.insert(PetIdsPair(atoi(currpetid), atoi(newpetid)));
}
// item, entry, owner, ...
- if(!changenth(line, 1, newpetid))
+ if (!changenth(line, 1, newpetid))
ROLLBACK(DUMP_FILE_BROKEN);
- if(!changenth(line, 3, newguid))
+ if (!changenth(line, 3, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
break;
@@ -628,12 +628,12 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
// lookup currpetid and match to new inserted pet id
std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid));
- if(petids_iter == petids.end()) // couldn't find new inserted id
+ if (petids_iter == petids.end()) // couldn't find new inserted id
ROLLBACK(DUMP_FILE_BROKEN);
snprintf(newpetid, 20, "%d", petids_iter->second);
- if(!changenth(line, 1, newpetid))
+ if (!changenth(line, 1, newpetid))
ROLLBACK(DUMP_FILE_BROKEN);
break;
@@ -641,29 +641,29 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
case DTT_MAIL: // mail
{
// id,messageType,stationery,mailtemplate,sender,receiver,subject,itemText
- if(!changeGuid(line, 1, mails, objmgr.m_mailid))
+ if (!changeGuid(line, 1, mails, objmgr.m_mailid))
ROLLBACK(DUMP_FILE_BROKEN);
- if(!changenth(line, 6, newguid))
+ if (!changenth(line, 6, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
- if(!changeGuid(line, 8, itemTexts, objmgr.m_ItemTextId))
+ if (!changeGuid(line, 8, itemTexts, objmgr.m_ItemTextId))
ROLLBACK(DUMP_FILE_BROKEN);
break;
}
case DTT_MAIL_ITEM: // mail_items
{
// mail_id,item_guid,item_template,receiver
- if(!changeGuid(line, 1, mails, objmgr.m_mailid))
+ if (!changeGuid(line, 1, mails, objmgr.m_mailid))
ROLLBACK(DUMP_FILE_BROKEN);
- if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid))
+ if (!changeGuid(line, 2, items, objmgr.m_hiItemGuid))
ROLLBACK(DUMP_FILE_BROKEN);
- if(!changenth(line, 4, newguid))
+ if (!changenth(line, 4, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
break;
}
case DTT_ITEM_TEXT: // item_text
{
// id
- if(!changeGuid(line, 1, itemTexts, objmgr.m_ItemTextId))
+ if (!changeGuid(line, 1, itemTexts, objmgr.m_ItemTextId))
ROLLBACK(DUMP_FILE_BROKEN);
// add it to cache
@@ -677,7 +677,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
break;
}
- if(!CharacterDatabase.Execute(line.c_str()))
+ if (!CharacterDatabase.Execute(line.c_str()))
ROLLBACK(DUMP_FILE_BROKEN);
}
@@ -687,7 +687,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
objmgr.m_mailid += mails.size();
objmgr.m_ItemTextId += itemTexts.size();
- if(incHighest)
+ if (incHighest)
++objmgr.m_hiCharGuid;
fclose(fin);
diff --git a/src/game/PointMovementGenerator.cpp b/src/game/PointMovementGenerator.cpp
index 94125fbbffa..d343dab5ad0 100644
--- a/src/game/PointMovementGenerator.cpp
+++ b/src/game/PointMovementGenerator.cpp
@@ -38,12 +38,12 @@ void PointMovementGenerator<T>::Initialize(T &unit)
template<class T>
bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
{
- if(!&unit)
+ if (!&unit)
return false;
- if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED))
+ if (unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED))
{
- if(unit.hasUnitState(UNIT_STAT_CHARGING))
+ if (unit.hasUnitState(UNIT_STAT_CHARGING))
return false;
else
return true;
@@ -53,7 +53,7 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
i_destinationHolder.UpdateTraveller(traveller, diff);
- if(i_destinationHolder.HasArrived())
+ if (i_destinationHolder.HasArrived())
{
unit.clearUnitState(UNIT_STAT_MOVE);
arrived = true;
@@ -66,9 +66,9 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
template<class T>
void PointMovementGenerator<T>:: Finalize(T &unit)
{
- if(unit.hasUnitState(UNIT_STAT_CHARGING))
+ if (unit.hasUnitState(UNIT_STAT_CHARGING))
unit.clearUnitState(UNIT_STAT_CHARGING | UNIT_STAT_JUMPING);
- if(arrived) // without this crash!
+ if (arrived) // without this crash!
MovementInform(unit);
}
@@ -79,7 +79,7 @@ void PointMovementGenerator<T>::MovementInform(T &unit)
template <> void PointMovementGenerator<Creature>::MovementInform(Creature &unit)
{
- if(id == EVENT_FALL_GROUND)
+ if (id == EVENT_FALL_GROUND)
{
unit.setDeathState(JUST_DIED);
unit.SetFlying(true);
diff --git a/src/game/PoolHandler.cpp b/src/game/PoolHandler.cpp
index 73fe4c01b9e..0ad727bfdd0 100644
--- a/src/game/PoolHandler.cpp
+++ b/src/game/PoolHandler.cpp
@@ -232,7 +232,7 @@ void PoolGroup<Pool>::RemoveOneRelation(uint16 child_pool_id)
{
for (PoolObjectList::iterator itr = ExplicitlyChanced.begin(); itr != ExplicitlyChanced.end(); ++itr)
{
- if(itr->guid == child_pool_id)
+ if (itr->guid == child_pool_id)
{
ExplicitlyChanced.erase(itr);
break;
@@ -240,7 +240,7 @@ void PoolGroup<Pool>::RemoveOneRelation(uint16 child_pool_id)
}
for (PoolObjectList::iterator itr = EqualChanced.begin(); itr != EqualChanced.end(); ++itr)
{
- if(itr->guid == child_pool_id)
+ if (itr->guid == child_pool_id)
{
EqualChanced.erase(itr);
break;
@@ -634,7 +634,7 @@ void PoolHandler::LoadFromDB()
for (SearchMap::iterator poolItr = mPoolSearchMap.find(i); poolItr != mPoolSearchMap.end(); poolItr = mPoolSearchMap.find(poolItr->second))
{
checkedPools.insert(poolItr->first);
- if(checkedPools.find(poolItr->second) != checkedPools.end())
+ if (checkedPools.find(poolItr->second) != checkedPools.end())
{
std::ostringstream ss;
ss<< "The pool(s) ";
diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp
index f271c65dd24..aed1d5cf914 100644
--- a/src/game/QueryHandler.cpp
+++ b/src/game/QueryHandler.cpp
@@ -36,7 +36,7 @@
void WorldSession::SendNameQueryOpcode(Player *p)
{
- if(!p)
+ if (!p)
return;
// guess size
WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10) );
@@ -47,7 +47,7 @@ void WorldSession::SendNameQueryOpcode(Player *p)
data << uint8(p->getRace());
data << uint8(p->getGender());
data << uint8(p->getClass());
- if(DeclinedName const* names = p->GetDeclinedNames())
+ if (DeclinedName const* names = p->GetDeclinedNames())
{
data << uint8(1); // is declined
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
@@ -79,18 +79,18 @@ void WorldSession::SendNameQueryOpcodeFromDB(uint64 guid)
void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult_AutoPtr result, uint32 accountId)
{
- if(!result)
+ if (!result)
return;
WorldSession * session = sWorld.FindSession(accountId);
- if(!session)
+ if (!session)
return;
Field *fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
std::string name = fields[1].GetCppString();
uint8 pRace = 0, pGender = 0, pClass = 0;
- if(name == "")
+ if (name == "")
name = session->GetTrinityString(LANG_NON_EXIST_CHARACTER);
else
{
@@ -109,7 +109,7 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult_AutoPtr result,
data << uint8(pClass); // class
// if the first declined name field (5) is empty, the rest must be too
- if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) && fields[5].GetCppString() != "")
+ if (sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) && fields[5].GetCppString() != "")
{
data << uint8(1); // is declined
for (int i = 5; i < MAX_DECLINED_NAME_CASES+5; ++i)
@@ -223,7 +223,7 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data )
recv_data >> guid;
const GameObjectInfo *info = objmgr.GetGameObjectInfo(entryID);
- if(info)
+ if (info)
{
std::string Name;
std::string IconName;
@@ -279,7 +279,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/)
Corpse *corpse = GetPlayer()->GetCorpse();
- if(!corpse)
+ if (!corpse)
{
WorldPacket data(MSG_CORPSE_QUERY, 1);
data << uint8(0); // corpse not found
@@ -294,15 +294,15 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/)
int32 corpsemapid = mapid;
// if corpse at different map
- if(mapid != _player->GetMapId())
+ if (mapid != _player->GetMapId())
{
// search entrance map for proper show entrance
- if(MapEntry const* corpseMapEntry = sMapStore.LookupEntry(mapid))
+ if (MapEntry const* corpseMapEntry = sMapStore.LookupEntry(mapid))
{
- if(corpseMapEntry->IsDungeon() && corpseMapEntry->entrance_map >= 0)
+ if (corpseMapEntry->IsDungeon() && corpseMapEntry->entrance_map >= 0)
{
// if corpse map have entrance
- if(Map const* entranceMap = MapManager::Instance().CreateBaseMap(corpseMapEntry->entrance_map))
+ if (Map const* entranceMap = MapManager::Instance().CreateBaseMap(corpseMapEntry->entrance_map))
{
mapid = corpseMapEntry->entrance_map;
x = corpseMapEntry->entrance_x;
@@ -477,7 +477,7 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recv_data)
uint32 count;
recv_data >> count; // quest count, max=25
- if(count >= MAX_QUEST_LOG_SIZE)
+ if (count >= MAX_QUEST_LOG_SIZE)
return;
WorldPacket data(SMSG_QUEST_POI_QUERY_RESPONSE, 4+(4+4)*count);
@@ -492,14 +492,14 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recv_data)
uint16 questSlot = _player->FindQuestSlot(questId);
- if(questSlot != MAX_QUEST_LOG_SIZE)
+ if (questSlot != MAX_QUEST_LOG_SIZE)
questOk =_player->GetQuestSlotQuestId(questSlot) == questId;
- if(questOk)
+ if (questOk)
{
QuestPOIVector const *POI = objmgr.GetQuestPOIVector(questId);
- if(POI)
+ if (POI)
{
data << uint32(questId); // quest ID
data << uint32(POI->size()); // POI count
diff --git a/src/game/QuestDef.cpp b/src/game/QuestDef.cpp
index 97ff3024bb5..23222831fc4 100644
--- a/src/game/QuestDef.cpp
+++ b/src/game/QuestDef.cpp
@@ -176,13 +176,13 @@ Quest::Quest(Field * questRecord)
uint32 Quest::XPValue( Player *pPlayer ) const
{
- if( pPlayer )
+ if ( pPlayer )
{
const QuestXPEntry *xpentry;
int32 quest_level = (QuestLevel == -1 ? pPlayer->getLevel() : QuestLevel);
xpentry = sQuestXPStore.LookupEntry(quest_level);
- if(!xpentry)
+ if (!xpentry)
return 0;
int diffFactor = 2 * (quest_level - pPlayer->getLevel()) + 20;
@@ -211,7 +211,7 @@ uint32 Quest::XPValue( Player *pPlayer ) const
int32 Quest::GetRewOrReqMoney() const
{
- if(RewOrReqMoney <= 0)
+ if (RewOrReqMoney <= 0)
return RewOrReqMoney;
return int32(RewOrReqMoney * sWorld.getRate(RATE_DROP_MONEY));
diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp
index 8bc46939b29..8a1a5918603 100644
--- a/src/game/QuestHandler.cpp
+++ b/src/game/QuestHandler.cpp
@@ -42,7 +42,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data )
uint8 defstatus = DIALOG_STATUS_NONE;
Object* questgiver = ObjectAccessor::GetObjectByTypeMask(*_player, guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
- if(!questgiver)
+ if (!questgiver)
{
sLog.outDetail("Error in CMSG_QUESTGIVER_STATUS_QUERY, called for not found questgiver (Typeid: %u GUID: %u)",GuidHigh2TypeId(GUID_HIPART(guid)),GUID_LOPART(guid));
return;
@@ -54,10 +54,10 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data )
{
sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u",uint32(GUID_LOPART(guid)) );
Creature* cr_questgiver=questgiver->ToCreature();
- if( !cr_questgiver->IsHostileTo(_player)) // not show quest status to enemies
+ if ( !cr_questgiver->IsHostileTo(_player)) // not show quest status to enemies
{
questStatus = sScriptMgr.NPCDialogStatus(_player, cr_questgiver);
- if( questStatus > 6 )
+ if ( questStatus > 6 )
questStatus = getDialogStatus(_player, cr_questgiver, defstatus);
}
break;
@@ -67,7 +67,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data )
sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u",uint32(GUID_LOPART(guid)) );
GameObject* go_questgiver=(GameObject*)questgiver;
questStatus = sScriptMgr.GODialogStatus(_player, go_questgiver);
- if( questStatus > 6 )
+ if ( questStatus > 6 )
questStatus = getDialogStatus(_player, go_questgiver, defstatus);
break;
}
@@ -96,12 +96,12 @@ void WorldSession::HandleQuestgiverHelloOpcode( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// Stop the npc if moving
pCreature->StopMoving();
- if(sScriptMgr.GossipHello( _player, pCreature ) )
+ if (sScriptMgr.GossipHello( _player, pCreature ) )
return;
_player->PrepareGossipMenu(pCreature, pCreature->GetCreatureInfo()->GossipMenuId);
@@ -115,7 +115,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
uint32 unk1;
recv_data >> guid >> quest >> unk1;
- if(!GetPlayer()->isAlive())
+ if (!GetPlayer()->isAlive())
return;
sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), quest, unk1 );
@@ -123,7 +123,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER);
// no or incorrect quest giver
- if(!pObject
+ if (!pObject
|| (pObject->GetTypeId() != TYPEID_PLAYER && !pObject->hasQuest(quest))
|| (pObject->GetTypeId() == TYPEID_PLAYER && !pObject->ToPlayer()->CanShareQuest(quest))
)
@@ -137,24 +137,24 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
if ( qInfo )
{
// prevent cheating
- if(!GetPlayer()->CanTakeQuest(qInfo,true) )
+ if (!GetPlayer()->CanTakeQuest(qInfo,true) )
{
_player->PlayerTalkClass->CloseGossip();
_player->SetDivider( 0 );
return;
}
- if( _player->GetDivider() != 0 )
+ if ( _player->GetDivider() != 0 )
{
Player *pPlayer = ObjectAccessor::FindPlayer( _player->GetDivider() );
- if( pPlayer )
+ if ( pPlayer )
{
pPlayer->SendPushToPartyResponse( _player, QUEST_PARTY_MSG_ACCEPT_QUEST );
_player->SetDivider( 0 );
}
}
- if( _player->CanAddQuest( qInfo, true ) )
+ if ( _player->CanAddQuest( qInfo, true ) )
{
_player->AddQuest( qInfo, pObject );
@@ -206,7 +206,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
}
}
- if(destroyItem)
+ if (destroyItem)
_player->DestroyItem(((Item*)pObject)->GetBagSlot(),((Item*)pObject)->GetSlot(),true);
break;
@@ -217,7 +217,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
}
_player->PlayerTalkClass->CloseGossip();
- if( qInfo->GetSrcSpell() > 0 )
+ if ( qInfo->GetSrcSpell() > 0 )
_player->CastSpell( _player, qInfo->GetSrcSpell(), true);
return;
@@ -237,7 +237,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode( WorldPacket & recv_data )
// Verify that the guid is valid and is a questgiver or involved in the requested quest
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM);
- if(!pObject||!pObject->hasQuest(quest) && !pObject->hasInvolvedQuest(quest))
+ if (!pObject||!pObject->hasQuest(quest) && !pObject->hasInvolvedQuest(quest))
{
_player->PlayerTalkClass->CloseGossip();
return;
@@ -269,46 +269,46 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode( WorldPacket & recv_data )
uint64 guid;
recv_data >> guid >> quest >> reward;
- if(reward >= QUEST_REWARD_CHOICES_COUNT)
+ if (reward >= QUEST_REWARD_CHOICES_COUNT)
{
sLog.outError("Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (probably packet hacking)", _player->GetName(), _player->GetGUIDLow(), reward);
return;
}
- if(!GetPlayer()->isAlive())
+ if (!GetPlayer()->isAlive())
return;
sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u",uint32(GUID_LOPART(guid)),quest,reward );
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
- if(!pObject)
+ if (!pObject)
return;
- if(!pObject->hasInvolvedQuest(quest))
+ if (!pObject->hasInvolvedQuest(quest))
return;
Quest const *pQuest = objmgr.GetQuestTemplate(quest);
- if( pQuest )
+ if ( pQuest )
{
- if( _player->CanRewardQuest( pQuest, reward, true ) )
+ if ( _player->CanRewardQuest( pQuest, reward, true ) )
{
_player->RewardQuest( pQuest, reward, pObject );
switch(pObject->GetTypeId())
{
case TYPEID_UNIT:
- if( !(sScriptMgr.ChooseReward( _player, (pObject->ToCreature()), pQuest, reward )) )
+ if ( !(sScriptMgr.ChooseReward( _player, (pObject->ToCreature()), pQuest, reward )) )
{
// Send next quest
- if(Quest const* nextquest = _player->GetNextQuest( guid ,pQuest ) )
+ if (Quest const* nextquest = _player->GetNextQuest( guid ,pQuest ) )
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextquest,guid,true);
}
break;
case TYPEID_GAMEOBJECT:
- if( !sScriptMgr.GOChooseReward( _player, ((GameObject*)pObject), pQuest, reward ) )
+ if ( !sScriptMgr.GOChooseReward( _player, ((GameObject*)pObject), pQuest, reward ) )
{
// Send next quest
- if(Quest const* nextquest = _player->GetNextQuest( guid ,pQuest ) )
+ if (Quest const* nextquest = _player->GetNextQuest( guid ,pQuest ) )
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextquest,guid,true);
}
break;
@@ -325,22 +325,22 @@ void WorldSession::HandleQuestgiverRequestRewardOpcode( WorldPacket & recv_data
uint64 guid;
recv_data >> guid >> quest;
- if(!GetPlayer()->isAlive())
+ if (!GetPlayer()->isAlive())
return;
sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest );
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
- if(!pObject||!pObject->hasInvolvedQuest(quest))
+ if (!pObject||!pObject->hasInvolvedQuest(quest))
return;
if ( _player->CanCompleteQuest( quest ) )
_player->CompleteQuest( quest );
- if( _player->GetQuestStatus( quest ) != QUEST_STATUS_COMPLETE )
+ if ( _player->GetQuestStatus( quest ) != QUEST_STATUS_COMPLETE )
return;
- if(Quest const *pQuest = objmgr.GetQuestTemplate(quest))
+ if (Quest const *pQuest = objmgr.GetQuestTemplate(quest))
_player->PlayerTalkClass->SendQuestGiverOfferReward( pQuest, guid, true );
}
@@ -356,7 +356,7 @@ void WorldSession::HandleQuestLogSwapQuest(WorldPacket& recv_data )
uint8 slot1, slot2;
recv_data >> slot1 >> slot2;
- if(slot1 == slot2 || slot1 >= MAX_QUEST_LOG_SIZE || slot2 >= MAX_QUEST_LOG_SIZE)
+ if (slot1 == slot2 || slot1 >= MAX_QUEST_LOG_SIZE || slot2 >= MAX_QUEST_LOG_SIZE)
return;
sLog.outDebug( "WORLD: Received CMSG_QUESTLOG_SWAP_QUEST slot 1 = %u, slot 2 = %u", slot1, slot2 );
@@ -371,11 +371,11 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data)
sLog.outDebug( "WORLD: Received CMSG_QUESTLOG_REMOVE_QUEST slot = %u",slot );
- if( slot < MAX_QUEST_LOG_SIZE )
+ if ( slot < MAX_QUEST_LOG_SIZE )
{
- if(uint32 quest = _player->GetQuestSlotQuestId(slot))
+ if (uint32 quest = _player->GetQuestSlotQuestId(slot))
{
- if(!_player->TakeQuestSourceItem( quest, true ))
+ if (!_player->TakeQuestSourceItem( quest, true ))
return; // can't un-equip some items, reject quest cancel
if (const Quest *pQuest = objmgr.GetQuestTemplate(quest))
@@ -435,30 +435,30 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data)
uint64 guid;
recv_data >> guid >> quest;
- if(!GetPlayer()->isAlive())
+ if (!GetPlayer()->isAlive())
return;
sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest );
Quest const *pQuest = objmgr.GetQuestTemplate(quest);
- if( pQuest )
+ if ( pQuest )
{
// TODO: need a virtual function
- if(GetPlayer()->InBattleGround())
- if(BattleGround* bg = GetPlayer()->GetBattleGround())
- if(bg->GetTypeID() == BATTLEGROUND_AV)
+ if (GetPlayer()->InBattleGround())
+ if (BattleGround* bg = GetPlayer()->GetBattleGround())
+ if (bg->GetTypeID() == BATTLEGROUND_AV)
((BattleGroundAV*)bg)->HandleQuestComplete(quest, GetPlayer());
- if( _player->GetQuestStatus( quest ) != QUEST_STATUS_COMPLETE )
+ if ( _player->GetQuestStatus( quest ) != QUEST_STATUS_COMPLETE )
{
- if( pQuest->IsRepeatable() )
+ if ( pQuest->IsRepeatable() )
_player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanCompleteRepeatableQuest(pQuest), false);
else
_player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanRewardQuest(pQuest,false), false);
}
else
{
- if(pQuest->GetReqItemsCount()) // some items required
+ if (pQuest->GetReqItemsCount()) // some items required
_player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanRewardQuest(pQuest,false), false);
else // no items required
_player->PlayerTalkClass->SendQuestGiverOfferReward(pQuest, guid, true);
@@ -536,10 +536,10 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
sLog.outDebug( "WORLD: Received MSG_QUEST_PUSH_RESULT" );
- if( _player->GetDivider() != 0 )
+ if ( _player->GetDivider() != 0 )
{
Player *pPlayer = ObjectAccessor::FindPlayer( _player->GetDivider() );
- if( pPlayer )
+ if ( pPlayer )
{
WorldPacket data( MSG_QUEST_PUSH_RESULT, (8+1) );
data << uint64(guid);
@@ -585,7 +585,7 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32
if ( !pQuest ) continue;
QuestStatus status = pPlayer->GetQuestStatus( quest_id );
- if( (status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) ||
+ if ( (status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) ||
(pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) )
{
if ( pQuest->IsAutoComplete() && pQuest->IsRepeatable() )
@@ -657,27 +657,27 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
{
// need also pet quests case support
Creature *questgiver = ObjectAccessor::GetCreatureOrPetOrVehicle(*GetPlayer(),*itr);
- if(!questgiver || questgiver->IsHostileTo(_player))
+ if (!questgiver || questgiver->IsHostileTo(_player))
continue;
- if(!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
+ if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
continue;
questStatus = sScriptMgr.NPCDialogStatus(_player, questgiver);
- if( questStatus > 6 )
+ if ( questStatus > 6 )
questStatus = getDialogStatus(_player, questgiver, defstatus);
data << uint64(questgiver->GetGUID());
data << uint8(questStatus);
++count;
}
- else if(IS_GAMEOBJECT_GUID(*itr))
+ else if (IS_GAMEOBJECT_GUID(*itr))
{
GameObject *questgiver = GetPlayer()->GetMap()->GetGameObject(*itr);
- if(!questgiver)
+ if (!questgiver)
continue;
- if(questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
+ if (questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
continue;
questStatus = sScriptMgr.GODialogStatus(_player, questgiver);
- if( questStatus > 6 )
+ if ( questStatus > 6 )
questStatus = getDialogStatus(_player, questgiver, defstatus);
data << uint64(questgiver->GetGUID());
@@ -699,7 +699,7 @@ void WorldSession::HandleQueryQuestsCompleted( WorldPacket & recv_data )
for (QuestStatusMap::const_iterator itr = _player->getQuestStatusMap().begin(); itr != _player->getQuestStatusMap().end(); ++itr)
{
- if(itr->second.m_rewarded)
+ if (itr->second.m_rewarded)
{
data << uint32(itr->first);
count++;
diff --git a/src/game/RandomMovementGenerator.cpp b/src/game/RandomMovementGenerator.cpp
index dabb030878f..49abb2b13d2 100644
--- a/src/game/RandomMovementGenerator.cpp
+++ b/src/game/RandomMovementGenerator.cpp
@@ -34,7 +34,7 @@ template<>
bool
RandomMovementGenerator<Creature>::GetDestination(float &x, float &y, float &z) const
{
- if(i_destinationHolder.HasArrived())
+ if (i_destinationHolder.HasArrived())
return false;
i_destinationHolder.GetDestination(x, y, z);
@@ -78,7 +78,7 @@ RandomMovementGenerator<Creature>::_setRandomLocation(Creature &creature)
dist = (nx - X)*(nx - X) + (ny - Y)*(ny - Y);
- if(i == 5)
+ if (i == 5)
{
nz = Z;
break;
@@ -132,7 +132,7 @@ RandomMovementGenerator<Creature>::_setRandomLocation(Creature &creature)
}
//Call for creature group update
- if(creature.GetFormation() && creature.GetFormation()->getLeader() == &creature)
+ if (creature.GetFormation() && creature.GetFormation()->getLeader() == &creature)
{
creature.GetFormation()->LeaderMoveTo(nx, ny, nz);
}
@@ -142,13 +142,13 @@ template<>
void
RandomMovementGenerator<Creature>::Initialize(Creature &creature)
{
- if(!creature.isAlive())
+ if (!creature.isAlive())
return;
- if(!wander_distance)
+ if (!wander_distance)
wander_distance = creature.GetRespawnRadius();
- if(irand(0,RUNNING_CHANCE_RANDOMMV) > 0)
+ if (irand(0,RUNNING_CHANCE_RANDOMMV) > 0)
creature.AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
_setRandomLocation(creature);
}
@@ -168,7 +168,7 @@ template<>
bool
RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff)
{
- if(creature.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
+ if (creature.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
{
i_nextMoveTime.Update(i_nextMoveTime.GetExpiry()); // Expire the timer
creature.clearUnitState(UNIT_STAT_ROAMING);
@@ -177,23 +177,23 @@ RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff
i_nextMoveTime.Update(diff);
- if(i_destinationHolder.HasArrived() && !creature.IsStopped() && !creature.canFly())
+ if (i_destinationHolder.HasArrived() && !creature.IsStopped() && !creature.canFly())
creature.clearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_MOVE);
- if(!i_destinationHolder.HasArrived() && creature.IsStopped())
+ if (!i_destinationHolder.HasArrived() && creature.IsStopped())
creature.addUnitState(UNIT_STAT_ROAMING);
CreatureTraveller traveller(creature);
- if( i_destinationHolder.UpdateTraveller(traveller, diff, true) )
+ if ( i_destinationHolder.UpdateTraveller(traveller, diff, true) )
{
- if(i_nextMoveTime.Passed())
+ if (i_nextMoveTime.Passed())
{
- if(irand(0,RUNNING_CHANCE_RANDOMMV) > 0)
+ if (irand(0,RUNNING_CHANCE_RANDOMMV) > 0)
creature.AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
_setRandomLocation(creature);
}
- else if(creature.isPet() && creature.GetOwner() && !creature.IsWithinDist(creature.GetOwner(),PET_FOLLOW_DIST+2.5f))
+ else if (creature.isPet() && creature.GetOwner() && !creature.IsWithinDist(creature.GetOwner(),PET_FOLLOW_DIST+2.5f))
{
creature.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
_setRandomLocation(creature);
diff --git a/src/game/ReactorAI.cpp b/src/game/ReactorAI.cpp
index 07969937358..8d1f2dea8eb 100644
--- a/src/game/ReactorAI.cpp
+++ b/src/game/ReactorAI.cpp
@@ -30,7 +30,7 @@
int
ReactorAI::Permissible(const Creature *creature)
{
- if( creature->isCivilian() || creature->IsNeutralToAll() )
+ if ( creature->isCivilian() || creature->IsNeutralToAll() )
return PERMIT_BASE_REACTIVE;
return PERMIT_BASE_NO;
@@ -45,12 +45,12 @@ void
ReactorAI::UpdateAI(const uint32 /*time_diff*/)
{
// update i_victimGuid if m_creature->getVictim() !=0 and changed
- if(!UpdateVictim())
+ if (!UpdateVictim())
return;
- if( m_creature->isAttackReady() )
+ if ( m_creature->isAttackReady() )
{
- if( m_creature->IsWithinMeleeRange(m_creature->getVictim()))
+ if ( m_creature->IsWithinMeleeRange(m_creature->getVictim()))
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
diff --git a/src/game/ReputationMgr.cpp b/src/game/ReputationMgr.cpp
index 7d0591efc5e..438f79c2159 100644
--- a/src/game/ReputationMgr.cpp
+++ b/src/game/ReputationMgr.cpp
@@ -58,7 +58,7 @@ int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const
uint32 classMask = m_player->getClassMask();
for (int i=0; i < 4; i++)
{
- if( (factionEntry->BaseRepRaceMask[i] & raceMask ||
+ if ( (factionEntry->BaseRepRaceMask[i] & raceMask ||
(factionEntry->BaseRepRaceMask[i] == 0 &&
factionEntry->BaseRepClassMask[i] != 0 ) ) &&
(factionEntry->BaseRepClassMask[i] & classMask ||
@@ -74,10 +74,10 @@ int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const
int32 ReputationMgr::GetReputation(FactionEntry const* factionEntry) const
{
// Faction without recorded reputation. Just ignore.
- if(!factionEntry)
+ if (!factionEntry)
return 0;
- if(FactionState const* state = GetState(factionEntry))
+ if (FactionState const* state = GetState(factionEntry))
return GetBaseReputation(factionEntry) + state->Standing;
return 0;
@@ -97,7 +97,7 @@ ReputationRank ReputationMgr::GetBaseRank(FactionEntry const* factionEntry) cons
void ReputationMgr::ApplyForceReaction( uint32 faction_id,ReputationRank rank,bool apply )
{
- if(apply)
+ if (apply)
m_forcedReactions[faction_id] = rank;
else
m_forcedReactions.erase(faction_id);
@@ -112,7 +112,7 @@ uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) con
uint32 classMask = m_player->getClassMask();
for (int i=0; i < 4; i++)
{
- if( (factionEntry->BaseRepRaceMask[i] & raceMask ||
+ if ( (factionEntry->BaseRepRaceMask[i] & raceMask ||
(factionEntry->BaseRepRaceMask[i] == 0 &&
factionEntry->BaseRepClassMask[i] != 0 ) ) &&
(factionEntry->BaseRepClassMask[i] & classMask ||
@@ -138,7 +138,7 @@ void ReputationMgr::SendForceReactions()
void ReputationMgr::SendState(FactionState const* faction) const
{
- if(faction->Flags & FACTION_FLAG_VISIBLE) //If faction is visible then update it
+ if (faction->Flags & FACTION_FLAG_VISIBLE) //If faction is visible then update it
{
WorldPacket data(SMSG_SET_FACTION_STANDING, (16)); // last check 2.4.0
data << (float) 0; // unk 2.4.0
@@ -193,7 +193,7 @@ void ReputationMgr::SendStates() const
void ReputationMgr::SendVisible(FactionState const* faction) const
{
- if(m_player->GetSession()->PlayerLoading())
+ if (m_player->GetSession()->PlayerLoading())
return;
// make faction visible in reputation list at client
@@ -214,7 +214,7 @@ void ReputationMgr::Initialize()
{
FactionEntry const *factionEntry = sFactionStore.LookupEntry(i);
- if( factionEntry && (factionEntry->reputationListID >= 0))
+ if ( factionEntry && (factionEntry->reputationListID >= 0))
{
FactionState newFaction;
newFaction.ID = factionEntry->ID;
@@ -223,7 +223,7 @@ void ReputationMgr::Initialize()
newFaction.Flags = GetDefaultStateFlags(factionEntry);
newFaction.Changed = true;
- if( newFaction.Flags & FACTION_FLAG_VISIBLE )
+ if ( newFaction.Flags & FACTION_FLAG_VISIBLE )
++m_visibleFactionCount;
UpdateRankCounters(REP_HOSTILE,GetBaseRank(factionEntry));
@@ -290,7 +290,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
{
for (SimpleFactionsList::const_iterator itr = flist->begin(); itr != flist->end(); ++itr)
{
- if((*itr) == factionEntry->ID) // Not to self
+ if ((*itr) == factionEntry->ID) // Not to self
continue;
targetFaction = sFactionStore.LookupEntry(*itr);
@@ -320,7 +320,7 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
{
int32 BaseRep = GetBaseReputation(factionEntry);
- if(incremental)
+ if (incremental)
{
// int32 *= float cause one point loss?
standing = floor( (float)standing * sWorld.getRate(RATE_REPUTATION_GAIN) + 0.5 );
@@ -340,7 +340,7 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
SetVisible(&itr->second);
- if(new_rank <= REP_HOSTILE)
+ if (new_rank <= REP_HOSTILE)
SetAtWar(&itr->second,true);
SendState(&itr->second);
@@ -361,18 +361,18 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
void ReputationMgr::SetVisible(FactionTemplateEntry const*factionTemplateEntry)
{
- if(!factionTemplateEntry->faction)
+ if (!factionTemplateEntry->faction)
return;
- if(FactionEntry const *factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
+ if (FactionEntry const *factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
// Never show factions of the opposing team
- if(!(factionEntry->BaseRepRaceMask[1] & m_player->getRaceMask() && factionEntry->BaseRepValue[1] == Reputation_Bottom) )
+ if (!(factionEntry->BaseRepRaceMask[1] & m_player->getRaceMask() && factionEntry->BaseRepValue[1] == Reputation_Bottom) )
SetVisible(factionEntry);
}
void ReputationMgr::SetVisible(FactionEntry const *factionEntry)
{
- if(factionEntry->reputationListID < 0)
+ if (factionEntry->reputationListID < 0)
return;
FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID);
@@ -386,11 +386,11 @@ void ReputationMgr::SetVisible(FactionState* faction)
{
// always invisible or hidden faction can't be make visible
// except if faction has FACTION_FLAG_SPECIAL
- if(faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN) && !(faction->Flags & FACTION_FLAG_SPECIAL) )
+ if (faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN) && !(faction->Flags & FACTION_FLAG_SPECIAL) )
return;
// already set
- if(faction->Flags & FACTION_FLAG_VISIBLE)
+ if (faction->Flags & FACTION_FLAG_VISIBLE)
return;
faction->Flags |= FACTION_FLAG_VISIBLE;
@@ -408,7 +408,7 @@ void ReputationMgr::SetAtWar( RepListID repListID, bool on )
return;
// always invisible or hidden faction can't change war state
- if(itr->second.Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN) )
+ if (itr->second.Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN) )
return;
SetAtWar(&itr->second,on);
@@ -417,14 +417,14 @@ void ReputationMgr::SetAtWar( RepListID repListID, bool on )
void ReputationMgr::SetAtWar(FactionState* faction, bool atWar)
{
// not allow declare war to own faction
- if(atWar && (faction->Flags & FACTION_FLAG_PEACE_FORCED) )
+ if (atWar && (faction->Flags & FACTION_FLAG_PEACE_FORCED) )
return;
// already set
- if(((faction->Flags & FACTION_FLAG_AT_WAR) != 0) == atWar)
+ if (((faction->Flags & FACTION_FLAG_AT_WAR) != 0) == atWar)
return;
- if( atWar )
+ if ( atWar )
faction->Flags |= FACTION_FLAG_AT_WAR;
else
faction->Flags &= ~FACTION_FLAG_AT_WAR;
@@ -444,14 +444,14 @@ void ReputationMgr::SetInactive( RepListID repListID, bool on )
void ReputationMgr::SetInactive(FactionState* faction, bool inactive)
{
// always invisible or hidden faction can't be inactive
- if(inactive && ((faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN)) || !(faction->Flags & FACTION_FLAG_VISIBLE) ) )
+ if (inactive && ((faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN)) || !(faction->Flags & FACTION_FLAG_VISIBLE) ) )
return;
// already set
- if(((faction->Flags & FACTION_FLAG_INACTIVE) != 0) == inactive)
+ if (((faction->Flags & FACTION_FLAG_INACTIVE) != 0) == inactive)
return;
- if(inactive)
+ if (inactive)
faction->Flags |= FACTION_FLAG_INACTIVE;
else
faction->Flags &= ~FACTION_FLAG_INACTIVE;
@@ -466,14 +466,14 @@ void ReputationMgr::LoadFromDB(QueryResult_AutoPtr result)
//QueryResult *result = CharacterDatabase.PQuery("SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'",GetGUIDLow());
- if(result)
+ if (result)
{
do
{
Field *fields = result->Fetch();
FactionEntry const *factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt32());
- if( factionEntry && (factionEntry->reputationListID >= 0))
+ if ( factionEntry && (factionEntry->reputationListID >= 0))
{
FactionState* faction = &m_factions[factionEntry->reputationListID];
@@ -488,27 +488,27 @@ void ReputationMgr::LoadFromDB(QueryResult_AutoPtr result)
uint32 dbFactionFlags = fields[2].GetUInt32();
- if( dbFactionFlags & FACTION_FLAG_VISIBLE )
+ if ( dbFactionFlags & FACTION_FLAG_VISIBLE )
SetVisible(faction); // have internal checks for forced invisibility
- if( dbFactionFlags & FACTION_FLAG_INACTIVE)
+ if ( dbFactionFlags & FACTION_FLAG_INACTIVE)
SetInactive(faction,true); // have internal checks for visibility requirement
- if( dbFactionFlags & FACTION_FLAG_AT_WAR ) // DB at war
+ if ( dbFactionFlags & FACTION_FLAG_AT_WAR ) // DB at war
SetAtWar(faction,true); // have internal checks for FACTION_FLAG_PEACE_FORCED
else // DB not at war
{
// allow remove if visible (and then not FACTION_FLAG_INVISIBLE_FORCED or FACTION_FLAG_HIDDEN)
- if( faction->Flags & FACTION_FLAG_VISIBLE )
+ if ( faction->Flags & FACTION_FLAG_VISIBLE )
SetAtWar(faction,false); // have internal checks for FACTION_FLAG_PEACE_FORCED
}
// set atWar for hostile
- if(GetRank(factionEntry) <= REP_HOSTILE)
+ if (GetRank(factionEntry) <= REP_HOSTILE)
SetAtWar(faction,true);
// reset changed flag if values similar to saved in DB
- if(faction->Flags==dbFactionFlags)
+ if (faction->Flags==dbFactionFlags)
faction->Changed = false;
}
}
@@ -531,17 +531,17 @@ void ReputationMgr::SaveToDB()
void ReputationMgr::UpdateRankCounters( ReputationRank old_rank, ReputationRank new_rank )
{
- if(old_rank >= REP_EXALTED)
+ if (old_rank >= REP_EXALTED)
--m_exaltedFactionCount;
- if(old_rank >= REP_REVERED)
+ if (old_rank >= REP_REVERED)
--m_reveredFactionCount;
- if(old_rank >= REP_HONORED)
+ if (old_rank >= REP_HONORED)
--m_honoredFactionCount;
- if(new_rank >= REP_EXALTED)
+ if (new_rank >= REP_EXALTED)
++m_exaltedFactionCount;
- if(new_rank >= REP_REVERED)
+ if (new_rank >= REP_REVERED)
++m_reveredFactionCount;
- if(new_rank >= REP_HONORED)
+ if (new_rank >= REP_HONORED)
++m_honoredFactionCount;
}
diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp
index ae412f61b5d..c6170a15b44 100644
--- a/src/game/ScriptMgr.cpp
+++ b/src/game/ScriptMgr.cpp
@@ -102,9 +102,9 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget)
debug_log("TSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote);
- if(pData->uiSoundId)
+ if (pData->uiSoundId)
{
- if(GetSoundEntriesStore()->LookupEntry(pData->uiSoundId))
+ if (GetSoundEntriesStore()->LookupEntry(pData->uiSoundId))
{
pSource->SendPlaySound(pData->uiSoundId, false);
}
@@ -112,7 +112,7 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget)
error_log("TSCR: DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId);
}
- if(pData->uiEmote)
+ if (pData->uiEmote)
{
if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER)
((Unit*)pSource)->HandleEmoteCommand(pData->uiEmote);
@@ -159,12 +159,12 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget)
void Script::RegisterSelf()
{
int id = GetScriptId(Name.c_str());
- if(id)
+ if (id)
{
m_scripts[id] = this;
++num_sc_scripts;
}
- else if(Name.find("example") == std::string::npos)
+ else if (Name.find("example") == std::string::npos)
{
error_db_log("TrinityScript: RegisterSelf, but script named %s does not have ScriptName assigned in database.",(this)->Name.c_str());
delete this;
@@ -307,12 +307,12 @@ bool ScriptMgr::GossipSelectWithCode(Player* pPlayer, Creature* pCreature, uint3
bool ScriptMgr::GOSelect(Player* pPlayer, GameObject* pGO, uint32 uiSender, uint32 uiAction)
{
- if(!pGO)
+ if (!pGO)
return false;
debug_log("TSCR: Gossip selection, sender: %d, action: %d", uiSender, uiAction);
Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId];
- if(!tmpscript || !tmpscript->pGOSelect) return false;
+ if (!tmpscript || !tmpscript->pGOSelect) return false;
pPlayer->PlayerTalkClass->ClearMenus();
return tmpscript->pGOSelect(pPlayer, pGO, uiSender, uiAction);
@@ -320,12 +320,12 @@ bool ScriptMgr::GOSelect(Player* pPlayer, GameObject* pGO, uint32 uiSender, uint
bool ScriptMgr::GOSelectWithCode(Player* pPlayer, GameObject* pGO, uint32 uiSender, uint32 uiAction, const char* sCode)
{
- if(!pGO)
+ if (!pGO)
return false;
debug_log("TSCR: Gossip selection, sender: %d, action: %d",uiSender, uiAction);
Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId];
- if(!tmpscript || !tmpscript->pGOSelectWithCode) return false;
+ if (!tmpscript || !tmpscript->pGOSelectWithCode) return false;
pPlayer->PlayerTalkClass->ClearMenus();
return tmpscript->pGOSelectWithCode(pPlayer, pGO, uiSender ,uiAction, sCode);
diff --git a/src/game/ScriptedCreature.cpp b/src/game/ScriptedCreature.cpp
index 2c9d569c6d7..62751a074b4 100644
--- a/src/game/ScriptedCreature.cpp
+++ b/src/game/ScriptedCreature.cpp
@@ -24,7 +24,7 @@ void SummonList::DoZoneInCombat(uint32 entry)
{
Creature *summon = Unit::GetCreature(*m_creature, *i);
++i;
- if(summon && summon->IsAIEnabled
+ if (summon && summon->IsAIEnabled
&& (!entry || summon->GetEntry() == entry))
summon->AI()->DoZoneInCombat();
}
@@ -36,7 +36,7 @@ void SummonList::DoAction(uint32 entry, uint32 info)
{
Creature *summon = Unit::GetCreature(*m_creature, *i);
++i;
- if(summon && summon->IsAIEnabled
+ if (summon && summon->IsAIEnabled
&& (!entry || summon->GetEntry() == entry))
summon->AI()->DoAction(info);
}
@@ -47,9 +47,9 @@ void SummonList::DespawnEntry(uint32 entry)
for (iterator i = begin(); i != end();)
{
Creature *summon = Unit::GetCreature(*m_creature, *i);
- if(!summon)
+ if (!summon)
erase(i++);
- else if(summon->GetEntry() == entry)
+ else if (summon->GetEntry() == entry)
{
erase(i++);
summon->setDeathState(JUST_DIED);
@@ -65,12 +65,12 @@ void SummonList::DespawnAll()
while (!empty())
{
Creature *summon = Unit::GetCreature(*m_creature, *begin());
- if(!summon)
+ if (!summon)
erase(begin());
else
{
erase(begin());
- if(summon->isSummon())
+ if (summon->isSummon())
{
summon->DestroyForNearbyPlayers();
CAST_SUM(summon)->UnSummon();
@@ -96,7 +96,7 @@ void ScriptedAI::AttackStartNoMove(Unit* pWho)
if (!pWho)
return;
- if(m_creature->Attack(pWho, false))
+ if (m_creature->Attack(pWho, false))
DoStartNoMovement(pWho);
}
@@ -410,20 +410,20 @@ void ScriptedAI::DoResetThreat()
{
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
- if(pUnit && DoGetThreat(pUnit))
+ if (pUnit && DoGetThreat(pUnit))
DoModifyThreatPercent(pUnit, -100);
}
}
float ScriptedAI::DoGetThreat(Unit* pUnit)
{
- if(!pUnit) return 0.0f;
+ if (!pUnit) return 0.0f;
return m_creature->getThreatManager().getThreat(pUnit);
}
void ScriptedAI::DoModifyThreatPercent(Unit* pUnit, int32 pct)
{
- if(!pUnit) return;
+ if (!pUnit) return;
m_creature->getThreatManager().modifyThreatPercent(pUnit, pct);
}
@@ -440,9 +440,9 @@ void ScriptedAI::DoTeleportTo(const float fPos[4])
void ScriptedAI::DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, float fO)
{
- if(!pUnit || pUnit->GetTypeId() != TYPEID_PLAYER)
+ if (!pUnit || pUnit->GetTypeId() != TYPEID_PLAYER)
{
- if(pUnit)
+ if (pUnit)
error_log("TSCR: Creature %u (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: %u) to x: %f y:%f z: %f o: %f. Aborted.", m_creature->GetGUID(), m_creature->GetEntry(), pUnit->GetTypeId(), pUnit->GetGUID(), fX, fY, fZ, fO);
return;
}
@@ -607,12 +607,12 @@ BossAI::BossAI(Creature *c, uint32 id) : ScriptedAI(c)
void BossAI::_Reset()
{
- if(!me->isAlive())
+ if (!me->isAlive())
return;
events.Reset();
summons.DespawnAll();
- if(instance)
+ if (instance)
instance->SetBossState(bossId, NOT_STARTED);
}
@@ -620,7 +620,7 @@ void BossAI::_JustDied()
{
events.Reset();
summons.DespawnAll();
- if(instance)
+ if (instance)
{
instance->SetBossState(bossId, DONE);
instance->SaveToDB();
@@ -631,7 +631,7 @@ void BossAI::_EnterCombat()
{
me->setActive(true);
DoZoneInCombat();
- if(instance)
+ if (instance)
instance->SetBossState(bossId, IN_PROGRESS);
}
@@ -641,7 +641,7 @@ void BossAI::TeleportCheaters()
me->GetPosition(x, y, z);
std::list<HostileReference*> &m_threatlist = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr)
- if((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && !CheckBoundary((*itr)->getTarget()))
+ if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && !CheckBoundary((*itr)->getTarget()))
(*itr)->getTarget()->NearTeleportTo(x, y, z, 0);
}
@@ -695,7 +695,7 @@ bool BossAI::CheckBoundary(Unit *who)
void BossAI::JustSummoned(Creature *summon)
{
summons.Summon(summon);
- if(me->isInCombat())
+ if (me->isInCombat())
DoZoneInCombat(summon);
}
@@ -711,13 +711,13 @@ void LoadOverridenSQLData()
GameObjectInfo *goInfo;
// Sunwell Plateau : Kalecgos : Spectral Rift
- if(goInfo = GOBJECT(187055))
- if(goInfo->type == GAMEOBJECT_TYPE_GOOBER)
+ if (goInfo = GOBJECT(187055))
+ if (goInfo->type == GAMEOBJECT_TYPE_GOOBER)
goInfo->goober.lockId = 57; // need LOCKTYPE_QUICK_OPEN
// Naxxramas : Sapphiron Birth
- if(goInfo = GOBJECT(181356))
- if(goInfo->type == GAMEOBJECT_TYPE_TRAP)
+ if (goInfo = GOBJECT(181356))
+ if (goInfo->type == GAMEOBJECT_TYPE_TRAP)
goInfo->trap.radius = 50;
}
diff --git a/src/game/ScriptedCreature.h b/src/game/ScriptedCreature.h
index ff7495c9bd6..047cfc27b86 100644
--- a/src/game/ScriptedCreature.h
+++ b/src/game/ScriptedCreature.h
@@ -271,7 +271,7 @@ struct BossAI : public ScriptedAI
bool CheckInRoom()
{
- if(CheckBoundary(me))
+ if (CheckBoundary(me))
return true;
EnterEvadeMode();
return false;
diff --git a/src/game/ScriptedEscortAI.cpp b/src/game/ScriptedEscortAI.cpp
index e170926bbbb..445974eedfd 100644
--- a/src/game/ScriptedEscortAI.cpp
+++ b/src/game/ScriptedEscortAI.cpp
@@ -442,7 +442,7 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID,
return;
}
- if(!ScriptWP) // sd2 never adds wp in script, but tc does
+ if (!ScriptWP) // sd2 never adds wp in script, but tc does
{
if (!WaypointList.empty())
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index a762744a9c6..30540cb96bc 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -203,7 +203,7 @@ enum SpellSchoolMask
inline SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask)
{
for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
- if(mask & (1 << i))
+ if (mask & (1 << i))
return SpellSchools(i);
return SPELL_SCHOOL_NORMAL;
diff --git a/src/game/SkillExtraItems.cpp b/src/game/SkillExtraItems.cpp
index 8c7dfffa871..ad5d6dd565f 100644
--- a/src/game/SkillExtraItems.cpp
+++ b/src/game/SkillExtraItems.cpp
@@ -72,28 +72,28 @@ void LoadSkillExtraItemTable()
uint32 spellId = fields[0].GetUInt32();
- if(!sSpellStore.LookupEntry(spellId))
+ if (!sSpellStore.LookupEntry(spellId))
{
sLog.outError("Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);
continue;
}
uint32 requiredSpecialization = fields[1].GetUInt32();
- if(!sSpellStore.LookupEntry(requiredSpecialization))
+ if (!sSpellStore.LookupEntry(requiredSpecialization))
{
sLog.outError("Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId,requiredSpecialization);
continue;
}
float additionalCreateChance = fields[2].GetFloat();
- if(additionalCreateChance <= 0.0f)
+ if (additionalCreateChance <= 0.0f)
{
sLog.outError("Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId);
continue;
}
uint8 additionalMaxNum = fields[3].GetUInt8();
- if(!additionalMaxNum)
+ if (!additionalMaxNum)
{
sLog.outError("Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);
continue;
@@ -122,17 +122,17 @@ bool canCreateExtraItems(Player * player, uint32 spellId, float &additionalChanc
{
// get the info for the specified spell
SkillExtraItemMap::const_iterator ret = SkillExtraItemStore.find(spellId);
- if(ret==SkillExtraItemStore.end())
+ if (ret==SkillExtraItemStore.end())
return false;
SkillExtraItemEntry const* specEntry = &ret->second;
// if no entry, then no extra items can be created
- if(!specEntry)
+ if (!specEntry)
return false;
// the player doesn't have the required specialization, return false
- if(!player->HasSpell(specEntry->requiredSpecialization))
+ if (!player->HasSpell(specEntry->requiredSpecialization))
return false;
// set the arguments to the appropriate values
diff --git a/src/game/SkillHandler.cpp b/src/game/SkillHandler.cpp
index d7d94dcef4a..ad4d1c09a87 100644
--- a/src/game/SkillHandler.cpp
+++ b/src/game/SkillHandler.cpp
@@ -70,10 +70,10 @@ void WorldSession::HandleTalentWipeConfirmOpcode( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
- if(!(_player->resetTalents()))
+ if (!(_player->resetTalents()))
{
WorldPacket data( MSG_TALENT_WIPE_CONFIRM, 8+4); //you have not any talent
data << uint64(0);
diff --git a/src/game/SocialMgr.cpp b/src/game/SocialMgr.cpp
index f11cc092ba0..ec9686b6dc2 100644
--- a/src/game/SocialMgr.cpp
+++ b/src/game/SocialMgr.cpp
@@ -65,11 +65,11 @@ bool PlayerSocial::AddToSocialList(uint32 friend_guid, bool ignore)
}
uint32 flag = SOCIAL_FLAG_FRIEND;
- if(ignore)
+ if (ignore)
flag = SOCIAL_FLAG_IGNORED;
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid);
- if(itr != m_playerSocialMap.end())
+ if (itr != m_playerSocialMap.end())
{
CharacterDatabase.PExecute("UPDATE character_social SET flags = (flags | %u) WHERE guid = '%u' AND friend = '%u'", flag, GetPlayerGUID(), friend_guid);
m_playerSocialMap[friend_guid].Flags |= flag;
@@ -155,7 +155,7 @@ void PlayerSocial::SendSocialList()
bool PlayerSocial::HasFriend(uint32 friend_guid)
{
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid);
- if(itr != m_playerSocialMap.end())
+ if (itr != m_playerSocialMap.end())
return itr->second.Flags & SOCIAL_FLAG_FRIEND;
return false;
}
@@ -163,7 +163,7 @@ bool PlayerSocial::HasFriend(uint32 friend_guid)
bool PlayerSocial::HasIgnore(uint32 ignore_guid)
{
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(ignore_guid);
- if(itr != m_playerSocialMap.end())
+ if (itr != m_playerSocialMap.end())
return itr->second.Flags & SOCIAL_FLAG_IGNORED;
return false;
}
@@ -178,7 +178,7 @@ SocialMgr::~SocialMgr()
void SocialMgr::GetFriendInfo(Player *player, uint32 friendGUID, FriendInfo &friendInfo)
{
- if(!player)
+ if (!player)
return;
friendInfo.Status = FRIEND_STATUS_OFFLINE;
@@ -187,7 +187,7 @@ void SocialMgr::GetFriendInfo(Player *player, uint32 friendGUID, FriendInfo &fri
friendInfo.Class = 0;
Player *pFriend = ObjectAccessor::FindPlayer(friendGUID);
- if(!pFriend)
+ if (!pFriend)
return;
uint32 team = player->GetTeam();
@@ -196,7 +196,7 @@ void SocialMgr::GetFriendInfo(Player *player, uint32 friendGUID, FriendInfo &fri
AccountTypes gmLevelInWhoList = AccountTypes (sWorld.getConfig(CONFIG_GM_LEVEL_IN_WHO_LIST));
PlayerSocialMap::iterator itr = player->GetSocial()->m_playerSocialMap.find(friendGUID);
- if(itr != player->GetSocial()->m_playerSocialMap.end())
+ if (itr != player->GetSocial()->m_playerSocialMap.end())
friendInfo.Note = itr->second.Note;
// PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
@@ -207,9 +207,9 @@ void SocialMgr::GetFriendInfo(Player *player, uint32 friendGUID, FriendInfo &fri
pFriend->IsVisibleGloballyFor(player))
{
friendInfo.Status = FRIEND_STATUS_ONLINE;
- if(pFriend->isAFK())
+ if (pFriend->isAFK())
friendInfo.Status = FRIEND_STATUS_AFK;
- if(pFriend->isDND())
+ if (pFriend->isDND())
friendInfo.Status = FRIEND_STATUS_DND;
friendInfo.Area = pFriend->GetZoneId();
friendInfo.Level = pFriend->getLevel();
@@ -296,7 +296,7 @@ PlayerSocial *SocialMgr::LoadFromDB(QueryResult_AutoPtr result, uint32 guid)
PlayerSocial *social = &m_socialMap[guid];
social->SetPlayerGUID(guid);
- if(!result)
+ if (!result)
return social;
uint32 friend_guid = 0;
@@ -314,7 +314,7 @@ PlayerSocial *SocialMgr::LoadFromDB(QueryResult_AutoPtr result, uint32 guid)
social->m_playerSocialMap[friend_guid] = FriendInfo(flags, note);
// client's friends list and ignore list limit
- if(social->m_playerSocialMap.size() >= (SOCIALMGR_FRIEND_LIMIT + SOCIALMGR_IGNORE_LIMIT))
+ if (social->m_playerSocialMap.size() >= (SOCIALMGR_FRIEND_LIMIT + SOCIALMGR_IGNORE_LIMIT))
break;
}
while (result->NextRow());
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 901f17c09e2..01fc86ff186 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -155,7 +155,7 @@ void SpellCastTargets::setSrc(float x, float y, float z)
void SpellCastTargets::setSrc(Position *pos)
{
- if(pos)
+ if (pos)
{
m_srcPos.Relocate(pos);
m_intTargetFlags |= FLAG_INT_SRC_LOC;
@@ -166,13 +166,13 @@ void SpellCastTargets::setDst(float x, float y, float z, float orientation, uint
{
m_dstPos.Relocate(x, y, z, orientation);
m_intTargetFlags |= FLAG_INT_DST_LOC;
- if(mapId != MAPID_INVALID)
+ if (mapId != MAPID_INVALID)
m_dstPos.m_mapId = mapId;
}
void SpellCastTargets::setDst(Position *pos)
{
- if(pos)
+ if (pos)
{
m_dstPos.Relocate(pos);
m_intTargetFlags |= FLAG_INT_DST_LOC;
@@ -188,7 +188,7 @@ void SpellCastTargets::setGOTarget(GameObject *target)
void SpellCastTargets::setItemTarget(Item* item)
{
- if(!item)
+ if (!item)
return;
m_itemTarget = item;
@@ -212,7 +212,7 @@ void SpellCastTargets::Update(Unit* caster)
m_itemTarget = NULL;
if (caster->GetTypeId() == TYPEID_PLAYER)
{
- if(m_targetMask & TARGET_FLAG_ITEM)
+ if (m_targetMask & TARGET_FLAG_ITEM)
m_itemTarget = caster->ToPlayer()->GetItemByGuid(m_itemTargetGUID);
else if (m_targetMask & TARGET_FLAG_TRADE_ITEM)
if (m_itemTargetGUID == TRADE_SLOT_NONTRADED) // here it is not guid but slot. Also prevent hacking slots
@@ -226,7 +226,7 @@ void SpellCastTargets::Update(Unit* caster)
bool SpellCastTargets::read ( WorldPacket * data, Unit *caster )
{
- if(data->rpos() + 4 > data->size())
+ if (data->rpos() + 4 > data->size())
return false;
//data->hexlike();
@@ -234,66 +234,66 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster )
*data >> m_targetMask;
//sLog.outDebug("Spell read, target mask = %u", m_targetMask);
- if(m_targetMask == TARGET_FLAG_SELF)
+ if (m_targetMask == TARGET_FLAG_SELF)
return true;
// TARGET_FLAG_UNK2 is used for non-combat pets, maybe other?
- if( m_targetMask & ( TARGET_FLAG_UNIT | TARGET_FLAG_UNK2 ))
+ if ( m_targetMask & ( TARGET_FLAG_UNIT | TARGET_FLAG_UNK2 ))
{
- if(!data->readPackGUID(m_unitTargetGUID))
+ if (!data->readPackGUID(m_unitTargetGUID))
return false;
if (m_targetMask & TARGET_FLAG_UNIT)
m_intTargetFlags |= FLAG_INT_UNIT;
}
- if( m_targetMask & ( TARGET_FLAG_OBJECT ))
+ if ( m_targetMask & ( TARGET_FLAG_OBJECT ))
{
- if(!data->readPackGUID(m_GOTargetGUID))
+ if (!data->readPackGUID(m_GOTargetGUID))
return false;
m_intTargetFlags |= FLAG_INT_OBJECT;
}
- if(( m_targetMask & ( TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM )) && caster->GetTypeId() == TYPEID_PLAYER)
- if(!data->readPackGUID(m_itemTargetGUID))
+ if (( m_targetMask & ( TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM )) && caster->GetTypeId() == TYPEID_PLAYER)
+ if (!data->readPackGUID(m_itemTargetGUID))
return false;
- if( m_targetMask & (TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE ) )
- if(!data->readPackGUID(m_CorpseTargetGUID))
+ if ( m_targetMask & (TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE ) )
+ if (!data->readPackGUID(m_CorpseTargetGUID))
return false;
- if( m_targetMask & TARGET_FLAG_SOURCE_LOCATION )
+ if ( m_targetMask & TARGET_FLAG_SOURCE_LOCATION )
{
- if(data->rpos() + 1 + 4 + 4 + 4 > data->size())
+ if (data->rpos() + 1 + 4 + 4 + 4 > data->size())
return false;
- if(!data->readPackGUID(m_unitTargetGUID))
+ if (!data->readPackGUID(m_unitTargetGUID))
return false;
*data >> m_srcPos.m_positionX >> m_srcPos.m_positionY >> m_srcPos.m_positionZ;
- if(!m_srcPos.IsPositionValid())
+ if (!m_srcPos.IsPositionValid())
return false;
m_intTargetFlags |= FLAG_INT_SRC_LOC;
}
else
m_srcPos.Relocate(caster);
- if( m_targetMask & TARGET_FLAG_DEST_LOCATION )
+ if ( m_targetMask & TARGET_FLAG_DEST_LOCATION )
{
- if(data->rpos() + 1 + 4 + 4 + 4 > data->size())
+ if (data->rpos() + 1 + 4 + 4 + 4 > data->size())
return false;
- if(!data->readPackGUID(m_unitTargetGUID))
+ if (!data->readPackGUID(m_unitTargetGUID))
return false;
*data >> m_dstPos.m_positionX >> m_dstPos.m_positionY >> m_dstPos.m_positionZ;
- if(!m_dstPos.IsPositionValid())
+ if (!m_dstPos.IsPositionValid())
return false;
m_intTargetFlags |= FLAG_INT_DST_LOC;
- if( m_targetMask & TARGET_FLAG_SOURCE_LOCATION )
+ if ( m_targetMask & TARGET_FLAG_SOURCE_LOCATION )
{
- if(data->rpos() + 4 + 4 <= data->size())
+ if (data->rpos() + 4 + 4 <= data->size())
{
*data >> m_elevation >> m_speed;
// TODO: should also read
@@ -306,9 +306,9 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster )
else
m_dstPos.Relocate(caster);
- if( m_targetMask & TARGET_FLAG_STRING )
+ if ( m_targetMask & TARGET_FLAG_STRING )
{
- if(data->rpos() + 1 > data->size())
+ if (data->rpos() + 1 > data->size())
return false;
*data >> m_strTarget;
@@ -324,49 +324,49 @@ void SpellCastTargets::write ( WorldPacket * data )
*data << uint32(m_targetMask);
//sLog.outDebug("Spell write, target mask = %u", m_targetMask);
- if( m_targetMask & ( TARGET_FLAG_UNIT | TARGET_FLAG_PVP_CORPSE | TARGET_FLAG_OBJECT | TARGET_FLAG_CORPSE | TARGET_FLAG_UNK2 ) )
+ if ( m_targetMask & ( TARGET_FLAG_UNIT | TARGET_FLAG_PVP_CORPSE | TARGET_FLAG_OBJECT | TARGET_FLAG_CORPSE | TARGET_FLAG_UNK2 ) )
{
- if(m_targetMask & TARGET_FLAG_UNIT)
+ if (m_targetMask & TARGET_FLAG_UNIT)
{
- if(m_unitTarget)
+ if (m_unitTarget)
data->append(m_unitTarget->GetPackGUID());
else
*data << uint8(0);
}
- else if( m_targetMask & TARGET_FLAG_OBJECT )
+ else if ( m_targetMask & TARGET_FLAG_OBJECT )
{
- if(m_GOTarget)
+ if (m_GOTarget)
data->append(m_GOTarget->GetPackGUID());
else
*data << uint8(0);
}
- else if( m_targetMask & ( TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE ) )
+ else if ( m_targetMask & ( TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE ) )
data->appendPackGUID(m_CorpseTargetGUID);
else
*data << uint8(0);
}
- if( m_targetMask & ( TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM ) )
+ if ( m_targetMask & ( TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM ) )
{
- if(m_itemTarget)
+ if (m_itemTarget)
data->append(m_itemTarget->GetPackGUID());
else
*data << uint8(0);
}
- if( m_targetMask & TARGET_FLAG_SOURCE_LOCATION )
+ if ( m_targetMask & TARGET_FLAG_SOURCE_LOCATION )
{
*data << uint8(0); // It seems the client doesn't like unit target GUID being sent here, we must send 0
*data << m_srcPos.m_positionX << m_srcPos.m_positionY << m_srcPos.m_positionZ;
}
- if( m_targetMask & TARGET_FLAG_DEST_LOCATION )
+ if ( m_targetMask & TARGET_FLAG_DEST_LOCATION )
{
*data << uint8(0); // It seems the client doesn't like unit target GUID being sent here, we must send 0
*data << m_dstPos.m_positionX << m_dstPos.m_positionY << m_dstPos.m_positionZ;
}
- if( m_targetMask & TARGET_FLAG_STRING )
+ if ( m_targetMask & TARGET_FLAG_STRING )
*data << m_strTarget;
}
@@ -412,29 +412,29 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
m_spellSchoolMask = GetSpellSchoolMask(info); // Can be override for some spell (wand shoot for example)
- if(m_attackType == RANGED_ATTACK)
+ if (m_attackType == RANGED_ATTACK)
{
// wand case
- if((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER)
+ if ((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER)
{
- if(Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK))
+ if (Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK))
m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetProto()->Damage[0].DamageType);
}
}
// Set health leech amount to zero
m_healthLeech = 0;
- if(originalCasterGUID)
+ if (originalCasterGUID)
m_originalCasterGUID = originalCasterGUID;
else
m_originalCasterGUID = m_caster->GetGUID();
- if(m_originalCasterGUID == m_caster->GetGUID())
+ if (m_originalCasterGUID == m_caster->GetGUID())
m_originalCaster = m_caster;
else
{
m_originalCaster = ObjectAccessor::GetUnit(*m_caster, m_originalCasterGUID);
- if(m_originalCaster && !m_originalCaster->IsInWorld()) m_originalCaster = NULL;
+ if (m_originalCaster && !m_originalCaster->IsInWorld()) m_originalCaster = NULL;
}
for (int i=0; i <3; ++i)
@@ -470,19 +470,19 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
// determine reflection
m_canReflect = false;
- if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !IsAreaOfEffectSpell(m_spellInfo) && !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED))
+ if (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !IsAreaOfEffectSpell(m_spellInfo) && !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED))
{
for (int j = 0; j < 3; ++j)
{
if (m_spellInfo->Effect[j] == 0)
continue;
- if(!IsPositiveTarget(m_spellInfo->EffectImplicitTargetA[j], m_spellInfo->EffectImplicitTargetB[j]))
+ if (!IsPositiveTarget(m_spellInfo->EffectImplicitTargetA[j], m_spellInfo->EffectImplicitTargetB[j]))
m_canReflect = true;
else
m_canReflect = (m_spellInfo->AttributesEx & SPELL_ATTR_EX_NEGATIVE) ? true : false;
- if(m_canReflect)
+ if (m_canReflect)
continue;
else
break;
@@ -494,7 +494,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
Spell::~Spell()
{
- if(m_caster && m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_caster && m_caster->GetTypeId() == TYPEID_PLAYER)
assert(m_caster->ToPlayer()->m_spellModTakingSpell != this);
delete m_spellValue;
}
@@ -533,44 +533,44 @@ void Spell::SelectSpellTargets()
{
// not call for empty effect.
// Also some spells use not used effect targets for store targets for dummy effect in triggered spells
- if(!m_spellInfo->Effect[i])
+ if (!m_spellInfo->Effect[i])
continue;
uint32 effectTargetType = EffectTargetType[m_spellInfo->Effect[i]];
// is it possible that areaaura is not applied to caster?
- if(effectTargetType == SPELL_REQUIRE_NONE)
+ if (effectTargetType == SPELL_REQUIRE_NONE)
continue;
uint32 targetA = m_spellInfo->EffectImplicitTargetA[i];
uint32 targetB = m_spellInfo->EffectImplicitTargetB[i];
- if(targetA)
+ if (targetA)
SelectEffectTargets(i, targetA);
- if(targetB) // In very rare case !A && B
+ if (targetB) // In very rare case !A && B
SelectEffectTargets(i, targetB);
- if(effectTargetType != SPELL_REQUIRE_UNIT)
+ if (effectTargetType != SPELL_REQUIRE_UNIT)
{
- if(effectTargetType == SPELL_REQUIRE_CASTER)
+ if (effectTargetType == SPELL_REQUIRE_CASTER)
AddUnitTarget(m_caster, i);
- else if(effectTargetType == SPELL_REQUIRE_ITEM)
+ else if (effectTargetType == SPELL_REQUIRE_ITEM)
{
- if(m_targets.getItemTarget())
+ if (m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i);
}
continue;
}
- if(/*tmpUnitMap.empty() && */m_spellInfo->Targets & TARGET_FLAG_CASTER)
+ if (/*tmpUnitMap.empty() && */m_spellInfo->Targets & TARGET_FLAG_CASTER)
{
AddUnitTarget(m_caster, i);
continue;
}
- if(!targetA && !targetB)
+ if (!targetA && !targetB)
{
- if(!GetSpellMaxRangeForFriend(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)))
+ if (!GetSpellMaxRangeForFriend(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)))
{
AddUnitTarget(m_caster, i);
continue;
@@ -588,7 +588,7 @@ void Spell::SelectSpellTargets()
{
WorldObject* result = FindCorpseUsing<Trinity::CannibalizeObjectCheck> ();
- if(result)
+ if (result)
{
switch(result->GetTypeId())
{
@@ -598,7 +598,7 @@ void Spell::SelectSpellTargets()
break;
case TYPEID_CORPSE:
m_targets.setCorpseTarget((Corpse*)result);
- if(Player* owner = ObjectAccessor::FindPlayer(((Corpse*)result)->GetOwnerGUID()))
+ if (Player* owner = ObjectAccessor::FindPlayer(((Corpse*)result)->GetOwnerGUID()))
AddUnitTarget(owner, i);
break;
}
@@ -606,7 +606,7 @@ void Spell::SelectSpellTargets()
else
{
// clear cooldown at fail
- if(m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
SendCastResult(SPELL_FAILED_NO_EDIBLE_CORPSES);
finish(false);
@@ -614,7 +614,7 @@ void Spell::SelectSpellTargets()
break;
}
default:
- if(m_targets.getUnitTarget())
+ if (m_targets.getUnitTarget())
AddUnitTarget(m_targets.getUnitTarget(), i);
else
AddUnitTarget(m_caster, i);
@@ -632,30 +632,30 @@ void Spell::SelectSpellTargets()
case SPELL_EFFECT_REPUTATION:
case SPELL_EFFECT_LEARN_SPELL:
case SPELL_EFFECT_SEND_TAXI:
- if(m_targets.getUnitTarget())
+ if (m_targets.getUnitTarget())
AddUnitTarget(m_targets.getUnitTarget(), i);
// Triggered spells have additional spell targets - cast them even if no explicit unit target is given (required for spell 50516 for example)
- else if(m_spellInfo->Effect[i] == SPELL_EFFECT_TRIGGER_SPELL)
+ else if (m_spellInfo->Effect[i] == SPELL_EFFECT_TRIGGER_SPELL)
AddUnitTarget(m_caster, i);
break;
case SPELL_EFFECT_SUMMON_PLAYER:
- if(m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->GetSelection())
+ if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->GetSelection())
{
Player* target = objmgr.GetPlayer(m_caster->ToPlayer()->GetSelection());
- if(target)
+ if (target)
AddUnitTarget(target, i);
}
break;
case SPELL_EFFECT_RESURRECT_NEW:
- if(m_targets.getUnitTarget())
+ if (m_targets.getUnitTarget())
AddUnitTarget(m_targets.getUnitTarget(), i);
- if(m_targets.getCorpseTargetGUID())
+ if (m_targets.getCorpseTargetGUID())
{
Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID());
- if(corpse)
+ if (corpse)
{
Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID());
- if(owner)
+ if (owner)
AddUnitTarget(owner, i);
}
}
@@ -670,7 +670,7 @@ void Spell::SelectSpellTargets()
AddUnitTarget(m_caster, i);
break;
case SPELL_EFFECT_LEARN_PET_SPELL:
- if(Guardian* pet = m_caster->GetGuardianPet())
+ if (Guardian* pet = m_caster->GetGuardianPet())
AddUnitTarget(pet, i);
break;
/*case SPELL_EFFECT_ENCHANT_ITEM:
@@ -679,7 +679,7 @@ void Spell::SelectSpellTargets()
case SPELL_EFFECT_DISENCHANT:
case SPELL_EFFECT_PROSPECTING:
case SPELL_EFFECT_MILLING:
- if(m_targets.getItemTarget())
+ if (m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i);
break;*/
case SPELL_EFFECT_APPLY_AURA:
@@ -695,21 +695,21 @@ void Spell::SelectSpellTargets()
break;
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
// AreaAura
- if(m_spellInfo->Attributes == 0x9050000 || m_spellInfo->Attributes == 0x10000)
+ if (m_spellInfo->Attributes == 0x9050000 || m_spellInfo->Attributes == 0x10000)
SelectEffectTargets(i, TARGET_UNIT_PARTY_TARGET);
break;
case SPELL_EFFECT_SKIN_PLAYER_CORPSE:
- if(m_targets.getUnitTarget())
+ if (m_targets.getUnitTarget())
{
AddUnitTarget(m_targets.getUnitTarget(), i);
}
else if (m_targets.getCorpseTargetGUID())
{
Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster,m_targets.getCorpseTargetGUID());
- if(corpse)
+ if (corpse)
{
Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID());
- if(owner)
+ if (owner)
AddUnitTarget(owner, i);
}
}
@@ -719,12 +719,12 @@ void Spell::SelectSpellTargets()
break;
}
}
- if(IsChanneledSpell(m_spellInfo))
+ if (IsChanneledSpell(m_spellInfo))
{
uint8 mask = (1<<i);
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
- if(ihit->effectMask & mask)
+ if (ihit->effectMask & mask)
{
m_needAliveTargetMask |= mask;
break;
@@ -737,7 +737,7 @@ void Spell::SelectSpellTargets()
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end();)
{
// remove targets which did not pass min level check
- if(m_auraScaleMask && ihit->effectMask == m_auraScaleMask)
+ if (m_auraScaleMask && ihit->effectMask == m_auraScaleMask)
{
// Do not check for selfcast
if (!ihit->scaleAura && ihit->targetGUID != m_caster->GetGUID())
@@ -756,15 +756,15 @@ void Spell::SelectSpellTargets()
}
}
- if(m_targets.HasDst())
+ if (m_targets.HasDst())
{
- if(m_targets.HasTraj())
+ if (m_targets.HasTraj())
{
float speed = m_targets.GetSpeedXY();
- if(speed > 0.0f)
+ if (speed > 0.0f)
m_delayMoment = (uint64)floor(m_targets.GetDist2d() / speed * 1000.0f);
}
- else if(m_spellInfo->speed > 0.0f)
+ else if (m_spellInfo->speed > 0.0f)
{
float dist = m_caster->GetDistance(m_targets.m_dstPos);
m_delayMoment = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);
@@ -905,7 +905,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
if (m_originalCaster)
{
target.missCondition = m_originalCaster->SpellHitResult(pVictim, m_spellInfo, m_canReflect);
- if(m_skipCheck && target.missCondition != SPELL_MISS_IMMUNE)
+ if (m_skipCheck && target.missCondition != SPELL_MISS_IMMUNE)
target.missCondition = SPELL_MISS_NONE;
}
else
@@ -956,7 +956,7 @@ void Spell::AddUnitTarget(uint64 unitGUID, uint32 effIndex)
void Spell::AddGOTarget(GameObject* pVictim, uint32 effIndex)
{
- if( m_spellInfo->Effect[effIndex] == 0 )
+ if ( m_spellInfo->Effect[effIndex] == 0 )
return;
uint64 targetGUID = pVictim->GetGUID();
@@ -1004,7 +1004,7 @@ void Spell::AddGOTarget(uint64 goGUID, uint32 effIndex)
void Spell::AddItemTarget(Item* pitem, uint32 effIndex)
{
- if( m_spellInfo->Effect[effIndex] == 0 )
+ if ( m_spellInfo->Effect[effIndex] == 0 )
return;
// Lookup target in already in list
@@ -1039,7 +1039,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
if (!unit)
return;
- if(unit->isAlive() != target->alive)
+ if (unit->isAlive() != target->alive)
return;
// Get original caster (if exist) and calculate damage/healing from him data
@@ -1078,17 +1078,17 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
if (target->reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him
{
spellHitTarget = m_caster;
- if(m_caster->GetTypeId() == TYPEID_UNIT)
+ if (m_caster->GetTypeId() == TYPEID_UNIT)
m_caster->ToCreature()->LowerPlayerDamageReq(target->damage);
}
}
- if(spellHitTarget)
+ if (spellHitTarget)
{
SpellMissInfo missInfo = DoSpellHitOnUnit(spellHitTarget, mask, target->scaleAura);
- if(missInfo != SPELL_MISS_NONE)
+ if (missInfo != SPELL_MISS_NONE)
{
- if(missInfo != SPELL_MISS_MISS)
+ if (missInfo != SPELL_MISS_MISS)
m_caster->SendSpellMiss(unit, m_spellInfo->Id, missInfo);
m_damage = 0;
spellHitTarget = NULL;
@@ -1185,7 +1185,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT)
{
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo, m_triggeredByAuraSpell);
- if(caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET) == 0 &&
+ if (caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET) == 0 &&
(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED))
caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx);
}
@@ -1193,7 +1193,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
caster->DealSpellDamage(&damageInfo, true);
// Haunt
- if(m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[1] & 0x40000 && m_spellAura && m_spellAura->GetEffect(1))
+ if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[1] & 0x40000 && m_spellAura && m_spellAura->GetEffect(1))
{
AuraEffect * aurEff = m_spellAura->GetEffect(1);
aurEff->SetAmount(aurEff->GetAmount() * damageInfo.damage / 100);
@@ -1220,38 +1220,38 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
}
}
- if(m_caster && !m_caster->IsFriendlyTo(unit) && !IsPositiveSpell(m_spellInfo->Id))
+ if (m_caster && !m_caster->IsFriendlyTo(unit) && !IsPositiveSpell(m_spellInfo->Id))
{
m_caster->CombatStart(unit, !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO));
- if(m_customAttr & SPELL_ATTR_CU_AURA_CC)
- if(!unit->IsStandState())
+ if (m_customAttr & SPELL_ATTR_CU_AURA_CC)
+ if (!unit->IsStandState())
unit->SetStandState(UNIT_STAND_STATE_STAND);
}
- if(spellHitTarget)
+ if (spellHitTarget)
{
//AI functions
- if(spellHitTarget->GetTypeId() == TYPEID_UNIT)
+ if (spellHitTarget->GetTypeId() == TYPEID_UNIT)
{
- if(spellHitTarget->ToCreature()->IsAIEnabled)
+ if (spellHitTarget->ToCreature()->IsAIEnabled)
spellHitTarget->ToCreature()->AI()->SpellHit(m_caster, m_spellInfo);
// cast at creature (or GO) quest objectives update at successful cast finished (+channel finished)
// ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm... )
- if(m_originalCaster && m_originalCaster->IsControlledByPlayer() && !spellHitTarget->ToCreature()->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive())
- if(Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself())
+ if (m_originalCaster && m_originalCaster->IsControlledByPlayer() && !spellHitTarget->ToCreature()->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive())
+ if (Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself())
p->CastedCreatureOrGO(spellHitTarget->GetEntry(),spellHitTarget->GetGUID(),m_spellInfo->Id);
}
- if(m_caster && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsAIEnabled)
+ if (m_caster && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsAIEnabled)
m_caster->ToCreature()->AI()->SpellHitTarget(spellHitTarget, m_spellInfo);
// Needs to be called after dealing damage/healing to not remove breaking on damage auras
DoTriggersOnSpellHit(spellHitTarget);
// if target is fallged for pvp also flag caster if a player
- if(unit->IsPvP())
+ if (unit->IsPvP())
{
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->UpdatePvP(true);
@@ -1262,11 +1262,11 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool scaleAura)
{
- if(!unit || !effectMask)
+ if (!unit || !effectMask)
return SPELL_MISS_EVADE;
// Recheck immune (only for delayed spells)
- if(m_spellInfo->speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo)))
+ if (m_spellInfo->speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo)))
return SPELL_MISS_IMMUNE;
if (unit->GetTypeId() == TYPEID_PLAYER)
@@ -1275,12 +1275,12 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
unit->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, m_spellInfo->Id);
}
- if(m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
m_caster->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, m_spellInfo->Id, 0, unit);
}
- if( m_caster != unit )
+ if ( m_caster != unit )
{
// Recheck UNIT_FLAG_NON_ATTACKABLE for delayed spells
if (m_spellInfo->speed > 0.0f &&
@@ -1290,12 +1290,12 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
return SPELL_MISS_EVADE;
}
- if( !m_caster->IsFriendlyTo(unit) )
+ if ( !m_caster->IsFriendlyTo(unit) )
{
// reset damage to 0 if target has Invisibility and isn't visible for caster
// I do not think this is a correct way to fix it. Sanctuary effect should make all delayed spells invalid
// for delayed spells ignore not visible explicit target
- if(m_spellInfo->speed > 0.0f && unit == m_targets.getUnitTarget()
+ if (m_spellInfo->speed > 0.0f && unit == m_targets.getUnitTarget()
&& (unit->m_invisibilityMask || m_caster->m_invisibilityMask)
&& !m_caster->canSeeOrDetect(unit, true))
{
@@ -1306,26 +1306,26 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL);
//TODO: This is a hack. But we do not know what types of stealth should be interrupted by CC
- if((m_customAttr & SPELL_ATTR_CU_AURA_CC) && unit->IsControlledByPlayer())
+ if ((m_customAttr & SPELL_ATTR_CU_AURA_CC) && unit->IsControlledByPlayer())
unit->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
}
else
{
// for delayed spells ignore negative spells (after duel end) for friendly targets
// TODO: this cause soul transfer bugged
- if(m_spellInfo->speed > 0.0f && unit->GetTypeId() == TYPEID_PLAYER && !IsPositiveSpell(m_spellInfo->Id))
+ if (m_spellInfo->speed > 0.0f && unit->GetTypeId() == TYPEID_PLAYER && !IsPositiveSpell(m_spellInfo->Id))
{
return SPELL_MISS_EVADE;
}
// assisting case, healing and resurrection
- if(unit->hasUnitState(UNIT_STAT_ATTACK_PLAYER))
+ if (unit->hasUnitState(UNIT_STAT_ATTACK_PLAYER))
{
m_caster->SetContestedPvP();
- if(m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->UpdatePvP(true);
}
- if( unit->isInCombat() && !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO) )
+ if ( unit->isInCombat() && !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO) )
{
m_caster->SetInCombatState(unit->GetCombatTimer() > 0, unit);
unit->getHostileRefManager().threatAssist(m_caster, 0.0f);
@@ -1334,12 +1334,12 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
}
// Get Data Needed for Diminishing Returns, some effects may have multiple auras, so this must be done on spell hit, not aura add
- if(m_diminishGroup = GetDiminishingReturnsGroupForSpell(m_spellInfo,m_triggeredByAuraSpell))
+ if (m_diminishGroup = GetDiminishingReturnsGroupForSpell(m_spellInfo,m_triggeredByAuraSpell))
{
m_diminishLevel = unit->GetDiminishing(m_diminishGroup);
DiminishingReturnsType type = GetDiminishingReturnsGroupType(m_diminishGroup);
// Increase Diminishing on unit, current informations for actually casts will use values above
- if((type == DRTYPE_PLAYER && (unit->GetTypeId() == TYPEID_PLAYER || unit->ToCreature()->isPet() || unit->ToCreature()->isPossessedByPlayer())) || type == DRTYPE_ALL)
+ if ((type == DRTYPE_PLAYER && (unit->GetTypeId() == TYPEID_PLAYER || unit->ToCreature()->isPet() || unit->ToCreature()->isPossessedByPlayer())) || type == DRTYPE_ALL)
unit->IncrDiminishing(m_diminishGroup);
}
@@ -1369,7 +1369,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
}
}
- if(m_originalCaster)
+ if (m_originalCaster)
{
if (m_spellAura = Aura::TryCreate(aurSpellInfo, effectMask, unit,
m_originalCaster,(aurSpellInfo == m_spellInfo)? &m_currentBasePoints[0] : &basePoints[0], m_CastItem))
@@ -1391,7 +1391,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
if (IsChanneledSpell(m_spellInfo))
m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this);
- if(duration != m_spellAura->GetMaxDuration())
+ if (duration != m_spellAura->GetMaxDuration())
{
m_spellAura->SetMaxDuration(duration);
m_spellAura->SetDuration(duration);
@@ -1442,7 +1442,7 @@ void Spell::DoTriggersOnSpellHit(Unit *unit)
{
// SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration
// set duration equal to triggering spell
- if(roll_chance_i(i->second))
+ if (roll_chance_i(i->second))
{
m_caster->CastSpell(unit, i->first, true);
sLog.outDebug("Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->first->Id);
@@ -1463,11 +1463,11 @@ void Spell::DoTriggersOnSpellHit(Unit *unit)
}
}
- if(m_customAttr & SPELL_ATTR_CU_LINK_HIT)
+ if (m_customAttr & SPELL_ATTR_CU_LINK_HIT)
{
- if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id + SPELL_LINK_HIT))
+ if (const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id + SPELL_LINK_HIT))
for (std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
- if(*i < 0)
+ if (*i < 0)
unit->RemoveAurasDueToSpell(-(*i));
else
unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID());
@@ -1481,11 +1481,11 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target)
target->processed = true; // Target checked in apply effects procedure
uint32 effectMask = target->effectMask;
- if(!effectMask)
+ if (!effectMask)
return;
GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID);
- if(!go)
+ if (!go)
return;
for (uint32 effectNumber = 0; effectNumber < 3; ++effectNumber)
@@ -1494,7 +1494,7 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target)
// cast at creature (or GO) quest objectives update at successful cast finished (+channel finished)
// ignore autorepeat/melee casts for speed (not exist quest for spells (hm... )
- if(m_originalCaster && m_originalCaster->IsControlledByPlayer() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() )
+ if (m_originalCaster && m_originalCaster->IsControlledByPlayer() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() )
{
if ( Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself() )
p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id);
@@ -1504,7 +1504,7 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target)
void Spell::DoAllEffectOnTarget(ItemTargetInfo *target)
{
uint32 effectMask = target->effectMask;
- if(!target->item || !effectMask)
+ if (!target->item || !effectMask)
return;
for (uint32 effectNumber = 0; effectNumber < 3; ++effectNumber)
@@ -1527,16 +1527,16 @@ bool Spell::UpdateChanneledTargetList()
needAuraMask &= needAliveTargetMask;
float range;
- if(needAuraMask)
+ if (needAuraMask)
{
range = GetSpellMaxRange(m_spellInfo, IsPositiveSpell(m_spellInfo->Id));
- if(Player * modOwner = m_caster->GetSpellModOwner())
+ if (Player * modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
}
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
- if( ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask) )
+ if ( ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask) )
{
Unit *unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
@@ -1544,7 +1544,7 @@ bool Spell::UpdateChanneledTargetList()
{
if (needAuraMask & ihit->effectMask)
{
- if(AuraApplication * aurApp = unit->GetAuraApplication(m_spellInfo->Id, m_originalCasterGUID))
+ if (AuraApplication * aurApp = unit->GetAuraApplication(m_spellInfo->Id, m_originalCasterGUID))
{
if (m_caster != unit && !m_caster->IsWithinDistInMap(unit,range))
{
@@ -1600,7 +1600,7 @@ struct ChainHealingOrder : public std::binary_function<const Unit*, const Unit*,
void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, float max_range, uint32 num, SpellTargets TargetType)
{
Unit *cur = m_targets.getUnitTarget();
- if(!cur)
+ if (!cur)
return;
// Get spell max affected targets
@@ -1614,15 +1614,15 @@ void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, float max_range, uin
}*/
//FIXME: This very like horrible hack and wrong for most spells
- if(m_spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MELEE)
+ if (m_spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MELEE)
max_range += num * CHAIN_SPELL_JUMP_RADIUS;
std::list<Unit*> tempUnitMap;
- if(TargetType == SPELL_TARGETS_CHAINHEAL)
+ if (TargetType == SPELL_TARGETS_CHAINHEAL)
{
SearchAreaTarget(tempUnitMap, max_range, PUSH_CHAIN, SPELL_TARGETS_ALLY);
tempUnitMap.sort(ChainHealingOrder(m_caster));
- //if(cur->GetHealth() == cur->GetMaxHealth() && tempUnitMap.size())
+ //if (cur->GetHealth() == cur->GetMaxHealth() && tempUnitMap.size())
// cur = tempUnitMap.front();
}
else
@@ -1634,19 +1634,19 @@ void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, float max_range, uin
TagUnitMap.push_back(cur);
--num;
- if(tempUnitMap.empty())
+ if (tempUnitMap.empty())
break;
std::list<Unit*>::iterator next;
- if(TargetType == SPELL_TARGETS_CHAINHEAL)
+ if (TargetType == SPELL_TARGETS_CHAINHEAL)
{
next = tempUnitMap.begin();
while (cur->GetDistance(*next) > CHAIN_SPELL_JUMP_RADIUS
|| !cur->IsWithinLOSInMap(*next))
{
++next;
- if(next == tempUnitMap.end())
+ if (next == tempUnitMap.end())
return;
}
}
@@ -1655,7 +1655,7 @@ void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, float max_range, uin
tempUnitMap.sort(TargetDistanceOrder(cur));
next = tempUnitMap.begin();
- if(cur->GetDistance(*next) > CHAIN_SPELL_JUMP_RADIUS)
+ if (cur->GetDistance(*next) > CHAIN_SPELL_JUMP_RADIUS)
break;
while (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE
&& !m_caster->isInFrontInMap(*next, max_range)
@@ -1663,7 +1663,7 @@ void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, float max_range, uin
|| !cur->IsWithinLOSInMap(*next))
{
++next;
- if(next == tempUnitMap.end() || cur->GetDistance(*next) > CHAIN_SPELL_JUMP_RADIUS)
+ if (next == tempUnitMap.end() || cur->GetDistance(*next) > CHAIN_SPELL_JUMP_RADIUS)
return;
}
}
@@ -1689,7 +1689,7 @@ void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, SpellNo
case PUSH_CHAIN:
{
Unit *target = m_targets.getUnitTarget();
- if(!target)
+ if (!target)
{
sLog.outError( "SPELL: cannot find unit target for spell ID %u\n", m_spellInfo->Id );
return;
@@ -1703,13 +1703,13 @@ void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, SpellNo
}
Trinity::SpellNotifierCreatureAndPlayer notifier(m_caster, TagUnitMap, radius, type, TargetType, pos, entry);
- if((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_PLAYERS_ONLY)
+ if ((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_PLAYERS_ONLY)
|| TargetType == SPELL_TARGETS_ENTRY && !entry)
m_caster->GetMap()->VisitWorld(pos->m_positionX, pos->m_positionY, radius, notifier);
else
m_caster->GetMap()->VisitAll(pos->m_positionX, pos->m_positionY, radius, notifier);
- if(m_customAttr & SPELL_ATTR_CU_EXCLUDE_SELF)
+ if (m_customAttr & SPELL_ATTR_CU_EXCLUDE_SELF)
TagUnitMap.remove(m_caster);
}
@@ -1720,10 +1720,10 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType)
case SPELL_TARGETS_ENTRY:
{
SpellScriptTargetBounds bounds = spellmgr.GetSpellScriptTargetBounds(m_spellInfo->Id);
- if(bounds.first==bounds.second)
+ if (bounds.first==bounds.second)
{
sLog.outDebug("Spell (ID: %u) (caster Entry: %u) does not have record in `spell_script_target`", m_spellInfo->Id, m_caster->GetEntry());
- if(IsPositiveSpell(m_spellInfo->Id))
+ if (IsPositiveSpell(m_spellInfo->Id))
return SearchNearbyTarget(range, SPELL_TARGETS_ALLY);
else
return SearchNearbyTarget(range, SPELL_TARGETS_ENEMY);
@@ -1746,9 +1746,9 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType)
}
break;
case SPELL_TARGET_TYPE_GAMEOBJECT:
- if(i_spellST->second.targetEntry)
+ if (i_spellST->second.targetEntry)
{
- if(GameObject *go = m_caster->FindNearestGameObject(i_spellST->second.targetEntry, range))
+ if (GameObject *go = m_caster->FindNearestGameObject(i_spellST->second.targetEntry, range))
{
// remember found target and range, next attempt will find more near target with another entry
goScriptTarget = go;
@@ -1756,10 +1756,10 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType)
range = m_caster->GetDistance(goScriptTarget);
}
}
- else if( focusObject ) //Focus Object
+ else if ( focusObject ) //Focus Object
{
float frange = m_caster->GetDistance(focusObject);
- if(range >= frange)
+ if (range >= frange)
{
creatureScriptTarget = NULL;
goScriptTarget = focusObject;
@@ -1768,11 +1768,11 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType)
}
break;
case SPELL_TARGET_TYPE_CREATURE:
- if(m_targets.getUnitTarget() && m_targets.getUnitTarget()->GetEntry() == i_spellST->second.targetEntry)
+ if (m_targets.getUnitTarget() && m_targets.getUnitTarget()->GetEntry() == i_spellST->second.targetEntry)
return m_targets.getUnitTarget();
case SPELL_TARGET_TYPE_DEAD:
default:
- if(Creature *cre = m_caster->FindNearestCreature(i_spellST->second.targetEntry, range, i_spellST->second.type != SPELL_TARGET_TYPE_DEAD))
+ if (Creature *cre = m_caster->FindNearestCreature(i_spellST->second.targetEntry, range, i_spellST->second.type != SPELL_TARGET_TYPE_DEAD))
{
creatureScriptTarget = cre;
goScriptTarget = NULL;
@@ -1782,7 +1782,7 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType)
}
}
- if(creatureScriptTarget)
+ if (creatureScriptTarget)
return creatureScriptTarget;
else
return goScriptTarget;
@@ -1811,7 +1811,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
{
SpellNotifyPushType pushType = PUSH_NONE;
Player *modOwner = NULL;
- if(m_originalCaster)
+ if (m_originalCaster)
modOwner = m_originalCaster->GetSpellModOwner();
switch(SpellTargetType[cur])
@@ -1835,11 +1835,11 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
break;
}
case TARGET_UNIT_MASTER:
- if(Unit* owner = m_caster->GetCharmerOrOwner())
+ if (Unit* owner = m_caster->GetCharmerOrOwner())
AddUnitTarget(owner, i);
break;
case TARGET_UNIT_PET:
- if(Guardian* pet = m_caster->GetGuardianPet())
+ if (Guardian* pet = m_caster->GetGuardianPet())
AddUnitTarget(pet, i);
break;
case TARGET_UNIT_PARTY_CASTER:
@@ -1847,7 +1847,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
pushType = PUSH_CASTER_CENTER;
break;
case TARGET_UNIT_VEHICLE:
- if(Unit *vehicle = m_caster->GetVehicleBase())
+ if (Unit *vehicle = m_caster->GetVehicleBase())
AddUnitTarget(vehicle, i);
break;
case TARGET_UNIT_PASSENGER_0:
@@ -1858,8 +1858,8 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
case TARGET_UNIT_PASSENGER_5:
case TARGET_UNIT_PASSENGER_6:
case TARGET_UNIT_PASSENGER_7:
- if(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsVehicle())
- if(Unit *unit = m_caster->GetVehicleKit()->GetPassenger(cur - TARGET_UNIT_PASSENGER_0))
+ if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsVehicle())
+ if (Unit *unit = m_caster->GetVehicleKit()->GetPassenger(cur - TARGET_UNIT_PASSENGER_0))
AddUnitTarget(unit, i);
break;
}
@@ -1869,7 +1869,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
case TARGET_TYPE_UNIT_TARGET:
{
Unit *target = m_targets.getUnitTarget();
- if(!target)
+ if (!target)
{
sLog.outError("SPELL: no unit target for spell ID %u", m_spellInfo->Id);
break;
@@ -1878,15 +1878,15 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
switch(cur)
{
case TARGET_UNIT_TARGET_ENEMY:
- if(Unit *magnet = m_caster->SelectMagnetTarget(target, m_spellInfo))
- if(magnet != target)
+ if (Unit *magnet = m_caster->SelectMagnetTarget(target, m_spellInfo))
+ if (magnet != target)
m_targets.setUnitTarget(magnet);
pushType = PUSH_CHAIN;
break;
case TARGET_UNIT_TARGET_ANY:
- if(!IsPositiveSpell(m_spellInfo->Id))
- if(Unit *magnet = m_caster->SelectMagnetTarget(target, m_spellInfo))
- if(magnet != target)
+ if (!IsPositiveSpell(m_spellInfo->Id))
+ if (Unit *magnet = m_caster->SelectMagnetTarget(target, m_spellInfo))
+ if (magnet != target)
m_targets.setUnitTarget(magnet);
pushType = PUSH_CHAIN;
break;
@@ -1917,33 +1917,33 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
{
case TARGET_UNIT_NEARBY_ENEMY:
range = GetSpellMaxRange(m_spellInfo, false);
- if(modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
+ if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
target = SearchNearbyTarget(range, SPELL_TARGETS_ENEMY);
break;
case TARGET_UNIT_NEARBY_ALLY:
case TARGET_UNIT_NEARBY_ALLY_UNK:
case TARGET_UNIT_NEARBY_RAID:
range = GetSpellMaxRange(m_spellInfo, true);
- if(modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
+ if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
target = SearchNearbyTarget(range, SPELL_TARGETS_ALLY);
break;
case TARGET_UNIT_NEARBY_ENTRY:
case TARGET_GAMEOBJECT_NEARBY_ENTRY:
range = GetSpellMaxRange(m_spellInfo, IsPositiveSpell(m_spellInfo->Id));
- if(modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
+ if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
target = SearchNearbyTarget(range, SPELL_TARGETS_ENTRY);
break;
}
- if(!target)
+ if (!target)
return;
- else if(target->GetTypeId() == TYPEID_GAMEOBJECT)
+ else if (target->GetTypeId() == TYPEID_GAMEOBJECT)
AddGOTarget((GameObject*)target, i);
else
{
pushType = PUSH_CHAIN;
- if(m_targets.getUnitTarget() != target)
+ if (m_targets.getUnitTarget() != target)
m_targets.setUnitTarget((Unit*)target);
}
@@ -1959,9 +1959,9 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
break;
case TARGET_TYPE_AREA_CONE:
- if(m_customAttr & SPELL_ATTR_CU_CONE_BACK)
+ if (m_customAttr & SPELL_ATTR_CU_CONE_BACK)
pushType = PUSH_IN_BACK;
- else if(m_customAttr & SPELL_ATTR_CU_CONE_LINE)
+ else if (m_customAttr & SPELL_ATTR_CU_CONE_LINE)
pushType = PUSH_IN_LINE;
else
pushType = PUSH_IN_FRONT;
@@ -1984,9 +1984,9 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
float objSize = m_caster->GetObjectSize();
dist = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
- if(dist < objSize)
+ if (dist < objSize)
dist = objSize;
- else if(cur == TARGET_DEST_CASTER_RANDOM)
+ else if (cur == TARGET_DEST_CASTER_RANDOM)
dist = objSize + (dist - objSize) * rand_norm();
switch(cur)
@@ -2014,13 +2014,13 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
case TARGET_TYPE_DEST_TARGET: //2+8+2
{
Unit *target = m_targets.getUnitTarget();
- if(!target)
+ if (!target)
{
sLog.outError("SPELL: no unit target for spell ID %u\n", m_spellInfo->Id);
break;
}
- if(cur == TARGET_DST_TARGET_ENEMY || cur == TARGET_DEST_TARGET_ANY)
+ if (cur == TARGET_DST_TARGET_ENEMY || cur == TARGET_DEST_TARGET_ANY)
{
m_targets.setDst(target);
AddUnitTarget(target, i);
@@ -2031,9 +2031,9 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
float objSize = target->GetObjectSize();
dist = target->GetSpellRadiusForTarget(target, sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
- if(dist < objSize)
+ if (dist < objSize)
dist = objSize;
- else if(cur == TARGET_DEST_CASTER_RANDOM)
+ else if (cur == TARGET_DEST_CASTER_RANDOM)
dist = objSize + (dist - objSize) * rand_norm();
switch(cur)
@@ -2060,7 +2060,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
case TARGET_TYPE_DEST_DEST: //5+8+1
{
- if(!m_targets.HasDst())
+ if (!m_targets.HasDst())
{
sLog.outError("SPELL: no destination for spell ID %u\n", m_spellInfo->Id);
break;
@@ -2103,35 +2103,35 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
switch(cur)
{
case TARGET_DST_DB:
- if(SpellTargetPosition const* st = spellmgr.GetSpellTargetPosition(m_spellInfo->Id))
+ if (SpellTargetPosition const* st = spellmgr.GetSpellTargetPosition(m_spellInfo->Id))
{
//TODO: fix this check
- if(m_spellInfo->Effect[0] == SPELL_EFFECT_TELEPORT_UNITS
+ if (m_spellInfo->Effect[0] == SPELL_EFFECT_TELEPORT_UNITS
|| m_spellInfo->Effect[1] == SPELL_EFFECT_TELEPORT_UNITS
|| m_spellInfo->Effect[2] == SPELL_EFFECT_TELEPORT_UNITS)
m_targets.setDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation, (int32)st->target_mapId);
- else if(st->target_mapId == m_caster->GetMapId())
+ else if (st->target_mapId == m_caster->GetMapId())
m_targets.setDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation);
}
else
{
sLog.outDebug( "SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id );
Unit *target = NULL;
- if(uint64 guid = m_caster->GetUInt64Value(UNIT_FIELD_TARGET))
+ if (uint64 guid = m_caster->GetUInt64Value(UNIT_FIELD_TARGET))
target = ObjectAccessor::GetUnit(*m_caster, guid);
m_targets.setDst(target ? target : m_caster);
}
break;
case TARGET_DST_HOME:
- if(m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_targets.setDst(m_caster->ToPlayer()->m_homebindX,m_caster->ToPlayer()->m_homebindY,m_caster->ToPlayer()->m_homebindZ, m_caster->ToPlayer()->GetOrientation(), m_caster->ToPlayer()->m_homebindMapId);
break;
case TARGET_DST_NEARBY_ENTRY:
{
float range = GetSpellMaxRange(m_spellInfo, IsPositiveSpell(m_spellInfo->Id));
- if(modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
+ if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
- if(WorldObject *target = SearchNearbyTarget(range, SPELL_TARGETS_ENTRY))
+ if (WorldObject *target = SearchNearbyTarget(range, SPELL_TARGETS_ENTRY))
m_targets.setDst(target);
break;
}
@@ -2173,7 +2173,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
switch (cur)
{
case TARGET_GAMEOBJECT:
- if(m_targets.getGOTarget())
+ if (m_targets.getGOTarget())
AddGOTarget(m_targets.getGOTarget(), i);
break;
case TARGET_GAMEOBJECT_ITEM:
@@ -2246,7 +2246,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
else if (pushType)
{
// Dummy, just for client
- if(EffectTargetType[m_spellInfo->Effect[i]] != SPELL_REQUIRE_UNIT)
+ if (EffectTargetType[m_spellInfo->Effect[i]] != SPELL_REQUIRE_UNIT)
return;
float radius;
@@ -2279,15 +2279,15 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
break;
}
- if(modOwner)
+ if (modOwner)
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius, this);
radius *= m_spellValue->RadiusMod;
std::list<Unit*> unitList;
- if(targetType == SPELL_TARGETS_ENTRY)
+ if (targetType == SPELL_TARGETS_ENTRY)
{
SpellScriptTargetBounds bounds = spellmgr.GetSpellScriptTargetBounds(m_spellInfo->Id);
- if(bounds.first == bounds.second)
+ if (bounds.first == bounds.second)
{
// Custom entries
// TODO: move these to sql
@@ -2347,9 +2347,9 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
default:
sLog.outDebug("Spell (ID: %u) (caster Entry: %u) does not have record in `spell_script_target`", m_spellInfo->Id, m_caster->GetEntry());
- if(m_spellInfo->Effect[i] == SPELL_EFFECT_TELEPORT_UNITS)
+ if (m_spellInfo->Effect[i] == SPELL_EFFECT_TELEPORT_UNITS)
SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENTRY, 0);
- else if(IsPositiveEffect(m_spellInfo->Id, i))
+ else if (IsPositiveEffect(m_spellInfo->Id, i))
SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ALLY);
else
SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENEMY);
@@ -2360,7 +2360,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
{
for (SpellScriptTarget::const_iterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST)
{
- if(i_spellST->second.type == SPELL_TARGET_TYPE_CREATURE)
+ if (i_spellST->second.type == SPELL_TARGET_TYPE_CREATURE)
SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENTRY, i_spellST->second.targetEntry);
else if (i_spellST->second.type == SPELL_TARGET_TYPE_CONTROLLED)
{
@@ -2386,16 +2386,16 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
case TARGET_OBJECT_AREA_DST:
{
float x, y, z;
- if(cur == TARGET_OBJECT_AREA_SRC)
+ if (cur == TARGET_OBJECT_AREA_SRC)
{
- if(m_targets.HasSrc())
+ if (m_targets.HasSrc())
m_targets.m_srcPos.GetPosition(x, y, z);
else
break;
}
else
{
- if(m_targets.HasDst())
+ if (m_targets.HasDst())
m_targets.m_dstPos.GetPosition(x, y, z);
else
break;
@@ -2424,14 +2424,14 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
? (Player*)m_targets.getUnitTarget() : NULL;
Group* pGroup = targetPlayer ? targetPlayer->GetGroup() : NULL;
- if(pGroup)
+ if (pGroup)
{
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* Target = itr->getSource();
// IsHostileTo check duel and controlled by enemy
- if( Target && targetPlayer->IsWithinDistInMap(Target, radius) &&
+ if ( Target && targetPlayer->IsWithinDistInMap(Target, radius) &&
targetPlayer->getClass() == Target->getClass() &&
!m_caster->IsHostileTo(Target) )
{
@@ -2439,23 +2439,23 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
}
}
}
- else if(m_targets.getUnitTarget())
+ else if (m_targets.getUnitTarget())
AddUnitTarget(m_targets.getUnitTarget(), i);
break;
}
}
}
- if(!unitList.empty())
+ if (!unitList.empty())
{
- if(uint32 maxTargets = m_spellValue->MaxAffectedTargets)
+ if (uint32 maxTargets = m_spellValue->MaxAffectedTargets)
{
Unit::AuraEffectList const& Auras = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_MAX_AFFECTED_TARGETS);
for (Unit::AuraEffectList::const_iterator j = Auras.begin(); j != Auras.end(); ++j)
- if((*j)->IsAffectedOnSpell(m_spellInfo))
+ if ((*j)->IsAffectedOnSpell(m_spellInfo))
maxTargets += (*j)->GetAmount();
- if(m_spellInfo->Id == 5246) //Intimidating Shout
+ if (m_spellInfo->Id == 5246) //Intimidating Shout
unitList.remove(m_targets.getUnitTarget());
Trinity::RandomResizeList(unitList, m_spellValue->MaxAffectedTargets);
}
@@ -2586,7 +2586,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
if (!m_targets.getUnitTargetGUID() && m_spellInfo->Targets & TARGET_FLAG_UNIT)
{
Unit *target = NULL;
- if(m_caster->GetTypeId() == TYPEID_UNIT)
+ if (m_caster->GetTypeId() == TYPEID_UNIT)
target = m_caster->getVictim();
else
target = ObjectAccessor::GetUnit(*m_caster, m_caster->ToPlayer()->GetSelection());
@@ -2609,7 +2609,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
Unit *target = m_targets.getUnitTarget();
if (!target)
{
- if(m_caster->GetTypeId() == TYPEID_UNIT)
+ if (m_caster->GetTypeId() == TYPEID_UNIT)
target = m_caster->getVictim();
else
target = ObjectAccessor::GetUnit(*m_caster, m_caster->ToPlayer()->GetSelection());
@@ -2648,7 +2648,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
m_spellState = SPELL_STATE_PREPARING;
- if(triggeredByAura)
+ if (triggeredByAura)
m_triggeredByAuraSpell = triggeredByAura->GetSpellProto();
// create and add update event for this spell
@@ -2656,16 +2656,16 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
m_caster->m_Events.AddEvent(Event, m_caster->m_Events.CalculateTime(1));
//Prevent casting at cast another spell (ServerSide check)
- if(m_caster->IsNonMeleeSpellCasted(false, true, true) && m_cast_count)
+ if (m_caster->IsNonMeleeSpellCasted(false, true, true) && m_cast_count)
{
SendCastResult(SPELL_FAILED_SPELL_IN_PROGRESS);
finish(false);
return;
}
- if(m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
- if(objmgr.IsPlayerSpellDisabled(m_spellInfo->Id))
+ if (objmgr.IsPlayerSpellDisabled(m_spellInfo->Id))
{
SendCastResult(SPELL_FAILED_SPELL_UNAVAILABLE);
finish(false);
@@ -2674,7 +2674,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
}
else if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet())
{
- if(objmgr.IsPetSpellDisabled(m_spellInfo->Id))
+ if (objmgr.IsPetSpellDisabled(m_spellInfo->Id))
{
SendCastResult(SPELL_FAILED_SPELL_UNAVAILABLE);
finish(false);
@@ -2683,7 +2683,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
}
else
{
- if(objmgr.IsCreatureSpellDisabled(m_spellInfo->Id))
+ if (objmgr.IsCreatureSpellDisabled(m_spellInfo->Id))
{
finish(false);
return;
@@ -2698,9 +2698,9 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
SpellCastResult result = CheckCast(true);
- if(result != SPELL_CAST_OK && !IsAutoRepeat()) //always cast autorepeat dummy for triggering
+ if (result != SPELL_CAST_OK && !IsAutoRepeat()) //always cast autorepeat dummy for triggering
{
- if(triggeredByAura && !triggeredByAura->GetBase()->IsPassive())
+ if (triggeredByAura && !triggeredByAura->GetBase()->IsPassive())
{
SendChannelUpdate(0);
triggeredByAura->GetBase()->SetDuration(0);
@@ -2726,26 +2726,26 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
ReSetTimer();
sLog.outDebug("Spell::prepare: spell id %u source %u caster %d triggered %u mask %u", m_spellInfo->Id, m_caster->GetEntry(), m_originalCaster ? m_originalCaster->GetEntry() : -1, m_IsTriggeredSpell ? 1 : 0, m_targets.getTargetMask());
- //if(m_targets.getUnitTarget())
+ //if (m_targets.getUnitTarget())
// sLog.outError("Spell::prepare: unit target %u", m_targets.getUnitTarget()->GetEntry());
- //if(m_targets.HasDst())
+ //if (m_targets.HasDst())
// sLog.outError("Spell::prepare: pos target %f %f %f", m_targets.m_dstPos.m_positionX, m_targets.m_dstPos.m_positionY, m_targets.m_dstPos.m_positionZ);
//Containers for channeled spells have to be set
//TODO:Apply this to all casted spells if needed
// Why check duration? 29350: channelled triggers channelled
- if(m_IsTriggeredSpell && (!IsChanneledSpell(m_spellInfo) || !GetSpellMaxDuration(m_spellInfo)))
+ if (m_IsTriggeredSpell && (!IsChanneledSpell(m_spellInfo) || !GetSpellMaxDuration(m_spellInfo)))
cast(true);
else
{
// stealth must be removed at cast starting (at show channel bar)
// skip triggered spell (item equip spell casting and other not explicit character casts/item uses)
- if(!m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo) )
+ if (!m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo) )
{
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST);
for (uint32 i = 0; i < 3; ++i)
{
- if(EffectTargetType[m_spellInfo->Effect[i]] == SPELL_REQUIRE_UNIT)
+ if (EffectTargetType[m_spellInfo->Effect[i]] == SPELL_REQUIRE_UNIT)
{
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_SPELL_ATTACK);
break;
@@ -2756,7 +2756,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
m_caster->SetCurrentCastedSpell( this );
SendSpellStart();
- if(!m_casttime && !m_spellInfo->StartRecoveryTime
+ if (!m_casttime && !m_spellInfo->StartRecoveryTime
&& !m_castItemGUID //item: first cast may destroy item and second cast causes crash
&& GetCurrentContainer() == CURRENT_GENERIC_SPELL)
cast(true);
@@ -2765,11 +2765,11 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
void Spell::cancel()
{
- if(m_spellState == SPELL_STATE_FINISHED)
+ if (m_spellState == SPELL_STATE_FINISHED)
return;
SetReferencedFromCurrent(false);
- if(m_selfContainer && *m_selfContainer == this)
+ if (m_selfContainer && *m_selfContainer == this)
*m_selfContainer = NULL;
uint32 oldState = m_spellState;
@@ -2822,10 +2822,10 @@ void Spell::cast(bool skipCheck)
// update pointers base at GUIDs to prevent access to non-existed already object
UpdatePointers();
- if(Unit *target = m_targets.getUnitTarget())
+ if (Unit *target = m_targets.getUnitTarget())
{
// three check: prepare, cast (m_casttime > 0), hit (delayed)
- if(m_casttime && target->isAlive()
+ if (m_casttime && target->isAlive()
&& (target->m_invisibilityMask || m_caster->m_invisibilityMask
|| target->GetVisibility() == VISIBILITY_GROUP_STEALTH)
&& !target->IsFriendlyTo(m_caster) && !m_caster->canSeeOrDetect(target, true))
@@ -2839,7 +2839,7 @@ void Spell::cast(bool skipCheck)
else
{
// cancel at lost main target unit
- if(m_targets.getUnitTargetGUID() && m_targets.getUnitTargetGUID() != m_caster->GetGUID())
+ if (m_targets.getUnitTargetGUID() && m_targets.getUnitTargetGUID() != m_caster->GetGUID())
{
cancel();
return;
@@ -2848,7 +2848,7 @@ void Spell::cast(bool skipCheck)
SetExecutedCurrently(true);
- if(m_caster->GetTypeId() != TYPEID_PLAYER && m_targets.getUnitTarget() && m_targets.getUnitTarget() != m_caster)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER && m_targets.getUnitTarget() && m_targets.getUnitTarget() != m_caster)
m_caster->SetInFront(m_targets.getUnitTarget());
// Should this be done for original caster?
@@ -2860,10 +2860,10 @@ void Spell::cast(bool skipCheck)
}
// triggered cast called from Spell::prepare where it was already checked
- if(!m_IsTriggeredSpell || !skipCheck)
+ if (!m_IsTriggeredSpell || !skipCheck)
{
SpellCastResult castResult = CheckCast(false);
- if(castResult != SPELL_CAST_OK)
+ if (castResult != SPELL_CAST_OK)
{
SendCastResult(castResult);
SendInterrupted(0);
@@ -2884,7 +2884,7 @@ void Spell::cast(bool skipCheck)
SelectSpellTargets();
// Spell may be finished after target map check
- if(m_spellState == SPELL_STATE_FINISHED)
+ if (m_spellState == SPELL_STATE_FINISHED)
{
SendInterrupted(0);
//restore spell mods
@@ -2900,7 +2900,7 @@ void Spell::cast(bool skipCheck)
return;
}
- if(m_spellInfo->SpellFamilyName)
+ if (m_spellInfo->SpellFamilyName)
{
if (m_spellInfo->excludeCasterAuraSpell && !IsPositiveSpell(m_spellInfo->excludeCasterAuraSpell))
m_preCastSpell = m_spellInfo->excludeCasterAuraSpell;
@@ -2935,7 +2935,7 @@ void Spell::cast(bool skipCheck)
m_caster->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, m_spellInfo->Id);
}
- if(!m_IsTriggeredSpell)
+ if (!m_IsTriggeredSpell)
{
// Powers have to be taken before SendSpellGo
TakePower();
@@ -2951,7 +2951,7 @@ void Spell::cast(bool skipCheck)
continue;
SpellEntry const *auraSpellInfo = (*i)->GetSpellProto();
uint32 auraSpellIdx = (*i)->GetEffIndex();
- if(SpellEntry const *spellInfo = sSpellStore.LookupEntry(auraSpellInfo->EffectTriggerSpell[auraSpellIdx]))
+ if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(auraSpellInfo->EffectTriggerSpell[auraSpellIdx]))
{
// Calculate chance at that moment (can be depend for example from combo points)
int32 chance = m_caster->CalculateSpellDamage(auraSpellInfo, auraSpellIdx, (*i)->GetBaseAmount(), NULL);
@@ -2959,7 +2959,7 @@ void Spell::cast(bool skipCheck)
}
}
- if(m_customAttr & SPELL_ATTR_CU_DIRECT_DAMAGE)
+ if (m_customAttr & SPELL_ATTR_CU_DIRECT_DAMAGE)
CalculateDamageDoneForAllTargets();
// CAST SPELL
@@ -2995,7 +2995,7 @@ void Spell::cast(bool skipCheck)
m_spellState = SPELL_STATE_DELAYED;
SetDelayStart(0);
- if(m_caster->hasUnitState(UNIT_STAT_CASTING) && !m_caster->IsNonMeleeSpellCasted(false, false, true))
+ if (m_caster->hasUnitState(UNIT_STAT_CASTING) && !m_caster->IsNonMeleeSpellCasted(false, false, true))
m_caster->clearUnitState(UNIT_STAT_CASTING);
}
else
@@ -3004,11 +3004,11 @@ void Spell::cast(bool skipCheck)
handle_immediate();
}
- if(m_customAttr & SPELL_ATTR_CU_LINK_CAST)
+ if (m_customAttr & SPELL_ATTR_CU_LINK_CAST)
{
- if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id))
+ if (const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id))
for (std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
- if(*i < 0)
+ if (*i < 0)
m_caster->RemoveAurasDueToSpell(-(*i));
else
m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, *i, true);
@@ -3023,7 +3023,7 @@ void Spell::cast(bool skipCheck)
void Spell::handle_immediate()
{
// start channeling if applicable
- if(IsChanneledSpell(m_spellInfo))
+ if (IsChanneledSpell(m_spellInfo))
{
int32 duration = GetSpellDuration(m_spellInfo);
if (duration)
@@ -3031,7 +3031,7 @@ void Spell::handle_immediate()
// Apply haste mods
m_caster->ModSpellCastTime(m_spellInfo, duration, this);
// Apply duration mod
- if(Player* modOwner = m_caster->GetSpellModOwner())
+ if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
m_spellState = SPELL_STATE_CASTING;
m_caster->AddInterruptMask(m_spellInfo->ChannelInterruptFlags);
@@ -3054,7 +3054,7 @@ void Spell::handle_immediate()
// Remove used for cast item if need (it can be already NULL after TakeReagents call
TakeCastItem();
- if(m_spellState != SPELL_STATE_CASTING)
+ if (m_spellState != SPELL_STATE_CASTING)
finish(true); // successfully finish spell cast (not last in case autorepeat or channel spell)
}
@@ -3082,7 +3082,7 @@ uint64 Spell::handle_delayed(uint64 t_offset)
{
if ( single_missile || ihit->timeDelay <= t_offset )
DoAllEffectOnTarget(&(*ihit));
- else if( next_time == 0 || ihit->timeDelay < next_time )
+ else if ( next_time == 0 || ihit->timeDelay < next_time )
next_time = ihit->timeDelay;
}
}
@@ -3094,7 +3094,7 @@ uint64 Spell::handle_delayed(uint64 t_offset)
{
if ( single_missile || ighit->timeDelay <= t_offset )
DoAllEffectOnTarget(&(*ighit));
- else if( next_time == 0 || ighit->timeDelay < next_time )
+ else if ( next_time == 0 || ighit->timeDelay < next_time )
next_time = ighit->timeDelay;
}
}
@@ -3129,18 +3129,18 @@ void Spell::_handle_immediate_phase()
m_needSpellLog = IsNeedSendToClient();
for (uint32 j = 0; j < 3; ++j)
{
- if(m_spellInfo->Effect[j] == 0)
+ if (m_spellInfo->Effect[j] == 0)
continue;
// apply Send Event effect to ground in case empty target lists
- if( m_spellInfo->Effect[j] == SPELL_EFFECT_SEND_EVENT && !HaveTargetsForEffect(j) )
+ if ( m_spellInfo->Effect[j] == SPELL_EFFECT_SEND_EVENT && !HaveTargetsForEffect(j) )
{
HandleEffects(NULL, NULL, NULL, j);
continue;
}
// Don't do spell log, if is school damage spell
- if(m_spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE || m_spellInfo->Effect[j] == 0)
+ if (m_spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE || m_spellInfo->Effect[j] == 0)
m_needSpellLog = false;
}
@@ -3152,20 +3152,20 @@ void Spell::_handle_immediate_phase()
for (std::list<ItemTargetInfo>::iterator ihit= m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit)
DoAllEffectOnTarget(&(*ihit));
- if(!m_originalCaster)
+ if (!m_originalCaster)
return;
uint8 oldEffMask = m_effectMask;
// process ground
for (uint32 j = 0; j < 3; ++j)
{
- if(EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_DEST)
+ if (EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_DEST)
{
- if(!m_targets.HasDst()) // FIXME: this will ignore dest set in effect
+ if (!m_targets.HasDst()) // FIXME: this will ignore dest set in effect
m_targets.setDst(m_caster);
HandleEffects(m_originalCaster, NULL, NULL, j);
m_effectMask |= (1<<j);
}
- else if(EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_NONE)
+ else if (EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_NONE)
{
HandleEffects(m_originalCaster, NULL, NULL, j);
m_effectMask |= (1<<j);
@@ -3207,7 +3207,7 @@ void Spell::_handle_immediate_phase()
void Spell::_handle_finish_phase()
{
- if(m_caster->m_movedPlayer)
+ if (m_caster->m_movedPlayer)
{
// Take for real after all targets are processed
if (m_needComboPoints)
@@ -3219,13 +3219,13 @@ void Spell::_handle_finish_phase()
}
// spell log
- if(m_needSpellLog)
+ if (m_needSpellLog)
SendLogExecute();
}
void Spell::SendSpellCooldown()
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* _player = (Player*)m_caster;
@@ -3239,7 +3239,7 @@ void Spell::SendSpellCooldown()
}
// have infinity cooldown but set at aura apply // do not set cooldown for triggered spells (needed by reincarnation)
- if(m_spellInfo->Attributes & (SPELL_ATTR_DISABLED_WHILE_ACTIVE | SPELL_ATTR_PASSIVE ) || m_IsTriggeredSpell)
+ if (m_spellInfo->Attributes & (SPELL_ATTR_DISABLED_WHILE_ACTIVE | SPELL_ATTR_PASSIVE ) || m_IsTriggeredSpell)
return;
_player->AddSpellAndCategoryCooldowns(m_spellInfo,m_CastItem ? m_CastItem->GetEntry() : 0, this);
@@ -3250,7 +3250,7 @@ void Spell::update(uint32 difftime)
// update pointers based at it's GUIDs
UpdatePointers();
- if(m_targets.getUnitTargetGUID() && !m_targets.getUnitTarget())
+ if (m_targets.getUnitTargetGUID() && !m_targets.getUnitTarget())
{
sLog.outDebug("Spell %u is cancelled due to removal of target.", m_spellInfo->Id);
cancel();
@@ -3263,7 +3263,7 @@ void Spell::update(uint32 difftime)
(m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK || !m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)))
{
// don't cancel for melee, autorepeat, triggered and instant spells
- if(!IsNextMeleeSwingSpell() && !IsAutoRepeat() && !m_IsTriggeredSpell)
+ if (!IsNextMeleeSwingSpell() && !IsAutoRepeat() && !m_IsTriggeredSpell)
cancel();
}
@@ -3271,20 +3271,20 @@ void Spell::update(uint32 difftime)
{
case SPELL_STATE_PREPARING:
{
- if(m_timer)
+ if (m_timer)
{
- if(difftime >= m_timer)
+ if (difftime >= m_timer)
m_timer = 0;
else
m_timer -= difftime;
}
- if(m_timer == 0 && !IsNextMeleeSwingSpell() && !IsAutoRepeat())
+ if (m_timer == 0 && !IsNextMeleeSwingSpell() && !IsAutoRepeat())
cast(m_spellInfo->CastingTimeIndex == 1);
} break;
case SPELL_STATE_CASTING:
{
- if(m_timer > 0)
+ if (m_timer > 0)
{
// check if there are alive targets left
if (!UpdateChanneledTargetList())
@@ -3294,27 +3294,27 @@ void Spell::update(uint32 difftime)
finish();
}
- if(difftime >= m_timer)
+ if (difftime >= m_timer)
m_timer = 0;
else
m_timer -= difftime;
}
- if(m_timer == 0)
+ if (m_timer == 0)
{
SendChannelUpdate(0);
// channeled spell processed independently for quest targeting
// cast at creature (or GO) quest objectives update at successful cast channel finished
// ignore autorepeat/melee casts for speed (not exist quest for spells (hm... )
- if( !IsAutoRepeat() && !IsNextMeleeSwingSpell() )
+ if ( !IsAutoRepeat() && !IsNextMeleeSwingSpell() )
{
if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() )
{
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
TargetInfo* target = &*ihit;
- if(!IS_CRE_OR_VEH_GUID(target->targetGUID))
+ if (!IS_CRE_OR_VEH_GUID(target->targetGUID))
continue;
Unit* unit = m_caster->GetGUID() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target->targetGUID);
@@ -3329,7 +3329,7 @@ void Spell::update(uint32 difftime)
GOTargetInfo* target = &*ihit;
GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID);
- if(!go)
+ if (!go)
continue;
p->CastedCreatureOrGO(go->GetEntry(), go->GetGUID(), m_spellInfo->Id);
@@ -3348,30 +3348,30 @@ void Spell::update(uint32 difftime)
void Spell::finish(bool ok)
{
- if(!m_caster)
+ if (!m_caster)
return;
- if(m_spellState == SPELL_STATE_FINISHED)
+ if (m_spellState == SPELL_STATE_FINISHED)
return;
m_spellState = SPELL_STATE_FINISHED;
- if(IsChanneledSpell(m_spellInfo))
+ if (IsChanneledSpell(m_spellInfo))
m_caster->UpdateInterruptMask();
- if(m_caster->hasUnitState(UNIT_STAT_CASTING) && !m_caster->IsNonMeleeSpellCasted(false, false, true))
+ if (m_caster->hasUnitState(UNIT_STAT_CASTING) && !m_caster->IsNonMeleeSpellCasted(false, false, true))
m_caster->clearUnitState(UNIT_STAT_CASTING);
// Unsummon summon as possessed creatures on spell cancel
- if(IsChanneledSpell(m_spellInfo) && m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (IsChanneledSpell(m_spellInfo) && m_caster->GetTypeId() == TYPEID_PLAYER)
{
- if(Unit *charm = m_caster->GetCharm())
- if(charm->GetTypeId() == TYPEID_UNIT
+ if (Unit *charm = m_caster->GetCharm())
+ if (charm->GetTypeId() == TYPEID_UNIT
&& charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_PUPPET)
&& charm->GetUInt32Value(UNIT_CREATED_BY_SPELL) == m_spellInfo->Id)
((Puppet*)charm)->UnSummon();
}
- if(!ok)
+ if (!ok)
return;
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isSummon())
@@ -3388,7 +3388,7 @@ void Spell::finish(bool ok)
}
// Okay to remove extra attacks
- if(IsSpellHaveEffect(m_spellInfo, SPELL_EFFECT_ADD_EXTRA_ATTACKS))
+ if (IsSpellHaveEffect(m_spellInfo, SPELL_EFFECT_ADD_EXTRA_ATTACKS))
m_caster->m_extraAttacks = 0;
// Heal caster for all health leech from all targets
@@ -3410,9 +3410,9 @@ void Spell::finish(bool ok)
if (!found)
{
m_caster->resetAttackTimer(BASE_ATTACK);
- if(m_caster->haveOffhandWeapon())
+ if (m_caster->haveOffhandWeapon())
m_caster->resetAttackTimer(OFF_ATTACK);
- if(!(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_RESET_AUTOSHOT))
+ if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_RESET_AUTOSHOT))
m_caster->resetAttackTimer(RANGED_ATTACK);
}
}
@@ -3430,7 +3430,7 @@ void Spell::finish(bool ok)
// call triggered spell only at successful cast (after clear combo points -> for add some if need)
// I assume what he means is that some triggered spells may add combo points
- if(!m_TriggerSpells.empty())
+ if (!m_TriggerSpells.empty())
TriggerSpell();
// Take mods after trigger spell (needed for 14177 to affect 48664)
@@ -3442,19 +3442,19 @@ void Spell::finish(bool ok)
}
// Stop Attack for some spells
- if( m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET )
+ if ( m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET )
m_caster->AttackStop();
}
void Spell::SendCastResult(SpellCastResult result)
{
- if(result == SPELL_CAST_OK)
+ if (result == SPELL_CAST_OK)
return;
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
- if(m_caster->ToPlayer()->GetSession()->PlayerLoading()) // don't send cast results at loading time
+ if (m_caster->ToPlayer()->GetSession()->PlayerLoading()) // don't send cast results at loading time
return;
SendCastResult((Player*)m_caster,m_spellInfo,m_cast_count,result);
@@ -3462,7 +3462,7 @@ void Spell::SendCastResult(SpellCastResult result)
void Spell::SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 cast_count, SpellCastResult result)
{
- if(result == SPELL_CAST_OK)
+ if (result == SPELL_CAST_OK)
return;
WorldPacket data(SMSG_CAST_FAILED, (4+1+1));
@@ -3495,15 +3495,15 @@ void Spell::SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 ca
}
break;
case SPELL_FAILED_TOTEMS:
- if(spellInfo->Totem[0])
+ if (spellInfo->Totem[0])
data << uint32(spellInfo->Totem[0]);
- if(spellInfo->Totem[1])
+ if (spellInfo->Totem[1])
data << uint32(spellInfo->Totem[1]);
break;
case SPELL_FAILED_TOTEM_CATEGORY:
- if(spellInfo->TotemCategory[0])
+ if (spellInfo->TotemCategory[0])
data << uint32(spellInfo->TotemCategory[0]);
- if(spellInfo->TotemCategory[1])
+ if (spellInfo->TotemCategory[1])
data << uint32(spellInfo->TotemCategory[1]);
break;
case SPELL_FAILED_EQUIPPED_ITEM_CLASS:
@@ -3530,24 +3530,24 @@ void Spell::SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 ca
void Spell::SendSpellStart()
{
- if(!IsNeedSendToClient())
+ if (!IsNeedSendToClient())
return;
//sLog.outDebug("Sending SMSG_SPELL_START id=%u", m_spellInfo->Id);
uint32 castFlags = CAST_FLAG_UNKNOWN_2;
- if(m_spellInfo->Attributes & SPELL_ATTR_REQ_AMMO)
+ if (m_spellInfo->Attributes & SPELL_ATTR_REQ_AMMO)
castFlags |= CAST_FLAG_AMMO;
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet()))
&& m_spellInfo->powerType != POWER_HEALTH )
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
- if(m_spellInfo->runeCostID && m_spellInfo->powerType == POWER_RUNE)
+ if (m_spellInfo->runeCostID && m_spellInfo->powerType == POWER_RUNE)
castFlags |= CAST_FLAG_UNKNOWN_19;
WorldPacket data(SMSG_SPELL_START, (8+8+4+4+2));
- if(m_CastItem)
+ if (m_CastItem)
data.append(m_CastItem->GetPackGUID());
else
data.append(m_caster->GetPackGUID());
@@ -3573,7 +3573,7 @@ void Spell::SendSpellStart()
m_targets.write(&data);
- if(castFlags & CAST_FLAG_POWER_LEFT_SELF)
+ if (castFlags & CAST_FLAG_POWER_LEFT_SELF)
data << uint32(m_caster->GetPower((Powers)m_spellInfo->powerType));
if ( castFlags & CAST_FLAG_AMMO )
@@ -3591,7 +3591,7 @@ void Spell::SendSpellStart()
void Spell::SendSpellGo()
{
// not send invisible spell casting
- if(!IsNeedSendToClient())
+ if (!IsNeedSendToClient())
return;
//sLog.outDebug("Sending SMSG_SPELL_GO id=%u", m_spellInfo->Id);
@@ -3599,17 +3599,17 @@ void Spell::SendSpellGo()
uint32 castFlags = CAST_FLAG_UNKNOWN_9;
// triggered spells with spell visual != 0
- if((m_IsTriggeredSpell && !IsAutoRepeatRangedSpell(m_spellInfo)) || m_triggeredByAuraSpell)
+ if ((m_IsTriggeredSpell && !IsAutoRepeatRangedSpell(m_spellInfo)) || m_triggeredByAuraSpell)
castFlags |= CAST_FLAG_PENDING;
- if(m_spellInfo->Attributes & SPELL_ATTR_REQ_AMMO)
+ if (m_spellInfo->Attributes & SPELL_ATTR_REQ_AMMO)
castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet()))
&& m_spellInfo->powerType != POWER_HEALTH )
castFlags |= CAST_FLAG_POWER_LEFT_SELF; // should only be sent to self, but the current messaging doesn't make that possible
- if((m_caster->GetTypeId() == TYPEID_PLAYER)
+ if ((m_caster->GetTypeId() == TYPEID_PLAYER)
&& (m_caster->getClass() == CLASS_DEATH_KNIGHT)
&& m_spellInfo->runeCostID
&& m_spellInfo->powerType == POWER_RUNE)
@@ -3627,7 +3627,7 @@ void Spell::SendSpellGo()
WorldPacket data(SMSG_SPELL_GO, 50); // guess size
- if(m_CastItem)
+ if (m_CastItem)
data.append(m_CastItem->GetPackGUID());
else
data.append(m_caster->GetPackGUID());
@@ -3658,7 +3658,7 @@ void Spell::SendSpellGo()
m_targets.write(&data);
- if(castFlags & CAST_FLAG_POWER_LEFT_SELF)
+ if (castFlags & CAST_FLAG_POWER_LEFT_SELF)
data << uint32(m_caster->GetPower((Powers)m_spellInfo->powerType));
if ( castFlags & CAST_FLAG_RUNE_LIST ) // rune cooldowns list
@@ -3670,8 +3670,8 @@ void Spell::SendSpellGo()
for (uint8 i = 0; i < MAX_RUNES; ++i)
{
uint8 m = (1 << i);
- if(m & v1) // usable before...
- if(!(m & v2)) // ...but on cooldown now...
+ if (m & v1) // usable before...
+ if (!(m & v2)) // ...but on cooldown now...
data << uint8(0); // some unknown byte (time?)
}
}
@@ -3707,24 +3707,24 @@ void Spell::WriteAmmoToPacket( WorldPacket * data )
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack( RANGED_ATTACK );
- if(pItem)
+ if (pItem)
{
ammoInventoryType = pItem->GetProto()->InventoryType;
- if( ammoInventoryType == INVTYPE_THROWN )
+ if ( ammoInventoryType == INVTYPE_THROWN )
ammoDisplayID = pItem->GetProto()->DisplayInfoID;
else
{
uint32 ammoID = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID);
- if(ammoID)
+ if (ammoID)
{
ItemPrototype const *pProto = objmgr.GetItemPrototype( ammoID );
- if(pProto)
+ if (pProto)
{
ammoDisplayID = pProto->DisplayInfoID;
ammoInventoryType = pProto->InventoryType;
}
}
- else if(m_caster->HasAura(46699)) // Requires No Ammo
+ else if (m_caster->HasAura(46699)) // Requires No Ammo
{
ammoDisplayID = 5996; // normal arrow
ammoInventoryType = INVTYPE_AMMO;
@@ -3736,11 +3736,11 @@ void Spell::WriteAmmoToPacket( WorldPacket * data )
{
for (uint8 i = 0; i < 3; ++i)
{
- if(uint32 item_id = m_caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i))
+ if (uint32 item_id = m_caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i))
{
- if(ItemEntry const * itemEntry = sItemStore.LookupEntry(item_id))
+ if (ItemEntry const * itemEntry = sItemStore.LookupEntry(item_id))
{
- if(itemEntry->Class==ITEM_CLASS_WEAPON)
+ if (itemEntry->Class==ITEM_CLASS_WEAPON)
{
switch(itemEntry->SubClass)
{
@@ -3759,7 +3759,7 @@ void Spell::WriteAmmoToPacket( WorldPacket * data )
break;
}
- if(ammoDisplayID)
+ if (ammoDisplayID)
break;
}
}
@@ -3807,16 +3807,16 @@ void Spell::WriteSpellGoTargets( WorldPacket * data )
*data << (uint8)miss;
for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
- if( ihit->missCondition != SPELL_MISS_NONE ) // Add only miss
+ if ( ihit->missCondition != SPELL_MISS_NONE ) // Add only miss
{
*data << uint64(ihit->targetGUID);
*data << uint8(ihit->missCondition);
- if( ihit->missCondition == SPELL_MISS_REFLECT )
+ if ( ihit->missCondition == SPELL_MISS_REFLECT )
*data << uint8(ihit->reflectResult);
}
}
// Reset m_needAliveTargetMask for non channeled spell
- if(!IsChanneledSpell(m_spellInfo))
+ if (!IsChanneledSpell(m_spellInfo))
m_needAliveTargetMask = 0;
}
@@ -3826,7 +3826,7 @@ void Spell::SendLogExecute()
WorldPacket data(SMSG_SPELLLOGEXECUTE, (8+4+4+4+4+8));
- if(m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
data.append(m_caster->GetPackGUID());
else
data.append(target->GetPackGUID());
@@ -3844,7 +3844,7 @@ void Spell::SendLogExecute()
switch(m_spellInfo->Effect[0])
{
case SPELL_EFFECT_POWER_DRAIN:
- if(Unit *unit = m_targets.getUnitTarget())
+ if (Unit *unit = m_targets.getUnitTarget())
data.append(unit->GetPackGUID());
else
data << uint8(0);
@@ -3853,21 +3853,21 @@ void Spell::SendLogExecute()
data << float(0);
break;
case SPELL_EFFECT_ADD_EXTRA_ATTACKS:
- if(Unit *unit = m_targets.getUnitTarget())
+ if (Unit *unit = m_targets.getUnitTarget())
data.append(unit->GetPackGUID());
else
data << uint8(0);
data << uint32(m_caster->m_extraAttacks);
break;
case SPELL_EFFECT_INTERRUPT_CAST:
- if(Unit *unit = m_targets.getUnitTarget())
+ if (Unit *unit = m_targets.getUnitTarget())
data.append(unit->GetPackGUID());
else
data << uint8(0);
data << uint32(0); // spellid
break;
case SPELL_EFFECT_DURABILITY_DAMAGE:
- if(Unit *unit = m_targets.getUnitTarget())
+ if (Unit *unit = m_targets.getUnitTarget())
data.append(unit->GetPackGUID());
else
data << uint8(0);
@@ -3875,7 +3875,7 @@ void Spell::SendLogExecute()
data << uint32(0);
break;
case SPELL_EFFECT_OPEN_LOCK:
- if(Item *item = m_targets.getItemTarget())
+ if (Item *item = m_targets.getItemTarget())
data.append(item->GetPackGUID());
else
data << uint8(0);
@@ -3894,11 +3894,11 @@ void Spell::SendLogExecute()
case SPELL_EFFECT_SUMMON_OBJECT_SLOT2:
case SPELL_EFFECT_SUMMON_OBJECT_SLOT3:
case SPELL_EFFECT_SUMMON_OBJECT_SLOT4:
- if(Unit *unit = m_targets.getUnitTarget())
+ if (Unit *unit = m_targets.getUnitTarget())
data.append(unit->GetPackGUID());
- else if(m_targets.getItemTargetGUID())
+ else if (m_targets.getItemTargetGUID())
data.appendPackGUID(m_targets.getItemTargetGUID());
- else if(GameObject *go = m_targets.getGOTarget())
+ else if (GameObject *go = m_targets.getGOTarget())
data.append(go->GetPackGUID());
else
data << uint8(0); // guid
@@ -3907,14 +3907,14 @@ void Spell::SendLogExecute()
data << uint32(m_targets.getItemTargetEntry());
break;
case SPELL_EFFECT_DISMISS_PET:
- if(Unit *unit = m_targets.getUnitTarget())
+ if (Unit *unit = m_targets.getUnitTarget())
data.append(unit->GetPackGUID());
else
data << uint8(0);
break;
case SPELL_EFFECT_RESURRECT:
case SPELL_EFFECT_RESURRECT_NEW:
- if(Unit *unit = m_targets.getUnitTarget())
+ if (Unit *unit = m_targets.getUnitTarget())
data.append(unit->GetPackGUID());
else
data << uint8(0);
@@ -3947,7 +3947,7 @@ void Spell::SendInterrupted(uint8 result)
void Spell::SendChannelUpdate(uint32 time)
{
- if(time == 0)
+ if (time == 0)
{
m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0);
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
@@ -3968,22 +3968,22 @@ void Spell::SendChannelStart(uint32 duration)
WorldObject* target = NULL;
// select first not resisted target from target list for _0_ effect
- if(!m_UniqueTargetInfo.empty())
+ if (!m_UniqueTargetInfo.empty())
{
for (std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr)
{
- if( (itr->effectMask & (1 << 0)) && itr->reflectResult == SPELL_MISS_NONE && itr->targetGUID != m_caster->GetGUID())
+ if ( (itr->effectMask & (1 << 0)) && itr->reflectResult == SPELL_MISS_NONE && itr->targetGUID != m_caster->GetGUID())
{
target = ObjectAccessor::GetUnit(*m_caster, itr->targetGUID);
break;
}
}
}
- else if(!m_UniqueGOTargetInfo.empty())
+ else if (!m_UniqueGOTargetInfo.empty())
{
for (std::list<GOTargetInfo>::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr)
{
- if(itr->effectMask & (1 << 0) )
+ if (itr->effectMask & (1 << 0) )
{
target = m_caster->GetMap()->GetGameObject(itr->targetGUID);
break;
@@ -3999,7 +3999,7 @@ void Spell::SendChannelStart(uint32 duration)
m_caster->SendMessageToSet(&data, true);
m_timer = duration;
- if(target)
+ if (target)
m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, target->GetGUID());
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id);
}
@@ -4035,16 +4035,16 @@ void Spell::SendPlaySpellVisual(uint32 SpellID)
void Spell::TakeCastItem()
{
- if(!m_CastItem || m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (!m_CastItem || m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// not remove cast item at triggered spell (equipping, weapon damage, etc)
- if(m_IsTriggeredSpell)
+ if (m_IsTriggeredSpell)
return;
ItemPrototype const *proto = m_CastItem->GetProto();
- if(!proto)
+ if (!proto)
{
// This code is to avoid a crash
// I'm not sure, if this is really an error, but I guess every item needs a prototype
@@ -4088,7 +4088,7 @@ void Spell::TakeCastItem()
m_caster->ToPlayer()->DestroyItemCount(m_CastItem, count, true);
// prevent crash at access to deleted m_targets.getItemTarget
- if(m_CastItem==m_targets.getItemTarget())
+ if (m_CastItem==m_targets.getItemTarget())
m_targets.setItemTarget(NULL);
m_CastItem = NULL;
@@ -4097,23 +4097,23 @@ void Spell::TakeCastItem()
void Spell::TakePower()
{
- if(m_CastItem || m_triggeredByAuraSpell)
+ if (m_CastItem || m_triggeredByAuraSpell)
return;
bool hit = true;
- if(m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
- if(m_spellInfo->powerType == POWER_RAGE || m_spellInfo->powerType == POWER_ENERGY)
- if(uint64 targetGUID = m_targets.getUnitTargetGUID())
+ if (m_spellInfo->powerType == POWER_RAGE || m_spellInfo->powerType == POWER_ENERGY)
+ if (uint64 targetGUID = m_targets.getUnitTargetGUID())
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
- if(ihit->targetGUID == targetGUID)
+ if (ihit->targetGUID == targetGUID)
{
- if(ihit->missCondition != SPELL_MISS_NONE && ihit->missCondition != SPELL_MISS_MISS/* && ihit->targetGUID!=m_caster->GetGUID()*/)
+ if (ihit->missCondition != SPELL_MISS_NONE && ihit->missCondition != SPELL_MISS_MISS/* && ihit->targetGUID!=m_caster->GetGUID()*/)
hit = false;
if (ihit->missCondition != SPELL_MISS_NONE)
{
//lower spell cost on fail (by talent aura)
- if(Player *modOwner = m_caster->ToPlayer()->GetSpellModOwner())
+ if (Player *modOwner = m_caster->ToPlayer()->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_SPELL_COST_REFUND_ON_FAIL, m_powerCost);
}
break;
@@ -4122,7 +4122,7 @@ void Spell::TakePower()
Powers powerType = Powers(m_spellInfo->powerType);
- if(hit && powerType == POWER_RUNE)
+ if (hit && powerType == POWER_RUNE)
{
TakeRunePower();
return;
@@ -4132,19 +4132,19 @@ void Spell::TakePower()
return;
// health as power used
- if(m_spellInfo->powerType == POWER_HEALTH)
+ if (m_spellInfo->powerType == POWER_HEALTH)
{
m_caster->ModifyHealth( -(int32)m_powerCost );
return;
}
- if(m_spellInfo->powerType >= MAX_POWERS)
+ if (m_spellInfo->powerType >= MAX_POWERS)
{
sLog.outError("Spell::TakePower: Unknown power type '%d'", m_spellInfo->powerType);
return;
}
- if(hit)
+ if (hit)
m_caster->ModifyPower(powerType, -m_powerCost);
else
m_caster->ModifyPower(powerType, -irand(0, m_powerCost/4));
@@ -4156,17 +4156,17 @@ void Spell::TakePower()
void Spell::TakeAmmo()
{
- if(m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER)
{
Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack( RANGED_ATTACK );
// wands don't have ammo
- if(!pItem || pItem->IsBroken() || pItem->GetProto()->SubClass==ITEM_SUBCLASS_WEAPON_WAND)
+ if (!pItem || pItem->IsBroken() || pItem->GetProto()->SubClass==ITEM_SUBCLASS_WEAPON_WAND)
return;
- if( pItem->GetProto()->InventoryType == INVTYPE_THROWN )
+ if ( pItem->GetProto()->InventoryType == INVTYPE_THROWN )
{
- if(pItem->GetMaxStackCount()==1)
+ if (pItem->GetMaxStackCount()==1)
{
// decrease durability for non-stackable throw weapon
m_caster->ToPlayer()->DurabilityPointLossForEquipSlot(EQUIPMENT_SLOT_RANGED);
@@ -4178,30 +4178,30 @@ void Spell::TakeAmmo()
m_caster->ToPlayer()->DestroyItemCount( pItem, count, true);
}
}
- else if(uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID))
+ else if (uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID))
m_caster->ToPlayer()->DestroyItemCount(ammo, 1, true);
}
}
SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)
{
- if(m_spellInfo->powerType != POWER_RUNE || !runeCostID)
+ if (m_spellInfo->powerType != POWER_RUNE || !runeCostID)
return SPELL_CAST_OK;
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_CAST_OK;
Player *plr = (Player*)m_caster;
- if(plr->getClass() != CLASS_DEATH_KNIGHT)
+ if (plr->getClass() != CLASS_DEATH_KNIGHT)
return SPELL_CAST_OK;
SpellRuneCostEntry const *src = sSpellRuneCostStore.LookupEntry(runeCostID);
- if(!src)
+ if (!src)
return SPELL_CAST_OK;
- if(src->NoRuneCost())
+ if (src->NoRuneCost())
return SPELL_CAST_OK;
int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death
@@ -4209,7 +4209,7 @@ SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)
for (uint32 i = 0; i < RUNE_DEATH; ++i)
{
runeCost[i] = src->RuneCost[i];
- if(Player* modOwner = m_caster->GetSpellModOwner())
+ if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], this);
}
@@ -4218,15 +4218,15 @@ SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)
for (uint32 i = 0; i < MAX_RUNES; ++i)
{
RuneType rune = plr->GetCurrentRune(i);
- if((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
+ if ((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
runeCost[rune]--;
}
for (uint32 i = 0; i < RUNE_DEATH; ++i)
- if(runeCost[i] > 0)
+ if (runeCost[i] > 0)
runeCost[RUNE_DEATH] += runeCost[i];
- if(runeCost[RUNE_DEATH] > MAX_RUNES)
+ if (runeCost[RUNE_DEATH] > MAX_RUNES)
return SPELL_FAILED_NO_POWER; // not sure if result code is correct
return SPELL_CAST_OK;
@@ -4234,17 +4234,17 @@ SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)
void Spell::TakeRunePower()
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player *plr = (Player*)m_caster;
- if(plr->getClass() != CLASS_DEATH_KNIGHT)
+ if (plr->getClass() != CLASS_DEATH_KNIGHT)
return;
SpellRuneCostEntry const *src = sSpellRuneCostStore.LookupEntry(m_spellInfo->runeCostID);
- if(!src || (src->NoRuneCost() && src->NoRunicPowerGain()))
+ if (!src || (src->NoRuneCost() && src->NoRunicPowerGain()))
return;
m_runesState = plr->GetRunesState(); // store previous state
@@ -4254,7 +4254,7 @@ void Spell::TakeRunePower()
for (uint32 i = 0; i < RUNE_DEATH; ++i)
{
runeCost[i] = src->RuneCost[i];
- if(Player* modOwner = m_caster->GetSpellModOwner())
+ if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], this);
}
@@ -4263,7 +4263,7 @@ void Spell::TakeRunePower()
for (uint32 i = 0; i < MAX_RUNES; ++i)
{
RuneType rune = plr->GetCurrentRune(i);
- if((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
+ if ((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
{
plr->SetRuneCooldown(i, plr->GetRuneBaseCooldown(i));
plr->SetLastUsedRune(RuneType(rune));
@@ -4273,12 +4273,12 @@ void Spell::TakeRunePower()
runeCost[RUNE_DEATH] = runeCost[RUNE_BLOOD] + runeCost[RUNE_UNHOLY] + runeCost[RUNE_FROST];
- if(runeCost[RUNE_DEATH] > 0)
+ if (runeCost[RUNE_DEATH] > 0)
{
for (uint32 i = 0; i < MAX_RUNES; ++i)
{
RuneType rune = plr->GetCurrentRune(i);
- if((plr->GetRuneCooldown(i) == 0) && (rune == RUNE_DEATH))
+ if ((plr->GetRuneCooldown(i) == 0) && (rune == RUNE_DEATH))
{
plr->SetRuneCooldown(i, plr->GetRuneBaseCooldown(i));
plr->SetLastUsedRune(RuneType(rune));
@@ -4286,7 +4286,7 @@ void Spell::TakeRunePower()
plr->RestoreBaseRune(i);
- if(runeCost[RUNE_DEATH] == 0)
+ if (runeCost[RUNE_DEATH] == 0)
break;
}
}
@@ -4300,7 +4300,7 @@ void Spell::TakeRunePower()
void Spell::TakeReagents()
{
- if(m_IsTriggeredSpell) // reagents used in triggered spell removed by original spell or don't must be removed.
+ if (m_IsTriggeredSpell) // reagents used in triggered spell removed by original spell or don't must be removed.
return;
if (m_caster->GetTypeId() != TYPEID_PLAYER)
@@ -4316,7 +4316,7 @@ void Spell::TakeReagents()
for (uint32 x = 0; x < 8; ++x)
{
- if(m_spellInfo->Reagent[x] <= 0)
+ if (m_spellInfo->Reagent[x] <= 0)
continue;
uint32 itemid = m_spellInfo->Reagent[x];
@@ -4326,7 +4326,7 @@ void Spell::TakeReagents()
if (m_CastItem)
{
ItemPrototype const *proto = m_CastItem->GetProto();
- if( proto && proto->ItemId == itemid )
+ if ( proto && proto->ItemId == itemid )
{
for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
{
@@ -4353,15 +4353,15 @@ void Spell::TakeReagents()
void Spell::HandleThreatSpells(uint32 spellId)
{
- if(!m_targets.getUnitTarget() || !spellId)
+ if (!m_targets.getUnitTarget() || !spellId)
return;
- if(!m_targets.getUnitTarget()->CanHaveThreatList())
+ if (!m_targets.getUnitTarget()->CanHaveThreatList())
return;
uint16 threat = spellmgr.GetSpellThreat(spellId);
- if(!threat)
+ if (!threat)
return;
m_targets.getUnitTarget()->AddThreat(m_caster, float(threat));
@@ -4390,7 +4390,7 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar
//we do not need DamageMultiplier here.
damage = CalculateDamage(i, NULL);
- if(eff < TOTAL_SPELL_EFFECTS)
+ if (eff < TOTAL_SPELL_EFFECTS)
{
//sLog.outDebug( "WORLD: Spell FX %d < TOTAL_SPELL_EFFECTS ", eff);
(this->*SpellEffects[eff])(i);
@@ -4409,7 +4409,7 @@ void Spell::TriggerSpell()
SpellCastResult Spell::CheckCast(bool strict)
{
// check cooldowns to prevent cheating
- if(m_caster->GetTypeId() == TYPEID_PLAYER && !(m_spellInfo->Attributes & SPELL_ATTR_PASSIVE))
+ if (m_caster->GetTypeId() == TYPEID_PLAYER && !(m_spellInfo->Attributes & SPELL_ATTR_PASSIVE))
{
//can cast triggered (by aura only?) spells while have this flag
if (!m_IsTriggeredSpell && m_caster->ToPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY))
@@ -4417,7 +4417,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id))
{
- if(m_triggeredByAuraSpell)
+ if (m_triggeredByAuraSpell)
return SPELL_FAILED_DONT_REPORT;
else
return SPELL_FAILED_NOT_READY;
@@ -4425,14 +4425,14 @@ SpellCastResult Spell::CheckCast(bool strict)
}
// only allow triggered spells if at an ended battleground
- if( !m_IsTriggeredSpell && m_caster->GetTypeId() == TYPEID_PLAYER)
- if(BattleGround * bg = m_caster->ToPlayer()->GetBattleGround())
- if(bg->GetStatus() == STATUS_WAIT_LEAVE)
+ if ( !m_IsTriggeredSpell && m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (BattleGround * bg = m_caster->ToPlayer()->GetBattleGround())
+ if (bg->GetStatus() == STATUS_WAIT_LEAVE)
return SPELL_FAILED_DONT_REPORT;
// only check at first call, Stealth auras are already removed at second call
// for now, ignore triggered spells
- if( strict && !m_IsTriggeredSpell)
+ if ( strict && !m_IsTriggeredSpell)
{
bool checkForm = true;
// Ignore form req aura
@@ -4448,7 +4448,7 @@ SpellCastResult Spell::CheckCast(bool strict)
{
// Cannot be used in this stance/form
SpellCastResult shapeError = GetErrorAtShapeshiftedCast(m_spellInfo, m_caster->m_form);
- if(shapeError != SPELL_CAST_OK)
+ if (shapeError != SPELL_CAST_OK)
return shapeError;
if ((m_spellInfo->Attributes & SPELL_ATTR_ONLY_STEALTHED) && !(m_caster->HasStealthAura()))
@@ -4460,7 +4460,7 @@ SpellCastResult Spell::CheckCast(bool strict)
Unit::AuraEffectList const& stateAuras = m_caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
for (Unit::AuraEffectList::const_iterator j = stateAuras.begin(); j != stateAuras.end(); ++j)
{
- if((*j)->IsAffectedOnSpell(m_spellInfo))
+ if ((*j)->IsAffectedOnSpell(m_spellInfo))
{
if ((*j)->GetMiscValue()==1)
{
@@ -4474,27 +4474,27 @@ SpellCastResult Spell::CheckCast(bool strict)
// not for triggered spells (needed by execute)
if (!m_IsTriggeredSpell)
{
- if(m_spellInfo->CasterAuraState && !m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraState), m_spellInfo, m_caster))
+ if (m_spellInfo->CasterAuraState && !m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraState), m_spellInfo, m_caster))
return SPELL_FAILED_CASTER_AURASTATE;
- if(m_spellInfo->CasterAuraStateNot && m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraStateNot), m_spellInfo, m_caster))
+ if (m_spellInfo->CasterAuraStateNot && m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraStateNot), m_spellInfo, m_caster))
return SPELL_FAILED_CASTER_AURASTATE;
// Note: spell 62473 requres casterAuraSpell = triggering spell
- if(m_spellInfo->casterAuraSpell && !m_caster->HasAura(m_spellInfo->casterAuraSpell))
+ if (m_spellInfo->casterAuraSpell && !m_caster->HasAura(m_spellInfo->casterAuraSpell))
return SPELL_FAILED_CASTER_AURASTATE;
- if(m_spellInfo->excludeCasterAuraSpell && m_caster->HasAura(m_spellInfo->excludeCasterAuraSpell))
+ if (m_spellInfo->excludeCasterAuraSpell && m_caster->HasAura(m_spellInfo->excludeCasterAuraSpell))
return SPELL_FAILED_CASTER_AURASTATE;
- if(reqCombat && m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
+ if (reqCombat && m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
return SPELL_FAILED_AFFECTING_COMBAT;
}
// cancel autorepeat spells if cast start when moving
// (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
- if( m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving() )
+ if ( m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving() )
{
// skip stuck spell to allow use it in falling case and apply spell limitations at movement
- if( (!m_caster->ToPlayer()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING) || m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK) &&
+ if ( (!m_caster->ToPlayer()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING) || m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK) &&
(IsAutoRepeat() || (m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) != 0) )
return SPELL_FAILED_MOVING;
}
@@ -4508,31 +4508,31 @@ SpellCastResult Spell::CheckCast(bool strict)
if (target)
{
// target state requirements (not allowed state), apply to self also
- if(!m_IsTriggeredSpell && m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot), m_spellInfo, m_caster))
+ if (!m_IsTriggeredSpell && m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot), m_spellInfo, m_caster))
return SPELL_FAILED_TARGET_AURASTATE;
- if(m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell))
+ if (m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell))
return SPELL_FAILED_TARGET_AURASTATE;
- if(m_spellInfo->excludeTargetAuraSpell && target->HasAura(m_spellInfo->excludeTargetAuraSpell))
+ if (m_spellInfo->excludeTargetAuraSpell && target->HasAura(m_spellInfo->excludeTargetAuraSpell))
return SPELL_FAILED_TARGET_AURASTATE;
- if(!m_IsTriggeredSpell && target == m_caster && m_spellInfo->AttributesEx & SPELL_ATTR_EX_CANT_TARGET_SELF)
+ if (!m_IsTriggeredSpell && target == m_caster && m_spellInfo->AttributesEx & SPELL_ATTR_EX_CANT_TARGET_SELF)
return SPELL_FAILED_BAD_TARGETS;
bool non_caster_target = target != m_caster && !spellmgr.IsSpellWithCasterSourceTargetsOnly(m_spellInfo);
- if(non_caster_target)
+ if (non_caster_target)
{
// target state requirements (apply to non-self only), to allow cast affects to self like Dirty Deeds
- if(!m_IsTriggeredSpell && m_spellInfo->TargetAuraState && !target->HasAuraState(AuraState(m_spellInfo->TargetAuraState), m_spellInfo, m_caster))
+ if (!m_IsTriggeredSpell && m_spellInfo->TargetAuraState && !target->HasAuraState(AuraState(m_spellInfo->TargetAuraState), m_spellInfo, m_caster))
return SPELL_FAILED_TARGET_AURASTATE;
// Not allow casting on flying player
if (target->hasUnitState(UNIT_STAT_UNATTACKABLE))
return SPELL_FAILED_BAD_TARGETS;
- if(!m_IsTriggeredSpell && (target->HasAuraType(SPELL_AURA_MOD_STEALTH)
+ if (!m_IsTriggeredSpell && (target->HasAuraType(SPELL_AURA_MOD_STEALTH)
|| target->m_invisibilityMask) && !m_caster->canSeeOrDetect(target, true))
return SPELL_FAILED_BAD_TARGETS;
@@ -4557,7 +4557,7 @@ SpellCastResult Spell::CheckCast(bool strict)
{
if (target->GetTypeId() == TYPEID_PLAYER)
{
- if(!target->ToPlayer()->GetWeaponForAttack(BASE_ATTACK) || !target->ToPlayer()->IsUseEquipedWeapon(true))
+ if (!target->ToPlayer()->GetWeaponForAttack(BASE_ATTACK) || !target->ToPlayer()->IsUseEquipedWeapon(true))
return SPELL_FAILED_TARGET_NO_WEAPONS;
}
else if (!target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID))
@@ -4565,7 +4565,7 @@ SpellCastResult Spell::CheckCast(bool strict)
}
}
- if(!m_IsTriggeredSpell && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target))
+ if (!m_IsTriggeredSpell && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target))
return SPELL_FAILED_LINE_OF_SIGHT;
}
@@ -4595,12 +4595,12 @@ SpellCastResult Spell::CheckCast(bool strict)
// check pet presents
for (int j = 0; j < 3; ++j)
{
- if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_PET)
+ if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_PET)
{
target = m_caster->GetGuardianPet();
- if(!target)
+ if (!target)
{
- if(m_triggeredByAuraSpell) // not report pet not existence for triggered spells
+ if (m_triggeredByAuraSpell) // not report pet not existence for triggered spells
return SPELL_FAILED_DONT_REPORT;
else
return SPELL_FAILED_NO_PET;
@@ -4611,11 +4611,11 @@ SpellCastResult Spell::CheckCast(bool strict)
//check creature type
//ignore self casts (including area casts when caster selected as target)
- if(non_caster_target)
+ if (non_caster_target)
{
- if(!CheckTargetCreatureType(target))
+ if (!CheckTargetCreatureType(target))
{
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
return SPELL_FAILED_TARGET_IS_PLAYER;
else
return SPELL_FAILED_BAD_TARGETS;
@@ -4627,30 +4627,30 @@ SpellCastResult Spell::CheckCast(bool strict)
/*
// TODO: this check can be applied and for player to prevent cheating when IsPositiveSpell will return always correct result.
// check target for pet/charmed casts (not self targeted), self targeted cast used for area effects and etc
- if(non_caster_target && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID())
+ if (non_caster_target && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID())
{
// check correctness positive/negative cast target (pet cast real check and cheating check)
- if(IsPositiveSpell(m_spellInfo->Id))
+ if (IsPositiveSpell(m_spellInfo->Id))
{
//dispel positivity is dependant on target, don't check it
- if(m_caster->IsHostileTo(target) && !IsDispel(m_spellInfo))
+ if (m_caster->IsHostileTo(target) && !IsDispel(m_spellInfo))
return SPELL_FAILED_BAD_TARGETS;
}
else
{
- if(m_caster->IsFriendlyTo(target))
+ if (m_caster->IsFriendlyTo(target))
return SPELL_FAILED_BAD_TARGETS;
}
}
*/
- if(target)
- if(IsPositiveSpell(m_spellInfo->Id))
- if(target->IsImmunedToSpell(m_spellInfo))
+ if (target)
+ if (IsPositiveSpell(m_spellInfo->Id))
+ if (target->IsImmunedToSpell(m_spellInfo))
return SPELL_FAILED_TARGET_AURASTATE;
//Must be behind the target.
- if( m_spellInfo->AttributesEx2 == 0x100000 && (m_spellInfo->AttributesEx & 0x200) == 0x200 && target->HasInArc(M_PI, m_caster)
+ if ( m_spellInfo->AttributesEx2 == 0x100000 && (m_spellInfo->AttributesEx & 0x200) == 0x200 && target->HasInArc(M_PI, m_caster)
//Exclusion for Pounce: Facing Limitation was removed in 2.0.1, but it still uses the same, old Ex-Flags
&& (!(m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags.IsEqual(0x20000,0,0)))
//Mutilate no longer requires you be behind the target as of patch 3.0.3
@@ -4663,7 +4663,7 @@ SpellCastResult Spell::CheckCast(bool strict)
}
//Target must be facing you.
- if((m_spellInfo->Attributes == 0x150010) && !target->HasInArc(M_PI, m_caster) )
+ if ((m_spellInfo->Attributes == 0x150010) && !target->HasInArc(M_PI, m_caster) )
{
SendInterrupted(2);
return SPELL_FAILED_NOT_INFRONT;
@@ -4676,7 +4676,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// Spell casted only on battleground
if ((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_BATTLEGROUND) && m_caster->GetTypeId() == TYPEID_PLAYER)
- if(!m_caster->ToPlayer()->InBattleGround())
+ if (!m_caster->ToPlayer()->InBattleGround())
return SPELL_FAILED_ONLY_BATTLEGROUNDS;
// do not allow spells to be cast in arenas
@@ -4684,19 +4684,19 @@ SpellCastResult Spell::CheckCast(bool strict)
// - with SPELL_ATTR_EX4_NOT_USABLE_IN_ARENA flag
if ((m_spellInfo->AttributesEx4 & SPELL_ATTR_EX4_NOT_USABLE_IN_ARENA) ||
GetSpellRecoveryTime(m_spellInfo) > 10 * MINUTE * IN_MILISECONDS && !(m_spellInfo->AttributesEx4 & SPELL_ATTR_EX4_USABLE_IN_ARENA))
- if(MapEntry const* mapEntry = sMapStore.LookupEntry(m_caster->GetMapId()))
- if(mapEntry->IsBattleArena())
+ if (MapEntry const* mapEntry = sMapStore.LookupEntry(m_caster->GetMapId()))
+ if (mapEntry->IsBattleArena())
return SPELL_FAILED_NOT_IN_ARENA;
// zone check
- if(m_caster->GetTypeId() == TYPEID_UNIT || !m_caster->ToPlayer()->isGameMaster())
+ if (m_caster->GetTypeId() == TYPEID_UNIT || !m_caster->ToPlayer()->isGameMaster())
{
uint32 zone, area;
m_caster->GetZoneAndAreaId(zone,area);
SpellCastResult locRes= spellmgr.GetSpellAllowedInLocationError(m_spellInfo,m_caster->GetMapId(),zone,area,
m_caster->GetTypeId() == TYPEID_PLAYER ? m_caster->ToPlayer() : NULL);
- if(locRes != SPELL_CAST_OK)
+ if (locRes != SPELL_CAST_OK)
return locRes;
}
@@ -4714,23 +4714,23 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!IsPassiveSpell(m_spellInfo->Id))
{
SpellCastResult castResult = CheckItems();
- if(castResult != SPELL_CAST_OK)
+ if (castResult != SPELL_CAST_OK)
return castResult;
}
/*//ImpliciteTargetA-B = 38, If fact there is 0 Spell with ImpliciteTargetB=38
- if(m_UniqueTargetInfo.empty()) // skip second CheckCast apply (for delayed spells for example)
+ if (m_UniqueTargetInfo.empty()) // skip second CheckCast apply (for delayed spells for example)
{
for (uint8 j = 0; j < 3; ++j)
{
- if( m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_NEARBY_ENTRY ||
+ if ( m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_NEARBY_ENTRY ||
m_spellInfo->EffectImplicitTargetB[j] == TARGET_UNIT_NEARBY_ENTRY && m_spellInfo->EffectImplicitTargetA[j] != TARGET_UNIT_CASTER ||
m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY ||
m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY )
{
SpellScriptTarget::const_iterator lower = spellmgr.GetBeginSpellScriptTarget(m_spellInfo->Id);
SpellScriptTarget::const_iterator upper = spellmgr.GetEndSpellScriptTarget(m_spellInfo->Id);
- if(lower==upper)
+ if (lower==upper)
sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = TARGET_UNIT_NEARBY_ENTRY or TARGET_DST_NEARBY_ENTRY, but does not have record in `spell_script_target`",m_spellInfo->Id);
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex);
@@ -4799,7 +4799,7 @@ SpellCastResult Spell::CheckCast(bool strict)
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, grid_creature_searcher, *m_caster->GetMap(), *m_caster, range);
- if(p_Creature )
+ if (p_Creature )
{
creatureScriptTarget = p_Creature;
goScriptTarget = NULL;
@@ -4810,7 +4810,7 @@ SpellCastResult Spell::CheckCast(bool strict)
}
}
- if(creatureScriptTarget)
+ if (creatureScriptTarget)
{
// store coordinates for TARGET_DST_NEARBY_ENTRY
if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY ||
@@ -4818,14 +4818,14 @@ SpellCastResult Spell::CheckCast(bool strict)
{
m_targets.setDst(creatureScriptTarget->GetPositionX(),creatureScriptTarget->GetPositionY(),creatureScriptTarget->GetPositionZ());
- if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY && m_spellInfo->EffectImplicitTargetB[j] == 0 && m_spellInfo->Effect[j]!=SPELL_EFFECT_PERSISTENT_AREA_AURA)
+ if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY && m_spellInfo->EffectImplicitTargetB[j] == 0 && m_spellInfo->Effect[j]!=SPELL_EFFECT_PERSISTENT_AREA_AURA)
AddUnitTarget(creatureScriptTarget, j);
}
// store explicit target for TARGET_UNIT_NEARBY_ENTRY
else
AddUnitTarget(creatureScriptTarget, j);
}
- else if(goScriptTarget)
+ else if (goScriptTarget)
{
// store coordinates for TARGET_DST_NEARBY_ENTRY
if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY ||
@@ -4833,7 +4833,7 @@ SpellCastResult Spell::CheckCast(bool strict)
{
m_targets.setDst(goScriptTarget->GetPositionX(),goScriptTarget->GetPositionY(),goScriptTarget->GetPositionZ());
- if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY && m_spellInfo->EffectImplicitTargetB[j] == 0 && m_spellInfo->Effect[j]!=SPELL_EFFECT_PERSISTENT_AREA_AURA)
+ if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY && m_spellInfo->EffectImplicitTargetB[j] == 0 && m_spellInfo->Effect[j]!=SPELL_EFFECT_PERSISTENT_AREA_AURA)
AddGOTarget(goScriptTarget, j);
}
// store explicit target for TARGET_UNIT_NEARBY_ENTRY
@@ -4844,7 +4844,7 @@ SpellCastResult Spell::CheckCast(bool strict)
else
{
// not report target not existence for triggered spells
- if(m_triggeredByAuraSpell || m_IsTriggeredSpell)
+ if (m_triggeredByAuraSpell || m_IsTriggeredSpell)
return SPELL_FAILED_DONT_REPORT;
else
return SPELL_FAILED_BAD_TARGETS;
@@ -4853,18 +4853,18 @@ SpellCastResult Spell::CheckCast(bool strict)
}
}*/
- if(!m_IsTriggeredSpell)
+ if (!m_IsTriggeredSpell)
{
SpellCastResult castResult = CheckRange(strict);
- if(castResult != SPELL_CAST_OK)
+ if (castResult != SPELL_CAST_OK)
return castResult;
castResult = CheckPower();
- if(castResult != SPELL_CAST_OK)
+ if (castResult != SPELL_CAST_OK)
return castResult;
castResult = CheckCasterAuras();
- if(castResult != SPELL_CAST_OK)
+ if (castResult != SPELL_CAST_OK)
return castResult;
}
@@ -4877,17 +4877,17 @@ SpellCastResult Spell::CheckCast(bool strict)
{
if (m_spellInfo->Id == 51582) // Rocket Boots Engaged
{
- if(m_caster->IsInWater())
+ if (m_caster->IsInWater())
return SPELL_FAILED_ONLY_ABOVEWATER;
}
- else if(m_spellInfo->SpellIconID == 156) // Holy Shock
+ else if (m_spellInfo->SpellIconID == 156) // Holy Shock
{
// spell different for friends and enemies
// hurt version required facing
- if(m_targets.getUnitTarget() && !m_caster->IsFriendlyTo(m_targets.getUnitTarget()) && !m_caster->HasInArc( M_PI, m_targets.getUnitTarget() ))
+ if (m_targets.getUnitTarget() && !m_caster->IsFriendlyTo(m_targets.getUnitTarget()) && !m_caster->HasInArc( M_PI, m_targets.getUnitTarget() ))
return SPELL_FAILED_UNIT_NOT_INFRONT;
}
- else if(m_spellInfo->SpellIconID == 33 && m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_FIRE_NOVA)
+ else if (m_spellInfo->SpellIconID == 33 && m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_FIRE_NOVA)
{
if (!m_caster->m_SummonSlot[1])
return SPELL_FAILED_SUCCESS;
@@ -4901,12 +4901,12 @@ SpellCastResult Spell::CheckCast(bool strict)
else if (m_spellInfo->Id == 19938) // Awaken Peon
{
Unit *unit = m_targets.getUnitTarget();
- if(!unit || !unit->HasAura(17743))
+ if (!unit || !unit->HasAura(17743))
return SPELL_FAILED_BAD_TARGETS;
}
else if (m_spellInfo->Id == 52264) // Deliver Stolen Horse
{
- if(!m_caster->FindNearestCreature(28653,5))
+ if (!m_caster->FindNearestCreature(28653,5))
return SPELL_FAILED_OUT_OF_RANGE;
}
else if (m_spellInfo->Id == 31789) // Righteous Defense
@@ -4926,20 +4926,20 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
- if(m_spellInfo->EffectImplicitTargetA[i] != TARGET_UNIT_PET)
+ if (m_spellInfo->EffectImplicitTargetA[i] != TARGET_UNIT_PET)
break;
Pet* pet = m_caster->ToPlayer()->GetPet();
- if(!pet)
+ if (!pet)
return SPELL_FAILED_NO_PET;
SpellEntry const *learn_spellproto = sSpellStore.LookupEntry(m_spellInfo->EffectTriggerSpell[i]);
- if(!learn_spellproto)
+ if (!learn_spellproto)
return SPELL_FAILED_NOT_KNOWN;
- if(m_spellInfo->spellLevel > pet->getLevel())
+ if (m_spellInfo->spellLevel > pet->getLevel())
return SPELL_FAILED_LOWLEVEL;
break;
@@ -4950,15 +4950,15 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_BAD_TARGETS;
Pet* pet = m_caster->ToPlayer()->GetPet();
- if(!pet)
+ if (!pet)
return SPELL_FAILED_NO_PET;
SpellEntry const *learn_spellproto = sSpellStore.LookupEntry(m_spellInfo->EffectTriggerSpell[i]);
- if(!learn_spellproto)
+ if (!learn_spellproto)
return SPELL_FAILED_NOT_KNOWN;
- if(m_spellInfo->spellLevel > pet->getLevel())
+ if (m_spellInfo->spellLevel > pet->getLevel())
return SPELL_FAILED_LOWLEVEL;
break;
@@ -4966,8 +4966,8 @@ SpellCastResult Spell::CheckCast(bool strict)
case SPELL_EFFECT_APPLY_GLYPH:
{
uint32 glyphId = m_spellInfo->EffectMiscValue[i];
- if(GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyphId))
- if(m_caster->HasAura(gp->SpellId))
+ if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyphId))
+ if (m_caster->HasAura(gp->SpellId))
return SPELL_FAILED_UNIQUE_GLYPH;
break;
}
@@ -4977,21 +4977,21 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_BAD_TARGETS;
Item* foodItem = m_targets.getItemTarget();
- if(!foodItem)
+ if (!foodItem)
return SPELL_FAILED_BAD_TARGETS;
Pet* pet = m_caster->ToPlayer()->GetPet();
- if(!pet)
+ if (!pet)
return SPELL_FAILED_NO_PET;
- if(!pet->HaveInDiet(foodItem->GetProto()))
+ if (!pet->HaveInDiet(foodItem->GetProto()))
return SPELL_FAILED_WRONG_PET_FOOD;
- if(!pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel))
+ if (!pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel))
return SPELL_FAILED_FOOD_LOWLEVEL;
- if(m_caster->isInCombat() || pet->isInCombat())
+ if (m_caster->isInCombat() || pet->isInCombat())
return SPELL_FAILED_AFFECTING_COMBAT;
break;
@@ -5000,9 +5000,9 @@ SpellCastResult Spell::CheckCast(bool strict)
case SPELL_EFFECT_POWER_DRAIN:
{
// Can be area effect, Check only for players and not check if target - caster (spell can have multiply drain/burn effects)
- if(m_caster->GetTypeId() == TYPEID_PLAYER)
- if(Unit* target = m_targets.getUnitTarget())
- if(target != m_caster && target->getPowerType() != m_spellInfo->EffectMiscValue[i])
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (Unit* target = m_targets.getUnitTarget())
+ if (target != m_caster && target->getPowerType() != m_spellInfo->EffectMiscValue[i])
return SPELL_FAILED_BAD_TARGETS;
break;
}
@@ -5023,7 +5023,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_targets.getUnitTarget() || m_targets.getUnitTarget()->GetTypeId() != TYPEID_UNIT)
return SPELL_FAILED_BAD_TARGETS;
- if( !(m_targets.getUnitTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & UNIT_FLAG_SKINNABLE) )
+ if ( !(m_targets.getUnitTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & UNIT_FLAG_SKINNABLE) )
return SPELL_FAILED_TARGET_UNSKINNABLE;
Creature* creature = m_targets.getUnitTarget()->ToCreature();
@@ -5039,7 +5039,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_LOW_CASTLEVEL;
// chance for fail at orange skinning attempt
- if( (m_selfContainer && (*m_selfContainer) == this) &&
+ if ( (m_selfContainer && (*m_selfContainer) == this) &&
skillValue < sWorld.GetConfigMaxSkillValue() &&
(ReqValue < 0 ? 0 : ReqValue) > irand(skillValue - 25, skillValue + 37) )
return SPELL_FAILED_TRY_AGAIN;
@@ -5048,11 +5048,11 @@ SpellCastResult Spell::CheckCast(bool strict)
}
case SPELL_EFFECT_OPEN_LOCK:
{
- if( m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT &&
+ if ( m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT &&
m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT_ITEM )
break;
- if( m_caster->GetTypeId() != TYPEID_PLAYER // only players can open locks, gather etc.
+ if ( m_caster->GetTypeId() != TYPEID_PLAYER // only players can open locks, gather etc.
// we need a go target in case of TARGET_GAMEOBJECT
|| m_spellInfo->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT && !m_targets.getGOTarget()
// we need a go target, or an openable item target in case of TARGET_GAMEOBJECT_ITEM
@@ -5061,7 +5061,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_BAD_TARGETS;
// In BattleGround players can use only flags and banners
- if( m_caster->ToPlayer()->InBattleGround() &&
+ if ( m_caster->ToPlayer()->InBattleGround() &&
!m_caster->ToPlayer()->CanUseBattleGroundObject() )
return SPELL_FAILED_TRY_AGAIN;
@@ -5073,7 +5073,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!lockId)
return SPELL_FAILED_BAD_TARGETS;
}
- else if(Item* itm = m_targets.getItemTarget())
+ else if (Item* itm = m_targets.getItemTarget())
lockId = itm->GetProto()->LockID;
SkillType skillId = SKILL_NONE;
@@ -5082,17 +5082,17 @@ SpellCastResult Spell::CheckCast(bool strict)
// check lock compatibility
SpellCastResult res = CanOpenLock(i, lockId, skillId, reqSkillValue, skillValue);
- if(res != SPELL_CAST_OK)
+ if (res != SPELL_CAST_OK)
return res;
// chance for fail at orange mining/herb/LockPicking gathering attempt
// second check prevent fail at rechecks
- if(skillId != SKILL_NONE && (!m_selfContainer || ((*m_selfContainer) != this)))
+ if (skillId != SKILL_NONE && (!m_selfContainer || ((*m_selfContainer) != this)))
{
bool canFailAtMax = skillId != SKILL_HERBALISM && skillId != SKILL_MINING;
// chance for failure in orange gather / lockpick (gathering skill can't fail at maxskill)
- if((canFailAtMax || skillValue < sWorld.GetConfigMaxSkillValue()) && reqSkillValue > irand(skillValue - 25, skillValue + 37))
+ if ((canFailAtMax || skillValue < sWorld.GetConfigMaxSkillValue()) && reqSkillValue > irand(skillValue - 25, skillValue + 37))
return SPELL_FAILED_TRY_AGAIN;
}
break;
@@ -5100,10 +5100,10 @@ SpellCastResult Spell::CheckCast(bool strict)
case SPELL_EFFECT_SUMMON_DEAD_PET:
{
Creature *pet = m_caster->GetGuardianPet();
- if(!pet)
+ if (!pet)
return SPELL_FAILED_NO_PET;
- if(pet->isAlive())
+ if (pet->isAlive())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
break;
@@ -5112,15 +5112,15 @@ SpellCastResult Spell::CheckCast(bool strict)
case SPELL_EFFECT_SUMMON:
{
SummonPropertiesEntry const *SummonProperties = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i]);
- if(!SummonProperties)
+ if (!SummonProperties)
break;
switch(SummonProperties->Category)
{
case SUMMON_CATEGORY_PET:
- if(m_caster->GetPetGUID())
+ if (m_caster->GetPetGUID())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
case SUMMON_CATEGORY_PUPPET:
- if(m_caster->GetCharmGUID())
+ if (m_caster->GetCharmGUID())
return SPELL_FAILED_ALREADY_HAVE_CHARM;
break;
}
@@ -5128,41 +5128,41 @@ SpellCastResult Spell::CheckCast(bool strict)
}
case SPELL_EFFECT_SUMMON_PET:
{
- if(m_caster->GetPetGUID()) //let warlock do a replacement summon
+ if (m_caster->GetPetGUID()) //let warlock do a replacement summon
{
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->getClass()==CLASS_WARLOCK)
{
if (strict) //starting cast, trigger pet stun (cast by pet so it doesn't attack player)
- if(Pet* pet = m_caster->ToPlayer()->GetPet())
+ if (Pet* pet = m_caster->ToPlayer()->GetPet())
pet->CastSpell(pet, 32752, true, NULL, NULL, pet->GetGUID());
}
else
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
}
- if(m_caster->GetCharmGUID())
+ if (m_caster->GetCharmGUID())
return SPELL_FAILED_ALREADY_HAVE_CHARM;
break;
}
case SPELL_EFFECT_SUMMON_PLAYER:
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
- if(!m_caster->ToPlayer()->GetSelection())
+ if (!m_caster->ToPlayer()->GetSelection())
return SPELL_FAILED_BAD_TARGETS;
Player* target = objmgr.GetPlayer(m_caster->ToPlayer()->GetSelection());
- if( !target || m_caster->ToPlayer() == target || !target->IsInSameRaidWith(m_caster->ToPlayer()) )
+ if ( !target || m_caster->ToPlayer() == target || !target->IsInSameRaidWith(m_caster->ToPlayer()) )
return SPELL_FAILED_BAD_TARGETS;
// check if our map is dungeon
- if( sMapStore.LookupEntry(m_caster->GetMapId())->IsDungeon() )
+ if ( sMapStore.LookupEntry(m_caster->GetMapId())->IsDungeon() )
{
InstanceTemplate const* instance = ObjectMgr::GetInstanceTemplate(m_caster->GetMapId());
- if(!instance)
+ if (!instance)
return SPELL_FAILED_TARGET_NOT_IN_INSTANCE;
- if(!target->Satisfy(objmgr.GetAccessRequirement(instance->access_id), m_caster->GetMapId()))
+ if (!target->Satisfy(objmgr.GetAccessRequirement(instance->access_id), m_caster->GetMapId()))
return SPELL_FAILED_BAD_TARGETS;
}
break;
@@ -5171,9 +5171,9 @@ SpellCastResult Spell::CheckCast(bool strict)
case SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER:
{
//Do not allow to cast it before BG starts.
- if(m_caster->GetTypeId() == TYPEID_PLAYER)
- if(BattleGround const *bg = m_caster->ToPlayer()->GetBattleGround())
- if(bg->GetStatus() != STATUS_IN_PROGRESS)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (BattleGround const *bg = m_caster->ToPlayer()->GetBattleGround())
+ if (bg->GetStatus() != STATUS_IN_PROGRESS)
return SPELL_FAILED_TRY_AGAIN;
break;
}
@@ -5205,7 +5205,7 @@ SpellCastResult Spell::CheckCast(bool strict)
break;
}
case 61336:
- if(m_caster->GetTypeId() != TYPEID_PLAYER || !m_caster->ToPlayer()->IsInFeralForm())
+ if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_caster->ToPlayer()->IsInFeralForm())
return SPELL_FAILED_ONLY_SHAPESHIFT;
break;
// Wild Growth
@@ -5243,10 +5243,10 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!target->GetCreatureInfo()->isTameable (m_caster->ToPlayer()->CanTameExoticPets()))
return SPELL_FAILED_BAD_TARGETS;
- if(m_caster->GetPetGUID())
+ if (m_caster->GetPetGUID())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
- if(m_caster->GetCharmGUID())
+ if (m_caster->GetCharmGUID())
return SPELL_FAILED_ALREADY_HAVE_CHARM;
break;
@@ -5267,14 +5267,14 @@ SpellCastResult Spell::CheckCast(bool strict)
}
case SPELL_AURA_MOD_POSSESS_PET:
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_NO_PET;
Pet *pet = m_caster->ToPlayer()->GetPet();
- if(!pet)
+ if (!pet)
return SPELL_FAILED_NO_PET;
- if(pet->GetCharmerGUID())
+ if (pet->GetCharmerGUID())
return SPELL_FAILED_CHARMED;
break;
}
@@ -5282,29 +5282,29 @@ SpellCastResult Spell::CheckCast(bool strict)
case SPELL_AURA_MOD_CHARM:
case SPELL_AURA_AOE_CHARM:
{
- if(m_caster->GetCharmerGUID())
+ if (m_caster->GetCharmerGUID())
return SPELL_FAILED_CHARMED;
- if(m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_CHARM
+ if (m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_CHARM
|| m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_POSSESS)
{
- if(m_caster->GetPetGUID())
+ if (m_caster->GetPetGUID())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
- if(m_caster->GetCharmGUID())
+ if (m_caster->GetCharmGUID())
return SPELL_FAILED_ALREADY_HAVE_CHARM;
}
- if(Unit *target = m_targets.getUnitTarget())
+ if (Unit *target = m_targets.getUnitTarget())
{
- if(target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsVehicle())
+ if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsVehicle())
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
- if(target->GetCharmerGUID())
+ if (target->GetCharmerGUID())
return SPELL_FAILED_CHARMED;
int32 damage = CalculateDamage(i, target);
- if(damage && int32(target->getLevel()) > damage)
+ if (damage && int32(target->getLevel()) > damage)
return SPELL_FAILED_HIGHLEVEL;
}
@@ -5327,7 +5327,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_NO_MOUNTS_ALLOWED;
ShapeshiftForm form = m_caster->m_form;
- if( form == FORM_CAT || form == FORM_TREE || form == FORM_TRAVEL ||
+ if ( form == FORM_CAT || form == FORM_TREE || form == FORM_TRAVEL ||
form == FORM_AQUA || form == FORM_BEAR || form == FORM_DIREBEAR ||
form == FORM_CREATUREBEAR || form == FORM_GHOSTWOLF || form == FORM_FLIGHT ||
form == FORM_FLIGHT_EPIC || form == FORM_MOONKIN || form == FORM_METAMORPHOSIS )
@@ -5337,11 +5337,11 @@ SpellCastResult Spell::CheckCast(bool strict)
}
case SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS:
{
- if(!m_targets.getUnitTarget())
+ if (!m_targets.getUnitTarget())
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
// can be casted at non-friendly unit or own pet/charm
- if(m_caster->IsFriendlyTo(m_targets.getUnitTarget()))
+ if (m_caster->IsFriendlyTo(m_targets.getUnitTarget()))
return SPELL_FAILED_TARGET_FRIENDLY;
break;
@@ -5378,7 +5378,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->GetTypeId() != TYPEID_PLAYER || m_CastItem)
break;
- if(m_targets.getUnitTarget()->getPowerType() != POWER_MANA)
+ if (m_targets.getUnitTarget()->getPowerType() != POWER_MANA)
return SPELL_FAILED_BAD_TARGETS;
break;
@@ -5394,28 +5394,28 @@ SpellCastResult Spell::CheckCast(bool strict)
SpellCastResult Spell::CheckPetCast(Unit* target)
{
- if(!m_caster->isAlive() && !(m_spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD))
+ if (!m_caster->isAlive() && !(m_spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD))
return SPELL_FAILED_CASTER_DEAD;
- if(m_caster->hasUnitState(UNIT_STAT_CASTING) && !m_IsTriggeredSpell) //prevent spellcast interruption by another spellcast
+ if (m_caster->hasUnitState(UNIT_STAT_CASTING) && !m_IsTriggeredSpell) //prevent spellcast interruption by another spellcast
return SPELL_FAILED_SPELL_IN_PROGRESS;
- if(m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
+ if (m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
return SPELL_FAILED_AFFECTING_COMBAT;
//dead owner (pets still alive when owners ressed?)
- if(Unit *owner = m_caster->GetCharmerOrOwner())
- if(!owner->isAlive())
+ if (Unit *owner = m_caster->GetCharmerOrOwner())
+ if (!owner->isAlive())
return SPELL_FAILED_CASTER_DEAD;
- if(!target && m_targets.getUnitTarget())
+ if (!target && m_targets.getUnitTarget())
target = m_targets.getUnitTarget();
for (uint32 i = 0; i < 3; ++i)
{
- if(SpellTargetType[m_spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET
+ if (SpellTargetType[m_spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET
|| SpellTargetType[m_spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_DEST_TARGET)
{
- if(!target)
+ if (!target)
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
m_targets.setUnitTarget(target);
break;
@@ -5424,16 +5424,16 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
Unit* _target = m_targets.getUnitTarget();
- if(_target) //for target dead/target not valid
+ if (_target) //for target dead/target not valid
{
- if(!_target->isAlive())
+ if (!_target->isAlive())
return SPELL_FAILED_BAD_TARGETS;
- if(!IsValidSingleTargetSpell(_target))
+ if (!IsValidSingleTargetSpell(_target))
return SPELL_FAILED_BAD_TARGETS;
}
//cooldown
- if(m_caster->ToCreature()->HasSpellCooldown(m_spellInfo->Id))
+ if (m_caster->ToCreature()->HasSpellCooldown(m_spellInfo->Id))
return SPELL_FAILED_NOT_READY;
return CheckCast(true);
@@ -5442,7 +5442,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
SpellCastResult Spell::CheckCasterAuras() const
{
// spells totally immuned to caster auras ( wsg flag drop, give marks etc)
- if(m_spellInfo->AttributesEx6& SPELL_ATTR_EX6_IGNORE_CASTER_AURAS)
+ if (m_spellInfo->AttributesEx6& SPELL_ATTR_EX6_IGNORE_CASTER_AURAS)
return SPELL_CAST_OK;
uint8 school_immune = 0;
@@ -5455,15 +5455,15 @@ SpellCastResult Spell::CheckCasterAuras() const
{
for (int i = 0; i < 3; ++i)
{
- if(m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_IMMUNITY)
+ if (m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_IMMUNITY)
school_immune |= uint32(m_spellInfo->EffectMiscValue[i]);
- else if(m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MECHANIC_IMMUNITY)
+ else if (m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MECHANIC_IMMUNITY)
mechanic_immune |= 1 << uint32(m_spellInfo->EffectMiscValue[i]);
- else if(m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_DISPEL_IMMUNITY)
+ else if (m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_DISPEL_IMMUNITY)
dispel_immune |= GetDispellMask(DispelType(m_spellInfo->EffectMiscValue[i]));
}
//immune movement impairment and loss of control
- if(m_spellInfo->Id==42292 || m_spellInfo->Id==59752)
+ if (m_spellInfo->Id==42292 || m_spellInfo->Id==59752)
mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
}
@@ -5471,32 +5471,32 @@ SpellCastResult Spell::CheckCasterAuras() const
SpellCastResult prevented_reason = SPELL_CAST_OK;
// Have to check if there is a stun aura. Otherwise will have problems with ghost aura apply while logging out
uint32 unitflag = m_caster->GetUInt32Value(UNIT_FIELD_FLAGS); // Get unit state
- if(unitflag & UNIT_FLAG_STUNNED && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED))
+ if (unitflag & UNIT_FLAG_STUNNED && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED))
prevented_reason = SPELL_FAILED_STUNNED;
- else if(unitflag & UNIT_FLAG_CONFUSED && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_CONFUSED))
+ else if (unitflag & UNIT_FLAG_CONFUSED && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_CONFUSED))
prevented_reason = SPELL_FAILED_CONFUSED;
- else if(unitflag & UNIT_FLAG_FLEEING && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_FEARED))
+ else if (unitflag & UNIT_FLAG_FLEEING && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_FEARED))
prevented_reason = SPELL_FAILED_FLEEING;
- else if(unitflag & UNIT_FLAG_SILENCED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
+ else if (unitflag & UNIT_FLAG_SILENCED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
prevented_reason = SPELL_FAILED_SILENCED;
- else if(unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY)
+ else if (unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY)
prevented_reason = SPELL_FAILED_PACIFIED;
// Attr must make flag drop spell totally immune from all effects
- if(prevented_reason != SPELL_CAST_OK)
+ if (prevented_reason != SPELL_CAST_OK)
{
- if(school_immune || mechanic_immune || dispel_immune)
+ if (school_immune || mechanic_immune || dispel_immune)
{
//Checking auras is needed now, because you are prevented by some state but the spell grants immunity.
Unit::AuraApplicationMap const& auras = m_caster->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
Aura const * aura = itr->second->GetBase();
- if( GetAllSpellMechanicMask(aura->GetSpellProto()) & mechanic_immune )
+ if ( GetAllSpellMechanicMask(aura->GetSpellProto()) & mechanic_immune )
continue;
- if( GetSpellSchoolMask(aura->GetSpellProto()) & school_immune )
+ if ( GetSpellSchoolMask(aura->GetSpellProto()) & school_immune )
continue;
- if( (1<<(aura->GetSpellProto()->Dispel)) & dispel_immune)
+ if ( (1<<(aura->GetSpellProto()->Dispel)) & dispel_immune)
continue;
//Make a second check for spell failed so the right SPELL_FAILED message is returned.
@@ -5522,7 +5522,7 @@ SpellCastResult Spell::CheckCasterAuras() const
case SPELL_AURA_MOD_SILENCE:
case SPELL_AURA_MOD_PACIFY:
case SPELL_AURA_MOD_PACIFY_SILENCE:
- if( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY)
+ if ( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY)
return SPELL_FAILED_PACIFIED;
else if ( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE)
return SPELL_FAILED_SILENCED;
@@ -5546,35 +5546,35 @@ bool Spell::CanAutoCast(Unit* target)
for (uint32 j = 0; j < 3; ++j)
{
- if(m_spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA)
+ if (m_spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA)
{
- if( m_spellInfo->StackAmount <= 1)
+ if ( m_spellInfo->StackAmount <= 1)
{
- if( target->HasAuraEffect(m_spellInfo->Id, j) )
+ if ( target->HasAuraEffect(m_spellInfo->Id, j) )
return false;
}
else
{
- if( AuraEffect * aureff = target->GetAuraEffect(m_spellInfo->Id, j))
+ if ( AuraEffect * aureff = target->GetAuraEffect(m_spellInfo->Id, j))
if (aureff->GetBase()->GetStackAmount() >= m_spellInfo->StackAmount)
return false;
}
}
else if ( IsAreaAuraEffect( m_spellInfo->Effect[j] ))
{
- if( target->HasAuraEffect(m_spellInfo->Id, j) )
+ if ( target->HasAuraEffect(m_spellInfo->Id, j) )
return false;
}
}
SpellCastResult result = CheckPetCast(target);
- if(result == SPELL_CAST_OK || result == SPELL_FAILED_UNIT_NOT_INFRONT)
+ if (result == SPELL_CAST_OK || result == SPELL_FAILED_UNIT_NOT_INFRONT)
{
SelectSpellTargets();
//check if among target units, our WANTED target is as well (->only self cast spells return false)
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
- if( ihit->targetGUID == targetguid )
+ if ( ihit->targetGUID == targetguid )
return true;
}
return false; //target invalid
@@ -5597,38 +5597,38 @@ SpellCastResult Spell::CheckRange(bool strict)
float min_range = m_caster->GetSpellMinRangeForTarget(target, srange);
uint32 range_type = GetSpellRangeType(srange);
- if(Player* modOwner = m_caster->GetSpellModOwner())
+ if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, max_range, this);
- if(target && target != m_caster)
+ if (target && target != m_caster)
{
- if(range_type == SPELL_RANGE_MELEE)
+ if (range_type == SPELL_RANGE_MELEE)
{
// Because of lag, we can not check too strictly here.
- if(!m_caster->IsWithinMeleeRange(target, max_range))
+ if (!m_caster->IsWithinMeleeRange(target, max_range))
return SPELL_FAILED_OUT_OF_RANGE;
}
- else if(!m_caster->IsWithinCombatRange(target, max_range))
+ else if (!m_caster->IsWithinCombatRange(target, max_range))
return SPELL_FAILED_OUT_OF_RANGE; //0x5A;
- if(range_type == SPELL_RANGE_RANGED)
+ if (range_type == SPELL_RANGE_RANGED)
{
- if(m_caster->IsWithinMeleeRange(target))
+ if (m_caster->IsWithinMeleeRange(target))
return SPELL_FAILED_TOO_CLOSE;
}
- else if(min_range && m_caster->IsWithinCombatRange(target, min_range)) // skip this check if min_range = 0
+ else if (min_range && m_caster->IsWithinCombatRange(target, min_range)) // skip this check if min_range = 0
return SPELL_FAILED_TOO_CLOSE;
- if( m_caster->GetTypeId() == TYPEID_PLAYER &&
+ if ( m_caster->GetTypeId() == TYPEID_PLAYER &&
(m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc( M_PI, target ) )
return SPELL_FAILED_UNIT_NOT_INFRONT;
}
- if(m_targets.HasDst() && !m_targets.HasTraj())
+ if (m_targets.HasDst() && !m_targets.HasTraj())
{
- if(!m_caster->IsWithinDist3d(&m_targets.m_dstPos, max_range))
+ if (!m_caster->IsWithinDist3d(&m_targets.m_dstPos, max_range))
return SPELL_FAILED_OUT_OF_RANGE;
- if(min_range && m_caster->IsWithinDist3d(&m_targets.m_dstPos, min_range))
+ if (min_range && m_caster->IsWithinDist3d(&m_targets.m_dstPos, min_range))
return SPELL_FAILED_TOO_CLOSE;
}
@@ -5638,34 +5638,34 @@ SpellCastResult Spell::CheckRange(bool strict)
SpellCastResult Spell::CheckPower()
{
// item cast not used power
- if(m_CastItem)
+ if (m_CastItem)
return SPELL_CAST_OK;
// health as power used - need check health amount
- if(m_spellInfo->powerType == POWER_HEALTH)
+ if (m_spellInfo->powerType == POWER_HEALTH)
{
- if(m_caster->GetHealth() <= m_powerCost)
+ if (m_caster->GetHealth() <= m_powerCost)
return SPELL_FAILED_CASTER_AURASTATE;
return SPELL_CAST_OK;
}
// Check valid power type
- if( m_spellInfo->powerType >= MAX_POWERS )
+ if ( m_spellInfo->powerType >= MAX_POWERS )
{
sLog.outError("Spell::CheckPower: Unknown power type '%d'", m_spellInfo->powerType);
return SPELL_FAILED_UNKNOWN;
}
//check rune cost only if a spell has PowerType == POWER_RUNE
- if(m_spellInfo->powerType == POWER_RUNE)
+ if (m_spellInfo->powerType == POWER_RUNE)
{
SpellCastResult failReason = CheckRuneCost(m_spellInfo->runeCostID);
- if(failReason != SPELL_CAST_OK)
+ if (failReason != SPELL_CAST_OK)
return failReason;
}
// Check power amount
Powers powerType = Powers(m_spellInfo->powerType);
- if(m_caster->GetPower(powerType) < m_powerCost)
+ if (m_caster->GetPower(powerType) < m_powerCost)
return SPELL_FAILED_NO_POWER;
else
return SPELL_CAST_OK;
@@ -5678,24 +5678,24 @@ SpellCastResult Spell::CheckItems()
Player* p_caster = (Player*)m_caster;
- if(!m_CastItem)
+ if (!m_CastItem)
{
- if(m_castItemGUID)
+ if (m_castItemGUID)
return SPELL_FAILED_ITEM_NOT_READY;
}
else
{
uint32 itemid = m_CastItem->GetEntry();
- if( !p_caster->HasItemCount(itemid, 1) )
+ if ( !p_caster->HasItemCount(itemid, 1) )
return SPELL_FAILED_ITEM_NOT_READY;
ItemPrototype const *proto = m_CastItem->GetProto();
- if(!proto)
+ if (!proto)
return SPELL_FAILED_ITEM_NOT_READY;
for (int i = 0; i < 5; ++i)
if (proto->Spells[i].SpellCharges)
- if(m_CastItem->GetSpellCharges(i) == 0)
+ if (m_CastItem->GetSpellCharges(i) == 0)
return SPELL_FAILED_NO_CHARGES_REMAIN;
// consumable cast item checks
@@ -5726,7 +5726,7 @@ SpellCastResult Spell::CheckItems()
// Mana Potion, Rage Potion, Thistle Tea(Rogue), ...
if (m_spellInfo->Effect[i] == SPELL_EFFECT_ENERGIZE)
{
- if(m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS)
+ if (m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS)
{
failReason = SPELL_FAILED_ALREADY_AT_FULL_POWER;
continue;
@@ -5751,26 +5751,26 @@ SpellCastResult Spell::CheckItems()
}
// check target item
- if(m_targets.getItemTargetGUID())
+ if (m_targets.getItemTargetGUID())
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
- if(!m_targets.getItemTarget())
+ if (!m_targets.getItemTarget())
return SPELL_FAILED_ITEM_GONE;
- if(!m_targets.getItemTarget()->IsFitToSpellRequirements(m_spellInfo))
+ if (!m_targets.getItemTarget()->IsFitToSpellRequirements(m_spellInfo))
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
}
// if not item target then required item must be equipped
else
{
- if(m_caster->GetTypeId() == TYPEID_PLAYER && !m_caster->ToPlayer()->HasItemFitToSpellReqirements(m_spellInfo))
+ if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_caster->ToPlayer()->HasItemFitToSpellReqirements(m_spellInfo))
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
}
// check spell focus object
- if(m_spellInfo->RequiresSpellFocus)
+ if (m_spellInfo->RequiresSpellFocus)
{
CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
Cell cell(p);
@@ -5784,7 +5784,7 @@ SpellCastResult Spell::CheckItems()
Map& map = *m_caster->GetMap();
cell.Visit(p, object_checker, map, *m_caster, map.GetVisibilityDistance());
- if(!ok)
+ if (!ok)
return SPELL_FAILED_REQUIRES_SPELL_FOCUS;
focusObject = ok; // game object found in range
@@ -5798,17 +5798,17 @@ SpellCastResult Spell::CheckItems()
{
for (uint32 i=0; i<8; i++)
{
- if(m_spellInfo->Reagent[i] <= 0)
+ if (m_spellInfo->Reagent[i] <= 0)
continue;
uint32 itemid = m_spellInfo->Reagent[i];
uint32 itemcount = m_spellInfo->ReagentCount[i];
// if CastItem is also spell reagent
- if( m_CastItem && m_CastItem->GetEntry() == itemid )
+ if ( m_CastItem && m_CastItem->GetEntry() == itemid )
{
ItemPrototype const *proto = m_CastItem->GetProto();
- if(!proto)
+ if (!proto)
return SPELL_FAILED_ITEM_NOT_READY;
for (int s=0; s < MAX_ITEM_PROTO_SPELLS; ++s)
{
@@ -5821,7 +5821,7 @@ SpellCastResult Spell::CheckItems()
}
}
}
- if( !p_caster->HasItemCount(itemid,itemcount) )
+ if ( !p_caster->HasItemCount(itemid,itemcount) )
return SPELL_FAILED_ITEM_NOT_READY; //0x54
}
}
@@ -5830,9 +5830,9 @@ SpellCastResult Spell::CheckItems()
uint32 totems = 2;
for (int i = 0; i < 2 ; ++i)
{
- if(m_spellInfo->Totem[i] != 0)
+ if (m_spellInfo->Totem[i] != 0)
{
- if( p_caster->HasItemCount(m_spellInfo->Totem[i],1) )
+ if ( p_caster->HasItemCount(m_spellInfo->Totem[i],1) )
{
totems -= 1;
continue;
@@ -5840,16 +5840,16 @@ SpellCastResult Spell::CheckItems()
}else
totems -= 1;
}
- if(totems != 0)
+ if (totems != 0)
return SPELL_FAILED_TOTEMS; //0x7C
// Check items for TotemCategory (items presence in inventory)
uint32 TotemCategory = 2;
for (int i= 0; i < 2; ++i)
{
- if(m_spellInfo->TotemCategory[i] != 0)
+ if (m_spellInfo->TotemCategory[i] != 0)
{
- if( p_caster->HasItemTotemCategory(m_spellInfo->TotemCategory[i]) )
+ if ( p_caster->HasItemTotemCategory(m_spellInfo->TotemCategory[i]) )
{
TotemCategory -= 1;
continue;
@@ -5858,7 +5858,7 @@ SpellCastResult Spell::CheckItems()
else
TotemCategory -= 1;
}
- if(TotemCategory != 0)
+ if (TotemCategory != 0)
return SPELL_FAILED_TOTEM_CATEGORY; //0x7B
}
@@ -5896,7 +5896,7 @@ SpellCastResult Spell::CheckItems()
break;
}
case SPELL_EFFECT_ENCHANT_ITEM:
- if(m_spellInfo->EffectItemType[i] && m_targets.getItemTarget()
+ if (m_spellInfo->EffectItemType[i] && m_targets.getItemTarget()
&& (m_targets.getItemTarget()->IsWeaponVellum() || m_targets.getItemTarget()->IsArmorVellum()))
{
// cannot enchant vellum for other player
@@ -5916,17 +5916,17 @@ SpellCastResult Spell::CheckItems()
case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC:
{
Item* targetItem = m_targets.getItemTarget();
- if(!targetItem)
+ if (!targetItem)
return SPELL_FAILED_ITEM_NOT_FOUND;
- if( targetItem->GetProto()->ItemLevel < m_spellInfo->baseLevel )
+ if ( targetItem->GetProto()->ItemLevel < m_spellInfo->baseLevel )
return SPELL_FAILED_LOWLEVEL;
// Not allow enchant in trade slot for some enchant type
- if( targetItem->GetOwner() != m_caster )
+ if ( targetItem->GetOwner() != m_caster )
{
uint32 enchant_id = m_spellInfo->EffectMiscValue[i];
SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
- if(!pEnchant)
+ if (!pEnchant)
return SPELL_FAILED_ERROR;
if (pEnchant->slot & ENCHANTMENT_CAN_SOULBOUND)
return SPELL_FAILED_NOT_TRADEABLE;
@@ -5936,14 +5936,14 @@ SpellCastResult Spell::CheckItems()
case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
{
Item *item = m_targets.getItemTarget();
- if(!item)
+ if (!item)
return SPELL_FAILED_ITEM_NOT_FOUND;
// Not allow enchant in trade slot for some enchant type
- if( item->GetOwner() != m_caster )
+ if ( item->GetOwner() != m_caster )
{
uint32 enchant_id = m_spellInfo->EffectMiscValue[i];
SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
- if(!pEnchant)
+ if (!pEnchant)
return SPELL_FAILED_ERROR;
if (pEnchant->slot & ENCHANTMENT_CAN_SOULBOUND)
return SPELL_FAILED_NOT_TRADEABLE;
@@ -5955,15 +5955,15 @@ SpellCastResult Spell::CheckItems()
break;
case SPELL_EFFECT_DISENCHANT:
{
- if(!m_targets.getItemTarget())
+ if (!m_targets.getItemTarget())
return SPELL_FAILED_CANT_BE_DISENCHANTED;
// prevent disenchanting in trade slot
- if( m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID() )
+ if ( m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID() )
return SPELL_FAILED_CANT_BE_DISENCHANTED;
ItemPrototype const* itemProto = m_targets.getItemTarget()->GetProto();
- if(!itemProto)
+ if (!itemProto)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
uint32 item_quality = itemProto->Quality;
@@ -5973,9 +5973,9 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_CANT_BE_DISENCHANTED;
if (item_disenchantskilllevel > p_caster->GetSkillValue(SKILL_ENCHANTING))
return SPELL_FAILED_LOW_CASTLEVEL;
- if(item_quality > 4 || item_quality < 2)
+ if (item_quality > 4 || item_quality < 2)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
- if(itemProto->Class != ITEM_CLASS_WEAPON && itemProto->Class != ITEM_CLASS_ARMOR)
+ if (itemProto->Class != ITEM_CLASS_WEAPON && itemProto->Class != ITEM_CLASS_ARMOR)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
if (!itemProto->DisenchantID)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
@@ -5983,46 +5983,46 @@ SpellCastResult Spell::CheckItems()
}
case SPELL_EFFECT_PROSPECTING:
{
- if(!m_targets.getItemTarget())
+ if (!m_targets.getItemTarget())
return SPELL_FAILED_CANT_BE_PROSPECTED;
//ensure item is a prospectable ore
- if(!(m_targets.getItemTarget()->GetProto()->BagFamily & BAG_FAMILY_MASK_MINING_SUPP) || m_targets.getItemTarget()->GetProto()->Class != ITEM_CLASS_TRADE_GOODS)
+ if (!(m_targets.getItemTarget()->GetProto()->BagFamily & BAG_FAMILY_MASK_MINING_SUPP) || m_targets.getItemTarget()->GetProto()->Class != ITEM_CLASS_TRADE_GOODS)
return SPELL_FAILED_CANT_BE_PROSPECTED;
//prevent prospecting in trade slot
- if( m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID() )
+ if ( m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID() )
return SPELL_FAILED_CANT_BE_PROSPECTED;
//Check for enough skill in jewelcrafting
uint32 item_prospectingskilllevel = m_targets.getItemTarget()->GetProto()->RequiredSkillRank;
- if(item_prospectingskilllevel >p_caster->GetSkillValue(SKILL_JEWELCRAFTING))
+ if (item_prospectingskilllevel >p_caster->GetSkillValue(SKILL_JEWELCRAFTING))
return SPELL_FAILED_LOW_CASTLEVEL;
//make sure the player has the required ores in inventory
- if(m_targets.getItemTarget()->GetCount() < 5)
+ if (m_targets.getItemTarget()->GetCount() < 5)
return SPELL_FAILED_NEED_MORE_ITEMS;
- if(!LootTemplates_Prospecting.HaveLootFor(m_targets.getItemTargetEntry()))
+ if (!LootTemplates_Prospecting.HaveLootFor(m_targets.getItemTargetEntry()))
return SPELL_FAILED_CANT_BE_PROSPECTED;
break;
}
case SPELL_EFFECT_MILLING:
{
- if(!m_targets.getItemTarget())
+ if (!m_targets.getItemTarget())
return SPELL_FAILED_CANT_BE_MILLED;
//ensure item is a millable herb
- if(!(m_targets.getItemTarget()->GetProto()->BagFamily & BAG_FAMILY_MASK_HERBS) || m_targets.getItemTarget()->GetProto()->Class != ITEM_CLASS_TRADE_GOODS)
+ if (!(m_targets.getItemTarget()->GetProto()->BagFamily & BAG_FAMILY_MASK_HERBS) || m_targets.getItemTarget()->GetProto()->Class != ITEM_CLASS_TRADE_GOODS)
return SPELL_FAILED_CANT_BE_MILLED;
//prevent milling in trade slot
- if( m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID() )
+ if ( m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID() )
return SPELL_FAILED_CANT_BE_MILLED;
//Check for enough skill in inscription
uint32 item_millingskilllevel = m_targets.getItemTarget()->GetProto()->RequiredSkillRank;
- if(item_millingskilllevel >p_caster->GetSkillValue(SKILL_INSCRIPTION))
+ if (item_millingskilllevel >p_caster->GetSkillValue(SKILL_INSCRIPTION))
return SPELL_FAILED_LOW_CASTLEVEL;
//make sure the player has the required herbs in inventory
- if(m_targets.getItemTarget()->GetCount() < 5)
+ if (m_targets.getItemTarget()->GetCount() < 5)
return SPELL_FAILED_NEED_MORE_ITEMS;
- if(!LootTemplates_Milling.HaveLootFor(m_targets.getItemTargetEntry()))
+ if (!LootTemplates_Milling.HaveLootFor(m_targets.getItemTargetEntry()))
return SPELL_FAILED_CANT_BE_MILLED;
break;
@@ -6030,11 +6030,11 @@ SpellCastResult Spell::CheckItems()
case SPELL_EFFECT_WEAPON_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER;
- if( m_attackType != RANGED_ATTACK )
+ if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER;
+ if ( m_attackType != RANGED_ATTACK )
break;
Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType);
- if(!pItem || pItem->IsBroken())
+ if (!pItem || pItem->IsBroken())
return SPELL_FAILED_EQUIPPED_ITEM;
switch(pItem->GetProto()->SubClass)
@@ -6042,7 +6042,7 @@ SpellCastResult Spell::CheckItems()
case ITEM_SUBCLASS_WEAPON_THROWN:
{
uint32 ammo = pItem->GetEntry();
- if( !m_caster->ToPlayer()->HasItemCount( ammo, 1 ) )
+ if ( !m_caster->ToPlayer()->HasItemCount( ammo, 1 ) )
return SPELL_FAILED_NO_AMMO;
}; break;
case ITEM_SUBCLASS_WEAPON_GUN:
@@ -6050,20 +6050,20 @@ SpellCastResult Spell::CheckItems()
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
{
uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID);
- if(!ammo)
+ if (!ammo)
{
// Requires No Ammo
- if(m_caster->HasAura(46699))
+ if (m_caster->HasAura(46699))
break; // skip other checks
return SPELL_FAILED_NO_AMMO;
}
ItemPrototype const *ammoProto = objmgr.GetItemPrototype( ammo );
- if(!ammoProto)
+ if (!ammoProto)
return SPELL_FAILED_NO_AMMO;
- if(ammoProto->Class != ITEM_CLASS_PROJECTILE)
+ if (ammoProto->Class != ITEM_CLASS_PROJECTILE)
return SPELL_FAILED_NO_AMMO;
// check ammo ws. weapon compatibility
@@ -6071,18 +6071,18 @@ SpellCastResult Spell::CheckItems()
{
case ITEM_SUBCLASS_WEAPON_BOW:
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
- if(ammoProto->SubClass != ITEM_SUBCLASS_ARROW)
+ if (ammoProto->SubClass != ITEM_SUBCLASS_ARROW)
return SPELL_FAILED_NO_AMMO;
break;
case ITEM_SUBCLASS_WEAPON_GUN:
- if(ammoProto->SubClass != ITEM_SUBCLASS_BULLET)
+ if (ammoProto->SubClass != ITEM_SUBCLASS_BULLET)
return SPELL_FAILED_NO_AMMO;
break;
default:
return SPELL_FAILED_NO_AMMO;
}
- if( !m_caster->ToPlayer()->HasItemCount( ammo, 1 ) )
+ if ( !m_caster->ToPlayer()->HasItemCount( ammo, 1 ) )
return SPELL_FAILED_NO_AMMO;
}; break;
case ITEM_SUBCLASS_WEAPON_WAND:
@@ -6114,33 +6114,33 @@ SpellCastResult Spell::CheckItems()
}
// check weapon presence in slots for main/offhand weapons
- if(m_spellInfo->EquippedItemClass >=0)
+ if (m_spellInfo->EquippedItemClass >=0)
{
// main hand weapon required
- if(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_MAIN_HAND)
+ if (m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_MAIN_HAND)
{
Item* item = m_caster->ToPlayer()->GetWeaponForAttack(BASE_ATTACK);
// skip spell if no weapon in slot or broken
- if(!item || item->IsBroken() )
+ if (!item || item->IsBroken() )
return m_IsTriggeredSpell? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS;
// skip spell if weapon not fit to triggered spell
- if(!item->IsFitToSpellRequirements(m_spellInfo))
+ if (!item->IsFitToSpellRequirements(m_spellInfo))
return m_IsTriggeredSpell? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS;
}
// offhand hand weapon required
- if(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_REQ_OFFHAND)
+ if (m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_REQ_OFFHAND)
{
Item* item = m_caster->ToPlayer()->GetWeaponForAttack(OFF_ATTACK);
// skip spell if no weapon in slot or broken
- if(!item || item->IsBroken() )
+ if (!item || item->IsBroken() )
return m_IsTriggeredSpell? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS;
// skip spell if weapon not fit to triggered spell
- if(!item->IsFitToSpellRequirements(m_spellInfo))
+ if (!item->IsFitToSpellRequirements(m_spellInfo))
return m_IsTriggeredSpell? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS;
}
}
@@ -6150,17 +6150,17 @@ SpellCastResult Spell::CheckItems()
void Spell::Delayed() // only called in DealDamage()
{
- if(!m_caster)// || m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (!m_caster)// || m_caster->GetTypeId() != TYPEID_PLAYER)
return;
//if (m_spellState == SPELL_STATE_DELAYED)
// return; // spell is active and can't be time-backed
- if(isDelayableNoMore()) // Spells may only be delayed twice
+ if (isDelayableNoMore()) // Spells may only be delayed twice
return;
// spells not loosing casting time ( slam, dynamites, bombs.. )
- //if(!(m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_DAMAGE))
+ //if (!(m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_DAMAGE))
// return;
//check pushback reduce
@@ -6168,12 +6168,12 @@ void Spell::Delayed() // only called in DealDamage()
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
- if(delayReduce >= 100)
+ if (delayReduce >= 100)
return;
delaytime = delaytime * (100 - delayReduce) / 100;
- if(int32(m_timer) + delaytime > m_casttime)
+ if (int32(m_timer) + delaytime > m_casttime)
{
delaytime = m_casttime - m_timer;
m_timer = m_casttime;
@@ -6203,12 +6203,12 @@ void Spell::DelayedChannel()
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
- if(delayReduce >= 100)
+ if (delayReduce >= 100)
return;
delaytime = delaytime * (100 - delayReduce) / 100;
- if(int32(m_timer) <= delaytime)
+ if (int32(m_timer) <= delaytime)
{
delaytime = m_timer;
m_timer = 0;
@@ -6224,7 +6224,7 @@ void Spell::DelayedChannel()
unit->DelayOwnedAuras(m_spellInfo->Id, m_originalCasterGUID, delaytime);
// partially interrupt persistent area auras
- if(DynamicObject* dynObj = m_caster->GetDynObject(m_spellInfo->Id))
+ if (DynamicObject* dynObj = m_caster->GetDynObject(m_spellInfo->Id))
dynObj->Delay(delaytime);
SendChannelUpdate(m_timer);
@@ -6232,7 +6232,7 @@ void Spell::DelayedChannel()
void Spell::UpdatePointers()
{
- if(m_originalCasterGUID == m_caster->GetGUID())
+ if (m_originalCasterGUID == m_caster->GetGUID())
m_originalCaster = m_caster;
else
{
@@ -6255,14 +6255,14 @@ bool Spell::CheckTargetCreatureType(Unit* target) const
if (m_spellInfo->SpellFamilyName==SPELLFAMILY_WARLOCK && m_spellInfo->Category == 1179)
{
// not allow cast at player
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
return false;
spellCreatureTargetMask = 0x7FF;
}
// Dismiss Pet and Taming Lesson skipped
- if(m_spellInfo->Id == 2641 || m_spellInfo->Id == 23356)
+ if (m_spellInfo->Id == 2641 || m_spellInfo->Id == 23356)
spellCreatureTargetMask = 0;
// Polymorph and Grounding Totem
@@ -6293,14 +6293,14 @@ CurrentSpellTypes Spell::GetCurrentContainer()
bool Spell::CheckTarget(Unit* target, uint32 eff)
{
// Check targets for creature type mask and remove not appropriate (skip explicit self target case, maybe need other explicit targets)
- if(m_spellInfo->EffectImplicitTargetA[eff] != TARGET_UNIT_CASTER)
+ if (m_spellInfo->EffectImplicitTargetA[eff] != TARGET_UNIT_CASTER)
{
if (!CheckTargetCreatureType(target))
return false;
}
// Check Aura spell req (need for AoE spells)
- if(m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell))
+ if (m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell))
return false;
if (m_spellInfo->excludeTargetAuraSpell && target->HasAura(m_spellInfo->excludeTargetAuraSpell))
return false;
@@ -6315,19 +6315,19 @@ bool Spell::CheckTarget(Unit* target, uint32 eff)
// unselectable targets skipped in all cases except TARGET_UNIT_NEARBY_ENTRY targeting
// in case TARGET_UNIT_NEARBY_ENTRY target selected by server always and can't be cheated
- /*if( target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) &&
+ /*if ( target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) &&
m_spellInfo->EffectImplicitTargetA[eff] != TARGET_UNIT_NEARBY_ENTRY &&
m_spellInfo->EffectImplicitTargetB[eff] != TARGET_UNIT_NEARBY_ENTRY )
return false;*/
}
//Check player targets and remove if in GM mode or GM invisibility (for not self casting case)
- if( target != m_caster && target->GetTypeId() == TYPEID_PLAYER)
+ if ( target != m_caster && target->GetTypeId() == TYPEID_PLAYER)
{
- if(target->ToPlayer()->GetVisibility() == VISIBILITY_OFF)
+ if (target->ToPlayer()->GetVisibility() == VISIBILITY_OFF)
return false;
- if(target->ToPlayer()->isGameMaster() && !IsPositiveSpell(m_spellInfo->Id))
+ if (target->ToPlayer()->isGameMaster() && !IsPositiveSpell(m_spellInfo->Id))
return false;
}
@@ -6340,18 +6340,18 @@ bool Spell::CheckTarget(Unit* target, uint32 eff)
case SPELL_AURA_MOD_CHARM:
case SPELL_AURA_MOD_POSSESS_PET:
case SPELL_AURA_AOE_CHARM:
- if(target->GetTypeId() == TYPEID_UNIT && target->IsVehicle())
+ if (target->GetTypeId() == TYPEID_UNIT && target->IsVehicle())
return false;
- if(target->GetCharmerGUID())
+ if (target->GetCharmerGUID())
return false;
- if(int32 damage = CalculateDamage(eff, target))
- if((int32)target->getLevel() > damage)
+ if (int32 damage = CalculateDamage(eff, target))
+ if ((int32)target->getLevel() > damage)
return false;
break;
}
//Do not do further checks for triggered spells
- if(m_IsTriggeredSpell)
+ if (m_IsTriggeredSpell)
return true;
//Check targets for LOS visibility (except spells without range limitations )
@@ -6360,24 +6360,24 @@ bool Spell::CheckTarget(Unit* target, uint32 eff)
case SPELL_EFFECT_SUMMON_PLAYER: // from anywhere
break;
case SPELL_EFFECT_DUMMY:
- if(m_spellInfo->Id != 20577) // Cannibalize
+ if (m_spellInfo->Id != 20577) // Cannibalize
break;
//fall through
case SPELL_EFFECT_RESURRECT_NEW:
// player far away, maybe his corpse near?
- if(target != m_caster && !target->IsWithinLOSInMap(m_caster))
+ if (target != m_caster && !target->IsWithinLOSInMap(m_caster))
{
- if(!m_targets.getCorpseTargetGUID())
+ if (!m_targets.getCorpseTargetGUID())
return false;
Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID());
- if(!corpse)
+ if (!corpse)
return false;
- if(target->GetGUID() != corpse->GetOwnerGUID())
+ if (target->GetGUID() != corpse->GetOwnerGUID())
return false;
- if(!corpse->IsWithinLOSInMap(m_caster))
+ if (!corpse->IsWithinLOSInMap(m_caster))
return false;
}
@@ -6390,9 +6390,9 @@ bool Spell::CheckTarget(Unit* target, uint32 eff)
caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID);
if (!caster)
caster = m_caster;
- if(target->GetEntry() == 5925)
+ if (target->GetEntry() == 5925)
return true;
- if(target != m_caster && !target->IsWithinLOSInMap(caster))
+ if (target != m_caster && !target->IsWithinLOSInMap(caster))
return false;
break;
}
@@ -6409,15 +6409,15 @@ bool Spell::IsNeedSendToClient() const
bool Spell::HaveTargetsForEffect( uint8 effect ) const
{
for (std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr)
- if(itr->effectMask & (1 << effect))
+ if (itr->effectMask & (1 << effect))
return true;
for (std::list<GOTargetInfo>::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr)
- if(itr->effectMask & (1 << effect))
+ if (itr->effectMask & (1 << effect))
return true;
for (std::list<ItemTargetInfo>::const_iterator itr = m_UniqueItemInfo.begin(); itr != m_UniqueItemInfo.end(); ++itr)
- if(itr->effectMask & (1 << effect))
+ if (itr->effectMask & (1 << effect))
return true;
return false;
@@ -6569,10 +6569,10 @@ bool Spell::IsValidSingleTargetSpell(Unit const* target) const
}
for (uint8 i = 0; i < 3; ++i)
{
- if(!IsValidSingleTargetEffect(target, Targets(m_spellInfo->EffectImplicitTargetA[i])))
+ if (!IsValidSingleTargetEffect(target, Targets(m_spellInfo->EffectImplicitTargetA[i])))
return false;
// Need to check B?
- //if(!IsValidSingleTargetEffect(m_spellInfo->EffectImplicitTargetB[i], target)
+ //if (!IsValidSingleTargetEffect(m_spellInfo->EffectImplicitTargetB[i], target)
// return false;
}
return true;
@@ -6588,8 +6588,8 @@ void Spell::CalculateDamageDoneForAllTargets()
// Get multiplier
multiplier[i] = m_spellInfo->DmgMultiplier[i];
// Apply multiplier mods
- if(m_originalCaster)
- if(Player* modOwner = m_originalCaster->GetSpellModOwner())
+ if (m_originalCaster)
+ if (Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_EFFECT_PAST_FIRST, multiplier[i], this);
}
}
@@ -6598,7 +6598,7 @@ void Spell::CalculateDamageDoneForAllTargets()
Unit::AuraEffectList const& Auras = m_caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_CONSUME_NO_AMMO);
for (Unit::AuraEffectList::const_iterator j = Auras.begin(); j != Auras.end(); ++j)
{
- if((*j)->IsAffectedOnSpell(m_spellInfo))
+ if ((*j)->IsAffectedOnSpell(m_spellInfo))
usesAmmo=false;
}
@@ -6679,11 +6679,11 @@ int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float *mul
break;
}
- if(m_damage > 0)
+ if (m_damage > 0)
{
- if(IsAreaEffectTarget[m_spellInfo->EffectImplicitTargetA[i]] || IsAreaEffectTarget[m_spellInfo->EffectImplicitTargetB[i]])
+ if (IsAreaEffectTarget[m_spellInfo->EffectImplicitTargetA[i]] || IsAreaEffectTarget[m_spellInfo->EffectImplicitTargetB[i]])
{
- if(int32 reducedPct = unit->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE))
+ if (int32 reducedPct = unit->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE))
m_damage = m_damage * (100 + reducedPct) / 100;
if (m_caster->GetTypeId() == TYPEID_PLAYER)
@@ -6694,7 +6694,7 @@ int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float *mul
}
}
}
- if(m_applyMultiplierMask & (1 << i))
+ if (m_applyMultiplierMask & (1 << i))
{
m_damage *= m_damageMultipliers[i];
m_damageMultipliers[i] *= multiplier[i];
@@ -6709,7 +6709,7 @@ int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float *mul
SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& skillId, int32& reqSkillValue, int32& skillValue)
{
- if(!lockId) // possible case for GO and maybe for items.
+ if (!lockId) // possible case for GO and maybe for items.
return SPELL_CAST_OK;
// Get LockInfo
@@ -6726,7 +6726,7 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
{
// check key item (many fit cases can be)
case LOCK_KEY_ITEM:
- if(lockInfo->Index[j] && m_CastItem && m_CastItem->GetEntry()==lockInfo->Index[j])
+ if (lockInfo->Index[j] && m_CastItem && m_CastItem->GetEntry()==lockInfo->Index[j])
return SPELL_CAST_OK;
reqKey = true;
break;
@@ -6736,7 +6736,7 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
reqKey = true;
// wrong locktype, skip
- if(uint32(m_spellInfo->EffectMiscValue[effIndex]) != lockInfo->Index[j])
+ if (uint32(m_spellInfo->EffectMiscValue[effIndex]) != lockInfo->Index[j])
continue;
skillId = SkillByLockType(LockType(lockInfo->Index[j]));
@@ -6763,7 +6763,7 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
}
}
- if(reqKey)
+ if (reqKey)
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
@@ -6797,12 +6797,12 @@ void Spell::SetSpellValue(SpellValueMod mod, int32 value)
float tangent(float x)
{
x = tan(x);
- //if(x < std::numeric_limits<float>::max() && x > -std::numeric_limits<float>::max()) return x;
- //if(x >= std::numeric_limits<float>::max()) return std::numeric_limits<float>::max();
- //if(x <= -std::numeric_limits<float>::max()) return -std::numeric_limits<float>::max();
- if(x < 100000.0f && x > -100000.0f) return x;
- if(x >= 100000.0f) return 100000.0f;
- if(x <= 100000.0f) return -100000.0f;
+ //if (x < std::numeric_limits<float>::max() && x > -std::numeric_limits<float>::max()) return x;
+ //if (x >= std::numeric_limits<float>::max()) return std::numeric_limits<float>::max();
+ //if (x <= -std::numeric_limits<float>::max()) return -std::numeric_limits<float>::max();
+ if (x < 100000.0f && x > -100000.0f) return x;
+ if (x >= 100000.0f) return 100000.0f;
+ if (x <= 100000.0f) return -100000.0f;
return 0.0f;
}
@@ -6810,25 +6810,25 @@ float tangent(float x)
void Spell::SelectTrajTargets()
{
- if(!m_targets.HasTraj())
+ if (!m_targets.HasTraj())
return;
float dist2d = m_targets.GetDist2d();
- if(!dist2d)
+ if (!dist2d)
return;
float dz = m_targets.m_dstPos.m_positionZ - m_targets.m_srcPos.m_positionZ;
UnitList unitList;
SearchAreaTarget(unitList, dist2d, PUSH_IN_THIN_LINE, SPELL_TARGETS_ANY);
- if(unitList.empty())
+ if (unitList.empty())
return;
unitList.sort(TargetDistanceOrder(m_caster));
float b = tangent(m_targets.m_elevation);
float a = (dz - dist2d * b) / (dist2d * dist2d);
- if(a > -0.0001f) a = 0;
+ if (a > -0.0001f) a = 0;
DEBUG_TRAJ(sLog.outError("Spell::SelectTrajTargets: a %f b %f", a, b);)
float bestDist = GetSpellMaxRange(m_spellInfo, false);
@@ -6836,7 +6836,7 @@ void Spell::SelectTrajTargets()
UnitList::const_iterator itr = unitList.begin();
for (; itr != unitList.end(); ++itr)
{
- if(m_caster == *itr || m_caster->IsOnVehicle(*itr) || (*itr)->GetVehicle())//(*itr)->IsOnVehicle(m_caster))
+ if (m_caster == *itr || m_caster->IsOnVehicle(*itr) || (*itr)->GetVehicle())//(*itr)->IsOnVehicle(m_caster))
continue;
const float size = std::max((*itr)->GetObjectSize() * 0.7f, 1.0f); // 1/sqrt(3)
@@ -6849,7 +6849,7 @@ void Spell::SelectTrajTargets()
float dist = objDist2d - size;
float height = dist * (a * dist + b);
DEBUG_TRAJ(sLog.outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)
- if(dist < bestDist && height < dz + size && height > dz - size)
+ if (dist < bestDist && height < dz + size && height > dz - size)
{
bestDist = dist > 0 ? dist : 0;
break;
@@ -6857,11 +6857,11 @@ void Spell::SelectTrajTargets()
#define CHECK_DIST {\
DEBUG_TRAJ(sLog.outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\
- if(dist > bestDist) continue;\
- if(dist < objDist2d + size && dist > objDist2d - size) { bestDist = dist; break; }\
+ if (dist > bestDist) continue;\
+ if (dist < objDist2d + size && dist > objDist2d - size) { bestDist = dist; break; }\
}
- if(!a)
+ if (!a)
{
height = dz - size;
dist = height / b;
@@ -6876,7 +6876,7 @@ void Spell::SelectTrajTargets()
height = dz - size;
float sqrt1 = b * b + 4 * a * height;
- if(sqrt1 > 0)
+ if (sqrt1 > 0)
{
sqrt1 = sqrt(sqrt1);
dist = (sqrt1 - b) / (2 * a);
@@ -6885,7 +6885,7 @@ void Spell::SelectTrajTargets()
height = dz + size;
float sqrt2 = b * b + 4 * a * height;
- if(sqrt2 > 0)
+ if (sqrt2 > 0)
{
sqrt2 = sqrt(sqrt2);
dist = (sqrt2 - b) / (2 * a);
@@ -6895,26 +6895,26 @@ void Spell::SelectTrajTargets()
CHECK_DIST;
}
- if(sqrt1 > 0)
+ if (sqrt1 > 0)
{
dist = (-sqrt1 - b) / (2 * a);
CHECK_DIST;
}
}
- if(m_targets.m_srcPos.GetExactDist2d(&m_targets.m_dstPos) > bestDist)
+ if (m_targets.m_srcPos.GetExactDist2d(&m_targets.m_dstPos) > bestDist)
{
float x = m_targets.m_srcPos.m_positionX + cos(m_caster->GetOrientation()) * bestDist;
float y = m_targets.m_srcPos.m_positionY + sin(m_caster->GetOrientation()) * bestDist;
float z = m_targets.m_srcPos.m_positionZ + bestDist * (a * bestDist + b);
- if(itr != unitList.end())
+ if (itr != unitList.end())
{
float distSq = (*itr)->GetExactDistSq(x, y, z);
float sizeSq = (*itr)->GetObjectSize();
sizeSq *= sizeSq;
DEBUG_TRAJ(sLog.outError("Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);)
- if(distSq > sizeSq)
+ if (distSq > sizeSq)
{
float factor = 1 - sqrt(sizeSq / distSq);
x += factor * ((*itr)->GetPositionX() - x);
diff --git a/src/game/Spell.h b/src/game/Spell.h
index 71815d4eef4..108765629e9 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -182,7 +182,7 @@ class SpellCastTargets
void setItemTarget(Item* item);
void updateTradeSlotItem()
{
- if(m_itemTarget && (m_targetMask & TARGET_FLAG_TRADE_ITEM))
+ if (m_itemTarget && (m_targetMask & TARGET_FLAG_TRADE_ITEM))
{
m_itemTargetGUID = m_itemTarget->GetGUID();
m_itemTargetEntry = m_itemTarget->GetEntry();
@@ -443,8 +443,8 @@ class Spell
bool CheckTarget( Unit* target, uint32 eff );
bool CanAutoCast(Unit* target);
- void CheckSrc() { if(!m_targets.HasSrc()) m_targets.setSrc(m_caster); }
- void CheckDst() { if(!m_targets.HasDst()) m_targets.setDst(m_caster); }
+ void CheckSrc() { if (!m_targets.HasSrc()) m_targets.setSrc(m_caster); }
+ void CheckDst() { if (!m_targets.HasDst()) m_targets.setDst(m_caster); }
static void SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 cast_count, SpellCastResult result);
void SendCastResult(SpellCastResult result);
@@ -538,7 +538,7 @@ class Spell
uint8 m_delayAtDamageCount;
bool isDelayableNoMore()
{
- if(m_delayAtDamageCount >= 2)
+ if (m_delayAtDamageCount >= 2)
return true;
m_delayAtDamageCount++;
@@ -706,35 +706,35 @@ namespace Trinity
{
Unit *target = (Unit*)itr->getSource();
- if(!target->InSamePhase(i_source))
+ if (!target->InSamePhase(i_source))
continue;
switch (i_TargetType)
{
case SPELL_TARGETS_ENEMY:
- if(target->isTotem())
+ if (target->isTotem())
continue;
- if(!target->isAttackableByAOE())
+ if (!target->isAttackableByAOE())
continue;
- if(i_source->IsControlledByPlayer())
+ if (i_source->IsControlledByPlayer())
{
- if(i_source->IsFriendlyTo(target))
+ if (i_source->IsFriendlyTo(target))
continue;
}
else
{
- if(!i_source->IsHostileTo(target))
+ if (!i_source->IsHostileTo(target))
continue;
}
break;
case SPELL_TARGETS_ALLY:
- if(target->isTotem())
+ if (target->isTotem())
continue;
- if(!target->isAttackableByAOE() || !i_source->IsFriendlyTo(target))
+ if (!target->isAttackableByAOE() || !i_source->IsFriendlyTo(target))
continue;
break;
case SPELL_TARGETS_ENTRY:
- if(target->GetEntry()!= i_entry)
+ if (target->GetEntry()!= i_entry)
continue;
break;
case SPELL_TARGETS_ANY:
@@ -748,23 +748,23 @@ namespace Trinity
case PUSH_DST_CENTER:
case PUSH_CHAIN:
default:
- if(target->IsWithinDist3d(i_pos, i_radius))
+ if (target->IsWithinDist3d(i_pos, i_radius))
i_data->push_back(target);
break;
case PUSH_IN_FRONT:
- if(i_source->isInFront(target, i_radius, M_PI/3))
+ if (i_source->isInFront(target, i_radius, M_PI/3))
i_data->push_back(target);
break;
case PUSH_IN_BACK:
- if(i_source->isInBack(target, i_radius, M_PI/3))
+ if (i_source->isInBack(target, i_radius, M_PI/3))
i_data->push_back(target);
break;
case PUSH_IN_LINE:
- if(i_source->HasInLine(target, i_radius, i_source->GetObjectSize()))
+ if (i_source->HasInLine(target, i_radius, i_source->GetObjectSize()))
i_data->push_back(target);
break;
case PUSH_IN_THIN_LINE: // only traj
- if(i_pos->HasInLine(target, i_radius, 0))
+ if (i_pos->HasInLine(target, i_radius, 0))
i_data->push_back(target);
break;
}
diff --git a/src/game/SpellAuraEffects.cpp b/src/game/SpellAuraEffects.cpp
index 02a25fd3f6e..c3c64f00beb 100644
--- a/src/game/SpellAuraEffects.cpp
+++ b/src/game/SpellAuraEffects.cpp
@@ -397,7 +397,7 @@ void AuraEffect::GetTargetList(std::list<Unit *> & targetList) const
// remove all targets which were not added to new list - they no longer deserve area aura
for (Aura::ApplicationMap::const_iterator appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter)
{
- if(appIter->second->HasEffect(GetEffIndex()))
+ if (appIter->second->HasEffect(GetEffIndex()))
targetList.push_back(appIter->second->GetTarget());
}
}
@@ -406,35 +406,35 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
{
int32 amount;
// default amount calculation
- if(caster)
+ if (caster)
amount = caster->CalculateSpellDamage(m_spellProto, m_effIndex, m_baseAmount, NULL);
else
amount = m_baseAmount + m_spellProto->EffectBaseDice[m_effIndex];
// check item enchant aura cast
- if(!amount && caster)
- if(uint64 itemGUID = GetBase()->GetCastItemGUID())
- if(Player *playerCaster = dynamic_cast<Player*>(caster))
- if(Item *castItem = playerCaster->GetItemByGuid(itemGUID))
+ if (!amount && caster)
+ if (uint64 itemGUID = GetBase()->GetCastItemGUID())
+ if (Player *playerCaster = dynamic_cast<Player*>(caster))
+ if (Item *castItem = playerCaster->GetItemByGuid(itemGUID))
if (castItem->GetItemSuffixFactor())
{
ItemRandomSuffixEntry const *item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId()));
- if(item_rand_suffix)
+ if (item_rand_suffix)
{
for (int k=0; k<MAX_SPELL_EFFECTS; k++)
{
SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->enchant_id[k]);
- if(pEnchant)
+ if (pEnchant)
{
for (int t=0; t<MAX_SPELL_EFFECTS; t++)
- if(pEnchant->spellid[t] == m_spellProto->Id)
+ if (pEnchant->spellid[t] == m_spellProto->Id)
{
amount = uint32((item_rand_suffix->prefix[k]*castItem->GetItemSuffixFactor()) / 10000 );
break;
}
}
- if(amount)
+ if (amount)
break;
}
}
@@ -461,7 +461,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
Unit::AuraEffectList const& overrideClassScripts = caster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (Unit::AuraEffectList::const_iterator itr = overrideClassScripts.begin(); itr != overrideClassScripts.end(); ++itr)
{
- if((*itr)->IsAffectedOnSpell(m_spellProto))
+ if ((*itr)->IsAffectedOnSpell(m_spellProto))
{
// Glyph of Fear, Glyph of Frost nova and similar auras
if ((*itr)->GetMiscValue() == 7801)
@@ -481,7 +481,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
{
case SPELLFAMILY_MAGE:
// Ice Barrier
- if(GetSpellProto()->SpellFamilyFlags[1] & 0x1 && GetSpellProto()->SpellFamilyFlags[2] & 0x8)
+ if (GetSpellProto()->SpellFamilyFlags[1] & 0x1 && GetSpellProto()->SpellFamilyFlags[2] & 0x8)
{
// +80.67% from sp bonus
DoneActualBenefit += caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.8067f;
@@ -489,7 +489,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
break;
case SPELLFAMILY_WARLOCK:
// Shadow Ward
- if(m_spellProto->SpellFamilyFlags[2]& 0x40)
+ if (m_spellProto->SpellFamilyFlags[2]& 0x40)
{
// +30% from sp bonus
DoneActualBenefit += caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.3f;
@@ -497,7 +497,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
break;
case SPELLFAMILY_PRIEST:
// Power Word: Shield
- if(GetSpellProto()->SpellFamilyFlags[0] & 0x1 && GetSpellProto()->SpellFamilyFlags[2] & 0x400)
+ if (GetSpellProto()->SpellFamilyFlags[0] & 0x1 && GetSpellProto()->SpellFamilyFlags[2] & 0x400)
{
//+80.68% from sp bonus
float bonus = 0.8068f;
@@ -523,7 +523,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
if (!caster)
break;
// Mana Shield
- if(GetSpellProto()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellProto()->SpellFamilyFlags[0] & 0x8000 && m_spellProto->SpellFamilyFlags[2] & 0x8)
+ if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellProto()->SpellFamilyFlags[0] & 0x8000 && m_spellProto->SpellFamilyFlags[2] & 0x8)
{
// +80.53% from +spd bonus
DoneActualBenefit += caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.8053f;;
@@ -636,14 +636,14 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
int32 value = int32((amount*-1)-10);
uint32 defva = uint32(caster->ToPlayer()->GetSkillValue(SKILL_DEFENSE) + caster->ToPlayer()->GetRatingBonusValue(CR_DEFENSE_SKILL));
- if(defva > 400)
+ if (defva > 400)
value += int32((defva-400)*0.15);
// Glyph of Icebound Fortitude
if (AuraEffect const * aurEff = caster->GetAuraEffect(58625,0))
{
uint32 valMax = aurEff->GetAmount();
- if(value < valMax)
+ if (value < valMax)
value = valMax;
}
amount = -value;
@@ -744,7 +744,7 @@ void AuraEffect::CalculatePeriodic(Unit * caster, bool create)
Player* modOwner = caster ? caster->GetSpellModOwner() : NULL;
// Apply casting time mods
- if(modOwner && m_amplitude)
+ if (modOwner && m_amplitude)
{
// For channeled spells
if (IsChanneledSpell(m_spellProto)) {
@@ -768,7 +768,7 @@ void AuraEffect::CalculatePeriodic(Unit * caster, bool create)
}
// Apply periodic time mod
- if(modOwner && m_amplitude)
+ if (modOwner && m_amplitude)
modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, m_amplitude);
if (create)
@@ -795,7 +795,7 @@ void AuraEffect::CalculateSpellMod()
{
case SPELLFAMILY_PRIEST:
// Pain and Suffering
- if(m_spellProto->SpellIconID == 2874)
+ if (m_spellProto->SpellIconID == 2874)
{
if (!m_spellmod)
{
@@ -913,7 +913,7 @@ void AuraEffect::HandleEffect(Unit * target, uint8 mode, bool apply)
void AuraEffect::ApplySpellMod(Unit * target, bool apply)
{
- if(!m_spellmod || target->GetTypeId() != TYPEID_PLAYER)
+ if (!m_spellmod || target->GetTypeId() != TYPEID_PLAYER)
return;
target->ToPlayer()->AddSpellMod(m_spellmod, apply);
@@ -974,7 +974,7 @@ void AuraEffect::Update(uint32 diff, Unit * caster)
{
if (m_isPeriodic && (GetBase()->GetDuration() >=0 || GetBase()->IsPassive() || GetBase()->IsPermanent()))
{
- if(m_periodicTimer > diff)
+ if (m_periodicTimer > diff)
m_periodicTimer -= diff;
else // tick also at m_periodicTimer==0 to prevent lost last tick in case max m_duration == (max m_periodicTimer)*N
{
@@ -1165,7 +1165,7 @@ void AuraEffect::SendTickImmune(Unit * target, Unit *caster) const
void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
{
- if(!target->isAlive())
+ if (!target->isAlive())
return;
if (target->hasUnitState(UNIT_STAT_ISOLATED))
@@ -1179,7 +1179,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
{
- if(!caster)
+ if (!caster)
break;
// Consecrate ticks can miss and will not show up in the combat log
@@ -1201,7 +1201,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
{
case 43093: case 31956: case 38801: // Grievous Wound
case 35321: case 38363: case 39215: // Gushing Wound
- if(target->GetHealth() == target->GetMaxHealth())
+ if (target->GetHealth() == target->GetMaxHealth())
{
target->RemoveAurasDueToSpell(GetId());
return;
@@ -1213,7 +1213,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
GetEffIndex() < 2 && GetSpellProto()->Effect[GetEffIndex()]==SPELL_EFFECT_DUMMY ?
caster->CalculateSpellDamage(GetSpellProto(),GetEffIndex()+1,GetSpellProto()->EffectBasePoints[GetEffIndex()+1],target) :
100;
- if(target->GetHealth()*100 >= target->GetMaxHealth()*percent)
+ if (target->GetHealth()*100 >= target->GetMaxHealth()*percent)
{
target->RemoveAurasDueToSpell(GetId());
return;
@@ -1230,7 +1230,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
// ignore non positive values (can be result apply spellmods to aura damage
uint32 damage = GetAmount() > 0 ? GetAmount() : 0;
- if(GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE)
+ if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE)
{
damage = caster->SpellDamageBonus(target, GetSpellProto(), damage, DOT, GetBase()->GetStackAmount());
@@ -1249,10 +1249,10 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
{
uint32 totalTick = GetTotalTicks();
// 1..4 ticks, 1/2 from normal tick damage
- if(m_tickNumber <= totalTick / 3)
+ if (m_tickNumber <= totalTick / 3)
damage = damage/2;
// 9..12 ticks, 3/2 from normal tick damage
- else if(m_tickNumber > totalTick * 2 / 3)
+ else if (m_tickNumber > totalTick * 2 / 3)
damage += (damage+1)/2; // +1 prevent 0.5 damage possible lost at 1..4 ticks
// 5..8 ticks have normal tick damage
}
@@ -1315,18 +1315,18 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
}
case SPELL_AURA_PERIODIC_LEECH:
{
- if(!caster)
+ if (!caster)
return;
- if(!caster->isAlive())
+ if (!caster->isAlive())
return;
- if( GetSpellProto()->Effect[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA &&
+ if ( GetSpellProto()->Effect[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA &&
caster->SpellHitResult(target,GetSpellProto(),false)!=SPELL_MISS_NONE)
return;
// Check for immune
- if(target->IsImmunedToDamage(GetSpellProto()))
+ if (target->IsImmunedToDamage(GetSpellProto()))
{
SendTickImmune(target, caster);
return;
@@ -1361,7 +1361,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
caster->CalcAbsorbResist(target, GetSpellSchoolMask(GetSpellProto()), DOT, damage, &absorb, &resist, m_spellProto);
- if(target->GetHealth() < damage)
+ if (target->GetHealth() < damage)
damage = uint32(target->GetHealth());
sLog.outDetail("PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
@@ -1387,7 +1387,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
float multiplier = GetSpellProto()->EffectMultipleValue[GetEffIndex()];
- if(Player *modOwner = caster->GetSpellModOwner())
+ if (Player *modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(GetSpellProto()->Id, SPELLMOD_MULTIPLE_VALUE, multiplier);
uint32 heal = uint32(caster->SpellHealingBonus(caster, GetSpellProto(), uint32(new_damage * multiplier), DOT, GetBase()->GetStackAmount()));
@@ -1398,14 +1398,14 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
}
case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: // only three spells
{
- if(!caster || !caster->GetHealth())
+ if (!caster || !caster->GetHealth())
break;
uint32 damage = GetAmount();
// do not kill health donator
- if(caster->GetHealth() < damage)
+ if (caster->GetHealth() < damage)
damage = caster->GetHealth() - 1;
- if(!damage)
+ if (!damage)
break;
//donator->SendSpellNonMeleeDamageLog(donator, GetId(), damage, GetSpellSchoolMask(spellProto), 0, 0, false, 0);
@@ -1414,7 +1414,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
float multiplier = GetSpellProto()->EffectMultipleValue[GetEffIndex()];
- if(Player *modOwner = caster->GetSpellModOwner())
+ if (Player *modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(GetSpellProto()->Id, SPELLMOD_MULTIPLE_VALUE, multiplier);
damage *= multiplier;
@@ -1425,20 +1425,20 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_OBS_MOD_HEALTH:
{
- if(!caster)
+ if (!caster)
break;
// heal for caster damage (must be alive)
- if(target != caster && GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_HEALTH_FUNNEL && !caster->isAlive())
+ if (target != caster && GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_HEALTH_FUNNEL && !caster->isAlive())
break;
- if(GetBase()->GetDuration() == -1 && target->GetHealth() == target->GetMaxHealth())
+ if (GetBase()->GetDuration() == -1 && target->GetHealth() == target->GetMaxHealth())
break;
// ignore non positive values (can be result apply spellmods to aura damage
int32 damage = m_amount > 0 ? m_amount : 0;
- if(GetAuraType() == SPELL_AURA_OBS_MOD_HEALTH)
+ if (GetAuraType() == SPELL_AURA_OBS_MOD_HEALTH)
damage = uint32(target->GetMaxHealth() * damage / 100);
else
{
@@ -1464,8 +1464,8 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
target->SendPeriodicAuraLog(&pInfo);
// add HoTs to amount healed in bgs
- if( caster->GetTypeId() == TYPEID_PLAYER )
- if( BattleGround *bg = caster->ToPlayer()->GetBattleGround() )
+ if ( caster->GetTypeId() == TYPEID_PLAYER )
+ if ( BattleGround *bg = caster->ToPlayer()->GetBattleGround() )
bg->UpdatePlayerScore(caster->ToPlayer(), SCORE_HEALING_DONE, gain);
target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
@@ -1474,7 +1474,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
// Health Funnel
// damage caster for heal amount
- if(target != caster && GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_HEALTH_FUNNEL)
+ if (target != caster && GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_HEALTH_FUNNEL)
{
uint32 damage = gain;
uint32 absorb = 0;
@@ -1489,30 +1489,30 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;
uint32 procEx = PROC_EX_NORMAL_HIT | PROC_EX_INTERNAL_HOT;
// ignore item heals
- if(!haveCastItem)
+ if (!haveCastItem)
caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellProto());
break;
}
case SPELL_AURA_PERIODIC_MANA_LEECH:
{
- if(GetMiscValue() < 0 || GetMiscValue() >= MAX_POWERS)
+ if (GetMiscValue() < 0 || GetMiscValue() >= MAX_POWERS)
break;
Powers power = Powers(GetMiscValue());
// power type might have changed between aura applying and tick (druid's shapeshift)
- if(target->getPowerType() != power)
+ if (target->getPowerType() != power)
break;
- if(!caster || !caster->isAlive())
+ if (!caster || !caster->isAlive())
break;
- if( GetSpellProto()->Effect[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA &&
+ if ( GetSpellProto()->Effect[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA &&
caster->SpellHitResult(target,GetSpellProto(),false) != SPELL_MISS_NONE)
break;
// Check for immune (not use charges)
- if(target->IsImmunedToDamage(GetSpellProto()))
+ if (target->IsImmunedToDamage(GetSpellProto()))
{
SendTickImmune(target, caster);
break;
@@ -1528,7 +1528,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
// max value
uint32 maxmana = caster->GetMaxPower(power) * damage * 2 / 100;
damage = target->GetMaxPower(power) * damage / 100;
- if(damage > maxmana)
+ if (damage > maxmana)
damage = maxmana;
}
@@ -1545,11 +1545,11 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
float gain_multiplier = 0.0f;
- if(caster->GetMaxPower(power) > 0)
+ if (caster->GetMaxPower(power) > 0)
{
gain_multiplier = GetSpellProto()->EffectMultipleValue[GetEffIndex()];
- if(Player *modOwner = caster->GetSpellModOwner())
+ if (Player *modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE, gain_multiplier);
}
@@ -1558,7 +1558,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
int32 gain_amount = int32(drain_amount*gain_multiplier);
- if(gain_amount)
+ if (gain_amount)
{
int32 gain = caster->ModifyPower(power,gain_amount);
target->AddThreat(caster, float(gain) * 0.5f, GetSpellSchoolMask(GetSpellProto()), GetSpellProto());
@@ -1567,7 +1567,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
switch(GetId())
{
case 31447: // Mark of Kaz'rogal
- if(target->GetPower(power) == 0)
+ if (target->GetPower(power) == 0)
{
target->CastSpell(target, 31463, true, 0, this);
// Remove aura
@@ -1579,7 +1579,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
int32 modifier = (target->GetPower(power) * 0.05f);
target->ModifyPower(power, -modifier);
- if(target->GetPower(power) == 0)
+ if (target->GetPower(power) == 0)
{
target->CastSpell(target, 32961, true, 0, this);
// Remove aura
@@ -1594,7 +1594,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
if (AuraEffect const * aurEff = GetBase()->GetEffect(1))
manaFeedVal = aurEff->GetAmount();
// Mana Feed - Drain Mana
- if(manaFeedVal > 0)
+ if (manaFeedVal > 0)
{
manaFeedVal = manaFeedVal * gain_amount / 100;
caster->CastCustomSpell(caster, 32554, &manaFeedVal, NULL, NULL, true, NULL, this);
@@ -1604,7 +1604,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
}
case SPELL_AURA_OBS_MOD_POWER:
{
- if(GetMiscValue() < 0)
+ if (GetMiscValue() < 0)
return;
Powers power;
@@ -1613,10 +1613,10 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
else
power = Powers(GetMiscValue());
- if(target->GetMaxPower(power) == 0)
+ if (target->GetMaxPower(power) == 0)
return;
- if(GetBase()->GetDuration() == -1 && target->GetPower(power) == target->GetMaxPower(power))
+ if (GetBase()->GetDuration() == -1 && target->GetPower(power) == target->GetMaxPower(power))
return;
uint32 amount = m_amount * target->GetMaxPower(power) /100;
@@ -1628,22 +1628,22 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
int32 gain = target->ModifyPower(power,amount);
- if(caster)
+ if (caster)
target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
break;
}
case SPELL_AURA_PERIODIC_ENERGIZE:
{
// ignore non positive values (can be result apply spellmods to aura damage
- if(m_amount < 0 || GetMiscValue() >= MAX_POWERS)
+ if (m_amount < 0 || GetMiscValue() >= MAX_POWERS)
return;
Powers power = Powers(GetMiscValue());
- if(target->GetMaxPower(power) == 0)
+ if (target->GetMaxPower(power) == 0)
return;
- if(GetBase()->GetDuration() ==-1 && target->GetPower(power)==target->GetMaxPower(power))
+ if (GetBase()->GetDuration() ==-1 && target->GetPower(power)==target->GetMaxPower(power))
return;
uint32 amount = m_amount;
@@ -1656,17 +1656,17 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
int32 gain = target->ModifyPower(power,amount);
- if(caster)
+ if (caster)
target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
break;
}
case SPELL_AURA_POWER_BURN_MANA:
{
- if(!caster)
+ if (!caster)
return;
// Check for immune (not use charges)
- if(target->IsImmunedToDamage(GetSpellProto()))
+ if (target->IsImmunedToDamage(GetSpellProto()))
{
SendTickImmune(target, caster);
return;
@@ -1676,7 +1676,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
Powers powerType = Powers(GetMiscValue());
- if(!target->isAlive() || target->getPowerType() != powerType)
+ if (!target->isAlive() || target->getPowerType() != powerType)
return;
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
@@ -1777,15 +1777,15 @@ void AuraEffect::PeriodicDummyTick(Unit * target, Unit * caster) const
target->CastSpell((Unit*)NULL, m_spellProto->EffectTriggerSpell[m_effIndex], true);
break;
case 62399: // Overload Circuit
- if(target->GetMap()->IsDungeon() && target->GetAppliedAuras().count(62399) >= (target->GetMap()->IsHeroic() ? 4 : 2))
+ if (target->GetMap()->IsDungeon() && target->GetAppliedAuras().count(62399) >= (target->GetMap()->IsHeroic() ? 4 : 2))
{
target->CastSpell(target, 62475, true); // System Shutdown
- if(Unit *veh = target->GetVehicleBase())
+ if (Unit *veh = target->GetVehicleBase())
veh->CastSpell(target, 62475, true);
}
break;
case 64821: // Fuse Armor (Razorscale)
- if(GetBase()->GetStackAmount() == GetSpellProto()->StackAmount)
+ if (GetBase()->GetStackAmount() == GetSpellProto()->StackAmount)
{
target->CastSpell(target, 64774, true, NULL, NULL, GetCasterGUID());
target->RemoveAura(64821);
@@ -1807,7 +1807,7 @@ void AuraEffect::PeriodicDummyTick(Unit * target, Unit * caster) const
{
// Demonic Circle
case 48018:
- if(GameObject* obj = target->GetGameObject(GetSpellProto()->Id))
+ if (GameObject* obj = target->GetGameObject(GetSpellProto()->Id))
{
if (target->IsWithinDist(obj, GetSpellMaxRange(48020, true)))
{
@@ -1881,7 +1881,7 @@ void AuraEffect::PeriodicDummyTick(Unit * target, Unit * caster) const
cell.Visit(p, world_object_checker, *GetBase()->GetOwner()->GetMap(), *caster, radius);
}
- if(targets.empty())
+ if (targets.empty())
return;
UnitList::const_iterator itr = targets.begin();
@@ -1905,7 +1905,7 @@ void AuraEffect::PeriodicDummyTick(Unit * target, Unit * caster) const
// Explosive Shot
if (GetSpellProto()->SpellFamilyFlags[1] & 0x80000000)
{
- if(caster)
+ if (caster)
caster->CastCustomSpell(53352, SPELLVALUE_BASE_POINT0, m_amount, target, true, NULL, this);
break;
}
@@ -1957,7 +1957,7 @@ void AuraEffect::PeriodicDummyTick(Unit * target, Unit * caster) const
{
if (target->GetTypeId() != TYPEID_PLAYER)
return;
- if(target->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT)
+ if (target->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT)
return;
// timer expired - remove death runes
@@ -1979,7 +1979,7 @@ Unit* AuraEffect::GetTriggerTarget(Unit * target) const
void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
{
- if(!caster || !target)
+ if (!caster || !target)
return;
Unit* triggerTarget = GetTriggerTarget(target);
@@ -2039,7 +2039,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
return;
// Detonate Mana
case 27819:
- if(int32 mana = (int32)(target->GetMaxPower(POWER_MANA) / 10))
+ if (int32 mana = (int32)(target->GetMaxPower(POWER_MANA) / 10))
{
mana = target->ModifyPower(POWER_MANA, -mana);
target->CastCustomSpell(27820, SPELLVALUE_BASE_POINT0, -mana*10, target, true, NULL, this);
@@ -2047,7 +2047,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
return;
// Inoculate Nestlewood Owlkin
case 29528:
- if(triggerTarget->GetTypeId()!=TYPEID_UNIT)// prevent error reports in case ignored player target
+ if (triggerTarget->GetTypeId()!=TYPEID_UNIT)// prevent error reports in case ignored player target
return;
break;
// Feed Captured Animal
@@ -2058,7 +2058,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
case 30427:
{
// move loot to player inventory and despawn target
- if(caster->GetTypeId() ==TYPEID_PLAYER &&
+ if (caster->GetTypeId() ==TYPEID_PLAYER &&
triggerTarget->GetTypeId() == TYPEID_UNIT &&
triggerTarget->ToCreature()->GetCreatureInfo()->type == CREATURE_TYPE_GAS_CLOUD)
{
@@ -2113,7 +2113,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
// Absorb Eye of Grillok (Zezzak's Shard)
case 38554:
{
- if(target->GetTypeId() != TYPEID_UNIT)
+ if (target->GetTypeId() != TYPEID_UNIT)
return;
caster->CastSpell(caster, 38495, true, NULL, this);
@@ -2191,14 +2191,14 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
bool all = true;
for (int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
{
- if(!target->m_SummonSlot[i])
+ if (!target->m_SummonSlot[i])
{
all = false;
break;
}
}
- if(all)
+ if (all)
caster->CastSpell(target,38437,true, NULL, this);
else
target->RemoveAurasDueToSpell(38437);
@@ -2235,26 +2235,26 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
}
}
- if(triggeredSpellInfo)
+ if (triggeredSpellInfo)
{
Unit * triggerCaster = GetTriggeredSpellCaster(triggeredSpellInfo, caster, triggerTarget);
triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, 0, this);
sLog.outDebug("AuraEffect::TriggerSpell: Spell %u Trigger %u",GetId(), triggeredSpellInfo->Id);
}
- else if(target->GetTypeId()!=TYPEID_UNIT || !sScriptMgr.EffectDummyCreature(caster, GetId(), GetEffIndex(), triggerTarget->ToCreature()))
+ else if (target->GetTypeId()!=TYPEID_UNIT || !sScriptMgr.EffectDummyCreature(caster, GetId(), GetEffIndex(), triggerTarget->ToCreature()))
sLog.outError("AuraEffect::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",GetId(),GetEffIndex());
}
void AuraEffect::TriggerSpellWithValue(Unit * target, Unit * caster) const
{
- if(!caster || !target)
+ if (!caster || !target)
return;
Unit* triggerTarget = GetTriggerTarget(target);
uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[m_effIndex];
SpellEntry const *triggeredSpellInfo = sSpellStore.LookupEntry(triggerSpellId);
- if(triggeredSpellInfo)
+ if (triggeredSpellInfo)
{
Unit * triggerCaster = GetTriggeredSpellCaster(triggeredSpellInfo, caster, triggerTarget);
@@ -2283,19 +2283,19 @@ bool AuraEffect::IsAffectedOnSpell(SpellEntry const *spell) const
void AuraEffect::CleanupTriggeredSpells(Unit * target)
{
uint32 tSpellId = m_spellProto->EffectTriggerSpell[GetEffIndex()];
- if(!tSpellId)
+ if (!tSpellId)
return;
SpellEntry const* tProto = sSpellStore.LookupEntry(tSpellId);
- if(!tProto)
+ if (!tProto)
return;
- if(GetSpellDuration(tProto) != -1)
+ if (GetSpellDuration(tProto) != -1)
return;
// needed for spell 43680, maybe others
// TODO: is there a spell flag, which can solve this in a more sophisticated way?
- if(m_spellProto->EffectApplyAuraName[GetEffIndex()] == SPELL_AURA_PERIODIC_TRIGGER_SPELL &&
+ if (m_spellProto->EffectApplyAuraName[GetEffIndex()] == SPELL_AURA_PERIODIC_TRIGGER_SPELL &&
GetSpellDuration(m_spellProto) == m_spellProto->EffectAmplitude[GetEffIndex()])
return;
@@ -2377,30 +2377,30 @@ void AuraEffect::HandleShapeshiftBoosts(Unit * target, bool apply) const
break;
}
- if(apply)
+ if (apply)
{
// Remove cooldown of spells triggered on stance change - they may share cooldown with stance spell
if (spellId)
{
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->RemoveSpellCooldown(spellId);
target->CastSpell(target, spellId, true, NULL, this );
}
if (spellId2)
{
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->RemoveSpellCooldown(spellId2);
target->CastSpell(target, spellId2, true, NULL, this);
}
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
const PlayerSpellMap& sp_list = target->ToPlayer()->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
{
- if(itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue;
- if(itr->first==spellId || itr->first==spellId2) continue;
+ if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue;
+ if (itr->first==spellId || itr->first==spellId2) continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR_PASSIVE | (1<<7)))) continue;
if (spellInfo->Stances & (1<<(GetMiscValue()-1)))
@@ -2429,7 +2429,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit * target, bool apply) const
if ((*i)->GetSpellProto()->SpellIconID == 240 && (*i)->GetMiscValue() == 3)
{
int32 HotWMod = (*i)->GetAmount();
- if(GetMiscValue() == FORM_CAT)
+ if (GetMiscValue() == FORM_CAT)
HotWMod /= 2;
target->CastCustomSpell(target, HotWSpellId, &HotWMod, NULL, NULL, true, NULL, this);
@@ -2537,12 +2537,12 @@ void AuraEffect::HandleShapeshiftBoosts(Unit * target, bool apply) const
void AuraEffect::HandleInvisibilityDetect(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
- if(apply)
+ if (apply)
{
target->m_detectInvisibilityMask |= (1 << GetMiscValue());
}
@@ -2554,18 +2554,18 @@ void AuraEffect::HandleInvisibilityDetect(AuraApplication const * aurApp, uint8
for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
target->m_detectInvisibilityMask |= (1 << GetMiscValue());
}
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->UpdateObjectVisibility();
}
void AuraEffect::HandleInvisibility(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(apply)
+ if (apply)
{
target->m_invisibilityMask |= (1 << GetMiscValue());
@@ -2576,7 +2576,7 @@ void AuraEffect::HandleInvisibility(AuraApplication const * aurApp, uint8 mode,
}
// apply glow vision
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->SetFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
target->UpdateObjectVisibility();
@@ -2591,7 +2591,7 @@ void AuraEffect::HandleInvisibility(AuraApplication const * aurApp, uint8 mode,
// if not have different invisibility auras.
// remove glow vision
- if(!target->m_invisibilityMask && target->GetTypeId() == TYPEID_PLAYER)
+ if (!target->m_invisibilityMask && target->GetTypeId() == TYPEID_PLAYER)
target->RemoveFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
target->UpdateObjectVisibility();
@@ -2600,12 +2600,12 @@ void AuraEffect::HandleInvisibility(AuraApplication const * aurApp, uint8 mode,
void AuraEffect::HandleModStealth(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(apply)
+ if (apply)
{
if (mode & AURA_EFFECT_HANDLE_REAL)
{
@@ -2614,44 +2614,44 @@ void AuraEffect::HandleModStealth(AuraApplication const * aurApp, uint8 mode, bo
}
target->SetStandFlags(UNIT_STAND_FLAGS_CREEP);
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->SetFlag(PLAYER_FIELD_BYTES2, 0x2000);
// apply only if not in GM invisibility (and overwrite invisibility state)
- if(target->GetVisibility() != VISIBILITY_OFF)
+ if (target->GetVisibility() != VISIBILITY_OFF)
target->SetVisibility(VISIBILITY_GROUP_STEALTH);
}
- else if(!target->HasAuraType(SPELL_AURA_MOD_STEALTH)) // if last SPELL_AURA_MOD_STEALTH
+ else if (!target->HasAuraType(SPELL_AURA_MOD_STEALTH)) // if last SPELL_AURA_MOD_STEALTH
{
target->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP);
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->RemoveFlag(PLAYER_FIELD_BYTES2, 0x2000);
- if(target->GetVisibility() != VISIBILITY_OFF)
+ if (target->GetVisibility() != VISIBILITY_OFF)
target->SetVisibility(VISIBILITY_ON);
}
}
void AuraEffect::HandleSpiritOfRedemption(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
// prepare spirit state
- if(apply)
+ if (apply)
{
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
// disable breath/etc timers
target->ToPlayer()->StopMirrorTimers();
// set stand state (expected in this form)
- if(!target->IsStandState())
+ if (!target->IsStandState())
target->SetStandState(UNIT_STAND_STATE_STAND);
}
@@ -2664,15 +2664,15 @@ void AuraEffect::HandleSpiritOfRedemption(AuraApplication const * aurApp, uint8
void AuraEffect::HandleAuraGhost(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
- if(apply)
+ if (apply)
target->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST);
else
{
@@ -2684,7 +2684,7 @@ void AuraEffect::HandleAuraGhost(AuraApplication const * aurApp, uint8 mode, boo
void AuraEffect::HandlePhase(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
@@ -2692,15 +2692,15 @@ void AuraEffect::HandlePhase(AuraApplication const * aurApp, uint8 mode, bool ap
// no-phase is also phase state so same code for apply and remove
// phase auras normally not expected at BG but anyway better check
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
// drop flag at invisible in bg
- if(target->ToPlayer()->InBattleGround())
- if(BattleGround *bg = target->ToPlayer()->GetBattleGround())
+ if (target->ToPlayer()->InBattleGround())
+ if (BattleGround *bg = target->ToPlayer()->GetBattleGround())
bg->EventPlayerDroppedFlag(target->ToPlayer());
// GM-mode have mask 0xFFFFFFFF
- if(!target->ToPlayer()->isGameMaster())
+ if (!target->ToPlayer()->isGameMaster())
target->SetPhaseMask((apply) ? GetMiscValue() : PHASEMASK_NORMAL,false);
target->ToPlayer()->GetSession()->SendSetPhaseShift((apply) ? GetMiscValue() : PHASEMASK_NORMAL);
@@ -2709,7 +2709,7 @@ void AuraEffect::HandlePhase(AuraApplication const * aurApp, uint8 mode, bool ap
target->SetPhaseMask((apply) ? GetMiscValue() : PHASEMASK_NORMAL,false);
// need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
- if(target->GetVisibility()!=VISIBILITY_OFF)
+ if (target->GetVisibility()!=VISIBILITY_OFF)
target->SetVisibility(target->GetVisibility());
}
@@ -2719,7 +2719,7 @@ void AuraEffect::HandlePhase(AuraApplication const * aurApp, uint8 mode, bool ap
void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
@@ -2780,7 +2780,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m
target->RemoveMovementImpairingAuras();
// and polymorphic affects
- if(target->IsPolymorphed())
+ if (target->IsPolymorphed())
target->RemoveAurasDueToSpell(target->getTransForm());
break;
}
@@ -2791,7 +2791,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m
if (apply)
{
// remove other shapeshift before applying a new one
- if(target->m_ShapeShiftFormSpellId)
+ if (target->m_ShapeShiftFormSpellId)
target->RemoveAurasDueToSpell(target->m_ShapeShiftFormSpellId);
target->SetByteValue(UNIT_FIELD_BYTES_2, 3, form);
@@ -2803,7 +2803,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m
{
uint32 oldPower = target->GetPower(PowerType);
// reset power to default values only at power change
- if(target->getPowerType() != PowerType)
+ if (target->getPowerType() != PowerType)
target->setPowerType(PowerType);
switch (form)
@@ -2848,10 +2848,10 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m
}
else
{
- if(modelid > 0)
+ if (modelid > 0)
target->SetDisplayId(target->GetNativeDisplayId());
target->SetByteValue(UNIT_FIELD_BYTES_2, 3, FORM_NONE);
- if(target->getClass() == CLASS_DRUID)
+ if (target->getClass() == CLASS_DRUID)
target->setPowerType(POWER_MANA);
target->m_ShapeShiftFormSpellId = 0;
target->m_form = FORM_NONE;
@@ -2862,12 +2862,12 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m
case FORM_BEAR:
case FORM_DIREBEAR:
case FORM_CAT:
- if(AuraEffect* dummy = target->GetAuraEffect(37315, 0) )
+ if (AuraEffect* dummy = target->GetAuraEffect(37315, 0) )
target->CastSpell(target,37316,true,NULL,dummy);
break;
// Nordrassil Regalia - bonus
case FORM_MOONKIN:
- if(AuraEffect* dummy = target->GetAuraEffect(37324, 0) )
+ if (AuraEffect* dummy = target->GetAuraEffect(37324, 0) )
target->CastSpell(target,37325,true,NULL,dummy);
break;
case FORM_BATTLESTANCE:
@@ -2882,12 +2882,12 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m
Rage_val += aurEff->GetAmount() * 10;
}
// Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch)
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
{
- if(itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue;
+ if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
Rage_val += target->CalculateSpellDamage(spellInfo,0,spellInfo->EffectBasePoints[0],target) * 10;
@@ -2906,13 +2906,13 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m
// add/remove the shapeshift aura's boosts
HandleShapeshiftBoosts(target, apply);
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->InitDataForForm();
- if(target->getClass() == CLASS_DRUID)
+ if (target->getClass() == CLASS_DRUID)
{
// Dash
- if(AuraEffect * aurEff =target->GetAuraEffect(SPELL_AURA_MOD_INCREASE_SPEED, SPELLFAMILY_DRUID, 0, 0, 0x8))
+ if (AuraEffect * aurEff =target->GetAuraEffect(SPELL_AURA_MOD_INCREASE_SPEED, SPELLFAMILY_DRUID, 0, 0, 0x8))
aurEff->RecalculateAmount();
}
if (target->GetTypeId() == TYPEID_PLAYER)
@@ -2933,7 +2933,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m
void AuraEffect::HandleAuraTransform(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
@@ -2941,7 +2941,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const * aurApp, uint8 mode,
if (apply)
{
// special case (spell specific functionality)
- if(GetMiscValue()==0)
+ if (GetMiscValue()==0)
{
// player applied only
if (target->GetTypeId() != TYPEID_PLAYER)
@@ -3007,7 +3007,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const * aurApp, uint8 mode,
else
{
CreatureInfo const * ci = objmgr.GetCreatureTemplate(GetMiscValue());
- if(!ci)
+ if (!ci)
{
target->SetDisplayId(16358); // pig pink ^_^
sLog.outError("Auras: unknown creature id = %d (only need its modelid) Form Spell Aura Transform in Spell ID = %d", GetMiscValue(), GetId());
@@ -3028,7 +3028,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const * aurApp, uint8 mode,
target->SetDisplayId(model_id);
// Dragonmaw Illusion (set mount model also)
- if(GetId()==42016 && target->GetMountID() && !target->GetAuraEffectsByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED).empty())
+ if (GetId()==42016 && target->GetMountID() && !target->GetAuraEffectsByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED).empty())
target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314);
}
}
@@ -3080,7 +3080,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const * aurApp, uint8 mode,
if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
{
uint32 cr_id = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
- if(CreatureInfo const* ci = objmgr.GetCreatureTemplate(cr_id))
+ if (CreatureInfo const* ci = objmgr.GetCreatureTemplate(cr_id))
{
uint32 team = 0;
if (target->GetTypeId() == TYPEID_PLAYER)
@@ -3100,7 +3100,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const * aurApp, uint8 mode,
void AuraEffect::HandleAuraModScale(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
@@ -3110,7 +3110,7 @@ void AuraEffect::HandleAuraModScale(AuraApplication const * aurApp, uint8 mode,
void AuraEffect::HandleAuraCloneCaster(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
@@ -3137,15 +3137,15 @@ void AuraEffect::HandleAuraCloneCaster(AuraApplication const * aurApp, uint8 mod
void AuraEffect::HandleFeignDeath(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
- if( apply )
+ if ( apply )
{
/*
WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
@@ -3160,12 +3160,12 @@ void AuraEffect::HandleFeignDeath(AuraApplication const * aurApp, uint8 mode, bo
target->VisitNearbyObject(target->GetMap()->GetVisibilityDistance(), searcher);
for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
{
- if(!(*iter)->hasUnitState(UNIT_STAT_CASTING))
+ if (!(*iter)->hasUnitState(UNIT_STAT_CASTING))
continue;
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
{
- if((*iter)->GetCurrentSpell(i)
+ if ((*iter)->GetCurrentSpell(i)
&& (*iter)->GetCurrentSpell(i)->m_targets.getUnitTargetGUID() == target->GetGUID())
{
(*iter)->InterruptSpell(CurrentSpellTypes(i), false);
@@ -3184,7 +3184,7 @@ void AuraEffect::HandleFeignDeath(AuraApplication const * aurApp, uint8 mode, bo
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
// prevent interrupt message
- if(GetCasterGUID()==target->GetGUID() && target->GetCurrentSpell(CURRENT_GENERIC_SPELL))
+ if (GetCasterGUID()==target->GetGUID() && target->GetCurrentSpell(CURRENT_GENERIC_SPELL))
target->FinishSpell(CURRENT_GENERIC_SPELL, false);
target->InterruptNonMeleeSpells(true);
target->getHostileRefManager().deleteReferences();
@@ -3210,12 +3210,12 @@ void AuraEffect::HandleFeignDeath(AuraApplication const * aurApp, uint8 mode, bo
void AuraEffect::HandleModUnattackable(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(apply)
+ if (apply)
{
if (mode & AURA_EFFECT_HANDLE_REAL)
{
@@ -3232,7 +3232,7 @@ void AuraEffect::HandleModUnattackable(AuraApplication const * aurApp, uint8 mod
void AuraEffect::HandleAuraModDisarm(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
@@ -3240,7 +3240,7 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const * aurApp, uint8 mode,
AuraType type = GetAuraType();
//Prevent handling aura twice
- if((apply) ? target->GetAuraEffectsByType(type).size() > 1 : target->HasAuraType(type))
+ if ((apply) ? target->GetAuraEffectsByType(type).size() > 1 : target->HasAuraType(type))
return;
uint32 field, flag, slot;
@@ -3269,7 +3269,7 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const * aurApp, uint8 mode,
return;
}
- if(!(apply))
+ if (!(apply))
target->RemoveFlag(field, flag);
if (target->GetTypeId() == TYPEID_PLAYER)
@@ -3277,11 +3277,11 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const * aurApp, uint8 mode,
// This is between the two because there is a check in _ApplyItemMods
// we must make sure that flag is always removed when call that function
// refer to DurabilityPointsLoss
- if(Item *pItem = target->ToPlayer()->GetItemByPos( INVENTORY_SLOT_BAG_0, slot ))
+ if (Item *pItem = target->ToPlayer()->GetItemByPos( INVENTORY_SLOT_BAG_0, slot ))
target->ToPlayer()->_ApplyItemMods(pItem, slot, !apply);
}
- if(apply)
+ if (apply)
target->SetFlag(field, flag);
if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->GetCurrentEquipmentId())
@@ -3290,25 +3290,25 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const * aurApp, uint8 mode,
void AuraEffect::HandleAuraModSilence(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
- if(apply)
+ if (apply)
{
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED);
// Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
- if(spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
+ if (spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
// Stop spells on prepare or casting state
target->InterruptSpell(CurrentSpellTypes(i), false);
}
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
- if(target->HasAuraType(SPELL_AURA_MOD_SILENCE) || target->HasAuraType(SPELL_AURA_MOD_PACIFY_SILENCE))
+ if (target->HasAuraType(SPELL_AURA_MOD_SILENCE) || target->HasAuraType(SPELL_AURA_MOD_PACIFY_SILENCE))
return;
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED);
@@ -3317,17 +3317,17 @@ void AuraEffect::HandleAuraModSilence(AuraApplication const * aurApp, uint8 mode
void AuraEffect::HandleAuraModPacify(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(apply)
+ if (apply)
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
- if(target->HasAuraType(SPELL_AURA_MOD_PACIFY) || target->HasAuraType(SPELL_AURA_MOD_PACIFY_SILENCE))
+ if (target->HasAuraType(SPELL_AURA_MOD_PACIFY) || target->HasAuraType(SPELL_AURA_MOD_PACIFY_SILENCE))
return;
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
}
@@ -3335,23 +3335,23 @@ void AuraEffect::HandleAuraModPacify(AuraApplication const * aurApp, uint8 mode,
void AuraEffect::HandleAuraModPacifyAndSilence(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
// Vengeance of the Blue Flight (TODO: REMOVE THIS!)
- if(m_spellProto->Id == 45839)
+ if (m_spellProto->Id == 45839)
{
- if(apply)
+ if (apply)
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
else
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
- if(!(apply))
+ if (!(apply))
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
- if(target->HasAuraType(SPELL_AURA_MOD_PACIFY_SILENCE))
+ if (target->HasAuraType(SPELL_AURA_MOD_PACIFY_SILENCE))
return;
}
HandleAuraModPacify(aurApp, mode, apply);
@@ -3360,19 +3360,19 @@ void AuraEffect::HandleAuraModPacifyAndSilence(AuraApplication const * aurApp, u
void AuraEffect::HandleAuraAllowOnlyAbility(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
if (apply)
target->SetFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY);
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
- if(target->HasAuraType(SPELL_AURA_ALLOW_ONLY_ABILITY))
+ if (target->HasAuraType(SPELL_AURA_ALLOW_ONLY_ABILITY))
return;
target->RemoveFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY);
}
@@ -3385,12 +3385,12 @@ void AuraEffect::HandleAuraAllowOnlyAbility(AuraApplication const * aurApp, uint
void AuraEffect::HandleAuraTrackCreatures(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
target->SetUInt32Value(PLAYER_TRACK_CREATURES, (apply) ? ((uint32)1)<<(GetMiscValue()-1) : 0 );
@@ -3398,12 +3398,12 @@ void AuraEffect::HandleAuraTrackCreatures(AuraApplication const * aurApp, uint8
void AuraEffect::HandleAuraTrackResources(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
target->SetUInt32Value(PLAYER_TRACK_RESOURCES, (apply) ? ((uint32)1)<<(GetMiscValue()-1): 0 );
@@ -3411,18 +3411,18 @@ void AuraEffect::HandleAuraTrackResources(AuraApplication const * aurApp, uint8
void AuraEffect::HandleAuraTrackStealthed(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
- if(!(apply))
+ if (!(apply))
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
- if(target->HasAuraType(GetAuraType()))
+ if (target->HasAuraType(GetAuraType()))
return;
}
target->ApplyModFlag(PLAYER_FIELD_BYTES,PLAYER_FIELD_BYTE_TRACK_STEALTHED,apply);
@@ -3430,18 +3430,18 @@ void AuraEffect::HandleAuraTrackStealthed(AuraApplication const * aurApp, uint8
void AuraEffect::HandleAuraModStalked(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
// used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
- if(apply)
+ if (apply)
target->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TRACK_UNIT);
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
- if(target->HasAuraType(GetAuraType()))
+ if (target->HasAuraType(GetAuraType()))
return;
target->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TRACK_UNIT);
@@ -3450,17 +3450,17 @@ void AuraEffect::HandleAuraModStalked(AuraApplication const * aurApp, uint8 mode
void AuraEffect::HandleAuraUntrackable(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(apply)
+ if (apply)
target->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_UNTRACKABLE);
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
- if(target->HasAuraType(GetAuraType()))
+ if (target->HasAuraType(GetAuraType()))
return;
target->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_UNTRACKABLE);
}
@@ -3472,12 +3472,12 @@ void AuraEffect::HandleAuraUntrackable(AuraApplication const * aurApp, uint8 mod
void AuraEffect::HandleAuraModPetTalentsPoints(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
// Recalculate pet talent points
@@ -3489,14 +3489,14 @@ void AuraEffect::HandleAuraModSkill(AuraApplication const * aurApp, uint8 mode,
{
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
uint32 prot = GetSpellProto()->EffectMiscValue[m_effIndex];
int32 points = GetAmount();
target->ToPlayer()->ModifySkillBonus(prot,((apply) ? points: -points),GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
- if(prot == SKILL_DEFENSE)
+ if (prot == SKILL_DEFENSE)
target->ToPlayer()->UpdateDefenseBonusesMod();
}
@@ -3506,15 +3506,15 @@ void AuraEffect::HandleAuraModSkill(AuraApplication const * aurApp, uint8 mode,
void AuraEffect::HandleAuraMounted(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(apply)
+ if (apply)
{
CreatureInfo const* ci = objmgr.GetCreatureTemplate(GetMiscValue());
- if(!ci)
+ if (!ci)
{
sLog.outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need it modelid)",GetMiscValue());
return;
@@ -3531,7 +3531,7 @@ void AuraEffect::HandleAuraMounted(AuraApplication const * aurApp, uint8 mode, b
//some spell has one aura of mount and one of vehicle
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if(GetSpellProto()->Effect[i] == SPELL_EFFECT_SUMMON
+ if (GetSpellProto()->Effect[i] == SPELL_EFFECT_SUMMON
&& GetSpellProto()->EffectMiscValue[i] == GetMiscValue())
display_id = 0;
target->Mount(display_id,ci->VehicleId);
@@ -3542,33 +3542,33 @@ void AuraEffect::HandleAuraMounted(AuraApplication const * aurApp, uint8 mode, b
//some mounts like Headless Horseman's Mount or broom stick are skill based spell
// need to remove ALL arura related to mounts, this will stop client crash with broom stick
// and never endless flying after using Headless Horseman's Mount
- if(mode & AURA_EFFECT_HANDLE_REAL)
+ if (mode & AURA_EFFECT_HANDLE_REAL)
target->RemoveAurasByType(SPELL_AURA_MOUNTED);
}
}
void AuraEffect::HandleAuraAllowFlight(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(!apply)
+ if (!apply)
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
- if(target->HasAuraType(GetAuraType()) || target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
+ if (target->HasAuraType(GetAuraType()) || target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
return;
}
- if(target->GetTypeId() == TYPEID_UNIT)
+ if (target->GetTypeId() == TYPEID_UNIT)
target->SetFlying(apply);
- if(Player *plr = target->m_movedPlayer)
+ if (Player *plr = target->m_movedPlayer)
{
// allow fly
WorldPacket data;
- if(apply)
+ if (apply)
data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12);
else
data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12);
@@ -3580,20 +3580,20 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const * aurApp, uint8 mod
void AuraEffect::HandleAuraWaterWalk(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(!(apply))
+ if (!(apply))
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
- if(target->HasAuraType(GetAuraType()))
+ if (target->HasAuraType(GetAuraType()))
return;
}
WorldPacket data;
- if(apply)
+ if (apply)
data.Initialize(SMSG_MOVE_WATER_WALK, 8+4);
else
data.Initialize(SMSG_MOVE_LAND_WALK, 8+4);
@@ -3604,15 +3604,15 @@ void AuraEffect::HandleAuraWaterWalk(AuraApplication const * aurApp, uint8 mode,
void AuraEffect::HandleAuraFeatherFall(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(!(apply))
+ if (!(apply))
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
- if(target->HasAuraType(GetAuraType()))
+ if (target->HasAuraType(GetAuraType()))
return;
}
@@ -3626,26 +3626,26 @@ void AuraEffect::HandleAuraFeatherFall(AuraApplication const * aurApp, uint8 mod
target->SendMessageToSet(&data, true);
// start fall from current height
- if(!apply && target->GetTypeId() == TYPEID_PLAYER)
+ if (!apply && target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->SetFallInformation(0, target->GetPositionZ());
}
void AuraEffect::HandleAuraHover(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(!(apply))
+ if (!(apply))
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
- if(target->HasAuraType(GetAuraType()))
+ if (target->HasAuraType(GetAuraType()))
return;
}
WorldPacket data;
- if(apply)
+ if (apply)
data.Initialize(SMSG_MOVE_SET_HOVER, 8+4);
else
data.Initialize(SMSG_MOVE_UNSET_HOVER, 8+4);
@@ -3656,32 +3656,32 @@ void AuraEffect::HandleAuraHover(AuraApplication const * aurApp, uint8 mode, boo
void AuraEffect::HandleWaterBreathing(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
// update timers in client
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->UpdateMirrorTimers();
}
void AuraEffect::HandleForceMoveForward(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
- if(apply)
+ if (apply)
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
- if(target->HasAuraType(GetAuraType()))
+ if (target->HasAuraType(GetAuraType()))
return;
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
}
@@ -3693,7 +3693,7 @@ void AuraEffect::HandleForceMoveForward(AuraApplication const * aurApp, uint8 mo
void AuraEffect::HandleModThreat(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
return;
Unit * target = aurApp->GetTarget();
@@ -3713,7 +3713,7 @@ void AuraEffect::HandleModThreat(AuraApplication const * aurApp, uint8 mode, boo
void AuraEffect::HandleAuraModTotalThreat(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
return;
Unit * target = aurApp->GetTarget();
@@ -3730,7 +3730,7 @@ void AuraEffect::HandleAuraModTotalThreat(AuraApplication const * aurApp, uint8
void AuraEffect::HandleModTaunt(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
@@ -3757,7 +3757,7 @@ void AuraEffect::HandleModTaunt(AuraApplication const * aurApp, uint8 mode, bool
void AuraEffect::HandleModConfuse(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
@@ -3767,7 +3767,7 @@ void AuraEffect::HandleModConfuse(AuraApplication const * aurApp, uint8 mode, bo
void AuraEffect::HandleModFear(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
@@ -3777,7 +3777,7 @@ void AuraEffect::HandleModFear(AuraApplication const * aurApp, uint8 mode, bool
void AuraEffect::HandleAuraModStun(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
@@ -3787,7 +3787,7 @@ void AuraEffect::HandleAuraModStun(AuraApplication const * aurApp, uint8 mode, b
void AuraEffect::HandleAuraModRoot(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
@@ -3797,13 +3797,13 @@ void AuraEffect::HandleAuraModRoot(AuraApplication const * aurApp, uint8 mode, b
void AuraEffect::HandlePreventFleeing(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
Unit::AuraEffectList const& fearAuras = target->GetAuraEffectsByType(SPELL_AURA_MOD_FEAR);
- if( !fearAuras.empty() )
+ if ( !fearAuras.empty() )
target->SetControlled(!(apply), UNIT_STAT_FLEEING);
}
@@ -3813,19 +3813,19 @@ void AuraEffect::HandlePreventFleeing(AuraApplication const * aurApp, uint8 mode
void AuraEffect::HandleModPossess(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
Unit * caster = GetCaster();
- if(caster && caster->GetTypeId() == TYPEID_UNIT)
+ if (caster && caster->GetTypeId() == TYPEID_UNIT)
{
HandleModCharm(aurApp, mode, apply);
return;
}
- if(apply)
+ if (apply)
target->SetCharmedBy(caster, CHARM_TYPE_POSSESS);
else
target->RemoveCharmedBy(caster);
@@ -3834,22 +3834,22 @@ void AuraEffect::HandleModPossess(AuraApplication const * aurApp, uint8 mode, bo
// only one spell has this aura
void AuraEffect::HandleModPossessPet(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
Unit * caster = GetCaster();
- if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
+ if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
return;
//seems it may happen that when removing it is no longer owner's pet
- //if(caster->ToPlayer()->GetPet() != target)
+ //if (caster->ToPlayer()->GetPet() != target)
// return;
- if(apply)
+ if (apply)
{
- if(caster->ToPlayer()->GetPet() != target)
+ if (caster->ToPlayer()->GetPet() != target)
return;
target->SetCharmedBy(caster, CHARM_TYPE_POSSESS);
@@ -3860,10 +3860,10 @@ void AuraEffect::HandleModPossessPet(AuraApplication const * aurApp, uint8 mode,
// Reinitialize the pet bar and make the pet come back to the owner
caster->ToPlayer()->PetSpellInitialize();
- if(!target->getVictim())
+ if (!target->getVictim())
{
target->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, target->GetFollowAngle());
- //if(target->GetCharmInfo())
+ //if (target->GetCharmInfo())
// target->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW);
}
}
@@ -3871,14 +3871,14 @@ void AuraEffect::HandleModPossessPet(AuraApplication const * aurApp, uint8 mode,
void AuraEffect::HandleModCharm(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
Unit * caster = GetCaster();
- if(apply)
+ if (apply)
target->SetCharmedBy(caster, CHARM_TYPE_CHARM);
else
target->RemoveCharmedBy(caster);
@@ -3886,14 +3886,14 @@ void AuraEffect::HandleModCharm(AuraApplication const * aurApp, uint8 mode, bool
void AuraEffect::HandleCharmConvert(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
Unit * caster = GetCaster();
- if(apply)
+ if (apply)
target->SetCharmedBy(caster, CHARM_TYPE_CONVERT);
else
target->RemoveCharmedBy(caster);
@@ -3905,32 +3905,32 @@ void AuraEffect::HandleCharmConvert(AuraApplication const * aurApp, uint8 mode,
*/
void AuraEffect::HandleAuraControlVehicle(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
- if(!target->IsVehicle())
+ if (!target->IsVehicle())
return;
Unit * caster = GetCaster();
- if(!caster || caster == target)
+ if (!caster || caster == target)
return;
if (apply)
{
- //if(caster->GetTypeId() == TYPEID_PLAYER)
- // if(Pet *pet = caster->ToPlayer()->GetPet())
+ //if (caster->GetTypeId() == TYPEID_PLAYER)
+ // if (Pet *pet = caster->ToPlayer()->GetPet())
// pet->Remove(PET_SAVE_AS_CURRENT);
caster->EnterVehicle(target->GetVehicleKit(), m_amount - 1);
}
else
{
- if(GetId() == 53111) // Devour Humanoid
+ if (GetId() == 53111) // Devour Humanoid
{
target->Kill(caster);
- if(caster->GetTypeId() == TYPEID_UNIT)
+ if (caster->GetTypeId() == TYPEID_UNIT)
caster->ToCreature()->RemoveCorpse();
}
@@ -3945,7 +3945,7 @@ void AuraEffect::HandleAuraControlVehicle(AuraApplication const * aurApp, uint8
/*********************************************************/
void AuraEffect::HandleAuraModIncreaseSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
return;
Unit * target = aurApp->GetTarget();
@@ -3955,7 +3955,7 @@ void AuraEffect::HandleAuraModIncreaseSpeed(AuraApplication const * aurApp, uint
void AuraEffect::HandleAuraModIncreaseMountedSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
return;
Unit * target = aurApp->GetTarget();
@@ -3965,7 +3965,7 @@ void AuraEffect::HandleAuraModIncreaseMountedSpeed(AuraApplication const * aurAp
void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
@@ -3976,10 +3976,10 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const * aurApp
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK && (apply || (!target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !target->HasAuraType(SPELL_AURA_FLY))))
{
- if(Player *plr = target->m_movedPlayer)
+ if (Player *plr = target->m_movedPlayer)
{
WorldPacket data;
- if(apply)
+ if (apply)
data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12);
else
data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12);
@@ -3996,18 +3996,18 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const * aurApp
target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,MECHANIC_POLYMORPH,apply);
// Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
- if( apply && target->HasAuraEffect(42016,0) && target->GetMountID())
+ if ( apply && target->HasAuraEffect(42016,0) && target->GetMountID())
target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314);
}
}
- if(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK)
+ if (mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK)
target->UpdateSpeed(MOVE_FLIGHT, true);
}
void AuraEffect::HandleAuraModIncreaseSwimSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
return;
Unit * target = aurApp->GetTarget();
@@ -4017,7 +4017,7 @@ void AuraEffect::HandleAuraModIncreaseSwimSpeed(AuraApplication const * aurApp,
void AuraEffect::HandleAuraModDecreaseSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
return;
Unit * target = aurApp->GetTarget();
@@ -4032,7 +4032,7 @@ void AuraEffect::HandleAuraModDecreaseSpeed(AuraApplication const * aurApp, uint
void AuraEffect::HandleAuraModUseNormalSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
@@ -4048,7 +4048,7 @@ void AuraEffect::HandleAuraModUseNormalSpeed(AuraApplication const * aurApp, uin
void AuraEffect::HandleModStateImmunityMask(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
@@ -4079,7 +4079,7 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const * aurApp, uint
target->RemoveAurasByType(SPELL_AURA_MOD_DECREASE_SPEED);
}
- if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
+ if (apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
{
for (std::list <AuraType>::iterator iter = immunity_list.begin(); iter != immunity_list.end(); ++iter)
{
@@ -4094,7 +4094,7 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const * aurApp, uint
void AuraEffect::HandleModMechanicImmunity(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
@@ -4126,20 +4126,20 @@ void AuraEffect::HandleModMechanicImmunity(AuraApplication const * aurApp, uint8
void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
// when removing flag aura, handle flag drop
- if( !(apply) && target->GetTypeId() == TYPEID_PLAYER
+ if ( !(apply) && target->GetTypeId() == TYPEID_PLAYER
&& (GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION) )
{
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
- if(target->ToPlayer()->InBattleGround())
+ if (target->ToPlayer()->InBattleGround())
{
- if( BattleGround *bg = target->ToPlayer()->GetBattleGround() )
+ if ( BattleGround *bg = target->ToPlayer()->GetBattleGround() )
bg->EventPlayerDroppedFlag(target->ToPlayer());
}
else
@@ -4152,12 +4152,12 @@ void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const * aurApp, uin
void AuraEffect::HandleAuraModStateImmunity(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
- if((apply) && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
+ if ((apply) && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
{
target->RemoveAurasByType(AuraType(GetMiscValue()), NULL , GetBase());
}
@@ -4167,23 +4167,23 @@ void AuraEffect::HandleAuraModStateImmunity(AuraApplication const * aurApp, uint
void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
- if((apply) && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
+ if ((apply) && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
target->ApplySpellImmune(GetId(),IMMUNITY_SCHOOL,GetMiscValue(),(apply));
// remove all flag auras (they are positive, but they must be removed when you are immune)
- if( GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
+ if ( GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
&& GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD )
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
// TODO: optimalize this cycle - use RemoveAurasWithInterruptFlags call or something else
- if((apply)
+ if ((apply)
&& GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
&& IsPositiveSpell(GetId()) ) //Only positive immunity removes auras
{
@@ -4192,7 +4192,7 @@ void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const * aurApp, uin
for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();)
{
SpellEntry const *spell = iter->second->GetBase()->GetSpellProto();
- if((GetSpellSchoolMask(spell) & school_mask)//Check for school mask
+ if ((GetSpellSchoolMask(spell) & school_mask)//Check for school mask
&& IsDispelableBySpell(GetSpellProto(),spell->Id, true)
&& !iter->second->IsPositive() //Don't remove positive spells
&& spell->Id != GetId() ) //Don't remove self
@@ -4203,9 +4203,9 @@ void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const * aurApp, uin
++iter;
}
}
- if(GetSpellProto()->Mechanic == MECHANIC_BANISH)
+ if (GetSpellProto()->Mechanic == MECHANIC_BANISH)
{
- if( apply )
+ if ( apply )
target->addUnitState(UNIT_STAT_ISOLATED);
else
{
@@ -4225,7 +4225,7 @@ void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const * aurApp, uin
void AuraEffect::HandleAuraModDmgImmunity(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
@@ -4235,7 +4235,7 @@ void AuraEffect::HandleAuraModDmgImmunity(AuraApplication const * aurApp, uint8
void AuraEffect::HandleAuraModDispelImmunity(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
@@ -4253,17 +4253,17 @@ void AuraEffect::HandleAuraModDispelImmunity(AuraApplication const * aurApp, uin
void AuraEffect::HandleAuraModResistanceExclusive(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
{
- if(GetMiscValue() & int32(1<<x))
+ if (GetMiscValue() & int32(1<<x))
{
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(GetAmount()), apply);
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->ApplyResistanceBuffModsMod(SpellSchools(x),aurApp->IsPositive(),GetAmount(), apply);
}
}
@@ -4271,17 +4271,17 @@ void AuraEffect::HandleAuraModResistanceExclusive(AuraApplication const * aurApp
void AuraEffect::HandleAuraModResistance(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
{
- if(GetMiscValue() & int32(1<<x))
+ if (GetMiscValue() & int32(1<<x))
{
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(GetAmount()), apply);
- if(target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
target->ApplyResistanceBuffModsMod(SpellSchools(x),GetAmount() > 0,GetAmount(), apply);
}
}
@@ -4289,23 +4289,23 @@ void AuraEffect::HandleAuraModResistance(AuraApplication const * aurApp, uint8 m
void AuraEffect::HandleAuraModBaseResistancePCT(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
// only players have base stats
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
{
//pets only have base armor
- if(target->ToCreature()->isPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
+ if (target->ToCreature()->isPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(GetAmount()), apply);
}
else
{
for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
{
- if(GetMiscValue() & int32(1<<x))
+ if (GetMiscValue() & int32(1<<x))
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_PCT, float(GetAmount()), apply);
}
}
@@ -4313,17 +4313,17 @@ void AuraEffect::HandleAuraModBaseResistancePCT(AuraApplication const * aurApp,
void AuraEffect::HandleModResistancePercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
for (int8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
{
- if(GetMiscValue() & int32(1<<i))
+ if (GetMiscValue() & int32(1<<i))
{
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(GetAmount()), apply);
- if(target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
{
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),true,GetAmount(), apply);
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),false,GetAmount(), apply);
@@ -4334,29 +4334,29 @@ void AuraEffect::HandleModResistancePercent(AuraApplication const * aurApp, uint
void AuraEffect::HandleModBaseResistance(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
// only players have base stats
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
{
//only pets have base stats
- if(target->ToCreature()->isPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
+ if (target->ToCreature()->isPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
target->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(GetAmount()), apply);
}
else
{
for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
- if(GetMiscValue() & (1<<i))
+ if (GetMiscValue() & (1<<i))
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_VALUE, float(GetAmount()), apply);
}
}
void AuraEffect::HandleModTargetResistance(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4378,7 +4378,7 @@ void AuraEffect::HandleModTargetResistance(AuraApplication const * aurApp, uint8
void AuraEffect::HandleAuraModStat(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4396,7 +4396,7 @@ void AuraEffect::HandleAuraModStat(AuraApplication const * aurApp, uint8 mode, b
{
//target->ApplyStatMod(Stats(i), m_amount,apply);
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(GetAmount()), apply);
- if(target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
target->ApplyStatBuffMod(Stats(i),GetAmount(),apply);
}
}
@@ -4404,7 +4404,7 @@ void AuraEffect::HandleAuraModStat(AuraApplication const * aurApp, uint8 mode, b
void AuraEffect::HandleModPercentStat(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4421,19 +4421,19 @@ void AuraEffect::HandleModPercentStat(AuraApplication const * aurApp, uint8 mode
for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
{
- if(GetMiscValue() == i || GetMiscValue() == -1)
+ if (GetMiscValue() == i || GetMiscValue() == -1)
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_amount), apply);
}
}
void AuraEffect::HandleModSpellDamagePercentFromStat(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
// Magic damage modifiers implemented in Unit::SpellDamageBonus
@@ -4444,12 +4444,12 @@ void AuraEffect::HandleModSpellDamagePercentFromStat(AuraApplication const * aur
void AuraEffect::HandleModSpellHealingPercentFromStat(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
// Recalculate bonus
@@ -4458,12 +4458,12 @@ void AuraEffect::HandleModSpellHealingPercentFromStat(AuraApplication const * au
void AuraEffect::HandleModSpellDamagePercentFromAttackPower(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
// Magic damage modifiers implemented in Unit::SpellDamageBonus
@@ -4474,12 +4474,12 @@ void AuraEffect::HandleModSpellDamagePercentFromAttackPower(AuraApplication cons
void AuraEffect::HandleModSpellHealingPercentFromAttackPower(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
// Recalculate bonus
@@ -4488,12 +4488,12 @@ void AuraEffect::HandleModSpellHealingPercentFromAttackPower(AuraApplication con
void AuraEffect::HandleModHealingDone(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
// implemented in Unit::SpellHealingBonus
// this information is for client side only
@@ -4502,7 +4502,7 @@ void AuraEffect::HandleModHealingDone(AuraApplication const * aurApp, uint8 mode
void AuraEffect::HandleModTotalPercentStat(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4519,10 +4519,10 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const * aurApp, uint8
for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
{
- if(GetMiscValue() == i || GetMiscValue() == -1)
+ if (GetMiscValue() == i || GetMiscValue() == -1)
{
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(GetAmount()), apply);
- if(target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
target->ApplyStatPercentBuffMod(Stats(i), GetAmount(), apply );
}
}
@@ -4538,15 +4538,15 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const * aurApp, uint8
void AuraEffect::HandleAuraModResistenceOfStatPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
- if(GetMiscValue() != SPELL_SCHOOL_MASK_NORMAL)
+ if (GetMiscValue() != SPELL_SCHOOL_MASK_NORMAL)
{
// support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
// and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
@@ -4560,12 +4560,12 @@ void AuraEffect::HandleAuraModResistenceOfStatPercent(AuraApplication const * au
void AuraEffect::HandleAuraModExpertise(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
target->ToPlayer()->UpdateExpertise(BASE_ATTACK);
@@ -4577,7 +4577,7 @@ void AuraEffect::HandleAuraModExpertise(AuraApplication const * aurApp, uint8 mo
/********************************/
void AuraEffect::HandleModPowerRegen(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4593,7 +4593,7 @@ void AuraEffect::HandleModPowerRegen(AuraApplication const * aurApp, uint8 mode,
void AuraEffect::HandleModPowerRegenPCT(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4609,7 +4609,7 @@ void AuraEffect::HandleModPowerRegenPCT(AuraApplication const * aurApp, uint8 mo
void AuraEffect::HandleModManaRegen(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4623,12 +4623,12 @@ void AuraEffect::HandleModManaRegen(AuraApplication const * aurApp, uint8 mode,
void AuraEffect::HandleAuraModIncreaseHealth(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(apply)
+ if (apply)
{
target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
target->ModifyHealth(GetAmount());
@@ -4645,7 +4645,7 @@ void AuraEffect::HandleAuraModIncreaseHealth(AuraApplication const * aurApp, uin
void AuraEffect::HandleAuraModIncreaseMaxHealth(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4656,10 +4656,10 @@ void AuraEffect::HandleAuraModIncreaseMaxHealth(AuraApplication const * aurApp,
target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
// refresh percentage
- if(oldhealth > 0)
+ if (oldhealth > 0)
{
uint32 newhealth = uint32(ceil((double)target->GetMaxHealth() * healthPercentage));
- if(newhealth==0)
+ if (newhealth==0)
newhealth = 1;
target->SetHealth(newhealth);
@@ -4668,13 +4668,13 @@ void AuraEffect::HandleAuraModIncreaseMaxHealth(AuraApplication const * aurApp,
void AuraEffect::HandleAuraModIncreaseEnergy(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
Powers powerType = target->getPowerType();
- if(int32(powerType) != GetMiscValue())
+ if (int32(powerType) != GetMiscValue())
return;
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
@@ -4697,13 +4697,13 @@ void AuraEffect::HandleAuraModIncreaseEnergy(AuraApplication const * aurApp, uin
void AuraEffect::HandleAuraModIncreaseEnergyPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
Powers powerType = target->getPowerType();
- if(int32(powerType) != GetMiscValue())
+ if (int32(powerType) != GetMiscValue())
return;
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
@@ -4713,7 +4713,7 @@ void AuraEffect::HandleAuraModIncreaseEnergyPercent(AuraApplication const * aurA
void AuraEffect::HandleAuraModIncreaseHealthPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4727,7 +4727,7 @@ void AuraEffect::HandleAuraModIncreaseHealthPercent(AuraApplication const * aurA
void AuraEffect::HandleAuraIncreaseBaseHealthPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4741,12 +4741,12 @@ void AuraEffect::HandleAuraIncreaseBaseHealthPercent(AuraApplication const * aur
void AuraEffect::HandleAuraModParryPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
target->ToPlayer()->UpdateParryPercentage();
@@ -4754,12 +4754,12 @@ void AuraEffect::HandleAuraModParryPercent(AuraApplication const * aurApp, uint8
void AuraEffect::HandleAuraModDodgePercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
target->ToPlayer()->UpdateDodgePercentage();
@@ -4767,12 +4767,12 @@ void AuraEffect::HandleAuraModDodgePercent(AuraApplication const * aurApp, uint8
void AuraEffect::HandleAuraModBlockPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
target->ToPlayer()->UpdateBlockPercentage();
@@ -4780,12 +4780,12 @@ void AuraEffect::HandleAuraModBlockPercent(AuraApplication const * aurApp, uint8
void AuraEffect::HandleAuraModRegenInterrupt(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
target->ToPlayer()->UpdateManaRegen();
@@ -4793,16 +4793,16 @@ void AuraEffect::HandleAuraModRegenInterrupt(AuraApplication const * aurApp, uin
void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
for (int i = 0; i < MAX_ATTACK; ++i)
- if(Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
+ if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
target->ToPlayer()->_ApplyWeaponDependentAuraCritMod(pItem,WeaponAttackType(i),this,apply);
// mods must be applied base at equipped weapon class and subclass comparison
@@ -4823,12 +4823,12 @@ void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const * aurApp,
void AuraEffect::HandleModHitChance(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
target->ToPlayer()->UpdateMeleeHitChances();
target->ToPlayer()->UpdateRangedHitChances();
@@ -4842,12 +4842,12 @@ void AuraEffect::HandleModHitChance(AuraApplication const * aurApp, uint8 mode,
void AuraEffect::HandleModSpellHitChance(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->UpdateSpellHitChances();
else
target->m_modSpellHitChance += (apply) ? GetAmount(): (-GetAmount());
@@ -4855,12 +4855,12 @@ void AuraEffect::HandleModSpellHitChance(AuraApplication const * aurApp, uint8 m
void AuraEffect::HandleModSpellCritChance(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->UpdateAllSpellCritChances();
else
target->m_baseSpellCritChance += (apply) ? GetAmount():-GetAmount();
@@ -4868,12 +4868,12 @@ void AuraEffect::HandleModSpellCritChance(AuraApplication const * aurApp, uint8
void AuraEffect::HandleModSpellCritChanceShool(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
@@ -4883,12 +4883,12 @@ void AuraEffect::HandleModSpellCritChanceShool(AuraApplication const * aurApp, u
void AuraEffect::HandleAuraModCritPct(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
{
target->m_baseSpellCritChance += (apply) ? GetAmount():-GetAmount();
return;
@@ -4908,7 +4908,7 @@ void AuraEffect::HandleAuraModCritPct(AuraApplication const * aurApp, uint8 mode
void AuraEffect::HandleModCastingSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4918,7 +4918,7 @@ void AuraEffect::HandleModCastingSpeed(AuraApplication const * aurApp, uint8 mod
void AuraEffect::HandleModMeleeRangedSpeedPct(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4930,7 +4930,7 @@ void AuraEffect::HandleModMeleeRangedSpeedPct(AuraApplication const * aurApp, ui
void AuraEffect::HandleModCombatSpeedPct(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4943,7 +4943,7 @@ void AuraEffect::HandleModCombatSpeedPct(AuraApplication const * aurApp, uint8 m
void AuraEffect::HandleModAttackSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4954,7 +4954,7 @@ void AuraEffect::HandleModAttackSpeed(AuraApplication const * aurApp, uint8 mode
void AuraEffect::HandleHaste(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4966,7 +4966,7 @@ void AuraEffect::HandleHaste(AuraApplication const * aurApp, uint8 mode, bool ap
void AuraEffect::HandleAuraModRangedHaste(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -4976,12 +4976,12 @@ void AuraEffect::HandleAuraModRangedHaste(AuraApplication const * aurApp, uint8
void AuraEffect::HandleRangedAmmoHaste(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetAmount(), apply);
@@ -4993,12 +4993,12 @@ void AuraEffect::HandleRangedAmmoHaste(AuraApplication const * aurApp, uint8 mod
void AuraEffect::HandleModRating(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
@@ -5008,12 +5008,12 @@ void AuraEffect::HandleModRating(AuraApplication const * aurApp, uint8 mode, boo
void AuraEffect::HandleModRatingFromStat(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
// Just recalculate ratings
@@ -5028,7 +5028,7 @@ void AuraEffect::HandleModRatingFromStat(AuraApplication const * aurApp, uint8 m
void AuraEffect::HandleAuraModAttackPower(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -5038,12 +5038,12 @@ void AuraEffect::HandleAuraModAttackPower(AuraApplication const * aurApp, uint8
void AuraEffect::HandleAuraModRangedAttackPower(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if((target->getClassMask() & CLASSMASK_WAND_USERS)!=0)
+ if ((target->getClassMask() & CLASSMASK_WAND_USERS)!=0)
return;
target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(GetAmount()), apply);
@@ -5051,7 +5051,7 @@ void AuraEffect::HandleAuraModRangedAttackPower(AuraApplication const * aurApp,
void AuraEffect::HandleAuraModAttackPowerPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -5062,12 +5062,12 @@ void AuraEffect::HandleAuraModAttackPowerPercent(AuraApplication const * aurApp,
void AuraEffect::HandleAuraModRangedAttackPowerPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
- if((target->getClassMask() & CLASSMASK_WAND_USERS)!=0)
+ if ((target->getClassMask() & CLASSMASK_WAND_USERS)!=0)
return;
//UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
@@ -5076,37 +5076,37 @@ void AuraEffect::HandleAuraModRangedAttackPowerPercent(AuraApplication const * a
void AuraEffect::HandleAuraModRangedAttackPowerOfStatPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
// Recalculate bonus
- if(target->GetTypeId() == TYPEID_PLAYER && !(target->getClassMask() & CLASSMASK_WAND_USERS))
+ if (target->GetTypeId() == TYPEID_PLAYER && !(target->getClassMask() & CLASSMASK_WAND_USERS))
target->ToPlayer()->UpdateAttackPowerAndDamage(true);
}
void AuraEffect::HandleAuraModAttackPowerOfStatPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
// Recalculate bonus
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->UpdateAttackPowerAndDamage(false);
}
void AuraEffect::HandleAuraModAttackPowerOfArmor(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
// Recalculate bonus
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->UpdateAttackPowerAndDamage(false);
}
/********************************/
@@ -5114,16 +5114,16 @@ void AuraEffect::HandleAuraModAttackPowerOfArmor(AuraApplication const * aurApp,
/********************************/
void AuraEffect::HandleModDamageDone(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
// apply item specific bonuses for already equipped weapon
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
for (int i = 0; i < MAX_ATTACK; ++i)
- if(Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
+ if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(pItem,WeaponAttackType(i),this,apply);
}
@@ -5136,7 +5136,7 @@ void AuraEffect::HandleModDamageDone(AuraApplication const * aurApp, uint8 mode,
// with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
// GetMiscValue() comparison with item generated damage types
- if((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) != 0)
+ if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) != 0)
{
// apply generic physical damage bonuses including wand case
if (GetSpellProto()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER)
@@ -5145,9 +5145,9 @@ void AuraEffect::HandleModDamageDone(AuraApplication const * aurApp, uint8 mode,
target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(GetAmount()), apply);
target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(GetAmount()), apply);
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
- if(GetAmount() > 0)
+ if (GetAmount() > 0)
target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS,GetAmount(),apply);
else
target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG,GetAmount(),apply);
@@ -5160,10 +5160,10 @@ void AuraEffect::HandleModDamageDone(AuraApplication const * aurApp, uint8 mode,
}
// Skip non magic case for speedup
- if((GetMiscValue() & SPELL_SCHOOL_MASK_MAGIC) == 0)
+ if ((GetMiscValue() & SPELL_SCHOOL_MASK_MAGIC) == 0)
return;
- if( GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0 )
+ if ( GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0 )
{
// wand magic case (skip generic to all item spell bonuses)
// done in Player::_ApplyWeaponDependentAuraMods
@@ -5174,13 +5174,13 @@ void AuraEffect::HandleModDamageDone(AuraApplication const * aurApp, uint8 mode,
// Magic damage modifiers implemented in Unit::SpellDamageBonus
// This information for client side use only
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
- if(GetAmount() > 0)
+ if (GetAmount() > 0)
{
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++)
{
- if((GetMiscValue() & (1<<i)) != 0)
+ if ((GetMiscValue() & (1<<i)) != 0)
target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i,GetAmount(),apply);
}
}
@@ -5188,18 +5188,18 @@ void AuraEffect::HandleModDamageDone(AuraApplication const * aurApp, uint8 mode,
{
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++)
{
- if((GetMiscValue() & (1<<i)) != 0)
+ if ((GetMiscValue() & (1<<i)) != 0)
target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i,GetAmount(),apply);
}
}
- if(Guardian* pet = target->ToPlayer()->GetGuardianPet())
+ if (Guardian* pet = target->ToPlayer()->GetGuardianPet())
pet->UpdateAttackPowerAndDamage();
}
}
void AuraEffect::HandleModDamagePercentDone(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -5207,10 +5207,10 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const * aurApp, uint
sLog.outDebug("AURA MOD DAMAGE type:%u negative:%u", GetMiscValue(), GetAmount() > 0);
// apply item specific bonuses for already equipped weapon
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
for (int i = 0; i < MAX_ATTACK; ++i)
- if(Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
+ if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(pItem,WeaponAttackType(i),this,apply);
}
@@ -5223,7 +5223,7 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const * aurApp, uint
// with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
// GetMiscValue() comparison with item generated damage types
- if((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) != 0)
+ if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) != 0)
{
// apply generic physical damage bonuses including wand case
if (GetSpellProto()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER)
@@ -5232,7 +5232,7 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const * aurApp, uint
target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(GetAmount()), apply);
target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(GetAmount()), apply);
// For show in client
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT,GetAmount()/100.0f,apply);
}
else
@@ -5242,10 +5242,10 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const * aurApp, uint
}
// Skip non magic case for speedup
- if((GetMiscValue() & SPELL_SCHOOL_MASK_MAGIC) == 0)
+ if ((GetMiscValue() & SPELL_SCHOOL_MASK_MAGIC) == 0)
return;
- if( GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0 )
+ if ( GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0 )
{
// wand magic case (skip generic to all item spell bonuses)
// done in Player::_ApplyWeaponDependentAuraMods
@@ -5256,14 +5256,14 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const * aurApp, uint
// Magic damage percent modifiers implemented in Unit::SpellDamageBonus
// Send info to client
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+i,GetAmount()/100.0f,apply);
}
void AuraEffect::HandleModOffhandDamagePercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
@@ -5273,16 +5273,16 @@ void AuraEffect::HandleModOffhandDamagePercent(AuraApplication const * aurApp, u
void AuraEffect::HandleShieldBlockValue(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
+ if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
BaseModType modType = FLAT_MOD;
- if(GetAuraType() == SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT)
+ if (GetAuraType() == SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT)
modType = PCT_MOD;
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(GetAmount()), apply);
}
@@ -5299,7 +5299,7 @@ void AuraEffect::HandleModPowerCostPCT(AuraApplication const * aurApp, uint8 mod
float amount = GetAmount() /100.0f;
for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
- if(GetMiscValue() & (1<<i))
+ if (GetMiscValue() & (1<<i))
target->ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER+i,amount,apply);
}
@@ -5311,7 +5311,7 @@ void AuraEffect::HandleModPowerCost(AuraApplication const * aurApp, uint8 mode,
Unit * target = aurApp->GetTarget();
for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
- if(GetMiscValue() & (1<<i))
+ if (GetMiscValue() & (1<<i))
target->ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER+i,GetAmount(),apply);
}
@@ -5322,12 +5322,12 @@ void AuraEffect::HandleArenaPreparation(AuraApplication const * aurApp, uint8 mo
Unit * target = aurApp->GetTarget();
- if(apply)
+ if (apply)
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION);
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
- if(target->HasAuraType(GetAuraType()))
+ if (target->HasAuraType(GetAuraType()))
return;
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION);
}
@@ -5340,7 +5340,7 @@ void AuraEffect::HandleNoReagentUseAura(AuraApplication const * aurApp, uint8 mo
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
flag96 mask;
@@ -5360,13 +5360,13 @@ void AuraEffect::HandleAuraRetainComboPoints(AuraApplication const * aurApp, uin
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
// combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
// remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
- if( !(apply) && GetBase()->GetDuration()==0 && target->ToPlayer()->GetComboTarget())
- if(Unit* unit = ObjectAccessor::GetUnit(*target,target->ToPlayer()->GetComboTarget()))
+ if ( !(apply) && GetBase()->GetDuration()==0 && target->ToPlayer()->GetComboTarget())
+ if (Unit* unit = ObjectAccessor::GetUnit(*target,target->ToPlayer()->GetComboTarget()))
target->ToPlayer()->AddComboPoints(unit, -GetAmount());
}
@@ -5386,7 +5386,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
if (mode & AURA_EFFECT_HANDLE_REAL)
{
// AT APPLY
- if(apply)
+ if (apply)
{
// Overpower
if (caster && m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR &&
@@ -5418,12 +5418,12 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
{
case 1515: // Tame beast
// FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
- if( caster && target->CanHaveThreatList())
+ if ( caster && target->CanHaveThreatList())
target->AddThreat(caster, 10.0f);
break;
case 13139: // net-o-matic
// root to self part of (root_target->charge->root_self sequence
- if(caster)
+ if (caster)
caster->CastSpell(caster,13138,true,NULL,this);
break;
case 34026: // kill command
@@ -5437,11 +5437,11 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
// set 3 stacks and 3 charges (to make all auras not disappear at once)
Aura * owner_aura = target->GetAura(34027,GetCasterGUID());
Aura * pet_aura = pet->GetAura(58914, GetCasterGUID());
- if( owner_aura )
+ if ( owner_aura )
{
owner_aura->SetStackAmount(owner_aura->GetSpellProto()->StackAmount);
}
- if( pet_aura )
+ if ( pet_aura )
{
pet_aura->SetCharges(0);
pet_aura->SetStackAmount(owner_aura->GetSpellProto()->StackAmount);
@@ -5450,7 +5450,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
}
case 37096: // Blood Elf Illusion
{
- if(caster)
+ if (caster)
{
switch(caster->getGender())
{
@@ -5471,7 +5471,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
target->CastSpell(target,55166,true,NULL,this);
// set 3 stacks and 3 charges (to make all auras not disappear at once)
Aura * owner_aura = target->GetAura(55166,GetCasterGUID());
- if( owner_aura )
+ if ( owner_aura )
{
// This aura lasts 2 sec, need this hack to properly proc spells
// TODO: drop aura charges for ApplySpellMod in ProcDamageAndSpell
@@ -5483,14 +5483,14 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
break;
}
case 39850: // Rocket Blast
- if(roll_chance_i(20)) // backfire stun
+ if (roll_chance_i(20)) // backfire stun
target->CastSpell(target, 51581, true, NULL, this);
break;
case 43873: // Headless Horseman Laugh
target->PlayDistanceSound(11965);
break;
case 46354: // Blood Elf Illusion
- if(caster)
+ if (caster)
{
switch(caster->getGender())
{
@@ -5512,7 +5512,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
}
break;
case 46699: // Requires No Ammo
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use
break;
case 49028:
@@ -5520,11 +5520,11 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
caster->SetPower(POWER_RUNIC_POWER, 0);
break;
case 62061: // Festive Holiday Mount
- if(target->HasAuraType(SPELL_AURA_MOUNTED))
+ if (target->HasAuraType(SPELL_AURA_MOUNTED))
target->CastSpell(target, 25860, true, NULL, this); // Reindeer Transformation
break;
case 52916: // Honor Among Thieves
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
if (Unit * spellTarget = ObjectAccessor::GetUnit(*target,target->ToPlayer()->GetComboTarget()))
target->CastSpell(spellTarget, 51699, true);
break;
@@ -5532,7 +5532,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
case 28833: // Mark of Blaumeux
case 28834: // Mark of Rivendare
case 28835: // Mark of Zeliek
- if(caster) // actually we can also use cast(this, originalcasterguid)
+ if (caster) // actually we can also use cast(this, originalcasterguid)
{
int32 damage;
switch(GetBase()->GetStackAmount())
@@ -5545,7 +5545,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
case 6: damage = 12000; break;
default:damage = 20000 + 1000 * (GetBase()->GetStackAmount() - 7); break;
}
- if(damage)
+ if (damage)
caster->CastCustomSpell(28836, SPELLVALUE_BASE_POINT0, damage, target);
}
break;
@@ -5554,7 +5554,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
// AT REMOVE
else
{
- if( (IsQuestTameSpell(GetId())) && caster && caster->isAlive() && target->isAlive())
+ if ( (IsQuestTameSpell(GetId())) && caster && caster->isAlive() && target->isAlive())
{
uint32 finalSpelId = 0;
switch(GetId())
@@ -5579,7 +5579,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
case 30105: finalSpelId = 30104; break;
}
- if(finalSpelId)
+ if (finalSpelId)
caster->CastSpell(target,finalSpelId,true,NULL,this);
}
@@ -5590,8 +5590,8 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
{
case 2584: // Waiting to Resurrect
// Waiting to resurrect spell cancel, we must remove player from resurrect queue
- if(target->GetTypeId() == TYPEID_PLAYER)
- if(BattleGround *bg = target->ToPlayer()->GetBattleGround())
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ if (BattleGround *bg = target->ToPlayer()->GetBattleGround())
bg->RemovePlayerFromResurrectQueue(target->GetGUID());
break;
case 28169: // Mutating Injection
@@ -5631,18 +5631,18 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
break;
case SPELLFAMILY_MAGE:
// Living Bomb
- if(m_spellProto->SpellFamilyFlags[1] & 0x20000)
+ if (m_spellProto->SpellFamilyFlags[1] & 0x20000)
{
AuraRemoveMode mode = aurApp->GetRemoveMode();
- if(caster && (mode == AURA_REMOVE_BY_ENEMY_SPELL || mode == AURA_REMOVE_BY_EXPIRE))
+ if (caster && (mode == AURA_REMOVE_BY_ENEMY_SPELL || mode == AURA_REMOVE_BY_EXPIRE))
caster->CastSpell(target, GetAmount(), true);
}
break;
case SPELLFAMILY_WARLOCK:
// Haunt
- if(m_spellProto->SpellFamilyFlags[1] & 0x40000)
+ if (m_spellProto->SpellFamilyFlags[1] & 0x40000)
{
- if(caster)
+ if (caster)
caster->CastCustomSpell(caster, 48210, &m_amount, 0, 0, true, NULL, this);
}
break;
@@ -5682,12 +5682,12 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
break;
case SPELLFAMILY_HUNTER:
// Misdirection
- if(GetId()==34477)
+ if (GetId()==34477)
target->SetReducedThreatPercent(0, 0);
break;
case SPELLFAMILY_DEATHKNIGHT:
// Summon Gargoyle ( will start feeding gargoyle )
- if(GetId()==61777)
+ if (GetId()==61777)
target->CastSpell(target,m_spellProto->EffectTriggerSpell[m_effIndex],true);
break;
default:
@@ -5755,7 +5755,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
Unit *owner = caster->GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
{
- if(apply)
+ if (apply)
owner->CastSpell(owner,8985,true);
else
owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
@@ -5771,7 +5771,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
Unit *owner = caster->GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
{
- if(apply)
+ if (apply)
owner->CastSpell(owner,19704,true);
else
owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
@@ -5793,12 +5793,12 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
case 57821: // Champion of the Kirin Tor
case 57822: // Wyrmrest Champion
{
- if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
+ if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
break;
uint32 FactionID = 0;
- if(apply)
+ if (apply)
{
switch(m_spellProto->Id)
{
@@ -5813,10 +5813,10 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
}
// LK Intro VO (1)
case 58204:
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
// Play part 1
- if(apply)
+ if (apply)
target->PlayDirectSound(14970, target->ToPlayer());
// continue in 58205
else
@@ -5825,10 +5825,10 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
break;
// LK Intro VO (2)
case 58205:
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
{
// Play part 2
- if(apply)
+ if (apply)
target->PlayDirectSound(14971, target->ToPlayer());
// Play part 3
else
@@ -5950,9 +5950,9 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
if (mode & AURA_EFFECT_HANDLE_REAL)
{
// pet auras
- if(PetAura const* petSpell = spellmgr.GetPetAura(GetId(), m_effIndex))
+ if (PetAura const* petSpell = spellmgr.GetPetAura(GetId(), m_effIndex))
{
- if(apply)
+ if (apply)
target->AddPetAura(petSpell);
else
target->RemovePetAura(petSpell);
@@ -5962,27 +5962,27 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
void AuraEffect::HandleChannelDeathItem(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
- if(!(apply))
+ if (!(apply))
{
Unit * caster = GetCaster();
- if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
+ if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
return;
Player *plCaster = caster->ToPlayer();
Unit *target = aurApp->GetTarget();
- if(target->getDeathState() != JUST_DIED)
+ if (target->getDeathState() != JUST_DIED)
return;
// Item amount
if (GetAmount() <= 0)
return;
- if(GetSpellProto()->EffectItemType[m_effIndex] == 0)
+ if (GetSpellProto()->EffectItemType[m_effIndex] == 0)
return;
// Soul Shard
@@ -6009,7 +6009,7 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const * aurApp, uint8 mo
ItemPosCountVec dest;
uint8 msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellProto()->EffectItemType[m_effIndex], count, &noSpaceForCount);
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
count-=noSpaceForCount;
plCaster->SendEquipError(msg, NULL, NULL);
@@ -6029,14 +6029,14 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const * aurApp, uint8 mo
void AuraEffect::HandleBindSight(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
Unit * caster = GetCaster();
- if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
+ if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
return;
caster->ToPlayer()->SetViewpoint(target, (apply));
@@ -6044,12 +6044,12 @@ void AuraEffect::HandleBindSight(AuraApplication const * aurApp, uint8 mode, boo
void AuraEffect::HandleForceReaction(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)target;
@@ -6067,7 +6067,7 @@ void AuraEffect::HandleForceReaction(AuraApplication const * aurApp, uint8 mode,
void AuraEffect::HandleAuraEmpathy(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
@@ -6075,35 +6075,35 @@ void AuraEffect::HandleAuraEmpathy(AuraApplication const * aurApp, uint8 mode, b
if (target->GetTypeId() != TYPEID_UNIT)
return;
- if(!(apply))
+ if (!(apply))
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
- if(target->HasAuraType(GetAuraType()))
+ if (target->HasAuraType(GetAuraType()))
return;
}
CreatureInfo const * ci = objmgr.GetCreatureTemplate(target->GetEntry());
- if(ci && ci->type == CREATURE_TYPE_BEAST)
+ if (ci && ci->type == CREATURE_TYPE_BEAST)
target->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply);
}
void AuraEffect::HandleAuraModFaction(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
- if(apply)
+ if (apply)
{
target->setFaction(GetMiscValue());
- if(target->GetTypeId()==TYPEID_PLAYER)
+ if (target->GetTypeId()==TYPEID_PLAYER)
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
}
else
{
target->RestoreFaction();
- if(target->GetTypeId()==TYPEID_PLAYER)
+ if (target->GetTypeId()==TYPEID_PLAYER)
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
}
}
@@ -6111,12 +6111,12 @@ void AuraEffect::HandleAuraModFaction(AuraApplication const * aurApp, uint8 mode
void AuraEffect::HandleComprehendLanguage(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
+ if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
return;
Unit * target = aurApp->GetTarget();
- if(apply)
+ if (apply)
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_COMPREHEND_LANG);
else
{
@@ -6129,28 +6129,28 @@ void AuraEffect::HandleComprehendLanguage(AuraApplication const * aurApp, uint8
void AuraEffect::HandleAuraConvertRune(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
- if(target->GetTypeId() != TYPEID_PLAYER)
+ if (target->GetTypeId() != TYPEID_PLAYER)
return;
Player *plr = (Player*)target;
- if(plr->getClass() != CLASS_DEATH_KNIGHT)
+ if (plr->getClass() != CLASS_DEATH_KNIGHT)
return;
uint32 runes = m_amount;
// convert number of runes specified in aura amount of rune type in miscvalue to runetype in miscvalueb
- if(apply)
+ if (apply)
{
for (uint32 i = 0; i < MAX_RUNES && runes; ++i)
{
if (GetMiscValue() != plr->GetCurrentRune(i))
continue;
- if(!plr->GetRuneCooldown(i))
+ if (!plr->GetRuneCooldown(i))
{
// ConvertRune(i,
plr->AddRuneByAuraEffect(i, RuneType(GetMiscValueB()), this);
@@ -6164,7 +6164,7 @@ void AuraEffect::HandleAuraConvertRune(AuraApplication const * aurApp, uint8 mod
void AuraEffect::HandleAuraLinked(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
- if(!(mode & AURA_EFFECT_HANDLE_REAL))
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit * target = aurApp->GetTarget();
diff --git a/src/game/SpellAuraEffects.h b/src/game/SpellAuraEffects.h
index 59cd7b81614..71f42885e4f 100644
--- a/src/game/SpellAuraEffects.h
+++ b/src/game/SpellAuraEffects.h
@@ -49,8 +49,8 @@ class AuraEffect
void CalculatePeriodic(Unit * caster, bool create = false);
void CalculateSpellMod();
void ChangeAmount(int32 newAmount, bool mark = true);
- void RecalculateAmount() { if(!CanBeRecalculated()) return; ChangeAmount(CalculateAmount(GetCaster()), false); }
- void RecalculateAmount(Unit * caster) { if(!CanBeRecalculated()) return; ChangeAmount(CalculateAmount(caster), false); }
+ void RecalculateAmount() { if (!CanBeRecalculated()) return; ChangeAmount(CalculateAmount(GetCaster()), false); }
+ void RecalculateAmount(Unit * caster) { if (!CanBeRecalculated()) return; ChangeAmount(CalculateAmount(caster), false); }
bool CanBeRecalculated() const { return m_canBeRecalculated; }
void SetCanBeRecalculated(bool val) { m_canBeRecalculated = val; }
void HandleEffect(AuraApplication const * aurApp, uint8 mode, bool apply);
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index b8032cd742f..528a4ab3d4b 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -41,7 +41,7 @@ AuraApplication::AuraApplication(Unit * target, Unit * caster, Aura * aura, uint
{
assert(GetTarget() && GetBase());
- if(GetBase()->IsVisible())
+ if (GetBase()->IsVisible())
{
// Try find slot for aura
uint8 slot = MAX_AURAS;
@@ -58,7 +58,7 @@ AuraApplication::AuraApplication(Unit * target, Unit * caster, Aura * aura, uint
Unit::VisibleAuraMap::const_iterator itr = visibleAuras->find(0);
for (uint32 freeSlot = 0; freeSlot < MAX_AURAS; ++itr , ++freeSlot)
{
- if(itr == visibleAuras->end() || itr->first != freeSlot)
+ if (itr == visibleAuras->end() || itr->first != freeSlot)
{
slot = freeSlot;
break;
@@ -67,7 +67,7 @@ AuraApplication::AuraApplication(Unit * target, Unit * caster, Aura * aura, uint
}
// Register Visible Aura
- if(slot < MAX_AURAS)
+ if (slot < MAX_AURAS)
{
m_slot = slot;
m_target->SetVisibleAura(slot, this);
@@ -124,7 +124,7 @@ bool AuraApplication::_CheckPositive(Unit * caster) const
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if((1<<i & GetEffectMask()))
+ if ((1<<i & GetEffectMask()))
{
if (m_isNeedManyNegativeEffects == IsPositiveEffect(GetBase()->GetId(), i))
return m_isNeedManyNegativeEffects;
@@ -174,7 +174,7 @@ void AuraApplication::ClientUpdate(bool remove)
data.append(GetTarget()->GetPackGUID());
data << uint8(m_slot);
- if(remove)
+ if (remove)
{
assert(!m_target->GetVisibleAura(m_slot));
data << uint32(0);
@@ -193,10 +193,10 @@ void AuraApplication::ClientUpdate(bool remove)
data << uint8(aura->GetCasterLevel());
data << uint8(aura->GetStackAmount() > 1 ? aura->GetStackAmount() : (aura->GetCharges()) ? aura->GetCharges() : 1);
- if(!(flags & AFLAG_CASTER))
+ if (!(flags & AFLAG_CASTER))
data.appendPackGUID(aura->GetCasterGUID());
- if(flags & AFLAG_DURATION)
+ if (flags & AFLAG_DURATION)
{
data << uint32(aura->GetMaxDuration());
data << uint32(aura->GetDuration());
@@ -304,7 +304,7 @@ m_spellProto(spellproto), m_owner(owner), m_casterGuid(casterGUID ? casterGUID :
m_applyTime(time(NULL)), m_timeCla(0), m_isSingleTarget(false), m_updateTargetMapInterval(0),
m_procCharges(0), m_stackAmount(1), m_isRemoved(false), m_casterLevel(caster ? caster->getLevel() : m_spellProto->spellLevel)
{
- if(m_spellProto->manaPerSecond || m_spellProto->manaPerSecondPerLevel)
+ if (m_spellProto->manaPerSecond || m_spellProto->manaPerSecondPerLevel)
m_timeCla = 1 * IN_MILISECONDS;
Player* modOwner = NULL;
@@ -317,16 +317,16 @@ m_spellProto(spellproto), m_owner(owner), m_casterGuid(casterGUID ? casterGUID :
else
m_maxDuration = GetSpellDuration(m_spellProto);
- if(IsPassive() && m_spellProto->DurationIndex == 0)
+ if (IsPassive() && m_spellProto->DurationIndex == 0)
m_maxDuration = -1;
- if(!IsPermanent() && modOwner)
+ if (!IsPermanent() && modOwner)
modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, m_maxDuration);
m_duration = m_maxDuration;
m_procCharges = m_spellProto->procCharges;
- if(modOwner)
+ if (modOwner)
modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, m_procCharges);
for (uint8 i=0 ; i<MAX_SPELL_EFFECTS; ++i)
@@ -353,7 +353,7 @@ Unit* Aura::GetCaster() const
{
if (GetOwner()->GetGUID() == GetCasterGUID())
return GetUnitOwner();
- if(AuraApplication const * aurApp = GetApplicationOfTarget(GetCasterGUID()))
+ if (AuraApplication const * aurApp = GetApplicationOfTarget(GetCasterGUID()))
return aurApp->GetTarget();
return ObjectAccessor::GetUnit(*GetOwner(), GetCasterGUID());
@@ -374,7 +374,7 @@ void Aura::_ApplyForTarget(Unit * target, Unit * caster, AuraApplication * auraA
m_applications[target->GetGUID()] = auraApp;
// set infinity cooldown state for spells
- if(caster && caster->GetTypeId() == TYPEID_PLAYER)
+ if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{
if (m_spellProto->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE)
{
@@ -397,7 +397,7 @@ void Aura::_UnapplyForTarget(Unit * target, Unit * caster, AuraApplication * aur
m_removedApplications.push_back(auraApp);
// reset cooldown state for spells
- if(caster && caster->GetTypeId() == TYPEID_PLAYER)
+ if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{
if ( GetSpellProto()->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE )
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
@@ -482,7 +482,7 @@ void Aura::UpdateTargetMap(Unit * caster, bool apply)
for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
{
Aura const * aura = iter->second->GetBase();
- if(!spellmgr.CanAurasStack(GetSpellProto(), aura->GetSpellProto(), aura->GetCasterGUID() == GetCasterGUID()))
+ if (!spellmgr.CanAurasStack(GetSpellProto(), aura->GetSpellProto(), aura->GetCasterGUID() == GetCasterGUID()))
{
addUnit = false;
break;
@@ -556,7 +556,7 @@ void Aura::UpdateOwner(uint32 diff, WorldObject * owner)
// used for example when triggered spell of spell:10 is modded
Spell * modSpell = NULL;
Player * modOwner = NULL;
- if(caster)
+ if (caster)
if ((modOwner = caster->GetSpellModOwner())
&& (modSpell = modOwner->FindCurrentSpellBySpellId(GetId())))
modOwner->SetSpellModTakingSpell(modSpell, true);
@@ -589,18 +589,18 @@ void Aura::Update(uint32 diff, Unit * caster)
m_duration = 0;
// handle manaPerSecond/manaPerSecondPerLevel
- if(m_timeCla)
+ if (m_timeCla)
{
- if(m_timeCla > diff)
+ if (m_timeCla > diff)
m_timeCla -= diff;
- else if(caster)
+ else if (caster)
{
- if(int32 manaPerSecond = m_spellProto->manaPerSecond + m_spellProto->manaPerSecondPerLevel * caster->getLevel())
+ if (int32 manaPerSecond = m_spellProto->manaPerSecond + m_spellProto->manaPerSecondPerLevel * caster->getLevel())
{
m_timeCla += 1000 - diff;
Powers powertype = Powers(m_spellProto->powerType);
- if(powertype == POWER_HEALTH)
+ if (powertype == POWER_HEALTH)
{
if (caster->GetHealth() > manaPerSecond)
caster->ModifyHealth(-manaPerSecond);
@@ -642,10 +642,10 @@ void Aura::RefreshDuration()
{
SetDuration(GetMaxDuration());
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if(m_effects[i])
+ if (m_effects[i])
m_effects[i]->ResetPeriodic();
- if(m_spellProto->manaPerSecond || m_spellProto->manaPerSecondPerLevel)
+ if (m_spellProto->manaPerSecond || m_spellProto->manaPerSecondPerLevel)
m_timeCla = 1 * IN_MILISECONDS;
}
@@ -659,9 +659,9 @@ void Aura::SetCharges(uint8 charges)
bool Aura::DropCharge()
{
- if(m_procCharges) //auras without charges always have charge = 0
+ if (m_procCharges) //auras without charges always have charge = 0
{
- if(--m_procCharges) // Send charge change
+ if (--m_procCharges) // Send charge change
SetNeedClientUpdateForTargets();
else // Last charge dropped
{
@@ -740,7 +740,7 @@ bool Aura::HasEffectType(AuraType type) const
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if(m_effects[i] && m_effects[i]->GetAuraType() == type)
+ if (m_effects[i] && m_effects[i]->GetAuraType() == type)
return true;
}
return false;
@@ -751,7 +751,7 @@ void Aura::RecalculateAmountOfEffects()
assert (!IsRemoved());
Unit * caster = GetCaster();
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if(m_effects[i])
+ if (m_effects[i])
m_effects[i]->RecalculateAmount(caster);
}
@@ -759,7 +759,7 @@ void Aura::HandleAllEffects(AuraApplication const * aurApp, uint8 mode, bool app
{
assert (!IsRemoved());
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if(m_effects[i] && !IsRemoved())
+ if (m_effects[i] && !IsRemoved())
m_effects[i]->HandleEffect(aurApp, mode, apply);
}
@@ -787,7 +787,7 @@ void Aura::SetLoadedState(int32 maxduration, int32 duration, int32 charges, uint
m_stackAmount = stackamount;
Unit * caster = GetCaster();
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if(m_effects[i])
+ if (m_effects[i])
{
m_effects[i]->SetAmount(amount[i]);
m_effects[i]->SetCanBeRecalculated(recalculateMask & (1<<i));
@@ -804,7 +804,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
AuraRemoveMode removeMode = aurApp->GetRemoveMode();
// spell_area table
SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAuraMapBounds(GetId());
- if(saBounds.first != saBounds.second)
+ if (saBounds.first != saBounds.second)
{
uint32 zone, area;
target->GetZoneAndAreaId(zone,area);
@@ -812,12 +812,12 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
// some auras remove at aura remove
- if(!itr->second->IsFitToRequirements((Player*)target,zone,area))
+ if (!itr->second->IsFitToRequirements((Player*)target,zone,area))
target->RemoveAurasDueToSpell(itr->second->spellId);
// some auras applied at aura apply
- else if(itr->second->autocast)
+ else if (itr->second->autocast)
{
- if( !target->HasAura(itr->second->spellId) )
+ if ( !target->HasAura(itr->second->spellId) )
target->CastSpell(target,itr->second->spellId,true);
}
}
@@ -826,14 +826,14 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
if (apply)
{
// Apply linked auras (On first aura apply)
- if(spellmgr.GetSpellCustomAttr(GetId()) & SPELL_ATTR_CU_LINK_AURA)
+ if (spellmgr.GetSpellCustomAttr(GetId()) & SPELL_ATTR_CU_LINK_AURA)
{
- if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(GetId() + SPELL_LINK_AURA))
+ if (const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(GetId() + SPELL_LINK_AURA))
for (std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
{
- if(*itr < 0)
+ if (*itr < 0)
target->ApplySpellImmune(GetId(), IMMUNITY_ID, -(*itr), true);
- else if(caster)
+ else if (caster)
caster->AddAura(*itr, target);
}
}
@@ -843,15 +843,15 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
switch(GetId())
{
case 32474: // Buffeting Winds of Susurrus
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->ActivateTaxiPathTo(506, GetId());
break;
case 33572: // Gronn Lord's Grasp, becomes stoned
- if(GetStackAmount() >= 5 && !target->HasAura(33652))
+ if (GetStackAmount() >= 5 && !target->HasAura(33652))
target->CastSpell(target, 33652, true);
break;
case 60970: // Heroic Fury (remove Intercept cooldown)
- if(target->GetTypeId() == TYPEID_PLAYER)
+ if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->RemoveSpellCooldown(20252, true);
break;
}
@@ -902,7 +902,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
default:
sLog.outError("Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency (%d) found", aurEff->GetId());
}
- if(spellId)
+ if (spellId)
caster->CastSpell(caster, spellId, true);
}
}
@@ -913,8 +913,8 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
switch(GetId())
{
case 48020: // Demonic Circle
- if(target->GetTypeId() == TYPEID_PLAYER)
- if(GameObject* obj = target->GetGameObject(48018))
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ if (GameObject* obj = target->GetGameObject(48018))
{
target->ToPlayer()->TeleportTo(obj->GetMapId(),obj->GetPositionX(),obj->GetPositionY(),obj->GetPositionZ(),obj->GetOrientation());
target->ToPlayer()->RemoveMovementImpairingAuras();
@@ -959,16 +959,16 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
break;
case SPELLFAMILY_ROGUE:
// Sprint (skip non player casted spells by category)
- if(GetSpellProto()->SpellFamilyFlags[0] & 0x40 && GetSpellProto()->Category == 44)
+ if (GetSpellProto()->SpellFamilyFlags[0] & 0x40 && GetSpellProto()->Category == 44)
// in official maybe there is only one icon?
- if(target->HasAura(58039)) // Glyph of Blurred Speed
+ if (target->HasAura(58039)) // Glyph of Blurred Speed
target->CastSpell(target, 61922, true); // Sprint (waterwalk)
break;
case SPELLFAMILY_DEATHKNIGHT:
if (!caster)
break;
// Frost Fever and Blood Plague
- if(GetSpellProto()->SpellFamilyFlags[2] & 0x2)
+ if (GetSpellProto()->SpellFamilyFlags[2] & 0x2)
{
// Can't proc on self
if (GetCasterGUID() == target->GetGUID())
@@ -1013,27 +1013,27 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
else
{
// Remove Linked Auras
- if(removeMode != AURA_REMOVE_BY_STACK && removeMode != AURA_REMOVE_BY_DEATH)
+ if (removeMode != AURA_REMOVE_BY_STACK && removeMode != AURA_REMOVE_BY_DEATH)
{
- if(uint32 customAttr = spellmgr.GetSpellCustomAttr(GetId()))
+ if (uint32 customAttr = spellmgr.GetSpellCustomAttr(GetId()))
{
- if(customAttr & SPELL_ATTR_CU_LINK_REMOVE)
+ if (customAttr & SPELL_ATTR_CU_LINK_REMOVE)
{
- if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)GetId()))
+ if (const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)GetId()))
for (std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
{
- if(*itr < 0)
+ if (*itr < 0)
target->RemoveAurasDueToSpell(-(*itr));
else if (removeMode != AURA_REMOVE_BY_DEFAULT)
target->CastSpell(target, *itr, true, 0, 0, GetCasterGUID());
}
}
- if(customAttr & SPELL_ATTR_CU_LINK_AURA)
+ if (customAttr & SPELL_ATTR_CU_LINK_AURA)
{
- if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(GetId() + SPELL_LINK_AURA))
+ if (const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(GetId() + SPELL_LINK_AURA))
for (std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
{
- if(*itr < 0)
+ if (*itr < 0)
target->ApplySpellImmune(GetId(), IMMUNITY_ID, -(*itr), false);
else
target->RemoveAurasDueToSpell(*itr);
@@ -1199,12 +1199,12 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
case 47788: // Guardian Spirit
if (removeMode != AURA_REMOVE_BY_EXPIRE)
break;
- if(caster->GetTypeId() != TYPEID_PLAYER)
+ if (caster->GetTypeId() != TYPEID_PLAYER)
break;
Player *player = caster->ToPlayer();
// Glyph of Guardian Spirit
- if(AuraEffect * aurEff = player->GetAuraEffect(63231, 0))
+ if (AuraEffect * aurEff = player->GetAuraEffect(63231, 0))
{
if (!player->HasSpellCooldown(47788))
break;
@@ -1237,7 +1237,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
break;
if (target->GetTypeId() != TYPEID_PLAYER)
break;
- if(target->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT)
+ if (target->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT)
break;
// aura removed - remove death runes
@@ -1384,7 +1384,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
// Unholy Presence bonus
if (presence == 48265)
{
- if(unholyPresenceAura)
+ if (unholyPresenceAura)
{
// Not listed as any effect, only base points set
int32 basePoints0 = unholyPresenceAura->GetSpellProto()->EffectBasePoints[1];
@@ -1408,7 +1408,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
target->RemoveAurasDueToSpell(61261);
if (presence == 48265 || unholyPresenceAura)
{
- if(presence == 48265 && unholyPresenceAura)
+ if (presence == 48265 && unholyPresenceAura)
{
target->RemoveAurasDueToSpell(63622);
target->RemoveAurasDueToSpell(65095);
@@ -1546,7 +1546,7 @@ void UnitAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit * caster)
targetList.push_back(GetUnitOwner());
case SPELL_EFFECT_APPLY_AREA_AURA_OWNER:
{
- if(Unit *owner = GetUnitOwner()->GetCharmerOrOwner())
+ if (Unit *owner = GetUnitOwner()->GetCharmerOrOwner())
if (GetUnitOwner()->IsWithinDistInMap(owner, radius))
targetList.push_back(owner);
break;
@@ -1589,7 +1589,7 @@ void DynObjAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit * caster)
if (!HasEffect(effIndex))
continue;
UnitList targetList;
- if(GetSpellProto()->EffectImplicitTargetB[effIndex] == TARGET_DEST_DYNOBJ_ALLY
+ if (GetSpellProto()->EffectImplicitTargetB[effIndex] == TARGET_DEST_DYNOBJ_ALLY
|| GetSpellProto()->EffectImplicitTargetB[effIndex] == TARGET_UNIT_AREA_ALLY_DST)
{
Trinity::AnyFriendlyUnitInObjectRangeCheck u_check(GetDynobjOwner(), dynObjOwnerCaster, radius);
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 6ff98b977a2..2d156744e75 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -242,18 +242,18 @@ void Spell::EffectUnused(uint32 /*i*/)
void Spell::EffectResurrectNew(uint32 i)
{
- if(!unitTarget || unitTarget->isAlive())
+ if (!unitTarget || unitTarget->isAlive())
return;
- if(unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- if(!unitTarget->IsInWorld())
+ if (!unitTarget->IsInWorld())
return;
Player* pTarget = unitTarget->ToPlayer();
- if(pTarget->isRessurectRequested()) // already have one active request
+ if (pTarget->isRessurectRequested()) // already have one active request
return;
uint32 health = damage;
@@ -287,7 +287,7 @@ void Spell::EffectInstaKill(uint32 /*i*/)
m_caster->CastSpell(m_caster, spellID, true);
}
- if(m_caster == unitTarget) // prevent interrupt message
+ if (m_caster == unitTarget) // prevent interrupt message
finish();
m_caster->DealDamage(unitTarget, unitTarget->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
@@ -306,7 +306,7 @@ void Spell::EffectEnvirinmentalDMG(uint32 i)
m_caster->CalcAbsorbResist(m_caster, GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist, m_spellInfo);
m_caster->SendSpellNonMeleeDamageLog(m_caster, m_spellInfo->Id, damage, GetSpellSchoolMask(m_spellInfo), absorb, resist, false, 0, false);
- if(m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->EnvironmentalDamage(DAMAGE_FIRE, damage);
}
@@ -348,9 +348,9 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
{
uint8 count = 0;
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
- if(ihit->targetGUID != m_caster->GetGUID())
- if(Player *target = ObjectAccessor::FindPlayer(ihit->targetGUID))
- if(target->HasAura(m_triggeredByAuraSpell->Id))
+ if (ihit->targetGUID != m_caster->GetGUID())
+ if (Player *target = ObjectAccessor::FindPlayer(ihit->targetGUID))
+ if (target->HasAura(m_triggeredByAuraSpell->Id))
++count;
if (count)
{
@@ -377,14 +377,14 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
case 25599: // Thundercrash
{
damage = unitTarget->GetHealth() / 2;
- if(damage < 200)
+ if (damage < 200)
damage = 200;
break;
}
// arcane charge. must only affect demons (also undead?)
case 45072:
{
- if(unitTarget->GetCreatureType() != CREATURE_TYPE_DEMON
+ if (unitTarget->GetCreatureType() != CREATURE_TYPE_DEMON
&& unitTarget->GetCreatureType() != CREATURE_TYPE_UNDEAD)
return;
break;
@@ -393,7 +393,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
case 33671:
{
// don't damage self and only players
- if(unitTarget->GetGUID() == m_caster->GetGUID() || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (unitTarget->GetGUID() == m_caster->GetGUID() || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
float radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[0]));
@@ -406,7 +406,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
// Shadowbolts only affects targets with Shadow Mark (Gothik)
case 27831:
case 55638:
- if(!unitTarget->HasAura(27825))
+ if (!unitTarget->HasAura(27825))
return;
break;
// Cataclysmic Bolt
@@ -458,11 +458,11 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
case SPELLFAMILY_WARLOCK:
{
// Incinerate Rank 1 & 2
- if((m_spellInfo->SpellFamilyFlags[1] & 0x000040) && m_spellInfo->SpellIconID==2128)
+ if ((m_spellInfo->SpellFamilyFlags[1] & 0x000040) && m_spellInfo->SpellIconID==2128)
{
// Incinerate does more dmg (dmg*0.25) if the target have Immolate debuff.
// Check aura state for speed but aura state set not only for Immolate spell
- if(unitTarget->HasAuraState(AURA_STATE_CONFLAGRATE))
+ if (unitTarget->HasAuraState(AURA_STATE_CONFLAGRATE))
{
if (unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x4, 0, 0))
damage += damage/4;
@@ -528,7 +528,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
if (AuraEffect * aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2874, 0))
back_damage -= aurEff->GetAmount() * back_damage / 100;
- if(back_damage < unitTarget->GetHealth())
+ if (back_damage < unitTarget->GetHealth())
m_caster->CastCustomSpell(m_caster, 32409, &back_damage, 0, 0, true);
}
// Mind Blast - applies Mind Trauma if:
@@ -673,7 +673,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
}
// TODO: should this be put on taken but not done?
- if(found)
+ if (found)
damage += m_spellInfo->EffectBasePoints[1];
if (m_caster->GetTypeId() == TYPEID_PLAYER)
@@ -718,7 +718,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
damage += int32(0.2f*ap + 0.32f*sp);
}
// Judgement of Wisdom, Light, Justice
- else if(m_spellInfo->Id == 54158)
+ else if (m_spellInfo->Id == 54158)
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
float sp = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo));
@@ -738,7 +738,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
}
}
- if(m_originalCaster && damage > 0 && apply_direct_bonus)
+ if (m_originalCaster && damage > 0 && apply_direct_bonus)
damage = m_originalCaster->SpellDamageBonus(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE);
m_damage += damage;
@@ -767,7 +767,7 @@ void Spell::EffectDummy(uint32 i)
{
uint32 count = 0;
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
- if(ihit->effectMask & (1<<i))
+ if (ihit->effectMask & (1<<i))
++count;
damage = 12000; // maybe wrong value
@@ -777,7 +777,7 @@ void Spell::EffectDummy(uint32 i)
// now deal the damage
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
- if(ihit->effectMask & (1<<i))
+ if (ihit->effectMask & (1<<i))
{
if (Unit* casttarget = Unit::GetUnit((*unitTarget), ihit->targetGUID))
m_caster->DealDamage(casttarget, damage, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, spellInfo, false);
@@ -785,7 +785,7 @@ void Spell::EffectDummy(uint32 i)
}
case 8063: // Deviate Fish
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = 0;
@@ -802,7 +802,7 @@ void Spell::EffectDummy(uint32 i)
}
case 8213: // Savory Deviate Delight
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = 0;
@@ -871,9 +871,9 @@ void Spell::EffectDummy(uint32 i)
uint32 roll = urand(0, 99);
- if(roll < 2) // 2% for 30 sec self root (off-like chance unknown)
+ if (roll < 2) // 2% for 30 sec self root (off-like chance unknown)
spell_id = 16566;
- else if(roll < 4) // 2% for 20 sec root, charge to target (off-like chance unknown)
+ else if (roll < 4) // 2% for 20 sec root, charge to target (off-like chance unknown)
spell_id = 13119;
else // normal root
spell_id = 13099;
@@ -937,7 +937,7 @@ void Spell::EffectDummy(uint32 i)
}
case 16589: // Noggenfogger Elixir
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = 0;
@@ -953,10 +953,10 @@ void Spell::EffectDummy(uint32 i)
}
case 17251: // Spirit Healer Res
{
- if(!unitTarget || !m_originalCaster)
+ if (!unitTarget || !m_originalCaster)
return;
- if(m_originalCaster->GetTypeId() == TYPEID_PLAYER)
+ if (m_originalCaster->GetTypeId() == TYPEID_PLAYER)
{
WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8);
data << uint64(unitTarget->GetGUID());
@@ -966,7 +966,7 @@ void Spell::EffectDummy(uint32 i)
}
case 17271: // Test Fetid Skull
{
- if(!itemTarget && m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (!itemTarget && m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = roll_chance_i(50)
@@ -982,7 +982,7 @@ void Spell::EffectDummy(uint32 i)
return;
case 23019: // Crystal Prison Dummy DND
{
- if(!unitTarget || !unitTarget->isAlive() || unitTarget->GetTypeId() != TYPEID_UNIT || unitTarget->ToCreature()->isPet())
+ if (!unitTarget || !unitTarget->isAlive() || unitTarget->GetTypeId() != TYPEID_UNIT || unitTarget->ToCreature()->isPet())
return;
Creature* creatureTarget = unitTarget->ToCreature();
@@ -1075,17 +1075,17 @@ void Spell::EffectDummy(uint32 i)
}
// Polarity Shift
case 28089:
- if(unitTarget)
+ if (unitTarget)
unitTarget->CastSpell(unitTarget, roll_chance_i(50) ? 28059 : 28084, true, NULL, NULL, m_caster->GetGUID());
break;
// Polarity Shift
case 39096:
- if(unitTarget)
+ if (unitTarget)
unitTarget->CastSpell(unitTarget, roll_chance_i(50) ? 39088 : 39091, true, NULL, NULL, m_caster->GetGUID());
break;
case 29200: // Purify Helboar Meat
{
- if( m_caster->GetTypeId() != TYPEID_PLAYER )
+ if ( m_caster->GetTypeId() != TYPEID_PLAYER )
return;
uint32 spell_id = roll_chance_i(50)
@@ -1102,21 +1102,21 @@ void Spell::EffectDummy(uint32 i)
return;
case 30458: // Nigh Invulnerability
if (!m_CastItem) return;
- if(roll_chance_i(86)) // Nigh-Invulnerability - success
+ if (roll_chance_i(86)) // Nigh-Invulnerability - success
m_caster->CastSpell(m_caster, 30456, true, m_CastItem);
else // Complete Vulnerability - backfire in 14% casts
m_caster->CastSpell(m_caster, 30457, true, m_CastItem);
return;
case 30507: // Poultryizer
if (!m_CastItem) return;
- if(roll_chance_i(80)) // Poultryized! - success
+ if (roll_chance_i(80)) // Poultryized! - success
m_caster->CastSpell(unitTarget, 30501, true, m_CastItem);
else // Poultryized! - backfire 20%
m_caster->CastSpell(unitTarget, 30504, true, m_CastItem);
return;
case 33060: // Make a Wish
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = 0;
@@ -1148,7 +1148,7 @@ void Spell::EffectDummy(uint32 i)
}
case 37674: // Chaos Blast
{
- if(!unitTarget)
+ if (!unitTarget)
return;
int32 basepoints0 = 100;
@@ -1216,7 +1216,7 @@ void Spell::EffectDummy(uint32 i)
}
case 44875: // Complete Raptor Capture
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
return;
unitTarget->ToCreature()->ForcedDespawn();
@@ -1227,7 +1227,7 @@ void Spell::EffectDummy(uint32 i)
}
case 34665: //Administer Antidote
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT
|| unitTarget->GetEntry() != 16880 || unitTarget->ToCreature()->isPet())
return;
@@ -1325,7 +1325,7 @@ void Spell::EffectDummy(uint32 i)
return;
case 50243: // Teach Language
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// spell has a 1/3 chance to trigger one of the below
@@ -1346,10 +1346,10 @@ void Spell::EffectDummy(uint32 i)
}
case 51582: //Rocket Boots Engaged (Rocket Boots Xtreme and Rocket Boots Xtreme Lite)
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
- if(BattleGround* bg = m_caster->ToPlayer()->GetBattleGround())
+ if (BattleGround* bg = m_caster->ToPlayer()->GetBattleGround())
bg->EventPlayerDroppedFlag(m_caster->ToPlayer());
m_caster->CastSpell(m_caster, 30452, true, NULL);
@@ -1357,7 +1357,7 @@ void Spell::EffectDummy(uint32 i)
}
case 51592: // Pickup Primordial Hatchling
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
return;
unitTarget->ToCreature()->ForcedDespawn();
@@ -1399,7 +1399,7 @@ void Spell::EffectDummy(uint32 i)
return; // implemented in EffectScript[0]
case 59640: // Underbelly Elixir
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = 0;
@@ -1414,10 +1414,10 @@ void Spell::EffectDummy(uint32 i)
}
case 62324: // Throw Passenger
{
- if(m_targets.HasTraj())
+ if (m_targets.HasTraj())
{
- if(Vehicle *vehicle = m_caster->GetVehicleKit())
- if(Unit *passenger = vehicle->GetPassenger(damage - 1))
+ if (Vehicle *vehicle = m_caster->GetVehicleKit())
+ if (Unit *passenger = vehicle->GetPassenger(damage - 1))
{
std::list<Unit*> unitList;
// use 99 because it is 3d search
@@ -1426,20 +1426,20 @@ void Spell::EffectDummy(uint32 i)
Vehicle *target = NULL;
for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
{
- if(Vehicle *seat = (*itr)->GetVehicleKit())
- if(!seat->GetPassenger(0))
- if(Unit *device = seat->GetPassenger(2))
- if(!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
+ if (Vehicle *seat = (*itr)->GetVehicleKit())
+ if (!seat->GetPassenger(0))
+ if (Unit *device = seat->GetPassenger(2))
+ if (!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
{
float dist = (*itr)->GetExactDistSq(&m_targets.m_dstPos);
- if(dist < minDist)
+ if (dist < minDist)
{
minDist = dist;
target = seat;
}
}
}
- if(target && target->GetBase()->IsWithinDist2d(&m_targets.m_dstPos, GetSpellRadius(m_spellInfo, i, false) * 2)) // now we use *2 because the location of the seat is not correct
+ if (target && target->GetBase()->IsWithinDist2d(&m_targets.m_dstPos, GetSpellRadius(m_spellInfo, i, false) * 2)) // now we use *2 because the location of the seat is not correct
passenger->EnterVehicle(target, 0);
else
{
@@ -1469,7 +1469,7 @@ void Spell::EffectDummy(uint32 i)
{
case 11958: // Cold Snap
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// immediately finishes the cooldown on Frost spells
@@ -1478,7 +1478,7 @@ void Spell::EffectDummy(uint32 i)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
- if( spellInfo->SpellFamilyName == SPELLFAMILY_MAGE &&
+ if ( spellInfo->SpellFamilyName == SPELLFAMILY_MAGE &&
(GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) &&
spellInfo->Id != 11958 && GetSpellRecoveryTime(spellInfo) > 0 )
{
@@ -1521,27 +1521,27 @@ void Spell::EffectDummy(uint32 i)
break;
case SPELLFAMILY_WARRIOR:
// Charge
- if(m_spellInfo->SpellFamilyFlags & SPELLFAMILYFLAG_WARRIOR_CHARGE && m_spellInfo->SpellVisual[0] == 867)
+ if (m_spellInfo->SpellFamilyFlags & SPELLFAMILYFLAG_WARRIOR_CHARGE && m_spellInfo->SpellVisual[0] == 867)
{
int32 chargeBasePoints0 = damage;
m_caster->CastCustomSpell(m_caster, 34846, &chargeBasePoints0, NULL, NULL, true);
//Juggernaut crit bonus
- if(m_caster->HasAura(64976))
+ if (m_caster->HasAura(64976))
m_caster->CastSpell(m_caster, 65156, true);
return;
}
//Slam
- if(m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARRIOR_SLAM && m_spellInfo->SpellIconID == 559)
+ if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARRIOR_SLAM && m_spellInfo->SpellIconID == 559)
{
int32 bp0 = damage;
m_caster->CastCustomSpell(unitTarget, 50783, &bp0, NULL, NULL, true, 0);
return;
}
// Execute
- if(m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARRIOR_EXECUTE)
+ if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARRIOR_EXECUTE)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
uint32 rage = m_caster->GetPower(POWER_RAGE);
@@ -1567,7 +1567,7 @@ void Spell::EffectDummy(uint32 i)
m_caster->ModifyPower(POWER_RAGE, -m_powerCost);
}
- if(rage > 300)
+ if (rage > 300)
rage = 300;
bp = damage+int32(rage * m_spellInfo->DmgMultiplier[i] +
@@ -1575,7 +1575,7 @@ void Spell::EffectDummy(uint32 i)
break;
}
// Concussion Blow
- if(m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARRIOR_CONCUSSION_BLOW)
+ if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARRIOR_CONCUSSION_BLOW)
{
m_damage+= uint32(damage * m_caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100);
return;
@@ -1585,7 +1585,7 @@ void Spell::EffectDummy(uint32 i)
// Warrior's Wrath
case 21977:
{
- if(!unitTarget)
+ if (!unitTarget)
return;
m_caster->CastSpell(unitTarget, 21887, true);// spell mod
return;
@@ -1627,7 +1627,7 @@ void Spell::EffectDummy(uint32 i)
}
// Think its not need (also need remove Life Tap from SpellDamageBonus or add new value)
// damage = m_caster->SpellDamageBonus(m_caster, m_spellInfo,uint32(damage > 0 ? damage : 0), SPELL_DIRECT_DAMAGE);
- if(unitTarget && (int32(unitTarget->GetHealth()) > damage))
+ if (unitTarget && (int32(unitTarget->GetHealth()) > damage))
{
// Shouldn't Appear in Combat Log
unitTarget->ModifyHealth(-damage);
@@ -1644,7 +1644,7 @@ void Spell::EffectDummy(uint32 i)
if (AuraEffect const * aurEff = m_caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARLOCK, 1982, 0))
manaFeedVal = aurEff->GetAmount();
- if(manaFeedVal > 0)
+ if (manaFeedVal > 0)
{
manaFeedVal = manaFeedVal * mana / 100;
m_caster->CastCustomSpell(m_caster, 32553, &manaFeedVal, NULL, NULL, true, NULL);
@@ -1686,15 +1686,15 @@ void Spell::EffectDummy(uint32 i)
if (m_spellInfo->SpellFamilyFlags[2] & SPELLFAMILYFLAG2_DRUID_STARFALL)
{
//Shapeshifting into an animal form or mounting cancels the effect.
- if(m_caster->GetCreatureType() == CREATURE_TYPE_BEAST || m_caster->IsMounted())
+ if (m_caster->GetCreatureType() == CREATURE_TYPE_BEAST || m_caster->IsMounted())
{
- if(m_triggeredByAuraSpell)
+ if (m_triggeredByAuraSpell)
m_caster->RemoveAurasDueToSpell(m_triggeredByAuraSpell->Id);
return;
}
//Any effect which causes you to lose control of your character will supress the starfall effect.
- if(m_caster->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_ROOT | UNIT_STAT_CONFUSED))
+ if (m_caster->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_ROOT | UNIT_STAT_CONFUSED))
return;
m_caster->CastSpell(unitTarget, damage, true);
@@ -1712,31 +1712,31 @@ void Spell::EffectDummy(uint32 i)
{
case 5938: // Shiv
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player *pCaster = m_caster->ToPlayer();
Item *item = pCaster->GetWeaponForAttack(OFF_ATTACK);
- if(!item)
+ if (!item)
return;
// all poison enchantments is temporary
uint32 enchant_id = item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT);
- if(!enchant_id)
+ if (!enchant_id)
return;
SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
- if(!pEnchant)
+ if (!pEnchant)
return;
for (int s=0; s<3; s++)
{
- if(pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
+ if (pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
continue;
SpellEntry const* combatEntry = sSpellStore.LookupEntry(pEnchant->spellid[s]);
- if(!combatEntry || combatEntry->Dispel != DISPEL_POISON)
+ if (!combatEntry || combatEntry->Dispel != DISPEL_POISON)
continue;
m_caster->CastSpell(unitTarget, combatEntry, true, item);
@@ -1747,7 +1747,7 @@ void Spell::EffectDummy(uint32 i)
}
case 14185: // Preparation
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
//immediately finishes the cooldown on certain Rogue abilities
@@ -1790,7 +1790,7 @@ void Spell::EffectDummy(uint32 i)
}
case 23989: // Readiness talent
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath
@@ -1950,12 +1950,12 @@ void Spell::EffectDummy(uint32 i)
return;
}
// Healing Stream Totem
- if(m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_HEALING_STREAM)
+ if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_HEALING_STREAM)
{
if (!unitTarget)
return;
// Restorative Totems
- if(Unit *owner = m_caster->GetOwner())
+ if (Unit *owner = m_caster->GetOwner())
if (AuraEffect *dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 338, 1))
damage += damage * dummy->GetAmount() / 100;
@@ -1970,12 +1970,12 @@ void Spell::EffectDummy(uint32 i)
m_caster->CastCustomSpell(unitTarget, 52032, &damage, 0, 0, true, 0, 0, m_originalCasterGUID);
return;
}
- if(m_spellInfo->Id == 39610) // Mana Tide Totem effect
+ if (m_spellInfo->Id == 39610) // Mana Tide Totem effect
{
- if(!unitTarget || unitTarget->getPowerType() != POWER_MANA)
+ if (!unitTarget || unitTarget->getPowerType() != POWER_MANA)
return;
// Glyph of Mana Tide
- if(Unit *owner = m_caster->GetOwner())
+ if (Unit *owner = m_caster->GetOwner())
if (AuraEffect *dummy = owner->GetAuraEffect(55441, 0))
damage += dummy->GetAmount();
// Regenerate 6% of Total Mana Every 3 secs
@@ -2042,15 +2042,15 @@ void Spell::EffectDummy(uint32 i)
return;
}
// Scourge Strike
- if(m_spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_DK_SCOURGE_STRIKE)
+ if (m_spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_DK_SCOURGE_STRIKE)
{
m_damage = float (m_damage) * (float(damage * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) + 100.0f) / 100.0f);
return;
}
// Death Coil
- if(m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_DK_DEATH_COIL)
+ if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_DK_DEATH_COIL)
{
- if(m_caster->IsFriendlyTo(unitTarget))
+ if (m_caster->IsFriendlyTo(unitTarget))
{
int32 bp = damage * 1.5f;
m_caster->CastCustomSpell(unitTarget, 47633, &bp, NULL, NULL, true);
@@ -2069,7 +2069,7 @@ void Spell::EffectDummy(uint32 i)
return;
}
// Death Grip
- if(m_spellInfo->Id == 49560)
+ if (m_spellInfo->Id == 49560)
{
if (Unit *unit = unitTarget->GetVehicleBase()) // what is this for?
unit->CastSpell(m_caster, damage, true);
@@ -2077,13 +2077,13 @@ void Spell::EffectDummy(uint32 i)
unitTarget->CastSpell(m_caster, damage, true);
return;
}
- else if(m_spellInfo->Id == 46584) // Raise dead
+ else if (m_spellInfo->Id == 46584) // Raise dead
{
if ( m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// Do we have talent Master of Ghouls?
- if(m_caster->HasAura(52143))
+ if (m_caster->HasAura(52143))
// summon as pet
bp = 52150;
else
@@ -2113,7 +2113,7 @@ void Spell::EffectDummy(uint32 i)
spell_id = m_currentBasePoints[0];
}
// Corpse Explosion
- else if(m_spellInfo->SpellIconID == 1737)
+ else if (m_spellInfo->SpellIconID == 1737)
{
// Dummy effect 1 is used only for targeting and damage amount
if (i!=0)
@@ -2150,11 +2150,11 @@ void Spell::EffectDummy(uint32 i)
}
//spells triggered by dummy effect should not miss
- if(spell_id)
+ if (spell_id)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spell_id );
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outError("EffectDummy of spell %u: triggering unknown spell id %i\n", m_spellInfo->Id, spell_id);
return;
@@ -2162,12 +2162,12 @@ void Spell::EffectDummy(uint32 i)
targets.setUnitTarget(unitTarget);
Spell* spell = new Spell(m_caster, spellInfo, triggered, m_originalCasterGUID, NULL, true);
- if(bp) spell->m_currentBasePoints[0] = bp;
+ if (bp) spell->m_currentBasePoints[0] = bp;
spell->prepare(&targets);
}
// pet auras
- if(PetAura const* petSpell = spellmgr.GetPetAura(m_spellInfo->Id,i))
+ if (PetAura const* petSpell = spellmgr.GetPetAura(m_spellInfo->Id,i))
{
m_caster->AddPetAura(petSpell);
return;
@@ -2175,11 +2175,11 @@ void Spell::EffectDummy(uint32 i)
// Script based implementation. Must be used only for not good for implementation in core spell effects
// So called only for not proccessed cases
- if(gameObjTarget)
+ if (gameObjTarget)
sScriptMgr.EffectDummyGameObj(m_caster, m_spellInfo->Id, i, gameObjTarget);
- else if(unitTarget && unitTarget->GetTypeId() == TYPEID_UNIT)
+ else if (unitTarget && unitTarget->GetTypeId() == TYPEID_UNIT)
sScriptMgr.EffectDummyCreature(m_caster, m_spellInfo->Id, i, unitTarget->ToCreature());
- else if(itemTarget)
+ else if (itemTarget)
sScriptMgr.EffectDummyItem(m_caster, m_spellInfo->Id, i, itemTarget);
}
@@ -2190,7 +2190,7 @@ void Spell::EffectTriggerSpellWithValue(uint32 i)
// normal case
SpellEntry const *spellInfo = sSpellStore.LookupEntry( triggered_spell_id );
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outError("EffectTriggerSpellWithValue of spell %u: triggering unknown spell id %i", m_spellInfo->Id,triggered_spell_id);
return;
@@ -2207,7 +2207,7 @@ void Spell::EffectTriggerRitualOfSummoning(uint32 i)
uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[i];
SpellEntry const *spellInfo = sSpellStore.LookupEntry( triggered_spell_id );
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outError("EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id,triggered_spell_id);
return;
@@ -2220,7 +2220,7 @@ void Spell::EffectTriggerRitualOfSummoning(uint32 i)
void Spell::EffectForceCast(uint32 i)
{
- if( !unitTarget )
+ if ( !unitTarget )
return;
uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[i];
@@ -2228,7 +2228,7 @@ void Spell::EffectForceCast(uint32 i)
// normal case
SpellEntry const *spellInfo = sSpellStore.LookupEntry( triggered_spell_id );
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outError("EffectForceCast of spell %u: triggering unknown spell id %i", m_spellInfo->Id,triggered_spell_id);
return;
@@ -2260,7 +2260,7 @@ void Spell::EffectTriggerSpell(uint32 effIndex)
// only unit case known
if (!unitTarget)
{
- if(gameObjTarget || itemTarget)
+ if (gameObjTarget || itemTarget)
sLog.outError("Spell::EffectTriggerSpell (Spell: %u): Unsupported non-unit case!",m_spellInfo->Id);
return;
}
@@ -2377,7 +2377,7 @@ void Spell::EffectTriggerSpell(uint32 effIndex)
{
// remove all harmful spells on you...
SpellEntry const* spell = iter->second->GetBase()->GetSpellProto();
- if((spell->DmgClass == SPELL_DAMAGE_CLASS_MAGIC // only affect magic spells
+ if ((spell->DmgClass == SPELL_DAMAGE_CLASS_MAGIC // only affect magic spells
|| ((1<<spell->Dispel) & dispelMask))
// ignore positive and passive auras
&& !iter->second->IsPositive() && !iter->second->GetBase()->IsPassive())
@@ -2433,7 +2433,7 @@ void Spell::EffectTriggerMissileSpell(uint32 effect_idx)
// normal case
SpellEntry const *spellInfo = sSpellStore.LookupEntry( triggered_spell_id );
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outError("EffectTriggerMissileSpell of spell %u (eff: %u): triggering unknown spell id %u",
m_spellInfo->Id,effect_idx,triggered_spell_id);
@@ -2456,25 +2456,25 @@ void Spell::EffectTriggerMissileSpell(uint32 effect_idx)
void Spell::EffectJump(uint32 i)
{
- if(m_caster->isInFlight())
+ if (m_caster->isInFlight())
return;
// Init dest coordinates
float x,y,z,o;
- if(m_targets.HasDst())
+ if (m_targets.HasDst())
{
m_targets.m_dstPos.GetPosition(x, y, z);
- if(m_spellInfo->EffectImplicitTargetA[i] == TARGET_DEST_TARGET_BACK)
+ if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_DEST_TARGET_BACK)
{
// explicit cast data from client or server-side cast
// some spell at client send caster
Unit* pTarget = NULL;
- if(m_targets.getUnitTarget() && m_targets.getUnitTarget()!=m_caster)
+ if (m_targets.getUnitTarget() && m_targets.getUnitTarget()!=m_caster)
pTarget = m_targets.getUnitTarget();
- else if(m_caster->getVictim())
+ else if (m_caster->getVictim())
pTarget = m_caster->getVictim();
- else if(m_caster->GetTypeId() == TYPEID_PLAYER)
+ else if (m_caster->GetTypeId() == TYPEID_PLAYER)
pTarget = ObjectAccessor::GetUnit(*m_caster, m_caster->ToPlayer()->GetSelection());
o = pTarget ? pTarget->GetOrientation() : m_caster->GetOrientation();
@@ -2482,12 +2482,12 @@ void Spell::EffectJump(uint32 i)
else
o = m_caster->GetOrientation();
}
- else if(m_targets.getUnitTarget())
+ else if (m_targets.getUnitTarget())
{
m_targets.getUnitTarget()->GetContactPoint(m_caster,x,y,z,CONTACT_DISTANCE);
o = m_caster->GetOrientation();
}
- else if(m_targets.getGOTarget())
+ else if (m_targets.getGOTarget())
{
m_targets.getGOTarget()->GetContactPoint(m_caster,x,y,z,CONTACT_DISTANCE);
o = m_caster->GetOrientation();
@@ -2500,9 +2500,9 @@ void Spell::EffectJump(uint32 i)
//m_caster->NearTeleportTo(x,y,z,o,true);
float speedZ;
- if(m_spellInfo->EffectMiscValue[i])
+ if (m_spellInfo->EffectMiscValue[i])
speedZ = float(m_spellInfo->EffectMiscValue[i])/10;
- else if(m_spellInfo->EffectMiscValueB[i])
+ else if (m_spellInfo->EffectMiscValueB[i])
speedZ = float(m_spellInfo->EffectMiscValueB[i])/10;
else
speedZ = 10.0f;
@@ -2534,7 +2534,7 @@ void Spell::EffectTeleportUnits(uint32 i)
if (mapid == unitTarget->GetMapId())
unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster);
- else if(unitTarget->GetTypeId() == TYPEID_PLAYER)
+ else if (unitTarget->GetTypeId() == TYPEID_PLAYER)
unitTarget->ToPlayer()->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0);
// post effects for TARGET_DST_DB
@@ -2652,7 +2652,7 @@ void Spell::EffectApplyAreaAura(uint32 i)
void Spell::EffectUnlearnSpecialization( uint32 i )
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player *_player = (Player*)unitTarget;
@@ -2665,18 +2665,18 @@ void Spell::EffectUnlearnSpecialization( uint32 i )
void Spell::EffectPowerDrain(uint32 i)
{
- if(m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS)
+ if (m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS)
return;
Powers drain_power = Powers(m_spellInfo->EffectMiscValue[i]);
- if(!unitTarget)
+ if (!unitTarget)
return;
- if(!unitTarget->isAlive())
+ if (!unitTarget->isAlive())
return;
- if(unitTarget->getPowerType() != drain_power)
+ if (unitTarget->getPowerType() != drain_power)
return;
- if(damage < 0)
+ if (damage < 0)
return;
uint32 curPower = unitTarget->GetPower(drain_power);
@@ -2690,7 +2690,7 @@ void Spell::EffectPowerDrain(uint32 i)
power -= unitTarget->GetSpellCritDamageReduction(power);
int32 new_damage;
- if(curPower < power)
+ if (curPower < power)
new_damage = curPower;
else
new_damage = power;
@@ -2698,13 +2698,13 @@ void Spell::EffectPowerDrain(uint32 i)
unitTarget->ModifyPower(drain_power,-new_damage);
// Don`t restore from self drain
- if(drain_power == POWER_MANA && m_caster != unitTarget)
+ if (drain_power == POWER_MANA && m_caster != unitTarget)
{
float manaMultiplier = m_spellInfo->EffectMultipleValue[i];
- if(manaMultiplier==0)
+ if (manaMultiplier==0)
manaMultiplier = 1;
- if(Player *modOwner = m_caster->GetSpellModOwner())
+ if (Player *modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, manaMultiplier);
int32 gain = int32(new_damage * manaMultiplier);
@@ -2735,28 +2735,28 @@ void Spell::EffectSendEvent(uint32 EffectIndex)
void Spell::EffectPowerBurn(uint32 i)
{
- if(m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS)
+ if (m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS)
return;
Powers powertype = Powers(m_spellInfo->EffectMiscValue[i]);
- if(!unitTarget)
+ if (!unitTarget)
return;
- if(!unitTarget->isAlive())
+ if (!unitTarget->isAlive())
return;
- if(unitTarget->getPowerType()!=powertype)
+ if (unitTarget->getPowerType()!=powertype)
return;
- if(damage < 0)
+ if (damage < 0)
return;
Unit* caster = m_originalCaster ? m_originalCaster : m_caster;
// burn x% of target's mana, up to maximum of 2x% of caster's mana (Mana Burn)
- if(m_spellInfo->ManaCostPercentage)
+ if (m_spellInfo->ManaCostPercentage)
{
uint32 maxdamage = m_caster->GetMaxPower(powertype) * damage * 2 / 100;
damage = unitTarget->GetMaxPower(powertype) * damage / 100;
- if(damage > maxdamage) damage = maxdamage;
+ if (damage > maxdamage) damage = maxdamage;
}
int32 curPower = int32(unitTarget->GetPower(powertype));
@@ -2771,14 +2771,14 @@ void Spell::EffectPowerBurn(uint32 i)
unitTarget->ModifyPower(powertype, -new_damage);
float multiplier = m_spellInfo->EffectMultipleValue[i];
- if(Player *modOwner = m_caster->GetSpellModOwner())
+ if (Player *modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, multiplier);
new_damage = int32(new_damage*multiplier);
//m_damage+=new_damage; should not apply spell bonus
//TODO: no log
//unitTarget->ModifyHealth(-new_damage);
- if(m_originalCaster)
+ if (m_originalCaster)
m_originalCaster->DealDamage(unitTarget, new_damage);
unitTarget->RemoveAurasByType(SPELL_AURA_MOD_FEAR);
@@ -2790,7 +2790,7 @@ void Spell::EffectHeal( uint32 /*i*/ )
void Spell::SpellDamageHeal(uint32 /*i*/)
{
- if( unitTarget && unitTarget->isAlive() && damage >= 0)
+ if ( unitTarget && unitTarget->isAlive() && damage >= 0)
{
// Try to get original caster
Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster;
@@ -2822,22 +2822,22 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
AuraEffect *targetAura = NULL;
for (Unit::AuraEffectList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i)
{
- if((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID
+ if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID
&& (*i)->GetSpellProto()->SpellFamilyFlags[0] & 0x50)
{
- if(!targetAura || (*i)->GetBase()->GetDuration() < targetAura->GetBase()->GetDuration())
+ if (!targetAura || (*i)->GetBase()->GetDuration() < targetAura->GetBase()->GetDuration())
targetAura = *i;
}
}
- if(!targetAura)
+ if (!targetAura)
{
sLog.outError("Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID());
return;
}
int32 tickheal = targetAura->GetAmount();
- if(Unit* auraCaster = targetAura->GetCaster())
+ if (Unit* auraCaster = targetAura->GetCaster())
tickheal = auraCaster->SpellHealingBonus(unitTarget, targetAura->GetSpellProto(), tickheal, DOT);
//int32 tickheal = targetAura->GetSpellProto()->EffectBasePoints[idx] + 1;
//It is said that talent bonus should not be included
@@ -2853,7 +2853,7 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
addhealth += tickheal * tickcount;
// Glyph of Swiftmend
- if(!caster->HasAura(54824))
+ if (!caster->HasAura(54824))
unitTarget->RemoveAura(targetAura->GetId(), targetAura->GetCasterGUID());
//addhealth += tickheal * tickcount;
@@ -2897,7 +2897,7 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
void Spell::EffectHealPct( uint32 /*i*/ )
{
- if( unitTarget && unitTarget->isAlive() && damage >= 0)
+ if ( unitTarget && unitTarget->isAlive() && damage >= 0)
{
// Try to get original caster
Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster;
@@ -2911,7 +2911,7 @@ void Spell::EffectHealPct( uint32 /*i*/ )
return;
uint32 addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, unitTarget->GetMaxHealth() * damage / 100.0f, HEAL);
- //if(Player *modOwner = m_caster->GetSpellModOwner())
+ //if (Player *modOwner = m_caster->GetSpellModOwner())
// modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this);
int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo);
@@ -2922,7 +2922,7 @@ void Spell::EffectHealPct( uint32 /*i*/ )
void Spell::EffectHealMechanical( uint32 /*i*/ )
{
// Mechanic creature type should be correctly checked by targetCreatureType field
- if( unitTarget && unitTarget->isAlive() && damage >= 0)
+ if ( unitTarget && unitTarget->isAlive() && damage >= 0)
{
// Try to get original caster
Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster;
@@ -2938,19 +2938,19 @@ void Spell::EffectHealMechanical( uint32 /*i*/ )
void Spell::EffectHealthLeech(uint32 i)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
- if(!unitTarget->isAlive())
+ if (!unitTarget->isAlive())
return;
- if(damage < 0)
+ if (damage < 0)
return;
sLog.outDebug("HealthLeech :%i", damage);
float multiplier = m_spellInfo->EffectMultipleValue[i];
- if(Player *modOwner = m_caster->GetSpellModOwner())
+ if (Player *modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, multiplier);
// Do not apply multiplier to damage if it's Death Coil
@@ -2961,10 +2961,10 @@ void Spell::EffectHealthLeech(uint32 i)
new_damage = int32(damage*multiplier);
uint32 curHealth = unitTarget->GetHealth();
new_damage = m_caster->SpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, new_damage );
- if(curHealth < new_damage)
+ if (curHealth < new_damage)
new_damage = curHealth;
- if(m_caster->isAlive())
+ if (m_caster->isAlive())
{
// Insead add it just to healing if it's Death Coil
if (m_spellInfo->SpellFamilyFlags[0] & 0x80000)
@@ -2985,7 +2985,7 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype)
uint32 newitemid = itemtype;
ItemPrototype const *pProto = objmgr.GetItemPrototype( newitemid );
- if(!pProto)
+ if (!pProto)
{
player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
@@ -3014,7 +3014,7 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype)
uint32 num_to_add;
// TODO: maybe all this can be replaced by using correct calculated `damage` value
- if(pProto->Class != ITEM_CLASS_CONSUMABLE || m_spellInfo->SpellFamilyName != SPELLFAMILY_MAGE)
+ if (pProto->Class != ITEM_CLASS_CONSUMABLE || m_spellInfo->SpellFamilyName != SPELLFAMILY_MAGE)
{
num_to_add = damage;
/*int32 basePoints = m_currentBasePoints[i];
@@ -3026,7 +3026,7 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype)
}
else if (pProto->MaxCount == 1)
num_to_add = 1;
- else if(player->getLevel() >= m_spellInfo->spellLevel)
+ else if (player->getLevel() >= m_spellInfo->spellLevel)
{
num_to_add = damage;
/*int32 basePoints = m_currentBasePoints[i];
@@ -3062,10 +3062,10 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype)
ItemPosCountVec dest;
uint32 no_space = 0;
uint8 msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, newitemid, num_to_add, &no_space );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
// convert to possible store amount
- if( msg == EQUIP_ERR_INVENTORY_FULL || msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS )
+ if ( msg == EQUIP_ERR_INVENTORY_FULL || msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS )
num_to_add -= no_space;
else
{
@@ -3075,13 +3075,13 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype)
}
}
- if(num_to_add)
+ if (num_to_add)
{
// create the new item and store it
Item* pItem = player->StoreNewItem( dest, newitemid, true, Item::GenerateItemRandomPropertyId(newitemid));
// was it successful? return error if not
- if(!pItem)
+ if (!pItem)
{
player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
@@ -3092,19 +3092,19 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype)
pItem->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow());
// send info to the client
- if(pItem)
+ if (pItem)
player->SendNewItem(pItem, num_to_add, true, bgType == 0);
// we succeeded in creating at least one item, so a levelup is possible
- if(bgType == 0)
+ if (bgType == 0)
player->UpdateCraftSkill(m_spellInfo->Id);
}
/*
// for battleground marks send by mail if not add all expected
- if(no_space > 0 && bgType)
+ if (no_space > 0 && bgType)
{
- if(BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(BattleGroundTypeId(bgType)))
+ if (BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(BattleGroundTypeId(bgType)))
bg->SendRewardMarkByMail(player, newitemid, no_space);
}
*/
@@ -3117,7 +3117,7 @@ void Spell::EffectCreateItem(uint32 i)
void Spell::EffectCreateItem2(uint32 i)
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)m_caster;
@@ -3126,9 +3126,9 @@ void Spell::EffectCreateItem2(uint32 i)
DoCreateItem(i, item_id);
// special case: fake item replaced by generate using spell_loot_template
- if(IsLootCraftingSpell(m_spellInfo))
+ if (IsLootCraftingSpell(m_spellInfo))
{
- if(!player->HasItemCount(item_id, 1))
+ if (!player->HasItemCount(item_id, 1))
return;
// remove reagent
@@ -3142,7 +3142,7 @@ void Spell::EffectCreateItem2(uint32 i)
void Spell::EffectCreateRandomItem(uint32 i)
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)m_caster;
@@ -3155,7 +3155,7 @@ void Spell::EffectPersistentAA(uint32 i)
if (!m_spellAura)
{
float radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
- if(Player* modOwner = m_originalCaster->GetSpellModOwner())
+ if (Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius);
Unit *caster = m_caster->GetEntry() == WORLD_TRIGGER ? m_originalCaster : m_caster;
@@ -3163,7 +3163,7 @@ void Spell::EffectPersistentAA(uint32 i)
if (!caster->IsInWorld())
return;
DynamicObject* dynObj = new DynamicObject;
- if(!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo->Id, m_targets.m_dstPos, radius, false))
+ if (!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo->Id, m_targets.m_dstPos, radius, false))
{
delete dynObj;
return;
@@ -3186,12 +3186,12 @@ void Spell::EffectPersistentAA(uint32 i)
void Spell::EffectEnergize(uint32 i)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
- if(!unitTarget->isAlive())
+ if (!unitTarget->isAlive())
return;
- if(m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS)
+ if (m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS)
return;
Powers power = Powers(m_spellInfo->EffectMiscValue[i]);
@@ -3228,10 +3228,10 @@ void Spell::EffectEnergize(uint32 i)
if (level_diff > 0)
damage -= level_multiplier * level_diff;
- if(damage < 0)
+ if (damage < 0)
return;
- if(unitTarget->GetMaxPower(power) == 0)
+ if (unitTarget->GetMaxPower(power) == 0)
return;
m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, damage, power);
@@ -3247,10 +3247,10 @@ void Spell::EffectEnergize(uint32 i)
{
uint32 spell_id = itr->second->GetBase()->GetId();
if (!guardianFound)
- if(spellmgr.IsSpellMemberOfSpellGroup(spell_id, SPELL_GROUP_ELIXIR_GUARDIAN))
+ if (spellmgr.IsSpellMemberOfSpellGroup(spell_id, SPELL_GROUP_ELIXIR_GUARDIAN))
guardianFound = true;
if (!battleFound)
- if(spellmgr.IsSpellMemberOfSpellGroup(spell_id, SPELL_GROUP_ELIXIR_BATTLE))
+ if (spellmgr.IsSpellMemberOfSpellGroup(spell_id, SPELL_GROUP_ELIXIR_BATTLE))
battleFound = true;
if (battleFound && guardianFound)
break;
@@ -3267,9 +3267,9 @@ void Spell::EffectEnergize(uint32 i)
SpellEntry const *spellInfo = sSpellStore.LookupEntry(*itr);
if (spellInfo->spellLevel < m_spellInfo->spellLevel || spellInfo->spellLevel > unitTarget->getLevel())
avalibleElixirs.erase(itr++);
- else if(spellmgr.IsSpellMemberOfSpellGroup(*itr, SPELL_GROUP_ELIXIR_SHATTRATH))
+ else if (spellmgr.IsSpellMemberOfSpellGroup(*itr, SPELL_GROUP_ELIXIR_SHATTRATH))
avalibleElixirs.erase(itr++);
- else if(spellmgr.IsSpellMemberOfSpellGroup(*itr, SPELL_GROUP_ELIXIR_UNSTABLE))
+ else if (spellmgr.IsSpellMemberOfSpellGroup(*itr, SPELL_GROUP_ELIXIR_UNSTABLE))
avalibleElixirs.erase(itr++);
else
++itr;
@@ -3288,18 +3288,18 @@ void Spell::EffectEnergize(uint32 i)
void Spell::EffectEnergizePct(uint32 i)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
- if(!unitTarget->isAlive())
+ if (!unitTarget->isAlive())
return;
- if(m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS)
+ if (m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS)
return;
Powers power = Powers(m_spellInfo->EffectMiscValue[i]);
uint32 maxPower = unitTarget->GetMaxPower(power);
- if(maxPower == 0)
+ if (maxPower == 0)
return;
uint32 gain = damage * maxPower / 100;
@@ -3333,7 +3333,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype)
case GAMEOBJECT_TYPE_SPELL_FOCUS:
// triggering linked GO
- if(uint32 trapEntry = gameObjTarget->GetGOInfo()->spellFocus.linkedTrapId)
+ if (uint32 trapEntry = gameObjTarget->GetGOInfo()->spellFocus.linkedTrapId)
gameObjTarget->TriggeringLinkedGameObject(trapEntry,m_caster);
return;
@@ -3357,7 +3357,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype)
}
// triggering linked GO
- if(uint32 trapEntry = gameObjTarget->GetGOInfo()->chest.linkedTrapId)
+ if (uint32 trapEntry = gameObjTarget->GetGOInfo()->chest.linkedTrapId)
gameObjTarget->TriggeringLinkedGameObject(trapEntry,m_caster);
// Don't return, let loots been taken
@@ -3372,7 +3372,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype)
void Spell::EffectOpenLock(uint32 effIndex)
{
- if(!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER)
{
sLog.outDebug( "WORLD: Open Lock - No Player Caster!");
return;
@@ -3384,16 +3384,16 @@ void Spell::EffectOpenLock(uint32 effIndex)
uint64 guid = 0;
// Get lockId
- if(gameObjTarget)
+ if (gameObjTarget)
{
GameObjectInfo const* goInfo = gameObjTarget->GetGOInfo();
// Arathi Basin banner opening !
- if( goInfo->type == GAMEOBJECT_TYPE_BUTTON && goInfo->button.noDamageImmune ||
+ 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())
+ if (BattleGround *bg = player->GetBattleGround())
{
bg->EventPlayerClickedOnFlag(player, gameObjTarget);
return;
@@ -3403,9 +3403,9 @@ void Spell::EffectOpenLock(uint32 effIndex)
{
//CanUseBattleGroundObject() already called in CheckCast()
// in battleground check
- if(BattleGround *bg = player->GetBattleGround())
+ if (BattleGround *bg = player->GetBattleGround())
{
- if(bg->GetTypeID() == BATTLEGROUND_EY)
+ if (bg->GetTypeID() == BATTLEGROUND_EY)
bg->EventPlayerClickedOnFlag(player, gameObjTarget);
return;
}
@@ -3416,12 +3416,12 @@ void Spell::EffectOpenLock(uint32 effIndex)
// TODO: Add script for spell 41920 - Filling, becouse server it freze when use this spell
// handle outdoor pvp object opening, return true if go was registered for handling
// these objects must have been spawned by outdoorpvp!
- else if(gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_GOOBER && sOutdoorPvPMgr.HandleOpenGo(player, gameObjTarget->GetGUID()))
+ else if (gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_GOOBER && sOutdoorPvPMgr.HandleOpenGo(player, gameObjTarget->GetGUID()))
return;
lockId = goInfo->GetLockId();
guid = gameObjTarget->GetGUID();
}
- else if(itemTarget)
+ else if (itemTarget)
{
lockId = itemTarget->GetProto()->LockID;
guid = itemTarget->GetGUID();
@@ -3437,7 +3437,7 @@ void Spell::EffectOpenLock(uint32 effIndex)
int32 skillValue;
SpellCastResult res = CanOpenLock(effIndex, lockId, skillId, reqSkillValue, skillValue);
- if(res != SPELL_CAST_OK)
+ if (res != SPELL_CAST_OK)
{
SendCastResult(res);
return;
@@ -3446,19 +3446,19 @@ void Spell::EffectOpenLock(uint32 effIndex)
SendLoot(guid, LOOT_SKINNING);
// not allow use skill grow at item base open
- if(!m_CastItem && skillId != SKILL_NONE)
+ if (!m_CastItem && skillId != SKILL_NONE)
{
// update skill if really known
- if(uint32 pureSkillValue = player->GetPureSkillValue(skillId))
+ if (uint32 pureSkillValue = player->GetPureSkillValue(skillId))
{
- if(gameObjTarget)
+ if (gameObjTarget)
{
// Allow one skill-up until respawned
if ( !gameObjTarget->IsInSkillupList( player->GetGUIDLow() ) &&
player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue) )
gameObjTarget->AddToSkillupList( player->GetGUIDLow() );
}
- else if(itemTarget)
+ else if (itemTarget)
{
// Do one skill-up
player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue);
@@ -3573,12 +3573,12 @@ void Spell::EffectProficiency(uint32 /*i*/)
Player *p_target = (Player*)unitTarget;
uint32 subClassMask = m_spellInfo->EquippedItemSubClassMask;
- if(m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && !(p_target->GetWeaponProficiency() & subClassMask))
+ if (m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && !(p_target->GetWeaponProficiency() & subClassMask))
{
p_target->AddWeaponProficiency(subClassMask);
p_target->SendProficiency(ITEM_CLASS_WEAPON, p_target->GetWeaponProficiency());
}
- if(m_spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR && !(p_target->GetArmorProficiency() & subClassMask))
+ if (m_spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR && !(p_target->GetArmorProficiency() & subClassMask))
{
p_target->AddArmorProficiency(subClassMask);
p_target->SendProficiency(ITEM_CLASS_ARMOR, p_target->GetArmorProficiency());
@@ -3646,7 +3646,7 @@ void Spell::EffectSummonType(uint32 i)
break;
case SUMMON_TYPE_VEHICLE:
case SUMMON_TYPE_VEHICLE2:
- if(m_originalCaster)
+ if (m_originalCaster)
summon = m_caster->GetMap()->SummonCreature(entry, pos, properties, duration, m_originalCaster);
break;
case SUMMON_TYPE_TOTEM:
@@ -3773,7 +3773,7 @@ void Spell::EffectLearnSpell(uint32 i)
typedef std::list< std::pair<uint32, uint64> > DispelList;
void Spell::EffectDispel(uint32 i)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
Unit::AuraList dispel_list;
@@ -3791,13 +3791,13 @@ void Spell::EffectDispel(uint32 i)
if ((1<<aura->GetSpellProto()->Dispel) & dispelMask)
{
- if(aura->GetSpellProto()->Dispel == DISPEL_MAGIC)
+ if (aura->GetSpellProto()->Dispel == DISPEL_MAGIC)
{
bool positive = aurApp->IsPositive() ? (!(aura->GetSpellProto()->AttributesEx & SPELL_ATTR_EX_NEGATIVE)) : false;
// do not remove positive auras if friendly target
// negative auras if non-friendly target
- if(positive == unitTarget->IsFriendlyTo(m_caster))
+ if (positive == unitTarget->IsFriendlyTo(m_caster))
continue;
}
@@ -3937,7 +3937,7 @@ void Spell::EffectAddFarsight(uint32 i)
if (!m_caster->IsInWorld())
return;
DynamicObject* dynObj = new DynamicObject;
- if(!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, m_targets.m_dstPos, radius, true))
+ if (!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, m_targets.m_dstPos, radius, true))
{
delete dynObj;
return;
@@ -4052,7 +4052,7 @@ void Spell::EffectEnchantItemPerm(uint32 effect_idx)
return;
SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
- if(!pEnchant)
+ if (!pEnchant)
return;
// item can be in trade slot and have owner diff. from caster
@@ -4060,7 +4060,7 @@ void Spell::EffectEnchantItemPerm(uint32 effect_idx)
if (!item_owner)
return;
- if(item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
+ if (item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(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(),
@@ -4092,7 +4092,7 @@ void Spell::EffectEnchantItemPrismatic(uint32 effect_idx)
return;
SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
- if(!pEnchant)
+ if (!pEnchant)
return;
// support only enchantings with add socket in this slot
@@ -4100,13 +4100,13 @@ void Spell::EffectEnchantItemPrismatic(uint32 effect_idx)
bool add_socket = false;
for (uint8 i = 0; i < 3; ++i)
{
- if(pEnchant->type[i]==ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET)
+ if (pEnchant->type[i]==ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET)
{
add_socket = true;
break;
}
}
- if(!add_socket)
+ if (!add_socket)
{
sLog.outError("Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.",
m_spellInfo->Id,SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC,ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET);
@@ -4322,9 +4322,9 @@ void Spell::EffectSummonPet(uint32 i)
Player *owner = NULL;
if (m_originalCaster)
{
- if(m_originalCaster->GetTypeId() == TYPEID_PLAYER)
+ if (m_originalCaster->GetTypeId() == TYPEID_PLAYER)
owner = (Player*)m_originalCaster;
- else if(m_originalCaster->ToCreature()->isTotem())
+ else if (m_originalCaster->ToCreature()->isTotem())
owner = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself();
}
@@ -4333,7 +4333,7 @@ void Spell::EffectSummonPet(uint32 i)
if (!owner)
{
SummonPropertiesEntry const *properties = sSummonPropertiesStore.LookupEntry(67);
- if(properties)
+ if (properties)
SummonGuardian(i, petentry, properties);
return;
}
@@ -4425,7 +4425,7 @@ void Spell::EffectTaunt(uint32 /*i*/)
// this effect use before aura Taunt apply for prevent taunt already attacking target
// for spell as marked "non effective at already attacking target"
- if(!unitTarget || !unitTarget->CanHaveThreatList()
+ if (!unitTarget || !unitTarget->CanHaveThreatList()
|| unitTarget->getVictim() == m_caster)
{
SendCastResult(SPELL_FAILED_DONT_REPORT);
@@ -4549,7 +4549,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
}
}
- if(found)
+ if (found)
totalDamagePercentMod *= 1.2f; // 120% if poisoned
}
break;
@@ -4581,9 +4581,9 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
case SPELLFAMILY_DRUID:
{
// Mangle (Cat): CP
- if(m_spellInfo->SpellFamilyFlags[1] & 0x400)
+ if (m_spellInfo->SpellFamilyFlags[1] & 0x400)
{
- if(m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->AddComboPoints(unitTarget,1, this);
}
// Shred, Maul - Rend and Tear
@@ -4599,7 +4599,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
case SPELLFAMILY_HUNTER:
{
// Kill Shot - bonus damage from Ranged Attack Power
- if(m_spellInfo->SpellFamilyFlags[1] & 0x800000)
+ if (m_spellInfo->SpellFamilyFlags[1] & 0x800000)
spell_bonus += int32(0.4f*m_caster->GetTotalAttackPowerValue(RANGED_ATTACK));
break;
}
@@ -4620,7 +4620,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
// Glyph of Blood Strike
if (AuraEffect * aurEff = m_caster->GetAuraEffect(59332,0))
{
- if(unitTarget->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED))
+ if (unitTarget->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED))
totalDamagePercentMod *= float((20 + 100.0f) / 100.0f);
}
}
@@ -4630,7 +4630,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
// Glyph of Death Strike
if (AuraEffect * aurEff = m_caster->GetAuraEffect(59336,0))
{
- if(uint32 runic = m_caster->GetPower(POWER_RUNIC_POWER))
+ if (uint32 runic = m_caster->GetPower(POWER_RUNIC_POWER))
{
if (runic > 25)
runic = 25;
@@ -4682,7 +4682,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
}
// apply to non-weapon bonus weapon total pct effect, weapon total flat effect included in weapon damage
- if(fixed_bonus || spell_bonus)
+ if (fixed_bonus || spell_bonus)
{
UnitMods unitMod;
switch(m_attackType)
@@ -4697,9 +4697,9 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
if ( m_spellInfo->SchoolMask & SPELL_SCHOOL_MASK_NORMAL )
weapon_total_pct = m_caster->GetModifierValue(unitMod, TOTAL_PCT);
- if(fixed_bonus)
+ if (fixed_bonus)
fixed_bonus = int32(fixed_bonus * weapon_total_pct);
- if(spell_bonus)
+ if (spell_bonus)
spell_bonus = int32(spell_bonus * weapon_total_pct);
}
@@ -4724,10 +4724,10 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
}
}
- if(spell_bonus)
+ if (spell_bonus)
weaponDamage += spell_bonus;
- if(totalDamagePercentMod != 1.0f)
+ if (totalDamagePercentMod != 1.0f)
weaponDamage = int32(weaponDamage * totalDamagePercentMod);
// prevent negative damage
@@ -4740,10 +4740,10 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
void Spell::EffectThreat(uint32 /*i*/)
{
- if(!unitTarget || !unitTarget->isAlive() || !m_caster->isAlive())
+ if (!unitTarget || !unitTarget->isAlive() || !m_caster->isAlive())
return;
- if(!unitTarget->CanHaveThreatList())
+ if (!unitTarget->CanHaveThreatList())
return;
unitTarget->AddThreat(m_caster, float(damage));
@@ -4751,13 +4751,13 @@ void Spell::EffectThreat(uint32 /*i*/)
void Spell::EffectHealMaxHealth(uint32 /*i*/)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
- if(!unitTarget->isAlive())
+ if (!unitTarget->isAlive())
return;
int32 addhealth;
- if(m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN) // Lay on Hands
+ if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN) // Lay on Hands
{
if (m_caster && m_caster->GetGUID() == unitTarget->GetGUID())
{
@@ -4770,7 +4770,7 @@ void Spell::EffectHealMaxHealth(uint32 /*i*/)
}
else
addhealth = unitTarget->GetMaxHealth() - unitTarget->GetHealth();
- if(m_originalCaster)
+ if (m_originalCaster)
{
addhealth=m_originalCaster->SpellHealingBonus(unitTarget,m_spellInfo, addhealth, HEAL);
m_originalCaster->DealHeal(unitTarget, addhealth, m_spellInfo);
@@ -4779,9 +4779,9 @@ void Spell::EffectHealMaxHealth(uint32 /*i*/)
void Spell::EffectInterruptCast(uint32 i)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
- if(!unitTarget->isAlive())
+ if (!unitTarget->isAlive())
return;
// TODO: not all spells that used this effect apply cooldown at school spells
@@ -4796,7 +4796,7 @@ void Spell::EffectInterruptCast(uint32 i)
|| spell->getState() == SPELL_STATE_PREPARING && spell->GetCastTime() > 0.0f)
&& curSpellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT && curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE )
{
- if(m_originalCaster)
+ if (m_originalCaster)
{
int32 duration = m_originalCaster->ModSpellDuration(m_spellInfo, unitTarget, m_originalCaster->CalcSpellDuration(m_spellInfo), false);
unitTarget->ProhibitSpellScholl(GetSpellSchoolMask(curSpellInfo), duration/*GetSpellDuration(m_spellInfo)*/);
@@ -4814,18 +4814,18 @@ void Spell::EffectSummonObjectWild(uint32 i)
GameObject* pGameObj = new GameObject;
WorldObject* target = focusObject;
- if( !target )
+ if ( !target )
target = m_caster;
float x, y, z;
- if(m_targets.HasDst())
+ if (m_targets.HasDst())
m_targets.m_dstPos.GetPosition(x, y, z);
else
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
Map *map = target->GetMap();
- if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map,
+ if (!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map,
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
delete pGameObj;
@@ -4840,7 +4840,7 @@ void Spell::EffectSummonObjectWild(uint32 i)
// Wild object not have owner and check clickable by players
map->Add(pGameObj);
- if(pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER)
{
Player *pl = m_caster->ToPlayer();
BattleGround* bg = pl->GetBattleGround();
@@ -4849,11 +4849,11 @@ void Spell::EffectSummonObjectWild(uint32 i)
{
case 489: //WS
{
- if(bg && bg->GetTypeID()==BATTLEGROUND_WS && bg->GetStatus() == STATUS_IN_PROGRESS)
+ if (bg && bg->GetTypeID()==BATTLEGROUND_WS && bg->GetStatus() == STATUS_IN_PROGRESS)
{
uint32 team = ALLIANCE;
- if(pl->GetTeam() == team)
+ if (pl->GetTeam() == team)
team = HORDE;
((BattleGroundWS*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID(),team);
@@ -4862,7 +4862,7 @@ void Spell::EffectSummonObjectWild(uint32 i)
}
case 566: //EY
{
- if(bg && bg->GetTypeID()==BATTLEGROUND_EY && bg->GetStatus() == STATUS_IN_PROGRESS)
+ if (bg && bg->GetTypeID()==BATTLEGROUND_EY && bg->GetStatus() == STATUS_IN_PROGRESS)
{
((BattleGroundEY*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID());
}
@@ -4871,10 +4871,10 @@ void Spell::EffectSummonObjectWild(uint32 i)
}
}
- if(uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
+ if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
{
GameObject* linkedGO = new GameObject;
- if(linkedGO->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, map,
+ if (linkedGO->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, map,
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0);
@@ -4904,16 +4904,16 @@ void Spell::EffectScriptEffect(uint32 effIndex)
{
case 6962:
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* plr = m_caster->ToPlayer();
- if(plr && plr->GetLastPetNumber())
+ if (plr && plr->GetLastPetNumber())
{
PetType NewPetType = (plr->getClass()==CLASS_HUNTER) ? HUNTER_PET : SUMMON_PET;
if (Pet* NewPet = new Pet(plr,NewPetType))
{
- if(NewPet->LoadPetFromDB(plr, 0, plr->GetLastPetNumber(), true))
+ if (NewPet->LoadPetFromDB(plr, 0, plr->GetLastPetNumber(), true))
{
NewPet->SetHealth(NewPet->GetMaxHealth());
NewPet->SetPower(NewPet->getPowerType(),NewPet->GetMaxPower(NewPet->getPowerType()));
@@ -5007,13 +5007,13 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Despawn Horse
case 52267:
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
return;
unitTarget->ToCreature()->ForcedDespawn();
return;
}
case 55693: // Remove Collapsing Cave Aura
- if(!unitTarget)
+ if (!unitTarget)
return;
unitTarget->RemoveAurasDueToSpell(m_spellInfo->CalculateSimpleValue(effIndex));
break;
@@ -5024,7 +5024,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// check presence
for (uint8 j = 0; j < 4; ++j)
- if(unitTarget->HasAuraEffect(spells[j],0))
+ if (unitTarget->HasAuraEffect(spells[j],0))
return;
// select spell
@@ -5037,7 +5037,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Bending Shinbone
case 8856:
{
- if(!itemTarget && m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (!itemTarget && m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = 0;
@@ -5068,7 +5068,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
case 35376:
case 35727:
{
- if(!unitTarget)
+ if (!unitTarget)
return;
uint32 spellid;
@@ -5104,11 +5104,11 @@ void Spell::EffectScriptEffect(uint32 effIndex)
case 22984:
case 22985:
{
- if(!unitTarget || !unitTarget->isAlive())
+ if (!unitTarget || !unitTarget->isAlive())
return;
// Onyxia Scale Cloak
- if(unitTarget->HasAura(22683))
+ if (unitTarget->HasAura(22683))
return;
// Shadow Flame
@@ -5118,7 +5118,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Piccolo of the Flaming Fire
case 17512:
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
unitTarget->HandleEmoteCommand(EMOTE_STATE_DANCE);
return;
@@ -5126,7 +5126,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Escape artist
case 20589:
{
- if(!unitTarget)
+ if (!unitTarget)
return;
unitTarget->RemoveMovementImpairingAuras();
return;
@@ -5134,10 +5134,10 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Decimate
case 28374:
case 54426:
- if(unitTarget)
+ if (unitTarget)
{
int32 damage = (int32)unitTarget->GetHealth() - (int32)unitTarget->GetMaxHealth() * 0.05f;
- if(damage > 0)
+ if (damage > 0)
m_caster->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, damage, unitTarget);
}
return;
@@ -5191,13 +5191,13 @@ void Spell::EffectScriptEffect(uint32 effIndex)
}
// Tidal Surge
case 38358:
- if(unitTarget)
+ if (unitTarget)
m_caster->CastSpell(unitTarget, 38353, true);
return;
/*// Flame Crash
case 41126:
{
- if(!unitTarget)
+ if (!unitTarget)
return;
unitTarget->CastSpell(unitTarget, 41131, true);
@@ -5206,7 +5206,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Draw Soul
case 40904:
{
- if(!unitTarget)
+ if (!unitTarget)
return;
unitTarget->CastSpell(m_caster, 40903, true);
@@ -5214,7 +5214,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
}
case 48025: // Headless Horseman's Mount
{
- if(!unitTarget)
+ if (!unitTarget)
return;
switch(unitTarget->ToPlayer()->GetBaseSkillValue(762))
@@ -5222,11 +5222,11 @@ void Spell::EffectScriptEffect(uint32 effIndex)
case 75: unitTarget->CastSpell(unitTarget, 51621, true); break;;
case 150: unitTarget->CastSpell(unitTarget, 48024, true); break;
case 225:
- if(unitTarget->ToPlayer()->GetMapId()==571 || unitTarget->ToPlayer()->GetMapId()==530)
+ if (unitTarget->ToPlayer()->GetMapId()==571 || unitTarget->ToPlayer()->GetMapId()==530)
unitTarget->CastSpell(unitTarget, 51617, true);
break;
case 300:
- if(unitTarget->ToPlayer()->GetMapId()==571 || unitTarget->ToPlayer()->GetMapId()==530)
+ if (unitTarget->ToPlayer()->GetMapId()==571 || unitTarget->ToPlayer()->GetMapId()==530)
unitTarget->CastSpell(unitTarget, 48023, true);
break;
default: break;
@@ -5235,10 +5235,10 @@ void Spell::EffectScriptEffect(uint32 effIndex)
}
case 47977: // Magic Broom
{
- if(!unitTarget)
+ if (!unitTarget)
return;
- if(unitTarget)
+ if (unitTarget)
{
switch(unitTarget->ToPlayer()->GetBaseSkillValue(762))
{
@@ -5252,7 +5252,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Mug Transformation
case 41931:
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint8 bag = 19;
@@ -5303,7 +5303,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// spell of Brutallus - Stomp
case 45185:
{
- if(!unitTarget)
+ if (!unitTarget)
return;
unitTarget->RemoveAurasDueToSpell(46394);
@@ -5313,7 +5313,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Negative Energy
case 46289:
{
- if(!unitTarget)
+ if (!unitTarget)
return;
m_caster->CastSpell(unitTarget, 46285, true);
@@ -5322,7 +5322,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Goblin Weather Machine
case 46203:
{
- if(!unitTarget)
+ if (!unitTarget)
return;
uint32 spellId = 0;
@@ -5339,7 +5339,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// 5,000 Gold
case 46642:
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
unitTarget->ToPlayer()->ModifyMoney(5000 * GOLD);
@@ -5351,7 +5351,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
{
char buf[128];
char *gender = "his";
- if(m_caster->getGender() > 0)
+ if (m_caster->getGender() > 0)
gender = "her";
sprintf(buf, "%s rubs %s [Decahedral Dwarven Dice] between %s hands and rolls. One %u and one %u.", m_caster->GetName(), gender, gender, urand(1,10), urand(1,10));
m_caster->MonsterTextEmote(buf, 0);
@@ -5362,7 +5362,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
{
char buf[128];
char *gender = "his";
- if(m_caster->getGender() > 0)
+ if (m_caster->getGender() > 0)
gender = "her";
sprintf(buf, "%s causually tosses %s [Worn Troll Dice]. One %u and one %u.", m_caster->GetName(), gender, urand(1,6), urand(1,6));
m_caster->MonsterTextEmote(buf, 0);
@@ -5371,7 +5371,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Vigilance
case 50725:
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Remove Taunt cooldown
@@ -5382,7 +5382,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Death Knight Initiate Visual
case 51519:
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
return;
uint32 iTmpSpellId = 0;
@@ -5419,7 +5419,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Emblazon Runeblade
case 51770:
{
- if(!m_originalCaster)
+ if (!m_originalCaster)
return;
m_originalCaster->CastSpell(m_originalCaster, damage, false);
@@ -5441,7 +5441,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Summon Ghouls On Scarlet Crusade
case 51904:
{
- if(!m_targets.HasDst())
+ if (!m_targets.HasDst())
return;
float x, y, z;
@@ -5460,37 +5460,37 @@ void Spell::EffectScriptEffect(uint32 effIndex)
return;
// Sky Darkener Assault
case 52124:
- if(unitTarget)
+ if (unitTarget)
m_caster->CastSpell(unitTarget, 52125, false);
return;
case 52479: // Gift of the Harvester
- if(unitTarget && m_originalCaster)
+ if (unitTarget && m_originalCaster)
m_originalCaster->CastSpell(unitTarget, urand(0, 1) ? damage : 52505, true);
return;
// Death Gate
case 52751:
{
- if(!unitTarget || unitTarget->getClass() != CLASS_DEATH_KNIGHT)
+ if (!unitTarget || unitTarget->getClass() != CLASS_DEATH_KNIGHT)
return;
// triggered spell is stored in m_spellInfo->EffectBasePoints[0]
unitTarget->CastSpell(unitTarget, damage, false);
break;
}
case 53110: // Devour Humanoid
- if(unitTarget)
+ if (unitTarget)
unitTarget->CastSpell(m_caster, damage, true);
return;
// Winged Steed of the Ebon Blade
case 54729:
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent of riding skill
- if(uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
+ if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
{
if (skillval >= 300)
unitTarget->CastSpell(unitTarget, 54727, true);
@@ -5502,7 +5502,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
case 58418: // Portal to Orgrimmar
case 58420: // Portal to Stormwind
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER || effIndex!=0)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER || effIndex!=0)
return;
uint32 spellID = m_spellInfo->CalculateSimpleValue(0);
@@ -5553,14 +5553,14 @@ void Spell::EffectScriptEffect(uint32 effIndex)
break;
}
case 58941: // Rock Shards
- if(unitTarget && m_originalCaster)
+ if (unitTarget && m_originalCaster)
{
for (uint32 i = 0; i < 3; ++i)
{
m_originalCaster->CastSpell(unitTarget, 58689, true);
m_originalCaster->CastSpell(unitTarget, 58692, true);
}
- if(((InstanceMap*)m_originalCaster->GetMap())->GetDifficulty() == REGULAR_DIFFICULTY)
+ if (((InstanceMap*)m_originalCaster->GetMap())->GetDifficulty() == REGULAR_DIFFICULTY)
{
m_originalCaster->CastSpell(unitTarget, 58695, true);
m_originalCaster->CastSpell(unitTarget, 58696, true);
@@ -5574,14 +5574,14 @@ void Spell::EffectScriptEffect(uint32 effIndex)
return;
case 58983: // Big Blizzard Bear
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent of riding skill
- if(uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
+ if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
{
if (skillval >= 150)
unitTarget->CastSpell(unitTarget, 58999, true);
@@ -5609,29 +5609,29 @@ void Spell::EffectScriptEffect(uint32 effIndex)
case 61756: // Northrend Inscription Research (FAST QA VERSION)
case 64323: // Book of Glyph Mastery
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// learn random explicit discovery recipe (if any)
- if(uint32 discoveredSpell = GetExplicitDiscoverySpell(m_spellInfo->Id, (Player*)m_caster))
+ if (uint32 discoveredSpell = GetExplicitDiscoverySpell(m_spellInfo->Id, (Player*)m_caster))
m_caster->ToPlayer()->learnSpell(discoveredSpell, false);
return;
}
case 62428: // Load into Catapult
{
- if(Vehicle *seat = m_caster->GetVehicleKit())
- if(Unit *passenger = seat->GetPassenger(0))
- if(Unit *demolisher = m_caster->GetVehicleBase())
+ if (Vehicle *seat = m_caster->GetVehicleKit())
+ if (Unit *passenger = seat->GetPassenger(0))
+ if (Unit *demolisher = m_caster->GetVehicleBase())
passenger->CastSpell(demolisher, damage, true);
return;
}
case 62482: // Grab Crate
{
- if(unitTarget)
+ if (unitTarget)
{
- if(Vehicle *seat = m_caster->GetVehicleKit())
+ if (Vehicle *seat = m_caster->GetVehicleKit())
{
- if(Creature *oldContainer = dynamic_cast<Creature*>(seat->GetPassenger(1)))
+ if (Creature *oldContainer = dynamic_cast<Creature*>(seat->GetPassenger(1)))
oldContainer->DisappearAndDie();
// TODO: a hack, range = 11, should after some time cast, otherwise too far
unitTarget->CastSpell(seat->GetBase(), 62496, true);
@@ -5661,7 +5661,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
}
Aura * chargesaura = m_caster->GetAura(59907);
- if(chargesaura && chargesaura->GetCharges() > 1)
+ if (chargesaura && chargesaura->GetCharges() > 1)
{
chargesaura->SetCharges(chargesaura->GetCharges() - 1);
m_caster->CastSpell(unitTarget, spell_heal, true, NULL, NULL, m_caster->ToTempSummon()->GetSummonerGUID());
@@ -5686,11 +5686,11 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Cast Absorb on totems
for (uint8 slot = SUMMON_SLOT_TOTEM; slot < MAX_TOTEM_SLOT; ++slot)
{
- if(!unitTarget->m_SummonSlot[slot])
+ if (!unitTarget->m_SummonSlot[slot])
continue;
Creature* totem = unitTarget->GetMap()->GetCreature(unitTarget->m_SummonSlot[slot]);
- if(totem && totem->isTotem())
+ if (totem && totem->isTotem())
{
m_caster->CastCustomSpell(totem, 55277, &basepoints0, NULL, NULL, true);
}
@@ -5768,9 +5768,9 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Improved Healthstone
if (AuraEffect const * aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 284, 0))
{
- if(aurEff->GetId() == 18692)
+ if (aurEff->GetId() == 18692)
rank = 1;
- else if(aurEff->GetId() == 18693)
+ else if (aurEff->GetId() == 18693)
rank = 2;
else
sLog.outError("Unknown rank of Improved Healthstone id: %d", aurEff->GetId());
@@ -5820,7 +5820,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Demonic Empowerment
case 47193:
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || !unitTarget->ToCreature()->isPet())
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || !unitTarget->ToCreature()->isPet())
return;
CreatureInfo const * ci = objmgr.GetCreatureTemplate(unitTarget->GetEntry());
switch (ci->family)
@@ -5852,7 +5852,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
case 63521:
{
// Divine Plea
- if(Aura * aura = m_caster->GetAura(54428))
+ if (Aura * aura = m_caster->GetAura(54428))
aura->RefreshDuration();
return;
}
@@ -5977,7 +5977,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Judgement (seal trigger)
if (m_spellInfo->Category == SPELLCATEGORY_JUDGEMENT)
{
- if(!unitTarget || !unitTarget->isAlive())
+ if (!unitTarget || !unitTarget->isAlive())
return;
uint32 spellId1 = 0;
uint32 spellId2 = 0;
@@ -6053,7 +6053,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Dreaming Glory
case 28698:
{
- if(!unitTarget)
+ if (!unitTarget)
return;
unitTarget->CastSpell(unitTarget, 28694, true);
break;
@@ -6061,10 +6061,10 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Netherbloom
case 28702:
{
- if(!unitTarget)
+ if (!unitTarget)
return;
// 25% chance of casting a random buff
- if(roll_chance_i(75))
+ if (roll_chance_i(75))
return;
// triggered spells are 28703 to 28707
@@ -6074,7 +6074,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// don't overwrite an existing aura
for (uint8 i = 0; i < 5; ++i)
- if(unitTarget->HasAura(spellid + i))
+ if (unitTarget->HasAura(spellid + i))
return;
unitTarget->CastSpell(unitTarget, spellid+urand(0, 4), true);
break;
@@ -6083,10 +6083,10 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Nightmare Vine
case 28720:
{
- if(!unitTarget)
+ if (!unitTarget)
return;
// 25% chance of casting Nightmare Pollen
- if(roll_chance_i(75))
+ if (roll_chance_i(75))
return;
unitTarget->CastSpell(unitTarget, 28721, true);
break;
@@ -6119,7 +6119,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Shattering Throw
if (m_spellInfo->SpellFamilyFlags[1] & 0x00400000)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
// remove shields, will still display immune to damage part
unitTarget->RemoveAurasWithMechanic(1<<MECHANIC_IMMUNE_SHIELD, AURA_REMOVE_BY_ENEMY_SPELL);
@@ -6136,7 +6136,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
void Spell::EffectSanctuary(uint32 /*i*/)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
std::list<Unit*> targets;
@@ -6145,12 +6145,12 @@ void Spell::EffectSanctuary(uint32 /*i*/)
unitTarget->VisitNearbyObject(m_caster->GetMap()->GetVisibilityDistance(), searcher);
for (std::list<Unit*>::iterator iter = targets.begin(); iter != targets.end(); ++iter)
{
- if(!(*iter)->hasUnitState(UNIT_STAT_CASTING))
+ if (!(*iter)->hasUnitState(UNIT_STAT_CASTING))
continue;
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
{
- if((*iter)->GetCurrentSpell(i)
+ if ((*iter)->GetCurrentSpell(i)
&& (*iter)->GetCurrentSpell(i)->m_targets.getUnitTargetGUID() == unitTarget->GetGUID())
{
(*iter)->InterruptSpell(CurrentSpellTypes(i), false);
@@ -6161,26 +6161,26 @@ void Spell::EffectSanctuary(uint32 /*i*/)
unitTarget->CombatStop();
unitTarget->getHostileRefManager().deleteReferences(); // stop all fighting
// Vanish allows to remove all threat and cast regular stealth so other spells can be used
- if(m_caster->GetTypeId() == TYPEID_PLAYER
+ if (m_caster->GetTypeId() == TYPEID_PLAYER
&& m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE
&& (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VANISH))
{
m_caster->ToPlayer()->RemoveAurasByType(SPELL_AURA_MOD_ROOT);
// Overkill
- if(m_caster->ToPlayer()->HasSpell(58426))
+ if (m_caster->ToPlayer()->HasSpell(58426))
m_caster->CastSpell(m_caster, 58427, true);
}
}
void Spell::EffectAddComboPoints(uint32 /*i*/)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
- if(!m_caster->m_movedPlayer)
+ if (!m_caster->m_movedPlayer)
return;
- if(damage <= 0)
+ if (damage <= 0)
return;
m_caster->m_movedPlayer->AddComboPoints(unitTarget, damage, this);
@@ -6188,34 +6188,34 @@ void Spell::EffectAddComboPoints(uint32 /*i*/)
void Spell::EffectDuel(uint32 i)
{
- if(!m_caster || !unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!m_caster || !unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player *caster = (Player*)m_caster;
Player *target = (Player*)unitTarget;
// caster or target already have requested duel
- if( caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetGUIDLow()) )
+ if ( caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetGUIDLow()) )
return;
// Players can only fight a duel with each other outside (=not inside dungeons and not in capital cities)
// Don't have to check the target's map since you cannot challenge someone across maps
- if(caster->GetMap()->Instanceable())
- //if( mapid != 0 && mapid != 1 && mapid != 530 && mapid != 571 && mapid != 609)
+ if (caster->GetMap()->Instanceable())
+ //if ( mapid != 0 && mapid != 1 && mapid != 530 && mapid != 571 && mapid != 609)
{
SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here
return;
}
AreaTableEntry const* casterAreaEntry = GetAreaEntryByAreaID(caster->GetZoneId());
- if(casterAreaEntry && (casterAreaEntry->flags & AREA_FLAG_CAPITAL) )
+ if (casterAreaEntry && (casterAreaEntry->flags & AREA_FLAG_CAPITAL) )
{
SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here
return;
}
AreaTableEntry const* targetAreaEntry = GetAreaEntryByAreaID(target->GetZoneId());
- if(targetAreaEntry && (targetAreaEntry->flags & AREA_FLAG_CAPITAL) )
+ if (targetAreaEntry && (targetAreaEntry->flags & AREA_FLAG_CAPITAL) )
{
SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here
return;
@@ -6227,7 +6227,7 @@ void Spell::EffectDuel(uint32 i)
uint32 gameobject_id = m_spellInfo->EffectMiscValue[i];
Map *map = m_caster->GetMap();
- if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id,
+ if (!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id,
map, m_caster->GetPhaseMask(),
m_caster->GetPositionX()+(unitTarget->GetPositionX()-m_caster->GetPositionX())/2 ,
m_caster->GetPositionY()+(unitTarget->GetPositionY()-m_caster->GetPositionY())/2 ,
@@ -6276,10 +6276,10 @@ void Spell::EffectDuel(uint32 i)
void Spell::EffectStuck(uint32 /*i*/)
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- if(!sWorld.getConfig(CONFIG_CAST_UNSTUCK))
+ if (!sWorld.getConfig(CONFIG_CAST_UNSTUCK))
return;
Player* pTarget = (Player*)unitTarget;
@@ -6287,7 +6287,7 @@ void Spell::EffectStuck(uint32 /*i*/)
sLog.outDebug("Spell Effect: Stuck");
sLog.outDetail("Player %s (guid %u) used auto-unstuck future at map %u (%f, %f, %f)", pTarget->GetName(), pTarget->GetGUIDLow(), m_caster->GetMapId(), m_caster->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ());
- if(pTarget->isInFlight())
+ if (pTarget->isInFlight())
return;
pTarget->TeleportTo(pTarget->GetStartPosition(), unitTarget == m_caster ? TELE_TO_SPELL : 0);
@@ -6296,7 +6296,7 @@ void Spell::EffectStuck(uint32 /*i*/)
// Stuck spell trigger Hearthstone cooldown
SpellEntry const *spellInfo = sSpellStore.LookupEntry(8690);
- if(!spellInfo)
+ if (!spellInfo)
return;
Spell spell(pTarget, spellInfo, true, 0);
spell.SendSpellCooldown();
@@ -6304,11 +6304,11 @@ void Spell::EffectStuck(uint32 /*i*/)
void Spell::EffectSummonPlayer(uint32 /*i*/)
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Evil Twin (ignore player summon, but hide this for summoner)
- if(unitTarget->HasAura(23445))
+ if (unitTarget->HasAura(23445))
return;
float x, y, z;
@@ -6332,7 +6332,7 @@ static ScriptInfo generateActivateCommand()
void Spell::EffectActivateObject(uint32 effect_idx)
{
- if(!gameObjTarget)
+ if (!gameObjTarget)
return;
static ScriptInfo activateCommand = generateActivateCommand();
@@ -6383,37 +6383,37 @@ void Spell::EffectApplyGlyph(uint32 i)
void Spell::EffectEnchantHeldItem(uint32 i)
{
// this is only item spell effect applied to main-hand weapon of target player (players in area)
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player* item_owner = (Player*)unitTarget;
Item* item = item_owner->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
- if(!item )
+ if (!item )
return;
// must be equipped
- if(!item ->IsEquipped())
+ if (!item ->IsEquipped())
return;
if (m_spellInfo->EffectMiscValue[i])
{
uint32 enchant_id = m_spellInfo->EffectMiscValue[i];
int32 duration = GetSpellDuration(m_spellInfo); //Try duration index first ..
- if(!duration)
+ if (!duration)
duration = damage;//+1; //Base points after ..
- if(!duration)
+ if (!duration)
duration = 10; //10 seconds for enchants which don't have listed duration
SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
- if(!pEnchant)
+ if (!pEnchant)
return;
// Always go to temp enchantment slot
EnchantmentSlot slot = TEMP_ENCHANTMENT_SLOT;
// Enchantment will not be applied if a different one already exists
- if(item->GetEnchantmentId(slot) && item->GetEnchantmentId(slot) != enchant_id)
+ if (item->GetEnchantmentId(slot) && item->GetEnchantmentId(slot) != enchant_id)
return;
// Apply the temporary enchantment
@@ -6424,11 +6424,11 @@ void Spell::EffectEnchantHeldItem(uint32 i)
void Spell::EffectDisEnchant(uint32 /*i*/)
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* p_caster = (Player*)m_caster;
- if(!itemTarget || !itemTarget->GetProto()->DisenchantID)
+ if (!itemTarget || !itemTarget->GetProto()->DisenchantID)
return;
p_caster->UpdateCraftSkill(m_spellInfo->Id);
@@ -6440,7 +6440,7 @@ void Spell::EffectDisEnchant(uint32 /*i*/)
void Spell::EffectInebriate(uint32 /*i*/)
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player *player = (Player*)unitTarget;
@@ -6455,24 +6455,24 @@ void Spell::EffectInebriate(uint32 /*i*/)
void Spell::EffectFeedPet(uint32 i)
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player *_player = (Player*)m_caster;
Item* foodItem = m_targets.getItemTarget();
- if(!foodItem)
+ if (!foodItem)
return;
Pet *pet = _player->GetPet();
- if(!pet)
+ if (!pet)
return;
- if(!pet->isAlive())
+ if (!pet->isAlive())
return;
int32 benefit = pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel);
- if(benefit <= 0)
+ if (benefit <= 0)
return;
uint32 count = 1;
@@ -6484,13 +6484,13 @@ void Spell::EffectFeedPet(uint32 i)
void Spell::EffectDismissPet(uint32 /*i*/)
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Pet* pet = m_caster->ToPlayer()->GetPet();
// not let dismiss dead pet
- if(!pet||!pet->isAlive())
+ if (!pet||!pet->isAlive())
return;
m_caster->ToPlayer()->RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
@@ -6511,13 +6511,13 @@ void Spell::EffectSummonObject(uint32 i)
}
uint64 guid = m_caster->m_ObjectSlot[slot];
- if(guid != 0)
+ if (guid != 0)
{
GameObject* obj = NULL;
- if( m_caster )
+ if ( m_caster )
obj = m_caster->GetMap()->GetGameObject(guid);
- if(obj)
+ if (obj)
{
// Recast case - null spell id to make auras not be removed on object remove from world
if (m_spellInfo->Id == obj->GetSpellId())
@@ -6538,7 +6538,7 @@ void Spell::EffectSummonObject(uint32 i)
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
Map *map = m_caster->GetMap();
- if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map,
+ if (!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map,
m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
{
delete pGameObj;
@@ -6558,14 +6558,14 @@ void Spell::EffectSummonObject(uint32 i)
void Spell::EffectResurrect(uint32 /*effIndex*/)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
- if(unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- if(unitTarget->isAlive())
+ if (unitTarget->isAlive())
return;
- if(!unitTarget->IsInWorld())
+ if (!unitTarget->IsInWorld())
return;
switch (m_spellInfo->Id)
@@ -6592,7 +6592,7 @@ void Spell::EffectResurrect(uint32 /*effIndex*/)
Player* pTarget = unitTarget->ToPlayer();
- if(pTarget->isRessurectRequested()) // already have one active request
+ if (pTarget->isRessurectRequested()) // already have one active request
return;
uint32 health = pTarget->GetMaxHealth() * damage / 100;
@@ -6604,10 +6604,10 @@ void Spell::EffectResurrect(uint32 /*effIndex*/)
void Spell::EffectAddExtraAttacks(uint32 /*i*/)
{
- if(!unitTarget || !unitTarget->isAlive())
+ if (!unitTarget || !unitTarget->isAlive())
return;
- if( unitTarget->m_extraAttacks )
+ if ( unitTarget->m_extraAttacks )
return;
Unit *victim = unitTarget->getVictim();
@@ -6640,15 +6640,15 @@ void Spell::EffectBlock(uint32 /*i*/)
void Spell::EffectLeapForward(uint32 i)
{
- if(unitTarget->isInFlight())
+ if (unitTarget->isInFlight())
return;
- if(!m_targets.HasDst())
+ if (!m_targets.HasDst())
return;
uint32 mapid = m_caster->GetMapId();
float dist = m_caster->GetSpellRadiusForTarget(unitTarget, sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
- if(Player* modOwner = m_originalCaster->GetSpellModOwner())
+ if (Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, dist);
float x,y,z;
@@ -6685,13 +6685,13 @@ void Spell::EffectLeapForward(uint32 i)
} else break;
}
- if(j < 10)
+ if (j < 10)
unitTarget->NearTeleportTo(destx, desty, destz + 0.07531, orientation, unitTarget==m_caster);
}
void Spell::EffectReputation(uint32 i)
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player *_player = (Player*)unitTarget;
@@ -6702,7 +6702,7 @@ void Spell::EffectReputation(uint32 i)
FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
- if(!factionEntry)
+ if (!factionEntry)
return;
_player->GetReputationMgr().ModifyReputation(factionEntry, rep_change);
@@ -6732,18 +6732,18 @@ void Spell::EffectForceDeselect(uint32 i)
void Spell::EffectSelfResurrect(uint32 i)
{
- if(!unitTarget || unitTarget->isAlive())
+ if (!unitTarget || unitTarget->isAlive())
return;
- if(unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- if(!unitTarget->IsInWorld())
+ if (!unitTarget->IsInWorld())
return;
uint32 health = 0;
uint32 mana = 0;
// flat case
- if(damage < 0)
+ if (damage < 0)
{
health = uint32(-damage);
mana = m_spellInfo->EffectMiscValue[i];
@@ -6752,7 +6752,7 @@ void Spell::EffectSelfResurrect(uint32 i)
else
{
health = uint32(damage/100.0f*unitTarget->GetMaxHealth());
- if(unitTarget->GetMaxPower(POWER_MANA) > 0)
+ if (unitTarget->GetMaxPower(POWER_MANA) > 0)
mana = uint32(damage/100.0f*unitTarget->GetMaxPower(POWER_MANA));
}
@@ -6769,9 +6769,9 @@ void Spell::EffectSelfResurrect(uint32 i)
void Spell::EffectSkinning(uint32 /*i*/)
{
- if(unitTarget->GetTypeId() != TYPEID_UNIT )
+ if (unitTarget->GetTypeId() != TYPEID_UNIT )
return;
- if(!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Creature* creature = unitTarget->ToCreature();
@@ -6792,11 +6792,11 @@ void Spell::EffectSkinning(uint32 /*i*/)
void Spell::EffectCharge(uint32 /*i*/)
{
- if(!m_caster)
+ if (!m_caster)
return;
Unit *target = m_targets.getUnitTarget();
- if(!target)
+ if (!target)
return;
float x, y, z;
@@ -6811,13 +6811,13 @@ void Spell::EffectCharge(uint32 /*i*/)
void Spell::EffectCharge2(uint32 /*i*/)
{
float x, y, z;
- if(m_targets.HasDst())
+ if (m_targets.HasDst())
m_targets.m_dstPos.GetPosition(x, y, z);
- else if(Unit *target = m_targets.getUnitTarget())
+ else if (Unit *target = m_targets.getUnitTarget())
{
target->GetContactPoint(m_caster, x, y, z);
// not all charge effects used in negative spells
- if(!IsPositiveSpell(m_spellInfo->Id) && m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (!IsPositiveSpell(m_spellInfo->Id) && m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->Attack(target, true);
}
else
@@ -6828,7 +6828,7 @@ void Spell::EffectCharge2(uint32 /*i*/)
void Spell::EffectKnockBack(uint32 i)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
// Typhoon
@@ -6848,17 +6848,17 @@ void Spell::EffectKnockBack(uint32 i)
}
float ratio = m_caster->GetCombatReach() / std::max(unitTarget->GetCombatReach(), 1.0f);
- if(ratio < 1.0f)
+ if (ratio < 1.0f)
ratio = ratio * ratio * ratio * 0.1f; // volume = length^3
else
ratio = 0.1f; // dbc value ratio
float speedxy = float(m_spellInfo->EffectMiscValue[i]) * ratio;
float speedz = float(damage) * ratio;
- if(speedxy < 0.1f && speedz < 0.1f)
+ if (speedxy < 0.1f && speedz < 0.1f)
return;
float x, y;
- if(m_targets.HasDst() && !m_targets.HasTraj())
+ if (m_targets.HasDst() && !m_targets.HasTraj())
m_targets.m_dstPos.GetPosition(x, y);
else
m_caster->GetPosition(x, y);
@@ -6870,9 +6870,9 @@ void Spell::EffectJump2(uint32 i)
{
float speedxy = float(m_spellInfo->EffectMiscValue[i])/10;
float speedz = float(damage/10);
- if(!speedxy)
+ if (!speedxy)
{
- if(m_targets.getUnitTarget())
+ if (m_targets.getUnitTarget())
m_caster->JumpTo(m_targets.getUnitTarget(), speedz);
}
else
@@ -6884,7 +6884,7 @@ void Spell::EffectJump2(uint32 i)
void Spell::EffectSendTaxi(uint32 i)
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
unitTarget->ToPlayer()->ActivateTaxiPathTo(m_spellInfo->EffectMiscValue[i],m_spellInfo->Id);
@@ -6892,7 +6892,7 @@ void Spell::EffectSendTaxi(uint32 i)
void Spell::EffectPlayerPull(uint32 i)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
float speedZ = m_spellInfo->EffectBasePoints[i]/10;
@@ -6902,7 +6902,7 @@ void Spell::EffectPlayerPull(uint32 i)
void Spell::EffectDispelMechanic(uint32 i)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
uint32 mechanic = m_spellInfo->EffectMiscValue[i];
@@ -6915,7 +6915,7 @@ void Spell::EffectDispelMechanic(uint32 i)
Aura * aura = itr->second;
if (!aura->GetApplicationOfTarget(unitTarget->GetGUID()))
continue;
- if((GetAllSpellMechanicMask(aura->GetSpellProto()) & (1<<(mechanic))) && GetDispelChance(aura->GetCaster(), aura->GetId()))
+ if ((GetAllSpellMechanicMask(aura->GetSpellProto()) & (1<<(mechanic))) && GetDispelChance(aura->GetCaster(), aura->GetId()))
{
dispel_list.push(std::make_pair(aura->GetId(), aura->GetCasterGUID() ) );
}
@@ -6929,15 +6929,15 @@ void Spell::EffectDispelMechanic(uint32 i)
void Spell::EffectSummonDeadPet(uint32 /*i*/)
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player *_player = (Player*)m_caster;
Pet *pet = _player->GetPet();
- if(!pet)
+ if (!pet)
return;
- if(pet->isAlive())
+ if (pet->isAlive())
return;
- if(damage < 0)
+ if (damage < 0)
return;
float x,y,z;
@@ -6960,15 +6960,15 @@ void Spell::EffectDestroyAllTotems(uint32 /*i*/)
int32 mana = 0;
for (uint8 slot = SUMMON_SLOT_TOTEM; slot < MAX_TOTEM_SLOT; ++slot)
{
- if(!m_caster->m_SummonSlot[slot])
+ if (!m_caster->m_SummonSlot[slot])
continue;
Creature* totem = m_caster->GetMap()->GetCreature(m_caster->m_SummonSlot[slot]);
- if(totem && totem->isTotem())
+ if (totem && totem->isTotem())
{
uint32 spell_id = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL);
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
- if(spellInfo)
+ if (spellInfo)
{
mana += spellInfo->manaCost;
mana += spellInfo->ManaCostPercentage * m_caster->GetCreateMana() / 100;
@@ -6984,56 +6984,56 @@ void Spell::EffectDestroyAllTotems(uint32 /*i*/)
void Spell::EffectDurabilityDamage(uint32 i)
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
int32 slot = m_spellInfo->EffectMiscValue[i];
// FIXME: some spells effects have value -1/-2
// Possibly its mean -1 all player equipped items and -2 all items
- if(slot < 0)
+ if (slot < 0)
{
unitTarget->ToPlayer()->DurabilityPointsLossAll(damage, (slot < -1));
return;
}
// invalid slot value
- if(slot >= INVENTORY_SLOT_BAG_END)
+ if (slot >= INVENTORY_SLOT_BAG_END)
return;
- if(Item* item = unitTarget->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
+ if (Item* item = unitTarget->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
unitTarget->ToPlayer()->DurabilityPointsLoss(item, damage);
}
void Spell::EffectDurabilityDamagePCT(uint32 i)
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
int32 slot = m_spellInfo->EffectMiscValue[i];
// FIXME: some spells effects have value -1/-2
// Possibly its mean -1 all player equipped items and -2 all items
- if(slot < 0)
+ if (slot < 0)
{
unitTarget->ToPlayer()->DurabilityLossAll(double(damage)/100.0f, (slot < -1));
return;
}
// invalid slot value
- if(slot >= INVENTORY_SLOT_BAG_END)
+ if (slot >= INVENTORY_SLOT_BAG_END)
return;
- if(damage <= 0)
+ if (damage <= 0)
return;
- if(Item* item = unitTarget->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
+ if (Item* item = unitTarget->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
unitTarget->ToPlayer()->DurabilityLoss(item, double(damage)/100.0f);
}
void Spell::EffectModifyThreatPercent(uint32 /*effIndex*/)
{
- if(!unitTarget)
+ if (!unitTarget)
return;
unitTarget->getThreatManager().modifyThreatPercent(m_caster, damage);
@@ -7053,10 +7053,10 @@ void Spell::EffectTransmitted(uint32 effIndex)
float fx, fy, fz;
- if(m_targets.HasDst())
+ if (m_targets.HasDst())
m_targets.m_dstPos.GetPosition(fx, fy, fz);
//FIXME: this can be better check for most objects but still hack
- else if(m_spellInfo->EffectRadiusIndex[effIndex] && m_spellInfo->speed==0)
+ else if (m_spellInfo->EffectRadiusIndex[effIndex] && m_spellInfo->speed==0)
{
float dis = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex]));
m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis);
@@ -7072,10 +7072,10 @@ void Spell::EffectTransmitted(uint32 effIndex)
}
Map *cMap = m_caster->GetMap();
- if(goinfo->type==GAMEOBJECT_TYPE_FISHINGNODE)
+ if (goinfo->type==GAMEOBJECT_TYPE_FISHINGNODE)
{
//dirty way to hack serpent shrine pool
- if(cMap->GetId() == 548 && m_caster->GetDistance(36.69, -416.38, -19.9645) <= 16)//center of strange pool
+ if (cMap->GetId() == 548 && m_caster->GetDistance(36.69, -416.38, -19.9645) <= 16)//center of strange pool
{
fx = 36.69+irand(-8,8);//random place for the bobber
fy = -416.38+irand(-8,8);
@@ -7088,18 +7088,18 @@ void Spell::EffectTransmitted(uint32 effIndex)
}
// replace by water level in this case
- if(cMap->GetId() != 548)//if map is not serpentshrine caverns
+ if (cMap->GetId() != 548)//if map is not serpentshrine caverns
fz = cMap->GetWaterLevel(fx, fy);
}
// if gameobject is summoning object, it should be spawned right on caster's position
- else if(goinfo->type==GAMEOBJECT_TYPE_SUMMONING_RITUAL)
+ else if (goinfo->type==GAMEOBJECT_TYPE_SUMMONING_RITUAL)
{
m_caster->GetPosition(fx, fy, fz);
}
GameObject* pGameObj = new GameObject;
- if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap,
+ if (!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap,
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
delete pGameObj;
@@ -7131,7 +7131,7 @@ void Spell::EffectTransmitted(uint32 effIndex)
}
case GAMEOBJECT_TYPE_SUMMONING_RITUAL:
{
- if(m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
pGameObj->AddUniqueUse(m_caster->ToPlayer());
m_caster->AddGameObject(pGameObj); // will removed at spell cancel
@@ -7160,10 +7160,10 @@ void Spell::EffectTransmitted(uint32 effIndex)
cMap->Add(pGameObj);
- if(uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
+ if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
{
GameObject* linkedGO = new GameObject;
- if(linkedGO->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, cMap,
+ if (linkedGO->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, cMap,
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0);
@@ -7184,17 +7184,17 @@ void Spell::EffectTransmitted(uint32 effIndex)
void Spell::EffectProspecting(uint32 /*i*/)
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* p_caster = (Player*)m_caster;
- if(!itemTarget || !(itemTarget->GetProto()->BagFamily & BAG_FAMILY_MASK_MINING_SUPP))
+ if (!itemTarget || !(itemTarget->GetProto()->BagFamily & BAG_FAMILY_MASK_MINING_SUPP))
return;
- if(itemTarget->GetCount() < 5)
+ if (itemTarget->GetCount() < 5)
return;
- if( sWorld.getConfig(CONFIG_SKILL_PROSPECTING))
+ if ( sWorld.getConfig(CONFIG_SKILL_PROSPECTING))
{
uint32 SkillValue = p_caster->GetPureSkillValue(SKILL_JEWELCRAFTING);
uint32 reqSkillValue = itemTarget->GetProto()->RequiredSkillRank;
@@ -7206,17 +7206,17 @@ void Spell::EffectProspecting(uint32 /*i*/)
void Spell::EffectMilling(uint32 /*i*/)
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* p_caster = (Player*)m_caster;
- if(!itemTarget || !(itemTarget->GetProto()->BagFamily & BAG_FAMILY_MASK_HERBS))
+ if (!itemTarget || !(itemTarget->GetProto()->BagFamily & BAG_FAMILY_MASK_HERBS))
return;
- if(itemTarget->GetCount() < 5)
+ if (itemTarget->GetCount() < 5)
return;
- if( sWorld.getConfig(CONFIG_SKILL_MILLING))
+ if ( sWorld.getConfig(CONFIG_SKILL_MILLING))
{
uint32 SkillValue = p_caster->GetPureSkillValue(SKILL_INSCRIPTION);
uint32 reqSkillValue = itemTarget->GetProto()->RequiredSkillRank;
@@ -7238,11 +7238,11 @@ void Spell::EffectSkill(uint32 /*i*/)
void Spell::EffectSpiritHeal(uint32 /*i*/)
{
/*
- if(!unitTarget || unitTarget->isAlive())
+ if (!unitTarget || unitTarget->isAlive())
return;
- if(unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- if(!unitTarget->IsInWorld())
+ if (!unitTarget->IsInWorld())
return;
//m_spellInfo->EffectBasePoints[i]; == 99 (percent?)
@@ -7266,7 +7266,7 @@ void Spell::EffectStealBeneficialBuff(uint32 i)
{
sLog.outDebug("Effect: StealBeneficialBuff");
- if(!unitTarget || unitTarget==m_caster) // can't steal from self
+ if (!unitTarget || unitTarget==m_caster) // can't steal from self
return;
Unit::AuraList steal_list;
@@ -7327,7 +7327,7 @@ void Spell::EffectStealBeneficialBuff(uint32 i)
void Spell::EffectKillCreditPersonal(uint32 i)
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
unitTarget->ToPlayer()->KilledMonsterCredit(m_spellInfo->EffectMiscValue[i], 0);
@@ -7335,23 +7335,23 @@ void Spell::EffectKillCreditPersonal(uint32 i)
void Spell::EffectKillCredit(uint32 i)
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
int32 creatureEntry = m_spellInfo->EffectMiscValue[i];
- if(!creatureEntry)
+ if (!creatureEntry)
{
- if(m_spellInfo->Id == 42793) // Burn Body
+ if (m_spellInfo->Id == 42793) // Burn Body
creatureEntry = 24008; // Fallen Combatant
}
- if(creatureEntry)
+ if (creatureEntry)
unitTarget->ToPlayer()->RewardPlayerAndGroupAtEvent(creatureEntry, unitTarget);
}
void Spell::EffectQuestFail(uint32 i)
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
unitTarget->ToPlayer()->FailQuest(m_spellInfo->EffectMiscValue[i]);
@@ -7359,12 +7359,12 @@ void Spell::EffectQuestFail(uint32 i)
void Spell::EffectActivateRune(uint32 eff_idx)
{
- if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player *plr = (Player*)m_caster;
- if(plr->getClass() != CLASS_DEATH_KNIGHT)
+ if (plr->getClass() != CLASS_DEATH_KNIGHT)
return;
// needed later
@@ -7374,7 +7374,7 @@ void Spell::EffectActivateRune(uint32 eff_idx)
if (count == 0) count = 1;
for (uint32 j = 0; j < MAX_RUNES && count > 0; ++j)
{
- if(plr->GetRuneCooldown(j) && plr->GetCurrentRune(j) == RuneType(m_spellInfo->EffectMiscValue[eff_idx]))
+ if (plr->GetRuneCooldown(j) && plr->GetCurrentRune(j) == RuneType(m_spellInfo->EffectMiscValue[eff_idx]))
{
plr->SetRuneCooldown(j, 0);
--count;
@@ -7389,7 +7389,7 @@ void Spell::EffectActivateRune(uint32 eff_idx)
for (uint32 i = 0; i < MAX_RUNES; ++i)
{
- if(plr->GetRuneCooldown(i) && (plr->GetCurrentRune(i) == RUNE_FROST || plr->GetCurrentRune(i) == RUNE_DEATH))
+ if (plr->GetRuneCooldown(i) && (plr->GetCurrentRune(i) == RUNE_FROST || plr->GetCurrentRune(i) == RUNE_DEATH))
plr->SetRuneCooldown(i, 0);
}
}
@@ -7403,7 +7403,7 @@ void Spell::EffectTitanGrip(uint32 /*eff_idx*/)
void Spell::EffectRedirectThreat(uint32 /*i*/)
{
- if(unitTarget)
+ if (unitTarget)
m_caster->SetReducedThreatPercent((uint32)damage, unitTarget->GetGUID());
}
@@ -7475,7 +7475,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const *
duration += aurEff->GetAmount();
break;
}
- if(Player* modOwner = m_originalCaster->GetSpellModOwner())
+ if (Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
@@ -7638,7 +7638,7 @@ void Spell::EffectCastButtons(uint32 i)
void Spell::EffectRechargeManaGem(uint32 i)
{
- if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player *player = (Player*)m_caster;
@@ -7649,7 +7649,7 @@ void Spell::EffectRechargeManaGem(uint32 i)
uint32 item_id = m_spellInfo->EffectItemType[0];
ItemPrototype const *pProto = objmgr.GetItemPrototype(item_id);
- if(!pProto)
+ if (!pProto)
{
player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index 905d30b80e1..6f937ad615c 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -187,7 +187,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
}
ItemPrototype const *proto = pItem->GetProto();
- if(!proto)
+ if (!proto)
{
pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL );
return;
@@ -360,11 +360,11 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
//recvPacket.read_skip<float>(); // unk1, coords?
uint8 unk1;
recvPacket >> unk1; // >> 1 or 0
- if(unk1)
+ if (unk1)
{
recvPacket.read_skip<uint32>(); // >> MSG_MOVE_STOP
uint64 guid; // guid - unused
- if(!recvPacket.readPackGUID(guid))
+ if (!recvPacket.readPackGUID(guid))
return;
MovementInfo movementInfo;
@@ -537,7 +537,7 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data )
return;
// TODO: Unit::SetCharmedBy: 28782 is not in world but 0 is trying to charm it! -> crash
- if(!unit->IsInWorld())
+ if (!unit->IsInWorld())
{
sLog.outCrash("Spell click target %u is not in world!", unit->GetEntry());
assert(false);
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index abea24dd0ba..011b8c0e13d 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -263,7 +263,7 @@ bool SpellMgr::IsSrcTargetSpell(SpellEntry const *spellInfo) const
{
for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
{
- if(SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_AREA_SRC || SpellTargetType[spellInfo->EffectImplicitTargetB[i]] == TARGET_TYPE_AREA_SRC)
+ if (SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_AREA_SRC || SpellTargetType[spellInfo->EffectImplicitTargetB[i]] == TARGET_TYPE_AREA_SRC)
return true;
}
return false;
@@ -271,20 +271,20 @@ bool SpellMgr::IsSrcTargetSpell(SpellEntry const *spellInfo) const
int32 GetSpellDuration(SpellEntry const *spellInfo)
{
- if(!spellInfo)
+ if (!spellInfo)
return 0;
SpellDurationEntry const *du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex);
- if(!du)
+ if (!du)
return 0;
return (du->Duration[0] == -1) ? -1 : abs(du->Duration[0]);
}
int32 GetSpellMaxDuration(SpellEntry const *spellInfo)
{
- if(!spellInfo)
+ if (!spellInfo)
return 0;
SpellDurationEntry const *du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex);
- if(!du)
+ if (!du)
return 0;
return (du->Duration[2] == -1) ? -1 : abs(du->Duration[2]);
}
@@ -309,7 +309,7 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell * spell)
SpellCastTimesEntry const *spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex);
// not all spells have cast time index and this is all is pasiive abilities
- if(!spellCastTimeEntry)
+ if (!spellCastTimeEntry)
return 0;
int32 castTime = spellCastTimeEntry->CastTime;
@@ -333,7 +333,7 @@ bool IsPassiveSpell(uint32 spellId)
bool IsPassiveSpell(SpellEntry const * spellInfo)
{
- if(spellInfo->Attributes & SPELL_ATTR_PASSIVE)
+ if (spellInfo->Attributes & SPELL_ATTR_PASSIVE)
return true;
return false;
}
@@ -341,11 +341,11 @@ bool IsPassiveSpell(SpellEntry const * spellInfo)
bool IsAutocastableSpell(uint32 spellId)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
- if(!spellInfo)
+ if (!spellInfo)
return false;
- if(spellInfo->Attributes & SPELL_ATTR_PASSIVE)
+ if (spellInfo->Attributes & SPELL_ATTR_PASSIVE)
return false;
- if(spellInfo->AttributesEx & SPELL_ATTR_EX_UNAUTOCASTABLE_BY_PET)
+ if (spellInfo->AttributesEx & SPELL_ATTR_EX_UNAUTOCASTABLE_BY_PET)
return false;
return true;
}
@@ -406,10 +406,10 @@ uint32 CalculatePowerCost(SpellEntry const * spellInfo, Unit const * caster, Spe
if ( spellInfo->AttributesEx4 & SPELL_ATTR_EX4_SPELL_VS_EXTEND_COST )
powerCost += caster->GetAttackTime(OFF_ATTACK)/100;
// Apply cost mod by spell
- if(Player* modOwner = caster->GetSpellModOwner())
+ if (Player* modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COST, powerCost);
- if(spellInfo->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION)
+ if (spellInfo->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION)
powerCost = int32(powerCost/ (1.117f* spellInfo->spellLevel / caster->getLevel() -0.1327f));
// PCT mod from user auras by school
@@ -465,18 +465,18 @@ AuraState GetSpellAuraState(SpellEntry const * spellInfo)
return AURA_STATE_SWIFTMEND;
// Deadly poison aura state
- if(spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && spellInfo->SpellFamilyFlags[0] & 0x10000)
+ if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && spellInfo->SpellFamilyFlags[0] & 0x10000)
return AURA_STATE_DEADLY_POISON;
// Enrage aura state
- if(spellInfo->Dispel == DISPEL_ENRAGE)
+ if (spellInfo->Dispel == DISPEL_ENRAGE)
return AURA_STATE_ENRAGE;
// Bleeding aura state
if (GetAllSpellMechanicMask(spellInfo) & 1<<MECHANIC_BLEED)
return AURA_STATE_BLEEDING;
- if(GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST)
+ if (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST)
{
for (uint8 i = 0; i<MAX_SPELL_EFFECTS; ++i)
{
@@ -495,7 +495,7 @@ SpellSpecific GetSpellSpecific(SpellEntry const * spellInfo)
case SPELLFAMILY_GENERIC:
{
// Food / Drinks (mostly)
- if(spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
+ if (spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
{
bool food = false;
bool drink = false;
@@ -518,11 +518,11 @@ SpellSpecific GetSpellSpecific(SpellEntry const * spellInfo)
}
}
- if(food && drink)
+ if (food && drink)
return SPELL_SPECIFIC_FOOD_AND_DRINK;
- else if(food)
+ else if (food)
return SPELL_SPECIFIC_FOOD;
- else if(drink)
+ else if (drink)
return SPELL_SPECIFIC_DRINK;
}
// scrolls effects
@@ -597,7 +597,7 @@ SpellSpecific GetSpellSpecific(SpellEntry const * spellInfo)
return SPELL_SPECIFIC_STING;
// only hunter aspects have this (but not all aspects in hunter family)
- if( spellInfo->SpellFamilyFlags.HasFlag(0x00380000, 0x00440000, 0x00001010))
+ if ( spellInfo->SpellFamilyFlags.HasFlag(0x00380000, 0x00440000, 0x00001010))
return SPELL_SPECIFIC_ASPECT;
break;
@@ -615,7 +615,7 @@ SpellSpecific GetSpellSpecific(SpellEntry const * spellInfo)
return SPELL_SPECIFIC_JUDGEMENT;
// only paladin auras have this (for palaldin class family)
- if( spellInfo->SpellFamilyFlags[2] & 0x00000020 )
+ if ( spellInfo->SpellFamilyFlags[2] & 0x00000020 )
return SPELL_SPECIFIC_AURA;
break;
@@ -637,7 +637,7 @@ SpellSpecific GetSpellSpecific(SpellEntry const * spellInfo)
for (int i = 0; i < 3; ++i)
{
- if(spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA)
+ if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA)
{
switch(spellInfo->EffectApplyAuraName[i])
{
@@ -800,28 +800,28 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con
case SPELL_AURA_MOD_HEALING_PCT:
case SPELL_AURA_MOD_HEALING_DONE:
case SPELL_AURA_MOD_DAMAGE_PERCENT_DONE:
- if(spellproto->CalculateSimpleValue(effIndex) < 0)
+ if (spellproto->CalculateSimpleValue(effIndex) < 0)
return false;
break;
case SPELL_AURA_MOD_DAMAGE_TAKEN: // dependent from bas point sign (positive -> negative)
- if(spellproto->CalculateSimpleValue(effIndex) > 0)
+ if (spellproto->CalculateSimpleValue(effIndex) > 0)
return false;
break;
case SPELL_AURA_MOD_CRIT_PCT:
case SPELL_AURA_MOD_SPELL_CRIT_CHANCE:
- if(spellproto->CalculateSimpleValue(effIndex) > 0)
+ if (spellproto->CalculateSimpleValue(effIndex) > 0)
return true; // some expected positive spells have SPELL_ATTR_EX_NEGATIVE
break;
case SPELL_AURA_ADD_TARGET_TRIGGER:
return true;
case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
- if(!deep)
+ if (!deep)
{
uint32 spellTriggeredId = spellproto->EffectTriggerSpell[effIndex];
SpellEntry const *spellTriggeredProto = sSpellStore.LookupEntry(spellTriggeredId);
- if(spellTriggeredProto)
+ if (spellTriggeredProto)
{
// non-positive targets of main spell return early
for (int i = 0; i < 3; ++i)
@@ -830,7 +830,7 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con
continue;
// if non-positive trigger cast targeted to positive target this main cast is non-positive
// this will place this spell auras as debuffs
- if(IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[effIndex],spellTriggeredProto->EffectImplicitTargetB[effIndex]) && !_isPositiveEffect(spellTriggeredId,i, true))
+ if (IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[effIndex],spellTriggeredProto->EffectImplicitTargetB[effIndex]) && !_isPositiveEffect(spellTriggeredId,i, true))
return false;
}
}
@@ -839,11 +839,11 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con
// many positive auras have negative triggered spells at damage for example and this not make it negative (it can be canceled for example)
break;
case SPELL_AURA_MOD_STUN: //have positive and negative spells, we can't sort its correctly at this moment.
- if(effIndex==0 && spellproto->Effect[1]==0 && spellproto->Effect[2]==0)
+ if (effIndex==0 && spellproto->Effect[1]==0 && spellproto->Effect[2]==0)
return false; // but all single stun aura spells is negative
break;
case SPELL_AURA_MOD_PACIFY_SILENCE:
- if(spellproto->Id == 24740) // Wisp Costume
+ if (spellproto->Id == 24740) // Wisp Costume
return true;
return false;
case SPELL_AURA_MOD_ROOT:
@@ -855,15 +855,15 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con
return false;
case SPELL_AURA_PERIODIC_DAMAGE: // used in positive spells also.
// part of negative spell if casted at self (prevent cancel)
- if(spellproto->EffectImplicitTargetA[effIndex] == TARGET_UNIT_CASTER)
+ if (spellproto->EffectImplicitTargetA[effIndex] == TARGET_UNIT_CASTER)
return false;
break;
case SPELL_AURA_MOD_DECREASE_SPEED: // used in positive spells also
// part of positive spell if casted at self
- if(spellproto->EffectImplicitTargetA[effIndex] != TARGET_UNIT_CASTER)
+ if (spellproto->EffectImplicitTargetA[effIndex] != TARGET_UNIT_CASTER)
return false;
// but not this if this first effect (didn't find better check)
- if(spellproto->Attributes & 0x4000000 && effIndex==0)
+ if (spellproto->Attributes & 0x4000000 && effIndex==0)
return false;
break;
case SPELL_AURA_MECHANIC_IMMUNITY:
@@ -887,7 +887,7 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con
switch(spellproto->EffectMiscValue[effIndex])
{
case SPELLMOD_COST: // dependent from bas point sign (negative -> positive)
- if(spellproto->CalculateSimpleValue(effIndex) > 0)
+ if (spellproto->CalculateSimpleValue(effIndex) > 0)
{
if (!deep)
{
@@ -920,11 +920,11 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con
}
// non-positive targets
- if(!IsPositiveTarget(spellproto->EffectImplicitTargetA[effIndex],spellproto->EffectImplicitTargetB[effIndex]))
+ if (!IsPositiveTarget(spellproto->EffectImplicitTargetA[effIndex],spellproto->EffectImplicitTargetB[effIndex]))
return false;
// AttributesEx check
- if(spellproto->AttributesEx & SPELL_ATTR_EX_NEGATIVE)
+ if (spellproto->AttributesEx & SPELL_ATTR_EX_NEGATIVE)
return false;
if (!deep && spellproto->EffectTriggerSpell[effIndex]
@@ -939,14 +939,14 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con
bool IsPositiveSpell(uint32 spellId)
{
- if(!sSpellStore.LookupEntry(spellId)) // non-existing spells
+ if (!sSpellStore.LookupEntry(spellId)) // non-existing spells
return false;
return !(spellmgr.GetSpellCustomAttr(spellId) & SPELL_ATTR_CU_NEGATIVE);
}
bool IsPositiveEffect(uint32 spellId, uint32 effIndex)
{
- if(!sSpellStore.LookupEntry(spellId))
+ if (!sSpellStore.LookupEntry(spellId))
return false;
switch(effIndex)
{
@@ -991,7 +991,7 @@ bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellI
{
// TODO - need better check
// Equal icon and spellfamily
- if( spellInfo1->SpellFamilyName == spellInfo2->SpellFamilyName &&
+ if ( spellInfo1->SpellFamilyName == spellInfo2->SpellFamilyName &&
spellInfo1->SpellIconID == spellInfo2->SpellIconID )
return true;
@@ -1002,7 +1002,7 @@ bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellI
{
case SPELL_SPECIFIC_JUDGEMENT:
case SPELL_SPECIFIC_MAGE_POLYMORPH:
- if(GetSpellSpecific(spellInfo2) == spec1)
+ if (GetSpellSpecific(spellInfo2) == spec1)
return true;
break;
default:
@@ -1016,7 +1016,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32
{
// talents that learn spells can have stance requirements that need ignore
// (this requirement only for client-side stance show in talent description)
- if( GetTalentSpellCost(spellInfo->Id) > 0 &&
+ if ( GetTalentSpellCost(spellInfo->Id) > 0 &&
(spellInfo->Effect[0]==SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[1]==SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[2]==SPELL_EFFECT_LEARN_SPELL) )
return SPELL_CAST_OK;
@@ -1041,7 +1041,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32
actAsShifted = !(shapeInfo->flags1 & 1); // shapeshift acts as normal form for spells
}
- if(actAsShifted)
+ if (actAsShifted)
{
if (spellInfo->Attributes & SPELL_ATTR_NOT_SHAPESHIFT) // not while shapeshifted
return SPELL_FAILED_NOT_SHAPESHIFT;
@@ -1051,7 +1051,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32
else
{
// needs shapeshift
- if(!(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) && spellInfo->Stances != 0)
+ if (!(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) && spellInfo->Stances != 0)
return SPELL_FAILED_ONLY_SHAPESHIFT;
}
@@ -1060,7 +1060,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32
// TODO: Find a way to disable use of these spells clientside
if (shapeInfo && shapeInfo->flags1 & 0x400)
{
- if(!(stanceMask & spellInfo->Stances))
+ if (!(stanceMask & spellInfo->Stances))
return SPELL_FAILED_ONLY_SHAPESHIFT;
}
@@ -1075,7 +1075,7 @@ void SpellMgr::LoadSpellTargetPositions()
// 0 1 2 3 4 5
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
@@ -1106,7 +1106,7 @@ void SpellMgr::LoadSpellTargetPositions()
st.target_Orientation = fields[5].GetFloat();
SpellEntry const* spellInfo = sSpellStore.LookupEntry(Spell_ID);
- if(!spellInfo)
+ if (!spellInfo)
{
sLog.outErrorDb("Spell (ID:%u) listed in `spell_target_position` does not exist.",Spell_ID);
continue;
@@ -1115,26 +1115,26 @@ void SpellMgr::LoadSpellTargetPositions()
bool found = false;
for (int i = 0; i < 3; ++i)
{
- if( spellInfo->EffectImplicitTargetA[i]==TARGET_DST_DB || spellInfo->EffectImplicitTargetB[i]==TARGET_DST_DB )
+ if ( spellInfo->EffectImplicitTargetA[i]==TARGET_DST_DB || spellInfo->EffectImplicitTargetB[i]==TARGET_DST_DB )
{
found = true;
break;
}
}
- if(!found)
+ if (!found)
{
sLog.outErrorDb("Spell (Id: %u) listed in `spell_target_position` does not have target TARGET_DST_DB (17).",Spell_ID);
continue;
}
MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId);
- if(!mapEntry)
+ if (!mapEntry)
{
sLog.outErrorDb("Spell (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.",Spell_ID,st.target_mapId);
continue;
}
- if(st.target_X==0 && st.target_Y==0 && st.target_Z==0)
+ if (st.target_X==0 && st.target_Y==0 && st.target_Z==0)
{
sLog.outErrorDb("Spell (ID:%u) target coordinates not provided.",Spell_ID);
continue;
@@ -1149,7 +1149,7 @@ void SpellMgr::LoadSpellTargetPositions()
for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
{
SpellEntry const * spellInfo = sSpellStore.LookupEntry(i);
- if(!spellInfo)
+ if (!spellInfo)
continue;
bool found = false;
@@ -1161,7 +1161,7 @@ void SpellMgr::LoadSpellTargetPositions()
found = true;
break;
}
- if(found)
+ if (found)
break;
switch(spellInfo->EffectImplicitTargetB[j])
{
@@ -1169,12 +1169,12 @@ void SpellMgr::LoadSpellTargetPositions()
found = true;
break;
}
- if(found)
+ if (found)
break;
}
- if(found)
+ if (found)
{
-// if(!spellmgr.GetSpellTargetPosition(i))
+// if (!spellmgr.GetSpellTargetPosition(i))
// sLog.outDebug("Spell (ID: %u) does not have record in `spell_target_position`", i);
}
}
@@ -1209,7 +1209,7 @@ void SpellMgr::LoadSpellProcEvents()
// 0 1 2 3 4 5 6 7 8 9 10
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
bar.step();
@@ -1275,7 +1275,7 @@ void SpellMgr::LoadSpellBonusess()
uint32 count = 0;
// 0 1 2 3 4
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
bar.step();
@@ -1319,7 +1319,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
uint32 procEvent_procEx = PROC_EX_NONE;
// check prockFlags for condition
- if((procFlags & EventProcFlag) == 0)
+ if ((procFlags & EventProcFlag) == 0)
return false;
bool hasFamilyMask = false;
@@ -1379,21 +1379,21 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
if (procSpell == NULL)
{
// Check (if set) for school (melee attack have Normal school)
- if(spellProcEvent->schoolMask && (spellProcEvent->schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
+ if (spellProcEvent->schoolMask && (spellProcEvent->schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
return false;
}
else // For spells need check school/spell family/family mask
{
// Check (if set) for school
- if(spellProcEvent->schoolMask && (spellProcEvent->schoolMask & procSpell->SchoolMask) == 0)
+ if (spellProcEvent->schoolMask && (spellProcEvent->schoolMask & procSpell->SchoolMask) == 0)
return false;
// Check (if set) for spellFamilyName
- if(spellProcEvent->spellFamilyName && (spellProcEvent->spellFamilyName != procSpell->SpellFamilyName))
+ if (spellProcEvent->spellFamilyName && (spellProcEvent->spellFamilyName != procSpell->SpellFamilyName))
return false;
// spellFamilyName is Ok need check for spellFamilyMask if present
- if(spellProcEvent->spellFamilyMask)
+ if (spellProcEvent->spellFamilyMask)
{
if ((spellProcEvent->spellFamilyMask & procSpell->SpellFamilyFlags ) == 0)
return false;
@@ -1415,7 +1415,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
if (procEvent_procEx == PROC_EX_NONE)
{
// No extra req, so can trigger only for hit/crit - spell has to be active
- if((procExtra & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) && active)
+ if ((procExtra & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) && active)
return true;
}
else // Passive spells hits here only if resist/reflect/immune/evade
@@ -1451,7 +1451,7 @@ void SpellMgr::LoadSpellGroups()
// 0 1
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group");
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
@@ -1541,7 +1541,7 @@ void SpellMgr::LoadSpellGroupStackRules()
// 0 1
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules");
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
@@ -1635,22 +1635,22 @@ void SpellMgr::LoadSpellThreats()
bool SpellMgr::IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const
{
SpellEntry const *spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
- if(!spellInfo_1 || !spellInfo_2) return false;
- if(spellInfo_1->Id == spellId_2) return false;
+ if (!spellInfo_1 || !spellInfo_2) return false;
+ if (spellInfo_1->Id == spellId_2) return false;
return GetFirstSpellInChain(spellInfo_1->Id)==GetFirstSpellInChain(spellId_2);
}
bool SpellMgr::canStackSpellRanks(SpellEntry const *spellInfo)
{
- if(IsPassiveSpell(spellInfo->Id)) // ranked passive spell
+ if (IsPassiveSpell(spellInfo->Id)) // ranked passive spell
return false;
- if(spellInfo->powerType != POWER_MANA && spellInfo->powerType != POWER_HEALTH)
+ if (spellInfo->powerType != POWER_MANA && spellInfo->powerType != POWER_HEALTH)
return false;
- if(IsProfessionOrRidingSpell(spellInfo->Id))
+ if (IsProfessionOrRidingSpell(spellInfo->Id))
return false;
- if(spellmgr.IsSkillBonusSpell(spellInfo->Id))
+ if (spellmgr.IsSkillBonusSpell(spellInfo->Id))
return false;
// All stance spells. if any better way, change it.
@@ -1682,12 +1682,12 @@ bool SpellMgr::canStackSpellRanks(SpellEntry const *spellInfo)
bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
- if(!spellInfo)
+ if (!spellInfo)
return false;
for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS ; ++i)
{
- if(spellInfo->Effect[i] == SPELL_EFFECT_SKILL)
+ if (spellInfo->Effect[i] == SPELL_EFFECT_SKILL)
{
uint32 skill = spellInfo->EffectMiscValue[i];
@@ -1702,12 +1702,12 @@ bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId)
bool SpellMgr::IsProfessionSpell(uint32 spellId)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
- if(!spellInfo)
+ if (!spellInfo)
return false;
for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS ; ++i)
{
- if(spellInfo->Effect[i] == SPELL_EFFECT_SKILL)
+ if (spellInfo->Effect[i] == SPELL_EFFECT_SKILL)
{
uint32 skill = spellInfo->EffectMiscValue[i];
@@ -1722,12 +1722,12 @@ bool SpellMgr::IsProfessionSpell(uint32 spellId)
bool SpellMgr::IsPrimaryProfessionSpell(uint32 spellId)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
- if(!spellInfo)
+ if (!spellInfo)
return false;
for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS ; ++i)
{
- if(spellInfo->Effect[i] == SPELL_EFFECT_SKILL)
+ if (spellInfo->Effect[i] == SPELL_EFFECT_SKILL)
{
uint32 skill = spellInfo->EffectMiscValue[i];
@@ -1754,7 +1754,7 @@ bool SpellMgr::IsSkillBonusSpell(uint32 spellId) const
if (!pAbility || pAbility->learnOnGetSkill != ABILITY_LEARNED_ON_GET_PROFESSION_SKILL)
continue;
- if(pAbility->req_skill_value > 0)
+ if (pAbility->req_skill_value > 0)
return true;
}
@@ -1764,13 +1764,13 @@ bool SpellMgr::IsSkillBonusSpell(uint32 spellId) const
SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spellInfo, uint32 playerLevel) const
{
// ignore passive spells
- if(IsPassiveSpell(spellInfo->Id))
+ if (IsPassiveSpell(spellInfo->Id))
return spellInfo;
bool needRankSelection = false;
for (int i=0; i<3; ++i)
{
- if( IsPositiveEffect(spellInfo->Id, i) && (
+ if ( IsPositiveEffect(spellInfo->Id, i) && (
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA ||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID
@@ -1782,17 +1782,17 @@ SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spell
}
// not required
- if(!needRankSelection)
+ if (!needRankSelection)
return spellInfo;
for (uint32 nextSpellId = spellInfo->Id; nextSpellId != 0; nextSpellId = GetPrevSpellInChain(nextSpellId))
{
SpellEntry const *nextSpellInfo = sSpellStore.LookupEntry(nextSpellId);
- if(!nextSpellInfo)
+ if (!nextSpellInfo)
break;
// if found appropriate level
- if(playerLevel + 10 >= nextSpellInfo->spellLevel)
+ if (playerLevel + 10 >= nextSpellInfo->spellLevel)
return nextSpellInfo;
// one rank less then
@@ -1814,12 +1814,12 @@ void SpellMgr::LoadSpellLearnSkills()
bar.step();
SpellEntry const* entry = sSpellStore.LookupEntry(spell);
- if(!entry)
+ if (!entry)
continue;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if(entry->Effect[i]==SPELL_EFFECT_SKILL)
+ if (entry->Effect[i]==SPELL_EFFECT_SKILL)
{
SpellLearnSkillNode dbc_node;
dbc_node.skill = entry->EffectMiscValue[i];
@@ -1908,7 +1908,7 @@ void SpellMgr::LoadSpellLearnSpells()
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if(entry->Effect[i]==SPELL_EFFECT_LEARN_SPELL)
+ if (entry->Effect[i]==SPELL_EFFECT_LEARN_SPELL)
{
SpellLearnSpellNode dbc_node;
dbc_node.spell = entry->EffectTriggerSpell[i];
@@ -1991,7 +1991,7 @@ void SpellMgr::LoadSpellScriptTarget()
bool targetfound = false;
for (uint8 i = 0; i < 3; ++i)
{
- if(spellProto->EffectImplicitTargetA[i]==TARGET_UNIT_AREA_ENTRY_SRC ||
+ if (spellProto->EffectImplicitTargetA[i]==TARGET_UNIT_AREA_ENTRY_SRC ||
spellProto->EffectImplicitTargetB[i]==TARGET_UNIT_AREA_ENTRY_SRC ||
spellProto->EffectImplicitTargetA[i]==TARGET_UNIT_AREA_ENTRY_DST ||
spellProto->EffectImplicitTargetB[i]==TARGET_UNIT_AREA_ENTRY_DST ||
@@ -2041,7 +2041,7 @@ void SpellMgr::LoadSpellScriptTarget()
default:
{
//players
- /*if(targetEntry == 0)
+ /*if (targetEntry == 0)
{
sLog.outErrorDb("Table `spell_script_target`: target entry == 0 for not GO target type (%u).",type);
continue;
@@ -2262,11 +2262,11 @@ bool LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefaultSpellsEntr
return false;
// remove duplicates with levelupSpells if any
- if(PetLevelupSpellSet const *levelupSpells = cInfo->family ? spellmgr.GetPetLevelupSpellList(cInfo->family) : NULL)
+ if (PetLevelupSpellSet const *levelupSpells = cInfo->family ? spellmgr.GetPetLevelupSpellList(cInfo->family) : NULL)
{
for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j)
{
- if(!petDefSpells.spellid[j])
+ if (!petDefSpells.spellid[j])
continue;
for (PetLevelupSpellSet::const_iterator itr = levelupSpells->begin(); itr != levelupSpells->end(); ++itr)
@@ -2324,7 +2324,7 @@ void SpellMgr::LoadPetDefaultSpells()
for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j)
petDefSpells.spellid[j] = spellDataEntry->spellId[j];
- if(LoadPetDefaultSpells_helper(cInfo, petDefSpells))
+ if (LoadPetDefaultSpells_helper(cInfo, petDefSpells))
{
mPetDefaultSpellsMap[petSpellsId] = petDefSpells;
++countData;
@@ -2402,9 +2402,9 @@ bool SpellMgr::IsSpellValid(SpellEntry const *spellInfo, Player *pl, bool msg)
// skip auto-loot crafting spells, its not need explicit item info (but have special fake items sometime)
if (!IsLootCraftingSpell(spellInfo))
{
- if(msg)
+ if (msg)
{
- if(pl)
+ if (pl)
ChatHandler(pl).PSendSysMessage("Craft spell %u not have create item entry.",spellInfo->Id);
else
sLog.outErrorDb("Craft spell %u not have create item entry.",spellInfo->Id);
@@ -2448,7 +2448,7 @@ bool SpellMgr::IsSpellValid(SpellEntry const *spellInfo, Player *pl, bool msg)
}
}
- if(need_check_reagents)
+ if (need_check_reagents)
{
for (uint8 j = 0; j < 8; ++j)
{
@@ -2515,7 +2515,7 @@ void SpellMgr::LoadSpellAreas()
if (const SpellEntry* spellInfo = sSpellStore.LookupEntry(spell))
{
- if(spellArea.autocast)
+ if (spellArea.autocast)
const_cast<SpellEntry*>(spellInfo)->Attributes |= SPELL_ATTR_CANT_CANCEL;
}
else
@@ -2547,7 +2547,7 @@ void SpellMgr::LoadSpellAreas()
break;
}
- if(!ok)
+ if (!ok)
{
sLog.outErrorDb("Spell %u listed in `spell_area` already listed with similar requirements.", spell);
continue;
@@ -2721,7 +2721,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
{
for (SpellAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
- if(itr->second.IsFitToRequirements(player,zone_id,area_id))
+ if (itr->second.IsFitToRequirements(player,zone_id,area_id))
return SPELL_CAST_OK;
}
return SPELL_FAILED_INCORRECT_AREA;
@@ -2968,7 +2968,7 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto
int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry const* spellproto)
{
- if(!IsDiminishingReturnsGroupDurationLimited(group))
+ if (!IsDiminishingReturnsGroupDurationLimited(group))
return 0;
// Explicit diminishing duration
@@ -3132,12 +3132,12 @@ bool SpellMgr::CanAurasStack(SpellEntry const *spellInfo_1, SpellEntry const *sp
return false;
}
- if(spellInfo_1->SpellFamilyName != spellInfo_2->SpellFamilyName)
+ if (spellInfo_1->SpellFamilyName != spellInfo_2->SpellFamilyName)
return true;
- if(!sameCaster)
+ if (!sameCaster)
{
- if(spellInfo_1->AttributesEx & SPELL_ATTR_EX_STACK_FOR_DIFF_CASTERS
+ if (spellInfo_1->AttributesEx & SPELL_ATTR_EX_STACK_FOR_DIFF_CASTERS
|| spellInfo_1->AttributesEx3 & SPELL_ATTR_EX3_STACK_FOR_DIFF_CASTERS)
return true;
@@ -3171,23 +3171,23 @@ bool SpellMgr::CanAurasStack(SpellEntry const *spellInfo_1, SpellEntry const *sp
if (spellId_1 == spellId_2)
{
// Hack for Incanter's Absorption
- if(spellId_1 == 44413)
+ if (spellId_1 == 44413)
return true;
// same spell with same caster should not stack
return false;
}
// use icon to check generic spells
- if(!spellInfo_1->SpellFamilyName)
+ if (!spellInfo_1->SpellFamilyName)
{
- if(!spellInfo_1->SpellIconID || spellInfo_1->SpellIconID == 1
+ if (!spellInfo_1->SpellIconID || spellInfo_1->SpellIconID == 1
|| spellInfo_1->SpellIconID != spellInfo_2->SpellIconID)
return true;
}
// use familyflag to check class spells
else
{
- if(!spellInfo_1->SpellFamilyFlags
+ if (!spellInfo_1->SpellFamilyFlags
|| spellInfo_1->SpellFamilyFlags != spellInfo_2->SpellFamilyFlags)
return true;
}
@@ -3198,7 +3198,7 @@ bool SpellMgr::CanAurasStack(SpellEntry const *spellInfo_1, SpellEntry const *sp
//if spells do not have the same effect or aura or miscvalue, they will stack
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if(spellInfo_1->Effect[i] != spellInfo_2->Effect[i]
+ if (spellInfo_1->Effect[i] != spellInfo_2->Effect[i]
|| spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i]
|| spellInfo_1->EffectMiscValue[i] != spellInfo_2->EffectMiscValue[i]) // paladin resist aura
return true; // need itemtype check? need an example to add that check
@@ -3217,7 +3217,7 @@ bool IsDispelableBySpell(SpellEntry const * dispelSpell, uint32 spellId, bool de
if (spellproto->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE)
return false;
- if(dispelSpell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY)
+ if (dispelSpell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY)
return true;
return def;
@@ -3483,7 +3483,7 @@ void SpellMgr::LoadSpellCustomAttr()
case SPELL_EFFECT_JUMP:
case SPELL_EFFECT_JUMP2:
case SPELL_EFFECT_LEAP_BACK:
- if(!spellInfo->speed && !spellInfo->SpellFamilyName)
+ if (!spellInfo->speed && !spellInfo->SpellFamilyName)
spellInfo->speed = SPEED_CHARGE;
mSpellCustomAttr[i] |= SPELL_ATTR_CU_CHARGE;
count++;
@@ -3815,7 +3815,7 @@ void SpellMgr::LoadSpellCustomAttr()
{
case SPELLFAMILY_WARRIOR:
// Shout
- if(spellInfo->SpellFamilyFlags[0] & 0x20000 || spellInfo->SpellFamilyFlags[1] & 0x20)
+ if (spellInfo->SpellFamilyFlags[0] & 0x20000 || spellInfo->SpellFamilyFlags[1] & 0x20)
mSpellCustomAttr[i] |= SPELL_ATTR_CU_AURA_CC;
else
break;
@@ -3823,13 +3823,13 @@ void SpellMgr::LoadSpellCustomAttr()
break;
case SPELLFAMILY_DRUID:
// Starfall Target Selection
- if(spellInfo->SpellFamilyFlags[2] & 0x100)
+ if (spellInfo->SpellFamilyFlags[2] & 0x100)
spellInfo->MaxAffectedTargets = 2;
// Starfall AOE Damage
- else if(spellInfo->SpellFamilyFlags[2] & 0x800000)
+ else if (spellInfo->SpellFamilyFlags[2] & 0x800000)
mSpellCustomAttr[i] |= SPELL_ATTR_CU_EXCLUDE_SELF;
// Roar
- else if(spellInfo->SpellFamilyFlags[0] & 0x8)
+ else if (spellInfo->SpellFamilyFlags[0] & 0x8)
mSpellCustomAttr[i] |= SPELL_ATTR_CU_AURA_CC;
else
break;
@@ -3837,7 +3837,7 @@ void SpellMgr::LoadSpellCustomAttr()
break;
// Do not allow Deadly throw and Slice and Dice to proc twice
case SPELLFAMILY_ROGUE:
- if(spellInfo->SpellFamilyFlags[1] & 0x1 || spellInfo->SpellFamilyFlags[0] & 0x40000)
+ if (spellInfo->SpellFamilyFlags[1] & 0x1 || spellInfo->SpellFamilyFlags[0] & 0x40000)
spellInfo->AttributesEx4 |= SPELL_ATTR_EX4_CANT_PROC_FROM_SELFCAST;
else
break;
@@ -3875,7 +3875,7 @@ void SpellMgr::LoadEnchantCustomAttr()
bar.step();
SpellEntry * spellInfo = (SpellEntry*)GetSpellStore()->LookupEntry(i);
- if(!spellInfo)
+ if (!spellInfo)
continue;
// TODO: find a better check
@@ -3884,7 +3884,7 @@ void SpellMgr::LoadEnchantCustomAttr()
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
- if(spellInfo->Effect[j] == SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY)
+ if (spellInfo->Effect[j] == SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY)
{
uint32 enchId = spellInfo->EffectMiscValue[j];
SpellItemEnchantmentEntry const *ench = sSpellItemEnchantmentStore.LookupEntry(enchId);
@@ -3953,7 +3953,7 @@ void SpellMgr::LoadSpellLinked()
continue;
}
- if(trigger > 0)
+ if (trigger > 0)
{
switch(type)
{
@@ -3967,9 +3967,9 @@ void SpellMgr::LoadSpellLinked()
mSpellCustomAttr[-trigger] |= SPELL_ATTR_CU_LINK_REMOVE;
}
- if(type) //we will find a better way when more types are needed
+ if (type) //we will find a better way when more types are needed
{
- if(trigger > 0)
+ if (trigger > 0)
trigger += SPELL_LINKED_MAX_SPELLS * type;
else
trigger -= SPELL_LINKED_MAX_SPELLS * type;
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index c952ef0763b..56108fd289b 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -221,14 +221,14 @@ inline float GetSpellMinRange(SpellEntry const *spellInfo, bool positive)
inline float GetSpellMinRange(uint32 id, bool positive)
{
SpellEntry const *spellInfo = GetSpellStore()->LookupEntry(id);
- if(!spellInfo) return 0;
+ if (!spellInfo) return 0;
return GetSpellMinRange(spellInfo, positive);
}
inline float GetSpellMaxRange(uint32 id, bool positive)
{
SpellEntry const *spellInfo = GetSpellStore()->LookupEntry(id);
- if(!spellInfo) return 0;
+ if (!spellInfo) return 0;
return GetSpellMaxRange(spellInfo, positive);
}
@@ -248,7 +248,7 @@ inline float GetSpellMaxRange(uint32 id, bool positive)
inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect)
{
for (int i= 0; i < 3; ++i)
- if(SpellEffects(spellInfo->Effect[i])==effect)
+ if (SpellEffects(spellInfo->Effect[i])==effect)
return true;
return false;
}
@@ -256,7 +256,7 @@ inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect)
inline bool IsSpellHaveAura(SpellEntry const *spellInfo, AuraType aura)
{
for (int i= 0; i < 3; ++i)
- if(AuraType(spellInfo->EffectApplyAuraName[i])==aura)
+ if (AuraType(spellInfo->EffectApplyAuraName[i])==aura)
return true;
return false;
}
@@ -304,7 +304,7 @@ uint32 CalculatePowerCost(SpellEntry const * spellInfo, Unit const * caster, Spe
inline bool IsPassiveSpellStackableWithRanks(SpellEntry const* spellProto)
{
- if(!IsPassiveSpell(spellProto->Id))
+ if (!IsPassiveSpell(spellProto->Id))
return false;
return !IsSpellHaveEffect(spellProto,SPELL_EFFECT_APPLY_AURA);
@@ -366,14 +366,14 @@ inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo)
for (int i = 0; i < 3; ++i)
{
uint32 targetA = spellInfo->EffectImplicitTargetA[i];
- if(targetA && !IsCasterSourceTarget(targetA))
+ if (targetA && !IsCasterSourceTarget(targetA))
return false;
uint32 targetB = spellInfo->EffectImplicitTargetB[i];
- if(targetB && !IsCasterSourceTarget(targetB))
+ if (targetB && !IsCasterSourceTarget(targetB))
return false;
- if(!targetA && !targetB)
+ if (!targetA && !targetB)
return false;
}
return true;
@@ -381,18 +381,18 @@ inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo)
inline bool IsAreaOfEffectSpell(SpellEntry const *spellInfo)
{
- if(IsAreaEffectTarget[spellInfo->EffectImplicitTargetA[0]] || IsAreaEffectTarget[spellInfo->EffectImplicitTargetB[0]])
+ if (IsAreaEffectTarget[spellInfo->EffectImplicitTargetA[0]] || IsAreaEffectTarget[spellInfo->EffectImplicitTargetB[0]])
return true;
- if(IsAreaEffectTarget[spellInfo->EffectImplicitTargetA[1]] || IsAreaEffectTarget[spellInfo->EffectImplicitTargetB[1]])
+ if (IsAreaEffectTarget[spellInfo->EffectImplicitTargetA[1]] || IsAreaEffectTarget[spellInfo->EffectImplicitTargetB[1]])
return true;
- if(IsAreaEffectTarget[spellInfo->EffectImplicitTargetA[2]] || IsAreaEffectTarget[spellInfo->EffectImplicitTargetB[2]])
+ if (IsAreaEffectTarget[spellInfo->EffectImplicitTargetA[2]] || IsAreaEffectTarget[spellInfo->EffectImplicitTargetB[2]])
return true;
return false;
}
inline bool IsAreaAuraEffect(uint32 effect)
{
- if( effect == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
+ if ( effect == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
effect == SPELL_EFFECT_APPLY_AREA_AURA_RAID ||
effect == SPELL_EFFECT_APPLY_AREA_AURA_FRIEND ||
effect == SPELL_EFFECT_APPLY_AREA_AURA_ENEMY ||
@@ -712,10 +712,10 @@ class PetAura
uint32 GetAura(uint32 petEntry) const
{
std::map<uint32, uint32>::const_iterator itr = auras.find(petEntry);
- if(itr != auras.end())
+ if (itr != auras.end())
return itr->second;
std::map<uint32, uint32>::const_iterator itr2 = auras.find(0);
- if(itr2 != auras.end())
+ if (itr2 != auras.end())
return itr2->second;
return 0;
}
@@ -824,10 +824,10 @@ typedef std::map<int32, PetDefaultSpellsEntry> PetDefaultSpellsMap;
inline bool IsPrimaryProfessionSkill(uint32 skill)
{
SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(skill);
- if(!pSkill)
+ if (!pSkill)
return false;
- if(pSkill->categoryId != SKILL_CATEGORY_PROFESSION)
+ if (pSkill->categoryId != SKILL_CATEGORY_PROFESSION)
return false;
return true;
@@ -971,7 +971,7 @@ class SpellMgr
uint16 GetSpellThreat(uint32 spellid) const
{
SpellThreatMap::const_iterator itr = mSpellThreatMap.find(spellid);
- if(itr==mSpellThreatMap.end())
+ if (itr==mSpellThreatMap.end())
return 0;
return itr->second;
@@ -981,7 +981,7 @@ class SpellMgr
SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const
{
SpellProcEventMap::const_iterator itr = mSpellProcEventMap.find(spellId);
- if( itr != mSpellProcEventMap.end( ) )
+ if ( itr != mSpellProcEventMap.end( ) )
return &itr->second;
return NULL;
}
@@ -991,7 +991,7 @@ class SpellMgr
SpellEnchantProcEntry const* GetSpellEnchantProcEvent(uint32 enchId) const
{
SpellEnchantProcEventMap::const_iterator itr = mSpellEnchantProcEventMap.find(enchId);
- if( itr != mSpellEnchantProcEventMap.end( ) )
+ if ( itr != mSpellEnchantProcEventMap.end( ) )
return &itr->second;
return NULL;
}
@@ -1001,13 +1001,13 @@ class SpellMgr
{
// Lookup data
SpellBonusMap::const_iterator itr = mSpellBonusMap.find(spellId);
- if( itr != mSpellBonusMap.end( ) )
+ if ( itr != mSpellBonusMap.end( ) )
return &itr->second;
// Not found, try lookup for 1 spell rank if exist
if (uint32 rank_1 = GetFirstSpellInChain(spellId))
{
SpellBonusMap::const_iterator itr2 = mSpellBonusMap.find(rank_1);
- if( itr2 != mSpellBonusMap.end( ) )
+ if ( itr2 != mSpellBonusMap.end( ) )
return &itr2->second;
}
return NULL;
@@ -1017,7 +1017,7 @@ class SpellMgr
SpellTargetPosition const* GetSpellTargetPosition(uint32 spell_id) const
{
SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find( spell_id );
- if( itr != mSpellTargetPositions.end( ) )
+ if ( itr != mSpellTargetPositions.end( ) )
return &itr->second;
return NULL;
}
@@ -1026,7 +1026,7 @@ class SpellMgr
SpellChainNode const* GetSpellChainNode(uint32 spell_id) const
{
SpellChainMap::const_iterator itr = mSpellChains.find(spell_id);
- if(itr == mSpellChains.end())
+ if (itr == mSpellChains.end())
return NULL;
return &itr->second;
@@ -1034,7 +1034,7 @@ class SpellMgr
uint32 GetFirstSpellInChain(uint32 spell_id) const
{
- if(SpellChainNode const* node = GetSpellChainNode(spell_id))
+ if (SpellChainNode const* node = GetSpellChainNode(spell_id))
return node->first;
return spell_id;
@@ -1042,7 +1042,7 @@ class SpellMgr
uint32 GetSpellWithRank(uint32 spell_id, uint32 rank) const
{
- if(SpellChainNode const* node = GetSpellChainNode(spell_id))
+ if (SpellChainNode const* node = GetSpellChainNode(spell_id))
{
if (rank != node->rank)
return GetSpellWithRank(node->rank < rank ? node->next : node->prev, rank);
@@ -1052,7 +1052,7 @@ class SpellMgr
uint32 GetPrevSpellInChain(uint32 spell_id) const
{
- if(SpellChainNode const* node = GetSpellChainNode(spell_id))
+ if (SpellChainNode const* node = GetSpellChainNode(spell_id))
return node->prev;
return 0;
@@ -1060,7 +1060,7 @@ class SpellMgr
uint32 GetNextSpellInChain(uint32 spell_id) const
{
- if(SpellChainNode const* node = GetSpellChainNode(spell_id))
+ if (SpellChainNode const* node = GetSpellChainNode(spell_id))
return node->next;
return 0;
@@ -1088,7 +1088,7 @@ class SpellMgr
uint8 GetSpellRank(uint32 spell_id) const
{
- if(SpellChainNode const* node = GetSpellChainNode(spell_id))
+ if (SpellChainNode const* node = GetSpellChainNode(spell_id))
return node->rank;
return 0;
@@ -1096,7 +1096,7 @@ class SpellMgr
uint32 GetLastSpellInChain(uint32 spell_id) const
{
- if(SpellChainNode const* node = GetSpellChainNode(spell_id))
+ if (SpellChainNode const* node = GetSpellChainNode(spell_id))
return node->last;
return spell_id;
@@ -1130,7 +1130,7 @@ class SpellMgr
SpellLearnSkillNode const* GetSpellLearnSkill(uint32 spell_id) const
{
SpellLearnSkillMap::const_iterator itr = mSpellLearnSkills.find(spell_id);
- if(itr != mSpellLearnSkills.end())
+ if (itr != mSpellLearnSkills.end())
return &itr->second;
else
return NULL;
@@ -1180,7 +1180,7 @@ class SpellMgr
PetAura const* GetPetAura(uint32 spell_id, uint8 eff)
{
SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find((spell_id<<8) + eff);
- if(itr != mSpellPetAuraMap.end())
+ if (itr != mSpellPetAuraMap.end())
return &itr->second;
else
return NULL;
@@ -1189,7 +1189,7 @@ class SpellMgr
PetLevelupSpellSet const* GetPetLevelupSpellList(uint32 petFamily) const
{
PetLevelupSpellMap::const_iterator itr = mPetLevelupSpellMap.find(petFamily);
- if(itr != mPetLevelupSpellMap.end())
+ if (itr != mPetLevelupSpellMap.end())
return &itr->second;
else
return NULL;
@@ -1197,7 +1197,7 @@ class SpellMgr
uint32 GetSpellCustomAttr(uint32 spell_id) const
{
- if(spell_id >= mSpellCustomAttr.size())
+ if (spell_id >= mSpellCustomAttr.size())
return 0;
else
return mSpellCustomAttr[spell_id];
@@ -1213,7 +1213,7 @@ class SpellMgr
PetDefaultSpellsEntry const* GetPetDefaultSpellsEntry(int32 id) const
{
PetDefaultSpellsMap::const_iterator itr = mPetDefaultSpellsMap.find(id);
- if(itr != mPetDefaultSpellsMap.end())
+ if (itr != mPetDefaultSpellsMap.end())
return &itr->second;
return NULL;
}
@@ -1227,7 +1227,7 @@ class SpellMgr
SpellAreaForQuestMapBounds GetSpellAreaForQuestMapBounds(uint32 quest_id, bool active) const
{
- if(active)
+ if (active)
return SpellAreaForQuestMapBounds(mSpellAreaForActiveQuestMap.lower_bound(quest_id),mSpellAreaForActiveQuestMap.upper_bound(quest_id));
else
return SpellAreaForQuestMapBounds(mSpellAreaForQuestMap.lower_bound(quest_id),mSpellAreaForQuestMap.upper_bound(quest_id));
@@ -1266,8 +1266,8 @@ class SpellMgr
inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo)
{
for (int i = 0; i < 3; ++i)
- if(uint32 target = spellInfo->EffectImplicitTargetA[i])
- if(!IsCasterSourceTarget(target))
+ if (uint32 target = spellInfo->EffectImplicitTargetA[i])
+ if (!IsCasterSourceTarget(target))
return false;
return true;
}
@@ -1281,7 +1281,7 @@ class SpellMgr
{
SpellRequiredMap::const_iterator itr = mSpellReq.find(spell_id);
- if(itr == mSpellReq.end())
+ if (itr == mSpellReq.end())
return NULL;
return itr->second;
diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp
index 1b7e2369aeb..ab45859c722 100644
--- a/src/game/StatSystem.cpp
+++ b/src/game/StatSystem.cpp
@@ -34,7 +34,7 @@
bool Player::UpdateStats(Stats stat)
{
- if(stat > STAT_SPIRIT)
+ if (stat > STAT_SPIRIT)
return false;
// value = ((base_value * base_pct) + total_value) * total_pct
@@ -45,7 +45,7 @@ bool Player::UpdateStats(Stats stat)
if (stat == STAT_STAMINA || stat == STAT_INTELLECT || stat == STAT_STRENGTH)
{
Pet *pet = GetPet();
- if(pet)
+ if (pet)
pet->UpdateStats(stat);
}
@@ -166,13 +166,13 @@ bool Player::UpdateAllStats()
void Player::UpdateResistances(uint32 school)
{
- if(school > SPELL_SCHOOL_NORMAL)
+ if (school > SPELL_SCHOOL_NORMAL)
{
float value = GetTotalAuraModValue(UnitMods(UNIT_MOD_RESISTANCE_START + school));
SetResistance(SpellSchools(school), int32(value));
Pet *pet = GetPet();
- if(pet)
+ if (pet)
pet->UpdateResistances(school);
}
else
@@ -193,7 +193,7 @@ void Player::UpdateArmor()
AuraEffectList const& mResbyIntellect = GetAuraEffectsByType(SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT);
for (AuraEffectList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
{
- if((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
+ if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
value += int32(GetStat(Stats((*i)->GetMiscValueB())) * (*i)->GetAmount() / 100.0f);
}
@@ -202,7 +202,7 @@ void Player::UpdateArmor()
SetArmor(int32(value));
Pet *pet = GetPet();
- if(pet)
+ if (pet)
pet->UpdateArmor();
UpdateAttackPowerAndDamage(); // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
@@ -271,7 +271,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged )
uint16 index_mod = UNIT_FIELD_ATTACK_POWER_MODS;
uint16 index_mult = UNIT_FIELD_ATTACK_POWER_MULTIPLIER;
- if(ranged)
+ if (ranged)
{
index = UNIT_FIELD_RANGED_ATTACK_POWER;
index_mod = UNIT_FIELD_RANGED_ATTACK_POWER_MODS;
@@ -358,7 +358,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged )
float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE);
//add dynamic flat mods
- if( ranged )
+ if ( ranged )
{
if ((getClassMask() & CLASSMASK_WAND_USERS)==0)
{
@@ -387,21 +387,21 @@ void Player::UpdateAttackPowerAndDamage(bool ranged )
Pet *pet = GetPet(); //update pet's AP
//automatically update weapon damage after attack power modification
- if(ranged)
+ if (ranged)
{
UpdateDamagePhysical(RANGED_ATTACK);
- if(pet && pet->isHunterPet()) // At ranged attack change for hunter pet
+ if (pet && pet->isHunterPet()) // At ranged attack change for hunter pet
pet->UpdateAttackPowerAndDamage();
}
else
{
UpdateDamagePhysical(BASE_ATTACK);
- if(CanDualWield() && haveOffhandWeapon()) //allow update offhand damage only if player knows DualWield Spec and has equipped offhand weapon
+ if (CanDualWield() && haveOffhandWeapon()) //allow update offhand damage only if player knows DualWield Spec and has equipped offhand weapon
UpdateDamagePhysical(OFF_ATTACK);
- if(getClass() == CLASS_SHAMAN || getClass() == CLASS_PALADIN) // mental quickness
+ if (getClass() == CLASS_SHAMAN || getClass() == CLASS_PALADIN) // mental quickness
UpdateSpellDamageAndHealingBonus();
- if(pet && pet->IsPetGhoul()) // At ranged attack change for hunter pet
+ if (pet && pet->IsPetGhoul()) // At ranged attack change for hunter pet
pet->UpdateAttackPowerAndDamage();
}
}
@@ -452,7 +452,7 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bo
weapon_mindamage = lvl*0.85f*att_speed;
weapon_maxdamage = lvl*1.25f*att_speed;
}
- else if(!CanUseAttackType(attType)) //check if player not in form but still can't use (disarm case)
+ else if (!CanUseAttackType(attType)) //check if player not in form but still can't use (disarm case)
{
//cannot use ranged/off attack, set values to 0
if (attType != BASE_ATTACK)
@@ -464,7 +464,7 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bo
weapon_mindamage = BASE_MINDAMAGE;
weapon_maxdamage = BASE_MAXDAMAGE;
}
- else if(attType == RANGED_ATTACK) //add ammo DPS to ranged damage
+ else if (attType == RANGED_ATTACK) //add ammo DPS to ranged damage
{
weapon_mindamage += GetAmmoDPS() * att_speed;
weapon_maxdamage += GetAmmoDPS() * att_speed;
@@ -510,7 +510,7 @@ void Player::UpdateBlockPercentage()
{
// No block
float value = 0.0f;
- if(CanBlock())
+ if (CanBlock())
{
// Base value
value = 5.0f;
@@ -607,7 +607,7 @@ void Player::UpdateDodgePercentage()
void Player::UpdateSpellCritChance(uint32 school)
{
// For normal school set zero crit chance
- if(school == SPELL_SCHOOL_NORMAL)
+ if (school == SPELL_SCHOOL_NORMAL)
{
SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1, 0.0f);
return;
@@ -661,7 +661,7 @@ void Player::UpdateAllSpellCritChances()
void Player::UpdateExpertise(WeaponAttackType attack)
{
- if(attack==RANGED_ATTACK)
+ if (attack==RANGED_ATTACK)
return;
int32 expertise = int32(GetRatingBonusValue(CR_EXPERTISE));
@@ -672,14 +672,14 @@ void Player::UpdateExpertise(WeaponAttackType attack)
for (AuraEffectList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr)
{
// item neutral spell
- if((*itr)->GetSpellProto()->EquippedItemClass == -1)
+ if ((*itr)->GetSpellProto()->EquippedItemClass == -1)
expertise += (*itr)->GetAmount();
// item dependent spell
- else if(weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto()))
+ else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto()))
expertise += (*itr)->GetAmount();
}
- if(expertise < 0)
+ if (expertise < 0)
expertise = 0;
switch(attack)
@@ -780,7 +780,7 @@ bool Creature::UpdateAllStats()
void Creature::UpdateResistances(uint32 school)
{
- if(school > SPELL_SCHOOL_NORMAL)
+ if (school > SPELL_SCHOOL_NORMAL)
{
float value = GetTotalAuraModValue(UnitMods(UNIT_MOD_RESISTANCE_START + school));
SetResistance(SpellSchools(school), int32(value));
@@ -817,7 +817,7 @@ void Creature::UpdateAttackPowerAndDamage(bool ranged)
uint16 index_mod = UNIT_FIELD_ATTACK_POWER_MODS;
uint16 index_mult = UNIT_FIELD_ATTACK_POWER_MULTIPLIER;
- if(ranged)
+ if (ranged)
{
index = UNIT_FIELD_RANGED_ATTACK_POWER;
index_mod = UNIT_FIELD_RANGED_ATTACK_POWER_MODS;
@@ -833,7 +833,7 @@ void Creature::UpdateAttackPowerAndDamage(bool ranged)
SetFloatValue(index_mult, attPowerMultiplier); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field
//automatically update weapon damage after attack power modification
- if(ranged)
+ if (ranged)
UpdateDamagePhysical(RANGED_ATTACK);
else
{
@@ -872,7 +872,7 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType)
float total_pct = GetModifierValue(unitMod, TOTAL_PCT);
float dmg_multiplier = GetCreatureInfo()->dmg_multiplier;
- if(!CanUseAttackType(attType))
+ if (!CanUseAttackType(attType))
{
weapon_mindamage = 0;
weapon_maxdamage = 0;
@@ -1017,12 +1017,12 @@ bool Guardian::UpdateAllStats()
void Guardian::UpdateResistances(uint32 school)
{
- if(school > SPELL_SCHOOL_NORMAL)
+ if (school > SPELL_SCHOOL_NORMAL)
{
float value = GetTotalAuraModValue(UnitMods(UNIT_MOD_RESISTANCE_START + school));
// hunter and warlock pets gain 40% of owner's resistance
- if(isPet())
+ if (isPet())
value += float(m_owner->GetResistance(SpellSchools(school))) * 0.4f;
SetResistance(SpellSchools(school), int32(value));
@@ -1038,7 +1038,7 @@ void Guardian::UpdateArmor()
UnitMods unitMod = UNIT_MOD_ARMOR;
// hunter and warlock pets gain 35% of owner's armor value
- if(isPet())
+ if (isPet())
bonus_armor = 0.35f * float(m_owner->GetArmor());
value = GetModifierValue(unitMod, BASE_VALUE);
@@ -1102,22 +1102,22 @@ void Guardian::UpdateMaxPower(Powers power)
void Guardian::UpdateAttackPowerAndDamage(bool ranged)
{
- if(ranged)
+ if (ranged)
return;
float val = 0.0f;
float bonusAP = 0.0f;
UnitMods unitMod = UNIT_MOD_ATTACK_POWER;
- if(GetEntry() == ENTRY_IMP) // imp's attack power
+ if (GetEntry() == ENTRY_IMP) // imp's attack power
val = GetStat(STAT_STRENGTH) - 10.0f;
else
val = 2 * GetStat(STAT_STRENGTH) - 20.0f;
Unit* owner = GetOwner();
- if( owner && owner->GetTypeId() == TYPEID_PLAYER)
+ if ( owner && owner->GetTypeId() == TYPEID_PLAYER)
{
- if(isHunterPet()) //hunter pets benefit from owner's attack power
+ if (isHunterPet()) //hunter pets benefit from owner's attack power
{
float mod = 1.0f; //Hunter contribution modifier
if (this->ToCreature()->isPet())
@@ -1143,21 +1143,21 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
SetBonusDamage( int32(owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.1287f));
}
//demons benefit from warlocks shadow or fire damage
- else if(isPet())
+ else if (isPet())
{
int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
int32 maximum = (fire > shadow) ? fire : shadow;
- if(maximum < 0)
+ if (maximum < 0)
maximum = 0;
SetBonusDamage( int32(maximum * 0.15f));
bonusAP = maximum * 0.57f;
}
//water elementals benefit from mage's frost damage
- else if(GetEntry() == ENTRY_WATER_ELEMENTAL)
+ else if (GetEntry() == ENTRY_WATER_ELEMENTAL)
{
int32 frost = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FROST);
- if(frost < 0)
+ if (frost < 0)
frost = 0;
SetBonusDamage( int32(frost * 0.4f));
}
@@ -1183,24 +1183,24 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
{
- if(attType > BASE_ATTACK)
+ if (attType > BASE_ATTACK)
return;
float bonusDamage = 0.0f;
- if(m_owner->GetTypeId() == TYPEID_PLAYER)
+ if (m_owner->GetTypeId() == TYPEID_PLAYER)
{
//force of nature
- if(GetEntry() == ENTRY_TREANT)
+ if (GetEntry() == ENTRY_TREANT)
{
int32 spellDmg = int32(m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_NATURE)) - m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_NATURE);
- if(spellDmg > 0)
+ if (spellDmg > 0)
bonusDamage = spellDmg * 0.09f;
}
//greater fire elemental
- else if(GetEntry() == ENTRY_FIRE_ELEMENTAL)
+ else if (GetEntry() == ENTRY_FIRE_ELEMENTAL)
{
int32 spellDmg = int32(m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
- if(spellDmg > 0)
+ if (spellDmg > 0)
bonusDamage = spellDmg * 0.4f;
}
}
diff --git a/src/game/TargetedMovementGenerator.cpp b/src/game/TargetedMovementGenerator.cpp
index d5c4ed8b6b9..29325fe294f 100644
--- a/src/game/TargetedMovementGenerator.cpp
+++ b/src/game/TargetedMovementGenerator.cpp
@@ -57,47 +57,47 @@ TargetedMovementGenerator<T>::_setTargetLocation(T &owner)
if (!i_target.isValid() || !i_target->IsInWorld())
return false;
- if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) )
+ if ( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) )
return false;
float x, y, z;
Traveller<T> traveller(owner);
- if(i_destinationHolder.HasDestination())
+ if (i_destinationHolder.HasDestination())
{
- if(i_destinationHolder.HasArrived())
+ if (i_destinationHolder.HasArrived())
{
// prevent redundant micro-movement
- if(!i_offset)
+ if (!i_offset)
{
- if(i_target->IsWithinMeleeRange(&owner))
+ if (i_target->IsWithinMeleeRange(&owner))
return false;
}
- else if(!i_angle && !owner.hasUnitState(UNIT_STAT_FOLLOW))
+ else if (!i_angle && !owner.hasUnitState(UNIT_STAT_FOLLOW))
{
- if(i_target->IsWithinDistInMap(&owner, i_offset))
+ if (i_target->IsWithinDistInMap(&owner, i_offset))
return false;
}
else
{
- if(i_target->IsWithinDistInMap(&owner, i_offset + 1.0f))
+ if (i_target->IsWithinDistInMap(&owner, i_offset + 1.0f))
return false;
}
}
else
{
bool stop = false;
- if(!i_offset)
+ if (!i_offset)
{
- if(i_target->IsWithinMeleeRange(&owner, 0))
+ if (i_target->IsWithinMeleeRange(&owner, 0))
stop = true;
}
- else if(!i_angle && !owner.hasUnitState(UNIT_STAT_FOLLOW))
+ else if (!i_angle && !owner.hasUnitState(UNIT_STAT_FOLLOW))
{
- if(i_target->IsWithinDist(&owner, i_offset * 0.8f))
+ if (i_target->IsWithinDist(&owner, i_offset * 0.8f))
stop = true;
}
- if(stop)
+ if (stop)
{
owner.GetPosition(x, y, z);
i_destinationHolder.SetDestination(traveller, x, y, z);
@@ -107,16 +107,16 @@ TargetedMovementGenerator<T>::_setTargetLocation(T &owner)
}
}
- if(i_target->GetExactDistSq(i_targetX, i_targetY, i_targetZ) < 0.01f)
+ if (i_target->GetExactDistSq(i_targetX, i_targetY, i_targetZ) < 0.01f)
return false;
}
- if(!i_offset)
+ if (!i_offset)
{
// to nearest random contact position
i_target->GetRandomContactPoint( &owner, x, y, z, 0, MELEE_RANGE - 0.5f );
}
- else if(!i_angle && !owner.hasUnitState(UNIT_STAT_FOLLOW))
+ else if (!i_angle && !owner.hasUnitState(UNIT_STAT_FOLLOW))
{
// caster chase
i_target->GetContactPoint(&owner, x, y, z, i_offset * urand(80, 95) * 0.01f);
@@ -140,7 +140,7 @@ TargetedMovementGenerator<T>::_setTargetLocation(T &owner)
//We don't update Mob Movement, if the difference between New destination and last destination is < BothObjectSize
float bothObjectSize = i_target->GetObjectSize() + owner.GetObjectSize() + CONTACT_DISTANCE;
- if( i_destinationHolder.HasDestination() && i_destinationHolder.GetDestinationDiff(x,y,z) < bothObjectSize )
+ if ( i_destinationHolder.HasDestination() && i_destinationHolder.GetDestinationDiff(x,y,z) < bothObjectSize )
return;
*/
i_destinationHolder.SetDestination(traveller, x, y, z);
@@ -219,7 +219,7 @@ TargetedMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
if (i_targetX != i_target->GetPositionX() || i_targetY != i_target->GetPositionY()
|| i_targetZ != i_target->GetPositionZ())
{
- if(_setTargetLocation(owner) || !owner.hasUnitState(UNIT_STAT_FOLLOW))
+ if (_setTargetLocation(owner) || !owner.hasUnitState(UNIT_STAT_FOLLOW))
owner.SetInFront(i_target.getTarget());
i_target->GetPosition(i_targetX, i_targetY, i_targetZ);
}
@@ -231,7 +231,7 @@ TargetedMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
owner.SetInFront(i_target.getTarget());
owner.StopMoving();
- if(owner.IsWithinMeleeRange(i_target.getTarget()) && !owner.hasUnitState(UNIT_STAT_FOLLOW))
+ if (owner.IsWithinMeleeRange(i_target.getTarget()) && !owner.hasUnitState(UNIT_STAT_FOLLOW))
owner.Attack(i_target.getTarget(),true);
}
}
diff --git a/src/game/TargetedMovementGenerator.h b/src/game/TargetedMovementGenerator.h
index c3992697ce4..d4204d23efa 100644
--- a/src/game/TargetedMovementGenerator.h
+++ b/src/game/TargetedMovementGenerator.h
@@ -55,7 +55,7 @@ class TargetedMovementGenerator
bool GetDestination(float &x, float &y, float &z) const
{
- if(i_destinationHolder.HasArrived() || !i_destinationHolder.HasDestination()) return false;
+ if (i_destinationHolder.HasArrived() || !i_destinationHolder.HasDestination()) return false;
i_destinationHolder.GetDestination(x,y,z);
return true;
}
diff --git a/src/game/TaxiHandler.cpp b/src/game/TaxiHandler.cpp
index 9c395f78528..1effa944cda 100644
--- a/src/game/TaxiHandler.cpp
+++ b/src/game/TaxiHandler.cpp
@@ -54,7 +54,7 @@ void WorldSession::SendTaxiStatus( uint64 guid )
uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer( )->GetTeam());
// not found nearest
- if(curloc == 0)
+ if (curloc == 0)
return;
sLog.outDebug( "WORLD: current location %u ",curloc);
@@ -82,11 +82,11 @@ void WorldSession::HandleTaxiQueryAvailableNodes( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// unknown taxi node case
- if( SendLearnNewTaxiNode(unit) )
+ if ( SendLearnNewTaxiNode(unit) )
return;
// known taxi node case
@@ -102,7 +102,7 @@ void WorldSession::SendTaxiMenu( Creature* unit )
return;
bool lastTaxiCheaterState = GetPlayer()->isTaxiCheater();
- if(unit->GetEntry() == 29480) GetPlayer()->SetTaxiCheater(true); // Grimwing in Ebon Hold, special case. NOTE: Not perfect, Zul'Aman should not be included according to WoWhead, and I think taxicheat includes it.
+ if (unit->GetEntry() == 29480) GetPlayer()->SetTaxiCheater(true); // Grimwing in Ebon Hold, special case. NOTE: Not perfect, Zul'Aman should not be included according to WoWhead, and I think taxicheat includes it.
sLog.outDebug( "WORLD: CMSG_TAXINODE_STATUS_QUERY %u ",curloc);
@@ -141,7 +141,7 @@ bool WorldSession::SendLearnNewTaxiNode( Creature* unit )
if ( curloc == 0 )
return true; // `true` send to avoid WorldSession::SendTaxiMenu call with one more curlock seartch with same false result.
- if( GetPlayer()->m_taxi.SetTaximaskNode(curloc) )
+ if ( GetPlayer()->m_taxi.SetTaximaskNode(curloc) )
{
WorldPacket msg(SMSG_NEW_TAXI_PATH, 0);
SendPacket( &msg );
@@ -181,7 +181,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode ( WorldPacket & recv_data )
nodes.push_back(node);
}
- if(nodes.empty())
+ if (nodes.empty())
return;
sLog.outDebug( "WORLD: Received CMSG_ACTIVATETAXIEXPRESS from %d to %d" ,nodes.front(),nodes.back());
@@ -194,7 +194,7 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recv_data)
sLog.outDebug( "WORLD: Received CMSG_MOVE_SPLINE_DONE" );
uint64 guid; // used only for proper packet read
- if(!recv_data.readPackGUID(guid))
+ if (!recv_data.readPackGUID(guid))
return;
MovementInfo movementInfo; // used only for proper packet read
@@ -208,15 +208,15 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recv_data)
// we need process only (1)
uint32 curDest = GetPlayer()->m_taxi.GetTaxiDestination();
- if(!curDest)
+ if (!curDest)
return;
TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest);
// far teleport case
- if(curDestNode && curDestNode->map_id != GetPlayer()->GetMapId())
+ if (curDestNode && curDestNode->map_id != GetPlayer()->GetMapId())
{
- if(GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType()==FLIGHT_MOTION_TYPE)
+ if (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType()==FLIGHT_MOTION_TYPE)
{
// short preparations to continue flight
FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
@@ -239,7 +239,7 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recv_data)
// Add to taximask middle hubs in taxicheat mode (to prevent having player with disabled taxicheat and not having back flight path)
if (GetPlayer()->isTaxiCheater())
{
- if(GetPlayer()->m_taxi.SetTaximaskNode(sourcenode))
+ if (GetPlayer()->m_taxi.SetTaximaskNode(sourcenode))
{
WorldPacket data(SMSG_NEW_TAXI_PATH, 0);
_player->GetSession()->SendPacket( &data );
@@ -253,7 +253,7 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recv_data)
uint32 path, cost;
objmgr.GetTaxiPath( sourcenode, destinationnode, path, cost);
- if(path && mountDisplayId)
+ if (path && mountDisplayId)
SendDoFlight( mountDisplayId, path, 1 ); // skip start fly node
else
GetPlayer()->m_taxi.ClearTaxiDestinations(); // clear problematic path and next
@@ -262,7 +262,7 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recv_data)
GetPlayer()->CleanupAfterTaxiFlight();
GetPlayer()->SetFallInformation(0, GetPlayer()->GetPositionZ());
- if(GetPlayer()->pvpInfo.inHostileArea)
+ if (GetPlayer()->pvpInfo.inHostileArea)
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
}
diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp
index c60e0119821..2badcf902b8 100644
--- a/src/game/TemporarySummon.cpp
+++ b/src/game/TemporarySummon.cpp
@@ -173,50 +173,50 @@ void TempSummon::InitStats(uint32 duration)
m_timer = duration;
m_lifetime = duration;
- if(m_type == TEMPSUMMON_MANUAL_DESPAWN)
+ if (m_type == TEMPSUMMON_MANUAL_DESPAWN)
m_type = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
Unit *owner = GetSummoner();
- if(owner && isTrigger() && m_spells[0])
+ if (owner && isTrigger() && m_spells[0])
{
setFaction(owner->getFaction());
SetLevel(owner->getLevel());
- if(owner->GetTypeId() == TYPEID_PLAYER)
+ if (owner->GetTypeId() == TYPEID_PLAYER)
m_ControlledByPlayer = true;
}
- if(!m_Properties)
+ if (!m_Properties)
return;
- if(owner)
+ if (owner)
{
- if(uint32 slot = m_Properties->Slot)
+ if (uint32 slot = m_Properties->Slot)
{
- if(owner->m_SummonSlot[slot] && owner->m_SummonSlot[slot] != GetGUID())
+ if (owner->m_SummonSlot[slot] && owner->m_SummonSlot[slot] != GetGUID())
{
Creature *oldSummon = GetMap()->GetCreature(owner->m_SummonSlot[slot]);
- if(oldSummon && oldSummon->isSummon())
+ if (oldSummon && oldSummon->isSummon())
oldSummon->ToTempSummon()->UnSummon();
}
owner->m_SummonSlot[slot] = GetGUID();
}
}
- if(m_Properties->Faction)
+ if (m_Properties->Faction)
setFaction(m_Properties->Faction);
- else if(IsVehicle()) // properties should be vehicle
+ else if (IsVehicle()) // properties should be vehicle
setFaction(owner->getFaction());
}
void TempSummon::InitSummon()
{
Unit* owner = GetSummoner();
- if(owner)
+ if (owner)
{
- if(owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
+ if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->JustSummoned(this);
- if(IsAIEnabled)
+ if (IsAIEnabled)
AI()->IsSummonedBy(owner);
}
}
@@ -229,7 +229,7 @@ void TempSummon::SetTempSummonType(TempSummonType type)
void TempSummon::UnSummon()
{
//assert(!isPet());
- if(isPet())
+ if (isPet())
{
((Pet*)this)->Remove(PET_SAVE_NOT_IN_SLOT);
assert(!IsInWorld());
@@ -237,7 +237,7 @@ void TempSummon::UnSummon()
}
Unit* owner = GetSummoner();
- if(owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
+ if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
AddObjectToRemoveList();
@@ -245,22 +245,22 @@ void TempSummon::UnSummon()
void TempSummon::RemoveFromWorld()
{
- if(!IsInWorld())
+ if (!IsInWorld())
return;
- if(m_Properties)
+ if (m_Properties)
{
- if(uint32 slot = m_Properties->Slot)
+ if (uint32 slot = m_Properties->Slot)
{
- if(Unit* owner = GetSummoner())
+ if (Unit* owner = GetSummoner())
{
- if(owner->m_SummonSlot[slot] = GetGUID())
+ if (owner->m_SummonSlot[slot] = GetGUID())
owner->m_SummonSlot[slot] = 0;
}
}
}
- //if(GetOwnerGUID())
+ //if (GetOwnerGUID())
// sLog.outError("Unit %u has owner guid when removed from world", GetEntry());
Creature::RemoveFromWorld();
@@ -292,7 +292,7 @@ void Minion::InitStats(uint32 duration)
void Minion::RemoveFromWorld()
{
- if(!IsInWorld())
+ if (!IsInWorld())
return;
m_owner->SetMinion(this, false);
@@ -321,7 +321,7 @@ void Guardian::InitStats(uint32 duration)
InitStatsForLevel(m_owner->getLevel());
- if(m_owner->GetTypeId() == TYPEID_PLAYER && HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
+ if (m_owner->GetTypeId() == TYPEID_PLAYER && HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
m_charmInfo->InitCharmCreateSpells();
SetReactState(REACT_AGGRESSIVE);
@@ -331,7 +331,7 @@ void Guardian::InitSummon()
{
TempSummon::InitSummon();
- if(m_owner->GetTypeId() == TYPEID_PLAYER
+ if (m_owner->GetTypeId() == TYPEID_PLAYER
&& m_owner->GetMinionGUID() == GetGUID()
&& !m_owner->GetCharmGUID())
m_owner->ToPlayer()->CharmSpellInitialize();
@@ -362,9 +362,9 @@ void Puppet::Update(uint32 time)
{
Minion::Update(time);
//check if caster is channelling?
- if(IsInWorld())
+ if (IsInWorld())
{
- if(!isAlive())
+ if (!isAlive())
{
UnSummon();
// TODO: why long distance .die does not remove it
@@ -374,7 +374,7 @@ void Puppet::Update(uint32 time)
void Puppet::RemoveFromWorld()
{
- if(!IsInWorld())
+ if (!IsInWorld())
return;
RemoveCharmedBy(NULL);
diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp
index 5d4979479d5..02b4785ba7a 100644
--- a/src/game/ThreatManager.cpp
+++ b/src/game/ThreatManager.cpp
@@ -215,7 +215,7 @@ HostileReference* ThreatContainer::getReferenceByTarget(Unit* pVictim)
uint64 guid = pVictim->GetGUID();
for (std::list<HostileReference*>::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
{
- if((*i)->getUnitGuid() == guid)
+ if ((*i)->getUnitGuid() == guid)
{
result = (*i);
break;
@@ -240,7 +240,7 @@ HostileReference* ThreatContainer::addThreat(Unit* pVictim, float fThreat)
void ThreatContainer::modifyThreatPercent(Unit *pVictim, int32 iPercent)
{
- if(HostileReference* ref = getReferenceByTarget(pVictim))
+ if (HostileReference* ref = getReferenceByTarget(pVictim))
ref->addThreatPercent(iPercent);
}
@@ -257,7 +257,7 @@ bool HostileReferenceSortPredicate(const HostileReference* lhs, const HostileRef
void ThreatContainer::update()
{
- if(iDirty && iThreatList.size() >1)
+ if (iDirty && iThreatList.size() >1)
{
iThreatList.sort(HostileReferenceSortPredicate);
}
@@ -285,12 +285,12 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
assert(target); // if the ref has status online the target must be there !
// some units are prefered in comparison to others
- if(!noPriorityTargetFound && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask()) || target->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE)) )
+ if (!noPriorityTargetFound && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask()) || target->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE)) )
{
- if(iter != lastRef)
+ if (iter != lastRef)
{
// current victim is a second choice target, so don't compare threat with it below
- if(currentRef == pCurrentVictim)
+ if (currentRef == pCurrentVictim)
pCurrentVictim = NULL;
++iter;
continue;
@@ -304,12 +304,12 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
}
}
- if(pAttacker->canCreatureAttack(target)) // skip non attackable currently targets
+ if (pAttacker->canCreatureAttack(target)) // skip non attackable currently targets
{
- if(pCurrentVictim) // select 1.3/1.1 better target in comparison current target
+ if (pCurrentVictim) // select 1.3/1.1 better target in comparison current target
{
// list sorted and and we check current target, then this is best case
- if(pCurrentVictim == currentRef || currentRef->getThreat() <= 1.1f * pCurrentVictim->getThreat() )
+ if (pCurrentVictim == currentRef || currentRef->getThreat() <= 1.1f * pCurrentVictim->getThreat() )
{
currentRef = pCurrentVictim; // for second case
found = true;
@@ -332,7 +332,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
}
++iter;
}
- if(!found)
+ if (!found)
currentRef = NULL;
return currentRef;
@@ -386,7 +386,7 @@ void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask scho
{
float reducedThreat = threat * pVictim->GetReducedThreatPercent() / 100;
threat -= reducedThreat;
- if(Unit *unit = pVictim->GetMisdirectionTarget())
+ if (Unit *unit = pVictim->GetMisdirectionTarget())
_addThreat(unit, reducedThreat);
}
@@ -406,7 +406,7 @@ void ThreatManager::_addThreat(Unit *pVictim, float fThreat)
HostileReference* hostilReference = new HostileReference(pVictim, this, 0);
iThreatContainer.addReference(hostilReference);
hostilReference->addThreat(fThreat); // now we add the real threat
- if(pVictim->GetTypeId() == TYPEID_PLAYER && pVictim->ToPlayer()->isGameMaster())
+ if (pVictim->GetTypeId() == TYPEID_PLAYER && pVictim->ToPlayer()->isGameMaster())
hostilReference->setOnlineOfflineState(false); // GM is always offline
}
}
@@ -434,9 +434,9 @@ float ThreatManager::getThreat(Unit *pVictim, bool pAlsoSearchOfflineList)
{
float threat = 0.0f;
HostileReference* ref = iThreatContainer.getReferenceByTarget(pVictim);
- if(!ref && pAlsoSearchOfflineList)
+ if (!ref && pAlsoSearchOfflineList)
ref = iThreatOfflineContainer.getReferenceByTarget(pVictim);
- if(ref)
+ if (ref)
threat = ref->getThreat();
return threat;
}
@@ -446,9 +446,9 @@ float ThreatManager::getThreat(Unit *pVictim, bool pAlsoSearchOfflineList)
void ThreatManager::tauntApply(Unit* pTaunter)
{
HostileReference* ref = iThreatContainer.getReferenceByTarget(pTaunter);
- if(getCurrentVictim() && ref && (ref->getThreat() < getCurrentVictim()->getThreat()))
+ if (getCurrentVictim() && ref && (ref->getThreat() < getCurrentVictim()->getThreat()))
{
- if(ref->getTempThreatModifier() == 0.0f) // Ok, temp threat is unused
+ if (ref->getTempThreatModifier() == 0.0f) // Ok, temp threat is unused
ref->setTempThreat(getCurrentVictim()->getThreat());
}
}
@@ -458,7 +458,7 @@ void ThreatManager::tauntApply(Unit* pTaunter)
void ThreatManager::tauntFadeOut(Unit *pTaunter)
{
HostileReference* ref = iThreatContainer.getReferenceByTarget(pTaunter);
- if(ref)
+ if (ref)
ref->resetTempThreat();
}
@@ -486,12 +486,12 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
switch(threatRefStatusChangeEvent->getType())
{
case UEV_THREAT_REF_THREAT_CHANGE:
- if((getCurrentVictim() == hostilReference && threatRefStatusChangeEvent->getFValue()<0.0f) ||
+ if ((getCurrentVictim() == hostilReference && threatRefStatusChangeEvent->getFValue()<0.0f) ||
(getCurrentVictim() != hostilReference && threatRefStatusChangeEvent->getFValue()>0.0f))
setDirty(true); // the order in the threat list might have changed
break;
case UEV_THREAT_REF_ONLINE_STATUS:
- if(!hostilReference->isOnline())
+ if (!hostilReference->isOnline())
{
if (hostilReference == getCurrentVictim())
{
@@ -503,7 +503,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
}
else
{
- if(getCurrentVictim() && hostilReference->getThreat() > (1.1f * getCurrentVictim()->getThreat()))
+ if (getCurrentVictim() && hostilReference->getThreat() > (1.1f * getCurrentVictim()->getThreat()))
setDirty(true);
iThreatContainer.addReference(hostilReference);
iThreatOfflineContainer.remove(hostilReference);
@@ -516,7 +516,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
setDirty(true);
}
iOwner->SendRemoveFromThreatListOpcode(hostilReference);
- if(hostilReference->isOnline())
+ if (hostilReference->isOnline())
iThreatContainer.remove(hostilReference);
else
iThreatOfflineContainer.remove(hostilReference);
diff --git a/src/game/TicketHandler.cpp b/src/game/TicketHandler.cpp
index a42d02d2999..8cbc12a9d30 100644
--- a/src/game/TicketHandler.cpp
+++ b/src/game/TicketHandler.cpp
@@ -33,7 +33,7 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
return;
}
- if(GM_Ticket *ticket = objmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID()))
+ if (GM_Ticket *ticket = objmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID()))
{
WorldPacket data( SMSG_GMTICKET_CREATE, 4 );
data << uint32(1); // 1 - You already have GM ticket
@@ -87,7 +87,7 @@ void WorldSession::HandleGMTicketUpdateOpcode( WorldPacket & recv_data)
recv_data >> message;
GM_Ticket *ticket = objmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID());
- if(!ticket)
+ if (!ticket)
{
data << uint32(1);
SendPacket(&data);
@@ -110,7 +110,7 @@ void WorldSession::HandleGMTicketDeleteOpcode( WorldPacket & /*recv_data*/)
{
GM_Ticket* ticket = objmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID());
- if(ticket)
+ if (ticket)
{
WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
data << uint32(9);
@@ -127,7 +127,7 @@ void WorldSession::HandleGMTicketGetTicketOpcode( WorldPacket & /*recv_data*/)
SendQueryTimeResponse();
GM_Ticket *ticket = objmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID());
- if(ticket)
+ if (ticket)
SendGMTicketGetTicket(0x06, ticket->message.c_str());
else
SendGMTicketGetTicket(0x0A, 0);
diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp
index 971482050a8..0f0b8160523 100644
--- a/src/game/Totem.cpp
+++ b/src/game/Totem.cpp
@@ -57,7 +57,7 @@ void Totem::InitStats(uint32 duration)
Minion::InitStats(duration);
CreatureInfo const *cinfo = GetCreatureInfo();
- if(m_owner->GetTypeId() == TYPEID_PLAYER && cinfo)
+ if (m_owner->GetTypeId() == TYPEID_PLAYER && cinfo)
{
uint32 display_id = objmgr.ChooseDisplayId(m_owner->ToPlayer()->GetTeam(), cinfo);
CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id);
@@ -107,7 +107,7 @@ void Totem::InitStats(uint32 duration)
m_type = TOTEM_ACTIVE;
}
- if(GetEntry() == SENTRY_TOTEM_ENTRY)
+ if (GetEntry() == SENTRY_TOTEM_ENTRY)
SetReactState(REACT_AGGRESSIVE);
m_duration = duration;
@@ -117,7 +117,7 @@ void Totem::InitStats(uint32 duration)
void Totem::InitSummon()
{
- if(m_type == TOTEM_PASSIVE)
+ if (m_type == TOTEM_PASSIVE)
CastSpell(this, GetSpell(), true);
// Some totems can have both instant effect and passive spell
@@ -133,7 +133,7 @@ void Totem::UnSummon()
// clear owner's totem slot
for (int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
{
- if(m_owner->m_SummonSlot[i]==GetGUID())
+ if (m_owner->m_SummonSlot[i]==GetGUID())
{
m_owner->m_SummonSlot[i] = 0;
break;
@@ -154,7 +154,7 @@ void Totem::UnSummon()
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* Target = itr->getSource();
- if(Target && pGroup->SameSubGroup((Player*)m_owner, Target))
+ if (Target && pGroup->SameSubGroup((Player*)m_owner, Target))
Target->RemoveAurasDueToSpell(GetSpell());
}
}
@@ -166,7 +166,7 @@ void Totem::UnSummon()
bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
{
// TODO: possibly all negative auras immune?
- if(GetEntry() == 5925)
+ if (GetEntry() == 5925)
return false;
switch(spellInfo->EffectApplyAuraName[index])
{
diff --git a/src/game/TotemAI.cpp b/src/game/TotemAI.cpp
index 25b40d9f7ee..f96071e8bfc 100644
--- a/src/game/TotemAI.cpp
+++ b/src/game/TotemAI.cpp
@@ -32,7 +32,7 @@
int
TotemAI::Permissible(const Creature *creature)
{
- if( creature->isTotem() )
+ if ( creature->isTotem() )
return PERMIT_BASE_PROACTIVE;
return PERMIT_BASE_NO;
@@ -77,7 +77,7 @@ TotemAI::UpdateAI(const uint32 /*diff*/)
Unit* victim = i_victimGuid ? ObjectAccessor::GetUnit(*m_creature, i_victimGuid) : NULL;
// Search victim if no, not attackable, or out of range, or friendly (possible in case duel end)
- if( !victim ||
+ if ( !victim ||
!victim->isTargetableForAttack() || !m_creature->IsWithinDistInMap(victim, max_range) ||
m_creature->IsFriendlyTo(victim) || !victim->isVisibleForOrDetect(m_creature,false) )
{
diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp
index 64c1d8e904c..2bcc4addd40 100644
--- a/src/game/TradeHandler.cpp
+++ b/src/game/TradeHandler.cpp
@@ -110,7 +110,7 @@ void WorldSession::SendUpdateTrade()
{
Item *item = NULL;
- if( !_player || !_player->pTrader )
+ if ( !_player || !_player->pTrader )
return;
// reset trade status
@@ -140,7 +140,7 @@ void WorldSession::SendUpdateTrade()
data << (uint8) i; // trade slot number, if not specified, then end of packet
- if(item)
+ if (item)
{
data << (uint32) item->GetProto()->ItemId; // entry
// display id
@@ -185,16 +185,16 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
ItemPosCountVec playerDst;
bool traderCanTrade = (myItems[i]==NULL || _player->pTrader->CanStoreItem( NULL_BAG, NULL_SLOT, traderDst, myItems[i], false ) == EQUIP_ERR_OK);
bool playerCanTrade = (hisItems[i]==NULL || _player->CanStoreItem( NULL_BAG, NULL_SLOT, playerDst, hisItems[i], false ) == EQUIP_ERR_OK);
- if(traderCanTrade && playerCanTrade )
+ if (traderCanTrade && playerCanTrade )
{
// Ok, if trade item exists and can be stored
// If we trade in both directions we had to check, if the trade will work before we actually do it
// A roll back is not possible after we stored it
- if(myItems[i])
+ if (myItems[i])
{
// logging
sLog.outDebug("partner storing: %u",myItems[i]->GetGUIDLow());
- if( _player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
+ if ( _player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(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(),
@@ -205,11 +205,11 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
// store
_player->pTrader->MoveItemToInventory( traderDst, myItems[i], true, true);
}
- if(hisItems[i])
+ if (hisItems[i])
{
// logging
sLog.outDebug("player storing: %u",hisItems[i]->GetGUIDLow());
- if( _player->pTrader->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
+ if ( _player->pTrader->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
{
sLog.outCommand(_player->pTrader->GetSession()->GetAccountId(),"GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId(),
@@ -225,21 +225,21 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
{
// in case of fatal error log error message
// return the already removed items to the original owner
- if(myItems[i])
+ if (myItems[i])
{
- if(!traderCanTrade)
+ if (!traderCanTrade)
sLog.outError("trader can't store item: %u",myItems[i]->GetGUIDLow());
- if(_player->CanStoreItem( NULL_BAG, NULL_SLOT, playerDst, myItems[i], false ) == EQUIP_ERR_OK)
+ if (_player->CanStoreItem( NULL_BAG, NULL_SLOT, playerDst, myItems[i], false ) == EQUIP_ERR_OK)
_player->MoveItemToInventory(playerDst, myItems[i], true, true);
else
sLog.outError("player can't take item back: %u",myItems[i]->GetGUIDLow());
}
// return the already removed items to the original owner
- if(hisItems[i])
+ if (hisItems[i])
{
- if(!playerCanTrade)
+ if (!playerCanTrade)
sLog.outError("player can't store item: %u",hisItems[i]->GetGUIDLow());
- if(_player->pTrader->CanStoreItem( NULL_BAG, NULL_SLOT, traderDst, hisItems[i], false ) == EQUIP_ERR_OK)
+ if (_player->pTrader->CanStoreItem( NULL_BAG, NULL_SLOT, traderDst, hisItems[i], false ) == EQUIP_ERR_OK)
_player->pTrader->MoveItemToInventory(traderDst, hisItems[i], true, true);
else
sLog.outError("trader can't take item back: %u",hisItems[i]->GetGUIDLow());
@@ -260,7 +260,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
return;
// not accept case incorrect money amount
- if( _player->tradeGold > _player->GetMoney() )
+ if ( _player->tradeGold > _player->GetMoney() )
{
SendNotification(LANG_NOT_ENOUGH_GOLD);
_player->pTrader->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE);
@@ -269,7 +269,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
}
// not accept case incorrect money amount
- if( _player->pTrader->tradeGold > _player->pTrader->GetMoney() )
+ if ( _player->pTrader->tradeGold > _player->pTrader->GetMoney() )
{
_player->pTrader->GetSession( )->SendNotification(LANG_NOT_ENOUGH_GOLD);
SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE);
@@ -342,12 +342,12 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
// clear 'in-trade' flag
for (int i=0; i<TRADE_SLOT_TRADED_COUNT; ++i)
{
- if(myItems[i]) myItems[i]->SetInTrade(false);
- if(hisItems[i]) hisItems[i]->SetInTrade(false);
+ if (myItems[i]) myItems[i]->SetInTrade(false);
+ if (hisItems[i]) hisItems[i]->SetInTrade(false);
}
// in case of missing space report error
- if(!myCanCompleteTrade)
+ if (!myCanCompleteTrade)
{
SendNotification(LANG_NOT_FREE_TRADE_SLOTS);
GetPlayer( )->pTrader->GetSession( )->SendNotification(LANG_NOT_PARTNER_FREE_TRADE_SLOTS);
@@ -386,16 +386,16 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
moveItems(myItems, hisItems);
// logging money
- if(sWorld.getConfig(CONFIG_GM_LOG_TRADE))
+ if (sWorld.getConfig(CONFIG_GM_LOG_TRADE))
{
- if( _player->GetSession()->GetSecurity() > SEC_PLAYER && _player->tradeGold > 0)
+ if ( _player->GetSession()->GetSecurity() > SEC_PLAYER && _player->tradeGold > 0)
{
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
_player->GetName(),_player->GetSession()->GetAccountId(),
_player->tradeGold,
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId());
}
- if( _player->pTrader->GetSession()->GetSecurity() > SEC_PLAYER && _player->pTrader->tradeGold > 0)
+ if ( _player->pTrader->GetSession()->GetSecurity() > SEC_PLAYER && _player->pTrader->tradeGold > 0)
{
sLog.outCommand(_player->pTrader->GetSession()->GetAccountId(),"GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId(),
@@ -442,7 +442,7 @@ void WorldSession::HandleUnacceptTradeOpcode(WorldPacket& /*recvPacket*/)
void WorldSession::HandleBeginTradeOpcode(WorldPacket& /*recvPacket*/)
{
- if(!_player->pTrader)
+ if (!_player->pTrader)
return;
_player->pTrader->GetSession()->SendTradeStatus(TRADE_STATUS_OPEN_WINDOW);
@@ -460,7 +460,7 @@ void WorldSession::SendCancelTrade()
void WorldSession::HandleCancelTradeOpcode(WorldPacket& /*recvPacket*/)
{
// sended also after LOGOUT COMPLETE
- if(_player) // needed because STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT
+ if (_player) // needed because STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT
_player->TradeCancel(true);
}
@@ -547,7 +547,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
return;
}
- if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeam() !=_player->GetTeam() )
+ if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeam() !=_player->GetTeam() )
{
SendTradeStatus(TRADE_STATUS_WRONG_FACTION);
return;
@@ -577,7 +577,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
void WorldSession::HandleSetTradeGoldOpcode(WorldPacket& recvPacket)
{
- if(!_player->pTrader)
+ if (!_player->pTrader)
return;
uint32 gold;
@@ -592,7 +592,7 @@ void WorldSession::HandleSetTradeGoldOpcode(WorldPacket& recvPacket)
void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket)
{
- if(!_player->pTrader)
+ if (!_player->pTrader)
return;
// send update
@@ -605,7 +605,7 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket)
recvPacket >> slot;
// invalid slot number
- if(tradeSlot >= TRADE_SLOT_COUNT)
+ if (tradeSlot >= TRADE_SLOT_COUNT)
{
SendTradeStatus(TRADE_STATUS_TRADE_CANCELED);
return;
@@ -639,14 +639,14 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket)
void WorldSession::HandleClearTradeItemOpcode(WorldPacket& recvPacket)
{
- if(!_player->pTrader)
+ if (!_player->pTrader)
return;
uint8 tradeSlot;
recvPacket >> tradeSlot;
// invalid slot number
- if(tradeSlot >= TRADE_SLOT_COUNT)
+ if (tradeSlot >= TRADE_SLOT_COUNT)
return;
_player->tradeItems[tradeSlot] = 0;
diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp
index 3f13ffd1ba1..68476392373 100644
--- a/src/game/Transports.cpp
+++ b/src/game/Transports.cpp
@@ -37,7 +37,7 @@ void MapManager::LoadTransports()
uint32 count = 0;
- if( !result )
+ if ( !result )
{
barGoLink bar( 1 );
bar.step();
@@ -63,14 +63,14 @@ void MapManager::LoadTransports()
const GameObjectInfo *goinfo = objmgr.GetGameObjectInfo(entry);
- if(!goinfo)
+ if (!goinfo)
{
sLog.outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template missing", entry, name.c_str());
delete t;
continue;
}
- if(goinfo->type != GAMEOBJECT_TYPE_MO_TRANSPORT)
+ if (goinfo->type != GAMEOBJECT_TYPE_MO_TRANSPORT)
{
sLog.outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template type wrong", entry, name.c_str());
delete t;
@@ -81,7 +81,7 @@ void MapManager::LoadTransports()
std::set<uint32> mapsUsed;
- if(!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed))
+ if (!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed))
// skip transports with empty waypoints list
{
sLog.outErrorDb("Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.",goinfo->moTransport.taxiPathId);
@@ -94,7 +94,7 @@ void MapManager::LoadTransports()
x = t->m_WayPoints[0].x; y = t->m_WayPoints[0].y; z = t->m_WayPoints[0].z; mapid = t->m_WayPoints[0].mapid; o = 1;
// creates the Gameobject
- if(!t->Create(entry, mapid, x, y, z, o, 100, 0))
+ if (!t->Create(entry, mapid, x, y, z, o, 100, 0))
{
delete t;
continue;
@@ -117,7 +117,7 @@ void MapManager::LoadTransports()
// check transport data DB integrity
result = WorldDatabase.Query("SELECT gameobject.guid,gameobject.id,transports.name FROM gameobject,transports WHERE gameobject.id = transports.entry");
- if(result) // wrong data found
+ if (result) // wrong data found
{
do
{
@@ -142,7 +142,7 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z,
Relocate(x,y,z,ang);
// instance id and phaseMask isn't set to values different from std.
- if(!IsPositionValid())
+ if (!IsPositionValid())
{
sLog.outError("Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
guidlow,x,y);
@@ -175,7 +175,7 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z,
SetGoType(GameobjectTypes(goinfo->type));
SetGoAnimProgress(animprogress);
- if(dynflags)
+ if (dynflags)
SetUInt32Value(GAMEOBJECT_DYNAMIC, MAKE_PAIR32(0, dynflags));
SetName(goinfo->name);
@@ -262,7 +262,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
if (keyFrames[i].actionflag == 2)
{
// remember first stop frame
- if(firstStop == -1)
+ if (firstStop == -1)
firstStop = i;
lastStop = i;
}
@@ -399,7 +399,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
// sLog.outString("T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport);
/*
- if(keyFrames[i+1].delay > 5)
+ if (keyFrames[i+1].delay > 5)
pos.delayed = true;
*/
//if (teleport)
@@ -463,7 +463,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
SetMap(newMap);
assert (GetMap());
- if(oldMap != newMap)
+ if (oldMap != newMap)
{
UpdateForMap(oldMap);
UpdateForMap(newMap);
@@ -472,7 +472,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
bool Transport::AddPassenger(Player* passenger)
{
- if(m_passengers.insert(passenger).second)
+ if (m_passengers.insert(passenger).second)
sLog.outDetail("Player %s boarded transport %s.", passenger->GetName(), GetName());
return true;
}
@@ -487,7 +487,7 @@ bool Transport::RemovePassenger(Player* passenger)
void Transport::CheckForEvent(uint32 entry, uint32 wp_id)
{
uint32 key = entry*100+wp_id;
- if(objmgr.TransportEventMap.find(key) != objmgr.TransportEventMap.end())
+ if (objmgr.TransportEventMap.find(key) != objmgr.TransportEventMap.end())
GetMap()->ScriptsStart(sEventScripts, objmgr.TransportEventMap[key], this, NULL);
}
@@ -512,7 +512,7 @@ void Transport::Update(uint32 /*p_time*/)
Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z);
}
/*
- if(m_curr->second.delayed)
+ if (m_curr->second.delayed)
{
switch (GetEntry())
{
@@ -557,14 +557,14 @@ void Transport::Update(uint32 /*p_time*/)
void Transport::UpdateForMap(Map const* targetMap)
{
Map::PlayerList const& pl = targetMap->GetPlayers();
- if(pl.isEmpty())
+ if (pl.isEmpty())
return;
- if(GetMapId()==targetMap->GetId())
+ if (GetMapId()==targetMap->GetId())
{
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
{
- if(this != itr->getSource()->GetTransport())
+ if (this != itr->getSource()->GetTransport())
{
UpdateData transData;
BuildCreateUpdateBlockForPlayer(&transData, itr->getSource());
@@ -582,7 +582,7 @@ void Transport::UpdateForMap(Map const* targetMap)
transData.BuildPacket(&out_packet);
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
- if(this != itr->getSource()->GetTransport())
+ if (this != itr->getSource()->GetTransport())
itr->getSource()->SendDirectMessage(&out_packet);
}
}
diff --git a/src/game/Traveller.h b/src/game/Traveller.h
index a419fbda126..c581f7017b5 100644
--- a/src/game/Traveller.h
+++ b/src/game/Traveller.h
@@ -75,11 +75,11 @@ inline uint32 Traveller<T>::GetTotalTrevelTimeTo(float x, float y, float z)
template<>
inline float Traveller<Creature>::Speed()
{
- if(i_traveller.hasUnitState(UNIT_STAT_CHARGING))
+ if (i_traveller.hasUnitState(UNIT_STAT_CHARGING))
return i_traveller.m_TempSpeed;
- else if(i_traveller.HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
+ else if (i_traveller.HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
return i_traveller.GetSpeed(MOVE_WALK);
- else if(i_traveller.HasUnitMovementFlag(MOVEMENTFLAG_FLYING))
+ else if (i_traveller.HasUnitMovementFlag(MOVEMENTFLAG_FLYING))
return i_traveller.GetSpeed(MOVE_FLIGHT);
else
return i_traveller.GetSpeed(MOVE_RUN);
@@ -98,7 +98,7 @@ inline float Traveller<Creature>::GetMoveDestinationTo(float x, float y, float z
float dy = y - GetPositionY();
float dz = z - GetPositionZ();
- //if(i_traveller.HasUnitMovementFlag(MOVEMENTFLAG_FLYING))
+ //if (i_traveller.HasUnitMovementFlag(MOVEMENTFLAG_FLYING))
return sqrt((dx*dx) + (dy*dy) + (dz*dz));
//else //Walking on the ground
// return sqrt((dx*dx) + (dy*dy));
@@ -115,9 +115,9 @@ inline void Traveller<Creature>::MoveTo(float x, float y, float z, uint32 t)
template<>
inline float Traveller<Player>::Speed()
{
- if(i_traveller.hasUnitState(UNIT_STAT_CHARGING))
+ if (i_traveller.hasUnitState(UNIT_STAT_CHARGING))
return i_traveller.m_TempSpeed;
- else if(i_traveller.isInFlight())
+ else if (i_traveller.isInFlight())
return PLAYER_FLIGHT_SPEED;
else
return i_traveller.GetSpeed(i_traveller.m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALK_MODE) ? MOVE_WALK : MOVE_RUN);
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 017f941ffd2..7e81806e658 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -518,7 +518,7 @@ bool Unit::IsWithinMeleeRange(const Unit *obj, float dist) const
void Unit::GetRandomContactPoint(const Unit* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax) const
{
float combat_reach = GetCombatReach();
- if(combat_reach < 0.1) // sometimes bugged for players
+ if (combat_reach < 0.1) // sometimes bugged for players
{
//sLog.outError("Unit %u (Type: %u) has invalid combat_reach %f",GetGUIDLow(),GetTypeId(),combat_reach);
//if (GetTypeId() == TYPEID_UNIT)
@@ -2004,7 +2004,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
if (float manaMultiplier = (*i)->GetSpellProto()->EffectMultipleValue[(*i)->GetEffIndex()])
{
- if(Player *modOwner = pVictim->GetSpellModOwner())
+ if (Player *modOwner = pVictim->GetSpellModOwner())
modOwner->ApplySpellMod((*i)->GetId(), SPELLMOD_MULTIPLE_VALUE, manaMultiplier);
int32 maxAbsorb = int32(pVictim->GetPower(POWER_MANA) / manaMultiplier);
@@ -2848,7 +2848,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
if (pVictim->IsImmunedToDamage(spell))
return SPELL_MISS_IMMUNE;
- if(this == pVictim)
+ if (this == pVictim)
return SPELL_MISS_NONE;
// Try victim reflect spell
@@ -2857,7 +2857,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
int32 reflectchance = pVictim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
Unit::AuraEffectList const& mReflectSpellsSchool = pVictim->GetAuraEffectsByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
for (Unit::AuraEffectList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
- if((*i)->GetMiscValue() & GetSpellSchoolMask(spell))
+ if ((*i)->GetMiscValue() & GetSpellSchoolMask(spell))
reflectchance += (*i)->GetAmount();
if (reflectchance > 0 && roll_chance_i(reflectchance))
{
@@ -2882,7 +2882,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
/*float Unit::MeleeMissChanceCalc(const Unit *pVictim, WeaponAttackType attType) const
{
- if(!pVictim)
+ if (!pVictim)
return 0.0f;
// Base misschance 5%
@@ -2894,7 +2894,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
bool isNormal = false;
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
{
- if( m_currentSpells[i] && (GetSpellSchoolMask(m_currentSpells[i]->m_spellInfo) & SPELL_SCHOOL_MASK_NORMAL) )
+ if ( m_currentSpells[i] && (GetSpellSchoolMask(m_currentSpells[i]->m_spellInfo) & SPELL_SCHOOL_MASK_NORMAL) )
{
isNormal = true;
break;
@@ -2910,7 +2910,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
int32 chance = pVictim->GetTypeId() == TYPEID_PLAYER ? 5 : 7;
int32 leveldif = int32(pVictim->getLevelForTarget(this)) - int32(getLevelForTarget(pVictim));
- if(leveldif < 0)
+ if (leveldif < 0)
leveldif = 0;
// Hit chance from attacker based on ratings and auras
@@ -2920,7 +2920,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
else
m_modHitChance = m_modMeleeHitChance;
- if(leveldif < 3)
+ if (leveldif < 3)
misschance += (leveldif - m_modHitChance);
else
misschance += ((leveldif - 2) * chance - m_modHitChance);
@@ -2935,7 +2935,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
}
// Modify miss chance by victim auras
- if(attType == RANGED_ATTACK)
+ if (attType == RANGED_ATTACK)
misschance -= pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE);
else
misschance -= pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE);
@@ -2955,7 +2955,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
uint32 Unit::GetDefenseSkillValue(Unit const* target) const
{
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
{
// in PvP use full skill instead current skill value
uint32 value = (target && target->GetTypeId() == TYPEID_PLAYER)
@@ -2970,13 +2970,13 @@ uint32 Unit::GetDefenseSkillValue(Unit const* target) const
float Unit::GetUnitDodgeChance() const
{
- if(hasUnitState(UNIT_STAT_STUNNED))
+ if (hasUnitState(UNIT_STAT_STUNNED))
return 0.0f;
- if( GetTypeId() == TYPEID_PLAYER )
+ if ( GetTypeId() == TYPEID_PLAYER )
return GetFloatValue(PLAYER_DODGE_PERCENTAGE);
else
{
- if(((Creature const*)this)->isTotem())
+ if (((Creature const*)this)->isTotem())
return 0.0f;
else
{
@@ -2994,22 +2994,22 @@ float Unit::GetUnitParryChance() const
float chance = 0.0f;
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
{
Player const* player = (Player const*)this;
- if(player->CanParry() )
+ if (player->CanParry() )
{
Item *tmpitem = player->GetWeaponForAttack(BASE_ATTACK,true);
- if(!tmpitem)
+ if (!tmpitem)
tmpitem = player->GetWeaponForAttack(OFF_ATTACK,true);
- if(tmpitem)
+ if (tmpitem)
chance = GetFloatValue(PLAYER_PARRY_PERCENTAGE);
}
}
- else if(GetTypeId() == TYPEID_UNIT)
+ else if (GetTypeId() == TYPEID_UNIT)
{
- if(GetCreatureType() == CREATURE_TYPE_HUMANOID)
+ if (GetCreatureType() == CREATURE_TYPE_HUMANOID)
{
chance = 5.0f;
chance += GetTotalAuraModifier(SPELL_AURA_MOD_PARRY_PERCENT);
@@ -3024,13 +3024,13 @@ float Unit::GetUnitBlockChance() const
if ( IsNonMeleeSpellCasted(false) || hasUnitState(UNIT_STAT_STUNNED))
return 0.0f;
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
{
Player const* player = (Player const*)this;
- if(player->CanBlock() )
+ if (player->CanBlock() )
{
Item *tmpitem = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
- if(tmpitem && !tmpitem->IsBroken() && tmpitem->GetProto()->Block)
+ if (tmpitem && !tmpitem->IsBroken() && tmpitem->GetProto()->Block)
return GetFloatValue(PLAYER_BLOCK_PERCENTAGE);
}
// is player but has no block ability or no not broken shield equipped
@@ -3038,7 +3038,7 @@ float Unit::GetUnitBlockChance() const
}
else
{
- if(((Creature const*)this)->isTotem())
+ if (((Creature const*)this)->isTotem())
return 0.0f;
else
{
@@ -3053,7 +3053,7 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVict
{
float crit;
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
{
switch(attackType)
{
@@ -3080,7 +3080,7 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVict
}
// flat aura mods
- if(attackType == RANGED_ATTACK)
+ if (attackType == RANGED_ATTACK)
crit += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE);
else
crit += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE);
@@ -3109,7 +3109,7 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVict
uint32 Unit::GetWeaponSkillValue (WeaponAttackType attType, Unit const* target) const
{
uint32 value = 0;
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
{
Item* item = this->ToPlayer()->GetWeaponForAttack(attType,true);
@@ -3152,7 +3152,7 @@ void Unit::_DeleteRemovedAuras()
void Unit::_UpdateSpells( uint32 time )
{
- if(m_currentSpells[CURRENT_AUTOREPEAT_SPELL])
+ if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL])
_UpdateAutoRepeatSpell();
// remove finished spells from current pointers
@@ -3176,7 +3176,7 @@ void Unit::_UpdateSpells( uint32 time )
// remove expired auras - do that after updates(used in scripts?)
for (AuraMap::iterator i = m_ownedAuras.begin(); i != m_ownedAuras.end();)
{
- if(i->second->IsExpired())
+ if (i->second->IsExpired())
RemoveOwnedAura(i, AURA_REMOVE_BY_EXPIRE);
else
++i;
@@ -3188,12 +3188,12 @@ void Unit::_UpdateSpells( uint32 time )
_DeleteRemovedAuras();
- if(!m_gameObj.empty())
+ if (!m_gameObj.empty())
{
GameObjectList::iterator itr;
for (itr = m_gameObj.begin(); itr != m_gameObj.end();)
{
- if( !(*itr)->isSpawned() )
+ if ( !(*itr)->isSpawned() )
{
(*itr)->SetOwnerGUID(0);
(*itr)->SetRespawnTime(0);
@@ -3212,7 +3212,7 @@ void Unit::_UpdateAutoRepeatSpell()
if ( (GetTypeId() == TYPEID_PLAYER && ((Player*)this)->isMoving()) || IsNonMeleeSpellCasted(false,false,true,m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id == 75) )
{
// cancel wand shoot
- if(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
+ if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
m_AutoRepeatFirstCast = true;
return;
@@ -3227,7 +3227,7 @@ void Unit::_UpdateAutoRepeatSpell()
if (isAttackReady(RANGED_ATTACK))
{
// Check if able to cast
- if(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->CheckCast(true) != SPELL_CAST_OK)
+ if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->CheckCast(true) != SPELL_CAST_OK)
{
InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
return;
@@ -3321,12 +3321,12 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi
//sLog.outDebug("Interrupt spell for unit %u.", GetEntry());
Spell *spell = m_currentSpells[spellType];
- if(spell
+ if (spell
&& (withDelayed || spell->getState() != SPELL_STATE_DELAYED)
&& (withInstant || spell->GetCastTime() > 0))
{
// for example, do not let self-stun aura interrupt itself
- if(!spell->IsInterruptable())
+ if (!spell->IsInterruptable())
return;
m_currentSpells[spellType] = NULL;
@@ -3334,7 +3334,7 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi
// send autorepeat cancel message for autorepeat spells
if (spellType == CURRENT_AUTOREPEAT_SPELL)
{
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
this->ToPlayer()->SendAutoRepeatCancel(this);
}
@@ -3401,7 +3401,7 @@ void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id, bool withI
Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const
{
for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++)
- if(m_currentSpells[i] && m_currentSpells[i]->m_spellInfo->Id==spell_id)
+ if (m_currentSpells[i] && m_currentSpells[i]->m_spellInfo->Id==spell_id)
return m_currentSpells[i];
return NULL;
}
@@ -3436,7 +3436,7 @@ void Unit::SetFacingToObject(WorldObject* pObject)
bool Unit::isInAccessiblePlaceFor(Creature const* c) const
{
- if(IsInWater())
+ if (IsInWater())
return c->canSwim();
else
return c->canWalk() || c->canFly();
@@ -3468,7 +3468,7 @@ void Unit::_AddAura(UnitAura * aura, Unit * caster)
// find current aura from spell and change it's stackamount
if (Aura * foundAura = GetOwnedAura(aura->GetId(), aura->GetCasterGUID(), 0, aura))
{
- if(aura->GetSpellProto()->StackAmount)
+ if (aura->GetSpellProto()->StackAmount)
aura->ModStackAmount(foundAura->GetStackAmount());
// Use the new one to replace the old one
@@ -3493,7 +3493,7 @@ void Unit::_AddAura(UnitAura * aura, Unit * caster)
Unit::AuraList& scAuras = caster->GetSingleCastAuras();
for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end(); ++itr)
{
- if( (*itr) != aura &&
+ if ( (*itr) != aura &&
IsSingleTargetSpells((*itr)->GetSpellProto(), aura->GetSpellProto()))
{
(*itr)->Remove();
@@ -3502,7 +3502,7 @@ void Unit::_AddAura(UnitAura * aura, Unit * caster)
}
}
- if(!restart)
+ if (!restart)
break;
}
}
@@ -3521,7 +3521,7 @@ AuraApplication * Unit::_CreateAuraApplication(Aura * aura, uint8 effMask)
uint32 aurId = aurSpellInfo->Id;
// ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
- if( !isAlive() && !IsDeathPersistentSpell(aurSpellInfo) &&
+ if ( !isAlive() && !IsDeathPersistentSpell(aurSpellInfo) &&
(GetTypeId() != TYPEID_PLAYER || !this->ToPlayer()->GetSession()->PlayerLoading()) )
return NULL;
@@ -3530,13 +3530,13 @@ AuraApplication * Unit::_CreateAuraApplication(Aura * aura, uint8 effMask)
AuraApplication * aurApp = new AuraApplication(this, caster, aura, effMask);
m_appliedAuras.insert(AuraApplicationMap::value_type(aurId, aurApp));
- if(aurSpellInfo->AuraInterruptFlags)
+ if (aurSpellInfo->AuraInterruptFlags)
{
m_interruptableAuras.push_back(aurApp);
AddInterruptMask(aurSpellInfo->AuraInterruptFlags);
}
- if(AuraState aState = GetSpellAuraState(aura->GetSpellProto()))
+ if (AuraState aState = GetSpellAuraState(aura->GetSpellProto()))
m_auraStateAuras.insert(AuraStateAurasMap::value_type(aState, aurApp));
aura->_ApplyForTarget(this, caster, aurApp);
@@ -3567,7 +3567,7 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask)
return;
// Update target aura state flag
- if(AuraState aState = GetSpellAuraState(aura->GetSpellProto()))
+ if (AuraState aState = GetSpellAuraState(aura->GetSpellProto()))
ModifyAuraState(aState, true);
if (aurApp->GetRemoveMode())
@@ -3666,7 +3666,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo
aura->HandleAuraSpecificMods(aurApp, caster, false);
// only way correctly remove all auras from list
- //if(removedAuras != m_removedAurasCount) new aura may be added
+ //if (removedAuras != m_removedAurasCount) new aura may be added
i = m_appliedAuras.begin();
}
@@ -3699,13 +3699,13 @@ void Unit::_RemoveNoStackAuraApplicationsDueToAura(Aura * aura)
uint32 spellId = spellProto->Id;
// passive spell special case (only non stackable with ranks)
- if(IsPassiveSpell(spellId) && IsPassiveSpellStackableWithRanks(spellProto))
+ if (IsPassiveSpell(spellId) && IsPassiveSpellStackableWithRanks(spellProto))
return;
bool remove = false;
for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
{
- if(remove)
+ if (remove)
{
remove = false;
i = m_appliedAuras.begin();
@@ -3715,7 +3715,7 @@ void Unit::_RemoveNoStackAuraApplicationsDueToAura(Aura * aura)
continue;
RemoveAura(i, AURA_REMOVE_BY_DEFAULT);
- if(i == m_appliedAuras.end())
+ if (i == m_appliedAuras.end())
break;
remove = true;
}
@@ -3728,13 +3728,13 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura * aura)
uint32 spellId = spellProto->Id;
// passive spell special case (only non stackable with ranks)
- if(IsPassiveSpell(spellId) && IsPassiveSpellStackableWithRanks(spellProto))
+ if (IsPassiveSpell(spellId) && IsPassiveSpellStackableWithRanks(spellProto))
return;
bool remove = false;
for (AuraMap::iterator i = m_ownedAuras.begin(); i != m_ownedAuras.end(); ++i)
{
- if(remove)
+ if (remove)
{
remove = false;
i = m_ownedAuras.begin();
@@ -3744,7 +3744,7 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura * aura)
continue;
RemoveOwnedAura(i, AURA_REMOVE_BY_DEFAULT);
- if(i == m_ownedAuras.end())
+ if (i == m_ownedAuras.end())
break;
remove = true;
}
@@ -3765,10 +3765,10 @@ bool Unit::_IsNoStackAuraDueToAura(Aura * appliedAura, Aura * existingAura) cons
uint32 i_spellId = i_spellProto->Id;
bool sameCaster = appliedAura->GetCasterGUID() == existingAura->GetCasterGUID();
- if(IsPassiveSpell(i_spellId))
+ if (IsPassiveSpell(i_spellId))
{
// passive non-stackable spells not stackable only for same caster
- if(!sameCaster)
+ if (!sameCaster)
return false;
// passive non-stackable spells not stackable only with another rank of same spell
@@ -3792,7 +3792,7 @@ bool Unit::_IsNoStackAuraDueToAura(Aura * appliedAura, Aura * existingAura) cons
if (is_triggered_by_spell)
return false;
- if(spellmgr.CanAurasStack(spellProto, i_spellProto, sameCaster))
+ if (spellmgr.CanAurasStack(spellProto, i_spellProto, sameCaster))
return false;
return true;
}
@@ -3830,7 +3830,7 @@ void Unit::RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode)
void Unit::RemoveOwnedAura(uint32 spellId, uint64 caster, uint8 reqEffMask, AuraRemoveMode removeMode)
{
for (AuraMap::iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId);)
- if(((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!caster || itr->second->GetCasterGUID() == caster))
+ if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!caster || itr->second->GetCasterGUID() == caster))
{
RemoveOwnedAura(itr, removeMode);
itr = m_ownedAuras.lower_bound(spellId);
@@ -3859,7 +3859,7 @@ void Unit::RemoveOwnedAura(Aura * aura, AuraRemoveMode removeMode)
Aura * Unit::GetOwnedAura(uint32 spellId, uint64 caster, uint8 reqEffMask, Aura * except) const
{
for (AuraMap::const_iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId); ++itr)
- if(((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!caster || itr->second->GetCasterGUID() == caster) && (!except || except != itr->second))
+ if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!caster || itr->second->GetCasterGUID() == caster) && (!except || except != itr->second))
return itr->second;
return NULL;
}
@@ -4358,7 +4358,7 @@ void Unit::_ApplyAllAuraStatMods()
AuraEffect * Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const
{
for (AuraApplicationMap::const_iterator itr = m_appliedAuras.lower_bound(spellId); itr != m_appliedAuras.upper_bound(spellId); ++itr)
- if(itr->second->HasEffect(effIndex) && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
+ if (itr->second->HasEffect(effIndex) && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
return itr->second->GetBase()->GetEffect(effIndex);
return NULL;
}
@@ -4414,7 +4414,7 @@ AuraApplication * Unit::GetAuraApplication(uint32 spellId, uint64 casterGUID, ui
for (AuraApplicationMap::const_iterator itr = m_appliedAuras.lower_bound(spellId); itr != m_appliedAuras.upper_bound(spellId); ++itr)
{
Aura const * aura = itr->second->GetBase();
- if(((aura->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || aura->GetCasterGUID() == casterGUID) && (!except || except!=itr->second))
+ if (((aura->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || aura->GetCasterGUID() == casterGUID) && (!except || except!=itr->second))
return itr->second;
}
return NULL;
@@ -4451,7 +4451,7 @@ Aura * Unit::GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID, uint8 reqEf
bool Unit::HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const
{
for (AuraApplicationMap::const_iterator itr = m_appliedAuras.lower_bound(spellId); itr != m_appliedAuras.upper_bound(spellId); ++itr)
- if(itr->second->HasEffect(effIndex) && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
+ if (itr->second->HasEffect(effIndex) && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
return true;
return false;
}
@@ -4729,16 +4729,16 @@ void Unit::AddDynObject(DynamicObject* dynObj)
void Unit::RemoveDynObject(uint32 spellid)
{
- if(m_dynObjGUIDs.empty())
+ if (m_dynObjGUIDs.empty())
return;
for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
{
DynamicObject* dynObj = GetMap()->GetDynamicObject(*i);
- if(!dynObj) // may happen if a dynobj is removed when grid unload
+ if (!dynObj) // may happen if a dynobj is removed when grid unload
{
i = m_dynObjGUIDs.erase(i);
}
- else if(spellid == 0 || dynObj->GetSpellId() == spellid)
+ else if (spellid == 0 || dynObj->GetSpellId() == spellid)
{
dynObj->Delete();
i = m_dynObjGUIDs.erase(i);
@@ -4753,7 +4753,7 @@ void Unit::RemoveAllDynObjects()
while (!m_dynObjGUIDs.empty())
{
DynamicObject* dynObj = GetMap()->GetDynamicObject(*m_dynObjGUIDs.begin());
- if(dynObj)
+ if (dynObj)
dynObj->Delete();
m_dynObjGUIDs.erase(m_dynObjGUIDs.begin());
}
@@ -4764,7 +4764,7 @@ DynamicObject * Unit::GetDynObject(uint32 spellId)
for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
{
DynamicObject* dynObj = GetMap()->GetDynamicObject(*i);
- if(!dynObj)
+ if (!dynObj)
{
i = m_dynObjGUIDs.erase(i);
continue;
@@ -4788,7 +4788,7 @@ GameObject* Unit::GetGameObject(uint32 spellId) const
void Unit::AddGameObject(GameObject* gameObj)
{
- if(!gameObj || !gameObj->GetOwnerGUID()==0) return;
+ if (!gameObj || !gameObj->GetOwnerGUID()==0) return;
m_gameObj.push_back(gameObj);
gameObj->SetOwnerGUID(GetGUID());
@@ -4804,13 +4804,13 @@ void Unit::AddGameObject(GameObject* gameObj)
void Unit::RemoveGameObject(GameObject* gameObj, bool del)
{
- if(!gameObj || !gameObj->GetOwnerGUID()==GetGUID()) return;
+ if (!gameObj || !gameObj->GetOwnerGUID()==GetGUID()) return;
gameObj->SetOwnerGUID(0);
for (uint32 i = 0; i < 4; ++i)
{
- if(m_ObjectSlot[i] == gameObj->GetGUID())
+ if (m_ObjectSlot[i] == gameObj->GetGUID())
{
m_ObjectSlot[i] = 0;
break;
@@ -4834,7 +4834,7 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del)
m_gameObj.remove(gameObj);
- if(del)
+ if (del)
{
gameObj->SetRespawnTime(0);
gameObj->Delete();
@@ -4843,16 +4843,16 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del)
void Unit::RemoveGameObject(uint32 spellid, bool del)
{
- if(m_gameObj.empty())
+ if (m_gameObj.empty())
return;
GameObjectList::iterator i, next;
for (i = m_gameObj.begin(); i != m_gameObj.end(); i = next)
{
next = i;
- if(spellid == 0 || (*i)->GetSpellId() == spellid)
+ if (spellid == 0 || (*i)->GetSpellId() == spellid)
{
(*i)->SetOwnerGUID(0);
- if(del)
+ if (del)
{
(*i)->SetRespawnTime(0);
(*i)->Delete();
@@ -4907,7 +4907,7 @@ void Unit::SendSpellNonMeleeDamageLog(Unit *target, uint32 SpellID, uint32 Damag
log.physicalLog = PhysicalDamage;
log.blocked = Blocked;
log.HitInfo = SPELL_HIT_TYPE_UNK1 | SPELL_HIT_TYPE_UNK3 | SPELL_HIT_TYPE_UNK6;
- if(CriticalHit)
+ if (CriticalHit)
log.HitInfo |= SPELL_HIT_TYPE_CRIT;
SendSpellNonMeleeDamageLog(&log);
}
@@ -4919,7 +4919,7 @@ void Unit::ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVic
ProcDamageAndSpellFor(false, pVictim,procAttacker, procExtra,attType, procSpell, amount, procAura);
// Now go on with a victim's events'n'auras
// Not much to do if no flags are set or there is no victim
- if(pVictim && pVictim->isAlive() && procVictim)
+ if (pVictim && pVictim->isAlive() && procVictim)
pVictim->ProcDamageAndSpellFor(true, this, procVictim, procExtra, attType, procSpell, amount, procAura);
}
@@ -5004,13 +5004,13 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo)
data << uint32(damageInfo->damage); // Sub Damage
}
- if(damageInfo->HitInfo & (HITINFO_ABSORB | HITINFO_ABSORB2))
+ if (damageInfo->HitInfo & (HITINFO_ABSORB | HITINFO_ABSORB2))
{
for (uint32 i = 0; i < count; ++i)
data << uint32(damageInfo->absorb); // Absorb
}
- if(damageInfo->HitInfo & (HITINFO_RESIST | HITINFO_RESIST2))
+ if (damageInfo->HitInfo & (HITINFO_RESIST | HITINFO_RESIST2))
{
for (uint32 i = 0; i < count; ++i)
data << uint32(damageInfo->resist); // Resist
@@ -5020,13 +5020,13 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo)
data << uint32(0);
data << uint32(0);
- if(damageInfo->HitInfo & HITINFO_BLOCK)
+ if (damageInfo->HitInfo & HITINFO_BLOCK)
data << uint32(damageInfo->blocked_amount);
- if(damageInfo->HitInfo & HITINFO_UNK3)
+ if (damageInfo->HitInfo & HITINFO_UNK3)
data << uint32(0);
- if(damageInfo->HitInfo & HITINFO_UNK1)
+ if (damageInfo->HitInfo & HITINFO_UNK1)
{
data << uint32(0);
data << float(0);
@@ -5147,7 +5147,7 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /*damage*/, AuraE
case 54646:
{
Unit* caster = triggeredByAura->GetCaster();
- if(!caster)
+ if (!caster)
return false;
triggered_spell_id = 54648;
@@ -5159,30 +5159,30 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /*damage*/, AuraE
}
// processed charge only counting case
- if(!triggered_spell_id)
+ if (!triggered_spell_id)
return true;
SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
- if(!triggerEntry)
+ if (!triggerEntry)
{
sLog.outError("Unit::HandleHasteAuraProc: Spell %u have not existed triggered spell %u",triggeredByAuraSpell->Id,triggered_spell_id);
return false;
}
// default case
- if(!target || target!=this && !target->isAlive())
+ if (!target || target!=this && !target->isAlive())
return false;
- if( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id))
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id))
return false;
- if(basepoints0)
+ if (basepoints0)
CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
else
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura);
- if( cooldown && GetTypeId() == TYPEID_PLAYER )
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER )
this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return true;
@@ -5241,7 +5241,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
case 35429:
{
target = SelectNearbyTarget();
- if(!target)
+ if (!target)
return false;
triggered_spell_id = 26654;
@@ -5266,7 +5266,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Adaptive Warding (Frostfire Regalia set)
case 28764:
{
- if(!procSpell)
+ if (!procSpell)
return false;
// find Mage Armor
@@ -5293,7 +5293,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Obsidian Armor (Justice Bearer`s Pauldrons shoulder)
case 27539:
{
- if(!procSpell)
+ if (!procSpell)
return false;
switch(GetFirstSchoolInMask(GetSpellSchoolMask(procSpell)))
@@ -5318,7 +5318,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
{
// Cast on owner
target = GetOwner();
- if(!target)
+ if (!target)
return false;
triggered_spell_id = 34650;
@@ -5329,7 +5329,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
{
// Cast on owner
target = GetOwner();
- if(!target)
+ if (!target)
return false;
triggered_spell_id = 58876;
@@ -5375,7 +5375,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// 41409 Dementia: Every 5 seconds either gives you -5% damage/healing. (Druid, Shaman, Priest, Warlock, Mage, Paladin)
case 39446:
{
- if(GetTypeId() != TYPEID_PLAYER || !this->isAlive())
+ if (GetTypeId() != TYPEID_PLAYER || !this->isAlive())
return false;
// Select class defined buff
@@ -5430,7 +5430,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// cast 45429 Arcane Bolt if Exalted by Scryers
case 45481:
{
- if(GetTypeId() != TYPEID_PLAYER)
+ if (GetTypeId() != TYPEID_PLAYER)
return false;
// Get Aldor reputation rank
@@ -5444,17 +5444,17 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if (ToPlayer()->GetReputationRank(934) == REP_EXALTED)
{
// triggered at positive/self casts also, current attack target used then
- if(IsFriendlyTo(target))
+ if (IsFriendlyTo(target))
{
target = getVictim();
- if(!target)
+ if (!target)
{
uint64 selected_guid = ToPlayer()->GetSelection();
target = ObjectAccessor::GetUnit(*this,selected_guid);
- if(!target)
+ if (!target)
return false;
}
- if(IsFriendlyTo(target))
+ if (IsFriendlyTo(target))
return false;
}
@@ -5468,7 +5468,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// cast 45428 Arcane Strike if Exalted by Scryers
case 45482:
{
- if(GetTypeId() != TYPEID_PLAYER)
+ if (GetTypeId() != TYPEID_PLAYER)
return false;
// Get Aldor reputation rank
@@ -5491,7 +5491,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// cast 45432 Light's Ward if Exalted by Scryers
case 45483:
{
- if(GetTypeId() != TYPEID_PLAYER)
+ if (GetTypeId() != TYPEID_PLAYER)
return false;
// Get Aldor reputation rank
@@ -5515,7 +5515,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// cast 45430 Arcane Surge if Exalted by Scryers
case 45484:
{
- if(GetTypeId() != TYPEID_PLAYER)
+ if (GetTypeId() != TYPEID_PLAYER)
return false;
// Get Aldor reputation rank
@@ -5547,7 +5547,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Remove aura stack from pet
RemoveAuraFromStack(58914);
Unit* owner = GetOwner();
- if(!owner)
+ if (!owner)
return true;
// reduce the owner's aura stack
owner->RemoveAuraFromStack(34027);
@@ -5604,13 +5604,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Master of Elements
if (dummySpell->SpellIconID == 1920)
{
- if(!procSpell)
+ if (!procSpell)
return false;
// mana cost save
int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100;
basepoints0 = cost * triggerAmount/100;
- if( basepoints0 <=0 )
+ if ( basepoints0 <=0 )
return false;
target = this;
@@ -5620,7 +5620,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Arcane Potency
if (dummySpell->SpellIconID == 2120)
{
- if(!procSpell)
+ if (!procSpell)
return false;
target = this;
@@ -5660,12 +5660,12 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Burnout
if (dummySpell->SpellIconID == 2998)
{
- if(!procSpell)
+ if (!procSpell)
return false;
int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100;
basepoints0 = cost * triggerAmount/100;
- if( basepoints0 <=0 )
+ if ( basepoints0 <=0 )
return false;
triggered_spell_id = 44450;
target = this;
@@ -5674,7 +5674,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Incanter's Regalia set (add trigger chance to Mana Shield)
if (dummySpell->SpellFamilyFlags[0] & 0x8000)
{
- if(GetTypeId() != TYPEID_PLAYER)
+ if (GetTypeId() != TYPEID_PLAYER)
return false;
target = this;
@@ -5731,7 +5731,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Glyph of Ice Block
case 56372:
{
- if(GetTypeId() != TYPEID_PLAYER)
+ if (GetTypeId() != TYPEID_PLAYER)
return false;
SpellCooldowns const SpellCDs = this->ToPlayer()->GetSpellCooldowns();
@@ -5740,7 +5740,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
{
SpellEntry const* SpellCDs_entry = sSpellStore.LookupEntry(itr->first);
// Frost Nova
- if(SpellCDs_entry && SpellCDs_entry->SpellFamilyName == SPELLFAMILY_MAGE
+ if (SpellCDs_entry && SpellCDs_entry->SpellFamilyName == SPELLFAMILY_MAGE
&& SpellCDs_entry->SpellFamilyFlags[0] & 0x00000040)
this->ToPlayer()->RemoveSpellCooldown(SpellCDs_entry->Id, true);
}
@@ -5757,7 +5757,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
case 12328:
{
target = SelectNearbyTarget();
- if(!target)
+ if (!target)
return false;
triggered_spell_id = 26654;
@@ -5774,7 +5774,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
}
// Retaliation
- if(dummySpell->SpellFamilyFlags[1] & 0x8)
+ if (dummySpell->SpellFamilyFlags[1] & 0x8)
{
// check attack comes not from behind
if (!HasInArc(M_PI, pVictim))
@@ -5840,10 +5840,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Seed of Corruption
if (dummySpell->SpellFamilyFlags[1] & 0x00000010)
{
- if(procSpell && procSpell->Id == 27285)
+ if (procSpell && procSpell->Id == 27285)
return false;
// if damage is more than need or target die from damage deal finish spell
- if( triggeredByAura->GetAmount() <= damage || GetHealth() <= damage )
+ if ( triggeredByAura->GetAmount() <= damage || GetHealth() <= damage )
{
// remember guid before aura delete
uint64 casterGuid = triggeredByAura->GetCasterGUID();
@@ -5852,7 +5852,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
RemoveAurasDueToSpell(triggeredByAura->GetId());
// Cast finish spell (triggeredByAura already not exist!)
- if(Unit* caster = GetUnit(*this, casterGuid))
+ if (Unit* caster = GetUnit(*this, casterGuid))
caster->CastSpell(this, 27285, true, castItem);
return true; // no hidden cooldown
}
@@ -5865,7 +5865,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if (dummySpell->SpellFamilyFlags.IsEqual(0,0,0) && dummySpell->SpellIconID == 1932)
{
// if damage is more than need deal finish spell
- if( triggeredByAura->GetAmount() <= damage )
+ if ( triggeredByAura->GetAmount() <= damage )
{
// remember guid before aura delete
uint64 casterGuid = triggeredByAura->GetCasterGUID();
@@ -5874,7 +5874,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
RemoveAurasDueToSpell(triggeredByAura->GetId());
// Cast finish spell (triggeredByAura already not exist!)
- if(Unit* caster = GetUnit(*this, casterGuid))
+ if (Unit* caster = GetUnit(*this, casterGuid))
caster->CastSpell(this, 32865, true, castItem);
return true; // no hidden cooldown
}
@@ -5976,7 +5976,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
case 37381:
{
target = GetGuardianPet();
- if(!target)
+ if (!target)
return false;
// heal amount
@@ -5996,16 +5996,16 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
case SPELLFAMILY_PRIEST:
{
// Vampiric Touch
- if( dummySpell->SpellFamilyFlags[1] & 0x00000400 )
+ if ( dummySpell->SpellFamilyFlags[1] & 0x00000400 )
{
- if(!pVictim || !pVictim->isAlive())
+ if (!pVictim || !pVictim->isAlive())
return false;
if (effIndex!=0)
return false;
// pVictim is caster of aura
- if(triggeredByAura->GetCasterGUID() != pVictim->GetGUID())
+ if (triggeredByAura->GetCasterGUID() != pVictim->GetGUID())
return false;
// Energize 0.25% of max. mana
@@ -6042,7 +6042,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Vampiric Embrace
case 15286:
{
- if(!pVictim || !pVictim->isAlive())
+ if (!pVictim || !pVictim->isAlive())
return false;
// heal amount
@@ -6055,10 +6055,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
case 40438:
{
// Shadow Word: Pain
- if( procSpell->SpellFamilyFlags[0] & 0x8000 )
+ if ( procSpell->SpellFamilyFlags[0] & 0x8000 )
triggered_spell_id = 40441;
// Renew
- else if( procSpell->SpellFamilyFlags[0] & 0x40 )
+ else if ( procSpell->SpellFamilyFlags[0] & 0x40 )
triggered_spell_id = 40440;
else
return false;
@@ -6072,20 +6072,20 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
triggered_spell_id = 56161;
SpellEntry const* GoPoH = sSpellStore.LookupEntry(triggered_spell_id);
- if(!GoPoH)
+ if (!GoPoH)
return false;
int EffIndex = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; i++)
{
- if(GoPoH->Effect[i] == SPELL_EFFECT_APPLY_AURA)
+ if (GoPoH->Effect[i] == SPELL_EFFECT_APPLY_AURA)
{
EffIndex = i;
break;
}
}
int32 tickcount = GetSpellMaxDuration(GoPoH) / GoPoH->EffectAmplitude[EffIndex];
- if(!tickcount)
+ if (!tickcount)
return false;
basepoints0 = damage * triggerAmount / tickcount / 100;
@@ -6107,7 +6107,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Dispel Magic shares spellfamilyflag with abolish disease
if (procSpell->SpellIconID != 74)
return false;
- if(!target || !target->IsFriendlyTo(this))
+ if (!target || !target->IsFriendlyTo(this))
return false;
basepoints0 = int32(target->GetMaxHealth() * triggerAmount / 100);
@@ -6126,7 +6126,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Frozen Shadoweave (Shadow's Embrace set) warning! its not only priest set
case 39372:
{
- if(!procSpell || (GetSpellSchoolMask(procSpell) & (SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW))==0 )
+ if (!procSpell || (GetSpellSchoolMask(procSpell) & (SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW))==0 )
return false;
// heal amount
@@ -6241,19 +6241,19 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
float chance;
// Starfire
- if( procSpell->SpellFamilyFlags[0] & 0x4 )
+ if ( procSpell->SpellFamilyFlags[0] & 0x4 )
{
triggered_spell_id = 40445;
chance = 25.0f;
}
// Rejuvenation
- else if( procSpell->SpellFamilyFlags[0] & 0x10 )
+ else if ( procSpell->SpellFamilyFlags[0] & 0x10 )
{
triggered_spell_id = 40446;
chance = 25.0f;
}
// Mangle (Bear) and Mangle (Cat)
- else if( procSpell->SpellFamilyFlags[1] & 0x00000440)
+ else if ( procSpell->SpellFamilyFlags[1] & 0x00000440)
{
triggered_spell_id = 40452;
chance = 40.0f;
@@ -6340,7 +6340,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
case 32748:
{
// Prevent cast Deadly Throw Interrupt on self from last effect (apply dummy) of Deadly Throw
- if(this == pVictim)
+ if (this == pVictim)
return false;
triggered_spell_id = 32747;
@@ -6348,7 +6348,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
}
}
// Cut to the Chase
- if( dummySpell->SpellIconID == 2909 )
+ if ( dummySpell->SpellIconID == 2909 )
{
// "refresh your Slice and Dice duration to its 5 combo point maximum"
// lookup Slice and Dice
@@ -6360,20 +6360,20 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
return false;
}
// Deadly Brew
- else if( dummySpell->SpellIconID == 2963 )
+ else if ( dummySpell->SpellIconID == 2963 )
{
triggered_spell_id = 3409;
break;
}
// Quick Recovery
- else if( dummySpell->SpellIconID == 2116 )
+ else if ( dummySpell->SpellIconID == 2116 )
{
- if(!procSpell)
+ if (!procSpell)
return false;
// energy cost save
basepoints0 = procSpell->manaCost * triggerAmount/100;
- if(basepoints0 <= 0)
+ if (basepoints0 <= 0)
return false;
target = this;
@@ -6387,13 +6387,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Thrill of the Hunt
if ( dummySpell->SpellIconID == 2236 )
{
- if(!procSpell)
+ if (!procSpell)
return false;
// mana cost save
int32 mana = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100;
basepoints0 = mana * 40/100;
- if(basepoints0 <= 0)
+ if (basepoints0 <= 0)
return false;
target = this;
@@ -6411,7 +6411,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if ( dummySpell->SpellIconID == 267 )
{
int32 chance = triggeredByAura->GetSpellProto()->EffectBasePoints[triggeredByAura->GetEffIndex()];
- if(!roll_chance_i(chance))
+ if (!roll_chance_i(chance))
return false;
triggered_spell_id = 24406;
@@ -6575,7 +6575,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Holy Power (Redemption Armor set)
case 28789:
{
- if(!pVictim)
+ if (!pVictim)
return false;
// Set class defined buff
@@ -6620,7 +6620,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Seal of Vengeance (damage calc on apply aura)
case 31801:
{
- if(effIndex != 0) // effect 1,2 used by seal unleashing code
+ if (effIndex != 0) // effect 1,2 used by seal unleashing code
return false;
// At melee attack or Hammer of the Righteous spell damage considered as melee attack
@@ -6645,7 +6645,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Seal of Corruption
case 53736:
{
- if(effIndex != 0) // effect 1,2 used by seal unleashing code
+ if (effIndex != 0) // effect 1,2 used by seal unleashing code
return false;
// At melee attack or Hammer of the Righteous spell damage considered as melee attack
@@ -6672,27 +6672,27 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
case 33776:
{
// if healed by another unit (pVictim)
- if(this == pVictim)
+ if (this == pVictim)
return false;
// heal amount
basepoints0 = triggerAmount*(std::min(damage,GetMaxHealth() - GetHealth()))/100;
target = this;
- if(basepoints0)
+ if (basepoints0)
triggered_spell_id = 31786;
break;
}
// Paladin Tier 6 Trinket (Ashtongue Talisman of Zeal)
case 40470:
{
- if( !procSpell )
+ if ( !procSpell )
return false;
float chance;
// Flash of light/Holy light
- if( procSpell->SpellFamilyFlags[0] & 0xC0000000)
+ if ( procSpell->SpellFamilyFlags[0] & 0xC0000000)
{
triggered_spell_id = 40471;
chance = 15.0f;
@@ -6776,7 +6776,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Totemic Power (The Earthshatterer set)
case 28823:
{
- if( !pVictim )
+ if ( !pVictim )
return false;
// Set class defined buff
@@ -6814,11 +6814,11 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Windfury Weapon (Passive) 1-5 Ranks
case 33757:
{
- if(GetTypeId()!=TYPEID_PLAYER || !castItem || !castItem->IsEquipped() || !pVictim || !pVictim->isAlive())
+ if (GetTypeId()!=TYPEID_PLAYER || !castItem || !castItem->IsEquipped() || !pVictim || !pVictim->isAlive())
return false;
// custom cooldown processing case
- if( cooldown && this->ToPlayer()->HasSpellCooldown(dummySpell->Id))
+ if ( cooldown && this->ToPlayer()->HasSpellCooldown(dummySpell->Id))
return false;
if (triggeredByAura->GetBase() && castItem->GetGUID() != triggeredByAura->GetBase()->GetCastItemGUID())
@@ -6863,7 +6863,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
}
SpellEntry const* windfurySpellEntry = sSpellStore.LookupEntry(spellId);
- if(!windfurySpellEntry)
+ if (!windfurySpellEntry)
{
sLog.outError("Unit::HandleDummyAuraProc: non existed spell id: %u (Windfury)",spellId);
return false;
@@ -6876,7 +6876,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
triggered_spell_id = 25504;
// apply cooldown before cast to prevent processing itself
- if( cooldown )
+ if ( cooldown )
this->ToPlayer()->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
// Attack Twice
@@ -6932,7 +6932,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
{
// Cast on owner
target = GetOwner();
- if(!target)
+ if (!target)
return false;
basepoints0 = triggerAmount * damage / 100;
triggered_spell_id = 58879;
@@ -6962,7 +6962,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if (dummySpell->SpellIconID == 3063)
{
// Earthbind Totem summon only
- if(procSpell->Id != 2484)
+ if (procSpell->Id != 2484)
return false;
float chance = triggerAmount;
@@ -6981,7 +6981,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
break;
}
// Earth Shield
- if(dummySpell->SpellFamilyFlags[1] & 0x00000400)
+ if (dummySpell->SpellFamilyFlags[1] & 0x00000400)
{
// 3.0.8: Now correctly uses the Shaman's own spell critical strike chance to determine the chance of a critical heal.
originalCaster = triggeredByAura->GetCasterGUID();
@@ -7000,7 +7000,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Flametongue Weapon (Passive)
if (dummySpell->SpellFamilyFlags[0] & 0x200000)
{
- if(GetTypeId()!=TYPEID_PLAYER || !pVictim || !pVictim->isAlive() || !castItem || !castItem->IsEquipped())
+ if (GetTypeId()!=TYPEID_PLAYER || !pVictim || !pVictim->isAlive() || !castItem || !castItem->IsEquipped())
return false;
// firehit = dummySpell->EffectBasePoints[0] / ((4*19.25) * 1.3);
@@ -7067,11 +7067,11 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Lightning Overload
if (dummySpell->SpellIconID == 2018) // only this spell have SpellFamily Shaman SpellIconID == 2018 and dummy aura
{
- if(!procSpell || GetTypeId() != TYPEID_PLAYER || !pVictim )
+ if (!procSpell || GetTypeId() != TYPEID_PLAYER || !pVictim )
return false;
// custom cooldown processing case
- if( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(dummySpell->Id))
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(dummySpell->Id))
return false;
uint32 spellId = 0;
@@ -7125,13 +7125,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
this->ToPlayer()->AddSpellMod(mod, false);
- if( cooldown && GetTypeId() == TYPEID_PLAYER )
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER )
this->ToPlayer()->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
return true;
}
// Static Shock
- if(dummySpell->SpellIconID == 3059)
+ if (dummySpell->SpellIconID == 3059)
{
// Lightning Shield
if (AuraEffect const * aurEff = GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0x400, 0, 0))
@@ -7329,7 +7329,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
{
// check if shown in spell book
- if(!itr->second->active || itr->second->disabled || itr->second->state == PLAYERSPELL_REMOVED)
+ if (!itr->second->active || itr->second->disabled || itr->second->state == PLAYERSPELL_REMOVED)
continue;
SpellEntry const *spellProto = sSpellStore.LookupEntry(itr->first);
@@ -7410,30 +7410,30 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
}
// processed charge only counting case
- if(!triggered_spell_id)
+ if (!triggered_spell_id)
return true;
SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
- if(!triggerEntry)
+ if (!triggerEntry)
{
sLog.outError("Unit::HandleDummyAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id);
return false;
}
// default case
- if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
+ if ((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
return false;
- if( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id))
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id))
return false;
- if(basepoints0)
+ if (basepoints0)
CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura, originalCaster);
else
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura, originalCaster);
- if( cooldown && GetTypeId() == TYPEID_PLAYER )
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER )
this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return true;
@@ -7468,30 +7468,30 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect*
}
}
// processed charge only counting case
- if(!triggered_spell_id)
+ if (!triggered_spell_id)
return true;
SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
// Try handle unknown trigger spells
- if(!triggerEntry)
+ if (!triggerEntry)
{
sLog.outError("Unit::HandleObsModEnergyAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id);
return false;
}
// default case
- if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
+ if ((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
return false;
- if( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id))
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id))
return false;
- if(basepoints0)
+ if (basepoints0)
CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
else
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura);
- if( cooldown && GetTypeId() == TYPEID_PLAYER )
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER )
this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return true;
}
@@ -7526,30 +7526,30 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEff
}
}
// processed charge only counting case
- if(!triggered_spell_id)
+ if (!triggered_spell_id)
return true;
SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
- if(!triggerEntry)
+ if (!triggerEntry)
{
sLog.outError("Unit::HandleModDamagePctTakenAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id);
return false;
}
// default case
- if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
+ if ((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
return false;
- if( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id))
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id))
return false;
- if(basepoints0)
+ if (basepoints0)
CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
else
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura);
- if( cooldown && GetTypeId() == TYPEID_PLAYER )
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER )
this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return true;
@@ -7614,7 +7614,7 @@ bool Unit::HandleAuraProc(Unit *pVictim, uint32 damage, Aura * triggeredByAura,
// Convert recently used Blood Rune to Death Rune
if (GetTypeId() == TYPEID_PLAYER)
{
- if(this->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT)
+ if (this->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT)
return false;
RuneType rune = this->ToPlayer()->GetLastUsedRune();
// can't proc from death rune use
@@ -7688,7 +7688,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
Unit* target = NULL;
int32 basepoints0 = 0;
- if(triggeredByAura->GetAuraType() == SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE)
+ if (triggeredByAura->GetAuraType() == SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE)
basepoints0 = triggerAmount;
Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
@@ -7888,7 +7888,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
return false;
}
SpellEntry const *TriggerPS = sSpellStore.LookupEntry(trigger_spell_id);
- if(!TriggerPS)
+ if (!TriggerPS)
return false;
basepoints0 = int32(damage * triggerAmount / 100 / (GetSpellMaxDuration(TriggerPS) / TriggerPS->EffectAmplitude[0]));
target = pVictim;
@@ -7916,14 +7916,14 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
// Lightning Capacitor
case 37657:
{
- if(!pVictim || !pVictim->isAlive())
+ if (!pVictim || !pVictim->isAlive())
return false;
// stacking
CastSpell(this, 37658, true, NULL, triggeredByAura);
Aura * dummy = GetAura(37658);
// release at 3 aura in stack (cont contain in basepoint of trigger aura)
- if(!dummy || dummy->GetStackAmount() < triggerAmount)
+ if (!dummy || dummy->GetStackAmount() < triggerAmount)
return false;
RemoveAurasDueToSpell(37658);
@@ -7934,7 +7934,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
// Thunder Capacitor
case 54841:
{
- if(!pVictim || !pVictim->isAlive())
+ if (!pVictim || !pVictim->isAlive())
return false;
// stacking
CastSpell(this, 54842, true, NULL, triggeredByAura);
@@ -7942,7 +7942,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
// counting
Aura * dummy = GetAura(54842);
// release at 3 aura in stack (cont contain in basepoint of trigger aura)
- if(!dummy || dummy->GetStackAmount() < triggerAmount)
+ if (!dummy || dummy->GetStackAmount() < triggerAmount)
return false;
RemoveAurasDueToSpell(54842);
@@ -7954,12 +7954,12 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
// Illumination
if (auraSpellInfo->SpellIconID==241)
{
- if(!procSpell)
+ if (!procSpell)
return false;
// procspell is triggered spell but we need mana cost of original casted spell
uint32 originalSpellId = procSpell->Id;
// Holy Shock heal
- if(procSpell->SpellFamilyFlags[1] & 0x00010000)
+ if (procSpell->SpellFamilyFlags[1] & 0x00010000)
{
switch(procSpell->Id)
{
@@ -7976,7 +7976,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
}
}
SpellEntry const *originalSpell = sSpellStore.LookupEntry(originalSpellId);
- if(!originalSpell)
+ if (!originalSpell)
{
sLog.outError("Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu",originalSpellId);
return false;
@@ -8011,7 +8011,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
// Mana Surge (The Earthfury set)
case 23572:
{
- if(!procSpell)
+ if (!procSpell)
return false;
basepoints0 = procSpell->manaCost * 35 / 100;
trigger_spell_id = 23571;
@@ -8021,7 +8021,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
default:
{
// Lightning Shield (overwrite non existing triggered spell call in spell.dbc
- if(auraSpellInfo->SpellFamilyFlags[0] & 0x400)
+ if (auraSpellInfo->SpellFamilyFlags[0] & 0x400)
{
trigger_spell_id = spellmgr.GetSpellWithRank(26364, spellmgr.GetSpellRank(auraSpellInfo->Id));
}
@@ -8032,7 +8032,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
if (!(10*(int32(GetHealth() - damage)) < 3 * GetMaxHealth()))
return false;
- if(pVictim && pVictim->isAlive())
+ if (pVictim && pVictim->isAlive())
pVictim->getThreatManager().modifyThreatPercent(this,-10);
basepoints0 = triggerAmount * GetMaxHealth() / 100;
@@ -8090,7 +8090,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
}
// not allow proc extra attack spell at extra attack
- if( m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS) )
+ if ( m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS) )
return false;
// Custom requirements (not listed in procEx) Warning! damage dealing after this
@@ -8109,14 +8109,14 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
// Unyielding Knights (item exploit 29108\29109)
case 38164:
{
- if(pVictim->GetEntry() != 19457) // Proc only if you target is Grillok
+ if (pVictim->GetEntry() != 19457) // Proc only if you target is Grillok
return false;
break;
}
// Deflection
case 52420:
{
- if(GetHealth()*100 / GetMaxHealth() >= 35)
+ if (GetHealth()*100 / GetMaxHealth() >= 35)
return false;
break;
}
@@ -8190,7 +8190,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
case 63156:
case 63158:
// Can proc only if target has hp below 35%
- if(!pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, procSpell, this))
+ if (!pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, procSpell, this))
return false;
break;
}
@@ -8225,15 +8225,15 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
case 52916:
{
target = triggeredByAura->GetBase()->GetCaster();
- if(!target)
+ if (!target)
return false;
- if( cooldown && GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->HasSpellCooldown(trigger_spell_id))
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->HasSpellCooldown(trigger_spell_id))
return false;
target->CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura);
- if( cooldown && GetTypeId() == TYPEID_PLAYER )
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER )
this->ToPlayer()->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown);
return true;
}
@@ -8249,7 +8249,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
// Combo points add triggers (need add combopoint only for main target, and after possible combopoints reset)
case 15250: // Rogue Setup
{
- if(!pVictim || pVictim != getVictim()) // applied only for main target
+ if (!pVictim || pVictim != getVictim()) // applied only for main target
return false;
break; // continue normal case
}
@@ -8277,7 +8277,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
// Enlightenment (trigger only from mana cost spells)
case 35095:
{
- if(!procSpell || procSpell->powerType!=POWER_MANA || procSpell->manaCost==0 && procSpell->ManaCostPercentage==0 && procSpell->manaCostPerlevel==0)
+ if (!procSpell || procSpell->powerType!=POWER_MANA || procSpell->manaCost==0 && procSpell->ManaCostPercentage==0 && procSpell->manaCostPerlevel==0)
return false;
break;
}
@@ -8312,7 +8312,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
// PPM = 2.5 * (rank of talent),
uint32 rank = spellmgr.GetSpellRank(auraSpellInfo->Id);
// 5 rank -> 100% 4 rank -> 80% and etc from full rate
- if(!roll_chance_i(20*rank))
+ if (!roll_chance_i(20*rank))
return false;
break;
}
@@ -8330,7 +8330,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
// Burning Determination
case 54748:
{
- if(!procSpell)
+ if (!procSpell)
return false;
// Need Interrupt or Silenced mechanic
if (!(GetAllSpellMechanicMask(procSpell) & ((1<<MECHANIC_INTERRUPT)|(1<<MECHANIC_SILENCE))))
@@ -8378,7 +8378,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
}
}
- if( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(trigger_spell_id))
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(trigger_spell_id))
return false;
// try detect target manually if not set
@@ -8386,15 +8386,15 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
target = !(procFlags & (PROC_FLAG_SUCCESSFUL_POSITIVE_MAGIC_SPELL | PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL_HIT)) && IsPositiveSpell(trigger_spell_id) ? this : pVictim;
// default case
- if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
+ if ((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
return false;
- if(basepoints0)
+ if (basepoints0)
CastCustomSpell(target,trigger_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
else
CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura);
- if( cooldown && GetTypeId() == TYPEID_PLAYER )
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER )
this->ToPlayer()->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown);
return true;
@@ -8404,7 +8404,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraE
{
int32 scriptId = triggeredByAura->GetMiscValue();
- if(!pVictim || !pVictim->isAlive())
+ if (!pVictim || !pVictim->isAlive())
return false;
Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
@@ -8475,24 +8475,24 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraE
}
// not processed
- if(!triggered_spell_id)
+ if (!triggered_spell_id)
return false;
// standard non-dummy case
SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
- if(!triggerEntry)
+ if (!triggerEntry)
{
sLog.outError("Unit::HandleOverrideClassScriptAuraProc: Spell %u triggering for class script id %u",triggered_spell_id,scriptId);
return false;
}
- if( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id))
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id))
return false;
CastSpell(pVictim, triggered_spell_id, true, castItem, triggeredByAura);
- if( cooldown && GetTypeId() == TYPEID_PLAYER )
+ if ( cooldown && GetTypeId() == TYPEID_PLAYER )
this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return true;
@@ -8502,18 +8502,18 @@ void Unit::setPowerType(Powers new_powertype)
{
SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype);
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
{
- if(this->ToPlayer()->GetGroup())
+ if (this->ToPlayer()->GetGroup())
this->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POWER_TYPE);
}
- else if(this->ToCreature()->isPet())
+ else if (this->ToCreature()->isPet())
{
Pet *pet = ((Pet*)this);
- if(pet->isControlled())
+ if (pet->isControlled())
{
Unit *owner = GetOwner();
- if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup())
+ if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup())
owner->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_POWER_TYPE);
}
}
@@ -8544,11 +8544,11 @@ void Unit::setPowerType(Powers new_powertype)
FactionTemplateEntry const* Unit::getFactionTemplateEntry() const
{
FactionTemplateEntry const* entry = sFactionTemplateStore.LookupEntry(getFaction());
- if(!entry)
+ if (!entry)
{
static uint64 guid = 0; // prevent repeating spam same faction problem
- if(GetGUID() != guid)
+ if (GetGUID() != guid)
{
if (const Player *player = ToPlayer())
sLog.outError("Player %s has invalid faction (faction template id) #%u", player->GetName(), getFaction());
@@ -8565,18 +8565,18 @@ FactionTemplateEntry const* Unit::getFactionTemplateEntry() const
bool Unit::IsHostileTo(Unit const* unit) const
{
- if(!unit)
+ if (!unit)
return false;
// always non-hostile to self
- if(unit==this)
+ if (unit==this)
return false;
// always non-hostile to GM in GM mode
- if(unit->GetTypeId() == TYPEID_PLAYER && ((Player const*)unit)->isGameMaster())
+ if (unit->GetTypeId() == TYPEID_PLAYER && ((Player const*)unit)->isGameMaster())
return false;
// always hostile to enemy
- if(getVictim()==unit || unit->getVictim()==this)
+ if (getVictim()==unit || unit->getVictim()==this)
return true;
// test pet/charm masters instead pers/charmeds
@@ -8584,51 +8584,51 @@ bool Unit::IsHostileTo(Unit const* unit) const
Unit const* targetOwner = unit->GetCharmerOrOwner();
// always hostile to owner's enemy
- if(testerOwner && (testerOwner->getVictim()==unit || unit->getVictim()==testerOwner))
+ if (testerOwner && (testerOwner->getVictim()==unit || unit->getVictim()==testerOwner))
return true;
// always hostile to enemy owner
- if(targetOwner && (getVictim()==targetOwner || targetOwner->getVictim()==this))
+ if (targetOwner && (getVictim()==targetOwner || targetOwner->getVictim()==this))
return true;
// always hostile to owner of owner's enemy
- if(testerOwner && targetOwner && (testerOwner->getVictim()==targetOwner || targetOwner->getVictim()==testerOwner))
+ if (testerOwner && targetOwner && (testerOwner->getVictim()==targetOwner || targetOwner->getVictim()==testerOwner))
return true;
Unit const* tester = testerOwner ? testerOwner : this;
Unit const* target = targetOwner ? targetOwner : unit;
// always non-hostile to target with common owner, or to owner/pet
- if(tester==target)
+ if (tester==target)
return false;
// special cases (Duel, etc)
- if(tester->GetTypeId() == TYPEID_PLAYER && target->GetTypeId() == TYPEID_PLAYER)
+ if (tester->GetTypeId() == TYPEID_PLAYER && target->GetTypeId() == TYPEID_PLAYER)
{
Player const* pTester = (Player const*)tester;
Player const* pTarget = (Player const*)target;
// Duel
- if(pTester->duel && pTester->duel->opponent == pTarget && pTester->duel->startTime != 0)
+ if (pTester->duel && pTester->duel->opponent == pTarget && pTester->duel->startTime != 0)
return true;
// Group
- if(pTester->GetGroup() && pTester->GetGroup()==pTarget->GetGroup())
+ if (pTester->GetGroup() && pTester->GetGroup()==pTarget->GetGroup())
return false;
// Sanctuary
- if(pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY) && pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY))
+ if (pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY) && pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY))
return false;
// PvP FFA state
- if(pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) && pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
+ if (pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) && pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
return true;
//= PvP states
// Green/Blue (can't attack)
if (!pTester->HasAuraType(SPELL_AURA_MOD_FACTION) && !pTarget->HasAuraType(SPELL_AURA_MOD_FACTION))
{
- if(pTester->GetTeam()==pTarget->GetTeam())
+ if (pTester->GetTeam()==pTarget->GetTeam())
return false;
// Red (can attack) if true, Blue/Yellow (can't attack) in another case
@@ -8639,39 +8639,39 @@ bool Unit::IsHostileTo(Unit const* unit) const
// faction base cases
FactionTemplateEntry const*tester_faction = tester->getFactionTemplateEntry();
FactionTemplateEntry const*target_faction = target->getFactionTemplateEntry();
- if(!tester_faction || !target_faction)
+ if (!tester_faction || !target_faction)
return false;
- if(target->isAttackingPlayer() && tester->IsContestedGuard())
+ if (target->isAttackingPlayer() && tester->IsContestedGuard())
return true;
// PvC forced reaction and reputation case
- if(tester->GetTypeId() == TYPEID_PLAYER && !tester->HasAuraType(SPELL_AURA_MOD_FACTION))
+ if (tester->GetTypeId() == TYPEID_PLAYER && !tester->HasAuraType(SPELL_AURA_MOD_FACTION))
{
// forced reaction
- if(target_faction->faction)
+ if (target_faction->faction)
{
- if(ReputationRank const* force =tester->ToPlayer()->GetReputationMgr().GetForcedRankIfAny(target_faction))
+ if (ReputationRank const* force =tester->ToPlayer()->GetReputationMgr().GetForcedRankIfAny(target_faction))
return *force <= REP_HOSTILE;
// if faction have reputation then hostile state for tester at 100% dependent from at_war state
- if(FactionEntry const* raw_target_faction = sFactionStore.LookupEntry(target_faction->faction))
- if(FactionState const* factionState = tester->ToPlayer()->GetReputationMgr().GetState(raw_target_faction))
+ if (FactionEntry const* raw_target_faction = sFactionStore.LookupEntry(target_faction->faction))
+ if (FactionState const* factionState = tester->ToPlayer()->GetReputationMgr().GetState(raw_target_faction))
return (factionState->Flags & FACTION_FLAG_AT_WAR);
}
}
// CvP forced reaction and reputation case
- else if(target->GetTypeId() == TYPEID_PLAYER && !target->HasAuraType(SPELL_AURA_MOD_FACTION))
+ else if (target->GetTypeId() == TYPEID_PLAYER && !target->HasAuraType(SPELL_AURA_MOD_FACTION))
{
// forced reaction
- if(tester_faction->faction)
+ if (tester_faction->faction)
{
- if(ReputationRank const* force = target->ToPlayer()->GetReputationMgr().GetForcedRankIfAny(tester_faction))
+ if (ReputationRank const* force = target->ToPlayer()->GetReputationMgr().GetForcedRankIfAny(tester_faction))
return *force <= REP_HOSTILE;
// apply reputation state
FactionEntry const* raw_tester_faction = sFactionStore.LookupEntry(tester_faction->faction);
- if(raw_tester_faction && raw_tester_faction->reputationListID >=0 )
+ if (raw_tester_faction && raw_tester_faction->reputationListID >=0 )
return ((Player const*)target)->GetReputationMgr().GetRank(raw_tester_faction) <= REP_HOSTILE;
}
}
@@ -8683,15 +8683,15 @@ bool Unit::IsHostileTo(Unit const* unit) const
bool Unit::IsFriendlyTo(Unit const* unit) const
{
// always friendly to self
- if(unit==this)
+ if (unit==this)
return true;
// always friendly to GM in GM mode
- if(unit->GetTypeId() == TYPEID_PLAYER && ((Player const*)unit)->isGameMaster())
+ if (unit->GetTypeId() == TYPEID_PLAYER && ((Player const*)unit)->isGameMaster())
return true;
// always non-friendly to enemy
- if(getVictim()==unit || unit->getVictim()==this)
+ if (getVictim()==unit || unit->getVictim()==this)
return false;
// test pet/charm masters instead pers/charmeds
@@ -8699,51 +8699,51 @@ bool Unit::IsFriendlyTo(Unit const* unit) const
Unit const* targetOwner = unit->GetCharmerOrOwner();
// always non-friendly to owner's enemy
- if(testerOwner && (testerOwner->getVictim()==unit || unit->getVictim()==testerOwner))
+ if (testerOwner && (testerOwner->getVictim()==unit || unit->getVictim()==testerOwner))
return false;
// always non-friendly to enemy owner
- if(targetOwner && (getVictim()==targetOwner || targetOwner->getVictim()==this))
+ if (targetOwner && (getVictim()==targetOwner || targetOwner->getVictim()==this))
return false;
// always non-friendly to owner of owner's enemy
- if(testerOwner && targetOwner && (testerOwner->getVictim()==targetOwner || targetOwner->getVictim()==testerOwner))
+ if (testerOwner && targetOwner && (testerOwner->getVictim()==targetOwner || targetOwner->getVictim()==testerOwner))
return false;
Unit const* tester = testerOwner ? testerOwner : this;
Unit const* target = targetOwner ? targetOwner : unit;
// always friendly to target with common owner, or to owner/pet
- if(tester==target)
+ if (tester==target)
return true;
// special cases (Duel)
- if(tester->GetTypeId() == TYPEID_PLAYER && target->GetTypeId() == TYPEID_PLAYER)
+ if (tester->GetTypeId() == TYPEID_PLAYER && target->GetTypeId() == TYPEID_PLAYER)
{
Player const* pTester = (Player const*)tester;
Player const* pTarget = (Player const*)target;
// Duel
- if(pTester->duel && pTester->duel->opponent == target && pTester->duel->startTime != 0)
+ if (pTester->duel && pTester->duel->opponent == target && pTester->duel->startTime != 0)
return false;
// Group
- if(pTester->GetGroup() && pTester->GetGroup()==pTarget->GetGroup())
+ if (pTester->GetGroup() && pTester->GetGroup()==pTarget->GetGroup())
return true;
// Sanctuary
- if(pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY) && pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY))
+ if (pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY) && pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY))
return true;
// PvP FFA state
- if(pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) && pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
+ if (pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) && pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
return false;
//= PvP states
// Green/Blue (non-attackable)
if (!pTester->HasAuraType(SPELL_AURA_MOD_FACTION) && !pTarget->HasAuraType(SPELL_AURA_MOD_FACTION))
{
- if(pTester->GetTeam()==pTarget->GetTeam())
+ if (pTester->GetTeam()==pTarget->GetTeam())
return true;
// Blue (friendly/non-attackable) if not PVP, or Yellow/Red in another case (attackable)
@@ -8823,31 +8823,31 @@ bool Unit::IsNeutralToAll() const
bool Unit::Attack(Unit *victim, bool meleeAttack)
{
- if(!victim || victim == this)
+ if (!victim || victim == this)
return false;
// dead units can neither attack nor be attacked
- if(!isAlive() || !victim->IsInWorld() || !victim->isAlive())
+ if (!isAlive() || !victim->IsInWorld() || !victim->isAlive())
return false;
// player cannot attack in mount state
- if(GetTypeId() == TYPEID_PLAYER && IsMounted())
+ if (GetTypeId() == TYPEID_PLAYER && IsMounted())
return false;
// nobody can attack GM in GM-mode
- if(victim->GetTypeId() == TYPEID_PLAYER)
+ if (victim->GetTypeId() == TYPEID_PLAYER)
{
- if(victim->ToPlayer()->isGameMaster())
+ if (victim->ToPlayer()->isGameMaster())
return false;
}
else
{
- if(victim->ToCreature()->IsInEvadeMode())
+ if (victim->ToCreature()->IsInEvadeMode())
return false;
}
// remove SPELL_AURA_MOD_UNATTACKABLE at attack (in case non-interruptible spells stun aura applied also that not let attack)
- if(HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
+ if (HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
RemoveAurasByType(SPELL_AURA_MOD_UNATTACKABLE);
if (m_attacking)
@@ -8892,7 +8892,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
addUnitState(UNIT_STAT_MELEE_ATTACKING);
// set position before any AI calls/assistance
- //if(GetTypeId() == TYPEID_UNIT)
+ //if (GetTypeId() == TYPEID_UNIT)
// this->ToCreature()->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
if (GetTypeId() == TYPEID_UNIT)
@@ -8908,7 +8908,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
}
// delay offhand weapon attack to next attack time
- if(haveOffhandWeapon())
+ if (haveOffhandWeapon())
resetAttackTimer(OFF_ATTACK);
if (meleeAttack)
@@ -9213,7 +9213,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
{
}
}
- //else if(minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
+ //else if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
// AddUInt64Value(UNIT_FIELD_CRITTER, minion->GetGUID());
// PvP, FFAPvP
@@ -9272,7 +9272,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
this->ToPlayer()->SendCooldownEvent(spellInfo);
}
- //if(minion->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
+ //if (minion->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
{
if (RemoveUInt64Value(UNIT_FIELD_SUMMON, minion->GetGUID()))
{
@@ -9280,7 +9280,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
for (ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
{
// do not use this check, creature do not have charm guid
- //if(GetCharmGUID() == (*itr)->GetGUID())
+ //if (GetCharmGUID() == (*itr)->GetGUID())
if (GetGUID() == (*itr)->GetCharmerGUID())
continue;
@@ -9311,7 +9311,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
}
}
}
- //else if(minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
+ //else if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
// RemoveUInt64Value(UNIT_FIELD_CRITTER, minion->GetGUID());
}
}
@@ -9388,7 +9388,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
charm->ToPlayer()->UpdatePvPState();
}
- else if(Player *player = charm->GetCharmerOrOwnerPlayerOrPlayerItself())
+ else if (Player *player = charm->GetCharmerOrOwnerPlayerOrPlayerItself())
{
charm->m_ControlledByPlayer = true;
charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
@@ -11233,9 +11233,9 @@ void Unit::Mount(uint32 mount, uint32 VehicleId)
this->ToPlayer()->UnsummonPetTemporaryIfAny();
}
- if(VehicleId !=0)
+ if (VehicleId !=0)
{
- if(VehicleEntry const *ve = sVehicleStore.LookupEntry(VehicleId))
+ if (VehicleEntry const *ve = sVehicleStore.LookupEntry(VehicleId))
{
if (CreateVehicleKit(VehicleId))
@@ -11280,7 +11280,7 @@ void Unit::Unmount()
else
this->ToPlayer()->ResummonPetTemporaryUnSummonedIfAny();
}
- if(GetTypeId()==TYPEID_PLAYER && GetVehicleKit())
+ if (GetTypeId()==TYPEID_PLAYER && GetVehicleKit())
{
// Send other players that we are no longer a vehicle
WorldPacket data( SMSG_PLAYER_VEHICLE_DATA, 8+4 );
@@ -11442,7 +11442,7 @@ bool Unit::canAttack(Unit const* target, bool force) const
else if (!IsHostileTo(target))
return false;
- //if(m_Vehicle && m_Vehicle == target->m_Vehicle)
+ //if (m_Vehicle && m_Vehicle == target->m_Vehicle)
// return true;
if (!target->isAttackableByAOE() || target->hasUnitState(UNIT_STAT_DIED))
@@ -12459,7 +12459,7 @@ void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Un
if (group == DIMINISHING_TAUNT)
{
- if(GetTypeId() == TYPEID_UNIT && (((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TAUNT_DIMINISH))
+ if (GetTypeId() == TYPEID_UNIT && (((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TAUNT_DIMINISH))
{
DiminishingLevels diminish = Level;
switch(diminish)
@@ -15224,8 +15224,8 @@ Unit *Unit::GetVehicleBase() const
Creature *Unit::GetVehicleCreatureBase() const
{
- if( Unit *veh = GetVehicleBase())
- if( Creature *c = veh->ToCreature())
+ if ( Unit *veh = GetVehicleBase())
+ if ( Creature *c = veh->ToCreature())
return c;
return NULL;
@@ -15550,7 +15550,7 @@ float Unit::GetCombatRatingReduction(CombatRating cr) const
{
// Player's pet get resilience from owner
if (Unit* owner = GetOwner())
- if(owner->GetTypeId() == TYPEID_PLAYER)
+ if (owner->GetTypeId() == TYPEID_PLAYER)
return ((Player*)owner)->GetRatingBonusValue(cr);
}
@@ -15644,7 +15644,7 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form)
return 8571;
}
}
- else if(Player::TeamForRace(getRace())==ALLIANCE)
+ else if (Player::TeamForRace(getRace())==ALLIANCE)
return 892;
else
return 8571;
@@ -15723,14 +15723,14 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form)
return 2289;
}
}
- else if(Player::TeamForRace(getRace())==ALLIANCE)
+ else if (Player::TeamForRace(getRace())==ALLIANCE)
return 2281;
else
return 2289;
case FORM_TRAVEL:
return 632;
case FORM_AQUA:
- if(Player::TeamForRace(getRace())==ALLIANCE)
+ if (Player::TeamForRace(getRace())==ALLIANCE)
return 2428;
else
return 2428;
@@ -15741,17 +15741,17 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form)
case FORM_GHOSTWOLF:
return 4613;
case FORM_FLIGHT:
- if(Player::TeamForRace(getRace())==ALLIANCE)
+ if (Player::TeamForRace(getRace())==ALLIANCE)
return 20857;
else
return 20872;
case FORM_MOONKIN:
- if(Player::TeamForRace(getRace())==ALLIANCE)
+ if (Player::TeamForRace(getRace())==ALLIANCE)
return 15374;
else
return 15375;
case FORM_FLIGHT_EPIC:
- if(Player::TeamForRace(getRace())==ALLIANCE)
+ if (Player::TeamForRace(getRace())==ALLIANCE)
return 21243;
else
return 21244;
@@ -15841,8 +15841,8 @@ void Unit::EnterVehicle(Vehicle *vehicle, int8 seatId)
this->ToPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED);
// drop flag at invisible in bg
- if(this->ToPlayer()->InBattleGround())
- if(BattleGround *bg = this->ToPlayer()->GetBattleGround())
+ if (this->ToPlayer()->InBattleGround())
+ if (BattleGround *bg = this->ToPlayer()->GetBattleGround())
bg->EventPlayerDroppedFlag(this->ToPlayer());
}
@@ -16073,12 +16073,12 @@ bool Unit::SetPosition(float x, float y, float z, float orientation, bool telepo
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE);
// move and update visible state if need
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
GetMap()->PlayerRelocation((Player*)this, x, y, z, orientation);
else
GetMap()->CreatureRelocation(this->ToCreature(), x, y, z, orientation);
}
- else if(turn)
+ else if (turn)
SetOrientation(orientation);
if ((relocated || turn) && IsVehicle())
diff --git a/src/game/Unit.h b/src/game/Unit.h
index de03bac1cfd..dfe124652b6 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1243,7 +1243,7 @@ class Unit : public WorldObject
void GetRaidMember(std::list<Unit*> &units, float dist);
bool IsContestedGuard() const
{
- if(FactionTemplateEntry const* entry = getFactionTemplateEntry())
+ if (FactionTemplateEntry const* entry = getFactionTemplateEntry())
return entry->IsContestedGuardFaction();
return false;
@@ -1251,7 +1251,7 @@ class Unit : public WorldObject
bool IsPvP() const { return HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP); }
void SetPvP(bool state)
{
- if(state)
+ if (state)
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP);
else
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP);
@@ -1470,7 +1470,7 @@ class Unit : public WorldObject
uint64 GetCharmerOrOwnerGUID() const { return GetCharmerGUID() ? GetCharmerGUID() : GetOwnerGUID(); }
uint64 GetCharmerOrOwnerOrOwnGUID() const
{
- if(uint64 guid = GetCharmerOrOwnerGUID())
+ if (uint64 guid = GetCharmerOrOwnerGUID())
return guid;
return GetGUID();
}
@@ -1486,7 +1486,7 @@ class Unit : public WorldObject
Unit* GetCharmerOrOwner() const { return GetCharmerGUID() ? GetCharmer() : GetOwner(); }
Unit* GetCharmerOrOwnerOrSelf() const
{
- if(Unit *u = GetCharmerOrOwner())
+ if (Unit *u = GetCharmerOrOwner())
return u;
return (Unit*)this;
@@ -1511,7 +1511,7 @@ class Unit : public WorldObject
bool isPossessedByPlayer() const { return hasUnitState(UNIT_STAT_POSSESSED) && IS_PLAYER_GUID(GetCharmerGUID()); }
bool isPossessing() const
{
- if(Unit *u = GetCharm())
+ if (Unit *u = GetCharm())
return u->isPossessed();
else
return false;
@@ -1719,7 +1719,7 @@ class Unit : public WorldObject
bool isInFrontInMap(Unit const* target,float distance, float arc = M_PI) const;
void SetInFront(Unit const* target)
{
- if(!hasUnitState(UNIT_STAT_CANNOT_TURN))
+ if (!hasUnitState(UNIT_STAT_CANNOT_TURN))
SetOrientation(GetAngle(target));
}
bool isInBackInMap(Unit const* target, float distance, float arc = M_PI) const;
@@ -1760,7 +1760,7 @@ class Unit : public WorldObject
AuraApplication * GetVisibleAura(uint8 slot)
{
VisibleAuraMap::iterator itr = m_visibleAuras.find(slot);
- if(itr != m_visibleAuras.end())
+ if (itr != m_visibleAuras.end())
return itr->second;
return 0;
}
@@ -1889,7 +1889,7 @@ class Unit : public WorldObject
bool CanProc(){return !m_procDeep;}
void SetCantProc( bool apply)
{
- if(apply)
+ if (apply)
++m_procDeep;
else
{
@@ -1957,10 +1957,10 @@ class Unit : public WorldObject
void OutDebugInfo() const;
virtual bool isBeingLoaded() const { return false;}
- Pet* ToPet(){ if(isPet()) return reinterpret_cast<Pet*>(this); else return NULL; }
- Totem* ToTotem(){ if(isTotem()) return reinterpret_cast<Totem*>(this); else return NULL; }
- TempSummon* ToTempSummon() { if(isSummon()) return reinterpret_cast<TempSummon*>(this); else return NULL; }
- const TempSummon* ToTempSummon() const { if(isSummon()) return reinterpret_cast<const TempSummon*>(this); else return NULL; }
+ Pet* ToPet(){ if (isPet()) return reinterpret_cast<Pet*>(this); else return NULL; }
+ Totem* ToTotem(){ if (isTotem()) return reinterpret_cast<Totem*>(this); else return NULL; }
+ TempSummon* ToTempSummon() { if (isSummon()) return reinterpret_cast<TempSummon*>(this); else return NULL; }
+ const TempSummon* ToTempSummon() const { if (isSummon()) return reinterpret_cast<const TempSummon*>(this); else return NULL; }
protected:
explicit Unit ();
diff --git a/src/game/UnitAI.cpp b/src/game/UnitAI.cpp
index 3eecf6a1c54..b66b725d462 100644
--- a/src/game/UnitAI.cpp
+++ b/src/game/UnitAI.cpp
@@ -28,19 +28,19 @@
void UnitAI::AttackStart(Unit *victim)
{
- if(victim && me->Attack(victim, true))
+ if (victim && me->Attack(victim, true))
me->GetMotionMaster()->MoveChase(victim);
}
void UnitAI::AttackStartCaster(Unit *victim, float dist)
{
- if(victim && me->Attack(victim, false))
+ if (victim && me->Attack(victim, false))
me->GetMotionMaster()->MoveChase(victim, dist);
}
void UnitAI::DoMeleeAttackIfReady()
{
- if(me->hasUnitState(UNIT_STAT_CASTING))
+ if (me->hasUnitState(UNIT_STAT_CASTING))
return;
//Make sure our attack is ready and we aren't currently casting before checking distance
@@ -66,12 +66,12 @@ void UnitAI::DoMeleeAttackIfReady()
bool UnitAI::DoSpellAttackIfReady(uint32 spell)
{
- if(me->hasUnitState(UNIT_STAT_CASTING))
+ if (me->hasUnitState(UNIT_STAT_CASTING))
return true;
- if(me->isAttackReady())
+ if (me->isAttackReady())
{
- if(me->IsWithinCombatRange(me->getVictim(), GetSpellMaxRange(spell, false)))
+ if (me->IsWithinCombatRange(me->getVictim(), GetSpellMaxRange(spell, false)))
{
me->CastSpell(me->getVictim(), spell, false);
me->resetAttackTimer();
@@ -229,11 +229,11 @@ void UnitAI::DoCast(uint32 spellId)
}
}
- if(target)
+ if (target)
me->CastSpell(target, spellId, false);
}
-#define UPDATE_TARGET(a) {if(AIInfo->target<a) AIInfo->target=a;}
+#define UPDATE_TARGET(a) {if (AIInfo->target<a) AIInfo->target=a;}
void UnitAI::FillAISpellInfo()
{
@@ -245,20 +245,20 @@ void UnitAI::FillAISpellInfo()
for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i, ++AIInfo)
{
spellInfo = GetSpellStore()->LookupEntry(i);
- if(!spellInfo)
+ if (!spellInfo)
continue;
- if(spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD)
+ if (spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD)
AIInfo->condition = AICOND_DIE;
- else if(IsPassiveSpell(i) || GetSpellDuration(spellInfo) == -1)
+ else if (IsPassiveSpell(i) || GetSpellDuration(spellInfo) == -1)
AIInfo->condition = AICOND_AGGRO;
else
AIInfo->condition = AICOND_COMBAT;
- if(AIInfo->cooldown < spellInfo->RecoveryTime)
+ if (AIInfo->cooldown < spellInfo->RecoveryTime)
AIInfo->cooldown = spellInfo->RecoveryTime;
- if(!GetSpellMaxRange(spellInfo, false))
+ if (!GetSpellMaxRange(spellInfo, false))
UPDATE_TARGET(AITARGET_SELF)
else
{
@@ -266,17 +266,17 @@ void UnitAI::FillAISpellInfo()
{
uint32 targetType = spellInfo->EffectImplicitTargetA[j];
- if(targetType == TARGET_UNIT_TARGET_ENEMY
+ if (targetType == TARGET_UNIT_TARGET_ENEMY
|| targetType == TARGET_DST_TARGET_ENEMY)
UPDATE_TARGET(AITARGET_VICTIM)
- else if(targetType == TARGET_UNIT_AREA_ENEMY_DST)
+ else if (targetType == TARGET_UNIT_AREA_ENEMY_DST)
UPDATE_TARGET(AITARGET_ENEMY)
- if(spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA)
+ if (spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA)
{
- if(targetType == TARGET_UNIT_TARGET_ENEMY)
+ if (targetType == TARGET_UNIT_TARGET_ENEMY)
UPDATE_TARGET(AITARGET_DEBUFF)
- else if(IsPositiveSpell(i))
+ else if (IsPositiveSpell(i))
UPDATE_TARGET(AITARGET_BUFF)
}
}
@@ -296,21 +296,21 @@ void SimpleCharmedAI::UpdateAI(const uint32 /*diff*/)
Creature *charmer = me->GetCharmer()->ToCreature();
//kill self if charm aura has infinite duration
- if(charmer->IsInEvadeMode())
+ if (charmer->IsInEvadeMode())
{
Unit::AuraEffectList const& auras = me->GetAuraEffectsByType(SPELL_AURA_MOD_CHARM);
for (Unit::AuraEffectList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
- if((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->GetBase()->IsPermanent())
+ if ((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->GetBase()->IsPermanent())
{
charmer->Kill(me);
return;
}
}
- if(!charmer->isInCombat())
+ if (!charmer->isInCombat())
me->GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, me->GetFollowAngle());
Unit *target = me->getVictim();
- if(!target || !charmer->canAttack(target))
+ if (!target || !charmer->canAttack(target))
AttackStart(charmer->SelectNearestTarget());
}
diff --git a/src/game/UnitAI.h b/src/game/UnitAI.h
index 099b3fb88fa..81f4442cfbd 100644
--- a/src/game/UnitAI.h
+++ b/src/game/UnitAI.h
@@ -51,7 +51,7 @@ class UnitAI
virtual void AttackStart(Unit *);
virtual void UpdateAI(const uint32 diff) = 0;
- virtual void InitializeAI() { if(!me->isDead()) Reset(); }
+ virtual void InitializeAI() { if (!me->isDead()) Reset(); }
virtual void Reset() {};
diff --git a/src/game/UpdateData.cpp b/src/game/UpdateData.cpp
index bb9ee79a076..cc3ae62db09 100644
--- a/src/game/UpdateData.cpp
+++ b/src/game/UpdateData.cpp
@@ -111,7 +111,7 @@ bool UpdateData::BuildPacket(WorldPacket *packet)
buf << (uint32) (!m_outOfRangeGUIDs.empty() ? m_blockCount + 1 : m_blockCount);
- if(!m_outOfRangeGUIDs.empty())
+ if (!m_outOfRangeGUIDs.empty())
{
buf << (uint8) UPDATETYPE_OUT_OF_RANGE_OBJECTS;
buf << (uint32) m_outOfRangeGUIDs.size();
diff --git a/src/game/UpdateMask.h b/src/game/UpdateMask.h
index 10683d8e6e5..3b46cdc03ea 100644
--- a/src/game/UpdateMask.h
+++ b/src/game/UpdateMask.h
@@ -32,7 +32,7 @@ class UpdateMask
~UpdateMask( )
{
- if(mUpdateMask)
+ if (mUpdateMask)
delete [] mUpdateMask;
}
@@ -58,7 +58,7 @@ class UpdateMask
void SetCount (uint32 valuesCount)
{
- if(mUpdateMask)
+ if (mUpdateMask)
delete [] mUpdateMask;
mCount = valuesCount;
diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp
index 5e860257d2e..f802bcfb04d 100644
--- a/src/game/Vehicle.cpp
+++ b/src/game/Vehicle.cpp
@@ -31,11 +31,11 @@ Vehicle::Vehicle(Unit *unit, VehicleEntry const *vehInfo) : me(unit), m_vehicleI
{
for (uint32 i = 0; i < 8; ++i)
{
- if(uint32 seatId = m_vehicleInfo->m_seatID[i])
- if(VehicleSeatEntry const *veSeat = sVehicleSeatStore.LookupEntry(seatId))
+ if (uint32 seatId = m_vehicleInfo->m_seatID[i])
+ if (VehicleSeatEntry const *veSeat = sVehicleSeatStore.LookupEntry(seatId))
{
m_Seats.insert(std::make_pair(i, VehicleSeat(veSeat)));
- if(veSeat->IsUsable())
+ if (veSeat->IsUsable())
++m_usableSeatNum;
}
}
@@ -50,14 +50,14 @@ Vehicle::~Vehicle()
void Vehicle::Install()
{
- if(Creature *cre = dynamic_cast<Creature*>(me))
+ if (Creature *cre = dynamic_cast<Creature*>(me))
{
- if(m_vehicleInfo->m_powerType == POWER_STEAM)
+ if (m_vehicleInfo->m_powerType == POWER_STEAM)
{
me->setPowerType(POWER_ENERGY);
me->SetMaxPower(POWER_ENERGY, 100);
}
- else if(m_vehicleInfo->m_powerType == POWER_PYRITE)
+ else if (m_vehicleInfo->m_powerType == POWER_PYRITE)
{
me->setPowerType(POWER_ENERGY);
me->SetMaxPower(POWER_ENERGY, 50);
@@ -66,17 +66,17 @@ void Vehicle::Install()
{
for (uint32 i = 0; i < MAX_SPELL_VEHICLE; ++i)
{
- if(!cre->m_spells[i])
+ if (!cre->m_spells[i])
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(cre->m_spells[i]);
- if(!spellInfo)
+ if (!spellInfo)
continue;
- if(spellInfo->powerType == POWER_MANA)
+ if (spellInfo->powerType == POWER_MANA)
break;
- if(spellInfo->powerType == POWER_ENERGY)
+ if (spellInfo->powerType == POWER_ENERGY)
{
me->setPowerType(POWER_ENERGY);
me->SetMaxPower(POWER_ENERGY, 100);
@@ -103,8 +103,8 @@ void Vehicle::Uninstall()
{
sLog.outDebug("Vehicle::Uninstall %u", me->GetEntry());
for (SeatMap::iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr)
- if(Unit *passenger = itr->second.passenger)
- if(passenger->HasUnitTypeMask(UNIT_MASK_ACCESSORY))
+ if (Unit *passenger = itr->second.passenger)
+ if (passenger->HasUnitTypeMask(UNIT_MASK_ACCESSORY))
passenger->ToTempSummon()->UnSummon();
RemoveAllPassengers();
}
@@ -113,8 +113,8 @@ void Vehicle::Die()
{
sLog.outDebug("Vehicle::Die %u", me->GetEntry());
for (SeatMap::iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr)
- if(Unit *passenger = itr->second.passenger)
- if(passenger->HasUnitTypeMask(UNIT_MASK_ACCESSORY))
+ if (Unit *passenger = itr->second.passenger)
+ if (passenger->HasUnitTypeMask(UNIT_MASK_ACCESSORY))
passenger->setDeathState(JUST_DIED);
RemoveAllPassengers();
}
@@ -139,14 +139,14 @@ void Vehicle::RemoveAllPassengers()
{
sLog.outDebug("Vehicle::RemoveAllPassengers");
for (SeatMap::iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr)
- if(Unit *passenger = itr->second.passenger)
+ if (Unit *passenger = itr->second.passenger)
{
- if(passenger->IsVehicle())
+ if (passenger->IsVehicle())
passenger->GetVehicleKit()->RemoveAllPassengers();
- if(passenger->GetVehicle() != this)
+ if (passenger->GetVehicle() != this)
sLog.outCrash("Vehicle %u has invalid passenger %u.", me->GetEntry(), passenger->GetEntry());
passenger->ExitVehicle();
- if(itr->second.passenger)
+ if (itr->second.passenger)
{
sLog.outCrash("Vehicle %u cannot remove passenger %u. %u is still on it.", me->GetEntry(), passenger->GetEntry(), itr->second.passenger->GetEntry());
//assert(!itr->second.passenger);
@@ -158,36 +158,36 @@ void Vehicle::RemoveAllPassengers()
bool Vehicle::HasEmptySeat(int8 seatId) const
{
SeatMap::const_iterator seat = m_Seats.find(seatId);
- if(seat == m_Seats.end()) return false;
+ if (seat == m_Seats.end()) return false;
return !seat->second.passenger;
}
Unit *Vehicle::GetPassenger(int8 seatId) const
{
SeatMap::const_iterator seat = m_Seats.find(seatId);
- if(seat == m_Seats.end()) return NULL;
+ if (seat == m_Seats.end()) return NULL;
return seat->second.passenger;
}
int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next) const
{
SeatMap::const_iterator seat = m_Seats.find(seatId);
- if(seat == m_Seats.end()) return -1;
+ if (seat == m_Seats.end()) return -1;
while (seat->second.passenger || !seat->second.seatInfo->IsUsable())
{
- if(next)
+ if (next)
{
++seat;
- if(seat == m_Seats.end())
+ if (seat == m_Seats.end())
seat = m_Seats.begin();
}
else
{
- if(seat == m_Seats.begin())
+ if (seat == m_Seats.begin())
seat = m_Seats.end();
--seat;
}
- if(seat->first == seatId)
+ if (seat->first == seatId)
return -1; // no available seat
}
return seat->first;
@@ -195,13 +195,13 @@ int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next) const
void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion)
{
- if(Unit *passenger = GetPassenger(seatId))
+ if (Unit *passenger = GetPassenger(seatId))
{
// already installed
- if(passenger->GetEntry() == entry)
+ if (passenger->GetEntry() == entry)
{
assert(passenger->GetTypeId() == TYPEID_UNIT);
- if(me->GetTypeId() == TYPEID_UNIT && me->ToCreature()->IsInEvadeMode() && passenger->ToCreature()->IsAIEnabled)
+ if (me->GetTypeId() == TYPEID_UNIT && me->ToCreature()->IsInEvadeMode() && passenger->ToCreature()->IsAIEnabled)
passenger->ToCreature()->AI()->EnterEvadeMode();
return;
}
@@ -209,9 +209,9 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion)
}
//TODO: accessory should be minion
- if(Creature *accessory = me->SummonCreature(entry, *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
+ if (Creature *accessory = me->SummonCreature(entry, *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
{
- if(minion)
+ if (minion)
accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY);
accessory->EnterVehicle(this, seatId);
// This is not good, we have to send update twice
@@ -221,26 +221,26 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion)
bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
{
- if(unit->GetVehicle() != this)
+ if (unit->GetVehicle() != this)
return false;
SeatMap::iterator seat;
- if(seatId < 0) // no specific seat requirement
+ if (seatId < 0) // no specific seat requirement
{
for (seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)
- if(!seat->second.passenger && seat->second.seatInfo->IsUsable())
+ if (!seat->second.passenger && seat->second.seatInfo->IsUsable())
break;
- if(seat == m_Seats.end()) // no available seat
+ if (seat == m_Seats.end()) // no available seat
return false;
}
else
{
seat = m_Seats.find(seatId);
- if(seat == m_Seats.end())
+ if (seat == m_Seats.end())
return false;
- if(seat->second.passenger)
+ if (seat->second.passenger)
seat->second.passenger->ExitVehicle();
assert(!seat->second.passenger);
@@ -249,11 +249,11 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
sLog.outDebug("Unit %s enter vehicle entry %u id %u dbguid %u seat %d", unit->GetName(), me->GetEntry(), m_vehicleInfo->m_ID, me->GetGUIDLow(), (int32)seat->first);
seat->second.passenger = unit;
- if(seat->second.seatInfo->IsUsable())
+ if (seat->second.seatInfo->IsUsable())
{
assert(m_usableSeatNum);
--m_usableSeatNum;
- if(!m_usableSeatNum)
+ if (!m_usableSeatNum)
{
if (me->GetTypeId() == TYPEID_PLAYER)
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
@@ -262,7 +262,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
}
}
- if(seat->second.seatInfo->m_flags && !(seat->second.seatInfo->m_flags & 0x400))
+ if (seat->second.seatInfo->m_flags && !(seat->second.seatInfo->m_flags & 0x400))
unit->addUnitState(UNIT_STAT_ONVEHICLE);
//SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
@@ -276,19 +276,19 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
unit->m_movementInfo.t_time = 0; // 1 for player
unit->m_movementInfo.t_seat = seat->first;
- if(me->GetTypeId() == TYPEID_UNIT
+ if (me->GetTypeId() == TYPEID_UNIT
&& unit->GetTypeId() == TYPEID_PLAYER
&& seat->first == 0 && seat->second.seatInfo->m_flags & 0x800) // not right
if (!me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE))
assert(false);
- if(me->IsInWorld())
+ if (me->IsInWorld())
{
unit->SendMonsterMoveTransport(me);
- if(me->GetTypeId() == TYPEID_UNIT)
+ if (me->GetTypeId() == TYPEID_UNIT)
{
- if(me->ToCreature()->IsAIEnabled)
+ if (me->ToCreature()->IsAIEnabled)
me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, true);
// update all passenger's positions
@@ -296,7 +296,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
}
}
- //if(unit->GetTypeId() == TYPEID_PLAYER)
+ //if (unit->GetTypeId() == TYPEID_PLAYER)
// unit->ToPlayer()->SendTeleportAckPacket();
//unit->SendMovementFlagUpdate();
@@ -305,12 +305,12 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
void Vehicle::RemovePassenger(Unit *unit)
{
- if(unit->GetVehicle() != this)
+ if (unit->GetVehicle() != this)
return;
SeatMap::iterator seat;
for (seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)
- if(seat->second.passenger == unit)
+ if (seat->second.passenger == unit)
break;
assert(seat != m_Seats.end());
@@ -318,9 +318,9 @@ void Vehicle::RemovePassenger(Unit *unit)
sLog.outDebug("Unit %s exit vehicle entry %u id %u dbguid %u seat %d", unit->GetName(), me->GetEntry(), m_vehicleInfo->m_ID, me->GetGUIDLow(), (int32)seat->first);
seat->second.passenger = NULL;
- if(seat->second.seatInfo->IsUsable())
+ if (seat->second.seatInfo->IsUsable())
{
- if(!m_usableSeatNum)
+ if (!m_usableSeatNum)
{
if (me->GetTypeId() == TYPEID_PLAYER)
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
@@ -334,12 +334,12 @@ void Vehicle::RemovePassenger(Unit *unit)
//SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
- if(me->GetTypeId() == TYPEID_UNIT
+ if (me->GetTypeId() == TYPEID_UNIT
&& unit->GetTypeId() == TYPEID_PLAYER
&& seat->first == 0 && seat->second.seatInfo->m_flags & 0x800)
me->RemoveCharmedBy(unit);
- if(me->GetTypeId() == TYPEID_UNIT && me->ToCreature()->IsAIEnabled)
+ if (me->GetTypeId() == TYPEID_UNIT && me->ToCreature()->IsAIEnabled)
me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, false);
// only for flyable vehicles?
diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp
index 8a694ab21ff..cb1673280ce 100644
--- a/src/game/WaypointManager.cpp
+++ b/src/game/WaypointManager.cpp
@@ -44,7 +44,7 @@ void WaypointStore::Load()
records = (*result)[0].GetUInt32();
result = WorldDatabase.PQuery("SELECT id,point,position_x,position_y,position_z,move_flag,delay,action,action_chance FROM waypoint_data ORDER BY id, point");
- if(!result)
+ if (!result)
{
sLog.outErrorDb("The table `waypoint_data` is empty or corrupted");
return;
@@ -66,7 +66,7 @@ void WaypointStore::Load()
count++;
WaypointData *wp = new WaypointData;
- if(last_id != id)
+ if (last_id != id)
path_data = new WaypointPath;
float x,y,z;
@@ -88,7 +88,7 @@ void WaypointStore::Load()
path_data->push_back(wp);
- if(id != last_id)
+ if (id != last_id)
waypoint_map[id] = path_data;
last_id = id;
@@ -101,14 +101,14 @@ void WaypointStore::Load()
void WaypointStore::UpdatePath(uint32 id)
{
- if(waypoint_map.find(id)!= waypoint_map.end())
+ if (waypoint_map.find(id)!= waypoint_map.end())
waypoint_map[id]->clear();
QueryResult_AutoPtr result;
result = WorldDatabase.PQuery("SELECT id,point,position_x,position_y,position_z,move_flag,delay,action,action_chance FROM waypoint_data WHERE id = %u ORDER BY point", id);
- if(!result)
+ if (!result)
return;
WaypointPath* path_data;
diff --git a/src/game/WaypointManager.h b/src/game/WaypointManager.h
index dae000d4949..20a5dcc256f 100644
--- a/src/game/WaypointManager.h
+++ b/src/game/WaypointManager.h
@@ -48,7 +48,7 @@ class WaypointStore
WaypointPath* GetPath(uint32 id)
{
- if(waypoint_map.find(id) != waypoint_map.end())
+ if (waypoint_map.find(id) != waypoint_map.end())
return waypoint_map[id];
else return 0;
}
diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp
index a8ca89d6fed..719ddd9aed5 100644
--- a/src/game/WaypointMovementGenerator.cpp
+++ b/src/game/WaypointMovementGenerator.cpp
@@ -329,7 +329,7 @@ void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport()
uint32 map0 = i_mapIds[0];
for (size_t i = 1; i < i_mapIds.size(); ++i)
{
- if(i_mapIds[i] != map0)
+ if (i_mapIds[i] != map0)
{
i_currentNode = i;
return;
diff --git a/src/game/Weather.cpp b/src/game/Weather.cpp
index f67b0d2fcec..92fbb313d45 100644
--- a/src/game/Weather.cpp
+++ b/src/game/Weather.cpp
@@ -48,14 +48,14 @@ bool Weather::Update(uint32 diff)
else m_timer.SetCurrent(0);
///- If the timer has passed, ReGenerate the weather
- if(m_timer.Passed())
+ if (m_timer.Passed())
{
m_timer.Reset();
// update only if Regenerate has changed the weather
- if(ReGenerate())
+ if (ReGenerate())
{
///- Weather will be removed if not updated (no players in zone anymore)
- if(!UpdateWeather())
+ if (!UpdateWeather())
return false;
}
}
@@ -149,11 +149,11 @@ bool Weather::ReGenerate()
uint32 chance3 = chance2+ m_weatherChances->data[season].stormChance;
uint32 rnd = urand(0, 99);
- if(rnd <= chance1)
+ if (rnd <= chance1)
m_type = WEATHER_TYPE_RAIN;
- else if(rnd <= chance2)
+ else if (rnd <= chance2)
m_type = WEATHER_TYPE_SNOW;
- else if(rnd <= chance3)
+ else if (rnd <= chance3)
m_type = WEATHER_TYPE_STORM;
else
m_type = WEATHER_TYPE_FINE;
@@ -206,7 +206,7 @@ void Weather::SendFineWeatherUpdateToPlayer(Player *player)
bool Weather::UpdateWeather()
{
Player* player = sWorld.FindPlayerInZone(m_zone);
- if(!player)
+ if (!player)
return false;
///- Send the weather packet to all players in this zone
@@ -271,7 +271,7 @@ bool Weather::UpdateWeather()
/// Set the weather
void Weather::SetWeather(WeatherType type, float grade)
{
- if(m_type == type && m_grade == grade)
+ if (m_type == type && m_grade == grade)
return;
m_type = type;
@@ -288,23 +288,23 @@ WeatherState Weather::GetWeatherState() const
switch(m_type)
{
case WEATHER_TYPE_RAIN:
- if(m_grade<0.40f)
+ if (m_grade<0.40f)
return WEATHER_STATE_LIGHT_RAIN;
- else if(m_grade<0.70f)
+ else if (m_grade<0.70f)
return WEATHER_STATE_MEDIUM_RAIN;
else
return WEATHER_STATE_HEAVY_RAIN;
case WEATHER_TYPE_SNOW:
- if(m_grade<0.40f)
+ if (m_grade<0.40f)
return WEATHER_STATE_LIGHT_SNOW;
- else if(m_grade<0.70f)
+ else if (m_grade<0.70f)
return WEATHER_STATE_MEDIUM_SNOW;
else
return WEATHER_STATE_HEAVY_SNOW;
case WEATHER_TYPE_STORM:
- if(m_grade<0.40f)
+ if (m_grade<0.40f)
return WEATHER_STATE_LIGHT_SANDSTORM;
- else if(m_grade<0.70f)
+ else if (m_grade<0.70f)
return WEATHER_STATE_MEDIUM_SANDSTORM;
else
return WEATHER_STATE_HEAVY_SANDSTORM;
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 374595a50ec..79427a207c6 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -1090,12 +1090,12 @@ void World::LoadConfigSettings(bool reload)
//visibility on continents
m_MaxVisibleDistanceOnContinents = sConfig.GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE);
- if(m_MaxVisibleDistanceOnContinents < 45*sWorld.getRate(RATE_CREATURE_AGGRO))
+ if (m_MaxVisibleDistanceOnContinents < 45*sWorld.getRate(RATE_CREATURE_AGGRO))
{
sLog.outError("Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld.getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceOnContinents = 45*sWorld.getRate(RATE_CREATURE_AGGRO);
}
- else if(m_MaxVisibleDistanceOnContinents + m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE)
+ else if (m_MaxVisibleDistanceOnContinents + m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE)
{
sLog.outError("Visibility.Distance.Continents can't be greater %f",MAX_VISIBILITY_DISTANCE - m_VisibleUnitGreyDistance);
m_MaxVisibleDistanceOnContinents = MAX_VISIBILITY_DISTANCE - m_VisibleUnitGreyDistance;
@@ -1103,12 +1103,12 @@ void World::LoadConfigSettings(bool reload)
//visibility in instances
m_MaxVisibleDistanceInInstances = sConfig.GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE);
- if(m_MaxVisibleDistanceInInstances < 45*sWorld.getRate(RATE_CREATURE_AGGRO))
+ if (m_MaxVisibleDistanceInInstances < 45*sWorld.getRate(RATE_CREATURE_AGGRO))
{
sLog.outError("Visibility.Distance.Instances can't be less max aggro radius %f",45*sWorld.getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceInInstances = 45*sWorld.getRate(RATE_CREATURE_AGGRO);
}
- else if(m_MaxVisibleDistanceInInstances + m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE)
+ else if (m_MaxVisibleDistanceInInstances + m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE)
{
sLog.outError("Visibility.Distance.Instances can't be greater %f",MAX_VISIBILITY_DISTANCE - m_VisibleUnitGreyDistance);
m_MaxVisibleDistanceInInstances = MAX_VISIBILITY_DISTANCE - m_VisibleUnitGreyDistance;
@@ -1116,30 +1116,30 @@ void World::LoadConfigSettings(bool reload)
//visibility in BG/Arenas
m_MaxVisibleDistanceInBGArenas = sConfig.GetFloatDefault("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS);
- if(m_MaxVisibleDistanceInBGArenas < 45*sWorld.getRate(RATE_CREATURE_AGGRO))
+ if (m_MaxVisibleDistanceInBGArenas < 45*sWorld.getRate(RATE_CREATURE_AGGRO))
{
sLog.outError("Visibility.Distance.BGArenas can't be less max aggro radius %f",45*sWorld.getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceInBGArenas = 45*sWorld.getRate(RATE_CREATURE_AGGRO);
}
- else if(m_MaxVisibleDistanceInBGArenas + m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE)
+ else if (m_MaxVisibleDistanceInBGArenas + m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE)
{
sLog.outError("Visibility.Distance.BGArenas can't be greater %f",MAX_VISIBILITY_DISTANCE - m_VisibleUnitGreyDistance);
m_MaxVisibleDistanceInBGArenas = MAX_VISIBILITY_DISTANCE - m_VisibleUnitGreyDistance;
}
m_MaxVisibleDistanceForObject = sConfig.GetFloatDefault("Visibility.Distance.Object", DEFAULT_VISIBILITY_DISTANCE);
- if(m_MaxVisibleDistanceForObject < INTERACTION_DISTANCE)
+ if (m_MaxVisibleDistanceForObject < INTERACTION_DISTANCE)
{
sLog.outError("Visibility.Distance.Object can't be less max aggro radius %f",float(INTERACTION_DISTANCE));
m_MaxVisibleDistanceForObject = INTERACTION_DISTANCE;
}
- else if(m_MaxVisibleDistanceForObject + m_VisibleObjectGreyDistance > MAX_VISIBILITY_DISTANCE)
+ else if (m_MaxVisibleDistanceForObject + m_VisibleObjectGreyDistance > MAX_VISIBILITY_DISTANCE)
{
sLog.outError("Visibility.Distance.Object can't be greater %f",MAX_VISIBILITY_DISTANCE-m_VisibleObjectGreyDistance);
m_MaxVisibleDistanceForObject = MAX_VISIBILITY_DISTANCE - m_VisibleObjectGreyDistance;
}
m_MaxVisibleDistanceInFlight = sConfig.GetFloatDefault("Visibility.Distance.InFlight", DEFAULT_VISIBILITY_DISTANCE);
- if(m_MaxVisibleDistanceInFlight + m_VisibleObjectGreyDistance > MAX_VISIBILITY_DISTANCE)
+ if (m_MaxVisibleDistanceInFlight + m_VisibleObjectGreyDistance > MAX_VISIBILITY_DISTANCE)
{
sLog.outError("Visibility.Distance.InFlight can't be greater %f",MAX_VISIBILITY_DISTANCE-m_VisibleObjectGreyDistance);
m_MaxVisibleDistanceInFlight = MAX_VISIBILITY_DISTANCE - m_VisibleObjectGreyDistance;
diff --git a/src/game/World.h b/src/game/World.h
index 2b92c01b68c..8132a657b23 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -523,7 +523,7 @@ class World
uint32 GetUptime() const { return uint32(m_gameTime - m_startTime); }
/// Update time
uint32 GetUpdateTime() const { return m_updateTime; }
- void SetRecordDiffInterval(int32 t) { if(t >= 0) m_configs[CONFIG_INTERVAL_LOG_UPDATE] = (uint32)t; }
+ void SetRecordDiffInterval(int32 t) { if (t >= 0) m_configs[CONFIG_INTERVAL_LOG_UPDATE] = (uint32)t; }
/// Next daily quests reset time
time_t GetNextDailyQuestsResetTime() const { return m_NextDailyQuestReset; }
@@ -622,7 +622,7 @@ class World
void UpdateAllowedSecurity();
- LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if(m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; }
+ LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if (m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; }
//used World DB version
void LoadDBVersion();
diff --git a/src/game/WorldLog.cpp b/src/game/WorldLog.cpp
index 01cd670ed75..89c058c5ce2 100644
--- a/src/game/WorldLog.cpp
+++ b/src/game/WorldLog.cpp
@@ -38,7 +38,7 @@ WorldLog::WorldLog() : i_file(NULL)
WorldLog::~WorldLog()
{
- if( i_file != NULL )
+ if ( i_file != NULL )
fclose(i_file);
i_file = NULL;
}
@@ -48,14 +48,14 @@ void WorldLog::Initialize()
{
std::string logsDir = sConfig.GetStringDefault("LogsDir","");
- if(!logsDir.empty())
+ if (!logsDir.empty())
{
- if((logsDir.at(logsDir.length()-1)!='/') && (logsDir.at(logsDir.length()-1)!='\\'))
+ if ((logsDir.at(logsDir.length()-1)!='/') && (logsDir.at(logsDir.length()-1)!='\\'))
logsDir.append("/");
}
std::string logname = sConfig.GetStringDefault("WorldLogFile", "");
- if(!logname.empty())
+ if (!logname.empty())
{
i_file = fopen((logsDir+logname).c_str(), "w");
}
@@ -65,7 +65,7 @@ void WorldLog::Initialize()
void WorldLog::outTimestampLog(char const *fmt, ...)
{
- if( LogWorld() )
+ if ( LogWorld() )
{
Guard guard(*this);
ASSERT(i_file);
@@ -93,7 +93,7 @@ void WorldLog::outTimestampLog(char const *fmt, ...)
void WorldLog::outLog(char const *fmt, ...)
{
- if( LogWorld() )
+ if ( LogWorld() )
{
Guard guard(*this);
ASSERT(i_file);
diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp
index 63f60ad061a..686f98ebeb9 100644
--- a/src/game/WorldSession.cpp
+++ b/src/game/WorldSession.cpp
@@ -115,7 +115,7 @@ void WorldSession::SendPacket(WorldPacket const* packet)
time_t cur_time = time(NULL);
- if((cur_time - lastTime) < 60)
+ if ((cur_time - lastTime) < 60)
{
sendPacketCount+=1;
sendPacketBytes+=packet->size();
@@ -181,7 +181,7 @@ bool WorldSession::Update(uint32 /*diff*/)
packet->GetOpcode());
#endif*/
- if(packet->GetOpcode() >= NUM_MSG_TYPES)
+ if (packet->GetOpcode() >= NUM_MSG_TYPES)
{
sLog.outError( "SESSION: received non-existed opcode %s (0x%.4X)",
LookupOpcodeName(packet->GetOpcode()),
@@ -195,13 +195,13 @@ bool WorldSession::Update(uint32 /*diff*/)
switch (opHandle.status)
{
case STATUS_LOGGEDIN:
- if(!_player)
+ if (!_player)
{
// skip STATUS_LOGGEDIN opcode unexpected errors if player logout sometime ago - this can be network lag delayed packets
- if(!m_playerRecentlyLogout)
+ if (!m_playerRecentlyLogout)
LogUnexpectedOpcode(packet, "the player has not logged in yet");
}
- else if(_player->IsInWorld())
+ else if (_player->IsInWorld())
{
(this->*opHandle.handler)(*packet);
if (sLog.IsOutDebug() && packet->rpos() < packet->wpos())
@@ -210,7 +210,7 @@ bool WorldSession::Update(uint32 /*diff*/)
// lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer
break;
case STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT:
- if(!_player && !m_playerRecentlyLogout)
+ if (!_player && !m_playerRecentlyLogout)
{
LogUnexpectedOpcode(packet, "the player has not logged in yet and not recently logout");
}
@@ -223,9 +223,9 @@ bool WorldSession::Update(uint32 /*diff*/)
}
break;
case STATUS_TRANSFER:
- if(!_player)
+ if (!_player)
LogUnexpectedOpcode(packet, "the player has not logged in yet");
- else if(_player->IsInWorld())
+ else if (_player->IsInWorld())
LogUnexpectedOpcode(packet, "the player is still in world");
else
{
@@ -236,7 +236,7 @@ bool WorldSession::Update(uint32 /*diff*/)
break;
case STATUS_AUTHED:
// prevent cheating with skip queue wait
- if(m_inQueue)
+ if (m_inQueue)
{
LogUnexpectedOpcode(packet, "the player not pass queue yet");
break;
@@ -263,7 +263,7 @@ bool WorldSession::Update(uint32 /*diff*/)
{
sLog.outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.",
packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
- if(sLog.IsOutDebug())
+ if (sLog.IsOutDebug())
{
sLog.outDebug("Dumping error causing packet:");
packet->hexlike();
@@ -326,13 +326,13 @@ void WorldSession::LogoutPlayer(bool Save)
for (Unit::AttackerSet::const_iterator itr = _player->getAttackers().begin(); itr != _player->getAttackers().end(); ++itr)
{
Unit* owner = (*itr)->GetOwner(); // including player controlled case
- if(owner)
+ if (owner)
{
- if(owner->GetTypeId() == TYPEID_PLAYER)
+ if (owner->GetTypeId() == TYPEID_PLAYER)
aset.insert(owner->ToPlayer());
}
else
- if((*itr)->GetTypeId() == TYPEID_PLAYER)
+ if ((*itr)->GetTypeId() == TYPEID_PLAYER)
aset.insert((Player*)(*itr));
}
@@ -347,11 +347,11 @@ void WorldSession::LogoutPlayer(bool Save)
// give bg rewards and update counters like kill by first from attackers
// this can't be called for all attackers.
- if(!aset.empty())
- if(BattleGround *bg = _player->GetBattleGround())
+ if (!aset.empty())
+ if (BattleGround *bg = _player->GetBattleGround())
bg->HandleKillPlayer(_player,*aset.begin());
}
- else if(_player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
+ else if (_player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
{
// this will kill character by SPELL_AURA_SPIRIT_OF_REDEMPTION
_player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
@@ -361,18 +361,18 @@ void WorldSession::LogoutPlayer(bool Save)
_player->RepopAtGraveyard();
}
//drop a flag if player is carrying it
- if(BattleGround *bg = _player->GetBattleGround())
+ if (BattleGround *bg = _player->GetBattleGround())
bg->EventPlayerLoggedOut(_player);
///- Teleport to home if the player is in an invalid instance
- if(!_player->m_InstanceValid && !_player->isGameMaster())
+ if (!_player->m_InstanceValid && !_player->isGameMaster())
_player->TeleportTo(_player->m_homebindMapId, _player->m_homebindX, _player->m_homebindY, _player->m_homebindZ, _player->GetOrientation());
sOutdoorPvPMgr.HandlePlayerLeaveZone(_player,_player->GetZoneId());
for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
{
- if(BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i))
+ if (BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i))
{
_player->RemoveBattleGroundQueueId(bgQueueTypeId);
sBattleGroundMgr.m_BattleGroundQueues[ bgQueueTypeId ].RemovePlayer(_player->GetGUID(), true);
@@ -386,7 +386,7 @@ void WorldSession::LogoutPlayer(bool Save)
///- If the player is in a guild, update the guild roster and broadcast a logout message to other guild members
Guild *guild = objmgr.GetGuildById(_player->GetGuildId());
- if(guild)
+ if (guild)
{
guild->SetMemberStats(_player->GetGUID());
guild->UpdateLogoutTime(_player->GetGUID());
@@ -404,7 +404,7 @@ void WorldSession::LogoutPlayer(bool Save)
///- empty buyback items and save the player in the database
// some save parts only correctly work in case player present in map/player_lists (pets, etc)
- if(Save)
+ if (Save)
{
uint32 eslot;
for (int j = BUYBACK_SLOT_START; j < BUYBACK_SLOT_END; ++j)
@@ -425,11 +425,11 @@ void WorldSession::LogoutPlayer(bool Save)
// remove player from the group if he is:
// a) in group; b) not in raid group; c) logging out normally (not being kicked or disconnected)
- if(_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && m_Socket)
+ if (_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && m_Socket)
_player->RemoveFromGroup();
///- Send update to group
- if(_player->GetGroup())
+ if (_player->GetGroup())
_player->GetGroup()->SendUpdate();
///- Broadcast a logout message to the player's friends
@@ -474,7 +474,7 @@ void WorldSession::KickPlayer()
void WorldSession::SendNotification(const char *format,...)
{
- if(format)
+ if (format)
{
va_list ap;
char szStr [1024];
@@ -492,7 +492,7 @@ void WorldSession::SendNotification(const char *format,...)
void WorldSession::SendNotification(int32 string_id,...)
{
char const* format = GetTrinityString(string_id);
- if(format)
+ if (format)
{
va_list ap;
char szStr [1024];
@@ -542,7 +542,7 @@ void WorldSession::Handle_Deprecated( WorldPacket& recvPacket )
void WorldSession::SendAuthWaitQue(uint32 position)
{
- if(position == 0)
+ if (position == 0)
{
WorldPacket packet( SMSG_AUTH_RESPONSE, 1 );
packet << uint8( AUTH_OK );
@@ -571,7 +571,7 @@ void WorldSession::LoadAccountData(QueryResult_AutoPtr result, uint32 mask)
if (mask & (1 << i))
m_accountData[i] = AccountData();
- if(!result)
+ if (!result)
return;
do
@@ -614,7 +614,7 @@ void WorldSession::SetAccountData(AccountDataType type, time_t time_, std::strin
else
{
// _player can be NULL and packet received after logout but m_GUID still store correct guid
- if(!m_GUIDLow)
+ if (!m_GUIDLow)
return;
CharacterDatabase.BeginTransaction ();
@@ -635,7 +635,7 @@ void WorldSession::SendAccountDataTimes(uint32 mask)
data << uint8(1);
data << uint32(mask); // type mask
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
- if(mask & (1 << i))
+ if (mask & (1 << i))
data << uint32(GetAccountData(AccountDataType(i))->Time);// also unix time
SendPacket(&data);
}
@@ -647,7 +647,7 @@ void WorldSession::LoadTutorialsData()
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT tut0,tut1,tut2,tut3,tut4,tut5,tut6,tut7 FROM character_tutorial WHERE account = '%u'", GetAccountId());
- if(result)
+ if (result)
{
do
{
@@ -671,13 +671,13 @@ void WorldSession::SendTutorialsData()
void WorldSession::SaveTutorialsData()
{
- if(!m_TutorialsChanged)
+ if (!m_TutorialsChanged)
return;
uint32 Rows=0;
// it's better than rebuilding indexes multiple times
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT count(*) AS r FROM character_tutorial WHERE account = '%u'", GetAccountId());
- if(result)
+ if (result)
Rows = result->Fetch()[0].GetUInt32();
if (Rows)
@@ -703,9 +703,9 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi)
data >> mi->z;
data >> mi->o;
- if(mi->flags & MOVEMENTFLAG_ONTRANSPORT)
+ if (mi->flags & MOVEMENTFLAG_ONTRANSPORT)
{
- if(!data.readPackGUID(mi->t_guid))
+ if (!data.readPackGUID(mi->t_guid))
return;
data >> mi->t_x;
@@ -716,14 +716,14 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi)
data >> mi->t_seat;
}
- if((mi->flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (mi->unk1 & 0x20))
+ if ((mi->flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (mi->unk1 & 0x20))
{
data >> mi->s_pitch;
}
data >> mi->fallTime;
- if(mi->flags & MOVEMENTFLAG_JUMPING)
+ if (mi->flags & MOVEMENTFLAG_JUMPING)
{
data >> mi->j_zspeed;
data >> mi->j_sinAngle;
@@ -731,7 +731,7 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi)
data >> mi->j_xyspeed;
}
- if(mi->flags & MOVEMENTFLAG_SPLINE)
+ if (mi->flags & MOVEMENTFLAG_SPLINE)
{
data >> mi->u_unk1;
}
@@ -749,7 +749,7 @@ void WorldSession::WriteMovementInfo(WorldPacket *data, MovementInfo *mi)
*data << mi->z;
*data << mi->o;
- if(mi->HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
+ if (mi->HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
{
data->appendPackGUID(mi->t_guid);
@@ -761,14 +761,14 @@ void WorldSession::WriteMovementInfo(WorldPacket *data, MovementInfo *mi)
*data << mi->t_seat;
}
- if((mi->HasMovementFlag(MovementFlags(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING))) || (mi->unk1 & 0x20))
+ if ((mi->HasMovementFlag(MovementFlags(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING))) || (mi->unk1 & 0x20))
{
*data << mi->s_pitch;
}
*data << mi->fallTime;
- if(mi->HasMovementFlag(MOVEMENTFLAG_JUMPING))
+ if (mi->HasMovementFlag(MOVEMENTFLAG_JUMPING))
{
*data << mi->j_zspeed;
*data << mi->j_sinAngle;
@@ -776,7 +776,7 @@ void WorldSession::WriteMovementInfo(WorldPacket *data, MovementInfo *mi)
*data << mi->j_xyspeed;
}
- if(mi->HasMovementFlag(MOVEMENTFLAG_SPLINE))
+ if (mi->HasMovementFlag(MOVEMENTFLAG_SPLINE))
{
*data << mi->u_unk1;
}
@@ -789,10 +789,10 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
uint32 size;
data >> size;
- if(!size)
+ if (!size)
return;
- if(size > 0xFFFFF)
+ if (size > 0xFFFFF)
{
sLog.outError("WorldSession::ReadAddonsInfo addon info too big, size %u", size);
return;
@@ -817,7 +817,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
uint32 crc, unk1;
// check next addon data format correctness
- if(addonInfo.rpos()+1 > addonInfo.size())
+ if (addonInfo.rpos()+1 > addonInfo.size())
return;
addonInfo >> addonName;
@@ -856,7 +856,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
addonInfo >> currentTime;
sLog.outDebug("ADDON: CurrentTime: %u", currentTime);
- if(addonInfo.rpos() != addonInfo.size())
+ if (addonInfo.rpos() != addonInfo.size())
sLog.outDebug("packet under-read!");
}
else
@@ -938,6 +938,6 @@ void WorldSession::SetPlayer( Player *plr )
_player = plr;
// set m_GUID that can be used while player loggined and later until m_playerRecentlyLogout not reset
- if(_player)
+ if (_player)
m_GUIDLow = _player->GetGUIDLow();
}
diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h
index 3631ae36dc8..ddaeb87862e 100644
--- a/src/game/WorldSession.h
+++ b/src/game/WorldSession.h
@@ -204,7 +204,7 @@ class WorldSession
void SetTutorialInt(uint32 intId, uint32 value)
{
- if(m_Tutorials[intId] != value)
+ if (m_Tutorials[intId] != value)
{
m_Tutorials[intId] = value;
m_TutorialsChanged = true;
diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp
index 7865068b912..387da651c57 100644
--- a/src/game/WorldSocket.cpp
+++ b/src/game/WorldSocket.cpp
@@ -60,7 +60,7 @@ struct ServerPktHeader
ServerPktHeader(uint32 size, uint16 cmd) : size(size)
{
uint8 headerIndex=0;
- if(isLargePacket())
+ if (isLargePacket())
{
sLog.outDebug("initializing large server to client packet. Size: %u, cmd: %u", size, cmd);
header[headerIndex++] = 0x80|(0xFF &(size>>16));
@@ -444,7 +444,7 @@ int WorldSocket::handle_input_header (void)
ACE_NEW_RETURN (m_RecvWPct, WorldPacket ((uint16) header.cmd, header.size), -1);
- if(header.size > 0)
+ if (header.size > 0)
{
m_RecvWPct->resize (header.size);
m_RecvPct.base ((char*) m_RecvWPct->contents (), m_RecvWPct->size ());
@@ -696,7 +696,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
{
sLog.outError("WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.",
opcode, GetRemoteAddress().c_str(), m_Session?m_Session->GetAccountId():-1);
- if(sLog.IsOutDebug())
+ if (sLog.IsOutDebug())
{
sLog.outDebug("Dumping error causing packet:");
new_pct->hexlike();
@@ -726,7 +726,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
BigNumber K;
- if(sWorld.IsClosed())
+ if (sWorld.IsClosed())
{
packet.Initialize(SMSG_AUTH_RESPONSE, 1);
packet << uint8(AUTH_REJECT);
@@ -788,7 +788,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
uint8 expansion = fields[6].GetUInt8();
uint32 world_expansion = sWorld.getConfig(CONFIG_EXPANSION);
- if(expansion > world_expansion)
+ if (expansion > world_expansion)
expansion = world_expansion;
//expansion = ((sWorld.getConfig(CONFIG_EXPANSION) > fields[6].GetUInt8()) ? fields[6].GetUInt8() : sWorld.getConfig(CONFIG_EXPANSION));
@@ -824,7 +824,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
id = fields[0].GetUInt32 ();
/*
- if(security > SEC_ADMINISTRATOR) // prevent invalid security settings in DB
+ if (security > SEC_ADMINISTRATOR) // prevent invalid security settings in DB
security = SEC_ADMINISTRATOR;
*/
@@ -846,7 +846,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
" AND (RealmID = '%d'"
" OR RealmID = '-1')",
id, realmID);
- if(!result)
+ if (!result)
security = 0;
else
{
diff --git a/src/game/WorldSocketMgr.cpp b/src/game/WorldSocketMgr.cpp
index c0007f0f633..4c3a5f81576 100644
--- a/src/game/WorldSocketMgr.cpp
+++ b/src/game/WorldSocketMgr.cpp
@@ -223,7 +223,7 @@ WorldSocketMgr::~WorldSocketMgr ()
if (m_NetThreads)
delete [] m_NetThreads;
- if(m_Acceptor)
+ if (m_Acceptor)
delete m_Acceptor;
}
diff --git a/src/scripts/eastern_kingdoms/alterac_valley/alterac_valley.cpp b/src/scripts/eastern_kingdoms/alterac_valley/alterac_valley.cpp
index bdaeb4aa949..c908d0ace49 100644
--- a/src/scripts/eastern_kingdoms/alterac_valley/alterac_valley.cpp
+++ b/src/scripts/eastern_kingdoms/alterac_valley/alterac_valley.cpp
@@ -154,7 +154,7 @@ struct mob_av_marshal_or_warmasterAI : public ScriptedAI
// check if creature is not outside of building
- if(uiResetTimer <= diff)
+ if (uiResetTimer <= diff)
{
if (m_creature->GetDistance2d(m_creature->GetHomePosition().GetPositionX(), m_creature->GetHomePosition().GetPositionY()) > 50)
EnterEvadeMode();
diff --git a/src/scripts/eastern_kingdoms/alterac_valley/boss_balinda.cpp b/src/scripts/eastern_kingdoms/alterac_valley/boss_balinda.cpp
index 6b0f5bb7e60..5da4bacb371 100644
--- a/src/scripts/eastern_kingdoms/alterac_valley/boss_balinda.cpp
+++ b/src/scripts/eastern_kingdoms/alterac_valley/boss_balinda.cpp
@@ -59,14 +59,14 @@ struct mob_water_elementalAI : public ScriptedAI
if (!UpdateVictim())
return;
- if(uiWaterBoltTimer < diff)
+ if (uiWaterBoltTimer < diff)
{
DoCast(m_creature->getVictim(), SPELL_WATERBOLT);
uiWaterBoltTimer = 5*IN_MILISECONDS;
} else uiWaterBoltTimer -= diff;
// check if creature is not outside of building
- if(uiResetTimer < diff)
+ if (uiResetTimer < diff)
{
if (Creature *pBalinda = Unit::GetCreature(*m_creature, uiBalindaGUID))
if (m_creature->GetDistance2d(pBalinda->GetHomePosition().GetPositionX(), pBalinda->GetHomePosition().GetPositionY()) > 50)
@@ -133,7 +133,7 @@ struct boss_balindaAI : public ScriptedAI
if (uiWaterElementalTimer < diff)
{
- if(Summons.empty())
+ if (Summons.empty())
m_creature->SummonCreature(NPC_WATER_ELEMENTAL, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45*IN_MILISECONDS);
uiWaterElementalTimer = 50*IN_MILISECONDS;
} else uiWaterElementalTimer -= diff;
@@ -164,7 +164,7 @@ struct boss_balindaAI : public ScriptedAI
// check if creature is not outside of building
- if(uiResetTimer < diff)
+ if (uiResetTimer < diff)
{
if (m_creature->GetDistance2d(m_creature->GetHomePosition().GetPositionX(), m_creature->GetHomePosition().GetPositionY()) > 50)
{
diff --git a/src/scripts/eastern_kingdoms/alterac_valley/boss_drekthar.cpp b/src/scripts/eastern_kingdoms/alterac_valley/boss_drekthar.cpp
index 0f1346af927..5b611666347 100644
--- a/src/scripts/eastern_kingdoms/alterac_valley/boss_drekthar.cpp
+++ b/src/scripts/eastern_kingdoms/alterac_valley/boss_drekthar.cpp
@@ -108,7 +108,7 @@ struct boss_drektharAI : public ScriptedAI
} else uiYellTimer -= diff;
// check if creature is not outside of building
- if(uiResetTimer <= diff)
+ if (uiResetTimer <= diff)
{
if (m_creature->GetDistance2d(m_creature->GetHomePosition().GetPositionX(), m_creature->GetHomePosition().GetPositionY()) > 50)
{
diff --git a/src/scripts/eastern_kingdoms/alterac_valley/boss_galvangar.cpp b/src/scripts/eastern_kingdoms/alterac_valley/boss_galvangar.cpp
index 063cf356fda..ac0f39d6eac 100644
--- a/src/scripts/eastern_kingdoms/alterac_valley/boss_galvangar.cpp
+++ b/src/scripts/eastern_kingdoms/alterac_valley/boss_galvangar.cpp
@@ -100,7 +100,7 @@ struct boss_galvangarAI : public ScriptedAI
} else uiMortalStrikeTimer -= diff;
// check if creature is not outside of building
- if(uiResetTimer <= diff)
+ if (uiResetTimer <= diff)
{
if (m_creature->GetDistance2d(m_creature->GetHomePosition().GetPositionX(), m_creature->GetHomePosition().GetPositionY()) > 50)
{
diff --git a/src/scripts/eastern_kingdoms/alterac_valley/boss_vanndar.cpp b/src/scripts/eastern_kingdoms/alterac_valley/boss_vanndar.cpp
index 43b674ff4c0..959e548f76f 100644
--- a/src/scripts/eastern_kingdoms/alterac_valley/boss_vanndar.cpp
+++ b/src/scripts/eastern_kingdoms/alterac_valley/boss_vanndar.cpp
@@ -100,7 +100,7 @@ struct boss_vanndarAI : public ScriptedAI
} else uiYellTimer -= diff;
// check if creature is not outside of building
- if(uiResetTimer <= diff)
+ if (uiResetTimer <= diff)
{
if (m_creature->GetDistance2d(m_creature->GetHomePosition().GetPositionX(), m_creature->GetHomePosition().GetPositionY()) > 50)
{
diff --git a/src/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp b/src/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp
index 9d255893927..df93b22541c 100644
--- a/src/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp
+++ b/src/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp
@@ -53,9 +53,9 @@ bool GOHello_go_shadowforge_brazier(Player* pPlayer, GameObject* pGo)
else
pInstance->SetData(TYPE_LYCEUM, IN_PROGRESS);
// If used brazier open linked doors (North or South)
- if(pGo->GetGUID() == pInstance->GetData64(DATA_SF_BRAZIER_N))
+ if (pGo->GetGUID() == pInstance->GetData64(DATA_SF_BRAZIER_N))
pInstance->HandleGameObject(pInstance->GetData64(DATA_GOLEM_DOOR_N), true);
- else if(pGo->GetGUID() == pInstance->GetData64(DATA_SF_BRAZIER_S))
+ else if (pGo->GetGUID() == pInstance->GetData64(DATA_SF_BRAZIER_S))
pInstance->HandleGameObject(pInstance->GetData64(DATA_GOLEM_DOOR_S), true);
}
return false;
diff --git a/src/scripts/eastern_kingdoms/blackrock_depths/boss_magmus.cpp b/src/scripts/eastern_kingdoms/blackrock_depths/boss_magmus.cpp
index 1854a7b2adc..fd654c2bdc9 100644
--- a/src/scripts/eastern_kingdoms/blackrock_depths/boss_magmus.cpp
+++ b/src/scripts/eastern_kingdoms/blackrock_depths/boss_magmus.cpp
@@ -79,7 +79,7 @@ struct boss_magmusAI : public ScriptedAI
// When he die open door to last chamber
void JustDied(Unit *who)
{
- if(ScriptedInstance* pInstance = who->GetInstanceData())
+ if (ScriptedInstance* pInstance = who->GetInstanceData())
pInstance->HandleGameObject(pInstance->GetData64(DATA_THRONE_DOOR), true);
}
};
diff --git a/src/scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp b/src/scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp
index 87ec1023b58..5564634f344 100644
--- a/src/scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp
+++ b/src/scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp
@@ -166,7 +166,7 @@ struct instance_blackrock_depths : public ScriptedInstance
case NPC_ANGERREL: TombBossGUIDs[6] = pCreature->GetGUID(); break;
case NPC_MAGMUS:
MagmusGUID = pCreature->GetGUID();
- if(!pCreature->isAlive())
+ if (!pCreature->isAlive())
HandleGameObject(GetData64(DATA_THRONE_DOOR), true); // if Magmus is dead open door to last boss
break;
}
diff --git a/src/scripts/eastern_kingdoms/blackwing_lair/boss_nefarian.cpp b/src/scripts/eastern_kingdoms/blackwing_lair/boss_nefarian.cpp
index a81ca4c9640..f946e17b2d5 100644
--- a/src/scripts/eastern_kingdoms/blackwing_lair/boss_nefarian.cpp
+++ b/src/scripts/eastern_kingdoms/blackwing_lair/boss_nefarian.cpp
@@ -108,9 +108,9 @@ struct boss_nefarianAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
- if( DespawnTimer <= diff)
+ if ( DespawnTimer <= diff)
{
- if(!UpdateVictim())
+ if (!UpdateVictim())
m_creature->ForcedDespawn();
DespawnTimer = 5000;
} else DespawnTimer -= diff;
diff --git a/src/scripts/eastern_kingdoms/duskwood.cpp b/src/scripts/eastern_kingdoms/duskwood.cpp
index d9aa69a4545..77cd1a3bc08 100644
--- a/src/scripts/eastern_kingdoms/duskwood.cpp
+++ b/src/scripts/eastern_kingdoms/duskwood.cpp
@@ -31,12 +31,12 @@ bool AreaTrigger_at_twilight_grove(Player* pPlayer, const AreaTriggerEntry *at)
{
if (pPlayer->HasQuestForItem(21149))
{
- if(Unit* TCorrupter = pPlayer->SummonCreature(15625,-10328.16,-489.57,49.95,0,TEMPSUMMON_MANUAL_DESPAWN,60000))
+ if (Unit* TCorrupter = pPlayer->SummonCreature(15625,-10328.16,-489.57,49.95,0,TEMPSUMMON_MANUAL_DESPAWN,60000))
{
TCorrupter->setFaction(14);
TCorrupter->SetMaxHealth(832750);
}
- if(Unit* CorrupterSpeaker = pPlayer->SummonCreature(1,pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()-1,0,TEMPSUMMON_TIMED_DESPAWN,15000))
+ if (Unit* CorrupterSpeaker = pPlayer->SummonCreature(1,pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()-1,0,TEMPSUMMON_TIMED_DESPAWN,15000))
{
CorrupterSpeaker->SetName("Twilight Corrupter");
CorrupterSpeaker->SetVisibility(VISIBILITY_ON);
@@ -90,7 +90,7 @@ struct boss_twilight_corrupterAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
- if(!UpdateVictim())
+ if (!UpdateVictim())
return;
if (SoulCorruption_Timer <= diff)
{
diff --git a/src/scripts/eastern_kingdoms/gnomeregan/gnomeregan.cpp b/src/scripts/eastern_kingdoms/gnomeregan/gnomeregan.cpp
index b4948c2132f..465ed5da357 100644
--- a/src/scripts/eastern_kingdoms/gnomeregan/gnomeregan.cpp
+++ b/src/scripts/eastern_kingdoms/gnomeregan/gnomeregan.cpp
@@ -209,17 +209,17 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
{
Map::PlayerList const &PlList = m_creature->GetMap()->GetPlayers();
- if(PlList.isEmpty())
+ if (PlList.isEmpty())
return;
for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
{
- if(Player* pPlayer = i->getSource())
+ if (Player* pPlayer = i->getSource())
{
- if(pPlayer->isGameMaster())
+ if (pPlayer->isGameMaster())
continue;
- if(pPlayer->isAlive())
+ if (pPlayer->isAlive())
{
pTemp->SetInCombatWith(pPlayer);
pPlayer->SetInCombatWith(pTemp);
diff --git a/src/scripts/eastern_kingdoms/karazhan/boss_curator.cpp b/src/scripts/eastern_kingdoms/karazhan/boss_curator.cpp
index d723cb3e678..f27203b8c75 100644
--- a/src/scripts/eastern_kingdoms/karazhan/boss_curator.cpp
+++ b/src/scripts/eastern_kingdoms/karazhan/boss_curator.cpp
@@ -147,7 +147,7 @@ struct boss_curatorAI : public ScriptedAI
}
else
{
- if(urand(0,1) == 0)
+ if (urand(0,1) == 0)
{
DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), m_creature);
}
diff --git a/src/scripts/eastern_kingdoms/karazhan/boss_moroes.cpp b/src/scripts/eastern_kingdoms/karazhan/boss_moroes.cpp
index 010d59b319a..90fbfc95d9c 100644
--- a/src/scripts/eastern_kingdoms/karazhan/boss_moroes.cpp
+++ b/src/scripts/eastern_kingdoms/karazhan/boss_moroes.cpp
@@ -134,7 +134,7 @@ struct boss_moroesAI : public ScriptedAI
DeSpawnAdds();
//remove aura from spell Garrote when Moroes dies
- if(pInstance)
+ if (pInstance)
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GARROTE);
}
@@ -275,7 +275,7 @@ struct boss_moroesAI : public ScriptedAI
std::list<Unit*> pTargets;
SelectTargetList(pTargets, 5, SELECT_TARGET_RANDOM, m_creature->GetMeleeReach()*5, true);
for (std::list<Unit*>::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i)
- if(!m_creature->IsWithinMeleeRange(*i))
+ if (!m_creature->IsWithinMeleeRange(*i))
{
DoCast(*i, SPELL_BLIND);
break;
diff --git a/src/scripts/eastern_kingdoms/karazhan/boss_netherspite.cpp b/src/scripts/eastern_kingdoms/karazhan/boss_netherspite.cpp
index 40f6f2bdab8..575f7db1552 100644
--- a/src/scripts/eastern_kingdoms/karazhan/boss_netherspite.cpp
+++ b/src/scripts/eastern_kingdoms/karazhan/boss_netherspite.cpp
@@ -71,7 +71,7 @@ struct boss_netherspiteAI : public ScriptedAI
// need core fix
for (int i=0; i<3; ++i)
{
- if(SpellEntry *spell = (SpellEntry*)GetSpellStore()->LookupEntry(PlayerBuff[i]))
+ if (SpellEntry *spell = (SpellEntry*)GetSpellStore()->LookupEntry(PlayerBuff[i]))
spell->AttributesEx |= SPELL_ATTR_EX_NEGATIVE;
}
}
@@ -92,7 +92,7 @@ struct boss_netherspiteAI : public ScriptedAI
bool IsBetween(WorldObject* u1, WorldObject *pTarget, WorldObject* u2) // the in-line checker
{
- if(!u1 || !u2 || !pTarget)
+ if (!u1 || !u2 || !pTarget)
return false;
float xn, yn, xp, yp, xh, yh;
@@ -104,7 +104,7 @@ struct boss_netherspiteAI : public ScriptedAI
yh = pTarget->GetPositionY();
// check if target is between (not checking distance from the beam yet)
- if(dist(xn,yn,xh,yh)>=dist(xn,yn,xp,yp) || dist(xp,yp,xh,yh)>=dist(xn,yn,xp,yp))
+ if (dist(xn,yn,xh,yh)>=dist(xn,yn,xp,yp) || dist(xp,yp,xh,yh)>=dist(xn,yn,xp,yp))
return false;
// check distance from the beam
return (abs((xn-xp)*yh+(yp-yn)*xh-xn*yp+xp*yn)/dist(xn,yn,xp,yp) < 1.5f);
@@ -135,7 +135,7 @@ struct boss_netherspiteAI : public ScriptedAI
pos[BLUE_PORTAL] = (r>1 ? 1: 2); // Blue Portal not on the left side (0)
for (int i=0; i<3; ++i)
- if(Creature *portal = m_creature->SummonCreature(PortalID[i],PortalCoord[pos[i]][0],PortalCoord[pos[i]][1],PortalCoord[pos[i]][2],0,TEMPSUMMON_TIMED_DESPAWN,60000))
+ if (Creature *portal = m_creature->SummonCreature(PortalID[i],PortalCoord[pos[i]][0],PortalCoord[pos[i]][1],PortalCoord[pos[i]][2],0,TEMPSUMMON_TIMED_DESPAWN,60000))
{
PortalGUID[i] = portal->GetGUID();
portal->AddAura(PortalVisual[i], portal);
@@ -146,9 +146,9 @@ struct boss_netherspiteAI : public ScriptedAI
{
for (int i=0; i<3; ++i)
{
- if(Creature *portal = Unit::GetCreature(*m_creature, PortalGUID[i]))
+ if (Creature *portal = Unit::GetCreature(*m_creature, PortalGUID[i]))
portal->DisappearAndDie();
- if(Creature *portal = Unit::GetCreature(*m_creature, BeamerGUID[i]))
+ if (Creature *portal = Unit::GetCreature(*m_creature, BeamerGUID[i]))
portal->DisappearAndDie();
PortalGUID[i] = 0;
BeamTarget[i] = 0;
@@ -158,14 +158,14 @@ struct boss_netherspiteAI : public ScriptedAI
void UpdatePortals() // Here we handle the beams' behavior
{
for (int j=0; j<3; ++j) // j = color
- if(Creature *portal = Unit::GetCreature(*m_creature, PortalGUID[j]))
+ if (Creature *portal = Unit::GetCreature(*m_creature, PortalGUID[j]))
{
// the one who's been casted upon before
Unit *current = Unit::GetUnit(*portal, BeamTarget[j]);
// temporary store for the best suitable beam reciever
Unit *pTarget = m_creature;
- if(Map* map = m_creature->GetMap())
+ if (Map* map = m_creature->GetMap())
{
Map::PlayerList const& players = map->GetPlayers();
@@ -173,7 +173,7 @@ struct boss_netherspiteAI : public ScriptedAI
for (Map::PlayerList::const_iterator i = players.begin(); i!=players.end(); ++i)
{
Player* p = i->getSource();
- if(p && p->isAlive() // alive
+ if (p && p->isAlive() // alive
&& (!pTarget || pTarget->GetDistance2d(portal)>p->GetDistance2d(portal)) // closer than current best
&& !p->HasAura(PlayerDebuff[j],0) // not exhausted
&& !p->HasAura(PlayerBuff[(j+1)%3],0) // not on another beam
@@ -183,31 +183,31 @@ struct boss_netherspiteAI : public ScriptedAI
}
}
// buff the target
- if(pTarget->GetTypeId() == TYPEID_PLAYER)
+ if (pTarget->GetTypeId() == TYPEID_PLAYER)
pTarget->AddAura(PlayerBuff[j], pTarget);
else
pTarget->AddAura(NetherBuff[j], pTarget);
// cast visual beam on the chosen target if switched
// simple target switching isn't working -> using BeamerGUID to cast (workaround)
- if(!current || pTarget != current)
+ if (!current || pTarget != current)
{
BeamTarget[j] = pTarget->GetGUID();
// remove currently beaming portal
- if(Creature *beamer = Unit::GetCreature(*portal, BeamerGUID[j]))
+ if (Creature *beamer = Unit::GetCreature(*portal, BeamerGUID[j]))
{
beamer->CastSpell(pTarget, PortalBeam[j], false);
beamer->DisappearAndDie();
BeamerGUID[j] = 0;
}
// create new one and start beaming on the target
- if(Creature *beamer = portal->SummonCreature(PortalID[j],portal->GetPositionX(),portal->GetPositionY(),portal->GetPositionZ(),portal->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,60000))
+ if (Creature *beamer = portal->SummonCreature(PortalID[j],portal->GetPositionX(),portal->GetPositionY(),portal->GetPositionZ(),portal->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,60000))
{
beamer->CastSpell(pTarget, PortalBeam[j], false);
BeamerGUID[j] = beamer->GetGUID();
}
}
// aggro target if Red Beam
- if(j==RED_PORTAL && m_creature->getVictim() != pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
+ if (j==RED_PORTAL && m_creature->getVictim() != pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
m_creature->getThreatManager().addThreat(pTarget, 100000.0f+DoGetThreat(m_creature->getVictim()));
}
}
@@ -241,7 +241,7 @@ struct boss_netherspiteAI : public ScriptedAI
void HandleDoors(bool open) // Massive Door switcher
{
- if(GameObject *Door = GameObject::GetGameObject(*m_creature, pInstance ? pInstance->GetData64(DATA_GO_MASSIVE_DOOR) : 0))
+ if (GameObject *Door = GameObject::GetGameObject(*m_creature, pInstance ? pInstance->GetData64(DATA_GO_MASSIVE_DOOR) : 0))
Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
}
@@ -259,7 +259,7 @@ struct boss_netherspiteAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
- if(!UpdateVictim())
+ if (!UpdateVictim())
return;
// Void Zone
@@ -277,7 +277,7 @@ struct boss_netherspiteAI : public ScriptedAI
Berserk = true;
} else NetherInfusionTimer -= diff;
- if(PortalPhase) // PORTAL PHASE
+ if (PortalPhase) // PORTAL PHASE
{
// Distribute beams and buffs
if (PortalTimer <= diff)
@@ -308,7 +308,7 @@ struct boss_netherspiteAI : public ScriptedAI
// Netherbreath
if (NetherbreathTimer <= diff)
{
- if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,40,true))
+ if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,40,true))
DoCast(pTarget, SPELL_NETHERBREATH);
NetherbreathTimer = urand(5000,7000);
} else NetherbreathTimer -= diff;
diff --git a/src/scripts/eastern_kingdoms/karazhan/boss_nightbane.cpp b/src/scripts/eastern_kingdoms/karazhan/boss_nightbane.cpp
index d90c0f74e7d..5554e6d700c 100644
--- a/src/scripts/eastern_kingdoms/karazhan/boss_nightbane.cpp
+++ b/src/scripts/eastern_kingdoms/karazhan/boss_nightbane.cpp
@@ -135,7 +135,7 @@ struct boss_nightbaneAI : public ScriptedAI
void HandleTerraceDoors(bool open)
{
- if(pInstance)
+ if (pInstance)
{
pInstance->HandleGameObject(pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_1), open);
pInstance->HandleGameObject(pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_2), open);
diff --git a/src/scripts/eastern_kingdoms/karazhan/boss_terestian_illhoof.cpp b/src/scripts/eastern_kingdoms/karazhan/boss_terestian_illhoof.cpp
index 3e5b888d211..df7a5b8b2d5 100644
--- a/src/scripts/eastern_kingdoms/karazhan/boss_terestian_illhoof.cpp
+++ b/src/scripts/eastern_kingdoms/karazhan/boss_terestian_illhoof.cpp
@@ -215,9 +215,9 @@ struct boss_terestianAI : public ScriptedAI
m_creature->RemoveAurasDueToSpell(SPELL_BROKEN_PACT);
- if(Minion* Kilrek = m_creature->GetFirstMinion())
+ if (Minion* Kilrek = m_creature->GetFirstMinion())
{
- if(!Kilrek->isAlive())
+ if (!Kilrek->isAlive())
{
Kilrek->UnSummon();
DoCast(m_creature, SPELL_SUMMON_IMP, true);
@@ -301,13 +301,13 @@ struct boss_terestianAI : public ScriptedAI
if (SummonTimer <= diff)
{
- if(!PortalGUID[0])
+ if (!PortalGUID[0])
DoCast(m_creature->getVictim(), SPELL_FIENDISH_PORTAL, false);
- if(!PortalGUID[1])
+ if (!PortalGUID[1])
DoCast(m_creature->getVictim(), SPELL_FIENDISH_PORTAL_1, false);
- if(PortalGUID[0] && PortalGUID[1])
+ if (PortalGUID[0] && PortalGUID[1])
{
if (Creature* pPortal = Unit::GetCreature(*m_creature, PortalGUID[urand(0,1)]))
pPortal->CastSpell(m_creature->getVictim(), SPELL_SUMMON_FIENDISIMP, false);
diff --git a/src/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp b/src/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp
index 394d25e5632..d1a1888b224 100644
--- a/src/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp
+++ b/src/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp
@@ -139,7 +139,7 @@ struct npc_unworthy_initiateAI : public ScriptedAI
wait_timer = 5000;
me->CastSpell(me, SPELL_DK_INITIATE_VISUAL, true);
- if(Player* starter = Unit::GetPlayer(playerGUID))
+ if (Player* starter = Unit::GetPlayer(playerGUID))
DoScriptText(say_event_attack[rand()%9], me, starter);
phase = PHASE_TO_ATTACK;
@@ -192,7 +192,7 @@ void npc_unworthy_initiateAI::UpdateAI(const uint32 diff)
case PHASE_CHAINED:
if (!anchorGUID)
{
- if(Creature *anchor = me->FindNearestCreature(29521, 30))
+ if (Creature *anchor = me->FindNearestCreature(29521, 30))
{
anchor->AI()->SetGUID(me->GetGUID());
anchor->CastSpell(me, SPELL_SOUL_PRISON_CHAIN, true);
@@ -611,7 +611,7 @@ struct npc_salanar_the_horsemanAI : public ScriptedAI
if (charmer->GetTypeId() == TYPEID_PLAYER)
{
// for quest Into the Realm of Shadows(12687)
- if(me->GetEntry() == 28788 && CAST_PLR(charmer)->GetQuestStatus(12687) == QUEST_STATUS_INCOMPLETE)
+ if (me->GetEntry() == 28788 && CAST_PLR(charmer)->GetQuestStatus(12687) == QUEST_STATUS_INCOMPLETE)
{
CAST_PLR(charmer)->GroupEventHappens(12687, me);
charmer->RemoveAurasDueToSpell(SPELL_EFFECT_OVERTAKE);
@@ -817,7 +817,7 @@ struct npc_scarlet_miner_cartAI : public PassiveAI
void DoAction(const int32 param)
{
- if(Creature *miner = Unit::GetCreature(*me, minerGUID))
+ if (Creature *miner = Unit::GetCreature(*me, minerGUID))
{
// very bad visual effect
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
@@ -829,8 +829,8 @@ struct npc_scarlet_miner_cartAI : public PassiveAI
void PassengerBoarded(Unit *who, int8 seatId, bool apply)
{
- if(!apply)
- if(Creature *miner = Unit::GetCreature(*me, minerGUID))
+ if (!apply)
+ if (Creature *miner = Unit::GetCreature(*me, minerGUID))
miner->DisappearAndDie();
}
};
@@ -880,7 +880,7 @@ struct npc_scarlet_minerAI : public npc_escortAI
AddWaypoint(11, 2202.595947, -6061.325684, 5.882018 );
AddWaypoint(12, 2188.974609, -6080.866699, 3.370027 );
- if(urand(0,1))
+ if (urand(0,1))
{
AddWaypoint(13, 2176.483887, -6110.407227, 1.855181 );
AddWaypoint(14, 2172.516602, -6146.752441, 1.074235 );
@@ -911,7 +911,7 @@ struct npc_scarlet_minerAI : public npc_escortAI
switch (i)
{
case 1:
- if(Unit *car = Unit::GetCreature(*me, carGUID))
+ if (Unit *car = Unit::GetCreature(*me, carGUID))
{
me->SetInFront(car);
me->SendMovementFlagUpdate();
@@ -922,7 +922,7 @@ struct npc_scarlet_minerAI : public npc_escortAI
IntroPhase = 1;
break;
case 17:
- if(Unit *car = Unit::GetCreature(*me, carGUID))
+ if (Unit *car = Unit::GetCreature(*me, carGUID))
{
me->SetInFront(car);
me->SendMovementFlagUpdate();
@@ -947,14 +947,14 @@ struct npc_scarlet_minerAI : public npc_escortAI
{
if (IntroPhase == 1)
{
- if(Creature *car = Unit::GetCreature(*me, carGUID))
+ if (Creature *car = Unit::GetCreature(*me, carGUID))
DoCast(car, SPELL_CART_DRAG);
IntroTimer = 800;
IntroPhase = 2;
}
else
{
- if(Creature *car = Unit::GetCreature(*me, carGUID))
+ if (Creature *car = Unit::GetCreature(*me, carGUID))
car->AI()->DoAction();
IntroPhase = 0;
}
@@ -980,12 +980,12 @@ bool GOHello_go_inconspicuous_mine_car(Player* pPlayer, GameObject* pGO)
if (pPlayer->GetQuestStatus(12701) == QUEST_STATUS_INCOMPLETE)
{
// Hack Why Trinity Dont Support Custom Summon Location
- if(Creature *miner = pPlayer->SummonCreature(28841, 2383.869629, -5900.312500, 107.996086, pPlayer->GetOrientation(),TEMPSUMMON_DEAD_DESPAWN, 1))
+ if (Creature *miner = pPlayer->SummonCreature(28841, 2383.869629, -5900.312500, 107.996086, pPlayer->GetOrientation(),TEMPSUMMON_DEAD_DESPAWN, 1))
{
pPlayer->CastSpell(pPlayer, SPELL_CART_SUMM, true);
- if(Creature *car = pPlayer->GetVehicleCreatureBase())
+ if (Creature *car = pPlayer->GetVehicleCreatureBase())
{
- if(car->GetEntry() == 28817)
+ if (car->GetEntry() == 28817)
{
car->AI()->SetGUID(miner->GetGUID());
CAST_AI(npc_scarlet_minerAI, miner->AI())->InitCartQuest(pPlayer);
diff --git a/src/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp b/src/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp
index 45300e9fb1c..fbc17d2a6dd 100644
--- a/src/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp
+++ b/src/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp
@@ -66,7 +66,7 @@ struct npc_crusade_persuadedAI : public ScriptedAI
{
if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && !uiSpeech_counter)
{
- if(CAST_PLR(caster)->GetQuestStatus(12720) == QUEST_STATUS_INCOMPLETE)
+ if (CAST_PLR(caster)->GetQuestStatus(12720) == QUEST_STATUS_INCOMPLETE)
{
uiPlayerGUID = caster->GetGUID();
uiSpeech_timer = 1000;
@@ -94,7 +94,7 @@ struct npc_crusade_persuadedAI : public ScriptedAI
if (uiSpeech_timer <= diff)
{
Player* pPlayer = Unit::GetPlayer(uiPlayerGUID);
- if(!pPlayer)
+ if (!pPlayer)
{
EnterEvadeMode();
return;
@@ -123,7 +123,7 @@ struct npc_crusade_persuadedAI : public ScriptedAI
return;
}
- if(!UpdateVictim())
+ if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
@@ -361,16 +361,16 @@ struct mob_scarlet_courierAI : public ScriptedAI
void MovementInform(uint32 type, uint32 id)
{
- if(type != POINT_MOTION_TYPE)
+ if (type != POINT_MOTION_TYPE)
return;
- if(id == 1)
+ if (id == 1)
uiStage = 2;
}
void UpdateAI(const uint32 diff)
{
- if(uiStage && !me->isInCombat())
+ if (uiStage && !me->isInCombat())
{
if (uiStage_timer <= diff)
{
@@ -388,7 +388,7 @@ struct mob_scarlet_courierAI : public ScriptedAI
break;
case 2:
if (GameObject* tree = me->FindNearestGameObject(GO_INCONSPICUOUS_TREE, 40.0f))
- if(Unit *unit = tree->GetOwner())
+ if (Unit *unit = tree->GetOwner())
AttackStart(unit);
break;
}
@@ -397,7 +397,7 @@ struct mob_scarlet_courierAI : public ScriptedAI
} else uiStage_timer -= diff;
}
- if(!UpdateVictim())
+ if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
@@ -474,7 +474,7 @@ struct mob_high_inquisitor_valrothAI : public ScriptedAI
void Shout()
{
- if(rand()%100 < 15)
+ if (rand()%100 < 15)
DoScriptText(RAND(SAY_VALROTH3,SAY_VALROTH4,SAY_VALROTH5), me);
}
diff --git a/src/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp b/src/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp
index 4561ec48212..9965c273cc1 100644
--- a/src/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp
+++ b/src/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp
@@ -579,7 +579,7 @@ struct npc_highlord_darion_mograineAI : public npc_escortAI
void EnterEvadeMode()
{
- if(!bIsBattle)//do not reset self if we are in battle
+ if (!bIsBattle)//do not reset self if we are in battle
npc_escortAI::EnterEvadeMode();
}
diff --git a/src/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp b/src/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp
index 62bbe42ab82..c59e73d6dc1 100644
--- a/src/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp
+++ b/src/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp
@@ -52,12 +52,12 @@ struct npc_valkyr_battle_maidenAI : public PassiveAI
if (FlyBackTimer <= diff)
{
Player *plr = NULL;
- if(me->isSummon())
- if(Unit *summoner = CAST_SUM(me)->GetSummoner())
- if(summoner->GetTypeId() == TYPEID_PLAYER)
+ if (me->isSummon())
+ if (Unit *summoner = CAST_SUM(me)->GetSummoner())
+ if (summoner->GetTypeId() == TYPEID_PLAYER)
plr = CAST_PLR(summoner);
- if(!plr)
+ if (!plr)
phase = 3;
switch(phase)
diff --git a/src/scripts/eastern_kingdoms/scarlet_monastery/boss_headless_horseman.cpp b/src/scripts/eastern_kingdoms/scarlet_monastery/boss_headless_horseman.cpp
index 563224c7384..dcc4b4dc3ec 100644
--- a/src/scripts/eastern_kingdoms/scarlet_monastery/boss_headless_horseman.cpp
+++ b/src/scripts/eastern_kingdoms/scarlet_monastery/boss_headless_horseman.cpp
@@ -824,7 +824,7 @@ bool GOHello_go_loosely_turned_soil(Player* pPlayer, GameObject* soil)
ScriptedInstance* pInstance = pPlayer->GetInstanceData();
if (pInstance)
{
- if(pInstance->GetData(DATA_HORSEMAN_EVENT) != NOT_STARTED)
+ if (pInstance->GetData(DATA_HORSEMAN_EVENT) != NOT_STARTED)
return true;
pInstance->SetData(DATA_HORSEMAN_EVENT, IN_PROGRESS);
}
diff --git a/src/scripts/eastern_kingdoms/silverpine_forest.cpp b/src/scripts/eastern_kingdoms/silverpine_forest.cpp
index d7319a6e290..b897db3138f 100644
--- a/src/scripts/eastern_kingdoms/silverpine_forest.cpp
+++ b/src/scripts/eastern_kingdoms/silverpine_forest.cpp
@@ -280,12 +280,12 @@ struct pyrewood_ambushAI : public ScriptedAI
{
//sLog.outString("DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer);
- if(!QuestInProgress)
+ if (!QuestInProgress)
return;
- if(KillCount && Phase < 6)
+ if (KillCount && Phase < 6)
{
- if(!UpdateVictim()) //reset() on target Despawn...
+ if (!UpdateVictim()) //reset() on target Despawn...
return;
DoMeleeAttackIfReady();
@@ -295,10 +295,10 @@ struct pyrewood_ambushAI : public ScriptedAI
switch (Phase)
{
case 0:
- if(WaitTimer == WAIT_SECS)
+ if (WaitTimer == WAIT_SECS)
m_creature->MonsterSay(NPCSAY_INIT, LANG_UNIVERSAL, 0); //no blizzlike
- if(WaitTimer <= diff)
+ if (WaitTimer <= diff)
{
WaitTimer -= diff;
return;
diff --git a/src/scripts/eastern_kingdoms/sunken_temple/instance_sunken_temple.cpp b/src/scripts/eastern_kingdoms/sunken_temple/instance_sunken_temple.cpp
index 6d040ed4885..8285e92c69e 100644
--- a/src/scripts/eastern_kingdoms/sunken_temple/instance_sunken_temple.cpp
+++ b/src/scripts/eastern_kingdoms/sunken_temple/instance_sunken_temple.cpp
@@ -100,7 +100,7 @@ struct instance_sunken_temple : public ScriptedInstance
switch(State)
{
case GO_ATALAI_STATUE1:
- if(!s1 && !s2 && !s3 && !s4 && !s5 && !s6)
+ if (!s1 && !s2 && !s3 && !s4 && !s5 && !s6)
{
if (GameObject *pAtalaiStatue1 = instance->GetGameObject(GOAtalaiStatue1))
UseStatue(pAtalaiStatue1);
@@ -109,7 +109,7 @@ struct instance_sunken_temple : public ScriptedInstance
};
break;
case GO_ATALAI_STATUE2:
- if(s1 && !s2 && !s3 && !s4 && !s5 && !s6)
+ if (s1 && !s2 && !s3 && !s4 && !s5 && !s6)
{
if (GameObject *pAtalaiStatue2 = instance->GetGameObject(GOAtalaiStatue2))
UseStatue(pAtalaiStatue2);
@@ -118,7 +118,7 @@ struct instance_sunken_temple : public ScriptedInstance
};
break;
case GO_ATALAI_STATUE3:
- if(s1 && s2 && !s3 && !s4 && !s5 && !s6)
+ if (s1 && s2 && !s3 && !s4 && !s5 && !s6)
{
if (GameObject *pAtalaiStatue3 = instance->GetGameObject(GOAtalaiStatue3))
UseStatue(pAtalaiStatue3);
@@ -127,7 +127,7 @@ struct instance_sunken_temple : public ScriptedInstance
};
break;
case GO_ATALAI_STATUE4:
- if(s1 && s2 && s3 && !s4 && !s5 && !s6)
+ if (s1 && s2 && s3 && !s4 && !s5 && !s6)
{
if (GameObject *pAtalaiStatue4 = instance->GetGameObject(GOAtalaiStatue4))
UseStatue(pAtalaiStatue4);
@@ -136,7 +136,7 @@ struct instance_sunken_temple : public ScriptedInstance
}
break;
case GO_ATALAI_STATUE5:
- if(s1 && s2 && s3 && s4 && !s5 && !s6)
+ if (s1 && s2 && s3 && s4 && !s5 && !s6)
{
if (GameObject *pAtalaiStatue5 = instance->GetGameObject(GOAtalaiStatue5))
UseStatue(pAtalaiStatue5);
@@ -145,7 +145,7 @@ struct instance_sunken_temple : public ScriptedInstance
}
break;
case GO_ATALAI_STATUE6:
- if(s1 && s2 && s3 && s4 && s5 && !s6)
+ if (s1 && s2 && s3 && s4 && s5 && !s6)
{
if (GameObject *pAtalaiStatue6 = instance->GetGameObject(GOAtalaiStatue6))
UseStatue(pAtalaiStatue6);
diff --git a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_brutallus.cpp b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_brutallus.cpp
index 8debcb9068f..48074a45a3e 100644
--- a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_brutallus.cpp
+++ b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_brutallus.cpp
@@ -265,7 +265,7 @@ struct boss_brutallusAI : public ScriptedAI
if (Intro && !IsIntro)
StartIntro();
- if(!Intro)
+ if (!Intro)
ScriptedAI::MoveInLineOfSight(who);
}
@@ -314,7 +314,7 @@ struct boss_brutallusAI : public ScriptedAI
std::list<Unit*> pTargets;
SelectTargetList(pTargets, 10, SELECT_TARGET_RANDOM, 100, true);
for (std::list<Unit*>::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i)
- if(!(*i)->HasAura(SPELL_BURN))
+ if (!(*i)->HasAura(SPELL_BURN))
{
(*i)->CastSpell((*i), SPELL_BURN, true);
break;
diff --git a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp
index 103b008c8d9..cbc1d861ec5 100644
--- a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp
+++ b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp
@@ -575,9 +575,9 @@ struct boss_alythessAI : public Scripted_NoMovementAI
}
}
}
- if(!m_creature->getVictim())
+ if (!m_creature->getVictim())
{
- if(pInstance)
+ if (pInstance)
{
Creature* sisiter = Unit::GetCreature((*m_creature),pInstance->GetData64(DATA_SACROLASH));
if (sisiter && !sisiter->isDead() && sisiter->getVictim())
diff --git a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kalecgos.cpp b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kalecgos.cpp
index 8b873e7fdd3..f1906ce3bbf 100644
--- a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kalecgos.cpp
+++ b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kalecgos.cpp
@@ -149,11 +149,11 @@ struct boss_kalecgosAI : public ScriptedAI
pInstance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED);
}
- if(Creature *Sath = Unit::GetCreature(*me, SathGUID))
+ if (Creature *Sath = Unit::GetCreature(*me, SathGUID))
Sath->AI()->EnterEvadeMode();
me->setFaction(14);
- if(!JustReseted)//first reset at create
+ if (!JustReseted)//first reset at create
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
@@ -223,7 +223,7 @@ struct boss_kalecgosAI : public ScriptedAI
}
else
{
- if(JustReseted)
+ if (JustReseted)
{
if (ResetTimer <= diff)
{
@@ -241,20 +241,20 @@ struct boss_kalecgosAI : public ScriptedAI
if (CheckTimer <= diff)
{
- if(me->GetDistance(CENTER_X, CENTER_Y, DRAGON_REALM_Z) >= 75)
+ if (me->GetDistance(CENTER_X, CENTER_Y, DRAGON_REALM_Z) >= 75)
{
me->AI()->EnterEvadeMode();
return;
}
if (HealthBelowPct(10) && !isEnraged)
{
- if(Creature* Sath = Unit::GetCreature(*me, SathGUID))
+ if (Creature* Sath = Unit::GetCreature(*me, SathGUID))
Sath->AI()->DoAction(DO_ENRAGE);
DoAction(DO_ENRAGE);
}
if (!isBanished && HealthBelowPct(1))
{
- if(Creature* Sath = Unit::GetCreature(*me, SathGUID))
+ if (Creature* Sath = Unit::GetCreature(*me, SathGUID))
{
if (Sath->HasAura(SPELL_BANISH))
{
@@ -303,16 +303,16 @@ struct boss_kalecgosAI : public ScriptedAI
std::list<HostileReference*> &m_threatlist = me->getThreatManager().getThreatList();
std::list<Unit*> targetList;
for (std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
- if((*itr)->getTarget() && (*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->GetGUID() != me->getVictim()->GetGUID() && !(*itr)->getTarget()->HasAura(AURA_SPECTRAL_EXHAUSTION) && (*itr)->getTarget()->GetPositionZ() > me->GetPositionZ()-5)
+ if ((*itr)->getTarget() && (*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->GetGUID() != me->getVictim()->GetGUID() && !(*itr)->getTarget()->HasAura(AURA_SPECTRAL_EXHAUSTION) && (*itr)->getTarget()->GetPositionZ() > me->GetPositionZ()-5)
targetList.push_back((*itr)->getTarget());
- if(targetList.empty())
+ if (targetList.empty())
{
SpectralBlastTimer = 1000;
return;
}
std::list<Unit*>::const_iterator i = targetList.begin();
advance(i, rand()%targetList.size());
- if((*i))
+ if ((*i))
{
(*i)->CastSpell((*i), SPELL_SPECTRAL_BLAST,true);
SpectralBlastTimer = 20000+rand()%5000;
@@ -325,7 +325,7 @@ struct boss_kalecgosAI : public ScriptedAI
void MoveInLineOfSight(Unit *who)
{
- if(JustReseted)//boss is invisible, don't attack
+ if (JustReseted)//boss is invisible, don't attack
return;
if (!m_creature->getVictim() && who->isTargetableForAttack() && (m_creature->IsHostileTo(who)))
{
@@ -360,7 +360,7 @@ struct boss_kalecgosAI : public ScriptedAI
void MovementInform(uint32 type,uint32 id)
{
- if(type != POINT_MOTION_TYPE)
+ if (type != POINT_MOTION_TYPE)
return;
me->SetVisibility(VISIBILITY_OFF);
if (isFriendly)
@@ -482,7 +482,7 @@ struct boss_sathrovarrAI : public ScriptedAI
void EnterCombat(Unit* who)
{
- if(Creature *Kalec = me->SummonCreature(MOB_KALEC, me->GetPositionX() + 10, me->GetPositionY() + 5, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0))
+ if (Creature *Kalec = me->SummonCreature(MOB_KALEC, me->GetPositionX() + 10, me->GetPositionY() + 5, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0))
{
KalecGUID = Kalec->GetGUID();
me->CombatStart(Kalec);
@@ -536,7 +536,7 @@ struct boss_sathrovarrAI : public ScriptedAI
Map::PlayerList const &PlayerList = pMap->GetPlayers();
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
- if(i->getSource()->GetPositionZ() <= DRAGON_REALM_Z-5)
+ if (i->getSource()->GetPositionZ() <= DRAGON_REALM_Z-5)
{
i->getSource()->RemoveAura(AURA_SPECTRAL_REALM);
i->getSource()->TeleportTo(me->GetMap()->GetId(),i->getSource()->GetPositionX(),i->getSource()->GetPositionY(),DRAGON_REALM_Z+5,i->getSource()->GetOrientation());
@@ -561,7 +561,7 @@ struct boss_sathrovarrAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
- if(!me->HasAura(AURA_SPECTRAL_INVISIBILITY))
+ if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY))
me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true);
if (!UpdateVictim())
return;
@@ -569,7 +569,7 @@ struct boss_sathrovarrAI : public ScriptedAI
if (CheckTimer <= diff)
{
Creature *Kalec = Unit::GetCreature(*me, KalecGUID);
- if(!Kalec || (Kalec && !Kalec->isAlive()))
+ if (!Kalec || (Kalec && !Kalec->isAlive()))
{
if (Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID))
Kalecgos->AI()->EnterEvadeMode();
@@ -577,14 +577,14 @@ struct boss_sathrovarrAI : public ScriptedAI
}
if (HealthBelowPct(10) && !isEnraged)
{
- if(Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID))
+ if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID))
Kalecgos->AI()->DoAction(DO_ENRAGE);
DoAction(DO_ENRAGE);
}
Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID);
if (Kalecgos)
{
- if(!Kalecgos->isInCombat())
+ if (!Kalecgos->isInCombat())
{
me->AI()->EnterEvadeMode();
return;
@@ -616,9 +616,9 @@ struct boss_sathrovarrAI : public ScriptedAI
{
for (std::list<HostileReference*>::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr)
{
- if(Unit* pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
+ if (Unit* pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
{
- if(pUnit->GetPositionZ() > me->GetPositionZ()+5)
+ if (pUnit->GetPositionZ() > me->GetPositionZ()+5)
{
me->getThreatManager().modifyThreatPercent(pUnit,-100);
}
@@ -629,7 +629,7 @@ struct boss_sathrovarrAI : public ScriptedAI
if (ShadowBoltTimer <= diff)
{
- if(!(rand()%5))DoScriptText(SAY_SATH_SPELL1, me);
+ if (!(rand()%5))DoScriptText(SAY_SATH_SPELL1, me);
DoCast(me, SPELL_SHADOW_BOLT);
ShadowBoltTimer = 7000+(rand()%3000);
} else ShadowBoltTimer -= diff;
@@ -644,7 +644,7 @@ struct boss_sathrovarrAI : public ScriptedAI
if (CorruptionStrikeTimer <= diff)
{
- if(!(rand()%5))DoScriptText(SAY_SATH_SPELL2, me);
+ if (!(rand()%5))DoScriptText(SAY_SATH_SPELL2, me);
DoCast(me->getVictim(), SPELL_CORRUPTION_STRIKE);
CorruptionStrikeTimer = 13000;
} else CorruptionStrikeTimer -= diff;
@@ -694,7 +694,7 @@ struct boss_kalecAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
- if(!me->HasAura(AURA_SPECTRAL_INVISIBILITY))
+ if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY))
me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true);
if (!UpdateVictim())
return;
@@ -751,7 +751,7 @@ bool GOkalecgos_teleporter(Player* pPlayer, GameObject* pGo)
Map::PlayerList const &PlayerList = pMap->GetPlayers();
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
- if(i->getSource() && i->getSource()->GetPositionZ() < DEMON_REALM_Z + 5)
+ if (i->getSource() && i->getSource()->GetPositionZ() < DEMON_REALM_Z + 5)
++SpectralPlayers;
}
if (pPlayer->HasAura(AURA_SPECTRAL_EXHAUSTION) || (MAX_PLAYERS_IN_SPECTRAL_REALM && SpectralPlayers >= MAX_PLAYERS_IN_SPECTRAL_REALM))
diff --git a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp
index b6711917f56..c2fcce96cdc 100644
--- a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp
+++ b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp
@@ -275,7 +275,7 @@ bool GOHello_go_orb_of_the_blue_flight(Player* pPlayer, GameObject* pGo)
pGo->SummonCreature(CREATURE_POWER_OF_THE_BLUE_DRAGONFLIGHT, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 121000);
pPlayer->CastSpell(pPlayer, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, true);
pGo->SetUInt32Value(GAMEOBJECT_FACTION, 0);
- if(pInstance)
+ if (pInstance)
Creature* Kalec = Unit::GetCreature(*pPlayer, pInstance->GetData64(DATA_KALECGOS_KJ));
//Kalec->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES);
pGo->GetPosition(x,y,z);
@@ -397,7 +397,7 @@ struct boss_kalecgos_kjAI : public ScriptedAI
}
}
}*/
- if(OrbGUID[random])
+ if (OrbGUID[random])
{
if (GameObject* pOrb = m_creature->GetMap()->GetGameObject(OrbGUID[random]))
{
@@ -548,7 +548,7 @@ struct boss_kiljaedenAI : public Scripted_NoMovementAI
// Reset the controller
if (pInstance)
- if(Creature* Control = CAST_CRE(Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))))
+ if (Creature* Control = CAST_CRE(Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))))
CAST_AI(Scripted_NoMovementAI, Control->AI())->Reset();
}
@@ -768,7 +768,7 @@ struct boss_kiljaedenAI : public Scripted_NoMovementAI
{
Phase = PHASE_SACRIFICE;
if (pInstance)
- if(Creature* Anveena = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_ANVEENA)))
+ if (Creature* Anveena = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_ANVEENA)))
Anveena->CastSpell(m_creature, SPELL_SACRIFICE_OF_ANVEENA, false);
OrbActivated = false;
ChangeTimers(true, 10000); // He shouldn't cast spells for ~10 seconds after Anveena's sacrifice. This will be done within Anveena's script
diff --git a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_muru.cpp b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_muru.cpp
index d7d70fa6919..d2d3e55b285 100644
--- a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_muru.cpp
+++ b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_muru.cpp
@@ -287,7 +287,7 @@ struct boss_muruAI : public Scripted_NoMovementAI
{
if (Timer[TIMER_PHASE] <= diff)
{
- if(!pInstance)
+ if (!pInstance)
return;
switch(pInstance->GetData(DATA_MURU_EVENT))
{
diff --git a/src/scripts/eastern_kingdoms/sunwell_plateau/instance_sunwell_plateau.cpp b/src/scripts/eastern_kingdoms/sunwell_plateau/instance_sunwell_plateau.cpp
index cb472e32bdd..cfc64ba18cd 100644
--- a/src/scripts/eastern_kingdoms/sunwell_plateau/instance_sunwell_plateau.cpp
+++ b/src/scripts/eastern_kingdoms/sunwell_plateau/instance_sunwell_plateau.cpp
@@ -200,13 +200,13 @@ struct instance_sunwell_plateau : public ScriptedInstance
{
case DATA_KALECGOS_EVENT:
{
- if(data == NOT_STARTED || data == DONE)
+ if (data == NOT_STARTED || data == DONE)
{
HandleGameObject(ForceField,true);
HandleGameObject(KalecgosWall[0],true);
HandleGameObject(KalecgosWall[1],true);
}
- else if(data == IN_PROGRESS)
+ else if (data == IN_PROGRESS)
{
HandleGameObject(ForceField,false);
HandleGameObject(KalecgosWall[0],false);
diff --git a/src/scripts/kalimdor/azuremyst_isle.cpp b/src/scripts/kalimdor/azuremyst_isle.cpp
index 280d78fc315..e773ecfaef1 100644
--- a/src/scripts/kalimdor/azuremyst_isle.cpp
+++ b/src/scripts/kalimdor/azuremyst_isle.cpp
@@ -490,7 +490,7 @@ struct npc_geezleAI : public ScriptedAI
for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
- if((*itr)->GetQuestStatus(QUEST_TREES_COMPANY)==QUEST_STATUS_INCOMPLETE
+ if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY)==QUEST_STATUS_INCOMPLETE
&&(*itr)->HasAura(SPELL_TREE_DISGUISE) )
{
(*itr)->KilledMonsterCredit(MOB_SPARK,0);
@@ -613,9 +613,9 @@ enum eRavegerCage
bool go_ravager_cage(Player* pPlayer, GameObject* pGo)
{
- if(pPlayer->GetQuestStatus(QUEST_STRENGTH_ONE) == QUEST_STATUS_INCOMPLETE)
+ if (pPlayer->GetQuestStatus(QUEST_STRENGTH_ONE) == QUEST_STATUS_INCOMPLETE)
{
- if(Creature* ravager = pGo->FindNearestCreature(NPC_DEATH_RAVAGER, 5.0f, true))
+ if (Creature* ravager = pGo->FindNearestCreature(NPC_DEATH_RAVAGER, 5.0f, true))
{
ravager->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE);
ravager->SetReactState(REACT_AGGRESSIVE);
@@ -646,14 +646,14 @@ struct npc_death_ravagerAI : public ScriptedAI
if (!UpdateVictim())
return;
- if(RendTimer <= diff)
+ if (RendTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_REND);
RendTimer = 30000;
}
else RendTimer -= diff;
- if(EnragingBiteTimer <= diff)
+ if (EnragingBiteTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_ENRAGING_BITE);
EnragingBiteTimer = 15000;
diff --git a/src/scripts/kalimdor/blackfathom_depths/blackfathom_deeps.cpp b/src/scripts/kalimdor/blackfathom_depths/blackfathom_deeps.cpp
index 3df3451c5bb..35452d06cf7 100644
--- a/src/scripts/kalimdor/blackfathom_depths/blackfathom_deeps.cpp
+++ b/src/scripts/kalimdor/blackfathom_depths/blackfathom_deeps.cpp
@@ -88,17 +88,17 @@ struct npc_blackfathom_deeps_eventAI : public ScriptedAI
{
Map::PlayerList const &PlList = m_creature->GetMap()->GetPlayers();
- if(PlList.isEmpty())
+ if (PlList.isEmpty())
return;
for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
{
- if(Player* pPlayer = i->getSource())
+ if (Player* pPlayer = i->getSource())
{
- if(pPlayer->isGameMaster())
+ if (pPlayer->isGameMaster())
continue;
- if(pPlayer->isAlive())
+ if (pPlayer->isAlive())
{
m_creature->SetInCombatWith(pPlayer);
pPlayer->SetInCombatWith(m_creature);
diff --git a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.cpp b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.cpp
index c1b38796cbb..9a784c781d2 100644
--- a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.cpp
+++ b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.cpp
@@ -469,7 +469,7 @@ struct npc_arthasAI : public npc_escortAI
DoMeleeAttackIfReady();
- if(bStepping)
+ if (bStepping)
{
if (uiPhaseTimer <= diff)
{
@@ -487,7 +487,7 @@ struct npc_arthasAI : public npc_escortAI
//After waypoint 0
case 1:
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
- if(Unit* pUther = m_creature->SummonCreature(NPC_UTHER,1794.357f,1272.183f,140.558f,1.37f,TEMPSUMMON_DEAD_DESPAWN,180000))
+ if (Unit* pUther = m_creature->SummonCreature(NPC_UTHER,1794.357f,1272.183f,140.558f,1.37f,TEMPSUMMON_DEAD_DESPAWN,180000))
{
uiUtherGUID = pUther->GetGUID();
pUther->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
@@ -1023,7 +1023,7 @@ struct npc_arthasAI : public npc_escortAI
//After Gossip 5
case 85:
DoScriptText(SAY_PHASE501, m_creature);
- if(Creature* pMalganis = m_creature->SummonCreature(NPC_MAL_GANIS,2296.665f,1502.362f,128.362f,4.961f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000))
+ if (Creature* pMalganis = m_creature->SummonCreature(NPC_MAL_GANIS,2296.665f,1502.362f,128.362f,4.961f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000))
{
uiMalganisGUID = pMalganis->GetGUID();
pMalganis->SetReactState(REACT_PASSIVE);
diff --git a/src/scripts/kalimdor/caverns_of_time/dark_portal/dark_portal.cpp b/src/scripts/kalimdor/caverns_of_time/dark_portal/dark_portal.cpp
index 2efed11fcf8..6a06bf2382c 100644
--- a/src/scripts/kalimdor/caverns_of_time/dark_portal/dark_portal.cpp
+++ b/src/scripts/kalimdor/caverns_of_time/dark_portal/dark_portal.cpp
@@ -292,7 +292,7 @@ struct npc_time_riftAI : public ScriptedAI
//normalize Z-level if we can, if rift is not at ground level.
pos.m_positionZ = std::max(m_creature->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), m_creature->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY));
- if(Unit *Summon = DoSummon(creature_entry, pos, 30000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT))
+ if (Unit *Summon = DoSummon(creature_entry, pos, 30000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT))
if (Unit *temp = Unit::GetUnit(*m_creature, pInstance ? pInstance->GetData64(DATA_MEDIVH) : 0))
Summon->AddThreat(temp,0.0f);
}
diff --git a/src/scripts/kalimdor/caverns_of_time/dark_portal/instance_dark_portal.cpp b/src/scripts/kalimdor/caverns_of_time/dark_portal/instance_dark_portal.cpp
index d6b85409e1a..5560d99787f 100644
--- a/src/scripts/kalimdor/caverns_of_time/dark_portal/instance_dark_portal.cpp
+++ b/src/scripts/kalimdor/caverns_of_time/dark_portal/instance_dark_portal.cpp
@@ -260,7 +260,7 @@ struct instance_dark_portal : public ScriptedInstance
//normalize Z-level if we can, if rift is not at ground level.
pos.m_positionZ = std::max(m_creature->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), m_creature->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY));
- if(Creature *summon = m_creature->SummonCreature(entry, pos, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000))
+ if (Creature *summon = m_creature->SummonCreature(entry, pos, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000))
return summon;
debug_log("TSCR: Instance Dark Portal: What just happened there? No boss, no loot, no fun...");
diff --git a/src/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp b/src/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp
index 92e65bfa0b4..879c9b723d9 100644
--- a/src/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp
+++ b/src/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp
@@ -868,7 +868,7 @@ void hyjalAI::UpdateAI(const uint32 diff)
CheckTimer = 0;
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
BossGUID[i] = 0;
- if(pInstance)
+ if (pInstance)
pInstance->DoUpdateWorldState(WORLD_STATE_ENEMY, 0); // Reset world state for enemies to disable it
}
}
diff --git a/src/scripts/kalimdor/durotar.cpp b/src/scripts/kalimdor/durotar.cpp
index 05af1aae3d4..8dbf33a2788 100644
--- a/src/scripts/kalimdor/durotar.cpp
+++ b/src/scripts/kalimdor/durotar.cpp
@@ -65,7 +65,7 @@ struct npc_lazy_peonAI : public ScriptedAI
caster->ToPlayer()->KilledMonsterCredit(m_creature->GetEntry(),m_creature->GetGUID());
DoScriptText(SAY_SPELL_HIT, m_creature, caster);
m_creature->RemoveAllAuras();
- if(GameObject* Lumberpile = m_creature->FindNearestGameObject(GO_LUMBERPILE, 20))
+ if (GameObject* Lumberpile = m_creature->FindNearestGameObject(GO_LUMBERPILE, 20))
m_creature->GetMotionMaster()->MovePoint(1,Lumberpile->GetPositionX()-1,Lumberpile->GetPositionY(),Lumberpile->GetPositionZ());
}
}
diff --git a/src/scripts/kalimdor/silithus.cpp b/src/scripts/kalimdor/silithus.cpp
index 1e90368183a..a6e7a89c7b2 100644
--- a/src/scripts/kalimdor/silithus.cpp
+++ b/src/scripts/kalimdor/silithus.cpp
@@ -499,7 +499,7 @@ struct npc_anachronos_the_ancientAI : public ScriptedAI
void HandleAnimation()
{
Player* plr = Unit::GetPlayer(PlayerGUID);
- if(!plr)
+ if (!plr)
return;
Unit* Fandral = plr->FindNearestCreature(C_FANDRAL_STAGHELM, 100, m_creature);
@@ -507,7 +507,7 @@ struct npc_anachronos_the_ancientAI : public ScriptedAI
Unit* Caelestrasz = plr->FindNearestCreature(C_CAELESTRASZ, 100, m_creature);
Unit* Merithra = plr->FindNearestCreature(C_MERITHRA, 100,m_creature);
- if(!Fandral || !Arygos || !Caelestrasz || !Merithra)
+ if (!Fandral || !Arygos || !Caelestrasz || !Merithra)
return;
Unit* mob;
@@ -724,13 +724,13 @@ struct npc_anachronos_the_ancientAI : public ScriptedAI
m_creature->GetMotionMaster()->MoveCharge(-8117.99,1532.24,3.94,4);
break;
case 60:
- if(plr)
+ if (plr)
DoScriptText(ANACHRONOS_SAY_10, m_creature,plr);
m_creature->GetMotionMaster()->MoveCharge(-8113.46,1524.16,2.89,4);
break;
case 61:
m_creature->GetMotionMaster()->MoveCharge(-8057.1,1470.32,2.61,6);
- if(plr->IsInRange(m_creature,0,15))
+ if (plr->IsInRange(m_creature,0,15))
plr->GroupEventHappens(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD ,m_creature);
break;
case 62:
@@ -745,7 +745,7 @@ struct npc_anachronos_the_ancientAI : public ScriptedAI
break;
case 65:
m_creature->SetVisibility(VISIBILITY_OFF);
- if(Creature* AnachronosQuestTrigger = (Unit::GetCreature(*m_creature, AnachronosQuestTriggerGUID)))
+ if (Creature* AnachronosQuestTrigger = (Unit::GetCreature(*m_creature, AnachronosQuestTriggerGUID)))
{
DoScriptText(ARYGOS_YELL_1,m_creature);
AnachronosQuestTrigger->AI()->EnterEvadeMode();
@@ -758,15 +758,15 @@ struct npc_anachronos_the_ancientAI : public ScriptedAI
}
void UpdateAI(const uint32 diff)
{
- if(AnimationTimer)
+ if (AnimationTimer)
{
- if(AnimationTimer <= diff)
+ if (AnimationTimer <= diff)
HandleAnimation();
else AnimationTimer -= diff;
}
- if(AnimationCount < 65)
+ if (AnimationCount < 65)
m_creature->CombatStop();
- if(AnimationCount == 65 || eventEnd)
+ if (AnimationCount == 65 || eventEnd)
m_creature->AI()->EnterEvadeMode();
}
};
@@ -801,32 +801,32 @@ struct mob_qiraj_war_spawnAI : public ScriptedAI
Unit *pTarget;
Player* plr = m_creature->GetPlayer(PlayerGUID);
- if(!Timers)
+ if (!Timers)
{
- if(m_creature->GetEntry() == 15424 || m_creature->GetEntry() == 15422 || m_creature->GetEntry() == 15414) //all but Kaldorei Soldiers
+ if (m_creature->GetEntry() == 15424 || m_creature->GetEntry() == 15422 || m_creature->GetEntry() == 15414) //all but Kaldorei Soldiers
{
SpellTimer1 = SpawnCast[1].Timer1;
SpellTimer2 = SpawnCast[2].Timer1;
SpellTimer3 = SpawnCast[3].Timer1;
}
- if(m_creature->GetEntry() == 15423 || m_creature->GetEntry() == 15424 || m_creature->GetEntry() == 15422 || m_creature->GetEntry() == 15414)
+ if (m_creature->GetEntry() == 15423 || m_creature->GetEntry() == 15424 || m_creature->GetEntry() == 15422 || m_creature->GetEntry() == 15414)
SpellTimer4 = SpawnCast[0].Timer1;
Timers = true;
}
- if(m_creature->GetEntry() == 15424 || m_creature->GetEntry() == 15422|| m_creature->GetEntry() == 15414)
+ if (m_creature->GetEntry() == 15424 || m_creature->GetEntry() == 15422|| m_creature->GetEntry() == 15414)
{
- if(SpellTimer1 <= diff)
+ if (SpellTimer1 <= diff)
{
DoCast(m_creature, SpawnCast[1].SpellId);
DoCast(m_creature, 24319);
SpellTimer1 = SpawnCast[1].Timer2;
} else SpellTimer1 -= diff;
- if(SpellTimer2 <= diff)
+ if (SpellTimer2 <= diff)
{
DoCast(m_creature, SpawnCast[2].SpellId);
SpellTimer2 = SpawnCast[2].Timer2;
} else SpellTimer2 -= diff;
- if(SpellTimer3 <= diff)
+ if (SpellTimer3 <= diff)
{
DoCast(m_creature, SpawnCast[3].SpellId);
SpellTimer3 = SpawnCast[3].Timer2;
@@ -834,7 +834,7 @@ struct mob_qiraj_war_spawnAI : public ScriptedAI
}
if (m_creature->GetEntry() == 15423 || m_creature->GetEntry() == 15424 || m_creature->GetEntry() == 15422 || m_creature->GetEntry() == 15414)
{
- if(SpellTimer4 <= diff)
+ if (SpellTimer4 <= diff)
{
m_creature->RemoveAllAttackers();
m_creature->AttackStop();
@@ -858,7 +858,7 @@ struct mob_qiraj_war_spawnAI : public ScriptedAI
pTarget = m_creature->FindNearestCreature(15414,20,true);
}
hasTarget = true;
- if(pTarget)
+ if (pTarget)
m_creature->AI()->AttackStart(pTarget);
}
if (!(m_creature->FindNearestCreature(15379,100)))
@@ -928,7 +928,7 @@ struct npc_anachronos_quest_triggerAI : public ScriptedAI
uint32 desptimer = WavesInfo[WaveCount].DespTimer;
Spawn = m_creature->SummonCreature(WavesInfo[WaveCount].CreatureId, X, Y, Z, O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer);
- if(Spawn)
+ if (Spawn)
{
Spawn->LoadCreaturesAddon();
if (Spawn->GetGUID()== 15423)
@@ -938,7 +938,7 @@ struct npc_anachronos_quest_triggerAI : public ScriptedAI
if (i >= 45) WaveCount = 3;
if (i >= 51) WaveCount = 4;
- if(WaveCount < 5) //1-4 Wave
+ if (WaveCount < 5) //1-4 Wave
{
CAST_AI(mob_qiraj_war_spawnAI, Spawn->AI())->MobGUID = m_creature->GetGUID();
CAST_AI(mob_qiraj_war_spawnAI, Spawn->AI())->PlayerGUID = PlayerGUID;
@@ -953,10 +953,10 @@ struct npc_anachronos_quest_triggerAI : public ScriptedAI
{
Player* pPlayer = Unit::GetPlayer(PlayerGUID);
- if(!pPlayer)
+ if (!pPlayer)
return;
- if(Group *EventGroup = pPlayer->GetGroup())
+ if (Group *EventGroup = pPlayer->GetGroup())
{
Player* GroupMember;
@@ -969,9 +969,9 @@ struct npc_anachronos_quest_triggerAI : public ScriptedAI
for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr)
{
GroupMember = (Unit::GetPlayer(itr->guid));
- if(!GroupMember)
+ if (!GroupMember)
continue;
- if(!GroupMember->IsWithinDistInMap(m_creature, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) == QUEST_STATUS_INCOMPLETE)
+ if (!GroupMember->IsWithinDistInMap(m_creature, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) == QUEST_STATUS_INCOMPLETE)
{
GroupMember->FailQuest(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD);
GroupMember->SetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD, QUEST_STATUS_NONE);
@@ -979,11 +979,11 @@ struct npc_anachronos_quest_triggerAI : public ScriptedAI
}
++GroupMemberCount;
- if(GroupMember->isDead())
+ if (GroupMember->isDead())
++DeadMemberCount;
}
- if(GroupMemberCount == FailedMemberCount || !pPlayer->IsWithinDistInMap(m_creature, EVENT_AREA_RADIUS))
+ if (GroupMemberCount == FailedMemberCount || !pPlayer->IsWithinDistInMap(m_creature, EVENT_AREA_RADIUS))
Failed = true; //only so event can restart
}
}
@@ -991,24 +991,24 @@ struct npc_anachronos_quest_triggerAI : public ScriptedAI
void LiveCounter()
{
--LiveCount;
- if(!LiveCount)
+ if (!LiveCount)
Announced = false;
}
void UpdateAI(const uint32 diff)
{
- if(!PlayerGUID || !EventStarted)
+ if (!PlayerGUID || !EventStarted)
return;
- if(WaveCount < 4)
+ if (WaveCount < 4)
{
- if(!Announced && AnnounceTimer <= diff)
+ if (!Announced && AnnounceTimer <= diff)
{
DoScriptText(WavesInfo[WaveCount].WaveTextId, m_creature);
Announced = true;
} else AnnounceTimer -= diff;
- if(WaveTimer <= diff)
+ if (WaveTimer <= diff)
SummonNextWave();
else WaveTimer -= diff;
}
@@ -1020,7 +1020,7 @@ struct npc_anachronos_quest_triggerAI : public ScriptedAI
void mob_qiraj_war_spawnAI::JustDied(Unit* slayer)
{
m_creature->RemoveCorpse();
- if(Creature* Mob = (Unit::GetCreature(*m_creature, MobGUID)))
+ if (Creature* Mob = (Unit::GetCreature(*m_creature, MobGUID)))
CAST_AI(npc_anachronos_quest_triggerAI, Mob->AI())->LiveCounter();
};
@@ -1030,10 +1030,10 @@ void mob_qiraj_war_spawnAI::JustDied(Unit* slayer)
bool GOQuestAccept_GO_crystalline_tear(Player* plr, GameObject* go, Quest const* quest)
{
- if(quest->GetQuestId() == QUEST_A_PAWN_ON_THE_ETERNAL_BOARD)
+ if (quest->GetQuestId() == QUEST_A_PAWN_ON_THE_ETERNAL_BOARD)
{
- if(Unit* Anachronos_Quest_Trigger = go->FindNearestCreature(15454, 100, plr))
+ if (Unit* Anachronos_Quest_Trigger = go->FindNearestCreature(15454, 100, plr))
{
Unit *Merithra = Anachronos_Quest_Trigger->SummonCreature(15378,-8034.535,1535.14,2.61,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,150000);
@@ -1042,7 +1042,7 @@ bool GOQuestAccept_GO_crystalline_tear(Player* plr, GameObject* go, Quest const*
/* Unit *Fandral = */ Anachronos_Quest_Trigger->SummonCreature(15382,-8028.462, 1535.843, 2.61, 3.141592,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,215000);
Creature *Anachronos = Anachronos_Quest_Trigger->SummonCreature(15381,-8028.75, 1538.795, 2.61, 4,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000);
- if(Merithra)
+ if (Merithra)
{
Merithra->SetUInt32Value(UNIT_NPC_FLAGS, 0);
Merithra->SetUInt32Value(UNIT_FIELD_BYTES_1,0);
@@ -1050,7 +1050,7 @@ bool GOQuestAccept_GO_crystalline_tear(Player* plr, GameObject* go, Quest const*
Merithra->setFaction(35);
}
- if(Caelestrasz)
+ if (Caelestrasz)
{
Caelestrasz->SetUInt32Value(UNIT_NPC_FLAGS, 0);
Caelestrasz->SetUInt32Value(UNIT_FIELD_BYTES_1,0);
@@ -1058,7 +1058,7 @@ bool GOQuestAccept_GO_crystalline_tear(Player* plr, GameObject* go, Quest const*
Caelestrasz->setFaction(35);
}
- if(Arygos)
+ if (Arygos)
{
Arygos->SetUInt32Value(UNIT_NPC_FLAGS, 0);
Arygos->SetUInt32Value(UNIT_FIELD_BYTES_1,0);
@@ -1066,7 +1066,7 @@ bool GOQuestAccept_GO_crystalline_tear(Player* plr, GameObject* go, Quest const*
Arygos->setFaction(35);
}
- if(Anachronos)
+ if (Anachronos)
{
CAST_AI(npc_anachronos_the_ancientAI, Anachronos->AI())->PlayerGUID = plr->GetGUID();
CAST_AI(npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Failed=false;
diff --git a/src/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp b/src/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp
index 80b9b2a36d6..5a73b25de8a 100644
--- a/src/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp
+++ b/src/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp
@@ -180,7 +180,7 @@ struct aqsentinelAI : public ScriptedAI
break;
Creature *pNearby = Unit::GetCreature(*m_creature, NearbyGUID[bli]);
- if(!pNearby)
+ if (!pNearby)
break;
AddSentinelsNear(pNearby);
diff --git a/src/scripts/kalimdor/thousand_needles.cpp b/src/scripts/kalimdor/thousand_needles.cpp
index 1a92c6a7226..49b5e33f45f 100644
--- a/src/scripts/kalimdor/thousand_needles.cpp
+++ b/src/scripts/kalimdor/thousand_needles.cpp
@@ -377,7 +377,7 @@ bool go_panther_cage(Player* pPlayer, GameObject* pGo)
if (pPlayer->GetQuestStatus(5151) == QUEST_STATUS_INCOMPLETE)
{
- if(Creature* panther = pGo->FindNearestCreature(ENRAGED_PANTHER, 5, true))
+ if (Creature* panther = pGo->FindNearestCreature(ENRAGED_PANTHER, 5, true))
{
panther->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE);
panther->SetReactState(REACT_AGGRESSIVE);
diff --git a/src/scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp b/src/scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp
index 934450ea370..b5c4981878a 100644
--- a/src/scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp
+++ b/src/scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp
@@ -207,7 +207,7 @@ struct boss_volazjAI : public ScriptedAI
// Check if all summons in this phase killed
for (SummonList::const_iterator iter = Summons.begin(); iter!=Summons.end(); ++iter)
{
- if(Creature *visage = Unit::GetCreature(*m_creature, *iter))
+ if (Creature *visage = Unit::GetCreature(*m_creature, *iter))
{
// Not all are dead
if (phase == visage->GetPhaseMask())
diff --git a/src/scripts/northrend/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp b/src/scripts/northrend/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp
index 53a2a8473b2..74561cd5865 100644
--- a/src/scripts/northrend/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp
+++ b/src/scripts/northrend/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp
@@ -279,7 +279,7 @@ struct boss_taldaramAI : public ScriptedAI
bool CheckSpheres()
{
- if(!pInstance)
+ if (!pInstance)
return false;
uint64 uiSphereGuids[2];
@@ -308,7 +308,7 @@ struct boss_taldaramAI : public ScriptedAI
void RemovePrison()
{
- if(!pInstance)
+ if (!pInstance)
return;
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
diff --git a/src/scripts/northrend/azjol_nerub/azjol_nerub/boss_anubarak.cpp b/src/scripts/northrend/azjol_nerub/azjol_nerub/boss_anubarak.cpp
index 6a6a4cbadd1..bd7430d6958 100644
--- a/src/scripts/northrend/azjol_nerub/azjol_nerub/boss_anubarak.cpp
+++ b/src/scripts/northrend/azjol_nerub/azjol_nerub/boss_anubarak.cpp
@@ -153,7 +153,7 @@ struct boss_anub_arakAI : public ScriptedAI
bGuardianSummoned = true;
}
- if(!bVenomancerSummoned)
+ if (!bVenomancerSummoned)
{
if (uiVenomancerTimer <= diff)
{
@@ -172,7 +172,7 @@ struct boss_anub_arakAI : public ScriptedAI
} else uiVenomancerTimer -= diff;
}
- if(!bDatterSummoned)
+ if (!bDatterSummoned)
{
if (uiDatterTimer <= diff)
{
diff --git a/src/scripts/northrend/borean_tundra.cpp b/src/scripts/northrend/borean_tundra.cpp
index f6075c7404d..bbebd070998 100644
--- a/src/scripts/northrend/borean_tundra.cpp
+++ b/src/scripts/northrend/borean_tundra.cpp
@@ -283,7 +283,7 @@ struct npc_sinkhole_kill_creditAI : public ScriptedAI
break;
case 7:
DoCast(m_creature, SPELL_EXPLODE_CART, true);
- if(Player *caster = Unit::GetPlayer(casterGuid))
+ if (Player *caster = Unit::GetPlayer(casterGuid))
caster->KilledMonster(m_creature->GetCreatureInfo(),m_creature->GetGUID());
uiPhaseTimer = 5000;
Phase = 8;
@@ -539,7 +539,7 @@ struct npc_jennyAI : public ScriptedAI
void Reset()
{
- if(!setCrateNumber)
+ if (!setCrateNumber)
setCrateNumber = true;
m_creature->SetReactState(REACT_PASSIVE);
@@ -563,7 +563,7 @@ struct npc_jennyAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
- if(setCrateNumber)
+ if (setCrateNumber)
{
m_creature->AddAura(SPELL_CRATES_CARRIED,m_creature);
setCrateNumber = false;
@@ -877,7 +877,7 @@ bool QuestAccept_npc_lurgglbr(Player* pPlayer, Creature* pCreature, Quest const
{
if (pQuest->GetQuestId() == QUEST_ESCAPE_WINTERFIN_CAVERNS)
{
- if(GameObject* pGo = pCreature->FindNearestGameObject(GO_CAGE, 5.0f))
+ if (GameObject* pGo = pCreature->FindNearestGameObject(GO_CAGE, 5.0f))
{
pGo->SetRespawnTime(0);
pGo->SetGoType(GAMEOBJECT_TYPE_BUTTON);
@@ -1432,7 +1432,7 @@ struct npc_counselor_talbotAI : public ScriptedAI
}
void MovementInform(uint32 uiType, uint32 uiId)
{
- if(uiType != POINT_MOTION_TYPE)
+ if (uiType != POINT_MOTION_TYPE)
return;
if (m_creature->isSummon())
@@ -1485,7 +1485,7 @@ struct npc_counselor_talbotAI : public ScriptedAI
Creature *pLeryssa = Unit::GetCreature(*m_creature, LeryssaGUID);
Creature *pArlos = Unit::GetCreature(*m_creature, ArlosGUID);
- if(!pLeryssa || !pArlos)
+ if (!pLeryssa || !pArlos)
return;
DoScriptText(SAY_ARLOS_1, pArlos);
@@ -1529,7 +1529,7 @@ struct npc_leryssaAI : public ScriptedAI
void MovementInform(uint32 uiType, uint32 uiId)
{
- if(uiType != POINT_MOTION_TYPE)
+ if (uiType != POINT_MOTION_TYPE)
return;
if (!bDone)
@@ -1967,7 +1967,7 @@ struct npc_bonker_togglevoltAI : public npc_escortAI
{
if (GetAttack() && UpdateVictim())
{
- if(Bonker_agro==0)
+ if (Bonker_agro==0)
{
DoScriptText(SAY_bonker_1,m_creature);
Bonker_agro++;
@@ -2187,12 +2187,12 @@ struct npc_seaforium_depth_chargeAI : public ScriptedAI
DoCast(SPELL_SEAFORIUM_DEPTH_CHARGE_EXPLOSION);
for (uint8 i = 0; i < 4; ++i)
{
- if(Creature* cCredit = m_creature->FindNearestCreature(25402 + i, 10.0f))//25402-25405 credit markers
+ if (Creature* cCredit = m_creature->FindNearestCreature(25402 + i, 10.0f))//25402-25405 credit markers
{
- if(Unit* uOwner = m_creature->GetOwner(true))
+ if (Unit* uOwner = m_creature->GetOwner(true))
{
Player* pOwner = uOwner->ToPlayer();
- if(pOwner && pOwner->GetQuestStatus(QUEST_BURY_THOSE_COCKROACHES) == QUEST_STATUS_INCOMPLETE)
+ if (pOwner && pOwner->GetQuestStatus(QUEST_BURY_THOSE_COCKROACHES) == QUEST_STATUS_INCOMPLETE)
pOwner->KilledMonsterCredit(cCredit->GetEntry(),cCredit->GetGUID());
}
}
diff --git a/src/scripts/northrend/crusaders_coliseum/trial_of_the_champion/boss_grand_champions.cpp b/src/scripts/northrend/crusaders_coliseum/trial_of_the_champion/boss_grand_champions.cpp
index f337eac0c81..06d47789f57 100644
--- a/src/scripts/northrend/crusaders_coliseum/trial_of_the_champion/boss_grand_champions.cpp
+++ b/src/scripts/northrend/crusaders_coliseum/trial_of_the_champion/boss_grand_champions.cpp
@@ -92,17 +92,17 @@ void AggroAllPlayers(Creature* pTemp)
{
Map::PlayerList const &PlList = pTemp->GetMap()->GetPlayers();
- if(PlList.isEmpty())
+ if (PlList.isEmpty())
return;
for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
{
- if(Player* pPlayer = i->getSource())
+ if (Player* pPlayer = i->getSource())
{
- if(pPlayer->isGameMaster())
+ if (pPlayer->isGameMaster())
continue;
- if(pPlayer->isAlive())
+ if (pPlayer->isAlive())
{
pTemp->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE);
pTemp->SetReactState(REACT_AGGRESSIVE);
diff --git a/src/scripts/northrend/crusaders_coliseum/trial_of_the_champion/trial_of_the_champion.cpp b/src/scripts/northrend/crusaders_coliseum/trial_of_the_champion/trial_of_the_champion.cpp
index 9ef8d15a509..030257a0605 100644
--- a/src/scripts/northrend/crusaders_coliseum/trial_of_the_champion/trial_of_the_champion.cpp
+++ b/src/scripts/northrend/crusaders_coliseum/trial_of_the_champion/trial_of_the_champion.cpp
@@ -373,17 +373,17 @@ struct npc_announcer_toc5AI : public ScriptedAI
{
Map::PlayerList const &PlList = m_creature->GetMap()->GetPlayers();
- if(PlList.isEmpty())
+ if (PlList.isEmpty())
return;
for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
{
- if(Player* pPlayer = i->getSource())
+ if (Player* pPlayer = i->getSource())
{
- if(pPlayer->isGameMaster())
+ if (pPlayer->isGameMaster())
continue;
- if(pPlayer->isAlive())
+ if (pPlayer->isAlive())
{
pTemp->SetHomePosition(m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),m_creature->GetOrientation());
pTemp->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE);
diff --git a/src/scripts/northrend/draktharon_keep/boss_novos.cpp b/src/scripts/northrend/draktharon_keep/boss_novos.cpp
index 0188228ee61..d327d0f6c9d 100644
--- a/src/scripts/northrend/draktharon_keep/boss_novos.cpp
+++ b/src/scripts/northrend/draktharon_keep/boss_novos.cpp
@@ -281,7 +281,7 @@ struct mob_novos_minionAI : public ScriptedAI
void MovementInform(uint32 type, uint32 id)
{
- if(type != POINT_MOTION_TYPE || id !=0)
+ if (type != POINT_MOTION_TYPE || id !=0)
return;
if (Creature* pNovos = Unit::GetCreature(*m_creature, pInstance ? pInstance->GetData64(DATA_NOVOS) : 0))
{
diff --git a/src/scripts/northrend/gundrak/boss_drakkari_colossus.cpp b/src/scripts/northrend/gundrak/boss_drakkari_colossus.cpp
index 25493d708a4..80c91012db2 100644
--- a/src/scripts/northrend/gundrak/boss_drakkari_colossus.cpp
+++ b/src/scripts/northrend/gundrak/boss_drakkari_colossus.cpp
@@ -54,7 +54,7 @@ struct boss_drakkari_colossusAI : public ScriptedAI
{
if (pInstance)
pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, NOT_STARTED);
- if(!m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE))
+ if (!m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE))
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->clearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT);
@@ -177,10 +177,10 @@ struct boss_drakkari_elementalAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
//Return since we have no target
- if(!UpdateVictim())
+ if (!UpdateVictim())
return;
- if(!bGoToColossus && HealthBelowPct(50))
+ if (!bGoToColossus && HealthBelowPct(50))
{
if (Creature *pColossus = Unit::GetCreature(*m_creature, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0))
{
diff --git a/src/scripts/northrend/gundrak/boss_eck.cpp b/src/scripts/northrend/gundrak/boss_eck.cpp
index 383b93126c2..45aa8e84720 100644
--- a/src/scripts/northrend/gundrak/boss_eck.cpp
+++ b/src/scripts/northrend/gundrak/boss_eck.cpp
@@ -86,7 +86,7 @@ struct boss_eckAI : public ScriptedAI
if (uiSpringTimer <= diff)
{
Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1);
- if(pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
+ if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
{
DoCast(pTarget, RAND(SPELL_ECK_SPRING_1, SPELL_ECK_SPRING_2));
uiSpringTimer = urand(5*IN_MILISECONDS,10*IN_MILISECONDS);
@@ -138,7 +138,7 @@ struct npc_ruins_dwellerAI : public ScriptedAI
void JustDied(Unit *who)
{
- if(pInstance)
+ if (pInstance)
{
pInstance->SetData64(DATA_RUIN_DWELLER_DIED,m_creature->GetGUID());
if (pInstance->GetData(DATA_ALIVE_RUIN_DWELLERS) == 0)
diff --git a/src/scripts/northrend/gundrak/boss_moorabi.cpp b/src/scripts/northrend/gundrak/boss_moorabi.cpp
index f0f972fe078..f10fd2091f1 100644
--- a/src/scripts/northrend/gundrak/boss_moorabi.cpp
+++ b/src/scripts/northrend/gundrak/boss_moorabi.cpp
@@ -92,7 +92,7 @@ struct boss_moorabiAI : public ScriptedAI
if (!UpdateVictim())
return;
- if(!bPhase && m_creature->HasAura(SPELL_TRANSFORMATION))
+ if (!bPhase && m_creature->HasAura(SPELL_TRANSFORMATION))
{
bPhase = true;
m_creature->RemoveAura(SPELL_MOJO_FRENZY);
diff --git a/src/scripts/northrend/howling_fjord.cpp b/src/scripts/northrend/howling_fjord.cpp
index cb534aeb6f1..0e9821c5e70 100644
--- a/src/scripts/northrend/howling_fjord.cpp
+++ b/src/scripts/northrend/howling_fjord.cpp
@@ -80,7 +80,7 @@ struct npc_Apothecary_HanesAI : public npc_escortAI
void UpdateEscortAI(const uint32 diff)
{
- if(HealthBelowPct(75))
+ if (HealthBelowPct(75))
{
if (PotTimer <= diff)
{
@@ -166,9 +166,9 @@ struct npc_plaguehound_trackerAI : public npc_escortAI
void InitScriptData()
{
Player* pPlayer = NULL;
- if(me->isSummon())
- if(Unit* summoner = CAST_SUM(me)->GetSummoner())
- if(summoner->GetTypeId() == TYPEID_PLAYER)
+ if (me->isSummon())
+ if (Unit* summoner = CAST_SUM(me)->GetSummoner())
+ if (summoner->GetTypeId() == TYPEID_PLAYER)
pPlayer = CAST_PLR(summoner);
if (!pPlayer)
@@ -181,9 +181,9 @@ struct npc_plaguehound_trackerAI : public npc_escortAI
void WaypointReached(uint32 i)
{
Player* pPlayer = NULL;
- if(me->isSummon())
- if(Unit* summoner = CAST_SUM(me)->GetSummoner())
- if(summoner->GetTypeId() == TYPEID_PLAYER)
+ if (me->isSummon())
+ if (Unit* summoner = CAST_SUM(me)->GetSummoner())
+ if (summoner->GetTypeId() == TYPEID_PLAYER)
pPlayer = CAST_PLR(summoner);
if (!pPlayer)
@@ -285,7 +285,7 @@ enum eMcGoyver
bool GossipHello_npc_mcgoyver(Player* pPlayer, Creature* pCreature)
{
- if(pPlayer->GetQuestStatus(QUEST_WE_CAN_REBUILD_IT) == QUEST_STATUS_INCOMPLETE)
+ if (pPlayer->GetQuestStatus(QUEST_WE_CAN_REBUILD_IT) == QUEST_STATUS_INCOMPLETE)
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MG_I, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
diff --git a/src/scripts/northrend/naxxramas/boss_patchwerk.cpp b/src/scripts/northrend/naxxramas/boss_patchwerk.cpp
index dad2ed5f4ff..436af04438d 100644
--- a/src/scripts/northrend/naxxramas/boss_patchwerk.cpp
+++ b/src/scripts/northrend/naxxramas/boss_patchwerk.cpp
@@ -66,13 +66,13 @@ struct boss_patchwerkAI : public BossAI
_JustDied();
DoScriptText(SAY_DEATH, me);
- if(EncounterTime <= MAX_ENCOUNTER_TIME)
+ if (EncounterTime <= MAX_ENCOUNTER_TIME)
{
AchievementEntry const *AchievMakeQuickWerkOfHim = GetAchievementStore()->LookupEntry(ACHIEVEMENT_MAKE_QUICK_WERK_OF_HIM);
- if(AchievMakeQuickWerkOfHim)
+ if (AchievMakeQuickWerkOfHim)
{
Map *pMap = m_creature->GetMap();
- if(pMap && pMap->IsDungeon())
+ if (pMap && pMap->IsDungeon())
{
Map::PlayerList const &players = pMap->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
diff --git a/src/scripts/northrend/naxxramas/boss_razuvious.cpp b/src/scripts/northrend/naxxramas/boss_razuvious.cpp
index 2575457aeac..8c82ab82726 100644
--- a/src/scripts/northrend/naxxramas/boss_razuvious.cpp
+++ b/src/scripts/northrend/naxxramas/boss_razuvious.cpp
@@ -66,7 +66,7 @@ struct boss_razuviousAI : public BossAI
void DamageTaken(Unit* pDone_by, uint32& uiDamage)
{
// Damage done by the controlled Death Knight understudies should also count toward damage done by players
- if(pDone_by->GetTypeId() == TYPEID_UNIT && (pDone_by->GetEntry() == 16803 || pDone_by->GetEntry() == 29941))
+ if (pDone_by->GetTypeId() == TYPEID_UNIT && (pDone_by->GetEntry() == 16803 || pDone_by->GetEntry() == 29941))
{
me->LowerPlayerDamageReq(uiDamage);
}
diff --git a/src/scripts/northrend/naxxramas/boss_sapphiron.cpp b/src/scripts/northrend/naxxramas/boss_sapphiron.cpp
index 964810b340d..eba60190492 100644
--- a/src/scripts/northrend/naxxramas/boss_sapphiron.cpp
+++ b/src/scripts/northrend/naxxramas/boss_sapphiron.cpp
@@ -142,12 +142,12 @@ struct boss_sapphironAI : public BossAI
me->CastSpell(me, SPELL_DIES, true);
CheckPlayersFrostResist();
- if(CanTheHundredClub)
+ if (CanTheHundredClub)
{
AchievementEntry const *AchievTheHundredClub = GetAchievementStore()->LookupEntry(ACHIEVEMENT_THE_HUNDRED_CLUB);
- if(AchievTheHundredClub)
+ if (AchievTheHundredClub)
{
- if(pMap && pMap->IsDungeon())
+ if (pMap && pMap->IsDungeon())
{
Map::PlayerList const &players = pMap->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
@@ -174,12 +174,12 @@ struct boss_sapphironAI : public BossAI
void CheckPlayersFrostResist()
{
- if(CanTheHundredClub && pMap && pMap->IsDungeon())
+ if (CanTheHundredClub && pMap && pMap->IsDungeon())
{
Map::PlayerList const &players = pMap->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
- if(itr->getSource()->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE)
+ if (itr->getSource()->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE)
{
CanTheHundredClub = false;
break;
@@ -222,7 +222,7 @@ struct boss_sapphironAI : public BossAI
if (phase != PHASE_BIRTH && !UpdateCombatState() || !CheckInRoom())
return;
- if(CanTheHundredClub)
+ if (CanTheHundredClub)
{
if (CheckFrostResistTimer <= diff)
{
diff --git a/src/scripts/northrend/nexus/nexus/boss_keristrasza.cpp b/src/scripts/northrend/nexus/nexus/boss_keristrasza.cpp
index 541466fc238..a3b48aff667 100644
--- a/src/scripts/northrend/nexus/nexus/boss_keristrasza.cpp
+++ b/src/scripts/northrend/nexus/nexus/boss_keristrasza.cpp
@@ -114,7 +114,7 @@ struct boss_keristraszaAI : public ScriptedAI
bool CheckContainmentSpheres(bool remove_prison = false)
{
- if(!pInstance)
+ if (!pInstance)
return false;
auiContainmentSphereGUIDs[0] = pInstance->GetData64(ANOMALUS_CONTAINMET_SPHERE);
diff --git a/src/scripts/northrend/nexus/oculus/boss_drakos.cpp b/src/scripts/northrend/nexus/oculus/boss_drakos.cpp
index c19a0468897..7003bcc58d7 100644
--- a/src/scripts/northrend/nexus/oculus/boss_drakos.cpp
+++ b/src/scripts/northrend/nexus/oculus/boss_drakos.cpp
@@ -92,9 +92,9 @@ struct boss_drakosAI : public ScriptedAI
if (!UpdateVictim())
return;
- if(uiBombSummonTimer < diff)
+ if (uiBombSummonTimer < diff)
{
- if(bPostPull)
+ if (bPostPull)
{
m_creature->SummonCreature(NPC_UNSTABLE_SPHERE, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ());
m_creature->SummonCreature(NPC_UNSTABLE_SPHERE, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ());
@@ -104,9 +104,9 @@ struct boss_drakosAI : public ScriptedAI
uiBombSummonTimer = 2*IN_MILISECONDS;
} else uiBombSummonTimer -= diff;
- if(uiMagicPullTimer < diff)
+ if (uiMagicPullTimer < diff)
{
- if(bIsPulling)
+ if (bIsPulling)
{
if (pInstance)
{
@@ -128,14 +128,14 @@ struct boss_drakosAI : public ScriptedAI
}
} else uiMagicPullTimer -= diff;
- if(bPostPull)
+ if (bPostPull)
{
if (uiPostPullTimer < diff)
bPostPull = false;
else uiPostPullTimer -= diff;
}
- if(uiStompTimer < diff)
+ if (uiStompTimer < diff)
{
DoScriptText(RAND(SAY_STOMP_1,SAY_STOMP_2,SAY_STOMP_3), m_creature);
DoCast(DUNGEON_MODE(SPELL_THUNDERING_STOMP, SPELL_THUNDERING_STOMP_H));
@@ -183,13 +183,13 @@ struct npc_unstable_sphereAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
- if(uiPulseTimer < diff)
+ if (uiPulseTimer < diff)
{
DoCast(SPELL_UNSTABLE_SPHERE_PULSE);
uiPulseTimer = 3*IN_MILISECONDS;
} else uiPulseTimer -= diff;
- if(uiDeathTimer < diff)
+ if (uiDeathTimer < diff)
m_creature->DisappearAndDie();
else uiDeathTimer -= diff;
}
diff --git a/src/scripts/northrend/nexus/oculus/oculus.cpp b/src/scripts/northrend/nexus/oculus/oculus.cpp
index e3ac9365daa..27ea4ec1218 100644
--- a/src/scripts/northrend/nexus/oculus/oculus.cpp
+++ b/src/scripts/northrend/nexus/oculus/oculus.cpp
@@ -54,7 +54,7 @@ bool GossipHello_npc_oculus_drake(Player* pPlayer, Creature* pCreature)
if (pCreature->isQuestGiver())
pPlayer->PrepareQuestMenu(pCreature->GetGUID());
- if(pCreature->GetInstanceData()->GetData(DATA_DRAKOS_EVENT) == DONE)
+ if (pCreature->GetInstanceData()->GetData(DATA_DRAKOS_EVENT) == DONE)
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DRAKES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DRAKES, pCreature->GetGUID());
@@ -71,7 +71,7 @@ bool GossipSelect_npc_oculus_drake(Player* pPlayer, Creature* pCreature, uint32
switch(uiAction)
{
case GOSSIP_ACTION_INFO_DEF + 1:
- if(!HAS_ESSENCE(pPlayer))
+ if (!HAS_ESSENCE(pPlayer))
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
@@ -101,7 +101,7 @@ bool GossipSelect_npc_oculus_drake(Player* pPlayer, Creature* pCreature, uint32
switch(uiAction)
{
case GOSSIP_ACTION_INFO_DEF + 1:
- if(!HAS_ESSENCE(pPlayer))
+ if (!HAS_ESSENCE(pPlayer))
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
@@ -131,7 +131,7 @@ bool GossipSelect_npc_oculus_drake(Player* pPlayer, Creature* pCreature, uint32
switch(uiAction)
{
case GOSSIP_ACTION_INFO_DEF + 1:
- if(!HAS_ESSENCE(pPlayer))
+ if (!HAS_ESSENCE(pPlayer))
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
diff --git a/src/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp b/src/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp
index 05eb57afe12..fc469ea0f95 100644
--- a/src/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp
+++ b/src/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp
@@ -320,7 +320,7 @@ struct boss_sartharionAI : public ScriptedAI
void FetchDragons()
{
- if(!pInstance)
+ if (!pInstance)
return;
Creature* pFetchTene = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_TENEBRON));
Creature* pFetchShad = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_SHADRON));
@@ -517,7 +517,7 @@ struct boss_sartharionAI : public ScriptedAI
{
DoCast(pTarget, SPELL_LAVA_STRIKE);
- if(urand(0,4) == 4)
+ if (urand(0,4) == 4)
DoScriptText(RAND(SAY_SARTHARION_SPECIAL_1,SAY_SARTHARION_SPECIAL_2,SAY_SARTHARION_SPECIAL_3), m_creature);
}
m_uiLavaStrikeTimer = urand(5000,20000);
@@ -712,7 +712,7 @@ struct dummy_dragonAI : public ScriptedAI
case NPC_SHADRON:
{
iTextId = WHISPER_OPEN_PORTAL;
- if(pInstance && !pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS)
+ if (pInstance && !pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS)
m_creature->SummonCreature(NPC_ACOLYTE_OF_SHADRON, AcolyteofShadron.x, AcolyteofShadron.y , AcolyteofShadron.z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000);
else
m_creature->SummonCreature(NPC_ACOLYTE_OF_SHADRON, AcolyteofShadron2.x, AcolyteofShadron2.y , AcolyteofShadron2.z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000);
@@ -786,7 +786,7 @@ struct dummy_dragonAI : public ScriptedAI
{
if (m_uiMoveNextTimer <= uiDiff)
{
- if(m_uiWaypointId < MAX_WAYPOINT)
+ if (m_uiWaypointId < MAX_WAYPOINT)
m_creature->GetMotionMaster()->MovePoint(m_uiWaypointId,
m_aDragonCommon[m_uiWaypointId].m_fX, m_aDragonCommon[m_uiWaypointId].m_fY, m_aDragonCommon[m_uiWaypointId].m_fZ);
diff --git a/src/scripts/northrend/storm_peaks.cpp b/src/scripts/northrend/storm_peaks.cpp
index 18c02d96777..6d5440dba25 100644
--- a/src/scripts/northrend/storm_peaks.cpp
+++ b/src/scripts/northrend/storm_peaks.cpp
@@ -186,9 +186,9 @@ struct npc_goblin_prisonerAI : public ScriptedAI
{
m_creature->SetReactState(REACT_PASSIVE);
- if(GameObject* pGO = m_creature->FindNearestGameObject(GO_RUSTY_CAGE,5.0f))
+ if (GameObject* pGO = m_creature->FindNearestGameObject(GO_RUSTY_CAGE,5.0f))
{
- if(pGO->GetGoState() == GO_STATE_ACTIVE)
+ if (pGO->GetGoState() == GO_STATE_ACTIVE)
pGO->SetGoState(GO_STATE_READY);
}
}
@@ -236,13 +236,13 @@ struct npc_victorious_challengerAI : public ScriptedAI
if (!UpdateVictim())
return;
- if(RendTimer < diff)
+ if (RendTimer < diff)
{
DoCast(m_creature->getVictim(), SPELL_REND_VC, true);
RendTimer = 15000;
}else RendTimer -= diff;
- if(SunderArmorTimer < diff)
+ if (SunderArmorTimer < diff)
{
DoCast(m_creature->getVictim(), SPELL_SUNDER_ARMOR, true);
SunderArmorTimer = 10000;
@@ -260,7 +260,7 @@ struct npc_victorious_challengerAI : public ScriptedAI
bool GossipHello_npc_victorious_challenger(Player* pPlayer, Creature* pCreature)
{
- if(pCreature->isQuestGiver())
+ if (pCreature->isQuestGiver())
pPlayer->PrepareQuestMenu(pCreature->GetGUID());
if (pPlayer->GetQuestStatus(QUEST_TAKING_ALL_CHALLENGERS) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_DEFENDING_YOUR_TITLE) == QUEST_STATUS_INCOMPLETE)
diff --git a/src/scripts/northrend/ulduar/halls_of_stone/boss_maiden_of_grief.cpp b/src/scripts/northrend/ulduar/halls_of_stone/boss_maiden_of_grief.cpp
index e97ede02101..4b098b5f288 100644
--- a/src/scripts/northrend/ulduar/halls_of_stone/boss_maiden_of_grief.cpp
+++ b/src/scripts/northrend/ulduar/halls_of_stone/boss_maiden_of_grief.cpp
@@ -100,7 +100,7 @@ struct boss_maiden_of_griefAI : public ScriptedAI
{
Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
- if(pTarget)
+ if (pTarget)
DoCast(pTarget, SPELL_PARTING_SORROW);
PartingSorrowTimer = 30000 + rand()%10000;
diff --git a/src/scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp b/src/scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp
index 6e099371f3d..f45ddf1d007 100644
--- a/src/scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp
+++ b/src/scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp
@@ -269,7 +269,7 @@ struct mob_iron_sludgeAI : public ScriptedAI
void JustDied(Unit* pKiller)
{
if (pInstance)
- if(Creature* pSjonnir = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_SJONNIR)))
+ if (Creature* pSjonnir = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_SJONNIR)))
CAST_AI(boss_sjonnirAI, pSjonnir->AI())->KilledIronSludge();
}
};
diff --git a/src/scripts/northrend/ulduar/halls_of_stone/halls_of_stone.cpp b/src/scripts/northrend/ulduar/halls_of_stone/halls_of_stone.cpp
index bd655c1ec1a..1725c32fdf3 100644
--- a/src/scripts/northrend/ulduar/halls_of_stone/halls_of_stone.cpp
+++ b/src/scripts/northrend/ulduar/halls_of_stone/halls_of_stone.cpp
@@ -184,7 +184,7 @@ struct mob_tribuna_controllerAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
- if(bKaddrakActivated)
+ if (bKaddrakActivated)
{
if (uiKaddrakEncounterTimer <= diff)
{
diff --git a/src/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp b/src/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp
index b167156f2d9..31c03816c6f 100644
--- a/src/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp
+++ b/src/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp
@@ -133,9 +133,9 @@ struct boss_flame_leviathanAI : public BossAI
void SpellHit(Unit *caster, const SpellEntry *spell)
{
- if(spell->Id == 62472)
+ if (spell->Id == 62472)
vehicle->InstallAllAccessories();
- else if(spell->Id == SPELL_ELECTROSHOCK)
+ else if (spell->Id == SPELL_ELECTROSHOCK)
m_creature->InterruptSpell(CURRENT_CHANNELED_SPELL);
}
@@ -166,7 +166,7 @@ struct boss_flame_leviathanAI : public BossAI
DoCastAOE(SPELL_PURSUED, true);
//events.RepeatEvent(35000); // this should not be used because eventId may be overriden
events.RescheduleEvent(EVENT_PURSUE, 35000);
- if(!m_creature->getVictim()) // all siege engines and demolishers are dead
+ if (!m_creature->getVictim()) // all siege engines and demolishers are dead
UpdateVictim(); // begin to kill other things
return;
case EVENT_MISSILE:
@@ -183,8 +183,8 @@ struct boss_flame_leviathanAI : public BossAI
events.RepeatEvent(15000);
return;
case EVENT_SUMMON:
- if(summons.size() < 15) // 4seat+1turret+10lift
- if(Creature *lift = DoSummonFlyer(MOB_MECHANOLIFT, me, urand(20,40), 50, 0))
+ if (summons.size() < 15) // 4seat+1turret+10lift
+ if (Creature *lift = DoSummonFlyer(MOB_MECHANOLIFT, me, urand(20,40), 50, 0))
lift->GetMotionMaster()->MoveRandom(100);
events.RepeatEvent(2000);
return;
@@ -222,7 +222,7 @@ struct boss_flame_leviathan_seatAI : public PassiveAI
#ifdef BOSS_DEBUG
void MoveInLineOfSight(Unit *who)
{
- if(who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->isGameMaster()
+ if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->isGameMaster()
&& !who->GetVehicle() && vehicle->GetPassenger(SEAT_TURRET))
who->EnterVehicle(vehicle, SEAT_PLAYER);
}
@@ -235,16 +235,16 @@ struct boss_flame_leviathan_seatAI : public PassiveAI
if (seatId == SEAT_PLAYER)
{
- if(!apply)
+ if (!apply)
return;
- if(Creature *turret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET)))
+ if (Creature *turret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET)))
{
turret->setFaction(m_creature->GetVehicleBase()->getFaction());
turret->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable
turret->AI()->AttackStart(who);
}
- if(Unit *device = vehicle->GetPassenger(SEAT_DEVICE))
+ if (Unit *device = vehicle->GetPassenger(SEAT_DEVICE))
{
device->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
device->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -288,17 +288,17 @@ struct boss_flame_leviathan_overload_deviceAI : public PassiveAI
void DoAction(const int32 param)
{
- if(param == EVENT_SPELLCLICK)
+ if (param == EVENT_SPELLCLICK)
{
m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- if(m_creature->GetVehicle())
+ if (m_creature->GetVehicle())
{
- if(Unit *player = m_creature->GetVehicle()->GetPassenger(SEAT_PLAYER))
+ if (Unit *player = m_creature->GetVehicle()->GetPassenger(SEAT_PLAYER))
{
player->ExitVehicle();
m_creature->GetVehicleBase()->CastSpell(player, SPELL_SMOKE_TRAIL, true);
- if(Unit *leviathan = m_creature->GetVehicleBase()->GetVehicleBase())
+ if (Unit *leviathan = m_creature->GetVehicleBase()->GetVehicleBase())
player->GetMotionMaster()->MoveKnockbackFrom(leviathan->GetPositionX(), leviathan->GetPositionY(), 30, 30);
}
}
@@ -312,9 +312,9 @@ struct boss_flame_leviathan_safety_containerAI : public PassiveAI
void MovementInform(uint32 type, uint32 id)
{
- if(id == m_creature->GetEntry())
+ if (id == m_creature->GetEntry())
{
- if(Creature *liquid = DoSummon(MOB_LIQUID, me, 0))
+ if (Creature *liquid = DoSummon(MOB_LIQUID, me, 0))
liquid->CastSpell(liquid, 62494, true);
m_creature->DisappearAndDie(); // this will relocate creature to sky
}
@@ -322,7 +322,7 @@ struct boss_flame_leviathan_safety_containerAI : public PassiveAI
void UpdateAI(const uint32 diff)
{
- if(!m_creature->GetVehicle() && m_creature->isSummon() && m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE)
+ if (!m_creature->GetVehicle() && m_creature->isSummon() && m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE)
m_creature->GetMotionMaster()->MoveFall(409.8f, m_creature->GetEntry());
}
};
@@ -341,7 +341,7 @@ struct spell_pool_of_tarAI : public TriggerAI
void SpellHit(Unit* caster, const SpellEntry *spell)
{
- if(spell->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !m_creature->HasAura(SPELL_BLAZE))
+ if (spell->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !m_creature->HasAura(SPELL_BLAZE))
m_creature->CastSpell(me, SPELL_BLAZE, true);
}
};
diff --git a/src/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp b/src/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp
index 3ffa8f9118b..dd2518fb783 100644
--- a/src/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp
+++ b/src/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp
@@ -117,19 +117,19 @@ struct boss_kologarnAI : public BossAI
case EVENT_NONE:
break;
case EVENT_SMASH:
- if(left && right)
+ if (left && right)
DoCastVictim(SPELL_TWO_ARM_SMASH, true);
- else if(left || right)
+ else if (left || right)
DoCastVictim(SPELL_ONE_ARM_SMASH, true);
events.RepeatEvent(15000);
break;
case EVENT_SWEEP:
- if(left)
+ if (left)
DoCastAOE(SPELL_ARM_SWEEP, true);
events.RepeatEvent(15000);
break;
case EVENT_GRIP:
- if(right)
+ if (right)
DoCastAOE(SPELL_STONE_GRIP, true);
events.RepeatEvent(15000);
break;
diff --git a/src/scripts/northrend/ulduar/ulduar/boss_razorscale.cpp b/src/scripts/northrend/ulduar/ulduar/boss_razorscale.cpp
index 0ac8f444fa3..7dba5317d57 100644
--- a/src/scripts/northrend/ulduar/ulduar/boss_razorscale.cpp
+++ b/src/scripts/northrend/ulduar/ulduar/boss_razorscale.cpp
@@ -110,7 +110,7 @@ struct boss_razorscaleAI : public BossAI
if (!UpdateVictim())
return;
- if(m_creature->GetPositionY() > -60 || m_creature->GetPositionX() < 450) // Not Blizzlike, anti-exploit to prevent players from pulling bosses to vehicles.
+ if (m_creature->GetPositionY() > -60 || m_creature->GetPositionX() < 450) // Not Blizzlike, anti-exploit to prevent players from pulling bosses to vehicles.
{
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
diff --git a/src/scripts/northrend/ulduar/ulduar/ulduar_teleporter.cpp b/src/scripts/northrend/ulduar/ulduar/ulduar_teleporter.cpp
index 9330de94e6e..469271bd5f7 100644
--- a/src/scripts/northrend/ulduar/ulduar/ulduar_teleporter.cpp
+++ b/src/scripts/northrend/ulduar/ulduar/ulduar_teleporter.cpp
@@ -24,21 +24,21 @@ The teleporter appears to be active and stable.
bool GoHello_ulduar_teleporter( Player *pPlayer, GameObject *pGO )
{
ScriptedInstance *pInstance = pGO->GetInstanceData();
- if(!pInstance) return true;
+ if (!pInstance) return true;
pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Expedition Base Camp", GOSSIP_SENDER_MAIN, BASE_CAMP);
pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Formation Grounds", GOSSIP_SENDER_MAIN, GROUNDS);
- if(pInstance->GetData(TYPE_LEVIATHAN) == DONE)
+ if (pInstance->GetData(TYPE_LEVIATHAN) == DONE)
{
pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Colossal Forge", GOSSIP_SENDER_MAIN, FORGE);
- if(pInstance->GetData(TYPE_XT002) == DONE)
+ if (pInstance->GetData(TYPE_XT002) == DONE)
{
pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Scrapyard", GOSSIP_SENDER_MAIN, SCRAPYARD);
pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Antechamber of Ulduar", GOSSIP_SENDER_MAIN, ANTECHAMBER);
- if(pInstance->GetData(TYPE_KOLOGARN) == DONE)
+ if (pInstance->GetData(TYPE_KOLOGARN) == DONE)
{
pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Shattered Walkway", GOSSIP_SENDER_MAIN, WALKWAY);
- if(pInstance->GetData(TYPE_AURIAYA) == DONE)
+ if (pInstance->GetData(TYPE_AURIAYA) == DONE)
pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Conservatory of Life", GOSSIP_SENDER_MAIN, CONSERVATORY);
}
}
@@ -50,8 +50,8 @@ bool GoHello_ulduar_teleporter( Player *pPlayer, GameObject *pGO )
bool GOSelect_ulduar_teleporter( Player *pPlayer, GameObject *pGO, uint32 sender, uint32 action )
{
- if(sender != GOSSIP_SENDER_MAIN) return true;
- if(!pPlayer->getAttackers().empty()) return true;
+ if (sender != GOSSIP_SENDER_MAIN) return true;
+ if (!pPlayer->getAttackers().empty()) return true;
switch(action)
{
diff --git a/src/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp b/src/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp
index 889bc93050f..9124b8dffc3 100644
--- a/src/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp
+++ b/src/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp
@@ -145,7 +145,7 @@ struct boss_palehoofAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
- if(currentPhase!=PHASE_GORTOK_PALEHOOF)
+ if (currentPhase!=PHASE_GORTOK_PALEHOOF)
return;
//Return since we have no target
if (!UpdateVictim())
@@ -194,7 +194,7 @@ struct boss_palehoofAI : public ScriptedAI
void NextPhase()
{
- if(currentPhase == PHASE_NONE)
+ if (currentPhase == PHASE_NONE)
{
pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, IN_PROGRESS);
m_creature->SummonCreature(MOB_STASIS_CONTROLLER,moveLocs[5].x,moveLocs[5].y,moveLocs[5].z,0,TEMPSUMMON_CORPSE_DESPAWN);
@@ -208,7 +208,7 @@ struct boss_palehoofAI : public ScriptedAI
uint8 next = urand(0,3);
for (uint8 i=0; i < 16; i++)
{
- if(!DoneAdds[i%4] && next == 0)
+ if (!DoneAdds[i%4] && next == 0)
{
move = (Phase)(i%4);
break;
@@ -223,7 +223,7 @@ struct boss_palehoofAI : public ScriptedAI
Creature *pOrb = Unit::GetCreature((*m_creature), pInstance ? pInstance->GetData64(DATA_MOB_ORB) : 0);
if (pOrb && pOrb->isAlive())
{
- if(currentPhase == PHASE_NONE)
+ if (currentPhase == PHASE_NONE)
pOrb->CastSpell(m_creature,SPELL_ORB_VISUAL,true);
pOrb->GetMotionMaster()->MovePoint(move,moveLocs[move].x,moveLocs[move].y,moveLocs[move].z);
}
@@ -274,7 +274,7 @@ struct mob_ravenous_furbolgAI : public ScriptedAI
m_creature->GetMotionMaster()->MoveTargetedHome();
if (pInstance)
- if(pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT)==IN_PROGRESS)
+ if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT)==IN_PROGRESS)
{
Creature *pPalehoof = Unit::GetCreature((*m_creature), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0);
if (pPalehoof && pPalehoof->isAlive())
@@ -380,7 +380,7 @@ struct mob_frenzied_worgenAI : public ScriptedAI
m_creature->GetMotionMaster()->MoveTargetedHome();
if (pInstance)
- if(pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT)==IN_PROGRESS)
+ if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT)==IN_PROGRESS)
{
Creature *pPalehoof = Unit::GetCreature((*m_creature), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0);
if (pPalehoof && pPalehoof->isAlive())
@@ -489,7 +489,7 @@ struct mob_ferocious_rhinoAI : public ScriptedAI
m_creature->GetMotionMaster()->MoveTargetedHome();
if (pInstance)
- if(pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT)==IN_PROGRESS)
+ if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT)==IN_PROGRESS)
{
Creature *pPalehoof = Unit::GetCreature((*m_creature), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0);
if (pPalehoof && pPalehoof->isAlive())
@@ -602,7 +602,7 @@ struct mob_massive_jormungarAI : public ScriptedAI
m_creature->GetMotionMaster()->MoveTargetedHome();
if (pInstance)
- if(pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS)
+ if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS)
{
Creature *pPalehoof = Unit::GetCreature((*m_creature), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0);
if (pPalehoof && pPalehoof->isAlive())
@@ -702,12 +702,12 @@ struct mob_palehoof_orbAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
- if(currentPhase==PHASE_NONE)
+ if (currentPhase==PHASE_NONE)
return;
- if(SummonTimer<=diff)
+ if (SummonTimer<=diff)
{
- if(currentPhase<5&&currentPhase>=0)
+ if (currentPhase<5&&currentPhase>=0)
{
Creature *pNext;
switch(currentPhase)
@@ -737,7 +737,7 @@ struct mob_palehoof_orbAI : public ScriptedAI
{
if (type != POINT_MOTION_TYPE)
return;
- if(id<0 || id>4)
+ if (id<0 || id>4)
return;
Creature *pNext;
switch(id)
@@ -748,7 +748,7 @@ struct mob_palehoof_orbAI : public ScriptedAI
case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*m_creature), pInstance ? pInstance->GetData64(DATA_MOB_FEROCIOUS_RHINO) : 0); break;
case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*m_creature), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break;
}
- if(pNext)
+ if (pNext)
DoCast(pNext, SPELL_ORB_CHANNEL, false);
currentPhase=(Phase)id;
SummonTimer=5000;
diff --git a/src/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp b/src/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp
index cf965bdb331..766d0699c5d 100644
--- a/src/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp
+++ b/src/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp
@@ -186,7 +186,7 @@ struct boss_skadiAI : public ScriptedAI
void MovementInform(uint32 type, uint32 id)
{
- if(type != POINT_MOTION_TYPE)
+ if (type != POINT_MOTION_TYPE)
return;
if (uiSpawnCounter >= DUNGEON_MODE(4, 5))
diff --git a/src/scripts/northrend/vault_of_archavon/boss_emalon.cpp b/src/scripts/northrend/vault_of_archavon/boss_emalon.cpp
index 3916b6d71c6..71c9047604e 100644
--- a/src/scripts/northrend/vault_of_archavon/boss_emalon.cpp
+++ b/src/scripts/northrend/vault_of_archavon/boss_emalon.cpp
@@ -116,7 +116,7 @@ struct boss_emalonAI : public BossAI
switch(eventId)
{
case EVENT_CHAIN_LIGHTNING:
- if(Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
+ if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
DoCast(pTarget, SPELL_CHAIN_LIGHTNING);
events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 25000);
break;
@@ -175,7 +175,7 @@ struct mob_tempest_minionAI : public ScriptedAI
void JustDied(Unit* Killer)
{
- if(Creature *pEmalon = Unit::GetCreature(*m_creature, pInstance ? pInstance->GetData64(DATA_EMALON) : 0))
+ if (Creature *pEmalon = Unit::GetCreature(*m_creature, pInstance ? pInstance->GetData64(DATA_EMALON) : 0))
{
if (pEmalon->isAlive())
{
@@ -190,7 +190,7 @@ struct mob_tempest_minionAI : public ScriptedAI
DoZoneInCombat();
events.ScheduleEvent(EVENT_SHOCK, 20000);
- if(Creature *pEmalon = Unit::GetCreature(*m_creature, pInstance ? pInstance->GetData64(DATA_EMALON) : 0))
+ if (Creature *pEmalon = Unit::GetCreature(*m_creature, pInstance ? pInstance->GetData64(DATA_EMALON) : 0))
{
if (!pEmalon->getVictim() && pEmalon->AI())
pEmalon->AI()->AttackStart(who);
diff --git a/src/scripts/northrend/violet_hold/boss_erekem.cpp b/src/scripts/northrend/violet_hold/boss_erekem.cpp
index 3b1454714cc..67c7632b94b 100644
--- a/src/scripts/northrend/violet_hold/boss_erekem.cpp
+++ b/src/scripts/northrend/violet_hold/boss_erekem.cpp
@@ -158,7 +158,7 @@ struct boss_erekemAI : public ScriptedAI
{
if (uint64 TargetGUID = GetChainHealTargetGUID())
{
- if(Creature *pTarget = Unit::GetCreature(*m_creature, TargetGUID))
+ if (Creature *pTarget = Unit::GetCreature(*m_creature, TargetGUID))
DoCast(pTarget, DUNGEON_MODE(SPELL_CHAIN_HEAL, H_SPELL_CHAIN_HEAL));
//If one of the adds is dead spawn heals faster
diff --git a/src/scripts/northrend/violet_hold/boss_moragg.cpp b/src/scripts/northrend/violet_hold/boss_moragg.cpp
index d543aae9d55..47d479ff23c 100644
--- a/src/scripts/northrend/violet_hold/boss_moragg.cpp
+++ b/src/scripts/northrend/violet_hold/boss_moragg.cpp
@@ -50,7 +50,7 @@ struct boss_moraggAI : public ScriptedAI
if (pInstance)
{
if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_MORAGG_CELL)))
- if(pDoor->GetGoState() == GO_STATE_READY)
+ if (pDoor->GetGoState() == GO_STATE_READY)
{
EnterEvadeMode();
return;
diff --git a/src/scripts/northrend/zuldrak.cpp b/src/scripts/northrend/zuldrak.cpp
index a944330b955..6550a3ce979 100644
--- a/src/scripts/northrend/zuldrak.cpp
+++ b/src/scripts/northrend/zuldrak.cpp
@@ -544,7 +544,7 @@ struct npc_orinoko_tuskbreakerAI : public ScriptedAI
pSummon->AI()->AttackStart(m_creature->getVictim());
break;
case NPC_HUNGRY_PENGUIN:
- if(Unit *pAffected = Unit::GetUnit(*m_creature, AffectedGUID))
+ if (Unit *pAffected = Unit::GetUnit(*m_creature, AffectedGUID))
{
if (pAffected->isAlive())
pSummon->AI()->AttackStart(pAffected);
diff --git a/src/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp b/src/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp
index 346970b86b6..8ff0ee6aa78 100644
--- a/src/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp
+++ b/src/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp
@@ -89,7 +89,7 @@ struct mob_voidtravelerAI : public ScriptedAI
if (move <= diff)
{
Creature *Vorpil = Unit::GetCreature(*m_creature, VorpilGUID);
- if(!Vorpil)
+ if (!Vorpil)
{
VorpilGUID = 0;
return;
diff --git a/src/scripts/outland/black_temple/boss_illidan.cpp b/src/scripts/outland/black_temple/boss_illidan.cpp
index 54e2139c4ca..8ee901f41dc 100644
--- a/src/scripts/outland/black_temple/boss_illidan.cpp
+++ b/src/scripts/outland/black_temple/boss_illidan.cpp
@@ -1003,7 +1003,7 @@ struct npc_akama_illidanAI : public ScriptedAI
DoorGUID[0] = pInstance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_R);
DoorGUID[1] = pInstance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_L);
- if(JustCreated)//close all doors at create
+ if (JustCreated)//close all doors at create
{
pInstance->HandleGameObject(GateGUID, false);
@@ -1058,7 +1058,7 @@ struct npc_akama_illidanAI : public ScriptedAI
void MovementInform(uint32 MovementType, uint32 Data)
{
- if(MovementType == POINT_MOTION_TYPE)
+ if (MovementType == POINT_MOTION_TYPE)
Timer = 1;
}
@@ -1107,7 +1107,7 @@ struct npc_akama_illidanAI : public ScriptedAI
{
m_creature->setActive(true);
m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- if(!JustCreated)
+ if (!JustCreated)
return;
float x, y, z;
if (GETGO(Gate, GateGUID))
@@ -1259,7 +1259,7 @@ struct npc_akama_illidanAI : public ScriptedAI
m_creature->InterruptNonMeleeSpells(true);
Spirit[0]->InterruptNonMeleeSpells(true);
Spirit[1]->InterruptNonMeleeSpells(true);
- if(pInstance)
+ if (pInstance)
pInstance->HandleGameObject(GateGUID, true);
Timer = 2000;
break;
@@ -1290,7 +1290,7 @@ struct npc_akama_illidanAI : public ScriptedAI
{
case 6:
for (uint8 i = 0; i < 2; ++i)
- if(pInstance)
+ if (pInstance)
pInstance->HandleGameObject(DoorGUID[i], true);
break;
case 8:
@@ -1314,11 +1314,11 @@ struct npc_akama_illidanAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
- if(m_creature->GetVisibility() == VISIBILITY_OFF)
+ if (m_creature->GetVisibility() == VISIBILITY_OFF)
{
if (Check_Timer <= diff)
{
- if(pInstance && pInstance->GetData(DATA_ILLIDARICOUNCILEVENT) == DONE)
+ if (pInstance && pInstance->GetData(DATA_ILLIDARICOUNCILEVENT) == DONE)
m_creature->SetVisibility(VISIBILITY_ON);
Check_Timer = 5000;
@@ -1337,7 +1337,7 @@ struct npc_akama_illidanAI : public ScriptedAI
switch(Phase)
{
case PHASE_CHANNEL:
- if(JustCreated)
+ if (JustCreated)
HandleChannelSequence();
else{
EnterPhase(PHASE_WALK);
diff --git a/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp b/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp
index 658c9316a67..9e783d4c1eb 100644
--- a/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp
+++ b/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp
@@ -98,7 +98,7 @@ struct boss_the_lurker_belowAI : public Scripted_NoMovementAI
bool CheckCanStart()//check if players fished
{
- if(pInstance && pInstance->GetData(DATA_STRANGE_POOL) == NOT_STARTED)
+ if (pInstance && pInstance->GetData(DATA_STRANGE_POOL) == NOT_STARTED)
return false;
return true;
}
@@ -151,7 +151,7 @@ struct boss_the_lurker_belowAI : public Scripted_NoMovementAI
void MoveInLineOfSight(Unit *who)
{
- if(!CanStartEvent)//boss is invisible, don't attack
+ if (!CanStartEvent)//boss is invisible, don't attack
return;
if (!m_creature->getVictim() && who->isTargetableForAttack() && (m_creature->IsHostileTo(who)))
{
@@ -165,17 +165,17 @@ struct boss_the_lurker_belowAI : public Scripted_NoMovementAI
void MovementInform(uint32 type, uint32 id)
{
- if(type == ROTATE_MOTION_TYPE)
+ if (type == ROTATE_MOTION_TYPE)
me->SetReactState(REACT_AGGRESSIVE);
}
void UpdateAI(const uint32 diff)
{
- if(!CanStartEvent)//boss is invisible, don't attack
+ if (!CanStartEvent)//boss is invisible, don't attack
{
- if(CheckCanStart())
+ if (CheckCanStart())
{
- if(Submerged)
+ if (Submerged)
{
m_creature->SetVisibility(VISIBILITY_ON);
Submerged = false;
@@ -201,9 +201,9 @@ struct boss_the_lurker_belowAI : public Scripted_NoMovementAI
return;
}
- if(m_creature->getThreatManager().getThreatList().empty())//check if should evade
+ if (m_creature->getThreatManager().getThreatList().empty())//check if should evade
{
- if(m_creature->isInCombat())
+ if (m_creature->isInCombat())
EnterEvadeMode();
return;
}
@@ -244,14 +244,14 @@ struct boss_the_lurker_belowAI : public Scripted_NoMovementAI
{
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
- if(m_creature->IsWithinMeleeRange(i->getSource()))
+ if (m_creature->IsWithinMeleeRange(i->getSource()))
InRange = true;
}
}
CheckTimer = 2000;
} else CheckTimer -= diff;
- if(RotTimer)
+ if (RotTimer)
{
Map* pMap = m_creature->GetMap();
if (pMap->IsDungeon())
@@ -287,7 +287,7 @@ struct boss_the_lurker_belowAI : public Scripted_NoMovementAI
GeyserTimer = rand()%5000 + 15000;
} else GeyserTimer -= diff;
- if(!InRange)//if on players in melee range cast Waterbolt
+ if (!InRange)//if on players in melee range cast Waterbolt
{
if (WaterboltTimer <= diff)
{
@@ -321,7 +321,7 @@ struct boss_the_lurker_belowAI : public Scripted_NoMovementAI
return;
} else PhaseTimer-=diff;
- if(m_creature->getThreatManager().getThreatList().empty())//check if should evade
+ if (m_creature->getThreatManager().getThreatList().empty())//check if should evade
{
EnterEvadeMode();
return;
diff --git a/src/scripts/outland/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp b/src/scripts/outland/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp
index 7f4d7e84739..9f1263aa5b9 100644
--- a/src/scripts/outland/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp
+++ b/src/scripts/outland/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp
@@ -131,7 +131,7 @@ struct instance_serpentshrine_cavern : public ScriptedInstance
void Update (uint32 diff)
{
//Lurker Fishing event
- if(LurkerSubEvent == LURKER_FISHING)
+ if (LurkerSubEvent == LURKER_FISHING)
{
if (FishingTimer <= diff)
{
@@ -142,7 +142,7 @@ struct instance_serpentshrine_cavern : public ScriptedInstance
//Water checks
if (WaterCheckTimer <= diff)
{
- if(TrashCount >= MIN_KILLS)
+ if (TrashCount >= MIN_KILLS)
Water = WATERSTATE_SCALDING;
else
Water = WATERSTATE_FRENZY;
@@ -156,19 +156,19 @@ struct instance_serpentshrine_cavern : public ScriptedInstance
{
if (pPlayer->isAlive() && /*i->getSource()->GetPositionZ() <= -21.434931f*/pPlayer->IsInWater())
{
- if(Water == WATERSTATE_SCALDING)
+ if (Water == WATERSTATE_SCALDING)
{
- if(!pPlayer->HasAura(SPELL_SCALDINGWATER))
+ if (!pPlayer->HasAura(SPELL_SCALDINGWATER))
{
pPlayer->CastSpell(pPlayer, SPELL_SCALDINGWATER,true);
}
- } else if(Water == WATERSTATE_FRENZY)
+ } else if (Water == WATERSTATE_FRENZY)
{
//spawn frenzy
- if(DoSpawnFrenzy)
+ if (DoSpawnFrenzy)
{
- if(Creature* frenzy = pPlayer->SummonCreature(MOB_COILFANG_FRENZY,pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ(),pPlayer->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,2000))
+ if (Creature* frenzy = pPlayer->SummonCreature(MOB_COILFANG_FRENZY,pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ(),pPlayer->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,2000))
{
frenzy->Attack(pPlayer,false);
frenzy->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_LEVITATING);
@@ -177,7 +177,7 @@ struct instance_serpentshrine_cavern : public ScriptedInstance
}
}
}
- if(!pPlayer->IsInWater())
+ if (!pPlayer->IsInWater())
pPlayer->RemoveAurasDueToSpell(SPELL_SCALDINGWATER);
}
@@ -215,7 +215,7 @@ struct instance_serpentshrine_cavern : public ScriptedInstance
pGo->setActive(true);
break;
case GAMEOBJECT_FISHINGNODE_ENTRY://no way checking if fish is hooked, so we create a timed event
- if(LurkerSubEvent == LURKER_NOT_STARTED)
+ if (LurkerSubEvent == LURKER_NOT_STARTED)
{
FishingTimer = 10000+rand()%30000;//random time before lurker emerges
LurkerSubEvent = LURKER_FISHING;
@@ -237,7 +237,7 @@ struct instance_serpentshrine_cavern : public ScriptedInstance
case 21215: LeotherasTheBlind = pCreature->GetGUID(); break;
/*case TRASHMOB_COILFANG_PRIESTESS:
case TRASHMOB_COILFANG_SHATTERER:
- if(pCreature->isAlive())
+ if (pCreature->isAlive())
++TrashCount;
break;*/
}
@@ -275,7 +275,7 @@ struct instance_serpentshrine_cavern : public ScriptedInstance
case DATA_STRANGE_POOL:
{
StrangePool = data;
- if(data == NOT_STARTED)
+ if (data == NOT_STARTED)
LurkerSubEvent = LURKER_NOT_STARTED;
}
break;
@@ -289,7 +289,7 @@ struct instance_serpentshrine_cavern : public ScriptedInstance
ControlConsole = data;break;
case DATA_TRASH :
{
- if(data == 1 && TrashCount < MIN_KILLS)
+ if (data == 1 && TrashCount < MIN_KILLS)
++TrashCount;//+1 died
SaveToDB();
break;
diff --git a/src/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp b/src/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp
index 2af55ffa15e..8984c1759d2 100644
--- a/src/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp
+++ b/src/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp
@@ -181,7 +181,7 @@ struct boss_high_king_maulgarAI : public ScriptedAI
void GetCouncil()
{
- if(pInstance)
+ if (pInstance)
{
//get council member's guid to respawn them if needed
Council[0] = pInstance->GetData64(DATA_KIGGLERTHECRAZED);
diff --git a/src/scripts/outland/netherstorm.cpp b/src/scripts/outland/netherstorm.cpp
index 6e339890707..587f432c6bb 100644
--- a/src/scripts/outland/netherstorm.cpp
+++ b/src/scripts/outland/netherstorm.cpp
@@ -711,7 +711,7 @@ struct mob_phase_hunterAI : public ScriptedAI
ManaBurnTimer = 5000 + (rand() % 3 * 1000); // 5-8 sec cd
- if(m_creature->GetEntry() == NPC_DRAINED_PHASE_HUNTER_ENTRY)
+ if (m_creature->GetEntry() == NPC_DRAINED_PHASE_HUNTER_ENTRY)
m_creature->UpdateEntry(NPC_PHASE_HUNTER_ENTRY);
}
@@ -748,13 +748,13 @@ struct mob_phase_hunterAI : public ScriptedAI
for (std::list<HostileReference*>::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr)
{
- if(Unit *pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
+ if (Unit *pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
{
- if(pUnit->GetCreateMana() > 0)
+ if (pUnit->GetCreateMana() > 0)
UnitsWithMana.push_back(pUnit);
}
}
- if(!UnitsWithMana.empty())
+ if (!UnitsWithMana.empty())
{
std::list<Unit*>::const_iterator it = UnitsWithMana.begin();
std::advance(it, rand() % UnitsWithMana.size());
diff --git a/src/scripts/outland/shadowmoon_valley.cpp b/src/scripts/outland/shadowmoon_valley.cpp
index 3a6a86613f9..f37b833515c 100644
--- a/src/scripts/outland/shadowmoon_valley.cpp
+++ b/src/scripts/outland/shadowmoon_valley.cpp
@@ -281,7 +281,7 @@ struct mob_enslaved_netherwing_drakeAI : public ScriptedAI
dz += 20; // so it's in the air, not ground*/
Position pos;
- if(Unit* EscapeDummy = me->FindNearestCreature(CREATURE_ESCAPE_DUMMY, 30))
+ if (Unit* EscapeDummy = me->FindNearestCreature(CREATURE_ESCAPE_DUMMY, 30))
EscapeDummy->GetPosition(&pos);
else
{
diff --git a/src/scripts/outland/tempest_keep/the_eye/boss_astromancer.cpp b/src/scripts/outland/tempest_keep/the_eye/boss_astromancer.cpp
index 148e174bed2..fcc76c4eec3 100644
--- a/src/scripts/outland/tempest_keep/the_eye/boss_astromancer.cpp
+++ b/src/scripts/outland/tempest_keep/the_eye/boss_astromancer.cpp
@@ -214,7 +214,7 @@ struct boss_high_astromancer_solarianAI : public ScriptedAI
if (Wrath_Timer <= diff)
{
m_creature->InterruptNonMeleeSpells(false);
- if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
+ if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
DoCast(pTarget, SPELL_WRATH_OF_THE_ASTROMANCER, true);
Wrath_Timer = 20000+rand()%5000;
} else Wrath_Timer -= diff;
diff --git a/src/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp b/src/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp
index 2f56606a031..26a744e6ff4 100644
--- a/src/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp
+++ b/src/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp
@@ -613,7 +613,7 @@ struct boss_kaelthasAI : public ScriptedAI
if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD))
{
Phase = 2;
- if(m_pInstance)
+ if (m_pInstance)
m_pInstance->SetData(DATA_KAELTHASEVENT, 2);
DoScriptText(SAY_PHASE2_WEAPON, m_creature);
@@ -656,7 +656,7 @@ struct boss_kaelthasAI : public ScriptedAI
if (Phase_Timer <= diff)
{
DoScriptText(SAY_PHASE3_ADVANCE, m_creature);
- if(m_pInstance)
+ if (m_pInstance)
m_pInstance->SetData(DATA_KAELTHASEVENT, 3);
Phase = 3;
PhaseSubphase = 0;
@@ -692,7 +692,7 @@ struct boss_kaelthasAI : public ScriptedAI
DoScriptText(SAY_PHASE4_INTRO2, m_creature);
Phase = 4;
- if(m_pInstance)
+ if (m_pInstance)
m_pInstance->SetData(DATA_KAELTHASEVENT, 4);
// Sometimes people can collect Aggro in Phase 1-3. Reset threat before releasing Kael.
@@ -785,7 +785,7 @@ struct boss_kaelthasAI : public ScriptedAI
{
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 50)
{
- if(m_pInstance)
+ if (m_pInstance)
m_pInstance->SetData(DATA_KAELTHASEVENT, 4);
Phase = 5;
Phase_Timer = 10000;
diff --git a/src/scripts/world/go_scripts.cpp b/src/scripts/world/go_scripts.cpp
index 25e794ec5ee..1ea5d5b9498 100644
--- a/src/scripts/world/go_scripts.cpp
+++ b/src/scripts/world/go_scripts.cpp
@@ -505,28 +505,28 @@ bool GOHello_go_matrix_punchograph(Player *pPlayer, GameObject *pGO)
switch(pGO->GetEntry())
{
case MATRIX_PUNCHOGRAPH_3005_A:
- if(pPlayer->HasItemCount(ITEM_WHITE_PUNCH_CARD, 1))
+ if (pPlayer->HasItemCount(ITEM_WHITE_PUNCH_CARD, 1))
{
pPlayer->DestroyItemCount(ITEM_WHITE_PUNCH_CARD, 1, true);
pPlayer->CastSpell(pPlayer,SPELL_YELLOW_PUNCH_CARD,true);
}
break;
case MATRIX_PUNCHOGRAPH_3005_B:
- if(pPlayer->HasItemCount(ITEM_YELLOW_PUNCH_CARD, 1))
+ if (pPlayer->HasItemCount(ITEM_YELLOW_PUNCH_CARD, 1))
{
pPlayer->DestroyItemCount(ITEM_YELLOW_PUNCH_CARD, 1, true);
pPlayer->CastSpell(pPlayer,SPELL_BLUE_PUNCH_CARD,true);
}
break;
case MATRIX_PUNCHOGRAPH_3005_C:
- if(pPlayer->HasItemCount(ITEM_BLUE_PUNCH_CARD, 1))
+ if (pPlayer->HasItemCount(ITEM_BLUE_PUNCH_CARD, 1))
{
pPlayer->DestroyItemCount(ITEM_BLUE_PUNCH_CARD, 1, true);
pPlayer->CastSpell(pPlayer,SPELL_RED_PUNCH_CARD,true);
}
break;
case MATRIX_PUNCHOGRAPH_3005_D:
- if(pPlayer->HasItemCount(ITEM_RED_PUNCH_CARD, 1))
+ if (pPlayer->HasItemCount(ITEM_RED_PUNCH_CARD, 1))
{
pPlayer->DestroyItemCount(ITEM_RED_PUNCH_CARD, 1, true);
pPlayer->CastSpell(pPlayer, SPELL_PRISMATIC_PUNCH_CARD, true);
@@ -549,7 +549,7 @@ enum eRustyCage
bool GOHello_go_rusty_cage(Player *pPlayer, GameObject *pGO)
{
- if(Creature *pGoblinPrisoner = pGO->FindNearestCreature(NPC_GOBLIN_PRISIONER, 5.0f, true))
+ if (Creature *pGoblinPrisoner = pGO->FindNearestCreature(NPC_GOBLIN_PRISIONER, 5.0f, true))
{
pGO->SetGoState(GO_STATE_ACTIVE);
pPlayer->KilledMonsterCredit(NPC_GOBLIN_PRISIONER, pGoblinPrisoner->GetGUID());
diff --git a/src/scripts/world/npcs_special.cpp b/src/scripts/world/npcs_special.cpp
index 977a57a9dd2..7e3325c7842 100644
--- a/src/scripts/world/npcs_special.cpp
+++ b/src/scripts/world/npcs_special.cpp
@@ -1250,7 +1250,7 @@ bool GossipSelect_npc_rogue_trainer(Player* pPlayer, Creature* pCreature, uint32
pPlayer->SendTalentWipeConfirm(pCreature->GetGUID());
break;
case GOSSIP_OPTION_LEARNDUALSPEC:
- if(pPlayer->GetSpecsCount() == 1 && !(pPlayer->getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL)))
+ if (pPlayer->GetSpecsCount() == 1 && !(pPlayer->getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL)))
{
if (pPlayer->GetMoney() < 10000000)
{
@@ -1805,7 +1805,7 @@ struct npc_ebon_gargoyleAI : CasterAI
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(m_creature, targets, u_check);
m_creature->VisitNearbyObject(30, searcher);
for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
- if((*iter)->GetAura(49206,owner->GetGUID()))
+ if ((*iter)->GetAura(49206,owner->GetGUID()))
{
me->Attack((*iter),false);
break;
@@ -1822,7 +1822,7 @@ struct npc_ebon_gargoyleAI : CasterAI
// Fly away when dismissed
void SpellHit(Unit *source, const SpellEntry *spell)
{
- if(spell->Id != 50515 || !me->isAlive() )
+ if (spell->Id != 50515 || !me->isAlive() )
return;
Unit *owner = me->GetOwner();