mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/PacketIO: Implemented SMSG_DISPLAY_TOAST for quest money rewards (#27669)
This commit is contained in:
@@ -15730,6 +15730,8 @@ void Player::RewardQuest(Quest const* quest, LootItemType rewardType, uint32 rew
|
||||
|
||||
if (moneyRew > 0)
|
||||
UpdateCriteria(CriteriaType::MoneyEarnedFromQuesting, uint32(moneyRew));
|
||||
|
||||
SendDisplayToast(0, DisplayToastType::Money, false, moneyRew, DisplayToastMethod::QuestComplete, quest_id);
|
||||
}
|
||||
|
||||
// honor reward
|
||||
@@ -29247,3 +29249,34 @@ std::string Player::GetDebugInfo() const
|
||||
sstr << Unit::GetDebugInfo();
|
||||
return sstr.str();
|
||||
}
|
||||
|
||||
void Player::SendDisplayToast(uint32 entry, DisplayToastType type, bool isBonusRoll, uint32 quantity, DisplayToastMethod method, uint32 questId, Item* item /*= nullptr*/) const
|
||||
{
|
||||
WorldPackets::Misc::DisplayToast displayToast;
|
||||
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.Initialize(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;
|
||||
}
|
||||
|
||||
SendDirectMessage(displayToast.Write());
|
||||
}
|
||||
|
||||
@@ -980,6 +980,37 @@ enum PlayerLogXPReason : uint8
|
||||
LOG_XP_REASON_NO_KILL = 1
|
||||
};
|
||||
|
||||
enum class DisplayToastType : uint8
|
||||
{
|
||||
NewItem = 0,
|
||||
NewCurrency = 1,
|
||||
Money = 2,
|
||||
Honor = 3
|
||||
};
|
||||
|
||||
enum class DisplayToastMethod : uint8
|
||||
{
|
||||
DoNotDisplay = 0,
|
||||
Loot = 1,
|
||||
PetBattle = 2,
|
||||
PersonalLoot = 3,
|
||||
GarrisonMissionLoot = 4,
|
||||
QuestUpgrade = 5,
|
||||
QuestUpgradeEpic = 6,
|
||||
Shipment = 7,
|
||||
GarrisonMissionSalvage = 8,
|
||||
PvPFactionReward = 9,
|
||||
GarrisonCurrency = 10,
|
||||
LessAwesomeLoot = 11,
|
||||
UpgradedLoot = 12,
|
||||
LegendaryLoot = 13,
|
||||
InvasionLoot = 14,
|
||||
Default = 15,
|
||||
QuestComplete = 16,
|
||||
RatedPvPReward = 17,
|
||||
CorruptedLoot = 19
|
||||
};
|
||||
|
||||
class Player;
|
||||
|
||||
/// Holder for Battleground data
|
||||
@@ -1631,6 +1662,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
void SendQuestUpdateAddCreditSimple(QuestObjective const& obj) const;
|
||||
void SendQuestUpdateAddPlayer(Quest const* quest, uint16 newCount) const;
|
||||
void SendQuestGiverStatusMultiple();
|
||||
void SendDisplayToast(uint32 entry, DisplayToastType type, bool isBonusRoll, uint32 quantity, DisplayToastMethod method, uint32 questId = 0, Item* item = nullptr) const;
|
||||
|
||||
uint32 GetSharedQuestID() const { return m_sharedQuestId; }
|
||||
ObjectGuid GetPlayerSharingQuest() const { return m_playerSharingQuest; }
|
||||
|
||||
@@ -78,7 +78,7 @@ void ItemInstance::Initialize(UF::SocketedGem const* gem)
|
||||
|
||||
void ItemInstance::Initialize(::LootItem const& lootItem)
|
||||
{
|
||||
ItemID = lootItem.itemid;
|
||||
ItemID = lootItem.itemid;
|
||||
|
||||
if (!lootItem.BonusListIDs.empty() || lootItem.randomBonusListId)
|
||||
{
|
||||
|
||||
@@ -741,3 +741,33 @@ WorldPacket const* WorldPackets::Misc::SplashScreenShowLatest::Write()
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::DisplayToast::Write()
|
||||
{
|
||||
_worldPacket << uint64(Quantity);
|
||||
_worldPacket << uint8(AsUnderlyingType(DisplayToastMethod));
|
||||
_worldPacket << uint32(QuestID);
|
||||
|
||||
_worldPacket.WriteBit(Mailed);
|
||||
_worldPacket.WriteBits(AsUnderlyingType(Type), 2);
|
||||
_worldPacket.WriteBit(IsSecondaryResult);
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case DisplayToastType::NewItem:
|
||||
_worldPacket.WriteBit(BonusRoll);
|
||||
_worldPacket << Item;
|
||||
_worldPacket << int32(LootSpec);
|
||||
_worldPacket << int32(Gender);
|
||||
break;
|
||||
case DisplayToastType::NewCurrency:
|
||||
_worldPacket << uint32(CurrencyID);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
#include "Packet.h"
|
||||
#include "CollectionMgr.h"
|
||||
#include "CUFProfile.h"
|
||||
#include "ItemPacketsCommon.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "Optional.h"
|
||||
#include "PacketUtilities.h"
|
||||
#include "Player.h"
|
||||
#include "Position.h"
|
||||
#include "SharedDefines.h"
|
||||
#include <array>
|
||||
@@ -964,6 +966,26 @@ namespace WorldPackets
|
||||
|
||||
int32 UISplashScreenID = 0;
|
||||
};
|
||||
|
||||
class DisplayToast final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
DisplayToast() : ServerPacket(SMSG_DISPLAY_TOAST) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint64 Quantity = 0;
|
||||
::DisplayToastMethod DisplayToastMethod = ::DisplayToastMethod::DoNotDisplay;
|
||||
bool Mailed = false;
|
||||
DisplayToastType Type = DisplayToastType::Money;
|
||||
uint32 QuestID = 0;
|
||||
bool IsSecondaryResult = false;
|
||||
Item::ItemInstance Item;
|
||||
bool BonusRoll = false;
|
||||
int32 LootSpec = 0;
|
||||
::Gender Gender = GENDER_NONE;
|
||||
uint32 CurrencyID = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1218,7 +1218,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DISPLAY_PROMOTION, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DISPLAY_QUEST_POPUP, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DISPLAY_SOULBIND_UPDATE_MESSAGE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DISPLAY_TOAST, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DISPLAY_TOAST, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DISPLAY_WORLD_TEXT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DONT_AUTO_PUSH_SPELLS_TO_ACTION_BAR, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DROP_NEW_CONNECTION, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
|
||||
Reference in New Issue
Block a user