Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-08-26 22:29:54 +08:00
358 changed files with 1165 additions and 1381 deletions

View File

@@ -1134,7 +1134,7 @@ public:
return true;
// check index
if (unit->GetTypeId() == TYPEID_PLAYER)
if (unit->IsPlayer())
{
if (index >= PLAYER_END)
return true;

View File

@@ -1130,7 +1130,7 @@ public:
return false;
}
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
{
if (handler->HasLowerSecurity(target->ToPlayer()))
{
@@ -2659,7 +2659,7 @@ public:
return false;
}
handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUID().ToString());
handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->IsPlayer() ? "Player" : "Creature"), unit->GetGUID().ToString());
MotionMaster* motionMaster = unit->GetMotionMaster();
float x, y, z;
@@ -2694,7 +2694,7 @@ public:
case CHASE_MOTION_TYPE:
{
Unit* target = nullptr;
if (unit->GetTypeId() == TYPEID_PLAYER)
if (unit->IsPlayer())
{
target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
}
@@ -2707,7 +2707,7 @@ public:
{
handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
}
else if (target->GetTypeId() == TYPEID_PLAYER)
else if (target->IsPlayer())
{
handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUID().ToString());
}
@@ -2720,7 +2720,7 @@ public:
case FOLLOW_MOTION_TYPE:
{
Unit* target = nullptr;
if (unit->GetTypeId() == TYPEID_PLAYER)
if (unit->IsPlayer())
{
target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
}
@@ -2733,7 +2733,7 @@ public:
{
handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
}
else if (target->GetTypeId() == TYPEID_PLAYER)
else if (target->IsPlayer())
{
handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUID().ToString());
}
@@ -2809,7 +2809,7 @@ public:
return false;
}
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
{
if (handler->HasLowerSecurity(target->ToPlayer()))
{

View File

@@ -355,7 +355,7 @@ public:
return false;
}
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
{
// check online security
if (handler->HasLowerSecurity(target->ToPlayer()))
@@ -370,7 +370,7 @@ public:
else if (target->IsPet())
{
Unit* owner = target->GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet*)target)->IsPermanentPetFor(owner->ToPlayer()))
if (owner && owner->IsPlayer() && ((Pet*)target)->IsPermanentPetFor(owner->ToPlayer()))
{
// check online security
if (handler->HasLowerSecurity(owner->ToPlayer()))
@@ -666,7 +666,7 @@ public:
}
// check online security
if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer()))
if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer()))
{
return false;
}
@@ -843,7 +843,7 @@ public:
{
target = handler->GetSession()->GetPlayer();
}
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security
else if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
{
return false;
}
@@ -860,7 +860,7 @@ public:
{
target = handler->GetSession()->GetPlayer();
}
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security
else if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
{
return false;
}
@@ -873,7 +873,7 @@ public:
{
Player* target = handler->getSelectedPlayerOrSelf();
if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security
if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
return false;
if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
@@ -892,7 +892,7 @@ public:
{
target = handler->GetSession()->GetPlayer();
}
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security
else if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
{
return false;
}

View File

@@ -54,7 +54,7 @@ public:
Player* player = handler->GetSession()->GetPlayer();
Creature* creatureTarget = handler->getSelectedCreature();
if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->IsPlayer())
{
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;

View File

@@ -245,4 +245,3 @@ void AddSC_boss_gyth()
new boss_gyth();
RegisterSpellScript(spell_gyth_chromatic_protection);
}

View File

@@ -275,4 +275,3 @@ void AddSC_boss_broodlord()
new go_suppression_device();
RegisterSpellScript(spell_suppression_aura);
}

View File

@@ -365,4 +365,3 @@ void AddSC_boss_chromaggus()
RegisterSpellScript(spell_gen_elemental_shield);
RegisterSpellScript(spell_gen_brood_power);
}

View File

@@ -673,7 +673,7 @@ struct boss_nefarian : public BossAI
{
for (auto& ref : me->GetThreatMgr().GetThreatList())
{
if (ref->getTarget() && ref->getTarget()->GetTypeId() == TYPEID_PLAYER)
if (ref->getTarget() && ref->getTarget()->IsPlayer())
{
classesPresent.insert(ref->getTarget()->getClass());
}
@@ -1277,4 +1277,3 @@ void AddSC_boss_nefarian()
RegisterSpellScript(spell_shadowblink);
RegisterSpellScript(spell_spawn_drakonid);
}

View File

@@ -338,4 +338,3 @@ void AddSC_boss_razorgore()
new go_orb_of_domination();
RegisterSpellScript(spell_egg_event);
}

View File

@@ -328,4 +328,3 @@ void AddSC_boss_vaelastrasz()
new boss_vaelastrasz();
RegisterSpellScript(spell_vael_burning_adrenaline);
}

View File

@@ -531,4 +531,3 @@ void AddSC_instance_blackwing_lair()
RegisterSpellScript(spell_bwl_shadowflame);
new at_orb_of_command();
}

View File

@@ -229,4 +229,3 @@ void AddSC_boss_baron_geddon()
RegisterSpellScript(spell_geddon_inferno_aura);
RegisterSpellScript(spell_geddon_armageddon_aura);
}

View File

@@ -230,4 +230,3 @@ void AddSC_boss_garr()
RegisterSpellScript(spell_garr_separation_anxiety_aura);
RegisterSpellScript(spell_garr_frenzy);
}

View File

@@ -167,4 +167,3 @@ void AddSC_boss_magmadar()
// Spells
RegisterSpellScript(spell_magmadar_lava_bomb);
}

View File

@@ -661,4 +661,3 @@ void AddSC_boss_majordomo()
RegisterSpellScript(spell_majordomo_separation_anxiety_aura);
RegisterSpellScript(spell_summon_ragnaros);
}

View File

@@ -564,4 +564,3 @@ void AddSC_boss_ragnaros()
RegisterSpellScript(spell_ragnaros_lava_burst_randomizer);
RegisterSpellScript(spell_ragnaros_summon_sons_of_flame);
}

View File

@@ -187,4 +187,3 @@ void AddSC_boss_shazzrah()
// Spells
RegisterSpellScript(spell_shazzrah_gate_dummy);
}

View File

@@ -268,4 +268,3 @@ void AddSC_molten_core()
// Spells
RegisterSpellScript(spell_mc_play_dead_aura);
}

View File

@@ -186,4 +186,3 @@ void AddSC_instance_gnomeregan()
new npc_kernobee();
new spell_gnomeregan_radiation_bolt();
}

View File

@@ -2084,4 +2084,3 @@ void AddSC_boss_chess_event()
RegisterSpellScript(spell_control_piece);
}

