Scripts/VH: Refactor commit 999843d

This commit is contained in:
Nay
2013-07-23 02:13:09 +01:00
parent 999843dfef
commit a3aa3f65fd
4 changed files with 84 additions and 88 deletions

View File

@@ -1,7 +1,7 @@
UPDATE `gameobject_template` SET `flags`=48, `ScriptName`='go_activation_crystal' WHERE `entry`=193611;
UPDATE `creature_template`
SET `flags_extra'=130,'ScriptName'='npc_violet_hold_arcane_sphere'
WHERE 'entry'=30837;
UPDATE `creature_template` SET `flags_extra`=130, `ScriptName`='npc_violet_hold_arcane_sphere' WHERE `entry`=30837;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES (13, 1, 57930, 0, 0, 32, 0, 16, 0, 0, 1, 0, 0, '', NULL);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceGroup`=1 AND `SourceEntry`=57930;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(13, 1, 57930, 0, 0, 32, 0, 16, 0, 0, 1, 0, 0, '', 'Spell Arcane Lightning hit players');

View File

@@ -21,10 +21,6 @@
#include "violet_hold.h"
#include "Player.h"
#include "TemporarySummon.h"
#include "ScriptMgr.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#define MAX_ENCOUNTER 3
@@ -65,13 +61,7 @@ enum AzureSaboteurSpells
enum CrystalSpells
{
SPELL_ARCANE_LIGHTNING = 57930,
SPELL_ARCANE_SPHERE_PASSIVE = 44263
};
enum Events
{
EVENT_ACTIVATE_CRYSTAL = 20001
SPELL_ARCANE_LIGHTNING = 57930
};
const Position PortalLocation[] =
@@ -403,15 +393,13 @@ public:
uiMainEventPhase = data;
if (data == IN_PROGRESS) // Start event
{
if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor))
pMainDoor->SetGoState(GO_STATE_READY);
if (GameObject* mainDoor = instance->GetGameObject(uiMainDoor))
mainDoor->SetGoState(GO_STATE_READY);
uiWaveCount = 1;
bActive = true;
for (int i = 0; i < 4; ++i)
{
if (GameObject* pCrystal = instance->GetGameObject(uiActivationCrystal[i]))
pCrystal->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
}
if (GameObject* crystal = instance->GetGameObject(uiActivationCrystal[i]))
crystal->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
uiRemoveNpc = 0; // might not have been reset after a wipe on a boss.
}
break;
@@ -711,7 +699,7 @@ public:
}
// if main event is in progress and players have wiped then reset instance
if ( uiMainEventPhase == IN_PROGRESS && CheckWipe())
if (uiMainEventPhase == IN_PROGRESS && CheckWipe())
{
SetData(DATA_REMOVE_NPC, 1);
StartBossEncounter(uiFirstBoss, false);
@@ -722,10 +710,8 @@ public:
uiMainEventPhase = NOT_STARTED;
for (int i = 0; i < 4; ++i)
{
if (GameObject* pCrystal = instance->GetGameObject(uiActivationCrystal[i]))
pCrystal->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
}
if (GameObject* crystal = instance->GetGameObject(uiActivationCrystal[i]))
crystal->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
if (Creature* pSinclari = instance->GetCreature(uiSinclari))
{
@@ -808,17 +794,18 @@ public:
void ActivateCrystal()
{
// just to make things easier we'll get the a gameobject from the map
GameObject* invoker=instance->GetGameObject(uiActivationCrystal[0]);
// just to make things easier we'll get the gameobject from the map
GameObject* invoker = instance->GetGameObject(uiActivationCrystal[0]);
if (!invoker)
return;
SpellInfo const* spellInfoLightning=sSpellMgr->GetSpellInfo(SPELL_ARCANE_LIGHTNING);
SpellInfo const* spellInfoLightning = sSpellMgr->GetSpellInfo(SPELL_ARCANE_LIGHTNING);
if (!spellInfoLightning)
return;
// the orb
TempSummon* trigger=invoker->SummonCreature(DEFENSE_SYSTEM, ArcaneSphere, TEMPSUMMON_MANUAL_DESPAWN, 0);
if ( !trigger )
TempSummon* trigger = invoker->SummonCreature(NPC_DEFENSE_SYSTEM, ArcaneSphere, TEMPSUMMON_MANUAL_DESPAWN, 0);
if (!trigger)
return;
// visuals
@@ -846,57 +833,7 @@ public:
};
};
class npc_violet_hold_arcane_sphere : public CreatureScript
{
public:
npc_violet_hold_arcane_sphere() : CreatureScript("npc_violet_hold_arcane_sphere") { }
CreatureAI* GetAI(Creature* c) const
{
return new npc_violet_hold_arcane_sphereAI(c);
}
struct npc_violet_hold_arcane_sphereAI : public ScriptedAI
{
npc_violet_hold_arcane_sphereAI(Creature* creature) : ScriptedAI(creature) { Reset(); }
uint32 DespawnTimer;
void Reset()
{
DespawnTimer = 3000;
me->SetDisableGravity(true);
DoCast(me, SPELL_ARCANE_SPHERE_PASSIVE, true);
}
void EnterCombat(Unit* /*who*/) {}
void UpdateAI(uint32 diff)
{
if (DespawnTimer <= diff)
me->Kill(me);
else
DespawnTimer -= diff;
}
};
};
class go_activation_crystal : public GameObjectScript
{
public:
go_activation_crystal() : GameObjectScript("go_activation_crystal") { }
bool OnGossipHello(Player* /*player*/, GameObject* go)
{
go->EventInform(EVENT_ACTIVATE_CRYSTAL);
return false;
}
};
void AddSC_instance_violet_hold()
{
new go_activation_crystal();
new npc_violet_hold_arcane_sphere();
new instance_violet_hold();
}

View File

@@ -21,6 +21,9 @@
#include "ScriptedEscortAI.h"
#include "violet_hold.h"
#include "Player.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#define GOSSIP_START_EVENT "Get your people to safety, we'll keep the Blue Dragonflight's forces at bay."
#define GOSSIP_ITEM_1 "Activate the crystals when we get in trouble, right"
@@ -108,8 +111,8 @@ enum AzureStalkerSpells
enum AzureSaboteurSpells
{
SABOTEUR_SHIELD_DISRUPTION = 58291,
SABOTEUR_SHIELD_EFFECT = 45775
SABOTEUR_SHIELD_DISRUPTION = 58291,
SABOTEUR_SHIELD_EFFECT = 45775
};
enum TrashDoorSpell
@@ -119,13 +122,14 @@ enum TrashDoorSpell
enum Spells
{
SPELL_PORTAL_CHANNEL = 58012,
SPELL_CRYSTAL_ACTIVATION = 57804
SPELL_PORTAL_CHANNEL = 58012,
SPELL_CRYSTAL_ACTIVATION = 57804,
SPELL_ARCANE_SPHERE_PASSIVE = 44263
};
enum Sinclari
{
SAY_SINCLARI_1 = 0
SAY_SINCLARI_1 = 0
};
float FirstPortalWPs [6][3] =
@@ -1320,7 +1324,55 @@ public:
DoMeleeAttackIfReady();
}
};
};
class npc_violet_hold_arcane_sphere : public CreatureScript
{
public:
npc_violet_hold_arcane_sphere() : CreatureScript("npc_violet_hold_arcane_sphere") { }
struct npc_violet_hold_arcane_sphereAI : public ScriptedAI
{
npc_violet_hold_arcane_sphereAI(Creature* creature) : ScriptedAI(creature) { }
uint32 DespawnTimer;
void Reset() OVERRIDE
{
DespawnTimer = 3000;
me->SetDisableGravity(true);
DoCast(me, SPELL_ARCANE_SPHERE_PASSIVE, true);
}
void EnterCombat(Unit * /*who*/) OVERRIDE {}
void UpdateAI(uint32 diff) OVERRIDE
{
if (DespawnTimer <= diff)
me->Kill(me);
else
DespawnTimer -= diff;
}
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_violet_hold_arcane_sphereAI(creature);
}
};
class go_activation_crystal : public GameObjectScript
{
public:
go_activation_crystal() : GameObjectScript("go_activation_crystal") { }
bool OnGossipHello(Player * /*player*/, GameObject* go) OVERRIDE
{
go->EventInform(EVENT_ACTIVATE_CRYSTAL);
return false;
}
};
void AddSC_violet_hold()
@@ -1336,4 +1388,6 @@ void AddSC_violet_hold()
new npc_azure_raider();
new npc_azure_stalker();
new npc_azure_saboteur();
new npc_violet_hold_arcane_sphere();
new go_activation_crystal();
}

View File

@@ -93,7 +93,7 @@ enum CreaturesIds
CREATURE_SINCLARI = 30658,
CREATURE_SABOTEOUR = 31079,
NPC_VIOLET_HOLD_GUARD = 30659,
DEFENSE_SYSTEM = 30837
NPC_DEFENSE_SYSTEM = 30837
};
enum WorldStateIds
@@ -103,4 +103,9 @@ enum WorldStateIds
WORLD_STATE_VH_WAVE_COUNT = 3810,
};
enum Events
{
EVENT_ACTIVATE_CRYSTAL = 20001
};
#endif