Core/Races: Really fix bug in racemasks.

This commit is contained in:
hondacrx
2021-01-25 13:06:53 -05:00
parent 3201b804fa
commit b25c1487b2
14 changed files with 63 additions and 52 deletions
+27 -15
View File
@@ -278,6 +278,27 @@ namespace Framework.Constants
MaxVisibilityDistance MaxVisibilityDistance
}; };
static int[] raceBits =
{
0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 21, -1, 23, 24, 25, 26, 27, 28,
29, 30, 31, -1, 11, 12, 13, 14
};
public static ulong RaceMaskAllPlayable = (ulong)(GetMaskForRace(Race.Human) | GetMaskForRace(Race.Orc) | GetMaskForRace(Race.Dwarf) | GetMaskForRace(Race.NightElf) | GetMaskForRace(Race.Undead)
| GetMaskForRace(Race.Tauren) | GetMaskForRace(Race.Gnome) | GetMaskForRace(Race.Troll) | GetMaskForRace(Race.BloodElf) | GetMaskForRace(Race.Draenei)
| GetMaskForRace(Race.Goblin) | GetMaskForRace(Race.Worgen) | GetMaskForRace(Race.PandarenNeutral) | GetMaskForRace(Race.PandarenAlliance) | GetMaskForRace(Race.PandarenHorde)
| GetMaskForRace(Race.Nightborne) | GetMaskForRace(Race.HighmountainTauren) | GetMaskForRace(Race.VoidElf) | GetMaskForRace(Race.LightforgedDraenei) | GetMaskForRace(Race.ZandalariTroll)
| GetMaskForRace(Race.KulTiran) | GetMaskForRace(Race.DarkIronDwarf) | GetMaskForRace(Race.Vulpera) | GetMaskForRace(Race.MagharOrc) | GetMaskForRace(Race.MechaGnome));
public static ulong RaceMaskAlliance = (ulong)(GetMaskForRace(Race.Human) | GetMaskForRace(Race.Dwarf) | GetMaskForRace(Race.NightElf) | GetMaskForRace(Race.Gnome)
| GetMaskForRace(Race.Draenei) | GetMaskForRace(Race.Worgen) | GetMaskForRace(Race.PandarenAlliance) | GetMaskForRace(Race.VoidElf) | GetMaskForRace(Race.LightforgedDraenei)
| GetMaskForRace(Race.KulTiran) | GetMaskForRace(Race.DarkIronDwarf) | GetMaskForRace(Race.MechaGnome));
public static ulong RaceMaskHorde = RaceMaskAllPlayable & ~RaceMaskAlliance;
//Todo move these else where //Todo move these else where
/// <summary> /// <summary>
/// Method Const /// Method Const
@@ -375,6 +396,11 @@ namespace Framework.Constants
{ {
return locale < Locale.Total && locale != Locale.None; return locale < Locale.Total && locale != Locale.None;
} }
public static long GetMaskForRace(Race raceId)
{
return raceId < Race.Max && raceBits[(int)raceId] >= 0 && raceBits[(int)raceId] < 64 ? (1 << raceBits[(int)raceId]) : 0;
}
} }
public enum Locale public enum Locale
@@ -565,23 +591,9 @@ namespace Framework.Constants
Vulpera = 35, Vulpera = 35,
MagharOrc = 36, MagharOrc = 36,
MechaGnome = 37, MechaGnome = 37,
Max, Max
} }
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)) | (1ul << (Race.DarkIronDwarf - 1)) | (1ul << (Race.Vulpera - 1)) | (1ul << (Race.MagharOrc - 1)) | (1ul << (Race.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)) | (1ul << (Race.DarkIronDwarf - 1)) | (1ul << (Race.MechaGnome - 1))),
Horde = AllPlayable & ~Alliance
}
public enum Expansion public enum Expansion
{ {
LevelCurrent = -1, LevelCurrent = -1,
+2 -2
View File
@@ -3146,7 +3146,7 @@ namespace Game.Achievements
criteria.Id, criteria.Entry.Type, DataType, ClassRace.ClassId); criteria.Id, criteria.Entry.Type, DataType, ClassRace.ClassId);
return false; return false;
} }
if (ClassRace.RaceId != 0 && ((1ul << (int)(ClassRace.RaceId - 1)) & (ulong)RaceMask.AllPlayable) == 0) if (ClassRace.RaceId != 0 && (SharedConst.GetMaskForRace((Race)ClassRace.RaceId) & (long)SharedConst.RaceMaskAllPlayable) == 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.", 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); criteria.Id, criteria.Entry.Type, DataType, ClassRace.RaceId);
@@ -3291,7 +3291,7 @@ namespace Game.Achievements
criteria.Id, criteria.Entry.Type, DataType, ClassRace.ClassId); criteria.Id, criteria.Entry.Type, DataType, ClassRace.ClassId);
return false; return false;
} }
if (ClassRace.RaceId != 0 && ((1ul << (int)(ClassRace.RaceId - 1)) & (ulong)RaceMask.AllPlayable) == 0) if (ClassRace.RaceId != 0 && ((ulong)SharedConst.GetMaskForRace((Race)ClassRace.RaceId) & SharedConst.RaceMaskAllPlayable) == 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.", 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); criteria.Id, criteria.Entry.Type, DataType, ClassRace.RaceId);
+1 -1
View File
@@ -95,7 +95,7 @@ namespace Game.Conditions
break; break;
case ConditionTypes.Race: case ConditionTypes.Race:
if (unit != null) if (unit != null)
condMeets = Convert.ToBoolean(unit.GetRaceMask() & ConditionValue1); condMeets = Convert.ToBoolean(SharedConst.GetMaskForRace(unit.GetRace()) & ConditionValue1);
break; break;
case ConditionTypes.Gender: case ConditionTypes.Gender:
if (player != null) if (player != null)
+3 -3
View File
@@ -1242,9 +1242,9 @@ namespace Game
} }
case ConditionTypes.Race: case ConditionTypes.Race:
{ {
if (Convert.ToBoolean(cond.ConditionValue1 & ~(ulong)RaceMask.AllPlayable)) if (Convert.ToBoolean(cond.ConditionValue1 & ~SharedConst.RaceMaskAllPlayable))
{ {
Log.outError(LogFilter.Sql, "{0} has non existing racemask ({1}), skipped.", cond.ToString(true), cond.ConditionValue1 & ~(ulong)RaceMask.AllPlayable); Log.outError(LogFilter.Sql, "{0} has non existing racemask ({1}), skipped.", cond.ToString(true), cond.ConditionValue1 & ~SharedConst.RaceMaskAllPlayable);
return false; return false;
} }
break; break;
@@ -1752,7 +1752,7 @@ namespace Game
} }
} }
if (condition.RaceMask != 0 && !Convert.ToBoolean(player.GetRaceMask() & condition.RaceMask)) if (condition.RaceMask != 0 && !Convert.ToBoolean(SharedConst.GetMaskForRace(player.GetRace()) & condition.RaceMask))
return false; return false;
if (condition.ClassMask != 0 && !Convert.ToBoolean(player.GetClassMask() & condition.ClassMask)) if (condition.ClassMask != 0 && !Convert.ToBoolean(player.GetClassMask() & condition.ClassMask))
+2 -2
View File
@@ -1462,7 +1462,7 @@ namespace Game.Entities
if (Convert.ToBoolean(proto.GetFlags2() & ItemFlags2.FactionAlliance) && GetTeam() != Team.Alliance) if (Convert.ToBoolean(proto.GetFlags2() & ItemFlags2.FactionAlliance) && GetTeam() != Team.Alliance)
return InventoryResult.CantEquipEver; return InventoryResult.CantEquipEver;
if ((proto.GetAllowableClass() & GetClassMask()) == 0 || (proto.GetAllowableRace() & (long)GetRaceMask()) == 0) if ((proto.GetAllowableClass() & GetClassMask()) == 0 || (proto.GetAllowableRace() & (long)SharedConst.GetMaskForRace(GetRace())) == 0)
return InventoryResult.CantEquipEver; return InventoryResult.CantEquipEver;
if (proto.GetRequiredSkill() != 0) if (proto.GetRequiredSkill() != 0)
@@ -3362,7 +3362,7 @@ namespace Game.Entities
return InventoryResult.ItemNotFound; return InventoryResult.ItemNotFound;
// Used by group, function GroupLoot, to know if a prototype can be used by a player // Used by group, function GroupLoot, to know if a prototype can be used by a player
if ((proto.GetAllowableClass() & GetClassMask()) == 0 || (proto.GetAllowableRace() & (long)GetRaceMask()) == 0) if ((proto.GetAllowableClass() & GetClassMask()) == 0 || (proto.GetAllowableRace() & (long)SharedConst.GetMaskForRace(GetRace())) == 0)
return InventoryResult.CantEquipEver; return InventoryResult.CantEquipEver;
if (proto.GetRequiredSpell() != 0 && !HasSpell(proto.GetRequiredSpell())) if (proto.GetRequiredSpell() != 0 && !HasSpell(proto.GetRequiredSpell()))
+1 -1
View File
@@ -1450,7 +1450,7 @@ namespace Game.Entities
if (reqraces == -1) if (reqraces == -1)
return true; return true;
if ((reqraces & (long)GetRaceMask()) == 0) if ((reqraces & (long)SharedConst.GetMaskForRace(GetRace())) == 0)
{ {
if (msg) if (msg)
{ {
+1 -1
View File
@@ -1567,7 +1567,7 @@ namespace Game.Entities
void LearnSkillRewardedSpells(uint skillId, uint skillValue) void LearnSkillRewardedSpells(uint skillId, uint skillValue)
{ {
long raceMask = GetRaceMask(); long raceMask = SharedConst.GetMaskForRace(GetRace());
uint classMask = GetClassMask(); uint classMask = GetClassMask();
List<SkillLineAbilityRecord> skillLineAbilities = Global.DB2Mgr.GetSkillLineAbilitiesBySkill(skillId); List<SkillLineAbilityRecord> skillLineAbilities = Global.DB2Mgr.GetSkillLineAbilitiesBySkill(skillId);
+3 -3
View File
@@ -3902,7 +3902,7 @@ namespace Game.Entities
public static bool IsValidGender(Gender _gender) { return _gender <= Gender.Female; } 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 IsValidClass(Class _class) { return Convert.ToBoolean((1 << ((int)_class - 1)) & (int)Class.ClassMaskAllPlayable); }
public static bool IsValidRace(Race _race) { return Convert.ToBoolean((1ul << ((int)_race - 1)) & (ulong)RaceMask.AllPlayable); } public static bool IsValidRace(Race _race) { return Convert.ToBoolean((ulong)SharedConst.GetMaskForRace(_race) & SharedConst.RaceMaskAllPlayable); }
public void OnCombatExit() public void OnCombatExit()
{ {
@@ -5225,7 +5225,7 @@ namespace Game.Entities
if (pet) if (pet)
pet.SynchronizeLevelWithOwner(); pet.SynchronizeLevelWithOwner();
MailLevelReward mailReward = Global.ObjectMgr.GetMailLevelReward(level, (uint)GetRaceMask()); MailLevelReward mailReward = Global.ObjectMgr.GetMailLevelReward(level, (uint)SharedConst.GetMaskForRace(GetRace()));
if (mailReward != null) if (mailReward != null)
{ {
//- TODO: Poor design of mail system //- TODO: Poor design of mail system
@@ -7034,7 +7034,7 @@ namespace Game.Entities
} }
public bool IsSpellFitByClassAndRace(uint spell_id) public bool IsSpellFitByClassAndRace(uint spell_id)
{ {
long racemask = GetRaceMask(); long racemask = SharedConst.GetMaskForRace(GetRace());
uint classmask = GetClassMask(); uint classmask = GetClassMask();
var bounds = Global.SpellMgr.GetSkillLineAbilityMapBounds(spell_id); var bounds = Global.SpellMgr.GetSkillLineAbilityMapBounds(spell_id);
-1
View File
@@ -1801,7 +1801,6 @@ namespace Game.Entities
public Race GetRace() { return (Race)(byte)m_unitData.Race; } public Race GetRace() { return (Race)(byte)m_unitData.Race; }
public void SetRace(Race race) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Race), (byte)race); } public void SetRace(Race race) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Race), (byte)race); }
public long GetRaceMask() { return 1L << ((int)GetRace() - 1); }
public Class GetClass() { return (Class)(byte)m_unitData.ClassId; } public Class GetClass() { return (Class)(byte)m_unitData.ClassId; }
public void SetClass(Class classId) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.ClassId), (byte)classId); } public void SetClass(Class classId) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.ClassId), (byte)classId); }
public uint GetClassMask() { return (uint)(1 << ((int)GetClass() - 1)); } public uint GetClassMask() { return (uint)(1 << ((int)GetClass() - 1)); }
+13 -13
View File
@@ -5727,15 +5727,15 @@ namespace Game
{ {
if (rcInfo.Availability == 1) if (rcInfo.Availability == 1)
{ {
for (int raceIndex = (int)Race.Human; raceIndex < (int)Race.Max; ++raceIndex) for (Race raceIndex = Race.Human; raceIndex < Race.Max; ++raceIndex)
{ {
if (rcInfo.RaceMask == -1 || Convert.ToBoolean((1L << (raceIndex - 1)) & rcInfo.RaceMask)) if (rcInfo.RaceMask == -1 || Convert.ToBoolean(SharedConst.GetMaskForRace(raceIndex) & rcInfo.RaceMask))
{ {
for (int classIndex = (int)Class.Warrior; classIndex < (int)Class.Max; ++classIndex) for (int classIndex = (int)Class.Warrior; classIndex < (int)Class.Max; ++classIndex)
{ {
if (rcInfo.ClassMask == -1 || Convert.ToBoolean((1 << (classIndex - 1)) & rcInfo.ClassMask)) if (rcInfo.ClassMask == -1 || Convert.ToBoolean((1 << (classIndex - 1)) & rcInfo.ClassMask))
{ {
PlayerInfo info = _playerInfo[raceIndex][classIndex]; PlayerInfo info = _playerInfo[(int)raceIndex][classIndex];
if (info != null) if (info != null)
info.skills.Add(rcInfo); info.skills.Add(rcInfo);
} }
@@ -5766,7 +5766,7 @@ namespace Game
uint classMask = result.Read<uint>(1); uint classMask = result.Read<uint>(1);
uint spellId = result.Read<uint>(2); uint spellId = result.Read<uint>(2);
if (raceMask != 0 && !Convert.ToBoolean(raceMask & (ulong)RaceMask.AllPlayable)) if (raceMask != 0 && !Convert.ToBoolean(raceMask & SharedConst.RaceMaskAllPlayable))
{ {
Log.outError(LogFilter.Sql, "Wrong race mask {0} in `playercreateinfo_spell_custom` table, ignoring.", raceMask); Log.outError(LogFilter.Sql, "Wrong race mask {0} in `playercreateinfo_spell_custom` table, ignoring.", raceMask);
continue; continue;
@@ -5778,15 +5778,15 @@ namespace Game
continue; continue;
} }
for (int raceIndex = (int)Race.Human; raceIndex < (int)Race.Max; ++raceIndex) for (Race raceIndex = Race.Human; raceIndex < Race.Max; ++raceIndex)
{ {
if (raceMask == 0 || Convert.ToBoolean((1ul << (raceIndex - 1)) & raceMask)) if (raceMask == 0 || Convert.ToBoolean((ulong)SharedConst.GetMaskForRace(raceIndex) & raceMask))
{ {
for (int classIndex = (int)Class.Warrior; classIndex < (int)Class.Max; ++classIndex) for (int classIndex = (int)Class.Warrior; classIndex < (int)Class.Max; ++classIndex)
{ {
if (classMask == 0 || Convert.ToBoolean((1 << (classIndex - 1)) & classMask)) if (classMask == 0 || Convert.ToBoolean((1 << (classIndex - 1)) & classMask))
{ {
PlayerInfo info = _playerInfo[raceIndex][classIndex]; PlayerInfo info = _playerInfo[(int)raceIndex][classIndex];
if (info != null) if (info != null)
{ {
info.customSpells.Add(spellId); info.customSpells.Add(spellId);
@@ -5824,7 +5824,7 @@ namespace Game
uint classMask = result.Read<uint>(1); uint classMask = result.Read<uint>(1);
uint spellId = result.Read<uint>(2); uint spellId = result.Read<uint>(2);
if (raceMask != 0 && !raceMask.HasAnyFlag((ulong)RaceMask.AllPlayable)) if (raceMask != 0 && (raceMask & SharedConst.RaceMaskAllPlayable) == 0)
{ {
Log.outError(LogFilter.Sql, "Wrong race mask {0} in `playercreateinfo_cast_spell` table, ignoring.", raceMask); Log.outError(LogFilter.Sql, "Wrong race mask {0} in `playercreateinfo_cast_spell` table, ignoring.", raceMask);
continue; continue;
@@ -5836,15 +5836,15 @@ namespace Game
continue; continue;
} }
for (int raceIndex = (int)Race.Human; raceIndex < (int)Race.Max; ++raceIndex) for (Race raceIndex = Race.Human; raceIndex < Race.Max; ++raceIndex)
{ {
if (raceMask == 0 || Convert.ToBoolean((1ul << (raceIndex - 1)) & raceMask)) if (raceMask == 0 || Convert.ToBoolean((ulong)SharedConst.GetMaskForRace(raceIndex) & raceMask))
{ {
for (int classIndex = (int)Class.Warrior; classIndex < (int)Class.Max; ++classIndex) for (int classIndex = (int)Class.Warrior; classIndex < (int)Class.Max; ++classIndex)
{ {
if (classMask == 0 || Convert.ToBoolean((1 << (classIndex - 1)) & classMask)) if (classMask == 0 || Convert.ToBoolean((1 << (classIndex - 1)) & classMask))
{ {
PlayerInfo info = _playerInfo[raceIndex][classIndex]; PlayerInfo info = _playerInfo[(int)raceIndex][classIndex];
if (info != null) if (info != null)
{ {
info.castSpells.Add(spellId); info.castSpells.Add(spellId);
@@ -6960,7 +6960,7 @@ namespace Game
// AllowableRaces, can be -1/RACEMASK_ALL_PLAYABLE to allow any race // AllowableRaces, can be -1/RACEMASK_ALL_PLAYABLE to allow any race
if (qinfo.AllowableRaces != -1) if (qinfo.AllowableRaces != -1)
{ {
if (qinfo.AllowableRaces > 0 && !Convert.ToBoolean(qinfo.AllowableRaces & (long)RaceMask.AllPlayable)) if (qinfo.AllowableRaces > 0 && !Convert.ToBoolean(qinfo.AllowableRaces & (long)SharedConst.RaceMaskAllPlayable))
{ {
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); 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; qinfo.AllowableRaces = -1;
@@ -8860,7 +8860,7 @@ namespace Game
continue; continue;
} }
if (!Convert.ToBoolean(raceMask & (ulong)RaceMask.AllPlayable)) if (!Convert.ToBoolean(raceMask & SharedConst.RaceMaskAllPlayable))
{ {
Log.outError(LogFilter.Sql, "Table `mail_level_reward` have raceMask ({0}) for level {1} that not include any player races, ignoring.", raceMask, level); Log.outError(LogFilter.Sql, "Table `mail_level_reward` have raceMask ({0}) for level {1} that not include any player races, ignoring.", raceMask, level);
continue; continue;
+3 -3
View File
@@ -355,7 +355,7 @@ namespace Game
if (!HasPermission(RBACPermissions.SkipCheckCharacterCreationRacemask)) if (!HasPermission(RBACPermissions.SkipCheckCharacterCreationRacemask))
{ {
ulong raceMaskDisabled = WorldConfig.GetUInt64Value(WorldCfg.CharacterCreatingDisabledRacemask); ulong raceMaskDisabled = WorldConfig.GetUInt64Value(WorldCfg.CharacterCreatingDisabledRacemask);
if (Convert.ToBoolean((1ul << ((int)charCreate.CreateInfo.RaceId - 1)) & raceMaskDisabled)) if (Convert.ToBoolean((ulong)SharedConst.GetMaskForRace(charCreate.CreateInfo.RaceId) & raceMaskDisabled))
{ {
SendCharCreate(ResponseCodes.CharCreateDisabled); SendCharCreate(ResponseCodes.CharCreateDisabled);
return; return;
@@ -1704,7 +1704,7 @@ namespace Game
if (!HasPermission(RBACPermissions.SkipCheckCharacterCreationRacemask)) if (!HasPermission(RBACPermissions.SkipCheckCharacterCreationRacemask))
{ {
ulong raceMaskDisabled = WorldConfig.GetUInt64Value(WorldCfg.CharacterCreatingDisabledRacemask); ulong raceMaskDisabled = WorldConfig.GetUInt64Value(WorldCfg.CharacterCreatingDisabledRacemask);
if (Convert.ToBoolean(1ul << ((int)factionChangeInfo.RaceID - 1) & raceMaskDisabled)) if (Convert.ToBoolean((ulong)SharedConst.GetMaskForRace(factionChangeInfo.RaceID) & raceMaskDisabled))
{ {
SendCharFactionChange(ResponseCodes.CharCreateError, factionChangeInfo); SendCharFactionChange(ResponseCodes.CharCreateError, factionChangeInfo);
return; return;
@@ -2013,7 +2013,7 @@ namespace Game
var questTemplates = Global.ObjectMgr.GetQuestTemplates(); var questTemplates = Global.ObjectMgr.GetQuestTemplates();
foreach (Quest quest in questTemplates.Values) foreach (Quest quest in questTemplates.Values)
{ {
long newRaceMask = (long)(newTeamId == TeamId.Alliance ? RaceMask.Alliance : RaceMask.Horde); long newRaceMask = (long)(newTeamId == TeamId.Alliance ? SharedConst.RaceMaskAlliance : SharedConst.RaceMaskHorde);
if (quest.AllowableRaces != -1 && !Convert.ToBoolean(quest.AllowableRaces & newRaceMask)) if (quest.AllowableRaces != -1 && !Convert.ToBoolean(quest.AllowableRaces & newRaceMask))
{ {
stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST); stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST);
+4 -4
View File
@@ -91,7 +91,7 @@ namespace Game
if (factionEntry == null) if (factionEntry == null)
return 0; return 0;
long raceMask = _player.GetRaceMask(); long raceMask = SharedConst.GetMaskForRace(_player.GetRace());
uint classMask = _player.GetClassMask(); uint classMask = _player.GetClassMask();
for (var i = 0; i < 4; i++) for (var i = 0; i < 4; i++)
{ {
@@ -149,7 +149,7 @@ namespace Game
if (factionEntry == null) if (factionEntry == null)
return 0; return 0;
long raceMask = _player.GetRaceMask(); long raceMask = SharedConst.GetMaskForRace(_player.GetRace());
uint classMask = _player.GetClassMask(); uint classMask = _player.GetClassMask();
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
@@ -405,7 +405,7 @@ namespace Game
var factionEntry = CliDB.FactionStorage.LookupByKey(factionTemplateEntry.Faction); var factionEntry = CliDB.FactionStorage.LookupByKey(factionTemplateEntry.Faction);
if (factionEntry.Id != 0) if (factionEntry.Id != 0)
// Never show factions of the opposing team // Never show factions of the opposing team
if (!Convert.ToBoolean(factionEntry.ReputationRaceMask[1] & _player.GetRaceMask()) && factionEntry.ReputationBase[1] == Reputation_Bottom) if (!Convert.ToBoolean(factionEntry.ReputationRaceMask[1] & SharedConst.GetMaskForRace(_player.GetRace())) && factionEntry.ReputationBase[1] == Reputation_Bottom)
SetVisible(factionEntry); SetVisible(factionEntry);
} }
@@ -629,7 +629,7 @@ namespace Game
if (factionEntry == null) if (factionEntry == null)
return 0; return 0;
ulong raceMask = (1ul << ((int)race - 1)); ulong raceMask = (ulong)SharedConst.GetMaskForRace(race);
uint classMask = (1u << ((int)playerClass - 1)); uint classMask = (1u << ((int)playerClass - 1));
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
+1 -1
View File
@@ -2969,7 +2969,7 @@ namespace Game.Spells
} }
case SpellProcsPerMinuteModType.Race: case SpellProcsPerMinuteModType.Race:
{ {
if (caster.GetRaceMask().HasAnyFlag(mod.Param)) if (SharedConst.GetMaskForRace(caster.GetRace()).HasAnyFlag((int)mod.Param))
ppm *= 1.0f + mod.Coeff; ppm *= 1.0f + mod.Coeff;
break; break;
} }
+2 -2
View File
@@ -2100,7 +2100,7 @@ namespace Game.Entities
} }
} }
if (spellArea.raceMask != 0 && (spellArea.raceMask & (ulong)RaceMask.AllPlayable) == 0) if (spellArea.raceMask != 0 && (spellArea.raceMask & SharedConst.RaceMaskAllPlayable) == 0)
{ {
Log.outError(LogFilter.Sql, "Spell {0} listed in `spell_area` have wrong race mask ({1}) requirement", spell, spellArea.raceMask); Log.outError(LogFilter.Sql, "Spell {0} listed in `spell_area` have wrong race mask ({1}) requirement", spell, spellArea.raceMask);
continue; continue;
@@ -3781,7 +3781,7 @@ namespace Game.Entities
return false; return false;
if (raceMask != 0) // not in expected race if (raceMask != 0) // not in expected race
if (player == null || !Convert.ToBoolean(raceMask & (ulong)player.GetRaceMask())) if (player == null || !Convert.ToBoolean(raceMask & (ulong)SharedConst.GetMaskForRace(player.GetRace())))
return false; return false;
if (areaId != 0) // not in expected zone if (areaId != 0) // not in expected zone