View File

@@ -69,7 +69,7 @@ struct boss_curator : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_KILL);
}

View File

@@ -72,7 +72,7 @@ struct boss_maiden_of_virtue : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_SLAY);
}

View File

@@ -139,7 +139,7 @@ struct boss_attumen : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_KILL);
}
@@ -416,4 +416,3 @@ void AddSC_boss_attumen()
RegisterKarazhanCreatureAI(boss_attumen);
RegisterSpellScript(spell_midnight_fixate);
}

View File

@@ -178,7 +178,7 @@ struct boss_moroes : public BossAI
void KilledUnit(Unit* victim) override
{
if (!_recentlySpoken && victim->GetTypeId() == TYPEID_PLAYER)
if (!_recentlySpoken && victim->IsPlayer())
{
Talk(SAY_KILL);
_recentlySpoken = true;
@@ -283,4 +283,3 @@ void AddSC_boss_moroes()
RegisterKarazhanCreatureAI(boss_moroes);
RegisterSpellScript(spell_moroes_vanish);
}

View File

@@ -149,7 +149,7 @@ struct boss_netherspite : public BossAI
}
}
// buff the target
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
{
target->AddAura(PlayerBuff[j], target);
}
@@ -177,7 +177,7 @@ struct boss_netherspite : public BossAI
}
}
// aggro target if Red Beam
if (j == RED_PORTAL && me->GetVictim() != target && target->GetTypeId() == TYPEID_PLAYER)
if (j == RED_PORTAL && me->GetVictim() != target && target->IsPlayer())
{
me->GetThreatMgr().AddThreat(target, 100000.0f + DoGetThreat(me->GetVictim()));
}
@@ -336,4 +336,3 @@ void AddSC_boss_netherspite()
RegisterKarazhanCreatureAI(boss_netherspite);
RegisterSpellScript(spell_nether_portal_perseverence);
}

View File

@@ -397,4 +397,3 @@ void AddSC_boss_malchezaar()
RegisterKarazhanCreatureAI(npc_netherspite_infernal);
RegisterSpellScript(spell_malchezaar_enfeeble);
}

View File

@@ -502,4 +502,3 @@ void AddSC_boss_shade_of_aran()
RegisterSpellScript(spell_flamewreath_aura);
new at_karazhan_atiesh_aran();
}

View File

@@ -224,7 +224,7 @@ struct boss_terestian_illhoof : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_SLAY);
}

View File

@@ -609,4 +609,3 @@ void AddSC_instance_karazhan()
RegisterSpellScript(spell_karazhan_overload_aura);
RegisterSpellScript(spell_karazhan_blink);
}

View File

@@ -142,7 +142,7 @@ struct boss_felblood_kaelthas : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (!introSpeak && me->IsWithinDistInMap(who, 40.0f) && who->GetTypeId() == TYPEID_PLAYER)
if (!introSpeak && me->IsWithinDistInMap(who, 40.0f) && who->IsPlayer())
{
Talk(SAY_AGGRO);
introSpeak = true;
@@ -313,4 +313,3 @@ void AddSC_boss_felblood_kaelthas()
RegisterMagistersTerraceCreatureAI(boss_felblood_kaelthas);
RegisterSpellScript(spell_mt_phoenix_burn);
}

View File

@@ -292,7 +292,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
for (ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr)
{
Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->GetThreatMgr().GetThreat(pUnit))
if (pUnit && pUnit->IsPlayer() && me->GetThreatMgr().GetThreat(pUnit))
{
float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit);
me->GetThreatMgr().ModifyThreatByPercent(pUnit, -100);

View File

@@ -116,7 +116,7 @@ struct boss_selin_fireheart : public ScriptedAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_KILL);
}

View File

@@ -82,7 +82,7 @@ struct boss_vexallus : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_KILL);
}

View File

@@ -1257,4 +1257,3 @@ void AddSC_the_scarlet_enclave_c1()
RegisterSpellScript(spell_death_knight_initiate_visual);
}

View File

@@ -77,7 +77,7 @@ public:
void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->IsAlive() && !speechCounter)
if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->IsPlayer() && me->IsAlive() && !speechCounter)
{
if (Player* player = caster->ToPlayer())
{

View File

@@ -39,4 +39,3 @@ void AddSC_the_scarlet_enclave_c3()
{
RegisterSpellScript(spell_q12779_an_end_to_all_things);
}

View File

@@ -1249,4 +1249,3 @@ void AddSC_the_scarlet_enclave_c5()
new spell_chapter5_light_of_dawn_aura();
new spell_chapter5_rebuke();
}

View File

@@ -213,4 +213,3 @@ void AddSC_boss_kormok()
RegisterSpellScript(spell_kormok_summon_bone_mages);
RegisterSpellScript(spell_kormok_summon_bone_minions);
}

View File

@@ -464,4 +464,3 @@ void AddSC_instance_scholomance()
new spell_scholomance_boon_of_life();
new npc_scholomance_occultist();
}

View File

@@ -531,4 +531,3 @@ void AddSC_boss_apothecary_hummel()
RegisterSpellScript(spell_apothecary_perfume_spill);
RegisterSpellScript(spell_apothecary_cologne_spill);
}

View File

@@ -237,4 +237,3 @@ void AddSC_instance_shadowfang_keep()
new spell_shadowfang_keep_haunting_spirits();
new spell_shadowfang_keep_forsaken_skills();
}

View File

@@ -302,4 +302,3 @@ void AddSC_instance_sunken_temple()
new spell_temple_of_atal_hakkar_hex_of_jammal_an();
new spell_temple_of_atal_hakkar_awaken_the_soulflayer();
}

View File

@@ -104,7 +104,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50))
if (victim->IsPlayer() && roll_chance_i(50))
Talk(YELL_KILL);
}
@@ -526,4 +526,3 @@ void AddSC_boss_brutallus()
RegisterSpellScript(spell_brutallus_burn);
new AreaTrigger_at_sunwell_madrigosa();
}

View File

@@ -143,7 +143,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && urand(0, 1))
if (victim->IsPlayer() && urand(0, 1))
Talk(YELL_SAC_KILL);
}
@@ -291,7 +291,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && urand(0, 1))
if (victim->IsPlayer() && urand(0, 1))
Talk(YELL_SAC_KILL);
}
@@ -504,4 +504,3 @@ void AddSC_boss_eredar_twins()
RegisterSpellScript(spell_eredar_twins_blaze);
new AreaTrigger_at_sunwell_eredar_twins();
}

View File

