Misc fixes

This commit is contained in:
hondacrx
2024-03-19 17:21:32 -04:00
parent 5237c49b77
commit 1e421b9f53
71 changed files with 337 additions and 319 deletions
+1 -1
View File
@@ -1343,7 +1343,7 @@ namespace Game.Spells
target.SetDisplayId(modelid);
}
if (!shapeInfo.Flags.HasAnyFlag(SpellShapeshiftFormFlags.Stance))
if (!shapeInfo.HasFlag(SpellShapeshiftFormFlags.Stance))
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Shapeshifting, GetSpellInfo());
}
else
+8 -8
View File
@@ -5759,7 +5759,7 @@ namespace Game.Spells
if (battlePet.PacketInfo.Level >= SharedConst.MaxBattlePetLevel)
return SpellCastResult.GrantPetLevelFail;
if (battlePetSpecies.GetFlags().HasFlag(BattlePetSpeciesFlags.CantBattle))
if (battlePetSpecies.HasFlag(BattlePetSpeciesFlags.CantBattle))
return SpellCastResult.BadTargets;
}
}
@@ -6266,7 +6266,7 @@ namespace Game.Spells
(float minRange, float maxRange) = GetMinMaxRange(strict);
// dont check max_range to strictly after cast
if (m_spellInfo.RangeEntry != null && m_spellInfo.RangeEntry.Flags != SpellRangeFlag.Melee && !strict)
if (m_spellInfo.RangeEntry != null && m_spellInfo.RangeEntry.HasFlag(SpellRangeFlag.Melee) && !strict)
maxRange += Math.Min(3.0f, maxRange * 0.1f); // 10% but no more than 3.0f
// get square values for sqr distance checks
@@ -6319,7 +6319,7 @@ namespace Game.Spells
if (m_spellInfo.RangeEntry != null)
{
Unit target = m_targets.GetUnitTarget();
if (m_spellInfo.RangeEntry.Flags.HasAnyFlag(SpellRangeFlag.Melee))
if (m_spellInfo.RangeEntry.HasFlag(SpellRangeFlag.Melee))
{
// when the target is not a unit, take the caster's combat reach as the target's combat reach.
if (unitCaster != null)
@@ -6328,7 +6328,7 @@ namespace Game.Spells
else
{
float meleeRange = 0.0f;
if (m_spellInfo.RangeEntry.Flags.HasAnyFlag(SpellRangeFlag.Ranged))
if (m_spellInfo.RangeEntry.HasFlag(SpellRangeFlag.Ranged))
{
// when the target is not a unit, take the caster's combat reach as the target's combat reach.
if (unitCaster != null)
@@ -6342,13 +6342,13 @@ namespace Game.Spells
{
rangeMod = m_caster.GetCombatReach() + (target != null ? target.GetCombatReach() : m_caster.GetCombatReach());
if (minRange > 0.0f && !m_spellInfo.RangeEntry.Flags.HasAnyFlag(SpellRangeFlag.Ranged))
if (minRange > 0.0f && !m_spellInfo.RangeEntry.HasFlag(SpellRangeFlag.Ranged))
minRange += rangeMod;
}
}
if (target != null && unitCaster != null && unitCaster.IsMoving() && target.IsMoving() && !unitCaster.IsWalking() && !target.IsWalking() &&
(m_spellInfo.RangeEntry.Flags.HasFlag(SpellRangeFlag.Melee) || target.IsPlayer()))
(m_spellInfo.RangeEntry.HasFlag(SpellRangeFlag.Melee) || target.IsPlayer()))
rangeMod += 8.0f / 3.0f;
}
@@ -6741,7 +6741,7 @@ namespace Game.Spells
{
if (enchantEntry == null)
return SpellCastResult.Error;
if (enchantEntry.GetFlags().HasFlag(SpellItemEnchantmentFlags.Soulbound))
if (enchantEntry.HasFlag(SpellItemEnchantmentFlags.Soulbound))
return SpellCastResult.NotTradeable;
}
break;
@@ -6758,7 +6758,7 @@ namespace Game.Spells
var enchantEntry = CliDB.SpellItemEnchantmentStorage.LookupByKey(enchant_id);
if (enchantEntry == null)
return SpellCastResult.Error;
if (enchantEntry.GetFlags().HasFlag(SpellItemEnchantmentFlags.Soulbound))
if (enchantEntry.HasFlag(SpellItemEnchantmentFlags.Soulbound))
return SpellCastResult.NotTradeable;
}
+7 -7
View File
@@ -1457,13 +1457,13 @@ namespace Game.Spells
caster = m_originalCaster;
ObjectGuid privateObjectOwner = caster.GetGUID();
if (!properties.GetFlags().HasAnyFlag(SummonPropertiesFlags.OnlyVisibleToSummoner | SummonPropertiesFlags.OnlyVisibleToSummonerGroup))
if (!properties.HasFlag(SummonPropertiesFlags.OnlyVisibleToSummoner | SummonPropertiesFlags.OnlyVisibleToSummonerGroup))
privateObjectOwner = ObjectGuid.Empty;
if (caster.IsPrivateObject())
privateObjectOwner = caster.GetPrivateObjectOwner();
if (properties.GetFlags().HasFlag(SummonPropertiesFlags.OnlyVisibleToSummonerGroup))
if (properties.HasFlag(SummonPropertiesFlags.OnlyVisibleToSummonerGroup))
if (caster.IsPlayer() && m_originalCaster.ToPlayer().GetGroup() != null)
privateObjectOwner = caster.ToPlayer().GetGroup().GetGUID();
@@ -1509,7 +1509,7 @@ namespace Game.Spells
case SummonCategory.Wild:
case SummonCategory.Ally:
case SummonCategory.Unk:
if (properties.GetFlags().HasFlag(SummonPropertiesFlags.JoinSummonerSpawnGroup))
if (properties.HasFlag(SummonPropertiesFlags.JoinSummonerSpawnGroup))
{
SummonGuardian(effectInfo, entry, properties, numSummons, privateObjectOwner);
break;
@@ -1938,7 +1938,7 @@ namespace Game.Spells
ushort skillval = Math.Max((ushort)1, playerTarget.GetPureSkillValue(skillid));
ushort maxSkillVal = (ushort)tier.GetValueForTierIndex(damage - 1);
if (rcEntry.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
if (rcEntry.HasFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
skillval = maxSkillVal;
playerTarget.SetSkill(skillid, (uint)damage, skillval, maxSkillVal);
@@ -2867,14 +2867,14 @@ namespace Game.Spells
// Players can only fight a duel in zones with this flag
AreaTableRecord casterAreaEntry = CliDB.AreaTableStorage.LookupByKey(caster.GetAreaId());
if (casterAreaEntry != null && !casterAreaEntry.GetFlags().HasFlag(AreaFlags.AllowDueling))
if (casterAreaEntry != null && !casterAreaEntry.HasFlag(AreaFlags.AllowDueling))
{
SendCastResult(SpellCastResult.NoDueling); // Dueling isn't allowed here
return;
}
AreaTableRecord targetAreaEntry = CliDB.AreaTableStorage.LookupByKey(target.GetAreaId());
if (targetAreaEntry != null && !targetAreaEntry.GetFlags().HasFlag(AreaFlags.AllowDueling))
if (targetAreaEntry != null && !targetAreaEntry.HasFlag(AreaFlags.AllowDueling))
{
SendCastResult(SpellCastResult.NoDueling); // Dueling isn't allowed here
return;
@@ -4281,7 +4281,7 @@ namespace Game.Spells
ushort skillval = Math.Max((ushort)1, playerTarget.GetPureSkillValue(skillid));
ushort maxSkillVal = (ushort)tier.GetValueForTierIndex(damage - 1);
if (rcEntry.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
if (rcEntry.HasFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
skillval = maxSkillVal;
playerTarget.SetSkill(skillid, (uint)damage, skillval, maxSkillVal);
+1 -1
View File
@@ -408,7 +408,7 @@ namespace Game.Spells
}
SpellCategoryRecord categoryEntry = CliDB.SpellCategoryStorage.LookupByKey(categoryId);
if (categoryEntry.Flags.HasAnyFlag(SpellCategoryFlags.CooldownExpiresAtDailyReset))
if (categoryEntry.HasFlag(SpellCategoryFlags.CooldownExpiresAtDailyReset))
categoryCooldown = Time.UnixTimeToDateTime(Global.WorldMgr.GetNextDailyQuestsResetTime()) - GameTime.GetSystemTime();
}
}
+5 -5
View File
@@ -476,7 +476,7 @@ namespace Game.Spells
return true;
SpellCategoryRecord category = CliDB.SpellCategoryStorage.LookupByKey(CategoryId);
return category != null && category.Flags.HasAnyFlag(SpellCategoryFlags.CooldownStartsOnEvent);
return category != null && category.HasFlag(SpellCategoryFlags.CooldownStartsOnEvent);
}
public bool IsDeathPersistent()
@@ -796,12 +796,12 @@ namespace Game.Spells
Log.outError(LogFilter.Spells, "GetErrorAtShapeshiftedCast: unknown shapeshift {0}", form);
return SpellCastResult.SpellCastOk;
}
actAsShifted = !shapeInfo.Flags.HasAnyFlag(SpellShapeshiftFormFlags.Stance);
actAsShifted = !shapeInfo.HasFlag(SpellShapeshiftFormFlags.Stance);
}
if (actAsShifted)
{
if (HasAttribute(SpellAttr0.NotShapeshifted) || (shapeInfo != null && shapeInfo.Flags.HasAnyFlag(SpellShapeshiftFormFlags.CanOnlyCastShapeshiftSpells))) // not while shapeshifted
if (HasAttribute(SpellAttr0.NotShapeshifted) || (shapeInfo != null && shapeInfo.HasFlag(SpellShapeshiftFormFlags.CanOnlyCastShapeshiftSpells))) // not while shapeshifted
return SpellCastResult.NotShapeshift;
else if (Stances != 0) // needs other shapeshift
return SpellCastResult.OnlyShapeshift;
@@ -849,7 +849,7 @@ namespace Game.Spells
{
AreaTableRecord areaTable = CliDB.AreaTableStorage.LookupByKey(area_id);
if (areaTable != null)
mountFlags = areaTable.GetMountFlags();
mountFlags = (AreaMountFlags)areaTable.MountFlags;
}
if (!mountFlags.HasFlag(AreaMountFlags.AllowFlyingMounts))
return SpellCastResult.IncorrectArea;
@@ -1245,7 +1245,7 @@ namespace Game.Spells
if (effectInfo.IsAura(AuraType.ModShapeshift))
{
var shapeShiftFromEntry = CliDB.SpellShapeshiftFormStorage.LookupByKey((uint)effectInfo.MiscValue);
if (shapeShiftFromEntry != null && !shapeShiftFromEntry.Flags.HasAnyFlag(SpellShapeshiftFormFlags.Stance))
if (shapeShiftFromEntry != null && !shapeShiftFromEntry.HasFlag(SpellShapeshiftFormFlags.Stance))
checkMask |= VehicleSeatFlags.Uncontrolled;
break;
}
+2 -2
View File
@@ -560,7 +560,7 @@ namespace Game.Entities
{
var enchantment = CliDB.SpellItemEnchantmentStorage.LookupByKey(ench_id);
if (enchantment != null)
return enchantment.GetFlags().HasFlag(SpellItemEnchantmentFlags.AllowEnteringArena);
return enchantment.HasFlag(SpellItemEnchantmentFlags.AllowEnteringArena);
return false;
}
@@ -2205,7 +2205,7 @@ namespace Game.Entities
var summonProperties = CliDB.SummonPropertiesStorage.LookupByKey(effect.EffectMiscValue[1]);
if (summonProperties != null)
{
if (summonProperties.Slot == (int)SummonSlot.MiniPet && summonProperties.GetFlags().HasFlag(SummonPropertiesFlags.SummonFromBattlePetJournal))
if (summonProperties.Slot == (int)SummonSlot.MiniPet && summonProperties.HasFlag(SummonPropertiesFlags.SummonFromBattlePetJournal))
{
var battlePetSpecies = battlePetSpeciesByCreature.LookupByKey(effect.EffectMiscValue[0]);
if (battlePetSpecies != null)