refactor(Core/Object): adds consistency in the use of type object check (#19671)

This commit is contained in:
Grimdhex
2024-08-25 14:57:37 +02:00
committed by GitHub
parent 61f3a631c3
commit 643362d697
189 changed files with 783 additions and 775 deletions

View File

@@ -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;