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
@@ -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);