Scripts/Dustwallow Marsh: Fix quest 11180 (What's Haunting Witch Hill?)

Move some parts to SAI.
This commit is contained in:
kaelima
2011-05-07 17:30:17 +02:00
parent 617d77c3b3
commit 985c85f44e
2 changed files with 81 additions and 84 deletions

View File

@@ -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');

View File

@@ -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") { }
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()
struct mobs_risen_husk_spiritAI : public ScriptedAI
{
m_uiConsumeFlesh_Timer = 10000;
m_uiIntangiblePresence_Timer = 5000;
}
mobs_risen_husk_spiritAI(Creature* creature) : ScriptedAI(creature) { }
void UpdateAI(const uint32 uiDiff)
{
if (!UpdateVictim())
return;
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);
}
}
}
};
}
};
void UpdateAI(uint32 const diff)
{
if (!UpdateVictim())
return;
/*######
## npc_restless_apparition
######*/
events.Update(diff);
enum eRestlessApparition
{
SAY_RESTLESS_1 = -1000469,
SAY_RESTLESS_2 = -1000470,
SAY_RESTLESS_3 = -1000471
};
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;
}
}
class npc_restless_apparition : public CreatureScript
{
public:
npc_restless_apparition() : CreatureScript("npc_restless_apparition") { }
DoMeleeAttackIfReady();
}
CreatureAI* GetAI(Creature* pCreature) const
{
return new npc_restless_apparitionAI (pCreature);
}
private:
EventMap events;
};
struct npc_restless_apparitionAI : public ScriptedAI
{
npc_restless_apparitionAI(Creature* pCreature) : ScriptedAI(pCreature) {}
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();