mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-03 11:03:47 +00:00
refactor(Core/Object): adds consistency in the use of type object check (#19671)
This commit is contained in:
@@ -92,7 +92,7 @@ void WorldSession::HandlePetAction(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// Xinef: allow to controll players
|
||||
if (pet->GetTypeId() == TYPEID_PLAYER && flag != ACT_COMMAND && flag != ACT_REACTION)
|
||||
if (pet->IsPlayer() && flag != ACT_COMMAND && flag != ACT_REACTION)
|
||||
return;
|
||||
|
||||
// Do not follow itself vehicle
|
||||
@@ -387,17 +387,17 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
|
||||
if (unit_target)
|
||||
{
|
||||
pet->SetInFront(unit_target);
|
||||
if (unit_target->GetTypeId() == TYPEID_PLAYER)
|
||||
if (unit_target->IsPlayer())
|
||||
pet->SendUpdateToPlayer(unit_target->ToPlayer());
|
||||
}
|
||||
else if (Unit* unit_target2 = spell->m_targets.GetUnitTarget())
|
||||
{
|
||||
pet->SetInFront(unit_target2);
|
||||
if (unit_target2->GetTypeId() == TYPEID_PLAYER)
|
||||
if (unit_target2->IsPlayer())
|
||||
pet->SendUpdateToPlayer(unit_target2->ToPlayer());
|
||||
}
|
||||
if (Unit* powner = pet->GetCharmerOrOwner())
|
||||
if (powner->GetTypeId() == TYPEID_PLAYER)
|
||||
if (powner->IsPlayer())
|
||||
pet->SendUpdateToPlayer(powner->ToPlayer());
|
||||
|
||||
result = SPELL_CAST_OK;
|
||||
@@ -853,7 +853,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
|
||||
pet->SetName(name);
|
||||
|
||||
Unit* owner = pet->GetOwner();
|
||||
if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup())
|
||||
if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
|
||||
owner->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_NAME);
|
||||
|
||||
pet->RemoveByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED);
|
||||
@@ -1065,7 +1065,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
|
||||
if (!caster->GetCharmInfo() || !caster->GetCharmInfo()->GetForcedSpell())
|
||||
spell->SendPetCastResult(result);
|
||||
|
||||
if (caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if (caster->IsPlayer())
|
||||
{
|
||||
if (!caster->ToPlayer()->HasSpellCooldown(spellId))
|
||||
GetPlayer()->SendClearCooldown(spellId, caster);
|
||||
|
||||
@@ -124,7 +124,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
|
||||
// no or incorrect quest giver
|
||||
if (!object || object == _player || (object->GetTypeId() != TYPEID_PLAYER && !object->hasQuest(questId)) ||
|
||||
(object->GetTypeId() == TYPEID_PLAYER && !object->ToPlayer()->CanShareQuest(questId)))
|
||||
(object->IsPlayer() && !object->ToPlayer()->CanShareQuest(questId)))
|
||||
{
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
_player->SetDivider();
|
||||
@@ -138,7 +138,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
|
||||
{
|
||||
// pussywizard: exploit fix, can't share quests that give items to be sold
|
||||
if (object->GetTypeId() == TYPEID_PLAYER)
|
||||
if (object->IsPlayer())
|
||||
if (uint32 itemId = quest->GetSrcItemId())
|
||||
if (ItemTemplate const* srcItem = sObjectMgr->GetItemTemplate(itemId))
|
||||
if (srcItem->SellPrice > 0)
|
||||
@@ -220,7 +220,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData)
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
|
||||
{
|
||||
// not sure here what should happen to quests with QUEST_FLAGS_AUTOCOMPLETE
|
||||
// if this breaks them, add && object->GetTypeId() == TYPEID_ITEM to this check
|
||||
// if this breaks them, add && object->IsItem() to this check
|
||||
// item-started quests never have that flag
|
||||
if (!_player->CanTakeQuest(quest, true))
|
||||
return;
|
||||
|
||||
@@ -351,7 +351,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
||||
|
||||
// ignore for remote control state (for player case)
|
||||
Unit* mover = _player->m_mover;
|
||||
if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER)
|
||||
if (mover != _player && mover->IsPlayer())
|
||||
{
|
||||
recvPacket.rfinish(); // prevent spam at ignore packet
|
||||
return;
|
||||
@@ -372,7 +372,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
||||
HandleClientCastFlags(recvPacket, castFlags, targets);
|
||||
|
||||
// not have spell in spellbook
|
||||
if (mover->GetTypeId() == TYPEID_PLAYER)
|
||||
if (mover->IsPlayer())
|
||||
{
|
||||
// not have spell in spellbook or spell passive and not casted by client
|
||||
if( !(spellInfo->Targets & TARGET_FLAG_GAMEOBJECT_ITEM) && (!mover->ToPlayer()->HasActiveSpell(spellId) || spellInfo->IsPassive()) )
|
||||
@@ -688,7 +688,7 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
|
||||
data << uint8(creator->getGender());
|
||||
data << uint8(creator->getClass());
|
||||
|
||||
if (creator->GetTypeId() == TYPEID_PLAYER)
|
||||
if (creator->IsPlayer())
|
||||
{
|
||||
Player* player = creator->ToPlayer();
|
||||
data << uint8(player->GetByteValue(PLAYER_BYTES, 0)); // skin
|
||||
|
||||
Reference in New Issue
Block a user