Core/Achievements: Fix gender-specific Matron/Patron title reward.

Closes #1406
This commit is contained in:
Machiavelli
2011-09-28 16:26:15 +02:00
parent be12603150
commit 8cde717e76
3 changed files with 16 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
-- Replaces MATRON with PATRON title on MALE char.
UPDATE characters SET knownTitles = CONCAT(
SUBSTRING_INDEX(SUBSTRING_INDEX(knownTitles, ' ', 1), ' ', -1), ' ',
SUBSTRING_INDEX(SUBSTRING_INDEX(knownTitles, ' ', 2), ' ', -1), ' ',
SUBSTRING_INDEX(SUBSTRING_INDEX(knownTitles, ' ', 3), ' ', -1), ' ',
(SUBSTRING_INDEX(SUBSTRING_INDEX(knownTitles, ' ', 4), ' ', -1) | 512) &~256, ' ',
SUBSTRING_INDEX(SUBSTRING_INDEX(knownTitles, ' ', 5), ' ', -1), ' ',
SUBSTRING_INDEX(SUBSTRING_INDEX(knownTitles, ' ', 6), ' ', -1))
WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(knownTitles, ' ', 4), ' ', -1) & 256 AND gender = 0;

View File

@@ -0,0 +1,2 @@
-- Set `title_A` to male variant (Patron)
UPDATE `achievement_reward` SET `title_A`=138 WHERE `entry`=1793;

View File

@@ -2039,7 +2039,11 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
return;
// titles
if (uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == ALLIANCE ? 0 : 1])
//! Currently there's only one achievement that deals with gender-specific titles.
//! 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() : (GetPlayer()->GetTeam() == ALLIANCE ? 0 : 1)])
if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId))
GetPlayer()->SetTitle(titleEntry);