mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-17 13:39:46 -04:00
Core/Packets: updated SMSG_LEVELUP_INFO (#24440)
* Core/Packets: updated & enabled SMSG_LEVELUP_INFO (cherry picked from commit bf9024c34180b1e35afb3cc9ef4cf1f3133dedfd#gitext://gotocommit/bf9024c34180b1e35afb3cc9ef4cf1f3133dedfd) # Conflicts: # src/server/game/Entities/Player/Player.cpp # src/server/game/Entities/Player/Player.h # src/server/game/Server/Protocol/Opcodes.cpp # src/server/game/Server/Protocol/Opcodes.h * Remove empty line * Remove whitespace Co-authored-by: MitchesD <majklprofik@seznam.cz>
This commit is contained in:
@@ -2593,23 +2593,23 @@ void Player::GiveLevel(uint8 level)
|
||||
PlayerClassLevelInfo classInfo;
|
||||
sObjectMgr->GetPlayerClassLevelInfo(GetClass(), level, &classInfo);
|
||||
|
||||
// send levelup info to client
|
||||
WorldPacket data(SMSG_LEVELUP_INFO, (4+4+MAX_POWERS*4+MAX_STATS*4));
|
||||
data << uint32(level);
|
||||
data << uint32(int32(classInfo.basehealth) - int32(GetCreateHealth()));
|
||||
// for (int i = 0; i < MAX_POWERS; ++i) // Powers loop (0-6)
|
||||
data << uint32(int32(classInfo.basemana) - int32(GetCreateMana()));
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
// end for
|
||||
for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) // Stats loop (0-4)
|
||||
data << uint32(int32(info.stats[i]) - GetCreateStat(Stats(i)));
|
||||
WorldPackets::Misc::LevelUpInfo packet;
|
||||
packet.Level = level;
|
||||
packet.HealthDelta = int32(classInfo.basehealth) - int32(GetCreateHealth());
|
||||
|
||||
SendDirectMessage(&data);
|
||||
/// @todo find some better solution
|
||||
// for (int i = 0; i < MAX_POWERS; ++i)
|
||||
packet.PowerDelta[0] = int32(classInfo.basemana) - int32(GetCreateMana());
|
||||
packet.PowerDelta[1] = 0;
|
||||
packet.PowerDelta[2] = 0;
|
||||
packet.PowerDelta[3] = 0;
|
||||
packet.PowerDelta[4] = 0;
|
||||
packet.PowerDelta[5] = 0;
|
||||
|
||||
for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
|
||||
packet.StatDelta[i] = int32(info.stats[i]) - GetCreateStat(Stats(i));
|
||||
|
||||
SendDirectMessage(packet.Write());
|
||||
|
||||
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr->GetXPForLevel(level));
|
||||
|
||||
|
||||
@@ -84,6 +84,20 @@ WorldPacket const* WorldPackets::Misc::Weather::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::LevelUpInfo::Write()
|
||||
{
|
||||
_worldPacket << uint32(Level);
|
||||
_worldPacket << uint32(HealthDelta);
|
||||
|
||||
for (uint32 power : PowerDelta)
|
||||
_worldPacket << power;
|
||||
|
||||
for (uint32 stat : StatDelta)
|
||||
_worldPacket << stat;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::PlayMusic::Write()
|
||||
{
|
||||
_worldPacket << SoundKitID;
|
||||
|
||||
@@ -128,6 +128,19 @@ namespace WorldPackets
|
||||
WeatherState WeatherID = WeatherState(0);
|
||||
};
|
||||
|
||||
class LevelUpInfo final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
LevelUpInfo() : ServerPacket(SMSG_LEVELUP_INFO, 56) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 Level = 0;
|
||||
uint32 HealthDelta = 0;
|
||||
std::array<uint32, MAX_POWERS> PowerDelta = { };
|
||||
std::array<uint32, MAX_STATS> StatDelta = { };
|
||||
};
|
||||
|
||||
class TC_GAME_API PlayMusic final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user