@@ -173,7 +173,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50))
if (victim->IsPlayer() && roll_chance_i(50))
Talk(YELL_KILL);
}
@@ -565,4 +565,3 @@ void AddSC_boss_felmyst()
RegisterSpellScript(spell_felmyst_fog_of_corruption_charm_aura);
RegisterSpellScript(spell_felmyst_open_brutallus_back_doors);
}

View File

@@ -229,7 +229,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50))
if (victim->IsPlayer() && roll_chance_i(50))
Talk(SAY_EVIL_SLAY);
}
@@ -539,7 +539,7 @@ public:
void KilledUnit(Unit* target) override
{
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
Talk(SAY_SATH_SLAY);
}
@@ -758,4 +758,3 @@ void AddSC_boss_kalecgos()
RegisterSpellScript(spell_kalecgos_spectral_realm_dummy);
RegisterSpellScript(spell_kalecgos_spectral_realm_aura);
}

View File

@@ -364,7 +364,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && events.GetNextEventTime(EVENT_NO_KILL_TALK) == 0)
if (victim->IsPlayer() && events.GetNextEventTime(EVENT_NO_KILL_TALK) == 0)
Talk(SAY_KJ_SLAY);
}
@@ -1262,4 +1262,3 @@ void AddSC_boss_kiljaeden()
RegisterSpellScript(spell_kiljaeden_armageddon_missile);
RegisterSpellScript(spell_kiljaeden_dragon_breath);
}

View File

@@ -485,4 +485,3 @@ void AddSC_boss_muru()
RegisterSpellScript(spell_entropius_void_zone_visual_aura);
RegisterSpellScript(spell_entropius_black_hole_effect);
}

View File

@@ -299,4 +299,3 @@ void AddSC_instance_sunwell_plateau()
new instance_sunwell_plateau();
RegisterSpellScript(spell_cataclysm_breath);
}

View File

@@ -253,4 +253,3 @@ void AddSC_instance_uldaman()
new spell_uldaman_stoned();
new spell_uldaman_boss_agro_archaedas();
}

View File

@@ -135,7 +135,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
Talk(SAY_KILL);
}

View File

@@ -996,4 +996,3 @@ void AddSC_boss_hex_lord_malacrass()
new boss_alyson_antille();
new spell_hexlord_unstable_affliction();
}

View File

@@ -420,7 +420,7 @@ public:
void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->GetTypeId() == TYPEID_PLAYER && me->GetEntry() == NPC_FOREST_FROG)
if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->IsPlayer() && me->GetEntry() == NPC_FOREST_FROG)
{
me->GetMotionMaster()->MoveIdle();
me->SetFacingToObject(caster);

View File

@@ -202,4 +202,3 @@ void AddSC_boss_gahzranka()
RegisterSpellScript(spell_gahzranka_slam);
RegisterSpellScript(spell_pagles_point_cast);
}

View File

@@ -413,4 +413,3 @@ void AddSC_boss_hakkar()
RegisterSpellScript(spell_blood_siphon);
RegisterSpellScript(spell_hakkar_power_down);
}

View File

@@ -169,4 +169,3 @@ void AddSC_boss_hazzarah()
RegisterZulGurubCreatureAI(boss_hazzarah);
RegisterSpellScript(spell_chain_burn);
}

View File

@@ -423,4 +423,3 @@ void AddSC_boss_jeklik()
RegisterCreatureAI(npc_batrider);
RegisterSpellScript(spell_batrider_bomb);
}

View File

@@ -322,4 +322,3 @@ void AddSC_boss_jindo()
RegisterSpellScript(spell_random_aggro);
RegisterSpellScript(spell_delusions_of_jindo);
}

View File

@@ -802,4 +802,3 @@ void AddSC_boss_mandokir()
RegisterSpellScript(spell_mandokir_charge);
RegisterSpellScript(spell_threatening_gaze_charge);
}

View File

@@ -299,7 +299,7 @@ class spell_enveloping_webs : public SpellScript
{
Unit* caster = GetCaster();
Unit* hitUnit = GetHitUnit();
if (caster && hitUnit && hitUnit->GetTypeId() == TYPEID_PLAYER)
if (caster && hitUnit && hitUnit->IsPlayer())
{
caster->GetThreatMgr().ModifyThreatByPercent(hitUnit, -100);
}
@@ -343,4 +343,3 @@ void AddSC_boss_marli()
RegisterSpellScript(spell_enveloping_webs);
RegisterSpellScript(spell_marli_transform);
}

View File

@@ -56,4 +56,3 @@ void AddSC_zulgurub()
{
RegisterSpellScript(spell_axe_flurry);
}

View File

@@ -75,7 +75,7 @@ struct boss_twilight_corrupter : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (!_introSpoken && who->GetTypeId() == TYPEID_PLAYER)
if (!_introSpoken && who->IsPlayer())
{
_introSpoken = true;
Talk(SAY_RESPAWN, who);
@@ -102,7 +102,7 @@ struct boss_twilight_corrupter : public ScriptedAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_KILL, victim);
DoCastSelf(SPELL_SWELL_OF_SOULS);

View File

@@ -499,7 +499,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (!announced && who->GetTypeId() == TYPEID_PLAYER && who->GetPositionZ() < 30.0f)
if (!announced && who->IsPlayer() && who->GetPositionZ() < 30.0f)
{
announced = true;
playerGUID = who->GetGUID();
@@ -687,4 +687,3 @@ void AddSC_isle_of_queldanas()
// THEIR:
new npc_greengill_slave();
}

View File

