mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
feat: add PvP honor credit toast on honorable kill
SMSG_PVP_CREDIT previously only wrote a system chat message. Now it also fires a new PvpHonorCallback, which game_screen.cpp uses to push a compact dark-red toast at the top-right of the screen showing "⚔ +N Honor" with a 3.5 s lifetime and smooth fade in/out.
This commit is contained in:
parent
59fc7cebaf
commit
129fa84fe3
4 changed files with 97 additions and 0 deletions
|
|
@ -1490,6 +1490,10 @@ public:
|
|||
using RepChangeCallback = std::function<void(const std::string& factionName, int32_t delta, int32_t standing)>;
|
||||
void setRepChangeCallback(RepChangeCallback cb) { repChangeCallback_ = std::move(cb); }
|
||||
|
||||
// PvP honor credit callback (honorable kill or BG reward)
|
||||
using PvpHonorCallback = std::function<void(uint32_t honorAmount, uint64_t victimGuid, uint32_t victimRank)>;
|
||||
void setPvpHonorCallback(PvpHonorCallback cb) { pvpHonorCallback_ = std::move(cb); }
|
||||
|
||||
// Quest turn-in completion callback
|
||||
using QuestCompleteCallback = std::function<void(uint32_t questId, const std::string& questTitle)>;
|
||||
void setQuestCompleteCallback(QuestCompleteCallback cb) { questCompleteCallback_ = std::move(cb); }
|
||||
|
|
@ -2831,6 +2835,9 @@ private:
|
|||
RepChangeCallback repChangeCallback_;
|
||||
uint32_t watchedFactionId_ = 0; // auto-set to most recently changed faction
|
||||
|
||||
// ---- PvP honor credit callback ----
|
||||
PvpHonorCallback pvpHonorCallback_;
|
||||
|
||||
// ---- Quest completion callback ----
|
||||
QuestCompleteCallback questCompleteCallback_;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -563,6 +563,17 @@ private:
|
|||
bool otherPlayerLevelUpCallbackSet_ = false;
|
||||
void renderPlayerLevelUpToasts(game::GameHandler& gameHandler);
|
||||
|
||||
// PvP honor credit toast ("+N Honor" shown when an honorable kill is credited)
|
||||
struct PvpHonorToastEntry {
|
||||
uint32_t honor = 0;
|
||||
uint32_t victimRank = 0; // 0 = unranked / not available
|
||||
float age = 0.0f;
|
||||
};
|
||||
static constexpr float PVP_HONOR_TOAST_DURATION = 3.5f;
|
||||
std::vector<PvpHonorToastEntry> pvpHonorToasts_;
|
||||
bool pvpHonorCallbackSet_ = false;
|
||||
void renderPvpHonorToasts();
|
||||
|
||||
// Zone discovery text ("Entering: <ZoneName>")
|
||||
static constexpr float ZONE_TEXT_DURATION = 5.0f;
|
||||
float zoneTextTimer_ = 0.0f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue