Core/Spell: Undefined SPELL_ATTR7_USABLE_IN_STUN_FEAR_CONFUSION attr for now - Some function renames - Used in some client checks but not 100% sure of its usage (eg in CGUnit_C::CheckAndReportSpellInhibitFlags but not in Spell_C::IsUsableAction)

This commit is contained in:
hondacrx
2018-03-12 13:24:16 -04:00
parent f6fc8fae09
commit 060bc0b7a8
6 changed files with 35 additions and 42 deletions
@@ -1553,7 +1553,7 @@ namespace Framework.Constants
Unk17 = 0x20000, // 17 Only 27965 (Suicide) Spell. Unk17 = 0x20000, // 17 Only 27965 (Suicide) Spell.
HasChargeEffect = 0x40000, // 18 Only Spells That Have Charge Among Effects. HasChargeEffect = 0x40000, // 18 Only Spells That Have Charge Among Effects.
ZoneTeleport = 0x80000, // 19 Teleports To Specific Zones. ZoneTeleport = 0x80000, // 19 Teleports To Specific Zones.
UsableInStunFearConfusion = 0x100000, // 20 Blink, Divine Shield, Ice Block Unk20 = 0x100000, // 20 Blink, Divine Shield, Ice Block
Unk21 = 0x200000, // 21 Not Set Unk21 = 0x200000, // 21 Not Set
Unk22 = 0x400000, // 22 Unk22 = 0x400000, // 22
Unk23 = 0x800000, // 23 Motivate, Mutilate, Shattering Throw Unk23 = 0x800000, // 23 Motivate, Mutilate, Shattering Throw
+1 -1
View File
@@ -98,7 +98,7 @@ namespace Game.DataStorage
CliDB.CharSectionsStorage.Clear(); CliDB.CharSectionsStorage.Clear();
foreach (var outfit in CliDB.CharStartOutfitStorage.Values) foreach (var outfit in CliDB.CharStartOutfitStorage.Values)
_charStartOutfits[(uint)(outfit.RaceID | (outfit.ClassID << 8) | (outfit.GenderID << 16))] = outfit; _charStartOutfits[(uint)((byte)outfit.RaceID | (outfit.ClassID << 8) | (outfit.GenderID << 16))] = outfit;
var powers = new List<ChrClassesXPowerTypesRecord>(); var powers = new List<ChrClassesXPowerTypesRecord>();
foreach (var chrClasses in CliDB.ChrClassesXPowerTypesStorage.Values) foreach (var chrClasses in CliDB.ChrClassesXPowerTypesStorage.Values)
+2 -2
View File
@@ -34,7 +34,7 @@ namespace Game.Entities
{ {
case Class.Deathknight: case Class.Deathknight:
{ {
for (byte i = 0; i < PlayerConst.TaxiMaskSize; ++i) for (int i = 0; i < PlayerConst.TaxiMaskSize; ++i)
m_taximask[i] |= (byte)(CliDB.OldContinentsNodesMask[i] & factionMask[i]); m_taximask[i] |= (byte)(CliDB.OldContinentsNodesMask[i] & factionMask[i]);
break; break;
} }
@@ -105,7 +105,7 @@ namespace Game.Entities
{ {
var split = new StringArray(data, ' '); var split = new StringArray(data, ' ');
byte index = 0; int index = 0;
for (var i = 0; index < PlayerConst.TaxiMaskSize && i != split.Length; ++i, ++index) for (var i = 0; index < PlayerConst.TaxiMaskSize && i != split.Length; ++i, ++index)
{ {
// load and set bits only for existing taxi nodes // load and set bits only for existing taxi nodes
+1 -1
View File
@@ -1703,7 +1703,7 @@ namespace Game
var factionMask = newTeamId == TeamId.Horde ? CliDB.HordeTaxiNodesMask : CliDB.AllianceTaxiNodesMask; var factionMask = newTeamId == TeamId.Horde ? CliDB.HordeTaxiNodesMask : CliDB.AllianceTaxiNodesMask;
for (byte i = 0; i < PlayerConst.TaxiMaskSize; ++i) for (int i = 0; i < PlayerConst.TaxiMaskSize; ++i)
{ {
// i = (315 - 1) / 8 = 39 // i = (315 - 1) / 8 = 39
// m = 1 << ((315 - 1) % 8) = 4 // m = 1 << ((315 - 1) % 8) = 4
+29 -35
View File
@@ -5469,13 +5469,6 @@ namespace Game.Spells
bool usableWhileStunned = m_spellInfo.HasAttribute(SpellAttr5.UsableWhileStunned); bool usableWhileStunned = m_spellInfo.HasAttribute(SpellAttr5.UsableWhileStunned);
bool usableWhileFeared = m_spellInfo.HasAttribute(SpellAttr5.UsableWhileFeared); bool usableWhileFeared = m_spellInfo.HasAttribute(SpellAttr5.UsableWhileFeared);
bool usableWhileConfused = m_spellInfo.HasAttribute(SpellAttr5.UsableWhileConfused); bool usableWhileConfused = m_spellInfo.HasAttribute(SpellAttr5.UsableWhileConfused);
if (m_spellInfo.HasAttribute(SpellAttr7.UsableInStunFearConfusion))
{
usableWhileStunned = true;
usableWhileFeared = true;
usableWhileConfused = true;
}
// Check whether the cast should be prevented by any state you might have. // Check whether the cast should be prevented by any state you might have.
SpellCastResult result = SpellCastResult.SpellCastOk; SpellCastResult result = SpellCastResult.SpellCastOk;
@@ -5485,18 +5478,18 @@ namespace Game.Spells
{ {
Unit charmer = m_caster.GetCharmer(); Unit charmer = m_caster.GetCharmer();
if (charmer) if (charmer)
if (charmer.GetUnitBeingMoved() != m_caster && CheckCasterNotImmunedCharmAuras(ref param1)) if (charmer.GetUnitBeingMoved() != m_caster && !CheckSpellCancelsCharm(ref param1))
result = SpellCastResult.Charmed; result = SpellCastResult.Charmed;
} }
else if (unitflag.HasAnyFlag(UnitFlags.Stunned) && !usableWhileStunned && CheckCasterNotImmunedStunAuras(ref param1)) else if (unitflag.HasAnyFlag(UnitFlags.Stunned) && !usableWhileStunned && !CheckSpellCancelsStun(ref param1))
result = SpellCastResult.Stunned; result = SpellCastResult.Stunned;
else if (unitflag.HasAnyFlag(UnitFlags.Silenced) && m_spellInfo.PreventionType.HasAnyFlag(SpellPreventionType.Silence) && CheckCasterNotImmunedSilenceAuras(ref param1)) else if (unitflag.HasAnyFlag(UnitFlags.Silenced) && m_spellInfo.PreventionType.HasAnyFlag(SpellPreventionType.Silence) && !CheckSpellCancelsSilence(ref param1))
result = SpellCastResult.Silenced; result = SpellCastResult.Silenced;
else if (unitflag.HasAnyFlag(UnitFlags.Pacified) && m_spellInfo.PreventionType.HasAnyFlag(SpellPreventionType.Pacify) && CheckCasterNotImmunedPacifyAuras(ref param1)) else if (unitflag.HasAnyFlag(UnitFlags.Pacified) && m_spellInfo.PreventionType.HasAnyFlag(SpellPreventionType.Pacify) && !CheckSpellCancelsPacify(ref param1))
result = SpellCastResult.Pacified; result = SpellCastResult.Pacified;
else if (unitflag.HasAnyFlag(UnitFlags.Fleeing) && !usableWhileFeared && CheckCasterNotImmunedFearAuras(ref param1)) else if (unitflag.HasAnyFlag(UnitFlags.Fleeing) && !usableWhileFeared && !CheckSpellCancelsFear(ref param1))
result = SpellCastResult.Fleeing; result = SpellCastResult.Fleeing;
else if (unitflag.HasAnyFlag(UnitFlags.Confused) && !usableWhileConfused && CheckCasterNotImmunedDisorientAuras(ref param1)) else if (unitflag.HasAnyFlag(UnitFlags.Confused) && !usableWhileConfused && !CheckSpellCancelsConfuse(ref param1))
result = SpellCastResult.Confused; result = SpellCastResult.Confused;
else if (m_caster.HasFlag(UnitFields.Flags2, UnitFlags2.NoActions) && m_spellInfo.PreventionType.HasAnyFlag(SpellPreventionType.NoActions)) else if (m_caster.HasFlag(UnitFields.Flags2, UnitFlags2.NoActions) && m_spellInfo.PreventionType.HasAnyFlag(SpellPreventionType.NoActions))
result = SpellCastResult.NoActions; result = SpellCastResult.NoActions;
@@ -5507,60 +5500,61 @@ namespace Game.Spells
return SpellCastResult.SpellCastOk; return SpellCastResult.SpellCastOk;
} }
// based on sub_00804430 from 12340 client bool CheckSpellCancelsAuraEffect(AuraType auraType, ref uint param1)
bool CheckCasterHasNotImmunedAuraType(AuraType auraType, ref uint param1)
{ {
// Checking auras is needed now, because you are prevented by some state but the spell grants immunity. // Checking auras is needed now, because you are prevented by some state but the spell grants immunity.
var auraEffects = m_caster.GetAuraEffectsByType(auraType); var auraEffects = m_caster.GetAuraEffectsByType(auraType);
if (auraEffects.Empty()) if (auraEffects.Empty())
return false; return true;
foreach (AuraEffect aurEff in auraEffects) foreach (AuraEffect aurEff in auraEffects)
{ {
if (m_spellInfo.CanSpellCastOverrideAuraEffect(aurEff)) if (m_spellInfo.SpellCancelsAuraEffect(aurEff))
continue; continue;
param1 = (uint)aurEff.GetSpellEffectInfo().Mechanic; param1 = (uint)aurEff.GetSpellEffectInfo().Mechanic;
if (param1 == 0) if (param1 == 0)
param1 = (uint)aurEff.GetSpellInfo().Mechanic; param1 = (uint)aurEff.GetSpellInfo().Mechanic;
return true;
return false;
} }
return false; return true;
} }
bool CheckCasterNotImmunedCharmAuras(ref uint param1) bool CheckSpellCancelsCharm(ref uint param1)
{ {
return CheckCasterHasNotImmunedAuraType(AuraType.ModCharm, ref param1) || return CheckSpellCancelsAuraEffect(AuraType.ModCharm, ref param1) ||
CheckCasterHasNotImmunedAuraType(AuraType.AoeCharm, ref param1) || CheckSpellCancelsAuraEffect(AuraType.AoeCharm, ref param1) ||
CheckCasterHasNotImmunedAuraType(AuraType.ModPossess, ref param1); CheckSpellCancelsAuraEffect(AuraType.ModPossess, ref param1);
} }
bool CheckCasterNotImmunedStunAuras(ref uint param1) bool CheckSpellCancelsStun(ref uint param1)
{ {
return CheckCasterHasNotImmunedAuraType(AuraType.ModStun, ref param1); return CheckSpellCancelsAuraEffect(AuraType.ModStun, ref param1) &&
CheckSpellCancelsAuraEffect(AuraType.Strangulate, ref param1);
} }
bool CheckCasterNotImmunedSilenceAuras(ref uint param1) bool CheckSpellCancelsSilence(ref uint param1)
{ {
return CheckCasterHasNotImmunedAuraType(AuraType.ModSilence, ref param1) || return CheckSpellCancelsAuraEffect(AuraType.ModSilence, ref param1) ||
CheckCasterHasNotImmunedAuraType(AuraType.ModPacifySilence, ref param1); CheckSpellCancelsAuraEffect(AuraType.ModPacifySilence, ref param1);
} }
bool CheckCasterNotImmunedPacifyAuras(ref uint param1) bool CheckSpellCancelsPacify(ref uint param1)
{ {
return CheckCasterHasNotImmunedAuraType(AuraType.ModPacify, ref param1) || return CheckSpellCancelsAuraEffect(AuraType.ModPacify, ref param1) ||
CheckCasterHasNotImmunedAuraType(AuraType.ModPacifySilence, ref param1); CheckSpellCancelsAuraEffect(AuraType.ModPacifySilence, ref param1);
} }
bool CheckCasterNotImmunedFearAuras(ref uint param1) bool CheckSpellCancelsFear(ref uint param1)
{ {
return CheckCasterHasNotImmunedAuraType(AuraType.ModFear, ref param1); return CheckSpellCancelsAuraEffect(AuraType.ModFear, ref param1);
} }
bool CheckCasterNotImmunedDisorientAuras(ref uint param1) bool CheckSpellCancelsConfuse(ref uint param1)
{ {
return CheckCasterHasNotImmunedAuraType(AuraType.ModConfuse, ref param1); return CheckSpellCancelsAuraEffect(AuraType.ModConfuse, ref param1);
} }
SpellCastResult CheckArenaAndRatedBattlegroundCastRules() SpellCastResult CheckArenaAndRatedBattlegroundCastRules()
+1 -2
View File
@@ -2465,8 +2465,7 @@ namespace Game.Spells
return false; return false;
} }
// based on client sub_007FDFA0 public bool SpellCancelsAuraEffect(AuraEffect aurEff)
public bool CanSpellCastOverrideAuraEffect(AuraEffect aurEff)
{ {
if (!HasAttribute(SpellAttr1.DispelAurasOnImmunity)) if (!HasAttribute(SpellAttr1.DispelAurasOnImmunity))
return false; return false;