Core/Quests: restored rewarding talent points from quests

This commit is contained in:
Ovahlord
2023-11-19 17:18:04 +01:00
parent 4eb2f72ddb
commit 659bd86f7b
2 changed files with 19 additions and 1 deletions

View File

@@ -189,6 +189,7 @@ Player::Player(WorldSession* session) : Unit(true), m_sceneMgr(this)
memset(m_items, 0, sizeof(Item*)*PLAYER_SLOTS_COUNT);
_questRewardedTalentPoints = 0;
m_social = nullptr;
// group is initialized in the reference constructor
@@ -14973,6 +14974,12 @@ void Player::RewardQuest(Quest const* quest, LootItemType rewardType, uint32 rew
SetTitle(titleEntry);
}
if (quest->GetRewardSkillPoints())
{
_questRewardedTalentPoints += quest->GetRewardSkillPoints();
InitTalentForLevel();
}
// Send reward mail
if (uint32 mail_template_id = quest->GetRewMailTemplateId())
{
@@ -18827,6 +18834,9 @@ void Player::_LoadQuestStatusRewarded(PreparedQueryResult result)
if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(quest->GetRewTitle()))
SetTitle(titleEntry);
if (quest->GetRewardSkillPoints())
_questRewardedTalentPoints += quest->GetRewardSkillPoints();
// Skip loading special quests - they are also added to rewarded quests but only once and remain there forever
// instead add them separately from load daily/weekly/monthly/seasonal
if (!quest->IsDailyOrWeekly() && !quest->IsMonthly() && !quest->IsSeasonal())
@@ -26404,7 +26414,7 @@ void Player::SendTalentsInfoData()
}
if (i == activeGroup)
packet.UnspentTalentPoints = std::max<int32>(0, DB2Manager::GetNumTalentsAtLevel(GetLevel(), Classes(GetClass())) - groupInfo.Talents.size());
packet.UnspentTalentPoints = std::max<int32>(0, CalculateTalentsPoints() - groupInfo.Talents.size());
std::vector<uint32> glyphs = GetGlyphs(activeGroup);
glyphs.resize(MAX_GLYPH_SLOT_INDEX, 0); // Blizzard always sends 6 glyph slots, no matter if they are used or not
@@ -26416,6 +26426,11 @@ void Player::SendTalentsInfoData()
SendDirectMessage(packet.Write());
}
uint32 Player::CalculateTalentsPoints() const
{
return DB2Manager::GetNumTalentsAtLevel(GetLevel(), Classes(GetClass())) + _questRewardedTalentPoints;
}
void Player::SendEquipmentSetList()
{
WorldPackets::EquipmentSet::LoadEquipmentSet data;

View File

@@ -1147,6 +1147,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
int64 GetBarberShopCost(Trinity::IteratorPair<UF::ChrCustomizationChoice const*> newCustomizations) const;
uint32 _questRewardedTalentPoints;
PlayerSocial* GetSocial() const { return m_social; }
void RemoveSocial();
@@ -1828,6 +1830,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
uint32 GetNextResetTalentsCost() const;
void InitTalentForLevel();
void SendTalentsInfoData();
uint32 CalculateTalentsPoints() const;
TalentLearnResult LearnTalent(uint32 talentId, int32* spellOnCooldown);
bool AddTalent(TalentEntry const* talent, uint8 spec, bool learning);
bool HasTalent(uint32 spell_id, uint8 spec) const;