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:
|
||||
{
|
||||
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;
|
||||
else
|
||||
m_aggroDelay -= update_diff;
|
||||
@ -663,9 +674,11 @@ void Creature::RegenerateAll(uint32 update_diff)
|
||||
if (m_regenTimer != 0)
|
||||
{ return; }
|
||||
|
||||
if (!IsInCombat() || IsPolymorphed())
|
||||
{ RegenerateHealth(); }
|
||||
|
||||
if (!IsInCombat() || IsPolymorphed())
|
||||
{
|
||||
RegenerateHealth();
|
||||
}
|
||||
|
||||
RegeneratePower();
|
||||
|
||||
m_regenTimer = REGEN_TIME_FULL;
|
||||
@ -744,20 +757,20 @@ void Creature::RegenerateHealth()
|
||||
if (curValue >= maxValue)
|
||||
{ return; }
|
||||
|
||||
uint32 addvalue;
|
||||
uint32 addvalue = 0;
|
||||
|
||||
// Not only pet, but any controlled creature
|
||||
if (GetCharmerOrOwnerGuid())
|
||||
{
|
||||
float HealthIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_HEALTH);
|
||||
float Spirit = GetStat(STAT_SPIRIT);
|
||||
|
||||
if (GetPower(POWER_MANA) > 0)
|
||||
{ addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate); }
|
||||
else
|
||||
{ addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate); }
|
||||
}
|
||||
else
|
||||
|
||||
if (addvalue == 0)
|
||||
{ addvalue = maxValue / 3; }
|
||||
|
||||
ModifyHealth(addvalue);
|
||||
|
@ -1326,14 +1326,25 @@ void Player::Update(uint32 update_diff, uint32 p_time)
|
||||
UpdateEnchantTime(update_diff);
|
||||
UpdateHomebindTime(update_diff);
|
||||
|
||||
// Group update
|
||||
SendUpdateToOutOfRangeGroupMembers();
|
||||
// unsummon pet/charmed that lost owner
|
||||
Pet* pet = GetPet();
|
||||
if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGuid() && (pet->GetObjectGuid() != GetCharmGuid())))
|
||||
{
|
||||
pet->Unsummon(PET_SAVE_REAGENTS, this);
|
||||
}
|
||||
|
||||
Pet* pet = GetPet();
|
||||
if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGuid() && (pet->GetObjectGuid() != GetCharmGuid())))
|
||||
{ pet->Unsummon(PET_SAVE_REAGENTS, this); }
|
||||
Unit* charmed = GetCharm();
|
||||
if (charmed && (GetCharmGuid() == charmed->GetObjectGuid()) &&
|
||||
!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); }
|
||||
|
||||
#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));
|
||||
|
||||
// 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);
|
||||
finish(false);
|
||||
|
@ -1127,6 +1127,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||
|
||||
Unit* target = GetTarget();
|
||||
|
||||
if (!target || !target->IsAlive())
|
||||
{ return; }
|
||||
|
||||
// AT APPLY
|
||||
if (apply)
|
||||
{
|
||||
@ -1209,7 +1212,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||
// AT REMOVE
|
||||
else
|
||||
{
|
||||
if (IsQuestTameSpell(GetId()) && target->IsAlive())
|
||||
if (IsQuestTameSpell(GetId()) && (GetAuraDuration() == 0))
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster || !caster->IsAlive())
|
||||
@ -2219,6 +2222,8 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
||||
{ return; }
|
||||
|
||||
Unit* target = GetTarget();
|
||||
if (!target || !target->IsAlive())
|
||||
{ return; }
|
||||
|
||||
// not charm yourself
|
||||
if (GetCasterGuid() == target->GetObjectGuid())
|
||||
@ -2277,7 +2282,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
||||
else if (Player *plTarget = target->ToPlayer())
|
||||
plTarget->SetClientControl(plTarget, 0);
|
||||
|
||||
if (caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if (caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{ ((Player*)caster)->CharmSpellInitialize(); }
|
||||
}
|
||||
else
|
||||
@ -2330,7 +2335,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
||||
if (target->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
((Creature*)target)->AIM_Initialize();
|
||||
target->AttackedBy(caster);
|
||||
//target->AttackedBy(caster);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5671,13 +5676,13 @@ void SpellAuraHolder::UpdateAuraDuration()
|
||||
if (GetAuraSlot() >= MAX_AURAS || m_isPassive)
|
||||
{ return; }
|
||||
|
||||
if (m_target->GetTypeId() == TYPEID_PLAYER)
|
||||
if (m_target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
WorldPacket data(SMSG_UPDATE_AURA_DURATION, 5);
|
||||
data << uint8(GetAuraSlot());
|
||||
data << uint32(GetAuraDuration());
|
||||
((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
|
||||
if (m_target->GetTypeId() == TYPEID_PLAYER && ((Player*)m_target)->GetSession()->PlayerLoading())
|
||||
|
@ -662,7 +662,8 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
|
||||
return;
|
||||
}
|
||||
case 15998: // Capture Worg Pup
|
||||
{
|
||||
case 19614: // Despawn Caster
|
||||
{
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
|
||||
{ return; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user