diff options
author | Ovahlord <dreadkiller@gmx.de> | 2024-06-02 17:29:23 +0200 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2024-06-02 17:29:23 +0200 |
commit | 17079022d55105b713d5b654cf7829aacf713217 (patch) | |
tree | bfaf2eb0b7fc0a06ca37c95094b017ec45218332 /src | |
parent | ae23dd46b13dd4ecc8d7c696962a3136b9891096 (diff) |
Core/Players: restore glyph slot initialization
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 33 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.h | 5 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 23530adb17f..f9f79fd32d4 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -493,6 +493,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, WorldPackets::Character::Charac // base stats and related field values InitStatsForLevel(); InitTaxiNodesForLevel(); + InitGlyphsForLevel(); InitTalentForLevel(); InitializeSkillFields(); InitPrimaryProfessions(); // to max set before any spell added @@ -2281,6 +2282,7 @@ void Player::GiveLevel(uint8 level) SetCreateHealth(0); SetCreateMana(basemana); + InitGlyphsForLevel(); InitTalentForLevel(); InitTaxiNodesForLevel(); @@ -17718,6 +17720,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol _LoadRandomBGStatus(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG)); // after spell and quest load + InitGlyphsForLevel(); InitTalentForLevel(); LearnDefaultSkills(); LearnCustomSpells(); @@ -26261,6 +26264,33 @@ void Player::ResetTalentSpecialization() */ } +void Player::InitGlyphsForLevel() +{ + uint8 slotIndex = 0; + for (GlyphSlotEntry const* glyphSlot : sGlyphSlotStore) + { + if (slotIndex >= m_activePlayerData->Glyphs.size()) + break; + + SetGlyphSlot(slotIndex, glyphSlot->ID); + SetGlyph(slotIndex, 0); + + ++slotIndex; + } + + uint8 level = GetLevel(); + uint32 slotMask = 0; + + if (level >= 25) + slotMask |= 0x01 | 0x02 | 0x40; + if (level >= 50) + slotMask |= 0x04 | 0x08 | 0x80; + if (level >= 75) + slotMask |= 0x10 | 0x20 | 0x100; + + SetGlyphsEnabled(slotMask); +} + TalentLearnResult Player::LearnPvpTalent(uint32 /*talentID*/, uint8 /*slot*/, int32* /*spellOnCooldown*/) { return TALENT_FAILED_UNKNOWN; @@ -26594,6 +26624,9 @@ void Player::SendTalentsInfoData() WorldPackets::Talent::UpdateTalentData packet; packet.Info.IsPetTalents = false; packet.Info.UnspentTalentPoints = DB2Manager::GetNumTalentsAtLevel(GetLevel(), static_cast<Classes>(GetClass())); + WorldPackets::Talent::TalentGroupInfo& talentGroup = packet.Info.TalentGroups.emplace_back(); + for (uint8 i = 0; i < m_activePlayerData->Glyphs.size(); ++i) + talentGroup.Glyphs.push_back(m_activePlayerData->Glyphs[i]); SendDirectMessage(packet.Write()); } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 81f35dac82a..522c58ddb43 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1848,6 +1848,11 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player> void RemoveTalent(TalentEntry const* talent); void ResetTalentSpecialization(); + void InitGlyphsForLevel(); + void SetGlyph(uint8 index, uint32 glyphRecId) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Glyphs, index), glyphRecId); } + void SetGlyphSlot(uint8 index, uint32 glyphSlotRecId) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::GlyphSlots, index), glyphSlotRecId); } + void SetGlyphsEnabled(uint32 slotMask) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::GlyphsEnabled), slotMask); } + TalentLearnResult LearnPvpTalent(uint32 talentID, uint8 slot, int32* spellOnCooldown); bool AddPvpTalent(PvpTalentEntry const* talent, uint8 activeTalentGroup, uint8 slot); void RemovePvpTalent(PvpTalentEntry const* talent, uint8 activeTalentGroup); |