fix(core/dbc): improve ChrRace DBC handling (#14843)

Cherry pick of https://github.com/TrinityCore/TrinityCore/pull/24508

Co-authored-by: HelloKitty <5829095+HelloKitty@users.noreply.github.com>
This commit is contained in:
M'Dic
2023-04-27 19:29:33 -04:00
committed by GitHub
parent e19d3be755
commit 3eae4c5713
26 changed files with 167 additions and 126 deletions

View File

@@ -2258,7 +2258,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
//! Since no common attributes were found, (not even in titleRewardFlags field)
//! we explicitly check by ID. Maybe in the future we could move the achievement_reward
//! condition fields to the condition system.
if (uint32 titleId = reward->titleId[achievement->ID == 1793 ? GetPlayer()->getGender() : uint8(GetPlayer()->GetTeamId())])
if (uint32 titleId = reward->titleId[achievement->ID == 1793 ? GetPlayer()->GetNativeGender() : (GetPlayer()->GetTeam() == ALLIANCE ? 0 : 1)])
if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId))
GetPlayer()->SetTitle(titleEntry);
@@ -2363,8 +2363,8 @@ bool AchievementMgr::CanUpdateCriteria(AchievementCriteriaEntry const* criteria,
if (achievement->mapID != -1 && GetPlayer()->GetMapId() != uint32(achievement->mapID))
return false;
if ((achievement->requiredFaction == ACHIEVEMENT_FACTION_HORDE && GetPlayer()->GetTeamId(true) != TEAM_HORDE) ||
(achievement->requiredFaction == ACHIEVEMENT_FACTION_ALLIANCE && GetPlayer()->GetTeamId(true) != TEAM_ALLIANCE))
if ((achievement->requiredFaction == ACHIEVEMENT_FACTION_HORDE && GetPlayer()->GetTeamId() != TEAM_HORDE) ||
(achievement->requiredFaction == ACHIEVEMENT_FACTION_ALLIANCE && GetPlayer()->GetTeamId() != TEAM_ALLIANCE))
return false;
for (uint32 i = 0; i < MAX_CRITERIA_REQUIREMENTS; ++i)