diff options
author | Ovahlord <dreadkiller@gmx.de> | 2024-06-02 16:16:46 +0200 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2024-06-02 16:16:46 +0200 |
commit | 2b56ab5be5819db4d90731b28ce802710aa76695 (patch) | |
tree | 427327a49ad7243f29b806b4d9887cb86e49a8ba /src | |
parent | 29ad3297aeb9471e498e565271ad956869df2c15 (diff) |
Core/Packets: updated SMSG_UPDATE_TALENT_DATA packet structure for 4.4.0
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 81 | ||||
-rw-r--r-- | src/server/game/Handlers/SkillHandler.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Server/Packets/TalentPackets.cpp | 41 | ||||
-rw-r--r-- | src/server/game/Server/Packets/TalentPackets.h | 21 |
4 files changed, 43 insertions, 104 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 05c7c7773b9..23530adb17f 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2357,9 +2357,10 @@ void Player::InitTalentForLevel() if (PvpTalentEntry const* pvpTalent = sPvpTalentStore.LookupEntry(GetPvpTalentMap(spec)[slot])) RemovePvpTalent(pvpTalent, spec); + */ + if (!GetSession()->PlayerLoading()) SendTalentsInfoData(); // update at client - */ } void Player::InitStatsForLevel(bool reapplyMods) @@ -26234,6 +26235,8 @@ TalentLearnResult Player::LearnTalent(uint32 talentId, int32* spellOnCooldown) void Player::ResetTalentSpecialization() { + SendTalentsInfoData(); + /* // Reset only talents that have different spells for each spec uint32 class_ = GetClass(); @@ -26589,80 +26592,10 @@ bool Player::CanSeeSpellClickOn(Creature const* c) const void Player::SendTalentsInfoData() { WorldPackets::Talent::UpdateTalentData packet; - packet.Info.PrimarySpecialization = AsUnderlyingType(GetPrimarySpecialization()); + packet.Info.IsPetTalents = false; + packet.Info.UnspentTalentPoints = DB2Manager::GetNumTalentsAtLevel(GetLevel(), static_cast<Classes>(GetClass())); - for (uint8 i = 0; i < MAX_SPECIALIZATIONS; ++i) - { - ChrSpecializationEntry const* spec = sDB2Manager.GetChrSpecializationByIndex(GetClass(), i); - if (!spec) - continue; - - PlayerTalentMap* talents = GetTalentMap(i); - PlayerPvpTalentMap const& pvpTalents = GetPvpTalentMap(i); - - WorldPackets::Talent::TalentGroupInfo groupInfoPkt; - groupInfoPkt.SpecID = spec->ID; - groupInfoPkt.TalentIDs.reserve(talents->size()); - - for (PlayerTalentMap::const_iterator itr = talents->begin(); itr != talents->end(); ++itr) - { - if (itr->second == PLAYERSPELL_REMOVED) - continue; - - TalentEntry const* talentInfo = sTalentStore.LookupEntry(itr->first); - if (!talentInfo) - { - TC_LOG_ERROR("entities.player", "Player::SendTalentsInfoData: Player '{}' ({}) has unknown talent id: {}", - GetName(), GetGUID().ToString(), itr->first); - continue; - } - - SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(talentInfo->SpellID, DIFFICULTY_NONE); - if (!spellEntry) - { - TC_LOG_ERROR("entities.player", "Player::SendTalentsInfoData: Player '{}' ({}) has unknown talent spell: {}", - GetName(), GetGUID().ToString(), talentInfo->SpellID); - continue; - } - - groupInfoPkt.TalentIDs.push_back(uint16(itr->first)); - } - - for (std::size_t slot = 0; slot < MAX_PVP_TALENT_SLOTS; ++slot) - { - if (!pvpTalents[slot]) - continue; - - PvpTalentEntry const* talentInfo = sPvpTalentStore.LookupEntry(pvpTalents[slot]); - if (!talentInfo) - { - TC_LOG_ERROR("entities.player", "Player::SendTalentsInfoData: Player '{}' ({}) has unknown pvp talent id: {}", - GetName(), GetGUID().ToString(), pvpTalents[slot]); - continue; - } - - SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(talentInfo->SpellID, DIFFICULTY_NONE); - if (!spellEntry) - { - TC_LOG_ERROR("entities.player", "Player::SendTalentsInfoData: Player '{}' ({}) has unknown pvp talent spell: {}", - GetName(), GetGUID().ToString(), talentInfo->SpellID); - continue; - } - - groupInfoPkt.PvPTalents.emplace_back(); - WorldPackets::Talent::PvPTalent& pvpTalent = groupInfoPkt.PvPTalents.back(); - pvpTalent.PvPTalentID = pvpTalents[slot]; - pvpTalent.Slot = slot; - } - - if (i == GetActiveTalentGroup()) - packet.Info.ActiveGroup = packet.Info.TalentGroups.size(); - - if (!groupInfoPkt.TalentIDs.empty() || !groupInfoPkt.PvPTalents.empty() || i == GetActiveTalentGroup()) - packet.Info.TalentGroups.push_back(groupInfoPkt); - } - - // SendDirectMessage(packet.Write()); + SendDirectMessage(packet.Write()); } void Player::SendEquipmentSetList() diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp index 2d51a1fa08e..c0076810310 100644 --- a/src/server/game/Handlers/SkillHandler.cpp +++ b/src/server/game/Handlers/SkillHandler.cpp @@ -50,8 +50,9 @@ void WorldSession::HandleLearnTalentsOpcode(WorldPackets::Talent::LearnTalents& _player->SendTalentsInfoData(); } -void WorldSession::HandleLearnPvpTalentsOpcode(WorldPackets::Talent::LearnPvpTalents& packet) +void WorldSession::HandleLearnPvpTalentsOpcode(WorldPackets::Talent::LearnPvpTalents& /*packet*/) { + /* WorldPackets::Talent::LearnPvpTalentFailed learnPvpTalentFailed; bool anythingLearned = false; for (WorldPackets::Talent::PvPTalent pvpTalent : packet.Talents) @@ -72,6 +73,7 @@ void WorldSession::HandleLearnPvpTalentsOpcode(WorldPackets::Talent::LearnPvpTal if (anythingLearned) _player->SendTalentsInfoData(); + */ } void WorldSession::HandleConfirmRespecWipeOpcode(WorldPackets::Talent::ConfirmRespecWipe& confirmRespecWipe) diff --git a/src/server/game/Server/Packets/TalentPackets.cpp b/src/server/game/Server/Packets/TalentPackets.cpp index 57aa6c6d430..c5103732977 100644 --- a/src/server/game/Server/Packets/TalentPackets.cpp +++ b/src/server/game/Server/Packets/TalentPackets.cpp @@ -17,39 +17,39 @@ #include "TalentPackets.h" -ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Talent::PvPTalent& pvpTalent) +ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Talent::TalentInfo const& talent) { - data >> pvpTalent.PvPTalentID; - data >> pvpTalent.Slot; - return data; -} - -ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Talent::PvPTalent const& pvpTalent) -{ - data << uint16(pvpTalent.PvPTalentID); - data << uint8(pvpTalent.Slot); + data << uint32(talent.TalentID); + data << uint32(talent.Rank); return data; } WorldPacket const* WorldPackets::Talent::UpdateTalentData::Write() { + _worldPacket << uint32(Info.UnspentTalentPoints); _worldPacket << uint8(Info.ActiveGroup); - _worldPacket << uint32(Info.PrimarySpecialization); _worldPacket << uint32(Info.TalentGroups.size()); for (auto& talentGroupInfo : Info.TalentGroups) { - _worldPacket << uint32(talentGroupInfo.SpecID); - _worldPacket << uint32(talentGroupInfo.TalentIDs.size()); - _worldPacket << uint32(talentGroupInfo.PvPTalents.size()); + _worldPacket << uint8(talentGroupInfo.Talents.size()); + _worldPacket << uint32(talentGroupInfo.Talents.size()); - for (uint16 talent : talentGroupInfo.TalentIDs) - _worldPacket << uint16(talent); + _worldPacket << uint8(talentGroupInfo.Glyphs.size()); + _worldPacket << uint32(talentGroupInfo.Glyphs.size()); - for (PvPTalent talent : talentGroupInfo.PvPTalents) + _worldPacket << uint8(talentGroupInfo.SpecID); + _worldPacket << uint32(talentGroupInfo.PrimarySpecialization); + + for (TalentInfo const& talent : talentGroupInfo.Talents) _worldPacket << talent; + + for (uint16 glyph : talentGroupInfo.Glyphs) + _worldPacket << glyph; } + _worldPacket.WriteBit(Info.IsPetTalents); + return &_worldPacket; } @@ -106,18 +106,19 @@ WorldPacket const* WorldPackets::Talent::ActiveGlyphs::Write() void WorldPackets::Talent::LearnPvpTalents::Read() { + /* Talents.resize(_worldPacket.read<uint32>()); for (uint32 i = 0; i < Talents.size(); ++i) _worldPacket >> Talents[i]; + */ } WorldPacket const* WorldPackets::Talent::LearnPvpTalentFailed::Write() { + /* _worldPacket.WriteBits(Reason, 4); _worldPacket << int32(SpellID); _worldPacket << uint32(Talents.size()); - for (PvPTalent pvpTalent : Talents) - _worldPacket << pvpTalent; - + */ return &_worldPacket; } diff --git a/src/server/game/Server/Packets/TalentPackets.h b/src/server/game/Server/Packets/TalentPackets.h index 702b26be149..e1a11e88170 100644 --- a/src/server/game/Server/Packets/TalentPackets.h +++ b/src/server/game/Server/Packets/TalentPackets.h @@ -27,23 +27,26 @@ namespace WorldPackets { namespace Talent { - struct PvPTalent + struct TalentInfo { - uint16 PvPTalentID = 0; - uint8 Slot = 0; + uint32 TalentID = 0; + uint32 Rank = 0; }; struct TalentGroupInfo { - uint32 SpecID = 0; - std::vector<uint16> TalentIDs; - std::vector<PvPTalent> PvPTalents; + uint8 SpecID = 0; + uint32 PrimarySpecialization = 0; + std::vector<TalentInfo> Talents; + std::vector<uint16> Glyphs; }; struct TalentInfoUpdate { + uint32 UnspentTalentPoints; uint8 ActiveGroup = 0; - uint32 PrimarySpecialization = 0; + bool IsPetTalents = false; + std::vector<TalentGroupInfo> TalentGroups; }; @@ -127,7 +130,7 @@ namespace WorldPackets void Read() override; - Array<PvPTalent, 4> Talents; + //Array<PvPTalent, 4> Talents; }; class LearnPvpTalentFailed final : public ServerPacket @@ -139,7 +142,7 @@ namespace WorldPackets uint32 Reason = 0; int32 SpellID = 0; - std::vector<PvPTalent> Talents; + //std::vector<PvPTalent> Talents; }; } } |