aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/EasternKingdoms
diff options
context:
space:
mode:
authorSpp <spp@jorge.gr>2013-03-21 13:07:10 +0100
committerSpp <spp@jorge.gr>2013-03-21 13:07:10 +0100
commit355029fb4f30a3d535a7c360b896b728eee330b6 (patch)
tree31f653f8ea96aaa2f0152d439bdd7a481c203f87 /src/server/scripts/EasternKingdoms
parentd0910974336115be1dd06577c63fe3703e8170d2 (diff)
Core/Scripts: Removed CAST_PLR define
Diffstat (limited to 'src/server/scripts/EasternKingdoms')
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp28
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp24
-rw-r--r--src/server/scripts/EasternKingdoms/zone_burning_steppes.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/zone_ghostlands.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/zone_silvermoon_city.cpp27
-rw-r--r--src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp17
-rw-r--r--src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp78
-rw-r--r--src/server/scripts/EasternKingdoms/zone_wetlands.cpp3
12 files changed, 110 insertions, 98 deletions
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp
index 0cbeec50f98..d0c0ded2267 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp
@@ -981,9 +981,9 @@ public:
if (HasEscortState(STATE_ESCORT_ESCORTING))
return;
- if (who->GetTypeId() == TYPEID_PLAYER)
+ if (Player* player = who->ToPlayer())
{
- if (CAST_PLR(who)->GetQuestStatus(4322) == QUEST_STATUS_INCOMPLETE)
+ if (player->GetQuestStatus(4322) == QUEST_STATUS_INCOMPLETE)
{
float Radius = 10.0f;
if (me->IsWithinDistInMap(who, Radius))
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index d3cb21c75f0..abaf900508c 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -651,19 +651,22 @@ public:
{
if (Unit* charmer = who->GetCharmer())
{
- if (charmer->GetTypeId() == TYPEID_PLAYER)
+ if (Player* player = charmer->ToPlayer())
{
// for quest Into the Realm of Shadows(12687)
- if (me->GetEntry() == 28788 && CAST_PLR(charmer)->GetQuestStatus(12687) == QUEST_STATUS_INCOMPLETE)
+ if (me->GetEntry() == 28788 && player->GetQuestStatus(12687) == QUEST_STATUS_INCOMPLETE)
{
- CAST_PLR(charmer)->GroupEventHappens(12687, me);
+ player->GroupEventHappens(12687, me);
charmer->RemoveAurasDueToSpell(SPELL_EFFECT_OVERTAKE);
- CAST_CRE(who)->DespawnOrUnsummon();
- //CAST_CRE(who)->Respawn(true);
+ if (Creature* creature = who->ToCreature())
+ {
+ creature->DespawnOrUnsummon();
+ //creature->Respawn(true);
+ }
}
- if (CAST_PLR(charmer)->HasAura(SPELL_REALM_OF_SHADOWS))
- charmer->RemoveAurasDueToSpell(SPELL_REALM_OF_SHADOWS);
+ if (player->HasAura(SPELL_REALM_OF_SHADOWS))
+ player->RemoveAurasDueToSpell(SPELL_REALM_OF_SHADOWS);
}
}
}
@@ -753,17 +756,18 @@ public:
{
if (Unit* owner = who->GetOwner())
{
- if (owner->GetTypeId() == TYPEID_PLAYER)
+ if (Player* player = owner->ToPlayer())
{
- if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE)
- CAST_CRE(who)->CastSpell(owner, 52517, true);
+ Creature* creature = who->ToCreature();
+ if (player->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE)
+ creature->CastSpell(owner, 52517, true);
/// @todo Creatures must not be removed, but, must instead
// stand next to Gothik and be commanded into the pit
// and dig into the ground.
- CAST_CRE(who)->DespawnOrUnsummon();
+ creature->DespawnOrUnsummon();
- if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE)
+ if (player->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE)
owner->RemoveAllMinionsByEntry(NPC_GHOSTS);
}
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
index 16e6554d1f4..326c02630ac 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
@@ -76,8 +76,7 @@ public:
Player* player = NULL;
if (me->isSummon())
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
- if (summoner->GetTypeId() == TYPEID_PLAYER)
- player = CAST_PLR(summoner);
+ player = summoner->ToPlayer();
if (!player)
phase = 3;
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
index 7208bbbee03..f12a9c33ea9 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
@@ -151,14 +151,15 @@ public:
void SpellHit(Unit* caster, const SpellInfo* spell)
{
- if (caster->GetTypeId() == TYPEID_PLAYER)
- {
- if (!Tagged && spell->Id == SPELL_EGAN_BLASTER && CAST_PLR(caster)->GetQuestStatus(QUEST_RESTLESS_SOUL) == QUEST_STATUS_INCOMPLETE)
- {
- Tagged = true;
- Tagger = caster->GetGUID();
- }
- }
+ if (Tagged || spell->Id != SPELL_EGAN_BLASTER)
+ return;
+
+ Player* player = caster->ToPlayer();
+ if (!player || player->GetQuestStatus(QUEST_RESTLESS_SOUL) != QUEST_STATUS_INCOMPLETE)
+ return;
+
+ Tagged = true;
+ Tagger = caster->GetGUID();
}
void JustSummoned(Creature* summoned)
@@ -180,10 +181,13 @@ public:
{
if (Unit* temp = Unit::GetUnit(*me, Tagger))
{
- CAST_PLR(temp)->KilledMonsterCredit(ENTRY_RESTLESS, me->GetGUID());
+ if (Player* player = temp->ToPlayer())
+ player->KilledMonsterCredit(ENTRY_RESTLESS, me->GetGUID());
me->Kill(me);
}
- } else Die_Timer -= diff;
+ }
+ else
+ Die_Timer -= diff;
}
}
};
diff --git a/src/server/scripts/EasternKingdoms/zone_burning_steppes.cpp b/src/server/scripts/EasternKingdoms/zone_burning_steppes.cpp
index b6899c534e4..6bc316d1437 100644
--- a/src/server/scripts/EasternKingdoms/zone_burning_steppes.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_burning_steppes.cpp
@@ -141,7 +141,8 @@ public:
if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 15) && who->isInAccessiblePlaceFor(me))
{
DoCast(who, 16472);
- CAST_PLR(who)->AreaExploredOrEventHappens(4866);
+ if (Player* player = who->ToPlayer())
+ player->AreaExploredOrEventHappens(4866);
}
}
diff --git a/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp b/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp
index ce62de8b368..c148d485e1a 100644
--- a/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp
@@ -243,11 +243,11 @@ public:
summonerGuid = summonerguid;
}
- void KilledUnit(Unit* Killed)
+ void KilledUnit(Unit* unit)
{
- if (Killed->GetTypeId() == TYPEID_PLAYER)
- if (CAST_PLR(Killed)->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE)
- CAST_PLR(Killed)->FailQuest(QUEST_SECOND_TRIAL);
+ if (Player* player = unit->ToPlayer())
+ if (player->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE)
+ player->FailQuest(QUEST_SECOND_TRIAL);
}
void JustDied(Unit* killer);
@@ -577,7 +577,7 @@ public:
{
if (!Progress && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 10.0f))
{
- if (CAST_PLR(who)->GetQuestStatus(QUEST_POWERING_OUR_DEFENSES) == QUEST_STATUS_INCOMPLETE)
+ if (who->ToPlayer()->GetQuestStatus(QUEST_POWERING_OUR_DEFENSES) == QUEST_STATUS_INCOMPLETE)
{
PlayerGUID = who->GetGUID();
WaveTimer = 1000;
@@ -596,7 +596,7 @@ public:
{
if (PlayerGUID && !Completed)
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
- CAST_PLR(player)->FailQuest(QUEST_POWERING_OUR_DEFENSES);
+ player->FailQuest(QUEST_POWERING_OUR_DEFENSES);
}
void UpdateAI(uint32 diff)
@@ -607,7 +607,7 @@ public:
Completed = true;
if (PlayerGUID)
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
- CAST_PLR(player)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES);
+ player->CompleteQuest(QUEST_POWERING_OUR_DEFENSES);
me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
me->RemoveCorpse();
diff --git a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp
index 9e00ceb2aa5..858aa287c61 100644
--- a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp
@@ -175,8 +175,7 @@ public:
me->SetWalk(true);
break;
case 30:
- if (player->GetTypeId() == TYPEID_PLAYER)
- CAST_PLR(player)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS, me);
+ player->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS, me);
break;
case 32:
me->SetOrientation(2.978281f);
diff --git a/src/server/scripts/EasternKingdoms/zone_silvermoon_city.cpp b/src/server/scripts/EasternKingdoms/zone_silvermoon_city.cpp
index fd36a02b8a5..0e7472fc63b 100644
--- a/src/server/scripts/EasternKingdoms/zone_silvermoon_city.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_silvermoon_city.cpp
@@ -88,19 +88,22 @@ public:
}
}
- void SpellHit(Unit* Hitter, const SpellInfo* Spellkind)
+ void SpellHit(Unit* caster, const SpellInfo* Spellkind)
{
- if ((Spellkind->Id == SPELL_SHIMMERING_VESSEL) && !spellHit &&
- (Hitter->GetTypeId() == TYPEID_PLAYER) && (CAST_PLR(Hitter)->IsActiveQuest(QUEST_REDEEMING_THE_DEAD)))
- {
- CAST_PLR(Hitter)->AreaExploredOrEventHappens(QUEST_REDEEMING_THE_DEAD);
- DoCast(me, SPELL_REVIVE_SELF);
- me->SetStandState(UNIT_STAND_STATE_STAND);
- me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
- //me->RemoveAllAuras();
- Talk(SAY_HEAL);
- spellHit = true;
- }
+ if (Spellkind->Id != SPELL_SHIMMERING_VESSEL || spellHit)
+ return;
+
+ Player* player = caster->ToPlayer();
+ if (!player || !player->IsActiveQuest(QUEST_REDEEMING_THE_DEAD))
+ return;
+
+ player->AreaExploredOrEventHappens(QUEST_REDEEMING_THE_DEAD);
+ DoCast(me, SPELL_REVIVE_SELF);
+ me->SetStandState(UNIT_STAND_STATE_STAND);
+ me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
+ //me->RemoveAllAuras();
+ Talk(SAY_HEAL);
+ spellHit = true;
}
};
};
diff --git a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
index b9c9c8ff15b..d8a2d765983 100644
--- a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
@@ -139,8 +139,8 @@ public:
//Take 0 damage
uiDamage = 0;
- if (pDoneBy->GetTypeId() == TYPEID_PLAYER)
- CAST_PLR(pDoneBy)->AreaExploredOrEventHappens(QUEST_BEAT);
+ if (Player* player = pDoneBy->ToPlayer())
+ player->AreaExploredOrEventHappens(QUEST_BEAT);
EnterEvadeMode();
}
}
diff --git a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
index c11e850cbc8..66fb4819175 100644
--- a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
@@ -64,10 +64,12 @@ public:
void SpellHit(Unit* caster, const SpellInfo* spell)
{
- if (caster->GetTypeId() == TYPEID_PLAYER)
+ if (bReset || spell->Id != 3607)
+ return;
+
+ if (Player* player = caster->ToPlayer())
{
- //Yenniku's Release
- if (!bReset && CAST_PLR(caster)->GetQuestStatus(592) == QUEST_STATUS_INCOMPLETE && spell->Id == 3607)
+ if (player->GetQuestStatus(592) == QUEST_STATUS_INCOMPLETE) //Yenniku's Release
{
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STUN);
me->CombatStop(); //stop combat
@@ -78,7 +80,6 @@ public:
Reset_Timer = 60000;
}
}
- return;
}
void EnterCombat(Unit* /*who*/) {}
@@ -94,14 +95,14 @@ public:
me->setFaction(28); //troll, bloodscalp
return;
}
- else Reset_Timer -= diff;
+
+ Reset_Timer -= diff;
if (me->isInCombat() && me->getVictim())
{
- if (me->getVictim()->GetTypeId() == TYPEID_PLAYER)
+ if (Player* player = me->getVictim()->ToPlayer())
{
- Unit* victim = me->getVictim();
- if (CAST_PLR(victim)->GetTeam() == HORDE)
+ if (player->GetTeam() == HORDE)
{
me->CombatStop();
me->DeleteThreatList();
diff --git a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp
index 1831d9f7ff1..0692330b87a 100644
--- a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp
@@ -190,46 +190,47 @@ public:
void MoveInLineOfSight(Unit* who)
{
- if (!who || who->GetTypeId() != TYPEID_PLAYER)
+ if (!who)
+ return;
+
+ Player* player = who->ToPlayer();
+ if (!player)
return;
- if (who->GetTypeId() == TYPEID_PLAYER)
+ switch (me->GetAreaId())
{
- switch (me->GetAreaId())
- {
- case 199: //felstone
- if (CAST_PLR(who)->GetQuestStatus(5216) == QUEST_STATUS_INCOMPLETE ||
- CAST_PLR(who)->GetQuestStatus(5229) == QUEST_STATUS_INCOMPLETE)
- {
- me->SummonCreature(11075, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
- DoDie();
- }
- break;
- case 200: //dalson
- if (CAST_PLR(who)->GetQuestStatus(5219) == QUEST_STATUS_INCOMPLETE ||
- CAST_PLR(who)->GetQuestStatus(5231) == QUEST_STATUS_INCOMPLETE)
- {
- me->SummonCreature(11077, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
- DoDie();
- }
- break;
- case 201: //gahrron
- if (CAST_PLR(who)->GetQuestStatus(5225) == QUEST_STATUS_INCOMPLETE ||
- CAST_PLR(who)->GetQuestStatus(5235) == QUEST_STATUS_INCOMPLETE)
- {
- me->SummonCreature(11078, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
- DoDie();
- }
- break;
- case 202: //writhing
- if (CAST_PLR(who)->GetQuestStatus(5222) == QUEST_STATUS_INCOMPLETE ||
- CAST_PLR(who)->GetQuestStatus(5233) == QUEST_STATUS_INCOMPLETE)
- {
- me->SummonCreature(11076, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
- DoDie();
- }
- break;
- }
+ case 199: //felstone
+ if (player->GetQuestStatus(5216) == QUEST_STATUS_INCOMPLETE ||
+ player->GetQuestStatus(5229) == QUEST_STATUS_INCOMPLETE)
+ {
+ me->SummonCreature(11075, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
+ DoDie();
+ }
+ break;
+ case 200: //dalson
+ if (player->GetQuestStatus(5219) == QUEST_STATUS_INCOMPLETE ||
+ player->GetQuestStatus(5231) == QUEST_STATUS_INCOMPLETE)
+ {
+ me->SummonCreature(11077, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
+ DoDie();
+ }
+ break;
+ case 201: //gahrron
+ if (player->GetQuestStatus(5225) == QUEST_STATUS_INCOMPLETE ||
+ player->GetQuestStatus(5235) == QUEST_STATUS_INCOMPLETE)
+ {
+ me->SummonCreature(11078, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
+ DoDie();
+ }
+ break;
+ case 202: //writhing
+ if (player->GetQuestStatus(5222) == QUEST_STATUS_INCOMPLETE ||
+ player->GetQuestStatus(5233) == QUEST_STATUS_INCOMPLETE)
+ {
+ me->SummonCreature(11076, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
+ DoDie();
+ }
+ break;
}
}
};
@@ -267,7 +268,8 @@ public:
return;
if (me->FindNearestGameObject(GO_BEACON_TORCH, 10.0f))
- CAST_PLR(who)->KilledMonsterCredit(me->GetEntry(), me->GetGUID());
+ if (Player* player = who->ToPlayer())
+ player->KilledMonsterCredit(me->GetEntry(), me->GetGUID());
}
};
};
diff --git a/src/server/scripts/EasternKingdoms/zone_wetlands.cpp b/src/server/scripts/EasternKingdoms/zone_wetlands.cpp
index c8a1fc2b2b4..ea7b995e8cf 100644
--- a/src/server/scripts/EasternKingdoms/zone_wetlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_wetlands.cpp
@@ -116,8 +116,7 @@ public:
{
if (Player* player = GetPlayerForEscort())
{
- if (player->GetTypeId() == TYPEID_PLAYER)
- CAST_PLR(player)->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, me);
+ player->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, me);
uiDamage = 0;