mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 15:50:20 +00:00
feat: show stat gains in level-up toast from SMSG_LEVELUP_INFO
Parse hp/mana/str/agi/sta/int/spi deltas from SMSG_LEVELUP_INFO payload and display them in green below the "You have reached level X!" banner. Extends DING_DURATION to 4s to give players time to read the gains.
This commit is contained in:
parent
6df8c72cf7
commit
6957ba97ea
4 changed files with 80 additions and 9 deletions
|
|
@ -3823,10 +3823,21 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
case Opcode::SMSG_LEVELUP_INFO:
|
||||
case Opcode::SMSG_LEVELUP_INFO_ALT: {
|
||||
// Server-authoritative level-up event.
|
||||
// First field is always the new level in Classic/TBC/WotLK-era layouts.
|
||||
// WotLK layout: uint32 newLevel + uint32 hpDelta + uint32 manaDelta + 5x uint32 statDeltas
|
||||
if (packet.getSize() - packet.getReadPos() >= 4) {
|
||||
uint32_t newLevel = packet.readUInt32();
|
||||
if (newLevel > 0) {
|
||||
// Parse stat deltas (WotLK layout has 7 more uint32s)
|
||||
lastLevelUpDeltas_ = {};
|
||||
if (packet.getSize() - packet.getReadPos() >= 28) {
|
||||
lastLevelUpDeltas_.hp = packet.readUInt32();
|
||||
lastLevelUpDeltas_.mana = packet.readUInt32();
|
||||
lastLevelUpDeltas_.str = packet.readUInt32();
|
||||
lastLevelUpDeltas_.agi = packet.readUInt32();
|
||||
lastLevelUpDeltas_.sta = packet.readUInt32();
|
||||
lastLevelUpDeltas_.intel = packet.readUInt32();
|
||||
lastLevelUpDeltas_.spi = packet.readUInt32();
|
||||
}
|
||||
uint32_t oldLevel = serverPlayerLevel_;
|
||||
serverPlayerLevel_ = std::max(serverPlayerLevel_, newLevel);
|
||||
for (auto& ch : characters) {
|
||||
|
|
@ -3840,7 +3851,6 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
}
|
||||
}
|
||||
}
|
||||
// Remaining payload (hp/mana/stat deltas) is optional for our client.
|
||||
packet.setReadPos(packet.getSize());
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue