fix(Core/Creature): Use proper name for wander distance (#2858)

* Change from spawndist to wander_distance

Co-Authored-By: ratkosrb <ratkosrb@users.noreply.github.com>

* fix sql error

Co-Authored-By: ratkosrb <ratkosrb@users.noreply.github.com>

* Let's see if this fixes eluna :)

* Revert "Let's see if this fixes eluna :)"

This reverts commit be675bf83fc6a02f3347ea76408152d623d374bf.

* fix indent

* Revert "fix indent"

This reverts commit f4cb3d2d9fa908445d342b6f2e6dda9d52fd4665.

* Revert "Revert "fix indent""

This reverts commit 48527cfd2f9031f95bdf6e0d7b90111a3c0dc0f2.

Co-authored-by: ratkosrb <ratkosrb@users.noreply.github.com>
This commit is contained in:
Kitzunu
2020-04-11 11:20:02 +02:00
committed by GitHub
parent 50287c05f0
commit 8a1eab2c23
14 changed files with 75 additions and 64 deletions

View File

@@ -160,7 +160,7 @@ bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
}
Creature::Creature(bool isWorldObject): Unit(isWorldObject), MovableMapObject(), m_groupLootTimer(0), lootingGroupLowGUID(0), m_PlayerDamageReq(0), m_lootRecipient(0), m_lootRecipientGroup(0),
m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f),
m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_wanderDistance(0.0f),
m_transportCheckTimer(1000), lootPickPocketRestoreTime(0), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE),
m_DBTableGuid(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false),
m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), m_originalEntry(0), m_moveInLineOfSightDisabled(false), m_moveInLineOfSightStrictlyDisabled(false),
@@ -387,7 +387,7 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data)
// checked at loading
m_defaultMovementType = MovementGeneratorType(cinfo->MovementType);
if (!m_respawnradius && m_defaultMovementType == RANDOM_MOTION_TYPE)
if (!m_wanderDistance && m_defaultMovementType == RANDOM_MOTION_TYPE)
m_defaultMovementType = IDLE_MOTION_TYPE;
for (uint8 i=0; i < CREATURE_MAX_SPELLS; ++i)
@@ -1072,12 +1072,12 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
data.spawntimesecs = m_respawnDelay;
// prevent add data integrity problems
data.spawndist = GetDefaultMovementType() == IDLE_MOTION_TYPE ? 0.0f : m_respawnradius;
data.wander_distance = GetDefaultMovementType() == IDLE_MOTION_TYPE ? 0.0f : m_wanderDistance;
data.currentwaypoint = 0;
data.curhealth = GetHealth();
data.curmana = GetPower(POWER_MANA);
// prevent add data integrity problems
data.movementType = !m_respawnradius && GetDefaultMovementType() == RANDOM_MOTION_TYPE
data.movementType = !m_wanderDistance && GetDefaultMovementType() == RANDOM_MOTION_TYPE
? IDLE_MOTION_TYPE : GetDefaultMovementType();
data.spawnMask = spawnMask;
data.npcflag = npcflag;
@@ -1106,7 +1106,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
stmt->setFloat(index++, GetPositionZ());
stmt->setFloat(index++, GetOrientation());
stmt->setUInt32(index++, m_respawnDelay);
stmt->setFloat(index++, m_respawnradius);
stmt->setFloat(index++, m_wanderDistance);
stmt->setUInt32(index++, 0);
stmt->setUInt32(index++, GetHealth());
stmt->setUInt32(index++, GetPower(POWER_MANA));
@@ -1345,7 +1345,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap, bool gri
//We should set first home position, because then AI calls home movement
SetHomePosition(data->posX, data->posY, data->posZ, data->orientation);
m_respawnradius = data->spawndist;
m_wanderDistance = data->wander_distance;
m_respawnDelay = data->spawntimesecs;
m_deathState = ALIVE;
@@ -2408,7 +2408,7 @@ void Creature::GetRespawnPosition(float &x, float &y, float &z, float* ori, floa
if (ori)
*ori = data->orientation;
if (dist)
*dist = data->spawndist;
*dist = data->wander_distance;
return;
}

View File

@@ -253,7 +253,7 @@ struct CreatureData
{
CreatureData() : id(0), mapid(0), phaseMask(0), displayid(0), equipmentId(0),
posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0),
spawndist(0.0f), currentwaypoint(0), curhealth(0), curmana(0), movementType(0),
wander_distance(0.0f), currentwaypoint(0), curhealth(0), curmana(0), movementType(0),
spawnMask(0), npcflag(0), unit_flags(0), dynamicflags(0), dbData(true), overwrittenZ(false) { }
uint32 id; // entry in creature_template
uint16 mapid;
@@ -265,7 +265,7 @@ struct CreatureData
float posZ;
float orientation;
uint32 spawntimesecs;
float spawndist;
float wander_distance;
uint32 currentwaypoint;
uint32 curhealth;
uint32 curmana;
@@ -640,8 +640,8 @@ class Creature : public Unit, public GridObject<Creature>, public MovableMapObje
uint32 GetRespawnDelay() const { return m_respawnDelay; }
void SetRespawnDelay(uint32 delay) { m_respawnDelay = delay; }
float GetRespawnRadius() const { return m_respawnradius; }
void SetRespawnRadius(float dist) { m_respawnradius = dist; }
float GetWanderDistance() const { return m_wanderDistance; }
void SetWanderDistance(float dist) { m_wanderDistance = dist; }
uint32 m_groupLootTimer; // (msecs)timer used for group loot
uint32 lootingGroupLowGUID; // used to find group which is looting corpse
@@ -735,7 +735,7 @@ class Creature : public Unit, public GridObject<Creature>, public MovableMapObje
time_t m_respawnTime; // (secs) time of next respawn
uint32 m_respawnDelay; // (secs) delay between corpse disappearance and respawning
uint32 m_corpseDelay; // (secs) delay between death and corpse disappearance
float m_respawnradius;
float m_wanderDistance;
uint16 m_transportCheckTimer;
uint32 lootPickPocketRestoreTime;