fix(Core/Quest): Refresh SMSG_QUESTGIVER_STATUS_MULTIPLE after a quest change (#8902)

Co-authored-by: Malcrom <malcromdev@gmail.com>
This commit is contained in:
acidmanifesto
2021-11-04 18:51:54 -04:00
committed by GitHub
parent 1926027066
commit 70b0de4e1f
5 changed files with 54 additions and 40 deletions

View File

@@ -2470,6 +2470,8 @@ void Player::GiveLevel(uint8 level)
SetByteFlag(PLAYER_FIELD_BYTES, 1, 0x01);
}
SendQuestGiverStatusMultiple();
sScriptMgr->OnPlayerLevelChanged(this, oldLevel);
}
@@ -7438,6 +7440,50 @@ bool Player::CheckAmmoCompatibility(const ItemTemplate* ammo_proto) const
return true;
}
void Player::SendQuestGiverStatusMultiple()
{
uint32 count = 0;
WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4);
data << uint32(count); // placeholder
for (GuidUnorderedSet::const_iterator 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 << 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 << questgiver->GetGUID();
data << uint8(questStatus);
++count;
}
}
data.put<uint32>(0, count); // write real count
GetSession()->SendPacket(&data);
}
/* If in a battleground a player dies, and an enemy removes the insignia, the player's bones is lootable
Called by remove insignia spell effect */
void Player::RemovedInsignia(Player* looterPlr)
@@ -10928,6 +10974,7 @@ void Player::SendInitialPacketsAfterAddToMap()
GetAurasForTarget(this);
SendEnchantmentDurations(); // must be after add to map
SendItemDurations(); // must be after add to map
SendQuestGiverStatusMultiple();
// raid downscaling - send difficulty to player
if (GetMap()->IsRaid())