@@ -2648,6 +2648,24 @@ void Player::ResetAllPowers()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Player::CanInteractWithQuestGiver(Object* questGiver)
|
||||||
|
{
|
||||||
|
switch (questGiver->GetTypeId())
|
||||||
|
{
|
||||||
|
case TYPEID_UNIT:
|
||||||
|
return GetNPCIfCanInteractWith(questGiver->GetGUID(), UNIT_NPC_FLAG_QUESTGIVER) != NULL;
|
||||||
|
case TYPEID_GAMEOBJECT:
|
||||||
|
return GetGameObjectIfCanInteractWith(questGiver->GetGUID(), GAMEOBJECT_TYPE_QUESTGIVER) != NULL;
|
||||||
|
case TYPEID_PLAYER:
|
||||||
|
return isAlive() && questGiver->ToPlayer()->isAlive();
|
||||||
|
case TYPEID_ITEM:
|
||||||
|
return isAlive();
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
|
Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
|
||||||
{
|
{
|
||||||
// unit checks
|
// unit checks
|
||||||
|
|||||||
@@ -1081,6 +1081,7 @@ class Player : public Unit, public GridObject<Player>
|
|||||||
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg = 0);
|
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg = 0);
|
||||||
void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time);
|
void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time);
|
||||||
|
|
||||||
|
bool CanInteractWithQuestGiver(Object* questGiver);
|
||||||
Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask);
|
Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask);
|
||||||
GameObject* GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const;
|
GameObject* GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const;
|
||||||
|
|
||||||
|
|||||||
@@ -119,9 +119,6 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
|
|||||||
uint32 unk1;
|
uint32 unk1;
|
||||||
recv_data >> guid >> quest >> unk1;
|
recv_data >> guid >> quest >> unk1;
|
||||||
|
|
||||||
if (!GetPlayer()->isAlive())
|
|
||||||
return;
|
|
||||||
|
|
||||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), quest, unk1);
|
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), quest, unk1);
|
||||||
|
|
||||||
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER);
|
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER);
|
||||||
@@ -135,6 +132,10 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// some kind of WPE protection
|
||||||
|
if (!_player->CanInteractWithQuestGiver(pObject))
|
||||||
|
return;
|
||||||
|
|
||||||
Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest);
|
Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest);
|
||||||
if (qInfo)
|
if (qInfo)
|
||||||
{
|
{
|
||||||
@@ -294,16 +295,14 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GetPlayer()->isAlive())
|
|
||||||
return;
|
|
||||||
|
|
||||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u", uint32(GUID_LOPART(guid)), quest, reward);
|
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u", uint32(GUID_LOPART(guid)), quest, reward);
|
||||||
|
|
||||||
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
|
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
|
||||||
if (!pObject)
|
if (!pObject || !pObject->hasInvolvedQuest(quest))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pObject->hasInvolvedQuest(quest))
|
// some kind of WPE protection
|
||||||
|
if (!_player->CanInteractWithQuestGiver(pObject))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Quest const *pQuest = sObjectMgr->GetQuestTemplate(quest);
|
Quest const *pQuest = sObjectMgr->GetQuestTemplate(quest);
|
||||||
@@ -349,13 +348,14 @@ void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket & recv_data)
|
|||||||
uint64 guid;
|
uint64 guid;
|
||||||
recv_data >> guid >> quest;
|
recv_data >> guid >> quest;
|
||||||
|
|
||||||
if (!GetPlayer()->isAlive())
|
|
||||||
return;
|
|
||||||
|
|
||||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest);
|
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest);
|
||||||
|
|
||||||
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
|
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
|
||||||
if (!pObject||!pObject->hasInvolvedQuest(quest))
|
if (!pObject || !pObject->hasInvolvedQuest(quest))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// some kind of WPE protection
|
||||||
|
if (!_player->CanInteractWithQuestGiver(pObject))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_player->CanCompleteQuest(quest))
|
if (_player->CanCompleteQuest(quest))
|
||||||
@@ -462,10 +462,15 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data)
|
|||||||
uint64 guid;
|
uint64 guid;
|
||||||
recv_data >> guid >> quest;
|
recv_data >> guid >> quest;
|
||||||
|
|
||||||
if (!_player->isAlive())
|
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest);
|
||||||
|
|
||||||
|
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
|
||||||
|
if (!pObject || !pObject->hasInvolvedQuest(quest))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest);
|
// some kind of WPE protection
|
||||||
|
if (!_player->CanInteractWithQuestGiver(pObject))
|
||||||
|
return;
|
||||||
|
|
||||||
Quest const *pQuest = sObjectMgr->GetQuestTemplate(quest);
|
Quest const *pQuest = sObjectMgr->GetQuestTemplate(quest);
|
||||||
if (pQuest)
|
if (pQuest)
|
||||||
|
|||||||
Reference in New Issue
Block a user