mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-28 14:35:57 +00:00
refactor(Core): Make more use of helpers. (#19835)
* Init. * Reword. * Update codestyle script. Co-Authored-By: Kitzunu <24550914+Kitzunu@users.noreply.github.com> * Add gameobject type ID check, reorder checks. * Add helper/codestyle check for unit type. * `IsUnit()` -> `IsCreature()` * Add `IsUnit()` method. * Use type mask. https: //github.com/TrinityCore/TrinityCore/commit/cc71da35b5dc74abf71f8691161525a23d870bb5 Co-Authored-By: Giacomo Pozzoni <giacomopoz@gmail.com> Co-Authored-By: Ovahlord <18347559+Ovahlord@users.noreply.github.com> * Replace instances of `isType` with `IsUnit`. --------- Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com> Co-authored-by: Ovahlord <18347559+Ovahlord@users.noreply.github.com>
This commit is contained in:
@@ -258,7 +258,7 @@ public:
|
||||
|
||||
void KilledUnit(Unit* victim) override
|
||||
{
|
||||
if (victim->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!victim->IsPlayer())
|
||||
return;
|
||||
|
||||
int32 textId = 0;
|
||||
@@ -347,7 +347,7 @@ class spell_wailing_souls_periodic_aura : public AuraScript
|
||||
{
|
||||
t->SetControlled(false, UNIT_STATE_ROOT);
|
||||
t->DisableRotate(false);
|
||||
if (t->GetTypeId() == TYPEID_UNIT)
|
||||
if (t->IsCreature())
|
||||
t->ToCreature()->SetReactState(REACT_AGGRESSIVE);
|
||||
if (t->GetVictim())
|
||||
{
|
||||
|
||||
@@ -333,7 +333,7 @@ class spell_garfrost_permafrost : public SpellScript
|
||||
if (valid)
|
||||
{
|
||||
if (Aura* aur = target->ToUnit()->GetAura(70336))
|
||||
if (aur->GetStackAmount() >= 10 && caster->GetTypeId() == TYPEID_UNIT)
|
||||
if (aur->GetStackAmount() >= 10 && caster->IsCreature())
|
||||
caster->ToCreature()->AI()->SetData(1, aur->GetStackAmount());
|
||||
targetList.push_back(*itrU);
|
||||
}
|
||||
|
||||
@@ -470,7 +470,7 @@ class spell_krick_explosive_barrage_aura : public AuraScript
|
||||
{
|
||||
PreventDefaultAction();
|
||||
if (Unit* caster = GetCaster())
|
||||
if (caster->GetTypeId() == TYPEID_UNIT)
|
||||
if (caster->IsCreature())
|
||||
{
|
||||
Map::PlayerList const& players = caster->GetMap()->GetPlayers();
|
||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
@@ -505,7 +505,7 @@ class spell_exploding_orb_auto_grow_aura : public AuraScript
|
||||
target->RemoveAurasDueToSpell(SPELL_HASTY_GROW);
|
||||
target->RemoveAurasDueToSpell(SPELL_AUTO_GROW);
|
||||
target->RemoveAurasDueToSpell(SPELL_EXPLODING_ORB_VISUAL);
|
||||
if (target->GetTypeId() == TYPEID_UNIT)
|
||||
if (target->IsCreature())
|
||||
target->ToCreature()->DespawnOrUnsummon(2000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1405,7 +1405,7 @@ class spell_pos_rimefang_frost_nova : public SpellScript
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
Unit::Kill(caster, target);
|
||||
if (target->GetTypeId() == TYPEID_UNIT)
|
||||
if (target->IsCreature())
|
||||
target->ToCreature()->DespawnOrUnsummon(30000);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user