aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp4
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.cpp6
-rwxr-xr-xsrc/server/game/Chat/Commands/Level2.cpp2
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp32
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.h39
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp4
-rwxr-xr-xsrc/server/game/Entities/Object/Object.cpp6
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.cpp4
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp10
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h4
-rwxr-xr-xsrc/server/game/Entities/Transport/Transport.cpp2
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp22
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h6
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp2
-rwxr-xr-xsrc/server/game/Events/GameEventMgr.cpp4
-rwxr-xr-xsrc/server/game/Globals/ObjectAccessor.cpp6
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp6
-rwxr-xr-xsrc/server/game/Grids/ObjectGridLoader.cpp22
-rwxr-xr-xsrc/server/game/Grids/ObjectGridLoader.h3
-rwxr-xr-xsrc/server/game/Groups/Group.cpp32
-rwxr-xr-xsrc/server/game/Groups/Group.h16
-rwxr-xr-xsrc/server/game/Instances/InstanceSaveMgr.h6
-rwxr-xr-xsrc/server/game/Maps/Map.cpp120
-rwxr-xr-xsrc/server/game/Maps/Map.h34
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp2
-rwxr-xr-xsrc/server/game/Movement/Traveller.h4
-rwxr-xr-xsrc/server/game/Pools/PoolMgr.cpp8
-rwxr-xr-xsrc/server/game/Scripting/MapScripts.cpp21
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/CharacterHandler.cpp4
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/GroupHandler.cpp6
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/MovementHandler.cpp8
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/QueryHandler.cpp72
-rwxr-xr-xsrc/server/game/Server/WorldSession.cpp2
-rwxr-xr-xsrc/server/game/Server/WorldSession.h2
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp12
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp2
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp22
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp2
-rw-r--r--src/server/scripts/Commands/cs_account.cpp289
-rw-r--r--src/server/scripts/Commands/cs_achievement.cpp10
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp441
-rw-r--r--src/server/scripts/Commands/cs_event.cpp68
-rw-r--r--src/server/scripts/Commands/cs_gm.cpp58
-rw-r--r--src/server/scripts/Commands/cs_go.cpp330
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp425
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp6
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/undercity.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp8
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp15
-rw-r--r--src/server/scripts/Kalimdor/azshara.cpp2
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp54
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp3
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp5
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp2
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp4
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidan.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp4
70 files changed, 1220 insertions, 1111 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index cdea190dfbc..f210f077fdd 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -493,7 +493,7 @@ void npc_escortAI::SetEscortPaused(bool on)
bool npc_escortAI::SetNextWaypoint(uint32 pointId, float x, float y, float z, float orientation)
{
- me->SetPosition(x, y, z, orientation);
+ me->UpdatePosition(x, y, z, orientation);
return SetNextWaypoint(pointId, false, true);
}
@@ -516,7 +516,7 @@ bool npc_escortAI::SetNextWaypoint(uint32 pointId, bool setPosition, bool resetW
if (waypoint.id == pointId)
{
if (setPosition)
- me->SetPosition(waypoint.x, waypoint.y, waypoint.z, me->GetOrientation());
+ me->UpdatePosition(waypoint.x, waypoint.y, waypoint.z, me->GetOrientation());
CurrentWP = WaypointList.begin();
return true;
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index ce555b3c503..339f2ebba3b 100755
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -1454,7 +1454,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
data.go_state = 1;
*/
// Add to world, so it can be later looked up from HashMapHolder
- map->Add(go);
+ map->AddToMap(go);
m_BgObjects[type] = go->GetGUID();
return true;
}
@@ -1521,7 +1521,7 @@ void Battleground::SpawnBGObject(uint32 type, uint32 respawntime)
// Change state from GO_JUST_DEACTIVATED to GO_READY in case battleground is starting again
obj->SetLootState(GO_READY);
obj->SetRespawnTime(respawntime);
- map->Add(obj);
+ map->AddToMap(obj);
}
}
@@ -1557,7 +1557,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
creature->SetSpeed(MOVE_WALK, cinfo->speed_walk);
creature->SetSpeed(MOVE_RUN, cinfo->speed_run);
- map->Add(creature);
+ map->AddToMap(creature);
m_BgCreatures[type] = creature->GetGUID();
if (respawntime)
diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp
index 9e772e2cde7..b4b0cff9ea7 100755
--- a/src/server/game/Chat/Commands/Level2.cpp
+++ b/src/server/game/Chat/Commands/Level2.cpp
@@ -895,7 +895,7 @@ bool ChatHandler::HandleCreatePetCommand(const char* /*args*/)
pet->InitPetCreateSpells();
pet->SetFullHealth();
- pet->GetMap()->Add(pet->ToCreature());
+ pet->GetMap()->AddToMap(pet->ToCreature());
// visual effect for levelup
pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel());
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index a8e219f4f6b..3842cc1924e 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -143,7 +143,8 @@ m_PlayerDamageReq(0), m_lootMoney(0), m_lootRecipient(0), m_lootRecipientGroup(0
m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE),
m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false),
m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),
-m_creatureInfo(NULL), m_creatureData(NULL), m_formation(NULL)
+m_creatureInfo(NULL), m_creatureData(NULL), m_formation(NULL),
+MapCreature()
{
m_regenTimer = CREATURE_REGEN_INTERVAL;
m_valuesCount = UNIT_END;
@@ -2386,21 +2387,28 @@ const char* Creature::GetNameForLocaleIdx(LocaleConstant loc_idx) const
return GetName();
}
+//Do not if this works or not, moving creature to another map is very dangerous
void Creature::FarTeleportTo(Map* map, float X, float Y, float Z, float O)
{
- InterruptNonMeleeSpells(true);
- CombatStop();
- ClearComboPointHolders();
- DeleteThreatList();
- GetMotionMaster()->Clear(false);
- DestroyForNearbyPlayers();
-
- RemoveFromWorld();
- ResetMap();
+ CleanupBeforeRemoveFromMap(false);
+ GetMap()->RemoveFromMap(this, false);
+ Relocate(X, Y, Z, O);
SetMap(map);
- AddToWorld();
+ GetMap()->AddToMap(this);
+}
+
+void Creature::SetPosition(float x, float y, float z, float o)
+{
+ // prevent crash when a bad coord is sent by the client
+ if (!Trinity::IsValidMapCoord(x, y, z, o))
+ {
+ sLog->outDebug(LOG_FILTER_UNITS, "Creature::SetPosition(%f, %f, %f) .. bad coordinates!", x, y, z);
+ return;
+ }
- SetPosition(X, Y, Z, O, true);
+ GetMap()->CreatureRelocation(ToCreature(), x, y, z, o);
+ if (IsVehicle())
+ GetVehicleKit()->RelocatePassengers(x, y, z, o);
}
bool Creature::IsDungeonBoss() const
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 3d5b86a106a..1d25dd46992 100755
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -407,7 +407,36 @@ typedef std::map<uint32, time_t> CreatureSpellCooldowns;
#define MAX_VENDOR_ITEMS 150 // Limitation in 3.x.x item count in SMSG_LIST_INVENTORY
-class Creature : public Unit, public GridObject<Creature>
+enum CreatureCellMoveState
+{
+ CREATURE_CELL_MOVE_NONE, //not in move list
+ CREATURE_CELL_MOVE_ACTIVE, //in move list
+ CREATURE_CELL_MOVE_INACTIVE, //in move list but should not move
+};
+
+class MapCreature
+{
+ friend class Map; //map for moving creatures
+ friend class ObjectGridLoader; //grid loader for loading creatures
+
+public:
+ MapCreature() : _moveState(CREATURE_CELL_MOVE_NONE) {}
+
+private:
+ Cell _currentCell;
+ Cell const& GetCurrentCell() const { return _currentCell; }
+ void SetCurrentCell(Cell const& cell) { _currentCell = cell; }
+
+ CreatureCellMoveState _moveState;
+ Position _newPosition;
+ void SetNewCellPosition(float x, float y, float z, float o)
+ {
+ _moveState = CREATURE_CELL_MOVE_ACTIVE;
+ _newPosition.Relocate(x, y, z, o);
+ }
+};
+
+class Creature : public Unit, public GridObject<Creature>, public MapCreature
{
public:
@@ -598,10 +627,6 @@ class Creature : public Unit, public GridObject<Creature>
MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
- // for use only in LoadHelper, Map::Add Map::CreatureCellRelocation
- Cell const& GetCurrentCell() const { return m_currentCell; }
- void SetCurrentCell(Cell const& cell) { m_currentCell = cell; }
-
void RemoveCorpse(bool setSpawnTime = true);
void ForcedDespawn(uint32 timeMSToDespawn = 0);
@@ -639,6 +664,9 @@ class Creature : public Unit, public GridObject<Creature>
return m_charmInfo->GetCharmSpell(pos)->GetAction();
}
+ void SetPosition(float x, float y, float z, float o);
+ void SetPosition(const Position &pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }
+
void SetHomePosition(float x, float y, float z, float o) { m_homePosition.Relocate(x, y, z, o); }
void SetHomePosition(const Position &pos) { m_homePosition.Relocate(pos); }
void GetHomePosition(float &x, float &y, float &z, float &ori) { m_homePosition.GetPosition(x, y, z, ori); }
@@ -703,7 +731,6 @@ class Creature : public Unit, public GridObject<Creature>
void RegenerateHealth();
void Regenerate(Powers power);
MovementGeneratorType m_defaultMovementType;
- Cell m_currentCell; // store current cell where creature listed
uint32 m_DBTableGuid; ///< For new or temporary creatures is 0 for saved it is lowguid
uint32 m_equipmentId;
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 03da98d5624..6e991bdc005 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -382,7 +382,7 @@ void GameObject::Update(uint32 diff)
if (poolid)
sPoolMgr->UpdatePool<GameObject>(poolid, GetDBTableGUIDLow());
else
- GetMap()->Add(this);
+ GetMap()->AddToMap(this);
break;
}
}
@@ -595,7 +595,7 @@ void GameObject::Refresh()
return;
if (isSpawned())
- GetMap()->Add(this);
+ GetMap()->AddToMap(this);
}
void GameObject::AddUniqueUse(Player* player)
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 0b275f833e6..82c0eb3a169 100755
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -2199,7 +2199,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
summon->SetHomePosition(pos);
summon->InitStats(duration);
- Add(summon->ToCreature());
+ AddToMap(summon->ToCreature());
summon->InitSummon();
//ObjectAccessor::UpdateObjectVisibility(summon);
@@ -2307,7 +2307,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
break;
}
- map->Add(pet->ToCreature());
+ map->AddToMap(pet->ToCreature());
switch (petType)
{
@@ -2368,7 +2368,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
((Unit*)this)->AddGameObject(go);
else
go->SetSpawnedByDefault(false);
- map->Add(go);
+ map->AddToMap(go);
return go;
}
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 4150810a4ab..ca8d863dee9 100755
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -185,7 +185,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
CreatureTemplate const* cinfo = GetCreatureInfo();
if (cinfo->type == CREATURE_TYPE_CRITTER)
{
- map->Add(this->ToCreature());
+ map->AddToMap(this->ToCreature());
return true;
}
@@ -279,7 +279,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
}
owner->SetMinion(this, true);
- map->Add(this->ToCreature());
+ map->AddToMap(this->ToCreature());
InitTalentForLevel(); // set original talents points before spell loading
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 4a8e2c9de0d..01203dd1d54 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -2278,7 +2278,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// remove from old map now
if (oldmap)
- oldmap->Remove(this, false);
+ oldmap->RemoveFromMap(this, false);
// new final coordinates
float final_x = x;
@@ -5044,7 +5044,7 @@ void Player::BuildPlayerRepop()
sLog->outError("Error creating corpse for Player %s [%u]", GetName(), GetGUIDLow());
return;
}
- GetMap()->Add(corpse);
+ GetMap()->AddToMap(corpse);
// convert player body to ghost
SetHealth(1);
@@ -6727,9 +6727,9 @@ ActionButton const* Player::GetActionButton(uint8 button)
return &buttonItr->second;
}
-bool Player::SetPosition(float x, float y, float z, float orientation, bool teleport)
+bool Player::UpdatePosition(float x, float y, float z, float orientation, bool teleport)
{
- if (!Unit::SetPosition(x, y, z, orientation, teleport))
+ if (!Unit::UpdatePosition(x, y, z, orientation, teleport))
return false;
//if (movementInfo.flags & MOVEMENTFLAG_MOVING)
@@ -6743,7 +6743,7 @@ bool Player::SetPosition(float x, float y, float z, float orientation, bool tele
SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
// code block for underwater state update
- // Unit::SetPosition() checks for validity and updates our coordinates
+ // Unit::UpdatePosition() checks for validity and updates our coordinates
// so we re-fetch them instead of using "raw" coordinates from function params
UpdateUnderwaterState(GetMap(), GetPositionX(), GetPositionY(), GetPositionZ());
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 862b271c464..05ef060add9 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1937,8 +1937,8 @@ class Player : public Unit, public GridObject<Player>
void SendResetInstanceFailed(uint32 reason, uint32 MapId);
void SendResetFailedNotify(uint32 mapid);
- virtual bool SetPosition(float x, float y, float z, float orientation, bool teleport = false);
- bool SetPosition(const Position &pos, bool teleport = false) { return SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }
+ virtual bool UpdatePosition(float x, float y, float z, float orientation, bool teleport = false);
+ bool UpdatePosition(const Position &pos, bool teleport = false) { return UpdatePosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }
void UpdateUnderwaterState(Map* m, float x, float y, float z);
void SendMessageToSet(WorldPacket* data, bool self) {SendMessageToSetInRange(data, GetVisibilityRange(), self); };// overwrite Object::SendMessageToSet
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index dbe9697bcaf..28d916fe0af 100755
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -673,7 +673,7 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,
return 0;
}
- map->Add(creature);
+ map->AddToMap(creature);
m_NPCPassengerSet.insert(creature);
if (tguid == 0)
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 6d02d943f63..6e70469df73 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -12384,6 +12384,15 @@ int32 Unit::ModifyPower(Powers power, int32 dVal)
return gain;
}
+// returns negative amount on power reduction
+int32 Unit::ModifyPowerPct(Powers power, float pct, bool apply)
+{
+ float amount = (float)GetMaxPower(power);
+ ApplyPercentModFloatVar(amount, pct, apply);
+
+ return ModifyPower(power, (int32)amount - (int32)GetMaxPower(power));
+}
+
bool Unit::isAlwaysVisibleFor(WorldObject const* seer) const
{
if (WorldObject::isAlwaysVisibleFor(seer))
@@ -13710,7 +13719,7 @@ void Unit::RemoveFromWorld()
}
}
-void Unit::CleanupsBeforeDelete(bool finalCleanup)
+void Unit::CleanupBeforeRemoveFromMap(bool finalCleanup)
{
// This needs to be before RemoveFromWorld to make GetCaster() return a valid pointer on aura removal
InterruptNonMeleeSpells(true);
@@ -13734,6 +13743,11 @@ void Unit::CleanupsBeforeDelete(bool finalCleanup)
DeleteThreatList();
getHostileRefManager().setOnlineOfflineState(false);
GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
+}
+
+void Unit::CleanupsBeforeDelete(bool finalCleanup)
+{
+ CleanupBeforeRemoveFromMap(finalCleanup);
if (Creature* thisCreature = ToCreature())
if (GetTransport())
@@ -17151,16 +17165,16 @@ void Unit::NearTeleportTo(float x, float y, float z, float orientation, bool cas
{
// FIXME: this interrupts spell visual
DestroyForNearbyPlayers();
- SetPosition(x, y, z, orientation, true);
+ UpdatePosition(x, y, z, orientation, true);
}
}
-bool Unit::SetPosition(float x, float y, float z, float orientation, bool teleport)
+bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool teleport)
{
// prevent crash when a bad coord is sent by the client
if (!Trinity::IsValidMapCoord(x, y, z, orientation))
{
- sLog->outDebug(LOG_FILTER_UNITS, "Unit::SetPosition(%f, %f, %f) .. bad coordinates!", x, y, z);
+ sLog->outDebug(LOG_FILTER_UNITS, "Unit::UpdatePosition(%f, %f, %f) .. bad coordinates!", x, y, z);
return false;
}
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 8f052ab41ae..7629050ea8a 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1247,6 +1247,7 @@ class Unit : public WorldObject
void AddToWorld();
void RemoveFromWorld();
+ void CleanupBeforeRemoveFromMap(bool finalCleanup);
void CleanupsBeforeDelete(bool finalCleanup = true); // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units)
DiminishingLevels GetDiminishing(DiminishingGroup group);
@@ -1370,6 +1371,7 @@ class Unit : public WorldObject
void SetMaxPower(Powers power, uint32 val);
// returns the change in power
int32 ModifyPower(Powers power, int32 val);
+ int32 ModifyPowerPct(Powers power, float pct, bool apply = true);
uint32 GetAttackTime(WeaponAttackType att) const
{
@@ -1600,9 +1602,9 @@ class Unit : public WorldObject
void SendSpellDamageImmune(Unit* target, uint32 spellId);
void NearTeleportTo(float x, float y, float z, float orientation, bool casting = false);
- virtual bool SetPosition(float x, float y, float z, float ang, bool teleport = false);
+ virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport = false);
// returns true if unit's position really changed
- bool SetPosition(const Position &pos, bool teleport = false) { return SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }
+ bool UpdatePosition(const Position &pos, bool teleport = false) { return UpdatePosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }
void KnockbackFrom(float x, float y, float speedXY, float speedZ);
void JumpTo(float speedXY, float speedZ, bool forward = true);
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index effd43cd320..107e275d47b 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -445,7 +445,7 @@ void Vehicle::RelocatePassengers(float x, float y, float z, float ang)
float pz = z + passenger->m_movementInfo.t_pos.m_positionZ;
float po = ang + passenger->m_movementInfo.t_pos.m_orientation;
- passenger->SetPosition(px, py, pz, po);
+ passenger->UpdatePosition(px, py, pz, po);
}
}
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index e81cd053003..cb42b898406 100755
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -1179,7 +1179,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
if (!creature->LoadFromDB(*itr, map))
delete creature;
else
- map->Add(creature);
+ map->AddToMap(creature);
}
}
}
@@ -1210,7 +1210,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
else
{
if (pGameobject->isSpawnedByDefault())
- map->Add(pGameobject);
+ map->AddToMap(pGameobject);
}
}
}
diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp
index c351efb334f..f98702d4393 100755
--- a/src/server/game/Globals/ObjectAccessor.cpp
+++ b/src/server/game/Globals/ObjectAccessor.cpp
@@ -199,10 +199,10 @@ void ObjectAccessor::RemoveCorpse(Corpse* corpse)
{
ASSERT(corpse && corpse->GetType() != CORPSE_BONES);
- if (corpse->FindMap())
+ if (Map* map = corpse->FindMap())
{
corpse->DestroyForNearbyPlayers();
- corpse->FindMap()->Remove(corpse, false);
+ map->RemoveFromMap(corpse, false);
}
else
corpse->RemoveFromWorld();
@@ -317,7 +317,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia
}
// add bones in grid store if grid loaded where corpse placed
- map->Add(bones);
+ map->AddToMap(bones);
}
// all references to the corpse should be removed at this point
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 3c3fc36da05..ae7e2d57991 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -1636,7 +1636,7 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float
delete go;
return 0;
}
- map->Add(go);
+ map->AddToMap(go);
}
sLog->outDebug(LOG_FILTER_MAPS, "AddGOData: dbguid %u entry %u map %u x %f y %f z %f o %f", guid, entry, mapId, x, y, z, o);
@@ -1672,7 +1672,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos)
delete creature;
return false;
}
- map->Add(creature);
+ map->AddToMap(creature);
}
}
return true;
@@ -1725,7 +1725,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float
delete creature;
return 0;
}
- map->Add(creature);
+ map->AddToMap(creature);
}
}
diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp
index 58521b76bff..ee488f404dc 100755
--- a/src/server/game/Grids/ObjectGridLoader.cpp
+++ b/src/server/game/Grids/ObjectGridLoader.cpp
@@ -57,20 +57,8 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m)
Creature* c = iter->getSource();
++iter;
- ASSERT(!c->isPet() && "ObjectGridRespawnMover don't must be called for pets");
-
- Cell const& cur_cell = c->GetCurrentCell();
-
- float resp_x, resp_y, resp_z;
- c->GetRespawnCoord(resp_x, resp_y, resp_z);
- CellPair resp_val = Trinity::ComputeCellPair(resp_x, resp_y);
- Cell resp_cell(resp_val);
-
- if (cur_cell.DiffGrid(resp_cell))
- {
- c->GetMap()->CreatureRespawnRelocation(c);
- // false result ignored: will be unload with other creatures at grid
- }
+ ASSERT(!c->isPet() && "ObjectGridRespawnMover must not be called for pets");
+ c->GetMap()->CreatureRespawnRelocation(c, true);
}
}
@@ -94,11 +82,11 @@ class ObjectWorldLoader
uint32 i_corpses;
};
-template<class T> void AddUnitState(T* /*obj*/, CellPair const& /*cell_pair*/)
+template<class T> void ObjectGridLoader::SetObjectCell(T* /*obj*/, CellPair const& /*cell_pair*/)
{
}
-template<> void AddUnitState(Creature* obj, CellPair const& cell_pair)
+template<> void ObjectGridLoader::SetObjectCell(Creature* obj, CellPair const& cell_pair)
{
Cell cell(cell_pair);
@@ -109,7 +97,7 @@ template <class T>
void AddObjectHelper(CellPair &cell, GridRefManager<T> &m, uint32 &count, Map* map, T *obj)
{
obj->GetGridRef().link(&m, obj);
- AddUnitState(obj, cell);
+ ObjectGridLoader::SetObjectCell(obj, cell);
obj->AddToWorld();
if (obj->isActiveObject())
map->AddToActive(obj);
diff --git a/src/server/game/Grids/ObjectGridLoader.h b/src/server/game/Grids/ObjectGridLoader.h
index 901080293a4..5fc5dc47e71 100755
--- a/src/server/game/Grids/ObjectGridLoader.h
+++ b/src/server/game/Grids/ObjectGridLoader.h
@@ -40,11 +40,12 @@ class ObjectGridLoader
void Visit(GameObjectMapType &m);
void Visit(CreatureMapType &m);
void Visit(CorpseMapType &) const {}
-
void Visit(DynamicObjectMapType&) const {}
void LoadN(void);
+ template<class T> static void SetObjectCell(T* obj, CellPair const& cellPair);
+
private:
Cell i_cell;
NGridType &i_grid;
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index 44d7f62305f..0442172b0fd 100755
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -1261,11 +1261,12 @@ void Group::UpdatePlayerOutOfRange(Player* player)
WorldPacket data;
player->GetSession()->BuildPartyMemberStatsChangedPacket(player, &data);
+ Player* member;
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
- player = itr->getSource();
- if (player && !player->IsWithinDist(player, player->GetSightRange(), false))
- player->GetSession()->SendPacket(&data);
+ member = itr->getSource();
+ if (member && !member->IsWithinDist(player, member->GetSightRange(), false))
+ member->GetSession()->SendPacket(&data);
}
}
@@ -1273,12 +1274,12 @@ 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))
+ Player* plr = itr->getSource();
+ if (!plr || (ignore != 0 && plr->GetGUID() == ignore) || (ignorePlayersInBGRaid && plr->GetGroup() != this))
continue;
- if (pl->GetSession() && (group == -1 || itr->getSubGroup() == group))
- pl->GetSession()->SendPacket(packet);
+ if (plr->GetSession() && (group == -1 || itr->getSubGroup() == group))
+ plr->GetSession()->SendPacket(packet);
}
}
@@ -1286,10 +1287,10 @@ 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()))
- pl->GetSession()->SendPacket(packet);
+ Player* plr = itr->getSource();
+ if (plr && plr->GetSession())
+ if (IsLeader(plr->GetGUID()) || IsAssistant(plr->GetGUID()))
+ plr->GetSession()->SendPacket(packet);
}
}
@@ -1297,8 +1298,8 @@ void Group::OfflineReadyCheck()
{
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
{
- Player* pl = ObjectAccessor::FindPlayer(citr->guid);
- if (!pl || !pl->GetSession())
+ Player* plr = ObjectAccessor::FindPlayer(citr->guid);
+ if (!plr || !plr->GetSession())
{
WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
data << uint64(citr->guid);
@@ -1328,6 +1329,7 @@ bool Group::SameSubGroup(Player const* member1, Player const* member2) const
{
if (!member1 || !member2)
return false;
+
if (member1->GetGroup() != this || member2->GetGroup() != this)
return false;
else
@@ -1364,10 +1366,8 @@ void Group::ChangeMembersGroup(uint64 guid, uint8 group)
if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid));
- Player* player = ObjectAccessor::FindPlayer(guid);
-
// In case the moved player is online, update the player object with the new sub group references
- if (player)
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
{
if (player->GetGroup() == this)
player->GetGroupRef().setSubGroup(group);
diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h
index ed1fc80fd20..c51aa6dd7bf 100755
--- a/src/server/game/Groups/Group.h
+++ b/src/server/game/Groups/Group.h
@@ -57,14 +57,14 @@ enum RollVote
enum GroupMemberOnlineStatus
{
MEMBER_STATUS_OFFLINE = 0x0000,
- MEMBER_STATUS_ONLINE = 0x0001,
- MEMBER_STATUS_PVP = 0x0002,
- MEMBER_STATUS_UNK0 = 0x0004, // dead? (health=0)
- MEMBER_STATUS_UNK1 = 0x0008, // ghost? (health=1)
- MEMBER_STATUS_UNK2 = 0x0010, // never seen
- MEMBER_STATUS_UNK3 = 0x0020, // never seen
- MEMBER_STATUS_UNK4 = 0x0040, // appears with dead and ghost flags
- MEMBER_STATUS_UNK5 = 0x0080, // never seen
+ MEMBER_STATUS_ONLINE = 0x0001, // Lua_UnitIsConnected
+ MEMBER_STATUS_PVP = 0x0002, // Lua_UnitIsPVP
+ MEMBER_STATUS_DEAD = 0x0004, // Lua_UnitIsDead
+ MEMBER_STATUS_GHOST = 0x0008, // Lua_UnitIsGhost
+ MEMBER_STATUS_PVP_FFA = 0x0010, // Lua_UnitIsPVPFreeForAll
+ MEMBER_STATUS_UNK3 = 0x0020, // used in calls from Lua_GetPlayerMapPosition/Lua_GetBattlefieldFlagPosition
+ MEMBER_STATUS_AFK = 0x0040, // Lua_UnitIsAFK
+ MEMBER_STATUS_DND = 0x0080, // Lua_UnitIsDND
};
enum GroupMemberFlags
diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h
index 63d54e4ec94..dec50e40127 100755
--- a/src/server/game/Instances/InstanceSaveMgr.h
+++ b/src/server/game/Instances/InstanceSaveMgr.h
@@ -80,8 +80,8 @@ class InstanceSave
/* online players bound to the instance (perm/solo)
does not include the members of the group unless they have permanent saves */
- void AddPlayer(Player* player) { m_playerList.push_back(player); }
- bool RemovePlayer(Player* player) { m_playerList.remove(player); return UnloadIfEmpty(); }
+ void AddPlayer(Player* player) { ACE_GUARD(ACE_Thread_Mutex, guard, _lock); m_playerList.push_back(player); }
+ bool RemovePlayer(Player* player) { ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, _lock, false); m_playerList.remove(player); return UnloadIfEmpty(); }
/* all groups bound to the instance */
void AddGroup(Group* group) { m_groupList.push_back(group); }
bool RemoveGroup(Group* group) { m_groupList.remove(group); return UnloadIfEmpty(); }
@@ -110,6 +110,8 @@ class InstanceSave
uint32 m_mapid;
Difficulty m_difficulty;
bool m_canReset;
+
+ ACE_Thread_Mutex _lock;
};
typedef UNORDERED_MAP<uint32 /*PAIR32(map, difficulty)*/, time_t /*resetTime*/> ResetTimeByMapDifficultyMap;
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 26e058a32f3..89049f39127 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -205,7 +205,8 @@ Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _par
i_mapEntry (sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_InstanceId(InstanceId),
m_unloadTimer(0), m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE),
m_VisibilityNotifyPeriod(DEFAULT_VISIBILITY_NOTIFY_PERIOD),
-m_activeNonPlayersIter(m_activeNonPlayers.end()), i_gridExpiry(expiry), i_scriptLock(false)
+m_activeNonPlayersIter(m_activeNonPlayers.end()), i_gridExpiry(expiry),
+i_scriptLock(false), _creatureToMoveLock(false)
{
m_parentMap = (_parent ? _parent : this);
for (unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx)
@@ -403,7 +404,7 @@ void Map::LoadGrid(float x, float y)
EnsureGridLoaded(cell);
}
-bool Map::Add(Player* player)
+bool Map::AddToMap(Player* player)
{
// Check if we are adding to correct map
ASSERT (player->GetMap() == this);
@@ -435,8 +436,19 @@ bool Map::Add(Player* player)
}
template<class T>
+void Map::InitializeObject(T* obj)
+{
+}
+
+template<>
+void Map::InitializeObject(Creature* obj)
+{
+ obj->_moveState = CREATURE_CELL_MOVE_NONE;
+}
+
+template<class T>
void
-Map::Add(T *obj)
+Map::AddToMap(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)
@@ -463,6 +475,7 @@ Map::Add(T *obj)
AddToGrid(obj, grid, cell);
//obj->SetMap(this);
obj->AddToWorld();
+ InitializeObject(obj);
if (obj->isActiveObject())
AddToActive(obj);
@@ -669,7 +682,7 @@ void Map::ProcessRelocationNotifies(const uint32 diff)
}
}
-void Map::Remove(Player* player, bool remove)
+void Map::RemoveFromMap(Player* player, bool remove)
{
player->RemoveFromWorld();
SendRemoveTransports(player);
@@ -701,7 +714,7 @@ void Map::Remove(Player* player, bool remove)
template<class T>
void
-Map::Remove(T *obj, bool remove)
+Map::RemoveFromMap(T *obj, bool remove)
{
obj->RemoveFromWorld();
if (obj->isActiveObject())
@@ -791,6 +804,7 @@ Map::CreatureRelocation(Creature* creature, float x, float y, float z, float ang
{
creature->Relocate(x, y, z, ang);
creature->UpdateObjectVisibility(false);
+ RemoveCreatureFromMoveList(creature);
}
ASSERT(CheckGridIntegrity(creature, true));
@@ -798,26 +812,47 @@ Map::CreatureRelocation(Creature* creature, float x, float y, float z, float ang
void Map::AddCreatureToMoveList(Creature* c, float x, float y, float z, float ang)
{
- if (!c)
+ if (_creatureToMoveLock) //can this happen?
+ return;
+
+ if(c->_moveState == CREATURE_CELL_MOVE_NONE)
+ _creaturesToMove.push_back(c);
+ c->SetNewCellPosition(x, y, z, ang);
+}
+
+void Map::RemoveCreatureFromMoveList(Creature* c)
+{
+ if (_creatureToMoveLock) //can this happen?
return;
- i_creaturesToMove[c] = CreatureMover(x, y, z, ang);
+ if(c->_moveState == CREATURE_CELL_MOVE_ACTIVE)
+ c->_moveState = CREATURE_CELL_MOVE_INACTIVE;
}
void Map::MoveAllCreaturesInMoveList()
{
- while (!i_creaturesToMove.empty())
+ _creatureToMoveLock = true;
+ for(std::vector<Creature*>::iterator itr = _creaturesToMove.begin(); itr != _creaturesToMove.end(); ++itr)
{
- // get data and remove element;
- CreatureMoveList::iterator iter = i_creaturesToMove.begin();
- Creature* c = iter->first;
- const CreatureMover &cm = iter->second;
+ Creature* c = *itr;
+ if(c->FindMap() != this) //pet is teleported to another map
+ continue;
+
+ if(c->_moveState != CREATURE_CELL_MOVE_ACTIVE)
+ {
+ c->_moveState = CREATURE_CELL_MOVE_NONE;
+ continue;
+ }
+
+ c->_moveState = CREATURE_CELL_MOVE_NONE;
+ if(!c->IsInWorld())
+ continue;
// do move or do move to respawn or remove creature if previous all fail
- if (CreatureCellRelocation(c, Cell(Trinity::ComputeCellPair(cm.x, cm.y))))
+ if (CreatureCellRelocation(c, Cell(Trinity::ComputeCellPair(c->_newPosition.m_positionX, c->_newPosition.m_positionY))))
{
// update pos
- c->Relocate(cm.x, cm.y, cm.z, cm.ang);
+ c->Relocate(c->_newPosition);
//CreatureRelocationNotify(c, new_cell, new_cell.cellPair());
c->UpdateObjectVisibility(false);
}
@@ -825,7 +860,7 @@ void Map::MoveAllCreaturesInMoveList()
{
// if creature can't be move in new cell/grid (not loaded) move it to repawn cell/grid
// creature coordinates will be updated and notifiers send
- if (!CreatureRespawnRelocation(c))
+ if (!CreatureRespawnRelocation(c, false))
{
// ... or unload (if respawn grid also not loaded)
#ifdef TRINITY_DEBUG
@@ -843,9 +878,9 @@ void Map::MoveAllCreaturesInMoveList()
AddObjectToRemoveList(c);
}
}
-
- i_creaturesToMove.erase(iter);
}
+ _creaturesToMove.clear();
+ _creatureToMoveLock = false;
}
bool Map::CreatureCellRelocation(Creature* c, Cell new_cell)
@@ -909,14 +944,17 @@ bool Map::CreatureCellRelocation(Creature* c, Cell new_cell)
return false;
}
-bool Map::CreatureRespawnRelocation(Creature* c)
+bool Map::CreatureRespawnRelocation(Creature* c, bool diffGridOnly)
{
float resp_x, resp_y, resp_z, resp_o;
c->GetRespawnCoord(resp_x, resp_y, resp_z, &resp_o);
-
CellPair resp_val = Trinity::ComputeCellPair(resp_x, resp_y);
Cell resp_cell(resp_val);
+ //creature will be unloaded with grid
+ if(diffGridOnly && !c->GetCurrentCell().DiffGrid(resp_cell))
+ return true;
+
c->CombatStop();
c->GetMotionMaster()->Clear();
@@ -1020,7 +1058,7 @@ void Map::RemoveAllPlayers()
void Map::UnloadAll()
{
// clear all delayed moves, useless anyway do this moves before map unload.
- i_creaturesToMove.clear();
+ _creaturesToMove.clear();
for (GridRefManager<NGridType>::iterator i = GridRefManager<NGridType>::begin(); i != GridRefManager<NGridType>::end();)
{
@@ -2051,20 +2089,20 @@ void Map::RemoveAllObjectsInRemoveList()
if (!corpse)
sLog->outError("Tried to delete corpse/bones %u that is not in map.", obj->GetGUIDLow());
else
- Remove(corpse, true);
+ RemoveFromMap(corpse, true);
break;
}
case TYPEID_DYNAMICOBJECT:
- Remove((DynamicObject*)obj, true);
+ RemoveFromMap((DynamicObject*)obj, true);
break;
case TYPEID_GAMEOBJECT:
- Remove((GameObject*)obj, true);
+ RemoveFromMap((GameObject*)obj, true);
break;
case TYPEID_UNIT:
// in case triggered sequence some spell can continue casting after prev CleanupsBeforeDelete call
// make sure that like sources auras/etc removed before destructor start
obj->ToCreature()->CleanupsBeforeDelete();
- Remove(obj->ToCreature(), true);
+ RemoveFromMap(obj->ToCreature(), true);
break;
default:
sLog->outError("Non-grid object (TypeId: %u) is in grid object remove list, ignored.", obj->GetTypeId());
@@ -2174,15 +2212,15 @@ void Map::RemoveFromActive(Creature* c)
}
}
-template void Map::Add(Corpse*);
-template void Map::Add(Creature*);
-template void Map::Add(GameObject*);
-template void Map::Add(DynamicObject*);
+template void Map::AddToMap(Corpse*);
+template void Map::AddToMap(Creature*);
+template void Map::AddToMap(GameObject*);
+template void Map::AddToMap(DynamicObject*);
-template void Map::Remove(Corpse*, bool);
-template void Map::Remove(Creature*, bool);
-template void Map::Remove(GameObject*, bool);
-template void Map::Remove(DynamicObject*, bool);
+template void Map::RemoveFromMap(Corpse*, bool);
+template void Map::RemoveFromMap(Creature*, bool);
+template void Map::RemoveFromMap(GameObject*, bool);
+template void Map::RemoveFromMap(DynamicObject*, bool);
/* ******* Dungeon Instance Maps ******* */
@@ -2277,7 +2315,7 @@ bool InstanceMap::CanEnter(Player* player)
/*
Do map specific checks and add the player to the map if successful.
*/
-bool InstanceMap::Add(Player* player)
+bool InstanceMap::AddToMap(Player* player)
{
// TODO: Not sure about checking player level: already done in HandleAreaTriggerOpcode
// GMs still can teleport player in instance.
@@ -2387,7 +2425,7 @@ bool InstanceMap::Add(Player* player)
}
// this will acquire the same mutex so it cannot be in the previous block
- Map::Add(player);
+ Map::AddToMap(player);
if (i_data)
i_data->OnPlayerEnter(player);
@@ -2403,13 +2441,13 @@ void InstanceMap::Update(const uint32 t_diff)
i_data->Update(t_diff);
}
-void InstanceMap::Remove(Player* player, bool remove)
+void InstanceMap::RemoveFromMap(Player* player, bool remove)
{
sLog->outDetail("MAP: Removing player '%s' from instance '%u' of map '%s' before relocating to another map", player->GetName(), GetInstanceId(), GetMapName());
//if last player set unload timer
if (!m_unloadTimer && m_mapRefManager.getSize() == 1)
m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld->getIntConfig(CONFIG_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY);
- Map::Remove(player, remove);
+ Map::RemoveFromMap(player, remove);
// for normal instances schedule the reset after all players have left
SetResetSchedule(true);
}
@@ -2623,7 +2661,7 @@ bool BattlegroundMap::CanEnter(Player* player)
return Map::CanEnter(player);
}
-bool BattlegroundMap::Add(Player* player)
+bool BattlegroundMap::AddToMap(Player* player)
{
{
ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, Lock, false);
@@ -2633,13 +2671,13 @@ bool BattlegroundMap::Add(Player* player)
// reset instance validity, battleground maps do not homebind
player->m_InstanceValid = true;
}
- return Map::Add(player);
+ return Map::AddToMap(player);
}
-void BattlegroundMap::Remove(Player* player, bool remove)
+void BattlegroundMap::RemoveFromMap(Player* player, bool remove)
{
sLog->outDetail("MAP: Removing player '%s' from bg '%u' of map '%s' before relocating to another map", player->GetName(), GetInstanceId(), GetMapName());
- Map::Remove(player, remove);
+ Map::RemoveFromMap(player, remove);
}
void BattlegroundMap::SetUnload()
@@ -2678,4 +2716,4 @@ void Map::UpdateIteratorBack(Player* player)
{
if (m_mapRefIter == player->GetMapRef())
m_mapRefIter = m_mapRefIter->nocheck_prev();
-} \ No newline at end of file
+}
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index bbd3b20ecfb..fd58fd0cc72 100755
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -193,14 +193,6 @@ public:
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0);
};
-struct CreatureMover
-{
- CreatureMover() : x(0.0f), y(0.0f), z(0.0f), ang(0.0f) {}
- CreatureMover(float _x, float _y, float _z, float _ang) : x(_x), y(_y), z(_z), ang(_ang) {}
-
- float x, y, z, ang;
-};
-
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push, N), also any gcc version not support it at some platform
#if defined(__GNUC__)
#pragma pack(1)
@@ -226,8 +218,6 @@ enum LevelRequirementVsMode
#pragma pack(pop)
#endif
-typedef UNORDERED_MAP<Creature*, CreatureMover> CreatureMoveList;
-
#define MAX_HEIGHT 100000.0f // can be use for find ground height at surface
#define INVALID_HEIGHT -100000.0f // for check, must be equal to VMAP_INVALID_HEIGHT, real value for unknown height is VMAP_INVALID_HEIGHT_VALUE
#define MAX_FALL_DISTANCE 250000.0f // "unlimited fall" to find VMap ground if it is available, just larger than MAX_HEIGHT - INVALID_HEIGHT
@@ -254,10 +244,10 @@ class Map : public GridRefManager<NGridType>
return false;
}
- virtual bool Add(Player*);
- virtual void Remove(Player*, bool);
- template<class T> void Add(T *);
- template<class T> void Remove(T *, bool);
+ virtual bool AddToMap(Player*);
+ virtual void RemoveFromMap(Player*, bool);
+ template<class T> void AddToMap(T *);
+ template<class T> void RemoveFromMap(T *, bool);
void VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer> &gridVisitor, TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer> &worldVisitor);
virtual void Update(const uint32);
@@ -344,7 +334,8 @@ class Map : public GridRefManager<NGridType>
void RemoveAllObjectsInRemoveList();
virtual void RemoveAllPlayers();
- bool CreatureRespawnRelocation(Creature* c); // used only in MoveAllCreaturesInMoveList and ObjectGridUnloader
+ // used only in MoveAllCreaturesInMoveList and ObjectGridUnloader
+ bool CreatureRespawnRelocation(Creature* c, bool diffGridOnly);
// assert print helper
bool CheckGridIntegrity(Creature* c, bool moved) const;
@@ -449,8 +440,11 @@ class Map : public GridRefManager<NGridType>
bool CreatureCellRelocation(Creature* creature, Cell new_cell);
+ template<class T> void InitializeObject(T* obj);
void AddCreatureToMoveList(Creature* c, float x, float y, float z, float ang);
- CreatureMoveList i_creaturesToMove;
+ void RemoveCreatureFromMoveList(Creature* c);
+ bool _creatureToMoveLock;
+ std::vector<Creature*> _creaturesToMove;
bool loaded(const GridPair &) const;
void EnsureGridCreated(const GridPair &);
@@ -577,8 +571,8 @@ class InstanceMap : public Map
public:
InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map* _parent);
~InstanceMap();
- bool Add(Player*);
- void Remove(Player*, bool);
+ bool AddToMap(Player*);
+ void RemoveFromMap(Player*, bool);
void Update(const uint32);
void CreateInstanceData(bool load);
bool Reset(uint8 method);
@@ -607,8 +601,8 @@ class BattlegroundMap : public Map
BattlegroundMap(uint32 id, time_t, uint32 InstanceId, Map* _parent, uint8 spawnMode);
~BattlegroundMap();
- bool Add(Player*);
- void Remove(Player*, bool);
+ bool AddToMap(Player*);
+ void RemoveFromMap(Player*, bool);
bool CanEnter(Player* player);
void SetUnload();
//void UnloadAll(bool pForce);
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
index 4ad2f0638d0..99deef200a6 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
@@ -266,7 +266,7 @@ void FlightPathMovementGenerator::Finalize(Player & player)
float y = 0;
float z = 0;
i_destinationHolder.GetLocationNow(player.GetBaseMap(), x, y, z);
- player.SetPosition(x, y, z, player.GetOrientation());
+ player.UpdatePosition(x, y, z, player.GetOrientation());
}
diff --git a/src/server/game/Movement/Traveller.h b/src/server/game/Movement/Traveller.h
index 27700eb61c4..9cd6a6cda17 100755
--- a/src/server/game/Movement/Traveller.h
+++ b/src/server/game/Movement/Traveller.h
@@ -85,7 +85,7 @@ inline float Traveller<Creature>::Speed()
template<>
inline void Traveller<Creature>::Relocation(float x, float y, float z, float orientation)
{
- i_traveller.SetPosition(x, y, z, orientation);
+ i_traveller.UpdatePosition(x, y, z, orientation);
}
template<>
@@ -136,7 +136,7 @@ inline float Traveller<Player>::GetMoveDestinationTo(float x, float y, float z)
template<>
inline void Traveller<Player>::Relocation(float x, float y, float z, float orientation)
{
- i_traveller.SetPosition(x, y, z, orientation);
+ i_traveller.UpdatePosition(x, y, z, orientation);
}
template<>
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 03accce42ed..35c19a6a62f 100755
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -371,7 +371,7 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj)
return;
}
else
- map->Add(creature);
+ map->AddToMap(creature);
}
}
}
@@ -399,7 +399,7 @@ void PoolGroup<GameObject>::Spawn1Object(PoolObject* obj)
else
{
if (pGameobject->isSpawnedByDefault())
- map->Add(pGameobject);
+ map->AddToMap(pGameobject);
}
}
}
@@ -507,7 +507,7 @@ void PoolGroup<Creature>::ReSpawn1Object(PoolObject* obj)
{
if (CreatureData const* data = sObjectMgr->GetCreatureData(obj->guid))
if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(obj->guid, data->id, HIGHGUID_UNIT), (Creature*)NULL))
- creature->GetMap()->Add(creature);
+ creature->GetMap()->AddToMap(creature);
}
// Method that does the respawn job on the specified gameobject
@@ -516,7 +516,7 @@ void PoolGroup<GameObject>::ReSpawn1Object(PoolObject* obj)
{
if (GameObjectData const* data = sObjectMgr->GetGOData(obj->guid))
if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(obj->guid, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL))
- pGameobject->GetMap()->Add(pGameobject);
+ pGameobject->GetMap()->AddToMap(pGameobject);
}
// Nothing to do for a child Pool
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index 3ded63fe812..b141f889196 100755
--- a/src/server/game/Scripting/MapScripts.cpp
+++ b/src/server/game/Scripting/MapScripts.cpp
@@ -539,8 +539,8 @@ void Map::ScriptsProcess()
// when script called for item spell casting then target == (unit or GO) and source is player
WorldObject* worldObject;
- Player* pTarget = target->ToPlayer();
- if (pTarget)
+ Player* plrTarget = target->ToPlayer();
+ if (plrTarget)
{
if (source->GetTypeId() != TYPEID_UNIT && source->GetTypeId() != TYPEID_GAMEOBJECT && source->GetTypeId() != TYPEID_PLAYER)
{
@@ -552,8 +552,8 @@ void Map::ScriptsProcess()
}
else
{
- pTarget = source->ToPlayer();
- if (target)
+ plrTarget = source->ToPlayer();
+ if (plrTarget)
{
if (target->GetTypeId() != TYPEID_UNIT && target->GetTypeId() != TYPEID_GAMEOBJECT && target->GetTypeId() != TYPEID_PLAYER)
{
@@ -566,19 +566,18 @@ void Map::ScriptsProcess()
else
{
sLog->outError("%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
- step.script->GetDebugInfo().c_str(),
- source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0,
- target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0);
+ step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow(),
+ target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
break;
}
}
// quest id and flags checked at script loading
if ((worldObject->GetTypeId() != TYPEID_UNIT || ((Unit*)worldObject)->isAlive()) &&
- (step.script->QuestExplored.Distance == 0 || worldObject->IsWithinDistInMap(pTarget, float(step.script->QuestExplored.Distance))))
- pTarget->AreaExploredOrEventHappens(step.script->QuestExplored.QuestID);
+ (step.script->QuestExplored.Distance == 0 || worldObject->IsWithinDistInMap(plrTarget, float(step.script->QuestExplored.Distance))))
+ plrTarget->AreaExploredOrEventHappens(step.script->QuestExplored.QuestID);
else
- pTarget->FailQuest(step.script->QuestExplored.QuestID);
+ plrTarget->FailQuest(step.script->QuestExplored.QuestID);
break;
}
@@ -628,7 +627,7 @@ void Map::ScriptsProcess()
pGO->SetLootState(GO_READY);
pGO->SetRespawnTime(nTimeToDespawn);
- pGO->GetMap()->Add(pGO);
+ pGO->GetMap()->AddToMap(pGO);
}
}
break;
diff --git a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp
index d4ca425d606..a468d05bcdf 100755
--- a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp
@@ -742,7 +742,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
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));
sScriptMgr->OnPlayerDelete(guid);
- sWorld->DeleteCharaceterNameData(guid);
+ sWorld->DeleteCharaceterNameData(GUID_LOPART(guid));
if (sLog->IsOutCharDump()) // optimize GetPlayerDump call
{
@@ -920,7 +920,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
}
}
- if (!pCurrChar->GetMap()->Add(pCurrChar) || !pCurrChar->CheckInstanceLoginValid())
+ if (!pCurrChar->GetMap()->AddToMap(pCurrChar) || !pCurrChar->CheckInstanceLoginValid())
{
AreaTrigger const* at = sObjectMgr->GetGoBackTrigger(pCurrChar->GetMapId());
if (at)
diff --git a/src/server/game/Server/Protocol/Handlers/GroupHandler.cpp b/src/server/game/Server/Protocol/Handlers/GroupHandler.cpp
index 57a54bd440f..404a949371a 100755
--- a/src/server/game/Server/Protocol/Handlers/GroupHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/GroupHandler.cpp
@@ -850,10 +850,8 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_VEHICLE_SEAT)
{
- if (player->GetVehicle()){
- Vehicle* vv=player->GetVehicle();
- *data << (uint32) vv->GetVehicleInfo()->m_seatID[player->m_movementInfo.t_seat];
- }
+ if (Vehicle* veh = player->GetVehicle())
+ *data << (uint32) veh->GetVehicleInfo()->m_seatID[player->m_movementInfo.t_seat];
}
if (mask & GROUP_UPDATE_FLAG_PET_AURAS)
diff --git a/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp b/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp
index bf971cae32f..d343e1b2dae 100755
--- a/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp
@@ -68,7 +68,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
if (GetPlayer()->IsInWorld())
{
sLog->outCrash("Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName(), oldMap->GetId(), loc.GetMapId());
- oldMap->Remove(GetPlayer(), false);
+ oldMap->RemoveFromMap(GetPlayer(), false);
}
// relocate the player to the teleport destination
@@ -88,7 +88,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->SetMap(newMap);
GetPlayer()->SendInitialPacketsBeforeAddToMap();
- if (!GetPlayer()->GetMap()->Add(GetPlayer()))
+ if (!GetPlayer()->GetMap()->AddToMap(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();
@@ -215,7 +215,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
WorldLocation const& dest = plMover->GetTeleportDest();
- plMover->SetPosition(dest, true);
+ plMover->UpdatePosition(dest, true);
uint32 newzone, newarea;
plMover->GetZoneAndAreaId(newzone, newarea);
@@ -355,7 +355,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
return;
}
- mover->SetPosition(movementInfo.pos);
+ mover->UpdatePosition(movementInfo.pos);
if (plMover) // nothing is charmed, or player charmed
{
diff --git a/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp b/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp
index bdb4b93a238..9277464ca21 100755
--- a/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp
@@ -31,27 +31,44 @@
#include "Pet.h"
#include "MapManager.h"
-void WorldSession::SendNameQueryOpcode(Player* p)
+void WorldSession::SendNameQueryOpcode(uint64 guid)
{
- if (!p)
- return;
+ Player* player = NULL;
+ const CharacterNameData* nameData = sWorld->GetCharacterNameData(GUID_LOPART(guid));
+ if (nameData)
+ player = ObjectAccessor::FindPlayer(guid);
+
// guess size
WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10));
- data.append(p->GetPackGUID()); // player guid
+ data.appendPackGUID(guid);
data << uint8(0); // added in 3.1
- data << p->GetName(); // played name
- data << uint8(0); // realm name for cross realm BG usage
- data << uint8(p->getRace());
- data << uint8(p->getGender());
- data << uint8(p->getClass());
- if (DeclinedName const* names = p->GetDeclinedNames())
+ if (nameData)
{
- data << uint8(1); // is declined
- for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
- data << names->name[i];
+ data << nameData->m_name; // played name
+ data << uint8(0); // realm name for cross realm BG usage
+ data << uint8(nameData->m_race);
+ data << uint8(nameData->m_gender);
+ data << uint8(nameData->m_class);
}
else
- data << uint8(0); // is not declined
+ {
+ data << std::string(GetTrinityString(LANG_NON_EXIST_CHARACTER));
+ data << uint32(0);
+ }
+
+ if (player)
+ {
+ if (DeclinedName const* names = player->GetDeclinedNames())
+ {
+ data << uint8(1); // is declined
+ for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
+ data << names->name[i];
+ }
+ else
+ data << uint8(0); // is not declined
+ }
+ else //TODO: decline names may also need to be stored in char name data
+ data << uint8(0);
SendPacket(&data);
}
@@ -65,32 +82,7 @@ void WorldSession::HandleNameQueryOpcode(WorldPacket& recv_data)
// This is disable by default to prevent lots of console spam
// sLog->outString("HandleNameQueryOpcode %u", guid);
- if (Player* pChar = ObjectAccessor::FindPlayer(guid))
- SendNameQueryOpcode(pChar);
- else
- {
- if (const CharacterNameData* cname = sWorld->GetCharacterNameData(GUID_LOPART(guid)))
- {
- WorldPacket data(SMSG_NAME_QUERY_RESPONSE, 8+1+1+1+1+1+1+10);
- data.appendPackGUID(guid);
- data << uint8(0);
- if (cname->m_name == "")
- {
- data << std::string(GetTrinityString(LANG_NON_EXIST_CHARACTER));
- data << uint32(0);
- }
- else
- {
- data << cname->m_name;
- data << uint8(0);
- data << uint8(cname->m_race);
- data << uint8(cname->m_gender);
- data << uint8(cname->m_class);
- }
- data << uint8(0);
- SendPacket(&data);
- }
- }
+ SendNameQueryOpcode(guid);
}
void WorldSession::HandleQueryTimeOpcode(WorldPacket & /*recv_data*/)
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index cc57b72d9b4..9cb2b1cbe3f 100755
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -494,7 +494,7 @@ void WorldSession::LogoutPlayer(bool Save)
_player->CleanupsBeforeDelete();
sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow());
Map* _map = _player->GetMap();
- _map->Remove(_player, true);
+ _map->RemoveFromMap(_player, true);
SetPlayer(NULL); // deleted in Remove call
///- Send the 'logout complete' packet to the client
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 8b8b3b96b85..2337f2a34b2 100755
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -278,7 +278,7 @@ class WorldSession
void SendAuthWaitQue(uint32 position);
//void SendTestCreatureQueryOpcode(uint32 entry, uint64 guid, uint32 testvalue);
- void SendNameQueryOpcode(Player* p);
+ void SendNameQueryOpcode(uint64 guid);
void SendTrainerList(uint64 guid);
void SendTrainerList(uint64 guid, const std::string& strTitle);
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index e8d763bb5b6..7cda6095688 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -3983,8 +3983,18 @@ void AuraEffect::HandleAuraModIncreaseEnergyPercent(AuraApplication const* aurAp
// return;
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
+ float amount = float(GetAmount());
- target->HandleStatModifier(unitMod, TOTAL_PCT, float(GetAmount()), apply);
+ if (apply)
+ {
+ target->HandleStatModifier(unitMod, TOTAL_PCT, amount, apply);
+ target->ModifyPowerPct(powerType, amount, apply);
+ }
+ else
+ {
+ target->ModifyPowerPct(powerType, amount, apply);
+ target->HandleStatModifier(unitMod, TOTAL_PCT, amount, apply);
+ }
}
void AuraEffect::HandleAuraModIncreaseHealthPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index fd782519410..16243396ebb 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1433,7 +1433,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, const uint32 effectMask, bool
if (m_spellInfo->Speed > 0.0f && unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID())
return SPELL_MISS_EVADE;
- if (m_caster->IsValidAttackTarget(unit))
+ if (m_caster->_IsValidAttackTarget(unit, m_spellInfo))
{
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
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 926a2280d18..19f84854ae4 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -2575,7 +2575,7 @@ void Spell::EffectPersistentAA(SpellEffIndex effIndex)
return;
}
- dynObj->GetMap()->Add(dynObj);
+ dynObj->GetMap()->AddToMap(dynObj);
if (Aura* aura = Aura::TryCreate(m_spellInfo, MAX_EFFECT_MASK, dynObj, caster, &m_spellValue->EffectBasePoints[0]))
{
@@ -3368,7 +3368,7 @@ void Spell::EffectDistract(SpellEffIndex /*effIndex*/)
if (unitTarget->GetTypeId() == TYPEID_PLAYER)
{
// For players just turn them
- unitTarget->ToPlayer()->SetPosition(unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), angle, false);
+ unitTarget->ToPlayer()->UpdatePosition(unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), angle, false);
unitTarget->ToPlayer()->SendTeleportAckPacket();
}
else
@@ -3422,7 +3422,7 @@ void Spell::EffectAddFarsight(SpellEffIndex effIndex)
dynObj->SetDuration(duration);
dynObj->setActive(true); //must before add to map to be put in world container
- dynObj->GetMap()->Add(dynObj); //grid will also be loaded
+ dynObj->GetMap()->AddToMap(dynObj); //grid will also be loaded
dynObj->SetCasterViewpoint();
}
@@ -3812,7 +3812,7 @@ void Spell::EffectTameCreature(SpellEffIndex /*effIndex*/)
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
// add to world
- pet->GetMap()->Add(pet->ToCreature());
+ pet->GetMap()->AddToMap(pet->ToCreature());
// visual effect for levelup
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level);
@@ -4378,7 +4378,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
ExecuteLogEffectSummonObject(effIndex, pGameObj);
// Wild object not have owner and check clickable by players
- map->Add(pGameObj);
+ map->AddToMap(pGameObj);
if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER)
{
@@ -4423,7 +4423,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
ExecuteLogEffectSummonObject(effIndex, linkedGO);
// Wild object not have owner and check clickable by players
- map->Add(linkedGO);
+ map->AddToMap(linkedGO);
}
else
{
@@ -5583,7 +5583,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
ExecuteLogEffectSummonObject(effIndex, pGameObj);
m_caster->AddGameObject(pGameObj);
- map->Add(pGameObj);
+ map->AddToMap(pGameObj);
//END
// Send request
@@ -5934,7 +5934,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
ExecuteLogEffectSummonObject(effIndex, pGameObj);
- map->Add(pGameObj);
+ map->AddToMap(pGameObj);
m_caster->m_ObjectSlot[slot] = pGameObj->GetGUID();
}
@@ -6630,7 +6630,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
//m_caster->AddGameObject(pGameObj);
//m_ObjToDel.push_back(pGameObj);
- cMap->Add(pGameObj);
+ cMap->AddToMap(pGameObj);
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
{
@@ -6645,7 +6645,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
ExecuteLogEffectSummonObject(effIndex, linkedGO);
- linkedGO->GetMap()->Add(linkedGO);
+ linkedGO->GetMap()->AddToMap(linkedGO);
}
else
{
@@ -6968,7 +6968,7 @@ void Spell::EffectCreateTamedPet(SpellEffIndex effIndex)
return;
// add to world
- pet->GetMap()->Add(pet->ToCreature());
+ pet->GetMap()->AddToMap(pet->ToCreature());
// unitTarget has pet now
unitTarget->SetMinion(pet, true);
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index b993f6152fc..4fc9564baa3 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -3101,7 +3101,7 @@ void SpellMgr::LoadDbcDataCorrections()
// with this spell atrribute aura can be stacked several times
spellInfo->Attributes &= ~SPELL_ATTR0_NOT_SHAPESHIFT;
break;
- case 64904: //Hymn of Hope
+ case 64904: // Hymn of Hope
spellInfo->EffectApplyAuraName[EFFECT_1] = SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT;
break;
case 30421: // Nether Portal - Perseverence
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index 1b3454e5ae6..80dd2dc366a 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -60,7 +60,7 @@ public:
return commandTable;
}
- static bool HandleAccountAddonCommand(ChatHandler* handler, const char* args)
+ static bool HandleAccountAddonCommand(ChatHandler* handler, char const* args)
{
if (!*args)
{
@@ -69,11 +69,11 @@ public:
return false;
}
- char *szExp = strtok((char*)args, " ");
+ char* exp = strtok((char*)args, " ");
- uint32 account_id = handler->GetSession()->GetAccountId();
+ uint32 accountId = handler->GetSession()->GetAccountId();
- int expansion = atoi(szExp); //get int anyway (0 if error)
+ int expansion = atoi(exp); //get int anyway (0 if error)
if (expansion < 0 || uint8(expansion) > sWorld->getIntConfig(CONFIG_EXPANSION))
{
handler->SendSysMessage(LANG_IMPROPER_VALUE);
@@ -82,78 +82,74 @@ public:
}
// No SQL injection
- LoginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'", expansion, account_id);
+ LoginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'", expansion, accountId);
handler->PSendSysMessage(LANG_ACCOUNT_ADDON, expansion);
return true;
}
/// Create an account
- static bool HandleAccountCreateCommand(ChatHandler* handler, const char* args)
+ static bool HandleAccountCreateCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
///- %Parse the command line arguments
- char *szAcc = strtok((char*)args, " ");
- char *szPassword = strtok(NULL, " ");
- if (!szAcc || !szPassword)
+ char* accountName = strtok((char*)args, " ");
+ char* password = strtok(NULL, " ");
+ if (!accountName || !password)
return false;
- // normalized in AccountMgr::CreateAccount
- std::string account_name = szAcc;
- std::string password = szPassword;
-
- AccountOpResult result = AccountMgr::CreateAccount(account_name, password);
+ AccountOpResult result = AccountMgr::CreateAccount(std::string(accountName), std::string(password));
switch (result)
{
- case AOR_OK:
- handler->PSendSysMessage(LANG_ACCOUNT_CREATED, account_name.c_str());
- break;
- case AOR_NAME_TOO_LONG:
- handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG);
- handler->SetSentErrorMessage(true);
- return false;
- case AOR_NAME_ALREDY_EXIST:
- handler->SendSysMessage(LANG_ACCOUNT_ALREADY_EXIST);
- handler->SetSentErrorMessage(true);
- return false;
- case AOR_DB_INTERNAL_ERROR:
- handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED_SQL_ERROR, account_name.c_str());
- handler->SetSentErrorMessage(true);
- return false;
- default:
- handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED, account_name.c_str());
- handler->SetSentErrorMessage(true);
- return false;
+ case AOR_OK:
+ handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName);
+ break;
+ case AOR_NAME_TOO_LONG:
+ handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG);
+ handler->SetSentErrorMessage(true);
+ return false;
+ case AOR_NAME_ALREDY_EXIST:
+ handler->SendSysMessage(LANG_ACCOUNT_ALREADY_EXIST);
+ handler->SetSentErrorMessage(true);
+ return false;
+ case AOR_DB_INTERNAL_ERROR:
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED_SQL_ERROR, accountName);
+ handler->SetSentErrorMessage(true);
+ return false;
+ default:
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED, accountName);
+ handler->SetSentErrorMessage(true);
+ return false;
}
return true;
}
/// Delete a user account and all associated characters in this realm
- /// \todo This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm, delete account chars in realm then delete account
- static bool HandleAccountDeleteCommand(ChatHandler* handler, const char* args)
+ /// \todo This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm then delete account)
+ static bool HandleAccountDeleteCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
///- Get the account name from the command line
- char *account_name_str=strtok ((char*)args, " ");
- if (!account_name_str)
+ char* account = strtok((char*)args, " ");
+ if (!account)
return false;
- std::string account_name = account_name_str;
- if (!AccountMgr::normalizeString(account_name))
+ std::string accountName = account;
+ if (!AccountMgr::normalizeString(accountName))
{
- handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
return false;
}
- uint32 account_id = AccountMgr::GetId(account_name);
- if (!account_id)
+ uint32 accountId = AccountMgr::GetId(accountName);
+ if (!accountId)
{
- handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
return false;
}
@@ -161,34 +157,34 @@ public:
/// Commands not recommended call from chat, but support anyway
/// can delete only for account with less security
/// This is also reject self apply in fact
- if (handler->HasLowerSecurityAccount (NULL, account_id, true))
+ if (handler->HasLowerSecurityAccount(NULL, accountId, true))
return false;
- AccountOpResult result = AccountMgr::DeleteAccount(account_id);
+ AccountOpResult result = AccountMgr::DeleteAccount(accountId);
switch (result)
{
- case AOR_OK:
- handler->PSendSysMessage(LANG_ACCOUNT_DELETED, account_name.c_str());
- break;
- case AOR_NAME_NOT_EXIST:
- handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
- handler->SetSentErrorMessage(true);
- return false;
- case AOR_DB_INTERNAL_ERROR:
- handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR, account_name.c_str());
- handler->SetSentErrorMessage(true);
- return false;
- default:
- handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED, account_name.c_str());
- handler->SetSentErrorMessage(true);
- return false;
+ case AOR_OK:
+ handler->PSendSysMessage(LANG_ACCOUNT_DELETED, accountName.c_str());
+ break;
+ case AOR_NAME_NOT_EXIST:
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ case AOR_DB_INTERNAL_ERROR:
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ default:
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
}
return true;
}
/// Display info on users currently in the realm
- static bool HandleAccountOnlineListCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleAccountOnlineListCommand(ChatHandler* handler, char const* /*args*/)
{
///- Get the list of accounts ID logged to the realm
QueryResult resultDB = CharacterDatabase.Query("SELECT name, account, map, zone FROM characters WHERE online > 0");
@@ -218,6 +214,7 @@ public:
"LEFT JOIN account_access aa "
"ON (a.id = aa.id) "
"WHERE a.id = '%u'", account);
+
if (resultLogin)
{
Field* fieldsLogin = resultLogin->Fetch();
@@ -229,13 +226,13 @@ public:
else
handler->PSendSysMessage(LANG_ACCOUNT_LIST_ERROR, name.c_str());
- }while (resultDB->NextRow());
+ } while (resultDB->NextRow());
handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR);
return true;
}
- static bool HandleAccountLockCommand(ChatHandler* handler, const char* args)
+ static bool HandleAccountLockCommand(ChatHandler* handler, char const* args)
{
if (!*args)
{
@@ -244,15 +241,15 @@ public:
return false;
}
- std::string argstr = (char*)args;
- if (argstr == "on")
+ std::string param = (char*)args;
+ if (param == "on")
{
LoginDatabase.PExecute("UPDATE account SET locked = '1' WHERE id = '%d'", handler->GetSession()->GetAccountId());
handler->PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED);
return true;
}
- if (argstr == "off")
+ if (param == "off")
{
LoginDatabase.PExecute("UPDATE account SET locked = '0' WHERE id = '%d'", handler->GetSession()->GetAccountId());
handler->PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
@@ -264,7 +261,7 @@ public:
return false;
}
- static bool HandleAccountPasswordCommand(ChatHandler* handler, const char* args)
+ static bool HandleAccountPasswordCommand(ChatHandler* handler, char const* args)
{
if (!*args)
{
@@ -273,95 +270,95 @@ public:
return false;
}
- char *old_pass = strtok((char*)args, " ");
- char *new_pass = strtok(NULL, " ");
- char *new_pass_c = strtok(NULL, " ");
+ char* oldPassword = strtok((char*)args, " ");
+ char* newPassword = strtok(NULL, " ");
+ char* passwordConfirmation = strtok(NULL, " ");
- if (!old_pass || !new_pass || !new_pass_c)
+ if (!oldPassword || !newPassword || !passwordConfirmation)
{
handler->SendSysMessage(LANG_CMD_SYNTAX);
handler->SetSentErrorMessage(true);
return false;
}
- if (!AccountMgr::CheckPassword(handler->GetSession()->GetAccountId(), std::string(old_pass)))
+ if (!AccountMgr::CheckPassword(handler->GetSession()->GetAccountId(), std::string(oldPassword)))
{
handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD);
handler->SetSentErrorMessage(true);
return false;
}
- if (strcmp(new_pass, new_pass_c) != 0)
+ if (strcmp(newPassword, passwordConfirmation) != 0)
{
handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
handler->SetSentErrorMessage(true);
return false;
}
- AccountOpResult result = AccountMgr::ChangePassword(handler->GetSession()->GetAccountId(), std::string(new_pass));
+ AccountOpResult result = AccountMgr::ChangePassword(handler->GetSession()->GetAccountId(), std::string(newPassword));
switch (result)
{
- case AOR_OK:
- handler->SendSysMessage(LANG_COMMAND_PASSWORD);
- break;
- case AOR_PASS_TOO_LONG:
- handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
- handler->SetSentErrorMessage(true);
- return false;
- default:
- handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD);
- handler->SetSentErrorMessage(true);
- return false;
+ case AOR_OK:
+ handler->SendSysMessage(LANG_COMMAND_PASSWORD);
+ break;
+ case AOR_PASS_TOO_LONG:
+ handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
+ handler->SetSentErrorMessage(true);
+ return false;
+ default:
+ handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD);
+ handler->SetSentErrorMessage(true);
+ return false;
}
return true;
}
- static bool HandleAccountCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleAccountCommand(ChatHandler* handler, char const* /*args*/)
{
- AccountTypes gmlevel = handler->GetSession()->GetSecurity();
- handler->PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmlevel));
+ AccountTypes gmLevel = handler->GetSession()->GetSecurity();
+ handler->PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmLevel));
return true;
}
/// Set/Unset the expansion level for an account
- static bool HandleAccountSetAddonCommand(ChatHandler* handler, const char *args)
+ static bool HandleAccountSetAddonCommand(ChatHandler* handler, char const* args)
{
///- Get the command line arguments
- char *szAcc = strtok((char*)args, " ");
- char *szExp = strtok(NULL, " ");
+ char* account = strtok((char*)args, " ");
+ char* exp = strtok(NULL, " ");
- if (!szAcc)
+ if (!account)
return false;
- std::string account_name;
- uint32 account_id;
+ std::string accountName;
+ uint32 accountId;
- if (!szExp)
+ if (!exp)
{
Player* player = handler->getSelectedPlayer();
if (!player)
return false;
- account_id = player->GetSession()->GetAccountId();
- AccountMgr::GetName(account_id, account_name);
- szExp = szAcc;
+ accountId = player->GetSession()->GetAccountId();
+ AccountMgr::GetName(accountId, accountName);
+ exp = account;
}
else
{
///- Convert Account name to Upper Format
- account_name = szAcc;
- if (!AccountMgr::normalizeString(account_name))
+ accountName = account;
+ if (!AccountMgr::normalizeString(accountName))
{
- handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
return false;
}
- account_id = AccountMgr::GetId(account_name);
- if (!account_id)
+ accountId = AccountMgr::GetId(accountName);
+ if (!accountId)
{
- handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
return false;
}
@@ -370,21 +367,21 @@ public:
// Let set addon state only for lesser (strong) security level
// or to self account
- if (handler->GetSession() && handler->GetSession()->GetAccountId () != account_id &&
- handler->HasLowerSecurityAccount (NULL, account_id, true))
+ if (handler->GetSession() && handler->GetSession()->GetAccountId () != accountId &&
+ handler->HasLowerSecurityAccount(NULL, accountId, true))
return false;
- int expansion = atoi(szExp); //get int anyway (0 if error)
+ int expansion = atoi(exp); //get int anyway (0 if error)
if (expansion < 0 || uint8(expansion) > sWorld->getIntConfig(CONFIG_EXPANSION))
return false;
// No SQL injection
- LoginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'", expansion, account_id);
- handler->PSendSysMessage(LANG_ACCOUNT_SETADDON, account_name.c_str(), account_id, expansion);
+ LoginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'", expansion, accountId);
+ handler->PSendSysMessage(LANG_ACCOUNT_SETADDON, accountName.c_str(), accountId, expansion);
return true;
}
- static bool HandleAccountSetGmLevelCommand(ChatHandler* handler, const char *args)
+ static bool HandleAccountSetGmLevelCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -433,16 +430,16 @@ public:
// handler->getSession() == NULL only for console
targetAccountId = (isAccountNameGiven) ? AccountMgr::GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId();
int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2);
- uint32 plSecurity;
+ uint32 playerSecurity;
if (handler->GetSession())
- plSecurity = AccountMgr::GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID);
+ playerSecurity = AccountMgr::GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID);
else
- plSecurity = SEC_CONSOLE;
+ playerSecurity = SEC_CONSOLE;
// can set security level only for target with less security and to less security that we have
// This is also reject self apply in fact
targetSecurity = AccountMgr::GetSecurity(targetAccountId, gmRealmID);
- if (targetSecurity >= plSecurity || gm >= plSecurity)
+ if (targetSecurity >= playerSecurity || gm >= playerSecurity)
{
handler->SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
handler->SetSentErrorMessage(true);
@@ -450,7 +447,7 @@ public:
}
// Check and abort if the target gm has a higher rank on one of the realms and the new realm is -1
- if (gmRealmID == -1 && !AccountMgr::IsConsoleAccount(plSecurity))
+ if (gmRealmID == -1 && !AccountMgr::IsConsoleAccount(playerSecurity))
{
QueryResult result = LoginDatabase.PQuery("SELECT * FROM account_access WHERE id = '%u' AND gmlevel > '%d'", targetAccountId, gm);
if (result)
@@ -477,72 +474,74 @@ public:
if (gm != 0)
LoginDatabase.PExecute("INSERT INTO account_access VALUES ('%u', '%d', '%d')", targetAccountId, gm, realmID);
+
handler->PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);
return true;
}
/// Set password for account
- static bool HandleAccountSetPasswordCommand(ChatHandler* handler, const char *args)
+ static bool HandleAccountSetPasswordCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
///- Get the command line arguments
- char *szAccount = strtok ((char*)args, " ");
- char *szPassword1 = strtok (NULL, " ");
- char *szPassword2 = strtok (NULL, " ");
+ char* account = strtok((char*)args, " ");
+ char* password = strtok(NULL, " ");
+ char* passwordConfirmation = strtok(NULL, " ");
- if (!szAccount||!szPassword1 || !szPassword2)
+ if (!account || !password || !passwordConfirmation)
return false;
- std::string account_name = szAccount;
- if (!AccountMgr::normalizeString(account_name))
+ std::string accountName = account;
+ if (!AccountMgr::normalizeString(accountName))
{
- handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
return false;
}
- uint32 targetAccountId = AccountMgr::GetId(account_name);
+ uint32 targetAccountId = AccountMgr::GetId(accountName);
if (!targetAccountId)
{
- handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
return false;
}
/// can set password only for target with less security
/// This is also reject self apply in fact
- if (handler->HasLowerSecurityAccount (NULL, targetAccountId, true))
+ if (handler->HasLowerSecurityAccount(NULL, targetAccountId, true))
return false;
- if (strcmp(szPassword1, szPassword2))
+ if (strcmp(password, passwordConfirmation))
{
- handler->SendSysMessage (LANG_NEW_PASSWORDS_NOT_MATCH);
- handler->SetSentErrorMessage (true);
+ handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
+ handler->SetSentErrorMessage(true);
return false;
}
- AccountOpResult result = AccountMgr::ChangePassword(targetAccountId, szPassword1);
+ AccountOpResult result = AccountMgr::ChangePassword(targetAccountId, password);
switch (result)
{
- case AOR_OK:
- handler->SendSysMessage(LANG_COMMAND_PASSWORD);
- break;
- case AOR_NAME_NOT_EXIST:
- handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
- handler->SetSentErrorMessage(true);
- return false;
- case AOR_PASS_TOO_LONG:
- handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
- handler->SetSentErrorMessage(true);
- return false;
- default:
- handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD);
- handler->SetSentErrorMessage(true);
- return false;
+ case AOR_OK:
+ handler->SendSysMessage(LANG_COMMAND_PASSWORD);
+ break;
+ case AOR_NAME_NOT_EXIST:
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ case AOR_PASS_TOO_LONG:
+ handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
+ handler->SetSentErrorMessage(true);
+ return false;
+ default:
+ handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD);
+ handler->SetSentErrorMessage(true);
+ return false;
}
+
return true;
}
};
diff --git a/src/server/scripts/Commands/cs_achievement.cpp b/src/server/scripts/Commands/cs_achievement.cpp
index 88e07a07fe7..61ce13f0ecb 100644
--- a/src/server/scripts/Commands/cs_achievement.cpp
+++ b/src/server/scripts/Commands/cs_achievement.cpp
@@ -45,7 +45,7 @@ public:
return commandTable;
}
- static bool HandleAchievementAddCommand(ChatHandler* handler, const char *args)
+ static bool HandleAchievementAddCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -53,8 +53,8 @@ public:
uint32 achievementId = atoi((char*)args);
if (!achievementId)
{
- if (char* cId = handler->extractKeyFromLink((char*)args, "Hachievement"))
- achievementId = atoi(cId);
+ if (char* id = handler->extractKeyFromLink((char*)args, "Hachievement"))
+ achievementId = atoi(id);
if (!achievementId)
return false;
}
@@ -67,8 +67,8 @@ public:
return false;
}
- if (AchievementEntry const* pAE = GetAchievementStore()->LookupEntry(achievementId))
- target->CompletedAchievement(pAE);
+ if (AchievementEntry const* achievementEntry = GetAchievementStore()->LookupEntry(achievementId))
+ target->CompletedAchievement(achievementEntry);
return true;
}
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index dca2f1e4f0e..9e1d5717f1f 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -98,7 +98,7 @@ public:
return commandTable;
}
- static bool HandleDebugPlayCinematicCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugPlayCinematicCommand(ChatHandler* handler, char const* args)
{
// USAGE: .debug play cinematic #cinematicid
// #cinematicid - ID decimal number from CinemaicSequences.dbc (1st column)
@@ -109,20 +109,20 @@ public:
return false;
}
- uint32 dwId = atoi((char*)args);
+ uint32 id = atoi((char*)args);
- if (!sCinematicSequencesStore.LookupEntry(dwId))
+ if (!sCinematicSequencesStore.LookupEntry(id))
{
- handler->PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, dwId);
+ handler->PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, id);
handler->SetSentErrorMessage(true);
return false;
}
- handler->GetSession()->GetPlayer()->SendCinematicStart(dwId);
+ handler->GetSession()->GetPlayer()->SendCinematicStart(id);
return true;
}
- static bool HandleDebugPlayMovieCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugPlayMovieCommand(ChatHandler* handler, char const* args)
{
// USAGE: .debug play movie #movieid
// #movieid - ID decimal number from Movie.dbc (1st column)
@@ -133,21 +133,21 @@ public:
return false;
}
- uint32 dwId = atoi((char*)args);
+ uint32 id = atoi((char*)args);
- if (!sMovieStore.LookupEntry(dwId))
+ if (!sMovieStore.LookupEntry(id))
{
- handler->PSendSysMessage(LANG_MOVIE_NOT_EXIST, dwId);
+ handler->PSendSysMessage(LANG_MOVIE_NOT_EXIST, id);
handler->SetSentErrorMessage(true);
return false;
}
- handler->GetSession()->GetPlayer()->SendMovieStart(dwId);
+ handler->GetSession()->GetPlayer()->SendMovieStart(id);
return true;
}
//Play sound
- static bool HandleDebugPlaySoundCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugPlaySoundCommand(ChatHandler* handler, char const* args)
{
// USAGE: .debug playsound #soundid
// #soundid - ID decimal number from SoundEntries.dbc (1st column)
@@ -158,11 +158,11 @@ public:
return false;
}
- uint32 dwSoundId = atoi((char*)args);
+ uint32 soundId = atoi((char*)args);
- if (!sSoundEntriesStore.LookupEntry(dwSoundId))
+ if (!sSoundEntriesStore.LookupEntry(soundId))
{
- handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, dwSoundId);
+ handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
handler->SetSentErrorMessage(true);
return false;
}
@@ -176,48 +176,48 @@ public:
}
if (handler->GetSession()->GetPlayer()->GetSelection())
- unit->PlayDistanceSound(dwSoundId, handler->GetSession()->GetPlayer());
+ unit->PlayDistanceSound(soundId, handler->GetSession()->GetPlayer());
else
- unit->PlayDirectSound(dwSoundId, handler->GetSession()->GetPlayer());
+ unit->PlayDirectSound(soundId, handler->GetSession()->GetPlayer());
- handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId);
+ handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, soundId);
return true;
}
- static bool HandleDebugSendSpellFailCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugSendSpellFailCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- char* px = strtok((char*)args, " ");
- if (!px)
+ char* result = strtok((char*)args, " ");
+ if (!result)
return false;
- uint8 failnum = (uint8)atoi(px);
- if (failnum == 0 && *px != '0')
+ uint8 failNum = (uint8)atoi(result);
+ if (failNum == 0 && *result != '0')
return false;
- char* p1 = strtok(NULL, " ");
- uint8 failarg1 = p1 ? (uint8)atoi(p1) : 0;
+ char* fail1 = strtok(NULL, " ");
+ uint8 failArg1 = fail1 ? (uint8)atoi(fail1) : 0;
- char* p2 = strtok(NULL, " ");
- uint8 failarg2 = p2 ? (uint8)atoi(p2) : 0;
+ char* fail2 = strtok(NULL, " ");
+ uint8 failArg2 = fail2 ? (uint8)atoi(fail2) : 0;
WorldPacket data(SMSG_CAST_FAILED, 5);
data << uint8(0);
data << uint32(133);
- data << uint8(failnum);
- if (p1 || p2)
- data << uint32(failarg1);
- if (p2)
- data << uint32(failarg2);
+ data << uint8(failNum);
+ if (fail1 || fail2)
+ data << uint32(failArg1);
+ if (fail2)
+ data << uint32(failArg2);
handler->GetSession()->SendPacket(&data);
return true;
}
- static bool HandleDebugSendEquipErrorCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugSendEquipErrorCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -227,7 +227,7 @@ public:
return true;
}
- static bool HandleDebugSendSellErrorCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugSendSellErrorCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -237,7 +237,7 @@ public:
return true;
}
- static bool HandleDebugSendBuyErrorCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugSendBuyErrorCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -247,7 +247,7 @@ public:
return true;
}
- static bool HandleDebugSendOpcodeCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleDebugSendOpcodeCommand(ChatHandler* handler, char const* /*args*/)
{
Unit* unit = handler->getSelectedUnit();
Player* player = NULL;
@@ -255,7 +255,9 @@ public:
player = handler->GetSession()->GetPlayer();
else
player = (Player*)unit;
- if (!unit) unit = player;
+
+ if (!unit)
+ unit = player;
std::ifstream ifs("opcode.txt");
if (ifs.bad())
@@ -296,9 +298,7 @@ public:
}
// regular data
else
- {
ifs.putback(commentToken[1]);
- }
}
parsedStream.put(commentToken[0]);
}
@@ -418,7 +418,7 @@ public:
return true;
}
- static bool HandleDebugUpdateWorldStateCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugUpdateWorldStateCommand(ChatHandler* handler, char const* args)
{
char* w = strtok((char*)args, " ");
char* s = strtok(NULL, " ");
@@ -432,14 +432,16 @@ public:
return true;
}
- static bool HandleDebugAreaTriggersCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleDebugAreaTriggersCommand(ChatHandler* handler, char const* /*args*/)
{
Player* player = handler->GetSession()->GetPlayer();
if (!player->isDebugAreaTriggers)
{
handler->PSendSysMessage(LANG_DEBUG_AREATRIGGER_ON);
player->isDebugAreaTriggers = true;
- } else {
+ }
+ else
+ {
handler->PSendSysMessage(LANG_DEBUG_AREATRIGGER_OFF);
player->isDebugAreaTriggers = false;
}
@@ -447,12 +449,12 @@ public:
}
//Send notification in channel
- static bool HandleDebugSendChannelNotifyCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugSendChannelNotifyCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- const char *name = "test";
+ char const* name = "test";
uint8 code = atoi(args);
WorldPacket data(SMSG_CHANNEL_NOTIFY, (1+10));
@@ -465,12 +467,12 @@ public:
}
//Send notification in chat
- static bool HandleDebugSendChatMsgCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugSendChatMsgCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- const char *msg = "testtest";
+ char const* msg = "testtest";
uint8 type = atoi(args);
WorldPacket data;
ChatHandler::FillMessageData(&data, handler->GetSession(), type, 0, "chan", handler->GetSession()->GetPlayer()->GetGUID(), msg, handler->GetSession()->GetPlayer());
@@ -478,54 +480,64 @@ public:
return true;
}
- static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler* handler, char const* args)
{
uint32 msg = atol((char*)args);
handler->GetSession()->GetPlayer()->SendPushToPartyResponse(handler->GetSession()->GetPlayer(), msg);
return true;
}
- static bool HandleDebugGetLootRecipientCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleDebugGetLootRecipientCommand(ChatHandler* handler, char const* /*args*/)
{
Creature* target = handler->getSelectedCreature();
if (!target)
return false;
- handler->PSendSysMessage("Loot recipient for creature %s (GUID %u, DB GUID %u) is %s", target->GetName(), target->GetGUIDLow(), target->GetDBTableGUIDLow(), target->hasLootRecipient()?(target->GetLootRecipient()?target->GetLootRecipient()->GetName():"offline"):"no loot recipient");
+ handler->PSendSysMessage("Loot recipient for creature %s (GUID %u, DB GUID %u) is %s", target->GetName(), target->GetGUIDLow(), target->GetDBTableGUIDLow(), target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName() : "offline") : "no loot recipient");
return true;
}
- static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler* handler, char const* args)
{
uint32 msg = atol((char*)args);
handler->GetSession()->GetPlayer()->SendCanTakeQuestResponse(msg);
return true;
}
- static bool HandleDebugGetItemStateCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugGetItemStateCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- std::string state_str = args;
+ std::string itemState = args;
ItemUpdateState state = ITEM_UNCHANGED;
- bool list_queue = false, check_all = false;
- if (state_str == "unchanged") state = ITEM_UNCHANGED;
- else if (state_str == "changed") state = ITEM_CHANGED;
- else if (state_str == "new") state = ITEM_NEW;
- else if (state_str == "removed") state = ITEM_REMOVED;
- else if (state_str == "queue") list_queue = true;
- else if (state_str == "check_all") check_all = true;
- else return false;
+ bool listQueue = false;
+ bool checkAll = false;
+
+ if (itemState == "unchanged")
+ state = ITEM_UNCHANGED;
+ else if (itemState == "changed")
+ state = ITEM_CHANGED;
+ else if (itemState == "new")
+ state = ITEM_NEW;
+ else if (itemState == "removed")
+ state = ITEM_REMOVED;
+ else if (itemState == "queue")
+ listQueue = true;
+ else if (itemState == "check_all")
+ checkAll = true;
+ else
+ return false;
Player* player = handler->getSelectedPlayer();
- if (!player) player = handler->GetSession()->GetPlayer();
+ if (!player)
+ player = handler->GetSession()->GetPlayer();
- if (!list_queue && !check_all)
+ if (!listQueue && !checkAll)
{
- state_str = "The player has the following " + state_str + " items: ";
- handler->SendSysMessage(state_str.c_str());
+ itemState = "The player has the following " + itemState + " items: ";
+ handler->SendSysMessage(itemState.c_str());
for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
{
if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
@@ -546,60 +558,73 @@ public:
}
}
- if (list_queue)
+ if (listQueue)
{
- std::vector<Item*> &updateQueue = player->GetItemUpdateQueue();
+ std::vector<Item*>& updateQueue = player->GetItemUpdateQueue();
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);
+ uint8 bagSlot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0);
std::string st;
switch (item->GetState())
{
- case ITEM_UNCHANGED: st = "unchanged"; break;
- case ITEM_CHANGED: st = "changed"; break;
- case ITEM_NEW: st = "new"; break;
- case ITEM_REMOVED: st = "removed"; break;
+ case ITEM_UNCHANGED:
+ st = "unchanged";
+ break;
+ case ITEM_CHANGED:
+ st = "changed";
+ break;
+ case ITEM_NEW:
+ st = "new";
+ break;
+ case ITEM_REMOVED:
+ st = "removed";
+ break;
}
- handler->PSendSysMessage("bag: %d slot: %d guid: %d - state: %s", bag_slot, item->GetSlot(), item->GetGUIDLow(), st.c_str());
+ handler->PSendSysMessage("bag: %d slot: %d guid: %d - state: %s", bagSlot, item->GetSlot(), item->GetGUIDLow(), st.c_str());
}
if (updateQueue.empty())
handler->PSendSysMessage("The player's updatequeue is empty");
}
- if (check_all)
+ if (checkAll)
{
bool error = false;
- std::vector<Item*> &updateQueue = player->GetItemUpdateQueue();
+ 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)
continue;
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
- if (!item) continue;
+ if (!item)
+ continue;
if (item->GetSlot() != i)
{
handler->PSendSysMessage("Item with slot %d and guid %d has an incorrect slot value: %d", i, item->GetGUIDLow(), item->GetSlot());
- error = true; continue;
+ error = true;
+ continue;
}
if (item->GetOwnerGUID() != player->GetGUID())
{
handler->PSendSysMessage("The item with slot %d and itemguid %d does have non-matching owner guid (%d) and player guid (%d) !", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow());
- error = true; continue;
+ error = true;
+ continue;
}
if (Bag* container = item->GetContainer())
{
handler->PSendSysMessage("The item with slot %d and guid %d has a container (slot: %d, guid: %d) but shouldn't!", item->GetSlot(), item->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow());
- error = true; continue;
+ error = true;
+ continue;
}
if (item->IsInUpdateQueue())
@@ -608,25 +633,29 @@ public:
if (qp > updateQueue.size())
{
handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) larger than the update queue size! ", item->GetSlot(), item->GetGUIDLow(), qp);
- error = true; continue;
+ error = true;
+ continue;
}
if (updateQueue[qp] == NULL)
{
handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) pointing to NULL in the queue!", item->GetSlot(), item->GetGUIDLow(), qp);
- error = true; continue;
+ error = true;
+ continue;
}
if (updateQueue[qp] != item)
{
handler->PSendSysMessage("The item with slot %d and guid %d has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", item->GetSlot(), item->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow());
- error = true; continue;
+ error = true;
+ continue;
}
}
else if (item->GetState() != ITEM_UNCHANGED)
{
handler->PSendSysMessage("The item with slot %d and guid %d is not in queue but should be (state: %d)!", item->GetSlot(), item->GetGUIDLow(), item->GetState());
- error = true; continue;
+ error = true;
+ continue;
}
if (Bag* bag = item->ToBag())
@@ -634,31 +663,36 @@ public:
for (uint8 j = 0; j < bag->GetBagSize(); ++j)
{
Item* item2 = bag->GetItemByPos(j);
- if (!item2) continue;
+ if (!item2)
+ continue;
if (item2->GetSlot() != j)
{
handler->PSendSysMessage("The item in bag %d and slot %d (guid: %d) has an incorrect slot value: %d", bag->GetSlot(), j, item2->GetGUIDLow(), item2->GetSlot());
- error = true; continue;
+ error = true;
+ continue;
}
if (item2->GetOwnerGUID() != player->GetGUID())
{
handler->PSendSysMessage("The item in bag %d at slot %d and with itemguid %d, the owner's guid (%d) and the player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID()), player->GetGUIDLow());
- error = true; continue;
+ error = true;
+ continue;
}
Bag* container = item2->GetContainer();
if (!container)
{
handler->PSendSysMessage("The item in bag %d at slot %d with guid %d has no container!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow());
- error = true; continue;
+ error = true;
+ continue;
}
if (container != bag)
{
handler->PSendSysMessage("The item in bag %d at slot %d with guid %d has a different container(slot %d guid %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow());
- error = true; continue;
+ error = true;
+ continue;
}
if (item2->IsInUpdateQueue())
@@ -667,25 +701,29 @@ public:
if (qp > updateQueue.size())
{
handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp);
- error = true; continue;
+ error = true;
+ continue;
}
if (updateQueue[qp] == NULL)
{
handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp);
- error = true; continue;
+ error = true;
+ continue;
}
if (updateQueue[qp] != item2)
{
handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow());
- error = true; continue;
+ error = true;
+ continue;
}
}
else if (item2->GetState() != ITEM_UNCHANGED)
{
handler->PSendSysMessage("The item in bag %d at slot %d having guid %d is not in queue but should be (state: %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), item2->GetState());
- error = true; continue;
+ error = true;
+ continue;
}
}
}
@@ -694,33 +732,40 @@ public:
for (size_t i = 0; i < updateQueue.size(); ++i)
{
Item* item = updateQueue[i];
- if (!item) continue;
+ if (!item)
+ continue;
if (item->GetOwnerGUID() != player->GetGUID())
{
handler->PSendSysMessage("queue(" SIZEFMTD "): For the item with guid %d, the owner's guid (%d) and the player's guid (%d) don't match!", i, item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow());
- error = true; continue;
+ error = true;
+ continue;
}
if (item->GetQueuePos() != i)
{
handler->PSendSysMessage("queue(" SIZEFMTD "): For the item with guid %d, the queuepos doesn't match it's position in the queue!", i, item->GetGUIDLow());
- error = true; continue;
+ error = true;
+ continue;
}
- if (item->GetState() == ITEM_REMOVED) continue;
+ if (item->GetState() == ITEM_REMOVED)
+ continue;
+
Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot());
if (test == NULL)
{
handler->PSendSysMessage("queue(" SIZEFMTD "): The bag(%d) and slot(%d) values for the item with guid %d are incorrect, the player doesn't have any item at that position!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow());
- error = true; continue;
+ error = true;
+ continue;
}
if (test != item)
{
handler->PSendSysMessage("queue(" SIZEFMTD "): The bag(%d) and slot(%d) values for the item with guid %d are incorrect, an item which guid is %d is there instead!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow());
- error = true; continue;
+ error = true;
+ continue;
}
}
if (!error)
@@ -730,54 +775,54 @@ public:
return true;
}
- static bool HandleDebugBattlegroundCommand(ChatHandler* /*handler*/, const char* /*args*/)
+ static bool HandleDebugBattlegroundCommand(ChatHandler* /*handler*/, char const* /*args*/)
{
sBattlegroundMgr->ToggleTesting();
return true;
}
- static bool HandleDebugArenaCommand(ChatHandler* /*handler*/, const char* /*args*/)
+ static bool HandleDebugArenaCommand(ChatHandler* /*handler*/, char const* /*args*/)
{
sBattlegroundMgr->ToggleArenaTesting();
return true;
}
- static bool HandleDebugThreatListCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleDebugThreatListCommand(ChatHandler* handler, char const* /*args*/)
{
Creature* target = handler->getSelectedCreature();
if (!target || target->isTotem() || target->isPet())
return false;
- std::list<HostileReference*>& tlist = target->getThreatManager().getThreatList();
+ std::list<HostileReference*>& threatList = target->getThreatManager().getThreatList();
std::list<HostileReference*>::iterator itr;
- uint32 cnt = 0;
+ uint32 count = 0;
handler->PSendSysMessage("Threat list of %s (guid %u)", target->GetName(), target->GetGUIDLow());
- for (itr = tlist.begin(); itr != tlist.end(); ++itr)
+ for (itr = threatList.begin(); itr != threatList.end(); ++itr)
{
Unit* unit = (*itr)->getTarget();
if (!unit)
continue;
- ++cnt;
- handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", cnt, unit->GetName(), unit->GetGUIDLow(), (*itr)->getThreat());
+ ++count;
+ handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName(), unit->GetGUIDLow(), (*itr)->getThreat());
}
handler->SendSysMessage("End of threat list.");
return true;
}
- static bool HandleDebugHostileRefListCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleDebugHostileRefListCommand(ChatHandler* handler, char const* /*args*/)
{
Unit* target = handler->getSelectedUnit();
if (!target)
target = handler->GetSession()->GetPlayer();
HostileReference* ref = target->getHostileRefManager().getFirst();
- uint32 cnt = 0;
+ uint32 count = 0;
handler->PSendSysMessage("Hostil reference list of %s (guid %u)", target->GetName(), target->GetGUIDLow());
while (ref)
{
if (Unit* unit = ref->getSource()->getOwner())
{
- ++cnt;
- handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", cnt, unit->GetName(), unit->GetGUIDLow(), ref->getThreat());
+ ++count;
+ handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName(), unit->GetGUIDLow(), ref->getThreat());
}
ref = ref->next();
}
@@ -785,7 +830,7 @@ public:
return true;
}
- static bool HandleDebugSetVehicleIdCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugSetVehicleIdCommand(ChatHandler* handler, char const* args)
{
Unit* target = handler->getSelectedUnit();
if (!target || target->IsVehicle())
@@ -804,7 +849,7 @@ public:
return true;
}
- static bool HandleDebugEnterVehicleCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugEnterVehicleCommand(ChatHandler* handler, char const* args)
{
Unit* target = handler->getSelectedUnit();
if (!target || !target->IsVehicle())
@@ -839,7 +884,7 @@ public:
return true;
}
- static bool HandleDebugSpawnVehicleCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugSpawnVehicleCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -880,12 +925,12 @@ public:
return false;
}
- map->Add(v->ToCreature());
+ map->AddToMap(v->ToCreature());
return true;
}
- static bool HandleDebugSendLargePacketCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleDebugSendLargePacketCommand(ChatHandler* handler, char const* /*args*/)
{
const char* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. ";
std::ostringstream ss;
@@ -895,7 +940,7 @@ public:
return true;
}
- static bool HandleDebugSendSetPhaseShiftCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugSendSetPhaseShiftCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -905,7 +950,7 @@ public:
return true;
}
- static bool HandleDebugGetItemValueCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugGetItemValueCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -934,7 +979,7 @@ public:
return true;
}
- static bool HandleDebugSetItemValueCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugSetItemValueCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -963,7 +1008,7 @@ public:
return true;
}
- static bool HandleDebugItemExpireCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugItemExpireCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -986,17 +1031,17 @@ public:
}
//show animation
- static bool HandleDebugAnimCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugAnimCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- uint32 anim_id = atoi((char*)args);
- handler->GetSession()->GetPlayer()->HandleEmoteCommand(anim_id);
+ uint32 animId = atoi((char*)args);
+ handler->GetSession()->GetPlayer()->HandleEmoteCommand(animId);
return true;
}
- static bool HandleDebugSetAuraStateCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugSetAuraStateCommand(ChatHandler* handler, char const* args)
{
if (!*args)
{
@@ -1026,16 +1071,16 @@ public:
return true;
}
- static bool HandleDebugSetValueCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugSetValueCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- char* px = strtok((char*)args, " ");
- char* py = strtok(NULL, " ");
- char* pz = strtok(NULL, " ");
+ char* x = strtok((char*)args, " ");
+ char* y = strtok(NULL, " ");
+ char* z = strtok(NULL, " ");
- if (!px || !py)
+ if (!x || !y)
return false;
WorldObject* target = handler->getSelectedObject();
@@ -1048,41 +1093,42 @@ public:
uint64 guid = target->GetGUID();
- uint32 Opcode = (uint32)atoi(px);
- if (Opcode >= target->GetValuesCount())
+ uint32 opcode = (uint32)atoi(x);
+ if (opcode >= target->GetValuesCount())
{
- handler->PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount());
+ handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, GUID_LOPART(guid), target->GetValuesCount());
return false;
}
- bool isint32 = true;
- if (pz)
- isint32 = (bool)atoi(pz);
- if (isint32)
+ bool isInt32 = true;
+ if (z)
+ isInt32 = (bool)atoi(z);
+
+ if (isInt32)
{
- uint32 iValue = (uint32)atoi(py);
- target->SetUInt32Value(Opcode, iValue);
- handler->PSendSysMessage(LANG_SET_UINT_FIELD, GUID_LOPART(guid), Opcode, iValue);
+ uint32 value = (uint32)atoi(y);
+ target->SetUInt32Value(opcode , value);
+ handler->PSendSysMessage(LANG_SET_UINT_FIELD, GUID_LOPART(guid), opcode, value);
}
else
{
- float fValue = (float)atof(py);
- target->SetFloatValue(Opcode, fValue);
- handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), Opcode, fValue);
+ float value = (float)atof(y);
+ target->SetFloatValue(opcode , value);
+ handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), opcode, value);
}
return true;
}
- static bool HandleDebugGetValueCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugGetValueCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- char* px = strtok((char*)args, " ");
- char* pz = strtok(NULL, " ");
+ char* x = strtok((char*)args, " ");
+ char* z = strtok(NULL, " ");
- if (!px)
+ if (!x)
return false;
Unit* target = handler->getSelectedUnit();
@@ -1095,62 +1141,62 @@ public:
uint64 guid = target->GetGUID();
- uint32 Opcode = (uint32)atoi(px);
- if (Opcode >= target->GetValuesCount())
+ uint32 opcode = (uint32)atoi(x);
+ if (opcode >= target->GetValuesCount())
{
- handler->PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount());
+ handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, GUID_LOPART(guid), target->GetValuesCount());
return false;
}
- bool isint32 = true;
- if (pz)
- isint32 = (bool)atoi(pz);
+ bool isInt32 = true;
+ if (z)
+ isInt32 = (bool)atoi(z);
- if (isint32)
+ if (isInt32)
{
- uint32 iValue = target->GetUInt32Value(Opcode);
- handler->PSendSysMessage(LANG_GET_UINT_FIELD, GUID_LOPART(guid), Opcode, iValue);
+ uint32 value = target->GetUInt32Value(opcode);
+ handler->PSendSysMessage(LANG_GET_UINT_FIELD, GUID_LOPART(guid), opcode, value);
}
else
{
- float fValue = target->GetFloatValue(Opcode);
- handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, GUID_LOPART(guid), Opcode, fValue);
+ float value = target->GetFloatValue(opcode);
+ handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, GUID_LOPART(guid), opcode, value);
}
return true;
}
- static bool HandleDebugMod32ValueCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugMod32ValueCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- char* px = strtok((char*)args, " ");
- char* py = strtok(NULL, " ");
+ char* x = strtok((char*)args, " ");
+ char* y = strtok(NULL, " ");
- if (!px || !py)
+ if (!x || !y)
return false;
- uint32 Opcode = (uint32)atoi(px);
- int Value = atoi(py);
+ uint32 opcode = (uint32)atoi(x);
+ int value = atoi(y);
- if (Opcode >= handler->GetSession()->GetPlayer()->GetValuesCount())
+ if (opcode >= handler->GetSession()->GetPlayer()->GetValuesCount())
{
- handler->PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, handler->GetSession()->GetPlayer()->GetGUIDLow(), handler->GetSession()->GetPlayer()->GetValuesCount());
+ handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, handler->GetSession()->GetPlayer()->GetGUIDLow(), handler->GetSession()->GetPlayer()->GetValuesCount());
return false;
}
- int CurrentValue = (int)handler->GetSession()->GetPlayer()->GetUInt32Value(Opcode);
+ int currentValue = (int)handler->GetSession()->GetPlayer()->GetUInt32Value(opcode);
- CurrentValue += Value;
- handler->GetSession()->GetPlayer()->SetUInt32Value(Opcode, (uint32)CurrentValue);
+ currentValue += value;
+ handler->GetSession()->GetPlayer()->SetUInt32Value(opcode , (uint32)currentValue);
- handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, Opcode, CurrentValue);
+ handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, opcode, currentValue);
return true;
}
- static bool HandleDebugUpdateCommand(ChatHandler* handler, const char* args)
+ static bool HandleDebugUpdateCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1158,49 +1204,48 @@ public:
uint32 updateIndex;
uint32 value;
- char* pUpdateIndex = strtok((char*)args, " ");
+ char* index = strtok((char*)args, " ");
- Unit* chr = handler->getSelectedUnit();
- if (chr == NULL)
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
return false;
}
- if (!pUpdateIndex)
- {
+ if (!index)
return true;
- }
- updateIndex = atoi(pUpdateIndex);
+
+ updateIndex = atoi(index);
//check updateIndex
- if (chr->GetTypeId() == TYPEID_PLAYER)
- {
- if (updateIndex >= PLAYER_END) return true;
- }
- else
+ if (unit->GetTypeId() == TYPEID_PLAYER)
{
- if (updateIndex >= UNIT_END) return true;
+ if (updateIndex >= PLAYER_END)
+ return true;
}
+ else if (updateIndex >= UNIT_END)
+ return true;
- char* pvalue = strtok(NULL, " ");
- if (!pvalue)
+ char* val = strtok(NULL, " ");
+ if (!val)
{
- value=chr->GetUInt32Value(updateIndex);
+ value = unit->GetUInt32Value(updateIndex);
- handler->PSendSysMessage(LANG_UPDATE, chr->GetGUIDLow(), updateIndex, value);
+ handler->PSendSysMessage(LANG_UPDATE, unit->GetGUIDLow(), updateIndex, value);
return true;
}
- value=atoi(pvalue);
+ value = atoi(val);
- handler->PSendSysMessage(LANG_UPDATE_CHANGE, chr->GetGUIDLow(), updateIndex, value);
+ handler->PSendSysMessage(LANG_UPDATE_CHANGE, unit->GetGUIDLow(), updateIndex, value);
- chr->SetUInt32Value(updateIndex, value);
+ unit->SetUInt32Value(updateIndex, value);
return true;
}
- static bool HandleDebugSet32BitCommand(ChatHandler* handler, const char* args)
+
+ static bool HandleDebugSet32BitCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1213,21 +1258,21 @@ public:
return false;
}
- char* px = strtok((char*)args, " ");
- char* py = strtok(NULL, " ");
+ char* x = strtok((char*)args, " ");
+ char* y = strtok(NULL, " ");
- if (!px || !py)
+ if (!x || !y)
return false;
- uint32 Opcode = (uint32)atoi(px);
- uint32 Value = (uint32)atoi(py);
- if (Value > 32) //uint32 = 32 bits
+ uint32 opcode = (uint32)atoi(x);
+ uint32 val = (uint32)atoi(y);
+ if (val > 32) //uint32 = 32 bits
return false;
- uint32 iValue = Value ? 1 << (Value - 1) : 0;
- target->SetUInt32Value(Opcode, iValue);
+ uint32 value = val ? 1 << (val - 1) : 0;
+ target->SetUInt32Value(opcode, value);
- handler->PSendSysMessage(LANG_SET_32BIT_FIELD, Opcode, iValue);
+ handler->PSendSysMessage(LANG_SET_32BIT_FIELD, opcode, value);
return true;
}
};
diff --git a/src/server/scripts/Commands/cs_event.cpp b/src/server/scripts/Commands/cs_event.cpp
index 20ade38d676..3bd745df4f4 100644
--- a/src/server/scripts/Commands/cs_event.cpp
+++ b/src/server/scripts/Commands/cs_event.cpp
@@ -49,7 +49,7 @@ public:
return commandTable;
}
- static bool HandleEventActiveListCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleEventActiveListCommand(ChatHandler* handler, char const* /*args*/)
{
uint32 counter = 0;
@@ -60,13 +60,13 @@ public:
for (GameEventMgr::ActiveEvents::const_iterator itr = activeEvents.begin(); itr != activeEvents.end(); ++itr)
{
- uint32 event_id = *itr;
- GameEventData const& eventData = events[event_id];
+ uint32 eventId = *itr;
+ GameEventData const& eventData = events[eventId];
if (handler->GetSession())
- handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, event_id, event_id, eventData.description.c_str(), active);
+ handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, eventId, eventId, eventData.description.c_str(), active);
else
- handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, event_id, eventData.description.c_str(), active);
+ handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, eventId, eventData.description.c_str(), active);
++counter;
}
@@ -78,28 +78,28 @@ public:
return true;
}
- static bool HandleEventInfoCommand(ChatHandler* handler, const char* args)
+ static bool HandleEventInfoCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
// id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r
- char* cId = handler->extractKeyFromLink((char*)args, "Hgameevent");
- if (!cId)
+ char* id = handler->extractKeyFromLink((char*)args, "Hgameevent");
+ if (!id)
return false;
- uint32 event_id = atoi(cId);
+ uint32 eventId = atoi(id);
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
- if (event_id >=events.size())
+ if (eventId >= events.size())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
handler->SetSentErrorMessage(true);
return false;
}
- GameEventData const& eventData = events[event_id];
+ GameEventData const& eventData = events[eventId];
if (!eventData.isValid())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
@@ -108,47 +108,47 @@ public:
}
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
- bool active = activeEvents.find(event_id) != activeEvents.end();
+ bool active = activeEvents.find(eventId) != activeEvents.end();
char const* activeStr = active ? handler->GetTrinityString(LANG_ACTIVE) : "";
std::string startTimeStr = TimeToTimestampStr(eventData.start);
std::string endTimeStr = TimeToTimestampStr(eventData.end);
- uint32 delay = sGameEventMgr->NextCheck(event_id);
- time_t nextTime = time(NULL)+delay;
- std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(NULL)+delay) : "-";
+ uint32 delay = sGameEventMgr->NextCheck(eventId);
+ time_t nextTime = time(NULL) + delay;
+ std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(NULL) + delay) : "-";
std::string occurenceStr = secsToTimeString(eventData.occurence * MINUTE);
std::string lengthStr = secsToTimeString(eventData.length * MINUTE);
- handler->PSendSysMessage(LANG_EVENT_INFO, event_id, eventData.description.c_str(), activeStr,
+ handler->PSendSysMessage(LANG_EVENT_INFO, eventId, eventData.description.c_str(), activeStr,
startTimeStr.c_str(), endTimeStr.c_str(), occurenceStr.c_str(), lengthStr.c_str(),
nextStr.c_str());
return true;
}
- static bool HandleEventStartCommand(ChatHandler* handler, const char* args)
+ static bool HandleEventStartCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
// id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r
- char* cId = handler->extractKeyFromLink((char*)args, "Hgameevent");
- if (!cId)
+ char* id = handler->extractKeyFromLink((char*)args, "Hgameevent");
+ if (!id)
return false;
- int32 event_id = atoi(cId);
+ int32 eventId = atoi(id);
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
- if (event_id < 1 || uint32(event_id) >= events.size())
+ if (eventId < 1 || uint32(eventId) >= events.size())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
handler->SetSentErrorMessage(true);
return false;
}
- GameEventData const& eventData = events[event_id];
+ GameEventData const& eventData = events[eventId];
if (!eventData.isValid())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
@@ -157,39 +157,39 @@ public:
}
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
- if (activeEvents.find(event_id) != activeEvents.end())
+ if (activeEvents.find(eventId) != activeEvents.end())
{
- handler->PSendSysMessage(LANG_EVENT_ALREADY_ACTIVE, event_id);
+ handler->PSendSysMessage(LANG_EVENT_ALREADY_ACTIVE, eventId);
handler->SetSentErrorMessage(true);
return false;
}
- sGameEventMgr->StartEvent(event_id, true);
+ sGameEventMgr->StartEvent(eventId, true);
return true;
}
- static bool HandleEventStopCommand(ChatHandler* handler, const char* args)
+ static bool HandleEventStopCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
// id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r
- char* cId = handler->extractKeyFromLink((char*)args, "Hgameevent");
- if (!cId)
+ char* id = handler->extractKeyFromLink((char*)args, "Hgameevent");
+ if (!id)
return false;
- int32 event_id = atoi(cId);
+ int32 eventId = atoi(id);
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
- if (event_id < 1 || uint32(event_id) >= events.size())
+ if (eventId < 1 || uint32(eventId) >= events.size())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
handler->SetSentErrorMessage(true);
return false;
}
- GameEventData const& eventData = events[event_id];
+ GameEventData const& eventData = events[eventId];
if (!eventData.isValid())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
@@ -199,14 +199,14 @@ public:
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
- if (activeEvents.find(event_id) == activeEvents.end())
+ if (activeEvents.find(eventId) == activeEvents.end())
{
- handler->PSendSysMessage(LANG_EVENT_NOT_ACTIVE, event_id);
+ handler->PSendSysMessage(LANG_EVENT_NOT_ACTIVE, eventId);
handler->SetSentErrorMessage(true);
return false;
}
- sGameEventMgr->StopEvent(event_id, true);
+ sGameEventMgr->StopEvent(eventId, true);
return true;
}
};
diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp
index 9a7146c641c..2a352e92d01 100644
--- a/src/server/scripts/Commands/cs_gm.cpp
+++ b/src/server/scripts/Commands/cs_gm.cpp
@@ -53,7 +53,7 @@ public:
}
// Enables or disables hiding of the staff badge
- static bool HandleGMChatCommand(ChatHandler* handler, const char* args)
+ static bool HandleGMChatCommand(ChatHandler* handler, char const* args)
{
if (!*args)
{
@@ -65,16 +65,16 @@ public:
return true;
}
- std::string argstr = (char*)args;
+ std::string param = (char*)args;
- if (argstr == "on")
+ if (param == "on")
{
handler->GetSession()->GetPlayer()->SetGMChat(true);
handler->GetSession()->SendNotification(LANG_GM_CHAT_ON);
return true;
}
- if (argstr == "off")
+ if (param == "off")
{
handler->GetSession()->GetPlayer()->SetGMChat(false);
handler->GetSession()->SendNotification(LANG_GM_CHAT_OFF);
@@ -86,7 +86,7 @@ public:
return false;
}
- static bool HandleGMFlyCommand(ChatHandler* handler, const char* args)
+ static bool HandleGMFlyCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -112,17 +112,17 @@ public:
return true;
}
- static bool HandleGMListIngameCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleGMListIngameCommand(ChatHandler* handler, char const* /*args*/)
{
bool first = true;
bool footer = false;
ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, *HashMapHolder<Player>::GetLock(), true);
- HashMapHolder<Player>::MapType &m = sObjectAccessor->GetPlayers();
+ HashMapHolder<Player>::MapType& m = sObjectAccessor->GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
{
- AccountTypes itr_sec = itr->second->GetSession()->GetSecurity();
- if ((itr->second->isGameMaster() || (!AccountMgr::IsPlayerAccount(itr_sec) && itr_sec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) &&
+ AccountTypes itrSec = itr->second->GetSession()->GetSecurity();
+ if ((itr->second->isGameMaster() || (!AccountMgr::IsPlayerAccount(itrSec) && itrSec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) &&
(!handler->GetSession() || itr->second->IsVisibleGloballyFor(handler->GetSession()->GetPlayer())))
{
if (first)
@@ -132,12 +132,12 @@ public:
handler->SendSysMessage(LANG_GMS_ON_SRV);
handler->SendSysMessage("========================");
}
- const char* name = itr->second->GetName();
- uint8 security = itr_sec;
+ char const* name = itr->second->GetName();
+ uint8 security = itrSec;
uint8 max = ((16 - strlen(name)) / 2);
uint8 max2 = max;
- if (((max)+(max2)+(strlen(name))) == 16)
- max2 = ((max)-1);
+ if ((max + max2 + strlen(name)) == 16)
+ max2 = max - 1;
if (handler->GetSession())
handler->PSendSysMessage("| %s GMLevel %u", name, security);
else
@@ -152,7 +152,7 @@ public:
}
/// Display the list of GMs
- static bool HandleGMListFullCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleGMListFullCommand(ChatHandler* handler, char const* /*args*/)
{
///- Get the accounts with GM Level >0
QueryResult result = LoginDatabase.PQuery("SELECT a.username, aa.gmlevel FROM account a, account_access aa WHERE a.id=aa.id AND aa.gmlevel >= %u", SEC_MODERATOR);
@@ -164,19 +164,17 @@ public:
do
{
Field* fields = result->Fetch();
- const char* name = fields[0].GetCString();
+ char const* name = fields[0].GetCString();
uint8 security = fields[1].GetUInt8();
- uint8 max = ((16 - strlen(name)) / 2);
+ uint8 max = (16 - strlen(name)) / 2;
uint8 max2 = max;
- if (((max)+(max2)+(strlen(name))) == 16)
- max2 = ((max)-1);
+ if ((max + max2 + strlen(name)) == 16)
+ max2 = max - 1;
if (handler->GetSession())
handler->PSendSysMessage("| %s GMLevel %u", name, security);
else
handler->PSendSysMessage("|%*s%s%*s| %u |", max, " ", name, max2, " ", security);
- }
- while (result->NextRow());
-
+ } while (result->NextRow());
handler->SendSysMessage("========================");
}
else
@@ -185,24 +183,24 @@ public:
}
//Enable\Disable Invisible mode
- static bool HandleGMVisibleCommand(ChatHandler* handler, const char* args)
+ static bool HandleGMVisibleCommand(ChatHandler* handler, char const* args)
{
if (!*args)
{
- handler->PSendSysMessage(LANG_YOU_ARE, handler->GetSession()->GetPlayer()->isGMVisible() ? handler->GetTrinityString(LANG_VISIBLE) : handler->GetTrinityString(LANG_INVISIBLE));
+ handler->PSendSysMessage(LANG_YOU_ARE, handler->GetSession()->GetPlayer()->isGMVisible() ? handler->GetTrinityString(LANG_VISIBLE) : handler->GetTrinityString(LANG_INVISIBLE));
return true;
}
- std::string argstr = (char*)args;
+ std::string param = (char*)args;
- if (argstr == "on")
+ if (param == "on")
{
handler->GetSession()->GetPlayer()->SetGMVisible(true);
handler->GetSession()->SendNotification(LANG_INVISIBLE_VISIBLE);
return true;
}
- if (argstr == "off")
+ if (param == "off")
{
handler->GetSession()->SendNotification(LANG_INVISIBLE_INVISIBLE);
handler->GetSession()->GetPlayer()->SetGMVisible(false);
@@ -215,7 +213,7 @@ public:
}
//Enable\Disable GM Mode
- static bool HandleGMCommand(ChatHandler* handler, const char* args)
+ static bool HandleGMCommand(ChatHandler* handler, char const* args)
{
if (!*args)
{
@@ -226,9 +224,9 @@ public:
return true;
}
- std::string argstr = (char*)args;
+ std::string param = (char*)args;
- if (argstr == "on")
+ if (param == "on")
{
handler->GetSession()->GetPlayer()->SetGameMaster(true);
handler->GetSession()->SendNotification(LANG_GM_ON);
@@ -240,7 +238,7 @@ public:
return true;
}
- if (argstr == "off")
+ if (param == "off")
{
handler->GetSession()->GetPlayer()->SetGameMaster(false);
handler->GetSession()->SendNotification(LANG_GM_OFF);
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp
index 118ab9eb13a..5ed2d6a3dd8 100644
--- a/src/server/scripts/Commands/cs_go.cpp
+++ b/src/server/scripts/Commands/cs_go.cpp
@@ -57,6 +57,7 @@ public:
};
return commandTable;
}
+
/** \brief Teleport the GM to the specified creature
*
* .gocreature <GUID> --> TP using creature.guid
@@ -68,59 +69,52 @@ public:
* you will be teleported to the first one that is found.
*/
//teleport to creature
- static bool HandleGoCreatureCommand(ChatHandler* handler, const char* args)
+ static bool HandleGoCreatureCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- Player* _player = handler->GetSession()->GetPlayer();
+
+ Player* player = handler->GetSession()->GetPlayer();
// "id" or number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
- char* pParam1 = handler->extractKeyFromLink((char*)args, "Hcreature");
- if (!pParam1)
+ char* param1 = handler->extractKeyFromLink((char*)args, "Hcreature");
+ if (!param1)
return false;
std::ostringstream whereClause;
// User wants to teleport to the NPC's template entry
- if (strcmp(pParam1, "id") == 0)
+ if (strcmp(param1, "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)
return false;
- char* cId = handler->extractKeyFromLink(tail, "Hcreature_entry");
- if (!cId)
+ char* id = handler->extractKeyFromLink(tail, "Hcreature_entry");
+ if (!id)
return false;
- int32 tEntry = atoi(cId);
- //sLog->outError("DEBUG: ID value: %d", tEntry);
- if (!tEntry)
+ int32 entry = atoi(id);
+ if (!entry)
return false;
- whereClause << "WHERE id = '" << tEntry << '\'';
+ whereClause << "WHERE id = '" << entry << '\'';
}
else
{
- //sLog->outError("DEBUG: ID *not found*");
-
- int32 guid = atoi(pParam1);
+ int32 guid = atoi(param1);
// Number is invalid - maybe the user specified the mob's name
if (!guid)
{
- std::string name = pParam1;
+ std::string name = param1;
WorldDatabase.EscapeString(name);
whereClause << ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name "_LIKE_" '" << name << '\'';
}
else
- {
whereClause << "WHERE guid = '" << guid << '\'';
- }
}
- //sLog->outError("DEBUG: %s", whereClause.c_str());
QueryResult result = WorldDatabase.PQuery("SELECT position_x, position_y, position_z, orientation, map, guid, id FROM creature %s", whereClause.str().c_str());
if (!result)
@@ -137,12 +131,12 @@ public:
float y = fields[1].GetFloat();
float z = fields[2].GetFloat();
float ort = fields[3].GetFloat();
- int mapid = fields[4].GetUInt16();
+ int mapId = fields[4].GetUInt16();
uint32 guid = fields[5].GetUInt32();
uint32 id = fields[6].GetUInt32();
// if creature is in same map with caster go at its current location
- if (Creature* creature = sObjectAccessor->GetCreature(*_player, MAKE_NEW_GUID(guid, id, HIGHGUID_UNIT)))
+ if (Creature* creature = sObjectAccessor->GetCreature(*player, MAKE_NEW_GUID(guid, id, HIGHGUID_UNIT)))
{
x = creature->GetPositionX();
y = creature->GetPositionY();
@@ -150,46 +144,47 @@ public:
ort = creature->GetOrientation();
}
- if (!MapManager::IsValidMapCoord(mapid, x, y, z, ort))
+ if (!MapManager::IsValidMapCoord(mapId, x, y, z, ort))
{
- handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapid);
+ handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId);
handler->SetSentErrorMessage(true);
return false;
}
// stop flight if need
- if (_player->isInFlight())
+ if (player->isInFlight())
{
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
}
// save only in non-flight case
else
- _player->SaveRecallPosition();
+ player->SaveRecallPosition();
- _player->TeleportTo(mapid, x, y, z, ort);
+ player->TeleportTo(mapId, x, y, z, ort);
return true;
}
- static bool HandleGoGraveyardCommand(ChatHandler* handler, const char* args)
+
+ static bool HandleGoGraveyardCommand(ChatHandler* handler, char const* args)
{
- Player* _player = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetSession()->GetPlayer();
if (!*args)
return false;
- char *gyId = strtok((char*)args, " ");
+ char* gyId = strtok((char*)args, " ");
if (!gyId)
return false;
- int32 i_gyId = atoi(gyId);
+ int32 graveyardId = atoi(gyId);
- if (!i_gyId)
+ if (!graveyardId)
return false;
- WorldSafeLocsEntry const* gy = sWorldSafeLocsStore.LookupEntry(i_gyId);
+ WorldSafeLocsEntry const* gy = sWorldSafeLocsStore.LookupEntry(graveyardId);
if (!gy)
{
- handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, i_gyId);
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId);
handler->SetSentErrorMessage(true);
return false;
}
@@ -202,93 +197,92 @@ public:
}
// stop flight if need
- if (_player->isInFlight())
+ if (player->isInFlight())
{
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
}
// save only in non-flight case
else
- _player->SaveRecallPosition();
+ player->SaveRecallPosition();
- _player->TeleportTo(gy->map_id, gy->x, gy->y, gy->z, _player->GetOrientation());
+ player->TeleportTo(gy->map_id, gy->x, gy->y, gy->z, player->GetOrientation());
return true;
}
+
//teleport to grid
- static bool HandleGoGridCommand(ChatHandler* handler, const char* args)
+ static bool HandleGoGridCommand(ChatHandler* handler, char const* args)
{
- if (!*args) return false;
- Player* _player = handler->GetSession()->GetPlayer();
+ if (!*args)
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
- char* px = strtok((char*)args, " ");
- char* py = strtok(NULL, " ");
- char* pmapid = strtok(NULL, " ");
+ char* gridX = strtok((char*)args, " ");
+ char* gridY = strtok(NULL, " ");
+ char* id = strtok(NULL, " ");
- if (!px || !py)
+ if (!gridX || !gridY)
return false;
- float grid_x = (float)atof(px);
- float grid_y = (float)atof(py);
- uint32 mapid;
- if (pmapid)
- mapid = (uint32)atoi(pmapid);
- else mapid = _player->GetMapId();
+ uint32 mapId = id ? (uint32)atoi(id) : player->GetMapId();
// center of grid
- float x = (grid_x-CENTER_GRID_ID+0.5f)*SIZE_OF_GRIDS;
- float y = (grid_y-CENTER_GRID_ID+0.5f)*SIZE_OF_GRIDS;
+ float x = ((float)atof(gridX) - CENTER_GRID_ID + 0.5f) * SIZE_OF_GRIDS;
+ float y = ((float)atof(gridY) - CENTER_GRID_ID + 0.5f) * SIZE_OF_GRIDS;
- if (!MapManager::IsValidMapCoord(mapid, x, y))
+ if (!MapManager::IsValidMapCoord(mapId, x, y))
{
- handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapid);
+ handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId);
handler->SetSentErrorMessage(true);
return false;
}
// stop flight if need
- if (_player->isInFlight())
+ if (player->isInFlight())
{
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
}
// save only in non-flight case
else
- _player->SaveRecallPosition();
+ player->SaveRecallPosition();
- Map const* map = sMapMgr->CreateBaseMap(mapid);
+ Map const* map = sMapMgr->CreateBaseMap(mapId);
float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
- _player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
+ player->TeleportTo(mapId, x, y, z, player->GetOrientation());
return true;
}
+
//teleport to gameobject
- static bool HandleGoObjectCommand(ChatHandler* handler, const char* args)
+ static bool HandleGoObjectCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- Player* _player = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetSession()->GetPlayer();
// number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r
- char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject");
- if (!cId)
+ char* id = handler->extractKeyFromLink((char*)args, "Hgameobject");
+ if (!id)
return false;
- int32 guid = atoi(cId);
+ int32 guid = atoi(id);
if (!guid)
return false;
float x, y, z, ort;
- int mapid;
+ int mapId;
// by DB guid
- if (GameObjectData const* go_data = sObjectMgr->GetGOData(guid))
+ if (GameObjectData const* goData = sObjectMgr->GetGOData(guid))
{
- x = go_data->posX;
- y = go_data->posY;
- z = go_data->posZ;
- ort = go_data->orientation;
- mapid = go_data->mapid;
+ x = goData->posX;
+ y = goData->posY;
+ z = goData->posZ;
+ ort = goData->orientation;
+ mapId = goData->mapid;
}
else
{
@@ -297,45 +291,46 @@ public:
return false;
}
- if (!MapManager::IsValidMapCoord(mapid, x, y, z, ort))
+ if (!MapManager::IsValidMapCoord(mapId, x, y, z, ort))
{
- handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapid);
+ handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId);
handler->SetSentErrorMessage(true);
return false;
}
// stop flight if need
- if (_player->isInFlight())
+ if (player->isInFlight())
{
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
}
// save only in non-flight case
else
- _player->SaveRecallPosition();
+ player->SaveRecallPosition();
- _player->TeleportTo(mapid, x, y, z, ort);
+ player->TeleportTo(mapId, x, y, z, ort);
return true;
}
- static bool HandleGoTaxinodeCommand(ChatHandler* handler, const char* args)
+
+ static bool HandleGoTaxinodeCommand(ChatHandler* handler, char const* args)
{
- Player* _player = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetSession()->GetPlayer();
if (!*args)
return false;
- char* cNodeId = handler->extractKeyFromLink((char*)args, "Htaxinode");
- if (!cNodeId)
+ char* id = handler->extractKeyFromLink((char*)args, "Htaxinode");
+ if (!id)
return false;
- int32 i_nodeId = atoi(cNodeId);
- if (!i_nodeId)
+ int32 nodeId = atoi(id);
+ if (!nodeId)
return false;
- TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i_nodeId);
+ TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(nodeId);
if (!node)
{
- handler->PSendSysMessage(LANG_COMMAND_GOTAXINODENOTFOUND, i_nodeId);
+ handler->PSendSysMessage(LANG_COMMAND_GOTAXINODENOTFOUND, nodeId);
handler->SetSentErrorMessage(true);
return false;
}
@@ -349,38 +344,39 @@ public:
}
// stop flight if need
- if (_player->isInFlight())
+ if (player->isInFlight())
{
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
}
// save only in non-flight case
else
- _player->SaveRecallPosition();
+ player->SaveRecallPosition();
- _player->TeleportTo(node->map_id, node->x, node->y, node->z, _player->GetOrientation());
+ player->TeleportTo(node->map_id, node->x, node->y, node->z, player->GetOrientation());
return true;
}
- static bool HandleGoTriggerCommand(ChatHandler* handler, const char* args)
+
+ static bool HandleGoTriggerCommand(ChatHandler* handler, char const* args)
{
- Player* _player = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetSession()->GetPlayer();
if (!*args)
return false;
- char *atId = strtok((char*)args, " ");
- if (!atId)
+ char* id = strtok((char*)args, " ");
+ if (!id)
return false;
- int32 i_atId = atoi(atId);
+ int32 areaTriggerId = atoi(id);
- if (!i_atId)
+ if (!areaTriggerId)
return false;
- AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(i_atId);
+ AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(areaTriggerId);
if (!at)
{
- handler->PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, i_atId);
+ handler->PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, areaTriggerId);
handler->SetSentErrorMessage(true);
return false;
}
@@ -393,49 +389,50 @@ public:
}
// stop flight if need
- if (_player->isInFlight())
+ if (player->isInFlight())
{
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
}
// save only in non-flight case
else
- _player->SaveRecallPosition();
+ player->SaveRecallPosition();
- _player->TeleportTo(at->mapid, at->x, at->y, at->z, _player->GetOrientation());
+ player->TeleportTo(at->mapid, at->x, at->y, at->z, player->GetOrientation());
return true;
}
+
//teleport at coordinates
- static bool HandleGoZoneXYCommand(ChatHandler* handler, const char* args)
+ static bool HandleGoZoneXYCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- Player* _player = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetSession()->GetPlayer();
- char* px = strtok((char*)args, " ");
- char* py = strtok(NULL, " ");
+ char* zoneX = strtok((char*)args, " ");
+ char* zoneY = strtok(NULL, " ");
char* tail = strtok(NULL, "");
- char* cAreaId = handler->extractKeyFromLink(tail, "Harea"); // string or [name] Shift-click form |color|Harea:area_id|h[name]|h|r
+ char* id = handler->extractKeyFromLink(tail, "Harea"); // string or [name] Shift-click form |color|Harea:area_id|h[name]|h|r
- if (!px || !py)
+ if (!zoneX || !zoneY)
return false;
- float x = (float)atof(px);
- float y = (float)atof(py);
+ float x = (float)atof(zoneX);
+ float y = (float)atof(zoneY);
// prevent accept wrong numeric args
- if ((x == 0.0f && *px != '0') || (y == 0.0f && *py != '0'))
+ if ((x == 0.0f && *zoneX != '0') || (y == 0.0f && *zoneY != '0'))
return false;
- uint32 areaid = cAreaId ? (uint32)atoi(cAreaId) : _player->GetZoneId();
+ uint32 areaId = id ? (uint32)atoi(id) : player->GetZoneId();
- AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaid);
+ AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
if (x < 0 || x > 100 || y < 0 || y > 100 || !areaEntry)
{
- handler->PSendSysMessage(LANG_INVALID_ZONE_COORD, x, y, areaid);
+ handler->PSendSysMessage(LANG_INVALID_ZONE_COORD, x, y, areaId);
handler->SetSentErrorMessage(true);
return false;
}
@@ -462,99 +459,90 @@ public:
}
// stop flight if need
- if (_player->isInFlight())
+ if (player->isInFlight())
{
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
}
// save only in non-flight case
else
- _player->SaveRecallPosition();
+ player->SaveRecallPosition();
float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
- _player->TeleportTo(zoneEntry->mapid, x, y, z, _player->GetOrientation());
+ player->TeleportTo(zoneEntry->mapid, x, y, z, player->GetOrientation());
return true;
}
+
//teleport at coordinates, including Z and orientation
- static bool HandleGoXYZCommand(ChatHandler* handler, const char* args)
+ static bool HandleGoXYZCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- Player* _player = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetSession()->GetPlayer();
- char* px = strtok((char*)args, " ");
- char* py = strtok(NULL, " ");
- char* pz = strtok(NULL, " ");
- char* pmapid = strtok(NULL, " ");
+ char* goX = strtok((char*)args, " ");
+ char* goY = strtok(NULL, " ");
+ char* goZ = strtok(NULL, " ");
+ char* id = strtok(NULL, " ");
char* port = strtok(NULL, " ");
- if (!px || !py)
+ if (!goX || !goY)
return false;
- float x = (float)atof(px);
- float y = (float)atof(py);
+ float x = (float)atof(goX);
+ float y = (float)atof(goY);
float z;
- float ort;
- uint32 mapid;
-
- if (pmapid)
- mapid = (uint32)atoi(pmapid);
- else
- mapid = _player->GetMapId();
-
- if ( port )
- ort = (float)atof(port);
- else
- ort = _player->GetOrientation();
-
- if ( pz )
+ float ort = port ? (float)atof(port) : player->GetOrientation();
+ uint32 mapId = id ? (uint32)atoi(id) : player->GetMapId();
+
+ if (goZ)
{
- z = (float)atof(pz);
- if (!MapManager::IsValidMapCoord(mapid, x, y, z))
+ z = (float)atof(goZ);
+ if (!MapManager::IsValidMapCoord(mapId, x, y, z))
{
- handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapid);
+ handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId);
handler->SetSentErrorMessage(true);
return false;
}
}
else
{
- if (!MapManager::IsValidMapCoord(mapid, x, y))
+ if (!MapManager::IsValidMapCoord(mapId, x, y))
{
- handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapid);
+ handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId);
handler->SetSentErrorMessage(true);
return false;
}
- Map const* map = sMapMgr->CreateBaseMap(mapid);
+ Map const* map = sMapMgr->CreateBaseMap(mapId);
z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
}
// stop flight if need
- if (_player->isInFlight())
+ if (player->isInFlight())
{
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
}
// save only in non-flight case
else
- _player->SaveRecallPosition();
-
- _player->TeleportTo(mapid, x, y, z, ort);
+ player->SaveRecallPosition();
+ player->TeleportTo(mapId, x, y, z, ort);
return true;
}
- static bool HandleGoTicketCommand(ChatHandler* handler, const char* args)
+
+ static bool HandleGoTicketCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- char *sTicketId = strtok((char*)args, " ");
- if (!sTicketId)
+ char* id = strtok((char*)args, " ");
+ if (!id)
return false;
- uint32 ticketId = atoi(sTicketId);
+ uint32 ticketId = atoi(id);
if (!ticketId)
return false;
@@ -565,16 +553,16 @@ public:
return true;
}
- Player* _player = handler->GetSession()->GetPlayer();
- if (_player->isInFlight())
+ Player* player = handler->GetSession()->GetPlayer();
+ if (player->isInFlight())
{
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
}
else
- _player->SaveRecallPosition();
+ player->SaveRecallPosition();
- ticket->TeleportTo(_player);
+ ticket->TeleportTo(player);
return true;
}
};
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index f8e636fb961..4c9960992e1 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -69,35 +69,35 @@ public:
return commandTable;
}
- static bool HandleGameObjectActivateCommand(ChatHandler* handler, const char* args)
+ static bool HandleGameObjectActivateCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject");
- if (!cId)
+ char* id = handler->extractKeyFromLink((char*)args, "Hgameobject");
+ if (!id)
return false;
- uint32 lowguid = atoi(cId);
- if (!lowguid)
+ uint32 guidLow = atoi(id);
+ if (!guidLow)
return false;
- GameObject* obj = NULL;
+ GameObject* object = NULL;
// by DB guid
- if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid))
- obj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, go_data->id);
+ if (GameObjectData const* goData = sObjectMgr->GetGOData(guidLow))
+ object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, goData->id);
- if (!obj)
+ if (!object)
{
- handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
+ handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
handler->SetSentErrorMessage(true);
return false;
}
// Activate
- obj->SetLootState(GO_READY);
- obj->UseDoorOrButton(10000);
+ object->SetLootState(GO_READY);
+ object->UseDoorOrButton(10000);
handler->PSendSysMessage("Object activated!");
@@ -105,92 +105,92 @@ public:
}
//spawn go
- static bool HandleGameObjectAddCommand(ChatHandler* handler, const char* args)
+ static bool HandleGameObjectAddCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
// number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
- char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject_entry");
- if (!cId)
+ char* id = handler->extractKeyFromLink((char*)args, "Hgameobject_entry");
+ if (!id)
return false;
- uint32 id = atol(cId);
- if (!id)
+ uint32 objectId = atol(id);
+ if (!objectId)
return false;
char* spawntimeSecs = strtok(NULL, " ");
- const GameObjectTemplate* gInfo = sObjectMgr->GetGameObjectTemplate(id);
+ const GameObjectTemplate* objectInfo = sObjectMgr->GetGameObjectTemplate(objectId);
- if (!gInfo)
+ if (!objectInfo)
{
- handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, id);
+ handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, objectId);
handler->SetSentErrorMessage(true);
return false;
}
- if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId))
+ if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId))
{
// report to DB errors log as in loading case
- sLog->outErrorDb("Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", id, gInfo->type, gInfo->displayId);
- handler->PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, id);
+ sLog->outErrorDb("Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", objectId, objectInfo->type, objectInfo->displayId);
+ handler->PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, objectId);
handler->SetSentErrorMessage(true);
return false;
}
- Player* chr = handler->GetSession()->GetPlayer();
- float x = float(chr->GetPositionX());
- float y = float(chr->GetPositionY());
- float z = float(chr->GetPositionZ());
- float o = float(chr->GetOrientation());
- Map* map = chr->GetMap();
+ Player* player = handler->GetSession()->GetPlayer();
+ float x = float(player->GetPositionX());
+ float y = float(player->GetPositionY());
+ float z = float(player->GetPositionZ());
+ float o = float(player->GetOrientation());
+ Map* map = player->GetMap();
- GameObject* pGameObj = new GameObject;
- uint32 db_lowGUID = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT);
+ GameObject* object = new GameObject;
+ uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT);
- if (!pGameObj->Create(db_lowGUID, gInfo->entry, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
+ if (!object->Create(guidLow, objectInfo->entry, map, player->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
{
- delete pGameObj;
+ delete object;
return false;
}
if (spawntimeSecs)
{
uint32 value = atoi((char*)spawntimeSecs);
- pGameObj->SetRespawnTime(value);
- //sLog->outDebug(LOG_FILTER_TSCR, "*** spawntimeSecs: %d", value);
+ object->SetRespawnTime(value);
}
// fill the gameobject data and save to the db
- pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
+ object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), player->GetPhaseMaskForSpawn());
// this will generate a new guid if the object is in an instance
- if (!pGameObj->LoadFromDB(db_lowGUID, map))
+ if (!object->LoadFromDB(guidLow, map))
{
- delete pGameObj;
+ delete object;
return false;
}
- map->Add(pGameObj);
+ map->AddToMap(object);
// TODO: is it really necessary to add both the real and DB table guid here ?
- sObjectMgr->AddGameobjectToGrid(db_lowGUID, sObjectMgr->GetGOData(db_lowGUID));
+ sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow));
- handler->PSendSysMessage(LANG_GAMEOBJECT_ADD, id, gInfo->name.c_str(), db_lowGUID, x, y, z);
+ handler->PSendSysMessage(LANG_GAMEOBJECT_ADD, objectId, objectInfo->name.c_str(), guidLow, x, y, z);
return true;
}
// add go, temp only
- static bool HandleGameObjectAddTempCommand(ChatHandler* handler, const char* args)
+ static bool HandleGameObjectAddTempCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- char* charID = strtok((char*)args, " ");
- if (!charID)
+
+ char* id = strtok((char*)args, " ");
+ if (!id)
return false;
- Player* chr = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetSession()->GetPlayer();
char* spawntime = strtok(NULL, " ");
uint32 spawntm = 300;
@@ -198,46 +198,47 @@ public:
if (spawntime)
spawntm = atoi((char*)spawntime);
- float x = chr->GetPositionX();
- float y = chr->GetPositionY();
- float z = chr->GetPositionZ();
- float ang = chr->GetOrientation();
+ float x = player->GetPositionX();
+ float y = player->GetPositionY();
+ float z = player->GetPositionZ();
+ float ang = player->GetOrientation();
float rot2 = sin(ang/2);
float rot3 = cos(ang/2);
- uint32 id = atoi(charID);
+ uint32 objectId = atoi(id);
- chr->SummonGameObject(id, x, y, z, ang, 0, 0, rot2, rot3, spawntm);
+ player->SummonGameObject(objectId, x, y, z, ang, 0, 0, rot2, rot3, spawntm);
return true;
}
- static bool HandleGameObjectTargetCommand(ChatHandler* handler, const char* args)
+ static bool HandleGameObjectTargetCommand(ChatHandler* handler, char const* args)
{
- Player* pl = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetSession()->GetPlayer();
QueryResult result;
GameEventMgr::ActiveEvents const& activeEventsList = sGameEventMgr->GetActiveEventList();
+
if (*args)
{
// number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
- char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject_entry");
- if (!cId)
+ char* id = handler->extractKeyFromLink((char*)args, "Hgameobject_entry");
+ if (!id)
return false;
- uint32 id = atol(cId);
+ uint32 objectId = atol(id);
- if (id)
+ if (objectId)
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);
+ player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), objectId);
else
{
- std::string name = cId;
+ std::string name = id;
WorldDatabase.EscapeString(name);
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, gameobject_template WHERE gameobject_template.entry = gameobject.id AND map = %i AND name "_LIKE_" "_CONCAT3_("'%%'", "'%s'", "'%%'")" ORDER BY order_ ASC LIMIT 1",
- pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(), name.c_str());
+ player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), name.c_str());
}
}
else
@@ -250,8 +251,8 @@ public:
{
if (initString)
{
- eventFilter << "OR eventEntry IN (" <<*itr;
- initString =false;
+ eventFilter << "OR eventEntry IN (" << *itr;
+ initString = false;
}
else
eventFilter << ',' << *itr;
@@ -277,25 +278,25 @@ public:
bool found = false;
float x, y, z, o;
- uint32 lowguid, id;
- uint16 mapid, phase;
- uint32 pool_id;
+ uint32 guidLow, id;
+ uint16 mapId, phase;
+ uint32 poolId;
do
{
Field* fields = result->Fetch();
- lowguid = fields[0].GetUInt32();
+ guidLow = fields[0].GetUInt32();
id = fields[1].GetUInt32();
x = fields[2].GetFloat();
y = fields[3].GetFloat();
z = fields[4].GetFloat();
o = fields[5].GetFloat();
- mapid = fields[6].GetUInt16();
+ mapId = fields[6].GetUInt16();
phase = fields[7].GetUInt16();
- pool_id = sPoolMgr->IsPartOfAPool<GameObject>(lowguid);
- if (!pool_id || sPoolMgr->IsSpawnedObject<GameObject>(lowguid))
+ poolId = sPoolMgr->IsPartOfAPool<GameObject>(guidLow);
+ if (!poolId || sPoolMgr->IsSpawnedObject<GameObject>(guidLow))
found = true;
- } while (result->NextRow() && (!found));
+ } while (result->NextRow() && !found);
if (!found)
{
@@ -303,21 +304,21 @@ public:
return false;
}
- GameObjectTemplate const* goI = sObjectMgr->GetGameObjectTemplate(id);
+ GameObjectTemplate const* objectInfo = sObjectMgr->GetGameObjectTemplate(id);
- if (!goI)
+ if (!objectInfo)
{
handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, id);
return false;
}
- GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid, id, HIGHGUID_GAMEOBJECT));
+ GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(MAKE_NEW_GUID(guidLow, id, HIGHGUID_GAMEOBJECT));
- handler->PSendSysMessage(LANG_GAMEOBJECT_DETAIL, lowguid, goI->name.c_str(), lowguid, id, x, y, z, mapid, o, phase);
+ handler->PSendSysMessage(LANG_GAMEOBJECT_DETAIL, guidLow, objectInfo->name.c_str(), guidLow, id, x, y, z, mapId, o, phase);
if (target)
{
- int32 curRespawnDelay = int32(target->GetRespawnTimeEx()-time(NULL));
+ int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - time(NULL));
if (curRespawnDelay < 0)
curRespawnDelay = 0;
@@ -330,219 +331,217 @@ public:
}
//delete object by selection or guid
- static bool HandleGameObjectDeleteCommand(ChatHandler* handler, const char* args)
+ static bool HandleGameObjectDeleteCommand(ChatHandler* handler, char const* args)
{
// number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r
- char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject");
- if (!cId)
+ char* id = handler->extractKeyFromLink((char*)args, "Hgameobject");
+ if (!id)
return false;
- uint32 lowguid = atoi(cId);
- if (!lowguid)
+ uint32 guidLow = atoi(id);
+ if (!guidLow)
return false;
- GameObject* obj = NULL;
+ GameObject* object = NULL;
// by DB guid
- if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid))
- obj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, go_data->id);
+ if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
+ object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
- if (!obj)
+ if (!object)
{
- handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
+ handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
handler->SetSentErrorMessage(true);
return false;
}
- uint64 owner_guid = obj->GetOwnerGUID();
- if (owner_guid)
+ uint64 ownerGuid = object->GetOwnerGUID();
+ if (ownerGuid)
{
- Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), owner_guid);
- if (!owner || !IS_PLAYER_GUID(owner_guid))
+ Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), ownerGuid);
+ if (!owner || !IS_PLAYER_GUID(ownerGuid))
{
- handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(owner_guid), obj->GetGUIDLow());
+ handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(ownerGuid), object->GetGUIDLow());
handler->SetSentErrorMessage(true);
return false;
}
- owner->RemoveGameObject(obj, false);
+ owner->RemoveGameObject(object, false);
}
- obj->SetRespawnTime(0); // not save respawn time
- obj->Delete();
- obj->DeleteFromDB();
+ object->SetRespawnTime(0); // not save respawn time
+ object->Delete();
+ object->DeleteFromDB();
- handler->PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, obj->GetGUIDLow());
+ handler->PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, object->GetGUIDLow());
return true;
}
//turn selected object
- static bool HandleGameObjectTurnCommand(ChatHandler* handler, const char* args)
+ static bool HandleGameObjectTurnCommand(ChatHandler* handler, char const* args)
{
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
- char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject");
- if (!cId)
+ char* id = handler->extractKeyFromLink((char*)args, "Hgameobject");
+ if (!id)
return false;
- uint32 lowguid = atoi(cId);
- if (!lowguid)
+ uint32 guidLow = atoi(id);
+ if (!guidLow)
return false;
- GameObject* obj = NULL;
+ GameObject* object = NULL;
// by DB guid
- if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid))
- obj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, go_data->id);
+ if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
+ object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
- if (!obj)
+ if (!object)
{
- handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
+ handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
handler->SetSentErrorMessage(true);
return false;
}
- char* po = strtok(NULL, " ");
+ char* orientation = strtok(NULL, " ");
float o;
- if (po)
- {
- o = (float)atof(po);
- }
+ if (orientation)
+ o = (float)atof(orientation);
else
{
- Player* chr = handler->GetSession()->GetPlayer();
- o = chr->GetOrientation();
+ Player* player = handler->GetSession()->GetPlayer();
+ o = player->GetOrientation();
}
- obj->Relocate(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), o);
- obj->UpdateRotationFields();
- obj->DestroyForNearbyPlayers();
- obj->UpdateObjectVisibility();
+ object->Relocate(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), o);
+ object->UpdateRotationFields();
+ object->DestroyForNearbyPlayers();
+ object->UpdateObjectVisibility();
- obj->SaveToDB();
- obj->Refresh();
+ object->SaveToDB();
+ object->Refresh();
- handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, obj->GetGUIDLow(), obj->GetGOInfo()->name.c_str(), obj->GetGUIDLow(), o);
+ handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, object->GetGUIDLow(), object->GetGOInfo()->name.c_str(), object->GetGUIDLow(), o);
return true;
}
//move selected object
- static bool HandleGameObjectMoveCommand(ChatHandler* handler, const char* args)
+ static bool HandleGameObjectMoveCommand(ChatHandler* handler, char const* args)
{
// number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r
- char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject");
- if (!cId)
+ char* id = handler->extractKeyFromLink((char*)args, "Hgameobject");
+ if (!id)
return false;
- uint32 lowguid = atoi(cId);
- if (!lowguid)
+ uint32 guidLow = atoi(id);
+ if (!guidLow)
return false;
- GameObject* obj = NULL;
+ GameObject* object = NULL;
// by DB guid
- if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid))
- obj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, go_data->id);
+ if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
+ object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
- if (!obj)
+ if (!object)
{
- handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
+ handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
handler->SetSentErrorMessage(true);
return false;
}
- char* px = strtok(NULL, " ");
- char* py = strtok(NULL, " ");
- char* pz = strtok(NULL, " ");
+ char* toX = strtok(NULL, " ");
+ char* toY = strtok(NULL, " ");
+ char* toZ = strtok(NULL, " ");
- if (!px)
+ if (!toX)
{
- Player* chr = handler->GetSession()->GetPlayer();
- obj->Relocate(chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), obj->GetOrientation());
- obj->DestroyForNearbyPlayers();
- obj->UpdateObjectVisibility();
+ Player* player = handler->GetSession()->GetPlayer();
+ object->Relocate(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), object->GetOrientation());
+ object->DestroyForNearbyPlayers();
+ object->UpdateObjectVisibility();
}
else
{
- if (!py || !pz)
+ if (!toY || !toZ)
return false;
- float x = (float)atof(px);
- float y = (float)atof(py);
- float z = (float)atof(pz);
+ float x = (float)atof(toX);
+ float y = (float)atof(toY);
+ float z = (float)atof(toZ);
- if (!MapManager::IsValidMapCoord(obj->GetMapId(), x, y, z))
+ if (!MapManager::IsValidMapCoord(object->GetMapId(), x, y, z))
{
- handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, obj->GetMapId());
+ handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, object->GetMapId());
handler->SetSentErrorMessage(true);
return false;
}
- obj->Relocate(x, y, z, obj->GetOrientation());
- obj->DestroyForNearbyPlayers();
- obj->UpdateObjectVisibility();
+ object->Relocate(x, y, z, object->GetOrientation());
+ object->DestroyForNearbyPlayers();
+ object->UpdateObjectVisibility();
}
- obj->SaveToDB();
- obj->Refresh();
+ object->SaveToDB();
+ object->Refresh();
- handler->PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, obj->GetGUIDLow(), obj->GetGOInfo()->name.c_str(), obj->GetGUIDLow());
+ handler->PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, object->GetGUIDLow(), object->GetGOInfo()->name.c_str(), object->GetGUIDLow());
return true;
}
- //set pahsemask for selected object
- static bool HandleGameObjectSetPhaseCommand(ChatHandler* handler, const char* args)
+ //set phasemask for selected object
+ static bool HandleGameObjectSetPhaseCommand(ChatHandler* handler, char const* args)
{
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
- char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject");
- if (!cId)
+ char* id = handler->extractKeyFromLink((char*)args, "Hgameobject");
+ if (!id)
return false;
- uint32 lowguid = atoi(cId);
- if (!lowguid)
+ uint32 guidLow = atoi(id);
+ if (!guidLow)
return false;
- GameObject* obj = NULL;
+ GameObject* object = NULL;
// by DB guid
- if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid))
- obj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, go_data->id);
+ if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
+ object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
- if (!obj)
+ if (!object)
{
- handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
+ handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
handler->SetSentErrorMessage(true);
return false;
}
- char* phaseStr = strtok (NULL, " ");
- uint32 phasemask = phaseStr? atoi(phaseStr) : 0;
- if (phasemask == 0)
+ char* phase = strtok (NULL, " ");
+ uint32 phaseMask = phase ? atoi(phase) : 0;
+ if (phaseMask == 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
return false;
}
- obj->SetPhaseMask(phasemask, true);
- obj->SaveToDB();
+ object->SetPhaseMask(phaseMask, true);
+ object->SaveToDB();
return true;
}
- static bool HandleGameObjectNearCommand(ChatHandler* handler, const char* args)
+ static bool HandleGameObjectNearCommand(ChatHandler* handler, char const* args)
{
float distance = (!*args) ? 10.0f : (float)(atof(args));
uint32 count = 0;
- Player* pl = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetSession()->GetPlayer();
QueryResult result = WorldDatabase.PQuery("SELECT guid, id, 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 map='%u' AND (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) <= '%f' ORDER BY order_",
- pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(),
- pl->GetMapId(), pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), distance*distance);
+ player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(),
+ player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), distance * distance);
if (result)
{
@@ -554,14 +553,14 @@ public:
float x = fields[2].GetFloat();
float y = fields[3].GetFloat();
float z = fields[4].GetFloat();
- uint16 mapid = fields[5].GetUInt16();
+ uint16 mapId = fields[5].GetUInt16();
- GameObjectTemplate const* gInfo = sObjectMgr->GetGameObjectTemplate(entry);
+ GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate(entry);
- if (!gInfo)
+ if (!gameObjectInfo)
continue;
- handler->PSendSysMessage(LANG_GO_LIST_CHAT, guid, entry, guid, gInfo->name.c_str(), x, y, z, mapid);
+ handler->PSendSysMessage(LANG_GO_LIST_CHAT, guid, entry, guid, gameObjectInfo->name.c_str(), x, y, z, mapId);
++count;
} while (result->NextRow());
@@ -572,99 +571,97 @@ public:
}
//show info of gameobject
- static bool HandleGameObjectInfoCommand(ChatHandler* handler, const char* args)
+ static bool HandleGameObjectInfoCommand(ChatHandler* handler, char const* args)
{
uint32 entry = 0;
uint32 type = 0;
- uint32 displayid = 0;
+ uint32 displayId = 0;
std::string name;
uint32 lootId = 0;
if (!*args)
{
- if (WorldObject* obj = handler->getSelectedObject())
- entry = obj->GetEntry();
+ if (WorldObject* object = handler->getSelectedObject())
+ entry = object->GetEntry();
else
entry = atoi((char*)args);
}
- GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
+ GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate(entry);
- if (!goinfo)
+ if (!gameObjectInfo)
return false;
- type = goinfo->type;
- displayid = goinfo->displayId;
- name = goinfo->name;
+ type = gameObjectInfo->type;
+ displayId = gameObjectInfo->displayId;
+ name = gameObjectInfo->name;
if (type == GAMEOBJECT_TYPE_CHEST)
- lootId = goinfo->chest.lootId;
+ lootId = gameObjectInfo->chest.lootId;
else if (type == GAMEOBJECT_TYPE_FISHINGHOLE)
- lootId = goinfo->fishinghole.lootId;
+ lootId = gameObjectInfo->fishinghole.lootId;
handler->PSendSysMessage(LANG_GOINFO_ENTRY, entry);
handler->PSendSysMessage(LANG_GOINFO_TYPE, type);
handler->PSendSysMessage(LANG_GOINFO_LOOTID, lootId);
- handler->PSendSysMessage(LANG_GOINFO_DISPLAYID, displayid);
+ handler->PSendSysMessage(LANG_GOINFO_DISPLAYID, displayId);
handler->PSendSysMessage(LANG_GOINFO_NAME, name.c_str());
return true;
}
- static bool HandleGameObjectSetStateCommand(ChatHandler* handler, const char* args)
+ static bool HandleGameObjectSetStateCommand(ChatHandler* handler, char const* args)
{
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
- char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject");
- if (!cId)
+ char* id = handler->extractKeyFromLink((char*)args, "Hgameobject");
+ if (!id)
return false;
- uint32 lowguid = atoi(cId);
- if (!lowguid)
+ uint32 guidLow = atoi(id);
+ if (!guidLow)
return false;
- GameObject* gobj = NULL;
+ GameObject* object = NULL;
- if (GameObjectData const* goData = sObjectMgr->GetGOData(lowguid))
- gobj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, goData->id);
+ if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
+ object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
- if (!gobj)
+ if (!object)
{
- handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
+ handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
handler->SetSentErrorMessage(true);
return false;
}
- char* ctype = strtok(NULL, " ");
- if (!ctype)
+ char* type = strtok(NULL, " ");
+ if (!type)
return false;
- int32 type = atoi(ctype);
- if (type < 0)
+ int32 objectType = atoi(type);
+ if (objectType < 0)
{
- if (type == -1)
- gobj->SendObjectDeSpawnAnim(gobj->GetGUID());
- else if (type == -2)
- {
+ if (objectType == -1)
+ object->SendObjectDeSpawnAnim(object->GetGUID());
+ else if (objectType == -2)
return false;
- }
return true;
}
- char* cstate = strtok(NULL, " ");
- if (!cstate)
+ char* state = strtok(NULL, " ");
+ if (!state)
return false;
- int32 state = atoi(cstate);
+ int32 objectState = atoi(state);
- if (type < 4)
- gobj->SetByteValue(GAMEOBJECT_BYTES_1, type, state);
- else if (type == 4)
+ if (objectType < 4)
+ object->SetByteValue(GAMEOBJECT_BYTES_1, objectType, objectState);
+ else if (objectType == 4)
{
WorldPacket data(SMSG_GAMEOBJECT_CUSTOM_ANIM, 8+4);
- data << gobj->GetGUID();
- data << (uint32)(state);
- gobj->SendMessageToSet(&data, true);
+ data << object->GetGUID();
+ data << (uint32)(objectState);
+ object->SendMessageToSet(&data, true);
}
- handler->PSendSysMessage("Set gobject type %d state %d", type, state);
+ handler->PSendSysMessage("Set gobject type %d state %d", objectType, objectState);
return true;
}
};
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index cdb87fde354..0fecfa83221 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -149,7 +149,7 @@ public:
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
creature->LoadFromDB(db_guid, map);
- map->Add(creature);
+ map->AddToMap(creature);
sObjectMgr->AddCreatureToGrid(db_guid, sObjectMgr->GetCreatureData(db_guid));
return true;
}
@@ -623,7 +623,7 @@ public:
const_cast<CreatureData*>(data)->posZ = z;
const_cast<CreatureData*>(data)->orientation = o;
}
- creature->GetMap()->CreatureRelocation(creature, x, y, z, o);
+ creature->SetPosition(x, y, z, o);
creature->GetMotionMaster()->Initialize();
if (creature->isAlive()) // dead creature will reset movement generator at respawn
{
@@ -1142,7 +1142,7 @@ public:
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
// add to world
- pet->GetMap()->Add(pet->ToCreature());
+ pet->GetMap()->AddToMap(pet->ToCreature());
// visual effect for levelup
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level);
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index 34ea264fd9e..75904764f23 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -591,7 +591,7 @@ public:
wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
wpCreature2->LoadFromDB(wpCreature2->GetDBTableGUIDLow(), map);
- map->Add(wpCreature2);
+ map->AddToMap(wpCreature2);
//sMapMgr->GetMap(npcCreature->GetMapId())->Add(wpCreature2);
}
@@ -790,7 +790,7 @@ public:
wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
wpCreature->LoadFromDB(wpCreature->GetDBTableGUIDLow(), map);
- map->Add(wpCreature);
+ map->AddToMap(wpCreature);
if (target)
{
@@ -837,7 +837,7 @@ public:
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
creature->LoadFromDB(creature->GetDBTableGUIDLow(), map);
- map->Add(creature);
+ map->AddToMap(creature);
if (target)
{
@@ -885,7 +885,7 @@ public:
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
creature->LoadFromDB(creature->GetDBTableGUIDLow(), map);
- map->Add(creature);
+ map->AddToMap(creature);
if (target)
{
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
index ce4a2a10cac..c64fc6f2dab 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
@@ -206,7 +206,7 @@ public:
{
float x = KaelLocations[0][0];
float y = KaelLocations[0][1];
- me->GetMap()->CreatureRelocation(me, x, y, LOCATION_Z, 0.0f);
+ me->SetPosition(x, y, LOCATION_Z, 0.0f);
//me->SendMonsterMove(x, y, LOCATION_Z, 0, 0, 0); // causes some issues...
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp
index e6610294071..a61b88a990d 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp
@@ -53,7 +53,7 @@ public:
me->GetPosition(x, y, z);
z += 4; x -= 3.5; y -= 5;
me->GetMotionMaster()->Clear(false);
- me->GetMap()->CreatureRelocation(me, x, y, z, 0.0f);
+ me->SetPosition(x, y, z, 0.0f);
}
void UpdateAI(const uint32 diff)
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
index 667e1cd279e..9afbeaa0172 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
@@ -756,7 +756,7 @@ public:
{
float x, y, z;
me->GetPosition(x, y, z); //this visual aura some under ground
- me->GetMap()->CreatureRelocation(me, x, y, z + 0.35f, 0.0f);
+ me->SetPosition(x, y, z + 0.35f, 0.0f);
Despawn();
Creature* debuff = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 14500);
if (debuff)
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
index 2e4e92685ea..df3bb5d4525 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -661,7 +661,7 @@ public:
void JustDied(Unit* /*killer*/)
{
DoScriptText(SAY_SATH_DEATH, me);
- me->GetMap()->CreatureRelocation(me, me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation());
+ me->SetPosition(me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation());
TeleportAllPlayersBack();
if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID))
{
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
index d4d4e7314b4..162c84f1fa7 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
@@ -335,7 +335,7 @@ class boss_hexlord_malacrass : public CreatureScript
else
{
creature->AI()->EnterEvadeMode();
- creature->GetMap()->CreatureRelocation(me, Pos_X[i], POS_Y, POS_Z, ORIENT);
+ creature->SetPosition(Pos_X[i], POS_Y, POS_Z, ORIENT);
creature->StopMoving();
}
}
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
index b9ae61c122e..f6704a50e6f 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
@@ -185,7 +185,7 @@ class boss_marli : public CreatureScript
if (target)
{
DoCast(target, SPELL_CHARGE);
- //me->GetMap()->CreatureRelocation(me, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
+ //me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
//me->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true, 1);
AttackStart(target);
}
diff --git a/src/server/scripts/EasternKingdoms/undercity.cpp b/src/server/scripts/EasternKingdoms/undercity.cpp
index 042c8f695c7..b8f2499c4e6 100644
--- a/src/server/scripts/EasternKingdoms/undercity.cpp
+++ b/src/server/scripts/EasternKingdoms/undercity.cpp
@@ -107,10 +107,10 @@ public:
{
if (summoned->GetEntry() == ENTRY_HIGHBORNE_BUNNY)
{
- if (Unit* target = Unit::GetUnit(*summoned, targetGUID))
+ if (Creature* target = Unit::GetCreature(*summoned, targetGUID))
{
target->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0);
- target->GetMap()->CreatureRelocation(me, target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f);
+ target->SetPosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f);
summoned->CastSpell(target, SPELL_RIBBON_OF_SOULS, false);
}
@@ -187,7 +187,7 @@ public:
{
me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
me->SendMonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, 5000);
- me->GetMap()->CreatureRelocation(me, me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetOrientation());
+ me->SetPosition(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetOrientation());
EventMove = false;
} else EventMove_Timer -= diff;
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
index ef75307c625..748d0dfa071 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
@@ -1202,7 +1202,7 @@ public:
me->GetPosition(x, y, z);
z = me->GetMap()->GetHeight(x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
- me->GetMap()->CreatureRelocation(me, x, y, z, 0);
+ me->SetPosition(x, y, z, 0);
}
void EnterCombat(Unit* /*who*/) {}
@@ -1321,7 +1321,7 @@ public:
me->GetPosition(x, y, z);
z = me->GetMap()->GetHeight(x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
- me->GetMap()->CreatureRelocation(me, x, y, z, 0);
+ me->SetPosition(x, y, z, 0);
hyjal_trashAI::JustDied(victim);
}
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
index dd2531d5aad..4cc1069b838 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
@@ -1073,7 +1073,7 @@ public:
if (!target->HasAura(SPELL_DIGESTIVE_ACID))
{
- me->GetMap()->CreatureRelocation(me, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
+ me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
{
pPortal->SetReactState(REACT_PASSIVE);
@@ -1185,7 +1185,7 @@ public:
if (!target->HasAura(SPELL_DIGESTIVE_ACID))
{
- me->GetMap()->CreatureRelocation(me, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
+ me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
if (Creature* pPortal = me->SummonCreature(MOB_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
{
pPortal->SetReactState(REACT_PASSIVE);
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
index b0033aa582a..0ba6bdb1154 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
@@ -157,15 +157,15 @@ public:
switch (urand(0, 2))
{
case 0:
- me->GetMap()->CreatureRelocation(me, -8340.782227f, 2083.814453f, 125.648788f, 0.0f);
+ me->SetPosition(-8340.782227f, 2083.814453f, 125.648788f, 0.0f);
DoResetThreat();
break;
case 1:
- me->GetMap()->CreatureRelocation(me, -8341.546875f, 2118.504639f, 133.058151f, 0.0f);
+ me->SetPosition(-8341.546875f, 2118.504639f, 133.058151f, 0.0f);
DoResetThreat();
break;
case 2:
- me->GetMap()->CreatureRelocation(me, -8318.822266f, 2058.231201f, 133.058151f, 0.0f);
+ me->SetPosition(-8318.822266f, 2058.231201f, 133.058151f, 0.0f);
DoResetThreat();
break;
}
@@ -252,7 +252,7 @@ public:
me->RemoveAllAuras();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetVisible(false);
- me->GetMap()->CreatureRelocation(me, bossc->x, bossc->y, bossc->z, bossc->r);
+ me->SetPosition(bossc->x, bossc->y, bossc->z, bossc->r);
Invisible = true;
DoResetThreat();
DoStopAttack();
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
index c501a060194..29b92957ace 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
@@ -216,15 +216,12 @@ struct boss_twinemperorsAI : public ScriptedAI
if (pOtherBoss)
{
//me->MonsterYell("Teleporting ...", LANG_UNIVERSAL, 0);
- float other_x = pOtherBoss->GetPositionX();
- float other_y = pOtherBoss->GetPositionY();
- float other_z = pOtherBoss->GetPositionZ();
- float other_o = pOtherBoss->GetOrientation();
-
- Map* thismap = me->GetMap();
- thismap->CreatureRelocation(pOtherBoss, me->GetPositionX(),
- me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
- thismap->CreatureRelocation(me, other_x, other_y, other_z, other_o);
+ Position thisPos;
+ thisPos.Relocate(me);
+ Position otherPos;
+ otherPos.Relocate(pOtherBoss);
+ pOtherBoss->SetPosition(thisPos);
+ me->SetPosition(otherPos);
SetAfterTeleport();
CAST_AI(boss_twinemperorsAI, pOtherBoss->AI())->SetAfterTeleport();
diff --git a/src/server/scripts/Kalimdor/azshara.cpp b/src/server/scripts/Kalimdor/azshara.cpp
index 88e46e7fb26..6fbc424f3d4 100644
--- a/src/server/scripts/Kalimdor/azshara.cpp
+++ b/src/server/scripts/Kalimdor/azshara.cpp
@@ -357,7 +357,7 @@ public:
Map* map = me->GetMap();
if (map)
{
- map->CreatureRelocation(me, 3706.39f, -3969.15f, 35.9118f, 0);
+ me->SetPosition(3706.39f, -3969.15f, 35.9118f, 0);
me->AI_SendMoveToPacket(3706.39f, -3969.15f, 35.9118f, 0, 0, 0);
}
//begin swimming and summon depth charges
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
index a6e3e78c96a..8e79bb185cf 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
@@ -78,6 +78,7 @@ enum Spells
// Slime Puddle
SPELL_GROW_STACKER = 70345,
+ SPELL_GROW = 70347,
SPELL_SLIME_PUDDLE_AURA = 70343,
// Gas Cloud
@@ -253,6 +254,9 @@ class boss_professor_putricide : public CreatureScript
case NPC_GROWING_OOZE_PUDDLE:
summon->CastSpell(summon, SPELL_GROW_STACKER, true);
summon->CastSpell(summon, SPELL_SLIME_PUDDLE_AURA, true);
+ // blizzard casts this spell 7 times initially (confirmed in sniff)
+ for (uint8 i = 0; i < 7; ++i)
+ summon->CastSpell(summon, SPELL_GROW, true);
break;
case NPC_GAS_CLOUD:
// no possible aura seen in sniff adding the aurastate
@@ -811,38 +815,45 @@ class spell_putricide_ooze_channel : public SpellScriptLoader
}
};
+class ExactDistanceCheck
+{
+ public:
+ ExactDistanceCheck(Unit* source, float dist) : _source(source), _dist(dist) {}
+
+ bool operator()(Unit* unit)
+ {
+ return _source->GetExactDist2d(unit) > _dist;
+ }
+
+ private:
+ Unit* _source;
+ float _dist;
+};
+
class spell_putricide_slime_puddle : public SpellScriptLoader
{
public:
spell_putricide_slime_puddle() : SpellScriptLoader("spell_putricide_slime_puddle") { }
- class spell_putricide_slime_puddle_AuraScript : public AuraScript
+ class spell_putricide_slime_puddle_SpellScript : public SpellScript
{
- PrepareAuraScript(spell_putricide_slime_puddle_AuraScript);
+ PrepareSpellScript(spell_putricide_slime_puddle_SpellScript);
- void HandleTriggerSpell(AuraEffect const* aurEff)
+ void ScaleRange(std::list<Unit*>& targets)
{
- PreventDefaultAction();
- if (Unit* caster = GetCaster())
- {
- int32 radiusMod = 4;
- if (Aura* size = caster->GetAura(70347))
- radiusMod += size->GetStackAmount();
-
- uint32 triggerSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
- caster->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, radiusMod * 100, caster, true);
- }
+ targets.remove_if(ExactDistanceCheck(GetCaster(), 2.5f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X)));
}
void Register()
{
- OnEffectPeriodic += AuraEffectPeriodicFn(spell_putricide_slime_puddle_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
+ OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
- AuraScript* GetAuraScript() const
+ SpellScript* GetSpellScript() const
{
- return new spell_putricide_slime_puddle_AuraScript();
+ return new spell_putricide_slime_puddle_SpellScript();
}
};
@@ -1047,7 +1058,6 @@ class spell_putricide_unbound_plague : public SpellScriptLoader
return;
uint32 plagueId = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE, GetCaster());
- uint32 searcherId = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE_SEARCHER, GetCaster());
if (!GetHitUnit()->HasAura(plagueId))
{
@@ -1057,10 +1067,10 @@ class spell_putricide_unbound_plague : public SpellScriptLoader
{
if (Aura* newPlague = professor->AddAura(plagueId, GetHitUnit()))
{
- newPlague->SetMaxDuration(oldPlague->GetDuration());
+ newPlague->SetMaxDuration(oldPlague->GetMaxDuration());
newPlague->SetDuration(oldPlague->GetDuration());
oldPlague->Remove();
- GetCaster()->RemoveAurasDueToSpell(searcherId);
+ GetCaster()->RemoveAurasDueToSpell(SPELL_UNBOUND_PLAGUE_SEARCHER);
GetCaster()->CastSpell(GetCaster(), SPELL_PLAGUE_SICKNESS, true);
GetCaster()->CastSpell(GetCaster(), SPELL_UNBOUND_PLAGUE_PROTECTION, true);
professor->CastSpell(GetHitUnit(), SPELL_UNBOUND_PLAGUE_SEARCHER, true);
@@ -1110,14 +1120,14 @@ class spell_putricide_eat_ooze : public SpellScriptLoader
if (Aura* grow = target->GetAura(uint32(GetEffectValue())))
{
- if (grow->GetStackAmount() < 4)
+ if (grow->GetStackAmount() < 3)
{
target->RemoveAurasDueToSpell(SPELL_GROW_STACKER);
target->RemoveAura(grow);
- target->DespawnOrUnsummon();
+ target->DespawnOrUnsummon(1);
}
else
- grow->ModStackAmount(-4);
+ grow->ModStackAmount(-3);
}
}
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
index 09fe37d140c..4d4b8e90e7b 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
@@ -86,6 +86,7 @@ public:
return true;
}
+ //TODO: this should be handled in map, maybe add a summon function in map
// There is no other way afaik...
void SpawnGameObject(uint32 entry, Position& pos)
{
@@ -98,7 +99,7 @@ public:
return;
}
- instance->Add(go);
+ instance->AddToMap(go);
}
void OnGameObjectCreate(GameObject* go)
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
index 1c7b538eb02..a8edd40d6b5 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
@@ -238,7 +238,7 @@ public:
for (uint8 n = 0; n < 3; ++n)
time[n] = 0;
me->GetMotionMaster()->Clear();
- me->GetMap()->CreatureRelocation(me, CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation());
+ me->SetPosition(CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation());
DoCast(me, SPELL_TELESTRA_BACK);
me->SetVisible(true);
if (Phase == 1)
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp
index ec336d3402c..ad79d1b56cc 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp
@@ -757,7 +757,7 @@ class boss_flame_leviathan_safety_container : public CreatureScript
me->GetPosition(x, y, z);
z = me->GetMap()->GetHeight(x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
- me->GetMap()->CreatureRelocation(me, x, y, z, 0);
+ me->SetPosition(x, y, z, 0);
}
void UpdateAI(uint32 const /*diff*/)
@@ -1680,7 +1680,8 @@ class spell_pursue : public SpellScriptLoader
void FilterTargetsSubsequently(std::list<Unit*>& targets)
{
targets.clear();
- targets.push_back(_target);
+ if(_target)
+ targets.push_back(_target);
}
void HandleScript(SpellEffIndex /*eff*/)
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
index 41d43a08f5d..41e80b1b777 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
@@ -260,7 +260,7 @@ class mob_frozen_orb_stalker : public CreatureScript
{
Position pos;
me->GetNearPoint(toravon, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 10.0f, 0.0f);
- me->SetPosition(pos, true);
+ me->SetPosition(pos);
DoCast(me, SPELL_FROZEN_ORB_SUMMON);
}
}
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
index 7727f761588..23477741ba1 100755
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
@@ -170,7 +170,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
else
{
go->SetRespawnTime(0);
- map->Add(go);
+ map->AddToMap(go);
}
}
}
@@ -199,7 +199,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
else
{
go->SetRespawnTime(0);
- map->Add(go);
+ map->AddToMap(go);
}
}
}
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
index 9b985d6d93e..6d3a5f181d4 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
@@ -291,7 +291,7 @@ public:
if (i_pl->isAlive() && !i_pl->HasAura(SPELL_BANISH))
i_pl->TeleportTo(me->GetMapId(), VorpilPosition[0], VorpilPosition[1], VorpilPosition[2], 0, TELE_TO_NOT_LEAVE_COMBAT);
- me->GetMap()->CreatureRelocation(me, VorpilPosition[0], VorpilPosition[1], VorpilPosition[2], 0.0f);
+ me->SetPosition(VorpilPosition[0], VorpilPosition[1], VorpilPosition[2], 0.0f);
DoCast(me, SPELL_DRAW_SHADOWS, true);
DoCast(me, SPELL_RAIN_OF_FIRE);
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
index 60845ae6365..aec9ffcf5cc 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
@@ -1967,7 +1967,7 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::HandleTalkSequence()
Summons.DespawnAll();
break;
case 17:
- if (GETUNIT(Akama, AkamaGUID))
+ if (GETCRE(Akama, AkamaGUID))
{
if (!me->IsWithinDistInMap(Akama, 15))
{
@@ -1976,7 +1976,7 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::HandleTalkSequence()
x += 10; y += 10;
Akama->GetMotionMaster()->Clear(false);
//Akama->GetMotionMaster()->MoveIdle();
- Akama->GetMap()->CreatureRelocation(me, x, y, z, 0.0f);
+ Akama->SetPosition(x, y, z, 0.0f);
Akama->SendMonsterMove(x, y, z, 0, MOVEMENTFLAG_NONE, 0);//Illidan must not die until Akama arrives.
Akama->GetMotionMaster()->MoveChase(me);
}
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
index 19280bd71f5..dcbc2832f27 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
@@ -291,7 +291,7 @@ class boss_alar : public CreatureScript
if (me->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f))
dist = 5.0f;
WaitTimer = 1000 + uint32(floor(dist / 80 * 1000.0f));
- me->GetMap()->CreatureRelocation(me, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f);
+ me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f);
me->StopMoving();
WaitEvent = WE_LAND;
}
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
index f079f68d943..6fac13aa8ad 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
@@ -278,7 +278,7 @@ class boss_high_astromancer_solarian : public CreatureScript
Phase1_Timer = 50000;
//After these 50 seconds she portals to the middle of the room and disappears, leaving 3 light portals behind.
me->GetMotionMaster()->Clear();
- me->GetMap()->CreatureRelocation(me, CENTER_X, CENTER_Y, CENTER_Z, CENTER_O);
+ me->SetPosition(CENTER_X, CENTER_Y, CENTER_Z, CENTER_O);
for (uint8 i=0; i <= 2; ++i)
{
if (!i)
@@ -346,7 +346,7 @@ class boss_high_astromancer_solarian : public CreatureScript
//15 seconds later Solarian reappears out of one of the 3 portals. Simultaneously, 2 healers appear in the two other portals.
int i = rand()%3;
me->GetMotionMaster()->Clear();
- me->GetMap()->CreatureRelocation(me, Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O);
+ me->SetPosition(Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O);
for (int j=0; j <= 2; j++)
if (j != i)
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
index 52a23196ee0..d987601c5bd 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
@@ -819,7 +819,7 @@ class boss_kaelthas : public CreatureScript
me->StopMoving();
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
- me->GetMap()->CreatureRelocation(me, afGravityPos[0], afGravityPos[1], afGravityPos[2], 0);
+ me->SetPosition(afGravityPos[0], afGravityPos[1], afGravityPos[2], 0);
me->SendMonsterMove(afGravityPos[0], afGravityPos[1], afGravityPos[2], 0, 0, 0);
me->InterruptNonMeleeSpells(false);
@@ -886,7 +886,7 @@ class boss_kaelthas : public CreatureScript
me->StopMoving();
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
- me->GetMap()->CreatureRelocation(me, afGravityPos[0], afGravityPos[1], afGravityPos[2], 0);
+ me->SetPosition(afGravityPos[0], afGravityPos[1], afGravityPos[2], 0);
me->SendMonsterMove(afGravityPos[0], afGravityPos[1], afGravityPos[2], 0, MOVEMENTFLAG_NONE, 0);
// 1) Kael'thas will portal the whole raid right into his body