Core/Spells: Fixed Raise Ally

thx @Nayd for sniffs :)
thx @Shauren for helping to find all spell involved

* There is no implementation for stats update on Puppet class (only on Guardian) so same SummonProperty as Raise Dead Ghoul (non pet) is used.
(Default SummonProperties set category to SUMMON_CATEGORY_PUPPET)
* Override the Summon Effect to enable charm and stats scaling.
* PlayerAI is used to handle unaura on ghoul despawn or dead.
It's necessary due to the fact that all script hooks on ScriptedCreature are called on an unactive CreatureAI, resulting in creature being unable to handle unaura calls.
* Create UpdateAI call for Player class
* Stats scaling is based on forum and wowhead comments, they recall this ghoul as a copy of the other one (same stats).
* Spellscript for Ghoul spell Thrash

Closes #82
Closes #14830
This commit is contained in:
ccrs authored and Shauren committed 2016-01-08 00:10:15 +01:00
1 parent 91fa2154e8
commit e5d4005cc6
10 files changed
+432 -24

No files matched your search

+74 -4
View File
@@ -1242,6 +1242,9 @@ void Player::Update(uint32 p_time)
if (charmer->GetTypeId() == TYPEID_UNIT && charmer->IsAlive())
UpdateCharmedAI();
if (GetAI() && IsAIEnabled)
GetAI()->UpdateAI(p_time);
// Update items that have just a limited lifetime
if (now > m_Last_tick)
UpdateItemDuration(uint32(now - m_Last_tick));
@@ -1476,8 +1479,8 @@ void Player::Update(uint32 p_time)
_pendingBindTimer -= p_time;
}
// not auto-free ghost from body in instances
if (m_deathTimer > 0 && !GetBaseMap()->Instanceable() && !HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
// not auto-free ghost from body in instances or if its affected by risen ally
if (m_deathTimer > 0 && !GetBaseMap()->Instanceable() && !HasAuraType(SPELL_AURA_PREVENT_RESURRECTION) && !IsGhouled())
{
if (p_time >= m_deathTimer)
{
@@ -2157,7 +2160,7 @@ bool Player::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) co
return true;
if (spellInfo->Effects[index].IsEffect(SPELL_EFFECT_ATTACK_ME))
return true;
return Unit::IsImmunedToSpellEffect(spellInfo, index);
}
@@ -4731,6 +4734,32 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
}
}
void Player::SendGhoulResurrectRequest(Player* target)
{
target->m_ghoulResurrectPlayerGUID = GetGUID();
WorldPacket data(SMSG_RESURRECT_REQUEST, 8 + 4 + 1 + 1);
data << uint64(GetGUID());
data << uint32(0);
data << uint8(0);
data << uint8(0);
target->GetSession()->SendPacket(&data);
}
void Player::GhoulResurrect()
{
CastSpell(this, 46619 /*SPELL_DK_RAISE_ALLY*/, true, nullptr, nullptr, m_ghoulResurrectPlayerGUID);
m_ghoulResurrectPlayerGUID = ObjectGuid::Empty;
}
void Player::RemoveGhoul()
{
if (IsGhouled())
if (Creature* ghoul = ObjectAccessor::GetCreature(*this, m_ghoulResurrectGhoulGUID))
ghoul->DespawnOrUnsummon(); // Raise Ally aura will handle unauras
}
void Player::KillPlayer()
{
if (IsFlying() && !GetTransport())
@@ -18682,7 +18711,7 @@ bool Player::CheckInstanceValidity(bool /*isLogin*/)
// game masters' instances are always valid
if (IsGameMaster())
return true;
// non-instances are always valid
Map* map = GetMap();
if (!map || !map->IsDungeon())
@@ -20156,6 +20185,12 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
void Player::StopCastingCharm()
{
if (IsGhouled())
{
RemoveGhoul();
return;
}
Unit* charm = GetCharm();
if (!charm)
return;
@@ -21508,6 +21543,14 @@ void Player::setResurrectRequestData(ObjectGuid guid, uint32 mapId, float X, flo
m_resurrectHealth = health;
m_resurrectMana = mana;
}
void Player::clearResurrectRequestData()
{
setResurrectRequestData(ObjectGuid::Empty, 0, 0.0f, 0.0f, 0.0f, 0, 0);
m_ghoulResurrectPlayerGUID = ObjectGuid::Empty;
m_ghoulResurrectGhoulGUID = ObjectGuid::Empty;
}
//slot to be excluded while counting
bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
{
@@ -23410,6 +23453,8 @@ uint32 Player::GetBaseWeaponSkillValue(WeaponAttackType attType) const
void Player::ResurrectUsingRequestData()
{
RemoveGhoul();
/// Teleport before resurrecting by player, otherwise the player might get attacked from creatures near his corpse
TeleportTo(m_resurrectMap, m_resurrectX, m_resurrectY, m_resurrectZ, GetOrientation());
@@ -23854,6 +23899,31 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
//WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0);
//GetSession()->SendPacket(&data);
}
// HACK: Make sure update for PLAYER_FARSIGHT is received before SMSG_PET_SPELLS to properly hide "Release spirit" dialog
if (target->GetTypeId() == TYPEID_UNIT && static_cast<Unit*>(target)->HasUnitTypeMask(UNIT_MASK_MINION) && static_cast<Minion*>(target)->IsRisenAlly())
{
if (apply)
{
UpdateDataMapType update_players;
BuildUpdate(update_players);
WorldPacket packet;
for (UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter)
{
iter->second.BuildPacket(&packet);
iter->first->GetSession()->SendPacket(&packet);
packet.clear();
}
}
else
{
m_deathTimer = 6 * MINUTE * IN_MILLISECONDS;
// Reset "Release spirit" timer clientside
WorldPacket data(SMSG_FORCED_DEATH_UPDATE);
SendDirectMessage(&data);
}
}
}
WorldObject* Player::GetViewpoint() const