aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Kalimdor
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/Kalimdor
parentd0910974336115be1dd06577c63fe3703e8170d2 (diff)
Core/Scripts: Removed CAST_PLR define
Diffstat (limited to 'src/server/scripts/Kalimdor')
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp5
-rw-r--r--src/server/scripts/Kalimdor/zone_azshara.cpp29
-rw-r--r--src/server/scripts/Kalimdor/zone_durotar.cpp9
-rw-r--r--src/server/scripts/Kalimdor/zone_tanaris.cpp18
-rw-r--r--src/server/scripts/Kalimdor/zone_the_barrens.cpp14
5 files changed, 47 insertions, 28 deletions
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
index 7cb78718e2a..55e81f1408f 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
@@ -119,8 +119,7 @@ public:
case 45:
Talk(SAY_WIN, player->GetGUID());
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
- if (player->GetTypeId() == TYPEID_PLAYER)
- CAST_PLR(player)->GroupEventHappens(QUEST_WILLIX_THE_IMPORTER, me);
+ player->GroupEventHappens(QUEST_WILLIX_THE_IMPORTER, me);
break;
case 46:
Talk(SAY_END, player->GetGUID());
@@ -143,7 +142,7 @@ public:
void JustDied(Unit* /*killer*/)
{
if (Player* player = GetPlayerForEscort())
- CAST_PLR(player)->FailQuest(QUEST_WILLIX_THE_IMPORTER);
+ player->FailQuest(QUEST_WILLIX_THE_IMPORTER);
}
};
diff --git a/src/server/scripts/Kalimdor/zone_azshara.cpp b/src/server/scripts/Kalimdor/zone_azshara.cpp
index 40af9e522ea..66834a68253 100644
--- a/src/server/scripts/Kalimdor/zone_azshara.cpp
+++ b/src/server/scripts/Kalimdor/zone_azshara.cpp
@@ -66,15 +66,26 @@ public:
void EnterCombat(Unit* /*who*/) { }
- void SpellHit(Unit* Hitter, const SpellInfo* Spellkind)
+ void SpellHit(Unit* unit, const SpellInfo* spell)
{
- if (!spellhit &&
- Hitter->GetTypeId() == TYPEID_PLAYER &&
- CAST_PLR(Hitter)->GetQuestStatus(9364) == QUEST_STATUS_INCOMPLETE &&
- (Spellkind->Id == 118 || Spellkind->Id == 12824 || Spellkind->Id == 12825 || Spellkind->Id == 12826))
+ if (spellhit)
+ return;
+
+ switch (spell->Id)
{
- spellhit=true;
- DoCast(me, 29124); //become a sheep
+ case 118:
+ case 12824:
+ case 12825:
+ case 12826:
+ if (Player* player = unit->ToPlayer())
+ if (player->GetQuestStatus(9364) == QUEST_STATUS_INCOMPLETE)
+ {
+ spellhit = true;
+ DoCast(me, 29124);
+ }
+ break;
+ default:
+ break;
}
}
@@ -429,7 +440,9 @@ public:
if (!who || PlayerGUID)
return;
- if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) == QUEST_STATUS_INCOMPLETE)
+ Player* player = who->ToPlayer();
+
+ if (player && player->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) == QUEST_STATUS_INCOMPLETE)
{
PlayerGUID = who->GetGUID();
Talk(SAY_RIZZLE_START);
diff --git a/src/server/scripts/Kalimdor/zone_durotar.cpp b/src/server/scripts/Kalimdor/zone_durotar.cpp
index 7bb59e9828b..801ffbc038e 100644
--- a/src/server/scripts/Kalimdor/zone_durotar.cpp
+++ b/src/server/scripts/Kalimdor/zone_durotar.cpp
@@ -73,10 +73,13 @@ public:
void SpellHit(Unit* caster, const SpellInfo* spell)
{
- if (spell->Id == SPELL_AWAKEN_PEON && caster->GetTypeId() == TYPEID_PLAYER
- && CAST_PLR(caster)->GetQuestStatus(QUEST_LAZY_PEONS) == QUEST_STATUS_INCOMPLETE)
+ if (spell->Id != SPELL_AWAKEN_PEON)
+ return;
+
+ Player* player = caster->ToPlayer();
+ if (player && player->GetQuestStatus(QUEST_LAZY_PEONS) == QUEST_STATUS_INCOMPLETE)
{
- caster->ToPlayer()->KilledMonsterCredit(me->GetEntry(), me->GetGUID());
+ player->KilledMonsterCredit(me->GetEntry(), me->GetGUID());
Talk(SAY_SPELL_HIT, caster->GetGUID());
me->RemoveAllAuras();
if (GameObject* Lumberpile = me->FindNearestGameObject(GO_LUMBERPILE, 20))
diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp
index 9d257790ab8..a0e57a1092f 100644
--- a/src/server/scripts/Kalimdor/zone_tanaris.cpp
+++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp
@@ -87,15 +87,17 @@ public:
void SendItem(Unit* receiver)
{
- if (CAST_PLR(receiver)->HasItemCount(11169, 1, false) &&
- CAST_PLR(receiver)->HasItemCount(11172, 11, false) &&
- CAST_PLR(receiver)->HasItemCount(11173, 1, false) &&
- !CAST_PLR(receiver)->HasItemCount(11522, 1, true))
+ Player* player = receiver->ToPlayer();
+
+ if (player && player->HasItemCount(11169, 1, false) &&
+ player->HasItemCount(11172, 11, false) &&
+ player->HasItemCount(11173, 1, false) &&
+ !player->HasItemCount(11522, 1, true))
{
ItemPosCountVec dest;
- uint8 msg = CAST_PLR(receiver)->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, NULL);
+ uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, NULL);
if (msg == EQUIP_ERR_OK)
- CAST_PLR(receiver)->StoreNewItem(dest, 11522, 1, true);
+ player->StoreNewItem(dest, 11522, 1, true);
}
}
@@ -254,9 +256,9 @@ public:
if (HasEscortState(STATE_ESCORT_ESCORTING))
return;
- if (who->GetTypeId() == TYPEID_PLAYER)
+ if (Player* player = who->ToPlayer())
{
- if (who->HasAura(34877) && CAST_PLR(who)->GetQuestStatus(10277) == QUEST_STATUS_INCOMPLETE)
+ if (who->HasAura(34877) && player->GetQuestStatus(10277) == QUEST_STATUS_INCOMPLETE)
{
float Radius = 10.0f;
if (me->IsWithinDistInMap(who, Radius))
diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
index ff52af97c11..4ab64846f1c 100644
--- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp
+++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
@@ -385,14 +385,16 @@ public:
void MoveInLineOfSight(Unit* who)
{
- if (!who || (!who->isAlive()))
+ if (!who || !who->isAlive() || EventInProgress)
return;
- if (me->IsWithinDistInMap(who, 10.0f) && (who->GetTypeId() == TYPEID_PLAYER) && CAST_PLR(who)->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE && !EventInProgress)
- {
- PlayerGUID = who->GetGUID();
- EventInProgress = true;
- }
+ if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 10.0f))
+ if (Player* player = who->ToPlayer())
+ if (player->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE)
+ {
+ PlayerGUID = who->GetGUID();
+ EventInProgress = true;
+ }
}
void KilledUnit(Unit* /*victim*/) { }