@@ -109,7 +109,7 @@ public:
m_uiPhase = 1;
if (pDoneBy->GetTypeId() == TYPEID_PLAYER)
if (pDoneBy->IsPlayer())
{
m_uiPlayerGUID = pDoneBy->GetGUID();
}
@@ -118,7 +118,7 @@ public:
if (Unit* owner = pDoneBy->GetOwner())
{
// not sure if this is needed.
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
{
m_uiPlayerGUID = owner->GetGUID();
}

View File

@@ -68,7 +68,7 @@ struct npc_brewfest_keg_thrower : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID)
if (me->GetDistance(who) < 10.0f && who->IsPlayer() && who->GetMountID() == RAM_DISPLAY_ID)
{
if (!who->ToPlayer()->HasItemCount(ITEM_PORTABLE_BREWFEST_KEG)) // portable brewfest keg
me->CastSpell(who, SPELL_THROW_KEG, true); // throw keg
@@ -90,7 +90,7 @@ struct npc_brewfest_keg_reciver : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID)
if (me->GetDistance(who) < 10.0f && who->IsPlayer() && who->GetMountID() == RAM_DISPLAY_ID)
{
Player* player = who->ToPlayer();
if (player->HasItemCount(ITEM_PORTABLE_BREWFEST_KEG)) // portable brewfest keg
@@ -149,7 +149,7 @@ struct npc_brewfest_bark_trigger : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID)
if (me->GetDistance(who) < 10.0f && who->IsPlayer() && who->GetMountID() == RAM_DISPLAY_ID)
{
bool allow = false;
uint32 quest = 0;

View File

@@ -62,7 +62,7 @@ struct npc_love_in_air_supply_sentry : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (lock > 1000 && me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->HasAura(SPELL_GOBLIN_DISGUISE) && !who->HasAura(SPELL_GOBLIN_CARRY_CRATE))
if (lock > 1000 && me->GetDistance(who) < 10.0f && who->IsPlayer() && who->HasAura(SPELL_GOBLIN_DISGUISE) && !who->HasAura(SPELL_GOBLIN_CARRY_CRATE))
{
lock = 0;
if (urand(0, 1))
@@ -135,7 +135,7 @@ struct npc_love_in_air_snivel : public NullCreatureAI
void MoveInLineOfSight(Unit* who) override
{
if (delay == 0 && me->GetDistance(who) < 7.0f && who->GetTypeId() == TYPEID_PLAYER)
if (delay == 0 && me->GetDistance(who) < 7.0f && who->IsPlayer())
{
Player* plr = who->ToPlayer();
if (AllowAction(plr))
@@ -454,7 +454,7 @@ class spell_gen_aura_service_uniform : public AuraScript
{
// Apply model goblin
Unit* target = GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
{
if (target->getGender() == GENDER_MALE)
{
@@ -472,7 +472,7 @@ class spell_gen_aura_service_uniform : public AuraScript
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
target->RestoreDisplayId();
}
@@ -496,4 +496,3 @@ void AddSC_event_love_in_the_air()
RegisterSpellScript(spell_love_is_in_the_air_romantic_picnic);
RegisterSpellScript(spell_gen_aura_service_uniform);
}

View File

@@ -437,7 +437,7 @@ struct npc_midsummer_torch_target : public ScriptedAI
if (posVec.empty())
return;
// Triggered spell from torch
if (spellInfo->Id == SPELL_TORCH_TOSS_LAND && caster->GetTypeId() == TYPEID_PLAYER)
if (spellInfo->Id == SPELL_TORCH_TOSS_LAND && caster->IsPlayer())
{
me->CastSpell(me, SPELL_BRAZIERS_HIT_VISUAL, true); // hit visual anim
if (++counter >= maxCount)
@@ -906,12 +906,12 @@ class spell_midsummer_ribbon_pole : public AuraScript
target->CastSpell(target, SPELL_RIBBON_POLE_XP, true);
// Achievement
if ((GameTime::GetGameTime().count() - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER)
if ((GameTime::GetGameTime().count() - GetApplyTime()) > 60 && target->IsPlayer())
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58934, 0, target);
}
// Achievement
if ((time(nullptr) - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER)
if ((time(nullptr) - GetApplyTime()) > 60 && target->IsPlayer())
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58934, 0, target);
}
}
@@ -1308,4 +1308,3 @@ void AddSC_event_midsummer_scripts()
RegisterSpellScript(spell_midsummer_torch_catch);
RegisterSpellScript(spell_midsummer_summon_ahune_lieutenant);
}

View File

@@ -118,7 +118,7 @@ struct npc_pilgrims_bounty_chair : public VehicleAI
void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) override
{
if (apply && who->GetTypeId() == TYPEID_PLAYER)
if (apply && who->IsPlayer())
who->ToPlayer()->SetClientControl(me, 0, true);
}
@@ -683,4 +683,3 @@ void AddSC_event_pilgrims_end_scripts()
new achievement_pb_pilgrims_peril();
new achievement_pb_terokkar_turkey_time();
}

View File

@@ -266,4 +266,3 @@ void AddSC_event_winter_veil_scripts()
RegisterSpellScript(spell_winter_veil_racer_slam_hit);
RegisterSpellScript(spell_winter_veil_shoot_air_rifle);
}

View File

@@ -508,4 +508,3 @@ void AddSC_boss_archimonde()
RegisterHyjalAI(npc_ancient_wisp);
RegisterHyjalAI(npc_doomfire_spirit);
}

View File

@@ -181,4 +181,3 @@ void AddSC_boss_kazrogal()
RegisterHyjalAI(boss_kazrogal);
RegisterSpellAndAuraScriptPair(spell_mark_of_kazrogal, spell_mark_of_kazrogal_aura);
}

View File

@@ -192,4 +192,3 @@ void AddSC_boss_salramm()
new boss_salramm();
RegisterSpellScript(spell_boss_salramm_steal_flesh_aura);
}

View File

@@ -1550,7 +1550,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (!allowTimer && !locked && (who->GetTypeId() == TYPEID_PLAYER || who->IsPet()) && me->GetDistance(who) < 15.0f)
if (!allowTimer && !locked && (who->IsPlayer() || who->IsPet()) && me->GetDistance(who) < 15.0f)
InfectMe(2000);
ScriptedAI::MoveInLineOfSight(who);

View File

@@ -68,7 +68,7 @@ struct boss_epoch_hunter : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_SLAY);
}

View File

@@ -91,7 +91,7 @@ struct boss_lieutenant_drake : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_SLAY);
}

View File

@@ -130,7 +130,7 @@ struct npc_medivh_bm : public ScriptedAI
return;
}
if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 20.0f))
if (who->IsPlayer() && me->IsWithinDistInMap(who, 20.0f))
{
Talk(SAY_MEDIVH_ENTER);
_instance->SetData(DATA_MEDIVH, 1);
@@ -475,4 +475,3 @@ void AddSC_the_black_morass()
RegisterSpellScript(spell_black_morass_corrupt_medivh);
}

View File

