mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-06 08:59:11 +01:00
Core/Scripts: fix static analysis issues
- Bonus: indentation fixes in zone_wintergrasp.cpp
This commit is contained in:
@@ -247,39 +247,39 @@ class npc_wg_queue : public CreatureScript
|
||||
public:
|
||||
npc_wg_queue() : CreatureScript("npc_wg_queue") { }
|
||||
|
||||
struct npc_wg_queueAI : public ScriptedAI
|
||||
{
|
||||
npc_wg_queueAI(Creature* creature) : ScriptedAI(creature)
|
||||
struct npc_wg_queueAI : public ScriptedAI
|
||||
{
|
||||
FrostArmor_Timer = 0;
|
||||
}
|
||||
|
||||
uint32 FrostArmor_Timer;
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
FrostArmor_Timer = 0;
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) override { }
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (FrostArmor_Timer <= diff)
|
||||
npc_wg_queueAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
DoCast(me, SPELL_FROST_ARMOR);
|
||||
FrostArmor_Timer = 180000;
|
||||
FrostArmor_Timer = 0;
|
||||
}
|
||||
else FrostArmor_Timer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
uint32 FrostArmor_Timer;
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
FrostArmor_Timer = 0;
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) override { }
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (FrostArmor_Timer <= diff)
|
||||
{
|
||||
DoCast(me, SPELL_FROST_ARMOR);
|
||||
FrostArmor_Timer = 180000;
|
||||
}
|
||||
else FrostArmor_Timer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_wg_queueAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_wg_queueAI(creature);
|
||||
}
|
||||
|
||||
bool OnGossipHello(Player* player, Creature* creature) override
|
||||
{
|
||||
@@ -474,26 +474,26 @@ class spell_wintergrasp_grab_passenger : public SpellScriptLoader
|
||||
|
||||
class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript
|
||||
{
|
||||
public:
|
||||
achievement_wg_didnt_stand_a_chance() : AchievementCriteriaScript("achievement_wg_didnt_stand_a_chance") { }
|
||||
public:
|
||||
achievement_wg_didnt_stand_a_chance() : AchievementCriteriaScript("achievement_wg_didnt_stand_a_chance") { }
|
||||
|
||||
bool OnCheck(Player* source, Unit* target) override
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Player* victim = target->ToPlayer())
|
||||
bool OnCheck(Player* source, Unit* target) override
|
||||
{
|
||||
if (!victim->IsMounted())
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Vehicle* vehicle = source->GetVehicle())
|
||||
if (vehicle->GetVehicleInfo()->m_ID == 244) // Wintergrasp Tower Cannon
|
||||
return true;
|
||||
}
|
||||
if (Player* victim = target->ToPlayer())
|
||||
{
|
||||
if (!victim->IsMounted())
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
if (Vehicle* vehicle = source->GetVehicle())
|
||||
if (vehicle->GetVehicleInfo()->m_ID == 244) // Wintergrasp Tower Cannon
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
enum WgTeleport
|
||||
@@ -503,91 +503,91 @@ enum WgTeleport
|
||||
|
||||
class spell_wintergrasp_defender_teleport : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_wintergrasp_defender_teleport() : SpellScriptLoader("spell_wintergrasp_defender_teleport") { }
|
||||
public:
|
||||
spell_wintergrasp_defender_teleport() : SpellScriptLoader("spell_wintergrasp_defender_teleport") { }
|
||||
|
||||
class spell_wintergrasp_defender_teleport_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_wintergrasp_defender_teleport_SpellScript);
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
class spell_wintergrasp_defender_teleport_SpellScript : public SpellScript
|
||||
{
|
||||
if (Battlefield* wg = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
|
||||
if (Player* target = GetExplTargetUnit()->ToPlayer())
|
||||
// check if we are in Wintergrasp at all, SotA uses same teleport spells
|
||||
if ((target->GetZoneId() == 4197 && target->GetTeamId() != wg->GetDefenderTeam()) || target->HasAura(SPELL_WINTERGRASP_TELEPORT_TRIGGER))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
PrepareSpellScript(spell_wintergrasp_defender_teleport_SpellScript);
|
||||
|
||||
void Register() override
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
if (Battlefield* wg = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
|
||||
if (Player* target = GetExplTargetUnit()->ToPlayer())
|
||||
// check if we are in Wintergrasp at all, SotA uses same teleport spells
|
||||
if ((target->GetZoneId() == 4197 && target->GetTeamId() != wg->GetDefenderTeam()) || target->HasAura(SPELL_WINTERGRASP_TELEPORT_TRIGGER))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_wintergrasp_defender_teleport_SpellScript::CheckCast);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_wintergrasp_defender_teleport_SpellScript::CheckCast);
|
||||
return new spell_wintergrasp_defender_teleport_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
{
|
||||
return new spell_wintergrasp_defender_teleport_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_wintergrasp_defender_teleport_trigger : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_wintergrasp_defender_teleport_trigger() : SpellScriptLoader("spell_wintergrasp_defender_teleport_trigger") { }
|
||||
public:
|
||||
spell_wintergrasp_defender_teleport_trigger() : SpellScriptLoader("spell_wintergrasp_defender_teleport_trigger") { }
|
||||
|
||||
class spell_wintergrasp_defender_teleport_trigger_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_wintergrasp_defender_teleport_trigger_SpellScript);
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effindex*/)
|
||||
class spell_wintergrasp_defender_teleport_trigger_SpellScript : public SpellScript
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
PrepareSpellScript(spell_wintergrasp_defender_teleport_trigger_SpellScript);
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effindex*/)
|
||||
{
|
||||
WorldLocation loc = target->GetWorldLocation();
|
||||
SetExplTargetDest(loc);
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
WorldLocation loc = target->GetWorldLocation();
|
||||
SetExplTargetDest(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_defender_teleport_trigger_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_defender_teleport_trigger_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
return new spell_wintergrasp_defender_teleport_trigger_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
{
|
||||
return new spell_wintergrasp_defender_teleport_trigger_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class condition_is_wintergrasp_horde : public ConditionScript
|
||||
{
|
||||
public:
|
||||
condition_is_wintergrasp_horde() : ConditionScript("condition_is_wintergrasp_horde") { }
|
||||
public:
|
||||
condition_is_wintergrasp_horde() : ConditionScript("condition_is_wintergrasp_horde") { }
|
||||
|
||||
bool OnConditionCheck(Condition const* /* condition */, ConditionSourceInfo& /* sourceInfo */)
|
||||
{
|
||||
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (wintergrasp->IsEnabled() && wintergrasp->GetDefenderTeam() == TEAM_HORDE)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
bool OnConditionCheck(Condition const* /* condition */, ConditionSourceInfo& /* sourceInfo */)
|
||||
{
|
||||
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (wintergrasp && wintergrasp->IsEnabled() && wintergrasp->GetDefenderTeam() == TEAM_HORDE)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
class condition_is_wintergrasp_alliance : public ConditionScript
|
||||
{
|
||||
public:
|
||||
condition_is_wintergrasp_alliance() : ConditionScript("condition_is_wintergrasp_alliance") { }
|
||||
public:
|
||||
condition_is_wintergrasp_alliance() : ConditionScript("condition_is_wintergrasp_alliance") { }
|
||||
|
||||
bool OnConditionCheck(Condition const* /* condition */, ConditionSourceInfo& /* sourceInfo */)
|
||||
{
|
||||
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (wintergrasp->IsEnabled() && wintergrasp->GetDefenderTeam() == TEAM_ALLIANCE)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
bool OnConditionCheck(Condition const* /* condition */, ConditionSourceInfo& /* sourceInfo */)
|
||||
{
|
||||
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (wintergrasp && wintergrasp->IsEnabled() && wintergrasp->GetDefenderTeam() == TEAM_ALLIANCE)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_wintergrasp()
|
||||
|
||||
@@ -215,7 +215,7 @@ class spell_pet_guard_dog : public SpellScriptLoader
|
||||
Unit* caster = eventInfo.GetActor();
|
||||
caster->CastSpell((Unit*)nullptr, SPELL_PET_GUARD_DOG_HAPPINESS, true);
|
||||
|
||||
float addThreat = CalculatePct(eventInfo.GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster), aurEff->GetAmount());
|
||||
float addThreat = CalculatePct(ASSERT_NOTNULL(eventInfo.GetSpellInfo())->Effects[EFFECT_0].CalcValue(caster), aurEff->GetAmount());
|
||||
eventInfo.GetProcTarget()->AddThreat(caster, addThreat);
|
||||
}
|
||||
|
||||
|
||||
@@ -1303,6 +1303,8 @@ class spell_pal_infusion_of_light : public SpellScriptLoader
|
||||
Unit* target = GetTarget();
|
||||
int32 duration = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_FLASH_OF_LIGHT_PROC)->GetMaxDuration() / 1000;
|
||||
int32 pct = GetSpellInfo()->Effects[EFFECT_2].CalcValue();
|
||||
ASSERT(duration > 0);
|
||||
|
||||
int32 bp0 = CalculatePct(healInfo->GetHeal() / duration, pct);
|
||||
|
||||
// Item - Paladin T9 Holy 4P Bonus
|
||||
|
||||
@@ -1263,19 +1263,12 @@ class spell_sha_item_mana_surge : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
|
||||
if (!damageInfo || !damageInfo->GetSpellInfo())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
|
||||
if (!spellInfo)
|
||||
return;
|
||||
|
||||
int32 mana = spellInfo->CalcPowerCost(GetTarget(), eventInfo.GetSchoolMask());
|
||||
int32 damage = CalculatePct(mana, 35);
|
||||
@@ -1285,7 +1278,6 @@ class spell_sha_item_mana_surge : public SpellScriptLoader
|
||||
|
||||
void Register() override
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(spell_sha_item_mana_surge_AuraScript::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(spell_sha_item_mana_surge_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user