diff --git a/Source/Game/AI/AISelector.cs b/Source/Game/AI/AISelector.cs index 7a33e75d9..085eb1191 100644 --- a/Source/Game/AI/AISelector.cs +++ b/Source/Game/AI/AISelector.cs @@ -99,14 +99,12 @@ namespace Game.AI public static IMovementGenerator SelectMovementAI(Creature creature) { - switch (creature.DefaultMovementType) + return creature.DefaultMovementType switch { - case MovementGeneratorType.Random: - return new RandomMovementGenerator(); - case MovementGeneratorType.Waypoint: - return new WaypointMovementGenerator(); - } - return null; + MovementGeneratorType.Random => new RandomMovementGenerator(), + MovementGeneratorType.Waypoint => new WaypointMovementGenerator(), + _ => null, + }; } public static GameObjectAI SelectGameObjectAI(GameObject go) @@ -116,14 +114,11 @@ namespace Game.AI if (scriptedAI != null) return scriptedAI; - switch (go.GetAIName()) + return go.GetAIName() switch { - case "GameObjectAI": - default: - return new GameObjectAI(go); - case "SmartGameObjectAI": - return new SmartGameObjectAI(go); - } + "SmartGameObjectAI" => new SmartGameObjectAI(go), + _ => new GameObjectAI(go), + }; } } } diff --git a/Source/Game/AI/CoreAI/AreaTriggerAI.cs b/Source/Game/AI/CoreAI/AreaTriggerAI.cs index 33099eb7b..420977f51 100644 --- a/Source/Game/AI/CoreAI/AreaTriggerAI.cs +++ b/Source/Game/AI/CoreAI/AreaTriggerAI.cs @@ -21,6 +21,8 @@ namespace Game.AI { public class AreaTriggerAI { + protected AreaTrigger at; + public AreaTriggerAI(AreaTrigger a) { at = a; @@ -49,8 +51,6 @@ namespace Game.AI // Called when the AreaTrigger is removed public virtual void OnRemove() { } - - protected AreaTrigger at; } class NullAreaTriggerAI : AreaTriggerAI diff --git a/Source/Game/AI/CoreAI/CombatAI.cs b/Source/Game/AI/CoreAI/CombatAI.cs index 14c05a872..234010653 100644 --- a/Source/Game/AI/CoreAI/CombatAI.cs +++ b/Source/Game/AI/CoreAI/CombatAI.cs @@ -23,13 +23,15 @@ namespace Game.AI { public class CombatAI : CreatureAI { + public List Spells = new(); + public CombatAI(Creature c) : base(c) { } public override void InitializeAI() { for (var i = 0; i < SharedConst.MaxCreatureSpells; ++i) if (me.m_spells[i] != 0 && Global.SpellMgr.HasSpellInfo(me.m_spells[i], me.GetMap().GetDifficultyID())) - spells.Add(me.m_spells[i]); + Spells.Add(me.m_spells[i]); base.InitializeAI(); } @@ -41,7 +43,7 @@ namespace Game.AI public override void JustDied(Unit killer) { - foreach (var id in spells) + foreach (var id in Spells) { AISpellInfoType info = GetAISpellInfo(id, me.GetMap().GetDifficultyID()); if (info.condition == AICondition.Die) @@ -51,7 +53,7 @@ namespace Game.AI public override void EnterCombat(Unit victim) { - foreach (var id in spells) + foreach (var id in Spells) { AISpellInfoType info = GetAISpellInfo(id, me.GetMap().GetDifficultyID()); if (info.condition == AICondition.Aggro) @@ -86,8 +88,6 @@ namespace Game.AI { _events.RescheduleEvent(spellId, unTimeMs); } - - public List spells = new List(); } public class AggressorAI : CreatureAI @@ -105,41 +105,43 @@ namespace Game.AI public class CasterAI : CombatAI { + float _attackDist; + public CasterAI(Creature c) : base(c) { - m_attackDist = SharedConst.MeleeRange; + _attackDist = SharedConst.MeleeRange; } public override void InitializeAI() { base.InitializeAI(); - m_attackDist = 30.0f; - foreach (var id in spells) + _attackDist = 30.0f; + foreach (var id in Spells) { AISpellInfoType info = GetAISpellInfo(id, me.GetMap().GetDifficultyID()); - if (info.condition == AICondition.Combat && m_attackDist > info.maxRange) - m_attackDist = info.maxRange; + if (info.condition == AICondition.Combat && _attackDist > info.maxRange) + _attackDist = info.maxRange; } - if (m_attackDist == 30.0f) - m_attackDist = SharedConst.MeleeRange; + if (_attackDist == 30.0f) + _attackDist = SharedConst.MeleeRange; } public override void AttackStart(Unit victim) { - AttackStartCaster(victim, m_attackDist); + AttackStartCaster(victim, _attackDist); } public override void EnterCombat(Unit victim) { - if (spells.Empty()) + if (Spells.Empty()) return; - int spell = (int)(RandomHelper.Rand32() % spells.Count); + int spell = (int)(RandomHelper.Rand32() % Spells.Count); uint count = 0; - foreach (var id in spells) + foreach (var id in Spells) { AISpellInfoType info = GetAISpellInfo(id, me.GetMap().GetDifficultyID()); if (info.condition == AICondition.Aggro) @@ -149,7 +151,7 @@ namespace Game.AI uint cooldown = info.realCooldown; if (count == spell) { - DoCast(spells[spell]); + DoCast(Spells[spell]); cooldown += (uint)me.GetCurrentSpellCastTime(id); } _events.ScheduleEvent(id, cooldown); @@ -182,23 +184,22 @@ namespace Game.AI _events.ScheduleEvent(spellId, (casttime != 0 ? casttime : 500) + info.realCooldown); } } - - float m_attackDist; } public class ArcherAI : CreatureAI { - public ArcherAI(Creature c) - : base(c) + float _minRange; + + public ArcherAI(Creature c) : base(c) { if (me.m_spells[0] == 0) Log.outError(LogFilter.ScriptsAi, "ArcherAI set for creature (entry = {0}) with spell1=0. AI will do nothing", me.GetEntry()); var spellInfo = Global.SpellMgr.GetSpellInfo(me.m_spells[0], me.GetMap().GetDifficultyID()); - m_minRange = spellInfo != null ? spellInfo.GetMinRange(false) : 0; + _minRange = spellInfo != null ? spellInfo.GetMinRange(false) : 0; - if (m_minRange == 0) - m_minRange = SharedConst.MeleeRange; + if (_minRange == 0) + _minRange = SharedConst.MeleeRange; me.m_CombatDistance = spellInfo != null ? spellInfo.GetMaxRange(false) : 0; me.m_SightDistance = me.m_CombatDistance; } @@ -208,7 +209,7 @@ namespace Game.AI if (who == null) return; - if (me.IsWithinCombatRange(who, m_minRange)) + if (me.IsWithinCombatRange(who, _minRange)) { if (me.Attack(who, true) && !who.IsFlying()) me.GetMotionMaster().MoveChase(who); @@ -222,22 +223,23 @@ namespace Game.AI if (who.IsFlying()) me.GetMotionMaster().MoveIdle(); } + public override void UpdateAI(uint diff) { if (!UpdateVictim()) return; - if (!me.IsWithinCombatRange(me.GetVictim(), m_minRange)) + if (!me.IsWithinCombatRange(me.GetVictim(), _minRange)) DoSpellAttackIfReady(me.m_spells[0]); else DoMeleeAttackIfReady(); } - - float m_minRange; } public class TurretAI : CreatureAI { + float _minRange; + public TurretAI(Creature c) : base(c) { @@ -245,7 +247,7 @@ namespace Game.AI Log.outError(LogFilter.Server, "TurretAI set for creature (entry = {0}) with spell1=0. AI will do nothing", me.GetEntry()); var spellInfo = Global.SpellMgr.GetSpellInfo(me.m_spells[0], me.GetMap().GetDifficultyID()); - m_minRange = spellInfo != null ? spellInfo.GetMinRange(false) : 0; + _minRange = spellInfo != null ? spellInfo.GetMinRange(false) : 0; me.m_CombatDistance = spellInfo != null ? spellInfo.GetMaxRange(false) : 0; me.m_SightDistance = me.m_CombatDistance; } @@ -254,7 +256,7 @@ namespace Game.AI { // todo use one function to replace it if (!me.IsWithinCombatRange(me.GetVictim(), me.m_CombatDistance) - || (m_minRange != 0 && me.IsWithinCombatRange(me.GetVictim(), m_minRange))) + || (_minRange != 0 && me.IsWithinCombatRange(me.GetVictim(), _minRange))) return false; return true; } @@ -272,8 +274,6 @@ namespace Game.AI DoSpellAttackIfReady(me.m_spells[0]); } - - float m_minRange; } public class VehicleAI : CreatureAI @@ -281,27 +281,32 @@ namespace Game.AI const int VEHICLE_CONDITION_CHECK_TIME = 1000; const int VEHICLE_DISMISS_TIME = 5000; + bool _hasConditions; + uint _conditionsTimer; + bool _doDismiss; + uint _dismissTimer; + public VehicleAI(Creature creature) : base(creature) { - m_ConditionsTimer = VEHICLE_CONDITION_CHECK_TIME; + _conditionsTimer = VEHICLE_CONDITION_CHECK_TIME; LoadConditions(); - m_DoDismiss = false; - m_DismissTimer = VEHICLE_DISMISS_TIME; + _doDismiss = false; + _dismissTimer = VEHICLE_DISMISS_TIME; } public override void UpdateAI(uint diff) { CheckConditions(diff); - if (m_DoDismiss) + if (_doDismiss) { - if (m_DismissTimer < diff) + if (_dismissTimer < diff) { - m_DoDismiss = false; + _doDismiss = false; me.DespawnOrUnsummon(); } else - m_DismissTimer -= diff; + _dismissTimer -= diff; } } @@ -311,25 +316,25 @@ namespace Game.AI public override void OnCharmed(bool apply) { - if (!me.GetVehicleKit().IsVehicleInUse() && !apply && m_HasConditions)//was used and has conditions - m_DoDismiss = true;//needs reset + if (!me.GetVehicleKit().IsVehicleInUse() && !apply && _hasConditions)//was used and has conditions + _doDismiss = true;//needs reset else if (apply) - m_DoDismiss = false;//in use again + _doDismiss = false;//in use again - m_DismissTimer = VEHICLE_DISMISS_TIME;//reset timer + _dismissTimer = VEHICLE_DISMISS_TIME;//reset timer } void LoadConditions() { - m_HasConditions = Global.ConditionMgr.HasConditionsForNotGroupedEntry(ConditionSourceType.CreatureTemplateVehicle, me.GetEntry()); + _hasConditions = Global.ConditionMgr.HasConditionsForNotGroupedEntry(ConditionSourceType.CreatureTemplateVehicle, me.GetEntry()); } void CheckConditions(uint diff) { - if (!m_HasConditions) + if (!_hasConditions) return; - if (m_ConditionsTimer <= diff) + if (_conditionsTimer <= diff) { Vehicle vehicleKit = me.GetVehicleKit(); if (vehicleKit) @@ -352,16 +357,11 @@ namespace Game.AI } } - m_ConditionsTimer = VEHICLE_CONDITION_CHECK_TIME; + _conditionsTimer = VEHICLE_CONDITION_CHECK_TIME; } else - m_ConditionsTimer -= diff; + _conditionsTimer -= diff; } - - bool m_HasConditions; - uint m_ConditionsTimer; - bool m_DoDismiss; - uint m_DismissTimer; } public class ReactorAI : CreatureAI diff --git a/Source/Game/AI/CoreAI/CreatureAI.cs b/Source/Game/AI/CoreAI/CreatureAI.cs index c077ae737..ec45c9214 100644 --- a/Source/Game/AI/CoreAI/CreatureAI.cs +++ b/Source/Game/AI/CoreAI/CreatureAI.cs @@ -27,10 +27,20 @@ namespace Game.AI { public class CreatureAI : UnitAI { + bool _moveInLineOfSightLocked; + List _boundary = new(); + bool _negateBoundary; + + protected new Creature me; + + protected EventMap _events = new(); + protected TaskScheduler _scheduler = new(); + protected InstanceScript _instanceScript; + public CreatureAI(Creature _creature) : base(_creature) { me = _creature; - MoveInLineOfSight_locked = false; + _moveInLineOfSightLocked = false; } public override void OnCharmed(bool apply) @@ -109,12 +119,12 @@ namespace Game.AI public virtual void MoveInLineOfSight_Safe(Unit who) { - if (MoveInLineOfSight_locked) + if (_moveInLineOfSightLocked) return; - MoveInLineOfSight_locked = true; + _moveInLineOfSightLocked = true; MoveInLineOfSight(who); - MoveInLineOfSight_locked = false; + _moveInLineOfSightLocked = false; } public virtual void MoveInLineOfSight(Unit who) @@ -126,7 +136,7 @@ namespace Game.AI me.EngageWithTarget(who); } - void _OnOwnerCombatInteraction(Unit target) + void OnOwnerCombatInteraction(Unit target) { if (target == null || !me.IsAlive()) return; @@ -165,7 +175,7 @@ namespace Game.AI if (!_EnterEvadeMode(why)) return; - Log.outDebug( LogFilter.Unit, "Creature {0} enters evade mode.", me.GetEntry()); + Log.outDebug(LogFilter.Unit, "Creature {0} enters evade mode.", me.GetEntry()); if (me.GetVehicle() == null) // otherwise me will be in evade mode forever { @@ -190,7 +200,7 @@ namespace Game.AI me.GetVehicleKit().Reset(true); } - void SetGazeOn(Unit target) + public void SetGazeOn(Unit target) { if (me.IsValidAttackTarget(target) && target != me.GetVictim()) { @@ -276,9 +286,9 @@ namespace Game.AI if (_boundary.Empty()) return CypherStrings.CreatureMovementNotBounded; - List> Q = new List>(); - List> alreadyChecked = new List>(); - List> outOfBounds = new List>(); + List> Q = new(); + List> alreadyChecked = new(); + List> outOfBounds = new(); Position startPosition = owner.GetPosition(); if (!CheckBoundary(startPosition)) // fall back to creature position @@ -309,7 +319,7 @@ namespace Game.AI } if (!alreadyChecked.Contains(next)) // never check a coordinate twice { - Position nextPos = new Position(startPosition.GetPositionX() + next.Key * SharedConst.BoundaryVisualizeStepSize, startPosition.GetPositionY() + next.Value * SharedConst.BoundaryVisualizeStepSize, startPosition.GetPositionZ()); + Position nextPos = new(startPosition.GetPositionX() + next.Key * SharedConst.BoundaryVisualizeStepSize, startPosition.GetPositionY() + next.Value * SharedConst.BoundaryVisualizeStepSize, startPosition.GetPositionZ()); if (CheckBoundary(nextPos)) Q.Add(next); else @@ -390,7 +400,7 @@ namespace Game.AI return true; } - + public void SetBoundary(List boundary, bool negateBoundaries = false) { _boundary = boundary; @@ -408,8 +418,8 @@ namespace Game.AI public virtual void JustDied(Unit killer) { } // Called when the creature kills a unit - public virtual void KilledUnit(Unit victim) {} - + public virtual void KilledUnit(Unit victim) { } + // Called when the creature summon successfully other creature public virtual void JustSummoned(Creature summon) { } public virtual void IsSummonedBy(Unit summoner) { } @@ -430,11 +440,11 @@ namespace Game.AI public virtual void JustUnregisteredAreaTrigger(AreaTrigger areaTrigger) { } // Called when hit by a spell - public virtual void SpellHit(Unit caster, SpellInfo spell) {} + public virtual void SpellHit(Unit caster, SpellInfo spell) { } // Called when spell hits a target - public virtual void SpellHitTarget(Unit target, SpellInfo spell) {} - + public virtual void SpellHitTarget(Unit target, SpellInfo spell) { } + public virtual bool IsEscorted() { return false; } // Called when creature appears in the world (spawn, respawn, grid load etc...) @@ -450,18 +460,18 @@ namespace Game.AI // Called at reaching home after evade public virtual void JustReachedHome() { } - + // Called at text emote receive from player public virtual void ReceiveEmote(Player player, TextEmotes emoteId) { } // Called when owner takes damage - public virtual void OwnerAttackedBy(Unit attacker) { _OnOwnerCombatInteraction(attacker); } + public virtual void OwnerAttackedBy(Unit attacker) { OnOwnerCombatInteraction(attacker); } // Called when owner attacks something - public virtual void OwnerAttacked(Unit target) { _OnOwnerCombatInteraction(target); } + public virtual void OwnerAttacked(Unit target) { OnOwnerCombatInteraction(target); } // called when the corpse of this creature gets removed - public virtual void CorpseRemoved(long respawnDelay) {} + public virtual void CorpseRemoved(long respawnDelay) { } public virtual void PassengerBoarded(Unit passenger, sbyte seatId, bool apply) { } @@ -481,18 +491,9 @@ namespace Game.AI /// /// /// - public virtual bool IsEscortNPC(bool onlyIfActive) { return false; } - - List GetBoundary() { return _boundary; } + public virtual bool IsEscortNPC(bool onlyIfActive) { return false; } - bool MoveInLineOfSight_locked; - protected new Creature me; - List _boundary = new List(); - bool _negateBoundary; - - protected EventMap _events = new EventMap(); - protected TaskScheduler _scheduler = new TaskScheduler(); - protected InstanceScript _instance; + public List GetBoundary() { return _boundary; } } public struct AISpellInfoType diff --git a/Source/Game/AI/CoreAI/GameObjectAI.cs b/Source/Game/AI/CoreAI/GameObjectAI.cs index 4af884941..1c73d2908 100644 --- a/Source/Game/AI/CoreAI/GameObjectAI.cs +++ b/Source/Game/AI/CoreAI/GameObjectAI.cs @@ -15,15 +15,20 @@ * along with this program. If not, see . */ +using Framework.Constants; using Framework.Dynamic; using Game.Entities; using Game.Spells; -using Framework.Constants; namespace Game.AI { public class GameObjectAI { + protected TaskScheduler _scheduler; + protected EventMap _events; + + public GameObject me; + public GameObjectAI(GameObject gameObject) { me = gameObject; @@ -93,10 +98,5 @@ namespace Game.AI public virtual void OnStateChanged(GameObjectState state) { } public virtual void EventInform(uint eventId) { } public virtual void SpellHit(Unit unit, SpellInfo spellInfo) { } - - protected TaskScheduler _scheduler; - protected EventMap _events; - - public GameObject me; } } diff --git a/Source/Game/AI/CoreAI/PetAI.cs b/Source/Game/AI/CoreAI/PetAI.cs index 021bc3e06..500ad0265 100644 --- a/Source/Game/AI/CoreAI/PetAI.cs +++ b/Source/Game/AI/CoreAI/PetAI.cs @@ -26,14 +26,15 @@ namespace Game.AI { public class PetAI : CreatureAI { + List _allySet = new(); + uint _updateAlliesTimer; + public PetAI(Creature c) : base(c) { - i_tracker = new TimeTracker(5000); - UpdateAllies(); } - bool _needToStop() + bool NeedToStop() { // This is needed for charmed creatures, as once their target was reset other effects can trigger threat if (me.IsCharmed() && me.GetVictim() == me.GetCharmer()) @@ -48,7 +49,7 @@ namespace Game.AI return !me.IsValidAttackTarget(me.GetVictim()); } - void _stopAttack() + void StopAttack() { if (!me.IsAlive()) { @@ -74,11 +75,11 @@ namespace Game.AI Unit owner = me.GetCharmerOrOwner(); - if (m_updateAlliesTimer <= diff) + if (_updateAlliesTimer <= diff) // UpdateAllies self set update timer UpdateAllies(); else - m_updateAlliesTimer -= diff; + _updateAlliesTimer -= diff; if (me.GetVictim() && me.GetVictim().IsAlive()) { @@ -90,10 +91,10 @@ namespace Game.AI return; } - if (_needToStop()) + if (NeedToStop()) { Log.outDebug(LogFilter.Server, "Pet AI stopped attacking [{0}]", me.GetGUID().ToString()); - _stopAttack(); + StopAttack(); return; } @@ -129,7 +130,7 @@ namespace Game.AI // Autocast (casted only in combat or persistent spells in any state) if (!me.HasUnitState(UnitState.Casting)) { - List> targetSpellStore = new List>(); + List> targetSpellStore = new(); for (byte i = 0; i < me.GetPetAutoSpellSize(); ++i) { @@ -157,7 +158,7 @@ namespace Game.AI continue; } - Spell spell = new Spell(me, spellInfo, TriggerCastFlags.None); + Spell spell = new(me, spellInfo, TriggerCastFlags.None); bool spellUsed = false; // Some spells can target enemy or friendly (DK Ghoul's Leap) @@ -185,7 +186,7 @@ namespace Game.AI // No enemy, check friendly if (!spellUsed) { - foreach (var tar in m_AllySet) + foreach (var tar in _allySet) { Unit ally = Global.ObjAccessor.GetUnit(me, tar); @@ -208,7 +209,7 @@ namespace Game.AI } else if (me.GetVictim() && CanAIAttack(me.GetVictim()) && spellInfo.CanBeUsedInCombat()) { - Spell spell = new Spell(me, spellInfo, TriggerCastFlags.None); + Spell spell = new(me, spellInfo, TriggerCastFlags.None); if (spell.CanAutoCast(me.GetVictim())) targetSpellStore.Add(Tuple.Create(me.GetVictim(), spell)); else @@ -226,7 +227,7 @@ namespace Game.AI targetSpellStore.RemoveAt(index); - SpellCastTargets targets = new SpellCastTargets(); + SpellCastTargets targets = new(); targets.SetUnitTarget(target); spell.Prepare(targets); @@ -245,7 +246,7 @@ namespace Game.AI void UpdateAllies() { - m_updateAlliesTimer = 10 * Time.InMilliseconds; // update friendly targets every 10 seconds, lesser checks increase performance + _updateAlliesTimer = 10 * Time.InMilliseconds; // update friendly targets every 10 seconds, lesser checks increase performance Unit owner = me.GetCharmerOrOwner(); if (!owner) @@ -257,15 +258,15 @@ namespace Game.AI group = player.GetGroup(); //only pet and owner/not in group.ok - if (m_AllySet.Count == 2 && !group) + if (_allySet.Count == 2 && !group) return; //owner is in group; group members filled in already (no raid . subgroupcount = whole count) - if (group && !group.IsRaidGroup() && m_AllySet.Count == (group.GetMembersCount() + 2)) + if (group && !group.IsRaidGroup() && _allySet.Count == (group.GetMembersCount() + 2)) return; - m_AllySet.Clear(); - m_AllySet.Add(me.GetGUID()); + _allySet.Clear(); + _allySet.Add(me.GetGUID()); if (group) //add group { for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next()) @@ -277,11 +278,11 @@ namespace Game.AI if (target.GetGUID() == owner.GetGUID()) continue; - m_AllySet.Add(target.GetGUID()); + _allySet.Add(target.GetGUID()); } } else //remove group - m_AllySet.Add(owner.GetGUID()); + _allySet.Add(owner.GetGUID()); } public override void KilledUnit(Unit victim) @@ -639,9 +640,5 @@ namespace Game.AI public override void MoveInLineOfSight(Unit who) { } public override void MoveInLineOfSight_Safe(Unit who) { } public override void EnterEvadeMode(EvadeReason why) { } - - TimeTracker i_tracker; - List m_AllySet = new List(); - uint m_updateAlliesTimer; } } diff --git a/Source/Game/AI/CoreAI/TotemAI.cs b/Source/Game/AI/CoreAI/TotemAI.cs index eb962e6c5..636c76f35 100644 --- a/Source/Game/AI/CoreAI/TotemAI.cs +++ b/Source/Game/AI/CoreAI/TotemAI.cs @@ -23,9 +23,11 @@ namespace Game.AI { public class TotemAI : CreatureAI { + ObjectGuid _victimGuid; + public TotemAI(Creature c) : base(c) { - i_victimGuid = ObjectGuid.Empty; + _victimGuid = ObjectGuid.Empty; } public override void EnterEvadeMode(EvadeReason why) @@ -51,7 +53,7 @@ namespace Game.AI // SpellModOp.Range not applied in this place just because not existence range mods for attacking totems - Unit victim = !i_victimGuid.IsEmpty() ? Global.ObjAccessor.GetUnit(me, i_victimGuid) : null; + Unit victim = !_victimGuid.IsEmpty() ? Global.ObjAccessor.GetUnit(me, _victimGuid) : null; // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end) if (victim == null || !victim.IsTargetableForAttack() || !me.IsWithinDistInMap(victim, max_range) || @@ -67,15 +69,13 @@ namespace Game.AI if (victim != null) { // remember - i_victimGuid = victim.GetGUID(); + _victimGuid = victim.GetGUID(); // attack me.CastSpell(victim, me.ToTotem().GetSpell()); } else - i_victimGuid.Clear(); + _victimGuid.Clear(); } - - ObjectGuid i_victimGuid; } } diff --git a/Source/Game/AI/CoreAI/UnitAI.cs b/Source/Game/AI/CoreAI/UnitAI.cs index 662f053dd..0e881c93f 100644 --- a/Source/Game/AI/CoreAI/UnitAI.cs +++ b/Source/Game/AI/CoreAI/UnitAI.cs @@ -27,6 +27,10 @@ namespace Game.AI { public class UnitAI { + static Dictionary<(uint id, Difficulty difficulty), AISpellInfoType> _aiSpellInfo = new(); + + protected Unit me { get; private set; } + public UnitAI(Unit _unit) { me = _unit; @@ -59,7 +63,7 @@ namespace Game.AI void SortByDistance(List targets, bool ascending) { - targets.Sort(new ObjectDistanceOrderPred(me, true)); + targets.Sort(new ObjectDistanceOrderPred(me, ascending)); } public void DoMeleeAttackIfReady() @@ -145,18 +149,12 @@ namespace Game.AI if (targetList.Empty()) return null; - switch (targetType) + return targetType switch { - case SelectAggroTarget.MaxThreat: - case SelectAggroTarget.MinThreat: - case SelectAggroTarget.MaxDistance: - case SelectAggroTarget.MinDistance: - return targetList[0]; - case SelectAggroTarget.Random: - return targetList.SelectRandom(); - default: - return null; - } + SelectAggroTarget.MaxThreat or SelectAggroTarget.MinThreat or SelectAggroTarget.MaxDistance or SelectAggroTarget.MinDistance => targetList[0], + SelectAggroTarget.Random => targetList.SelectRandom(), + _ => null, + }; } /// @@ -287,7 +285,7 @@ namespace Game.AI bool playerOnly = spellInfo.HasAttribute(SpellAttr3.OnlyTargetPlayers); float range = spellInfo.GetMaxRange(false); - DefaultTargetSelector targetSelector = new DefaultTargetSelector(me, range, playerOnly, true, -(int)spellId); + DefaultTargetSelector targetSelector = new(me, range, playerOnly, true, -(int)spellId); if (!spellInfo.HasAuraInterruptFlag(SpellAuraInterruptFlags.NotVictim) && targetSelector.Invoke(me.GetVictim())) target = me.GetVictim(); @@ -334,7 +332,7 @@ namespace Game.AI Global.SpellMgr.ForEachSpellInfo(spellInfo => { - AISpellInfoType AIInfo = new AISpellInfoType(); + AISpellInfoType AIInfo = new(); if (spellInfo.HasAttribute(SpellAttr0.CastableWhileDead)) AIInfo.condition = AICondition.Die; else if (spellInfo.IsPassive() || spellInfo.GetDuration() == -1) @@ -461,7 +459,7 @@ namespace Game.AI AIInfo.Effects |= 1 << ((int)SelectEffect.Aura - 1); } - AISpellInfo[(spellInfo.Id, spellInfo.Difficulty)] = AIInfo; + _aiSpellInfo[(spellInfo.Id, spellInfo.Difficulty)] = AIInfo; }); } @@ -471,16 +469,16 @@ namespace Game.AI public virtual void InitializeAI() { - if (!me.IsDead()) + if (!me.IsDead()) Reset(); } - + public virtual void Reset() { } public virtual void OnCharmed(bool apply) { } public virtual bool ShouldSparWith(Unit target) { return false; } - + public virtual void DoAction(int action) { } public virtual uint GetData(uint id = 0) { return 0; } public virtual void SetData(uint id, uint value) { } @@ -491,7 +489,7 @@ namespace Game.AI public virtual void DamageTaken(Unit attacker, ref uint damage) { } public virtual void HealReceived(Unit by, uint addhealth) { } public virtual void HealDone(Unit to, uint addhealth) { } - public virtual void SpellInterrupted(uint spellId, uint unTimeMs) {} + public virtual void SpellInterrupted(uint spellId, uint unTimeMs) { } /// /// Called when a player opens a gossip dialog with the creature. @@ -522,11 +520,10 @@ namespace Game.AI } public virtual void QuestReward(Player player, Quest quest, LootItemType type, uint opt) { } - - /// - /// Called when a game event starts or ends - /// - public virtual void OnGameEvent(bool start, ushort eventId) { } + /// + /// Called when a game event starts or ends + /// + public virtual void OnGameEvent(bool start, ushort eventId) { } // Called when the dialog status between a player and the creature is requested. public virtual QuestGiverStatus GetDialogStatus(Player player) { return QuestGiverStatus.ScriptedDefault; } @@ -539,14 +536,10 @@ namespace Game.AI public virtual void WaypointPathEnded(uint nodeId, uint pathId) { } - public AISpellInfoType GetAISpellInfo(uint spellId, Difficulty difficulty) + public static AISpellInfoType GetAISpellInfo(uint spellId, Difficulty difficulty) { - return AISpellInfo.LookupByKey((spellId, difficulty)); + return _aiSpellInfo.LookupByKey((spellId, difficulty)); } - - public static Dictionary<(uint id, Difficulty difficulty), AISpellInfoType> AISpellInfo = new Dictionary<(uint id, Difficulty difficulty), AISpellInfoType>(); - - protected Unit me { get; private set; } } public enum SelectAggroTarget @@ -623,6 +616,9 @@ namespace Game.AI // todo Add more checks from Spell.CheckCast public class SpellTargetSelector : ICheck { + Unit _caster; + SpellInfo _spellInfo; + public SpellTargetSelector(Unit caster, uint spellId) { _caster = caster; @@ -694,9 +690,6 @@ namespace Game.AI return true; } - - Unit _caster; - SpellInfo _spellInfo; } // Very simple target selector, will just skip main target @@ -704,6 +697,9 @@ namespace Game.AI // because tank will not be in the temporary list public class NonTankTargetSelector : ICheck { + Unit _source; + bool _playerOnly; + public NonTankTargetSelector(Unit source, bool playerOnly = true) { _source = source; @@ -724,14 +720,16 @@ namespace Game.AI return target != _source.GetVictim(); } - - Unit _source; - bool _playerOnly; } // Simple selector for units using mana class PowerUsersSelector : ICheck { + Unit _me; + PowerType _power; + float _dist; + bool _playerOnly; + public PowerUsersSelector(Unit unit, PowerType power, float dist, bool playerOnly) { _me = unit; @@ -759,15 +757,15 @@ namespace Game.AI return true; } - - Unit _me; - PowerType _power; - float _dist; - bool _playerOnly; } class FarthestTargetSelector : ICheck { + Unit _me; + float _dist; + bool _playerOnly; + bool _inLos; + public FarthestTargetSelector(Unit unit, float dist, bool playerOnly, bool inLos) { _me = unit; @@ -792,10 +790,5 @@ namespace Game.AI return true; } - - Unit _me; - float _dist; - bool _playerOnly; - bool _inLos; } } diff --git a/Source/Game/AI/PlayerAI/PlayerAI.cs b/Source/Game/AI/PlayerAI/PlayerAI.cs index c14627005..008d71c05 100644 --- a/Source/Game/AI/PlayerAI/PlayerAI.cs +++ b/Source/Game/AI/PlayerAI/PlayerAI.cs @@ -389,6 +389,11 @@ namespace Game.AI public class PlayerAI : UnitAI { + protected new Player me; + uint _selfSpec; + bool _isSelfHealer; + bool _isSelfRangedAttacker; + public PlayerAI(Player player) : base(player) { me = player; @@ -402,29 +407,17 @@ namespace Game.AI if (!who) return false; - switch (who.GetClass()) + return who.GetClass() switch { - case Class.Warrior: - case Class.Hunter: - case Class.Rogue: - case Class.Deathknight: - case Class.Mage: - case Class.Warlock: - case Class.DemonHunter: - default: - return false; - case Class.Paladin: - return who.GetPrimarySpecialization() == (uint)TalentSpecialization.PaladinHoly; - case Class.Priest: - return who.GetPrimarySpecialization() == (uint)TalentSpecialization.PriestDiscipline || who.GetPrimarySpecialization() == (uint)TalentSpecialization.PriestHoly; - case Class.Shaman: - return who.GetPrimarySpecialization() == (uint)TalentSpecialization.ShamanRestoration; - case Class.Monk: - return who.GetPrimarySpecialization() == (uint)TalentSpecialization.MonkMistweaver; - case Class.Druid: - return who.GetPrimarySpecialization() == (uint)TalentSpecialization.DruidRestoration; - } + Class.Paladin => who.GetPrimarySpecialization() == (uint)TalentSpecialization.PaladinHoly, + Class.Priest => who.GetPrimarySpecialization() == (uint)TalentSpecialization.PriestDiscipline || who.GetPrimarySpecialization() == (uint)TalentSpecialization.PriestHoly, + Class.Shaman => who.GetPrimarySpecialization() == (uint)TalentSpecialization.ShamanRestoration, + Class.Monk => who.GetPrimarySpecialization() == (uint)TalentSpecialization.MonkMistweaver, + Class.Druid => who.GetPrimarySpecialization() == (uint)TalentSpecialization.DruidRestoration, + _ => false, + }; } + bool IsPlayerRangedAttacker(Player who) { if (!who) @@ -494,14 +487,14 @@ namespace Game.AI if (me.GetSpellHistory().HasGlobalCooldown(spellInfo)) return null; - Spell spell = new Spell(me, spellInfo, TriggerCastFlags.None); + Spell spell = new(me, spellInfo, TriggerCastFlags.None); if (spell.CanAutoCast(target)) return Tuple.Create(spell, target); return null; } - Tuple VerifySpellCast(uint spellId, SpellTarget target) + public Tuple VerifySpellCast(uint spellId, SpellTarget target) { Unit pTarget = null; switch (target) @@ -558,7 +551,7 @@ namespace Game.AI return selected; } - void VerifyAndPushSpellCast(List, uint>> spells, uint spellId, T target, uint weight) where T : Unit + public void VerifyAndPushSpellCast(List, uint>> spells, uint spellId, T target, uint weight) where T : Unit { Tuple spell = VerifySpellCast(spellId, target); if (spell != null) @@ -567,7 +560,7 @@ namespace Game.AI public void DoCastAtTarget(Tuple spell) { - SpellCastTargets targets = new SpellCastTargets(); + SpellCastTargets targets = new(); targets.SetUnitTarget(spell.Item2); spell.Item1.Prepare(targets); } @@ -621,10 +614,10 @@ namespace Game.AI DoMeleeAttackIfReady(); } - void CancelAllShapeshifts() + public void CancelAllShapeshifts() { List shapeshiftAuras = me.GetAuraEffectsByType(AuraType.ModShapeshift); - List removableShapeshifts = new List(); + List removableShapeshifts = new(); foreach (AuraEffect auraEff in shapeshiftAuras) { Aura aura = auraEff.GetBase(); @@ -654,22 +647,17 @@ namespace Game.AI public override void OnCharmed(bool apply) { } // helper functions to determine player info - bool IsHealer(Player who = null) + public bool IsHealer(Player who = null) { return (!who || who == me) ? _isSelfHealer : IsPlayerHealer(who); } public bool IsRangedAttacker(Player who = null) { return (!who || who == me) ? _isSelfRangedAttacker : IsPlayerRangedAttacker(who); } - uint GetSpec(Player who = null) { return (!who || who == me) ? _selfSpec : who.GetPrimarySpecialization(); } - void SetIsRangedAttacker(bool state) { _isSelfRangedAttacker = state; } // this allows overriding of the default ranged attacker detection + public uint GetSpec(Player who = null) { return (!who || who == me) ? _selfSpec : who.GetPrimarySpecialization(); } + public void SetIsRangedAttacker(bool state) { _isSelfRangedAttacker = state; } // this allows overriding of the default ranged attacker detection public virtual Unit SelectAttackTarget() { return me.GetCharmer() ? me.GetCharmer().GetVictim() : null; } - protected new Player me; - uint _selfSpec; - bool _isSelfHealer; - bool _isSelfRangedAttacker; - - enum SpellTarget + public enum SpellTarget { None, Victim, @@ -680,6 +668,13 @@ namespace Game.AI class SimpleCharmedPlayerAI : PlayerAI { + const float CASTER_CHASE_DISTANCE = 28.0f; + + uint _castCheckTimer; + bool _chaseCloser; + bool _forceFacing; + bool _isFollowing; + public SimpleCharmedPlayerAI(Player player) : base(player) { _castCheckTimer = 2500; @@ -710,7 +705,7 @@ namespace Game.AI Tuple SelectAppropriateCastForSpec() { - List, uint>> spells = new List, uint>>(); + List, uint>> spells = new(); /* switch (me.getClass()) { @@ -1234,8 +1229,6 @@ namespace Game.AI return SelectSpellCast(spells); } - const float CASTER_CHASE_DISTANCE = 28.0f; - public override void UpdateAI(uint diff) { Creature charmer = GetCharmer(); @@ -1359,11 +1352,6 @@ namespace Game.AI me.StopMoving(); } } - - uint _castCheckTimer; - bool _chaseCloser; - bool _forceFacing; - bool _isFollowing; } struct ValidTargetSelectPredicate : ICheck diff --git a/Source/Game/AI/ScriptedAI/ScriptedAI.cs b/Source/Game/AI/ScriptedAI/ScriptedAI.cs index 255186e74..be01637c8 100644 --- a/Source/Game/AI/ScriptedAI/ScriptedAI.cs +++ b/Source/Game/AI/ScriptedAI/ScriptedAI.cs @@ -28,6 +28,10 @@ namespace Game.AI { public class ScriptedAI : CreatureAI { + Difficulty _difficulty; + bool _isCombatMovementAllowed; + bool _isHeroic; + public ScriptedAI(Creature creature) : base(creature) { _isCombatMovementAllowed = true; @@ -87,7 +91,7 @@ namespace Game.AI } //Cast spell by spell info - void DoCastSpell(Unit target, SpellInfo spellInfo, bool triggered = false) + public void DoCastSpell(Unit target, SpellInfo spellInfo, bool triggered = false) { if (target == null || me.IsNonMeleeSpellCast(false)) return; @@ -97,7 +101,7 @@ namespace Game.AI } //Plays a sound to all nearby players - public void DoPlaySoundToSet(WorldObject source, uint soundId) + public static void DoPlaySoundToSet(WorldObject source, uint soundId) { if (source == null) return; @@ -268,7 +272,7 @@ namespace Game.AI me.MonsterMoveWithSpeed(x, y, z, speed); } - void DoTeleportTo(float[] position) + public void DoTeleportTo(float[] position) { me.NearTeleportTo(position[0], position[1], position[2], position[3]); } @@ -286,7 +290,7 @@ namespace Game.AI me.GetGUID(), me.GetEntry(), unit.GetTypeId(), unit.GetGUID(), x, y, z, o); } - void DoTeleportAll(float x, float y, float z, float o) + public void DoTeleportAll(float x, float y, float z, float o) { Map map = me.GetMap(); if (!map.IsDungeon()) @@ -310,9 +314,9 @@ namespace Game.AI } //Returns a list of friendly CC'd units within range - List DoFindFriendlyCC(float range) + public List DoFindFriendlyCC(float range) { - List list = new List(); + List list = new(); var u_check = new FriendlyCCedInRange(me, range); var searcher = new CreatureListSearcher(me, list, u_check); Cell.VisitAllObjects(me, searcher, range); @@ -323,7 +327,7 @@ namespace Game.AI //Returns a list of all friendly units missing a specific buff within range public List DoFindFriendlyMissingBuff(float range, uint spellId) { - List list = new List(); + List list = new(); var u_check = new FriendlyMissingBuffInRange(me, range, spellId); var searcher = new CreatureListSearcher(me, list, u_check); Cell.VisitAllObjects(me, searcher, range); @@ -332,7 +336,7 @@ namespace Game.AI } //Return a player with at least minimumRange from me - Player GetPlayerAtMinimumRange(float minimumRange) + public Player GetPlayerAtMinimumRange(float minimumRange) { var check = new PlayerAtMinimumRangeAway(me, minimumRange); var searcher = new PlayerSearcher(me, check); @@ -398,7 +402,7 @@ namespace Game.AI return source.FindNearestCreature(entry, maxSearchRange, alive); } - public GameObject GetClosestGameObjectWithEntry(WorldObject source, uint entry, float maxSearchRange) + public static GameObject GetClosestGameObjectWithEntry(WorldObject source, uint entry, float maxSearchRange) { return source.FindNearestGameObject(entry, maxSearchRange); } @@ -429,50 +433,40 @@ namespace Game.AI public T DungeonMode(T normal5, T heroic10) { - switch (_difficulty) + return _difficulty switch { - case Difficulty.Normal: - return normal5; - case Difficulty.Heroic: - default: - return heroic10; - } + Difficulty.Normal => normal5, + _ => heroic10, + }; } public T RaidMode(T normal10, T normal25) { - switch (_difficulty) + return _difficulty switch { - case Difficulty.Raid10N: - return normal10; - case Difficulty.Raid25N: - default: - return normal25; - } - } - public T RaidMode(T normal10, T normal25, T heroic10, T heroic25) - { - switch (_difficulty) - { - case Difficulty.Raid10N: - return normal10; - case Difficulty.Raid25N: - return normal25; - case Difficulty.Raid10HC: - return heroic10; - case Difficulty.Raid25HC: - default: - return heroic25; - } + Difficulty.Raid10N => normal10, + _ => normal25, + }; } - Difficulty _difficulty; - bool _isCombatMovementAllowed; - bool _isHeroic; + public T RaidMode(T normal10, T normal25, T heroic10, T heroic25) + { + return _difficulty switch + { + Difficulty.Raid10N => normal10, + Difficulty.Raid25N => normal25, + Difficulty.Raid10HC => heroic10, + _ => heroic25, + }; + } } public class BossAI : ScriptedAI { + public InstanceScript instance; + public SummonList summons; + uint _bossId; + public BossAI(Creature creature, uint bossId) : base(creature) { instance = creature.GetInstanceScript(); @@ -615,14 +609,12 @@ namespace Game.AI public override bool CanAIAttack(Unit victim) { return CheckBoundary(victim); } public void _JustReachedHome() { me.SetActive(false); } - - public InstanceScript instance; - public SummonList summons; - uint _bossId; } public class WorldBossAI : ScriptedAI { + SummonList summons; + public WorldBossAI(Creature creature) : base(creature) { summons = new SummonList(creature); @@ -695,15 +687,15 @@ namespace Game.AI public override void EnterCombat(Unit who) { _EnterCombat(); } public override void JustDied(Unit killer) { _JustDied(); } - - SummonList summons; } public class SummonList : List { + Creature _me; + public SummonList(Creature creature) { - me = creature; + _me = creature; } public void Summon(Creature summon) { Add(summon.GetGUID()); } @@ -712,7 +704,7 @@ namespace Game.AI { foreach (var id in this) { - Creature summon = ObjectAccessor.GetCreature(me, id); + Creature summon = ObjectAccessor.GetCreature(_me, id); if (summon && summon.IsAIEnabled && (entry == 0 || summon.GetEntry() == entry)) { summon.GetAI().DoZoneInCombat(null, maxRangeToNearestTarget); @@ -724,7 +716,7 @@ namespace Game.AI { foreach (var id in this) { - Creature summon = ObjectAccessor.GetCreature(me, id); + Creature summon = ObjectAccessor.GetCreature(_me, id); if (!summon) Remove(id); else if (summon.GetEntry() == entry) @@ -739,7 +731,7 @@ namespace Game.AI { while (!this.Empty()) { - Creature summon = ObjectAccessor.GetCreature(me, this.FirstOrDefault()); + Creature summon = ObjectAccessor.GetCreature(_me, this.FirstOrDefault()); RemoveAt(0); if (summon) summon.DespawnOrUnsummon(); @@ -762,7 +754,7 @@ namespace Game.AI { foreach (var id in this) { - if (!ObjectAccessor.GetCreature(me, id)) + if (!ObjectAccessor.GetCreature(_me, id)) Remove(id); } } @@ -770,7 +762,7 @@ namespace Game.AI public void DoAction(int info, ICheck predicate, ushort max = 0) { // We need to use a copy of SummonList here, otherwise original SummonList would be modified - List listCopy = new List(this); + List listCopy = new(this); listCopy.RandomResize(predicate.Invoke, max); DoActionImpl(info, listCopy); } @@ -778,7 +770,7 @@ namespace Game.AI public void DoAction(int info, Predicate predicate, ushort max = 0) { // We need to use a copy of SummonList here, otherwise original SummonList would be modified - List listCopy = new List(this); + List listCopy = new(this); listCopy.RandomResize(predicate, max); DoActionImpl(info, listCopy); } @@ -787,7 +779,7 @@ namespace Game.AI { foreach (var id in this) { - Creature summon = ObjectAccessor.GetCreature(me, id); + Creature summon = ObjectAccessor.GetCreature(_me, id); if (summon && summon.GetEntry() == entry) return true; } @@ -799,24 +791,22 @@ namespace Game.AI { foreach (var guid in summons) { - Creature summon = ObjectAccessor.GetCreature(me, guid); + Creature summon = ObjectAccessor.GetCreature(_me, guid); if (summon && summon.IsAIEnabled) summon.GetAI().DoAction(action); } } - - Creature me; } public class EntryCheckPredicate : ICheck { + uint _entry; + public EntryCheckPredicate(uint entry) { _entry = entry; } public bool Invoke(ObjectGuid guid) { return guid.GetEntry() == _entry; } - - uint _entry; } } diff --git a/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs b/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs index b879d9492..3c26baa51 100644 --- a/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs +++ b/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs @@ -212,7 +212,7 @@ namespace Game.AI Log.outDebug(LogFilter.Scripts, "EscortAI.UpdateAI: reached end of waypoints, despawning at end"); if (_returnToStart) { - Position respawnPosition = new Position(); + Position respawnPosition = new(); float orientation; me.GetRespawnPosition(out respawnPosition.posX, out respawnPosition.posY, out respawnPosition.posZ, out orientation); respawnPosition.SetOrientation(orientation); @@ -338,7 +338,7 @@ namespace Game.AI GridDefines.NormalizeMapCoord(ref x); GridDefines.NormalizeMapCoord(ref y); - WaypointNode waypoint = new WaypointNode(); + WaypointNode waypoint = new(); waypoint.id = id; waypoint.x = x; waypoint.y = y; diff --git a/Source/Game/AI/ScriptedAI/ScriptedFollowerAI.cs b/Source/Game/AI/ScriptedAI/ScriptedFollowerAI.cs index 4d1989f6e..5271cef4d 100644 --- a/Source/Game/AI/ScriptedAI/ScriptedFollowerAI.cs +++ b/Source/Game/AI/ScriptedAI/ScriptedFollowerAI.cs @@ -35,11 +35,17 @@ namespace Game.AI class FollowerAI : ScriptedAI { + ObjectGuid _leaderGUID; + uint _updateFollowTimer; + FollowState _followState; + + Quest _questForFollow; //normally we have a quest + public FollowerAI(Creature creature) : base(creature) { - m_uiUpdateFollowTimer = 2500; - m_uiFollowState = FollowState.None; - m_pQuestForFollow = null; + _updateFollowTimer = 2500; + _followState = FollowState.None; + _questForFollow = null; } public override void AttackStart(Unit who) @@ -124,7 +130,7 @@ namespace Game.AI public override void JustDied(Unit killer) { - if (!HasFollowState(FollowState.Inprogress) || m_uiLeaderGUID.IsEmpty() || m_pQuestForFollow == null) + if (!HasFollowState(FollowState.Inprogress) || _leaderGUID.IsEmpty() || _questForFollow == null) return; // @todo need a better check for quests with time limit. @@ -139,17 +145,17 @@ namespace Game.AI Player member = groupRef.GetSource(); if (member) if (member.IsInMap(player)) - member.FailQuest(m_pQuestForFollow.Id); + member.FailQuest(_questForFollow.Id); } } else - player.FailQuest(m_pQuestForFollow.Id); + player.FailQuest(_questForFollow.Id); } } public override void JustAppeared() { - m_uiFollowState = FollowState.None; + _followState = FollowState.None; if (!IsCombatMovementAllowed()) SetCombatMovement(true); @@ -191,7 +197,7 @@ namespace Game.AI { if (HasFollowState(FollowState.Inprogress) && !me.GetVictim()) { - if (m_uiUpdateFollowTimer <= uiDiff) + if (_updateFollowTimer <= uiDiff) { if (HasFollowState(FollowState.Complete) && !HasFollowState(FollowState.PostEvent)) { @@ -241,10 +247,10 @@ namespace Game.AI return; } - m_uiUpdateFollowTimer = 1000; + _updateFollowTimer = 1000; } else - m_uiUpdateFollowTimer -= uiDiff; + _updateFollowTimer -= uiDiff; } UpdateFollowerAI(uiDiff); @@ -275,7 +281,7 @@ namespace Game.AI } } - void StartFollow(Player player, uint factionForFollower = 0, Quest quest = null) + public void StartFollow(Player player, uint factionForFollower = 0, Quest quest = null) { if (me.GetVictim()) { @@ -290,12 +296,12 @@ namespace Game.AI } //set variables - m_uiLeaderGUID = player.GetGUID(); + _leaderGUID = player.GetGUID(); if (factionForFollower != 0) me.SetFaction(factionForFollower); - m_pQuestForFollow = quest; + _questForFollow = quest; if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Waypoint) { @@ -311,12 +317,12 @@ namespace Game.AI me.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle); - Log.outDebug(LogFilter.Scripts, "FollowerAI start follow {0} ({1})", player.GetName(), m_uiLeaderGUID.ToString()); + Log.outDebug(LogFilter.Scripts, "FollowerAI start follow {0} ({1})", player.GetName(), _leaderGUID.ToString()); } Player GetLeaderForFollower() { - Player player = Global.ObjAccessor.GetPlayer(me, m_uiLeaderGUID); + Player player = Global.ObjAccessor.GetPlayer(me, _leaderGUID); if (player) { if (player.IsAlive()) @@ -332,7 +338,7 @@ namespace Game.AI if (member && me.IsWithinDistInMap(member, 100.0f) && member.IsAlive()) { Log.outDebug(LogFilter.Scripts, "FollowerAI GetLeader changed and returned new leader."); - m_uiLeaderGUID = member.GetGUID(); + _leaderGUID = member.GetGUID(); return member; } } @@ -344,7 +350,7 @@ namespace Game.AI return null; } - void SetFollowComplete(bool bWithEndEvent = false) + public void SetFollowComplete(bool bWithEndEvent = false) { if (me.HasUnitState(UnitState.Follow)) { @@ -366,15 +372,9 @@ namespace Game.AI AddFollowState(FollowState.Complete); } - bool HasFollowState(FollowState uiFollowState) { return (m_uiFollowState & uiFollowState) != 0; } + bool HasFollowState(FollowState uiFollowState) { return (_followState & uiFollowState) != 0; } - void AddFollowState(FollowState uiFollowState) { m_uiFollowState |= uiFollowState; } - void RemoveFollowState(FollowState uiFollowState) { m_uiFollowState &= ~uiFollowState; } - - ObjectGuid m_uiLeaderGUID; - uint m_uiUpdateFollowTimer; - FollowState m_uiFollowState; - - Quest m_pQuestForFollow; //normally we have a quest + void AddFollowState(FollowState uiFollowState) { _followState |= uiFollowState; } + void RemoveFollowState(FollowState uiFollowState) { _followState &= ~uiFollowState; } } } diff --git a/Source/Game/AI/SmartScripts/SmartAI.cs b/Source/Game/AI/SmartScripts/SmartAI.cs index 36259becc..e5044b618 100644 --- a/Source/Game/AI/SmartScripts/SmartAI.cs +++ b/Source/Game/AI/SmartScripts/SmartAI.cs @@ -31,19 +31,61 @@ namespace Game.AI const int SMART_ESCORT_MAX_PLAYER_DIST = 60; const int SMART_MAX_AID_DIST = SMART_ESCORT_MAX_PLAYER_DIST / 2; + public uint EscortQuestID; + + SmartScript _script = new(); + + bool _isCharmed; + uint _followCreditType; + uint _followArrivedTimer; + uint _followCredit; + uint _followArrivedEntry; + ObjectGuid _followGuid; + float _followDist; + float _followAngle; + + SmartEscortState _escortState; + uint _escortNPCFlags; + uint _escortInvokerCheckTimer; + WaypointPath _path; + uint _currentWaypointNode; + bool _waypointReached; + uint _waypointPauseTimer; + bool _waypointPauseForced; + bool _repeatWaypointPath; + bool _OOCReached; + bool _waypointPathEnded; + + bool _run; + bool _evadeDisabled; + bool _canAutoAttack; + bool _canCombatMove; + uint _invincibilityHpLevel; + + uint _despawnTime; + uint _respawnTime; + uint _despawnState; + + // Vehicle conditions + bool _hasConditions; + uint _conditionsTimer; + + // Gossip + bool _gossipReturn; + public SmartAI(Creature creature) : base(creature) { _escortInvokerCheckTimer = 1000; - mRun = true; - mCanAutoAttack = true; - mCanCombatMove = true; + _run = true; + _canAutoAttack = true; + _canCombatMove = true; - mHasConditions = Global.ConditionMgr.HasConditionsForNotGroupedEntry(ConditionSourceType.CreatureTemplateVehicle, creature.GetEntry()); + _hasConditions = Global.ConditionMgr.HasConditionsForNotGroupedEntry(ConditionSourceType.CreatureTemplateVehicle, creature.GetEntry()); } bool IsAIControlled() { - return !mIsCharmed; + return !_isCharmed; } public void StartPath(bool run = false, uint pathId = 0, bool repeat = false, Unit invoker = null, uint nodeId = 1) @@ -57,6 +99,8 @@ namespace Game.AI if (HasEscortState(SmartEscortState.Escorting)) StopPath(); + SetRun(run); + if (pathId != 0) { if (!LoadPath(pathId)) @@ -104,7 +148,7 @@ namespace Game.AI { GridDefines.NormalizeMapCoord(ref waypoint.x); GridDefines.NormalizeMapCoord(ref waypoint.y); - waypoint.moveType = mRun ? WaypointMoveType.Run : WaypointMoveType.Walk; + waypoint.moveType = _run ? WaypointMoveType.Run : WaypointMoveType.Walk; } GetScript().SetPathId(entry); @@ -118,8 +162,8 @@ namespace Game.AI me.PauseMovement(delay, MovementSlot.Idle, forced); if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Waypoint) { - var waypointInfo = me.GetCurrentWaypointInfo(); - GetScript().ProcessEventsFor(SmartEvents.WaypointPaused, null, waypointInfo.nodeId, waypointInfo.pathId); + var (nodeId, pathId) = me.GetCurrentWaypointInfo(); + GetScript().ProcessEventsFor(SmartEvents.WaypointPaused, null, nodeId, pathId); } return; } @@ -135,7 +179,7 @@ namespace Game.AI if (forced) { _waypointPauseForced = forced; - SetRun(mRun); + SetRun(_run); me.PauseMovement(); me.SetHomePosition(me.GetPosition()); } @@ -154,7 +198,7 @@ namespace Game.AI if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Waypoint) waypointInfo = me.GetCurrentWaypointInfo(); - if (mDespawnState != 2) + if (_despawnState != 2) SetDespawnTime(despawnTime); me.GetMotionMaster().MoveIdle(); @@ -166,16 +210,16 @@ namespace Game.AI { if (waypointInfo.Item1 != 0) GetScript().ProcessEventsFor(SmartEvents.WaypointEnded, null, waypointInfo.Item1, waypointInfo.Item2); - if (mDespawnState == 1) + if (_despawnState == 1) StartDespawn(); } return; } if (quest != 0) - mEscortQuestID = quest; + EscortQuestID = quest; - if (mDespawnState != 2) + if (_despawnState != 2) SetDespawnTime(despawnTime); me.GetMotionMaster().MoveIdle(); @@ -198,16 +242,16 @@ namespace Game.AI } List targets = GetScript().GetStoredTargetList(SharedConst.SmartEscortTargets, me); - if (targets != null && mEscortQuestID != 0) + if (targets != null && EscortQuestID != 0) { if (targets.Count == 1 && GetScript().IsPlayer(targets.First())) { Player player = targets.First().ToPlayer(); if (!fail && player.IsAtGroupRewardDistance(me) && player.GetCorpse() == null) - player.GroupEventHappens(mEscortQuestID, me); + player.GroupEventHappens(EscortQuestID, me); if (fail) - player.FailQuest(mEscortQuestID); + player.FailQuest(EscortQuestID); Group group = player.GetGroup(); if (group) @@ -219,9 +263,9 @@ namespace Game.AI continue; if (!fail && groupGuy.IsAtGroupRewardDistance(me) && !groupGuy.GetCorpse()) - groupGuy.AreaExploredOrEventHappens(mEscortQuestID); + groupGuy.AreaExploredOrEventHappens(EscortQuestID); else if (fail) - groupGuy.FailQuest(mEscortQuestID); + groupGuy.FailQuest(EscortQuestID); } } } @@ -233,9 +277,9 @@ namespace Game.AI { Player player = obj.ToPlayer(); if (!fail && player.IsAtGroupRewardDistance(me) && player.GetCorpse() == null) - player.AreaExploredOrEventHappens(mEscortQuestID); + player.AreaExploredOrEventHappens(EscortQuestID); else if (fail) - player.FailQuest(mEscortQuestID); + player.FailQuest(EscortQuestID); } } } @@ -250,12 +294,12 @@ namespace Game.AI if (_repeatWaypointPath) { if (IsAIControlled()) - StartPath(mRun, GetScript().GetPathId(), _repeatWaypointPath); + StartPath(_run, GetScript().GetPathId(), _repeatWaypointPath); } else GetScript().SetPathId(0); - if (mDespawnState == 1) + if (_despawnState == 1) StartDespawn(); } @@ -269,7 +313,7 @@ namespace Game.AI _waypointReached = false; _waypointPauseTimer = 0; - SetRun(mRun); + SetRun(_run); me.ResumeMovement(); } @@ -298,7 +342,7 @@ namespace Game.AI if (!UpdateVictim()) return; - if (mCanAutoAttack) + if (_canAutoAttack) DoMeleeAttackIfReady(); } @@ -382,7 +426,7 @@ namespace Game.AI if (_currentWaypointNode == _path.nodes.Count) _waypointPathEnded = true; else - SetRun(mRun); + SetRun(_run); } } @@ -411,7 +455,7 @@ namespace Game.AI public override void EnterEvadeMode(EvadeReason why = EvadeReason.Other) { - if (mEvadeDisabled) + if (_evadeDisabled) { GetScript().ProcessEventsFor(SmartEvents.Evade); return; @@ -430,7 +474,7 @@ namespace Game.AI GetScript().ProcessEventsFor(SmartEvents.Evade); // must be after _EnterEvadeMode (spells, auras, ...) - SetRun(mRun); + SetRun(_run); Unit owner = me.GetCharmerOrOwner(); if (owner != null) @@ -445,10 +489,10 @@ namespace Game.AI } else { - Unit target = !mFollowGuid.IsEmpty() ? Global.ObjAccessor.GetUnit(me, mFollowGuid) : null; + Unit target = !_followGuid.IsEmpty() ? Global.ObjAccessor.GetUnit(me, _followGuid) : null; if (target) { - me.GetMotionMaster().MoveFollow(target, mFollowDist, mFollowAngle); + me.GetMotionMaster().MoveFollow(target, _followDist, _followAngle); // evade is not cleared in MoveFollow, so we can't keep it me.ClearUnitState(UnitState.Evade); } @@ -526,9 +570,9 @@ namespace Game.AI public override void JustAppeared() { - mDespawnTime = 0; - mRespawnTime = 0; - mDespawnState = 0; + _despawnTime = 0; + _respawnTime = 0; + _despawnState = 0; _escortState = SmartEscortState.None; me.SetVisible(true); @@ -539,13 +583,13 @@ namespace Game.AI GetScript().OnReset(); GetScript().ProcessEventsFor(SmartEvents.Respawn); - mFollowGuid.Clear();//do not reset follower on Reset(), we need it after combat evade - mFollowDist = 0; - mFollowAngle = 0; - mFollowCredit = 0; - mFollowArrivedTimer = 1000; - mFollowArrivedEntry = 0; - mFollowCreditType = 0; + _followGuid.Clear();//do not reset follower on Reset(), we need it after combat evade + _followDist = 0; + _followAngle = 0; + _followCredit = 0; + _followArrivedTimer = 1000; + _followArrivedEntry = 0; + _followCreditType = 0; } public override void JustReachedHome() @@ -597,18 +641,18 @@ namespace Game.AI if (!IsAIControlled()) { if (who != null) - me.Attack(who, mCanAutoAttack); + me.Attack(who, _canAutoAttack); return; } - if (who != null && me.Attack(who, mCanAutoAttack)) + if (who != null && me.Attack(who, _canAutoAttack)) { me.GetMotionMaster().Clear(MovementSlot.Active); me.PauseMovement(); - if (mCanCombatMove) + if (_canCombatMove) { - SetRun(mRun); + SetRun(_run); me.GetMotionMaster().MoveChase(who); } } @@ -631,8 +675,8 @@ namespace Game.AI if (!IsAIControlled()) // don't allow players to use unkillable units return; - if (mInvincibilityHpLevel != 0 && (damage >= me.GetHealth() - mInvincibilityHpLevel)) - damage = (uint)(me.GetHealth() - mInvincibilityHpLevel); // damage should not be nullified, because of player damage req. + if (_invincibilityHpLevel != 0 && (damage >= me.GetHealth() - _invincibilityHpLevel)) + damage = (uint)(me.GetHealth() - _invincibilityHpLevel); // damage should not be nullified, because of player damage req. } public override void HealReceived(Unit by, uint addhealth) @@ -672,7 +716,7 @@ namespace Game.AI public override void InitializeAI() { - mScript.OnInitialize(me); + _script.OnInitialize(me); if (!me.IsDead()) GetScript().OnReset(); @@ -686,14 +730,14 @@ namespace Game.AI EndPath(true); } - mIsCharmed = apply; + _isCharmed = apply; if (!apply && !me.IsInEvadeMode()) { if (_repeatWaypointPath) - StartPath(mRun, GetScript().GetPathId(), true); + StartPath(_run, GetScript().GetPathId(), true); else - me.SetWalk(!mRun); + me.SetWalk(!_run); Unit charmer = me.GetCharmer(); if (charmer) @@ -728,7 +772,7 @@ namespace Game.AI public void SetRun(bool run) { me.SetWalk(!run); - mRun = run; + _run = run; } public void SetDisableGravity(bool disable = true) @@ -748,7 +792,7 @@ namespace Game.AI public void SetEvadeDisabled(bool disable) { - mEvadeDisabled = disable; + _evadeDisabled = disable; } public override bool GossipHello(Player player) @@ -782,10 +826,10 @@ namespace Game.AI public void SetCombatMove(bool on) { - if (mCanCombatMove == on) + if (_canCombatMove == on) return; - mCanCombatMove = on; + _canCombatMove = on; if (!IsAIControlled()) return; @@ -794,7 +838,7 @@ namespace Game.AI { if (on && !me.HasReactState(ReactStates.Passive) && me.GetVictim() && me.GetMotionMaster().GetMotionSlotType(MovementSlot.Active) == MovementGeneratorType.Max) { - SetRun(mRun); + SetRun(_run); me.GetMotionMaster().MoveChase(me.GetVictim()); } else if (!on && me.GetMotionMaster().GetMotionSlotType(MovementSlot.Active) == MovementGeneratorType.Chase) @@ -810,39 +854,39 @@ namespace Game.AI return; } - mFollowGuid = target.GetGUID(); - mFollowDist = dist; - mFollowAngle = angle; - mFollowArrivedTimer = 1000; - mFollowCredit = credit; - mFollowArrivedEntry = end; - mFollowCreditType = creditType; - SetRun(mRun); - me.GetMotionMaster().MoveFollow(target, mFollowDist, mFollowAngle); + _followGuid = target.GetGUID(); + _followDist = dist; + _followAngle = angle; + _followArrivedTimer = 1000; + _followCredit = credit; + _followArrivedEntry = end; + _followCreditType = creditType; + SetRun(_run); + me.GetMotionMaster().MoveFollow(target, _followDist, _followAngle); } public void StopFollow(bool complete) { - mFollowGuid.Clear(); - mFollowDist = 0; - mFollowAngle = 0; - mFollowCredit = 0; - mFollowArrivedTimer = 1000; - mFollowArrivedEntry = 0; - mFollowCreditType = 0; + _followGuid.Clear(); + _followDist = 0; + _followAngle = 0; + _followCredit = 0; + _followArrivedTimer = 1000; + _followArrivedEntry = 0; + _followCreditType = 0; me.StopMoving(); me.GetMotionMaster().MoveIdle(); if (!complete) return; - Player player = Global.ObjAccessor.GetPlayer(me, mFollowGuid); + Player player = Global.ObjAccessor.GetPlayer(me, _followGuid); if (player != null) { - if (mFollowCreditType == 0) - player.RewardPlayerAndGroupAtEvent(mFollowCredit, me); + if (_followCreditType == 0) + player.RewardPlayerAndGroupAtEvent(_followCredit, me); else - player.GroupEventHappens(mFollowCredit, me); + player.GroupEventHappens(_followCredit, me); } SetDespawnTime(5000); @@ -853,7 +897,7 @@ namespace Game.AI public void SetScript9(SmartScriptHolder e, uint entry, Unit invoker) { if (invoker != null) - GetScript().mLastInvoker = invoker.GetGUID(); + GetScript().LastInvoker = invoker.GetGUID(); GetScript().SetScript9(e, entry); } @@ -872,10 +916,10 @@ namespace Game.AI void CheckConditions(uint diff) { - if (!mHasConditions) + if (!_hasConditions) return; - if (mConditionsTimer <= diff) + if (_conditionsTimer <= diff) { Vehicle vehicleKit = me.GetVehicleKit(); if (vehicleKit != null) @@ -898,10 +942,10 @@ namespace Game.AI } } - mConditionsTimer = 1000; + _conditionsTimer = 1000; } else - mConditionsTimer -= diff; + _conditionsTimer -= diff; } void UpdatePath(uint diff) @@ -913,7 +957,7 @@ namespace Game.AI { if (!IsEscortInvokerInRange()) { - StopPath(0, mEscortQuestID, true); + StopPath(0, EscortQuestID, true); // allow to properly hook out of range despawn action, which in most cases should perform the same operation as dying GetScript().ProcessEventsFor(SmartEvents.Death, me); @@ -957,123 +1001,83 @@ namespace Game.AI void UpdateFollow(uint diff) { - if (mFollowGuid.IsEmpty()) + if (_followGuid.IsEmpty()) { - if (mFollowArrivedTimer < diff) + if (_followArrivedTimer < diff) { - if (me.FindNearestCreature(mFollowArrivedEntry, SharedConst.InteractionDistance, true)) + if (me.FindNearestCreature(_followArrivedEntry, SharedConst.InteractionDistance, true)) { StopFollow(true); return; } - mFollowArrivedTimer = 1000; + _followArrivedTimer = 1000; } else - mFollowArrivedTimer -= diff; + _followArrivedTimer -= diff; } } void UpdateDespawn(uint diff) { - if (mDespawnState <= 1 || mDespawnState > 3) + if (_despawnState <= 1 || _despawnState > 3) return; - if (mDespawnTime < diff) + if (_despawnTime < diff) { - if (mDespawnState == 2) + if (_despawnState == 2) { me.SetVisible(false); - mDespawnTime = 5000; - mDespawnState++; + _despawnTime = 5000; + _despawnState++; } else - me.DespawnOrUnsummon(0, TimeSpan.FromSeconds(mRespawnTime)); + me.DespawnOrUnsummon(0, TimeSpan.FromSeconds(_respawnTime)); } else - mDespawnTime -= diff; + _despawnTime -= diff; } public override void Reset() { if (!HasEscortState(SmartEscortState.Escorting))//dont mess up escort movement after combat - SetRun(mRun); + SetRun(_run); GetScript().OnReset(); } public bool HasEscortState(SmartEscortState uiEscortState) { return (_escortState & uiEscortState) != 0; } public void AddEscortState(SmartEscortState uiEscortState) { _escortState |= uiEscortState; } public void RemoveEscortState(SmartEscortState uiEscortState) { _escortState &= ~uiEscortState; } - public void SetAutoAttack(bool on) { mCanAutoAttack = on; } + public void SetAutoAttack(bool on) { _canAutoAttack = on; } - public bool CanCombatMove() { return mCanCombatMove; } + public bool CanCombatMove() { return _canCombatMove; } - public SmartScript GetScript() { return mScript; } + public SmartScript GetScript() { return _script; } - public void SetInvincibilityHpLevel(uint level) { mInvincibilityHpLevel = level; } + public void SetInvincibilityHpLevel(uint level) { _invincibilityHpLevel = level; } public void SetDespawnTime(uint t, uint r = 0) { - mDespawnTime = t; - mRespawnTime = r; - mDespawnState = t != 0 ? 1 : 0u; + _despawnTime = t; + _respawnTime = r; + _despawnState = t != 0 ? 1 : 0u; } - public void StartDespawn() { mDespawnState = 2; } + public void StartDespawn() { _despawnState = 2; } public void SetWPPauseTimer(uint time) { _waypointPauseTimer = time; } public void SetGossipReturn(bool val) { _gossipReturn = val; } - - public uint mEscortQuestID; - - SmartScript mScript = new SmartScript(); - - bool mIsCharmed; - uint mFollowCreditType; - uint mFollowArrivedTimer; - uint mFollowCredit; - uint mFollowArrivedEntry; - ObjectGuid mFollowGuid; - float mFollowDist; - float mFollowAngle; - - SmartEscortState _escortState; - uint _escortNPCFlags; - uint _escortInvokerCheckTimer; - WaypointPath _path; - uint _currentWaypointNode; - bool _waypointReached; - uint _waypointPauseTimer; - bool _waypointPauseForced; - bool _repeatWaypointPath; - bool _OOCReached; - bool _waypointPathEnded; - - bool mRun; - bool mEvadeDisabled; - bool mCanAutoAttack; - bool mCanCombatMove; - uint mInvincibilityHpLevel; - - uint mDespawnTime; - uint mRespawnTime; - uint mDespawnState; - - // Vehicle conditions - bool mHasConditions; - uint mConditionsTimer; - - // Gossip - bool _gossipReturn; } public class SmartGameObjectAI : GameObjectAI { - public SmartGameObjectAI(GameObject g) : base(g) - { - mScript = new SmartScript(); - } + SmartScript _script = new(); + + // Gossip + bool _gossipReturn; + + public SmartGameObjectAI(GameObject g) : base(g) { } public override void UpdateAI(uint diff) { @@ -1142,7 +1146,7 @@ namespace Game.AI public void SetScript9(SmartScriptHolder e, uint entry, Unit invoker) { if (invoker != null) - GetScript().mLastInvoker = invoker.GetGUID(); + GetScript().LastInvoker = invoker.GetGUID(); GetScript().SetScript9(e, entry); } @@ -1168,16 +1172,13 @@ namespace Game.AI public void SetGossipReturn(bool val) { _gossipReturn = val; } - public SmartScript GetScript() { return mScript; } - - SmartScript mScript; - - // Gossip - bool _gossipReturn; + public SmartScript GetScript() { return _script; } } public class SmartAreaTriggerAI : AreaTriggerAI { + SmartScript _script = new(); + public SmartAreaTriggerAI(AreaTrigger areaTrigger) : base(areaTrigger) { } public override void OnInitialize() @@ -1198,13 +1199,12 @@ namespace Game.AI public void SetScript9(SmartScriptHolder e, uint entry, Unit invoker) { if (invoker) - GetScript().mLastInvoker = invoker.GetGUID(); + GetScript().LastInvoker = invoker.GetGUID(); + GetScript().SetScript9(e, entry); } - SmartScript GetScript() { return mScript; } - - SmartScript mScript; + public SmartScript GetScript() { return _script; } } public enum SmartEscortState diff --git a/Source/Game/AI/SmartScripts/SmartAIManager.cs b/Source/Game/AI/SmartScripts/SmartAIManager.cs index cae5df909..34947934a 100644 --- a/Source/Game/AI/SmartScripts/SmartAIManager.cs +++ b/Source/Game/AI/SmartScripts/SmartAIManager.cs @@ -22,17 +22,19 @@ using Game.Entities; using Game.Spells; using System; using System.Collections.Generic; -using System.IO; using System.Runtime.InteropServices; namespace Game.AI { public class SmartAIManager : Singleton { + MultiMap[] _eventMap = new MultiMap[(int)SmartScriptType.Max]; + Dictionary _waypointStore = new(); + SmartAIManager() { for (byte i = 0; i < (int)SmartScriptType.Max; i++) - mEventMap[i] = new MultiMap(); + _eventMap[i] = new MultiMap(); } public void LoadFromDB() @@ -40,7 +42,7 @@ namespace Game.AI uint oldMSTime = Time.GetMSTime(); for (byte i = 0; i < (int)SmartScriptType.Max; i++) - mEventMap[i].Clear(); //Drop Existing SmartAI List + _eventMap[i].Clear(); //Drop Existing SmartAI List PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_SMART_SCRIPTS); SQLResult result = DB.World.Query(stmt); @@ -53,59 +55,59 @@ namespace Game.AI int count = 0; do { - SmartScriptHolder temp = new SmartScriptHolder(); + SmartScriptHolder temp = new(); - temp.entryOrGuid = result.Read(0); + temp.EntryOrGuid = result.Read(0); SmartScriptType source_type = (SmartScriptType)result.Read(1); if (source_type >= SmartScriptType.Max) { Log.outError(LogFilter.Sql, "SmartAIMgr.LoadSmartAI: invalid source_type ({0}), skipped loading.", source_type); continue; } - if (temp.entryOrGuid >= 0) + if (temp.EntryOrGuid >= 0) { switch (source_type) { case SmartScriptType.Creature: - if (Global.ObjectMgr.GetCreatureTemplate((uint)temp.entryOrGuid) == null) + if (Global.ObjectMgr.GetCreatureTemplate((uint)temp.EntryOrGuid) == null) { - Log.outError(LogFilter.Sql, "SmartAIMgr.LoadSmartAI: Creature entry ({0}) does not exist, skipped loading.", temp.entryOrGuid); + Log.outError(LogFilter.Sql, "SmartAIMgr.LoadSmartAI: Creature entry ({0}) does not exist, skipped loading.", temp.EntryOrGuid); continue; } break; case SmartScriptType.GameObject: { - if (Global.ObjectMgr.GetGameObjectTemplate((uint)temp.entryOrGuid) == null) + if (Global.ObjectMgr.GetGameObjectTemplate((uint)temp.EntryOrGuid) == null) { - Log.outError(LogFilter.Sql, "SmartAIMgr.LoadSmartAI: GameObject entry ({0}) does not exist, skipped loading.", temp.entryOrGuid); + Log.outError(LogFilter.Sql, "SmartAIMgr.LoadSmartAI: GameObject entry ({0}) does not exist, skipped loading.", temp.EntryOrGuid); continue; } break; } case SmartScriptType.AreaTrigger: { - if (CliDB.AreaTableStorage.LookupByKey((uint)temp.entryOrGuid) == null) + if (CliDB.AreaTableStorage.LookupByKey((uint)temp.EntryOrGuid) == null) { - Log.outError(LogFilter.Sql, "SmartAIMgr.LoadSmartAI: AreaTrigger entry ({0}) does not exist, skipped loading.", temp.entryOrGuid); + Log.outError(LogFilter.Sql, "SmartAIMgr.LoadSmartAI: AreaTrigger entry ({0}) does not exist, skipped loading.", temp.EntryOrGuid); continue; } break; } case SmartScriptType.Scene: { - if (Global.ObjectMgr.GetSceneTemplate((uint)temp.entryOrGuid) == null) + if (Global.ObjectMgr.GetSceneTemplate((uint)temp.EntryOrGuid) == null) { - Log.outError(LogFilter.Sql, "SmartAIMgr.LoadSmartAIFromDB: Scene id ({0}) does not exist, skipped loading.", temp.entryOrGuid); + Log.outError(LogFilter.Sql, "SmartAIMgr.LoadSmartAIFromDB: Scene id ({0}) does not exist, skipped loading.", temp.EntryOrGuid); continue; } break; } case SmartScriptType.Quest: { - if (Global.ObjectMgr.GetQuestTemplate((uint)temp.entryOrGuid) == null) + if (Global.ObjectMgr.GetQuestTemplate((uint)temp.EntryOrGuid) == null) { - Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: Quest id ({temp.entryOrGuid}) does not exist, skipped loading."); + Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: Quest id ({temp.EntryOrGuid}) does not exist, skipped loading."); continue; } break; @@ -114,18 +116,18 @@ namespace Game.AI break;//nothing to check, really case SmartScriptType.AreaTriggerEntity: { - if (Global.AreaTriggerDataStorage.GetAreaTriggerTemplate(new AreaTriggerId((uint)temp.entryOrGuid, false)) == null) + if (Global.AreaTriggerDataStorage.GetAreaTriggerTemplate(new AreaTriggerId((uint)temp.EntryOrGuid, false)) == null) { - Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: AreaTrigger entry ({temp.entryOrGuid} IsServerSide false) does not exist, skipped loading."); + Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: AreaTrigger entry ({temp.EntryOrGuid} IsServerSide false) does not exist, skipped loading."); continue; } break; } case SmartScriptType.AreaTriggerEntityServerside: { - if (Global.AreaTriggerDataStorage.GetAreaTriggerTemplate(new AreaTriggerId((uint)temp.entryOrGuid, true)) == null) + if (Global.AreaTriggerDataStorage.GetAreaTriggerTemplate(new AreaTriggerId((uint)temp.EntryOrGuid, true)) == null) { - Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: AreaTrigger entry ({temp.entryOrGuid} IsServerSide true) does not exist, skipped loading."); + Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: AreaTrigger entry ({temp.EntryOrGuid} IsServerSide true) does not exist, skipped loading."); continue; } break; @@ -141,46 +143,46 @@ namespace Game.AI { case SmartScriptType.Creature: { - CreatureData creature = Global.ObjectMgr.GetCreatureData((ulong)-temp.entryOrGuid); + CreatureData creature = Global.ObjectMgr.GetCreatureData((ulong)-temp.EntryOrGuid); if (creature == null) { - Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: Creature guid ({-temp.entryOrGuid}) does not exist, skipped loading."); + Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: Creature guid ({-temp.EntryOrGuid}) does not exist, skipped loading."); continue; } CreatureTemplate creatureInfo = Global.ObjectMgr.GetCreatureTemplate(creature.Id); if (creatureInfo == null) { - Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: Creature entry ({creature.Id}) guid ({-temp.entryOrGuid}) does not exist, skipped loading."); + Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: Creature entry ({creature.Id}) guid ({-temp.EntryOrGuid}) does not exist, skipped loading."); continue; } if (creatureInfo.AIName != "SmartAI") { - Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: Creature entry ({creature.Id}) guid ({-temp.entryOrGuid}) is not using SmartAI, skipped loading."); + Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: Creature entry ({creature.Id}) guid ({-temp.EntryOrGuid}) is not using SmartAI, skipped loading."); continue; } break; } case SmartScriptType.GameObject: { - GameObjectData gameObject = Global.ObjectMgr.GetGameObjectData((ulong)-temp.entryOrGuid); + GameObjectData gameObject = Global.ObjectMgr.GetGameObjectData((ulong)-temp.EntryOrGuid); if (gameObject == null) { - Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: GameObject guid ({-temp.entryOrGuid}) does not exist, skipped loading."); + Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: GameObject guid ({-temp.EntryOrGuid}) does not exist, skipped loading."); continue; } GameObjectTemplate gameObjectInfo = Global.ObjectMgr.GetGameObjectTemplate(gameObject.Id); if (gameObjectInfo == null) { - Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: GameObject entry ({gameObject.Id}) guid ({-temp.entryOrGuid}) does not exist, skipped loading."); + Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: GameObject entry ({gameObject.Id}) guid ({-temp.EntryOrGuid}) does not exist, skipped loading."); continue; } if (gameObjectInfo.AIName != "SmartGameObjectAI") { - Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: GameObject entry ({gameObject.Id}) guid ({-temp.entryOrGuid}) is not using SmartGameObjectAI, skipped loading."); + Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: GameObject entry ({gameObject.Id}) guid ({-temp.EntryOrGuid}) is not using SmartGameObjectAI, skipped loading."); continue; } break; @@ -191,9 +193,9 @@ namespace Game.AI } } - temp.source_type = source_type; - temp.event_id = result.Read(2); - temp.link = result.Read(3); + temp.SourceType = source_type; + temp.EventId = result.Read(2); + temp.Link = result.Read(3); temp.Event.type = (SmartEvents)result.Read(4); temp.Event.event_phase_mask = result.Read(5); temp.Event.event_chance = result.Read(6); @@ -247,25 +249,25 @@ namespace Game.AI case SmartEvents.FriendlyMissingBuff: case SmartEvents.HasAura: case SmartEvents.TargetBuffed: - if (temp.Event.minMaxRepeat.repeatMin == 0 && temp.Event.minMaxRepeat.repeatMax == 0 && !temp.Event.event_flags.HasAnyFlag(SmartEventFlags.NotRepeatable) && temp.source_type != SmartScriptType.TimedActionlist) + if (temp.Event.minMaxRepeat.repeatMin == 0 && temp.Event.minMaxRepeat.repeatMax == 0 && !temp.Event.event_flags.HasAnyFlag(SmartEventFlags.NotRepeatable) && temp.SourceType != SmartScriptType.TimedActionlist) { temp.Event.event_flags |= SmartEventFlags.NotRepeatable; - Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: Entry {temp.entryOrGuid} SourceType {temp.GetScriptType()}, Event {temp.event_id}, Missing Repeat flag."); + Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: Entry {temp.EntryOrGuid} SourceType {temp.GetScriptType()}, Event {temp.EventId}, Missing Repeat flag."); } break; case SmartEvents.VictimCasting: case SmartEvents.IsBehindTarget: - if (temp.Event.minMaxRepeat.min == 0 && temp.Event.minMaxRepeat.max == 0 && !temp.Event.event_flags.HasAnyFlag(SmartEventFlags.NotRepeatable) && temp.source_type != SmartScriptType.TimedActionlist) + if (temp.Event.minMaxRepeat.min == 0 && temp.Event.minMaxRepeat.max == 0 && !temp.Event.event_flags.HasAnyFlag(SmartEventFlags.NotRepeatable) && temp.SourceType != SmartScriptType.TimedActionlist) { temp.Event.event_flags |= SmartEventFlags.NotRepeatable; - Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: Entry {temp.entryOrGuid} SourceType {temp.GetScriptType()}, Event {temp.event_id}, Missing Repeat flag."); + Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: Entry {temp.EntryOrGuid} SourceType {temp.GetScriptType()}, Event {temp.EventId}, Missing Repeat flag."); } break; case SmartEvents.FriendlyIsCc: - if (temp.Event.friendlyCC.repeatMin == 0 && temp.Event.friendlyCC.repeatMax == 0 && !temp.Event.event_flags.HasAnyFlag(SmartEventFlags.NotRepeatable) && temp.source_type != SmartScriptType.TimedActionlist) + if (temp.Event.friendlyCC.repeatMin == 0 && temp.Event.friendlyCC.repeatMax == 0 && !temp.Event.event_flags.HasAnyFlag(SmartEventFlags.NotRepeatable) && temp.SourceType != SmartScriptType.TimedActionlist) { temp.Event.event_flags |= SmartEventFlags.NotRepeatable; - Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: Entry {temp.entryOrGuid} SourceType {temp.GetScriptType()}, Event {temp.event_id}, Missing Repeat flag."); + Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadSmartAIFromDB: Entry {temp.EntryOrGuid} SourceType {temp.GetScriptType()}, Event {temp.EventId}, Missing Repeat flag."); } break; default: @@ -273,40 +275,40 @@ namespace Game.AI } // creature entry / guid not found in storage, create empty event list for it and increase counters - if (!mEventMap[(int)source_type].ContainsKey(temp.entryOrGuid)) + if (!_eventMap[(int)source_type].ContainsKey(temp.EntryOrGuid)) ++count; // store the new event - mEventMap[(int)source_type].Add(temp.entryOrGuid, temp); + _eventMap[(int)source_type].Add(temp.EntryOrGuid, temp); } while (result.NextRow()); // Post Loading Validation for (byte i = 0; i < (int)SmartScriptType.Max; ++i) { - if (mEventMap[i] == null) + if (_eventMap[i] == null) continue; - foreach (var key in mEventMap[i].Keys) + foreach (var key in _eventMap[i].Keys) { - var list = mEventMap[i].LookupByKey(key); + var list = _eventMap[i].LookupByKey(key); foreach (var e in list) { - if (e.link != 0) + if (e.Link != 0) { - if (FindLinkedEvent(list, e.link) == null) + if (FindLinkedEvent(list, e.Link) == null) { Log.outError(LogFilter.Sql, "SmartAIMgr.LoadFromDB: Entry {0} SourceType {1}, Event {2}, Link Event {3} not found or invalid.", - e.entryOrGuid, e.GetScriptType(), e.event_id, e.link); + e.EntryOrGuid, e.GetScriptType(), e.EventId, e.Link); } } if (e.GetEventType() == SmartEvents.Link) { - if (FindLinkedSourceEvent(list, e.event_id) == null) + if (FindLinkedSourceEvent(list, e.EventId) == null) { Log.outError(LogFilter.Sql, "SmartAIMgr.LoadFromDB: Entry {0} SourceType {1}, Event {2}, Link Source Event not found or invalid. Event will never trigger.", - e.entryOrGuid, e.GetScriptType(), e.event_id); + e.EntryOrGuid, e.GetScriptType(), e.EventId); } } } @@ -371,11 +373,11 @@ namespace Game.AI Log.outInfo(LogFilter.ServerLoading, $"Loaded {count} SmartAI waypoint paths (total {total} waypoints) in {Time.GetMSTimeDiffToNow(oldMSTime)} ms"); } - bool IsTargetValid(SmartScriptHolder e) + static bool IsTargetValid(SmartScriptHolder e) { if (Math.Abs(e.Target.o) > 2 * MathFunctions.PI) Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} has abs(`target.o` = {4}) > 2*PI (orientation is expressed in radians)", - e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Target.o); + e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Target.o); if (e.GetActionType() == SmartActions.InstallAiTemplate) return true; // AI template has special handling @@ -387,7 +389,7 @@ namespace Game.AI { if (e.Target.unitDistance.creature != 0 && Global.ObjectMgr.GetCreatureTemplate(e.Target.unitDistance.creature) == null) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Creature entry {4} as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Target.unitDistance.creature); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Creature entry {4} as target_param1, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Target.unitDistance.creature); return false; } break; @@ -397,7 +399,7 @@ namespace Game.AI { if (e.Target.goDistance.entry != 0 && Global.ObjectMgr.GetGameObjectTemplate(e.Target.goDistance.entry) == null) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent GameObject entry {4} as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Target.goDistance.entry); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent GameObject entry {4} as target_param1, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Target.goDistance.entry); return false; } break; @@ -419,7 +421,7 @@ namespace Game.AI { if (e.Target.playerDistance.dist == 0) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} has maxDist 0 as target_param1, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType()); return false; } break; @@ -449,17 +451,17 @@ namespace Game.AI case SmartTargets.SpellTarget: break; default: - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Not handled target_type({0}), Entry {1} SourceType {2} Event {3} Action {4}, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Not handled target_type({0}), Entry {1} SourceType {2} Event {3} Action {4}, skipped.", e.GetTargetType(), e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType()); return false; } return true; } - bool IsSpellVisualKitValid(SmartScriptHolder e, uint entry) + static bool IsSpellVisualKitValid(SmartScriptHolder e, uint entry) { if (!CliDB.SpellVisualKitStorage.ContainsKey(entry)) { - Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.entryOrGuid} SourceType {e.GetScriptType()} Event {e.event_id} Action {e.GetActionType()} uses non-existent SpellVisualKit entry {entry}, skipped."); + Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.EntryOrGuid} SourceType {e.GetScriptType()} Event {e.EventId} Action {e.GetActionType()} uses non-existent SpellVisualKit entry {entry}, skipped."); return false; } return true; @@ -469,34 +471,34 @@ namespace Game.AI { if (e.Event.type >= SmartEvents.End) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: EntryOrGuid {0} using event({1}) has invalid event type ({2}), skipped.", e.entryOrGuid, e.event_id, e.GetEventType()); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: EntryOrGuid {0} using event({1}) has invalid event type ({2}), skipped.", e.EntryOrGuid, e.EventId, e.GetEventType()); return false; } // in SMART_SCRIPT_TYPE_TIMED_ACTIONLIST all event types are overriden by core - if (e.GetScriptType() != SmartScriptType.TimedActionlist && !Convert.ToBoolean(SmartAIEventMask[e.Event.type] & SmartAITypeMask[e.GetScriptType()])) + if (e.GetScriptType() != SmartScriptType.TimedActionlist && !Convert.ToBoolean(GetEventMask(e.Event.type) & GetTypeMask(e.GetScriptType()))) { - Log.outError(LogFilter.Scripts, "SmartAIMgr: EntryOrGuid {0}, event type {1} can not be used for Script type {2}", e.entryOrGuid, e.GetEventType(), e.GetScriptType()); + Log.outError(LogFilter.Scripts, "SmartAIMgr: EntryOrGuid {0}, event type {1} can not be used for Script type {2}", e.EntryOrGuid, e.GetEventType(), e.GetScriptType()); return false; } if (e.Action.type <= 0 || e.Action.type >= SmartActions.End) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: EntryOrGuid {0} using event({1}) has invalid action type ({2}), skipped.", e.entryOrGuid, e.event_id, e.GetActionType()); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: EntryOrGuid {0} using event({1}) has invalid action type ({2}), skipped.", e.EntryOrGuid, e.EventId, e.GetActionType()); return false; } if (e.Event.event_phase_mask > (uint)SmartEventPhaseBits.All) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: EntryOrGuid {0} using event({1}) has invalid phase mask ({2}), skipped.", e.entryOrGuid, e.event_id, e.Event.event_phase_mask); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: EntryOrGuid {0} using event({1}) has invalid phase mask ({2}), skipped.", e.EntryOrGuid, e.EventId, e.Event.event_phase_mask); return false; } if (e.Event.event_flags > SmartEventFlags.All) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: EntryOrGuid {0} using event({1}) has invalid event flags ({2}), skipped.", e.entryOrGuid, e.event_id, e.Event.event_flags); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: EntryOrGuid {0} using event({1}) has invalid event flags ({2}), skipped.", e.EntryOrGuid, e.EventId, e.Event.event_flags); return false; } - if (e.link != 0 && e.link == e.event_id) + if (e.Link != 0 && e.Link == e.EventId) { - Log.outError(LogFilter.Sql, "SmartAIMgr: EntryOrGuid {0} SourceType {1}, Event {2}, Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id); + Log.outError(LogFilter.Sql, "SmartAIMgr: EntryOrGuid {0} SourceType {1}, Event {2}, Event is linking self (infinite loop), skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId); return false; } if (e.GetScriptType() == SmartScriptType.TimedActionlist) @@ -536,12 +538,12 @@ namespace Game.AI SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(e.Event.spellHit.spell, Difficulty.None); if (spellInfo == null) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Spell entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Event.spellHit.spell); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Spell entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Event.spellHit.spell); return false; } if (e.Event.spellHit.school != 0 && ((SpellSchoolMask)e.Event.spellHit.school & spellInfo.SchoolMask) != spellInfo.SchoolMask) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses Spell entry {4} with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Event.spellHit.spell); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses Spell entry {4} with invalid school mask, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Event.spellHit.spell); return false; } } @@ -556,12 +558,12 @@ namespace Game.AI case SmartEvents.Respawn: if (e.Event.respawn.type == (uint)SmartRespawnCondition.Map && CliDB.MapStorage.LookupByKey(e.Event.respawn.map) == null) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Map entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Event.respawn.map); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Map entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Event.respawn.map); return false; } if (e.Event.respawn.type == (uint)SmartRespawnCondition.Area && !CliDB.AreaTableStorage.ContainsKey(e.Event.respawn.area)) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Area entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Event.respawn.area); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Area entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Event.respawn.area); return false; } break; @@ -598,7 +600,7 @@ namespace Game.AI case SmartEvents.VictimCasting: if (e.Event.targetCasting.spellId > 0 && !Global.SpellMgr.HasSpellInfo(e.Event.targetCasting.spellId, Difficulty.None)) { - Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.entryOrGuid} SourceType {e.GetScriptType()} Event {e.event_id} Action {e.GetActionType()} uses non-existent Spell entry {e.Event.spellHit.spell}, skipped."); + Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.EntryOrGuid} SourceType {e.GetScriptType()} Event {e.EventId} Action {e.GetActionType()} uses non-existent Spell entry {e.Event.spellHit.spell}, skipped."); return false; } @@ -652,7 +654,7 @@ namespace Game.AI { if (e.Event.movementInform.type >= (uint)MovementGeneratorType.Max) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses invalid Motion type {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Event.movementInform.type); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses invalid Motion type {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Event.movementInform.type); return false; } break; @@ -667,7 +669,7 @@ namespace Game.AI { if (e.Event.areatrigger.id != 0 && (e.GetScriptType() == SmartScriptType.AreaTriggerEntity || e.GetScriptType() == SmartScriptType.AreaTriggerEntityServerside)) { - Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.entryOrGuid} SourceType {e.GetScriptType()} Event {e.event_id} Action {e.GetActionType()} areatrigger param not supported for SMART_SCRIPT_TYPE_AREATRIGGER_ENTITY and SMART_SCRIPT_TYPE_AREATRIGGER_ENTITY_SERVERSIDE, skipped."); + Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.EntryOrGuid} SourceType {e.GetScriptType()} Event {e.EventId} Action {e.GetActionType()} areatrigger param not supported for SMART_SCRIPT_TYPE_AREATRIGGER_ENTITY and SMART_SCRIPT_TYPE_AREATRIGGER_ENTITY_SERVERSIDE, skipped."); return false; } @@ -721,7 +723,7 @@ namespace Game.AI { if (e.Event.doAction.eventId > EventId.Charge) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses invalid event id {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Event.doAction.eventId); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses invalid event id {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Event.doAction.eventId); return false; } break; @@ -732,7 +734,7 @@ namespace Game.AI if (e.Event.friendlyHealthPct.maxHpPct > 100 || e.Event.friendlyHealthPct.minHpPct > 100) { - Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} has pct value above 100, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} has pct value above 100, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType()); return false; } @@ -747,7 +749,7 @@ namespace Game.AI case SmartTargets.PlayerDistance: break; default: - Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses invalid target_type {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType()); + Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses invalid target_type {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.GetTargetType()); return false; } break; @@ -865,7 +867,7 @@ namespace Game.AI case SmartEvents.SpellEffectHit: break; default: - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Not handled event_type({0}), Entry {1} SourceType {2} Event {3} Action {4}, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Not handled event_type({0}), Entry {1} SourceType {2} Event {3} Action {4}, skipped.", e.GetEventType(), e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType()); return false; } } @@ -882,7 +884,7 @@ namespace Game.AI case SmartActions.SetFaction: if (e.Action.faction.factionID != 0 && CliDB.FactionTemplateStorage.LookupByKey(e.Action.faction.factionID) == null) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Faction {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.faction.factionID); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Faction {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.faction.factionID); return false; } break; @@ -892,7 +894,7 @@ namespace Game.AI { if (e.Action.morphOrMount.creature > 0 && Global.ObjectMgr.GetCreatureTemplate(e.Action.morphOrMount.creature) == null) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Creature entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.morphOrMount.creature); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Creature entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.morphOrMount.creature); return false; } @@ -900,12 +902,12 @@ namespace Game.AI { if (e.Action.morphOrMount.creature != 0) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} has ModelID set with also set CreatureId, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType()); return false; } else if (!CliDB.CreatureDisplayInfoStorage.ContainsKey(e.Action.morphOrMount.model)) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Model id {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.morphOrMount.model); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Model id {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.morphOrMount.model); return false; } } @@ -927,7 +929,7 @@ namespace Game.AI if (e.Action.animKit.type > 3) { Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses invalid AnimKit type {4}, skipped.", - e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.animKit.type); + e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.animKit.type); return false; } break; @@ -944,7 +946,7 @@ namespace Game.AI { if (!CliDB.TaxiPathStorage.ContainsKey(e.Action.taxi.id)) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses invalid Taxi path ID {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.taxi.id); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses invalid Taxi path ID {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.taxi.id); return false; } break; @@ -985,7 +987,7 @@ namespace Game.AI { if (effect.TargetA.GetTarget() == Targets.UnitCaster) Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} Effect: SPELL_EFFECT_KILL_CREDIT: (SpellId: {4} targetA: {5} - targetB: {6}) has invalid target for this Action", - e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.cast.spell, effect.TargetA.GetTarget(), effect.TargetB.GetTarget()); + e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.cast.spell, effect.TargetA.GetTarget(), effect.TargetB.GetTarget()); } } break; @@ -1008,32 +1010,32 @@ namespace Game.AI { if (!qid.HasSpecialFlag(QuestSpecialFlags.ExplorationOrEvent)) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} SpecialFlags for Quest entry {4} does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.quest.questId); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} SpecialFlags for Quest entry {4} does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.quest.questId); return false; } } else { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Quest entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.quest.questId); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Quest entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.quest.questId); return false; } break; case SmartActions.SetEventPhase: if (e.Action.setEventPhase.phase >= (uint)SmartPhase.Max) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} attempts to set phase {4}. Phase mask cannot be used past phase {5}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.setEventPhase.phase, SmartPhase.Max - 1); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} attempts to set phase {4}. Phase mask cannot be used past phase {5}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.setEventPhase.phase, SmartPhase.Max - 1); return false; } break; case SmartActions.IncEventPhase: if (e.Action.incEventPhase.inc == 0 && e.Action.incEventPhase.dec == 0) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} is incrementing phase by 0, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType()); return false; } else if (e.Action.incEventPhase.inc > (uint)SmartPhase.Max || e.Action.incEventPhase.dec > (uint)SmartPhase.Max) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} attempts to increment phase by too large value, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType()); return false; } break; @@ -1050,7 +1052,7 @@ namespace Game.AI e.Action.randomPhase.phase5 >= (uint)SmartPhase.Max || e.Action.randomPhase.phase6 >= (uint)SmartPhase.Max) { - Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.entryOrGuid} SourceType {e.GetScriptType()} Event {e.event_id} Action {e.GetActionType()} attempts to set invalid phase, skipped."); + Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.EntryOrGuid} SourceType {e.GetScriptType()} Event {e.EventId} Action {e.GetActionType()} attempts to set invalid phase, skipped."); return false; } @@ -1061,7 +1063,7 @@ namespace Game.AI if (e.Action.randomPhaseRange.phaseMin >= (uint)SmartPhase.Max || e.Action.randomPhaseRange.phaseMax >= (uint)SmartPhase.Max) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} attempts to set invalid phase, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType()); return false; } if (!IsMinMaxValid(e, e.Action.randomPhaseRange.phaseMin, e.Action.randomPhaseRange.phaseMax)) @@ -1074,7 +1076,7 @@ namespace Game.AI if (e.Action.summonCreature.type < (uint)TempSummonType.TimedOrDeadDespawn || e.Action.summonCreature.type > (uint)TempSummonType.ManualDespawn) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses incorrect TempSummonType {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.summonCreature.type); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses incorrect TempSummonType {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.summonCreature.type); return false; } break; @@ -1084,7 +1086,7 @@ namespace Game.AI if (e.GetTargetType() == SmartTargets.Position) { - Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses incorrect TargetType {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType()); + Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses incorrect TargetType {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.GetTargetType()); return false; } break; @@ -1095,7 +1097,7 @@ namespace Game.AI case SmartActions.SetSheath: if (e.Action.setSheath.sheath != 0 && e.Action.setSheath.sheath >= (uint)SheathState.Max) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses incorrect Sheath state {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.setSheath.sheath); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses incorrect Sheath state {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.setSheath.sheath); return false; } break; @@ -1103,7 +1105,7 @@ namespace Game.AI { if (e.Action.react.state > (uint)ReactStates.Aggressive) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Creature {0} Event {1} Action {2} uses invalid React State {3}, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.Action.react.state); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Creature {0} Event {1} Action {2} uses invalid React State {3}, skipped.", e.EntryOrGuid, e.EventId, e.GetActionType(), e.Action.react.state); return false; } break; @@ -1129,14 +1131,14 @@ namespace Game.AI case SmartActions.Teleport: if (!CliDB.MapStorage.ContainsKey(e.Action.teleport.mapID)) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Map entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.teleport.mapID); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Map entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.teleport.mapID); return false; } break; case SmartActions.InstallAiTemplate: if (e.Action.installTtemplate.id >= (uint)SmartAITemplate.End) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Creature {0} Event {1} Action {2} uses non-existent AI template id {3}, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.Action.installTtemplate.id); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Creature {0} Event {1} Action {2} uses non-existent AI template id {3}, skipped.", e.EntryOrGuid, e.EventId, e.GetActionType(), e.Action.installTtemplate.id); return false; } break; @@ -1183,7 +1185,7 @@ namespace Game.AI case SmartActions.RemovePower: if (e.Action.power.powerType > (int)PowerType.Max) { - Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Power {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.power.powerType); + Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Power {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.power.powerType); return false; } break; @@ -1194,14 +1196,14 @@ namespace Game.AI var events = Global.GameEventMgr.GetEventMap(); if (eventId < 1 || eventId >= events.Length) { - Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent event, eventId {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.gameEventStop.id); + Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent event, eventId {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.gameEventStop.id); return false; } GameEventData eventData = events[eventId]; if (!eventData.IsValid()) { - Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent event, eventId {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.gameEventStop.id); + Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent event, eventId {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.gameEventStop.id); return false; } break; @@ -1213,14 +1215,14 @@ namespace Game.AI var events = Global.GameEventMgr.GetEventMap(); if (eventId < 1 || eventId >= events.Length) { - Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent event, eventId {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.gameEventStart.id); + Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent event, eventId {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.gameEventStart.id); return false; } GameEventData eventData = events[eventId]; if (!eventData.IsValid()) { - Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent event, eventId {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.gameEventStart.id); + Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent event, eventId {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.gameEventStart.id); return false; } break; @@ -1231,9 +1233,9 @@ namespace Game.AI { sbyte equipId = (sbyte)e.Action.equip.entry; - if (equipId != 0 && Global.ObjectMgr.GetEquipmentInfo((uint)e.entryOrGuid, equipId) == null) + if (equipId != 0 && Global.ObjectMgr.GetEquipmentInfo((uint)e.EntryOrGuid, equipId) == null) { - Log.outError(LogFilter.Sql, "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id {0} for creature {1}, skipped.", equipId, e.entryOrGuid); + Log.outError(LogFilter.Sql, "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id {0} for creature {1}, skipped.", equipId, e.EntryOrGuid); return false; } } @@ -1243,14 +1245,14 @@ namespace Game.AI { if (e.Action.setInstanceData.type > 1) { - Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses invalid data type {4} (value range 0-1), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.setInstanceData.type); + Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses invalid data type {4} (value range 0-1), skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.setInstanceData.type); return false; } else if (e.Action.setInstanceData.type == 1) { if (e.Action.setInstanceData.data > (int)EncounterState.ToBeDecided) { - Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses invalid boss state {4} (value range 0-5), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.setInstanceData.data); + Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses invalid boss state {4} (value range 0-5), skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), e.Action.setInstanceData.data); return false; } } @@ -1263,13 +1265,13 @@ namespace Game.AI if (apply != 0 && apply != 1) { - Log.outError(LogFilter.Sql, "SmartScript: SMART_ACTION_SET_INGAME_PHASE_ID uses invalid apply value {0} (Should be 0 or 1) for creature {1}, skipped", apply, e.entryOrGuid); + Log.outError(LogFilter.Sql, "SmartScript: SMART_ACTION_SET_INGAME_PHASE_ID uses invalid apply value {0} (Should be 0 or 1) for creature {1}, skipped", apply, e.EntryOrGuid); return false; } if (!CliDB.PhaseStorage.ContainsKey(phaseId)) { - Log.outError(LogFilter.Sql, "SmartScript: SMART_ACTION_SET_INGAME_PHASE_ID uses invalid phaseid {0} for creature {1}, skipped", phaseId, e.entryOrGuid); + Log.outError(LogFilter.Sql, "SmartScript: SMART_ACTION_SET_INGAME_PHASE_ID uses invalid phaseid {0} for creature {1}, skipped", phaseId, e.EntryOrGuid); return false; } break; @@ -1281,13 +1283,13 @@ namespace Game.AI if (apply != 0 && apply != 1) { - Log.outError(LogFilter.Sql, "SmartScript: SMART_ACTION_SET_INGAME_PHASE_GROUP uses invalid apply value {0} (Should be 0 or 1) for creature {1}, skipped", apply, e.entryOrGuid); + Log.outError(LogFilter.Sql, "SmartScript: SMART_ACTION_SET_INGAME_PHASE_GROUP uses invalid apply value {0} (Should be 0 or 1) for creature {1}, skipped", apply, e.EntryOrGuid); return false; } if (Global.DB2Mgr.GetPhasesForGroup(phaseGroup).Empty()) { - Log.outError(LogFilter.Sql, "SmartScript: SMART_ACTION_SET_INGAME_PHASE_GROUP uses invalid phase group id {0} for creature {1}, skipped", phaseGroup, e.entryOrGuid); + Log.outError(LogFilter.Sql, "SmartScript: SMART_ACTION_SET_INGAME_PHASE_GROUP uses invalid phase group id {0} for creature {1}, skipped", phaseGroup, e.EntryOrGuid); return false; } break; @@ -1316,7 +1318,7 @@ namespace Game.AI { if (e.Action.auraType.type >= (uint)AuraType.Total) { - Log.outError(LogFilter.Sql, $"Entry {e.entryOrGuid} SourceType {e.GetScriptType()} Event {e.event_id} Action {e.GetActionType()} uses invalid data type {e.Action.auraType.type} (value range 0-TOTAL_AURAS), skipped."); + Log.outError(LogFilter.Sql, $"Entry {e.EntryOrGuid} SourceType {e.GetScriptType()} Event {e.EventId} Action {e.GetActionType()} uses invalid data type {e.Action.auraType.type} (value range 0-TOTAL_AURAS), skipped."); return false; } break; @@ -1325,13 +1327,13 @@ namespace Game.AI { if (e.Action.movementSpeed.movementType >= (int)MovementGeneratorType.Max) { - Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.entryOrGuid} SourceType {e.GetScriptType()} Event {e.event_id} Action {e.GetActionType()} uses invalid movementType {e.Action.movementSpeed.movementType}, skipped."); + Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.EntryOrGuid} SourceType {e.GetScriptType()} Event {e.EventId} Action {e.GetActionType()} uses invalid movementType {e.Action.movementSpeed.movementType}, skipped."); return false; } if (e.Action.movementSpeed.speedInteger == 0 && e.Action.movementSpeed.speedFraction == 0) { - Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.entryOrGuid} SourceType {e.GetScriptType()} Event {e.event_id} Action {e.GetActionType()} uses speed 0, skipped."); + Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.EntryOrGuid} SourceType {e.GetScriptType()} Event {e.EventId} Action {e.GetActionType()} uses speed 0, skipped."); return false; } @@ -1341,7 +1343,7 @@ namespace Game.AI { if (Global.ConversationDataStorage.GetConversationTemplate(e.Action.conversation.id) == null) { - Log.outError(LogFilter.Sql, $"SmartAIMgr: SMART_ACTION_CREATE_CONVERSATION Entry {e.entryOrGuid} SourceType {e.GetScriptType()} Event {e.event_id} Action {e.GetActionType()} uses invalid entry {e.Action.conversation.id}, skipped."); + Log.outError(LogFilter.Sql, $"SmartAIMgr: SMART_ACTION_CREATE_CONVERSATION Entry {e.EntryOrGuid} SourceType {e.GetScriptType()} Event {e.EventId} Action {e.GetActionType()} uses invalid entry {e.Action.conversation.id}, skipped."); return false; } @@ -1428,23 +1430,23 @@ namespace Game.AI case SmartActions.DespawnSpawngroup: break; default: - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Not handled action_type({0}), event_type({1}), Entry {2} SourceType {3} Event {4}, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Not handled action_type({0}), event_type({1}), Entry {2} SourceType {3} Event {4}, skipped.", e.GetActionType(), e.GetEventType(), e.EntryOrGuid, e.GetScriptType(), e.EventId); return false; } return true; } - bool IsAnimKitValid(SmartScriptHolder e, uint entry) + static bool IsAnimKitValid(SmartScriptHolder e, uint entry) { if (!CliDB.AnimKitStorage.ContainsKey(entry)) { Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent AnimKit entry {4}, skipped.", - e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), entry); return false; } return true; } - bool IsTextValid(SmartScriptHolder e, uint id) + static bool IsTextValid(SmartScriptHolder e, uint id) { if (e.GetScriptType() != SmartScriptType.Creature) return true; @@ -1463,127 +1465,127 @@ namespace Game.AI case SmartTargets.ClosestCreature: return true; // ignore default: - if (e.entryOrGuid < 0) + if (e.EntryOrGuid < 0) { - ulong guid = (ulong)-e.entryOrGuid; + ulong guid = (ulong)-e.EntryOrGuid; CreatureData data = Global.ObjectMgr.GetCreatureData(guid); if (data == null) { - Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} using non-existent Creature guid {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), guid); + Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} using non-existent Creature guid {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), guid); return false; } else entry = data.Id; } else - entry = (uint)e.entryOrGuid; + entry = (uint)e.EntryOrGuid; break; } } if (entry == 0 || !Global.CreatureTextMgr.TextExist(entry, (byte)id)) { - Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} using non-existent Text id {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), id); + Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} using non-existent Text id {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), id); return false; } return true; } - bool IsCreatureValid(SmartScriptHolder e, uint entry) + static bool IsCreatureValid(SmartScriptHolder e, uint entry) { if (Global.ObjectMgr.GetCreatureTemplate(entry) == null) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Creature entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Creature entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), entry); return false; } return true; } - bool IsGameObjectValid(SmartScriptHolder e, uint entry) + static bool IsGameObjectValid(SmartScriptHolder e, uint entry) { if (Global.ObjectMgr.GetGameObjectTemplate(entry) == null) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent GameObject entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent GameObject entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), entry); return false; } return true; } - bool IsQuestValid(SmartScriptHolder e, uint entry) + static bool IsQuestValid(SmartScriptHolder e, uint entry) { if (Global.ObjectMgr.GetQuestTemplate(entry) == null) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Quest entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Quest entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), entry); return false; } return true; } - bool IsSpellValid(SmartScriptHolder e, uint entry) + static bool IsSpellValid(SmartScriptHolder e, uint entry) { if (!Global.SpellMgr.HasSpellInfo(entry, Difficulty.None)) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Spell entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Spell entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), entry); return false; } return true; } - bool IsMinMaxValid(SmartScriptHolder e, uint min, uint max) + static bool IsMinMaxValid(SmartScriptHolder e, uint min, uint max) { if (max < min) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses min/max params wrong ({4}/{5}), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses min/max params wrong ({4}/{5}), skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), min, max); return false; } return true; } - bool NotNULL(SmartScriptHolder e, uint data) + static bool NotNULL(SmartScriptHolder e, uint data) { if (data == 0) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} Parameter can not be NULL, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType()); return false; } return true; } - bool IsEmoteValid(SmartScriptHolder e, uint entry) + static bool IsEmoteValid(SmartScriptHolder e, uint entry) { if (!CliDB.EmotesStorage.ContainsKey(entry)) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Emote entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Emote entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), entry); return false; } return true; } - bool IsItemValid(SmartScriptHolder e, uint entry) + static bool IsItemValid(SmartScriptHolder e, uint entry) { if (!CliDB.ItemSparseStorage.ContainsKey(entry)) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Item entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Item entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), entry); return false; } return true; } - bool IsTextEmoteValid(SmartScriptHolder e, uint entry) + static bool IsTextEmoteValid(SmartScriptHolder e, uint entry) { if (!CliDB.EmotesTextStorage.ContainsKey(entry)) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Text Emote entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Text Emote entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), entry); return false; } return true; } - bool IsAreaTriggerValid(SmartScriptHolder e, uint entry) + static bool IsAreaTriggerValid(SmartScriptHolder e, uint entry) { if (!CliDB.AreaTriggerStorage.ContainsKey(entry)) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent AreaTrigger entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent AreaTrigger entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), entry); return false; } return true; } - bool IsSoundValid(SmartScriptHolder e, uint entry) + static bool IsSoundValid(SmartScriptHolder e, uint entry) { if (!CliDB.SoundKitStorage.ContainsKey(entry)) { - Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Sound entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Sound entry {4}, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType(), entry); return false; } return true; @@ -1591,10 +1593,10 @@ namespace Game.AI public List GetScript(int entry, SmartScriptType type) { - List temp = new List(); - if (mEventMap[(uint)type].ContainsKey(entry)) + List temp = new(); + if (_eventMap[(uint)type].ContainsKey(entry)) { - foreach (var holder in mEventMap[(uint)type][entry]) + foreach (var holder in _eventMap[(uint)type][entry]) temp.Add(new SmartScriptHolder(holder)); } else @@ -1611,9 +1613,9 @@ namespace Game.AI return _waypointStore.LookupByKey(id); } - public SmartScriptHolder FindLinkedSourceEvent(List list, uint eventId) + public static SmartScriptHolder FindLinkedSourceEvent(List list, uint eventId) { - var sch = list.Find(p => p.link == eventId); + var sch = list.Find(p => p.Link == eventId); if (sch != null) return sch; @@ -1622,161 +1624,162 @@ namespace Game.AI public SmartScriptHolder FindLinkedEvent(List list, uint link) { - var sch = list.Find(p => p.event_id == link && p.GetEventType() == SmartEvents.Link); + var sch = list.Find(p => p.EventId == link && p.GetEventType() == SmartEvents.Link); if (sch != null) return sch; return null; } - MultiMap[] mEventMap = new MultiMap[(int)SmartScriptType.Max]; - Dictionary _waypointStore = new Dictionary(); + public static uint GetTypeMask(SmartScriptType smartScriptType) => + smartScriptType switch + { + SmartScriptType.Creature => SmartScriptTypeMaskId.Creature, + SmartScriptType.GameObject => SmartScriptTypeMaskId.Gameobject, + SmartScriptType.AreaTrigger => SmartScriptTypeMaskId.Areatrigger, + SmartScriptType.Event => SmartScriptTypeMaskId.Event, + SmartScriptType.Gossip => SmartScriptTypeMaskId.Gossip, + SmartScriptType.Quest => SmartScriptTypeMaskId.Quest, + SmartScriptType.Spell => SmartScriptTypeMaskId.Spell, + SmartScriptType.Transport => SmartScriptTypeMaskId.Transport, + SmartScriptType.Instance => SmartScriptTypeMaskId.Instance, + SmartScriptType.TimedActionlist => SmartScriptTypeMaskId.TimedActionlist, + SmartScriptType.Scene => SmartScriptTypeMaskId.Scene, + SmartScriptType.AreaTriggerEntity => SmartScriptTypeMaskId.AreatrigggerEntity, + SmartScriptType.AreaTriggerEntityServerside => SmartScriptTypeMaskId.AreatrigggerEntity, + _ => 0, + }; - Dictionary SmartAITypeMask = new Dictionary - { - { SmartScriptType.Creature, SmartScriptTypeMaskId.Creature }, - { SmartScriptType.GameObject, SmartScriptTypeMaskId.Gameobject }, - { SmartScriptType.AreaTrigger, SmartScriptTypeMaskId.Areatrigger }, - { SmartScriptType.Event, SmartScriptTypeMaskId.Event }, - { SmartScriptType.Gossip, SmartScriptTypeMaskId.Gossip }, - { SmartScriptType.Quest, SmartScriptTypeMaskId.Quest }, - { SmartScriptType.Spell, SmartScriptTypeMaskId.Spell }, - { SmartScriptType.Transport, SmartScriptTypeMaskId.Transport }, - { SmartScriptType.Instance, SmartScriptTypeMaskId.Instance }, - { SmartScriptType.TimedActionlist, SmartScriptTypeMaskId.TimedActionlist }, - { SmartScriptType.Scene, SmartScriptTypeMaskId.Scene }, - { SmartScriptType.AreaTriggerEntity, SmartScriptTypeMaskId.AreatrigggerEntity }, - { SmartScriptType.AreaTriggerEntityServerside, SmartScriptTypeMaskId.AreatrigggerEntity } - }; - - Dictionary SmartAIEventMask = new Dictionary - { - { SmartEvents.UpdateIc, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.TimedActionlist }, - { SmartEvents.UpdateOoc, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject + SmartScriptTypeMaskId.Instance + SmartScriptTypeMaskId.AreatrigggerEntity }, - { SmartEvents.HealthPct, SmartScriptTypeMaskId.Creature }, - { SmartEvents.ManaPct, SmartScriptTypeMaskId.Creature }, - { SmartEvents.Aggro, SmartScriptTypeMaskId.Creature }, - { SmartEvents.Kill, SmartScriptTypeMaskId.Creature }, - { SmartEvents.Death, SmartScriptTypeMaskId.Creature }, - { SmartEvents.Evade, SmartScriptTypeMaskId.Creature }, - { SmartEvents.SpellHit, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.Range, SmartScriptTypeMaskId.Creature }, - { SmartEvents.OocLos, SmartScriptTypeMaskId.Creature }, - { SmartEvents.Respawn, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.TargetHealthPct, SmartScriptTypeMaskId.Creature }, - { SmartEvents.VictimCasting, SmartScriptTypeMaskId.Creature }, - { SmartEvents.FriendlyHealth, SmartScriptTypeMaskId.Creature }, - { SmartEvents.FriendlyIsCc, SmartScriptTypeMaskId.Creature }, - { SmartEvents.FriendlyMissingBuff, SmartScriptTypeMaskId.Creature }, - { SmartEvents.SummonedUnit, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.TargetManaPct, SmartScriptTypeMaskId.Creature }, - { SmartEvents.AcceptedQuest, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.RewardQuest, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.ReachedHome, SmartScriptTypeMaskId.Creature }, - { SmartEvents.ReceiveEmote, SmartScriptTypeMaskId.Creature }, - { SmartEvents.HasAura, SmartScriptTypeMaskId.Creature }, - { SmartEvents.TargetBuffed, SmartScriptTypeMaskId.Creature }, - { SmartEvents.Reset, SmartScriptTypeMaskId.Creature }, - { SmartEvents.IcLos, SmartScriptTypeMaskId.Creature }, - { SmartEvents.PassengerBoarded, SmartScriptTypeMaskId.Creature }, - { SmartEvents.PassengerRemoved, SmartScriptTypeMaskId.Creature }, - { SmartEvents.Charmed, SmartScriptTypeMaskId.Creature }, - { SmartEvents.CharmedTarget, SmartScriptTypeMaskId.Creature }, - { SmartEvents.SpellHitTarget, SmartScriptTypeMaskId.Creature }, - { SmartEvents.Damaged, SmartScriptTypeMaskId.Creature }, - { SmartEvents.DamagedTarget, SmartScriptTypeMaskId.Creature }, - { SmartEvents.Movementinform, SmartScriptTypeMaskId.Creature }, - { SmartEvents.SummonDespawned, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.CorpseRemoved, SmartScriptTypeMaskId.Creature }, - { SmartEvents.AiInit, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.DataSet, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.WaypointStart, SmartScriptTypeMaskId.Creature }, - { SmartEvents.WaypointReached, SmartScriptTypeMaskId.Creature }, - { SmartEvents.TransportAddplayer, SmartScriptTypeMaskId.Transport }, - { SmartEvents.TransportAddcreature, SmartScriptTypeMaskId.Transport }, - { SmartEvents.TransportRemovePlayer, SmartScriptTypeMaskId.Transport }, - { SmartEvents.TransportRelocate, SmartScriptTypeMaskId.Transport }, - { SmartEvents.InstancePlayerEnter, SmartScriptTypeMaskId.Instance }, - { SmartEvents.AreatriggerOntrigger, SmartScriptTypeMaskId.Areatrigger + SmartScriptTypeMaskId.AreatrigggerEntity }, - { SmartEvents.QuestAccepted, SmartScriptTypeMaskId.Quest }, - { SmartEvents.QuestObjCompletion, SmartScriptTypeMaskId.Quest }, - { SmartEvents.QuestRewarded, SmartScriptTypeMaskId.Quest }, - { SmartEvents.QuestCompletion, SmartScriptTypeMaskId.Quest }, - { SmartEvents.QuestFail, SmartScriptTypeMaskId.Quest }, - { SmartEvents.TextOver, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.ReceiveHeal, SmartScriptTypeMaskId.Creature }, - { SmartEvents.JustSummoned, SmartScriptTypeMaskId.Creature }, - { SmartEvents.WaypointPaused, SmartScriptTypeMaskId.Creature }, - { SmartEvents.WaypointResumed, SmartScriptTypeMaskId.Creature }, - { SmartEvents.WaypointStopped, SmartScriptTypeMaskId.Creature }, - { SmartEvents.WaypointEnded, SmartScriptTypeMaskId.Creature }, - { SmartEvents.TimedEventTriggered, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.Update, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject + SmartScriptTypeMaskId.AreatrigggerEntity }, - { SmartEvents.Link, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject + SmartScriptTypeMaskId.Areatrigger + SmartScriptTypeMaskId.Event + SmartScriptTypeMaskId.Gossip + SmartScriptTypeMaskId.Quest + SmartScriptTypeMaskId.Spell + SmartScriptTypeMaskId.Transport + SmartScriptTypeMaskId.Instance + SmartScriptTypeMaskId.AreatrigggerEntity }, - { SmartEvents.GossipSelect, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.JustCreated, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.GossipHello, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.FollowCompleted, SmartScriptTypeMaskId.Creature }, - { SmartEvents.PhaseChange, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.IsBehindTarget, SmartScriptTypeMaskId.Creature }, - { SmartEvents.GameEventStart, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.GameEventEnd, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.GoLootStateChanged, SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.GoEventInform, SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.ActionDone, SmartScriptTypeMaskId.Creature }, - { SmartEvents.OnSpellclick, SmartScriptTypeMaskId.Creature }, - { SmartEvents.FriendlyHealthPCT, SmartScriptTypeMaskId.Creature }, - { SmartEvents.DistanceCreature, SmartScriptTypeMaskId.Creature }, - { SmartEvents.DistanceGameobject, SmartScriptTypeMaskId.Creature }, - { SmartEvents.CounterSet, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject }, - { SmartEvents.SceneStart, SmartScriptTypeMaskId.Scene }, - { SmartEvents.SceneTrigger, SmartScriptTypeMaskId.Scene }, - { SmartEvents.SceneCancel, SmartScriptTypeMaskId.Scene }, - { SmartEvents.SceneComplete, SmartScriptTypeMaskId.Scene }, - { SmartEvents.SpellEffectHit, SmartScriptTypeMaskId.Spell }, - { SmartEvents.SpellEffectHitTarget, SmartScriptTypeMaskId.Spell } - }; + public static uint GetEventMask(SmartEvents smartEvent) => + smartEvent switch + { + SmartEvents.UpdateIc => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.TimedActionlist, + SmartEvents.UpdateOoc => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject + SmartScriptTypeMaskId.Instance + SmartScriptTypeMaskId.AreatrigggerEntity, + SmartEvents.HealthPct => SmartScriptTypeMaskId.Creature, + SmartEvents.ManaPct => SmartScriptTypeMaskId.Creature, + SmartEvents.Aggro => SmartScriptTypeMaskId.Creature, + SmartEvents.Kill => SmartScriptTypeMaskId.Creature, + SmartEvents.Death => SmartScriptTypeMaskId.Creature, + SmartEvents.Evade => SmartScriptTypeMaskId.Creature, + SmartEvents.SpellHit => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.Range => SmartScriptTypeMaskId.Creature, + SmartEvents.OocLos => SmartScriptTypeMaskId.Creature, + SmartEvents.Respawn => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.TargetHealthPct => SmartScriptTypeMaskId.Creature, + SmartEvents.VictimCasting => SmartScriptTypeMaskId.Creature, + SmartEvents.FriendlyHealth => SmartScriptTypeMaskId.Creature, + SmartEvents.FriendlyIsCc => SmartScriptTypeMaskId.Creature, + SmartEvents.FriendlyMissingBuff => SmartScriptTypeMaskId.Creature, + SmartEvents.SummonedUnit => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.TargetManaPct => SmartScriptTypeMaskId.Creature, + SmartEvents.AcceptedQuest => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.RewardQuest => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.ReachedHome => SmartScriptTypeMaskId.Creature, + SmartEvents.ReceiveEmote => SmartScriptTypeMaskId.Creature, + SmartEvents.HasAura => SmartScriptTypeMaskId.Creature, + SmartEvents.TargetBuffed => SmartScriptTypeMaskId.Creature, + SmartEvents.Reset => SmartScriptTypeMaskId.Creature, + SmartEvents.IcLos => SmartScriptTypeMaskId.Creature, + SmartEvents.PassengerBoarded => SmartScriptTypeMaskId.Creature, + SmartEvents.PassengerRemoved => SmartScriptTypeMaskId.Creature, + SmartEvents.Charmed => SmartScriptTypeMaskId.Creature, + SmartEvents.CharmedTarget => SmartScriptTypeMaskId.Creature, + SmartEvents.SpellHitTarget => SmartScriptTypeMaskId.Creature, + SmartEvents.Damaged => SmartScriptTypeMaskId.Creature, + SmartEvents.DamagedTarget => SmartScriptTypeMaskId.Creature, + SmartEvents.Movementinform => SmartScriptTypeMaskId.Creature, + SmartEvents.SummonDespawned => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.CorpseRemoved => SmartScriptTypeMaskId.Creature, + SmartEvents.AiInit => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.DataSet => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.WaypointStart => SmartScriptTypeMaskId.Creature, + SmartEvents.WaypointReached => SmartScriptTypeMaskId.Creature, + SmartEvents.TransportAddplayer => SmartScriptTypeMaskId.Transport, + SmartEvents.TransportAddcreature => SmartScriptTypeMaskId.Transport, + SmartEvents.TransportRemovePlayer => SmartScriptTypeMaskId.Transport, + SmartEvents.TransportRelocate => SmartScriptTypeMaskId.Transport, + SmartEvents.InstancePlayerEnter => SmartScriptTypeMaskId.Instance, + SmartEvents.AreatriggerOntrigger => SmartScriptTypeMaskId.Areatrigger + SmartScriptTypeMaskId.AreatrigggerEntity, + SmartEvents.QuestAccepted => SmartScriptTypeMaskId.Quest, + SmartEvents.QuestObjCompletion => SmartScriptTypeMaskId.Quest, + SmartEvents.QuestRewarded => SmartScriptTypeMaskId.Quest, + SmartEvents.QuestCompletion => SmartScriptTypeMaskId.Quest, + SmartEvents.QuestFail => SmartScriptTypeMaskId.Quest, + SmartEvents.TextOver => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.ReceiveHeal => SmartScriptTypeMaskId.Creature, + SmartEvents.JustSummoned => SmartScriptTypeMaskId.Creature, + SmartEvents.WaypointPaused => SmartScriptTypeMaskId.Creature, + SmartEvents.WaypointResumed => SmartScriptTypeMaskId.Creature, + SmartEvents.WaypointStopped => SmartScriptTypeMaskId.Creature, + SmartEvents.WaypointEnded => SmartScriptTypeMaskId.Creature, + SmartEvents.TimedEventTriggered => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.Update => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject + SmartScriptTypeMaskId.AreatrigggerEntity, + SmartEvents.Link => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject + SmartScriptTypeMaskId.Areatrigger + SmartScriptTypeMaskId.Event + SmartScriptTypeMaskId.Gossip + SmartScriptTypeMaskId.Quest + SmartScriptTypeMaskId.Spell + SmartScriptTypeMaskId.Transport + SmartScriptTypeMaskId.Instance + SmartScriptTypeMaskId.AreatrigggerEntity, + SmartEvents.GossipSelect => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.JustCreated => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.GossipHello => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.FollowCompleted => SmartScriptTypeMaskId.Creature, + SmartEvents.PhaseChange => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.IsBehindTarget => SmartScriptTypeMaskId.Creature, + SmartEvents.GameEventStart => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.GameEventEnd => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.GoLootStateChanged => SmartScriptTypeMaskId.Gameobject, + SmartEvents.GoEventInform => SmartScriptTypeMaskId.Gameobject, + SmartEvents.ActionDone => SmartScriptTypeMaskId.Creature, + SmartEvents.OnSpellclick => SmartScriptTypeMaskId.Creature, + SmartEvents.FriendlyHealthPCT => SmartScriptTypeMaskId.Creature, + SmartEvents.DistanceCreature => SmartScriptTypeMaskId.Creature, + SmartEvents.DistanceGameobject => SmartScriptTypeMaskId.Creature, + SmartEvents.CounterSet => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject, + SmartEvents.SceneStart => SmartScriptTypeMaskId.Scene, + SmartEvents.SceneTrigger => SmartScriptTypeMaskId.Scene, + SmartEvents.SceneCancel => SmartScriptTypeMaskId.Scene, + SmartEvents.SceneComplete => SmartScriptTypeMaskId.Scene, + SmartEvents.SpellEffectHit => SmartScriptTypeMaskId.Spell, + SmartEvents.SpellEffectHitTarget => SmartScriptTypeMaskId.Spell, + _ => 0, + }; } public class SmartScriptHolder { + public int EntryOrGuid; + public SmartScriptType SourceType; + public uint EventId; + public uint Link; + public SmartEvent Event; + public SmartAction Action; + public SmartTarget Target; + public uint Timer; + public bool Active; + public bool RunOnce; + public bool EnableTimed; + public SmartScriptHolder() { } public SmartScriptHolder(SmartScriptHolder other) { - entryOrGuid = other.entryOrGuid; - source_type = other.source_type; - event_id = other.event_id; - link = other.link; + EntryOrGuid = other.EntryOrGuid; + SourceType = other.SourceType; + EventId = other.EventId; + Link = other.Link; Event = other.Event; Action = other.Action; Target = other.Target; - timer = other.timer; - active = other.active; - runOnce = other.runOnce; - enableTimed = other.enableTimed; + Timer = other.Timer; + Active = other.Active; + RunOnce = other.RunOnce; + EnableTimed = other.EnableTimed; } - public SmartScriptType GetScriptType() { return source_type; } + public SmartScriptType GetScriptType() { return SourceType; } public SmartEvents GetEventType() { return Event.type; } public SmartActions GetActionType() { return Action.type; } public SmartTargets GetTargetType() { return Target.type; } public override string ToString() { - return $"Entry {entryOrGuid} SourceType {GetScriptType()} Event {event_id} Action {GetActionType()}"; + return $"Entry {EntryOrGuid} SourceType {GetScriptType()} Event {EventId} Action {GetActionType()}"; } - - public int entryOrGuid; - public SmartScriptType source_type; - public uint event_id; - public uint link; - public SmartEvent Event; - public SmartAction Action; - public SmartTarget Target; - public uint timer; - public bool active; - public bool runOnce; - public bool enableTimed; } [StructLayout(LayoutKind.Explicit)] diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index a326f41b3..89f76920a 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -32,50 +32,82 @@ namespace Game.AI { public class SmartScript { + public ObjectGuid LastInvoker; + + Dictionary _counterList = new(); + + List _events = new(); + List _installEvents = new(); + List _timedActionList = new(); + Creature _me; + ObjectGuid _meOrigGUID; + GameObject _go; + ObjectGuid _goOrigGUID; + AreaTriggerRecord _trigger; + AreaTrigger _areaTrigger; + SceneTemplate _sceneTemplate; + Quest _quest; + SmartScriptType _scriptType; + uint _eventPhase; + + uint _pathId; + List _storedEvents = new(); + List _remIDs = new(); + + uint _textTimer; + uint _lastTextID; + ObjectGuid _textGUID; + uint _talkerEntry; + bool _useTextTimer; + + Dictionary _storedTargets = new(); + + SmartAITemplate _template; + public SmartScript() { - go = null; - me = null; - trigger = null; - mEventPhase = 0; - mPathId = 0; - mTextTimer = 0; - mLastTextID = 0; - mTextGUID = ObjectGuid.Empty; - mUseTextTimer = false; - mTalkerEntry = 0; - mTemplate = SmartAITemplate.Basic; - meOrigGUID = ObjectGuid.Empty; - goOrigGUID = ObjectGuid.Empty; - mLastInvoker = ObjectGuid.Empty; - mScriptType = SmartScriptType.Creature; + _go = null; + _me = null; + _trigger = null; + _eventPhase = 0; + _pathId = 0; + _textTimer = 0; + _lastTextID = 0; + _textGUID = ObjectGuid.Empty; + _useTextTimer = false; + _talkerEntry = 0; + _template = SmartAITemplate.Basic; + _meOrigGUID = ObjectGuid.Empty; + _goOrigGUID = ObjectGuid.Empty; + LastInvoker = ObjectGuid.Empty; + _scriptType = SmartScriptType.Creature; } public void OnReset() { ResetBaseObject(); - foreach (var holder in mEvents) + foreach (var holder in _events) { if (!holder.Event.event_flags.HasAnyFlag(SmartEventFlags.DontReset)) { InitTimer(holder); - holder.runOnce = false; + holder.RunOnce = false; } } ProcessEventsFor(SmartEvents.Reset); - mLastInvoker = ObjectGuid.Empty; + LastInvoker = ObjectGuid.Empty; } public void ProcessEventsFor(SmartEvents e, Unit unit = null, uint var0 = 0, uint var1 = 0, bool bvar = false, SpellInfo spell = null, GameObject gob = null, string varString = "") { - foreach (var Event in mEvents) + foreach (var Event in _events) { SmartEvents eventType = Event.GetEventType(); if (eventType == SmartEvents.Link)//special handling continue; if (eventType == e) - if (Global.ConditionMgr.IsObjectMeetingSmartEventConditions(Event.entryOrGuid, Event.event_id, Event.source_type, unit, GetBaseObject())) + if (Global.ConditionMgr.IsObjectMeetingSmartEventConditions(Event.EntryOrGuid, Event.EventId, Event.SourceType, unit, GetBaseObject())) ProcessEvent(Event, unit, var0, var1, bvar, spell, gob, varString); } } @@ -88,10 +120,10 @@ namespace Game.AI if (RandomHelper.randChance(e.Event.event_chance)) return; } - e.runOnce = true;//used for repeat check + e.RunOnce = true;//used for repeat check if (unit != null) - mLastInvoker = unit.GetGUID(); + LastInvoker = unit.GetGUID(); Unit tempInvoker = GetLastInvoker(); if (tempInvoker != null) @@ -103,7 +135,7 @@ namespace Game.AI { case SmartActions.Talk: { - Creature talker = e.Target.type == 0 ? me : null; + Creature talker = e.Target.type == 0 ? _me : null; Unit talkTarget = null; foreach (var target in targets) @@ -112,7 +144,7 @@ namespace Game.AI { if (e.Action.talk.useTalkTarget != 0) { - talker = me; + talker = _me; talkTarget = target.ToCreature(); } else @@ -121,7 +153,7 @@ namespace Game.AI } else if (IsPlayer(target)) { - talker = me; + talker = _me; talkTarget = target.ToPlayer(); break; } @@ -133,14 +165,14 @@ namespace Game.AI if (talker == null) break; - mTalkerEntry = talker.GetEntry(); - mLastTextID = e.Action.talk.textGroupId; - mTextTimer = e.Action.talk.duration; + _talkerEntry = talker.GetEntry(); + _lastTextID = e.Action.talk.textGroupId; + _textTimer = e.Action.talk.duration; - mUseTextTimer = true; + _useTextTimer = true; Global.CreatureTextMgr.SendChat(talker, (byte)e.Action.talk.textGroupId, talkTarget); Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction: SMART_ACTION_TALK: talker: {0} (Guid: {1}), textGuid: {2}", - talker.GetName(), talker.GetGUID().ToString(), mTextGUID.ToString()); + talker.GetName(), talker.GetGUID().ToString(), _textGUID.ToString()); break; } case SmartActions.SimpleTalk: @@ -149,10 +181,10 @@ namespace Game.AI { if (IsCreature(target)) Global.CreatureTextMgr.SendChat(target.ToCreature(), (byte)e.Action.talk.textGroupId, IsPlayer(GetLastInvoker()) ? GetLastInvoker() : null); - else if (IsPlayer(target) && me != null) + else if (IsPlayer(target) && _me != null) { Unit templastInvoker = GetLastInvoker(); - Global.CreatureTextMgr.SendChat(me, (byte)e.Action.talk.textGroupId, IsPlayer(templastInvoker) ? templastInvoker : null, ChatMsg.Addon, Language.Addon, CreatureTextRange.Normal, 0, Team.Other, false, target.ToPlayer()); + Global.CreatureTextMgr.SendChat(_me, (byte)e.Action.talk.textGroupId, IsPlayer(templastInvoker) ? templastInvoker : null, ChatMsg.Addon, Language.Addon, CreatureTextRange.Normal, 0, Team.Other, false, target.ToPlayer()); } Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_SIMPLE_TALK: talker: {0} (GuidLow: {1}), textGroupId: {2}", target.GetName(), target.GetGUID().ToString(), e.Action.talk.textGroupId); @@ -279,15 +311,15 @@ namespace Game.AI Quest quest = Global.ObjectMgr.GetQuestTemplate(e.Action.questOffer.questId); if (quest != null) { - if (me && e.Action.questOffer.directAdd == 0) + if (_me && e.Action.questOffer.directAdd == 0) { if (player.CanTakeQuest(quest, true)) { WorldSession session = player.GetSession(); if (session) { - PlayerMenu menu = new PlayerMenu(session); - menu.SendQuestGiverQuestDetails(quest, me.GetGUID(), true, false); + PlayerMenu menu = new(session); + menu.SendQuestGiverQuestDetails(quest, _me.GetGUID(), true, false); Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction:: SMART_ACTION_OFFER_QUEST: Player {0} - offering quest {1}", player.GetGUID().ToString(), e.Action.questOffer.questId); } } @@ -315,7 +347,7 @@ namespace Game.AI } case SmartActions.RandomEmote: { - List emotes = new List(); + List emotes = new(); var randomEmote = e.Action.randomEmote; foreach (var id in new[] { randomEmote.emote1, randomEmote.emote2, randomEmote.emote3, randomEmote.emote4, randomEmote.emote5, randomEmote.emote6, }) if (id != 0) @@ -335,27 +367,27 @@ namespace Game.AI } case SmartActions.ThreatAllPct: { - if (me == null) + if (_me == null) break; - foreach (var refe in me.GetThreatManager().GetThreatList()) + foreach (var refe in _me.GetThreatManager().GetThreatList()) { refe.AddThreatPercent(Math.Max(-100, (int)(e.Action.threatPCT.threatINC - e.Action.threatPCT.threatDEC))); - Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_THREAT_ALL_PCT: Creature {me.GetGUID()} modify threat for {refe.GetTarget().GetGUID()}, value {e.Action.threatPCT.threatINC - e.Action.threatPCT.threatDEC}"); + Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_THREAT_ALL_PCT: Creature {_me.GetGUID()} modify threat for {refe.GetTarget().GetGUID()}, value {e.Action.threatPCT.threatINC - e.Action.threatPCT.threatDEC}"); } break; } case SmartActions.ThreatSinglePct: { - if (me == null) + if (_me == null) break; foreach (var target in targets) { if (IsUnit(target)) { - me.GetThreatManager().ModifyThreatByPercent(target.ToUnit(), Math.Max(-100, (int)(e.Action.threatPCT.threatINC - e.Action.threatPCT.threatDEC))); - Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_THREAT_SINGLE_PCT: Creature {me.GetGUID()} modify threat for {target.GetGUID()}, value {e.Action.threatPCT.threatINC - e.Action.threatPCT.threatDEC}"); + _me.GetThreatManager().ModifyThreatByPercent(target.ToUnit(), Math.Max(-100, (int)(e.Action.threatPCT.threatINC - e.Action.threatPCT.threatDEC))); + Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_THREAT_SINGLE_PCT: Creature {_me.GetGUID()} modify threat for {target.GetGUID()}, value {e.Action.threatPCT.threatINC - e.Action.threatPCT.threatDEC}"); } } break; @@ -395,8 +427,8 @@ namespace Game.AI foreach (var target in targets) { - if (go != null) - go.CastSpell(target.ToUnit(), e.Action.cast.spell); + if (_go != null) + _go.CastSpell(target.ToUnit(), e.Action.cast.spell); if (!IsUnit(target)) continue; @@ -412,10 +444,10 @@ namespace Game.AI triggerFlag = TriggerCastFlags.FullMask; } - if (me) + if (_me) { if (e.Action.cast.castFlags.HasAnyFlag((uint)SmartCastFlags.InterruptPrevious)) - me.InterruptNonMeleeSpells(false); + _me.InterruptNonMeleeSpells(false); if (e.Action.cast.castFlags.HasAnyFlag((uint)SmartCastFlags.CombatMove)) { @@ -423,14 +455,14 @@ namespace Game.AI // unless target is outside spell range, out of mana, or LOS. bool allowMove = false; - SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(e.Action.cast.spell, me.GetMap().GetDifficultyID()); - var costs = spellInfo.CalcPowerCost(me, spellInfo.GetSchoolMask()); + SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(e.Action.cast.spell, _me.GetMap().GetDifficultyID()); + var costs = spellInfo.CalcPowerCost(_me, spellInfo.GetSchoolMask()); bool hasPower = true; foreach (var cost in costs) { if (cost.Power == PowerType.Health) { - if (me.GetHealth() <= (uint)cost.Amount) + if (_me.GetHealth() <= (uint)cost.Amount) { hasPower = false; break; @@ -438,7 +470,7 @@ namespace Game.AI } else { - if (me.GetPower(cost.Power) < cost.Amount) + if (_me.GetPower(cost.Power) < cost.Amount) { hasPower = false; break; @@ -446,18 +478,18 @@ namespace Game.AI } } - if (me.GetDistance(target) > spellInfo.GetMaxRange(true) || - me.GetDistance(target) < spellInfo.GetMinRange(true) || - !me.IsWithinLOSInMap(target) || !hasPower) + if (_me.GetDistance(target) > spellInfo.GetMaxRange(true) || + _me.GetDistance(target) < spellInfo.GetMinRange(true) || + !_me.IsWithinLOSInMap(target) || !hasPower) allowMove = true; - ((SmartAI)me.GetAI()).SetCombatMove(allowMove); + ((SmartAI)_me.GetAI()).SetCombatMove(allowMove); } - me.CastSpell(target.ToUnit(), e.Action.cast.spell, triggerFlag); + _me.CastSpell(target.ToUnit(), e.Action.cast.spell, triggerFlag); } - else if (go) - go.CastSpell(target.ToUnit(), e.Action.cast.spell, triggerFlag); + else if (_go) + _go.CastSpell(target.ToUnit(), e.Action.cast.spell, triggerFlag); else if (target != null) target.ToUnit().CastSpell(target.ToUnit(), e.Action.cast.spell); } @@ -612,9 +644,9 @@ namespace Game.AI if (!IsSmart()) break; - ((SmartAI)me.GetAI()).SetAutoAttack(e.Action.autoAttack.attack != 0 ? true : false); + ((SmartAI)_me.GetAI()).SetAutoAttack(e.Action.autoAttack.attack != 0); Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_AUTO_ATTACK: Creature: {0} bool on = {1}", - me.GetGUID().ToString(), e.Action.autoAttack.attack); + _me.GetGUID().ToString(), e.Action.autoAttack.attack); break; } case SmartActions.AllowCombatMovement: @@ -622,10 +654,10 @@ namespace Game.AI if (!IsSmart()) break; - bool move = e.Action.combatMove.move != 0 ? true : false; - ((SmartAI)me.GetAI()).SetCombatMove(move); + bool move = e.Action.combatMove.move != 0; + ((SmartAI)_me.GetAI()).SetCombatMove(move); Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_ALLOW_COMBAT_MOVEMENT: Creature {0} bool on = {1}", - me.GetGUID().ToString(), e.Action.combatMove.move); + _me.GetGUID().ToString(), e.Action.combatMove.move); break; } case SmartActions.SetEventPhase: @@ -651,25 +683,25 @@ namespace Game.AI } case SmartActions.Evade: { - if (me == null) + if (_me == null) break; - me.GetAI().EnterEvadeMode(); - Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_EVADE: Creature {0} EnterEvadeMode", me.GetGUID().ToString()); + _me.GetAI().EnterEvadeMode(); + Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_EVADE: Creature {0} EnterEvadeMode", _me.GetGUID().ToString()); break; } case SmartActions.FleeForAssist: { - if (!me) + if (!_me) break; - me.DoFleeToGetAssistance(); + _me.DoFleeToGetAssistance(); if (e.Action.fleeAssist.withEmote != 0) { - var builder = new BroadcastTextBuilder(me, ChatMsg.MonsterEmote, (uint)BroadcastTextIds.FleeForAssist, me.GetGender()); - Global.CreatureTextMgr.SendChatPacket(me, builder, ChatMsg.Emote); + var builder = new BroadcastTextBuilder(_me, ChatMsg.MonsterEmote, (uint)BroadcastTextIds.FleeForAssist, _me.GetGender()); + Global.CreatureTextMgr.SendChatPacket(_me, builder, ChatMsg.Emote); } - Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_FLEE_FOR_ASSIST: Creature {0} DoFleeToGetAssistance", me.GetGUID().ToString()); + Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_FLEE_FOR_ASSIST: Creature {0} DoFleeToGetAssistance", _me.GetGUID().ToString()); break; } case SmartActions.CallGroupeventhappens: @@ -701,11 +733,11 @@ namespace Game.AI } case SmartActions.CombatStop: { - if (!me) + if (!_me) break; - me.CombatStop(true); - Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction: SMART_ACTION_COMBAT_STOP: {0} CombatStop", me.GetGUID().ToString()); + _me.CombatStop(true); + Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction: SMART_ACTION_COMBAT_STOP: {0} CombatStop", _me.GetGUID().ToString()); break; } case SmartActions.RemoveAurasFromSpell: @@ -732,7 +764,7 @@ namespace Game.AI if (targets.Empty()) { - ((SmartAI)me.GetAI()).StopFollow(false); + ((SmartAI)_me.GetAI()).StopFollow(false); break; } @@ -741,9 +773,9 @@ namespace Game.AI if (IsUnit(target)) { float angle = e.Action.follow.angle > 6 ? (e.Action.follow.angle * (float)Math.PI / 180.0f) : e.Action.follow.angle; - ((SmartAI)me.GetAI()).SetFollow(target.ToUnit(), e.Action.follow.dist + 0.1f, angle, e.Action.follow.credit, e.Action.follow.entry, e.Action.follow.creditType); + ((SmartAI)_me.GetAI()).SetFollow(target.ToUnit(), e.Action.follow.dist + 0.1f, angle, e.Action.follow.credit, e.Action.follow.entry, e.Action.follow.creditType); Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction: SMART_ACTION_FOLLOW: Creature {0} following target {1}", - me.GetGUID().ToString(), target.GetGUID().ToString()); + _me.GetGUID().ToString(), target.GetGUID().ToString()); break; } } @@ -754,7 +786,7 @@ namespace Game.AI if (GetBaseObject() == null) break; - List phases = new List(); + List phases = new(); var randomPhase = e.Action.randomPhase; foreach (var id in new[] { randomPhase.phase1, randomPhase.phase2, randomPhase.phase3, randomPhase.phase4, randomPhase.phase5, randomPhase.phase6 }) if (id != 0) @@ -781,10 +813,10 @@ namespace Game.AI { if (e.Target.type == SmartTargets.None || e.Target.type == SmartTargets.Self) // Loot recipient and his group members { - if (me == null) + if (_me == null) break; - Player player = me.GetLootRecipient(); + Player player = _me.GetLootRecipient(); if (player != null) { player.RewardPlayerAndGroupAtEvent(e.Action.killedMonster.creature, player); @@ -831,7 +863,7 @@ namespace Game.AI InstanceScript instance = obj.GetInstanceScript(); if (instance == null) { - Log.outError(LogFilter.Sql, "SmartScript: Event {0} attempt to set instance data without instance script. EntryOrGuid {1}", e.GetEventType(), e.entryOrGuid); + Log.outError(LogFilter.Sql, "SmartScript: Event {0} attempt to set instance data without instance script. EntryOrGuid {1}", e.GetEventType(), e.EntryOrGuid); break; } @@ -864,7 +896,7 @@ namespace Game.AI InstanceScript instance = obj.GetInstanceScript(); if (instance == null) { - Log.outError(LogFilter.Sql, "SmartScript: Event {0} attempt to set instance data without instance script. EntryOrGuid {1}", e.GetEventType(), e.entryOrGuid); + Log.outError(LogFilter.Sql, "SmartScript: Event {0} attempt to set instance data without instance script. EntryOrGuid {1}", e.GetEventType(), e.EntryOrGuid); break; } @@ -885,10 +917,10 @@ namespace Game.AI } case SmartActions.Die: { - if (me != null && !me.IsDead()) + if (_me != null && !_me.IsDead()) { - me.KillSelf(); - Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction: SMART_ACTION_DIE: Creature {0}", me.GetGUID().ToString()); + _me.KillSelf(); + Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction: SMART_ACTION_DIE: Creature {0}", _me.GetGUID().ToString()); } break; } @@ -898,8 +930,8 @@ namespace Game.AI { if (IsCreature(target)) { - me.SetInCombatWithZone(); - Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_SET_IN_COMBAT_WITH_ZONE: Creature: {me.GetGUID()}, Target: {target.GetGUID()}"); + _me.SetInCombatWithZone(); + Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_SET_IN_COMBAT_WITH_ZONE: Creature: {_me.GetGUID()}, Target: {target.GetGUID()}"); } } @@ -914,21 +946,21 @@ namespace Game.AI target.ToCreature().CallForHelp(e.Action.callHelp.range); if (e.Action.callHelp.withEmote != 0) { - var builder = new BroadcastTextBuilder(me, ChatMsg.Emote, (uint)BroadcastTextIds.CallForHelp, me.GetGender()); - Global.CreatureTextMgr.SendChatPacket(me, builder, ChatMsg.MonsterEmote); + var builder = new BroadcastTextBuilder(_me, ChatMsg.Emote, (uint)BroadcastTextIds.CallForHelp, _me.GetGender()); + Global.CreatureTextMgr.SendChatPacket(_me, builder, ChatMsg.MonsterEmote); } - Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_CALL_FOR_HELP: Creature: {me.GetGUID()}, Target: {target.GetGUID()}"); + Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_CALL_FOR_HELP: Creature: {_me.GetGUID()}, Target: {target.GetGUID()}"); } } break; } case SmartActions.SetSheath: { - if (me != null) + if (_me != null) { - me.SetSheath((SheathState)e.Action.setSheath.sheath); + _me.SetSheath((SheathState)e.Action.setSheath.sheath); Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction: SMART_ACTION_SET_SHEATH: Creature {0}, State: {1}", - me.GetGUID().ToString(), e.Action.setSheath.sheath); + _me.GetGUID().ToString(), e.Action.setSheath.sheath); } break; } @@ -1011,7 +1043,7 @@ namespace Game.AI { if (IsCreature(target)) { - SmartAI ai = (SmartAI)me.GetAI(); + SmartAI ai = (SmartAI)_me.GetAI(); if (ai == null) continue; @@ -1072,7 +1104,7 @@ namespace Game.AI } case SmartActions.AttackStart: { - if (me == null) + if (_me == null) break; if (targets.Empty()) @@ -1080,7 +1112,7 @@ namespace Game.AI Unit target = targets.SelectRandom().ToUnit(); if (target != null) - me.GetAI().AttackStart(target); + _me.GetAI().AttackStart(target); break; } @@ -1194,7 +1226,7 @@ namespace Game.AI if (!IsSmart()) break; - ((SmartAI)me.GetAI()).SetDisableGravity(e.Action.setDisableGravity.disable != 0); + ((SmartAI)_me.GetAI()).SetDisableGravity(e.Action.setDisableGravity.disable != 0); break; } case SmartActions.SetCanFly: @@ -1202,7 +1234,7 @@ namespace Game.AI if (!IsSmart()) break; - ((SmartAI)me.GetAI()).SetCanFly(e.Action.setFly.fly != 0); + ((SmartAI)_me.GetAI()).SetCanFly(e.Action.setFly.fly != 0); break; } case SmartActions.SetRun: @@ -1210,7 +1242,7 @@ namespace Game.AI if (!IsSmart()) break; - ((SmartAI)me.GetAI()).SetRun(e.Action.setRun.run != 0 ? true : false); + ((SmartAI)_me.GetAI()).SetRun(e.Action.setRun.run != 0); break; } case SmartActions.SetSwim: @@ -1218,7 +1250,7 @@ namespace Game.AI if (!IsSmart()) break; - ((SmartAI)me.GetAI()).SetSwim(e.Action.setSwim.swim != 0 ? true : false); + ((SmartAI)_me.GetAI()).SetSwim(e.Action.setSwim.swim != 0); break; } case SmartActions.SetCounter: @@ -1268,13 +1300,13 @@ namespace Game.AI } } - me.SetReactState((ReactStates)e.Action.wpStart.reactState); - ((SmartAI)me.GetAI()).StartPath(run, entry, repeat, unit); + _me.SetReactState((ReactStates)e.Action.wpStart.reactState); + ((SmartAI)_me.GetAI()).StartPath(run, entry, repeat, unit); uint quest = e.Action.wpStart.quest; uint DespawnTime = e.Action.wpStart.despawnTime; - ((SmartAI)me.GetAI()).mEscortQuestID = quest; - ((SmartAI)me.GetAI()).SetDespawnTime(DespawnTime); + ((SmartAI)_me.GetAI()).EscortQuestID = quest; + ((SmartAI)_me.GetAI()).SetDespawnTime(DespawnTime); break; } case SmartActions.WpPause: @@ -1283,7 +1315,7 @@ namespace Game.AI break; uint delay = e.Action.wpPause.delay; - ((SmartAI)me.GetAI()).PausePath(delay, e.GetEventType() != SmartEvents.WaypointReached); + ((SmartAI)_me.GetAI()).PausePath(delay, e.GetEventType() != SmartEvents.WaypointReached); break; } case SmartActions.WpStop: @@ -1293,8 +1325,8 @@ namespace Game.AI uint DespawnTime = e.Action.wpStop.despawnTime; uint quest = e.Action.wpStop.quest; - bool fail = e.Action.wpStop.fail != 0 ? true : false; - ((SmartAI)me.GetAI()).StopPath(DespawnTime, quest, fail); + bool fail = e.Action.wpStop.fail != 0; + ((SmartAI)_me.GetAI()).StopPath(DespawnTime, quest, fail); break; } case SmartActions.WpResume: @@ -1302,20 +1334,20 @@ namespace Game.AI if (!IsSmart()) break; - ((SmartAI)me.GetAI()).SetWPPauseTimer(0); + ((SmartAI)_me.GetAI()).SetWPPauseTimer(0); break; } case SmartActions.SetOrientation: { - if (me == null) + if (_me == null) break; if (e.GetTargetType() == SmartTargets.Self) - me.SetFacingTo((me.GetTransport() ? me.GetTransportHomePosition() : me.GetHomePosition()).GetOrientation()); + _me.SetFacingTo((_me.GetTransport() ? _me.GetTransportHomePosition() : _me.GetHomePosition()).GetOrientation()); else if (e.GetTargetType() == SmartTargets.Position) - me.SetFacingTo(e.Target.o); + _me.SetFacingTo(e.Target.o); else if (!targets.Empty()) - me.SetFacingToObject(targets.First()); + _me.SetFacingToObject(targets.First()); break; } @@ -1351,23 +1383,23 @@ namespace Game.AI if (target == null) { - Position dest = new Position(e.Target.x, e.Target.y, e.Target.z); + Position dest = new(e.Target.x, e.Target.y, e.Target.z); if (e.Action.moveToPos.transport != 0) { - ITransport trans = me.GetDirectTransport(); + ITransport trans = _me.GetDirectTransport(); if (trans != null) trans.CalculatePassengerPosition(ref dest.posX, ref dest.posY, ref dest.posZ, ref dest.Orientation); } - me.GetMotionMaster().MovePoint(e.Action.moveToPos.pointId, dest, e.Action.moveToPos.disablePathfinding == 0); + _me.GetMotionMaster().MovePoint(e.Action.moveToPos.pointId, dest, e.Action.moveToPos.disablePathfinding == 0); } else { float x, y, z; target.GetPosition(out x, out y, out z); if (e.Action.moveToPos.contactDistance > 0) - target.GetContactPoint(me, out x, out y, out z, e.Action.moveToPos.contactDistance); - me.GetMotionMaster().MovePoint(e.Action.moveToPos.pointId, x + e.Target.x, y + e.Target.y, z + e.Target.z, e.Action.moveToPos.disablePathfinding == 0); + target.GetContactPoint(_me, out x, out y, out z, e.Action.moveToPos.contactDistance); + _me.GetMotionMaster().MovePoint(e.Action.moveToPos.pointId, x + e.Target.x, y + e.Target.y, z + e.Target.z, e.Action.moveToPos.disablePathfinding == 0); } break; } @@ -1432,7 +1464,7 @@ namespace Game.AI } case SmartActions.CreateTimedEvent: { - SmartEvent ne = new SmartEvent(); + SmartEvent ne = new(); ne.type = SmartEvents.Update; ne.event_chance = e.Action.timeEvent.chance; if (ne.event_chance == 0) @@ -1447,17 +1479,17 @@ namespace Game.AI if (ne.minMaxRepeat.repeatMin == 0 && ne.minMaxRepeat.repeatMax == 0) ne.event_flags |= SmartEventFlags.NotRepeatable; - SmartAction ac = new SmartAction(); + SmartAction ac = new(); ac.type = SmartActions.TriggerTimedEvent; ac.timeEvent.id = e.Action.timeEvent.id; - SmartScriptHolder ev = new SmartScriptHolder(); + SmartScriptHolder ev = new(); ev.Event = ne; - ev.event_id = e.Action.timeEvent.id; + ev.EventId = e.Action.timeEvent.id; ev.Target = e.Target; ev.Action = ac; InitTimer(ev); - mStoredEvents.Add(ev); + _storedEvents.Add(ev); break; } case SmartActions.TriggerTimedEvent: @@ -1465,10 +1497,10 @@ namespace Game.AI // remove this event if not repeatable if (e.Event.event_flags.HasAnyFlag(SmartEventFlags.NotRepeatable)) - mRemIDs.Add(e.Action.timeEvent.id); + _remIDs.Add(e.Action.timeEvent.id); break; case SmartActions.RemoveTimedEvent: - mRemIDs.Add(e.Action.timeEvent.id); + _remIDs.Add(e.Action.timeEvent.id); break; case SmartActions.OverrideScriptBaseObject: { @@ -1476,22 +1508,22 @@ namespace Game.AI { if (IsCreature(target)) { - if (meOrigGUID.IsEmpty() && me) - meOrigGUID = me.GetGUID(); - if (goOrigGUID.IsEmpty() && go) - goOrigGUID = go.GetGUID(); - go = null; - me = target.ToCreature(); + if (_meOrigGUID.IsEmpty() && _me) + _meOrigGUID = _me.GetGUID(); + if (_goOrigGUID.IsEmpty() && _go) + _goOrigGUID = _go.GetGUID(); + _go = null; + _me = target.ToCreature(); break; } else if (IsGameObject(target)) { - if (meOrigGUID.IsEmpty() && me) - meOrigGUID = me.GetGUID(); - if (goOrigGUID.IsEmpty() && go) - goOrigGUID = go.GetGUID(); - go = target.ToGameObject(); - me = null; + if (_meOrigGUID.IsEmpty() && _me) + _meOrigGUID = _me.GetGUID(); + if (_goOrigGUID.IsEmpty() && _go) + _goOrigGUID = _go.GetGUID(); + _go = target.ToGameObject(); + _me = null; break; } } @@ -1526,7 +1558,7 @@ namespace Game.AI { if (e.GetTargetType() == SmartTargets.None) { - Log.outError(LogFilter.Sql, "SmartScript: Entry {0} SourceType {1} Event {2} Action {3} is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); + Log.outError(LogFilter.Sql, "SmartScript: Entry {0} SourceType {1} Event {2} Action {3} is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.EntryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); break; } @@ -1618,7 +1650,7 @@ namespace Game.AI } case SmartActions.CallRandomTimedActionlist: { - List actionLists = new List(); + List actionLists = new(); var randTimedActionList = e.Action.randTimedActionList; foreach (var id in new[] { randTimedActionList.actionList1, randTimedActionList.actionList2, randTimedActionList.actionList3, randTimedActionList.actionList4, randTimedActionList.actionList5, randTimedActionList.actionList6 }) if (id != 0) @@ -1626,7 +1658,7 @@ namespace Game.AI if (e.GetTargetType() == SmartTargets.None) { - Log.outError(LogFilter.Sql, "SmartScript: Entry {0} SourceType {1} Event {2} Action {3} is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); + Log.outError(LogFilter.Sql, "SmartScript: Entry {0} SourceType {1} Event {2} Action {3} is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.EntryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); break; } @@ -1666,7 +1698,7 @@ namespace Game.AI uint id = 0;// RandomHelper.URand(e.Action.randTimedActionList.actionLists[0], e.Action.randTimedActionList.actionLists[1]); if (e.GetTargetType() == SmartTargets.None) { - Log.outError(LogFilter.Sql, "SmartScript: Entry {0} SourceType {1} Event {2} Action {3} is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); + Log.outError(LogFilter.Sql, "SmartScript: Entry {0} SourceType {1} Event {2} Action {3} is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.EntryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); break; } @@ -1722,12 +1754,12 @@ namespace Game.AI } } - if (!foundTarget && me != null && IsCreature(me)) + if (!foundTarget && _me != null && IsCreature(_me)) { if (e.Action.moveRandom.distance != 0) - me.GetMotionMaster().MoveRandom(e.Action.moveRandom.distance); + _me.GetMotionMaster().MoveRandom(e.Action.moveRandom.distance); else - me.GetMotionMaster().MoveIdle(); + _me.GetMotionMaster().MoveIdle(); } break; } @@ -1885,10 +1917,10 @@ namespace Game.AI e.Action.sendGossipMenu.gossipMenuId, e.Action.sendGossipMenu.gossipNpcTextId); // override default gossip - if (me) - ((SmartAI)me.GetAI()).SetGossipReturn(true); - else if (go) - ((SmartGameObjectAI)go.GetAI()).SetGossipReturn(true); + if (_me) + ((SmartAI)_me.GetAI()).SetGossipReturn(true); + else if (_go) + ((SmartGameObjectAI)_go.GetAI()).SetGossipReturn(true); foreach (var target in targets) { @@ -1912,7 +1944,7 @@ namespace Game.AI if (IsCreature(target)) { if (e.GetTargetType() == SmartTargets.Self) - target.ToCreature().SetHomePosition(me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetOrientation()); + target.ToCreature().SetHomePosition(_me.GetPositionX(), _me.GetPositionY(), _me.GetPositionZ(), _me.GetOrientation()); else if (e.GetTargetType() == SmartTargets.Position) target.ToCreature().SetHomePosition(e.Target.x, e.Target.y, e.Target.z, e.Target.o); else if (e.GetTargetType() == SmartTargets.CreatureRange || e.GetTargetType() == SmartTargets.CreatureGuid || @@ -1934,14 +1966,14 @@ namespace Game.AI { foreach (var target in targets) if (IsCreature(target)) - target.ToCreature().SetRegenerateHealth(e.Action.setHealthRegen.regenHealth != 0 ? true : false); + target.ToCreature().SetRegenerateHealth(e.Action.setHealthRegen.regenHealth != 0); break; } case SmartActions.SetRoot: { foreach (var target in targets) if (IsCreature(target)) - target.ToCreature().SetControlled(e.Action.setRoot.root != 0 ? true : false, UnitState.Root); + target.ToCreature().SetControlled(e.Action.setRoot.root != 0, UnitState.Root); break; } case SmartActions.SetGoFlag: @@ -2019,7 +2051,7 @@ namespace Game.AI } case SmartActions.StartClosestWaypoint: { - List waypoints = new List(); + List waypoints = new(); var closestWaypointFromList = e.Action.closestWaypointFromList; foreach (var id in new[] { closestWaypointFromList.wp1, closestWaypointFromList.wp2, closestWaypointFromList.wp3, closestWaypointFromList.wp4, closestWaypointFromList.wp5, closestWaypointFromList.wp6 }) if (id != 0) @@ -2063,7 +2095,7 @@ namespace Game.AI } case SmartActions.RandomSound: { - List sounds = new List(); + List sounds = new(); var randomSound = e.Action.randomSound; foreach (var id in new[] { randomSound.sound1, randomSound.sound2, randomSound.sound3, randomSound.sound4 }) if (id != 0) @@ -2107,7 +2139,7 @@ namespace Game.AI else { // Delayed spawn (use values from parameter to schedule event to call us back - SmartEvent ne = new SmartEvent(); + SmartEvent ne = new(); ne.type = SmartEvents.Update; ne.event_chance = 100; @@ -2119,7 +2151,7 @@ namespace Game.AI ne.event_flags = 0; ne.event_flags |= SmartEventFlags.NotRepeatable; - SmartAction ac = new SmartAction(); + SmartAction ac = new(); ac.type = SmartActions.SpawnSpawngroup; ac.groupSpawn.groupId = e.Action.groupSpawn.groupId; ac.groupSpawn.minDelay = 0; @@ -2127,13 +2159,13 @@ namespace Game.AI ac.groupSpawn.spawnflags = e.Action.groupSpawn.spawnflags; ac.timeEvent.id = e.Action.timeEvent.id; - SmartScriptHolder ev = new SmartScriptHolder(); + SmartScriptHolder ev = new(); ev.Event = ne; - ev.event_id = e.event_id; + ev.EventId = e.EventId; ev.Target = e.Target; ev.Action = ac; InitTimer(ev); - mStoredEvents.Add(ev); + _storedEvents.Add(ev); } break; } @@ -2149,7 +2181,7 @@ namespace Game.AI else { // Delayed spawn (use values from parameter to schedule event to call us back - SmartEvent ne = new SmartEvent(); + SmartEvent ne = new(); ne.type = SmartEvents.Update; ne.event_chance = 100; @@ -2161,7 +2193,7 @@ namespace Game.AI ne.event_flags = 0; ne.event_flags |= SmartEventFlags.NotRepeatable; - SmartAction ac = new SmartAction(); + SmartAction ac = new(); ac.type = SmartActions.DespawnSpawngroup; ac.groupSpawn.groupId = e.Action.groupSpawn.groupId; ac.groupSpawn.minDelay = 0; @@ -2169,13 +2201,13 @@ namespace Game.AI ac.groupSpawn.spawnflags = e.Action.groupSpawn.spawnflags; ac.timeEvent.id = e.Action.timeEvent.id; - SmartScriptHolder ev = new SmartScriptHolder(); + SmartScriptHolder ev = new(); ev.Event = ne; - ev.event_id = e.event_id; + ev.EventId = e.EventId; ev.Target = e.Target; ev.Action = ac; InitTimer(ev); - mStoredEvents.Add(ev); + _storedEvents.Add(ev); } break; } @@ -2184,7 +2216,7 @@ namespace Game.AI if (!IsSmart()) break; - ((SmartAI)me.GetAI()).SetEvadeDisabled(e.Action.disableEvade.disable != 0); + ((SmartAI)_me.GetAI()).SetEvadeDisabled(e.Action.disableEvade.disable != 0); break; } case SmartActions.RemoveAurasByType: // can be used to exit vehicle for example @@ -2207,7 +2239,7 @@ namespace Game.AI { foreach (var target in targets) if (IsCreature(target)) - target.ToCreature().GetMotionMaster().MoveFleeing(me, e.Action.flee.fleeTime); + target.ToCreature().GetMotionMaster().MoveFleeing(_me, e.Action.flee.fleeTime); break; } @@ -2215,7 +2247,7 @@ namespace Game.AI { foreach (var target in targets) if (IsUnit(target)) - me.GetThreatManager().AddThreat(target.ToUnit(), (float)(e.Action.threatPCT.threatINC - (float)e.Action.threatPCT.threatDEC), null, true, true); + _me.GetThreatManager().AddThreat(target.ToUnit(), (float)(e.Action.threatPCT.threatINC - (float)e.Action.threatPCT.threatDEC), null, true, true); break; } @@ -2313,7 +2345,7 @@ namespace Game.AI foreach (var target in targets) if (IsCreature(target)) - me.SetSpeed((UnitMoveType)e.Action.movementSpeed.movementType, speed); + _me.SetSpeed((UnitMoveType)e.Action.movementSpeed.movementType, speed); break; } @@ -2348,24 +2380,24 @@ namespace Game.AI break; } default: - Log.outError(LogFilter.Sql, "SmartScript.ProcessAction: Entry {0} SourceType {1}, Event {2}, Unhandled Action type {3}", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + Log.outError(LogFilter.Sql, "SmartScript.ProcessAction: Entry {0} SourceType {1}, Event {2}, Unhandled Action type {3}", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType()); break; } - if (e.link != 0 && e.link != e.event_id) + if (e.Link != 0 && e.Link != e.EventId) { - SmartScriptHolder linked = Global.SmartAIMgr.FindLinkedEvent(mEvents, e.link); + SmartScriptHolder linked = Global.SmartAIMgr.FindLinkedEvent(_events, e.Link); if (linked != null) ProcessEvent(linked, unit, var0, var1, bvar, spell, gob, varString); else - Log.outError(LogFilter.Sql, "SmartScript.ProcessAction: Entry {0} SourceType {1}, Event {2}, Link Event {3} not found or invalid, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.link); + Log.outError(LogFilter.Sql, "SmartScript.ProcessAction: Entry {0} SourceType {1}, Event {2}, Link Event {3} not found or invalid, skipped.", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.Link); } } void ProcessTimedAction(SmartScriptHolder e, uint min, uint max, Unit unit = null, uint var0 = 0, uint var1 = 0, bool bvar = false, SpellInfo spell = null, GameObject gob = null, string varString = "") { // We may want to execute action rarely and because of this if condition is not fulfilled the action will be rechecked in a long time - if (Global.ConditionMgr.IsObjectMeetingSmartEventConditions(e.entryOrGuid, e.event_id, e.source_type, unit, GetBaseObject())) + if (Global.ConditionMgr.IsObjectMeetingSmartEventConditions(e.EntryOrGuid, e.EventId, e.SourceType, unit, GetBaseObject())) { RecalcTimer(e, min, max); ProcessAction(e, unit, var0, var1, bvar, spell, gob, varString); @@ -2379,13 +2411,13 @@ namespace Game.AI if (GetBaseObject() == null) return; - if (mTemplate != SmartAITemplate.Basic) + if (_template != SmartAITemplate.Basic) { - Log.outError(LogFilter.Sql, "SmartScript.InstallTemplate: Entry {0} SourceType {1} AI Template can not be set more then once, skipped.", e.entryOrGuid, e.GetScriptType()); + Log.outError(LogFilter.Sql, "SmartScript.InstallTemplate: Entry {0} SourceType {1} AI Template can not be set more then once, skipped.", e.EntryOrGuid, e.GetScriptType()); return; } - mTemplate = (SmartAITemplate)e.Action.installTtemplate.id; + _template = (SmartAITemplate)e.Action.installTtemplate.id; switch ((SmartAITemplate)e.Action.installTtemplate.id) { case SmartAITemplate.Caster: @@ -2406,7 +2438,7 @@ namespace Game.AI } case SmartAITemplate.CagedNPCPart: { - if (me == null) + if (_me == null) return; //store cage as id1 AddEvent(SmartEvents.DataSet, 0, 0, 0, 0, 0, 0, SmartActions.StoreTargetList, 1, 0, 0, 0, 0, 0, SmartTargets.ClosestGameobject, e.Action.installTtemplate.param1, 10, 0, 0); @@ -2423,13 +2455,13 @@ namespace Game.AI //phase 1: despawn after time on movepoint reached AddEvent(SmartEvents.Movementinform, 0, (uint)MovementGeneratorType.Point, EventId.SmartRandomPoint, 0, 0, 0, SmartActions.ForceDespawn, e.Action.installTtemplate.param2, 0, 0, 0, 0, 0, SmartTargets.None, 0, 0, 0, 1); - if (Global.CreatureTextMgr.TextExist(me.GetEntry(), (byte)e.Action.installTtemplate.param5)) + if (Global.CreatureTextMgr.TextExist(_me.GetEntry(), (byte)e.Action.installTtemplate.param5)) AddEvent(SmartEvents.Movementinform, 0, (uint)MovementGeneratorType.Point, EventId.SmartRandomPoint, 0, 0, 0, SmartActions.Talk, e.Action.installTtemplate.param5, 0, 0, 0, 0, 0, SmartTargets.None, 0, 0, 0, 1); break; } case SmartAITemplate.CagedGOPart: { - if (go == null) + if (_go == null) return; //store hostage as id1 AddEvent(SmartEvents.GoLootStateChanged, 0, 2, 0, 0, 0, 0, SmartActions.StoreTargetList, 1, 0, 0, 0, 0, 0, SmartTargets.ClosestCreature, e.Action.installTtemplate.param1, 10, 0, 0); @@ -2453,14 +2485,14 @@ namespace Game.AI SmartActions action, uint action_param1, uint action_param2, uint action_param3, uint action_param4, uint action_param5, uint action_param6, SmartTargets t, uint target_param1, uint target_param2, uint target_param3, uint phaseMask) { - mInstallEvents.Add(CreateSmartEvent(e, event_flags, event_param1, event_param2, event_param3, event_param4, event_param5, action, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, t, target_param1, target_param2, target_param3, phaseMask)); + _installEvents.Add(CreateSmartEvent(e, event_flags, event_param1, event_param2, event_param3, event_param4, event_param5, action, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, t, target_param1, target_param2, target_param3, phaseMask)); } SmartScriptHolder CreateSmartEvent(SmartEvents e, SmartEventFlags event_flags, uint event_param1, uint event_param2, uint event_param3, uint event_param4, uint event_param5, SmartActions action, uint action_param1, uint action_param2, uint action_param3, uint action_param4, uint action_param5, uint action_param6, SmartTargets t, uint target_param1, uint target_param2, uint target_param3, uint phaseMask) { - SmartScriptHolder script = new SmartScriptHolder(); + SmartScriptHolder script = new(); script.Event.type = e; script.Event.raw.param1 = event_param1; script.Event.raw.param2 = event_param2; @@ -2484,7 +2516,7 @@ namespace Game.AI script.Target.raw.param2 = target_param2; script.Target.raw.param3 = target_param3; - script.source_type = SmartScriptType.Creature; + script.SourceType = SmartScriptType.Creature; InitTimer(script); return script; } @@ -2500,7 +2532,7 @@ namespace Game.AI WorldObject baseObject = GetBaseObject(); - List targets = new List(); + List targets = new(); switch (e.GetTargetType()) { case SmartTargets.Self: @@ -2508,81 +2540,81 @@ namespace Game.AI targets.Add(baseObject); break; case SmartTargets.Victim: - if (me != null && me.GetVictim() != null) - targets.Add(me.GetVictim()); + if (_me != null && _me.GetVictim() != null) + targets.Add(_me.GetVictim()); break; case SmartTargets.HostileSecondAggro: - if (me != null) + if (_me != null) { if (e.Target.hostilRandom.powerType != 0) { - Unit u = me.GetAI().SelectTarget(SelectAggroTarget.MaxThreat, 1, new PowerUsersSelector(me, (PowerType)(e.Target.hostilRandom.powerType - 1), (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0)); + Unit u = _me.GetAI().SelectTarget(SelectAggroTarget.MaxThreat, 1, new PowerUsersSelector(_me, (PowerType)(e.Target.hostilRandom.powerType - 1), (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0)); if (u != null) targets.Add(u); } else { - Unit u = me.GetAI().SelectTarget(SelectAggroTarget.MaxThreat, 1, (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0); + Unit u = _me.GetAI().SelectTarget(SelectAggroTarget.MaxThreat, 1, (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0); if (u != null) targets.Add(u); } } break; case SmartTargets.HostileLastAggro: - if (me != null) + if (_me != null) { if (e.Target.hostilRandom.powerType != 0) { - Unit u = me.GetAI().SelectTarget(SelectAggroTarget.MinThreat, 1, new PowerUsersSelector(me, (PowerType)(e.Target.hostilRandom.powerType - 1), (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0)); + Unit u = _me.GetAI().SelectTarget(SelectAggroTarget.MinThreat, 1, new PowerUsersSelector(_me, (PowerType)(e.Target.hostilRandom.powerType - 1), (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0)); if (u != null) targets.Add(u); } else { - Unit u = me.GetAI().SelectTarget(SelectAggroTarget.MinThreat, 1, (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0); + Unit u = _me.GetAI().SelectTarget(SelectAggroTarget.MinThreat, 1, (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0); if (u != null) targets.Add(u); } } break; case SmartTargets.HostileRandom: - if (me != null) + if (_me != null) { if (e.Target.hostilRandom.powerType != 0) { - Unit u = me.GetAI().SelectTarget(SelectAggroTarget.Random, 1, new PowerUsersSelector(me, (PowerType)(e.Target.hostilRandom.powerType - 1), (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0)); + Unit u = _me.GetAI().SelectTarget(SelectAggroTarget.Random, 1, new PowerUsersSelector(_me, (PowerType)(e.Target.hostilRandom.powerType - 1), (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0)); if (u != null) targets.Add(u); } else { - Unit u = me.GetAI().SelectTarget(SelectAggroTarget.Random, 1, (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0); + Unit u = _me.GetAI().SelectTarget(SelectAggroTarget.Random, 1, (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0); if (u != null) targets.Add(u); } } break; case SmartTargets.HostileRandomNotTop: - if (me != null) + if (_me != null) { if (e.Target.hostilRandom.powerType != 0) { - Unit u = me.GetAI().SelectTarget(SelectAggroTarget.Random, 1, new PowerUsersSelector(me, (PowerType)(e.Target.hostilRandom.powerType - 1), (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0)); + Unit u = _me.GetAI().SelectTarget(SelectAggroTarget.Random, 1, new PowerUsersSelector(_me, (PowerType)(e.Target.hostilRandom.powerType - 1), (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0)); if (u != null) targets.Add(u); } else { - Unit u = me.GetAI().SelectTarget(SelectAggroTarget.Random, 1, (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0); + Unit u = _me.GetAI().SelectTarget(SelectAggroTarget.Random, 1, (float)e.Target.hostilRandom.maxDist, e.Target.hostilRandom.playerOnly != 0); if (u != null) targets.Add(u); } } break; case SmartTargets.Farthest: - if (me) + if (_me) { - Unit u = me.GetAI().SelectTarget(SelectAggroTarget.MaxDistance, 0, new FarthestTargetSelector(me, (float)e.Target.farthest.maxDist, e.Target.farthest.playerOnly != 0, e.Target.farthest.isInLos != 0)); + Unit u = _me.GetAI().SelectTarget(SelectAggroTarget.MaxDistance, 0, new FarthestTargetSelector(_me, (float)e.Target.farthest.maxDist, e.Target.farthest.playerOnly != 0, e.Target.farthest.isInLos != 0)); if (u != null) targets.Add(u); } @@ -2628,7 +2660,7 @@ namespace Game.AI if (!IsCreature(obj)) continue; - if (me != null && me == obj) + if (_me != null && _me == obj) continue; if ((e.Target.unitRange.creature == 0 || obj.ToCreature().GetEntry() == e.Target.unitRange.creature) && baseObject.IsInRange(obj, e.Target.unitRange.minDist, e.Target.unitRange.maxDist)) @@ -2644,7 +2676,7 @@ namespace Game.AI if (!IsCreature(obj)) continue; - if (me != null && me == obj) + if (_me != null && _me == obj) continue; if (e.Target.unitDistance.creature == 0 || obj.ToCreature().GetEntry() == e.Target.unitDistance.creature) @@ -2660,7 +2692,7 @@ namespace Game.AI if (!IsGameObject(obj)) continue; - if (go != null && go == obj) + if (_go != null && _go == obj) continue; if (e.Target.goDistance.entry == 0 || obj.ToGameObject().GetEntry() == e.Target.goDistance.entry) @@ -2676,7 +2708,7 @@ namespace Game.AI if (!IsGameObject(obj)) continue; - if (go != null && go == obj) + if (_go != null && _go == obj) continue; if ((e.Target.goRange.entry == 0 && obj.ToGameObject().GetEntry() == e.Target.goRange.entry) && baseObject.IsInRange(obj, e.Target.goRange.minDist, e.Target.goRange.maxDist)) @@ -2771,12 +2803,12 @@ namespace Game.AI } case SmartTargets.OwnerOrSummoner: { - if (me != null) + if (_me != null) { - ObjectGuid charmerOrOwnerGuid = me.GetCharmerOrOwnerGUID(); + ObjectGuid charmerOrOwnerGuid = _me.GetCharmerOrOwnerGUID(); if (charmerOrOwnerGuid.IsEmpty()) { - TempSummon tempSummon = me.ToTempSummon(); + TempSummon tempSummon = _me.ToTempSummon(); if (tempSummon) { Unit summoner = tempSummon.GetSummoner(); @@ -2786,15 +2818,15 @@ namespace Game.AI } if (charmerOrOwnerGuid.IsEmpty()) - charmerOrOwnerGuid = me.GetCreatorGUID(); + charmerOrOwnerGuid = _me.GetCreatorGUID(); - Unit owner = Global.ObjAccessor.GetUnit(me, charmerOrOwnerGuid); + Unit owner = Global.ObjAccessor.GetUnit(_me, charmerOrOwnerGuid); if (owner != null) targets.Add(owner); } - else if (go != null) + else if (_go != null) { - Unit owner = Global.ObjAccessor.GetUnit(go, go.GetOwnerGUID()); + Unit owner = Global.ObjAccessor.GetUnit(_go, _go.GetOwnerGUID()); if (owner) targets.Add(owner); } @@ -2813,20 +2845,19 @@ namespace Game.AI } case SmartTargets.ThreatList: { - if (me != null && me.CanHaveThreatList()) + if (_me != null && _me.CanHaveThreatList()) { - var threatList = me.GetThreatManager().GetThreatList(); - foreach (var refe in me.GetThreatManager().GetThreatList()) - if (e.Target.hostilRandom.maxDist == 0 || me.IsWithinCombatRange(refe.GetTarget(), e.Target.hostilRandom.maxDist)) + foreach (var refe in _me.GetThreatManager().GetThreatList()) + if (e.Target.hostilRandom.maxDist == 0 || _me.IsWithinCombatRange(refe.GetTarget(), e.Target.hostilRandom.maxDist)) targets.Add(refe.GetTarget()); } break; } case SmartTargets.ClosestEnemy: { - if (me != null) + if (_me != null) { - Unit target = me.SelectNearestTarget(e.Target.closestAttackable.maxDist); + Unit target = _me.SelectNearestTarget(e.Target.closestAttackable.maxDist); if (target != null) targets.Add(target); } @@ -2835,7 +2866,7 @@ namespace Game.AI } case SmartTargets.ClosestFriendly: { - if (me != null) + if (_me != null) { Unit target = DoFindClosestFriendlyInRange(e.Target.closestFriendly.maxDist); if (target != null) @@ -2845,22 +2876,22 @@ namespace Game.AI } case SmartTargets.LootRecipients: { - if (me) + if (_me) { - Group lootGroup = me.GetLootRecipientGroup(); + Group lootGroup = _me.GetLootRecipientGroup(); if (lootGroup) { for (GroupReference refe = lootGroup.GetFirstMember(); refe != null; refe = refe.Next()) { Player recipient = refe.GetSource(); if (recipient) - if (recipient.IsInMap(me)) + if (recipient.IsInMap(_me)) targets.Add(recipient); } } else { - Player recipient = me.GetLootRecipient(); + Player recipient = _me.GetLootRecipient(); if (recipient) targets.Add(recipient); } @@ -2869,9 +2900,9 @@ namespace Game.AI } case SmartTargets.VehicleAccessory: { - if (me && me.IsVehicle()) + if (_me && _me.IsVehicle()) { - Unit target = me.GetVehicleKit().GetPassenger((sbyte)e.Target.vehicle.seat); + Unit target = _me.GetVehicleKit().GetPassenger((sbyte)e.Target.vehicle.seat); if (target) targets.Add(target); } @@ -2887,7 +2918,7 @@ namespace Game.AI List GetWorldObjectsInDist(float dist) { - List targets = new List(); + List targets = new(); WorldObject obj = GetBaseObject(); if (obj == null) return targets; @@ -2900,13 +2931,13 @@ namespace Game.AI void ProcessEvent(SmartScriptHolder e, Unit unit = null, uint var0 = 0, uint var1 = 0, bool bvar = false, SpellInfo spell = null, GameObject gob = null, string varString = "") { - if (!e.active && e.GetEventType() != SmartEvents.Link) + if (!e.Active && e.GetEventType() != SmartEvents.Link) return; - if ((e.Event.event_phase_mask != 0 && !IsInPhase(e.Event.event_phase_mask)) || (e.Event.event_flags.HasAnyFlag(SmartEventFlags.NotRepeatable) && e.runOnce)) + if ((e.Event.event_phase_mask != 0 && !IsInPhase(e.Event.event_phase_mask)) || (e.Event.event_flags.HasAnyFlag(SmartEventFlags.NotRepeatable) && e.RunOnce)) return; - if (!e.Event.event_flags.HasAnyFlag(SmartEventFlags.WhileCharmed) && IsCharmedCreature(me)) + if (!e.Event.event_flags.HasAnyFlag(SmartEventFlags.WhileCharmed) && IsCharmedCreature(_me)) return; switch (e.GetEventType()) @@ -2919,20 +2950,20 @@ namespace Game.AI ProcessTimedAction(e, e.Event.minMaxRepeat.repeatMin, e.Event.minMaxRepeat.repeatMax); break; case SmartEvents.UpdateOoc: - if (me != null && me.IsEngaged()) + if (_me != null && _me.IsEngaged()) return; ProcessTimedAction(e, e.Event.minMaxRepeat.repeatMin, e.Event.minMaxRepeat.repeatMax); break; case SmartEvents.UpdateIc: - if (me == null || !me.IsEngaged()) + if (_me == null || !_me.IsEngaged()) return; ProcessTimedAction(e, e.Event.minMaxRepeat.repeatMin, e.Event.minMaxRepeat.repeatMax); break; case SmartEvents.HealthPct: { - if (me == null || !me.IsEngaged() || me.GetMaxHealth() == 0) + if (_me == null || !_me.IsEngaged() || _me.GetMaxHealth() == 0) return; - uint perc = (uint)me.GetHealthPct(); + uint perc = (uint)_me.GetHealthPct(); if (perc > e.Event.minMaxRepeat.max || perc < e.Event.minMaxRepeat.min) return; ProcessTimedAction(e, e.Event.minMaxRepeat.repeatMin, e.Event.minMaxRepeat.repeatMax); @@ -2940,19 +2971,19 @@ namespace Game.AI } case SmartEvents.TargetHealthPct: { - if (me == null || !me.IsEngaged() || me.GetVictim() == null || me.GetVictim().GetMaxHealth() == 0) + if (_me == null || !_me.IsEngaged() || _me.GetVictim() == null || _me.GetVictim().GetMaxHealth() == 0) return; - uint perc = (uint)me.GetVictim().GetHealthPct(); + uint perc = (uint)_me.GetVictim().GetHealthPct(); if (perc > e.Event.minMaxRepeat.max || perc < e.Event.minMaxRepeat.min) return; - ProcessTimedAction(e, e.Event.minMaxRepeat.repeatMin, e.Event.minMaxRepeat.repeatMax, me.GetVictim()); + ProcessTimedAction(e, e.Event.minMaxRepeat.repeatMin, e.Event.minMaxRepeat.repeatMax, _me.GetVictim()); break; } case SmartEvents.ManaPct: { - if (me == null || !me.IsEngaged() || me.GetMaxPower(PowerType.Mana) == 0) + if (_me == null || !_me.IsEngaged() || _me.GetMaxPower(PowerType.Mana) == 0) return; - uint perc = (uint)me.GetPowerPct(PowerType.Mana); + uint perc = (uint)_me.GetPowerPct(PowerType.Mana); if (perc > e.Event.minMaxRepeat.max || perc < e.Event.minMaxRepeat.min) return; ProcessTimedAction(e, e.Event.minMaxRepeat.repeatMin, e.Event.minMaxRepeat.repeatMax); @@ -2960,31 +2991,31 @@ namespace Game.AI } case SmartEvents.TargetManaPct: { - if (me == null || !me.IsEngaged() || me.GetVictim() == null || me.GetVictim().GetMaxPower(PowerType.Mana) == 0) + if (_me == null || !_me.IsEngaged() || _me.GetVictim() == null || _me.GetVictim().GetMaxPower(PowerType.Mana) == 0) return; - uint perc = (uint)me.GetVictim().GetPowerPct(PowerType.Mana); + uint perc = (uint)_me.GetVictim().GetPowerPct(PowerType.Mana); if (perc > e.Event.minMaxRepeat.max || perc < e.Event.minMaxRepeat.min) return; - ProcessTimedAction(e, e.Event.minMaxRepeat.repeatMin, e.Event.minMaxRepeat.repeatMax, me.GetVictim()); + ProcessTimedAction(e, e.Event.minMaxRepeat.repeatMin, e.Event.minMaxRepeat.repeatMax, _me.GetVictim()); break; } case SmartEvents.Range: { - if (me == null || !me.IsEngaged() || me.GetVictim() == null) + if (_me == null || !_me.IsEngaged() || _me.GetVictim() == null) return; - if (me.IsInRange(me.GetVictim(), e.Event.minMaxRepeat.min, e.Event.minMaxRepeat.max)) - ProcessTimedAction(e, e.Event.minMaxRepeat.repeatMin, e.Event.minMaxRepeat.repeatMax, me.GetVictim()); + if (_me.IsInRange(_me.GetVictim(), e.Event.minMaxRepeat.min, e.Event.minMaxRepeat.max)) + ProcessTimedAction(e, e.Event.minMaxRepeat.repeatMin, e.Event.minMaxRepeat.repeatMax, _me.GetVictim()); else // make it predictable RecalcTimer(e, 500, 500); break; } case SmartEvents.VictimCasting: { - if (me == null || !me.IsEngaged()) + if (_me == null || !_me.IsEngaged()) return; - Unit victim = me.GetVictim(); + Unit victim = _me.GetVictim(); if (victim == null || !victim.IsNonMeleeSpellCast(false, false, true)) return; @@ -2997,12 +3028,12 @@ namespace Game.AI return; } - ProcessTimedAction(e, e.Event.targetCasting.repeatMin, e.Event.targetCasting.repeatMax, me.GetVictim()); + ProcessTimedAction(e, e.Event.targetCasting.repeatMin, e.Event.targetCasting.repeatMax, _me.GetVictim()); break; } case SmartEvents.FriendlyHealth: { - if (me == null || !me.IsEngaged()) + if (_me == null || !_me.IsEngaged()) return; Unit target = DoSelectLowestHpFriendly(e.Event.friendlyHealth.radius, e.Event.friendlyHealth.hpDeficit); @@ -3018,10 +3049,10 @@ namespace Game.AI } case SmartEvents.FriendlyIsCc: { - if (me == null || !me.IsEngaged()) + if (_me == null || !_me.IsEngaged()) return; - List creatures = new List(); + List creatures = new(); DoFindFriendlyCC(creatures, e.Event.friendlyCC.radius); if (creatures.Empty()) { @@ -3035,7 +3066,7 @@ namespace Game.AI } case SmartEvents.FriendlyMissingBuff: { - List creatures = new List(); + List creatures = new(); DoFindFriendlyMissingBuff(creatures, e.Event.missingBuff.radius, e.Event.missingBuff.spell); if (creatures.Empty()) @@ -3046,18 +3077,18 @@ namespace Game.AI } case SmartEvents.HasAura: { - if (me == null) + if (_me == null) return; - uint count = me.GetAuraCount(e.Event.aura.spell); + uint count = _me.GetAuraCount(e.Event.aura.spell); if ((e.Event.aura.count == 0 && count == 0) || (e.Event.aura.count != 0 && count >= e.Event.aura.count)) ProcessTimedAction(e, e.Event.aura.repeatMin, e.Event.aura.repeatMax); break; } case SmartEvents.TargetBuffed: { - if (me == null || me.GetVictim() == null) + if (_me == null || _me.GetVictim() == null) return; - uint count = me.GetVictim().GetAuraCount(e.Event.aura.spell); + uint count = _me.GetVictim().GetAuraCount(e.Event.aura.spell); if (count < e.Event.aura.count) return; ProcessTimedAction(e, e.Event.aura.repeatMin, e.Event.aura.repeatMax); @@ -3109,13 +3140,13 @@ namespace Game.AI } case SmartEvents.IsBehindTarget: { - if (me == null) + if (_me == null) return; - Unit victim = me.GetVictim(); + Unit victim = _me.GetVictim(); if (victim != null) { - if (!victim.HasInArc(MathFunctions.PI, me)) + if (!victim.HasInArc(MathFunctions.PI, _me)) ProcessTimedAction(e, e.Event.behindTarget.cooldownMin, e.Event.behindTarget.cooldownMax, victim); } break; @@ -3129,7 +3160,7 @@ namespace Game.AI break; case SmartEvents.Kill: { - if (me == null || unit == null) + if (_me == null || unit == null) return; if (e.Event.kill.playerOnly != 0 && !unit.IsTypeId(TypeId.Player)) return; @@ -3154,16 +3185,16 @@ namespace Game.AI } case SmartEvents.OocLos: { - if (me == null || me.IsEngaged()) + if (_me == null || _me.IsEngaged()) return; //can trigger if closer than fMaxAllowedRange float range = e.Event.los.maxDist; //if range is ok and we are actually in LOS - if (me.IsWithinDistInMap(unit, range) && me.IsWithinLOSInMap(unit)) + if (_me.IsWithinDistInMap(unit, range) && _me.IsWithinLOSInMap(unit)) { //if friendly event&&who is not hostile OR hostile event&&who is hostile - if ((e.Event.los.noHostile != 0 && !me.IsHostileTo(unit)) || (e.Event.los.noHostile == 0 && me.IsHostileTo(unit))) + if ((e.Event.los.noHostile != 0 && !_me.IsHostileTo(unit)) || (e.Event.los.noHostile == 0 && _me.IsHostileTo(unit))) { if (e.Event.los.playerOnly != 0 && !unit.IsTypeId(TypeId.Player)) return; @@ -3176,16 +3207,16 @@ namespace Game.AI } case SmartEvents.IcLos: { - if (me == null || !me.IsEngaged()) + if (_me == null || !_me.IsEngaged()) return; //can trigger if closer than fMaxAllowedRange float range = e.Event.los.maxDist; //if range is ok and we are actually in LOS - if (me.IsWithinDistInMap(unit, range) && me.IsWithinLOSInMap(unit)) + if (_me.IsWithinDistInMap(unit, range) && _me.IsWithinLOSInMap(unit)) { //if friendly event&&who is not hostile OR hostile event&&who is hostile - if ((e.Event.los.noHostile != 0 && !me.IsHostileTo(unit)) || (e.Event.los.noHostile == 0 && me.IsHostileTo(unit))) + if ((e.Event.los.noHostile != 0 && !_me.IsHostileTo(unit)) || (e.Event.los.noHostile == 0 && _me.IsHostileTo(unit))) { if (e.Event.los.playerOnly != 0 && !unit.IsTypeId(TypeId.Player)) return; @@ -3248,7 +3279,7 @@ namespace Game.AI case SmartEvents.WaypointStopped: case SmartEvents.WaypointEnded: { - if (me == null || (e.Event.waypoint.pointID != 0 && var0 != e.Event.waypoint.pointID) || (e.Event.waypoint.pathID != 0 && var1 != e.Event.waypoint.pathID)) + if (_me == null || (e.Event.waypoint.pointID != 0 && var0 != e.Event.waypoint.pointID) || (e.Event.waypoint.pathID != 0 && var1 != e.Event.waypoint.pathID)) return; ProcessAction(e, unit); break; @@ -3368,7 +3399,7 @@ namespace Game.AI } case SmartEvents.FriendlyHealthPCT: { - if (me == null || !me.IsEngaged()) + if (_me == null || !_me.IsEngaged()) return; List targets; @@ -3394,7 +3425,7 @@ namespace Game.AI Unit unitTarget = null; foreach (var target in targets) { - if (IsUnit(target) && me.IsFriendlyTo(target.ToUnit()) && target.ToUnit().IsAlive() && target.ToUnit().IsInCombat()) + if (IsUnit(target) && _me.IsFriendlyTo(target.ToUnit()) && target.ToUnit().IsAlive() && target.ToUnit().IsInCombat()) { uint healthPct = (uint)target.ToUnit().GetHealthPct(); @@ -3414,25 +3445,25 @@ namespace Game.AI } case SmartEvents.DistanceCreature: { - if (!me) + if (!_me) return; Creature creature = null; if (e.Event.distance.guid != 0) { - creature = FindCreatureNear(me, e.Event.distance.guid); + creature = FindCreatureNear(_me, e.Event.distance.guid); if (!creature) return; - if (!me.IsInRange(creature, 0, e.Event.distance.dist)) + if (!_me.IsInRange(creature, 0, e.Event.distance.dist)) return; } else if (e.Event.distance.entry != 0) { - List list = new List(); - me.GetCreatureListWithEntryInGrid(list, e.Event.distance.entry, e.Event.distance.dist); + List list = new(); + _me.GetCreatureListWithEntryInGrid(list, e.Event.distance.entry, e.Event.distance.dist); if (!list.Empty()) creature = list.FirstOrDefault(); @@ -3445,25 +3476,25 @@ namespace Game.AI } case SmartEvents.DistanceGameobject: { - if (!me) + if (!_me) return; GameObject gameobject = null; if (e.Event.distance.guid != 0) { - gameobject = FindGameObjectNear(me, e.Event.distance.guid); + gameobject = FindGameObjectNear(_me, e.Event.distance.guid); if (!gameobject) return; - if (!me.IsInRange(gameobject, 0, e.Event.distance.dist)) + if (!_me.IsInRange(gameobject, 0, e.Event.distance.dist)) return; } else if (e.Event.distance.entry != 0) { - List list = new List(); - me.GetGameObjectListWithEntryInGrid(list, e.Event.distance.entry, e.Event.distance.dist); + List list = new(); + _me.GetGameObjectListWithEntryInGrid(list, e.Event.distance.entry, e.Event.distance.dist); if (!list.Empty()) gameobject = list.FirstOrDefault(); @@ -3519,20 +3550,20 @@ namespace Game.AI RecalcTimer(e, e.Event.distance.repeat, e.Event.distance.repeat); break; default: - e.active = true; + e.Active = true; break; } } void RecalcTimer(SmartScriptHolder e, uint min, uint max) { - if (e.entryOrGuid == 15294 && e.timer != 0) + if (e.EntryOrGuid == 15294 && e.Timer != 0) { Log.outError(LogFilter.Server, "Called RecalcTimer"); } // min/max was checked at loading! - e.timer = RandomHelper.URand(min, max); - e.active = e.timer == 0; + e.Timer = RandomHelper.URand(min, max); + e.Active = e.Timer == 0; } void UpdateTimer(SmartScriptHolder e, uint diff) @@ -3543,22 +3574,22 @@ namespace Game.AI if (e.Event.event_phase_mask != 0 && !IsInPhase(e.Event.event_phase_mask)) return; - if (e.GetEventType() == SmartEvents.UpdateIc && (me == null || !me.IsEngaged())) + if (e.GetEventType() == SmartEvents.UpdateIc && (_me == null || !_me.IsEngaged())) return; - if (e.GetEventType() == SmartEvents.UpdateOoc && (me != null && me.IsEngaged()))//can be used with me=NULL (go script) + if (e.GetEventType() == SmartEvents.UpdateOoc && (_me != null && _me.IsEngaged()))//can be used with me=NULL (go script) return; - if (e.timer < diff) + if (e.Timer < diff) { // delay spell cast event if another spell is being casted if (e.GetActionType() == SmartActions.Cast) { if (!Convert.ToBoolean(e.Action.cast.castFlags & (uint)SmartCastFlags.InterruptPrevious)) { - if (me != null && me.HasUnitState(UnitState.Casting)) + if (_me != null && _me.HasUnitState(UnitState.Casting)) { - e.timer = 1; + e.Timer = 1; return; } } @@ -3567,14 +3598,14 @@ namespace Game.AI // Delay flee for assist event if stunned or rooted if (e.GetActionType() == SmartActions.FleeForAssist) { - if (me && me.HasUnitState(UnitState.Root | UnitState.LostControl)) + if (_me && _me.HasUnitState(UnitState.Root | UnitState.LostControl)) { - e.timer = 1; + e.Timer = 1; return; } } - e.active = true;//activate events with cooldown + e.Active = true;//activate events with cooldown switch (e.GetEventType())//process ONLY timed events { case SmartEvents.Update: @@ -3599,13 +3630,13 @@ namespace Game.AI ProcessEvent(e); if (e.GetScriptType() == SmartScriptType.TimedActionlist) { - e.enableTimed = false;//disable event if it is in an ActionList and was processed once - foreach (var holder in mTimedActionList) + e.EnableTimed = false;//disable event if it is in an ActionList and was processed once + foreach (var holder in _timedActionList) { //find the first event which is not the current one and enable it - if (holder.event_id > e.event_id) + if (holder.EventId > e.EventId) { - holder.enableTimed = true; + holder.EnableTimed = true; break; } } @@ -3616,53 +3647,53 @@ namespace Game.AI } else { - e.timer -= diff; - if (e.entryOrGuid == 15294 && me.GetGUID().GetCounter() == 55039 && e.timer != 0) + e.Timer -= diff; + if (e.EntryOrGuid == 15294 && _me.GetGUID().GetCounter() == 55039 && e.Timer != 0) { - Log.outError(LogFilter.Server, "Called UpdateTimer: reduce timer: e.timer: {0}, diff: {1} current time: {2}", e.timer, diff, Time.GetMSTime()); + Log.outError(LogFilter.Server, "Called UpdateTimer: reduce timer: e.timer: {0}, diff: {1} current time: {2}", e.Timer, diff, Time.GetMSTime()); } } } - bool CheckTimer(SmartScriptHolder e) + public bool CheckTimer(SmartScriptHolder e) { - return e.active; + return e.Active; } void InstallEvents() { - if (!mInstallEvents.Empty()) + if (!_installEvents.Empty()) { - foreach (var holder in mInstallEvents) - mEvents.Add(holder);//must be before UpdateTimers + foreach (var holder in _installEvents) + _events.Add(holder);//must be before UpdateTimers - mInstallEvents.Clear(); + _installEvents.Clear(); } } public void OnUpdate(uint diff) { - if ((mScriptType == SmartScriptType.Creature || mScriptType == SmartScriptType.GameObject - || mScriptType == SmartScriptType.AreaTriggerEntity || mScriptType == SmartScriptType.AreaTriggerEntityServerside) + if ((_scriptType == SmartScriptType.Creature || _scriptType == SmartScriptType.GameObject + || _scriptType == SmartScriptType.AreaTriggerEntity || _scriptType == SmartScriptType.AreaTriggerEntityServerside) && !GetBaseObject()) return; InstallEvents();//before UpdateTimers - foreach (var holder in mEvents) + foreach (var holder in _events) UpdateTimer(holder, diff); - if (!mStoredEvents.Empty()) - foreach (var holder in mStoredEvents) + if (!_storedEvents.Empty()) + foreach (var holder in _storedEvents) UpdateTimer(holder, diff); bool needCleanup = true; - if (!mTimedActionList.Empty()) + if (!_timedActionList.Empty()) { - foreach (var holder in mTimedActionList) + foreach (var holder in _timedActionList) { - if (holder.enableTimed) + if (holder.EnableTimed) { UpdateTimer(holder, diff); needCleanup = false; @@ -3670,28 +3701,28 @@ namespace Game.AI } } if (needCleanup) - mTimedActionList.Clear(); + _timedActionList.Clear(); - if (!mRemIDs.Empty()) + if (!_remIDs.Empty()) { - foreach (var id in mRemIDs) + foreach (var id in _remIDs) RemoveStoredEvent(id); - mRemIDs.Clear(); + _remIDs.Clear(); } - if (mUseTextTimer && me != null) + if (_useTextTimer && _me != null) { - if (mTextTimer < diff) + if (_textTimer < diff) { - uint textID = mLastTextID; - mLastTextID = 0; - uint entry = mTalkerEntry; - mTalkerEntry = 0; - mTextTimer = 0; - mUseTextTimer = false; + uint textID = _lastTextID; + _lastTextID = 0; + uint entry = _talkerEntry; + _talkerEntry = 0; + _textTimer = 0; + _useTextTimer = false; ProcessEventsFor(SmartEvents.TextOver, null, textID, entry); } - else mTextTimer -= diff; + else _textTimer -= diff; } } @@ -3721,20 +3752,20 @@ namespace Game.AI case Difficulty.Normal: case Difficulty.Raid10N: if (holder.Event.event_flags.HasAnyFlag(SmartEventFlags.Difficulty0)) - mEvents.Add(holder); + _events.Add(holder); break; case Difficulty.Heroic: case Difficulty.Raid25N: if (holder.Event.event_flags.HasAnyFlag(SmartEventFlags.Difficulty1)) - mEvents.Add(holder); + _events.Add(holder); break; case Difficulty.Raid10HC: if (holder.Event.event_flags.HasAnyFlag(SmartEventFlags.Difficulty2)) - mEvents.Add(holder); + _events.Add(holder); break; case Difficulty.Raid25HC: if (holder.Event.event_flags.HasAnyFlag(SmartEventFlags.Difficulty3)) - mEvents.Add(holder); + _events.Add(holder); break; default: break; @@ -3742,46 +3773,46 @@ namespace Game.AI } continue; } - mEvents.Add(holder);//NOTE: 'world(0)' events still get processed in ANY instance mode + _events.Add(holder);//NOTE: 'world(0)' events still get processed in ANY instance mode } } void GetScript() { List e; - if (me != null) + if (_me != null) { - e = Global.SmartAIMgr.GetScript(-((int)me.GetSpawnId()), mScriptType); + e = Global.SmartAIMgr.GetScript(-((int)_me.GetSpawnId()), _scriptType); if (e.Empty()) - e = Global.SmartAIMgr.GetScript((int)me.GetEntry(), mScriptType); - FillScript(e, me, null, null, null); + e = Global.SmartAIMgr.GetScript((int)_me.GetEntry(), _scriptType); + FillScript(e, _me, null, null, null); } - else if (go != null) + else if (_go != null) { - e = Global.SmartAIMgr.GetScript(-((int)go.GetSpawnId()), mScriptType); + e = Global.SmartAIMgr.GetScript(-((int)_go.GetSpawnId()), _scriptType); if (e.Empty()) - e = Global.SmartAIMgr.GetScript((int)go.GetEntry(), mScriptType); - FillScript(e, go, null, null, null); + e = Global.SmartAIMgr.GetScript((int)_go.GetEntry(), _scriptType); + FillScript(e, _go, null, null, null); } - else if (trigger != null) + else if (_trigger != null) { - e = Global.SmartAIMgr.GetScript((int)trigger.Id, mScriptType); - FillScript(e, null, trigger, null, null); + e = Global.SmartAIMgr.GetScript((int)_trigger.Id, _scriptType); + FillScript(e, null, _trigger, null, null); } - else if (areaTrigger != null) + else if (_areaTrigger != null) { - e = Global.SmartAIMgr.GetScript((int)areaTrigger.GetEntry(), mScriptType); - FillScript(e, areaTrigger, null, null, null); + e = Global.SmartAIMgr.GetScript((int)_areaTrigger.GetEntry(), _scriptType); + FillScript(e, _areaTrigger, null, null, null); } - else if (sceneTemplate != null) + else if (_sceneTemplate != null) { - e = Global.SmartAIMgr.GetScript((int)sceneTemplate.SceneId, mScriptType); - FillScript(e, null, null, sceneTemplate, null); + e = Global.SmartAIMgr.GetScript((int)_sceneTemplate.SceneId, _scriptType); + FillScript(e, null, null, _sceneTemplate, null); } - else if (quest != null) + else if (_quest != null) { - e = Global.SmartAIMgr.GetScript((int)quest.Id, mScriptType); - FillScript(e, null, null, null, quest); + e = Global.SmartAIMgr.GetScript((int)_quest.Id, _scriptType); + FillScript(e, null, null, null, _quest); } } @@ -3792,19 +3823,19 @@ namespace Game.AI switch (obj.GetTypeId()) { case TypeId.Unit: - mScriptType = SmartScriptType.Creature; - me = obj.ToCreature(); - Log.outDebug(LogFilter.Scripts, "SmartScript.OnInitialize: source is Creature {0}", me.GetEntry()); + _scriptType = SmartScriptType.Creature; + _me = obj.ToCreature(); + Log.outDebug(LogFilter.Scripts, "SmartScript.OnInitialize: source is Creature {0}", _me.GetEntry()); break; case TypeId.GameObject: - mScriptType = SmartScriptType.GameObject; - go = obj.ToGameObject(); - Log.outDebug(LogFilter.Scripts, "SmartScript.OnInitialize: source is GameObject {0}", go.GetEntry()); + _scriptType = SmartScriptType.GameObject; + _go = obj.ToGameObject(); + Log.outDebug(LogFilter.Scripts, "SmartScript.OnInitialize: source is GameObject {0}", _go.GetEntry()); break; case TypeId.AreaTrigger: - areaTrigger = obj.ToAreaTrigger(); - mScriptType = areaTrigger.IsServerSide() ? SmartScriptType.AreaTriggerEntityServerside : SmartScriptType.AreaTriggerEntity; - Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.OnInitialize: source is AreaTrigger {areaTrigger.GetEntry()}, IsServerSide {areaTrigger.IsServerSide()}"); + _areaTrigger = obj.ToAreaTrigger(); + _scriptType = _areaTrigger.IsServerSide() ? SmartScriptType.AreaTriggerEntityServerside : SmartScriptType.AreaTriggerEntity; + Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.OnInitialize: source is AreaTrigger {_areaTrigger.GetEntry()}, IsServerSide {_areaTrigger.IsServerSide()}"); break; default: Log.outError(LogFilter.Scripts, "SmartScript.OnInitialize: Unhandled TypeID !WARNING!"); @@ -3819,7 +3850,7 @@ namespace Game.AI GetScript();//load copy of script - foreach (var holder in mEvents) + foreach (var holder in _events) InitTimer(holder);//calculate timers for first time use ProcessEventsFor(SmartEvents.AiInit); @@ -3831,9 +3862,9 @@ namespace Game.AI { if (at != null) { - mScriptType = SmartScriptType.AreaTrigger; - trigger = at; - Log.outDebug(LogFilter.ScriptsAi, "SmartScript.OnInitialize: AreaTrigger {0}", trigger.Id); + _scriptType = SmartScriptType.AreaTrigger; + _trigger = at; + Log.outDebug(LogFilter.ScriptsAi, "SmartScript.OnInitialize: AreaTrigger {0}", _trigger.Id); } else { @@ -3843,7 +3874,7 @@ namespace Game.AI GetScript();//load copy of script - foreach (var holder in mEvents) + foreach (var holder in _events) InitTimer(holder);//calculate timers for first time use InstallEvents(); @@ -3853,8 +3884,8 @@ namespace Game.AI { if (scene != null) { - mScriptType = SmartScriptType.Scene; - sceneTemplate = scene; + _scriptType = SmartScriptType.Scene; + _sceneTemplate = scene; Log.outDebug(LogFilter.ScriptsAi, "SmartScript.OnInitialize: Scene with id {0}", scene.SceneId); } else @@ -3865,7 +3896,7 @@ namespace Game.AI GetScript();//load copy of script - foreach (var holder in mEvents) + foreach (var holder in _events) InitTimer(holder);//calculate timers for first time use InstallEvents(); @@ -3875,8 +3906,8 @@ namespace Game.AI { if (qst != null) { - mScriptType = SmartScriptType.Quest; - quest = qst; + _scriptType = SmartScriptType.Quest; + _quest = qst; Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.OnInitialize: source is Quest with id {qst.Id}"); } else @@ -3887,7 +3918,7 @@ namespace Game.AI GetScript();//load copy of script - foreach (var holder in mEvents) + foreach (var holder in _events) InitTimer(holder);//calculate timers for first time use InstallEvents(); @@ -3895,77 +3926,77 @@ namespace Game.AI public void OnMoveInLineOfSight(Unit who) { - if (me == null) + if (_me == null) return; - ProcessEventsFor(me.IsEngaged() ? SmartEvents.IcLos : SmartEvents.OocLos, who); + ProcessEventsFor(_me.IsEngaged() ? SmartEvents.IcLos : SmartEvents.OocLos, who); } Unit DoSelectLowestHpFriendly(float range, uint MinHPDiff) { - if (!me) + if (!_me) return null; - var u_check = new MostHPMissingInRange(me, range, MinHPDiff); - var searcher = new UnitLastSearcher(me, u_check); - Cell.VisitGridObjects(me, searcher, range); + var u_check = new MostHPMissingInRange(_me, range, MinHPDiff); + var searcher = new UnitLastSearcher(_me, u_check); + Cell.VisitGridObjects(_me, searcher, range); return searcher.GetTarget(); } - Unit DoSelectBelowHpPctFriendlyWithEntry(uint entry, float range, byte minHPDiff = 1, bool excludeSelf = true) + public Unit DoSelectBelowHpPctFriendlyWithEntry(uint entry, float range, byte minHPDiff = 1, bool excludeSelf = true) { - FriendlyBelowHpPctEntryInRange u_check = new FriendlyBelowHpPctEntryInRange(me, entry, range, minHPDiff, excludeSelf); - UnitLastSearcher searcher = new UnitLastSearcher(me, u_check); - Cell.VisitAllObjects(me, searcher, range); + FriendlyBelowHpPctEntryInRange u_check = new(_me, entry, range, minHPDiff, excludeSelf); + UnitLastSearcher searcher = new(_me, u_check); + Cell.VisitAllObjects(_me, searcher, range); return searcher.GetTarget(); } void DoFindFriendlyCC(List creatures, float range) { - if (me == null) + if (_me == null) return; - var u_check = new FriendlyCCedInRange(me, range); - var searcher = new CreatureListSearcher(me, creatures, u_check); - Cell.VisitGridObjects(me, searcher, range); + var u_check = new FriendlyCCedInRange(_me, range); + var searcher = new CreatureListSearcher(_me, creatures, u_check); + Cell.VisitGridObjects(_me, searcher, range); } void DoFindFriendlyMissingBuff(List creatures, float range, uint spellid) { - if (me == null) + if (_me == null) return; - var u_check = new FriendlyMissingBuffInRange(me, range, spellid); - var searcher = new CreatureListSearcher(me, creatures, u_check); - Cell.VisitGridObjects(me, searcher, range); + var u_check = new FriendlyMissingBuffInRange(_me, range, spellid); + var searcher = new CreatureListSearcher(_me, creatures, u_check); + Cell.VisitGridObjects(_me, searcher, range); } Unit DoFindClosestFriendlyInRange(float range) { - if (!me) + if (!_me) return null; - var u_check = new AnyFriendlyUnitInObjectRangeCheck(me, me, range); - var searcher = new UnitLastSearcher(me, u_check); - Cell.VisitAllObjects(me, searcher, range); + var u_check = new AnyFriendlyUnitInObjectRangeCheck(_me, _me, range); + var searcher = new UnitLastSearcher(_me, u_check); + Cell.VisitAllObjects(_me, searcher, range); return searcher.GetTarget(); } public void SetScript9(SmartScriptHolder e, uint entry) { - mTimedActionList.Clear(); - mTimedActionList = Global.SmartAIMgr.GetScript((int)entry, SmartScriptType.TimedActionlist); - if (mTimedActionList.Empty()) + _timedActionList.Clear(); + _timedActionList = Global.SmartAIMgr.GetScript((int)entry, SmartScriptType.TimedActionlist); + if (_timedActionList.Empty()) return; int i = 0; - foreach (var holder in mTimedActionList.ToList()) + foreach (var holder in _timedActionList.ToList()) { if (i++ == 0) { - holder.enableTimed = true;//enable processing only for the first action + holder.EnableTimed = true;//enable processing only for the first action } - else holder.enableTimed = false; + else holder.EnableTimed = false; if (e.Action.timedActionList.timerType == 1) holder.Event.type = SmartEvents.UpdateIc; @@ -3980,25 +4011,25 @@ namespace Game.AI // Look for invoker only on map of base object... Prevents multithreaded crashes WorldObject baseObject = GetBaseObject(); if (baseObject != null) - return Global.ObjAccessor.GetUnit(baseObject, mLastInvoker); + return Global.ObjAccessor.GetUnit(baseObject, LastInvoker); // used for area triggers invoker cast else if (invoker != null) - return Global.ObjAccessor.GetUnit(invoker, mLastInvoker); + return Global.ObjAccessor.GetUnit(invoker, LastInvoker); return null; } - public void SetPathId(uint id) { mPathId = id; } - public uint GetPathId() { return mPathId; } + public void SetPathId(uint id) { _pathId = id; } + public uint GetPathId() { return _pathId; } WorldObject GetBaseObject() { WorldObject obj = null; - if (me != null) - obj = me; - else if (go != null) - obj = go; - else if (areaTrigger != null) - obj = areaTrigger; + if (_me != null) + obj = _me; + else if (_go != null) + obj = _go; + else if (_areaTrigger != null) + obj = _areaTrigger; return obj; } @@ -4012,10 +4043,10 @@ namespace Game.AI return summoner; } - bool IsUnit(WorldObject obj) { return obj != null && (obj.IsTypeId(TypeId.Unit) || obj.IsTypeId(TypeId.Player)); } + public bool IsUnit(WorldObject obj) { return obj != null && (obj.IsTypeId(TypeId.Unit) || obj.IsTypeId(TypeId.Player)); } public bool IsPlayer(WorldObject obj) { return obj != null && obj.IsTypeId(TypeId.Player); } - bool IsCreature(WorldObject obj) { return obj != null && obj.IsTypeId(TypeId.Unit); } - static bool IsCharmedCreature(WorldObject obj) + public bool IsCreature(WorldObject obj) { return obj != null && obj.IsTypeId(TypeId.Unit); } + public bool IsCharmedCreature(WorldObject obj) { if (!obj) return false; @@ -4026,7 +4057,7 @@ namespace Game.AI return false; } - bool IsGameObject(WorldObject obj) { return obj != null && obj.IsTypeId(TypeId.GameObject); } + public bool IsGameObject(WorldObject obj) { return obj != null && obj.IsTypeId(TypeId.GameObject); } void StoreTargetList(List targets, uint id) { @@ -4050,11 +4081,11 @@ namespace Game.AI if (c != null && c.GetAIName() != "SmartAI") smart = false; - if (me == null || me.GetAIName() != "SmartAI") + if (_me == null || _me.GetAIName() != "SmartAI") smart = false; if (!smart) - Log.outError(LogFilter.Sql, "SmartScript: Action target Creature (GUID: {0} Entry: {1}) is not using SmartAI, action skipped to prevent crash.", c != null ? c.GetSpawnId() : (me != null ? me.GetSpawnId() : 0), c != null ? c.GetEntry() : (me != null ? me.GetEntry() : 0)); + Log.outError(LogFilter.Sql, "SmartScript: Action target Creature (GUID: {0} Entry: {1}) is not using SmartAI, action skipped to prevent crash.", c != null ? c.GetSpawnId() : (_me != null ? _me.GetSpawnId() : 0), c != null ? c.GetEntry() : (_me != null ? _me.GetEntry() : 0)); return smart; } @@ -4065,33 +4096,33 @@ namespace Game.AI if (g != null && g.GetAIName() != "SmartGameObjectAI") smart = false; - if (go == null || go.GetAIName() != "SmartGameObjectAI") + if (_go == null || _go.GetAIName() != "SmartGameObjectAI") smart = false; if (!smart) - Log.outError(LogFilter.Sql, "SmartScript: Action target GameObject (GUID: {0} Entry: {1}) is not using SmartGameObjectAI, action skipped to prevent crash.", g != null ? g.GetSpawnId() : (go != null ? go.GetSpawnId() : 0), g != null ? g.GetEntry() : (go != null ? go.GetEntry() : 0)); + Log.outError(LogFilter.Sql, "SmartScript: Action target GameObject (GUID: {0} Entry: {1}) is not using SmartGameObjectAI, action skipped to prevent crash.", g != null ? g.GetSpawnId() : (_go != null ? _go.GetSpawnId() : 0), g != null ? g.GetEntry() : (_go != null ? _go.GetEntry() : 0)); return smart; } void StoreCounter(uint id, uint value, uint reset) { - if (mCounterList.ContainsKey(id)) + if (_counterList.ContainsKey(id)) { if (reset == 0) - mCounterList[id] += value; + _counterList[id] += value; else - mCounterList[id] = value; + _counterList[id] = value; } else - mCounterList.Add(id, value); + _counterList.Add(id, value); ProcessEventsFor(SmartEvents.CounterSet, null, id); } uint GetCounterValue(uint id) { - if (mCounterList.ContainsKey(id)) - return mCounterList[id]; + if (_counterList.ContainsKey(id)) + return _counterList[id]; return 0; } @@ -4117,120 +4148,88 @@ namespace Game.AI void ResetBaseObject() { - WorldObject lookupRoot = me; + WorldObject lookupRoot = _me; if (!lookupRoot) - lookupRoot = go; + lookupRoot = _go; if (lookupRoot) { - if (!meOrigGUID.IsEmpty()) + if (!_meOrigGUID.IsEmpty()) { - Creature m = ObjectAccessor.GetCreature(lookupRoot, meOrigGUID); + Creature m = ObjectAccessor.GetCreature(lookupRoot, _meOrigGUID); if (m != null) { - me = m; - go = null; - areaTrigger = null; + _me = m; + _go = null; + _areaTrigger = null; } } - if (!goOrigGUID.IsEmpty()) + if (!_goOrigGUID.IsEmpty()) { - GameObject o = ObjectAccessor.GetGameObject(lookupRoot, goOrigGUID); + GameObject o = ObjectAccessor.GetGameObject(lookupRoot, _goOrigGUID); if (o != null) { - me = null; - go = o; - areaTrigger = null; + _me = null; + _go = o; + _areaTrigger = null; } } } - goOrigGUID.Clear(); - meOrigGUID.Clear(); + _goOrigGUID.Clear(); + _meOrigGUID.Clear(); } void IncPhase(uint p) { // protect phase from overflowing - SetPhase(Math.Min((uint)SmartPhase.Phase12, mEventPhase + p)); + SetPhase(Math.Min((uint)SmartPhase.Phase12, _eventPhase + p)); } void DecPhase(uint p) { - if (p >= mEventPhase) + if (p >= _eventPhase) SetPhase(0); else - SetPhase(mEventPhase - p); + SetPhase(_eventPhase - p); } void SetPhase(uint p) { - uint oldPhase = mEventPhase; + uint oldPhase = _eventPhase; - mEventPhase = p; + _eventPhase = p; - if (oldPhase != mEventPhase) + if (oldPhase != _eventPhase) ProcessEventsFor(SmartEvents.PhaseChange); } bool IsInPhase(uint p) { - if (mEventPhase == 0) + if (_eventPhase == 0) return false; - return ((1 << (int)(mEventPhase - 1)) & p) != 0; + return ((1 << (int)(_eventPhase - 1)) & p) != 0; } void RemoveStoredEvent(uint id) { - if (!mStoredEvents.Empty()) + if (!_storedEvents.Empty()) { - foreach (var holder in mStoredEvents) + foreach (var holder in _storedEvents) { - if (holder.event_id == id) + if (holder.EventId == id) { - mStoredEvents.Remove(holder); + _storedEvents.Remove(holder); return; } } } } - - public ObjectGuid mLastInvoker; - - Dictionary mCounterList = new Dictionary(); - - List mEvents = new List(); - List mInstallEvents = new List(); - List mTimedActionList = new List(); - Creature me; - ObjectGuid meOrigGUID; - GameObject go; - ObjectGuid goOrigGUID; - AreaTriggerRecord trigger; - AreaTrigger areaTrigger; - SceneTemplate sceneTemplate; - Quest quest; - SmartScriptType mScriptType; - uint mEventPhase; - - uint mPathId; - List mStoredEvents = new List(); - List mRemIDs = new List(); - - uint mTextTimer; - uint mLastTextID; - ObjectGuid mTextGUID; - uint mTalkerEntry; - bool mUseTextTimer; - - Dictionary _storedTargets = new Dictionary(); - - SmartAITemplate mTemplate; } class ObjectGuidList { - List _guidList = new List(); - List _objectList = new List(); + List _guidList = new(); + List _objectList = new(); public ObjectGuidList(List objectList) { diff --git a/Source/Game/Accounts/AccountManager.cs b/Source/Game/Accounts/AccountManager.cs index f05794c0e..f249402cb 100644 --- a/Source/Game/Accounts/AccountManager.cs +++ b/Source/Game/Accounts/AccountManager.cs @@ -16,6 +16,7 @@ */ using Framework.Constants; +using Framework.Cryptography; using Framework.Database; using Game.Accounts; using Game.Entities; @@ -23,7 +24,6 @@ using System; using System.Collections.Generic; using System.Security.Cryptography; using System.Text; -using Framework.Cryptography; namespace Game { @@ -32,6 +32,9 @@ namespace Game const int MaxAccountLength = 16; const int MaxEmailLength = 64; + readonly Dictionary _permissions = new(); + readonly MultiMap _defaultPermissions = new(); + AccountManager() { } public AccountOpResult CreateAccount(string username, string password, string email = "", uint bnetAccountId = 0, byte bnetIndex = 0) @@ -116,7 +119,7 @@ namespace Game stmt.AddValue(0, accountId); DB.Characters.Execute(stmt); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_ACCOUNT); stmt.AddValue(0, accountId); @@ -170,12 +173,10 @@ namespace Game stmt.AddValue(2, accountId); DB.Login.Execute(stmt); - { - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_LOGON_LEGACY); - stmt.AddValue(0, CalculateShaPassHash(newUsername, newPassword)); - stmt.AddValue(1, accountId); - DB.Login.Execute(stmt); - } + stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_LOGON_LEGACY); + stmt.AddValue(0, CalculateShaPassHash(newUsername, newPassword)); + stmt.AddValue(1, accountId); + DB.Login.Execute(stmt); return AccountOpResult.Ok; } @@ -198,12 +199,10 @@ namespace Game stmt.AddValue(2, accountId); DB.Login.Execute(stmt); - { - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_LOGON_LEGACY); - stmt.AddValue(0, CalculateShaPassHash(username, newPassword)); - stmt.AddValue(1, accountId); - DB.Login.Execute(stmt); - } + stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_LOGON_LEGACY); + stmt.AddValue(0, CalculateShaPassHash(username, newPassword)); + stmt.AddValue(1, accountId); + DB.Login.Execute(stmt); return AccountOpResult.Ok; } @@ -280,7 +279,7 @@ namespace Game return false; } - bool GetEmail(uint accountId, out string email) + public bool GetEmail(uint accountId, out string email) { email = ""; PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.GET_EMAIL_BY_ID); @@ -339,7 +338,6 @@ namespace Game return result.IsEmpty() ? 0 : (uint)result.Read(0); } - [Obsolete] string CalculateShaPassHash(string name, string password) { SHA1 sha = SHA1.Create(); @@ -371,7 +369,8 @@ namespace Game public void LoadRBAC() { - ClearRBAC(); + _permissions.Clear(); + _defaultPermissions.Clear(); Log.outDebug(LogFilter.Rbac, "AccountMgr:LoadRBAC"); uint oldMSTime = Time.GetMSTime(); @@ -455,7 +454,7 @@ namespace Game rbac.SetSecurityLevel(securityLevel); PreparedStatement stmt; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); // Delete old security level from DB if (realmId == -1) { @@ -498,7 +497,7 @@ namespace Game return false; } - RBACData rbac = new RBACData(accountId, "", (int)realmId); + RBACData rbac = new(accountId, "", (int)realmId); rbac.LoadFromDB(); bool hasPermission = rbac.HasPermission(permissionId); @@ -507,21 +506,12 @@ namespace Game return hasPermission; } - void ClearRBAC() - { - _permissions.Clear(); - _defaultPermissions.Clear(); - } - public List GetRBACDefaultPermissions(byte secLevel) { return _defaultPermissions[secLevel]; } public Dictionary GetRBACPermissionList() { return _permissions; } - - Dictionary _permissions = new Dictionary(); - MultiMap _defaultPermissions = new MultiMap(); } public enum AccountOpResult diff --git a/Source/Game/Accounts/RoleAccessControl.cs b/Source/Game/Accounts/RoleAccessControl.cs index 555a01943..3095f5f17 100644 --- a/Source/Game/Accounts/RoleAccessControl.cs +++ b/Source/Game/Accounts/RoleAccessControl.cs @@ -24,6 +24,14 @@ namespace Game.Accounts { public class RBACData { + uint _id; // Account id + string _name; // Account name + int _realmId; // RealmId Affected + byte _secLevel; // Account SecurityLevel + List _grantedPerms = new(); // Granted permissions + List _deniedPerms = new(); // Denied permissions + List _globalPerms = new(); // Calculated permissions + public RBACData(uint id, string name, int realmId, byte secLevel = 255) { _id = id; @@ -224,7 +232,7 @@ namespace Game.Accounts RemovePermissions(_globalPerms, revoked); } - void AddPermissions(List permsFrom, List permsTo) + public void AddPermissions(List permsFrom, List permsTo) { foreach (var id in permsFrom) permsTo.Add(id); @@ -243,7 +251,7 @@ namespace Game.Accounts void ExpandPermissions(List permissions) { - List toCheck = new List(permissions); + List toCheck = new(permissions); permissions.Clear(); while (!toCheck.Empty()) @@ -337,18 +345,14 @@ namespace Game.Accounts { _deniedPerms.Remove(permissionId); } - - uint _id; // Account id - string _name; // Account name - int _realmId; // RealmId Affected - byte _secLevel; // Account SecurityLevel - List _grantedPerms = new List(); // Granted permissions - List _deniedPerms = new List(); // Denied permissions - List _globalPerms = new List(); // Calculated permissions } public class RBACPermission { + uint _id; // id of the object + string _name; // name of the object + List _perms = new(); // Set of permissions + public RBACPermission(uint id = 0, string name = "") { _id = id; @@ -365,12 +369,7 @@ namespace Game.Accounts // Adds a new linked Permission public void AddLinkedPermission(uint id) { _perms.Add(id); } // Removes a linked Permission - void RemoveLinkedPermission(uint id) { _perms.Remove(id); } - - - uint _id; // id of the object - string _name; // name of the object - List _perms = new List(); // Set of permissions + public void RemoveLinkedPermission(uint id) { _perms.Remove(id); } } public enum RBACCommandResult diff --git a/Source/Game/Achievements/AchievementManager.cs b/Source/Game/Achievements/AchievementManager.cs index c5dc44efa..08cddacdf 100644 --- a/Source/Game/Achievements/AchievementManager.cs +++ b/Source/Game/Achievements/AchievementManager.cs @@ -35,6 +35,9 @@ namespace Game.Achievements { public class AchievementManager : CriteriaHandler { + protected Dictionary _completedAchievements = new(); + protected uint _achievementPoints; + /// /// called at player login. The player might have fulfilled some achievements when the achievement system wasn't working yet /// @@ -193,13 +196,12 @@ namespace Game.Achievements return achievement; return null; }; - - protected Dictionary _completedAchievements = new Dictionary(); - protected uint _achievementPoints; } public class PlayerAchievementMgr : AchievementManager { + Player _owner; + public PlayerAchievementMgr(Player owner) { _owner = owner; @@ -211,7 +213,7 @@ namespace Game.Achievements foreach (var iter in _completedAchievements) { - AchievementDeleted achievementDeleted = new AchievementDeleted(); + AchievementDeleted achievementDeleted = new(); achievementDeleted.AchievementID = iter.Key; SendPacket(achievementDeleted); } @@ -226,7 +228,7 @@ namespace Game.Achievements public static void DeleteFromDB(ObjectGuid guid) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT); stmt.AddValue(0, guid.GetCounter()); @@ -252,7 +254,7 @@ namespace Game.Achievements if (achievement == null) continue; - CompletedAchievementData ca = new CompletedAchievementData(); + CompletedAchievementData ca = new(); ca.Date = achievementResult.Read(1); ca.Changed = false; @@ -299,7 +301,7 @@ namespace Game.Achievements if (criteria.Entry.StartTimer != 0 && (date + criteria.Entry.StartTimer) < now) continue; - CriteriaProgress progress = new CriteriaProgress(); + CriteriaProgress progress = new(); progress.Counter = counter; progress.Date = date; progress.PlayerGUID = _owner.GetGUID(); @@ -398,8 +400,8 @@ namespace Game.Achievements public override void SendAllData(Player receiver) { - AllAccountCriteria allAccountCriteria = new AllAccountCriteria(); - AllAchievementData achievementData = new AllAchievementData(); + AllAccountCriteria allAccountCriteria = new(); + AllAchievementData achievementData = new(); foreach (var pair in _completedAchievements) { @@ -407,7 +409,7 @@ namespace Game.Achievements if (achievement == null) continue; - EarnedAchievement earned = new EarnedAchievement(); + EarnedAchievement earned = new(); earned.Id = pair.Key; earned.Date = pair.Value.Date; if (!achievement.Flags.HasAnyFlag(AchievementFlags.Account)) @@ -422,7 +424,7 @@ namespace Game.Achievements { Criteria criteria = Global.CriteriaMgr.GetCriteria(pair.Key); - CriteriaProgressPkt progress = new CriteriaProgressPkt(); + CriteriaProgressPkt progress = new(); progress.Id = pair.Key; progress.Quantity = pair.Value.Counter; progress.Player = pair.Value.PlayerGUID; @@ -434,7 +436,7 @@ namespace Game.Achievements if (criteria.FlagsCu.HasAnyFlag(CriteriaFlagsCu.Account)) { - CriteriaProgressPkt accountProgress = new CriteriaProgressPkt(); + CriteriaProgressPkt accountProgress = new(); accountProgress.Id = pair.Key; accountProgress.Quantity = pair.Value.Counter; accountProgress.Player = _owner.GetSession().GetBattlenetAccountGUID(); @@ -454,7 +456,7 @@ namespace Game.Achievements public void SendAchievementInfo(Player receiver) { - RespondInspectAchievements inspectedAchievements = new RespondInspectAchievements(); + RespondInspectAchievements inspectedAchievements = new(); inspectedAchievements.Player = _owner.GetGUID(); foreach (var pair in _completedAchievements) @@ -463,7 +465,7 @@ namespace Game.Achievements if (achievement == null) continue; - EarnedAchievement earned = new EarnedAchievement(); + EarnedAchievement earned = new(); earned.Id = pair.Key; earned.Date = pair.Value.Date; if (!achievement.Flags.HasAnyFlag(AchievementFlags.Account)) @@ -476,7 +478,7 @@ namespace Game.Achievements foreach (var pair in _criteriaProgress) { - CriteriaProgressPkt progress = new CriteriaProgressPkt(); + CriteriaProgressPkt progress = new(); progress.Id = pair.Key; progress.Quantity = pair.Value.Counter; progress.Player = pair.Value.PlayerGUID; @@ -515,7 +517,7 @@ namespace Game.Achievements Log.outDebug(LogFilter.Achievement, "PlayerAchievementMgr.CompletedAchievement({0}). {1}", achievement.Id, GetOwnerInfo()); - CompletedAchievementData ca = new CompletedAchievementData(); + CompletedAchievementData ca = new(); ca.Date = Time.UnixTime; ca.Changed = true; _completedAchievements[achievement.Id] = ca; @@ -552,7 +554,7 @@ namespace Game.Achievements // mail if (reward.SenderCreatureId != 0) { - MailDraft draft = new MailDraft(reward.MailTemplateId); + MailDraft draft = new(reward.MailTemplateId); if (reward.MailTemplateId == 0) { @@ -574,7 +576,7 @@ namespace Game.Achievements draft = new MailDraft(subject, text); } - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); Item item = reward.ItemId != 0 ? Item.CreateItem(reward.ItemId, 1, ItemContext.None, _owner) : null; if (item) @@ -604,7 +606,7 @@ namespace Game.Achievements { if (criteria.FlagsCu.HasAnyFlag(CriteriaFlagsCu.Account)) { - AccountCriteriaUpdate criteriaUpdate = new AccountCriteriaUpdate(); + AccountCriteriaUpdate criteriaUpdate = new(); criteriaUpdate.Progress.Id = criteria.Id; criteriaUpdate.Progress.Quantity = progress.Counter; criteriaUpdate.Progress.Player = _owner.GetSession().GetBattlenetAccountGUID(); @@ -619,7 +621,7 @@ namespace Game.Achievements } else { - CriteriaUpdate criteriaUpdate = new CriteriaUpdate(); + CriteriaUpdate criteriaUpdate = new(); criteriaUpdate.CriteriaID = criteria.Id; criteriaUpdate.Quantity = progress.Counter; @@ -638,7 +640,7 @@ namespace Game.Achievements public override void SendCriteriaProgressRemoved(uint criteriaId) { - CriteriaDeleted criteriaDeleted = new CriteriaDeleted(); + CriteriaDeleted criteriaDeleted = new(); criteriaDeleted.CriteriaID = criteriaId; SendPacket(criteriaDeleted); } @@ -656,7 +658,7 @@ namespace Game.Achievements Guild guild = Global.GuildMgr.GetGuildById(_owner.GetGuildId()); if (guild) { - BroadcastTextBuilder say_builder = new BroadcastTextBuilder(_owner, ChatMsg.GuildAchievement, (uint)BroadcastTextIds.AchivementEarned, _owner.GetGender(), _owner, achievement.Id); + BroadcastTextBuilder say_builder = new(_owner, ChatMsg.GuildAchievement, (uint)BroadcastTextIds.AchivementEarned, _owner.GetGender(), _owner, achievement.Id); var say_do = new LocalizedPacketDo(say_builder); guild.BroadcastWorker(say_do, _owner); } @@ -664,7 +666,7 @@ namespace Game.Achievements if (achievement.Flags.HasAnyFlag(AchievementFlags.RealmFirstReach | AchievementFlags.RealmFirstKill)) { // broadcast realm first reached - BroadcastAchievement serverFirstAchievement = new BroadcastAchievement(); + BroadcastAchievement serverFirstAchievement = new(); serverFirstAchievement.Name = _owner.GetName(); serverFirstAchievement.PlayerGUID = _owner.GetGUID(); serverFirstAchievement.AchievementID = achievement.Id; @@ -673,14 +675,14 @@ namespace Game.Achievements // if player is in world he can tell his friends about new achievement else if (_owner.IsInWorld) { - BroadcastTextBuilder _builder = new BroadcastTextBuilder(_owner, ChatMsg.Achievement, (uint)BroadcastTextIds.AchivementEarned, _owner.GetGender(), _owner, achievement.Id); + BroadcastTextBuilder _builder = new(_owner, ChatMsg.Achievement, (uint)BroadcastTextIds.AchivementEarned, _owner.GetGender(), _owner, achievement.Id); var _localizer = new LocalizedPacketDo(_builder); var _worker = new PlayerDistWorker(_owner, WorldConfig.GetFloatValue(WorldCfg.ListenRangeSay), _localizer); Cell.VisitWorldObjects(_owner, _worker, WorldConfig.GetFloatValue(WorldCfg.ListenRangeSay)); } } - AchievementEarned achievementEarned = new AchievementEarned(); + AchievementEarned achievementEarned = new(); achievementEarned.Sender = _owner.GetGUID(); achievementEarned.Earner = _owner.GetGUID(); achievementEarned.EarnerNativeRealm = achievementEarned.EarnerVirtualRealm = Global.WorldMgr.GetVirtualRealmAddress(); @@ -707,12 +709,12 @@ namespace Game.Achievements { return $"{_owner.GetGUID()} {_owner.GetName()}"; } - - Player _owner; } public class GuildAchievementMgr : AchievementManager { + Guild _owner; + public GuildAchievementMgr(Guild owner) { _owner = owner; @@ -725,7 +727,7 @@ namespace Game.Achievements ObjectGuid guid = _owner.GetGUID(); foreach (var iter in _completedAchievements) { - GuildAchievementDeleted guildAchievementDeleted = new GuildAchievementDeleted(); + GuildAchievementDeleted guildAchievementDeleted = new(); guildAchievementDeleted.AchievementID = iter.Key; guildAchievementDeleted.GuildGUID = guid; guildAchievementDeleted.TimeDeleted = Time.UnixTime; @@ -739,7 +741,7 @@ namespace Game.Achievements void DeleteFromDB(ObjectGuid guid) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GUILD_ACHIEVEMENTS); stmt.AddValue(0, guid.GetCounter()); @@ -808,7 +810,7 @@ namespace Game.Achievements if (criteria.Entry.StartTimer != 0 && date + criteria.Entry.StartTimer < now) continue; - CriteriaProgress progress = new CriteriaProgress(); + CriteriaProgress progress = new(); progress.Counter = counter; progress.Date = date; progress.PlayerGUID = ObjectGuid.Create(HighGuid.Player, guidLow); @@ -823,7 +825,7 @@ namespace Game.Achievements public void SaveToDB(SQLTransaction trans) { PreparedStatement stmt; - StringBuilder guidstr = new StringBuilder(); + StringBuilder guidstr = new(); foreach (var pair in _completedAchievements) { if (!pair.Value.Changed) @@ -869,7 +871,7 @@ namespace Game.Achievements public override void SendAllData(Player receiver) { - AllGuildAchievements allGuildAchievements = new AllGuildAchievements(); + AllGuildAchievements allGuildAchievements = new(); foreach (var pair in _completedAchievements) { @@ -877,7 +879,7 @@ namespace Game.Achievements if (achievement == null) continue; - EarnedAchievement earned = new EarnedAchievement(); + EarnedAchievement earned = new(); earned.Id = pair.Key; earned.Date = pair.Value.Date; allGuildAchievements.Earned.Add(earned); @@ -888,7 +890,7 @@ namespace Game.Achievements public void SendAchievementInfo(Player receiver, uint achievementId = 0) { - GuildCriteriaUpdate guildCriteriaUpdate = new GuildCriteriaUpdate(); + GuildCriteriaUpdate guildCriteriaUpdate = new(); AchievementRecord achievement = CliDB.AchievementStorage.LookupByKey(achievementId); if (achievement != null) { @@ -902,7 +904,7 @@ namespace Game.Achievements var progress = _criteriaProgress.LookupByKey(node.Criteria.Id); if (progress != null) { - GuildCriteriaProgress guildCriteriaProgress = new GuildCriteriaProgress(); + GuildCriteriaProgress guildCriteriaProgress = new(); guildCriteriaProgress.CriteriaID = node.Criteria.Id; guildCriteriaProgress.DateCreated = 0; guildCriteriaProgress.DateStarted = 0; @@ -923,7 +925,7 @@ namespace Game.Achievements public void SendAllTrackedCriterias(Player receiver, List trackedCriterias) { - GuildCriteriaUpdate guildCriteriaUpdate = new GuildCriteriaUpdate(); + GuildCriteriaUpdate guildCriteriaUpdate = new(); foreach (uint criteriaId in trackedCriterias) { @@ -931,7 +933,7 @@ namespace Game.Achievements if (progress == null) continue; - GuildCriteriaProgress guildCriteriaProgress = new GuildCriteriaProgress(); + GuildCriteriaProgress guildCriteriaProgress = new(); guildCriteriaProgress.CriteriaID = criteriaId; guildCriteriaProgress.DateCreated = 0; guildCriteriaProgress.DateStarted = 0; @@ -951,7 +953,7 @@ namespace Game.Achievements var achievementData = _completedAchievements.LookupByKey(achievementId); if (achievementData != null) { - GuildAchievementMembers guildAchievementMembers = new GuildAchievementMembers(); + GuildAchievementMembers guildAchievementMembers = new(); guildAchievementMembers.GuildGUID = _owner.GetGUID(); guildAchievementMembers.AchievementID = achievementId; @@ -977,7 +979,7 @@ namespace Game.Achievements } SendAchievementEarned(achievement); - CompletedAchievementData ca = new CompletedAchievementData(); + CompletedAchievementData ca = new(); ca.Date = Time.UnixTime; ca.Changed = true; @@ -1013,9 +1015,9 @@ namespace Game.Achievements public override void SendCriteriaUpdate(Criteria entry, CriteriaProgress progress, uint timeElapsed, bool timedCompleted) { - GuildCriteriaUpdate guildCriteriaUpdate = new GuildCriteriaUpdate(); + GuildCriteriaUpdate guildCriteriaUpdate = new(); - GuildCriteriaProgress guildCriteriaProgress = new GuildCriteriaProgress(); + GuildCriteriaProgress guildCriteriaProgress = new(); guildCriteriaProgress.CriteriaID = entry.Id; guildCriteriaProgress.DateCreated = 0; guildCriteriaProgress.DateStarted = 0; @@ -1031,7 +1033,7 @@ namespace Game.Achievements public override void SendCriteriaProgressRemoved(uint criteriaId) { - GuildCriteriaDeleted guildCriteriaDeleted = new GuildCriteriaDeleted(); + GuildCriteriaDeleted guildCriteriaDeleted = new(); guildCriteriaDeleted.GuildGUID = _owner.GetGUID(); guildCriteriaDeleted.CriteriaID = criteriaId; SendPacket(guildCriteriaDeleted); @@ -1042,7 +1044,7 @@ namespace Game.Achievements if (achievement.Flags.HasAnyFlag(AchievementFlags.RealmFirstReach | AchievementFlags.RealmFirstKill)) { // broadcast realm first reached - BroadcastAchievement serverFirstAchievement = new BroadcastAchievement(); + BroadcastAchievement serverFirstAchievement = new(); serverFirstAchievement.Name = _owner.GetName(); serverFirstAchievement.PlayerGUID = _owner.GetGUID(); serverFirstAchievement.AchievementID = achievement.Id; @@ -1050,7 +1052,7 @@ namespace Game.Achievements Global.WorldMgr.SendGlobalMessage(serverFirstAchievement); } - GuildAchievementEarned guildAchievementEarned = new GuildAchievementEarned(); + GuildAchievementEarned guildAchievementEarned = new(); guildAchievementEarned.AchievementID = achievement.Id; guildAchievementEarned.GuildGUID = _owner.GetGUID(); guildAchievementEarned.TimeEarned = Time.UnixTime; @@ -1071,12 +1073,19 @@ namespace Game.Achievements { return $"Guild ID {_owner.GetId()} {_owner.GetName()}"; } - - Guild _owner; } public class AchievementGlobalMgr : Singleton { + // store achievements by referenced achievement id to speed up lookup + MultiMap _achievementListByReferencedId = new(); + + // store realm first achievements + Dictionary _allCompletedAchievements = new(); + + Dictionary _achievementRewards = new(); + Dictionary _achievementRewardLocales = new(); + AchievementGlobalMgr() { } public List GetAchievementByReferencedId(uint id) @@ -1217,7 +1226,7 @@ namespace Game.Achievements continue; } - AchievementReward reward = new AchievementReward(); + AchievementReward reward = new(); reward.TitleId[0] = result.Read(1); reward.TitleId[1] = result.Read(2); reward.ItemId = result.Read(3); @@ -1332,7 +1341,7 @@ namespace Game.Achievements continue; } - AchievementRewardLocale data = new AchievementRewardLocale(); + AchievementRewardLocale data = new(); Locale locale = localeName.ToEnum(); if (!SharedConst.IsValidLocale(locale) || locale == Locale.enUS) continue; @@ -1346,15 +1355,6 @@ namespace Game.Achievements Log.outInfo(LogFilter.ServerLoading, "Loaded {0} achievement reward locale strings in {1} ms.", _achievementRewardLocales.Count, Time.GetMSTimeDiffToNow(oldMSTime)); } - - // store achievements by referenced achievement id to speed up lookup - MultiMap _achievementListByReferencedId = new MultiMap(); - - // store realm first achievements - Dictionary _allCompletedAchievements = new Dictionary(); - - Dictionary _achievementRewards = new Dictionary(); - Dictionary _achievementRewardLocales = new Dictionary(); } public class AchievementReward @@ -1369,14 +1369,14 @@ namespace Game.Achievements public class AchievementRewardLocale { - public StringArray Subject = new StringArray((int)Locale.Total); - public StringArray Body = new StringArray((int)Locale.Total); + public StringArray Subject = new((int)Locale.Total); + public StringArray Body = new((int)Locale.Total); } public class CompletedAchievementData { public long Date; - public List CompletingPlayers = new List(); + public List CompletingPlayers = new(); public bool Changed; } } \ No newline at end of file diff --git a/Source/Game/Achievements/CriteriaHandler.cs b/Source/Game/Achievements/CriteriaHandler.cs index 3d72f3a35..a7ac07b91 100644 --- a/Source/Game/Achievements/CriteriaHandler.cs +++ b/Source/Game/Achievements/CriteriaHandler.cs @@ -37,6 +37,9 @@ namespace Game.Achievements { public class CriteriaHandler { + protected Dictionary _criteriaProgress = new(); + Dictionary _timeCriteriaTrees = new(); + public virtual void Reset() { foreach (var iter in _criteriaProgress) @@ -2599,13 +2602,28 @@ namespace Game.Achievements public virtual string GetOwnerInfo() { return ""; } public virtual List GetCriteriaByType(CriteriaTypes type, uint asset) { return null; } - - protected Dictionary _criteriaProgress = new Dictionary(); - Dictionary _timeCriteriaTrees = new Dictionary(); } public class CriteriaManager : Singleton { + Dictionary _criteriaDataMap = new(); + + Dictionary _criteriaTrees = new(); + Dictionary _criteria = new(); + Dictionary _criteriaModifiers = new(); + + MultiMap _criteriaTreeByCriteria = new(); + + // store criterias by type to speed up lookup + MultiMap _criteriasByType = new(); + MultiMap[] _criteriasByAsset = new MultiMap[(int)CriteriaTypes.TotalTypes]; + MultiMap _guildCriteriasByType = new(); + MultiMap _scenarioCriteriasByType = new(); + MultiMap _questObjectiveCriteriasByType = new(); + + MultiMap _criteriasByTimedType = new(); + MultiMap[] _criteriasByFailEvent = new MultiMap[(int)CriteriaCondition.Max]; + CriteriaManager() { for (var i = 0; i < (int)CriteriaTypes.TotalTypes; ++i) @@ -2625,7 +2643,7 @@ namespace Game.Achievements // Load modifier tree nodes foreach (var tree in CliDB.ModifierTreeStorage.Values) { - ModifierTreeNode node = new ModifierTreeNode(); + ModifierTreeNode node = new(); node.Entry = tree; _criteriaModifiers[node.Entry.Id] = node; } @@ -2667,19 +2685,19 @@ namespace Game.Achievements { uint oldMSTime = Time.GetMSTime(); - Dictionary achievementCriteriaTreeIds = new Dictionary(); + Dictionary achievementCriteriaTreeIds = new(); foreach (AchievementRecord achievement in CliDB.AchievementStorage.Values) if (achievement.CriteriaTree != 0) achievementCriteriaTreeIds[achievement.CriteriaTree] = achievement; - Dictionary scenarioCriteriaTreeIds = new Dictionary(); + Dictionary scenarioCriteriaTreeIds = new(); foreach (ScenarioStepRecord scenarioStep in CliDB.ScenarioStepStorage.Values) { if (scenarioStep.CriteriaTreeId != 0) scenarioCriteriaTreeIds[scenarioStep.CriteriaTreeId] = scenarioStep; } - Dictionary questObjectiveCriteriaTreeIds = new Dictionary(); + Dictionary questObjectiveCriteriaTreeIds = new(); foreach (var pair in Global.ObjectMgr.GetQuestTemplates()) { foreach (QuestObjective objective in pair.Value.Objectives) @@ -2702,7 +2720,7 @@ namespace Game.Achievements if (achievement == null && scenarioStep == null && questObjective == null) continue; - CriteriaTree criteriaTree = new CriteriaTree(); + CriteriaTree criteriaTree = new(); criteriaTree.Id = tree.Id; criteriaTree.Achievement = achievement; criteriaTree.ScenarioStep = scenarioStep; @@ -2742,7 +2760,7 @@ namespace Game.Achievements if (treeList.Empty()) continue; - Criteria criteria = new Criteria(); + Criteria criteria = new(); criteria.Id = criteriaEntry.Id; criteria.Entry = criteriaEntry; criteria.Modifier = _criteriaModifiers.LookupByKey(criteriaEntry.ModifierTreeId); @@ -2863,13 +2881,13 @@ namespace Game.Achievements scriptId = Global.ObjectMgr.GetScriptId(scriptName); } - CriteriaData data = new CriteriaData(dataType, result.Read(2), result.Read(3), scriptId); + CriteriaData data = new(dataType, result.Read(2), result.Read(3), scriptId); if (!data.IsValid(criteria)) continue; // this will allocate empty data set storage - CriteriaDataSet dataSet = new CriteriaDataSet(); + CriteriaDataSet dataSet = new(); dataSet.SetCriteriaId(criteria_id); // add real data only for not NONE data types @@ -3012,30 +3030,12 @@ namespace Game.Achievements func(tree); } - - Dictionary _criteriaDataMap = new Dictionary(); - - Dictionary _criteriaTrees = new Dictionary(); - Dictionary _criteria = new Dictionary(); - Dictionary _criteriaModifiers = new Dictionary(); - - MultiMap _criteriaTreeByCriteria = new MultiMap(); - - // store criterias by type to speed up lookup - MultiMap _criteriasByType = new MultiMap(); - MultiMap[] _criteriasByAsset = new MultiMap[(int)CriteriaTypes.TotalTypes]; - MultiMap _guildCriteriasByType = new MultiMap(); - MultiMap _scenarioCriteriasByType = new MultiMap(); - MultiMap _questObjectiveCriteriasByType = new MultiMap(); - - MultiMap _criteriasByTimedType = new MultiMap(); - MultiMap[] _criteriasByFailEvent = new MultiMap[(int)CriteriaCondition.Max]; } public class ModifierTreeNode { public ModifierTreeRecord Entry; - public List Children = new List(); + public List Children = new(); } public class Criteria @@ -3054,7 +3054,7 @@ namespace Game.Achievements public ScenarioStepRecord ScenarioStep; public QuestObjective QuestObjective; public Criteria Criteria; - public List Children = new List(); + public List Children = new(); } public class CriteriaProgress @@ -3067,7 +3067,67 @@ namespace Game.Achievements [StructLayout(LayoutKind.Explicit)] public class CriteriaData - { + { + [FieldOffset(0)] + public CriteriaDataType DataType; + + [FieldOffset(4)] + public CreatureStruct Creature; + + [FieldOffset(4)] + public ClassRaceStruct ClassRace; + + [FieldOffset(4)] + public HealthStruct Health; + + [FieldOffset(4)] + public AuraStruct Aura; + + [FieldOffset(4)] + public ValueStruct Value; + + [FieldOffset(4)] + public LevelStruct Level; + + [FieldOffset(4)] + public GenderStruct Gender; + + [FieldOffset(4)] + public MapPlayersStruct MapPlayers; + + [FieldOffset(4)] + public TeamStruct TeamId; + + [FieldOffset(4)] + public DrunkStruct Drunk; + + [FieldOffset(4)] + public HolidayStruct Holiday; + + [FieldOffset(4)] + public BgLossTeamScoreStruct BattlegroundScore; + + [FieldOffset(4)] + public EquippedItemStruct EquippedItem; + + [FieldOffset(4)] + public MapIdStruct MapId; + + [FieldOffset(4)] + public KnownTitleStruct KnownTitle; + + [FieldOffset(4)] + public GameEventStruct GameEvent; + + [FieldOffset(4)] + public ItemQualityStruct itemQuality; + + [FieldOffset(4)] + public RawStruct Raw; + + [FieldOffset(12)] + public uint ScriptId; + public CriteriaData() { DataType = CriteriaDataType.None; @@ -3452,66 +3512,6 @@ namespace Game.Achievements return false; } - [FieldOffset(0)] - public CriteriaDataType DataType; - - [FieldOffset(4)] - public CreatureStruct Creature; - - [FieldOffset(4)] - public ClassRaceStruct ClassRace; - - [FieldOffset(4)] - public HealthStruct Health; - - [FieldOffset(4)] - public AuraStruct Aura; - - [FieldOffset(4)] - public ValueStruct Value; - - [FieldOffset(4)] - public LevelStruct Level; - - [FieldOffset(4)] - public GenderStruct Gender; - - [FieldOffset(4)] - public MapPlayersStruct MapPlayers; - - [FieldOffset(4)] - public TeamStruct TeamId; - - [FieldOffset(4)] - public DrunkStruct Drunk; - - [FieldOffset(4)] - public HolidayStruct Holiday; - - [FieldOffset(4)] - public BgLossTeamScoreStruct BattlegroundScore; - - [FieldOffset(4)] - public EquippedItemStruct EquippedItem; - - [FieldOffset(4)] - public MapIdStruct MapId; - - [FieldOffset(4)] - public KnownTitleStruct KnownTitle; - - [FieldOffset(4)] - public GameEventStruct GameEvent; - - [FieldOffset(4)] - public ItemQualityStruct itemQuality; - - [FieldOffset(4)] - public RawStruct Raw; - - [FieldOffset(12)] - public uint ScriptId; - #region Structs // criteria_data_TYPE_NONE = 0 (no data) // criteria_data_TYPE_T_CREATURE = 1 @@ -3618,21 +3618,21 @@ namespace Game.Achievements } public class CriteriaDataSet - { - public void Add(CriteriaData data) { storage.Add(data); } + { + uint _criteriaId; + List _storage = new(); + + public void Add(CriteriaData data) { _storage.Add(data); } public bool Meets(Player source, Unit target, uint miscValue = 0, uint miscValue2 = 0) { - foreach (var data in storage) - if (!data.Meets(criteria_id, source, target, miscValue, miscValue2)) + foreach (var data in _storage) + if (!data.Meets(_criteriaId, source, target, miscValue, miscValue2)) return false; return true; } - public void SetCriteriaId(uint id) { criteria_id = id; } - - uint criteria_id; - List storage = new List(); + public void SetCriteriaId(uint id) { _criteriaId = id; } } } diff --git a/Source/Game/Arenas/ArenaTeam.cs b/Source/Game/Arenas/ArenaTeam.cs index 6fc662c5c..ca65d252f 100644 --- a/Source/Game/Arenas/ArenaTeam.cs +++ b/Source/Game/Arenas/ArenaTeam.cs @@ -136,7 +136,7 @@ namespace Game.Arenas //Player.RemovePetitionsAndSigns(playerGuid, GetArenaType()); // Feed data to the struct - ArenaTeamMember newMember = new ArenaTeamMember(); + ArenaTeamMember newMember = new(); newMember.Name = playerName; newMember.Guid = playerGuid; newMember.Class = (byte)playerClass; @@ -211,7 +211,7 @@ namespace Game.Arenas if (arenaTeamId > teamId) break; - ArenaTeamMember newMember = new ArenaTeamMember(); + ArenaTeamMember newMember = new(); newMember.Guid = ObjectGuid.Create(HighGuid.Player, result.Read(1)); newMember.WeekGames = result.Read(2); newMember.WeekWins = result.Read(3); @@ -341,7 +341,7 @@ namespace Game.Arenas DelMember(Members.FirstOrDefault().Guid, false); // Update database - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ARENA_TEAM); stmt.AddValue(0, teamId); @@ -364,7 +364,7 @@ namespace Game.Arenas DelMember(Members.First().Guid, false); // Update database - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ARENA_TEAM); stmt.AddValue(0, teamId); @@ -692,7 +692,7 @@ namespace Game.Arenas // Save team and member stats to db // Called after a match has ended or when calculating arena_points - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ARENA_TEAM_STATS); stmt.AddValue(0, stats.Rating); @@ -808,7 +808,7 @@ namespace Game.Arenas byte BorderStyle; // border image id uint BorderColor; // ARGB format - List Members = new List(); + List Members = new(); ArenaTeamStats stats; } diff --git a/Source/Game/Arenas/ArenaTeamManager.cs b/Source/Game/Arenas/ArenaTeamManager.cs index 3aa8c8bd0..e25ff97e5 100644 --- a/Source/Game/Arenas/ArenaTeamManager.cs +++ b/Source/Game/Arenas/ArenaTeamManager.cs @@ -101,7 +101,7 @@ namespace Game.Arenas uint count = 0; do { - ArenaTeam newArenaTeam = new ArenaTeam(); + ArenaTeam newArenaTeam = new(); if (!newArenaTeam.LoadArenaTeamFromDB(result) || !newArenaTeam.LoadMembersFromDB(result2)) { @@ -123,6 +123,6 @@ namespace Game.Arenas public Dictionary GetArenaTeamMap() { return ArenaTeamStorage; } uint NextArenaTeamId; - Dictionary ArenaTeamStorage = new Dictionary(); + Dictionary ArenaTeamStorage = new(); } } diff --git a/Source/Game/AuctionHouse/AuctionManager.cs b/Source/Game/AuctionHouse/AuctionManager.cs index b0fc4f9c4..c6d691918 100644 --- a/Source/Game/AuctionHouse/AuctionManager.cs +++ b/Source/Game/AuctionHouse/AuctionManager.cs @@ -41,13 +41,13 @@ namespace Game AuctionHouseObject mNeutralAuctions; AuctionHouseObject mGoblinAuctions; - Dictionary _pendingAuctionsByPlayer = new Dictionary(); + Dictionary _pendingAuctionsByPlayer = new(); - Dictionary _itemsByGuid = new Dictionary(); + Dictionary _itemsByGuid = new(); uint _replicateIdGenerator; - Dictionary _playerThrottleObjects = new Dictionary(); + Dictionary _playerThrottleObjects = new(); DateTime _playerThrottleObjectsCleanupTime; AuctionManager() @@ -164,8 +164,8 @@ namespace Game // data needs to be at first place for Item.LoadFromDB uint count = 0; - MultiMap itemsByAuction = new MultiMap(); - MultiMap biddersByAuction = new MultiMap(); + MultiMap itemsByAuction = new(); + MultiMap biddersByAuction = new(); do { @@ -215,10 +215,10 @@ namespace Game result = DB.Characters.Query(DB.Characters.GetPreparedStatement(CharStatements.SEL_AUCTIONS)); if (!result.IsEmpty()) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); do { - AuctionPosting auction = new AuctionPosting(); + AuctionPosting auction = new(); auction.Id = result.Read(0); uint auctionHouseId = result.Read(1); @@ -343,7 +343,7 @@ namespace Game // expire auctions we cannot afford if (auctionIndex < playerPendingAuctions.Auctions.Count) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); do { @@ -385,7 +385,7 @@ namespace Game // Expire any auctions that we couldn't get a deposit for Log.outWarn(LogFilter.Auctionhouse, $"Player {playerGUID} was offline, unable to retrieve deposit!"); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); foreach (PendingAuctionInfo pendingAuction in pair.Value.Auctions) { AuctionPosting auction = GetAuctionsById(pendingAuction.AuctionHouseId).GetAuction(pendingAuction.AuctionId); @@ -517,7 +517,7 @@ namespace Game class PlayerPendingAuctions { - public List Auctions = new List(); + public List Auctions = new(); public int LastAuctionsSize; } @@ -677,7 +677,7 @@ namespace Game _itemsByAuctionId[auction.Id] = auction; - AuctionPosting.Sorter insertSorter = new AuctionPosting.Sorter(Locale.enUS, new AuctionSortDef[] { new AuctionSortDef(AuctionHouseSortOrder.Price, false) }, 1); + AuctionPosting.Sorter insertSorter = new(Locale.enUS, new AuctionSortDef[] { new AuctionSortDef(AuctionHouseSortOrder.Price, false) }, 1); var auctionIndex = bucket.Auctions.BinarySearch(auction, insertSorter); if (auctionIndex < 0) auctionIndex = ~auctionIndex; @@ -786,7 +786,7 @@ namespace Game if (_itemsByAuctionId.Empty()) return; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); foreach (var auction in _itemsByAuctionId.Values.ToList()) { @@ -822,8 +822,8 @@ namespace Game public void BuildListBuckets(AuctionListBucketsResult listBucketsResult, Player player, string name, byte minLevel, byte maxLevel, AuctionHouseFilterMask filters, Optional classFilters, byte[] knownPetBits, int knownPetBitsCount, byte maxKnownPetLevel, uint offset, AuctionSortDef[] sorts, int sortCount) { - List knownAppearanceIds = new List(); - BitArray knownPetSpecies = new BitArray(knownPetBits); + List knownAppearanceIds = new(); + BitArray knownPetSpecies = new(knownPetBits); // prepare uncollected filter for more efficient searches if (filters.HasFlag(AuctionHouseFilterMask.UncollectedOnly)) { @@ -957,7 +957,7 @@ namespace Game foreach (AuctionsBucketData resultBucket in builder.GetResultRange()) { - BucketInfo bucketInfo = new BucketInfo(); + BucketInfo bucketInfo = new(); resultBucket.BuildBucketInfo(bucketInfo, player); listBucketsResult.Buckets.Add(bucketInfo); } @@ -967,7 +967,7 @@ namespace Game public void BuildListBuckets(AuctionListBucketsResult listBucketsResult, Player player, AuctionBucketKey[] keys, int keysCount, AuctionSortDef[] sorts, int sortCount) { - List buckets = new List(); + List buckets = new(); for (int i = 0; i < keysCount; ++i) { var bucketData = _buckets.LookupByKey(new AuctionsBucketKey(keys[i])); @@ -975,12 +975,12 @@ namespace Game buckets.Add(bucketData); } - AuctionsBucketData.Sorter sorter = new AuctionsBucketData.Sorter(player.GetSession().GetSessionDbcLocale(), sorts, sortCount); + AuctionsBucketData.Sorter sorter = new(player.GetSession().GetSessionDbcLocale(), sorts, sortCount); buckets.Sort(sorter); foreach (AuctionsBucketData resultBucket in buckets) { - BucketInfo bucketInfo = new BucketInfo(); + BucketInfo bucketInfo = new(); resultBucket.BuildBucketInfo(bucketInfo, player); listBucketsResult.Buckets.Add(bucketInfo); } @@ -991,7 +991,7 @@ namespace Game public void BuildListBiddedItems(AuctionListBiddedItemsResult listBidderItemsResult, Player player, uint offset, AuctionSortDef[] sorts, int sortCount) { // always full list - List auctions = new List(); + List auctions = new(); foreach (var auctionId in _playerBidderAuctions.LookupByKey(player.GetGUID())) { AuctionPosting auction = _itemsByAuctionId.LookupByKey(auctionId); @@ -999,12 +999,12 @@ namespace Game auctions.Add(auction); } - AuctionPosting.Sorter sorter = new AuctionPosting.Sorter(player.GetSession().GetSessionDbcLocale(), sorts, sortCount); + AuctionPosting.Sorter sorter = new(player.GetSession().GetSessionDbcLocale(), sorts, sortCount); auctions.Sort(sorter); foreach (var resultAuction in auctions) { - AuctionItem auctionItem = new AuctionItem(); + AuctionItem auctionItem = new(); resultAuction.BuildAuctionItem(auctionItem, true, true, true, false); listBidderItemsResult.Items.Add(auctionItem); } @@ -1030,7 +1030,7 @@ namespace Game foreach (AuctionPosting resultAuction in builder.GetResultRange()) { - AuctionItem auctionItem = new AuctionItem(); + AuctionItem auctionItem = new(); resultAuction.BuildAuctionItem(auctionItem, false, false, resultAuction.OwnerAccount != player.GetSession().GetAccountGUID(), resultAuction.Bidder.IsEmpty()); listItemsResult.Items.Add(auctionItem); } @@ -1058,7 +1058,7 @@ namespace Game foreach (AuctionPosting resultAuction in builder.GetResultRange()) { - AuctionItem auctionItem = new AuctionItem(); + AuctionItem auctionItem = new(); resultAuction.BuildAuctionItem(auctionItem, false, true, resultAuction.OwnerAccount != player.GetSession().GetAccountGUID(), resultAuction.Bidder.IsEmpty()); @@ -1071,7 +1071,7 @@ namespace Game public void BuildListOwnedItems(AuctionListOwnedItemsResult listOwnerItemsResult, Player player, uint offset, AuctionSortDef[] sorts, int sortCount) { // always full list - List auctions = new List(); + List auctions = new(); foreach (var auctionId in _playerOwnedAuctions.LookupByKey(player.GetGUID())) { AuctionPosting auction = _itemsByAuctionId.LookupByKey(auctionId); @@ -1079,12 +1079,12 @@ namespace Game auctions.Add(auction); } - AuctionPosting.Sorter sorter = new AuctionPosting.Sorter(player.GetSession().GetSessionDbcLocale(), sorts, sortCount); + AuctionPosting.Sorter sorter = new(player.GetSession().GetSessionDbcLocale(), sorts, sortCount); auctions.Sort(sorter); foreach (var resultAuction in auctions) { - AuctionItem auctionItem = new AuctionItem(); + AuctionItem auctionItem = new(); resultAuction.BuildAuctionItem(auctionItem, true, true, false, false); listOwnerItemsResult.Items.Add(auctionItem); } @@ -1118,7 +1118,7 @@ namespace Game var keyIndex = _itemsByAuctionId.IndexOfKey(cursor); foreach (var pair in _itemsByAuctionId.Skip(keyIndex)) { - AuctionItem auctionItem = new AuctionItem(); + AuctionItem auctionItem = new(); pair.Value.BuildAuctionItem(auctionItem, false, true, true, pair.Value.Bidder.IsEmpty()); replicateResponse.Items.Add(auctionItem); if (--count == 0) @@ -1197,7 +1197,7 @@ namespace Game ulong totalPrice = 0; uint remainingQuantity = quantity; - List auctions = new List(); + List auctions = new(); for (var i = 0; i < bucketItr.Auctions.Count;) { AuctionPosting auction = bucketItr.Auctions[i++]; @@ -1238,14 +1238,14 @@ namespace Game return false; } - Optional uniqueSeller = new Optional(); + Optional uniqueSeller = new(); // prepare items - List items = new List(); + List items = new(); items.Add(new MailedItemsBatch()); remainingQuantity = quantity; - List removedItemsFromAuction = new List(); + List removedItemsFromAuction = new(); for (var i = 0; i < bucketItr.Auctions.Count;) { @@ -1323,7 +1323,7 @@ namespace Game foreach (MailedItemsBatch batch in items) { - MailDraft mail = new MailDraft(Global.AuctionHouseMgr.BuildCommodityAuctionMailSubject(AuctionMailType.Won, itemId, batch.Quantity), + MailDraft mail = new(Global.AuctionHouseMgr.BuildCommodityAuctionMailSubject(AuctionMailType.Won, itemId, batch.Quantity), Global.AuctionHouseMgr.BuildAuctionWonMailBody(uniqueSeller.Value, batch.TotalPrice, batch.Quantity)); for (int i = 0; i < batch.ItemsCount; ++i) @@ -1340,7 +1340,7 @@ namespace Game mail.SendMailTo(trans, player, new MailSender(this), MailCheckMask.Copied); } - AuctionWonNotification packet = new AuctionWonNotification(); + AuctionWonNotification packet = new(); packet.Info.Initialize(auctions[0], items[0].Items[0]); player.SendPacket(packet); @@ -1373,7 +1373,7 @@ namespace Game { if (oldBidder) { - AuctionOutbidNotification packet = new AuctionOutbidNotification(); + AuctionOutbidNotification packet = new(); packet.BidAmount = newBidAmount; packet.MinIncrement = AuctionPosting.CalculateMinIncrement(newBidAmount); packet.Info.AuctionID = auction.Id; @@ -1427,7 +1427,7 @@ namespace Game // receiver exist if ((bidder != null || bidderAccId != 0))// && !sAuctionBotConfig.IsBotChar(auction.Bidder)) { - MailDraft mail = new MailDraft(Global.AuctionHouseMgr.BuildItemAuctionMailSubject(AuctionMailType.Won, auction), + MailDraft mail = new(Global.AuctionHouseMgr.BuildItemAuctionMailSubject(AuctionMailType.Won, auction), Global.AuctionHouseMgr.BuildAuctionWonMailBody(auction.Owner, auction.BidAmount, auction.BuyoutOrUnitPrice)); // set owner to bidder (to prevent delete item with sender char deleting) @@ -1444,7 +1444,7 @@ namespace Game if (bidder) { - AuctionWonNotification packet = new AuctionWonNotification(); + AuctionWonNotification packet = new(); packet.Info.Initialize(auction, auction.Items[0]); bidder.SendPacket(packet); @@ -1502,7 +1502,7 @@ namespace Game int itemIndex = 0; while (itemIndex < auction.Items.Count) { - MailDraft mail = new MailDraft(Global.AuctionHouseMgr.BuildItemAuctionMailSubject(AuctionMailType.Expired, auction), ""); + MailDraft mail = new(Global.AuctionHouseMgr.BuildItemAuctionMailSubject(AuctionMailType.Expired, auction), ""); for (int i = 0; i < SharedConst.MaxMailItems && itemIndex < auction.Items.Count; ++i, ++itemIndex) mail.AddItem(auction.Items[itemIndex]); @@ -1523,7 +1523,7 @@ namespace Game int itemIndex = 0; while (itemIndex < auction.Items.Count) { - MailDraft draft = new MailDraft(Global.AuctionHouseMgr.BuildItemAuctionMailSubject(AuctionMailType.Cancelled, auction), ""); + MailDraft draft = new(Global.AuctionHouseMgr.BuildItemAuctionMailSubject(AuctionMailType.Cancelled, auction), ""); for (int i = 0; i < SharedConst.MaxMailItems && itemIndex < auction.Items.Count; ++i, ++itemIndex) draft.AddItem(auction.Items[itemIndex]); @@ -1552,7 +1552,7 @@ namespace Game // owner exist (online or offline) if ((owner || Global.CharacterCacheStorage.HasCharacterCacheEntry(auction.Owner)))// && !sAuctionBotConfig.IsBotChar(auction.Owner)) { - ByteBuffer tempBuffer = new ByteBuffer(); + ByteBuffer tempBuffer = new(); tempBuffer.WritePackedTime(GameTime.GetGameTime() + WorldConfig.GetIntValue(WorldCfg.MailDeliveryDelay)); uint eta = tempBuffer.ReadUInt32(); @@ -1593,16 +1593,16 @@ namespace Game AuctionHouseRecord _auctionHouse; - SortedList _itemsByAuctionId = new SortedList(); // ordered for replicate - SortedDictionary _buckets = new SortedDictionary();// ordered for search by itemid only - Dictionary _commodityQuotes = new Dictionary(); + SortedList _itemsByAuctionId = new(); // ordered for replicate + SortedDictionary _buckets = new();// ordered for search by itemid only + Dictionary _commodityQuotes = new(); - MultiMap _playerOwnedAuctions = new MultiMap(); - MultiMap _playerBidderAuctions = new MultiMap(); + MultiMap _playerOwnedAuctions = new(); + MultiMap _playerBidderAuctions = new(); // Map of throttled players for GetAll, and throttle expiry time // Stored here, rather than player object to maintain persistence after logout - Dictionary _replicateThrottleMap = new Dictionary(); + Dictionary _replicateThrottleMap = new(); } public class AuctionPosting @@ -1610,7 +1610,7 @@ namespace Game public uint Id; public AuctionsBucketData Bucket; - public List Items = new List(); + public List Items = new(); public ObjectGuid Owner; public ObjectGuid OwnerAccount; public ObjectGuid Bidder; @@ -1621,7 +1621,7 @@ namespace Game public DateTime StartTime = DateTime.MinValue; public DateTime EndTime = DateTime.MinValue; - public List BidderHistory = new List(); + public List BidderHistory = new(); public bool IsCommodity() { @@ -1674,7 +1674,7 @@ namespace Game SocketedGem gemData = Items[0].m_itemData.Gems[i]; if (gemData.ItemId != 0) { - ItemGemData gem = new ItemGemData(); + ItemGemData gem = new(); gem.Slot = i; gem.Item = new ItemInstance(gemData); auctionItem.Gems.Add(gem); @@ -1802,7 +1802,7 @@ namespace Game public byte MaxBattlePetLevel = 0; public string[] FullName = new string[(int)Locale.Total]; - public List Auctions = new List(); + public List Auctions = new(); public void BuildBucketInfo(BucketInfo bucketInfo, Player player) { @@ -2004,7 +2004,7 @@ namespace Game uint _offset; IComparer _sorter; AuctionHouseResultLimits _maxResults; - List _items = new List(); + List _items = new(); bool _hasMoreResults; public AuctionsResultBuilder(uint offset, IComparer sorter, AuctionHouseResultLimits maxResults) diff --git a/Source/Game/BattleFields/BattleField.cs b/Source/Game/BattleFields/BattleField.cs index d71b249d0..d67817b91 100644 --- a/Source/Game/BattleFields/BattleField.cs +++ b/Source/Game/BattleFields/BattleField.cs @@ -471,7 +471,7 @@ namespace Game.BattleFields public void SendUpdateWorldState(uint variable, uint value, bool hidden = false) { - UpdateWorldState worldstate = new UpdateWorldState(); + UpdateWorldState worldstate = new(); worldstate.VariableID = variable; worldstate.Value = (int)value; worldstate.Hidden = hidden; @@ -654,7 +654,7 @@ namespace Game.BattleFields public void SendAreaSpiritHealerQuery(Player player, ObjectGuid guid) { - AreaSpiritHealerTime areaSpiritHealerTime = new AreaSpiritHealerTime(); + AreaSpiritHealerTime areaSpiritHealerTime = new(); areaSpiritHealerTime.HealerGuid = guid; areaSpiritHealerTime.TimeLeft = m_LastResurectTimer;// resurrect every 30 seconds @@ -807,7 +807,7 @@ namespace Game.BattleFields protected uint m_DefenderTeam; // Map of the objectives belonging to this OutdoorPvP - Dictionary m_capturePoints = new Dictionary(); + Dictionary m_capturePoints = new(); // Players info maps protected List[] m_players = new List[2]; // Players in zone @@ -835,7 +835,7 @@ namespace Game.BattleFields uint m_uiKickAfkPlayersTimer; // Timer for check Afk in war // Graveyard variables - protected List m_GraveyardList = new List(); // Vector witch contain the different GY of the battle + protected List m_GraveyardList = new(); // Vector witch contain the different GY of the battle uint m_LastResurectTimer; // Timer for resurect player every 30 sec protected uint m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle @@ -843,8 +843,8 @@ namespace Game.BattleFields List[] m_Groups = new List[2]; // Contain different raid group - Dictionary m_Data64 = new Dictionary(); - protected Dictionary m_Data32 = new Dictionary(); + Dictionary m_Data64 = new(); + protected Dictionary m_Data32 = new(); } public class BfGraveyard @@ -992,7 +992,7 @@ namespace Game.BattleFields uint m_ControlTeam; uint m_GraveyardId; ObjectGuid[] m_SpiritGuide = new ObjectGuid[SharedConst.BGTeamsCount]; - List m_ResurrectQueue = new List(); + List m_ResurrectQueue = new(); protected BattleField m_Bf; } @@ -1143,7 +1143,7 @@ namespace Game.BattleFields } } - List players = new List(); + List players = new(); var checker = new AnyPlayerInObjectRangeCheck(capturePoint, radius); var searcher = new PlayerListSearcher(capturePoint, players, checker); Cell.VisitWorldObjects(capturePoint, searcher, radius); diff --git a/Source/Game/BattleFields/BattleFieldManager.cs b/Source/Game/BattleFields/BattleFieldManager.cs index 3892adb7b..372b986f3 100644 --- a/Source/Game/BattleFields/BattleFieldManager.cs +++ b/Source/Game/BattleFields/BattleFieldManager.cs @@ -145,10 +145,10 @@ namespace Game.BattleFields // contains all initiated battlefield events // used when initing / cleaning up - List _battlefieldSet = new List(); + List _battlefieldSet = new(); // maps the zone ids to an battlefield event // used in player event handling - Dictionary _battlefieldMap = new Dictionary(); + Dictionary _battlefieldMap = new(); // update interval uint _updateTimer; } diff --git a/Source/Game/BattleFields/Zones/WinterGrasp.cs b/Source/Game/BattleFields/Zones/WinterGrasp.cs index 09c7c290a..001d968d6 100644 --- a/Source/Game/BattleFields/Zones/WinterGrasp.cs +++ b/Source/Game/BattleFields/Zones/WinterGrasp.cs @@ -85,7 +85,7 @@ namespace Game.BattleFields foreach (var gy in WGConst.WGGraveYard) { - BfGraveyardWG graveyard = new BfGraveyardWG(this); + BfGraveyardWG graveyard = new(this); // When between games, the graveyard is controlled by the defending team if (gy.StartControl == TeamId.Neutral) @@ -101,7 +101,7 @@ namespace Game.BattleFields // Spawn workshop creatures and gameobjects for (byte i = 0; i < WGConst.MaxWorkshops; i++) { - WGWorkshop workshop = new WGWorkshop(this, i); + WGWorkshop workshop = new(this, i); if (i < WGWorkshopIds.Ne) workshop.GiveControlTo(GetAttackerTeam(), true); else @@ -129,7 +129,7 @@ namespace Game.BattleFields GameObject go = SpawnGameObject(build.Entry, build.Pos, build.Rot); if (go) { - BfWGGameObjectBuilding b = new BfWGGameObjectBuilding(this, build.BuildingType, build.WorldState); + BfWGGameObjectBuilding b = new(this, build.BuildingType, build.WorldState); b.Init(go); if (!IsEnabled() && go.GetEntry() == WGGameObjects.VaultGate) go.SetDestructibleState(GameObjectDestructibleState.Destroyed); @@ -551,7 +551,7 @@ namespace Game.BattleFields { if (workshop.GetId() == workshopId) { - WintergraspCapturePoint capturePoint = new WintergraspCapturePoint(this, GetAttackerTeam()); + WintergraspCapturePoint capturePoint = new(this, GetAttackerTeam()); capturePoint.SetCapturePointData(go); capturePoint.LinkToWorkshop(workshop); @@ -782,7 +782,7 @@ namespace Game.BattleFields void SendInitWorldStatesTo(Player player) { - InitWorldStates packet = new InitWorldStates(); + InitWorldStates packet = new(); packet.AreaID = m_ZoneId; packet.MapID = m_MapId; packet.SubareaID = 0; @@ -1028,13 +1028,13 @@ namespace Game.BattleFields bool m_isRelicInteractible; - List Workshops = new List(); + List Workshops = new(); List[] DefenderPortalList = new List[SharedConst.BGTeamsCount]; - List BuildingsInZone = new List(); + List BuildingsInZone = new(); List[] m_vehicles = new List[SharedConst.BGTeamsCount]; - List CanonList = new List(); + List CanonList = new(); int m_tenacityTeam; uint m_tenacityStack; @@ -1476,8 +1476,8 @@ namespace Game.BattleFields // Creature associations List[] m_CreatureBottomList = new List[SharedConst.BGTeamsCount]; List[] m_CreatureTopList = new List[SharedConst.BGTeamsCount]; - List m_TowerCannonBottomList = new List(); - List m_TurretTopList = new List(); + List m_TowerCannonBottomList = new(); + List m_TurretTopList = new(); } class WGWorkshop diff --git a/Source/Game/BattleFields/Zones/WinterGraspConst.cs b/Source/Game/BattleFields/Zones/WinterGraspConst.cs index b46f8c1a8..bb9528ff1 100644 --- a/Source/Game/BattleFields/Zones/WinterGraspConst.cs +++ b/Source/Game/BattleFields/Zones/WinterGraspConst.cs @@ -45,10 +45,10 @@ namespace Game.BattleFields public static uint[] ClockWorldState = { 3781, 4354 }; public static uint[] WintergraspFaction = { 1732, 1735, 35 }; - public static Position WintergraspStalkerPos = new Position(4948.985f, 2937.789f, 550.5172f, 1.815142f); + public static Position WintergraspStalkerPos = new(4948.985f, 2937.789f, 550.5172f, 1.815142f); - public static Position RelicPos = new Position(5440.379f, 2840.493f, 430.2816f, -1.832595f); - public static Quaternion RelicRot = new Quaternion(0.0f, 0.0f, -0.7933531f, 0.6087617f); + public static Position RelicPos = new(5440.379f, 2840.493f, 430.2816f, -1.832595f); + public static Quaternion RelicRot = new(0.0f, 0.0f, -0.7933531f, 0.6087617f); //Destructible (Wall, Tower..) public static WintergraspBuildingSpawnData[] WGGameObjectBuilding = diff --git a/Source/Game/BattleGrounds/BattleGround.cs b/Source/Game/BattleGrounds/BattleGround.cs index 1f14b894a..a915b90b0 100644 --- a/Source/Game/BattleGrounds/BattleGround.cs +++ b/Source/Game/BattleGrounds/BattleGround.cs @@ -187,7 +187,7 @@ namespace Game.BattleGrounds { m_LastPlayerPositionBroadcast = 0; - BattlegroundPlayerPositions playerPositions = new BattlegroundPlayerPositions(); + BattlegroundPlayerPositions playerPositions = new(); for (var i =0; i < _playerPositions.Count; ++i) { var playerPosition = _playerPositions[i]; @@ -349,7 +349,7 @@ namespace Game.BattleGrounds { uint countdownMaxForBGType = IsArena() ? BattlegroundConst.ArenaCountdownMax : BattlegroundConst.BattlegroundCountdownMax; - StartTimer timer = new StartTimer(); + StartTimer timer = new(); timer.Type = TimerType.Pvp; timer.TimeRemaining = countdownMaxForBGType - (GetElapsedTime() / 1000); timer.TotalTime = countdownMaxForBGType; @@ -568,8 +568,8 @@ namespace Game.BattleGrounds return; } - BroadcastTextBuilder builder = new BroadcastTextBuilder(null, msgType, id, Gender.Male, target); - LocalizedPacketDo localizer = new LocalizedPacketDo(builder); + BroadcastTextBuilder builder = new(null, msgType, id, Gender.Male, target); + LocalizedPacketDo localizer = new(builder); BroadcastWorker(localizer); } @@ -634,7 +634,7 @@ namespace Game.BattleGrounds public void UpdateWorldState(uint variable, uint value, bool hidden = false) { - UpdateWorldState worldstate = new UpdateWorldState(); + UpdateWorldState worldstate = new(); worldstate.VariableID = variable; worldstate.Value = (int)value; worldstate.Hidden = hidden; @@ -643,7 +643,7 @@ namespace Game.BattleGrounds public void UpdateWorldState(uint variable, bool value, bool hidden = false) { - UpdateWorldState worldstate = new UpdateWorldState(); + UpdateWorldState worldstate = new(); worldstate.VariableID = variable; worldstate.Value = value ? 1 : 0; worldstate.Hidden = hidden; @@ -699,7 +699,7 @@ namespace Game.BattleGrounds //we must set it this way, because end time is sent in packet! SetRemainingTime(BattlegroundConst.AutocloseBattleground); - PVPMatchComplete pvpMatchComplete = new PVPMatchComplete(); + PVPMatchComplete pvpMatchComplete = new(); pvpMatchComplete.Winner = (byte)GetWinner(); pvpMatchComplete.Duration = (int)Math.Max(0, (GetElapsedTime() - (int)BattlegroundStartTimeIntervals.Delay2m) / Time.InMilliseconds); pvpMatchComplete.LogData.HasValue = true; @@ -905,7 +905,7 @@ namespace Game.BattleGrounds Global.BattlegroundMgr.ScheduleQueueUpdate(0, bgQueueTypeId, GetBracketId()); } // Let others know - BattlegroundPlayerLeft playerLeft = new BattlegroundPlayerLeft(); + BattlegroundPlayerLeft playerLeft = new(); playerLeft.Guid = guid; SendPacketToTeam(team, playerLeft, player); } @@ -989,7 +989,7 @@ namespace Game.BattleGrounds ObjectGuid guid = player.GetGUID(); Team team = player.GetBGTeam(); - BattlegroundPlayer bp = new BattlegroundPlayer(); + BattlegroundPlayer bp = new(); bp.OfflineRemoveTime = 0; bp.Team = team; bp.ActiveSpec = (int)player.GetPrimarySpecialization(); @@ -999,11 +999,11 @@ namespace Game.BattleGrounds UpdatePlayersCountByTeam(team, false); // +1 player - BattlegroundPlayerJoined playerJoined = new BattlegroundPlayerJoined(); + BattlegroundPlayerJoined playerJoined = new(); playerJoined.Guid = player.GetGUID(); SendPacketToTeam(team, playerJoined, player); - PVPMatchInitialize pvpMatchInitialize = new PVPMatchInitialize(); + PVPMatchInitialize pvpMatchInitialize = new(); pvpMatchInitialize.MapID = GetMapId(); switch (GetStatus()) { @@ -1057,7 +1057,7 @@ namespace Game.BattleGrounds player.CastSpell(player, BattlegroundConst.SpellPreparation, true); // reduces all mana cost of spells. uint countdownMaxForBGType = IsArena() ? BattlegroundConst.ArenaCountdownMax : BattlegroundConst.BattlegroundCountdownMax; - StartTimer timer = new StartTimer(); + StartTimer timer = new(); timer.Type = TimerType.Pvp; timer.TimeRemaining = countdownMaxForBGType - (GetElapsedTime() / 1000); timer.TotalTime = countdownMaxForBGType; @@ -1346,7 +1346,7 @@ namespace Game.BattleGrounds if (!map) return false; - Quaternion rotation = new Quaternion(rotation0, rotation1, rotation2, rotation3); + Quaternion rotation = new(rotation0, rotation1, rotation2, rotation3); // Temporally add safety check for bad spawns and send log (object rotations need to be rechecked in sniff) if (rotation0 == 0 && rotation1 == 0 && rotation2 == 0 && rotation3 == 0) { @@ -1485,7 +1485,7 @@ namespace Game.BattleGrounds return null; } - Position pos = new Position(x, y, z, o); + Position pos = new(x, y, z, o); Creature creature = Creature.CreateCreature(entry, map, pos); if (!creature) @@ -1581,8 +1581,8 @@ namespace Game.BattleGrounds if (entry == 0) return; - CypherStringChatBuilder builder = new CypherStringChatBuilder(null, msgType, entry, source); - LocalizedPacketDo localizer = new LocalizedPacketDo(builder); + CypherStringChatBuilder builder = new(null, msgType, entry, source); + LocalizedPacketDo localizer = new(builder); BroadcastWorker(localizer); } @@ -1591,8 +1591,8 @@ namespace Game.BattleGrounds if (entry == 0) return; - CypherStringChatBuilder builder = new CypherStringChatBuilder(null, msgType, entry, source, args); - LocalizedPacketDo localizer = new LocalizedPacketDo(builder); + CypherStringChatBuilder builder = new(null, msgType, entry, source, args); + LocalizedPacketDo localizer = new(builder); BroadcastWorker(localizer); } @@ -1724,7 +1724,7 @@ namespace Game.BattleGrounds BlockMovement(player); - PVPMatchStatisticsMessage pvpMatchStatistics = new PVPMatchStatisticsMessage(); + PVPMatchStatisticsMessage pvpMatchStatistics = new(); BuildPvPLogDataPacket(out pvpMatchStatistics.Data); player.SendPacket(pvpMatchStatistics); } @@ -2025,11 +2025,11 @@ namespace Game.BattleGrounds } #region Fields - protected Dictionary PlayerScores = new Dictionary(); // Player scores + protected Dictionary PlayerScores = new(); // Player scores // Player lists, those need to be accessible by inherited classes - Dictionary m_Players = new Dictionary(); + Dictionary m_Players = new(); // Spirit Guide guid + Player list GUIDS - MultiMap m_ReviveQueue = new MultiMap(); + MultiMap m_ReviveQueue = new(); // these are important variables used for starting messages BattlegroundEventFlags m_Events; @@ -2071,8 +2071,8 @@ namespace Game.BattleGrounds uint m_LastPlayerPositionBroadcast; // Player lists - List m_ResurrectQueue = new List(); // Player GUID - List m_OfflineQueue = new List(); // Player GUID + List m_ResurrectQueue = new(); // Player GUID + List m_OfflineQueue = new(); // Player GUID // Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction // Invited counters will be changed only when removing already invited player from queue, removing player from Battleground and inviting player to BG @@ -2099,7 +2099,7 @@ namespace Game.BattleGrounds BattlegroundTemplate _battlegroundTemplate; PvpDifficultyRecord _pvpDifficultyEntry; - List _playerPositions = new List(); + List _playerPositions = new(); #endregion } diff --git a/Source/Game/BattleGrounds/BattleGroundManager.cs b/Source/Game/BattleGrounds/BattleGroundManager.cs index 0018406c1..7baaea803 100644 --- a/Source/Game/BattleGrounds/BattleGroundManager.cs +++ b/Source/Game/BattleGrounds/BattleGroundManager.cs @@ -85,7 +85,7 @@ namespace Game.BattleGrounds // update scheduled queues if (!m_QueueUpdateScheduler.Empty()) { - List scheduled = new List(); + List scheduled = new(); Extensions.Swap(ref scheduled, ref m_QueueUpdateScheduler); for (byte i = 0; i < scheduled.Count; i++) @@ -379,7 +379,7 @@ namespace Game.BattleGrounds continue; } - BattlegroundTemplate bgTemplate = new BattlegroundTemplate(); + BattlegroundTemplate bgTemplate = new(); bgTemplate.Id = bgTypeId; float dist = result.Read(3); bgTemplate.MaxStartDistSq = dist * dist; @@ -439,7 +439,7 @@ namespace Game.BattleGrounds if (bgTemplate == null) return; - BattlefieldList battlefieldList = new BattlefieldList(); + BattlefieldList battlefieldList = new(); battlefieldList.BattlemasterGuid = guid; battlefieldList.BattlemasterListID = (int)bgTypeId; battlefieldList.MinLevel = bgTemplate.GetMinLevel(); @@ -471,7 +471,7 @@ namespace Game.BattleGrounds if (time == 0xFFFFFFFF) time = 0; - AreaSpiritHealerTime areaSpiritHealerTime = new AreaSpiritHealerTime(); + AreaSpiritHealerTime areaSpiritHealerTime = new(); areaSpiritHealerTime.HealerGuid = guid; areaSpiritHealerTime.TimeLeft = time; @@ -556,7 +556,7 @@ namespace Game.BattleGrounds public void ScheduleQueueUpdate(uint arenaMatchmakerRating, BattlegroundQueueTypeId bgQueueTypeId, BattlegroundBracketId bracket_id) { //we will use only 1 number created of bgTypeId and bracket_id - ScheduledQueueUpdate scheduleId = new ScheduledQueueUpdate(arenaMatchmakerRating, bgQueueTypeId, bracket_id); + ScheduledQueueUpdate scheduleId = new(arenaMatchmakerRating, bgQueueTypeId, bracket_id); if (!m_QueueUpdateScheduler.Contains(scheduleId)) m_QueueUpdateScheduler.Add(scheduleId); } @@ -700,7 +700,7 @@ namespace Game.BattleGrounds BattlegroundTemplate bgTemplate = GetBattlegroundTemplateByTypeId(bgTypeId); if (bgTemplate != null) { - Dictionary selectionWeights = new Dictionary(); + Dictionary selectionWeights = new(); foreach (var mapId in bgTemplate.BattlemasterEntry.MapId) { @@ -780,12 +780,12 @@ namespace Game.BattleGrounds return _battlegroundMapTemplates.LookupByKey(mapId); } - Dictionary bgDataStore = new Dictionary(); - Dictionary m_BattlegroundQueues = new Dictionary(); - MultiMap m_BGFreeSlotQueue = new MultiMap(); - Dictionary mBattleMastersMap = new Dictionary(); - Dictionary _battlegroundTemplates = new Dictionary(); - Dictionary _battlegroundMapTemplates = new Dictionary(); + Dictionary bgDataStore = new(); + Dictionary m_BattlegroundQueues = new(); + MultiMap m_BGFreeSlotQueue = new(); + Dictionary mBattleMastersMap = new(); + Dictionary _battlegroundTemplates = new(); + Dictionary _battlegroundMapTemplates = new(); struct ScheduledQueueUpdate { @@ -820,7 +820,7 @@ namespace Game.BattleGrounds return ArenaMatchmakerRating.GetHashCode() ^ QueueId.GetHashCode() ^ BracketId.GetHashCode(); } } - List m_QueueUpdateScheduler = new List(); + List m_QueueUpdateScheduler = new(); uint m_NextRatedArenaUpdate; uint m_UpdateTimer; bool m_ArenaTesting; @@ -835,7 +835,7 @@ namespace Game.BattleGrounds m_ClientBattlegroundIds[i] = new List(); } - public Dictionary m_Battlegrounds = new Dictionary(); + public Dictionary m_Battlegrounds = new(); public List[] m_ClientBattlegroundIds = new List[(int)BattlegroundBracketId.Max]; public Battleground Template; } diff --git a/Source/Game/BattleGrounds/BattleGroundQueue.cs b/Source/Game/BattleGrounds/BattleGroundQueue.cs index 33ae145b5..f95246991 100644 --- a/Source/Game/BattleGrounds/BattleGroundQueue.cs +++ b/Source/Game/BattleGrounds/BattleGroundQueue.cs @@ -62,7 +62,7 @@ namespace Game.BattleGrounds BattlegroundBracketId bracketId = bracketEntry.GetBracketId(); // create new ginfo - GroupQueueInfo ginfo = new GroupQueueInfo(); + GroupQueueInfo ginfo = new(); ginfo.BgTypeId = BgTypeId; ginfo.ArenaType = ArenaType; ginfo.ArenaTeamId = arenateamid; @@ -105,7 +105,7 @@ namespace Game.BattleGrounds if (!member) continue; // this should never happen - PlayerQueueInfo pl_info = new PlayerQueueInfo(); + PlayerQueueInfo pl_info = new(); pl_info.LastOnlineTime = lastOnlineTime; pl_info.GroupInfo = ginfo; @@ -116,7 +116,7 @@ namespace Game.BattleGrounds } else { - PlayerQueueInfo pl_info = new PlayerQueueInfo(); + PlayerQueueInfo pl_info = new(); pl_info.LastOnlineTime = lastOnlineTime; pl_info.GroupInfo = ginfo; @@ -409,10 +409,10 @@ namespace Game.BattleGrounds player.SetInviteForBattlegroundQueueType(bgQueueTypeId, ginfo.IsInvitedToBGInstanceGUID); // create remind invite events - BGQueueInviteEvent inviteEvent = new BGQueueInviteEvent(player.GetGUID(), ginfo.IsInvitedToBGInstanceGUID, bgTypeId, ginfo.ArenaType, ginfo.RemoveInviteTime); + BGQueueInviteEvent inviteEvent = new(player.GetGUID(), ginfo.IsInvitedToBGInstanceGUID, bgTypeId, ginfo.ArenaType, ginfo.RemoveInviteTime); m_events.AddEvent(inviteEvent, m_events.CalculateTime(BattlegroundConst.InvitationRemindTime)); // create automatic remove events - BGQueueRemoveEvent removeEvent = new BGQueueRemoveEvent(player.GetGUID(), ginfo.IsInvitedToBGInstanceGUID, bgQueueTypeId, ginfo.RemoveInviteTime); + BGQueueRemoveEvent removeEvent = new(player.GetGUID(), ginfo.IsInvitedToBGInstanceGUID, bgQueueTypeId, ginfo.RemoveInviteTime); m_events.AddEvent(removeEvent, m_events.CalculateTime(BattlegroundConst.InviteAcceptWaitTime)); uint queueSlot = player.GetBattlegroundQueueIndex(bgQueueTypeId); @@ -968,7 +968,7 @@ namespace Game.BattleGrounds BattlegroundQueueTypeId m_queueId; - Dictionary m_QueuedPlayers = new Dictionary(); + Dictionary m_QueuedPlayers = new(); /// /// This two dimensional array is used to store All queued groups @@ -986,7 +986,7 @@ namespace Game.BattleGrounds uint[][] m_SumOfWaitTimes = new uint[SharedConst.BGTeamsCount][]; // Event handler - EventSystem m_events = new EventSystem(); + EventSystem m_events = new(); SelectionPool[] m_SelectionPools = new SelectionPool[SharedConst.BGTeamsCount]; // class to select and invite groups to bg @@ -1042,7 +1042,7 @@ namespace Game.BattleGrounds } public uint GetPlayerCount() { return PlayerCount; } - public List SelectedGroups = new List(); + public List SelectedGroups = new(); uint PlayerCount; } @@ -1142,7 +1142,7 @@ namespace Game.BattleGrounds /// public class GroupQueueInfo { - public Dictionary Players = new Dictionary(); // player queue info map + public Dictionary Players = new(); // player queue info map public Team Team; // Player team (ALLIANCE/HORDE) public BattlegroundTypeId BgTypeId; // Battleground type id public bool IsRated; // rated diff --git a/Source/Game/BattleGrounds/Zones/ArathiBasin.cs b/Source/Game/BattleGrounds/Zones/ArathiBasin.cs index 9cc0ea0e7..721300135 100644 --- a/Source/Game/BattleGrounds/Zones/ArathiBasin.cs +++ b/Source/Game/BattleGrounds/Zones/ArathiBasin.cs @@ -636,7 +636,7 @@ namespace Game.BattleGrounds.Zones int teamIndex = GetTeamIndexByTeamId(player.GetTeam()); // Is there any occupied node for this team? - List nodes = new List(); + List nodes = new(); for (byte i = 0; i < ABBattlegroundNodes.DynamicNodesCount; ++i) if (m_Nodes[i] == ABNodeStatus.Occupied + teamIndex) nodes.Add(i); diff --git a/Source/Game/BattleGrounds/Zones/StrandofAncients.cs b/Source/Game/BattleGrounds/Zones/StrandofAncients.cs index 607e5a8cc..7c8d75d64 100644 --- a/Source/Game/BattleGrounds/Zones/StrandofAncients.cs +++ b/Source/Game/BattleGrounds/Zones/StrandofAncients.cs @@ -298,7 +298,7 @@ namespace Game.BattleGrounds.Zones Player p = Global.ObjAccessor.FindPlayer(pair.Key); if (p) { - UpdateData data = new UpdateData(p.GetMapId()); + UpdateData data = new(p.GetMapId()); GetBGObject(i).BuildValuesUpdateBlockForPlayer(data, p); UpdateObject pkt; @@ -1029,7 +1029,7 @@ namespace Game.BattleGrounds.Zones { if (!BgObjects[SAObjectTypes.BoatOne].IsEmpty() || !BgObjects[SAObjectTypes.BoatTwo].IsEmpty()) { - UpdateData transData = new UpdateData(player.GetMapId()); + UpdateData transData = new(player.GetMapId()); if (!BgObjects[SAObjectTypes.BoatOne].IsEmpty()) GetBGObject(SAObjectTypes.BoatOne).BuildCreateUpdateBlockForPlayer(transData, player); @@ -1046,7 +1046,7 @@ namespace Game.BattleGrounds.Zones { if (!BgObjects[SAObjectTypes.BoatOne].IsEmpty() || !BgObjects[SAObjectTypes.BoatTwo].IsEmpty()) { - UpdateData transData = new UpdateData(player.GetMapId()); + UpdateData transData = new(player.GetMapId()); if (!BgObjects[SAObjectTypes.BoatOne].IsEmpty()) GetBGObject(SAObjectTypes.BoatOne).BuildOutOfRangeUpdateBlock(transData); if (!BgObjects[SAObjectTypes.BoatTwo].IsEmpty()) @@ -1143,7 +1143,7 @@ namespace Game.BattleGrounds.Zones bool SignaledRoundTwoHalfMin; // for know if second round has been init bool InitSecondRound; - Dictionary DemoliserRespawnList = new Dictionary(); + Dictionary DemoliserRespawnList = new(); // Achievement: Defense of the Ancients bool _gateDestroyed; diff --git a/Source/Game/BattlePets/BattlePetManager.cs b/Source/Game/BattlePets/BattlePetManager.cs index dab7740df..8526ce208 100644 --- a/Source/Game/BattlePets/BattlePetManager.cs +++ b/Source/Game/BattlePets/BattlePetManager.cs @@ -33,7 +33,7 @@ namespace Game.BattlePets _owner = owner; for (byte i = 0; i < SharedConst.MaxPetBattleSlots; ++i) { - BattlePetSlot slot = new BattlePetSlot(); + BattlePetSlot slot = new(); slot.Index = i; _slots.Add(slot); } @@ -157,7 +157,7 @@ namespace Game.BattlePets continue; } - BattlePet pet = new BattlePet(); + BattlePet pet = new(); pet.PacketInfo.Guid = ObjectGuid.Create(HighGuid.BattlePet, petsResult.Read(0)); pet.PacketInfo.Species = species; pet.PacketInfo.Breed = petsResult.Read(2); @@ -277,7 +277,7 @@ namespace Game.BattlePets if (battlePetSpecies == null) // should never happen return; - BattlePet pet = new BattlePet(); + BattlePet pet = new(); pet.PacketInfo.Guid = ObjectGuid.Create(HighGuid.BattlePet, Global.ObjectMgr.GetGenerator(HighGuid.BattlePet).Generate()); pet.PacketInfo.Species = species; pet.PacketInfo.CreatureID = creatureId; @@ -293,7 +293,7 @@ namespace Game.BattlePets _pets[pet.PacketInfo.Guid.GetCounter()] = pet; - List updates = new List(); + List updates = new(); updates.Add(pet); SendUpdates(updates, true); @@ -326,7 +326,7 @@ namespace Game.BattlePets _slots[slot].Locked = false; - PetBattleSlotUpdates updates = new PetBattleSlotUpdates(); + PetBattleSlotUpdates updates = new(); updates.Slots.Add(_slots[slot]); updates.AutoSlotted = false; // what's this? updates.NewSlot = true; // causes the "new slot unlocked" bubble to appear @@ -349,7 +349,7 @@ namespace Game.BattlePets if (pet == null) return; - List dest = new List(); + List dest = new(); if (_owner.GetPlayer().CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, SharedConst.BattlePetCageItemId, 1) != InventoryResult.Ok) return; @@ -368,7 +368,7 @@ namespace Game.BattlePets RemovePet(guid); - BattlePetDeleted deletePet = new BattlePetDeleted(); + BattlePetDeleted deletePet = new(); deletePet.PetGuid = guid; _owner.SendPacket(deletePet); } @@ -377,7 +377,7 @@ namespace Game.BattlePets { // TODO: After each Pet Battle, any injured companion will automatically // regain 50 % of the damage that was taken during combat - List updates = new List(); + List updates = new(); foreach (var pet in _pets.Values) { @@ -425,7 +425,7 @@ namespace Game.BattlePets public void SendJournal() { - BattlePetJournal battlePetJournal = new BattlePetJournal(); + BattlePetJournal battlePetJournal = new(); battlePetJournal.Trap = _trapLevel; foreach (var pet in _pets) @@ -438,7 +438,7 @@ namespace Game.BattlePets void SendUpdates(List pets, bool petAdded) { - BattlePetUpdates updates = new BattlePetUpdates(); + BattlePetUpdates updates = new(); foreach (var pet in pets) updates.Pets.Add(pet.PacketInfo); @@ -448,7 +448,7 @@ namespace Game.BattlePets public void SendError(BattlePetError error, uint creatureId) { - BattlePetErrorPacket battlePetError = new BattlePetErrorPacket(); + BattlePetErrorPacket battlePetError = new(); battlePetError.Result = error; battlePetError.CreatureID = creatureId; _owner.SendPacket(battlePetError); @@ -462,13 +462,13 @@ namespace Game.BattlePets WorldSession _owner; ushort _trapLevel; - Dictionary _pets = new Dictionary(); - List _slots = new List(); + Dictionary _pets = new(); + List _slots = new(); - static Dictionary> _battlePetBreedStates = new Dictionary>(); - static Dictionary> _battlePetSpeciesStates = new Dictionary>(); - static MultiMap _availableBreedsPerSpecies = new MultiMap(); - static Dictionary _defaultQualityPerSpecies = new Dictionary(); + static Dictionary> _battlePetBreedStates = new(); + static Dictionary> _battlePetSpeciesStates = new(); + static MultiMap _availableBreedsPerSpecies = new(); + static Dictionary _defaultQualityPerSpecies = new(); public class BattlePet { diff --git a/Source/Game/BlackMarket/BlackMarketEntry.cs b/Source/Game/BlackMarket/BlackMarketEntry.cs index 8a995a4f0..926e64dfb 100644 --- a/Source/Game/BlackMarket/BlackMarketEntry.cs +++ b/Source/Game/BlackMarket/BlackMarketEntry.cs @@ -38,7 +38,7 @@ namespace Game.BlackMarket Chance = fields.Read(6); var bonusListIDsTok = new StringArray(fields.Read(7), ' '); - List bonusListIDs = new List(); + List bonusListIDs = new(); if (!bonusListIDsTok.IsEmpty()) { foreach (string token in bonusListIDsTok) diff --git a/Source/Game/BlackMarket/BlackMarketManager.cs b/Source/Game/BlackMarket/BlackMarketManager.cs index 852888e76..791993e48 100644 --- a/Source/Game/BlackMarket/BlackMarketManager.cs +++ b/Source/Game/BlackMarket/BlackMarketManager.cs @@ -44,7 +44,7 @@ namespace Game.BlackMarket do { - BlackMarketTemplate templ = new BlackMarketTemplate(); + BlackMarketTemplate templ = new(); if (!templ.LoadFromDB(result.GetFields())) // Add checks continue; @@ -72,10 +72,10 @@ namespace Game.BlackMarket _lastUpdate = Time.UnixTime; //Set update time before loading - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); do { - BlackMarketEntry auction = new BlackMarketEntry(); + BlackMarketEntry auction = new(); if (!auction.LoadFromDB(result.GetFields())) { @@ -99,7 +99,7 @@ namespace Game.BlackMarket public void Update(bool updateTime = false) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); long now = Time.UnixTime; foreach (var entry in _auctions.Values) { @@ -118,7 +118,7 @@ namespace Game.BlackMarket public void RefreshAuctions() { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); // Delete completed auctions foreach (var pair in _auctions) { @@ -132,7 +132,7 @@ namespace Game.BlackMarket DB.Characters.CommitTransaction(trans); trans = new SQLTransaction(); - List templates = new List(); + List templates = new(); foreach (var pair in _templates) { if (GetAuctionByID(pair.Value.MarketID) != null) @@ -147,7 +147,7 @@ namespace Game.BlackMarket foreach (BlackMarketTemplate templat in templates) { - BlackMarketEntry entry = new BlackMarketEntry(); + BlackMarketEntry entry = new(); entry.Initialize(templat.MarketID, (uint)templat.Duration); entry.SaveToDB(trans); AddAuction(entry); @@ -170,7 +170,7 @@ namespace Game.BlackMarket { BlackMarketTemplate templ = pair.Value.GetTemplate(); - BlackMarketItem item = new BlackMarketItem(); + BlackMarketItem item = new(); item.MarketID = pair.Value.GetMarketId(); item.SellerNPC = templ.SellerNPC; item.Item = templ.Item; @@ -302,8 +302,8 @@ namespace Game.BlackMarket public long GetLastUpdate() { return _lastUpdate; } - Dictionary _auctions = new Dictionary(); - Dictionary _templates = new Dictionary(); + Dictionary _auctions = new(); + Dictionary _templates = new(); long _lastUpdate; } } diff --git a/Source/Game/Cache/CharacterCache.cs b/Source/Game/Cache/CharacterCache.cs index 255cc9f8f..401298e08 100644 --- a/Source/Game/Cache/CharacterCache.cs +++ b/Source/Game/Cache/CharacterCache.cs @@ -10,8 +10,8 @@ namespace Game.Cache { public class CharacterCache : Singleton { - Dictionary _characterCacheStore = new Dictionary(); - Dictionary _characterCacheByNameStore = new Dictionary(); + Dictionary _characterCacheStore = new(); + Dictionary _characterCacheByNameStore = new(); CharacterCache() { } @@ -76,7 +76,7 @@ namespace Game.Cache if (race.HasValue) characterCacheEntry.RaceId = (Race)race.Value; - InvalidatePlayer invalidatePlayer = new InvalidatePlayer(); + InvalidatePlayer invalidatePlayer = new(); invalidatePlayer.Guid = guid; Global.WorldMgr.SendGlobalMessage(invalidatePlayer); diff --git a/Source/Game/Calendar/CalendarManager.cs b/Source/Game/Calendar/CalendarManager.cs index 8ff78af12..c916048ca 100644 --- a/Source/Game/Calendar/CalendarManager.cs +++ b/Source/Game/Calendar/CalendarManager.cs @@ -64,7 +64,7 @@ namespace Game if (flags.HasAnyFlag(CalendarFlags.GuildEvent) || flags.HasAnyFlag(CalendarFlags.WithoutInvites)) guildID = Global.CharacterCacheStorage.GetCharacterGuildIdByGuid(ownerGUID); - CalendarEvent calendarEvent = new CalendarEvent(eventID, ownerGUID, guildID, type, textureID, date, flags, title, description, lockDate); + CalendarEvent calendarEvent = new(eventID, ownerGUID, guildID, type, textureID, date, flags, title, description, lockDate); _events.Add(calendarEvent); _maxEventId = Math.Max(_maxEventId, eventID); @@ -93,7 +93,7 @@ namespace Game CalendarModerationRank rank = (CalendarModerationRank)result.Read(6); string note = result.Read(7); - CalendarInvite invite = new CalendarInvite(inviteId, eventId, invitee, senderGUID, responseTime, status, rank, note); + CalendarInvite invite = new(inviteId, eventId, invitee, senderGUID, responseTime, status, rank, note); _invites.Add(eventId, invite); _maxInviteId = Math.Max(_maxInviteId, inviteId); @@ -148,9 +148,9 @@ namespace Game SendCalendarEventRemovedAlert(calendarEvent); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt; - MailDraft mail = new MailDraft(calendarEvent.BuildCalendarMailSubject(remover), calendarEvent.BuildCalendarMailBody()); + MailDraft mail = new(calendarEvent.BuildCalendarMailSubject(remover), calendarEvent.BuildCalendarMailBody()); var eventInvites = _invites[eventId]; for (int i = 0; i < eventInvites.Count; ++i) @@ -196,7 +196,7 @@ namespace Game if (calendarInvite == null) return; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CALENDAR_INVITE); stmt.AddValue(0, calendarInvite.InviteId); trans.Append(stmt); @@ -217,7 +217,7 @@ namespace Game public void UpdateEvent(CalendarEvent calendarEvent) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_CALENDAR_EVENT); stmt.AddValue(0, calendarEvent.EventId); stmt.AddValue(1, calendarEvent.OwnerGuid.GetCounter()); @@ -331,7 +331,7 @@ namespace Game public List GetPlayerEvents(ObjectGuid guid) { - List events = new List(); + List events = new(); foreach (var pair in _invites) { @@ -360,7 +360,7 @@ namespace Game public List GetPlayerInvites(ObjectGuid guid) { - List invites = new List(); + List invites = new(); foreach (var calendarEvent in _invites.Values) { @@ -402,7 +402,7 @@ namespace Game uint level = player ? player.GetLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(invitee); - CalendarInviteAdded packet = new CalendarInviteAdded(); + CalendarInviteAdded packet = new(); packet.EventID = calendarEvent != null ? calendarEvent.EventId : 0; packet.InviteGuid = invitee; packet.InviteID = calendarEvent != null ? invite.InviteId : 0; @@ -427,7 +427,7 @@ namespace Game public void SendCalendarEventUpdateAlert(CalendarEvent calendarEvent, long originalDate) { - CalendarEventUpdatedAlert packet = new CalendarEventUpdatedAlert(); + CalendarEventUpdatedAlert packet = new(); packet.ClearPending = true; // FIXME packet.Date = calendarEvent.Date; packet.Description = calendarEvent.Description; @@ -444,7 +444,7 @@ namespace Game public void SendCalendarEventStatus(CalendarEvent calendarEvent, CalendarInvite invite) { - CalendarInviteStatusPacket packet = new CalendarInviteStatusPacket(); + CalendarInviteStatusPacket packet = new(); packet.ClearPending = true; // FIXME packet.Date = calendarEvent.Date; packet.EventID = calendarEvent.EventId; @@ -458,7 +458,7 @@ namespace Game void SendCalendarEventRemovedAlert(CalendarEvent calendarEvent) { - CalendarEventRemovedAlert packet = new CalendarEventRemovedAlert(); + CalendarEventRemovedAlert packet = new(); packet.ClearPending = true; // FIXME packet.Date = calendarEvent.Date; packet.EventID = calendarEvent.EventId; @@ -468,7 +468,7 @@ namespace Game void SendCalendarEventInviteRemove(CalendarEvent calendarEvent, CalendarInvite invite, uint flags) { - CalendarInviteRemoved packet = new CalendarInviteRemoved(); + CalendarInviteRemoved packet = new(); packet.ClearPending = true; // FIXME packet.EventID = calendarEvent.EventId; packet.Flags = flags; @@ -479,7 +479,7 @@ namespace Game public void SendCalendarEventModeratorStatusAlert(CalendarEvent calendarEvent, CalendarInvite invite) { - CalendarModeratorStatus packet = new CalendarModeratorStatus(); + CalendarModeratorStatus packet = new(); packet.ClearPending = true; // FIXME packet.EventID = calendarEvent.EventId; packet.InviteGuid = invite.InviteeGuid; @@ -490,7 +490,7 @@ namespace Game void SendCalendarEventInviteAlert(CalendarEvent calendarEvent, CalendarInvite invite) { - CalendarInviteAlert packet = new CalendarInviteAlert(); + CalendarInviteAlert packet = new(); packet.Date = calendarEvent.Date; packet.EventID = calendarEvent.EventId; packet.EventName = calendarEvent.Title; @@ -528,7 +528,7 @@ namespace Game List eventInviteeList = _invites[calendarEvent.EventId]; - CalendarSendEvent packet = new CalendarSendEvent(); + CalendarSendEvent packet = new(); packet.Date = calendarEvent.Date; packet.Description = calendarEvent.Description; packet.EventID = calendarEvent.EventId; @@ -551,7 +551,7 @@ namespace Game uint inviteeLevel = invitee ? invitee.GetLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(inviteeGuid); ulong inviteeGuildId = invitee ? invitee.GetGuildId() : Global.CharacterCacheStorage.GetCharacterGuildIdByGuid(inviteeGuid); - CalendarEventInviteInfo inviteInfo = new CalendarEventInviteInfo(); + CalendarEventInviteInfo inviteInfo = new(); inviteInfo.Guid = inviteeGuid; inviteInfo.Level = (byte)inviteeLevel; inviteInfo.Status = calendarInvite.Status; @@ -572,7 +572,7 @@ namespace Game Player player = Global.ObjAccessor.FindPlayer(guid); if (player) { - CalendarInviteRemovedAlert packet = new CalendarInviteRemovedAlert(); + CalendarInviteRemovedAlert packet = new(); packet.Date = calendarEvent.Date; packet.EventID = calendarEvent.EventId; packet.Flags = calendarEvent.Flags; @@ -594,7 +594,7 @@ namespace Game Player player = Global.ObjAccessor.FindPlayer(guid); if (player) { - CalendarCommandResult packet = new CalendarCommandResult(); + CalendarCommandResult packet = new(); packet.Command = 1; // FIXME packet.Result = err; @@ -635,8 +635,8 @@ namespace Game List _events; MultiMap _invites; - List _freeEventIds = new List(); - List _freeInviteIds = new List(); + List _freeEventIds = new(); + List _freeInviteIds = new(); ulong _maxEventId; ulong _maxInviteId; } diff --git a/Source/Game/Chat/Channels/Channel.cs b/Source/Game/Chat/Channels/Channel.cs index 7651dd05b..65a6a5d89 100644 --- a/Source/Game/Chat/Channels/Channel.cs +++ b/Source/Game/Chat/Channels/Channel.cs @@ -81,7 +81,7 @@ namespace Game.Chat var tokens = new StringArray(bannedList, ' '); for (var i = 0; i < tokens.Length; ++i) { - ObjectGuid bannedGuid = new ObjectGuid(); + ObjectGuid bannedGuid = new(); if (ulong.TryParse(tokens[i].Substring(0, 16), out ulong highguid) && ulong.TryParse(tokens[i].Substring(16), out ulong lowguid)) bannedGuid.SetRawValue(highguid, lowguid); @@ -219,7 +219,7 @@ namespace Game.Chat bool newChannel = _playersStore.Empty(); - PlayerInfo playerInfo = new PlayerInfo(); + PlayerInfo playerInfo = new(); playerInfo.SetInvisible(!player.IsGMVisible()); _playersStore[guid] = playerInfo; @@ -328,7 +328,7 @@ namespace Game.Chat if (!IsOn(good)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotMemberAppend()); + ChannelNameBuilder builder = new(this, new NotMemberAppend()); SendToOne(builder, good); return; } @@ -336,7 +336,7 @@ namespace Game.Chat PlayerInfo info = _playersStore.LookupByKey(good); if (!info.IsModerator() && !player.GetSession().HasPermission(RBACPermissions.ChangeChannelNotModerator)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotModeratorAppend()); + ChannelNameBuilder builder = new(this, new NotModeratorAppend()); SendToOne(builder, good); return; } @@ -345,7 +345,7 @@ namespace Game.Chat ObjectGuid victim = bad ? bad.GetGUID() : ObjectGuid.Empty; if (victim.IsEmpty() || !IsOn(victim)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new PlayerNotFoundAppend(badname)); + ChannelNameBuilder builder = new(this, new PlayerNotFoundAppend(badname)); SendToOne(builder, good); return; } @@ -354,7 +354,7 @@ namespace Game.Chat if (!player.GetSession().HasPermission(RBACPermissions.ChangeChannelNotModerator) && changeowner && good != _ownerGuid) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotOwnerAppend()); + ChannelNameBuilder builder = new(this, new NotOwnerAppend()); SendToOne(builder, good); return; } @@ -366,14 +366,14 @@ namespace Game.Chat if (!player.GetSession().HasPermission(RBACPermissions.SilentlyJoinChannel)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new PlayerBannedAppend(good, victim)); + ChannelNameBuilder builder = new(this, new PlayerBannedAppend(good, victim)); SendToAll(builder); } } else if (!player.GetSession().HasPermission(RBACPermissions.SilentlyJoinChannel)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new PlayerKickedAppend(good, victim)); + ChannelNameBuilder builder = new(this, new PlayerKickedAppend(good, victim)); SendToAll(builder); } @@ -393,7 +393,7 @@ namespace Game.Chat if (!IsOn(good)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotMemberAppend()); + ChannelNameBuilder builder = new(this, new NotMemberAppend()); SendToOne(builder, good); return; } @@ -401,7 +401,7 @@ namespace Game.Chat PlayerInfo info = _playersStore.LookupByKey(good); if (!info.IsModerator() && !player.GetSession().HasPermission(RBACPermissions.ChangeChannelNotModerator)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotModeratorAppend()); + ChannelNameBuilder builder = new(this, new NotModeratorAppend()); SendToOne(builder, good); return; } @@ -411,14 +411,14 @@ namespace Game.Chat if (victim.IsEmpty() || !IsBanned(victim)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new PlayerNotFoundAppend(badname)); + ChannelNameBuilder builder = new(this, new PlayerNotFoundAppend(badname)); SendToOne(builder, good); return; } _bannedStore.Remove(victim); - ChannelNameBuilder builder1 = new ChannelNameBuilder(this, new PlayerUnbannedAppend(good, victim)); + ChannelNameBuilder builder1 = new(this, new PlayerUnbannedAppend(good, victim)); SendToAll(builder1); UpdateChannelInDB(); @@ -430,7 +430,7 @@ namespace Game.Chat if (!IsOn(guid)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotMemberAppend()); + ChannelNameBuilder builder = new(this, new NotMemberAppend()); SendToOne(builder, guid); return; } @@ -438,14 +438,14 @@ namespace Game.Chat PlayerInfo info = _playersStore.LookupByKey(guid); if (!info.IsModerator() && !player.GetSession().HasPermission(RBACPermissions.ChangeChannelNotModerator)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotModeratorAppend()); + ChannelNameBuilder builder = new(this, new NotModeratorAppend()); SendToOne(builder, guid); return; } _channelPassword = pass; - ChannelNameBuilder builder1 = new ChannelNameBuilder(this, new PasswordChangedAppend(guid)); + ChannelNameBuilder builder1 = new(this, new PasswordChangedAppend(guid)); SendToAll(builder1); UpdateChannelInDB(); @@ -457,7 +457,7 @@ namespace Game.Chat if (!IsOn(guid)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotMemberAppend()); + ChannelNameBuilder builder = new(this, new NotMemberAppend()); SendToOne(builder, guid); return; } @@ -465,7 +465,7 @@ namespace Game.Chat PlayerInfo info = _playersStore.LookupByKey(guid); if (!info.IsModerator() && !player.GetSession().HasPermission(RBACPermissions.ChangeChannelNotModerator)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotModeratorAppend()); + ChannelNameBuilder builder = new(this, new NotModeratorAppend()); SendToOne(builder, guid); return; } @@ -481,14 +481,14 @@ namespace Game.Chat (!player.GetSession().HasPermission(RBACPermissions.TwoSideInteractionChannel) || !newp.GetSession().HasPermission(RBACPermissions.TwoSideInteractionChannel)))) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new PlayerNotFoundAppend(p2n)); + ChannelNameBuilder builder = new(this, new PlayerNotFoundAppend(p2n)); SendToOne(builder, guid); return; } if (_ownerGuid == victim && _ownerGuid != guid) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotOwnerAppend()); + ChannelNameBuilder builder = new(this, new NotOwnerAppend()); SendToOne(builder, guid); return; } @@ -518,13 +518,13 @@ namespace Game.Chat if (!IsOn(guid)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotMemberAppend()); + ChannelNameBuilder builder = new(this, new NotMemberAppend()); SendToOne(builder, guid); return; } if (!player.GetSession().HasPermission(RBACPermissions.ChangeChannelNotModerator) && guid != _ownerGuid) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotOwnerAppend()); + ChannelNameBuilder builder = new(this, new NotOwnerAppend()); SendToOne(builder, guid); return; } @@ -537,7 +537,7 @@ namespace Game.Chat (!player.GetSession().HasPermission(RBACPermissions.TwoSideInteractionChannel) || !newp.GetSession().HasPermission(RBACPermissions.TwoSideInteractionChannel)))) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new PlayerNotFoundAppend(newname)); + ChannelNameBuilder builder = new(this, new PlayerNotFoundAppend(newname)); SendToOne(builder, guid); return; } @@ -551,12 +551,12 @@ namespace Game.Chat ObjectGuid guid = player.GetGUID(); if (IsOn(guid)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new ChannelOwnerAppend(this, _ownerGuid)); + ChannelNameBuilder builder = new(this, new ChannelOwnerAppend(this, _ownerGuid)); SendToOne(builder, guid); } else { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotMemberAppend()); + ChannelNameBuilder builder = new(this, new NotMemberAppend()); SendToOne(builder, guid); } } @@ -567,7 +567,7 @@ namespace Game.Chat if (!IsOn(guid)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotMemberAppend()); + ChannelNameBuilder builder = new(this, new NotMemberAppend()); SendToOne(builder, guid); return; } @@ -575,7 +575,7 @@ namespace Game.Chat string channelName = GetName(player.GetSession().GetSessionDbcLocale()); Log.outDebug(LogFilter.ChatSystem, "SMSG_CHANNEL_LIST {0} Channel: {1}", player.GetSession().GetPlayerInfo(), channelName); - ChannelListResponse list = new ChannelListResponse(); + ChannelListResponse list = new(); list.Display = true; // always true? list.Channel = channelName; list.ChannelFlags = GetFlags(); @@ -605,7 +605,7 @@ namespace Game.Chat if (!IsOn(guid)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotMemberAppend()); + ChannelNameBuilder builder = new(this, new NotMemberAppend()); SendToOne(builder, guid); return; } @@ -613,7 +613,7 @@ namespace Game.Chat PlayerInfo playerInfo = _playersStore.LookupByKey(guid); if (!playerInfo.IsModerator() && !player.GetSession().HasPermission(RBACPermissions.ChangeChannelNotModerator)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotModeratorAppend()); + ChannelNameBuilder builder = new(this, new NotModeratorAppend()); SendToOne(builder, guid); return; } @@ -622,12 +622,12 @@ namespace Game.Chat if (_announceEnabled) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new AnnouncementsOnAppend(guid)); + ChannelNameBuilder builder = new(this, new AnnouncementsOnAppend(guid)); SendToAll(builder); } else { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new AnnouncementsOffAppend(guid)); + ChannelNameBuilder builder = new(this, new AnnouncementsOffAppend(guid)); SendToAll(builder); } @@ -645,7 +645,7 @@ namespace Game.Chat if (!IsOn(guid)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotMemberAppend()); + ChannelNameBuilder builder = new(this, new NotMemberAppend()); SendToOne(builder, guid); return; } @@ -653,7 +653,7 @@ namespace Game.Chat PlayerInfo playerInfo = _playersStore.LookupByKey(guid); if (playerInfo.IsMuted()) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new MutedAppend()); + ChannelNameBuilder builder = new(this, new MutedAppend()); SendToOne(builder, guid); return; } @@ -669,7 +669,7 @@ namespace Game.Chat if (!IsOn(guid)) { NotMemberAppend appender; - ChannelNameBuilder builder = new ChannelNameBuilder(this, appender); + ChannelNameBuilder builder = new(this, appender); SendToOne(builder, guid); return; } @@ -678,7 +678,7 @@ namespace Game.Chat if (playerInfo.IsMuted()) { MutedAppend appender; - ChannelNameBuilder builder = new ChannelNameBuilder(this, appender); + ChannelNameBuilder builder = new(this, appender); SendToOne(builder, guid); return; } @@ -692,7 +692,7 @@ namespace Game.Chat if (!IsOn(guid)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new NotMemberAppend()); + ChannelNameBuilder builder = new(this, new NotMemberAppend()); SendToOne(builder, guid); return; } @@ -700,14 +700,14 @@ namespace Game.Chat Player newp = Global.ObjAccessor.FindPlayerByName(newname); if (!newp || !newp.IsGMVisible()) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new PlayerNotFoundAppend(newname)); + ChannelNameBuilder builder = new(this, new PlayerNotFoundAppend(newname)); SendToOne(builder, guid); return; } if (IsBanned(newp.GetGUID())) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new PlayerInviteBannedAppend(newname)); + ChannelNameBuilder builder = new(this, new PlayerInviteBannedAppend(newname)); SendToOne(builder, guid); return; } @@ -716,25 +716,25 @@ namespace Game.Chat (!player.GetSession().HasPermission(RBACPermissions.TwoSideInteractionChannel) || !newp.GetSession().HasPermission(RBACPermissions.TwoSideInteractionChannel))) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new InviteWrongFactionAppend()); + ChannelNameBuilder builder = new(this, new InviteWrongFactionAppend()); SendToOne(builder, guid); return; } if (IsOn(newp.GetGUID())) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new PlayerAlreadyMemberAppend(newp.GetGUID())); + ChannelNameBuilder builder = new(this, new PlayerAlreadyMemberAppend(newp.GetGUID())); SendToOne(builder, guid); return; } if (!newp.GetSocial().HasIgnore(guid)) { - ChannelNameBuilder builder = new ChannelNameBuilder(this, new InviteAppend(guid)); + ChannelNameBuilder builder = new(this, new InviteAppend(guid)); SendToOne(builder, newp.GetGUID()); } - ChannelNameBuilder builder1 = new ChannelNameBuilder(this, new PlayerInvitedAppend(newp.GetName())); + ChannelNameBuilder builder1 = new(this, new PlayerInvitedAppend(newp.GetName())); SendToOne(builder1, guid); } @@ -759,12 +759,12 @@ namespace Game.Chat playerInfo.SetModerator(true); playerInfo.SetOwner(true); - ChannelNameBuilder builder = new ChannelNameBuilder(this, new ModeChangeAppend(_ownerGuid, oldFlag, GetPlayerFlags(_ownerGuid))); + ChannelNameBuilder builder = new(this, new ModeChangeAppend(_ownerGuid, oldFlag, GetPlayerFlags(_ownerGuid))); SendToAll(builder); if (exclaim) { - ChannelNameBuilder ownerChangedBuilder = new ChannelNameBuilder(this, new OwnerChangedAppend(_ownerGuid)); + ChannelNameBuilder ownerChangedBuilder = new(this, new OwnerChangedAppend(_ownerGuid)); SendToAll(ownerChangedBuilder); } @@ -811,7 +811,7 @@ namespace Game.Chat ChannelMemberFlags oldFlag = _playersStore[guid].GetFlags(); playerInfo.SetModerator(set); - ChannelNameBuilder builder = new ChannelNameBuilder(this, new ModeChangeAppend(guid, oldFlag, playerInfo.GetFlags())); + ChannelNameBuilder builder = new(this, new ModeChangeAppend(guid, oldFlag, playerInfo.GetFlags())); SendToAll(builder); } } @@ -827,14 +827,14 @@ namespace Game.Chat ChannelMemberFlags oldFlag = _playersStore[guid].GetFlags(); playerInfo.SetMuted(set); - ChannelNameBuilder builder = new ChannelNameBuilder(this, new ModeChangeAppend(guid, oldFlag, playerInfo.GetFlags())); + ChannelNameBuilder builder = new(this, new ModeChangeAppend(guid, oldFlag, playerInfo.GetFlags())); SendToAll(builder); } } void SendToAll(MessageBuilder builder, ObjectGuid guid = default) { - LocalizedPacketDo localizer = new LocalizedPacketDo(builder); + LocalizedPacketDo localizer = new(builder); foreach (var pair in _playersStore) { @@ -847,7 +847,7 @@ namespace Game.Chat void SendToAllButOne(MessageBuilder builder, ObjectGuid who) { - LocalizedPacketDo localizer = new LocalizedPacketDo(builder); + LocalizedPacketDo localizer = new(builder); foreach (var pair in _playersStore) { @@ -862,7 +862,7 @@ namespace Game.Chat void SendToOne(MessageBuilder builder, ObjectGuid who) { - LocalizedPacketDo localizer = new LocalizedPacketDo(builder); + LocalizedPacketDo localizer = new(builder); Player player = Global.ObjAccessor.FindConnectedPlayer(who); if (player) @@ -871,7 +871,7 @@ namespace Game.Chat void SendToAllWithAddon(MessageBuilder builder, string addonPrefix, ObjectGuid guid = default) { - LocalizedPacketDo localizer = new LocalizedPacketDo(builder); + LocalizedPacketDo localizer = new(builder); foreach (var pair in _playersStore) { @@ -931,8 +931,8 @@ namespace Game.Chat ObjectGuid _ownerGuid; string _channelName; string _channelPassword; - Dictionary _playersStore = new Dictionary(); - List _bannedStore = new List(); + Dictionary _playersStore = new(); + List _bannedStore = new(); AreaTableRecord _zoneEntry; diff --git a/Source/Game/Chat/Channels/ChannelAppenders.cs b/Source/Game/Chat/Channels/ChannelAppenders.cs index ece5f1fb4..818ce04cc 100644 --- a/Source/Game/Chat/Channels/ChannelAppenders.cs +++ b/Source/Game/Chat/Channels/ChannelAppenders.cs @@ -43,7 +43,7 @@ namespace Game.Chat // LocalizedPacketDo sends client DBC locale, we need to get available to server locale Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); - ChannelNotify data = new ChannelNotify(); + ChannelNotify data = new(); data.Type = _modifier.GetNotificationType(); data.Channel = _source.GetName(localeIdx); _modifier.Append(data); @@ -65,7 +65,7 @@ namespace Game.Chat { Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); - ChannelNotifyJoined notify = new ChannelNotifyJoined(); + ChannelNotifyJoined notify = new(); //notify.ChannelWelcomeMsg = ""; notify.ChatChannelID = (int)_source.GetChannelId(); //notify.InstanceID = 0; @@ -90,7 +90,7 @@ namespace Game.Chat { Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); - ChannelNotifyLeft notify = new ChannelNotifyLeft(); + ChannelNotifyLeft notify = new(); notify.Channel = _source.GetName(localeIdx); notify.ChatChannelID = _source.GetChannelId(); notify.Suspended = _suspended; @@ -115,7 +115,7 @@ namespace Game.Chat { Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); - ChatPkt packet = new ChatPkt(); + ChatPkt packet = new(); Player player = Global.ObjAccessor.FindConnectedPlayer(_guid); if (player) packet.Initialize(ChatMsg.Channel, _lang, player, player, _what, 0, _source.GetName(localeIdx)); @@ -150,7 +150,7 @@ namespace Game.Chat { Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); - ChatPkt packet = new ChatPkt(); + ChatPkt packet = new(); Player player = Global.ObjAccessor.FindConnectedPlayer(_guid); if (player) packet.Initialize(ChatMsg.Channel, _lang, player, player, _what, 0, _source.GetName(localeIdx), Locale.enUS, _prefix); @@ -183,7 +183,7 @@ namespace Game.Chat { Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); - UserlistAdd userlistAdd = new UserlistAdd(); + UserlistAdd userlistAdd = new(); userlistAdd.AddedUserGUID = _guid; userlistAdd.ChannelFlags = _source.GetFlags(); userlistAdd.UserFlags = _source.GetPlayerFlags(_guid); @@ -208,7 +208,7 @@ namespace Game.Chat { Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); - UserlistUpdate userlistUpdate = new UserlistUpdate(); + UserlistUpdate userlistUpdate = new(); userlistUpdate.UpdatedUserGUID = _guid; userlistUpdate.ChannelFlags = _source.GetFlags(); userlistUpdate.UserFlags = _source.GetPlayerFlags(_guid); @@ -233,7 +233,7 @@ namespace Game.Chat { Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); - UserlistRemove userlistRemove = new UserlistRemove(); + UserlistRemove userlistRemove = new(); userlistRemove.RemovedUserGUID = _guid; userlistRemove.ChannelFlags = _source.GetFlags(); userlistRemove.ChannelID = _source.GetChannelId(); diff --git a/Source/Game/Chat/Channels/ChannelManager.cs b/Source/Game/Chat/Channels/ChannelManager.cs index 58f550b82..72b2787d1 100644 --- a/Source/Game/Chat/Channels/ChannelManager.cs +++ b/Source/Game/Chat/Channels/ChannelManager.cs @@ -67,7 +67,7 @@ namespace Game.Chat if (channel != null) return channel; - Channel newChannel = new Channel(channelGuid, channelId, _team, zoneEntry); + Channel newChannel = new(channelGuid, channelId, _team, zoneEntry); _channels[channelGuid] = newChannel; return newChannel; } @@ -77,7 +77,7 @@ namespace Game.Chat if (channel != null) return channel; - Channel newChannel = new Channel(CreateCustomChannelGuid(), name, _team); + Channel newChannel = new(CreateCustomChannelGuid(), name, _team); _customChannels[name.ToLower()] = newChannel; return newChannel; } @@ -135,7 +135,7 @@ namespace Game.Chat public static void SendNotOnChannelNotify(Player player, string name) { - ChannelNotify notify = new ChannelNotify(); + ChannelNotify notify = new(); notify.Type = ChatNotify.NotMemberNotice; notify.Channel = name; player.SendPacket(notify); @@ -148,7 +148,7 @@ namespace Game.Chat high |= (ulong)Global.WorldMgr.GetRealmId().Index << 42; high |= (ulong)(_team == Team.Alliance ? 3 : 5) << 4; - ObjectGuid channelGuid = new ObjectGuid(); + ObjectGuid channelGuid = new(); channelGuid.SetRawValue(high, _guidGenerator.Generate()); return channelGuid; } @@ -171,17 +171,17 @@ namespace Game.Chat high |= (ulong)(zoneId) << 10; high |= (ulong)(_team == Team.Alliance ? 3 : 5) << 4; - ObjectGuid channelGuid = new ObjectGuid(); + ObjectGuid channelGuid = new(); channelGuid.SetRawValue(high, channelId); return channelGuid; } - Dictionary _customChannels = new Dictionary(); - Dictionary _channels = new Dictionary(); + Dictionary _customChannels = new(); + Dictionary _channels = new(); Team _team; ObjectGuidGenerator _guidGenerator; - static ChannelManager allianceChannelMgr = new ChannelManager(Team.Alliance); - static ChannelManager hordeChannelMgr = new ChannelManager(Team.Horde); + static ChannelManager allianceChannelMgr = new(Team.Alliance); + static ChannelManager hordeChannelMgr = new(Team.Horde); } } diff --git a/Source/Game/Chat/CommandHandler.cs b/Source/Game/Chat/CommandHandler.cs index 547a000c8..93b526952 100644 --- a/Source/Game/Chat/CommandHandler.cs +++ b/Source/Game/Chat/CommandHandler.cs @@ -73,7 +73,7 @@ namespace Game.Chat public bool ExecuteCommandInTable(ICollection table, string text, string fullcmd) { - StringArguments args = new StringArguments(text); + StringArguments args = new(text); string cmd = args.NextString(); foreach (var command in table) @@ -170,7 +170,7 @@ namespace Game.Chat public bool ShowHelpForCommand(ICollection table, string text) { - StringArguments args = new StringArguments(text); + StringArguments args = new(text); if (!args.Empty()) { string cmd = args.NextString(); @@ -626,8 +626,8 @@ namespace Game.Chat return null; Player pl = _session.GetPlayer(); - NearestGameObjectCheck check = new NearestGameObjectCheck(pl); - GameObjectLastSearcher searcher = new GameObjectLastSearcher(pl, check); + NearestGameObjectCheck check = new(pl); + GameObjectLastSearcher searcher = new(pl, check); Cell.VisitGridObjects(pl, searcher, MapConst.SizeofGrids); return searcher.GetTarget(); } @@ -764,7 +764,7 @@ namespace Game.Chat if (escapeCharacters) str.Replace("|", "||"); - ChatPkt messageChat = new ChatPkt(); + ChatPkt messageChat = new(); var lines = new StringArray(str, "\n", "\r"); for (var i = 0; i < lines.Length; ++i) @@ -782,7 +782,7 @@ namespace Game.Chat public void SendGlobalSysMessage(string str) { // Chat output - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(ChatMsg.System, Language.Universal, null, null, str); Global.WorldMgr.SendGlobalMessage(data); } @@ -790,7 +790,7 @@ namespace Game.Chat public void SendGlobalGMSysMessage(string str) { // Chat output - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(ChatMsg.System, Language.Universal, null, null, str); Global.WorldMgr.SendGlobalGMMessage(data); } @@ -893,7 +893,7 @@ namespace Game.Chat void Send(string msg) { - ChatPkt chat = new ChatPkt(); + ChatPkt chat = new(); chat.Initialize(ChatMsg.Whisper, Language.Addon, GetSession().GetPlayer(), GetSession().GetPlayer(), msg, 0, "", Locale.enUS, PREFIX); GetSession().SendPacket(chat); } @@ -919,7 +919,7 @@ namespace Game.Chat if (!hadAck) SendAck(); - StringBuilder msg = new StringBuilder("m"); + StringBuilder msg = new("m"); msg.Append(echo, 0, 4); string body = str; if (escapeCharacters) diff --git a/Source/Game/Chat/CommandManager.cs b/Source/Game/Chat/CommandManager.cs index fe1840c7a..9cff368b7 100644 --- a/Source/Game/Chat/CommandManager.cs +++ b/Source/Game/Chat/CommandManager.cs @@ -71,7 +71,7 @@ namespace Game.Chat static bool SetDataForCommandInTable(ICollection table, string text, uint permission, string help, string fullcommand) { - StringArguments args = new StringArguments(text); + StringArguments args = new(text); string cmd = args.NextString().ToLower(); foreach (var command in table) @@ -140,7 +140,7 @@ namespace Game.Chat return _commands.Values; } - static SortedDictionary _commands = new SortedDictionary(); + static SortedDictionary _commands = new(); } public delegate bool HandleCommandDelegate(StringArguments args, CommandHandler handler); @@ -192,6 +192,6 @@ namespace Game.Chat public bool AllowConsole; public HandleCommandDelegate Handler; public string Help; - public List ChildCommands = new List(); + public List ChildCommands = new(); } } diff --git a/Source/Game/Chat/Commands/ArenaCommands.cs b/Source/Game/Chat/Commands/ArenaCommands.cs index 193de2173..0de091958 100644 --- a/Source/Game/Chat/Commands/ArenaCommands.cs +++ b/Source/Game/Chat/Commands/ArenaCommands.cs @@ -57,7 +57,7 @@ namespace Game.Chat return false; } - ArenaTeam arena = new ArenaTeam(); + ArenaTeam arena = new(); if (!arena.Create(target.GetGUID(), type, name, 4293102085, 101, 4293253939, 4, 4284049911)) { diff --git a/Source/Game/Chat/Commands/CharacterCommands.cs b/Source/Game/Chat/Commands/CharacterCommands.cs index 73c6c131c..471767ab4 100644 --- a/Source/Game/Chat/Commands/CharacterCommands.cs +++ b/Source/Game/Chat/Commands/CharacterCommands.cs @@ -415,7 +415,7 @@ namespace Game.Chat string factionName = factionEntry != null ? factionEntry.Name[loc] : "#Not found#"; ReputationRank rank = target.GetReputationMgr().GetRank(factionEntry); string rankName = handler.GetCypherString(ReputationMgr.ReputationRankStrIndex[(int)rank]); - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); if (handler.GetSession() != null) ss.AppendFormat("{0} - |cffffffff|Hfaction:{0}|h[{1} {2}]|h|r", faction.Id, factionName, loc); else @@ -495,7 +495,7 @@ namespace Game.Chat if (args.Empty()) return false; - List foundList = new List(); + List foundList = new(); if (!GetDeletedCharacterInfoList(foundList, args.NextString())) return false; @@ -518,7 +518,7 @@ namespace Game.Chat [Command("list", RBACPermissions.CommandCharacterDeletedList, true)] static bool HandleCharacterDeletedListCommand(StringArguments args, CommandHandler handler) { - List foundList = new List(); + List foundList = new(); if (!GetDeletedCharacterInfoList(foundList, args.NextString())) return false; @@ -545,7 +545,7 @@ namespace Game.Chat string newCharName = args.NextString(); uint newAccount = args.NextUInt32(); - List foundList = new List(); + List foundList = new(); if (!GetDeletedCharacterInfoList(foundList, searchString)) return false; diff --git a/Source/Game/Chat/Commands/DebugCommands.cs b/Source/Game/Chat/Commands/DebugCommands.cs index 0c5cc86ae..1987a6e61 100644 --- a/Source/Game/Chat/Commands/DebugCommands.cs +++ b/Source/Game/Chat/Commands/DebugCommands.cs @@ -542,7 +542,7 @@ namespace Game.Chat target.DestroyForNearbyPlayers(); // Force new SMSG_UPDATE_OBJECT:CreateObject else { - MoveUpdate moveUpdate = new MoveUpdate(); + MoveUpdate moveUpdate = new(); moveUpdate.Status = target.m_movementInfo; target.SendMessageToSet(moveUpdate, true); } @@ -775,7 +775,7 @@ namespace Game.Chat return false; Map map = handler.GetSession().GetPlayer().GetMap(); - Position pos = new Position(x, y, z, o); + Position pos = new(x, y, z, o); Creature creature = Creature.CreateCreature(entry, map, pos, id); if (!creature) @@ -1075,7 +1075,7 @@ namespace Game.Chat string name = "test"; byte code = args.NextByte(); - ChannelNotify packet = new ChannelNotify(); + ChannelNotify packet = new(); packet.Type = (ChatNotify)code; packet.Channel = name; handler.GetSession().SendPacket(packet); @@ -1090,7 +1090,7 @@ namespace Game.Chat string msg = "testtest"; byte type = args.NextByte(); - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize((ChatMsg)type, Language.Universal, handler.GetSession().GetPlayer(), handler.GetSession().GetPlayer(), msg, 0, "chan"); handler.GetSession().SendPacket(data); return true; @@ -1111,7 +1111,7 @@ namespace Game.Chat static bool HandleDebugSendLargePacketCommand(StringArguments args, CommandHandler handler) { const string stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. "; - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); while (ss.Length < 128000) ss.Append(stuffingString); handler.SendSysMessage(ss.ToString()); @@ -1171,7 +1171,7 @@ namespace Game.Chat if (args.Empty()) return false; - PhaseShift phaseShift = new PhaseShift(); + PhaseShift phaseShift = new(); if (uint.TryParse(args.NextString(), out uint terrain)) phaseShift.AddVisibleMapId(terrain, null); @@ -1198,7 +1198,7 @@ namespace Game.Chat int failArg1 = args.NextInt32(); int failArg2 = args.NextInt32(); - CastFailed castFailed = new CastFailed(); + CastFailed castFailed = new(); castFailed.CastID = ObjectGuid.Empty; castFailed.SpellID = 133; castFailed.Reason = (SpellCastResult)failNum; diff --git a/Source/Game/Chat/Commands/GameObjectCommands.cs b/Source/Game/Chat/Commands/GameObjectCommands.cs index d9a7c238a..3c18780c8 100644 --- a/Source/Game/Chat/Commands/GameObjectCommands.cs +++ b/Source/Game/Chat/Commands/GameObjectCommands.cs @@ -366,7 +366,7 @@ namespace Game.Chat Player player = handler.GetSession().GetPlayer(); - List creatureList = new List(); + List creatureList = new(); if (!player.GetMap().SpawnGroupSpawn(groupId, ignoreRespawn, force, creatureList)) { handler.SendSysMessage(CypherStrings.SpawngroupBadgroup, groupId); @@ -407,7 +407,7 @@ namespace Game.Chat } else { - StringBuilder eventFilter = new StringBuilder(); + StringBuilder eventFilter = new(); eventFilter.Append(" AND (eventEntry IS NULL "); bool initString = true; diff --git a/Source/Game/Chat/Commands/GuildCommands.cs b/Source/Game/Chat/Commands/GuildCommands.cs index 885ed3100..f057bf9bc 100644 --- a/Source/Game/Chat/Commands/GuildCommands.cs +++ b/Source/Game/Chat/Commands/GuildCommands.cs @@ -45,7 +45,7 @@ namespace Game.Chat return true; } - Guild guild = new Guild(); + Guild guild = new(); if (!guild.Create(target, guildname)) { handler.SendSysMessage(CypherStrings.GuildNotCreated); diff --git a/Source/Game/Chat/Commands/ListCommands.cs b/Source/Game/Chat/Commands/ListCommands.cs index 885260a80..37b7403cb 100644 --- a/Source/Game/Chat/Commands/ListCommands.cs +++ b/Source/Game/Chat/Commands/ListCommands.cs @@ -577,7 +577,7 @@ namespace Game.Chat.Commands if (!args.Empty()) range = args.NextUInt32(); - List respawns = new List(); + List respawns = new(); Locale locale = handler.GetSession().GetSessionDbcLocale(); string stringOverdue = Global.ObjectMgr.GetCypherString(CypherStrings.ListRespawnsOverdue, locale); string stringCreature = Global.ObjectMgr.GetCypherString(CypherStrings.ListRespawnsCreatures, locale); diff --git a/Source/Game/Chat/Commands/LookupCommands.cs b/Source/Game/Chat/Commands/LookupCommands.cs index f6b0d4156..59e9c420f 100644 --- a/Source/Game/Chat/Commands/LookupCommands.cs +++ b/Source/Game/Chat/Commands/LookupCommands.cs @@ -267,7 +267,7 @@ namespace Game.Chat // send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format // or "id - [faction] [no reputation]" format - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); if (handler.GetSession() != null) ss.AppendFormat("{0} - |cffffffff|Hfaction:{0}|h[{1}]|h|r", factionEntry.Id, name); else @@ -772,7 +772,7 @@ namespace Game.Chat string namePart = args.NextString().ToLower(); - StringBuilder reply = new StringBuilder(); + StringBuilder reply = new(); uint count = 0; bool limitReached = false; @@ -924,7 +924,7 @@ namespace Game.Chat return true; } - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); ss.Append(mapInfo.Id + " - [" + name + ']'); if (mapInfo.IsContinent()) @@ -1141,7 +1141,7 @@ namespace Game.Chat uint rank = learn && learnSpellInfo != null ? learnSpellInfo.GetRank() : spellInfo.GetRank(); // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); if (handler.GetSession() != null) ss.Append(spellInfo.Id + " - |cffffffff|Hspell:" + spellInfo.Id + "|h[" + name); else @@ -1215,7 +1215,7 @@ namespace Game.Chat uint rank = learn && learnSpellInfo != null ? learnSpellInfo.GetRank() : spellInfo.GetRank(); // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); if (handler.GetSession() != null) ss.Append(id + " - |cffffffff|Hspell:" + id + "|h[" + name); else diff --git a/Source/Game/Chat/Commands/MMapsCommands.cs b/Source/Game/Chat/Commands/MMapsCommands.cs index a6e10dac0..295f82ef0 100644 --- a/Source/Game/Chat/Commands/MMapsCommands.cs +++ b/Source/Game/Chat/Commands/MMapsCommands.cs @@ -62,7 +62,7 @@ namespace Game.Chat player.GetPosition(out x, out y, out z); // path - PathGenerator path = new PathGenerator(target); + PathGenerator path = new(target); path.SetUseStraightPath(useStraightPath); bool result = path.CalculatePath(x, y, z, false, useStraightLine); @@ -125,7 +125,7 @@ namespace Game.Chat handler.SendSysMessage("Calc [{0:D2}, {1:D2}]", tilex, tiley); // navmesh poly . navmesh tile location - Detour.dtQueryFilter filter = new Detour.dtQueryFilter(); + Detour.dtQueryFilter filter = new(); float[] nothing = new float[3]; ulong polyRef = 0; if (Detour.dtStatusFailed(navmeshquery.findNearestPoly(location, extents, filter, ref polyRef, ref nothing))) @@ -138,8 +138,8 @@ namespace Game.Chat handler.SendSysMessage("Dt [??, ??] (invalid poly, probably no tile loaded)"); else { - Detour.dtMeshTile tile = new Detour.dtMeshTile(); - Detour.dtPoly poly = new Detour.dtPoly(); + Detour.dtMeshTile tile = new(); + Detour.dtPoly poly = new(); if (Detour.dtStatusSucceed(navmesh.getTileAndPolyByRef(polyRef, ref tile, ref poly))) { if (tile != null) @@ -231,7 +231,7 @@ namespace Game.Chat WorldObject obj = handler.GetPlayer(); // Get Creatures - List creatureList = new List(); + List creatureList = new(); var go_check = new AnyUnitInObjectRangeCheck(obj, radius); var go_search = new UnitListSearcher(obj, creatureList, go_check); @@ -248,7 +248,7 @@ namespace Game.Chat obj.GetPosition(out gx, out gy, out gz); foreach (var creature in creatureList) { - PathGenerator path = new PathGenerator(creature); + PathGenerator path = new(creature); path.CalculatePath(gx, gy, gz); ++paths; } diff --git a/Source/Game/Chat/Commands/MiscCommands.cs b/Source/Game/Chat/Commands/MiscCommands.cs index 22b411520..43e46bade 100644 --- a/Source/Game/Chat/Commands/MiscCommands.cs +++ b/Source/Game/Chat/Commands/MiscCommands.cs @@ -80,7 +80,7 @@ namespace Game.Chat if (count == 0) count = 1; - List bonusListIDs = new List(); + List bonusListIDs = new(); var bonuses = args.NextString(); // semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!) @@ -121,7 +121,7 @@ namespace Game.Chat uint noSpaceForCount = 0; // check space and find places - List dest = new List(); + List dest = new(); InventoryResult msg = playerTarget.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, itemId, (uint)count, out noSpaceForCount); if (msg != InventoryResult.Ok) // convert to possible store amount count -= (int)noSpaceForCount; @@ -175,7 +175,7 @@ namespace Game.Chat return false; } - List bonusListIDs = new List(); + List bonusListIDs = new(); var bonuses = args.NextString(); // semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!) @@ -203,7 +203,7 @@ namespace Game.Chat if (template.Value.GetItemSet() == itemSetId) { found = true; - List dest = new List(); + List dest = new(); InventoryResult msg = playerTarget.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, template.Value.GetId(), 1); if (msg == InventoryResult.Ok) { @@ -565,7 +565,7 @@ namespace Game.Chat // melee damage by specific school if (string.IsNullOrEmpty(spellStr)) { - DamageInfo dmgInfo = new DamageInfo(attacker, target, damage_, null, schoolmask, DamageEffectType.SpellDirect, WeaponAttackType.BaseAttack); + DamageInfo dmgInfo = new(attacker, target, damage_, null, schoolmask, DamageEffectType.SpellDirect, WeaponAttackType.BaseAttack); attacker.CalcAbsorbResist(dmgInfo); if (dmgInfo.GetDamage() == 0) @@ -591,7 +591,7 @@ namespace Game.Chat if (spellInfo == null) return false; - SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(attacker, target, spellInfo, new Networking.Packets.SpellCastVisual(spellInfo.GetSpellXSpellVisualId(attacker), 0), spellInfo.SchoolMask); + SpellNonMeleeDamage damageInfo = new(attacker, target, spellInfo, new Networking.Packets.SpellCastVisual(spellInfo.GetSpellXSpellVisualId(attacker), 0), spellInfo.SchoolMask); damageInfo.damage = damage_; attacker.DealDamageMods(damageInfo.target, ref damageInfo.damage, ref damageInfo.absorb); target.DealSpellDamage(damageInfo, true); @@ -886,7 +886,7 @@ namespace Game.Chat } CellCoord cellCoord = GridDefines.ComputeCellCoord(obj.GetPositionX(), obj.GetPositionY()); - Cell cell = new Cell(cellCoord); + Cell cell = new(cellCoord); uint zoneId, areaId; obj.GetZoneAndAreaId(out zoneId, out areaId); @@ -1957,7 +1957,7 @@ namespace Game.Chat Cell.VisitGridObjects(player, worker, player.GetGridActivationRange()); // Now handle any that had despawned, but had respawn time logged. - List data = new List(); + List data = new(); player.GetMap().GetRespawnInfo(data, SpawnObjectTypeMask.All, 0); if (!data.Empty()) { diff --git a/Source/Game/Chat/Commands/ModifyCommands.cs b/Source/Game/Chat/Commands/ModifyCommands.cs index 70b6dbb53..ba5c43a67 100644 --- a/Source/Game/Chat/Commands/ModifyCommands.cs +++ b/Source/Game/Chat/Commands/ModifyCommands.cs @@ -191,8 +191,8 @@ namespace Game.Chat if (handler.NeedReportToTarget(target)) target.SendSysMessage(CypherStrings.YoursSpellflatidChanged, handler.GetNameLink(), spellflatid, val, mark); - SetSpellModifier packet = new SetSpellModifier(ServerOpcodes.SetFlatSpellModifier); - SpellModifierInfo spellMod = new SpellModifierInfo(); + SetSpellModifier packet = new(ServerOpcodes.SetFlatSpellModifier); + SpellModifierInfo spellMod = new(); spellMod.ModIndex = op; SpellModifierData modData; modData.ClassIndex = spellflatid; @@ -601,7 +601,7 @@ namespace Game.Chat Global.CharacterCacheStorage.UpdateCharacterGender(target.GetGUID(), (byte)gender); // Generate random customizations - List customizations = new List(); + List customizations = new(); var options = Global.DB2Mgr.GetCustomiztionOptions(target.GetRace(), gender); WorldSession worldSession = target.GetSession(); @@ -620,7 +620,7 @@ namespace Game.Chat continue; ChrCustomizationChoiceRecord choiceEntry = choicesForOption[0]; - ChrCustomizationChoice choice = new ChrCustomizationChoice(); + ChrCustomizationChoice choice = new(); choice.ChrCustomizationOptionID = option.Id; choice.ChrCustomizationChoiceID = choiceEntry.Id; customizations.Add(choice); diff --git a/Source/Game/Chat/Commands/NPCCommands.cs b/Source/Game/Chat/Commands/NPCCommands.cs index 2b5b67c80..3e5cbe544 100644 --- a/Source/Game/Chat/Commands/NPCCommands.cs +++ b/Source/Game/Chat/Commands/NPCCommands.cs @@ -446,7 +446,7 @@ namespace Game.Chat Player player = handler.GetSession().GetPlayer(); - List creatureList = new List(); + List creatureList = new(); if (!player.GetMap().SpawnGroupSpawn(groupId, ignoreRespawn, force, creatureList)) { handler.SendSysMessage(CypherStrings.SpawngroupBadgroup, groupId); @@ -719,7 +719,7 @@ namespace Game.Chat uint vendor_entry = vendor.GetEntry(); - VendorItem vItem = new VendorItem(); + VendorItem vItem = new(); vItem.item = itemId; vItem.maxcount = maxcount; vItem.incrtime = incrtime; @@ -807,7 +807,7 @@ namespace Game.Chat return false; Player chr = handler.GetSession().GetPlayer(); - FormationInfo group_member = new FormationInfo(); + FormationInfo group_member = new(); group_member.follow_angle = (creature.GetAngle(chr) - chr.GetOrientation()) * 180 / MathFunctions.PI; group_member.follow_dist = (float)Math.Sqrt(Math.Pow(chr.GetPositionX() - creature.GetPositionX(), 2) + Math.Pow(chr.GetPositionY() - creature.GetPositionY(), 2)); group_member.leaderGUID = leaderGUID; diff --git a/Source/Game/Chat/Commands/PetCommands.cs b/Source/Game/Chat/Commands/PetCommands.cs index 2a09af61c..d20a5b6aa 100644 --- a/Source/Game/Chat/Commands/PetCommands.cs +++ b/Source/Game/Chat/Commands/PetCommands.cs @@ -52,7 +52,7 @@ namespace Game.Chat } // Everything looks OK, create new pet - Pet pet = new Pet(player, PetType.Hunter); + Pet pet = new(player, PetType.Hunter); if (!pet.CreateBaseAtCreature(creatureTarget)) { handler.SendSysMessage("Error 1"); diff --git a/Source/Game/Chat/Commands/QuestCommands.cs b/Source/Game/Chat/Commands/QuestCommands.cs index 11289122b..7f9c25b36 100644 --- a/Source/Game/Chat/Commands/QuestCommands.cs +++ b/Source/Game/Chat/Commands/QuestCommands.cs @@ -101,7 +101,7 @@ namespace Game.Chat case QuestObjectiveType.Item: { uint curItemCount = player.GetItemCount((uint)obj.ObjectID, true); - List dest = new List(); + List dest = new(); InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, (uint)obj.ObjectID, (uint)(obj.Amount - curItemCount)); if (msg == InventoryResult.Ok) { diff --git a/Source/Game/Chat/Commands/RbacCommands.cs b/Source/Game/Chat/Commands/RbacCommands.cs index b0592f77b..1c9c8f719 100644 --- a/Source/Game/Chat/Commands/RbacCommands.cs +++ b/Source/Game/Chat/Commands/RbacCommands.cs @@ -292,7 +292,7 @@ namespace Game.Chat.Commands if (checkParams && handler.HasLowerSecurityAccount(null, accountId, true)) return null; - RBACCommandData data = new RBACCommandData(); + RBACCommandData data = new(); if (rdata == null) { diff --git a/Source/Game/Chat/Commands/SendCommands.cs b/Source/Game/Chat/Commands/SendCommands.cs index 590ef812f..2ac36744a 100644 --- a/Source/Game/Chat/Commands/SendCommands.cs +++ b/Source/Game/Chat/Commands/SendCommands.cs @@ -54,10 +54,10 @@ namespace Game.Chat.Commands return false; // from console show not existed sender - MailSender sender = new MailSender(MailMessageType.Normal, handler.GetSession() ? handler.GetSession().GetPlayer().GetGUID().GetCounter() : 0, MailStationery.Gm); + MailSender sender = new(MailMessageType.Normal, handler.GetSession() ? handler.GetSession().GetPlayer().GetGUID().GetCounter() : 0, MailStationery.Gm); // @todo Fix poor design - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); new MailDraft(subject, text) .SendMailTo(trans, new MailReceiver(target, targetGuid.GetCounter()), sender); @@ -95,10 +95,10 @@ namespace Game.Chat.Commands return false; // extract items - List> items = new List>(); + List> items = new(); // get all tail string - StringArguments tail = new StringArguments(args.NextString("")); + StringArguments tail = new(args.NextString("")); // get from tail next item str StringArguments itemStr; @@ -143,12 +143,12 @@ namespace Game.Chat.Commands } // from console show not existed sender - MailSender sender = new MailSender(MailMessageType.Normal, handler.GetSession() ? handler.GetSession().GetPlayer().GetGUID().GetCounter() : 0, MailStationery.Gm); + MailSender sender = new(MailMessageType.Normal, handler.GetSession() ? handler.GetSession().GetPlayer().GetGUID().GetCounter() : 0, MailStationery.Gm); // fill mail - MailDraft draft = new MailDraft(subject, text); + MailDraft draft = new(subject, text); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); foreach (var pair in items) { @@ -202,9 +202,9 @@ namespace Game.Chat.Commands return false; // from console show not existed sender - MailSender sender = new MailSender(MailMessageType.Normal, handler.GetSession() ? handler.GetSession().GetPlayer().GetGUID().GetCounter() : 0, MailStationery.Gm); + MailSender sender = new(MailMessageType.Normal, handler.GetSession() ? handler.GetSession().GetPlayer().GetGUID().GetCounter() : 0, MailStationery.Gm); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); new MailDraft(subject, text) .AddMoney((uint)money) diff --git a/Source/Game/Chat/Commands/TeleCommands.cs b/Source/Game/Chat/Commands/TeleCommands.cs index 65220083f..61a480018 100644 --- a/Source/Game/Chat/Commands/TeleCommands.cs +++ b/Source/Game/Chat/Commands/TeleCommands.cs @@ -90,7 +90,7 @@ namespace Game.Chat return false; } - GameTele tele = new GameTele(); + GameTele tele = new(); tele.posX = player.GetPositionX(); tele.posY = player.GetPositionY(); tele.posZ = player.GetPositionZ(); @@ -232,7 +232,7 @@ namespace Game.Chat if (!result.IsEmpty()) { - WorldLocation loc = new WorldLocation(result.Read(0), result.Read(2), result.Read(3), result.Read(4), 0.0f); + WorldLocation loc = new(result.Read(0), result.Read(2), result.Read(3), result.Read(4), 0.0f); uint zoneId = result.Read(1); Player.SavePositionInDB(loc, zoneId, targetGuid, null); diff --git a/Source/Game/Chat/Commands/WPCommands.cs b/Source/Game/Chat/Commands/WPCommands.cs index cee99691b..1848d49ad 100644 --- a/Source/Game/Chat/Commands/WPCommands.cs +++ b/Source/Game/Chat/Commands/WPCommands.cs @@ -760,7 +760,7 @@ namespace Game.Chat.Commands Player chr = handler.GetSession().GetPlayer(); Map map = chr.GetMap(); - Position pos = new Position(x, y, z, chr.GetOrientation()); + Position pos = new(x, y, z, chr.GetOrientation()); Creature creature = Creature.CreateCreature(id, map, pos); if (!creature) @@ -826,7 +826,7 @@ namespace Game.Chat.Commands Player chr = handler.GetSession().GetPlayer(); Map map = chr.GetMap(); - Position pos = new Position(x, y, z, chr.GetOrientation()); + Position pos = new(x, y, z, chr.GetOrientation()); Creature creature = Creature.CreateCreature(1, map, pos); if (!creature) @@ -881,7 +881,7 @@ namespace Game.Chat.Commands Player chr = handler.GetSession().GetPlayer(); Map map = chr.GetMap(); - Position pos = new Position(x, y, z, o); + Position pos = new(x, y, z, o); Creature creature = Creature.CreateCreature(1, map, pos); if (!creature) diff --git a/Source/Game/Collision/BoundingIntervalHierarchy.cs b/Source/Game/Collision/BoundingIntervalHierarchy.cs index 83416aa7c..6b4078ed7 100644 --- a/Source/Game/Collision/BoundingIntervalHierarchy.cs +++ b/Source/Game/Collision/BoundingIntervalHierarchy.cs @@ -46,7 +46,7 @@ namespace Game.Collision tempTree.Add(0); // seed bbox - AABound gridBox = new AABound(); + AABound gridBox = new(); gridBox.lo = bounds.Lo; gridBox.hi = bounds.Hi; AABound nodeBox = gridBox; @@ -303,8 +303,8 @@ namespace Game.Collision dat.primBound[i] = primitives[i].GetBounds(); bounds.merge(dat.primBound[i]); } - List tempTree = new List(); - BuildStats stats = new BuildStats(); + List tempTree = new(); + BuildStats stats = new(); BuildHierarchy(tempTree, dat, stats); objects = new uint[dat.numPrims]; @@ -322,7 +322,7 @@ namespace Game.Collision float intervalMax = -1.0f; Vector3 org = r.Origin; Vector3 dir = r.Direction; - Vector3 invDir = new Vector3(); + Vector3 invDir = new(); for (int i = 0; i < 3; ++i) { invDir[i] = 1.0f / dir[i]; @@ -621,13 +621,13 @@ namespace Game.Collision uint FloatToRawIntBits(float f) { - FloatToIntConverter converter = new FloatToIntConverter(); + FloatToIntConverter converter = new(); converter.FloatValue = f; return converter.IntValue; } float IntBitsToFloat(uint i) { - FloatToIntConverter converter = new FloatToIntConverter(); + FloatToIntConverter converter = new(); converter.IntValue = i; return converter.FloatValue; } diff --git a/Source/Game/Collision/BoundingIntervalHierarchyWrap.cs b/Source/Game/Collision/BoundingIntervalHierarchyWrap.cs index 6045f8b29..86a6a3e3d 100644 --- a/Source/Game/Collision/BoundingIntervalHierarchyWrap.cs +++ b/Source/Game/Collision/BoundingIntervalHierarchyWrap.cs @@ -53,21 +53,21 @@ namespace Game.Collision public void IntersectRay(Ray ray, WorkerCallback intersectCallback, ref float maxDist) { Balance(); - MDLCallback temp_cb = new MDLCallback(intersectCallback, m_objects.ToArray(), (uint)m_objects.Count); + MDLCallback temp_cb = new(intersectCallback, m_objects.ToArray(), (uint)m_objects.Count); m_tree.IntersectRay(ray, temp_cb, ref maxDist, true); } public void IntersectPoint(Vector3 point, WorkerCallback intersectCallback) { Balance(); - MDLCallback callback = new MDLCallback(intersectCallback, m_objects.ToArray(), (uint)m_objects.Count); + MDLCallback callback = new(intersectCallback, m_objects.ToArray(), (uint)m_objects.Count); m_tree.IntersectPoint(point, callback); } - BIH m_tree = new BIH(); - List m_objects = new List(); - Dictionary m_obj2Idx = new Dictionary(); - HashSet m_objects_to_push = new HashSet(); + BIH m_tree = new(); + List m_objects = new(); + Dictionary m_obj2Idx = new(); + HashSet m_objects_to_push = new(); int unbalanced_times; public class MDLCallback : WorkerCallback diff --git a/Source/Game/Collision/Callbacks.cs b/Source/Game/Collision/Callbacks.cs index c0c8e68b2..0b4d71ff5 100644 --- a/Source/Game/Collision/Callbacks.cs +++ b/Source/Game/Collision/Callbacks.cs @@ -121,7 +121,7 @@ namespace Game.Collision Vector3 e1 = points[(int)tri.idx1] - points[(int)tri.idx0]; Vector3 e2 = points[(int)tri.idx2] - points[(int)tri.idx0]; - Vector3 p = new Vector3(ray.Direction.cross(e2)); + Vector3 p = new(ray.Direction.cross(e2)); float a = e1.dot(p); if (Math.Abs(a) < EPS) @@ -131,7 +131,7 @@ namespace Game.Collision } float f = 1.0f / a; - Vector3 s = new Vector3(ray.Origin - points[(int)tri.idx0]); + Vector3 s = new(ray.Origin - points[(int)tri.idx0]); float u = f * s.dot(p); if ((u < 0.0f) || (u > 1.0f)) @@ -140,7 +140,7 @@ namespace Game.Collision return false; } - Vector3 q = new Vector3(s.cross(e1)); + Vector3 q = new(s.cross(e1)); float v = f * ray.Direction.dot(q); if ((v < 0.0f) || ((u + v) > 1.0f)) @@ -205,7 +205,7 @@ namespace Game.Collision } ModelInstance[] prims; - public AreaInfo aInfo = new AreaInfo(); + public AreaInfo aInfo = new(); } public class LocationInfoCallback : WorkerCallback diff --git a/Source/Game/Collision/DynamicTree.cs b/Source/Game/Collision/DynamicTree.cs index f02bd66ef..1dc3361df 100644 --- a/Source/Game/Collision/DynamicTree.cs +++ b/Source/Game/Collision/DynamicTree.cs @@ -54,7 +54,7 @@ namespace Game.Collision public bool GetIntersectionTime(Ray ray, Vector3 endPos, PhaseShift phaseShift, float maxDist) { float distance = maxDist; - DynamicTreeIntersectionCallback callback = new DynamicTreeIntersectionCallback(phaseShift); + DynamicTreeIntersectionCallback callback = new(phaseShift); impl.IntersectRay(ray, callback, ref distance, endPos); if (callback.DidHit()) maxDist = distance; @@ -74,7 +74,7 @@ namespace Game.Collision return false; } Vector3 dir = (endPos - startPos) / maxDist; // direction with length of 1 - Ray ray = new Ray(startPos, dir); + Ray ray = new(startPos, dir); float dist = maxDist; if (GetIntersectionTime(ray, endPos, phaseShift, dist)) { @@ -106,8 +106,8 @@ namespace Game.Collision if (!MathFunctions.fuzzyGt(maxDist, 0)) return true; - Ray r = new Ray(startPos, (endPos - startPos) / maxDist); - DynamicTreeIntersectionCallback callback = new DynamicTreeIntersectionCallback(phaseShift); + Ray r = new(startPos, (endPos - startPos) / maxDist); + DynamicTreeIntersectionCallback callback = new(phaseShift); impl.IntersectRay(r, callback, ref maxDist, endPos); return !callback.DidHit(); @@ -115,9 +115,9 @@ namespace Game.Collision public float GetHeight(float x, float y, float z, float maxSearchDist, PhaseShift phaseShift) { - Vector3 v = new Vector3(x, y, z + 0.5f); - Ray r = new Ray(v, new Vector3(0, 0, -1)); - DynamicTreeIntersectionCallback callback = new DynamicTreeIntersectionCallback(phaseShift); + Vector3 v = new(x, y, z + 0.5f); + Ray r = new(v, new Vector3(0, 0, -1)); + DynamicTreeIntersectionCallback callback = new(phaseShift); impl.IntersectZAllignedRay(r, callback, ref maxSearchDist); if (callback.DidHit()) @@ -133,8 +133,8 @@ namespace Game.Collision rootId = 0; groupId = 0; - Vector3 v = new Vector3(x, y, z + 0.5f); - DynamicTreeAreaInfoCallback intersectionCallBack = new DynamicTreeAreaInfoCallback(phaseShift); + Vector3 v = new(x, y, z + 0.5f); + DynamicTreeAreaInfoCallback intersectionCallBack = new(phaseShift); impl.IntersectPoint(v, intersectionCallBack); if (intersectionCallBack.GetAreaInfo().result) { diff --git a/Source/Game/Collision/Management/VMapManager.cs b/Source/Game/Collision/Management/VMapManager.cs index c0e86642a..cf1f91ec4 100644 --- a/Source/Game/Collision/Management/VMapManager.cs +++ b/Source/Game/Collision/Management/VMapManager.cs @@ -84,7 +84,7 @@ namespace Game.Collision if (instanceTree == null) { string filename = VMapPath + GetMapFileName(mapId); - StaticMapTree newTree = new StaticMapTree(mapId); + StaticMapTree newTree = new(mapId); LoadResult treeInitResult = newTree.InitMap(filename); if (treeInitResult != LoadResult.Success) return treeInitResult; @@ -232,7 +232,7 @@ namespace Game.Collision var instanceTree = iInstanceMapTrees.LookupByKey(mapId); if (instanceTree != null) { - LocationInfo info = new LocationInfo(); + LocationInfo info = new(); Vector3 pos = ConvertPositionToInternalRep(x, y, z); if (instanceTree.GetLocationInfo(pos, info)) { @@ -265,7 +265,7 @@ namespace Game.Collision var instanceTree = iInstanceMapTrees.LookupByKey(mapId); if (instanceTree != null) { - LocationInfo info = new LocationInfo(); + LocationInfo info = new(); Vector3 pos = ConvertPositionToInternalRep(x, y, z); if (instanceTree.GetLocationInfo(pos, info)) { @@ -292,7 +292,7 @@ namespace Game.Collision var model = iLoadedModelFiles.LookupByKey(filename); if (model == null) { - WorldModel worldmodel = new WorldModel(); + WorldModel worldmodel = new(); if (!worldmodel.ReadFile(VMapPath + filename)) { Log.outError(LogFilter.Server, "VMapManager: could not load '{0}'", filename); @@ -347,7 +347,7 @@ namespace Game.Collision Vector3 ConvertPositionToInternalRep(float x, float y, float z) { - Vector3 pos = new Vector3(); + Vector3 pos = new(); float mid = 0.5f * 64.0f * 533.33333333f; pos.X = mid - x; pos.Y = mid - y; @@ -368,14 +368,14 @@ namespace Game.Collision public bool IsHeightCalcEnabled() { return _enableHeightCalc; } public bool IsMapLoadingEnabled() { return _enableLineOfSightCalc || _enableHeightCalc; } - Dictionary iLoadedModelFiles = new Dictionary(); - Dictionary iInstanceMapTrees = new Dictionary(); - MultiMap iChildMapData = new MultiMap(); - Dictionary iParentMapData = new Dictionary(); + Dictionary iLoadedModelFiles = new(); + Dictionary iInstanceMapTrees = new(); + MultiMap iChildMapData = new(); + Dictionary iParentMapData = new(); bool _enableLineOfSightCalc; bool _enableHeightCalc; - object LoadedModelFilesLock = new object(); + object LoadedModelFilesLock = new(); } public class ManagedModel diff --git a/Source/Game/Collision/Maps/MapTree.cs b/Source/Game/Collision/Maps/MapTree.cs index 0b64ed2f3..fca6c9e42 100644 --- a/Source/Game/Collision/Maps/MapTree.cs +++ b/Source/Game/Collision/Maps/MapTree.cs @@ -64,7 +64,7 @@ namespace Game.Collision if (!File.Exists(fname)) return LoadResult.FileNotFound; - using (BinaryReader reader = new BinaryReader(new FileStream(fname, FileMode.Open, FileAccess.Read))) + using (BinaryReader reader = new(new FileStream(fname, FileMode.Open, FileAccess.Read))) { var magic = reader.ReadStringFromChars(8); if (magic != MapConst.VMapMagic) @@ -120,7 +120,7 @@ namespace Game.Collision if (fileResult.File != null) { result = LoadResult.Success; - using (BinaryReader reader = new BinaryReader(fileResult.File)) + using (BinaryReader reader = new(fileResult.File)) { if (reader.ReadStringFromChars(8) != MapConst.VMapMagic) result = LoadResult.VersionMismatch; @@ -196,7 +196,7 @@ namespace Game.Collision TileFileOpenResult fileResult = OpenMapTileFile(VMapManager.VMapPath, iMapID, tileX, tileY, vm); if (fileResult.File != null) { - using (BinaryReader reader = new BinaryReader(fileResult.File)) + using (BinaryReader reader = new(fileResult.File)) { bool result = true; if (reader.ReadStringFromChars(8) != MapConst.VMapMagic) @@ -240,7 +240,7 @@ namespace Game.Collision static TileFileOpenResult OpenMapTileFile(string vmapPath, uint mapID, uint tileX, uint tileY, VMapManager vm) { - TileFileOpenResult result = new TileFileOpenResult(); + TileFileOpenResult result = new(); result.Name = vmapPath + GetTileFileName(mapID, tileX, tileY); if (File.Exists(result.Name)) @@ -273,7 +273,7 @@ namespace Game.Collision if (!File.Exists(fullname)) return LoadResult.FileNotFound; - using (BinaryReader reader = new BinaryReader(new FileStream(fullname, FileMode.Open, FileAccess.Read))) + using (BinaryReader reader = new(new FileStream(fullname, FileMode.Open, FileAccess.Read))) { if (reader.ReadStringFromChars(8) != MapConst.VMapMagic) return LoadResult.VersionMismatch; @@ -283,7 +283,7 @@ namespace Game.Collision if (stream == null) return LoadResult.FileNotFound; - using (BinaryReader reader = new BinaryReader(stream)) + using (BinaryReader reader = new(stream)) { if (reader.ReadStringFromChars(8) != MapConst.VMapMagic) return LoadResult.VersionMismatch; @@ -304,7 +304,7 @@ namespace Game.Collision rootId = 0; groupId = 0; - AreaInfoCallback intersectionCallBack = new AreaInfoCallback(iTreeValues); + AreaInfoCallback intersectionCallBack = new(iTreeValues); iTree.IntersectPoint(pos, intersectionCallBack); if (intersectionCallBack.aInfo.result) { @@ -320,7 +320,7 @@ namespace Game.Collision public bool GetLocationInfo(Vector3 pos, LocationInfo info) { - LocationInfoCallback intersectionCallBack = new LocationInfoCallback(iTreeValues, info); + LocationInfoCallback intersectionCallBack = new(iTreeValues, info); iTree.IntersectPoint(pos, intersectionCallBack); return intersectionCallBack.result; } @@ -328,8 +328,8 @@ namespace Game.Collision public float GetHeight(Vector3 pPos, float maxSearchDist) { float height = float.PositiveInfinity; - Vector3 dir = new Vector3(0, 0, -1); - Ray ray = new Ray(pPos, dir); // direction with length of 1 + Vector3 dir = new(0, 0, -1); + Ray ray = new(pPos, dir); // direction with length of 1 float maxDist = maxSearchDist; if (GetIntersectionTime(ray, ref maxDist, false, ModelIgnoreFlags.Nothing)) height = pPos.Z - maxDist; @@ -339,7 +339,7 @@ namespace Game.Collision bool GetIntersectionTime(Ray pRay, ref float pMaxDist, bool pStopAtFirstHit, ModelIgnoreFlags ignoreFlags) { float distance = pMaxDist; - MapRayCallback intersectionCallBack = new MapRayCallback(iTreeValues, ignoreFlags); + MapRayCallback intersectionCallBack = new(iTreeValues, ignoreFlags); iTree.IntersectRay(pRay, intersectionCallBack, ref distance, pStopAtFirstHit); if (intersectionCallBack.DidHit()) pMaxDist = distance; @@ -359,7 +359,7 @@ namespace Game.Collision return false; } Vector3 dir = (pPos2 - pPos1) / maxDist; // direction with length of 1 - Ray ray = new Ray(pPos1, dir); + Ray ray = new(pPos1, dir); float dist = maxDist; if (GetIntersectionTime(ray, ref dist, false, ModelIgnoreFlags.Nothing)) { @@ -403,7 +403,7 @@ namespace Game.Collision if (maxDist < 1e-10f) return true; // direction with length of 1 - Ray ray = new Ray(pos1, (pos2 - pos1) / maxDist); + Ray ray = new(pos1, (pos2 - pos1) / maxDist); if (GetIntersectionTime(ray, ref maxDist, true, ignoreFlags)) return false; @@ -413,13 +413,13 @@ namespace Game.Collision public int NumLoadedTiles() { return iLoadedTiles.Count; } uint iMapID; - BIH iTree = new BIH(); + BIH iTree = new(); ModelInstance[] iTreeValues; uint iNTreeValues; - Dictionary iSpawnIndices = new Dictionary(); + Dictionary iSpawnIndices = new(); - Dictionary iLoadedTiles = new Dictionary(); - Dictionary iLoadedSpawns = new Dictionary(); + Dictionary iLoadedTiles = new(); + Dictionary iLoadedSpawns = new(); } class TileFileOpenResult diff --git a/Source/Game/Collision/Models/GameObjectModel.cs b/Source/Game/Collision/Models/GameObjectModel.cs index f87493a1e..df25edec0 100644 --- a/Source/Game/Collision/Models/GameObjectModel.cs +++ b/Source/Game/Collision/Models/GameObjectModel.cs @@ -25,7 +25,7 @@ namespace Game.Collision { public class StaticModelList { - public static Dictionary models = new Dictionary(); + public static Dictionary models = new(); } public abstract class GameObjectModelOwnerBase @@ -47,7 +47,7 @@ namespace Game.Collision if (modelData == null) return false; - AxisAlignedBox mdl_box = new AxisAlignedBox(modelData.bound); + AxisAlignedBox mdl_box = new(modelData.bound); // ignore models with no bounds if (mdl_box == AxisAlignedBox.Zero()) { @@ -69,7 +69,7 @@ namespace Game.Collision iInvRot = iRotation.inverse(); // transform bounding box: mdl_box = new AxisAlignedBox(mdl_box.Lo * iScale, mdl_box.Hi * iScale); - AxisAlignedBox rotated_bounds = new AxisAlignedBox(); + AxisAlignedBox rotated_bounds = new(); for (int i = 0; i < 8; ++i) rotated_bounds.merge(iRotation * mdl_box.corner(i)); @@ -81,7 +81,7 @@ namespace Game.Collision public static GameObjectModel Create(GameObjectModelOwnerBase modelOwner) { - GameObjectModel mdl = new GameObjectModel(); + GameObjectModel mdl = new(); if (!mdl.Initialize(modelOwner)) return null; @@ -102,7 +102,7 @@ namespace Game.Collision // child bounds are defined in object space: Vector3 p = iInvRot * (ray.Origin - iPos) * iInvScale; - Ray modRay = new Ray(p, iInvRot * ray.Direction); + Ray modRay = new(p, iInvRot * ray.Direction); float distance = maxDist * iInvScale; bool hit = iModel.IntersectRay(modRay, ref distance, stopAtFirstHit, ignoreFlags); if (hit) @@ -149,7 +149,7 @@ namespace Game.Collision if (it == null) return false; - AxisAlignedBox mdl_box = new AxisAlignedBox(it.bound); + AxisAlignedBox mdl_box = new(it.bound); // ignore models with no bounds if (mdl_box == AxisAlignedBox.Zero()) { @@ -163,7 +163,7 @@ namespace Game.Collision iInvRot = iRotation.inverse(); // transform bounding box: mdl_box = new AxisAlignedBox(mdl_box.Lo * iScale, mdl_box.Hi * iScale); - AxisAlignedBox rotated_bounds = new AxisAlignedBox(); + AxisAlignedBox rotated_bounds = new(); for (int i = 0; i < 8; ++i) rotated_bounds.merge(iRotation * mdl_box.corner(i)); @@ -190,7 +190,7 @@ namespace Game.Collision } try { - using (BinaryReader reader = new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.Read))) + using (BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read))) { string magic = reader.ReadStringFromChars(8); if (magic != MapConst.VMapMagic) diff --git a/Source/Game/Collision/Models/ModelInstance.cs b/Source/Game/Collision/Models/ModelInstance.cs index 7bc9c4c25..234b65ba0 100644 --- a/Source/Game/Collision/Models/ModelInstance.cs +++ b/Source/Game/Collision/Models/ModelInstance.cs @@ -105,7 +105,7 @@ namespace Game.Collision // child bounds are defined in object space: Vector3 p = iInvRot * (pRay.Origin - iPos) * iInvScale; - Ray modRay = new Ray(p, iInvRot * pRay.Direction); + Ray modRay = new(p, iInvRot * pRay.Direction); float distance = pMaxDist * iInvScale; bool hit = iModel.IntersectRay(modRay, ref distance, pStopAtFirstHit, ignoreFlags); if (hit) diff --git a/Source/Game/Collision/Models/WorldModel.cs b/Source/Game/Collision/Models/WorldModel.cs index 079d1bae0..8f0ad0efc 100644 --- a/Source/Game/Collision/Models/WorldModel.cs +++ b/Source/Game/Collision/Models/WorldModel.cs @@ -130,7 +130,7 @@ namespace Game.Collision public static WmoLiquid ReadFromFile(BinaryReader reader) { - WmoLiquid liquid = new WmoLiquid(); + WmoLiquid liquid = new(); liquid.iTilesX = reader.ReadUInt32(); liquid.iTilesY = reader.ReadUInt32(); @@ -254,7 +254,7 @@ namespace Game.Collision if (triangles.Empty()) return false; - GModelRayCallback callback = new GModelRayCallback(triangles, vertices); + GModelRayCallback callback = new(triangles, vertices); meshTree.IntersectRay(ray, callback, ref distance, stopAtFirstHit); return callback.hit; } @@ -267,7 +267,7 @@ namespace Game.Collision Vector3 rPos = pos - 0.1f * down; float dist = float.PositiveInfinity; - Ray ray = new Ray(rPos, down); + Ray ray = new(rPos, down); bool hit = IntersectRay(ray, ref dist, false); if (hit) z_dist = dist - 0.1f; @@ -298,9 +298,9 @@ namespace Game.Collision AxisAlignedBox iBound; uint iMogpFlags; uint iGroupWMOID; - List vertices = new List(); - List triangles = new List(); - BIH meshTree = new BIH(); + List vertices = new(); + List triangles = new(); + BIH meshTree = new(); WmoLiquid iLiquid; } @@ -326,7 +326,7 @@ namespace Game.Collision if (groupModels.Count == 1) return groupModels[0].IntersectRay(ray, ref distance, stopAtFirstHit); - WModelRayCallBack isc = new WModelRayCallBack(groupModels); + WModelRayCallBack isc = new(groupModels); groupTree.IntersectRay(ray, isc, ref distance, stopAtFirstHit); return isc.hit; } @@ -337,7 +337,7 @@ namespace Game.Collision if (groupModels.Empty()) return false; - WModelAreaCallback callback = new WModelAreaCallback(groupModels, down); + WModelAreaCallback callback = new(groupModels, down); groupTree.IntersectPoint(p, callback); if (callback.hit != null) { @@ -357,7 +357,7 @@ namespace Game.Collision if (groupModels.Empty()) return false; - WModelAreaCallback callback = new WModelAreaCallback(groupModels, down); + WModelAreaCallback callback = new(groupModels, down); groupTree.IntersectPoint(p, callback); if (callback.hit != null) { @@ -378,7 +378,7 @@ namespace Game.Collision return false; } - using (BinaryReader reader = new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.Read))) + using (BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read))) { if (reader.ReadStringFromChars(8) != MapConst.VMapMagic) return false; @@ -396,7 +396,7 @@ namespace Game.Collision uint count = reader.ReadUInt32(); for (var i = 0; i < count; ++i) { - GroupModel group = new GroupModel(); + GroupModel group = new(); group.ReadFromFile(reader); groupModels.Add(group); } @@ -409,8 +409,8 @@ namespace Game.Collision } } - List groupModels = new List(); - BIH groupTree = new BIH(); + List groupModels = new(); + BIH groupTree = new(); uint RootWMOID; public uint Flags; } diff --git a/Source/Game/Collision/RegularGrid2D.cs b/Source/Game/Collision/RegularGrid2D.cs index e9c594858..0f4a9be51 100644 --- a/Source/Game/Collision/RegularGrid2D.cs +++ b/Source/Game/Collision/RegularGrid2D.cs @@ -89,7 +89,7 @@ namespace Game.Collision public static Cell ComputeCell(float fx, float fy) { - Cell c = new Cell(); + Cell c = new(); c.x = (int)(fx * (1.0f / CELL_SIZE) + (CELL_NUMBER / 2f)); c.y = (int)(fy * (1.0f / CELL_SIZE) + (CELL_NUMBER / 2f)); return c; @@ -206,7 +206,7 @@ namespace Game.Collision node.IntersectRay(ray, intersectCallback, ref max_dist); } - MultiMap memberTable = new MultiMap(); + MultiMap memberTable = new(); Node[][] nodes = new Node[CELL_NUMBER][]; } } diff --git a/Source/Game/Combat/HostileRegManager.cs b/Source/Game/Combat/HostileRegManager.cs index 8f3393543..3dc76df45 100644 --- a/Source/Game/Combat/HostileRegManager.cs +++ b/Source/Game/Combat/HostileRegManager.cs @@ -238,7 +238,7 @@ namespace Game.Combat if (!IsOnline()) UpdateOnlineStatus(); - ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefThreatChange, this, modThreat); + ThreatRefStatusChangeEvent Event = new(UnitEventTypes.ThreatRefThreatChange, this, modThreat); FireStatusChanged(Event); if (IsValid() && modThreat > 0.0f) @@ -300,7 +300,7 @@ namespace Game.Combat if (!iOnline) SetAccessibleState(false); // if not online that not accessable as well - ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefOnlineStatus, this); + ThreatRefStatusChangeEvent Event = new(UnitEventTypes.ThreatRefOnlineStatus, this); FireStatusChanged(Event); } } @@ -311,7 +311,7 @@ namespace Game.Combat { iAccessible = isAccessible; - ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefAccessibleStatus, this); + ThreatRefStatusChangeEvent Event = new(UnitEventTypes.ThreatRefAccessibleStatus, this); FireStatusChanged(Event); } } @@ -321,7 +321,7 @@ namespace Game.Combat { Invalidate(); - ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefRemoveFromList, this); + ThreatRefStatusChangeEvent Event = new(UnitEventTypes.ThreatRefRemoveFromList, this); FireStatusChanged(Event); } @@ -366,7 +366,7 @@ namespace Game.Combat iTempThreatModifier += threat; - ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefThreatChange, this, threat); + ThreatRefStatusChangeEvent Event = new(UnitEventTypes.ThreatRefThreatChange, this, threat); FireStatusChanged(Event); } diff --git a/Source/Game/Conditions/Condition.cs b/Source/Game/Conditions/Condition.cs index ce5b87850..17db7eb6e 100644 --- a/Source/Game/Conditions/Condition.cs +++ b/Source/Game/Conditions/Condition.cs @@ -521,7 +521,7 @@ namespace Game.Conditions public string ToString(bool ext = false) { - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); ss.AppendFormat("[Condition SourceType: {0}", SourceType); if (SourceType < ConditionSourceType.Max) ss.AppendFormat(" ({0})", Global.ConditionMgr.StaticSourceTypeData[(int)SourceType]); diff --git a/Source/Game/Conditions/ConditionManager.cs b/Source/Game/Conditions/ConditionManager.cs index fa1ae5504..cf32b7d8b 100644 --- a/Source/Game/Conditions/ConditionManager.cs +++ b/Source/Game/Conditions/ConditionManager.cs @@ -38,7 +38,7 @@ namespace Game if (conditions.Empty()) return GridMapTypeMask.All; // groupId, typeMask - Dictionary elseGroupSearcherTypeMasks = new Dictionary(); + Dictionary elseGroupSearcherTypeMasks = new(); foreach (var i in conditions) { // no point of having not loaded conditions in list @@ -75,7 +75,7 @@ namespace Game public bool IsObjectMeetToConditionList(ConditionSourceInfo sourceInfo, List conditions) { // groupId, groupCheckPassed - Dictionary elseGroupStore = new Dictionary(); + Dictionary elseGroupStore = new(); foreach (var condition in conditions) { Log.outDebug(LogFilter.Condition, "ConditionMgr.IsPlayerMeetToConditionList condType: {0} val1: {1}", condition.ConditionType, condition.ConditionValue1); @@ -119,13 +119,13 @@ namespace Game public bool IsObjectMeetToConditions(WorldObject obj, List conditions) { - ConditionSourceInfo srcInfo = new ConditionSourceInfo(obj); + ConditionSourceInfo srcInfo = new(obj); return IsObjectMeetToConditions(srcInfo, conditions); } public bool IsObjectMeetToConditions(WorldObject obj1, WorldObject obj2, List conditions) { - ConditionSourceInfo srcInfo = new ConditionSourceInfo(obj1, obj2); + ConditionSourceInfo srcInfo = new(obj1, obj2); return IsObjectMeetToConditions(srcInfo, conditions); } @@ -184,7 +184,7 @@ namespace Game public bool IsObjectMeetingNotGroupedConditions(ConditionSourceType sourceType, uint entry, WorldObject target0, WorldObject target1 = null, WorldObject target2 = null) { - ConditionSourceInfo conditionSource = new ConditionSourceInfo(target0, target1, target2); + ConditionSourceInfo conditionSource = new(target0, target1, target2); return IsObjectMeetingNotGroupedConditions(sourceType, entry, conditionSource); } @@ -206,7 +206,7 @@ namespace Game if (!conditions.Empty()) { Log.outDebug(LogFilter.Condition, "GetConditionsForSpellClickEvent: found conditions for SpellClickEvent entry {0} spell {1}", creatureId, spellId); - ConditionSourceInfo sourceInfo = new ConditionSourceInfo(clicker, target); + ConditionSourceInfo sourceInfo = new(clicker, target); return IsObjectMeetToConditions(sourceInfo, conditions); } } @@ -237,7 +237,7 @@ namespace Game if (!conditions.Empty()) { Log.outDebug(LogFilter.Condition, "GetConditionsForVehicleSpell: found conditions for Vehicle entry {0} spell {1}", creatureId, spellId); - ConditionSourceInfo sourceInfo = new ConditionSourceInfo(player, vehicle); + ConditionSourceInfo sourceInfo = new(player, vehicle); return IsObjectMeetToConditions(sourceInfo, conditions); } } @@ -253,7 +253,7 @@ namespace Game if (!conditions.Empty()) { Log.outDebug(LogFilter.Condition, "GetConditionsForSmartEvent: found conditions for Smart Event entry or guid {0} eventId {1}", entryOrGuid, eventId); - ConditionSourceInfo sourceInfo = new ConditionSourceInfo(unit, baseObject); + ConditionSourceInfo sourceInfo = new(unit, baseObject); return IsObjectMeetToConditions(sourceInfo, conditions); } } @@ -269,7 +269,7 @@ namespace Game if (!conditions.Empty()) { Log.outDebug(LogFilter.Condition, "GetConditionsForNpcVendorEvent: found conditions for creature entry {0} item {1}", creatureId, itemId); - ConditionSourceInfo sourceInfo = new ConditionSourceInfo(player, vendor); + ConditionSourceInfo sourceInfo = new(player, vendor); return IsObjectMeetToConditions(sourceInfo, conditions); } } @@ -321,7 +321,7 @@ namespace Game uint count = 0; do { - Condition cond = new Condition(); + Condition cond = new(); int iSourceTypeOrReferenceId = result.Read(0); cond.SourceGroup = result.Read(1); cond.SourceEntry = result.Read(2); @@ -579,7 +579,7 @@ namespace Game Global.SpellMgr.ForEachSpellInfoDifficulty((uint)cond.SourceEntry, spellInfo => { uint conditionEffMask = cond.SourceGroup; - List sharedMasks = new List(); + List sharedMasks = new(); for (byte i = 0; i < SpellConst.MaxEffects; ++i) { SpellEffectInfo effect = spellInfo.GetEffect(i); @@ -2167,7 +2167,7 @@ namespace Game public static bool IsPlayerMeetingExpression(Player player, WorldStateExpressionRecord expression) { - ByteBuffer buffer = new ByteBuffer(expression.Expression.ToByteArray()); + ByteBuffer buffer = new(expression.Expression.ToByteArray()); if (buffer.GetSize() == 0) return false; @@ -2387,12 +2387,12 @@ namespace Game return false; } - Dictionary> ConditionStore = new Dictionary>(); - MultiMap ConditionReferenceStore = new MultiMap(); - Dictionary> VehicleSpellConditionStore = new Dictionary>(); - Dictionary> SpellClickEventConditionStore = new Dictionary>(); - Dictionary> NpcVendorConditionContainerStore = new Dictionary>(); - Dictionary, MultiMap> SmartEventConditionStore = new Dictionary, MultiMap>(); + Dictionary> ConditionStore = new(); + MultiMap ConditionReferenceStore = new(); + Dictionary> VehicleSpellConditionStore = new(); + Dictionary> SpellClickEventConditionStore = new(); + Dictionary> NpcVendorConditionContainerStore = new(); + Dictionary, MultiMap> SmartEventConditionStore = new(); public string[] StaticSourceTypeData = { diff --git a/Source/Game/Conditions/DisableManager.cs b/Source/Game/Conditions/DisableManager.cs index 4f351b686..8f9e8df2f 100644 --- a/Source/Game/Conditions/DisableManager.cs +++ b/Source/Game/Conditions/DisableManager.cs @@ -32,11 +32,11 @@ namespace Game public class DisableData { public byte flags; - public List param0 = new List(); - public List param1 = new List(); + public List param0 = new(); + public List param1 = new(); } - Dictionary> m_DisableMap = new Dictionary>(); + Dictionary> m_DisableMap = new(); public void LoadDisables() { @@ -67,7 +67,7 @@ namespace Game string params_0 = result.Read(3); string params_1 = result.Read(4); - DisableData data = new DisableData(); + DisableData data = new(); data.flags = flags; switch (type) diff --git a/Source/Game/DataStorage/AreaTriggerDataStorage.cs b/Source/Game/DataStorage/AreaTriggerDataStorage.cs index b5e921bb7..18b121704 100644 --- a/Source/Game/DataStorage/AreaTriggerDataStorage.cs +++ b/Source/Game/DataStorage/AreaTriggerDataStorage.cs @@ -31,10 +31,10 @@ namespace Game.DataStorage public void LoadAreaTriggerTemplates() { uint oldMSTime = Time.GetMSTime(); - MultiMap verticesByAreaTrigger = new MultiMap(); - MultiMap verticesTargetByAreaTrigger = new MultiMap(); - MultiMap splinesBySpellMisc = new MultiMap(); - MultiMap actionsByAreaTrigger = new MultiMap(); + MultiMap verticesByAreaTrigger = new(); + MultiMap verticesTargetByAreaTrigger = new(); + MultiMap splinesBySpellMisc = new(); + MultiMap actionsByAreaTrigger = new(); // 0 1 2 3 4 SQLResult templateActions = DB.World.Query("SELECT AreaTriggerId, IsServerSide, ActionType, ActionParam, TargetType FROM `areatrigger_template_actions`"); @@ -110,7 +110,7 @@ namespace Game.DataStorage { uint spellMiscId = splines.Read(0); - Vector3 spline = new Vector3(splines.Read(1), splines.Read(2), splines.Read(3)); + Vector3 spline = new(splines.Read(1), splines.Read(2), splines.Read(3)); splinesBySpellMisc.Add(spellMiscId, spline); } @@ -127,7 +127,7 @@ namespace Game.DataStorage { do { - AreaTriggerTemplate areaTriggerTemplate = new AreaTriggerTemplate(); + AreaTriggerTemplate areaTriggerTemplate = new(); areaTriggerTemplate.Id = new(templates.Read(0), templates.Read(1) == 1); AreaTriggerTypes type = (AreaTriggerTypes)templates.Read(2); @@ -172,7 +172,7 @@ namespace Game.DataStorage { do { - AreaTriggerMiscTemplate miscTemplate = new AreaTriggerMiscTemplate(); + AreaTriggerMiscTemplate miscTemplate = new(); miscTemplate.MiscId = areatriggerSpellMiscs.Read(0); uint areatriggerId = areatriggerSpellMiscs.Read(1); @@ -233,7 +233,7 @@ namespace Game.DataStorage continue; } - AreaTriggerOrbitInfo orbitInfo = new AreaTriggerOrbitInfo(); + AreaTriggerOrbitInfo orbitInfo = new(); orbitInfo.StartDelay = circularMovementInfos.Read(1); orbitInfo.Radius = circularMovementInfos.Read(2); @@ -305,7 +305,7 @@ namespace Game.DataStorage continue; } - AreaTriggerSpawn spawn = new AreaTriggerSpawn(); + AreaTriggerSpawn spawn = new(); spawn.SpawnId = spawnId; spawn.Id = areaTriggerId; spawn.Location = new WorldLocation(location); @@ -349,9 +349,9 @@ namespace Game.DataStorage return _areaTriggerSpawnsBySpawnId.LookupByKey(spawnId); } - Dictionary<(uint mapId, uint cellId), SortedSet> _areaTriggerSpawnsByLocation = new Dictionary<(uint mapId, uint cellId), SortedSet>(); - Dictionary _areaTriggerSpawnsBySpawnId = new Dictionary(); - Dictionary _areaTriggerTemplateStore = new Dictionary(); - Dictionary _areaTriggerTemplateSpellMisc = new Dictionary(); + Dictionary<(uint mapId, uint cellId), SortedSet> _areaTriggerSpawnsByLocation = new(); + Dictionary _areaTriggerSpawnsBySpawnId = new(); + Dictionary _areaTriggerTemplateStore = new(); + Dictionary _areaTriggerTemplateSpellMisc = new(); } } diff --git a/Source/Game/DataStorage/CharacterTemplateDataStorage.cs b/Source/Game/DataStorage/CharacterTemplateDataStorage.cs index 7fa22ba5f..729f3dd47 100644 --- a/Source/Game/DataStorage/CharacterTemplateDataStorage.cs +++ b/Source/Game/DataStorage/CharacterTemplateDataStorage.cs @@ -30,7 +30,7 @@ namespace Game.DataStorage uint oldMSTime = Time.GetMSTime(); _characterTemplateStore.Clear(); - MultiMap characterTemplateClasses = new MultiMap(); + MultiMap characterTemplateClasses = new(); SQLResult classesResult = DB.World.Query("SELECT TemplateId, FactionGroup, Class FROM character_template_class"); if (!classesResult.IsEmpty()) { @@ -71,7 +71,7 @@ namespace Game.DataStorage do { - CharacterTemplate templ = new CharacterTemplate(); + CharacterTemplate templ = new(); templ.TemplateSetId = templates.Read(0); templ.Name = templates.Read(1); templ.Description = templates.Read(2); @@ -101,7 +101,7 @@ namespace Game.DataStorage return _characterTemplateStore.LookupByKey(templateId); } - Dictionary _characterTemplateStore = new Dictionary(); + Dictionary _characterTemplateStore = new(); } public struct CharacterTemplateClass diff --git a/Source/Game/DataStorage/CliDB.cs b/Source/Game/DataStorage/CliDB.cs index 356a6169d..1fadf62e8 100644 --- a/Source/Game/DataStorage/CliDB.cs +++ b/Source/Game/DataStorage/CliDB.cs @@ -33,7 +33,7 @@ namespace Game.DataStorage string db2Path = dataPath + "/dbc"; - BitSet availableDb2Locales = new BitSet((int)Locale.Total); + BitSet availableDb2Locales = new((int)Locale.Total); foreach (var dir in Directory.GetDirectories(db2Path)) { Locale locale = Path.GetFileName(dir).ToEnum(); @@ -698,8 +698,8 @@ namespace Game.DataStorage public static byte[] OldContinentsNodesMask = new byte[PlayerConst.TaxiMaskSize]; public static byte[] HordeTaxiNodesMask = new byte[PlayerConst.TaxiMaskSize]; public static byte[] AllianceTaxiNodesMask = new byte[PlayerConst.TaxiMaskSize]; - public static Dictionary> TaxiPathSetBySource = new Dictionary>(); - public static Dictionary TaxiPathNodesByPath = new Dictionary(); + public static Dictionary> TaxiPathSetBySource = new(); + public static Dictionary TaxiPathNodesByPath = new(); #endregion #region Helper Methods diff --git a/Source/Game/DataStorage/ClientReader/DB6Storage.cs b/Source/Game/DataStorage/ClientReader/DB6Storage.cs index 6ac6c68a9..9c04ee182 100644 --- a/Source/Game/DataStorage/ClientReader/DB6Storage.cs +++ b/Source/Game/DataStorage/ClientReader/DB6Storage.cs @@ -159,7 +159,7 @@ namespace Game.DataStorage case TypeCode.Object: if (type == typeof(LocalizedString)) { - LocalizedString locString = new LocalizedString(); + LocalizedString locString = new(); locString[Global.WorldMgr.GetDefaultDbcLocale()] = result.Read(dbIndex++); f.SetValue(obj, locString); diff --git a/Source/Game/DataStorage/ClientReader/DBReader.cs b/Source/Game/DataStorage/ClientReader/DBReader.cs index 69e2af6fd..598775b3c 100644 --- a/Source/Game/DataStorage/ClientReader/DBReader.cs +++ b/Source/Game/DataStorage/ClientReader/DBReader.cs @@ -37,7 +37,7 @@ namespace Game.DataStorage public static DB6Storage Read(BitSet availableDb2Locales, string db2Path, string fileName, HotfixStatements preparedStatement, HotfixStatements preparedStatementLocale, ref uint loadedFileCount) where T : new() { - DB6Storage storage = new DB6Storage(); + DB6Storage storage = new(); if (!File.Exists(db2Path + fileName)) { @@ -45,7 +45,7 @@ namespace Game.DataStorage return storage; } - DBReader reader = new DBReader(); + DBReader reader = new(); using (var stream = new FileStream(db2Path + fileName, FileMode.Open)) { if (!reader.Load(stream)) @@ -118,7 +118,7 @@ namespace Game.DataStorage { if (ColumnMeta[i].CompressionType == DB2ColumnCompression.Common) { - Dictionary commonValues = new Dictionary(); + Dictionary commonValues = new(); CommonData[i] = commonValues; for (int j = 0; j < ColumnMeta[i].AdditionalDataSize / 8; j++) @@ -177,7 +177,7 @@ namespace Game.DataStorage bool isIndexEmpty = Header.HasIndexTable() && indexData.Count(i => i == 0) == sections[sectionIndex].NumRecords; // duplicate rows data - Dictionary copyData = new Dictionary(); + Dictionary copyData = new(); for (int i = 0; i < sections[sectionIndex].NumCopyRecords; i++) copyData[reader.ReadInt32()] = reader.ReadInt32(); @@ -222,7 +222,7 @@ namespace Game.DataStorage //indexData = sparseIndexData; } - BitReader bitReader = new BitReader(recordsData); + BitReader bitReader = new(recordsData); for (int i = 0; i < sections[sectionIndex].NumRecords; ++i) { @@ -262,7 +262,7 @@ namespace Game.DataStorage internal Value32[][] PalletData; internal Dictionary[] CommonData; - Dictionary _records = new Dictionary(); + Dictionary _records = new(); } class WDC3Row @@ -393,7 +393,7 @@ namespace Game.DataStorage _data.Offset = _dataOffset; int fieldIndex = 0; - T obj = new T(); + T obj = new(); foreach (var f in typeof(T).GetFields()) { @@ -533,7 +533,7 @@ namespace Game.DataStorage case TypeCode.Object: if (type == typeof(LocalizedString)) { - LocalizedString localized = new LocalizedString(); + LocalizedString localized = new(); if (_stringsTable == null) { localized[Locale.enUS] = _data.ReadCString(); @@ -749,6 +749,6 @@ namespace Game.DataStorage } } - StringArray stringStorage = new StringArray((int)Locale.Total); + StringArray stringStorage = new((int)Locale.Total); } } diff --git a/Source/Game/DataStorage/ClientReader/GameTables.cs b/Source/Game/DataStorage/ClientReader/GameTables.cs index e5d053234..77c42a791 100644 --- a/Source/Game/DataStorage/ClientReader/GameTables.cs +++ b/Source/Game/DataStorage/ClientReader/GameTables.cs @@ -26,7 +26,7 @@ namespace Game.DataStorage { internal static GameTable Read(string path, string fileName, ref uint loadedFileCount) where T : new() { - GameTable storage = new GameTable(); + GameTable storage = new(); if (!File.Exists(path + fileName)) { @@ -42,7 +42,7 @@ namespace Game.DataStorage return storage; } - List data = new List(); + List data = new(); data.Add(new T()); // row id 0, unused string line; @@ -92,6 +92,6 @@ namespace Game.DataStorage public void SetData(List data) { _data = data; } - List _data = new List(); + List _data = new(); } } diff --git a/Source/Game/DataStorage/ConversationDataStorage.cs b/Source/Game/DataStorage/ConversationDataStorage.cs index bd7b75f6e..73c64a6e4 100644 --- a/Source/Game/DataStorage/ConversationDataStorage.cs +++ b/Source/Game/DataStorage/ConversationDataStorage.cs @@ -33,8 +33,8 @@ namespace Game.DataStorage _conversationLineTemplateStorage.Clear(); _conversationTemplateStorage.Clear(); - Dictionary actorsByConversation = new Dictionary(); - Dictionary actorGuidsByConversation = new Dictionary(); + Dictionary actorsByConversation = new(); + Dictionary actorGuidsByConversation = new(); SQLResult actorTemplates = DB.World.Query("SELECT Id, CreatureId, CreatureModelId FROM conversation_actor_template"); if (!actorTemplates.IsEmpty()) @@ -44,7 +44,7 @@ namespace Game.DataStorage do { uint id = actorTemplates.Read(0); - ConversationActorTemplate conversationActor = new ConversationActorTemplate(); + ConversationActorTemplate conversationActor = new(); conversationActor.Id = id; conversationActor.CreatureId = actorTemplates.Read(1); conversationActor.CreatureModelId = actorTemplates.Read(2); @@ -75,7 +75,7 @@ namespace Game.DataStorage continue; } - ConversationLineTemplate conversationLine = new ConversationLineTemplate(); + ConversationLineTemplate conversationLine = new(); conversationLine.Id = id; conversationLine.StartTime = lineTemplates.Read(1); conversationLine.UiCameraID = lineTemplates.Read(2); @@ -165,7 +165,7 @@ namespace Game.DataStorage do { - ConversationTemplate conversationTemplate = new ConversationTemplate(); + ConversationTemplate conversationTemplate = new(); conversationTemplate.Id = templateResult.Read(0); conversationTemplate.FirstLineId = templateResult.Read(1); conversationTemplate.LastLineEndTime = templateResult.Read(2); @@ -210,9 +210,9 @@ namespace Game.DataStorage return _conversationTemplateStorage.LookupByKey(conversationId); } - Dictionary _conversationTemplateStorage = new Dictionary(); - Dictionary _conversationActorTemplateStorage = new Dictionary(); - Dictionary _conversationLineTemplateStorage = new Dictionary(); + Dictionary _conversationTemplateStorage = new(); + Dictionary _conversationActorTemplateStorage = new(); + Dictionary _conversationLineTemplateStorage = new(); } public class ConversationActorTemplate @@ -240,9 +240,9 @@ namespace Game.DataStorage public uint TextureKitId; // Background texture public uint ScriptId; - public List Actors = new List(); - public List ActorGuids = new List(); - public List Lines = new List(); + public List Actors = new(); + public List ActorGuids = new(); + public List Lines = new(); } diff --git a/Source/Game/DataStorage/DB2Manager.cs b/Source/Game/DataStorage/DB2Manager.cs index ee2c0f01c..57b70c9a4 100644 --- a/Source/Game/DataStorage/DB2Manager.cs +++ b/Source/Game/DataStorage/DB2Manager.cs @@ -115,7 +115,7 @@ namespace Game.DataStorage _azeriteTierUnlockLevels[key][azeriteTierUnlock.Tier] = azeriteTierUnlock.AzeriteLevel; } - MultiMap azeriteUnlockMappings = new MultiMap(); + MultiMap azeriteUnlockMappings = new(); foreach (AzeriteUnlockMappingRecord azeriteUnlockMapping in CliDB.AzeriteUnlockMappingStorage.Values) azeriteUnlockMappings.Add(azeriteUnlockMapping.AzeriteUnlockMappingSetID, azeriteUnlockMapping); @@ -159,8 +159,8 @@ namespace Game.DataStorage foreach (var customizationChoice in CliDB.ChrCustomizationChoiceStorage.Values) _chrCustomizationChoicesByOption.Add(customizationChoice.ChrCustomizationOptionID, customizationChoice); - MultiMap> shapeshiftFormByModel = new MultiMap>(); - Dictionary displayInfoByCustomizationChoice = new Dictionary(); + MultiMap> shapeshiftFormByModel = new(); + Dictionary displayInfoByCustomizationChoice = new(); // build shapeshift form model lookup foreach (ChrCustomizationElementRecord customizationElement in CliDB.ChrCustomizationElementStorage.Values) @@ -179,7 +179,7 @@ namespace Game.DataStorage } } - MultiMap customizationOptionsByModel = new MultiMap(); + MultiMap customizationOptionsByModel = new(); foreach (ChrCustomizationOptionRecord customizationOption in CliDB.ChrCustomizationOptionStorage.Values) customizationOptionsByModel.Add(customizationOption.ChrModelID, customizationOption); @@ -195,7 +195,7 @@ namespace Game.DataStorage } } - Dictionary parentRaces = new Dictionary(); + Dictionary parentRaces = new(); foreach (ChrRacesRecord chrRace in CliDB.ChrRacesStorage.Values) if (chrRace.UnalteredVisualRaceID != 0) parentRaces[(uint)chrRace.UnalteredVisualRaceID] = chrRace.Id; @@ -220,7 +220,7 @@ namespace Game.DataStorage // link shapeshift displays to race/gender/form foreach (var shapeshiftOptionsForModel in shapeshiftFormByModel.LookupByKey(model.Id)) { - ShapeshiftFormModelData data = new ShapeshiftFormModelData(); + ShapeshiftFormModelData data = new(); data.OptionID = shapeshiftOptionsForModel.Item1; data.Choices = _chrCustomizationChoicesByOption.LookupByKey(shapeshiftOptionsForModel.Item1); if (!data.Choices.Empty()) @@ -388,7 +388,7 @@ namespace Game.DataStorage CliDB.MapDifficultyStorage.Clear(); - List mapDifficultyConditions = new List(); + List mapDifficultyConditions = new(); foreach (var mapDifficultyCondition in CliDB.MapDifficultyXConditionStorage.Values) mapDifficultyConditions.Add(mapDifficultyCondition); @@ -597,7 +597,7 @@ namespace Game.DataStorage _uiMapAssignmentByWmoGroup[i] = new MultiMap(); } - MultiMap uiMapAssignmentByUiMap = new MultiMap(); + MultiMap uiMapAssignmentByUiMap = new(); foreach (UiMapAssignmentRecord uiMapAssignment in CliDB.UiMapAssignmentStorage.Values) { uiMapAssignmentByUiMap.Add(uiMapAssignment.UiMapID, uiMapAssignment); @@ -616,13 +616,13 @@ namespace Game.DataStorage } } - Dictionary, UiMapLinkRecord> uiMapLinks = new Dictionary, UiMapLinkRecord>(); + Dictionary, UiMapLinkRecord> uiMapLinks = new(); foreach (UiMapLinkRecord uiMapLink in CliDB.UiMapLinkStorage.Values) uiMapLinks[Tuple.Create(uiMapLink.ParentUiMapID, (uint)uiMapLink.ChildUiMapID)] = uiMapLink; foreach (UiMapRecord uiMap in CliDB.UiMapStorage.Values) { - UiMapBounds bounds = new UiMapBounds(); + UiMapBounds bounds = new(); UiMapRecord parentUiMap = CliDB.UiMapStorage.LookupByKey(uiMap.ParentUiMapID); if (parentUiMap != null) { @@ -716,7 +716,7 @@ namespace Game.DataStorage return; } - Dictionary<(uint tableHash, int recordId), bool> deletedRecords = new Dictionary<(uint tableHash, int recordId), bool>(); + Dictionary<(uint tableHash, int recordId), bool> deletedRecords = new(); uint count = 0; do @@ -734,7 +734,7 @@ namespace Game.DataStorage } } - HotfixRecord hotfixRecord = new HotfixRecord(); + HotfixRecord hotfixRecord = new(); hotfixRecord.TableHash = tableHash; hotfixRecord.RecordID = recordId; hotfixRecord.HotfixID = id; @@ -845,7 +845,7 @@ namespace Game.DataStorage if (!availableDb2Locales[(int)locale]) continue; - HotfixOptionalData optionalData = new HotfixOptionalData(); + HotfixOptionalData optionalData = new(); optionalData.Key = result.Read(3); var allowedHotfixItr = allowedHotfixes.Find(v => { @@ -1086,7 +1086,7 @@ namespace Game.DataStorage _ => 0 }; - ContentTuningLevels levels = new ContentTuningLevels(); + ContentTuningLevels levels = new(); levels.MinLevel = (short)(contentTuning.MinLevel + getLevelAdjustment((ContentTuningCalcType)contentTuning.MinLevelType)); levels.MaxLevel = (short)(contentTuning.MaxLevel + getLevelAdjustment((ContentTuningCalcType)contentTuning.MaxLevelType)); levels.MinLevelWithDelta = (short)Math.Clamp(levels.MinLevel + contentTuning.TargetLevelDelta, 1, SharedConst.MaxLevel); @@ -1432,7 +1432,7 @@ namespace Game.DataStorage public List GetDefaultItemBonusTree(uint itemId, ItemContext itemContext) { - List bonusListIDs = new List(); + List bonusListIDs = new(); ItemSparseRecord proto = CliDB.ItemSparseStorage.LookupByKey(itemId); if (proto == null) @@ -2134,7 +2134,7 @@ namespace Game.DataStorage UiMapAssignmentRecord FindNearestMapAssignment(float x, float y, float z, int mapId, int areaId, int wmoDoodadPlacementId, int wmoGroupId, UiMapSystem system) { - UiMapAssignmentStatus nearestMapAssignment = new UiMapAssignmentStatus(); + UiMapAssignmentStatus nearestMapAssignment = new(); var iterateUiMapAssignments = new Action, int>((assignments, id) => { foreach (var assignment in assignments.LookupByKey(id)) @@ -2216,15 +2216,15 @@ namespace Game.DataStorage uiMapId = uiMapAssignment.UiMapID; - Vector2 relativePosition = new Vector2(0.5f, 0.5f); - Vector2 regionSize = new Vector2(uiMapAssignment.Region[1].X - uiMapAssignment.Region[0].X, uiMapAssignment.Region[1].Y - uiMapAssignment.Region[0].Y); + Vector2 relativePosition = new(0.5f, 0.5f); + Vector2 regionSize = new(uiMapAssignment.Region[1].X - uiMapAssignment.Region[0].X, uiMapAssignment.Region[1].Y - uiMapAssignment.Region[0].Y); if (regionSize.X > 0.0f) relativePosition.X = (x - uiMapAssignment.Region[0].X) / regionSize.X; if (regionSize.Y > 0.0f) relativePosition.Y = (y - uiMapAssignment.Region[0].Y) / regionSize.Y; // x any y are swapped - Vector2 uiPosition = new Vector2(((1.0f - (1.0f - relativePosition.Y)) * uiMapAssignment.UiMin.X) + ((1.0f - relativePosition.Y) * uiMapAssignment.UiMax.X), ((1.0f - (1.0f - relativePosition.X)) * uiMapAssignment.UiMin.Y) + ((1.0f - relativePosition.X) * uiMapAssignment.UiMax.Y)); + Vector2 uiPosition = new(((1.0f - (1.0f - relativePosition.Y)) * uiMapAssignment.UiMin.X) + ((1.0f - relativePosition.Y) * uiMapAssignment.UiMax.X), ((1.0f - (1.0f - relativePosition.X)) * uiMapAssignment.UiMin.Y) + ((1.0f - relativePosition.X) * uiMapAssignment.UiMax.Y)); if (!local) uiPosition = CalculateGlobalUiMapPosition(uiMapAssignment.UiMapID, uiPosition); @@ -2287,83 +2287,83 @@ namespace Game.DataStorage delegate bool AllowedHotfixOptionalData(byte[] data); - Dictionary _storage = new Dictionary(); - List _hotfixData = new List(); + Dictionary _storage = new(); + List _hotfixData = new(); Dictionary<(uint tableHash, int recordId), byte[]>[] _hotfixBlob = new Dictionary<(uint tableHash, int recordId), byte[]>[(int)Locale.Total]; - MultiMap> _allowedHotfixOptionalData = new MultiMap>(); + MultiMap> _allowedHotfixOptionalData = new(); MultiMap<(uint tableHash, int recordId), HotfixOptionalData>[]_hotfixOptionalData = new MultiMap<(uint tableHash, int recordId), HotfixOptionalData>[(int)Locale.Total]; - MultiMap _areaGroupMembers = new MultiMap(); - MultiMap _artifactPowers = new MultiMap(); - MultiMap _artifactPowerLinks = new MultiMap(); - Dictionary, ArtifactPowerRankRecord> _artifactPowerRanks = new Dictionary, ArtifactPowerRankRecord>(); - Dictionary _azeriteEmpoweredItems = new Dictionary(); - Dictionary<(uint azeriteEssenceId, uint rank), AzeriteEssencePowerRecord> _azeriteEssencePowersByIdAndRank = new Dictionary<(uint azeriteEssenceId, uint rank), AzeriteEssencePowerRecord>(); - List _azeriteItemMilestonePowers = new List(); + MultiMap _areaGroupMembers = new(); + MultiMap _artifactPowers = new(); + MultiMap _artifactPowerLinks = new(); + Dictionary, ArtifactPowerRankRecord> _artifactPowerRanks = new(); + Dictionary _azeriteEmpoweredItems = new(); + Dictionary<(uint azeriteEssenceId, uint rank), AzeriteEssencePowerRecord> _azeriteEssencePowersByIdAndRank = new(); + List _azeriteItemMilestonePowers = new(); AzeriteItemMilestonePowerRecord[] _azeriteItemMilestonePowerByEssenceSlot = new AzeriteItemMilestonePowerRecord[SharedConst.MaxAzeriteEssenceSlot]; - MultiMap _azeritePowers = new MultiMap(); - Dictionary<(uint azeriteUnlockSetId, ItemContext itemContext), byte[]> _azeriteTierUnlockLevels = new Dictionary<(uint azeriteUnlockSetId, ItemContext itemContext), byte[]>(); - Dictionary<(uint itemId, ItemContext itemContext), AzeriteUnlockMappingRecord> _azeriteUnlockMappings = new Dictionary<(uint itemId, ItemContext itemContext), AzeriteUnlockMappingRecord>(); + MultiMap _azeritePowers = new(); + Dictionary<(uint azeriteUnlockSetId, ItemContext itemContext), byte[]> _azeriteTierUnlockLevels = new(); + Dictionary<(uint itemId, ItemContext itemContext), AzeriteUnlockMappingRecord> _azeriteUnlockMappings = new(); ChrClassUIDisplayRecord[] _uiDisplayByClass = new ChrClassUIDisplayRecord[(int)Class.Max]; uint[][] _powersByClass = new uint[(int)Class.Max][]; - MultiMap _chrCustomizationChoicesByOption = new MultiMap(); - Dictionary, ChrModelRecord> _chrModelsByRaceAndGender = new Dictionary, ChrModelRecord>(); - Dictionary, ShapeshiftFormModelData> _chrCustomizationChoicesForShapeshifts = new Dictionary, ShapeshiftFormModelData>(); - MultiMap, ChrCustomizationOptionRecord> _chrCustomizationOptionsByRaceAndGender = new MultiMap, ChrCustomizationOptionRecord>(); - Dictionary> _chrCustomizationRequiredChoices = new Dictionary>(); + MultiMap _chrCustomizationChoicesByOption = new(); + Dictionary, ChrModelRecord> _chrModelsByRaceAndGender = new(); + Dictionary, ShapeshiftFormModelData> _chrCustomizationChoicesForShapeshifts = new(); + MultiMap, ChrCustomizationOptionRecord> _chrCustomizationOptionsByRaceAndGender = new(); + Dictionary> _chrCustomizationRequiredChoices = new(); ChrSpecializationRecord[][] _chrSpecializationsByIndex = new ChrSpecializationRecord[(int)Class.Max + 1][]; - MultiMap _curvePoints = new MultiMap(); - Dictionary, EmotesTextSoundRecord> _emoteTextSounds = new Dictionary, EmotesTextSoundRecord>(); - Dictionary, ExpectedStatRecord> _expectedStatsByLevel = new Dictionary, ExpectedStatRecord>(); - MultiMap _expectedStatModsByContentTuning = new MultiMap(); - MultiMap _factionTeams = new MultiMap(); - Dictionary _heirlooms = new Dictionary(); - MultiMap _glyphBindableSpells = new MultiMap(); - MultiMap _glyphRequiredSpecs = new MultiMap(); - MultiMap _itemBonusLists = new MultiMap(); - Dictionary _itemLevelDeltaToBonusListContainer = new Dictionary(); - MultiMap _itemBonusTrees = new MultiMap(); - Dictionary _itemChildEquipment = new Dictionary(); + MultiMap _curvePoints = new(); + Dictionary, EmotesTextSoundRecord> _emoteTextSounds = new(); + Dictionary, ExpectedStatRecord> _expectedStatsByLevel = new(); + MultiMap _expectedStatModsByContentTuning = new(); + MultiMap _factionTeams = new(); + Dictionary _heirlooms = new(); + MultiMap _glyphBindableSpells = new(); + MultiMap _glyphRequiredSpecs = new(); + MultiMap _itemBonusLists = new(); + Dictionary _itemLevelDeltaToBonusListContainer = new(); + MultiMap _itemBonusTrees = new(); + Dictionary _itemChildEquipment = new(); ItemClassRecord[] _itemClassByOldEnum = new ItemClassRecord[19]; - List _itemsWithCurrencyCost = new List(); - MultiMap _itemCategoryConditions = new MultiMap(); - MultiMap _itemLevelQualitySelectorQualities = new MultiMap(); - Dictionary _itemModifiedAppearancesByItem = new Dictionary(); - MultiMap _itemToBonusTree = new MultiMap(); - MultiMap _itemSetSpells = new MultiMap(); - MultiMap _itemSpecOverrides = new MultiMap(); - Dictionary> _mapDifficulties = new Dictionary>(); - MultiMap> _mapDifficultyConditions = new MultiMap>(); - Dictionary _mountsBySpellId = new Dictionary(); - MultiMap _mountCapabilitiesByType = new MultiMap(); - MultiMap _mountDisplays = new MultiMap(); - Dictionary[]> _nameGenData = new Dictionary[]>(); + List _itemsWithCurrencyCost = new(); + MultiMap _itemCategoryConditions = new(); + MultiMap _itemLevelQualitySelectorQualities = new(); + Dictionary _itemModifiedAppearancesByItem = new(); + MultiMap _itemToBonusTree = new(); + MultiMap _itemSetSpells = new(); + MultiMap _itemSpecOverrides = new(); + Dictionary> _mapDifficulties = new(); + MultiMap> _mapDifficultyConditions = new(); + Dictionary _mountsBySpellId = new(); + MultiMap _mountCapabilitiesByType = new(); + MultiMap _mountDisplays = new(); + Dictionary[]> _nameGenData = new(); List[] _nameValidators = new List[(int)Locale.Total + 1]; - MultiMap _phasesByGroup = new MultiMap(); - Dictionary _powerTypes = new Dictionary(); - Dictionary _pvpItemBonus = new Dictionary(); + MultiMap _phasesByGroup = new(); + Dictionary _powerTypes = new(); + Dictionary _pvpItemBonus = new(); PvpTalentSlotUnlockRecord[] _pvpTalentSlotUnlock = new PvpTalentSlotUnlockRecord[PlayerConst.MaxPvpTalentSlots]; - Dictionary, List>> _questPackages = new Dictionary, List>>(); - MultiMap _rewardPackCurrencyTypes = new MultiMap(); - MultiMap _rewardPackItems = new MultiMap(); - MultiMap _skillLinesByParentSkillLine = new MultiMap(); - MultiMap _skillLineAbilitiesBySkillupSkill = new MultiMap(); - MultiMap _skillRaceClassInfoBySkill = new MultiMap(); - MultiMap _specializationSpellsBySpec = new MultiMap(); - List> _specsBySpecSet = new List>(); - List _spellFamilyNames = new List(); - MultiMap _spellProcsPerMinuteMods = new MultiMap(); + Dictionary, List>> _questPackages = new(); + MultiMap _rewardPackCurrencyTypes = new(); + MultiMap _rewardPackItems = new(); + MultiMap _skillLinesByParentSkillLine = new(); + MultiMap _skillLineAbilitiesBySkillupSkill = new(); + MultiMap _skillRaceClassInfoBySkill = new(); + MultiMap _specializationSpellsBySpec = new(); + List> _specsBySpecSet = new(); + List _spellFamilyNames = new(); + MultiMap _spellProcsPerMinuteMods = new(); List[][][] _talentsByPosition = new List[(int)Class.Max][][]; - List _toys = new List(); - MultiMap _transmogSetsByItemModifiedAppearance = new MultiMap(); - MultiMap _transmogSetItemsByTransmogSet = new MultiMap(); - Dictionary _uiMapBounds = new Dictionary(); + List _toys = new(); + MultiMap _transmogSetsByItemModifiedAppearance = new(); + MultiMap _transmogSetItemsByTransmogSet = new(); + Dictionary _uiMapBounds = new(); MultiMap[] _uiMapAssignmentByMap = new MultiMap[(int)UiMapSystem.Max]; MultiMap[] _uiMapAssignmentByArea = new MultiMap[(int)UiMapSystem.Max]; MultiMap[] _uiMapAssignmentByWmoDoodadPlacement = new MultiMap[(int)UiMapSystem.Max]; MultiMap[] _uiMapAssignmentByWmoGroup = new MultiMap[(int)UiMapSystem.Max]; - List _uiMapPhases = new List(); - Dictionary, WMOAreaTableRecord> _wmoAreaTableLookup = new Dictionary, WMOAreaTableRecord>(); + List _uiMapPhases = new(); + Dictionary, WMOAreaTableRecord> _wmoAreaTableLookup = new(); } class UiMapBounds @@ -2606,8 +2606,8 @@ namespace Game.DataStorage public class ShapeshiftFormModelData { public uint OptionID; - public List Choices = new List(); - public List Displays = new List(); + public List Choices = new(); + public List Displays = new(); } enum CurveInterpolationMode diff --git a/Source/Game/DataStorage/M2Storage.cs b/Source/Game/DataStorage/M2Storage.cs index c59ae5df7..335f2c773 100644 --- a/Source/Game/DataStorage/M2Storage.cs +++ b/Source/Game/DataStorage/M2Storage.cs @@ -27,7 +27,7 @@ namespace Game.DataStorage // Convert the geomoetry from a spline value, to an actual WoW XYZ static Vector3 TranslateLocation(Vector4 dbcLocation, Vector3 basePosition, Vector3 splineVector) { - Vector3 work = new Vector3(); + Vector3 work = new(); float x = basePosition.X + splineVector.X; float y = basePosition.Y + splineVector.Y; float z = basePosition.Z + splineVector.Z; @@ -46,10 +46,10 @@ namespace Game.DataStorage // Number of cameras not used. Multiple cameras never used in 7.1.5 static void ReadCamera(M2Camera cam, BinaryReader reader, CinematicCameraRecord dbcentry) { - List cameras = new List(); - List targetcam = new List(); + List cameras = new(); + List targetcam = new(); - Vector4 dbcData = new Vector4(dbcentry.Origin.X, dbcentry.Origin.Y, dbcentry.Origin.Z, dbcentry.OriginFacing); + Vector4 dbcData = new(dbcentry.Origin.X, dbcentry.Origin.Y, dbcentry.Origin.Z, dbcentry.OriginFacing); // Read target locations, only so that we can calculate orientation for (uint k = 0; k < cam.target_positions.timestamps.number; ++k) @@ -76,7 +76,7 @@ namespace Game.DataStorage Vector3 newPos = TranslateLocation(dbcData, cam.target_position_base, targPositions[i].p0); // Add to vector - FlyByCamera thisCam = new FlyByCamera(); + FlyByCamera thisCam = new(); thisCam.timeStamp = targTimestamps[i]; thisCam.locations = new Vector4(newPos.X, newPos.Y, newPos.Z, 0.0f); targetcam.Add(thisCam); @@ -108,7 +108,7 @@ namespace Game.DataStorage Vector3 newPos = TranslateLocation(dbcData, cam.position_base, positions[i].p0); // Add to vector - FlyByCamera thisCam = new FlyByCamera(); + FlyByCamera thisCam = new(); thisCam.timeStamp = posTimestamps[i]; thisCam.locations = new Vector4(newPos.X, newPos.Y, newPos.Z, 0); @@ -170,7 +170,7 @@ namespace Game.DataStorage try { - using (BinaryReader m2file = new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.Read))) + using (BinaryReader m2file = new(new FileStream(filename, FileMode.Open, FileAccess.Read))) { // Check file has correct magic (MD21) if (m2file.ReadUInt32() != 0x3132444D) //"MD21" @@ -209,7 +209,7 @@ namespace Game.DataStorage return FlyByCameraStorage.LookupByKey(cameraId); } - static MultiMap FlyByCameraStorage = new MultiMap(); + static MultiMap FlyByCameraStorage = new(); } public class FlyByCamera diff --git a/Source/Game/DungeonFinding/LFGGroupData.cs b/Source/Game/DungeonFinding/LFGGroupData.cs index 60e25005e..653e78b83 100644 --- a/Source/Game/DungeonFinding/LFGGroupData.cs +++ b/Source/Game/DungeonFinding/LFGGroupData.cs @@ -141,7 +141,7 @@ namespace Game.DungeonFinding LfgState m_State; LfgState m_OldState; ObjectGuid m_Leader; - List m_Players = new List(); + List m_Players = new(); // Dungeon uint m_Dungeon; // Vote Kick diff --git a/Source/Game/DungeonFinding/LFGManager.cs b/Source/Game/DungeonFinding/LFGManager.cs index 81ee5fb1e..6cab2f152 100644 --- a/Source/Game/DungeonFinding/LFGManager.cs +++ b/Source/Game/DungeonFinding/LFGManager.cs @@ -43,7 +43,7 @@ namespace Game.DungeonFinding public string ConcatenateDungeons(List dungeons) { - StringBuilder dungeonstr = new StringBuilder(); + StringBuilder dungeonstr = new(); if (!dungeons.Empty()) { foreach (var id in dungeons) @@ -91,7 +91,7 @@ namespace Game.DungeonFinding if (!guid.IsParty()) return; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_LFG_DATA); stmt.AddValue(0, db_guid); @@ -360,8 +360,8 @@ namespace Game.DungeonFinding Group grp = player.GetGroup(); ObjectGuid guid = player.GetGUID(); ObjectGuid gguid = grp ? grp.GetGUID() : guid; - LfgJoinResultData joinData = new LfgJoinResultData(); - List players = new List(); + LfgJoinResultData joinData = new(); + List players = new(); uint rDungeonId = 0; bool isContinue = grp && grp.IsLFGGroup() && GetState(gguid) != LfgState.FinishedDungeon; @@ -496,7 +496,7 @@ namespace Game.DungeonFinding return; } - RideTicket ticket = new RideTicket(); + RideTicket ticket = new(); ticket.RequesterGuid = guid; ticket.Id = GetQueueId(gguid); ticket.Type = RideType.Lfg; @@ -506,7 +506,7 @@ namespace Game.DungeonFinding if (grp) // Begin rolecheck { // Create new rolecheck - LfgRoleCheck roleCheck = new LfgRoleCheck(); + LfgRoleCheck roleCheck = new(); roleCheck.cancelTime = Time.UnixTime + SharedConst.LFGTimeRolecheck; roleCheck.state = LfgRoleCheckState.Initialiting; roleCheck.leader = guid; @@ -523,7 +523,7 @@ namespace Game.DungeonFinding SetState(gguid, LfgState.Rolecheck); // Send update to player - LfgUpdateData updateData = new LfgUpdateData(LfgUpdateType.JoinQueue, dungeons); + LfgUpdateData updateData = new(LfgUpdateType.JoinQueue, dungeons); for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.Next()) { Player plrg = refe.GetSource(); @@ -546,7 +546,7 @@ namespace Game.DungeonFinding } else // Add player to queue { - Dictionary rolesMap = new Dictionary(); + Dictionary rolesMap = new(); rolesMap[guid] = roles; LFGQueue queue = GetQueue(guid); queue.AddQueueData(guid, Time.UnixTime, dungeons, rolesMap); @@ -569,7 +569,7 @@ namespace Game.DungeonFinding player.GetSession().SendLfgJoinResult(joinData); debugNames += player.GetName(); } - StringBuilder o = new StringBuilder(); + StringBuilder o = new(); o.AppendFormat("Join: [{0}] joined ({1}{2}) Members: {3}. Dungeons ({4}): ", guid, (grp ? "group" : "player"), debugNames, dungeons.Count, ConcatenateDungeons(dungeons)); Log.outDebug(LogFilter.Lfg, o.ToString()); } @@ -610,7 +610,7 @@ namespace Game.DungeonFinding case LfgState.Proposal: { // Remove from Proposals - KeyValuePair it = new KeyValuePair(); + KeyValuePair it = new(); ObjectGuid pguid = gguid == guid ? GetLeader(gguid) : guid; foreach (var test in ProposalsStore) { @@ -686,13 +686,13 @@ namespace Game.DungeonFinding } } - List dungeons = new List(); + List dungeons = new(); if (roleCheck.rDungeonId != 0) dungeons.Add(roleCheck.rDungeonId); else dungeons = roleCheck.dungeons; - LfgJoinResultData joinData = new LfgJoinResultData(LfgJoinResult.RoleCheckFailed, roleCheck.state); + LfgJoinResultData joinData = new(LfgJoinResult.RoleCheckFailed, roleCheck.state); foreach (var it in roleCheck.roles) { ObjectGuid pguid = it.Key; @@ -736,8 +736,8 @@ namespace Game.DungeonFinding void GetCompatibleDungeons(List dungeons, List players, Dictionary> lockMap, List playersMissingRequirement, bool isContinue) { lockMap.Clear(); - Dictionary lockedDungeons = new Dictionary(); - List dungeonsToRemove = new List(); + Dictionary lockedDungeons = new(); + List dungeonsToRemove = new(); foreach (var guid in players) { @@ -806,7 +806,7 @@ namespace Game.DungeonFinding byte tank = 0; byte healer = 0; - List keys = new List(groles.Keys); + List keys = new(groles.Keys); for (int i = 0; i < keys.Count; i++) { LfgRoles role = groles[keys[i]] & ~LfgRoles.Leader; @@ -866,8 +866,8 @@ namespace Game.DungeonFinding void MakeNewGroup(LfgProposal proposal) { - List players = new List(); - List playersToTeleport = new List(); + List players = new(); + List playersToTeleport = new(); foreach (var it in proposal.players) { @@ -981,7 +981,7 @@ namespace Game.DungeonFinding long joinTime = Time.UnixTime; LFGQueue queue = GetQueue(guid); - LfgUpdateData updateData = new LfgUpdateData(LfgUpdateType.GroupFound); + LfgUpdateData updateData = new(LfgUpdateType.GroupFound); foreach (var it in proposal.players) { ObjectGuid pguid = it.Key; @@ -1048,7 +1048,7 @@ namespace Game.DungeonFinding it.Value.accept = LfgAnswer.Deny; // Mark players/groups to be removed - List toRemove = new List(); + List toRemove = new(); foreach (var it in proposal.players) { if (it.Value.accept == LfgAnswer.Agree) @@ -1073,7 +1073,7 @@ namespace Game.DungeonFinding if (toRemove.Contains(gguid)) // Didn't accept or in same group that someone that didn't accept { - LfgUpdateData updateData = new LfgUpdateData(); + LfgUpdateData updateData = new(); if (it.Value.accept == LfgAnswer.Deny) { updateData.updateType = type; @@ -1369,7 +1369,7 @@ namespace Game.DungeonFinding // Give rewards string doneString = done ? "" : "not"; Log.outDebug(LogFilter.Lfg, $"Group: {gguid}, Player: {guid} done dungeon {GetDungeon(gguid)}, {doneString} previously done."); - LfgPlayerRewardData data = new LfgPlayerRewardData(dungeon.Entry(), GetDungeon(gguid, false), done, quest); + LfgPlayerRewardData data = new(dungeon.Entry(), GetDungeon(gguid, false), done, quest); player.GetSession().SendLfgPlayerReward(data); } } @@ -1509,7 +1509,7 @@ namespace Game.DungeonFinding public Dictionary GetLockedDungeons(ObjectGuid guid) { - Dictionary lockDic = new Dictionary(); + Dictionary lockDic = new(); Player player = Global.ObjAccessor.FindConnectedPlayer(guid); if (!player) { @@ -1940,7 +1940,7 @@ namespace Game.DungeonFinding public void SetupGroupMember(ObjectGuid guid, ObjectGuid gguid) { - List dungeons = new List(); + List dungeons = new(); dungeons.Add(GetDungeon(gguid)); SetSelectedDungeons(guid, dungeons); SetState(guid, GetState(gguid)); @@ -1995,7 +1995,7 @@ namespace Game.DungeonFinding public List GetRandomAndSeasonalDungeons(uint level, uint expansion, uint contentTuningReplacementConditionMask) { - List randomDungeons = new List(); + List randomDungeons = new(); foreach (var dungeon in LfgDungeonStore.Values) { if (!(dungeon.type == LfgType.RandomDungeon || (dungeon.seasonal && Global.LFGMgr.IsSeasonActive(dungeon.id)))) @@ -2019,17 +2019,17 @@ namespace Game.DungeonFinding uint m_lfgProposalId; //< used as internal counter for proposals LfgOptions m_options; //< Stores config options - Dictionary QueuesStore = new Dictionary(); //< Queues - MultiMap CachedDungeonMapStore = new MultiMap(); //< Stores all dungeons by groupType + Dictionary QueuesStore = new(); //< Queues + MultiMap CachedDungeonMapStore = new(); //< Stores all dungeons by groupType // Reward System - MultiMap RewardMapStore = new MultiMap(); //< Stores rewards for random dungeons - Dictionary LfgDungeonStore = new Dictionary(); + MultiMap RewardMapStore = new(); //< Stores rewards for random dungeons + Dictionary LfgDungeonStore = new(); // Rolecheck - Proposal - Vote Kicks - Dictionary RoleChecksStore = new Dictionary(); //< Current Role checks - Dictionary ProposalsStore = new Dictionary(); //< Current Proposals - Dictionary BootsStore = new Dictionary(); //< Current player kicks - Dictionary PlayersStore = new Dictionary(); //< Player data - Dictionary GroupsStore = new Dictionary(); //< Group data + Dictionary RoleChecksStore = new(); //< Current Role checks + Dictionary ProposalsStore = new(); //< Current Proposals + Dictionary BootsStore = new(); //< Current player kicks + Dictionary PlayersStore = new(); //< Player data + Dictionary GroupsStore = new(); //< Group data } public class LfgJoinResultData @@ -2042,8 +2042,8 @@ namespace Game.DungeonFinding public LfgJoinResult result; public LfgRoleCheckState state; - public Dictionary> lockmap = new Dictionary>(); - public List playersMissingRequirement = new List(); + public Dictionary> lockmap = new(); + public List playersMissingRequirement = new(); } public class LfgUpdateData @@ -2068,7 +2068,7 @@ namespace Game.DungeonFinding public LfgUpdateType updateType; public LfgState state; - public List dungeons = new List(); + public List dungeons = new(); } public class LfgQueueStatusData @@ -2168,17 +2168,17 @@ namespace Game.DungeonFinding public long cancelTime; public uint encounters; public bool isNew; - public List queues = new List(); - public List showorder = new List(); - public Dictionary players = new Dictionary(); // Players data + public List queues = new(); + public List showorder = new(); + public Dictionary players = new(); // Players data } public class LfgRoleCheck { public long cancelTime; - public Dictionary roles = new Dictionary(); + public Dictionary roles = new(); public LfgRoleCheckState state; - public List dungeons = new List(); + public List dungeons = new(); public uint rDungeonId; public ObjectGuid leader; } @@ -2187,7 +2187,7 @@ namespace Game.DungeonFinding { public long cancelTime; public bool inProgress; - public Dictionary votes = new Dictionary(); + public Dictionary votes = new(); public ObjectGuid victim; public string reason; } diff --git a/Source/Game/DungeonFinding/LFGPlayerData.cs b/Source/Game/DungeonFinding/LFGPlayerData.cs index 3356dcb5c..8b0b199a0 100644 --- a/Source/Game/DungeonFinding/LFGPlayerData.cs +++ b/Source/Game/DungeonFinding/LFGPlayerData.cs @@ -126,6 +126,6 @@ namespace Game.DungeonFinding // Queue LfgRoles m_Roles; - List m_SelectedDungeons = new List(); + List m_SelectedDungeons = new(); } } diff --git a/Source/Game/DungeonFinding/LFGQueue.cs b/Source/Game/DungeonFinding/LFGQueue.cs index 36e2e6c2d..81da83709 100644 --- a/Source/Game/DungeonFinding/LFGQueue.cs +++ b/Source/Game/DungeonFinding/LFGQueue.cs @@ -32,7 +32,7 @@ namespace Game.DungeonFinding return ""; // need the guids in order to avoid duplicates - StringBuilder val = new StringBuilder(); + StringBuilder val = new(); guids.Sort(); var it = guids.First(); val.Append(it); @@ -48,7 +48,7 @@ namespace Game.DungeonFinding public static string GetRolesString(LfgRoles roles) { - StringBuilder rolesstr = new StringBuilder(); + StringBuilder rolesstr = new(); if (roles.HasAnyFlag(LfgRoles.Tank)) rolesstr.Append("Tank"); @@ -276,7 +276,7 @@ namespace Game.DungeonFinding public byte FindGroups() { byte proposals = 0; - List firstNew = new List(); + List firstNew = new(); while (!newToQueueStore.Empty()) { ObjectGuid frontguid = newToQueueStore.First(); @@ -285,7 +285,7 @@ namespace Game.DungeonFinding firstNew.Add(frontguid); RemoveFromNewQueue(frontguid); - List temporalList = new List(currentQueueStore); + List temporalList = new(currentQueueStore); LfgCompatibility compatibles = FindNewGroups(firstNew, temporalList); if (compatibles == LfgCompatibility.Match) @@ -331,10 +331,10 @@ namespace Game.DungeonFinding LfgCompatibility CheckCompatibility(List check) { string strGuids = ConcatenateGuids(check); - LfgProposal proposal = new LfgProposal(); + LfgProposal proposal = new(); List proposalDungeons; - Dictionary proposalGroups = new Dictionary(); - Dictionary proposalRoles = new Dictionary(); + Dictionary proposalGroups = new(); + Dictionary proposalRoles = new(); // Check for correct size if (check.Count > MapConst.MaxGroupSize || check.Empty()) @@ -397,7 +397,7 @@ namespace Game.DungeonFinding var guid = check.First(); var itQueue = QueueDataStore.LookupByKey(guid); - LfgCompatibilityData data = new LfgCompatibilityData(LfgCompatibility.WithLessPlayers); + LfgCompatibilityData data = new(LfgCompatibility.WithLessPlayers); data.roles = itQueue.roles; Global.LFGMgr.CheckGroupRoles(data.roles); @@ -428,7 +428,7 @@ namespace Game.DungeonFinding Dictionary roles = QueueDataStore[it].roles; foreach (var rolePair in roles) { - KeyValuePair itPlayer = new KeyValuePair(); + KeyValuePair itPlayer = new(); foreach (var _player in proposalRoles) { itPlayer = _player; @@ -497,7 +497,7 @@ namespace Game.DungeonFinding if (numPlayers != MapConst.MaxGroupSize) { Log.outDebug(LogFilter.Lfg, "CheckCompatibility: ({0}) Compatibles but not enough players({1})", strGuids, numPlayers); - LfgCompatibilityData data = new LfgCompatibilityData(LfgCompatibility.WithLessPlayers); + LfgCompatibilityData data = new(LfgCompatibility.WithLessPlayers); data.roles = proposalRoles; foreach (var guid in check) @@ -541,7 +541,7 @@ namespace Game.DungeonFinding proposal.leader = rolePair.Key; // Assing player data and roles - LfgProposalPlayer data = new LfgProposalPlayer(); + LfgProposalPlayer data = new(); data.role = rolePair.Value; data.group = proposalGroups.LookupByKey(rolePair.Key); if (!proposal.isNew && !data.group.IsEmpty() && data.group == proposal.group) // Player from existing group, autoaccept @@ -615,7 +615,7 @@ namespace Game.DungeonFinding if (string.IsNullOrEmpty(queueinfo.bestCompatible)) FindBestCompatibleInQueue(itQueue.Key, itQueue.Value); - LfgQueueStatusData queueData = new LfgQueueStatusData(queueId, dungeonId, waitTime, wtAvg, wtTank, wtHealer, wtDps, queuedTime, queueinfo.tanks, queueinfo.healers, queueinfo.dps); + LfgQueueStatusData queueData = new(queueId, dungeonId, waitTime, wtAvg, wtTank, wtHealer, wtDps, queuedTime, queueinfo.tanks, queueinfo.healers, queueinfo.dps); foreach (var itPlayer in queueinfo.roles) { ObjectGuid pguid = itPlayer.Key; @@ -708,15 +708,15 @@ namespace Game.DungeonFinding } // Queue - Dictionary QueueDataStore = new Dictionary(); - Dictionary CompatibleMapStore = new Dictionary(); + Dictionary QueueDataStore = new(); + Dictionary CompatibleMapStore = new(); - Dictionary waitTimesAvgStore = new Dictionary(); - Dictionary waitTimesTankStore = new Dictionary(); - Dictionary waitTimesHealerStore = new Dictionary(); - Dictionary waitTimesDpsStore = new Dictionary(); - List currentQueueStore = new List(); - List newToQueueStore = new List(); + Dictionary waitTimesAvgStore = new(); + Dictionary waitTimesTankStore = new(); + Dictionary waitTimesHealerStore = new(); + Dictionary waitTimesDpsStore = new(); + List currentQueueStore = new(); + List newToQueueStore = new(); } public class LfgCompatibilityData diff --git a/Source/Game/Entities/AreaTrigger/AreaTrigger.cs b/Source/Game/Entities/AreaTrigger/AreaTrigger.cs index ca8f0b0de..80b0321d5 100644 --- a/Source/Game/Entities/AreaTrigger/AreaTrigger.cs +++ b/Source/Game/Entities/AreaTrigger/AreaTrigger.cs @@ -127,12 +127,12 @@ namespace Game.Entities SetUpdateFieldValue(extraScaleCurve.ModifyValue(extraScaleCurve.StartTimeOffset), GetMiscTemplate().ExtraScale.Structured.StartTimeOffset); if (GetMiscTemplate().ExtraScale.Structured.X != 0 || GetMiscTemplate().ExtraScale.Structured.Y != 0) { - Vector2 point = new Vector2(GetMiscTemplate().ExtraScale.Structured.X, GetMiscTemplate().ExtraScale.Structured.Y); + Vector2 point = new(GetMiscTemplate().ExtraScale.Structured.X, GetMiscTemplate().ExtraScale.Structured.Y); SetUpdateFieldValue(ref extraScaleCurve.ModifyValue(extraScaleCurve.Points, 0), point); } if (GetMiscTemplate().ExtraScale.Structured.Z != 0 || GetMiscTemplate().ExtraScale.Structured.W != 0) { - Vector2 point = new Vector2(GetMiscTemplate().ExtraScale.Structured.Z, GetMiscTemplate().ExtraScale.Structured.W); + Vector2 point = new(GetMiscTemplate().ExtraScale.Structured.Z, GetMiscTemplate().ExtraScale.Structured.W); SetUpdateFieldValue(ref extraScaleCurve.ModifyValue(extraScaleCurve.Points, 1), point); } unsafe @@ -205,7 +205,7 @@ namespace Game.Entities public static AreaTrigger CreateAreaTrigger(uint spellMiscId, Unit caster, Unit target, SpellInfo spell, Position pos, int duration, SpellCastVisualField spellVisual, ObjectGuid castId = default, AuraEffect aurEff = null) { - AreaTrigger at = new AreaTrigger(); + AreaTrigger at = new(); if (!at.Create(spellMiscId, caster, target, spell, pos, duration, spellVisual, castId, aurEff)) return null; @@ -327,7 +327,7 @@ namespace Game.Entities void UpdateTargetList() { - List targetList = new List(); + List targetList = new(); switch (GetTemplate().TriggerType) { @@ -405,7 +405,7 @@ namespace Game.Entities float minZ = GetPositionZ() - halfExtentsZ; float maxZ = GetPositionZ() + halfExtentsZ; - AxisAlignedBox box = new AxisAlignedBox(new Vector3(minX, minY, minZ), new Vector3(maxX, maxY, maxZ)); + AxisAlignedBox box = new(new Vector3(minX, minY, minZ), new Vector3(maxX, maxY, maxZ)); targetList.RemoveAll(unit => !box.contains(new Vector3(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZ()))); } @@ -437,7 +437,7 @@ namespace Game.Entities List exitUnits = _insideUnits; _insideUnits.Clear(); - List enteringUnits = new List(); + List enteringUnits = new(); foreach (Unit unit in newTargetList) { @@ -668,7 +668,7 @@ namespace Game.Entities float angleCos = (float)Math.Cos(GetOrientation()); // This is needed to rotate the spline, following caster orientation - List rotatedPoints = new List(); + List rotatedPoints = new(); for (var i = 0; i < offsets.Count; ++i) { Vector3 offset = offsets[i]; @@ -715,12 +715,12 @@ namespace Game.Entities { if (_reachedDestination) { - AreaTriggerRePath reshapeDest = new AreaTriggerRePath(); + AreaTriggerRePath reshapeDest = new(); reshapeDest.TriggerGUID = GetGUID(); SendMessageToSet(reshapeDest, true); } - AreaTriggerRePath reshape = new AreaTriggerRePath(); + AreaTriggerRePath reshape = new(); reshape.TriggerGUID = GetGUID(); reshape.AreaTriggerSpline.HasValue = true; reshape.AreaTriggerSpline.Value.ElapsedTimeForMovement = GetElapsedTimeForMovement(); @@ -751,7 +751,7 @@ namespace Game.Entities if (IsInWorld) { - AreaTriggerRePath reshape = new AreaTriggerRePath(); + AreaTriggerRePath reshape = new(); reshape.TriggerGUID = GetGUID(); reshape.AreaTriggerOrbit = _orbitInfo; @@ -919,7 +919,7 @@ namespace Game.Entities public override void BuildValuesCreate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt8((byte)flags); m_objectData.WriteCreate(buffer, flags, this, target); @@ -932,7 +932,7 @@ namespace Game.Entities public override void BuildValuesUpdate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(m_values.GetChangedObjectTypeMask()); if (m_values.HasChanged(TypeId.Object)) @@ -947,14 +947,14 @@ namespace Game.Entities void BuildValuesUpdateForPlayerWithMask(UpdateData data, UpdateMask requestedObjectMask, UpdateMask requestedAreaTriggerMask, Player target) { - UpdateMask valuesMask = new UpdateMask((int)TypeId.Max); + UpdateMask valuesMask = new((int)TypeId.Max); if (requestedObjectMask.IsAnySet()) valuesMask.Set((int)TypeId.Object); if (requestedAreaTriggerMask.IsAnySet()) valuesMask.Set((int)TypeId.AreaTrigger); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(valuesMask.GetBlock(0)); if (valuesMask[(int)TypeId.Object]) @@ -963,7 +963,7 @@ namespace Game.Entities if (valuesMask[(int)TypeId.AreaTrigger]) m_areaTriggerData.WriteUpdate(buffer, requestedAreaTriggerMask, true, this, target); - WorldPacket buffer1 = new WorldPacket(); + WorldPacket buffer1 = new(); buffer1.WriteUInt8((byte)UpdateType.Values); buffer1.WritePackedGuid(GetGUID()); buffer1.WriteUInt32(buffer.GetSize()); @@ -1054,7 +1054,7 @@ namespace Game.Entities AreaTriggerMiscTemplate _areaTriggerMiscTemplate; AreaTriggerTemplate _areaTriggerTemplate; - List _insideUnits = new List(); + List _insideUnits = new(); AreaTriggerAI _ai; } diff --git a/Source/Game/Entities/AreaTrigger/AreaTriggerTemplate.cs b/Source/Game/Entities/AreaTrigger/AreaTriggerTemplate.cs index 698eed98f..149d83e26 100644 --- a/Source/Game/Entities/AreaTrigger/AreaTriggerTemplate.cs +++ b/Source/Game/Entities/AreaTrigger/AreaTriggerTemplate.cs @@ -272,9 +272,9 @@ namespace Game.Entities public uint ScriptId; public float MaxSearchRadius; - public List PolygonVertices = new List(); - public List PolygonVerticesTarget = new List(); - public List Actions = new List(); + public List PolygonVertices = new(); + public List PolygonVerticesTarget = new(); + public List Actions = new(); } public unsafe class AreaTriggerMiscTemplate @@ -305,12 +305,12 @@ namespace Game.Entities public uint TimeToTarget; public uint TimeToTargetScale; - public AreaTriggerScaleInfo OverrideScale = new AreaTriggerScaleInfo(); - public AreaTriggerScaleInfo ExtraScale = new AreaTriggerScaleInfo(); + public AreaTriggerScaleInfo OverrideScale = new(); + public AreaTriggerScaleInfo ExtraScale = new(); public AreaTriggerOrbitInfo OrbitInfo; public AreaTriggerTemplate Template; - public List SplinePoints = new List(); + public List SplinePoints = new(); } public class AreaTriggerSpawn diff --git a/Source/Game/Entities/Conversation.cs b/Source/Game/Entities/Conversation.cs index a68378240..f5d27e613 100644 --- a/Source/Game/Entities/Conversation.cs +++ b/Source/Game/Entities/Conversation.cs @@ -104,7 +104,7 @@ namespace Game.Entities ulong lowGuid = creator.GetMap().GenerateLowGuid(HighGuid.Conversation); - Conversation conversation = new Conversation(); + Conversation conversation = new(); if (!conversation.Create(lowGuid, conversationEntry, creator.GetMap(), creator, pos, participants, spellInfo)) return null; @@ -139,7 +139,7 @@ namespace Game.Entities { if (actor != null) { - ConversationActor actorField = new ConversationActor(); + ConversationActor actorField = new(); actorField.CreatureID = actor.CreatureId; actorField.CreatureDisplayInfoID = actor.CreatureModelId; actorField.Id = (int)actor.Id; @@ -168,13 +168,13 @@ namespace Game.Entities Global.ScriptMgr.OnConversationCreate(this, creator); - List actorIndices = new List(); - List lines = new List(); + List actorIndices = new(); + List lines = new(); foreach (ConversationLineTemplate line in conversationTemplate.Lines) { actorIndices.Add(line.ActorIdx); - ConversationLine lineField = new ConversationLine(); + ConversationLine lineField = new(); lineField.ConversationLineID = line.Id; lineField.StartTime = line.StartTime; lineField.UiCameraID = line.UiCameraID; @@ -225,7 +225,7 @@ namespace Game.Entities public override void BuildValuesCreate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); m_objectData.WriteCreate(buffer, flags, this, target); m_conversationData.WriteCreate(buffer, flags, this, target); @@ -238,7 +238,7 @@ namespace Game.Entities public override void BuildValuesUpdate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(m_values.GetChangedObjectTypeMask()); if (m_values.HasChanged(TypeId.Object)) @@ -253,14 +253,14 @@ namespace Game.Entities void BuildValuesUpdateForPlayerWithMask(UpdateData data, UpdateMask requestedObjectMask, UpdateMask requestedConversationMask, Player target) { - UpdateMask valuesMask = new UpdateMask((int)TypeId.Max); + UpdateMask valuesMask = new((int)TypeId.Max); if (requestedObjectMask.IsAnySet()) valuesMask.Set((int)TypeId.Object); if (requestedConversationMask.IsAnySet()) valuesMask.Set((int)TypeId.Conversation); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(valuesMask.GetBlock(0)); if (valuesMask[(int)TypeId.Object]) @@ -269,7 +269,7 @@ namespace Game.Entities if (valuesMask[(int)TypeId.Conversation]) m_conversationData.WriteUpdate(buffer, requestedConversationMask, true, this, target); - WorldPacket buffer1 = new WorldPacket(); + WorldPacket buffer1 = new(); buffer1.WriteUInt8((byte)UpdateType.Values); buffer1.WritePackedGuid(GetGUID()); buffer1.WriteUInt32(buffer.GetSize()); @@ -297,10 +297,10 @@ namespace Game.Entities ConversationData m_conversationData; - Position _stationaryPosition = new Position(); + Position _stationaryPosition = new(); ObjectGuid _creatorGuid; uint _duration; uint _textureKitId; - List _participants = new List(); + List _participants = new(); } } diff --git a/Source/Game/Entities/Corpse.cs b/Source/Game/Entities/Corpse.cs index 582106079..e21fb6275 100644 --- a/Source/Game/Entities/Corpse.cs +++ b/Source/Game/Entities/Corpse.cs @@ -94,10 +94,10 @@ namespace Game.Entities public void SaveToDB() { // prevent DB data inconsistence problems and duplicates - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); DeleteFromDB(trans); - StringBuilder items = new StringBuilder(); + StringBuilder items = new(); for (var i = 0; i < EquipmentSlot.End; ++i) items.Append($"{m_corpseData.Items[i]} "); @@ -178,7 +178,7 @@ namespace Game.Entities SetObjectScale(1.0f); SetDisplayId(field.Read(5)); - StringArray items = new StringArray(field.Read(6), ' '); + StringArray items = new(field.Read(6), ' '); for (uint index = 0; index < EquipmentSlot.End; ++index) SetItem(index, uint.Parse(items[(int)index])); @@ -225,7 +225,7 @@ namespace Game.Entities public override void BuildValuesCreate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); m_objectData.WriteCreate(buffer, flags, this, target); m_corpseData.WriteCreate(buffer, flags, this, target); @@ -238,7 +238,7 @@ namespace Game.Entities public override void BuildValuesUpdate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(m_values.GetChangedObjectTypeMask()); if (m_values.HasChanged(TypeId.Object)) @@ -253,14 +253,14 @@ namespace Game.Entities void BuildValuesUpdateForPlayerWithMask(UpdateData data, UpdateMask requestedObjectMask, UpdateMask requestedCorpseMask, Player target) { - UpdateMask valuesMask = new UpdateMask((int)TypeId.Max); + UpdateMask valuesMask = new((int)TypeId.Max); if (requestedObjectMask.IsAnySet()) valuesMask.Set((int)TypeId.Object); if (requestedCorpseMask.IsAnySet()) valuesMask.Set((int)TypeId.Corpse); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(valuesMask.GetBlock(0)); if (valuesMask[(int)TypeId.Object]) @@ -269,7 +269,7 @@ namespace Game.Entities if (valuesMask[(int)TypeId.Corpse]) m_corpseData.WriteUpdate(buffer, requestedCorpseMask, true, this, target); - WorldPacket buffer1 = new WorldPacket(); + WorldPacket buffer1 = new(); buffer1.WriteUInt8((byte)UpdateType.Values); buffer1.WritePackedGuid(GetGUID()); buffer1.WriteUInt32(buffer.GetSize()); @@ -320,7 +320,7 @@ namespace Game.Entities public CorpseData m_corpseData; - public Loot loot = new Loot(); + public Loot loot = new(); public Player lootRecipient; CorpseType m_type; diff --git a/Source/Game/Entities/Creature/Creature.Fields.cs b/Source/Game/Entities/Creature/Creature.Fields.cs index 9e7e37ecf..d5c086135 100644 --- a/Source/Game/Entities/Creature/Creature.Fields.cs +++ b/Source/Game/Entities/Creature/Creature.Fields.cs @@ -34,7 +34,7 @@ namespace Game.Entities float m_suppressedOrientation; // Stores the creature's "real" orientation while casting long _lastDamagedTime; // Part of Evade mechanics - MultiMap m_textRepeat = new MultiMap(); + MultiMap m_textRepeat = new(); // Regenerate health bool _regenerateHealth; // Set on creation @@ -61,7 +61,7 @@ namespace Game.Entities public uint m_originalEntry; Position m_homePosition; - Position m_transportHomePosition = new Position(); + Position m_transportHomePosition = new(); bool DisableReputationGain; @@ -90,9 +90,9 @@ namespace Game.Entities uint m_combatPulseDelay; // (secs) how often the creature puts the entire zone in combat (only works in dungeons) // vendor items - List m_vendorItemCounts = new List(); + List m_vendorItemCounts = new(); - public Loot loot = new Loot(); + public Loot loot = new(); public uint m_groupLootTimer; // (msecs)timer used for group loot public ObjectGuid lootingGroupLowGUID; // used to find group which is looting corpse ObjectGuid m_lootRecipient; diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index 5f55ae237..0b6a69f91 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -798,7 +798,7 @@ namespace Game.Entities else lowGuid = map.GenerateLowGuid(HighGuid.Creature); - Creature creature = new Creature(); + Creature creature = new(); if (!creature.Create(lowGuid, map, entry, pos, null, vehId)) return null; @@ -807,7 +807,7 @@ namespace Game.Entities public static Creature CreateCreatureFromDB(ulong spawnId, Map map, bool addToMap = true, bool allowDuplicate = false) { - Creature creature = new Creature(); + Creature creature = new(); if (!creature.LoadFromDB(spawnId, map, addToMap, allowDuplicate)) return null; @@ -1181,7 +1181,7 @@ namespace Game.Entities data.phaseGroup = GetDBPhase() < 0 ? (uint)-GetDBPhase() : data.phaseGroup; // update in DB - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_CREATURE); stmt.AddValue(0, m_spawnId); @@ -1500,7 +1500,7 @@ namespace Game.Entities GetMap().RemoveRespawnTime(SpawnObjectType.Creature, m_spawnId); Global.ObjectMgr.DeleteCreatureData(m_spawnId); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_CREATURE); stmt.AddValue(0, m_spawnId); @@ -1772,7 +1772,7 @@ namespace Game.Entities SetDeathState(DeathState.JustRespawned); - CreatureModel display = new CreatureModel(GetNativeDisplayId(), GetNativeDisplayScale(), 1.0f); + CreatureModel display = new(GetNativeDisplayId(), GetNativeDisplayScale(), 1.0f); if (Global.ObjectMgr.GetCreatureModelRandomGender(ref display, GetCreatureTemplate()) != null) { SetDisplayId(display.CreatureDisplayID, display.DisplayScale); @@ -1977,7 +1977,7 @@ namespace Game.Entities public void SendAIReaction(AiReaction reactionType) { - AIReaction packet = new AIReaction(); + AIReaction packet = new(); packet.UnitGUID = GetGUID(); packet.Reaction = reactionType; @@ -1995,7 +1995,7 @@ namespace Game.Entities if (radius > 0) { - List assistList = new List(); + List assistList = new(); var u_check = new AnyAssistCreatureInRangeCheck(this, GetVictim(), radius); var searcher = new CreatureListSearcher(this, assistList, u_check); @@ -2003,7 +2003,7 @@ namespace Game.Entities if (!assistList.Empty()) { - AssistDelayEvent e = new AssistDelayEvent(GetVictim().GetGUID(), this); + AssistDelayEvent e = new(GetVictim().GetGUID(), this); while (!assistList.Empty()) { // Pushing guids because in delay can happen some creature gets despawned @@ -2271,7 +2271,7 @@ namespace Game.Entities { Team enemy_team = attacker.GetTeam(); - ZoneUnderAttack packet = new ZoneUnderAttack(); + ZoneUnderAttack packet = new(); packet.AreaID = (int)GetAreaId(); Global.WorldMgr.SendGlobalMessage(packet, null, (enemy_team == Team.Alliance ? Team.Horde : Team.Alliance)); } @@ -2969,7 +2969,7 @@ namespace Game.Entities // If an alive instance of this spawnId is already found, skip creation // If only dead instance(s) exist, despawn them and spawn a new (maybe also dead) version var creatureBounds = map.GetCreatureBySpawnIdStore().LookupByKey(spawnId); - List despawnList = new List(); + List despawnList = new(); foreach (var creature in creatureBounds) { @@ -3305,7 +3305,7 @@ namespace Game.Entities ObjectGuid m_victim; - List m_assistants = new List(); + List m_assistants = new(); Unit m_owner; } diff --git a/Source/Game/Entities/Creature/CreatureData.cs b/Source/Game/Entities/Creature/CreatureData.cs index 9291d0ca4..7cf74045b 100644 --- a/Source/Game/Entities/Creature/CreatureData.cs +++ b/Source/Game/Entities/Creature/CreatureData.cs @@ -30,7 +30,7 @@ namespace Game.Entities public uint Entry; public uint[] DifficultyEntry = new uint[SharedConst.MaxCreatureDifficulties]; public uint[] KillCredit = new uint[SharedConst.MaxCreatureKillCredit]; - public List Models = new List(); + public List Models = new(); public string Name; public string FemaleName; public string SubName; @@ -38,7 +38,7 @@ namespace Game.Entities public string IconName; public uint GossipMenuId; public short Minlevel; - public Dictionary scalingStorage = new Dictionary(); + public Dictionary scalingStorage = new(); public short Maxlevel; public int HealthScalingExpansion; public uint RequiredExpansion; @@ -235,7 +235,7 @@ namespace Game.Entities QueryData.CreatureID = Entry; QueryData.Allow = true; - CreatureStats stats = new CreatureStats(); + CreatureStats stats = new(); stats.Leader = RacialLeader; stats.Name[0] = Name; @@ -308,10 +308,10 @@ namespace Game.Entities public class CreatureLocale { - public StringArray Name = new StringArray((int)Locale.Total); - public StringArray NameAlt = new StringArray((int)Locale.Total); - public StringArray Title = new StringArray((int)Locale.Total); - public StringArray TitleAlt = new StringArray((int)Locale.Total); + public StringArray Name = new((int)Locale.Total); + public StringArray NameAlt = new((int)Locale.Total); + public StringArray Title = new((int)Locale.Total); + public StringArray TitleAlt = new((int)Locale.Total); } public struct EquipmentItem @@ -355,8 +355,8 @@ namespace Game.Entities public class CreatureModel { - public static CreatureModel DefaultInvisibleModel = new CreatureModel(11686, 1.0f, 1.0f); - public static CreatureModel DefaultVisibleModel = new CreatureModel(17519, 1.0f, 1.0f); + public static CreatureModel DefaultInvisibleModel = new(11686, 1.0f, 1.0f); + public static CreatureModel DefaultVisibleModel = new(17519, 1.0f, 1.0f); public uint CreatureDisplayID; public float DisplayScale; @@ -402,7 +402,7 @@ namespace Game.Entities public uint incrtime; // time for restore items amount if maxcount != 0 public uint ExtendedCost; public ItemVendorType Type; - public List BonusListIDs = new List(); + public List BonusListIDs = new(); public uint PlayerConditionId; public bool IgnoreFiltering; @@ -412,7 +412,7 @@ namespace Game.Entities public class VendorItemData { - List m_items = new List(); + List m_items = new(); public VendorItem GetItem(uint slot) { diff --git a/Source/Game/Entities/Creature/CreatureGroups.cs b/Source/Game/Entities/Creature/CreatureGroups.cs index 3beb33eb1..85174246e 100644 --- a/Source/Game/Entities/Creature/CreatureGroups.cs +++ b/Source/Game/Entities/Creature/CreatureGroups.cs @@ -43,7 +43,7 @@ namespace Game.Entities else { Log.outDebug(LogFilter.Unit, "Group not found: {0}. Creating new group.", leaderGuid); - CreatureGroup group = new CreatureGroup(leaderGuid); + CreatureGroup group = new(leaderGuid); map.CreatureGroupHolder[leaderGuid] = group; group.AddMember(member); } @@ -126,7 +126,7 @@ namespace Game.Entities Log.outInfo(LogFilter.ServerLoading, "Loaded {0} creatures in formations in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime)); } - public static Dictionary CreatureGroupMap = new Dictionary(); + public static Dictionary CreatureGroupMap = new(); } public class FormationInfo @@ -251,7 +251,7 @@ namespace Game.Entities if (!member.IsFlying()) member.UpdateGroundPositionZ(dx, dy, ref dz); - Position point = new Position(dx, dy, dz, destination.GetOrientation()); + Position point = new(dx, dy, dz, destination.GetOrientation()); member.GetMotionMaster().MoveFormation(id, point, moveType, !member.IsWithinDist(m_leader, dist + 5.0f), orientation); member.SetHomePosition(dx, dy, dz, pathangle); @@ -279,7 +279,7 @@ namespace Game.Entities public bool IsLeader(Creature creature) { return m_leader == creature; } Creature m_leader; - Dictionary m_members = new Dictionary(); + Dictionary m_members = new(); ulong m_groupID; bool m_Formed; diff --git a/Source/Game/Entities/Creature/Gossip.cs b/Source/Game/Entities/Creature/Gossip.cs index c45079cfa..7c98b4023 100644 --- a/Source/Game/Entities/Creature/Gossip.cs +++ b/Source/Game/Entities/Creature/Gossip.cs @@ -49,7 +49,7 @@ namespace Game.Misc } } - GossipMenuItem menuItem = new GossipMenuItem(); + GossipMenuItem menuItem = new(); menuItem.MenuItemIcon = (byte)icon; menuItem.Message = message; @@ -131,7 +131,7 @@ namespace Game.Misc public void AddGossipMenuItemData(uint optionIndex, uint gossipActionMenuId, uint gossipActionPoi) { - GossipMenuItemData itemData = new GossipMenuItemData(); + GossipMenuItemData itemData = new(); itemData.GossipActionMenuId = gossipActionMenuId; itemData.GossipActionPoi = gossipActionPoi; @@ -208,8 +208,8 @@ namespace Game.Misc return _menuItems; } - Dictionary _menuItems = new Dictionary(); - Dictionary _menuItemData = new Dictionary(); + Dictionary _menuItems = new(); + Dictionary _menuItemData = new(); uint _menuId; Locale _locale; } @@ -247,14 +247,14 @@ namespace Game.Misc _interactionData.Reset(); _interactionData.SourceGuid = objectGUID; - GossipMessagePkt packet = new GossipMessagePkt(); + GossipMessagePkt packet = new(); packet.GossipGUID = objectGUID; packet.GossipID = (int)_gossipMenu.GetMenuId(); packet.TextID = (int)titleTextId; foreach (var pair in _gossipMenu.GetMenuItems()) { - ClientGossipOptions opt = new ClientGossipOptions(); + ClientGossipOptions opt = new(); GossipMenuItem item = pair.Value; opt.ClientOption = (int)pair.Key; opt.OptionNPC = item.MenuItemIcon; @@ -274,7 +274,7 @@ namespace Game.Misc Quest quest = Global.ObjectMgr.GetQuestTemplate(questID); if (quest != null) { - ClientGossipText text = new ClientGossipText(); + ClientGossipText text = new(); text.QuestID = questID; text.ContentTuningID = quest.ContentTuningId; text.QuestType = item.QuestIcon; @@ -314,7 +314,7 @@ namespace Game.Misc return; } - GossipPOI packet = new GossipPOI(); + GossipPOI packet = new(); packet.Id = pointOfInterest.Id; packet.Name = pointOfInterest.Name; @@ -339,7 +339,7 @@ namespace Game.Misc ObjectGuid guid = questgiver.GetGUID(); Locale localeConstant = _session.GetSessionDbLocaleIndex(); - QuestGiverQuestListMessage questList = new QuestGiverQuestListMessage(); + QuestGiverQuestListMessage questList = new(); questList.QuestGiverGUID = guid; QuestGreeting questGreeting = Global.ObjectMgr.GetQuestGreeting(questgiver.GetTypeId(), questgiver.GetEntry()); @@ -365,7 +365,7 @@ namespace Game.Misc Quest quest = Global.ObjectMgr.GetQuestTemplate(questID); if (quest != null) { - ClientGossipText text = new ClientGossipText(); + ClientGossipText text = new(); text.QuestID = questID; text.ContentTuningID = quest.ContentTuningId; text.QuestType = questMenuItem.QuestIcon; @@ -399,7 +399,7 @@ namespace Game.Misc public void SendQuestGiverQuestDetails(Quest quest, ObjectGuid npcGUID, bool autoLaunched, bool displayPopup) { - QuestGiverQuestDetails packet = new QuestGiverQuestDetails(); + QuestGiverQuestDetails packet = new(); packet.QuestTitle = quest.LogTitle; packet.LogDescription = quest.LogDescription; @@ -507,7 +507,7 @@ namespace Game.Misc public void SendQuestGiverOfferReward(Quest quest, ObjectGuid npcGUID, bool autoLaunched) { - QuestGiverOfferRewardMessage packet = new QuestGiverOfferRewardMessage(); + QuestGiverOfferRewardMessage packet = new(); packet.QuestTitle = quest.LogTitle; packet.RewardText = quest.OfferRewardText; @@ -534,7 +534,7 @@ namespace Game.Misc ObjectManager.GetLocaleString(questOfferRewardLocale.RewardText, locale, ref packet.RewardText); } - QuestGiverOfferReward offer = new QuestGiverOfferReward(); + QuestGiverOfferReward offer = new(); quest.BuildQuestRewards(offer.Rewards, _session.GetPlayer()); offer.QuestGiverGUID = npcGUID; @@ -575,7 +575,7 @@ namespace Game.Misc return; } - QuestGiverRequestItems packet = new QuestGiverRequestItems(); + QuestGiverRequestItems packet = new(); packet.QuestTitle = quest.LogTitle; packet.CompletionText = quest.RequestItemsText; @@ -654,10 +654,10 @@ namespace Game.Misc public uint GetGossipOptionAction(uint selection) { return _gossipMenu.GetMenuItemAction(selection); } public bool IsGossipOptionCoded(uint selection) { return _gossipMenu.IsMenuItemCoded(selection); } - GossipMenu _gossipMenu = new GossipMenu(); - QuestMenu _questMenu = new QuestMenu(); + GossipMenu _gossipMenu = new(); + QuestMenu _questMenu = new(); WorldSession _session; - InteractionData _interactionData = new InteractionData(); + InteractionData _interactionData = new(); } public class QuestMenu @@ -667,7 +667,7 @@ namespace Game.Misc if (Global.ObjectMgr.GetQuestTemplate(QuestId) == null) return; - QuestMenuItem questMenuItem = new QuestMenuItem(); + QuestMenuItem questMenuItem = new(); questMenuItem.QuestId = QuestId; questMenuItem.QuestIcon = Icon; @@ -704,7 +704,7 @@ namespace Game.Misc return _questMenuItems.LookupByIndex(index); } - List _questMenuItems = new List(); + List _questMenuItems = new(); } public struct QuestMenuItem @@ -743,7 +743,7 @@ namespace Game.Misc public class PageTextLocale { - public StringArray Text = new StringArray((int)Locale.Total); + public StringArray Text = new((int)Locale.Total); } public class GossipMenuItems @@ -761,7 +761,7 @@ namespace Game.Misc public uint BoxMoney; public string BoxText; public uint BoxBroadcastTextId; - public List Conditions = new List(); + public List Conditions = new(); } public class PointOfInterest @@ -776,13 +776,13 @@ namespace Game.Misc public class PointOfInterestLocale { - public StringArray Name = new StringArray((int)Locale.Total); + public StringArray Name = new((int)Locale.Total); } public class GossipMenus { public uint MenuId; public uint TextId; - public List Conditions = new List(); + public List Conditions = new(); } } diff --git a/Source/Game/Entities/Creature/Trainer.cs b/Source/Game/Entities/Creature/Trainer.cs index 210e7c008..148f8b4d8 100644 --- a/Source/Game/Entities/Creature/Trainer.cs +++ b/Source/Game/Entities/Creature/Trainer.cs @@ -12,7 +12,7 @@ namespace Game.Entities public uint MoneyCost; public uint ReqSkillLine; public uint ReqSkillRank; - public Array ReqAbility = new Array(3); + public Array ReqAbility = new(3); public byte ReqLevel; public bool IsCastable() { return Global.SpellMgr.GetSpellInfo(SpellId, Difficulty.None).HasEffect(SpellEffectName.LearnSpell); } @@ -33,7 +33,7 @@ namespace Game.Entities { float reputationDiscount = player.GetReputationPriceDiscount(npc); - TrainerList trainerList = new TrainerList(); + TrainerList trainerList = new(); trainerList.TrainerGUID = npc.GetGUID(); trainerList.TrainerType = (int)_type; trainerList.TrainerID = (int)_id; @@ -44,7 +44,7 @@ namespace Game.Entities if (!player.IsSpellFitByClassAndRace(trainerSpell.SpellId)) continue; - TrainerListSpell trainerListSpell = new TrainerListSpell(); + TrainerListSpell trainerListSpell = new(); trainerListSpell.SpellID = trainerSpell.SpellId; trainerListSpell.MoneyCost = (uint)(trainerSpell.MoneyCost * reputationDiscount); trainerListSpell.ReqSkillLine = trainerSpell.ReqSkillLine; @@ -147,7 +147,7 @@ namespace Game.Entities void SendTeachFailure(Creature npc, Player player, uint spellId, TrainerFailReason reason) { - TrainerBuyFailed trainerBuyFailed = new TrainerBuyFailed(); + TrainerBuyFailed trainerBuyFailed = new(); trainerBuyFailed.TrainerGUID = npc.GetGUID(); trainerBuyFailed.SpellID = spellId; trainerBuyFailed.TrainerFailedReason = reason; @@ -170,6 +170,6 @@ namespace Game.Entities uint _id; TrainerType _type; List _spells; - Array _greeting = new Array((int)Locale.Total); + Array _greeting = new((int)Locale.Total); } } diff --git a/Source/Game/Entities/DynamicObject.cs b/Source/Game/Entities/DynamicObject.cs index dabf293e6..a6dc42185 100644 --- a/Source/Game/Entities/DynamicObject.cs +++ b/Source/Game/Entities/DynamicObject.cs @@ -250,7 +250,7 @@ namespace Game.Entities public override void BuildValuesCreate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt8((byte)flags); m_objectData.WriteCreate(buffer, flags, this, target); @@ -263,7 +263,7 @@ namespace Game.Entities public override void BuildValuesUpdate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(m_values.GetChangedObjectTypeMask()); if (m_values.HasChanged(TypeId.Object)) @@ -278,14 +278,14 @@ namespace Game.Entities void BuildValuesUpdateForPlayerWithMask(UpdateData data, UpdateMask requestedObjectMask, UpdateMask requestedDynamicObjectMask, Player target) { - UpdateMask valuesMask = new UpdateMask((int)TypeId.Max); + UpdateMask valuesMask = new((int)TypeId.Max); if (requestedObjectMask.IsAnySet()) valuesMask.Set((int)TypeId.Object); if (requestedDynamicObjectMask.IsAnySet()) valuesMask.Set((int)TypeId.DynamicObject); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(valuesMask.GetBlock(0)); if (valuesMask[(int)TypeId.Object]) @@ -294,7 +294,7 @@ namespace Game.Entities if (valuesMask[(int)TypeId.DynamicObject]) m_dynamicObjectData.WriteUpdate(buffer, requestedDynamicObjectMask, true, this, target); - WorldPacket buffer1 = new WorldPacket(); + WorldPacket buffer1 = new(); buffer1.WriteUInt8((byte)UpdateType.Values); buffer1.WritePackedGuid(GetGUID()); buffer1.WriteUInt32(buffer.GetSize()); diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs index e79608769..c5754241c 100644 --- a/Source/Game/Entities/GameObject/GameObject.cs +++ b/Source/Game/Entities/GameObject/GameObject.cs @@ -165,7 +165,7 @@ namespace Game.Entities if (goInfo == null) return null; - GameObject go = new GameObject(); + GameObject go = new(); if (!go.Create(entry, map, pos, rotation, animProgress, goState, artKit, false, 0)) return null; @@ -174,7 +174,7 @@ namespace Game.Entities public static GameObject CreateGameObjectFromDB(ulong spawnId, Map map, bool addToMap = true) { - GameObject go = new GameObject(); + GameObject go = new(); if (!go.LoadFromDB(spawnId, map, addToMap)) return null; @@ -502,7 +502,7 @@ namespace Game.Entities SetGoState(GameObjectState.Active); SetFlags(GameObjectFlags.NoDespawn); - UpdateData udata = new UpdateData(caster.GetMapId()); + UpdateData udata = new(caster.GetMapId()); UpdateObject packet; BuildValuesUpdateBlockForPlayer(udata, caster.ToPlayer()); udata.BuildPacket(out packet); @@ -882,7 +882,7 @@ namespace Game.Entities public void SendGameObjectDespawn() { - GameObjectDespawn packet = new GameObjectDespawn(); + GameObjectDespawn packet = new(); packet.ObjectGUID = GetGUID(); SendMessageToSet(packet, true); } @@ -1065,7 +1065,7 @@ namespace Game.Entities GetMap().RemoveRespawnTime(SpawnObjectType.GameObject, m_spawnId); Global.ObjectMgr.DeleteGameObjectData(m_spawnId); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_GAMEOBJECT); stmt.AddValue(0, m_spawnId); @@ -1501,7 +1501,7 @@ namespace Game.Entities if (info.Goober.pageID != 0) // show page... { - PageTextPkt data = new PageTextPkt(); + PageTextPkt data = new(); data.GameObjectGUID = GetGUID(); player.SendPacket(data); } @@ -1957,7 +1957,7 @@ namespace Game.Entities return; } - OpenArtifactForge openArtifactForge = new OpenArtifactForge(); + OpenArtifactForge openArtifactForge = new(); openArtifactForge.ArtifactGUID = item.GetGUID(); openArtifactForge.ForgeGUID = GetGUID(); player.SendPacket(openArtifactForge); @@ -1969,7 +1969,7 @@ namespace Game.Entities if (!item) return; - OpenHeartForge openHeartForge = new OpenHeartForge(); + OpenHeartForge openHeartForge = new(); openHeartForge.ForgeGUID = GetGUID(); player.SendPacket(openHeartForge); break; @@ -1985,7 +1985,7 @@ namespace Game.Entities if (!player) return; - GameObjectUILink gameObjectUILink = new GameObjectUILink(); + GameObjectUILink gameObjectUILink = new(); gameObjectUILink.ObjectGUID = GetGUID(); gameObjectUILink.UILink = (int)GetGoInfo().UILink.UILinkType; player.SendPacket(gameObjectUILink); @@ -2082,7 +2082,7 @@ namespace Game.Entities public void SendCustomAnim(uint anim) { - GameObjectCustomAnim customAnim = new GameObjectCustomAnim(); + GameObjectCustomAnim customAnim = new(); customAnim.ObjectGUID = GetGUID(); customAnim.CustomAnim = anim; SendMessageToSet(customAnim, true); @@ -2174,7 +2174,7 @@ namespace Game.Entities public void SetWorldRotation(float qx, float qy, float qz, float qw) { - Quaternion rotation = new Quaternion(qx, qy, qz, qw); + Quaternion rotation = new(qx, qy, qz, qw); rotation.unitize(); m_worldRotation.X = rotation.X; m_worldRotation.Y = rotation.Y; @@ -2218,7 +2218,7 @@ namespace Game.Entities // dealing damage, send packet if (player != null) { - DestructibleBuildingDamage packet = new DestructibleBuildingDamage(); + DestructibleBuildingDamage packet = new(); packet.Caster = attackerOrHealer.GetGUID(); // todo: this can be a GameObject packet.Target = GetGUID(); packet.Damage = -change; @@ -2545,7 +2545,7 @@ namespace Game.Entities public override void BuildValuesCreate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt8((byte)flags); m_objectData.WriteCreate(buffer, flags, this, target); @@ -2558,7 +2558,7 @@ namespace Game.Entities public override void BuildValuesUpdate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(m_values.GetChangedObjectTypeMask()); if (m_values.HasChanged(TypeId.Object)) @@ -2573,14 +2573,14 @@ namespace Game.Entities public void BuildValuesUpdateForPlayerWithMask(UpdateData data, UpdateMask requestedObjectMask, UpdateMask requestedGameObjectMask, Player target) { - UpdateMask valuesMask = new UpdateMask((int)TypeId.Max); + UpdateMask valuesMask = new((int)TypeId.Max); if (requestedObjectMask.IsAnySet()) valuesMask.Set((int)TypeId.Object); if (requestedGameObjectMask.IsAnySet()) valuesMask.Set((int)TypeId.GameObject); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(valuesMask.GetBlock(0)); if (valuesMask[(int)TypeId.Object]) @@ -2589,7 +2589,7 @@ namespace Game.Entities if (valuesMask[(int)TypeId.GameObject]) m_gameObjectData.WriteUpdate(buffer, requestedGameObjectMask, true, this, target); - WorldPacket buffer1 = new WorldPacket(); + WorldPacket buffer1 = new(); buffer1.WriteUInt8((byte)UpdateType.Values); buffer1.WritePackedGuid(GetGUID()); buffer1.WriteUInt32(buffer.GetSize()); @@ -2655,7 +2655,7 @@ namespace Game.Entities else _animKitId = 0; - GameObjectActivateAnimKit activateAnimKit = new GameObjectActivateAnimKit(); + GameObjectActivateAnimKit activateAnimKit = new(); activateAnimKit.ObjectGUID = GetGUID(); activateAnimKit.AnimKitID = animKitId; activateAnimKit.Maintain = !oneshot; @@ -2846,7 +2846,7 @@ namespace Game.Entities // For traps this: spell casting cooldown, for doors/buttons: reset time. Player m_ritualOwner; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner) - List m_unique_users = new List(); + List m_unique_users = new(); uint m_usetimes; ObjectGuid m_lootRecipient; @@ -2867,10 +2867,10 @@ namespace Game.Entities GameObjectState m_prevGoState; // What state to set whenever resetting - Dictionary ChairListSlots = new Dictionary(); - List m_SkillupList = new List(); + Dictionary ChairListSlots = new(); + List m_SkillupList = new(); - public Loot loot = new Loot(); + public Loot loot = new(); public GameObjectModel m_model; diff --git a/Source/Game/Entities/GameObject/GameObjectData.cs b/Source/Game/Entities/GameObject/GameObjectData.cs index 5523866da..483b86697 100644 --- a/Source/Game/Entities/GameObject/GameObjectData.cs +++ b/Source/Game/Entities/GameObject/GameObjectData.cs @@ -579,7 +579,7 @@ namespace Game.Entities QueryData.GameObjectID = entry; QueryData.Allow = true; - GameObjectStats stats = new GameObjectStats(); + GameObjectStats stats = new(); stats.Type = (uint)type; stats.DisplayID = displayId; @@ -1369,9 +1369,9 @@ namespace Game.Entities public class GameObjectLocale { - public StringArray Name = new StringArray((int)Locale.Total); - public StringArray CastBarCaption = new StringArray((int)Locale.Total); - public StringArray Unk1 = new StringArray((int)Locale.Total); + public StringArray Name = new((int)Locale.Total); + public StringArray CastBarCaption = new((int)Locale.Total); + public StringArray Unk1 = new((int)Locale.Total); } public class GameObjectAddon diff --git a/Source/Game/Entities/Item/AzeriteEmpoweredItem.cs b/Source/Game/Entities/Item/AzeriteEmpoweredItem.cs index 784486771..736138b8d 100644 --- a/Source/Game/Entities/Item/AzeriteEmpoweredItem.cs +++ b/Source/Game/Entities/Item/AzeriteEmpoweredItem.cs @@ -165,7 +165,7 @@ namespace Game.Entities public override void BuildValuesCreate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt8((byte)flags); m_objectData.WriteCreate(buffer, flags, this, target); @@ -179,7 +179,7 @@ namespace Game.Entities public override void BuildValuesUpdate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); if (m_values.HasChanged(TypeId.Object)) m_objectData.WriteUpdate(buffer, flags, this, target); @@ -198,7 +198,7 @@ namespace Game.Entities void BuildValuesUpdateForPlayerWithMask(UpdateData data, UpdateMask requestedObjectMask, UpdateMask requestedItemMask, UpdateMask requestedAzeriteEmpoweredItemMask, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - UpdateMask valuesMask = new UpdateMask((int)TypeId.Max); + UpdateMask valuesMask = new((int)TypeId.Max); if (requestedObjectMask.IsAnySet()) valuesMask.Set((int)TypeId.Object); @@ -209,7 +209,7 @@ namespace Game.Entities if (requestedAzeriteEmpoweredItemMask.IsAnySet()) valuesMask.Set((int)TypeId.AzeriteEmpoweredItem); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(valuesMask.GetBlock(0)); if (valuesMask[(int)TypeId.Object]) @@ -221,7 +221,7 @@ namespace Game.Entities if (valuesMask[(int)TypeId.AzeriteEmpoweredItem]) m_azeriteEmpoweredItemData.WriteUpdate(buffer, requestedAzeriteEmpoweredItemMask, true, this, target); - WorldPacket buffer1 = new WorldPacket(); + WorldPacket buffer1 = new(); buffer1.WriteUInt8((byte)UpdateType.Values); buffer1.WritePackedGuid(GetGUID()); buffer1.WriteUInt32(buffer.GetSize()); diff --git a/Source/Game/Entities/Item/AzeriteItem.cs b/Source/Game/Entities/Item/AzeriteItem.cs index cfcddbc54..1841db825 100644 --- a/Source/Game/Entities/Item/AzeriteItem.cs +++ b/Source/Game/Entities/Item/AzeriteItem.cs @@ -230,7 +230,7 @@ namespace Game.Entities { // count weeks from 14.01.2020 DateTime now = GameTime.GetDateAndTime(); - DateTime beginDate = new DateTime(2020, 1, 14); + DateTime beginDate = new(2020, 1, 14); uint knowledge = 0; while (beginDate < now && knowledge < PlayerConst.MaxAzeriteItemKnowledgeLevel) { @@ -293,7 +293,7 @@ namespace Game.Entities SetState(ItemUpdateState.Changed, owner); } - PlayerAzeriteItemGains xpGain = new PlayerAzeriteItemGains(); + PlayerAzeriteItemGains xpGain = new(); xpGain.ItemGUID = GetGUID(); xpGain.XP = xp; owner.SendPacket(xpGain); @@ -362,7 +362,7 @@ namespace Game.Entities if (index < 0) { - UnlockedAzeriteEssence unlockedEssence = new UnlockedAzeriteEssence(); + UnlockedAzeriteEssence unlockedEssence = new(); unlockedEssence.AzeriteEssenceID = azeriteEssenceId; unlockedEssence.Rank = rank; AddDynamicUpdateFieldValue(m_values.ModifyValue(m_azeriteItemData).ModifyValue(m_azeriteItemData.UnlockedEssences), unlockedEssence); @@ -385,7 +385,7 @@ namespace Game.Entities public void CreateSelectedAzeriteEssences(uint specializationId) { - SelectedAzeriteEssences selectedEssences = new SelectedAzeriteEssences(); + SelectedAzeriteEssences selectedEssences = new(); selectedEssences.ModifyValue(selectedEssences.SpecializationID).SetValue(specializationId); selectedEssences.ModifyValue(selectedEssences.Enabled).SetValue(true); AddDynamicUpdateFieldValue(m_values.ModifyValue(m_azeriteItemData).ModifyValue(m_azeriteItemData.SelectedEssences), selectedEssences); @@ -426,7 +426,7 @@ namespace Game.Entities public override void BuildValuesCreate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt8((byte)flags); m_objectData.WriteCreate(buffer, flags, this, target); @@ -440,7 +440,7 @@ namespace Game.Entities public override void BuildValuesUpdate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); if (m_values.HasChanged(TypeId.Object)) m_objectData.WriteUpdate(buffer, flags, this, target); @@ -458,18 +458,18 @@ namespace Game.Entities public override void BuildValuesUpdateWithFlag(WorldPacket data, UpdateFieldFlag flags, Player target) { - UpdateMask valuesMask = new UpdateMask(14); + UpdateMask valuesMask = new(14); valuesMask.Set((int)TypeId.Item); valuesMask.Set((int)TypeId.AzeriteItem); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(valuesMask.GetBlock(0)); - UpdateMask mask = new UpdateMask(40); + UpdateMask mask = new(40); m_itemData.AppendAllowedFieldsMaskForFlag(mask, flags); m_itemData.WriteUpdate(buffer, mask, true, this, target); - UpdateMask mask2 = new UpdateMask(9); + UpdateMask mask2 = new(9); m_azeriteItemData.AppendAllowedFieldsMaskForFlag(mask2, flags); m_azeriteItemData.WriteUpdate(buffer, mask2, true, this, target); @@ -480,7 +480,7 @@ namespace Game.Entities void BuildValuesUpdateForPlayerWithMask(UpdateData data, UpdateMask requestedObjectMask, UpdateMask requestedItemMask, UpdateMask requestedAzeriteItemMask, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - UpdateMask valuesMask = new UpdateMask((int)TypeId.Max); + UpdateMask valuesMask = new((int)TypeId.Max); if (requestedObjectMask.IsAnySet()) valuesMask.Set((int)TypeId.Object); @@ -492,7 +492,7 @@ namespace Game.Entities if (requestedAzeriteItemMask.IsAnySet()) valuesMask.Set((int)TypeId.AzeriteItem); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(valuesMask.GetBlock(0)); if (valuesMask[(int)TypeId.Object]) @@ -504,7 +504,7 @@ namespace Game.Entities if (valuesMask[(int)TypeId.AzeriteItem]) m_azeriteItemData.WriteUpdate(buffer, requestedAzeriteItemMask, true, this, target); - WorldPacket buffer1 = new WorldPacket(); + WorldPacket buffer1 = new(); buffer1.WriteUInt8((byte)UpdateType.Values); buffer1.WritePackedGuid(GetGUID()); buffer1.WriteUInt32(buffer.GetSize()); @@ -555,8 +555,8 @@ namespace Game.Entities public ulong Xp; public uint Level; public uint KnowledgeLevel; - public List AzeriteItemMilestonePowers = new List(); - public List UnlockedAzeriteEssences = new List(); + public List AzeriteItemMilestonePowers = new(); + public List UnlockedAzeriteEssences = new(); public AzeriteItemSelectedEssencesData[] SelectedAzeriteEssences = new AzeriteItemSelectedEssencesData[4]; } } diff --git a/Source/Game/Entities/Item/Bag.cs b/Source/Game/Entities/Item/Bag.cs index feb7d6cf0..6b4994af5 100644 --- a/Source/Game/Entities/Item/Bag.cs +++ b/Source/Game/Entities/Item/Bag.cs @@ -175,7 +175,7 @@ namespace Game.Entities public override void BuildValuesCreate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt8((byte)flags); m_objectData.WriteCreate(buffer, flags, this, target); @@ -189,7 +189,7 @@ namespace Game.Entities public override void BuildValuesUpdate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(m_values.GetChangedObjectTypeMask()); if (m_values.HasChanged(TypeId.Object)) @@ -208,7 +208,7 @@ namespace Game.Entities void BuildValuesUpdateForPlayerWithMask(UpdateData data, UpdateMask requestedObjectMask, UpdateMask requestedItemMask, UpdateMask requestedContainerMask, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - UpdateMask valuesMask = new UpdateMask((int)TypeId.Max); + UpdateMask valuesMask = new((int)TypeId.Max); if (requestedObjectMask.IsAnySet()) valuesMask.Set((int)TypeId.Object); @@ -219,7 +219,7 @@ namespace Game.Entities if (requestedContainerMask.IsAnySet()) valuesMask.Set((int)TypeId.Container); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(valuesMask.GetBlock(0)); if (valuesMask[(int)TypeId.Object]) @@ -231,7 +231,7 @@ namespace Game.Entities if (valuesMask[(int)TypeId.Container]) m_containerData.WriteUpdate(buffer, requestedContainerMask, true, this, target); - WorldPacket buffer1 = new WorldPacket(); + WorldPacket buffer1 = new(); buffer1.WriteUInt8((byte)UpdateType.Values); buffer1.WritePackedGuid(GetGUID()); buffer1.WriteUInt32(buffer.GetSize()); diff --git a/Source/Game/Entities/Item/Item.cs b/Source/Game/Entities/Item/Item.cs index b8ad9673c..2ad5f72af 100644 --- a/Source/Game/Entities/Item/Item.cs +++ b/Source/Game/Entities/Item/Item.cs @@ -159,7 +159,7 @@ namespace Game.Entities stmt.AddValue(++index, GetCount()); stmt.AddValue(++index, (uint)m_itemData.Expiration); - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); for (byte i = 0; i < m_itemData.SpellCharges.GetSize() && i < _bonusData.EffectCount; ++i) ss.AppendFormat("{0} ", GetSpellCharges(i)); @@ -215,7 +215,7 @@ namespace Game.Entities if (gemData.ItemId != 0) { stmt.AddValue(1 + i * gemFields, (uint)gemData.ItemId); - StringBuilder gemBonusListIDs = new StringBuilder(); + StringBuilder gemBonusListIDs = new(); foreach (ushort bonusListID in gemData.BonusListIDs) { if (bonusListID != 0) @@ -446,7 +446,7 @@ namespace Game.Entities SetContext((ItemContext)fields.Read(17)); var bonusListString = new StringArray(fields.Read(18), ' '); - List bonusListIDs = new List(); + List bonusListIDs = new(); for (var i = 0; i < bonusListString.Length; ++i) { if (uint.TryParse(bonusListString[i], out uint bonusListID)) @@ -1006,7 +1006,7 @@ namespace Game.Entities SpellItemEnchantmentRecord gemEnchant = CliDB.SpellItemEnchantmentStorage.LookupByKey(gemProperties.EnchantId); if (gemEnchant != null) { - BonusData gemBonus = new BonusData(gemTemplate); + BonusData gemBonus = new(gemTemplate); foreach (var bonusListId in gem.BonusListIDs) gemBonus.AddBonusList(bonusListId); @@ -1117,7 +1117,7 @@ namespace Game.Entities public void SendUpdateSockets() { - SocketGemsSuccess socketGems = new SocketGemsSuccess(); + SocketGemsSuccess socketGems = new(); socketGems.Item = GetGUID(); GetOwner().SendPacket(socketGems); @@ -1129,7 +1129,7 @@ namespace Game.Entities if (duration == 0) return; - ItemTimeUpdate itemTimeUpdate = new ItemTimeUpdate(); + ItemTimeUpdate itemTimeUpdate = new(); itemTimeUpdate.ItemGuid = GetGUID(); itemTimeUpdate.DurationLeft = duration; owner.SendPacket(itemTimeUpdate); @@ -1213,7 +1213,7 @@ namespace Game.Entities public override void BuildValuesCreate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); m_objectData.WriteCreate(buffer, flags, this, target); m_itemData.WriteCreate(buffer, flags, this, target); @@ -1226,7 +1226,7 @@ namespace Game.Entities public override void BuildValuesUpdate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); if (m_values.HasChanged(TypeId.Object)) m_objectData.WriteUpdate(buffer, flags, this, target); @@ -1242,11 +1242,11 @@ namespace Game.Entities public override void BuildValuesUpdateWithFlag(WorldPacket data, UpdateFieldFlag flags, Player target) { - UpdateMask valuesMask = new UpdateMask(14); + UpdateMask valuesMask = new(14); valuesMask.Set((int)TypeId.Item); - WorldPacket buffer = new WorldPacket(); - UpdateMask mask = new UpdateMask(40); + WorldPacket buffer = new(); + UpdateMask mask = new(40); buffer.WriteUInt32(valuesMask.GetBlock(0)); m_itemData.AppendAllowedFieldsMaskForFlag(mask, flags); @@ -1259,7 +1259,7 @@ namespace Game.Entities void BuildValuesUpdateForPlayerWithMask(UpdateData data, UpdateMask requestedObjectMask, UpdateMask requestedItemMask, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - UpdateMask valuesMask = new UpdateMask((int)TypeId.Max); + UpdateMask valuesMask = new((int)TypeId.Max); if (requestedObjectMask.IsAnySet()) valuesMask.Set((int)TypeId.Object); @@ -1267,7 +1267,7 @@ namespace Game.Entities if (requestedItemMask.IsAnySet()) valuesMask.Set((int)TypeId.Item); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(valuesMask.GetBlock(0)); if (valuesMask[(int)TypeId.Object]) @@ -1276,7 +1276,7 @@ namespace Game.Entities if (valuesMask[(int)TypeId.Item]) m_itemData.WriteUpdate(buffer, requestedItemMask, true, this, target); - WorldPacket buffer1 = new WorldPacket(); + WorldPacket buffer1 = new(); buffer1.WriteUInt8((byte)UpdateType.Values); buffer1.WritePackedGuid(GetGUID()); buffer1.WriteUInt32(buffer.GetSize()); @@ -1332,7 +1332,7 @@ namespace Game.Entities if (!HasItemFlag(ItemFieldFlags.Refundable)) return; - ItemExpirePurchaseRefund itemExpirePurchaseRefund = new ItemExpirePurchaseRefund(); + ItemExpirePurchaseRefund itemExpirePurchaseRefund = new(); itemExpirePurchaseRefund.ItemGUID = GetGUID(); owner.SendPacket(itemExpirePurchaseRefund); @@ -1922,7 +1922,7 @@ namespace Game.Entities { if (modifierIndex == -1) { - ItemMod mod = new ItemMod(); + ItemMod mod = new(); mod.Value = value; mod.Type = (byte)modifier; @@ -2052,7 +2052,7 @@ namespace Game.Entities int index = m_artifactPowerIdToIndex.Count; m_artifactPowerIdToIndex[artifactPower.ArtifactPowerId] = (ushort)index; - ArtifactPower powerField = new ArtifactPower(); + ArtifactPower powerField = new(); powerField.ArtifactPowerId = (ushort)artifactPower.ArtifactPowerId; powerField.PurchasedRank = artifactPower.PurchasedRank; powerField.CurrentRankWithBonus = artifactPower.CurrentRankWithBonus; @@ -2081,7 +2081,7 @@ namespace Game.Entities if (m_artifactPowerIdToIndex.ContainsKey(artifactPower.Id)) continue; - ArtifactPowerData powerData = new ArtifactPowerData(); + ArtifactPowerData powerData = new(); powerData.ArtifactPowerId = artifactPower.Id; powerData.PurchasedRank = 0; powerData.CurrentRankWithBonus = (byte)((artifactPower.Flags & ArtifactPowerFlag.First) == ArtifactPowerFlag.First ? 1 : 0); @@ -2232,7 +2232,7 @@ namespace Game.Entities SetArtifactXP(m_itemData.ArtifactXP + amount); - ArtifactXpGain artifactXpGain = new ArtifactXpGain(); + ArtifactXpGain artifactXpGain = new(); artifactXpGain.ArtifactGUID = GetGUID(); artifactXpGain.Amount = amount; owner.SendPacket(artifactXpGain); @@ -2641,11 +2641,11 @@ namespace Game.Entities string m_text; bool mb_in_trade; long m_lastPlayedTimeUpdate; - List allowedGUIDs = new List(); + List allowedGUIDs = new(); uint m_randomBonusListId; // store separately to easily find which bonus list is the one randomly given for stat rerolling ObjectGuid m_childItem; - Dictionary m_artifactPowerIdToIndex = new Dictionary(); - Array m_gemScalingLevels = new Array(ItemConst.MaxGemSockets); + Dictionary m_artifactPowerIdToIndex = new(); + Array m_gemScalingLevels = new(ItemConst.MaxGemSockets); #endregion } @@ -2673,7 +2673,7 @@ namespace Game.Entities { public uint ItemSetID; public uint EquippedItemCount; - public List SetBonuses = new List(); + public List SetBonuses = new(); } public class BonusData @@ -2916,12 +2916,12 @@ namespace Game.Entities public ulong Xp; public uint ArtifactAppearanceId; public uint ArtifactTierId; - public List ArtifactPowers = new List(); + public List ArtifactPowers = new(); } public class AzeriteEmpoweredData { - public Array SelectedAzeritePowers = new Array(SharedConst.MaxAzeriteEmpoweredTier); + public Array SelectedAzeritePowers = new(SharedConst.MaxAzeriteEmpoweredTier); } class ItemAdditionalLoadInfo @@ -2953,7 +2953,7 @@ namespace Game.Entities info.Artifact.ArtifactAppearanceId = artifactResult.Read(2); info.Artifact.ArtifactTierId = artifactResult.Read(3); - ArtifactPowerData artifactPowerData = new ArtifactPowerData(); + ArtifactPowerData artifactPowerData = new(); artifactPowerData.ArtifactPowerId = artifactResult.Read(4); artifactPowerData.PurchasedRank = artifactResult.Read(5); diff --git a/Source/Game/Entities/Item/ItemEnchantment.cs b/Source/Game/Entities/Item/ItemEnchantment.cs index e2d75dbae..f1ce35253 100644 --- a/Source/Game/Entities/Item/ItemEnchantment.cs +++ b/Source/Game/Entities/Item/ItemEnchantment.cs @@ -160,12 +160,12 @@ namespace Game.Entities return 0; } - static Dictionary _storage = new Dictionary(); + static Dictionary _storage = new(); } public class RandomBonusListIds { - public List BonusListIDs = new List(); - public List Chances = new List(); + public List BonusListIDs = new(); + public List Chances = new(); } } diff --git a/Source/Game/Entities/Item/ItemTemplate.cs b/Source/Game/Entities/Item/ItemTemplate.cs index 14f973261..84bce862a 100644 --- a/Source/Game/Entities/Item/ItemTemplate.cs +++ b/Source/Game/Entities/Item/ItemTemplate.cs @@ -328,7 +328,7 @@ namespace Game.Entities } public uint MaxDurability; - public List Effects = new List(); + public List Effects = new(); // extra fields, not part of db2 files public uint ScriptId; diff --git a/Source/Game/Entities/Object/ObjectGuid.cs b/Source/Game/Entities/Object/ObjectGuid.cs index 0bb1022f7..61880fd6a 100644 --- a/Source/Game/Entities/Object/ObjectGuid.cs +++ b/Source/Game/Entities/Object/ObjectGuid.cs @@ -22,7 +22,7 @@ namespace Game.Entities { public struct ObjectGuid : IEquatable { - public static ObjectGuid Empty = new ObjectGuid(); + public static ObjectGuid Empty = new(); public static ObjectGuid TradeItem = Create(HighGuid.Uniq, 10ul); ulong _low; diff --git a/Source/Game/Entities/Object/Position.cs b/Source/Game/Entities/Object/Position.cs index 6e5924518..6dc7d20d1 100644 --- a/Source/Game/Entities/Object/Position.cs +++ b/Source/Game/Entities/Object/Position.cs @@ -354,7 +354,7 @@ namespace Game.Entities Cell currentCell; public ObjectCellMoveState _moveState; - public Position _newPosition = new Position(); + public Position _newPosition = new(); public WorldLocation(uint mapId = 0xFFFFFFFF, float x = 0, float y = 0, float z = 0, float o = 0) { diff --git a/Source/Game/Entities/Object/Update/UpdateData.cs b/Source/Game/Entities/Object/Update/UpdateData.cs index 826edcf4c..4d70faf2e 100644 --- a/Source/Game/Entities/Object/Update/UpdateData.cs +++ b/Source/Game/Entities/Object/Update/UpdateData.cs @@ -26,9 +26,9 @@ namespace Game.Entities { uint MapId; uint BlockCount; - List destroyGUIDs = new List(); - List outOfRangeGUIDs = new List(); - ByteBuffer data = new ByteBuffer(); + List destroyGUIDs = new(); + List outOfRangeGUIDs = new(); + ByteBuffer data = new(); public UpdateData(uint mapId) { @@ -63,7 +63,7 @@ namespace Game.Entities packet.NumObjUpdates = BlockCount; packet.MapID = (ushort)MapId; - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); if (buffer.WriteBit(!outOfRangeGUIDs.Empty() || !destroyGUIDs.Empty())) { buffer.WriteUInt16((ushort)destroyGUIDs.Count); diff --git a/Source/Game/Entities/Object/Update/UpdateField.cs b/Source/Game/Entities/Object/Update/UpdateField.cs index f7908923b..587f844bd 100644 --- a/Source/Game/Entities/Object/Update/UpdateField.cs +++ b/Source/Game/Entities/Object/Update/UpdateField.cs @@ -25,7 +25,7 @@ namespace Game.Entities { public class UpdateFieldHolder { - UpdateMask _changesMask = new UpdateMask((int)TypeId.Max); + UpdateMask _changesMask = new((int)TypeId.Max); WorldObject _owner; public UpdateFieldHolder(WorldObject owner) { _owner = owner; } diff --git a/Source/Game/Entities/Object/Update/UpdateFields.cs b/Source/Game/Entities/Object/Update/UpdateFields.cs index 5fe3bd4fe..baf4d5ecb 100644 --- a/Source/Game/Entities/Object/Update/UpdateFields.cs +++ b/Source/Game/Entities/Object/Update/UpdateFields.cs @@ -28,9 +28,9 @@ namespace Game.Entities { public class ObjectFieldData : BaseUpdateData { - public UpdateField EntryId = new UpdateField(0, 1); - public UpdateField DynamicFlags = new UpdateField(0, 2); - public UpdateField Scale = new UpdateField(0, 3); + public UpdateField EntryId = new(0, 1); + public UpdateField DynamicFlags = new(0, 2); + public UpdateField Scale = new(0, 3); public ObjectFieldData() : base(0, TypeId.Object, 4) { } @@ -149,10 +149,10 @@ namespace Game.Entities public class ItemEnchantment : BaseUpdateData { - public UpdateField ID = new UpdateField(0, 1); - public UpdateField Duration = new UpdateField(0, 2); - public UpdateField Charges = new UpdateField(0, 3); - public UpdateField Inactive = new UpdateField(0, 4); + public UpdateField ID = new(0, 1); + public UpdateField Duration = new(0, 2); + public UpdateField Charges = new(0, 3); + public UpdateField Inactive = new(0, 4); public ItemEnchantment() : base(5) { } @@ -224,7 +224,7 @@ namespace Game.Entities public class ItemModList : BaseUpdateData { - public DynamicUpdateField Values = new DynamicUpdateField(0, 0); + public DynamicUpdateField Values = new(0, 0); public ItemModList() : base(1) { } @@ -303,9 +303,9 @@ namespace Game.Entities public class SocketedGem : BaseUpdateData { - public UpdateField ItemId = new UpdateField(0, 1); - public UpdateField Context = new UpdateField(0, 2); - public UpdateFieldArray BonusListIDs = new UpdateFieldArray(16, 3, 4); + public UpdateField ItemId = new(0, 1); + public UpdateField Context = new(0, 2); + public UpdateFieldArray BonusListIDs = new(16, 3, 4); public SocketedGem() : base(20) { } @@ -363,27 +363,27 @@ namespace Game.Entities public class ItemData : BaseUpdateData { - public UpdateField> BonusListIDs = new UpdateField>(0, 1); - public DynamicUpdateField ArtifactPowers = new DynamicUpdateField(0, 2); - public DynamicUpdateField Gems = new DynamicUpdateField(0, 3); - public UpdateField Owner = new UpdateField(0, 4); - public UpdateField ContainedIn = new UpdateField(0, 5); - public UpdateField Creator = new UpdateField(0, 6); - public UpdateField GiftCreator = new UpdateField(0, 7); - public UpdateField StackCount = new UpdateField(0, 8); - public UpdateField Expiration = new UpdateField(0, 9); - public UpdateField DynamicFlags = new UpdateField(0, 10); - public UpdateField Durability = new UpdateField(0, 11); - public UpdateField MaxDurability = new UpdateField(0, 12); - public UpdateField CreatePlayedTime = new UpdateField(0, 13); - public UpdateField Context = new UpdateField(0, 14); - public UpdateField CreateTime = new UpdateField(0, 15); - public UpdateField ArtifactXP = new UpdateField(0, 16); - public UpdateField ItemAppearanceModID = new UpdateField(0, 17); - public UpdateField Modifiers = new UpdateField(0, 18); - public UpdateField DynamicFlags2 = new UpdateField(0, 19); - public UpdateFieldArray SpellCharges = new UpdateFieldArray(5, 20, 21); - public UpdateFieldArray Enchantment = new UpdateFieldArray(13, 26, 27); + public UpdateField> BonusListIDs = new(0, 1); + public DynamicUpdateField ArtifactPowers = new(0, 2); + public DynamicUpdateField Gems = new(0, 3); + public UpdateField Owner = new(0, 4); + public UpdateField ContainedIn = new(0, 5); + public UpdateField Creator = new(0, 6); + public UpdateField GiftCreator = new(0, 7); + public UpdateField StackCount = new(0, 8); + public UpdateField Expiration = new(0, 9); + public UpdateField DynamicFlags = new(0, 10); + public UpdateField Durability = new(0, 11); + public UpdateField MaxDurability = new(0, 12); + public UpdateField CreatePlayedTime = new(0, 13); + public UpdateField Context = new(0, 14); + public UpdateField CreateTime = new(0, 15); + public UpdateField ArtifactXP = new(0, 16); + public UpdateField ItemAppearanceModID = new(0, 17); + public UpdateField Modifiers = new(0, 18); + public UpdateField DynamicFlags2 = new(0, 19); + public UpdateFieldArray SpellCharges = new(5, 20, 21); + public UpdateFieldArray Enchantment = new(13, 26, 27); public ItemData() : base(0, TypeId.Item, 40) { } @@ -444,7 +444,7 @@ namespace Game.Entities public void WriteUpdate(WorldPacket data, UpdateFieldFlag fieldVisibilityFlags, Item owner, Player receiver) { - UpdateMask allowedMaskForTarget = new UpdateMask(40, new uint[] { 0xFC04E4FFu, 0x000000FFu }); + UpdateMask allowedMaskForTarget = new(40, new uint[] { 0xFC04E4FFu, 0x000000FFu }); AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags); WriteUpdate(data, _changesMask & allowedMaskForTarget, false, owner, receiver); } @@ -457,7 +457,7 @@ namespace Game.Entities public void FilterDisallowedFieldsMaskForFlag(UpdateMask changesMask, UpdateFieldFlag fieldVisibilityFlags) { - UpdateMask allowedMaskForTarget = new UpdateMask(40, new[] { 0xFC04E4FFu, 0x000000FFu }); + UpdateMask allowedMaskForTarget = new(40, new[] { 0xFC04E4FFu, 0x000000FFu }); AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags); changesMask.AND(allowedMaskForTarget); } @@ -636,8 +636,8 @@ namespace Game.Entities public class ContainerData : BaseUpdateData { - public UpdateField NumSlots = new UpdateField(0, 1); - public UpdateFieldArray Slots = new UpdateFieldArray(36, 2, 3); + public UpdateField NumSlots = new(0, 1); + public UpdateFieldArray Slots = new(36, 2, 3); public ContainerData() : base(0, TypeId.Container, 39) { } @@ -692,7 +692,7 @@ namespace Game.Entities public class AzeriteEmpoweredItemData : BaseUpdateData { - public UpdateFieldArray Selections = new UpdateFieldArray(5, 0, 1); + public UpdateFieldArray Selections = new(5, 0, 1); public AzeriteEmpoweredItemData() : base(0, TypeId.AzeriteEmpoweredItem, 6) { } @@ -755,9 +755,9 @@ namespace Game.Entities public class SelectedAzeriteEssences : BaseUpdateData { - public UpdateField Enabled = new UpdateField(0, 1); - public UpdateField SpecializationID = new UpdateField(0, 2); - public UpdateFieldArray AzeriteEssenceID = new UpdateFieldArray(4, 3, 4); + public UpdateField Enabled = new(0, 1); + public UpdateField SpecializationID = new(0, 2); + public UpdateFieldArray AzeriteEssenceID = new(4, 3, 4); public SelectedAzeriteEssences() : base(8) { } @@ -822,15 +822,15 @@ namespace Game.Entities public class AzeriteItemData : BaseUpdateData { - public UpdateField Enabled = new UpdateField(0, 1); - public DynamicUpdateFieldUnlockedEssences = new DynamicUpdateField(0, 2); - public DynamicUpdateFieldUnlockedEssenceMilestones = new DynamicUpdateField(0, 4); - public DynamicUpdateFieldSelectedEssences = new DynamicUpdateField(0, 3); - public UpdateField Xp = new UpdateField(0, 5); - public UpdateField Level = new UpdateField(0, 6); - public UpdateField AuraLevel = new UpdateField(0, 7); - public UpdateField KnowledgeLevel = new UpdateField(0, 8); - public UpdateField DEBUGknowledgeWeek = new UpdateField(0, 9); + public UpdateField Enabled = new(0, 1); + public DynamicUpdateFieldUnlockedEssences = new(0, 2); + public DynamicUpdateFieldUnlockedEssenceMilestones = new(0, 4); + public DynamicUpdateFieldSelectedEssences = new(0, 3); + public UpdateField Xp = new(0, 5); + public UpdateField Level = new(0, 6); + public UpdateField AuraLevel = new(0, 7); + public UpdateField KnowledgeLevel = new(0, 8); + public UpdateField DEBUGknowledgeWeek = new(0, 9); public AzeriteItemData() : base(10) { } @@ -868,7 +868,7 @@ namespace Game.Entities public void WriteUpdate(WorldPacket data, UpdateFieldFlag fieldVisibilityFlags, AzeriteItem owner, Player receiver) { - UpdateMask allowedMaskForTarget = new UpdateMask(9, new[] { 0x0000001Du }); + UpdateMask allowedMaskForTarget = new(9, new[] { 0x0000001Du }); AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags); WriteUpdate(data, _changesMask & allowedMaskForTarget, false, owner, receiver); } @@ -881,7 +881,7 @@ namespace Game.Entities public void FilterDisallowedFieldsMaskForFlag(UpdateMask changesMask, UpdateFieldFlag fieldVisibilityFlags) { - UpdateMask allowedMaskForTarget = new UpdateMask(9, new[] { 0x0000001Du }); + UpdateMask allowedMaskForTarget = new(9, new[] { 0x0000001Du }); AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags); changesMask.AND(allowedMaskForTarget); } @@ -1012,7 +1012,7 @@ namespace Game.Entities { public uint SpellID; public uint SpellXSpellVisualID; - public SpellCastVisualField SpellVisual = new SpellCastVisualField(); + public SpellCastVisualField SpellVisual = new(); public void WriteCreate(WorldPacket data, Unit owner, Player receiver) { @@ -1029,10 +1029,10 @@ namespace Game.Entities public class VisibleItem : BaseUpdateData { - public UpdateField ItemID = new UpdateField(0, 1); - public UpdateField ItemModifiedAppearanceID = new UpdateField(0, 2); - public UpdateField ItemAppearanceModID = new UpdateField(0, 3); - public UpdateField ItemVisual = new UpdateField(0, 4); + public UpdateField ItemID = new(0, 1); + public UpdateField ItemModifiedAppearanceID = new(0, 2); + public UpdateField ItemAppearanceModID = new(0, 3); + public UpdateField ItemVisual = new(0, 4); public VisibleItem() : base(5) { } @@ -1104,134 +1104,134 @@ namespace Game.Entities public class UnitData : BaseUpdateData { - public UpdateField> StateWorldEffectIDs = new UpdateField>(0, 1); - public DynamicUpdateField PassiveSpells = new DynamicUpdateField(0, 2); - public DynamicUpdateField WorldEffects = new DynamicUpdateField(0, 3); - public DynamicUpdateField ChannelObjects = new DynamicUpdateField(0, 4); - public UpdateField DisplayID = new UpdateField(0, 5); - public UpdateField StateSpellVisualID = new UpdateField(0, 6); - public UpdateField StateAnimID = new UpdateField(0, 7); - public UpdateField StateAnimKitID = new UpdateField(0, 8); - public UpdateField StateWorldEffectsQuestObjectiveID = new UpdateField(0, 9); - public UpdateField SpellOverrideNameID = new UpdateField(0, 10); - public UpdateField Charm = new UpdateField(0, 11); - public UpdateField Summon = new UpdateField(0, 12); - public UpdateField Critter = new UpdateField(0, 13); - public UpdateField CharmedBy = new UpdateField(0, 14); - public UpdateField SummonedBy = new UpdateField(0, 15); - public UpdateField CreatedBy = new UpdateField(0, 16); - public UpdateField DemonCreator = new UpdateField(0, 17); - public UpdateField LookAtControllerTarget = new UpdateField(0, 18); - public UpdateField Target = new UpdateField(0, 19); - public UpdateField BattlePetCompanionGUID = new UpdateField(0, 20); - public UpdateField BattlePetDBID = new UpdateField(0, 21); - public UpdateField ChannelData = new UpdateField(0, 22); - public UpdateField SummonedByHomeRealm = new UpdateField(0, 23); - public UpdateField Race = new UpdateField(0, 24); - public UpdateField ClassId = new UpdateField(0, 25); - public UpdateField PlayerClassId = new UpdateField(0, 26); - public UpdateField Sex = new UpdateField(0, 27); - public UpdateField DisplayPower = new UpdateField(0, 28); - public UpdateField OverrideDisplayPowerID = new UpdateField(0, 29); - public UpdateField Health = new UpdateField(0, 30); - public UpdateField MaxHealth = new UpdateField(0, 31); - public UpdateField Level = new UpdateField(32, 33); - public UpdateField EffectiveLevel = new UpdateField(32, 34); - public UpdateField ContentTuningID = new UpdateField(32, 35); - public UpdateField ScalingLevelMin = new UpdateField(32, 36); - public UpdateField ScalingLevelMax = new UpdateField(32, 37); - public UpdateField ScalingLevelDelta = new UpdateField(32, 38); - public UpdateField ScalingFactionGroup = new UpdateField(32, 39); - public UpdateField ScalingHealthItemLevelCurveID = new UpdateField(32, 40); - public UpdateField ScalingDamageItemLevelCurveID = new UpdateField(32, 41); - public UpdateField FactionTemplate = new UpdateField(32, 42); - public UpdateField Flags = new UpdateField(32, 43); - public UpdateField Flags2 = new UpdateField(32, 44); - public UpdateField Flags3 = new UpdateField(32, 45); - public UpdateField AuraState = new UpdateField(32, 46); - public UpdateField RangedAttackRoundBaseTime = new UpdateField(32, 47); - public UpdateField BoundingRadius = new UpdateField(32, 48); - public UpdateField CombatReach = new UpdateField(32, 49); - public UpdateField DisplayScale = new UpdateField(32, 50); - public UpdateField CreatureFamily = new UpdateField(32, 51); - public UpdateField CreatureType = new UpdateField(32, 52); - public UpdateField NativeDisplayID = new UpdateField(32, 53); - public UpdateField NativeXDisplayScale = new UpdateField(32, 54); - public UpdateField MountDisplayID = new UpdateField(32, 55); - public UpdateField CosmeticMountDisplayID = new UpdateField(32, 56); - public UpdateField MinDamage = new UpdateField(32, 57); - public UpdateField MaxDamage = new UpdateField(32, 58); - public UpdateField MinOffHandDamage = new UpdateField(32, 59); - public UpdateField MaxOffHandDamage = new UpdateField(32, 60); - public UpdateField StandState = new UpdateField(32, 61); - public UpdateField PetTalentPoints = new UpdateField(32, 62); - public UpdateField VisFlags = new UpdateField(32, 63); - public UpdateField AnimTier = new UpdateField(64, 65); - public UpdateField PetNumber = new UpdateField(64, 66); - public UpdateField PetNameTimestamp = new UpdateField(64, 67); - public UpdateField PetExperience = new UpdateField(64, 68); - public UpdateField PetNextLevelExperience = new UpdateField(64, 69); - public UpdateField ModCastingSpeed = new UpdateField(64, 70); - public UpdateField ModCastingSpeedNeg = new UpdateField(64, 71); - public UpdateField ModSpellHaste = new UpdateField(64, 72); - public UpdateField ModHaste = new UpdateField(64, 73); - public UpdateField ModRangedHaste = new UpdateField(64, 74); - public UpdateField ModHasteRegen = new UpdateField(64, 75); - public UpdateField ModTimeRate = new UpdateField(64, 76); - public UpdateField CreatedBySpell = new UpdateField(64, 77); - public UpdateField EmoteState = new UpdateField(64, 78); - public UpdateField BaseMana = new UpdateField(64, 79); - public UpdateField BaseHealth = new UpdateField(64, 80); - public UpdateField SheatheState = new UpdateField(64, 81); - public UpdateField PvpFlags = new UpdateField(64, 82); - public UpdateField PetFlags = new UpdateField(64, 83); - public UpdateField ShapeshiftForm = new UpdateField(64, 84); - public UpdateField AttackPower = new UpdateField(64, 85); - public UpdateField AttackPowerModPos = new UpdateField(64, 86); - public UpdateField AttackPowerModNeg = new UpdateField(64, 87); - public UpdateField AttackPowerMultiplier = new UpdateField(64, 88); - public UpdateField RangedAttackPower = new UpdateField(64, 89); - public UpdateField RangedAttackPowerModPos = new UpdateField(64, 90); - public UpdateField RangedAttackPowerModNeg = new UpdateField(64, 91); - public UpdateField RangedAttackPowerMultiplier = new UpdateField(64, 92); - public UpdateField MainHandWeaponAttackPower = new UpdateField(64, 93); - public UpdateField OffHandWeaponAttackPower = new UpdateField(64, 94); - public UpdateField RangedWeaponAttackPower = new UpdateField(64, 95); - public UpdateField SetAttackSpeedAura = new UpdateField(96, 97); - public UpdateField Lifesteal = new UpdateField(96, 98); - public UpdateField MinRangedDamage = new UpdateField(96, 99); - public UpdateField MaxRangedDamage = new UpdateField(96, 100); - public UpdateField ManaCostMultiplier = new UpdateField(96, 101); - public UpdateField MaxHealthModifier = new UpdateField(96, 102); - public UpdateField HoverHeight = new UpdateField(96, 103); - public UpdateField MinItemLevelCutoff = new UpdateField(96, 104); - public UpdateField MinItemLevel = new UpdateField(96, 105); - public UpdateField MaxItemLevel = new UpdateField(96, 106); - public UpdateField AzeriteItemLevel = new UpdateField(96, 107); - public UpdateField WildBattlePetLevel = new UpdateField(96, 108); - public UpdateField BattlePetCompanionNameTimestamp = new UpdateField(96, 109); - public UpdateField InteractSpellID = new UpdateField(96, 110); - public UpdateField ScaleDuration = new UpdateField(96, 111); - public UpdateField LooksLikeMountID = new UpdateField(96, 112); - public UpdateField LooksLikeCreatureID = new UpdateField(96, 113); - public UpdateField LookAtControllerID = new UpdateField(96, 114); - public UpdateField TaxiNodesID = new UpdateField(96, 115); - public UpdateField GuildGUID = new UpdateField(96, 116); - public UpdateField SkinningOwnerGUID = new UpdateField(96, 117); - public UpdateField SilencedSchoolMask = new UpdateField(96, 118); - public UpdateFieldArray NpcFlags = new UpdateFieldArray(2, 119, 120); - public UpdateFieldArray Power = new UpdateFieldArray(6, 122, 123); - public UpdateFieldArray MaxPower = new UpdateFieldArray(6, 122, 129); - public UpdateFieldArray PowerRegenFlatModifier = new UpdateFieldArray(6, 122, 135); - public UpdateFieldArray PowerRegenInterruptedFlatModifier = new UpdateFieldArray(6, 122, 141); - public UpdateFieldArray VirtualItems = new UpdateFieldArray(3, 147, 148); - public UpdateFieldArray AttackRoundBaseTime = new UpdateFieldArray(2, 151, 152); - public UpdateFieldArray Stats = new UpdateFieldArray(4, 154, 155); - public UpdateFieldArray StatPosBuff = new UpdateFieldArray(4, 154, 159); - public UpdateFieldArray StatNegBuff = new UpdateFieldArray(4, 154, 163); - public UpdateFieldArray Resistances = new UpdateFieldArray(7, 167, 168); - public UpdateFieldArray BonusResistanceMods = new UpdateFieldArray(7, 167, 175); - public UpdateFieldArray ManaCostModifier = new UpdateFieldArray(7, 167, 182); + public UpdateField> StateWorldEffectIDs = new(0, 1); + public DynamicUpdateField PassiveSpells = new(0, 2); + public DynamicUpdateField WorldEffects = new(0, 3); + public DynamicUpdateField ChannelObjects = new(0, 4); + public UpdateField DisplayID = new(0, 5); + public UpdateField StateSpellVisualID = new(0, 6); + public UpdateField StateAnimID = new(0, 7); + public UpdateField StateAnimKitID = new(0, 8); + public UpdateField StateWorldEffectsQuestObjectiveID = new(0, 9); + public UpdateField SpellOverrideNameID = new(0, 10); + public UpdateField Charm = new(0, 11); + public UpdateField Summon = new(0, 12); + public UpdateField Critter = new(0, 13); + public UpdateField CharmedBy = new(0, 14); + public UpdateField SummonedBy = new(0, 15); + public UpdateField CreatedBy = new(0, 16); + public UpdateField DemonCreator = new(0, 17); + public UpdateField LookAtControllerTarget = new(0, 18); + public UpdateField Target = new(0, 19); + public UpdateField BattlePetCompanionGUID = new(0, 20); + public UpdateField BattlePetDBID = new(0, 21); + public UpdateField ChannelData = new(0, 22); + public UpdateField SummonedByHomeRealm = new(0, 23); + public UpdateField Race = new(0, 24); + public UpdateField ClassId = new(0, 25); + public UpdateField PlayerClassId = new(0, 26); + public UpdateField Sex = new(0, 27); + public UpdateField DisplayPower = new(0, 28); + public UpdateField OverrideDisplayPowerID = new(0, 29); + public UpdateField Health = new(0, 30); + public UpdateField MaxHealth = new(0, 31); + public UpdateField Level = new(32, 33); + public UpdateField EffectiveLevel = new(32, 34); + public UpdateField ContentTuningID = new(32, 35); + public UpdateField ScalingLevelMin = new(32, 36); + public UpdateField ScalingLevelMax = new(32, 37); + public UpdateField ScalingLevelDelta = new(32, 38); + public UpdateField ScalingFactionGroup = new(32, 39); + public UpdateField ScalingHealthItemLevelCurveID = new(32, 40); + public UpdateField ScalingDamageItemLevelCurveID = new(32, 41); + public UpdateField FactionTemplate = new(32, 42); + public UpdateField Flags = new(32, 43); + public UpdateField Flags2 = new(32, 44); + public UpdateField Flags3 = new(32, 45); + public UpdateField AuraState = new(32, 46); + public UpdateField RangedAttackRoundBaseTime = new(32, 47); + public UpdateField BoundingRadius = new(32, 48); + public UpdateField CombatReach = new(32, 49); + public UpdateField DisplayScale = new(32, 50); + public UpdateField CreatureFamily = new(32, 51); + public UpdateField CreatureType = new(32, 52); + public UpdateField NativeDisplayID = new(32, 53); + public UpdateField NativeXDisplayScale = new(32, 54); + public UpdateField MountDisplayID = new(32, 55); + public UpdateField CosmeticMountDisplayID = new(32, 56); + public UpdateField MinDamage = new(32, 57); + public UpdateField MaxDamage = new(32, 58); + public UpdateField MinOffHandDamage = new(32, 59); + public UpdateField MaxOffHandDamage = new(32, 60); + public UpdateField StandState = new(32, 61); + public UpdateField PetTalentPoints = new(32, 62); + public UpdateField VisFlags = new(32, 63); + public UpdateField AnimTier = new(64, 65); + public UpdateField PetNumber = new(64, 66); + public UpdateField PetNameTimestamp = new(64, 67); + public UpdateField PetExperience = new(64, 68); + public UpdateField PetNextLevelExperience = new(64, 69); + public UpdateField ModCastingSpeed = new(64, 70); + public UpdateField ModCastingSpeedNeg = new(64, 71); + public UpdateField ModSpellHaste = new(64, 72); + public UpdateField ModHaste = new(64, 73); + public UpdateField ModRangedHaste = new(64, 74); + public UpdateField ModHasteRegen = new(64, 75); + public UpdateField ModTimeRate = new(64, 76); + public UpdateField CreatedBySpell = new(64, 77); + public UpdateField EmoteState = new(64, 78); + public UpdateField BaseMana = new(64, 79); + public UpdateField BaseHealth = new(64, 80); + public UpdateField SheatheState = new(64, 81); + public UpdateField PvpFlags = new(64, 82); + public UpdateField PetFlags = new(64, 83); + public UpdateField ShapeshiftForm = new(64, 84); + public UpdateField AttackPower = new(64, 85); + public UpdateField AttackPowerModPos = new(64, 86); + public UpdateField AttackPowerModNeg = new(64, 87); + public UpdateField AttackPowerMultiplier = new(64, 88); + public UpdateField RangedAttackPower = new(64, 89); + public UpdateField RangedAttackPowerModPos = new(64, 90); + public UpdateField RangedAttackPowerModNeg = new(64, 91); + public UpdateField RangedAttackPowerMultiplier = new(64, 92); + public UpdateField MainHandWeaponAttackPower = new(64, 93); + public UpdateField OffHandWeaponAttackPower = new(64, 94); + public UpdateField RangedWeaponAttackPower = new(64, 95); + public UpdateField SetAttackSpeedAura = new(96, 97); + public UpdateField Lifesteal = new(96, 98); + public UpdateField MinRangedDamage = new(96, 99); + public UpdateField MaxRangedDamage = new(96, 100); + public UpdateField ManaCostMultiplier = new(96, 101); + public UpdateField MaxHealthModifier = new(96, 102); + public UpdateField HoverHeight = new(96, 103); + public UpdateField MinItemLevelCutoff = new(96, 104); + public UpdateField MinItemLevel = new(96, 105); + public UpdateField MaxItemLevel = new(96, 106); + public UpdateField AzeriteItemLevel = new(96, 107); + public UpdateField WildBattlePetLevel = new(96, 108); + public UpdateField BattlePetCompanionNameTimestamp = new(96, 109); + public UpdateField InteractSpellID = new(96, 110); + public UpdateField ScaleDuration = new(96, 111); + public UpdateField LooksLikeMountID = new(96, 112); + public UpdateField LooksLikeCreatureID = new(96, 113); + public UpdateField LookAtControllerID = new(96, 114); + public UpdateField TaxiNodesID = new(96, 115); + public UpdateField GuildGUID = new(96, 116); + public UpdateField SkinningOwnerGUID = new(96, 117); + public UpdateField SilencedSchoolMask = new(96, 118); + public UpdateFieldArray NpcFlags = new(2, 119, 120); + public UpdateFieldArray Power = new(6, 122, 123); + public UpdateFieldArray MaxPower = new(6, 122, 129); + public UpdateFieldArray PowerRegenFlatModifier = new(6, 122, 135); + public UpdateFieldArray PowerRegenInterruptedFlatModifier = new(6, 122, 141); + public UpdateFieldArray VirtualItems = new(3, 147, 148); + public UpdateFieldArray AttackRoundBaseTime = new(2, 151, 152); + public UpdateFieldArray Stats = new(4, 154, 155); + public UpdateFieldArray StatPosBuff = new(4, 154, 159); + public UpdateFieldArray StatNegBuff = new(4, 154, 163); + public UpdateFieldArray Resistances = new(7, 167, 168); + public UpdateFieldArray BonusResistanceMods = new(7, 167, 175); + public UpdateFieldArray ManaCostModifier = new(7, 167, 182); public UnitData() : base(0, TypeId.Unit, 189) { } @@ -1426,7 +1426,7 @@ namespace Game.Entities public void WriteUpdate(WorldPacket data, UpdateFieldFlag fieldVisibilityFlags, Unit owner, Player receiver) { - UpdateMask allowedMaskForTarget = new UpdateMask(192, new uint[] { 0xFFFFDFFFu, 0xE1FF7FFFu, 0x001EFFFFu, 0xFFFFFF81u, 0x03F8007Fu, 0x00000000u }); + UpdateMask allowedMaskForTarget = new(192, new uint[] { 0xFFFFDFFFu, 0xE1FF7FFFu, 0x001EFFFFu, 0xFFFFFF81u, 0x03F8007Fu, 0x00000000u }); AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags); WriteUpdate(data, _changesMask & allowedMaskForTarget, false, owner, receiver); } @@ -1443,7 +1443,7 @@ namespace Game.Entities public void FilterDisallowedFieldsMaskForFlag(UpdateMask changesMask, UpdateFieldFlag fieldVisibilityFlags) { - UpdateMask allowedMaskForTarget = new UpdateMask(192, new[] { 0xFFFFDFFFu, 0xE1FF7FFFu, 0x001EFFFFu, 0xFFFFFF81u, 0x03F8007Fu, 0x00000000u }); + UpdateMask allowedMaskForTarget = new(192, new[] { 0xFFFFDFFFu, 0xE1FF7FFFu, 0x001EFFFFu, 0xFFFFFF81u, 0x03F8007Fu, 0x00000000u }); AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags); changesMask.AND(allowedMaskForTarget); } @@ -2305,12 +2305,12 @@ namespace Game.Entities public class QuestLog : BaseUpdateData { - public UpdateField QuestID = new UpdateField(0, 1); - public UpdateField StateFlags = new UpdateField(0, 2); - public UpdateField EndTime = new UpdateField(0, 3); - public UpdateField AcceptTime = new UpdateField(0, 4); - public UpdateField ObjectiveFlags = new UpdateField(0, 5); - public UpdateFieldArray ObjectiveProgress = new UpdateFieldArray(24, 6, 7); + public UpdateField QuestID = new(0, 1); + public UpdateField StateFlags = new(0, 2); + public UpdateField EndTime = new(0, 3); + public UpdateField AcceptTime = new(0, 4); + public UpdateField ObjectiveFlags = new(0, 5); + public UpdateFieldArray ObjectiveProgress = new(24, 6, 7); public QuestLog() : base(31) { } @@ -2387,13 +2387,13 @@ namespace Game.Entities public class ArenaCooldown : BaseUpdateData { - public UpdateField SpellID = new UpdateField(0, 1); - public UpdateField Charges = new UpdateField(0, 2); - public UpdateField Flags = new UpdateField(0, 3); - public UpdateField StartTime = new UpdateField(0, 4); - public UpdateField EndTime = new UpdateField(0, 5); - public UpdateField NextChargeTime = new UpdateField(0, 6); - public UpdateField MaxCharges = new UpdateField(0, 7); + public UpdateField SpellID = new(0, 1); + public UpdateField Charges = new(0, 2); + public UpdateField Flags = new(0, 3); + public UpdateField StartTime = new(0, 4); + public UpdateField EndTime = new(0, 5); + public UpdateField NextChargeTime = new(0, 6); + public UpdateField MaxCharges = new(0, 7); public ArenaCooldown() : base(8) { } @@ -2486,41 +2486,41 @@ namespace Game.Entities public class PlayerData : BaseUpdateData { - public UpdateField HasQuestSession = new UpdateField(0, 1); - public UpdateField HasLevelLink = new UpdateField(0, 2); - public DynamicUpdateFieldCustomizations = new DynamicUpdateField(0, 3); - public DynamicUpdateFieldQuestSessionQuestLog = new DynamicUpdateField(0, 4); - public DynamicUpdateFieldArenaCooldowns = new DynamicUpdateField(0, 5); - public UpdateField DuelArbiter = new UpdateField(0, 6); - public UpdateField WowAccount = new UpdateField(0, 7); - public UpdateField LootTargetGUID = new UpdateField(0, 8); - public UpdateField PlayerFlags = new UpdateField(0, 9); - public UpdateField PlayerFlagsEx = new UpdateField(0, 10); - public UpdateField GuildRankID = new UpdateField(0, 11); - public UpdateField GuildDeleteDate = new UpdateField(0, 12); - public UpdateField GuildLevel = new UpdateField(0, 13); - public UpdateField PartyType = new UpdateField(0, 14); - public UpdateField NativeSex = new UpdateField(0, 15); - public UpdateField Inebriation = new UpdateField(0, 16); - public UpdateField PvpTitle = new UpdateField(0, 17); - public UpdateField ArenaFaction = new UpdateField(0, 18); - public UpdateField DuelTeam = new UpdateField(0, 19); - public UpdateField GuildTimeStamp = new UpdateField(0, 20); - public UpdateField PlayerTitle = new UpdateField(0, 21); - public UpdateField FakeInebriation = new UpdateField(0, 22); - public UpdateField VirtualPlayerRealm = new UpdateField(0, 23); - public UpdateField CurrentSpecID = new UpdateField(0, 24); - public UpdateField TaxiMountAnimKitID = new UpdateField(0, 25); - public UpdateField CurrentBattlePetBreedQuality = new UpdateField(0, 26); - public UpdateField HonorLevel = new UpdateField(0, 27); - public UpdateField Field_B0 = new UpdateField(0, 28); - public UpdateField Field_B4 = new UpdateField(0, 29); - public UpdateField CtrOptions = new UpdateField(0, 30); - public UpdateField CovenantID = new UpdateField(0, 31); - public UpdateField SoulbindID = new UpdateField(32, 33); - public UpdateFieldArrayQuestLog = new UpdateFieldArray(125, 34, 35); - public UpdateFieldArray VisibleItems = new UpdateFieldArray(19, 160, 161); - public UpdateFieldArrayAvgItemLevel = new UpdateFieldArray(4, 180, 181); + public UpdateField HasQuestSession = new(0, 1); + public UpdateField HasLevelLink = new(0, 2); + public DynamicUpdateFieldCustomizations = new(0, 3); + public DynamicUpdateFieldQuestSessionQuestLog = new(0, 4); + public DynamicUpdateFieldArenaCooldowns = new(0, 5); + public UpdateField DuelArbiter = new(0, 6); + public UpdateField WowAccount = new(0, 7); + public UpdateField LootTargetGUID = new(0, 8); + public UpdateField PlayerFlags = new(0, 9); + public UpdateField PlayerFlagsEx = new(0, 10); + public UpdateField GuildRankID = new(0, 11); + public UpdateField GuildDeleteDate = new(0, 12); + public UpdateField GuildLevel = new(0, 13); + public UpdateField PartyType = new(0, 14); + public UpdateField NativeSex = new(0, 15); + public UpdateField Inebriation = new(0, 16); + public UpdateField PvpTitle = new(0, 17); + public UpdateField ArenaFaction = new(0, 18); + public UpdateField DuelTeam = new(0, 19); + public UpdateField GuildTimeStamp = new(0, 20); + public UpdateField PlayerTitle = new(0, 21); + public UpdateField FakeInebriation = new(0, 22); + public UpdateField VirtualPlayerRealm = new(0, 23); + public UpdateField CurrentSpecID = new(0, 24); + public UpdateField TaxiMountAnimKitID = new(0, 25); + public UpdateField CurrentBattlePetBreedQuality = new(0, 26); + public UpdateField HonorLevel = new(0, 27); + public UpdateField Field_B0 = new(0, 28); + public UpdateField Field_B4 = new(0, 29); + public UpdateField CtrOptions = new(0, 30); + public UpdateField CovenantID = new(0, 31); + public UpdateField SoulbindID = new(32, 33); + public UpdateFieldArrayQuestLog = new(125, 34, 35); + public UpdateFieldArray VisibleItems = new(19, 160, 161); + public UpdateFieldArrayAvgItemLevel = new(4, 180, 181); public PlayerData() : base(0, TypeId.Player, 185) { } @@ -2596,7 +2596,7 @@ namespace Game.Entities public void WriteUpdate(WorldPacket data, UpdateFieldFlag fieldVisibilityFlags, Player owner, Player receiver) { - UpdateMask allowedMaskForTarget = new UpdateMask(185, new[] { 0xFFFFFFEDu, 0x00000003u, 0x00000000u, 0x00000000u, 0x00000000u, 0x01FFFFFFu }); + UpdateMask allowedMaskForTarget = new(185, new[] { 0xFFFFFFEDu, 0x00000003u, 0x00000000u, 0x00000000u, 0x00000000u, 0x01FFFFFFu }); AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags); WriteUpdate(data, _changesMask & allowedMaskForTarget, false, owner, receiver); } @@ -2609,7 +2609,7 @@ namespace Game.Entities public void FilterDisallowedFieldsMaskForFlag(UpdateMask changesMask, UpdateFieldFlag fieldVisibilityFlags) { - UpdateMask allowedMaskForTarget = new UpdateMask(185, new[] { 0xFFFFFFEDu, 0x00000003u, 0x00000000u, 0x00000000u, 0x00000000u, 0x01FFFFFFu }); + UpdateMask allowedMaskForTarget = new(185, new[] { 0xFFFFFFEDu, 0x00000003u, 0x00000000u, 0x00000000u, 0x00000000u, 0x01FFFFFFu }); AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags); changesMask.AND(allowedMaskForTarget); } @@ -2883,13 +2883,13 @@ namespace Game.Entities public class SkillInfo : BaseUpdateData { - public UpdateFieldArray SkillLineID = new UpdateFieldArray(256, 0, 1); - public UpdateFieldArray SkillStep = new UpdateFieldArray(256, 0, 257); - public UpdateFieldArray SkillRank = new UpdateFieldArray(256, 0, 513); - public UpdateFieldArray SkillStartingRank = new UpdateFieldArray(256, 0, 769); - public UpdateFieldArray SkillMaxRank = new UpdateFieldArray(256, 0, 1025); - public UpdateFieldArray SkillTempBonus = new UpdateFieldArray(256, 0, 1281); - public UpdateFieldArray SkillPermBonus = new UpdateFieldArray(256, 0, 1537); + public UpdateFieldArray SkillLineID = new(256, 0, 1); + public UpdateFieldArray SkillStep = new(256, 0, 257); + public UpdateFieldArray SkillRank = new(256, 0, 513); + public UpdateFieldArray SkillStartingRank = new(256, 0, 769); + public UpdateFieldArray SkillMaxRank = new(256, 0, 1025); + public UpdateFieldArray SkillTempBonus = new(256, 0, 1281); + public UpdateFieldArray SkillPermBonus = new(256, 0, 1537); public SkillInfo() : base(1793) { } @@ -2972,8 +2972,8 @@ namespace Game.Entities public class RestInfo : BaseUpdateData { - public UpdateField Threshold = new UpdateField(0, 1); - public UpdateField StateID = new UpdateField(0, 2); + public UpdateField Threshold = new(0, 1); + public UpdateField StateID = new(0, 2); public RestInfo() : base(3) { } @@ -3015,15 +3015,15 @@ namespace Game.Entities public class PVPInfo : BaseUpdateData { - public UpdateField Field_0 = new UpdateField(0, 1); - public UpdateField Field_4 = new UpdateField(0, 2); - public UpdateField Field_8 = new UpdateField(0, 3); - public UpdateField Field_C = new UpdateField(0, 4); - public UpdateField Rating = new UpdateField(0, 5); - public UpdateField Field_14 = new UpdateField(0, 6); - public UpdateField Field_18 = new UpdateField(0, 7); - public UpdateField PvpTierID = new UpdateField(0, 8); - public UpdateField Field_20 = new UpdateField(0, 9); + public UpdateField Field_0 = new(0, 1); + public UpdateField Field_4 = new(0, 2); + public UpdateField Field_8 = new(0, 3); + public UpdateField Field_C = new(0, 4); + public UpdateField Rating = new(0, 5); + public UpdateField Field_14 = new(0, 6); + public UpdateField Field_18 = new(0, 7); + public UpdateField PvpTierID = new(0, 8); + public UpdateField Field_20 = new(0, 9); public PVPInfo() : base(10) { } @@ -3213,7 +3213,7 @@ namespace Game.Entities public class MultiFloorExplore { - public List WorldMapOverlayIDs = new List(); + public List WorldMapOverlayIDs = new(); public void WriteCreate(WorldPacket data, Player owner, Player receiver) { @@ -3255,8 +3255,8 @@ namespace Game.Entities public class ActivePlayerUnk901 : BaseUpdateData { - public UpdateField Field_0 = new UpdateField(0, 1 ); - public UpdateField Field_10 = new UpdateField(0, 2 ); + public UpdateField Field_0 = new(0, 1 ); + public UpdateField Field_10 = new(0, 2 ); public ActivePlayerUnk901() : base(3) { } @@ -3298,8 +3298,8 @@ namespace Game.Entities public class ReplayedQuest : BaseUpdateData { - public UpdateField QuestID = new UpdateField(0, 1); - public UpdateField ReplayTime = new UpdateField(0, 2); + public UpdateField QuestID = new(0, 1); + public UpdateField ReplayTime = new(0, 2); public ReplayedQuest() : base(3) { } @@ -3341,8 +3341,8 @@ namespace Game.Entities public class QuestSession : BaseUpdateData { - public UpdateField Owner = new UpdateField(0, 1); - public UpdateFieldArray QuestCompleted = new UpdateFieldArray(875, 2, 3); + public UpdateField Owner = new(0, 1); + public UpdateFieldArray QuestCompleted = new(875, 2, 3); public QuestSession() : base(878) { } @@ -3396,134 +3396,134 @@ namespace Game.Entities public class ActivePlayerData : BaseUpdateData { - public UpdateField BackpackAutoSortDisabled = new UpdateField(0, 1); - public UpdateField BankAutoSortDisabled = new UpdateField(0, 2); - public UpdateField SortBagsRightToLeft = new UpdateField(0, 3); - public UpdateField InsertItemsLeftToRight = new UpdateField(0, 4); - public UpdateFieldArray> Research = new UpdateFieldArray>(1, 27, 28); - public DynamicUpdateField KnownTitles = new DynamicUpdateField(0, 5); - public DynamicUpdateField ResearchSites = new DynamicUpdateField(0, 6); - public DynamicUpdateField ResearchSiteProgress = new DynamicUpdateField(0, 7); - public DynamicUpdateField DailyQuestsCompleted = new DynamicUpdateField(0, 8); - public DynamicUpdateField AvailableQuestLineXQuestIDs = new DynamicUpdateField(0, 9); - public DynamicUpdateField Heirlooms = new DynamicUpdateField(0, 10); - public DynamicUpdateField HeirloomFlags = new DynamicUpdateField(0, 11); - public DynamicUpdateField Toys = new DynamicUpdateField(0, 12); - public DynamicUpdateField ToyFlags = new DynamicUpdateField(0, 13); - public DynamicUpdateField Transmog = new DynamicUpdateField(0, 14); - public DynamicUpdateField ConditionalTransmog = new DynamicUpdateField(0, 15); - public DynamicUpdateField SelfResSpells = new DynamicUpdateField(0, 16); - public DynamicUpdateField RuneforgePowers = new DynamicUpdateField(0, 17); - public DynamicUpdateField TransmogIllusions = new DynamicUpdateField(0, 18); - public DynamicUpdateField SpellPctModByLabel = new DynamicUpdateField(0, 20); - public DynamicUpdateField SpellFlatModByLabel = new DynamicUpdateField(0, 21); - public DynamicUpdateField MawPowers = new DynamicUpdateField(0, 22); - public DynamicUpdateField MultiFloorExploration = new DynamicUpdateField(0, 23); - public DynamicUpdateField RecipeProgression = new DynamicUpdateField(0, 24); - public DynamicUpdateField ReplayedQuests = new DynamicUpdateField(0, 25); - public DynamicUpdateField DisabledSpells = new DynamicUpdateField(0, 26); - public DynamicUpdateField CharacterRestrictions = new DynamicUpdateField(0, 19); - public UpdateField FarsightObject = new UpdateField(0, 29); - public UpdateField SummonedBattlePetGUID = new UpdateField(0, 30); - public UpdateField Coinage = new UpdateField(0, 31); - public UpdateField XP = new UpdateField(0, 32); - public UpdateField NextLevelXP = new UpdateField(0, 33); - public UpdateField TrialXP = new UpdateField(34, 35); - public UpdateField Skill = new UpdateField(34, 36); - public UpdateField CharacterPoints = new UpdateField(34, 37); - public UpdateField MaxTalentTiers = new UpdateField(34, 38); - public UpdateField TrackCreatureMask = new UpdateField(34, 39); - public UpdateField MainhandExpertise = new UpdateField(34, 40); - public UpdateField OffhandExpertise = new UpdateField(34, 41); - public UpdateField RangedExpertise = new UpdateField(34, 42); - public UpdateField CombatRatingExpertise = new UpdateField(34, 43); - public UpdateField BlockPercentage = new UpdateField(34, 44); - public UpdateField DodgePercentage = new UpdateField(34, 45); - public UpdateField DodgePercentageFromAttribute = new UpdateField(34, 46); - public UpdateField ParryPercentage = new UpdateField(34, 47); - public UpdateField ParryPercentageFromAttribute = new UpdateField(34, 48); - public UpdateField CritPercentage = new UpdateField(34, 49); - public UpdateField RangedCritPercentage = new UpdateField(34, 50); - public UpdateField OffhandCritPercentage = new UpdateField(34, 51); - public UpdateField SpellCritPercentage = new UpdateField(34, 52); - public UpdateField ShieldBlock = new UpdateField(34, 53); - public UpdateField ShieldBlockCritPercentage = new UpdateField(34, 54); - public UpdateField Mastery = new UpdateField(34, 55); - public UpdateField Speed = new UpdateField(34, 56); - public UpdateField Avoidance = new UpdateField(34, 57); - public UpdateField Sturdiness = new UpdateField(34, 58); - public UpdateField Versatility = new UpdateField(34, 59); - public UpdateField VersatilityBonus = new UpdateField(34, 60); - public UpdateField PvpPowerDamage = new UpdateField(34, 61); - public UpdateField PvpPowerHealing = new UpdateField(34, 62); - public UpdateField ModHealingDonePos = new UpdateField(34, 63); - public UpdateField ModHealingPercent = new UpdateField(34, 64); - public UpdateField ModPeriodicHealingDonePercent = new UpdateField(34, 65); - public UpdateField ModSpellPowerPercent = new UpdateField(66, 67); - public UpdateField ModResiliencePercent = new UpdateField(66, 68); - public UpdateField OverrideSpellPowerByAPPercent = new UpdateField(66, 69); - public UpdateField OverrideAPBySpellPowerPercent = new UpdateField(66, 70); - public UpdateField ModTargetResistance = new UpdateField(66, 71); - public UpdateField ModTargetPhysicalResistance = new UpdateField(66, 72); - public UpdateField LocalFlags = new UpdateField(66, 73); - public UpdateField GrantableLevels = new UpdateField(66, 74); - public UpdateField MultiActionBars = new UpdateField(66, 75); - public UpdateField LifetimeMaxRank = new UpdateField(66, 76); - public UpdateField NumRespecs = new UpdateField(66, 77); - public UpdateField PvpMedals = new UpdateField(66, 78); - public UpdateField TodayHonorableKills = new UpdateField(66, 79); - public UpdateField YesterdayHonorableKills = new UpdateField(66, 80); - public UpdateField LifetimeHonorableKills = new UpdateField(66, 81); - public UpdateField WatchedFactionIndex = new UpdateField(66, 82); - public UpdateField MaxLevel = new UpdateField(66, 83); - public UpdateField ScalingPlayerLevelDelta = new UpdateField(66, 84); - public UpdateField MaxCreatureScalingLevel = new UpdateField(66, 85); - public UpdateField PetSpellPower = new UpdateField(66, 86); - public UpdateField UiHitModifier = new UpdateField(66, 87); - public UpdateField UiSpellHitModifier = new UpdateField(66, 88); - public UpdateField HomeRealmTimeOffset = new UpdateField(66, 89); - public UpdateField ModPetHaste = new UpdateField(66, 90); - public UpdateField JailersTowerLevelMax = new UpdateField(66, 91); - public UpdateField JailersTowerLevel = new UpdateField(66, 92); - public UpdateField LocalRegenFlags = new UpdateField(66, 93); - public UpdateField AuraVision = new UpdateField(66, 94); - public UpdateField NumBackpackSlots = new UpdateField(66, 95); - public UpdateField OverrideSpellsID = new UpdateField(66, 96); - public UpdateField LootSpecID = new UpdateField(66, 97); - public UpdateField OverrideZonePVPType = new UpdateField(98, 99); - public UpdateField BnetAccount = new UpdateField(98, 100); - public UpdateField GuildClubMemberID = new UpdateField(98, 101); - public UpdateField Honor = new UpdateField(98, 102); - public UpdateField HonorNextLevel = new UpdateField(98, 103); - public UpdateField PvpRewardAchieved = new UpdateField(98, 104); - public UpdateField PvpTierMaxFromWins = new UpdateField(98, 105); - public UpdateField PvpLastWeeksRewardAchieved = new UpdateField(98, 106); - public UpdateField PvpLastWeeksTierMaxFromWins = new UpdateField(98, 107); - public UpdateField PvpLastWeeksRewardClaimed = new UpdateField(98, 108); - public UpdateField NumBankSlots = new UpdateField(98, 109); - public UpdateField Field_1410 = new UpdateField(98, 111); - public UpdateField> QuestSession = new UpdateField>(98, 110); - public UpdateField UiChromieTimeExpansionID = new UpdateField(98, 112); - public UpdateField TransportServerTime = new UpdateField(98, 113); - public UpdateFieldArray InvSlots = new UpdateFieldArray(199, 114, 115); - public UpdateFieldArray TrackResourceMask = new UpdateFieldArray(2, 314, 315); - public UpdateFieldArray ExploredZones = new UpdateFieldArray(192, 317, 318); - public UpdateFieldArray RestInfo = new UpdateFieldArray(2, 510, 511); - public UpdateFieldArray ModDamageDonePos = new UpdateFieldArray(7, 513, 514); - public UpdateFieldArray ModDamageDoneNeg = new UpdateFieldArray(7, 513, 521); - public UpdateFieldArray ModDamageDonePercent = new UpdateFieldArray(7, 513, 528); - public UpdateFieldArray ModHealingDonePercent = new UpdateFieldArray(7, 513, 535); - public UpdateFieldArray WeaponDmgMultipliers = new UpdateFieldArray(3, 542, 543); - public UpdateFieldArray WeaponAtkSpeedMultipliers = new UpdateFieldArray(3, 542, 546); - public UpdateFieldArray BuybackPrice = new UpdateFieldArray(12, 549, 550); - public UpdateFieldArray BuybackTimestamp = new UpdateFieldArray(12, 549, 562); - public UpdateFieldArray CombatRatings = new UpdateFieldArray(32, 574, 575); - public UpdateFieldArray PvpInfo = new UpdateFieldArray(6, 607, 608); - public UpdateFieldArray NoReagentCostMask = new UpdateFieldArray(4, 614, 615); - public UpdateFieldArray ProfessionSkillLine = new UpdateFieldArray(2, 619, 620); - public UpdateFieldArray BagSlotFlags = new UpdateFieldArray(4, 622, 623); - public UpdateFieldArray BankBagSlotFlags = new UpdateFieldArray(7, 627, 628); - public UpdateFieldArray QuestCompleted = new UpdateFieldArray(875, 635, 636); + public UpdateField BackpackAutoSortDisabled = new(0, 1); + public UpdateField BankAutoSortDisabled = new(0, 2); + public UpdateField SortBagsRightToLeft = new(0, 3); + public UpdateField InsertItemsLeftToRight = new(0, 4); + public UpdateFieldArray> Research = new(1, 27, 28); + public DynamicUpdateField KnownTitles = new(0, 5); + public DynamicUpdateField ResearchSites = new(0, 6); + public DynamicUpdateField ResearchSiteProgress = new(0, 7); + public DynamicUpdateField DailyQuestsCompleted = new(0, 8); + public DynamicUpdateField AvailableQuestLineXQuestIDs = new(0, 9); + public DynamicUpdateField Heirlooms = new(0, 10); + public DynamicUpdateField HeirloomFlags = new(0, 11); + public DynamicUpdateField Toys = new(0, 12); + public DynamicUpdateField ToyFlags = new(0, 13); + public DynamicUpdateField Transmog = new(0, 14); + public DynamicUpdateField ConditionalTransmog = new(0, 15); + public DynamicUpdateField SelfResSpells = new(0, 16); + public DynamicUpdateField RuneforgePowers = new(0, 17); + public DynamicUpdateField TransmogIllusions = new(0, 18); + public DynamicUpdateField SpellPctModByLabel = new(0, 20); + public DynamicUpdateField SpellFlatModByLabel = new(0, 21); + public DynamicUpdateField MawPowers = new(0, 22); + public DynamicUpdateField MultiFloorExploration = new(0, 23); + public DynamicUpdateField RecipeProgression = new(0, 24); + public DynamicUpdateField ReplayedQuests = new(0, 25); + public DynamicUpdateField DisabledSpells = new(0, 26); + public DynamicUpdateField CharacterRestrictions = new(0, 19); + public UpdateField FarsightObject = new(0, 29); + public UpdateField SummonedBattlePetGUID = new(0, 30); + public UpdateField Coinage = new(0, 31); + public UpdateField XP = new(0, 32); + public UpdateField NextLevelXP = new(0, 33); + public UpdateField TrialXP = new(34, 35); + public UpdateField Skill = new(34, 36); + public UpdateField CharacterPoints = new(34, 37); + public UpdateField MaxTalentTiers = new(34, 38); + public UpdateField TrackCreatureMask = new(34, 39); + public UpdateField MainhandExpertise = new(34, 40); + public UpdateField OffhandExpertise = new(34, 41); + public UpdateField RangedExpertise = new(34, 42); + public UpdateField CombatRatingExpertise = new(34, 43); + public UpdateField BlockPercentage = new(34, 44); + public UpdateField DodgePercentage = new(34, 45); + public UpdateField DodgePercentageFromAttribute = new(34, 46); + public UpdateField ParryPercentage = new(34, 47); + public UpdateField ParryPercentageFromAttribute = new(34, 48); + public UpdateField CritPercentage = new(34, 49); + public UpdateField RangedCritPercentage = new(34, 50); + public UpdateField OffhandCritPercentage = new(34, 51); + public UpdateField SpellCritPercentage = new(34, 52); + public UpdateField ShieldBlock = new(34, 53); + public UpdateField ShieldBlockCritPercentage = new(34, 54); + public UpdateField Mastery = new(34, 55); + public UpdateField Speed = new(34, 56); + public UpdateField Avoidance = new(34, 57); + public UpdateField Sturdiness = new(34, 58); + public UpdateField Versatility = new(34, 59); + public UpdateField VersatilityBonus = new(34, 60); + public UpdateField PvpPowerDamage = new(34, 61); + public UpdateField PvpPowerHealing = new(34, 62); + public UpdateField ModHealingDonePos = new(34, 63); + public UpdateField ModHealingPercent = new(34, 64); + public UpdateField ModPeriodicHealingDonePercent = new(34, 65); + public UpdateField ModSpellPowerPercent = new(66, 67); + public UpdateField ModResiliencePercent = new(66, 68); + public UpdateField OverrideSpellPowerByAPPercent = new(66, 69); + public UpdateField OverrideAPBySpellPowerPercent = new(66, 70); + public UpdateField ModTargetResistance = new(66, 71); + public UpdateField ModTargetPhysicalResistance = new(66, 72); + public UpdateField LocalFlags = new(66, 73); + public UpdateField GrantableLevels = new(66, 74); + public UpdateField MultiActionBars = new(66, 75); + public UpdateField LifetimeMaxRank = new(66, 76); + public UpdateField NumRespecs = new(66, 77); + public UpdateField PvpMedals = new(66, 78); + public UpdateField TodayHonorableKills = new(66, 79); + public UpdateField YesterdayHonorableKills = new(66, 80); + public UpdateField LifetimeHonorableKills = new(66, 81); + public UpdateField WatchedFactionIndex = new(66, 82); + public UpdateField MaxLevel = new(66, 83); + public UpdateField ScalingPlayerLevelDelta = new(66, 84); + public UpdateField MaxCreatureScalingLevel = new(66, 85); + public UpdateField PetSpellPower = new(66, 86); + public UpdateField UiHitModifier = new(66, 87); + public UpdateField UiSpellHitModifier = new(66, 88); + public UpdateField HomeRealmTimeOffset = new(66, 89); + public UpdateField ModPetHaste = new(66, 90); + public UpdateField JailersTowerLevelMax = new(66, 91); + public UpdateField JailersTowerLevel = new(66, 92); + public UpdateField LocalRegenFlags = new(66, 93); + public UpdateField AuraVision = new(66, 94); + public UpdateField NumBackpackSlots = new(66, 95); + public UpdateField OverrideSpellsID = new(66, 96); + public UpdateField LootSpecID = new(66, 97); + public UpdateField OverrideZonePVPType = new(98, 99); + public UpdateField BnetAccount = new(98, 100); + public UpdateField GuildClubMemberID = new(98, 101); + public UpdateField Honor = new(98, 102); + public UpdateField HonorNextLevel = new(98, 103); + public UpdateField PvpRewardAchieved = new(98, 104); + public UpdateField PvpTierMaxFromWins = new(98, 105); + public UpdateField PvpLastWeeksRewardAchieved = new(98, 106); + public UpdateField PvpLastWeeksTierMaxFromWins = new(98, 107); + public UpdateField PvpLastWeeksRewardClaimed = new(98, 108); + public UpdateField NumBankSlots = new(98, 109); + public UpdateField Field_1410 = new(98, 111); + public UpdateField> QuestSession = new(98, 110); + public UpdateField UiChromieTimeExpansionID = new(98, 112); + public UpdateField TransportServerTime = new(98, 113); + public UpdateFieldArray InvSlots = new(199, 114, 115); + public UpdateFieldArray TrackResourceMask = new(2, 314, 315); + public UpdateFieldArray ExploredZones = new(192, 317, 318); + public UpdateFieldArray RestInfo = new(2, 510, 511); + public UpdateFieldArray ModDamageDonePos = new(7, 513, 514); + public UpdateFieldArray ModDamageDoneNeg = new(7, 513, 521); + public UpdateFieldArray ModDamageDonePercent = new(7, 513, 528); + public UpdateFieldArray ModHealingDonePercent = new(7, 513, 535); + public UpdateFieldArray WeaponDmgMultipliers = new(3, 542, 543); + public UpdateFieldArray WeaponAtkSpeedMultipliers = new(3, 542, 546); + public UpdateFieldArray BuybackPrice = new(12, 549, 550); + public UpdateFieldArray BuybackTimestamp = new(12, 549, 562); + public UpdateFieldArray CombatRatings = new(32, 574, 575); + public UpdateFieldArray PvpInfo = new(6, 607, 608); + public UpdateFieldArray NoReagentCostMask = new(4, 614, 615); + public UpdateFieldArray ProfessionSkillLine = new(2, 619, 620); + public UpdateFieldArray BagSlotFlags = new(4, 622, 623); + public UpdateFieldArray BankBagSlotFlags = new(7, 627, 628); + public UpdateFieldArray QuestCompleted = new(875, 635, 636); public ActivePlayerData() : base(0, TypeId.ActivePlayer, 1511) { } @@ -4880,26 +4880,26 @@ namespace Game.Entities public class GameObjectFieldData : BaseUpdateData { - public UpdateField> StateWorldEffectIDs = new UpdateField>(0, 1); - public DynamicUpdateField EnableDoodadSets = new DynamicUpdateField(0, 2); - public UpdateField DisplayID = new UpdateField(0, 3); - public UpdateField SpellVisualID = new UpdateField(0, 4); - public UpdateField StateSpellVisualID = new UpdateField(0, 5); - public UpdateField SpawnTrackingStateAnimID = new UpdateField(0, 6); - public UpdateField SpawnTrackingStateAnimKitID = new UpdateField(0, 7); - public UpdateField StateWorldEffectsQuestObjectiveID = new UpdateField(0, 8); - public UpdateField CreatedBy = new UpdateField(0, 9); - public UpdateField GuildGUID = new UpdateField(0, 10); - public UpdateField Flags = new UpdateField(0, 11); - public UpdateField ParentRotation = new UpdateField(0, 12); - public UpdateField FactionTemplate = new UpdateField(0, 13); - public UpdateField State = new UpdateField(0, 14); - public UpdateField TypeID = new UpdateField(0, 15); - public UpdateField PercentHealth = new UpdateField(0, 16); - public UpdateField ArtKit = new UpdateField(0, 17); - public UpdateField CustomParam = new UpdateField(0, 18); - public UpdateField Level = new UpdateField(0, 19); - public UpdateField AnimGroupInstance = new UpdateField(0, 20); + public UpdateField> StateWorldEffectIDs = new(0, 1); + public DynamicUpdateField EnableDoodadSets = new(0, 2); + public UpdateField DisplayID = new(0, 3); + public UpdateField SpellVisualID = new(0, 4); + public UpdateField StateSpellVisualID = new(0, 5); + public UpdateField SpawnTrackingStateAnimID = new(0, 6); + public UpdateField SpawnTrackingStateAnimKitID = new(0, 7); + public UpdateField StateWorldEffectsQuestObjectiveID = new(0, 8); + public UpdateField CreatedBy = new(0, 9); + public UpdateField GuildGUID = new(0, 10); + public UpdateField Flags = new(0, 11); + public UpdateField ParentRotation = new(0, 12); + public UpdateField FactionTemplate = new(0, 13); + public UpdateField State = new(0, 14); + public UpdateField TypeID = new(0, 15); + public UpdateField PercentHealth = new(0, 16); + public UpdateField ArtKit = new(0, 17); + public UpdateField CustomParam = new(0, 18); + public UpdateField Level = new(0, 19); + public UpdateField AnimGroupInstance = new(0, 20); public GameObjectFieldData() : base(0, TypeId.GameObject, 21) { } @@ -5114,12 +5114,12 @@ namespace Game.Entities public class DynamicObjectData : BaseUpdateData { - public UpdateField Caster = new UpdateField(0, 1); - public UpdateField SpellVisual = new UpdateField(0, 2); - public UpdateField SpellID = new UpdateField(0, 3); - public UpdateField Radius = new UpdateField(0, 4); - public UpdateField CastTime = new UpdateField(0, 5); - public UpdateField Type = new UpdateField(0, 6); + public UpdateField Caster = new(0, 1); + public UpdateField SpellVisual = new(0, 2); + public UpdateField SpellID = new(0, 3); + public UpdateField Radius = new(0, 4); + public UpdateField CastTime = new(0, 5); + public UpdateField Type = new(0, 6); public DynamicObjectData() : base(0, TypeId.DynamicObject, 7) { } @@ -5186,19 +5186,19 @@ namespace Game.Entities public class CorpseData : BaseUpdateData { - public DynamicUpdateField Customizations = new DynamicUpdateField(0, 1); - public UpdateField DynamicFlags = new UpdateField(0, 2); - public UpdateField Owner = new UpdateField(0, 3); - public UpdateField PartyGUID = new UpdateField(0, 4); - public UpdateField GuildGUID = new UpdateField(0, 5); - public UpdateField DisplayID = new UpdateField(0, 6); - public UpdateField RaceID = new UpdateField(0, 7); - public UpdateField Sex = new UpdateField(0, 8); - public UpdateField Class = new UpdateField(0, 9); - public UpdateField Flags = new UpdateField(0, 10); - public UpdateField FactionTemplate = new UpdateField(0, 11); - public UpdateField StateSpellVisualKitID = new UpdateField(0, 12); - public UpdateFieldArray Items = new UpdateFieldArray(19, 13, 14); + public DynamicUpdateField Customizations = new(0, 1); + public UpdateField DynamicFlags = new(0, 2); + public UpdateField Owner = new(0, 3); + public UpdateField PartyGUID = new(0, 4); + public UpdateField GuildGUID = new(0, 5); + public UpdateField DisplayID = new(0, 6); + public UpdateField RaceID = new(0, 7); + public UpdateField Sex = new(0, 8); + public UpdateField Class = new(0, 9); + public UpdateField Flags = new(0, 10); + public UpdateField FactionTemplate = new(0, 11); + public UpdateField StateSpellVisualKitID = new(0, 12); + public UpdateFieldArray Items = new(19, 13, 14); public CorpseData() : base(0, TypeId.Corpse, 33) { } @@ -5339,10 +5339,10 @@ namespace Game.Entities public class ScaleCurve : BaseUpdateData { - public UpdateField OverrideActive = new UpdateField(0, 1); - public UpdateField StartTimeOffset = new UpdateField(0, 2); - public UpdateField ParameterCurve = new UpdateField(0, 3); - public UpdateFieldArray Points = new UpdateFieldArray(2, 4, 5); + public UpdateField OverrideActive = new(0, 1); + public UpdateField StartTimeOffset = new(0, 2); + public UpdateField ParameterCurve = new(0, 3); + public UpdateFieldArray Points = new(2, 4, 5); public ScaleCurve() : base(7) { } @@ -5411,19 +5411,19 @@ namespace Game.Entities public class AreaTriggerFieldData : BaseUpdateData { - public UpdateField OverrideScaleCurve = new UpdateField(0, 1); - public UpdateField ExtraScaleCurve = new UpdateField(0, 2); - public UpdateField Caster = new UpdateField(0, 3); - public UpdateField Duration = new UpdateField(0, 4); - public UpdateField TimeToTarget = new UpdateField(0, 5); - public UpdateField TimeToTargetScale = new UpdateField(0, 6); - public UpdateField TimeToTargetExtraScale = new UpdateField(0, 7); - public UpdateField SpellID = new UpdateField(0, 8); - public UpdateField SpellForVisuals = new UpdateField(0, 9); - public UpdateField SpellVisual = new UpdateField(0, 10); - public UpdateField BoundsRadius2D = new UpdateField(0, 11); - public UpdateField DecalPropertiesID = new UpdateField(0, 12); - public UpdateField CreatingEffectGUID = new UpdateField(0, 13); + public UpdateField OverrideScaleCurve = new(0, 1); + public UpdateField ExtraScaleCurve = new(0, 2); + public UpdateField Caster = new(0, 3); + public UpdateField Duration = new(0, 4); + public UpdateField TimeToTarget = new(0, 5); + public UpdateField TimeToTargetScale = new(0, 6); + public UpdateField TimeToTargetExtraScale = new(0, 7); + public UpdateField SpellID = new(0, 8); + public UpdateField SpellForVisuals = new(0, 9); + public UpdateField SpellVisual = new(0, 10); + public UpdateField BoundsRadius2D = new(0, 11); + public UpdateField DecalPropertiesID = new(0, 12); + public UpdateField CreatingEffectGUID = new(0, 13); public AreaTriggerFieldData() : base(0, TypeId.AreaTrigger, 14) { } @@ -5534,10 +5534,10 @@ namespace Game.Entities public class SceneObjectData : BaseUpdateData { - public UpdateField ScriptPackageID = new UpdateField(0, 1); - public UpdateField RndSeedVal = new UpdateField(0, 2); - public UpdateField CreatedBy = new UpdateField(0, 3); - public UpdateField SceneType = new UpdateField(0, 4); + public UpdateField ScriptPackageID = new(0, 1); + public UpdateField RndSeedVal = new(0, 2); + public UpdateField CreatedBy = new(0, 3); + public UpdateField SceneType = new(0, 4); public SceneObjectData() : base(5) { } @@ -5654,10 +5654,10 @@ namespace Game.Entities public class ConversationData : BaseUpdateData { - public UpdateField> Lines = new UpdateField>(0, 1); - public DynamicUpdateField Actors = new DynamicUpdateField(0, 2); - public UpdateField LastLineEndTime = new UpdateField(0, 3); - public UpdateField Progress = new UpdateField(0, 4); + public UpdateField> Lines = new(0, 1); + public DynamicUpdateField Actors = new(0, 2); + public UpdateField LastLineEndTime = new(0, 3); + public UpdateField Progress = new(0, 4); public ConversationData() : base(0, TypeId.Conversation, 5) { } diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index d76b03705..ae2ffd3dc 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -113,7 +113,7 @@ namespace Game.Entities public void UpdatePositionData() { - PositionFullTerrainStatus data = new PositionFullTerrainStatus(); + PositionFullTerrainStatus data = new(); GetMap().GetFullTerrainStatusForPosition(_phaseShift, GetPositionX(), GetPositionY(), GetPositionZ(), data); ProcessPositionDataChanged(data); } @@ -200,7 +200,7 @@ namespace Game.Entities if (unit.GetVictim()) flags.CombatVictim = true; - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt8((byte)updateType); buffer.WritePackedGuid(GetGUID()); buffer.WriteUInt8((byte)tempObjectType); @@ -213,7 +213,7 @@ namespace Game.Entities public void SendUpdateToPlayer(Player player) { // send create update to player - UpdateData upd = new UpdateData(player.GetMapId()); + UpdateData upd = new(player.GetMapId()); UpdateObject packet; if (player.HaveAtClient(this)) @@ -227,7 +227,7 @@ namespace Game.Entities public void BuildValuesUpdateBlockForPlayer(UpdateData data, Player target) { - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt8((byte)UpdateType.Values); buffer.WritePackedGuid(GetGUID()); @@ -238,7 +238,7 @@ namespace Game.Entities public void BuildValuesUpdateBlockForPlayerWithFlag(UpdateData data, UpdateFieldFlag flags, Player target) { - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt8((byte)UpdateType.Values); buffer.WritePackedGuid(GetGUID()); @@ -259,7 +259,7 @@ namespace Game.Entities public virtual void DestroyForPlayer(Player target) { - UpdateData updateData = new UpdateData(target.GetMapId()); + UpdateData updateData = new(target.GetMapId()); BuildDestroyUpdateBlock(updateData); UpdateObject packet; updateData.BuildPacket(out packet); @@ -1342,7 +1342,7 @@ namespace Game.Entities public virtual void SendMessageToSetInRange(ServerPacket data, float dist, bool self) { - MessageDistDeliverer notifier = new MessageDistDeliverer(this, data, dist); + MessageDistDeliverer notifier = new(this, data, dist); Cell.VisitWorldObjects(this, notifier, dist); } @@ -1458,7 +1458,7 @@ namespace Game.Entities ang = GetOrientation(); } - Position pos = new Position(x, y, z, ang); + Position pos = new(x, y, z, ang); return SummonGameObject(entry, pos, rotation, respawnTime); } @@ -1586,7 +1586,7 @@ namespace Game.Entities public List GetPlayerListInGrid(float maxSearchRange) { - List playerList = new List(); + List playerList = new(); var checker = new AnyPlayerInObjectRangeCheck(this, maxSearchRange); var searcher = new PlayerListSearcher(this, playerList, checker); @@ -1611,7 +1611,7 @@ namespace Game.Entities public void PlayDistanceSound(uint soundId, Player target = null) { - PlaySpeakerBoxSound playSpeakerBoxSound = new PlaySpeakerBoxSound(GetGUID(), soundId); + PlaySpeakerBoxSound playSpeakerBoxSound = new(GetGUID(), soundId); if (target != null) target.SendPacket(playSpeakerBoxSound); else @@ -1620,7 +1620,7 @@ namespace Game.Entities public void PlayDirectSound(uint soundId, Player target = null, uint broadcastTextId = 0) { - PlaySound sound = new PlaySound(GetGUID(), soundId, broadcastTextId); + PlaySound sound = new(GetGUID(), soundId, broadcastTextId); if (target) target.SendPacket(sound); else @@ -1640,7 +1640,7 @@ namespace Game.Entities if (!IsInWorld) return; - List targets = new List(); + List targets = new(); var check = new AnyPlayerInObjectRangeCheck(this, GetVisibilityRange(), false); var searcher = new PlayerListSearcher(this, targets, check); @@ -1933,8 +1933,8 @@ namespace Game.Entities Position GetHitSpherePointFor(Position dest) { - Vector3 vThis = new Vector3(GetPositionX(), GetPositionY(), GetPositionZ() + GetMidsectionHeight()); - Vector3 vObj = new Vector3(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ()); + Vector3 vThis = new(GetPositionX(), GetPositionY(), GetPositionZ() + GetMidsectionHeight()); + Vector3 vObj = new(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ()); Vector3 contactPoint = vThis + (vObj - vThis).directionOrZero() * Math.Min(dest.GetExactDist(GetPosition()), GetCombatReach()); return new Position(contactPoint.X, contactPoint.Y, contactPoint.Z, GetAngle(contactPoint.X, contactPoint.Y)); @@ -2376,21 +2376,21 @@ namespace Game.Entities Transport m_transport; Map _currMap; uint instanceId; - PhaseShift _phaseShift= new PhaseShift(); - PhaseShift _suppressedPhaseShift = new PhaseShift(); // contains phases for current area but not applied due to conditions + PhaseShift _phaseShift= new(); + PhaseShift _suppressedPhaseShift = new(); // contains phases for current area but not applied due to conditions int _dbPhase; public bool IsInWorld { get; set; } NotifyFlags m_notifyflags; - public FlaggedArray m_stealth = new FlaggedArray(2); - public FlaggedArray m_stealthDetect = new FlaggedArray(2); + public FlaggedArray m_stealth = new(2); + public FlaggedArray m_stealthDetect = new(2); - public FlaggedArray m_invisibility = new FlaggedArray((int)InvisibilityType.Max); - public FlaggedArray m_invisibilityDetect = new FlaggedArray((int)InvisibilityType.Max); + public FlaggedArray m_invisibility = new((int)InvisibilityType.Max); + public FlaggedArray m_invisibilityDetect = new((int)InvisibilityType.Max); - public FlaggedArray m_serverSideVisibility = new FlaggedArray(2); - public FlaggedArray m_serverSideVisibilityDetect = new FlaggedArray(2); + public FlaggedArray m_serverSideVisibility = new(2); + public FlaggedArray m_serverSideVisibilityDetect = new(2); #endregion public static implicit operator bool(WorldObject obj) @@ -2513,7 +2513,7 @@ namespace Game.Entities public class MovementForces { - List _forces = new List(); + List _forces = new(); float _modMagnitude = 1.0f; public List GetForces() { return _forces; } diff --git a/Source/Game/Entities/Pet.cs b/Source/Game/Entities/Pet.cs index 3fa937081..ed1c570ac 100644 --- a/Source/Game/Entities/Pet.cs +++ b/Source/Game/Entities/Pet.cs @@ -284,7 +284,7 @@ namespace Game.Entities // @todo pets should be summoned from real cast instead of just faking it? if (summonSpellId != 0) { - SpellGo spellGo = new SpellGo(); + SpellGo spellGo = new(); SpellCastData castData = spellGo.Cast; castData.CasterGUID = owner.GetGUID(); @@ -395,7 +395,7 @@ namespace Game.Entities uint curhealth = (uint)GetHealth(); int curmana = GetPower(PowerType.Mana); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); // save auras before possibly removing them _SaveAuras(trans); @@ -471,7 +471,7 @@ namespace Game.Entities public static void DeleteFromDB(uint guidlow) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_PET_BY_ID); stmt.AddValue(0, guidlow); @@ -847,9 +847,9 @@ namespace Game.Entities PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PET_AURA_EFFECT); stmt.AddValue(0, GetCharmInfo().GetPetNumber()); - ObjectGuid casterGuid = new ObjectGuid(); - ObjectGuid itemGuid = new ObjectGuid(); - Dictionary effectInfo = new Dictionary(); + ObjectGuid casterGuid = new(); + ObjectGuid itemGuid = new(); + Dictionary effectInfo = new(); SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) { @@ -862,7 +862,7 @@ namespace Game.Entities if (casterGuid.IsEmpty()) casterGuid = GetGUID(); - AuraKey key = new AuraKey(casterGuid, itemGuid, result.Read(1), result.Read(2)); + AuraKey key = new(casterGuid, itemGuid, result.Read(1), result.Read(2)); if (!effectInfo.ContainsKey(key)) effectInfo[key] = new AuraLoadEffectInfo(); @@ -885,7 +885,7 @@ namespace Game.Entities if (casterGuid.IsEmpty()) casterGuid = GetGUID(); - AuraKey key = new AuraKey(casterGuid, itemGuid, result.Read(1), result.Read(2)); + AuraKey key = new(casterGuid, itemGuid, result.Read(1), result.Read(2)); uint recalculateMask = result.Read(3); Difficulty difficulty = (Difficulty)result.Read(4); byte stackCount = result.Read(5); @@ -1046,7 +1046,7 @@ namespace Game.Entities } } - PetSpell newspell = new PetSpell(); + PetSpell newspell = new(); newspell.state = state; newspell.type = type; @@ -1114,7 +1114,7 @@ namespace Game.Entities if (!m_loading) { - PetLearnedSpells packet = new PetLearnedSpells(); + PetLearnedSpells packet = new(); packet.Spells.Add(spellId); GetOwner().SendPacket(packet); GetOwner().PetSpellInitialize(); @@ -1124,7 +1124,7 @@ namespace Game.Entities void LearnSpells(List spellIds) { - PetLearnedSpells packet = new PetLearnedSpells(); + PetLearnedSpells packet = new(); foreach (uint spell in spellIds) { @@ -1182,7 +1182,7 @@ namespace Game.Entities { if (!m_loading) { - PetUnlearnedSpells packet = new PetUnlearnedSpells(); + PetUnlearnedSpells packet = new(); packet.Spells.Add(spellId); GetOwner().SendPacket(packet); } @@ -1193,7 +1193,7 @@ namespace Game.Entities void UnlearnSpells(List spellIds, bool learnPrev, bool clearActionBar) { - PetUnlearnedSpells packet = new PetUnlearnedSpells(); + PetUnlearnedSpells packet = new(); foreach (uint spell in spellIds) { @@ -1517,7 +1517,7 @@ namespace Game.Entities void LearnSpecializationSpells() { - List learnedSpells = new List(); + List learnedSpells = new(); List specSpells = Global.DB2Mgr.GetSpecializationSpells(m_petSpecialization); if (specSpells != null) @@ -1537,7 +1537,7 @@ namespace Game.Entities void RemoveSpecializationSpells(bool clearActionBar) { - List unlearnedSpells = new List(); + List unlearnedSpells = new(); for (uint i = 0; i < PlayerConst.MaxSpecializations; ++i) { @@ -1588,14 +1588,14 @@ namespace Game.Entities CleanupActionBar(); GetOwner().PetSpellInitialize(); - SetPetSpecialization setPetSpecialization = new SetPetSpecialization(); + SetPetSpecialization setPetSpecialization = new(); setPetSpecialization.SpecID = m_petSpecialization; GetOwner().SendPacket(setPetSpecialization); } string GenerateActionBarData() { - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); for (byte i = SharedConst.ActionBarIndexStart; i < SharedConst.ActionBarIndexEnd; ++i) { @@ -1607,8 +1607,8 @@ namespace Game.Entities public DeclinedName GetDeclinedNames() { return _declinedname; } - public new Dictionary m_spells = new Dictionary(); - List m_autospells = new List(); + public new Dictionary m_spells = new(); + List m_autospells = new(); public bool m_removed; PetType m_petType; diff --git a/Source/Game/Entities/Player/CinematicManager.cs b/Source/Game/Entities/Player/CinematicManager.cs index b469dfbdc..bc7344cc3 100644 --- a/Source/Game/Entities/Player/CinematicManager.cs +++ b/Source/Game/Entities/Player/CinematicManager.cs @@ -76,7 +76,7 @@ namespace Game.Entities if (!m_cinematicCamera.Empty()) { FlyByCamera firstCamera = m_cinematicCamera.FirstOrDefault(); - Position pos = new Position(firstCamera.locations.X, firstCamera.locations.Y, firstCamera.locations.Z, firstCamera.locations.W); + Position pos = new(firstCamera.locations.X, firstCamera.locations.Y, firstCamera.locations.Z, firstCamera.locations.W); if (!pos.IsPositionValid()) return; @@ -119,9 +119,9 @@ namespace Game.Entities if (m_activeCinematic == null || m_activeCinematicCameraIndex == -1 || m_cinematicCamera == null || m_cinematicCamera.Count == 0) return; - Position lastPosition = new Position(); + Position lastPosition = new(); uint lastTimestamp = 0; - Position nextPosition = new Position(); + Position nextPosition = new(); uint nextTimestamp = 0; // Obtain direction of travel @@ -179,7 +179,7 @@ namespace Game.Entities float xDiff = nextPosition.posX - lastPosition.posX; float yDiff = nextPosition.posY - lastPosition.posY; float zDiff = nextPosition.posZ - lastPosition.posZ; - Position interPosition = new Position(lastPosition.posX + (xDiff * ((float)interDiff / timeDiff)), lastPosition.posY + + Position interPosition = new(lastPosition.posX + (xDiff * ((float)interDiff / timeDiff)), lastPosition.posY + (yDiff * ((float)interDiff / timeDiff)), lastPosition.posZ + (zDiff * ((float)interDiff / timeDiff))); // Advance (at speed) to this position. The remote sight object is used diff --git a/Source/Game/Entities/Player/CollectionManager.cs b/Source/Game/Entities/Player/CollectionManager.cs index ff1a93acf..cd7f8f373 100644 --- a/Source/Game/Entities/Player/CollectionManager.cs +++ b/Source/Game/Entities/Player/CollectionManager.cs @@ -28,15 +28,15 @@ namespace Game.Entities { public class CollectionMgr { - static Dictionary FactionSpecificMounts = new Dictionary(); + static Dictionary FactionSpecificMounts = new(); WorldSession _owner; - Dictionary _toys = new Dictionary(); - Dictionary _heirlooms = new Dictionary(); - Dictionary _mounts = new Dictionary(); + Dictionary _toys = new(); + Dictionary _heirlooms = new(); + Dictionary _mounts = new(); BitSet _appearances; - MultiMap _temporaryAppearances = new MultiMap(); - Dictionary _favoriteAppearances = new Dictionary(); + MultiMap _temporaryAppearances = new(); + Dictionary _favoriteAppearances = new(); public static void LoadMountDefinitions() { @@ -463,7 +463,7 @@ namespace Game.Entities if (!player) return; - AccountMountUpdate mountUpdate = new AccountMountUpdate(); + AccountMountUpdate mountUpdate = new(); mountUpdate.IsFullUpdate = false; mountUpdate.Mounts.Add(spellId, mountStatusFlags); player.SendPacket(mountUpdate); @@ -782,7 +782,7 @@ namespace Game.Entities public List GetAppearanceIds() { - List appearances = new List(); + List appearances = new(); foreach (int id in _appearances) appearances.Add(CliDB.ItemModifiedAppearanceStorage.LookupByKey(id).ItemAppearanceID); @@ -813,7 +813,7 @@ namespace Game.Entities _favoriteAppearances[itemModifiedAppearanceId] = apperanceState; - AccountTransmogUpdate accountTransmogUpdate = new AccountTransmogUpdate(); + AccountTransmogUpdate accountTransmogUpdate = new(); accountTransmogUpdate.IsFullUpdate = false; accountTransmogUpdate.IsSetFavorite = apply; accountTransmogUpdate.FavoriteAppearances.Add(itemModifiedAppearanceId); @@ -823,7 +823,7 @@ namespace Game.Entities public void SendFavoriteAppearances() { - AccountTransmogUpdate accountTransmogUpdate = new AccountTransmogUpdate(); + AccountTransmogUpdate accountTransmogUpdate = new(); accountTransmogUpdate.IsFullUpdate = true; foreach (var pair in _favoriteAppearances) if (pair.Value != FavoriteAppearanceState.Removed) diff --git a/Source/Game/Entities/Player/PetitionManager.cs b/Source/Game/Entities/Player/PetitionManager.cs index 640e3a918..0d3537b25 100644 --- a/Source/Game/Entities/Player/PetitionManager.cs +++ b/Source/Game/Entities/Player/PetitionManager.cs @@ -24,7 +24,7 @@ namespace Game.Entities { public class PetitionManager : Singleton { - Dictionary _petitionStorage = new Dictionary(); + Dictionary _petitionStorage = new(); PetitionManager() { } @@ -77,7 +77,7 @@ namespace Game.Entities public void AddPetition(ObjectGuid petitionGuid, ObjectGuid ownerGuid, string name, bool isLoading) { - Petition p = new Petition(); + Petition p = new(); p.PetitionGuid = petitionGuid; p.ownerGuid = ownerGuid; p.petitionName = name; @@ -100,7 +100,7 @@ namespace Game.Entities _petitionStorage.Remove(petitionGuid); // Delete From DB - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_BY_GUID); stmt.AddValue(0, petitionGuid.GetCounter()); @@ -134,7 +134,7 @@ namespace Game.Entities } } - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_BY_OWNER); stmt.AddValue(0, ownerGuid.GetCounter()); trans.Append(stmt); @@ -161,7 +161,7 @@ namespace Game.Entities public ObjectGuid PetitionGuid; public ObjectGuid ownerGuid; public string petitionName; - public List<(uint AccountId, ObjectGuid PlayerGuid)> signatures = new List<(uint AccountId, ObjectGuid PlayerGuid)>(); + public List<(uint AccountId, ObjectGuid PlayerGuid)> signatures = new(); public bool IsPetitionSignedByAccount(uint accountId) { diff --git a/Source/Game/Entities/Player/Player.Combat.cs b/Source/Game/Entities/Player/Player.Combat.cs index dd66add4b..7929e3d89 100644 --- a/Source/Game/Entities/Player/Player.Combat.cs +++ b/Source/Game/Entities/Player/Player.Combat.cs @@ -83,7 +83,7 @@ namespace Game.Entities public uint GetArmorProficiency() { return m_ArmorProficiency; } public void SendProficiency(ItemClass itemClass, uint itemSubclassMask) { - SetProficiency packet = new SetProficiency(); + SetProficiency packet = new(); packet.ProficiencyMask = itemSubclassMask; packet.ProficiencyClass = (byte)itemClass; SendPacket(packet); @@ -437,7 +437,7 @@ namespace Game.Entities Log.outDebug(LogFilter.Player, "Duel Complete {0} {1}", GetName(), duel.opponent.GetName()); - DuelComplete duelCompleted = new DuelComplete(); + DuelComplete duelCompleted = new(); duelCompleted.Started = type != DuelCompleteType.Interrupted; SendPacket(duelCompleted); @@ -446,7 +446,7 @@ namespace Game.Entities if (type != DuelCompleteType.Interrupted) { - DuelWinner duelWinner = new DuelWinner(); + DuelWinner duelWinner = new(); duelWinner.BeatenName = (type == DuelCompleteType.Won ? duel.opponent.GetName() : GetName()); duelWinner.WinnerName = (type == DuelCompleteType.Won ? GetName() : duel.opponent.GetName()); duelWinner.BeatenVirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress(); @@ -576,7 +576,7 @@ namespace Game.Entities AddUnitState(UnitState.AttackPlayer); AddPlayerFlag(PlayerFlags.ContestedPVP); // call MoveInLineOfSight for nearby contested guards - AIRelocationNotifier notifier = new AIRelocationNotifier(this); + AIRelocationNotifier notifier = new(this); Cell.VisitWorldObjects(this, notifier, GetVisibilityRange()); } foreach (Unit unit in m_Controlled) @@ -584,7 +584,7 @@ namespace Game.Entities if (!unit.HasUnitState(UnitState.AttackPlayer)) { unit.AddUnitState(UnitState.AttackPlayer); - AIRelocationNotifier notifier = new AIRelocationNotifier(unit); + AIRelocationNotifier notifier = new(unit); Cell.VisitWorldObjects(this, notifier, GetVisibilityRange()); } } diff --git a/Source/Game/Entities/Player/Player.DB.cs b/Source/Game/Entities/Player/Player.DB.cs index bc7c6e50e..0e719d348 100644 --- a/Source/Game/Entities/Player/Player.DB.cs +++ b/Source/Game/Entities/Player/Player.DB.cs @@ -40,16 +40,16 @@ namespace Game.Entities { void _LoadInventory(SQLResult result, SQLResult artifactsResult, SQLResult azeriteResult, SQLResult azeriteItemMilestonePowersResult, SQLResult azeriteItemUnlockedEssencesResult, SQLResult azeriteEmpoweredItemResult, uint timeDiff) { - Dictionary additionalData = new Dictionary(); + Dictionary additionalData = new(); ItemAdditionalLoadInfo.Init(additionalData, artifactsResult, azeriteResult, azeriteItemMilestonePowersResult, azeriteItemUnlockedEssencesResult, azeriteEmpoweredItemResult); if (!result.IsEmpty()) { uint zoneId = GetZoneId(); - Dictionary bagMap = new Dictionary(); // fast guid lookup for bags - Dictionary invalidBagMap = new Dictionary(); // fast guid lookup for bags - Queue problematicItems = new Queue(); - SQLTransaction trans = new SQLTransaction(); + Dictionary bagMap = new(); // fast guid lookup for bags + Dictionary invalidBagMap = new(); // fast guid lookup for bags + Queue problematicItems = new(); + SQLTransaction trans = new(); // Prevent items from being added to the queue while loading m_itemUpdateQueueBlocked = true; @@ -113,7 +113,7 @@ namespace Game.Entities if (IsInventoryPos(InventorySlots.Bag0, slot)) { - List dest = new List(); + List dest = new(); err = CanStoreItem(InventorySlots.Bag0, slot, dest, item, false); if (err == InventoryResult.Ok) item = StoreItem(dest, item, true); @@ -128,7 +128,7 @@ namespace Game.Entities } else if (IsBankPos(InventorySlots.Bag0, slot)) { - List dest = new List(); + List dest = new(); err = CanBankItem(InventorySlots.Bag0, slot, dest, item, false, false); if (err == InventoryResult.Ok) item = BankItem(dest, item, true); @@ -155,7 +155,7 @@ namespace Game.Entities var bag = bagMap.LookupByKey(bagGuid); if (bag != null) { - List dest = new List(); + List dest = new(); err = CanStoreItem(bag.GetSlot(), slot, dest, item); if (err == InventoryResult.Ok) item = StoreItem(dest, item, true); @@ -195,7 +195,7 @@ namespace Game.Entities while (problematicItems.Count != 0) { string subject = Global.ObjectMgr.GetCypherString(CypherStrings.NotEquippedItem); - MailDraft draft = new MailDraft(subject, "There were problems with equipping item(s)."); + MailDraft draft = new(subject, "There were problems with equipping item(s)."); for (int i = 0; problematicItems.Count != 0 && i < SharedConst.MaxMailItems; ++i) { draft.AddItem(problematicItems.Dequeue()); @@ -281,7 +281,7 @@ namespace Game.Entities { string strGUID = result.Read(0); var GUIDlist = new StringArray(strGUID, ' '); - List looters = new List(); + List looters = new(); for (var i = 0; i < GUIDlist.Length; ++i) { if (ulong.TryParse(GUIDlist[i], out ulong guid)) @@ -347,7 +347,7 @@ namespace Game.Entities void _LoadSkills(SQLResult result) { uint count = 0; - Dictionary loadedSkillValues = new Dictionary(); + Dictionary loadedSkillValues = new(); if (!result.IsEmpty()) { do @@ -466,9 +466,9 @@ namespace Game.Entities { Log.outDebug(LogFilter.Player, "Loading auras for player {0}", GetGUID().ToString()); - ObjectGuid casterGuid = new ObjectGuid(); - ObjectGuid itemGuid = new ObjectGuid(); - Dictionary effectInfo = new Dictionary(); + ObjectGuid casterGuid = new(); + ObjectGuid itemGuid = new(); + Dictionary effectInfo = new(); if (!effectResult.IsEmpty()) { do @@ -479,7 +479,7 @@ namespace Game.Entities casterGuid.SetRawValue(effectResult.Read(0)); itemGuid.SetRawValue(effectResult.Read(1)); - AuraKey key = new AuraKey(casterGuid, itemGuid, effectResult.Read(2), effectResult.Read(3)); + AuraKey key = new(casterGuid, itemGuid, effectResult.Read(2), effectResult.Read(3)); if (!effectInfo.ContainsKey(key)) effectInfo[key] = new AuraLoadEffectInfo(); @@ -497,7 +497,7 @@ namespace Game.Entities { casterGuid.SetRawValue(auraResult.Read(0)); itemGuid.SetRawValue(auraResult.Read(1)); - AuraKey key = new AuraKey(casterGuid, itemGuid, auraResult.Read(2), auraResult.Read(3)); + AuraKey key = new(casterGuid, itemGuid, auraResult.Read(2), auraResult.Read(3)); uint recalculateMask = auraResult.Read(4); Difficulty difficulty = (Difficulty)auraResult.Read(5); byte stackCount = auraResult.Read(6); @@ -626,7 +626,7 @@ namespace Game.Entities if (currency == null) continue; - PlayerCurrency cur = new PlayerCurrency(); + PlayerCurrency cur = new(); cur.state = PlayerCurrencyState.Unchanged; cur.Quantity = result.Read(1); cur.WeeklyQuantity = result.Read(2); @@ -680,7 +680,7 @@ namespace Game.Entities if (quest != null) { // find or create - QuestStatusData questStatusData = new QuestStatusData(); + QuestStatusData questStatusData = new(); byte qstatus = result.Read(1); if (qstatus < (byte)QuestStatus.Max) @@ -1113,7 +1113,7 @@ namespace Game.Entities uint fixedScalingLevel = result.Read(5); uint artifactKnowledgeLevel = result.Read(6); ItemContext context = (ItemContext)result.Read(7); - List bonusListIDs = new List(); + List bonusListIDs = new(); var bonusListIdTokens = new StringArray(result.Read(8), ' '); for (var i = 0; i < bonusListIdTokens.Length; ++i) { @@ -1141,7 +1141,7 @@ namespace Game.Entities _voidStorageItems[slot] = new VoidStorageItem(itemId, itemEntry, creatorGuid, randomBonusListId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs); - BonusData bonus = new BonusData(new ItemInstance(_voidStorageItems[slot])); + BonusData bonus = new(new ItemInstance(_voidStorageItems[slot])); GetSession().GetCollectionMgr().AddItemAppearance(itemEntry, bonus.AppearanceModID); } while (result.NextRow()); @@ -1162,13 +1162,13 @@ namespace Game.Entities stmt.AddValue(0, GetGUID().GetCounter()); SQLResult result = DB.Characters.Query(stmt); - Dictionary mailById = new Dictionary(); + Dictionary mailById = new(); if (!result.IsEmpty()) { do { - Mail m = new Mail(); + Mail m = new(); m.messageID = result.Read(0); m.messageType = (MailMessageType)result.Read(1); @@ -1224,7 +1224,7 @@ namespace Game.Entities stmt.AddValue(0, GetGUID().GetCounter()); SQLResult azeriteEmpoweredItemResult = DB.Characters.Query(stmt); - Dictionary additionalData = new Dictionary(); + Dictionary additionalData = new(); ItemAdditionalLoadInfo.Init(additionalData, artifactResult, azeriteResult, azeriteItemMilestonePowersResult, azeriteItemUnlockedEssencesResult, azeriteEmpoweredItemResult); do @@ -1248,7 +1248,7 @@ namespace Game.Entities { Log.outError(LogFilter.Player, $"Player {(player != null ? player.GetName() : "")} ({playerGuid}) has unknown item in mailed items (GUID: {itemGuid} template: {itemEntry}) in mail ({mailId}), deleted."); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_INVALID_MAIL_ITEM); stmt.AddValue(0, itemGuid); @@ -1395,7 +1395,7 @@ namespace Game.Entities do { - EquipmentSetInfo eqSet = new EquipmentSetInfo(); + EquipmentSetInfo eqSet = new(); eqSet.Data.Guid = result.Read(0); eqSet.Data.Type = EquipmentSetInfo.EquipmentSetType.Equipment; eqSet.Data.SetID = result.Read(1); @@ -1435,7 +1435,7 @@ namespace Game.Entities do { - EquipmentSetInfo eqSet = new EquipmentSetInfo(); + EquipmentSetInfo eqSet = new(); eqSet.Data.Guid = result.Read(0); eqSet.Data.Type = EquipmentSetInfo.EquipmentSetType.Transmog; @@ -2359,7 +2359,7 @@ namespace Game.Entities stmt.AddValue(7, _voidStorageItems[i].ArtifactKnowledgeLevel); stmt.AddValue(8, (byte)_voidStorageItems[i].Context); - StringBuilder bonusListIDs = new StringBuilder(); + StringBuilder bonusListIDs = new(); foreach (uint bonusListID in _voidStorageItems[i].BonusListIDs) bonusListIDs.AppendFormat("{0} ", bonusListID); stmt.AddValue(9, bonusListIDs.ToString()); @@ -2579,12 +2579,12 @@ namespace Game.Entities SetLevel(level); SetXP(xp); - StringArray exploredZonesStrings = new StringArray(exploredZones, ' '); + StringArray exploredZonesStrings = new(exploredZones, ' '); if (exploredZonesStrings.Length == PlayerConst.ExploredZonesSize * 2) for (int i = 0; i < exploredZonesStrings.Length; ++i) SetUpdateFieldFlagValue(ref m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ExploredZones, i / 2), (ulong)((long.Parse(exploredZonesStrings[i])) << (32 * (i % 2)))); - StringArray knownTitlesStrings = new StringArray(knownTitles, ' '); + StringArray knownTitlesStrings = new(knownTitles, ' '); if ((knownTitlesStrings.Length % 2) == 0) { for (int i = 0; i < knownTitlesStrings.Length; ++i) @@ -2600,14 +2600,14 @@ namespace Game.Entities SetMoney(Math.Min(money, PlayerConst.MaxMoneyAmount)); - List customizations = new List(); + List customizations = new(); SQLResult customizationsResult = holder.GetResult(PlayerLoginQueryLoad.Customizations); if (!customizationsResult.IsEmpty()) { do { - ChrCustomizationChoice choice = new ChrCustomizationChoice(); + ChrCustomizationChoice choice = new(); choice.ChrCustomizationOptionID = customizationsResult.Read(0); choice.ChrCustomizationChoiceID = customizationsResult.Read(1); customizations.Add(choice); @@ -3228,8 +3228,8 @@ namespace Game.Entities public void SaveToDB(bool create = false) { - SQLTransaction loginTransaction = new SQLTransaction(); - SQLTransaction characterTransaction = new SQLTransaction(); + SQLTransaction loginTransaction = new(); + SQLTransaction characterTransaction = new(); SaveToDB(loginTransaction, characterTransaction, create); @@ -3303,7 +3303,7 @@ namespace Game.Entities transLowGUID = GetTransport().GetGUID().GetCounter(); stmt.AddValue(index++, transLowGUID); - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); for (int i = 0; i < PlayerConst.TaxiMaskSize; ++i) ss.Append(m_taxi.m_taximask[i] + " "); @@ -3443,7 +3443,7 @@ namespace Game.Entities transLowGUID = GetTransport().GetGUID().GetCounter(); stmt.AddValue(index++, transLowGUID); - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); for (int i = 0; i < PlayerConst.TaxiMaskSize; ++i) ss.Append(m_taxi.m_taximask[i] + " "); @@ -3707,7 +3707,7 @@ namespace Game.Entities charDelete_method = CharDeleteMethod.Remove; } - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); ulong guildId = Global.CharacterCacheStorage.GetCharacterGuildIdByGuid(playerGuid); if (guildId != 0) { @@ -3744,7 +3744,7 @@ namespace Game.Entities SQLResult resultMail = DB.Characters.Query(stmt); if (!resultMail.IsEmpty()) { - MultiMap itemsByMail = new MultiMap(); + MultiMap itemsByMail = new(); stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAILITEMS); stmt.AddValue(0, guid); @@ -3772,7 +3772,7 @@ namespace Game.Entities stmt.AddValue(0, guid); SQLResult azeriteEmpoweredItemResult = DB.Characters.Query(stmt); - Dictionary additionalData = new Dictionary(); + Dictionary additionalData = new(); ItemAdditionalLoadInfo.Init(additionalData, artifactResult, azeriteResult, azeriteItemMilestonePowersResult, azeriteItemUnlockedEssencesResult, azeriteEmpoweredItemResult); do @@ -3814,7 +3814,7 @@ namespace Game.Entities continue; } - MailDraft draft = new MailDraft(subject, body); + MailDraft draft = new(subject, body); if (mailTemplateId != 0) draft = new MailDraft(mailTemplateId, false); // items are already included diff --git a/Source/Game/Entities/Player/Player.Fields.cs b/Source/Game/Entities/Player/Player.Fields.cs index 565f21e64..b78f32d38 100644 --- a/Source/Game/Entities/Player/Player.Fields.cs +++ b/Source/Game/Entities/Player/Player.Fields.cs @@ -39,18 +39,18 @@ namespace Game.Entities //Gossip public PlayerMenu PlayerTalkClass; PlayerSocial m_social; - List m_channels = new List(); - List WhisperList = new List(); + List m_channels = new(); + List WhisperList = new(); public string autoReplyMsg; //Inventory - Dictionary _equipmentSets = new Dictionary(); - public List ItemSetEff = new List(); - List m_enchantDuration = new List(); - List m_itemDuration = new List(); - List m_itemSoulboundTradeable = new List(); - List m_refundableItems = new List(); - public List ItemUpdateQueue = new List(); + Dictionary _equipmentSets = new(); + public List ItemSetEff = new(); + List m_enchantDuration = new(); + List m_itemDuration = new(); + List m_itemSoulboundTradeable = new(); + List m_refundableItems = new(); + public List ItemUpdateQueue = new(); VoidStorageItem[] _voidStorageItems = new VoidStorageItem[SharedConst.VoidStorageMaxSlot]; Item[] m_items = new Item[(int)PlayerSlots.Count]; uint m_WeaponProficiency; @@ -69,15 +69,15 @@ namespace Game.Entities bool _usePvpItemLevels; //Groups/Raids - GroupReference m_group = new GroupReference(); - GroupReference m_originalGroup = new GroupReference(); + GroupReference m_group = new(); + GroupReference m_originalGroup = new(); Group m_groupInvite; GroupUpdateFlags m_groupUpdateMask; bool m_bPassOnGroupLoot; GroupUpdateCounter[] m_groupUpdateSequences = new GroupUpdateCounter[2]; - public Dictionary> m_boundInstances = new Dictionary>(); - Dictionary _instanceResetTimes = new Dictionary(); + public Dictionary> m_boundInstances = new(); + Dictionary _instanceResetTimes = new(); uint _pendingBindId; uint _pendingBindTimer; public bool m_InstanceValid; @@ -88,7 +88,7 @@ namespace Game.Entities Difficulty m_prevMapDifficulty; //Movement - public PlayerTaxi m_taxi = new PlayerTaxi(); + public PlayerTaxi m_taxi = new(); public byte[] m_forced_speed_changes = new byte[(int)UnitMoveType.Max]; public byte m_movementForceModMagnitudeChanges; uint m_lastFallTime; @@ -113,24 +113,24 @@ namespace Game.Entities uint m_lastPotionId; //Spell - Dictionary m_spells = new Dictionary(); - Dictionary mSkillStatus = new Dictionary(); - Dictionary _currencyStorage = new Dictionary(); + Dictionary m_spells = new(); + Dictionary mSkillStatus = new(); + Dictionary _currencyStorage = new(); List[][] m_spellMods = new List[(int)SpellModOp.Max][]; - MultiMap m_overrideSpells = new MultiMap(); + MultiMap m_overrideSpells = new(); public Spell m_spellModTakingSpell; uint m_oldpetspell; //Mail - List m_mail = new List(); - Dictionary mMitems = new Dictionary(); + List m_mail = new(); + Dictionary mMitems = new(); public byte unReadMails; long m_nextMailDelivereTime; public bool m_mailsLoaded; public bool m_mailsUpdated; //Pets - public List m_petAuras = new List(); + public List m_petAuras = new(); public uint m_stableSlots; uint m_temporaryUnsummonedPetNumber; uint m_lastpetnumber; @@ -158,15 +158,15 @@ namespace Game.Entities uint m_weaponChangeTimer; //Quest - List m_timedquests = new List(); - List m_weeklyquests = new List(); - List m_monthlyquests = new List(); - MultiMap m_seasonalquests = new MultiMap(); - Dictionary m_QuestStatus = new Dictionary(); - Dictionary m_QuestStatusSave = new Dictionary(); - List m_DFQuests = new List(); - List m_RewardedQuests = new List(); - Dictionary m_RewardedQuestsSave = new Dictionary(); + List m_timedquests = new(); + List m_weeklyquests = new(); + List m_monthlyquests = new(); + MultiMap m_seasonalquests = new(); + Dictionary m_QuestStatus = new(); + Dictionary m_QuestStatusSave = new(); + List m_DFQuests = new(); + List m_RewardedQuests = new(); + Dictionary m_RewardedQuestsSave = new(); bool m_DailyQuestChanged; bool m_WeeklyQuestChanged; @@ -199,13 +199,13 @@ namespace Game.Entities bool m_customizationsChanged; SpecializationInfo _specializationInfo; - public List m_clientGUIDs = new List(); - public List m_visibleTransports = new List(); + public List m_clientGUIDs = new(); + public List m_visibleTransports = new(); public WorldObject seerView; // only changed for direct client control (possess, vehicle etc.), not stuff you control using pet commands public Unit m_unitMovedByMe; Team m_team; - public Stack m_timeSyncQueue = new Stack(); + public Stack m_timeSyncQueue = new(); uint m_timeSyncTimer; public uint m_timeSyncClient; public uint m_timeSyncServer; @@ -236,7 +236,7 @@ namespace Game.Entities SceneMgr m_sceneMgr; - Dictionary m_AELootView = new Dictionary(); + Dictionary m_AELootView = new(); CUFProfile[] _CUFProfiles = new CUFProfile[PlayerConst.MaxCUFProfiles]; float[] m_powerFraction = new float[(int)PowerType.MaxPerClass]; @@ -244,7 +244,7 @@ namespace Game.Entities ulong m_GuildIdInvited; DeclinedName _declinedname; - Runes m_runes = new Runes(); + Runes m_runes = new(); uint m_hostileReferenceCheckTimer; uint m_drunkTimer; long m_logintime; @@ -252,7 +252,7 @@ namespace Game.Entities uint m_PlayedTimeTotal; uint m_PlayedTimeLevel; - Dictionary m_actionButtons = new Dictionary(); + Dictionary m_actionButtons = new(); ObjectGuid m_playerSharingQuest; uint m_sharedQuestId; uint m_ingametime; @@ -272,11 +272,11 @@ namespace Game.Entities public uint DisplayId_m; public uint DisplayId_f; - public List item = new List(); - public List customSpells = new List(); - public List castSpells = new List(); - public List action = new List(); - public List skills = new List(); + public List item = new(); + public List customSpells = new(); + public List castSpells = new(); + public List action = new(); + public List skills = new(); public PlayerLevelInfo[] levelInfo = new PlayerLevelInfo[WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)]; } @@ -361,7 +361,7 @@ namespace Game.Entities } } - public List CooldownOrder = new List(); + public List CooldownOrder = new(); public uint[] Cooldown = new uint[PlayerConst.MaxRunes]; public byte RuneState; // mask of available runes } @@ -394,7 +394,7 @@ namespace Game.Entities public class ResurrectionData { public ObjectGuid GUID; - public WorldLocation Location = new WorldLocation(); + public WorldLocation Location = new(); public uint Health; public uint Mana; public uint Aura; @@ -471,7 +471,7 @@ namespace Game.Entities public uint FixedScalingLevel; public uint ArtifactKnowledgeLevel; public ItemContext Context; - public List BonusListIDs = new List(); + public List BonusListIDs = new(); } public class EquipmentSetInfo @@ -495,9 +495,9 @@ namespace Game.Entities public int AssignedSpecIndex = -1; // Index of character specialization that this set is automatically equipped for public string SetName = ""; public string SetIcon = ""; - public Array Pieces = new Array(EquipmentSlot.End); - public Array Appearances = new Array(EquipmentSlot.End); // ItemModifiedAppearanceID - public Array Enchants = new Array(2); // SpellItemEnchantmentID + public Array Pieces = new(EquipmentSlot.End); + public Array Appearances = new(EquipmentSlot.End); // ItemModifiedAppearanceID + public Array Enchants = new(2); // SpellItemEnchantmentID public int Unknown901_1; public int Unknown901_2; } @@ -530,7 +530,7 @@ namespace Game.Entities // when player is teleported to BG - (it is Battleground's GUID) public BattlegroundTypeId bgTypeID; - public List bgAfkReporter = new List(); + public List bgAfkReporter = new(); public byte bgAfkReportedCount; public long bgAfkReportedTimer; diff --git a/Source/Game/Entities/Player/Player.Groups.cs b/Source/Game/Entities/Player/Player.Groups.cs index a9078b21a..e297eae37 100644 --- a/Source/Game/Entities/Player/Player.Groups.cs +++ b/Source/Game/Entities/Player/Player.Groups.cs @@ -30,7 +30,7 @@ namespace Game.Entities if (!group) return null; - List nearMembers = new List(); + List nearMembers = new(); for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next()) { diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index 068b0fd2d..1a66fd2e9 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -84,7 +84,7 @@ namespace Game.Entities if (count != 0 && itemid != 0) { - List dest = new List(); + List dest = new(); InventoryResult msg = CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, itemid, count); if (msg != InventoryResult.Ok) { @@ -105,7 +105,7 @@ namespace Game.Entities ulong moneyRefund = item.GetPaidMoney(); // item. will be invalidated in DestroyItem // Save all relevant data to DB to prevent desynchronisation exploits - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); // Delete any references to the refund data item.SetNotRefundable(this, true, trans, false); @@ -121,7 +121,7 @@ namespace Game.Entities uint itemid = iece.ItemID[i]; if (count != 0 && itemid != 0) { - List dest = new List(); + List dest = new(); InventoryResult msg = CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, itemid, count); Cypher.Assert(msg == InventoryResult.Ok); // Already checked before Item it = StoreNewItem(dest, itemid, true); @@ -173,7 +173,7 @@ namespace Game.Entities Log.outDebug(LogFilter.Player, "Item refund: cannot find extendedcost data."); return; } - SetItemPurchaseData setItemPurchaseData = new SetItemPurchaseData(); + SetItemPurchaseData setItemPurchaseData = new(); setItemPurchaseData.ItemGUID = item.GetGUID(); setItemPurchaseData.PurchaseTime = GetTotalPlayedTime() - item.GetPlayedTime(); setItemPurchaseData.Contents.Money = item.GetPaidMoney(); @@ -197,7 +197,7 @@ namespace Game.Entities } public void SendItemRefundResult(Item item, ItemExtendedCostRecord iece, byte error) { - ItemPurchaseRefundResult itemPurchaseRefundResult = new ItemPurchaseRefundResult(); + ItemPurchaseRefundResult itemPurchaseRefundResult = new(); itemPurchaseRefundResult.ItemGUID = item.GetGUID(); itemPurchaseRefundResult.Result = error; if (error == 0) @@ -1246,7 +1246,7 @@ namespace Game.Entities return true; // equipped // attempt store - List sDest = new List(); + List sDest = new(); // store in main bag to simplify second pass (special bags can be not equipped yet at this moment) msg = CanStoreNewItem(InventorySlots.Bag0, ItemConst.NullSlot, sDest, titem_id, titem_amount); if (msg == InventoryResult.Ok) @@ -1288,7 +1288,7 @@ namespace Game.Entities AddTradeableItem(item); // save data - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); foreach (var guid in allowedLooters) ss.AppendFormat("{0} ", guid); @@ -1307,7 +1307,7 @@ namespace Game.Entities ItemTemplate childTemplate = Global.ObjectMgr.GetItemTemplate(childItemEntry.ChildItemID); if (childTemplate != null) { - List childDest = new List(); + List childDest = new(); CanStoreItem_InInventorySlots(InventorySlots.ChildEquipmentStart, InventorySlots.ChildEquipmentEnd, childDest, childTemplate, ref count, false, null, ItemConst.NullBag, ItemConst.NullSlot); Item childItem = StoreNewItem(childDest, childTemplate.GetId(), update, 0, null, context, null, addToCollection); if (childItem) @@ -1645,7 +1645,7 @@ namespace Game.Entities GetSpellHistory().AddGlobalCooldown(spellProto, m_weaponChangeTimer); - SpellCooldownPkt spellCooldown = new SpellCooldownPkt(); + SpellCooldownPkt spellCooldown = new(); spellCooldown.Caster = GetGUID(); spellCooldown.Flags = SpellCooldownFlags.IncludeGCD; spellCooldown.SpellCooldowns.Add(new SpellCooldownStruct(cooldownSpell, 0)); @@ -1746,7 +1746,7 @@ namespace Game.Entities } // check dest.src move possibility but try to store currently equipped item in the bag where the parent item is - List sSrc = new List(); + List sSrc = new(); ushort eSrc = 0; if (IsInventoryPos(parentBag, parentSlot)) { @@ -1804,7 +1804,7 @@ namespace Game.Entities if (IsChildEquipmentPos(childItem.GetPos())) return; - List dest = new List(); + List dest = new(); uint count = childItem.GetCount(); InventoryResult result = CanStoreItem_InInventorySlots(InventorySlots.ChildEquipmentStart, InventorySlots.ChildEquipmentEnd, dest, childItem.GetTemplate(), ref count, false, childItem, ItemConst.NullBag, ItemConst.NullSlot); if (result != InventoryResult.Ok) @@ -1842,7 +1842,7 @@ namespace Game.Entities } public void SendEquipError(InventoryResult msg, Item item1 = null, Item item2 = null, uint itemId = 0) { - InventoryChangeFailure failure = new InventoryChangeFailure(); + InventoryChangeFailure failure = new(); failure.BagResult = msg; if (msg != InventoryResult.Ok) @@ -1890,7 +1890,7 @@ namespace Game.Entities public bool AddItem(uint itemId, uint count) { uint noSpaceForCount; - List dest = new List(); + List dest = new(); InventoryResult msg = CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, itemId, count, out noSpaceForCount); if (msg != InventoryResult.Ok) count -= noSpaceForCount; @@ -2037,7 +2037,7 @@ namespace Game.Entities // change item amount before check (for unique max count check) pSrcItem.SetCount(pSrcItem.GetCount() - count); - List dest = new List(); + List dest = new(); InventoryResult msg = CanStoreItem(dstbag, dstslot, dest, pNewItem, false); if (msg != InventoryResult.Ok) { @@ -2056,7 +2056,7 @@ namespace Game.Entities // change item amount before check (for unique max count check) pSrcItem.SetCount(pSrcItem.GetCount() - count); - List dest = new List(); + List dest = new(); InventoryResult msg = CanBankItem(dstbag, dstslot, dest, pNewItem, false); if (msg != InventoryResult.Ok) { @@ -2194,7 +2194,7 @@ namespace Game.Entities { if (IsInventoryPos(dst)) { - List dest = new List(); + List dest = new(); InventoryResult msg = CanStoreItem(dstbag, dstslot, dest, pSrcItem, false); if (msg != InventoryResult.Ok) { @@ -2209,7 +2209,7 @@ namespace Game.Entities } else if (IsBankPos(dst)) { - List dest = new List(); + List dest = new(); InventoryResult msg = CanBankItem(dstbag, dstslot, dest, pSrcItem, false); if (msg != InventoryResult.Ok) { @@ -2243,7 +2243,7 @@ namespace Game.Entities if (!pSrcItem.IsBag() && !pDstItem.IsBag()) { InventoryResult msg; - List sDest = new List(); + List sDest = new(); ushort eDest = 0; if (IsInventoryPos(dst)) msg = CanStoreItem(dstbag, dstslot, sDest, pSrcItem, false); @@ -2298,7 +2298,7 @@ namespace Game.Entities InventoryResult _msg = InventoryResult.Ok; // check src.dest move possibility - List _sDest = new List(); + List _sDest = new(); ushort _eDest = 0; if (IsInventoryPos(dst)) _msg = CanStoreItem(dstbag, dstslot, _sDest, pSrcItem, true); @@ -2318,7 +2318,7 @@ namespace Game.Entities } // check dest.src move possibility - List sDest2 = new List(); + List sDest2 = new(); ushort eDest2 = 0; if (IsInventoryPos(src)) _msg = CanStoreItem(srcbag, srcslot, sDest2, pDstItem, true); @@ -2482,7 +2482,7 @@ namespace Game.Entities bool _StoreOrEquipNewItem(uint vendorslot, uint item, byte count, byte bag, byte slot, long price, ItemTemplate pProto, Creature pVendor, VendorItem crItem, bool bStore) { uint stacks = count / pProto.GetBuyCount(); - List vDest = new List(); + List vDest = new(); ushort uiDest = 0; InventoryResult msg = bStore ? CanStoreNewItem(bag, slot, vDest, item, count) : CanEquipNewItem(slot, out uiDest, item, false); if (msg != InventoryResult.Ok) @@ -2517,7 +2517,7 @@ namespace Game.Entities { uint new_count = pVendor.UpdateVendorItemCurrentCount(crItem, count); - BuySucceeded packet = new BuySucceeded(); + BuySucceeded packet = new(); packet.VendorGUID = pVendor.GetGUID(); packet.Muid = vendorslot + 1; packet.NewQuantity = crItem.maxcount > 0 ? new_count : 0xFFFFFFFF; @@ -2548,7 +2548,7 @@ namespace Game.Entities if (item == null) // prevent crash return; - ItemPushResult packet = new ItemPushResult(); + ItemPushResult packet = new(); packet.PlayerGUID = GetGUID(); @@ -2951,7 +2951,7 @@ namespace Game.Entities } public List GetItemListByEntry(uint entry, bool inBankAlso = false) { - List itemList = new List(); + List itemList = new(); int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount(); for (byte i = InventorySlots.ItemStart; i < inventoryEnd; ++i) @@ -3880,9 +3880,9 @@ namespace Game.Entities public void SendItemRetrievalMail(uint itemEntry, uint count, ItemContext context) { - MailSender sender = new MailSender(MailMessageType.Creature, 34337); - MailDraft draft = new MailDraft("Recovered Item", "We recovered a lost item in the twisting nether and noted that it was yours.$B$BPlease find said object enclosed."); // This is the text used in Cataclysm, it probably wasn't changed. - SQLTransaction trans = new SQLTransaction(); + MailSender sender = new(MailMessageType.Creature, 34337); + MailDraft draft = new("Recovered Item", "We recovered a lost item in the twisting nether and noted that it was yours.$B$BPlease find said object enclosed."); // This is the text used in Cataclysm, it probably wasn't changed. + SQLTransaction trans = new(); Item item = Item.CreateItem(itemEntry, count, context, null); if (item) @@ -4354,7 +4354,7 @@ namespace Game.Entities GetSpellHistory().AddCooldown((uint)effectData.SpellID, pItem.GetEntry(), TimeSpan.FromSeconds(30)); - ItemCooldown data = new ItemCooldown(); + ItemCooldown data = new(); data.ItemGuid = pItem.GetGUID(); data.SpellID = (uint)effectData.SpellID; data.Cooldown = 30 * Time.InMilliseconds; //Always 30secs? @@ -4563,7 +4563,7 @@ namespace Game.Entities if (need_space > count) need_space = count; - ItemPosCount newPosition = new ItemPosCount((ushort)(InventorySlots.Bag0 << 8 | j), need_space); + ItemPosCount newPosition = new((ushort)(InventorySlots.Bag0 << 8 | j), need_space); if (!newPosition.IsContainedIn(dest)) { dest.Add(newPosition); @@ -4641,7 +4641,7 @@ namespace Game.Entities if (need_space > count) need_space = count; - ItemPosCount newPosition = new ItemPosCount((ushort)(bag << 8 | slot), need_space); + ItemPosCount newPosition = new((ushort)(bag << 8 | slot), need_space); if (!newPosition.IsContainedIn(dest)) { dest.Add(newPosition); @@ -4981,7 +4981,7 @@ namespace Game.Entities if (need_space > count) need_space = count; - ItemPosCount newPosition = new ItemPosCount((ushort)(bag << 8 | j), need_space); + ItemPosCount newPosition = new((ushort)(bag << 8 | j), need_space); if (!newPosition.IsContainedIn(dest)) { dest.Add(newPosition); @@ -5281,7 +5281,7 @@ namespace Game.Entities { // offhand item must can be stored in inventory for offhand item and it also must be unequipped Item offItem = GetItemByPos(InventorySlots.Bag0, EquipmentSlot.OffHand); - List off_dest = new List(); + List off_dest = new(); if (offItem != null && (!not_loading || CanUnequipItem(((int)InventorySlots.Bag0 << 8) | (int)EquipmentSlot.OffHand, false) != InventoryResult.Ok || CanStoreItem(ItemConst.NullBag, ItemConst.NullSlot, off_dest, offItem, false) != InventoryResult.Ok)) return swap ? InventoryResult.CantSwap : InventoryResult.InvFull; @@ -5314,7 +5314,7 @@ namespace Game.Entities // check dest.src move possibility ushort src = parentItem.GetPos(); - List dest = new List(); + List dest = new(); if (IsInventoryPos(src)) { msg = CanStoreItem(parentItem.GetBagSlot(), ItemConst.NullSlot, dest, dstItem, true); @@ -5492,7 +5492,7 @@ namespace Game.Entities } else if (apply) { - Dictionary csv = new Dictionary(); + Dictionary csv = new(); if (artifactPowerRank.AuraPointsOverride != 0) for (int i = 0; i < SpellConst.MaxEffects; ++i) if (spellInfo.GetEffect((uint)i) != null) @@ -5506,7 +5506,7 @@ namespace Game.Entities if (apply && !HasSpell(artifactPowerRank.SpellID)) { AddTemporarySpell(artifactPowerRank.SpellID); - LearnedSpells learnedSpells = new LearnedSpells(); + LearnedSpells learnedSpells = new(); learnedSpells.SuppressMessaging = true; learnedSpells.SpellID.Add(artifactPowerRank.SpellID); SendPacket(learnedSpells); @@ -5514,7 +5514,7 @@ namespace Game.Entities else if (!apply) { RemoveTemporarySpell(artifactPowerRank.SpellID); - UnlearnedSpells unlearnedSpells = new UnlearnedSpells(); + UnlearnedSpells unlearnedSpells = new(); unlearnedSpells.SuppressMessaging = true; unlearnedSpells.SpellID.Add(artifactPowerRank.SpellID); SendPacket(unlearnedSpells); @@ -6151,7 +6151,7 @@ namespace Game.Entities public void AutoStoreLoot(uint loot_id, LootStore store, ItemContext context = 0, bool broadcast = false) { AutoStoreLoot(ItemConst.NullBag, ItemConst.NullSlot, loot_id, store, context, broadcast); } void AutoStoreLoot(byte bag, byte slot, uint loot_id, LootStore store, ItemContext context = 0, bool broadcast = false) { - Loot loot = new Loot(); + Loot loot = new(); loot.FillLoot(loot_id, store, this, true, false, LootModes.Default, context); uint max_slot = loot.GetMaxSlotInLootFor(this); @@ -6159,7 +6159,7 @@ namespace Game.Entities { LootItem lootItem = loot.LootItemInSlot(i, this); - List dest = new List(); + List dest = new(); InventoryResult msg = CanStoreNewItem(bag, slot, dest, lootItem.itemid, lootItem.count); if (msg != InventoryResult.Ok && slot != ItemConst.NullSlot) msg = CanStoreNewItem(bag, ItemConst.NullSlot, dest, lootItem.itemid, lootItem.count); @@ -6183,7 +6183,7 @@ namespace Game.Entities if (slots < GetInventorySlotCount()) { - List unstorableItems = new List(); + List unstorableItems = new(); for (byte slot = (byte)(InventorySlots.ItemStart + slots); slot < InventorySlots.ItemEnd; ++slot) { @@ -6196,11 +6196,11 @@ namespace Game.Entities { int fullBatches = unstorableItems.Count / SharedConst.MaxMailItems; int remainder = unstorableItems.Count % SharedConst.MaxMailItems; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); var sendItemsBatch = new Action((batchNumber, batchSize) => { - MailDraft draft = new MailDraft(Global.ObjectMgr.GetCypherString(CypherStrings.NotEquippedItem), "There were problems with equipping item(s)."); + MailDraft draft = new(Global.ObjectMgr.GetCypherString(CypherStrings.NotEquippedItem), "There were problems with equipping item(s)."); for (int j = 0; j < batchSize; ++j) draft.AddItem(unstorableItems[batchNumber * SharedConst.MaxMailItems + j]); @@ -6257,7 +6257,7 @@ namespace Game.Entities return; } - List dest = new List(); + List dest = new(); InventoryResult msg = CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, item.itemid, item.count); if (msg == InventoryResult.Ok) { @@ -6365,7 +6365,7 @@ namespace Game.Entities public void SendLootRelease(ObjectGuid guid) { - LootReleaseResponse packet = new LootReleaseResponse(); + LootReleaseResponse packet = new(); packet.LootObj = guid; packet.Owner = GetGUID(); SendPacket(packet); @@ -6747,7 +6747,7 @@ namespace Game.Entities if (!aeLooting) SetLootGUID(guid); - LootResponse packet = new LootResponse(); + LootResponse packet = new(); packet.Owner = guid; packet.LootObj = loot.GetGUID(); packet.LootMethod = _lootMethod; @@ -6770,7 +6770,7 @@ namespace Game.Entities public void SendLootError(ObjectGuid lootObj, ObjectGuid owner, LootError error) { - LootResponse packet = new LootResponse(); + LootResponse packet = new(); packet.LootObj = lootObj; packet.Owner = owner; packet.Acquired = false; @@ -6780,14 +6780,14 @@ namespace Game.Entities public void SendNotifyLootMoneyRemoved(ObjectGuid lootObj) { - CoinRemoved packet = new CoinRemoved(); + CoinRemoved packet = new(); packet.LootObj = lootObj; SendPacket(packet); } public void SendNotifyLootItemRemoved(ObjectGuid lootObj, byte lootSlot) { - LootRemoved packet = new LootRemoved(); + LootRemoved packet = new(); packet.Owner = GetLootWorldObjectGUID(lootObj); packet.LootObj = lootObj; packet.LootListID = (byte)(lootSlot + 1); @@ -6796,7 +6796,7 @@ namespace Game.Entities void SendEquipmentSetList() { - LoadEquipmentSet data = new LoadEquipmentSet(); + LoadEquipmentSet data = new(); foreach (var pair in _equipmentSets) { @@ -6834,7 +6834,7 @@ namespace Game.Entities { eqSlot.Data.Guid = setGuid; - EquipmentSetID data = new EquipmentSetID(); + EquipmentSetID data = new(); data.GUID = eqSlot.Data.Guid; data.Type = (int)eqSlot.Data.Type; data.SetID = eqSlot.Data.SetID; diff --git a/Source/Game/Entities/Player/Player.Map.cs b/Source/Game/Entities/Player/Player.Map.cs index 5b6d40ccd..24ec975c1 100644 --- a/Source/Game/Entities/Player/Player.Map.cs +++ b/Source/Game/Entities/Player/Player.Map.cs @@ -97,7 +97,7 @@ namespace Game.Entities public void SendRaidGroupOnlyMessage(RaidGroupReason reason, int delay) { - RaidGroupOnly raidGroupOnly = new RaidGroupOnly(); + RaidGroupOnly raidGroupOnly = new(); raidGroupOnly.Delay = delay; raidGroupOnly.Reason = reason; @@ -362,7 +362,7 @@ namespace Game.Entities { if (save != null) { - InstanceBind bind = new InstanceBind(); + InstanceBind bind = new(); if (m_boundInstances.ContainsKey(save.GetDifficultyID()) && m_boundInstances[save.GetDifficultyID()].ContainsKey(save.GetMapId())) bind = m_boundInstances[save.GetDifficultyID()][save.GetMapId()]; @@ -438,7 +438,7 @@ namespace Game.Entities if (mapSave == null) //it seems sometimes mapSave is NULL, but I did not check why return; - InstanceSaveCreated data = new InstanceSaveCreated(); + InstanceSaveCreated data = new(); data.Gm = IsGameMaster(); SendPacket(data); if (!IsGameMaster()) @@ -456,7 +456,7 @@ namespace Game.Entities public void SendRaidInfo() { - InstanceInfoPkt instanceInfo = new InstanceInfoPkt(); + InstanceInfoPkt instanceInfo = new(); long now = Time.UnixTime; foreach (var difficultyDic in m_boundInstances.Values) @@ -660,14 +660,14 @@ namespace Game.Entities public void SendDungeonDifficulty(int forcedDifficulty = -1) { - DungeonDifficultySet dungeonDifficultySet = new DungeonDifficultySet(); + DungeonDifficultySet dungeonDifficultySet = new(); dungeonDifficultySet.DifficultyID = forcedDifficulty == -1 ? (int)GetDungeonDifficultyID() : forcedDifficulty; SendPacket(dungeonDifficultySet); } public void SendRaidDifficulty(bool legacy, int forcedDifficulty = -1) { - RaidDifficultySet raidDifficultySet = new RaidDifficultySet(); + RaidDifficultySet raidDifficultySet = new(); raidDifficultySet.DifficultyID = forcedDifficulty == -1 ? (int)(legacy ? GetLegacyRaidDifficultyID() : GetRaidDifficultyID()) : forcedDifficulty; raidDifficultySet.Legacy = legacy; SendPacket(raidDifficultySet); @@ -731,14 +731,14 @@ namespace Game.Entities public void SendResetInstanceSuccess(uint MapId) { - InstanceReset data = new InstanceReset(); + InstanceReset data = new(); data.MapID = MapId; SendPacket(data); } public void SendResetInstanceFailed(ResetFailedReason reason, uint MapId) { - InstanceResetFailed data = new InstanceResetFailed(); + InstanceResetFailed data = new(); data.MapID = MapId; data.ResetFailedReason = reason; SendPacket(data); @@ -746,7 +746,7 @@ namespace Game.Entities public void SendTransferAborted(uint mapid, TransferAbortReason reason, byte arg = 0, uint mapDifficultyXConditionID = 0) { - TransferAborted transferAborted = new TransferAborted(); + TransferAborted transferAborted = new(); transferAborted.MapID = mapid; transferAborted.Arg = arg; transferAborted.TransfertAbort = reason; @@ -769,7 +769,7 @@ namespace Game.Entities else type = InstanceResetWarningType.WarningMinSoon; - RaidInstanceMessage raidInstanceMessage = new RaidInstanceMessage(); + RaidInstanceMessage raidInstanceMessage = new(); raidInstanceMessage.Type = type; raidInstanceMessage.MapID = mapid; raidInstanceMessage.DifficultyID = difficulty; diff --git a/Source/Game/Entities/Player/Player.PvP.cs b/Source/Game/Entities/Player/Player.PvP.cs index 5e90858ce..2855e3032 100644 --- a/Source/Game/Entities/Player/Player.PvP.cs +++ b/Source/Game/Entities/Player/Player.PvP.cs @@ -173,7 +173,7 @@ namespace Game.Entities // victim_rank [1..4] HK: // victim_rank [5..19] HK: // victim_rank [0, 20+] HK: <> - PvPCredit data = new PvPCredit(); + PvPCredit data = new(); data.Honor = honor; data.OriginalHonor = honor; data.Target = victim_guid; @@ -317,7 +317,7 @@ namespace Game.Entities RemovePvpTalent(talentInfo); } - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); _SaveTalents(trans); _SaveSpells(trans); DB.Characters.CommitTransaction(trans); @@ -786,7 +786,7 @@ namespace Game.Entities /// public void ReportedAfkBy(Player reporter) { - ReportPvPPlayerAFKResult reportAfkResult = new ReportPvPPlayerAFKResult(); + ReportPvPPlayerAFKResult reportAfkResult = new(); reportAfkResult.Offender = GetGUID(); Battleground bg = GetBattleground(); // Battleground also must be in progress! diff --git a/Source/Game/Entities/Player/Player.Quest.cs b/Source/Game/Entities/Player/Player.Quest.cs index d6e97b46f..985f0746f 100644 --- a/Source/Game/Entities/Player/Player.Quest.cs +++ b/Source/Game/Entities/Player/Player.Quest.cs @@ -169,7 +169,7 @@ namespace Game.Entities SetQuestCompletedBit(questBit, false); } - DailyQuestsReset dailyQuestsReset = new DailyQuestsReset(); + DailyQuestsReset dailyQuestsReset = new(); dailyQuestsReset.Count = m_activePlayerData.DailyQuestsCompleted.Size(); SendPacket(dailyQuestsReset); @@ -453,7 +453,7 @@ namespace Game.Entities if (srcitem > 0) { uint count = quest.SourceItemIdCount; - List dest = new List(); + List dest = new(); InventoryResult msg2 = CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, srcitem, count); // player already have max number (in most case 1) source item, no additional item needed and quest can be added. @@ -582,7 +582,7 @@ namespace Game.Entities if (!CanRewardQuest(quest, msg)) return false; - List dest = new List(); + List dest = new(); if (quest.GetRewChoiceItemsCount() > 0) { switch (rewardType) @@ -915,7 +915,7 @@ namespace Game.Entities if (CanSelectQuestPackageItem(questPackageItem)) { hasFilteredQuestPackageReward = true; - List dest = new List(); + List dest = new(); if (CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, questPackageItem.ItemID, questPackageItem.ItemQuantity) == InventoryResult.Ok) { Item item = StoreNewItem(dest, questPackageItem.ItemID, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(questPackageItem.ItemID)); @@ -935,7 +935,7 @@ namespace Game.Entities if (onlyItemId != 0 && questPackageItem.ItemID != onlyItemId) continue; - List dest = new List(); + List dest = new(); if (CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, questPackageItem.ItemID, questPackageItem.ItemQuantity) == InventoryResult.Ok) { Item item = StoreNewItem(dest, questPackageItem.ItemID, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(questPackageItem.ItemID)); @@ -989,7 +989,7 @@ namespace Game.Entities uint itemId = quest.RewardItemId[i]; if (itemId != 0) { - List dest = new List(); + List dest = new(); if (CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, itemId, quest.RewardItemCount[i]) == InventoryResult.Ok) { Item item = StoreNewItem(dest, itemId, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(itemId)); @@ -1011,7 +1011,7 @@ namespace Game.Entities { if (quest.RewardChoiceItemId[i] != 0 && quest.RewardChoiceItemType[i] == LootItemType.Item && quest.RewardChoiceItemId[i] == rewardId) { - List dest = new List(); + List dest = new(); if (CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, rewardId, quest.RewardChoiceItemCount[i]) == InventoryResult.Ok) { Item item = StoreNewItem(dest, rewardId, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(rewardId)); @@ -1085,7 +1085,7 @@ namespace Game.Entities uint mail_template_id = quest.RewardMailTemplateId; if (mail_template_id != 0) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); // @todo Poor design of mail system uint questMailSender = quest.RewardMailSenderEntry; if (questMailSender != 0) @@ -1656,7 +1656,7 @@ namespace Game.Entities if (count <= 0) count = 1; - List dest = new List(); + List dest = new(); InventoryResult msg = CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, srcitem, count); if (msg == InventoryResult.Ok) { @@ -2775,7 +2775,7 @@ namespace Game.Entities { if (quest != null) { - QuestUpdateComplete data = new QuestUpdateComplete(); + QuestUpdateComplete data = new(); data.QuestID = quest.Id; SendPacket(data); } @@ -2798,7 +2798,7 @@ namespace Game.Entities moneyReward = (uint)(GetQuestMoneyReward(quest) + (int)(quest.GetRewMoneyMaxLevel() * WorldConfig.GetFloatValue(WorldCfg.RateDropMoney))); } - QuestGiverQuestComplete packet = new QuestGiverQuestComplete(); + QuestGiverQuestComplete packet = new(); packet.QuestID = questId; packet.MoneyReward = moneyReward; @@ -2825,7 +2825,7 @@ namespace Game.Entities { if (questId != 0) { - QuestGiverQuestFailed questGiverQuestFailed = new QuestGiverQuestFailed(); + QuestGiverQuestFailed questGiverQuestFailed = new(); questGiverQuestFailed.QuestID = questId; questGiverQuestFailed.Reason = reason; // failed reason (valid reasons: 4, 16, 50, 17, other values show default message) SendPacket(questGiverQuestFailed); @@ -2836,7 +2836,7 @@ namespace Game.Entities { if (questId != 0) { - QuestUpdateFailedTimer questUpdateFailedTimer = new QuestUpdateFailedTimer(); + QuestUpdateFailedTimer questUpdateFailedTimer = new(); questUpdateFailedTimer.QuestID = questId; SendPacket(questUpdateFailedTimer); } @@ -2844,7 +2844,7 @@ namespace Game.Entities public void SendCanTakeQuestResponse(QuestFailedReasons reason, bool sendErrorMessage = true, string reasonText = "") { - QuestGiverInvalidQuest questGiverInvalidQuest = new QuestGiverInvalidQuest(); + QuestGiverInvalidQuest questGiverInvalidQuest = new(); questGiverInvalidQuest.Reason = reason; questGiverInvalidQuest.SendErrorMessage = sendErrorMessage; @@ -2858,7 +2858,7 @@ namespace Game.Entities if (!receiver) return; - QuestConfirmAcceptResponse packet = new QuestConfirmAcceptResponse(); + QuestConfirmAcceptResponse packet = new(); packet.QuestTitle = quest.LogTitle; @@ -2880,7 +2880,7 @@ namespace Game.Entities { if (player != null) { - QuestPushResultResponse data = new QuestPushResultResponse(); + QuestPushResultResponse data = new(); data.SenderGUID = player.GetGUID(); data.Result = reason; SendPacket(data); @@ -2889,7 +2889,7 @@ namespace Game.Entities void SendQuestUpdateAddCredit(Quest quest, ObjectGuid guid, QuestObjective obj, uint count) { - QuestUpdateAddCredit packet = new QuestUpdateAddCredit(); + QuestUpdateAddCredit packet = new(); packet.VictimGUID = guid; packet.QuestID = quest.Id; packet.ObjectID = obj.ObjectID; @@ -2901,7 +2901,7 @@ namespace Game.Entities public void SendQuestUpdateAddCreditSimple(QuestObjective obj) { - QuestUpdateAddCreditSimple packet = new QuestUpdateAddCreditSimple(); + QuestUpdateAddCreditSimple packet = new(); packet.QuestID = obj.QuestID; packet.ObjectID = obj.ObjectID; packet.ObjectiveType = obj.Type; @@ -2910,7 +2910,7 @@ namespace Game.Entities public void SendQuestUpdateAddPlayer(Quest quest, uint newCount) { - QuestUpdateAddPvPCredit packet = new QuestUpdateAddPvPCredit(); + QuestUpdateAddPvPCredit packet = new(); packet.QuestID = quest.Id; packet.Count = (ushort)newCount; SendPacket(packet); @@ -2918,7 +2918,7 @@ namespace Game.Entities public void SendQuestGiverStatusMultiple() { - QuestGiverStatusMultiple response = new QuestGiverStatusMultiple(); + QuestGiverStatusMultiple response = new(); foreach (var itr in m_clientGUIDs) { @@ -3005,7 +3005,7 @@ namespace Game.Entities if (m_clientGUIDs.Empty()) return; - UpdateData udata = new UpdateData(GetMapId()); + UpdateData udata = new(GetMapId()); UpdateObject packet; foreach (var guid in m_clientGUIDs) { @@ -3022,8 +3022,8 @@ namespace Game.Entities case GameObjectTypes.Generic: if (Global.ObjectMgr.IsGameObjectForQuests(obj.GetEntry())) { - ObjectFieldData objMask = new ObjectFieldData(); - GameObjectFieldData goMask = new GameObjectFieldData(); + ObjectFieldData objMask = new(); + GameObjectFieldData goMask = new(); objMask.MarkChanged(obj.m_objectData.DynamicFlags); obj.BuildValuesUpdateForPlayerWithMask(udata, objMask._changesMask, goMask._changesMask, this); } @@ -3058,8 +3058,8 @@ namespace Game.Entities if (buildUpdateBlock) { - ObjectFieldData objMask = new ObjectFieldData(); - UnitData unitMask = new UnitData(); + ObjectFieldData objMask = new(); + UnitData unitMask = new(); unitMask.MarkChanged(obj.m_unitData.NpcFlags, 0); // NpcFlags[0] has UNIT_NPC_FLAG_SPELLCLICK obj.BuildValuesUpdateForPlayerWithMask(udata, objMask._changesMask, unitMask._changesMask, this); break; diff --git a/Source/Game/Entities/Player/Player.Spells.cs b/Source/Game/Entities/Player/Player.Spells.cs index a6a726c3d..abfc88f25 100644 --- a/Source/Game/Entities/Player/Player.Spells.cs +++ b/Source/Game/Entities/Player/Player.Spells.cs @@ -217,7 +217,7 @@ namespace Game.Entities CharmInfo charmInfo = pet.GetCharmInfo(); - PetSpells petSpellsPacket = new PetSpells(); + PetSpells petSpellsPacket = new(); petSpellsPacket.PetGUID = pet.GetGUID(); petSpellsPacket.CreatureFamily = (ushort)pet.GetCreatureTemplate().Family; // creature family (required for pet talents) petSpellsPacket.Specialization = pet.GetSpecialization(); @@ -346,7 +346,7 @@ namespace Game.Entities public void SendSpellCategoryCooldowns() { - SpellCategoryCooldown cooldowns = new SpellCategoryCooldown(); + SpellCategoryCooldown cooldowns = new(); var categoryCooldownAuras = GetAuraEffectsByType(AuraType.ModSpellCategoryCooldown); foreach (AuraEffect aurEff in categoryCooldownAuras) @@ -1487,9 +1487,9 @@ namespace Game.Entities return; } - Spell spell = new Spell(this, spellInfo, TriggerCastFlags.None); + Spell spell = new(this, spellInfo, TriggerCastFlags.None); - SpellPrepare spellPrepare = new SpellPrepare(); + SpellPrepare spellPrepare = new(); spellPrepare.ClientCastID = castCount; spellPrepare.ServerCastID = spell.m_castId; SendPacket(spellPrepare); @@ -1516,9 +1516,9 @@ namespace Game.Entities continue; } - Spell spell = new Spell(this, spellInfo, TriggerCastFlags.None); + Spell spell = new(this, spellInfo, TriggerCastFlags.None); - SpellPrepare spellPrepare = new SpellPrepare(); + SpellPrepare spellPrepare = new(); spellPrepare.ClientCastID = castCount; spellPrepare.ServerCastID = spell.m_castId; SendPacket(spellPrepare); @@ -1550,9 +1550,9 @@ namespace Game.Entities continue; } - Spell spell = new Spell(this, spellInfo, TriggerCastFlags.None); + Spell spell = new(this, spellInfo, TriggerCastFlags.None); - SpellPrepare spellPrepare = new SpellPrepare(); + SpellPrepare spellPrepare = new(); spellPrepare.ClientCastID = castCount; spellPrepare.ServerCastID = spell.m_castId; SendPacket(spellPrepare); @@ -1870,7 +1870,7 @@ namespace Game.Entities if (spell != null) return; - PlayerSpell newspell = new PlayerSpell(); + PlayerSpell newspell = new(); newspell.State = PlayerSpellState.Temporary; newspell.Active = true; newspell.Dependent = false; @@ -2009,7 +2009,7 @@ namespace Game.Entities void SendKnownSpells() { - SendKnownSpells knownSpells = new SendKnownSpells(); + SendKnownSpells knownSpells = new(); knownSpells.InitialLogin = false; // @todo foreach (var spell in m_spells.ToList()) @@ -2047,7 +2047,7 @@ namespace Game.Entities // prevent duplicated entires in spell book, also not send if not in world (loading) if (learning && IsInWorld) { - LearnedSpells packet = new LearnedSpells(); + LearnedSpells packet = new(); packet.SpellID.Add(spellId); packet.SuppressMessaging = suppressMessaging; SendPacket(packet); @@ -2243,7 +2243,7 @@ namespace Game.Entities // remove from spell book if not replaced by lesser rank if (!prev_activate) { - UnlearnedSpells unlearnedSpells = new UnlearnedSpells(); + UnlearnedSpells unlearnedSpells = new(); unlearnedSpells.SpellID.Add(spellId); unlearnedSpells.SuppressMessaging = suppressMessaging; SendPacket(unlearnedSpells); @@ -2388,7 +2388,7 @@ namespace Game.Entities SendSupercededSpell(spellId, next_active_spell_id); else { - UnlearnedSpells removedSpells = new UnlearnedSpells(); + UnlearnedSpells removedSpells = new(); removedSpells.SpellID.Add(spellId); SendPacket(removedSpells); } @@ -2443,7 +2443,7 @@ namespace Game.Entities LearnSpell(prev_spell, true, fromSkill); } - PlayerSpell newspell = new PlayerSpell(); + PlayerSpell newspell = new(); newspell.State = state; newspell.Active = active; newspell.Dependent = dependent; @@ -2648,19 +2648,19 @@ namespace Game.Entities if (!IsLoading()) { ServerOpcodes opcode = (mod.type == SpellModType.Flat ? ServerOpcodes.SetFlatSpellModifier : ServerOpcodes.SetPctSpellModifier); - SetSpellModifier packet = new SetSpellModifier(opcode); + SetSpellModifier packet = new(opcode); // @todo Implement sending of bulk modifiers instead of single - SpellModifierInfo spellMod = new SpellModifierInfo(); + SpellModifierInfo spellMod = new(); spellMod.ModIndex = (byte)mod.op; for (int eff = 0; eff < 128; ++eff) { - FlagArray128 mask = new FlagArray128(); + FlagArray128 mask = new(); mask[eff / 32] = 1u << (eff %32); if (mod.mask & mask) { - SpellModifierData modData = new SpellModifierData(); + SpellModifierData modData = new(); if (mod.type == SpellModType.Flat) { modData.ModifierValue = 0.0f; @@ -2839,16 +2839,16 @@ namespace Game.Entities void SendSpellModifiers() { - SetSpellModifier flatMods = new SetSpellModifier(ServerOpcodes.SetFlatSpellModifier); - SetSpellModifier pctMods = new SetSpellModifier(ServerOpcodes.SetPctSpellModifier); + SetSpellModifier flatMods = new(ServerOpcodes.SetFlatSpellModifier); + SetSpellModifier pctMods = new(ServerOpcodes.SetPctSpellModifier); for (var i = 0; i < (int)SpellModOp.Max; ++i) { - SpellModifierInfo flatMod = new SpellModifierInfo(); - SpellModifierInfo pctMod = new SpellModifierInfo(); + SpellModifierInfo flatMod = new(); + SpellModifierInfo pctMod = new(); flatMod.ModIndex = pctMod.ModIndex = (byte)i; for (byte j = 0; j < 128; ++j) { - FlagArray128 mask = new FlagArray128(); + FlagArray128 mask = new(); mask[j / 32] = 1u << (j % 32); SpellModifierData flatData; @@ -2893,7 +2893,7 @@ namespace Game.Entities void SendSupercededSpell(uint oldSpell, uint newSpell) { - SupercededSpells supercededSpells = new SupercededSpells(); + SupercededSpells supercededSpells = new(); supercededSpells.SpellID.Add(newSpell); supercededSpells.Superceded.Add(oldSpell); SendPacket(supercededSpells); @@ -3000,7 +3000,7 @@ namespace Game.Entities { int maxRunes = GetMaxPower(PowerType.Runes); - ResyncRunes data = new ResyncRunes(); + ResyncRunes data = new(); data.Runes.Start = (byte)((1 << maxRunes) - 1); data.Runes.Count = GetRunesState(); @@ -3057,7 +3057,7 @@ namespace Game.Entities return true; // Check no reagent use mask - FlagArray128 noReagentMask = new FlagArray128(); + FlagArray128 noReagentMask = new(); noReagentMask[0] = m_activePlayerData.NoReagentCostMask[0]; noReagentMask[1] = m_activePlayerData.NoReagentCostMask[1]; noReagentMask[2] = m_activePlayerData.NoReagentCostMask[2]; @@ -3232,7 +3232,7 @@ namespace Game.Entities Unit target = spellInfo.IsPositive() ? this : damageInfo.GetVictim(); // reduce effect values if enchant is limited - Dictionary values = new Dictionary(); + Dictionary values = new(); if (entry != null && entry.AttributesMask.HasAnyFlag(EnchantProcAttributes.Limit60) && target.GetLevelForTarget(this) > 60) { int lvlDifference = (int)target.GetLevelForTarget(this) - 60; diff --git a/Source/Game/Entities/Player/Player.Talents.cs b/Source/Game/Entities/Player/Player.Talents.cs index b7b830c80..f79315f7e 100644 --- a/Source/Game/Entities/Player/Player.Talents.cs +++ b/Source/Game/Entities/Player/Player.Talents.cs @@ -259,7 +259,7 @@ namespace Game.Entities if (IsNonMeleeSpellCast(false)) InterruptNonMeleeSpells(false); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); _SaveActions(trans); DB.Characters.CommitTransaction(trans); @@ -410,7 +410,7 @@ namespace Game.Entities foreach (uint glyphId in GetGlyphs(spec.OrderIndex)) CastSpell(this, CliDB.GlyphPropertiesStorage.LookupByKey(glyphId).SpellID, true); - ActiveGlyphs activeGlyphs = new ActiveGlyphs(); + ActiveGlyphs activeGlyphs = new(); foreach (uint glyphId in GetGlyphs(spec.OrderIndex)) { List bindableSpells = Global.DB2Mgr.GetGlyphBindableSpells(glyphId); @@ -527,7 +527,7 @@ namespace Game.Entities RemoveTalent(talentInfo); } - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); _SaveTalents(trans); _SaveSpells(trans); DB.Characters.CommitTransaction(trans); @@ -547,7 +547,7 @@ namespace Game.Entities public void SendTalentsInfoData() { - UpdateTalentData packet = new UpdateTalentData(); + UpdateTalentData packet = new(); packet.Info.PrimarySpecialization = GetPrimarySpecialization(); for (byte i = 0; i < PlayerConst.MaxSpecializations; ++i) @@ -559,7 +559,7 @@ namespace Game.Entities var talents = GetTalentMap(i); var pvpTalents = GetPvpTalentMap(i); - UpdateTalentData.TalentGroupInfo groupInfoPkt = new UpdateTalentData.TalentGroupInfo(); + UpdateTalentData.TalentGroupInfo groupInfoPkt = new(); groupInfoPkt.SpecID = spec.Id; foreach (var pair in talents) @@ -603,7 +603,7 @@ namespace Game.Entities continue; } - PvPTalent pvpTalent = new PvPTalent(); + PvPTalent pvpTalent = new(); pvpTalent.PvPTalentID = (ushort)pvpTalents[slot]; pvpTalent.Slot = slot; groupInfoPkt.PvPTalents.Add(pvpTalent); @@ -621,7 +621,7 @@ namespace Game.Entities public void SendRespecWipeConfirm(ObjectGuid guid, uint cost) { - RespecWipeConfirm respecWipeConfirm = new RespecWipeConfirm(); + RespecWipeConfirm respecWipeConfirm = new(); respecWipeConfirm.RespecMaster = guid; respecWipeConfirm.Cost = cost; respecWipeConfirm.RespecType = SpecResetType.Talents; diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 266f7574c..e464ad52b 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -266,7 +266,7 @@ namespace Game.Entities foreach (var action in info.action) { // create new button - ActionButton ab = new ActionButton(); + ActionButton ab = new(); // set data ab.SetActionAndType(action.action, (ActionButtonType)action.type); @@ -297,7 +297,7 @@ namespace Game.Entities // move other items to more appropriate slots else { - List sDest = new List(); + List sDest = new(); msg = CanStoreItem(ItemConst.NullBag, ItemConst.NullSlot, sDest, pItem, false); if (msg == InventoryResult.Ok) { @@ -843,7 +843,7 @@ namespace Game.Entities { m_timeSyncQueue.Push(m_movementCounter++); - TimeSyncRequest packet = new TimeSyncRequest(); + TimeSyncRequest packet = new(); packet.SequenceIndex = m_timeSyncQueue.Last(); SendPacket(packet); @@ -903,7 +903,7 @@ namespace Game.Entities // just not added to the map if (IsInWorld) { - Pet pet = new Pet(this); + Pet pet = new(this); pet.LoadPetFromDB(this, 0, 0, true); } } @@ -935,7 +935,7 @@ namespace Game.Entities if (!GetPetGUID().IsEmpty()) return; - Pet NewPet = new Pet(this); + Pet NewPet = new(this); NewPet.LoadPetFromDB(this, 0, m_temporaryUnsummonedPetNumber, true); m_temporaryUnsummonedPetNumber = 0; @@ -992,7 +992,7 @@ namespace Game.Entities return; } - PetSpells petSpells = new PetSpells(); + PetSpells petSpells = new(); petSpells.PetGUID = charm.GetGUID(); if (charm.IsTypeId(TypeId.Unit)) @@ -1030,7 +1030,7 @@ namespace Game.Entities return; } - PetSpells petSpellsPacket = new PetSpells(); + PetSpells petSpellsPacket = new(); petSpellsPacket.PetGUID = charm.GetGUID(); for (byte i = 0; i < SharedConst.ActionBarIndexMax; ++i) @@ -1047,7 +1047,7 @@ namespace Game.Entities if (!vehicle) return; - PetSpells petSpells = new PetSpells(); + PetSpells petSpells = new(); petSpells.PetGUID = vehicle.GetGUID(); petSpells.CreatureFamily = 0; // Pet Family (0 for all vehicles) petSpells.Specialization = 0; @@ -1090,7 +1090,7 @@ namespace Game.Entities var playerCurrency = _currencyStorage.LookupByKey(id); if (playerCurrency == null) { - PlayerCurrency cur = new PlayerCurrency(); + PlayerCurrency cur = new(); cur.state = PlayerCurrencyState.New; cur.Quantity = count; cur.WeeklyQuantity = 0; @@ -1146,7 +1146,7 @@ namespace Game.Entities var playerCurrency = _currencyStorage.LookupByKey(id); if (playerCurrency == null) { - PlayerCurrency cur = new PlayerCurrency(); + PlayerCurrency cur = new(); cur.state = PlayerCurrencyState.New; cur.Quantity = 0; cur.WeeklyQuantity = 0; @@ -1215,7 +1215,7 @@ namespace Game.Entities _currencyStorage[(uint)id] = playerCurrency; - SetCurrency packet = new SetCurrency(); + SetCurrency packet = new(); packet.Type = (uint)id; packet.Quantity = newTotalCount; packet.SuppressChatLog = !printLog; @@ -1396,7 +1396,7 @@ namespace Game.Entities void SendInitialActionButtons() { SendActionButtons(0); } void SendActionButtons(uint state) { - UpdateActionButtons packet = new UpdateActionButtons(); + UpdateActionButtons packet = new(); foreach (var pair in m_actionButtons) { @@ -1792,7 +1792,7 @@ namespace Game.Entities if (!GetSession().PlayerLogout() && !options.HasAnyFlag(TeleportToOptions.Seamless)) { // send transfer packets - TransferPending transferPending = new TransferPending(); + TransferPending transferPending = new(); transferPending.MapID = (int)mapid; transferPending.OldMapPosition = GetPosition(); @@ -1819,7 +1819,7 @@ namespace Game.Entities if (!GetSession().PlayerLogout()) { - SuspendToken suspendToken = new SuspendToken(); + SuspendToken suspendToken = new(); suspendToken.SequenceIndex = m_movementCounter; // not incrementing suspendToken.Reason = options.HasAnyFlag(TeleportToOptions.Seamless) ? 2 : 1u; SendPacket(suspendToken); @@ -2060,7 +2060,7 @@ namespace Game.Entities m_summon_expire = Time.UnixTime + PlayerConst.MaxPlayerSummonDelay; m_summon_location = new WorldLocation(summoner); - SummonRequest summonRequest = new SummonRequest(); + SummonRequest summonRequest = new(); summonRequest.SummonerGUID = summoner.GetGUID(); summonRequest.SummonerVirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress(); summonRequest.AreaID = (int)summoner.GetZoneId(); @@ -2087,7 +2087,7 @@ namespace Game.Entities } else { - Position center = new Position(trigger.Pos.X, trigger.Pos.Y, trigger.Pos.Z, trigger.BoxYaw); + Position center = new(trigger.Pos.X, trigger.Pos.Y, trigger.Pos.Z, trigger.BoxYaw); if (!IsWithinBox(center, trigger.BoxLength / 2.0f, trigger.BoxWidth / 2.0f, trigger.BoxHeight / 2.0f)) return false; } @@ -2703,7 +2703,7 @@ namespace Game.Entities } public void SendMailResult(uint mailId, MailResponseType mailAction, MailResponseResult mailError, InventoryResult equipError = 0, uint item_guid = 0, uint item_count = 0) { - MailCommandResult result = new MailCommandResult(); + MailCommandResult result = new(); result.MailID = mailId; result.Command = (uint)mailAction; result.ErrorCode = (uint)mailError; @@ -2815,12 +2815,12 @@ namespace Game.Entities } public void SetBindPoint(ObjectGuid guid) { - BinderConfirm packet = new BinderConfirm(guid); + BinderConfirm packet = new(guid); SendPacket(packet); } public void SendBindPointUpdate() { - BindPointUpdate packet = new BindPointUpdate(); + BindPointUpdate packet = new(); packet.BindPosition.X = homebind.GetPositionX(); packet.BindPosition.Y = homebind.GetPositionY(); packet.BindPosition.Z = homebind.GetPositionZ(); @@ -2837,7 +2837,7 @@ namespace Game.Entities public void SendUpdateWorldState(uint variable, uint value, bool hidden = false) { - UpdateWorldState worldstate = new UpdateWorldState(); + UpdateWorldState worldstate = new(); worldstate.VariableID = variable; worldstate.Value = (int)value; worldstate.Hidden = hidden; @@ -2853,7 +2853,7 @@ namespace Game.Entities InstanceScript instance = GetInstanceScript(); BattleField bf = Global.BattleFieldMgr.GetBattlefieldToZoneId(zoneid); - InitWorldStates packet = new InitWorldStates(); + InitWorldStates packet = new(); packet.MapID = mapid; packet.AreaID = zoneid; packet.SubareaID = areaid; @@ -3550,7 +3550,7 @@ namespace Game.Entities if (!IsInWorld) return; - UpdateData udata = new UpdateData(GetMapId()); + UpdateData udata = new(GetMapId()); foreach (var guid in m_clientGUIDs) { if (guid.IsCreatureOrVehicle()) @@ -3946,7 +3946,7 @@ namespace Game.Entities { case EnviromentalDamage.Lava: case EnviromentalDamage.Slime: - DamageInfo dmgInfo = new DamageInfo(this, this, damage, null, type == EnviromentalDamage.Lava ? SpellSchoolMask.Fire : SpellSchoolMask.Nature, DamageEffectType.Direct, WeaponAttackType.BaseAttack); + DamageInfo dmgInfo = new(this, this, damage, null, type == EnviromentalDamage.Lava ? SpellSchoolMask.Fire : SpellSchoolMask.Nature, DamageEffectType.Direct, WeaponAttackType.BaseAttack); CalcAbsorbResist(dmgInfo); absorb = dmgInfo.GetAbsorb(); resist = dmgInfo.GetResist(); @@ -3956,7 +3956,7 @@ namespace Game.Entities DealDamageMods(this, ref damage, ref absorb); - EnvironmentalDamageLog packet = new EnvironmentalDamageLog(); + EnvironmentalDamageLog packet = new(); packet.Victim = GetGUID(); packet.Type = type != EnviromentalDamage.FallToVoid ? type : EnviromentalDamage.Fall; packet.Amount = (int)damage; @@ -4038,7 +4038,7 @@ namespace Game.Entities public void BuildPlayerRepop() { - PreRessurect packet = new PreRessurect(); + PreRessurect packet = new(); packet.PlayerGUID = GetGUID(); SendPacket(packet); @@ -4289,7 +4289,7 @@ namespace Game.Entities public void ResurrectPlayer(float restore_percent, bool applySickness = false) { - DeathReleaseLoc packet = new DeathReleaseLoc(); + DeathReleaseLoc packet = new(); packet.MapID = -1; SendPacket(packet); @@ -4419,7 +4419,7 @@ namespace Game.Entities // prevent existence 2 corpse for player SpawnCorpseBones(); - Corpse corpse = new Corpse(Convert.ToBoolean(m_ExtraFlags & PlayerExtraFlags.PVPDeath) ? CorpseType.ResurrectablePVP : CorpseType.ResurrectablePVE); + Corpse corpse = new(Convert.ToBoolean(m_ExtraFlags & PlayerExtraFlags.PVPDeath) ? CorpseType.ResurrectablePVP : CorpseType.ResurrectablePVE); SetPvPDeath(false); if (!corpse.Create(GetMap().GenerateLowGuid(HighGuid.Corpse), this)) @@ -4518,7 +4518,7 @@ namespace Game.Entities TeleportTo(ClosestGrave.Loc); if (IsDead()) // not send if alive, because it used in TeleportTo() { - DeathReleaseLoc packet = new DeathReleaseLoc(); + DeathReleaseLoc packet = new(); packet.MapID = (int)ClosestGrave.Loc.GetMapId(); packet.Loc = ClosestGrave.Loc; SendPacket(packet); @@ -4611,7 +4611,7 @@ namespace Game.Entities } void SendCorpseReclaimDelay(int delay) { - CorpseReclaimDelay packet = new CorpseReclaimDelay(); + CorpseReclaimDelay packet = new(); packet.Remaining = (uint)delay; SendPacket(packet); } @@ -4639,7 +4639,7 @@ namespace Game.Entities public Pet SummonPet(uint entry, float x, float y, float z, float ang, PetType petType, uint duration) { - Pet pet = new Pet(this, petType); + Pet pet = new(this, petType); if (petType == PetType.Summon && pet.LoadPetFromDB(this, entry)) { if (duration > 0) @@ -4740,7 +4740,7 @@ namespace Game.Entities { if (spellInfo.Reagent[i] > 0) { - List dest = new List(); //for succubus, voidwalker, felhunter and felguard credit soulshard when despawn reason other than death (out of range, logout) + List dest = new(); //for succubus, voidwalker, felhunter and felguard credit soulshard when despawn reason other than death (out of range, logout) InventoryResult msg = CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, (uint)spellInfo.Reagent[i], spellInfo.ReagentCount[i]); if (msg == InventoryResult.Ok) { @@ -4824,7 +4824,7 @@ namespace Game.Entities public void SendMovementSetCollisionHeight(float height, UpdateCollisionHeightReason reason) { - MoveSetCollisionHeight setCollisionHeight = new MoveSetCollisionHeight(); + MoveSetCollisionHeight setCollisionHeight = new(); setCollisionHeight.MoverGUID = GetGUID(); setCollisionHeight.SequenceIndex = m_movementCounter++; setCollisionHeight.Height = height; @@ -4834,7 +4834,7 @@ namespace Game.Entities setCollisionHeight.Reason = reason; SendPacket(setCollisionHeight); - MoveUpdateCollisionHeight updateCollisionHeight = new MoveUpdateCollisionHeight(); + MoveUpdateCollisionHeight updateCollisionHeight = new(); updateCollisionHeight.Status = m_movementInfo; updateCollisionHeight.Height = height; updateCollisionHeight.Scale = GetObjectScale(); @@ -4854,7 +4854,7 @@ namespace Game.Entities PlayerTalkClass.GetInteractionData().SourceGuid = sender; PlayerTalkClass.GetInteractionData().PlayerChoiceId = (uint)choiceId; - DisplayPlayerChoice displayPlayerChoice = new DisplayPlayerChoice(); + DisplayPlayerChoice displayPlayerChoice = new(); displayPlayerChoice.SenderGUID = sender; displayPlayerChoice.ChoiceID = choiceId; displayPlayerChoice.UiTextureKitID = playerChoice.UiTextureKitId; @@ -5146,7 +5146,7 @@ namespace Game.Entities Global.ObjectMgr.GetPlayerClassLevelInfo(GetClass(), level, out uint basemana); - LevelUpInfo packet = new LevelUpInfo(); + LevelUpInfo packet = new(); packet.Level = level; packet.HealthDelta = 0; @@ -5217,7 +5217,7 @@ namespace Game.Entities if (mailReward != null) { //- TODO: Poor design of mail system - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); new MailDraft(mailReward.mailTemplateId).SendMailTo(trans, this, new MailSender(MailMessageType.Creature, mailReward.senderEntry)); DB.Characters.CommitTransaction(trans); } @@ -5420,16 +5420,16 @@ namespace Game.Entities SendPacket(new SendUnlearnSpells()); // SMSG_SEND_SPELL_HISTORY - SendSpellHistory sendSpellHistory = new SendSpellHistory(); + SendSpellHistory sendSpellHistory = new(); GetSpellHistory().WritePacket(sendSpellHistory); SendPacket(sendSpellHistory); // SMSG_SEND_SPELL_CHARGES - SendSpellCharges sendSpellCharges = new SendSpellCharges(); + SendSpellCharges sendSpellCharges = new(); GetSpellHistory().WritePacket(sendSpellCharges); SendPacket(sendSpellCharges); - ActiveGlyphs activeGlyphs = new ActiveGlyphs(); + ActiveGlyphs activeGlyphs = new(); foreach (uint glyphId in GetGlyphs(GetActiveTalentGroup())) { List bindableSpells = Global.DB2Mgr.GetGlyphBindableSpells(glyphId); @@ -5458,7 +5458,7 @@ namespace Game.Entities // SMSG_LOGIN_SETTIMESPEED float TimeSpeed = 0.01666667f; - LoginSetTimeSpeed loginSetTimeSpeed = new LoginSetTimeSpeed(); + LoginSetTimeSpeed loginSetTimeSpeed = new(); loginSetTimeSpeed.NewSpeed = TimeSpeed; loginSetTimeSpeed.GameTime = (uint)GameTime.GetGameTime(); loginSetTimeSpeed.ServerTime = (uint)GameTime.GetGameTime(); @@ -5467,7 +5467,7 @@ namespace Game.Entities SendPacket(loginSetTimeSpeed); // SMSG_WORLD_SERVER_INFO - WorldServerInfo worldServerInfo = new WorldServerInfo(); + WorldServerInfo worldServerInfo = new(); worldServerInfo.InstanceGroupSize.Set(GetMap().GetMapDifficulty().MaxPlayers); // @todo worldServerInfo.IsTournamentRealm = 0; // @todo worldServerInfo.RestrictedAccountMaxLevel.Clear(); // @todo @@ -5480,26 +5480,26 @@ namespace Game.Entities SendSpellModifiers(); // SMSG_ACCOUNT_MOUNT_UPDATE - AccountMountUpdate mountUpdate = new AccountMountUpdate(); + AccountMountUpdate mountUpdate = new(); mountUpdate.IsFullUpdate = true; mountUpdate.Mounts = GetSession().GetCollectionMgr().GetAccountMounts(); SendPacket(mountUpdate); // SMSG_ACCOUNT_TOYS_UPDATE - AccountToyUpdate toyUpdate = new AccountToyUpdate(); + AccountToyUpdate toyUpdate = new(); toyUpdate.IsFullUpdate = true; toyUpdate.Toys = GetSession().GetCollectionMgr().GetAccountToys(); SendPacket(toyUpdate); // SMSG_ACCOUNT_HEIRLOOM_UPDATE - AccountHeirloomUpdate heirloomUpdate = new AccountHeirloomUpdate(); + AccountHeirloomUpdate heirloomUpdate = new(); heirloomUpdate.IsFullUpdate = true; heirloomUpdate.Heirlooms = GetSession().GetCollectionMgr().GetAccountHeirlooms(); SendPacket(heirloomUpdate); GetSession().GetCollectionMgr().SendFavoriteAppearances(); - InitialSetup initialSetup = new InitialSetup(); + InitialSetup initialSetup = new(); initialSetup.ServerExpansionLevel = (byte)WorldConfig.GetIntValue(WorldCfg.Expansion); SendPacket(initialSetup); @@ -5538,7 +5538,7 @@ namespace Game.Entities if (HasAuraType(AuraType.ModStun)) SetRooted(true); - MoveSetCompoundState setCompoundState = new MoveSetCompoundState(); + MoveSetCompoundState setCompoundState = new(); // manual send package (have code in HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); that must not be re-applied. if (HasAuraType(AuraType.ModRoot) || HasAuraType(AuraType.ModRoot2)) setCompoundState.StateChanges.Add(new MoveSetCompoundState.MoveStateChange(ServerOpcodes.MoveRoot, m_movementCounter++)); @@ -5625,13 +5625,13 @@ namespace Game.Entities var visibleAuras = target.GetVisibleAuras(); - AuraUpdate update = new AuraUpdate(); + AuraUpdate update = new(); update.UpdateAll = true; update.UnitGUID = target.GetGUID(); foreach (var auraApp in visibleAuras) { - AuraInfo auraInfo = new AuraInfo(); + AuraInfo auraInfo = new(); auraApp.BuildUpdatePacket(ref auraInfo, false); update.Auras.Add(auraInfo); } @@ -5962,7 +5962,7 @@ namespace Game.Entities if (self) SendPacket(data); - MessageDistDeliverer notifier = new MessageDistDeliverer(this, data, dist); + MessageDistDeliverer notifier = new(this, data, dist); Cell.VisitWorldObjects(this, notifier, dist); } @@ -5971,7 +5971,7 @@ namespace Game.Entities if (self) SendPacket(data); - MessageDistDeliverer notifier = new MessageDistDeliverer(this, data, dist, own_team_only); + MessageDistDeliverer notifier = new(this, data, dist, own_team_only); Cell.VisitWorldObjects(this, notifier, dist); } @@ -5982,7 +5982,7 @@ namespace Game.Entities // we use World.GetMaxVisibleDistance() because i cannot see why not use a distance // update: replaced by GetMap().GetVisibilityDistance() - MessageDistDeliverer notifier = new MessageDistDeliverer(this, data, GetVisibilityRange(), false, skipped_rcvr); + MessageDistDeliverer notifier = new(this, data, GetVisibilityRange(), false, skipped_rcvr); Cell.VisitWorldObjects(this, notifier, GetVisibilityRange()); } public override void SendMessageToSet(ServerPacket data, bool self) @@ -6022,8 +6022,8 @@ namespace Game.Entities if (entry == null) // should never happen return; - SetupCurrency packet = new SetupCurrency(); - SetupCurrency.Record record = new SetupCurrency.Record(); + SetupCurrency packet = new(); + SetupCurrency.Record record = new(); record.Type = entry.Id; record.Quantity = Curr.Quantity; record.WeeklyQuantity.Set(Curr.WeeklyQuantity); @@ -6038,7 +6038,7 @@ namespace Game.Entities void SendCurrencies() { - SetupCurrency packet = new SetupCurrency(); + SetupCurrency packet = new(); foreach (var pair in _currencyStorage) { @@ -6048,7 +6048,7 @@ namespace Game.Entities if (entry == null || entry.CategoryID == 89) //CURRENCY_CATEGORY_META_CONQUEST continue; - SetupCurrency.Record record = new SetupCurrency.Record(); + SetupCurrency.Record record = new(); record.Type = entry.Id; record.Quantity = pair.Value.Quantity; record.WeeklyQuantity.Set(pair.Value.WeeklyQuantity); @@ -6196,7 +6196,7 @@ namespace Game.Entities } public void SendBuyError(BuyResult msg, Creature creature, uint item) { - BuyFailed packet = new BuyFailed(); + BuyFailed packet = new(); packet.VendorGUID = creature ? creature.GetGUID() : ObjectGuid.Empty; packet.Muid = item; packet.Reason = msg; @@ -6204,7 +6204,7 @@ namespace Game.Entities } public void SendSellError(SellResult msg, Creature creature, ObjectGuid guid) { - SellResponse sellResponse = new SellResponse(); + SellResponse sellResponse = new(); sellResponse.VendorGUID = (creature ? creature.GetGUID() : ObjectGuid.Empty); sellResponse.ItemGUID = guid; sellResponse.Reason = msg; @@ -6217,7 +6217,7 @@ namespace Game.Entities { Global.ScriptMgr.OnPlayerChat(this, ChatMsg.Say, language, text); - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(ChatMsg.Say, language, this, this, text); SendMessageToSetInRange(data, WorldConfig.GetFloatValue(WorldCfg.ListenRangeSay), true); } @@ -6229,7 +6229,7 @@ namespace Game.Entities { Global.ScriptMgr.OnPlayerChat(this, ChatMsg.Yell, language, text); - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(ChatMsg.Yell, language, this, this, text); SendMessageToSetInRange(data, WorldConfig.GetFloatValue(WorldCfg.ListenRangeYell), true); } @@ -6241,7 +6241,7 @@ namespace Game.Entities { Global.ScriptMgr.OnPlayerChat(this, ChatMsg.Emote, Language.Universal, text); - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(ChatMsg.Emote, Language.Universal, this, this, text); SendMessageToSetInRange(data, WorldConfig.GetFloatValue(WorldCfg.ListenRangeTextemote), !GetSession().HasPermission(RBACPermissions.TwoSideInteractionChat)); } @@ -6256,7 +6256,7 @@ namespace Game.Entities if (!receiver.GetSession().IsAddonRegistered(prefix)) return; - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(ChatMsg.Whisper, isLogged ? Language.AddonLogged : Language.Addon, this, this, text, 0, "", Locale.enUS, prefix); receiver.SendPacket(data); } @@ -6271,7 +6271,7 @@ namespace Game.Entities Global.ScriptMgr.OnPlayerChat(this, ChatMsg.Whisper, language, text, target); - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(ChatMsg.Whisper, language, this, this, text); target.SendPacket(data); @@ -6308,7 +6308,7 @@ namespace Game.Entities } Locale locale = target.GetSession().GetSessionDbLocaleIndex(); - ChatPkt packet = new ChatPkt(); + ChatPkt packet = new(); packet.Initialize(ChatMsg.Whisper, Language.Universal, this, target, Global.DB2Mgr.GetBroadcastTextValue(bct, locale, GetGender())); target.SendPacket(packet); } @@ -6333,7 +6333,7 @@ namespace Game.Entities public void SendCinematicStart(uint CinematicSequenceId) { - TriggerCinematic packet = new TriggerCinematic(); + TriggerCinematic packet = new(); packet.CinematicID = CinematicSequenceId; SendPacket(packet); @@ -6344,7 +6344,7 @@ namespace Game.Entities public void SendMovieStart(uint movieId) { SetMovie(movieId); - TriggerMovie packet = new TriggerMovie(); + TriggerMovie packet = new(); packet.MovieID = movieId; SendPacket(packet); } @@ -6405,7 +6405,7 @@ namespace Game.Entities else bonus_xp = victim != null ? _restMgr.GetRestBonusFor(RestTypes.XP, xp) : 0; // XP resting bonus - LogXPGain packet = new LogXPGain(); + LogXPGain packet = new(); packet.Victim = victim ? victim.GetGUID() : ObjectGuid.Empty; packet.Original = (int)(xp + bonus_xp); packet.Reason = victim ? PlayerLogXPReason.Kill : PlayerLogXPReason.NoKill; @@ -6627,7 +6627,7 @@ namespace Game.Entities if (newDrunkenState == oldDrunkenState) return; - CrossedInebriationThreshold data = new CrossedInebriationThreshold(); + CrossedInebriationThreshold data = new(); data.Guid = GetGUID(); data.Threshold = (uint)newDrunkenState; data.ItemID = itemId; @@ -6834,7 +6834,7 @@ namespace Game.Entities if (entry == null) return false; - List nodes = new List(); + List nodes = new(); nodes.Add(entry.FromTaxiNode); nodes.Add(entry.ToTaxiNode); @@ -6968,7 +6968,7 @@ namespace Game.Entities uint roll = RandomHelper.URand(minimum, maximum); - RandomRoll randomRoll = new RandomRoll(); + RandomRoll randomRoll = new(); randomRoll.Min = (int)minimum; randomRoll.Max = (int)maximum; randomRoll.Result = (int)roll; @@ -7091,7 +7091,7 @@ namespace Game.Entities SetUpdateFieldFlagValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.KnownTitles, fieldIndexOffset), flag); } - TitleEarned packet = new TitleEarned(lost ? ServerOpcodes.TitleLost : ServerOpcodes.TitleEarned); + TitleEarned packet = new(lost ? ServerOpcodes.TitleLost : ServerOpcodes.TitleEarned); packet.Index = title.MaskID; SendPacket(packet); } @@ -7150,7 +7150,7 @@ namespace Game.Entities public void SetClientControl(Unit target, bool allowMove) { - ControlUpdate packet = new ControlUpdate(); + ControlUpdate packet = new(); packet.Guid = target.GetGUID(); packet.On = allowMove; SendPacket(packet); @@ -7167,7 +7167,7 @@ namespace Game.Entities m_unitMovedByMe = target; m_unitMovedByMe.m_playerMovingMe = this; - MoveSetActiveMover packet = new MoveSetActiveMover(); + MoveSetActiveMover packet = new(); packet.MoverGUID = target.GetGUID(); SendPacket(packet); } @@ -7235,7 +7235,7 @@ namespace Game.Entities if (!force && (CanTitanGrip() || (offtemplate.GetInventoryType() != InventoryType.Weapon2Hand && !IsTwoHandUsed()))) return; - List off_dest = new List(); + List off_dest = new(); InventoryResult off_msg = CanStoreItem(ItemConst.NullBag, ItemConst.NullSlot, off_dest, offItem, false); if (off_msg == InventoryResult.Ok) { @@ -7245,7 +7245,7 @@ namespace Game.Entities else { MoveItemFromInventory(InventorySlots.Bag0, EquipmentSlot.OffHand, true); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); offItem.DeleteFromInventoryDB(trans); // deletes item from character's inventory offItem.SaveToDB(trans); // recursive and not have transaction guard into self, item not in inventory and can be save standalone @@ -7311,7 +7311,7 @@ namespace Game.Entities ClearDynamicUpdateFieldValues(m_values.ModifyValue(m_playerData).ModifyValue(m_playerData.Customizations)); foreach (var customization in customizations) { - ChrCustomizationChoice newChoice = new ChrCustomizationChoice(); + ChrCustomizationChoice newChoice = new(); newChoice.ChrCustomizationOptionID = customization.ChrCustomizationOptionID; newChoice.ChrCustomizationChoiceID = customization.ChrCustomizationChoiceID; AddDynamicUpdateFieldValue(m_values.ModifyValue(m_playerData).ModifyValue(m_playerData.Customizations), newChoice); @@ -7394,7 +7394,7 @@ namespace Game.Entities public void SendAttackSwingCancelAttack() { SendPacket(new CancelCombat()); } public void SendAutoRepeatCancel(Unit target) { - CancelAutoRepeat cancelAutoRepeat = new CancelAutoRepeat(); + CancelAutoRepeat cancelAutoRepeat = new(); cancelAutoRepeat.Guid = target.GetGUID(); // may be it's target guid SendMessageToSet(cancelAutoRepeat, true); } @@ -7451,7 +7451,7 @@ namespace Game.Entities public override void BuildValuesCreate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt8((byte)flags); m_objectData.WriteCreate(buffer, flags, this, target); @@ -7467,7 +7467,7 @@ namespace Game.Entities public override void BuildValuesUpdate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32((uint)(m_values.GetChangedObjectTypeMask() & ~((target != this ? 1 : 0) << (int)TypeId.ActivePlayer))); if (m_values.HasChanged(TypeId.Object)) @@ -7488,17 +7488,17 @@ namespace Game.Entities public override void BuildValuesUpdateWithFlag(WorldPacket data, UpdateFieldFlag flags, Player target) { - UpdateMask valuesMask = new UpdateMask((int)TypeId.Max); + UpdateMask valuesMask = new((int)TypeId.Max); valuesMask.Set((int)TypeId.Unit); valuesMask.Set((int)TypeId.Player); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); - UpdateMask mask = new UpdateMask(191); + UpdateMask mask = new(191); m_unitData.AppendAllowedFieldsMaskForFlag(mask, flags); m_unitData.WriteUpdate(buffer, mask, true, this, target); - UpdateMask mask2 = new UpdateMask(161); + UpdateMask mask2 = new(161); m_playerData.AppendAllowedFieldsMaskForFlag(mask2, flags); m_playerData.WriteUpdate(buffer, mask2, true, this, target); @@ -7510,7 +7510,7 @@ namespace Game.Entities void BuildValuesUpdateForPlayerWithMask(UpdateData data, UpdateMask requestedObjectMask, UpdateMask requestedUnitMask, UpdateMask requestedPlayerMask, UpdateMask requestedActivePlayerMask, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - UpdateMask valuesMask = new UpdateMask((int)TypeId.Max); + UpdateMask valuesMask = new((int)TypeId.Max); if (requestedObjectMask.IsAnySet()) valuesMask.Set((int)TypeId.Object); @@ -7525,7 +7525,7 @@ namespace Game.Entities if (target == this && requestedActivePlayerMask.IsAnySet()) valuesMask.Set((int)TypeId.ActivePlayer); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(valuesMask.GetBlock(0)); if (valuesMask[(int)TypeId.Object]) @@ -7540,7 +7540,7 @@ namespace Game.Entities if (valuesMask[(int)TypeId.ActivePlayer]) m_activePlayerData.WriteUpdate(buffer, requestedActivePlayerMask, true, this, target); - WorldPacket buffer1 = new WorldPacket(); + WorldPacket buffer1 = new(); buffer1.WriteUInt8((byte)UpdateType.Values); buffer1.WritePackedGuid(GetGUID()); buffer1.WriteUInt32(buffer.GetSize()); diff --git a/Source/Game/Entities/Player/PlayerTaxi.cs b/Source/Game/Entities/Player/PlayerTaxi.cs index 88c1625b5..4b648d21d 100644 --- a/Source/Game/Entities/Player/PlayerTaxi.cs +++ b/Source/Game/Entities/Player/PlayerTaxi.cs @@ -28,7 +28,7 @@ namespace Game.Entities public class PlayerTaxi { public byte[] m_taximask = new byte[PlayerConst.TaxiMaskSize]; - List m_TaxiDestinations = new List(); + List m_TaxiDestinations = new(); uint m_flightMasterFactionId; public void InitTaxiNodesForLevel(Race race, Class chrClass, uint level) @@ -174,7 +174,7 @@ namespace Game.Entities if (m_TaxiDestinations.Empty()) return ""; - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); ss.Append($"{m_flightMasterFactionId} "); for (int i = 0; i < m_TaxiDestinations.Count; ++i) diff --git a/Source/Game/Entities/Player/SceneMgr.cs b/Source/Game/Entities/Player/SceneMgr.cs index b679c75e5..cc272ddcc 100644 --- a/Source/Game/Entities/Player/SceneMgr.cs +++ b/Source/Game/Entities/Player/SceneMgr.cs @@ -26,7 +26,7 @@ namespace Game.Entities public class SceneMgr { Player _player; - Dictionary _scenesByInstance = new Dictionary(); + Dictionary _scenesByInstance = new(); uint _standaloneSceneInstanceID; bool _isDebuggingScenes; @@ -61,7 +61,7 @@ namespace Game.Entities if (_isDebuggingScenes) GetPlayer().SendSysMessage(CypherStrings.CommandSceneDebugPlay, sceneInstanceID, sceneTemplate.ScenePackageId, sceneTemplate.PlaybackFlags); - PlayScene playScene = new PlayScene(); + PlayScene playScene = new(); playScene.SceneID = sceneTemplate.SceneId; playScene.PlaybackFlags = (uint)sceneTemplate.PlaybackFlags; playScene.SceneInstanceID = sceneInstanceID; @@ -81,7 +81,7 @@ namespace Game.Entities public uint PlaySceneByPackageId(uint sceneScriptPackageId, SceneFlags playbackflags = SceneFlags.Unk16, Position position = null) { - SceneTemplate sceneTemplate = new SceneTemplate(); + SceneTemplate sceneTemplate = new(); sceneTemplate.SceneId = 0; sceneTemplate.ScenePackageId = sceneScriptPackageId; sceneTemplate.PlaybackFlags = playbackflags; @@ -96,7 +96,7 @@ namespace Game.Entities if (removeFromMap) RemoveSceneInstanceId(sceneInstanceID); - CancelScene cancelScene = new CancelScene(); + CancelScene cancelScene = new(); cancelScene.SceneInstanceID = sceneInstanceID; GetPlayer().SendPacket(cancelScene); } @@ -174,7 +174,7 @@ namespace Game.Entities public void CancelSceneBySceneId(uint sceneId) { - List instancesIds = new List(); + List instancesIds = new(); foreach (var pair in _scenesByInstance) if (pair.Value.SceneId == sceneId) @@ -186,7 +186,7 @@ namespace Game.Entities public void CancelSceneByPackageId(uint sceneScriptPackageId) { - List instancesIds = new List(); + List instancesIds = new(); foreach (var sceneTemplate in _scenesByInstance) if (sceneTemplate.Value.ScenePackageId == sceneScriptPackageId) diff --git a/Source/Game/Entities/Player/SocialMgr.cs b/Source/Game/Entities/Player/SocialMgr.cs index e52b745f6..319064609 100644 --- a/Source/Game/Entities/Player/SocialMgr.cs +++ b/Source/Game/Entities/Player/SocialMgr.cs @@ -26,7 +26,7 @@ namespace Game.Entities { public class SocialManager : Singleton { - Dictionary _socialMap = new Dictionary(); + Dictionary _socialMap = new(); SocialManager() { } @@ -83,10 +83,10 @@ namespace Game.Entities public void SendFriendStatus(Player player, FriendsResult result, ObjectGuid friendGuid, bool broadcast = false) { - FriendInfo fi = new FriendInfo(); + FriendInfo fi = new(); GetFriendInfo(player, friendGuid, fi); - FriendStatusPkt friendStatus = new FriendStatusPkt(); + FriendStatusPkt friendStatus = new(); friendStatus.Initialize(friendGuid, result, fi); if (broadcast) @@ -125,7 +125,7 @@ namespace Game.Entities public PlayerSocial LoadFromDB(SQLResult result, ObjectGuid guid) { - PlayerSocial social = new PlayerSocial(); + PlayerSocial social = new(); social.SetPlayerGUID(guid); if (!result.IsEmpty()) @@ -151,7 +151,7 @@ namespace Game.Entities public class PlayerSocial { - public Dictionary _playerSocialMap = new Dictionary(); + public Dictionary _playerSocialMap = new(); ObjectGuid m_playerGUID; uint GetNumberOfSocialsWithFlag(SocialFlag flag) @@ -183,7 +183,7 @@ namespace Game.Entities } else { - FriendInfo fi = new FriendInfo(); + FriendInfo fi = new(); fi.Flags |= flag; _playerSocialMap[friendGuid] = fi; @@ -242,7 +242,7 @@ namespace Game.Entities if (!player) return; - ContactList contactList = new ContactList(); + ContactList contactList = new(); contactList.Flags = flags; foreach (var v in _playerSocialMap) diff --git a/Source/Game/Entities/Player/TradeData.cs b/Source/Game/Entities/Player/TradeData.cs index 10bdec649..9be0bee89 100644 --- a/Source/Game/Entities/Player/TradeData.cs +++ b/Source/Game/Entities/Player/TradeData.cs @@ -115,7 +115,7 @@ namespace Game.Entities if (!m_player.HasEnoughMoney(money)) { - TradeStatusPkt info = new TradeStatusPkt(); + TradeStatusPkt info = new(); info.Status = TradeStatus.Failed; info.BagResult = InventoryResult.NotEnoughMoney; m_player.GetSession().SendTradeStatus(info); @@ -145,7 +145,7 @@ namespace Game.Entities if (!state) { - TradeStatusPkt info = new TradeStatusPkt(); + TradeStatusPkt info = new(); info.Status = TradeStatus.Unaccepted; if (crosssend) m_trader.GetSession().SendTradeStatus(info); diff --git a/Source/Game/Entities/StatSystem.cs b/Source/Game/Entities/StatSystem.cs index 5f056db46..66f7bfe0d 100644 --- a/Source/Game/Entities/StatSystem.cs +++ b/Source/Game/Entities/StatSystem.cs @@ -608,7 +608,7 @@ namespace Game.Entities if (IsInWorld) { - PowerUpdate packet = new PowerUpdate(); + PowerUpdate packet = new(); packet.Guid = GetGUID(); packet.Powers.Add(new PowerUpdatePower(val, (byte)powerType)); SendMessageToSet(packet, IsTypeId(TypeId.Player)); diff --git a/Source/Game/Entities/Taxi/TaxiPathGraph.cs b/Source/Game/Entities/Taxi/TaxiPathGraph.cs index 903872758..d02f26acc 100644 --- a/Source/Game/Entities/Taxi/TaxiPathGraph.cs +++ b/Source/Game/Entities/Taxi/TaxiPathGraph.cs @@ -28,8 +28,8 @@ namespace Game.Entities public class TaxiPathGraph : Singleton { EdgeWeightedDigraph m_graph; - List m_nodesByVertex = new List(); - Dictionary m_verticesByNode = new Dictionary(); + List m_nodesByVertex = new(); + Dictionary m_verticesByNode = new(); TaxiPathGraph() { } @@ -38,7 +38,7 @@ namespace Game.Entities if (m_graph != null) return; - List, uint>> edges = new List, uint>>(); + List, uint>> edges = new(); // Initialize here foreach (TaxiPathRecord path in CliDB.TaxiPathStorage.Values) @@ -148,7 +148,7 @@ namespace Game.Entities { shortestPath.Clear(); // We want to use Dijkstra on this graph - DijkstraShortestPath g = new DijkstraShortestPath(m_graph, (int)GetVertexIDFromNodeID(from)); + DijkstraShortestPath g = new(m_graph, (int)GetVertexIDFromNodeID(from)); var path = g.PathTo((int)GetVertexIDFromNodeID(to)); // found a path to the goal shortestPath.Add(from.Id); @@ -175,7 +175,7 @@ namespace Game.Entities //todo test me public void GetReachableNodesMask(TaxiNodesRecord from, byte[] mask) { - DepthFirstSearch depthFirst = new DepthFirstSearch(m_graph, GetVertexIDFromNodeID(from), vertex => + DepthFirstSearch depthFirst = new(m_graph, GetVertexIDFromNodeID(from), vertex => { TaxiNodesRecord taxiNode = CliDB.TaxiNodesStorage.LookupByKey(GetNodeIDFromVertexID(vertex)); if (taxiNode != null) diff --git a/Source/Game/Entities/TemporarySummon.cs b/Source/Game/Entities/TemporarySummon.cs index 965f70569..d20425979 100644 --- a/Source/Game/Entities/TemporarySummon.cs +++ b/Source/Game/Entities/TemporarySummon.cs @@ -238,7 +238,7 @@ namespace Game.Entities { if (msTime != 0) { - ForcedUnsummonDelayEvent pEvent = new ForcedUnsummonDelayEvent(this); + ForcedUnsummonDelayEvent pEvent = new(this); m_Events.AddEvent(pEvent, m_Events.CalculateTime(msTime)); return; diff --git a/Source/Game/Entities/Totem.cs b/Source/Game/Entities/Totem.cs index ad3d019b1..ddc0ff289 100644 --- a/Source/Game/Entities/Totem.cs +++ b/Source/Game/Entities/Totem.cs @@ -58,7 +58,7 @@ namespace Game.Entities { if (m_Properties.Slot >= (int)SummonSlot.Totem && m_Properties.Slot < SharedConst.MaxTotemSlot) { - TotemCreated packet = new TotemCreated(); + TotemCreated packet = new(); packet.Totem = GetGUID(); packet.Slot = (byte)(m_Properties.Slot - (int)SummonSlot.Totem); packet.Duration = duration; diff --git a/Source/Game/Entities/Transport.cs b/Source/Game/Entities/Transport.cs index 1b450a330..ba7a61c37 100644 --- a/Source/Game/Entities/Transport.cs +++ b/Source/Game/Entities/Transport.cs @@ -512,7 +512,7 @@ namespace Game.Entities public void UpdatePosition(float x, float y, float z, float o) { bool newActive = GetMap().IsGridLoaded(x, y); - Cell oldCell = new Cell(GetPositionX(), GetPositionY()); + Cell oldCell = new(GetPositionX(), GetPositionY()); Relocate(x, y, z, o); StationaryPosition.SetOrientation(o); @@ -796,7 +796,7 @@ namespace Game.Entities KeyFrame _currentFrame; int _nextFrame; - TimeTrackerSmall _positionChangeTimer = new TimeTrackerSmall(); + TimeTrackerSmall _positionChangeTimer = new(); bool _isMoving; bool _pendingStop; @@ -804,8 +804,8 @@ namespace Game.Entities bool _triggeredArrivalEvent; bool _triggeredDepartureEvent; - HashSet _passengers = new HashSet(); - HashSet _staticPassengers = new HashSet(); + HashSet _passengers = new(); + HashSet _staticPassengers = new(); bool _delayedAddModel; bool _delayedTeleport; diff --git a/Source/Game/Entities/Unit/Unit.Combat.cs b/Source/Game/Entities/Unit/Unit.Combat.cs index 64d4f6c2c..b785f752b 100644 --- a/Source/Game/Entities/Unit/Unit.Combat.cs +++ b/Source/Game/Entities/Unit/Unit.Combat.cs @@ -62,14 +62,14 @@ namespace Game.Entities { if (!GetThreatManager().IsThreatListEmpty()) { - HighestThreatUpdate packet = new HighestThreatUpdate(); + HighestThreatUpdate packet = new(); packet.UnitGUID = GetGUID(); packet.HighestThreatGUID = pHostileReference.GetUnitGuid(); var refeList = GetThreatManager().GetThreatList(); foreach (var refe in refeList) { - ThreatInfo info = new ThreatInfo(); + ThreatInfo info = new(); info.UnitGUID = refe.GetUnitGuid(); info.Threat = (long)refe.GetThreat() * 100; packet.ThreatList.Add(info); @@ -127,14 +127,14 @@ namespace Game.Entities public void SendClearThreatList() { - ThreatClear packet = new ThreatClear(); + ThreatClear packet = new(); packet.UnitGUID = GetGUID(); SendMessageToSet(packet, false); } public void SendRemoveFromThreatList(HostileReference pHostileReference) { - ThreatRemove packet = new ThreatRemove(); + ThreatRemove packet = new(); packet.UnitGUID = GetGUID(); packet.AboutGUID = pHostileReference.GetUnitGuid(); SendMessageToSet(packet, false); @@ -144,12 +144,12 @@ namespace Game.Entities { if (!GetThreatManager().IsThreatListEmpty()) { - ThreatUpdate packet = new ThreatUpdate(); + ThreatUpdate packet = new(); packet.UnitGUID = GetGUID(); var tlist = GetThreatManager().GetThreatList(); foreach (var refe in tlist) { - ThreatInfo info = new ThreatInfo(); + ThreatInfo info = new(); info.UnitGUID = refe.GetUnitGuid(); info.Threat = (long)refe.GetThreat() * 100; packet.ThreatList.Add(info); @@ -224,7 +224,7 @@ namespace Game.Entities public void ValidateAttackersAndOwnTarget() { // iterate attackers - List toRemove = new List(); + List toRemove = new(); foreach (Unit attacker in GetAttackers()) if (!attacker.IsValidAttackTarget(this)) toRemove.Add(attacker); @@ -490,7 +490,7 @@ namespace Game.Entities } public void SendMeleeAttackStart(Unit victim) { - AttackStart packet = new AttackStart(); + AttackStart packet = new(); packet.Attacker = GetGUID(); packet.Victim = victim.GetGUID(); SendMessageToSet(packet, true); @@ -682,7 +682,7 @@ namespace Game.Entities DealMeleeDamage(damageInfo, true); - DamageInfo dmgInfo = new DamageInfo(damageInfo); + DamageInfo dmgInfo = new(damageInfo); ProcSkillsAndAuras(damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, ProcFlagsSpellType.None, ProcFlagsSpellPhase.None, dmgInfo.GetHitMask(), null, dmgInfo, null); Log.outDebug(LogFilter.Unit, "AttackerStateUpdate: {0} attacked {1} for {2} dmg, absorbed {3}, blocked {4}, resisted {5}.", GetGUID().ToString(), victim.GetGUID().ToString(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist); @@ -720,7 +720,7 @@ namespace Game.Entities if (IsTypeId(TypeId.Unit) && !HasUnitFlag(UnitFlags.PlayerControlled)) SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells) - CalcDamageInfo damageInfo = new CalcDamageInfo(); + CalcDamageInfo damageInfo = new(); damageInfo.attacker = this; damageInfo.target = victim; damageInfo.damageSchoolMask = (uint)GetMeleeDamageSchoolMask(); @@ -873,7 +873,7 @@ namespace Game.Entities } // Call default DealDamage - CleanDamage cleanDamage = new CleanDamage(damageInfo.cleanDamage, damageInfo.absorb, damageInfo.attackType, damageInfo.hitOutCome); + CleanDamage cleanDamage = new(damageInfo.cleanDamage, damageInfo.absorb, damageInfo.attackType, damageInfo.hitOutCome); DealDamage(victim, damageInfo.damage, cleanDamage, DamageEffectType.Direct, (SpellSchoolMask)damageInfo.damageSchoolMask, null, durabilityLoss); // If this is a creature and it attacks from behind it has a probability to daze it's victim @@ -902,7 +902,7 @@ namespace Game.Entities if (IsTypeId(TypeId.Player)) { - DamageInfo dmgInfo = new DamageInfo(damageInfo); + DamageInfo dmgInfo = new(damageInfo); ToPlayer().CastItemCombatSpell(dmgInfo); } @@ -939,13 +939,13 @@ namespace Game.Entities damage = SpellDamageBonusTaken(caster, spellInfo, damage, DamageEffectType.SpellDirect, dmgShield.GetSpellEffectInfo()); } - DamageInfo damageInfo1 = new DamageInfo(this, victim, damage, spellInfo, spellInfo.GetSchoolMask(), DamageEffectType.SpellDirect, WeaponAttackType.BaseAttack); + DamageInfo damageInfo1 = new(this, victim, damage, spellInfo, spellInfo.GetSchoolMask(), DamageEffectType.SpellDirect, WeaponAttackType.BaseAttack); victim.CalcAbsorbResist(damageInfo1); damage = damageInfo1.GetDamage(); victim.DealDamageMods(this, ref damage); - SpellDamageShield damageShield = new SpellDamageShield(); + SpellDamageShield damageShield = new(); damageShield.Attacker = victim.GetGUID(); damageShield.Defender = GetGUID(); damageShield.SpellID = spellInfo.Id; @@ -1249,7 +1249,7 @@ namespace Game.Entities if (dVal < 0) { - HealthUpdate packet = new HealthUpdate(); + HealthUpdate packet = new(); packet.Guid = GetGUID(); packet.Health = (long)GetHealth(); @@ -1287,7 +1287,7 @@ namespace Game.Entities public void SendAttackStateUpdate(HitInfo HitInfo, Unit target, SpellSchoolMask damageSchoolMask, uint Damage, uint AbsorbDamage, uint Resist, VictimState TargetState, uint BlockedAmount) { - CalcDamageInfo dmgInfo = new CalcDamageInfo(); + CalcDamageInfo dmgInfo = new(); dmgInfo.HitInfo = HitInfo; dmgInfo.attacker = this; dmgInfo.target = target; @@ -1302,7 +1302,7 @@ namespace Game.Entities } public void SendAttackStateUpdate(CalcDamageInfo damageInfo) { - AttackerStateUpdate packet = new AttackerStateUpdate(); + AttackerStateUpdate packet = new(); packet.hitInfo = damageInfo.HitInfo; packet.AttackerGUID = damageInfo.attacker.GetGUID(); packet.VictimGUID = damageInfo.target.GetGUID(); @@ -1311,7 +1311,7 @@ namespace Game.Entities int overkill = (int)(damageInfo.damage - damageInfo.target.GetHealth()); packet.OverDamage = (overkill < 0 ? -1 : overkill); - SubDamage subDmg = new SubDamage(); + SubDamage subDmg = new(); subDmg.SchoolMask = (int)damageInfo.damageSchoolMask; // School of sub damage subDmg.FDamage = damageInfo.damage; // sub damage subDmg.Damage = (int)damageInfo.damage; // Sub Damage @@ -1323,7 +1323,7 @@ namespace Game.Entities packet.BlockAmount = (int)damageInfo.blocked_amount; packet.LogData.Initialize(damageInfo.attacker); - ContentTuningParams contentTuningParams = new ContentTuningParams(); + ContentTuningParams contentTuningParams = new(); if (contentTuningParams.GenerateDataForUnits(damageInfo.attacker, damageInfo.target)) packet.ContentTuning = contentTuningParams; @@ -1431,7 +1431,7 @@ namespace Game.Entities internal void SendCombatLogMessage(CombatLogServerPacket combatLog) { - CombatLogSender notifier = new CombatLogSender(this, combatLog, GetVisibilityRange()); + CombatLogSender notifier = new(this, combatLog, GetVisibilityRange()); Cell.VisitWorldObjects(this, notifier, GetVisibilityRange()); } @@ -1464,7 +1464,7 @@ namespace Game.Entities // call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop) if (isRewardAllowed && player != null && player != victim) { - PartyKillLog partyKillLog = new PartyKillLog(); + PartyKillLog partyKillLog = new(); partyKillLog.Player = player.GetGUID(); partyKillLog.Victim = victim.GetGUID(); @@ -1495,7 +1495,7 @@ namespace Game.Entities if (creature != null) { - LootList lootList = new LootList(); + LootList lootList = new(); lootList.Owner = creature.GetGUID(); lootList.LootObj = creature.loot.GetGUID(); player.SendMessageToSet(lootList, true); @@ -1800,7 +1800,7 @@ namespace Game.Entities return IsWithinDistInMap(pet, radius) ? pet : null; } - List nearMembers = new List(); + List nearMembers = new(); // reserve place for players and pets because resizing vector every unit push is unefficient (vector is reallocated then) for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next()) @@ -2021,7 +2021,7 @@ namespace Game.Entities { damageInfo.procVictim |= ProcFlags.TakenDamage; // Calculate absorb & resists - DamageInfo dmgInfo = new DamageInfo(damageInfo); + DamageInfo dmgInfo = new(damageInfo); CalcAbsorbResist(dmgInfo); damageInfo.absorb = dmgInfo.GetAbsorb(); damageInfo.resist = dmgInfo.GetResist(); @@ -2636,8 +2636,8 @@ namespace Game.Entities uint split_absorb = 0; DealDamageMods(caster, ref splitDamage, ref split_absorb); - SpellNonMeleeDamage log = new SpellNonMeleeDamage(this, caster, itr.GetSpellInfo(), itr.GetBase().GetSpellVisual(), damageInfo.GetSchoolMask(), itr.GetBase().GetCastGUID()); - CleanDamage cleanDamage = new CleanDamage(splitDamage, 0, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal); + SpellNonMeleeDamage log = new(this, caster, itr.GetSpellInfo(), itr.GetBase().GetSpellVisual(), damageInfo.GetSchoolMask(), itr.GetBase().GetCastGUID()); + CleanDamage cleanDamage = new(splitDamage, 0, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal); DealDamage(caster, splitDamage, cleanDamage, DamageEffectType.Direct, damageInfo.GetSchoolMask(), itr.GetSpellInfo(), false); log.damage = splitDamage; log.originalDamage = splitDamage; diff --git a/Source/Game/Entities/Unit/Unit.Fields.cs b/Source/Game/Entities/Unit/Unit.Fields.cs index 7b36edfb6..eb55a6dc1 100644 --- a/Source/Game/Entities/Unit/Unit.Fields.cs +++ b/Source/Game/Entities/Unit/Unit.Fields.cs @@ -49,8 +49,8 @@ namespace Game.Entities MovementForces _movementForces; //Combat - protected List attackerList = new List(); - Dictionary m_reactiveTimer = new Dictionary(); + protected List attackerList = new(); + Dictionary m_reactiveTimer = new(); protected float[][] m_weaponDamage = new float[(int)WeaponAttackType.Max][]; public float[] m_threatModifier = new float[(int)SpellSchools.Max]; @@ -73,8 +73,8 @@ namespace Game.Entities public uint ExtraAttacks { get; set; } //Charm - public List m_Controlled = new List(); - List m_sharedVision = new List(); + public List m_Controlled = new(); + List m_sharedVision = new(); CharmInfo m_charmInfo; protected bool m_ControlledByPlayer; public ObjectGuid LastCharmerGUID { get; set; } @@ -83,8 +83,8 @@ namespace Game.Entities bool _isWalkingBeforeCharm; // Are we walking before we were charmed? //Spells - protected Dictionary m_currentSpells = new Dictionary((int)CurrentSpellTypes.Max); - Dictionary CustomSpellValueMod = new Dictionary(); + protected Dictionary m_currentSpells = new((int)CurrentSpellTypes.Max); + Dictionary CustomSpellValueMod = new(); MultiMap[] m_spellImmune = new MultiMap[(int)SpellImmunity.Max]; uint[] m_interruptMask = new uint[2]; protected int m_procDeep; @@ -92,16 +92,16 @@ namespace Game.Entities SpellHistory _spellHistory; //Auras - List AuraEffectList = new List(); - MultiMap m_modAuras = new MultiMap(); - List m_removedAuras = new List(); - List m_interruptableAuras = new List(); // auras which have interrupt mask applied on unit - MultiMap m_auraStateAuras = new MultiMap(); // Used for improve performance of aura state checks on aura apply/remove - SortedSet m_visibleAuras = new SortedSet(new VisibleAuraSlotCompare()); - SortedSet m_visibleAurasToUpdate = new SortedSet(new VisibleAuraSlotCompare()); - MultiMap m_appliedAuras = new MultiMap(); - MultiMap m_ownedAuras = new MultiMap(); - List m_scAuras = new List(); + List AuraEffectList = new(); + MultiMap m_modAuras = new(); + List m_removedAuras = new(); + List m_interruptableAuras = new(); // auras which have interrupt mask applied on unit + MultiMap m_auraStateAuras = new(); // Used for improve performance of aura state checks on aura apply/remove + SortedSet m_visibleAuras = new(new VisibleAuraSlotCompare()); + SortedSet m_visibleAurasToUpdate = new(new VisibleAuraSlotCompare()); + MultiMap m_appliedAuras = new(); + MultiMap m_ownedAuras = new(); + List m_scAuras = new(); protected float[][] m_auraFlatModifiersGroup = new float[(int)UnitMods.End][]; protected float[][] m_auraPctModifiersGroup = new float[(int)UnitMods.End][]; uint m_removedAurasCount; @@ -110,15 +110,15 @@ namespace Game.Entities public UnitData m_unitData; DiminishingReturn[] m_Diminishing = new DiminishingReturn[(int)DiminishingGroup.Max]; - protected List m_gameObj = new List(); - List m_areaTrigger = new List(); - protected List m_dynObj = new List(); + protected List m_gameObj = new(); + List m_areaTrigger = new(); + protected List m_dynObj = new(); protected float[] CreateStats = new float[(int)Stats.Max]; float[] m_floatStatPosBuff = new float[(int)Stats.Max]; float[] m_floatStatNegBuff = new float[(int)Stats.Max]; public ObjectGuid[] m_SummonSlot = new ObjectGuid[7]; public ObjectGuid[] m_ObjectSlot = new ObjectGuid[4]; - public EventSystem m_Events = new EventSystem(); + public EventSystem m_Events = new(); public UnitTypeMask UnitTypeMask { get; set; } UnitState m_state; protected LiquidTypeRecord _lastLiquid; @@ -573,7 +573,7 @@ namespace Game.Entities public class DeclinedName { - public StringArray name = new StringArray(SharedConst.MaxDeclinedNameCases); + public StringArray name = new(SharedConst.MaxDeclinedNameCases); } class CombatLogSender : Notifier diff --git a/Source/Game/Entities/Unit/Unit.Movement.cs b/Source/Game/Entities/Unit/Unit.Movement.cs index dda985d8c..a8ac01360 100644 --- a/Source/Game/Entities/Unit/Unit.Movement.cs +++ b/Source/Game/Entities/Unit/Unit.Movement.cs @@ -124,21 +124,21 @@ namespace Game.Entities if (playerMover) { // Send notification to self - MoveSetSpeed selfpacket = new MoveSetSpeed(moveTypeToOpcode[(int)mtype, 1]); + MoveSetSpeed selfpacket = new(moveTypeToOpcode[(int)mtype, 1]); selfpacket.MoverGUID = GetGUID(); selfpacket.SequenceIndex = m_movementCounter++; selfpacket.Speed = GetSpeed(mtype); playerMover.SendPacket(selfpacket); // Send notification to other players - MoveUpdateSpeed packet = new MoveUpdateSpeed(moveTypeToOpcode[(int)mtype, 2]); + MoveUpdateSpeed packet = new(moveTypeToOpcode[(int)mtype, 2]); packet.Status = m_movementInfo; packet.Speed = GetSpeed(mtype); playerMover.SendMessageToSet(packet, false); } else { - MoveSplineSetSpeed packet = new MoveSplineSetSpeed(moveTypeToOpcode[(int)mtype, 0]); + MoveSplineSetSpeed packet = new(moveTypeToOpcode[(int)mtype, 0]); packet.MoverGUID = GetGUID(); packet.Speed = GetSpeed(mtype); SendMessageToSet(packet, true); @@ -155,7 +155,7 @@ namespace Game.Entities if (!IsInWorld || MoveSpline.Finalized()) return; - MoveSplineInit init = new MoveSplineInit(this); + MoveSplineInit init = new(this); init.Stop(); } @@ -194,7 +194,7 @@ namespace Game.Entities if (!force && (!IsStopped() || !MoveSpline.Finalized())) return; - MoveSplineInit init = new MoveSplineInit(this); + MoveSplineInit init = new(this); init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZMinusOffset(), false); init.SetFacing(ori); init.Launch(); @@ -212,7 +212,7 @@ namespace Game.Entities public void MonsterMoveWithSpeed(float x, float y, float z, float speed, bool generatePath = false, bool forceDestination = false) { - MoveSplineInit init = new MoveSplineInit(this); + MoveSplineInit init = new(this); init.MoveTo(x, y, z, generatePath, forceDestination); init.SetVelocity(speed); init.Launch(); @@ -244,7 +244,7 @@ namespace Game.Entities void SendMoveKnockBack(Player player, float speedXY, float speedZ, float vcos, float vsin) { - MoveKnockBack moveKnockBack = new MoveKnockBack(); + MoveKnockBack moveKnockBack = new(); moveKnockBack.MoverGUID = GetGUID(); moveKnockBack.SequenceIndex = m_movementCounter++; moveKnockBack.Speeds.HorzSpeed = speedXY; @@ -266,18 +266,18 @@ namespace Game.Entities Player playerMover = GetPlayerBeingMoved(); if (playerMover) { - MoveSetFlag packet = new MoveSetFlag(disable ? ServerOpcodes.MoveSplineEnableCollision : ServerOpcodes.MoveEnableCollision); + MoveSetFlag packet = new(disable ? ServerOpcodes.MoveSplineEnableCollision : ServerOpcodes.MoveEnableCollision); packet.MoverGUID = GetGUID(); packet.SequenceIndex = m_movementCounter++; playerMover.SendPacket(packet); - MoveUpdate moveUpdate = new MoveUpdate(); + MoveUpdate moveUpdate = new(); moveUpdate.Status = m_movementInfo; SendMessageToSet(moveUpdate, playerMover); } else { - MoveSplineSetFlag packet = new MoveSplineSetFlag(disable ? ServerOpcodes.MoveSplineDisableCollision : ServerOpcodes.MoveDisableCollision); + MoveSplineSetFlag packet = new(disable ? ServerOpcodes.MoveSplineDisableCollision : ServerOpcodes.MoveDisableCollision); packet.MoverGUID = GetGUID(); SendMessageToSet(packet, true); } @@ -301,12 +301,12 @@ namespace Game.Entities Player playerMover = GetPlayerBeingMoved(); if (playerMover) { - MoveSetFlag packet = new MoveSetFlag(enable ? ServerOpcodes.MoveEnableTransitionBetweenSwimAndFly : ServerOpcodes.MoveDisableTransitionBetweenSwimAndFly); + MoveSetFlag packet = new(enable ? ServerOpcodes.MoveEnableTransitionBetweenSwimAndFly : ServerOpcodes.MoveDisableTransitionBetweenSwimAndFly); packet.MoverGUID = GetGUID(); packet.SequenceIndex = m_movementCounter++; playerMover.SendPacket(packet); - MoveUpdate moveUpdate = new MoveUpdate(); + MoveUpdate moveUpdate = new(); moveUpdate.Status = m_movementInfo; SendMessageToSet(moveUpdate, playerMover); } @@ -327,12 +327,12 @@ namespace Game.Entities Player playerMover = GetPlayerBeingMoved(); if (playerMover) { - MoveSetFlag packet = new MoveSetFlag(enable ? ServerOpcodes.MoveSetCanTurnWhileFalling : ServerOpcodes.MoveUnsetCanTurnWhileFalling); + MoveSetFlag packet = new(enable ? ServerOpcodes.MoveSetCanTurnWhileFalling : ServerOpcodes.MoveUnsetCanTurnWhileFalling); packet.MoverGUID = GetGUID(); packet.SequenceIndex = m_movementCounter++; playerMover.SendPacket(packet); - MoveUpdate moveUpdate = new MoveUpdate(); + MoveUpdate moveUpdate = new(); moveUpdate.Status = m_movementInfo; SendMessageToSet(moveUpdate, playerMover); } @@ -353,12 +353,12 @@ namespace Game.Entities Player playerMover = GetPlayerBeingMoved(); if (playerMover) { - MoveSetFlag packet = new MoveSetFlag(enable ? ServerOpcodes.MoveEnableDoubleJump : ServerOpcodes.MoveDisableDoubleJump); + MoveSetFlag packet = new(enable ? ServerOpcodes.MoveEnableDoubleJump : ServerOpcodes.MoveDisableDoubleJump); packet.MoverGUID = GetGUID(); packet.SequenceIndex = m_movementCounter++; playerMover.SendPacket(packet); - MoveUpdate moveUpdate = new MoveUpdate(); + MoveUpdate moveUpdate = new(); moveUpdate.Status = m_movementInfo; SendMessageToSet(moveUpdate, playerMover); } @@ -653,18 +653,18 @@ namespace Game.Entities Player playerMover = GetPlayerBeingMoved(); if (playerMover) { - MoveSetFlag packet = new MoveSetFlag(disable ? ServerOpcodes.MoveDisableGravity : ServerOpcodes.MoveEnableGravity); + MoveSetFlag packet = new(disable ? ServerOpcodes.MoveDisableGravity : ServerOpcodes.MoveEnableGravity); packet.MoverGUID = GetGUID(); packet.SequenceIndex = m_movementCounter++; playerMover.SendPacket(packet); - MoveUpdate moveUpdate = new MoveUpdate(); + MoveUpdate moveUpdate = new(); moveUpdate.Status = m_movementInfo; SendMessageToSet(moveUpdate, playerMover); } else { - MoveSplineSetFlag packet = new MoveSplineSetFlag(disable ? ServerOpcodes.MoveSplineDisableGravity : ServerOpcodes.MoveSplineEnableGravity); + MoveSplineSetFlag packet = new(disable ? ServerOpcodes.MoveSplineDisableGravity : ServerOpcodes.MoveSplineEnableGravity); packet.MoverGUID = GetGUID(); SendMessageToSet(packet, true); } @@ -824,7 +824,7 @@ namespace Game.Entities else RemoveUnitMovementFlag(MovementFlag.Walking); - MoveSplineSetFlag packet = new MoveSplineSetFlag(enable ? ServerOpcodes.MoveSplineSetWalkMode : ServerOpcodes.MoveSplineSetRunMode); + MoveSplineSetFlag packet = new(enable ? ServerOpcodes.MoveSplineSetWalkMode : ServerOpcodes.MoveSplineSetRunMode); packet.MoverGUID = GetGUID(); SendMessageToSet(packet, true); return true; @@ -856,7 +856,7 @@ namespace Game.Entities else RemoveUnitMovementFlag(MovementFlag.Swimming); - MoveSplineSetFlag packet = new MoveSplineSetFlag(enable ? ServerOpcodes.MoveSplineStartSwim : ServerOpcodes.MoveSplineStopSwim); + MoveSplineSetFlag packet = new(enable ? ServerOpcodes.MoveSplineStartSwim : ServerOpcodes.MoveSplineStopSwim); packet.MoverGUID = GetGUID(); SendMessageToSet(packet, true); @@ -882,18 +882,18 @@ namespace Game.Entities Player playerMover = GetPlayerBeingMoved(); if (playerMover) { - MoveSetFlag packet = new MoveSetFlag(enable ? ServerOpcodes.MoveSetCanFly : ServerOpcodes.MoveUnsetCanFly); + MoveSetFlag packet = new(enable ? ServerOpcodes.MoveSetCanFly : ServerOpcodes.MoveUnsetCanFly); packet.MoverGUID = GetGUID(); packet.SequenceIndex = m_movementCounter++; playerMover.SendPacket(packet); - MoveUpdate moveUpdate = new MoveUpdate(); + MoveUpdate moveUpdate = new(); moveUpdate.Status = m_movementInfo; SendMessageToSet(moveUpdate, playerMover); } else { - MoveSplineSetFlag packet = new MoveSplineSetFlag(enable ? ServerOpcodes.MoveSplineSetFlying : ServerOpcodes.MoveSplineUnsetFlying); + MoveSplineSetFlag packet = new(enable ? ServerOpcodes.MoveSplineSetFlying : ServerOpcodes.MoveSplineUnsetFlying); packet.MoverGUID = GetGUID(); SendMessageToSet(packet, true); } @@ -915,18 +915,18 @@ namespace Game.Entities Player playerMover = GetPlayerBeingMoved(); if (playerMover) { - MoveSetFlag packet = new MoveSetFlag(enable ? ServerOpcodes.MoveSetWaterWalk : ServerOpcodes.MoveSetLandWalk); + MoveSetFlag packet = new(enable ? ServerOpcodes.MoveSetWaterWalk : ServerOpcodes.MoveSetLandWalk); packet.MoverGUID = GetGUID(); packet.SequenceIndex = m_movementCounter++; playerMover.SendPacket(packet); - MoveUpdate moveUpdate = new MoveUpdate(); + MoveUpdate moveUpdate = new(); moveUpdate.Status = m_movementInfo; SendMessageToSet(moveUpdate, playerMover); } else { - MoveSplineSetFlag packet = new MoveSplineSetFlag(enable ? ServerOpcodes.MoveSplineSetWaterWalk : ServerOpcodes.MoveSplineSetLandWalk); + MoveSplineSetFlag packet = new(enable ? ServerOpcodes.MoveSplineSetWaterWalk : ServerOpcodes.MoveSplineSetLandWalk); packet.MoverGUID = GetGUID(); SendMessageToSet(packet, true); } @@ -947,18 +947,18 @@ namespace Game.Entities Player playerMover = GetPlayerBeingMoved(); if (playerMover) { - MoveSetFlag packet = new MoveSetFlag(enable ? ServerOpcodes.MoveSetFeatherFall : ServerOpcodes.MoveSetNormalFall); + MoveSetFlag packet = new(enable ? ServerOpcodes.MoveSetFeatherFall : ServerOpcodes.MoveSetNormalFall); packet.MoverGUID = GetGUID(); packet.SequenceIndex = m_movementCounter++; playerMover.SendPacket(packet); - MoveUpdate moveUpdate = new MoveUpdate(); + MoveUpdate moveUpdate = new(); moveUpdate.Status = m_movementInfo; SendMessageToSet(moveUpdate, playerMover); } else { - MoveSplineSetFlag packet = new MoveSplineSetFlag(enable ? ServerOpcodes.MoveSplineSetFeatherFall : ServerOpcodes.MoveSplineSetNormalFall); + MoveSplineSetFlag packet = new(enable ? ServerOpcodes.MoveSplineSetFeatherFall : ServerOpcodes.MoveSplineSetNormalFall); packet.MoverGUID = GetGUID(); SendMessageToSet(packet, true); } @@ -993,18 +993,18 @@ namespace Game.Entities Player playerMover = GetPlayerBeingMoved(); if (playerMover) { - MoveSetFlag packet = new MoveSetFlag(enable ? ServerOpcodes.MoveSetHovering : ServerOpcodes.MoveUnsetHovering); + MoveSetFlag packet = new(enable ? ServerOpcodes.MoveSetHovering : ServerOpcodes.MoveUnsetHovering); packet.MoverGUID = GetGUID(); packet.SequenceIndex = m_movementCounter++; playerMover.SendPacket(packet); - MoveUpdate moveUpdate = new MoveUpdate(); + MoveUpdate moveUpdate = new(); moveUpdate.Status = m_movementInfo; SendMessageToSet(moveUpdate, playerMover); } else { - MoveSplineSetFlag packet = new MoveSplineSetFlag(enable ? ServerOpcodes.MoveSplineSetHover : ServerOpcodes.MoveSplineUnsetHover); + MoveSplineSetFlag packet = new(enable ? ServerOpcodes.MoveSplineSetHover : ServerOpcodes.MoveSplineUnsetHover); packet.MoverGUID = GetGUID(); SendMessageToSet(packet, true); } @@ -1050,7 +1050,7 @@ namespace Game.Entities DisableSpline(); if (IsTypeId(TypeId.Player)) { - WorldLocation target = new WorldLocation(GetMapId(), pos); + WorldLocation target = new(GetMapId(), pos); ToPlayer().TeleportTo(target, (TeleportToOptions.NotLeaveTransport | TeleportToOptions.NotLeaveCombat | TeleportToOptions.NotUnSummonPet | (casting ? TeleportToOptions.Spell : 0))); } else @@ -1205,18 +1205,18 @@ namespace Game.Entities Player playerMover = GetPlayerBeingMoved();// unit controlled by a player. if (playerMover) { - MoveSetFlag packet = new MoveSetFlag(apply ? ServerOpcodes.MoveRoot : ServerOpcodes.MoveUnroot); + MoveSetFlag packet = new(apply ? ServerOpcodes.MoveRoot : ServerOpcodes.MoveUnroot); packet.MoverGUID = GetGUID(); packet.SequenceIndex = m_movementCounter++; playerMover.SendPacket(packet); - MoveUpdate moveUpdate = new MoveUpdate(); + MoveUpdate moveUpdate = new(); moveUpdate.Status = m_movementInfo; SendMessageToSet(moveUpdate, playerMover); } else { - MoveSplineSetFlag packet = new MoveSplineSetFlag(apply ? ServerOpcodes.MoveSplineRoot : ServerOpcodes.MoveSplineUnroot); + MoveSplineSetFlag packet = new(apply ? ServerOpcodes.MoveSplineRoot : ServerOpcodes.MoveSplineUnroot); packet.MoverGUID = GetGUID(); SendMessageToSet(packet, true); } @@ -1411,14 +1411,14 @@ namespace Game.Entities Player player = ToPlayer(); if (player) { - MoveSetVehicleRecID moveSetVehicleRec = new MoveSetVehicleRecID(); + MoveSetVehicleRecID moveSetVehicleRec = new(); moveSetVehicleRec.MoverGUID = GetGUID(); moveSetVehicleRec.SequenceIndex = m_movementCounter++; moveSetVehicleRec.VehicleRecID = vehicleId; player.SendPacket(moveSetVehicleRec); } - SetVehicleRecID setVehicleRec = new SetVehicleRecID(); + SetVehicleRecID setVehicleRec = new(); setVehicleRec.VehicleGUID = GetGUID(); setVehicleRec.VehicleRecID = vehicleId; SendMessageToSet(setVehicleRec, true); @@ -1431,7 +1431,7 @@ namespace Game.Entities if (_movementForces == null) _movementForces = new MovementForces(); - MovementForce force = new MovementForce(); + MovementForce force = new(); force.ID = id; force.Origin = origin; force.Direction = direction; @@ -1446,7 +1446,7 @@ namespace Game.Entities Player movingPlayer = GetPlayerMovingMe(); if (movingPlayer != null) { - MoveApplyMovementForce applyMovementForce = new MoveApplyMovementForce(); + MoveApplyMovementForce applyMovementForce = new(); applyMovementForce.MoverGUID = GetGUID(); applyMovementForce.SequenceIndex = (int)m_movementCounter++; applyMovementForce.Force = force; @@ -1454,7 +1454,7 @@ namespace Game.Entities } else { - MoveUpdateApplyMovementForce updateApplyMovementForce = new MoveUpdateApplyMovementForce(); + MoveUpdateApplyMovementForce updateApplyMovementForce = new(); updateApplyMovementForce.Status = m_movementInfo; updateApplyMovementForce.Force = force; SendMessageToSet(updateApplyMovementForce, true); @@ -1472,7 +1472,7 @@ namespace Game.Entities Player movingPlayer = GetPlayerMovingMe(); if (movingPlayer != null) { - MoveRemoveMovementForce moveRemoveMovementForce = new MoveRemoveMovementForce(); + MoveRemoveMovementForce moveRemoveMovementForce = new(); moveRemoveMovementForce.MoverGUID = GetGUID(); moveRemoveMovementForce.SequenceIndex = (int)m_movementCounter++; moveRemoveMovementForce.ID = id; @@ -1480,7 +1480,7 @@ namespace Game.Entities } else { - MoveUpdateRemoveMovementForce updateRemoveMovementForce = new MoveUpdateRemoveMovementForce(); + MoveUpdateRemoveMovementForce updateRemoveMovementForce = new(); updateRemoveMovementForce.Status = m_movementInfo; updateRemoveMovementForce.TriggerGUID = id; SendMessageToSet(updateRemoveMovementForce, true); @@ -1510,12 +1510,12 @@ namespace Game.Entities Player movingPlayer = GetPlayerMovingMe(); if (movingPlayer != null) { - MoveSetFlag packet = new MoveSetFlag(ignoreMovementForcesOpcodeTable[ignore ? 1 : 0]); + MoveSetFlag packet = new(ignoreMovementForcesOpcodeTable[ignore ? 1 : 0]); packet.MoverGUID = GetGUID(); packet.SequenceIndex = m_movementCounter++; movingPlayer.SendPacket(packet); - MoveUpdate moveUpdate = new MoveUpdate(); + MoveUpdate moveUpdate = new(); moveUpdate.Status = m_movementInfo; SendMessageToSet(moveUpdate, movingPlayer); } @@ -1530,7 +1530,7 @@ namespace Game.Entities Player movingPlayer = GetPlayerMovingMe(); if (movingPlayer != null) { - MoveSetSpeed setModMovementForceMagnitude = new MoveSetSpeed(ServerOpcodes.MoveSetModMovementForceMagnitude); + MoveSetSpeed setModMovementForceMagnitude = new(ServerOpcodes.MoveSetModMovementForceMagnitude); setModMovementForceMagnitude.MoverGUID = GetGUID(); setModMovementForceMagnitude.SequenceIndex = m_movementCounter++; setModMovementForceMagnitude.Speed = modMagnitude; @@ -1539,7 +1539,7 @@ namespace Game.Entities } else { - MoveUpdateSpeed updateModMovementForceMagnitude = new MoveUpdateSpeed(ServerOpcodes.MoveUpdateModMovementForceMagnitude); + MoveUpdateSpeed updateModMovementForceMagnitude = new(ServerOpcodes.MoveUpdateModMovementForceMagnitude); updateModMovementForceMagnitude.Status = m_movementInfo; updateModMovementForceMagnitude.Speed = modMagnitude; SendMessageToSet(updateModMovementForceMagnitude, true); @@ -1558,7 +1558,7 @@ namespace Game.Entities void SendSetPlayHoverAnim(bool enable) { - SetPlayHoverAnim data = new SetPlayHoverAnim(); + SetPlayHoverAnim data = new(); data.UnitGUID = GetGUID(); data.PlayHoverAnim = enable; @@ -1701,7 +1701,7 @@ namespace Game.Entities // SMSG_MOVE_UPDATE_TELEPORT is sent to nearby players to signal the teleport // SMSG_MOVE_TELEPORT is sent to self in order to trigger CMSG_MOVE_TELEPORT_ACK and update the position server side - MoveUpdateTeleport moveUpdateTeleport = new MoveUpdateTeleport(); + MoveUpdateTeleport moveUpdateTeleport = new(); moveUpdateTeleport.Status = m_movementInfo; if (_movementForces != null) moveUpdateTeleport.MovementForces = _movementForces.GetForces(); @@ -1717,7 +1717,7 @@ namespace Game.Entities if (transportBase != null) transportBase.CalculatePassengerOffset(ref x, ref y, ref z, ref o); - MoveTeleport moveTeleport = new MoveTeleport(); + MoveTeleport moveTeleport = new(); moveTeleport.MoverGUID = GetGUID(); moveTeleport.Pos = new Position(x, y, z, o); if (GetTransGUID() != ObjectGuid.Empty) diff --git a/Source/Game/Entities/Unit/Unit.Pets.cs b/Source/Game/Entities/Unit/Unit.Pets.cs index cbd96619d..bf2710ec0 100644 --- a/Source/Game/Entities/Unit/Unit.Pets.cs +++ b/Source/Game/Entities/Unit/Unit.Pets.cs @@ -706,7 +706,7 @@ namespace Game.Entities if (!owner || !owner.IsTypeId(TypeId.Player)) return; - PetActionFeedbackPacket petActionFeedback = new PetActionFeedbackPacket(); + PetActionFeedbackPacket petActionFeedback = new(); petActionFeedback.SpellID = spellId; petActionFeedback.Response = msg; owner.ToPlayer().SendPacket(petActionFeedback); @@ -718,7 +718,7 @@ namespace Game.Entities if (!owner || !owner.IsTypeId(TypeId.Player)) return; - PetActionSound petActionSound = new PetActionSound(); + PetActionSound petActionSound = new(); petActionSound.UnitGUID = GetGUID(); petActionSound.Action = pettalk; owner.ToPlayer().SendPacket(petActionSound); @@ -730,7 +730,7 @@ namespace Game.Entities if (!owner || !owner.IsTypeId(TypeId.Player)) return; - AIReaction packet = new AIReaction(); + AIReaction packet = new(); packet.UnitGUID = guid; packet.Reaction = AiReaction.Hostile; @@ -742,7 +742,7 @@ namespace Game.Entities if (!IsTypeId(TypeId.Player)) return null; - Pet pet = new Pet(ToPlayer(), PetType.Hunter); + Pet pet = new(ToPlayer(), PetType.Hunter); if (!pet.CreateBaseAtCreature(creatureTarget)) return null; @@ -763,7 +763,7 @@ namespace Game.Entities if (creatureInfo == null) return null; - Pet pet = new Pet(ToPlayer(), PetType.Hunter); + Pet pet = new(ToPlayer(), PetType.Hunter); if (!pet.CreateBaseAtCreatureInfo(creatureInfo, this) || !InitTamedPet(pet, GetLevel(), spell_id)) return null; diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index 1c0c89584..b9efdffa5 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -1067,7 +1067,7 @@ namespace Game.Entities return; } - Spell spell = new Spell(this, spellInfo, triggerFlags, originalCaster); + Spell spell = new(this, spellInfo, triggerFlags, originalCaster); if (values != null) foreach (var pair in values) @@ -1097,7 +1097,7 @@ namespace Game.Entities } public void CastSpell(Unit victim, SpellInfo spellInfo, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { - SpellCastTargets targets = new SpellCastTargets(); + SpellCastTargets targets = new(); targets.SetUnitTarget(victim); CastSpell(targets, spellInfo, null, triggerFlags, castItem, triggeredByAura, originalCaster); } @@ -1109,7 +1109,7 @@ namespace Game.Entities Log.outError(LogFilter.Unit, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString()); return; } - SpellCastTargets targets = new SpellCastTargets(); + SpellCastTargets targets = new(); targets.SetDst(x, y, z, GetOrientation()); CastSpell(targets, spellInfo, null, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster); @@ -1122,7 +1122,7 @@ namespace Game.Entities Log.outError(LogFilter.Unit, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString()); return; } - SpellCastTargets targets = new SpellCastTargets(); + SpellCastTargets targets = new(); targets.SetGOTarget(go); CastSpell(targets, spellInfo, null, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster); @@ -1135,7 +1135,7 @@ namespace Game.Entities Log.outError(LogFilter.Unit, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString()); return; } - SpellCastTargets targets = new SpellCastTargets(); + SpellCastTargets targets = new(); targets.SetItemTarget(item); CastSpell(targets, spellInfo, null, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster); @@ -1144,7 +1144,7 @@ namespace Game.Entities public void CastCustomSpell(Unit target, uint spellId, int bp0, int bp1, int bp2, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { - Dictionary values = new Dictionary(); + Dictionary values = new(); if (bp0 != 0) values.Add(SpellValueMod.BasePoint0, bp0); if (bp1 != 0) @@ -1155,13 +1155,13 @@ namespace Game.Entities } public void CastCustomSpell(uint spellId, SpellValueMod mod, int value, Unit target, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { - Dictionary values = new Dictionary(); + Dictionary values = new(); values.Add(mod, value); CastCustomSpell(spellId, values, target, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster); } public void CastCustomSpell(uint spellId, SpellValueMod mod, int value, Unit target = null, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { - Dictionary values = new Dictionary(); + Dictionary values = new(); values.Add(mod, value); CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster); } @@ -1173,7 +1173,7 @@ namespace Game.Entities Log.outError(LogFilter.Unit, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString()); return; } - SpellCastTargets targets = new SpellCastTargets(); + SpellCastTargets targets = new(); targets.SetUnitTarget(victim); CastSpell(targets, spellInfo, values, triggerFlags, castItem, triggeredByAura, originalCaster); @@ -1561,7 +1561,7 @@ namespace Game.Entities public void SendEnergizeSpellLog(Unit victim, uint spellId, int amount, int overEnergize, PowerType powerType) { - SpellEnergizeLog data = new SpellEnergizeLog(); + SpellEnergizeLog data = new(); data.CasterGUID = GetGUID(); data.TargetGUID = victim.GetGUID(); data.SpellID = spellId; @@ -1907,15 +1907,15 @@ namespace Game.Entities void TriggerAurasProcOnEvent(CalcDamageInfo damageInfo) { - DamageInfo dmgInfo = new DamageInfo(damageInfo); + DamageInfo dmgInfo = new(damageInfo); TriggerAurasProcOnEvent(null, null, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, ProcFlagsSpellType.None, ProcFlagsSpellPhase.None, dmgInfo.GetHitMask(), null, dmgInfo, null); } void TriggerAurasProcOnEvent(List myProcAuras, List targetProcAuras, Unit actionTarget, ProcFlags typeMaskActor, ProcFlags typeMaskActionTarget, ProcFlagsSpellType spellTypeMask, ProcFlagsSpellPhase spellPhaseMask, ProcFlagsHit hitMask, Spell spell, DamageInfo damageInfo, HealInfo healInfo) { // prepare data for self trigger - ProcEventInfo myProcEventInfo = new ProcEventInfo(this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); - List> myAurasTriggeringProc = new List>(); + ProcEventInfo myProcEventInfo = new(this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); + List> myAurasTriggeringProc = new(); if (typeMaskActor != 0) { GetProcAurasTriggeredOnEvent(myAurasTriggeringProc, myProcAuras, myProcEventInfo); @@ -1926,7 +1926,7 @@ namespace Game.Entities { if (modOwner != this && spell) { - List modAuras = new List(); + List modAuras = new(); foreach (var itr in modOwner.GetAppliedAuras()) { if (spell.m_appliedMods.Contains(itr.Value.GetBase())) @@ -1938,8 +1938,8 @@ namespace Game.Entities } // prepare data for target trigger - ProcEventInfo targetProcEventInfo = new ProcEventInfo(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); - List> targetAurasTriggeringProc = new List>(); + ProcEventInfo targetProcEventInfo = new(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); + List> targetAurasTriggeringProc = new(); if (typeMaskActionTarget != 0 && actionTarget) actionTarget.GetProcAurasTriggeredOnEvent(targetAurasTriggeringProc, targetProcAuras, targetProcEventInfo); @@ -2314,7 +2314,7 @@ namespace Game.Entities void SendHealSpellLog(HealInfo healInfo, bool critical = false) { - SpellHealLog spellHealLog = new SpellHealLog(); + SpellHealLog spellHealLog = new(); spellHealLog.TargetGUID = healInfo.GetTarget().GetGUID(); spellHealLog.CasterGUID = healInfo.GetHealer().GetGUID(); @@ -2484,7 +2484,7 @@ namespace Game.Entities damageInfo.damage = (uint)damage; damageInfo.originalDamage = (uint)damage; - DamageInfo dmgInfo = new DamageInfo(damageInfo, DamageEffectType.SpellDirect, WeaponAttackType.BaseAttack, ProcFlagsHit.None); + DamageInfo dmgInfo = new(damageInfo, DamageEffectType.SpellDirect, WeaponAttackType.BaseAttack, ProcFlagsHit.None); CalcAbsorbResist(dmgInfo); damageInfo.absorb = dmgInfo.GetAbsorb(); damageInfo.resist = dmgInfo.GetResist(); @@ -2516,13 +2516,13 @@ namespace Game.Entities } // Call default DealDamage - CleanDamage cleanDamage = new CleanDamage(damageInfo.cleanDamage, damageInfo.absorb, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal); + CleanDamage cleanDamage = new(damageInfo.cleanDamage, damageInfo.absorb, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal); DealDamage(victim, damageInfo.damage, cleanDamage, DamageEffectType.SpellDirect, damageInfo.schoolMask, damageInfo.Spell, durabilityLoss); } public void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage log) { - SpellNonMeleeDamageLog packet = new SpellNonMeleeDamageLog(); + SpellNonMeleeDamageLog packet = new(); packet.Me = log.target.GetGUID(); packet.CasterGUID = log.attacker.GetGUID(); packet.CastID = log.castId; @@ -2542,7 +2542,7 @@ namespace Game.Entities packet.Periodic = log.periodicLog; packet.Flags = (int)log.HitInfo; - ContentTuningParams contentTuningParams = new ContentTuningParams(); + ContentTuningParams contentTuningParams = new(); if (contentTuningParams.GenerateDataForUnits(log.attacker, log.target)) packet.ContentTuning.Set(contentTuningParams); @@ -2553,13 +2553,13 @@ namespace Game.Entities { AuraEffect aura = info.auraEff; - SpellPeriodicAuraLog data = new SpellPeriodicAuraLog(); + SpellPeriodicAuraLog data = new(); data.TargetGUID = GetGUID(); data.CasterGUID = aura.GetCasterGUID(); data.SpellID = aura.GetId(); data.LogData.Initialize(this); - SpellPeriodicAuraLog.SpellLogEffect spellLogEffect = new SpellPeriodicAuraLog.SpellLogEffect(); + SpellPeriodicAuraLog.SpellLogEffect spellLogEffect = new(); spellLogEffect.Effect = (uint)aura.GetAuraType(); spellLogEffect.Amount = info.damage; spellLogEffect.OriginalDamage = (int)info.originalDamage; @@ -2570,7 +2570,7 @@ namespace Game.Entities spellLogEffect.Crit = info.critical; // @todo: implement debug info - ContentTuningParams contentTuningParams = new ContentTuningParams(); + ContentTuningParams contentTuningParams = new(); Unit caster = Global.ObjAccessor.GetUnit(this, aura.GetCasterGUID()); if (caster && contentTuningParams.GenerateDataForUnits(caster, this)) spellLogEffect.ContentTuning.Set(contentTuningParams); @@ -2581,7 +2581,7 @@ namespace Game.Entities } public void SendSpellMiss(Unit target, uint spellID, SpellMissInfo missInfo) { - SpellMissLog spellMissLog = new SpellMissLog(); + SpellMissLog spellMissLog = new(); spellMissLog.SpellID = spellID; spellMissLog.Caster = GetGUID(); spellMissLog.Entries.Add(new SpellLogMissEntry(target.GetGUID(), (byte)missInfo)); @@ -2590,7 +2590,7 @@ namespace Game.Entities void SendSpellDamageResist(Unit target, uint spellId) { - ProcResist procResist = new ProcResist(); + ProcResist procResist = new(); procResist.Caster = GetGUID(); procResist.SpellID = spellId; procResist.Target = target.GetGUID(); @@ -2599,7 +2599,7 @@ namespace Game.Entities public void SendSpellDamageImmune(Unit target, uint spellId, bool isPeriodic) { - SpellOrDamageImmune spellOrDamageImmune = new SpellOrDamageImmune(); + SpellOrDamageImmune spellOrDamageImmune = new(); spellOrDamageImmune.CasterGUID = GetGUID(); spellOrDamageImmune.VictimGUID = target.GetGUID(); spellOrDamageImmune.SpellID = spellId; @@ -2609,7 +2609,7 @@ namespace Game.Entities public void SendSpellInstakillLog(uint spellId, Unit caster, Unit target = null) { - SpellInstakillLog spellInstakillLog = new SpellInstakillLog(); + SpellInstakillLog spellInstakillLog = new(); spellInstakillLog.Caster = caster.GetGUID(); spellInstakillLog.Target = target ? target.GetGUID() : caster.GetGUID(); spellInstakillLog.SpellID = spellId; @@ -3227,7 +3227,7 @@ namespace Game.Entities public List GetDispellableAuraList(Unit caster, uint dispelMask, bool isReflect = false) { - List dispelList = new List(); + List dispelList = new(); var auras = GetOwnedAuras(); foreach (var pair in auras) @@ -3547,7 +3547,7 @@ namespace Game.Entities Aura aura = pair.Value; if (aura.GetCasterGUID() == casterGUID) { - DispelInfo dispelInfo = new DispelInfo(dispeller, dispellerSpellId, chargesRemoved); + DispelInfo dispelInfo = new(dispeller, dispellerSpellId, chargesRemoved); // Call OnDispel hook on AuraScript aura.CallScriptDispel(dispelInfo); @@ -4430,7 +4430,7 @@ namespace Game.Entities public int GetTotalAuraModifier(AuraType auratype, Func predicate) { - Dictionary sameEffectSpellGroup = new Dictionary(); + Dictionary sameEffectSpellGroup = new(); int modifier = 0; var mTotalAuraList = GetAuraEffectsByType(auratype); @@ -4463,7 +4463,7 @@ namespace Game.Entities if (mTotalAuraList.Empty()) return 1.0f; - Dictionary sameEffectSpellGroup = new Dictionary(); + Dictionary sameEffectSpellGroup = new(); float multiplier = 1.0f; foreach (var aurEff in mTotalAuraList) diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index 8ba0bb8cd..5569784cb 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -252,14 +252,14 @@ namespace Game.Entities public void HandleEmoteCommand(Emote anim_id) { - EmoteMessage packet = new EmoteMessage(); + EmoteMessage packet = new(); packet.Guid = GetGUID(); packet.EmoteID = (int)anim_id; SendMessageToSet(packet, true); } public void SendDurabilityLoss(Player receiver, uint percent) { - DurabilityDamageDeath packet = new DurabilityDamageDeath(); + DurabilityDamageDeath packet = new(); packet.Percent = percent; receiver.SendPacket(packet); } @@ -308,7 +308,7 @@ namespace Game.Entities public void SendClearTarget() { - BreakTarget breakTarget = new BreakTarget(); + BreakTarget breakTarget = new(); breakTarget.UnitGUID = GetGUID(); SendMessageToSet(breakTarget, false); } @@ -369,7 +369,7 @@ namespace Game.Entities return; Locale locale = target.GetSession().GetSessionDbLocaleIndex(); - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(isBossWhisper ? ChatMsg.RaidBossWhisper : ChatMsg.MonsterWhisper, Language.Universal, this, target, text, 0, "", locale); target.SendPacket(data); } @@ -416,7 +416,7 @@ namespace Game.Entities } Locale locale = target.GetSession().GetSessionDbLocaleIndex(); - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(isBossWhisper ? ChatMsg.RaidBossWhisper : ChatMsg.MonsterWhisper, Language.Universal, this, target, Global.DB2Mgr.GetBroadcastTextValue(bct, locale, GetGender()), 0, "", locale); target.SendPacket(data); } @@ -429,7 +429,7 @@ namespace Game.Entities { base.UpdateObjectVisibility(true); // call MoveInLineOfSight for nearby creatures - AIRelocationNotifier notifier = new AIRelocationNotifier(this); + AIRelocationNotifier notifier = new(this); Cell.VisitAllObjects(this, notifier, GetVisibilityRange()); } } @@ -554,7 +554,7 @@ namespace Game.Entities List GetDynObjects(uint spellId) { - List dynamicobjects = new List(); + List dynamicobjects = new(); foreach (var obj in m_dynObj) if (obj.GetSpellId() == spellId) dynamicobjects.Add(obj); @@ -585,7 +585,7 @@ namespace Game.Entities List GetGameObjects(uint spellId) { - List gameobjects = new List(); + List gameobjects = new(); foreach (var obj in m_gameObj) if (obj.GetSpellId() == spellId) gameobjects.Add(obj); @@ -830,7 +830,7 @@ namespace Game.Entities public Unit SelectNearbyTarget(Unit exclude = null, float dist = SharedConst.NominalMeleeRange) { - List targets = new List(); + List targets = new(); var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(this, this, dist); var searcher = new UnitListSearcher(this, targets, u_check); Cell.VisitAllObjects(this, searcher, dist); @@ -982,7 +982,7 @@ namespace Game.Entities float height = pos.GetPositionZ(); - MoveSplineInit init = new MoveSplineInit(this); + MoveSplineInit init = new(this); // Creatures without inhabit type air should begin falling after exiting the vehicle if (IsTypeId(TypeId.Unit) && !ToCreature().CanFly() && height > GetMap().GetWaterOrGroundLevel(GetPhaseShift(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), ref height) + 0.1f) @@ -1013,14 +1013,14 @@ namespace Game.Entities void SendCancelOrphanSpellVisual(uint id) { - CancelOrphanSpellVisual cancelOrphanSpellVisual = new CancelOrphanSpellVisual(); + CancelOrphanSpellVisual cancelOrphanSpellVisual = new(); cancelOrphanSpellVisual.SpellVisualID = id; SendMessageToSet(cancelOrphanSpellVisual, true); } void SendPlayOrphanSpellVisual(ObjectGuid target, uint spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false) { - PlayOrphanSpellVisual playOrphanSpellVisual = new PlayOrphanSpellVisual(); + PlayOrphanSpellVisual playOrphanSpellVisual = new(); playOrphanSpellVisual.SourceLocation = GetPosition(); if (withSourceOrientation) playOrphanSpellVisual.SourceRotation = new Vector3(0.0f, 0.0f, GetOrientation()); @@ -1034,7 +1034,7 @@ namespace Game.Entities void SendPlayOrphanSpellVisual(Vector3 targetLocation, uint spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false) { - PlayOrphanSpellVisual playOrphanSpellVisual = new PlayOrphanSpellVisual(); + PlayOrphanSpellVisual playOrphanSpellVisual = new(); playOrphanSpellVisual.SourceLocation = GetPosition(); if (withSourceOrientation) playOrphanSpellVisual.SourceRotation = new Vector3(0.0f, 0.0f, GetOrientation()); @@ -1048,7 +1048,7 @@ namespace Game.Entities void SendCancelSpellVisual(uint id) { - CancelSpellVisual cancelSpellVisual = new CancelSpellVisual(); + CancelSpellVisual cancelSpellVisual = new(); cancelSpellVisual.Source = GetGUID(); cancelSpellVisual.SpellVisualID = id; SendMessageToSet(cancelSpellVisual, true); @@ -1056,7 +1056,7 @@ namespace Game.Entities public void SendPlaySpellVisual(ObjectGuid targetGuid, uint spellVisualId, uint missReason, uint reflectStatus, float travelSpeed, bool speedAsTime = false) { - PlaySpellVisual playSpellVisual = new PlaySpellVisual(); + PlaySpellVisual playSpellVisual = new(); playSpellVisual.Source = GetGUID(); playSpellVisual.Target = targetGuid; // exclusive with TargetPosition playSpellVisual.SpellVisualID = spellVisualId; @@ -1069,7 +1069,7 @@ namespace Game.Entities public void SendPlaySpellVisual(Vector3 targetPosition, float launchDelay, uint spellVisualId, uint missReason, uint reflectStatus, float travelSpeed, bool speedAsTime = false) { - PlaySpellVisual playSpellVisual = new PlaySpellVisual(); + PlaySpellVisual playSpellVisual = new(); playSpellVisual.Source = GetGUID(); playSpellVisual.TargetPosition = targetPosition; // exclusive with Target playSpellVisual.LaunchDelay = launchDelay; @@ -1083,7 +1083,7 @@ namespace Game.Entities void SendCancelSpellVisualKit(uint id) { - CancelSpellVisualKit cancelSpellVisualKit = new CancelSpellVisualKit(); + CancelSpellVisualKit cancelSpellVisualKit = new(); cancelSpellVisualKit.Source = GetGUID(); cancelSpellVisualKit.SpellVisualKitID = id; SendMessageToSet(cancelSpellVisualKit, true); @@ -1091,7 +1091,7 @@ namespace Game.Entities public void SendPlaySpellVisualKit(uint id, uint type, uint duration) { - PlaySpellVisualKit playSpellVisualKit = new PlaySpellVisualKit(); + PlaySpellVisualKit playSpellVisualKit = new(); playSpellVisualKit.Unit = GetGUID(); playSpellVisualKit.KitRecID = id; playSpellVisualKit.KitType = type; @@ -1117,7 +1117,7 @@ namespace Game.Entities if (hasMissile) { - MissileCancel packet = new MissileCancel(); + MissileCancel packet = new(); packet.OwnerGUID = GetGUID(); packet.SpellID = spellId; packet.Reverse = reverseMissile; @@ -1276,7 +1276,7 @@ namespace Game.Entities if (useRandom) { - List displayIds = new List(); + List displayIds = new(); for (var i = 0; i < formModelData.Choices.Count; ++i) { ChrCustomizationDisplayInfoRecord displayInfo = formModelData.Displays[i]; @@ -1546,7 +1546,7 @@ namespace Game.Entities Unit caster = aura.GetCaster(); - AuraApplication aurApp = new AuraApplication(this, caster, aura, effMask); + AuraApplication aurApp = new(this, caster, aura, effMask); m_appliedAuras.Add(aurId, aurApp); if (aurSpellInfo.HasAnyAuraInterruptFlag()) @@ -1605,7 +1605,7 @@ namespace Game.Entities } // we want to shoot - Spell spell = new Spell(this, autoRepeatSpellInfo, TriggerCastFlags.FullMask); + Spell spell = new(this, autoRepeatSpellInfo, TriggerCastFlags.FullMask); spell.Prepare(m_currentSpells[CurrentSpellTypes.AutoRepeat].m_targets); // all went good, reset attack @@ -1728,7 +1728,7 @@ namespace Game.Entities return; } - PlayOneShotAnimKit packet = new PlayOneShotAnimKit(); + PlayOneShotAnimKit packet = new(); packet.Unit = GetGUID(); packet.AnimKitID = animKitId; SendMessageToSet(packet, true); @@ -1744,7 +1744,7 @@ namespace Game.Entities _aiAnimKitId = animKitId; - SetAIAnimKit data = new SetAIAnimKit(); + SetAIAnimKit data = new(); data.Unit = GetGUID(); data.AnimKitID = animKitId; SendMessageToSet(data, true); @@ -1762,7 +1762,7 @@ namespace Game.Entities _movementAnimKitId = animKitId; - SetMovementAnimKit data = new SetMovementAnimKit(); + SetMovementAnimKit data = new(); data.Unit = GetGUID(); data.AnimKitID = animKitId; SendMessageToSet(data, true); @@ -1780,7 +1780,7 @@ namespace Game.Entities _meleeAnimKitId = animKitId; - SetMeleeAnimKit data = new SetMeleeAnimKit(); + SetMeleeAnimKit data = new(); data.Unit = GetGUID(); data.AnimKitID = animKitId; SendMessageToSet(data, true); @@ -1951,7 +1951,7 @@ namespace Game.Entities if (player == null || !player.HaveAtClient(this)) // if player cannot see this unit yet, he will receive needed data with create object return; - UpdateData udata = new UpdateData(GetMapId()); + UpdateData udata = new(GetMapId()); UpdateObject packet; BuildValuesUpdateBlockForPlayerWithFlag(udata, UpdateFieldFlag.Owner, player); udata.BuildPacket(out packet); @@ -2368,7 +2368,7 @@ namespace Game.Entities if (IsTypeId(TypeId.Player)) { - StandStateUpdate packet = new StandStateUpdate(state, animKitId); + StandStateUpdate packet = new(state, animKitId); ToPlayer().SendPacket(packet); } } @@ -2379,7 +2379,7 @@ namespace Game.Entities if (notifyClient) { - SetAnimTier setAnimTier = new SetAnimTier(); + SetAnimTier setAnimTier = new(); setAnimTier.Unit = GetGUID(); setAnimTier.Tier = (int)animTier; SendMessageToSet(setAnimTier, true); @@ -2444,7 +2444,7 @@ namespace Game.Entities public override void BuildValuesCreate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt8((byte)flags); m_objectData.WriteCreate(buffer, flags, this, target); @@ -2457,7 +2457,7 @@ namespace Game.Entities public override void BuildValuesUpdate(WorldPacket data, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(m_values.GetChangedObjectTypeMask()); if (m_values.HasChanged(TypeId.Object)) @@ -2472,12 +2472,12 @@ namespace Game.Entities public override void BuildValuesUpdateWithFlag(WorldPacket data, UpdateFieldFlag flags, Player target) { - UpdateMask valuesMask = new UpdateMask(14); + UpdateMask valuesMask = new(14); valuesMask.Set((int)TypeId.Unit); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); - UpdateMask mask = new UpdateMask(191); + UpdateMask mask = new(191); m_unitData.AppendAllowedFieldsMaskForFlag(mask, flags); m_unitData.WriteUpdate(buffer, mask, true, this, target); @@ -2489,7 +2489,7 @@ namespace Game.Entities public void BuildValuesUpdateForPlayerWithMask(UpdateData data, UpdateMask requestedObjectMask, UpdateMask requestedUnitMask, Player target) { UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - UpdateMask valuesMask = new UpdateMask((int)TypeId.Max); + UpdateMask valuesMask = new((int)TypeId.Max); if (requestedObjectMask.IsAnySet()) valuesMask.Set((int)TypeId.Object); @@ -2497,7 +2497,7 @@ namespace Game.Entities if (requestedUnitMask.IsAnySet()) valuesMask.Set((int)TypeId.Unit); - WorldPacket buffer = new WorldPacket(); + WorldPacket buffer = new(); buffer.WriteUInt32(valuesMask.GetBlock(0)); if (valuesMask[(int)TypeId.Object]) @@ -2506,7 +2506,7 @@ namespace Game.Entities if (valuesMask[(int)TypeId.Unit]) m_unitData.WriteUpdate(buffer, requestedUnitMask, true, this, target); - WorldPacket buffer1 = new WorldPacket(); + WorldPacket buffer1 = new(); buffer1.WriteUInt8((byte)UpdateType.Values); buffer1.WritePackedGuid(GetGUID()); buffer1.WriteUInt32(buffer.GetSize()); @@ -2528,7 +2528,7 @@ namespace Game.Entities { if (bg.IsArena()) { - DestroyArenaUnit destroyArenaUnit = new DestroyArenaUnit(); + DestroyArenaUnit destroyArenaUnit = new(); destroyArenaUnit.Guid = GetGUID(); target.SendPacket(destroyArenaUnit); } diff --git a/Source/Game/Entities/Vehicle.cs b/Source/Game/Entities/Vehicle.cs index 7d6cc2034..99989f282 100644 --- a/Source/Game/Entities/Vehicle.cs +++ b/Source/Game/Entities/Vehicle.cs @@ -288,10 +288,10 @@ namespace Game.Entities // While the validity of the following may be arguable, it is possible that when such a passenger // exits the vehicle will dismiss. That's why the actual adding the passenger to the vehicle is scheduled // asynchronously, so it can be cancelled easily in case the vehicle is uninstalled meanwhile. - VehicleJoinEvent e = new VehicleJoinEvent(this, unit); + VehicleJoinEvent e = new(this, unit); unit.m_Events.AddEvent(e, unit.m_Events.CalculateTime(0)); - KeyValuePair seat = new KeyValuePair(); + KeyValuePair seat = new(); if (seatId < 0) // no specific seat requirement { foreach (var _seat in Seats) @@ -382,7 +382,7 @@ namespace Game.Entities { Cypher.Assert(_me.GetMap() != null); - List> seatRelocation = new List>(); + List> seatRelocation = new(); // not sure that absolute position calculation is correct, it must depend on vehicle pitch angle foreach (var pair in Seats) @@ -527,14 +527,14 @@ namespace Game.Entities Unit _me; VehicleRecord _vehicleInfo; //< DBC data for vehicle - List vehiclePlayers = new List(); + List vehiclePlayers = new(); uint _creatureEntry; //< Can be different than the entry of _me in case of players Status _status; //< Internal variable for sanity checks Position _lastShootPos; - List _pendingJoinEvents = new List(); - public Dictionary Seats = new Dictionary(); + List _pendingJoinEvents = new(); + public Dictionary Seats = new(); public uint UsableSeatNum; //< Number of seats that match VehicleSeatEntry.UsableByPlayer, used for proper display flags public static implicit operator bool(Vehicle vehicle) @@ -631,7 +631,7 @@ namespace Game.Entities Passenger.SetControlled(true, UnitState.Root); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures) // also adds MOVEMENTFLAG_ROOT - MoveSplineInit init = new MoveSplineInit(Passenger); + MoveSplineInit init = new(Passenger); init.DisableTransportPathTransformations(); init.MoveTo(veSeat.AttachmentOffset.X, veSeat.AttachmentOffset.Y, veSeat.AttachmentOffset.Z, false, true); init.SetFacing(0.0f); diff --git a/Source/Game/Events/GameEventManager.cs b/Source/Game/Events/GameEventManager.cs index 0797f7c3e..071e4e59f 100644 --- a/Source/Game/Events/GameEventManager.cs +++ b/Source/Game/Events/GameEventManager.cs @@ -194,7 +194,7 @@ namespace Game foreach (var pair in data.conditions) pair.Value.done = 0; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GAME_EVENT_CONDITION_SAVE); stmt.AddValue(0, event_id); trans.Append(stmt); @@ -231,7 +231,7 @@ namespace Game continue; } - GameEventData pGameEvent = new GameEventData(); + GameEventData pGameEvent = new(); ulong starttime = result.Read(1); pGameEvent.start = (long)starttime; ulong endtime = result.Read(2); @@ -466,7 +466,7 @@ namespace Game continue; } - ModelEquip newModelEquipSet = new ModelEquip(); + ModelEquip newModelEquipSet = new(); newModelEquipSet.modelid = result.Read(3); newModelEquipSet.equipment_id = result.Read(4); newModelEquipSet.equipement_id_prev = 0; @@ -783,7 +783,7 @@ namespace Game if (data != null) entry = data.Id; - VendorItem vItem = new VendorItem(); + VendorItem vItem = new(); vItem.item = result.Read(2); vItem.maxcount = result.Read(3); vItem.incrtime = result.Read(4); @@ -974,8 +974,8 @@ namespace Game long currenttime = Time.UnixTime; uint nextEventDelay = Time.Day; // 1 day uint calcDelay; - List activate = new List(); - List deactivate = new List(); + List activate = new(); + List deactivate = new(); for (ushort id = 1; id < mGameEvent.Length; ++id) { // must do the activating first, and after that the deactivating @@ -1103,7 +1103,7 @@ namespace Game void UpdateEventNPCFlags(ushort event_id) { - MultiMap creaturesByMap = new MultiMap(); + MultiMap creaturesByMap = new(); // go through the creatures whose npcflags are changed in the event foreach (var (guid, npcflag) in mGameEventNPCFlags[event_id]) @@ -1450,7 +1450,7 @@ namespace Game BattlemasterListRecord bl = CliDB.BattlemasterListStorage.LookupByKey(bgTypeId); if (bl != null && bl.HolidayWorldState != 0) { - UpdateWorldState worldstate = new UpdateWorldState(); + UpdateWorldState worldstate = new(); worldstate.VariableID = bl.HolidayWorldState; worldstate.Value = Activate ? 1 : 0; //worldstate.Hidden = false; @@ -1489,7 +1489,7 @@ namespace Game if (eventFinishCond.done > eventFinishCond.reqNum) eventFinishCond.done = eventFinishCond.reqNum; // save the change to db - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GAME_EVENT_CONDITION_SAVE); stmt.AddValue(0, event_id); @@ -1534,7 +1534,7 @@ namespace Game void SaveWorldEventStateToDB(ushort event_id) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GAME_EVENT_SAVE); stmt.AddValue(0, event_id); @@ -1565,7 +1565,7 @@ namespace Game //! Not entirely sure how this will affect units in non-loaded grids. Global.MapMgr.DoForAllMaps(map => { - GameEventAIHookWorker worker = new GameEventAIHookWorker(event_id, activate); + GameEventAIHookWorker worker = new(event_id, activate); var visitor = new Visitor(worker, GridMapTypeMask.None); visitor.Visit(map.GetObjectsStore().Values.ToList()); }); @@ -1677,9 +1677,9 @@ namespace Game List[] mGameEventPoolIds; GameEventData[] mGameEvent; uint[] mGameEventBattlegroundHolidays; - Dictionary mQuestToEventConditions = new Dictionary(); + Dictionary mQuestToEventConditions = new(); List<(ulong guid, ulong npcflag)>[] mGameEventNPCFlags; - List m_ActiveEvents = new List(); + List m_ActiveEvents = new(); bool isSystemInit; public List[] mGameEventCreatureGuids; @@ -1716,8 +1716,8 @@ namespace Game public HolidayIds holiday_id; public byte holidayStage; public GameEventState state; // state of the game event, these are saved into the game_event table on change! - public Dictionary conditions = new Dictionary(); // conditions to finish - public List prerequisite_events = new List(); // events that must be completed before starting this event + public Dictionary conditions = new(); // conditions to finish + public List prerequisite_events = new(); // events that must be completed before starting this event public string description; public byte announce; // if 0 dont announce, if 1 announce, if 2 take config value diff --git a/Source/Game/Garrisons/GarrisonManager.cs b/Source/Game/Garrisons/GarrisonManager.cs index 633e86043..21d1a254f 100644 --- a/Source/Game/Garrisons/GarrisonManager.cs +++ b/Source/Game/Garrisons/GarrisonManager.cs @@ -175,7 +175,7 @@ namespace Game.Garrisons Cypher.Assert(faction< 2); bool hasForcedExclusiveTrait = false; - List result = new List(); + List result = new(); uint[] slots = { AbilitiesForQuality[quality, 0], AbilitiesForQuality[quality, 1] }; GarrAbilities garrAbilities = null; @@ -183,10 +183,10 @@ namespace Game.Garrisons if (abilities != null) garrAbilities = abilities; - List abilityList = new List(); - List forcedAbilities = new List(); - List traitList = new List(); - List forcedTraits = new List(); + List abilityList = new(); + List forcedAbilities = new(); + List traitList = new(); + List forcedTraits = new(); if (garrAbilities != null) { foreach (GarrAbilityRecord ability in garrAbilities.Counters) @@ -252,7 +252,7 @@ namespace Game.Garrisons if (slots[1] > forcedTraits.Count + traitList.Count) { - List genericTraitsTemp = new List(); + List genericTraitsTemp = new(); foreach (GarrAbilityRecord ability in _garrisonFollowerRandomTraits) { if (ability.Flags.HasAnyFlag(GarrisonAbilityFlags.HordeOnly) && faction != GarrisonFactionIndex.Horde) @@ -309,7 +309,7 @@ namespace Game.Garrisons List GetClassSpecAbilities(GarrFollowerRecord follower, uint faction) { - List abilities = new List(); + List abilities = new(); uint classSpecId; switch (faction) { @@ -412,7 +412,7 @@ namespace Game.Garrisons continue; } - FinalizeGarrisonPlotGOInfo info = new FinalizeGarrisonPlotGOInfo(); + FinalizeGarrisonPlotGOInfo info = new(); info.factionInfo[GarrisonFactionIndex.Horde].GameObjectId = hordeGameObjectId; info.factionInfo[GarrisonFactionIndex.Horde].Pos = new Position(result.Read(2), result.Read(3), result.Read(4), result.Read(5)); info.factionInfo[GarrisonFactionIndex.Horde].AnimKitId = hordeAnimKitId; @@ -468,23 +468,23 @@ namespace Game.Garrisons Log.outInfo(LogFilter.ServerLoading, "Loaded {0} garrison follower class spec abilities in {1}.", count, Time.GetMSTimeDiffToNow(msTime)); } - MultiMap _garrisonPlotInstBySiteLevel = new MultiMap(); - Dictionary> _garrisonPlots = new Dictionary>(); - MultiMap _garrisonBuildingsByPlot = new MultiMap(); - Dictionary _garrisonBuildingPlotInstances = new Dictionary(); - MultiMap _garrisonBuildingsByType = new MultiMap(); - Dictionary _finalizePlotGOInfo = new Dictionary(); + MultiMap _garrisonPlotInstBySiteLevel = new(); + Dictionary> _garrisonPlots = new(); + MultiMap _garrisonBuildingsByPlot = new(); + Dictionary _garrisonBuildingPlotInstances = new(); + MultiMap _garrisonBuildingsByType = new(); + Dictionary _finalizePlotGOInfo = new(); Dictionary[] _garrisonFollowerAbilities = new Dictionary[2]; - MultiMap _garrisonFollowerClassSpecAbilities = new MultiMap(); - List _garrisonFollowerRandomTraits = new List(); + MultiMap _garrisonFollowerClassSpecAbilities = new(); + List _garrisonFollowerRandomTraits = new(); ulong _followerDbIdGenerator = 1; } class GarrAbilities { - public List Counters = new List(); - public List Traits = new List(); + public List Counters = new(); + public List Traits = new(); } public class FinalizeGarrisonPlotGOInfo diff --git a/Source/Game/Garrisons/GarrisonMap.cs b/Source/Game/Garrisons/GarrisonMap.cs index da1345ea5..537dd0bc5 100644 --- a/Source/Game/Garrisons/GarrisonMap.cs +++ b/Source/Game/Garrisons/GarrisonMap.cs @@ -35,7 +35,7 @@ namespace Game.Garrisons { base.LoadGridObjects(grid, cell); - GarrisonGridLoader loader = new GarrisonGridLoader(grid, this, cell); + GarrisonGridLoader loader = new(grid, this, cell); loader.LoadN(); } diff --git a/Source/Game/Garrisons/Garrisons.cs b/Source/Game/Garrisons/Garrisons.cs index 23e2aba59..6bb872d79 100644 --- a/Source/Game/Garrisons/Garrisons.cs +++ b/Source/Game/Garrisons/Garrisons.cs @@ -229,7 +229,7 @@ namespace Game.Garrisons InitializePlots(); - GarrisonCreateResult garrisonCreateResult = new GarrisonCreateResult(); + GarrisonCreateResult garrisonCreateResult = new(); garrisonCreateResult.GarrSiteLevelID = _siteLevel.Id; _owner.SendPacket(garrisonCreateResult); PhasingHandler.OnConditionChange(_owner); @@ -239,11 +239,11 @@ namespace Game.Garrisons public void Delete() { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); DeleteFromDB(_owner.GetGUID().GetCounter(), trans); DB.Characters.CommitTransaction(trans); - GarrisonDeleteResult garrisonDelete = new GarrisonDeleteResult(); + GarrisonDeleteResult garrisonDelete = new(); garrisonDelete.Result = GarrisonError.Success; garrisonDelete.GarrSiteID = _siteLevel.GarrSiteID; _owner.SendPacket(garrisonDelete); @@ -281,7 +281,7 @@ namespace Game.Garrisons void Enter() { - WorldLocation loc = new WorldLocation(_siteLevel.MapID); + WorldLocation loc = new(_siteLevel.MapID); loc.Relocate(_owner); _owner.TeleportTo(loc, TeleportToOptions.Seamless); } @@ -291,7 +291,7 @@ namespace Game.Garrisons MapRecord map = CliDB.MapStorage.LookupByKey(_siteLevel.MapID); if (map != null) { - WorldLocation loc = new WorldLocation((uint)map.ParentMapID); + WorldLocation loc = new((uint)map.ParentMapID); loc.Relocate(_owner); _owner.TeleportTo(loc, TeleportToOptions.Seamless); } @@ -319,7 +319,7 @@ namespace Game.Garrisons public void LearnBlueprint(uint garrBuildingId) { - GarrisonLearnBlueprintResult learnBlueprintResult = new GarrisonLearnBlueprintResult(); + GarrisonLearnBlueprintResult learnBlueprintResult = new(); learnBlueprintResult.GarrTypeID = GetGarrisonType(); learnBlueprintResult.BuildingID = garrBuildingId; learnBlueprintResult.Result = GarrisonError.Success; @@ -336,7 +336,7 @@ namespace Game.Garrisons void UnlearnBlueprint(uint garrBuildingId) { - GarrisonUnlearnBlueprintResult unlearnBlueprintResult = new GarrisonUnlearnBlueprintResult(); + GarrisonUnlearnBlueprintResult unlearnBlueprintResult = new(); unlearnBlueprintResult.GarrTypeID = GetGarrisonType(); unlearnBlueprintResult.BuildingID = garrBuildingId; unlearnBlueprintResult.Result = GarrisonError.Success; @@ -353,7 +353,7 @@ namespace Game.Garrisons public void PlaceBuilding(uint garrPlotInstanceId, uint garrBuildingId) { - GarrisonPlaceBuildingResult placeBuildingResult = new GarrisonPlaceBuildingResult(); + GarrisonPlaceBuildingResult placeBuildingResult = new(); placeBuildingResult.GarrTypeID = GetGarrisonType(); placeBuildingResult.Result = CheckBuildingPlacement(garrPlotInstanceId, garrBuildingId); if (placeBuildingResult.Result == GarrisonError.Success) @@ -389,7 +389,7 @@ namespace Game.Garrisons if (oldBuildingId != 0) { - GarrisonBuildingRemoved buildingRemoved = new GarrisonBuildingRemoved(); + GarrisonBuildingRemoved buildingRemoved = new(); buildingRemoved.GarrTypeID = GetGarrisonType(); buildingRemoved.Result = GarrisonError.Success; buildingRemoved.GarrPlotInstanceID = garrPlotInstanceId; @@ -405,7 +405,7 @@ namespace Game.Garrisons public void CancelBuildingConstruction(uint garrPlotInstanceId) { - GarrisonBuildingRemoved buildingRemoved = new GarrisonBuildingRemoved(); + GarrisonBuildingRemoved buildingRemoved = new(); buildingRemoved.GarrTypeID = GetGarrisonType(); buildingRemoved.Result = CheckBuildingRemoval(garrPlotInstanceId); if (buildingRemoved.Result == GarrisonError.Success) @@ -433,7 +433,7 @@ namespace Game.Garrisons uint restored = Global.GarrisonMgr.GetPreviousLevelBuilding(constructing.BuildingType, constructing.UpgradeLevel); Cypher.Assert(restored != 0); - GarrisonPlaceBuildingResult placeBuildingResult = new GarrisonPlaceBuildingResult(); + GarrisonPlaceBuildingResult placeBuildingResult = new(); placeBuildingResult.GarrTypeID = GetGarrisonType(); placeBuildingResult.Result = GarrisonError.Success; placeBuildingResult.BuildingInfo.GarrPlotInstanceID = garrPlotInstanceId; @@ -473,7 +473,7 @@ namespace Game.Garrisons map.AddToMap(go); } - GarrisonBuildingActivated buildingActivated = new GarrisonBuildingActivated(); + GarrisonBuildingActivated buildingActivated = new(); buildingActivated.GarrPlotInstanceID = garrPlotInstanceId; _owner.SendPacket(buildingActivated); } @@ -482,7 +482,7 @@ namespace Game.Garrisons public void AddFollower(uint garrFollowerId) { - GarrisonAddFollowerResult addFollowerResult = new GarrisonAddFollowerResult(); + GarrisonAddFollowerResult addFollowerResult = new(); addFollowerResult.GarrTypeID = GetGarrisonType(); GarrFollowerRecord followerEntry = CliDB.GarrFollowerStorage.LookupByKey(garrFollowerId); if (_followerIds.Contains(garrFollowerId) || followerEntry == null) @@ -495,7 +495,7 @@ namespace Game.Garrisons _followerIds.Add(garrFollowerId); ulong dbId = Global.GarrisonMgr.GenerateFollowerDbId(); - Follower follower = new Follower(); + Follower follower = new(); follower.PacketInfo.DbID = dbId; follower.PacketInfo.GarrFollowerID = garrFollowerId; follower.PacketInfo.Quality = followerEntry.Quality; // TODO: handle magic upgrades @@ -532,10 +532,10 @@ namespace Game.Garrisons public void SendInfo() { - GetGarrisonInfoResult garrisonInfo = new GetGarrisonInfoResult(); + GetGarrisonInfoResult garrisonInfo = new(); garrisonInfo.FactionIndex = GetFaction(); - GarrisonInfo garrison = new GarrisonInfo(); + GarrisonInfo garrison = new(); garrison.GarrTypeID = GetGarrisonType(); garrison.GarrSiteID = _siteLevel.GarrSiteID; garrison.GarrSiteLevelID = _siteLevel.Id; @@ -561,9 +561,9 @@ namespace Game.Garrisons if (garrisonMap == null || _owner.GetMapId() != garrisonMap.ParentMapID) return; - GarrisonRemoteInfo remoteInfo = new GarrisonRemoteInfo(); + GarrisonRemoteInfo remoteInfo = new(); - GarrisonRemoteSiteInfo remoteSiteInfo = new GarrisonRemoteSiteInfo(); + GarrisonRemoteSiteInfo remoteSiteInfo = new(); remoteSiteInfo.GarrSiteLevelID = _siteLevel.Id; foreach (var p in _plots) if (p.Value.BuildingInfo.PacketInfo.HasValue) @@ -575,7 +575,7 @@ namespace Game.Garrisons public void SendBlueprintAndSpecializationData() { - GarrisonRequestBlueprintAndSpecializationDataResult data = new GarrisonRequestBlueprintAndSpecializationDataResult(); + GarrisonRequestBlueprintAndSpecializationDataResult data = new(); data.GarrTypeID = GetGarrisonType(); data.BlueprintsKnown = _knownBuildings; _owner.SendPacket(data); @@ -583,7 +583,7 @@ namespace Game.Garrisons public void SendMapData(Player receiver) { - GarrisonMapDataResponse mapData = new GarrisonMapDataResponse(); + GarrisonMapDataResponse mapData = new(); foreach (var plot in _plots.Values) { @@ -677,10 +677,10 @@ namespace Game.Garrisons GarrSiteLevelRecord _siteLevel; uint _followerActivationsRemainingToday; - Dictionary _plots = new Dictionary(); - List _knownBuildings = new List(); - Dictionary _followers = new Dictionary(); - List _followerIds = new List(); + Dictionary _plots = new(); + List _knownBuildings = new(); + Dictionary _followers = new(); + List _followerIds = new(); public class Building { @@ -697,7 +697,7 @@ namespace Game.Garrisons } public ObjectGuid Guid; - public List Spawns = new List(); + public List Spawns = new(); public Optional PacketInfo; } @@ -808,7 +808,7 @@ namespace Game.Garrisons public void ClearBuildingInfo(GarrisonType garrisonType, Player owner) { - GarrisonPlotPlaced plotPlaced = new GarrisonPlotPlaced(); + GarrisonPlotPlaced plotPlaced = new(); plotPlaced.GarrTypeID = garrisonType; plotPlaced.PlotInfo = PacketInfo; owner.SendPacket(plotPlaced); @@ -820,7 +820,7 @@ namespace Game.Garrisons { if (!BuildingInfo.PacketInfo.HasValue) { - GarrisonPlotRemoved plotRemoved = new GarrisonPlotRemoved(); + GarrisonPlotRemoved plotRemoved = new(); plotRemoved.GarrPlotInstanceID = PacketInfo.GarrPlotInstanceID; owner.SendPacket(plotRemoved); } @@ -830,7 +830,7 @@ namespace Game.Garrisons T BuildingSpawnHelper(GameObject building, ulong spawnId, Map map) where T : WorldObject, new() { - T spawn = new T(); + T spawn = new(); if (!spawn.LoadFromDB(spawnId, map, false, false)) return null; @@ -869,7 +869,7 @@ namespace Game.Garrisons public class Follower { - public GarrisonFollower PacketInfo = new GarrisonFollower(); + public GarrisonFollower PacketInfo = new(); public uint GetItemLevel() { diff --git a/Source/Game/Globals/ObjectAccessor.cs b/Source/Game/Globals/ObjectAccessor.cs index 760d81dbd..2edaaf643 100644 --- a/Source/Game/Globals/ObjectAccessor.cs +++ b/Source/Game/Globals/ObjectAccessor.cs @@ -24,10 +24,10 @@ using System.Collections.Generic; public class ObjectAccessor : Singleton { - object _lockObject = new object(); + object _lockObject = new(); - Dictionary _players = new Dictionary(); - Dictionary _transports = new Dictionary(); + Dictionary _players = new(); + Dictionary _transports = new(); ObjectAccessor() { } @@ -286,5 +286,5 @@ class PlayerNameMapHolder return _playerNameMap.LookupByKey(name); } - static Dictionary _playerNameMap = new Dictionary(); + static Dictionary _playerNameMap = new(); } diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index 956d84662..1fa2f7995 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -420,7 +420,7 @@ namespace Game continue; } - RaceUnlockRequirement raceUnlockRequirement = new RaceUnlockRequirement(); + RaceUnlockRequirement raceUnlockRequirement = new(); raceUnlockRequirement.Expansion = expansion; raceUnlockRequirement.AchievementId = achievementId; @@ -441,7 +441,7 @@ namespace Game result = DB.World.Query("SELECT ClassID, RaceID, ActiveExpansionLevel, AccountExpansionLevel FROM `class_expansion_requirement`"); if (!result.IsEmpty()) { - Dictionary>> temp = new Dictionary>>(); + Dictionary>> temp = new(); uint count = 0; do { @@ -487,12 +487,12 @@ namespace Game foreach (var race in temp) { - RaceClassAvailability raceClassAvailability = new RaceClassAvailability(); + RaceClassAvailability raceClassAvailability = new(); raceClassAvailability.RaceID = race.Key; foreach (var class_ in race.Value) { - ClassAvailability classAvailability = new ClassAvailability(); + ClassAvailability classAvailability = new(); classAvailability.ClassID = class_.Key; classAvailability.ActiveExpansionLevel = class_.Value.Item1; classAvailability.AccountExpansionLevel = class_.Value.Item2; @@ -617,7 +617,7 @@ namespace Game do { - GossipMenus gMenu = new GossipMenus(); + GossipMenus gMenu = new(); gMenu.MenuId = result.Read(0); gMenu.TextId = result.Read(1); @@ -657,7 +657,7 @@ namespace Game do { - GossipMenuItems gMenuItem = new GossipMenuItems(); + GossipMenuItems gMenuItem = new(); gMenuItem.MenuId = result.Read(0); gMenuItem.OptionIndex = result.Read(1); @@ -731,7 +731,7 @@ namespace Game { uint id = result.Read(0); - PointOfInterest POI = new PointOfInterest(); + PointOfInterest POI = new(); POI.Id = id; POI.Pos = new Vector2(result.Read(1), result.Read(2)); POI.Icon = result.Read(3); @@ -830,14 +830,14 @@ namespace Game do { uint id = result.Read(0); - WorldLocation loc = new WorldLocation(result.Read(1), result.Read(2), result.Read(3), result.Read(4), result.Read(5)); + WorldLocation loc = new(result.Read(1), result.Read(2), result.Read(3), result.Read(4), result.Read(5)); if (!GridDefines.IsValidMapCoord(loc)) { Log.outError(LogFilter.Sql, $"World location (ID: {id}) has a invalid position MapID: {loc.GetMapId()} {loc}, skipped"); continue; } - WorldSafeLocsEntry worldSafeLocs = new WorldSafeLocsEntry(); + WorldSafeLocsEntry worldSafeLocs = new(); worldSafeLocs.Id = id; worldSafeLocs.Loc = loc; _worldSafeLocs[id] = worldSafeLocs; @@ -882,7 +882,7 @@ namespace Game var range = GraveYardStorage.LookupByKey(zoneId); MapRecord mapEntry = CliDB.MapStorage.LookupByKey(MapId); - ConditionSourceInfo conditionSource = new ConditionSourceInfo(conditionObject); + ConditionSourceInfo conditionSource = new(conditionObject); // not need to check validity of map object; MapId _MUST_ be valid here if (range.Empty() && !mapEntry.IsBattlegroundOrArena()) @@ -1014,7 +1014,7 @@ namespace Game return false; // add link to loaded data - GraveYardData data = new GraveYardData(); + GraveYardData data = new(); data.safeLocId = id; data.team = (uint)team; @@ -1185,7 +1185,7 @@ namespace Game uint count = 0; do { - ScriptInfo tmp = new ScriptInfo(); + ScriptInfo tmp = new(); tmp.type = type; tmp.id = result.Read(0); if (isSpellScriptTable) @@ -1503,7 +1503,7 @@ namespace Game { LoadScripts(ScriptsType.Event); - List evt_scripts = new List(); + List evt_scripts = new(); // Load all possible script entries from gameobjects foreach (var go in _gameObjectTemplateStorage) { @@ -1556,7 +1556,7 @@ namespace Game { LoadScripts(ScriptsType.Waypoint); - List actionSet = new List(); + List actionSet = new(); foreach (var script in sWaypointScripts) actionSet.Add(script.Key); @@ -1798,7 +1798,7 @@ namespace Game { uint entry = fields.Read(0); - CreatureTemplate creature = new CreatureTemplate(); + CreatureTemplate creature = new(); creature.Entry = entry; for (var i = 0; i < SharedConst.MaxCreatureDifficulties; ++i) @@ -1944,7 +1944,7 @@ namespace Game continue; } - CreatureAddon creatureAddon = new CreatureAddon(); + CreatureAddon creatureAddon = new(); creatureAddon.path_id = result.Read(1); creatureAddon.mount = result.Read(2); creatureAddon.bytes1 = result.Read(3); @@ -2052,7 +2052,7 @@ namespace Game continue; } - CreatureAddon creatureAddon = new CreatureAddon(); + CreatureAddon creatureAddon = new(); creatureAddon.path_id = result.Read(1); if (creData.movementType == (byte)MovementGeneratorType.Waypoint && creatureAddon.path_id == 0) @@ -2211,7 +2211,7 @@ namespace Game uint id = result.Read(1); - EquipmentInfo equipmentInfo = new EquipmentInfo(); + EquipmentInfo equipmentInfo = new(); for (var i = 0; i < SharedConst.MaxEquipmentItems; ++i) { @@ -2290,7 +2290,7 @@ namespace Game if (_class == 0 || ((1 << (_class - 1)) & (int)Class.ClassMaskAllCreatures) == 0) Log.outError(LogFilter.Sql, "Creature base stats for level {0} has invalid class {1}", Level, _class); - CreatureBaseStats stats = new CreatureBaseStats(); + CreatureBaseStats stats = new(); stats.BaseMana = result.Read(2); stats.AttackPower = result.Read(3); @@ -2338,7 +2338,7 @@ namespace Game continue; } - CreatureModelInfo modelInfo = new CreatureModelInfo(); + CreatureModelInfo modelInfo = new(); modelInfo.BoundingRadius = result.Read(1); modelInfo.CombatReach = result.Read(2); modelInfo.DisplayIdOtherGender = result.Read(3); @@ -2402,7 +2402,7 @@ namespace Game continue; } - CreatureLevelScaling creatureLevelScaling = new CreatureLevelScaling(); + CreatureLevelScaling creatureLevelScaling = new(); creatureLevelScaling.MinLevel = result.Read(2); creatureLevelScaling.MaxLevel = result.Read(3); creatureLevelScaling.DeltaLevelMin = result.Read(4); @@ -2924,7 +2924,7 @@ namespace Game continue; } - NpcText npcText = new NpcText(); + NpcText npcText = new(); for (int i = 0; i < SharedConst.MaxNpcTextOptions; i++) { npcText.Data[i].Probability = result.Read(1 + i); @@ -2964,13 +2964,13 @@ namespace Game // For reload case _trainers.Clear(); - MultiMap spellsByTrainer = new MultiMap(); + MultiMap spellsByTrainer = new(); SQLResult trainerSpellsResult = DB.World.Query("SELECT TrainerId, SpellId, MoneyCost, ReqSkillLine, ReqSkillRank, ReqAbility1, ReqAbility2, ReqAbility3, ReqLevel FROM trainer_spell"); if (!trainerSpellsResult.IsEmpty()) { do { - TrainerSpell spell = new TrainerSpell(); + TrainerSpell spell = new(); uint trainerId = trainerSpellsResult.Read(0); spell.SpellId = trainerSpellsResult.Read(1); spell.MoneyCost = trainerSpellsResult.Read(2); @@ -3021,7 +3021,7 @@ namespace Game uint trainerId = trainersResult.Read(0); TrainerType trainerType = (TrainerType)trainersResult.Read(1); string greeting = trainersResult.Read(2); - List spells = new List(); + List spells = new(); var spellList = spellsByTrainer.LookupByKey(trainerId); if (spellList != null) { @@ -3118,7 +3118,7 @@ namespace Game // For reload case cacheVendorItemStorage.Clear(); - List skipvendors = new List(); + List skipvendors = new(); SQLResult result = DB.World.Query("SELECT entry, item, maxcount, incrtime, ExtendedCost, type, BonusListIDs, PlayerConditionID, IgnoreFiltering FROM npc_vendor ORDER BY entry, slot ASC"); if (result.IsEmpty()) @@ -3139,7 +3139,7 @@ namespace Game count += LoadReferenceVendor((int)entry, -itemid, skipvendors); else { - VendorItem vItem = new VendorItem(); + VendorItem vItem = new(); vItem.item = (uint)itemid; vItem.maxcount = result.Read(2); vItem.incrtime = result.Read(3); @@ -3191,7 +3191,7 @@ namespace Game count += LoadReferenceVendor(vendor, -item_id, skip_vendors); else { - VendorItem vItem = new VendorItem(); + VendorItem vItem = new(); vItem.item = (uint)item_id; vItem.maxcount = result.Read(1); vItem.incrtime = result.Read(2); @@ -3243,7 +3243,7 @@ namespace Game } // Build single time for check spawnmask - Dictionary> spawnMasks = new Dictionary>(); + Dictionary> spawnMasks = new(); foreach (var mapDifficultyPair in Global.DB2Mgr.GetMapDifficulties()) { foreach (var difficultyPair in mapDifficultyPair.Value) @@ -3255,7 +3255,7 @@ namespace Game } } - PhaseShift phaseShift = new PhaseShift(); + PhaseShift phaseShift = new(); uint count = 0; do @@ -3270,7 +3270,7 @@ namespace Game continue; } - CreatureData data = new CreatureData(); + CreatureData data = new(); data.spawnId = guid; data.Id = entry; data.spawnPoint = new WorldLocation(result.Read(2), result.Read(3), result.Read(4), result.Read(5), result.Read(6)); @@ -3669,7 +3669,7 @@ namespace Game foreach (GameObjectsRecord db2go in CliDB.GameObjectsStorage.Values) { - GameObjectTemplate go = new GameObjectTemplate(); + GameObjectTemplate go = new(); go.entry = db2go.Id; go.type = db2go.TypeID; go.displayId = db2go.DisplayID; @@ -3708,7 +3708,7 @@ namespace Game { uint entry = result.Read(0); - GameObjectTemplate got = new GameObjectTemplate(); + GameObjectTemplate got = new(); got.entry = entry; got.type = (GameObjectTypes)result.Read(1); @@ -3883,7 +3883,7 @@ namespace Game continue; } - GameObjectTemplateAddon gameObjectAddon = new GameObjectTemplateAddon(); + GameObjectTemplateAddon gameObjectAddon = new(); gameObjectAddon.faction = result.Read(1); gameObjectAddon.flags = result.Read(2); gameObjectAddon.mingold = result.Read(3); @@ -3948,7 +3948,7 @@ namespace Game uint count = 0; // build single time for check spawnmask - Dictionary> spawnMasks = new Dictionary>(); + Dictionary> spawnMasks = new(); foreach (var mapDifficultyPair in Global.DB2Mgr.GetMapDifficulties()) { foreach (var difficultyPair in mapDifficultyPair.Value) @@ -3960,7 +3960,7 @@ namespace Game } } - PhaseShift phaseShift = new PhaseShift(); + PhaseShift phaseShift = new(); do { @@ -3993,7 +3993,7 @@ namespace Game continue; } - GameObjectData data = new GameObjectData(); + GameObjectData data = new(); data.spawnId = guid; data.Id = entry; data.spawnPoint = new WorldLocation(result.Read(2), result.Read(3), result.Read(4), result.Read(5), result.Read(6)); @@ -4175,7 +4175,7 @@ namespace Game continue; } - GameObjectAddon gameObjectAddon = new GameObjectAddon(); + GameObjectAddon gameObjectAddon = new(); gameObjectAddon.ParentRotation = new Quaternion(result.Read(1), result.Read(2), result.Read(3), result.Read(4)); gameObjectAddon.invisibilityType = (InvisibilityType)result.Read(5); gameObjectAddon.invisibilityValue = result.Read(6); @@ -4485,8 +4485,8 @@ namespace Game List ParseSpawnDifficulties(string difficultyString, string table, ulong spawnId, uint mapId, List mapDifficulties) { - List difficulties = new List(); - StringArray tokens = new StringArray(difficultyString, ','); + List difficulties = new(); + StringArray tokens = new(difficultyString, ','); if (tokens.Length == 0) return difficulties; @@ -4546,7 +4546,7 @@ namespace Game } else { - ItemSpecStats itemSpecStats = new ItemSpecStats(db2Data, sparse); + ItemSpecStats itemSpecStats = new(db2Data, sparse); foreach (ItemSpecRecord itemSpec in CliDB.ItemSpecStorage.Values) { @@ -4979,7 +4979,7 @@ namespace Game { uint id = result.Read(0); - GameTele gt = new GameTele(); + GameTele gt = new(); gt.posX = result.Read(1); gt.posY = result.Read(2); @@ -5030,7 +5030,7 @@ namespace Game continue; } - AreaTriggerStruct at = new AreaTriggerStruct(); + AreaTriggerStruct at = new(); at.target_mapId = portLoc.Loc.GetMapId(); at.target_X = portLoc.Loc.GetPositionX(); at.target_Y = portLoc.Loc.GetPositionY(); @@ -5084,7 +5084,7 @@ namespace Game ulong requirementId = MathFunctions.MakePair64(mapid, difficulty); - AccessRequirement ar = new AccessRequirement(); + AccessRequirement ar = new(); ar.levelMin = result.Read(2); ar.levelMax = result.Read(3); ar.item = result.Read(4); @@ -5160,7 +5160,7 @@ namespace Game } uint count = 0; - Dictionary> dungeonLastBosses = new Dictionary>(); + Dictionary> dungeonLastBosses = new(); do { uint entry = result.Read(0); @@ -5259,7 +5259,7 @@ namespace Game do { uint groupId = result.Read(0); - SpawnGroupTemplateData group = new SpawnGroupTemplateData(); + SpawnGroupTemplateData group = new(); group.groupId = groupId; group.name = result.Read(1); group.mapId = 0xFFFFFFFF; @@ -5283,7 +5283,7 @@ namespace Game if (!_spawnGroupDataStorage.ContainsKey(0)) { Log.outError(LogFilter.Sql, "Default spawn group (index 0) is missing from DB! Manually inserted."); - SpawnGroupTemplateData data = new SpawnGroupTemplateData(); + SpawnGroupTemplateData data = new(); data.groupId = 0; data.name = "Default Group"; data.mapId = 0; @@ -5295,7 +5295,7 @@ namespace Game { Log.outError(LogFilter.Sql, "Default legacy spawn group (index 1) is missing from DB! Manually inserted."); - SpawnGroupTemplateData data = new SpawnGroupTemplateData(); + SpawnGroupTemplateData data = new(); data.groupId = 1; data.name = "Legacy Group"; data.mapId = 0; @@ -5392,7 +5392,7 @@ namespace Game continue; } - InstanceSpawnGroupInfo info = new InstanceSpawnGroupInfo(); + InstanceSpawnGroupInfo info = new(); info.SpawnGroupId = spawnGroupId; info.BossStateId = result.Read(1); @@ -5591,7 +5591,7 @@ namespace Game continue; } - PlayerInfo pInfo = new PlayerInfo(); + PlayerInfo pInfo = new(); pInfo.MapId = mapId; pInfo.ZoneId = zoneId; pInfo.PositionX = positionX; @@ -5613,7 +5613,7 @@ namespace Game // Load playercreate items Log.outInfo(LogFilter.ServerLoading, "Loading Player Create Items Data..."); { - MultiMap itemsByCharacterLoadout = new MultiMap(); + MultiMap itemsByCharacterLoadout = new(); foreach (CharacterLoadoutItemRecord characterLoadoutItem in CliDB.CharacterLoadoutItemStorage.Values) { ItemTemplate itemTemplate = GetItemTemplate(characterLoadoutItem.ItemID); @@ -6279,7 +6279,7 @@ namespace Game if (pInfoMapEntry == null) pInfoMapEntry = new PetLevelInfo[WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)]; - PetLevelInfo pLevelInfo = new PetLevelInfo(); + PetLevelInfo pLevelInfo = new(); pLevelInfo.health = result.Read(2); pLevelInfo.mana = result.Read(3); pLevelInfo.armor = result.Read(9); @@ -6640,7 +6640,7 @@ namespace Game // for example set of race quests can lead to single not race specific quest do { - Quest newQuest = new Quest(result.GetFields()); + Quest newQuest = new(result.GetFields()); _questTemplates[newQuest.Id] = newQuest; if (newQuest.IsAutoPush()) _questTemplatesAutoPush.Add(newQuest); @@ -6858,7 +6858,7 @@ namespace Game } while (result.NextRow()); } - Dictionary usedMailTemplates = new Dictionary(); + Dictionary usedMailTemplates = new(); // Post processing foreach (var qinfo in _questTemplates.Values) @@ -7622,7 +7622,7 @@ namespace Game return; } - Dictionary> allPoints = new Dictionary>(); + Dictionary> allPoints = new(); // 0 1 2 3 4 SQLResult pointsResult = DB.World.Query("SELECT QuestID, Idx1, X, Y, Z FROM quest_poi_points ORDER BY QuestID DESC, Idx1, Idx2"); @@ -8095,7 +8095,7 @@ namespace Game Log.outError(LogFilter.Sql, "Table npc_spellclick_spells creature: {0} references unknown user type {1}. Skipping entry.", npc_entry, userType); byte castFlags = result.Read(2); - SpellClickInfo info = new SpellClickInfo(); + SpellClickInfo info = new(); info.spellId = spellid; info.castFlags = castFlags; info.userType = userType; @@ -8171,7 +8171,7 @@ namespace Game do { uint id = result.Read(0); - SkillTiersEntry tier = new SkillTiersEntry(); + SkillTiersEntry tier = new(); for (int i = 0; i < SkillConst.MaxSkillStep; ++i) tier.Value[i] = result.Read(1 + i); @@ -8466,7 +8466,7 @@ namespace Game if (!SharedConst.IsValidLocale(locale) || locale == Locale.enUS) continue; - GossipMenuItemsLocale data = new GossipMenuItemsLocale(); + GossipMenuItemsLocale data = new(); AddLocaleString(result.Read(3), locale, data.OptionText); AddLocaleString(result.Read(4), locale, data.BoxText); @@ -8590,7 +8590,7 @@ namespace Game { uint factionId = result.Read(0); - RepRewardRate repRate = new RepRewardRate(); + RepRewardRate repRate = new(); repRate.questRate = result.Read(1); repRate.questDailyRate = result.Read(2); @@ -8680,7 +8680,7 @@ namespace Game { uint creature_id = result.Read(0); - ReputationOnKillEntry repOnKill = new ReputationOnKillEntry(); + ReputationOnKillEntry repOnKill = new(); repOnKill.RepFaction1 = result.Read(1); repOnKill.RepFaction2 = result.Read(2); repOnKill.IsTeamAward1 = result.Read(3); @@ -8744,7 +8744,7 @@ namespace Game { uint factionId = result.Read(0); - RepSpilloverTemplate repTemplate = new RepSpilloverTemplate(); + RepSpilloverTemplate repTemplate = new(); repTemplate.faction[0] = result.Read(1); repTemplate.faction_rate[0] = result.Read(2); repTemplate.faction_rank[0] = result.Read(3); @@ -8975,7 +8975,7 @@ namespace Game continue; } - TempSummonData data = new TempSummonData(); + TempSummonData data = new(); data.entry = result.Read(3); if (GetCreatureTemplate(data.entry) == null) @@ -9030,7 +9030,7 @@ namespace Game { uint id = result.Read(0); - PageText pageText = new PageText(); + PageText pageText = new(); pageText.Text = result.Read(1); pageText.NextPageID = result.Read(2); pageText.PlayerConditionID = result.Read(3); @@ -9105,13 +9105,13 @@ namespace Game return; // any mails need to be returned or deleted } - MultiMap itemsCache = new MultiMap(); + MultiMap itemsCache = new(); stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_EXPIRED_MAIL_ITEMS); stmt.AddValue(0, (uint)basetime); SQLResult items = DB.Characters.Query(stmt); if (!items.IsEmpty()) { - MailItemInfo item = new MailItemInfo(); + MailItemInfo item = new(); do { item.item_guid = result.Read(0); @@ -9125,7 +9125,7 @@ namespace Game uint returnedCount = 0; do { - Mail m = new Mail(); + Mail m = new(); m.messageID = result.Read(0); m.messageType = (MailMessageType)result.Read(1); m.sender = result.Read(2); @@ -9223,7 +9223,7 @@ namespace Game do { uint sceneId = result.Read(0); - SceneTemplate sceneTemplate = new SceneTemplate(); + SceneTemplate sceneTemplate = new(); sceneTemplate.SceneId = sceneId; sceneTemplate.PlaybackFlags = (SceneFlags)result.Read(1); sceneTemplate.ScenePackageId = result.Read(2); @@ -9258,7 +9258,7 @@ namespace Game do { - PlayerChoice choice = new PlayerChoice(); + PlayerChoice choice = new(); choice.ChoiceId = choiceResult.Read(0); choice.UiTextureKitId = choiceResult.Read(1); choice.SoundKitId = choiceResult.Read(2); @@ -9289,7 +9289,7 @@ namespace Game } PlayerChoice choice = _playerChoices[choiceId]; - PlayerChoiceResponse response = new PlayerChoiceResponse(); + PlayerChoiceResponse response = new(); response.ResponseId = responseId; response.ResponseIdentifier = responses.Read(2); @@ -9338,7 +9338,7 @@ namespace Game continue; } - PlayerChoiceResponseReward reward = new PlayerChoiceResponseReward(); + PlayerChoiceResponseReward reward = new(); reward.TitleId = rewards.Read(2); reward.PackageId = rewards.Read(3); reward.SkillLineId = rewards.Read(4); @@ -9381,8 +9381,8 @@ namespace Game int choiceId = rewardItem.Read(0); int responseId = rewardItem.Read(1); uint itemId = rewardItem.Read(2); - StringArray bonusListIDsTok = new StringArray(rewardItem.Read(3), ' '); - List bonusListIds = new List(); + StringArray bonusListIDsTok = new(rewardItem.Read(3), ' '); + List bonusListIds = new(); if (!bonusListIDsTok.IsEmpty()) { foreach (uint token in bonusListIDsTok) @@ -9515,8 +9515,8 @@ namespace Game int choiceId = rewardItems.Read(0); int responseId = rewardItems.Read(1); uint itemId = rewardItems.Read(2); - StringArray bonusListIDsTok = new StringArray(rewardItems.Read(3), ' '); - List bonusListIds = new List(); + StringArray bonusListIDsTok = new(rewardItems.Read(3), ' '); + List bonusListIds = new(); foreach (string token in bonusListIDsTok) bonusListIds.Add(uint.Parse(token)); @@ -9576,7 +9576,7 @@ namespace Game continue; } - PlayerChoiceResponseMawPower mawPower = new PlayerChoiceResponseMawPower(); + PlayerChoiceResponseMawPower mawPower = new(); mawPower.TypeArtFileID = mawPowersResult.Read(2); mawPower.Rarity = mawPowersResult.Read(3); mawPower.RarityColor = mawPowersResult.Read(4); @@ -9972,7 +9972,7 @@ namespace Game } public uint GetTaxiMountDisplayId(uint id, Team team, bool allowed_alt_team = false) { - CreatureModel mountModel = new CreatureModel(); + CreatureModel mountModel = new(); CreatureTemplate mount_info = null; // select mount creature id @@ -10110,7 +10110,7 @@ namespace Game continue; } - VehicleTemplate vehicleTemplate = new VehicleTemplate(); + VehicleTemplate vehicleTemplate = new(); vehicleTemplate.DespawnDelay = TimeSpan.FromMilliseconds(result.Read(1)); _vehicleTemplateStore[creatureId] = vehicleTemplate; @@ -10233,137 +10233,137 @@ namespace Game #region Fields public static LanguageDesc[] lang_description; //General - Dictionary CypherStringStorage = new Dictionary(); - Dictionary _repRewardRateStorage = new Dictionary(); - Dictionary _repOnKillStorage = new Dictionary(); - Dictionary _repSpilloverTemplateStorage = new Dictionary(); - MultiMap _mailLevelRewardStorage = new MultiMap(); - MultiMap, TempSummonData> _tempSummonDataStorage = new MultiMap, TempSummonData>(); - Dictionary _playerChoices = new Dictionary(); - Dictionary _pageTextStorage = new Dictionary(); - List _reservedNamesStorage = new List(); - Dictionary _sceneTemplateStorage = new Dictionary(); + Dictionary CypherStringStorage = new(); + Dictionary _repRewardRateStorage = new(); + Dictionary _repOnKillStorage = new(); + Dictionary _repSpilloverTemplateStorage = new(); + MultiMap _mailLevelRewardStorage = new(); + MultiMap, TempSummonData> _tempSummonDataStorage = new(); + Dictionary _playerChoices = new(); + Dictionary _pageTextStorage = new(); + List _reservedNamesStorage = new(); + Dictionary _sceneTemplateStorage = new(); - Dictionary _raceUnlockRequirementStorage = new Dictionary(); - List _classExpansionRequirementStorage = new List(); - Dictionary _realmNameStorage = new Dictionary(); + Dictionary _raceUnlockRequirementStorage = new(); + List _classExpansionRequirementStorage = new(); + Dictionary _realmNameStorage = new(); //Quest - Dictionary _questTemplates = new Dictionary(); - List _questTemplatesAutoPush = new List(); - MultiMap _goQuestRelations = new MultiMap(); - MultiMap _goQuestInvolvedRelations = new MultiMap(); - MultiMap _goQuestInvolvedRelationsReverse = new MultiMap(); - MultiMap _creatureQuestRelations = new MultiMap(); - MultiMap _creatureQuestInvolvedRelations = new MultiMap(); - MultiMap _creatureQuestInvolvedRelationsReverse = new MultiMap(); - MultiMap _exclusiveQuestGroups = new MultiMap(); - Dictionary _questPOIStorage = new Dictionary(); - MultiMap _questAreaTriggerStorage = new MultiMap(); - Dictionary _questObjectives = new Dictionary(); + Dictionary _questTemplates = new(); + List _questTemplatesAutoPush = new(); + MultiMap _goQuestRelations = new(); + MultiMap _goQuestInvolvedRelations = new(); + MultiMap _goQuestInvolvedRelationsReverse = new(); + MultiMap _creatureQuestRelations = new(); + MultiMap _creatureQuestInvolvedRelations = new(); + MultiMap _creatureQuestInvolvedRelationsReverse = new(); + MultiMap _exclusiveQuestGroups = new(); + Dictionary _questPOIStorage = new(); + MultiMap _questAreaTriggerStorage = new(); + Dictionary _questObjectives = new(); Dictionary[] _questGreetingStorage = new Dictionary[2]; Dictionary[] _questGreetingLocaleStorage = new Dictionary[2]; //Scripts - List scriptNamesStorage = new List(); - MultiMap spellScriptsStorage = new MultiMap(); - public Dictionary> sSpellScripts = new Dictionary>(); - public Dictionary> sEventScripts = new Dictionary>(); - public Dictionary> sWaypointScripts = new Dictionary>(); - Dictionary areaTriggerScriptStorage = new Dictionary(); + List scriptNamesStorage = new(); + MultiMap spellScriptsStorage = new(); + public Dictionary> sSpellScripts = new(); + public Dictionary> sEventScripts = new(); + public Dictionary> sWaypointScripts = new(); + Dictionary areaTriggerScriptStorage = new(); //Maps - public Dictionary gameTeleStorage = new Dictionary(); - Dictionary> mapObjectGuidsStore = new Dictionary>(); - Dictionary instanceTemplateStorage = new Dictionary(); - public MultiMap GraveYardStorage = new MultiMap(); - List _transportMaps = new List(); - Dictionary _spawnGroupDataStorage = new Dictionary(); - MultiMap _spawnGroupMapStorage = new MultiMap(); - MultiMap _instanceSpawnGroupStorage = new MultiMap(); + public Dictionary gameTeleStorage = new(); + Dictionary> mapObjectGuidsStore = new(); + Dictionary instanceTemplateStorage = new(); + public MultiMap GraveYardStorage = new(); + List _transportMaps = new(); + Dictionary _spawnGroupDataStorage = new(); + MultiMap _spawnGroupMapStorage = new(); + MultiMap _instanceSpawnGroupStorage = new(); //Spells /Skills / Phases - Dictionary _phaseInfoById = new Dictionary(); - Dictionary _terrainSwapInfoById = new Dictionary(); - MultiMap _phaseInfoByArea = new MultiMap(); - MultiMap _terrainSwapInfoByMap = new MultiMap(); - MultiMap _spellClickInfoStorage = new MultiMap(); - Dictionary _fishingBaseForAreaStorage = new Dictionary(); - Dictionary _skillTiers = new Dictionary(); + Dictionary _phaseInfoById = new(); + Dictionary _terrainSwapInfoById = new(); + MultiMap _phaseInfoByArea = new(); + MultiMap _terrainSwapInfoByMap = new(); + MultiMap _spellClickInfoStorage = new(); + Dictionary _fishingBaseForAreaStorage = new(); + Dictionary _skillTiers = new(); //Gossip - MultiMap gossipMenuItemsStorage = new MultiMap(); - MultiMap gossipMenusStorage = new MultiMap(); - Dictionary pointsOfInterestStorage = new Dictionary(); + MultiMap gossipMenuItemsStorage = new(); + MultiMap gossipMenusStorage = new(); + Dictionary pointsOfInterestStorage = new(); //Creature - Dictionary _creatureTemplateStorage = new Dictionary(); - Dictionary creatureModelStorage = new Dictionary(); - Dictionary creatureDataStorage = new Dictionary(); - Dictionary creatureAddonStorage = new Dictionary(); - MultiMap _creatureQuestItemStorage = new MultiMap(); - Dictionary creatureTemplateAddonStorage = new Dictionary(); - MultiMap> equipmentInfoStorage = new MultiMap>(); - Dictionary linkedRespawnStorage = new Dictionary(); - Dictionary creatureBaseStatsStorage = new Dictionary(); - Dictionary cacheVendorItemStorage = new Dictionary(); - Dictionary _trainers = new Dictionary(); - Dictionary<(uint creatureId, uint gossipMenuId, uint gossipOptionIndex), uint> _creatureDefaultTrainers = new Dictionary<(uint creatureId, uint gossipMenuId, uint gossipOptionIndex), uint>(); + Dictionary _creatureTemplateStorage = new(); + Dictionary creatureModelStorage = new(); + Dictionary creatureDataStorage = new(); + Dictionary creatureAddonStorage = new(); + MultiMap _creatureQuestItemStorage = new(); + Dictionary creatureTemplateAddonStorage = new(); + MultiMap> equipmentInfoStorage = new(); + Dictionary linkedRespawnStorage = new(); + Dictionary creatureBaseStatsStorage = new(); + Dictionary cacheVendorItemStorage = new(); + Dictionary _trainers = new(); + Dictionary<(uint creatureId, uint gossipMenuId, uint gossipOptionIndex), uint> _creatureDefaultTrainers = new(); List[] _difficultyEntries = new List[SharedConst.MaxCreatureDifficulties]; // already loaded difficulty 1 value in creatures, used in CheckCreatureTemplate List[] _hasDifficultyEntries = new List[SharedConst.MaxCreatureDifficulties]; // already loaded creatures with difficulty 1 values, used in CheckCreatureTemplate - Dictionary _npcTextStorage = new Dictionary(); + Dictionary _npcTextStorage = new(); //GameObject - Dictionary _gameObjectTemplateStorage = new Dictionary(); - Dictionary gameObjectDataStorage = new Dictionary(); - Dictionary _gameObjectTemplateAddonStorage = new Dictionary(); - Dictionary _gameObjectAddonStorage = new Dictionary(); - MultiMap _gameObjectQuestItemStorage = new MultiMap(); - List _gameObjectForQuestStorage = new List(); + Dictionary _gameObjectTemplateStorage = new(); + Dictionary gameObjectDataStorage = new(); + Dictionary _gameObjectTemplateAddonStorage = new(); + Dictionary _gameObjectAddonStorage = new(); + MultiMap _gameObjectQuestItemStorage = new(); + List _gameObjectForQuestStorage = new(); //Item - Dictionary ItemTemplateStorage = new Dictionary(); + Dictionary ItemTemplateStorage = new(); //Player PlayerInfo[][] _playerInfo = new PlayerInfo[(int)Race.Max][]; //Faction Change - public Dictionary FactionChangeAchievements = new Dictionary(); - public Dictionary FactionChangeItems = new Dictionary(); - public Dictionary FactionChangeQuests = new Dictionary(); - public Dictionary FactionChangeReputation = new Dictionary(); - public Dictionary FactionChangeSpells = new Dictionary(); - public Dictionary FactionChangeTitles = new Dictionary(); + public Dictionary FactionChangeAchievements = new(); + public Dictionary FactionChangeItems = new(); + public Dictionary FactionChangeQuests = new(); + public Dictionary FactionChangeReputation = new(); + public Dictionary FactionChangeSpells = new(); + public Dictionary FactionChangeTitles = new(); //Pets - Dictionary petInfoStore = new Dictionary(); - MultiMap _petHalfName0 = new MultiMap(); - MultiMap _petHalfName1 = new MultiMap(); + Dictionary petInfoStore = new(); + MultiMap _petHalfName0 = new(); + MultiMap _petHalfName1 = new(); //Vehicles - Dictionary _vehicleTemplateStore = new Dictionary(); - MultiMap _vehicleTemplateAccessoryStore = new MultiMap(); - MultiMap _vehicleAccessoryStore = new MultiMap(); + Dictionary _vehicleTemplateStore = new(); + MultiMap _vehicleTemplateAccessoryStore = new(); + MultiMap _vehicleAccessoryStore = new(); //Locales - Dictionary _creatureLocaleStorage = new Dictionary(); - Dictionary _gameObjectLocaleStorage = new Dictionary(); - Dictionary _questTemplateLocaleStorage = new Dictionary(); - Dictionary _questObjectivesLocaleStorage = new Dictionary(); - Dictionary _questOfferRewardLocaleStorage = new Dictionary(); - Dictionary _questRequestItemsLocaleStorage = new Dictionary(); - Dictionary, GossipMenuItemsLocale> _gossipMenuItemsLocaleStorage = new Dictionary, GossipMenuItemsLocale>(); - Dictionary _pageTextLocaleStorage = new Dictionary(); - Dictionary _pointOfInterestLocaleStorage = new Dictionary(); - Dictionary _playerChoiceLocales = new Dictionary(); + Dictionary _creatureLocaleStorage = new(); + Dictionary _gameObjectLocaleStorage = new(); + Dictionary _questTemplateLocaleStorage = new(); + Dictionary _questObjectivesLocaleStorage = new(); + Dictionary _questOfferRewardLocaleStorage = new(); + Dictionary _questRequestItemsLocaleStorage = new(); + Dictionary, GossipMenuItemsLocale> _gossipMenuItemsLocaleStorage = new(); + Dictionary _pageTextLocaleStorage = new(); + Dictionary _pointOfInterestLocaleStorage = new(); + Dictionary _playerChoiceLocales = new(); - List _tavernAreaTriggerStorage = new List(); - Dictionary _areaTriggerStorage = new Dictionary(); - Dictionary _accessRequirementStorage = new Dictionary(); - MultiMap _dungeonEncounterStorage = new MultiMap(); - Dictionary _worldSafeLocs = new Dictionary(); + List _tavernAreaTriggerStorage = new(); + Dictionary _areaTriggerStorage = new(); + Dictionary _accessRequirementStorage = new(); + MultiMap _dungeonEncounterStorage = new(); + Dictionary _worldSafeLocs = new(); - Dictionary _guidGenerators = new Dictionary(); + Dictionary _guidGenerators = new(); // first free id for selected id type uint _auctionId; ulong _equipmentSetGuid; @@ -10373,7 +10373,7 @@ namespace Game ulong _gameObjectSpawnId; ulong _voidItemId; uint[] _playerXPperLevel; - Dictionary _baseXPTable = new Dictionary(); + Dictionary _baseXPTable = new(); #endregion } @@ -10667,8 +10667,8 @@ namespace Game public class CellObjectGuids { - public SortedSet creatures = new SortedSet(); - public SortedSet gameobjects = new SortedSet(); + public SortedSet creatures = new(); + public SortedSet gameobjects = new(); } public class GameTele @@ -11160,7 +11160,7 @@ namespace Game } public uint Id; - public List UiMapPhaseIDs = new List(); + public List UiMapPhaseIDs = new(); } public class PhaseInfoStruct @@ -11176,7 +11176,7 @@ namespace Game } public uint Id; - public List Areas = new List(); + public List Areas = new(); } public class PhaseAreaInfo @@ -11187,8 +11187,8 @@ namespace Game } public PhaseInfoStruct PhaseInfo; - public List SubAreaExclusions = new List(); - public List Conditions = new List(); + public List SubAreaExclusions = new(); + public List Conditions = new(); } public class SceneTemplate @@ -11212,24 +11212,24 @@ namespace Game public class GossipMenuItemsLocale { - public StringArray OptionText = new StringArray((int)Locale.Total); - public StringArray BoxText = new StringArray((int)Locale.Total); + public StringArray OptionText = new((int)Locale.Total); + public StringArray BoxText = new((int)Locale.Total); } public class PlayerChoiceLocale { - public StringArray Question = new StringArray((int)Locale.Total); - public Dictionary Responses = new Dictionary(); + public StringArray Question = new((int)Locale.Total); + public Dictionary Responses = new(); } public class PlayerChoiceResponseLocale { - public StringArray Answer = new StringArray((int)Locale.Total); - public StringArray Header = new StringArray((int)Locale.Total); - public StringArray SubHeader = new StringArray((int)Locale.Total); - public StringArray ButtonTooltip = new StringArray((int)Locale.Total); - public StringArray Description = new StringArray((int)Locale.Total); - public StringArray Confirmation = new StringArray((int)Locale.Total); + public StringArray Answer = new((int)Locale.Total); + public StringArray Header = new((int)Locale.Total); + public StringArray SubHeader = new((int)Locale.Total); + public StringArray ButtonTooltip = new((int)Locale.Total); + public StringArray Description = new((int)Locale.Total); + public StringArray Confirmation = new((int)Locale.Total); } public class PlayerChoiceResponseRewardItem @@ -11243,7 +11243,7 @@ namespace Game } public uint Id; - public List BonusListIDs = new List(); + public List BonusListIDs = new(); public int Quantity; } @@ -11270,10 +11270,10 @@ namespace Game public ulong Money; public uint Xp; - public List Items = new List(); - public List Currency = new List(); - public List Faction = new List(); - public List ItemChoices = new List(); + public List Items = new(); + public List Currency = new(); + public List Faction = new(); + public List ItemChoices = new(); } public struct PlayerChoiceResponseMawPower @@ -11318,7 +11318,7 @@ namespace Game public int UiTextureKitId; public uint SoundKitId; public string Question; - public List Responses = new List(); + public List Responses = new(); public bool HideWarboardHeader; public bool KeepOpenAfterChoice; } @@ -11333,7 +11333,7 @@ namespace Game public class RaceClassAvailability { public byte RaceID; - public List Classes = new List(); + public List Classes = new(); } public class RaceUnlockRequirement diff --git a/Source/Game/Groups/Group.cs b/Source/Game/Groups/Group.cs index 5ec4470cd..0755a6a21 100644 --- a/Source/Game/Groups/Group.cs +++ b/Source/Game/Groups/Group.cs @@ -151,7 +151,7 @@ namespace Game.Groups public void LoadMemberFromDB(ulong guidLow, byte memberFlags, byte subgroup, LfgRoles roles) { - MemberSlot member = new MemberSlot(); + MemberSlot member = new(); member.guid = ObjectGuid.Create(HighGuid.Player, guidLow); // skip non-existed member @@ -339,7 +339,7 @@ namespace Game.Groups return false; } - MemberSlot member = new MemberSlot(); + MemberSlot member = new(); member.guid = player.GetGUID(); member.name = player.GetName(); member._class = (byte)player.GetClass(); @@ -429,7 +429,7 @@ namespace Game.Groups { // Broadcast new player group member fields to rest of the group - UpdateData groupData = new UpdateData(player.GetMapId()); + UpdateData groupData = new(player.GetMapId()); UpdateObject groupDataPacket; // Broadcast group members' fields to player @@ -446,7 +446,7 @@ namespace Game.Groups if (existingMember.HaveAtClient(player)) { - UpdateData newData = new UpdateData(player.GetMapId()); + UpdateData newData = new(player.GetMapId()); UpdateObject newDataPacket; player.BuildValuesUpdateBlockForPlayerWithFlag(newData, UpdateFieldFlag.PartyMember, existingMember); if (newData.HasData()) @@ -632,7 +632,7 @@ namespace Game.Groups if (!IsBGGroup() && !IsBFGroup()) { PreparedStatement stmt; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); // Remove the groups permanent instance bindings foreach (var difficultyDic in m_boundInstances.Values) @@ -677,7 +677,7 @@ namespace Game.Groups m_leaderName = newLeader.GetName(); ToggleGroupMemberFlag(slot, GroupMemberFlags.Assistant, false); - GroupNewLeader groupNewLeader = new GroupNewLeader(); + GroupNewLeader groupNewLeader = new(); groupNewLeader.Name = m_leaderName; groupNewLeader.PartyIndex = partyIndex; BroadcastPacket(groupNewLeader, true); @@ -768,7 +768,7 @@ namespace Game.Groups if (!IsBGGroup() && !IsBFGroup()) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GROUP); stmt.AddValue(0, m_dbStoreId); @@ -796,7 +796,7 @@ namespace Game.Groups void SendLootStartRollToPlayer(uint countDown, uint mapId, Player p, bool canNeed, Roll r) { - StartLootRoll startLootRoll = new StartLootRoll(); + StartLootRoll startLootRoll = new(); startLootRoll.LootObj = r.GetTarget().GetGUID(); startLootRoll.MapID = (int)mapId; startLootRoll.RollTime = countDown; @@ -816,7 +816,7 @@ namespace Game.Groups void SendLootRoll(ObjectGuid playerGuid, int rollNumber, RollType rollType, Roll roll) { - LootRollBroadcast lootRoll = new LootRollBroadcast(); + LootRollBroadcast lootRoll = new(); lootRoll.LootObj = roll.GetTarget().GetGUID(); lootRoll.Player = playerGuid; lootRoll.Roll = rollNumber; @@ -836,7 +836,7 @@ namespace Game.Groups void SendLootRollWon(ObjectGuid winnerGuid, int rollNumber, RollType rollType, Roll roll) { - LootRollWon lootRollWon = new LootRollWon(); + LootRollWon lootRollWon = new(); lootRollWon.LootObj = roll.GetTarget().GetGUID(); lootRollWon.Winner = winnerGuid; lootRollWon.Roll = rollNumber; @@ -857,7 +857,7 @@ namespace Game.Groups void SendLootAllPassed(Roll roll) { - LootAllPassed lootAllPassed = new LootAllPassed(); + LootAllPassed lootAllPassed = new(); lootAllPassed.LootObj = roll.GetTarget().GetGUID(); roll.FillPacket(lootAllPassed.Item); @@ -874,7 +874,7 @@ namespace Game.Groups void SendLootRollsComplete(Roll roll) { - LootRollsComplete lootRollsComplete = new LootRollsComplete(); + LootRollsComplete lootRollsComplete = new(); lootRollsComplete.LootObj = roll.GetTarget().GetGUID(); lootRollsComplete.LootListID = (byte)(roll.itemSlot + 1); @@ -894,7 +894,7 @@ namespace Game.Groups { Cypher.Assert(creature); - LootList lootList = new LootList(); + LootList lootList = new(); lootList.Owner = creature.GetGUID(); lootList.LootObj = creature.loot.GetGUID(); @@ -923,7 +923,7 @@ namespace Game.Groups //roll for over-threshold item if it's one-player loot if (item.GetQuality() >= m_lootThreshold) { - Roll r = new Roll(lootItem); + Roll r = new(lootItem); for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next()) { @@ -994,7 +994,7 @@ namespace Game.Groups continue; ItemTemplate item = Global.ObjectMgr.GetItemTemplate(i.itemid); - Roll r = new Roll(i); + Roll r = new(i); for (var refe = GetFirstMember(); refe != null; refe = refe.Next()) { @@ -1050,7 +1050,7 @@ namespace Game.Groups public void MasterLoot(Loot loot, WorldObject pLootedObject) { - MasterLootCandidateList masterLootCandidateList = new MasterLootCandidateList(); + MasterLootCandidateList masterLootCandidateList = new(); masterLootCandidateList.LootObj = loot.GetGUID(); for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next()) @@ -1176,7 +1176,7 @@ namespace Game.Groups { player.UpdateCriteria(CriteriaTypes.RollNeedOnLoot, roll.itemid, maxresul); - List dest = new List(); + List dest = new(); LootItem item = (roll.itemSlot >= roll.GetLoot().items.Count ? roll.GetLoot().quest_items[roll.itemSlot - roll.GetLoot().items.Count] : roll.GetLoot().items[roll.itemSlot]); InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, roll.itemid, item.count); if (msg == InventoryResult.Ok) @@ -1243,7 +1243,7 @@ namespace Game.Groups if (rollVote == RollType.Greed) { - List dest = new List(); + List dest = new(); InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, roll.itemid, item.count); if (msg == InventoryResult.Ok) { @@ -1268,13 +1268,13 @@ namespace Game.Groups ItemDisenchantLootRecord disenchant = roll.GetItemDisenchantLoot(player); - List dest = new List(); + List dest = new(); InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, roll.itemid, item.count); if (msg == InventoryResult.Ok) player.AutoStoreLoot(disenchant.Id, LootStorage.Disenchant, ItemContext.None, true); else // If the player's inventory is full, send the disenchant result in a mail. { - Loot loot = new Loot(); + Loot loot = new(); loot.FillLoot(disenchant.Id, LootStorage.Disenchant, player, true); uint max_slot = loot.GetMaxSlotInLootFor(player); @@ -1320,7 +1320,7 @@ namespace Game.Groups m_targetIcons[symbol] = target; - SendRaidTargetUpdateSingle updateSingle = new SendRaidTargetUpdateSingle(); + SendRaidTargetUpdateSingle updateSingle = new(); updateSingle.PartyIndex = partyIndex; updateSingle.Target = target; updateSingle.ChangedBy = changedBy; @@ -1333,7 +1333,7 @@ namespace Game.Groups if (session == null) return; - SendRaidTargetUpdateAll updateAll = new SendRaidTargetUpdateAll(); + SendRaidTargetUpdateAll updateAll = new(); updateAll.PartyIndex = partyIndex; for (byte i = 0; i < MapConst.TargetIconsCount; i++) updateAll.TargetIcons.Add(i, m_targetIcons[i]); @@ -1363,7 +1363,7 @@ namespace Game.Groups memberSlot = slot; } - PartyUpdate partyUpdate = new PartyUpdate(); + PartyUpdate partyUpdate = new(); partyUpdate.PartyFlags = m_groupFlags; partyUpdate.PartyIndex = (byte)m_groupCategory; @@ -1384,7 +1384,7 @@ namespace Game.Groups Player memberPlayer = Global.ObjAccessor.FindConnectedPlayer(member.guid); - PartyPlayerInfo playerInfos = new PartyPlayerInfo(); + PartyPlayerInfo playerInfos = new(); playerInfos.GUID = member.guid; playerInfos.Name = member.name; @@ -1451,7 +1451,7 @@ namespace Game.Groups void SendUpdateDestroyGroupToPlayer(Player player) { - PartyUpdate partyUpdate = new PartyUpdate(); + PartyUpdate partyUpdate = new(); partyUpdate.PartyFlags = GroupFlags.Destroyed; partyUpdate.PartyIndex = (byte)m_groupCategory; partyUpdate.PartyType = GroupType.None; @@ -1466,7 +1466,7 @@ namespace Game.Groups if (!player || !player.IsInWorld) return; - PartyMemberFullState packet = new PartyMemberFullState(); + PartyMemberFullState packet = new(); packet.Initialize(player); for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next()) @@ -1609,7 +1609,7 @@ namespace Game.Groups slots[0].group = slots[1].group; slots[1].group = tmp; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); for (byte i = 0; i < 2; i++) { // Preserve new sub group in database for non-raid groups @@ -2181,7 +2181,7 @@ namespace Game.Groups SetMemberReadyChecked(slot); - ReadyCheckStarted readyCheckStarted = new ReadyCheckStarted(); + ReadyCheckStarted readyCheckStarted = new(); readyCheckStarted.PartyGUID = m_guid; readyCheckStarted.PartyIndex = partyIndex; readyCheckStarted.InitiatorGUID = starterGuid; @@ -2199,7 +2199,7 @@ namespace Game.Groups ResetMemberReadyChecked(); - ReadyCheckCompleted readyCheckCompleted = new ReadyCheckCompleted(); + ReadyCheckCompleted readyCheckCompleted = new(); readyCheckCompleted.PartyIndex = 0; readyCheckCompleted.PartyGUID = m_guid; BroadcastPacket(readyCheckCompleted, false); @@ -2225,7 +2225,7 @@ namespace Game.Groups void SetMemberReadyCheck(MemberSlot slot, bool ready) { - ReadyCheckResponse response = new ReadyCheckResponse(); + ReadyCheckResponse response = new(); response.PartyGUID = m_guid; response.Player = slot.guid; response.IsReady = ready; @@ -2286,7 +2286,7 @@ namespace Game.Groups public void SendRaidMarkersChanged(WorldSession session = null, sbyte partyIndex = 0) { - RaidMarkersChanged packet = new RaidMarkersChanged(); + RaidMarkersChanged packet = new(); packet.PartyIndex = partyIndex; packet.ActiveMarkers = m_activeMarkers; @@ -2597,9 +2597,9 @@ namespace Game.Groups worker(refe.GetSource()); } - List m_memberSlots = new List(); - GroupRefManager m_memberMgr = new GroupRefManager(); - List m_invitees = new List(); + List m_memberSlots = new(); + GroupRefManager m_memberMgr = new(); + List m_invitees = new(); ObjectGuid m_leaderGuid; string m_leaderName; GroupFlags m_groupFlags; @@ -2614,8 +2614,8 @@ namespace Game.Groups ItemQuality m_lootThreshold; ObjectGuid m_looterGuid; ObjectGuid m_masterLooterGuid; - List RollId = new List(); - Dictionary> m_boundInstances = new Dictionary>(); + List RollId = new(); + Dictionary> m_boundInstances = new(); byte[] m_subGroupsCounts; ObjectGuid m_guid; uint m_maxEnchantingLevel; @@ -2680,8 +2680,8 @@ namespace Game.Groups LootItem lootItemInSlot = GetTarget().GetItemInSlot(itemSlot); if (lootItemInSlot != null) { - ItemInstance itemInstance = new ItemInstance(lootItemInSlot); - BonusData bonusData = new BonusData(itemInstance); + ItemInstance itemInstance = new(lootItemInSlot); + BonusData bonusData = new(itemInstance); if (!bonusData.CanDisenchant) return null; @@ -2696,7 +2696,7 @@ namespace Game.Groups public uint itemid; public uint itemRandomBonusListId; public byte itemCount; - public Dictionary playerVote = new Dictionary(); + public Dictionary playerVote = new(); public byte totalPlayersRolling; public byte totalNeed; public byte totalGreed; diff --git a/Source/Game/Groups/GroupManager.cs b/Source/Game/Groups/GroupManager.cs index 529171dc1..a6d2cb3b2 100644 --- a/Source/Game/Groups/GroupManager.cs +++ b/Source/Game/Groups/GroupManager.cs @@ -122,7 +122,7 @@ namespace Game.Groups uint count = 0; do { - Group group = new Group(); + Group group = new(); group.LoadGroupFromDB(result.GetFields()); AddGroup(group); @@ -231,8 +231,8 @@ namespace Game.Groups } } - Dictionary GroupStore = new Dictionary(); - Dictionary GroupDbStore = new Dictionary(); + Dictionary GroupStore = new(); + Dictionary GroupDbStore = new(); ulong NextGroupId; uint NextGroupDbStoreId; } diff --git a/Source/Game/Guilds/Guild.cs b/Source/Game/Guilds/Guild.cs index 4d5388cf2..148418d22 100644 --- a/Source/Game/Guilds/Guild.cs +++ b/Source/Game/Guilds/Guild.cs @@ -58,7 +58,7 @@ namespace Game.Guilds Log.outDebug(LogFilter.Guild, "GUILD: creating guild [{0}] for leader {1} ({2})", name, pLeader.GetName(), m_leaderGuid); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_MEMBERS); stmt.AddValue(0, m_id); @@ -102,7 +102,7 @@ namespace Game.Guilds BroadcastPacket(new GuildEventDisbanded()); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); while (!m_members.Empty()) { var member = m_members.First(); @@ -149,7 +149,7 @@ namespace Game.Guilds public void SaveToDB() { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); m_achievementSys.SaveToDB(trans); @@ -202,7 +202,7 @@ namespace Game.Guilds stmt.AddValue(1, GetId()); DB.Characters.Execute(stmt); - GuildNameChanged guildNameChanged = new GuildNameChanged(); + GuildNameChanged guildNameChanged = new(); guildNameChanged.GuildGUID = GetGUID(); guildNameChanged.GuildName = m_name; BroadcastPacket(guildNameChanged); @@ -212,7 +212,7 @@ namespace Game.Guilds public void HandleRoster(WorldSession session = null) { - GuildRoster roster = new GuildRoster(); + GuildRoster roster = new(); roster.NumAccounts = (int)m_accountsNumber; roster.CreateDate = (uint)m_createdDate; roster.GuildFlags = 0; @@ -220,7 +220,7 @@ namespace Game.Guilds foreach (var member in m_members.Values) { - GuildRosterMemberData memberData = new GuildRosterMemberData(); + GuildRosterMemberData memberData = new(); memberData.Guid = member.GetGUID(); memberData.RankID = member.GetRankId(); @@ -256,7 +256,7 @@ namespace Game.Guilds public void SendQueryResponse(WorldSession session, ObjectGuid playerGuid) { - QueryGuildInfoResponse response = new QueryGuildInfoResponse(); + QueryGuildInfoResponse response = new(); response.GuildGUID = GetGUID(); response.PlayerGuid = playerGuid; response.HasGuildInfo = true; @@ -280,7 +280,7 @@ namespace Game.Guilds public void SendGuildRankInfo(WorldSession session) { - GuildRanks ranks = new GuildRanks(); + GuildRanks ranks = new(); for (byte i = 0; i < _GetRanksSize(); i++) { @@ -288,7 +288,7 @@ namespace Game.Guilds if (rankInfo == null) continue; - GuildRankData rankData = new GuildRankData(); + GuildRankData rankData = new(); rankData.RankID = rankInfo.GetId(); rankData.RankOrder = i; @@ -315,7 +315,7 @@ namespace Game.Guilds Member member = GetMember(player.GetGUID()); if (member != null) { - List criteriaIds = new List(); + List criteriaIds = new(); foreach (var achievementId in achievementIds) { var achievement = CliDB.AchievementStorage.LookupByKey(achievementId); @@ -436,7 +436,7 @@ namespace Game.Guilds return; } - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); _SetLeader(trans, newGuildMaster); oldGuildMaster.ChangeRank(trans, GuildDefaultRanks.Initiate); @@ -458,7 +458,7 @@ namespace Game.Guilds tab.SetInfo(name, icon); - GuildEventTabModified packet = new GuildEventTabModified(); + GuildEventTabModified packet = new(); packet.Tab = tabId; packet.Name = name; packet.Icon = icon; @@ -478,7 +478,7 @@ namespace Game.Guilds else member.SetOfficerNote(note); - GuildMemberUpdateNote updateNote = new GuildMemberUpdateNote(); + GuildMemberUpdateNote updateNote = new(); updateNote.Member = guid; updateNote.IsPublic = isPublic; updateNote.Note = note; @@ -504,7 +504,7 @@ namespace Game.Guilds foreach (var rightsAndSlot in rightsAndSlots) _SetRankBankTabRightsAndSlots(rankId, rightsAndSlot); - GuildEventRankChanged packet = new GuildEventRankChanged(); + GuildEventRankChanged packet = new(); packet.RankID = rankId; BroadcastPacket(packet); } @@ -594,7 +594,7 @@ namespace Game.Guilds pInvitee.SetGuildIdInvited(m_id); _LogEvent(GuildEventLogTypes.InvitePlayer, player.GetGUID().GetCounter(), pInvitee.GetGUID().GetCounter()); - GuildInvite invite = new GuildInvite(); + GuildInvite invite = new(); invite.InviterVirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress(); invite.GuildVirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress(); @@ -826,7 +826,7 @@ namespace Game.Guilds // Call script after validation and before money transfer. Global.ScriptMgr.OnGuildMemberDepositMoney(this, player, amount); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); _ModifyBankMoney(trans, amount, true); if (!cashFlow) { @@ -869,7 +869,7 @@ namespace Game.Guilds // Call script after validation and before money transfer. Global.ScriptMgr.OnGuildMemberWitdrawMoney(this, player, amount, repair); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); // Add money to player (if required) if (!repair) { @@ -926,7 +926,7 @@ namespace Game.Guilds if (!IsMember(player.GetGUID()) || !group) return; - GuildPartyState partyStateResponse = new GuildPartyState(); + GuildPartyState partyStateResponse = new(); partyStateResponse.InGuildParty = (player.GetMap().GetOwnerGuildId(player.GetTeam()) == GetId()); partyStateResponse.NumMembers = 0; partyStateResponse.NumRequired = 0; @@ -936,7 +936,7 @@ namespace Game.Guilds public void HandleGuildRequestChallengeUpdate(WorldSession session) { - GuildChallengeUpdate updatePacket = new GuildChallengeUpdate(); + GuildChallengeUpdate updatePacket = new(); for (int i = 0; i < GuildConst.ChallengesTypes; ++i) updatePacket.CurrentCount[i] = 0; // @todo current count @@ -960,7 +960,7 @@ namespace Game.Guilds if (logs == null) return; - GuildEventLogQueryResults packet = new GuildEventLogQueryResults(); + GuildEventLogQueryResults packet = new(); foreach (var logEntry in logs) { EventLogEntry eventLog = (EventLogEntry)logEntry; @@ -977,7 +977,7 @@ namespace Game.Guilds if (logs.Empty()) return; - GuildNewsPkt packet = new GuildNewsPkt(); + GuildNewsPkt packet = new(); foreach (var logEntry in logs) { NewsLogEntry eventLog = (NewsLogEntry)logEntry; @@ -997,7 +997,7 @@ namespace Game.Guilds if (logs == null) return; - GuildBankLogQueryResults packet = new GuildBankLogQueryResults(); + GuildBankLogQueryResults packet = new(); packet.Tab = tabId; //if (tabId == GUILD_BANK_MAX_TABS && hasCashFlow) @@ -1028,7 +1028,7 @@ namespace Game.Guilds byte rankId = member.GetRankId(); - GuildPermissionsQueryResults queryResult = new GuildPermissionsQueryResults(); + GuildPermissionsQueryResults queryResult = new(); queryResult.RankID = rankId; queryResult.WithdrawGoldLimit = (int)_GetMemberRemainingMoney(member); queryResult.Flags = (int)_GetRankRights(rankId); @@ -1053,7 +1053,7 @@ namespace Game.Guilds long amount = _GetMemberRemainingMoney(member); - GuildBankRemainingWithdrawMoney packet = new GuildBankRemainingWithdrawMoney(); + GuildBankRemainingWithdrawMoney packet = new(); packet.RemainingWithdrawMoney = amount; session.SendPacket(packet); } @@ -1074,7 +1074,7 @@ namespace Game.Guilds if (member.GetGUID() == GetLeaderGUID()) { - GuildFlaggedForRename renameFlag = new GuildFlaggedForRename(); + GuildFlaggedForRename renameFlag = new(); renameFlag.FlagSet = false; player.SendPacket(renameFlag); } @@ -1107,7 +1107,7 @@ namespace Game.Guilds else member.RemoveFlag(GuildMemberFlags.DND); - GuildEventStatusChange statusChange = new GuildEventStatusChange(); + GuildEventStatusChange statusChange = new(); statusChange.Guid = memberGuid; statusChange.AFK = afk; statusChange.DND = dnd; @@ -1116,14 +1116,14 @@ namespace Game.Guilds void SendEventBankMoneyChanged() { - GuildEventBankMoneyChanged eventPacket = new GuildEventBankMoneyChanged(); + GuildEventBankMoneyChanged eventPacket = new(); eventPacket.Money = GetBankMoney(); BroadcastPacket(eventPacket); } void SendEventMOTD(WorldSession session, bool broadcast = false) { - GuildEventMotd eventPacket = new GuildEventMotd(); + GuildEventMotd eventPacket = new(); eventPacket.MotdText = GetMOTD(); if (broadcast) @@ -1137,7 +1137,7 @@ namespace Game.Guilds void SendEventNewLeader(Member newLeader, Member oldLeader, bool isSelfPromoted = false) { - GuildEventNewLeader eventPacket = new GuildEventNewLeader(); + GuildEventNewLeader eventPacket = new(); eventPacket.SelfPromoted = isSelfPromoted; if (newLeader != null) { @@ -1158,7 +1158,7 @@ namespace Game.Guilds void SendEventPlayerLeft(Player leaver, Player remover = null, bool isRemoved = false) { - GuildEventPlayerLeft eventPacket = new GuildEventPlayerLeft(); + GuildEventPlayerLeft eventPacket = new(); eventPacket.Removed = isRemoved; eventPacket.LeaverGUID = leaver.GetGUID(); eventPacket.LeaverName = leaver.GetName(); @@ -1178,7 +1178,7 @@ namespace Game.Guilds { Player player = session.GetPlayer(); - GuildEventPresenceChange eventPacket = new GuildEventPresenceChange(); + GuildEventPresenceChange eventPacket = new(); eventPacket.Guid = player.GetGUID(); eventPacket.Name = player.GetName(); eventPacket.VirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress(); @@ -1222,7 +1222,7 @@ namespace Game.Guilds public void LoadRankFromDB(SQLFields field) { - RankInfo rankInfo = new RankInfo(m_id); + RankInfo rankInfo = new(m_id); rankInfo.LoadFromDB(field); @@ -1233,7 +1233,7 @@ namespace Game.Guilds { ulong lowguid = field.Read(1); ObjectGuid playerGuid = ObjectGuid.Create(HighGuid.Player, lowguid); - Member member = new Member(m_id, playerGuid, field.Read(2)); + Member member = new(m_id, playerGuid, field.Read(2)); if (!member.LoadFromDB(field)) { _DeleteMemberFromDB(null, lowguid); @@ -1247,7 +1247,7 @@ namespace Game.Guilds public void LoadBankRightFromDB(SQLFields field) { // tabId rights slots - GuildBankRightsAndSlots rightsAndSlots = new GuildBankRightsAndSlots(field.Read(1), field.Read(3), field.Read(4)); + GuildBankRightsAndSlots rightsAndSlots = new(field.Read(1), field.Read(3), field.Read(4)); // rankId _SetRankBankTabRightsAndSlots(field.Read(2), rightsAndSlots, false); } @@ -1358,7 +1358,7 @@ namespace Game.Guilds bool broken_ranks = false; byte ranks = _GetRanksSize(); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); if (ranks < GuildConst.MinRanks || ranks > GuildConst.MaxRanks) { Log.outError(LogFilter.Guild, "Guild {0} has invalid number of ranks, creating new...", m_id); @@ -1419,7 +1419,7 @@ namespace Game.Guilds { if (session != null && session.GetPlayer() != null && _HasRankRight(session.GetPlayer(), officerOnly ? GuildRankRights.OffChatSpeak : GuildRankRights.GChatSpeak)) { - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(officerOnly ? ChatMsg.Officer : ChatMsg.Guild, language, session.GetPlayer(), null, msg); foreach (var member in m_members.Values) { @@ -1436,7 +1436,7 @@ namespace Game.Guilds { if (session != null && session.GetPlayer() != null && _HasRankRight(session.GetPlayer(), officerOnly ? GuildRankRights.OffChatSpeak : GuildRankRights.GChatSpeak)) { - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(officerOnly ? ChatMsg.Officer : ChatMsg.Guild, isLogged ? Language.AddonLogged : Language.Addon, session.GetPlayer(), null, msg, 0, "", Locale.enUS, prefix); foreach (var member in m_members.Values) { @@ -1489,7 +1489,7 @@ namespace Game.Guilds public void MassInviteToEvent(WorldSession session, uint minLevel, uint maxLevel, uint minRank) { - CalendarCommunityInvite packet = new CalendarCommunityInvite(); + CalendarCommunityInvite packet = new(); foreach (var member in m_members.Values) { @@ -1533,7 +1533,7 @@ namespace Game.Guilds if (rankId == GuildConst.RankNone) rankId = _GetLowestRankId(); - Member member = new Member(m_id, guid, rankId); + Member member = new(m_id, guid, rankId); string name = ""; if (player != null) { @@ -1581,7 +1581,7 @@ namespace Game.Guilds _UpdateAccountsNumber(); _LogEvent(GuildEventLogTypes.JoinGuild, lowguid); - GuildEventPlayerJoined joinNotificationPacket = new GuildEventPlayerJoined(); + GuildEventPlayerJoined joinNotificationPacket = new(); joinNotificationPacket.Guid = guid; joinNotificationPacket.Name = name; joinNotificationPacket.VirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress(); @@ -1679,8 +1679,8 @@ namespace Game.Guilds if (tabId == destTabId && slotId == destSlotId) return; - BankMoveItemData from = new BankMoveItemData(this, player, tabId, slotId); - BankMoveItemData to = new BankMoveItemData(this, player, destTabId, destSlotId); + BankMoveItemData from = new(this, player, tabId, slotId); + BankMoveItemData to = new(this, player, destTabId, destSlotId); _MoveItems(from, to, splitedAmount); } @@ -1689,8 +1689,8 @@ namespace Game.Guilds if ((slotId >= GuildConst.MaxBankSlots && slotId != ItemConst.NullSlot) || tabId >= _GetPurchasedTabsSize()) return; - BankMoveItemData bankData = new BankMoveItemData(this, player, tabId, slotId); - PlayerMoveItemData charData = new PlayerMoveItemData(this, player, playerBag, playerSlotId); + BankMoveItemData bankData = new(this, player, tabId, slotId); + PlayerMoveItemData charData = new(this, player, playerBag, playerSlotId); if (toChar) _MoveItems(bankData, charData, splitedAmount); else @@ -1705,7 +1705,7 @@ namespace Game.Guilds pTab.SetText(text); pTab.SendText(this); - GuildEventTabTextChanged eventPacket = new GuildEventTabTextChanged(); + GuildEventTabTextChanged eventPacket = new(); eventPacket.Tab = tabId; BroadcastPacket(eventPacket); } @@ -1725,7 +1725,7 @@ namespace Game.Guilds byte tabId = _GetPurchasedTabsSize(); // Next free id m_bankTabs.Add(new BankTab(m_id, tabId)); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_TAB); stmt.AddValue(0, m_id); @@ -1768,7 +1768,7 @@ namespace Game.Guilds return false; // Ranks represent sequence 0, 1, 2, ... where 0 means guildmaster - RankInfo info = new RankInfo(m_id, newRankId, name, rights, 0); + RankInfo info = new(m_id, newRankId, name, rights, 0); m_ranks.Add(info); bool isInTransaction = trans != null; @@ -1788,7 +1788,7 @@ namespace Game.Guilds void _UpdateAccountsNumber() { // We use a set to be sure each element will be unique - List accountsIdSet = new List(); + List accountsIdSet = new(); foreach (var member in m_members.Values) accountsIdSet.Add(member.GetAccountId()); @@ -1973,7 +1973,7 @@ namespace Game.Guilds void _LogEvent(GuildEventLogTypes eventType, ulong playerGuid1, ulong playerGuid2 = 0, byte newRank = 0) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); m_eventLog.AddEvent(trans, new EventLogEntry(m_id, m_eventLog.GetNextGUID(), eventType, playerGuid1, playerGuid2, newRank)); DB.Characters.CommitTransaction(trans); @@ -2089,7 +2089,7 @@ namespace Game.Guilds if (swap) pSrc.LogAction(pDest); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); // 3. Log bank events pDest.LogBankEvent(trans, pSrc, pSrcItem.GetCount()); if (swap) @@ -2118,7 +2118,7 @@ namespace Game.Guilds Cypher.Assert(pSrc.IsBank() || pDest.IsBank()); byte tabId = 0; - List slots = new List(); + List slots = new(); if (pSrc.IsBank()) // B . { tabId = pSrc.GetContainer(); @@ -2130,7 +2130,7 @@ namespace Game.Guilds pDest.CopySlots(slots); else // Different tabs - send second message { - List destSlots = new List(); + List destSlots = new(); pDest.CopySlots(destSlots); _SendBankContentUpdate(pDest.GetContainer(), destSlots); } @@ -2150,7 +2150,7 @@ namespace Game.Guilds BankTab tab = GetBankTab(tabId); if (tab != null) { - GuildBankQueryResults packet = new GuildBankQueryResults(); + GuildBankQueryResults packet = new(); packet.FullUpdate = true; // @todo packet.Tab = tabId; packet.Money = m_bankMoney; @@ -2159,7 +2159,7 @@ namespace Game.Guilds { Item tabItem = tab.GetItem(slot); - GuildBankItemInfo itemInfo = new GuildBankItemInfo(); + GuildBankItemInfo itemInfo = new(); itemInfo.Slot = slot; itemInfo.Item.ItemID = tabItem ? tabItem.GetEntry() : 0; @@ -2176,7 +2176,7 @@ namespace Game.Guilds { if (gemData.ItemId != 0) { - ItemGemData gem = new ItemGemData(); + ItemGemData gem = new(); gem.Slot = i; gem.Item = new ItemInstance(gemData); itemInfo.SocketEnchant.Add(gem); @@ -2209,7 +2209,7 @@ namespace Game.Guilds if (member == null) // Shouldn't happen, just in case return; - GuildBankQueryResults packet = new GuildBankQueryResults(); + GuildBankQueryResults packet = new(); packet.Money = m_bankMoney; packet.WithdrawalsRemaining = _GetMemberRemainingSlots(member, tabId); @@ -2240,7 +2240,7 @@ namespace Game.Guilds Item tabItem = tab.GetItem(slotId); if (tabItem) { - GuildBankItemInfo itemInfo = new GuildBankItemInfo(); + GuildBankItemInfo itemInfo = new(); itemInfo.Slot = slotId; itemInfo.Item.ItemID = tabItem.GetEntry(); @@ -2255,7 +2255,7 @@ namespace Game.Guilds { if (gemData.ItemId != 0) { - ItemGemData gem = new ItemGemData(); + ItemGemData gem = new(); gem.Slot = i; gem.Item = new ItemInstance(gemData); itemInfo.SocketEnchant.Add(gem); @@ -2279,7 +2279,7 @@ namespace Game.Guilds Member member = GetMember(targetGuid); Cypher.Assert(member != null); - GuildSendRankChange rankChange = new GuildSendRankChange(); + GuildSendRankChange rankChange = new(); rankChange.Officer = setterGuid; rankChange.Other = targetGuid; rankChange.RankID = rank; @@ -2307,13 +2307,13 @@ namespace Game.Guilds public void AddGuildNews(GuildNews type, ObjectGuid guid, uint flags, uint value) { - NewsLogEntry news = new NewsLogEntry(m_id, m_newsLog.GetNextGUID(), type, guid, flags, value); + NewsLogEntry news = new(m_id, m_newsLog.GetNextGUID(), type, guid, flags, value); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); m_newsLog.AddEvent(trans, news); DB.Characters.CommitTransaction(trans); - GuildNewsPkt newsPacket = new GuildNewsPkt(); + GuildNewsPkt newsPacket = new(); news.WritePacket(newsPacket); BroadcastPacket(newsPacket); } @@ -2343,7 +2343,7 @@ namespace Game.Guilds Log.outDebug(LogFilter.Guild, "HandleNewsSetSticky: [{0}] chenged newsId {1} sticky to {2}", session.GetPlayerInfo(), newsId, sticky); - GuildNewsPkt newsPacket = new GuildNewsPkt(); + GuildNewsPkt newsPacket = new(); news.WritePacket(newsPacket); session.SendPacket(newsPacket); } @@ -2437,7 +2437,7 @@ namespace Game.Guilds public static void SendCommandResult(WorldSession session, GuildCommandType type, GuildCommandError errCode, string param = "") { - GuildCommandResult resultPacket = new GuildCommandResult(); + GuildCommandResult resultPacket = new(); resultPacket.Command = type; resultPacket.Result = errCode; resultPacket.Name = param; @@ -2446,7 +2446,7 @@ namespace Game.Guilds public static void SendSaveEmblemResult(WorldSession session, GuildEmblemError errCode) { - PlayerSaveGuildEmblem saveResponse = new PlayerSaveGuildEmblem(); + PlayerSaveGuildEmblem saveResponse = new(); saveResponse.Error = errCode; session.SendPacket(saveResponse); } @@ -2459,13 +2459,13 @@ namespace Game.Guilds string m_info; long m_createdDate; - EmblemInfo m_emblemInfo = new EmblemInfo(); + EmblemInfo m_emblemInfo = new(); uint m_accountsNumber; ulong m_bankMoney; - List m_ranks = new List(); - Dictionary m_members = new Dictionary(); - List m_bankTabs = new List(); + List m_ranks = new(); + Dictionary m_members = new(); + List m_bankTabs = new(); // These are actually ordered lists. The first element is the oldest entry. LogHolder m_eventLog; @@ -2733,7 +2733,7 @@ namespace Game.Guilds string m_publicNote = ""; string m_officerNote = ""; - List m_trackedCriteriaIds = new List(); + List m_trackedCriteriaIds = new(); uint[] m_bankWithdraw = new uint[GuildConst.MaxBankTabs]; ulong m_bankWithdrawMoney; @@ -2815,7 +2815,7 @@ namespace Game.Guilds ObjectGuid playerGUID = ObjectGuid.Create(HighGuid.Player, m_playerGuid1); ObjectGuid otherGUID = ObjectGuid.Create(HighGuid.Player, m_playerGuid2); - GuildEventEntry eventEntry = new GuildEventEntry(); + GuildEventEntry eventEntry = new(); eventEntry.PlayerGUID = playerGUID; eventEntry.OtherGUID = otherGUID; eventEntry.TransactionType = (byte)m_eventType; @@ -2903,7 +2903,7 @@ namespace Game.Guilds bool hasStack = (hasItem && m_itemStackCount > 1) || itemMoved; - GuildBankLogEntry bankLogEntry = new GuildBankLogEntry(); + GuildBankLogEntry bankLogEntry = new(); bankLogEntry.PlayerGUID = logGuid; bankLogEntry.TimeOffset = (uint)(Time.UnixTime - m_timestamp); bankLogEntry.EntryType = (sbyte)m_eventType; @@ -2983,7 +2983,7 @@ namespace Game.Guilds public void WritePacket(GuildNewsPkt newsPacket) { - GuildNewsEvent newsEvent = new GuildNewsEvent(); + GuildNewsEvent newsEvent = new(); newsEvent.Id = (int)GetGUID(); newsEvent.MemberGuid = GetPlayerGuid(); newsEvent.CompletedDate = (uint)GetTimestamp(); @@ -2997,7 +2997,7 @@ namespace Game.Guilds if (GetNewsType() == GuildNews.ItemLooted || GetNewsType() == GuildNews.ItemCrafted || GetNewsType() == GuildNews.ItemPurchased) { - ItemInstance itemInstance = new ItemInstance(); + ItemInstance itemInstance = new(); itemInstance.ItemID = GetValue(); newsEvent.Item.Set(itemInstance); } @@ -3054,7 +3054,7 @@ namespace Game.Guilds public List GetGuildLog() { return m_log; } - List m_log = new List(); + List m_log = new(); uint m_maxRecords; uint m_nextGUID; } @@ -3322,7 +3322,7 @@ namespace Game.Guilds public void SendText(Guild guild, WorldSession session = null) { - GuildBankTextQueryResult textQuery = new GuildBankTextQueryResult(); + GuildBankTextQueryResult textQuery = new(); textQuery.Tab = m_tabId; textQuery.Text = m_text; @@ -3565,7 +3565,7 @@ namespace Game.Guilds public byte m_slotId; public Item m_pItem; public Item m_pClonedItem; - public List m_vec = new List(); + public List m_vec = new(); } public class PlayerMoveItemData : MoveItemData @@ -3773,7 +3773,7 @@ namespace Game.Guilds requiredSpace = Math.Min(requiredSpace, count); // Reserve space - ItemPosCount pos = new ItemPosCount(slotId, requiredSpace); + ItemPosCount pos = new(slotId, requiredSpace); if (!pos.IsContainedIn(m_vec)) { m_vec.Add(pos); diff --git a/Source/Game/Guilds/GuildFinderManager.cs b/Source/Game/Guilds/GuildFinderManager.cs index f8498aa84..67598b849 100644 --- a/Source/Game/Guilds/GuildFinderManager.cs +++ b/Source/Game/Guilds/GuildFinderManager.cs @@ -66,7 +66,7 @@ namespace Game.Guilds if (raceEntry.Alliance == 1) guildTeam = TeamId.Horde; - LFGuildSettings settings = new LFGuildSettings(listed, guildTeam, guildId, classRoles, availability, interests, level, comment); + LFGuildSettings settings = new(listed, guildTeam, guildId, classRoles, availability, interests, level, comment); _guildSettings[guildId] = settings; ++count; @@ -99,7 +99,7 @@ namespace Game.Guilds string comment = result.Read(5); uint submitTime = result.Read(6); - MembershipRequest request = new MembershipRequest(playerId, guildId, availability, classRoles, interests, comment, submitTime); + MembershipRequest request = new(playerId, guildId, availability, classRoles, interests, comment, submitTime); if (!_membershipRequestsByGuild.ContainsKey(guildId)) _membershipRequestsByGuild[guildId] = new Dictionary(); @@ -127,7 +127,7 @@ namespace Game.Guilds _membershipRequestsByPlayer[request.GetPlayerGUID()] = new Dictionary(); _membershipRequestsByPlayer[request.GetPlayerGUID()][guildGuid] = request; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_GUILD_FINDER_APPLICANT); stmt.AddValue(0, request.GetGuildGuid().GetCounter()); stmt.AddValue(1, request.GetPlayerGUID().GetCounter()); @@ -156,7 +156,7 @@ namespace Game.Guilds if (playerDic == null) return; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); foreach (var guid in playerDic.Keys) { PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_FINDER_APPLICANT); @@ -201,7 +201,7 @@ namespace Game.Guilds _membershipRequestsByPlayer.Remove(playerId); } - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_FINDER_APPLICANT); stmt.AddValue(0, guildId.GetCounter()); stmt.AddValue(1, playerId.GetCounter()); @@ -222,7 +222,7 @@ namespace Game.Guilds public List GetAllMembershipRequestsForPlayer(ObjectGuid playerGuid) { - List resultSet = new List(); + List resultSet = new(); var playerDic = _membershipRequestsByPlayer.LookupByKey(playerGuid); if (playerDic == null) return resultSet; @@ -240,7 +240,7 @@ namespace Game.Guilds public List GetGuildsMatchingSetting(LFGuildPlayer settings, uint faction) { - List resultSet = new List(); + List resultSet = new(); foreach (var guildSettings in _guildSettings.Values) { if (!guildSettings.IsListed()) @@ -280,7 +280,7 @@ namespace Game.Guilds { _guildSettings[guildGuid] = settings; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_GUILD_FINDER_GUILD_SETTINGS); stmt.AddValue(0, settings.GetGUID().GetCounter()); @@ -297,7 +297,7 @@ namespace Game.Guilds public void DeleteGuild(ObjectGuid guildId) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt; var guildDic = _membershipRequestsByGuild.LookupByKey(guildId); if (guildDic != null) @@ -341,7 +341,7 @@ namespace Game.Guilds void SendApplicantListUpdate(Guild guild) { - LFGuildApplicantListChanged applicantListChanged = new LFGuildApplicantListChanged(); + LFGuildApplicantListChanged applicantListChanged = new(); guild.BroadcastPacketToRank(applicantListChanged, GuildDefaultRanks.Officer); @@ -359,9 +359,9 @@ namespace Game.Guilds public LFGuildSettings GetGuildSettings(ObjectGuid guildGuid) { return _guildSettings.LookupByKey(guildGuid); } - Dictionary _guildSettings = new Dictionary(); - Dictionary> _membershipRequestsByGuild = new Dictionary>(); - Dictionary> _membershipRequestsByPlayer = new Dictionary>(); + Dictionary _guildSettings = new(); + Dictionary> _membershipRequestsByGuild = new(); + Dictionary> _membershipRequestsByPlayer = new(); } public class MembershipRequest diff --git a/Source/Game/Guilds/GuildManager.cs b/Source/Game/Guilds/GuildManager.cs index 206848942..436250248 100644 --- a/Source/Game/Guilds/GuildManager.cs +++ b/Source/Game/Guilds/GuildManager.cs @@ -123,7 +123,7 @@ namespace Game uint count = 0; do { - Guild guild = new Guild(); + Guild guild = new(); if (!guild.LoadFromDB(result.GetFields())) continue; @@ -447,7 +447,7 @@ namespace Game uint count = 0; do { - GuildReward reward = new GuildReward(); + GuildReward reward = new(); reward.ItemID = result.Read(0); reward.MinGuildRep = result.Read(1); @@ -505,8 +505,8 @@ namespace Game uint NextGuildId; - Dictionary GuildStore = new Dictionary(); - List guildRewards = new List(); + Dictionary GuildStore = new(); + List guildRewards = new(); } public class GuildReward @@ -515,6 +515,6 @@ namespace Game public byte MinGuildRep; public ulong RaceMask; public ulong Cost; - public List AchievementsRequired = new List(); + public List AchievementsRequired = new(); } } diff --git a/Source/Game/Handlers/AdventureJournalHandler.cs b/Source/Game/Handlers/AdventureJournalHandler.cs index 3c2535649..d32d957de 100644 --- a/Source/Game/Handlers/AdventureJournalHandler.cs +++ b/Source/Game/Handlers/AdventureJournalHandler.cs @@ -66,7 +66,7 @@ namespace Game if (!_player.MeetPlayerCondition(uiDisplay.AdvGuidePlayerConditionID)) return; - AdventureJournalDataResponse response = new AdventureJournalDataResponse(); + AdventureJournalDataResponse response = new(); response.OnLevelUp = updateSuggestions.OnLevelUp; foreach (var adventureJournal in CliDB.AdventureJournalStorage.Values) diff --git a/Source/Game/Handlers/AuctionHandler.cs b/Source/Game/Handlers/AuctionHandler.cs index 3b0027e34..ec260f82f 100644 --- a/Source/Game/Handlers/AuctionHandler.cs +++ b/Source/Game/Handlers/AuctionHandler.cs @@ -52,9 +52,9 @@ namespace Game Log.outDebug(LogFilter.Auctionhouse, $"Auctionhouse search ({browseQuery.Auctioneer}), searchedname: {browseQuery.Name}, levelmin: {browseQuery.MinLevel}, levelmax: {browseQuery.MaxLevel}, filters: {browseQuery.Filters}"); - Optional classFilters = new Optional(); + Optional classFilters = new(); - AuctionListBucketsResult listBucketsResult = new AuctionListBucketsResult(); + AuctionListBucketsResult listBucketsResult = new(); if (!browseQuery.ItemClassFilters.Empty()) { classFilters.HasValue = true; @@ -128,7 +128,7 @@ namespace Game AuctionHouseObject auctionHouse = Global.AuctionHouseMgr.GetAuctionsMap(creature.GetFaction()); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); if (auctionHouse.BuyCommodity(trans, _player, (uint)confirmCommoditiesPurchase.ItemID, confirmCommoditiesPurchase.Quantity, throttle.DelayUntilNext)) { AddTransactionCallback(DB.Characters.AsyncCommitTransaction(trans)).AfterComplete(success => @@ -184,7 +184,7 @@ namespace Game AuctionHouseObject auctionHouse = Global.AuctionHouseMgr.GetAuctionsMap(creature.GetFaction()); - AuctionListBiddedItemsResult result = new AuctionListBiddedItemsResult(); + AuctionListBiddedItemsResult result = new(); Player player = GetPlayer(); auctionHouse.BuildListBiddedItems(result, player, listBiddedItems.Offset, listBiddedItems.Sorts, listBiddedItems.Sorts.Count); @@ -212,7 +212,7 @@ namespace Game AuctionHouseObject auctionHouse = Global.AuctionHouseMgr.GetAuctionsMap(creature.GetFaction()); - AuctionListBucketsResult listBucketsResult = new AuctionListBucketsResult(); + AuctionListBucketsResult listBucketsResult = new(); auctionHouse.BuildListBuckets(listBucketsResult, _player, listBucketsByBucketKeys.BucketKeys, listBucketsByBucketKeys.BucketKeys.Count, @@ -243,7 +243,7 @@ namespace Game AuctionHouseObject auctionHouse = Global.AuctionHouseMgr.GetAuctionsMap(creature.GetFaction()); - AuctionListItemsResult listItemsResult = new AuctionListItemsResult(); + AuctionListItemsResult listItemsResult = new(); listItemsResult.DesiredDelay = (uint)throttle.DelayUntilNext.TotalSeconds; listItemsResult.BucketKey = listItemsByBucketKey.BucketKey; ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(listItemsByBucketKey.BucketKey.ItemID); @@ -275,7 +275,7 @@ namespace Game AuctionHouseObject auctionHouse = Global.AuctionHouseMgr.GetAuctionsMap(creature.GetFaction()); - AuctionListItemsResult listItemsResult = new AuctionListItemsResult(); + AuctionListItemsResult listItemsResult = new(); listItemsResult.DesiredDelay = (uint)throttle.DelayUntilNext.TotalSeconds; listItemsResult.BucketKey.ItemID = listItemsByItemID.ItemID; ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(listItemsByItemID.ItemID); @@ -307,7 +307,7 @@ namespace Game AuctionHouseObject auctionHouse = Global.AuctionHouseMgr.GetAuctionsMap(creature.GetFaction()); - AuctionListOwnedItemsResult result = new AuctionListOwnedItemsResult(); + AuctionListOwnedItemsResult result = new(); auctionHouse.BuildListOwnedItems(result, _player, listOwnedItems.Offset, listOwnedItems.Sorts, listOwnedItems.Sorts.Count); result.DesiredDelay = (uint)throttle.DelayUntilNext.TotalSeconds; @@ -374,7 +374,7 @@ namespace Game return; } - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); ulong priceToPay = placeBid.BidAmount; if (!auction.Bidder.IsEmpty()) { @@ -467,7 +467,7 @@ namespace Game AuctionPosting auction = auctionHouse.GetAuction(removeItem.AuctionID); Player player = GetPlayer(); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); if (auction != null && auction.Owner == player.GetGUID()) { if (auction.Bidder.IsEmpty()) // If we have a bidder, we have to send him the money he paid @@ -526,7 +526,7 @@ namespace Game AuctionHouseObject auctionHouse = Global.AuctionHouseMgr.GetAuctionsMap(creature.GetFaction()); - AuctionReplicateResponse response = new AuctionReplicateResponse(); + AuctionReplicateResponse response = new(); auctionHouse.BuildReplicate(response, GetPlayer(), replicateItems.ChangeNumberGlobal, replicateItems.ChangeNumberCursor, replicateItems.ChangeNumberTombstone, replicateItems.Count); @@ -588,7 +588,7 @@ namespace Game // find all items for sale ulong totalCount = 0; - Dictionary items2 = new Dictionary(); + Dictionary items2 = new(); foreach (var itemForSale in sellCommodity.Items) { @@ -652,7 +652,7 @@ namespace Game } uint auctionId = Global.ObjectMgr.GenerateAuctionID(); - AuctionPosting auction = new AuctionPosting(); + AuctionPosting auction = new(); auction.Id = auctionId; auction.Owner = _player.GetGUID(); auction.OwnerAccount = GetAccountGUID(); @@ -662,7 +662,7 @@ namespace Game auction.EndTime = auction.StartTime + auctionTime; // keep track of what was cloned to undo/modify counts later - Dictionary clones = new Dictionary(); + Dictionary clones = new(); foreach (var pair in items2) { Item itemForSale; @@ -705,7 +705,7 @@ namespace Game Log.outCommand(GetAccountId(), $"GM {GetPlayerName()} (Account: {GetAccountId()}) create auction: {logItem.GetName(Global.WorldMgr.GetDefaultDbcLocale())} (Entry: {logItem.GetEntry()} Count: {totalCount})"); } - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); foreach (var pair in items2) { @@ -845,7 +845,7 @@ namespace Game uint auctionId = Global.ObjectMgr.GenerateAuctionID(); - AuctionPosting auction = new AuctionPosting(); + AuctionPosting auction = new(); auction.Id = auctionId; auction.Owner = _player.GetGUID(); auction.OwnerAccount = GetAccountGUID(); @@ -874,7 +874,7 @@ namespace Game _player.MoveItemFromInventory(item.GetBagSlot(), item.GetSlot(), true); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); item.DeleteFromInventoryDB(trans); item.SaveToDB(trans); @@ -902,7 +902,7 @@ namespace Game if (throttle.Throttled) return; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_FAVORITE_AUCTION); stmt.AddValue(0, _player.GetGUID().GetCounter()); @@ -944,7 +944,7 @@ namespace Game AuctionHouseObject auctionHouse = Global.AuctionHouseMgr.GetAuctionsMap(creature.GetFaction()); - AuctionGetCommodityQuoteResult commodityQuoteResult = new AuctionGetCommodityQuoteResult(); + AuctionGetCommodityQuoteResult commodityQuoteResult = new(); CommodityQuote quote = auctionHouse.CreateCommodityQuote(_player, (uint)getCommodityQuote.ItemID, getCommodityQuote.Quantity); if (quote != null) @@ -971,7 +971,7 @@ namespace Game if (ahEntry == null) return; - AuctionHelloResponse auctionHelloResponse = new AuctionHelloResponse(); + AuctionHelloResponse auctionHelloResponse = new(); auctionHelloResponse.Guid = guid; auctionHelloResponse.OpenForBusiness = true; SendPacket(auctionHelloResponse); @@ -979,7 +979,7 @@ namespace Game public void SendAuctionCommandResult(uint auctionId, AuctionCommand command, AuctionResult errorCode, TimeSpan delayForNextAction, InventoryResult bagError = 0) { - AuctionCommandResult auctionCommandResult = new AuctionCommandResult(); + AuctionCommandResult auctionCommandResult = new(); auctionCommandResult.AuctionID = auctionId; auctionCommandResult.Command = (int)command; auctionCommandResult.ErrorCode = (int)errorCode; @@ -990,7 +990,7 @@ namespace Game public void SendAuctionClosedNotification(AuctionPosting auction, float mailDelay, bool sold) { - AuctionClosedNotification packet = new AuctionClosedNotification(); + AuctionClosedNotification packet = new(); packet.Info.Initialize(auction); packet.ProceedsMailDelay = mailDelay; packet.Sold = sold; @@ -999,7 +999,7 @@ namespace Game public void SendAuctionOwnerBidNotification(AuctionPosting auction) { - AuctionOwnerBidNotification packet = new AuctionOwnerBidNotification(); + AuctionOwnerBidNotification packet = new(); packet.Info.Initialize(auction); packet.Bidder = auction.Bidder; packet.MinIncrement = auction.CalculateMinIncrement(); diff --git a/Source/Game/Handlers/AuthenticationHandler.cs b/Source/Game/Handlers/AuthenticationHandler.cs index 2ad871a1d..c46121075 100644 --- a/Source/Game/Handlers/AuthenticationHandler.cs +++ b/Source/Game/Handlers/AuthenticationHandler.cs @@ -24,7 +24,7 @@ namespace Game { public void SendAuthResponse(BattlenetRpcErrorCode code, bool queued, uint queuePos = 0) { - AuthResponse response = new AuthResponse(); + AuthResponse response = new(); response.Result = code; if (code == BattlenetRpcErrorCode.Ok) @@ -62,7 +62,7 @@ namespace Game { if (position != 0) { - WaitQueueUpdate waitQueueUpdate = new WaitQueueUpdate(); + WaitQueueUpdate waitQueueUpdate = new(); waitQueueUpdate.WaitInfo.WaitCount = position; waitQueueUpdate.WaitInfo.WaitTime = 0; waitQueueUpdate.WaitInfo.HasFCM = false; @@ -74,7 +74,7 @@ namespace Game public void SendClientCacheVersion(uint version) { - ClientCacheVersion cache = new ClientCacheVersion(); + ClientCacheVersion cache = new(); cache.CacheVersion = version; SendPacket(cache);//enabled it } @@ -82,7 +82,7 @@ namespace Game public void SendSetTimeZoneInformation() { // @todo: replace dummy values - SetTimeZoneInformation packet = new SetTimeZoneInformation(); + SetTimeZoneInformation packet = new(); packet.ServerTimeTZ = "Europe/Paris"; packet.GameTimeTZ = "Europe/Paris"; @@ -91,7 +91,7 @@ namespace Game public void SendFeatureSystemStatusGlueScreen() { - FeatureSystemStatusGlueScreen features = new FeatureSystemStatusGlueScreen(); + FeatureSystemStatusGlueScreen features = new(); features.BpayStoreAvailable = false; features.BpayStoreDisabledByParentalControls = false; features.CharUndeleteEnabled = WorldConfig.GetBoolValue(WorldCfg.FeatureSystemCharacterUndeleteEnabled); diff --git a/Source/Game/Handlers/AzeriteHandler.cs b/Source/Game/Handlers/AzeriteHandler.cs index 27c0c5c32..0604e262b 100644 --- a/Source/Game/Handlers/AzeriteHandler.cs +++ b/Source/Game/Handlers/AzeriteHandler.cs @@ -62,7 +62,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AzeriteEssenceActivateEssence)] void HandleAzeriteEssenceActivateEssence(AzeriteEssenceActivateEssence azeriteEssenceActivateEssence) { - ActivateEssenceFailed activateEssenceResult = new ActivateEssenceFailed(); + ActivateEssenceFailed activateEssenceResult = new(); activateEssenceResult.AzeriteEssenceID = azeriteEssenceActivateEssence.AzeriteEssenceID; Item item = _player.GetItemByEntry(PlayerConst.ItemIdHeartOfAzeroth, ItemSearchLocation.InEquipment); diff --git a/Source/Game/Handlers/BankHandler.cs b/Source/Game/Handlers/BankHandler.cs index 93a08cc37..80b4a23d9 100644 --- a/Source/Game/Handlers/BankHandler.cs +++ b/Source/Game/Handlers/BankHandler.cs @@ -39,7 +39,7 @@ namespace Game if (!item) return; - List dest = new List(); + List dest = new(); InventoryResult msg = GetPlayer().CanBankItem(ItemConst.NullBag, ItemConst.NullSlot, dest, item, false); if (msg != InventoryResult.Ok) { @@ -89,7 +89,7 @@ namespace Game if (Player.IsBankPos(packet.Bag, packet.Slot)) // moving from bank to inventory { - List dest = new List(); + List dest = new(); InventoryResult msg = GetPlayer().CanStoreItem(ItemConst.NullBag, ItemConst.NullSlot, dest, item, false); if (msg != InventoryResult.Ok) { @@ -104,7 +104,7 @@ namespace Game } else // moving from inventory to bank { - List dest = new List(); + List dest = new(); InventoryResult msg = GetPlayer().CanBankItem(ItemConst.NullBag, ItemConst.NullSlot, dest, item, false); if (msg != InventoryResult.Ok) { @@ -146,7 +146,7 @@ namespace Game public void SendShowBank(ObjectGuid guid) { m_currentBankerGUID = guid; - ShowBank packet = new ShowBank(); + ShowBank packet = new(); packet.Guid = guid; SendPacket(packet); } diff --git a/Source/Game/Handlers/BattleFieldHandler.cs b/Source/Game/Handlers/BattleFieldHandler.cs index feb332575..b1e16ad8e 100644 --- a/Source/Game/Handlers/BattleFieldHandler.cs +++ b/Source/Game/Handlers/BattleFieldHandler.cs @@ -31,7 +31,7 @@ namespace Game /// Time in second that the player have for accept public void SendBfInvitePlayerToWar(ulong queueId, uint zoneId, uint acceptTime) { - BFMgrEntryInvite bfMgrEntryInvite = new BFMgrEntryInvite(); + BFMgrEntryInvite bfMgrEntryInvite = new(); bfMgrEntryInvite.QueueID = queueId; bfMgrEntryInvite.AreaID = (int)zoneId; bfMgrEntryInvite.ExpireTime = Time.UnixTime + acceptTime; @@ -45,7 +45,7 @@ namespace Game /// Battlefield State public void SendBfInvitePlayerToQueue(ulong queueId, BattlefieldState battleState) { - BFMgrQueueInvite bfMgrQueueInvite = new BFMgrQueueInvite(); + BFMgrQueueInvite bfMgrQueueInvite = new(); bfMgrQueueInvite.QueueID = queueId; bfMgrQueueInvite.BattleState = battleState; SendPacket(bfMgrQueueInvite); @@ -61,7 +61,7 @@ namespace Game /// on log in send queue status public void SendBfQueueInviteResponse(ulong queueId, uint zoneId, BattlefieldState battleStatus, bool canQueue = true, bool loggingIn = false) { - BFMgrQueueRequestResponse bfMgrQueueRequestResponse = new BFMgrQueueRequestResponse(); + BFMgrQueueRequestResponse bfMgrQueueRequestResponse = new(); bfMgrQueueRequestResponse.QueueID = queueId; bfMgrQueueRequestResponse.AreaID = (int)zoneId; bfMgrQueueRequestResponse.Result = (sbyte)(canQueue ? 1 : 0); @@ -78,7 +78,7 @@ namespace Game /// Whether player belongs to attacking team or not public void SendBfEntered(ulong queueId, bool relocated, bool onOffense) { - BFMgrEntering bfMgrEntering = new BFMgrEntering(); + BFMgrEntering bfMgrEntering = new(); bfMgrEntering.ClearedAFK = _player.IsAFK(); bfMgrEntering.Relocated = relocated; bfMgrEntering.OnOffense = onOffense; @@ -95,7 +95,7 @@ namespace Game /// Reason why player left battlefield public void SendBfLeaveMessage(ulong queueId, BattlefieldState battleState, bool relocated, BFLeaveReason reason = BFLeaveReason.Exited) { - BFMgrEjected bfMgrEjected = new BFMgrEjected(); + BFMgrEjected bfMgrEjected = new(); bfMgrEjected.QueueID = queueId; bfMgrEjected.Reason = reason; bfMgrEjected.BattleState = battleState; diff --git a/Source/Game/Handlers/BattleGroundHandler.cs b/Source/Game/Handlers/BattleGroundHandler.cs index 73776be7f..245b5468e 100644 --- a/Source/Game/Handlers/BattleGroundHandler.cs +++ b/Source/Game/Handlers/BattleGroundHandler.cs @@ -221,7 +221,7 @@ namespace Game if (bg.IsArena()) return; - PVPMatchStatisticsMessage pvpMatchStatistics = new PVPMatchStatisticsMessage(); + PVPMatchStatisticsMessage pvpMatchStatistics = new(); bg.BuildPvPLogDataPacket(out pvpMatchStatistics.Data); SendPacket(pvpMatchStatistics); } @@ -384,7 +384,7 @@ namespace Game at.SaveToDB(); } } - BattlefieldStatusNone battlefieldStatus = new BattlefieldStatusNone(); + BattlefieldStatusNone battlefieldStatus = new(); battlefieldStatus.Ticket = battlefieldPort.Ticket; SendPacket(battlefieldStatus); @@ -581,7 +581,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.RequestRatedPvpInfo)] void HandleRequestRatedPvpInfo(RequestRatedPvpInfo packet) { - RatedPvpInfo ratedPvpInfo = new RatedPvpInfo(); + RatedPvpInfo ratedPvpInfo = new(); SendPacket(ratedPvpInfo); } @@ -589,7 +589,7 @@ namespace Game void HandleGetPVPOptionsEnabled(GetPVPOptionsEnabled packet) { // This packet is completely irrelevant, it triggers PVP_TYPES_ENABLED lua event but that is not handled in interface code as of 6.1.2 - PVPOptionsEnabled pvpOptionsEnabled = new PVPOptionsEnabled(); + PVPOptionsEnabled pvpOptionsEnabled = new(); pvpOptionsEnabled.PugBattlegrounds = true; SendPacket(new PVPOptionsEnabled()); } diff --git a/Source/Game/Handlers/BattlenetHandler.cs b/Source/Game/Handlers/BattlenetHandler.cs index c5a526d56..73020e82b 100644 --- a/Source/Game/Handlers/BattlenetHandler.cs +++ b/Source/Game/Handlers/BattlenetHandler.cs @@ -43,7 +43,7 @@ namespace Game { SetRealmListSecret(changeRealmTicket.Secret); - ChangeRealmTicketResponse realmListTicket = new ChangeRealmTicketResponse(); + ChangeRealmTicketResponse realmListTicket = new(); realmListTicket.Token = changeRealmTicket.Token; realmListTicket.Allow = true; realmListTicket.Ticket = new Framework.IO.ByteBuffer(); @@ -54,7 +54,7 @@ namespace Game public void SendBattlenetResponse(uint serviceHash, uint methodId, uint token, IMessage response) { - Response bnetResponse = new Response(); + Response bnetResponse = new(); bnetResponse.BnetStatus = BattlenetRpcErrorCode.Ok; bnetResponse.Method.Type = MathFunctions.MakePair64(methodId, serviceHash); bnetResponse.Method.ObjectId = 1; @@ -68,7 +68,7 @@ namespace Game public void SendBattlenetResponse(uint serviceHash, uint methodId, uint token, BattlenetRpcErrorCode status) { - Response bnetResponse = new Response(); + Response bnetResponse = new(); bnetResponse.BnetStatus = status; bnetResponse.Method.Type = MathFunctions.MakePair64(methodId, serviceHash); bnetResponse.Method.ObjectId = 1; @@ -85,7 +85,7 @@ namespace Game public void SendBattlenetRequest(uint serviceHash, uint methodId, IMessage request) { - Notification notification = new Notification(); + Notification notification = new(); notification.Method.Type = MathFunctions.MakePair64(methodId, serviceHash); notification.Method.ObjectId = 1; notification.Method.Token = _battlenetRequestToken++; diff --git a/Source/Game/Handlers/BlackMarketHandlers.cs b/Source/Game/Handlers/BlackMarketHandlers.cs index c09476497..1c9339d34 100644 --- a/Source/Game/Handlers/BlackMarketHandlers.cs +++ b/Source/Game/Handlers/BlackMarketHandlers.cs @@ -45,7 +45,7 @@ namespace Game void SendBlackMarketOpenResult(ObjectGuid guid, Creature auctioneer) { - BlackMarketOpenResult packet = new BlackMarketOpenResult(); + BlackMarketOpenResult packet = new(); packet.Guid = guid; packet.Enable = Global.BlackMarketMgr.IsEnabled(); SendPacket(packet); @@ -64,7 +64,7 @@ namespace Game return; } - BlackMarketRequestItemsResult result = new BlackMarketRequestItemsResult(); + BlackMarketRequestItemsResult result = new(); Global.BlackMarketMgr.BuildItemsResponse(result, GetPlayer()); SendPacket(result); } @@ -119,7 +119,7 @@ namespace Game return; } - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); Global.BlackMarketMgr.SendAuctionOutbidMail(entry, trans); entry.PlaceBid(blackMarketBidOnItem.BidAmount, player, trans); @@ -131,7 +131,7 @@ namespace Game void SendBlackMarketBidOnItemResult(BlackMarketError result, uint marketId, ItemInstance item) { - BlackMarketBidOnItemResult packet = new BlackMarketBidOnItemResult(); + BlackMarketBidOnItemResult packet = new(); packet.MarketID = marketId; packet.Item = item; @@ -142,7 +142,7 @@ namespace Game public void SendBlackMarketWonNotification(BlackMarketEntry entry, Item item) { - BlackMarketWon packet = new BlackMarketWon(); + BlackMarketWon packet = new(); packet.MarketID = entry.GetMarketId(); packet.Item = new ItemInstance(item); @@ -152,7 +152,7 @@ namespace Game public void SendBlackMarketOutbidNotification(BlackMarketTemplate templ) { - BlackMarketOutbid packet = new BlackMarketOutbid(); + BlackMarketOutbid packet = new(); packet.MarketID = templ.MarketID; packet.Item = templ.Item; diff --git a/Source/Game/Handlers/CalendarHandler.cs b/Source/Game/Handlers/CalendarHandler.cs index 0f52b4519..a45912a2f 100644 --- a/Source/Game/Handlers/CalendarHandler.cs +++ b/Source/Game/Handlers/CalendarHandler.cs @@ -37,13 +37,13 @@ namespace Game long currTime = Time.UnixTime; - CalendarSendCalendar packet = new CalendarSendCalendar(); + CalendarSendCalendar packet = new(); packet.ServerTime = currTime; var invites = Global.CalendarMgr.GetPlayerInvites(guid); foreach (var invite in invites) { - CalendarSendCalendarInviteInfo inviteInfo = new CalendarSendCalendarInviteInfo(); + CalendarSendCalendarInviteInfo inviteInfo = new(); inviteInfo.EventID = invite.EventId; inviteInfo.InviteID = invite.InviteId; inviteInfo.InviterGuid = invite.SenderGuid; @@ -126,7 +126,7 @@ namespace Game if (calendarAddEvent.EventInfo.Time < (Time.UnixTime - 86400L)) return; - CalendarEvent calendarEvent = new CalendarEvent(Global.CalendarMgr.GetFreeEventId(), guid, 0, (CalendarEventType)calendarAddEvent.EventInfo.EventType, calendarAddEvent.EventInfo.TextureID, + CalendarEvent calendarEvent = new(Global.CalendarMgr.GetFreeEventId(), guid, 0, (CalendarEventType)calendarAddEvent.EventInfo.EventType, calendarAddEvent.EventInfo.TextureID, calendarAddEvent.EventInfo.Time, (CalendarFlags)calendarAddEvent.EventInfo.Flags, calendarAddEvent.EventInfo.Title, calendarAddEvent.EventInfo.Description, 0); if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement()) @@ -138,7 +138,7 @@ namespace Game if (calendarEvent.IsGuildAnnouncement()) { - CalendarInvite invite = new CalendarInvite(0, calendarEvent.EventId, ObjectGuid.Empty, guid, SharedConst.CalendarDefaultResponseTime, CalendarInviteStatus.NotSignedUp, CalendarModerationRank.Player, ""); + CalendarInvite invite = new(0, calendarEvent.EventId, ObjectGuid.Empty, guid, SharedConst.CalendarDefaultResponseTime, CalendarInviteStatus.NotSignedUp, CalendarModerationRank.Player, ""); // WARNING: By passing pointer to a local variable, the underlying method(s) must NOT perform any kind // of storage of the pointer as it will lead to memory corruption Global.CalendarMgr.AddInvite(calendarEvent, invite); @@ -151,7 +151,7 @@ namespace Game for (int i = 0; i < calendarAddEvent.EventInfo.Invites.Length; ++i) { - CalendarInvite invite = new CalendarInvite(Global.CalendarMgr.GetFreeInviteId(), calendarEvent.EventId, + CalendarInvite invite = new(Global.CalendarMgr.GetFreeInviteId(), calendarEvent.EventId, calendarAddEvent.EventInfo.Invites[i].Guid, guid, SharedConst.CalendarDefaultResponseTime, (CalendarInviteStatus)calendarAddEvent.EventInfo.Invites[i].Status, (CalendarModerationRank)calendarAddEvent.EventInfo.Invites[i].Moderator, ""); Global.CalendarMgr.AddInvite(calendarEvent, invite, trans); @@ -214,7 +214,7 @@ namespace Game CalendarEvent oldEvent = Global.CalendarMgr.GetEvent(calendarCopyEvent.EventID); if (oldEvent != null) { - CalendarEvent newEvent = new CalendarEvent(oldEvent, Global.CalendarMgr.GetFreeEventId()); + CalendarEvent newEvent = new(oldEvent, Global.CalendarMgr.GetFreeEventId()); newEvent.Date = calendarCopyEvent.Date; Global.CalendarMgr.AddEvent(newEvent, CalendarSendEventType.Copy); @@ -305,7 +305,7 @@ namespace Game return; } - CalendarInvite invite = new CalendarInvite(Global.CalendarMgr.GetFreeInviteId(), calendarInvite.EventID, inviteeGuid, playerGuid, SharedConst.CalendarDefaultResponseTime, CalendarInviteStatus.Invited, CalendarModerationRank.Player, ""); + CalendarInvite invite = new(Global.CalendarMgr.GetFreeInviteId(), calendarInvite.EventID, inviteeGuid, playerGuid, SharedConst.CalendarDefaultResponseTime, CalendarInviteStatus.Invited, CalendarModerationRank.Player, ""); Global.CalendarMgr.AddInvite(calendarEvent, invite); } else @@ -319,7 +319,7 @@ namespace Game return; } - CalendarInvite invite = new CalendarInvite(calendarInvite.EventID, 0, inviteeGuid, playerGuid, SharedConst.CalendarDefaultResponseTime, CalendarInviteStatus.Invited, CalendarModerationRank.Player, ""); + CalendarInvite invite = new(calendarInvite.EventID, 0, inviteeGuid, playerGuid, SharedConst.CalendarDefaultResponseTime, CalendarInviteStatus.Invited, CalendarModerationRank.Player, ""); Global.CalendarMgr.SendCalendarEventInvite(invite); } } @@ -339,7 +339,7 @@ namespace Game } CalendarInviteStatus status = calendarEventSignUp.Tentative ? CalendarInviteStatus.Tentative : CalendarInviteStatus.SignedUp; - CalendarInvite invite = new CalendarInvite(Global.CalendarMgr.GetFreeInviteId(), calendarEventSignUp.EventID, guid, guid, Time.UnixTime, status, CalendarModerationRank.Player, ""); + CalendarInvite invite = new(Global.CalendarMgr.GetFreeInviteId(), calendarEventSignUp.EventID, guid, guid, Time.UnixTime, status, CalendarModerationRank.Player, ""); Global.CalendarMgr.AddInvite(calendarEvent, invite); Global.CalendarMgr.SendCalendarClearPendingAction(guid); } @@ -495,7 +495,7 @@ namespace Game if (add) { - CalendarRaidLockoutAdded calendarRaidLockoutAdded = new CalendarRaidLockoutAdded(); + CalendarRaidLockoutAdded calendarRaidLockoutAdded = new(); calendarRaidLockoutAdded.InstanceID = save.GetInstanceId(); calendarRaidLockoutAdded.ServerTime = (uint)currTime; calendarRaidLockoutAdded.MapID = (int)save.GetMapId(); @@ -505,7 +505,7 @@ namespace Game } else { - CalendarRaidLockoutRemoved calendarRaidLockoutRemoved = new CalendarRaidLockoutRemoved(); + CalendarRaidLockoutRemoved calendarRaidLockoutRemoved = new(); calendarRaidLockoutRemoved.InstanceID = save.GetInstanceId(); calendarRaidLockoutRemoved.MapID = (int)save.GetMapId(); calendarRaidLockoutRemoved.DifficultyID = save.GetDifficultyID(); @@ -520,7 +520,7 @@ namespace Game long currTime = Time.UnixTime; - CalendarRaidLockoutUpdated packet = new CalendarRaidLockoutUpdated(); + CalendarRaidLockoutUpdated packet = new(); packet.DifficultyID = (uint)save.GetDifficultyID(); packet.MapID = (int)save.GetMapId(); packet.NewTimeRemaining = 0; // FIXME diff --git a/Source/Game/Handlers/CharacterHandler.cs b/Source/Game/Handlers/CharacterHandler.cs index 0b436300e..ed12392cd 100644 --- a/Source/Game/Handlers/CharacterHandler.cs +++ b/Source/Game/Handlers/CharacterHandler.cs @@ -42,7 +42,7 @@ namespace Game DB.Characters.Execute(stmt); // get all the data necessary for loading all characters (along with their pets) on the account - EnumCharactersQueryHolder holder = new EnumCharactersQueryHolder(); + EnumCharactersQueryHolder holder = new(); if (!holder.Initialize(GetAccountId(), WorldConfig.GetBoolValue(WorldCfg.DeclinedNamesUsed), false)) { HandleCharEnum(holder); @@ -54,7 +54,7 @@ namespace Game void HandleCharEnum(EnumCharactersQueryHolder holder) { - EnumCharactersResult charResult = new EnumCharactersResult(); + EnumCharactersResult charResult = new(); charResult.Success = true; charResult.IsDeletedCharacters = holder.IsDeletedCharacters(); charResult.DisabledClassesMask.Set(WorldConfig.GetUIntValue(WorldCfg.CharacterCreatingDisabledClassmask)); @@ -62,13 +62,13 @@ namespace Game if (!charResult.IsDeletedCharacters) _legitCharacters.Clear(); - MultiMap customizations = new MultiMap(); + MultiMap customizations = new(); SQLResult customizationsResult = holder.GetResult(EnumCharacterQueryLoad.Customizations); if (!customizationsResult.IsEmpty()) { do { - ChrCustomizationChoice choice = new ChrCustomizationChoice(); + ChrCustomizationChoice choice = new(); choice.ChrCustomizationOptionID = customizationsResult.Read(1); choice.ChrCustomizationChoiceID = customizationsResult.Read(2); customizations.Add(customizationsResult.Read(0), choice); @@ -81,7 +81,7 @@ namespace Game { do { - EnumCharactersResult.CharacterInfo charInfo = new EnumCharactersResult.CharacterInfo(result.GetFields()); + EnumCharactersResult.CharacterInfo charInfo = new(result.GetFields()); var customizationsForChar = customizations.LookupByKey(charInfo.Guid.GetCounter()); if (!customizationsForChar.Empty()) @@ -126,7 +126,7 @@ namespace Game foreach (var requirement in Global.ObjectMgr.GetRaceUnlockRequirements()) { - EnumCharactersResult.RaceUnlock raceUnlock = new EnumCharactersResult.RaceUnlock(); + EnumCharactersResult.RaceUnlock raceUnlock = new(); raceUnlock.RaceID = requirement.Key; raceUnlock.HasExpansion = (byte)GetAccountExpansion() >= requirement.Value.Expansion; raceUnlock.HasAchievement = requirement.Value.AchievementId != 0 /*|| HasAchievement(requirement.Value.AchievementId)*/; @@ -140,7 +140,7 @@ namespace Game void HandleCharUndeleteEnum(EnumCharacters enumCharacters) { // get all the data necessary for loading all undeleted characters (along with their pets) on the account - EnumCharactersQueryHolder holder = new EnumCharactersQueryHolder(); + EnumCharactersQueryHolder holder = new(); if (!holder.Initialize(GetAccountId(), WorldConfig.GetBoolValue(WorldCfg.DeclinedNamesUsed), true)) { HandleCharEnum(holder); @@ -152,7 +152,7 @@ namespace Game void HandleCharUndeleteEnumCallback(SQLResult result) { - EnumCharactersResult charEnum = new EnumCharactersResult(); + EnumCharactersResult charEnum = new(); charEnum.Success = true; charEnum.IsDeletedCharacters = true; charEnum.DisabledClassesMask.Set(WorldConfig.GetUIntValue(WorldCfg.CharacterCreatingDisabledClassmask)); @@ -161,7 +161,7 @@ namespace Game { do { - EnumCharactersResult.CharacterInfo charInfo = new EnumCharactersResult.CharacterInfo(result.GetFields()); + EnumCharactersResult.CharacterInfo charInfo = new(result.GetFields()); Log.outInfo(LogFilter.Network, "Loading undeleted char guid {0} from account {1}.", charInfo.Guid.ToString(), GetAccountId()); @@ -508,7 +508,7 @@ namespace Game return; } - Player newChar = new Player(this); + Player newChar = new(this); newChar.GetMotionMaster().Initialize(); if (!newChar.Create(Global.ObjectMgr.GetGenerator(HighGuid.Player).Generate(), createInfo)) { @@ -524,8 +524,8 @@ namespace Game newChar.atLoginFlags = AtLoginFlags.FirstLogin; // First login - SQLTransaction characterTransaction = new SQLTransaction(); - SQLTransaction loginTransaction = new SQLTransaction(); + SQLTransaction characterTransaction = new(); + SQLTransaction loginTransaction = new(); // Player created, save it now newChar.SaveToDB(loginTransaction, characterTransaction, true); @@ -648,7 +648,7 @@ namespace Game return; } - GenerateRandomCharacterNameResult result = new GenerateRandomCharacterNameResult(); + GenerateRandomCharacterNameResult result = new(); result.Success = true; result.Name = Global.DB2Mgr.GetNameGenEntry(packet.Race, packet.Sex); @@ -658,7 +658,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.ReorderCharacters, Status = SessionStatus.Authed)] void HandleReorderCharacters(ReorderCharacters reorderChars) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); foreach (var reorderInfo in reorderChars.Entries) { @@ -702,7 +702,7 @@ namespace Game return; } - LoginQueryHolder holder = new LoginQueryHolder(GetAccountId(), m_playerLoading); + LoginQueryHolder holder = new(GetAccountId(), m_playerLoading); holder.Initialize(); SendPacket(new ResumeComms(ConnectionType.Instance)); @@ -714,7 +714,7 @@ namespace Game { ObjectGuid playerGuid = holder.GetGuid(); - Player pCurrChar = new Player(this); + Player pCurrChar = new(this); if (!pCurrChar.LoadFromDB(playerGuid, holder)) { SetPlayer(null); @@ -730,14 +730,14 @@ namespace Game pCurrChar.GetMotionMaster().Initialize(); pCurrChar.SendDungeonDifficulty(); - LoginVerifyWorld loginVerifyWorld = new LoginVerifyWorld(); + LoginVerifyWorld loginVerifyWorld = new(); loginVerifyWorld.MapID = (int)pCurrChar.GetMapId(); loginVerifyWorld.Pos = pCurrChar.GetPosition(); SendPacket(loginVerifyWorld); LoadAccountData(holder.GetResult(PlayerLoginQueryLoad.AccountData), AccountDataTypes.PerCharacterCacheMask); - AccountDataTimes accountDataTimes = new AccountDataTimes(); + AccountDataTimes accountDataTimes = new(); accountDataTimes.PlayerGuid = playerGuid; accountDataTimes.ServerTime = (uint)GameTime.GetGameTime(); for (AccountDataTypes i = 0; i < AccountDataTypes.Max; ++i) @@ -747,7 +747,7 @@ namespace Game SendFeatureSystemStatus(); - MOTD motd = new MOTD(); + MOTD motd = new(); motd.Text = Global.WorldMgr.GetMotd(); SendPacket(motd); @@ -755,7 +755,7 @@ namespace Game // Send PVPSeason { - SeasonInfo seasonInfo = new SeasonInfo(); + SeasonInfo seasonInfo = new(); seasonInfo.PreviousSeason = (WorldConfig.GetIntValue(WorldCfg.ArenaSeasonId) - (WorldConfig.GetBoolValue(WorldCfg.ArenaSeasonInProgress) ? 1 : 0)); if (WorldConfig.GetBoolValue(WorldCfg.ArenaSeasonInProgress)) @@ -855,12 +855,12 @@ namespace Game stmt.AddValue(0, pCurrChar.GetGUID().GetCounter()); GetQueryProcessor().AddCallback(DB.Characters.AsyncQuery(stmt)).WithCallback(favoriteAuctionResult => { - AuctionFavoriteList favoriteItems = new AuctionFavoriteList(); + AuctionFavoriteList favoriteItems = new(); if (!favoriteAuctionResult.IsEmpty()) { do { - AuctionFavoriteInfo item = new AuctionFavoriteInfo(); + AuctionFavoriteInfo item = new(); item.Order = favoriteAuctionResult.Read(0); item.ItemID = favoriteAuctionResult.Read(1); item.ItemLevel = favoriteAuctionResult.Read(2); @@ -1049,7 +1049,7 @@ namespace Game public void SendFeatureSystemStatus() { - FeatureSystemStatus features = new FeatureSystemStatus(); + FeatureSystemStatus features = new(); // START OF DUMMY VALUES features.ComplaintStatus = 2; @@ -1239,7 +1239,7 @@ namespace Game } atLoginFlags &= ~AtLoginFlags.Rename; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); ulong lowGuid = renameInfo.Guid.GetCounter(); // Update name and at_login flag in the db @@ -1298,7 +1298,7 @@ namespace Game packet.DeclinedNames.name[i] = declinedName; } - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME); stmt.AddValue(0, packet.Player.GetCounter()); @@ -1450,7 +1450,7 @@ namespace Game } PreparedStatement stmt; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); ulong lowGuid = customizeInfo.CharGUID.GetCounter(); // Customize @@ -1582,7 +1582,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.UseEquipmentSet)] void HandleUseEquipmentSet(UseEquipmentSet useEquipmentSet) { - ObjectGuid ignoredItemGuid = new ObjectGuid(0x0C00040000000000, 0xFFFFFFFFFFFFFFFF); + ObjectGuid ignoredItemGuid = new(0x0C00040000000000, 0xFFFFFFFFFFFFFFFF); for (byte i = 0; i < EquipmentSlot.End; ++i) { Log.outDebug(LogFilter.Player, "{0}: ContainerSlot: {1}, Slot: {2}", useEquipmentSet.Items[i].Item.ToString(), useEquipmentSet.Items[i].ContainerSlot, useEquipmentSet.Items[i].Slot); @@ -1604,7 +1604,7 @@ namespace Game if (!uItem) continue; - List itemPosCount = new List(); + List itemPosCount = new(); InventoryResult inventoryResult = GetPlayer().CanStoreItem(ItemConst.NullBag, ItemConst.NullSlot, itemPosCount, uItem, false); if (inventoryResult == InventoryResult.Ok) { @@ -1629,7 +1629,7 @@ namespace Game GetPlayer().SwapItem(item.GetPos(), dstPos); } - UseEquipmentSetResult result = new UseEquipmentSetResult(); + UseEquipmentSetResult result = new(); result.GUID = useEquipmentSet.GUID; result.Reason = 0; // 4 - equipment swap failed - inventory is full SendPacket(result); @@ -1761,7 +1761,7 @@ namespace Game ulong lowGuid = factionChangeInfo.Guid.GetCounter(); PreparedStatement stmt; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); // resurrect the character in case he's dead Player.OfflineResurrect(factionChangeInfo.Guid, trans); @@ -2089,7 +2089,7 @@ namespace Game // Title conversion if (!string.IsNullOrEmpty(knownTitlesStr)) { - List knownTitles = new List(); + List knownTitles = new(); var tokens = new StringArray(knownTitlesStr, ' '); for (int index = 0; index < tokens.Length; ++index) @@ -2339,7 +2339,7 @@ namespace Game uint zoneId = GetPlayer().GetZoneId(); uint team = (uint)GetPlayer().GetTeam(); - List graveyardIds = new List(); + List graveyardIds = new(); var range = Global.ObjectMgr.GraveYardStorage.LookupByKey(zoneId); for (uint i = 0; i < range.Count && graveyardIds.Count < 16; ++i) // client max @@ -2356,7 +2356,7 @@ namespace Game return; } - RequestCemeteryListResponse packet = new RequestCemeteryListResponse(); + RequestCemeteryListResponse packet = new(); packet.IsGossipTriggered = false; foreach (uint id in graveyardIds) @@ -2439,7 +2439,7 @@ namespace Game void SendCharCreate(ResponseCodes result, ObjectGuid guid = default) { - CreateChar response = new CreateChar(); + CreateChar response = new(); response.Code = result; response.Guid = guid; @@ -2448,7 +2448,7 @@ namespace Game void SendCharDelete(ResponseCodes result) { - DeleteChar response = new DeleteChar(); + DeleteChar response = new(); response.Code = result; SendPacket(response); @@ -2456,7 +2456,7 @@ namespace Game void SendCharRename(ResponseCodes result, CharacterRenameInfo renameInfo) { - CharacterRenameResult packet = new CharacterRenameResult(); + CharacterRenameResult packet = new(); packet.Result = result; packet.Name = renameInfo.NewName; if (result == ResponseCodes.Success) @@ -2469,12 +2469,12 @@ namespace Game { if (result == ResponseCodes.Success) { - CharCustomizeSuccess response = new CharCustomizeSuccess(customizeInfo); + CharCustomizeSuccess response = new(customizeInfo); SendPacket(response); } else { - CharCustomizeFailure failed = new CharCustomizeFailure(); + CharCustomizeFailure failed = new(); failed.Result = (byte)result; failed.CharGUID = customizeInfo.CharGUID; SendPacket(failed); @@ -2483,7 +2483,7 @@ namespace Game void SendCharFactionChange(ResponseCodes result, CharRaceOrFactionChangeInfo factionChangeInfo) { - CharFactionChangeResult packet = new CharFactionChangeResult(); + CharFactionChangeResult packet = new(); packet.Result = result; packet.Guid = factionChangeInfo.Guid; @@ -2501,7 +2501,7 @@ namespace Game void SendSetPlayerDeclinedNamesResult(DeclinedNameResult result, ObjectGuid guid) { - SetPlayerDeclinedNamesResult packet = new SetPlayerDeclinedNamesResult(); + SetPlayerDeclinedNamesResult packet = new(); packet.ResultCode = result; packet.Player = guid; @@ -2510,7 +2510,7 @@ namespace Game void SendUndeleteCooldownStatusResponse(uint currentCooldown, uint maxCooldown) { - UndeleteCooldownStatusResponse response = new UndeleteCooldownStatusResponse(); + UndeleteCooldownStatusResponse response = new(); response.OnCooldown = (currentCooldown > 0); response.MaxCooldown = maxCooldown; response.CurrentCooldown = currentCooldown; @@ -2520,7 +2520,7 @@ namespace Game void SendUndeleteCharacterResponse(CharacterUndeleteResult result, CharacterUndeleteInfo undeleteInfo) { - UndeleteCharacterResponse response = new UndeleteCharacterResponse(); + UndeleteCharacterResponse response = new(); response.UndeleteInfo = undeleteInfo; response.Result = result; diff --git a/Source/Game/Handlers/ChatHandler.cs b/Source/Game/Handlers/ChatHandler.cs index 3d7d07226..54552928a 100644 --- a/Source/Game/Handlers/ChatHandler.cs +++ b/Source/Game/Handlers/ChatHandler.cs @@ -282,7 +282,7 @@ namespace Game Global.ScriptMgr.OnPlayerChat(GetPlayer(), type, lang, msg, group); - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(type, lang, sender, null, msg); group.BroadcastPacket(data, false, group.GetMemberGroup(GetPlayer().GetGUID())); } @@ -322,7 +322,7 @@ namespace Game Global.ScriptMgr.OnPlayerChat(GetPlayer(), type, lang, msg, group); - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(type, lang, sender, null, msg); group.BroadcastPacket(data, false); } @@ -335,7 +335,7 @@ namespace Game Global.ScriptMgr.OnPlayerChat(GetPlayer(), type, lang, msg, group); - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); //in Battleground, raid warning is sent only to players in Battleground - code is ok data.Initialize(ChatMsg.RaidWarning, lang, sender, null, msg); group.BroadcastPacket(data, false); @@ -368,7 +368,7 @@ namespace Game Global.ScriptMgr.OnPlayerChat(GetPlayer(), type, lang, msg, group); - ChatPkt packet = new ChatPkt(); + ChatPkt packet = new(); packet.Initialize(type, lang, sender, null, msg); group.BroadcastPacket(packet, false); break; @@ -449,7 +449,7 @@ namespace Game subGroup = sender.GetSubGroup(); } - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(type, isLogged ? Language.AddonLogged : Language.Addon, sender, null, text, 0, "", Locale.enUS, prefix); group.BroadcastAddonMessagePacket(data, prefix, true, subGroup, sender.GetGUID()); break; @@ -592,7 +592,7 @@ namespace Game break; } - STextEmote textEmote = new STextEmote(); + STextEmote textEmote = new(); textEmote.SourceGUID = GetPlayer().GetGUID(); textEmote.SourceAccountGUID = GetAccountGUID(); textEmote.TargetGUID = packet.Target; @@ -620,7 +620,7 @@ namespace Game if (!player || player.GetSession() == null) return; - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(ChatMsg.Ignored, Language.Universal, GetPlayer(), GetPlayer(), GetPlayer().GetName()); player.SendPacket(data); } diff --git a/Source/Game/Handlers/DuelHandler.cs b/Source/Game/Handlers/DuelHandler.cs index 88e2a79d3..5b21a5637 100644 --- a/Source/Game/Handlers/DuelHandler.cs +++ b/Source/Game/Handlers/DuelHandler.cs @@ -32,7 +32,7 @@ namespace Game if (!player) return; - CanDuelResult response = new CanDuelResult(); + CanDuelResult response = new(); response.TargetGUID = packet.TargetGUID; response.Result = player.duel == null; SendPacket(response); @@ -73,7 +73,7 @@ namespace Game player.duel.startTimer = now; plTarget.duel.startTimer = now; - DuelCountdown packet = new DuelCountdown(3000); + DuelCountdown packet = new(3000); player.SendPacket(packet); plTarget.SendPacket(packet); diff --git a/Source/Game/Handlers/GroupHandler.cs b/Source/Game/Handlers/GroupHandler.cs index 7a1ff7f89..c7f5a5619 100644 --- a/Source/Game/Handlers/GroupHandler.cs +++ b/Source/Game/Handlers/GroupHandler.cs @@ -27,7 +27,7 @@ namespace Game { public void SendPartyResult(PartyOperation operation, string member, PartyResult res, uint val = 0) { - PartyCommandResult packet = new PartyCommandResult(); + PartyCommandResult packet = new(); packet.Name = member; packet.Command = (byte)operation; @@ -232,7 +232,7 @@ namespace Game return; // report - GroupDecline decline = new GroupDecline(GetPlayer().GetName()); + GroupDecline decline = new(GetPlayer().GetName()); leader.SendPacket(decline); } } @@ -294,7 +294,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.SetRole, Processing = PacketProcessing.Inplace)] void HandleSetRole(SetRole packet) { - RoleChangedInform roleChangedInform = new RoleChangedInform(); + RoleChangedInform roleChangedInform = new(); Group group = GetPlayer().GetGroup(); byte oldRole = (byte)(group ? group.GetLfgRoles(packet.TargetGUID) : 0); @@ -407,7 +407,7 @@ namespace Game if (!GetPlayer().GetGroup()) return; - MinimapPing minimapPing = new MinimapPing(); + MinimapPing minimapPing = new(); minimapPing.Sender = GetPlayer().GetGUID(); minimapPing.PositionX = packet.PositionX; minimapPing.PositionY = packet.PositionY; @@ -586,7 +586,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.RequestPartyMemberStats)] void HandleRequestPartyMemberStats(RequestPartyMemberStats packet) { - PartyMemberFullState partyMemberStats = new PartyMemberFullState(); + PartyMemberFullState partyMemberStats = new(); Player player = Global.ObjAccessor.FindConnectedPlayer(packet.TargetGUID); if (!player) @@ -632,7 +632,7 @@ namespace Game if (!group.IsLeader(guid) && !group.IsAssistant(guid)) return; - RolePollInform rolePollInform = new RolePollInform(); + RolePollInform rolePollInform = new(); rolePollInform.From = guid; rolePollInform.PartyIndex = packet.PartyIndex; group.BroadcastPacket(rolePollInform, true); diff --git a/Source/Game/Handlers/GuildFinderHandler.cs b/Source/Game/Handlers/GuildFinderHandler.cs index 867e0c3ec..a6f058e87 100644 --- a/Source/Game/Handlers/GuildFinderHandler.cs +++ b/Source/Game/Handlers/GuildFinderHandler.cs @@ -43,7 +43,7 @@ namespace Game if (!lfGuildAddRecruit.PlayStyle.HasAnyFlag((uint)GuildFinderOptionsInterest.All) || lfGuildAddRecruit.PlayStyle > (uint)GuildFinderOptionsInterest.All) return; - MembershipRequest request = new MembershipRequest(GetPlayer().GetGUID(), lfGuildAddRecruit.GuildGUID, lfGuildAddRecruit.Availability, + MembershipRequest request = new(GetPlayer().GetGUID(), lfGuildAddRecruit.GuildGUID, lfGuildAddRecruit.Availability, lfGuildAddRecruit.ClassRoles, lfGuildAddRecruit.PlayStyle, lfGuildAddRecruit.Comment, Time.UnixTime); Global.GuildFinderMgr.AddMembershipRequest(lfGuildAddRecruit.GuildGUID, request); } @@ -62,14 +62,14 @@ namespace Game Player player = GetPlayer(); - LFGuildPlayer settings = new LFGuildPlayer(player.GetGUID(), lfGuildBrowse.ClassRoles, lfGuildBrowse.Availability, lfGuildBrowse.PlayStyle, (uint)GuildFinderOptionsLevel.Any); + LFGuildPlayer settings = new(player.GetGUID(), lfGuildBrowse.ClassRoles, lfGuildBrowse.Availability, lfGuildBrowse.PlayStyle, (uint)GuildFinderOptionsLevel.Any); var guildList = Global.GuildFinderMgr.GetGuildsMatchingSetting(settings, (uint)player.GetTeam()); - LFGuildBrowseResult lfGuildBrowseResult = new LFGuildBrowseResult(); + LFGuildBrowseResult lfGuildBrowseResult = new(); for (var i = 0; i < guildList.Count; ++i) { LFGuildSettings guildSettings = guildList[i]; - LFGuildBrowseData guildData = new LFGuildBrowseData(); + LFGuildBrowseData guildData = new(); Guild guild = Global.GuildMgr.GetGuildByGuid(guildSettings.GetGUID()); guildData.GuildName = guild.GetName(); @@ -112,13 +112,13 @@ namespace Game void HandleGuildFinderGetApplications(LFGuildGetApplications lfGuildGetApplications) { List applicatedGuilds = Global.GuildFinderMgr.GetAllMembershipRequestsForPlayer(GetPlayer().GetGUID()); - LFGuildApplications lfGuildApplications = new LFGuildApplications(); + LFGuildApplications lfGuildApplications = new(); lfGuildApplications.NumRemaining = 10 - Global.GuildFinderMgr.CountRequestsFromPlayer(GetPlayer().GetGUID()); for (var i = 0; i < applicatedGuilds.Count; ++i) { MembershipRequest application = applicatedGuilds[i]; - LFGuildApplicationData applicationData = new LFGuildApplicationData(); + LFGuildApplicationData applicationData = new(); Guild guild = Global.GuildMgr.GetGuildByGuid(application.GetGuildGuid()); LFGuildSettings guildSettings = Global.GuildFinderMgr.GetGuildSettings(application.GetGuildGuid()); @@ -148,7 +148,7 @@ namespace Game if (!guild) // Player must be in guild return; - LFGuildPost lfGuildPost = new LFGuildPost(); + LFGuildPost lfGuildPost = new(); if (guild.GetLeaderGUID() == player.GetGUID()) { LFGuildSettings settings = Global.GuildFinderMgr.GetGuildSettings(guild.GetGUID()); @@ -177,14 +177,14 @@ namespace Game return; long now = Time.UnixTime; - LFGuildRecruits lfGuildRecruits = new LFGuildRecruits(); + LFGuildRecruits lfGuildRecruits = new(); lfGuildRecruits.UpdateTime = now; var recruitsList = Global.GuildFinderMgr.GetAllMembershipRequestsForGuild(guild.GetGUID()); if (recruitsList != null) { foreach (var recruitRequestPair in recruitsList) { - LFGuildRecruitData recruitData = new LFGuildRecruitData(); + LFGuildRecruitData recruitData = new(); recruitData.RecruitGUID = recruitRequestPair.Key; recruitData.RecruitVirtualRealm = Global.WorldMgr.GetVirtualRealmAddress(); recruitData.Comment = recruitRequestPair.Value.GetComment(); @@ -248,7 +248,7 @@ namespace Game if (guild.GetLeaderGUID() != player.GetGUID()) return; - LFGuildSettings settings = new LFGuildSettings(lfGuildSetGuildPost.Active, (uint)player.GetTeam(), player.GetGuild().GetGUID(), lfGuildSetGuildPost.ClassRoles, + LFGuildSettings settings = new(lfGuildSetGuildPost.Active, (uint)player.GetTeam(), player.GetGuild().GetGUID(), lfGuildSetGuildPost.ClassRoles, lfGuildSetGuildPost.Availability, lfGuildSetGuildPost.PlayStyle, lfGuildSetGuildPost.LevelRange, lfGuildSetGuildPost.Comment); Global.GuildFinderMgr.SetGuildSettings(player.GetGuild().GetGUID(), settings); } diff --git a/Source/Game/Handlers/GuildHandler.cs b/Source/Game/Handlers/GuildHandler.cs index 87f4680f6..bf107a995 100644 --- a/Source/Game/Handlers/GuildHandler.cs +++ b/Source/Game/Handlers/GuildHandler.cs @@ -38,7 +38,7 @@ namespace Game } } - QueryGuildInfoResponse response = new QueryGuildInfoResponse(); + QueryGuildInfoResponse response = new(); response.GuildGUID = query.GuildGuid; response.PlayerGuid = query.PlayerGuid; SendPacket(response); @@ -185,7 +185,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.SaveGuildEmblem)] void HandleSaveGuildEmblem(SaveGuildEmblem packet) { - Guild.EmblemInfo emblemInfo = new Guild.EmblemInfo(); + Guild.EmblemInfo emblemInfo = new(); emblemInfo.ReadPacket(packet); if (GetPlayer().GetNPCIfCanInteractWith(packet.Vendor, NPCFlags.TabardDesigner, NPCFlags2.None)) @@ -407,12 +407,12 @@ namespace Game { var rewards = Global.GuildMgr.GetGuildRewards(); - GuildRewardList rewardList = new GuildRewardList(); + GuildRewardList rewardList = new(); rewardList.Version = (uint)Time.UnixTime; for (int i = 0; i < rewards.Count; i++) { - GuildRewardItem rewardItem = new GuildRewardItem(); + GuildRewardItem rewardItem = new(); rewardItem.ItemID = rewards[i].ItemID; rewardItem.RaceMask = (uint)rewards[i].RaceMask; rewardItem.MinGuildLevel = 0; diff --git a/Source/Game/Handlers/HotfixHandler.cs b/Source/Game/Handlers/HotfixHandler.cs index dc5ae4c73..1950f12cb 100644 --- a/Source/Game/Handlers/HotfixHandler.cs +++ b/Source/Game/Handlers/HotfixHandler.cs @@ -32,7 +32,7 @@ namespace Game foreach (DBQueryBulk.DBQueryRecord record in dbQuery.Queries) { - DBReply dbReply = new DBReply(); + DBReply dbReply = new(); dbReply.TableHash = dbQuery.TableHash; dbReply.RecordID = record.RecordID; @@ -69,13 +69,13 @@ namespace Game { var hotfixes = Global.DB2Mgr.GetHotfixData(); - HotfixConnect hotfixQueryResponse = new HotfixConnect(); + HotfixConnect hotfixQueryResponse = new(); foreach (HotfixRecord hotfixRecord in hotfixQuery.Hotfixes) { var serverHotfixIndex = hotfixes.IndexOf(hotfixRecord); if (serverHotfixIndex != -1) { - HotfixConnect.HotfixData hotfixData = new HotfixConnect.HotfixData(); + HotfixConnect.HotfixData hotfixData = new(); hotfixData.Record = hotfixes[serverHotfixIndex]; if (hotfixData.Record.HotfixStatus == HotfixRecord.Status.Valid) { diff --git a/Source/Game/Handlers/InspectHandler.cs b/Source/Game/Handlers/InspectHandler.cs index 19eacc216..a2924a023 100644 --- a/Source/Game/Handlers/InspectHandler.cs +++ b/Source/Game/Handlers/InspectHandler.cs @@ -42,7 +42,7 @@ namespace Game if (GetPlayer().IsValidAttackTarget(player)) return; - InspectResult inspectResult = new InspectResult(); + InspectResult inspectResult = new(); inspectResult.DisplayInfo.Initialize(player); if (GetPlayer().CanBeGameMaster() || WorldConfig.GetIntValue(WorldCfg.TalentsInspecting) + (GetPlayer().GetTeamId() == player.GetTeamId() ? 1 : 0) > 1) diff --git a/Source/Game/Handlers/ItemHandler.cs b/Source/Game/Handlers/ItemHandler.cs index 0fb2ed8ae..68f59cad7 100644 --- a/Source/Game/Handlers/ItemHandler.cs +++ b/Source/Game/Handlers/ItemHandler.cs @@ -229,7 +229,7 @@ namespace Game if (!dstItem.HasItemFlag(ItemFieldFlags.Child)) { // check dest.src move possibility - List sSrc = new List(); + List sSrc = new(); ushort eSrc = 0; if (pl.IsInventoryPos(src)) { @@ -353,7 +353,7 @@ namespace Game InventoryResult msg = _player.CanUseItem(item); if (msg == InventoryResult.Ok) { - ReadItemResultOK packet = new ReadItemResultOK(); + ReadItemResultOK packet = new(); packet.Item = item.GetGUID(); SendPacket(packet); } @@ -515,7 +515,7 @@ namespace Game return; } - List dest = new List(); + List dest = new(); InventoryResult msg = _player.CanStoreItem(ItemConst.NullBag, ItemConst.NullSlot, dest, pItem, false); if (msg == InventoryResult.Ok) { @@ -594,7 +594,7 @@ namespace Game } } - List dest = new List(); + List dest = new(); msg = GetPlayer().CanStoreItem(packet.ContainerSlotB, ItemConst.NullSlot, dest, item, false); if (msg != InventoryResult.Ok) { @@ -616,7 +616,7 @@ namespace Game public void SendEnchantmentLog(ObjectGuid owner, ObjectGuid caster, ObjectGuid itemGuid, uint itemId, uint enchantId, uint enchantSlot) { - EnchantmentLog packet = new EnchantmentLog(); + EnchantmentLog packet = new(); packet.Owner = owner; packet.Caster = caster; packet.ItemGUID = itemGuid; @@ -629,7 +629,7 @@ namespace Game public void SendItemEnchantTimeUpdate(ObjectGuid Playerguid, ObjectGuid Itemguid, uint slot, uint Duration) { - ItemEnchantTimeUpdate data = new ItemEnchantTimeUpdate(); + ItemEnchantTimeUpdate data = new(); data.ItemGuid = Itemguid; data.DurationLeft = Duration; data.Slot = slot; @@ -716,7 +716,7 @@ namespace Game return; } - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_GIFT); stmt.AddValue(0, item.GetOwnerGUID().GetCounter()); diff --git a/Source/Game/Handlers/LFGHandler.cs b/Source/Game/Handlers/LFGHandler.cs index 5fd32317d..2acdcfa6f 100644 --- a/Source/Game/Handlers/LFGHandler.cs +++ b/Source/Game/Handlers/LFGHandler.cs @@ -43,7 +43,7 @@ namespace Game return; } - List newDungeons = new List(); + List newDungeons = new(); foreach (uint slot in dfJoin.Slots) { uint dungeon = slot & 0x00FFFFFF; @@ -147,7 +147,7 @@ namespace Game uint contentTuningReplacementConditionMask = GetPlayer().m_playerData.CtrOptions.GetValue().ContentTuningConditionMask; var randomDungeons = Global.LFGMgr.GetRandomAndSeasonalDungeons(level, (uint)GetExpansion(), contentTuningReplacementConditionMask); - LfgPlayerInfo lfgPlayerInfo = new LfgPlayerInfo(); + LfgPlayerInfo lfgPlayerInfo = new(); // Get player locked Dungeons foreach (var locked in Global.LFGMgr.GetLockedDungeons(_player.GetGUID())) @@ -216,7 +216,7 @@ namespace Game if (!group) return; - LfgPartyInfo lfgPartyInfo = new LfgPartyInfo(); + LfgPartyInfo lfgPartyInfo = new(); // Get the Locked dungeons of the other party members for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next()) @@ -229,7 +229,7 @@ namespace Game if (pguid == guid) continue; - LFGBlackList lfgBlackList = new LFGBlackList(); + LFGBlackList lfgBlackList = new(); lfgBlackList.PlayerGuid.Set(pguid); foreach (var locked in Global.LFGMgr.GetLockedDungeons(pguid)) lfgBlackList.Slot.Add(new LFGBlackListSlot(locked.Key, (uint)locked.Value.lockStatus, locked.Value.requiredItemLevel, (int)locked.Value.currentItemLevel, 0)); @@ -267,7 +267,7 @@ namespace Game break; } - LFGUpdateStatus lfgUpdateStatus = new LFGUpdateStatus(); + LFGUpdateStatus lfgUpdateStatus = new(); RideTicket ticket = Global.LFGMgr.GetTicket(_player.GetGUID()); if (ticket != null) @@ -293,7 +293,7 @@ namespace Game public void SendLfgRoleChosen(ObjectGuid guid, LfgRoles roles) { - RoleChosen roleChosen = new RoleChosen(); + RoleChosen roleChosen = new(); roleChosen.Player = guid; roleChosen.RoleMask = roles; roleChosen.Accepted = roles > 0; @@ -302,7 +302,7 @@ namespace Game public void SendLfgRoleCheckUpdate(LfgRoleCheck roleCheck) { - List dungeons = new List(); + List dungeons = new(); if (roleCheck.rDungeonId != 0) dungeons.Add(roleCheck.rDungeonId); else @@ -310,7 +310,7 @@ namespace Game Log.outDebug(LogFilter.Lfg, "SMSG_LFG_ROLE_CHECK_UPDATE {0}", GetPlayerInfo()); - LFGRoleCheckUpdate lfgRoleCheckUpdate = new LFGRoleCheckUpdate(); + LFGRoleCheckUpdate lfgRoleCheckUpdate = new(); lfgRoleCheckUpdate.PartyIndex = 127; lfgRoleCheckUpdate.RoleCheckStatus = (byte)roleCheck.state; lfgRoleCheckUpdate.IsBeginning = roleCheck.state == LfgRoleCheckState.Initialiting; @@ -340,7 +340,7 @@ namespace Game public void SendLfgJoinResult(LfgJoinResultData joinData) { - LFGJoinResult lfgJoinResult = new LFGJoinResult(); + LFGJoinResult lfgJoinResult = new(); RideTicket ticket = Global.LFGMgr.GetTicket(GetPlayer().GetGUID()); if (ticket != null) @@ -378,7 +378,7 @@ namespace Game GetPlayerInfo(), Global.LFGMgr.GetState(GetPlayer().GetGUID()), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg, queueData.waitTimeTank, queueData.waitTimeHealer, queueData.waitTimeDps, queueData.queuedTime, queueData.tanks, queueData.healers, queueData.dps); - LFGQueueStatus lfgQueueStatus = new LFGQueueStatus(); + LFGQueueStatus lfgQueueStatus = new(); RideTicket ticket = Global.LFGMgr.GetTicket(GetPlayer().GetGUID()); if (ticket != null) @@ -405,7 +405,7 @@ namespace Game Log.outDebug(LogFilter.Lfg, "SMSG_LFG_PLAYER_REWARD {0} rdungeonEntry: {1}, sdungeonEntry: {2}, done: {3}", GetPlayerInfo(), rewardData.rdungeonEntry, rewardData.sdungeonEntry, rewardData.done); - LFGPlayerReward lfgPlayerReward = new LFGPlayerReward(); + LFGPlayerReward lfgPlayerReward = new(); lfgPlayerReward.QueuedSlot = rewardData.rdungeonEntry; lfgPlayerReward.ActualSlot = rewardData.sdungeonEntry; lfgPlayerReward.RewardMoney = GetPlayer().GetQuestMoneyReward(rewardData.quest); @@ -446,7 +446,7 @@ namespace Game Log.outDebug(LogFilter.Lfg, "SMSG_LFG_BOOT_PROPOSAL_UPDATE {0} inProgress: {1} - didVote: {2} - agree: {3} - victim: {4} votes: {5} - agrees: {6} - left: {7} - needed: {8} - reason {9}", GetPlayerInfo(), boot.inProgress, playerVote != LfgAnswer.Pending, playerVote == LfgAnswer.Agree, boot.victim.ToString(), votesNum, agreeNum, secsleft, SharedConst.LFGKickVotesNeeded, boot.reason); - LfgBootPlayer lfgBootPlayer = new LfgBootPlayer(); + LfgBootPlayer lfgBootPlayer = new(); lfgBootPlayer.Info.VoteInProgress = boot.inProgress; // Vote in progress lfgBootPlayer.Info.VotePassed = agreeNum >= SharedConst.LFGKickVotesNeeded; // Did succeed lfgBootPlayer.Info.MyVoteCompleted = playerVote != LfgAnswer.Pending; // Did Vote @@ -477,7 +477,7 @@ namespace Game dungeonEntry = playerDungeons.First(); } - LFGProposalUpdate lfgProposalUpdate = new LFGProposalUpdate(); + LFGProposalUpdate lfgProposalUpdate = new(); RideTicket ticket = Global.LFGMgr.GetTicket(GetPlayer().GetGUID()); if (ticket != null) diff --git a/Source/Game/Handlers/LogoutHandler.cs b/Source/Game/Handlers/LogoutHandler.cs index 91c239e8c..22e34364c 100644 --- a/Source/Game/Handlers/LogoutHandler.cs +++ b/Source/Game/Handlers/LogoutHandler.cs @@ -44,7 +44,7 @@ namespace Game else if (pl.duel != null || pl.HasAura(9454)) // is dueling or frozen by GM via freeze command reason = 2; // FIXME - Need the correct value - LogoutResponse logoutResponse = new LogoutResponse(); + LogoutResponse logoutResponse = new(); logoutResponse.LogoutResult = reason; logoutResponse.Instant = instantLogout; SendPacket(logoutResponse); diff --git a/Source/Game/Handlers/LootHandler.cs b/Source/Game/Handlers/LootHandler.cs index c485510e8..ede0867f4 100644 --- a/Source/Game/Handlers/LootHandler.cs +++ b/Source/Game/Handlers/LootHandler.cs @@ -184,7 +184,7 @@ namespace Game Group group = player.GetGroup(); - List playersNear = new List(); + List playersNear = new(); for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next()) { Player member = refe.GetSource(); @@ -204,7 +204,7 @@ namespace Game pl.ModifyMoney((long)(goldPerPlayer + goldMod)); pl.UpdateCriteria(CriteriaTypes.LootMoney, goldPerPlayer); - LootMoneyNotify packet = new LootMoneyNotify(); + LootMoneyNotify packet = new(); packet.Money = goldPerPlayer; packet.MoneyMod = goldMod; packet.SoleLooter = playersNear.Count <= 1 ? true : false; @@ -218,7 +218,7 @@ namespace Game player.ModifyMoney((long)(loot.gold + goldMod)); player.UpdateCriteria(CriteriaTypes.LootMoney, loot.gold); - LootMoneyNotify packet = new LootMoneyNotify(); + LootMoneyNotify packet = new(); packet.Money = loot.gold; packet.MoneyMod = goldMod; packet.SoleLooter = true; // "You loot..." @@ -272,9 +272,9 @@ namespace Game if (!GetPlayer().IsAlive() || !packet.Unit.IsCreatureOrVehicle()) return; - List corpses = new List(); - AELootCreatureCheck check = new AELootCreatureCheck(_player, packet.Unit); - CreatureListSearcher searcher = new CreatureListSearcher(_player, corpses, check); + List corpses = new(); + AELootCreatureCheck check = new(_player, packet.Unit); + CreatureListSearcher searcher = new(_player, corpses, check); Cell.VisitGridObjects(_player, searcher, AELootCreatureCheck.LootDistance); if (!corpses.Empty()) @@ -459,7 +459,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.MasterLootItem)] void HandleLootMasterGive(MasterLootItem masterLootItem) { - AELootResult aeResult = new AELootResult(); + AELootResult aeResult = new(); if (GetPlayer().GetGroup() == null || GetPlayer().GetGroup().GetLooterGuid() != GetPlayer().GetGUID() || GetPlayer().GetGroup().GetLootMethod() != LootMethod.MasterLoot) { @@ -516,7 +516,7 @@ namespace Game LootItem item = slotid >= loot.items.Count ? loot.quest_items[slotid - loot.items.Count] : loot.items[slotid]; - List dest = new List(); + List dest = new(); InventoryResult msg = target.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, item.itemid, item.count); if (item.follow_loot_rules && !item.AllowedForPlayer(target)) msg = InventoryResult.CantEquipEver; diff --git a/Source/Game/Handlers/MailHandler.cs b/Source/Game/Handlers/MailHandler.cs index 258706e84..0c09f6867 100644 --- a/Source/Game/Handlers/MailHandler.cs +++ b/Source/Game/Handlers/MailHandler.cs @@ -209,7 +209,7 @@ namespace Game return; } - List items = new List(); + List items = new(); foreach (var att in packet.Info.Attachments) { if (att.ItemGUID.IsEmpty()) @@ -270,9 +270,9 @@ namespace Game bool needItemDelay = false; - MailDraft draft = new MailDraft(packet.Info.Subject, packet.Info.Body); + MailDraft draft = new(packet.Info.Subject, packet.Info.Body); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); if (!packet.Info.Attachments.Empty() || packet.Info.SendMoney > 0) { @@ -384,7 +384,7 @@ namespace Game return; } //we can return mail now, so firstly delete the old one - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_MAIL_BY_ID); stmt.AddValue(0, packet.MailID); @@ -399,7 +399,7 @@ namespace Game // only return mail if the player exists (and delete if not existing) if (m.messageType == MailMessageType.Normal && m.sender != 0) { - MailDraft draft = new MailDraft(m.subject, m.body); + MailDraft draft = new(m.subject, m.body); if (m.mailTemplateId != 0) draft = new MailDraft(m.mailTemplateId, false); // items already included @@ -455,11 +455,11 @@ namespace Game Item it = player.GetMItem(packet.AttachID); - List dest = new List(); + List dest = new(); InventoryResult msg = GetPlayer().CanStoreItem(ItemConst.NullBag, ItemConst.NullSlot, dest, it, false); if (msg == InventoryResult.Ok) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); m.RemoveItem(packet.AttachID); m.removedItems.Add(packet.AttachID); @@ -550,7 +550,7 @@ namespace Game player.SendMailResult(packet.MailID, MailResponseType.MoneyTaken, MailResponseResult.Ok); // save money and mail to prevent cheating - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); player.SaveGoldToDB(trans); player._SaveMail(trans); DB.Characters.CommitTransaction(trans); @@ -571,7 +571,7 @@ namespace Game var mails = player.GetMails(); - MailListResult response = new MailListResult(); + MailListResult response = new(); long curTime = Time.UnixTime; foreach (Mail m in mails) @@ -609,7 +609,7 @@ namespace Game return; } - Item bodyItem = new Item(); // This is not bag and then can be used new Item. + Item bodyItem = new(); // This is not bag and then can be used new Item. if (!bodyItem.Create(Global.ObjectMgr.GetGenerator(HighGuid.Item).Generate(), 8383, ItemContext.None, player)) return; @@ -635,7 +635,7 @@ namespace Game Log.outInfo(LogFilter.Network, "HandleMailCreateTextItem mailid={0}", packet.MailID); - List dest = new List(); + List dest = new(); InventoryResult msg = GetPlayer().CanStoreItem(ItemConst.NullBag, ItemConst.NullSlot, dest, bodyItem, false); if (msg == InventoryResult.Ok) { @@ -653,7 +653,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.QueryNextMailTime)] void HandleQueryNextMailTime(MailQueryNextMailTime packet) { - MailQueryNextTimeResult result = new MailQueryNextTimeResult(); + MailQueryNextTimeResult result = new(); if (!GetPlayer().m_mailsLoaded) GetPlayer()._LoadMail(); @@ -663,7 +663,7 @@ namespace Game result.NextMailTime = 0.0f; long now = Time.UnixTime; - List sentSenders = new List(); + List sentSenders = new(); foreach (Mail mail in GetPlayer().GetMails()) { @@ -695,7 +695,7 @@ namespace Game public void SendShowMailBox(ObjectGuid guid) { - ShowMailbox packet = new ShowMailbox(); + ShowMailbox packet = new(); packet.PostmasterGUID = guid; SendPacket(packet); } diff --git a/Source/Game/Handlers/MiscHandler.cs b/Source/Game/Handlers/MiscHandler.cs index 529720cf0..e5ff0679e 100644 --- a/Source/Game/Handlers/MiscHandler.cs +++ b/Source/Game/Handlers/MiscHandler.cs @@ -43,7 +43,7 @@ namespace Game AccountData adata = GetAccountData(request.DataType); - UpdateAccountData data = new UpdateAccountData(); + UpdateAccountData data = new(); data.Player = GetPlayer() ? GetPlayer().GetGUID() : ObjectGuid.Empty; data.Time = (uint)adata.Time; data.DataType = request.DataType; @@ -369,7 +369,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.RequestPlayedTime)] void HandlePlayedTime(RequestPlayedTime packet) { - PlayedTime playedTime = new PlayedTime(); + PlayedTime playedTime = new(); playedTime.TotalTime = GetPlayer().GetTotalPlayedTime(); playedTime.LevelTime = GetPlayer().GetLevelPlayedTime(); playedTime.TriggerEvent = packet.TriggerScriptEvent; // 0-1 - will not show in chat frame @@ -396,7 +396,7 @@ namespace Game { Player player = GetPlayer(); - LoadCUFProfiles loadCUFProfiles = new LoadCUFProfiles(); + LoadCUFProfiles loadCUFProfiles = new(); for (byte i = 0; i < PlayerConst.MaxCUFProfiles; ++i) { @@ -417,7 +417,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.MountSpecialAnim)] void HandleMountSpecialAnim(MountSpecial mountSpecial) { - SpecialMountAnim specialMountAnim = new SpecialMountAnim(); + SpecialMountAnim specialMountAnim = new(); specialMountAnim.UnitGUID = _player.GetGUID(); GetPlayer().SendMessageToSet(specialMountAnim, false); } diff --git a/Source/Game/Handlers/MovementHandler.cs b/Source/Game/Handlers/MovementHandler.cs index ecc7d6d55..4be9ce398 100644 --- a/Source/Game/Handlers/MovementHandler.cs +++ b/Source/Game/Handlers/MovementHandler.cs @@ -171,7 +171,7 @@ namespace Game mover.UpdatePosition(movementInfo.Pos); - MoveUpdate moveUpdate = new MoveUpdate(); + MoveUpdate moveUpdate = new(); moveUpdate.Status = mover.m_movementInfo; mover.SendMessageToSet(moveUpdate, GetPlayer()); @@ -274,7 +274,7 @@ namespace Game GetPlayer().ResetMap(); GetPlayer().SetMap(newMap); - ResumeToken resumeToken = new ResumeToken(); + ResumeToken resumeToken = new(); resumeToken.SequenceIndex = _player.m_movementCounter; resumeToken.Reason = seamlessTeleport ? 2 : 1u; SendPacket(resumeToken); @@ -416,12 +416,12 @@ namespace Game if (CliDB.MapStorage.LookupByKey(loc.GetMapId()).IsDungeon()) { - UpdateLastInstance updateLastInstance = new UpdateLastInstance(); + UpdateLastInstance updateLastInstance = new(); updateLastInstance.MapID = loc.GetMapId(); SendPacket(updateLastInstance); } - NewWorld packet = new NewWorld(); + NewWorld packet = new(); packet.MapID = loc.GetMapId(); packet.Loc.Pos = loc; packet.Reason = (uint)(!_player.IsBeingTeleportedSeamlessly() ? NewWorldReason.Normal : NewWorldReason.Seamless); @@ -577,7 +577,7 @@ namespace Game GetPlayer().m_movementInfo = movementAck.Ack.Status; - MoveUpdateKnockBack updateKnockBack = new MoveUpdateKnockBack(); + MoveUpdateKnockBack updateKnockBack = new(); updateKnockBack.Status = GetPlayer().m_movementInfo; GetPlayer().SendMessageToSet(updateKnockBack, false); } @@ -630,7 +630,7 @@ namespace Game moveApplyMovementForceAck.Ack.Status.Time += m_clientTimeDelay; - MoveUpdateApplyMovementForce updateApplyMovementForce = new MoveUpdateApplyMovementForce(); + MoveUpdateApplyMovementForce updateApplyMovementForce = new(); updateApplyMovementForce.Status = moveApplyMovementForceAck.Ack.Status; updateApplyMovementForce.Force = moveApplyMovementForceAck.Force; mover.SendMessageToSet(updateApplyMovementForce, false); @@ -652,7 +652,7 @@ namespace Game moveRemoveMovementForceAck.Ack.Status.Time += m_clientTimeDelay; - MoveUpdateRemoveMovementForce updateRemoveMovementForce = new MoveUpdateRemoveMovementForce(); + MoveUpdateRemoveMovementForce updateRemoveMovementForce = new(); updateRemoveMovementForce.Status = moveRemoveMovementForceAck.Ack.Status; updateRemoveMovementForce.TriggerGUID = moveRemoveMovementForceAck.ID; mover.SendMessageToSet(updateRemoveMovementForce, false); @@ -694,7 +694,7 @@ namespace Game setModMovementForceMagnitudeAck.Ack.Status.Time += m_clientTimeDelay; - MoveUpdateSpeed updateModMovementForceMagnitude = new MoveUpdateSpeed(ServerOpcodes.MoveUpdateModMovementForceMagnitude); + MoveUpdateSpeed updateModMovementForceMagnitude = new(ServerOpcodes.MoveUpdateModMovementForceMagnitude); updateModMovementForceMagnitude.Status = setModMovementForceMagnitudeAck.Ack.Status; updateModMovementForceMagnitude.Speed = setModMovementForceMagnitudeAck.Speed; mover.SendMessageToSet(updateModMovementForceMagnitude, false); diff --git a/Source/Game/Handlers/NPCHandler.cs b/Source/Game/Handlers/NPCHandler.cs index 609a9e75b..02d16a73b 100644 --- a/Source/Game/Handlers/NPCHandler.cs +++ b/Source/Game/Handlers/NPCHandler.cs @@ -48,7 +48,7 @@ namespace Game public void SendTabardVendorActivate(ObjectGuid guid) { - PlayerTabardVendorActivate packet = new PlayerTabardVendorActivate(); + PlayerTabardVendorActivate packet = new(); packet.Vendor = guid; SendPacket(packet); } @@ -119,7 +119,7 @@ namespace Game void SendTrainerBuyFailed(ObjectGuid trainerGUID, uint spellID, TrainerFailReason trainerFailedReason) { - TrainerBuyFailed trainerBuyFailed = new TrainerBuyFailed(); + TrainerBuyFailed trainerBuyFailed = new(); trainerBuyFailed.TrainerGUID = trainerGUID; trainerBuyFailed.SpellID = spellID; // should be same as in packet from client trainerBuyFailed.TrainerFailedReason = trainerFailedReason; // 1 == "Not enough money for trainer service." 0 == "Trainer service %d unavailable." @@ -356,7 +356,7 @@ namespace Game if (!GetPlayer()) return; - PetStableList packet = new PetStableList(); + PetStableList packet = new(); packet.StableMaster = guid; Pet pet = GetPlayer().GetPet(); @@ -403,7 +403,7 @@ namespace Game void SendPetStableResult(StableResult result) { - PetStableResult petStableResult = new PetStableResult(); + PetStableResult petStableResult = new(); petStableResult.Result = result; SendPacket(petStableResult); } @@ -470,7 +470,7 @@ namespace Game VendorItemData vendorItems = vendor.GetVendorItems(); int rawItemCount = vendorItems != null ? vendorItems.GetItemCount() : 0; - VendorInventory packet = new VendorInventory(); + VendorInventory packet = new(); packet.Vendor = vendor.GetGUID(); float discountMod = GetPlayer().GetReputationPriceDiscount(vendor); @@ -481,7 +481,7 @@ namespace Game if (vendorItem == null) continue; - VendorItemPkt item = new VendorItemPkt(); + VendorItemPkt item = new(); PlayerConditionRecord playerCondition = CliDB.PlayerConditionStorage.LookupByKey(vendorItem.PlayerConditionId); if (playerCondition != null) diff --git a/Source/Game/Handlers/PetHandler.cs b/Source/Game/Handlers/PetHandler.cs index 69491317f..8d57ad2bd 100644 --- a/Source/Game/Handlers/PetHandler.cs +++ b/Source/Game/Handlers/PetHandler.cs @@ -92,7 +92,7 @@ namespace Game else { //If a pet is dismissed, m_Controlled will change - List controlled = new List(); + List controlled = new(); foreach (var unit in GetPlayer().m_Controlled) if (unit.GetEntry() == pet.GetEntry() && unit.IsAlive()) controlled.Add(unit); @@ -317,7 +317,7 @@ namespace Game pet.GetCharmInfo().SetIsFollowing(false); } - Spell spell = new Spell(pet, spellInfo, TriggerCastFlags.None); + Spell spell = new(pet, spellInfo, TriggerCastFlags.None); SpellCastResult result = spell.CheckPetCast(unit_target); @@ -418,7 +418,7 @@ namespace Game void SendQueryPetNameResponse(ObjectGuid guid) { - QueryPetNameResponse response = new QueryPetNameResponse(); + QueryPetNameResponse response = new(); response.UnitGUID = guid; Creature unit = ObjectAccessor.GetCreatureOrPetOrVehicle(GetPlayer(), guid); @@ -560,7 +560,7 @@ namespace Game pet.RemovePetFlag(UnitPetFlags.CanBeRenamed); PreparedStatement stmt; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); if (isdeclined) { stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_PET_DECLINEDNAME); @@ -673,10 +673,10 @@ namespace Game if (!caster.HasSpell(spellInfo.Id) || spellInfo.IsPassive()) return; - SpellCastTargets targets = new SpellCastTargets(caster, petCastSpell.Cast); + SpellCastTargets targets = new(caster, petCastSpell.Cast); caster.ClearUnitState(UnitState.Follow); - Spell spell = new Spell(caster, spellInfo, TriggerCastFlags.None); + Spell spell = new(caster, spellInfo, TriggerCastFlags.None); spell.m_fromClient = true; spell.m_misc.Data0 = petCastSpell.Cast.Misc[0]; spell.m_misc.Data1 = petCastSpell.Cast.Misc[1]; @@ -701,7 +701,7 @@ namespace Game } } - SpellPrepare spellPrepare = new SpellPrepare(); + SpellPrepare spellPrepare = new(); spellPrepare.ClientCastID = petCastSpell.Cast.CastID; spellPrepare.ServerCastID = spell.m_castId; SendPacket(spellPrepare); @@ -722,7 +722,7 @@ namespace Game void SendPetNameInvalid(PetNameInvalidReason error, string name, DeclinedName declinedName) { - PetNameInvalid petNameInvalid = new PetNameInvalid(); + PetNameInvalid petNameInvalid = new(); petNameInvalid.Result = error; petNameInvalid.RenameData.NewName = name; for (int i = 0; i < SharedConst.MaxDeclinedNameCases; i++) diff --git a/Source/Game/Handlers/PetitionsHandler.cs b/Source/Game/Handlers/PetitionsHandler.cs index b3effec49..59956f3eb 100644 --- a/Source/Game/Handlers/PetitionsHandler.cs +++ b/Source/Game/Handlers/PetitionsHandler.cs @@ -75,7 +75,7 @@ namespace Game return; } - List dest = new List(); + List dest = new(); InventoryResult msg = GetPlayer().CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, charterItemID, pProto.GetBuyCount()); if (msg != InventoryResult.Ok) { @@ -126,7 +126,7 @@ namespace Game void SendPetitionSigns(Petition petition, Player sendTo) { - ServerPetitionShowSignatures signaturesPacket = new ServerPetitionShowSignatures(); + ServerPetitionShowSignatures signaturesPacket = new(); signaturesPacket.Item = petition.PetitionGuid; signaturesPacket.Owner = petition.ownerGuid; signaturesPacket.OwnerAccountID = ObjectGuid.Create(HighGuid.WowAccount, Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(petition.ownerGuid)); @@ -134,7 +134,7 @@ namespace Game foreach (var signature in petition.signatures) { - ServerPetitionShowSignatures.PetitionSignature signaturePkt = new ServerPetitionShowSignatures.PetitionSignature(); + ServerPetitionShowSignatures.PetitionSignature signaturePkt = new(); signaturePkt.Signer = signature.PlayerGuid; signaturePkt.Choice = 0; signaturesPacket.Signatures.Add(signaturePkt); @@ -151,7 +151,7 @@ namespace Game public void SendPetitionQuery(ObjectGuid petitionGuid) { - QueryPetitionResponse responsePacket = new QueryPetitionResponse(); + QueryPetitionResponse responsePacket = new(); responsePacket.PetitionID = (uint)petitionGuid.GetCounter(); // PetitionID (in Trinity always same as GUID_LOPART(petition guid)) Petition petition = Global.PetitionMgr.GetPetition(petitionGuid); @@ -165,7 +165,7 @@ namespace Game uint reqSignatures = WorldConfig.GetUIntValue(WorldCfg.MinPetitionSigns); - PetitionInfo petitionInfo = new PetitionInfo(); + PetitionInfo petitionInfo = new(); petitionInfo.PetitionID = (int)petitionGuid.GetCounter(); petitionInfo.Petitioner = petition.ownerGuid; petitionInfo.MinSignatures = reqSignatures; @@ -206,7 +206,7 @@ namespace Game // update petition storage petition.UpdateName(packet.NewGuildName); - PetitionRenameGuildResponse renameResponse = new PetitionRenameGuildResponse(); + PetitionRenameGuildResponse renameResponse = new(); renameResponse.PetitionGuid = packet.PetitionGuid; renameResponse.NewGuildName = packet.NewGuildName; SendPacket(renameResponse); @@ -252,7 +252,7 @@ namespace Game // Client doesn't allow to sign petition two times by one character, but not check sign by another character from same account // not allow sign another player from already sign player account - PetitionSignResults signResult = new PetitionSignResults(); + PetitionSignResults signResult = new(); signResult.Player = GetPlayer().GetGUID(); signResult.Item = packet.PetitionGUID; @@ -366,7 +366,7 @@ namespace Game if (GetPlayer().GetGUID() != petition.ownerGuid) return; - TurnInPetitionResult resultPacket = new TurnInPetitionResult(); + TurnInPetitionResult resultPacket = new(); // Check if player is already in a guild if (GetPlayer().GetGuildId() != 0) @@ -399,7 +399,7 @@ namespace Game GetPlayer().DestroyItem(item.GetBagSlot(), item.GetSlot(), true); // Create guild - Guild guild = new Guild(); + Guild guild = new(); if (!guild.Create(GetPlayer(), name)) return; @@ -408,7 +408,7 @@ namespace Game Guild.SendCommandResult(this, GuildCommandType.CreateGuild, GuildCommandError.Success, name); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); // Add members from signatures foreach (var signature in signatures) @@ -440,10 +440,10 @@ namespace Game return; } - WorldPacket data = new WorldPacket(ServerOpcodes.PetitionShowList); + WorldPacket data = new(ServerOpcodes.PetitionShowList); data.WritePackedGuid(guid); // npc guid - ServerPetitionShowList packet = new ServerPetitionShowList(); + ServerPetitionShowList packet = new(); packet.Unit = guid; packet.Price = WorldConfig.GetUIntValue(WorldCfg.CharterCostGuild); SendPacket(packet); diff --git a/Source/Game/Handlers/QueryHandler.cs b/Source/Game/Handlers/QueryHandler.cs index 9c56f1e81..16291bf9f 100644 --- a/Source/Game/Handlers/QueryHandler.cs +++ b/Source/Game/Handlers/QueryHandler.cs @@ -40,7 +40,7 @@ namespace Game { Player player = Global.ObjAccessor.FindPlayer(guid); - QueryPlayerNameResponse response = new QueryPlayerNameResponse(); + QueryPlayerNameResponse response = new(); response.Player = guid; if (response.Data.Initialize(guid, player)) @@ -59,7 +59,7 @@ namespace Game void SendQueryTimeResponse() { - QueryTimeResponse queryTimeResponse = new QueryTimeResponse(); + QueryTimeResponse queryTimeResponse = new(); queryTimeResponse.CurrentTime = Time.UnixTime; SendPacket(queryTimeResponse); } @@ -93,7 +93,7 @@ namespace Game { Log.outDebug(LogFilter.Network, $"WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (ENTRY: {packet.GameObjectID})"); - QueryGameObjectResponse response = new QueryGameObjectResponse(); + QueryGameObjectResponse response = new(); response.GameObjectID = packet.GameObjectID; response.Guid = packet.Guid; SendPacket(response); @@ -136,7 +136,7 @@ namespace Game { Log.outDebug(LogFilter.Network, $"WORLD: CMSG_QUERY_CREATURE - NO CREATURE INFO! (ENTRY: {packet.CreatureID})"); - QueryCreatureResponse response = new QueryCreatureResponse(); + QueryCreatureResponse response = new(); response.CreatureID = packet.CreatureID; SendPacket(response); } @@ -147,7 +147,7 @@ namespace Game { NpcText npcText = Global.ObjectMgr.GetNpcText(packet.TextID); - QueryNPCTextResponse response = new QueryNPCTextResponse(); + QueryNPCTextResponse response = new(); response.TextID = packet.TextID; if (npcText != null) @@ -170,7 +170,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.QueryPageText)] void HandleQueryPageText(QueryPageText packet) { - QueryPageTextResponse response = new QueryPageTextResponse(); + QueryPageTextResponse response = new(); response.PageTextID = packet.PageTextID; uint pageID = packet.PageTextID; @@ -207,7 +207,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.QueryCorpseLocationFromClient)] void HandleQueryCorpseLocation(QueryCorpseLocationFromClient queryCorpseLocation) { - CorpseLocation packet = new CorpseLocation(); + CorpseLocation packet = new(); Player player = Global.ObjAccessor.FindConnectedPlayer(queryCorpseLocation.Player); if (!player || !player.HasCorpse() || !_player.IsInSameRaidWith(player)) { @@ -258,7 +258,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.QueryCorpseTransport)] void HandleQueryCorpseTransport(QueryCorpseTransport queryCorpseTransport) { - CorpseTransportQuery response = new CorpseTransportQuery(); + CorpseTransportQuery response = new(); response.Player = queryCorpseTransport.Player; Player player = Global.ObjAccessor.FindConnectedPlayer(queryCorpseTransport.Player); @@ -278,11 +278,11 @@ namespace Game [WorldPacketHandler(ClientOpcodes.QueryQuestCompletionNpcs)] void HandleQueryQuestCompletionNPCs(QueryQuestCompletionNPCs queryQuestCompletionNPCs) { - QuestCompletionNPCResponse response = new QuestCompletionNPCResponse(); + QuestCompletionNPCResponse response = new(); foreach (var questID in queryQuestCompletionNPCs.QuestCompletionNPCs) { - QuestCompletionNPC questCompletionNPC = new QuestCompletionNPC(); + QuestCompletionNPC questCompletionNPC = new(); if (Global.ObjectMgr.GetQuestTemplate(questID) == null) { @@ -313,11 +313,11 @@ namespace Game return; // Read quest ids and add the in a unordered_set so we don't send POIs for the same quest multiple times - HashSet questIds = new HashSet(); + HashSet questIds = new(); for (int i = 0; i < packet.MissingQuestCount; ++i) questIds.Add(packet.MissingQuestPOIs[i]); // QuestID - QuestPOIQueryResponse response = new QuestPOIQueryResponse(); + QuestPOIQueryResponse response = new(); foreach (uint questId in questIds) { @@ -335,7 +335,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.ItemTextQuery)] void HandleItemTextQuery(ItemTextQuery packet) { - QueryItemTextResponse queryItemTextResponse = new QueryItemTextResponse(); + QueryItemTextResponse queryItemTextResponse = new(); queryItemTextResponse.Id = packet.Id; Item item = GetPlayer().GetItemByGuid(packet.Id); @@ -351,10 +351,10 @@ namespace Game [WorldPacketHandler(ClientOpcodes.QueryRealmName)] void HandleQueryRealmName(QueryRealmName queryRealmName) { - RealmQueryResponse realmQueryResponse = new RealmQueryResponse(); + RealmQueryResponse realmQueryResponse = new(); realmQueryResponse.VirtualRealmAddress = queryRealmName.VirtualRealmAddress; - RealmId realmHandle = new RealmId(queryRealmName.VirtualRealmAddress); + RealmId realmHandle = new(queryRealmName.VirtualRealmAddress); if (Global.ObjectMgr.GetRealmName(realmHandle.Index, ref realmQueryResponse.NameInfo.RealmNameActual, ref realmQueryResponse.NameInfo.RealmNameNormalized)) { realmQueryResponse.LookupState = (byte)ResponseCodes.Success; diff --git a/Source/Game/Handlers/QuestHandler.cs b/Source/Game/Handlers/QuestHandler.cs index 1afb6d120..9d4b42442 100644 --- a/Source/Game/Handlers/QuestHandler.cs +++ b/Source/Game/Handlers/QuestHandler.cs @@ -229,7 +229,7 @@ namespace Game _player.PlayerTalkClass.SendQuestQueryResponse(quest); else { - QueryQuestInfoResponse response = new QueryQuestInfoResponse(); + QueryQuestInfoResponse response = new(); response.QuestID = packet.QuestID; SendPacket(response); } @@ -689,7 +689,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.RequestWorldQuestUpdate)] void HandleRequestWorldQuestUpdate(RequestWorldQuestUpdate packet) { - WorldQuestUpdateResponse response = new WorldQuestUpdateResponse(); + WorldQuestUpdateResponse response = new(); // @todo: 7.x Has to be implemented //response.WorldQuestUpdates.push_back(WorldPackets::Quest::WorldQuestUpdateInfo(lastUpdate, questID, timer, variableID, value)); @@ -742,7 +742,7 @@ namespace Game foreach (PlayerChoiceResponseRewardItem item in reward.Items) { - List dest = new List(); + List dest = new(); if (_player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, item.Id, (uint)item.Quantity) == InventoryResult.Ok) { Item newItem = _player.StoreNewItem(dest, item.Id, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(item.Id), null, ItemContext.QuestReward, item.BonusListIDs); diff --git a/Source/Game/Handlers/ScenarioHandler.cs b/Source/Game/Handlers/ScenarioHandler.cs index 99a8de386..99982d057 100644 --- a/Source/Game/Handlers/ScenarioHandler.cs +++ b/Source/Game/Handlers/ScenarioHandler.cs @@ -27,10 +27,10 @@ namespace Game [WorldPacketHandler(ClientOpcodes.QueryScenarioPoi)] void HandleQueryScenarioPOI(QueryScenarioPOI queryScenarioPOI) { - ScenarioPOIs response = new ScenarioPOIs(); + ScenarioPOIs response = new(); // Read criteria tree ids and add the in a unordered_set so we don't send POIs for the same criteria tree multiple times - List criteriaTreeIds = new List(); + List criteriaTreeIds = new(); for (int i = 0; i < queryScenarioPOI.MissingScenarioPOIs.Count; ++i) criteriaTreeIds.Add(queryScenarioPOI.MissingScenarioPOIs[i]); // CriteriaTreeID @@ -39,7 +39,7 @@ namespace Game var poiVector = Global.ScenarioMgr.GetScenarioPOIs((uint)criteriaTreeId); if (poiVector != null) { - ScenarioPOIData scenarioPOIData = new ScenarioPOIData(); + ScenarioPOIData scenarioPOIData = new(); scenarioPOIData.CriteriaTreeID = criteriaTreeId; scenarioPOIData.ScenarioPOIs = poiVector; response.ScenarioPOIDataStats.Add(scenarioPOIData); diff --git a/Source/Game/Handlers/SkillHandler.cs b/Source/Game/Handlers/SkillHandler.cs index 009bfc9bd..aab0b109d 100644 --- a/Source/Game/Handlers/SkillHandler.cs +++ b/Source/Game/Handlers/SkillHandler.cs @@ -29,7 +29,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.LearnTalents)] void HandleLearnTalents(LearnTalents packet) { - LearnTalentFailed learnTalentFailed = new LearnTalentFailed(); + LearnTalentFailed learnTalentFailed = new(); bool anythingLearned = false; foreach (uint talentId in packet.Talents) { @@ -55,7 +55,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.LearnPvpTalents)] void HandleLearnPvpTalents(LearnPvpTalents packet) { - LearnPvpTalentFailed learnPvpTalentFailed = new LearnPvpTalentFailed(); + LearnPvpTalentFailed learnPvpTalentFailed = new(); bool anythingLearned = false; foreach (var pvpTalent in packet.Talents) { diff --git a/Source/Game/Handlers/SocialHandler.cs b/Source/Game/Handlers/SocialHandler.cs index d1c1a9dff..63d424b93 100644 --- a/Source/Game/Handlers/SocialHandler.cs +++ b/Source/Game/Handlers/SocialHandler.cs @@ -65,7 +65,7 @@ namespace Game uint gmLevelInWhoList = WorldConfig.GetUIntValue(WorldCfg.GmLevelInWhoList); - WhoResponsePkt response = new WhoResponsePkt(); + WhoResponsePkt response = new(); response.RequestID = whoRequest.RequestID; List whoList = Global.WhoListStorageMgr.GetWhoList(); @@ -137,7 +137,7 @@ namespace Game continue; } - WhoEntry whoEntry = new WhoEntry(); + WhoEntry whoEntry = new(); if (!whoEntry.PlayerData.Initialize(target.Guid, null)) continue; @@ -205,7 +205,7 @@ namespace Game if (string.IsNullOrEmpty(lastip)) lastip = "Unknown"; - WhoIsResponse response = new WhoIsResponse(); + WhoIsResponse response = new(); response.AccountName = packet.CharName + "'s " + "account is " + acc + ", e-mail: " + email + ", last ip: " + lastip; SendPacket(response); } diff --git a/Source/Game/Handlers/SpellHandler.cs b/Source/Game/Handlers/SpellHandler.cs index 1c8ed6084..1c08322da 100644 --- a/Source/Game/Handlers/SpellHandler.cs +++ b/Source/Game/Handlers/SpellHandler.cs @@ -115,7 +115,7 @@ namespace Game } } - SpellCastTargets targets = new SpellCastTargets(user, packet.Cast); + SpellCastTargets targets = new(user, packet.Cast); // Note: If script stop casting it must send appropriate data to client to prevent stuck item in gray state. if (!Global.ScriptMgr.OnItemUse(user, item, targets, packet.Cast.CastID)) @@ -214,7 +214,7 @@ namespace Game return; } - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); uint entry = result.Read(0); uint flags = result.Read(1); @@ -313,7 +313,7 @@ namespace Game return; // client provided targets - SpellCastTargets targets = new SpellCastTargets(caster, cast.Cast); + SpellCastTargets targets = new(caster, cast.Cast); // auto-selection buff level base at target level (in spellInfo) if (targets.GetUnitTarget() != null) @@ -328,9 +328,9 @@ namespace Game if (cast.Cast.MoveUpdate.HasValue) HandleMovementOpcode(ClientOpcodes.MoveStop, cast.Cast.MoveUpdate.Value); - Spell spell = new Spell(caster, spellInfo, TriggerCastFlags.None, ObjectGuid.Empty, false); + Spell spell = new(caster, spellInfo, TriggerCastFlags.None, ObjectGuid.Empty, false); - SpellPrepare spellPrepare = new SpellPrepare(); + SpellPrepare spellPrepare = new(); spellPrepare.ClientCastID = cast.Cast.CastID; spellPrepare.ServerCastID = spell.m_castId; SendPacket(spellPrepare); @@ -522,7 +522,7 @@ namespace Game Player player = creator.ToPlayer(); if (player) { - MirrorImageComponentedData mirrorImageComponentedData = new MirrorImageComponentedData(); + MirrorImageComponentedData mirrorImageComponentedData = new(); mirrorImageComponentedData.UnitGUID = guid; mirrorImageComponentedData.DisplayID = (int)creator.GetDisplayId(); mirrorImageComponentedData.RaceID = (byte)creator.GetRace(); @@ -572,7 +572,7 @@ namespace Game } else { - MirrorImageCreatureData data = new MirrorImageCreatureData(); + MirrorImageCreatureData data = new(); data.UnitGUID = guid; data.DisplayID = (int)creator.GetDisplayId(); SendPacket(data); @@ -597,7 +597,7 @@ namespace Game // we changed dest, recalculate flight time spell.RecalculateDelayMomentForDst(); - NotifyMissileTrajectoryCollision data = new NotifyMissileTrajectoryCollision(); + NotifyMissileTrajectoryCollision data = new(); data.Caster = packet.Target; data.CastID = packet.CastID; data.CollisionPos = packet.CollisionPos; diff --git a/Source/Game/Handlers/TaxiHandler.cs b/Source/Game/Handlers/TaxiHandler.cs index 6d3e483ab..8f9aebce4 100644 --- a/Source/Game/Handlers/TaxiHandler.cs +++ b/Source/Game/Handlers/TaxiHandler.cs @@ -56,7 +56,7 @@ namespace Game // find taxi node uint nearest = Global.ObjectMgr.GetNearestTaxiNode(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZ(), unit.GetMapId(), player.GetTeam()); - TaxiNodeStatusPkt data = new TaxiNodeStatusPkt(); + TaxiNodeStatusPkt data = new(); data.Unit = guid; if (nearest == 0) @@ -103,7 +103,7 @@ namespace Game if (unit.GetEntry() == 29480) GetPlayer().SetTaxiCheater(true); // Grimwing in Ebon Hold, special case. NOTE: Not perfect, Zul'Aman should not be included according to WoWhead, and I think taxicheat includes it. - ShowTaxiNodes data = new ShowTaxiNodes(); + ShowTaxiNodes data = new(); data.WindowInfo.HasValue = true; data.WindowInfo.Value.UnitGUID = unit.GetGUID(); data.WindowInfo.Value.CurrentNode = (int)curloc; @@ -150,7 +150,7 @@ namespace Game { SendPacket(new NewTaxiPath()); - TaxiNodeStatusPkt data = new TaxiNodeStatusPkt(); + TaxiNodeStatusPkt data = new(); data.Unit = unit.GetGUID(); data.Status = TaxiNodeStatus.Learned; SendPacket(data); @@ -220,14 +220,14 @@ namespace Game } } - List nodes = new List(); + List nodes = new(); Global.TaxiPathGraph.GetCompleteNodeRoute(from, to, GetPlayer(), nodes); GetPlayer().ActivateTaxiPathTo(nodes, unit, 0, preferredMountDisplay); } public void SendActivateTaxiReply(ActivateTaxiReply reply = ActivateTaxiReply.Ok) { - ActivateTaxiReplyPkt data = new ActivateTaxiReplyPkt(); + ActivateTaxiReplyPkt data = new(); data.Reply = reply; SendPacket(data); } diff --git a/Source/Game/Handlers/TicketHandler.cs b/Source/Game/Handlers/TicketHandler.cs index 7b42a4ed9..1c87695c3 100644 --- a/Source/Game/Handlers/TicketHandler.cs +++ b/Source/Game/Handlers/TicketHandler.cs @@ -29,7 +29,7 @@ namespace Game void HandleGMTicketGetCaseStatus(GMTicketGetCaseStatus packet) { //TODO: Implement GmCase and handle this packet correctly - GMTicketCaseStatus status = new GMTicketCaseStatus(); + GMTicketCaseStatus status = new(); SendPacket(status); } @@ -38,7 +38,7 @@ namespace Game { // Note: This only disables the ticket UI at client side and is not fully reliable // Note: This disables the whole customer support UI after trying to send a ticket in disabled state (MessageBox: "GM Help Tickets are currently unavaiable."). UI remains disabled until the character relogs. - GMTicketSystemStatusPkt response = new GMTicketSystemStatusPkt(); + GMTicketSystemStatusPkt response = new(); response.Status = Global.SupportMgr.GetSupportSystemStatus() ? 1 : 0; SendPacket(response); } @@ -51,7 +51,7 @@ namespace Game if (!Global.SupportMgr.GetSuggestionSystemStatus()) return; - SuggestionTicket ticket = new SuggestionTicket(GetPlayer()); + SuggestionTicket ticket = new(GetPlayer()); ticket.SetPosition(userFeedback.Header.MapID, userFeedback.Header.Position); ticket.SetFacing(userFeedback.Header.Facing); ticket.SetNote(userFeedback.Note); @@ -63,7 +63,7 @@ namespace Game if (!Global.SupportMgr.GetBugSystemStatus()) return; - BugTicket ticket = new BugTicket(GetPlayer()); + BugTicket ticket = new(GetPlayer()); ticket.SetPosition(userFeedback.Header.MapID, userFeedback.Header.Position); ticket.SetFacing(userFeedback.Header.Facing); ticket.SetNote(userFeedback.Note); @@ -78,7 +78,7 @@ namespace Game if (!Global.SupportMgr.GetComplaintSystemStatus()) return; - ComplaintTicket comp = new ComplaintTicket(GetPlayer()); + ComplaintTicket comp = new(GetPlayer()); comp.SetPosition(packet.Header.MapID, packet.Header.Position); comp.SetFacing(packet.Header.Facing); comp.SetChatLog(packet.ChatLog); @@ -107,7 +107,7 @@ namespace Game { // NOTE: all chat messages from this spammer are automatically ignored by the spam reporter until logout in case of chat spam. // if it's mail spam - ALL mails from this spammer are automatically removed by client - ComplaintResult result = new ComplaintResult(); + ComplaintResult result = new(); result.ComplaintType = packet.ComplaintType; result.Result = 0; SendPacket(result); diff --git a/Source/Game/Handlers/TimeHandler.cs b/Source/Game/Handlers/TimeHandler.cs index ebd64dd37..3158587cc 100644 --- a/Source/Game/Handlers/TimeHandler.cs +++ b/Source/Game/Handlers/TimeHandler.cs @@ -27,7 +27,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.ServerTimeOffsetRequest, Status = SessionStatus.Authed, Processing = PacketProcessing.Inplace)] void HandleServerTimeOffsetRequest(ServerTimeOffsetRequest packet) { - ServerTimeOffset response = new ServerTimeOffset(); + ServerTimeOffset response = new(); response.Time = (uint)Time.UnixTime; SendPacket(response); } diff --git a/Source/Game/Handlers/TokenHandler.cs b/Source/Game/Handlers/TokenHandler.cs index f476beba3..78ed3f204 100644 --- a/Source/Game/Handlers/TokenHandler.cs +++ b/Source/Game/Handlers/TokenHandler.cs @@ -26,7 +26,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.CommerceTokenGetLog)] void HandleCommerceTokenGetLog(CommerceTokenGetLog commerceTokenGetLog) { - CommerceTokenGetLogResponse response = new CommerceTokenGetLogResponse(); + CommerceTokenGetLogResponse response = new(); // @todo: fix 6.x implementation response.UnkInt = commerceTokenGetLog.UnkInt; @@ -38,7 +38,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.CommerceTokenGetMarketPrice)] void HandleCommerceTokenGetMarketPrice(CommerceTokenGetMarketPrice commerceTokenGetMarketPrice) { - CommerceTokenGetMarketPriceResponse response = new CommerceTokenGetMarketPriceResponse(); + CommerceTokenGetMarketPriceResponse response = new(); // @todo: 6.x fix implementation response.CurrentMarketPrice = 300000000; diff --git a/Source/Game/Handlers/ToyHandler.cs b/Source/Game/Handlers/ToyHandler.cs index c4eb8831d..a735c38f1 100644 --- a/Source/Game/Handlers/ToyHandler.cs +++ b/Source/Game/Handlers/ToyHandler.cs @@ -77,11 +77,11 @@ namespace Game if (_player.IsPossessing()) return; - SpellCastTargets targets = new SpellCastTargets(_player, packet.Cast); + SpellCastTargets targets = new(_player, packet.Cast); - Spell spell = new Spell(_player, spellInfo, TriggerCastFlags.None, ObjectGuid.Empty, false); + Spell spell = new(_player, spellInfo, TriggerCastFlags.None, ObjectGuid.Empty, false); - SpellPrepare spellPrepare = new SpellPrepare(); + SpellPrepare spellPrepare = new(); spellPrepare.ClientCastID = packet.Cast.CastID; spellPrepare.ServerCastID = spell.m_castId; SendPacket(spellPrepare); diff --git a/Source/Game/Handlers/TradeHandler.cs b/Source/Game/Handlers/TradeHandler.cs index f96d068a6..f7b12d814 100644 --- a/Source/Game/Handlers/TradeHandler.cs +++ b/Source/Game/Handlers/TradeHandler.cs @@ -45,7 +45,7 @@ namespace Game { TradeData view_trade = trader_data ? GetPlayer().GetTradeData().GetTraderData() : GetPlayer().GetTradeData(); - TradeUpdated tradeUpdated = new TradeUpdated(); + TradeUpdated tradeUpdated = new(); tradeUpdated.WhichPlayer = (byte)(trader_data ? 1 : 0); tradeUpdated.ClientStateIndex = view_trade.GetClientStateIndex(); tradeUpdated.CurrentStateIndex = view_trade.GetServerStateIndex(); @@ -57,7 +57,7 @@ namespace Game Item item = view_trade.GetItem((TradeSlots)i); if (item) { - TradeUpdated.TradeItem tradeItem = new TradeUpdated.TradeItem(); + TradeUpdated.TradeItem tradeItem = new(); tradeItem.Slot = i; tradeItem.Item = new ItemInstance(item); tradeItem.StackCount = (int)item.GetCount(); @@ -79,7 +79,7 @@ namespace Game { if (gemData.ItemId != 0) { - ItemGemData gem = new ItemGemData(); + ItemGemData gem = new(); gem.Slot = g; gem.Item = new ItemInstance(gemData); tradeItem.Unwrapped.Value.Gems.Add(gem); @@ -102,8 +102,8 @@ namespace Game for (byte i = 0; i < (int)TradeSlots.TradedCount; ++i) { - List traderDst = new List(); - List playerDst = new List(); + List traderDst = new(); + List playerDst = new(); bool traderCanTrade = (myItems[i] == null || trader.CanStoreItem(ItemConst.NullBag, ItemConst.NullSlot, traderDst, myItems[i], false) == InventoryResult.Ok); bool playerCanTrade = (hisItems[i] == null || GetPlayer().CanStoreItem(ItemConst.NullBag, ItemConst.NullSlot, playerDst, hisItems[i], false) == InventoryResult.Ok); if (traderCanTrade && playerCanTrade) @@ -239,7 +239,7 @@ namespace Game // set before checks for propertly undo at problems (it already set in to client) my_trade.SetAccepted(true); - TradeStatusPkt info = new TradeStatusPkt(); + TradeStatusPkt info = new(); if (his_trade.GetServerStateIndex() != acceptTrade.StateIndex) { info.Status = TradeStatus.StateChanged; @@ -332,10 +332,10 @@ namespace Game SetAcceptTradeMode(my_trade, his_trade, myItems, hisItems); Spell my_spell = null; - SpellCastTargets my_targets = new SpellCastTargets(); + SpellCastTargets my_targets = new(); Spell his_spell = null; - SpellCastTargets his_targets = new SpellCastTargets(); + SpellCastTargets his_targets = new(); // not accept if spell can't be casted now (cheating) uint my_spell_id = my_trade.GetSpell(); @@ -415,8 +415,8 @@ namespace Game trader.GetSession().SendTradeStatus(info); // test if item will fit in each inventory - TradeStatusPkt myCanCompleteInfo = new TradeStatusPkt(); - TradeStatusPkt hisCanCompleteInfo = new TradeStatusPkt(); + TradeStatusPkt myCanCompleteInfo = new(); + TradeStatusPkt hisCanCompleteInfo = new(); hisCanCompleteInfo.BagResult = trader.CanStoreItems(myItems, (int)TradeSlots.TradedCount, ref hisCanCompleteInfo.ItemID); myCanCompleteInfo.BagResult = GetPlayer().CanStoreItems(hisItems, (int)TradeSlots.TradedCount, ref myCanCompleteInfo.ItemID); @@ -501,7 +501,7 @@ namespace Game trader.SetTradeData(null); // desynchronized with the other saves here (SaveInventoryAndGoldToDB() not have own transaction guards) - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); GetPlayer().SaveInventoryAndGoldToDB(trans); trader.SaveInventoryAndGoldToDB(trans); DB.Characters.CommitTransaction(trans); @@ -534,7 +534,7 @@ namespace Game if (my_trade == null) return; - TradeStatusPkt info = new TradeStatusPkt(); + TradeStatusPkt info = new(); my_trade.GetTrader().GetSession().SendTradeStatus(info); SendTradeStatus(info); } @@ -544,7 +544,7 @@ namespace Game if (PlayerRecentlyLoggedOut() || PlayerLogout()) return; - TradeStatusPkt info = new TradeStatusPkt(); + TradeStatusPkt info = new(); info.Status = TradeStatus.Cancelled; SendTradeStatus(info); } @@ -563,7 +563,7 @@ namespace Game if (GetPlayer().GetTradeData() != null) return; - TradeStatusPkt info = new TradeStatusPkt(); + TradeStatusPkt info = new(); if (!GetPlayer().IsAlive()) { info.Status = TradeStatus.Dead; @@ -700,7 +700,7 @@ namespace Game if (my_trade == null) return; - TradeStatusPkt info = new TradeStatusPkt(); + TradeStatusPkt info = new(); // invalid slot number if (setTradeItem.TradeSlot >= (byte)TradeSlots.Count) { diff --git a/Source/Game/Handlers/TransmogrificationHandler.cs b/Source/Game/Handlers/TransmogrificationHandler.cs index 821ceedbd..f65ebe358 100644 --- a/Source/Game/Handlers/TransmogrificationHandler.cs +++ b/Source/Game/Handlers/TransmogrificationHandler.cs @@ -40,12 +40,12 @@ namespace Game } long cost = 0; - Dictionary transmogItems = new Dictionary();// new Dictionary>(); - Dictionary illusionItems = new Dictionary(); + Dictionary transmogItems = new();// new Dictionary>(); + Dictionary illusionItems = new(); - List resetAppearanceItems = new List(); - List resetIllusionItems = new List(); - List bindAppearances = new List(); + List resetAppearanceItems = new(); + List resetIllusionItems = new(); + List bindAppearances = new(); bool validateAndStoreTransmogItem(Item itemTransmogrified, uint itemModifiedAppearanceId, bool isSecondary) { diff --git a/Source/Game/Handlers/VoidStorageHandler.cs b/Source/Game/Handlers/VoidStorageHandler.cs index fd31664e0..78948aba6 100644 --- a/Source/Game/Handlers/VoidStorageHandler.cs +++ b/Source/Game/Handlers/VoidStorageHandler.cs @@ -70,14 +70,14 @@ namespace Game return; } - VoidStorageContents voidStorageContents = new VoidStorageContents(); + VoidStorageContents voidStorageContents = new(); for (byte i = 0; i < SharedConst.VoidStorageMaxSlot; ++i) { VoidStorageItem item = player.GetVoidStorageItem(i); if (item == null) continue; - VoidItem voidItem = new VoidItem(); + VoidItem voidItem = new(); voidItem.Guid = ObjectGuid.Create(HighGuid.Item, item.ItemId); voidItem.Creator = item.CreatorGuid; voidItem.Slot = i; @@ -143,7 +143,7 @@ namespace Game return; } - VoidStorageTransferChanges voidStorageTransferChanges = new VoidStorageTransferChanges(); + VoidStorageTransferChanges voidStorageTransferChanges = new(); byte depositCount = 0; for (int i = 0; i < voidStorageTransfer.Deposits.Length; ++i) @@ -155,7 +155,7 @@ namespace Game continue; } - VoidStorageItem itemVS = new VoidStorageItem(Global.ObjectMgr.GenerateVoidStorageItemId(), item.GetEntry(), item.GetCreator(), + VoidStorageItem itemVS = new(Global.ObjectMgr.GenerateVoidStorageItemId(), item.GetEntry(), item.GetCreator(), item.GetItemRandomBonusListId(), item.GetModifier(ItemModifier.TimewalkerLevel), item.GetModifier(ItemModifier.ArtifactKnowledgeLevel), item.GetContext(), item.m_itemData.BonusListIDs); @@ -185,7 +185,7 @@ namespace Game continue; } - List dest = new List(); + List dest = new(); InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, itemVS.ItemEntry, 1); if (msg != InventoryResult.Ok) { @@ -244,7 +244,7 @@ namespace Game return; } - VoidItemSwapResponse voidItemSwapResponse = new VoidItemSwapResponse(); + VoidItemSwapResponse voidItemSwapResponse = new(); voidItemSwapResponse.VoidItemA = swapVoidItem.VoidItemGuid; voidItemSwapResponse.VoidItemSlotA = swapVoidItem.DstSlot; if (usedDestSlot) diff --git a/Source/Game/Loot/Loot.cs b/Source/Game/Loot/Loot.cs index fdfdd96ec..b90132634 100644 --- a/Source/Game/Loot/Loot.cs +++ b/Source/Game/Loot/Loot.cs @@ -82,10 +82,10 @@ namespace Game.Loots public uint itemid; public uint randomBonusListId; - public List BonusListIDs = new List(); + public List BonusListIDs = new(); public ItemContext context; - public List conditions = new List(); // additional loot condition - public List allowedGUIDs = new List(); + public List conditions = new(); // additional loot condition + public List allowedGUIDs = new(); public ObjectGuid rollWinnerGUID; // Stores the guid of person who won loot, if his bags are full only he can see the item in loot list! public byte count; public bool is_looted; @@ -160,7 +160,7 @@ namespace Game.Loots for (uint i = 0; i < stacks && lootItems.Count < limit; ++i) { - LootItem generatedLoot = new LootItem(item); + LootItem generatedLoot = new(item); generatedLoot.context = _itemContext; generatedLoot.count = (byte)Math.Min(count, proto.GetMaxStackSize()); if (_itemContext != 0) @@ -282,7 +282,7 @@ namespace Game.Loots List FillFFALoot(Player player) { - List ql = new List(); + List ql = new(); for (byte i = 0; i < items.Count; ++i) { @@ -306,7 +306,7 @@ namespace Game.Loots if (items.Count == SharedConst.MaxNRLootItems) return null; - List ql = new List(); + List ql = new(); for (byte i = 0; i < quest_items.Count; ++i) { @@ -339,7 +339,7 @@ namespace Game.Loots List FillNonQuestNonFFAConditionalLoot(Player player, bool presentAtLooting) { - List ql = new List(); + List ql = new(); for (byte i = 0; i < items.Count; ++i) { @@ -642,7 +642,7 @@ namespace Game.Loots // item shall not be displayed. continue; - LootItemData lootItem = new LootItemData(); + LootItemData lootItem = new(); lootItem.LootListID = (byte)(i + 1); lootItem.UIType = slot_type; lootItem.Quantity = items[i].count; @@ -659,7 +659,7 @@ namespace Game.Loots { if (!items[i].is_looted && !items[i].freeforall && items[i].conditions.Empty() && items[i].AllowedForPlayer(viewer)) { - LootItemData lootItem = new LootItemData(); + LootItemData lootItem = new(); lootItem.LootListID = (byte)(i + 1); lootItem.UIType = (permission == PermissionTypes.Owner ? LootSlotType.Owner : LootSlotType.AllowLoot); lootItem.Quantity = items[i].count; @@ -684,7 +684,7 @@ namespace Game.Loots LootItem item = quest_items[qi.index]; if (!qi.is_looted && !item.is_looted) { - LootItemData lootItem = new LootItemData(); + LootItemData lootItem = new(); lootItem.LootListID = (byte)(items.Count + i + 1); lootItem.Quantity = item.count; lootItem.Loot = new ItemInstance(item); @@ -722,7 +722,7 @@ namespace Game.Loots LootItem item = items[fi.index]; if (!fi.is_looted && !item.is_looted) { - LootItemData lootItem = new LootItemData(); + LootItemData lootItem = new(); lootItem.LootListID = (byte)(fi.index + 1); lootItem.UIType = slotType; lootItem.Quantity = item.count; @@ -741,7 +741,7 @@ namespace Game.Loots LootItem item = items[ci.index]; if (!ci.is_looted && !item.is_looted) { - LootItemData lootItem = new LootItemData(); + LootItemData lootItem = new(); lootItem.LootListID = (byte)(ci.index + 1); lootItem.Quantity = item.count; lootItem.Loot = new ItemInstance(item); @@ -812,8 +812,8 @@ namespace Game.Loots public MultiMap GetPlayerFFAItems() { return PlayerFFAItems; } public MultiMap GetPlayerNonQuestNonFFAConditionalItems() { return PlayerNonQuestNonFFAConditionalItems; } - public List items = new List(); - public List quest_items = new List(); + public List items = new(); + public List quest_items = new(); public uint gold; public byte unlootedCount; public ObjectGuid roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released. @@ -822,13 +822,13 @@ namespace Game.Loots public ObjectGuid containerID; - List PlayersLooting = new List(); - MultiMap PlayerQuestItems = new MultiMap(); - MultiMap PlayerFFAItems = new MultiMap(); - MultiMap PlayerNonQuestNonFFAConditionalItems = new MultiMap(); + List PlayersLooting = new(); + MultiMap PlayerQuestItems = new(); + MultiMap PlayerFFAItems = new(); + MultiMap PlayerNonQuestNonFFAConditionalItems = new(); // All rolls are registered here. They need to know, when the loot is not valid anymore - LootValidatorRefManager i_LootValidatorRefManager = new LootValidatorRefManager(); + LootValidatorRefManager i_LootValidatorRefManager = new(); // Loot GUID ObjectGuid _GUID; @@ -861,8 +861,8 @@ namespace Game.Loots return _byOrder; } - List _byOrder = new List(); - Dictionary _byItem = new Dictionary(); + List _byOrder = new(); + Dictionary _byItem = new(); public struct ResultValue { diff --git a/Source/Game/Loot/LootItemStorage.cs b/Source/Game/Loot/LootItemStorage.cs index b914a459a..1e613888f 100644 --- a/Source/Game/Loot/LootItemStorage.cs +++ b/Source/Game/Loot/LootItemStorage.cs @@ -48,7 +48,7 @@ namespace Game.Loots StoredLootContainer storedContainer = _lootItemStorage[key]; - LootItem lootItem = new LootItem(); + LootItem lootItem = new(); lootItem.itemid = result.Read(1); lootItem.count = result.Read(2); lootItem.follow_loot_rules = result.Read(3); @@ -59,7 +59,7 @@ namespace Game.Loots lootItem.needs_quest = result.Read(8); lootItem.randomBonusListId = result.Read(9); lootItem.context = (ItemContext)result.Read(10); - StringArray bonusLists = new StringArray(result.Read(11), ' '); + StringArray bonusLists = new(result.Read(11), ' '); foreach (string str in bonusLists) lootItem.BonusListIDs.Add(uint.Parse(str)); @@ -111,7 +111,7 @@ namespace Game.Loots { foreach (var storedItemPair in container.GetLootItems()) { - LootItem li = new LootItem(); + LootItem li = new(); li.itemid = storedItemPair.Key; li.count = (byte)storedItemPair.Value.Count; li.follow_loot_rules = storedItemPair.Value.FollowRules; @@ -156,7 +156,7 @@ namespace Game.Loots { _lootItemStorage.TryRemove(containerId, out _); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEMS); stmt.AddValue(0, containerId); trans.Append(stmt); @@ -188,9 +188,9 @@ namespace Game.Loots return; } - StoredLootContainer container = new StoredLootContainer(loot.containerID.GetCounter()); + StoredLootContainer container = new(loot.containerID.GetCounter()); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); if (loot.gold != 0) container.AddMoney(loot.gold, trans); @@ -221,7 +221,7 @@ namespace Game.Loots _lootItemStorage.TryAdd(loot.containerID.GetCounter(), container); } - ConcurrentDictionary _lootItemStorage = new ConcurrentDictionary(); + ConcurrentDictionary _lootItemStorage = new(); } class StoredLootContainer @@ -254,7 +254,7 @@ namespace Game.Loots foreach (uint token in lootItem.BonusListIDs) { - StringBuilder bonusListIDs = new StringBuilder(); + StringBuilder bonusListIDs = new(); foreach (int bonusListID in lootItem.BonusListIDs) bonusListIDs.Append(bonusListID + ' '); @@ -314,7 +314,7 @@ namespace Game.Loots public MultiMap GetLootItems() { return _lootItems; } - MultiMap _lootItems = new MultiMap(); + MultiMap _lootItems = new(); ulong _containerId; uint _money; } @@ -346,6 +346,6 @@ namespace Game.Loots public bool NeedsQuest; public uint RandomBonusListId; public ItemContext Context; - public List BonusListIDs = new List(); + public List BonusListIDs = new(); } } diff --git a/Source/Game/Loot/LootManager.cs b/Source/Game/Loot/LootManager.cs index b449129ae..0f516579d 100644 --- a/Source/Game/Loot/LootManager.cs +++ b/Source/Game/Loot/LootManager.cs @@ -71,7 +71,7 @@ namespace Game.Loots uint oldMSTime = Time.GetMSTime(); - List lootIdSet, lootIdSetUsed = new List(); + List lootIdSet, lootIdSetUsed = new(); uint count = Creature.LoadAndCollectLootIds(out lootIdSet); // Remove real entries and check loot existence @@ -109,7 +109,7 @@ namespace Game.Loots uint oldMSTime = Time.GetMSTime(); - List lootIdSet, lootIdSetUsed = new List(); + List lootIdSet, lootIdSetUsed = new(); uint count = Disenchant.LoadAndCollectLootIds(out lootIdSet); foreach (var disenchant in CliDB.ItemDisenchantLootStorage.Values) @@ -162,7 +162,7 @@ namespace Game.Loots uint oldMSTime = Time.GetMSTime(); - List lootIdSet, lootIdSetUsed = new List(); + List lootIdSet, lootIdSetUsed = new(); uint count = Gameobject.LoadAndCollectLootIds(out lootIdSet); // remove real entries and check existence loot @@ -251,7 +251,7 @@ namespace Game.Loots uint oldMSTime = Time.GetMSTime(); List lootIdSet; - List lootIdSetUsed = new List(); + List lootIdSetUsed = new(); uint count = Pickpocketing.LoadAndCollectLootIds(out lootIdSet); // Remove real entries and check loot existence @@ -339,7 +339,7 @@ namespace Game.Loots uint oldMSTime = Time.GetMSTime(); List lootIdSet; - List lootIdSetUsed = new List(); + List lootIdSetUsed = new(); uint count = Skinning.LoadAndCollectLootIds(out lootIdSet); // remove real entries and check existence loot @@ -614,7 +614,7 @@ namespace Game.Loots { foreach (var pair in m_LootTemplates) { - List empty = new List(); + List empty = new(); pair.Value.CopyConditions(empty); } } @@ -661,7 +661,7 @@ namespace Game.Loots return 0; } - LootStoreItem storeitem = new LootStoreItem(item, reference, chance, needsquest, lootmode, groupid, mincount, maxcount); + LootStoreItem storeitem = new(item, reference, chance, needsquest, lootmode, groupid, mincount, maxcount); if (!storeitem.IsValid(this, entry)) // Validity checks continue; @@ -686,7 +686,7 @@ namespace Game.Loots m_LootTemplates.Clear(); } - LootTemplateMap m_LootTemplates = new LootTemplateMap(); + LootTemplateMap m_LootTemplates = new(); string m_name; string m_entryName; bool m_ratesAllowed; @@ -932,8 +932,8 @@ namespace Game.Loots return false;//not found or not reference } - LootStoreItemList Entries = new LootStoreItemList(); // not grouped only - Dictionary Groups = new Dictionary(); // groups have own (optimised) processing, grouped entries go there + LootStoreItemList Entries = new(); // not grouped only + Dictionary Groups = new(); // groups have own (optimised) processing, grouped entries go there public class LootGroup // A set of loot definitions for items (refs are not allowed) { @@ -1042,8 +1042,8 @@ namespace Game.Loots i.conditions.Clear(); } - LootStoreItemList ExplicitlyChanced = new LootStoreItemList(); // Entries with chances defined in DB - LootStoreItemList EqualChanced = new LootStoreItemList(); // Zero chances - every entry takes the same chance + LootStoreItemList ExplicitlyChanced = new(); // Entries with chances defined in DB + LootStoreItemList EqualChanced = new(); // Zero chances - every entry takes the same chance LootStoreItem Roll(Loot loot, ushort lootMode) { diff --git a/Source/Game/Mails/Mail.cs b/Source/Game/Mails/Mail.cs index 571222fea..f3835bfd9 100644 --- a/Source/Game/Mails/Mail.cs +++ b/Source/Game/Mails/Mail.cs @@ -26,7 +26,7 @@ namespace Game.Mails { public void AddItem(ulong itemGuidLow, uint item_template) { - MailItemInfo mii = new MailItemInfo(); + MailItemInfo mii = new(); mii.item_guid = itemGuidLow; mii.item_template = item_template; items.Add(mii); @@ -55,8 +55,8 @@ namespace Game.Mails public ulong receiver; public string subject; public string body; - public List items = new List(); - public List removedItems = new List(); + public List items = new(); + public List removedItems = new(); public long expire_time; public long deliver_time; public ulong money; diff --git a/Source/Game/Mails/MailDraft.cs b/Source/Game/Mails/MailDraft.cs index f3f827cc0..9cf5d98a4 100644 --- a/Source/Game/Mails/MailDraft.cs +++ b/Source/Game/Mails/MailDraft.cs @@ -56,7 +56,7 @@ namespace Game.Mails m_mailTemplateItemsNeed = false; - Loot mailLoot = new Loot(); + Loot mailLoot = new(); // can be empty mailLoot.FillLoot(m_mailTemplateId, LootStorage.Mail, receiver, true, true, LootModes.Default, ItemContext.None); @@ -196,7 +196,7 @@ namespace Game.Mails if (pReceiver.IsMailsLoaded()) { - Mail m = new Mail(); + Mail m = new(); m.messageID = mailId; m.mailTemplateId = GetMailTemplateId(); m.subject = GetSubject(); @@ -253,7 +253,7 @@ namespace Game.Mails string m_subject; string m_body; - Dictionary m_items = new Dictionary(); + Dictionary m_items = new(); ulong m_money; ulong m_COD; diff --git a/Source/Game/Maps/Cell.cs b/Source/Game/Maps/Cell.cs index 0a9b4df28..e6fad5aa4 100644 --- a/Source/Game/Maps/Cell.cs +++ b/Source/Game/Maps/Cell.cs @@ -168,11 +168,11 @@ namespace Game.Maps { for (uint y = area.low_bound.Y_coord; y <= area.high_bound.Y_coord; ++y) { - CellCoord cellCoord = new CellCoord(x, y); + CellCoord cellCoord = new(x, y); //lets skip standing cell since we already visited it if (cellCoord != standing_cell) { - Cell r_zone = new Cell(cellCoord); + Cell r_zone = new(cellCoord); r_zone.data.nocreate = data.nocreate; map.Visit(r_zone, visitor); } @@ -193,8 +193,8 @@ namespace Game.Maps { for (uint y = begin_cell.Y_coord; y <= end_cell.Y_coord; ++y) { - CellCoord cellCoord = new CellCoord(x, y); - Cell r_zone = new Cell(cellCoord); + CellCoord cellCoord = new(x, y); + Cell r_zone = new(cellCoord); r_zone.data.nocreate = data.nocreate; map.Visit(r_zone, visitor); } @@ -217,14 +217,14 @@ namespace Game.Maps { //we visit cells symmetrically from both sides, heading from center to sides and from up to bottom //e.g. filling 2 trapezoids after filling central cell strip... - CellCoord cellCoord_left = new CellCoord(x_start - step, y); - Cell r_zone_left = new Cell(cellCoord_left); + CellCoord cellCoord_left = new(x_start - step, y); + Cell r_zone_left = new(cellCoord_left); r_zone_left.data.nocreate = data.nocreate; map.Visit(r_zone_left, visitor); //right trapezoid cell visit - CellCoord cellCoord_right = new CellCoord(x_end + step, y); - Cell r_zone_right = new Cell(cellCoord_right); + CellCoord cellCoord_right = new(x_end + step, y); + Cell r_zone_right = new(cellCoord_right); r_zone_right.data.nocreate = data.nocreate; map.Visit(r_zone_right, visitor); } @@ -234,70 +234,70 @@ namespace Game.Maps public static void VisitGridObjects(WorldObject center_obj, Notifier visitor, float radius, bool dont_load = true) { CellCoord p = GridDefines.ComputeCellCoord(center_obj.GetPositionX(), center_obj.GetPositionY()); - Cell cell = new Cell(p); + Cell cell = new(p); if (dont_load) cell.SetNoCreate(); - Visitor gnotifier = new Visitor(visitor, GridMapTypeMask.AllGrid); + Visitor gnotifier = new(visitor, GridMapTypeMask.AllGrid); cell.Visit(p, gnotifier, center_obj.GetMap(), center_obj, radius); } public static void VisitWorldObjects(WorldObject center_obj, Notifier visitor, float radius, bool dont_load = true) { CellCoord p = GridDefines.ComputeCellCoord(center_obj.GetPositionX(), center_obj.GetPositionY()); - Cell cell = new Cell(p); + Cell cell = new(p); if (dont_load) cell.SetNoCreate(); - Visitor gnotifier = new Visitor(visitor, GridMapTypeMask.AllWorld); + Visitor gnotifier = new(visitor, GridMapTypeMask.AllWorld); cell.Visit(p, gnotifier, center_obj.GetMap(), center_obj, radius); } public static void VisitAllObjects(WorldObject center_obj, Notifier visitor, float radius, bool dont_load = true) { CellCoord p = GridDefines.ComputeCellCoord(center_obj.GetPositionX(), center_obj.GetPositionY()); - Cell cell = new Cell(p); + Cell cell = new(p); if (dont_load) cell.SetNoCreate(); - Visitor wnotifier = new Visitor(visitor, GridMapTypeMask.AllWorld); + Visitor wnotifier = new(visitor, GridMapTypeMask.AllWorld); cell.Visit(p, wnotifier, center_obj.GetMap(), center_obj, radius); - Visitor gnotifier = new Visitor(visitor, GridMapTypeMask.AllGrid); + Visitor gnotifier = new(visitor, GridMapTypeMask.AllGrid); cell.Visit(p, gnotifier, center_obj.GetMap(), center_obj, radius); } public static void VisitGridObjects(float x, float y, Map map, Notifier visitor, float radius, bool dont_load = true) { CellCoord p = GridDefines.ComputeCellCoord(x, y); - Cell cell = new Cell(p); + Cell cell = new(p); if (dont_load) cell.SetNoCreate(); - Visitor gnotifier = new Visitor(visitor, GridMapTypeMask.AllGrid); + Visitor gnotifier = new(visitor, GridMapTypeMask.AllGrid); cell.Visit(p, gnotifier, map, x, y, radius); } public static void VisitWorldObjects(float x, float y, Map map, Notifier visitor, float radius, bool dont_load = true) { CellCoord p = GridDefines.ComputeCellCoord(x, y); - Cell cell = new Cell(p); + Cell cell = new(p); if (dont_load) cell.SetNoCreate(); - Visitor gnotifier = new Visitor(visitor, GridMapTypeMask.AllWorld); + Visitor gnotifier = new(visitor, GridMapTypeMask.AllWorld); cell.Visit(p, gnotifier, map, x, y, radius); } public static void VisitAllObjects(float x, float y, Map map, Notifier visitor, float radius, bool dont_load = true) { CellCoord p = GridDefines.ComputeCellCoord(x, y); - Cell cell = new Cell(p); + Cell cell = new(p); if (dont_load) cell.SetNoCreate(); - Visitor wnotifier = new Visitor(visitor, GridMapTypeMask.AllWorld); + Visitor wnotifier = new(visitor, GridMapTypeMask.AllWorld); cell.Visit(p, wnotifier, map, x, y, radius); - Visitor gnotifier = new Visitor(visitor, GridMapTypeMask.AllGrid); + Visitor gnotifier = new(visitor, GridMapTypeMask.AllGrid); cell.Visit(p, gnotifier, map, x, y, radius); } diff --git a/Source/Game/Maps/Grid.cs b/Source/Game/Maps/Grid.cs index 1c608d1df..f88c38753 100644 --- a/Source/Game/Maps/Grid.cs +++ b/Source/Game/Maps/Grid.cs @@ -208,7 +208,7 @@ namespace Game.Maps { if (GetWorldObjectCountInNGrid() == 0 && !map.ActiveObjectsNearGrid(this)) { - ObjectGridStoper worker = new ObjectGridStoper(); + ObjectGridStoper worker = new(); var visitor = new Visitor(worker, GridMapTypeMask.AllGrid); VisitAllGrids(visitor); SetGridState(GridState.Idle); @@ -442,14 +442,14 @@ namespace Game.Maps return 0; } - public List players = new List(); - public List creatures = new List(); - public List corpses = new List(); - public List dynamicObjects = new List(); - public List areaTriggers = new List(); - public List conversations = new List(); - public List gameObjects = new List(); - public List worldObjects = new List(); + public List players = new(); + public List creatures = new(); + public List corpses = new(); + public List dynamicObjects = new(); + public List areaTriggers = new(); + public List conversations = new(); + public List gameObjects = new(); + public List worldObjects = new(); } public enum GridState diff --git a/Source/Game/Maps/GridMap.cs b/Source/Game/Maps/GridMap.cs index 2395c18e6..afb990c27 100644 --- a/Source/Game/Maps/GridMap.cs +++ b/Source/Game/Maps/GridMap.cs @@ -43,7 +43,7 @@ namespace Game.Maps if (!File.Exists(filename)) return LoadResult.FileNotFound; - using (BinaryReader reader = new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.Read))) + using (BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read))) { MapFileHeader header = reader.Read(); if (header.mapMagic != MapConst.MapMagic || (header.versionMagic != MapConst.MapVersionMagic && header.versionMagic != MapConst.MapVersionMagic2)) // Hack for some different extractors using v2.0 header @@ -464,7 +464,7 @@ namespace Game.Maps quarterIndex = gx > gy ? 1u : 0; - Ray ray = new Ray(new Vector3(gx, gy, 0.0f), Vector3.ZAxis); + Ray ray = new(new Vector3(gx, gy, 0.0f), Vector3.ZAxis); return ray.intersection(_minHeightPlanes[quarterIndex]).Z; } diff --git a/Source/Game/Maps/GridNotifiers.cs b/Source/Game/Maps/GridNotifiers.cs index 56fb1fd40..f5ac31636 100644 --- a/Source/Game/Maps/GridNotifiers.cs +++ b/Source/Game/Maps/GridNotifiers.cs @@ -340,7 +340,7 @@ namespace Game.Maps if (!creature.IsNeedNotify(NotifyFlags.VisibilityChanged)) continue; - CreatureRelocationNotifier relocate = new CreatureRelocationNotifier(creature); + CreatureRelocationNotifier relocate = new(creature); var c2world_relocation = new Visitor(relocate, GridMapTypeMask.AllWorld); var c2grid_relocation = new Visitor(relocate, GridMapTypeMask.AllGrid); @@ -848,7 +848,7 @@ namespace Game.Maps Dictionary updateData; WorldObject worldObject; - List plr_list = new List(); + List plr_list = new(); } public class PlayerDistWorker : Notifier @@ -953,7 +953,7 @@ namespace Game.Maps { Locale loc_idx = p.GetSession().GetSessionDbLocaleIndex(); int cache_idx = (int)loc_idx + 1; - List data_list = new List(); + List data_list = new(); // create if not cached yet if (i_data_cache.Count < cache_idx + 1 || i_data_cache[cache_idx].Empty()) @@ -970,7 +970,7 @@ namespace Game.Maps } MessageBuilder i_builder; - MultiMap i_data_cache = new MultiMap(); + MultiMap i_data_cache = new(); // 0 = default, i => i-1 locale index } diff --git a/Source/Game/Maps/Instances/InstanceSaveManager.cs b/Source/Game/Maps/Instances/InstanceSaveManager.cs index 93e0ae773..c5a5ec63d 100644 --- a/Source/Game/Maps/Instances/InstanceSaveManager.cs +++ b/Source/Game/Maps/Instances/InstanceSaveManager.cs @@ -79,7 +79,7 @@ namespace Game.Maps Log.outDebug(LogFilter.Maps, "InstanceSaveManager.AddInstanceSave: mapid = {0}, instanceid = {1}", mapId, instanceId); - InstanceSave save = new InstanceSave(mapId, instanceId, difficulty, entranceId, resetTime, canReset); + InstanceSave save = new(mapId, instanceId, difficulty, entranceId, resetTime, canReset); if (!load) save.SaveToDB(); @@ -94,7 +94,7 @@ namespace Game.Maps public void DeleteInstanceFromDB(uint instanceid) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_INSTANCE_BY_INSTANCE); stmt.AddValue(0, instanceid); @@ -187,10 +187,10 @@ namespace Game.Maps // get the current reset times for normal instances (these may need to be updated) // these are only kept in memory for InstanceSaves that are loaded later // resettime = 0 in the DB for raid/heroic instances so those are skipped - Dictionary> instResetTime = new Dictionary>(); + Dictionary> instResetTime = new(); // index instance ids by map/difficulty pairs for fast reset warning send - MultiMap mapDiffResetInstances = new MultiMap(); + MultiMap mapDiffResetInstances = new(); SQLResult result = DB.Characters.Query("SELECT id, map, difficulty, resettime FROM instance ORDER BY id ASC"); if (!result.IsEmpty()) @@ -420,7 +420,7 @@ namespace Game.Maps bool shouldDelete = true; var pList = pair.Value.m_playerList; - List temp = new List(); // list of expired binds that should be unbound + List temp = new(); // list of expired binds that should be unbound foreach (var player in pList) { InstanceBind bind = player.GetBoundInstance(pair.Value.GetMapId(), pair.Value.GetDifficultyID()); @@ -499,7 +499,7 @@ namespace Game.Maps return; // delete them from the DB, even if not loaded - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_EXPIRED_CHAR_INSTANCE_BY_MAP_DIFF); stmt.AddValue(0, mapid); @@ -634,10 +634,10 @@ namespace Game.Maps // used during global instance resets public bool lock_instLists; // fast lookup by instance id - Dictionary m_instanceSaveById = new Dictionary(); + Dictionary m_instanceSaveById = new(); // fast lookup for reset times (always use existed functions for access/set) - Dictionary m_resetTimeByMapDifficulty = new Dictionary(); - MultiMap m_resetTimeQueue = new MultiMap(); + Dictionary m_resetTimeByMapDifficulty = new(); + MultiMap m_resetTimeQueue = new(); } public class InstanceSave @@ -766,8 +766,8 @@ namespace Game.Maps m_toDelete = toDelete; } - public List m_playerList = new List(); - public List m_groupList = new List(); + public List m_playerList = new(); + public List m_groupList = new(); long m_resetTime; uint m_instanceid; uint m_mapid; diff --git a/Source/Game/Maps/Instances/InstanceScript.cs b/Source/Game/Maps/Instances/InstanceScript.cs index ffad22020..34832bb6e 100644 --- a/Source/Game/Maps/Instances/InstanceScript.cs +++ b/Source/Game/Maps/Instances/InstanceScript.cs @@ -221,7 +221,7 @@ namespace Game.Maps if (_instanceSpawnGroups.Empty()) return; - Dictionary newStates = new Dictionary(); + Dictionary newStates = new(); foreach (var info in _instanceSpawnGroups) { if (!newStates.ContainsKey(info.SpawnGroupId)) @@ -473,7 +473,7 @@ namespace Game.Maps { OUT_SAVE_INST_DATA(); - StringBuilder saveStream = new StringBuilder(); + StringBuilder saveStream = new(); WriteSaveDataHeaders(saveStream); WriteSaveDataBossStates(saveStream); @@ -682,7 +682,7 @@ namespace Game.Maps if (unit == null) return; - InstanceEncounterEngageUnit encounterEngageMessage = new InstanceEncounterEngageUnit(); + InstanceEncounterEngageUnit encounterEngageMessage = new(); encounterEngageMessage.Unit = unit.GetGUID(); encounterEngageMessage.TargetFramePriority = priority; instance.SendToPlayers(encounterEngageMessage); @@ -691,7 +691,7 @@ namespace Game.Maps if (!unit) return; - InstanceEncounterDisengageUnit encounterDisengageMessage = new InstanceEncounterDisengageUnit(); + InstanceEncounterDisengageUnit encounterDisengageMessage = new(); encounterDisengageMessage.Unit = unit.GetGUID(); instance.SendToPlayers(encounterDisengageMessage); break; @@ -699,7 +699,7 @@ namespace Game.Maps if (!unit) return; - InstanceEncounterChangePriority encounterChangePriorityMessage = new InstanceEncounterChangePriority(); + InstanceEncounterChangePriority encounterChangePriorityMessage = new(); encounterChangePriorityMessage.Unit = unit.GetGUID(); encounterChangePriorityMessage.TargetFramePriority = priority; instance.SendToPlayers(encounterChangePriorityMessage); @@ -711,7 +711,7 @@ namespace Game.Maps void SendEncounterStart(uint inCombatResCount = 0, uint maxInCombatResCount = 0, uint inCombatResChargeRecovery = 0, uint nextCombatResChargeTime = 0) { - InstanceEncounterStart encounterStartMessage = new InstanceEncounterStart(); + InstanceEncounterStart encounterStartMessage = new(); encounterStartMessage.InCombatResCount = inCombatResCount; encounterStartMessage.MaxInCombatResCount = maxInCombatResCount; encounterStartMessage.CombatResChargeRecovery = inCombatResChargeRecovery; @@ -727,7 +727,7 @@ namespace Game.Maps public void SendBossKillCredit(uint encounterId) { - BossKill bossKillCreditMessage = new BossKill(); + BossKill bossKillCreditMessage = new(); bossKillCreditMessage.DungeonEncounterID = encounterId; instance.SendToPlayers(bossKillCreditMessage); @@ -905,16 +905,16 @@ namespace Game.Maps public virtual void WriteSaveDataMore(StringBuilder data) { } public InstanceMap instance; - List headers = new List(); - Dictionary bosses = new Dictionary(); - MultiMap doors = new MultiMap(); - Dictionary minions = new Dictionary(); - Dictionary _creatureInfo = new Dictionary(); - Dictionary _gameObjectInfo = new Dictionary(); - Dictionary _objectGuids = new Dictionary(); + List headers = new(); + Dictionary bosses = new(); + MultiMap doors = new(); + Dictionary minions = new(); + Dictionary _creatureInfo = new(); + Dictionary _gameObjectInfo = new(); + Dictionary _objectGuids = new(); uint completedEncounters; - List _instanceSpawnGroups = new List(); - List _activatedAreaTriggers = new List(); + List _instanceSpawnGroups = new(); + List _activatedAreaTriggers = new(); uint _entranceId; uint _temporaryEntranceId; uint _combatResurrectionTimer; @@ -984,8 +984,8 @@ namespace Game.Maps public EncounterState state; public List[] door = new List[(int)DoorType.Max]; - public List minion = new List(); - public List boundary = new List(); + public List minion = new(); + public List boundary = new(); } class DoorInfo { diff --git a/Source/Game/Maps/Instances/MapInstance.cs b/Source/Game/Maps/Instances/MapInstance.cs index 8c3e134bb..0a259b11b 100644 --- a/Source/Game/Maps/Instances/MapInstance.cs +++ b/Source/Game/Maps/Instances/MapInstance.cs @@ -194,7 +194,7 @@ namespace Game.Maps Log.outDebug(LogFilter.Maps, "MapInstanced.CreateInstance: {0} map instance {1} for {2} created with difficulty {3}", save != null ? "" : "new ", InstanceId, GetId(), difficulty); - InstanceMap map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this); + InstanceMap map = new(GetId(), GetGridExpiry(), InstanceId, difficulty, this); Cypher.Assert(map.IsDungeon()); map.LoadRespawnTimes(); @@ -220,7 +220,7 @@ namespace Game.Maps { Log.outDebug(LogFilter.Maps, "MapInstanced.CreateBattleground: map bg {0} for {1} created.", InstanceId, GetId()); - BattlegroundMap map = new BattlegroundMap(GetId(), (uint)GetGridExpiry(), InstanceId, this, Difficulty.None); + BattlegroundMap map = new(GetId(), (uint)GetGridExpiry(), InstanceId, this, Difficulty.None); Cypher.Assert(map.IsBattlegroundOrArena()); map.SetBG(bg); bg.SetBgMap(map); @@ -234,7 +234,7 @@ namespace Game.Maps { lock (_mapLock) { - GarrisonMap map = new GarrisonMap(GetId(), GetGridExpiry(), instanceId, this, owner.GetGUID()); + GarrisonMap map = new(GetId(), GetGridExpiry(), instanceId, this, owner.GetGUID()); Cypher.Assert(map.IsGarrison()); m_InstancedMaps[instanceId] = map; @@ -279,7 +279,7 @@ namespace Game.Maps public Dictionary GetInstancedMaps() { return m_InstancedMaps; } - Dictionary m_InstancedMaps = new Dictionary(); + Dictionary m_InstancedMaps = new(); } public class InstanceTemplate diff --git a/Source/Game/Maps/MMapManager.cs b/Source/Game/Maps/MMapManager.cs index 6c0863437..ef14088ce 100644 --- a/Source/Game/Maps/MMapManager.cs +++ b/Source/Game/Maps/MMapManager.cs @@ -57,9 +57,9 @@ namespace Game return false; } - using (BinaryReader reader = new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.Read), Encoding.UTF8)) + using (BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read), Encoding.UTF8)) { - Detour.dtNavMeshParams Params = new Detour.dtNavMeshParams(); + Detour.dtNavMeshParams Params = new(); Params.orig[0] = reader.ReadSingle(); Params.orig[1] = reader.ReadSingle(); Params.orig[2] = reader.ReadSingle(); @@ -69,7 +69,7 @@ namespace Game Params.maxTiles = reader.ReadInt32(); Params.maxPolys = reader.ReadInt32(); - Detour.dtNavMesh mesh = new Detour.dtNavMesh(); + Detour.dtNavMesh mesh = new(); if (Detour.dtStatusFailed(mesh.init(Params))) { Log.outError(LogFilter.Maps, "MMAP:loadMapData: Failed to initialize dtNavMesh for mmap {0:D4} from file {1}", mapId, filename); @@ -133,7 +133,7 @@ namespace Game return false; } - using (BinaryReader reader = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read))) + using (BinaryReader reader = new(new FileStream(fileName, FileMode.Open, FileAccess.Read))) { MmapTileHeader fileHeader = reader.Read(); if (fileHeader.mmapMagic != MapConst.mmapMagic) @@ -149,7 +149,7 @@ namespace Game } var bytes = reader.ReadBytes((int)fileHeader.size); - Detour.dtRawTileData data = new Detour.dtRawTileData(); + Detour.dtRawTileData data = new(); data.FromBytes(bytes, 0); ulong tileRef = 0; @@ -191,7 +191,7 @@ namespace Game return true; // allocate mesh query - Detour.dtNavMeshQuery query = new Detour.dtNavMeshQuery(); + Detour.dtNavMeshQuery query = new(); if (Detour.dtStatusFailed(query.init(mmap.navMesh, 1024))) { Log.outError(LogFilter.Maps, "MMAP.GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId {0:D4} instanceId {1}", mapId, instanceId); @@ -330,11 +330,11 @@ namespace Game public uint GetLoadedTilesCount() { return loadedTiles; } public int GetLoadedMapsCount() { return loadedMMaps.Count; } - Dictionary loadedMMaps = new Dictionary(); + Dictionary loadedMMaps = new(); uint loadedTiles; - MultiMap childMapData = new MultiMap(); - Dictionary parentMapData = new Dictionary(); + MultiMap childMapData = new(); + Dictionary parentMapData = new(); } public class MMapData @@ -344,10 +344,10 @@ namespace Game navMesh = mesh; } - public Dictionary navMeshQueries = new Dictionary(); // instanceId to query + public Dictionary navMeshQueries = new(); // instanceId to query public Detour.dtNavMesh navMesh; - public Dictionary loadedTileRefs = new Dictionary(); // maps [map grid coords] to [dtTile] + public Dictionary loadedTileRefs = new(); // maps [map grid coords] to [dtTile] } public struct MmapTileHeader diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index 937bca0d1..a7b8b9200 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -248,7 +248,7 @@ namespace Game.Maps Log.outInfo(LogFilter.Maps, "Loading map {0}", fileName); // loading data - GridMap gridMap = new GridMap(); + GridMap gridMap = new(); LoadResult gridMapLoadResult = gridMap.LoadData(fileName); if (gridMapLoadResult == LoadResult.Success) map.GridMaps[gx][gy] = gridMap; @@ -500,7 +500,7 @@ namespace Game.Maps public virtual void LoadGridObjects(Grid grid, Cell cell) { - ObjectGridLoader loader = new ObjectGridLoader(grid, this, cell); + ObjectGridLoader loader = new(grid, this, cell); loader.LoadN(); } @@ -509,7 +509,7 @@ namespace Game.Maps // First make sure this grid is loaded float gX = (((float)x - 0.5f - MapConst.CenterGridId) * MapConst.SizeofGrids) + (MapConst.CenterGridOffset * 2); float gY = (((float)y - 0.5f - MapConst.CenterGridId) * MapConst.SizeofGrids) + (MapConst.CenterGridOffset * 2); - Cell cell = new Cell(gX, gY); + Cell cell = new(gX, gY); EnsureGridLoaded(cell); // Mark as don't unload @@ -762,7 +762,7 @@ namespace Game.Maps // Handle updates for creatures in combat with player and are more than 60 yards away if (player.IsInCombat()) { - List updateList = new List(); + List updateList = new(); HostileReference refe = player.GetHostileRefManager().GetFirst(); while (refe != null) @@ -976,7 +976,7 @@ namespace Game.Maps var players = GetPlayers(); if (!players.Empty()) { - UpdateData data = new UpdateData(GetId()); + UpdateData data = new(GetId()); obj.BuildOutOfRangeUpdateBlock(data); UpdateObject packet; data.BuildPacket(out packet); @@ -1104,12 +1104,12 @@ namespace Game.Maps public void DynamicObjectRelocation(DynamicObject dynObj, float x, float y, float z, float orientation) { - Cell integrity_check = new Cell(dynObj.GetPositionX(), dynObj.GetPositionY()); + Cell integrity_check = new(dynObj.GetPositionX(), dynObj.GetPositionY()); Cell old_cell = dynObj.GetCurrentCell(); Cypher.Assert(integrity_check == old_cell); - Cell new_cell = new Cell(x, y); + Cell new_cell = new(x, y); if (GetGrid(new_cell.GetGridX(), new_cell.GetGridY()) == null) return; @@ -1140,11 +1140,11 @@ namespace Game.Maps public void AreaTriggerRelocation(AreaTrigger at, float x, float y, float z, float orientation) { - Cell integrity_check = new Cell(at.GetPositionX(), at.GetPositionY()); + Cell integrity_check = new(at.GetPositionX(), at.GetPositionY()); Cell old_cell = at.GetCurrentCell(); Cypher.Assert(integrity_check == old_cell); - Cell new_cell = new Cell(x, y); + Cell new_cell = new(x, y); if (GetGrid(new_cell.GetGridX(), new_cell.GetGridY()) == null) return; @@ -1699,7 +1699,7 @@ namespace Game.Maps MoveAllAreaTriggersInMoveList(); // move creatures to respawn grids if this is diff.grid or to remove list - ObjectGridEvacuator worker = new ObjectGridEvacuator(); + ObjectGridEvacuator worker = new(); var visitor = new Visitor(worker, GridMapTypeMask.AllGrid); grid.VisitAllGrids(visitor); @@ -1710,7 +1710,7 @@ namespace Game.Maps } { - ObjectGridCleaner worker = new ObjectGridCleaner(); + ObjectGridCleaner worker = new(); var visitor = new Visitor(worker, GridMapTypeMask.AllGrid); grid.VisitAllGrids(visitor); } @@ -1718,7 +1718,7 @@ namespace Game.Maps RemoveAllObjectsInRemoveList(); { - ObjectGridUnloader worker = new ObjectGridUnloader(); + ObjectGridUnloader worker = new(); var visitor = new Visitor(worker, GridMapTypeMask.AllGrid); grid.VisitAllGrids(visitor); } @@ -2286,7 +2286,7 @@ namespace Game.Maps // look up liquid data from grid map if (gmap != null && (data.LiquidStatus == ZLiquidStatus.AboveWater || data.LiquidStatus == ZLiquidStatus.NoWater)) { - LiquidData gridMapLiquid = new LiquidData(); + LiquidData gridMapLiquid = new(); ZLiquidStatus gridMapStatus = gmap.GetLiquidStatus(x, y, z, reqLiquidType, gridMapLiquid); if (gridMapStatus != ZLiquidStatus.NoWater && (gridMapLiquid.level > vmapData.floorZ)) { @@ -2422,7 +2422,7 @@ namespace Game.Maps public void SendUpdateTransportVisibility(Player player) { // Hack to send out transports - UpdateData transData = new UpdateData(player.GetMapId()); + UpdateData transData = new(player.GetMapId()); foreach (var transport in _transports) { var hasTransport = player.m_visibleTransports.Contains(transport.GetGUID()); @@ -2458,7 +2458,7 @@ namespace Game.Maps void SendObjectUpdates() { - Dictionary update_players = new Dictionary(); + Dictionary update_players = new(); while (!_updateObjects.Empty()) { @@ -2581,14 +2581,14 @@ namespace Game.Maps { case SpawnObjectType.Creature: { - Creature obj = new Creature(); + Creature obj = new(); if (!obj.LoadFromDB(spawnId, this, true, true)) obj.Dispose(); break; } case SpawnObjectType.GameObject: { - GameObject obj = new GameObject(); + GameObject obj = new(); if (!obj.LoadFromDB(spawnId, this, true)) obj.Dispose(); break; @@ -2649,7 +2649,7 @@ namespace Game.Maps } // if we get to this point, we should insert the respawninfo (there either was no prior entry, or it was deleted already) - RespawnInfo ri = new RespawnInfo(info); + RespawnInfo ri = new(info); _respawnTimes.Add(ri); bySpawnIdMap.Add(ri.spawnId, ri); } @@ -2740,7 +2740,7 @@ namespace Game.Maps public void RemoveRespawnTime(SpawnObjectTypeMask types = SpawnObjectTypeMask.All, uint zoneId = 0, bool doRespawn = false, SQLTransaction dbTrans = null) { - List v = new List(); + List v = new(); GetRespawnInfo(v, types, zoneId); if (!v.Empty()) RemoveRespawnTime(v, doRespawn, dbTrans); @@ -2874,7 +2874,7 @@ namespace Game.Maps { case SpawnObjectType.Creature: { - Creature creature = new Creature(); + Creature creature = new(); if (!creature.LoadFromDB(data.spawnId, this, true, force)) creature.Dispose(); else if (spawnedObjects != null) @@ -2883,7 +2883,7 @@ namespace Game.Maps } case SpawnObjectType.GameObject: { - GameObject gameobject = new GameObject(); + GameObject gameobject = new(); if (!gameobject.LoadFromDB(data.spawnId, this, true)) gameobject.Dispose(); else if (spawnedObjects != null) @@ -2908,7 +2908,7 @@ namespace Game.Maps return false; } - List toUnload = new List(); // unload after iterating, otherwise iterator invalidation + List toUnload = new(); // unload after iterating, otherwise iterator invalidation foreach (var data in Global.ObjectMgr.GetSpawnDataForGroup(groupId)) { if (deleteRespawnTimes) @@ -3216,7 +3216,7 @@ namespace Game.Maps return; } - RespawnInfo ri = new RespawnInfo(); + RespawnInfo ri = new(); ri.type = type; ri.spawnId = spawnId; ri.entry = entry; @@ -3328,8 +3328,8 @@ namespace Game.Maps if (result.IsEmpty()) return; - MultiMap phases = new MultiMap(); - MultiMap customizations = new MultiMap(); + MultiMap phases = new(); + MultiMap customizations = new(); stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CORPSE_PHASES); stmt.AddValue(0, GetId()); @@ -3363,7 +3363,7 @@ namespace Game.Maps { ulong guid = customizationResult.Read(0); - ChrCustomizationChoice choice = new ChrCustomizationChoice(); + ChrCustomizationChoice choice = new(); choice.ChrCustomizationOptionID = customizationResult.Read(1); choice.ChrCustomizationChoiceID = customizationResult.Read(2); customizations.Add(guid, choice); @@ -3381,7 +3381,7 @@ namespace Game.Maps continue; } - Corpse corpse = new Corpse(type); + Corpse corpse = new(type); if (!corpse.LoadCorpseFromDB(GenerateLowGuid(HighGuid.Corpse), result.GetFields())) continue; @@ -3443,7 +3443,7 @@ namespace Game.Maps RemoveCorpse(corpse); // remove corpse from DB - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); corpse.DeleteFromDB(trans); DB.Characters.CommitTransaction(trans); @@ -3494,7 +3494,7 @@ namespace Game.Maps { long now = Time.UnixTime; - List corpses = new List(); + List corpses = new(); foreach (var p in _corpsesByPlayer) if (p.Value.IsExpired(now)) @@ -3503,7 +3503,7 @@ namespace Game.Maps foreach (ObjectGuid ownerGuid in corpses) ConvertCorpseToBones(ownerGuid); - List expiredBones = new List(); + List expiredBones = new(); foreach (Corpse bones in _corpseBones) if (bones.IsExpired(now)) expiredBones.Add(bones); @@ -3530,7 +3530,7 @@ namespace Game.Maps uint overrideLightId = zoneInfo.OverrideLightId; if (overrideLightId != 0) { - OverrideLight overrideLight = new OverrideLight(); + OverrideLight overrideLight = new(); overrideLight.AreaLightID = _defaultLight; overrideLight.OverrideLightID = overrideLightId; overrideLight.TransitionMilliseconds = zoneInfo.LightFadeInTime; @@ -3555,7 +3555,7 @@ namespace Game.Maps WeatherState weatherId = zoneDynamicInfo.WeatherId; if (weatherId != 0) { - WeatherPkt weather = new WeatherPkt(weatherId, zoneDynamicInfo.WeatherGrade); + WeatherPkt weather = new(weatherId, zoneDynamicInfo.WeatherGrade); player.SendPacket(weather); } else if (zoneDynamicInfo.DefaultWeather != null) @@ -3576,7 +3576,7 @@ namespace Game.Maps var players = GetPlayers(); if (!players.Empty()) { - PlayMusic playMusic = new PlayMusic(musicId); + PlayMusic playMusic = new(musicId); foreach (var player in players) if (player.GetZoneId() == zoneId && !player.HasAuraType(AuraType.ForceWeather)) @@ -3616,7 +3616,7 @@ namespace Game.Maps var players = GetPlayers(); if (!players.Empty()) { - WeatherPkt weather = new WeatherPkt(weatherId, weatherGrade); + WeatherPkt weather = new(weatherId, weatherGrade); foreach (var player in players) { @@ -3638,7 +3638,7 @@ namespace Game.Maps if (!players.Empty()) { - OverrideLight overrideLight = new OverrideLight(); + OverrideLight overrideLight = new(); overrideLight.AreaLightID = _defaultLight; overrideLight.OverrideLightID = lightId; overrideLight.TransitionMilliseconds = fadeInTime; @@ -4138,7 +4138,7 @@ namespace Game.Maps summon.InitSummon(); // call MoveInLineOfSight for nearby creatures - AIRelocationNotifier notifier = new AIRelocationNotifier(summon); + AIRelocationNotifier notifier = new(summon); Cell.VisitAllObjects(summon, notifier, GetVisibilityRange()); return summon; @@ -5040,70 +5040,70 @@ namespace Game.Maps #endregion #region Fields - internal object _mapLock = new object(); - object _gridLock = new object(); + internal object _mapLock = new(); + object _gridLock = new(); bool _creatureToMoveLock; - List creaturesToMove = new List(); + List creaturesToMove = new(); bool _gameObjectsToMoveLock; - List _gameObjectsToMove = new List(); + List _gameObjectsToMove = new(); bool _dynamicObjectsToMoveLock; - List _dynamicObjectsToMove = new List(); + List _dynamicObjectsToMove = new(); bool _areaTriggersToMoveLock; - List _areaTriggersToMove = new List(); + List _areaTriggersToMove = new(); GridMap[][] GridMaps = new GridMap[MapConst.MaxGrids][]; ushort[][] GridMapReference = new ushort[MapConst.MaxGrids][]; - DynamicMapTree _dynamicTree = new DynamicMapTree(); + DynamicMapTree _dynamicTree = new(); - SortedSet _respawnTimes = new SortedSet(new CompareRespawnInfo()); - Dictionary _creatureRespawnTimesBySpawnId = new Dictionary(); - Dictionary _gameObjectRespawnTimesBySpawnId = new Dictionary(); - List _toggledSpawnGroupIds = new List(); + SortedSet _respawnTimes = new(new CompareRespawnInfo()); + Dictionary _creatureRespawnTimesBySpawnId = new(); + Dictionary _gameObjectRespawnTimesBySpawnId = new(); + List _toggledSpawnGroupIds = new(); uint _respawnCheckTimer; - Dictionary _zonePlayerCountMap = new Dictionary(); + Dictionary _zonePlayerCountMap = new(); - List _transports = new List(); + List _transports = new(); Grid[][] i_grids = new Grid[MapConst.MaxGrids][]; MapRecord i_mapRecord; - List i_objectsToRemove = new List(); - Dictionary i_objectsToSwitch = new Dictionary(); + List i_objectsToRemove = new(); + Dictionary i_objectsToSwitch = new(); Difficulty i_spawnMode; - List i_worldObjects = new List(); - protected List m_activeNonPlayers = new List(); - protected List m_activePlayers = new List(); + List i_worldObjects = new(); + protected List m_activeNonPlayers = new(); + protected List m_activePlayers = new(); Map m_parentMap; // points to MapInstanced or self (always same map id) Map m_parentTerrainMap; // points to m_parentMap of MapEntry::ParentMapID - List m_childTerrainMaps = new List(); // contains m_parentMap of maps that have MapEntry::ParentMapID == GetId() - SortedMultiMap m_scriptSchedule = new SortedMultiMap(); + List m_childTerrainMaps = new(); // contains m_parentMap of maps that have MapEntry::ParentMapID == GetId() + SortedMultiMap m_scriptSchedule = new(); - BitSet i_gridFileExists = new BitSet(MapConst.MaxGrids * MapConst.MaxGrids); // cache what grids are available for this map (not including parent/child maps) - BitSet marked_cells = new BitSet(MapConst.TotalCellsPerMap * MapConst.TotalCellsPerMap); - public Dictionary CreatureGroupHolder = new Dictionary(); + BitSet i_gridFileExists = new(MapConst.MaxGrids * MapConst.MaxGrids); // cache what grids are available for this map (not including parent/child maps) + BitSet marked_cells = new(MapConst.TotalCellsPerMap * MapConst.TotalCellsPerMap); + public Dictionary CreatureGroupHolder = new(); internal uint i_InstanceId; long i_gridExpiry; - List i_objects = new List(); + List i_objects = new(); bool i_scriptLock; public int m_VisibilityNotifyPeriod; public float m_VisibleDistance; internal uint m_unloadTimer; - Dictionary _zoneDynamicInfo = new Dictionary(); + Dictionary _zoneDynamicInfo = new(); IntervalTimer _weatherUpdateTimer; uint _defaultLight; - Dictionary _guidGenerators = new Dictionary(); - Dictionary _objectsStore = new Dictionary(); - MultiMap _creatureBySpawnIdStore = new MultiMap(); - MultiMap _gameobjectBySpawnIdStore = new MultiMap(); - MultiMap _corpsesByCell = new MultiMap(); - Dictionary _corpsesByPlayer = new Dictionary(); - List _corpseBones = new List(); + Dictionary _guidGenerators = new(); + Dictionary _objectsStore = new(); + MultiMap _creatureBySpawnIdStore = new(); + MultiMap _gameobjectBySpawnIdStore = new(); + MultiMap _corpsesByCell = new(); + Dictionary _corpsesByPlayer = new(); + List _corpseBones = new(); - List _updateObjects = new List(); + List _updateObjects = new(); #endregion } @@ -5257,7 +5257,7 @@ namespace Game.Maps // players also become permanently bound when they enter if (groupBind.perm) { - PendingRaidLock pendingRaidLock = new PendingRaidLock(); + PendingRaidLock pendingRaidLock = new(); pendingRaidLock.TimeUntilLock = 60000; pendingRaidLock.CompletedMask = i_data != null ? i_data.GetCompletedEncounterMask() : 0; pendingRaidLock.Extending = false; @@ -5469,7 +5469,7 @@ namespace Game.Maps else { player.BindToInstance(save, true); - InstanceSaveCreated data = new InstanceSaveCreated(); + InstanceSaveCreated data = new(); data.Gm = player.IsGameMaster(); player.SendPacket(data); diff --git a/Source/Game/Maps/MapManager.cs b/Source/Game/Maps/MapManager.cs index ed7bcc794..eebaa7779 100644 --- a/Source/Game/Maps/MapManager.cs +++ b/Source/Game/Maps/MapManager.cs @@ -484,9 +484,9 @@ namespace Game.Entities public void DecreaseScheduledScriptCount(uint count) { _scheduledScripts -= count; } public bool IsScriptScheduled() { return _scheduledScripts > 0; } - Dictionary i_maps = new Dictionary(); - IntervalTimer i_timer = new IntervalTimer(); - object _mapsLock= new object(); + Dictionary i_maps = new(); + IntervalTimer i_timer = new(); + object _mapsLock= new(); uint i_gridCleanUpDelay; BitSet _freeInstanceIds; uint _nextInstanceId; diff --git a/Source/Game/Maps/MapUpdater.cs b/Source/Game/Maps/MapUpdater.cs index a859cefb1..b6eeecdf2 100644 --- a/Source/Game/Maps/MapUpdater.cs +++ b/Source/Game/Maps/MapUpdater.cs @@ -22,12 +22,12 @@ namespace Game.Maps { public class MapUpdater { - ProducerConsumerQueue _queue = new ProducerConsumerQueue(); + ProducerConsumerQueue _queue = new(); Thread[] _workerThreads; volatile bool _cancelationToken; - object _lock = new object(); + object _lock = new(); int _pendingRequests; public MapUpdater(int numThreads) diff --git a/Source/Game/Maps/ObjectGridLoader.cs b/Source/Game/Maps/ObjectGridLoader.cs index 4994ab7c6..e41c37437 100644 --- a/Source/Game/Maps/ObjectGridLoader.cs +++ b/Source/Game/Maps/ObjectGridLoader.cs @@ -48,7 +48,7 @@ namespace Game.Maps var visitor = new Visitor(this, GridMapTypeMask.AllGrid); i_grid.VisitGrid(x, y, visitor); - ObjectWorldLoader worker = new ObjectWorldLoader(this); + ObjectWorldLoader worker = new(this); visitor = new Visitor(worker, GridMapTypeMask.AllWorld); i_grid.VisitGrid(x, y, visitor); } @@ -90,7 +90,7 @@ namespace Game.Maps { foreach (var guid in guid_set) { - T obj = new T(); + T obj = new(); // Don't spawn at all if there's a respawn time if ((obj.IsTypeId(TypeId.Unit) && map.GetCreatureRespawnTime(guid) == 0) || (obj.IsTypeId(TypeId.GameObject) && map.GetGORespawnTime(guid) == 0) || obj.IsTypeId(TypeId.AreaTrigger)) { diff --git a/Source/Game/Maps/TransportManager.cs b/Source/Game/Maps/TransportManager.cs index 0482e92e4..903e12e77 100644 --- a/Source/Game/Maps/TransportManager.cs +++ b/Source/Game/Maps/TransportManager.cs @@ -70,7 +70,7 @@ namespace Game.Maps continue; // paths are generated per template, saves us from generating it again in case of instanced transports - TransportTemplate transport = new TransportTemplate(); + TransportTemplate transport = new(); transport.entry = entry; GeneratePath(goInfo, transport); @@ -101,8 +101,8 @@ namespace Game.Maps uint pathId = goInfo.MoTransport.taxiPathID; var path = CliDB.TaxiPathNodesByPath[pathId]; List keyFrames = transport.keyFrames; - List splinePath = new List(); - List allPoints = new List(); + List splinePath = new(); + List allPoints = new(); bool mapChange = false; for (uint i = 0; i < path.Length; ++i) @@ -113,8 +113,8 @@ namespace Game.Maps allPoints.Add(allPoints.Last().lerp(allPoints[allPoints.Count - 2], -0.2f)); allPoints.Add(allPoints.Last().lerp(allPoints[allPoints.Count - 2], -1.0f)); - SplineRawInitializer initer = new SplineRawInitializer(allPoints); - Spline orientationSpline = new Spline(); + SplineRawInitializer initer = new(allPoints); + Spline orientationSpline = new(); orientationSpline.InitSplineCustom(initer); orientationSpline.InitLengths(); @@ -130,7 +130,7 @@ namespace Game.Maps } else { - KeyFrame k = new KeyFrame(node_i); + KeyFrame k = new(node_i); Vector3 h; orientationSpline.Evaluate_Derivative((int)(i + 1), 0.0f, out h); k.InitialOrientation = Position.NormalizeOrientation((float)Math.Atan2(h.Y, h.X) + MathFunctions.PI); @@ -202,7 +202,7 @@ namespace Game.Maps if (keyFrames[i - 1].Teleport || i + 1 == keyFrames.Count) { int extra = !keyFrames[i - 1].Teleport ? 1 : 0; - Spline spline = new Spline(); + Spline spline = new(); Span span = splinePath.ToArray(); spline.InitSpline(span.Slice(start), i - start + extra, Spline.EvaluationMode.Catmullrom); spline.InitLengths(); @@ -339,7 +339,7 @@ namespace Game.Maps public void AddPathNodeToTransport(uint transportEntry, uint timeSeg, TransportAnimationRecord node) { - TransportAnimation animNode = new TransportAnimation(); + TransportAnimation animNode = new(); if (animNode.TotalTime < timeSeg) animNode.TotalTime = timeSeg; @@ -373,7 +373,7 @@ namespace Game.Maps } // create transport... - Transport trans = new Transport(); + Transport trans = new(); // ...at first waypoint TaxiPathNodeRecord startNode = tInfo.keyFrames.First().Node; @@ -512,9 +512,9 @@ namespace Game.Maps _transportAnimations[transportEntry].Rotations[timeSeg] = node; } - Dictionary _transportTemplates = new Dictionary(); - MultiMap _instanceTransports = new MultiMap(); - Dictionary _transportAnimations = new Dictionary(); + Dictionary _transportTemplates = new(); + MultiMap _instanceTransports = new(); + Dictionary _transportAnimations = new(); } public class SplineRawInitializer @@ -588,10 +588,10 @@ namespace Game.Maps accelDist = 0.0f; } - public List mapsUsed = new List(); + public List mapsUsed = new(); public bool inInstance; public uint pathTime; - public List keyFrames = new List(); + public List keyFrames = new(); public float accelTime; public float accelDist; public uint entry; @@ -616,8 +616,8 @@ namespace Game.Maps return Rotations.LookupByKey(time); } - public Dictionary Path = new Dictionary(); - public Dictionary Rotations = new Dictionary(); + public Dictionary Path = new(); + public Dictionary Rotations = new(); public uint TotalTime; } } diff --git a/Source/Game/Maps/ZoneScript.cs b/Source/Game/Maps/ZoneScript.cs index e1d011bee..d93e3b45f 100644 --- a/Source/Game/Maps/ZoneScript.cs +++ b/Source/Game/Maps/ZoneScript.cs @@ -46,6 +46,6 @@ namespace Game.Maps public virtual void ProcessEvent(WorldObject obj, uint eventId) { } - protected EventMap _events = new EventMap(); + protected EventMap _events = new(); } } diff --git a/Source/Game/Movement/Generators/ConfusedGenerator.cs b/Source/Game/Movement/Generators/ConfusedGenerator.cs index e09a81b95..13d215399 100644 --- a/Source/Game/Movement/Generators/ConfusedGenerator.cs +++ b/Source/Game/Movement/Generators/ConfusedGenerator.cs @@ -83,7 +83,7 @@ namespace Game.Movement return true; } - MoveSplineInit init = new MoveSplineInit(owner); + MoveSplineInit init = new(owner); init.MovebyPath(_path.GetPath()); init.SetWalk(true); int traveltime = init.Launch(); diff --git a/Source/Game/Movement/Generators/FleeingGenerator.cs b/Source/Game/Movement/Generators/FleeingGenerator.cs index bef7cb434..23b9b5968 100644 --- a/Source/Game/Movement/Generators/FleeingGenerator.cs +++ b/Source/Game/Movement/Generators/FleeingGenerator.cs @@ -122,7 +122,7 @@ namespace Game.Movement return; } - MoveSplineInit init = new MoveSplineInit(owner); + MoveSplineInit init = new(owner); init.MovebyPath(_path.GetPath()); init.SetWalk(false); int traveltime = init.Launch(); diff --git a/Source/Game/Movement/Generators/FlightPathMovementGenerator.cs b/Source/Game/Movement/Generators/FlightPathMovementGenerator.cs index 3ca8110d4..37485e00c 100644 --- a/Source/Game/Movement/Generators/FlightPathMovementGenerator.cs +++ b/Source/Game/Movement/Generators/FlightPathMovementGenerator.cs @@ -126,12 +126,12 @@ namespace Game.Movement owner.AddUnitState(UnitState.InFlight); owner.AddUnitFlag(UnitFlags.RemoveClientControl | UnitFlags.TaxiFlight); - MoveSplineInit init = new MoveSplineInit(owner); + MoveSplineInit init = new(owner); uint end = GetPathAtMapEnd(); init.args.path = new Vector3[end]; for (int i = (int)GetCurrentNode(); i != end; ++i) { - Vector3 vertice = new Vector3(_path[i].Loc.X, _path[i].Loc.Y, _path[i].Loc.Z); + Vector3 vertice = new(_path[i].Loc.X, _path[i].Loc.Y, _path[i].Loc.Z); init.args.path[i] = vertice; } init.SetFirstPointId((int)GetCurrentNode()); @@ -252,9 +252,9 @@ namespace Game.Movement uint _endMapId; //! map Id of last node location uint _preloadTargetNode; //! node index where preloading starts - List _path = new List(); + List _path = new(); int _currentNode; - List _pointsForPathSwitch = new List(); //! node indexes and costs where TaxiPath changes + List _pointsForPathSwitch = new(); //! node indexes and costs where TaxiPath changes class TaxiNodeChangeInfo { diff --git a/Source/Game/Movement/Generators/FormationMovement.cs b/Source/Game/Movement/Generators/FormationMovement.cs index 06104429b..e06d52247 100644 --- a/Source/Game/Movement/Generators/FormationMovement.cs +++ b/Source/Game/Movement/Generators/FormationMovement.cs @@ -44,7 +44,7 @@ namespace Game.Movement owner.AddUnitState(UnitState.RoamingMove); - MoveSplineInit init = new MoveSplineInit(owner); + MoveSplineInit init = new(owner); init.MoveTo(_destination.GetPositionX(), _destination.GetPositionY(), _destination.GetPositionZ()); if (_orientation) init.SetFacing(_destination.GetOrientation()); @@ -96,7 +96,7 @@ namespace Game.Movement owner.AddUnitState(UnitState.RoamingMove); - MoveSplineInit init = new MoveSplineInit(owner); + MoveSplineInit init = new(owner); init.MoveTo(_destination.GetPositionX(), _destination.GetPositionY(), _destination.GetPositionZ()); if (_orientation) init.SetFacing(_destination.GetOrientation()); diff --git a/Source/Game/Movement/Generators/HomeMovement.cs b/Source/Game/Movement/Generators/HomeMovement.cs index 1f3c284ce..7beea0e73 100644 --- a/Source/Game/Movement/Generators/HomeMovement.cs +++ b/Source/Game/Movement/Generators/HomeMovement.cs @@ -59,7 +59,7 @@ namespace Game.AI return; } - MoveSplineInit init = new MoveSplineInit(owner); + MoveSplineInit init = new(owner); float x, y, z, o; // at apply we can select more nice return points base at current movegen if (owner.GetMotionMaster().Empty() || !owner.GetMotionMaster().Top().GetResetPosition(owner, out x, out y, out z)) diff --git a/Source/Game/Movement/Generators/PathGenerator.cs b/Source/Game/Movement/Generators/PathGenerator.cs index 5429956d6..abade3fc9 100644 --- a/Source/Game/Movement/Generators/PathGenerator.cs +++ b/Source/Game/Movement/Generators/PathGenerator.cs @@ -55,10 +55,10 @@ namespace Game.Movement if (!GridDefines.IsValidMapCoord(destX, destY, destZ) || !GridDefines.IsValidMapCoord(x, y, z)) return false; - Vector3 dest = new Vector3(destX, destY, destZ); + Vector3 dest = new(destX, destY, destZ); SetEndPosition(dest); - Vector3 start = new Vector3(x, y, z); + Vector3 start = new(x, y, z); SetStartPosition(start); _forceDestination = forceDest; @@ -477,8 +477,8 @@ namespace Game.Movement Array.Copy(startPoint, pathPoints, 3); // first point // path has to be split into polygons with dist SMOOTH_PATH_STEP_SIZE between them - Vector3 startVec = new Vector3(startPoint[0], startPoint[1], startPoint[2]); - Vector3 endVec = new Vector3(endPoint[0], endPoint[1], endPoint[2]); + Vector3 startVec = new(startPoint[0], startPoint[1], startPoint[2]); + Vector3 endVec = new(endPoint[0], endPoint[1], endPoint[2]); Vector3 diffVec = (endVec - startVec); Vector3 prevVec = startVec; float len = diffVec.GetLength(); @@ -976,7 +976,7 @@ namespace Game.Movement Vector3 _endPosition; PathType pathType; - Detour.dtQueryFilter _filter = new Detour.dtQueryFilter(); + Detour.dtQueryFilter _filter = new(); Detour.dtNavMeshQuery _navMeshQuery; Detour.dtNavMesh _navMesh; } diff --git a/Source/Game/Movement/Generators/PointMovement.cs b/Source/Game/Movement/Generators/PointMovement.cs index f3f19d15c..59d8a95f2 100644 --- a/Source/Game/Movement/Generators/PointMovement.cs +++ b/Source/Game/Movement/Generators/PointMovement.cs @@ -52,7 +52,7 @@ namespace Game.Movement owner.AddUnitState(UnitState.RoamingMove); - MoveSplineInit init = new MoveSplineInit(owner); + MoveSplineInit init = new(owner); init.MoveTo(_destination.GetPositionX(), _destination.GetPositionY(), _destination.GetPositionZ(), _generatePath); if (_speed > 0.0f) init.SetVelocity(_speed); @@ -99,7 +99,7 @@ namespace Game.Movement owner.AddUnitState(UnitState.RoamingMove); - MoveSplineInit init = new MoveSplineInit(owner); + MoveSplineInit init = new(owner); init.MoveTo(_destination.GetPositionX(), _destination.GetPositionY(), _destination.GetPositionZ(), _generatePath); if (_speed > 0.0f) // Default value for point motion type is 0.0, if 0.0 spline will use GetSpeed on unit init.SetVelocity(_speed); diff --git a/Source/Game/Movement/Generators/RandomMovement.cs b/Source/Game/Movement/Generators/RandomMovement.cs index baefabba8..4d9cab8de 100644 --- a/Source/Game/Movement/Generators/RandomMovement.cs +++ b/Source/Game/Movement/Generators/RandomMovement.cs @@ -92,7 +92,7 @@ namespace Game.Movement owner.AddUnitState(UnitState.RoamingMove); - Position position = new Position(_reference); + Position position = new(_reference); float distance = RandomHelper.FRand(0.0f, 1.0f) * _wanderDistance; float angle = RandomHelper.FRand(0.0f, 1.0f) * MathF.PI * 2.0f; owner.MovePositionToFirstCollision(ref position, distance, angle); @@ -110,7 +110,7 @@ namespace Game.Movement return; } - MoveSplineInit init = new MoveSplineInit(owner); + MoveSplineInit init = new(owner); init.MovebyPath(_path.GetPath()); init.SetWalk(true); int traveltime = init.Launch(); diff --git a/Source/Game/Movement/Generators/SplineChainMovementGenerator.cs b/Source/Game/Movement/Generators/SplineChainMovementGenerator.cs index 265763f78..d0737f2ed 100644 --- a/Source/Game/Movement/Generators/SplineChainMovementGenerator.cs +++ b/Source/Game/Movement/Generators/SplineChainMovementGenerator.cs @@ -48,7 +48,7 @@ namespace Game.Movement { int numWp = wp.Length; Cypher.Assert(numWp > 1, "Every path must have source & destination"); - MoveSplineInit init = new MoveSplineInit(me); + MoveSplineInit init = new(me); if (numWp > 2) init.MovebyPath(wp.ToArray()); else @@ -174,7 +174,7 @@ namespace Game.Movement public override MovementGeneratorType GetMovementGeneratorType() { return MovementGeneratorType.SplineChain; } uint _id; - List _chain = new List(); + List _chain = new(); byte _chainSize; bool _walk; bool finished; diff --git a/Source/Game/Movement/Generators/TargetMovement.cs b/Source/Game/Movement/Generators/TargetMovement.cs index e6683fea5..df940d58e 100644 --- a/Source/Game/Movement/Generators/TargetMovement.cs +++ b/Source/Game/Movement/Generators/TargetMovement.cs @@ -201,7 +201,7 @@ namespace Game.Movement if (owner.IsTypeId(TypeId.Unit)) owner.ToCreature().SetCannotReachTarget(false); - MoveSplineInit init = new MoveSplineInit(owner); + MoveSplineInit init = new(owner); init.MovebyPath(_path.GetPath()); init.SetWalk(EnableWalking()); // Using the same condition for facing target as the one that is used for SetInFront on movement end diff --git a/Source/Game/Movement/Generators/WaypointMovement.cs b/Source/Game/Movement/Generators/WaypointMovement.cs index 79fa13ea6..47257f59f 100644 --- a/Source/Game/Movement/Generators/WaypointMovement.cs +++ b/Source/Game/Movement/Generators/WaypointMovement.cs @@ -179,14 +179,14 @@ namespace Game.Movement Cypher.Assert(_currentNode < _path.nodes.Count, $"WaypointMovementGenerator.StartMove: tried to reference a node id ({_currentNode}) which is not included in path ({_path.id})"); WaypointNode waypoint = _path.nodes.ElementAt(_currentNode); - Position formationDest = new Position(waypoint.x, waypoint.y, waypoint.z, (waypoint.orientation != 0 && waypoint.delay != 0) ? waypoint.orientation : 0.0f); + Position formationDest = new(waypoint.x, waypoint.y, waypoint.z, (waypoint.orientation != 0 && waypoint.delay != 0) ? waypoint.orientation : 0.0f); _isArrivalDone = false; _recalculateSpeed = false; creature.AddUnitState(UnitState.RoamingMove); - MoveSplineInit init = new MoveSplineInit(creature); + MoveSplineInit init = new(creature); //! If creature is on transport, we assume waypoints set in DB are already transport offsets if (transportPath) diff --git a/Source/Game/Movement/MotionMaster.cs b/Source/Game/Movement/MotionMaster.cs index 36a67aa9e..6004abc06 100644 --- a/Source/Game/Movement/MotionMaster.cs +++ b/Source/Game/Movement/MotionMaster.cs @@ -29,7 +29,7 @@ namespace Game.Movement { public const double gravity = 19.29110527038574; public const float SPEED_CHARGE = 42.0f; - IdleMovementGenerator staticIdleMovement = new IdleMovementGenerator(); + IdleMovementGenerator staticIdleMovement = new(); public MotionMaster(Unit me) { @@ -285,7 +285,7 @@ namespace Game.Movement else { // we are already close enough. We just need to turn toward the target without changing position. - MoveSplineInit init = new MoveSplineInit(_owner); + MoveSplineInit init = new(_owner); init.MoveTo(_owner.GetPositionX(), _owner.GetPositionY(), _owner.GetPositionZMinusOffset()); init.SetFacing(target); init.Launch(); @@ -298,7 +298,7 @@ namespace Game.Movement float x, y, z; pos.GetPosition(out x, out y, out z); - MoveSplineInit init = new MoveSplineInit(_owner); + MoveSplineInit init = new(_owner); init.MoveTo(x, y, z); init.SetAnimation(AnimType.ToGround); init.Launch(); @@ -310,7 +310,7 @@ namespace Game.Movement float x, y, z; pos.GetPosition(out x, out y, out z); - MoveSplineInit init = new MoveSplineInit(_owner); + MoveSplineInit init = new(_owner); init.MoveTo(x, y, z); init.SetAnimation(AnimType.ToFly); init.Launch(); @@ -335,7 +335,7 @@ namespace Game.Movement MoveCharge(dest.X, dest.Y, dest.Z, SPEED_CHARGE, EventId.ChargePrepath); // Charge movement is not started when using EVENT_CHARGE_PREPATH - MoveSplineInit init = new MoveSplineInit(_owner); + MoveSplineInit init = new(_owner); init.MovebyPath(path.GetPath()); init.SetVelocity(speed); if (target != null) @@ -361,7 +361,7 @@ namespace Game.Movement _owner.GetNearPoint(_owner, out x, out y, out z, _owner.GetCombatReach(), dist, _owner.GetAngle(srcX, srcY) + MathFunctions.PI); - MoveSplineInit init = new MoveSplineInit(_owner); + MoveSplineInit init = new(_owner); init.MoveTo(x, y, z); init.SetParabolic(max_height, 0); init.SetOrientationFixed(true); @@ -402,7 +402,7 @@ namespace Game.Movement float moveTimeHalf = (float)(speedZ / gravity); float max_height = -MoveSpline.ComputeFallElevation(moveTimeHalf, false, -speedZ); - MoveSplineInit init = new MoveSplineInit(_owner); + MoveSplineInit init = new(_owner); init.MoveTo(x, y, z, false); init.SetParabolic(max_height, 0); init.SetVelocity(speedXY); @@ -426,14 +426,14 @@ namespace Game.Movement public void MoveCirclePath(float x, float y, float z, float radius, bool clockwise, byte stepCount) { float step = 2 * MathFunctions.PI / stepCount * (clockwise ? -1.0f : 1.0f); - Position pos = new Position(x, y, z, 0.0f); + Position pos = new(x, y, z, 0.0f); float angle = pos.GetAngle(_owner.GetPositionX(), _owner.GetPositionY()); - MoveSplineInit init = new MoveSplineInit(_owner); + MoveSplineInit init = new(_owner); init.args.path = new Vector3[stepCount]; for (byte i = 0; i < stepCount; angle += step, ++i) { - Vector3 point = new Vector3(); + Vector3 point = new(); point.X = (float)(x + radius * Math.Cos(angle)); point.Y = (float)(y + radius * Math.Sin(angle)); @@ -462,7 +462,7 @@ namespace Game.Movement void MoveSmoothPath(uint pointId, Vector3[] pathPoints, int pathSize, bool walk = false, bool fly = false) { - MoveSplineInit init = new MoveSplineInit(_owner); + MoveSplineInit init = new(_owner); if (fly) { init.SetFly(); @@ -535,7 +535,7 @@ namespace Game.Movement return; } - MoveSplineInit init = new MoveSplineInit(_owner); + MoveSplineInit init = new(_owner); init.MoveTo(_owner.GetPositionX(), _owner.GetPositionY(), tz, false); init.SetFall(); init.Launch(); @@ -570,7 +570,7 @@ namespace Game.Movement if (path < CliDB.TaxiPathNodesByPath.Count) { Log.outDebug(LogFilter.Server, "{0} taxi to (Path {1} node {2})", _owner.GetName(), path, pathnode); - FlightPathMovementGenerator mgen = new FlightPathMovementGenerator(); + FlightPathMovementGenerator mgen = new(); mgen.LoadPath(_owner.ToPlayer()); StartMovement(mgen, MovementSlot.Controlled); } @@ -825,7 +825,7 @@ namespace Game.Movement MMCleanFlag _cleanFlag; bool[] _initialize = new bool[(int)MovementSlot.Max]; int _top; - List _expireList = new List(); + List _expireList = new(); } public class JumpArrivalCastArgs diff --git a/Source/Game/Movement/MoveSpline.cs b/Source/Game/Movement/MoveSpline.cs index f975cafb1..92ce1321c 100644 --- a/Source/Game/Movement/MoveSpline.cs +++ b/Source/Game/Movement/MoveSpline.cs @@ -91,12 +91,12 @@ namespace Game.Movement // init spline timestamps if (splineflags.HasFlag(SplineFlag.Falling)) { - FallInitializer init = new FallInitializer(spline.GetPoint(spline.First()).Z); + FallInitializer init = new(spline.GetPoint(spline.First()).Z); spline.InitLengths(init); } else { - CommonInitializer init = new CommonInitializer(args.velocity); + CommonInitializer init = new(args.velocity); spline.InitLengths(init); } @@ -297,9 +297,9 @@ namespace Game.Movement #region Fields public MoveSplineInitArgs InitArgs; - public Spline spline = new Spline(); + public Spline spline = new(); public FacingInfo facing; - public MoveSplineFlag splineflags = new MoveSplineFlag(); + public MoveSplineFlag splineflags = new(); public bool onTransport; public bool splineIsFacingOnly; public uint m_Id; @@ -392,7 +392,7 @@ namespace Game.Movement TimeToNext = msToNext; } - public List Points = new List(); + public List Points = new(); public uint ExpectedDuration; public uint TimeToNext; } @@ -414,7 +414,7 @@ namespace Game.Movement public void Clear() { Chain.Clear(); } public uint PointID; - public List Chain = new List(); + public List Chain = new(); public bool IsWalkMode; public byte SplineIndex; public byte PointIndex; diff --git a/Source/Game/Movement/MoveSplineInit.cs b/Source/Game/Movement/MoveSplineInit.cs index 9b40ed23e..60043af78 100644 --- a/Source/Game/Movement/MoveSplineInit.cs +++ b/Source/Game/Movement/MoveSplineInit.cs @@ -73,7 +73,7 @@ namespace Game.Movement MoveSpline move_spline = unit.MoveSpline; bool transport = !unit.GetTransGUID().IsEmpty(); - Vector4 real_position = new Vector4(); + Vector4 real_position = new(); // there is a big chance that current position is unknown if current state is not finalized, need compute it // this also allows calculate spline position and update map position in much greater intervals // Don't compute for transport movement if the unit is in a motion between two transports @@ -130,7 +130,7 @@ namespace Game.Movement unit.m_movementInfo.SetMovementFlags(moveFlags); move_spline.Initialize(args); - MonsterMove packet = new MonsterMove(); + MonsterMove packet = new(); packet.MoverGUID = unit.GetGUID(); packet.Pos = new Vector3(real_position.X, real_position.Y, real_position.Z); packet.InitializeSplineData(move_spline); @@ -153,7 +153,7 @@ namespace Game.Movement return; bool transport = !unit.GetTransGUID().IsEmpty(); - Vector4 loc = new Vector4(); + Vector4 loc = new(); if (move_spline.onTransport == transport) loc = move_spline.ComputePosition(); else @@ -175,7 +175,7 @@ namespace Game.Movement move_spline.onTransport = transport; move_spline.Initialize(args); - MonsterMove packet = new MonsterMove(); + MonsterMove packet = new(); packet.MoverGUID = unit.GetGUID(); packet.Pos = new Vector3(loc.X, loc.Y, loc.Z); packet.SplineData.StopDistanceTolerance = 2; @@ -217,7 +217,7 @@ namespace Game.Movement { if (generatePath) { - PathGenerator path = new PathGenerator(unit); + PathGenerator path = new(unit); bool result = path.CalculatePath(dest.X, dest.Y, dest.Z, forceDestination); if (result && !Convert.ToBoolean(path.GetPathType() & PathType.NoPath)) { @@ -228,7 +228,7 @@ namespace Game.Movement args.path_Idx_offset = 0; args.path = new Vector3[2]; - TransportPathTransform transform = new TransportPathTransform(unit, args.TransformForTransport); + TransportPathTransform transform = new(unit, args.TransformForTransport); args.path[1] = transform.Calc(dest); } @@ -264,7 +264,7 @@ namespace Game.Movement { args.path_Idx_offset = path_offset; args.path = new Vector3[controls.Length]; - TransportPathTransform transform = new TransportPathTransform(unit, args.TransformForTransport); + TransportPathTransform transform = new(unit, args.TransformForTransport); for (var i = 0; i < controls.Length; i++) args.path[i] = transform.Calc(controls[i]); @@ -292,7 +292,7 @@ namespace Game.Movement public void SetFacing(Vector3 spot) { - TransportPathTransform transform = new TransportPathTransform(unit, args.TransformForTransport); + TransportPathTransform transform = new(unit, args.TransformForTransport); Vector3 finalSpot = transform.Calc(spot); args.facing.f = new Vector3(finalSpot.X, finalSpot.Y, finalSpot.Z); args.facing.type = MonsterMoveType.FacingSpot; @@ -307,7 +307,7 @@ namespace Game.Movement public Vector3[] Path() { return args.path; } - public MoveSplineInitArgs args = new MoveSplineInitArgs(); + public MoveSplineInitArgs args = new(); Unit unit; } diff --git a/Source/Game/Movement/MoveSplineInitArgs.cs b/Source/Game/Movement/MoveSplineInitArgs.cs index 75bc74731..9ec1e6834 100644 --- a/Source/Game/Movement/MoveSplineInitArgs.cs +++ b/Source/Game/Movement/MoveSplineInitArgs.cs @@ -38,8 +38,8 @@ namespace Game.Movement } public Vector3[] path; - public FacingInfo facing = new FacingInfo(); - public MoveSplineFlag flags = new MoveSplineFlag(); + public FacingInfo facing = new(); + public MoveSplineFlag flags = new(); public int path_Idx_offset; public float velocity; public float parabolic_amplitude; diff --git a/Source/Game/Movement/Spline.cs b/Source/Game/Movement/Spline.cs index cbd5d465b..715967760 100644 --- a/Source/Game/Movement/Spline.cs +++ b/Source/Game/Movement/Spline.cs @@ -296,13 +296,13 @@ namespace Game.Movement return i; } - private static readonly Matrix4 s_catmullRomCoeffs = new Matrix4(-0.5f, 1.5f, -1.5f, 0.5f, 1.0f, -2.5f, 2.0f, -0.5f, -0.5f, 0.0f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f); + private static readonly Matrix4 s_catmullRomCoeffs = new(-0.5f, 1.5f, -1.5f, 0.5f, 1.0f, -2.5f, 2.0f, -0.5f, -0.5f, 0.0f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f); - private static readonly Matrix4 s_Bezier3Coeffs = new Matrix4(-1.0f, 3.0f, -3.0f, 1.0f, 3.0f, -6.0f, 3.0f, 0.0f, -3.0f, 3.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f); + private static readonly Matrix4 s_Bezier3Coeffs = new(-1.0f, 3.0f, -3.0f, 1.0f, 3.0f, -6.0f, 3.0f, 0.0f, -3.0f, 3.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f); void C_Evaluate(Span vertice, float t, Matrix4 matr, out Vector3 result) { - Vector4 tvec = new Vector4(t * t * t, t * t, t, 1.0f); + Vector4 tvec = new(t * t * t, t * t, t, 1.0f); Vector4 weights = (tvec * matr); result = vertice[0] * weights[0] + vertice[1] * weights[1] @@ -310,7 +310,7 @@ namespace Game.Movement } void C_Evaluate_Derivative(Span vertice, float t, Matrix4 matr, out Vector3 result) { - Vector4 tvec = new Vector4(3.0f * t * t, 2.0f * t, 1.0f, 0.0f); + Vector4 tvec = new(3.0f * t * t, 2.0f * t, 1.0f, 0.0f); Vector4 weights = (tvec * matr); result = vertice[0] * weights[0] + vertice[1] * weights[1] diff --git a/Source/Game/Movement/WaypointManager.cs b/Source/Game/Movement/WaypointManager.cs index 72e6b32f8..b02ed374f 100644 --- a/Source/Game/Movement/WaypointManager.cs +++ b/Source/Game/Movement/WaypointManager.cs @@ -52,7 +52,7 @@ namespace Game GridDefines.NormalizeMapCoord(ref x); GridDefines.NormalizeMapCoord(ref y); - WaypointNode waypoint = new WaypointNode(); + WaypointNode waypoint = new(); waypoint.id = result.Read(1); waypoint.x = x; waypoint.y = y; @@ -94,7 +94,7 @@ namespace Game if (result.IsEmpty()) return; - List values = new List(); + List values = new(); do { float x = result.Read(1); @@ -105,7 +105,7 @@ namespace Game GridDefines.NormalizeMapCoord(ref x); GridDefines.NormalizeMapCoord(ref y); - WaypointNode waypoint = new WaypointNode(); + WaypointNode waypoint = new(); waypoint.id = result.Read(0); waypoint.x = x; waypoint.y = y; @@ -135,7 +135,7 @@ namespace Game return _waypointStore.LookupByKey(id); } - Dictionary _waypointStore = new Dictionary(); + Dictionary _waypointStore = new(); } public class WaypointNode @@ -171,7 +171,7 @@ namespace Game nodes = _nodes; } - public List nodes = new List(); + public List nodes = new(); public uint id; } diff --git a/Source/Game/Networking/PacketLog.cs b/Source/Game/Networking/PacketLog.cs index 2f6d47bfe..b93e0e941 100644 --- a/Source/Game/Networking/PacketLog.cs +++ b/Source/Game/Networking/PacketLog.cs @@ -24,7 +24,7 @@ using System.Text; public class PacketLog { - static object syncObj = new object(); + static object syncObj = new(); static string FullPath; static PacketLog() diff --git a/Source/Game/Networking/PacketManager.cs b/Source/Game/Networking/PacketManager.cs index 7e05b0e5f..d8cb2ac35 100644 --- a/Source/Game/Networking/PacketManager.cs +++ b/Source/Game/Networking/PacketManager.cs @@ -95,7 +95,7 @@ namespace Game.Networking return _clientPacketTable.ContainsKey(opcode); } - static ConcurrentDictionary _clientPacketTable = new ConcurrentDictionary(); + static ConcurrentDictionary _clientPacketTable = new(); public static bool IsInstanceOnlyOpcode(ServerOpcodes opcode) { diff --git a/Source/Game/Networking/Packets/AchievementPackets.cs b/Source/Game/Networking/Packets/AchievementPackets.cs index 20e8aadc2..2761d01f8 100644 --- a/Source/Game/Networking/Packets/AchievementPackets.cs +++ b/Source/Game/Networking/Packets/AchievementPackets.cs @@ -32,7 +32,7 @@ namespace Game.Networking.Packets Data.Write(_worldPacket); } - public AllAchievements Data = new AllAchievements(); + public AllAchievements Data = new(); } class AllAccountCriteria : ServerPacket @@ -46,7 +46,7 @@ namespace Game.Networking.Packets progress.Write(_worldPacket); } - public List Progress = new List(); + public List Progress = new(); } public class RespondInspectAchievements : ServerPacket @@ -60,7 +60,7 @@ namespace Game.Networking.Packets } public ObjectGuid Player; - public AllAchievements Data = new AllAchievements(); + public AllAchievements Data = new(); } public class CriteriaUpdate : ServerPacket @@ -195,7 +195,7 @@ namespace Game.Networking.Packets } } - public List Progress = new List(); + public List Progress = new(); } public class GuildCriteriaDeleted : ServerPacket @@ -268,7 +268,7 @@ namespace Game.Networking.Packets earned.Write(_worldPacket); } - public List Earned = new List(); + public List Earned = new(); } class GuildGetAchievementMembers : ClientPacket @@ -302,7 +302,7 @@ namespace Game.Networking.Packets public ObjectGuid GuildGUID; public uint AchievementID; - public List Member = new List(); + public List Member = new(); } //Structs @@ -377,7 +377,7 @@ namespace Game.Networking.Packets progress.Write(data); } - public List Earned = new List(); - public List Progress = new List(); + public List Earned = new(); + public List Progress = new(); } } diff --git a/Source/Game/Networking/Packets/AdventureJournalPackets.cs b/Source/Game/Networking/Packets/AdventureJournalPackets.cs index 00a07d619..196bb872a 100644 --- a/Source/Game/Networking/Packets/AdventureJournalPackets.cs +++ b/Source/Game/Networking/Packets/AdventureJournalPackets.cs @@ -65,7 +65,7 @@ namespace Game.Networking.Packets } public bool OnLevelUp; - public List AdventureJournalDatas = new List(); + public List AdventureJournalDatas = new(); } struct AdventureJournalEntry diff --git a/Source/Game/Networking/Packets/AreaTriggerPackets.cs b/Source/Game/Networking/Packets/AreaTriggerPackets.cs index 643e203fd..5ed87bef5 100644 --- a/Source/Game/Networking/Packets/AreaTriggerPackets.cs +++ b/Source/Game/Networking/Packets/AreaTriggerPackets.cs @@ -108,6 +108,6 @@ namespace Game.Networking.Packets public uint TimeToTarget; public uint ElapsedTimeForMovement; - public List Points = new List(); + public List Points = new(); } } diff --git a/Source/Game/Networking/Packets/ArtifactPackets.cs b/Source/Game/Networking/Packets/ArtifactPackets.cs index 40e76b908..aae96d256 100644 --- a/Source/Game/Networking/Packets/ArtifactPackets.cs +++ b/Source/Game/Networking/Packets/ArtifactPackets.cs @@ -42,7 +42,7 @@ namespace Game.Networking.Packets public ObjectGuid ArtifactGUID; public ObjectGuid ForgeGUID; - public Array PowerChoices = new Array(1); + public Array PowerChoices = new(1); public struct ArtifactPowerChoice { diff --git a/Source/Game/Networking/Packets/AuctionHousePackets.cs b/Source/Game/Networking/Packets/AuctionHousePackets.cs index 23f8af43c..826856b68 100644 --- a/Source/Game/Networking/Packets/AuctionHousePackets.cs +++ b/Source/Game/Networking/Packets/AuctionHousePackets.cs @@ -29,12 +29,12 @@ namespace Game.Networking.Packets public byte MinLevel = 1; public byte MaxLevel = SharedConst.MaxLevel; public AuctionHouseFilterMask Filters; - public Array KnownPets = new Array(SharedConst.MaxBattlePetSpeciesId / 8 + 1); + public Array KnownPets = new(SharedConst.MaxBattlePetSpeciesId / 8 + 1); public sbyte MaxPetLevel; public Optional TaintedBy; public string Name; - public Array ItemClassFilters = new Array(7); - public Array Sorts = new Array(2); + public Array ItemClassFilters = new(7); + public Array Sorts = new(2); public AuctionBrowseQuery(WorldPacket packet) : base(packet) { } @@ -123,8 +123,8 @@ namespace Game.Networking.Packets { public ObjectGuid Auctioneer; public uint Offset; - public List AuctionItemIDs = new List(); - public Array Sorts = new Array(2); + public List AuctionItemIDs = new(); + public Array Sorts = new(2); public Optional TaintedBy; public AuctionListBiddedItems(WorldPacket packet) : base(packet) { } @@ -153,8 +153,8 @@ namespace Game.Networking.Packets { public ObjectGuid Auctioneer; public Optional TaintedBy; - public Array BucketKeys = new Array(100); - public Array Sorts = new Array(2); + public Array BucketKeys = new(100); + public Array Sorts = new(2); public AuctionListBucketsByBucketKeys(WorldPacket packet) : base(packet) { } @@ -183,7 +183,7 @@ namespace Game.Networking.Packets public uint Offset; public sbyte Unknown830; public Optional TaintedBy; - public Array Sorts = new Array(2); + public Array Sorts = new(2); public AuctionBucketKey BucketKey; public AuctionListItemsByBucketKey(WorldPacket packet) : base(packet) { } @@ -213,7 +213,7 @@ namespace Game.Networking.Packets public int SuffixItemNameDescriptionID; public uint Offset; public Optional TaintedBy; - public Array Sorts = new Array(2); + public Array Sorts = new(2); public AuctionListItemsByItemID(WorldPacket packet) : base(packet) { } @@ -242,7 +242,7 @@ namespace Game.Networking.Packets public ObjectGuid Auctioneer; public uint Offset; public Optional TaintedBy; - public Array Sorts = new Array(2); + public Array Sorts = new(2); public AuctionListOwnedItems(WorldPacket packet) : base(packet) { } @@ -333,7 +333,7 @@ namespace Game.Networking.Packets public ulong UnitPrice; public uint RunTime; public Optional TaintedBy; - public Array Items = new Array(64); + public Array Items = new(64); public AuctionSellCommodity(WorldPacket packet) : base(packet) { } @@ -360,7 +360,7 @@ namespace Game.Networking.Packets public ulong MinBid; public uint RunTime; public Optional TaintedBy; - public Array Items = new Array(1); + public Array Items = new(1); public AuctionSellItem(WorldPacket packet) : base(packet) { } @@ -506,7 +506,7 @@ namespace Game.Networking.Packets public class AuctionListBiddedItemsResult : ServerPacket { - public List Items = new List(); + public List Items = new(); public uint DesiredDelay; public bool HasMoreResults; @@ -526,7 +526,7 @@ namespace Game.Networking.Packets public class AuctionListBucketsResult : ServerPacket { - public List Buckets = new List(); + public List Buckets = new(); public uint DesiredDelay; public int Unknown830_0; public int Unknown830_1; @@ -553,7 +553,7 @@ namespace Game.Networking.Packets class AuctionFavoriteList : ServerPacket { public uint DesiredDelay; - public List Items = new List(); + public List Items = new(); public AuctionFavoriteList() : base(ServerOpcodes.AuctionFavoriteList) { } @@ -570,13 +570,13 @@ namespace Game.Networking.Packets public class AuctionListItemsResult : ServerPacket { - public List Items = new List(); + public List Items = new(); public uint Unknown830; public uint TotalCount; public uint DesiredDelay; public AuctionHouseListType ListType; public bool HasMoreResults; - public AuctionBucketKey BucketKey = new AuctionBucketKey(); + public AuctionBucketKey BucketKey = new(); public AuctionListItemsResult() : base(ServerOpcodes.AuctionListItemsResult) { } @@ -599,8 +599,8 @@ namespace Game.Networking.Packets public class AuctionListOwnedItemsResult : ServerPacket { - public List Items = new List(); - public List SoldItems = new List(); + public List Items = new(); + public List SoldItems = new(); public uint DesiredDelay; public bool HasMoreResults; @@ -661,7 +661,7 @@ namespace Game.Networking.Packets public uint DesiredDelay; public uint ChangeNumberTombstone; public uint Result; - public List Items = new List(); + public List Items = new(); public AuctionReplicateResponse() : base(ServerOpcodes.AuctionReplicateResponse) { } @@ -696,8 +696,8 @@ namespace Game.Networking.Packets { public uint ItemID; public ushort ItemLevel; - public Optional BattlePetSpeciesID = new Optional(); - public Optional SuffixItemNameDescriptionID = new Optional(); + public Optional BattlePetSpeciesID = new(); + public Optional SuffixItemNameDescriptionID = new(); public AuctionBucketKey() { } @@ -764,7 +764,7 @@ namespace Game.Networking.Packets public class AuctionListFilterClass { public int ItemClass; - public Array SubClassFilters = new Array(31); + public Array SubClassFilters = new(31); public AuctionListFilterClass(WorldPacket data) { @@ -861,7 +861,7 @@ namespace Game.Networking.Packets public int TotalQuantity; public ulong MinPrice; public int RequiredLevel; - public List ItemModifiedAppearanceIDs = new List(); + public List ItemModifiedAppearanceIDs = new(); public Optional MaxBattlePetQuality; public Optional MaxBattlePetLevel; public Optional BattlePetBreedID; @@ -909,7 +909,7 @@ namespace Game.Networking.Packets public Optional Item; public int Count; public int Charges; - public List Enchantments = new List(); + public List Enchantments = new(); public uint Flags; public uint AuctionID; public ObjectGuid Owner; @@ -926,7 +926,7 @@ namespace Game.Networking.Packets public uint EndTime; public Optional Bidder; public Optional BidAmount; - public List Gems = new List(); + public List Gems = new(); public Optional AuctionBucketKey; public void Write(WorldPacket data) diff --git a/Source/Game/Networking/Packets/AuthenticationPackets.cs b/Source/Game/Networking/Packets/AuthenticationPackets.cs index 169d59222..26b78977a 100644 --- a/Source/Game/Networking/Packets/AuthenticationPackets.cs +++ b/Source/Game/Networking/Packets/AuthenticationPackets.cs @@ -97,7 +97,7 @@ namespace Game.Networking.Packets public uint RegionID; public uint BattlegroupID; public uint RealmID; - public Array LocalChallenge = new Array(16); + public Array LocalChallenge = new(16); public byte[] Digest = new byte[24]; public ulong DosResponse; public string RealmJoinTicket; @@ -215,8 +215,8 @@ namespace Game.Networking.Packets public GameTime GameTimeInfo; - public List VirtualRealms = new List(); // list of realms connected to this one (inclusive) @todo implement - public List Templates = new List(); // list of pre-made character templates. @todo implement + public List VirtualRealms = new(); // list of realms connected to this one (inclusive) @todo implement + public List Templates = new(); // list of pre-made character templates. @todo implement public List AvailableClasses; // the minimum AccountExpansion required to select the classes @@ -264,7 +264,7 @@ namespace Game.Networking.Packets public override void Write() { - ByteBuffer whereBuffer = new ByteBuffer(); + ByteBuffer whereBuffer = new(); whereBuffer.WriteUInt8((byte)Payload.Where.Type); switch (Payload.Where.Type) @@ -282,7 +282,7 @@ namespace Game.Networking.Packets break; } - Sha256 hash = new Sha256(); + Sha256 hash = new(); hash.Process(whereBuffer.GetData(), (int)whereBuffer.GetSize()); hash.Process((uint)Payload.Where.Type); hash.Finish(BitConverter.GetBytes(Payload.Port)); @@ -380,7 +380,7 @@ namespace Game.Networking.Packets public override void Write() { - HmacSha256 hash = new HmacSha256(EncryptionKey); + HmacSha256 hash = new(EncryptionKey); hash.Process(BitConverter.GetBytes(Enabled), 1); hash.Finish(EnableEncryptionSeed, 16); diff --git a/Source/Game/Networking/Packets/BattleGroundPackets.cs b/Source/Game/Networking/Packets/BattleGroundPackets.cs index f42668181..5366bb92a 100644 --- a/Source/Game/Networking/Packets/BattleGroundPackets.cs +++ b/Source/Game/Networking/Packets/BattleGroundPackets.cs @@ -106,7 +106,7 @@ namespace Game.Networking.Packets Ticket.Write(_worldPacket); } - public RideTicket Ticket = new RideTicket(); + public RideTicket Ticket = new(); } public class BattlefieldStatusNeedConfirmation : ServerPacket @@ -123,7 +123,7 @@ namespace Game.Networking.Packets public uint Timeout; public uint Mapid; - public BattlefieldStatusHeader Hdr = new BattlefieldStatusHeader(); + public BattlefieldStatusHeader Hdr = new(); public byte Role; } @@ -142,7 +142,7 @@ namespace Game.Networking.Packets _worldPacket.FlushBits(); } - public BattlefieldStatusHeader Hdr = new BattlefieldStatusHeader(); + public BattlefieldStatusHeader Hdr = new(); public uint ShutdownTimer; public byte ArenaFaction; public bool LeftEarly; @@ -166,7 +166,7 @@ namespace Game.Networking.Packets } public uint AverageWaitTime; - public BattlefieldStatusHeader Hdr = new BattlefieldStatusHeader(); + public BattlefieldStatusHeader Hdr = new(); public bool AsGroup; public bool SuspendedQueue; public bool EligibleForMatchmaking; @@ -188,7 +188,7 @@ namespace Game.Networking.Packets public ulong QueueID; public ObjectGuid ClientID; public int Reason; - public RideTicket Ticket = new RideTicket(); + public RideTicket Ticket = new(); } class BattlemasterJoin : ClientPacket @@ -206,7 +206,7 @@ namespace Game.Networking.Packets QueueIDs[i] = _worldPacket.ReadUInt64(); } - public Array QueueIDs = new Array(1); + public Array QueueIDs = new(1); public byte Roles; public int[] BlacklistMap = new int[2]; } @@ -242,7 +242,7 @@ namespace Game.Networking.Packets AcceptedInvite = _worldPacket.HasBit(); } - public RideTicket Ticket = new RideTicket(); + public RideTicket Ticket = new(); public bool AcceptedInvite; } @@ -282,7 +282,7 @@ namespace Game.Networking.Packets public int BattlemasterListID; public byte MinLevel; public byte MaxLevel; - public List Battlefields = new List(); // Players cannot join a specific Battleground instance anymore - this is always empty + public List Battlefields = new(); // Players cannot join a specific Battleground instance anymore - this is always empty public bool PvpAnywhere; public bool HasRandomWinToday; } @@ -373,7 +373,7 @@ namespace Game.Networking.Packets pos.Write(_worldPacket); } - public List FlagCarriers = new List(); + public List FlagCarriers = new(); } class BattlegroundPlayerJoined : ServerPacket @@ -554,7 +554,7 @@ namespace Game.Networking.Packets public class PVPMatchStatistics { - public List Statistics = new List(); + public List Statistics = new(); public Optional Ratings; public sbyte[] PlayerCount = new sbyte[2]; @@ -665,7 +665,7 @@ namespace Game.Networking.Packets public Optional RatingChange; public Optional PreMatchMMR; public Optional MmrChange; - public List Stats = new List(); + public List Stats = new(); public int PrimaryTalentTree; public int Sex; public Race PlayerRace; @@ -709,7 +709,7 @@ namespace Game.Networking.Packets } public RideTicket Ticket; - public List QueueID = new List(); + public List QueueID = new(); public byte RangeMin; public byte RangeMax; public byte TeamSize; diff --git a/Source/Game/Networking/Packets/BattlePetPackets.cs b/Source/Game/Networking/Packets/BattlePetPackets.cs index 6b4a53c0f..4120606fb 100644 --- a/Source/Game/Networking/Packets/BattlePetPackets.cs +++ b/Source/Game/Networking/Packets/BattlePetPackets.cs @@ -45,8 +45,8 @@ namespace Game.Networking.Packets public ushort Trap; bool HasJournalLock = true; - public List Slots = new List(); - public List Pets = new List(); + public List Slots = new(); + public List Pets = new(); int MaxPets = 1000; } @@ -78,7 +78,7 @@ namespace Game.Networking.Packets pet.Write(_worldPacket); } - public List Pets = new List(); + public List Pets = new(); public bool PetAdded; } @@ -97,7 +97,7 @@ namespace Game.Networking.Packets slot.Write(_worldPacket); } - public List Slots = new List(); + public List Slots = new(); public bool AutoSlotted; public bool NewSlot; } diff --git a/Source/Game/Networking/Packets/BattlenetPackets.cs b/Source/Game/Networking/Packets/BattlenetPackets.cs index 536b962e1..6f85c4e85 100644 --- a/Source/Game/Networking/Packets/BattlenetPackets.cs +++ b/Source/Game/Networking/Packets/BattlenetPackets.cs @@ -33,7 +33,7 @@ namespace Game.Networking.Packets } public MethodCall Method; - public ByteBuffer Data = new ByteBuffer(); + public ByteBuffer Data = new(); } class Response : ServerPacket @@ -50,7 +50,7 @@ namespace Game.Networking.Packets public BattlenetRpcErrorCode BnetStatus = BattlenetRpcErrorCode.Ok; public MethodCall Method; - public ByteBuffer Data = new ByteBuffer(); + public ByteBuffer Data = new(); } class ConnectionStatus : ServerPacket @@ -113,7 +113,7 @@ namespace Game.Networking.Packets } public uint Token; - public Array Secret = new Array(32); + public Array Secret = new(32); } public struct MethodCall diff --git a/Source/Game/Networking/Packets/BlackMarketPackets.cs b/Source/Game/Networking/Packets/BlackMarketPackets.cs index ba5bc02e4..7615d98c3 100644 --- a/Source/Game/Networking/Packets/BlackMarketPackets.cs +++ b/Source/Game/Networking/Packets/BlackMarketPackets.cs @@ -76,7 +76,7 @@ namespace Game.Networking.Packets } public int LastUpdateID; - public List Items = new List(); + public List Items = new(); } class BlackMarketBidOnItem : ClientPacket @@ -93,7 +93,7 @@ namespace Game.Networking.Packets public ObjectGuid Guid; public uint MarketID; - public ItemInstance Item = new ItemInstance(); + public ItemInstance Item = new(); public ulong BidAmount; } diff --git a/Source/Game/Networking/Packets/CalendarPackets.cs b/Source/Game/Networking/Packets/CalendarPackets.cs index 2f58a8162..ddc52a2b5 100644 --- a/Source/Game/Networking/Packets/CalendarPackets.cs +++ b/Source/Game/Networking/Packets/CalendarPackets.cs @@ -71,7 +71,7 @@ namespace Game.Networking.Packets } public uint MaxSize = 100; - public CalendarAddEventInfo EventInfo = new CalendarAddEventInfo(); + public CalendarAddEventInfo EventInfo = new(); } class CalendarUpdateEvent : ClientPacket @@ -174,9 +174,9 @@ namespace Game.Networking.Packets } public long ServerTime; - public List Invites = new List(); - public List RaidLockouts = new List(); - public List Events = new List(); + public List Invites = new(); + public List RaidLockouts = new(); + public List Events = new(); } class CalendarSendEvent : ServerPacket @@ -218,7 +218,7 @@ namespace Game.Networking.Packets public CalendarSendEventType EventType; public string Description; public string EventName; - public List Invites = new List(); + public List Invites = new(); } class CalendarInviteAlert : ServerPacket @@ -653,7 +653,7 @@ namespace Game.Networking.Packets } } - public List Invites = new List(); + public List Invites = new(); } class CalendarInviteStatusAlert : ServerPacket @@ -777,7 +777,7 @@ namespace Game.Networking.Packets for (var i = 0; i < InviteCount; ++i) { - CalendarAddEventInviteInfo invite = new CalendarAddEventInviteInfo(); + CalendarAddEventInviteInfo invite = new(); invite.Read(data); Invites[i] = invite; } diff --git a/Source/Game/Networking/Packets/CharacterPackets.cs b/Source/Game/Networking/Packets/CharacterPackets.cs index 2a73d2854..1f69b4f57 100644 --- a/Source/Game/Networking/Packets/CharacterPackets.cs +++ b/Source/Game/Networking/Packets/CharacterPackets.cs @@ -72,11 +72,11 @@ namespace Game.Networking.Packets public bool IsAlliedRacesCreationAllowed; public int MaxCharacterLevel = 1; - public Optional DisabledClassesMask = new Optional(); + public Optional DisabledClassesMask = new(); - public List Characters = new List(); // all characters on the list - public List RaceUnlockData = new List(); // - public List UnlockedConditionalAppearances = new List(); + public List Characters = new(); // all characters on the list + public List RaceUnlockData = new(); // + public List UnlockedConditionalAppearances = new(); public class CharacterInfo { @@ -141,7 +141,7 @@ namespace Game.Networking.Packets ProfessionIds[0] = 0; ProfessionIds[1] = 0; - StringArguments equipment = new StringArguments(fields.Read(17)); + StringArguments equipment = new(fields.Read(17)); ListPosition = fields.Read(19); LastPlayedTime = fields.Read(20); @@ -230,7 +230,7 @@ namespace Game.Networking.Packets public byte RaceId; public Class ClassId; public byte SexId; - public Array Customizations = new Array(50); + public Array Customizations = new(50); public byte ExperienceLevel; public uint ZoneId; public uint MapId; @@ -253,8 +253,8 @@ namespace Game.Networking.Packets public bool BoostInProgress; // @todo public uint[] ProfessionIds = new uint[2]; // @todo public VisualItemInfo[] VisualItems = new VisualItemInfo[InventorySlots.BagEnd]; - public List MailSenders = new List(); - public List MailSenderTypes = new List(); + public List MailSenders = new(); + public List MailSenderTypes = new(); public struct VisualItemInfo { @@ -559,7 +559,7 @@ namespace Game.Networking.Packets public string Name; public byte SexID; public byte RaceID; - public Array Customizations = new Array(50); + public Array Customizations = new(50); } } @@ -870,7 +870,7 @@ namespace Game.Networking.Packets } public byte NewSex; - public Array Customizations = new Array(50); + public Array Customizations = new(50); } public class BarberShopResult : ServerPacket @@ -1021,7 +1021,7 @@ namespace Game.Networking.Packets ObjectGuid CharGUID; string CharName = ""; byte SexID; - Array Customizations = new Array(50); + Array Customizations = new(50); } class CharCustomizeFailure : ServerPacket @@ -1083,8 +1083,8 @@ namespace Game.Networking.Packets public Race RaceId = Race.None; public Class ClassId = Class.None; public Gender Sex = Gender.None; - public Array Customizations = new Array(50); - public Optional TemplateSet = new Optional(); + public Array Customizations = new(50); + public Optional TemplateSet = new(); public bool IsTrialBoost; public bool UseNPE; public string Name; @@ -1104,7 +1104,7 @@ namespace Game.Networking.Packets public ObjectGuid CharGUID; public Gender SexID = Gender.None; public string CharName; - public Array Customizations = new Array(50); + public Array Customizations = new(50); } public class CharRaceOrFactionChangeInfo @@ -1114,7 +1114,7 @@ namespace Game.Networking.Packets public ObjectGuid Guid; public bool FactionChange; public string Name; - public Array Customizations = new Array(50); + public Array Customizations = new(50); } public class CharacterUndeleteInfo diff --git a/Source/Game/Networking/Packets/ChatPackets.cs b/Source/Game/Networking/Packets/ChatPackets.cs index 44fdec984..1195a1d91 100644 --- a/Source/Game/Networking/Packets/ChatPackets.cs +++ b/Source/Game/Networking/Packets/ChatPackets.cs @@ -83,7 +83,7 @@ namespace Game.Networking.Packets Params.Read(_worldPacket); } - public ChatAddonMessageParams Params = new ChatAddonMessageParams(); + public ChatAddonMessageParams Params = new(); } class ChatAddonMessageTargeted : ClientPacket @@ -98,7 +98,7 @@ namespace Game.Networking.Packets } public string Target; - public ChatAddonMessageParams Params = new ChatAddonMessageParams(); + public ChatAddonMessageParams Params = new(); } public class ChatMessageDND : ClientPacket diff --git a/Source/Game/Networking/Packets/ClientConfigPackets.cs b/Source/Game/Networking/Packets/ClientConfigPackets.cs index 2a5be7453..b258afc10 100644 --- a/Source/Game/Networking/Packets/ClientConfigPackets.cs +++ b/Source/Game/Networking/Packets/ClientConfigPackets.cs @@ -36,7 +36,7 @@ namespace Game.Networking.Packets public ObjectGuid PlayerGuid; public uint ServerTime = 0; - public Array AccountTimes = new Array((int)AccountDataTypes.Max); + public Array AccountTimes = new((int)AccountDataTypes.Max); } public class ClientCacheVersion : ServerPacket diff --git a/Source/Game/Networking/Packets/CombatLogPackets.cs b/Source/Game/Networking/Packets/CombatLogPackets.cs index 716ca6c8c..2ea25281c 100644 --- a/Source/Game/Networking/Packets/CombatLogPackets.cs +++ b/Source/Game/Networking/Packets/CombatLogPackets.cs @@ -101,7 +101,7 @@ namespace Game.Networking.Packets public int Absorbed; public int Flags; // Optional DebugInfo; - public Optional ContentTuning = new Optional(); + public Optional ContentTuning = new(); } class EnvironmentalDamageLog : CombatLogServerPacket @@ -188,18 +188,18 @@ namespace Game.Networking.Packets public ObjectGuid Caster; public uint SpellID; - public List Effects = new List(); + public List Effects = new(); public class SpellLogEffect { public int Effect; - public List PowerDrainTargets = new List(); - public List ExtraAttacksTargets = new List(); - public List DurabilityDamageTargets = new List(); - public List GenericVictimTargets = new List(); - public List TradeSkillTargets = new List(); - public List FeedPetTargets = new List(); + public List PowerDrainTargets = new(); + public List ExtraAttacksTargets = new(); + public List DurabilityDamageTargets = new(); + public List GenericVictimTargets = new(); + public List TradeSkillTargets = new(); + public List FeedPetTargets = new(); } } @@ -248,7 +248,7 @@ namespace Game.Networking.Packets public bool Crit; public Optional CritRollMade; public Optional CritRollNeeded; - Optional ContentTuning = new Optional(); + Optional ContentTuning = new(); } class SpellPeriodicAuraLog : CombatLogServerPacket @@ -272,7 +272,7 @@ namespace Game.Networking.Packets public ObjectGuid TargetGUID; public ObjectGuid CasterGUID; public uint SpellID; - public List Effects = new List(); + public List Effects = new(); public struct PeriodicalAuraLogEffectDebugInfo { @@ -316,7 +316,7 @@ namespace Game.Networking.Packets public uint Resisted; public bool Crit; public Optional DebugInfo; - public Optional ContentTuning = new Optional(); + public Optional ContentTuning = new(); } } @@ -366,7 +366,7 @@ namespace Game.Networking.Packets } } - public List DispellData = new List(); + public List DispellData = new(); public ObjectGuid CasterGUID; public ObjectGuid TargetGUID; public uint DispelledBySpellID; @@ -434,7 +434,7 @@ namespace Game.Networking.Packets public uint SpellID; public ObjectGuid Caster; - public List Entries = new List(); + public List Entries = new(); } class ProcResist : ServerPacket @@ -522,7 +522,7 @@ namespace Game.Networking.Packets public override void Write() { - WorldPacket attackRoundInfo = new WorldPacket(); + WorldPacket attackRoundInfo = new(); attackRoundInfo.WriteUInt32((uint)hitInfo); attackRoundInfo.WritePackedGuid(AttackerGUID); attackRoundInfo.WritePackedGuid(VictimGUID); @@ -605,7 +605,7 @@ namespace Game.Networking.Packets public int RageGained; public UnkAttackerState UnkState; public float Unk; - public ContentTuningParams ContentTuning = new ContentTuningParams(); + public ContentTuningParams ContentTuning = new(); } //Structs diff --git a/Source/Game/Networking/Packets/CombatPackets.cs b/Source/Game/Networking/Packets/CombatPackets.cs index 1f47aee32..9241fa9f7 100644 --- a/Source/Game/Networking/Packets/CombatPackets.cs +++ b/Source/Game/Networking/Packets/CombatPackets.cs @@ -111,7 +111,7 @@ namespace Game.Networking.Packets } public ObjectGuid UnitGUID; - public List ThreatList = new List(); + public List ThreatList = new(); } public class HighestThreatUpdate : ServerPacket @@ -131,7 +131,7 @@ namespace Game.Networking.Packets } public ObjectGuid UnitGUID; - public List ThreatList = new List(); + public List ThreatList = new(); public ObjectGuid HighestThreatGUID; } diff --git a/Source/Game/Networking/Packets/EquipmentPackets.cs b/Source/Game/Networking/Packets/EquipmentPackets.cs index 9dac10268..250d39d50 100644 --- a/Source/Game/Networking/Packets/EquipmentPackets.cs +++ b/Source/Game/Networking/Packets/EquipmentPackets.cs @@ -77,7 +77,7 @@ namespace Game.Networking.Packets } } - public List SetData = new List(); + public List SetData = new(); } public class SaveEquipmentSet : ClientPacket diff --git a/Source/Game/Networking/Packets/GarrisonPackets.cs b/Source/Game/Networking/Packets/GarrisonPackets.cs index 176410476..f17554947 100644 --- a/Source/Game/Networking/Packets/GarrisonPackets.cs +++ b/Source/Game/Networking/Packets/GarrisonPackets.cs @@ -77,8 +77,8 @@ namespace Game.Networking.Packets } public uint FactionIndex; - public List Garrisons = new List(); - public List FollowerSoftCaps = new List(); + public List Garrisons = new(); + public List FollowerSoftCaps = new(); } class GarrisonRemoteInfo : ServerPacket @@ -92,7 +92,7 @@ namespace Game.Networking.Packets site.Write(_worldPacket); } - public List Sites = new List(); + public List Sites = new(); } class GarrisonPurchaseBuilding : ClientPacket @@ -126,7 +126,7 @@ namespace Game.Networking.Packets public GarrisonType GarrTypeID; public GarrisonError Result; - public GarrisonBuildingInfo BuildingInfo = new GarrisonBuildingInfo(); + public GarrisonBuildingInfo BuildingInfo = new(); public bool PlayActivationCinematic; } @@ -242,7 +242,7 @@ namespace Game.Networking.Packets landmark.Write(_worldPacket); } - public List Buildings = new List(); + public List Buildings = new(); } class GarrisonPlotPlaced : ServerPacket @@ -391,7 +391,7 @@ namespace Game.Networking.Packets public uint Durability; public uint CurrentBuildingID; public uint CurrentMissionID; - public List AbilityID = new List(); + public List AbilityID = new(); public uint ZoneSupportSpellID; public uint FollowerStatus; public int Health; @@ -519,7 +519,7 @@ namespace Game.Networking.Packets class GarrisonCollection { public int Type; - public List Entries = new List(); + public List Entries = new(); public void Write(WorldPacket data) { @@ -545,7 +545,7 @@ namespace Game.Networking.Packets class GarrisonEventList { public int Type; - public List Events = new List(); + public List Events = new(); public void Write(WorldPacket data) { @@ -634,19 +634,19 @@ namespace Game.Networking.Packets public uint GarrSiteLevelID; public uint NumFollowerActivationsRemaining; public uint NumMissionsStartedToday; // might mean something else, but sending 0 here enables follower abilities "Increase success chance of the first mission of the day by %." - public List Plots = new List(); - public List Buildings = new List(); - public List Followers = new List(); - public List AutoTroops = new List(); - public List Missions = new List(); - public List> MissionRewards = new List>(); - public List> MissionOvermaxRewards = new List>(); - public List MissionAreaBonuses = new List(); - public List Talents = new List(); - public List Collections = new List(); - public List EventLists = new List(); - public List CanStartMission = new List(); - public List ArchivedMissions = new List(); + public List Plots = new(); + public List Buildings = new(); + public List Followers = new(); + public List AutoTroops = new(); + public List Missions = new(); + public List> MissionRewards = new(); + public List> MissionOvermaxRewards = new(); + public List MissionAreaBonuses = new(); + public List Talents = new(); + public List Collections = new(); + public List EventLists = new(); + public List CanStartMission = new(); + public List ArchivedMissions = new(); } struct FollowerSoftCapInfo @@ -690,7 +690,7 @@ namespace Game.Networking.Packets } public uint GarrSiteLevelID; - public List Buildings = new List(); + public List Buildings = new(); } struct GarrisonBuildingMapData diff --git a/Source/Game/Networking/Packets/GuildFinderPackets.cs b/Source/Game/Networking/Packets/GuildFinderPackets.cs index 6c51b96cb..2f4c5344e 100644 --- a/Source/Game/Networking/Packets/GuildFinderPackets.cs +++ b/Source/Game/Networking/Packets/GuildFinderPackets.cs @@ -86,7 +86,7 @@ namespace Game.Networking.Packets guildData.Write(_worldPacket); } - public List Post = new List(); + public List Post = new(); } class LFGuildDeclineRecruit : ClientPacket @@ -120,7 +120,7 @@ namespace Game.Networking.Packets application.Write(_worldPacket); } - public List Application = new List(); + public List Application = new(); public int NumRemaining; } @@ -170,7 +170,7 @@ namespace Game.Networking.Packets recruit.Write(_worldPacket); } - public List Recruits = new List(); + public List Recruits = new(); public long UpdateTime; } diff --git a/Source/Game/Networking/Packets/GuildPackets.cs b/Source/Game/Networking/Packets/GuildPackets.cs index 36c99ad79..4636e7851 100644 --- a/Source/Game/Networking/Packets/GuildPackets.cs +++ b/Source/Game/Networking/Packets/GuildPackets.cs @@ -77,7 +77,7 @@ namespace Game.Networking.Packets public ObjectGuid GuildGUID; public ObjectGuid PlayerGuid; - public GuildInfo Info = new GuildInfo(); + public GuildInfo Info = new(); public bool HasGuildInfo; public class GuildInfo @@ -91,7 +91,7 @@ namespace Game.Networking.Packets public uint BorderStyle; public uint BorderColor; public uint BackgroundColor; - public List Ranks = new List(); + public List Ranks = new(); public string GuildName = ""; public struct RankInfo @@ -1362,7 +1362,7 @@ namespace Game.Networking.Packets AchievementIDs.Add(_worldPacket.ReadUInt32()); } - public List AchievementIDs = new List(); + public List AchievementIDs = new(); } class GuildNameChanged : ServerPacket @@ -1504,7 +1504,7 @@ namespace Game.Networking.Packets public uint ItemID; public uint Unk4; - public List AchievementsRequired = new List(); + public List AchievementsRequired = new(); public ulong RaceMask; public int MinGuildLevel; public int MinGuildRep; @@ -1521,7 +1521,7 @@ namespace Game.Networking.Packets public int OnUseEnchantmentID; public uint Flags; public bool Locked; - public List SocketEnchant = new List(); + public List SocketEnchant = new(); } public struct GuildBankTabInfo @@ -1573,7 +1573,7 @@ namespace Game.Networking.Packets public int Flags; public int[] Data = new int[2]; public ObjectGuid MemberGuid; - public List MemberList = new List(); + public List MemberList = new(); public Optional Item; } } diff --git a/Source/Game/Networking/Packets/HotfixPackets.cs b/Source/Game/Networking/Packets/HotfixPackets.cs index 07fdcde68..e8a234a77 100644 --- a/Source/Game/Networking/Packets/HotfixPackets.cs +++ b/Source/Game/Networking/Packets/HotfixPackets.cs @@ -41,7 +41,7 @@ namespace Game.Networking.Packets } public uint TableHash; - public List Queries = new List(); + public List Queries = new(); public struct DBQueryRecord { @@ -73,7 +73,7 @@ namespace Game.Networking.Packets public uint RecordID; public HotfixRecord.Status Status = HotfixRecord.Status.Invalid; - public ByteBuffer Data = new ByteBuffer(); + public ByteBuffer Data = new(); } class AvailableHotfixes : ServerPacket @@ -111,7 +111,7 @@ namespace Game.Networking.Packets uint hotfixCount = _worldPacket.ReadUInt32(); for (var i = 0; i < hotfixCount; ++i) { - HotfixRecord hotfixRecord = new HotfixRecord(); + HotfixRecord hotfixRecord = new(); hotfixRecord.Read(_worldPacket); Hotfixes.Add(hotfixRecord); } @@ -119,7 +119,7 @@ namespace Game.Networking.Packets public uint ClientBuild; public uint DataBuild; - public List Hotfixes = new List(); + public List Hotfixes = new(); } class HotfixConnect : ServerPacket @@ -136,8 +136,8 @@ namespace Game.Networking.Packets _worldPacket.WriteBytes(HotfixContent); } - public List Hotfixes = new List(); - public ByteBuffer HotfixContent = new ByteBuffer(); + public List Hotfixes = new(); + public ByteBuffer HotfixContent = new(); public class HotfixData { @@ -149,7 +149,7 @@ namespace Game.Networking.Packets data.FlushBits(); } - public HotfixRecord Record = new HotfixRecord(); + public HotfixRecord Record = new(); public uint Size; } } diff --git a/Source/Game/Networking/Packets/InspectPackets.cs b/Source/Game/Networking/Packets/InspectPackets.cs index 1e476c2bb..b58bda167 100644 --- a/Source/Game/Networking/Packets/InspectPackets.cs +++ b/Source/Game/Networking/Packets/InspectPackets.cs @@ -79,11 +79,11 @@ namespace Game.Networking.Packets } public PlayerModelDisplayInfo DisplayInfo; - public List Glyphs = new List(); - public List Talents = new List(); - public Array PvpTalents = new Array(PlayerConst.MaxPvpTalentSlots, 0); - public Optional GuildData = new Optional(); - public Array Bracket = new Array(6, default); + public List Glyphs = new(); + public List Talents = new(); + public Array PvpTalents = new(PlayerConst.MaxPvpTalentSlots, 0); + public Optional GuildData = new(); + public Array Bracket = new(6, default); public uint? AzeriteLevel; public int ItemLevel; public uint LifetimeHK; @@ -149,7 +149,7 @@ namespace Game.Networking.Packets { if (gemData.ItemId != 0) { - ItemGemData gem = new ItemGemData(); + ItemGemData gem = new(); gem.Slot = i; gem.Item = new ItemInstance(gemData); Gems.Add(gem); @@ -165,7 +165,7 @@ namespace Game.Networking.Packets { for (byte slot = 0; slot < essences.AzeriteEssenceID.GetSize(); ++slot) { - AzeriteEssenceData essence = new AzeriteEssenceData(); + AzeriteEssenceData essence = new(); essence.Index = slot; essence.AzeriteEssenceID = essences.AzeriteEssenceID[slot]; if (essence.AzeriteEssenceID != 0) @@ -211,22 +211,22 @@ namespace Game.Networking.Packets public ItemInstance Item; public byte Index; public bool Usable; - public List Enchants = new List(); - public List Gems = new List(); - public List AzeritePowers = new List(); - public List AzeriteEssences = new List(); + public List Enchants = new(); + public List Gems = new(); + public List AzeritePowers = new(); + public List AzeriteEssences = new(); } public class PlayerModelDisplayInfo { public ObjectGuid GUID; - public List Items = new List(); + public List Items = new(); public string Name; public uint SpecializationID; public byte GenderID; public byte Race; public byte ClassID; - public List Customizations = new List(); + public List Customizations = new(); public void Initialize(Player player) { diff --git a/Source/Game/Networking/Packets/InstancePackets.cs b/Source/Game/Networking/Packets/InstancePackets.cs index 8eb1ba29d..2379d3727 100644 --- a/Source/Game/Networking/Packets/InstancePackets.cs +++ b/Source/Game/Networking/Packets/InstancePackets.cs @@ -45,7 +45,7 @@ namespace Game.Networking.Packets lockInfos.Write(_worldPacket); } - public List LockList = new List(); + public List LockList = new(); } class ResetInstances : ClientPacket diff --git a/Source/Game/Networking/Packets/ItemPackets.cs b/Source/Game/Networking/Packets/ItemPackets.cs index 7545017f6..d34895020 100644 --- a/Source/Game/Networking/Packets/ItemPackets.cs +++ b/Source/Game/Networking/Packets/ItemPackets.cs @@ -124,7 +124,7 @@ namespace Game.Networking.Packets public uint PurchaseTime; public uint Flags; - public ItemPurchaseContents Contents = new ItemPurchaseContents(); + public ItemPurchaseContents Contents = new(); public ObjectGuid ItemGUID; } @@ -731,7 +731,7 @@ namespace Game.Networking.Packets } public ItemContext Context; - public List BonusListIDs = new List(); + public List BonusListIDs = new(); } public class ItemMod @@ -790,7 +790,7 @@ namespace Game.Networking.Packets public class ItemModList { - public Array Values = new Array((int)ItemModifier.Max); + public Array Values = new((int)ItemModifier.Max); public void Read(WorldPacket data) { @@ -845,7 +845,7 @@ namespace Game.Networking.Packets { public uint ItemID; public Optional ItemBonus; - public ItemModList Modifications = new ItemModList(); + public ItemModList Modifications = new(); public ItemInstance() { } @@ -900,7 +900,7 @@ namespace Game.Networking.Packets { ItemID = gem.ItemId; - ItemBonuses bonus = new ItemBonuses(); + ItemBonuses bonus = new(); bonus.Context = (ItemContext)(byte)gem.Context; foreach (ushort bonusListId in gem.BonusListIDs) if (bonusListId != 0) @@ -1011,7 +1011,7 @@ namespace Game.Networking.Packets } public byte Slot; - public ItemInstance Item = new ItemInstance(); + public ItemInstance Item = new(); } public struct InvUpdate diff --git a/Source/Game/Networking/Packets/LFGPackets.cs b/Source/Game/Networking/Packets/LFGPackets.cs index c52cc3e25..760df805d 100644 --- a/Source/Game/Networking/Packets/LFGPackets.cs +++ b/Source/Game/Networking/Packets/LFGPackets.cs @@ -43,7 +43,7 @@ namespace Game.Networking.Packets bool Unknown; // Always false in 7.2.5 public byte PartyIndex; public LfgRoles Roles; - public List Slots = new List(); + public List Slots = new(); } class DFLeave : ClientPacket @@ -55,7 +55,7 @@ namespace Game.Networking.Packets Ticket.Read(_worldPacket); } - public RideTicket Ticket = new RideTicket(); + public RideTicket Ticket = new(); } class DFProposalResponse : ClientPacket @@ -70,7 +70,7 @@ namespace Game.Networking.Packets Accepted = _worldPacket.HasBit(); } - public RideTicket Ticket = new RideTicket(); + public RideTicket Ticket = new(); public ulong InstanceID; public uint ProposalID; public bool Accepted; @@ -148,8 +148,8 @@ namespace Game.Networking.Packets dungeonInfo.Write(_worldPacket); } - public LFGBlackList BlackList = new LFGBlackList(); - public List Dungeons = new List(); + public LFGBlackList BlackList = new(); + public List Dungeons = new(); } class LfgPartyInfo : ServerPacket @@ -163,7 +163,7 @@ namespace Game.Networking.Packets blackList.Write(_worldPacket); } - public List Player = new List(); + public List Player = new(); } class LFGUpdateStatus : ServerPacket @@ -196,12 +196,12 @@ namespace Game.Networking.Packets _worldPacket.FlushBits(); } - public RideTicket Ticket = new RideTicket(); + public RideTicket Ticket = new(); public byte SubType; public byte Reason; - public List Slots = new List(); + public List Slots = new(); public uint RequestedRoles; - public List SuspendedPlayers = new List(); + public List SuspendedPlayers = new(); public uint QueueMapID; public bool NotifyUI; public bool IsParty; @@ -257,10 +257,10 @@ namespace Game.Networking.Packets public byte PartyIndex; public byte RoleCheckStatus; - public List JoinSlots = new List(); - public List BgQueueIDs = new List(); + public List JoinSlots = new(); + public List BgQueueIDs = new(); public int GroupFinderActivityID = 0; - public List Members = new List(); + public List Members = new(); public bool IsBeginning; public bool IsRequeue; } @@ -289,11 +289,11 @@ namespace Game.Networking.Packets _worldPacket.WriteCString(str); } - public RideTicket Ticket = new RideTicket(); + public RideTicket Ticket = new(); public byte Result; public byte ResultDetail; - public List BlackList = new List(); - public List BlackListNames = new List(); + public List BlackList = new(); + public List BlackListNames = new(); } class LFGQueueStatus : ServerPacket @@ -346,7 +346,7 @@ namespace Game.Networking.Packets public uint ActualSlot; public uint RewardMoney; public uint AddedXP; - public List Rewards = new List(); + public List Rewards = new(); } class LfgBootPlayer : ServerPacket @@ -358,7 +358,7 @@ namespace Game.Networking.Packets Info.Write(_worldPacket); } - public LfgBootInfo Info = new LfgBootInfo(); + public LfgBootInfo Info = new(); } class LFGProposalUpdate : ServerPacket @@ -397,7 +397,7 @@ namespace Game.Networking.Packets public bool ValidCompletedMask; public bool ProposalSilent; public bool IsRequeue; - public List Players = new List(); + public List Players = new(); } class LfgDisabled : ServerPacket @@ -469,7 +469,7 @@ namespace Game.Networking.Packets public class LFGBlackList { public Optional PlayerGuid; - public List Slot = new List(); + public List Slot = new(); public void Write(WorldPacket data) { @@ -561,9 +561,9 @@ namespace Game.Networking.Packets public uint Mask; public uint RewardMoney; public uint RewardXP; - public List Item = new List(); - public List Currency = new List(); - public List BonusCurrency = new List(); + public List Item = new(); + public List Currency = new(); + public List BonusCurrency = new(); public Optional RewardSpellID; // Only used by SMSG_LFG_PLAYER_INFO public Optional Unused1; public Optional Unused2; @@ -616,8 +616,8 @@ namespace Game.Networking.Packets public uint EncounterMask; public bool FirstReward; public bool ShortageEligible; - public LfgPlayerQuestReward Rewards = new LfgPlayerQuestReward(); - public List ShortageReward = new List(); + public LfgPlayerQuestReward Rewards = new(); + public List ShortageReward = new(); } public class LFGRoleCheckUpdateMember @@ -660,7 +660,7 @@ namespace Game.Networking.Packets } public Optional PlayerGuid; - public List Slot = new List(); + public List Slot = new(); } public struct LFGPlayerRewards diff --git a/Source/Game/Networking/Packets/LootPackets.cs b/Source/Game/Networking/Packets/LootPackets.cs index 4be859a13..b58761e57 100644 --- a/Source/Game/Networking/Packets/LootPackets.cs +++ b/Source/Game/Networking/Packets/LootPackets.cs @@ -73,8 +73,8 @@ namespace Game.Networking.Packets public byte AcquireReason; public LootError FailureReason = LootError.NoLoot; // Most common value public uint Coins; - public List Items = new List(); - public List Currencies = new List(); + public List Items = new(); + public List Currencies = new(); public bool Acquired; public bool AELooting; } @@ -99,7 +99,7 @@ namespace Game.Networking.Packets } } - public List Loot = new List(); + public List Loot = new(); } class MasterLootItem : ClientPacket @@ -113,14 +113,14 @@ namespace Game.Networking.Packets for (int i = 0; i < Count; ++i) { - LootRequest lootRequest = new LootRequest(); + LootRequest lootRequest = new(); lootRequest.Object = _worldPacket.ReadPackedGuid(); lootRequest.LootListID = _worldPacket.ReadUInt8(); Loot[i] = lootRequest; } } - public Array Loot = new Array(1000); + public Array Loot = new(1000); public ObjectGuid Target; } @@ -282,7 +282,7 @@ namespace Game.Networking.Packets public uint RollTime; public LootMethod Method; public RollMask ValidRolls; - public LootItemData Item = new LootItemData(); + public LootItemData Item = new(); } class LootRollBroadcast : ServerPacket @@ -304,7 +304,7 @@ namespace Game.Networking.Packets public ObjectGuid Player; public int Roll; // Roll value can be negative, it means that it is an "offspec" roll but only during roll selection broadcast (not when sending the result) public RollType RollType; - public LootItemData Item = new LootItemData(); + public LootItemData Item = new(); public bool Autopassed; // Triggers message |HlootHistory:%d|h[Loot]|h: You automatically passed on: %s because you cannot loot that item. } @@ -327,7 +327,7 @@ namespace Game.Networking.Packets public ObjectGuid Winner; public int Roll; public RollType RollType; - public LootItemData Item = new LootItemData(); + public LootItemData Item = new(); public bool MainSpec; } @@ -342,7 +342,7 @@ namespace Game.Networking.Packets } public ObjectGuid LootObj; - public LootItemData Item = new LootItemData(); + public LootItemData Item = new(); } class LootRollsComplete : ServerPacket @@ -370,7 +370,7 @@ namespace Game.Networking.Packets Players.ForEach(guid => _worldPacket.WritePackedGuid(guid)); } - public List Players = new List(); + public List Players = new(); public ObjectGuid LootObj; } diff --git a/Source/Game/Networking/Packets/MailPackets.cs b/Source/Game/Networking/Packets/MailPackets.cs index bc40e6639..6935c78f8 100644 --- a/Source/Game/Networking/Packets/MailPackets.cs +++ b/Source/Game/Networking/Packets/MailPackets.cs @@ -49,7 +49,7 @@ namespace Game.Networking.Packets } public int TotalNumRecords; - public List Mails = new List(); + public List Mails = new(); } public class MailCreateTextItem : ClientPacket @@ -113,7 +113,7 @@ namespace Game.Networking.Packets public string Target; public string Subject; public string Body; - public List Attachments = new List(); + public List Attachments = new(); public struct MailAttachment { @@ -334,7 +334,7 @@ namespace Game.Networking.Packets { if (gemData.ItemId != 0) { - ItemGemData gem = new ItemGemData(); + ItemGemData gem = new(); gem.Slot = i; gem.Item = new ItemInstance(gemData); Gems.Add(gem); @@ -372,8 +372,8 @@ namespace Game.Networking.Packets public uint MaxDurability; public uint Durability; public bool Unlocked; - List Enchants = new List(); - List Gems= new List(); + List Enchants = new(); + List Gems= new(); } public class MailListEntry @@ -455,6 +455,6 @@ namespace Game.Networking.Packets public int MailTemplateID; public string Subject = ""; public string Body = ""; - public List Attachments = new List(); + public List Attachments = new(); } } diff --git a/Source/Game/Networking/Packets/MiscPackets.cs b/Source/Game/Networking/Packets/MiscPackets.cs index bd43553db..4b0415548 100644 --- a/Source/Game/Networking/Packets/MiscPackets.cs +++ b/Source/Game/Networking/Packets/MiscPackets.cs @@ -226,7 +226,7 @@ namespace Game.Networking.Packets } } - public List Data = new List(); + public List Data = new(); public struct Record { @@ -534,7 +534,7 @@ namespace Game.Networking.Packets } public bool IsGossipTriggered; - public List CemeteryID = new List(); + public List CemeteryID = new(); } public class ResurrectResponse : ClientPacket @@ -809,10 +809,10 @@ namespace Game.Networking.Packets } public ObjectGuid Client; - public PhaseShiftData Phaseshift = new PhaseShiftData(); - public List PreloadMapIDs = new List(); - public List UiMapPhaseIDs = new List(); - public List VisibleMapIDs = new List(); + public PhaseShiftData Phaseshift = new(); + public List PreloadMapIDs = new(); + public List UiMapPhaseIDs = new(); + public List VisibleMapIDs = new(); } public class ZoneUnderAttack : ServerPacket @@ -971,7 +971,7 @@ namespace Game.Networking.Packets uint count = _worldPacket.ReadUInt32(); for (byte i = 0; i < count && i < PlayerConst.MaxCUFProfiles; i++) { - CUFProfile cufProfile = new CUFProfile(); + CUFProfile cufProfile = new(); byte strLen = _worldPacket.ReadBits(7); @@ -1000,7 +1000,7 @@ namespace Game.Networking.Packets } } - public List CUFProfiles = new List(); + public List CUFProfiles = new(); } class LoadCUFProfiles : ServerPacket @@ -1038,7 +1038,7 @@ namespace Game.Networking.Packets } } - public List CUFProfiles = new List(); + public List CUFProfiles = new(); } class PlayOneShotAnimKit : ServerPacket @@ -1154,7 +1154,7 @@ namespace Game.Networking.Packets } public bool IsFullUpdate; - public Dictionary Heirlooms = new Dictionary(); + public Dictionary Heirlooms = new(); int Unk; } @@ -1292,7 +1292,7 @@ namespace Game.Networking.Packets } public bool IsFullUpdate = false; - public Dictionary Mounts = new Dictionary(); + public Dictionary Mounts = new(); } class MountSetFavorite : ClientPacket @@ -1352,7 +1352,7 @@ namespace Game.Networking.Packets } public uint PhaseShiftFlags; - public List Phases = new List(); + public List Phases = new(); public ObjectGuid PersonalGUID; } } diff --git a/Source/Game/Networking/Packets/MovementPackets.cs b/Source/Game/Networking/Packets/MovementPackets.cs index 8e4153a8c..25f19754c 100644 --- a/Source/Game/Networking/Packets/MovementPackets.cs +++ b/Source/Game/Networking/Packets/MovementPackets.cs @@ -297,7 +297,7 @@ namespace Game.Networking.Packets Vector3 direction = Vector3.Zero; if (movementForce.Magnitude != 0.0f) { - Position tmp = new Position(movementForce.Origin.X - objectPosition.GetPositionX(), + Position tmp = new(movementForce.Origin.X - objectPosition.GetPositionX(), movementForce.Origin.Y - objectPosition.GetPositionY(), movementForce.Origin.Z - objectPosition.GetPositionZ()); float lengthSquared = tmp.GetExactDistSq(0.0f, 0.0f, 0.0f); @@ -591,7 +591,7 @@ namespace Game.Networking.Packets public uint MapID; public uint Reason; - public TeleportLocation Loc = new TeleportLocation(); + public TeleportLocation Loc = new(); public Position MovementOffset; // Adjusts all pending movement events by this offset } @@ -730,8 +730,8 @@ namespace Game.Networking.Packets Force.Read(_worldPacket); } - public MovementAck Ack = new MovementAck(); - public MovementForce Force = new MovementForce(); + public MovementAck Ack = new(); + public MovementForce Force = new(); } class MoveRemoveMovementForce : ServerPacket @@ -760,7 +760,7 @@ namespace Game.Networking.Packets ID = _worldPacket.ReadPackedGuid(); } - public MovementAck Ack = new MovementAck(); + public MovementAck Ack = new(); public ObjectGuid ID; } @@ -774,8 +774,8 @@ namespace Game.Networking.Packets Force.Write(_worldPacket); } - public MovementInfo Status = new MovementInfo(); - public MovementForce Force = new MovementForce(); + public MovementInfo Status = new(); + public MovementForce Force = new(); } class MoveUpdateRemoveMovementForce : ServerPacket @@ -788,7 +788,7 @@ namespace Game.Networking.Packets _worldPacket.WritePackedGuid(TriggerGUID); } - public MovementInfo Status = new MovementInfo(); + public MovementInfo Status = new(); public ObjectGuid TriggerGUID; } @@ -1103,7 +1103,7 @@ namespace Game.Networking.Packets } public ObjectGuid MoverGUID; - public List StateChanges = new List(); + public List StateChanges = new(); public struct CollisionHeightInfo { @@ -1221,7 +1221,7 @@ namespace Game.Networking.Packets data.FlushBits(); } - public List FilterKeys = new List(); + public List FilterKeys = new(); public byte FilterFlags; public float BaseSpeed; public short StartOffset; @@ -1279,7 +1279,7 @@ namespace Game.Networking.Packets public class MonsterSplineUnknown901 { - public Array Data = new Array(16); + public Array Data = new(16); public void Write(WorldPacket data) { @@ -1379,13 +1379,13 @@ namespace Game.Networking.Packets public int Elapsed; public uint MoveTime; public uint FadeObjectTime; - public List Points = new List(); // Spline path + public List Points = new(); // Spline path public byte Mode; // Spline mode - actually always 0 in this packet - Catmullrom mode appears only in SMSG_UPDATE_OBJECT. In this packet it is determined by flags public bool VehicleExitVoluntary; public bool Interpolate; public ObjectGuid TransportGUID; public sbyte VehicleSeat = -1; - public List PackedDeltas = new List(); + public List PackedDeltas = new(); public Optional SplineFilter; public Optional SpellEffectExtraData; public Optional JumpExtraData; diff --git a/Source/Game/Networking/Packets/NPCPackets.cs b/Source/Game/Networking/Packets/NPCPackets.cs index 0e546acec..f985ff61d 100644 --- a/Source/Game/Networking/Packets/NPCPackets.cs +++ b/Source/Game/Networking/Packets/NPCPackets.cs @@ -83,10 +83,10 @@ namespace Game.Networking.Packets text.Write(_worldPacket); } - public List GossipOptions = new List(); + public List GossipOptions = new(); public int FriendshipFactionID; public ObjectGuid GossipGUID; - public List GossipText = new List(); + public List GossipText = new(); public int TextID; public int GossipID; } @@ -133,7 +133,7 @@ namespace Game.Networking.Packets } public byte Reason = 0; - public List Items = new List(); + public List Items = new(); public ObjectGuid Vendor; } @@ -170,7 +170,7 @@ namespace Game.Networking.Packets public ObjectGuid TrainerGUID; public int TrainerType; public int TrainerID = 1; - public List Spells = new List(); + public List Spells = new(); public string Greeting; } @@ -308,7 +308,7 @@ namespace Game.Networking.Packets public class TreasureLootList { - public List Items = new List(); + public List Items = new(); public void Write(WorldPacket data) { @@ -327,7 +327,7 @@ namespace Game.Networking.Packets public GossipOptionStatus Status; public string Text; public string Confirm; - public TreasureLootList Treasure = new TreasureLootList(); + public TreasureLootList Treasure = new(); public Optional SpellID; } @@ -378,7 +378,7 @@ namespace Game.Networking.Packets public int MuID; public int Type; - public ItemInstance Item = new ItemInstance(); + public ItemInstance Item = new(); public int Quantity = -1; public ulong Price; public int Durability; diff --git a/Source/Game/Networking/Packets/PartyPackets.cs b/Source/Game/Networking/Packets/PartyPackets.cs index f033eb49f..0f13b5d81 100644 --- a/Source/Game/Networking/Packets/PartyPackets.cs +++ b/Source/Game/Networking/Packets/PartyPackets.cs @@ -134,7 +134,7 @@ namespace Game.Networking.Packets // Lfg public uint ProposedRoles; public int LfgCompletedMask; - public List LfgSlots = new List(); + public List LfgSlots = new(); } class PartyInviteResponse : ClientPacket @@ -290,7 +290,7 @@ namespace Game.Networking.Packets // Auras foreach (AuraApplication aurApp in player.GetVisibleAuras()) { - PartyMemberAuraStates aura = new PartyMemberAuraStates(); + PartyMemberAuraStates aura = new(); aura.SpellID = (int)aurApp.GetBase().GetId(); aura.ActiveFlags = aurApp.GetEffectMask(); aura.Flags = (byte)aurApp.GetFlags(); @@ -329,7 +329,7 @@ namespace Game.Networking.Packets foreach (AuraApplication aurApp in pet.GetVisibleAuras()) { - PartyMemberAuraStates aura = new PartyMemberAuraStates(); + PartyMemberAuraStates aura = new(); aura.SpellID = (int)aurApp.GetBase().GetId(); aura.ActiveFlags = aurApp.GetEffectMask(); @@ -355,7 +355,7 @@ namespace Game.Networking.Packets public bool ForEnemy; public ObjectGuid MemberGuid; - public PartyMemberStats MemberStats = new PartyMemberStats(); + public PartyMemberStats MemberStats = new(); } class SetPartyLeader : ClientPacket @@ -529,7 +529,7 @@ namespace Game.Networking.Packets } public sbyte PartyIndex; - public Dictionary TargetIcons = new Dictionary(); + public Dictionary TargetIcons = new(); } class ConvertRaid : ClientPacket @@ -768,7 +768,7 @@ namespace Game.Networking.Packets public int MyIndex; public int SequenceNum; - public List PlayerList = new List(); + public List PlayerList = new(); public Optional LfgInfos; public Optional LootSettings; @@ -856,7 +856,7 @@ namespace Game.Networking.Packets public sbyte PartyIndex; public uint ActiveMarkers; - public List RaidMarkers = new List(); + public List RaidMarkers = new(); } class PartyKillLog : ServerPacket @@ -906,7 +906,7 @@ namespace Game.Networking.Packets public int PhaseShiftFlags; public ObjectGuid PersonalGUID; - public List List = new List(); + public List List = new(); } class PartyMemberAuraStates @@ -914,7 +914,7 @@ namespace Game.Networking.Packets public int SpellID; public ushort Flags; public uint ActiveFlags; - public List Points = new List(); + public List Points = new(); public void Write(WorldPacket data) { @@ -950,7 +950,7 @@ namespace Game.Networking.Packets public int CurrentHealth; public int MaxHealth; - public List Auras = new List(); + public List Auras = new(); } public struct CTROptions @@ -1022,8 +1022,8 @@ namespace Game.Networking.Packets public int VehicleSeat; - public PartyMemberPhaseStates Phases = new PartyMemberPhaseStates(); - public List Auras = new List(); + public PartyMemberPhaseStates Phases = new(); + public List Auras = new(); public Optional PetStats; public ushort PowerDisplayID; diff --git a/Source/Game/Networking/Packets/PetPackets.cs b/Source/Game/Networking/Packets/PetPackets.cs index c1f03f8b6..2ccb367c8 100644 --- a/Source/Game/Networking/Packets/PetPackets.cs +++ b/Source/Game/Networking/Packets/PetPackets.cs @@ -133,9 +133,9 @@ namespace Game.Networking.Packets public uint[] ActionButtons = new uint[10]; - public List Actions = new List(); - public List Cooldowns = new List(); - public List SpellHistory = new List(); + public List Actions = new(); + public List Cooldowns = new(); + public List SpellHistory = new(); } class PetStableList : ServerPacket @@ -161,7 +161,7 @@ namespace Game.Networking.Packets } public ObjectGuid StableMaster; - public List Pets = new List(); + public List Pets = new(); } class PetStableResult : ServerPacket @@ -187,7 +187,7 @@ namespace Game.Networking.Packets _worldPacket.WriteUInt32(spell); } - public List Spells = new List(); + public List Spells = new(); } class PetUnlearnedSpells : ServerPacket @@ -201,7 +201,7 @@ namespace Game.Networking.Packets _worldPacket.WriteUInt32(spell); } - public List Spells = new List(); + public List Spells = new(); } class PetNameInvalid : ServerPacket diff --git a/Source/Game/Networking/Packets/PetitionPackets.cs b/Source/Game/Networking/Packets/PetitionPackets.cs index 9cf82d923..95a298905 100644 --- a/Source/Game/Networking/Packets/PetitionPackets.cs +++ b/Source/Game/Networking/Packets/PetitionPackets.cs @@ -341,6 +341,6 @@ namespace Game.Networking.Packets public int NumChoices; public int StaticType; public uint Muid = 0; - public StringArray Choicetext = new StringArray(10); + public StringArray Choicetext = new(10); } } diff --git a/Source/Game/Networking/Packets/QueryPackets.cs b/Source/Game/Networking/Packets/QueryPackets.cs index 07c3b9fa1..935890eac 100644 --- a/Source/Game/Networking/Packets/QueryPackets.cs +++ b/Source/Game/Networking/Packets/QueryPackets.cs @@ -188,7 +188,7 @@ namespace Game.Networking.Packets public uint PageTextID; public bool Allow; - public List Pages = new List(); + public List Pages = new(); public struct PageTextInfo { @@ -277,7 +277,7 @@ namespace Game.Networking.Packets _worldPacket.WriteBit(Allow); _worldPacket.FlushBits(); - ByteBuffer statsData = new ByteBuffer(); + ByteBuffer statsData = new(); if (Allow) { statsData.WriteUInt32(Stats.Type); @@ -432,7 +432,7 @@ namespace Game.Networking.Packets } } - public List QuestPOIDataStats = new List(); + public List QuestPOIDataStats = new(); } class QueryQuestCompletionNPCs : ClientPacket @@ -468,7 +468,7 @@ namespace Game.Networking.Packets } } - public List QuestCompletionNPCs = new List(); + public List QuestCompletionNPCs = new(); } class QueryPetName : ClientPacket @@ -514,7 +514,7 @@ namespace Game.Networking.Packets public bool Allow; public bool HasDeclined; - public DeclinedName DeclinedNames = new DeclinedName(); + public DeclinedName DeclinedNames = new(); public uint Timestamp; public string Name = ""; } @@ -595,8 +595,8 @@ namespace Game.Networking.Packets data.WriteUInt32(NativeRealmAddress.Value); } - public Optional VirtualRealmAddress = new Optional(); // current realm (?) (identifier made from the Index, BattleGroup and Region) - public Optional NativeRealmAddress = new Optional(); // original realm (?) (identifier made from the Index, BattleGroup and Region) + public Optional VirtualRealmAddress = new(); // current realm (?) (identifier made from the Index, BattleGroup and Region) + public Optional NativeRealmAddress = new(); // original realm (?) (identifier made from the Index, BattleGroup and Region) } public class PlayerGuidLookupData @@ -679,7 +679,7 @@ namespace Game.Networking.Packets public Gender Sex = Gender.None; public Class ClassID = Class.None; public byte Level; - public DeclinedName DeclinedNames = new DeclinedName(); + public DeclinedName DeclinedNames = new(); } public class CreatureXDisplay @@ -699,7 +699,7 @@ namespace Game.Networking.Packets public class CreatureDisplayStats { public float TotalProbability; - public List CreatureDisplay = new List(); + public List CreatureDisplay = new(); } public class CreatureStats @@ -710,11 +710,11 @@ namespace Game.Networking.Packets public int CreatureType; public int CreatureFamily; public int Classification; - public CreatureDisplayStats Display = new CreatureDisplayStats(); + public CreatureDisplayStats Display = new(); public float HpMulti; public float EnergyMulti; public bool Leader; - public List QuestItems = new List(); + public List QuestItems = new(); public uint CreatureMovementInfoID; public int HealthScalingExpansion; public uint RequiredExpansion; @@ -724,8 +724,8 @@ namespace Game.Networking.Packets public int WidgetSetUnitConditionID; public uint[] Flags = new uint[2]; public uint[] ProxyCreatureID = new uint[SharedConst.MaxCreatureKillCredit]; - public StringArray Name = new StringArray(SharedConst.MaxCreatureNames); - public StringArray NameAlt = new StringArray(SharedConst.MaxCreatureNames); + public StringArray Name = new(SharedConst.MaxCreatureNames); + public StringArray NameAlt = new(SharedConst.MaxCreatureNames); } public struct DBQueryRecord @@ -743,13 +743,13 @@ namespace Game.Networking.Packets public uint DisplayID; public int[] Data = new int[SharedConst.MaxGOData]; public float Size; - public List QuestItems = new List(); + public List QuestItems = new(); public uint ContentTuningId; } class QuestCompletionNPC { public uint QuestID; - public List NPCs = new List(); + public List NPCs = new(); } } diff --git a/Source/Game/Networking/Packets/QuestPackets.cs b/Source/Game/Networking/Packets/QuestPackets.cs index e7dd97a64..610398013 100644 --- a/Source/Game/Networking/Packets/QuestPackets.cs +++ b/Source/Game/Networking/Packets/QuestPackets.cs @@ -72,7 +72,7 @@ namespace Game.Networking.Packets } } - public List QuestGiver = new List(); + public List QuestGiver = new(); } public class QuestGiverHello : ClientPacket @@ -246,7 +246,7 @@ namespace Game.Networking.Packets } public bool Allow; - public QuestInfo Info = new QuestInfo(); + public QuestInfo Info = new(); public uint QuestID; } @@ -387,7 +387,7 @@ namespace Game.Networking.Packets public bool LaunchGossip; public bool LaunchQuest; public bool HideChatMessage; - public ItemInstance ItemReward = new ItemInstance(); + public ItemInstance ItemReward = new(); } public class QuestGiverCompleteQuest : ClientPacket @@ -487,10 +487,10 @@ namespace Game.Networking.Packets public int QuestPackageID; public uint[] QuestFlags = new uint[2]; public uint SuggestedPartyMembers; - public QuestRewards Rewards = new QuestRewards(); - public List Objectives = new List(); - public List DescEmotes = new List(); - public List LearnSpells = new List(); + public QuestRewards Rewards = new(); + public List Objectives = new(); + public List DescEmotes = new(); + public List LearnSpells = new(); public uint PortraitTurnIn; public uint PortraitGiver; public uint PortraitGiverMount; @@ -557,8 +557,8 @@ namespace Game.Networking.Packets public bool AutoLaunched; public uint SuggestPartyMembers; public int MoneyToGet; - public List Collect = new List(); - public List Currency = new List(); + public List Collect = new(); + public List Currency = new(); public int StatusFlags; public uint[] QuestFlags = new uint[2]; public string QuestTitle = ""; @@ -645,7 +645,7 @@ namespace Game.Networking.Packets public ObjectGuid QuestGiverGUID; public uint GreetEmoteDelay; public uint GreetEmoteType; - public List QuestDataText = new List(); + public List QuestDataText = new(); public string Greeting = ""; } @@ -825,7 +825,7 @@ namespace Game.Networking.Packets } } - List WorldQuestUpdates = new List(); + List WorldQuestUpdates = new(); } class DisplayPlayerChoice : ServerPacket @@ -856,7 +856,7 @@ namespace Game.Networking.Packets public int UiTextureKitID; public uint SoundKitID; public string Question; - public List Responses = new List(); + public List Responses = new(); public bool CloseChoiceFrame; public bool HideWarboardHeader; public bool KeepOpenAfterChoice; @@ -944,7 +944,7 @@ namespace Game.Networking.Packets public uint RewardMoneyDifficulty; public float RewardMoneyMultiplier = 1.0f; public uint RewardBonusMoney; - public List RewardDisplaySpell = new List(); // reward spell, this spell will be displayed (icon) + public List RewardDisplaySpell = new(); // reward spell, this spell will be displayed (icon) public uint RewardSpell; public uint RewardHonor; public float RewardKillHonor; @@ -985,7 +985,7 @@ namespace Game.Networking.Packets public int Expansion; public int ManagedWorldStateID; public int QuestSessionBonus; - public List Objectives = new List(); + public List Objectives = new(); public uint[] RewardItems = new uint[SharedConst.QuestRewardItemCount]; public uint[] RewardAmount = new uint[SharedConst.QuestRewardItemCount]; public int[] ItemDrop = new int[SharedConst.QuestItemDropCount]; @@ -1142,8 +1142,8 @@ namespace Game.Networking.Packets public uint QuestID = 0; public bool AutoLaunched = false; public uint SuggestedPartyMembers = 0; - public QuestRewards Rewards = new QuestRewards(); - public List Emotes = new List(); + public QuestRewards Rewards = new(); + public List Emotes = new(); public uint[] QuestFlags = new uint[2]; // Flags and FlagsEx } @@ -1252,10 +1252,10 @@ namespace Game.Networking.Packets public uint HonorPointCount; public ulong Money; public uint Xp; - public List Items = new List(); - public List Currencies = new List(); - public List Factions = new List(); - public List ItemChoices = new List(); + public List Items = new(); + public List Currencies = new(); + public List Factions = new(); + public List ItemChoices = new(); } struct PlayerChoiceResponseMawPower diff --git a/Source/Game/Networking/Packets/ReputationPackets.cs b/Source/Game/Networking/Packets/ReputationPackets.cs index 45c8cd753..7f697b8ed 100644 --- a/Source/Game/Networking/Packets/ReputationPackets.cs +++ b/Source/Game/Networking/Packets/ReputationPackets.cs @@ -63,7 +63,7 @@ namespace Game.Networking.Packets reaction.Write(_worldPacket); } - public List Reactions = new List(); + public List Reactions = new(); } class SetFactionStanding : ServerPacket @@ -85,7 +85,7 @@ namespace Game.Networking.Packets public float ReferAFriendBonus; public float BonusFromAchievementSystem; - public List Faction = new List(); + public List Faction = new(); public bool ShowVisual; } diff --git a/Source/Game/Networking/Packets/ScenarioPackets.cs b/Source/Game/Networking/Packets/ScenarioPackets.cs index 601cd6207..48482dc32 100644 --- a/Source/Game/Networking/Packets/ScenarioPackets.cs +++ b/Source/Game/Networking/Packets/ScenarioPackets.cs @@ -60,10 +60,10 @@ namespace Game.Networking.Packets public uint WaveCurrent; public uint WaveMax; public uint TimerDuration; - public List CriteriaProgress = new List(); - public List BonusObjectives = new List(); - public List PickedSteps = new List(); - public List Spells = new List(); + public List CriteriaProgress = new(); + public List BonusObjectives = new(); + public List PickedSteps = new(); + public List Spells = new(); public bool ScenarioComplete = false; } @@ -122,7 +122,7 @@ namespace Game.Networking.Packets MissingScenarioPOIs[i] = _worldPacket.ReadInt32(); } - public Array MissingScenarioPOIs = new Array(50); + public Array MissingScenarioPOIs = new(50); } class ScenarioPOIs : ServerPacket @@ -160,7 +160,7 @@ namespace Game.Networking.Packets } } - public List ScenarioPOIDataStats = new List(); + public List ScenarioPOIDataStats = new(); } struct BonusObjectiveData diff --git a/Source/Game/Networking/Packets/SpellPackets.cs b/Source/Game/Networking/Packets/SpellPackets.cs index fbcc2c774..868095f2e 100644 --- a/Source/Game/Networking/Packets/SpellPackets.cs +++ b/Source/Game/Networking/Packets/SpellPackets.cs @@ -84,7 +84,7 @@ namespace Game.Networking.Packets public class SpellCategoryCooldown : ServerPacket { - public List CategoryCooldowns = new List(); + public List CategoryCooldowns = new(); public SpellCategoryCooldown() : base(ServerOpcodes.CategoryCooldown, ConnectionType.Instance) { } @@ -130,8 +130,8 @@ namespace Game.Networking.Packets } public bool InitialLogin; - public List KnownSpells = new List(); - public List FavoriteSpells = new List(); // tradeskill recipes + public List KnownSpells = new(); + public List FavoriteSpells = new(); // tradeskill recipes } public class UpdateActionButtons : ServerPacket @@ -169,7 +169,7 @@ namespace Game.Networking.Packets public class SendUnlearnSpells : ServerPacket { - List Spells = new List(); + List Spells = new(); public SendUnlearnSpells() : base(ServerOpcodes.SendUnlearnSpells, ConnectionType.Instance) { } @@ -197,7 +197,7 @@ namespace Game.Networking.Packets public bool UpdateAll; public ObjectGuid UnitGUID; - public List Auras = new List(); + public List Auras = new(); } public class CastSpell : ClientPacket @@ -281,7 +281,7 @@ namespace Game.Networking.Packets WriteLogData(); } - public SpellCastData Cast = new SpellCastData(); + public SpellCastData Cast = new(); } public class SpellStart : ServerPacket @@ -319,9 +319,9 @@ namespace Game.Networking.Packets _worldPacket.WriteInt32(spellId); } - public List SpellID = new List(); - public List Superceded = new List(); - public List FavoriteSpellID = new List(); + public List SpellID = new(); + public List Superceded = new(); + public List FavoriteSpellID = new(); } public class LearnedSpells : ServerPacket @@ -344,8 +344,8 @@ namespace Game.Networking.Packets _worldPacket.FlushBits(); } - public List SpellID = new List(); - public List FavoriteSpellID = new List(); + public List SpellID = new(); + public List FavoriteSpellID = new(); public uint SpecializationID; public bool SuppressMessaging; } @@ -454,7 +454,7 @@ namespace Game.Networking.Packets spellMod.Write(_worldPacket); } - public List Modifiers = new List(); + public List Modifiers = new(); } public class UnlearnedSpells : ServerPacket @@ -471,7 +471,7 @@ namespace Game.Networking.Packets _worldPacket.FlushBits(); } - public List SpellID = new List(); + public List SpellID = new(); public bool SuppressMessaging; } @@ -508,7 +508,7 @@ namespace Game.Networking.Packets _worldPacket.FlushBits(); } - public List SpellID = new List(); + public List SpellID = new(); public bool IsPet; } @@ -558,7 +558,7 @@ namespace Game.Networking.Packets SpellCooldowns.ForEach(p => p.Write(_worldPacket)); } - public List SpellCooldowns = new List(); + public List SpellCooldowns = new(); public ObjectGuid Caster; public SpellCooldownFlags Flags; } @@ -573,7 +573,7 @@ namespace Game.Networking.Packets Entries.ForEach(p => p.Write(_worldPacket)); } - public List Entries = new List(); + public List Entries = new(); } public class ClearAllSpellCharges : ServerPacket @@ -635,7 +635,7 @@ namespace Game.Networking.Packets Entries.ForEach(p => p.Write(_worldPacket)); } - public List Entries = new List(); + public List Entries = new(); } public class ClearTarget : ServerPacket @@ -948,10 +948,10 @@ namespace Game.Networking.Packets public byte RaceID; public byte Gender; public byte ClassID; - public List Customizations = new List(); + public List Customizations = new(); public ObjectGuid GuildGUID; - public List ItemDisplayID = new List(); + public List ItemDisplayID = new(); } class MirrorImageCreatureData : ServerPacket @@ -993,7 +993,7 @@ namespace Game.Networking.Packets Runes.Write(_worldPacket); } - public RuneData Runes = new RuneData(); + public RuneData Runes = new(); } class AddRunePower : ServerPacket @@ -1103,7 +1103,7 @@ namespace Game.Networking.Packets public ObjectGuid CasterGUID; public ObjectGuid VictimGUID; public uint SpellID; - public List FailedSpells = new List(); + public List FailedSpells = new(); } class CustomLoadScreen : ServerPacket @@ -1219,7 +1219,7 @@ namespace Game.Networking.Packets int AttackPower; int SpellPower; uint Armor; - List PowerData = new List(); + List PowerData = new(); } class ContentTuningParams @@ -1384,7 +1384,7 @@ namespace Game.Networking.Packets public static implicit operator SpellCastVisualField(SpellCastVisual spellCastVisual) { - SpellCastVisualField visual = new SpellCastVisualField(); + SpellCastVisualField visual = new(); visual.SpellXSpellVisualID = spellCastVisual.SpellXSpellVisualID; visual.ScriptVisualID = spellCastVisual.ScriptVisualID; return visual; @@ -1449,7 +1449,7 @@ namespace Game.Networking.Packets public Optional Remaining; Optional TimeMod; public float[] Points = new float[0]; - public List EstimatedPoints = new List(); + public List EstimatedPoints = new(); } public struct AuraInfo @@ -1609,12 +1609,12 @@ namespace Game.Networking.Packets public uint SpellID; public SpellCastVisual Visual; public uint SendCastFlags; - public SpellTargetData Target = new SpellTargetData(); + public SpellTargetData Target = new(); public MissileTrajectoryRequest MissileTrajectory; public Optional MoveUpdate; - public List Weight = new List(); - public Array OptionalReagents = new Array(3); - public Array OptionalCurrencies = new Array(5 /*MAX_ITEM_EXT_COST_CURRENCIES*/); + public List Weight = new(); + public Array OptionalReagents = new(3); + public Array OptionalCurrencies = new(5 /*MAX_ITEM_EXT_COST_CURRENCIES*/); public ObjectGuid CraftingNPC; public uint[] Misc = new uint[2]; @@ -1721,7 +1721,7 @@ namespace Game.Networking.Packets public byte Start; public byte Count; - public List Cooldowns = new List(); + public List Cooldowns = new(); } public struct MissileTrajectoryResult @@ -1840,17 +1840,17 @@ namespace Game.Networking.Packets public SpellCastFlags CastFlags; public SpellCastFlagsEx CastFlagsEx; public uint CastTime; - public List HitTargets = new List(); - public List MissTargets = new List(); - public List HitStatus = new List(); - public List MissStatus = new List(); - public SpellTargetData Target = new SpellTargetData(); - public List RemainingPower = new List(); + public List HitTargets = new(); + public List MissTargets = new(); + public List HitStatus = new(); + public List MissStatus = new(); + public SpellTargetData Target = new(); + public List RemainingPower = new(); public Optional RemainingRunes; public MissileTrajectoryResult MissileTrajectory; public SpellAmmo Ammo; public byte DestLocSpellCastIndex; - public List TargetPoints = new List(); + public List TargetPoints = new(); public CreatureImmunities Immunities; public SpellHealPrediction Predict; } @@ -1870,7 +1870,7 @@ namespace Game.Networking.Packets public class SpellModifierInfo { public byte ModIndex; - public List ModifierData = new List(); + public List ModifierData = new(); public void Write(WorldPacket data) { diff --git a/Source/Game/Networking/Packets/SystemPackets.cs b/Source/Game/Networking/Packets/SystemPackets.cs index ea8456985..94f882746 100644 --- a/Source/Game/Networking/Packets/SystemPackets.cs +++ b/Source/Game/Networking/Packets/SystemPackets.cs @@ -296,7 +296,7 @@ namespace Game.Networking.Packets public bool LiveRegionKeyBindingsCopyEnabled = false; public bool Unknown901CheckoutRelated = false; // NYI public Optional EuropaTicketSystemStatus; - public List LiveRegionCharacterCopySourceRegions = new List(); + public List LiveRegionCharacterCopySourceRegions = new(); public uint TokenPollTimeSeconds; // NYI public long TokenBalanceAmount; // NYI public int MaxCharactersPerRealm; diff --git a/Source/Game/Networking/Packets/TalentPackets.cs b/Source/Game/Networking/Packets/TalentPackets.cs index a3a9c672f..54c2130c8 100644 --- a/Source/Game/Networking/Packets/TalentPackets.cs +++ b/Source/Game/Networking/Packets/TalentPackets.cs @@ -45,20 +45,20 @@ namespace Game.Networking.Packets } } - public TalentInfoUpdate Info = new TalentInfoUpdate(); + public TalentInfoUpdate Info = new(); public class TalentGroupInfo { public uint SpecID; - public List TalentIDs = new List(); - public List PvPTalents = new List(); + public List TalentIDs = new(); + public List PvPTalents = new(); } public class TalentInfoUpdate { public byte ActiveGroup; public uint PrimarySpecialization; - public List TalentGroups = new List(); + public List TalentGroups = new(); } } @@ -73,7 +73,7 @@ namespace Game.Networking.Packets Talents[i] = _worldPacket.ReadUInt16(); } - public Array Talents = new Array(PlayerConst.MaxTalentTiers); + public Array Talents = new(PlayerConst.MaxTalentTiers); } class RespecWipeConfirm : ServerPacket @@ -122,7 +122,7 @@ namespace Game.Networking.Packets public uint Reason; public int SpellID; - public List Talents = new List(); + public List Talents = new(); } class ActiveGlyphs : ServerPacket @@ -139,7 +139,7 @@ namespace Game.Networking.Packets _worldPacket.FlushBits(); } - public List Glyphs = new List(); + public List Glyphs = new(); public bool IsFullUpdate; } @@ -154,7 +154,7 @@ namespace Game.Networking.Packets Talents[i] = new PvPTalent(_worldPacket); } - public Array Talents = new Array(4); + public Array Talents = new(4); } class LearnPvpTalentFailed : ServerPacket @@ -173,7 +173,7 @@ namespace Game.Networking.Packets public uint Reason; public uint SpellID; - public List Talents = new List(); + public List Talents = new(); } //Structs diff --git a/Source/Game/Networking/Packets/TicketPackets.cs b/Source/Game/Networking/Packets/TicketPackets.cs index bdd455be6..0ae2919e3 100644 --- a/Source/Game/Networking/Packets/TicketPackets.cs +++ b/Source/Game/Networking/Packets/TicketPackets.cs @@ -75,7 +75,7 @@ namespace Game.Networking.Packets } } - public List Cases = new List(); + public List Cases = new(); public struct GMTicketCase { @@ -252,7 +252,7 @@ namespace Game.Networking.Packets ReportLineIndex.Value = data.ReadUInt32(); } - public List Lines = new List(); + public List Lines = new(); public Optional ReportLineIndex; } @@ -316,7 +316,7 @@ namespace Game.Networking.Packets public class SupportTicketHorusChatLog { - public List Lines = new List(); + public List Lines = new(); public void Read(WorldPacket data) { diff --git a/Source/Game/Networking/Packets/TokenPackets.cs b/Source/Game/Networking/Packets/TokenPackets.cs index ea7e45af4..a5374303c 100644 --- a/Source/Game/Networking/Packets/TokenPackets.cs +++ b/Source/Game/Networking/Packets/TokenPackets.cs @@ -54,7 +54,7 @@ namespace Game.Networking.Packets public uint UnkInt; // send CMSG_UPDATE_WOW_TOKEN_AUCTIONABLE_LIST public TokenResult Result; - List AuctionableTokenAuctionableList =new List(); + List AuctionableTokenAuctionableList =new(); struct AuctionableTokenAuctionable { diff --git a/Source/Game/Networking/Packets/ToyPackets.cs b/Source/Game/Networking/Packets/ToyPackets.cs index 37d8fec91..96013a98f 100644 --- a/Source/Game/Networking/Packets/ToyPackets.cs +++ b/Source/Game/Networking/Packets/ToyPackets.cs @@ -43,7 +43,7 @@ namespace Game.Networking.Packets Cast.Read(_worldPacket); } - public SpellCastRequest Cast = new SpellCastRequest(); + public SpellCastRequest Cast = new(); } class AccountToyUpdate : ServerPacket @@ -73,7 +73,7 @@ namespace Game.Networking.Packets } public bool IsFullUpdate = false; - public Dictionary Toys = new Dictionary(); + public Dictionary Toys = new(); } class ToyClearFanfare : ClientPacket diff --git a/Source/Game/Networking/Packets/TradePackets.cs b/Source/Game/Networking/Packets/TradePackets.cs index dbb99816b..dbf0fe788 100644 --- a/Source/Game/Networking/Packets/TradePackets.cs +++ b/Source/Game/Networking/Packets/TradePackets.cs @@ -230,7 +230,7 @@ namespace Game.Networking.Packets public bool Lock; public uint MaxDurability; public uint Durability; - public List Gems = new List(); + public List Gems = new(); } public class TradeItem @@ -249,7 +249,7 @@ namespace Game.Networking.Packets } public byte Slot; - public ItemInstance Item = new ItemInstance(); + public ItemInstance Item = new(); public int StackCount; public ObjectGuid GiftCreator; public Optional Unwrapped; @@ -259,7 +259,7 @@ namespace Game.Networking.Packets public uint CurrentStateIndex; public byte WhichPlayer; public uint ClientStateIndex; - public List Items = new List(); + public List Items = new(); public int CurrencyType; public uint Id; public int ProposedEnchantment; diff --git a/Source/Game/Networking/Packets/TransmogrificationPackets.cs b/Source/Game/Networking/Packets/TransmogrificationPackets.cs index 57cdee8bc..087679f39 100644 --- a/Source/Game/Networking/Packets/TransmogrificationPackets.cs +++ b/Source/Game/Networking/Packets/TransmogrificationPackets.cs @@ -32,7 +32,7 @@ namespace Game.Networking.Packets for (var i = 0; i < itemsCount; ++i) { - TransmogrifyItem item = new TransmogrifyItem(); + TransmogrifyItem item = new(); item.Read(_worldPacket); Items[i] = item; } @@ -41,7 +41,7 @@ namespace Game.Networking.Packets } public ObjectGuid Npc; - public Array Items = new Array(13); + public Array Items = new(13); public bool CurrentSpecOnly; } @@ -65,8 +65,8 @@ namespace Game.Networking.Packets public bool IsFullUpdate; public bool IsSetFavorite; - public List FavoriteAppearances = new List(); - public List NewAppearances = new List(); + public List FavoriteAppearances = new(); + public List NewAppearances = new(); } class TransmogrifyNPC : ServerPacket diff --git a/Source/Game/Networking/Packets/VoidStoragePackets.cs b/Source/Game/Networking/Packets/VoidStoragePackets.cs index a6ad67764..f79e2103e 100644 --- a/Source/Game/Networking/Packets/VoidStoragePackets.cs +++ b/Source/Game/Networking/Packets/VoidStoragePackets.cs @@ -85,7 +85,7 @@ namespace Game.Networking.Packets voidItem.Write(_worldPacket); } - public List Items = new List(); + public List Items = new(); } class VoidStorageTransfer : ClientPacket @@ -127,8 +127,8 @@ namespace Game.Networking.Packets _worldPacket.WritePackedGuid(removedItem); } - public List RemovedItems = new List(); - public List AddedItems = new List(); + public List RemovedItems = new(); + public List AddedItems = new(); } class SwapVoidItem : ClientPacket diff --git a/Source/Game/Networking/Packets/WhoPackets.cs b/Source/Game/Networking/Packets/WhoPackets.cs index 2015c4ce5..b22401470 100644 --- a/Source/Game/Networking/Packets/WhoPackets.cs +++ b/Source/Game/Networking/Packets/WhoPackets.cs @@ -63,9 +63,9 @@ namespace Game.Networking.Packets Areas.Add(_worldPacket.ReadInt32()); } - public WhoRequest Request = new WhoRequest(); + public WhoRequest Request = new(); public uint RequestID; - public List Areas= new List(); + public List Areas= new(); } public class WhoResponsePkt : ServerPacket @@ -82,7 +82,7 @@ namespace Game.Networking.Packets } public uint RequestID; - public List Response = new List(); + public List Response = new(); } public struct WhoRequestServerInfo @@ -143,7 +143,7 @@ namespace Game.Networking.Packets public string GuildVirtualRealmName; public long RaceFilter; public int ClassFilter = -1; - public List Words = new List(); + public List Words = new(); public bool ShowEnemies; public bool ShowArenaPlayers; public bool ExactName; @@ -167,7 +167,7 @@ namespace Game.Networking.Packets data.FlushBits(); } - public PlayerGuidLookupData PlayerData = new PlayerGuidLookupData(); + public PlayerGuidLookupData PlayerData = new(); public ObjectGuid GuildGUID; public uint GuildVirtualRealmAddress; public string GuildName = ""; diff --git a/Source/Game/Networking/Packets/WorldStatePackets.cs b/Source/Game/Networking/Packets/WorldStatePackets.cs index 44ad55c0c..ed71dfd39 100644 --- a/Source/Game/Networking/Packets/WorldStatePackets.cs +++ b/Source/Game/Networking/Packets/WorldStatePackets.cs @@ -52,7 +52,7 @@ namespace Game.Networking.Packets public uint SubareaID; public uint MapID; - List Worldstates = new List(); + List Worldstates = new(); struct WorldStateInfo { diff --git a/Source/Game/Networking/RASocket.cs b/Source/Game/Networking/RASocket.cs index 3d7dfe1c9..548946977 100644 --- a/Source/Game/Networking/RASocket.cs +++ b/Source/Game/Networking/RASocket.cs @@ -209,7 +209,7 @@ namespace Game.Networking return false; } - RemoteAccessHandler cmd = new RemoteAccessHandler(CommandPrint); + RemoteAccessHandler cmd = new(CommandPrint); cmd.ParseCommand(command); return true; diff --git a/Source/Game/Networking/WorldSocket.cs b/Source/Game/Networking/WorldSocket.cs index aae4afb89..1cc954f56 100644 --- a/Source/Game/Networking/WorldSocket.cs +++ b/Source/Game/Networking/WorldSocket.cs @@ -52,12 +52,12 @@ namespace Game.Networking long _LastPingTime; uint _OverSpeedPings; - object _worldSessionLock = new object(); + object _worldSessionLock = new(); WorldSession _worldSession; ZLib.z_stream _compressionStream; - AsyncCallbackProcessor _queryProcessor = new AsyncCallbackProcessor(); + AsyncCallbackProcessor _queryProcessor = new(); string _ipCountry; public WorldSocket(Socket socket) : base(socket) @@ -120,7 +120,7 @@ namespace Game.Networking AsyncReadWithCallback(InitializeHandler); - ByteBuffer packet = new ByteBuffer(); + ByteBuffer packet = new(); packet.WriteString(ServerConnectionInitialize); packet.WriteString("\n"); AsyncWrite(packet.GetData()); @@ -149,7 +149,7 @@ namespace Game.Networking return; } - ByteBuffer buffer = new ByteBuffer(_packetBuffer.GetData()); + ByteBuffer buffer = new(_packetBuffer.GetData()); string initializer = buffer.ReadString((uint)ClientConnectionInitialize.Length); if (initializer != ClientConnectionInitialize) { @@ -240,7 +240,7 @@ namespace Game.Networking bool ReadHeader() { - PacketHeader header = new PacketHeader(); + PacketHeader header = new(); header.Read(_headerBuffer.GetData()); _packetBuffer.Resize(header.Size); @@ -249,7 +249,7 @@ namespace Game.Networking ReadDataHandlerResult ReadData() { - PacketHeader header = new PacketHeader(); + PacketHeader header = new(); header.Read(_headerBuffer.GetData()); if (!_worldCrypt.Decrypt(_packetBuffer.GetData(), header.Tag)) @@ -258,7 +258,7 @@ namespace Game.Networking return ReadDataHandlerResult.Error; } - WorldPacket packet = new WorldPacket(_packetBuffer.GetData()); + WorldPacket packet = new(_packetBuffer.GetData()); _packetBuffer.Reset(); if (packet.GetOpcode() >= (int)ClientOpcodes.Max) @@ -281,7 +281,7 @@ namespace Game.Networking switch (opcode) { case ClientOpcodes.Ping: - Ping ping = new Ping(packet); + Ping ping = new(packet); ping.Read(); if (!HandlePing(ping)) return ReadDataHandlerResult.Error; @@ -293,7 +293,7 @@ namespace Game.Networking return ReadDataHandlerResult.Error; } - AuthSession authSession = new AuthSession(packet); + AuthSession authSession = new(packet); authSession.Read(); HandleAuthSession(authSession); return ReadDataHandlerResult.WaitingForQuery; @@ -304,7 +304,7 @@ namespace Game.Networking return ReadDataHandlerResult.Error; } - AuthContinuedSession authContinuedSession = new AuthContinuedSession(packet); + AuthContinuedSession authContinuedSession = new(packet); authContinuedSession.Read(); HandleAuthContinuedSession(authContinuedSession); return ReadDataHandlerResult.WaitingForQuery; @@ -318,7 +318,7 @@ namespace Game.Networking SetNoDelay(false); break; case ClientOpcodes.ConnectToFailed: - ConnectToFailed connectToFailed = new ConnectToFailed(packet); + ConnectToFailed connectToFailed = new(packet); connectToFailed.Read(); HandleConnectToFailed(connectToFailed); break; @@ -364,7 +364,7 @@ namespace Game.Networking ServerOpcodes opcode = packet.GetOpcode(); PacketLog.Write(data, (uint)opcode, GetRemoteIpAddress(), _connectType, false); - ByteBuffer buffer = new ByteBuffer(); + ByteBuffer buffer = new(); int packetSize = data.Length; if (packetSize > 0x400 && _worldCrypt.IsInitialized) @@ -390,11 +390,11 @@ namespace Game.Networking data = buffer.GetData(); - PacketHeader header = new PacketHeader(); + PacketHeader header = new(); header.Size = packetSize; _worldCrypt.Encrypt(ref data, ref header.Tag); - ByteBuffer byteBuffer = new ByteBuffer(); + ByteBuffer byteBuffer = new(); header.Write(byteBuffer); byteBuffer.WriteBytes(data); @@ -452,7 +452,7 @@ namespace Game.Networking void HandleSendAuthSession() { - AuthChallenge challenge = new AuthChallenge(); + AuthChallenge challenge = new(); challenge.Challenge = _serverChallenge; challenge.DosChallenge = new byte[32].GenerateRandomKey(32); challenge.DosZeroBits = 1; @@ -489,12 +489,12 @@ namespace Game.Networking return; } - AccountInfo account = new AccountInfo(result.GetFields()); + AccountInfo account = new(result.GetFields()); // For hook purposes, we get Remoteaddress at this point. var address = GetRemoteIpAddress(); - Sha256 digestKeyHash = new Sha256(); + Sha256 digestKeyHash = new(); digestKeyHash.Process(account.game.SessionKey, account.game.SessionKey.Length); if (account.game.OS == "Wn64") digestKeyHash.Finish(buildInfo.Win64AuthSeed); @@ -507,7 +507,7 @@ namespace Game.Networking return; } - HmacSha256 hmac = new HmacSha256(digestKeyHash.Digest); + HmacSha256 hmac = new(digestKeyHash.Digest); hmac.Process(authSession.LocalChallenge, authSession.LocalChallenge.Count); hmac.Process(_serverChallenge, 16); hmac.Finish(AuthCheckSeed, 16); @@ -520,10 +520,10 @@ namespace Game.Networking return; } - Sha256 keyData = new Sha256(); + Sha256 keyData = new(); keyData.Finish(account.game.SessionKey); - HmacSha256 sessionKeyHmac = new HmacSha256(keyData.Digest); + HmacSha256 sessionKeyHmac = new(keyData.Digest); sessionKeyHmac.Process(_serverChallenge, 16); sessionKeyHmac.Process(authSession.LocalChallenge, authSession.LocalChallenge.Count); sessionKeyHmac.Finish(SessionKeySeed, 16); @@ -532,7 +532,7 @@ namespace Game.Networking var sessionKeyGenerator = new SessionKeyGenerator(sessionKeyHmac.Digest, 32); sessionKeyGenerator.Generate(_sessionKey, 40); - HmacSha256 encryptKeyGen = new HmacSha256(_sessionKey); + HmacSha256 encryptKeyGen = new(_sessionKey); encryptKeyGen.Process(authSession.LocalChallenge, authSession.LocalChallenge.Count); encryptKeyGen.Process(_serverChallenge, 16); encryptKeyGen.Finish(EncryptionKeySeed, 16); @@ -662,7 +662,7 @@ namespace Game.Networking void HandleAuthContinuedSession(AuthContinuedSession authSession) { - ConnectToKey key = new ConnectToKey(); + ConnectToKey key = new(); _key = key.Raw = authSession.Key; _connectType = key.connectionType; @@ -689,14 +689,14 @@ namespace Game.Networking return; } - ConnectToKey key = new ConnectToKey(); + ConnectToKey key = new(); _key = key.Raw = authSession.Key; uint accountId = key.AccountId; string login = result.Read(0); _sessionKey = result.Read(1); - HmacSha256 hmac = new HmacSha256(_sessionKey); + HmacSha256 hmac = new(_sessionKey); hmac.Process(BitConverter.GetBytes(authSession.Key), 8); hmac.Process(authSession.LocalChallenge, authSession.LocalChallenge.Length); hmac.Process(_serverChallenge, 16); @@ -709,7 +709,7 @@ namespace Game.Networking return; } - HmacSha256 encryptKeyGen = new HmacSha256(_sessionKey); + HmacSha256 encryptKeyGen = new(_sessionKey); encryptKeyGen.Process(authSession.LocalChallenge, authSession.LocalChallenge.Length); encryptKeyGen.Process(_serverChallenge, 16); encryptKeyGen.Finish(EncryptionKeySeed, 16); @@ -771,7 +771,7 @@ namespace Game.Networking public void SendAuthResponseError(BattlenetRpcErrorCode code) { - AuthResponse response = new AuthResponse(); + AuthResponse response = new(); response.SuccessInfo.HasValue = false; response.WaitInfo.HasValue = false; response.Result = code; diff --git a/Source/Game/OutdoorPVP/OutdoorPvP.cs b/Source/Game/OutdoorPVP/OutdoorPvP.cs index 9c2e72728..87527bd45 100644 --- a/Source/Game/OutdoorPVP/OutdoorPvP.cs +++ b/Source/Game/OutdoorPVP/OutdoorPvP.cs @@ -245,7 +245,7 @@ namespace Game.PvP public void SendDefenseMessage(uint zoneId, uint id) { - DefenseMessageBuilder builder = new DefenseMessageBuilder(zoneId, id); + DefenseMessageBuilder builder = new(zoneId, id); var localizer = new LocalizedPacketDo(builder); BroadcastWorker(localizer, zoneId); } @@ -304,7 +304,7 @@ namespace Game.PvP } // the map of the objectives belonging to this outdoorpvp - public Dictionary m_capturePoints = new Dictionary(); + public Dictionary m_capturePoints = new(); List[] m_players = new List[2]; public OutdoorPvPTypes m_TypeId; bool m_sendUpdate; @@ -521,7 +521,7 @@ namespace Game.PvP } } - List players = new List(); + List players = new(); var checker = new AnyPlayerInObjectRangeCheck(m_capturePoint, radius); var searcher = new PlayerListSearcher(m_capturePoint, players, checker); Cell.VisitWorldObjects(m_capturePoint, searcher, radius); @@ -722,10 +722,10 @@ namespace Game.PvP // pointer to the OutdoorPvP this objective belongs to public OutdoorPvP PvP { get; set; } - public Dictionary m_Objects = new Dictionary(); - public Dictionary m_Creatures = new Dictionary(); - Dictionary m_ObjectTypes = new Dictionary(); - Dictionary m_CreatureTypes = new Dictionary(); + public Dictionary m_Objects = new(); + public Dictionary m_Creatures = new(); + Dictionary m_ObjectTypes = new(); + Dictionary m_CreatureTypes = new(); } class DefenseMessageBuilder : MessageBuilder @@ -740,7 +740,7 @@ namespace Game.PvP { string text = Global.OutdoorPvPMgr.GetDefenseMessage(_zoneId, _id, locale); - DefenseMessage defenseMessage = new DefenseMessage(); + DefenseMessage defenseMessage = new(); defenseMessage.ZoneID = _zoneId; defenseMessage.MessageText = text; return defenseMessage; diff --git a/Source/Game/OutdoorPVP/OutdoorPvPManager.cs b/Source/Game/OutdoorPVP/OutdoorPvPManager.cs index 971f8b65b..e916ad2c5 100644 --- a/Source/Game/OutdoorPVP/OutdoorPvPManager.cs +++ b/Source/Game/OutdoorPVP/OutdoorPvPManager.cs @@ -224,14 +224,14 @@ namespace Game.PvP // contains all initiated outdoor pvp events // used when initing / cleaning up - List m_OutdoorPvPSet = new List(); + List m_OutdoorPvPSet = new(); // maps the zone ids to an outdoor pvp event // used in player event handling - Dictionary m_OutdoorPvPMap = new Dictionary(); + Dictionary m_OutdoorPvPMap = new(); // Holds the outdoor PvP templates - Dictionary OutdoorPvPScriptIds = new Dictionary(); + Dictionary OutdoorPvPScriptIds = new(); // update interval uint m_UpdateTimer; diff --git a/Source/Game/Phasing/PhaseShift.cs b/Source/Game/Phasing/PhaseShift.cs index befe68155..9751e5059 100644 --- a/Source/Game/Phasing/PhaseShift.cs +++ b/Source/Game/Phasing/PhaseShift.cs @@ -241,9 +241,9 @@ namespace Game public PhaseShiftFlags Flags = PhaseShiftFlags.Unphased; public ObjectGuid PersonalGuid; - public Dictionary Phases = new Dictionary(); - public Dictionary VisibleMapIds = new Dictionary(); - public Dictionary UiMapPhaseIds = new Dictionary(); + public Dictionary Phases = new(); + public Dictionary VisibleMapIds = new(); + public Dictionary UiMapPhaseIds = new(); int NonCosmeticReferences; int CosmeticReferences; diff --git a/Source/Game/Phasing/PhasingHandler.cs b/Source/Game/Phasing/PhasingHandler.cs index d7acc0710..3409b9c3a 100644 --- a/Source/Game/Phasing/PhasingHandler.cs +++ b/Source/Game/Phasing/PhasingHandler.cs @@ -15,7 +15,7 @@ namespace Game { public class PhasingHandler { - public static PhaseShift EmptyPhaseShift = new PhaseShift(); + public static PhaseShift EmptyPhaseShift = new(); public static PhaseFlags GetPhaseFlags(uint phaseId) { @@ -208,7 +208,7 @@ namespace Game { PhaseShift phaseShift = obj.GetPhaseShift(); PhaseShift suppressedPhaseShift = obj.GetSuppressedPhaseShift(); - ConditionSourceInfo srcInfo = new ConditionSourceInfo(obj); + ConditionSourceInfo srcInfo = new(obj); obj.GetPhaseShift().VisibleMapIds.Clear(); obj.GetPhaseShift().UiMapPhaseIds.Clear(); @@ -237,7 +237,7 @@ namespace Game PhaseShift phaseShift = obj.GetPhaseShift(); PhaseShift suppressedPhaseShift = obj.GetSuppressedPhaseShift(); var oldPhases = phaseShift.GetPhases(); // for comparison - ConditionSourceInfo srcInfo = new ConditionSourceInfo(obj); + ConditionSourceInfo srcInfo = new(obj); obj.GetPhaseShift().ClearPhases(); obj.GetSuppressedPhaseShift().ClearPhases(); @@ -309,8 +309,8 @@ namespace Game { PhaseShift phaseShift = obj.GetPhaseShift(); PhaseShift suppressedPhaseShift = obj.GetSuppressedPhaseShift(); - PhaseShift newSuppressions = new PhaseShift(); - ConditionSourceInfo srcInfo = new ConditionSourceInfo(obj); + PhaseShift newSuppressions = new(); + ConditionSourceInfo srcInfo = new(obj); bool changed = false; foreach (var pair in phaseShift.Phases.ToList()) @@ -413,7 +413,7 @@ namespace Game public static void SendToPlayer(Player player, PhaseShift phaseShift) { - PhaseShiftChange phaseShiftChange = new PhaseShiftChange(); + PhaseShiftChange phaseShiftChange = new(); phaseShiftChange.Client = player.GetGUID(); phaseShiftChange.Phaseshift.PhaseShiftFlags = (uint)phaseShift.Flags; phaseShiftChange.Phaseshift.PersonalGUID = phaseShift.PersonalGuid; @@ -484,7 +484,7 @@ namespace Game public static bool InDbPhaseShift(WorldObject obj, PhaseUseFlagsValues phaseUseFlags, ushort phaseId, uint phaseGroupId) { - PhaseShift phaseShift = new PhaseShift(); + PhaseShift phaseShift = new(); InitDbPhaseShift(phaseShift, phaseUseFlags, phaseId, phaseGroupId); return obj.GetPhaseShift().CanSee(phaseShift); } @@ -535,7 +535,7 @@ namespace Game chat.SendSysMessage(CypherStrings.PhaseshiftStatus, phaseShift.Flags, phaseShift.PersonalGuid.ToString()); if (!phaseShift.Phases.Empty()) { - StringBuilder phases = new StringBuilder(); + StringBuilder phases = new(); string cosmetic = Global.ObjectMgr.GetCypherString(CypherStrings.PhaseFlagCosmetic, chat.GetSessionDbcLocale()); string personal = Global.ObjectMgr.GetCypherString(CypherStrings.PhaseFlagPersonal, chat.GetSessionDbcLocale()); foreach (var pair in phaseShift.Phases) @@ -553,7 +553,7 @@ namespace Game if (!phaseShift.VisibleMapIds.Empty()) { - StringBuilder visibleMapIds = new StringBuilder(); + StringBuilder visibleMapIds = new(); foreach (var visibleMapId in phaseShift.VisibleMapIds) visibleMapIds.Append(visibleMapId.Key + ',' + ' '); @@ -562,7 +562,7 @@ namespace Game if (!phaseShift.UiMapPhaseIds.Empty()) { - StringBuilder uiWorldMapAreaIdSwaps = new StringBuilder(); + StringBuilder uiWorldMapAreaIdSwaps = new(); foreach (var uiWorldMapAreaIdSwap in phaseShift.UiMapPhaseIds) uiWorldMapAreaIdSwaps.Append(uiWorldMapAreaIdSwap.Key + ',' + ' '); @@ -572,7 +572,7 @@ namespace Game public static string FormatPhases(PhaseShift phaseShift) { - StringBuilder phases = new StringBuilder(); + StringBuilder phases = new(); foreach (var phaseId in phaseShift.Phases.Keys) phases.Append(phaseId + ','); diff --git a/Source/Game/Pools/PoolManager.cs b/Source/Game/Pools/PoolManager.cs index 171ade01b..6c8ad558f 100644 --- a/Source/Game/Pools/PoolManager.cs +++ b/Source/Game/Pools/PoolManager.cs @@ -55,7 +55,7 @@ namespace Game { uint pool_id = result.Read(0); - PoolTemplateData pPoolTemplate = new PoolTemplateData(); + PoolTemplateData pPoolTemplate = new(); pPoolTemplate.MaxLimit = result.Read(1); mPoolTemplate[pool_id] = pPoolTemplate; ++count; @@ -104,7 +104,7 @@ namespace Game continue; } PoolTemplateData pPoolTemplate = mPoolTemplate[pool_id]; - PoolObject plObject = new PoolObject(guid, chance); + PoolObject plObject = new(guid, chance); if (!mPoolCreatureGroups.ContainsKey(pool_id)) mPoolCreatureGroups[pool_id] = new PoolGroup(); @@ -174,7 +174,7 @@ namespace Game } PoolTemplateData pPoolTemplate = mPoolTemplate[pool_id]; - PoolObject plObject = new PoolObject(guid, chance); + PoolObject plObject = new(guid, chance); if (!mPoolGameobjectGroups.ContainsKey(pool_id)) mPoolGameobjectGroups[pool_id] = new PoolGroup(); @@ -235,7 +235,7 @@ namespace Game continue; } PoolTemplateData pPoolTemplateMother = mPoolTemplate[mother_pool_id]; - PoolObject plObject = new PoolObject(child_pool_id, chance); + PoolObject plObject = new(child_pool_id, chance); if (!mPoolPoolGroups.ContainsKey(mother_pool_id)) mPoolPoolGroups[mother_pool_id] = new PoolGroup(); @@ -269,7 +269,7 @@ namespace Game List creBounds; List goBounds; - Dictionary poolTypeMap = new Dictionary(); + Dictionary poolTypeMap = new(); uint count = 0; do { @@ -320,7 +320,7 @@ namespace Game } PoolTemplateData pPoolTemplate = mPoolTemplate[pool_id]; - PoolObject plObject = new PoolObject(entry, 0.0f); + PoolObject plObject = new(entry, 0.0f); if (!mPoolQuestGroups.ContainsKey(pool_id)) mPoolQuestGroups[pool_id] = new PoolGroup(); @@ -387,7 +387,7 @@ namespace Game public void SaveQuestsToDB() { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); foreach (var questPoolGroup in mPoolQuestGroups.Values) { @@ -559,21 +559,21 @@ namespace Game public bool IsSpawnedObject(ulong db_guid_or_pool_id) { return mSpawnedData.IsActiveObject(db_guid_or_pool_id); } - public MultiMap mQuestCreatureRelation = new MultiMap(); - public MultiMap mQuestGORelation = new MultiMap(); + public MultiMap mQuestCreatureRelation = new(); + public MultiMap mQuestGORelation = new(); - Dictionary mPoolTemplate = new Dictionary(); - Dictionary> mPoolCreatureGroups = new Dictionary>(); - Dictionary> mPoolGameobjectGroups = new Dictionary>(); - Dictionary> mPoolPoolGroups = new Dictionary>(); - Dictionary> mPoolQuestGroups = new Dictionary>(); - Dictionary mCreatureSearchMap = new Dictionary(); - Dictionary mGameobjectSearchMap = new Dictionary(); - Dictionary mPoolSearchMap = new Dictionary(); - Dictionary mQuestSearchMap = new Dictionary(); + Dictionary mPoolTemplate = new(); + Dictionary> mPoolCreatureGroups = new(); + Dictionary> mPoolGameobjectGroups = new(); + Dictionary> mPoolPoolGroups = new(); + Dictionary> mPoolQuestGroups = new(); + Dictionary mCreatureSearchMap = new(); + Dictionary mGameobjectSearchMap = new(); + Dictionary mPoolSearchMap = new(); + Dictionary mQuestSearchMap = new(); // dynamic data - ActivePoolData mSpawnedData = new ActivePoolData(); + ActivePoolData mSpawnedData = new(); } public class PoolGroup @@ -760,7 +760,7 @@ namespace Game // This will try to spawn the rest of pool, not guaranteed if (count > 0) { - List rolledObjects = new List(); + List rolledObjects = new(); // roll objects to be spawned if (!ExplicitlyChanced.Empty()) @@ -838,7 +838,7 @@ namespace Game { uint questId = result.Read(0); spawns.ActivateObject(questId, poolId); - PoolObject tempObj = new PoolObject(questId, 0.0f); + PoolObject tempObj = new(questId, 0.0f); Spawn1Object(tempObj); --limit; } while (result.NextRow() && limit != 0); @@ -847,7 +847,7 @@ namespace Game } List currentQuests = spawns.GetActiveQuests(); - List newQuests = new List(); + List newQuests = new(); // always try to select different quests foreach (var poolObject in EqualChanced) @@ -876,7 +876,7 @@ namespace Game { ulong questId = newQuests.SelectRandom(); spawns.ActivateObject(questId, poolId); - PoolObject tempObj = new PoolObject(questId, 0.0f); + PoolObject tempObj = new(questId, 0.0f); Spawn1Object(tempObj); newQuests.Remove(questId); --limit; @@ -971,8 +971,8 @@ namespace Game public uint GetPoolId() { return poolId; } uint poolId; - List ExplicitlyChanced = new List(); - List EqualChanced = new List(); + List ExplicitlyChanced = new(); + List EqualChanced = new(); } public class ActivePoolData @@ -1051,10 +1051,10 @@ namespace Game public List GetActiveQuests() { return mActiveQuests; } // a copy of the set - List mSpawnedCreatures = new List(); - List mSpawnedGameobjects = new List(); - List mActiveQuests = new List(); - Dictionary mSpawnedPools = new Dictionary(); + List mSpawnedCreatures = new(); + List mSpawnedGameobjects = new(); + List mActiveQuests = new(); + Dictionary mSpawnedPools = new(); } public class PoolObject diff --git a/Source/Game/Quest/Quest.cs b/Source/Game/Quest/Quest.cs index 021cbe867..8022203b7 100644 --- a/Source/Game/Quest/Quest.cs +++ b/Source/Game/Quest/Quest.cs @@ -239,7 +239,7 @@ namespace Game public void LoadQuestObjective(SQLFields fields) { - QuestObjective obj = new QuestObjective(); + QuestObjective obj = new(); obj.QuestID = fields.Read(0); obj.Id = fields.Read(1); obj.Type = (QuestObjectiveType)fields.Read(2); @@ -618,7 +618,7 @@ namespace Game public uint RewardMoneyDifficulty; public float RewardMoneyMultiplier; public uint RewardBonusMoney; - public List RewardDisplaySpell = new List(); + public List RewardDisplaySpell = new(); public uint RewardSpell { get; set; } public uint RewardHonor; public uint RewardKillHonor; @@ -664,7 +664,7 @@ namespace Game public int Expansion; public int ManagedWorldStateID; public int QuestSessionBonus; - public List Objectives = new List(); + public List Objectives = new(); public string LogTitle = ""; public string LogDescription = ""; public string QuestDescription = ""; @@ -711,7 +711,7 @@ namespace Game public QuestSpecialFlags SpecialFlags; // custom flags, not sniffed/WDB public uint ScriptId; - public List DependentPreviousQuests = new List(); + public List DependentPreviousQuests = new(); public QueryQuestInfoResponse QueryData; uint _rewChoiceItemsCount; @@ -748,35 +748,35 @@ namespace Game public class QuestGreetingLocale { - public StringArray Greeting = new StringArray((int)Locale.Total); + public StringArray Greeting = new((int)Locale.Total); } public class QuestTemplateLocale { - public StringArray LogTitle = new StringArray((int)Locale.Total); - public StringArray LogDescription = new StringArray((int)Locale.Total); - public StringArray QuestDescription = new StringArray((int)Locale.Total); - public StringArray AreaDescription = new StringArray((int)Locale.Total); - public StringArray PortraitGiverText = new StringArray((int)Locale.Total); - public StringArray PortraitGiverName = new StringArray((int)Locale.Total); - public StringArray PortraitTurnInText = new StringArray((int)Locale.Total); - public StringArray PortraitTurnInName = new StringArray((int)Locale.Total); - public StringArray QuestCompletionLog = new StringArray((int)Locale.Total); + public StringArray LogTitle = new((int)Locale.Total); + public StringArray LogDescription = new((int)Locale.Total); + public StringArray QuestDescription = new((int)Locale.Total); + public StringArray AreaDescription = new((int)Locale.Total); + public StringArray PortraitGiverText = new((int)Locale.Total); + public StringArray PortraitGiverName = new((int)Locale.Total); + public StringArray PortraitTurnInText = new((int)Locale.Total); + public StringArray PortraitTurnInName = new((int)Locale.Total); + public StringArray QuestCompletionLog = new((int)Locale.Total); } public class QuestRequestItemsLocale { - public StringArray CompletionText = new StringArray((int)Locale.Total); + public StringArray CompletionText = new((int)Locale.Total); } public class QuestObjectivesLocale { - public StringArray Description = new StringArray((int)Locale.Total); + public StringArray Description = new((int)Locale.Total); } public class QuestOfferRewardLocale { - public StringArray RewardText = new StringArray((int)Locale.Total); + public StringArray RewardText = new((int)Locale.Total); } public struct QuestRewardDisplaySpell diff --git a/Source/Game/Quest/QuestObjectiveCriteriaManager.cs b/Source/Game/Quest/QuestObjectiveCriteriaManager.cs index 08b32556a..fbf231076 100644 --- a/Source/Game/Quest/QuestObjectiveCriteriaManager.cs +++ b/Source/Game/Quest/QuestObjectiveCriteriaManager.cs @@ -54,7 +54,7 @@ namespace Game public static void DeleteFromDB(ObjectGuid guid) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA); stmt.AddValue(0, guid.GetCounter()); @@ -109,7 +109,7 @@ namespace Game if (criteria.Entry.StartTimer != 0 && date + criteria.Entry.StartTimer < now) continue; - CriteriaProgress progress = new CriteriaProgress(); + CriteriaProgress progress = new(); progress.Counter = counter; progress.Date = date; progress.Changed = false; @@ -209,7 +209,7 @@ namespace Game { foreach (var pair in _criteriaProgress) { - CriteriaUpdate criteriaUpdate = new CriteriaUpdate(); + CriteriaUpdate criteriaUpdate = new(); criteriaUpdate.CriteriaID = pair.Key; criteriaUpdate.Quantity = pair.Value.Counter; @@ -242,7 +242,7 @@ namespace Game public override void SendCriteriaUpdate(Criteria criteria, CriteriaProgress progress, uint timeElapsed, bool timedCompleted) { - CriteriaUpdate criteriaUpdate = new CriteriaUpdate(); + CriteriaUpdate criteriaUpdate = new(); criteriaUpdate.CriteriaID = criteria.Id; criteriaUpdate.Quantity = progress.Counter; @@ -260,7 +260,7 @@ namespace Game public override void SendCriteriaProgressRemoved(uint criteriaId) { - CriteriaDeleted criteriaDeleted = new CriteriaDeleted(); + CriteriaDeleted criteriaDeleted = new(); criteriaDeleted.CriteriaID = criteriaId; SendPacket(criteriaDeleted); } @@ -328,6 +328,6 @@ namespace Game Player _owner; - List _completedObjectives = new List(); + List _completedObjectives = new(); } } diff --git a/Source/Game/Reputation/ReputationManager.cs b/Source/Game/Reputation/ReputationManager.cs index 83d74e857..c4cac3dca 100644 --- a/Source/Game/Reputation/ReputationManager.cs +++ b/Source/Game/Reputation/ReputationManager.cs @@ -165,7 +165,7 @@ namespace Game public void SendForceReactions() { - SetForcedReactions setForcedReactions = new SetForcedReactions(); + SetForcedReactions setForcedReactions = new(); foreach (var pair in _forcedReactions) { @@ -180,7 +180,7 @@ namespace Game public void SendState(FactionState faction) { - SetFactionStanding setFactionStanding = new SetFactionStanding(); + SetFactionStanding setFactionStanding = new(); setFactionStanding.ReferAFriendBonus = 0.0f; setFactionStanding.BonusFromAchievementSystem = 0.0f; if (faction != null) @@ -204,7 +204,7 @@ namespace Game public void SendInitialReputations() { - InitializeFactions initFactions = new InitializeFactions(); + InitializeFactions initFactions = new(); foreach (var pair in _factions) { @@ -223,7 +223,7 @@ namespace Game return; //make faction visible / not visible in reputation list at client - SetFactionVisible packet = new SetFactionVisible(visible); + SetFactionVisible packet = new(visible); packet.FactionIndex = faction.ReputationListID; _player.SendPacket(packet); } @@ -241,7 +241,7 @@ namespace Game { if (factionEntry.CanHaveReputation()) { - FactionState newFaction = new FactionState(); + FactionState newFaction = new(); newFaction.Id = factionEntry.Id; newFaction.ReputationListID = (uint)factionEntry.ReputationIndex; newFaction.Standing = 0; @@ -659,8 +659,8 @@ namespace Game }; const int Reputation_Cap = 42999; const int Reputation_Bottom = -42000; - SortedDictionary _factions = new SortedDictionary(); - Dictionary _forcedReactions = new Dictionary(); + SortedDictionary _factions = new(); + Dictionary _forcedReactions = new(); } diff --git a/Source/Game/Scenarios/InstanceScenario.cs b/Source/Game/Scenarios/InstanceScenario.cs index 734bb13ad..3ea251dac 100644 --- a/Source/Game/Scenarios/InstanceScenario.cs +++ b/Source/Game/Scenarios/InstanceScenario.cs @@ -56,7 +56,7 @@ namespace Game.Scenarios return; } - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); foreach (var iter in _criteriaProgress) { if (!iter.Value.Changed) @@ -101,10 +101,10 @@ namespace Game.Scenarios SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) { - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); long now = Time.UnixTime; - List criteriaTrees = new List(); + List criteriaTrees = new(); do { uint id = result.Read(0); @@ -178,6 +178,6 @@ namespace Game.Scenarios } Map _map; - Dictionary> _stepCriteriaProgress = new Dictionary>(); + Dictionary> _stepCriteriaProgress = new(); } } diff --git a/Source/Game/Scenarios/Scenario.cs b/Source/Game/Scenarios/Scenario.cs index f541fd14f..4303eada9 100644 --- a/Source/Game/Scenarios/Scenario.cs +++ b/Source/Game/Scenarios/Scenario.cs @@ -109,7 +109,7 @@ namespace Game.Scenarios if (step != null) SetStepState(step, ScenarioStepState.InProgress); - ScenarioState scenarioState = new ScenarioState(); + ScenarioState scenarioState = new(); BuildScenarioState(scenarioState); SendPacket(scenarioState); } @@ -155,7 +155,7 @@ namespace Game.Scenarios public override void SendCriteriaUpdate(Criteria criteria, CriteriaProgress progress, uint timeElapsed, bool timedCompleted) { - ScenarioProgressUpdate progressUpdate = new ScenarioProgressUpdate(); + ScenarioProgressUpdate progressUpdate = new(); progressUpdate.CriteriaProgress.Id = criteria.Id; progressUpdate.CriteriaProgress.Quantity = progress.Counter; progressUpdate.CriteriaProgress.Player = progress.PlayerGUID; @@ -279,14 +279,14 @@ namespace Game.Scenarios public void SendScenarioState(Player player) { - ScenarioState scenarioState = new ScenarioState(); + ScenarioState scenarioState = new(); BuildScenarioState(scenarioState); player.SendPacket(scenarioState); } List GetBonusObjectivesData() { - List bonusObjectivesData = new List(); + List bonusObjectivesData = new(); foreach (var step in _data.Steps.Values) { if (!step.IsBonusObjective()) @@ -306,13 +306,13 @@ namespace Game.Scenarios List GetCriteriasProgress() { - List criteriasProgress = new List(); + List criteriasProgress = new(); if (!_criteriaProgress.Empty()) { foreach (var pair in _criteriaProgress) { - CriteriaProgressPkt criteriaProgress = new CriteriaProgressPkt(); + CriteriaProgressPkt criteriaProgress = new(); criteriaProgress.Id = pair.Key; criteriaProgress.Quantity = pair.Value.Counter; criteriaProgress.Date = pair.Value.Date; @@ -331,7 +331,7 @@ namespace Game.Scenarios void SendBootPlayer(Player player) { - ScenarioVacate scenarioBoot = new ScenarioVacate(); + ScenarioVacate scenarioBoot = new(); scenarioBoot.ScenarioID = (int)_data.Entry.Id; player.SendPacket(scenarioBoot); } @@ -348,10 +348,10 @@ namespace Game.Scenarios public override void AfterCriteriaTreeUpdate(CriteriaTree tree, Player referencePlayer) { } public override void SendAllData(Player receiver) { } - List _players = new List(); + List _players = new(); ScenarioData _data; ScenarioStepRecord _currentstep; - Dictionary _stepStates = new Dictionary(); + Dictionary _stepStates = new(); } public enum ScenarioStepState diff --git a/Source/Game/Scenarios/ScenarioManager.cs b/Source/Game/Scenarios/ScenarioManager.cs index 2071db4b1..b614901cd 100644 --- a/Source/Game/Scenarios/ScenarioManager.cs +++ b/Source/Game/Scenarios/ScenarioManager.cs @@ -95,7 +95,7 @@ namespace Game.Scenarios if (scenarioHordeId == 0) scenarioHordeId = scenarioAllianceId; - ScenarioDBData data = new ScenarioDBData(); + ScenarioDBData data = new(); data.MapID = mapId; data.DifficultyID = difficulty; data.Scenario_A = scenarioAllianceId; @@ -111,7 +111,7 @@ namespace Game.Scenarios { _scenarioData.Clear(); - Dictionary> scenarioSteps = new Dictionary>(); + Dictionary> scenarioSteps = new(); uint deepestCriteriaTreeSize = 0; foreach (ScenarioStepRecord step in CliDB.ScenarioStepStorage.Values) @@ -136,7 +136,7 @@ namespace Game.Scenarios foreach (ScenarioRecord scenario in CliDB.ScenarioStorage.Values) { - ScenarioData data = new ScenarioData(); + ScenarioData data = new(); data.Entry = scenario; data.Steps = scenarioSteps.LookupByKey(scenario.Id); _scenarioData[scenario.Id] = data; @@ -160,7 +160,7 @@ namespace Game.Scenarios } List[][] POIs = new List[0][]; - Dictionary> allPoints = new Dictionary>(); + Dictionary> allPoints = new(); // 0 1 2 3 4 SQLResult pointsResult = DB.World.Query("SELECT CriteriaTreeID, Idx1, X, Y, Z FROM scenario_poi_points ORDER BY CriteriaTreeID DESC, Idx1, Idx2"); @@ -225,15 +225,15 @@ namespace Game.Scenarios return _scenarioPOIStore[CriteriaTreeID]; } - Dictionary _scenarioData = new Dictionary(); - MultiMap _scenarioPOIStore = new MultiMap(); - Dictionary, ScenarioDBData> _scenarioDBData = new Dictionary, ScenarioDBData>(); + Dictionary _scenarioData = new(); + MultiMap _scenarioPOIStore = new(); + Dictionary, ScenarioDBData> _scenarioDBData = new(); } public class ScenarioData { public ScenarioRecord Entry; - public Dictionary Steps = new Dictionary(); + public Dictionary Steps = new(); } class ScenarioDBData @@ -268,7 +268,7 @@ namespace Game.Scenarios public int WorldEffectID; public int PlayerConditionID; public int NavigationPlayerConditionID; - public List Points = new List(); + public List Points = new(); public ScenarioPOI(int blobIndex, int mapID, int uiMapID, int priority, int flags, int worldEffectID, int playerConditionID, int navigationPlayerConditionID, List points) { diff --git a/Source/Game/Scripting/ScriptManager.cs b/Source/Game/Scripting/ScriptManager.cs index 33de413f6..77e1721c4 100644 --- a/Source/Game/Scripting/ScriptManager.cs +++ b/Source/Game/Scripting/ScriptManager.cs @@ -1259,13 +1259,13 @@ namespace Game.Scripting } uint _ScriptCount; - public Dictionary spellSummaryStorage = new Dictionary(); - Hashtable ScriptStorage = new Hashtable(); + public Dictionary spellSummaryStorage = new(); + Hashtable ScriptStorage = new(); - Dictionary _waypointStore = new Dictionary(); + Dictionary _waypointStore = new(); // creature entry + chain ID - MultiMap, SplineChainLink> m_mSplineChainsMap = new MultiMap, SplineChainLink>(); // spline chains + MultiMap, SplineChainLink> m_mSplineChainsMap = new(); // spline chains } public interface IScriptRegistry @@ -1348,7 +1348,7 @@ namespace Game.Scripting // Counter used for code-only scripts. uint _scriptIdCounter; - Dictionary ScriptMap = new Dictionary(); + Dictionary ScriptMap = new(); } public class SpellSummary diff --git a/Source/Game/Scripting/SpellScript.cs b/Source/Game/Scripting/SpellScript.cs index 5afcc5aa4..bdbc56bc7 100644 --- a/Source/Game/Scripting/SpellScript.cs +++ b/Source/Game/Scripting/SpellScript.cs @@ -264,7 +264,7 @@ namespace Game.Scripting if (effect.TargetA.GetTarget() != _targetType && effect.TargetB.GetTarget() != _targetType) return false; - SpellImplicitTargetInfo targetInfo = new SpellImplicitTargetInfo(_targetType); + SpellImplicitTargetInfo targetInfo = new(_targetType); switch (targetInfo.GetSelectionCategory()) { case SpellTargetSelectionCategories.Channel: // SINGLE @@ -445,32 +445,32 @@ namespace Game.Scripting // SpellScript interface // hooks to which you can attach your functions - public List BeforeCast = new List(); - public List OnCast = new List(); - public List AfterCast = new List(); + public List BeforeCast = new(); + public List OnCast = new(); + public List AfterCast = new(); // where function is SpellCastResult function() - public List OnCheckCast = new List(); + public List OnCheckCast = new(); // where function is void function(uint effIndex) - public List OnEffectLaunch = new List(); - public List OnEffectLaunchTarget = new List(); - public List OnEffectHit = new List(); - public List OnEffectHitTarget = new List(); - public List OnEffectSuccessfulDispel = new List(); + public List OnEffectLaunch = new(); + public List OnEffectLaunchTarget = new(); + public List OnEffectHit = new(); + public List OnEffectHitTarget = new(); + public List OnEffectSuccessfulDispel = new(); - public List BeforeHit = new List(); - public List OnHit = new List(); - public List AfterHit = new List(); + public List BeforeHit = new(); + public List OnHit = new(); + public List AfterHit = new(); // where function is void function(List targets) - public List OnObjectAreaTargetSelect = new List(); + public List OnObjectAreaTargetSelect = new(); // where function is void function(ref WorldObject target) - public List OnObjectTargetSelect = new List(); + public List OnObjectTargetSelect = new(); // where function is void function(SpellDestination target) - public List OnDestinationTargetSelect = new List(); + public List OnDestinationTargetSelect = new(); // hooks are executed in following order, at specified event of spell: // 1. BeforeCast - executed when spell preparation is finished (when cast bar becomes full) before cast is handled @@ -1168,7 +1168,7 @@ namespace Game.Scripting _defaultActionPrevented = defaultActionPrevented; } } - Stack m_scriptStates = new Stack(); + Stack m_scriptStates = new(); // AuraScript interface // hooks to which you can attach your functions @@ -1176,124 +1176,124 @@ namespace Game.Scripting // executed when area aura checks if it can be applied on target // example: OnEffectApply += AuraEffectApplyFn(class.function); // where function is: bool function (Unit target); - public List DoCheckAreaTarget = new List(); + public List DoCheckAreaTarget = new(); // executed when aura is dispelled by a unit // example: OnDispel += AuraDispelFn(class.function); // where function is: void function (DispelInfo dispelInfo); - public List OnDispel = new List(); + public List OnDispel = new(); // executed after aura is dispelled by a unit // example: AfterDispel += AuraDispelFn(class.function); // where function is: void function (DispelInfo dispelInfo); - public List AfterDispel = new List(); + public List AfterDispel = new(); // executed when aura effect is applied with specified mode to target // should be used when when effect handler preventing/replacing is needed, do not use this hook for triggering spellcasts/removing auras etc - may be unsafe // example: OnEffectApply += AuraEffectApplyFn(class.function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes); // where function is: void function (AuraEffect aurEff, AuraEffectHandleModes mode); - public List OnEffectApply = new List(); + public List OnEffectApply = new(); // executed after aura effect is applied with specified mode to target // example: AfterEffectApply += AuraEffectApplyFn(class.function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes); // where function is: void function (AuraEffect aurEff, AuraEffectHandleModes mode); - public List AfterEffectApply = new List(); + public List AfterEffectApply = new(); // executed after aura effect is removed with specified mode from target // should be used when when effect handler preventing/replacing is needed, do not use this hook for triggering spellcasts/removing auras etc - may be unsafe // example: OnEffectRemove += AuraEffectRemoveFn(class.function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes); // where function is: void function (AuraEffect aurEff, AuraEffectHandleModes mode); - public List OnEffectRemove = new List(); + public List OnEffectRemove = new(); // executed when aura effect is removed with specified mode from target // example: AfterEffectRemove += AuraEffectRemoveFn(class.function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes); // where function is: void function (AuraEffect aurEff, AuraEffectHandleModes mode); - public List AfterEffectRemove = new List(); + public List AfterEffectRemove = new(); // executed when periodic aura effect ticks on target // example: OnEffectPeriodic += AuraEffectPeriodicFn(class.function, EffectIndexSpecifier, EffectAuraNameSpecifier); // where function is: void function (AuraEffect aurEff); - public List OnEffectPeriodic = new List(); + public List OnEffectPeriodic = new(); // executed when periodic aura effect is updated // example: OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(class.function, EffectIndexSpecifier, EffectAuraNameSpecifier); // where function is: void function (AuraEffect aurEff); - public List OnEffectUpdatePeriodic = new List(); + public List OnEffectUpdatePeriodic = new(); // executed when aura effect calculates amount // example: DoEffectCalcAmount += AuraEffectCalcAmounFn(class.function, EffectIndexSpecifier, EffectAuraNameSpecifier); // where function is: void function (AuraEffect aurEff, int& amount, bool& canBeRecalculated); - public List DoEffectCalcAmount = new List(); + public List DoEffectCalcAmount = new(); // executed when aura effect calculates periodic data // example: DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(class.function, EffectIndexSpecifier, EffectAuraNameSpecifier); // where function is: void function (AuraEffect aurEff, bool& isPeriodic, int& amplitude); - public List DoEffectCalcPeriodic = new List(); + public List DoEffectCalcPeriodic = new(); // executed when aura effect calculates spellmod // example: DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(class.function, EffectIndexSpecifier, EffectAuraNameSpecifier); // where function is: void function (AuraEffect aurEff, SpellModifier& spellMod); - public List DoEffectCalcSpellMod = new List(); + public List DoEffectCalcSpellMod = new(); // executed when absorb aura effect is going to reduce damage // example: OnEffectAbsorb += AuraEffectAbsorbFn(class.function, EffectIndexSpecifier); // where function is: void function (AuraEffect aurEff, DamageInfo& dmgInfo, uint& absorbAmount); - public List OnEffectAbsorb = new List(); + public List OnEffectAbsorb = new(); // executed after absorb aura effect reduced damage to target - absorbAmount is real amount absorbed by aura // example: AfterEffectAbsorb += AuraEffectAbsorbFn(class.function, EffectIndexSpecifier); // where function is: void function (AuraEffect aurEff, DamageInfo& dmgInfo, uint& absorbAmount); - public List AfterEffectAbsorb = new List(); + public List AfterEffectAbsorb = new(); // executed when mana shield aura effect is going to reduce damage // example: OnEffectManaShield += AuraEffectAbsorbFn(class.function, EffectIndexSpecifier); // where function is: void function (AuraEffect aurEff, DamageInfo& dmgInfo, uint& absorbAmount); - public List OnEffectManaShield = new List(); + public List OnEffectManaShield = new(); // executed after mana shield aura effect reduced damage to target - absorbAmount is real amount absorbed by aura // example: AfterEffectManaShield += AuraEffectAbsorbFn(class.function, EffectIndexSpecifier); // where function is: void function (AuraEffect aurEff, DamageInfo& dmgInfo, uint& absorbAmount); - public List AfterEffectManaShield = new List(); + public List AfterEffectManaShield = new(); // executed when the caster of some spell with split dmg aura gets damaged through it // example: OnEffectSplit += AuraEffectSplitFn(class.function, EffectIndexSpecifier); // where function is: void function (AuraEffect aurEff, DamageInfo& dmgInfo, uint& splitAmount); - public List OnEffectSplit = new List(); + public List OnEffectSplit = new(); // executed when aura checks if it can proc // example: DoCheckProc += AuraCheckProcFn(class.function); // where function is: bool function (ProcEventInfo& eventInfo); - public List DoCheckProc = new List(); + public List DoCheckProc = new(); // executed when aura effect checks if it can proc the aura // example: DoCheckEffectProc += AuraCheckEffectProcFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier); // where function is bool function (AuraEffect const* aurEff, ProcEventInfo& eventInfo); - public List DoCheckEffectProc = new List(); + public List DoCheckEffectProc = new(); // executed before aura procs (possibility to prevent charge drop/cooldown) // example: DoPrepareProc += AuraProcFn(class.function); // where function is: void function (ProcEventInfo& eventInfo); - public List DoPrepareProc = new List(); + public List DoPrepareProc = new(); // executed when aura procs // example: OnProc += AuraProcFn(class.function); // where function is: void function (ProcEventInfo& eventInfo); - public List OnProc = new List(); + public List OnProc = new(); // executed after aura proced // example: AfterProc += AuraProcFn(class.function); // where function is: void function (ProcEventInfo& eventInfo); - public List AfterProc = new List(); + public List AfterProc = new(); // executed when aura effect procs // example: OnEffectProc += AuraEffectProcFn(class.function, EffectIndexSpecifier, EffectAuraNameSpecifier); // where function is: void function (AuraEffect aurEff, ProcEventInfo& procInfo); - public List OnEffectProc = new List(); + public List OnEffectProc = new(); // executed after aura effect proced // example: AfterEffectProc += AuraEffectProcFn(class.function, EffectIndexSpecifier, EffectAuraNameSpecifier); // where function is: void function (AuraEffect aurEff, ProcEventInfo& procInfo); - public List AfterEffectProc = new List(); + public List AfterEffectProc = new(); // AuraScript interface - hook/effect execution manipulators diff --git a/Source/Game/Server/WorldConfig.cs b/Source/Game/Server/WorldConfig.cs index 5b448bd6b..fc0cb7e1f 100644 --- a/Source/Game/Server/WorldConfig.cs +++ b/Source/Game/Server/WorldConfig.cs @@ -1021,6 +1021,6 @@ namespace Game Values[confi] = value; } - static Dictionary Values = new Dictionary(); + static Dictionary Values = new(); } } diff --git a/Source/Game/Server/WorldManager.cs b/Source/Game/Server/WorldManager.cs index de183a800..79e5468dc 100644 --- a/Source/Game/Server/WorldManager.cs +++ b/Source/Game/Server/WorldManager.cs @@ -246,7 +246,7 @@ namespace Game if (!linkInfo.Item1.IsOpen()) return; - ConnectToKey key = new ConnectToKey(); + ConnectToKey key = new(); key.Raw = linkInfo.Item2; WorldSession session = FindSession(key.AccountId); @@ -422,7 +422,7 @@ namespace Game //Load weighted graph on taxi nodes path Global.TaxiPathGraph.Initialize(); - MultiMap mapData = new MultiMap(); + MultiMap mapData = new(); foreach (MapRecord mapEntry in CliDB.MapStorage.Values) { if (mapEntry.ParentMapID != -1) @@ -1471,7 +1471,7 @@ namespace Game // Send a System Message to all players (except self if mentioned) public void SendWorldText(CypherStrings string_id, params object[] args) { - WorldWorldTextBuilder wt_builder = new WorldWorldTextBuilder((uint)string_id, args); + WorldWorldTextBuilder wt_builder = new((uint)string_id, args); var wt_do = new LocalizedPacketListDo(wt_builder); foreach (var session in m_sessions.Values) { @@ -1522,7 +1522,7 @@ namespace Game // Send a System Message to all players in the zone (except self if mentioned) public void SendZoneText(uint zone, string text, WorldSession self = null, uint team = 0) { - ChatPkt data = new ChatPkt(); + ChatPkt data = new(); data.Initialize(ChatMsg.System, Language.Universal, null, null, text); SendZoneMessage(zone, data, self, team); } @@ -1601,7 +1601,7 @@ namespace Game } // Disconnect all affected players (for IP it can be several) - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); do { uint account = resultAccounts.Read(0); @@ -1682,7 +1682,7 @@ namespace Game guid = pBanned.GetGUID(); //Use transaction in order to ensure the order of the queries - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); // make sure there is only one active ban PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER_BAN); @@ -1828,7 +1828,7 @@ namespace Game public void SendServerMessage(ServerMessageType messageID, string stringParam = "", Player player = null) { - ChatServerMessage packet = new ChatServerMessage(); + ChatServerMessage packet = new(); packet.MessageID = (int)messageID; if (messageID <= ServerMessageType.String) packet.StringParam = stringParam; @@ -1854,7 +1854,7 @@ namespace Game foreach (var pair in m_sessions) { WorldSession session = pair.Value; - WorldSessionFilter updater = new WorldSessionFilter(session); + WorldSessionFilter updater = new(session); if (!session.Update(diff, updater)) // As interval = 0 { if (!RemoveQueuedPlayer(session) && session != null && WorldConfig.GetIntValue(WorldCfg.IntervalDisconnectTolerance) != 0) @@ -1903,7 +1903,7 @@ namespace Game uint Id = result.Read(0); uint charCount = result.Read(1); - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_REALM_CHARACTERS_BY_REALM); stmt.AddValue(0, Id); @@ -2393,7 +2393,7 @@ namespace Game ShutdownExitCode m_ExitCode; public bool IsStopped; - Dictionary m_Autobroadcasts = new Dictionary(); + Dictionary m_Autobroadcasts = new(); CleaningFlags m_CleaningFlags; @@ -2407,24 +2407,24 @@ namespace Game bool m_isClosed; - Dictionary m_timers = new Dictionary(); + Dictionary m_timers = new(); long mail_timer; long mail_timer_expires; long blackmarket_timer; - ConcurrentDictionary m_sessions = new ConcurrentDictionary(); - Dictionary m_disconnects = new Dictionary(); + ConcurrentDictionary m_sessions = new(); + Dictionary m_disconnects = new(); uint m_maxActiveSessionCount; uint m_maxQueuedSessionCount; uint m_PlayerCount; uint m_MaxPlayerCount; - Dictionary m_worldstates = new Dictionary(); + Dictionary m_worldstates = new(); uint m_playerLimit; AccountTypes m_allowedSecurityLevel; Locale m_defaultDbcLocale; // from config for one from loaded DBC locales BitSet m_availableDbcLocaleMask; // by loaded DBC - List m_motd = new List(); + List m_motd = new(); // scheduled reset times long m_NextDailyQuestReset; @@ -2434,12 +2434,12 @@ namespace Game long m_NextGuildReset; long m_NextCurrencyReset; - List m_QueuedPlayer = new List(); - ConcurrentQueue addSessQueue = new ConcurrentQueue(); + List m_QueuedPlayer = new(); + ConcurrentQueue addSessQueue = new(); - ConcurrentQueue> _linkSocketQueue = new ConcurrentQueue>(); + ConcurrentQueue> _linkSocketQueue = new(); - AsyncCallbackProcessor _queryProcessor = new AsyncCallbackProcessor(); + AsyncCallbackProcessor _queryProcessor = new(); Realm _realm; @@ -2450,7 +2450,7 @@ namespace Game string _guidWarningMsg; string _alertRestartReason; - object _guidAlertLock = new object(); + object _guidAlertLock = new(); bool _guidWarn; bool _guidAlert; @@ -2526,7 +2526,7 @@ namespace Game if (i_args != null) text = string.Format(text, i_args); - ChatPkt messageChat = new ChatPkt(); + ChatPkt messageChat = new(); var lines = new StringArray(text, "\n"); for (var i = 0; i < lines.Length; ++i) diff --git a/Source/Game/Server/WorldSession.cs b/Source/Game/Server/WorldSession.cs index 286b94d3d..cbc05da4b 100644 --- a/Source/Game/Server/WorldSession.cs +++ b/Source/Game/Server/WorldSession.cs @@ -218,7 +218,7 @@ namespace Game //! Send the 'logout complete' packet to the client //! Client will respond by sending 3x CMSG_CANCEL_TRADE, which we currently dont handle - LogoutComplete logoutComplete = new LogoutComplete(); + LogoutComplete logoutComplete = new(); SendPacket(logoutComplete); //! Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline @@ -468,7 +468,7 @@ namespace Game _instanceConnectKey.connectionType = ConnectionType.Instance; _instanceConnectKey.Key = RandomHelper.URand(0, 0x7FFFFFFF); - ConnectTo connectTo = new ConnectTo(); + ConnectTo connectTo = new(); connectTo.Key = _instanceConnectKey.Raw; connectTo.Serial = serial; connectTo.Payload.Port = (ushort)WorldConfig.GetIntValue(WorldCfg.PortInstance); @@ -553,7 +553,7 @@ namespace Game public void SendTutorialsData() { - TutorialFlags packet = new TutorialFlags(); + TutorialFlags packet = new(); Array.Copy(tutorials, packet.TutorialData, (int)AccountDataTypes.Max); SendPacket(packet); } @@ -592,7 +592,7 @@ namespace Game public string GetPlayerInfo() { - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); ss.Append("[Player: "); if (!m_playerLoading.IsEmpty()) ss.AppendFormat("Logging in: {0}, ", m_playerLoading.ToString()); @@ -721,10 +721,10 @@ namespace Game public void InitializeSession() { - AccountInfoQueryHolderPerRealm realmHolder = new AccountInfoQueryHolderPerRealm(); + AccountInfoQueryHolderPerRealm realmHolder = new(); realmHolder.Initialize(GetAccountId(), GetBattlenetAccountId()); - AccountInfoQueryHolder holder = new AccountInfoQueryHolder(); + AccountInfoQueryHolder holder = new(); holder.Initialize(GetAccountId(), GetBattlenetAccountId()); _realmAccountLoginCallback = DB.Characters.DelayQueryHolder(realmHolder); @@ -764,7 +764,7 @@ namespace Game } while (result.NextRow()); } - ConnectionStatus bnetConnected = new ConnectionStatus(); + ConnectionStatus bnetConnected = new(); bnetConnected.State = 1; SendPacket(bnetConnected); @@ -851,7 +851,7 @@ namespace Game } #region Fields - List _legitCharacters = new List(); + List _legitCharacters = new(); ulong m_GUIDLow; Player _player; WorldSocket[] m_Socket = new WorldSocket[(int)ConnectionType.Max]; @@ -886,12 +886,12 @@ namespace Game uint[] tutorials = new uint[SharedConst.MaxAccountTutorialValues]; TutorialsFlag tutorialsChanged; - Array _realmListSecret = new Array(32); - Dictionary _realmCharacterCounts = new Dictionary(); - Dictionary> _battlenetResponseCallbacks = new Dictionary>(); + Array _realmListSecret = new(32); + Dictionary _realmCharacterCounts = new(); + Dictionary> _battlenetResponseCallbacks = new(); uint _battlenetRequestToken; - List _registeredAddonPrefixes = new List(); + List _registeredAddonPrefixes = new(); bool _filterAddonMessages; uint recruiterId; bool isRecruiter; @@ -899,7 +899,7 @@ namespace Game public long m_muteTime; long m_timeOutTime; - ConcurrentQueue _recvQueue = new ConcurrentQueue(); + ConcurrentQueue _recvQueue = new(); RBACData _RBACData; ObjectGuid m_currentBankerGUID; @@ -915,8 +915,8 @@ namespace Game Task> _charLoginCallback; Task> _charEnumCallback; - AsyncCallbackProcessor _queryProcessor = new AsyncCallbackProcessor(); - AsyncCallbackProcessor _transactionCallbacks = new AsyncCallbackProcessor(); + AsyncCallbackProcessor _queryProcessor = new(); + AsyncCallbackProcessor _transactionCallbacks = new(); #endregion } @@ -1001,7 +1001,7 @@ namespace Game Policy _policy; WorldSession Session; - Dictionary _PacketThrottlingMap = new Dictionary(); + Dictionary _PacketThrottlingMap = new(); enum Policy { diff --git a/Source/Game/Services/GameUtilitiesService.cs b/Source/Game/Services/GameUtilitiesService.cs index da233e4e4..6673716d6 100644 --- a/Source/Game/Services/GameUtilitiesService.cs +++ b/Source/Game/Services/GameUtilitiesService.cs @@ -31,7 +31,7 @@ namespace Game BattlenetRpcErrorCode HandleProcessClientRequest(ClientRequest request, ClientResponse response) { Bgs.Protocol.Attribute command = null; - Dictionary Params = new Dictionary(); + Dictionary Params = new(); for (int i = 0; i < request.Attribute.Count; ++i) { @@ -78,7 +78,7 @@ namespace Game if (compressed.Empty()) return BattlenetRpcErrorCode.UtilServerFailedToSerializeResponse; - Bgs.Protocol.Attribute attribute = new Bgs.Protocol.Attribute(); + Bgs.Protocol.Attribute attribute = new(); attribute.Name = "Param_RealmList"; attribute.Value = new Bgs.Protocol.Variant(); attribute.Value.BlobValue = ByteString.CopyFrom(compressed); @@ -87,7 +87,7 @@ namespace Game var realmCharacterCounts = new RealmCharacterCountList(); foreach (var characterCount in GetRealmCharacterCounts()) { - RealmCharacterCountEntry countEntry = new RealmCharacterCountEntry(); + RealmCharacterCountEntry countEntry = new(); countEntry.WowRealmAddress = (int)characterCount.Key; countEntry.Count = characterCount.Value; realmCharacterCounts.Counts.Add(countEntry); diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index 34d2bb7c4..024f6b02f 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -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 targets = new Dictionary(); + Dictionary targets = new(); FillTargetMap(ref targets, caster); - List targetsToRemove = new List(); + List 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 targetList = new List(); + List 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 m_loadedScripts = new List(); + List 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 m_periodicCosts = new List();// Periodic costs + List 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 m_applications = new Dictionary(); + Dictionary 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 m_removedApplications = new List(); + List m_removedApplications = new(); #endregion } @@ -2580,7 +2580,7 @@ namespace Game.Spells if (effect == null || !HasEffect(effect.EffectIndex)) continue; - List targetList = new List(); + List 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 targetList = new List(); + List 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); diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 30c9418aa..dc3925e8d 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -1582,7 +1582,7 @@ namespace Game.Spells if (apply) { - List targets = new List(); + List 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 dest = new List(); + List 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 summonedEntries = new List(); + List 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 nearbyEntries = new List(); + List 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(); diff --git a/Source/Game/Spells/Skills/SkillDiscovery.cs b/Source/Game/Spells/Skills/SkillDiscovery.cs index 56023d598..b4803208b 100644 --- a/Source/Game/Spells/Skills/SkillDiscovery.cs +++ b/Source/Game/Spells/Skills/SkillDiscovery.cs @@ -44,8 +44,8 @@ namespace Game.Spells uint count = 0; - StringBuilder ssNonDiscoverableEntries = new StringBuilder(); - List reportedReqSpells = new List(); + StringBuilder ssNonDiscoverableEntries = new(); + List reportedReqSpells = new(); do { @@ -226,7 +226,7 @@ namespace Game.Spells return 0; } - static MultiMap SkillDiscoveryStorage = new MultiMap(); + static MultiMap SkillDiscoveryStorage = new(); } public class SkillDiscoveryEntry diff --git a/Source/Game/Spells/Skills/SkillExtraItems.cs b/Source/Game/Spells/Skills/SkillExtraItems.cs index 533d4e7cb..f7c777894 100644 --- a/Source/Game/Spells/Skills/SkillExtraItems.cs +++ b/Source/Game/Spells/Skills/SkillExtraItems.cs @@ -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 SkillExtraItemStorage = new Dictionary(); + static Dictionary SkillExtraItemStorage = new(); } class SkillExtraItemEntry @@ -199,7 +199,7 @@ namespace Game.Spells return true; } - static Dictionary SkillPerfectItemStorage = new Dictionary(); + static Dictionary SkillPerfectItemStorage = new(); } // struct to store information about perfection procs diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 8c908bfce..055ebc164 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -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 targets = new List(); + List 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 targets = new List(); + List 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 targets = new List(); + List 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 targets = new List(); + List 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 tempTargets = new List(); + List 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 dest = new List(); + List 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 dest = new List(); + List 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 m_loadedScripts = new List(); + List m_loadedScripts = new(); int CalculateDamage(uint i, Unit target) { @@ -7401,12 +7401,12 @@ namespace Game.Spells } #region Fields - MultiMap _powerDrainTargets = new MultiMap(); - MultiMap _extraAttacksTargets = new MultiMap(); - MultiMap _durabilityDamageTargets = new MultiMap(); - MultiMap _genericVictimTargets = new MultiMap(); - MultiMap _tradeSkillTargets = new MultiMap(); - MultiMap _feedPetTargets = new MultiMap(); + MultiMap _powerDrainTargets = new(); + MultiMap _extraAttacksTargets = new(); + MultiMap _durabilityDamageTargets = new(); + MultiMap _genericVictimTargets = new(); + MultiMap _tradeSkillTargets = new(); + MultiMap _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 m_powerCost = new List(); + List 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 m_UniqueTargetInfo = new List(); + List m_UniqueTargetInfo = new(); uint m_channelTargetEffectMask; // Mask req. alive targets - List m_UniqueGOTargetInfo = new List(); + List m_UniqueGOTargetInfo = new(); - List m_UniqueItemInfo = new List(); + List m_UniqueItemInfo = new(); SpellDestination[] m_destTargets = new SpellDestination[SpellConst.MaxEffects]; - List m_hitTriggerSpells = new List(); + List m_hitTriggerSpells = new(); SpellState m_spellState; int m_timer; diff --git a/Source/Game/Spells/SpellCastTargets.cs b/Source/Game/Spells/SpellCastTargets.cs index fbeae13a3..d3023edb8 100644 --- a/Source/Game/Spells/SpellCastTargets.cs +++ b/Source/Game/Spells/SpellCastTargets.cs @@ -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; diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 403bd53d3..8ec3127b6 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -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 values = new Dictionary(); + Dictionary 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 values = new Dictionary(); + Dictionary values = new(); // set basepoints for trigger with value effect if (effectInfo.Effect == SpellEffectName.TriggerMissileSpellWithValue) { @@ -484,7 +484,7 @@ namespace Game.Spells } } - Dictionary values = new Dictionary(); + Dictionary 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 dest = new List(); + List 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 dest = new List(); + List 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 dest = new List(); + List 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 successList = new List(); + List 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 attackerSet = new List(); + List 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> dispel_list = new List>(); + List> 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 stealList = new List(); + List 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> successList = new List>(); + List> 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 bonusList = new List(); + List 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; diff --git a/Source/Game/Spells/SpellHistory.cs b/Source/Game/Spells/SpellHistory.cs index 5df4e5417..5c1e51745 100644 --- a/Source/Game/Spells/SpellHistory.cs +++ b/Source/Game/Spells/SpellHistory.cs @@ -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(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, bool> predicate, bool update = false) { - List resetCooldowns = new List(); + List resetCooldowns = new(); foreach (var pair in _spellCooldowns) { if (predicate(pair)) @@ -568,7 +568,7 @@ namespace Game.Spells Player playerOwner = GetPlayerOwner(); if (playerOwner) { - List cooldowns = new List(); + List 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 knownSpells = new List(); + List 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 _spellCooldowns = new Dictionary(); - Dictionary _spellCooldownsBeforeDuel = new Dictionary(); - Dictionary _categoryCooldowns = new Dictionary(); + Dictionary _spellCooldowns = new(); + Dictionary _spellCooldownsBeforeDuel = new(); + Dictionary _categoryCooldowns = new(); DateTime[] _schoolLockouts = new DateTime[(int)SpellSchools.Max]; - MultiMap _categoryCharges = new MultiMap(); - Dictionary _globalCooldowns = new Dictionary(); + MultiMap _categoryCharges = new(); + Dictionary _globalCooldowns = new(); public class CooldownEntry { diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index aab45c30b..6b7819e12 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -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 CalcPowerCost(Unit caster, SpellSchoolMask schoolMask, Spell spell = null) { - List costs = new List(); + List 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 ProcPPMMods = new List(); + List 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 _visuals = new List(); + List _visuals = new(); SpellSpecificType _spellSpecific; AuraStateType _auraState; @@ -4852,8 +4852,8 @@ namespace Game.Spells public uint DispelImmune; public uint DamageSchoolMask; - public List AuraTypeImmune = new List(); - public List SpellEffectImmune = new List(); + public List AuraTypeImmune = new(); + public List SpellEffectImmune = new(); } } diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index 91265ae03..55734f749 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -333,7 +333,7 @@ namespace Game.Entities public void GetSetOfSpellsInSpellGroup(SpellGroup group_id, out List foundSpells) { - List usedGroups = new List(); + List 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 groups = new List(); + List groups = new(); foreach (var group in spellGroup1) { if (IsSpellMemberOfSpellGroup(spellid_2, group)) @@ -694,8 +694,8 @@ namespace Game.Entities { uint oldMSTime = Time.GetMSTime(); - Dictionary chains = new Dictionary(); - List hasPrev = new List(); + Dictionary chains = new(); + List 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(0); uint effIndex = result.Read(1); - SpellTargetPosition st = new SpellTargetPosition(); + SpellTargetPosition st = new(); st.target_mapId = result.Read(2); st.target_X = result.Read(3); st.target_Y = result.Read(4); @@ -1117,7 +1117,7 @@ namespace Game.Entities return; } - List groups = new List(); + List groups = new(); uint count = 0; do { @@ -1182,7 +1182,7 @@ namespace Game.Entities mSpellGroupStack.Clear(); // need for reload case mSpellSameEffectStack.Clear(); - List sameEffectGroups = new List(); + List 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 auraTypes = new List(); + List auraTypes = new(); // we have to 'guess' what effect this group corresponds to { - List frequencyContainer = new List(); + List 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(1); baseProcEntry.SpellFamilyName = (SpellFamilyNames)result.Read(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(1); ste.pctMod = result.Read(2); ste.apPctMod = result.Read(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(1); spe.ProcsPerMinute = result.Read(2); spe.HitMask = result.Read(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(0); - SpellArea spellArea = new SpellArea(); + SpellArea spellArea = new(); spellArea.spellId = spell; spellArea.areaId = result.Read(1); spellArea.questStart = result.Read(2); @@ -2151,7 +2151,7 @@ namespace Game.Entities mSpellInfoMap.Clear(); var loadData = new Dictionary<(uint Id, Difficulty difficulty), SpellInfoLoadHelper>(); - Dictionary battlePetSpeciesByCreature = new Dictionary(); + Dictionary 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(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(2); spellInfo.Dispel = (DispelType)spellsResult.Read(3); spellInfo.Mechanic = (Mechanics)spellsResult.Read(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 talentSpells = new List(); + List talentSpells = new(); foreach (var talentInfo in CliDB.TalentStorage.Values) talentSpells.Add(talentInfo.SpellID); @@ -3654,7 +3654,7 @@ namespace Game.Entities public void LoadPetFamilySpellsStore() { - Dictionary levelsBySpell = new Dictionary(); + Dictionary 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 mSpellChains = new Dictionary(); - MultiMap mSpellsReqSpell = new MultiMap(); - MultiMap mSpellReq = new MultiMap(); - Dictionary mSpellLearnSkills = new Dictionary(); - MultiMap mSpellLearnSpells = new MultiMap(); - Dictionary, SpellTargetPosition> mSpellTargetPositions = new Dictionary, SpellTargetPosition>(); - MultiMap mSpellSpellGroup = new MultiMap(); - MultiMap mSpellGroupSpell = new MultiMap(); - Dictionary mSpellGroupStack = new Dictionary(); - MultiMap mSpellSameEffectStack = new MultiMap(); - List mServersideSpellNames = new List(); - Dictionary<(uint id, Difficulty difficulty), SpellProcEntry> mSpellProcMap = new Dictionary<(uint id, Difficulty difficulty), SpellProcEntry>(); - Dictionary mSpellThreatMap = new Dictionary(); - Dictionary mSpellPetAuraMap = new Dictionary(); - MultiMap mSpellLinkedMap = new MultiMap(); - Dictionary mSpellEnchantProcEventMap = new Dictionary(); - Dictionary mEnchantCustomAttr = new Dictionary(); - MultiMap mSpellAreaMap = new MultiMap(); - MultiMap mSpellAreaForQuestMap = new MultiMap(); - MultiMap mSpellAreaForQuestEndMap = new MultiMap(); - MultiMap mSpellAreaForAuraMap = new MultiMap(); - MultiMap mSpellAreaForAreaMap = new MultiMap(); - MultiMap, SpellArea> mSpellAreaForQuestAreaMap = new MultiMap, SpellArea>(); - MultiMap mSkillLineAbilityMap = new MultiMap(); - Dictionary> mPetLevelupSpellMap = new Dictionary>(); - Dictionary mPetDefaultSpellsMap = new Dictionary(); // only spells not listed in related mPetLevelupSpellMap entry - MultiMap mSpellInfoMap = new MultiMap(); - Dictionary, uint> mSpellTotemModel = new Dictionary, uint>(); - Dictionary mBattlePets = new Dictionary(); + Dictionary mSpellChains = new(); + MultiMap mSpellsReqSpell = new(); + MultiMap mSpellReq = new(); + Dictionary mSpellLearnSkills = new(); + MultiMap mSpellLearnSpells = new(); + Dictionary, SpellTargetPosition> mSpellTargetPositions = new(); + MultiMap mSpellSpellGroup = new(); + MultiMap mSpellGroupSpell = new(); + Dictionary mSpellGroupStack = new(); + MultiMap mSpellSameEffectStack = new(); + List mServersideSpellNames = new(); + Dictionary<(uint id, Difficulty difficulty), SpellProcEntry> mSpellProcMap = new(); + Dictionary mSpellThreatMap = new(); + Dictionary mSpellPetAuraMap = new(); + MultiMap mSpellLinkedMap = new(); + Dictionary mSpellEnchantProcEventMap = new(); + Dictionary mEnchantCustomAttr = new(); + MultiMap mSpellAreaMap = new(); + MultiMap mSpellAreaForQuestMap = new(); + MultiMap mSpellAreaForQuestEndMap = new(); + MultiMap mSpellAreaForAuraMap = new(); + MultiMap mSpellAreaForAreaMap = new(); + MultiMap, SpellArea> mSpellAreaForQuestAreaMap = new(); + MultiMap mSkillLineAbilityMap = new(); + Dictionary> mPetLevelupSpellMap = new(); + Dictionary mPetDefaultSpellsMap = new(); // only spells not listed in related mPetLevelupSpellMap entry + MultiMap mSpellInfoMap = new(); + Dictionary, uint> mSpellTotemModel = new(); + Dictionary mBattlePets = new(); public delegate void AuraEffectHandler(AuraEffect effect, AuraApplication aurApp, AuraEffectHandleModes mode, bool apply); - Dictionary AuraEffectHandlers = new Dictionary(); + Dictionary AuraEffectHandlers = new(); public delegate void SpellEffectHandler(Spell spell, uint effectIndex); - Dictionary SpellEffectsHandlers = new Dictionary(); + Dictionary SpellEffectsHandlers = new(); - public MultiMap PetFamilySpellsStorage = new MultiMap(); + public MultiMap PetFamilySpellsStorage = new(); #endregion } @@ -4020,7 +4020,7 @@ namespace Game.Entities public SpellShapeshiftRecord Shapeshift; public SpellTargetRestrictionsRecord TargetRestrictions; public SpellTotemsRecord Totems; - public List Visuals = new List(); // only to group visuals when parsing sSpellXSpellVisualStore, not for loading + public List 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 auras = new Dictionary(); + Dictionary auras = new(); bool removeOnChangePet; int damage; } diff --git a/Source/Game/SupportSystem/SupportManager.cs b/Source/Game/SupportSystem/SupportManager.cs index 975228461..005b8d471 100644 --- a/Source/Game/SupportSystem/SupportManager.cs +++ b/Source/Game/SupportSystem/SupportManager.cs @@ -85,7 +85,7 @@ namespace Game.SupportSystem uint count = 0; do { - BugTicket bug = new BugTicket(); + BugTicket bug = new(); bug.LoadFromDB(result.GetFields()); if (!bug.IsClosed()) @@ -123,7 +123,7 @@ namespace Game.SupportSystem SQLResult chatLogResult; do { - ComplaintTicket complaint = new ComplaintTicket(); + ComplaintTicket complaint = new(); complaint.LoadFromDB(result.GetFields()); if (!complaint.IsClosed()) @@ -171,7 +171,7 @@ namespace Game.SupportSystem uint count = 0; do { - SuggestionTicket suggestion = new SuggestionTicket(); + SuggestionTicket suggestion = new(); suggestion.LoadFromDB(result.GetFields()); if (!suggestion.IsClosed()) @@ -277,7 +277,7 @@ namespace Game.SupportSystem _lastComplaintId = 0; - SQLTransaction trans = new SQLTransaction(); + SQLTransaction trans = new(); trans.Append(DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GM_COMPLAINTS)); trans.Append(DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GM_COMPLAINT_CHATLOGS)); DB.Characters.CommitTransaction(trans); @@ -372,9 +372,9 @@ namespace Game.SupportSystem bool _bugSystemStatus; bool _complaintSystemStatus; bool _suggestionSystemStatus; - Dictionary _bugTicketList = new Dictionary(); - Dictionary _complaintTicketList = new Dictionary(); - Dictionary _suggestionTicketList = new Dictionary(); + Dictionary _bugTicketList = new(); + Dictionary _complaintTicketList = new(); + Dictionary _suggestionTicketList = new(); uint _lastBugId; uint _lastComplaintId; uint _lastSuggestionId; diff --git a/Source/Game/SupportSystem/SupportTickets.cs b/Source/Game/SupportSystem/SupportTickets.cs index c327843af..e950b0e92 100644 --- a/Source/Game/SupportSystem/SupportTickets.cs +++ b/Source/Game/SupportSystem/SupportTickets.cs @@ -51,7 +51,7 @@ namespace Game.SupportSystem public virtual string FormatViewMessageString(CommandHandler handler, bool detailed = false) { return ""; } public virtual string FormatViewMessageString(CommandHandler handler, string closedName, string assignedToName, string unassignedName, string deletedName) { - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistguid, _id)); ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistname, GetPlayerName())); @@ -186,7 +186,7 @@ namespace Game.SupportSystem { ulong curTime = (ulong)Time.UnixTime; - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistguid, _id)); ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistname, GetPlayerName())); ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistagecreate, Time.secsToTimeString(curTime - _createTime, true, false))); @@ -323,7 +323,7 @@ namespace Game.SupportSystem { ulong curTime = (ulong)Time.UnixTime; - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistguid, _id)); ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistname, GetPlayerName())); ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistagecreate, Time.secsToTimeString(curTime - _createTime, true, false))); @@ -428,7 +428,7 @@ namespace Game.SupportSystem { ulong curTime = (ulong)Time.UnixTime; - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistguid, _id)); ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistname, GetPlayerName())); ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistagecreate, Time.secsToTimeString(curTime - _createTime, true, false))); diff --git a/Source/Game/Text/ChatTextBuilder.cs b/Source/Game/Text/ChatTextBuilder.cs index 0adcb56bb..4f06c36ca 100644 --- a/Source/Game/Text/ChatTextBuilder.cs +++ b/Source/Game/Text/ChatTextBuilder.cs @@ -96,7 +96,7 @@ namespace Game.Chat public override ServerPacket Invoke(Locale locale) { - ChatPkt packet = new ChatPkt(); + ChatPkt packet = new(); string text = Global.ObjectMgr.GetCypherString(_textId, locale); diff --git a/Source/Game/Text/CreatureTextManager.cs b/Source/Game/Text/CreatureTextManager.cs index 5fd6f7f33..7c6f88d73 100644 --- a/Source/Game/Text/CreatureTextManager.cs +++ b/Source/Game/Text/CreatureTextManager.cs @@ -55,7 +55,7 @@ namespace Game do { - CreatureTextEntry temp = new CreatureTextEntry(); + CreatureTextEntry temp = new(); temp.creatureId = result.Read(0); temp.groupId = result.Read(1); @@ -178,7 +178,7 @@ namespace Game return 0; } - List tempGroup = new List(); + List tempGroup = new(); var repeatGroup = source.GetTextRepeatGroup(textGroup); foreach (var entry in textGroupContainer) @@ -224,12 +224,12 @@ namespace Game if (srcPlr) { - PlayerTextBuilder builder = new PlayerTextBuilder(source, finalSource, finalSource.GetGender(), finalType, textEntry.groupId, textEntry.id, finalLang, whisperTarget); + PlayerTextBuilder builder = new(source, finalSource, finalSource.GetGender(), finalType, textEntry.groupId, textEntry.id, finalLang, whisperTarget); SendChatPacket(finalSource, builder, finalType, whisperTarget, range, team, gmOnly); } else { - CreatureTextBuilder builder = new CreatureTextBuilder(finalSource, finalSource.GetGender(), finalType, textEntry.groupId, textEntry.id, finalLang, whisperTarget); + CreatureTextBuilder builder = new(finalSource, finalSource.GetGender(), finalType, textEntry.groupId, textEntry.id, finalLang, whisperTarget); SendChatPacket(finalSource, builder, finalType, whisperTarget, range, team, gmOnly); } @@ -495,8 +495,8 @@ namespace Game Cell.VisitWorldObjects(source, worker, dist); } - Dictionary> mTextMap = new Dictionary>(); - Dictionary mLocaleTextMap = new Dictionary(); + Dictionary> mTextMap = new(); + Dictionary mLocaleTextMap = new(); } public class CreatureTextHolder @@ -560,7 +560,7 @@ namespace Game } public class CreatureTextLocale { - public StringArray Text = new StringArray((int)Locale.Total); + public StringArray Text = new((int)Locale.Total); } public class CreatureTextId { @@ -621,7 +621,7 @@ namespace Game player.SendPacket(message); } - Dictionary _packetCache = new Dictionary(); + Dictionary _packetCache = new(); MessageBuilder _builder; ChatMsg _msgType; } diff --git a/Source/Game/Tools/CharacterDatabaseCleaner.cs b/Source/Game/Tools/CharacterDatabaseCleaner.cs index a951ee436..f6b076208 100644 --- a/Source/Game/Tools/CharacterDatabaseCleaner.cs +++ b/Source/Game/Tools/CharacterDatabaseCleaner.cs @@ -82,7 +82,7 @@ namespace Game } bool found = false; - StringBuilder ss = new StringBuilder(); + StringBuilder ss = new(); do { uint id = result.Read(0); diff --git a/Source/Game/Warden/Warden.cs b/Source/Game/Warden/Warden.cs index 2ce5d8b21..c09eb6158 100644 --- a/Source/Game/Warden/Warden.cs +++ b/Source/Game/Warden/Warden.cs @@ -51,7 +51,7 @@ namespace Game uint burstSize; while (sizeLeft > 0) { - WardenModuleTransfer transfer = new WardenModuleTransfer(); + WardenModuleTransfer transfer = new(); burstSize = sizeLeft < 500 ? sizeLeft : 500u; transfer.Command = WardenOpcodes.Smsg_ModuleCache; @@ -60,7 +60,7 @@ namespace Game sizeLeft -= burstSize; pos += (int)burstSize; - Warden3DataServer packet = new Warden3DataServer(); + Warden3DataServer packet = new(); packet.Data = EncryptData(transfer.Write()); _session.SendPacket(packet); } @@ -71,14 +71,14 @@ namespace Game Log.outDebug(LogFilter.Warden, "Request module"); // Create packet structure - WardenModuleUse request = new WardenModuleUse(); + WardenModuleUse request = new(); request.Command = WardenOpcodes.Smsg_ModuleUse; request.ModuleId = _module.Id; request.ModuleKey = _module.Key; request.Size = _module.CompressedSize; - Warden3DataServer packet = new Warden3DataServer(); + Warden3DataServer packet = new(); packet.Data = EncryptData(request.Write()); _session.SendPacket(packet); } diff --git a/Source/Game/Warden/WardenCheckManager.cs b/Source/Game/Warden/WardenCheckManager.cs index 8c07538d3..859f117aa 100644 --- a/Source/Game/Warden/WardenCheckManager.cs +++ b/Source/Game/Warden/WardenCheckManager.cs @@ -58,7 +58,7 @@ namespace Game string str = result.Read(6); string comment = result.Read(7); - WardenCheck wardenCheck = new WardenCheck(); + WardenCheck wardenCheck = new(); wardenCheck.Type = checkType; wardenCheck.CheckId = id; @@ -87,7 +87,7 @@ namespace Game if (checkType == WardenCheckType.MPQ || checkType == WardenCheckType.Memory) { - BigInteger Result = new BigInteger(checkResult.ToByteArray()); + BigInteger Result = new(checkResult.ToByteArray()); CheckResultStore[id] = Result; } @@ -158,10 +158,10 @@ namespace Game return CheckResultStore.LookupByKey(Id); } - public List MemChecksIdPool = new List(); - public List OtherChecksIdPool = new List(); - List CheckStore = new List(); - Dictionary CheckResultStore = new Dictionary(); + public List MemChecksIdPool = new(); + public List OtherChecksIdPool = new(); + List CheckStore = new(); + Dictionary CheckResultStore = new(); } public enum WardenActions diff --git a/Source/Game/Warden/WardenWin.cs b/Source/Game/Warden/WardenWin.cs index 43555c4c5..5994b12d0 100644 --- a/Source/Game/Warden/WardenWin.cs +++ b/Source/Game/Warden/WardenWin.cs @@ -32,7 +32,7 @@ namespace Game { _session = session; // Generate Warden Key - SHA1Randx WK = new SHA1Randx(k.ToByteArray()); + SHA1Randx WK = new(k.ToByteArray()); WK.Generate(_inputKey, 16); WK.Generate(_outputKey, 16); @@ -55,7 +55,7 @@ namespace Game public override ClientWardenModule GetModuleForClient() { - ClientWardenModule mod = new ClientWardenModule(); + ClientWardenModule mod = new(); uint length = (uint)WardenModuleWin.Module.Length; @@ -78,7 +78,7 @@ namespace Game Log.outDebug(LogFilter.Warden, "Initialize module"); // Create packet structure - WardenInitModuleRequest Request = new WardenInitModuleRequest(); + WardenInitModuleRequest Request = new(); Request.Command1 = WardenOpcodes.Smsg_ModuleInitialize; Request.Size1 = 20; Request.Unk1 = 1; @@ -109,7 +109,7 @@ namespace Game Request.Function3_set = 1; Request.CheckSumm3 = BuildChecksum(BitConverter.GetBytes(Request.Unk5), 8); - Warden3DataServer packet = new Warden3DataServer(); + Warden3DataServer packet = new(); packet.Data = EncryptData(Request.Write()); _session.SendPacket(packet); } @@ -119,11 +119,11 @@ namespace Game Log.outDebug(LogFilter.Warden, "Request hash"); // Create packet structure - WardenHashRequest Request = new WardenHashRequest(); + WardenHashRequest Request = new(); Request.Command = WardenOpcodes.Smsg_HashRequest; Request.Seed = _seed; - Warden3DataServer packet = new Warden3DataServer(); + Warden3DataServer packet = new(); packet.Data = EncryptData(Request.Write()); _session.SendPacket(packet); } @@ -184,7 +184,7 @@ namespace Game _currentChecks.Add(id); } - ByteBuffer buffer = new ByteBuffer(); + ByteBuffer buffer = new(); buffer.WriteUInt8((byte)WardenOpcodes.Smsg_CheatChecksRequest); for (uint i = 0; i < WorldConfig.GetUIntValue(WorldCfg.WardenNumOtherChecks); ++i) @@ -262,7 +262,7 @@ namespace Game { uint seed = RandomHelper.Rand32(); buffer.WriteUInt32(seed); - HmacHash hmac = new HmacHash(BitConverter.GetBytes(seed)); + HmacHash hmac = new(BitConverter.GetBytes(seed)); hmac.Finish(wd.Str); buffer.WriteBytes(hmac.Digest); break; @@ -282,7 +282,7 @@ namespace Game } buffer.WriteUInt8(xorByte); - Warden3DataServer packet = new Warden3DataServer(); + Warden3DataServer packet = new(); packet.Data = EncryptData(buffer.GetData()); _session.SendPacket(packet); @@ -448,8 +448,8 @@ namespace Game } uint _serverTicks; - List _otherChecksTodo = new List(); - List _memChecksTodo = new List(); - List _currentChecks = new List(); + List _otherChecksTodo = new(); + List _memChecksTodo = new(); + List _currentChecks = new(); } } diff --git a/Source/Game/Weather/WeatherManager.cs b/Source/Game/Weather/WeatherManager.cs index a6a25ca11..802d8fbae 100644 --- a/Source/Game/Weather/WeatherManager.cs +++ b/Source/Game/Weather/WeatherManager.cs @@ -46,7 +46,7 @@ namespace Game { uint zone_id = result.Read(0); - WeatherData wzc = new WeatherData(); + WeatherData wzc = new(); for (byte season = 0; season < 4; ++season) { @@ -87,7 +87,7 @@ namespace Game return _weatherData.LookupByKey(zone_id); } - Dictionary _weatherData = new Dictionary(); + Dictionary _weatherData = new(); } public class Weather @@ -249,7 +249,7 @@ namespace Game public void SendWeatherUpdateToPlayer(Player player) { - WeatherPkt weather = new WeatherPkt(GetWeatherState(), m_grade); + WeatherPkt weather = new(GetWeatherState(), m_grade); player.SendPacket(weather); } @@ -272,7 +272,7 @@ namespace Game WeatherState state = GetWeatherState(); - WeatherPkt weather = new WeatherPkt(state, m_grade); + WeatherPkt weather = new(state, m_grade); //- Returns false if there were no players found to update if (!Global.WorldMgr.SendZoneMessage(m_zone, weather)) @@ -383,7 +383,7 @@ namespace Game uint m_zone; WeatherType m_type; float m_grade; - IntervalTimer m_timer = new IntervalTimer(); + IntervalTimer m_timer = new(); WeatherData m_weatherChances; }