mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 08:28:32 +01:00
Core/Scripting: More cleanup to Mechanar scripts. Added missing doors and handling to instance.
This commit is contained in:
7
sql/updates/world/2013_01_12_03_world_gameobject.sql
Normal file
7
sql/updates/world/2013_01_12_03_world_gameobject.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
-- Add missing doors to mechanar
|
||||
SET @GUID := 6032;
|
||||
DELETE FROM `gameobject` WHERE `guid` BETWEEN @GUID AND @GUID+2;
|
||||
INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES
|
||||
(@GUID,184632,554,3,1,236.4597,52.36356,1.653544,3.141593,0,0,-1,0,120,0,1),
|
||||
(@GUID+1,184322,554,3,1,242.874,52.314810,1.596334,3.141593,0,0,-1,0,120,0,1),
|
||||
(@GUID+2,184449,554,3,1,267.9281,52.31481,27.04254,3.141593,0,0,-1,0,120,0,1);
|
||||
@@ -590,6 +590,7 @@ void AddSC_boss_high_astromancer_solarian();
|
||||
void AddSC_instance_the_eye();
|
||||
void AddSC_the_eye();
|
||||
void AddSC_boss_gatewatcher_iron_hand(); //TK The Mechanar
|
||||
void AddSC_boss_gatewatcher_gyrokill();
|
||||
void AddSC_boss_nethermancer_sepethrea();
|
||||
void AddSC_boss_pathaleon_the_calculator();
|
||||
void AddSC_boss_mechano_lord_capacitus();
|
||||
@@ -1073,6 +1074,7 @@ void AddOutlandScripts()
|
||||
AddSC_instance_the_eye();
|
||||
AddSC_the_eye();
|
||||
AddSC_boss_gatewatcher_iron_hand(); //TK The Mechanar
|
||||
AddSC_boss_gatewatcher_gyrokill();
|
||||
AddSC_boss_nethermancer_sepethrea();
|
||||
AddSC_boss_pathaleon_the_calculator();
|
||||
AddSC_boss_mechano_lord_capacitus();
|
||||
|
||||
@@ -52,7 +52,7 @@ enum Events
|
||||
|
||||
class boss_gatewatcher_gyrokill : public CreatureScript
|
||||
{
|
||||
public: boss_gatewatcher_gyrokill() : CreatureScript("boss_gatewatcher_gyrokill") { }
|
||||
public: boss_gatewatcher_gyrokill() : CreatureScript("boss_gatewatcher_gyrokill") {}
|
||||
|
||||
struct boss_gatewatcher_gyrokillAI : public BossAI
|
||||
{
|
||||
@@ -62,6 +62,8 @@ class boss_gatewatcher_gyrokill : public CreatureScript
|
||||
{
|
||||
_JustDied();
|
||||
Talk(SAY_DEATH);
|
||||
if (GameObject* door = me->GetMap()->GetGameObject(instance->GetData64(GO_DOOR_MOARG_2)))
|
||||
door->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/)
|
||||
|
||||
@@ -25,8 +25,9 @@ EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "mechanar.h"
|
||||
|
||||
enum eSays
|
||||
enum Says
|
||||
{
|
||||
SAY_AGGRO = 0,
|
||||
SAY_HAMMER = 1,
|
||||
@@ -35,106 +36,91 @@ enum eSays
|
||||
EMOTE_HAMMER = 4
|
||||
};
|
||||
|
||||
enum eSpells
|
||||
enum Spells
|
||||
{
|
||||
// Spells to be casted
|
||||
SPELL_SHADOW_POWER = 35322,
|
||||
H_SPELL_SHADOW_POWER = 39193,
|
||||
SPELL_HAMMER_PUNCH = 35326,
|
||||
SPELL_JACKHAMMER = 35327,
|
||||
H_SPELL_JACKHAMMER = 39194,
|
||||
SPELL_STREAM_OF_MACHINE_FLUID = 35311,
|
||||
SPELL_STREAM_OF_MACHINE_FLUID = 35311
|
||||
};
|
||||
|
||||
enum Events
|
||||
{
|
||||
EVENT_STREAM_OF_MACHINE_FLUID = 0,
|
||||
EVENT_JACKHAMMER = 1,
|
||||
EVENT_SHADOW_POWER = 2
|
||||
};
|
||||
|
||||
class boss_gatewatcher_iron_hand : public CreatureScript
|
||||
{
|
||||
public:
|
||||
public: boss_gatewatcher_iron_hand(): CreatureScript("boss_gatewatcher_iron_hand") {}
|
||||
|
||||
boss_gatewatcher_iron_hand()
|
||||
: CreatureScript("boss_gatewatcher_iron_hand")
|
||||
struct boss_gatewatcher_iron_handAI : public BossAI
|
||||
{
|
||||
}
|
||||
// Gatewatcher Iron-Hand AI
|
||||
struct boss_gatewatcher_iron_handAI : public ScriptedAI
|
||||
boss_gatewatcher_iron_handAI(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_IRON_HAND) {}
|
||||
|
||||
void EnterCombat(Unit* /*who*/)
|
||||
{
|
||||
boss_gatewatcher_iron_handAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
}
|
||||
|
||||
uint32 Shadow_Power_Timer;
|
||||
uint32 Jackhammer_Timer;
|
||||
uint32 Stream_of_Machine_Fluid_Timer;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
Shadow_Power_Timer = 25000;
|
||||
Jackhammer_Timer = 45000;
|
||||
Stream_of_Machine_Fluid_Timer = 55000;
|
||||
|
||||
}
|
||||
void EnterCombat(Unit* /*who*/)
|
||||
{
|
||||
Talk(SAY_AGGRO);
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* /*victim*/)
|
||||
{
|
||||
if (rand()%2)
|
||||
return;
|
||||
_EnterCombat();
|
||||
events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, 55000);
|
||||
events.ScheduleEvent(EVENT_JACKHAMMER, 45000);
|
||||
events.ScheduleEvent(EVENT_SHADOW_POWER, 25000);
|
||||
Talk(SAY_AGGRO);
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* /*victim*/)
|
||||
{
|
||||
if (roll_chance_i(50))
|
||||
Talk(SAY_SLAY);
|
||||
}
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/)
|
||||
void JustDied(Unit* /*killer*/)
|
||||
{
|
||||
_JustDied();
|
||||
Talk(SAY_DEATH);
|
||||
if (GameObject* door = me->GetMap()->GetGameObject(instance->GetData64(GO_DOOR_MOARG_1)))
|
||||
door->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 const diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
Talk(SAY_DEATH);
|
||||
//TODO: Add door check/open code
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_STREAM_OF_MACHINE_FLUID:
|
||||
DoCastVictim(SPELL_STREAM_OF_MACHINE_FLUID, true);
|
||||
events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, urand(35000, 50000));
|
||||
break;
|
||||
case EVENT_JACKHAMMER:
|
||||
Talk(EMOTE_HAMMER);
|
||||
//TODO: expect cast this about 5 times in a row (?), announce it by emote only once
|
||||
DoCastVictim(SPELL_JACKHAMMER, true);
|
||||
if (roll_chance_i(50))
|
||||
Talk(SAY_HAMMER);
|
||||
events.ScheduleEvent(EVENT_JACKHAMMER, 30000);
|
||||
break;
|
||||
case EVENT_SHADOW_POWER:
|
||||
DoCast(me, SPELL_SHADOW_POWER);
|
||||
events.ScheduleEvent(EVENT_SHADOW_POWER, urand(20000, 28000));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
//Shadow Power
|
||||
if (Shadow_Power_Timer <= diff)
|
||||
{
|
||||
DoCast(me, SPELL_SHADOW_POWER);
|
||||
Shadow_Power_Timer = urand(20000, 28000);
|
||||
}
|
||||
else
|
||||
Shadow_Power_Timer -= diff;
|
||||
|
||||
//Jack Hammer
|
||||
if (Jackhammer_Timer <= diff)
|
||||
{
|
||||
//TODO: expect cast this about 5 times in a row (?), announce it by emote only once
|
||||
Talk(EMOTE_HAMMER);
|
||||
DoCast(me->getVictim(), SPELL_JACKHAMMER);
|
||||
|
||||
//chance to yell, but not same time as emote (after spell in fact casted)
|
||||
if (rand()%2)
|
||||
return;
|
||||
|
||||
Talk(SAY_HAMMER);
|
||||
Jackhammer_Timer = 30000;
|
||||
}
|
||||
else
|
||||
Jackhammer_Timer -= diff;
|
||||
|
||||
//Stream of Machine Fluid
|
||||
if (Stream_of_Machine_Fluid_Timer <= diff)
|
||||
{
|
||||
DoCast(me->getVictim(), SPELL_STREAM_OF_MACHINE_FLUID);
|
||||
Stream_of_Machine_Fluid_Timer = urand(35000, 50000);
|
||||
}
|
||||
else
|
||||
Stream_of_Machine_Fluid_Timer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
|
||||
@@ -29,13 +29,12 @@ enum Spells
|
||||
SPELL_POSITIVE_CHARGE = 39090,
|
||||
SPELL_NEGATIVE_POLARITY = 39091,
|
||||
SPELL_NEGATIVE_CHARGE_STACK = 39092,
|
||||
SPELL_NEGATIVE_CHARGE = 39093,
|
||||
SPELL_NEGATIVE_CHARGE = 39093
|
||||
};
|
||||
|
||||
class spell_capacitus_polarity_charge : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_capacitus_polarity_charge() : SpellScriptLoader("spell_capacitus_polarity_charge") { }
|
||||
public: spell_capacitus_polarity_charge() : SpellScriptLoader("spell_capacitus_polarity_charge") { }
|
||||
|
||||
class spell_capacitus_polarity_charge_SpellScript : public SpellScript
|
||||
{
|
||||
|
||||
@@ -89,6 +89,8 @@ class boss_nethermancer_sepethrea : public CreatureScript
|
||||
{
|
||||
_JustDied();
|
||||
Talk(SAY_DEATH);
|
||||
if (GameObject* door = me->GetMap()->GetGameObject(instance->GetData64(GO_DOOR_NETHERMANCER)))
|
||||
door->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 const diff)
|
||||
|
||||
@@ -31,11 +31,67 @@ class instance_mechanar : public InstanceMapScript
|
||||
{
|
||||
public: instance_mechanar(): InstanceMapScript("instance_mechanar", 554) { }
|
||||
|
||||
InstanceScript* GetInstanceScript(InstanceMap* map) const
|
||||
{
|
||||
return new instance_mechanar_InstanceMapScript(map);
|
||||
}
|
||||
|
||||
struct instance_mechanar_InstanceMapScript : public InstanceScript
|
||||
{
|
||||
instance_mechanar_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetBossNumber(EncounterCount);
|
||||
DoorMoArg1GUID = 0;
|
||||
DoorMoArg2GUID = 0;
|
||||
DoorNethermancerGUID = 0;
|
||||
}
|
||||
|
||||
void OnGameObjectCreate(GameObject* go)
|
||||
{
|
||||
switch (go->GetEntry())
|
||||
{
|
||||
case GO_DOOR_MOARG_1:
|
||||
DoorMoArg1GUID = go->GetGUID();
|
||||
break;
|
||||
case GO_DOOR_MOARG_2:
|
||||
DoorMoArg2GUID = go->GetGUID();
|
||||
break;
|
||||
case GO_DOOR_NETHERMANCER:
|
||||
DoorNethermancerGUID = go->GetGUID();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
CheckInstanceStatus();
|
||||
}
|
||||
|
||||
void CheckInstanceStatus()
|
||||
{
|
||||
if (GetBossState(DATA_GATEWATCHER_IRON_HAND) == DONE)
|
||||
HandleGameObject(DoorMoArg1GUID, true);
|
||||
|
||||
if (GetBossState(DATA_GATEWATCHER_GYROKILL) == DONE)
|
||||
HandleGameObject(DoorMoArg2GUID, true);
|
||||
|
||||
if (GetBossState(DATA_NETHERMANCER_SEPRETHREA) == DONE)
|
||||
HandleGameObject(DoorNethermancerGUID, true);
|
||||
}
|
||||
|
||||
uint64 GetData64(uint32 type) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case GO_DOOR_MOARG_1:
|
||||
return DoorMoArg1GUID;
|
||||
case GO_DOOR_MOARG_2:
|
||||
return DoorMoArg2GUID;
|
||||
case GO_DOOR_NETHERMANCER:
|
||||
return DoorNethermancerGUID;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool SetBossState(uint32 type, EncounterState state)
|
||||
@@ -46,7 +102,7 @@ class instance_mechanar : public InstanceMapScript
|
||||
switch (type)
|
||||
{
|
||||
case DATA_GATEWATCHER_GYROKILL:
|
||||
case DATA_IRON_HAND:
|
||||
case DATA_GATEWATCHER_IRON_HAND:
|
||||
case DATA_MECHANOLORD_CAPACITUS:
|
||||
case DATA_NETHERMANCER_SEPRETHREA:
|
||||
case DATA_PATHALEON_THE_CALCULATOR:
|
||||
@@ -100,12 +156,12 @@ class instance_mechanar : public InstanceMapScript
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
};
|
||||
|
||||
InstanceScript* GetInstanceScript(InstanceMap* map) const
|
||||
{
|
||||
return new instance_mechanar_InstanceMapScript(map);
|
||||
}
|
||||
protected:
|
||||
uint64 DoorMoArg1GUID;
|
||||
uint64 DoorMoArg2GUID;
|
||||
uint64 DoorNethermancerGUID;
|
||||
};
|
||||
};
|
||||
|
||||
void AddSC_instance_mechanar()
|
||||
|
||||
@@ -23,10 +23,17 @@ uint32 const EncounterCount = 5;
|
||||
enum DataTypes
|
||||
{
|
||||
DATA_GATEWATCHER_GYROKILL = 0,
|
||||
DATA_IRON_HAND = 1,
|
||||
DATA_GATEWATCHER_IRON_HAND = 1,
|
||||
DATA_MECHANOLORD_CAPACITUS = 2,
|
||||
DATA_NETHERMANCER_SEPRETHREA = 3,
|
||||
DATA_PATHALEON_THE_CALCULATOR = 4
|
||||
};
|
||||
|
||||
enum GameobjectIds
|
||||
{
|
||||
GO_DOOR_MOARG_1 = 184632,
|
||||
GO_DOOR_MOARG_2 = 184322,
|
||||
GO_DOOR_NETHERMANCER = 184449
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user