mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 22:26:22 +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:
@@ -90,7 +90,7 @@ struct boss_aeonus : public BossAI
|
||||
|
||||
void MoveInLineOfSight(Unit* who) override
|
||||
{
|
||||
if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_TIME_KEEPER)
|
||||
if (who->IsCreature() && who->GetEntry() == NPC_TIME_KEEPER)
|
||||
{
|
||||
if (me->IsWithinDistInMap(who, 20.0f))
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@ enum Spells
|
||||
|
||||
void MoveInLineOfSight(Unit* who) override
|
||||
{
|
||||
if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_TIME_KEEPER)
|
||||
if (who->IsCreature() && who->GetEntry() == NPC_TIME_KEEPER)
|
||||
{
|
||||
if (me->IsWithinDistInMap(who, 20.0f))
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@ struct boss_temporus : public BossAI
|
||||
|
||||
void MoveInLineOfSight(Unit* who) override
|
||||
{
|
||||
if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_TIME_KEEPER)
|
||||
if (who->IsCreature() && who->GetEntry() == NPC_TIME_KEEPER)
|
||||
{
|
||||
if (me->IsWithinDistInMap(who, 20.0f))
|
||||
{
|
||||
|
||||
@@ -367,7 +367,7 @@ struct boss_vem : public boss_bug_trio
|
||||
{
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, [this](Unit* target) -> bool
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return false;
|
||||
if (me->IsWithinMeleeRange(target) || target == me->GetVictim())
|
||||
return false;
|
||||
|
||||
@@ -180,7 +180,7 @@ public:
|
||||
|
||||
void KilledUnit(Unit* victim) override
|
||||
{
|
||||
if (victim->GetTypeId() != TYPEID_UNIT || !victim->IsSummon())
|
||||
if (!victim->IsCreature() || !victim->IsSummon())
|
||||
return;
|
||||
|
||||
if (Unit* vehSummoner = victim->ToTempSummon()->GetSummonerUnit())
|
||||
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
return;
|
||||
|
||||
//only aggro text if not player and only in this area
|
||||
if (who->GetTypeId() != TYPEID_PLAYER && me->GetAreaId() == AREA_MERCHANT_COAST)
|
||||
if (!who->IsPlayer() && me->GetAreaId() == AREA_MERCHANT_COAST)
|
||||
{
|
||||
//appears to be pretty much random (possible only if escorter not in combat with who yet?)
|
||||
Talk(SAY_GIL_AGGRO, who);
|
||||
@@ -325,7 +325,7 @@ public:
|
||||
|
||||
void MoveInLineOfSight(Unit* who) override
|
||||
{
|
||||
if (!who->IsAlive() || EventInProgress || who->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!who->IsAlive() || EventInProgress || !who->IsPlayer())
|
||||
return;
|
||||
|
||||
if (me->IsWithinDistInMap(who, 10.0f) && who->ToPlayer()->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE)
|
||||
|
||||
Reference in New Issue
Block a user