@@ -45,9 +45,9 @@ enum Spells
SPELL_HIVEZARA_SWARMER_TELEPORT_5 = 25828,
SPELL_HIVEZARA_SWARMER_TELEPORT_TRIGGER = 25830,
SPELL_HIVEZARA_SWARMER_START_LOOP = 25711,
SPELL_HIVEZARA_SWARMER_LOOP_1 = 25833,
SPELL_HIVEZARA_SWARMER_LOOP_2 = 25834,
SPELL_HIVEZARA_SWARMER_LOOP_3 = 25835,
SPELL_HZ_SWARMER_LOOP_1 = 25833,
SPELL_HZ_SWARMER_LOOP_2 = 25834,
SPELL_HZ_SWARMER_LOOP_3 = 25835,
SPELL_HIVEZARA_SWARMER_SWARM = 25844
};
@@ -105,16 +105,13 @@ struct boss_ayamiss : public BossAI
void JustSummoned(Creature* who) override
{
switch (who->GetEntry())
if (who->GetEntry() == NPC_HIVEZARA_SWARMER)
{
case NPC_HIVEZARA_SWARMER:
who->CastSpell(who, SPELL_HIVEZARA_SWARMER_TELEPORT_TRIGGER, true);
_swarmers.push_back(who->GetGUID());
break;
case NPC_HIVEZARA_LARVA:
who->GetMotionMaster()->MovePoint(POINT_PARALYZE, AltarPos);
break;
who->CastSpell(who, SPELL_HIVEZARA_SWARMER_TELEPORT_TRIGGER, true);
_swarmers.push_back(who->GetGUID());
}
else if (who->GetEntry() == NPC_HIVEZARA_LARVA)
who->GetMotionMaster()->MovePoint(POINT_PARALYZE, AltarPos);
summons.Summon(who);
}
@@ -122,9 +119,7 @@ struct boss_ayamiss : public BossAI
void MovementInform(uint32 type, uint32 id) override
{
if (type == POINT_MOTION_TYPE && id == POINT_AIR)
{
me->AddUnitState(UNIT_STATE_ROOT);
}
else if (type == WAYPOINT_MOTION_TYPE && id == POINT_GROUND)
{
me->SetCombatMovement(true);
@@ -133,10 +128,7 @@ struct boss_ayamiss : public BossAI
me->m_Events.AddEventAtOffset([this]()
{
me->SetReactState(REACT_AGGRESSIVE);
if (me->GetVictim())
{
me->GetMotionMaster()->MoveChase(me->GetVictim());
}
me->ResumeChasingVictim();
}, 1s);
@@ -164,9 +156,7 @@ struct boss_ayamiss : public BossAI
DoCastAOE(SPELL_SUMMON_HIVEZARA_SWARMER, true);
if (_swarmers.size() >= MAX_SWARMER_COUNT)
{
DoCastAOE(SPELL_HIVEZARA_SWARMER_SWARM, true);
}
context.Repeat(RAND(2400ms, 3600ms));
}).Schedule(15s, 28s, [this](TaskContext context) {
@@ -185,15 +175,9 @@ struct boss_ayamiss : public BossAI
if (action == ACTION_SWARMER_SWARM)
{
for (ObjectGuid const& guid : _swarmers)
{
if (Creature* swarmer = me->GetMap()->GetCreature(guid))
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random))
{
swarmer->AI()->AttackStart(target);
}
}
}
_swarmers.clear();
}
@@ -231,17 +215,14 @@ struct npc_hive_zara_larva : public ScriptedAI
npc_hive_zara_larva(Creature* creature) : ScriptedAI(creature)
{
_instance = me->GetInstanceScript();
me->SetReactState(REACT_PASSIVE);
}
void MovementInform(uint32 type, uint32 id) override
{
if (type == POINT_MOTION_TYPE && id == POINT_PARALYZE)
{
if (Player* target = ObjectAccessor::GetPlayer(*me, _instance->GetGuidData(DATA_PARALYZED)))
{
DoCast(target, SPELL_FEED);
}
}
}
void JustSummoned(Creature* summon) override
@@ -253,29 +234,6 @@ struct npc_hive_zara_larva : public ScriptedAI
}
}
void MoveInLineOfSight(Unit* who) override
{
if (_instance->GetBossState(DATA_AYAMISS) == IN_PROGRESS)
return;
ScriptedAI::MoveInLineOfSight(who);
}
void AttackStart(Unit* victim) override
{
if (_instance->GetBossState(DATA_AYAMISS) == IN_PROGRESS)
return;
ScriptedAI::AttackStart(victim);
}
void UpdateAI(uint32 diff) override
{
if (_instance->GetBossState(DATA_AYAMISS) == IN_PROGRESS)
return;
ScriptedAI::UpdateAI(diff);
}
private:
InstanceScript* _instance;
};
@@ -369,7 +327,7 @@ class spell_ayamiss_swarmer_start_loop : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_HIVEZARA_SWARMER_LOOP_1, SPELL_HIVEZARA_SWARMER_LOOP_2, SPELL_HIVEZARA_SWARMER_LOOP_3 });
return ValidateSpellInfo({ SPELL_HZ_SWARMER_LOOP_1, SPELL_HZ_SWARMER_LOOP_2, SPELL_HZ_SWARMER_LOOP_3 });
}
bool Load() override
@@ -379,8 +337,7 @@ class spell_ayamiss_swarmer_start_loop : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
uint32 loopSpells[3] = { SPELL_HIVEZARA_SWARMER_LOOP_1, SPELL_HIVEZARA_SWARMER_LOOP_2, SPELL_HIVEZARA_SWARMER_LOOP_3 };
GetCaster()->CastSpell((Unit*)nullptr, Acore::Containers::SelectRandomContainerElement(loopSpells));
GetCaster()->GetAI()->DoCastAOE(RAND(SPELL_HZ_SWARMER_LOOP_1, SPELL_HZ_SWARMER_LOOP_2, SPELL_HZ_SWARMER_LOOP_3));
}
void Register() override
@@ -428,4 +385,3 @@ void AddSC_boss_ayamiss()
RegisterSpellScriptWithArgs(spell_gen_ayamiss_swarmer_loop, "spell_gen_ayamiss_swarmer_loop_2", (NPC_HIVEZARA_SWARMER + 6) * 10);
RegisterSpellScriptWithArgs(spell_gen_ayamiss_swarmer_loop, "spell_gen_ayamiss_swarmer_loop_3", (NPC_HIVEZARA_SWARMER + 7) * 10);
}

View File

@@ -106,7 +106,7 @@ struct boss_buru : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
ChaseNewVictim();
}
@@ -270,4 +270,3 @@ void AddSC_boss_buru()
RegisterRuinsOfAhnQirajCreatureAI(npc_buru_egg);
RegisterSpellScript(spell_egg_explosion);
}

View File

@@ -204,4 +204,3 @@ void AddSC_boss_moam()
RegisterSpellScript(spell_moam_mana_drain_filter);
RegisterSpellScript(spell_moam_summon_mana_fiends);
}

View File

@@ -382,4 +382,3 @@ void AddSC_boss_rajaxx()
RegisterSpellScript(spell_rajaxx_thundercrash);
RegisterRuinsOfAhnQirajCreatureAI(npc_general_andorov);
}

View File

@@ -161,4 +161,3 @@ void AddSC_ruins_of_ahnqiraj()
RegisterRuinsOfAhnQirajCreatureAI(npc_obsidian_destroyer);
RegisterSpellScript(spell_drain_mana);
}

