mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-14 07:53:44 +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:
@@ -765,7 +765,7 @@ class spell_toc5_light_rain : public SpellScript
|
||||
{
|
||||
for( std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); )
|
||||
{
|
||||
if ((*itr)->GetTypeId() == TYPEID_UNIT)
|
||||
if ((*itr)->IsCreature())
|
||||
if ((*itr)->ToCreature()->GetEntry() == NPC_FOUNTAIN_OF_LIGHT)
|
||||
{
|
||||
targets.erase(itr);
|
||||
|
||||
@@ -691,7 +691,7 @@ public:
|
||||
if( me->GetExactDist(plr) <= 5.0f )
|
||||
if( Vehicle* v = plr->GetVehicle() )
|
||||
if( Unit* c = v->GetBase() )
|
||||
if( c->GetTypeId() == TYPEID_UNIT && c->ToCreature()->GetEntry() == (pInstance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? VEHICLE_ARGENT_BATTLEWORG : VEHICLE_ARGENT_WARHORSE) )
|
||||
if( c->IsCreature() && c->ToCreature()->GetEntry() == (pInstance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? VEHICLE_ARGENT_BATTLEWORG : VEHICLE_ARGENT_WARHORSE) )
|
||||
{
|
||||
me->GetMotionMaster()->MovementExpired();
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
|
||||
@@ -1156,7 +1156,7 @@ public:
|
||||
{
|
||||
NPC_BlackKnightGUID = bk->GetGUID();
|
||||
bk->SendMovementFlagUpdate(); // put him on vehicle visually
|
||||
if( bk->GetTypeId() == TYPEID_UNIT )
|
||||
if( bk->IsCreature() )
|
||||
bk->ToCreature()->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
|
||||
|
||||
@@ -400,7 +400,7 @@ public:
|
||||
|
||||
void MoveInLineOfSight(Unit* who) override
|
||||
{
|
||||
if (who->GetTypeId() != TYPEID_PLAYER || me->GetExactDistSq(who) > 6400.0f) // 80yd*80yd
|
||||
if (!who->IsPlayer() || me->GetExactDistSq(who) > 6400.0f) // 80yd*80yd
|
||||
return;
|
||||
|
||||
if (me->getStandState() != UNIT_STAND_STATE_STAND)
|
||||
@@ -846,7 +846,7 @@ public:
|
||||
{
|
||||
target->UpdatePosition(*c, false);
|
||||
target->CastCustomSpell(SPELL_SPIKE_FAIL, SPELLVALUE_MAX_TARGETS, 1);
|
||||
if( target->GetTypeId() == TYPEID_UNIT )
|
||||
if( target->IsCreature() )
|
||||
target->ToCreature()->AI()->DoAction(-1);
|
||||
Remove();
|
||||
return;
|
||||
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
break;
|
||||
case EVENT_SPELL_FIRE_BOMB:
|
||||
{
|
||||
if( t->GetTypeId() != TYPEID_PLAYER && pInstance )
|
||||
if( !t->IsPlayer() && pInstance )
|
||||
{
|
||||
GuidVector validPlayers;
|
||||
Map::PlayerList const& pl = me->GetMap()->GetPlayers();
|
||||
@@ -342,7 +342,7 @@ public:
|
||||
if( Vehicle* vk = me->GetVehicleKit() )
|
||||
if( Unit* snobold = vk->GetPassenger(4) )
|
||||
{
|
||||
if( snobold->GetTypeId() == TYPEID_UNIT )
|
||||
if( snobold->IsCreature() )
|
||||
{
|
||||
CAST_AI(npc_snobold_vassal::npc_snobold_vassalAI, snobold->ToCreature()->AI())->TargetGUID = PlayerGUID;
|
||||
snobold->ToCreature()->AI()->AttackStart(p);
|
||||
@@ -357,7 +357,7 @@ public:
|
||||
{
|
||||
events.RescheduleEvent(EVENT_PICK_SNOBOLD_TARGET, 5s);
|
||||
if( Unit* snobold = vk->GetPassenger(4) )
|
||||
if( snobold->GetTypeId() == TYPEID_UNIT )
|
||||
if( snobold->IsCreature() )
|
||||
{
|
||||
bool needDespawn = true;
|
||||
for( uint8 i = 0; i < 4; ++i )
|
||||
|
||||
Reference in New Issue
Block a user