Core/Quests: Improve ItemRemovedQuestCheck logic (#26758)

Closes #25603
This commit is contained in:
Gildor authored and Ovahlord committed 2021-07-29 17:31:23 +02:00
1 parent 8cabdc6c85
commit 1466176aef
1 file changed
+6 -6
+6 -6
View File
@@ -16070,14 +16070,14 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count)
{
QuestStatusData& q_status = m_QuestStatus[questid];
uint32 reqitemcount = qInfo->RequiredItemCount[j];
uint16 curitemcount = q_status.ItemCount[j];
uint32 reqItemCount = qInfo->RequiredItemCount[j];
uint16 questStatusItemCount = q_status.ItemCount[j];
uint16 newItemCount = (count > questStatusItemCount) ? 0 : questStatusItemCount - count;
if (q_status.ItemCount[j] >= reqitemcount) // we may have more than what the status shows
curitemcount = GetItemCount(entry, false);
if (questStatusItemCount >= reqItemCount) // we may have more than what the status shows, we don't need reduce by count
newItemCount = GetItemCount(entry, false);
uint16 newItemCount = (count > curitemcount) ? 0 : curitemcount - count;
newItemCount = std::min<uint16>(newItemCount, reqitemcount);
newItemCount = std::min<uint16>(newItemCount, reqItemCount);
if (newItemCount != q_status.ItemCount[j])
{
q_status.ItemCount[j] = newItemCount;