Core: SOme code cleanup, more to follow.

This commit is contained in:
hondacrx
2021-03-20 22:48:48 -04:00
parent 62f554f2e0
commit 62ec699ec6
318 changed files with 5080 additions and 5125 deletions
+12 -12
View File
@@ -248,11 +248,11 @@ namespace Game.Spells
{
_needClientUpdate = false;
AuraUpdate update = new AuraUpdate();
AuraUpdate update = new();
update.UpdateAll = false;
update.UnitGUID = GetTarget().GetGUID();
AuraInfo auraInfo = new AuraInfo();
AuraInfo auraInfo = new();
BuildUpdatePacket(ref auraInfo, remove);
update.Auras.Add(auraInfo);
@@ -439,11 +439,11 @@ namespace Game.Spells
// fill up to date target list
// target, effMask
Dictionary<Unit, uint> targets = new Dictionary<Unit, uint>();
Dictionary<Unit, uint> targets = new();
FillTargetMap(ref targets, caster);
List<Unit> targetsToRemove = new List<Unit>();
List<Unit> targetsToRemove = new();
// mark all auras as ready to remove
foreach (var app in m_applications)
@@ -576,7 +576,7 @@ namespace Game.Spells
public void _ApplyEffectForTargets(uint effIndex)
{
// prepare list of aura targets
List<Unit> targetList = new List<Unit>();
List<Unit> targetList = new();
foreach (var app in m_applications.Values)
{
if (Convert.ToBoolean(app.GetEffectsToApply() & (1 << (int)effIndex)) && !app.HasEffect(effIndex))
@@ -1035,7 +1035,7 @@ namespace Game.Spells
public AuraKey GenerateKey(out uint recalculateMask)
{
AuraKey key = new AuraKey(GetCasterGUID(), GetCastItemGUID(), GetId(), 0);
AuraKey key = new(GetCasterGUID(), GetCastItemGUID(), GetId(), 0);
recalculateMask = 0;
for (int i = 0; i < _effects.Length; ++i)
{
@@ -2499,7 +2499,7 @@ namespace Game.Spells
}
#region Fields
List<AuraScript> m_loadedScripts = new List<AuraScript>();
List<AuraScript> m_loadedScripts = new();
SpellInfo m_spellInfo;
Difficulty m_castDifficulty;
ObjectGuid m_castGuid;
@@ -2514,7 +2514,7 @@ namespace Game.Spells
int m_maxDuration; // Max aura duration
int m_duration; // Current time
int m_timeCla; // Timer for power per sec calcultion
List<SpellPowerRecord> m_periodicCosts = new List<SpellPowerRecord>();// Periodic costs
List<SpellPowerRecord> m_periodicCosts = new();// Periodic costs
int m_updateTargetMapInterval; // Timer for UpdateTargetMapOfEffect
uint m_casterLevel; // Aura level (store caster level for correct show level dep amount)
@@ -2523,7 +2523,7 @@ namespace Game.Spells
//might need to be arrays still
AuraEffect[] _effects;
Dictionary<ObjectGuid, AuraApplication> m_applications = new Dictionary<ObjectGuid, AuraApplication>();
Dictionary<ObjectGuid, AuraApplication> m_applications = new();
bool m_isRemoved;
bool m_isSingleTarget; // true if it's a single target spell and registered at caster - can change at spell steal for example
@@ -2535,7 +2535,7 @@ namespace Game.Spells
DateTime m_lastProcAttemptTime;
DateTime m_lastProcSuccessTime;
List<AuraApplication> m_removedApplications = new List<AuraApplication>();
List<AuraApplication> m_removedApplications = new();
#endregion
}
@@ -2580,7 +2580,7 @@ namespace Game.Spells
if (effect == null || !HasEffect(effect.EffectIndex))
continue;
List<Unit> targetList = new List<Unit>();
List<Unit> targetList = new();
// non-area aura
if (effect.Effect == SpellEffectName.ApplyAura)
{
@@ -2697,7 +2697,7 @@ namespace Game.Spells
if (effect == null || !HasEffect(effect.EffectIndex))
continue;
List<Unit> targetList = new List<Unit>();
List<Unit> targetList = new();
if (effect.TargetB.GetTarget() == Targets.DestDynobjAlly || effect.TargetB.GetTarget() == Targets.UnitDestAreaAlly)
{
var u_check = new AnyFriendlyUnitInObjectRangeCheck(GetDynobjOwner(), dynObjOwnerCaster, radius, GetSpellInfo().HasAttribute(SpellAttr3.OnlyTargetPlayers), false, true);
+22 -22
View File
@@ -1582,7 +1582,7 @@ namespace Game.Spells
if (apply)
{
List<Unit> targets = new List<Unit>();
List<Unit> targets = new();
var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(target, target, target.GetMap().GetVisibilityRange());
var searcher = new UnitListSearcher(target, targets, u_check);
@@ -4001,7 +4001,7 @@ namespace Game.Spells
if (!target.IsTypeId(TypeId.Player))
return;
FlagArray128 mask = new FlagArray128();
FlagArray128 mask = new();
var noReagent = target.GetAuraEffectsByType(AuraType.NoReagentUse);
foreach (var eff in noReagent)
{
@@ -4395,7 +4395,7 @@ namespace Game.Spells
uint noSpaceForCount;
uint count = (uint)m_amount;
List<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> dest = new();
InventoryResult msg = plCaster.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, GetSpellEffectInfo().ItemType, count, out noSpaceForCount);
if (msg != InventoryResult.Ok)
{
@@ -4840,7 +4840,7 @@ namespace Game.Spells
caster.SpellHitResult(target, GetSpellInfo(), false) != SpellMissInfo.None)
return;
CleanDamage cleanDamage = new CleanDamage(0, 0, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal);
CleanDamage cleanDamage = new(0, 0, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal);
// AOE spells are not affected by the new periodic system.
bool isAreaAura = GetSpellEffectInfo().IsAreaAuraEffect() || GetSpellEffectInfo().IsEffect(SpellEffectName.PersistentAreaAura);
@@ -4928,7 +4928,7 @@ namespace Game.Spells
caster.ApplyResilience(target, ref dmg);
damage = dmg;
DamageInfo damageInfo = new DamageInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo().GetSchoolMask(), DamageEffectType.DOT, WeaponAttackType.BaseAttack);
DamageInfo damageInfo = new(caster, target, damage, GetSpellInfo(), GetSpellInfo().GetSchoolMask(), DamageEffectType.DOT, WeaponAttackType.BaseAttack);
caster.CalcAbsorbResist(damageInfo);
damage = damageInfo.GetDamage();
@@ -4951,7 +4951,7 @@ namespace Game.Spells
if (overkill < 0)
overkill = 0;
SpellPeriodicAuraLogInfo pInfo = new SpellPeriodicAuraLogInfo(this, damage, dmg, (uint)overkill, absorb, resist, 0.0f, crit);
SpellPeriodicAuraLogInfo pInfo = new(this, damage, dmg, (uint)overkill, absorb, resist, 0.0f, crit);
caster.DealDamage(target, damage, cleanDamage, DamageEffectType.DOT, GetSpellInfo().GetSchoolMask(), GetSpellInfo(), true);
@@ -4974,7 +4974,7 @@ namespace Game.Spells
caster.SpellHitResult(target, GetSpellInfo(), false) != SpellMissInfo.None)
return;
CleanDamage cleanDamage = new CleanDamage(0, 0, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal);
CleanDamage cleanDamage = new(0, 0, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal);
bool isAreaAura = GetSpellEffectInfo().IsAreaAuraEffect() || GetSpellEffectInfo().IsEffect(SpellEffectName.PersistentAreaAura);
// ignore negative values (can be result apply spellmods to aura damage
@@ -5015,14 +5015,14 @@ namespace Game.Spells
caster.ApplyResilience(target, ref dmg);
damage = dmg;
DamageInfo damageInfo = new DamageInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo().GetSchoolMask(), DamageEffectType.DOT, WeaponAttackType.BaseAttack);
DamageInfo damageInfo = new(caster, target, damage, GetSpellInfo(), GetSpellInfo().GetSchoolMask(), DamageEffectType.DOT, WeaponAttackType.BaseAttack);
caster.CalcAbsorbResist(damageInfo);
uint absorb = damageInfo.GetAbsorb();
uint resist = damageInfo.GetResist();
// SendSpellNonMeleeDamageLog expects non-absorbed/non-resisted damage
SpellNonMeleeDamage log = new SpellNonMeleeDamage(caster, target, GetSpellInfo(), GetBase().GetSpellVisual(), GetSpellInfo().GetSchoolMask(), GetBase().GetCastGUID());
SpellNonMeleeDamage log = new(caster, target, GetSpellInfo(), GetBase().GetSpellVisual(), GetSpellInfo().GetSchoolMask(), GetBase().GetCastGUID());
log.damage = damage;
log.originalDamage = dmg;
log.absorb = absorb;
@@ -5052,7 +5052,7 @@ namespace Game.Spells
uint heal = (caster.SpellHealingBonusDone(caster, GetSpellInfo(), (uint)(new_damage * gainMultiplier), DamageEffectType.DOT, GetSpellEffectInfo(), GetBase().GetStackAmount()));
heal = (caster.SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DamageEffectType.DOT, GetSpellEffectInfo(), GetBase().GetStackAmount()));
HealInfo healInfo = new HealInfo(caster, caster, heal, GetSpellInfo(), GetSpellInfo().GetSchoolMask());
HealInfo healInfo = new(caster, caster, heal, GetSpellInfo(), GetSpellInfo().GetSchoolMask());
caster.HealBySpell(healInfo);
caster.GetThreatManager().ForwardThreatForAssistingMe(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
@@ -5087,7 +5087,7 @@ namespace Game.Spells
damage = (uint)(damage * gainMultiplier);
HealInfo healInfo = new HealInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo().GetSchoolMask());
HealInfo healInfo = new(caster, target, damage, GetSpellInfo(), GetSpellInfo().GetSchoolMask());
caster.HealBySpell(healInfo);
caster.ProcSkillsAndAuras(target, ProcFlags.DonePeriodic, ProcFlags.TakenPeriodic, ProcFlagsSpellType.Heal, ProcFlagsSpellPhase.None, ProcFlagsHit.Normal, null, null, healInfo);
}
@@ -5155,11 +5155,11 @@ namespace Game.Spells
uint heal = (uint)damage;
HealInfo healInfo = new HealInfo(caster, target, heal, GetSpellInfo(), GetSpellInfo().GetSchoolMask());
HealInfo healInfo = new(caster, target, heal, GetSpellInfo(), GetSpellInfo().GetSchoolMask());
caster.CalcHealAbsorb(healInfo);
caster.DealHeal(healInfo);
SpellPeriodicAuraLogInfo pInfo = new SpellPeriodicAuraLogInfo(this, heal, (uint)damage, heal - healInfo.GetEffectiveHeal(), healInfo.GetAbsorb(), 0, 0.0f, crit);
SpellPeriodicAuraLogInfo pInfo = new(this, heal, (uint)damage, heal - healInfo.GetEffectiveHeal(), healInfo.GetAbsorb(), 0, 0.0f, crit);
target.SendPeriodicAuraLog(pInfo);
target.GetThreatManager().ForwardThreatForAssistingMe(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
@@ -5199,7 +5199,7 @@ namespace Game.Spells
int drainedAmount = -target.ModifyPower(powerType, -drainAmount);
float gainMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
SpellPeriodicAuraLogInfo pInfo = new SpellPeriodicAuraLogInfo(this, (uint)drainedAmount, (uint)drainAmount, 0, 0, 0, gainMultiplier, false);
SpellPeriodicAuraLogInfo pInfo = new(this, (uint)drainedAmount, (uint)drainAmount, 0, 0, 0, gainMultiplier, false);
int gainAmount = (int)(drainedAmount * gainMultiplier);
int gainedAmount = 0;
@@ -5252,7 +5252,7 @@ namespace Game.Spells
// ignore negative values (can be result apply spellmods to aura damage
int amount = Math.Max(m_amount, 0) * target.GetMaxPower(powerType) / 100;
SpellPeriodicAuraLogInfo pInfo = new SpellPeriodicAuraLogInfo(this, (uint)amount, (uint)amount, 0, 0, 0, 0.0f, false);
SpellPeriodicAuraLogInfo pInfo = new(this, (uint)amount, (uint)amount, 0, 0, 0, 0.0f, false);
int gain = target.ModifyPower(powerType, amount);
@@ -5281,7 +5281,7 @@ namespace Game.Spells
// ignore negative values (can be result apply spellmods to aura damage
int amount = Math.Max(m_amount, 0);
SpellPeriodicAuraLogInfo pInfo = new SpellPeriodicAuraLogInfo(this, (uint)amount, (uint)amount, 0, 0, 0, 0.0f, false);
SpellPeriodicAuraLogInfo pInfo = new(this, (uint)amount, (uint)amount, 0, 0, 0, 0.0f, false);
int gain = target.ModifyPower(powerType, amount);
if (caster != null)
@@ -5312,7 +5312,7 @@ namespace Game.Spells
SpellInfo spellProto = GetSpellInfo();
// maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, target, spellProto, GetBase().GetSpellVisual(), spellProto.SchoolMask, GetBase().GetCastGUID());
SpellNonMeleeDamage damageInfo = new(caster, target, spellProto, GetBase().GetSpellVisual(), spellProto.SchoolMask, GetBase().GetCastGUID());
// no SpellDamageBonus for burn mana
caster.CalculateSpellDamageTaken(damageInfo, (int)(gain * dmgMultiplier), spellProto);
@@ -5331,7 +5331,7 @@ namespace Game.Spells
caster.DealSpellDamage(damageInfo, true);
DamageInfo dotDamageInfo = new DamageInfo(damageInfo, DamageEffectType.DOT, WeaponAttackType.BaseAttack, hitMask);
DamageInfo dotDamageInfo = new(damageInfo, DamageEffectType.DOT, WeaponAttackType.BaseAttack, hitMask);
caster.ProcSkillsAndAuras(target, procAttacker, procVictim, spellTypeMask, ProcFlagsSpellPhase.None, hitMask, null, dotDamageInfo, null);
caster.SendSpellNonMeleeDamageLog(damageInfo);
@@ -5390,7 +5390,7 @@ namespace Game.Spells
return;
}
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(target, triggerTarget, GetSpellInfo(), GetBase().GetSpellVisual(), GetSpellInfo().SchoolMask, GetBase().GetCastGUID());
SpellNonMeleeDamage damageInfo = new(target, triggerTarget, GetSpellInfo(), GetBase().GetSpellVisual(), GetSpellInfo().SchoolMask, GetBase().GetCastGUID());
int damage = (int)target.SpellDamageBonusDone(triggerTarget, GetSpellInfo(), (uint)GetAmount(), DamageEffectType.SpellDirect, GetSpellEffectInfo());
damage = (int)triggerTarget.SpellDamageBonusTaken(target, GetSpellInfo(), (uint)damage, DamageEffectType.SpellDirect, GetSpellEffectInfo());
target.CalculateSpellDamageTaken(damageInfo, damage, GetSpellInfo());
@@ -5574,7 +5574,7 @@ namespace Game.Spells
// on unapply we need to search for and remove the summoned creature
else
{
List<uint> summonedEntries = new List<uint>();
List<uint> summonedEntries = new();
foreach (var spellEffect in triggerSpellInfo.GetEffects())
{
if (spellEffect != null && spellEffect.Effect == SpellEffectName.Summon)
@@ -5590,7 +5590,7 @@ namespace Game.Spells
// most of the spells have multiple effects with the same summon spell id for multiple spawns, so right now it's safe to assume there's only 1 spawn per effect
foreach (uint summonEntry in summonedEntries)
{
List<Creature> nearbyEntries = new List<Creature>();
List<Creature> nearbyEntries = new();
target.GetCreatureListWithEntryInGrid(nearbyEntries, summonEntry);
foreach (var creature in nearbyEntries)
{
@@ -5671,7 +5671,7 @@ namespace Game.Spells
if (apply)
{
BattlegroundPlayerPosition playerPosition = new BattlegroundPlayerPosition();
BattlegroundPlayerPosition playerPosition = new();
playerPosition.Guid = target.GetGUID();
playerPosition.ArenaSlot = (sbyte)GetMiscValue();
playerPosition.Pos = target.GetPosition();
+3 -3
View File
@@ -44,8 +44,8 @@ namespace Game.Spells
uint count = 0;
StringBuilder ssNonDiscoverableEntries = new StringBuilder();
List<uint> reportedReqSpells = new List<uint>();
StringBuilder ssNonDiscoverableEntries = new();
List<uint> reportedReqSpells = new();
do
{
@@ -226,7 +226,7 @@ namespace Game.Spells
return 0;
}
static MultiMap<int, SkillDiscoveryEntry> SkillDiscoveryStorage = new MultiMap<int, SkillDiscoveryEntry>();
static MultiMap<int, SkillDiscoveryEntry> SkillDiscoveryStorage = new();
}
public class SkillDiscoveryEntry
+3 -3
View File
@@ -71,7 +71,7 @@ namespace Game.Spells
continue;
}
SkillExtraItemEntry skillExtraItemEntry = new SkillExtraItemEntry();
SkillExtraItemEntry skillExtraItemEntry = new();
skillExtraItemEntry.requiredSpecialization = requiredSpecialization;
skillExtraItemEntry.additionalCreateChance = additionalCreateChance;
skillExtraItemEntry.additionalMaxNum = additionalMaxNum;
@@ -103,7 +103,7 @@ namespace Game.Spells
return true;
}
static Dictionary<uint, SkillExtraItemEntry> SkillExtraItemStorage = new Dictionary<uint,SkillExtraItemEntry>();
static Dictionary<uint, SkillExtraItemEntry> SkillExtraItemStorage = new();
}
class SkillExtraItemEntry
@@ -199,7 +199,7 @@ namespace Game.Spells
return true;
}
static Dictionary<uint, SkillPerfectItemEntry> SkillPerfectItemStorage = new Dictionary<uint, SkillPerfectItemEntry>();
static Dictionary<uint, SkillPerfectItemEntry> SkillPerfectItemStorage = new();
}
// struct to store information about perfection procs
+51 -51
View File
@@ -489,7 +489,7 @@ namespace Game.Spells
CallScriptObjectTargetSelectHandlers(ref target, effIndex, targetType);
if (target)
{
SpellDestination dest = new SpellDestination(target);
SpellDestination dest = new(target);
CallScriptDestinationTargetSelectHandlers(ref dest, effIndex, targetType);
m_targets.SetDst(dest);
}
@@ -501,7 +501,7 @@ namespace Game.Spells
}
case Targets.DestChannelCaster:
{
SpellDestination dest = new SpellDestination(channeledSpell.GetCaster());
SpellDestination dest = new(channeledSpell.GetCaster());
CallScriptDestinationTargetSelectHandlers(ref dest, effIndex, targetType);
m_targets.SetDst(dest);
break;
@@ -571,7 +571,7 @@ namespace Game.Spells
{
if (focusObject != null)
{
SpellDestination dest = new SpellDestination(focusObject);
SpellDestination dest = new(focusObject);
CallScriptDestinationTargetSelectHandlers(ref dest, effIndex, targetType);
m_targets.SetDst(dest);
}
@@ -633,7 +633,7 @@ namespace Game.Spells
}
break;
case SpellTargetObjectTypes.Dest:
SpellDestination dest = new SpellDestination(target);
SpellDestination dest = new(target);
CallScriptDestinationTargetSelectHandlers(ref dest, effIndex, targetType);
m_targets.SetDst(dest);
break;
@@ -652,7 +652,7 @@ namespace Game.Spells
Cypher.Assert(false, "Spell.SelectImplicitConeTargets: received not implemented target reference type");
return;
}
List<WorldObject> targets = new List<WorldObject>();
List<WorldObject> targets = new();
SpellTargetObjectTypes objectType = targetType.GetObjectType();
SpellTargetCheckTypes selectionType = targetType.GetCheckType();
SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
@@ -742,7 +742,7 @@ namespace Game.Spells
Cypher.Assert(false, "Spell.SelectImplicitAreaTargets: received not implemented target reference type");
return;
}
List<WorldObject> targets = new List<WorldObject>();
List<WorldObject> targets = new();
SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect == null)
return;
@@ -820,7 +820,7 @@ namespace Game.Spells
void SelectImplicitCasterDestTargets(uint effIndex, SpellImplicitTargetInfo targetType)
{
SpellDestination dest = new SpellDestination(m_caster);
SpellDestination dest = new(m_caster);
switch (targetType.GetTarget())
{
@@ -944,7 +944,7 @@ namespace Game.Spells
{
WorldObject target = m_targets.GetObjectTarget();
SpellDestination dest = new SpellDestination(target);
SpellDestination dest = new(target);
switch (targetType.GetTarget())
{
@@ -1099,7 +1099,7 @@ namespace Game.Spells
m_damageMultipliers[eff.EffectIndex] = 1.0f;
m_applyMultiplierMask |= effMask;
List<WorldObject> targets = new List<WorldObject>();
List<WorldObject> targets = new();
SearchChainTargets(targets, (uint)maxTargets - 1, target, targetType.GetObjectType(), targetType.GetCheckType(), effect.ImplicitTargetConditions, targetType.GetTarget() == Targets.UnitChainhealAlly);
// Chain primary target is added earlier
@@ -1137,7 +1137,7 @@ namespace Game.Spells
float srcToDestDelta = m_targets.GetDstPos().posZ - srcPos.posZ;
SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
List<WorldObject> targets = new List<WorldObject>();
List<WorldObject> targets = new();
var spellTraj = new WorldObjectSpellTrajTargetCheck(dist2d, srcPos, m_caster, m_spellInfo, targetType.GetCheckType(), effect.ImplicitTargetConditions, SpellTargetObjectTypes.None);
var searcher = new WorldObjectListSearcher(m_caster, targets, spellTraj);
SearchTargets(searcher, GridMapTypeMask.All, m_caster, srcPos, dist2d);
@@ -1203,7 +1203,7 @@ namespace Game.Spells
float y = (float)(m_targets.GetSrcPos().posY + Math.Sin(m_caster.GetOrientation()) * bestDist);
float z = m_targets.GetSrcPos().posZ + bestDist * (a * bestDist + b);
SpellDestination dest = new SpellDestination(x, y, z, m_caster.GetOrientation());
SpellDestination dest = new(x, y, z, m_caster.GetOrientation());
CallScriptDestinationTargetSelectHandlers(ref dest, effIndex, targetType);
m_targets.ModDst(dest);
}
@@ -1350,7 +1350,7 @@ namespace Game.Spells
float y = pos.GetPositionY();
CellCoord p = GridDefines.ComputeCellCoord(x, y);
Cell cell = new Cell(p);
Cell cell = new(p);
cell.SetNoCreate();
Map map = referer.GetMap();
@@ -1423,7 +1423,7 @@ namespace Game.Spells
if (isBouncingFar)
searchRadius *= chainTargets;
List<WorldObject> tempTargets = new List<WorldObject>();
List<WorldObject> tempTargets = new();
SearchAreaTargets(tempTargets, searchRadius, target.GetPosition(), m_caster, objectType, selectType, condList);
tempTargets.Remove(target);
@@ -1603,7 +1603,7 @@ namespace Game.Spells
// This is new target calculate data for him
// Get spell hit result on target
TargetInfo targetInfo = new TargetInfo();
TargetInfo targetInfo = new();
targetInfo.targetGUID = targetGUID; // Store target GUID
targetInfo.effectMask = effectMask; // Store all effects not immune
targetInfo.processed = false; // Effects not apply on target
@@ -1690,7 +1690,7 @@ namespace Game.Spells
}
// This is new target calculate data for him
GOTargetInfo target = new GOTargetInfo();
GOTargetInfo target = new();
target.targetGUID = targetGUID;
target.effectMask = effectMask;
target.processed = false; // Effects not apply on target
@@ -1746,7 +1746,7 @@ namespace Game.Spells
// This is new target add data
ItemTargetInfo target = new ItemTargetInfo();
ItemTargetInfo target = new();
target.item = item;
target.effectMask = effectMask;
@@ -1937,7 +1937,7 @@ namespace Game.Spells
else
hitMask |= ProcFlagsHit.Normal;
HealInfo healInfo = new HealInfo(caster, unitTarget, addhealth, m_spellInfo, m_spellInfo.GetSchoolMask());
HealInfo healInfo = new(caster, unitTarget, addhealth, m_spellInfo, m_spellInfo.GetSchoolMask());
caster.HealBySpell(healInfo, crit);
unitTarget.GetThreatManager().ForwardThreatForAssistingMe(caster, healInfo.GetEffectiveHeal() * 0.5f, m_spellInfo);
m_healing = (int)healInfo.GetEffectiveHeal();
@@ -1950,7 +1950,7 @@ namespace Game.Spells
else if (m_damage > 0)
{
// Fill base damage struct (unitTarget - is real spell target)
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, unitTarget, m_spellInfo, m_SpellVisual, m_spellSchoolMask, m_castId);
SpellNonMeleeDamage damageInfo = new(caster, unitTarget, m_spellInfo, m_SpellVisual, m_spellSchoolMask, m_castId);
// Check damage immunity
if (unitTarget.IsImmunedToDamage(m_spellInfo))
@@ -1979,7 +1979,7 @@ namespace Game.Spells
// Do triggers for unit
if (canEffectTrigger)
{
DamageInfo spellDamageInfo = new DamageInfo(damageInfo, DamageEffectType.SpellDirect, m_attackType, hitMask);
DamageInfo spellDamageInfo = new(damageInfo, DamageEffectType.SpellDirect, m_attackType, hitMask);
caster.ProcSkillsAndAuras(unitTarget, procAttacker, procVictim, ProcFlagsSpellType.Damage, ProcFlagsSpellPhase.Hit, hitMask, this, spellDamageInfo, null);
if (caster.IsPlayer() && !m_spellInfo.HasAttribute(SpellAttr0.StopAttackTarget) &&
@@ -1991,12 +1991,12 @@ namespace Game.Spells
else
{
// Fill base damage struct (unitTarget - is real spell target)
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, unitTarget, m_spellInfo, m_SpellVisual, m_spellSchoolMask);
SpellNonMeleeDamage damageInfo = new(caster, unitTarget, m_spellInfo, m_SpellVisual, m_spellSchoolMask);
hitMask |= Unit.CreateProcHitMask(damageInfo, missInfo);
// Do triggers for unit
if (canEffectTrigger)
{
DamageInfo spellNoDamageInfo = new DamageInfo(damageInfo, DamageEffectType.NoDamage, m_attackType, hitMask);
DamageInfo spellNoDamageInfo = new(damageInfo, DamageEffectType.NoDamage, m_attackType, hitMask);
caster.ProcSkillsAndAuras(unitTarget, procAttacker, procVictim, ProcFlagsSpellType.NoDmgHeal, ProcFlagsSpellPhase.Hit, hitMask, this, spellNoDamageInfo, null);
if (caster.IsPlayer() && !m_spellInfo.HasAttribute(SpellAttr0.StopAttackTarget) &&
@@ -3520,7 +3520,7 @@ namespace Game.Spells
if (_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.DontReportCastError))
result = SpellCastResult.DontReport;
CastFailed castFailed = new CastFailed();
CastFailed castFailed = new();
castFailed.Visual = m_SpellVisual;
FillSpellCastFailedArgs(castFailed, m_castId, m_spellInfo, result, m_customError, param1, param2, m_caster.ToPlayer());
m_caster.ToPlayer().SendPacket(castFailed);
@@ -3538,7 +3538,7 @@ namespace Game.Spells
if (_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.DontReportCastError))
result = SpellCastResult.DontReport;
PetCastFailed petCastFailed = new PetCastFailed();
PetCastFailed petCastFailed = new();
FillSpellCastFailedArgs(petCastFailed, m_castId, m_spellInfo, result, SpellCustomErrors.None, param1, param2, owner.ToPlayer());
owner.ToPlayer().SendPacket(petCastFailed);
}
@@ -3548,7 +3548,7 @@ namespace Game.Spells
if (result == SpellCastResult.SpellCastOk)
return;
CastFailed packet = new CastFailed();
CastFailed packet = new();
packet.Visual = spellVisual;
FillSpellCastFailedArgs(packet, castCount, spellInfo, result, customError, param1, param2, caster);
caster.SendPacket(packet);
@@ -3566,7 +3566,7 @@ namespace Game.Spells
if (caster.IsLoading()) // don't send mount results at loading time
return;
MountResultPacket packet = new MountResultPacket();
MountResultPacket packet = new();
packet.Result = (uint)result;
caster.SendPacket(packet);
}
@@ -3594,7 +3594,7 @@ namespace Game.Spells
if (HasPowerTypeCost(PowerType.Runes))
castFlags |= SpellCastFlags.NoGCD; // not needed, but Blizzard sends it
SpellStart packet = new SpellStart();
SpellStart packet = new();
SpellCastData castData = packet.Cast;
if (m_CastItem)
@@ -3705,7 +3705,7 @@ namespace Game.Spells
if (m_spellInfo.StartRecoveryTime == 0)
castFlags |= SpellCastFlags.NoGCD;
SpellGo packet = new SpellGo();
SpellGo packet = new();
SpellCastData castData = packet.Cast;
if (m_CastItem != null)
@@ -3874,7 +3874,7 @@ namespace Game.Spells
void SendSpellExecuteLog()
{
SpellExecuteLog spellExecuteLog = new SpellExecuteLog();
SpellExecuteLog spellExecuteLog = new();
spellExecuteLog.Caster = m_caster.GetGUID();
spellExecuteLog.SpellID = m_spellInfo.Id;
@@ -3889,7 +3889,7 @@ namespace Game.Spells
_tradeSkillTargets[effect.EffectIndex].Empty() && _feedPetTargets[effect.EffectIndex].Empty())
continue;
SpellExecuteLog.SpellLogEffect spellLogEffect = new SpellExecuteLog.SpellLogEffect();
SpellExecuteLog.SpellLogEffect spellLogEffect = new();
spellLogEffect.Effect = (int)effect.Effect;
spellLogEffect.PowerDrainTargets = _powerDrainTargets[effect.EffectIndex];
spellLogEffect.ExtraAttacksTargets = _extraAttacksTargets[effect.EffectIndex];
@@ -3939,7 +3939,7 @@ namespace Game.Spells
void ExecuteLogEffectInterruptCast(uint effIndex, Unit victim, uint spellId)
{
SpellInterruptLog data = new SpellInterruptLog();
SpellInterruptLog data = new();
data.Caster = m_caster.GetGUID();
data.Victim = victim.GetGUID();
data.InterruptedSpellID = m_spellInfo.Id;
@@ -4008,7 +4008,7 @@ namespace Game.Spells
void SendInterrupted(byte result)
{
SpellFailure failurePacket = new SpellFailure();
SpellFailure failurePacket = new();
failurePacket.CasterUnit = m_caster.GetGUID();
failurePacket.CastID = m_castId;
failurePacket.SpellID = m_spellInfo.Id;
@@ -4016,7 +4016,7 @@ namespace Game.Spells
failurePacket.Reason = result;
m_caster.SendMessageToSet(failurePacket, true);
SpellFailedOther failedPacket = new SpellFailedOther();
SpellFailedOther failedPacket = new();
failedPacket.CasterUnit = m_caster.GetGUID();
failedPacket.CastID = m_castId;
failedPacket.SpellID = m_spellInfo.Id;
@@ -4034,7 +4034,7 @@ namespace Game.Spells
m_caster.SetChannelVisual(new SpellCastVisualField());
}
SpellChannelUpdate spellChannelUpdate = new SpellChannelUpdate();
SpellChannelUpdate spellChannelUpdate = new();
spellChannelUpdate.CasterGUID = m_caster.GetGUID();
spellChannelUpdate.TimeRemaining = (int)time;
m_caster.SendMessageToSet(spellChannelUpdate, true);
@@ -4042,7 +4042,7 @@ namespace Game.Spells
void SendChannelStart(uint duration)
{
SpellChannelStart spellChannelStart = new SpellChannelStart();
SpellChannelStart spellChannelStart = new();
spellChannelStart.CasterGUID = m_caster.GetGUID();
spellChannelStart.SpellID = (int)m_spellInfo.Id;
spellChannelStart.Visual = m_SpellVisual;
@@ -4089,7 +4089,7 @@ namespace Game.Spells
// for player resurrections the name is looked up by guid
string sentName = (m_caster.IsTypeId(TypeId.Player) ? "" : m_caster.GetName(target.GetSession().GetSessionDbLocaleIndex()));
ResurrectRequest resurrectRequest = new ResurrectRequest();
ResurrectRequest resurrectRequest = new();
resurrectRequest.ResurrectOffererGUID = m_caster.GetGUID();
resurrectRequest.ResurrectOffererVirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress();
@@ -4605,7 +4605,7 @@ namespace Game.Spells
// check spell cast conditions from database
{
ConditionSourceInfo condInfo = new ConditionSourceInfo(m_caster, m_targets.GetObjectTarget());
ConditionSourceInfo condInfo = new(m_caster, m_targets.GetObjectTarget());
if (!Global.ConditionMgr.IsObjectMeetingNotGroupedConditions(ConditionSourceType.Spell, m_spellInfo.Id, condInfo))
{
// mLastFailedCondition can be NULL if there was an error processing the condition in Condition.Meets (i.e. wrong data for ConditionTarget or others)
@@ -6108,7 +6108,7 @@ namespace Game.Spells
Unit target = m_targets.GetUnitTarget() ? m_targets.GetUnitTarget() : m_caster;
if (target != null && target.GetTypeId() == TypeId.Player && !IsTriggered() && effect.ItemType != 0)
{
List<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> dest = new();
InventoryResult msg = target.ToPlayer().CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, effect.ItemType, 1);
if (msg != InventoryResult.Ok)
{
@@ -6146,7 +6146,7 @@ namespace Game.Spells
// do not allow to enchant vellum from scroll made by vellum-prevent exploit
if (m_CastItem != null && Convert.ToBoolean(m_CastItem.GetTemplate().GetFlags() & ItemFlags.NoReagentCost))
return SpellCastResult.TotemCategory;
List<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> dest = new();
InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, effect.ItemType, 1);
if (msg != InventoryResult.Ok)
{
@@ -6451,7 +6451,7 @@ namespace Game.Spells
Log.outDebug(LogFilter.Spells, "Spell {0} partially interrupted for ({1}) ms at damage", m_spellInfo.Id, delaytime);
SpellDelayed spellDelayed = new SpellDelayed();
SpellDelayed spellDelayed = new();
spellDelayed.Caster = m_caster.GetGUID();
spellDelayed.ActualDelay = delaytime;
@@ -7274,7 +7274,7 @@ namespace Game.Spells
m_caster.GetSpellHistory().CancelGlobalCooldown(m_spellInfo);
}
List<SpellScript> m_loadedScripts = new List<SpellScript>();
List<SpellScript> m_loadedScripts = new();
int CalculateDamage(uint i, Unit target)
{
@@ -7401,12 +7401,12 @@ namespace Game.Spells
}
#region Fields
MultiMap<uint, SpellLogEffectPowerDrainParams> _powerDrainTargets = new MultiMap<uint, SpellLogEffectPowerDrainParams>();
MultiMap<uint, SpellLogEffectExtraAttacksParams> _extraAttacksTargets = new MultiMap<uint, SpellLogEffectExtraAttacksParams>();
MultiMap<uint, SpellLogEffectDurabilityDamageParams> _durabilityDamageTargets = new MultiMap<uint, SpellLogEffectDurabilityDamageParams>();
MultiMap<uint, SpellLogEffectGenericVictimParams> _genericVictimTargets = new MultiMap<uint, SpellLogEffectGenericVictimParams>();
MultiMap<uint, SpellLogEffectTradeSkillItemParams> _tradeSkillTargets = new MultiMap<uint, SpellLogEffectTradeSkillItemParams>();
MultiMap<uint, SpellLogEffectFeedPetParams> _feedPetTargets = new MultiMap<uint, SpellLogEffectFeedPetParams>();
MultiMap<uint, SpellLogEffectPowerDrainParams> _powerDrainTargets = new();
MultiMap<uint, SpellLogEffectExtraAttacksParams> _extraAttacksTargets = new();
MultiMap<uint, SpellLogEffectDurabilityDamageParams> _durabilityDamageTargets = new();
MultiMap<uint, SpellLogEffectGenericVictimParams> _genericVictimTargets = new();
MultiMap<uint, SpellLogEffectTradeSkillItemParams> _tradeSkillTargets = new();
MultiMap<uint, SpellLogEffectFeedPetParams> _feedPetTargets = new();
PathGenerator m_preGeneratedPath;
public SpellInfo m_spellInfo;
@@ -7436,7 +7436,7 @@ namespace Game.Spells
SpellSchoolMask m_spellSchoolMask; // Spell school (can be overwrite for some spells (wand shoot for example)
WeaponAttackType m_attackType; // For weapon based attack
List<SpellPowerCost> m_powerCost = new List<SpellPowerCost>();
List<SpellPowerCost> m_powerCost = new();
int m_casttime; // Calculated spell cast time initialized only in Spell.prepare
bool m_canReflect; // can reflect this spell?
bool m_autoRepeat;
@@ -7487,16 +7487,16 @@ namespace Game.Spells
// Spell target subsystem
// *****************************************
// Targets store structures and data
List<TargetInfo> m_UniqueTargetInfo = new List<TargetInfo>();
List<TargetInfo> m_UniqueTargetInfo = new();
uint m_channelTargetEffectMask; // Mask req. alive targets
List<GOTargetInfo> m_UniqueGOTargetInfo = new List<GOTargetInfo>();
List<GOTargetInfo> m_UniqueGOTargetInfo = new();
List<ItemTargetInfo> m_UniqueItemInfo = new List<ItemTargetInfo>();
List<ItemTargetInfo> m_UniqueItemInfo = new();
SpellDestination[] m_destTargets = new SpellDestination[SpellConst.MaxEffects];
List<HitTriggerSpell> m_hitTriggerSpells = new List<HitTriggerSpell>();
List<HitTriggerSpell> m_hitTriggerSpells = new();
SpellState m_spellState;
int m_timer;
+2 -2
View File
@@ -89,7 +89,7 @@ namespace Game.Spells
if (m_targetMask.HasAnyFlag(SpellCastTargetFlags.SourceLocation))
{
data.SrcLocation.HasValue = true;
TargetLocation target = new TargetLocation();
TargetLocation target = new();
target.Transport = m_src.TransportGUID; // relative position guid here - transport for example
if (!m_src.TransportGUID.IsEmpty())
target.Location = m_src.TransportOffset;
@@ -102,7 +102,7 @@ namespace Game.Spells
if (Convert.ToBoolean(m_targetMask & SpellCastTargetFlags.DestLocation))
{
data.DstLocation.HasValue = true;
TargetLocation target = new TargetLocation();
TargetLocation target = new();
target.Transport = m_dst.TransportGUID; // relative position guid here - transport for example
if (!m_dst.TransportGUID.IsEmpty())
target.Location = m_dst.TransportOffset;
+46 -46
View File
@@ -104,7 +104,7 @@ namespace Game.Spells
if (m_caster == unitTarget) // prevent interrupt message
Finish();
SpellInstakillLog data = new SpellInstakillLog();
SpellInstakillLog data = new();
data.Target = unitTarget.GetGUID();
data.Caster = m_caster.GetGUID();
data.SpellID = m_spellInfo.Id;
@@ -127,10 +127,10 @@ namespace Game.Spells
unitTarget.ToPlayer().EnvironmentalDamage(EnviromentalDamage.Fire, (uint)damage);
else
{
DamageInfo damageInfo = new DamageInfo(m_caster, unitTarget, (uint)damage, m_spellInfo, m_spellInfo.GetSchoolMask(), DamageEffectType.SpellDirect, WeaponAttackType.BaseAttack);
DamageInfo damageInfo = new(m_caster, unitTarget, (uint)damage, m_spellInfo, m_spellInfo.GetSchoolMask(), DamageEffectType.SpellDirect, WeaponAttackType.BaseAttack);
m_caster.CalcAbsorbResist(damageInfo);
SpellNonMeleeDamage log = new SpellNonMeleeDamage(m_caster, unitTarget, m_spellInfo, m_SpellVisual, m_spellInfo.GetSchoolMask(), m_castId);
SpellNonMeleeDamage log = new(m_caster, unitTarget, m_spellInfo, m_SpellVisual, m_spellInfo.GetSchoolMask(), m_castId);
log.damage = damageInfo.GetDamage();
log.originalDamage = (uint)damage;
log.absorb = damageInfo.GetAbsorb();
@@ -367,7 +367,7 @@ namespace Game.Spells
return;
}
SpellCastTargets targets = new SpellCastTargets();
SpellCastTargets targets = new();
if (effectHandleMode == SpellEffectHandleMode.LaunchTarget)
{
if (!spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo))
@@ -385,7 +385,7 @@ namespace Game.Spells
targets.SetUnitTarget(m_caster);
}
Dictionary<SpellValueMod, int> values = new Dictionary<SpellValueMod, int>();
Dictionary<SpellValueMod, int> values = new();
// set basepoints for trigger with value effect
if (effectInfo.Effect == SpellEffectName.TriggerSpellWithValue)
{
@@ -416,7 +416,7 @@ namespace Game.Spells
return;
}
SpellCastTargets targets = new SpellCastTargets();
SpellCastTargets targets = new();
if (effectHandleMode == SpellEffectHandleMode.HitTarget)
{
if (!spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo))
@@ -434,7 +434,7 @@ namespace Game.Spells
targets.SetUnitTarget(m_caster);
}
Dictionary<SpellValueMod, int> values = new Dictionary<SpellValueMod, int>();
Dictionary<SpellValueMod, int> values = new();
// set basepoints for trigger with value effect
if (effectInfo.Effect == SpellEffectName.TriggerMissileSpellWithValue)
{
@@ -484,7 +484,7 @@ namespace Game.Spells
}
}
Dictionary<SpellValueMod, int> values = new Dictionary<SpellValueMod, int>();
Dictionary<SpellValueMod, int> values = new();
// set basepoints for trigger with value effect
if (effectInfo.Effect == SpellEffectName.ForceCastWithValue)
{
@@ -494,7 +494,7 @@ namespace Game.Spells
values.Add(SpellValueMod.BasePoint2, damage);
}
SpellCastTargets targets = new SpellCastTargets();
SpellCastTargets targets = new();
targets.SetUnitTarget(m_caster);
unitTarget.CastSpell(targets, spellInfo, values, TriggerCastFlags.FullMask);
@@ -533,7 +533,7 @@ namespace Game.Spells
float speedXY, speedZ;
CalculateJumpSpeeds(effectInfo, m_caster.GetExactDist2d(unitTarget), out speedXY, out speedZ);
JumpArrivalCastArgs arrivalCast = new JumpArrivalCastArgs();
JumpArrivalCastArgs arrivalCast = new();
arrivalCast.SpellId = effectInfo.TriggerSpell;
arrivalCast.Target = unitTarget.GetGUID();
m_caster.GetMotionMaster().MoveJump(unitTarget, speedXY, speedZ, EventId.Jump, false, arrivalCast);
@@ -553,7 +553,7 @@ namespace Game.Spells
float speedXY, speedZ;
CalculateJumpSpeeds(effectInfo, m_caster.GetExactDist2d(destTarget), out speedXY, out speedZ);
JumpArrivalCastArgs arrivalCast = new JumpArrivalCastArgs();
JumpArrivalCastArgs arrivalCast = new();
arrivalCast.SpellId = effectInfo.TriggerSpell;
m_caster.GetMotionMaster().MoveJump(destTarget, speedXY, speedZ, EventId.Jump, !m_targets.GetObjectTargetGUID().IsEmpty(), arrivalCast);
}
@@ -990,7 +990,7 @@ namespace Game.Spells
healthGain = m_caster.SpellHealingBonusDone(m_caster, m_spellInfo, healthGain, DamageEffectType.Heal, effectInfo);
healthGain = m_caster.SpellHealingBonusTaken(m_caster, m_spellInfo, healthGain, DamageEffectType.Heal, effectInfo);
HealInfo healInfo = new HealInfo(m_caster, m_caster, healthGain, m_spellInfo, m_spellSchoolMask);
HealInfo healInfo = new(m_caster, m_caster, healthGain, m_spellInfo, m_spellSchoolMask);
m_caster.HealBySpell(healInfo);
}
}
@@ -1046,7 +1046,7 @@ namespace Game.Spells
num_to_add *= (uint)items_count;
// can the player store the new item?
List<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> dest = new();
uint no_space = 0;
InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, newitemid, num_to_add, out no_space);
if (msg != InventoryResult.Ok)
@@ -1172,7 +1172,7 @@ namespace Game.Spells
// Caster not in world, might be spell triggered from aura removal
if (!caster.IsInWorld)
return;
DynamicObject dynObj = new DynamicObject(false);
DynamicObject dynObj = new(false);
if (!dynObj.CreateDynamicObject(caster.GetMap().GenerateLowGuid(HighGuid.DynamicObject), caster, m_spellInfo, destTarget, radius, DynamicObjectType.AreaSpell, m_SpellVisual))
return;
@@ -1479,7 +1479,7 @@ namespace Game.Spells
if (player.IsInventoryPos(pos))
{
List<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> dest = new();
InventoryResult msg = player.CanStoreItem(m_CastItem.GetBagSlot(), m_CastItem.GetSlot(), dest, pNewItem, true);
if (msg == InventoryResult.Ok)
{
@@ -1502,7 +1502,7 @@ namespace Game.Spells
}
else if (Player.IsBankPos(pos))
{
List<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> dest = new();
InventoryResult msg = player.CanBankItem(m_CastItem.GetBagSlot(), m_CastItem.GetSlot(), dest, pNewItem, true);
if (msg == InventoryResult.Ok)
{
@@ -1804,9 +1804,9 @@ namespace Game.Spells
int remaining = dispelList.Count;
// Ok if exist some buffs for dispel try dispel it
List<DispelableAura> successList = new List<DispelableAura>();
List<DispelableAura> successList = new();
DispelFailed dispelFailed = new DispelFailed();
DispelFailed dispelFailed = new();
dispelFailed.CasterGUID = m_caster.GetGUID();
dispelFailed.VictimGUID = unitTarget.GetGUID();
dispelFailed.SpellID = m_spellInfo.Id;
@@ -1851,7 +1851,7 @@ namespace Game.Spells
if (successList.Empty())
return;
SpellDispellLog spellDispellLog = new SpellDispellLog();
SpellDispellLog spellDispellLog = new();
spellDispellLog.IsBreak = false; // TODO: use me
spellDispellLog.IsSteal = false;
@@ -1941,7 +1941,7 @@ namespace Game.Spells
if (!m_caster.IsInWorld)
return;
DynamicObject dynObj = new DynamicObject(true);
DynamicObject dynObj = new(true);
if (!dynObj.CreateDynamicObject(m_caster.GetMap().GenerateLowGuid(HighGuid.DynamicObject), m_caster, m_spellInfo, destTarget, radius, DynamicObjectType.FarsightFocus, m_SpellVisual))
return;
@@ -2734,7 +2734,7 @@ namespace Game.Spells
Map map = target.GetMap();
Position pos = new Position(x, y, z, target.GetOrientation());
Position pos = new(x, y, z, target.GetOrientation());
Quaternion rotation = Quaternion.fromEulerAnglesZYX(target.GetOrientation(), 0.0f, 0.0f);
GameObject go = GameObject.CreateGameObject((uint)effectInfo.MiscValue, map, pos, rotation, 255, GameObjectState.Ready);
if (!go)
@@ -3294,7 +3294,7 @@ namespace Game.Spells
//CREATE DUEL FLAG OBJECT
Map map = m_caster.GetMap();
Position pos = new Position()
Position pos = new()
{
posX = m_caster.GetPositionX() + (unitTarget.GetPositionX() - m_caster.GetPositionX()) / 2,
posY = m_caster.GetPositionY() + (unitTarget.GetPositionY() - m_caster.GetPositionY()) / 2,
@@ -3322,7 +3322,7 @@ namespace Game.Spells
//END
// Send request
DuelRequested packet = new DuelRequested();
DuelRequested packet = new();
packet.ArbiterGUID = go.GetGUID();
packet.RequestedByGUID = caster.GetGUID();
packet.RequestedByWowAccount = caster.GetSession().GetAccountGUID();
@@ -3331,7 +3331,7 @@ namespace Game.Spells
target.SendPacket(packet);
// create duel-info
DuelInfo duel = new DuelInfo();
DuelInfo duel = new();
duel.initiator = caster;
duel.opponent = target;
duel.startTime = 0;
@@ -3339,7 +3339,7 @@ namespace Game.Spells
duel.isMounted = (GetSpellInfo().Id == 62875); // Mounted Duel
caster.duel = duel;
DuelInfo duel2 = new DuelInfo();
DuelInfo duel2 = new();
duel2.initiator = caster;
duel2.opponent = caster;
duel2.startTime = 0;
@@ -3395,7 +3395,7 @@ namespace Game.Spells
if (spellInfo == null)
return;
Spell spell = new Spell(player, spellInfo, TriggerCastFlags.FullMask);
Spell spell = new(player, spellInfo, TriggerCastFlags.FullMask);
spell.SendSpellCooldown();
}
@@ -3421,7 +3421,7 @@ namespace Game.Spells
if (gameObjTarget == null)
return;
ScriptInfo activateCommand = new ScriptInfo();
ScriptInfo activateCommand = new();
activateCommand.command = ScriptCommands.ActivateObject;
// int unk = effectInfo.MiscValue; // This is set for EffectActivateObject spells; needs research
@@ -3467,7 +3467,7 @@ namespace Game.Spells
if (glyphProperties != null)
player.CastSpell(player, glyphProperties.SpellID, true);
ActiveGlyphs activeGlyphs = new ActiveGlyphs();
ActiveGlyphs activeGlyphs = new();
activeGlyphs.Glyphs.Add(new GlyphBinding(m_misc.SpellId, (ushort)glyphId));
activeGlyphs.IsFullUpdate = false;
player.SendPacket(activeGlyphs);
@@ -3641,7 +3641,7 @@ namespace Game.Spells
m_caster.GetClosePoint(out x, out y, out z, SharedConst.DefaultPlayerBoundingRadius);
Map map = m_caster.GetMap();
Position pos = new Position(x, y, z, m_caster.GetOrientation());
Position pos = new(x, y, z, m_caster.GetOrientation());
Quaternion rotation = Quaternion.fromEulerAnglesZYX(m_caster.GetOrientation(), 0.0f, 0.0f);
GameObject go = GameObject.CreateGameObject((uint)effectInfo.MiscValue, map, pos, rotation, 255, GameObjectState.Ready);
if (!go)
@@ -3799,19 +3799,19 @@ namespace Game.Spells
float dist = m_caster.GetVisibilityRange();
// clear focus
BreakTarget breakTarget = new BreakTarget();
BreakTarget breakTarget = new();
breakTarget.UnitGUID = m_caster.GetGUID();
MessageDistDelivererToHostile notifierBreak = new MessageDistDelivererToHostile(m_caster, breakTarget, dist);
MessageDistDelivererToHostile notifierBreak = new(m_caster, breakTarget, dist);
Cell.VisitWorldObjects(m_caster, notifierBreak, dist);
// and selection
ClearTarget clearTarget = new ClearTarget();
ClearTarget clearTarget = new();
clearTarget.Guid = m_caster.GetGUID();
MessageDistDelivererToHostile notifierClear = new MessageDistDelivererToHostile(m_caster, clearTarget, dist);
MessageDistDelivererToHostile notifierClear = new(m_caster, clearTarget, dist);
Cell.VisitWorldObjects(m_caster, notifierClear, dist);
// we should also force pets to remove us from current target
List<Unit> attackerSet = new List<Unit>();
List<Unit> attackerSet = new();
foreach (var unit in m_caster.GetAttackers())
if (unit.GetTypeId() == TypeId.Unit && !unit.CanHaveThreatList())
attackerSet.Add(unit);
@@ -4134,7 +4134,7 @@ namespace Game.Spells
if (!unitTarget)
return;
Position pos = new Position();
Position pos = new();
if (effectInfo.Effect == SpellEffectName.PullTowardsDest)
{
if (m_targets.HasDst())
@@ -4184,7 +4184,7 @@ namespace Game.Spells
int mechanic = effectInfo.MiscValue;
List<KeyValuePair<uint, ObjectGuid>> dispel_list = new List<KeyValuePair<uint, ObjectGuid>>();
List<KeyValuePair<uint, ObjectGuid>> dispel_list = new();
var auras = unitTarget.GetOwnedAuras();
foreach (var pair in auras)
@@ -4401,7 +4401,7 @@ namespace Game.Spells
if (goinfo.type == GameObjectTypes.Ritual)
m_caster.GetPosition(out fx, out fy, out fz);
Position pos = new Position(fx, fy, fz, m_caster.GetOrientation());
Position pos = new(fx, fy, fz, m_caster.GetOrientation());
Quaternion rotation = Quaternion.fromEulerAnglesZYX(m_caster.GetOrientation(), 0.0f, 0.0f);
GameObject go = GameObject.CreateGameObject(name_id, cMap, pos, rotation, 255, GameObjectState.Ready);
if (!go)
@@ -4573,7 +4573,7 @@ namespace Game.Spells
if (unitTarget == null || unitTarget == m_caster) // can't steal from self
return;
List<DispelableAura> stealList = new List<DispelableAura>();
List<DispelableAura> stealList = new();
// Create dispel mask by dispel type
uint dispelMask = SpellInfo.GetDispelMask((DispelType)effectInfo.MiscValue);
@@ -4612,9 +4612,9 @@ namespace Game.Spells
int remaining = stealList.Count;
// Ok if exist some buffs for dispel try dispel it
List<Tuple<uint, ObjectGuid>> successList = new List<Tuple<uint, ObjectGuid>>();
List<Tuple<uint, ObjectGuid>> successList = new();
DispelFailed dispelFailed = new DispelFailed();
DispelFailed dispelFailed = new();
dispelFailed.CasterGUID = m_caster.GetGUID();
dispelFailed.VictimGUID = unitTarget.GetGUID();
dispelFailed.SpellID = m_spellInfo.Id;
@@ -4647,7 +4647,7 @@ namespace Game.Spells
if (successList.Empty())
return;
SpellDispellLog spellDispellLog = new SpellDispellLog();
SpellDispellLog spellDispellLog = new();
spellDispellLog.IsBreak = false; // TODO: use me
spellDispellLog.IsSteal = true;
@@ -5117,7 +5117,7 @@ namespace Game.Spells
Player player = unitTarget.ToPlayer();
WorldLocation homeLoc = new WorldLocation();
WorldLocation homeLoc = new();
uint areaId = player.GetAreaId();
if (effectInfo.MiscValue != 0)
@@ -5137,7 +5137,7 @@ namespace Game.Spells
Log.outDebug(LogFilter.Spells, "EffectBind: New homebind MapId: {0}, AreaId: {1}, {2}, ", homeLoc.GetMapId(), areaId, homeLoc);
// zone update
PlayerBound packet = new PlayerBound(m_caster.GetGUID(), areaId);
PlayerBound packet = new(m_caster.GetGUID(), areaId);
player.SendPacket(packet);
}
@@ -5183,7 +5183,7 @@ namespace Game.Spells
m_caster.GetClosePoint(out x, out y, out z, SharedConst.DefaultPlayerBoundingRadius);
Map map = m_caster.GetMap();
Position pos = new Position(x, y, z, m_caster.GetOrientation());
Position pos = new(x, y, z, m_caster.GetOrientation());
Quaternion rot = Quaternion.fromEulerAnglesZYX(m_caster.GetOrientation(), 0.0f, 0.0f);
GameObject go = GameObject.CreateGameObject(goId, map, pos, rot, 255, GameObjectState.Ready);
@@ -5362,7 +5362,7 @@ namespace Game.Spells
if (collectionMgr == null)
return;
List<uint> bonusList = new List<uint>();
List<uint> bonusList = new();
bonusList.Add(collectionMgr.GetHeirloomBonus(m_misc.Data0));
DoCreateItem(effIndex, m_misc.Data0, ItemContext.None, bonusList);
@@ -5607,7 +5607,7 @@ namespace Game.Spells
if (!unitTarget || unitTarget.GetTypeId() != TypeId.Player)
return;
PvPCredit packet = new PvPCredit();
PvPCredit packet = new();
packet.Honor = damage;
packet.OriginalHonor = damage;
+23 -23
View File
@@ -45,7 +45,7 @@ namespace Game.Spells
int index = (typeof(T) == typeof(Pet) ? 1 : 2);
CooldownEntry cooldownEntry = new CooldownEntry();
CooldownEntry cooldownEntry = new();
cooldownEntry.SpellId = spellId;
cooldownEntry.CooldownEnd = Time.UnixTimeToDateTime(cooldownsResult.Read<uint>(index++));
cooldownEntry.ItemId = 0;
@@ -236,7 +236,7 @@ namespace Game.Spells
DateTime now = GameTime.GetGameTimeSystemPoint();
foreach (var p in _spellCooldowns)
{
SpellHistoryEntry historyEntry = new SpellHistoryEntry();
SpellHistoryEntry historyEntry = new();
historyEntry.SpellID = p.Key;
historyEntry.ItemID = p.Value.ItemId;
@@ -273,7 +273,7 @@ namespace Game.Spells
if (cooldownDuration.TotalMilliseconds <= 0)
continue;
SpellChargeEntry chargeEntry = new SpellChargeEntry();
SpellChargeEntry chargeEntry = new();
chargeEntry.Category = key;
chargeEntry.NextRecoveryTime = (uint)cooldownDuration.TotalMilliseconds;
chargeEntry.ConsumedCharges = (byte)list.Count;
@@ -288,7 +288,7 @@ namespace Game.Spells
foreach (var pair in _spellCooldowns)
{
PetSpellCooldown petSpellCooldown = new PetSpellCooldown();
PetSpellCooldown petSpellCooldown = new();
petSpellCooldown.SpellID = pair.Key;
petSpellCooldown.Category = (ushort)pair.Value.CategoryId;
@@ -318,7 +318,7 @@ namespace Game.Spells
if (cooldownDuration.TotalMilliseconds <= 0)
continue;
PetSpellHistory petChargeEntry = new PetSpellHistory();
PetSpellHistory petChargeEntry = new();
petChargeEntry.CategoryID = key;
petChargeEntry.RecoveryTime = (uint)cooldownDuration.TotalMilliseconds;
petChargeEntry.ConsumedCharges = (sbyte)list.Count;
@@ -435,7 +435,7 @@ namespace Game.Spells
Player playerOwner = GetPlayerOwner();
if (playerOwner)
{
SpellCooldownPkt spellCooldown = new SpellCooldownPkt();
SpellCooldownPkt spellCooldown = new();
spellCooldown.Caster = _owner.GetGUID();
spellCooldown.Flags = SpellCooldownFlags.None;
spellCooldown.SpellCooldowns.Add(new SpellCooldownStruct(spellInfo.Id, (uint)cooldown));
@@ -478,7 +478,7 @@ namespace Game.Spells
public void AddCooldown(uint spellId, uint itemId, DateTime cooldownEnd, uint categoryId, DateTime categoryEnd, bool onHold = false)
{
CooldownEntry cooldownEntry = new CooldownEntry();
CooldownEntry cooldownEntry = new();
cooldownEntry.SpellId = spellId;
cooldownEntry.CooldownEnd = cooldownEnd;
cooldownEntry.ItemId = itemId;
@@ -516,7 +516,7 @@ namespace Game.Spells
Player playerOwner = GetPlayerOwner();
if (playerOwner)
{
ModifyCooldown modifyCooldown = new ModifyCooldown();
ModifyCooldown modifyCooldown = new();
modifyCooldown.IsPet = _owner != playerOwner;
modifyCooldown.SpellID = spellId;
modifyCooldown.DeltaTime = (int)offset.TotalMilliseconds;
@@ -535,7 +535,7 @@ namespace Game.Spells
Player playerOwner = GetPlayerOwner();
if (playerOwner)
{
ClearCooldown clearCooldown = new ClearCooldown();
ClearCooldown clearCooldown = new();
clearCooldown.IsPet = _owner != playerOwner;
clearCooldown.SpellID = spellId;
clearCooldown.ClearOnHold = false;
@@ -549,7 +549,7 @@ namespace Game.Spells
public void ResetCooldowns(Func<KeyValuePair<uint, CooldownEntry>, bool> predicate, bool update = false)
{
List<uint> resetCooldowns = new List<uint>();
List<uint> resetCooldowns = new();
foreach (var pair in _spellCooldowns)
{
if (predicate(pair))
@@ -568,7 +568,7 @@ namespace Game.Spells
Player playerOwner = GetPlayerOwner();
if (playerOwner)
{
List<uint> cooldowns = new List<uint>();
List<uint> cooldowns = new();
foreach (var id in _spellCooldowns.Keys)
cooldowns.Add(id);
@@ -635,7 +635,7 @@ namespace Game.Spells
if (Convert.ToBoolean((SpellSchoolMask)(1 << i) & schoolMask))
_schoolLockouts[i] = lockoutEnd;
List<uint> knownSpells = new List<uint>();
List<uint> knownSpells = new();
Player plrOwner = _owner.ToPlayer();
if (plrOwner)
{
@@ -658,7 +658,7 @@ namespace Game.Spells
knownSpells.Add(creatureOwner.m_spells[i]);
}
SpellCooldownPkt spellCooldown = new SpellCooldownPkt();
SpellCooldownPkt spellCooldown = new();
spellCooldown.Caster = _owner.GetGUID();
spellCooldown.Flags = SpellCooldownFlags.None;
foreach (uint spellId in knownSpells)
@@ -726,7 +726,7 @@ namespace Game.Spells
Player player = GetPlayerOwner();
if (player)
{
SetSpellCharges setSpellCharges = new SetSpellCharges();
SetSpellCharges setSpellCharges = new();
setSpellCharges.Category = chargeCategoryId;
if (!chargeList.Empty())
setSpellCharges.NextRecoveryTime = (uint)(chargeList.FirstOrDefault().RechargeEnd - GameTime.GetGameTimeSystemPoint()).TotalMilliseconds;
@@ -751,7 +751,7 @@ namespace Game.Spells
Player player = GetPlayerOwner();
if (player)
{
ClearSpellCharges clearSpellCharges = new ClearSpellCharges();
ClearSpellCharges clearSpellCharges = new();
clearSpellCharges.IsPet = _owner != player;
clearSpellCharges.Category = chargeCategoryId;
player.SendPacket(clearSpellCharges);
@@ -766,7 +766,7 @@ namespace Game.Spells
Player player = GetPlayerOwner();
if (player)
{
ClearAllSpellCharges clearAllSpellCharges = new ClearAllSpellCharges();
ClearAllSpellCharges clearAllSpellCharges = new();
clearAllSpellCharges.IsPet = _owner != player;
player.SendPacket(clearAllSpellCharges);
}
@@ -843,7 +843,7 @@ namespace Game.Spells
Player playerOwner = GetPlayerOwner();
if (playerOwner)
{
ClearCooldowns clearCooldowns = new ClearCooldowns();
ClearCooldowns clearCooldowns = new();
clearCooldowns.IsPet = _owner != playerOwner;
clearCooldowns.SpellID = cooldowns;
playerOwner.SendPacket(clearCooldowns);
@@ -921,7 +921,7 @@ namespace Game.Spells
}
// update the client: restore old cooldowns
SpellCooldownPkt spellCooldown = new SpellCooldownPkt();
SpellCooldownPkt spellCooldown = new();
spellCooldown.Caster = _owner.GetGUID();
spellCooldown.Flags = SpellCooldownFlags.IncludeEventCooldowns;
@@ -942,12 +942,12 @@ namespace Game.Spells
}
Unit _owner;
Dictionary<uint, CooldownEntry> _spellCooldowns = new Dictionary<uint, CooldownEntry>();
Dictionary<uint, CooldownEntry> _spellCooldownsBeforeDuel = new Dictionary<uint, CooldownEntry>();
Dictionary<uint, CooldownEntry> _categoryCooldowns = new Dictionary<uint, CooldownEntry>();
Dictionary<uint, CooldownEntry> _spellCooldowns = new();
Dictionary<uint, CooldownEntry> _spellCooldownsBeforeDuel = new();
Dictionary<uint, CooldownEntry> _categoryCooldowns = new();
DateTime[] _schoolLockouts = new DateTime[(int)SpellSchools.Max];
MultiMap<uint, ChargeEntry> _categoryCharges = new MultiMap<uint, ChargeEntry>();
Dictionary<uint, DateTime> _globalCooldowns = new Dictionary<uint, DateTime>();
MultiMap<uint, ChargeEntry> _categoryCharges = new();
Dictionary<uint, DateTime> _globalCooldowns = new();
public class CooldownEntry
{
+6 -6
View File
@@ -1621,7 +1621,7 @@ namespace Game.Spells
public void _LoadSpellDiminishInfo()
{
SpellDiminishInfo diminishInfo = new SpellDiminishInfo();
SpellDiminishInfo diminishInfo = new();
diminishInfo.DiminishGroup = DiminishingGroupCompute();
diminishInfo.DiminishReturnType = DiminishingTypeCompute(diminishInfo.DiminishGroup);
diminishInfo.DiminishMaxLevel = DiminishingMaxLevelCompute(diminishInfo.DiminishGroup);
@@ -2904,7 +2904,7 @@ namespace Game.Spells
public List<SpellPowerCost> CalcPowerCost(Unit caster, SpellSchoolMask schoolMask, Spell spell = null)
{
List<SpellPowerCost> costs = new List<SpellPowerCost>();
List<SpellPowerCost> costs = new();
SpellPowerCost getOrCreatePowerCost(PowerType powerType)
{
@@ -3655,7 +3655,7 @@ namespace Game.Spells
public uint ProcCharges { get; set; }
public uint ProcCooldown { get; set; }
public float ProcBasePPM { get; set; }
List<SpellProcsPerMinuteModRecord> ProcPPMMods = new List<SpellProcsPerMinuteModRecord>();
List<SpellProcsPerMinuteModRecord> ProcPPMMods = new();
public uint MaxLevel { get; set; }
public uint BaseLevel { get; set; }
public uint SpellLevel { get; set; }
@@ -3694,7 +3694,7 @@ namespace Game.Spells
public SpellChainNode ChainEntry { get; set; }
SpellEffectInfo[] _effects = new SpellEffectInfo[SpellConst.MaxEffects];
List<SpellXSpellVisualRecord> _visuals = new List<SpellXSpellVisualRecord>();
List<SpellXSpellVisualRecord> _visuals = new();
SpellSpecificType _spellSpecific;
AuraStateType _auraState;
@@ -4852,8 +4852,8 @@ namespace Game.Spells
public uint DispelImmune;
public uint DamageSchoolMask;
public List<AuraType> AuraTypeImmune = new List<AuraType>();
public List<SpellEffectName> SpellEffectImmune = new List<SpellEffectName>();
public List<AuraType> AuraTypeImmune = new();
public List<SpellEffectName> SpellEffectImmune = new();
}
}
+57 -57
View File
@@ -333,7 +333,7 @@ namespace Game.Entities
public void GetSetOfSpellsInSpellGroup(SpellGroup group_id, out List<int> foundSpells)
{
List<SpellGroup> usedGroups = new List<SpellGroup>();
List<SpellGroup> usedGroups = new();
GetSetOfSpellsInSpellGroup(group_id, out foundSpells, ref usedGroups);
}
@@ -399,7 +399,7 @@ namespace Game.Entities
// find SpellGroups which are common for both spells
var spellGroup1 = GetSpellSpellGroupMapBounds(spellid_1);
List<SpellGroup> groups = new List<SpellGroup>();
List<SpellGroup> groups = new();
foreach (var group in spellGroup1)
{
if (IsSpellMemberOfSpellGroup(spellid_2, group))
@@ -694,8 +694,8 @@ namespace Game.Entities
{
uint oldMSTime = Time.GetMSTime();
Dictionary<uint /*spell*/, uint /*next*/> chains = new Dictionary<uint, uint>();
List<uint> hasPrev = new List<uint>();
Dictionary<uint /*spell*/, uint /*next*/> chains = new();
List<uint> hasPrev = new();
foreach (SkillLineAbilityRecord skillAbility in CliDB.SkillLineAbilityStorage.Values)
{
if (skillAbility.SupercedesSpell == 0)
@@ -852,7 +852,7 @@ namespace Game.Entities
if (effect == null)
continue;
SpellLearnSkillNode dbc_node = new SpellLearnSkillNode();
SpellLearnSkillNode dbc_node = new();
switch (effect.Effect)
{
case SpellEffectName.Skill:
@@ -1012,7 +1012,7 @@ namespace Game.Entities
if (found)
continue;
SpellLearnSpellNode dbcLearnNode = new SpellLearnSpellNode();
SpellLearnSpellNode dbcLearnNode = new();
dbcLearnNode.Spell = spellLearnSpell.LearnSpellID;
dbcLearnNode.OverridesSpell = spellLearnSpell.OverridesSpellID;
dbcLearnNode.Active = true;
@@ -1045,7 +1045,7 @@ namespace Game.Entities
uint spellId = result.Read<uint>(0);
uint effIndex = result.Read<byte>(1);
SpellTargetPosition st = new SpellTargetPosition();
SpellTargetPosition st = new();
st.target_mapId = result.Read<uint>(2);
st.target_X = result.Read<float>(3);
st.target_Y = result.Read<float>(4);
@@ -1117,7 +1117,7 @@ namespace Game.Entities
return;
}
List<uint> groups = new List<uint>();
List<uint> groups = new();
uint count = 0;
do
{
@@ -1182,7 +1182,7 @@ namespace Game.Entities
mSpellGroupStack.Clear(); // need for reload case
mSpellSameEffectStack.Clear();
List<SpellGroup> sameEffectGroups = new List<SpellGroup>();
List<SpellGroup> sameEffectGroups = new();
// 0 1
SQLResult result = DB.World.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules");
@@ -1229,11 +1229,11 @@ namespace Game.Entities
{
GetSetOfSpellsInSpellGroup(group_id, out var spellIds);
List<AuraType> auraTypes = new List<AuraType>();
List<AuraType> auraTypes = new();
// we have to 'guess' what effect this group corresponds to
{
List<AuraType> frequencyContainer = new List<AuraType>();
List<AuraType> frequencyContainer = new();
// only waylay for the moment (shared group)
AuraType[] SubGroups =
@@ -1360,7 +1360,7 @@ namespace Game.Entities
}
}
SpellProcEntry baseProcEntry = new SpellProcEntry();
SpellProcEntry baseProcEntry = new();
baseProcEntry.SchoolMask = (SpellSchoolMask)result.Read<uint>(1);
baseProcEntry.SpellFamilyName = (SpellFamilyNames)result.Read<uint>(2);
@@ -1508,7 +1508,7 @@ namespace Game.Entities
continue;
}
SpellProcEntry procEntry = new SpellProcEntry();
SpellProcEntry procEntry = new();
procEntry.SchoolMask = 0;
procEntry.ProcFlags = spellInfo.ProcFlags;
procEntry.SpellFamilyName = 0;
@@ -1592,7 +1592,7 @@ namespace Game.Entities
continue;
}
SpellThreatEntry ste = new SpellThreatEntry();
SpellThreatEntry ste = new();
ste.flatMod = result.Read<int>(1);
ste.pctMod = result.Read<float>(2);
ste.apPctMod = result.Read<float>(3);
@@ -1669,7 +1669,7 @@ namespace Game.Entities
continue;
}
PetAura pa = new PetAura(pet, aura, effect.TargetA.GetTarget() == Targets.UnitPet, effect.CalcValue());
PetAura pa = new(pet, aura, effect.TargetA.GetTarget() == Targets.UnitPet, effect.CalcValue());
mSpellPetAuraMap[(spell << 8) + eff] = pa;
}
++count;
@@ -1734,7 +1734,7 @@ namespace Game.Entities
continue;
}
SpellEnchantProcEntry spe = new SpellEnchantProcEntry();
SpellEnchantProcEntry spe = new();
spe.Chance = result.Read<uint>(1);
spe.ProcsPerMinute = result.Read<float>(2);
spe.HitMask = result.Read<uint>(3);
@@ -1883,7 +1883,7 @@ namespace Game.Entities
if (mPetDefaultSpellsMap.LookupByKey(cInfo.Entry) != null)
continue;
PetDefaultSpellsEntry petDefSpells = new PetDefaultSpellsEntry();
PetDefaultSpellsEntry petDefSpells = new();
for (byte j = 0; j < SharedConst.MaxCreatureSpellDataSlots; ++j)
petDefSpells.spellid[j] = cInfo.Spells[j];
@@ -1974,7 +1974,7 @@ namespace Game.Entities
{
uint spell = result.Read<uint>(0);
SpellArea spellArea = new SpellArea();
SpellArea spellArea = new();
spellArea.spellId = spell;
spellArea.areaId = result.Read<uint>(1);
spellArea.questStart = result.Read<uint>(2);
@@ -2151,7 +2151,7 @@ namespace Game.Entities
mSpellInfoMap.Clear();
var loadData = new Dictionary<(uint Id, Difficulty difficulty), SpellInfoLoadHelper>();
Dictionary<uint, BattlePetSpeciesRecord> battlePetSpeciesByCreature = new Dictionary<uint, BattlePetSpeciesRecord>();
Dictionary<uint, BattlePetSpeciesRecord> battlePetSpeciesByCreature = new();
foreach (var battlePetSpecies in CliDB.BattlePetSpeciesStorage.Values)
if (battlePetSpecies.CreatureID != 0)
battlePetSpeciesByCreature[battlePetSpecies.CreatureID] = battlePetSpecies;
@@ -2364,7 +2364,7 @@ namespace Game.Entities
{
uint oldMSTime = Time.GetMSTime();
MultiMap<(uint spellId, Difficulty difficulty), SpellEffectRecord> spellEffects = new MultiMap<(uint spellId, Difficulty difficulty), SpellEffectRecord>();
MultiMap<(uint spellId, Difficulty difficulty), SpellEffectRecord> spellEffects = new();
// 0 1 2 3 4 5 6
SQLResult effectsResult = DB.World.Query("SELECT SpellID, EffectIndex, DifficultyID, Effect, EffectAura, EffectAmplitude, EffectAttributes, " +
@@ -2507,7 +2507,7 @@ namespace Game.Entities
mServersideSpellNames.Add(new (spellId, spellsResult.Read<string>(61)));
SpellInfo spellInfo = new SpellInfo(mServersideSpellNames.Last().Name, difficulty, spellEffects[(spellId, difficulty)]);
SpellInfo spellInfo = new(mServersideSpellNames.Last().Name, difficulty, spellEffects[(spellId, difficulty)]);
spellInfo.CategoryId = spellsResult.Read<uint>(2);
spellInfo.Dispel = (DispelType)spellsResult.Read<uint>(3);
spellInfo.Mechanic = (Mechanics)spellsResult.Read<uint>(4);
@@ -2630,7 +2630,7 @@ namespace Game.Entities
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} spell custom attributes from DB in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime2));
}
List<uint> talentSpells = new List<uint>();
List<uint> talentSpells = new();
foreach (var talentInfo in CliDB.TalentStorage.Values)
talentSpells.Add(talentInfo.SpellID);
@@ -3654,7 +3654,7 @@ namespace Game.Entities
public void LoadPetFamilySpellsStore()
{
Dictionary<uint, SpellLevelsRecord> levelsBySpell = new Dictionary<uint, SpellLevelsRecord>();
Dictionary<uint, SpellLevelsRecord> levelsBySpell = new();
foreach (SpellLevelsRecord levels in CliDB.SpellLevelsStorage.Values)
if (levels.DifficultyID == 0)
levelsBySpell[levels.SpellID] = levels;
@@ -3940,42 +3940,42 @@ namespace Game.Entities
}
#region Fields
Dictionary<uint, SpellChainNode> mSpellChains = new Dictionary<uint, SpellChainNode>();
MultiMap<uint, uint> mSpellsReqSpell = new MultiMap<uint, uint>();
MultiMap<uint, uint> mSpellReq = new MultiMap<uint, uint>();
Dictionary<uint, SpellLearnSkillNode> mSpellLearnSkills = new Dictionary<uint, SpellLearnSkillNode>();
MultiMap<uint, SpellLearnSpellNode> mSpellLearnSpells = new MultiMap<uint, SpellLearnSpellNode>();
Dictionary<KeyValuePair<uint, uint>, SpellTargetPosition> mSpellTargetPositions = new Dictionary<KeyValuePair<uint, uint>, SpellTargetPosition>();
MultiMap<uint, SpellGroup> mSpellSpellGroup = new MultiMap<uint, SpellGroup>();
MultiMap<SpellGroup, int> mSpellGroupSpell = new MultiMap<SpellGroup, int>();
Dictionary<SpellGroup, SpellGroupStackRule> mSpellGroupStack = new Dictionary<SpellGroup, SpellGroupStackRule>();
MultiMap<SpellGroup, AuraType> mSpellSameEffectStack = new MultiMap<SpellGroup, AuraType>();
List<ServersideSpellName> mServersideSpellNames = new List<ServersideSpellName>();
Dictionary<(uint id, Difficulty difficulty), SpellProcEntry> mSpellProcMap = new Dictionary<(uint id, Difficulty difficulty), SpellProcEntry>();
Dictionary<uint, SpellThreatEntry> mSpellThreatMap = new Dictionary<uint, SpellThreatEntry>();
Dictionary<uint, PetAura> mSpellPetAuraMap = new Dictionary<uint, PetAura>();
MultiMap<int, int> mSpellLinkedMap = new MultiMap<int, int>();
Dictionary<uint, SpellEnchantProcEntry> mSpellEnchantProcEventMap = new Dictionary<uint, SpellEnchantProcEntry>();
Dictionary<int, bool> mEnchantCustomAttr = new Dictionary<int, bool>();
MultiMap<uint, SpellArea> mSpellAreaMap = new MultiMap<uint, SpellArea>();
MultiMap<uint, SpellArea> mSpellAreaForQuestMap = new MultiMap<uint, SpellArea>();
MultiMap<uint, SpellArea> mSpellAreaForQuestEndMap = new MultiMap<uint, SpellArea>();
MultiMap<uint, SpellArea> mSpellAreaForAuraMap = new MultiMap<uint, SpellArea>();
MultiMap<uint, SpellArea> mSpellAreaForAreaMap = new MultiMap<uint, SpellArea>();
MultiMap<Tuple<uint, uint>, SpellArea> mSpellAreaForQuestAreaMap = new MultiMap<Tuple<uint, uint>, SpellArea>();
MultiMap<uint, SkillLineAbilityRecord> mSkillLineAbilityMap = new MultiMap<uint, SkillLineAbilityRecord>();
Dictionary<uint, MultiMap<uint, uint>> mPetLevelupSpellMap = new Dictionary<uint, MultiMap<uint, uint>>();
Dictionary<uint, PetDefaultSpellsEntry> mPetDefaultSpellsMap = new Dictionary<uint, PetDefaultSpellsEntry>(); // only spells not listed in related mPetLevelupSpellMap entry
MultiMap<uint, SpellInfo> mSpellInfoMap = new MultiMap<uint, SpellInfo>();
Dictionary<Tuple<uint, byte>, uint> mSpellTotemModel = new Dictionary<Tuple<uint, byte>, uint>();
Dictionary<uint, BattlePetSpeciesRecord> mBattlePets = new Dictionary<uint, BattlePetSpeciesRecord>();
Dictionary<uint, SpellChainNode> mSpellChains = new();
MultiMap<uint, uint> mSpellsReqSpell = new();
MultiMap<uint, uint> mSpellReq = new();
Dictionary<uint, SpellLearnSkillNode> mSpellLearnSkills = new();
MultiMap<uint, SpellLearnSpellNode> mSpellLearnSpells = new();
Dictionary<KeyValuePair<uint, uint>, SpellTargetPosition> mSpellTargetPositions = new();
MultiMap<uint, SpellGroup> mSpellSpellGroup = new();
MultiMap<SpellGroup, int> mSpellGroupSpell = new();
Dictionary<SpellGroup, SpellGroupStackRule> mSpellGroupStack = new();
MultiMap<SpellGroup, AuraType> mSpellSameEffectStack = new();
List<ServersideSpellName> mServersideSpellNames = new();
Dictionary<(uint id, Difficulty difficulty), SpellProcEntry> mSpellProcMap = new();
Dictionary<uint, SpellThreatEntry> mSpellThreatMap = new();
Dictionary<uint, PetAura> mSpellPetAuraMap = new();
MultiMap<int, int> mSpellLinkedMap = new();
Dictionary<uint, SpellEnchantProcEntry> mSpellEnchantProcEventMap = new();
Dictionary<int, bool> mEnchantCustomAttr = new();
MultiMap<uint, SpellArea> mSpellAreaMap = new();
MultiMap<uint, SpellArea> mSpellAreaForQuestMap = new();
MultiMap<uint, SpellArea> mSpellAreaForQuestEndMap = new();
MultiMap<uint, SpellArea> mSpellAreaForAuraMap = new();
MultiMap<uint, SpellArea> mSpellAreaForAreaMap = new();
MultiMap<Tuple<uint, uint>, SpellArea> mSpellAreaForQuestAreaMap = new();
MultiMap<uint, SkillLineAbilityRecord> mSkillLineAbilityMap = new();
Dictionary<uint, MultiMap<uint, uint>> mPetLevelupSpellMap = new();
Dictionary<uint, PetDefaultSpellsEntry> mPetDefaultSpellsMap = new(); // only spells not listed in related mPetLevelupSpellMap entry
MultiMap<uint, SpellInfo> mSpellInfoMap = new();
Dictionary<Tuple<uint, byte>, uint> mSpellTotemModel = new();
Dictionary<uint, BattlePetSpeciesRecord> mBattlePets = new();
public delegate void AuraEffectHandler(AuraEffect effect, AuraApplication aurApp, AuraEffectHandleModes mode, bool apply);
Dictionary<AuraType, AuraEffectHandler> AuraEffectHandlers = new Dictionary<AuraType, AuraEffectHandler>();
Dictionary<AuraType, AuraEffectHandler> AuraEffectHandlers = new();
public delegate void SpellEffectHandler(Spell spell, uint effectIndex);
Dictionary<SpellEffectName, SpellEffectHandler> SpellEffectsHandlers = new Dictionary<SpellEffectName, SpellEffectHandler>();
Dictionary<SpellEffectName, SpellEffectHandler> SpellEffectsHandlers = new();
public MultiMap<uint, uint> PetFamilySpellsStorage = new MultiMap<uint, uint>();
public MultiMap<uint, uint> PetFamilySpellsStorage = new();
#endregion
}
@@ -4020,7 +4020,7 @@ namespace Game.Entities
public SpellShapeshiftRecord Shapeshift;
public SpellTargetRestrictionsRecord TargetRestrictions;
public SpellTotemsRecord Totems;
public List<SpellXSpellVisualRecord> Visuals = new List<SpellXSpellVisualRecord>(); // only to group visuals when parsing sSpellXSpellVisualStore, not for loading
public List<SpellXSpellVisualRecord> Visuals = new(); // only to group visuals when parsing sSpellXSpellVisualStore, not for loading
}
public class SpellThreatEntry
@@ -4218,7 +4218,7 @@ namespace Game.Entities
return damage;
}
Dictionary<uint, uint> auras = new Dictionary<uint, uint>();
Dictionary<uint, uint> auras = new();
bool removeOnChangePet;
int damage;
}