diff --git a/Source/Framework/Constants/SharedConst.cs b/Source/Framework/Constants/SharedConst.cs index b8c91b5fb..1b5bf73de 100644 --- a/Source/Framework/Constants/SharedConst.cs +++ b/Source/Framework/Constants/SharedConst.cs @@ -558,24 +558,29 @@ namespace Framework.Constants HighmountainTauren = 28, VoidElf = 29, LightforgedDraenei = 30, - //RACE_ZANDALARI_TROLL = 31, - //RACE_KUL_TIRAN = 32, + ZandalariTroll = 31, + KulTiran = 32, //RACE_THIN_HUMAN = 33, DarkIronDwarf = 34, - //RACE_VULPERA = 35, + Vulpera = 35, MagharOrc = 36, MechaGnome = 37, Max, + } - RaceMaskAllPlayable = ((1 << (Human - 1)) | (1 << (Orc - 1)) | (1 << (Dwarf - 1)) | (1 << (NightElf - 1)) | (1 << (Undead - 1)) - | (1 << (Tauren - 1)) | (1 << (Gnome - 1)) | (1 << (Troll - 1)) | (1 << (BloodElf - 1)) | (1 << (Draenei - 1)) - | (1 << (Goblin - 1)) | (1 << (Worgen - 1)) | (1 << (PandarenNeutral - 1)) | (1 << (PandarenAlliance - 1)) | (1 << (PandarenHorde - 1)) - | (1 << (Nightborne - 1)) | (1 << (HighmountainTauren - 1)) | (1 << (VoidElf - 1)) | (1 << (LightforgedDraenei - 1)) | (1 << (DarkIronDwarf - 1)) | (1 << (MagharOrc - 1)) | (1 << (MechaGnome - 1))), + public enum RaceMask : ulong + { + AllPlayable = ((1 << (Race.Human - 1)) | (1 << (Race.Orc - 1)) | (1 << (Race.Dwarf - 1)) | (1 << (Race.NightElf - 1)) | (1 << (Race.Undead - 1)) + | (1 << (Race.Tauren - 1)) | (1 << (Race.Gnome - 1)) | (1 << (Race.Troll - 1)) | (1 << (Race.BloodElf - 1)) | (1 << (Race.Draenei - 1)) + | (1 << (Race.Goblin - 1)) | (1 << (Race.Worgen - 1)) | (1 << (Race.PandarenNeutral - 1)) | (1 << (Race.PandarenAlliance - 1)) | (1 << (Race.PandarenHorde - 1)) + | (1 << (Race.Nightborne - 1)) | (1 << (Race.HighmountainTauren - 1)) | (1 << (Race.VoidElf - 1)) | (1 << (Race.LightforgedDraenei - 1)) | (1 << (Race.ZandalariTroll - 1)) + | (1ul << (Race.KulTiran - 1)) | (1 << (Race.DarkIronDwarf - 1)) | (1 << (Race.Vulpera - 1)) | (1 << (Race.MagharOrc - 1)) | (1 << (Race.MechaGnome - 1))), - RaceMaskAlliance = ((1 << (Human - 1)) | (1 << (Dwarf - 1)) | (1 << (NightElf - 1)) | (1 << (Gnome - 1)) - | (1 << (Draenei - 1)) | (1 << (Worgen - 1)) | (1 << (PandarenAlliance - 1)) | (1 << (VoidElf - 1)) | (1 << (LightforgedDraenei - 1)) | (1 << (DarkIronDwarf - 1)) | (1 << (MechaGnome - 1))), + Alliance = ((1 << (Race.Human - 1)) | (1 << (Race.Dwarf - 1)) | (1 << (Race.NightElf - 1)) | (1 << (Race.Gnome - 1)) + | (1 << (Race.Draenei - 1)) | (1 << (Race.Worgen - 1)) | (1 << (Race.PandarenAlliance - 1)) | (1 << (Race.VoidElf - 1)) | (1 << (Race.LightforgedDraenei - 1)) + | (1ul << (Race.KulTiran - 1)) | (1 << (Race.DarkIronDwarf - 1)) | (1 << (Race.MechaGnome - 1))), - RaceMaskHorde = RaceMaskAllPlayable & ~RaceMaskAlliance + Horde = AllPlayable & ~Alliance } public enum Expansion { diff --git a/Source/Game/Achievements/CriteriaHandler.cs b/Source/Game/Achievements/CriteriaHandler.cs index c98144054..eba529744 100644 --- a/Source/Game/Achievements/CriteriaHandler.cs +++ b/Source/Game/Achievements/CriteriaHandler.cs @@ -3146,7 +3146,7 @@ namespace Game.Achievements criteria.Id, criteria.Entry.Type, DataType, ClassRace.ClassId); return false; } - if (ClassRace.RaceId != 0 && ((1ul << (int)(ClassRace.RaceId - 1)) & (ulong)Race.RaceMaskAllPlayable) == 0) + if (ClassRace.RaceId != 0 && ((1ul << (int)(ClassRace.RaceId - 1)) & (ulong)RaceMask.AllPlayable) == 0) { Log.outError(LogFilter.Sql, "Table `criteria_data` (Entry: {0} Type: {1}) for data type CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE ({2}) has non-existing race in value2 ({3}), ignored.", criteria.Id, criteria.Entry.Type, DataType, ClassRace.RaceId); @@ -3291,7 +3291,7 @@ namespace Game.Achievements criteria.Id, criteria.Entry.Type, DataType, ClassRace.ClassId); return false; } - if (ClassRace.RaceId != 0 && ((1ul << (int)(ClassRace.RaceId - 1)) & (ulong)Race.RaceMaskAllPlayable) == 0) + if (ClassRace.RaceId != 0 && ((1ul << (int)(ClassRace.RaceId - 1)) & (ulong)RaceMask.AllPlayable) == 0) { Log.outError(LogFilter.Sql, "Table `criteria_data` (Entry: {0} Type: {1}) for data type CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE ({2}) has non-existing race in value2 ({3}), ignored.", criteria.Id, criteria.Entry.Type, DataType, ClassRace.RaceId); diff --git a/Source/Game/Conditions/ConditionManager.cs b/Source/Game/Conditions/ConditionManager.cs index bb656134d..ff9d13265 100644 --- a/Source/Game/Conditions/ConditionManager.cs +++ b/Source/Game/Conditions/ConditionManager.cs @@ -1242,9 +1242,9 @@ namespace Game } case ConditionTypes.Race: { - if (Convert.ToBoolean(cond.ConditionValue1 & ~(uint)Race.RaceMaskAllPlayable)) + if (Convert.ToBoolean(cond.ConditionValue1 & ~(ulong)RaceMask.AllPlayable)) { - Log.outError(LogFilter.Sql, "{0} has non existing racemask ({1}), skipped.", cond.ToString(true), cond.ConditionValue1 & ~(uint)Race.RaceMaskAllPlayable); + Log.outError(LogFilter.Sql, "{0} has non existing racemask ({1}), skipped.", cond.ToString(true), cond.ConditionValue1 & ~(ulong)RaceMask.AllPlayable); return false; } break; diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 9cf44597b..ca48adb6b 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -3902,7 +3902,7 @@ namespace Game.Entities public static bool IsValidGender(Gender _gender) { return _gender <= Gender.Female; } public static bool IsValidClass(Class _class) { return Convert.ToBoolean((1 << ((int)_class - 1)) & (int)Class.ClassMaskAllPlayable); } - public static bool IsValidRace(Race _race) { return Convert.ToBoolean((1 << ((int)_race - 1)) & (int)Race.RaceMaskAllPlayable); } + public static bool IsValidRace(Race _race) { return Convert.ToBoolean((1ul << ((int)_race - 1)) & (ulong)RaceMask.AllPlayable); } public void OnCombatExit() { diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index f2c2ac8ee..aa481b7bc 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -5766,7 +5766,7 @@ namespace Game uint classMask = result.Read(1); uint spellId = result.Read(2); - if (raceMask != 0 && !Convert.ToBoolean(raceMask & (int)Race.RaceMaskAllPlayable)) + if (raceMask != 0 && !Convert.ToBoolean(raceMask & (ulong)RaceMask.AllPlayable)) { Log.outError(LogFilter.Sql, "Wrong race mask {0} in `playercreateinfo_spell_custom` table, ignoring.", raceMask); continue; @@ -5824,7 +5824,7 @@ namespace Game uint classMask = result.Read(1); uint spellId = result.Read(2); - if (raceMask != 0 && !raceMask.HasAnyFlag((ulong)Race.RaceMaskAllPlayable)) + if (raceMask != 0 && !raceMask.HasAnyFlag((ulong)RaceMask.AllPlayable)) { Log.outError(LogFilter.Sql, "Wrong race mask {0} in `playercreateinfo_cast_spell` table, ignoring.", raceMask); continue; @@ -6960,7 +6960,7 @@ namespace Game // AllowableRaces, can be -1/RACEMASK_ALL_PLAYABLE to allow any race if (qinfo.AllowableRaces != -1) { - if (qinfo.AllowableRaces > 0 && !Convert.ToBoolean(qinfo.AllowableRaces & (long)Race.RaceMaskAllPlayable)) + if (qinfo.AllowableRaces > 0 && !Convert.ToBoolean(qinfo.AllowableRaces & (long)RaceMask.AllPlayable)) { Log.outError(LogFilter.Sql, "Quest {0} does not contain any playable races in `RequiredRaces` ({1}), value set to 0 (all races).", qinfo.Id, qinfo.AllowableRaces); qinfo.AllowableRaces = -1; @@ -8860,7 +8860,7 @@ namespace Game continue; } - if (!Convert.ToBoolean(raceMask & (uint)Race.RaceMaskAllPlayable)) + if (!Convert.ToBoolean(raceMask & (ulong)RaceMask.AllPlayable)) { Log.outError(LogFilter.Sql, "Table `mail_level_reward` have raceMask ({0}) for level {1} that not include any player races, ignoring.", raceMask, level); continue; diff --git a/Source/Game/Handlers/CharacterHandler.cs b/Source/Game/Handlers/CharacterHandler.cs index 43616caf5..f3be726f8 100644 --- a/Source/Game/Handlers/CharacterHandler.cs +++ b/Source/Game/Handlers/CharacterHandler.cs @@ -129,6 +129,7 @@ namespace Game EnumCharactersResult.RaceUnlock raceUnlock = new EnumCharactersResult.RaceUnlock(); raceUnlock.RaceID = requirement.Key; raceUnlock.HasExpansion = (byte)GetAccountExpansion() >= requirement.Value.Expansion; + raceUnlock.HasAchievement = requirement.Value.AchievementId != 0 /*|| HasAchievement(requirement.Value.AchievementId)*/; charResult.RaceUnlockData.Add(raceUnlock); } @@ -2013,7 +2014,7 @@ namespace Game var questTemplates = Global.ObjectMgr.GetQuestTemplates(); foreach (Quest quest in questTemplates.Values) { - long newRaceMask = (long)(newTeamId == TeamId.Alliance ? Race.RaceMaskAlliance : Race.RaceMaskHorde); + long newRaceMask = (long)(newTeamId == TeamId.Alliance ? RaceMask.Alliance : RaceMask.Horde); if (quest.AllowableRaces != -1 && !Convert.ToBoolean(quest.AllowableRaces & newRaceMask)) { stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST); diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index b19f56e6f..17335af55 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -2100,7 +2100,7 @@ namespace Game.Entities } } - if (spellArea.raceMask != 0 && (spellArea.raceMask & (uint)Race.RaceMaskAllPlayable) == 0) + if (spellArea.raceMask != 0 && (spellArea.raceMask & (ulong)RaceMask.AllPlayable) == 0) { Log.outError(LogFilter.Sql, "Spell {0} listed in `spell_area` have wrong race mask ({1}) requirement", spell, spellArea.raceMask); continue;