From 628f11e1a75384928ade89dc1dbecc71d74abac7 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Sun, 16 May 2010 13:52:17 +0200 Subject: [PATCH] [9914] Add script effect of spell 51864, 51889 and 51910 In addition, dummy effect of spell 51866 and 51872 and dummy aura effect of spell 51870. Dummy effect of 51866 might need additional work (see comments). Code expect additional spell cast by AI (summon dummy at death of related quest target creatures). Signed-off-by: NoFantasy --- src/game/SpellAuras.cpp | 10 ++++ src/game/SpellEffects.cpp | 100 ++++++++++++++++++++++++++++++++++++++ src/shared/revision_nr.h | 2 +- 3 files changed, 111 insertions(+), 1 deletion(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index c0aecd87f..58d81c827 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2488,6 +2488,16 @@ void Aura::HandleAuraDummy(bool apply, bool Real) m_target->CastSpell(m_target, 47287, true, NULL, this); return; } + case 51870: // Collect Hair Sample + { + if (Unit* pCaster = GetCaster()) + { + if (m_removeMode == AURA_REMOVE_BY_DEFAULT) + pCaster->CastSpell(m_target, 51872, true, NULL, this); + } + + return; + } case 58600: // Restricted Flight Area { // Remove Flight Auras diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 0b44785c9..a1ddddab7 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1507,6 +1507,64 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) ((Creature*)unitTarget)->ForcedDespawn(); return; } + case 51866: // Kick Nass + { + // It is possible that Nass Heartbeat (spell id 61438) is involved in this + // If so, unclear how it should work and using the below instead (even though it could be a bit hack-ish) + + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) + return; + + // Only own guardian pet + if (m_caster != unitTarget->GetOwner()) + return; + + // This means we already set state (see below) and need to wait. + if (unitTarget->hasUnitState(UNIT_STAT_ROOT)) + return; + + // Expecting pTargetDummy to be summoned by AI at death of target creatures. + + Creature* pTargetDummy = NULL; + float fRange = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); + + MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster, 28523, true, fRange*2); + MaNGOS::CreatureLastSearcher searcher(m_caster, pTargetDummy, u_check); + + Cell::VisitGridObjects(m_caster, searcher, fRange*2); + + if (pTargetDummy) + { + if (unitTarget->hasUnitState(UNIT_STAT_FOLLOW | UNIT_STAT_FOLLOW_MOVE)) + unitTarget->GetMotionMaster()->MovementExpired(); + + unitTarget->MonsterMove(pTargetDummy->GetPositionX(), pTargetDummy->GetPositionY(), pTargetDummy->GetPositionZ(), IN_MILLISECONDS); + + // Add state to temporarily prevent follow + unitTarget->addUnitState(UNIT_STAT_ROOT); + + // Collect Hair Sample + unitTarget->CastSpell(pTargetDummy, 51870, true); + } + + return; + } + case 51872: // Hair Sample Collected + { + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) + return; + + // clear state to allow follow again + m_caster->clearUnitState(UNIT_STAT_ROOT); + + // Nass Kill Credit + m_caster->CastSpell(m_caster, 51871, true); + + // Despawn dummy creature + ((Creature*)unitTarget)->ForcedDespawn(); + + return; + } case 51964: // Tormentor's Incense { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) @@ -5708,6 +5766,48 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) caster->CastSpell(caster, damage, false); break; } + case 51864: // Player Summon Nass + { + if (m_caster->GetTypeId() != TYPEID_PLAYER) + return; + + // Summon Nass + if (const SpellEntry* pSpell = sSpellStore.LookupEntry(51865)) + { + // Only if he is not already there + if (!m_caster->FindGuardianWithEntry(pSpell->EffectMiscValue[EFFECT_INDEX_0])) + { + m_caster->CastSpell(m_caster, pSpell, true); + + if (Pet* pPet = m_caster->FindGuardianWithEntry(pSpell->EffectMiscValue[EFFECT_INDEX_0])) + { + // Nass Periodic Say aura + pPet->CastSpell(pPet, 51868, true); + } + } + } + return; + } + case 51889: // Quest Accept Summon Nass + { + // This is clearly for quest accept, is spell 51864 then for gossip and does pretty much the same thing? + // Just "jumping" to what may be the "gossip-spell" for now, doing the same thing + m_caster->CastSpell(m_caster, 51864, true); + return; + } + case 51910: // Kickin' Nass: Quest Completion + { + if (m_caster->GetTypeId() != TYPEID_PLAYER) + return; + + if (const SpellEntry* pSpell = sSpellStore.LookupEntry(51865)) + { + // Is this all to be done at completion? + if (Pet* pPet = m_caster->FindGuardianWithEntry(pSpell->EffectMiscValue[EFFECT_INDEX_0])) + ((Player*)m_caster)->RemovePet(pPet, PET_SAVE_NOT_IN_SLOT); + } + return; + } case 52751: // Death Gate { if (!unitTarget || unitTarget->getClass() != CLASS_DEATH_KNIGHT) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8e4dcd985..1f03772d1 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9913" + #define REVISION_NR "9914" #endif // __REVISION_NR_H__