fix(Core/Pet): Fixed set hunter pet's speed on load. (#15206)
This commit is contained in:
@@ -459,17 +459,8 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data)
|
|||||||
|
|
||||||
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
|
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
|
||||||
|
|
||||||
float runSpeed = cinfo->speed_run;
|
|
||||||
if (Pet* pet = ToPet())
|
|
||||||
{
|
|
||||||
if (pet->isControlled() && pet->GetOwnerGUID().IsPlayer())
|
|
||||||
{
|
|
||||||
runSpeed = 1.15f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SetSpeed(MOVE_WALK, cinfo->speed_walk);
|
SetSpeed(MOVE_WALK, cinfo->speed_walk);
|
||||||
SetSpeed(MOVE_RUN, runSpeed);
|
SetSpeed(MOVE_RUN, cinfo->speed_run);
|
||||||
SetSpeed(MOVE_SWIM, cinfo->speed_swim);
|
SetSpeed(MOVE_SWIM, cinfo->speed_swim);
|
||||||
SetSpeed(MOVE_FLIGHT, cinfo->speed_flight);
|
SetSpeed(MOVE_FLIGHT, cinfo->speed_flight);
|
||||||
|
|
||||||
|
|||||||
@@ -1048,6 +1048,11 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
|
|||||||
else if (petType != SUMMON_PET)
|
else if (petType != SUMMON_PET)
|
||||||
LOG_ERROR("entities.pet", "Unknown type pet {} is summoned by player class {}", GetEntry(), owner->getClass());
|
LOG_ERROR("entities.pet", "Unknown type pet {} is summoned by player class {}", GetEntry(), owner->getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (petType == HUNTER_PET || petType == SUMMON_PET)
|
||||||
|
{
|
||||||
|
SetSpeed(MOVE_RUN, 1.15f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 creature_ID = (petType == HUNTER_PET) ? 1 : cinfo->Entry;
|
uint32 creature_ID = (petType == HUNTER_PET) ? 1 : cinfo->Entry;
|
||||||
|
|||||||
@@ -10700,11 +10700,6 @@ void Unit::SetMinion(Minion* minion, bool apply)
|
|||||||
// PvP, FFAPvP
|
// PvP, FFAPvP
|
||||||
minion->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));
|
minion->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));
|
||||||
|
|
||||||
// FIXME: hack, speed must be set only at follow
|
|
||||||
if (GetTypeId() == TYPEID_PLAYER && minion->IsPet())
|
|
||||||
for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
|
|
||||||
minion->SetSpeed(UnitMoveType(i), m_speed_rate[i], true);
|
|
||||||
|
|
||||||
// Ghoul pets have energy instead of mana (is anywhere better place for this code?)
|
// Ghoul pets have energy instead of mana (is anywhere better place for this code?)
|
||||||
if (minion->IsPetGhoul() || minion->GetEntry() == 24207 /*ENTRY_ARMY_OF_THE_DEAD*/)
|
if (minion->IsPetGhoul() || minion->GetEntry() == 24207 /*ENTRY_ARMY_OF_THE_DEAD*/)
|
||||||
minion->setPowerType(POWER_ENERGY);
|
minion->setPowerType(POWER_ENERGY);
|
||||||
@@ -14251,7 +14246,17 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
|
|||||||
{
|
{
|
||||||
// Set creature speed rate
|
// Set creature speed rate
|
||||||
if (GetTypeId() == TYPEID_UNIT)
|
if (GetTypeId() == TYPEID_UNIT)
|
||||||
speed *= ToCreature()->GetCreatureTemplate()->speed_run; // at this point, MOVE_WALK is never reached
|
{
|
||||||
|
if (IsPet() && ToPet()->isControlled() && IsControlledByPlayer())
|
||||||
|
{
|
||||||
|
// contant value for player pets
|
||||||
|
speed *= 1.15f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
speed *= ToCreature()->GetCreatureTemplate()->speed_run; // at this point, MOVE_WALK is never reached
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need
|
// Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need
|
||||||
/// @todo possible affect only on MOVE_RUN
|
/// @todo possible affect only on MOVE_RUN
|
||||||
@@ -15380,7 +15385,7 @@ void Unit::SetHealth(uint32 val)
|
|||||||
SetUInt32Value(UNIT_FIELD_HEALTH, val);
|
SetUInt32Value(UNIT_FIELD_HEALTH, val);
|
||||||
|
|
||||||
// mobs that are now or were below 30% need to update their speed
|
// mobs that are now or were below 30% need to update their speed
|
||||||
if (GetTypeId() == TYPEID_UNIT && (prevHealthPct < 30.0 || HealthBelowPct(30)))
|
if (GetTypeId() == TYPEID_UNIT && !(IsPet() && ToPet()->isControlled() && IsControlledByPlayer()) && (prevHealthPct < 30.0 || HealthBelowPct(30)))
|
||||||
{
|
{
|
||||||
UpdateSpeed(MOVE_RUN, false);
|
UpdateSpeed(MOVE_RUN, false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user