aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/scripts/Kalimdor/zone_desolace.cpp108
1 files changed, 26 insertions, 82 deletions
diff --git a/src/server/scripts/Kalimdor/zone_desolace.cpp b/src/server/scripts/Kalimdor/zone_desolace.cpp
index 8f55bb6102c..8dbeb989140 100644
--- a/src/server/scripts/Kalimdor/zone_desolace.cpp
+++ b/src/server/scripts/Kalimdor/zone_desolace.cpp
@@ -39,7 +39,6 @@ EndContentData */
enum DyingKodo
{
- // signed for 9999
SAY_SMEED_HOME = 0,
QUEST_KODO = 5561,
@@ -51,7 +50,7 @@ enum DyingKodo
NPC_TAMED_KODO = 11627,
SPELL_KODO_KOMBO_ITEM = 18153,
- SPELL_KODO_KOMBO_PLAYER_BUFF = 18172, //spells here have unclear function, but using them at least for visual parts and checks
+ SPELL_KODO_KOMBO_PLAYER_BUFF = 18172,
SPELL_KODO_KOMBO_DESPAWN_BUFF = 18377,
SPELL_KODO_KOMBO_GOSSIP = 18362
@@ -66,110 +65,55 @@ public:
{
if (player->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) && creature->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF))
{
- //the expected quest objective
- player->TalkedToCreature(creature->GetEntry(), creature->GetGUID());
-
+ player->TalkedToCreature(creature->GetEntry(), 0);
player->RemoveAurasDueToSpell(SPELL_KODO_KOMBO_PLAYER_BUFF);
- creature->GetMotionMaster()->MoveIdle();
}
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
- bool EffectDummyCreature(Unit* pCaster, uint32 spellId, uint32 effIndex, Creature* creatureTarget)
- {
- //always check spellid and effectindex
- if (spellId == SPELL_KODO_KOMBO_ITEM && effIndex == 0)
- {
- //no effect if player/creature already have aura from spells
- if (pCaster->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) || creatureTarget->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF))
- return true;
-
- if (creatureTarget->GetEntry() == NPC_AGED_KODO ||
- creatureTarget->GetEntry() == NPC_DYING_KODO ||
- creatureTarget->GetEntry() == NPC_ANCIENT_KODO)
- {
- pCaster->CastSpell(pCaster, SPELL_KODO_KOMBO_PLAYER_BUFF, true);
-
- creatureTarget->UpdateEntry(NPC_TAMED_KODO);
- creatureTarget->CastSpell(creatureTarget, SPELL_KODO_KOMBO_DESPAWN_BUFF, false);
-
- if (creatureTarget->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
- creatureTarget->GetMotionMaster()->MoveIdle();
-
- creatureTarget->GetMotionMaster()->MoveFollow(pCaster, PET_FOLLOW_DIST, creatureTarget->GetFollowAngle());
- }
-
- //always return true when we are handling this spell and effect
- return true;
- }
- return false;
- }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_aged_dying_ancient_kodoAI(creature);
- }
-
struct npc_aged_dying_ancient_kodoAI : public ScriptedAI
{
- npc_aged_dying_ancient_kodoAI(Creature* creature) : ScriptedAI(creature) { Reset(); }
-
- uint32 DespawnTimer;
+ npc_aged_dying_ancient_kodoAI(Creature* creature) : ScriptedAI(creature) {}
- void Reset()
+ void MoveInLineOfSight(Unit* who)
{
- DespawnTimer = 0;
+ if (who->GetEntry() == NPC_SMEED && me->IsWithinDistInMap(who, 10.0f) && !me->HasAura(SPELL_KODO_KOMBO_GOSSIP))
+ {
+ me->GetMotionMaster()->Clear();
+ DoCast(me, SPELL_KODO_KOMBO_GOSSIP, true);
+ if (Creature* smeed = who->ToCreature())
+ smeed->AI()->Talk(SAY_SMEED_HOME);
+ }
}
- void MoveInLineOfSight(Unit* who)
+ void SpellHit(Unit* caster, SpellInfo const* spell)
{
- if (who->GetEntry() == NPC_SMEED)
+ if (spell->Id == SPELL_KODO_KOMBO_ITEM)
{
- if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
- return;
-
- if (me->IsWithinDistInMap(who, 10.0f))
+ if (!(caster->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) || me->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF))
+ && (me->GetEntry() == NPC_AGED_KODO || me->GetEntry() == NPC_DYING_KODO || me->GetEntry() == NPC_ANCIENT_KODO))
{
- if (Creature* talker = who->ToCreature())
- talker->AI()->Talk(SAY_SMEED_HOME);
+ caster->CastSpell(caster, SPELL_KODO_KOMBO_PLAYER_BUFF, true);
+ DoCast(me, SPELL_KODO_KOMBO_DESPAWN_BUFF, true);
- //spell have no implemented effect (dummy), so useful to notify spellHit
- DoCast(me, SPELL_KODO_KOMBO_GOSSIP, true);
+ me->UpdateEntry(NPC_TAMED_KODO);
+ me->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, me->GetFollowAngle());
}
}
- }
-
- void SpellHit(Unit* /*pCaster*/, SpellInfo const* pSpell)
- {
- if (pSpell->Id == SPELL_KODO_KOMBO_GOSSIP)
+ else if (spell->Id == SPELL_KODO_KOMBO_GOSSIP)
{
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- DespawnTimer = 60000;
+ me->DespawnOrUnsummon(60000);
}
}
-
- void UpdateAI(const uint32 diff)
- {
- //timer should always be == 0 unless we already updated entry of creature. Then not expect this updated to ever be in combat.
- if (DespawnTimer && DespawnTimer <= diff)
- {
- if (!me->getVictim() && me->isAlive())
- {
- Reset();
- me->setDeathState(JUST_DIED);
- me->Respawn();
- return;
- }
- } else DespawnTimer -= diff;
-
- if (!UpdateVictim())
- return;
-
- DoMeleeAttackIfReady();
- }
};
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_aged_dying_ancient_kodoAI(creature);
+ }
};