Core/Errors: Stop using System.Diagnostics.Contracts, Its just closing the server without error or warning. We now log the error and then throw a exception

This commit is contained in:
hondacrx
2018-06-15 12:34:56 -04:00
parent 1289bc3ed1
commit 7aa494d5dd
86 changed files with 520 additions and 558 deletions
+47 -48
View File
@@ -24,7 +24,6 @@ using Game.Network.Packets;
using Game.Scripting;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
namespace Game.Spells
@@ -75,7 +74,7 @@ namespace Game.Spells
_effectsToApply = effMask;
_needClientUpdate = false;
Contract.Assert(GetTarget() != null && GetBase() != null);
Cypher.Assert(GetTarget() != null && GetBase() != null);
// Try find slot for aura
byte slot = 0;
@@ -165,20 +164,20 @@ namespace Game.Spells
Log.outError(LogFilter.Spells, "Aura {0} has no effect at effectIndex {1} but _HandleEffect was called", GetBase().GetSpellInfo().Id, effIndex);
return;
}
Contract.Assert(aurEff != null);
Contract.Assert(HasEffect(effIndex) == (!apply));
Contract.Assert(Convert.ToBoolean((1 << (int)effIndex) & _effectsToApply));
Cypher.Assert(aurEff != null);
Cypher.Assert(HasEffect(effIndex) == (!apply));
Cypher.Assert(Convert.ToBoolean((1 << (int)effIndex) & _effectsToApply));
Log.outDebug(LogFilter.Spells, "AuraApplication._HandleEffect: {0}, apply: {1}: amount: {2}", aurEff.GetAuraType(), apply, aurEff.GetAmount());
if (apply)
{
Contract.Assert(!Convert.ToBoolean(_effectMask & (1 << (int)effIndex)));
Cypher.Assert(!Convert.ToBoolean(_effectMask & (1 << (int)effIndex)));
_effectMask |= (uint)(1 << (int)effIndex);
aurEff.HandleEffect(this, AuraEffectHandleModes.Real, true);
}
else
{
Contract.Assert(Convert.ToBoolean(_effectMask & (1 << (int)effIndex)));
Cypher.Assert(Convert.ToBoolean(_effectMask & (1 << (int)effIndex)));
_effectMask &= ~(uint)(1 << (int)effIndex);
aurEff.HandleEffect(this, AuraEffectHandleModes.Real, false);
}
@@ -196,7 +195,7 @@ namespace Game.Spells
public void BuildUpdatePacket(ref AuraInfo auraInfo, bool remove)
{
Contract.Assert(_target.HasVisibleAura(this) != remove);
Cypher.Assert(_target.HasVisibleAura(this) != remove);
auraInfo.Slot = GetSlot();
if (remove)
@@ -264,7 +263,7 @@ namespace Game.Spells
public uint GetEffectMask() { return _effectMask; }
public bool HasEffect(uint effect)
{
Contract.Assert(effect < SpellConst.MaxEffects);
Cypher.Assert(effect < SpellConst.MaxEffects);
return Convert.ToBoolean(_effectMask & (1 << (int)effect));
}
public bool IsPositive() { return _flags.HasAnyFlag(AuraFlags.Positive); }
@@ -363,10 +362,10 @@ namespace Game.Spells
public virtual void _ApplyForTarget(Unit target, Unit caster, AuraApplication auraApp)
{
Contract.Assert(target != null);
Contract.Assert(auraApp != null);
Cypher.Assert(target != null);
Cypher.Assert(auraApp != null);
// aura mustn't be already applied on target
//Contract.Assert(!IsAppliedOnTarget(target.GetGUID()) && "Aura._ApplyForTarget: aura musn't be already applied on target");
//Cypher.Assert(!IsAppliedOnTarget(target.GetGUID()) && "Aura._ApplyForTarget: aura musn't be already applied on target");
m_applications[target.GetGUID()] = auraApp;
@@ -382,9 +381,9 @@ namespace Game.Spells
}
public virtual void _UnapplyForTarget(Unit target, Unit caster, AuraApplication auraApp)
{
Contract.Assert(target != null);
Contract.Assert(auraApp.HasRemoveMode());
Contract.Assert(auraApp != null);
Cypher.Assert(target != null);
Cypher.Assert(auraApp.HasRemoveMode());
Cypher.Assert(auraApp != null);
var app = m_applications.LookupByKey(target.GetGUID());
@@ -393,11 +392,11 @@ namespace Game.Spells
{
Log.outError(LogFilter.Spells, "Aura._UnapplyForTarget, target: {0}, caster: {1}, spell: {2} was not found in owners application map!",
target.GetGUID().ToString(), caster ? caster.GetGUID().ToString() : "", auraApp.GetBase().GetSpellInfo().Id);
Contract.Assert(false);
Cypher.Assert(false);
}
// aura has to be already applied
Contract.Assert(app == auraApp);
Cypher.Assert(app == auraApp);
m_applications.Remove(target.GetGUID());
m_removedApplications.Add(auraApp);
@@ -412,7 +411,7 @@ namespace Game.Spells
// and marks aura as removed
public void _Remove(AuraRemoveMode removeMode)
{
Contract.Assert(!m_isRemoved);
Cypher.Assert(!m_isRemoved);
m_isRemoved = true;
foreach (var pair in m_applications.ToList())
{
@@ -482,7 +481,7 @@ namespace Game.Spells
else
{
// ok, we have one unit twice in target map (impossible, but...)
Contract.Assert(false);
Cypher.Assert(false);
}
}
@@ -564,7 +563,7 @@ namespace Game.Spells
if (aurApp != null)
{
// owner has to be in world, or effect has to be applied to self
Contract.Assert((!m_owner.IsInWorld && m_owner == pair.Key) || m_owner.IsInMap(pair.Key));
Cypher.Assert((!m_owner.IsInWorld && m_owner == pair.Key) || m_owner.IsInMap(pair.Key));
pair.Key._ApplyAura(aurApp, pair.Value);
}
}
@@ -587,7 +586,7 @@ namespace Game.Spells
if (GetApplicationOfTarget(unit.GetGUID()) != null)
{
// owner has to be in world, or effect has to be applied to self
Contract.Assert((!GetOwner().IsInWorld && GetOwner() == unit) || GetOwner().IsInMap(unit));
Cypher.Assert((!GetOwner().IsInWorld && GetOwner() == unit) || GetOwner().IsInMap(unit));
unit._ApplyAuraEffect(this, effIndex);
}
}
@@ -595,7 +594,7 @@ namespace Game.Spells
public void UpdateOwner(uint diff, WorldObject owner)
{
Contract.Assert(owner == m_owner);
Cypher.Assert(owner == m_owner);
Unit caster = GetCaster();
// Apply spellmods for channeled auras
@@ -994,9 +993,9 @@ namespace Game.Spells
public void UnregisterSingleTarget()
{
Contract.Assert(m_isSingleTarget);
Cypher.Assert(m_isSingleTarget);
Unit caster = GetCaster();
Contract.Assert(caster != null);
Cypher.Assert(caster != null);
caster.GetSingleCastAuras().Remove(this);
SetIsSingleTarget(false);
}
@@ -1076,7 +1075,7 @@ namespace Game.Spells
public void RecalculateAmountOfEffects()
{
Contract.Assert(!IsRemoved());
Cypher.Assert(!IsRemoved());
Unit caster = GetCaster();
foreach (AuraEffect effect in GetAuraEffects())
if (effect != null && !IsRemoved())
@@ -1085,7 +1084,7 @@ namespace Game.Spells
public void HandleAllEffects(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
Contract.Assert(!IsRemoved());
Cypher.Assert(!IsRemoved());
foreach (AuraEffect effect in GetAuraEffects())
if (effect != null && !IsRemoved())
effect.HandleEffect(aurApp, mode, apply);
@@ -1625,7 +1624,7 @@ namespace Game.Spells
SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(GetId());
Contract.Assert(procEntry != null);
Cypher.Assert(procEntry != null);
// cooldowns should be added to the whole aura (see 51698 area aura)
AddProcCooldown(now + TimeSpan.FromMilliseconds(procEntry.Cooldown));
@@ -2227,12 +2226,12 @@ namespace Game.Spells
public WorldObject GetOwner() { return m_owner; }
public Unit GetUnitOwner()
{
Contract.Assert(GetAuraType() == AuraObjectType.Unit);
Cypher.Assert(GetAuraType() == AuraObjectType.Unit);
return m_owner.ToUnit();
}
public DynamicObject GetDynobjOwner()
{
Contract.Assert(GetAuraType() == AuraObjectType.DynObj);
Cypher.Assert(GetAuraType() == AuraObjectType.DynObj);
return m_owner.ToDynamicObject();
}
@@ -2345,8 +2344,8 @@ namespace Game.Spells
//Static Methods
public static uint BuildEffectMaskForOwner(SpellInfo spellProto, uint availableEffectMask, WorldObject owner)
{
Contract.Assert(spellProto != null);
Contract.Assert(owner != null);
Cypher.Assert(spellProto != null);
Cypher.Assert(owner != null);
uint effMask = 0;
switch (owner.GetTypeId())
{
@@ -2377,10 +2376,10 @@ namespace Game.Spells
}
public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, out bool refresh, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default(ObjectGuid), bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default(ObjectGuid), int castItemLevel = -1)
{
Contract.Assert(spellproto != null);
Contract.Assert(owner != null);
Contract.Assert(caster || !casterGUID.IsEmpty());
Contract.Assert(tryEffMask <= SpellConst.MaxEffectMask);
Cypher.Assert(spellproto != null);
Cypher.Assert(owner != null);
Cypher.Assert(caster || !casterGUID.IsEmpty());
Cypher.Assert(tryEffMask <= SpellConst.MaxEffectMask);
refresh = false;
uint effMask = BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
@@ -2402,10 +2401,10 @@ namespace Game.Spells
}
public static Aura TryCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid castItemGuid = default(ObjectGuid), int castItemLevel = -1)
{
Contract.Assert(spellproto != null);
Contract.Assert(owner != null);
Contract.Assert(caster != null || !casterGUID.IsEmpty());
Contract.Assert(tryEffMask <= SpellConst.MaxEffectMask);
Cypher.Assert(spellproto != null);
Cypher.Assert(owner != null);
Cypher.Assert(caster != null || !casterGUID.IsEmpty());
Cypher.Assert(tryEffMask <= SpellConst.MaxEffectMask);
uint effMask = BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
if (effMask == 0)
return null;
@@ -2413,11 +2412,11 @@ namespace Game.Spells
}
public static Aura Create(SpellInfo spellproto, ObjectGuid castId, uint effMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, int castItemLevel)
{
Contract.Assert(effMask != 0);
Contract.Assert(spellproto != null);
Contract.Assert(owner != null);
Contract.Assert(caster != null || !casterGUID.IsEmpty());
Contract.Assert(effMask <= SpellConst.MaxEffectMask);
Cypher.Assert(effMask != 0);
Cypher.Assert(spellproto != null);
Cypher.Assert(owner != null);
Cypher.Assert(caster != null || !casterGUID.IsEmpty());
Cypher.Assert(effMask <= SpellConst.MaxEffectMask);
// try to get caster of aura
if (!casterGUID.IsEmpty())
{
@@ -2447,7 +2446,7 @@ namespace Game.Spells
aura = new DynObjAura(spellproto, castId, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemGuid, castItemLevel);
break;
default:
Contract.Assert(false);
Cypher.Assert(false);
return null;
}
// aura can be removed in Unit:_AddAura call
@@ -2613,9 +2612,9 @@ namespace Game.Spells
: base(spellproto, castId, owner, caster, castItem, casterGUID, castItemGuid, castItemLevel)
{
LoadScripts();
Contract.Assert(GetDynobjOwner() != null);
Contract.Assert(GetDynobjOwner().IsInWorld);
Contract.Assert(GetDynobjOwner().GetMap() == caster.GetMap());
Cypher.Assert(GetDynobjOwner() != null);
Cypher.Assert(GetDynobjOwner().IsInWorld);
Cypher.Assert(GetDynobjOwner().GetMap() == caster.GetMap());
_InitEffects(effMask, caster, baseAmount);
GetDynobjOwner().SetAura(this);
+3 -4
View File
@@ -26,7 +26,6 @@ using Game.Maps;
using Game.Network.Packets;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
namespace Game.Spells
@@ -305,7 +304,7 @@ namespace Game.Spells
public void HandleEffect(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
// check if call is correct, we really don't want using bitmasks here (with 1 exception)
Contract.Assert(mode == AuraEffectHandleModes.Real || mode == AuraEffectHandleModes.SendForClient
Cypher.Assert(mode == AuraEffectHandleModes.Real || mode == AuraEffectHandleModes.SendForClient
|| mode == AuraEffectHandleModes.ChangeAmount || mode == AuraEffectHandleModes.Stat
|| mode == AuraEffectHandleModes.Skill || mode == AuraEffectHandleModes.Reapply
|| mode == (AuraEffectHandleModes.ChangeAmount | AuraEffectHandleModes.Reapply));
@@ -345,7 +344,7 @@ namespace Game.Spells
public void HandleEffect(Unit target, AuraEffectHandleModes mode, bool apply)
{
AuraApplication aurApp = GetBase().GetApplicationOfTarget(target.GetGUID());
Contract.Assert(aurApp != null);
Cypher.Assert(aurApp != null);
HandleEffect(aurApp, mode, apply);
}
@@ -578,7 +577,7 @@ namespace Game.Spells
bool CanPeriodicTickCrit(Unit caster)
{
Contract.Assert(caster);
Cypher.Assert(caster);
return caster.HasAuraTypeWithAffectMask(AuraType.AbilityPeriodicCrit, m_spellInfo);
}
+20 -20
View File
@@ -29,7 +29,6 @@ using Game.Network.Packets;
using Game.Scripting;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Runtime.InteropServices;
using Game.AI;
@@ -124,7 +123,7 @@ namespace Game.Spells
}
if (m_caster && m_caster.GetTypeId() == TypeId.Player)
Contract.Assert(m_caster.ToPlayer().m_spellModTakingSpell != this);
Cypher.Assert(m_caster.ToPlayer().m_spellModTakingSpell != this);
}
void InitExplicitTargets(SpellCastTargets targets)
@@ -282,8 +281,9 @@ namespace Game.Spells
else if (m_auraScaleMask != 0)
{
bool checkLvl = !m_UniqueTargetInfo.Empty();
foreach (var ihit in m_UniqueTargetInfo)
for (var i = 0; i < m_UniqueTargetInfo.Count; ++i)
{
var ihit = m_UniqueTargetInfo[i];
// remove targets which did not pass min level check
if (m_auraScaleMask != 0 && ihit.effectMask == m_auraScaleMask)
{
@@ -388,7 +388,7 @@ namespace Game.Spells
m_targets.SetSrc(m_caster);
break;
default:
Contract.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_SRC");
Cypher.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_SRC");
break;
}
break;
@@ -405,7 +405,7 @@ namespace Game.Spells
SelectImplicitDestDestTargets(effIndex, targetType);
break;
default:
Contract.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_DEST");
Cypher.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_DEST");
break;
}
break;
@@ -419,7 +419,7 @@ namespace Game.Spells
SelectImplicitTargetObjectTargets(effIndex, targetType);
break;
default:
Contract.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT");
Cypher.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT");
break;
}
break;
@@ -429,7 +429,7 @@ namespace Game.Spells
Log.outDebug(LogFilter.Spells, "SPELL: target type {0}, found in spellID {1}, effect {2} is not implemented yet!", m_spellInfo.Id, effIndex, targetType.GetTarget());
break;
default:
Contract.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target category");
Cypher.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target category");
break;
}
}
@@ -438,7 +438,7 @@ namespace Game.Spells
{
if (targetType.GetReferenceType() != SpellTargetReferenceTypes.Caster)
{
Contract.Assert(false, "Spell.SelectImplicitChannelTargets: received not implemented target reference type");
Cypher.Assert(false, "Spell.SelectImplicitChannelTargets: received not implemented target reference type");
return;
}
@@ -498,7 +498,7 @@ namespace Game.Spells
break;
}
default:
Contract.Assert(false, "Spell.SelectImplicitChannelTargets: received not implemented target type");
Cypher.Assert(false, "Spell.SelectImplicitChannelTargets: received not implemented target type");
break;
}
}
@@ -507,7 +507,7 @@ namespace Game.Spells
{
if (targetType.GetReferenceType() != SpellTargetReferenceTypes.Caster)
{
Contract.Assert(false, "Spell.SelectImplicitNearbyTargets: received not implemented target reference type");
Cypher.Assert(false, "Spell.SelectImplicitNearbyTargets: received not implemented target reference type");
return;
}
@@ -532,7 +532,7 @@ namespace Game.Spells
range = m_spellInfo.GetMaxRange(m_spellInfo.IsPositive(), m_caster, this);
break;
default:
Contract.Assert(false, "Spell.SelectImplicitNearbyTargets: received not implemented selection check type");
Cypher.Assert(false, "Spell.SelectImplicitNearbyTargets: received not implemented selection check type");
break;
}
@@ -629,7 +629,7 @@ namespace Game.Spells
m_targets.SetDst(dest);
break;
default:
Contract.Assert(false, "Spell.SelectImplicitNearbyTargets: received not implemented target object type");
Cypher.Assert(false, "Spell.SelectImplicitNearbyTargets: received not implemented target object type");
break;
}
@@ -640,7 +640,7 @@ namespace Game.Spells
{
if (targetType.GetReferenceType() != SpellTargetReferenceTypes.Caster)
{
Contract.Assert(false, "Spell.SelectImplicitConeTargets: received not implemented target reference type");
Cypher.Assert(false, "Spell.SelectImplicitConeTargets: received not implemented target reference type");
return;
}
List<WorldObject> targets = new List<WorldObject>();
@@ -709,7 +709,7 @@ namespace Game.Spells
break;
}
default:
Contract.Assert(false, "Spell.SelectImplicitAreaTargets: received not implemented target reference type");
Cypher.Assert(false, "Spell.SelectImplicitAreaTargets: received not implemented target reference type");
return;
}
if (referer == null)
@@ -730,7 +730,7 @@ namespace Game.Spells
center = referer.GetPosition();
break;
default:
Contract.Assert(false, "Spell.SelectImplicitAreaTargets: received not implemented target reference type");
Cypher.Assert(false, "Spell.SelectImplicitAreaTargets: received not implemented target reference type");
return;
}
List<WorldObject> targets = new List<WorldObject>();
@@ -2182,7 +2182,7 @@ namespace Game.Spells
if (scaleAura)
{
aurSpellInfo = m_spellInfo.GetAuraRankForLevel(unitTarget.getLevel());
Contract.Assert(aurSpellInfo != null);
Cypher.Assert(aurSpellInfo != null);
foreach (SpellEffectInfo effect in aurSpellInfo.GetEffectsForDifficulty(0))
{
if (effect == null)
@@ -3507,7 +3507,7 @@ namespace Game.Spells
}
case SpellCastResult.CantUntalent:
{
Contract.Assert(param1.HasValue);
Cypher.Assert(param1.HasValue);
packet.FailedArg1 = (int)param1;
break;
}
@@ -6844,7 +6844,7 @@ namespace Game.Spells
hookType = SpellScriptHookType.EffectHitTarget;
break;
default:
Contract.Assert(false);
Cypher.Assert(false);
return false;
}
script._PrepareScriptCall(hookType);
@@ -7528,7 +7528,7 @@ namespace Game.Spells
public SpellValue(Difficulty difficulty, SpellInfo proto)
{
var effects = proto.GetEffectsForDifficulty(difficulty);
Contract.Assert(effects.Length <= SpellConst.MaxEffects);
Cypher.Assert(effects.Length <= SpellConst.MaxEffects);
foreach (SpellEffectInfo effect in effects)
if (effect != null)
EffectBasePoints[effect.EffectIndex] = effect.BasePoints;
@@ -7795,7 +7795,7 @@ namespace Game.Spells
if (!m_Spell.m_targets.HasDst())
{
ulong n_offset = m_Spell.handle_delayed(0);
Contract.Assert(n_offset == m_Spell.GetDelayMoment());
Cypher.Assert(n_offset == m_Spell.GetDelayMoment());
}
// re-plan the event for the delay moment
m_Spell.GetCaster().m_Events.AddEvent(this, e_time + m_Spell.GetDelayMoment(), false);
+3 -4
View File
@@ -19,7 +19,6 @@ using Framework.Constants;
using Game.Entities;
using Game.Network.Packets;
using System;
using System.Diagnostics.Contracts;
namespace Game.Spells
{
@@ -280,7 +279,7 @@ namespace Game.Spells
public void ModSrc(Position pos)
{
Contract.Assert(m_targetMask.HasAnyFlag(SpellCastTargetFlags.SourceLocation));
Cypher.Assert(m_targetMask.HasAnyFlag(SpellCastTargetFlags.SourceLocation));
m_src.Relocate(pos);
}
@@ -331,13 +330,13 @@ namespace Game.Spells
public void ModDst(Position pos)
{
Contract.Assert(m_targetMask.HasAnyFlag(SpellCastTargetFlags.DestLocation));
Cypher.Assert(m_targetMask.HasAnyFlag(SpellCastTargetFlags.DestLocation));
m_dst.Relocate(pos);
}
public void ModDst(SpellDestination spellDest)
{
Contract.Assert(m_targetMask.HasAnyFlag(SpellCastTargetFlags.DestLocation));
Cypher.Assert(m_targetMask.HasAnyFlag(SpellCastTargetFlags.DestLocation));
m_dst = spellDest;
}
+4 -5
View File
@@ -32,7 +32,6 @@ using Game.Movement;
using Game.Network.Packets;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
namespace Game.Spells
@@ -770,7 +769,7 @@ namespace Game.Spells
if (m_spellAura == null || unitTarget == null)
return;
Contract.Assert(unitTarget == m_spellAura.GetOwner());
Cypher.Assert(unitTarget == m_spellAura.GetOwner());
m_spellAura._ApplyEffectForTargets(effIndex);
}
@@ -787,7 +786,7 @@ namespace Game.Spells
if (m_spellAura == null || unitTarget == null)
return;
Contract.Assert(unitTarget == m_spellAura.GetOwner());
Cypher.Assert(unitTarget == m_spellAura.GetOwner());
m_spellAura._ApplyEffectForTargets(effIndex);
}
@@ -1253,7 +1252,7 @@ namespace Game.Spells
return;
}
Contract.Assert(m_spellAura.GetDynobjOwner());
Cypher.Assert(m_spellAura.GetDynobjOwner());
m_spellAura._ApplyEffectForTargets(effIndex);
}
@@ -2436,7 +2435,7 @@ namespace Game.Spells
if (OldSummon.IsDead())
return;
Contract.Assert(OldSummon.GetMap() == owner.GetMap());
Cypher.Assert(OldSummon.GetMap() == owner.GetMap());
float px, py, pz;
owner.GetClosePoint(out px, out py, out pz, OldSummon.GetObjectSize());
+5 -5
View File
@@ -1956,11 +1956,11 @@ namespace Game.Entities
Dictionary<uint, MultiMap<uint, SpellXSpellVisualRecord>> visualsBySpell = new Dictionary<uint, MultiMap<uint, SpellXSpellVisualRecord>>();
foreach (var effect in CliDB.SpellEffectStorage.Values)
{
/*Contract.Assert(effect.EffectIndex < MAX_SPELL_EFFECTS, "MAX_SPELL_EFFECTS must be at least {0}", effect.EffectIndex);
Contract.Assert(effect.Effect < TOTAL_SPELL_EFFECTS, "TOTAL_SPELL_EFFECTS must be at least {0}", effect.Effect);
Contract.Assert(effect.EffectAura < TOTAL_AURAS, "TOTAL_AURAS must be at least {0}", effect.EffectAura);
Contract.Assert(effect.ImplicitTarget[0] < TOTAL_SPELL_TARGETS, "TOTAL_SPELL_TARGETS must be at least {0}", effect.ImplicitTarget[0]);
Contract.Assert(effect.ImplicitTarget[1] < TOTAL_SPELL_TARGETS, "TOTAL_SPELL_TARGETS must be at least {0}", effect.ImplicitTarget[1]);*/
Cypher.Assert(effect.EffectIndex < SpellConst.MaxEffects, $"MAX_SPELL_EFFECTS must be at least {effect.EffectIndex}");
Cypher.Assert(effect.Effect < (int)SpellEffectName.TotalSpellEffects, $"TOTAL_SPELL_EFFECTS must be at least {effect.Effect}");
Cypher.Assert(effect.EffectAura < (int)AuraType.Total, $"TOTAL_AURAS must be at least {effect.EffectAura}");
Cypher.Assert(effect.ImplicitTarget[0] < (int)Targets.TotalSpellTargets, $"TOTAL_SPELL_TARGETS must be at least {effect.ImplicitTarget[0]}");
Cypher.Assert(effect.ImplicitTarget[1] < (int)Targets.TotalSpellTargets, $"TOTAL_SPELL_TARGETS must be at least {effect.ImplicitTarget[1]}");
if (!effectsBySpell.ContainsKey(effect.SpellID))
effectsBySpell[effect.SpellID] = new Dictionary<uint, SpellEffectRecord[]>();