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:
Benjamin Jackson
2024-09-03 13:41:31 -04:00
committed by GitHub
parent e3e4133e88
commit 1edac37ac3
165 changed files with 725 additions and 719 deletions

View File

@@ -401,7 +401,7 @@ class spell_item_lil_phylactery : public AuraScript
bool CheckProc(ProcEventInfo& eventInfo)
{
return eventInfo.GetActionTarget() && (eventInfo.GetActionTarget()->GetTypeId() != TYPEID_UNIT || eventInfo.GetActionTarget()->ToCreature()->isWorldBoss());
return eventInfo.GetActionTarget() && (!eventInfo.GetActionTarget()->IsCreature() || eventInfo.GetActionTarget()->ToCreature()->isWorldBoss());
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
@@ -501,7 +501,7 @@ class spell_item_lil_xt : public SpellScript
Creature* target = GetHitCreature();
if (!target)
return;
if (GetCaster()->GetTypeId() == TYPEID_UNIT && GetCaster()->ToCreature()->AI())
if (GetCaster()->IsCreature() && GetCaster()->ToCreature()->AI())
GetCaster()->ToCreature()->AI()->Talk(2);
target->DespawnOrUnsummon(500);
}
@@ -2291,7 +2291,7 @@ class spell_item_unsated_craving : public AuraScript
bool CheckProc(ProcEventInfo& procInfo)
{
Unit* caster = procInfo.GetActor();
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
if (!caster || !caster->IsPlayer())
{
return false;
}
@@ -2302,7 +2302,7 @@ class spell_item_unsated_craving : public AuraScript
return true;
}
if (!target || target->GetTypeId() != TYPEID_UNIT || target->IsCritter() || target->IsSummon())
if (!target || !target->IsCreature() || target->IsCritter() || target->IsSummon())
{
return false;
}