Core/Quest: send SMSG_QUESTGIVER_STATUS_MULTIPLE after a quest is rew…

…arded.

This updates the status of nearby questgivers and prevents them from being stuck in a state that's no longer valid (for example, stuck with yellow question mark until area update).
This commit is contained in:
Aokromes committed 2016-07-20 15:54:01 +02:00
1 parent 4aa993607a
commit ef28a6c817
2 files changed
+47

No files matched your search

@@ -14923,6 +14923,8 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
SendQuestUpdate(quest_id);
SendQuestGiverStatusMultiple();
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled
{
// prepare Quest Tracker data
@@ -16724,6 +16726,50 @@ void Player::SendQuestUpdateAddPlayer(Quest const* quest, uint16 old_count, uint
SetQuestSlotCounter(log_slot, QUEST_PVP_KILL_SLOT, GetQuestSlotCounter(log_slot, QUEST_PVP_KILL_SLOT) + add_count);
}
void Player::SendQuestGiverStatusMultiple()
{
uint32 count = 0;
WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4);
data << uint32(count); // placeholder
for (auto itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
{
uint32 questStatus = DIALOG_STATUS_NONE;
if (itr->IsAnyTypeCreature())
{
// need also pet quests case support
Creature* questgiver = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, *itr);
if (!questgiver || questgiver->IsHostileTo(this))
continue;
if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
continue;
questStatus = GetQuestDialogStatus(questgiver);
data << uint64(questgiver->GetGUID());
data << uint8(questStatus);
++count;
}
else if (itr->IsGameObject())
{
GameObject* questgiver = GetMap()->GetGameObject(*itr);
if (!questgiver || questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
continue;
questStatus = GetQuestDialogStatus(questgiver);
data << uint64(questgiver->GetGUID());
data << uint8(questStatus);
++count;
}
}
data.put<uint32>(0, count); // write real count
GetSession()->SendPacket(&data);
}
bool Player::HasPvPForcingQuest() const
{
for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
+1
View File
@@ -1614,6 +1614,7 @@ class Player : public Unit, public GridObject<Player>
void SendPushToPartyResponse(Player* player, uint8 msg) const;
void SendQuestUpdateAddCreatureOrGo(Quest const* quest, ObjectGuid guid, uint32 creatureOrGOIdx, uint16 oldCount, uint16 addCount);
void SendQuestUpdateAddPlayer(Quest const* quest, uint16 oldCount, uint16 addCount);
void SendQuestGiverStatusMultiple();
ObjectGuid GetDivider() const { return m_divider; }
void SetDivider(ObjectGuid guid) { m_divider = guid; }