Scripts/SholazarBasin: Make quest "Engineering a Disaster" more retail-like

* Use correct spells and add the appropriate spell scripts
* Use correct flame GOs
* Fix emotes of the escortee

(cherry picked from commit c08f086a02729f3b7e4c99f4741063e45301ebf8)
This commit is contained in:
Carbenium
2022-03-11 12:54:22 +01:00
committed by Shauren
parent 3623e1c7f2
commit 169c6a522b
2 changed files with 161 additions and 96 deletions
@@ -0,0 +1,41 @@
-- NPC Engineer Helice
UPDATE creature_text SET emote = 5 WHERE CreatureID = 28787 AND GroupID = 0;
UPDATE creature_text SET emote = 25 WHERE CreatureID = 28787 AND GroupID = 1;
UPDATE creature_text SET emote = 11 WHERE CreatureID = 28787 AND GroupID = 3;
UPDATE creature_text SET emote = 25 WHERE CreatureID = 28787 AND GroupID = 4;
UPDATE creature_text SET emote = 5 WHERE CreatureID = 28787 AND GroupID = 5;
UPDATE creature_text SET emote = 4 WHERE CreatureID = 28787 AND GroupID = 6;
DELETE FROM conditions WHERE SourceTypeOrReferenceId = 13 AND SourceEntry IN (52369, 52371);
INSERT INTO conditions (SourceTypeOrReferenceId, SourceGroup, SourceEntry, SourceId, ElseGroup, ConditionTypeOrReference, ConditionTarget, ConditionValue1, ConditionValue2, ConditionValue3, NegativeCondition, ErrorType, ErrorTextId, ScriptName, Comment) VALUES
(13, 1, 52369, 0, 0, 31, 0, 3, 28789, 0, 0, 0, 0, '', 'Spell ''Detonate Explosives'' targets trigger'),
(13, 1, 52371, 0, 0, 31, 0, 3, 28789, 0, 0, 0, 0, '', 'Spell ''Detonate Explosives'' targets trigger');
DELETE FROM spell_script_names WHERE spell_id IN (52369, 52371);
INSERT INTO spell_script_names (spell_id, ScriptName) VALUES
(52369, 'spell_q12688_detonate_1'),
(52371, 'spell_q12688_detonate_2');
-- Flames
DELETE FROM gameobject WHERE guid IN (9577, 9578, 9579, 9598, 9599, 9600);
INSERT INTO gameobject (guid, id, map, zoneId, areaId, spawnDifficulties, phaseId, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, ScriptName, VerifiedBuild) VALUES
(9577, 182071, 571, 0, 0, '0', 0, 5921.53, 5371.77, -96.3387, 0, 0, 0, 0.688354, 0.725374, 0, 0, 1, '', 0),
(9578, 182071, 571, 0, 0, '0', 0, 5919.42, 5366.92, -96.0911, 0, 0, 0, 0.608761, 0.793354, 0, 0, 1, '', 0),
(9579, 182071, 571, 0, 0, '0', 0, 5920.25, 5372.41, -98.8582, 0, 0, 0, -0.325567, 0.945519, 0, 0, 1, '', 0),
(9598, 182071, 571, 0, 0, '0', 0, 5888.68, 5377.42, -92.6171, 0, 0, 0, 0.9612608, 0.2756405, 0, 0, 1, '', 0),
(9599, 182071, 571, 0, 0, '0', 0, 5886.48, 5379.05, -92.9799, 0, 0, 0, 0.41469288, 0.90996146, 0, 0, 1, '', 0),
(9600, 182071, 571, 0, 0, '0', 0, 5887.20, 5381.18, -93.5000, 0, 0, 0, 0.061048508, 0.9981348, 0, 0, 1, '', 0);
DELETE FROM spawn_group_template WHERE groupId IN (67, 68);
INSERT INTO spawn_group_template (groupId, groupName, groupFlags) VALUES
(67, 'Quest "Engineering a Disaster" (12688) - Spell Detonate (52369)', 4),
(68, 'Quest "Engineering a Disaster" (12688) - Spell Detonate (52371)', 4);
DELETE FROM spawn_group WHERE groupId IN (67, 68);
INSERT INTO spawn_group (groupId, spawnType, spawnId) VALUES
(67, 1, 9577),
(67, 1, 9578),
(67, 1, 9579),
(68, 1, 9598),
(68, 1, 9599),
(68, 1, 9600);
@@ -26,6 +26,7 @@
#include "SpellAuras.h"
#include "SpellScript.h"
#include "Vehicle.h"
#include "GameObject.h"
/*######
## npc_engineer_helice
@@ -34,8 +35,9 @@
enum EngineerHelice
{
// Spells
SPELL_EXPLODE_CRYSTAL = 62487,
SPELL_FLAMES = 64561,
SPELL_DETONATE_1 = 52369,
SPELL_DETONATE_2 = 52371,
SPELL_EXPLOSION = 46419,
// Yells
SAY_WP_1 = 0,
@@ -50,29 +52,12 @@ enum EngineerHelice
QUEST_DISASTER = 12688
};
class npc_engineer_helice : public CreatureScript
struct npc_engineer_helice : public EscortAI
{
public:
npc_engineer_helice() : CreatureScript("npc_engineer_helice") { }
struct npc_engineer_heliceAI : public EscortAI
{
npc_engineer_heliceAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
void Initialize()
{
m_uiChatTimer = 4000;
}
uint32 m_uiChatTimer;
npc_engineer_helice(Creature* creature) : EscortAI(creature) { }
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
switch (waypointId)
{
case 0:
@@ -80,39 +65,29 @@ public:
break;
case 1:
Talk(SAY_WP_3);
me->CastSpell(Position{ 5918.33f, 5372.91f, -98.770f }, SPELL_EXPLODE_CRYSTAL, true);
me->SummonGameObject(184743, 5918.33f, 5372.91f, -98.770f, 0, QuaternionData(), 3s, GO_SUMMON_TIMED_DESPAWN);
me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);
break;
case 2:
Talk(SAY_WP_4);
DoCast(SPELL_DETONATE_1);
break;
case 7:
Talk(SAY_WP_5);
break;
case 8:
me->CastSpell(Position{ 5887.37f, 5379.39f, -91.289f }, SPELL_EXPLODE_CRYSTAL, true);
me->SummonGameObject(184743, 5887.37f, 5379.39f, -91.289f, 0, QuaternionData(), 3s, GO_SUMMON_TIMED_DESPAWN);
me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);
DoCast(SPELL_DETONATE_2);
break;
case 9:
Talk(SAY_WP_6);
break;
case 13:
if (player)
if (Player* player = GetPlayerForEscort())
{
player->GroupEventHappens(QUEST_DISASTER, me);
Talk(SAY_WP_7);
}
break;
default:
break;
}
}
void Reset() override
{
Initialize();
}
void JustDied(Unit* /*killer*/) override
{
if (HasEscortState(STATE_ESCORT_ESCORTING))
@@ -122,37 +97,84 @@ public:
}
}
void UpdateAI(uint32 uiDiff) override
{
EscortAI::UpdateAI(uiDiff);
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
if (m_uiChatTimer <= uiDiff)
{
m_uiChatTimer = 12000;
}
else
m_uiChatTimer -= uiDiff;
}
}
void OnQuestAccept(Player* player, Quest const* quest) override
{
if (quest->GetQuestId() == QUEST_DISASTER)
{
me->GetMotionMaster()->MoveJumpTo(0, 0.4f, 0.4f);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
Start(false, false, player->GetGUID());
Talk(SAY_WP_1);
}
}
};
};
CreatureAI* GetAI(Creature* creature) const override
class spell_q12688_detonate_1 : public SpellScript
{
PrepareSpellScript(spell_q12688_detonate_1);
static constexpr uint32 SPAWN_GROUP_FLAMES = 67;
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return new npc_engineer_heliceAI(creature);
return ValidateSpellInfo({ SPELL_EXPLOSION });
}
void HandleDummyEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
{
target->CastSpell(target, SPELL_EXPLOSION);
std::vector<WorldObject*> flames;
target->GetMap()->SpawnGroupSpawn(SPAWN_GROUP_FLAMES, false, false, &flames);
target->GetMap()->SetSpawnGroupInactive(SPAWN_GROUP_FLAMES);
for (WorldObject* flame : flames)
dynamic_cast<GameObject*>(flame)->DespawnOrUnsummon(20s);
}
}
void HandleAfterHit()
{
if (Creature* caster = GetCaster()->ToCreature())
caster->AI()->Talk(EngineerHelice::SAY_WP_4);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q12688_detonate_1::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
AfterHit += SpellHitFn(spell_q12688_detonate_1::HandleAfterHit);
}
};
class spell_q12688_detonate_2 : public SpellScript
{
PrepareSpellScript(spell_q12688_detonate_2);
static constexpr uint32 SPAWN_GROUP_FLAMES = 68;
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_EXPLOSION });
}
void HandleDummyEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
{
target->CastSpell(target, SPELL_EXPLOSION);
std::vector<WorldObject*> flames;
target->GetMap()->SpawnGroupSpawn(SPAWN_GROUP_FLAMES, false, false, &flames);
target->GetMap()->SetSpawnGroupInactive(SPAWN_GROUP_FLAMES);
for (WorldObject* flame : flames)
dynamic_cast<GameObject*>(flame)->DespawnOrUnsummon(20s);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q12688_detonate_2::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -692,7 +714,9 @@ class spell_q12611_deathbolt : public SpellScript
void AddSC_sholazar_basin()
{
new npc_engineer_helice();
RegisterCreatureAI(npc_engineer_helice);
RegisterSpellScript(spell_q12688_detonate_1);
RegisterSpellScript(spell_q12688_detonate_2);
new npc_jungle_punch_target();
new spell_q12620_the_lifewarden_wrath();
new spell_q12589_shoot_rjr();