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
+2 -2
View File
@@ -1462,7 +1462,7 @@ namespace Game.Entities
if (Convert.ToBoolean(proto.GetFlags2() & ItemFlags2.FactionAlliance) && GetTeam() != Team.Alliance)
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;
if (proto.GetRequiredSkill() != 0)
@@ -3362,7 +3362,7 @@ namespace Game.Entities
return InventoryResult.ItemNotFound;
// 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;
if (proto.GetRequiredSpell() != 0 && !HasSpell(proto.GetRequiredSpell()))
+1 -1
View File
@@ -1450,7 +1450,7 @@ namespace Game.Entities
if (reqraces == -1)
return true;
if ((reqraces & (long)GetRaceMask()) == 0)
if ((reqraces & (long)SharedConst.GetMaskForRace(GetRace())) == 0)
{
if (msg)
{
+1 -1
View File
@@ -1567,7 +1567,7 @@ namespace Game.Entities
void LearnSkillRewardedSpells(uint skillId, uint skillValue)
{
long raceMask = GetRaceMask();
long raceMask = SharedConst.GetMaskForRace(GetRace());
uint classMask = GetClassMask();
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 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()
{
@@ -5225,7 +5225,7 @@ namespace Game.Entities
if (pet)
pet.SynchronizeLevelWithOwner();
MailLevelReward mailReward = Global.ObjectMgr.GetMailLevelReward(level, (uint)GetRaceMask());
MailLevelReward mailReward = Global.ObjectMgr.GetMailLevelReward(level, (uint)SharedConst.GetMaskForRace(GetRace()));
if (mailReward != null)
{
//- TODO: Poor design of mail system
@@ -7034,7 +7034,7 @@ namespace Game.Entities
}
public bool IsSpellFitByClassAndRace(uint spell_id)
{
long racemask = GetRaceMask();
long racemask = SharedConst.GetMaskForRace(GetRace());
uint classmask = GetClassMask();
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 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 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)); }