View File

@@ -498,4 +498,3 @@ void AddSC_bug_trio()
RegisterSpellScript(spell_vem_knockback);
RegisterSpellScript(spell_vem_vengeance);
}

View File

@@ -22,12 +22,6 @@
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "temple_of_ahnqiraj.h"
/* ScriptData
SDName: Boss_Cthun
SD%Complete: 95
SDComment: Darkglare tracking issue
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
enum Spells
{
@@ -82,9 +76,7 @@ enum Spells
enum Actions
{
ACTION_FLESH_TENTACLE_KILLED = 1,
ACTION_SPAWN_EYE_TENTACLES = 1,
ACTION_START_PHASE_TWO = 1,
};
@@ -116,13 +108,8 @@ enum Yells
RANDOM_SOUND_WHISPER = 8663,
};
//Stomach Teleport positions
#define STOMACH_X -8562.0f
#define STOMACH_Y 2037.0f
#define STOMACH_Z -70.0f
#define STOMACH_O 5.05f
const Position StomachPosition = { -8562.0f, 2037.0f, -70.0f, 5.05f };
//Flesh tentacle positions
const Position FleshTentaclePos[2] =
{
{ -8571.0f, 1990.0f, -98.0f, 1.22f},
@@ -165,9 +152,8 @@ struct boss_eye_of_cthun : public BossAI
me->SetVisible(true);
//to avoid having a following void zone
Creature* pPortal = me->FindNearestCreature(NPC_CTHUN_PORTAL, 10);
if (pPortal)
pPortal->SetReactState(REACT_PASSIVE);
if (Creature* portal = me->FindNearestCreature(NPC_CTHUN_PORTAL, 10.0f))
portal->SetReactState(REACT_PASSIVE);
BossAI::Reset();
}
@@ -175,9 +161,7 @@ struct boss_eye_of_cthun : public BossAI
void JustDied(Unit* /*killer*/) override
{
if (Creature* cthun = instance->GetCreature(DATA_CTHUN))
{
cthun->AI()->DoAction(ACTION_START_PHASE_TWO);
}
}
void JustEngagedWith(Unit* who) override
@@ -189,13 +173,11 @@ struct boss_eye_of_cthun : public BossAI
void MoveInLineOfSight(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER && !me->IsInCombat())
if (who->IsPlayer() && !me->IsInCombat())
{
// Z checks are necessary here because AQ maps do funky stuff.
if (me->IsWithinLOSInMap(who) && me->IsWithinDist2d(who, 90.0f) && who->GetPositionZ() > 100.0f)
{
AttackStart(who);
}
}
}
@@ -207,9 +189,7 @@ struct boss_eye_of_cthun : public BossAI
_eyeTentacleCounter++;
if (_eyeTentacleCounter >= MAX_TENTACLE_GROUPS)
{
_eyeTentacleCounter = 0;
}
}
}
@@ -218,9 +198,7 @@ struct boss_eye_of_cthun : public BossAI
summons.Summon(summon);
if (Creature* cthun = instance->GetCreature(DATA_CTHUN))
{
cthun->AI()->JustSummoned(summon);
}
}
void ScheduleTask(bool onEngage = false)
@@ -231,9 +209,7 @@ struct boss_eye_of_cthun : public BossAI
if (task.GetRepeatCounter() < 3 && onEngage)
{
if (Unit* target = ObjectAccessor::GetUnit(*me, _beamTarget))
{
DoCast(target, SPELL_GREEN_BEAM);
}
task.Repeat();
}
@@ -257,12 +233,8 @@ struct boss_eye_of_cthun : public BossAI
.Schedule(8s, [this](TaskContext task)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
{
if (Creature* tentacle = me->SummonCreature(NPC_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000))
{
tentacle->AI()->AttackStart(target);
}
}
task.SetGroup(GROUP_BEAM_PHASE);
task.Repeat();
@@ -283,7 +255,7 @@ struct boss_eye_of_cthun : public BossAI
me->SetTarget(ObjectGuid::Empty);
//Freeze animation
DoCast(me, SPELL_FREEZE_ANIM, true);
DoCastSelf(SPELL_FREEZE_ANIM, true);
scheduler.Schedule(1s, [this](TaskContext /*task*/)
{
@@ -294,7 +266,7 @@ struct boss_eye_of_cthun : public BossAI
ClockWise = RAND(true, false);
//Add red coloration to C'thun
DoCast(me, SPELL_RED_COLORATION, true);
DoCastSelf(SPELL_RED_COLORATION, true);
me->StopMoving();
me->SetOrientation(DarkGlareAngle);
@@ -357,9 +329,8 @@ struct boss_eye_of_cthun : public BossAI
me->m_Events.AddEventAtOffset([this]()
{
if (Creature* cthun = instance->GetCreature(DATA_CTHUN))
{
cthun->AI()->DoAction(ACTION_START_PHASE_TWO);
}
}, 3s);
}
@@ -415,10 +386,8 @@ struct boss_cthun : public BossAI
}, 500ms);
//Spawn flesh tentacle
for (uint8 i = 0; i < 2; i++)
{
me->SummonCreature(NPC_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
}
for (const auto& position : FleshTentaclePos)
me->SummonCreature(NPC_FLESH_TENTACLE, position, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
ScheduleTasks();
}
@@ -434,7 +403,7 @@ struct boss_cthun : public BossAI
target->m_Events.AddEventAtOffset([target, this]()
{
DoTeleportPlayer(target, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O);
DoTeleportPlayer(target, StomachPosition);
target->RemoveAurasDueToSpell(SPELL_MIND_FLAY);
target->m_Events.AddEventAtOffset([target, this]()
@@ -448,33 +417,21 @@ struct boss_cthun : public BossAI
}).Schedule(30s, [this](TaskContext context)
{
if (Creature* eye = instance->GetCreature(DATA_EYE_OF_CTHUN))
{
eye->AI()->DoAction(ACTION_SPAWN_EYE_TENTACLES);
}
context.Repeat(30s);
context.Repeat();
}).Schedule(8s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, NotInStomachSelector()))
{
//Spawn claw tentacle on the random target
if (Creature* spawned = me->SummonCreature(NPC_GIANT_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000))
{
spawned->AI()->AttackStart(target);
}
}
context.Repeat(1min);
}).Schedule(38s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, NotInStomachSelector()))
{
//Spawn claw tentacle on the random target
if (Creature* spawned = me->SummonCreature(NPC_GIANT_EYE_TENTACLE, *target, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000))
{
spawned->AI()->AttackStart(target);
}
}
context.Repeat(1min);
});
@@ -486,24 +443,13 @@ struct boss_cthun : public BossAI
if (!UpdateVictim())
{
//No target so we'll use this section to do our random wispers instance wide
//WisperTimer
if (WisperTimer <= diff)
{
Map* map = me->GetMap();
if (!map->IsDungeon())
return;
//Play random sound to the zone
Map::PlayerList const& PlayerList = map->GetPlayers();
if (!PlayerList.IsEmpty())
me->GetMap()->DoForAllPlayers([&](Player* player)
{
for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
{
if (Player* pPlr = itr->GetSource())
pPlr->PlayDirectSound(RANDOM_SOUND_WHISPER, pPlr);
}
}
player->PlayDirectSound(RANDOM_SOUND_WHISPER, player);
});
//One random wisper every 90 - 300 seconds
WisperTimer = urand(90000, 300000);
@@ -523,14 +469,10 @@ struct boss_cthun : public BossAI
BossAI::JustDied(killer);
if (Creature* pPortal = me->FindNearestCreature(NPC_CTHUN_PORTAL, 10.0f))
{
pPortal->DespawnOrUnsummon();
}
if (Creature* eye = instance->GetCreature(DATA_EYE_OF_CTHUN))
{
eye->DespawnOrUnsummon();
}
}
void SummonedCreatureDies(Creature* creature, Unit* /*killer*/) override
@@ -549,7 +491,7 @@ struct boss_cthun : public BossAI
Talk(EMOTE_WEAKENED);
DoCast(me, SPELL_PURPLE_COLORATION, true);
DoCastSelf(SPELL_PURPLE_COLORATION, true);
me->RemoveAurasDueToSpell(SPELL_CARAPACE_CTHUN);
scheduler.Schedule(45s, [this](TaskContext /*context*/)
@@ -559,10 +501,8 @@ struct boss_cthun : public BossAI
me->RemoveAurasDueToSpell(SPELL_PURPLE_COLORATION);
DoCastSelf(SPELL_CARAPACE_CTHUN, true);
//Spawn flesh tentacle
for (uint8 i = 0; i < 2; i++)
{
me->SummonCreature(NPC_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
}
for (const auto& position : FleshTentaclePos)
me->SummonCreature(NPC_FLESH_TENTACLE, position, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
});
}
}
@@ -586,15 +526,9 @@ struct npc_eye_tentacle : public ScriptedAI
_portalGUID = portal->GetGUID();
if (me->ToTempSummon())
{
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
{
if (Creature* creature = summoner->ToCreature())
{
creature->AI()->JustSummoned(portal);
}
}
}
}
me->SetCombatMovement(false);
@@ -602,10 +536,8 @@ struct npc_eye_tentacle : public ScriptedAI
void JustDied(Unit* /*killer*/) override
{
if (Unit* p = ObjectAccessor::GetUnit(*me, _portalGUID))
{
Unit::Kill(p, p);
}
if (Unit* portal = ObjectAccessor::GetUnit(*me, _portalGUID))
portal->KillSelf();
}
void Reset() override
@@ -626,9 +558,7 @@ struct npc_eye_tentacle : public ScriptedAI
scheduler.Schedule(1s, 5s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, NotInStomachSelector()))
{
DoCast(target, SPELL_MIND_FLAY);
}
context.Repeat(10s, 15s);
});
@@ -659,24 +589,16 @@ struct npc_claw_tentacle : public ScriptedAI
_portalGUID = portal->GetGUID();
if (me->ToTempSummon())
{
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
{
if (Creature* creature = summoner->ToCreature())
{
creature->AI()->JustSummoned(portal);
}
}
}
}
}
void JustDied(Unit* /*killer*/) override
{
if (Unit* p = ObjectAccessor::GetUnit(*me, _portalGUID))
{
Unit::Kill(p, p);
}
if (Unit* portal = ObjectAccessor::GetUnit(*me, _portalGUID))
portal->KillSelf();
}
void Reset() override
@@ -728,15 +650,9 @@ struct npc_giant_claw_tentacle : public ScriptedAI
_portalGUID = portal->GetGUID();
if (me->ToTempSummon())
{
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
{
if (Creature* creature = summoner->ToCreature())
{
creature->AI()->JustSummoned(portal);
}
}
}
}
_canAttack = false;
@@ -744,10 +660,8 @@ struct npc_giant_claw_tentacle : public ScriptedAI
void JustDied(Unit* /*killer*/) override
{
if (Unit* p = ObjectAccessor::GetUnit(*me, _portalGUID))
{
Unit::Kill(p, p);
}
if (Unit* portal = ObjectAccessor::GetUnit(*me, _portalGUID))
portal->KillSelf();
}
void Reset() override
@@ -770,20 +684,14 @@ struct npc_giant_claw_tentacle : public ScriptedAI
scheduler.Schedule(10s, [this](TaskContext task)
{
if (Unit* target = me->GetVictim())
{
if (!target->IsWithinMeleeRange(me))
{
// Main target not found within melee range, try to select a new one
if (Player* newTarget = me->SelectNearestPlayer(5.0f))
{
AttackStart(newTarget);
}
else // Main target not found, and failed to acquire a new target... Submerge
{
Submerge();
}
}
}
task.Repeat();
}).Schedule(2s, [this](TaskContext context)
@@ -809,9 +717,7 @@ struct npc_giant_claw_tentacle : public ScriptedAI
// Despawn portal
if (Creature* p = ObjectAccessor::GetCreature(*me, _portalGUID))
{
p->DespawnOrUnsummon();
}
DoCastSelf(SPELL_SUBMERGE_VISUAL);
me->SetHealth(me->GetMaxHealth());
@@ -878,24 +784,16 @@ struct npc_giant_eye_tentacle : public ScriptedAI
_portalGUID = portal->GetGUID();
if (me->ToTempSummon())
{
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
{
if (Creature* creature = summoner->ToCreature())
{
creature->AI()->JustSummoned(portal);
}
}
}
}
}
void JustDied(Unit* /*killer*/) override
{
if (Unit* p = ObjectAccessor::GetUnit(*me, _portalGUID))
{
Unit::Kill(p, p);
}
if (Unit* portal = ObjectAccessor::GetUnit(*me, _portalGUID))
portal->KillSelf();
}
void Reset() override
@@ -906,9 +804,7 @@ struct npc_giant_eye_tentacle : public ScriptedAI
}).Schedule(1s, 5s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, NotInStomachSelector()))
{
DoCast(target, SPELL_GREEN_BEAM);
}
context.Repeat(2100ms);
});
@@ -955,12 +851,8 @@ class spell_cthun_digestive_acid : public AuraScript
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
if (InstanceScript* instance = GetUnitOwner()->GetInstanceScript())
{
if (Creature* cthun = instance->GetCreature(DATA_CTHUN))
{
cthun->CastSpell(GetUnitOwner(), SPELL_DIGESTIVE_ACID, true);
}
}
}
void Register() override
@@ -986,9 +878,7 @@ public:
trigger->CastSpell(player, SPELL_EXIT_STOMACH, true);
if (Creature* exittrigger = player->FindNearestCreature(NPC_EXIT_TRIGGER, 15.0f))
{
exittrigger->CastSpell(player, SPELL_RUBBLE_ROCKY, true);
}
}
player->m_Events.AddEventAtOffset([player, cthun]()
@@ -1000,9 +890,7 @@ public:
player->m_Events.AddEventAtOffset([player, cthun]()
{
if (cthun)
{
player->NearTeleportTo(cthun->GetPositionX(), cthun->GetPositionY(), cthun->GetPositionZ() + 10, float(rand32() % 6));
}
player->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);
}, 1s);
@@ -1027,15 +915,9 @@ public:
bool OnTrigger(Player* player, AreaTrigger const* /*at*/) override
{
if (InstanceScript* instance = player->GetInstanceScript())
{
if (Creature* cthun = instance->GetCreature(DATA_CTHUN))
{
if (cthun->IsAlive())
{
cthun->CastSpell(player, SPELL_SPIT_OUT, true);
}
}
}
return true;
}
@@ -1054,4 +936,3 @@ void AddSC_boss_cthun()
new at_cthun_stomach_exit();
new at_cthun_center();
}

