aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/EasternKingdoms
diff options
context:
space:
mode:
authorVincent-Michael <Vincent_Michael@gmx.de>2014-09-08 22:15:42 +0200
committerVincent-Michael <Vincent_Michael@gmx.de>2014-09-08 22:15:42 +0200
commit5cdea8b30cda77d6a9d93921b0f667d51ec89c6f (patch)
tree0cf4e6bd15cdbe3543cda20702a9a17abbd2b7a8 /src/server/scripts/EasternKingdoms
parent668fe43d51208738cb95c0d30a3077d998832b50 (diff)
parente181af1b1c983c8dc492f20eb4720973f002c538 (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Diffstat (limited to 'src/server/scripts/EasternKingdoms')
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp44
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp79
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp2
5 files changed, 68 insertions, 61 deletions
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
index 87272037755..ca46ff36079 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
@@ -173,7 +173,7 @@ public:
DoMeleeAttackIfReady();
}
-
+
private:
EventMap events;
SummonList summons;
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
index b0222413513..7338620a8b2 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
@@ -133,7 +133,7 @@ public:
++uiHealth;
DoCastAOE(SPELL_SMITE_STOMP, false);
SetCombatMovement(false);
- if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_SMITE_CHEST)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_SMITE_CHEST)))
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(1, go->GetPositionX() - 3.0f, go->GetPositionY(), go->GetPositionZ());
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
index 220cf0c92b4..d009986651a 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
@@ -142,56 +142,48 @@ public:
uiPhase = uiPhaseStep;
}
- void CaveDestruction(bool bBool)
+ void CaveDestruction(bool isRight)
{
if (GoSummonList.empty())
return;
for (std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr)
{
- if (GameObject* go = GameObject::GetGameObject(*me, *itr))
- {
- if (go)
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, *itr))
+ {
+ if (Creature* trigger = go->SummonTrigger(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, 1))
{
- if (Creature* trigger = go->SummonTrigger(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, 1))
- {
- //visual effects are not working!
- trigger->CastSpell(trigger, 11542, true);
- trigger->CastSpell(trigger, 35470, true);
- }
- go->RemoveFromWorld();
- //go->CastSpell(me, 12158); makes all die?!
+ //visual effects are not working!
+ trigger->CastSpell(trigger, 11542, true);
+ trigger->CastSpell(trigger, 35470, true);
}
- }
+ go->RemoveFromWorld();
+ //go->CastSpell(me, 12158); makes all die?!
+ }
}
- if (bBool)
- {
- if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
- instance->HandleGameObject(0, false, go);
- }else
- if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT)))
- instance->HandleGameObject(0, false, go);
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(isRight ? DATA_GO_CAVE_IN_RIGHT : DATA_GO_CAVE_IN_LEFT)))
+ instance->HandleGameObject(0, false, go);
}
void SetInFace(bool isRight)
{
- if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(isRight ? DATA_GO_CAVE_IN_RIGHT : DATA_GO_CAVE_IN_LEFT)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(isRight ? DATA_GO_CAVE_IN_RIGHT : DATA_GO_CAVE_IN_LEFT)))
me->SetFacingToObject(go);
}
void RestoreAll()
{
- if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
instance->HandleGameObject(0, false, go);
- if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT)))
instance->HandleGameObject(0, false, go);
if (!GoSummonList.empty())
for (std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr)
{
- if (GameObject* go = GameObject::GetGameObject(*me, *itr))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, *itr))
go->RemoveFromWorld();
}
@@ -406,7 +398,7 @@ public:
SetInFace(true);
Talk(SAY_BLASTMASTER_5);
Summon(1);
- if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
instance->HandleGameObject(0, true, go);
NextStep(3000, true);
break;
@@ -452,7 +444,7 @@ public:
case 16:
Talk(SAY_BLASTMASTER_14);
SetInFace(false);
- if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT)))
instance->HandleGameObject(0, true, go);
NextStep(2000, true);
break;
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
index 9a1f8f14557..0386341ed0c 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
@@ -162,52 +162,58 @@ class spell_shadow_portal : public SpellScriptLoader
{
PrepareSpellScript(spell_shadow_portal_SpellScript);
+ bool Load() override
+ {
+ _instance = GetCaster()->GetInstanceScript();
+ return _instance != nullptr;
+ }
+
void HandleCast(SpellEffIndex /*effIndex*/)
{
- Creature* caster = GetCaster()->ToCreature();
- int8 attempts = 0;
- int32 spell_to_cast =0;
+ Unit* caster = GetCaster();
+ uint8 attempts = 0;
+ uint32 spellId = 0;
- while (!spell_to_cast)
+ while (!spellId)
{
if (attempts++ >= 6) break;
switch (urand(0, 5))
{
case ROOM_HALL_OF_SECRETS:
- if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (GameObject::GetGameObject(*caster, instance->GetData64(GO_GATE_RAVENIAN))->GetGoState() == GO_STATE_ACTIVE)
- spell_to_cast = SPELL_SHADOW_PORTAL_HALLOFSECRETS;
+ if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_RAVENIAN)))
+ if (go->GetGoState() == GO_STATE_ACTIVE)
+ spellId = SPELL_SHADOW_PORTAL_HALLOFSECRETS;
break;
case ROOM_HALL_OF_THE_DAMNED:
- if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (GameObject::GetGameObject(*caster, instance->GetData64(GO_GATE_THEOLEN))->GetGoState() == GO_STATE_ACTIVE)
- spell_to_cast = SPELL_SHADOW_PORTAL_HALLOFTHEDAMNED;
+ if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_THEOLEN)))
+ if (go->GetGoState() == GO_STATE_ACTIVE)
+ spellId = SPELL_SHADOW_PORTAL_HALLOFTHEDAMNED;
break;
case ROOM_THE_COVEN:
- if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (GameObject::GetGameObject(*caster, instance->GetData64(GO_GATE_MALICIA))->GetGoState() == GO_STATE_ACTIVE)
- spell_to_cast = SPELL_SHADOW_PORTAL_THECOVEN;
+ if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_MALICIA)))
+ if (go->GetGoState() == GO_STATE_ACTIVE)
+ spellId = SPELL_SHADOW_PORTAL_THECOVEN;
break;
case ROOM_THE_SHADOW_VAULT:
- if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (GameObject::GetGameObject(*caster, instance->GetData64(GO_GATE_ILLUCIA))->GetGoState() == GO_STATE_ACTIVE)
- spell_to_cast = SPELL_SHADOW_PORTAL_THESHADOWVAULT;
+ if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_ILLUCIA)))
+ if (go->GetGoState() == GO_STATE_ACTIVE)
+ spellId = SPELL_SHADOW_PORTAL_THESHADOWVAULT;
break;
case ROOM_BAROV_FAMILY_VAULT:
- if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (GameObject::GetGameObject(*caster, instance->GetData64(GO_GATE_BAROV))->GetGoState() == GO_STATE_ACTIVE)
- spell_to_cast = SPELL_SHADOW_PORTAL_BAROVFAMILYVAULT;
+ if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_BAROV)))
+ if (go->GetGoState() == GO_STATE_ACTIVE)
+ spellId = SPELL_SHADOW_PORTAL_BAROVFAMILYVAULT;
break;
case ROOM_VAULT_OF_THE_RAVENIAN:
- if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (GameObject::GetGameObject(*caster, instance->GetData64(GO_GATE_POLKELT))->GetGoState() == GO_STATE_ACTIVE)
- spell_to_cast = SPELL_SHADOW_PORTAL_VAULTOFTHERAVENIAN;
+ if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_POLKELT)))
+ if (go->GetGoState() == GO_STATE_ACTIVE)
+ spellId = SPELL_SHADOW_PORTAL_VAULTOFTHERAVENIAN;
break;
}
- if (spell_to_cast)
- GetHitUnit()->CastSpell(GetHitUnit(), spell_to_cast);
+ if (spellId)
+ GetHitUnit()->CastSpell(GetHitUnit(), spellId);
}
}
@@ -215,6 +221,9 @@ class spell_shadow_portal : public SpellScriptLoader
{
OnEffectHitTarget += SpellEffectFn(spell_shadow_portal_SpellScript::HandleCast, EFFECT_0, SPELL_EFFECT_DUMMY);
}
+
+ private:
+ InstanceScript* _instance;
};
SpellScript* GetSpellScript() const override
@@ -276,12 +285,17 @@ class spell_shadow_portal_rooms : public SpellScriptLoader
{
PrepareSpellScript(spell_shadow_portal_rooms_SpellScript);
+ bool Load() override
+ {
+ _instance = GetCaster()->GetInstanceScript();
+ return _instance != nullptr;
+ }
+
void HandleSendEvent(SpellEffIndex effIndex)
{
// If only one player in threat list fail spell
- Creature* Summoned = NULL;
- Creature* caster = GetCaster()->ToCreature();
+ Unit* caster = GetCaster();
int8 pos_to_summon = 0;
int8 phase_to_set = 0;
@@ -323,21 +337,19 @@ class spell_shadow_portal_rooms : public SpellScriptLoader
break;
}
- if (gate_to_close && (GetCaster()->GetMap()->GetId() == 289))
+ if (gate_to_close && (caster->GetMap()->GetId() == 289))
{
for (uint8 i = 0; i < 3; ++i)
{
- Summoned = GetCaster()->SummonCreature(NPC_RISEN_GUARDIAN, SummonPos[pos_to_summon++], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
- if (Summoned)
+ if (Creature* Summoned = caster->SummonCreature(NPC_RISEN_GUARDIAN, SummonPos[pos_to_summon++], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000))
{
Summoned->GetMotionMaster()->MoveRandom(5);
Summoned->AI()->SetData(0, phase_to_set);
}
}
- if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (GameObject* gate = GameObject::GetGameObject(*caster, instance->GetData64(gate_to_close)))
- gate->SetGoState(GO_STATE_READY);
+ if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(gate_to_close)))
+ gate->SetGoState(GO_STATE_READY);
}
}
@@ -345,6 +357,9 @@ class spell_shadow_portal_rooms : public SpellScriptLoader
{
OnEffectHit += SpellEffectFn(spell_shadow_portal_rooms_SpellScript::HandleSendEvent, EFFECT_1, SPELL_EFFECT_SEND_EVENT);
}
+
+ private:
+ InstanceScript* _instance;
};
SpellScript* GetSpellScript() const override
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
index 889fbe8fdc9..9c733677b42 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
@@ -149,7 +149,7 @@ public:
void JustSummoned(Creature* summoned) override
{
summoned->CastSpell(summoned, SPELL_SOUL_FREED, false);
-
+
if (Player* player = ObjectAccessor::GetPlayer(*me, Tagger))
summoned->GetMotionMaster()->MoveFollow(player, 0.0f, 0.0f);
}