Core/PacketIO: Implemented SMSG_DISPLAY_TOAST for quest money rewards

Port From (https://github.com/TrinityCore/TrinityCore/commit/e5417e9ce747d92822538da77d32cf7d0f26ce8a)
This commit is contained in:
hondacrx
2022-05-04 10:12:29 -04:00
parent b048b57f46
commit aec91dc2b0
3 changed files with 109 additions and 0 deletions
@@ -1066,6 +1066,8 @@ namespace Game.Entities
if (moneyRew > 0)
UpdateCriteria(CriteriaType.MoneyEarnedFromQuesting, (uint)moneyRew);
SendDisplayToast(0, DisplayToastType.Money, false, (uint)moneyRew, DisplayToastMethod.QuestComplete, questId);
}
// honor reward
@@ -3061,5 +3063,36 @@ namespace Game.Entities
AddQuestAndCheckCompletion(quest, null);
}
}
void SendDisplayToast(uint entry, DisplayToastType type, bool isBonusRoll, uint quantity, DisplayToastMethod method, uint questId, Item item = null)
{
DisplayToast displayToast = new();
displayToast.Quantity = quantity;
displayToast.DisplayToastMethod = method;
displayToast.QuestID = questId;
displayToast.Type = type;
switch (type)
{
case DisplayToastType.NewItem:
{
if (!item)
return;
displayToast.BonusRoll = isBonusRoll;
displayToast.Item = new(item);
displayToast.LootSpec = 0; // loot spec that was selected when loot was generated (not at loot time)
displayToast.Gender = GetNativeGender();
break;
}
case DisplayToastType.NewCurrency:
displayToast.CurrencyID = entry;
break;
default:
break;
}
SendPacket(displayToast);
}
}
}