Core: SOme code cleanup, more to follow.

This commit is contained in:
hondacrx
2021-03-20 22:48:48 -04:00
parent 62f554f2e0
commit 62ec699ec6
318 changed files with 5080 additions and 5125 deletions
+26 -26
View File
@@ -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<Unit> toRemove = new List<Unit>();
List<Unit> 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<Unit> nearMembers = new List<Unit>();
List<Unit> 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;
+21 -21
View File
@@ -49,8 +49,8 @@ namespace Game.Entities
MovementForces _movementForces;
//Combat
protected List<Unit> attackerList = new List<Unit>();
Dictionary<ReactiveType, uint> m_reactiveTimer = new Dictionary<ReactiveType, uint>();
protected List<Unit> attackerList = new();
Dictionary<ReactiveType, uint> 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<Unit> m_Controlled = new List<Unit>();
List<Player> m_sharedVision = new List<Player>();
public List<Unit> m_Controlled = new();
List<Player> 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<CurrentSpellTypes, Spell> m_currentSpells = new Dictionary<CurrentSpellTypes, Spell>((int)CurrentSpellTypes.Max);
Dictionary<SpellValueMod, int> CustomSpellValueMod = new Dictionary<SpellValueMod, int>();
protected Dictionary<CurrentSpellTypes, Spell> m_currentSpells = new((int)CurrentSpellTypes.Max);
Dictionary<SpellValueMod, int> CustomSpellValueMod = new();
MultiMap<uint, uint>[] m_spellImmune = new MultiMap<uint, uint>[(int)SpellImmunity.Max];
uint[] m_interruptMask = new uint[2];
protected int m_procDeep;
@@ -92,16 +92,16 @@ namespace Game.Entities
SpellHistory _spellHistory;
//Auras
List<AuraEffect> AuraEffectList = new List<AuraEffect>();
MultiMap<AuraType, AuraEffect> m_modAuras = new MultiMap<AuraType, AuraEffect>();
List<Aura> m_removedAuras = new List<Aura>();
List<AuraApplication> m_interruptableAuras = new List<AuraApplication>(); // auras which have interrupt mask applied on unit
MultiMap<AuraStateType, AuraApplication> m_auraStateAuras = new MultiMap<AuraStateType, AuraApplication>(); // Used for improve performance of aura state checks on aura apply/remove
SortedSet<AuraApplication> m_visibleAuras = new SortedSet<AuraApplication>(new VisibleAuraSlotCompare());
SortedSet<AuraApplication> m_visibleAurasToUpdate = new SortedSet<AuraApplication>(new VisibleAuraSlotCompare());
MultiMap<uint, AuraApplication> m_appliedAuras = new MultiMap<uint, AuraApplication>();
MultiMap<uint, Aura> m_ownedAuras = new MultiMap<uint, Aura>();
List<Aura> m_scAuras = new List<Aura>();
List<AuraEffect> AuraEffectList = new();
MultiMap<AuraType, AuraEffect> m_modAuras = new();
List<Aura> m_removedAuras = new();
List<AuraApplication> m_interruptableAuras = new(); // auras which have interrupt mask applied on unit
MultiMap<AuraStateType, AuraApplication> m_auraStateAuras = new(); // Used for improve performance of aura state checks on aura apply/remove
SortedSet<AuraApplication> m_visibleAuras = new(new VisibleAuraSlotCompare());
SortedSet<AuraApplication> m_visibleAurasToUpdate = new(new VisibleAuraSlotCompare());
MultiMap<uint, AuraApplication> m_appliedAuras = new();
MultiMap<uint, Aura> m_ownedAuras = new();
List<Aura> 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<GameObject> m_gameObj = new List<GameObject>();
List<AreaTrigger> m_areaTrigger = new List<AreaTrigger>();
protected List<DynamicObject> m_dynObj = new List<DynamicObject>();
protected List<GameObject> m_gameObj = new();
List<AreaTrigger> m_areaTrigger = new();
protected List<DynamicObject> 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
+51 -51
View File
@@ -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)
+5 -5
View File
@@ -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;
+32 -32
View File
@@ -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<SpellValueMod, int> values = new Dictionary<SpellValueMod, int>();
Dictionary<SpellValueMod, int> 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<SpellValueMod, int> values = new Dictionary<SpellValueMod, int>();
Dictionary<SpellValueMod, int> 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<SpellValueMod, int> values = new Dictionary<SpellValueMod, int>();
Dictionary<SpellValueMod, int> 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<AuraApplication> myProcAuras, List<AuraApplication> 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<Tuple<uint, AuraApplication>> myAurasTriggeringProc = new List<Tuple<uint, AuraApplication>>();
ProcEventInfo myProcEventInfo = new(this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
List<Tuple<uint, AuraApplication>> myAurasTriggeringProc = new();
if (typeMaskActor != 0)
{
GetProcAurasTriggeredOnEvent(myAurasTriggeringProc, myProcAuras, myProcEventInfo);
@@ -1926,7 +1926,7 @@ namespace Game.Entities
{
if (modOwner != this && spell)
{
List<AuraApplication> modAuras = new List<AuraApplication>();
List<AuraApplication> 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<Tuple<uint, AuraApplication>> targetAurasTriggeringProc = new List<Tuple<uint, AuraApplication>>();
ProcEventInfo targetProcEventInfo = new(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
List<Tuple<uint, AuraApplication>> 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<DispelableAura> GetDispellableAuraList(Unit caster, uint dispelMask, bool isReflect = false)
{
List<DispelableAura> dispelList = new List<DispelableAura>();
List<DispelableAura> 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<AuraEffect, bool> predicate)
{
Dictionary<SpellGroup, int> sameEffectSpellGroup = new Dictionary<SpellGroup, int>();
Dictionary<SpellGroup, int> sameEffectSpellGroup = new();
int modifier = 0;
var mTotalAuraList = GetAuraEffectsByType(auratype);
@@ -4463,7 +4463,7 @@ namespace Game.Entities
if (mTotalAuraList.Empty())
return 1.0f;
Dictionary<SpellGroup, int> sameEffectSpellGroup = new Dictionary<SpellGroup, int>();
Dictionary<SpellGroup, int> sameEffectSpellGroup = new();
float multiplier = 1.0f;
foreach (var aurEff in mTotalAuraList)
+38 -38
View File
@@ -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<DynamicObject> GetDynObjects(uint spellId)
{
List<DynamicObject> dynamicobjects = new List<DynamicObject>();
List<DynamicObject> dynamicobjects = new();
foreach (var obj in m_dynObj)
if (obj.GetSpellId() == spellId)
dynamicobjects.Add(obj);
@@ -585,7 +585,7 @@ namespace Game.Entities
List<GameObject> GetGameObjects(uint spellId)
{
List<GameObject> gameobjects = new List<GameObject>();
List<GameObject> 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<Unit> targets = new List<Unit>();
List<Unit> 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<uint> displayIds = new List<uint>();
List<uint> 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);
}