View File

@@ -185,4 +185,3 @@ void AddSC_boss_huhuran()
RegisterSpellScript(spell_huhuran_wyvern_sting);
RegisterSpellScript(spell_huhuran_poison_bolt);
}

View File

@@ -75,7 +75,7 @@ struct npc_ouro_spawner : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
// Spawn Ouro on LoS check
if (!hasSummoned && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 40.0f) && !who->ToPlayer()->IsGameMaster())
if (!hasSummoned && who->IsPlayer() && me->IsWithinDistInMap(who, 40.0f) && !who->ToPlayer()->IsGameMaster())
{
if (InstanceScript* instance = me->GetInstanceScript())
{

View File

@@ -261,4 +261,3 @@ void AddSC_boss_skeram()
RegisterTempleOfAhnQirajCreatureAI(boss_skeram);
RegisterSpellScript(spell_skeram_arcane_explosion);
}

View File

@@ -117,7 +117,7 @@ struct boss_twinemperorsAI : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim && victim->GetTypeId() == TYPEID_PLAYER)
if (victim && victim->IsPlayer())
Talk(SAY_KILL);
}
@@ -487,4 +487,3 @@ void AddSC_boss_twinemperors()
new at_twin_emperors();
RegisterSpellScript(spell_mutate_explode_bug);
}

