Scripts/Outland: Convert 'Captain Tyralius' to SAI (#25188)

Closes #24676

(cherry picked from commit 7f2874a7ac)
This commit is contained in:
Trond B. Krokli
2020-08-03 20:06:20 +02:00
committed by Shauren
parent 7c65cee78a
commit c324f954ce
2 changed files with 24 additions and 97 deletions

View File

@@ -0,0 +1,24 @@
--
-- Captain Tyralius's Prison SAI
UPDATE `gameobject` SET `spawntimesecs` = 60 WHERE `id` = 184588 AND `guid` = 25412;
UPDATE `gameobject_template` SET `AIName` = "SmartGameObjectAI", `ScriptName` = "" WHERE `entry` = 184588;
DELETE FROM `smart_scripts` WHERE `entryorguid` = 184588 AND `source_type` = 1;
DELETE FROM `smart_scripts` WHERE `entryorguid` = 18458800 AND `source_type` = 9;
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`,`event_param5`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_param4`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(184588, 1,0,0,11,0,100,0,0,0,0,0,0,12, 20787,8,0,0,0,0, 1, 0,0,0,0,0,0,0,0,"Captain Tyralius's Prison - On Respawn - Summon Creature 'Captain Tyralius'"),
(184588, 1,1,0,11,0,100,0,0,0,0,0,0,12, 20825,8,0,0,0,0, 1, 0,0,0,0,0,0,0,0,"Captain Tyralius's Prison - On Respawn - Summon Creature 'Ethereum Prisoner (Tyralius)'"),
(184588, 1,2,0,64,0,100,0,1,0,0,0,0,80,18458800,0,0,0,0,0, 1, 0,0,0,0,0,0,0,0,"Captain Tyralius's Prison - On Gossip Hello - Run Script"),
(18458800,9,0,0, 0,0,100,0,0,0,0,0,0,99, 3,0,0,0,0,0, 1, 0,0,0,0,0,0,0,0,"Captain Tyralius's Prison - On Script - Set Lootstate Deactivated"),
(18458800,9,1,0, 0,0,100,0,0,0,0,0,0,33, 20787,0,0,0,0,0, 7, 0,0,0,0,0,0,0,0,"Captain Tyralius's Prison - On Script - Quest Credit 'Captain Tyralius'"),
(18458800,9,2,0, 0,0,100,0,0,0,0,0,0, 1, 0,0,0,0,0,0,19,20787,5,0,0,0,0,0,0,"Captain Tyralius's Prison - On Script - Say Line 0 (Captain Tyralius)"),
(18458800,9,3,0, 0,0,100,0,0,0,0,0,0,41, 0,0,0,0,0,0,19,20825,5,0,0,0,0,0,0,"Captain Tyralius's Prison - On Script - Despawn (0) (Ethereum Prisoner (Tyralius))"),
(18458800,9,4,0, 0,0,100,0,0,0,0,0,0,45, 0,1,0,0,0,0,19,20787,5,0,0,0,0,0,0,"Captain Tyralius's Prison - On Script - Set Data 0 1 (Captain Tyralius)");
-- Captain Tyralius SAI
UPDATE `creature_template` SET `AIName` = "SmartAI", `ScriptName` = "" WHERE `entry` = 20787;
DELETE FROM `smart_scripts` WHERE `entryorguid` = 20787 AND `source_type` = 0;
DELETE FROM `smart_scripts` WHERE `entryorguid` = 2078700 AND `source_type` = 9;
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`,`event_param5`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_param4`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(20787, 0,0,0,38,0,100,0, 0, 1,0,0,0,80,2078700,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"Captain Tyralius - On Data Set 0 1 - Run Script"),
(2078700,9,0,0, 0,0,100,0,5000,5000,0,0,0,11, 51347,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"Captain Tyralius - On Script - Cast 'Teleport Visual Only'"),
(2078700,9,1,0, 0,0,100,0, 0, 0,0,0,0,41, 2000,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"Captain Tyralius - On Script - Despawn (2000)");

View File

@@ -24,7 +24,6 @@ EndScriptData */
/* ContentData
npc_commander_dawnforge
go_captain_tyralius_prison
EndContentData */
#include "ScriptMgr.h"
@@ -462,105 +461,9 @@ public:
};
};
/*######
## go_captain_tyralius_prison
######*/
enum CaptainTyralius
{
NPC_CAPTAIN_TYRALIUS = 20787,
NPC_ETHEREUM_PRISONER = 20825,
SPELL_TELEPORT_VISUAL = 51347,
SAY_FREE = 0,
ACTION_FREED = 0,
EVENT_TELEPORT = 1
};
class go_captain_tyralius_prison : public GameObjectScript
{
public:
go_captain_tyralius_prison() : GameObjectScript("go_captain_tyralius_prison") { }
struct go_captain_tyralius_prisonAI : public GameObjectAI
{
go_captain_tyralius_prisonAI(GameObject* go) : GameObjectAI(go) { }
void Reset() override
{
me->SummonCreature(NPC_CAPTAIN_TYRALIUS, me->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN);
me->SummonCreature(NPC_ETHEREUM_PRISONER, me->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN);
}
bool GossipHello(Player* player) override
{
me->SetRespawnTime(60);
me->SetLootState(GO_JUST_DEACTIVATED);
if (Creature* tyralius = me->FindNearestCreature(NPC_CAPTAIN_TYRALIUS, 1.0f))
{
player->KilledMonsterCredit(NPC_CAPTAIN_TYRALIUS);
tyralius->AI()->DoAction(ACTION_FREED);
}
if (Creature* prisoner = me->FindNearestCreature(NPC_ETHEREUM_PRISONER, 1.0f))
prisoner->DespawnOrUnsummon();
return true;
}
};
GameObjectAI* GetAI(GameObject* go) const override
{
return new go_captain_tyralius_prisonAI(go);
}
};
class npc_captain_tyralius : public CreatureScript
{
public:
npc_captain_tyralius() : CreatureScript("npc_captain_tyralius") { }
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_captain_tyraliusAI(creature);
}
struct npc_captain_tyraliusAI : public ScriptedAI
{
npc_captain_tyraliusAI(Creature* creature) : ScriptedAI(creature) { }
void DoAction(int32 /*action*/) override
{
Talk(SAY_FREE);
_events.ScheduleEvent(EVENT_TELEPORT, 5s);
}
void UpdateAI(uint32 diff) override
{
_events.Update(diff);
if (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_TELEPORT:
DoCastSelf(SPELL_TELEPORT_VISUAL);
me->DespawnOrUnsummon(Seconds(2));
break;
}
}
}
private:
EventMap _events;
};
};
void AddSC_netherstorm()
{
new npc_commander_dawnforge();
new at_commander_dawnforge();
new npc_phase_hunter();
new go_captain_tyralius_prison();
new npc_captain_tyralius();
}