Core/Packet: SMSG_LEVELUP_INFO (#10884)
This commit is contained in:
committed by
GitHub
parent
204043ccd2
commit
86e438a1e7
@@ -2426,23 +2426,23 @@ void Player::GiveLevel(uint8 level)
|
|||||||
PlayerClassLevelInfo classInfo;
|
PlayerClassLevelInfo classInfo;
|
||||||
sObjectMgr->GetPlayerClassLevelInfo(getClass(), level, &classInfo);
|
sObjectMgr->GetPlayerClassLevelInfo(getClass(), level, &classInfo);
|
||||||
|
|
||||||
// send levelup info to client
|
WorldPackets::Misc::LevelUpInfo packet;
|
||||||
WorldPacket data(SMSG_LEVELUP_INFO, (4 + 4 + MAX_POWERS * 4 + MAX_STATS * 4));
|
packet.Level = level;
|
||||||
data << uint32(level);
|
packet.HealthDelta = int32(classInfo.basehealth) - int32(GetCreateHealth());
|
||||||
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)));
|
|
||||||
|
|
||||||
GetSession()->SendPacket(&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));
|
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr->GetXPForLevel(level));
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,20 @@ WorldPacket const* WorldPackets::Misc::Weather::Write()
|
|||||||
return &_worldPacket;
|
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 const* WorldPackets::Misc::PlayMusic::Write()
|
||||||
{
|
{
|
||||||
_worldPacket << SoundKitID;
|
_worldPacket << SoundKitID;
|
||||||
|
|||||||
@@ -41,6 +41,19 @@ namespace WorldPackets
|
|||||||
WeatherState WeatherID = WeatherState(0);
|
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 AC_GAME_API PlayMusic final : public ServerPacket
|
class AC_GAME_API PlayMusic final : public ServerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user