mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 00:18:43 +01:00
Core/Quests: implemented MSG_QUEST_PUSH_RESULT notifications
- Allow to share already completed (but not rewarded) quests, restriction was unblizzlike thanks Cannix for the heads up
This commit is contained in:
@@ -15904,12 +15904,12 @@ bool Player::CanShareQuest(uint32 quest_id) const
|
||||
QuestStatusMap::const_iterator itr = m_QuestStatus.find(quest_id);
|
||||
if (itr != m_QuestStatus.end())
|
||||
{
|
||||
if (itr->second.Status != QUEST_STATUS_INCOMPLETE)
|
||||
return false;
|
||||
|
||||
// in pool and not currently available (wintergrasp weekly, dalaran weekly) - can't share
|
||||
if (sPoolMgr->IsPartOfAPool<Quest>(quest_id) && !sPoolMgr->IsSpawnedObject<Quest>(quest_id))
|
||||
{
|
||||
SendPushToPartyResponse(this, QUEST_PARTY_MSG_CANT_BE_SHARED_TODAY);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -16849,7 +16849,7 @@ void Player::SendQuestConfirmAccept(Quest const* quest, Player* receiver) const
|
||||
receiver->GetSession()->SendPacket(packet.Write());
|
||||
}
|
||||
|
||||
void Player::SendPushToPartyResponse(Player* player, uint8 msg) const
|
||||
void Player::SendPushToPartyResponse(Player const* player, uint8 msg) const
|
||||
{
|
||||
if (player)
|
||||
{
|
||||
|
||||
@@ -1443,7 +1443,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
void SendQuestTimerFailed(uint32 questId) const;
|
||||
void SendCanTakeQuestResponse(QuestFailedReason reason) const;
|
||||
void SendQuestConfirmAccept(Quest const* quest, Player* receiver) const;
|
||||
void SendPushToPartyResponse(Player* player, uint8 msg) const;
|
||||
void SendPushToPartyResponse(Player const* player, uint8 msg) const;
|
||||
void SendQuestUpdateAddCredit(Quest const* quest, ObjectGuid guid, uint32 creatureOrGOIdx, uint16 count);
|
||||
void SendQuestUpdateAddPlayer(Quest const* quest, uint16 newCount);
|
||||
void SendQuestGiverStatusMultiple();
|
||||
|
||||
@@ -552,7 +552,10 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
|
||||
|
||||
Group* group = sender->GetGroup();
|
||||
if (!group)
|
||||
{
|
||||
sender->SendPushToPartyResponse(sender, QUEST_PARTY_MSG_NOT_IN_PARTY);
|
||||
return;
|
||||
}
|
||||
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
{
|
||||
@@ -573,6 +576,12 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!receiver->SatisfyQuestDay(quest, false))
|
||||
{
|
||||
sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_NOT_ELIGIBLE_TODAY);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!receiver->CanTakeQuest(quest, false))
|
||||
{
|
||||
sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_CANT_TAKE_QUEST);
|
||||
@@ -615,21 +624,17 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
|
||||
|
||||
TC_LOG_DEBUG("network", "WORLD: Received MSG_QUEST_PUSH_RESULT");
|
||||
|
||||
if (_player->GetPlayerSharingQuest())
|
||||
if (!_player->GetPlayerSharingQuest())
|
||||
return;
|
||||
|
||||
if (_player->GetPlayerSharingQuest() == guid)
|
||||
{
|
||||
if (_player->GetPlayerSharingQuest() == guid)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(_player->GetPlayerSharingQuest());
|
||||
if (player)
|
||||
{
|
||||
WorldPacket data(MSG_QUEST_PUSH_RESULT, 8 + 4 + 1);
|
||||
data << uint64(_player->GetGUID());
|
||||
data << uint8(msg); // valid values: 0-8
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
_player->ClearQuestSharingInfo();
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
if (player)
|
||||
player->SendPushToPartyResponse(_player, msg);
|
||||
}
|
||||
|
||||
_player->ClearQuestSharingInfo();
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPackets::Quest::QuestGiverStatusMultipleQuery& /*packet*/)
|
||||
|
||||
@@ -78,7 +78,8 @@ enum QuestShareMessages : uint8
|
||||
QUEST_PARTY_MSG_FINISH_QUEST = 7,
|
||||
QUEST_PARTY_MSG_CANT_BE_SHARED_TODAY = 8,
|
||||
QUEST_PARTY_MSG_SHARING_TIMER_EXPIRED = 9,
|
||||
QUEST_PARTY_MSG_NOT_IN_PARTY = 10
|
||||
QUEST_PARTY_MSG_NOT_IN_PARTY = 10,
|
||||
QUEST_PARTY_MSG_NOT_ELIGIBLE_TODAY = 11
|
||||
};
|
||||
|
||||
enum QuestTradeSkill
|
||||
|
||||
Reference in New Issue
Block a user