Core/Player: Keep shared quests through map changes instead of getting stuck in busy state
This commit is contained in:
1 parent
288aca3d15
commit
29cbbc50d3
4 files changed
+37
-26
No files matched your search
@@ -113,29 +113,29 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
else
|
||||
object = ObjectAccessor::FindPlayer(guid);
|
||||
|
||||
#define CLOSE_GOSSIP_CLEAR_DIVIDER() \
|
||||
#define CLOSE_GOSSIP_CLEAR_SHARING_INFO() \
|
||||
do { \
|
||||
_player->PlayerTalkClass->SendCloseGossip(); \
|
||||
_player->SetDivider(ObjectGuid::Empty); \
|
||||
_player->ClearQuestSharingInfo(); \
|
||||
} while (0)
|
||||
|
||||
// no or incorrect quest giver
|
||||
if (!object)
|
||||
{
|
||||
CLOSE_GOSSIP_CLEAR_DIVIDER();
|
||||
CLOSE_GOSSIP_CLEAR_SHARING_INFO();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Player* playerQuestObject = object->ToPlayer())
|
||||
{
|
||||
if ((_player->GetDivider() && _player->GetDivider() != guid) || !playerQuestObject->CanShareQuest(questId))
|
||||
if ((_player->GetPlayerSharingQuest() && _player->GetPlayerSharingQuest() != guid) || !playerQuestObject->CanShareQuest(questId))
|
||||
{
|
||||
CLOSE_GOSSIP_CLEAR_DIVIDER();
|
||||
CLOSE_GOSSIP_CLEAR_SHARING_INFO();
|
||||
return;
|
||||
}
|
||||
if (!_player->IsInSameRaidWith(playerQuestObject))
|
||||
{
|
||||
CLOSE_GOSSIP_CLEAR_DIVIDER();
|
||||
CLOSE_GOSSIP_CLEAR_SHARING_INFO();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
{
|
||||
if (!object->hasQuest(questId))
|
||||
{
|
||||
CLOSE_GOSSIP_CLEAR_DIVIDER();
|
||||
CLOSE_GOSSIP_CLEAR_SHARING_INFO();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
// some kind of WPE protection
|
||||
if (!_player->CanInteractWithQuestGiver(object))
|
||||
{
|
||||
CLOSE_GOSSIP_CLEAR_DIVIDER();
|
||||
CLOSE_GOSSIP_CLEAR_SHARING_INFO();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -160,17 +160,17 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
// prevent cheating
|
||||
if (!GetPlayer()->CanTakeQuest(quest, true))
|
||||
{
|
||||
CLOSE_GOSSIP_CLEAR_DIVIDER();
|
||||
CLOSE_GOSSIP_CLEAR_SHARING_INFO();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_player->GetDivider().IsEmpty())
|
||||
if (!_player->GetPlayerSharingQuest().IsEmpty())
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(_player->GetDivider());
|
||||
Player* player = ObjectAccessor::FindPlayer(_player->GetPlayerSharingQuest());
|
||||
if (player)
|
||||
{
|
||||
player->SendPushToPartyResponse(_player, QUEST_PARTY_MSG_ACCEPT_QUEST);
|
||||
_player->SetDivider(ObjectGuid::Empty);
|
||||
_player->ClearQuestSharingInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
|
||||
if (player->CanTakeQuest(quest, true))
|
||||
{
|
||||
player->SetDivider(_player->GetGUID());
|
||||
player->SetQuestSharingInfo(_player->GetGUID(), questId);
|
||||
|
||||
// need confirmation that any gossip window will close
|
||||
player->PlayerTalkClass->SendCloseGossip();
|
||||
@@ -211,9 +211,9 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
}
|
||||
}
|
||||
|
||||
CLOSE_GOSSIP_CLEAR_DIVIDER();
|
||||
CLOSE_GOSSIP_CLEAR_SHARING_INFO();
|
||||
|
||||
#undef CLOSE_GOSSIP_CLEAR_DIVIDER
|
||||
#undef CLOSE_GOSSIP_CLEAR_SHARING_INFO
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData)
|
||||
@@ -473,7 +473,7 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData)
|
||||
if (!quest->HasFlag(QUEST_FLAGS_PARTY_ACCEPT))
|
||||
return;
|
||||
|
||||
Player* originalPlayer = ObjectAccessor::FindPlayer(_player->GetDivider());
|
||||
Player* originalPlayer = ObjectAccessor::FindPlayer(_player->GetPlayerSharingQuest());
|
||||
if (!originalPlayer)
|
||||
return;
|
||||
|
||||
@@ -495,7 +495,7 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData)
|
||||
}
|
||||
}
|
||||
|
||||
_player->SetDivider(ObjectGuid::Empty);
|
||||
_player->ClearQuestSharingInfo();
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData)
|
||||
@@ -621,7 +621,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (receiver->GetDivider())
|
||||
if (receiver->GetPlayerSharingQuest())
|
||||
{
|
||||
sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_BUSY);
|
||||
continue;
|
||||
@@ -636,7 +636,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
|
||||
receiver->PlayerTalkClass->SendQuestGiverRequestItems(quest, sender->GetGUID(), receiver->CanCompleteRepeatableQuest(quest), true);
|
||||
else
|
||||
{
|
||||
receiver->SetDivider(sender->GetGUID());
|
||||
receiver->SetQuestSharingInfo(sender->GetGUID(), questId);
|
||||
receiver->PlayerTalkClass->SendQuestGiverQuestDetails(quest, receiver->GetGUID(), true);
|
||||
}
|
||||
}
|
||||
@@ -651,9 +651,9 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
|
||||
|
||||
TC_LOG_DEBUG("network", "WORLD: Received MSG_QUEST_PUSH_RESULT");
|
||||
|
||||
if (_player->GetDivider())
|
||||
if (_player->GetPlayerSharingQuest())
|
||||
{
|
||||
if (_player->GetDivider() == guid)
|
||||
if (_player->GetPlayerSharingQuest() == guid)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(_player->GetDivider());
|
||||
if (player)
|
||||
@@ -664,7 +664,7 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
_player->SetDivider(ObjectGuid::Empty);
|
||||
_player->ClearQuestSharingInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user