Fix hunter starting quests.
Ref: https://www.getmangos.eu/bug-tracker/mangos-zero/Hunter-pet-quests-bugged-r139/ - Tamed pets now properly update HP bar - Taming process, if interrupted by any means, will not instantly trigger tamed status for creature. - Teleporting or moving too far from the tamed creature will remove it and it's action bar from the player UI. - Tamed creature will properly despawn after 10 minutes. - Recasting Taming spell while channeling will consume one charge from the item, as this is a normal behavior for channeled spells.
This commit is contained in:
parent
3de9b857e0
commit
9af47a5582
@ -589,7 +589,18 @@ void Creature::Update(uint32 update_diff, uint32 diff)
|
|||||||
}
|
}
|
||||||
case ALIVE:
|
case ALIVE:
|
||||||
{
|
{
|
||||||
if (m_aggroDelay <= update_diff)
|
// unsummon pet that lost owner
|
||||||
|
Unit* charmer = GetCharmer();
|
||||||
|
if (GetCharmerGuid() && (!charmer ||
|
||||||
|
(!IsWithinDistInMap(charmer, GetMap()->GetVisibilityDistance()) &&
|
||||||
|
(charmer->GetCharmGuid() == GetObjectGuid()))))
|
||||||
|
{
|
||||||
|
if (charmer)
|
||||||
|
charmer->Uncharm();
|
||||||
|
ForcedDespawn();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (m_aggroDelay <= update_diff)
|
||||||
m_aggroDelay = 0;
|
m_aggroDelay = 0;
|
||||||
else
|
else
|
||||||
m_aggroDelay -= update_diff;
|
m_aggroDelay -= update_diff;
|
||||||
@ -663,9 +674,11 @@ void Creature::RegenerateAll(uint32 update_diff)
|
|||||||
if (m_regenTimer != 0)
|
if (m_regenTimer != 0)
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
if (!IsInCombat() || IsPolymorphed())
|
if (!IsInCombat() || IsPolymorphed())
|
||||||
{ RegenerateHealth(); }
|
{
|
||||||
|
RegenerateHealth();
|
||||||
|
}
|
||||||
|
|
||||||
RegeneratePower();
|
RegeneratePower();
|
||||||
|
|
||||||
m_regenTimer = REGEN_TIME_FULL;
|
m_regenTimer = REGEN_TIME_FULL;
|
||||||
@ -744,20 +757,20 @@ void Creature::RegenerateHealth()
|
|||||||
if (curValue >= maxValue)
|
if (curValue >= maxValue)
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
uint32 addvalue;
|
uint32 addvalue = 0;
|
||||||
|
|
||||||
// Not only pet, but any controlled creature
|
// Not only pet, but any controlled creature
|
||||||
if (GetCharmerOrOwnerGuid())
|
if (GetCharmerOrOwnerGuid())
|
||||||
{
|
{
|
||||||
float HealthIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_HEALTH);
|
float HealthIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_HEALTH);
|
||||||
float Spirit = GetStat(STAT_SPIRIT);
|
float Spirit = GetStat(STAT_SPIRIT);
|
||||||
|
|
||||||
if (GetPower(POWER_MANA) > 0)
|
if (GetPower(POWER_MANA) > 0)
|
||||||
{ addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate); }
|
{ addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate); }
|
||||||
else
|
else
|
||||||
{ addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate); }
|
{ addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate); }
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (addvalue == 0)
|
||||||
{ addvalue = maxValue / 3; }
|
{ addvalue = maxValue / 3; }
|
||||||
|
|
||||||
ModifyHealth(addvalue);
|
ModifyHealth(addvalue);
|
||||||
|
@ -1326,14 +1326,25 @@ void Player::Update(uint32 update_diff, uint32 p_time)
|
|||||||
UpdateEnchantTime(update_diff);
|
UpdateEnchantTime(update_diff);
|
||||||
UpdateHomebindTime(update_diff);
|
UpdateHomebindTime(update_diff);
|
||||||
|
|
||||||
// Group update
|
// unsummon pet/charmed that lost owner
|
||||||
SendUpdateToOutOfRangeGroupMembers();
|
Pet* pet = GetPet();
|
||||||
|
if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGuid() && (pet->GetObjectGuid() != GetCharmGuid())))
|
||||||
|
{
|
||||||
|
pet->Unsummon(PET_SAVE_REAGENTS, this);
|
||||||
|
}
|
||||||
|
|
||||||
Pet* pet = GetPet();
|
Unit* charmed = GetCharm();
|
||||||
if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGuid() && (pet->GetObjectGuid() != GetCharmGuid())))
|
if (charmed && (GetCharmGuid() == charmed->GetObjectGuid()) &&
|
||||||
{ pet->Unsummon(PET_SAVE_REAGENTS, this); }
|
!IsWithinDistInMap(charmed, GetMap()->GetVisibilityDistance()))
|
||||||
|
{
|
||||||
|
Uncharm();
|
||||||
|
if(charmed->GetTypeId()==TYPEID_UNIT)
|
||||||
|
((Creature*)charmed)->ForcedDespawn();
|
||||||
|
}
|
||||||
|
|
||||||
if (IsHasDelayedTeleport())
|
// Group update
|
||||||
|
SendUpdateToOutOfRangeGroupMembers();
|
||||||
|
if (IsHasDelayedTeleport())
|
||||||
{ TeleportTo(m_teleport_dest, m_teleport_options); }
|
{ TeleportTo(m_teleport_dest, m_teleport_options); }
|
||||||
|
|
||||||
#ifdef ENABLE_PLAYERBOTS
|
#ifdef ENABLE_PLAYERBOTS
|
||||||
|
@ -2547,7 +2547,7 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
|
|||||||
m_caster->m_Events.AddEvent(Event, m_caster->m_Events.CalculateTime(1));
|
m_caster->m_Events.AddEvent(Event, m_caster->m_Events.CalculateTime(1));
|
||||||
|
|
||||||
// Prevent casting at cast another spell (ServerSide check)
|
// Prevent casting at cast another spell (ServerSide check)
|
||||||
if (!m_IsTriggeredSpell && m_caster->IsNonMeleeSpellCasted(false, true, true))
|
if (!m_IsTriggeredSpell && m_caster->IsNonMeleeSpellCasted(false,true, true))
|
||||||
{
|
{
|
||||||
SendCastResult(SPELL_FAILED_SPELL_IN_PROGRESS);
|
SendCastResult(SPELL_FAILED_SPELL_IN_PROGRESS);
|
||||||
finish(false);
|
finish(false);
|
||||||
|
@ -1127,6 +1127,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
|||||||
|
|
||||||
Unit* target = GetTarget();
|
Unit* target = GetTarget();
|
||||||
|
|
||||||
|
if (!target || !target->IsAlive())
|
||||||
|
{ return; }
|
||||||
|
|
||||||
// AT APPLY
|
// AT APPLY
|
||||||
if (apply)
|
if (apply)
|
||||||
{
|
{
|
||||||
@ -1209,7 +1212,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
|||||||
// AT REMOVE
|
// AT REMOVE
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (IsQuestTameSpell(GetId()) && target->IsAlive())
|
if (IsQuestTameSpell(GetId()) && (GetAuraDuration() == 0))
|
||||||
{
|
{
|
||||||
Unit* caster = GetCaster();
|
Unit* caster = GetCaster();
|
||||||
if (!caster || !caster->IsAlive())
|
if (!caster || !caster->IsAlive())
|
||||||
@ -2219,6 +2222,8 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
|||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
Unit* target = GetTarget();
|
Unit* target = GetTarget();
|
||||||
|
if (!target || !target->IsAlive())
|
||||||
|
{ return; }
|
||||||
|
|
||||||
// not charm yourself
|
// not charm yourself
|
||||||
if (GetCasterGuid() == target->GetObjectGuid())
|
if (GetCasterGuid() == target->GetObjectGuid())
|
||||||
@ -2277,7 +2282,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
|||||||
else if (Player *plTarget = target->ToPlayer())
|
else if (Player *plTarget = target->ToPlayer())
|
||||||
plTarget->SetClientControl(plTarget, 0);
|
plTarget->SetClientControl(plTarget, 0);
|
||||||
|
|
||||||
if (caster->GetTypeId() == TYPEID_PLAYER)
|
if (caster->GetTypeId() == TYPEID_PLAYER)
|
||||||
{ ((Player*)caster)->CharmSpellInitialize(); }
|
{ ((Player*)caster)->CharmSpellInitialize(); }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2330,7 +2335,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
|||||||
if (target->GetTypeId() == TYPEID_UNIT)
|
if (target->GetTypeId() == TYPEID_UNIT)
|
||||||
{
|
{
|
||||||
((Creature*)target)->AIM_Initialize();
|
((Creature*)target)->AIM_Initialize();
|
||||||
target->AttackedBy(caster);
|
//target->AttackedBy(caster);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5671,13 +5676,13 @@ void SpellAuraHolder::UpdateAuraDuration()
|
|||||||
if (GetAuraSlot() >= MAX_AURAS || m_isPassive)
|
if (GetAuraSlot() >= MAX_AURAS || m_isPassive)
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
if (m_target->GetTypeId() == TYPEID_PLAYER)
|
if (m_target->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_UPDATE_AURA_DURATION, 5);
|
WorldPacket data(SMSG_UPDATE_AURA_DURATION, 5);
|
||||||
data << uint8(GetAuraSlot());
|
data << uint8(GetAuraSlot());
|
||||||
data << uint32(GetAuraDuration());
|
data << uint32(GetAuraDuration());
|
||||||
((Player*)m_target)->SendDirectMessage(&data);
|
((Player*)m_target)->SendDirectMessage(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// not send in case player loading (will not work anyway until player not added to map), sent in visibility change code
|
// not send in case player loading (will not work anyway until player not added to map), sent in visibility change code
|
||||||
if (m_target->GetTypeId() == TYPEID_PLAYER && ((Player*)m_target)->GetSession()->PlayerLoading())
|
if (m_target->GetTypeId() == TYPEID_PLAYER && ((Player*)m_target)->GetSession()->PlayerLoading())
|
||||||
|
@ -662,7 +662,8 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 15998: // Capture Worg Pup
|
case 15998: // Capture Worg Pup
|
||||||
{
|
case 19614: // Despawn Caster
|
||||||
|
{
|
||||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
|
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user