aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/2011_05_07_05_world_sai.sql20
-rw-r--r--src/server/scripts/Kalimdor/dustwallow_marsh.cpp145
2 files changed, 81 insertions, 84 deletions
diff --git a/sql/updates/world/2011_05_07_05_world_sai.sql b/sql/updates/world/2011_05_07_05_world_sai.sql
new file mode 100644
index 00000000000..45316ea0b8f
--- /dev/null
+++ b/sql/updates/world/2011_05_07_05_world_sai.sql
@@ -0,0 +1,20 @@
+-- SAI for Restless Apparition
+SET @ENTRY := 23861;
+
+UPDATE `creature_template` SET `ScriptName`='',`AIName`= 'SmartAI' WHERE `entry`=@ENTRY;
+DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
+DELETE FROM `smart_scripts` WHERE `source_type`=9 AND `entryorguid`=@ENTRY*100;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@ENTRY,0,0,0,25,0,100,0,0,0,0,0,80,@ENTRY*100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Restless Apparition - On spawn - Run script'),
+(@ENTRY*100,9,0,0,0,0,100,0,2000,2000,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Restless Apparition - Script - Say text 0'),
+(@ENTRY*100,9,1,0,0,0,100,0,8000,8000,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Restless Apparition - Script - Despawn');
+
+DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(@ENTRY,0,0, 'The darkness... the corruption... they came too quickly for anyone to know...',12,0,15,25,0,0, 'Restless Apparition'),
+(@ENTRY,0,1, 'It is too late for us, living one. Take yourself and your friend away from here before you both are... claimed...',12,0,15,25,0,0, 'Restless Apparition'),
+(@ENTRY,0,2, 'Go away, whoever you are! Witch Hill is mine... mine!',12,0,15,25,0,0, 'Restless Apparition'),
+(@ENTRY,0,3, 'The darkness will consume all... all the living...',12,0,15,25,0,0, 'Restless Apparition'),
+(@ENTRY,0,4, 'The manor... someone else... will soon be consumed...',12,0,15,25,0,0, 'Restless Apparition'),
+(@ENTRY,0,5, 'Why have you come here, outsider? You will only find pain! Our fate will be yours...',12,0,15,25,0,0, 'Restless Apparition'),
+(@ENTRY,0,6, 'It was... terrible... the demon...',12,0,15,25,0,0, 'Restless Apparition');
diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
index b38e95a4f87..5c4c134ad4c 100644
--- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
+++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
@@ -25,7 +25,6 @@ EndScriptData */
/* ContentData
mobs_risen_husk_spirit
-npc_restless_apparition
npc_deserter_agitator
npc_lady_jaina_proudmoore
npc_nat_pagle
@@ -40,114 +39,93 @@ EndContentData */
## mobs_risen_husk_spirit
######*/
-enum eHuskSpirit
+enum HauntingWitchHill
{
+ // Quest
QUEST_WHATS_HAUNTING_WITCH_HILL = 11180,
+ // General spells
SPELL_SUMMON_RESTLESS_APPARITION = 42511,
- SPELL_CONSUME_FLESH = 37933, //Risen Husk
- SPELL_INTANGIBLE_PRESENCE = 43127, //Risen Spirit
+ SPELL_WITCH_HILL_INFORMATION_CREDIT = 42512,
+ // Risen Husk specific
+ SPELL_CONSUME_FLESH = 37933,
NPC_RISEN_HUSK = 23555,
+
+ // Risen Spirit specific
+ SPELL_INTANGIBLE_PRESENCE = 43127,
NPC_RISEN_SPIRIT = 23554,
- NPC_RESTLESS_APPARITION = 23861
+
+ // Events
+ EVENT_CONSUME_FLESH = 0,
+ EVENT_INTANGIBLE_PRESENCE = 1,
};
class mobs_risen_husk_spirit : public CreatureScript
{
-public:
- mobs_risen_husk_spirit() : CreatureScript("mobs_risen_husk_spirit") { }
-
- CreatureAI* GetAI(Creature* pCreature) const
- {
- return new mobs_risen_husk_spiritAI (pCreature);
- }
-
- struct mobs_risen_husk_spiritAI : public ScriptedAI
- {
- mobs_risen_husk_spiritAI(Creature *c) : ScriptedAI(c) {}
-
- uint32 m_uiConsumeFlesh_Timer;
- uint32 m_uiIntangiblePresence_Timer;
-
- void Reset()
- {
- m_uiConsumeFlesh_Timer = 10000;
- m_uiIntangiblePresence_Timer = 5000;
- }
+ public:
+ mobs_risen_husk_spirit() : CreatureScript("mobs_risen_husk_spirit") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mobs_risen_husk_spiritAI : public ScriptedAI
{
- if (!UpdateVictim())
- return;
+ mobs_risen_husk_spiritAI(Creature* creature) : ScriptedAI(creature) { }
- if (m_uiConsumeFlesh_Timer <= uiDiff)
+ void Reset()
{
+ events.Reset();
if (me->GetEntry() == NPC_RISEN_HUSK)
- DoCast(me->getVictim(), SPELL_CONSUME_FLESH);
-
- m_uiConsumeFlesh_Timer = 15000;
+ events.ScheduleEvent(EVENT_CONSUME_FLESH, 5000);
+ else if (me->GetEntry() == NPC_RISEN_SPIRIT)
+ events.ScheduleEvent(EVENT_INTANGIBLE_PRESENCE, 5000);
}
- else
- m_uiConsumeFlesh_Timer -= uiDiff;
- if (m_uiIntangiblePresence_Timer <= uiDiff)
+ void JustDied(Unit* killer)
{
- if (me->GetEntry() == NPC_RISEN_SPIRIT)
- DoCast(me->getVictim(), SPELL_INTANGIBLE_PRESENCE);
-
- m_uiIntangiblePresence_Timer = 20000;
- }
- else
- m_uiIntangiblePresence_Timer -= uiDiff;
-
- DoMeleeAttackIfReady();
- }
-
- void JustDied(Unit* pKiller)
- {
- if (pKiller->GetTypeId() == TYPEID_PLAYER)
- if (CAST_PLR(pKiller)->GetQuestStatus(QUEST_WHATS_HAUNTING_WITCH_HILL) == QUEST_STATUS_INCOMPLETE)
+ if (killer->GetTypeId() == TYPEID_PLAYER)
{
- DoCast(pKiller, SPELL_SUMMON_RESTLESS_APPARITION, true);
- CAST_PLR(pKiller)->KilledMonsterCredit(NPC_RESTLESS_APPARITION, 0);
+ if (killer->ToPlayer()->GetQuestStatus(QUEST_WHATS_HAUNTING_WITCH_HILL) == QUEST_STATUS_INCOMPLETE)
+ {
+ DoCast(me, SPELL_SUMMON_RESTLESS_APPARITION, true);
+ DoCast(killer, SPELL_WITCH_HILL_INFORMATION_CREDIT, true);
+ }
}
- }
- };
-
-};
+ }
-/*######
-## npc_restless_apparition
-######*/
+ void UpdateAI(uint32 const diff)
+ {
+ if (!UpdateVictim())
+ return;
-enum eRestlessApparition
-{
- SAY_RESTLESS_1 = -1000469,
- SAY_RESTLESS_2 = -1000470,
- SAY_RESTLESS_3 = -1000471
-};
+ events.Update(diff);
-class npc_restless_apparition : public CreatureScript
-{
-public:
- npc_restless_apparition() : CreatureScript("npc_restless_apparition") { }
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_CONSUME_FLESH:
+ DoCastVictim(SPELL_CONSUME_FLESH);
+ events.ScheduleEvent(EVENT_CONSUME_FLESH, 15000);
+ break;
+ case EVENT_INTANGIBLE_PRESENCE:
+ DoCastVictim(SPELL_INTANGIBLE_PRESENCE);
+ events.ScheduleEvent(EVENT_INTANGIBLE_PRESENCE, 15000);
+ break;
+ default:
+ break;
+ }
+ }
- CreatureAI* GetAI(Creature* pCreature) const
- {
- return new npc_restless_apparitionAI (pCreature);
- }
+ DoMeleeAttackIfReady();
+ }
- struct npc_restless_apparitionAI : public ScriptedAI
- {
- npc_restless_apparitionAI(Creature* pCreature) : ScriptedAI(pCreature) {}
+ private:
+ EventMap events;
+ };
- void Reset()
+ CreatureAI* GetAI(Creature* creature) const
{
- DoScriptText(RAND(SAY_RESTLESS_1, SAY_RESTLESS_2, SAY_RESTLESS_3), me);
+ return new mobs_risen_husk_spiritAI (creature);
}
- };
-
};
/*######
@@ -580,9 +558,9 @@ public:
};
-/////////////////////
-/// npc_stinky
-/////////////////////
+/*######
+## npc_stinky
+######*/
enum eStinky
{
@@ -709,7 +687,6 @@ public:
void AddSC_dustwallow_marsh()
{
new mobs_risen_husk_spirit();
- new npc_restless_apparition();
new npc_lady_jaina_proudmoore();
new npc_nat_pagle();
new npc_private_hendel();