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
+16 -16
View File
@@ -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<Unit> targetList = new List<Unit>();
List<Unit> 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<ObjectGuid> exitUnits = _insideUnits;
_insideUnits.Clear();
List<Unit> enteringUnits = new List<Unit>();
List<Unit> 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<Vector3> rotatedPoints = new List<Vector3>();
List<Vector3> 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<ObjectGuid> _insideUnits = new List<ObjectGuid>();
List<ObjectGuid> _insideUnits = new();
AreaTriggerAI _ai;
}
@@ -272,9 +272,9 @@ namespace Game.Entities
public uint ScriptId;
public float MaxSearchRadius;
public List<Vector2> PolygonVertices = new List<Vector2>();
public List<Vector2> PolygonVerticesTarget = new List<Vector2>();
public List<AreaTriggerAction> Actions = new List<AreaTriggerAction>();
public List<Vector2> PolygonVertices = new();
public List<Vector2> PolygonVerticesTarget = new();
public List<AreaTriggerAction> 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<Vector3> SplinePoints = new List<Vector3>();
public List<Vector3> SplinePoints = new();
}
public class AreaTriggerSpawn
+12 -12
View File
@@ -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<ushort> actorIndices = new List<ushort>();
List<ConversationLine> lines = new List<ConversationLine>();
List<ushort> actorIndices = new();
List<ConversationLine> 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<ObjectGuid> _participants = new List<ObjectGuid>();
List<ObjectGuid> _participants = new();
}
}
+9 -9
View File
@@ -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<uint>(5));
StringArray items = new StringArray(field.Read<string>(6), ' ');
StringArray items = new(field.Read<string>(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;
@@ -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<byte, byte> m_textRepeat = new MultiMap<byte, byte>();
MultiMap<byte, byte> 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<VendorItemCount> m_vendorItemCounts = new List<VendorItemCount>();
List<VendorItemCount> 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;
+11 -11
View File
@@ -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<Creature> assistList = new List<Creature>();
List<Creature> 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<Creature> despawnList = new List<Creature>();
List<Creature> despawnList = new();
foreach (var creature in creatureBounds)
{
@@ -3305,7 +3305,7 @@ namespace Game.Entities
ObjectGuid m_victim;
List<ObjectGuid> m_assistants = new List<ObjectGuid>();
List<ObjectGuid> m_assistants = new();
Unit m_owner;
}
+11 -11
View File
@@ -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<CreatureModel> Models = new List<CreatureModel>();
public List<CreatureModel> 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<Difficulty, CreatureLevelScaling> scalingStorage = new Dictionary<Difficulty, CreatureLevelScaling>();
public Dictionary<Difficulty, CreatureLevelScaling> 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<uint> BonusListIDs = new List<uint>();
public List<uint> BonusListIDs = new();
public uint PlayerConditionId;
public bool IgnoreFiltering;
@@ -412,7 +412,7 @@ namespace Game.Entities
public class VendorItemData
{
List<VendorItem> m_items = new List<VendorItem>();
List<VendorItem> m_items = new();
public VendorItem GetItem(uint slot)
{
@@ -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<ulong, FormationInfo> CreatureGroupMap = new Dictionary<ulong, FormationInfo>();
public static Dictionary<ulong, FormationInfo> 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<Creature, FormationInfo> m_members = new Dictionary<Creature, FormationInfo>();
Dictionary<Creature, FormationInfo> m_members = new();
ulong m_groupID;
bool m_Formed;
+23 -23
View File
@@ -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<uint, GossipMenuItem> _menuItems = new Dictionary<uint, GossipMenuItem>();
Dictionary<uint, GossipMenuItemData> _menuItemData = new Dictionary<uint, GossipMenuItemData>();
Dictionary<uint, GossipMenuItem> _menuItems = new();
Dictionary<uint, GossipMenuItemData> _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<QuestMenuItem> _questMenuItems = new List<QuestMenuItem>();
List<QuestMenuItem> _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<Condition> Conditions = new List<Condition>();
public List<Condition> 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<Condition> Conditions = new List<Condition>();
public List<Condition> Conditions = new();
}
}
+5 -5
View File
@@ -12,7 +12,7 @@ namespace Game.Entities
public uint MoneyCost;
public uint ReqSkillLine;
public uint ReqSkillRank;
public Array<uint> ReqAbility = new Array<uint>(3);
public Array<uint> 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<TrainerSpell> _spells;
Array<string> _greeting = new Array<string>((int)Locale.Total);
Array<string> _greeting = new((int)Locale.Total);
}
}
+5 -5
View File
@@ -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());
+22 -22
View File
@@ -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<ObjectGuid> m_unique_users = new List<ObjectGuid>();
List<ObjectGuid> 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<uint, ObjectGuid> ChairListSlots = new Dictionary<uint, ObjectGuid>();
List<ObjectGuid> m_SkillupList = new List<ObjectGuid>();
Dictionary<uint, ObjectGuid> ChairListSlots = new();
List<ObjectGuid> m_SkillupList = new();
public Loot loot = new Loot();
public Loot loot = new();
public GameObjectModel m_model;
@@ -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
@@ -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());
+15 -15
View File
@@ -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<uint> AzeriteItemMilestonePowers = new List<uint>();
public List<AzeriteEssencePowerRecord> UnlockedAzeriteEssences = new List<AzeriteEssencePowerRecord>();
public List<uint> AzeriteItemMilestonePowers = new();
public List<AzeriteEssencePowerRecord> UnlockedAzeriteEssences = new();
public AzeriteItemSelectedEssencesData[] SelectedAzeriteEssences = new AzeriteItemSelectedEssencesData[4];
}
}
+5 -5
View File
@@ -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());
+26 -26
View File
@@ -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<byte>(17));
var bonusListString = new StringArray(fields.Read<string>(18), ' ');
List<uint> bonusListIDs = new List<uint>();
List<uint> 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<ObjectGuid> allowedGUIDs = new List<ObjectGuid>();
List<ObjectGuid> 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<uint, ushort> m_artifactPowerIdToIndex = new Dictionary<uint, ushort>();
Array<uint> m_gemScalingLevels = new Array<uint>(ItemConst.MaxGemSockets);
Dictionary<uint, ushort> m_artifactPowerIdToIndex = new();
Array<uint> m_gemScalingLevels = new(ItemConst.MaxGemSockets);
#endregion
}
@@ -2673,7 +2673,7 @@ namespace Game.Entities
{
public uint ItemSetID;
public uint EquippedItemCount;
public List<ItemSetSpellRecord> SetBonuses = new List<ItemSetSpellRecord>();
public List<ItemSetSpellRecord> SetBonuses = new();
}
public class BonusData
@@ -2916,12 +2916,12 @@ namespace Game.Entities
public ulong Xp;
public uint ArtifactAppearanceId;
public uint ArtifactTierId;
public List<ArtifactPowerData> ArtifactPowers = new List<ArtifactPowerData>();
public List<ArtifactPowerData> ArtifactPowers = new();
}
public class AzeriteEmpoweredData
{
public Array<int> SelectedAzeritePowers = new Array<int>(SharedConst.MaxAzeriteEmpoweredTier);
public Array<int> SelectedAzeritePowers = new(SharedConst.MaxAzeriteEmpoweredTier);
}
class ItemAdditionalLoadInfo
@@ -2953,7 +2953,7 @@ namespace Game.Entities
info.Artifact.ArtifactAppearanceId = artifactResult.Read<uint>(2);
info.Artifact.ArtifactTierId = artifactResult.Read<uint>(3);
ArtifactPowerData artifactPowerData = new ArtifactPowerData();
ArtifactPowerData artifactPowerData = new();
artifactPowerData.ArtifactPowerId = artifactResult.Read<uint>(4);
artifactPowerData.PurchasedRank = artifactResult.Read<byte>(5);
+3 -3
View File
@@ -160,12 +160,12 @@ namespace Game.Entities
return 0;
}
static Dictionary<uint, RandomBonusListIds> _storage = new Dictionary<uint, RandomBonusListIds>();
static Dictionary<uint, RandomBonusListIds> _storage = new();
}
public class RandomBonusListIds
{
public List<uint> BonusListIDs = new List<uint>();
public List<double> Chances = new List<double>();
public List<uint> BonusListIDs = new();
public List<double> Chances = new();
}
}
+1 -1
View File
@@ -328,7 +328,7 @@ namespace Game.Entities
}
public uint MaxDurability;
public List<ItemEffectRecord> Effects = new List<ItemEffectRecord>();
public List<ItemEffectRecord> Effects = new();
// extra fields, not part of db2 files
public uint ScriptId;
+1 -1
View File
@@ -22,7 +22,7 @@ namespace Game.Entities
{
public struct ObjectGuid : IEquatable<ObjectGuid>
{
public static ObjectGuid Empty = new ObjectGuid();
public static ObjectGuid Empty = new();
public static ObjectGuid TradeItem = Create(HighGuid.Uniq, 10ul);
ulong _low;
+1 -1
View File
@@ -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)
{
@@ -26,9 +26,9 @@ namespace Game.Entities
{
uint MapId;
uint BlockCount;
List<ObjectGuid> destroyGUIDs = new List<ObjectGuid>();
List<ObjectGuid> outOfRangeGUIDs = new List<ObjectGuid>();
ByteBuffer data = new ByteBuffer();
List<ObjectGuid> destroyGUIDs = new();
List<ObjectGuid> 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);
@@ -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; }
File diff suppressed because it is too large Load Diff
+23 -23
View File
@@ -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<Unit> GetPlayerListInGrid(float maxSearchRange)
{
List<Unit> playerList = new List<Unit>();
List<Unit> 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<Unit> targets = new List<Unit>();
List<Unit> 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<StealthType> m_stealth = new FlaggedArray<StealthType>(2);
public FlaggedArray<StealthType> m_stealthDetect = new FlaggedArray<StealthType>(2);
public FlaggedArray<StealthType> m_stealth = new(2);
public FlaggedArray<StealthType> m_stealthDetect = new(2);
public FlaggedArray<InvisibilityType> m_invisibility = new FlaggedArray<InvisibilityType>((int)InvisibilityType.Max);
public FlaggedArray<InvisibilityType> m_invisibilityDetect = new FlaggedArray<InvisibilityType>((int)InvisibilityType.Max);
public FlaggedArray<InvisibilityType> m_invisibility = new((int)InvisibilityType.Max);
public FlaggedArray<InvisibilityType> m_invisibilityDetect = new((int)InvisibilityType.Max);
public FlaggedArray<ServerSideVisibilityType> m_serverSideVisibility = new FlaggedArray<ServerSideVisibilityType>(2);
public FlaggedArray<ServerSideVisibilityType> m_serverSideVisibilityDetect = new FlaggedArray<ServerSideVisibilityType>(2);
public FlaggedArray<ServerSideVisibilityType> m_serverSideVisibility = new(2);
public FlaggedArray<ServerSideVisibilityType> m_serverSideVisibilityDetect = new(2);
#endregion
public static implicit operator bool(WorldObject obj)
@@ -2513,7 +2513,7 @@ namespace Game.Entities
public class MovementForces
{
List<MovementForce> _forces = new List<MovementForce>();
List<MovementForce> _forces = new();
float _modMagnitude = 1.0f;
public List<MovementForce> GetForces() { return _forces; }
+19 -19
View File
@@ -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<AuraKey, AuraLoadEffectInfo> effectInfo = new Dictionary<AuraKey, AuraLoadEffectInfo>();
ObjectGuid casterGuid = new();
ObjectGuid itemGuid = new();
Dictionary<AuraKey, AuraLoadEffectInfo> 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<uint>(1), result.Read<uint>(2));
AuraKey key = new(casterGuid, itemGuid, result.Read<uint>(1), result.Read<uint>(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<uint>(1), result.Read<uint>(2));
AuraKey key = new(casterGuid, itemGuid, result.Read<uint>(1), result.Read<uint>(2));
uint recalculateMask = result.Read<uint>(3);
Difficulty difficulty = (Difficulty)result.Read<byte>(4);
byte stackCount = result.Read<byte>(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<uint> 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<uint> 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<uint> learnedSpells = new List<uint>();
List<uint> learnedSpells = new();
List<SpecializationSpellsRecord> specSpells = Global.DB2Mgr.GetSpecializationSpells(m_petSpecialization);
if (specSpells != null)
@@ -1537,7 +1537,7 @@ namespace Game.Entities
void RemoveSpecializationSpells(bool clearActionBar)
{
List<uint> unlearnedSpells = new List<uint>();
List<uint> 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<uint, PetSpell> m_spells = new Dictionary<uint, PetSpell>();
List<uint> m_autospells = new List<uint>();
public new Dictionary<uint, PetSpell> m_spells = new();
List<uint> m_autospells = new();
public bool m_removed;
PetType m_petType;
@@ -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
@@ -28,15 +28,15 @@ namespace Game.Entities
{
public class CollectionMgr
{
static Dictionary<uint, uint> FactionSpecificMounts = new Dictionary<uint, uint>();
static Dictionary<uint, uint> FactionSpecificMounts = new();
WorldSession _owner;
Dictionary<uint, ToyFlags> _toys = new Dictionary<uint, ToyFlags>();
Dictionary<uint, HeirloomData> _heirlooms = new Dictionary<uint, HeirloomData>();
Dictionary<uint, MountStatusFlags> _mounts = new Dictionary<uint, MountStatusFlags>();
Dictionary<uint, ToyFlags> _toys = new();
Dictionary<uint, HeirloomData> _heirlooms = new();
Dictionary<uint, MountStatusFlags> _mounts = new();
BitSet _appearances;
MultiMap<uint, ObjectGuid> _temporaryAppearances = new MultiMap<uint, ObjectGuid>();
Dictionary<uint, FavoriteAppearanceState> _favoriteAppearances = new Dictionary<uint, FavoriteAppearanceState>();
MultiMap<uint, ObjectGuid> _temporaryAppearances = new();
Dictionary<uint, FavoriteAppearanceState> _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<uint> GetAppearanceIds()
{
List<uint> appearances = new List<uint>();
List<uint> 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)
@@ -24,7 +24,7 @@ namespace Game.Entities
{
public class PetitionManager : Singleton<PetitionManager>
{
Dictionary<ObjectGuid, Petition> _petitionStorage = new Dictionary<ObjectGuid, Petition>();
Dictionary<ObjectGuid, Petition> _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)
{
+5 -5
View File
@@ -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());
}
}
+39 -39
View File
@@ -40,16 +40,16 @@ namespace Game.Entities
{
void _LoadInventory(SQLResult result, SQLResult artifactsResult, SQLResult azeriteResult, SQLResult azeriteItemMilestonePowersResult, SQLResult azeriteItemUnlockedEssencesResult, SQLResult azeriteEmpoweredItemResult, uint timeDiff)
{
Dictionary<ulong, ItemAdditionalLoadInfo> additionalData = new Dictionary<ulong, ItemAdditionalLoadInfo>();
Dictionary<ulong, ItemAdditionalLoadInfo> additionalData = new();
ItemAdditionalLoadInfo.Init(additionalData, artifactsResult, azeriteResult, azeriteItemMilestonePowersResult, azeriteItemUnlockedEssencesResult, azeriteEmpoweredItemResult);
if (!result.IsEmpty())
{
uint zoneId = GetZoneId();
Dictionary<ObjectGuid, Bag> bagMap = new Dictionary<ObjectGuid, Bag>(); // fast guid lookup for bags
Dictionary<ObjectGuid, Item> invalidBagMap = new Dictionary<ObjectGuid, Item>(); // fast guid lookup for bags
Queue<Item> problematicItems = new Queue<Item>();
SQLTransaction trans = new SQLTransaction();
Dictionary<ObjectGuid, Bag> bagMap = new(); // fast guid lookup for bags
Dictionary<ObjectGuid, Item> invalidBagMap = new(); // fast guid lookup for bags
Queue<Item> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<string>(0);
var GUIDlist = new StringArray(strGUID, ' ');
List<ObjectGuid> looters = new List<ObjectGuid>();
List<ObjectGuid> 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<uint, uint> loadedSkillValues = new Dictionary<uint, uint>();
Dictionary<uint, uint> 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<AuraKey, AuraLoadEffectInfo> effectInfo = new Dictionary<AuraKey, AuraLoadEffectInfo>();
ObjectGuid casterGuid = new();
ObjectGuid itemGuid = new();
Dictionary<AuraKey, AuraLoadEffectInfo> effectInfo = new();
if (!effectResult.IsEmpty())
{
do
@@ -479,7 +479,7 @@ namespace Game.Entities
casterGuid.SetRawValue(effectResult.Read<byte[]>(0));
itemGuid.SetRawValue(effectResult.Read<byte[]>(1));
AuraKey key = new AuraKey(casterGuid, itemGuid, effectResult.Read<uint>(2), effectResult.Read<uint>(3));
AuraKey key = new(casterGuid, itemGuid, effectResult.Read<uint>(2), effectResult.Read<uint>(3));
if (!effectInfo.ContainsKey(key))
effectInfo[key] = new AuraLoadEffectInfo();
@@ -497,7 +497,7 @@ namespace Game.Entities
{
casterGuid.SetRawValue(auraResult.Read<byte[]>(0));
itemGuid.SetRawValue(auraResult.Read<byte[]>(1));
AuraKey key = new AuraKey(casterGuid, itemGuid, auraResult.Read<uint>(2), auraResult.Read<uint>(3));
AuraKey key = new(casterGuid, itemGuid, auraResult.Read<uint>(2), auraResult.Read<uint>(3));
uint recalculateMask = auraResult.Read<uint>(4);
Difficulty difficulty = (Difficulty)auraResult.Read<byte>(5);
byte stackCount = auraResult.Read<byte>(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<uint>(1);
cur.WeeklyQuantity = result.Read<uint>(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<byte>(1);
if (qstatus < (byte)QuestStatus.Max)
@@ -1113,7 +1113,7 @@ namespace Game.Entities
uint fixedScalingLevel = result.Read<uint>(5);
uint artifactKnowledgeLevel = result.Read<uint>(6);
ItemContext context = (ItemContext)result.Read<byte>(7);
List<uint> bonusListIDs = new List<uint>();
List<uint> bonusListIDs = new();
var bonusListIdTokens = new StringArray(result.Read<string>(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<uint, Mail> mailById = new Dictionary<uint, Mail>();
Dictionary<uint, Mail> mailById = new();
if (!result.IsEmpty())
{
do
{
Mail m = new Mail();
Mail m = new();
m.messageID = result.Read<uint>(0);
m.messageType = (MailMessageType)result.Read<byte>(1);
@@ -1224,7 +1224,7 @@ namespace Game.Entities
stmt.AddValue(0, GetGUID().GetCounter());
SQLResult azeriteEmpoweredItemResult = DB.Characters.Query(stmt);
Dictionary<ulong, ItemAdditionalLoadInfo> additionalData = new Dictionary<ulong, ItemAdditionalLoadInfo>();
Dictionary<ulong, ItemAdditionalLoadInfo> 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() : "<unknown>")} ({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<ulong>(0);
eqSet.Data.Type = EquipmentSetInfo.EquipmentSetType.Equipment;
eqSet.Data.SetID = result.Read<byte>(1);
@@ -1435,7 +1435,7 @@ namespace Game.Entities
do
{
EquipmentSetInfo eqSet = new EquipmentSetInfo();
EquipmentSetInfo eqSet = new();
eqSet.Data.Guid = result.Read<ulong>(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<ChrCustomizationChoice> customizations = new List<ChrCustomizationChoice>();
List<ChrCustomizationChoice> customizations = new();
SQLResult customizationsResult = holder.GetResult(PlayerLoginQueryLoad.Customizations);
if (!customizationsResult.IsEmpty())
{
do
{
ChrCustomizationChoice choice = new ChrCustomizationChoice();
ChrCustomizationChoice choice = new();
choice.ChrCustomizationOptionID = customizationsResult.Read<uint>(0);
choice.ChrCustomizationChoiceID = customizationsResult.Read<uint>(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<uint, Item> itemsByMail = new MultiMap<uint, Item>();
MultiMap<uint, Item> 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<ulong, ItemAdditionalLoadInfo> additionalData = new Dictionary<ulong, ItemAdditionalLoadInfo>();
Dictionary<ulong, ItemAdditionalLoadInfo> 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
+48 -48
View File
@@ -39,18 +39,18 @@ namespace Game.Entities
//Gossip
public PlayerMenu PlayerTalkClass;
PlayerSocial m_social;
List<Channel> m_channels = new List<Channel>();
List<ObjectGuid> WhisperList = new List<ObjectGuid>();
List<Channel> m_channels = new();
List<ObjectGuid> WhisperList = new();
public string autoReplyMsg;
//Inventory
Dictionary<ulong, EquipmentSetInfo> _equipmentSets = new Dictionary<ulong, EquipmentSetInfo>();
public List<ItemSetEffect> ItemSetEff = new List<ItemSetEffect>();
List<EnchantDuration> m_enchantDuration = new List<EnchantDuration>();
List<Item> m_itemDuration = new List<Item>();
List<ObjectGuid> m_itemSoulboundTradeable = new List<ObjectGuid>();
List<ObjectGuid> m_refundableItems = new List<ObjectGuid>();
public List<Item> ItemUpdateQueue = new List<Item>();
Dictionary<ulong, EquipmentSetInfo> _equipmentSets = new();
public List<ItemSetEffect> ItemSetEff = new();
List<EnchantDuration> m_enchantDuration = new();
List<Item> m_itemDuration = new();
List<ObjectGuid> m_itemSoulboundTradeable = new();
List<ObjectGuid> m_refundableItems = new();
public List<Item> 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<Difficulty, Dictionary<uint, InstanceBind>> m_boundInstances = new Dictionary<Difficulty, Dictionary<uint, InstanceBind>>();
Dictionary<uint, long> _instanceResetTimes = new Dictionary<uint, long>();
public Dictionary<Difficulty, Dictionary<uint, InstanceBind>> m_boundInstances = new();
Dictionary<uint, long> _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<uint, PlayerSpell> m_spells = new Dictionary<uint, PlayerSpell>();
Dictionary<uint, SkillStatusData> mSkillStatus = new Dictionary<uint, SkillStatusData>();
Dictionary<uint, PlayerCurrency> _currencyStorage = new Dictionary<uint, PlayerCurrency>();
Dictionary<uint, PlayerSpell> m_spells = new();
Dictionary<uint, SkillStatusData> mSkillStatus = new();
Dictionary<uint, PlayerCurrency> _currencyStorage = new();
List<SpellModifier>[][] m_spellMods = new List<SpellModifier>[(int)SpellModOp.Max][];
MultiMap<uint, uint> m_overrideSpells = new MultiMap<uint, uint>();
MultiMap<uint, uint> m_overrideSpells = new();
public Spell m_spellModTakingSpell;
uint m_oldpetspell;
//Mail
List<Mail> m_mail = new List<Mail>();
Dictionary<ulong, Item> mMitems = new Dictionary<ulong, Item>();
List<Mail> m_mail = new();
Dictionary<ulong, Item> mMitems = new();
public byte unReadMails;
long m_nextMailDelivereTime;
public bool m_mailsLoaded;
public bool m_mailsUpdated;
//Pets
public List<PetAura> m_petAuras = new List<PetAura>();
public List<PetAura> 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<uint> m_timedquests = new List<uint>();
List<uint> m_weeklyquests = new List<uint>();
List<uint> m_monthlyquests = new List<uint>();
MultiMap<uint, uint> m_seasonalquests = new MultiMap<uint, uint>();
Dictionary<uint, QuestStatusData> m_QuestStatus = new Dictionary<uint, QuestStatusData>();
Dictionary<uint, QuestSaveType> m_QuestStatusSave = new Dictionary<uint, QuestSaveType>();
List<uint> m_DFQuests = new List<uint>();
List<uint> m_RewardedQuests = new List<uint>();
Dictionary<uint, QuestSaveType> m_RewardedQuestsSave = new Dictionary<uint, QuestSaveType>();
List<uint> m_timedquests = new();
List<uint> m_weeklyquests = new();
List<uint> m_monthlyquests = new();
MultiMap<uint, uint> m_seasonalquests = new();
Dictionary<uint, QuestStatusData> m_QuestStatus = new();
Dictionary<uint, QuestSaveType> m_QuestStatusSave = new();
List<uint> m_DFQuests = new();
List<uint> m_RewardedQuests = new();
Dictionary<uint, QuestSaveType> m_RewardedQuestsSave = new();
bool m_DailyQuestChanged;
bool m_WeeklyQuestChanged;
@@ -199,13 +199,13 @@ namespace Game.Entities
bool m_customizationsChanged;
SpecializationInfo _specializationInfo;
public List<ObjectGuid> m_clientGUIDs = new List<ObjectGuid>();
public List<ObjectGuid> m_visibleTransports = new List<ObjectGuid>();
public List<ObjectGuid> m_clientGUIDs = new();
public List<ObjectGuid> 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<uint> m_timeSyncQueue = new Stack<uint>();
public Stack<uint> 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<ObjectGuid /*LootObject*/, ObjectGuid /*WorldObject*/> m_AELootView = new Dictionary<ObjectGuid, ObjectGuid>();
Dictionary<ObjectGuid /*LootObject*/, ObjectGuid /*WorldObject*/> 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<byte, ActionButton> m_actionButtons = new Dictionary<byte, ActionButton>();
Dictionary<byte, ActionButton> 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<PlayerCreateInfoItem> item = new List<PlayerCreateInfoItem>();
public List<uint> customSpells = new List<uint>();
public List<uint> castSpells = new List<uint>();
public List<PlayerCreateInfoAction> action = new List<PlayerCreateInfoAction>();
public List<SkillRaceClassInfoRecord> skills = new List<SkillRaceClassInfoRecord>();
public List<PlayerCreateInfoItem> item = new();
public List<uint> customSpells = new();
public List<uint> castSpells = new();
public List<PlayerCreateInfoAction> action = new();
public List<SkillRaceClassInfoRecord> skills = new();
public PlayerLevelInfo[] levelInfo = new PlayerLevelInfo[WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)];
}
@@ -361,7 +361,7 @@ namespace Game.Entities
}
}
public List<byte> CooldownOrder = new List<byte>();
public List<byte> 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<uint> BonusListIDs = new List<uint>();
public List<uint> 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<ObjectGuid> Pieces = new Array<ObjectGuid>(EquipmentSlot.End);
public Array<int> Appearances = new Array<int>(EquipmentSlot.End); // ItemModifiedAppearanceID
public Array<int> Enchants = new Array<int>(2); // SpellItemEnchantmentID
public Array<ObjectGuid> Pieces = new(EquipmentSlot.End);
public Array<int> Appearances = new(EquipmentSlot.End); // ItemModifiedAppearanceID
public Array<int> 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<ObjectGuid> bgAfkReporter = new List<ObjectGuid>();
public List<ObjectGuid> bgAfkReporter = new();
public byte bgAfkReportedCount;
public long bgAfkReportedTimer;
+1 -1
View File
@@ -30,7 +30,7 @@ namespace Game.Entities
if (!group)
return null;
List<Player> nearMembers = new List<Player>();
List<Player> nearMembers = new();
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
{
+49 -49
View File
@@ -84,7 +84,7 @@ namespace Game.Entities
if (count != 0 && itemid != 0)
{
List<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> sDest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> childDest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> sSrc = new List<ItemPosCount>();
List<ItemPosCount> sSrc = new();
ushort eSrc = 0;
if (IsInventoryPos(parentBag, parentSlot))
{
@@ -1804,7 +1804,7 @@ namespace Game.Entities
if (IsChildEquipmentPos(childItem.GetPos()))
return;
List<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> sDest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> _sDest = new List<ItemPosCount>();
List<ItemPosCount> _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<ItemPosCount> sDest2 = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> vDest = new List<ItemPosCount>();
List<ItemPosCount> 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<Item> GetItemListByEntry(uint entry, bool inBankAlso = false)
{
List<Item> itemList = new List<Item>();
List<Item> 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<ItemPosCount> off_dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<SpellValueMod, int> csv = new Dictionary<SpellValueMod, int>();
Dictionary<SpellValueMod, int> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<Item> unstorableItems = new List<Item>();
List<Item> 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<int, int>((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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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;
+10 -10
View File
@@ -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;
+3 -3
View File
@@ -173,7 +173,7 @@ namespace Game.Entities
// victim_rank [1..4] HK: <dishonored rank>
// victim_rank [5..19] HK: <alliance\horde rank>
// 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
/// <param name="reporter"></param>
public void ReportedAfkBy(Player reporter)
{
ReportPvPPlayerAFKResult reportAfkResult = new ReportPvPPlayerAFKResult();
ReportPvPPlayerAFKResult reportAfkResult = new();
reportAfkResult.Offender = GetGUID();
Battleground bg = GetBattleground();
// Battleground also must be in progress!
+25 -25
View File
@@ -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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> dest = new();
if (quest.GetRewChoiceItemsCount() > 0)
{
switch (rewardType)
@@ -915,7 +915,7 @@ namespace Game.Entities
if (CanSelectQuestPackageItem(questPackageItem))
{
hasFilteredQuestPackageReward = true;
List<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> 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;
+27 -27
View File
@@ -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<SpellValueMod, int> values = new Dictionary<SpellValueMod, int>();
Dictionary<SpellValueMod, int> values = new();
if (entry != null && entry.AttributesMask.HasAnyFlag(EnchantProcAttributes.Limit60) && target.GetLevelForTarget(this) > 60)
{
int lvlDifference = (int)target.GetLevelForTarget(this) - 60;
@@ -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<uint> 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;
+85 -85
View File
@@ -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<ItemPosCount> sDest = new List<ItemPosCount>();
List<ItemPosCount> 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<ItemPosCount> dest = new List<ItemPosCount>(); //for succubus, voidwalker, felhunter and felguard credit soulshard when despawn reason other than death (out of range, logout)
List<ItemPosCount> 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<uint> 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<uint> nodes = new List<uint>();
List<uint> 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<ItemPosCount> off_dest = new List<ItemPosCount>();
List<ItemPosCount> 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());
+2 -2
View File
@@ -28,7 +28,7 @@ namespace Game.Entities
public class PlayerTaxi
{
public byte[] m_taximask = new byte[PlayerConst.TaxiMaskSize];
List<uint> m_TaxiDestinations = new List<uint>();
List<uint> 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)
+6 -6
View File
@@ -26,7 +26,7 @@ namespace Game.Entities
public class SceneMgr
{
Player _player;
Dictionary<uint, SceneTemplate> _scenesByInstance = new Dictionary<uint, SceneTemplate>();
Dictionary<uint, SceneTemplate> _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<uint> instancesIds = new List<uint>();
List<uint> 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<uint> instancesIds = new List<uint>();
List<uint> instancesIds = new();
foreach (var sceneTemplate in _scenesByInstance)
if (sceneTemplate.Value.ScenePackageId == sceneScriptPackageId)
+7 -7
View File
@@ -26,7 +26,7 @@ namespace Game.Entities
{
public class SocialManager : Singleton<SocialManager>
{
Dictionary<ObjectGuid, PlayerSocial> _socialMap = new Dictionary<ObjectGuid, PlayerSocial>();
Dictionary<ObjectGuid, PlayerSocial> _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<ObjectGuid, FriendInfo> _playerSocialMap = new Dictionary<ObjectGuid, FriendInfo>();
public Dictionary<ObjectGuid, FriendInfo> _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)
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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));
+5 -5
View File
@@ -28,8 +28,8 @@ namespace Game.Entities
public class TaxiPathGraph : Singleton<TaxiPathGraph>
{
EdgeWeightedDigraph m_graph;
List<TaxiNodesRecord> m_nodesByVertex = new List<TaxiNodesRecord>();
Dictionary<uint, uint> m_verticesByNode = new Dictionary<uint, uint>();
List<TaxiNodesRecord> m_nodesByVertex = new();
Dictionary<uint, uint> m_verticesByNode = new();
TaxiPathGraph() { }
@@ -38,7 +38,7 @@ namespace Game.Entities
if (m_graph != null)
return;
List<Tuple<Tuple<uint, uint>, uint>> edges = new List<Tuple<Tuple<uint, uint>, uint>>();
List<Tuple<Tuple<uint, uint>, 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)
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+4 -4
View File
@@ -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<WorldObject> _passengers = new HashSet<WorldObject>();
HashSet<WorldObject> _staticPassengers = new HashSet<WorldObject>();
HashSet<WorldObject> _passengers = new();
HashSet<WorldObject> _staticPassengers = new();
bool _delayedAddModel;
bool _delayedTeleport;
+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);
}
+7 -7
View File
@@ -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<sbyte, VehicleSeat> seat = new KeyValuePair<sbyte, VehicleSeat>();
KeyValuePair<sbyte, VehicleSeat> 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<Tuple<Unit, Position>> seatRelocation = new List<Tuple<Unit, Position>>();
List<Tuple<Unit, Position>> 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<ulong> vehiclePlayers = new List<ulong>();
List<ulong> 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<VehicleJoinEvent> _pendingJoinEvents = new List<VehicleJoinEvent>();
public Dictionary<sbyte, VehicleSeat> Seats = new Dictionary<sbyte, VehicleSeat>();
List<VehicleJoinEvent> _pendingJoinEvents = new();
public Dictionary<sbyte, VehicleSeat> 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);