mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Scripts/DunMorogh: Implement Quest "Decontamination" (#29542)
This commit is contained in:
85
sql/updates/world/master/2024_01_01_02_world.sql
Normal file
85
sql/updates/world/master/2024_01_01_02_world.sql
Normal file
@@ -0,0 +1,85 @@
|
||||
-- Update Template
|
||||
UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'npc_sanitron_5000' WHERE `entry` = 46185;
|
||||
|
||||
UPDATE `creature` SET `StringId` = 'SanitronLeft' WHERE `guid` = 304775;
|
||||
UPDATE `creature` SET `StringId` = 'SanitronMiddle' WHERE `guid` = 304772;
|
||||
UPDATE `creature` SET `StringId` = 'SanitronRight' WHERE `guid` = 304773;
|
||||
|
||||
UPDATE `creature` SET `StringId` = 'DecontaminationStageOne' WHERE `guid` IN (304788, 304784);
|
||||
UPDATE `creature` SET `StringId` = 'DecontaminationStageTwo' WHERE `guid` IN (304782, 304787);
|
||||
UPDATE `creature` SET `StringId` = 'DecontaminationStageThree' WHERE `guid` IN (304783, 304793);
|
||||
|
||||
UPDATE `creature` SET `StringId` = 'SafeTechnicianSayText' WHERE `guid` = 304777;
|
||||
UPDATE `creature` SET `ScriptName` = 'npc_safe_technician_sanitron', `StringId` = 'SafeTechnicianSanitron' WHERE `guid` = 304803;
|
||||
|
||||
-- Update Template Addon
|
||||
UPDATE `creature_template_addon` SET `SheathState`=2 WHERE `entry`=45847; -- 45847 (S.A.F.E. Operative)
|
||||
UPDATE `creature_template_addon` SET `visibilityDistanceType`=3 WHERE `entry`=46208; -- 46208 (Clean Cannon X-2)
|
||||
|
||||
-- Creature Difficulty
|
||||
UPDATE `creature_template_difficulty` SET `ContentTuningID`=74, `VerifiedBuild`=52607 WHERE (`Entry`=46391 AND `DifficultyID`=0); -- Crazed Leper Gnome
|
||||
|
||||
-- Creature Text
|
||||
DELETE FROM `creature_text` WHERE `CreatureID` = 46185;
|
||||
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
|
||||
(46185, 0, 0, 'Commencing decontamination sequence... ', 12, 0, 100, 0, 0, 0, 46323, 0, 'Sanitron 500 to Player'),
|
||||
(46185, 1, 0, 'Decontamination complete. Standby for delivery.', 12, 0, 100, 0, 0, 0, 46324, 0, 'Sanitron 500 to Player'),
|
||||
(46185, 2, 0, 'Warning, system overload. Malfunction imminent!', 12, 0, 100, 0, 0, 0, 46325, 0, 'Sanitron 500 to Player');
|
||||
|
||||
-- Creature Movement
|
||||
DELETE FROM `creature_template_movement` WHERE `CreatureID` = 46185;
|
||||
INSERT INTO `creature_template_movement` (`CreatureId`, `Ground`, `Swim`, `Flight`, `Rooted`, `Chase`, `Random`, `InteractionPauseTimer`) VALUES
|
||||
(46185, 0, 0, 1, 0, 0, 0, NULL);
|
||||
|
||||
-- Quest stuff
|
||||
DELETE FROM `quest_request_items` WHERE `ID`=27635;
|
||||
INSERT INTO `quest_request_items` (`ID`, `EmoteOnComplete`, `EmoteOnIncomplete`, `EmoteOnCompleteDelay`, `EmoteOnIncompleteDelay`, `CompletionText`, `VerifiedBuild`) VALUES
|
||||
(27635, 0, 1, 0, 0, 'I bet you\'re feeling better already.', 52607); -- Decontamination
|
||||
|
||||
-- Condition
|
||||
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 18 AND `SourceGroup` = 46185 AND `SourceEntry` = 86106;
|
||||
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
|
||||
(18, 46185, 86106, 0, 0, 47, 0, 27635, 8, 0, 0, 0, 0, '', 'Allow Spellclick if Quest 27635 is in progress');
|
||||
|
||||
-- SendEvent: 26534
|
||||
SET @EVENTID := 26534;
|
||||
DELETE FROM `event_script_names` WHERE `Id` = @EVENTID;
|
||||
INSERT INTO `event_script_names` (`Id`, `ScriptName`) VALUES
|
||||
(@EVENTID, 'SmartEventTrigger');
|
||||
|
||||
DELETE FROM `smart_scripts` WHERE `source_type` = 3 AND `entryOrGuid` = @EVENTID;
|
||||
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
|
||||
(@EVENTID, 3, 0, 0, 87, 0, 100, 0, 0, 0, 0, 0, 28, 80653, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On SendEvent: 26534 - remove Aura "Irradiated" - to self');
|
||||
|
||||
-- Path for Sanitron 5000 (left)
|
||||
SET @ENTRY := 46185;
|
||||
SET @PATHOFFSET := 0;
|
||||
SET @PATH := @ENTRY * 100 + @PATHOFFSET;
|
||||
DELETE FROM `waypoint_data` WHERE `id`= @PATH;
|
||||
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`) VALUES
|
||||
(@PATH, 0, -5169.338, 725.4744, 290.8398, NULL, 2343),
|
||||
(@PATH, 1, -5170.238, 717.5745, 289.9582, NULL, 4087),
|
||||
(@PATH, 2, -5170.56, 706.8755, 291.4106, NULL, 2973),
|
||||
(@PATH, 3, -5170.71, 701.8777, 291.4106, NULL, 0);
|
||||
|
||||
-- Path for Sanitron 5000 (middle)
|
||||
SET @ENTRY := 46185;
|
||||
SET @PATHOFFSET := 1;
|
||||
SET @PATH := @ENTRY * 100 + @PATHOFFSET;
|
||||
DELETE FROM `waypoint_data` WHERE `id`= @PATH;
|
||||
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`) VALUES
|
||||
(@PATH, 0, -5173.613, 726.069, 290.8889, NULL, 1240),
|
||||
(@PATH, 1, -5174.34, 718.1465, 289.9154, NULL, 4101),
|
||||
(@PATH, 2, -5174.679, 707.4569, 291.6958, NULL, 2965),
|
||||
(@PATH, 3, -5174.837, 702.4594, 291.6958, NULL, 0);
|
||||
|
||||
-- Path for Sanitron 5000 (right)
|
||||
SET @ENTRY := 46185;
|
||||
SET @PATHOFFSET := 2;
|
||||
SET @PATH := @ENTRY * 100 + @PATHOFFSET;
|
||||
DELETE FROM `waypoint_data` WHERE `id`= @PATH;
|
||||
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`) VALUES
|
||||
(@PATH, 0, -5178.169, 727.0316, 290.8698, NULL, 1482),
|
||||
(@PATH, 1, -5178.966, 718.7164, 289.9154, NULL, 5117),
|
||||
(@PATH, 2, -5179.144, 708.0433, 291.6927, NULL, 2966),
|
||||
(@PATH, 3, -5179.227, 703.0439, 291.6927, NULL, 0);
|
||||
@@ -15,9 +15,14 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "AreaTrigger.h"
|
||||
#include "AreaTriggerAI.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "PassiveAI.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
enum FrozenMountaineer
|
||||
{
|
||||
@@ -83,7 +88,216 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
enum DecontaminationData
|
||||
{
|
||||
NPC_DECONTAMINATION_BUNNY = 46165,
|
||||
NPC_CLEAN_CANNON_X2 = 46208,
|
||||
NPC_SANITRON_5000 = 46185,
|
||||
NPC_SAFE_TECHNICIAN = 46230,
|
||||
|
||||
SAY_SANITRON_START = 0,
|
||||
SAY_SANITRON_FINISH = 1,
|
||||
SAY_SANITRON_DESTROY = 2,
|
||||
|
||||
SAY_TECHNICIAN_CLEAN_CANNON = 0,
|
||||
SAY_TECHNICIAN_SANITRON_DESTROY = 1,
|
||||
|
||||
PATH_SANITRON_LEFT_START = 4618500,
|
||||
PATH_SANITRON_MIDDLE_START = 4618501,
|
||||
PATH_SANITRON_RIGHT_START = 4618502,
|
||||
|
||||
WAYPOINT_SANITRON_STAGE_ONE = 0,
|
||||
WAYPOINT_SANITRON_STAGE_TWO = 1,
|
||||
WAYPOINT_SANITRON_STAGE_THREE = 2,
|
||||
WAYPOINT_SANITRON_FINISH = 3,
|
||||
|
||||
ACTION_TECHNICIAN_START_EVENT = 1,
|
||||
|
||||
POINT_SAFE_TECHNICIAN_SANITRON = 1,
|
||||
POINT_SAFE_TECHNICIAN_FINISH = 2,
|
||||
|
||||
SPELL_DECONTAMINATE_STAGE_1 = 86075,
|
||||
SPELL_DECONTAMINATE_STAGE_2 = 86098,
|
||||
SPELL_DECONTAMINATE_STAGE_3 = 86086,
|
||||
SPELL_CLEAN_CANNON_CLEAN_BURST = 86080,
|
||||
SPELL_FORCE_CAST_GNOMEREGAN_AURA = 86298,
|
||||
SPELL_SANITRON_COSMETIC_EXPLOSION = 46419
|
||||
};
|
||||
|
||||
// 46185 - Sanitron 5000
|
||||
struct npc_sanitron_5000 : public NullCreatureAI
|
||||
{
|
||||
npc_sanitron_5000(Creature* creature) : NullCreatureAI(creature) { }
|
||||
|
||||
uint32 GetPathId() const
|
||||
{
|
||||
if (me->HasStringId("SanitronLeft"))
|
||||
return PATH_SANITRON_LEFT_START;
|
||||
else if (me->HasStringId("SanitronMiddle"))
|
||||
return PATH_SANITRON_MIDDLE_START;
|
||||
else if (me->HasStringId("SanitronRight"))
|
||||
return PATH_SANITRON_RIGHT_START;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PassengerBoarded(Unit* passenger, int8 /*seatId*/, bool apply) override
|
||||
{
|
||||
if (!apply)
|
||||
return;
|
||||
|
||||
Player* player = passenger->ToPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
Talk(SAY_SANITRON_START);
|
||||
player->TalkedToCreature(me->GetEntry(), me->GetGUID());
|
||||
me->GetMotionMaster()->MovePath(GetPathId(), false);
|
||||
}
|
||||
|
||||
void ForceCastOnPassenger(FindCreatureOptions const& options, uint32 spellId)
|
||||
{
|
||||
std::list<Creature*> bunnys;
|
||||
me->GetCreatureListWithOptionsInGrid(bunnys, 20.0f, options);
|
||||
|
||||
Vehicle* veh = me->GetVehicleKit();
|
||||
if (!veh)
|
||||
return;
|
||||
|
||||
Unit* passenger = veh->GetPassenger(0);
|
||||
if (!passenger)
|
||||
return;
|
||||
|
||||
for (Creature* bunny : bunnys)
|
||||
{
|
||||
bunny->CastSpell(passenger, spellId, false);
|
||||
}
|
||||
}
|
||||
|
||||
void WaypointReached(uint32 waypointId, uint32 pathId) override
|
||||
{
|
||||
if (pathId == PATH_SANITRON_LEFT_START || pathId == PATH_SANITRON_MIDDLE_START || pathId == PATH_SANITRON_RIGHT_START)
|
||||
{
|
||||
if (waypointId == WAYPOINT_SANITRON_STAGE_ONE)
|
||||
ForceCastOnPassenger({ .CreatureId = NPC_DECONTAMINATION_BUNNY, .StringId = "DecontaminationStageOne" }, SPELL_DECONTAMINATE_STAGE_1);
|
||||
else if (waypointId == WAYPOINT_SANITRON_STAGE_TWO)
|
||||
{
|
||||
ForceCastOnPassenger({ .CreatureId = NPC_CLEAN_CANNON_X2 }, SPELL_CLEAN_CANNON_CLEAN_BURST);
|
||||
ForceCastOnPassenger({ .CreatureId = NPC_DECONTAMINATION_BUNNY, .StringId = "DecontaminationStageTwo" }, SPELL_DECONTAMINATE_STAGE_2);
|
||||
}
|
||||
else if (waypointId == WAYPOINT_SANITRON_STAGE_THREE)
|
||||
ForceCastOnPassenger({ .CreatureId = NPC_DECONTAMINATION_BUNNY, .StringId = "DecontaminationStageThree" }, SPELL_DECONTAMINATE_STAGE_3);
|
||||
else if (waypointId == WAYPOINT_SANITRON_FINISH)
|
||||
{
|
||||
_scheduler.Schedule(2s, [this](TaskContext task)
|
||||
{
|
||||
Talk(SAY_SANITRON_DESTROY);
|
||||
DoCast(SPELL_SANITRON_COSMETIC_EXPLOSION);
|
||||
task.Schedule(1s, [this](TaskContext /*task*/)
|
||||
{
|
||||
if (Creature* technician = me->FindNearestCreatureWithOptions(30.0f, { .CreatureId = NPC_SAFE_TECHNICIAN, .StringId = "SafeTechnicianSanitron" }))
|
||||
technician->AI()->DoAction(ACTION_TECHNICIAN_START_EVENT);
|
||||
|
||||
me->KillSelf();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WaypointStarted(uint32 waypointId, uint32 pathId) override
|
||||
{
|
||||
if (pathId == PATH_SANITRON_LEFT_START || pathId == PATH_SANITRON_MIDDLE_START || pathId == PATH_SANITRON_RIGHT_START)
|
||||
{
|
||||
if (waypointId == WAYPOINT_SANITRON_STAGE_THREE)
|
||||
{
|
||||
if (Creature* technician = me->FindNearestCreatureWithOptions(30.0f, { .CreatureId = NPC_SAFE_TECHNICIAN, .StringId = "SafeTechnicianSayText" }))
|
||||
technician->AI()->Talk(SAY_TECHNICIAN_CLEAN_CANNON);
|
||||
}
|
||||
else if (waypointId == WAYPOINT_SANITRON_FINISH)
|
||||
{
|
||||
Talk(SAY_SANITRON_FINISH);
|
||||
DoCast(SPELL_FORCE_CAST_GNOMEREGAN_AURA);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
|
||||
private:
|
||||
TaskScheduler _scheduler;
|
||||
};
|
||||
|
||||
Position const SafeTechnicianSanitron = { -5178.169f, 696.795f, 288.22797f };
|
||||
|
||||
// 46230 - S.A.F.E Technician
|
||||
struct npc_safe_technician_sanitron : public NullCreatureAI
|
||||
{
|
||||
npc_safe_technician_sanitron(Creature* creature) : NullCreatureAI(creature), _isEventStarted(false) { }
|
||||
|
||||
void DoAction(int32 action) override
|
||||
{
|
||||
if (action == ACTION_TECHNICIAN_START_EVENT)
|
||||
{
|
||||
if (!_isEventStarted)
|
||||
{
|
||||
_isEventStarted = true;
|
||||
me->SetEmoteState(EMOTE_STATE_NONE);
|
||||
me->SetFacingTo(0.2967f);
|
||||
_scheduler.Schedule(2s + 500ms, [this](TaskContext /*task*/)
|
||||
{
|
||||
me->GetMotionMaster()->MovePoint(POINT_SAFE_TECHNICIAN_SANITRON, SafeTechnicianSanitron);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MovementInform(uint32 type, uint32 pointId) override
|
||||
{
|
||||
if (type != POINT_MOTION_TYPE)
|
||||
return;
|
||||
|
||||
if (pointId == POINT_SAFE_TECHNICIAN_SANITRON)
|
||||
{
|
||||
me->SetFacingTo(1.5009f);
|
||||
_scheduler.Schedule(1s, [this](TaskContext task)
|
||||
{
|
||||
Talk(SAY_TECHNICIAN_SANITRON_DESTROY);
|
||||
task.Schedule(2s, [this](TaskContext task)
|
||||
{
|
||||
me->SetEmoteState(EMOTE_STATE_USESTANDING);
|
||||
task.Schedule(5s, [this](TaskContext /*task*/)
|
||||
{
|
||||
me->SetWalk(true);
|
||||
me->SetEmoteState(EMOTE_STATE_NONE);
|
||||
me->GetMotionMaster()->MovePoint(POINT_SAFE_TECHNICIAN_FINISH, me->GetHomePosition(), true, me->GetHomePosition().GetOrientation());
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
else if (pointId == POINT_SAFE_TECHNICIAN_FINISH)
|
||||
{
|
||||
me->SetEmoteState(EMOTE_STATE_WORK_MINING);
|
||||
_isEventStarted = false;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
|
||||
private:
|
||||
TaskScheduler _scheduler;
|
||||
bool _isEventStarted;
|
||||
};
|
||||
|
||||
void AddSC_dun_morogh()
|
||||
{
|
||||
// Creature
|
||||
new npc_frozen_mountaineer();
|
||||
RegisterCreatureAI(npc_sanitron_5000);
|
||||
RegisterCreatureAI(npc_safe_technician_sanitron);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user