mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-26 00:19:24 -04:00
Core/Quests: restore rewarding talent points from quests
This commit is contained in:
@@ -279,6 +279,7 @@ Player::Player(WorldSession* session) : Unit(true), m_sceneMgr(this)
|
||||
m_lastPotionId = 0;
|
||||
|
||||
_activeTalentGroup = 0;
|
||||
_questRewardedTalentPoints = 0;
|
||||
|
||||
m_auraBaseFlatMod.fill(0.0f);
|
||||
m_auraBasePctMod.fill(1.0f);
|
||||
@@ -14397,6 +14398,14 @@ void Player::RewardQuest(Quest const* quest, LootItemType rewardType, uint32 rew
|
||||
SetTitle(titleEntry);
|
||||
}
|
||||
|
||||
// Quests which have no skillId set but still reward skill points, are considered talent point rewards
|
||||
if (!quest->GetRewardSkillId() && quest->GetRewardSkillPoints())
|
||||
{
|
||||
_questRewardedTalentPoints += quest->GetRewardSkillPoints();
|
||||
UpdateAvailableTalentPoints();
|
||||
SendTalentsInfoData();
|
||||
}
|
||||
|
||||
// Send reward mail
|
||||
if (uint32 mail_template_id = quest->GetRewMailTemplateId())
|
||||
{
|
||||
@@ -18429,6 +18438,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())
|
||||
@@ -28586,7 +28598,7 @@ bool Player::LearnTalent(uint32 talentId, uint8 rank)
|
||||
|
||||
void Player::UpdateAvailableTalentPoints()
|
||||
{
|
||||
uint32 points = sDB2Manager.GetNumTalentsAtLevel(GetLevel(), Classes(GetClass()));
|
||||
uint32 points = sDB2Manager.GetNumTalentsAtLevel(GetLevel(), Classes(GetClass())) + _questRewardedTalentPoints;
|
||||
uint32 spentPoints = 0;
|
||||
for (auto const& pair : _talentGroups[_activeTalentGroup].Talents)
|
||||
spentPoints += pair.second + 1;
|
||||
|
||||
@@ -3029,6 +3029,7 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
|
||||
// Talents
|
||||
std::vector<TalentGroupInfo> _talentGroups;
|
||||
uint8 _activeTalentGroup;
|
||||
uint32 _questRewardedTalentPoints;
|
||||
|
||||
std::unordered_map<int32, PlayerSpellState> m_traitConfigStates;
|
||||
|
||||
|
||||
@@ -5260,7 +5260,7 @@ void ObjectMgr::LoadQuests()
|
||||
}
|
||||
}
|
||||
|
||||
if (qinfo->_rewardSkillPoints)
|
||||
if (qinfo->_rewardSkillPoints && qinfo->_rewardSkillId)
|
||||
{
|
||||
if (qinfo->_rewardSkillPoints > sWorld->GetConfigMaxSkillValue())
|
||||
{
|
||||
@@ -5268,11 +5268,6 @@ void ObjectMgr::LoadQuests()
|
||||
qinfo->GetQuestId(), qinfo->_rewardSkillPoints, sWorld->GetConfigMaxSkillValue());
|
||||
// no changes, quest can't be done for this requirement
|
||||
}
|
||||
if (!qinfo->_rewardSkillId)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Quest {} has `RewardSkillPoints` = {} but `RewardSkillId` is 0",
|
||||
qinfo->GetQuestId(), qinfo->_rewardSkillPoints);
|
||||
}
|
||||
}
|
||||
|
||||
// fill additional data stores
|
||||
|
||||
Reference in New Issue
Block a user