mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 00:20:16 +00:00
feat: fire PLAYER_MONEY, PLAYER_DEAD, PLAYER_ALIVE addon events
Fire more gameplay events to Lua addons: - PLAYER_MONEY — when gold/silver/copper changes (both CREATE and VALUES paths) - PLAYER_DEAD — on forced death (SMSG_FORCED_DEATH_UPDATE) - PLAYER_ALIVE — when ghost flag clears (player resurrected) Total addon events: 19 (2 world + 12 chat + 5 gameplay).
This commit is contained in:
parent
269d9e2d40
commit
c7e25beaf1
1 changed files with 8 additions and 0 deletions
|
|
@ -2633,6 +2633,7 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
// Server forces player into dead state (GM command, scripted event, etc.)
|
||||
playerDead_ = true;
|
||||
if (ghostStateCallback_) ghostStateCallback_(false); // dead but not ghost yet
|
||||
if (addonEventCallback_) addonEventCallback_("PLAYER_DEAD", {});
|
||||
addSystemChatMessage("You have been killed.");
|
||||
LOG_INFO("SMSG_FORCED_DEATH_UPDATE: player force-killed");
|
||||
packet.setReadPos(packet.getSize());
|
||||
|
|
@ -12000,8 +12001,11 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem
|
|||
}
|
||||
}
|
||||
else if (key == ufCoinage) {
|
||||
uint64_t oldMoney = playerMoneyCopper_;
|
||||
playerMoneyCopper_ = val;
|
||||
LOG_DEBUG("Money set from update fields: ", val, " copper");
|
||||
if (val != oldMoney && addonEventCallback_)
|
||||
addonEventCallback_("PLAYER_MONEY", {});
|
||||
}
|
||||
else if (ufHonor != 0xFFFF && key == ufHonor) {
|
||||
playerHonorPoints_ = val;
|
||||
|
|
@ -12450,8 +12454,11 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem
|
|||
}
|
||||
}
|
||||
else if (key == ufCoinage) {
|
||||
uint64_t oldM = playerMoneyCopper_;
|
||||
playerMoneyCopper_ = val;
|
||||
LOG_DEBUG("Money updated via VALUES: ", val, " copper");
|
||||
if (val != oldM && addonEventCallback_)
|
||||
addonEventCallback_("PLAYER_MONEY", {});
|
||||
}
|
||||
else if (ufHonorV != 0xFFFF && key == ufHonorV) {
|
||||
playerHonorPoints_ = val;
|
||||
|
|
@ -12522,6 +12529,7 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem
|
|||
corpseGuid_ = 0;
|
||||
corpseReclaimAvailableMs_ = 0;
|
||||
LOG_INFO("Player resurrected (PLAYER_FLAGS ghost cleared)");
|
||||
if (addonEventCallback_) addonEventCallback_("PLAYER_ALIVE", {});
|
||||
if (ghostStateCallback_) ghostStateCallback_(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue