mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 02:04:52 +01:00
Scripting/Eversong_Woods: Add quest end scripting for quest 8487.
Also fixes for quest 8488 but not completely fixed.
This commit is contained in:
4
sql/updates/world/2013_11_23_0_world_creature_text.sql
Normal file
4
sql/updates/world/2013_11_23_0_world_creature_text.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
-- NPC talk text for Apprentice Mirveda
|
||||
DELETE FROM `creature_text` WHERE `entry`=15402;
|
||||
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
|
||||
(15402,0,0, 'Such... dark... energy! How can this be possible?',12,0,100,0,0,0, 'Apprentice Mirveda');
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
/* ScriptData
|
||||
SDName: Eversong_Woods
|
||||
SD%Complete: 100
|
||||
SDComment: Quest support: 8488, 8490
|
||||
SD%Complete: 95
|
||||
SDComment: Quest support: 8487, 8488, 8490
|
||||
SDCategory: Eversong Woods
|
||||
EndScriptData */
|
||||
|
||||
@@ -37,11 +37,29 @@ EndContentData */
|
||||
enum UnexpectedResults
|
||||
{
|
||||
// Quest
|
||||
QUEST_CORRUPTED_SOIL = 8487,
|
||||
QUEST_UNEXPECTED_RESULT = 8488,
|
||||
|
||||
// Creatures
|
||||
NPC_GHARZUL = 15958,
|
||||
NPC_ANGERSHADE = 15656
|
||||
NPC_GHARZUL = 15958, // Quest 8488
|
||||
NPC_ANGERSHADE = 15656, // Quest 8488
|
||||
|
||||
// Factions
|
||||
FACTION_NORMAL = 1604, // Quest 8488
|
||||
FACTION_COMBAT = 232, // Quest 8488
|
||||
|
||||
// Spells
|
||||
SPELL_TEST_SOIL = 29535, // Quest 8487
|
||||
SPELL_FIREBALL = 20811, // Quest 8488
|
||||
|
||||
// Text
|
||||
SAY_TEST_SOIL = 0, // Quest 8487
|
||||
|
||||
// Events
|
||||
EVENT_TALK = 1, // Quest 8487
|
||||
EVENT_ADD_QUEST_GIVER_FLAG = 2, // Quest 8487
|
||||
EVENT_SUMMON = 3, // Quest 8488
|
||||
EVENT_FIREBALL = 4 // Quest 8488
|
||||
};
|
||||
|
||||
class npc_apprentice_mirveda : public CreatureScript
|
||||
@@ -49,10 +67,25 @@ class npc_apprentice_mirveda : public CreatureScript
|
||||
public:
|
||||
npc_apprentice_mirveda() : CreatureScript("npc_apprentice_mirveda") { }
|
||||
|
||||
bool OnQuestReward(Player* player, Creature* creature, const Quest *_Quest, uint32 /*slot*/) OVERRIDE
|
||||
{
|
||||
if (_Quest->GetQuestId() == QUEST_CORRUPTED_SOIL)
|
||||
{
|
||||
CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, creature->AI())->me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
|
||||
CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, creature->AI())->events.ScheduleEvent(EVENT_TALK, 2000);
|
||||
CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, creature->AI())->CorruptedSoil = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE
|
||||
{
|
||||
if (quest->GetQuestId() == QUEST_UNEXPECTED_RESULT)
|
||||
{
|
||||
CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, creature->AI())->me->setFaction(FACTION_COMBAT);
|
||||
CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, creature->AI())->me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
|
||||
|
||||
CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, creature->AI())->events.ScheduleEvent(EVENT_SUMMON, 1000);
|
||||
CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, creature->AI())->Summon = true;
|
||||
CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, creature->AI())->PlayerGUID = player->GetGUID();
|
||||
}
|
||||
@@ -70,26 +103,35 @@ public:
|
||||
|
||||
uint32 KillCount;
|
||||
uint64 PlayerGUID;
|
||||
bool CorruptedSoil;
|
||||
bool Summon;
|
||||
SummonList Summons;
|
||||
EventMap events;
|
||||
|
||||
void Reset() OVERRIDE
|
||||
{
|
||||
SetCombatMovement(false);
|
||||
KillCount = 0;
|
||||
PlayerGUID = 0;
|
||||
Summons.DespawnAll();
|
||||
CorruptedSoil = false;
|
||||
Summon = false;
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) OVERRIDE { }
|
||||
void EnterCombat(Unit* /*who*/) OVERRIDE
|
||||
{
|
||||
events.ScheduleEvent(EVENT_FIREBALL, 1000);
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* summoned) OVERRIDE
|
||||
{
|
||||
summoned->AI()->AttackStart(me);
|
||||
// This is the best I can do because AttackStart does nothing
|
||||
summoned->GetMotionMaster()->MovePoint(1, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
|
||||
// summoned->AI()->AttackStart(me);
|
||||
Summons.Summon(summoned);
|
||||
}
|
||||
|
||||
void SummonedCreatureDespawn(Creature* summoned) OVERRIDE
|
||||
void SummonedCreatureDies(Creature* summoned, Unit* who) OVERRIDE
|
||||
{
|
||||
Summons.Despawn(summoned);
|
||||
++KillCount;
|
||||
@@ -97,24 +139,61 @@ public:
|
||||
|
||||
void JustDied(Unit* /*killer*/) OVERRIDE
|
||||
{
|
||||
me->setFaction(FACTION_NORMAL);
|
||||
|
||||
if (PlayerGUID)
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
player->FailQuest(QUEST_UNEXPECTED_RESULT);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 /*diff*/) OVERRIDE
|
||||
void UpdateAI(uint32 diff) OVERRIDE
|
||||
{
|
||||
if (KillCount >= 3 && PlayerGUID)
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
player->CompleteQuest(QUEST_UNEXPECTED_RESULT);
|
||||
if (player->GetQuestStatus(QUEST_UNEXPECTED_RESULT) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
player->CompleteQuest(QUEST_UNEXPECTED_RESULT);
|
||||
me->setFaction(FACTION_NORMAL);
|
||||
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
|
||||
}
|
||||
|
||||
if (Summon)
|
||||
events.Update(diff);
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
me->SummonCreature(NPC_GHARZUL, 8745, -7134.32f, 35.22f, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000);
|
||||
me->SummonCreature(NPC_ANGERSHADE, 8745, -7134.32f, 35.22f, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000);
|
||||
me->SummonCreature(NPC_ANGERSHADE, 8745, -7134.32f, 35.22f, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000);
|
||||
Summon = false;
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_TALK:
|
||||
if (!CorruptedSoil)
|
||||
continue;
|
||||
Talk(SAY_TEST_SOIL);
|
||||
events.ScheduleEvent(EVENT_ADD_QUEST_GIVER_FLAG, 7000);
|
||||
break;
|
||||
case EVENT_ADD_QUEST_GIVER_FLAG:
|
||||
if (!CorruptedSoil)
|
||||
continue;
|
||||
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
|
||||
CorruptedSoil = false;
|
||||
break;
|
||||
case EVENT_SUMMON:
|
||||
if (!Summon)
|
||||
continue;
|
||||
me->SummonCreature(NPC_GHARZUL, 8749.505f, -7132.595f, 35.31983f, 3.816502f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 180000);
|
||||
me->SummonCreature(NPC_ANGERSHADE, 8755.38f, -7131.521f, 35.30957f, 3.816502f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 180000);
|
||||
me->SummonCreature(NPC_ANGERSHADE, 8753.199f, -7125.975f, 35.31986f, 3.816502f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 180000);
|
||||
Summon = false;
|
||||
break;
|
||||
case EVENT_FIREBALL:
|
||||
if (!UpdateVictim())
|
||||
continue;
|
||||
DoCastVictim(SPELL_FIREBALL, true);
|
||||
events.ScheduleEvent(EVENT_FIREBALL, 3000);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user