View File

@@ -420,4 +420,3 @@ void AddSC_boss_viscidus()
RegisterSpellScript(spell_explode_trigger);
RegisterSpellScript(spell_summon_toxin_slime);
}

View File

@@ -357,4 +357,3 @@ void AddSC_npc_anubisath_sentinel()
RegisterSpellScript(spell_anubisath_mortal_strike);
RegisterSpellScript(spell_mana_burn_area);
}

View File

@@ -575,4 +575,3 @@ void AddSC_temple_of_ahnqiraj()
RegisterSpellScript(spell_nullify);
new at_battleguard_sartura();
}

View File

@@ -519,4 +519,3 @@ void AddSC_instance_zulfarrak()
RegisterSpellScript(spell_zulfarrak_summon_zulfarrak_zombies);
RegisterSpellScript(spell_zulfarrak_unlocking);
}

View File

@@ -739,4 +739,3 @@ void AddSC_zulfarrak()
new npc_shadowpriest_sezziz();
new go_troll_cage();
}

View File

@@ -77,7 +77,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim && victim->GetTypeId() == TYPEID_PLAYER)
if (victim && victim->IsPlayer())
{
Talk(SAY_KILL);
victim->CastSpell(victim, SPELL_MARK_OF_FROST, true);
@@ -229,4 +229,3 @@ void AddSC_boss_azuregos()
RegisterSpellScript(spell_arcane_vacuum);
RegisterSpellScript(spell_mark_of_frost_freeze);
}

View File

@@ -339,7 +339,7 @@ public:
if (!who)
return;
if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 5))
if (who->IsPlayer() && me->IsWithinDistInMap(who, 5))
{
DoCast(who, SPELL_DEPTH_CHARGE_TRAP);
WeMustDie = true;

View File

@@ -94,7 +94,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (CanSayHelp && who->GetTypeId() == TYPEID_PLAYER && me->IsFriendlyTo(who) && me->IsWithinDistInMap(who, 25.0f))
if (CanSayHelp && who->IsPlayer() && me->IsFriendlyTo(who) && me->IsWithinDistInMap(who, 25.0f))
{
//Random switch between 4 texts
Talk(SAY_HELP, who);
@@ -585,4 +585,3 @@ void AddSC_azuremyst_isle()
new go_bristlelimb_cage();
RegisterSpellScript(spell_inoculate_nestlewood_owlkin);
}

View File

@@ -70,7 +70,7 @@ public:
{
if (Unit* owner = killer->GetOwner())
{
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
{
owner->ToPlayer()->KilledMonsterCredit(NPC_EXPEDITION_RESEARCHER);
}

View File

@@ -478,4 +478,3 @@ void AddSC_durotar()
RegisterSpellScript(spell_voljin_war_drums);
RegisterSpellScript(spell_voodoo);
}

View File

@@ -99,7 +99,7 @@ class spell_energize_aoe : public SpellScript
{
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
{
if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
if ((*itr)->IsPlayer() && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
++itr;
else
targets.erase(itr++);
@@ -127,4 +127,3 @@ void AddSC_dustwallow_marsh()
RegisterSpellScript(spell_ooze_zap_channel_end);
RegisterSpellScript(spell_energize_aoe);
}

View File

@@ -56,4 +56,3 @@ void AddSC_feralas()
{
RegisterSpellScript(spell_gordunni_trap);
}

View File

@@ -91,7 +91,7 @@ public:
{
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
{
if (player->GetTypeId() == TYPEID_PLAYER && player->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE)
if (player->IsPlayer() && player->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE)
player->FailQuest(QUEST_SHATTERED_SALUTE);
}
Reset();

Some files were not shown because too many files have changed in this diff Show More