mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 09:39:11 +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:
@@ -1280,7 +1280,7 @@ bool GameObject::IsAlwaysVisibleFor(WorldObject const* seer) const
|
||||
Unit* owner = GetOwner();
|
||||
if (owner)
|
||||
{
|
||||
if (seer->isType(TYPEMASK_UNIT) && owner->IsFriendlyTo(seer->ToUnit()))
|
||||
if (seer->IsUnit() && owner->IsFriendlyTo(seer->ToUnit()))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1521,7 +1521,7 @@ void GameObject::Use(Unit* user)
|
||||
return;
|
||||
case GAMEOBJECT_TYPE_QUESTGIVER: //2
|
||||
{
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!user->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* player = user->ToPlayer();
|
||||
@@ -1550,7 +1550,7 @@ void GameObject::Use(Unit* user)
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!user->IsPlayer())
|
||||
return;
|
||||
|
||||
if (ChairListSlots.empty()) // this is called once at first chair use to make list of available slots
|
||||
@@ -1717,7 +1717,7 @@ void GameObject::Use(Unit* user)
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!user->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* player = user->ToPlayer();
|
||||
@@ -1818,7 +1818,7 @@ void GameObject::Use(Unit* user)
|
||||
|
||||
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
|
||||
{
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!user->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* player = user->ToPlayer();
|
||||
@@ -1831,7 +1831,7 @@ void GameObject::Use(Unit* user)
|
||||
|
||||
if (owner)
|
||||
{
|
||||
if (owner->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!owner->IsPlayer())
|
||||
return;
|
||||
|
||||
// accept only use by player from same group as owner, excluding owner itself (unique use already added in spell effect)
|
||||
@@ -1908,7 +1908,7 @@ void GameObject::Use(Unit* user)
|
||||
{
|
||||
GameObjectTemplate const* info = GetGOInfo();
|
||||
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!user->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* player = user->ToPlayer();
|
||||
@@ -1934,7 +1934,7 @@ void GameObject::Use(Unit* user)
|
||||
|
||||
case GAMEOBJECT_TYPE_FLAGSTAND: // 24
|
||||
{
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!user->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* player = user->ToPlayer();
|
||||
@@ -1966,7 +1966,7 @@ void GameObject::Use(Unit* user)
|
||||
|
||||
case GAMEOBJECT_TYPE_FISHINGHOLE: // 25
|
||||
{
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!user->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* player = user->ToPlayer();
|
||||
@@ -1978,7 +1978,7 @@ void GameObject::Use(Unit* user)
|
||||
|
||||
case GAMEOBJECT_TYPE_FLAGDROP: // 26
|
||||
{
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!user->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* player = user->ToPlayer();
|
||||
@@ -2036,7 +2036,7 @@ void GameObject::Use(Unit* user)
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!user->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* player = user->ToPlayer();
|
||||
@@ -2063,7 +2063,7 @@ void GameObject::Use(Unit* user)
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
if (!spellInfo)
|
||||
{
|
||||
if (user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr->HandleCustomSpell(user->ToPlayer(), spellId, this))
|
||||
if (!user->IsPlayer() || !sOutdoorPvPMgr->HandleCustomSpell(user->ToPlayer(), spellId, this))
|
||||
LOG_ERROR("entities.gameobject", "WORLD: unknown spell id {} at use action for gameobject (Entry: {} GoType: {})", spellId, GetEntry(), GetGoType());
|
||||
else
|
||||
LOG_DEBUG("outdoorpvp", "WORLD: {} non-dbc spell was handled by OutdoorPvP", spellId);
|
||||
|
||||
Reference in New Issue
Block a user