Core/Scripts: Removed CAST_PLR define

This commit is contained in:
Spp
2013-03-21 13:07:10 +01:00
parent d091097433
commit 355029fb4f
26 changed files with 310 additions and 297 deletions
@@ -24,7 +24,6 @@
#include "CreatureAIImpl.h"
#include "InstanceScript.h"
#define CAST_PLR(a) (dynamic_cast<Player*>(a))
#define CAST_CRE(a) (dynamic_cast<Creature*>(a))
#define CAST_AI(a, b) (dynamic_cast<a*>(b))
@@ -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))
@@ -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);
}
}
@@ -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;
@@ -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;
}
}
};
@@ -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);
}
}
@@ -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();
@@ -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);
@@ -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;
}
};
};
@@ -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();
}
}
@@ -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();
@@ -190,46 +190,47 @@ public:
void MoveInLineOfSight(Unit* who)
{
if (!who || who->GetTypeId() != TYPEID_PLAYER)
if (!who)
return;
if (who->GetTypeId() == TYPEID_PLAYER)
Player* player = who->ToPlayer();
if (!player)
return;
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());
}
};
};
@@ -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;
@@ -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);
}
};
+21 -8
View File
@@ -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);
+6 -3
View File
@@ -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))
+10 -8
View File
@@ -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))
@@ -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*/) { }
@@ -79,11 +79,11 @@ public:
void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (phase)
if (phase || spell->Id != SPELL_SET_CART)
return;
if (spell->Id == SPELL_SET_CART && caster->GetTypeId() == TYPEID_PLAYER
&& CAST_PLR(caster)->GetQuestStatus(11897) == QUEST_STATUS_INCOMPLETE)
Player* player = caster->ToPlayer();
if (player && player->GetQuestStatus(11897) == QUEST_STATUS_INCOMPLETE)
{
phase = 1;
casterGuid = caster->GetGUID();
@@ -419,7 +419,7 @@ public:
me->SetReactState(REACT_PASSIVE);
switch (CAST_PLR(me->GetOwner())->GetTeamId())
switch (me->GetOwner()->ToPlayer()->GetTeamId())
{
case TEAM_ALLIANCE:
me->setFaction(FACTION_ESCORT_A_NEUTRAL_ACTIVE);
@@ -475,23 +475,18 @@ public:
{
ScriptedAI::MoveInLineOfSight(who);
if (who->GetTypeId() != TYPEID_UNIT)
if (who->GetEntry() != NPC_JENNY || !who->HasAura(SPELL_CRATES_CARRIED))
return;
if (who->GetEntry() == NPC_JENNY && me->IsWithinDistInMap(who, 10.0f))
Unit* owner = who->GetOwner();
if (!owner || !me->IsWithinDistInMap(who, 10.0f))
return;
if (Player* player = owner->ToPlayer())
{
if (Unit* owner = who->GetOwner())
{
if (owner->GetTypeId() == TYPEID_PLAYER)
{
if (who->HasAura(SPELL_CRATES_CARRIED))
{
owner->CastSpell(owner, SPELL_GIVE_JENNY_CREDIT, true); // Maybe is not working.
CAST_PLR(owner)->CompleteQuest(QUEST_LOADER_UP);
CAST_CRE(who)->DisappearAndDie();
}
}
}
owner->CastSpell(owner, SPELL_GIVE_JENNY_CREDIT, true); // Maybe is not working.
player->CompleteQuest(QUEST_LOADER_UP);
who->ToCreature()->DisappearAndDie();
}
}
};
@@ -569,8 +564,8 @@ public:
if (TempSummon* summon = me->ToTempSummon())
if (summon->isSummon())
if (Unit* temp = summon->GetSummoner())
if (temp->GetTypeId() == TYPEID_PLAYER)
CAST_PLR(temp)->KilledMonsterCredit(me->GetEntry(), 0);
if (Player* player = temp->ToPlayer())
player->KilledMonsterCredit(me->GetEntry(), 0);
if (GameObject* go_caribou = me->GetMap()->GetGameObject(go_caribouGUID))
go_caribou->SetGoState(GO_STATE_READY);
@@ -349,10 +349,10 @@ public:
{
/*float x, y, z;
ghost->GetPosition(x, y, z);
Creature* control = me->SummonCreature(CREATURE_GHOST, x, y, z, 0, TEMPSUMMON_TIMED_DESAWN, 30000);
if (control)
if (Creature* control = me->SummonCreature(CREATURE_GHOST, x, y, z, 0, TEMPSUMMON_TIMED_DESAWN, 30000))
{
CAST_PLR(ghost)->Possess(control);
if (Player* player = ghost->ToPlayer())
player->Possess(control);
ghost->DealDamage(ghost, ghost->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL,
false);
}*/
+7 -9
View File
@@ -339,17 +339,15 @@ public:
if (!who)
return;
if (who->GetTypeId() == TYPEID_PLAYER)
Player* player = who->ToPlayer();
if (player && player->GetQuestStatus(10085) == QUEST_STATUS_INCOMPLETE)
{
if (CAST_PLR(who)->GetQuestStatus(10085) == QUEST_STATUS_INCOMPLETE)
uint32 creditMarkerId = me->GetEntry();
if (creditMarkerId >= 18840 && creditMarkerId <= 18843)
{
uint32 creditMarkerId = me->GetEntry();
if ((creditMarkerId >= 18840) && (creditMarkerId <= 18843))
{
// 18840: Sunspring, 18841: Laughing, 18842: Garadar, 18843: Bleeding
if (!CAST_PLR(who)->GetReqKillOrCastCurrentCount(10085, creditMarkerId))
CAST_PLR(who)->KilledMonsterCredit(creditMarkerId, me->GetGUID());
}
// 18840: Sunspring, 18841: Laughing, 18842: Garadar, 18843: Bleeding
if (!player->GetReqKillOrCastCurrentCount(10085, creditMarkerId))
player->KilledMonsterCredit(creditMarkerId, me->GetGUID());
}
}
}
+19 -19
View File
@@ -118,36 +118,33 @@ public:
if (someplayer)
{
Unit* p = Unit::GetUnit(*me, someplayer);
if (p && p->GetTypeId() == TYPEID_PLAYER)
if (Player* player = ObjectAccessor::GetPlayer(*me, someplayer))
{
switch (me->GetEntry())
{
case ENTRY_BNAAR_C_CONSOLE:
CAST_PLR(p)->FailQuest(10299);
CAST_PLR(p)->FailQuest(10329);
player->FailQuest(10299);
player->FailQuest(10329);
break;
case ENTRY_CORUU_C_CONSOLE:
CAST_PLR(p)->FailQuest(10321);
CAST_PLR(p)->FailQuest(10330);
player->FailQuest(10321);
player->FailQuest(10330);
break;
case ENTRY_DURO_C_CONSOLE:
CAST_PLR(p)->FailQuest(10322);
CAST_PLR(p)->FailQuest(10338);
player->FailQuest(10322);
player->FailQuest(10338);
break;
case ENTRY_ARA_C_CONSOLE:
CAST_PLR(p)->FailQuest(10323);
CAST_PLR(p)->FailQuest(10365);
player->FailQuest(10323);
player->FailQuest(10365);
break;
}
}
}
if (goConsole)
{
if (GameObject* go = GameObject::GetGameObject(*me, goConsole))
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
}
}
void DoWaveSpawnForCreature(Creature* creature)
@@ -275,27 +272,30 @@ public:
Talk(EMOTE_COMPLETE);
if (someplayer)
{
Unit* u = Unit::GetUnit(*me, someplayer);
if (u && u->GetTypeId() == TYPEID_PLAYER)
CAST_PLR(u)->KilledMonsterCredit(me->GetEntry(), me->GetGUID());
if (Player* player = ObjectAccessor::GetPlayer(*me, someplayer))
player->KilledMonsterCredit(me->GetEntry(), me->GetGUID());
DoCast(me, SPELL_DISABLE_VISUAL);
}
if (goConsole)
{
if (GameObject* go = GameObject::GetGameObject(*me, goConsole))
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
}
++Phase;
break;
}
} else Event_Timer -= diff;
}
else
Event_Timer -= diff;
if (Wave)
{
if (Wave_Timer <= diff)
{
DoWaveSpawnForCreature(me);
} else Wave_Timer -= diff;
}
else
Wave_Timer -= diff;
}
}
};
@@ -1377,20 +1377,19 @@ public:
{
case TYPEID_UNIT:
if (Unit* owner = killer->GetOwner())
if (owner->GetTypeId() == TYPEID_PLAYER)
CAST_PLR(owner)->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, me);
if (Player* player = owner->ToPlayer())
player->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, me);
break;
case TYPEID_PLAYER:
CAST_PLR(killer)->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, me);
if (Player* player = killer->ToPlayer())
player->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, me);
break;
default:
break;
}
if (Creature* LordIllidan = (Unit::GetCreature(*me, LordIllidanGUID)))
{
LordIllidan->AI()->EnterEvadeMode();
}
}
};
};
@@ -1865,10 +1864,9 @@ public:
Summoned->setFaction(ENRAGED_SOUL_FRIENDLY);
Summoned->GetMotionMaster()->MovePoint(0, totemOspirits->GetPositionX(), totemOspirits->GetPositionY(), Summoned->GetPositionZ());
Unit* Owner = totemOspirits->GetOwner();
if (Owner && Owner->GetTypeId() == TYPEID_PLAYER)
// DoCast(Owner, credit); -- not working!
CAST_PLR(Owner)->KilledMonsterCredit(credit, 0);
if (Unit* owner = totemOspirits->GetOwner())
if (Player* player = owner->ToPlayer())
player->KilledMonsterCredit(credit, 0);
DoCast(totemOspirits, SPELL_SOUL_CAPTURED);
}
}
@@ -167,10 +167,9 @@ public:
void DamageTaken(Unit* done_by, uint32 &damage)
{
if (done_by->GetTypeId() == TYPEID_PLAYER)
if (me->HealthBelowPctDamaged(20, damage))
if (done_by->GetTypeId() == TYPEID_PLAYER && me->HealthBelowPctDamaged(20, damage))
{
CAST_PLR(done_by)->GroupEventHappens(QUEST_10004, me);
done_by->ToPlayer()->GroupEventHappens(QUEST_10004, me);
damage = 0;
EnterEvadeMode();
}
@@ -410,20 +409,18 @@ public:
if (HasEscortState(STATE_ESCORT_ESCORTING))
return;
if (who->GetTypeId() == TYPEID_PLAYER)
Player* player = who->ToPlayer();
if (player && player->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE)
{
if (CAST_PLR(who)->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE)
float Radius = 10.0f;
if (me->IsWithinDistInMap(who, Radius))
{
float Radius = 10.0f;
if (me->IsWithinDistInMap(who, Radius))
{
Start(false, false, who->GetGUID());
}
Start(false, false, who->GetGUID());
}
}
}
void Reset() {}
void Reset() { }
};
};
@@ -583,9 +580,8 @@ public:
me->DeleteThreatList();
me->CombatStop();
me->GetMotionMaster()->MoveTargetedHome();
Player* player = Unit::GetPlayer(*me, PlayerGUID);
if (player)
CAST_PLR(player)->GroupEventHappens(QUEST_WBI, me);
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
player->GroupEventHappens(QUEST_WBI, me);
}
DoMeleeAttackIfReady();
}
@@ -98,10 +98,11 @@ public:
void DamageTaken(Unit* done_by, uint32 &damage)
{
if (done_by->GetTypeId() == TYPEID_PLAYER)
if (me->HealthBelowPctDamaged(30, damage))
Player* player = done_by->ToPlayer();
if (player && me->HealthBelowPctDamaged(30, damage))
{
if (Group* group = CAST_PLR(done_by)->GetGroup())
if (Group* group = player->GetGroup())
{
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
@@ -115,11 +116,11 @@ public:
CanDoQuest = true;
}
}
} else
if (CAST_PLR(done_by)->GetQuestStatus(QUEST_DONTKILLTHEFATONE) == QUEST_STATUS_INCOMPLETE &&
CAST_PLR(done_by)->GetReqKillOrCastCurrentCount(QUEST_DONTKILLTHEFATONE, 18260) == 10)
}
else if (player->GetQuestStatus(QUEST_DONTKILLTHEFATONE) == QUEST_STATUS_INCOMPLETE &&
player->GetReqKillOrCastCurrentCount(QUEST_DONTKILLTHEFATONE, 18260) == 10)
{
CAST_PLR(done_by)->AreaExploredOrEventHappens(QUEST_DONTKILLTHEFATONE);
player->AreaExploredOrEventHappens(QUEST_DONTKILLTHEFATONE);
CanDoQuest = true;
}
}
@@ -229,20 +230,13 @@ public:
if (HasEscortState(STATE_ESCORT_ESCORTING))
return;
if (who->GetTypeId() == TYPEID_PLAYER)
{
if (CAST_PLR(who)->GetQuestStatus(10898) == QUEST_STATUS_INCOMPLETE)
{
float Radius = 10.0f;
if (me->IsWithinDistInMap(who, Radius))
{
Start(false, false, who->GetGUID());
}
}
}
Player* player = who->ToPlayer();
if (player && player->GetQuestStatus(10898) == QUEST_STATUS_INCOMPLETE)
if (me->IsWithinDistInMap(who, 10.0f))
Start(false, false, who->GetGUID());
}
void Reset() {}
void Reset() { }
void UpdateAI(uint32 diff)
{
+79 -77
View File
@@ -761,40 +761,41 @@ public:
void SpellHit(Unit* caster, SpellInfo const* spell)
{
if (caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && spell->Id == 20804)
Player* player = caster->ToPlayer();
if (!player || !me->isAlive() || spell->Id != 20804)
return;
if (player->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)
if (DoctorGUID)
if (Creature* doctor = Unit::GetCreature(*me, DoctorGUID))
CAST_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientSaved(me, player, Coord);
//make not selectable
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
//regen health
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
//stand up
me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND);
Talk(SAY_DOC);
uint32 mobId = me->GetEntry();
me->SetWalk(false);
switch (mobId)
{
if ((CAST_PLR(caster)->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (CAST_PLR(caster)->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE))
if (DoctorGUID)
if (Creature* doctor = Unit::GetCreature(*me, DoctorGUID))
CAST_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientSaved(me, CAST_PLR(caster), Coord);
//make not selectable
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
//regen health
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
//stand up
me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND);
Talk(SAY_DOC);
uint32 mobId = me->GetEntry();
me->SetWalk(false);
switch (mobId)
{
case 12923:
case 12924:
case 12925:
me->GetMotionMaster()->MovePoint(0, H_RUNTOX, H_RUNTOY, H_RUNTOZ);
break;
case 12936:
case 12937:
case 12938:
me->GetMotionMaster()->MovePoint(0, A_RUNTOX, A_RUNTOY, A_RUNTOZ);
break;
}
case 12923:
case 12924:
case 12925:
me->GetMotionMaster()->MovePoint(0, H_RUNTOX, H_RUNTOY, H_RUNTOZ);
break;
case 12936:
case 12937:
case 12938:
me->GetMotionMaster()->MovePoint(0, A_RUNTOX, A_RUNTOY, A_RUNTOZ);
break;
}
}
@@ -1749,52 +1750,53 @@ public:
void ReceiveEmote(Player* player, uint32 emote)
{
me->HandleEmoteCommand(emote);
Unit* own = me->GetOwner();
if (!own || own->GetTypeId() != TYPEID_PLAYER || CAST_PLR(own)->GetTeam() != player->GetTeam())
return;
if (emote == TEXT_EMOTE_KISS)
Unit* owner = me->GetOwner();
if (emote != TEXT_EMOTE_KISS || owner || owner->GetTypeId() != TYPEID_PLAYER ||
owner->ToPlayer()->GetTeam() != player->GetTeam())
{
std::string whisp = "";
switch (rand() % 8)
{
case 0:
whisp.append(SAY_RANDOM_MOJO0);
break;
case 1:
whisp.append(SAY_RANDOM_MOJO1);
break;
case 2:
whisp.append(SAY_RANDOM_MOJO2);
break;
case 3:
whisp.append(SAY_RANDOM_MOJO3);
break;
case 4:
whisp.append(SAY_RANDOM_MOJO4);
break;
case 5:
whisp.append(SAY_RANDOM_MOJO5);
break;
case 6:
whisp.append(SAY_RANDOM_MOJO6a);
whisp.append(player->GetName());
whisp.append(SAY_RANDOM_MOJO6b);
break;
case 7:
whisp.append(SAY_RANDOM_MOJO7);
break;
}
me->MonsterWhisper(whisp.c_str(), player->GetGUID());
if (victimGUID)
if (Player* victim = Unit::GetPlayer(*me, victimGUID))
victim->RemoveAura(43906);//remove polymorph frog thing
me->AddAura(43906, player);//add polymorph frog thing
victimGUID = player->GetGUID();
DoCast(me, 20372, true);//tag.hearts
me->GetMotionMaster()->MoveFollow(player, 0, 0);
hearts = 15000;
return;
}
std::string whisp = "";
switch (rand() % 8)
{
case 0:
whisp.append(SAY_RANDOM_MOJO0);
break;
case 1:
whisp.append(SAY_RANDOM_MOJO1);
break;
case 2:
whisp.append(SAY_RANDOM_MOJO2);
break;
case 3:
whisp.append(SAY_RANDOM_MOJO3);
break;
case 4:
whisp.append(SAY_RANDOM_MOJO4);
break;
case 5:
whisp.append(SAY_RANDOM_MOJO5);
break;
case 6:
whisp.append(SAY_RANDOM_MOJO6a);
whisp.append(player->GetName());
whisp.append(SAY_RANDOM_MOJO6b);
break;
case 7:
whisp.append(SAY_RANDOM_MOJO7);
break;
}
me->MonsterWhisper(whisp.c_str(), player->GetGUID());
if (victimGUID)
if (Player* victim = Unit::GetPlayer(*me, victimGUID))
victim->RemoveAura(43906); // remove polymorph frog thing
me->AddAura(43906, player); // add polymorph frog thing
victimGUID = player->GetGUID();
DoCast(me, 20372, true); // tag.hearts
me->GetMotionMaster()->MoveFollow(player, 0, 0);
hearts = 15000;
}
};