First try at updating command system to be like TC. Still needs alot of testing/work
This commit is contained in:
@@ -17,25 +17,26 @@
|
||||
|
||||
namespace Framework.Dynamic
|
||||
{
|
||||
public struct Optional<T> where T : new()
|
||||
public struct Optional<T>
|
||||
{
|
||||
private bool _hasValue;
|
||||
public T Value;
|
||||
|
||||
public Optional(T value)
|
||||
{
|
||||
Value = value;
|
||||
_hasValue = true;
|
||||
}
|
||||
|
||||
public bool HasValue
|
||||
{
|
||||
get { return _hasValue; }
|
||||
set
|
||||
{
|
||||
_hasValue = value;
|
||||
Value = _hasValue ? new T() : default;
|
||||
}
|
||||
}
|
||||
|
||||
public void Set(T v)
|
||||
public void Set(T value)
|
||||
{
|
||||
Value = value;
|
||||
_hasValue = true;
|
||||
Value = v;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
@@ -49,9 +50,14 @@ namespace Framework.Dynamic
|
||||
return HasValue ? Value : otherValue;
|
||||
}
|
||||
|
||||
public static explicit operator T(Optional<T> value)
|
||||
public static explicit operator T(Optional<T> optional)
|
||||
{
|
||||
return (T)value;
|
||||
return optional.Value;
|
||||
}
|
||||
|
||||
public static implicit operator Optional<T>(T value)
|
||||
{
|
||||
return new Optional<T>(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,7 +561,7 @@ namespace Framework.Dynamic
|
||||
/// <returns></returns>
|
||||
TaskContext ClearGroup()
|
||||
{
|
||||
_task._group.HasValue = false;
|
||||
_task._group.Clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,8 +104,7 @@ namespace Game.Arenas
|
||||
|
||||
if (IsRated())
|
||||
{
|
||||
pvpLogData.Ratings.HasValue = true;
|
||||
|
||||
pvpLogData.Ratings.Value = new();
|
||||
for (byte i = 0; i < SharedConst.PvpTeamsCount; ++i)
|
||||
{
|
||||
pvpLogData.Ratings.Value.Postmatch[i] = _arenaTeamScores[i].PostMatchRating;
|
||||
|
||||
@@ -1658,7 +1658,7 @@ namespace Game
|
||||
{
|
||||
if (alwaysSendItem)
|
||||
{
|
||||
auctionItem.Item.HasValue = true;
|
||||
auctionItem.Item.Value = new();
|
||||
auctionItem.Item.Value = new ItemInstance(Items[0]);
|
||||
}
|
||||
|
||||
@@ -1666,7 +1666,7 @@ namespace Game
|
||||
}
|
||||
else
|
||||
{
|
||||
auctionItem.Item.HasValue = true;
|
||||
auctionItem.Item.Value = new();
|
||||
auctionItem.Item.Value = new ItemInstance(Items[0]);
|
||||
auctionItem.Charges = new[] { Items[0].GetSpellCharges(0), Items[0].GetSpellCharges(1), Items[0].GetSpellCharges(2), Items[0].GetSpellCharges(3), Items[0].GetSpellCharges(4) }.Max();
|
||||
for (EnchantmentSlot enchantmentSlot = 0; enchantmentSlot < EnchantmentSlot.MaxInspected; enchantmentSlot++)
|
||||
|
||||
@@ -702,7 +702,7 @@ namespace Game.BattleGrounds
|
||||
PVPMatchComplete pvpMatchComplete = new();
|
||||
pvpMatchComplete.Winner = (byte)GetWinner();
|
||||
pvpMatchComplete.Duration = (int)Math.Max(0, (GetElapsedTime() - (int)BattlegroundStartTimeIntervals.Delay2m) / Time.InMilliseconds);
|
||||
pvpMatchComplete.LogData.HasValue = true;
|
||||
pvpMatchComplete.LogData.Value = new();
|
||||
BuildPvPLogDataPacket(out pvpMatchComplete.LogData.Value);
|
||||
pvpMatchComplete.Write();
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Game.BattleGrounds
|
||||
playerData.Faction = (byte)TeamId;
|
||||
if (HonorableKills != 0 || Deaths != 0 || BonusHonor != 0)
|
||||
{
|
||||
playerData.Honor.HasValue = true;
|
||||
playerData.Honor.Value = new();
|
||||
playerData.Honor.Value.HonorKills = HonorableKills;
|
||||
playerData.Honor.Value.Deaths = Deaths;
|
||||
playerData.Honor.Value.ContributionPoints = BonusHonor;
|
||||
|
||||
@@ -230,7 +230,7 @@ namespace Game.BattlePets
|
||||
|
||||
if (!ownerGuid.IsEmpty())
|
||||
{
|
||||
pet.PacketInfo.OwnerInfo.HasValue = true;
|
||||
pet.PacketInfo.OwnerInfo.Value = new();
|
||||
pet.PacketInfo.OwnerInfo.Value.Guid = ownerGuid;
|
||||
pet.PacketInfo.OwnerInfo.Value.PlayerVirtualRealm = Global.WorldMgr.GetVirtualRealmAddress();
|
||||
pet.PacketInfo.OwnerInfo.Value.PlayerNativeRealm = Global.WorldMgr.GetVirtualRealmAddress();
|
||||
@@ -398,7 +398,7 @@ namespace Game.BattlePets
|
||||
Player player = _owner.GetPlayer();
|
||||
if (battlePetSpecies.GetFlags().HasFlag(BattlePetSpeciesFlags.NotAccountWide))
|
||||
{
|
||||
pet.PacketInfo.OwnerInfo.HasValue = true;
|
||||
pet.PacketInfo.OwnerInfo.Value = new();
|
||||
pet.PacketInfo.OwnerInfo.Value.Guid = player.GetGUID();
|
||||
pet.PacketInfo.OwnerInfo.Value.PlayerVirtualRealm = Global.WorldMgr.GetVirtualRealmAddress();
|
||||
pet.PacketInfo.OwnerInfo.Value.PlayerNativeRealm = Global.WorldMgr.GetVirtualRealmAddress();
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Game.BlackMarket
|
||||
|
||||
if (!bonusListIDs.Empty())
|
||||
{
|
||||
Item.ItemBonus.HasValue = true;
|
||||
Item.ItemBonus.Value = new();
|
||||
Item.ItemBonus.Value.BonusListIDs = bonusListIDs;
|
||||
}
|
||||
|
||||
|
||||
@@ -759,7 +759,7 @@ namespace Game.Entities
|
||||
|
||||
AreaTriggerRePath reshape = new();
|
||||
reshape.TriggerGUID = GetGUID();
|
||||
reshape.AreaTriggerSpline.HasValue = true;
|
||||
reshape.AreaTriggerSpline.Value = new();
|
||||
reshape.AreaTriggerSpline.Value.ElapsedTimeForMovement = GetElapsedTimeForMovement();
|
||||
reshape.AreaTriggerSpline.Value.TimeToTarget = timeToTarget;
|
||||
reshape.AreaTriggerSpline.Value.Points = splinePoints;
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace Game.Entities
|
||||
itemPurchaseRefundResult.Result = error;
|
||||
if (error == 0)
|
||||
{
|
||||
itemPurchaseRefundResult.Contents.HasValue = true;
|
||||
itemPurchaseRefundResult.Contents.Value = new();
|
||||
itemPurchaseRefundResult.Contents.Value.Money = item.GetPaidMoney();
|
||||
for (byte i = 0; i < ItemConst.MaxItemExtCostItems; ++i) // item cost data
|
||||
{
|
||||
|
||||
@@ -1836,7 +1836,7 @@ namespace Game.Entities
|
||||
transport = GetTransport();
|
||||
if (transport)
|
||||
{
|
||||
transferPending.Ship.HasValue = true;
|
||||
transferPending.Ship.Value = new();
|
||||
transferPending.Ship.Value.Id = transport.GetEntry();
|
||||
transferPending.Ship.Value.OriginMapID = (int)GetMapId();
|
||||
}
|
||||
@@ -4983,7 +4983,7 @@ namespace Game.Entities
|
||||
rewardEntry.Quantity = item.Quantity;
|
||||
if (!item.BonusListIDs.Empty())
|
||||
{
|
||||
rewardEntry.Item.ItemBonus.HasValue = true;
|
||||
rewardEntry.Item.ItemBonus.Value = new();
|
||||
rewardEntry.Item.ItemBonus.Value.BonusListIDs = item.BonusListIDs;
|
||||
}
|
||||
reward.Items.Add(rewardEntry);
|
||||
@@ -5012,7 +5012,7 @@ namespace Game.Entities
|
||||
rewardEntry.Quantity = item.Quantity;
|
||||
if (!item.BonusListIDs.Empty())
|
||||
{
|
||||
rewardEntry.Item.ItemBonus.HasValue = true;
|
||||
rewardEntry.Item.ItemBonus.Value = new();
|
||||
rewardEntry.Item.ItemBonus.Value.BonusListIDs = item.BonusListIDs;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Game.Garrisons
|
||||
if (!CliDB.GarrBuildingStorage.ContainsKey(buildingId))
|
||||
continue;
|
||||
|
||||
plot.BuildingInfo.PacketInfo.HasValue = true;
|
||||
plot.BuildingInfo.PacketInfo.Value = new();
|
||||
plot.BuildingInfo.PacketInfo.Value.GarrPlotInstanceID = plotInstanceId;
|
||||
plot.BuildingInfo.PacketInfo.Value.GarrBuildingID = buildingId;
|
||||
plot.BuildingInfo.PacketInfo.Value.TimeBuilt = timeBuilt;
|
||||
|
||||
@@ -5800,7 +5800,7 @@ namespace Game
|
||||
|
||||
if (!result.IsNull(7))
|
||||
{
|
||||
info.createPositionNPE.HasValue = true;
|
||||
info.createPositionNPE.Value = new();
|
||||
|
||||
info.createPositionNPE.Value.Loc = new WorldLocation(result.Read<uint>(7), result.Read<float>(8), result.Read<float>(9), result.Read<float>(10), result.Read<float>(11));
|
||||
if (!result.IsNull(12))
|
||||
@@ -5809,13 +5809,13 @@ namespace Game
|
||||
if (!CliDB.MapStorage.ContainsKey(info.createPositionNPE.Value.Loc.GetMapId()))
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"Invalid NPE map id {info.createPositionNPE.Value.Loc.GetMapId()} for class {currentclass} race {currentrace} pair in `playercreateinfo` table, ignoring.");
|
||||
info.createPositionNPE.HasValue = false;
|
||||
info.createPositionNPE.Clear();
|
||||
}
|
||||
|
||||
if (info.createPositionNPE.HasValue && info.createPositionNPE.Value.TransportGuid.HasValue && Global.TransportMgr.GetTransportSpawn(info.createPositionNPE.Value.TransportGuid.Value) == null)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"Invalid NPE transport spawn id {info.createPositionNPE.Value.TransportGuid.Value} for class {currentclass} race {currentrace} pair in `playercreateinfo` table, ignoring.");
|
||||
info.createPositionNPE.HasValue = false; // remove entire NPE data - assume user put transport offsets into npe_position fields
|
||||
info.createPositionNPE.Clear(); // remove entire NPE data - assume user put transport offsets into npe_position fields
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1483,14 +1483,14 @@ namespace Game.Groups
|
||||
if (GetMembersCount() > 1)
|
||||
{
|
||||
// LootSettings
|
||||
partyUpdate.LootSettings.HasValue = true;
|
||||
partyUpdate.LootSettings.Value = new();
|
||||
|
||||
partyUpdate.LootSettings.Value.Method = (byte)m_lootMethod;
|
||||
partyUpdate.LootSettings.Value.Threshold = (byte)m_lootThreshold;
|
||||
partyUpdate.LootSettings.Value.LootMaster = m_lootMethod == LootMethod.MasterLoot ? m_masterLooterGuid : ObjectGuid.Empty;
|
||||
|
||||
// Difficulty Settings
|
||||
partyUpdate.DifficultySettings.HasValue = true;
|
||||
partyUpdate.DifficultySettings.Value = new();
|
||||
|
||||
partyUpdate.DifficultySettings.Value.DungeonDifficultyID = (uint)m_dungeonDifficulty;
|
||||
partyUpdate.DifficultySettings.Value.RaidDifficultyID = (uint)m_raidDifficulty;
|
||||
@@ -1500,7 +1500,7 @@ namespace Game.Groups
|
||||
// LfgInfos
|
||||
if (IsLFGGroup())
|
||||
{
|
||||
partyUpdate.LfgInfos.HasValue = true;
|
||||
partyUpdate.LfgInfos.Value = new();
|
||||
|
||||
partyUpdate.LfgInfos.Value.Slot = Global.LFGMgr.GetLFGDungeonEntry(Global.LFGMgr.GetDungeon(m_guid));
|
||||
partyUpdate.LfgInfos.Value.BootCount = 0;
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Game
|
||||
AuctionListBucketsResult listBucketsResult = new();
|
||||
if (!browseQuery.ItemClassFilters.Empty())
|
||||
{
|
||||
classFilters.HasValue = true;
|
||||
classFilters.Value = new();
|
||||
|
||||
foreach (var classFilter in browseQuery.ItemClassFilters)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Game
|
||||
|
||||
if (code == BattlenetRpcErrorCode.Ok)
|
||||
{
|
||||
response.SuccessInfo.HasValue = true;
|
||||
response.SuccessInfo.Value = new();
|
||||
|
||||
response.SuccessInfo.Value = new AuthResponse.AuthSuccessInfo();
|
||||
response.SuccessInfo.Value.ActiveExpansionLevel = (byte)GetExpansion();
|
||||
@@ -51,7 +51,7 @@ namespace Game
|
||||
|
||||
if (queued)
|
||||
{
|
||||
response.WaitInfo.HasValue = true;
|
||||
response.WaitInfo.Value = new();
|
||||
response.WaitInfo.Value.WaitCount = queuePos;
|
||||
}
|
||||
|
||||
|
||||
@@ -1091,7 +1091,7 @@ namespace Game
|
||||
features.VoiceEnabled = false;
|
||||
features.BrowserEnabled = false; // Has to be false, otherwise client will crash if "Customer Support" is opened
|
||||
|
||||
features.EuropaTicketSystemStatus.HasValue = true;
|
||||
features.EuropaTicketSystemStatus.Value = new();
|
||||
features.EuropaTicketSystemStatus.Value.ThrottleState.MaxTries = 10;
|
||||
features.EuropaTicketSystemStatus.Value.ThrottleState.PerMilliseconds = 60000;
|
||||
features.EuropaTicketSystemStatus.Value.ThrottleState.TryCount = 1;
|
||||
@@ -2533,7 +2533,7 @@ namespace Game
|
||||
|
||||
if (result == ResponseCodes.Success)
|
||||
{
|
||||
packet.Display.HasValue = true;
|
||||
packet.Display.Value = new();
|
||||
packet.Display.Value.Name = factionChangeInfo.Name;
|
||||
packet.Display.Value.SexID = (byte)factionChangeInfo.SexID;
|
||||
packet.Display.Value.Customizations = factionChangeInfo.Customizations;
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Game
|
||||
Guild guild = Global.GuildMgr.GetGuildById(player.GetGuildId());
|
||||
if (guild)
|
||||
{
|
||||
inspectResult.GuildData.HasValue = true;
|
||||
inspectResult.GuildData.Value = new();
|
||||
|
||||
InspectGuildData guildData;
|
||||
guildData.GuildGUID = guild.GetGUID();
|
||||
|
||||
@@ -533,7 +533,7 @@ namespace Game
|
||||
item.Item.ItemID = vendorItem.item;
|
||||
if (!vendorItem.BonusListIDs.Empty())
|
||||
{
|
||||
item.Item.ItemBonus.HasValue = true;
|
||||
item.Item.ItemBonus.Value = new();
|
||||
item.Item.ItemBonus.Value.BonusListIDs = vendorItem.BonusListIDs;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Game
|
||||
GetPlayer().SetTaxiCheater(true); // Grimwing in Ebon Hold, special case. NOTE: Not perfect, Zul'Aman should not be included according to WoWhead, and I think taxicheat includes it.
|
||||
|
||||
ShowTaxiNodes data = new();
|
||||
data.WindowInfo.HasValue = true;
|
||||
data.WindowInfo.Value = new();
|
||||
data.WindowInfo.Value.UnitGUID = unit.GetGUID();
|
||||
data.WindowInfo.Value.CurrentNode = (int)curloc;
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Game
|
||||
tradeItem.GiftCreator = item.GetGiftCreator();
|
||||
if (!item.IsWrapped())
|
||||
{
|
||||
tradeItem.Unwrapped.HasValue = true;
|
||||
tradeItem.Unwrapped.Value = new();
|
||||
TradeUpdated.UnwrappedTradeItem unwrappedItem = tradeItem.Unwrapped.Value;
|
||||
unwrappedItem.EnchantID = (int)item.GetEnchantmentId(EnchantmentSlot.Perm);
|
||||
unwrappedItem.OnUseEnchantmentID = (int)item.GetEnchantmentId(EnchantmentSlot.Use);
|
||||
|
||||
@@ -2120,7 +2120,7 @@ namespace Game.Maps
|
||||
}
|
||||
}
|
||||
|
||||
data.LiquidInfo.HasValue = true;
|
||||
data.LiquidInfo.Value = new();
|
||||
data.LiquidInfo.Value.level = wmoData.liquidInfo.Value.Level;
|
||||
data.LiquidInfo.Value.depth_level = wmoData.floorZ;
|
||||
data.LiquidInfo.Value.entry = liquidType;
|
||||
|
||||
@@ -313,7 +313,7 @@ namespace Game.Movement
|
||||
public void SetAnimation(AnimType anim)
|
||||
{
|
||||
args.time_perc = 0.0f;
|
||||
args.animTier.HasValue = true;
|
||||
args.animTier.Value = new();
|
||||
args.animTier.Value.AnimTier = (byte)anim;
|
||||
args.flags.EnableAnimation();
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Game.Networking.Packets
|
||||
KnownPets[i] = _worldPacket.ReadUInt8();
|
||||
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.HasValue = true;
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint nameLength = _worldPacket.ReadBits<uint>(8);
|
||||
uint itemClassFilterCount = _worldPacket.ReadBits<uint>(3);
|
||||
@@ -79,10 +79,12 @@ namespace Game.Networking.Packets
|
||||
public override void Read()
|
||||
{
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
if (_worldPacket.HasBit())
|
||||
{
|
||||
TaintedBy.Value = new();
|
||||
TaintedBy.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,10 +102,12 @@ namespace Game.Networking.Packets
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
ItemID = _worldPacket.ReadInt32();
|
||||
Quantity = _worldPacket.ReadUInt32();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
if (_worldPacket.HasBit())
|
||||
{
|
||||
TaintedBy.Value = new();
|
||||
TaintedBy.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +137,8 @@ namespace Game.Networking.Packets
|
||||
{
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
Offset = _worldPacket.ReadUInt32();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint auctionIDCount = _worldPacket.ReadBits<uint>(7);
|
||||
uint sortCount = _worldPacket.ReadBits<uint>(2);
|
||||
@@ -161,7 +166,8 @@ namespace Game.Networking.Packets
|
||||
public override void Read()
|
||||
{
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint bucketKeysCount = _worldPacket.ReadBits<uint>(7);
|
||||
uint sortCount = _worldPacket.ReadBits<uint>(2);
|
||||
@@ -193,7 +199,8 @@ namespace Game.Networking.Packets
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
Offset = _worldPacket.ReadUInt32();
|
||||
Unknown830 = _worldPacket.ReadInt8();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint sortCount = _worldPacket.ReadBits<uint>(2);
|
||||
for (var i = 0; i < sortCount; ++i)
|
||||
@@ -225,7 +232,7 @@ namespace Game.Networking.Packets
|
||||
Offset = _worldPacket.ReadUInt32();
|
||||
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.HasValue = true;
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint sortCount = _worldPacket.ReadBits<uint>(2);
|
||||
|
||||
@@ -250,7 +257,8 @@ namespace Game.Networking.Packets
|
||||
{
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
Offset = _worldPacket.ReadUInt32();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint sortCount = _worldPacket.ReadBits<uint>(2);
|
||||
|
||||
@@ -276,10 +284,12 @@ namespace Game.Networking.Packets
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
AuctionID = _worldPacket.ReadUInt32();
|
||||
BidAmount = _worldPacket.ReadUInt64();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
if (_worldPacket.HasBit())
|
||||
{
|
||||
TaintedBy.Value = new();
|
||||
TaintedBy.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,10 +305,12 @@ namespace Game.Networking.Packets
|
||||
{
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
AuctionID = _worldPacket.ReadUInt32();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
if (_worldPacket.HasBit())
|
||||
{
|
||||
TaintedBy.Value = new();
|
||||
TaintedBy.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,10 +332,12 @@ namespace Game.Networking.Packets
|
||||
ChangeNumberCursor = _worldPacket.ReadUInt32();
|
||||
ChangeNumberTombstone = _worldPacket.ReadUInt32();
|
||||
Count = _worldPacket.ReadUInt32();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
if (_worldPacket.HasBit())
|
||||
{
|
||||
TaintedBy.Value = new();
|
||||
TaintedBy.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,7 +356,9 @@ namespace Game.Networking.Packets
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
UnitPrice = _worldPacket.ReadUInt64();
|
||||
RunTime = _worldPacket.ReadUInt32();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint itemCount = _worldPacket.ReadBits<uint>(6);
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
@@ -371,7 +387,9 @@ namespace Game.Networking.Packets
|
||||
BuyoutPrice = _worldPacket.ReadUInt64();
|
||||
RunTime = _worldPacket.ReadUInt32();
|
||||
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint itemCount = _worldPacket.ReadBits<uint>(6);
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
@@ -410,10 +428,12 @@ namespace Game.Networking.Packets
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
ItemID = _worldPacket.ReadInt32();
|
||||
Quantity = _worldPacket.ReadUInt32();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
if (_worldPacket.HasBit())
|
||||
{
|
||||
TaintedBy.Value = new();
|
||||
TaintedBy.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,12 +739,12 @@ namespace Game.Networking.Packets
|
||||
ItemID = data.ReadBits<uint>(20);
|
||||
|
||||
if (data.HasBit())
|
||||
BattlePetSpeciesID.HasValue = true;
|
||||
BattlePetSpeciesID.Value = new();
|
||||
|
||||
ItemLevel = data.ReadBits<ushort>(11);
|
||||
|
||||
if (data.HasBit())
|
||||
SuffixItemNameDescriptionID.HasValue = true;
|
||||
SuffixItemNameDescriptionID.Value = new();
|
||||
|
||||
if (BattlePetSpeciesID.HasValue)
|
||||
BattlePetSpeciesID.Set(data.ReadUInt16());
|
||||
|
||||
@@ -855,7 +855,7 @@ namespace Game.Networking.Packets
|
||||
List<uint> bonusListIds = item.m_itemData.BonusListIDs;
|
||||
if (!bonusListIds.Empty())
|
||||
{
|
||||
ItemBonus.HasValue = true;
|
||||
ItemBonus.Value = new();
|
||||
ItemBonus.Value.BonusListIDs.AddRange(bonusListIds);
|
||||
ItemBonus.Value.Context = item.GetContext();
|
||||
}
|
||||
@@ -870,7 +870,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (!lootItem.BonusListIDs.Empty() || lootItem.randomBonusListId != 0)
|
||||
{
|
||||
ItemBonus.HasValue = true;
|
||||
ItemBonus.Value = new();
|
||||
ItemBonus.Value.BonusListIDs = lootItem.BonusListIDs;
|
||||
ItemBonus.Value.Context = lootItem.context;
|
||||
if (lootItem.randomBonusListId != 0)
|
||||
@@ -890,7 +890,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (!voidItem.BonusListIDs.Empty())
|
||||
{
|
||||
ItemBonus.HasValue = true;
|
||||
ItemBonus.Value = new();
|
||||
ItemBonus.Value.Context = voidItem.Context;
|
||||
ItemBonus.Value.BonusListIDs = voidItem.BonusListIDs;
|
||||
}
|
||||
@@ -927,7 +927,9 @@ namespace Game.Networking.Packets
|
||||
{
|
||||
ItemID = data.ReadUInt32();
|
||||
|
||||
ItemBonus.HasValue = data.HasBit();
|
||||
if (data.HasBit())
|
||||
ItemBonus.Value = new();
|
||||
|
||||
data.ResetBitPos();
|
||||
|
||||
Modifications.Read(data);
|
||||
|
||||
@@ -674,7 +674,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (!isCurrency)
|
||||
{
|
||||
RewardItem.HasValue = true;
|
||||
RewardItem.Value = new();
|
||||
RewardItem.Value.ItemID = id;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -377,7 +377,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (splineFlags.HasFlag(SplineFlag.Animation))
|
||||
{
|
||||
movementSpline.AnimTierTransition.HasValue = true;
|
||||
movementSpline.AnimTierTransition.Value = new();
|
||||
movementSpline.AnimTierTransition.Value.TierTransitionID = (int)moveSpline.anim_tier.Value.TierTransitionId;
|
||||
movementSpline.AnimTierTransition.Value.StartTime = (uint)moveSpline.effect_start_time;
|
||||
movementSpline.AnimTierTransition.Value.AnimTier = moveSpline.anim_tier.Value.AnimTier;
|
||||
@@ -387,7 +387,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (splineFlags.HasFlag(SplineFlag.Parabolic) && (!moveSpline.spell_effect_extra.HasValue || moveSpline.effect_start_time != 0))
|
||||
{
|
||||
movementSpline.JumpExtraData.HasValue = true;
|
||||
movementSpline.JumpExtraData.Value = new();
|
||||
movementSpline.JumpExtraData.Value.JumpGravity = moveSpline.vertical_acceleration;
|
||||
movementSpline.JumpExtraData.Value.StartTime = (uint)moveSpline.effect_start_time;
|
||||
}
|
||||
@@ -397,7 +397,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (moveSpline.spell_effect_extra.HasValue)
|
||||
{
|
||||
movementSpline.SpellEffectExtraData.HasValue = true;
|
||||
movementSpline.SpellEffectExtraData.Value = new();
|
||||
movementSpline.SpellEffectExtraData.Value.TargetGuid = moveSpline.spell_effect_extra.Value.Target;
|
||||
movementSpline.SpellEffectExtraData.Value.SpellVisualID = moveSpline.spell_effect_extra.Value.SpellVisualId;
|
||||
movementSpline.SpellEffectExtraData.Value.ProgressCurveID = moveSpline.spell_effect_extra.Value.ProgressCurveId;
|
||||
@@ -915,7 +915,7 @@ namespace Game.Networking.Packets
|
||||
Ack.Read(_worldPacket);
|
||||
if (_worldPacket.HasBit())
|
||||
{
|
||||
Speeds.HasValue = true;
|
||||
Speeds.Value = new();
|
||||
Speeds.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ namespace Game.Networking.Packets
|
||||
{
|
||||
Pet pet = player.GetPet();
|
||||
|
||||
MemberStats.PetStats.HasValue = true;
|
||||
MemberStats.PetStats.Value = new();
|
||||
|
||||
MemberStats.PetStats.Value.GUID = pet.GetGUID();
|
||||
MemberStats.PetStats.Value.Name = pet.GetName();
|
||||
|
||||
@@ -1519,10 +1519,18 @@ namespace Game.Networking.Packets
|
||||
public void Read(WorldPacket data)
|
||||
{
|
||||
Flags = (SpellCastTargetFlags)data.ReadBits<uint>(26);
|
||||
SrcLocation.HasValue = data.HasBit();
|
||||
DstLocation.HasValue = data.HasBit();
|
||||
Orientation.HasValue = data.HasBit();
|
||||
MapID.HasValue = data.HasBit();
|
||||
if (data.HasBit())
|
||||
SrcLocation.Value = new();
|
||||
|
||||
if (data.HasBit())
|
||||
DstLocation.Value = new();
|
||||
|
||||
if (data.HasBit())
|
||||
Orientation.Value = new();
|
||||
|
||||
if (data.HasBit())
|
||||
MapID.Value = new();
|
||||
|
||||
uint nameLength = data.ReadBits<uint>(7);
|
||||
|
||||
Unit = data.ReadPackedGuid();
|
||||
@@ -1661,7 +1669,9 @@ namespace Game.Networking.Packets
|
||||
OptionalCurrencies[i].Read(data);
|
||||
|
||||
SendCastFlags = data.ReadBits<uint>(5);
|
||||
MoveUpdate.HasValue = data.HasBit();
|
||||
if (data.HasBit())
|
||||
MoveUpdate.Value = new();
|
||||
|
||||
var weightCount = data.ReadBits<uint>(2);
|
||||
Target.Read(data);
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (hasClubMessage)
|
||||
{
|
||||
CommunityMessage.HasValue = true;
|
||||
CommunityMessage.Value = new();
|
||||
CommunityMessage.Value.IsPlayerUsingVoice = _worldPacket.HasBit();
|
||||
_worldPacket.ResetBitPos();
|
||||
}
|
||||
@@ -158,49 +158,49 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (hasMailInfo)
|
||||
{
|
||||
MailInfo.HasValue = true;
|
||||
MailInfo.Value = new();
|
||||
MailInfo.Value.Read(_worldPacket);
|
||||
}
|
||||
|
||||
if (hasCalendarInfo)
|
||||
{
|
||||
CalenderInfo.HasValue = true;
|
||||
CalenderInfo.Value = new();
|
||||
CalenderInfo.Value.Read(_worldPacket);
|
||||
}
|
||||
|
||||
if (hasPetInfo)
|
||||
{
|
||||
PetInfo.HasValue = true;
|
||||
PetInfo.Value = new();
|
||||
PetInfo.Value.Read(_worldPacket);
|
||||
}
|
||||
|
||||
if (hasGuildInfo)
|
||||
{
|
||||
GuildInfo.HasValue = true;
|
||||
GuildInfo.Value = new();
|
||||
GuildInfo.Value.Read(_worldPacket);
|
||||
}
|
||||
|
||||
if (hasLFGListSearchResult)
|
||||
{
|
||||
LFGListSearchResult.HasValue = true;
|
||||
LFGListSearchResult.Value = new();
|
||||
LFGListSearchResult.Value.Read(_worldPacket);
|
||||
}
|
||||
|
||||
if (hasLFGListApplicant)
|
||||
{
|
||||
LFGListApplicant.HasValue = true;
|
||||
LFGListApplicant.Value = new();
|
||||
LFGListApplicant.Value.Read(_worldPacket);
|
||||
}
|
||||
|
||||
if (hasClubFinderResult)
|
||||
{
|
||||
ClubFinderResult.HasValue = true;
|
||||
ClubFinderResult.Value = new();
|
||||
ClubFinderResult.Value.Read(_worldPacket);
|
||||
}
|
||||
|
||||
if (hasUnk910)
|
||||
{
|
||||
Unused910.HasValue = true;
|
||||
Unused910.Value = new();
|
||||
Unused910.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
@@ -250,7 +250,9 @@ namespace Game.Networking.Packets
|
||||
public void Read(WorldPacket data)
|
||||
{
|
||||
uint linesCount = data.ReadUInt32();
|
||||
ReportLineIndex.HasValue = data.HasBit();
|
||||
if (data.HasBit())
|
||||
ReportLineIndex.Value = new();
|
||||
|
||||
data.ResetBitPos();
|
||||
|
||||
for (uint i = 0; i < linesCount; i++)
|
||||
@@ -279,19 +281,19 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (hasClubID)
|
||||
{
|
||||
ClubID.HasValue = true;
|
||||
ClubID.Value = new();
|
||||
ClubID.Value = data.ReadUInt64();
|
||||
}
|
||||
|
||||
if (hasChannelGUID)
|
||||
{
|
||||
ChannelGUID.HasValue = true;
|
||||
ChannelGUID.Value = new();
|
||||
ChannelGUID.Value = data.ReadPackedGuid();
|
||||
}
|
||||
|
||||
if (hasRealmAddress)
|
||||
{
|
||||
RealmAddress.HasValue = true;
|
||||
RealmAddress.Value = new();
|
||||
RealmAddress.Value.VirtualRealmAddress = data.ReadUInt32();
|
||||
RealmAddress.Value.field_4 = data.ReadUInt16();
|
||||
RealmAddress.Value.field_6 = data.ReadUInt8();
|
||||
@@ -299,7 +301,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (hasSlashCmd)
|
||||
{
|
||||
SlashCmd.HasValue = true;
|
||||
SlashCmd.Value = new();
|
||||
SlashCmd.Value = data.ReadInt32();
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,9 @@ namespace Game.Networking.Packets
|
||||
ShowEnemies = data.HasBit();
|
||||
ShowArenaPlayers = data.HasBit();
|
||||
ExactName = data.HasBit();
|
||||
ServerInfo.HasValue = data.HasBit();
|
||||
if (data.HasBit())
|
||||
ServerInfo.Value = new();
|
||||
|
||||
data.ResetBitPos();
|
||||
|
||||
for (int i = 0; i < wordsCount; ++i)
|
||||
|
||||
@@ -775,8 +775,8 @@ namespace Game.Networking
|
||||
public void SendAuthResponseError(BattlenetRpcErrorCode code)
|
||||
{
|
||||
AuthResponse response = new();
|
||||
response.SuccessInfo.HasValue = false;
|
||||
response.WaitInfo.HasValue = false;
|
||||
response.SuccessInfo.Clear();
|
||||
response.WaitInfo.Clear();
|
||||
response.Result = code;
|
||||
SendPacket(response);
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace Game.Spells
|
||||
if (remove)
|
||||
return;
|
||||
|
||||
auraInfo.AuraData.HasValue = true;
|
||||
auraInfo.AuraData.Value = new();
|
||||
|
||||
Aura aura = GetBase();
|
||||
|
||||
|
||||
@@ -3539,7 +3539,7 @@ namespace Game.Spells
|
||||
|
||||
if (castFlags.HasAnyFlag(SpellCastFlags.RuneList)) // rune cooldowns list
|
||||
{
|
||||
castData.RemainingRunes.HasValue = true;
|
||||
castData.RemainingRunes.Value = new();
|
||||
|
||||
RuneData runeData = castData.RemainingRunes.Value;
|
||||
//TODO: There is a crash caused by a spell with CAST_FLAG_RUNE_LIST casted by a creature
|
||||
@@ -3654,7 +3654,7 @@ namespace Game.Spells
|
||||
|
||||
if (Convert.ToBoolean(castFlags & SpellCastFlags.RuneList)) // rune cooldowns list
|
||||
{
|
||||
castData.RemainingRunes.HasValue = true;
|
||||
castData.RemainingRunes.Value = new();
|
||||
RuneData runeData = castData.RemainingRunes.Value;
|
||||
|
||||
Player player = m_caster.ToPlayer();
|
||||
@@ -3965,7 +3965,7 @@ namespace Game.Spells
|
||||
|
||||
if (schoolImmunityMask != 0 || mechanicImmunityMask != 0)
|
||||
{
|
||||
spellChannelStart.InterruptImmunities.HasValue = true;
|
||||
spellChannelStart.InterruptImmunities.Value = new();
|
||||
spellChannelStart.InterruptImmunities.Value.SchoolImmunities = (int)schoolImmunityMask;
|
||||
spellChannelStart.InterruptImmunities.Value.Immunities = (int)mechanicImmunityMask;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Game.Spells
|
||||
|
||||
if (m_targetMask.HasAnyFlag(SpellCastTargetFlags.SourceLocation))
|
||||
{
|
||||
data.SrcLocation.HasValue = true;
|
||||
data.SrcLocation.Value = new();
|
||||
TargetLocation target = new();
|
||||
target.Transport = m_src.TransportGUID; // relative position guid here - transport for example
|
||||
if (!m_src.TransportGUID.IsEmpty())
|
||||
@@ -101,7 +101,7 @@ namespace Game.Spells
|
||||
|
||||
if (Convert.ToBoolean(m_targetMask & SpellCastTargetFlags.DestLocation))
|
||||
{
|
||||
data.DstLocation.HasValue = true;
|
||||
data.DstLocation.Value = new();
|
||||
TargetLocation target = new();
|
||||
target.Transport = m_dst.TransportGUID; // relative position guid here - transport for example
|
||||
if (!m_dst.TransportGUID.IsEmpty())
|
||||
|
||||
@@ -5395,14 +5395,14 @@ namespace Game.Spells
|
||||
Optional<JumpArrivalCastArgs> arrivalCast = new();
|
||||
if (effectInfo.TriggerSpell != 0)
|
||||
{
|
||||
arrivalCast.HasValue = true;
|
||||
arrivalCast.Value = new();
|
||||
arrivalCast.Value.SpellId = effectInfo.TriggerSpell;
|
||||
}
|
||||
|
||||
Optional<SpellEffectExtraData> effectExtra = new();
|
||||
if (jumpParams.SpellVisualId.HasValue || jumpParams.ProgressCurveId.HasValue || jumpParams.ParabolicCurveId.HasValue)
|
||||
{
|
||||
effectExtra.HasValue = true;
|
||||
effectExtra.Value = new();
|
||||
if (jumpParams.SpellVisualId.HasValue)
|
||||
effectExtra.Value.SpellVisualId = jumpParams.SpellVisualId.Value;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Game.Chat
|
||||
|
||||
if (!TranslatedPacket.HasValue)
|
||||
{
|
||||
TranslatedPacket.HasValue = true;
|
||||
TranslatedPacket.Value = new();
|
||||
TranslatedPacket.Value.Initialize(Type, Language, Sender, Receiver, Global.LanguageMgr.Translate(Text, (uint)Language, player.GetSession().GetSessionDbcLocale()), AchievementId, "", Locale);
|
||||
TranslatedPacket.Value.Write();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user