Misc: replace Unit::GetPlayer with ObjectAccessor::GetPlayer and some cosmetic changes
This commit is contained in:
@@ -311,7 +311,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
|
||||
|
||||
Player* FollowerAI::GetLeaderForFollower()
|
||||
{
|
||||
if (Player* player = Unit::GetPlayer(*me, m_uiLeaderGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, m_uiLeaderGUID))
|
||||
{
|
||||
if (player->IsAlive())
|
||||
return player;
|
||||
|
||||
@@ -343,7 +343,7 @@ void SmartAI::UpdateAI(uint32 diff)
|
||||
{
|
||||
if (me->FindNearestCreature(mFollowArrivedEntry, INTERACTION_DISTANCE, true))
|
||||
{
|
||||
if (Player* player = me->GetPlayer(*me, mFollowGuid))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid))
|
||||
{
|
||||
if (!mFollowCreditType)
|
||||
player->RewardPlayerAndGroupAtEvent(mFollowCredit, me);
|
||||
@@ -365,7 +365,9 @@ void SmartAI::UpdateAI(uint32 diff)
|
||||
return;
|
||||
}
|
||||
mFollowArrivedTimer = 1000;
|
||||
} else mFollowArrivedTimer -= diff;
|
||||
}
|
||||
else
|
||||
mFollowArrivedTimer -= diff;
|
||||
}
|
||||
|
||||
if (!UpdateVictim())
|
||||
|
||||
@@ -2526,10 +2526,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo
|
||||
// Increase hit chance from attacker SPELL_AURA_MOD_SPELL_HIT_CHANCE and attacker ratings
|
||||
HitChance += int32(m_modSpellHitChance * 100.0f);
|
||||
|
||||
if (HitChance < 100)
|
||||
HitChance = 100;
|
||||
else if (HitChance > 10000)
|
||||
HitChance = 10000;
|
||||
RoundToInterval(HitChance, 100, 10000);
|
||||
|
||||
int32 tmp = 10000 - HitChance;
|
||||
|
||||
@@ -5741,8 +5738,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// if damage is more than need or target die from damage deal finish spell
|
||||
if (triggeredByAura->GetAmount() <= int32(damage) || GetHealth() <= damage)
|
||||
{
|
||||
// remember guid before aura delete
|
||||
uint64 casterGuid = triggeredByAura->GetCasterGUID();
|
||||
// remember caster before aura delete
|
||||
Unit* caster = triggeredByAura->GetCaster();
|
||||
|
||||
// Remove aura (before cast for prevent infinite loop handlers)
|
||||
RemoveAurasDueToSpell(triggeredByAura->GetId());
|
||||
@@ -5750,7 +5747,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
uint32 spell = sSpellMgr->GetSpellWithRank(27285, dummySpell->GetRank());
|
||||
|
||||
// Cast finish spell (triggeredByAura already not exist!)
|
||||
if (Unit* caster = GetUnit(*this, casterGuid))
|
||||
if (caster)
|
||||
caster->CastSpell(this, spell, true, castItem);
|
||||
return true; // no hidden cooldown
|
||||
}
|
||||
@@ -5765,14 +5762,14 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// if damage is more than need deal finish spell
|
||||
if (triggeredByAura->GetAmount() <= int32(damage))
|
||||
{
|
||||
// remember guid before aura delete
|
||||
uint64 casterGuid = triggeredByAura->GetCasterGUID();
|
||||
// remember caster before aura delete
|
||||
Unit* caster = triggeredByAura->GetCaster();
|
||||
|
||||
// Remove aura (before cast for prevent infinite loop handlers)
|
||||
RemoveAurasDueToSpell(triggeredByAura->GetId());
|
||||
|
||||
// Cast finish spell (triggeredByAura already not exist!)
|
||||
if (Unit* caster = GetUnit(*this, casterGuid))
|
||||
if (caster)
|
||||
caster->CastSpell(this, 32865, true, castItem);
|
||||
return true; // no hidden cooldown
|
||||
}
|
||||
@@ -15933,7 +15930,7 @@ void Unit::RestoreFaction()
|
||||
|
||||
Unit* Unit::GetRedirectThreatTarget()
|
||||
{
|
||||
return _redirectThreadInfo.GetTargetGUID() ? GetUnit(*this, _redirectThreadInfo.GetTargetGUID()) : NULL;
|
||||
return _redirectThreadInfo.GetTargetGUID() ? ObjectAccessor::GetUnit(*this, _redirectThreadInfo.GetTargetGUID()) : NULL;
|
||||
}
|
||||
|
||||
bool Unit::CreateVehicleKit(uint32 id, uint32 creatureEntry)
|
||||
|
||||
@@ -2001,7 +2001,7 @@ class Unit : public WorldObject
|
||||
int32 CalculateSpellDamage(Unit const* target, SpellInfo const* spellProto, uint8 effect_index, int32 const* basePoints = NULL) const;
|
||||
int32 CalcSpellDuration(SpellInfo const* spellProto);
|
||||
int32 ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive, uint32 effectMask);
|
||||
void ModSpellCastTime(SpellInfo const* spellProto, int32 & castTime, Spell* spell=NULL);
|
||||
void ModSpellCastTime(SpellInfo const* spellProto, int32& castTime, Spell* spell = NULL);
|
||||
float CalculateLevelPenalty(SpellInfo const* spellProto) const;
|
||||
|
||||
void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); }
|
||||
|
||||
@@ -998,8 +998,7 @@ int32 Aura::CalcDispelChance(Unit* auraTarget, bool offensive) const
|
||||
if (offensive && auraTarget)
|
||||
resistChance += auraTarget->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST);
|
||||
|
||||
resistChance = resistChance < 0 ? 0 : resistChance;
|
||||
resistChance = resistChance > 100 ? 100 : resistChance;
|
||||
RoundToInterval(resistChance, 0, 100);
|
||||
return 100 - resistChance;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,9 +74,9 @@ class _SpellScript
|
||||
EffectHook(uint8 _effIndex);
|
||||
virtual ~EffectHook() { }
|
||||
|
||||
uint8 GetAffectedEffectsMask(SpellInfo const* spellEntry);
|
||||
bool IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex);
|
||||
virtual bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex) = 0;
|
||||
uint8 GetAffectedEffectsMask(SpellInfo const* spellInfo);
|
||||
bool IsEffectAffected(SpellInfo const* spellInfo, uint8 effIndex);
|
||||
virtual bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex) = 0;
|
||||
std::string EffIndexToString();
|
||||
protected:
|
||||
uint8 effIndex;
|
||||
@@ -86,7 +86,7 @@ class _SpellScript
|
||||
{
|
||||
public:
|
||||
EffectNameCheck(uint16 _effName) { effName = _effName; }
|
||||
bool Check(SpellInfo const* spellEntry, uint8 effIndex);
|
||||
bool Check(SpellInfo const* spellInfo, uint8 effIndex);
|
||||
std::string ToString();
|
||||
private:
|
||||
uint16 effName;
|
||||
@@ -96,7 +96,7 @@ class _SpellScript
|
||||
{
|
||||
public:
|
||||
EffectAuraNameCheck(uint16 _effAurName) { effAurName = _effAurName; }
|
||||
bool Check(SpellInfo const* spellEntry, uint8 effIndex);
|
||||
bool Check(SpellInfo const* spellInfo, uint8 effIndex);
|
||||
std::string ToString();
|
||||
private:
|
||||
uint16 effAurName;
|
||||
@@ -114,7 +114,7 @@ class _SpellScript
|
||||
virtual void Register() = 0;
|
||||
// Function called on server startup, if returns false script won't be used in core
|
||||
// use for: dbc/template data presence/correctness checks
|
||||
virtual bool Validate(SpellInfo const* /*spellEntry*/) { return true; }
|
||||
virtual bool Validate(SpellInfo const* /*spellInfo*/) { return true; }
|
||||
// Function called when script is created, if returns false script will be unloaded afterwards
|
||||
// use for: initializing local script variables (DO NOT USE CONSTRUCTOR FOR THIS PURPOSE!)
|
||||
virtual bool Load() { return true; }
|
||||
@@ -185,7 +185,7 @@ class SpellScript : public _SpellScript
|
||||
public:
|
||||
EffectHandler(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
|
||||
std::string ToString();
|
||||
bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex);
|
||||
bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex);
|
||||
void Call(SpellScript* spellScript, SpellEffIndex effIndex);
|
||||
private:
|
||||
SpellEffectFnType pEffectHandlerScript;
|
||||
@@ -204,7 +204,7 @@ class SpellScript : public _SpellScript
|
||||
{
|
||||
public:
|
||||
TargetHook(uint8 _effectIndex, uint16 _targetType, bool _area);
|
||||
bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex);
|
||||
bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex);
|
||||
std::string ToString();
|
||||
protected:
|
||||
uint16 targetType;
|
||||
@@ -488,7 +488,7 @@ class AuraScript : public _SpellScript
|
||||
public:
|
||||
EffectBase(uint8 _effIndex, uint16 _effName);
|
||||
std::string ToString();
|
||||
bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex);
|
||||
bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex);
|
||||
};
|
||||
class EffectPeriodicHandler : public EffectBase
|
||||
{
|
||||
|
||||
@@ -143,7 +143,7 @@ public:
|
||||
wait_timer = 5000;
|
||||
me->CastSpell(me, SPELL_DK_INITIATE_VISUAL, true);
|
||||
|
||||
if (Player* starter = Unit::GetPlayer(*me, playerGUID))
|
||||
if (Player* starter = ObjectAccessor::GetPlayer(*me, playerGUID))
|
||||
sCreatureTextMgr->SendChat(me, SAY_EVENT_ATTACK, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, starter);
|
||||
|
||||
phase = PHASE_TO_ATTACK;
|
||||
@@ -228,8 +228,8 @@ public:
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
|
||||
phase = PHASE_ATTACKING;
|
||||
|
||||
if (Player* target = Unit::GetPlayer(*me, playerGUID))
|
||||
me->AI()->AttackStart(target);
|
||||
if (Player* target = ObjectAccessor::GetPlayer(*me, playerGUID))
|
||||
AttackStart(target);
|
||||
wait_timer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
{
|
||||
if (speechTimer <= diff)
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, playerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, playerGUID);
|
||||
if (!player)
|
||||
{
|
||||
EnterEvadeMode();
|
||||
@@ -683,7 +683,7 @@ public:
|
||||
{
|
||||
if (ExecuteSpeech_Timer <= diff)
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
|
||||
if (!player)
|
||||
{
|
||||
|
||||
@@ -410,7 +410,7 @@ public:
|
||||
void JustSummoned(Creature* summoned) OVERRIDE
|
||||
{
|
||||
if (instance)
|
||||
if (Player* Target = Unit::GetPlayer(*me, instance->GetData64(DATA_PLAYER_GUID)))
|
||||
if (Player* Target = ObjectAccessor::GetPlayer(*me, instance->GetData64(DATA_PLAYER_GUID)))
|
||||
summoned->AI()->AttackStart(Target);
|
||||
|
||||
Summons.Summon(summoned);
|
||||
|
||||
@@ -150,8 +150,7 @@ class npc_zulaman_hostage : public CreatureScript
|
||||
|
||||
void JustDied(Unit* /*killer*/) OVERRIDE
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
if (player)
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
player->SendLoot(me->GetGUID(), LOOT_CORPSE);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,14 +98,14 @@ public:
|
||||
void JustDied(Unit* /*killer*/) OVERRIDE
|
||||
{
|
||||
if (PlayerGUID)
|
||||
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
player->FailQuest(QUEST_UNEXPECTED_RESULT);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 /*diff*/) OVERRIDE
|
||||
{
|
||||
if (KillCount >= 3 && PlayerGUID)
|
||||
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
player->CompleteQuest(QUEST_UNEXPECTED_RESULT);
|
||||
|
||||
if (Summon)
|
||||
@@ -207,7 +207,7 @@ public:
|
||||
void JustDied(Unit* /*killer*/) OVERRIDE
|
||||
{
|
||||
if (PlayerGUID && !Completed)
|
||||
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
player->FailQuest(QUEST_POWERING_OUR_DEFENSES);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ public:
|
||||
Talk(EMOTE);
|
||||
Completed = true;
|
||||
if (PlayerGUID)
|
||||
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
player->CompleteQuest(QUEST_POWERING_OUR_DEFENSES);
|
||||
|
||||
me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
|
||||
@@ -113,32 +113,22 @@ public:
|
||||
{
|
||||
npc_greengill_slaveAI(Creature* creature) : ScriptedAI(creature) {}
|
||||
|
||||
uint64 PlayerGUID;
|
||||
void EnterCombat(Unit* /*who*/) OVERRIDE { }
|
||||
|
||||
void EnterCombat(Unit* /*who*/)OVERRIDE {}
|
||||
|
||||
void Reset() OVERRIDE
|
||||
void SpellHit(Unit* caster, SpellInfo const* spellInfo) OVERRIDE
|
||||
{
|
||||
PlayerGUID = 0;
|
||||
}
|
||||
|
||||
void SpellHit(Unit* caster, const SpellInfo* spell) OVERRIDE
|
||||
{
|
||||
if (!caster)
|
||||
Player* player = caster->ToPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == ORB && !me->HasAura(ENRAGE))
|
||||
if (spellInfo->Id == ORB && !me->HasAura(ENRAGE))
|
||||
{
|
||||
PlayerGUID = caster->GetGUID();
|
||||
if (PlayerGUID)
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
if (player && player->GetQuestStatus(QUESTG) == QUEST_STATUS_INCOMPLETE)
|
||||
DoCast(player, 45110, true);
|
||||
}
|
||||
if (player->GetQuestStatus(QUESTG) == QUEST_STATUS_INCOMPLETE)
|
||||
DoCast(player, 45110, true);
|
||||
|
||||
DoCast(me, ENRAGE);
|
||||
Unit* Myrmidon = me->FindNearestCreature(DM, 70);
|
||||
if (Myrmidon)
|
||||
|
||||
if (Creature* Myrmidon = me->FindNearestCreature(DM, 70))
|
||||
{
|
||||
me->AddThreat(Myrmidon, 100000.0f);
|
||||
AttackStart(Myrmidon);
|
||||
|
||||
@@ -232,7 +232,7 @@ public:
|
||||
{
|
||||
Unit* target = NULL;
|
||||
if (PlayerGUID)
|
||||
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
if (player->IsAlive() && RAND(0, 1))
|
||||
target = player;
|
||||
|
||||
@@ -248,7 +248,7 @@ public:
|
||||
void JustDied(Unit* /*killer*/) OVERRIDE
|
||||
{
|
||||
if (PlayerGUID)
|
||||
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
if (player->GetQuestStatus(QUEST_PYREWOOD_AMBUSH) == QUEST_STATUS_INCOMPLETE)
|
||||
player->FailQuest(QUEST_PYREWOOD_AMBUSH);
|
||||
}
|
||||
@@ -301,7 +301,7 @@ public:
|
||||
case 5: //end
|
||||
if (PlayerGUID)
|
||||
{
|
||||
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
{
|
||||
me->MonsterSay(NPCSAY_END, LANG_UNIVERSAL, 0); //not blizzlike
|
||||
player->GroupEventHappens(QUEST_PYREWOOD_AMBUSH, me);
|
||||
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
++m_uiPhase;
|
||||
break;
|
||||
case 2:
|
||||
if (Player* player = Unit::GetPlayer(*me, m_uiPlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, m_uiPlayerGUID))
|
||||
player->AreaExploredOrEventHappens(QUEST_590);
|
||||
|
||||
DoCast(me, SPELL_DRINK, true);
|
||||
|
||||
@@ -181,8 +181,8 @@ class npc_winterfin_playmate : public CreatureScript
|
||||
|
||||
if (timer <= diff)
|
||||
{
|
||||
Player* player = Player::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = Creature::GetCreature(*me, orphanGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = ObjectAccessor::GetCreature(*me, orphanGUID);
|
||||
|
||||
if (!orphan || !player)
|
||||
{
|
||||
@@ -280,8 +280,8 @@ class npc_snowfall_glade_playmate : public CreatureScript
|
||||
|
||||
if (timer <= diff)
|
||||
{
|
||||
Player* player = Player::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = Creature::GetCreature(*me, orphanGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = ObjectAccessor::GetCreature(*me, orphanGUID);
|
||||
|
||||
if (!orphan || !player)
|
||||
{
|
||||
@@ -381,8 +381,8 @@ class npc_the_biggest_tree : public CreatureScript
|
||||
|
||||
if (timer <= diff)
|
||||
{
|
||||
Player* player = Player::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = Creature::GetCreature(*me, orphanGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = ObjectAccessor::GetCreature(*me, orphanGUID);
|
||||
|
||||
if (!orphan || !player)
|
||||
{
|
||||
@@ -468,8 +468,8 @@ class npc_high_oracle_soo_roo : public CreatureScript
|
||||
|
||||
if (timer <= diff)
|
||||
{
|
||||
Player* player = Player::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = Creature::GetCreature(*me, orphanGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = ObjectAccessor::GetCreature(*me, orphanGUID);
|
||||
|
||||
if (!orphan || !player)
|
||||
{
|
||||
@@ -557,8 +557,8 @@ class npc_elder_kekek : public CreatureScript
|
||||
|
||||
if (timer <= diff)
|
||||
{
|
||||
Player* player = Player::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = Creature::GetCreature(*me, orphanGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = ObjectAccessor::GetCreature(*me, orphanGUID);
|
||||
|
||||
if (!player || !orphan)
|
||||
{
|
||||
@@ -646,8 +646,8 @@ class npc_the_etymidian : public CreatureScript
|
||||
|
||||
if (timer <= diff)
|
||||
{
|
||||
Player* player = Player::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = Creature::GetCreature(*me, orphanGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = ObjectAccessor::GetCreature(*me, orphanGUID);
|
||||
|
||||
if (!orphan || !player)
|
||||
{
|
||||
@@ -768,8 +768,8 @@ class npc_alexstraza_the_lifebinder : public CreatureScript
|
||||
|
||||
if (timer <= diff)
|
||||
{
|
||||
Player* player = Player::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = Creature::GetCreature(*me, orphanGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = ObjectAccessor::GetCreature(*me, orphanGUID);
|
||||
|
||||
if (!orphan || !player)
|
||||
{
|
||||
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
break;
|
||||
case 3:
|
||||
me->setFaction(FACTION_HOSTILE);
|
||||
if (Player* target = Player::GetPlayer(*me, PlayerGUID))
|
||||
if (Player* target = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
AttackStart(target);
|
||||
|
||||
if (instance)
|
||||
|
||||
@@ -35,7 +35,6 @@ EndContentData */
|
||||
#include "ScriptedGossip.h"
|
||||
#include "Player.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
/*######
|
||||
## npc_spitelashes
|
||||
@@ -371,7 +370,7 @@ public:
|
||||
DoTeleportTo(3706.39f, -3969.15f, 35.9118f);
|
||||
|
||||
//begin swimming and summon depth charges
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
@@ -396,8 +395,7 @@ public:
|
||||
|
||||
if (GrenadeTimer <= diff)
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
if (player)
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
{
|
||||
Talk(SAY_RIZZLE_GRENADE, player->GetGUID());
|
||||
DoCast(player, SPELL_RIZZLE_FROST_GRENADE, true);
|
||||
@@ -407,7 +405,7 @@ public:
|
||||
|
||||
if (CheckTimer <= diff)
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
if (!player)
|
||||
{
|
||||
me->DespawnOrUnsummon();
|
||||
@@ -429,13 +427,6 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void SendText(int32 iTextEntry, Player* player)
|
||||
{
|
||||
LocaleConstant loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
|
||||
const char* text = sObjectMgr->GetTrinityString(iTextEntry, loc_idx);
|
||||
sWorld->SendServerMessage(SERVER_MSG_STRING, text, player);
|
||||
}
|
||||
|
||||
void AttackStart(Unit* who) OVERRIDE
|
||||
{
|
||||
if (!who || PlayerGUID)
|
||||
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
{
|
||||
me->RemoveAurasDueToSpell(SPELL_IRRIDATION);
|
||||
|
||||
if (Player* player = Unit::GetPlayer(*me, pCaster))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, pCaster))
|
||||
{
|
||||
Talk(SAY_HEAL, player->GetGUID());
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@ public:
|
||||
if (!PlayerGUID)
|
||||
return;
|
||||
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
if (player && player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
player->FailQuest(10965);
|
||||
@@ -361,7 +361,7 @@ public:
|
||||
|
||||
void EnterEvadeMode() OVERRIDE
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
if (player && player->IsInCombat() && player->getAttackerForHelper())
|
||||
{
|
||||
AttackStart(player->getAttackerForHelper());
|
||||
@@ -398,7 +398,7 @@ public:
|
||||
{
|
||||
if (checkPlayerTimer <= diff)
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
if (player && player->IsInCombat() && player->getAttackerForHelper())
|
||||
AttackStart(player->getAttackerForHelper());
|
||||
checkPlayerTimer = 1000;
|
||||
@@ -407,9 +407,8 @@ public:
|
||||
|
||||
if (EventOnWait && EventTimer <= diff)
|
||||
{
|
||||
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
if (!player || (player && player->GetQuestStatus(10965) == QUEST_STATUS_NONE))
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
if (!player || player->GetQuestStatus(10965) == QUEST_STATUS_NONE)
|
||||
{
|
||||
me->setDeathState(JUST_DIED);
|
||||
return;
|
||||
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
switch (EventPhase)
|
||||
{
|
||||
case 1:
|
||||
if (Unit* unit = Unit::GetUnit(*me, PlayerGUID))
|
||||
if (Unit* unit = ObjectAccessor::GetUnit(*me, PlayerGUID))
|
||||
{
|
||||
if (GameObject* go = unit->GetGameObject(SPELL_LUNCH))
|
||||
{
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING);
|
||||
break;
|
||||
case 3:
|
||||
if (Player* unit = Unit::GetPlayer(*me, PlayerGUID))
|
||||
if (Player* unit = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
unit->TalkedToCreature(me->GetEntry(), me->GetGUID());
|
||||
|
||||
me->UpdateEntry(NPC_KYLE_FRIENDLY);
|
||||
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
{
|
||||
if (ResetTimer <= diff)
|
||||
{
|
||||
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
{
|
||||
if (player->GetTypeId() == TYPEID_PLAYER && player->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE)
|
||||
player->FailQuest(QUEST_SHATTERED_SALUTE);
|
||||
|
||||
@@ -526,7 +526,7 @@ public:
|
||||
|
||||
void HandleAnimation()
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
@@ -1002,14 +1002,13 @@ public:
|
||||
|
||||
void CheckEventFail()
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if (Group* EventGroup = player->GetGroup())
|
||||
{
|
||||
Player* groupMember;
|
||||
Player* groupMember = NULL;
|
||||
|
||||
uint8 GroupMemberCount = 0;
|
||||
uint8 DeadMemberCount = 0;
|
||||
@@ -1019,7 +1018,7 @@ public:
|
||||
|
||||
for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr)
|
||||
{
|
||||
groupMember = (Unit::GetPlayer(*me, itr->guid));
|
||||
groupMember = ObjectAccessor::GetPlayer(*me, itr->guid);
|
||||
if (!groupMember)
|
||||
continue;
|
||||
if (!groupMember->IsWithinDistInMap(me, EVENT_AREA_RADIUS) && groupMember->GetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) == QUEST_STATUS_INCOMPLETE)
|
||||
|
||||
@@ -366,18 +366,20 @@ public:
|
||||
|
||||
void UpdateAI(uint32 diff) OVERRIDE
|
||||
{
|
||||
if (EventInProgress) {
|
||||
Player* pWarrior = NULL;
|
||||
if (EventInProgress)
|
||||
{
|
||||
Player* warrior = NULL;
|
||||
|
||||
if (PlayerGUID)
|
||||
pWarrior = Unit::GetPlayer(*me, PlayerGUID);
|
||||
warrior = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
|
||||
if (!pWarrior)
|
||||
if (!warrior)
|
||||
return;
|
||||
|
||||
if (!pWarrior->IsAlive() && pWarrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE) {
|
||||
if (!warrior->IsAlive() && warrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
Talk(SAY_TWIGGY_FLATHEAD_DOWN);
|
||||
pWarrior->FailQuest(1719);
|
||||
warrior->FailQuest(1719);
|
||||
|
||||
for (uint8 i = 0; i < 6; ++i) // unsummon challengers
|
||||
{
|
||||
@@ -401,11 +403,12 @@ public:
|
||||
if (!EventGrate && EventInProgress)
|
||||
{
|
||||
float x, y, z;
|
||||
pWarrior->GetPosition(x, y, z);
|
||||
warrior->GetPosition(x, y, z);
|
||||
|
||||
if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324) {
|
||||
pWarrior->AreaExploredOrEventHappens(1719);
|
||||
Talk(SAY_TWIGGY_FLATHEAD_BEGIN, pWarrior->GetGUID());
|
||||
if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324)
|
||||
{
|
||||
warrior->AreaExploredOrEventHappens(1719);
|
||||
Talk(SAY_TWIGGY_FLATHEAD_BEGIN, warrior->GetGUID());
|
||||
|
||||
for (uint8 i = 0; i < 6; ++i)
|
||||
{
|
||||
@@ -447,19 +450,20 @@ public:
|
||||
if (Wave < 6 && AffrayChallenger[Wave] && !EventBigWill)
|
||||
{
|
||||
Talk(SAY_TWIGGY_FLATHEAD_FRAY);
|
||||
Creature* creature = Unit::GetCreature((*me), AffrayChallenger[Wave]);
|
||||
Creature* creature = ObjectAccessor::GetCreature(*me, AffrayChallenger[Wave]);
|
||||
if (creature && (creature->IsAlive()))
|
||||
{
|
||||
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
creature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
|
||||
creature->setFaction(14);
|
||||
creature->AI()->AttackStart(pWarrior);
|
||||
creature->AI()->AttackStart(warrior);
|
||||
++Wave;
|
||||
WaveTimer = 20000;
|
||||
}
|
||||
}
|
||||
else if (Wave >= 6 && !EventBigWill) {
|
||||
else if (Wave >= 6 && !EventBigWill)
|
||||
{
|
||||
if (Creature* creature = me->SummonCreature(NPC_BIG_WILL, -1722, -4341, 6.12f, 6.26f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 480000))
|
||||
{
|
||||
BigWill = creature->GetGUID();
|
||||
@@ -473,7 +477,7 @@ public:
|
||||
}
|
||||
else if (Wave >= 6 && EventBigWill && BigWill)
|
||||
{
|
||||
Creature* creature = Unit::GetCreature((*me), BigWill);
|
||||
Creature* creature = ObjectAccessor::GetCreature(*me, BigWill);
|
||||
if (!creature || !creature->IsAlive())
|
||||
{
|
||||
Talk(SAY_TWIGGY_FLATHEAD_OVER);
|
||||
|
||||
+4
-4
@@ -352,7 +352,7 @@ class npc_snobold_vassal : public CreatureScript
|
||||
|
||||
void JustDied(Unit* /*killer*/) OVERRIDE
|
||||
{
|
||||
if (Unit* target = Unit::GetPlayer(*me, _targetGUID))
|
||||
if (Unit* target = ObjectAccessor::GetPlayer(*me, _targetGUID))
|
||||
if (target->IsAlive())
|
||||
target->RemoveAurasDueToSpell(SPELL_SNOBOLLED);
|
||||
if (_instance)
|
||||
@@ -379,7 +379,7 @@ class npc_snobold_vassal : public CreatureScript
|
||||
if (!UpdateVictim() || _targetDied)
|
||||
return;
|
||||
|
||||
if (Unit* target = Unit::GetPlayer(*me, _targetGUID))
|
||||
if (Unit* target = ObjectAccessor::GetPlayer(*me, _targetGUID))
|
||||
{
|
||||
if (!target->IsAlive())
|
||||
{
|
||||
@@ -907,7 +907,7 @@ class boss_icehowl : public CreatureScript
|
||||
else
|
||||
{
|
||||
// Landed from Hop backwards (start trample)
|
||||
if (Unit::GetPlayer(*me, _trampleTargetGUID))
|
||||
if (ObjectAccessor::GetPlayer(*me, _trampleTargetGUID))
|
||||
_stage = 4;
|
||||
else
|
||||
_stage = 6;
|
||||
@@ -1046,7 +1046,7 @@ class boss_icehowl : public CreatureScript
|
||||
{
|
||||
case EVENT_TRAMPLE:
|
||||
{
|
||||
if (Unit* target = Unit::GetPlayer(*me, _trampleTargetGUID))
|
||||
if (Unit* target = ObjectAccessor::GetPlayer(*me, _trampleTargetGUID))
|
||||
{
|
||||
me->StopMoving();
|
||||
me->AttackStop();
|
||||
|
||||
@@ -283,6 +283,18 @@ public:
|
||||
|
||||
SummonList spawns; // adds spawn by the trigger. kept in separated list (i.e. not in summons)
|
||||
|
||||
void ResetPlayerScale()
|
||||
{
|
||||
std::map<uint64, float>::const_iterator itr;
|
||||
for (itr = chained.begin(); itr != chained.end(); ++itr)
|
||||
{
|
||||
if (Player* charmed = ObjectAccessor::GetPlayer(*me, itr->first))
|
||||
charmed->SetObjectScale(itr->second);
|
||||
}
|
||||
|
||||
chained.clear();
|
||||
}
|
||||
|
||||
void Reset() OVERRIDE
|
||||
{
|
||||
_Reset();
|
||||
@@ -292,14 +304,8 @@ public:
|
||||
|
||||
me->setFaction(35);
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE);
|
||||
std::map<uint64, float>::const_iterator itr;
|
||||
for (itr = chained.begin(); itr != chained.end(); ++itr)
|
||||
{
|
||||
if (Player* charmed = Unit::GetPlayer(*me, (*itr).first))
|
||||
charmed->SetObjectScale((*itr).second);
|
||||
}
|
||||
|
||||
chained.clear();
|
||||
ResetPlayerScale();
|
||||
spawns.DespawnAll();
|
||||
|
||||
FindGameObjects();
|
||||
@@ -340,13 +346,7 @@ public:
|
||||
_JustDied();
|
||||
Talk(SAY_DEATH);
|
||||
|
||||
std::map<uint64, float>::const_iterator itr;
|
||||
for (itr = chained.begin(); itr != chained.end(); ++itr)
|
||||
{
|
||||
if (Player* player = Unit::GetPlayer(*me, (*itr).first))
|
||||
player->SetObjectScale((*itr).second);
|
||||
}
|
||||
chained.clear();
|
||||
ResetPlayerScale();
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) OVERRIDE
|
||||
@@ -523,11 +523,11 @@ public:
|
||||
std::map<uint64, float>::iterator itr;
|
||||
for (itr = chained.begin(); itr != chained.end();)
|
||||
{
|
||||
if (Unit* player = Unit::GetPlayer(*me, (*itr).first))
|
||||
if (Unit* player = ObjectAccessor::GetPlayer(*me, itr->first))
|
||||
{
|
||||
if (!player->IsCharmed())
|
||||
{
|
||||
player->SetObjectScale((*itr).second);
|
||||
player->SetObjectScale(itr->second);
|
||||
std::map<uint64, float>::iterator next = itr;
|
||||
++next;
|
||||
chained.erase(itr);
|
||||
|
||||
@@ -142,7 +142,7 @@ public:
|
||||
break;
|
||||
case 7:
|
||||
DoCast(me, SPELL_EXPLODE_CART, true);
|
||||
if (Player* caster = Unit::GetPlayer(*me, casterGuid))
|
||||
if (Player* caster = ObjectAccessor::GetPlayer(*me, casterGuid))
|
||||
caster->KilledMonster(me->GetCreatureTemplate(), me->GetGUID());
|
||||
phaseTimer = 5000;
|
||||
phase = 8;
|
||||
@@ -857,7 +857,7 @@ public:
|
||||
{
|
||||
if (me->IsWithinDistInMap(who, INTERACTION_DISTANCE))
|
||||
{
|
||||
if (Player* pHarpooner = Unit::GetPlayer(*me, HarpoonerGUID))
|
||||
if (Player* pHarpooner = ObjectAccessor::GetPlayer(*me, HarpoonerGUID))
|
||||
{
|
||||
pHarpooner->KilledMonsterCredit(26175, 0);
|
||||
pHarpooner->RemoveAura(SPELL_DRAKE_HATCHLING_SUBDUED);
|
||||
@@ -873,7 +873,7 @@ public:
|
||||
{
|
||||
if (WithRedDragonBlood && HarpoonerGUID && !me->HasAura(SPELL_RED_DRAGONBLOOD))
|
||||
{
|
||||
if (Player* pHarpooner = Unit::GetPlayer(*me, HarpoonerGUID))
|
||||
if (Player* pHarpooner = ObjectAccessor::GetPlayer(*me, HarpoonerGUID))
|
||||
{
|
||||
EnterEvadeMode();
|
||||
StartFollow(pHarpooner, 35, NULL);
|
||||
@@ -1718,7 +1718,7 @@ public:
|
||||
|
||||
void GotStinged(uint64 casterGUID)
|
||||
{
|
||||
if (Player* caster = Player::GetPlayer(*me, casterGUID))
|
||||
if (Player* caster = ObjectAccessor::GetPlayer(*me, casterGUID))
|
||||
{
|
||||
uint32 step = caster->GetAuraCount(SPELL_NEURAL_NEEDLE) + 1;
|
||||
switch (step)
|
||||
@@ -2378,7 +2378,7 @@ public:
|
||||
{
|
||||
me->StopMoving();
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, 0);
|
||||
if (Player* player = me->GetPlayer(*me, uiPlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, uiPlayerGUID))
|
||||
me->SetFacingToObject(player);
|
||||
uiEventTimer = 3000;
|
||||
uiEventPhase = 1;
|
||||
@@ -2392,7 +2392,7 @@ public:
|
||||
void AttackPlayer()
|
||||
{
|
||||
me->setFaction(14);
|
||||
if (Player* player = me->GetPlayer(*me, uiPlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, uiPlayerGUID))
|
||||
me->AI()->AttackStart(player);
|
||||
}
|
||||
|
||||
@@ -2428,7 +2428,7 @@ public:
|
||||
{
|
||||
case NPC_SALTY_JOHN_THORPE:
|
||||
Talk(SAY_HIDDEN_CULTIST_4);
|
||||
if (Player* player = me->GetPlayer(*me, uiPlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, uiPlayerGUID))
|
||||
me->SetFacingToObject(player);
|
||||
uiEventTimer = 3000;
|
||||
uiEventPhase = 3;
|
||||
|
||||
@@ -638,7 +638,7 @@ public:
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_STRAGGLER_1:
|
||||
if (Player* player = Unit::GetPlayer(*me, _playerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID))
|
||||
DoCast(player, SPELL_VENTURE_STRAGGLER_CREDIT);
|
||||
me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()+7, me->GetPositionZ());
|
||||
_events.ScheduleEvent(EVENT_STRAGGLER_2, 2500);
|
||||
|
||||
@@ -338,7 +338,7 @@ public:
|
||||
|
||||
void JustSummoned(Creature* summon) OVERRIDE
|
||||
{
|
||||
if (Player* player = me->GetPlayer(*me, uiPlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, uiPlayerGUID))
|
||||
{
|
||||
if (player->IsAlive())
|
||||
{
|
||||
|
||||
@@ -540,8 +540,8 @@ public:
|
||||
{
|
||||
if (timer <= diff)
|
||||
{
|
||||
Player* player = Player::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = Creature::GetCreature(*me, orphanGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, playerGUID);
|
||||
Creature* orphan = ObjectAccessor::GetCreature(*me, orphanGUID);
|
||||
|
||||
if (!orphan || !player)
|
||||
{
|
||||
|
||||
@@ -341,7 +341,7 @@ public:
|
||||
|
||||
if (uiPhase)
|
||||
{
|
||||
Player* player = me->GetPlayer(*me, _playerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID);
|
||||
|
||||
if (uiTimer <= diff)
|
||||
{
|
||||
@@ -1502,7 +1502,7 @@ public:
|
||||
_events.ScheduleEvent(EVENT_TURN_TO_POT, urand(25000, 41000));
|
||||
break;
|
||||
case EVENT_EASY_123:
|
||||
if (Player* player = Unit::GetPlayer(*me, _playerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID))
|
||||
{
|
||||
Talk(SAY_EASY_123, _playerGUID);
|
||||
DoCast(player, SPELL_RANDOM_INGREDIENT_EASY_AURA);
|
||||
@@ -1510,7 +1510,7 @@ public:
|
||||
}
|
||||
break;
|
||||
case EVENT_MEDIUM_4:
|
||||
if (Player* player = Unit::GetPlayer(*me, _playerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID))
|
||||
{
|
||||
Talk(SAY_MEDIUM_4, _playerGUID);
|
||||
DoCast(player, SPELL_RANDOM_INGREDIENT_MEDIUM_AURA);
|
||||
@@ -1518,7 +1518,7 @@ public:
|
||||
}
|
||||
break;
|
||||
case EVENT_MEDIUM_5:
|
||||
if (Player* player = Unit::GetPlayer(*me, _playerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID))
|
||||
{
|
||||
Talk(SAY_MEDIUM_5, _playerGUID);
|
||||
DoCast(player, SPELL_RANDOM_INGREDIENT_MEDIUM_AURA);
|
||||
@@ -1526,7 +1526,7 @@ public:
|
||||
}
|
||||
break;
|
||||
case EVENT_HARD_6:
|
||||
if (Player* player = Unit::GetPlayer(*me, _playerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID))
|
||||
{
|
||||
Talk(SAY_HARD_6, _playerGUID);
|
||||
DoCast(player, SPELL_RANDOM_INGREDIENT_HARD_AURA);
|
||||
|
||||
@@ -31,10 +31,6 @@ EndScriptData */
|
||||
#include "Player.h"
|
||||
#include "SpellInfo.h"
|
||||
|
||||
#define GETGO(obj, guid) GameObject* obj = instance->instance->GetGameObject(guid)
|
||||
#define GETUNIT(unit, guid) Unit* unit = Unit::GetUnit(*me, guid)
|
||||
#define GETCRE(cre, guid) Creature* cre = Unit::GetCreature(*me, guid)
|
||||
|
||||
#define EMOTE_UNABLE_TO_SUMMON "%s is unable to summon Maiev Shadowsong and enter Phase 4. Resetting Encounter."
|
||||
|
||||
// Other defines
|
||||
@@ -409,11 +405,11 @@ public:
|
||||
|
||||
void EnrageCheck()
|
||||
{
|
||||
if (GETUNIT(Glaive, GlaiveGUID))
|
||||
if (Creature* glaive = ObjectAccessor::GetCreature(*me, GlaiveGUID))
|
||||
{
|
||||
if (!me->IsWithinDistInMap(Glaive, FLAME_ENRAGE_DISTANCE))
|
||||
if (!me->IsWithinDistInMap(glaive, FLAME_ENRAGE_DISTANCE))
|
||||
{
|
||||
Glaive->InterruptNonMeleeSpells(true);
|
||||
glaive->InterruptNonMeleeSpells(true);
|
||||
DoCast(me, SPELL_FLAME_ENRAGE, true);
|
||||
DoResetThreat();
|
||||
if (SelectTarget(SELECT_TARGET_RANDOM, 0))
|
||||
@@ -424,7 +420,7 @@ public:
|
||||
}
|
||||
else if (!me->HasAura(SPELL_AZZINOTH_CHANNEL))
|
||||
{
|
||||
Glaive->CastSpell(me, SPELL_AZZINOTH_CHANNEL, false);
|
||||
glaive->CastSpell(me, SPELL_AZZINOTH_CHANNEL, false);
|
||||
me->RemoveAurasDueToSpell(SPELL_FLAME_ENRAGE);
|
||||
}
|
||||
}
|
||||
@@ -694,13 +690,14 @@ public:
|
||||
}
|
||||
if (MaievGUID)
|
||||
{
|
||||
GETCRE(Maiev, MaievGUID);
|
||||
if (Maiev && Maiev->IsAlive())
|
||||
Maiev->AI()->DoAction(NextPhase);
|
||||
if (Creature* maiev = ObjectAccessor::GetCreature(*me, MaievGUID))
|
||||
if (maiev->IsAlive())
|
||||
maiev->AI()->DoAction(NextPhase);
|
||||
}
|
||||
Phase = NextPhase;
|
||||
Event = EVENT_NULL;
|
||||
}
|
||||
|
||||
void CastEyeBlast()
|
||||
{
|
||||
me->InterruptNonMeleeSpells(false);
|
||||
@@ -738,26 +735,27 @@ public:
|
||||
me->SetTarget(Trigger->GetGUID());
|
||||
DoCast(Trigger, SPELL_EYE_BLAST);
|
||||
}
|
||||
|
||||
void SummonFlamesOfAzzinoth()
|
||||
{
|
||||
Talk(SAY_ILLIDAN_SUMMONFLAMES);
|
||||
|
||||
for (uint8 i = 0; i < 2; ++i)
|
||||
{
|
||||
if (GETUNIT(Glaive, GlaiveGUID[i]))
|
||||
if (Creature* glaive = ObjectAccessor::GetCreature(*me, GlaiveGUID[i]))
|
||||
{
|
||||
Creature* Flame = me->SummonCreature(FLAME_OF_AZZINOTH, GlaivePosition[i+2].x, GlaivePosition[i+2].y, GlaivePosition[i+2].z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
|
||||
if (Flame)
|
||||
if (Creature* flame = me->SummonCreature(FLAME_OF_AZZINOTH, GlaivePosition[i+2].x, GlaivePosition[i+2].y, GlaivePosition[i+2].z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000))
|
||||
{
|
||||
Flame->setFaction(me->getFaction()); // Just in case the database has it as a different faction
|
||||
Flame->SetMeleeDamageSchool(SPELL_SCHOOL_FIRE);
|
||||
FlameGUID[i] = Flame->GetGUID(); // Record GUID in order to check if they're dead later on to move to the next phase
|
||||
CAST_AI(npc_flame_of_azzinoth::flame_of_azzinothAI, Flame->AI())->SetGlaiveGUID(GlaiveGUID[i]);
|
||||
Glaive->CastSpell(Flame, SPELL_AZZINOTH_CHANNEL, false); // Glaives do some random Beam type channel on it.
|
||||
flame->setFaction(me->getFaction()); // Just in case the database has it as a different faction
|
||||
flame->SetMeleeDamageSchool(SPELL_SCHOOL_FIRE);
|
||||
FlameGUID[i] = flame->GetGUID(); // Record GUID in order to check if they're dead later on to move to the next phase
|
||||
CAST_AI(npc_flame_of_azzinoth::flame_of_azzinothAI, flame->AI())->SetGlaiveGUID(GlaiveGUID[i]);
|
||||
glaive->CastSpell(flame, SPELL_AZZINOTH_CHANNEL, false); // Glaives do some random Beam type channel on it.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SummonMaiev()
|
||||
{
|
||||
DoCast(me, SPELL_SHADOW_PRISON, true);
|
||||
@@ -853,11 +851,9 @@ public:
|
||||
{
|
||||
if (GlaiveGUID[i])
|
||||
{
|
||||
if (GETUNIT(Glaive, GlaiveGUID[i]))
|
||||
{
|
||||
Glaive->SetVisible(false);
|
||||
Glaive->setDeathState(JUST_DIED); // Despawn the Glaive
|
||||
}
|
||||
if (Creature* glaive = ObjectAccessor::GetCreature(*me, GlaiveGUID[i]))
|
||||
glaive->DespawnOrUnsummon();
|
||||
|
||||
GlaiveGUID[i] = 0;
|
||||
}
|
||||
}
|
||||
@@ -1173,9 +1169,10 @@ public:
|
||||
damage = 0;
|
||||
else
|
||||
{
|
||||
GETUNIT(Illidan, IllidanGUID);
|
||||
if (Illidan && Illidan->GetVictim() == me)
|
||||
damage = me->CountPctFromMaxHealth(10);
|
||||
if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID))
|
||||
if (illidan->GetVictim() == me)
|
||||
damage = me->CountPctFromMaxHealth(10);
|
||||
|
||||
if (damage >= me->GetHealth())
|
||||
damage = 0;
|
||||
}
|
||||
@@ -1190,9 +1187,9 @@ public:
|
||||
AttackStartNoMove(who);
|
||||
else if (Phase == PHASE_DEMON || Phase == PHASE_TRANSFORM_SEQUENCE)
|
||||
{
|
||||
GETUNIT(Illidan, IllidanGUID);
|
||||
if (Illidan && me->IsWithinDistInMap(Illidan, 25))
|
||||
BlinkToPlayer();// Do not let dread aura hurt her.
|
||||
if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID))
|
||||
if (me->IsWithinDistInMap(illidan, 25))
|
||||
BlinkToPlayer(); // Do not let dread aura hurt her.
|
||||
AttackStartNoMove(who);
|
||||
}
|
||||
else
|
||||
@@ -1253,11 +1250,11 @@ public:
|
||||
|
||||
void BlinkToPlayer()
|
||||
{
|
||||
if (GETCRE(Illidan, IllidanGUID))
|
||||
if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID))
|
||||
{
|
||||
Unit* target = Illidan->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0);
|
||||
Unit* target = illidan->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0);
|
||||
|
||||
if (!target || !me->IsWithinDistInMap(target, 80) || Illidan->IsWithinDistInMap(target, 20))
|
||||
if (!target || !me->IsWithinDistInMap(target, 80) || illidan->IsWithinDistInMap(target, 20))
|
||||
{
|
||||
uint8 pos = rand()%4;
|
||||
BlinkTo(HoverPosition[pos].x, HoverPosition[pos].y, HoverPosition[pos].z);
|
||||
@@ -1329,8 +1326,8 @@ public:
|
||||
{
|
||||
me->SetVisible(false);
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
if (GETCRE(Illidan, IllidanGUID))
|
||||
CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->DeleteFromThreatList(me->GetGUID());
|
||||
if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID))
|
||||
CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->DeleteFromThreatList(me->GetGUID());
|
||||
me->AttackStop();
|
||||
Timer[EVENT_MAIEV_STEALTH] = 60000; // reappear after 1 minute
|
||||
MaxTimer = 1;
|
||||
@@ -1469,15 +1466,15 @@ public:
|
||||
instance->SetData(DATA_ILLIDANSTORMRAGEEVENT, IN_PROGRESS);
|
||||
for (uint8 i = 0; i < 2; ++i)
|
||||
instance->HandleGameObject(DoorGUID[i], false);
|
||||
if (GETCRE(Illidan, IllidanGUID))
|
||||
if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID))
|
||||
{
|
||||
Illidan->RemoveAurasDueToSpell(SPELL_KNEEL);
|
||||
me->SetInFront(Illidan);
|
||||
Illidan->SetInFront(me);
|
||||
illidan->RemoveAurasDueToSpell(SPELL_KNEEL);
|
||||
me->SetInFront(illidan);
|
||||
illidan->SetInFront(me);
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
Illidan->GetMotionMaster()->MoveIdle();
|
||||
CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->AkamaGUID = me->GetGUID();
|
||||
CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->EnterPhase(PHASE_TALK_SEQUENCE);
|
||||
illidan->GetMotionMaster()->MoveIdle();
|
||||
CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->AkamaGUID = me->GetGUID();
|
||||
CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->EnterPhase(PHASE_TALK_SEQUENCE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1488,8 +1485,8 @@ public:
|
||||
if (!JustCreated)
|
||||
return;
|
||||
float x, y, z;
|
||||
if (GETGO(Gate, GateGUID))
|
||||
Gate->GetPosition(x, y, z);
|
||||
if (GameObject* gate = ObjectAccessor::GetGameObject(*me, GateGUID))
|
||||
gate->GetPosition(x, y, z);
|
||||
else
|
||||
return; // if door not spawned, don't crash server
|
||||
|
||||
@@ -1531,8 +1528,8 @@ public:
|
||||
WalkCount = 0;
|
||||
else if (Phase == PHASE_TALK)
|
||||
{
|
||||
if (GETCRE(Illidan, IllidanGUID))
|
||||
CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->DeleteFromThreatList(me->GetGUID());
|
||||
if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID))
|
||||
CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->DeleteFromThreatList(me->GetGUID());
|
||||
EnterEvadeMode();
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
++WalkCount;
|
||||
@@ -1554,10 +1551,10 @@ public:
|
||||
}
|
||||
break;
|
||||
case PHASE_FIGHT_ILLIDAN:
|
||||
if (GETUNIT(Illidan, IllidanGUID))
|
||||
if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID))
|
||||
{
|
||||
me->AddThreat(Illidan, 10000000.0f);
|
||||
me->GetMotionMaster()->MoveChase(Illidan);
|
||||
me->AddThreat(illidan, 10000000.0f);
|
||||
me->GetMotionMaster()->MoveChase(illidan);
|
||||
}
|
||||
Timer = 30000; // chain lightning
|
||||
break;
|
||||
@@ -1584,10 +1581,10 @@ public:
|
||||
switch (TalkCount)
|
||||
{
|
||||
case 0:
|
||||
if (GETCRE(Illidan, IllidanGUID))
|
||||
if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID))
|
||||
{
|
||||
CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->Timer[EVENT_TAUNT] += 30000;
|
||||
Illidan->AI()->Talk(SAY_ILLIDAN_MINION);
|
||||
CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->Timer[EVENT_TAUNT] += 30000;
|
||||
illidan->AI()->Talk(SAY_ILLIDAN_MINION);
|
||||
}
|
||||
Timer = 8000;
|
||||
break;
|
||||
@@ -1728,8 +1725,8 @@ public:
|
||||
break;
|
||||
case PHASE_FIGHT_ILLIDAN:
|
||||
{
|
||||
GETUNIT(Illidan, IllidanGUID);
|
||||
if (Illidan && Illidan->HealthBelowPct(90))
|
||||
Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID);
|
||||
if (illidan && illidan->HealthBelowPct(90))
|
||||
EnterPhase(PHASE_TALK);
|
||||
else
|
||||
{
|
||||
@@ -1752,9 +1749,9 @@ public:
|
||||
me->AddThreat(Elite, 1000000.0f);
|
||||
}
|
||||
Timer = urand(10000, 16000);
|
||||
GETUNIT(Illidan, IllidanGUID);
|
||||
if (Illidan && Illidan->HealthBelowPct(10))
|
||||
EnterPhase(PHASE_RETURN);
|
||||
if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID))
|
||||
if (illidan->HealthBelowPct(10))
|
||||
EnterPhase(PHASE_RETURN);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1807,16 +1804,12 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::Reset()
|
||||
|
||||
if (AkamaGUID)
|
||||
{
|
||||
if (GETCRE(Akama, AkamaGUID))
|
||||
if (Creature* akama = ObjectAccessor::GetCreature(*me, AkamaGUID))
|
||||
{
|
||||
if (!Akama->IsAlive())
|
||||
Akama->Respawn();
|
||||
if (!akama->IsAlive())
|
||||
akama->Respawn();
|
||||
else
|
||||
{
|
||||
CAST_AI(npc_akama_illidan::npc_akama_illidanAI, Akama->AI())->EnterEvadeMode();
|
||||
Akama->GetMotionMaster()->MoveTargetedHome();
|
||||
CAST_AI(npc_akama_illidan::npc_akama_illidanAI, Akama->AI())->Reset();
|
||||
}
|
||||
akama->AI()->EnterEvadeMode();
|
||||
}
|
||||
AkamaGUID = 0;
|
||||
}
|
||||
@@ -1908,11 +1901,11 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::HandleTalkSequence()
|
||||
me->SetWalk(false);
|
||||
break;
|
||||
case 9:
|
||||
if (GETCRE(Akama, AkamaGUID))
|
||||
if (Creature* akama = ObjectAccessor::GetCreature(*me, AkamaGUID))
|
||||
{
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
|
||||
me->AddThreat(Akama, 100.0f);
|
||||
CAST_AI(npc_akama_illidan::npc_akama_illidanAI, Akama->AI())->EnterPhase(PHASE_FIGHT_ILLIDAN);
|
||||
me->AddThreat(akama, 100.0f);
|
||||
CAST_AI(npc_akama_illidan::npc_akama_illidanAI, akama->AI())->EnterPhase(PHASE_FIGHT_ILLIDAN);
|
||||
EnterPhase(PHASE_NORMAL);
|
||||
}
|
||||
break;
|
||||
@@ -1920,23 +1913,23 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::HandleTalkSequence()
|
||||
SummonMaiev();
|
||||
break;
|
||||
case 11:
|
||||
if (GETUNIT(Maiev, MaievGUID))
|
||||
if (Creature* maiev = ObjectAccessor::GetCreature(*me, MaievGUID))
|
||||
{
|
||||
Maiev->SetVisible(true); // Maiev is now visible
|
||||
Maiev->CastSpell(Maiev, SPELL_TELEPORT_VISUAL, true); // onoz she looks like she teleported!
|
||||
Maiev->SetInFront(me); // Have her face us
|
||||
me->SetInFront(Maiev); // Face her, so it's not rude =P
|
||||
Maiev->GetMotionMaster()->MoveIdle();
|
||||
maiev->SetVisible(true); // Maiev is now visible
|
||||
maiev->CastSpell(maiev, SPELL_TELEPORT_VISUAL, true); // onoz she looks like she teleported!
|
||||
maiev->SetInFront(me); // Have her face us
|
||||
me->SetInFront(maiev); // Face her, so it's not rude =P
|
||||
maiev->GetMotionMaster()->MoveIdle();
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
if (GETCRE(Maiev, MaievGUID))
|
||||
if (Creature* maiev = ObjectAccessor::GetCreature(*me, MaievGUID))
|
||||
{
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
|
||||
Maiev->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
|
||||
Maiev->AddThreat(me, 10000000.0f); // Have Maiev add a lot of threat on us so that players don't pull her off if they damage her via AOE
|
||||
Maiev->AI()->AttackStart(me); // Force Maiev to attack us.
|
||||
maiev->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
|
||||
maiev->AddThreat(me, 10000000.0f); // Have Maiev add a lot of threat on us so that players don't pull her off if they damage her via AOE
|
||||
maiev->AI()->AttackStart(me); // Force Maiev to attack us.
|
||||
EnterPhase(PHASE_NORMAL_MAIEV);
|
||||
}
|
||||
break;
|
||||
@@ -1945,26 +1938,26 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::HandleTalkSequence()
|
||||
Summons.DespawnAll();
|
||||
break;
|
||||
case 17:
|
||||
if (GETCRE(Akama, AkamaGUID))
|
||||
if (Creature* akama = ObjectAccessor::GetCreature(*me, AkamaGUID))
|
||||
{
|
||||
if (!me->IsWithinDistInMap(Akama, 15))
|
||||
if (!me->IsWithinDistInMap(akama, 15))
|
||||
{
|
||||
float x, y, z;
|
||||
me->GetPosition(x, y, z);
|
||||
x += 10; y += 10;
|
||||
Akama->GetMotionMaster()->Clear(false);
|
||||
akama->GetMotionMaster()->Clear(false);
|
||||
// Akama->GetMotionMaster()->MoveIdle();
|
||||
Akama->SetPosition(x, y, z, 0.0f);
|
||||
Akama->MonsterMoveWithSpeed(x, y, z, 0); // Illidan must not die until Akama arrives.
|
||||
Akama->GetMotionMaster()->MoveChase(me);
|
||||
akama->SetPosition(x, y, z, 0.0f);
|
||||
akama->MonsterMoveWithSpeed(x, y, z, 0); // Illidan must not die until Akama arrives.
|
||||
akama->GetMotionMaster()->MoveChase(me);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 19: // Make Maiev leave
|
||||
if (GETUNIT(Maiev, MaievGUID))
|
||||
if (Creature* maiev = ObjectAccessor::GetCreature(*me, MaievGUID))
|
||||
{
|
||||
Maiev->CastSpell(Maiev, SPELL_TELEPORT_VISUAL, true);
|
||||
Maiev->setDeathState(JUST_DIED);
|
||||
maiev->CastSpell(maiev, SPELL_TELEPORT_VISUAL, true);
|
||||
maiev->setDeathState(JUST_DIED);
|
||||
me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD);
|
||||
}
|
||||
break;
|
||||
@@ -2208,22 +2201,24 @@ public:
|
||||
AttackStart(target);
|
||||
else
|
||||
{
|
||||
me->SetVisible(false);
|
||||
me->setDeathState(JUST_DIED);
|
||||
me->DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (CheckTimer <= diff)
|
||||
{
|
||||
GETUNIT(Illidan, IllidanGUID);
|
||||
if (!Illidan || Illidan->ToCreature()->IsInEvadeMode())
|
||||
Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID);
|
||||
if (!illidan || illidan->IsInEvadeMode())
|
||||
{
|
||||
me->SetVisible(false);
|
||||
me->setDeathState(JUST_DIED);
|
||||
me->DespawnOrUnsummon();
|
||||
return;
|
||||
} else CheckTimer = 5000;
|
||||
} else CheckTimer -= diff;
|
||||
}
|
||||
else
|
||||
CheckTimer = 5000;
|
||||
}
|
||||
else
|
||||
CheckTimer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ class boss_omor_the_unscarred : public CreatureScript
|
||||
{
|
||||
if (ShadowWhip_Timer <= diff)
|
||||
{
|
||||
if (Player* temp = Unit::GetPlayer(*me, PlayerGUID))
|
||||
if (Player* temp = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
{
|
||||
//if unit dosen't have this flag, then no pulling back (script will attempt cast, even if orbital strike was resisted)
|
||||
if (temp->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR))
|
||||
|
||||
@@ -500,7 +500,6 @@ public:
|
||||
}
|
||||
|
||||
void MoveInLineOfSight(Unit* who) OVERRIDE
|
||||
|
||||
{
|
||||
if (!who || (!who->IsAlive()))
|
||||
return;
|
||||
@@ -516,15 +515,16 @@ public:
|
||||
|
||||
void MovementInform(uint32 /*type*/, uint32 id) OVERRIDE
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
if (id == 1)
|
||||
{
|
||||
GameObject* Keg = me->FindNearestGameObject(GO_KEG, 20);
|
||||
if (Keg)
|
||||
if (GameObject* Keg = me->FindNearestGameObject(GO_KEG, 20))
|
||||
Keg->Delete();
|
||||
|
||||
me->HandleEmoteCommand(7);
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
Creature* Credit = me->FindNearestCreature(NPC_QUEST_CREDIT, 50, true);
|
||||
if (player && Credit)
|
||||
player->KilledMonster(Credit->GetCreatureTemplate(), Credit->GetGUID());
|
||||
@@ -1017,7 +1017,7 @@ class npc_simon_bunny : public CreatureScript
|
||||
}
|
||||
|
||||
if (rewSpell)
|
||||
if (Player* player = me->GetPlayer(*me, playerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID))
|
||||
DoCast(player, rewSpell, true);
|
||||
}
|
||||
|
||||
@@ -1032,7 +1032,7 @@ class npc_simon_bunny : public CreatureScript
|
||||
{
|
||||
if (large)
|
||||
{
|
||||
if (Player* player = me->GetPlayer(*me, playerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID))
|
||||
if (Creature* guardian = me->SummonCreature(NPC_APEXIS_GUARDIAN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() - zCoordCorrection, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000))
|
||||
guardian->AI()->AttackStart(player);
|
||||
|
||||
@@ -1042,7 +1042,7 @@ class npc_simon_bunny : public CreatureScript
|
||||
{
|
||||
fails++;
|
||||
|
||||
if (Player* player = me->GetPlayer(*me, playerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID))
|
||||
DoCast(player, SPELL_BAD_PRESS_TRIGGER, true);
|
||||
|
||||
if (fails >= 4)
|
||||
@@ -1065,7 +1065,7 @@ class npc_simon_bunny : public CreatureScript
|
||||
// Checks if player has already die or has get too far from the current node
|
||||
bool CheckPlayer()
|
||||
{
|
||||
if (Player* player = me->GetPlayer(*me, playerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID))
|
||||
{
|
||||
if (player->isDead())
|
||||
return false;
|
||||
|
||||
@@ -436,9 +436,9 @@ public:
|
||||
// Emote Ardonis and Pathaleon
|
||||
void Turn_to_Pathaleons_Image()
|
||||
{
|
||||
Creature* ardonis = Unit::GetCreature(*me, ardonisGUID);
|
||||
Creature* pathaleon = Unit::GetCreature(*me, pathaleonGUID);
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Creature* ardonis = ObjectAccessor::GetCreature(*me, ardonisGUID);
|
||||
Creature* pathaleon = ObjectAccessor::GetCreature(*me, pathaleonGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
|
||||
if (!ardonis || !pathaleon || !player)
|
||||
return;
|
||||
@@ -462,9 +462,9 @@ public:
|
||||
//Set them back to each other
|
||||
void Turn_to_eachother()
|
||||
{
|
||||
if (Unit* ardonis = Unit::GetUnit(*me, ardonisGUID))
|
||||
if (Unit* ardonis = ObjectAccessor::GetUnit(*me, ardonisGUID))
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
|
||||
if (!player)
|
||||
return;
|
||||
@@ -519,9 +519,9 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
Creature* ardonis = Creature::GetCreature(*me, ardonisGUID);
|
||||
Creature* pathaleon = Creature::GetCreature(*me, pathaleonGUID);
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Creature* ardonis = ObjectAccessor::GetCreature(*me, ardonisGUID);
|
||||
Creature* pathaleon = ObjectAccessor::GetCreature(*me, pathaleonGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
|
||||
if (!ardonis || !player)
|
||||
{
|
||||
@@ -821,7 +821,7 @@ public:
|
||||
ManaBurnTimer = 3500;
|
||||
} else ManaBurnTimer -= diff;
|
||||
|
||||
if (Player* player = Unit::GetPlayer(*me, PlayerGUID)) // start: support for quest 10190
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID)) // start: support for quest 10190
|
||||
{
|
||||
if (!Weak && HealthBelowPct(WeakPercent)
|
||||
&& player->GetQuestStatus(QUEST_RECHARGING_THE_BATTERIES) == QUEST_STATUS_INCOMPLETE)
|
||||
|
||||
@@ -154,11 +154,11 @@ public:
|
||||
DoCast(me, SPELL_JUST_EATEN);
|
||||
Talk(SAY_JUST_EATEN);
|
||||
|
||||
if (Player* pPlr = Unit::GetPlayer(*me, uiPlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, uiPlayerGUID))
|
||||
{
|
||||
pPlr->KilledMonsterCredit(NPC_EVENT_PINGER, 0);
|
||||
player->KilledMonsterCredit(NPC_EVENT_PINGER, 0);
|
||||
|
||||
if (GameObject* go = pPlr->FindNearestGameObject(GO_CARCASS, 10))
|
||||
if (GameObject* go = player->FindNearestGameObject(GO_CARCASS, 10))
|
||||
go->Delete();
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ public:
|
||||
Tapped = false;
|
||||
if (PlayerGUID)
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
if (player && player->GetQuestStatus(10854) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
DoCast(player, SPELL_FORCE_OF_NELTHARAKU, true);
|
||||
@@ -400,7 +400,7 @@ public:
|
||||
{
|
||||
if (PlayerGUID)
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
if (player && player->GetQuestStatus(11020) == QUEST_STATUS_INCOMPLETE)
|
||||
player->KilledMonsterCredit(23209, 0);
|
||||
}
|
||||
@@ -760,7 +760,7 @@ public:
|
||||
}
|
||||
if (PlayerGUID)
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
if (player)
|
||||
Talk(OVERLORD_SAY_1, player->GetGUID());
|
||||
}
|
||||
@@ -771,8 +771,8 @@ public:
|
||||
|
||||
uint32 NextStep(uint32 Step)
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Creature* Illi = Creature::GetCreature(*me, IllidanGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
Creature* Illi = ObjectAccessor::GetCreature(*me, IllidanGUID);
|
||||
|
||||
if (!player)
|
||||
{
|
||||
@@ -1311,7 +1311,7 @@ public:
|
||||
me->RemoveFlag(UNIT_FIELD_BYTES_1, 8);
|
||||
break;
|
||||
case 5:
|
||||
if (Player* AggroTarget = (Unit::GetPlayer(*me, AggroTargetGUID)))
|
||||
if (Player* AggroTarget = ObjectAccessor::GetPlayer(*me, AggroTargetGUID))
|
||||
{
|
||||
me->SetTarget(AggroTarget->GetGUID());
|
||||
me->AddThreat(AggroTarget, 1);
|
||||
@@ -1319,7 +1319,7 @@ public:
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (Player* AggroTarget = (Unit::GetPlayer(*me, AggroTargetGUID)))
|
||||
if (Player* AggroTarget = ObjectAccessor::GetPlayer(*me, AggroTargetGUID))
|
||||
{
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
me->ClearUnitState(UNIT_STATE_ROOT);
|
||||
@@ -1456,15 +1456,13 @@ public:
|
||||
|
||||
void CheckEventFail()
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if (Group* EventGroup = player->GetGroup())
|
||||
{
|
||||
Player* GroupMember;
|
||||
|
||||
uint8 GroupMemberCount = 0;
|
||||
uint8 DeadMemberCount = 0;
|
||||
uint8 FailedMemberCount = 0;
|
||||
@@ -1473,7 +1471,7 @@ public:
|
||||
|
||||
for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr)
|
||||
{
|
||||
GroupMember = (Unit::GetPlayer(*me, itr->guid));
|
||||
Player* GroupMember = ObjectAccessor::GetPlayer(*me, itr->guid);
|
||||
if (!GroupMember)
|
||||
continue;
|
||||
if (!GroupMember->IsWithinDistInMap(me, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE)
|
||||
@@ -1484,9 +1482,7 @@ public:
|
||||
++GroupMemberCount;
|
||||
|
||||
if (GroupMember->isDead())
|
||||
{
|
||||
++DeadMemberCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (GroupMemberCount == FailedMemberCount)
|
||||
@@ -1498,12 +1494,9 @@ public:
|
||||
{
|
||||
for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr)
|
||||
{
|
||||
GroupMember = Unit::GetPlayer(*me, itr->guid);
|
||||
|
||||
if (GroupMember && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
GroupMember->FailQuest(QUEST_BATTLE_OF_THE_CRIMSON_WATCH);
|
||||
}
|
||||
if (Player* groupMember = ObjectAccessor::GetPlayer(*me, itr->guid))
|
||||
if (groupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE)
|
||||
groupMember->FailQuest(QUEST_BATTLE_OF_THE_CRIMSON_WATCH);
|
||||
}
|
||||
Failed = true;
|
||||
}
|
||||
@@ -1713,7 +1706,7 @@ void npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave()
|
||||
{
|
||||
if (PlayerGUID)
|
||||
{
|
||||
if (Player* target = Unit::GetPlayer(*me, PlayerGUID))
|
||||
if (Player* target = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
{
|
||||
float x, y, z;
|
||||
target->GetPosition(x, y, z);
|
||||
|
||||
@@ -743,15 +743,10 @@ class spell_hun_sniper_training : public SpellScriptLoader
|
||||
PreventDefaultAction();
|
||||
if (aurEff->GetAmount() <= 0)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Unit* target = GetTarget();
|
||||
uint32 spellId = SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_HUNTER_SNIPER_TRAINING_R1;
|
||||
if (Unit* target = GetTarget())
|
||||
if (!target->HasAura(spellId))
|
||||
{
|
||||
SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? caster : target;
|
||||
triggerCaster->CastSpell(target, triggeredSpellInfo, true, 0, aurEff);
|
||||
}
|
||||
if (!target->HasAura(spellId))
|
||||
target->CastSpell(target, spellId, true, 0, aurEff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -634,7 +634,7 @@ public:
|
||||
|
||||
void PatientDied(Location* point)
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
if (player && ((player->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (player->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)))
|
||||
{
|
||||
++PatientDiedCount;
|
||||
@@ -1685,7 +1685,7 @@ public:
|
||||
|
||||
me->MonsterWhisper(whisp.c_str(), player->GetGUID());
|
||||
if (victimGUID)
|
||||
if (Player* victim = Unit::GetPlayer(*me, victimGUID))
|
||||
if (Player* victim = ObjectAccessor::GetPlayer(*me, victimGUID))
|
||||
victim->RemoveAura(43906); // remove polymorph frog thing
|
||||
me->AddAura(43906, player); // add polymorph frog thing
|
||||
victimGUID = player->GetGUID();
|
||||
|
||||
Reference in New Issue
Block a user