Remove custom OptionalType and use the default c# nullable type.

This commit is contained in:
hondacrx
2022-03-01 17:27:56 -05:00
parent cc08afe269
commit c14f1eb3dc
89 changed files with 924 additions and 976 deletions
-63
View File
@@ -1,63 +0,0 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Framework.Dynamic
{
public struct Optional<T>
{
private bool _hasValue;
public T Value;
public Optional(T value)
{
Value = value;
_hasValue = true;
}
public bool HasValue
{
get { return _hasValue; }
}
public void Set(T value)
{
Value = value;
_hasValue = true;
}
public void Clear()
{
_hasValue = false;
Value = default;
}
public T ValueOr(T otherValue)
{
return HasValue ? Value : otherValue;
}
public static explicit operator T(Optional<T> optional)
{
return optional.Value;
}
public static implicit operator Optional<T>(T value)
{
return new Optional<T>(value);
}
}
}
+5 -5
View File
@@ -403,7 +403,7 @@ namespace Framework.Dynamic
{ {
_end = end; _end = end;
_duration = duration; _duration = duration;
_group.Set(group); _group = group;
_repeated = repeated; _repeated = repeated;
_task = task; _task = task;
} }
@@ -427,12 +427,12 @@ namespace Framework.Dynamic
/// <returns></returns> /// <returns></returns>
public bool IsInGroup(uint group) public bool IsInGroup(uint group)
{ {
return _group.HasValue && _group.Value == group; return _group.HasValue && _group == group;
} }
internal DateTime _end; internal DateTime _end;
internal TimeSpan _duration; internal TimeSpan _duration;
internal Optional<uint> _group; internal uint? _group;
internal uint _repeated; internal uint _repeated;
internal Action<TaskContext> _task; internal Action<TaskContext> _task;
} }
@@ -551,7 +551,7 @@ namespace Framework.Dynamic
/// <returns></returns> /// <returns></returns>
TaskContext SetGroup(uint group) TaskContext SetGroup(uint group)
{ {
_task._group.Set(group); _task._group = group;
return this; return this;
} }
@@ -561,7 +561,7 @@ namespace Framework.Dynamic
/// <returns></returns> /// <returns></returns>
TaskContext ClearGroup() TaskContext ClearGroup()
{ {
_task._group.Clear(); _task._group = null;
return this; return this;
} }
+12 -12
View File
@@ -2079,10 +2079,10 @@ namespace Game.Achievements
foreach (Garrison.Plot plot in garrison.GetPlots()) foreach (Garrison.Plot plot in garrison.GetPlots())
{ {
if (!plot.BuildingInfo.PacketInfo.HasValue) if (plot.BuildingInfo.PacketInfo == null)
continue; continue;
GarrBuildingRecord building = CliDB.GarrBuildingStorage.LookupByKey(plot.BuildingInfo.PacketInfo.Value.GarrBuildingID); GarrBuildingRecord building = CliDB.GarrBuildingStorage.LookupByKey(plot.BuildingInfo.PacketInfo.GarrBuildingID);
if (building == null || building.UpgradeLevel < reqValue || building.BuildingType != secondaryAsset) if (building == null || building.UpgradeLevel < reqValue || building.BuildingType != secondaryAsset)
continue; continue;
@@ -2109,7 +2109,7 @@ namespace Game.Achievements
return false; return false;
foreach (var plot in garrison.GetPlots()) foreach (var plot in garrison.GetPlots())
if (!plot.BuildingInfo.PacketInfo.HasValue) if (plot.BuildingInfo.PacketInfo == null)
return false; return false;
break; break;
} }
@@ -2131,10 +2131,10 @@ namespace Game.Achievements
foreach (Garrison.Plot plot in garrison.GetPlots()) foreach (Garrison.Plot plot in garrison.GetPlots())
{ {
if (!plot.BuildingInfo.PacketInfo.HasValue || plot.BuildingInfo.PacketInfo.Value.GarrBuildingID != reqValue) if (plot.BuildingInfo.PacketInfo == null || plot.BuildingInfo.PacketInfo.GarrBuildingID != reqValue)
continue; continue;
return !plot.BuildingInfo.PacketInfo.Value.Active; return !plot.BuildingInfo.PacketInfo.Active;
} }
return false; return false;
} }
@@ -2148,10 +2148,10 @@ namespace Game.Achievements
foreach (Garrison.Plot plot in garrison.GetPlots()) foreach (Garrison.Plot plot in garrison.GetPlots())
{ {
if (!plot.BuildingInfo.PacketInfo.HasValue) if (plot.BuildingInfo.PacketInfo == null)
continue; continue;
GarrBuildingRecord building = CliDB.GarrBuildingStorage.LookupByKey(plot.BuildingInfo.PacketInfo.Value.GarrBuildingID); GarrBuildingRecord building = CliDB.GarrBuildingStorage.LookupByKey(plot.BuildingInfo.PacketInfo.GarrBuildingID);
if (building == null || building.UpgradeLevel != secondaryAsset || building.BuildingType != reqValue) if (building == null || building.UpgradeLevel != secondaryAsset || building.BuildingType != reqValue)
continue; continue;
@@ -2276,10 +2276,10 @@ namespace Game.Achievements
foreach (var plot in garrison.GetPlots()) foreach (var plot in garrison.GetPlots())
{ {
if (!plot.BuildingInfo.PacketInfo.HasValue || plot.BuildingInfo.PacketInfo.Value.GarrBuildingID != miscValue1) if (plot.BuildingInfo.PacketInfo == null || plot.BuildingInfo.PacketInfo.GarrBuildingID != miscValue1)
continue; continue;
var building = CliDB.GarrBuildingStorage.LookupByKey(plot.BuildingInfo.PacketInfo.Value.GarrBuildingID); var building = CliDB.GarrBuildingStorage.LookupByKey(plot.BuildingInfo.PacketInfo.GarrBuildingID);
if (building == null || building.UpgradeLevel != reqValue) if (building == null || building.UpgradeLevel != reqValue)
continue; continue;
@@ -2297,7 +2297,7 @@ namespace Game.Achievements
if (plot == null) if (plot == null)
return false; return false;
if (!plot.BuildingInfo.CanActivate() || !plot.BuildingInfo.PacketInfo.HasValue || plot.BuildingInfo.PacketInfo.Value.Active) if (!plot.BuildingInfo.CanActivate() || plot.BuildingInfo.PacketInfo == null || plot.BuildingInfo.PacketInfo.Active)
return false; return false;
break; break;
} }
@@ -2398,10 +2398,10 @@ namespace Game.Achievements
foreach (var plot in garrison.GetPlots()) foreach (var plot in garrison.GetPlots())
{ {
if (!plot.BuildingInfo.PacketInfo.HasValue) if (plot.BuildingInfo.PacketInfo == null)
return false; return false;
var building = CliDB.GarrBuildingStorage.LookupByKey(plot.BuildingInfo.PacketInfo.Value.GarrBuildingID); var building = CliDB.GarrBuildingStorage.LookupByKey(plot.BuildingInfo.PacketInfo.GarrBuildingID);
if (building == null || building.UpgradeLevel != reqValue) if (building == null || building.UpgradeLevel != reqValue)
return false; return false;
} }
+4 -4
View File
@@ -104,12 +104,12 @@ namespace Game.Arenas
if (IsRated()) if (IsRated())
{ {
pvpLogData.Ratings.Value = new(); pvpLogData.Ratings = new();
for (byte i = 0; i < SharedConst.PvpTeamsCount; ++i) for (byte i = 0; i < SharedConst.PvpTeamsCount; ++i)
{ {
pvpLogData.Ratings.Value.Postmatch[i] = _arenaTeamScores[i].PostMatchRating; pvpLogData.Ratings.Postmatch[i] = _arenaTeamScores[i].PostMatchRating;
pvpLogData.Ratings.Value.Prematch[i] = _arenaTeamScores[i].PreMatchRating; pvpLogData.Ratings.Prematch[i] = _arenaTeamScores[i].PreMatchRating;
pvpLogData.Ratings.Value.PrematchMMR[i] = _arenaTeamScores[i].PreMatchMMR; pvpLogData.Ratings.PrematchMMR[i] = _arenaTeamScores[i].PreMatchMMR;
} }
} }
} }
+4 -4
View File
@@ -34,16 +34,16 @@ namespace Game.Arenas
base.BuildPvPLogPlayerDataPacket(out playerData); base.BuildPvPLogPlayerDataPacket(out playerData);
if (PreMatchRating != 0) if (PreMatchRating != 0)
playerData.PreMatchRating.Set(PreMatchRating); playerData.PreMatchRating = PreMatchRating;
if (PostMatchRating != PreMatchRating) if (PostMatchRating != PreMatchRating)
playerData.RatingChange.Set((int)(PostMatchRating - PreMatchRating)); playerData.RatingChange = (int)(PostMatchRating - PreMatchRating);
if (PreMatchMMR != 0) if (PreMatchMMR != 0)
playerData.PreMatchMMR.Set(PreMatchMMR); playerData.PreMatchMMR = PreMatchMMR;
if (PostMatchMMR != PreMatchMMR) if (PostMatchMMR != PreMatchMMR)
playerData.MmrChange.Set((int)(PostMatchMMR - PreMatchMMR)); playerData.MmrChange = (int)(PostMatchMMR - PreMatchMMR);
} }
// For Logging purpose // For Logging purpose
+11 -10
View File
@@ -17,9 +17,10 @@
using Framework.Constants; using Framework.Constants;
using Framework.Dynamic; using Framework.Dynamic;
using Game.BattleGrounds;
using Game.Entities; using Game.Entities;
using Game.Networking.Packets; using Game.Networking.Packets;
using Game.BattleGrounds; using System;
namespace Game.Arenas namespace Game.Arenas
{ {
@@ -44,7 +45,7 @@ namespace Game.Arenas
for (int i = DalaranSewersObjectTypes.Buff1; i <= DalaranSewersObjectTypes.Buff2; ++i) for (int i = DalaranSewersObjectTypes.Buff1; i <= DalaranSewersObjectTypes.Buff2; ++i)
SpawnBGObject(i, 60); SpawnBGObject(i, 60);
_events.ScheduleEvent(DalaranSewersEvents.WaterfallWarning, RandomHelper.URand(DalaranSewersData.WaterfallTimerMin, DalaranSewersData.WaterfallTimerMax)); _events.ScheduleEvent(DalaranSewersEvents.WaterfallWarning, DalaranSewersData.WaterfallTimerMin, DalaranSewersData.WaterfallTimerMax);
_events.ScheduleEvent(DalaranSewersEvents.PipeKnockback, DalaranSewersData.PipeKnockbackFirstDelay); _events.ScheduleEvent(DalaranSewersEvents.PipeKnockback, DalaranSewersData.PipeKnockbackFirstDelay);
SpawnBGObject(DalaranSewersObjectTypes.Water2, BattlegroundConst.RespawnImmediately); SpawnBGObject(DalaranSewersObjectTypes.Water2, BattlegroundConst.RespawnImmediately);
@@ -148,7 +149,7 @@ namespace Game.Arenas
DoorOpen(DalaranSewersObjectTypes.Water1); DoorOpen(DalaranSewersObjectTypes.Water1);
DoorOpen(DalaranSewersObjectTypes.Water2); DoorOpen(DalaranSewersObjectTypes.Water2);
_events.CancelEvent(DalaranSewersEvents.WaterfallKnockback); _events.CancelEvent(DalaranSewersEvents.WaterfallKnockback);
_events.ScheduleEvent(DalaranSewersEvents.WaterfallWarning, RandomHelper.URand(DalaranSewersData.WaterfallTimerMin, DalaranSewersData.WaterfallTimerMax)); _events.ScheduleEvent(DalaranSewersEvents.WaterfallWarning, DalaranSewersData.WaterfallTimerMin, DalaranSewersData.WaterfallTimerMax);
break; break;
case DalaranSewersEvents.WaterfallKnockback: case DalaranSewersEvents.WaterfallKnockback:
{ {
@@ -218,14 +219,14 @@ namespace Game.Arenas
struct DalaranSewersData struct DalaranSewersData
{ {
// These values are NOT blizzlike... need the correct data! // These values are NOT blizzlike... need the correct data!
public const uint WaterfallTimerMin = 30000; public static TimeSpan WaterfallTimerMin = TimeSpan.FromSeconds(30);
public const uint WaterfallTimerMax = 60000; public static TimeSpan WaterfallTimerMax = TimeSpan.FromSeconds(60);
public const uint WaterWarningDuration = 5000; public static TimeSpan WaterWarningDuration = TimeSpan.FromSeconds(5);
public const uint WaterfallDuration = 30000; public static TimeSpan WaterfallDuration = TimeSpan.FromSeconds(30);
public const uint WaterfallKnockbackTimer = 1500; public static TimeSpan WaterfallKnockbackTimer = TimeSpan.FromSeconds(1.5);
public const uint PipeKnockbackFirstDelay = 5000; public static TimeSpan PipeKnockbackFirstDelay = TimeSpan.FromSeconds(5);
public const uint PipeKnockbackDelay = 3000; public static TimeSpan PipeKnockbackDelay = TimeSpan.FromSeconds(3);
public const uint PipeKnockbackTotalCount = 2; public const uint PipeKnockbackTotalCount = 2;
public const uint NpcWaterSpout = 28567; public const uint NpcWaterSpout = 28567;
+6 -5
View File
@@ -17,9 +17,10 @@
using Framework.Constants; using Framework.Constants;
using Framework.Dynamic; using Framework.Dynamic;
using Game.BattleGrounds;
using Game.Entities; using Game.Entities;
using Game.Networking.Packets; using Game.Networking.Packets;
using Game.BattleGrounds; using System;
namespace Game.Arenas namespace Game.Arenas
{ {
@@ -95,7 +96,7 @@ namespace Game.Arenas
DoorOpen(RingofValorObjectTypes.Elevator1); DoorOpen(RingofValorObjectTypes.Elevator1);
DoorOpen(RingofValorObjectTypes.Elevator2); DoorOpen(RingofValorObjectTypes.Elevator2);
_events.ScheduleEvent(RingofValorEvents.OpenFences, 20133); _events.ScheduleEvent(RingofValorEvents.OpenFences, TimeSpan.FromSeconds(20));
// Should be false at first, TogglePillarCollision will do it. // Should be false at first, TogglePillarCollision will do it.
TogglePillarCollision(true); TogglePillarCollision(true);
@@ -141,17 +142,17 @@ namespace Game.Arenas
// Open fire (only at game start) // Open fire (only at game start)
for (byte i = RingofValorObjectTypes.Fire1; i <= RingofValorObjectTypes.Firedoor2; ++i) for (byte i = RingofValorObjectTypes.Fire1; i <= RingofValorObjectTypes.Firedoor2; ++i)
DoorOpen(i); DoorOpen(i);
_events.ScheduleEvent(RingofValorEvents.CloseFire, 5000); _events.ScheduleEvent(RingofValorEvents.CloseFire, TimeSpan.FromSeconds(5));
break; break;
case RingofValorEvents.CloseFire: case RingofValorEvents.CloseFire:
for (byte i = RingofValorObjectTypes.Fire1; i <= RingofValorObjectTypes.Firedoor2; ++i) for (byte i = RingofValorObjectTypes.Fire1; i <= RingofValorObjectTypes.Firedoor2; ++i)
DoorClose(i); DoorClose(i);
// Fire got closed after five seconds, leaves twenty seconds before toggling pillars // Fire got closed after five seconds, leaves twenty seconds before toggling pillars
_events.ScheduleEvent(RingofValorEvents.SwitchPillars, 20000); _events.ScheduleEvent(RingofValorEvents.SwitchPillars, TimeSpan.FromSeconds(20));
break; break;
case RingofValorEvents.SwitchPillars: case RingofValorEvents.SwitchPillars:
TogglePillarCollision(true); TogglePillarCollision(true);
_events.Repeat(25000); _events.Repeat(TimeSpan.FromSeconds(25));
break; break;
} }
}); });
+23 -27
View File
@@ -817,7 +817,7 @@ namespace Game
DB.Characters.CommitTransaction(trans); DB.Characters.CommitTransaction(trans);
} }
public void BuildListBuckets(AuctionListBucketsResult listBucketsResult, Player player, string name, byte minLevel, byte maxLevel, AuctionHouseFilterMask filters, Optional<AuctionSearchClassFilters> classFilters, public void BuildListBuckets(AuctionListBucketsResult listBucketsResult, Player player, string name, byte minLevel, byte maxLevel, AuctionHouseFilterMask filters, AuctionSearchClassFilters classFilters,
byte[] knownPetBits, int knownPetBitsCount, byte maxKnownPetLevel, uint offset, AuctionSortDef[] sorts, int sortCount) byte[] knownPetBits, int knownPetBitsCount, byte maxKnownPetLevel, uint offset, AuctionSortDef[] sorts, int sortCount)
{ {
List<uint> knownAppearanceIds = new(); List<uint> knownAppearanceIds = new();
@@ -860,21 +860,21 @@ namespace Game
if (!filters.HasFlag(bucketData.QualityMask)) if (!filters.HasFlag(bucketData.QualityMask))
continue; continue;
if (classFilters.HasValue) if (classFilters != null)
{ {
// if we dont want any class filters, Optional is not initialized // if we dont want any class filters, Optional is not initialized
// if we dont want this class included, SubclassMask is set to FILTER_SKIP_CLASS // if we dont want this class included, SubclassMask is set to FILTER_SKIP_CLASS
// if we want this class and did not specify and subclasses, its set to FILTER_SKIP_SUBCLASS // if we want this class and did not specify and subclasses, its set to FILTER_SKIP_SUBCLASS
// otherwise full restrictions apply // otherwise full restrictions apply
if (classFilters.Value.Classes[bucketData.ItemClass].SubclassMask == AuctionSearchClassFilters.FilterType.SkipClass) if (classFilters.Classes[bucketData.ItemClass].SubclassMask == AuctionSearchClassFilters.FilterType.SkipClass)
continue; continue;
if (classFilters.Value.Classes[bucketData.ItemClass].SubclassMask != AuctionSearchClassFilters.FilterType.SkipSubclass) if (classFilters.Classes[bucketData.ItemClass].SubclassMask != AuctionSearchClassFilters.FilterType.SkipSubclass)
{ {
if (!classFilters.Value.Classes[bucketData.ItemClass].SubclassMask.HasAnyFlag((AuctionSearchClassFilters.FilterType)(1 << bucketData.ItemSubClass))) if (!classFilters.Classes[bucketData.ItemClass].SubclassMask.HasAnyFlag((AuctionSearchClassFilters.FilterType)(1 << bucketData.ItemSubClass)))
continue; continue;
if (!classFilters.Value.Classes[bucketData.ItemClass].InvTypes[bucketData.ItemSubClass].HasAnyFlag(1u << bucketData.InventoryType)) if (!classFilters.Classes[bucketData.ItemClass].InvTypes[bucketData.ItemSubClass].HasAnyFlag(1u << bucketData.InventoryType))
continue; continue;
} }
} }
@@ -1244,7 +1244,7 @@ namespace Game
return false; return false;
} }
Optional<ObjectGuid> uniqueSeller = new(); ObjectGuid? uniqueSeller = new();
// prepare items // prepare items
List<MailedItemsBatch> items = new(); List<MailedItemsBatch> items = new();
@@ -1257,9 +1257,9 @@ namespace Game
{ {
AuctionPosting auction = bucketItr.Auctions[i++]; AuctionPosting auction = bucketItr.Auctions[i++];
if (!uniqueSeller.HasValue) if (!uniqueSeller.HasValue)
uniqueSeller.Set(auction.Owner); uniqueSeller = auction.Owner;
else if (uniqueSeller.Value != auction.Owner) else if (uniqueSeller != auction.Owner)
uniqueSeller.Set(ObjectGuid.Empty); uniqueSeller = ObjectGuid.Empty;
uint boughtFromAuction = 0; uint boughtFromAuction = 0;
int removedItems = 0; int removedItems = 0;
@@ -1657,17 +1657,13 @@ namespace Game
if (IsCommodity()) if (IsCommodity())
{ {
if (alwaysSendItem) if (alwaysSendItem)
{ auctionItem.Item = new ItemInstance(Items[0]);
auctionItem.Item.Value = new();
auctionItem.Item.Value = new ItemInstance(Items[0]);
}
auctionItem.UnitPrice.Set(BuyoutOrUnitPrice); auctionItem.UnitPrice = BuyoutOrUnitPrice;
} }
else else
{ {
auctionItem.Item.Value = new(); auctionItem.Item = new ItemInstance(Items[0]);
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(); 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++) for (EnchantmentSlot enchantmentSlot = 0; enchantmentSlot < EnchantmentSlot.MaxInspected; enchantmentSlot++)
{ {
@@ -1691,14 +1687,14 @@ namespace Game
} }
if (MinBid != 0) if (MinBid != 0)
auctionItem.MinBid.Set(MinBid); auctionItem.MinBid = MinBid;
ulong minIncrement = CalculateMinIncrement(); ulong minIncrement = CalculateMinIncrement();
if (minIncrement != 0) if (minIncrement != 0)
auctionItem.MinIncrement.Set(minIncrement); auctionItem.MinIncrement = minIncrement;
if (BuyoutOrUnitPrice != 0) if (BuyoutOrUnitPrice != 0)
auctionItem.BuyoutPrice.Set(BuyoutOrUnitPrice); auctionItem.BuyoutPrice = BuyoutOrUnitPrice;
} }
// all (not optional<>) // all (not optional<>)
@@ -1715,17 +1711,17 @@ namespace Game
auctionItem.CensorBidInfo = censorBidInfo; auctionItem.CensorBidInfo = censorBidInfo;
if (!Bidder.IsEmpty()) if (!Bidder.IsEmpty())
{ {
auctionItem.Bidder.Set(Bidder); auctionItem.Bidder = Bidder;
auctionItem.BidAmount.Set(BidAmount); auctionItem.BidAmount = BidAmount;
} }
// SMSG_AUCTION_LIST_BIDDER_ITEMS_RESULT, SMSG_AUCTION_LIST_OWNER_ITEMS_RESULT, SMSG_AUCTION_REPLICATE_RESPONSE (if commodity) // SMSG_AUCTION_LIST_BIDDER_ITEMS_RESULT, SMSG_AUCTION_LIST_OWNER_ITEMS_RESULT, SMSG_AUCTION_REPLICATE_RESPONSE (if commodity)
if (sendKey) if (sendKey)
auctionItem.AuctionBucketKey.Set(new AuctionBucketKey(AuctionsBucketKey.ForItem(Items[0]))); auctionItem.AuctionBucketKey = new(AuctionsBucketKey.ForItem(Items[0]));
// all // all
if (!Items[0].m_itemData.Creator._value.IsEmpty()) if (!Items[0].m_itemData.Creator._value.IsEmpty())
auctionItem.Creator.Set(Items[0].m_itemData.Creator); auctionItem.Creator = Items[0].m_itemData.Creator;
} }
public static ulong CalculateMinIncrement(ulong bidAmount) public static ulong CalculateMinIncrement(ulong bidAmount)
@@ -1837,9 +1833,9 @@ namespace Game
byte quality = (byte)((breedData >> 24) & 0xFF); byte quality = (byte)((breedData >> 24) & 0xFF);
byte level = (byte)(item.GetModifier(ItemModifier.BattlePetLevel)); byte level = (byte)(item.GetModifier(ItemModifier.BattlePetLevel));
bucketInfo.MaxBattlePetQuality.Set(bucketInfo.MaxBattlePetQuality.HasValue ? Math.Max(bucketInfo.MaxBattlePetQuality.Value, quality) : quality); bucketInfo.MaxBattlePetQuality = bucketInfo.MaxBattlePetQuality.HasValue ? Math.Max(bucketInfo.MaxBattlePetQuality.Value, quality) : quality;
bucketInfo.MaxBattlePetLevel.Set(bucketInfo.MaxBattlePetLevel.HasValue ? Math.Max(bucketInfo.MaxBattlePetLevel.Value, level) : level); bucketInfo.MaxBattlePetLevel = bucketInfo.MaxBattlePetLevel.HasValue ? Math.Max(bucketInfo.MaxBattlePetLevel.Value, level) : level;
bucketInfo.BattlePetBreedID.Set((byte)breedId); bucketInfo.BattlePetBreedID = (byte)breedId;
} }
} }
+1 -2
View File
@@ -702,8 +702,7 @@ namespace Game.BattleGrounds
PVPMatchComplete pvpMatchComplete = new(); PVPMatchComplete pvpMatchComplete = new();
pvpMatchComplete.Winner = (byte)GetWinner(); pvpMatchComplete.Winner = (byte)GetWinner();
pvpMatchComplete.Duration = (int)Math.Max(0, (GetElapsedTime() - (int)BattlegroundStartTimeIntervals.Delay2m) / Time.InMilliseconds); pvpMatchComplete.Duration = (int)Math.Max(0, (GetElapsedTime() - (int)BattlegroundStartTimeIntervals.Delay2m) / Time.InMilliseconds);
pvpMatchComplete.LogData.Value = new(); BuildPvPLogDataPacket(out pvpMatchComplete.LogData);
BuildPvPLogDataPacket(out pvpMatchComplete.LogData.Value);
pvpMatchComplete.Write(); pvpMatchComplete.Write();
foreach (var pair in m_Players) foreach (var pair in m_Players)
@@ -65,10 +65,11 @@ namespace Game.BattleGrounds
playerData.Faction = (byte)TeamId; playerData.Faction = (byte)TeamId;
if (HonorableKills != 0 || Deaths != 0 || BonusHonor != 0) if (HonorableKills != 0 || Deaths != 0 || BonusHonor != 0)
{ {
playerData.Honor.Value = new(); PVPMatchStatistics.HonorData playerDataHonor = new();
playerData.Honor.Value.HonorKills = HonorableKills; playerDataHonor.HonorKills = HonorableKills;
playerData.Honor.Value.Deaths = Deaths; playerDataHonor.Deaths = Deaths;
playerData.Honor.Value.ContributionPoints = BonusHonor; playerDataHonor.ContributionPoints = BonusHonor;
playerData.Honor = playerDataHonor;
} }
playerData.DamageDone = DamageDone; playerData.DamageDone = DamageDone;
+10 -8
View File
@@ -230,10 +230,11 @@ namespace Game.BattlePets
if (!ownerGuid.IsEmpty()) if (!ownerGuid.IsEmpty())
{ {
pet.PacketInfo.OwnerInfo.Value = new(); BattlePetStruct.BattlePetOwnerInfo battlePetOwnerInfo = new();
pet.PacketInfo.OwnerInfo.Value.Guid = ownerGuid; battlePetOwnerInfo.Guid = ownerGuid;
pet.PacketInfo.OwnerInfo.Value.PlayerVirtualRealm = Global.WorldMgr.GetVirtualRealmAddress(); battlePetOwnerInfo.PlayerVirtualRealm = Global.WorldMgr.GetVirtualRealmAddress();
pet.PacketInfo.OwnerInfo.Value.PlayerNativeRealm = Global.WorldMgr.GetVirtualRealmAddress(); battlePetOwnerInfo.PlayerNativeRealm = Global.WorldMgr.GetVirtualRealmAddress();
pet.PacketInfo.OwnerInfo = battlePetOwnerInfo;
} }
pet.SaveInfo = BattlePetSaveInfo.Unchanged; pet.SaveInfo = BattlePetSaveInfo.Unchanged;
@@ -398,10 +399,11 @@ namespace Game.BattlePets
Player player = _owner.GetPlayer(); Player player = _owner.GetPlayer();
if (battlePetSpecies.GetFlags().HasFlag(BattlePetSpeciesFlags.NotAccountWide)) if (battlePetSpecies.GetFlags().HasFlag(BattlePetSpeciesFlags.NotAccountWide))
{ {
pet.PacketInfo.OwnerInfo.Value = new(); BattlePetStruct.BattlePetOwnerInfo battlePetOwnerInfo = new();
pet.PacketInfo.OwnerInfo.Value.Guid = player.GetGUID(); battlePetOwnerInfo.Guid = player.GetGUID();
pet.PacketInfo.OwnerInfo.Value.PlayerVirtualRealm = Global.WorldMgr.GetVirtualRealmAddress(); battlePetOwnerInfo.PlayerVirtualRealm = Global.WorldMgr.GetVirtualRealmAddress();
pet.PacketInfo.OwnerInfo.Value.PlayerNativeRealm = Global.WorldMgr.GetVirtualRealmAddress(); battlePetOwnerInfo.PlayerNativeRealm = Global.WorldMgr.GetVirtualRealmAddress();
pet.PacketInfo.OwnerInfo = battlePetOwnerInfo;
} }
pet.SaveInfo = BattlePetSaveInfo.New; pet.SaveInfo = BattlePetSaveInfo.New;
+2 -2
View File
@@ -50,8 +50,8 @@ namespace Game.BlackMarket
if (!bonusListIDs.Empty()) if (!bonusListIDs.Empty())
{ {
Item.ItemBonus.Value = new(); Item.ItemBonus = new();
Item.ItemBonus.Value.BonusListIDs = bonusListIDs; Item.ItemBonus.BonusListIDs = bonusListIDs;
} }
if (Global.ObjectMgr.GetCreatureTemplate(SellerNPC) == null) if (Global.ObjectMgr.GetCreatureTemplate(SellerNPC) == null)
@@ -244,9 +244,9 @@ namespace Game.BlackMarket
if (!item) if (!item)
return; return;
if (templ.Item.ItemBonus.HasValue) if (templ.Item.ItemBonus != null)
{ {
foreach (uint bonusList in templ.Item.ItemBonus.Value.BonusListIDs) foreach (uint bonusList in templ.Item.ItemBonus.BonusListIDs)
item.AddBonuses(bonusList); item.AddBonuses(bonusList);
} }
@@ -128,7 +128,7 @@ namespace Game.Chat
packet.Data.TargetGUID = _guid; packet.Data.TargetGUID = _guid;
} }
packet.Data.ChannelGUID.Set(_channelGuid); packet.Data.ChannelGUID = _channelGuid;
return packet; return packet;
} }
+3 -5
View File
@@ -163,12 +163,10 @@ namespace Game.Collision
float liquidLevel = 0; float liquidLevel = 0;
if (reqLiquidType == 0 || (Global.DB2Mgr.GetLiquidFlags(liquidType) & reqLiquidType) != 0) if (reqLiquidType == 0 || (Global.DB2Mgr.GetLiquidFlags(liquidType) & reqLiquidType) != 0)
if (intersectionCallBack.GetHitModel().GetLiquidLevel(v, intersectionCallBack.GetLocationInfo(), ref liquidLevel)) if (intersectionCallBack.GetHitModel().GetLiquidLevel(v, intersectionCallBack.GetLocationInfo(), ref liquidLevel))
data.liquidInfo.Set(new AreaAndLiquidData.LiquidInfo(liquidType, liquidLevel)); data.liquidInfo = new AreaAndLiquidData.LiquidInfo(liquidType, liquidLevel);
data.areaInfo.Set(new AreaAndLiquidData.AreaInfo(intersectionCallBack.GetHitModel().GetNameSetId(), data.areaInfo = new(intersectionCallBack.GetHitModel().GetNameSetId(), intersectionCallBack.GetLocationInfo().rootId,
intersectionCallBack.GetLocationInfo().rootId, (int)intersectionCallBack.GetLocationInfo().hitModel.GetWmoID(), intersectionCallBack.GetLocationInfo().hitModel.GetMogpFlags());
(int)intersectionCallBack.GetLocationInfo().hitModel.GetWmoID(),
intersectionCallBack.GetLocationInfo().hitModel.GetMogpFlags()));
} }
return data; return data;
@@ -260,7 +260,7 @@ namespace Game.Collision
int adtId, rootId, groupId; int adtId, rootId, groupId;
uint flags; uint flags;
if (GetAreaInfo(mapId, x, y, ref data.floorZ, out flags, out adtId, out rootId, out groupId)) if (GetAreaInfo(mapId, x, y, ref data.floorZ, out flags, out adtId, out rootId, out groupId))
data.areaInfo.Set(new AreaAndLiquidData.AreaInfo(adtId, rootId, groupId, flags)); data.areaInfo = new(adtId, rootId, groupId, flags);
return data; return data;
} }
var instanceTree = iInstanceMapTrees.LookupByKey(mapId); var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
@@ -275,10 +275,10 @@ namespace Game.Collision
float liquidLevel = 0; float liquidLevel = 0;
if (reqLiquidType == 0 || Convert.ToBoolean(Global.DB2Mgr.GetLiquidFlags(liquidType) & reqLiquidType)) if (reqLiquidType == 0 || Convert.ToBoolean(Global.DB2Mgr.GetLiquidFlags(liquidType) & reqLiquidType))
if (info.hitInstance.GetLiquidLevel(pos, info, ref liquidLevel)) if (info.hitInstance.GetLiquidLevel(pos, info, ref liquidLevel))
data.liquidInfo.Set(new AreaAndLiquidData.LiquidInfo(liquidType, liquidLevel)); data.liquidInfo = new(liquidType, liquidLevel);
if (!Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, (byte)DisableFlags.VmapLiquidStatus)) if (!Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, (byte)DisableFlags.VmapLiquidStatus))
data.areaInfo.Set(new AreaAndLiquidData.AreaInfo(info.hitInstance.adtId, info.rootId, (int)info.hitModel.GetWmoID(), info.hitModel.GetMogpFlags())); data.areaInfo = new(info.hitInstance.adtId, info.rootId, (int)info.hitModel.GetWmoID(), info.hitModel.GetMogpFlags());
} }
} }
@@ -422,7 +422,7 @@ namespace Game.Collision
} }
public float floorZ = MapConst.VMAPInvalidHeightValue; public float floorZ = MapConst.VMAPInvalidHeightValue;
public Optional<AreaInfo> areaInfo; public AreaInfo? areaInfo;
public Optional<LiquidInfo> liquidInfo; public LiquidInfo? liquidInfo;
} }
} }
@@ -270,7 +270,7 @@ namespace Game.DataStorage
orbitInfo.CounterClockwise = circularMovementInfos.Read<bool>(6); orbitInfo.CounterClockwise = circularMovementInfos.Read<bool>(6);
orbitInfo.CanLoop = circularMovementInfos.Read<bool>(7); orbitInfo.CanLoop = circularMovementInfos.Read<bool>(7);
createProperties.OrbitInfo.Set(orbitInfo); createProperties.OrbitInfo = orbitInfo;
} }
while (circularMovementInfos.NextRow()); while (circularMovementInfos.NextRow());
} }
+22 -22
View File
@@ -172,13 +172,13 @@ namespace Game.Entities
uint timeToTarget = GetCreateProperties().TimeToTarget != 0 ? GetCreateProperties().TimeToTarget : m_areaTriggerData.Duration; uint timeToTarget = GetCreateProperties().TimeToTarget != 0 ? GetCreateProperties().TimeToTarget : m_areaTriggerData.Duration;
if (GetCreateProperties().OrbitInfo.HasValue) if (GetCreateProperties().OrbitInfo != null)
{ {
AreaTriggerOrbitInfo orbit = GetCreateProperties().OrbitInfo.Value; AreaTriggerOrbitInfo orbit = GetCreateProperties().OrbitInfo;
if (target && GetTemplate() != null && GetTemplate().HasFlag(AreaTriggerFlags.HasAttached)) if (target && GetTemplate() != null && GetTemplate().HasFlag(AreaTriggerFlags.HasAttached))
orbit.PathTarget.Set(target.GetGUID()); orbit.PathTarget = target.GetGUID();
else else
orbit.Center.Set(new Vector3(pos.posX, pos.posY, pos.posZ)); orbit.Center = new(pos.posX, pos.posY, pos.posZ);
InitOrbit(orbit, timeToTarget); InitOrbit(orbit, timeToTarget);
} }
@@ -759,10 +759,10 @@ namespace Game.Entities
AreaTriggerRePath reshape = new(); AreaTriggerRePath reshape = new();
reshape.TriggerGUID = GetGUID(); reshape.TriggerGUID = GetGUID();
reshape.AreaTriggerSpline.Value = new(); reshape.AreaTriggerSpline = new();
reshape.AreaTriggerSpline.Value.ElapsedTimeForMovement = GetElapsedTimeForMovement(); reshape.AreaTriggerSpline.ElapsedTimeForMovement = GetElapsedTimeForMovement();
reshape.AreaTriggerSpline.Value.TimeToTarget = timeToTarget; reshape.AreaTriggerSpline.TimeToTarget = timeToTarget;
reshape.AreaTriggerSpline.Value.Points = splinePoints; reshape.AreaTriggerSpline.Points = splinePoints;
SendMessageToSet(reshape, true); SendMessageToSet(reshape, true);
} }
@@ -781,10 +781,10 @@ namespace Game.Entities
m_areaTriggerData.ClearChanged(m_areaTriggerData.TimeToTarget); m_areaTriggerData.ClearChanged(m_areaTriggerData.TimeToTarget);
}); });
_orbitInfo.Set(orbit); _orbitInfo = orbit;
_orbitInfo.Value.TimeToTarget = timeToTarget; _orbitInfo.TimeToTarget = timeToTarget;
_orbitInfo.Value.ElapsedTimeForMovement = 0; _orbitInfo.ElapsedTimeForMovement = 0;
if (IsInWorld) if (IsInWorld)
{ {
@@ -798,23 +798,23 @@ namespace Game.Entities
public bool HasOrbit() public bool HasOrbit()
{ {
return _orbitInfo.HasValue; return _orbitInfo != null;
} }
Position GetOrbitCenterPosition() Position GetOrbitCenterPosition()
{ {
if (!_orbitInfo.HasValue) if (_orbitInfo == null)
return null; return null;
if (_orbitInfo.Value.PathTarget.HasValue) if (_orbitInfo.PathTarget.HasValue)
{ {
WorldObject center = Global.ObjAccessor.GetWorldObject(this, _orbitInfo.Value.PathTarget.Value); WorldObject center = Global.ObjAccessor.GetWorldObject(this, _orbitInfo.PathTarget.Value);
if (center) if (center)
return center; return center;
} }
if (_orbitInfo.Value.Center.HasValue) if (_orbitInfo.Center.HasValue)
return new Position(_orbitInfo.Value.Center.Value); return new Position(_orbitInfo.Center.Value);
return null; return null;
} }
@@ -825,7 +825,7 @@ namespace Game.Entities
if (centerPos == null) if (centerPos == null)
return GetPosition(); return GetPosition();
AreaTriggerOrbitInfo cmi = _orbitInfo.Value; AreaTriggerOrbitInfo cmi = _orbitInfo;
// AreaTrigger make exactly "Duration / TimeToTarget" loops during his life time // AreaTrigger make exactly "Duration / TimeToTarget" loops during his life time
float pathProgress = (float)cmi.ElapsedTimeForMovement / cmi.TimeToTarget; float pathProgress = (float)cmi.ElapsedTimeForMovement / cmi.TimeToTarget;
@@ -858,10 +858,10 @@ namespace Game.Entities
void UpdateOrbitPosition(uint diff) void UpdateOrbitPosition(uint diff)
{ {
if (_orbitInfo.Value.StartDelay > GetElapsedTimeForMovement()) if (_orbitInfo.StartDelay > GetElapsedTimeForMovement())
return; return;
_orbitInfo.Value.ElapsedTimeForMovement = (int)(GetElapsedTimeForMovement() - _orbitInfo.Value.StartDelay); _orbitInfo.ElapsedTimeForMovement = (int)(GetElapsedTimeForMovement() - _orbitInfo.StartDelay);
Position pos = CalculateOrbitPosition(); Position pos = CalculateOrbitPosition();
@@ -1066,7 +1066,7 @@ namespace Game.Entities
public Spline GetSpline() { return _spline; } public Spline GetSpline() { return _spline; }
public uint GetElapsedTimeForMovement() { return GetTimeSinceCreated(); } // @todo: research the right value, in sniffs both timers are nearly identical public uint GetElapsedTimeForMovement() { return GetTimeSinceCreated(); } // @todo: research the right value, in sniffs both timers are nearly identical
public Optional<AreaTriggerOrbitInfo> GetCircularMovementInfo() { return _orbitInfo; } public AreaTriggerOrbitInfo GetCircularMovementInfo() { return _orbitInfo; }
AreaTriggerFieldData m_areaTriggerData; AreaTriggerFieldData m_areaTriggerData;
@@ -1093,7 +1093,7 @@ namespace Game.Entities
int _lastSplineIndex; int _lastSplineIndex;
uint _movementTime; uint _movementTime;
Optional<AreaTriggerOrbitInfo> _orbitInfo; AreaTriggerOrbitInfo _orbitInfo;
AreaTriggerCreateProperties _areaTriggerCreateProperties; AreaTriggerCreateProperties _areaTriggerCreateProperties;
AreaTriggerTemplate _areaTriggerTemplate; AreaTriggerTemplate _areaTriggerTemplate;
@@ -212,7 +212,7 @@ namespace Game.Entities
public bool IsCylinder() { return TriggerType == AreaTriggerTypes.Cylinder; } public bool IsCylinder() { return TriggerType == AreaTriggerTypes.Cylinder; }
} }
public struct AreaTriggerOrbitInfo public class AreaTriggerOrbitInfo
{ {
public void Write(WorldPacket data) public void Write(WorldPacket data)
{ {
@@ -236,8 +236,8 @@ namespace Game.Entities
data.WriteVector3(Center.Value); data.WriteVector3(Center.Value);
} }
public Optional<ObjectGuid> PathTarget; public ObjectGuid? PathTarget;
public Optional<Vector3> Center; public Vector3? Center;
public bool CounterClockwise; public bool CounterClockwise;
public bool CanLoop; public bool CanLoop;
public uint TimeToTarget; public uint TimeToTarget;
@@ -315,7 +315,7 @@ namespace Game.Entities
public List<Vector2> PolygonVertices = new(); public List<Vector2> PolygonVertices = new();
public List<Vector2> PolygonVerticesTarget = new(); public List<Vector2> PolygonVerticesTarget = new();
public List<Vector3> SplinePoints = new(); public List<Vector3> SplinePoints = new();
public Optional<AreaTriggerOrbitInfo> OrbitInfo; public AreaTriggerOrbitInfo OrbitInfo;
public uint ScriptId; public uint ScriptId;
} }
+2 -2
View File
@@ -2828,9 +2828,9 @@ namespace Game.Entities
public BonusData(ItemInstance itemInstance) : this(Global.ObjectMgr.GetItemTemplate(itemInstance.ItemID)) public BonusData(ItemInstance itemInstance) : this(Global.ObjectMgr.GetItemTemplate(itemInstance.ItemID))
{ {
if (itemInstance.ItemBonus.HasValue) if (itemInstance.ItemBonus != null)
{ {
foreach (uint bonusListID in itemInstance.ItemBonus.Value.BonusListIDs) foreach (uint bonusListID in itemInstance.ItemBonus.BonusListIDs)
AddBonusList(bonusListID); AddBonusList(bonusListID);
} }
} }
@@ -90,6 +90,35 @@ namespace Game.Entities
public T GetValue() { return _value; } public T GetValue() { return _value; }
} }
public class OptionalUpdateField<T> : IUpdateField<T> where T : new()
{
bool _hasValue;
public T _value;
public int BlockBit;
public int Bit;
public OptionalUpdateField(int blockBit, int bit)
{
BlockBit = blockBit;
Bit = bit;
}
public static implicit operator T(OptionalUpdateField<T> updateField)
{
return updateField._value;
}
public void SetValue(T value)
{
_hasValue = true;
_value = value;
}
public T GetValue() { return _value; }
public bool HasValue() { return _hasValue; }
}
public class UpdateFieldArray<T> where T : new() public class UpdateFieldArray<T> where T : new()
{ {
public T[] _values; public T[] _values;
@@ -351,6 +380,12 @@ namespace Game.Entities
((IHasChangesMask)updateField._value).ClearChangesMask(); ((IHasChangesMask)updateField._value).ClearChangesMask();
} }
public void ClearChangesMask<U>(OptionalUpdateField<U> updateField) where U : new()
{
if (typeof(IHasChangesMask).IsAssignableFrom(typeof(U)))
((IHasChangesMask)updateField._value).ClearChangesMask();
}
public void ClearChangesMask<U>(UpdateFieldArray<U> updateField) where U : new() public void ClearChangesMask<U>(UpdateFieldArray<U> updateField) where U : new()
{ {
if (typeof(IHasChangesMask).IsAssignableFrom(typeof(U))) if (typeof(IHasChangesMask).IsAssignableFrom(typeof(U)))
@@ -3548,7 +3548,7 @@ namespace Game.Entities
public UpdateField<uint> HonorNextLevel = new(98, 103); public UpdateField<uint> HonorNextLevel = new(98, 103);
public UpdateField<byte> NumBankSlots = new(98, 104); public UpdateField<byte> NumBankSlots = new(98, 104);
public UpdateField<ActivePlayerUnk901> Field_1410 = new(98, 106); public UpdateField<ActivePlayerUnk901> Field_1410 = new(98, 106);
public UpdateField<Optional<QuestSession>> QuestSession = new(98, 105); public OptionalUpdateField<QuestSession> QuestSession = new(98, 105);
public UpdateField<int> UiChromieTimeExpansionID = new(98, 107); public UpdateField<int> UiChromieTimeExpansionID = new(98, 107);
public UpdateField<int> TransportServerTime = new(98, 108); public UpdateField<int> TransportServerTime = new(98, 108);
public UpdateField<uint> WeeklyRewardsPeriodSinceOrigin = new(98, 109); // week count since Cfg_RegionsEntry::ChallengeOrigin public UpdateField<uint> WeeklyRewardsPeriodSinceOrigin = new(98, 109); // week count since Cfg_RegionsEntry::ChallengeOrigin
@@ -3830,11 +3830,11 @@ namespace Game.Entities
data.WriteBit(BankAutoSortDisabled); data.WriteBit(BankAutoSortDisabled);
data.WriteBit(SortBagsRightToLeft); data.WriteBit(SortBagsRightToLeft);
data.WriteBit(InsertItemsLeftToRight); data.WriteBit(InsertItemsLeftToRight);
data.WriteBits(QuestSession.GetValue().HasValue, 1); data.WriteBits(QuestSession.HasValue(), 1);
((ActivePlayerUnk901)Field_1410).WriteCreate(data, owner, receiver); ((ActivePlayerUnk901)Field_1410).WriteCreate(data, owner, receiver);
if (QuestSession.GetValue().HasValue) if (QuestSession.HasValue())
{ {
QuestSession.GetValue().Value.WriteCreate(data, owner, receiver); QuestSession.GetValue().WriteCreate(data, owner, receiver);
} }
DungeonScore._value.Write(data); DungeonScore._value.Write(data);
for (int i = 0; i < CharacterRestrictions.Size(); ++i) for (int i = 0; i < CharacterRestrictions.Size(); ++i)
@@ -4599,16 +4599,16 @@ namespace Game.Entities
} }
if (changesMask[98]) if (changesMask[98])
{ {
data.WriteBits(QuestSession.GetValue().HasValue, 1); data.WriteBits(QuestSession.HasValue(), 1);
if (changesMask[106]) if (changesMask[106])
{ {
((ActivePlayerUnk901)Field_1410).WriteUpdate(data, ignoreNestedChangesMask, owner, receiver); ((ActivePlayerUnk901)Field_1410).WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
} }
if (changesMask[105]) if (changesMask[105])
{ {
if (QuestSession.GetValue().HasValue) if (QuestSession.HasValue())
{ {
QuestSession.GetValue().Value.WriteUpdate(data, ignoreNestedChangesMask, owner, receiver); QuestSession.GetValue().WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
} }
} }
if (changesMask[111]) if (changesMask[111])
+3 -3
View File
@@ -522,7 +522,7 @@ namespace Game.Entities
// *data << *areaTrigger.GetMovementScript(); // AreaTriggerMovementScriptInfo // *data << *areaTrigger.GetMovementScript(); // AreaTriggerMovementScriptInfo
if (hasOrbit) if (hasOrbit)
areaTrigger.GetCircularMovementInfo().Value.Write(data); areaTrigger.GetCircularMovementInfo().Write(data);
} }
if (flags.GameObject) if (flags.GameObject)
@@ -960,7 +960,7 @@ namespace Game.Entities
if (GetTypeId() == TypeId.Player) if (GetTypeId() == TypeId.Player)
return; return;
m_visibilityDistanceOverride.Set(SharedConst.VisibilityDistances[(int)type]); m_visibilityDistanceOverride = SharedConst.VisibilityDistances[(int)type];
} }
public virtual void CleanupsBeforeDelete(bool finalCleanup = true) public virtual void CleanupsBeforeDelete(bool finalCleanup = true)
@@ -3577,7 +3577,7 @@ namespace Game.Entities
string _name; string _name;
protected bool m_isActive; protected bool m_isActive;
bool m_isFarVisible; bool m_isFarVisible;
Optional<float> m_visibilityDistanceOverride; float? m_visibilityDistanceOverride;
bool m_isWorldObject; bool m_isWorldObject;
public ZoneScript m_zoneScript; public ZoneScript m_zoneScript;
+4 -4
View File
@@ -265,7 +265,7 @@ namespace Game.Entities
public class PlayerInfo public class PlayerInfo
{ {
public CreatePosition createPosition; public CreatePosition createPosition;
public Optional<CreatePosition> createPositionNPE; public CreatePosition? createPositionNPE;
public List<PlayerCreateInfoItem> item = new(); public List<PlayerCreateInfoItem> item = new();
public List<uint> customSpells = new(); public List<uint> customSpells = new();
@@ -273,9 +273,9 @@ namespace Game.Entities
public List<PlayerCreateInfoAction> action = new(); public List<PlayerCreateInfoAction> action = new();
public List<SkillRaceClassInfoRecord> skills = new(); public List<SkillRaceClassInfoRecord> skills = new();
public Optional<uint> introMovieId; public uint? introMovieId;
public Optional<uint> introSceneId; public uint? introSceneId;
public Optional<uint> introSceneIdNPE; public uint? introSceneIdNPE;
public PlayerLevelInfo[] levelInfo = new PlayerLevelInfo[WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)]; public PlayerLevelInfo[] levelInfo = new PlayerLevelInfo[WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)];
+6 -6
View File
@@ -200,12 +200,12 @@ namespace Game.Entities
itemPurchaseRefundResult.Result = error; itemPurchaseRefundResult.Result = error;
if (error == 0) if (error == 0)
{ {
itemPurchaseRefundResult.Contents.Value = new(); itemPurchaseRefundResult.Contents = new();
itemPurchaseRefundResult.Contents.Value.Money = item.GetPaidMoney(); itemPurchaseRefundResult.Contents.Money = item.GetPaidMoney();
for (byte i = 0; i < ItemConst.MaxItemExtCostItems; ++i) // item cost data for (byte i = 0; i < ItemConst.MaxItemExtCostItems; ++i) // item cost data
{ {
itemPurchaseRefundResult.Contents.Value.Items[i].ItemCount = iece.ItemCount[i]; itemPurchaseRefundResult.Contents.Items[i].ItemCount = iece.ItemCount[i];
itemPurchaseRefundResult.Contents.Value.Items[i].ItemID = iece.ItemID[i]; itemPurchaseRefundResult.Contents.Items[i].ItemID = iece.ItemID[i];
} }
for (byte i = 0; i < ItemConst.MaxItemExtCostCurrencies; ++i) // currency cost data for (byte i = 0; i < ItemConst.MaxItemExtCostCurrencies; ++i) // currency cost data
@@ -213,8 +213,8 @@ namespace Game.Entities
if (iece.Flags.HasAnyFlag((byte)((uint)ItemExtendedCostFlags.RequireSeasonEarned1 << i))) if (iece.Flags.HasAnyFlag((byte)((uint)ItemExtendedCostFlags.RequireSeasonEarned1 << i)))
continue; continue;
itemPurchaseRefundResult.Contents.Value.Currencies[i].CurrencyCount = iece.CurrencyCount[i]; itemPurchaseRefundResult.Contents.Currencies[i].CurrencyCount = iece.CurrencyCount[i];
itemPurchaseRefundResult.Contents.Value.Currencies[i].CurrencyID = iece.CurrencyID[i]; itemPurchaseRefundResult.Contents.Currencies[i].CurrencyID = iece.CurrencyID[i];
} }
} }
+6 -6
View File
@@ -787,16 +787,16 @@ namespace Game.Entities
SendPacket(raidInstanceMessage); SendPacket(raidInstanceMessage);
} }
public override void ProcessTerrainStatusUpdate(ZLiquidStatus oldLiquidStatus, Optional<LiquidData> newLiquidData) public override void ProcessTerrainStatusUpdate(ZLiquidStatus oldLiquidStatus, LiquidData newLiquidData)
{ {
// process liquid auras using generic unit code // process liquid auras using generic unit code
base.ProcessTerrainStatusUpdate(oldLiquidStatus, newLiquidData); base.ProcessTerrainStatusUpdate(oldLiquidStatus, newLiquidData);
// player specific logic for mirror timers // player specific logic for mirror timers
if (GetLiquidStatus() != 0 && newLiquidData.HasValue) if (GetLiquidStatus() != 0 && newLiquidData != null)
{ {
// Breath bar state (under water in any liquid type) // Breath bar state (under water in any liquid type)
if (newLiquidData.Value.type_flags.HasAnyFlag(LiquidHeaderTypeFlags.AllLiquids)) if (newLiquidData.type_flags.HasAnyFlag(LiquidHeaderTypeFlags.AllLiquids))
{ {
if (GetLiquidStatus().HasAnyFlag(ZLiquidStatus.UnderWater)) if (GetLiquidStatus().HasAnyFlag(ZLiquidStatus.UnderWater))
m_MirrorTimerFlags |= PlayerUnderwaterState.InWater; m_MirrorTimerFlags |= PlayerUnderwaterState.InWater;
@@ -805,13 +805,13 @@ namespace Game.Entities
} }
// Fatigue bar state (if not on flight path or transport) // Fatigue bar state (if not on flight path or transport)
if (newLiquidData.Value.type_flags.HasAnyFlag(LiquidHeaderTypeFlags.DarkWater) && !IsInFlight() && !GetTransport()) if (newLiquidData.type_flags.HasAnyFlag(LiquidHeaderTypeFlags.DarkWater) && !IsInFlight() && !GetTransport())
m_MirrorTimerFlags |= PlayerUnderwaterState.InDarkWater; m_MirrorTimerFlags |= PlayerUnderwaterState.InDarkWater;
else else
m_MirrorTimerFlags &= ~PlayerUnderwaterState.InDarkWater; m_MirrorTimerFlags &= ~PlayerUnderwaterState.InDarkWater;
// Lava state (any contact) // Lava state (any contact)
if (newLiquidData.Value.type_flags.HasAnyFlag(LiquidHeaderTypeFlags.Magma)) if (newLiquidData.type_flags.HasAnyFlag(LiquidHeaderTypeFlags.Magma))
{ {
if (GetLiquidStatus().HasAnyFlag(ZLiquidStatus.InContact)) if (GetLiquidStatus().HasAnyFlag(ZLiquidStatus.InContact))
m_MirrorTimerFlags |= PlayerUnderwaterState.InLava; m_MirrorTimerFlags |= PlayerUnderwaterState.InLava;
@@ -820,7 +820,7 @@ namespace Game.Entities
} }
// Slime state (any contact) // Slime state (any contact)
if (newLiquidData.Value.type_flags.HasAnyFlag(LiquidHeaderTypeFlags.Slime)) if (newLiquidData.type_flags.HasAnyFlag(LiquidHeaderTypeFlags.Slime))
{ {
if (GetLiquidStatus().HasAnyFlag(ZLiquidStatus.InContact)) if (GetLiquidStatus().HasAnyFlag(ZLiquidStatus.InContact))
m_MirrorTimerFlags |= PlayerUnderwaterState.InSlime; m_MirrorTimerFlags |= PlayerUnderwaterState.InSlime;
+36 -35
View File
@@ -1238,10 +1238,10 @@ namespace Game.Entities
packet.Type = (uint)id; packet.Type = (uint)id;
packet.Quantity = newTotalCount; packet.Quantity = newTotalCount;
packet.SuppressChatLog = !printLog; packet.SuppressChatLog = !printLog;
packet.WeeklyQuantity.Set(newWeekCount); packet.WeeklyQuantity = newWeekCount;
packet.TrackedQuantity.Set(newTrackedCount); packet.TrackedQuantity = newTrackedCount;
packet.Flags = playerCurrency.Flags; packet.Flags = playerCurrency.Flags;
packet.QuantityChange.Set(count); packet.QuantityChange = count;
SendPacket(packet); SendPacket(packet);
} }
@@ -1835,9 +1835,10 @@ namespace Game.Entities
transport = GetTransport(); transport = GetTransport();
if (transport) if (transport)
{ {
transferPending.Ship.Value = new(); TransferPending.ShipTransferPending shipTransferPending = new();
transferPending.Ship.Value.Id = transport.GetEntry(); shipTransferPending.Id = transport.GetEntry();
transferPending.Ship.Value.OriginMapID = (int)GetMapId(); shipTransferPending.OriginMapID = (int)GetMapId();
transferPending.Ship = shipTransferPending;
} }
SendPacket(transferPending); SendPacket(transferPending);
@@ -1879,7 +1880,7 @@ namespace Game.Entities
return TeleportTo(m_bgData.joinPos); return TeleportTo(m_bgData.joinPos);
} }
public uint GetStartLevel(Race race, Class playerClass, Optional<uint> characterTemplateId = default) public uint GetStartLevel(Race race, Class playerClass, uint? characterTemplateId = null)
{ {
uint startLevel = WorldConfig.GetUIntValue(WorldCfg.StartPlayerLevel); uint startLevel = WorldConfig.GetUIntValue(WorldCfg.StartPlayerLevel);
if (CliDB.ChrRacesStorage.LookupByKey(race).GetFlags().HasAnyFlag(ChrRacesFlag.IsAlliedRace)) if (CliDB.ChrRacesStorage.LookupByKey(race).GetFlags().HasAnyFlag(ChrRacesFlag.IsAlliedRace))
@@ -4980,32 +4981,32 @@ namespace Game.Entities
} }
} }
if (playerChoiceResponseTemplate.Reward.HasValue) if (playerChoiceResponseTemplate.Reward != null)
{ {
var reward = new Networking.Packets.PlayerChoiceResponseReward(); var reward = new Networking.Packets.PlayerChoiceResponseReward();
reward.TitleID = playerChoiceResponseTemplate.Reward.Value.TitleId; reward.TitleID = playerChoiceResponseTemplate.Reward.TitleId;
reward.PackageID = playerChoiceResponseTemplate.Reward.Value.PackageId; reward.PackageID = playerChoiceResponseTemplate.Reward.PackageId;
reward.SkillLineID = playerChoiceResponseTemplate.Reward.Value.SkillLineId; reward.SkillLineID = playerChoiceResponseTemplate.Reward.SkillLineId;
reward.SkillPointCount = playerChoiceResponseTemplate.Reward.Value.SkillPointCount; reward.SkillPointCount = playerChoiceResponseTemplate.Reward.SkillPointCount;
reward.ArenaPointCount = playerChoiceResponseTemplate.Reward.Value.ArenaPointCount; reward.ArenaPointCount = playerChoiceResponseTemplate.Reward.ArenaPointCount;
reward.HonorPointCount = playerChoiceResponseTemplate.Reward.Value.HonorPointCount; reward.HonorPointCount = playerChoiceResponseTemplate.Reward.HonorPointCount;
reward.Money = playerChoiceResponseTemplate.Reward.Value.Money; reward.Money = playerChoiceResponseTemplate.Reward.Money;
reward.Xp = playerChoiceResponseTemplate.Reward.Value.Xp; reward.Xp = playerChoiceResponseTemplate.Reward.Xp;
foreach (var item in playerChoiceResponseTemplate.Reward.Value.Items) foreach (var item in playerChoiceResponseTemplate.Reward.Items)
{ {
var rewardEntry = new Networking.Packets.PlayerChoiceResponseRewardEntry(); var rewardEntry = new Networking.Packets.PlayerChoiceResponseRewardEntry();
rewardEntry.Item.ItemID = item.Id; rewardEntry.Item.ItemID = item.Id;
rewardEntry.Quantity = item.Quantity; rewardEntry.Quantity = item.Quantity;
if (!item.BonusListIDs.Empty()) if (!item.BonusListIDs.Empty())
{ {
rewardEntry.Item.ItemBonus.Value = new(); rewardEntry.Item.ItemBonus = new();
rewardEntry.Item.ItemBonus.Value.BonusListIDs = item.BonusListIDs; rewardEntry.Item.ItemBonus.BonusListIDs = item.BonusListIDs;
} }
reward.Items.Add(rewardEntry); reward.Items.Add(rewardEntry);
} }
foreach (var currency in playerChoiceResponseTemplate.Reward.Value.Currency) foreach (var currency in playerChoiceResponseTemplate.Reward.Currency)
{ {
var rewardEntry = new Networking.Packets.PlayerChoiceResponseRewardEntry(); var rewardEntry = new Networking.Packets.PlayerChoiceResponseRewardEntry();
rewardEntry.Item.ItemID = currency.Id; rewardEntry.Item.ItemID = currency.Id;
@@ -5013,7 +5014,7 @@ namespace Game.Entities
reward.Items.Add(rewardEntry); reward.Items.Add(rewardEntry);
} }
foreach (var faction in playerChoiceResponseTemplate.Reward.Value.Faction) foreach (var faction in playerChoiceResponseTemplate.Reward.Faction)
{ {
var rewardEntry = new Networking.Packets.PlayerChoiceResponseRewardEntry(); var rewardEntry = new Networking.Packets.PlayerChoiceResponseRewardEntry();
rewardEntry.Item.ItemID = faction.Id; rewardEntry.Item.ItemID = faction.Id;
@@ -5021,21 +5022,21 @@ namespace Game.Entities
reward.Items.Add(rewardEntry); reward.Items.Add(rewardEntry);
} }
foreach (PlayerChoiceResponseRewardItem item in playerChoiceResponseTemplate.Reward.Value.ItemChoices) foreach (PlayerChoiceResponseRewardItem item in playerChoiceResponseTemplate.Reward.ItemChoices)
{ {
var rewardEntry = new Networking.Packets.PlayerChoiceResponseRewardEntry(); var rewardEntry = new Networking.Packets.PlayerChoiceResponseRewardEntry();
rewardEntry.Item.ItemID = item.Id; rewardEntry.Item.ItemID = item.Id;
rewardEntry.Quantity = item.Quantity; rewardEntry.Quantity = item.Quantity;
if (!item.BonusListIDs.Empty()) if (!item.BonusListIDs.Empty())
{ {
rewardEntry.Item.ItemBonus.Value = new(); rewardEntry.Item.ItemBonus = new();
rewardEntry.Item.ItemBonus.Value.BonusListIDs = item.BonusListIDs; rewardEntry.Item.ItemBonus.BonusListIDs = item.BonusListIDs;
} }
reward.ItemChoices.Add(rewardEntry); reward.ItemChoices.Add(rewardEntry);
} }
playerChoiceResponse.Reward.Set(reward); playerChoiceResponse.Reward = reward;
displayPlayerChoice.Responses[i] = playerChoiceResponse; displayPlayerChoice.Responses[i] = playerChoiceResponse;
} }
@@ -5050,7 +5051,7 @@ namespace Game.Entities
mawPower.SpellID = playerChoiceResponse.MawPower.Value.SpellID; mawPower.SpellID = playerChoiceResponse.MawPower.Value.SpellID;
mawPower.MaxStacks = playerChoiceResponse.MawPower.Value.MaxStacks; mawPower.MaxStacks = playerChoiceResponse.MawPower.Value.MaxStacks;
playerChoiceResponse.MawPower.Set(mawPower); playerChoiceResponse.MawPower = mawPower;
} }
} }
@@ -5662,10 +5663,10 @@ namespace Game.Entities
// SMSG_WORLD_SERVER_INFO // SMSG_WORLD_SERVER_INFO
WorldServerInfo worldServerInfo = new(); WorldServerInfo worldServerInfo = new();
worldServerInfo.InstanceGroupSize.Set(GetMap().GetMapDifficulty().MaxPlayers); // @todo worldServerInfo.InstanceGroupSize = GetMap().GetMapDifficulty().MaxPlayers; // @todo
worldServerInfo.IsTournamentRealm = 0; // @todo worldServerInfo.IsTournamentRealm = 0; // @todo
worldServerInfo.RestrictedAccountMaxLevel.Clear(); // @todo worldServerInfo.RestrictedAccountMaxLevel = null; // @todo
worldServerInfo.RestrictedAccountMaxMoney.Clear(); // @todo worldServerInfo.RestrictedAccountMaxMoney = null; // @todo
worldServerInfo.DifficultyID = (uint)GetMap().GetDifficultyID(); worldServerInfo.DifficultyID = (uint)GetMap().GetDifficultyID();
// worldServerInfo.XRealmPvpAlert; // @todo // worldServerInfo.XRealmPvpAlert; // @todo
SendPacket(worldServerInfo); SendPacket(worldServerInfo);
@@ -6240,9 +6241,9 @@ namespace Game.Entities
SetupCurrency.Record record = new(); SetupCurrency.Record record = new();
record.Type = entry.Id; record.Type = entry.Id;
record.Quantity = Curr.Quantity; record.Quantity = Curr.Quantity;
record.WeeklyQuantity.Set(Curr.WeeklyQuantity); record.WeeklyQuantity = Curr.WeeklyQuantity;
record.MaxWeeklyQuantity.Set(GetCurrencyWeekCap(entry)); record.MaxWeeklyQuantity = GetCurrencyWeekCap(entry);
record.TrackedQuantity.Set(Curr.TrackedQuantity); record.TrackedQuantity = Curr.TrackedQuantity;
record.Flags = Curr.Flags; record.Flags = Curr.Flags;
packet.Data.Add(record); packet.Data.Add(record);
@@ -6265,9 +6266,9 @@ namespace Game.Entities
SetupCurrency.Record record = new(); SetupCurrency.Record record = new();
record.Type = entry.Id; record.Type = entry.Id;
record.Quantity = pair.Value.Quantity; record.Quantity = pair.Value.Quantity;
record.WeeklyQuantity.Set(pair.Value.WeeklyQuantity); record.WeeklyQuantity = pair.Value.WeeklyQuantity;
record.MaxWeeklyQuantity.Set(GetCurrencyWeekCap(entry)); record.MaxWeeklyQuantity = GetCurrencyWeekCap(entry);
record.TrackedQuantity.Set(pair.Value.TrackedQuantity); record.TrackedQuantity = pair.Value.TrackedQuantity;
record.Flags = pair.Value.Flags; record.Flags = pair.Value.Flags;
packet.Data.Add(record); packet.Data.Add(record);
+1 -1
View File
@@ -616,7 +616,7 @@ namespace Game.Entities
subDmg.Damage = (int)damageInfo.Damage; // Sub Damage subDmg.Damage = (int)damageInfo.Damage; // Sub Damage
subDmg.Absorbed = (int)damageInfo.Absorb; subDmg.Absorbed = (int)damageInfo.Absorb;
subDmg.Resisted = (int)damageInfo.Resist; subDmg.Resisted = (int)damageInfo.Resist;
packet.SubDmg.Set(subDmg); packet.SubDmg = subDmg;
packet.VictimState = (byte)damageInfo.TargetState; packet.VictimState = (byte)damageInfo.TargetState;
packet.BlockAmount = (int)damageInfo.Blocked; packet.BlockAmount = (int)damageInfo.Blocked;
+5 -4
View File
@@ -825,7 +825,7 @@ namespace Game.Entities
ProcessTerrainStatusUpdate(oldLiquidStatus, data.LiquidInfo); ProcessTerrainStatusUpdate(oldLiquidStatus, data.LiquidInfo);
} }
public virtual void ProcessTerrainStatusUpdate(ZLiquidStatus oldLiquidStatus, Optional<LiquidData> newLiquidData) public virtual void ProcessTerrainStatusUpdate(ZLiquidStatus oldLiquidStatus, LiquidData newLiquidData)
{ {
if (!IsControlledByPlayer()) if (!IsControlledByPlayer())
return; return;
@@ -838,8 +838,8 @@ namespace Game.Entities
// liquid aura handling // liquid aura handling
LiquidTypeRecord curLiquid = null; LiquidTypeRecord curLiquid = null;
if (IsInWater() && newLiquidData.HasValue) if (IsInWater() && newLiquidData != null)
curLiquid = CliDB.LiquidTypeStorage.LookupByKey(newLiquidData.Value.entry); curLiquid = CliDB.LiquidTypeStorage.LookupByKey(newLiquidData.entry);
if (curLiquid != _lastLiquid) if (curLiquid != _lastLiquid)
{ {
if (_lastLiquid != null && _lastLiquid.SpellID != 0) if (_lastLiquid != null && _lastLiquid.SpellID != 0)
@@ -1804,7 +1804,8 @@ namespace Game.Entities
moveTeleport.MoverGUID = GetGUID(); moveTeleport.MoverGUID = GetGUID();
moveTeleport.Pos = new Position(x, y, z, o); moveTeleport.Pos = new Position(x, y, z, o);
if (GetTransGUID() != ObjectGuid.Empty) if (GetTransGUID() != ObjectGuid.Empty)
moveTeleport.TransportGUID.Set(GetTransGUID()); moveTeleport.TransportGUID = GetTransGUID();
moveTeleport.Facing = o; moveTeleport.Facing = o;
moveTeleport.SequenceIndex = m_movementCounter++; moveTeleport.SequenceIndex = m_movementCounter++;
playerMover.SendPacket(moveTeleport); playerMover.SendPacket(moveTeleport);
+2 -2
View File
@@ -2092,7 +2092,7 @@ namespace Game.Entities
ContentTuningParams contentTuningParams = new(); ContentTuningParams contentTuningParams = new();
if (contentTuningParams.GenerateDataForUnits(log.attacker, log.target)) if (contentTuningParams.GenerateDataForUnits(log.attacker, log.target))
packet.ContentTuning.Set(contentTuningParams); packet.ContentTuning = contentTuningParams;
SendCombatLogMessage(packet); SendCombatLogMessage(packet);
} }
@@ -2121,7 +2121,7 @@ namespace Game.Entities
ContentTuningParams contentTuningParams = new(); ContentTuningParams contentTuningParams = new();
Unit caster = Global.ObjAccessor.GetUnit(this, aura.GetCasterGUID()); Unit caster = Global.ObjAccessor.GetUnit(this, aura.GetCasterGUID());
if (caster && contentTuningParams.GenerateDataForUnits(caster, this)) if (caster && contentTuningParams.GenerateDataForUnits(caster, this))
spellLogEffect.ContentTuning.Set(contentTuningParams); spellLogEffect.ContentTuning = contentTuningParams;
data.Effects.Add(spellLogEffect); data.Effects.Add(spellLogEffect);
+38 -39
View File
@@ -69,7 +69,6 @@ namespace Game.Garrisons
long timeBuilt = buildings.Read<long>(2); long timeBuilt = buildings.Read<long>(2);
bool active = buildings.Read<bool>(3); bool active = buildings.Read<bool>(3);
Plot plot = GetPlot(plotInstanceId); Plot plot = GetPlot(plotInstanceId);
if (plot == null) if (plot == null)
continue; continue;
@@ -77,11 +76,11 @@ namespace Game.Garrisons
if (!CliDB.GarrBuildingStorage.ContainsKey(buildingId)) if (!CliDB.GarrBuildingStorage.ContainsKey(buildingId))
continue; continue;
plot.BuildingInfo.PacketInfo.Value = new(); plot.BuildingInfo.PacketInfo = new();
plot.BuildingInfo.PacketInfo.Value.GarrPlotInstanceID = plotInstanceId; plot.BuildingInfo.PacketInfo.GarrPlotInstanceID = plotInstanceId;
plot.BuildingInfo.PacketInfo.Value.GarrBuildingID = buildingId; plot.BuildingInfo.PacketInfo.GarrBuildingID = buildingId;
plot.BuildingInfo.PacketInfo.Value.TimeBuilt = timeBuilt; plot.BuildingInfo.PacketInfo.TimeBuilt = timeBuilt;
plot.BuildingInfo.PacketInfo.Value.Active = active; plot.BuildingInfo.PacketInfo.Active = active;
} while (buildings.NextRow()); } while (buildings.NextRow());
} }
@@ -159,14 +158,14 @@ namespace Game.Garrisons
foreach (var plot in _plots.Values) foreach (var plot in _plots.Values)
{ {
if (plot.BuildingInfo.PacketInfo.HasValue) if (plot.BuildingInfo.PacketInfo != null)
{ {
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_GARRISON_BUILDINGS); stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_GARRISON_BUILDINGS);
stmt.AddValue(0, _owner.GetGUID().GetCounter()); stmt.AddValue(0, _owner.GetGUID().GetCounter());
stmt.AddValue(1, plot.BuildingInfo.PacketInfo.Value.GarrPlotInstanceID); stmt.AddValue(1, plot.BuildingInfo.PacketInfo.GarrPlotInstanceID);
stmt.AddValue(2, plot.BuildingInfo.PacketInfo.Value.GarrBuildingID); stmt.AddValue(2, plot.BuildingInfo.PacketInfo.GarrBuildingID);
stmt.AddValue(3, plot.BuildingInfo.PacketInfo.Value.TimeBuilt); stmt.AddValue(3, plot.BuildingInfo.PacketInfo.TimeBuilt);
stmt.AddValue(4, plot.BuildingInfo.PacketInfo.Value.Active); stmt.AddValue(4, plot.BuildingInfo.PacketInfo.Active);
trans.Append(stmt); trans.Append(stmt);
} }
} }
@@ -369,9 +368,9 @@ namespace Game.Garrisons
if (map) if (map)
plot.DeleteGameObject(map); plot.DeleteGameObject(map);
if (plot.BuildingInfo.PacketInfo.HasValue) if (plot.BuildingInfo.PacketInfo != null)
{ {
oldBuildingId = plot.BuildingInfo.PacketInfo.Value.GarrBuildingID; oldBuildingId = plot.BuildingInfo.PacketInfo.GarrBuildingID;
if (CliDB.GarrBuildingStorage.LookupByKey(oldBuildingId).BuildingType != building.BuildingType) if (CliDB.GarrBuildingStorage.LookupByKey(oldBuildingId).BuildingType != building.BuildingType)
plot.ClearBuildingInfo(GetGarrisonType(), _owner); plot.ClearBuildingInfo(GetGarrisonType(), _owner);
} }
@@ -413,7 +412,7 @@ namespace Game.Garrisons
Plot plot = GetPlot(garrPlotInstanceId); Plot plot = GetPlot(garrPlotInstanceId);
buildingRemoved.GarrPlotInstanceID = garrPlotInstanceId; buildingRemoved.GarrPlotInstanceID = garrPlotInstanceId;
buildingRemoved.GarrBuildingID = plot.BuildingInfo.PacketInfo.Value.GarrBuildingID; buildingRemoved.GarrBuildingID = plot.BuildingInfo.PacketInfo.GarrBuildingID;
Map map = FindMap(); Map map = FindMap();
if (map) if (map)
@@ -461,9 +460,9 @@ namespace Game.Garrisons
Plot plot = GetPlot(garrPlotInstanceId); Plot plot = GetPlot(garrPlotInstanceId);
if (plot != null) if (plot != null)
{ {
if (plot.BuildingInfo.CanActivate() && plot.BuildingInfo.PacketInfo.HasValue && !plot.BuildingInfo.PacketInfo.Value.Active) if (plot.BuildingInfo.CanActivate() && plot.BuildingInfo.PacketInfo != null && !plot.BuildingInfo.PacketInfo.Active)
{ {
plot.BuildingInfo.PacketInfo.Value.Active = true; plot.BuildingInfo.PacketInfo.Active = true;
Map map = FindMap(); Map map = FindMap();
if (map) if (map)
{ {
@@ -477,7 +476,7 @@ namespace Game.Garrisons
buildingActivated.GarrPlotInstanceID = garrPlotInstanceId; buildingActivated.GarrPlotInstanceID = garrPlotInstanceId;
_owner.SendPacket(buildingActivated); _owner.SendPacket(buildingActivated);
_owner.UpdateCriteria(CriteriaType.ActivateAnyGarrisonBuilding, plot.BuildingInfo.PacketInfo.Value.GarrBuildingID); _owner.UpdateCriteria(CriteriaType.ActivateAnyGarrisonBuilding, plot.BuildingInfo.PacketInfo.GarrBuildingID);
} }
} }
} }
@@ -545,8 +544,8 @@ namespace Game.Garrisons
foreach (var plot in _plots.Values) foreach (var plot in _plots.Values)
{ {
garrison.Plots.Add(plot.PacketInfo); garrison.Plots.Add(plot.PacketInfo);
if (plot.BuildingInfo.PacketInfo.HasValue) if (plot.BuildingInfo.PacketInfo != null)
garrison.Buildings.Add(plot.BuildingInfo.PacketInfo.Value); garrison.Buildings.Add(plot.BuildingInfo.PacketInfo);
} }
foreach (var follower in _followers.Values) foreach (var follower in _followers.Values)
@@ -568,8 +567,8 @@ namespace Game.Garrisons
GarrisonRemoteSiteInfo remoteSiteInfo = new(); GarrisonRemoteSiteInfo remoteSiteInfo = new();
remoteSiteInfo.GarrSiteLevelID = _siteLevel.Id; remoteSiteInfo.GarrSiteLevelID = _siteLevel.Id;
foreach (var p in _plots) foreach (var p in _plots)
if (p.Value.BuildingInfo.PacketInfo.HasValue) if (p.Value.BuildingInfo.PacketInfo != null)
remoteSiteInfo.Buildings.Add(new GarrisonRemoteBuildingInfo(p.Key, p.Value.BuildingInfo.PacketInfo.Value.GarrBuildingID)); remoteSiteInfo.Buildings.Add(new GarrisonRemoteBuildingInfo(p.Key, p.Value.BuildingInfo.PacketInfo.GarrBuildingID));
remoteInfo.Sites.Add(remoteSiteInfo); remoteInfo.Sites.Add(remoteSiteInfo);
_owner.SendPacket(remoteInfo); _owner.SendPacket(remoteInfo);
@@ -589,9 +588,9 @@ namespace Game.Garrisons
foreach (var plot in _plots.Values) foreach (var plot in _plots.Values)
{ {
if (plot.BuildingInfo.PacketInfo.HasValue) if (plot.BuildingInfo.PacketInfo != null)
{ {
uint garrBuildingPlotInstId = Global.GarrisonMgr.GetGarrBuildingPlotInst(plot.BuildingInfo.PacketInfo.Value.GarrBuildingID, plot.GarrSiteLevelPlotInstId); uint garrBuildingPlotInstId = Global.GarrisonMgr.GetGarrBuildingPlotInst(plot.BuildingInfo.PacketInfo.GarrBuildingID, plot.GarrSiteLevelPlotInstId);
if (garrBuildingPlotInstId != 0) if (garrBuildingPlotInstId != 0)
mapData.Buildings.Add(new GarrisonBuildingMapData(garrBuildingPlotInstId, plot.PacketInfo.PlotPos)); mapData.Buildings.Add(new GarrisonBuildingMapData(garrBuildingPlotInstId, plot.PacketInfo.PlotPos));
} }
@@ -635,9 +634,9 @@ namespace Game.Garrisons
GarrBuildingRecord existingBuilding; GarrBuildingRecord existingBuilding;
foreach (var p in _plots) foreach (var p in _plots)
{ {
if (p.Value.BuildingInfo.PacketInfo.HasValue) if (p.Value.BuildingInfo.PacketInfo != null)
{ {
existingBuilding = CliDB.GarrBuildingStorage.LookupByKey(p.Value.BuildingInfo.PacketInfo.Value.GarrBuildingID); existingBuilding = CliDB.GarrBuildingStorage.LookupByKey(p.Value.BuildingInfo.PacketInfo.GarrBuildingID);
if (existingBuilding.BuildingType == building.BuildingType) if (existingBuilding.BuildingType == building.BuildingType)
if (p.Key != garrPlotInstanceId || existingBuilding.UpgradeLevel + 1 != building.UpgradeLevel) // check if its an upgrade in same plot if (p.Key != garrPlotInstanceId || existingBuilding.UpgradeLevel + 1 != building.UpgradeLevel) // check if its an upgrade in same plot
return GarrisonError.BuildingExists; return GarrisonError.BuildingExists;
@@ -651,8 +650,8 @@ namespace Game.Garrisons
return GarrisonError.NotEnoughGold; return GarrisonError.NotEnoughGold;
// New building cannot replace another building currently under construction // New building cannot replace another building currently under construction
if (plot.BuildingInfo.PacketInfo.HasValue) if (plot.BuildingInfo.PacketInfo != null)
if (!plot.BuildingInfo.PacketInfo.Value.Active) if (!plot.BuildingInfo.PacketInfo.Active)
return GarrisonError.NoBuilding; return GarrisonError.NoBuilding;
return GarrisonError.Success; return GarrisonError.Success;
@@ -664,7 +663,7 @@ namespace Game.Garrisons
if (plot == null) if (plot == null)
return GarrisonError.InvalidPlotInstanceId; return GarrisonError.InvalidPlotInstanceId;
if (!plot.BuildingInfo.PacketInfo.HasValue) if (plot.BuildingInfo.PacketInfo == null)
return GarrisonError.NoBuilding; return GarrisonError.NoBuilding;
if (plot.BuildingInfo.CanActivate()) if (plot.BuildingInfo.CanActivate())
@@ -688,10 +687,10 @@ namespace Game.Garrisons
{ {
public bool CanActivate() public bool CanActivate()
{ {
if (PacketInfo.HasValue) if (PacketInfo != null)
{ {
GarrBuildingRecord building = CliDB.GarrBuildingStorage.LookupByKey(PacketInfo.Value.GarrBuildingID); GarrBuildingRecord building = CliDB.GarrBuildingStorage.LookupByKey(PacketInfo.GarrBuildingID);
if (PacketInfo.Value.TimeBuilt + building.BuildSeconds <= GameTime.GetGameTime()) if (PacketInfo.TimeBuilt + building.BuildSeconds <= GameTime.GetGameTime())
return true; return true;
} }
@@ -700,7 +699,7 @@ namespace Game.Garrisons
public ObjectGuid Guid; public ObjectGuid Guid;
public List<ObjectGuid> Spawns = new(); public List<ObjectGuid> Spawns = new();
public Optional<GarrisonBuildingInfo> PacketInfo; public GarrisonBuildingInfo PacketInfo;
} }
public class Plot public class Plot
@@ -708,14 +707,14 @@ namespace Game.Garrisons
public GameObject CreateGameObject(Map map, uint faction) public GameObject CreateGameObject(Map map, uint faction)
{ {
uint entry = EmptyGameObjectId; uint entry = EmptyGameObjectId;
if (BuildingInfo.PacketInfo.HasValue) if (BuildingInfo.PacketInfo != null)
{ {
GarrPlotInstanceRecord plotInstance = CliDB.GarrPlotInstanceStorage.LookupByKey(PacketInfo.GarrPlotInstanceID); GarrPlotInstanceRecord plotInstance = CliDB.GarrPlotInstanceStorage.LookupByKey(PacketInfo.GarrPlotInstanceID);
GarrPlotRecord plot = CliDB.GarrPlotStorage.LookupByKey(plotInstance.GarrPlotID); GarrPlotRecord plot = CliDB.GarrPlotStorage.LookupByKey(plotInstance.GarrPlotID);
GarrBuildingRecord building = CliDB.GarrBuildingStorage.LookupByKey(BuildingInfo.PacketInfo.Value.GarrBuildingID); GarrBuildingRecord building = CliDB.GarrBuildingStorage.LookupByKey(BuildingInfo.PacketInfo.GarrBuildingID);
entry = faction == GarrisonFactionIndex.Horde ? plot.HordeConstructObjID : plot.AllianceConstructObjID; entry = faction == GarrisonFactionIndex.Horde ? plot.HordeConstructObjID : plot.AllianceConstructObjID;
if (BuildingInfo.PacketInfo.Value.Active || entry == 0) if (BuildingInfo.PacketInfo.Active || entry == 0)
entry = faction == GarrisonFactionIndex.Horde ? building.HordeGameObjectID : building.AllianceGameObjectID; entry = faction == GarrisonFactionIndex.Horde ? building.HordeGameObjectID : building.AllianceGameObjectID;
} }
@@ -729,7 +728,7 @@ namespace Game.Garrisons
if (!go) if (!go)
return null; return null;
if (BuildingInfo.CanActivate() && BuildingInfo.PacketInfo.HasValue && !BuildingInfo.PacketInfo.Value.Active) if (BuildingInfo.CanActivate() && BuildingInfo.PacketInfo != null && !BuildingInfo.PacketInfo.Active)
{ {
FinalizeGarrisonPlotGOInfo finalizeInfo = Global.GarrisonMgr.GetPlotFinalizeGOInfo(PacketInfo.GarrPlotInstanceID); FinalizeGarrisonPlotGOInfo finalizeInfo = Global.GarrisonMgr.GetPlotFinalizeGOInfo(PacketInfo.GarrPlotInstanceID);
if (finalizeInfo != null) if (finalizeInfo != null)
@@ -815,19 +814,19 @@ namespace Game.Garrisons
plotPlaced.PlotInfo = PacketInfo; plotPlaced.PlotInfo = PacketInfo;
owner.SendPacket(plotPlaced); owner.SendPacket(plotPlaced);
BuildingInfo.PacketInfo.Clear(); BuildingInfo.PacketInfo = null;
} }
public void SetBuildingInfo(GarrisonBuildingInfo buildingInfo, Player owner) public void SetBuildingInfo(GarrisonBuildingInfo buildingInfo, Player owner)
{ {
if (!BuildingInfo.PacketInfo.HasValue) if (BuildingInfo.PacketInfo == null)
{ {
GarrisonPlotRemoved plotRemoved = new(); GarrisonPlotRemoved plotRemoved = new();
plotRemoved.GarrPlotInstanceID = PacketInfo.GarrPlotInstanceID; plotRemoved.GarrPlotInstanceID = PacketInfo.GarrPlotInstanceID;
owner.SendPacket(plotRemoved); owner.SendPacket(plotRemoved);
} }
BuildingInfo.PacketInfo.Set(buildingInfo); BuildingInfo.PacketInfo = buildingInfo;
} }
T BuildingSpawnHelper<T>(GameObject building, ulong spawnId, Map map) where T : WorldObject, new() T BuildingSpawnHelper<T>(GameObject building, ulong spawnId, Map map) where T : WorldObject, new()
+30 -28
View File
@@ -5872,22 +5872,24 @@ namespace Game
if (!result.IsNull(7)) if (!result.IsNull(7))
{ {
info.createPositionNPE.Value = new(); PlayerInfo.CreatePosition createPosition = 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)); createPosition.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)) if (!result.IsNull(12))
info.createPositionNPE.Value.TransportGuid = result.Read<ulong>(12); createPosition.TransportGuid = result.Read<ulong>(12);
info.createPositionNPE = createPosition;
if (!CliDB.MapStorage.ContainsKey(info.createPositionNPE.Value.Loc.GetMapId())) 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."); 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.Clear(); info.createPositionNPE = null;
} }
if (info.createPositionNPE.HasValue && info.createPositionNPE.Value.TransportGuid.HasValue && Global.TransportMgr.GetTransportSpawn(info.createPositionNPE.Value.TransportGuid.Value) == null) 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."); 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.Clear(); // remove entire NPE data - assume user put transport offsets into npe_position fields info.createPositionNPE = null; // remove entire NPE data - assume user put transport offsets into npe_position fields
} }
} }
@@ -5895,7 +5897,7 @@ namespace Game
{ {
uint introMovieId = result.Read<uint>(13); uint introMovieId = result.Read<uint>(13);
if (CliDB.MovieStorage.ContainsKey(introMovieId)) if (CliDB.MovieStorage.ContainsKey(introMovieId))
info.introMovieId.Set(introMovieId); info.introMovieId = introMovieId;
else else
Log.outError(LogFilter.Sql, $"Invalid intro movie id {introMovieId} for class {currentclass} race {currentrace} pair in `playercreateinfo` table, ignoring."); Log.outError(LogFilter.Sql, $"Invalid intro movie id {introMovieId} for class {currentclass} race {currentrace} pair in `playercreateinfo` table, ignoring.");
} }
@@ -5904,7 +5906,7 @@ namespace Game
{ {
uint introSceneId = result.Read<uint>(14); uint introSceneId = result.Read<uint>(14);
if (GetSceneTemplate(introSceneId) != null) if (GetSceneTemplate(introSceneId) != null)
info.introSceneId.Set(introSceneId); info.introSceneId = introSceneId;
else else
Log.outError(LogFilter.Sql, $"Invalid intro scene id {introSceneId} for class {currentclass} race {currentrace} pair in `playercreateinfo` table, ignoring."); Log.outError(LogFilter.Sql, $"Invalid intro scene id {introSceneId} for class {currentclass} race {currentrace} pair in `playercreateinfo` table, ignoring.");
} }
@@ -5913,7 +5915,7 @@ namespace Game
{ {
uint introSceneId = result.Read<uint>(15); uint introSceneId = result.Read<uint>(15);
if (GetSceneTemplate(introSceneId) != null) if (GetSceneTemplate(introSceneId) != null)
info.introSceneIdNPE.Set(introSceneId); info.introSceneIdNPE = introSceneId;
else else
Log.outError(LogFilter.Sql, $"Invalid NPE intro scene id {introSceneId} for class {currentclass} race {currentrace} pair in `playercreateinfo` table, ignoring."); Log.outError(LogFilter.Sql, $"Invalid NPE intro scene id {introSceneId} for class {currentclass} race {currentrace} pair in `playercreateinfo` table, ignoring.");
} }
@@ -9620,7 +9622,7 @@ namespace Game
response.Description = responses.Read<string>(14); response.Description = responses.Read<string>(14);
response.Confirmation = responses.Read<string>(15); response.Confirmation = responses.Read<string>(15);
if (!responses.IsNull(16)) if (!responses.IsNull(16))
response.RewardQuestID.Set(responses.Read<uint>(16)); response.RewardQuestID = responses.Read<uint>(16);
choice.Responses.Add(response); choice.Responses.Add(response);
@@ -9680,7 +9682,7 @@ namespace Game
reward.SkillPointCount = 0; reward.SkillPointCount = 0;
} }
response.Reward.Set(reward); response.Reward = reward;
++rewardCount; ++rewardCount;
} while (rewards.NextRow()); } while (rewards.NextRow());
@@ -9718,7 +9720,7 @@ namespace Game
continue; continue;
} }
if (!response.Reward.HasValue) if (response.Reward == null)
{ {
Log.outError(LogFilter.Sql, $"Table `playerchoice_response_reward_item` references non-existing player choice reward for ChoiceId {choiceId}, ResponseId: {responseId}, skipped"); Log.outError(LogFilter.Sql, $"Table `playerchoice_response_reward_item` references non-existing player choice reward for ChoiceId {choiceId}, ResponseId: {responseId}, skipped");
continue; continue;
@@ -9730,7 +9732,7 @@ namespace Game
continue; continue;
} }
response.Reward.Value.Items.Add(new PlayerChoiceResponseRewardItem(itemId, bonusListIds, quantity)); response.Reward.Items.Add(new PlayerChoiceResponseRewardItem(itemId, bonusListIds, quantity));
itemRewardCount++; itemRewardCount++;
} while (rewardItem.NextRow()); } while (rewardItem.NextRow());
@@ -9760,7 +9762,7 @@ namespace Game
continue; continue;
} }
if (!response.Reward.HasValue) if (response.Reward == null)
{ {
Log.outError(LogFilter.Sql, $"Table `playerchoice_response_reward_currency` references non-existing player choice reward for ChoiceId {choiceId}, ResponseId: {responseId}, skipped"); Log.outError(LogFilter.Sql, $"Table `playerchoice_response_reward_currency` references non-existing player choice reward for ChoiceId {choiceId}, ResponseId: {responseId}, skipped");
continue; continue;
@@ -9772,7 +9774,7 @@ namespace Game
continue; continue;
} }
response.Reward.Value.Currency.Add(new PlayerChoiceResponseRewardEntry(currencyId, quantity)); response.Reward.Currency.Add(new PlayerChoiceResponseRewardEntry(currencyId, quantity));
currencyRewardCount++; currencyRewardCount++;
} while (rewardCurrency.NextRow()); } while (rewardCurrency.NextRow());
@@ -9802,7 +9804,7 @@ namespace Game
continue; continue;
} }
if (!response.Reward.HasValue) if (response.Reward == null)
{ {
Log.outError(LogFilter.Sql, $"Table `playerchoice_response_reward_faction` references non-existing player choice reward for ChoiceId {choiceId}, ResponseId: {responseId}, skipped"); Log.outError(LogFilter.Sql, $"Table `playerchoice_response_reward_faction` references non-existing player choice reward for ChoiceId {choiceId}, ResponseId: {responseId}, skipped");
continue; continue;
@@ -9814,7 +9816,7 @@ namespace Game
continue; continue;
} }
response.Reward.Value.Faction.Add(new PlayerChoiceResponseRewardEntry(factionId, quantity)); response.Reward.Faction.Add(new PlayerChoiceResponseRewardEntry(factionId, quantity));
factionRewardCount++; factionRewardCount++;
} while (rewardFaction.NextRow()); } while (rewardFaction.NextRow());
@@ -9849,7 +9851,7 @@ namespace Game
continue; continue;
} }
if (!response.Reward.HasValue) if (response.Reward == null)
{ {
Log.outError(LogFilter.Sql, $"Table `playerchoice_response_reward_item_choice` references non-existing player choice reward for ChoiceId {choiceId}, ResponseId: {responseId}, skipped"); Log.outError(LogFilter.Sql, $"Table `playerchoice_response_reward_item_choice` references non-existing player choice reward for ChoiceId {choiceId}, ResponseId: {responseId}, skipped");
continue; continue;
@@ -9861,7 +9863,7 @@ namespace Game
continue; continue;
} }
response.Reward.Value.ItemChoices.Add(new PlayerChoiceResponseRewardItem(itemId, bonusListIds, quantity)); response.Reward.ItemChoices.Add(new PlayerChoiceResponseRewardItem(itemId, bonusListIds, quantity));
itemChoiceRewardCount++; itemChoiceRewardCount++;
} while (rewards.NextRow()); } while (rewards.NextRow());
@@ -9895,7 +9897,7 @@ namespace Game
mawPower.RarityColor = mawPowersResult.Read<uint>(4); mawPower.RarityColor = mawPowersResult.Read<uint>(4);
mawPower.SpellID = mawPowersResult.Read<int>(5); mawPower.SpellID = mawPowersResult.Read<int>(5);
mawPower.MaxStacks = mawPowersResult.Read<int>(6); mawPower.MaxStacks = mawPowersResult.Read<int>(6);
response.MawPower.Set(mawPower); response.MawPower = mawPower;
++mawPowersCount; ++mawPowersCount;
@@ -10027,9 +10029,9 @@ namespace Game
float speed = result.Read<float>(1); float speed = result.Read<float>(1);
bool treatSpeedAsMoveTimeSeconds = result.Read<bool>(2); bool treatSpeedAsMoveTimeSeconds = result.Read<bool>(2);
float jumpGravity = result.Read<float>(3); float jumpGravity = result.Read<float>(3);
Optional<uint> spellVisualId = new(); uint? spellVisualId = null;
Optional<uint> progressCurveId = new(); uint? progressCurveId = null;
Optional<uint> parabolicCurveId = new(); uint? parabolicCurveId = null;
if (speed <= 0.0f) if (speed <= 0.0f)
{ {
@@ -10046,7 +10048,7 @@ namespace Game
if (!result.IsNull(4)) if (!result.IsNull(4))
{ {
if (CliDB.SpellVisualStorage.ContainsKey(result.Read<uint>(4))) if (CliDB.SpellVisualStorage.ContainsKey(result.Read<uint>(4)))
spellVisualId.Set(result.Read<uint>(4)); spellVisualId = result.Read<uint>(4);
else else
Log.outError(LogFilter.Sql, $"Table `jump_charge_params` references non-existing SpellVisual: {result.Read<uint>(4)} for id {id}, ignored."); Log.outError(LogFilter.Sql, $"Table `jump_charge_params` references non-existing SpellVisual: {result.Read<uint>(4)} for id {id}, ignored.");
} }
@@ -10054,7 +10056,7 @@ namespace Game
if (!result.IsNull(5)) if (!result.IsNull(5))
{ {
if (CliDB.CurveStorage.ContainsKey(result.Read<uint>(5))) if (CliDB.CurveStorage.ContainsKey(result.Read<uint>(5)))
progressCurveId.Set(result.Read<uint>(5)); progressCurveId = result.Read<uint>(5);
else else
Log.outError(LogFilter.Sql, $"Table `jump_charge_params` references non-existing progress Curve: {result.Read<uint>(5)} for id {id}, ignored."); Log.outError(LogFilter.Sql, $"Table `jump_charge_params` references non-existing progress Curve: {result.Read<uint>(5)} for id {id}, ignored.");
} }
@@ -10062,7 +10064,7 @@ namespace Game
if (!result.IsNull(6)) if (!result.IsNull(6))
{ {
if (CliDB.CurveStorage.ContainsKey(result.Read<uint>(6))) if (CliDB.CurveStorage.ContainsKey(result.Read<uint>(6)))
parabolicCurveId.Set(result.Read<uint>(6)); parabolicCurveId = result.Read<uint>(6);
else else
Log.outError(LogFilter.Sql, $"Table `jump_charge_params` references non-existing parabolic Curve: {result.Read<uint>(6)} for id {id}, ignored."); Log.outError(LogFilter.Sql, $"Table `jump_charge_params` references non-existing parabolic Curve: {result.Read<uint>(6)} for id {id}, ignored.");
} }
@@ -11825,9 +11827,9 @@ namespace Game
public string ButtonTooltip; public string ButtonTooltip;
public string Description; public string Description;
public string Confirmation; public string Confirmation;
public Optional<PlayerChoiceResponseReward> Reward; public PlayerChoiceResponseReward Reward;
public Optional<uint> RewardQuestID; public uint? RewardQuestID;
public Optional<PlayerChoiceResponseMawPower> MawPower; public PlayerChoiceResponseMawPower? MawPower;
} }
public class PlayerChoice public class PlayerChoice
+28 -22
View File
@@ -957,10 +957,10 @@ namespace Game.Groups
lootList.LootObj = creature.loot.GetGUID(); lootList.LootObj = creature.loot.GetGUID();
if (GetLootMethod() == LootMethod.MasterLoot && creature.loot.HasOverThresholdItem()) if (GetLootMethod() == LootMethod.MasterLoot && creature.loot.HasOverThresholdItem())
lootList.Master.Set(GetMasterLooterGuid()); lootList.Master = GetMasterLooterGuid();
if (groupLooter) if (groupLooter)
lootList.RoundRobinWinner.Set(groupLooter.GetGUID()); lootList.RoundRobinWinner = groupLooter.GetGUID();
BroadcastPacket(lootList, false); BroadcastPacket(lootList, false);
} }
@@ -1483,46 +1483,52 @@ namespace Game.Groups
if (GetMembersCount() > 1) if (GetMembersCount() > 1)
{ {
// LootSettings // LootSettings
partyUpdate.LootSettings.Value = new(); PartyLootSettings lootSettings = new();
partyUpdate.LootSettings.Value.Method = (byte)m_lootMethod; lootSettings.Method = (byte)m_lootMethod;
partyUpdate.LootSettings.Value.Threshold = (byte)m_lootThreshold; lootSettings.Threshold = (byte)m_lootThreshold;
partyUpdate.LootSettings.Value.LootMaster = m_lootMethod == LootMethod.MasterLoot ? m_masterLooterGuid : ObjectGuid.Empty; lootSettings.LootMaster = m_lootMethod == LootMethod.MasterLoot ? m_masterLooterGuid : ObjectGuid.Empty;
partyUpdate.LootSettings = lootSettings;
// Difficulty Settings // Difficulty Settings
partyUpdate.DifficultySettings.Value = new(); PartyDifficultySettings difficultySettings = new();
partyUpdate.DifficultySettings.Value.DungeonDifficultyID = (uint)m_dungeonDifficulty; difficultySettings.DungeonDifficultyID = (uint)m_dungeonDifficulty;
partyUpdate.DifficultySettings.Value.RaidDifficultyID = (uint)m_raidDifficulty; difficultySettings.RaidDifficultyID = (uint)m_raidDifficulty;
partyUpdate.DifficultySettings.Value.LegacyRaidDifficultyID = (uint)m_legacyRaidDifficulty; difficultySettings.LegacyRaidDifficultyID = (uint)m_legacyRaidDifficulty;
partyUpdate.DifficultySettings = difficultySettings;
} }
// LfgInfos // LfgInfos
if (IsLFGGroup()) if (IsLFGGroup())
{ {
partyUpdate.LfgInfos.Value = new(); PartyLFGInfo lfgInfos = new();
partyUpdate.LfgInfos.Value.Slot = Global.LFGMgr.GetLFGDungeonEntry(Global.LFGMgr.GetDungeon(m_guid)); lfgInfos.Slot = Global.LFGMgr.GetLFGDungeonEntry(Global.LFGMgr.GetDungeon(m_guid));
partyUpdate.LfgInfos.Value.BootCount = 0; lfgInfos.BootCount = 0;
partyUpdate.LfgInfos.Value.Aborted = false; lfgInfos.Aborted = false;
partyUpdate.LfgInfos.Value.MyFlags = (byte)(Global.LFGMgr.GetState(m_guid) == LfgState.FinishedDungeon ? 2 : 0); lfgInfos.MyFlags = (byte)(Global.LFGMgr.GetState(m_guid) == LfgState.FinishedDungeon ? 2 : 0);
partyUpdate.LfgInfos.Value.MyRandomSlot = Global.LFGMgr.GetSelectedRandomDungeon(player.GetGUID()); lfgInfos.MyRandomSlot = Global.LFGMgr.GetSelectedRandomDungeon(player.GetGUID());
partyUpdate.LfgInfos.Value.MyPartialClear = 0; lfgInfos.MyPartialClear = 0;
partyUpdate.LfgInfos.Value.MyGearDiff = 0.0f; lfgInfos.MyGearDiff = 0.0f;
partyUpdate.LfgInfos.Value.MyFirstReward = false; lfgInfos.MyFirstReward = false;
DungeonFinding.LfgReward reward = Global.LFGMgr.GetRandomDungeonReward(partyUpdate.LfgInfos.Value.MyRandomSlot, player.GetLevel()); DungeonFinding.LfgReward reward = Global.LFGMgr.GetRandomDungeonReward(partyUpdate.LfgInfos.Value.MyRandomSlot, player.GetLevel());
if (reward != null) if (reward != null)
{ {
Quest quest = Global.ObjectMgr.GetQuestTemplate(reward.firstQuest); Quest quest = Global.ObjectMgr.GetQuestTemplate(reward.firstQuest);
if (quest != null) if (quest != null)
partyUpdate.LfgInfos.Value.MyFirstReward = player.CanRewardQuest(quest, false); lfgInfos.MyFirstReward = player.CanRewardQuest(quest, false);
} }
partyUpdate.LfgInfos.Value.MyStrangerCount = 0; lfgInfos.MyStrangerCount = 0;
partyUpdate.LfgInfos.Value.MyKickVoteCount = 0; lfgInfos.MyKickVoteCount = 0;
partyUpdate.LfgInfos = lfgInfos;
} }
player.SendPacket(partyUpdate); player.SendPacket(partyUpdate);
+5 -5
View File
@@ -3019,16 +3019,16 @@ namespace Game.Guilds
bankLogEntry.EntryType = (sbyte)m_eventType; bankLogEntry.EntryType = (sbyte)m_eventType;
if (hasStack) if (hasStack)
bankLogEntry.Count.Set(m_itemStackCount); bankLogEntry.Count = m_itemStackCount;
if (IsMoneyEvent()) if (IsMoneyEvent())
bankLogEntry.Money.Set(m_itemOrMoney); bankLogEntry.Money = m_itemOrMoney;
if (hasItem) if (hasItem)
bankLogEntry.ItemID.Set((int)m_itemOrMoney); bankLogEntry.ItemID = (int)m_itemOrMoney;
if (itemMoved) if (itemMoved)
bankLogEntry.OtherTab.Set((sbyte)m_destTabId); bankLogEntry.OtherTab = (sbyte)m_destTabId;
packet.Entry.Add(bankLogEntry); packet.Entry.Add(bankLogEntry);
} }
@@ -3109,7 +3109,7 @@ namespace Game.Guilds
{ {
ItemInstance itemInstance = new(); ItemInstance itemInstance = new();
itemInstance.ItemID = GetValue(); itemInstance.ItemID = GetValue();
newsEvent.Item.Set(itemInstance); newsEvent.Item = itemInstance;
} }
newsPacket.NewsEvents.Add(newsEvent); newsPacket.NewsEvents.Add(newsEvent);
+8 -8
View File
@@ -52,12 +52,12 @@ namespace Game
Log.outDebug(LogFilter.Auctionhouse, $"Auctionhouse search ({browseQuery.Auctioneer}), searchedname: {browseQuery.Name}, levelmin: {browseQuery.MinLevel}, levelmax: {browseQuery.MaxLevel}, filters: {browseQuery.Filters}"); Log.outDebug(LogFilter.Auctionhouse, $"Auctionhouse search ({browseQuery.Auctioneer}), searchedname: {browseQuery.Name}, levelmin: {browseQuery.MinLevel}, levelmax: {browseQuery.MaxLevel}, filters: {browseQuery.Filters}");
Optional<AuctionSearchClassFilters> classFilters = new(); AuctionSearchClassFilters classFilters = null;
AuctionListBucketsResult listBucketsResult = new(); AuctionListBucketsResult listBucketsResult = new();
if (!browseQuery.ItemClassFilters.Empty()) if (!browseQuery.ItemClassFilters.Empty())
{ {
classFilters.Value = new(); classFilters = new();
foreach (var classFilter in browseQuery.ItemClassFilters) foreach (var classFilter in browseQuery.ItemClassFilters)
{ {
@@ -67,14 +67,14 @@ namespace Game
{ {
if (classFilter.ItemClass < (int)ItemClass.Max) if (classFilter.ItemClass < (int)ItemClass.Max)
{ {
classFilters.Value.Classes[classFilter.ItemClass].SubclassMask |= (AuctionSearchClassFilters.FilterType)(1 << subClassFilter.ItemSubclass); classFilters.Classes[classFilter.ItemClass].SubclassMask |= (AuctionSearchClassFilters.FilterType)(1 << subClassFilter.ItemSubclass);
if (subClassFilter.ItemSubclass < ItemConst.MaxItemSubclassTotal) if (subClassFilter.ItemSubclass < ItemConst.MaxItemSubclassTotal)
classFilters.Value.Classes[classFilter.ItemClass].InvTypes[subClassFilter.ItemSubclass] = subClassFilter.InvTypeMask; classFilters.Classes[classFilter.ItemClass].InvTypes[subClassFilter.ItemSubclass] = subClassFilter.InvTypeMask;
} }
} }
} }
else else
classFilters.Value.Classes[classFilter.ItemClass].SubclassMask = AuctionSearchClassFilters.FilterType.SkipSubclass; classFilters.Classes[classFilter.ItemClass].SubclassMask = AuctionSearchClassFilters.FilterType.SkipSubclass;
} }
} }
@@ -949,9 +949,9 @@ namespace Game
CommodityQuote quote = auctionHouse.CreateCommodityQuote(_player, (uint)getCommodityQuote.ItemID, getCommodityQuote.Quantity); CommodityQuote quote = auctionHouse.CreateCommodityQuote(_player, (uint)getCommodityQuote.ItemID, getCommodityQuote.Quantity);
if (quote != null) if (quote != null)
{ {
commodityQuoteResult.TotalPrice.Set(quote.TotalPrice); commodityQuoteResult.TotalPrice = quote.TotalPrice;
commodityQuoteResult.Quantity.Set(quote.Quantity); commodityQuoteResult.Quantity = quote.Quantity;
commodityQuoteResult.QuoteDuration.Set((int)(quote.ValidTo - GameTime.GetGameTimeSteadyPoint()).TotalMilliseconds); commodityQuoteResult.QuoteDuration = (int)(quote.ValidTo - GameTime.GetGameTimeSteadyPoint()).TotalMilliseconds;
} }
commodityQuoteResult.ItemID = getCommodityQuote.ItemID; commodityQuoteResult.ItemID = getCommodityQuote.ItemID;
+13 -12
View File
@@ -29,30 +29,31 @@ namespace Game
if (code == BattlenetRpcErrorCode.Ok) if (code == BattlenetRpcErrorCode.Ok)
{ {
response.SuccessInfo.Value = new(); response.SuccessInfo = new();
response.SuccessInfo.Value = new AuthResponse.AuthSuccessInfo(); response.SuccessInfo = new AuthResponse.AuthSuccessInfo();
response.SuccessInfo.Value.ActiveExpansionLevel = (byte)GetExpansion(); response.SuccessInfo.ActiveExpansionLevel = (byte)GetExpansion();
response.SuccessInfo.Value.AccountExpansionLevel = (byte)GetAccountExpansion(); response.SuccessInfo.AccountExpansionLevel = (byte)GetAccountExpansion();
response.SuccessInfo.Value.VirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress(); response.SuccessInfo.VirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress();
response.SuccessInfo.Value.Time = (uint)GameTime.GetGameTime(); response.SuccessInfo.Time = (uint)GameTime.GetGameTime();
var realm = Global.WorldMgr.GetRealm(); var realm = Global.WorldMgr.GetRealm();
// Send current home realm. Also there is no need to send it later in realm queries. // Send current home realm. Also there is no need to send it later in realm queries.
response.SuccessInfo.Value.VirtualRealms.Add(new VirtualRealmInfo(realm.Id.GetAddress(), true, false, realm.Name, realm.NormalizedName)); response.SuccessInfo.VirtualRealms.Add(new VirtualRealmInfo(realm.Id.GetAddress(), true, false, realm.Name, realm.NormalizedName));
if (HasPermission(RBACPermissions.UseCharacterTemplates)) if (HasPermission(RBACPermissions.UseCharacterTemplates))
foreach (var templ in Global.CharacterTemplateDataStorage.GetCharacterTemplates().Values) foreach (var templ in Global.CharacterTemplateDataStorage.GetCharacterTemplates().Values)
response.SuccessInfo.Value.Templates.Add(templ); response.SuccessInfo.Templates.Add(templ);
response.SuccessInfo.Value.AvailableClasses = Global.ObjectMgr.GetClassExpansionRequirements(); response.SuccessInfo.AvailableClasses = Global.ObjectMgr.GetClassExpansionRequirements();
} }
if (queued) if (queued)
{ {
response.WaitInfo.Value = new(); AuthWaitInfo waitInfo = new();
response.WaitInfo.Value.WaitCount = queuePos; waitInfo.WaitCount = queuePos;
response.WaitInfo = waitInfo;
} }
SendPacket(response); SendPacket(response);
@@ -110,7 +111,7 @@ namespace Game
europaTicketConfig.ComplaintsEnabled = WorldConfig.GetBoolValue(WorldCfg.SupportComplaintsEnabled); europaTicketConfig.ComplaintsEnabled = WorldConfig.GetBoolValue(WorldCfg.SupportComplaintsEnabled);
europaTicketConfig.SuggestionsEnabled = WorldConfig.GetBoolValue(WorldCfg.SupportSuggestionsEnabled); europaTicketConfig.SuggestionsEnabled = WorldConfig.GetBoolValue(WorldCfg.SupportSuggestionsEnabled);
features.EuropaTicketSystemStatus.Set(europaTicketConfig); features.EuropaTicketSystemStatus = europaTicketConfig;
SendPacket(features); SendPacket(features);
} }
+1 -1
View File
@@ -56,7 +56,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.BattlePetModifyName)] [WorldPacketHandler(ClientOpcodes.BattlePetModifyName)]
void HandleBattlePetModifyName(BattlePetModifyName battlePetModifyName) void HandleBattlePetModifyName(BattlePetModifyName battlePetModifyName)
{ {
GetBattlePetMgr().ModifyName(battlePetModifyName.PetGuid, battlePetModifyName.Name, battlePetModifyName.DeclinedNames.Value); GetBattlePetMgr().ModifyName(battlePetModifyName.PetGuid, battlePetModifyName.Name, battlePetModifyName.DeclinedNames);
} }
[WorldPacketHandler(ClientOpcodes.QueryBattlePetName)] [WorldPacketHandler(ClientOpcodes.QueryBattlePetName)]
+19 -17
View File
@@ -58,7 +58,7 @@ namespace Game
EnumCharactersResult charResult = new(); EnumCharactersResult charResult = new();
charResult.Success = true; charResult.Success = true;
charResult.IsDeletedCharacters = holder.IsDeletedCharacters(); charResult.IsDeletedCharacters = holder.IsDeletedCharacters();
charResult.DisabledClassesMask.Set(WorldConfig.GetUIntValue(WorldCfg.CharacterCreatingDisabledClassmask)); charResult.DisabledClassesMask = WorldConfig.GetUIntValue(WorldCfg.CharacterCreatingDisabledClassmask);
if (!charResult.IsDeletedCharacters) if (!charResult.IsDeletedCharacters)
_legitCharacters.Clear(); _legitCharacters.Clear();
@@ -157,7 +157,7 @@ namespace Game
EnumCharactersResult charEnum = new(); EnumCharactersResult charEnum = new();
charEnum.Success = true; charEnum.Success = true;
charEnum.IsDeletedCharacters = true; charEnum.IsDeletedCharacters = true;
charEnum.DisabledClassesMask.Set(WorldConfig.GetUIntValue(WorldCfg.CharacterCreatingDisabledClassmask)); charEnum.DisabledClassesMask = WorldConfig.GetUIntValue(WorldCfg.CharacterCreatingDisabledClassmask);
if (!result.IsEmpty()) if (!result.IsEmpty())
{ {
@@ -1099,19 +1099,21 @@ namespace Game
features.VoiceEnabled = false; features.VoiceEnabled = false;
features.BrowserEnabled = false; // Has to be false, otherwise client will crash if "Customer Support" is opened features.BrowserEnabled = false; // Has to be false, otherwise client will crash if "Customer Support" is opened
features.EuropaTicketSystemStatus.Value = new(); EuropaTicketConfig europaTicketSystemStatus = new();
features.EuropaTicketSystemStatus.Value.ThrottleState.MaxTries = 10; europaTicketSystemStatus.ThrottleState.MaxTries = 10;
features.EuropaTicketSystemStatus.Value.ThrottleState.PerMilliseconds = 60000; europaTicketSystemStatus.ThrottleState.PerMilliseconds = 60000;
features.EuropaTicketSystemStatus.Value.ThrottleState.TryCount = 1; europaTicketSystemStatus.ThrottleState.TryCount = 1;
features.EuropaTicketSystemStatus.Value.ThrottleState.LastResetTimeBeforeNow = 111111; europaTicketSystemStatus.ThrottleState.LastResetTimeBeforeNow = 111111;
features.TutorialsEnabled = true; features.TutorialsEnabled = true;
features.NPETutorialsEnabled = true; features.NPETutorialsEnabled = true;
// END OF DUMMY VALUES // END OF DUMMY VALUES
features.EuropaTicketSystemStatus.Value.TicketsEnabled = WorldConfig.GetBoolValue(WorldCfg.SupportTicketsEnabled); europaTicketSystemStatus.TicketsEnabled = WorldConfig.GetBoolValue(WorldCfg.SupportTicketsEnabled);
features.EuropaTicketSystemStatus.Value.BugsEnabled = WorldConfig.GetBoolValue(WorldCfg.SupportBugsEnabled); europaTicketSystemStatus.BugsEnabled = WorldConfig.GetBoolValue(WorldCfg.SupportBugsEnabled);
features.EuropaTicketSystemStatus.Value.ComplaintsEnabled = WorldConfig.GetBoolValue(WorldCfg.SupportComplaintsEnabled); europaTicketSystemStatus.ComplaintsEnabled = WorldConfig.GetBoolValue(WorldCfg.SupportComplaintsEnabled);
features.EuropaTicketSystemStatus.Value.SuggestionsEnabled = WorldConfig.GetBoolValue(WorldCfg.SupportSuggestionsEnabled); europaTicketSystemStatus.SuggestionsEnabled = WorldConfig.GetBoolValue(WorldCfg.SupportSuggestionsEnabled);
features.EuropaTicketSystemStatus = europaTicketSystemStatus;
features.CharUndeleteEnabled = WorldConfig.GetBoolValue(WorldCfg.FeatureSystemCharacterUndeleteEnabled); features.CharUndeleteEnabled = WorldConfig.GetBoolValue(WorldCfg.FeatureSystemCharacterUndeleteEnabled);
features.BpayStoreEnabled = WorldConfig.GetBoolValue(WorldCfg.FeatureSystemBpayStoreEnabled); features.BpayStoreEnabled = WorldConfig.GetBoolValue(WorldCfg.FeatureSystemBpayStoreEnabled);
@@ -2511,7 +2513,7 @@ namespace Game
packet.Result = result; packet.Result = result;
packet.Name = renameInfo.NewName; packet.Name = renameInfo.NewName;
if (result == ResponseCodes.Success) if (result == ResponseCodes.Success)
packet.Guid.Set(renameInfo.Guid); packet.Guid = renameInfo.Guid;
SendPacket(packet); SendPacket(packet);
} }
@@ -2540,11 +2542,11 @@ namespace Game
if (result == ResponseCodes.Success) if (result == ResponseCodes.Success)
{ {
packet.Display.Value = new(); packet.Display = new();
packet.Display.Value.Name = factionChangeInfo.Name; packet.Display.Name = factionChangeInfo.Name;
packet.Display.Value.SexID = (byte)factionChangeInfo.SexID; packet.Display.SexID = (byte)factionChangeInfo.SexID;
packet.Display.Value.Customizations = factionChangeInfo.Customizations; packet.Display.Customizations = factionChangeInfo.Customizations;
packet.Display.Value.RaceID = (byte)factionChangeInfo.RaceID; packet.Display.RaceID = (byte)factionChangeInfo.RaceID;
} }
SendPacket(packet); SendPacket(packet);
+1 -1
View File
@@ -387,7 +387,7 @@ namespace Game
HandleChatAddon(chatAddonMessageTargeted.Params.Type, chatAddonMessageTargeted.Params.Prefix, chatAddonMessageTargeted.Params.Text, chatAddonMessageTargeted.Params.IsLogged, chatAddonMessageTargeted.Target, chatAddonMessageTargeted.ChannelGUID); HandleChatAddon(chatAddonMessageTargeted.Params.Type, chatAddonMessageTargeted.Params.Prefix, chatAddonMessageTargeted.Params.Text, chatAddonMessageTargeted.Params.IsLogged, chatAddonMessageTargeted.Target, chatAddonMessageTargeted.ChannelGUID);
} }
void HandleChatAddon(ChatMsg type, string prefix, string text, bool isLogged, string target = "", Optional<ObjectGuid> channelGuid = default) void HandleChatAddon(ChatMsg type, string prefix, string text, bool isLogged, string target = "", ObjectGuid? channelGuid = null)
{ {
Player sender = GetPlayer(); Player sender = GetPlayer();
+14 -14
View File
@@ -332,11 +332,11 @@ namespace Game
if (guild == null) if (guild == null)
return; return;
if (!Player.IsInventoryPos(depositGuildBankItem.ContainerSlot.ValueOr(InventorySlots.Bag0), depositGuildBankItem.ContainerItemSlot)) if (!Player.IsInventoryPos(depositGuildBankItem.ContainerSlot.GetValueOrDefault(InventorySlots.Bag0), depositGuildBankItem.ContainerItemSlot))
GetPlayer().SendEquipError(InventoryResult.InternalBagError, null); GetPlayer().SendEquipError(InventoryResult.InternalBagError, null);
else else
guild.SwapItemsWithInventory(GetPlayer(), false, depositGuildBankItem.BankTab, depositGuildBankItem.BankSlot, guild.SwapItemsWithInventory(GetPlayer(), false, depositGuildBankItem.BankTab, depositGuildBankItem.BankSlot,
depositGuildBankItem.ContainerSlot.ValueOr(InventorySlots.Bag0), depositGuildBankItem.ContainerItemSlot, 0); depositGuildBankItem.ContainerSlot.GetValueOrDefault(InventorySlots.Bag0), depositGuildBankItem.ContainerItemSlot, 0);
} }
[WorldPacketHandler(ClientOpcodes.StoreGuildBankItem)] [WorldPacketHandler(ClientOpcodes.StoreGuildBankItem)]
@@ -349,11 +349,11 @@ namespace Game
if (guild == null) if (guild == null)
return; return;
if (!Player.IsInventoryPos(storeGuildBankItem.ContainerSlot.ValueOr(InventorySlots.Bag0), storeGuildBankItem.ContainerItemSlot)) if (!Player.IsInventoryPos(storeGuildBankItem.ContainerSlot.GetValueOrDefault(InventorySlots.Bag0), storeGuildBankItem.ContainerItemSlot))
GetPlayer().SendEquipError(InventoryResult.InternalBagError, null); GetPlayer().SendEquipError(InventoryResult.InternalBagError, null);
else else
guild.SwapItemsWithInventory(GetPlayer(), true, storeGuildBankItem.BankTab, storeGuildBankItem.BankSlot, guild.SwapItemsWithInventory(GetPlayer(), true, storeGuildBankItem.BankTab, storeGuildBankItem.BankSlot,
storeGuildBankItem.ContainerSlot.ValueOr(InventorySlots.Bag0), storeGuildBankItem.ContainerItemSlot, 0); storeGuildBankItem.ContainerSlot.GetValueOrDefault(InventorySlots.Bag0), storeGuildBankItem.ContainerItemSlot, 0);
} }
[WorldPacketHandler(ClientOpcodes.SwapItemWithGuildBankItem)] [WorldPacketHandler(ClientOpcodes.SwapItemWithGuildBankItem)]
@@ -366,11 +366,11 @@ namespace Game
if (guild == null) if (guild == null)
return; return;
if (!Player.IsInventoryPos(swapItemWithGuildBankItem.ContainerSlot.ValueOr(InventorySlots.Bag0), swapItemWithGuildBankItem.ContainerItemSlot)) if (!Player.IsInventoryPos(swapItemWithGuildBankItem.ContainerSlot.GetValueOrDefault(InventorySlots.Bag0), swapItemWithGuildBankItem.ContainerItemSlot))
GetPlayer().SendEquipError(InventoryResult.InternalBagError, null); GetPlayer().SendEquipError(InventoryResult.InternalBagError, null);
else else
guild.SwapItemsWithInventory(GetPlayer(), false, swapItemWithGuildBankItem.BankTab, swapItemWithGuildBankItem.BankSlot, guild.SwapItemsWithInventory(GetPlayer(), false, swapItemWithGuildBankItem.BankTab, swapItemWithGuildBankItem.BankSlot,
swapItemWithGuildBankItem.ContainerSlot.ValueOr(InventorySlots.Bag0), swapItemWithGuildBankItem.ContainerItemSlot, 0); swapItemWithGuildBankItem.ContainerSlot.GetValueOrDefault(InventorySlots.Bag0), swapItemWithGuildBankItem.ContainerItemSlot, 0);
} }
[WorldPacketHandler(ClientOpcodes.SwapGuildBankItemWithGuildBankItem)] [WorldPacketHandler(ClientOpcodes.SwapGuildBankItemWithGuildBankItem)]
@@ -410,11 +410,11 @@ namespace Game
if (guild == null) if (guild == null)
return; return;
if (!Player.IsInventoryPos(mergeItemWithGuildBankItem.ContainerSlot.ValueOr(InventorySlots.Bag0), mergeItemWithGuildBankItem.ContainerItemSlot)) if (!Player.IsInventoryPos(mergeItemWithGuildBankItem.ContainerSlot.GetValueOrDefault(InventorySlots.Bag0), mergeItemWithGuildBankItem.ContainerItemSlot))
GetPlayer().SendEquipError(InventoryResult.InternalBagError, null); GetPlayer().SendEquipError(InventoryResult.InternalBagError, null);
else else
guild.SwapItemsWithInventory(GetPlayer(), false, mergeItemWithGuildBankItem.BankTab, mergeItemWithGuildBankItem.BankSlot, guild.SwapItemsWithInventory(GetPlayer(), false, mergeItemWithGuildBankItem.BankTab, mergeItemWithGuildBankItem.BankSlot,
mergeItemWithGuildBankItem.ContainerSlot.ValueOr(InventorySlots.Bag0), mergeItemWithGuildBankItem.ContainerItemSlot, mergeItemWithGuildBankItem.StackCount); mergeItemWithGuildBankItem.ContainerSlot.GetValueOrDefault(InventorySlots.Bag0), mergeItemWithGuildBankItem.ContainerItemSlot, mergeItemWithGuildBankItem.StackCount);
} }
[WorldPacketHandler(ClientOpcodes.SplitItemToGuildBank)] [WorldPacketHandler(ClientOpcodes.SplitItemToGuildBank)]
@@ -427,11 +427,11 @@ namespace Game
if (guild == null) if (guild == null)
return; return;
if (!Player.IsInventoryPos(splitItemToGuildBank.ContainerSlot.ValueOr(InventorySlots.Bag0), splitItemToGuildBank.ContainerItemSlot)) if (!Player.IsInventoryPos(splitItemToGuildBank.ContainerSlot.GetValueOrDefault(InventorySlots.Bag0), splitItemToGuildBank.ContainerItemSlot))
GetPlayer().SendEquipError(InventoryResult.InternalBagError, null); GetPlayer().SendEquipError(InventoryResult.InternalBagError, null);
else else
guild.SwapItemsWithInventory(GetPlayer(), false, splitItemToGuildBank.BankTab, splitItemToGuildBank.BankSlot, guild.SwapItemsWithInventory(GetPlayer(), false, splitItemToGuildBank.BankTab, splitItemToGuildBank.BankSlot,
splitItemToGuildBank.ContainerSlot.ValueOr(InventorySlots.Bag0), splitItemToGuildBank.ContainerItemSlot, splitItemToGuildBank.StackCount); splitItemToGuildBank.ContainerSlot.GetValueOrDefault(InventorySlots.Bag0), splitItemToGuildBank.ContainerItemSlot, splitItemToGuildBank.StackCount);
} }
[WorldPacketHandler(ClientOpcodes.MergeGuildBankItemWithItem)] [WorldPacketHandler(ClientOpcodes.MergeGuildBankItemWithItem)]
@@ -444,11 +444,11 @@ namespace Game
if (guild == null) if (guild == null)
return; return;
if (!Player.IsInventoryPos(mergeGuildBankItemWithItem.ContainerSlot.ValueOr(InventorySlots.Bag0), mergeGuildBankItemWithItem.ContainerItemSlot)) if (!Player.IsInventoryPos(mergeGuildBankItemWithItem.ContainerSlot.GetValueOrDefault(InventorySlots.Bag0), mergeGuildBankItemWithItem.ContainerItemSlot))
GetPlayer().SendEquipError(InventoryResult.InternalBagError, null); GetPlayer().SendEquipError(InventoryResult.InternalBagError, null);
else else
guild.SwapItemsWithInventory(GetPlayer(), true, mergeGuildBankItemWithItem.BankTab, mergeGuildBankItemWithItem.BankSlot, guild.SwapItemsWithInventory(GetPlayer(), true, mergeGuildBankItemWithItem.BankTab, mergeGuildBankItemWithItem.BankSlot,
mergeGuildBankItemWithItem.ContainerSlot.ValueOr(InventorySlots.Bag0), mergeGuildBankItemWithItem.ContainerItemSlot, mergeGuildBankItemWithItem.StackCount); mergeGuildBankItemWithItem.ContainerSlot.GetValueOrDefault(InventorySlots.Bag0), mergeGuildBankItemWithItem.ContainerItemSlot, mergeGuildBankItemWithItem.StackCount);
} }
[WorldPacketHandler(ClientOpcodes.SplitGuildBankItemToInventory)] [WorldPacketHandler(ClientOpcodes.SplitGuildBankItemToInventory)]
@@ -461,11 +461,11 @@ namespace Game
if (guild == null) if (guild == null)
return; return;
if (!Player.IsInventoryPos(splitGuildBankItemToInventory.ContainerSlot.ValueOr(InventorySlots.Bag0), splitGuildBankItemToInventory.ContainerItemSlot)) if (!Player.IsInventoryPos(splitGuildBankItemToInventory.ContainerSlot.GetValueOrDefault(InventorySlots.Bag0), splitGuildBankItemToInventory.ContainerItemSlot))
GetPlayer().SendEquipError(InventoryResult.InternalBagError, null); GetPlayer().SendEquipError(InventoryResult.InternalBagError, null);
else else
guild.SwapItemsWithInventory(GetPlayer(), true, splitGuildBankItemToInventory.BankTab, splitGuildBankItemToInventory.BankSlot, guild.SwapItemsWithInventory(GetPlayer(), true, splitGuildBankItemToInventory.BankTab, splitGuildBankItemToInventory.BankSlot,
splitGuildBankItemToInventory.ContainerSlot.ValueOr(InventorySlots.Bag0), splitGuildBankItemToInventory.ContainerItemSlot, splitGuildBankItemToInventory.StackCount); splitGuildBankItemToInventory.ContainerSlot.GetValueOrDefault(InventorySlots.Bag0), splitGuildBankItemToInventory.ContainerItemSlot, splitGuildBankItemToInventory.StackCount);
} }
[WorldPacketHandler(ClientOpcodes.AutoStoreGuildBankItem)] [WorldPacketHandler(ClientOpcodes.AutoStoreGuildBankItem)]
+2 -3
View File
@@ -58,13 +58,12 @@ namespace Game
Guild guild = Global.GuildMgr.GetGuildById(player.GetGuildId()); Guild guild = Global.GuildMgr.GetGuildById(player.GetGuildId());
if (guild) if (guild)
{ {
inspectResult.GuildData.Value = new();
InspectGuildData guildData; InspectGuildData guildData;
guildData.GuildGUID = guild.GetGUID(); guildData.GuildGUID = guild.GetGUID();
guildData.NumGuildMembers = guild.GetMembersCount(); guildData.NumGuildMembers = guild.GetMembersCount();
guildData.AchievementPoints = (int)guild.GetAchievementMgr().GetAchievementPoints(); guildData.AchievementPoints = (int)guild.GetAchievementMgr().GetAchievementPoints();
inspectResult.GuildData.Set(guildData);
inspectResult.GuildData = guildData;
} }
Item heartOfAzeroth = player.GetItemByEntry(PlayerConst.ItemIdHeartOfAzeroth, ItemSearchLocation.Everywhere); Item heartOfAzeroth = player.GetItemByEntry(PlayerConst.ItemIdHeartOfAzeroth, ItemSearchLocation.Everywhere);
+2 -2
View File
@@ -230,7 +230,7 @@ namespace Game
continue; continue;
LFGBlackList lfgBlackList = new(); LFGBlackList lfgBlackList = new();
lfgBlackList.PlayerGuid.Set(pguid); lfgBlackList.PlayerGuid = pguid;
foreach (var locked in Global.LFGMgr.GetLockedDungeons(pguid)) foreach (var locked in Global.LFGMgr.GetLockedDungeons(pguid))
lfgBlackList.Slot.Add(new LFGBlackListSlot(locked.Key, (uint)locked.Value.lockStatus, locked.Value.requiredItemLevel, (int)locked.Value.currentItemLevel, 0)); lfgBlackList.Slot.Add(new LFGBlackListSlot(locked.Key, (uint)locked.Value.lockStatus, locked.Value.requiredItemLevel, (int)locked.Value.currentItemLevel, 0));
@@ -355,7 +355,7 @@ namespace Game
foreach (var it in joinData.lockmap) foreach (var it in joinData.lockmap)
{ {
var blackList = new LFGBlackListPkt(); var blackList = new LFGBlackListPkt();
blackList.PlayerGuid.Set(it.Key); blackList.PlayerGuid = it.Key;
foreach (var lockInfo in it.Value) foreach (var lockInfo in it.Value)
{ {
+2 -2
View File
@@ -533,8 +533,8 @@ namespace Game
item.Item.ItemID = vendorItem.item; item.Item.ItemID = vendorItem.item;
if (!vendorItem.BonusListIDs.Empty()) if (!vendorItem.BonusListIDs.Empty())
{ {
item.Item.ItemBonus.Value = new(); item.Item.ItemBonus = new();
item.Item.ItemBonus.Value.BonusListIDs = vendorItem.BonusListIDs; item.Item.ItemBonus.BonusListIDs = vendorItem.BonusListIDs;
} }
packet.Items.Add(item); packet.Items.Add(item);
+2 -2
View File
@@ -796,9 +796,9 @@ namespace Game
Global.ScriptMgr.OnPlayerChoiceResponse(GetPlayer(), (uint)choiceResponse.ChoiceID, (uint)choiceResponse.ResponseID); Global.ScriptMgr.OnPlayerChoiceResponse(GetPlayer(), (uint)choiceResponse.ChoiceID, (uint)choiceResponse.ResponseID);
if (playerChoiceResponse.Reward.HasValue) if (playerChoiceResponse.Reward != null)
{ {
var reward = playerChoiceResponse.Reward.Value; var reward = playerChoiceResponse.Reward;
if (reward.TitleId != 0) if (reward.TitleId != 0)
_player.SetTitle(CliDB.CharTitlesStorage.LookupByKey(reward.TitleId), false); _player.SetTitle(CliDB.CharTitlesStorage.LookupByKey(reward.TitleId), false);
+4 -4
View File
@@ -353,8 +353,8 @@ namespace Game
spellInfo = actualSpellInfo; spellInfo = actualSpellInfo;
} }
if (cast.Cast.MoveUpdate.HasValue) if (cast.Cast.MoveUpdate != null)
HandleMovementOpcode(ClientOpcodes.MoveStop, cast.Cast.MoveUpdate.Value); HandleMovementOpcode(ClientOpcodes.MoveStop, cast.Cast.MoveUpdate);
Spell spell = new(caster, spellInfo, triggerFlag); Spell spell = new(caster, spellInfo, triggerFlag);
@@ -660,9 +660,9 @@ namespace Game
spell.m_targets.SetPitch(packet.Pitch); spell.m_targets.SetPitch(packet.Pitch);
spell.m_targets.SetSpeed(packet.Speed); spell.m_targets.SetSpeed(packet.Speed);
if (packet.Status.HasValue) if (packet.Status != null)
{ {
GetPlayer().ValidateMovementInfo(packet.Status.Value); GetPlayer().ValidateMovementInfo(packet.Status);
/*public uint opcode; /*public uint opcode;
recvPacket >> opcode; recvPacket >> opcode;
recvPacket.SetOpcode(CMSG_MOVE_STOP); // always set to CMSG_MOVE_STOP in client SetOpcode recvPacket.SetOpcode(CMSG_MOVE_STOP); // always set to CMSG_MOVE_STOP in client SetOpcode
+5 -3
View File
@@ -104,9 +104,11 @@ 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. GetPlayer().SetTaxiCheater(true); // Grimwing in Ebon Hold, special case. NOTE: Not perfect, Zul'Aman should not be included according to WoWhead, and I think taxicheat includes it.
ShowTaxiNodes data = new(); ShowTaxiNodes data = new();
data.WindowInfo.Value = new(); ShowTaxiNodesWindowInfo windowInfo = new();
data.WindowInfo.Value.UnitGUID = unit.GetGUID(); windowInfo.UnitGUID = unit.GetGUID();
data.WindowInfo.Value.CurrentNode = (int)curloc; windowInfo.CurrentNode = (int)curloc;
data.WindowInfo = windowInfo;
GetPlayer().m_taxi.AppendTaximaskTo(data, lastTaxiCheaterState); GetPlayer().m_taxi.AppendTaximaskTo(data, lastTaxiCheaterState);
+4 -3
View File
@@ -64,8 +64,7 @@ namespace Game
tradeItem.GiftCreator = item.GetGiftCreator(); tradeItem.GiftCreator = item.GetGiftCreator();
if (!item.IsWrapped()) if (!item.IsWrapped())
{ {
tradeItem.Unwrapped.Value = new(); TradeUpdated.UnwrappedTradeItem unwrappedItem = new();
TradeUpdated.UnwrappedTradeItem unwrappedItem = tradeItem.Unwrapped.Value;
unwrappedItem.EnchantID = (int)item.GetEnchantmentId(EnchantmentSlot.Perm); unwrappedItem.EnchantID = (int)item.GetEnchantmentId(EnchantmentSlot.Perm);
unwrappedItem.OnUseEnchantmentID = (int)item.GetEnchantmentId(EnchantmentSlot.Use); unwrappedItem.OnUseEnchantmentID = (int)item.GetEnchantmentId(EnchantmentSlot.Use);
unwrappedItem.Creator = item.GetCreator(); unwrappedItem.Creator = item.GetCreator();
@@ -74,6 +73,8 @@ namespace Game
unwrappedItem.MaxDurability = item.m_itemData.MaxDurability; unwrappedItem.MaxDurability = item.m_itemData.MaxDurability;
unwrappedItem.Durability = item.m_itemData.Durability; unwrappedItem.Durability = item.m_itemData.Durability;
tradeItem.Unwrapped = unwrappedItem;
byte g = 0; byte g = 0;
foreach (SocketedGem gemData in item.m_itemData.Gems) foreach (SocketedGem gemData in item.m_itemData.Gems)
{ {
@@ -82,7 +83,7 @@ namespace Game
ItemGemData gem = new(); ItemGemData gem = new();
gem.Slot = g; gem.Slot = g;
gem.Item = new ItemInstance(gemData); gem.Item = new ItemInstance(gemData);
tradeItem.Unwrapped.Value.Gems.Add(gem); tradeItem.Unwrapped.Gems.Add(gem);
} }
++g; ++g;
} }
+9 -9
View File
@@ -2080,7 +2080,7 @@ namespace Game.Maps
{ {
if (wmoData.areaInfo.HasValue) if (wmoData.areaInfo.HasValue)
{ {
data.areaInfo.Set(new PositionFullTerrainStatus.AreaInfo(wmoData.areaInfo.Value.AdtId, wmoData.areaInfo.Value.RootId, wmoData.areaInfo.Value.GroupId, wmoData.areaInfo.Value.MogpFlags)); data.areaInfo = new(wmoData.areaInfo.Value.AdtId, wmoData.areaInfo.Value.RootId, wmoData.areaInfo.Value.GroupId, wmoData.areaInfo.Value.MogpFlags);
// wmo found // wmo found
var wmoEntry = Global.DB2Mgr.GetWMOAreaTable(wmoData.areaInfo.Value.RootId, wmoData.areaInfo.Value.AdtId, wmoData.areaInfo.Value.GroupId); var wmoEntry = Global.DB2Mgr.GetWMOAreaTable(wmoData.areaInfo.Value.RootId, wmoData.areaInfo.Value.AdtId, wmoData.areaInfo.Value.GroupId);
data.outdoors = (wmoData.areaInfo.Value.MogpFlags & 0x8) != 0; data.outdoors = (wmoData.areaInfo.Value.MogpFlags & 0x8) != 0;
@@ -2144,11 +2144,11 @@ namespace Game.Maps
} }
} }
data.LiquidInfo.Value = new(); data.LiquidInfo = new();
data.LiquidInfo.Value.level = wmoData.liquidInfo.Value.Level; data.LiquidInfo.level = wmoData.liquidInfo.Value.Level;
data.LiquidInfo.Value.depth_level = wmoData.floorZ; data.LiquidInfo.depth_level = wmoData.floorZ;
data.LiquidInfo.Value.entry = liquidType; data.LiquidInfo.entry = liquidType;
data.LiquidInfo.Value.type_flags = (LiquidHeaderTypeFlags)(1 << (int)liquidFlagType); data.LiquidInfo.type_flags = (LiquidHeaderTypeFlags)(1 << (int)liquidFlagType);
float delta = wmoData.liquidInfo.Value.Level - z; float delta = wmoData.liquidInfo.Value.Level - z;
if (delta > collisionHeight) if (delta > collisionHeight)
@@ -2169,7 +2169,7 @@ namespace Game.Maps
{ {
if (GetId() == 530 && gridMapLiquid.entry == 2) if (GetId() == 530 && gridMapLiquid.entry == 2)
gridMapLiquid.entry = 15; gridMapLiquid.entry = 15;
data.LiquidInfo.Set(gridMapLiquid); data.LiquidInfo = gridMapLiquid;
data.LiquidStatus = gridMapStatus; data.LiquidStatus = gridMapStatus;
} }
} }
@@ -5702,8 +5702,8 @@ namespace Game.Maps
public float FloorZ; public float FloorZ;
public bool outdoors = true; public bool outdoors = true;
public ZLiquidStatus LiquidStatus; public ZLiquidStatus LiquidStatus;
public Optional<AreaInfo> areaInfo; public AreaInfo? areaInfo;
public Optional<LiquidData> LiquidInfo; public LiquidData LiquidInfo;
} }
public class RespawnInfo public class RespawnInfo
+3 -3
View File
@@ -1233,9 +1233,9 @@ namespace Game.Movement
public float JumpGravity; public float JumpGravity;
public Optional<uint> SpellVisualId; public uint? SpellVisualId;
public Optional<uint> ProgressCurveId; public uint? ProgressCurveId;
public Optional<uint> ParabolicCurveId; public uint? ParabolicCurveId;
} }
public struct ChaseRange public struct ChaseRange
+4 -4
View File
@@ -209,8 +209,8 @@ namespace Game.Movement
{ {
float t_passedf = MSToSec((uint)(time_point - effect_start_time)); float t_passedf = MSToSec((uint)(time_point - effect_start_time));
float t_durationf = MSToSec((uint)(Duration() - effect_start_time)); //client use not modified duration here float t_durationf = MSToSec((uint)(Duration() - effect_start_time)); //client use not modified duration here
if (spell_effect_extra.HasValue && spell_effect_extra.Value.ParabolicCurveId != 0) if (spell_effect_extra != null && spell_effect_extra.ParabolicCurveId != 0)
t_passedf *= Global.DB2Mgr.GetCurveValueAt(spell_effect_extra.Value.ParabolicCurveId, (float)time_point / Duration()); t_passedf *= Global.DB2Mgr.GetCurveValueAt(spell_effect_extra.ParabolicCurveId, (float)time_point / Duration());
el += (t_durationf - t_passedf) * 0.5f * vertical_acceleration * t_passedf; el += (t_durationf - t_passedf) * 0.5f * vertical_acceleration * t_passedf;
} }
@@ -362,8 +362,8 @@ namespace Game.Movement
public int point_Idx; public int point_Idx;
public int point_Idx_offset; public int point_Idx_offset;
public float velocity; public float velocity;
public Optional<SpellEffectExtraData> spell_effect_extra; public SpellEffectExtraData spell_effect_extra;
public Optional<AnimTierTransition> anim_tier; public AnimTierTransition anim_tier;
#endregion #endregion
public class CommonInitializer : IInitializer public class CommonInitializer : IInitializer
+3 -3
View File
@@ -313,8 +313,8 @@ namespace Game.Movement
public void SetAnimation(AnimType anim) public void SetAnimation(AnimType anim)
{ {
args.time_perc = 0.0f; args.time_perc = 0.0f;
args.animTier.Value = new(); args.animTier = new();
args.animTier.Value.AnimTier = (byte)anim; args.animTier.AnimTier = (byte)anim;
args.flags.EnableAnimation(); args.flags.EnableAnimation();
} }
@@ -330,7 +330,7 @@ namespace Game.Movement
public void SetSpellEffectExtraData(SpellEffectExtraData spellEffectExtraData) public void SetSpellEffectExtraData(SpellEffectExtraData spellEffectExtraData)
{ {
args.spellEffectExtra.Set(spellEffectExtraData); args.spellEffectExtra = spellEffectExtraData;
} }
public List<Vector3> Path() { return args.path; } public List<Vector3> Path() { return args.path; }
+7 -7
View File
@@ -47,8 +47,8 @@ namespace Game.Movement
public float time_perc; public float time_perc;
public uint splineId; public uint splineId;
public float initialOrientation; public float initialOrientation;
public Optional<SpellEffectExtraData> spellEffectExtra; public SpellEffectExtraData spellEffectExtra;
public Optional<AnimTierTransition> animTier; public AnimTierTransition animTier;
public bool walk; public bool walk;
public bool HasVelocity; public bool HasVelocity;
public bool TransformForTransport; public bool TransformForTransport;
@@ -77,15 +77,15 @@ namespace Game.Movement
return false; return false;
if (!CHECK(_checkPathLengths(), false)) if (!CHECK(_checkPathLengths(), false))
return false; return false;
if (spellEffectExtra.HasValue) if (spellEffectExtra != null)
{ {
if (!CHECK(spellEffectExtra.Value.ProgressCurveId == 0 || CliDB.CurveStorage.ContainsKey(spellEffectExtra.Value.ProgressCurveId), false)) if (!CHECK(spellEffectExtra.ProgressCurveId == 0 || CliDB.CurveStorage.ContainsKey(spellEffectExtra.ProgressCurveId), false))
return false; return false;
if (!CHECK(spellEffectExtra.Value.ParabolicCurveId == 0 || CliDB.CurveStorage.ContainsKey(spellEffectExtra.Value.ParabolicCurveId), false)) if (!CHECK(spellEffectExtra.ParabolicCurveId == 0 || CliDB.CurveStorage.ContainsKey(spellEffectExtra.ParabolicCurveId), false))
return false; return false;
if (!CHECK(spellEffectExtra.Value.ProgressCurveId == 0 || CliDB.CurveStorage.ContainsKey(spellEffectExtra.Value.ProgressCurveId), true)) if (!CHECK(spellEffectExtra.ProgressCurveId == 0 || CliDB.CurveStorage.ContainsKey(spellEffectExtra.ProgressCurveId), true))
return false; return false;
if (!CHECK(spellEffectExtra.Value.ParabolicCurveId == 0 || CliDB.CurveStorage.ContainsKey(spellEffectExtra.Value.ParabolicCurveId), true)) if (!CHECK(spellEffectExtra.ParabolicCurveId == 0 || CliDB.CurveStorage.ContainsKey(spellEffectExtra.ParabolicCurveId), true))
return false; return false;
} }
return true; return true;
@@ -90,7 +90,7 @@ namespace Game.Networking.Packets
public long CurrentTime; public long CurrentTime;
public uint ElapsedTime; public uint ElapsedTime;
public long CreationTime; public long CreationTime;
public Optional<ulong> RafAcceptanceID; public ulong? RafAcceptanceID;
} }
class AccountCriteriaUpdate : ServerPacket class AccountCriteriaUpdate : ServerPacket
@@ -350,7 +350,7 @@ namespace Game.Networking.Packets
public long Date; public long Date;
public uint TimeFromStart; public uint TimeFromStart;
public uint TimeFromCreate; public uint TimeFromCreate;
public Optional<ulong> RafAcceptanceID; public ulong? RafAcceptanceID;
} }
public struct GuildCriteriaProgress public struct GuildCriteriaProgress
@@ -69,24 +69,24 @@ namespace Game.Networking.Packets
{ {
_worldPacket.WritePackedGuid(TriggerGUID); _worldPacket.WritePackedGuid(TriggerGUID);
_worldPacket.WriteBit(AreaTriggerSpline.HasValue); _worldPacket.WriteBit(AreaTriggerSpline != null);
_worldPacket.WriteBit(AreaTriggerOrbit.HasValue); _worldPacket.WriteBit(AreaTriggerOrbit != null);
_worldPacket.WriteBit(AreaTriggerMovementScript.HasValue); _worldPacket.WriteBit(AreaTriggerMovementScript.HasValue);
_worldPacket.FlushBits(); _worldPacket.FlushBits();
if (AreaTriggerSpline.HasValue) if (AreaTriggerSpline != null)
AreaTriggerSpline.Value.Write(_worldPacket); AreaTriggerSpline.Write(_worldPacket);
if (AreaTriggerMovementScript.HasValue) if (AreaTriggerMovementScript.HasValue)
AreaTriggerMovementScript.Value.Write(_worldPacket); AreaTriggerMovementScript.Value.Write(_worldPacket);
if (AreaTriggerOrbit.HasValue) if (AreaTriggerOrbit != null)
AreaTriggerOrbit.Value.Write(_worldPacket); AreaTriggerOrbit.Write(_worldPacket);
} }
public Optional<AreaTriggerSplineInfo> AreaTriggerSpline; public AreaTriggerSplineInfo AreaTriggerSpline;
public Optional<AreaTriggerOrbitInfo> AreaTriggerOrbit; public AreaTriggerOrbitInfo AreaTriggerOrbit;
public Optional<AreaTriggerMovementScriptInfo> AreaTriggerMovementScript; public AreaTriggerMovementScriptInfo? AreaTriggerMovementScript;
public ObjectGuid TriggerGUID; public ObjectGuid TriggerGUID;
} }
@@ -31,7 +31,7 @@ namespace Game.Networking.Packets
public AuctionHouseFilterMask Filters; public AuctionHouseFilterMask Filters;
public Array<byte> KnownPets = new(SharedConst.MaxBattlePetSpeciesId / 8 + 1); public Array<byte> KnownPets = new(SharedConst.MaxBattlePetSpeciesId / 8 + 1);
public sbyte MaxPetLevel; public sbyte MaxPetLevel;
public Optional<AddOnInfo> TaintedBy; public AddOnInfo? TaintedBy;
public string Name; public string Name;
public Array<AuctionListFilterClass> ItemClassFilters = new(7); public Array<AuctionListFilterClass> ItemClassFilters = new(7);
public Array<AuctionSortDef> Sorts = new(2); public Array<AuctionSortDef> Sorts = new(2);
@@ -51,7 +51,7 @@ namespace Game.Networking.Packets
KnownPets[i] = _worldPacket.ReadUInt8(); KnownPets[i] = _worldPacket.ReadUInt8();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
TaintedBy.Value = new(); TaintedBy = new();
uint nameLength = _worldPacket.ReadBits<uint>(8); uint nameLength = _worldPacket.ReadBits<uint>(8);
uint itemClassFilterCount = _worldPacket.ReadBits<uint>(3); uint itemClassFilterCount = _worldPacket.ReadBits<uint>(3);
@@ -72,7 +72,7 @@ namespace Game.Networking.Packets
class AuctionCancelCommoditiesPurchase : ClientPacket class AuctionCancelCommoditiesPurchase : ClientPacket
{ {
public ObjectGuid Auctioneer; public ObjectGuid Auctioneer;
public Optional<AddOnInfo> TaintedBy; public AddOnInfo? TaintedBy;
public AuctionCancelCommoditiesPurchase(WorldPacket packet) : base(packet) { } public AuctionCancelCommoditiesPurchase(WorldPacket packet) : base(packet) { }
@@ -82,7 +82,7 @@ namespace Game.Networking.Packets
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
{ {
TaintedBy.Value = new(); TaintedBy = new();
TaintedBy.Value.Read(_worldPacket); TaintedBy.Value.Read(_worldPacket);
} }
} }
@@ -93,7 +93,7 @@ namespace Game.Networking.Packets
public ObjectGuid Auctioneer; public ObjectGuid Auctioneer;
public int ItemID; public int ItemID;
public uint Quantity; public uint Quantity;
public Optional<AddOnInfo> TaintedBy; public AddOnInfo? TaintedBy;
public AuctionConfirmCommoditiesPurchase(WorldPacket packet) : base(packet) { } public AuctionConfirmCommoditiesPurchase(WorldPacket packet) : base(packet) { }
@@ -105,7 +105,7 @@ namespace Game.Networking.Packets
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
{ {
TaintedBy.Value = new(); TaintedBy = new();
TaintedBy.Value.Read(_worldPacket); TaintedBy.Value.Read(_worldPacket);
} }
} }
@@ -129,7 +129,7 @@ namespace Game.Networking.Packets
public uint Offset; public uint Offset;
public List<uint> AuctionItemIDs = new(); public List<uint> AuctionItemIDs = new();
public Array<AuctionSortDef> Sorts = new(2); public Array<AuctionSortDef> Sorts = new(2);
public Optional<AddOnInfo> TaintedBy; public AddOnInfo? TaintedBy;
public AuctionListBiddedItems(WorldPacket packet) : base(packet) { } public AuctionListBiddedItems(WorldPacket packet) : base(packet) { }
@@ -138,7 +138,7 @@ namespace Game.Networking.Packets
Auctioneer = _worldPacket.ReadPackedGuid(); Auctioneer = _worldPacket.ReadPackedGuid();
Offset = _worldPacket.ReadUInt32(); Offset = _worldPacket.ReadUInt32();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
TaintedBy.Value = new(); TaintedBy = new();
uint auctionIDCount = _worldPacket.ReadBits<uint>(7); uint auctionIDCount = _worldPacket.ReadBits<uint>(7);
uint sortCount = _worldPacket.ReadBits<uint>(2); uint sortCount = _worldPacket.ReadBits<uint>(2);
@@ -157,7 +157,7 @@ namespace Game.Networking.Packets
class AuctionListBucketsByBucketKeys : ClientPacket class AuctionListBucketsByBucketKeys : ClientPacket
{ {
public ObjectGuid Auctioneer; public ObjectGuid Auctioneer;
public Optional<AddOnInfo> TaintedBy; public AddOnInfo? TaintedBy;
public Array<AuctionBucketKey> BucketKeys = new(100); public Array<AuctionBucketKey> BucketKeys = new(100);
public Array<AuctionSortDef> Sorts = new(2); public Array<AuctionSortDef> Sorts = new(2);
@@ -167,7 +167,7 @@ namespace Game.Networking.Packets
{ {
Auctioneer = _worldPacket.ReadPackedGuid(); Auctioneer = _worldPacket.ReadPackedGuid();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
TaintedBy.Value = new(); TaintedBy = new();
uint bucketKeysCount = _worldPacket.ReadBits<uint>(7); uint bucketKeysCount = _worldPacket.ReadBits<uint>(7);
uint sortCount = _worldPacket.ReadBits<uint>(2); uint sortCount = _worldPacket.ReadBits<uint>(2);
@@ -188,7 +188,7 @@ namespace Game.Networking.Packets
public ObjectGuid Auctioneer; public ObjectGuid Auctioneer;
public uint Offset; public uint Offset;
public sbyte Unknown830; public sbyte Unknown830;
public Optional<AddOnInfo> TaintedBy; public AddOnInfo? TaintedBy;
public Array<AuctionSortDef> Sorts = new(2); public Array<AuctionSortDef> Sorts = new(2);
public AuctionBucketKey BucketKey; public AuctionBucketKey BucketKey;
@@ -200,7 +200,7 @@ namespace Game.Networking.Packets
Offset = _worldPacket.ReadUInt32(); Offset = _worldPacket.ReadUInt32();
Unknown830 = _worldPacket.ReadInt8(); Unknown830 = _worldPacket.ReadInt8();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
TaintedBy.Value = new(); TaintedBy = new();
uint sortCount = _worldPacket.ReadBits<uint>(2); uint sortCount = _worldPacket.ReadBits<uint>(2);
for (var i = 0; i < sortCount; ++i) for (var i = 0; i < sortCount; ++i)
@@ -219,7 +219,7 @@ namespace Game.Networking.Packets
public uint ItemID; public uint ItemID;
public int SuffixItemNameDescriptionID; public int SuffixItemNameDescriptionID;
public uint Offset; public uint Offset;
public Optional<AddOnInfo> TaintedBy; public AddOnInfo? TaintedBy;
public Array<AuctionSortDef> Sorts = new(2); public Array<AuctionSortDef> Sorts = new(2);
public AuctionListItemsByItemID(WorldPacket packet) : base(packet) { } public AuctionListItemsByItemID(WorldPacket packet) : base(packet) { }
@@ -232,7 +232,7 @@ namespace Game.Networking.Packets
Offset = _worldPacket.ReadUInt32(); Offset = _worldPacket.ReadUInt32();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
TaintedBy.Value = new(); TaintedBy = new();
uint sortCount = _worldPacket.ReadBits<uint>(2); uint sortCount = _worldPacket.ReadBits<uint>(2);
@@ -248,7 +248,7 @@ namespace Game.Networking.Packets
{ {
public ObjectGuid Auctioneer; public ObjectGuid Auctioneer;
public uint Offset; public uint Offset;
public Optional<AddOnInfo> TaintedBy; public AddOnInfo? TaintedBy;
public Array<AuctionSortDef> Sorts = new(2); public Array<AuctionSortDef> Sorts = new(2);
public AuctionListOwnedItems(WorldPacket packet) : base(packet) { } public AuctionListOwnedItems(WorldPacket packet) : base(packet) { }
@@ -258,7 +258,7 @@ namespace Game.Networking.Packets
Auctioneer = _worldPacket.ReadPackedGuid(); Auctioneer = _worldPacket.ReadPackedGuid();
Offset = _worldPacket.ReadUInt32(); Offset = _worldPacket.ReadUInt32();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
TaintedBy.Value = new(); TaintedBy = new();
uint sortCount = _worldPacket.ReadBits<uint>(2); uint sortCount = _worldPacket.ReadBits<uint>(2);
@@ -275,7 +275,7 @@ namespace Game.Networking.Packets
public ObjectGuid Auctioneer; public ObjectGuid Auctioneer;
public ulong BidAmount; public ulong BidAmount;
public uint AuctionID; public uint AuctionID;
public Optional<AddOnInfo> TaintedBy; public AddOnInfo? TaintedBy;
public AuctionPlaceBid(WorldPacket packet) : base(packet) { } public AuctionPlaceBid(WorldPacket packet) : base(packet) { }
@@ -287,7 +287,7 @@ namespace Game.Networking.Packets
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
{ {
TaintedBy.Value = new(); TaintedBy = new();
TaintedBy.Value.Read(_worldPacket); TaintedBy.Value.Read(_worldPacket);
} }
} }
@@ -297,7 +297,7 @@ namespace Game.Networking.Packets
{ {
public ObjectGuid Auctioneer; public ObjectGuid Auctioneer;
public uint AuctionID; public uint AuctionID;
public Optional<AddOnInfo> TaintedBy; public AddOnInfo? TaintedBy;
public AuctionRemoveItem(WorldPacket packet) : base(packet) { } public AuctionRemoveItem(WorldPacket packet) : base(packet) { }
@@ -308,7 +308,7 @@ namespace Game.Networking.Packets
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
{ {
TaintedBy.Value = new(); TaintedBy = new();
TaintedBy.Value.Read(_worldPacket); TaintedBy.Value.Read(_worldPacket);
} }
} }
@@ -321,7 +321,7 @@ namespace Game.Networking.Packets
public uint ChangeNumberCursor; public uint ChangeNumberCursor;
public uint ChangeNumberTombstone; public uint ChangeNumberTombstone;
public uint Count; public uint Count;
public Optional<AddOnInfo> TaintedBy; public AddOnInfo? TaintedBy;
public AuctionReplicateItems(WorldPacket packet) : base(packet) { } public AuctionReplicateItems(WorldPacket packet) : base(packet) { }
@@ -335,7 +335,7 @@ namespace Game.Networking.Packets
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
{ {
TaintedBy.Value = new(); TaintedBy = new();
TaintedBy.Value.Read(_worldPacket); TaintedBy.Value.Read(_worldPacket);
} }
} }
@@ -346,7 +346,7 @@ namespace Game.Networking.Packets
public ObjectGuid Auctioneer; public ObjectGuid Auctioneer;
public ulong UnitPrice; public ulong UnitPrice;
public uint RunTime; public uint RunTime;
public Optional<AddOnInfo> TaintedBy; public AddOnInfo? TaintedBy;
public Array<AuctionItemForSale> Items = new(64); public Array<AuctionItemForSale> Items = new(64);
public AuctionSellCommodity(WorldPacket packet) : base(packet) { } public AuctionSellCommodity(WorldPacket packet) : base(packet) { }
@@ -357,7 +357,7 @@ namespace Game.Networking.Packets
UnitPrice = _worldPacket.ReadUInt64(); UnitPrice = _worldPacket.ReadUInt64();
RunTime = _worldPacket.ReadUInt32(); RunTime = _worldPacket.ReadUInt32();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
TaintedBy.Value = new(); TaintedBy = new();
uint itemCount = _worldPacket.ReadBits<uint>(6); uint itemCount = _worldPacket.ReadBits<uint>(6);
@@ -375,7 +375,7 @@ namespace Game.Networking.Packets
public ObjectGuid Auctioneer; public ObjectGuid Auctioneer;
public ulong MinBid; public ulong MinBid;
public uint RunTime; public uint RunTime;
public Optional<AddOnInfo> TaintedBy; public AddOnInfo? TaintedBy;
public Array<AuctionItemForSale> Items = new(1); public Array<AuctionItemForSale> Items = new(1);
public AuctionSellItem(WorldPacket packet) : base(packet) { } public AuctionSellItem(WorldPacket packet) : base(packet) { }
@@ -388,7 +388,7 @@ namespace Game.Networking.Packets
RunTime = _worldPacket.ReadUInt32(); RunTime = _worldPacket.ReadUInt32();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
TaintedBy.Value = new(); TaintedBy = new();
uint itemCount = _worldPacket.ReadBits<uint>(6); uint itemCount = _worldPacket.ReadBits<uint>(6);
@@ -419,7 +419,7 @@ namespace Game.Networking.Packets
public ObjectGuid Auctioneer; public ObjectGuid Auctioneer;
public int ItemID; public int ItemID;
public uint Quantity; public uint Quantity;
public Optional<AddOnInfo> TaintedBy; public AddOnInfo? TaintedBy;
public AuctionGetCommodityQuote(WorldPacket packet) : base(packet) { } public AuctionGetCommodityQuote(WorldPacket packet) : base(packet) { }
@@ -431,7 +431,7 @@ namespace Game.Networking.Packets
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
{ {
TaintedBy.Value = new(); TaintedBy = new();
TaintedBy.Value.Read(_worldPacket); TaintedBy.Value.Read(_worldPacket);
} }
} }
@@ -482,9 +482,9 @@ namespace Game.Networking.Packets
class AuctionGetCommodityQuoteResult : ServerPacket class AuctionGetCommodityQuoteResult : ServerPacket
{ {
public Optional<ulong> TotalPrice; public ulong? TotalPrice;
public Optional<uint> Quantity; public uint? Quantity;
public Optional<int> QuoteDuration; public int? QuoteDuration;
public int ItemID; public int ItemID;
public uint DesiredDelay; public uint DesiredDelay;
@@ -716,8 +716,8 @@ namespace Game.Networking.Packets
{ {
public uint ItemID; public uint ItemID;
public ushort ItemLevel; public ushort ItemLevel;
public Optional<ushort> BattlePetSpeciesID = new(); public ushort? BattlePetSpeciesID;
public Optional<ushort> SuffixItemNameDescriptionID = new(); public ushort? SuffixItemNameDescriptionID;
public AuctionBucketKey() { } public AuctionBucketKey() { }
@@ -727,30 +727,25 @@ namespace Game.Networking.Packets
ItemLevel = key.ItemLevel; ItemLevel = key.ItemLevel;
if (key.BattlePetSpeciesId != 0) if (key.BattlePetSpeciesId != 0)
BattlePetSpeciesID.Set(key.BattlePetSpeciesId); BattlePetSpeciesID = key.BattlePetSpeciesId;
if (key.SuffixItemNameDescriptionId != 0) if (key.SuffixItemNameDescriptionId != 0)
SuffixItemNameDescriptionID.Set(key.SuffixItemNameDescriptionId); SuffixItemNameDescriptionID = key.SuffixItemNameDescriptionId;
} }
public AuctionBucketKey(WorldPacket data) public AuctionBucketKey(WorldPacket data)
{ {
data.ResetBitPos(); data.ResetBitPos();
ItemID = data.ReadBits<uint>(20); ItemID = data.ReadBits<uint>(20);
bool hasBattlePetSpeciesId = data.HasBit();
if (data.HasBit())
BattlePetSpeciesID.Value = new();
ItemLevel = data.ReadBits<ushort>(11); ItemLevel = data.ReadBits<ushort>(11);
bool hasSuffixItemNameDescriptionId = data.HasBit();
if (data.HasBit()) if (hasBattlePetSpeciesId)
SuffixItemNameDescriptionID.Value = new(); BattlePetSpeciesID = data.ReadUInt16();
if (BattlePetSpeciesID.HasValue) if (hasSuffixItemNameDescriptionId)
BattlePetSpeciesID.Set(data.ReadUInt16()); SuffixItemNameDescriptionID = data.ReadUInt16();
if (SuffixItemNameDescriptionID.HasValue)
SuffixItemNameDescriptionID.Set(data.ReadUInt16());
} }
public void Write(WorldPacket data) public void Write(WorldPacket data)
@@ -882,10 +877,10 @@ namespace Game.Networking.Packets
public ulong MinPrice; public ulong MinPrice;
public int RequiredLevel; public int RequiredLevel;
public List<uint> ItemModifiedAppearanceIDs = new(); public List<uint> ItemModifiedAppearanceIDs = new();
public Optional<byte> MaxBattlePetQuality; public byte? MaxBattlePetQuality;
public Optional<byte> MaxBattlePetLevel; public byte? MaxBattlePetLevel;
public Optional<byte> BattlePetBreedID; public byte? BattlePetBreedID;
public Optional<uint> Unk901_1; public uint? Unk901_1;
public bool ContainsOwnerItem; public bool ContainsOwnerItem;
public bool ContainsOnlyCollectedAppearances; public bool ContainsOnlyCollectedAppearances;
@@ -926,17 +921,17 @@ namespace Game.Networking.Packets
public class AuctionItem public class AuctionItem
{ {
public Optional<ItemInstance> Item; public ItemInstance Item;
public int Count; public int Count;
public int Charges; public int Charges;
public List<ItemEnchantData> Enchantments = new(); public List<ItemEnchantData> Enchantments = new();
public uint Flags; public uint Flags;
public uint AuctionID; public uint AuctionID;
public ObjectGuid Owner; public ObjectGuid Owner;
public Optional<ulong> MinBid; public ulong? MinBid;
public Optional<ulong> MinIncrement; public ulong? MinIncrement;
public Optional<ulong> BuyoutPrice; public ulong? BuyoutPrice;
public Optional<ulong> UnitPrice; public ulong? UnitPrice;
public int DurationLeft; public int DurationLeft;
public byte DeleteReason; public byte DeleteReason;
public bool CensorServerSideInfo; public bool CensorServerSideInfo;
@@ -944,15 +939,15 @@ namespace Game.Networking.Packets
public ObjectGuid ItemGuid; public ObjectGuid ItemGuid;
public ObjectGuid OwnerAccountID; public ObjectGuid OwnerAccountID;
public uint EndTime; public uint EndTime;
public Optional<ObjectGuid> Bidder; public ObjectGuid? Bidder;
public Optional<ulong> BidAmount; public ulong? BidAmount;
public List<ItemGemData> Gems = new(); public List<ItemGemData> Gems = new();
public Optional<AuctionBucketKey> AuctionBucketKey; public AuctionBucketKey AuctionBucketKey;
public Optional<ObjectGuid> Creator; public ObjectGuid? Creator;
public void Write(WorldPacket data) public void Write(WorldPacket data)
{ {
data.WriteBit(Item.HasValue); data.WriteBit(Item != null);
data.WriteBits(Enchantments.Count, 4); data.WriteBits(Enchantments.Count, 4);
data.WriteBits(Gems.Count, 2); data.WriteBits(Gems.Count, 2);
data.WriteBit(MinBid.HasValue); data.WriteBit(MinBid.HasValue);
@@ -961,7 +956,7 @@ namespace Game.Networking.Packets
data.WriteBit(UnitPrice.HasValue); data.WriteBit(UnitPrice.HasValue);
data.WriteBit(CensorServerSideInfo); data.WriteBit(CensorServerSideInfo);
data.WriteBit(CensorBidInfo); data.WriteBit(CensorBidInfo);
data.WriteBit(AuctionBucketKey.HasValue); data.WriteBit(AuctionBucketKey != null);
data.WriteBit(Creator.HasValue); data.WriteBit(Creator.HasValue);
if (!CensorBidInfo) if (!CensorBidInfo)
{ {
@@ -971,8 +966,8 @@ namespace Game.Networking.Packets
data.FlushBits(); data.FlushBits();
if (Item.HasValue) if (Item != null)
Item.Value.Write(data); Item.Write(data);
data.WriteInt32(Count); data.WriteInt32(Count);
data.WriteInt32(Charges); data.WriteInt32(Charges);
@@ -1019,8 +1014,8 @@ namespace Game.Networking.Packets
foreach (ItemGemData gem in Gems) foreach (ItemGemData gem in Gems)
gem.Write(data); gem.Write(data);
if (AuctionBucketKey.HasValue) if (AuctionBucketKey != null)
AuctionBucketKey.Value.Write(data); AuctionBucketKey.Write(data);
} }
} }
@@ -106,33 +106,29 @@ namespace Game.Networking.Packets
class AuthResponse : ServerPacket class AuthResponse : ServerPacket
{ {
public AuthResponse() : base(ServerOpcodes.AuthResponse) public AuthResponse() : base(ServerOpcodes.AuthResponse) { }
{
WaitInfo = new Optional<AuthWaitInfo>();
SuccessInfo = new Optional<AuthSuccessInfo>();
}
public override void Write() public override void Write()
{ {
_worldPacket.WriteUInt32((uint)Result); _worldPacket.WriteUInt32((uint)Result);
_worldPacket.WriteBit(SuccessInfo.HasValue); _worldPacket.WriteBit(SuccessInfo != null);
_worldPacket.WriteBit(WaitInfo.HasValue); _worldPacket.WriteBit(WaitInfo.HasValue);
_worldPacket.FlushBits(); _worldPacket.FlushBits();
if (SuccessInfo.HasValue) if (SuccessInfo != null)
{ {
_worldPacket.WriteUInt32(SuccessInfo.Value.VirtualRealmAddress); _worldPacket.WriteUInt32(SuccessInfo.VirtualRealmAddress);
_worldPacket.WriteInt32(SuccessInfo.Value.VirtualRealms.Count); _worldPacket.WriteInt32(SuccessInfo.VirtualRealms.Count);
_worldPacket.WriteUInt32(SuccessInfo.Value.TimeRested); _worldPacket.WriteUInt32(SuccessInfo.TimeRested);
_worldPacket.WriteUInt8(SuccessInfo.Value.ActiveExpansionLevel); _worldPacket.WriteUInt8(SuccessInfo.ActiveExpansionLevel);
_worldPacket.WriteUInt8(SuccessInfo.Value.AccountExpansionLevel); _worldPacket.WriteUInt8(SuccessInfo.AccountExpansionLevel);
_worldPacket.WriteUInt32(SuccessInfo.Value.TimeSecondsUntilPCKick); _worldPacket.WriteUInt32(SuccessInfo.TimeSecondsUntilPCKick);
_worldPacket.WriteInt32(SuccessInfo.Value.AvailableClasses.Count); _worldPacket.WriteInt32(SuccessInfo.AvailableClasses.Count);
_worldPacket.WriteInt32(SuccessInfo.Value.Templates.Count); _worldPacket.WriteInt32(SuccessInfo.Templates.Count);
_worldPacket.WriteUInt32(SuccessInfo.Value.CurrencyID); _worldPacket.WriteUInt32(SuccessInfo.CurrencyID);
_worldPacket.WriteInt64(SuccessInfo.Value.Time); _worldPacket.WriteInt64(SuccessInfo.Time);
foreach (var raceClassAvailability in SuccessInfo.Value.AvailableClasses) foreach (var raceClassAvailability in SuccessInfo.AvailableClasses)
{ {
_worldPacket.WriteUInt8(raceClassAvailability.RaceID); _worldPacket.WriteUInt8(raceClassAvailability.RaceID);
_worldPacket.WriteInt32(raceClassAvailability.Classes.Count); _worldPacket.WriteInt32(raceClassAvailability.Classes.Count);
@@ -145,37 +141,37 @@ namespace Game.Networking.Packets
} }
} }
_worldPacket.WriteBit(SuccessInfo.Value.IsExpansionTrial); _worldPacket.WriteBit(SuccessInfo.IsExpansionTrial);
_worldPacket.WriteBit(SuccessInfo.Value.ForceCharacterTemplate); _worldPacket.WriteBit(SuccessInfo.ForceCharacterTemplate);
_worldPacket.WriteBit(SuccessInfo.Value.NumPlayersHorde.HasValue); _worldPacket.WriteBit(SuccessInfo.NumPlayersHorde.HasValue);
_worldPacket.WriteBit(SuccessInfo.Value.NumPlayersAlliance.HasValue); _worldPacket.WriteBit(SuccessInfo.NumPlayersAlliance.HasValue);
_worldPacket.WriteBit(SuccessInfo.Value.ExpansionTrialExpiration.HasValue); _worldPacket.WriteBit(SuccessInfo.ExpansionTrialExpiration.HasValue);
_worldPacket.FlushBits(); _worldPacket.FlushBits();
{ {
_worldPacket.WriteUInt32(SuccessInfo.Value.GameTimeInfo.BillingPlan); _worldPacket.WriteUInt32(SuccessInfo.GameTimeInfo.BillingPlan);
_worldPacket.WriteUInt32(SuccessInfo.Value.GameTimeInfo.TimeRemain); _worldPacket.WriteUInt32(SuccessInfo.GameTimeInfo.TimeRemain);
_worldPacket.WriteUInt32(SuccessInfo.Value.GameTimeInfo.Unknown735); _worldPacket.WriteUInt32(SuccessInfo.GameTimeInfo.Unknown735);
// 3x same bit is not a mistake - preserves legacy client behavior of BillingPlanFlags::SESSION_IGR // 3x same bit is not a mistake - preserves legacy client behavior of BillingPlanFlags::SESSION_IGR
_worldPacket.WriteBit(SuccessInfo.Value.GameTimeInfo.InGameRoom); // inGameRoom check in function checking which lua event to fire when remaining time is near end - BILLING_NAG_DIALOG vs IGR_BILLING_NAG_DIALOG _worldPacket.WriteBit(SuccessInfo.GameTimeInfo.InGameRoom); // inGameRoom check in function checking which lua event to fire when remaining time is near end - BILLING_NAG_DIALOG vs IGR_BILLING_NAG_DIALOG
_worldPacket.WriteBit(SuccessInfo.Value.GameTimeInfo.InGameRoom); // inGameRoom lua return from Script_GetBillingPlan _worldPacket.WriteBit(SuccessInfo.GameTimeInfo.InGameRoom); // inGameRoom lua return from Script_GetBillingPlan
_worldPacket.WriteBit(SuccessInfo.Value.GameTimeInfo.InGameRoom); // not used anywhere in the client _worldPacket.WriteBit(SuccessInfo.GameTimeInfo.InGameRoom); // not used anywhere in the client
_worldPacket.FlushBits(); _worldPacket.FlushBits();
} }
if (SuccessInfo.Value.NumPlayersHorde.HasValue) if (SuccessInfo.NumPlayersHorde.HasValue)
_worldPacket.WriteUInt16(SuccessInfo.Value.NumPlayersHorde.Value); _worldPacket.WriteUInt16(SuccessInfo.NumPlayersHorde.Value);
if (SuccessInfo.Value.NumPlayersAlliance.HasValue) if (SuccessInfo.NumPlayersAlliance.HasValue)
_worldPacket.WriteUInt16(SuccessInfo.Value.NumPlayersAlliance.Value); _worldPacket.WriteUInt16(SuccessInfo.NumPlayersAlliance.Value);
if(SuccessInfo.Value.ExpansionTrialExpiration.HasValue) if(SuccessInfo.ExpansionTrialExpiration.HasValue)
_worldPacket.WriteInt32(SuccessInfo.Value.ExpansionTrialExpiration.Value); _worldPacket.WriteInt32(SuccessInfo.ExpansionTrialExpiration.Value);
foreach (VirtualRealmInfo virtualRealm in SuccessInfo.Value.VirtualRealms) foreach (VirtualRealmInfo virtualRealm in SuccessInfo.VirtualRealms)
virtualRealm.Write(_worldPacket); virtualRealm.Write(_worldPacket);
foreach (var templat in SuccessInfo.Value.Templates) foreach (var templat in SuccessInfo.Templates)
{ {
_worldPacket.WriteUInt32(templat.TemplateSetId); _worldPacket.WriteUInt32(templat.TemplateSetId);
_worldPacket.WriteInt32(templat.Classes.Count); _worldPacket.WriteInt32(templat.Classes.Count);
@@ -198,8 +194,8 @@ namespace Game.Networking.Packets
WaitInfo.Value.Write(_worldPacket); WaitInfo.Value.Write(_worldPacket);
} }
public Optional<AuthSuccessInfo> SuccessInfo; // contains the packet data in case that it has account information (It is never set when WaitInfo is set), otherwise its contents are undefined. public AuthSuccessInfo SuccessInfo; // contains the packet data in case that it has account information (It is never set when WaitInfo is set), otherwise its contents are undefined.
public Optional<AuthWaitInfo> WaitInfo; // contains the queue wait information in case the account is in the login queue. public AuthWaitInfo? WaitInfo; // contains the queue wait information in case the account is in the login queue.
public BattlenetRpcErrorCode Result; // the result of the authentication process, possible values are @ref BattlenetRpcErrorCode public BattlenetRpcErrorCode Result; // the result of the authentication process, possible values are @ref BattlenetRpcErrorCode
public class AuthSuccessInfo public class AuthSuccessInfo
@@ -222,9 +218,9 @@ namespace Game.Networking.Packets
public bool IsExpansionTrial; public bool IsExpansionTrial;
public bool ForceCharacterTemplate; // forces the client to always use a character template when creating a new character. @see Templates. @todo implement public bool ForceCharacterTemplate; // forces the client to always use a character template when creating a new character. @see Templates. @todo implement
public Optional<ushort> NumPlayersHorde; // number of horde players in this realm. @todo implement public ushort? NumPlayersHorde; // number of horde players in this realm. @todo implement
public Optional<ushort> NumPlayersAlliance; // number of alliance players in this realm. @todo implement public ushort? NumPlayersAlliance; // number of alliance players in this realm. @todo implement
public Optional<int> ExpansionTrialExpiration; // expansion trial expiration unix timestamp public int? ExpansionTrialExpiration; // expansion trial expiration unix timestamp
public struct GameTime public struct GameTime
{ {
@@ -502,16 +502,16 @@ namespace Game.Networking.Packets
{ {
_worldPacket.WriteUInt8(Winner); _worldPacket.WriteUInt8(Winner);
_worldPacket.WriteInt32(Duration); _worldPacket.WriteInt32(Duration);
_worldPacket.WriteBit(LogData.HasValue); _worldPacket.WriteBit(LogData != null);
_worldPacket.FlushBits(); _worldPacket.FlushBits();
if (LogData.HasValue) if (LogData != null)
LogData.Value.Write(_worldPacket); LogData.Write(_worldPacket);
} }
public byte Winner; public byte Winner;
public int Duration; public int Duration;
public Optional<PVPMatchStatistics> LogData; public PVPMatchStatistics LogData;
} }
//Structs //Structs
@@ -561,7 +561,7 @@ namespace Game.Networking.Packets
public class PVPMatchStatistics public class PVPMatchStatistics
{ {
public List<PVPMatchPlayerStatistics> Statistics = new(); public List<PVPMatchPlayerStatistics> Statistics = new();
public Optional<RatingData> Ratings; public RatingData Ratings;
public sbyte[] PlayerCount = new sbyte[2]; public sbyte[] PlayerCount = new sbyte[2];
public class RatingData public class RatingData
@@ -664,13 +664,13 @@ namespace Game.Networking.Packets
public uint Kills; public uint Kills;
public byte Faction; public byte Faction;
public bool IsInWorld; public bool IsInWorld;
public Optional<HonorData> Honor; public HonorData? Honor;
public uint DamageDone; public uint DamageDone;
public uint HealingDone; public uint HealingDone;
public Optional<uint> PreMatchRating; public uint? PreMatchRating;
public Optional<int> RatingChange; public int? RatingChange;
public Optional<uint> PreMatchMMR; public uint? PreMatchMMR;
public Optional<int> MmrChange; public int? MmrChange;
public List<PVPMatchPlayerPVPStat> Stats = new(); public List<PVPMatchPlayerPVPStat> Stats = new();
public int PrimaryTalentTree; public int PrimaryTalentTree;
public int Sex; public int Sex;
@@ -682,13 +682,13 @@ namespace Game.Networking.Packets
public void Write(WorldPacket data) public void Write(WorldPacket data)
{ {
data.WriteBit(Ratings.HasValue); data.WriteBit(Ratings != null);
data.WriteInt32(Statistics.Count); data.WriteInt32(Statistics.Count);
foreach (var count in PlayerCount) foreach (var count in PlayerCount)
data.WriteInt8(count); data.WriteInt8(count);
if (Ratings.HasValue) if (Ratings != null)
Ratings.Value.Write(data); Ratings.Write(data);
foreach (var player in Statistics) foreach (var player in Statistics)
player.Write(data); player.Write(data);
@@ -139,7 +139,7 @@ namespace Game.Networking.Packets
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
{ {
DeclinedNames.Set(new DeclinedName()); DeclinedNames = new();
byte[] declinedNameLengths = new byte[SharedConst.MaxDeclinedNameCases]; byte[] declinedNameLengths = new byte[SharedConst.MaxDeclinedNameCases];
@@ -147,7 +147,7 @@ namespace Game.Networking.Packets
declinedNameLengths[i] = _worldPacket.ReadBits<byte>(7); declinedNameLengths[i] = _worldPacket.ReadBits<byte>(7);
for (byte i = 0; i < SharedConst.MaxDeclinedNameCases; ++i) for (byte i = 0; i < SharedConst.MaxDeclinedNameCases; ++i)
DeclinedNames.Value.name[i] = _worldPacket.ReadString(declinedNameLengths[i]); DeclinedNames.name[i] = _worldPacket.ReadString(declinedNameLengths[i]);
} }
Name = _worldPacket.ReadString(nameLength); Name = _worldPacket.ReadString(nameLength);
@@ -155,7 +155,7 @@ namespace Game.Networking.Packets
public ObjectGuid PetGuid; public ObjectGuid PetGuid;
public string Name; public string Name;
public Optional<DeclinedName> DeclinedNames; public DeclinedName DeclinedNames;
} }
class QueryBattlePetName : ClientPacket class QueryBattlePetName : ClientPacket
@@ -355,7 +355,7 @@ namespace Game.Networking.Packets
public uint MaxHealth; public uint MaxHealth;
public uint Speed; public uint Speed;
public byte Quality; public byte Quality;
public Optional<BattlePetOwnerInfo> OwnerInfo; public BattlePetOwnerInfo? OwnerInfo;
public string Name; public string Name;
} }
@@ -746,19 +746,19 @@ namespace Game.Networking.Packets
bool hasUnused801_3 = data.HasBit(); bool hasUnused801_3 = data.HasBit();
if (hasUnused801_1) if (hasUnused801_1)
Unused801_1.Set(data.ReadPackedGuid()); Unused801_1 = data.ReadPackedGuid();
if (hasUnused801_2) if (hasUnused801_2)
Unused801_2.Set(data.ReadUInt64()); Unused801_2 = data.ReadUInt64();
if (hasUnused801_3) if (hasUnused801_3)
Unused801_3.Set(data.ReadUInt64()); Unused801_3 = data.ReadUInt64();
} }
public ObjectGuid Guid; public ObjectGuid Guid;
public byte Status; public byte Status;
public byte Moderator; public byte Moderator;
public Optional<ObjectGuid> Unused801_1; public ObjectGuid? Unused801_1;
public Optional<ulong> Unused801_2; public ulong? Unused801_2;
public Optional<ulong> Unused801_3; public ulong? Unused801_3;
} }
class CalendarAddEventInfo class CalendarAddEventInfo
@@ -72,7 +72,7 @@ namespace Game.Networking.Packets
public bool IsAlliedRacesCreationAllowed; public bool IsAlliedRacesCreationAllowed;
public int MaxCharacterLevel = 1; public int MaxCharacterLevel = 1;
public Optional<uint> DisabledClassesMask = new(); public uint? DisabledClassesMask = new();
public List<CharacterInfo> Characters = new(); // all characters on the list public List<CharacterInfo> Characters = new(); // all characters on the list
public List<RaceUnlock> RaceUnlockData = new(); // public List<RaceUnlock> RaceUnlockData = new(); //
@@ -364,7 +364,7 @@ namespace Game.Networking.Packets
CreateInfo.Name = _worldPacket.ReadString(nameLength); CreateInfo.Name = _worldPacket.ReadString(nameLength);
if (CreateInfo.TemplateSet.HasValue) if (CreateInfo.TemplateSet.HasValue)
CreateInfo.TemplateSet.Set(_worldPacket.ReadUInt32()); CreateInfo.TemplateSet = _worldPacket.ReadUInt32();
for (var i = 0; i < customizationCount; ++i) for (var i = 0; i < customizationCount; ++i)
{ {
@@ -435,10 +435,7 @@ namespace Game.Networking.Packets
public class CharacterRenameResult : ServerPacket public class CharacterRenameResult : ServerPacket
{ {
public CharacterRenameResult() : base(ServerOpcodes.CharacterRenameResult) public CharacterRenameResult() : base(ServerOpcodes.CharacterRenameResult) { }
{
Guid = new Optional<ObjectGuid>();
}
public override void Write() public override void Write()
{ {
@@ -454,8 +451,8 @@ namespace Game.Networking.Packets
} }
public string Name; public string Name;
public ResponseCodes Result = 0; public ResponseCodes Result;
public Optional<ObjectGuid> Guid; public ObjectGuid? Guid;
} }
public class CharCustomize : ClientPacket public class CharCustomize : ClientPacket
@@ -523,27 +520,24 @@ namespace Game.Networking.Packets
public class CharFactionChangeResult : ServerPacket public class CharFactionChangeResult : ServerPacket
{ {
public CharFactionChangeResult() : base(ServerOpcodes.CharFactionChangeResult) public CharFactionChangeResult() : base(ServerOpcodes.CharFactionChangeResult) { }
{
Display = new Optional<CharFactionChangeDisplayInfo>();
}
public override void Write() public override void Write()
{ {
_worldPacket.WriteUInt8((byte)Result); _worldPacket.WriteUInt8((byte)Result);
_worldPacket.WritePackedGuid(Guid); _worldPacket.WritePackedGuid(Guid);
_worldPacket.WriteBit(Display.HasValue); _worldPacket.WriteBit(Display != null);
_worldPacket.FlushBits(); _worldPacket.FlushBits();
if (Display.HasValue) if (Display != null)
{ {
_worldPacket.WriteBits(Display.Value.Name.GetByteCount(), 6); _worldPacket.WriteBits(Display.Name.GetByteCount(), 6);
_worldPacket.WriteUInt8(Display.Value.SexID); _worldPacket.WriteUInt8(Display.SexID);
_worldPacket.WriteUInt8(Display.Value.RaceID); _worldPacket.WriteUInt8(Display.RaceID);
_worldPacket.WriteInt32(Display.Value.Customizations.Count); _worldPacket.WriteInt32(Display.Customizations.Count);
_worldPacket.WriteString(Display.Value.Name); _worldPacket.WriteString(Display.Name);
foreach (ChrCustomizationChoice customization in Display.Value.Customizations) foreach (ChrCustomizationChoice customization in Display.Customizations)
{ {
_worldPacket.WriteUInt32(customization.ChrCustomizationOptionID); _worldPacket.WriteUInt32(customization.ChrCustomizationOptionID);
_worldPacket.WriteUInt32(customization.ChrCustomizationChoiceID); _worldPacket.WriteUInt32(customization.ChrCustomizationChoiceID);
@@ -553,7 +547,7 @@ namespace Game.Networking.Packets
public ResponseCodes Result = 0; public ResponseCodes Result = 0;
public ObjectGuid Guid; public ObjectGuid Guid;
public Optional<CharFactionChangeDisplayInfo> Display; public CharFactionChangeDisplayInfo Display;
public class CharFactionChangeDisplayInfo public class CharFactionChangeDisplayInfo
{ {
@@ -1085,7 +1079,7 @@ namespace Game.Networking.Packets
public Class ClassId = Class.None; public Class ClassId = Class.None;
public Gender Sex = Gender.None; public Gender Sex = Gender.None;
public Array<ChrCustomizationChoice> Customizations = new(50); public Array<ChrCustomizationChoice> Customizations = new(50);
public Optional<uint> TemplateSet = new(); public uint? TemplateSet;
public bool IsTrialBoost; public bool IsTrialBoost;
public bool UseNPE; public bool UseNPE;
public string Name; public string Name;
@@ -97,13 +97,13 @@ namespace Game.Networking.Packets
{ {
uint targetLen = _worldPacket.ReadBits<uint>(9); uint targetLen = _worldPacket.ReadBits<uint>(9);
Params.Read(_worldPacket); Params.Read(_worldPacket);
ChannelGUID.Set(_worldPacket.ReadPackedGuid()); ChannelGUID = _worldPacket.ReadPackedGuid();
Target = _worldPacket.ReadString(targetLen); Target = _worldPacket.ReadString(targetLen);
} }
public string Target; public string Target;
public ChatAddonMessageParams Params = new(); public ChatAddonMessageParams Params = new();
public Optional<ObjectGuid> ChannelGUID; // not optional in the packet. Optional for api reasons public ObjectGuid? ChannelGUID; // not optional in the packet. Optional for api reasons
} }
public class ChatMessageDND : ClientPacket public class ChatMessageDND : ClientPacket
@@ -266,10 +266,10 @@ namespace Game.Networking.Packets
public uint AchievementID; public uint AchievementID;
public ChatFlags _ChatFlags; public ChatFlags _ChatFlags;
public float DisplayTime; public float DisplayTime;
public Optional<uint> Unused_801; public uint? Unused_801;
public bool HideChatLog; public bool HideChatLog;
public bool FakeSenderName; public bool FakeSenderName;
public Optional<ObjectGuid> ChannelGUID; public ObjectGuid? ChannelGUID;
} }
public class EmoteMessage : ServerPacket public class EmoteMessage : ServerPacket
@@ -81,11 +81,11 @@ namespace Game.Networking.Packets
_worldPacket.WriteBits(Flags, 7); _worldPacket.WriteBits(Flags, 7);
_worldPacket.WriteBit(false); // Debug info _worldPacket.WriteBit(false); // Debug info
WriteLogDataBit(); WriteLogDataBit();
_worldPacket.WriteBit(ContentTuning.HasValue); _worldPacket.WriteBit(ContentTuning != null);
FlushBits(); FlushBits();
WriteLogData(); WriteLogData();
if (ContentTuning.HasValue) if (ContentTuning != null)
ContentTuning.Value.Write(_worldPacket); ContentTuning.Write(_worldPacket);
} }
public ObjectGuid Me; public ObjectGuid Me;
@@ -103,7 +103,7 @@ namespace Game.Networking.Packets
public int Absorbed; public int Absorbed;
public int Flags; public int Flags;
// Optional<SpellNonMeleeDamageLogDebugInfo> DebugInfo; // Optional<SpellNonMeleeDamageLogDebugInfo> DebugInfo;
public Optional<ContentTuningParams> ContentTuning = new(); public ContentTuningParams ContentTuning;
} }
class EnvironmentalDamageLog : CombatLogServerPacket class EnvironmentalDamageLog : CombatLogServerPacket
@@ -213,7 +213,7 @@ namespace Game.Networking.Packets
_worldPacket.WriteBit(CritRollMade.HasValue); _worldPacket.WriteBit(CritRollMade.HasValue);
_worldPacket.WriteBit(CritRollNeeded.HasValue); _worldPacket.WriteBit(CritRollNeeded.HasValue);
WriteLogDataBit(); WriteLogDataBit();
_worldPacket.WriteBit(ContentTuning.HasValue); _worldPacket.WriteBit(ContentTuning != null);
FlushBits(); FlushBits();
WriteLogData(); WriteLogData();
@@ -224,8 +224,8 @@ namespace Game.Networking.Packets
if (CritRollNeeded.HasValue) if (CritRollNeeded.HasValue)
_worldPacket.WriteFloat(CritRollNeeded.Value); _worldPacket.WriteFloat(CritRollNeeded.Value);
if (ContentTuning.HasValue) if (ContentTuning != null)
ContentTuning.Value.Write(_worldPacket); ContentTuning.Write(_worldPacket);
} }
public ObjectGuid CasterGUID; public ObjectGuid CasterGUID;
@@ -236,9 +236,9 @@ namespace Game.Networking.Packets
public uint OverHeal; public uint OverHeal;
public uint Absorbed; public uint Absorbed;
public bool Crit; public bool Crit;
public Optional<float> CritRollMade; public float? CritRollMade;
public Optional<float> CritRollNeeded; public float? CritRollNeeded;
Optional<ContentTuningParams> ContentTuning = new(); public ContentTuningParams ContentTuning;
} }
class SpellPeriodicAuraLog : CombatLogServerPacket class SpellPeriodicAuraLog : CombatLogServerPacket
@@ -284,11 +284,11 @@ namespace Game.Networking.Packets
data.WriteBit(Crit); data.WriteBit(Crit);
data.WriteBit(DebugInfo.HasValue); data.WriteBit(DebugInfo.HasValue);
data.WriteBit(ContentTuning.HasValue); data.WriteBit(ContentTuning != null);
data.FlushBits(); data.FlushBits();
if (ContentTuning.HasValue) if (ContentTuning != null)
ContentTuning.Value.Write(data); ContentTuning.Write(data);
if (DebugInfo.HasValue) if (DebugInfo.HasValue)
{ {
@@ -305,8 +305,8 @@ namespace Game.Networking.Packets
public uint AbsorbedOrAmplitude; public uint AbsorbedOrAmplitude;
public uint Resisted; public uint Resisted;
public bool Crit; public bool Crit;
public Optional<PeriodicalAuraLogEffectDebugInfo> DebugInfo; public PeriodicalAuraLogEffectDebugInfo? DebugInfo;
public Optional<ContentTuningParams> ContentTuning = new(); public ContentTuningParams ContentTuning;
} }
} }
@@ -450,8 +450,8 @@ namespace Game.Networking.Packets
public ObjectGuid Caster; public ObjectGuid Caster;
public ObjectGuid Target; public ObjectGuid Target;
public uint SpellID; public uint SpellID;
public Optional<float> Rolled; public float? Rolled;
public Optional<float> Needed; public float? Needed;
} }
class SpellOrDamageImmune : ServerPacket class SpellOrDamageImmune : ServerPacket
@@ -505,10 +505,7 @@ namespace Game.Networking.Packets
class AttackerStateUpdate : CombatLogServerPacket class AttackerStateUpdate : CombatLogServerPacket
{ {
public AttackerStateUpdate() : base(ServerOpcodes.AttackerStateUpdate, ConnectionType.Instance) public AttackerStateUpdate() : base(ServerOpcodes.AttackerStateUpdate, ConnectionType.Instance) { }
{
SubDmg = new Optional<SubDamage>();
}
public override void Write() public override void Write()
{ {
@@ -587,7 +584,7 @@ namespace Game.Networking.Packets
public int Damage; public int Damage;
public int OriginalDamage; public int OriginalDamage;
public int OverDamage = -1; // (damage - health) or -1 if unit is still alive public int OverDamage = -1; // (damage - health) or -1 if unit is still alive
public Optional<SubDamage> SubDmg; public SubDamage? SubDmg;
public byte VictimState; public byte VictimState;
public uint AttackerState; public uint AttackerState;
public uint MeleeSpellID; public uint MeleeSpellID;
@@ -684,7 +681,6 @@ namespace Game.Networking.Packets
{ {
Victim = victim; Victim = victim;
MissReason = missReason; MissReason = missReason;
Debug = new Optional<SpellLogMissDebug>();
} }
public void Write(WorldPacket data) public void Write(WorldPacket data)
@@ -699,15 +695,15 @@ namespace Game.Networking.Packets
public ObjectGuid Victim; public ObjectGuid Victim;
public byte MissReason; public byte MissReason;
Optional<SpellLogMissDebug> Debug; SpellLogMissDebug? Debug;
} }
struct SpellDispellData struct SpellDispellData
{ {
public uint SpellID; public uint SpellID;
public bool Harmful; public bool Harmful;
public Optional<int> Rolled; public int? Rolled;
public Optional<int> Needed; public int? Needed;
} }
public struct SubDamage public struct SubDamage
@@ -441,11 +441,11 @@ namespace Game.Networking.Packets
data.WriteUInt32(FollowerXP); data.WriteUInt32(FollowerXP);
data.WriteUInt32(GarrMssnBonusAbilityID); data.WriteUInt32(GarrMssnBonusAbilityID);
data.WriteInt32(ItemFileDataID); data.WriteInt32(ItemFileDataID);
data.WriteBit(ItemInstance.HasValue); data.WriteBit(ItemInstance != null);
data.FlushBits(); data.FlushBits();
if (ItemInstance.HasValue) if (ItemInstance != null)
ItemInstance.Value.Write(data); ItemInstance.Write(data);
} }
public int ItemID; public int ItemID;
@@ -455,7 +455,7 @@ namespace Game.Networking.Packets
public uint FollowerXP; public uint FollowerXP;
public uint GarrMssnBonusAbilityID; public uint GarrMssnBonusAbilityID;
public int ItemFileDataID; public int ItemFileDataID;
public Optional<ItemInstance> ItemInstance; public ItemInstance ItemInstance;
} }
struct GarrisonMissionBonusAbility struct GarrisonMissionBonusAbility
@@ -501,7 +501,7 @@ namespace Game.Networking.Packets
public int Rank; public int Rank;
public long ResearchStartTime; public long ResearchStartTime;
public int Flags; public int Flags;
public Optional<GarrisonTalentSocketData> Socket; public GarrisonTalentSocketData? Socket;
} }
struct GarrisonCollectionEntry struct GarrisonCollectionEntry
+25 -25
View File
@@ -234,11 +234,11 @@ namespace Game.Networking.Packets
Name = _worldPacket.ReadString(nameLen); Name = _worldPacket.ReadString(nameLen);
if (hasUnused910) if (hasUnused910)
Unused910.Set(_worldPacket.ReadInt32()); Unused910 = _worldPacket.ReadInt32();
} }
public string Name; public string Name;
public Optional<int> Unused910; public int? Unused910;
} }
public class GuildInvite : ServerPacket public class GuildInvite : ServerPacket
@@ -1094,13 +1094,13 @@ namespace Game.Networking.Packets
ContainerItemSlot = _worldPacket.ReadUInt8(); ContainerItemSlot = _worldPacket.ReadUInt8();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
ContainerSlot.Set(_worldPacket.ReadUInt8()); ContainerSlot = _worldPacket.ReadUInt8();
} }
public ObjectGuid Banker; public ObjectGuid Banker;
public byte BankTab; public byte BankTab;
public byte BankSlot; public byte BankSlot;
public Optional<byte> ContainerSlot; public byte? ContainerSlot;
public byte ContainerItemSlot; public byte ContainerItemSlot;
} }
@@ -1116,13 +1116,13 @@ namespace Game.Networking.Packets
ContainerItemSlot = _worldPacket.ReadUInt8(); ContainerItemSlot = _worldPacket.ReadUInt8();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
ContainerSlot.Set(_worldPacket.ReadUInt8()); ContainerSlot = _worldPacket.ReadUInt8();
} }
public ObjectGuid Banker; public ObjectGuid Banker;
public byte BankTab; public byte BankTab;
public byte BankSlot; public byte BankSlot;
public Optional<byte> ContainerSlot; public byte? ContainerSlot;
public byte ContainerItemSlot; public byte ContainerItemSlot;
} }
@@ -1138,13 +1138,13 @@ namespace Game.Networking.Packets
ContainerItemSlot = _worldPacket.ReadUInt8(); ContainerItemSlot = _worldPacket.ReadUInt8();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
ContainerSlot.Set(_worldPacket.ReadUInt8()); ContainerSlot = _worldPacket.ReadUInt8();
} }
public ObjectGuid Banker; public ObjectGuid Banker;
public byte BankTab; public byte BankTab;
public byte BankSlot; public byte BankSlot;
public Optional<byte> ContainerSlot; public byte? ContainerSlot;
public byte ContainerItemSlot; public byte ContainerItemSlot;
} }
@@ -1199,13 +1199,13 @@ namespace Game.Networking.Packets
StackCount = _worldPacket.ReadUInt32(); StackCount = _worldPacket.ReadUInt32();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
ContainerSlot.Set(_worldPacket.ReadUInt8()); ContainerSlot = _worldPacket.ReadUInt8();
} }
public ObjectGuid Banker; public ObjectGuid Banker;
public byte BankTab; public byte BankTab;
public byte BankSlot; public byte BankSlot;
public Optional<byte> ContainerSlot; public byte? ContainerSlot;
public byte ContainerItemSlot; public byte ContainerItemSlot;
public uint StackCount; public uint StackCount;
} }
@@ -1223,13 +1223,13 @@ namespace Game.Networking.Packets
StackCount = _worldPacket.ReadUInt32(); StackCount = _worldPacket.ReadUInt32();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
ContainerSlot.Set(_worldPacket.ReadUInt8()); ContainerSlot = _worldPacket.ReadUInt8();
} }
public ObjectGuid Banker; public ObjectGuid Banker;
public byte BankTab; public byte BankTab;
public byte BankSlot; public byte BankSlot;
public Optional<byte> ContainerSlot; public byte? ContainerSlot;
public byte ContainerItemSlot; public byte ContainerItemSlot;
public uint StackCount; public uint StackCount;
} }
@@ -1247,13 +1247,13 @@ namespace Game.Networking.Packets
StackCount = _worldPacket.ReadUInt32(); StackCount = _worldPacket.ReadUInt32();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
ContainerSlot.Set(_worldPacket.ReadUInt8()); ContainerSlot = _worldPacket.ReadUInt8();
} }
public ObjectGuid Banker; public ObjectGuid Banker;
public byte BankTab; public byte BankTab;
public byte BankSlot; public byte BankSlot;
public Optional<byte> ContainerSlot; public byte? ContainerSlot;
public byte ContainerItemSlot; public byte ContainerItemSlot;
public uint StackCount; public uint StackCount;
} }
@@ -1271,13 +1271,13 @@ namespace Game.Networking.Packets
StackCount = _worldPacket.ReadUInt32(); StackCount = _worldPacket.ReadUInt32();
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
ContainerSlot.Set(_worldPacket.ReadUInt8()); ContainerSlot = _worldPacket.ReadUInt8();
} }
public ObjectGuid Banker; public ObjectGuid Banker;
public byte BankTab; public byte BankTab;
public byte BankSlot; public byte BankSlot;
public Optional<byte> ContainerSlot; public byte? ContainerSlot;
public byte ContainerItemSlot; public byte ContainerItemSlot;
public uint StackCount; public uint StackCount;
} }
@@ -1398,7 +1398,7 @@ namespace Game.Networking.Packets
public int Tab; public int Tab;
public List<GuildBankLogEntry> Entry; public List<GuildBankLogEntry> Entry;
public Optional<ulong> WeeklyBonusMoney; public ulong? WeeklyBonusMoney;
} }
public class GuildBankTextQuery : ClientPacket public class GuildBankTextQuery : ClientPacket
@@ -1765,10 +1765,10 @@ namespace Game.Networking.Packets
public ObjectGuid PlayerGUID; public ObjectGuid PlayerGUID;
public uint TimeOffset; public uint TimeOffset;
public sbyte EntryType; public sbyte EntryType;
public Optional<ulong> Money; public ulong? Money;
public Optional<int> ItemID; public int? ItemID;
public Optional<int> Count; public int? Count;
public Optional<sbyte> OtherTab; public sbyte? OtherTab;
} }
public class GuildNewsEvent public class GuildNewsEvent
@@ -1789,11 +1789,11 @@ namespace Game.Networking.Packets
foreach (ObjectGuid memberGuid in MemberList) foreach (ObjectGuid memberGuid in MemberList)
data.WritePackedGuid(memberGuid); data.WritePackedGuid(memberGuid);
data.WriteBit(Item.HasValue); data.WriteBit(Item != null);
data.FlushBits(); data.FlushBits();
if (Item.HasValue) if (Item != null)
Item.Value.Write(data); Item.Write(data);
} }
public int Id; public int Id;
@@ -1803,6 +1803,6 @@ namespace Game.Networking.Packets
public int[] Data = new int[2]; public int[] Data = new int[2];
public ObjectGuid MemberGuid; public ObjectGuid MemberGuid;
public List<ObjectGuid> MemberList = new(); public List<ObjectGuid> MemberList = new();
public Optional<ItemInstance> Item; public ItemInstance Item;
} }
} }
@@ -82,7 +82,7 @@ namespace Game.Networking.Packets
public List<ushort> Glyphs = new(); public List<ushort> Glyphs = new();
public List<ushort> Talents = new(); public List<ushort> Talents = new();
public Array<ushort> PvpTalents = new(PlayerConst.MaxPvpTalentSlots, 0); public Array<ushort> PvpTalents = new(PlayerConst.MaxPvpTalentSlots, 0);
public Optional<InspectGuildData> GuildData = new(); public InspectGuildData? GuildData;
public Array<PVPBracketData> Bracket = new(6, default); public Array<PVPBracketData> Bracket = new(6, default);
public uint? AzeriteLevel; public uint? AzeriteLevel;
public int ItemLevel; public int ItemLevel;
+23 -26
View File
@@ -148,15 +148,15 @@ namespace Game.Networking.Packets
{ {
_worldPacket.WritePackedGuid(ItemGUID); _worldPacket.WritePackedGuid(ItemGUID);
_worldPacket.WriteUInt8(Result); _worldPacket.WriteUInt8(Result);
_worldPacket.WriteBit(Contents.HasValue); _worldPacket.WriteBit(Contents != null);
_worldPacket.FlushBits(); _worldPacket.FlushBits();
if (Contents.HasValue) if (Contents != null)
Contents.Value.Write(_worldPacket); Contents.Write(_worldPacket);
} }
public byte Result; public byte Result;
public ObjectGuid ItemGUID; public ObjectGuid ItemGUID;
public Optional<ItemPurchaseContents> Contents; public ItemPurchaseContents Contents;
} }
class ItemExpirePurchaseRefund : ServerPacket class ItemExpirePurchaseRefund : ServerPacket
@@ -844,7 +844,7 @@ namespace Game.Networking.Packets
public class ItemInstance public class ItemInstance
{ {
public uint ItemID; public uint ItemID;
public Optional<ItemBonuses> ItemBonus; public ItemBonuses ItemBonus;
public ItemModList Modifications = new(); public ItemModList Modifications = new();
public ItemInstance() { } public ItemInstance() { }
@@ -855,9 +855,9 @@ namespace Game.Networking.Packets
List<uint> bonusListIds = item.m_itemData.BonusListIDs; List<uint> bonusListIds = item.m_itemData.BonusListIDs;
if (!bonusListIds.Empty()) if (!bonusListIds.Empty())
{ {
ItemBonus.Value = new(); ItemBonus = new();
ItemBonus.Value.BonusListIDs.AddRange(bonusListIds); ItemBonus.BonusListIDs.AddRange(bonusListIds);
ItemBonus.Value.Context = item.GetContext(); ItemBonus.Context = item.GetContext();
} }
foreach (var mod in item.m_itemData.Modifiers.GetValue().Values) foreach (var mod in item.m_itemData.Modifiers.GetValue().Values)
@@ -870,11 +870,11 @@ namespace Game.Networking.Packets
if (!lootItem.BonusListIDs.Empty() || lootItem.randomBonusListId != 0) if (!lootItem.BonusListIDs.Empty() || lootItem.randomBonusListId != 0)
{ {
ItemBonus.Value = new(); ItemBonus = new();
ItemBonus.Value.BonusListIDs = lootItem.BonusListIDs; ItemBonus.BonusListIDs = lootItem.BonusListIDs;
ItemBonus.Value.Context = lootItem.context; ItemBonus.Context = lootItem.context;
if (lootItem.randomBonusListId != 0) if (lootItem.randomBonusListId != 0)
ItemBonus.Value.BonusListIDs.Add(lootItem.randomBonusListId); ItemBonus.BonusListIDs.Add(lootItem.randomBonusListId);
} }
} }
@@ -890,9 +890,9 @@ namespace Game.Networking.Packets
if (!voidItem.BonusListIDs.Empty()) if (!voidItem.BonusListIDs.Empty())
{ {
ItemBonus.Value = new(); ItemBonus = new();
ItemBonus.Value.Context = voidItem.Context; ItemBonus.Context = voidItem.Context;
ItemBonus.Value.BonusListIDs = voidItem.BonusListIDs; ItemBonus.BonusListIDs = voidItem.BonusListIDs;
} }
} }
@@ -907,20 +907,20 @@ namespace Game.Networking.Packets
bonus.BonusListIDs.Add(bonusListId); bonus.BonusListIDs.Add(bonusListId);
if (bonus.Context != 0 || !bonus.BonusListIDs.Empty()) if (bonus.Context != 0 || !bonus.BonusListIDs.Empty())
ItemBonus.Set(bonus); ItemBonus = bonus;
} }
public void Write(WorldPacket data) public void Write(WorldPacket data)
{ {
data.WriteUInt32(ItemID); data.WriteUInt32(ItemID);
data.WriteBit(ItemBonus.HasValue); data.WriteBit(ItemBonus != null);
data.FlushBits(); data.FlushBits();
Modifications.Write(data); Modifications.Write(data);
if (ItemBonus.HasValue) if (ItemBonus != null)
ItemBonus.Value.Write(data); ItemBonus.Write(data);
} }
public void Read(WorldPacket data) public void Read(WorldPacket data)
@@ -928,14 +928,14 @@ namespace Game.Networking.Packets
ItemID = data.ReadUInt32(); ItemID = data.ReadUInt32();
if (data.HasBit()) if (data.HasBit())
ItemBonus.Value = new(); ItemBonus = new();
data.ResetBitPos(); data.ResetBitPos();
Modifications.Read(data); Modifications.Read(data);
if (ItemBonus.HasValue) if (ItemBonus != null)
ItemBonus.Value.Read(data); ItemBonus.Read(data);
} }
public override int GetHashCode() public override int GetHashCode()
@@ -956,15 +956,12 @@ namespace Game.Networking.Packets
if (left.ItemID != right.ItemID) if (left.ItemID != right.ItemID)
return false; return false;
if (left.ItemBonus.HasValue != right.ItemBonus.HasValue) if (left.ItemBonus != null && right.ItemBonus != null && left.ItemBonus != right.ItemBonus)
return false; return false;
if (left.Modifications != right.Modifications) if (left.Modifications != right.Modifications)
return false; return false;
if (left.ItemBonus.HasValue && left.ItemBonus.Value != right.ItemBonus.Value)
return false;
return true; return true;
} }
+19 -16
View File
@@ -468,7 +468,7 @@ namespace Game.Networking.Packets
public class LFGBlackList public class LFGBlackList
{ {
public Optional<ObjectGuid> PlayerGuid; public ObjectGuid? PlayerGuid;
public List<LFGBlackListSlot> Slot = new(); public List<LFGBlackListSlot> Slot = new();
public void Write(WorldPacket data) public void Write(WorldPacket data)
@@ -564,10 +564,10 @@ namespace Game.Networking.Packets
public List<LfgPlayerQuestRewardItem> Item = new(); public List<LfgPlayerQuestRewardItem> Item = new();
public List<LfgPlayerQuestRewardCurrency> Currency = new(); public List<LfgPlayerQuestRewardCurrency> Currency = new();
public List<LfgPlayerQuestRewardCurrency> BonusCurrency = new(); public List<LfgPlayerQuestRewardCurrency> BonusCurrency = new();
public Optional<int> RewardSpellID; // Only used by SMSG_LFG_PLAYER_INFO public int? RewardSpellID; // Only used by SMSG_LFG_PLAYER_INFO
public Optional<int> Unused1; public int? Unused1;
public Optional<ulong> Unused2; public ulong? Unused2;
public Optional<int> Honor; // Only used by SMSG_REQUEST_PVP_REWARDS_RESPONSE public int? Honor; // Only used by SMSG_REQUEST_PVP_REWARDS_RESPONSE
} }
public class LfgPlayerDungeonInfo public class LfgPlayerDungeonInfo
@@ -659,7 +659,7 @@ namespace Game.Networking.Packets
slot.Write(data); slot.Write(data);
} }
public Optional<ObjectGuid> PlayerGuid; public ObjectGuid? PlayerGuid;
public List<LFGBlackListSlot> Slot = new(); public List<LFGBlackListSlot> Slot = new();
} }
@@ -669,34 +669,37 @@ namespace Game.Networking.Packets
{ {
Quantity = quantity; Quantity = quantity;
BonusQuantity = bonusQuantity; BonusQuantity = bonusQuantity;
RewardItem = new Optional<ItemInstance>(); RewardItem = null;
RewardCurrency = new Optional<uint>(); RewardCurrency = null;
if (!isCurrency) if (!isCurrency)
{ {
RewardItem.Value = new(); RewardItem = new();
RewardItem.Value.ItemID = id; RewardItem.ItemID = id;
} }
else else
{ {
RewardCurrency.Set(id); RewardCurrency = id;
} }
} }
public void Write(WorldPacket data) public void Write(WorldPacket data)
{ {
data.WriteBit(RewardItem.HasValue); data.WriteBit(RewardItem != null);
data.WriteBit(RewardCurrency.HasValue); data.WriteBit(RewardCurrency.HasValue);
if (RewardItem.HasValue)
RewardItem.Value.Write(data); if (RewardItem != null)
RewardItem.Write(data);
data.WriteUInt32(Quantity); data.WriteUInt32(Quantity);
data.WriteInt32(BonusQuantity); data.WriteInt32(BonusQuantity);
if (RewardCurrency.HasValue) if (RewardCurrency.HasValue)
data.WriteUInt32(RewardCurrency.Value); data.WriteUInt32(RewardCurrency.Value);
} }
public Optional<ItemInstance> RewardItem; public ItemInstance RewardItem;
public Optional<uint> RewardCurrency; public uint? RewardCurrency;
public uint Quantity; public uint Quantity;
public int BonusQuantity; public int BonusQuantity;
} }
@@ -247,8 +247,8 @@ namespace Game.Networking.Packets
public ObjectGuid Owner; public ObjectGuid Owner;
public ObjectGuid LootObj; public ObjectGuid LootObj;
public Optional<ObjectGuid> Master; public ObjectGuid? Master;
public Optional<ObjectGuid> RoundRobinWinner; public ObjectGuid? RoundRobinWinner;
} }
class SetLootSpecialization : ClientPacket class SetLootSpecialization : ClientPacket
@@ -384,13 +384,13 @@ namespace Game.Networking.Packets
switch (mail.messageType) switch (mail.messageType)
{ {
case MailMessageType.Normal: case MailMessageType.Normal:
SenderCharacter.Set(ObjectGuid.Create(HighGuid.Player, mail.sender)); SenderCharacter = ObjectGuid.Create(HighGuid.Player, mail.sender);
break; break;
case MailMessageType.Creature: case MailMessageType.Creature:
case MailMessageType.Gameobject: case MailMessageType.Gameobject:
case MailMessageType.Auction: case MailMessageType.Auction:
case MailMessageType.Calendar: case MailMessageType.Calendar:
AltSenderID.Set((uint)mail.sender); AltSenderID = (uint)mail.sender;
break; break;
} }
@@ -443,8 +443,8 @@ namespace Game.Networking.Packets
public int MailID; public int MailID;
public byte SenderType; public byte SenderType;
public Optional<ObjectGuid> SenderCharacter; public ObjectGuid? SenderCharacter;
public Optional<uint> AltSenderID; public uint? AltSenderID;
public ulong Cod; public ulong Cod;
public int StationeryID; public int StationeryID;
public ulong SentMoney; public ulong SentMoney;
+23 -23
View File
@@ -156,13 +156,13 @@ namespace Game.Networking.Packets
public uint Type; public uint Type;
public int Quantity; public int Quantity;
public uint Flags; public uint Flags;
public Optional<int> WeeklyQuantity; public int? WeeklyQuantity;
public Optional<int> TrackedQuantity; public int? TrackedQuantity;
public Optional<int> MaxQuantity; public int? MaxQuantity;
public Optional<int> Unused901; public int? Unused901;
public Optional<int> QuantityChange; public int? QuantityChange;
public Optional<int> QuantityGainSource; public int? QuantityGainSource;
public Optional<int> QuantityLostSource; public int? QuantityLostSource;
public bool SuppressChatLog; public bool SuppressChatLog;
} }
@@ -232,11 +232,11 @@ namespace Game.Networking.Packets
{ {
public uint Type; public uint Type;
public uint Quantity; public uint Quantity;
public Optional<uint> WeeklyQuantity; // Currency count obtained this Week. public uint? WeeklyQuantity; // Currency count obtained this Week.
public Optional<uint> MaxWeeklyQuantity; // Weekly Currency cap. public uint? MaxWeeklyQuantity; // Weekly Currency cap.
public Optional<uint> TrackedQuantity; public uint? TrackedQuantity;
public Optional<int> MaxQuantity; public int? MaxQuantity;
public Optional<int> Unused901; public int? Unused901;
public byte Flags; // 0 = none, public byte Flags; // 0 = none,
} }
} }
@@ -358,10 +358,10 @@ namespace Game.Networking.Packets
{ {
public WorldServerInfo() : base(ServerOpcodes.WorldServerInfo, ConnectionType.Instance) public WorldServerInfo() : base(ServerOpcodes.WorldServerInfo, ConnectionType.Instance)
{ {
InstanceGroupSize = new Optional<uint>(); InstanceGroupSize = new uint?();
RestrictedAccountMaxLevel = new Optional<uint>(); RestrictedAccountMaxLevel = new uint?();
RestrictedAccountMaxMoney = new Optional<ulong>(); RestrictedAccountMaxMoney = new ulong?();
} }
public override void Write() public override void Write()
@@ -390,9 +390,9 @@ namespace Game.Networking.Packets
public bool XRealmPvpAlert; public bool XRealmPvpAlert;
public bool BlockExitingLoadingScreen; // when set to true, sending SMSG_UPDATE_OBJECT with CreateObject Self bit = true will not hide loading screen public bool BlockExitingLoadingScreen; // when set to true, sending SMSG_UPDATE_OBJECT with CreateObject Self bit = true will not hide loading screen
// instead it will be done after this packet is sent again with false in this bit and SMSG_UPDATE_OBJECT Values for player // instead it will be done after this packet is sent again with false in this bit and SMSG_UPDATE_OBJECT Values for player
public Optional<uint> RestrictedAccountMaxLevel; public uint? RestrictedAccountMaxLevel;
public Optional<ulong> RestrictedAccountMaxMoney; public ulong? RestrictedAccountMaxMoney;
public Optional<uint> InstanceGroupSize; public uint? InstanceGroupSize;
} }
public class SetDungeonDifficulty : ClientPacket public class SetDungeonDifficulty : ClientPacket
@@ -1306,12 +1306,12 @@ namespace Game.Networking.Packets
public DisplayGameError(GameError error, int arg) : this(error) public DisplayGameError(GameError error, int arg) : this(error)
{ {
Arg.Set(arg); Arg = arg;
} }
public DisplayGameError(GameError error, int arg1, int arg2) : this(error) public DisplayGameError(GameError error, int arg1, int arg2) : this(error)
{ {
Arg.Set(arg1); Arg = arg1;
Arg2.Set(arg2); Arg2 = arg2;
} }
public override void Write() public override void Write()
@@ -1329,8 +1329,8 @@ namespace Game.Networking.Packets
} }
GameError Error; GameError Error;
Optional<int> Arg; int? Arg;
Optional<int> Arg2; int? Arg2;
} }
class AccountMountUpdate : ServerPacket class AccountMountUpdate : ServerPacket
@@ -207,9 +207,9 @@ namespace Game.Networking.Packets
bool hasFadeObjectTime = data.WriteBit(moveSpline.splineflags.HasFlag(SplineFlag.FadeObject) && moveSpline.effect_start_time < moveSpline.Duration()); bool hasFadeObjectTime = data.WriteBit(moveSpline.splineflags.HasFlag(SplineFlag.FadeObject) && moveSpline.effect_start_time < moveSpline.Duration());
data.WriteBits(moveSpline.GetPath().Length, 16); data.WriteBits(moveSpline.GetPath().Length, 16);
data.WriteBit(false); // HasSplineFilter data.WriteBit(false); // HasSplineFilter
data.WriteBit(moveSpline.spell_effect_extra.HasValue); // HasSpellEffectExtraData data.WriteBit(moveSpline.spell_effect_extra != null); // HasSpellEffectExtraData
bool hasJumpExtraData = data.WriteBit(moveSpline.splineflags.HasFlag(SplineFlag.Parabolic) && (!moveSpline.spell_effect_extra.HasValue || moveSpline.effect_start_time != 0)); bool hasJumpExtraData = data.WriteBit(moveSpline.splineflags.HasFlag(SplineFlag.Parabolic) && (moveSpline.spell_effect_extra == null || moveSpline.effect_start_time != 0));
data.WriteBit(moveSpline.anim_tier.HasValue); // HasAnimationTierTransition data.WriteBit(moveSpline.anim_tier != null); // HasAnimationTierTransition
data.WriteBit(false); // HasUnknown901 data.WriteBit(false); // HasUnknown901
data.FlushBits(); data.FlushBits();
@@ -245,12 +245,12 @@ namespace Game.Networking.Packets
foreach (var vec in moveSpline.GetPath()) foreach (var vec in moveSpline.GetPath())
data.WriteVector3(vec); data.WriteVector3(vec);
if (moveSpline.spell_effect_extra.HasValue) if (moveSpline.spell_effect_extra != null)
{ {
data.WritePackedGuid(moveSpline.spell_effect_extra.Value.Target); data.WritePackedGuid(moveSpline.spell_effect_extra.Target);
data.WriteUInt32(moveSpline.spell_effect_extra.Value.SpellVisualId); data.WriteUInt32(moveSpline.spell_effect_extra.SpellVisualId);
data.WriteUInt32(moveSpline.spell_effect_extra.Value.ProgressCurveId); data.WriteUInt32(moveSpline.spell_effect_extra.ProgressCurveId);
data.WriteUInt32(moveSpline.spell_effect_extra.Value.ParabolicCurveId); data.WriteUInt32(moveSpline.spell_effect_extra.ParabolicCurveId);
} }
if (hasJumpExtraData) if (hasJumpExtraData)
@@ -260,12 +260,12 @@ namespace Game.Networking.Packets
data.WriteUInt32(0); // Duration (override) data.WriteUInt32(0); // Duration (override)
} }
if (moveSpline.anim_tier.HasValue) if (moveSpline.anim_tier != null)
{ {
data.WriteUInt32(moveSpline.anim_tier.Value.TierTransitionId); data.WriteUInt32(moveSpline.anim_tier.TierTransitionId);
data.WriteInt32(moveSpline.effect_start_time); data.WriteInt32(moveSpline.effect_start_time);
data.WriteUInt32(0); data.WriteUInt32(0);
data.WriteUInt8(moveSpline.anim_tier.Value.AnimTier); data.WriteUInt8(moveSpline.anim_tier.AnimTier);
} }
//if (HasUnknown901) //if (HasUnknown901)
@@ -377,32 +377,35 @@ namespace Game.Networking.Packets
if (splineFlags.HasFlag(SplineFlag.Animation)) if (splineFlags.HasFlag(SplineFlag.Animation))
{ {
movementSpline.AnimTierTransition.Value = new(); MonsterSplineAnimTierTransition animTierTransition = new();
movementSpline.AnimTierTransition.Value.TierTransitionID = (int)moveSpline.anim_tier.Value.TierTransitionId; animTierTransition.TierTransitionID = (int)moveSpline.anim_tier.TierTransitionId;
movementSpline.AnimTierTransition.Value.StartTime = (uint)moveSpline.effect_start_time; animTierTransition.StartTime = (uint)moveSpline.effect_start_time;
movementSpline.AnimTierTransition.Value.AnimTier = moveSpline.anim_tier.Value.AnimTier; animTierTransition.AnimTier = moveSpline.anim_tier.AnimTier;
movementSpline.AnimTierTransition = animTierTransition;
} }
movementSpline.MoveTime = (uint)moveSpline.Duration(); movementSpline.MoveTime = (uint)moveSpline.Duration();
if (splineFlags.HasFlag(SplineFlag.Parabolic) && (!moveSpline.spell_effect_extra.HasValue || moveSpline.effect_start_time != 0)) if (splineFlags.HasFlag(SplineFlag.Parabolic) && (moveSpline.spell_effect_extra == null || moveSpline.effect_start_time != 0))
{ {
movementSpline.JumpExtraData.Value = new(); MonsterSplineJumpExtraData jumpExtraData = new();
movementSpline.JumpExtraData.Value.JumpGravity = moveSpline.vertical_acceleration; jumpExtraData.JumpGravity = moveSpline.vertical_acceleration;
movementSpline.JumpExtraData.Value.StartTime = (uint)moveSpline.effect_start_time; jumpExtraData.StartTime = (uint)moveSpline.effect_start_time;
movementSpline.JumpExtraData = jumpExtraData;
} }
if (splineFlags.HasFlag(SplineFlag.FadeObject)) if (splineFlags.HasFlag(SplineFlag.FadeObject))
movementSpline.FadeObjectTime = (uint)moveSpline.effect_start_time; movementSpline.FadeObjectTime = (uint)moveSpline.effect_start_time;
if (moveSpline.spell_effect_extra.HasValue) if (moveSpline.spell_effect_extra != null)
{ {
movementSpline.SpellEffectExtraData.Value = new(); MonsterSplineSpellEffectExtraData spellEffectExtraData = new();
movementSpline.SpellEffectExtraData.Value.TargetGuid = moveSpline.spell_effect_extra.Value.Target; spellEffectExtraData.TargetGuid = moveSpline.spell_effect_extra.Target;
movementSpline.SpellEffectExtraData.Value.SpellVisualID = moveSpline.spell_effect_extra.Value.SpellVisualId; spellEffectExtraData.SpellVisualID = moveSpline.spell_effect_extra.SpellVisualId;
movementSpline.SpellEffectExtraData.Value.ProgressCurveID = moveSpline.spell_effect_extra.Value.ProgressCurveId; spellEffectExtraData.ProgressCurveID = moveSpline.spell_effect_extra.ProgressCurveId;
movementSpline.SpellEffectExtraData.Value.ParabolicCurveID = moveSpline.spell_effect_extra.Value.ParabolicCurveId; spellEffectExtraData.ParabolicCurveID = moveSpline.spell_effect_extra.ParabolicCurveId;
movementSpline.SpellEffectExtraData.Value.JumpGravity = moveSpline.vertical_acceleration; spellEffectExtraData.JumpGravity = moveSpline.vertical_acceleration;
movementSpline.SpellEffectExtraData = spellEffectExtraData;
} }
Spline spline = moveSpline.spline; Spline spline = moveSpline.spline;
@@ -540,11 +543,7 @@ namespace Game.Networking.Packets
public class TransferPending : ServerPacket public class TransferPending : ServerPacket
{ {
public TransferPending() : base(ServerOpcodes.TransferPending) public TransferPending() : base(ServerOpcodes.TransferPending) { }
{
Ship = new Optional<ShipTransferPending>();
TransferSpellID = new Optional<int>();
}
public override void Write() public override void Write()
{ {
@@ -566,8 +565,8 @@ namespace Game.Networking.Packets
public int MapID = -1; public int MapID = -1;
public Position OldMapPosition; public Position OldMapPosition;
public Optional<ShipTransferPending> Ship; public ShipTransferPending? Ship;
public Optional<int> TransferSpellID; public int? TransferSpellID;
public struct ShipTransferPending public struct ShipTransferPending
{ {
@@ -649,10 +648,10 @@ namespace Game.Networking.Packets
} }
public Position Pos; public Position Pos;
public Optional<VehicleTeleport> Vehicle; public VehicleTeleport? Vehicle;
public uint SequenceIndex; public uint SequenceIndex;
public ObjectGuid MoverGUID; public ObjectGuid MoverGUID;
public Optional<ObjectGuid> TransportGUID; public ObjectGuid? TransportGUID;
public float Facing; public float Facing;
public byte PreloadWorld; public byte PreloadWorld;
} }
@@ -711,15 +710,15 @@ namespace Game.Networking.Packets
public MovementInfo Status; public MovementInfo Status;
public List<MovementForce> MovementForces; public List<MovementForce> MovementForces;
public Optional<float> SwimBackSpeed; public float? SwimBackSpeed;
public Optional<float> FlightSpeed; public float? FlightSpeed;
public Optional<float> SwimSpeed; public float? SwimSpeed;
public Optional<float> WalkSpeed; public float? WalkSpeed;
public Optional<float> TurnRate; public float? TurnRate;
public Optional<float> RunSpeed; public float? RunSpeed;
public Optional<float> FlightBackSpeed; public float? FlightBackSpeed;
public Optional<float> RunBackSpeed; public float? RunBackSpeed;
public Optional<float> PitchRate; public float? PitchRate;
} }
class MoveApplyMovementForce : ServerPacket class MoveApplyMovementForce : ServerPacket
@@ -915,13 +914,13 @@ namespace Game.Networking.Packets
Ack.Read(_worldPacket); Ack.Read(_worldPacket);
if (_worldPacket.HasBit()) if (_worldPacket.HasBit())
{ {
Speeds.Value = new(); Speeds = new();
Speeds.Value.Read(_worldPacket); Speeds.Value.Read(_worldPacket);
} }
} }
public MovementAck Ack; public MovementAck Ack;
public Optional<MoveKnockBackSpeeds> Speeds; public MoveKnockBackSpeeds? Speeds;
} }
class MoveSetCollisionHeight : ServerPacket class MoveSetCollisionHeight : ServerPacket
@@ -1167,12 +1166,12 @@ namespace Game.Networking.Packets
data.WriteBit(KnockBack.HasValue); data.WriteBit(KnockBack.HasValue);
data.WriteBit(VehicleRecID.HasValue); data.WriteBit(VehicleRecID.HasValue);
data.WriteBit(CollisionHeight.HasValue); data.WriteBit(CollisionHeight.HasValue);
data.WriteBit(MovementForce_.HasValue); data.WriteBit(@MovementForce != null);
data.WriteBit(MovementForceGUID.HasValue); data.WriteBit(MovementForceGUID.HasValue);
data.FlushBits(); data.FlushBits();
if (MovementForce_.HasValue) if (@MovementForce != null)
MovementForce_.Value.Write(data); @MovementForce.Write(data);
@@ -1203,12 +1202,12 @@ namespace Game.Networking.Packets
public ServerOpcodes MessageID; public ServerOpcodes MessageID;
public uint SequenceIndex; public uint SequenceIndex;
public Optional<float> Speed; public float? Speed;
public Optional<KnockBackInfo> KnockBack; public KnockBackInfo? KnockBack;
public Optional<int> VehicleRecID; public int? VehicleRecID;
public Optional<CollisionHeightInfo> CollisionHeight; public CollisionHeightInfo? CollisionHeight;
public Optional<MovementForce> MovementForce_; public MovementForce MovementForce;
public Optional<ObjectGuid> MovementForceGUID; public ObjectGuid? MovementForceGUID;
} }
} }
@@ -1363,15 +1362,15 @@ namespace Game.Networking.Packets
data.WriteBit(VehicleExitVoluntary); data.WriteBit(VehicleExitVoluntary);
data.WriteBit(Interpolate); data.WriteBit(Interpolate);
data.WriteBits(PackedDeltas.Count, 16); data.WriteBits(PackedDeltas.Count, 16);
data.WriteBit(SplineFilter.HasValue); data.WriteBit(SplineFilter != null);
data.WriteBit(SpellEffectExtraData.HasValue); data.WriteBit(SpellEffectExtraData.HasValue);
data.WriteBit(JumpExtraData.HasValue); data.WriteBit(JumpExtraData.HasValue);
data.WriteBit(AnimTierTransition.HasValue); data.WriteBit(AnimTierTransition.HasValue);
data.WriteBit(Unknown901.HasValue); data.WriteBit(Unknown901 != null);
data.FlushBits(); data.FlushBits();
if (SplineFilter.HasValue) if (SplineFilter != null)
SplineFilter.Value.Write(data); SplineFilter.Write(data);
switch (Face) switch (Face)
{ {
@@ -1402,8 +1401,8 @@ namespace Game.Networking.Packets
if (AnimTierTransition.HasValue) if (AnimTierTransition.HasValue)
AnimTierTransition.Value.Write(data); AnimTierTransition.Value.Write(data);
if (Unknown901.HasValue) if (Unknown901 != null)
Unknown901.Value.Write(data); Unknown901.Write(data);
} }
public uint Flags; // Spline flags public uint Flags; // Spline flags
@@ -1418,11 +1417,11 @@ namespace Game.Networking.Packets
public ObjectGuid TransportGUID; public ObjectGuid TransportGUID;
public sbyte VehicleSeat = -1; public sbyte VehicleSeat = -1;
public List<Vector3> PackedDeltas = new(); public List<Vector3> PackedDeltas = new();
public Optional<MonsterSplineFilter> SplineFilter; public MonsterSplineFilter SplineFilter;
public Optional<MonsterSplineSpellEffectExtraData> SpellEffectExtraData; public MonsterSplineSpellEffectExtraData? SpellEffectExtraData;
public Optional<MonsterSplineJumpExtraData> JumpExtraData; public MonsterSplineJumpExtraData? JumpExtraData;
public Optional<MonsterSplineAnimTierTransition> AnimTierTransition; public MonsterSplineAnimTierTransition? AnimTierTransition;
public Optional<MonsterSplineUnknown901> Unknown901; public MonsterSplineUnknown901 Unknown901;
public float FaceDirection; public float FaceDirection;
public ObjectGuid FaceGUID; public ObjectGuid FaceGUID;
public Vector3 FaceSpot; public Vector3 FaceSpot;
+1 -1
View File
@@ -329,7 +329,7 @@ namespace Game.Networking.Packets
public string Text; public string Text;
public string Confirm; public string Confirm;
public TreasureLootList Treasure = new(); public TreasureLootList Treasure = new();
public Optional<int> SpellID; public int? SpellID;
} }
public class ClientGossipText public class ClientGossipText
+16 -16
View File
@@ -150,12 +150,12 @@ namespace Game.Networking.Packets
bool hasRolesDesired = _worldPacket.HasBit(); bool hasRolesDesired = _worldPacket.HasBit();
if (hasRolesDesired) if (hasRolesDesired)
RolesDesired.Set(_worldPacket.ReadUInt32()); RolesDesired = _worldPacket.ReadUInt32();
} }
public byte PartyIndex; public byte PartyIndex;
public bool Accept; public bool Accept;
public Optional<uint> RolesDesired; public uint? RolesDesired;
} }
class PartyUninvite : ClientPacket class PartyUninvite : ClientPacket
@@ -319,14 +319,14 @@ namespace Game.Networking.Packets
{ {
Pet pet = player.GetPet(); Pet pet = player.GetPet();
MemberStats.PetStats.Value = new(); MemberStats.PetStats = new();
MemberStats.PetStats.Value.GUID = pet.GetGUID(); MemberStats.PetStats.GUID = pet.GetGUID();
MemberStats.PetStats.Value.Name = pet.GetName(); MemberStats.PetStats.Name = pet.GetName();
MemberStats.PetStats.Value.ModelId = (short)pet.GetDisplayId(); MemberStats.PetStats.ModelId = (short)pet.GetDisplayId();
MemberStats.PetStats.Value.CurrentHealth = (int)pet.GetHealth(); MemberStats.PetStats.CurrentHealth = (int)pet.GetHealth();
MemberStats.PetStats.Value.MaxHealth = (int)pet.GetMaxHealth(); MemberStats.PetStats.MaxHealth = (int)pet.GetMaxHealth();
foreach (AuraApplication aurApp in pet.GetVisibleAuras()) foreach (AuraApplication aurApp in pet.GetVisibleAuras())
{ {
@@ -348,7 +348,7 @@ namespace Game.Networking.Packets
} }
} }
MemberStats.PetStats.Value.Auras.Add(aura); MemberStats.PetStats.Auras.Add(aura);
} }
} }
@@ -771,9 +771,9 @@ namespace Game.Networking.Packets
public List<PartyPlayerInfo> PlayerList = new(); public List<PartyPlayerInfo> PlayerList = new();
public Optional<PartyLFGInfo> LfgInfos; public PartyLFGInfo? LfgInfos;
public Optional<PartyLootSettings> LootSettings; public PartyLootSettings? LootSettings;
public Optional<PartyDifficultySettings> DifficultySettings; public PartyDifficultySettings? DifficultySettings;
} }
class SetEveryoneIsAssistant : ClientPacket class SetEveryoneIsAssistant : ClientPacket
@@ -999,13 +999,13 @@ namespace Game.Networking.Packets
foreach (PartyMemberAuraStates aura in Auras) foreach (PartyMemberAuraStates aura in Auras)
aura.Write(data); aura.Write(data);
data.WriteBit(PetStats.HasValue); data.WriteBit(PetStats != null);
data.FlushBits(); data.FlushBits();
DungeonScore.Write(data); DungeonScore.Write(data);
if (PetStats.HasValue) if (PetStats != null)
PetStats.Value.Write(data); PetStats.Write(data);
} }
public ushort Level; public ushort Level;
@@ -1027,7 +1027,7 @@ namespace Game.Networking.Packets
public PartyMemberPhaseStates Phases = new(); public PartyMemberPhaseStates Phases = new();
public List<PartyMemberAuraStates> Auras = new(); public List<PartyMemberAuraStates> Auras = new();
public Optional<PartyMemberPetStats> PetStats; public PartyMemberPetStats PetStats;
public ushort PowerDisplayID; public ushort PowerDisplayID;
public ushort SpecID; public ushort SpecID;
@@ -596,8 +596,8 @@ namespace Game.Networking.Packets
data.WriteUInt32(NativeRealmAddress.Value); data.WriteUInt32(NativeRealmAddress.Value);
} }
public Optional<uint> VirtualRealmAddress = new(); // current realm (?) (identifier made from the Index, BattleGroup and Region) public uint? VirtualRealmAddress = new(); // current realm (?) (identifier made from the Index, BattleGroup and Region)
public Optional<uint> NativeRealmAddress = new(); // original realm (?) (identifier made from the Index, BattleGroup and Region) public uint? NativeRealmAddress = new(); // original realm (?) (identifier made from the Index, BattleGroup and Region)
} }
public class PlayerGuidLookupData public class PlayerGuidLookupData
@@ -1313,9 +1313,9 @@ namespace Game.Networking.Packets
public string ButtonTooltip; public string ButtonTooltip;
public string Description; public string Description;
public string Confirmation; public string Confirmation;
public Optional<PlayerChoiceResponseReward> Reward; public PlayerChoiceResponseReward Reward;
public Optional<uint> RewardQuestID; public uint? RewardQuestID;
public Optional<PlayerChoiceResponseMawPower> MawPower; public PlayerChoiceResponseMawPower? MawPower;
public void Write(WorldPacket data) public void Write(WorldPacket data)
{ {
@@ -1337,12 +1337,12 @@ namespace Game.Networking.Packets
data.WriteBits(Confirmation.GetByteCount(), 7); data.WriteBits(Confirmation.GetByteCount(), 7);
data.WriteBit(RewardQuestID.HasValue); data.WriteBit(RewardQuestID.HasValue);
data.WriteBit(Reward.HasValue); data.WriteBit(Reward != null);
data.WriteBit(MawPower.HasValue); data.WriteBit(MawPower.HasValue);
data.FlushBits(); data.FlushBits();
if (Reward.HasValue) if (Reward != null)
Reward.Value.Write(data); Reward.Write(data);
data.WriteString(Answer); data.WriteString(Answer);
data.WriteString(Header); data.WriteString(Header);
+38 -42
View File
@@ -851,9 +851,9 @@ namespace Game.Networking.Packets
public int SpellID; public int SpellID;
public SpellCastVisual Visual; public SpellCastVisual Visual;
public Optional<SpellChannelStartInterruptImmunities> InterruptImmunities; public SpellChannelStartInterruptImmunities? InterruptImmunities;
public ObjectGuid CasterGUID; public ObjectGuid CasterGUID;
public Optional<SpellTargetedHealPrediction> HealPrediction; public SpellTargetedHealPrediction? HealPrediction;
public uint ChannelDuration; public uint ChannelDuration;
} }
@@ -1080,7 +1080,7 @@ namespace Game.Networking.Packets
_worldPacket.ResetBitPos(); _worldPacket.ResetBitPos();
if (hasStatus) if (hasStatus)
Status.Set(MovementExtensions.ReadMovementInfo(_worldPacket)); Status = MovementExtensions.ReadMovementInfo(_worldPacket);
} }
public ObjectGuid Guid; public ObjectGuid Guid;
@@ -1091,7 +1091,7 @@ namespace Game.Networking.Packets
public float Speed; public float Speed;
public Vector3 FirePos; public Vector3 FirePos;
public Vector3 ImpactPos; public Vector3 ImpactPos;
public Optional<MovementInfo> Status; public MovementInfo Status;
} }
public class SpellDelayed : ServerPacket public class SpellDelayed : ServerPacket
@@ -1434,10 +1434,10 @@ namespace Game.Networking.Packets
data.WriteBit(TimeMod.HasValue); data.WriteBit(TimeMod.HasValue);
data.WriteBits(Points.Count, 6); data.WriteBits(Points.Count, 6);
data.WriteBits(EstimatedPoints.Count, 6); data.WriteBits(EstimatedPoints.Count, 6);
data.WriteBit(ContentTuning.HasValue); data.WriteBit(ContentTuning != null);
if (ContentTuning.HasValue) if (ContentTuning != null)
ContentTuning.Value.Write(data); ContentTuning.Write(data);
if (CastUnit.HasValue) if (CastUnit.HasValue)
data.WritePackedGuid(CastUnit.Value); data.WritePackedGuid(CastUnit.Value);
@@ -1466,11 +1466,11 @@ namespace Game.Networking.Packets
public ushort CastLevel = 1; public ushort CastLevel = 1;
public byte Applications = 1; public byte Applications = 1;
public int ContentTuningID; public int ContentTuningID;
Optional<ContentTuningParams> ContentTuning; ContentTuningParams ContentTuning;
public Optional<ObjectGuid> CastUnit; public ObjectGuid? CastUnit;
public Optional<int> Duration; public int? Duration;
public Optional<int> Remaining; public int? Remaining;
Optional<float> TimeMod; float? TimeMod;
public List<float> Points = new(); public List<float> Points = new();
public List<float> EstimatedPoints = new(); public List<float> EstimatedPoints = new();
} }
@@ -1480,15 +1480,15 @@ namespace Game.Networking.Packets
public void Write(WorldPacket data) public void Write(WorldPacket data)
{ {
data .WriteUInt8(Slot); data .WriteUInt8(Slot);
data.WriteBit(AuraData.HasValue); data.WriteBit(AuraData != null);
data.FlushBits(); data.FlushBits();
if (AuraData.HasValue) if (AuraData != null)
AuraData.Value.Write(data); AuraData.Write(data);
} }
public byte Slot; public byte Slot;
public Optional<AuraDataInfo> AuraData; public AuraDataInfo AuraData;
} }
public struct TargetLocation public struct TargetLocation
@@ -1520,16 +1520,13 @@ namespace Game.Networking.Packets
{ {
Flags = (SpellCastTargetFlags)data.ReadBits<uint>(26); Flags = (SpellCastTargetFlags)data.ReadBits<uint>(26);
if (data.HasBit()) if (data.HasBit())
SrcLocation.Value = new(); SrcLocation = new();
if (data.HasBit()) if (data.HasBit())
DstLocation.Value = new(); DstLocation = new();
if (data.HasBit()) bool hasOrientation = data.HasBit();
Orientation.Value = new(); bool hasMapId = data.HasBit();
if (data.HasBit())
MapID.Value = new();
uint nameLength = data.ReadBits<uint>(7); uint nameLength = data.ReadBits<uint>(7);
@@ -1542,11 +1539,11 @@ namespace Game.Networking.Packets
if (DstLocation.HasValue) if (DstLocation.HasValue)
DstLocation.Value.Read(data); DstLocation.Value.Read(data);
if (Orientation.HasValue) if (hasOrientation)
Orientation.Value = data.ReadFloat(); Orientation = data.ReadFloat();
if (MapID.HasValue) if (hasMapId)
MapID.Value = data.ReadInt32(); MapID = data.ReadInt32();
Name = data.ReadString(nameLength); Name = data.ReadString(nameLength);
} }
@@ -1582,10 +1579,10 @@ namespace Game.Networking.Packets
public SpellCastTargetFlags Flags; public SpellCastTargetFlags Flags;
public ObjectGuid Unit; public ObjectGuid Unit;
public ObjectGuid Item; public ObjectGuid Item;
public Optional<TargetLocation> SrcLocation; public TargetLocation? SrcLocation;
public Optional<TargetLocation> DstLocation; public TargetLocation? DstLocation;
public Optional<float> Orientation; public float? Orientation;
public Optional<int> MapID; public int? MapID;
public string Name = ""; public string Name = "";
} }
@@ -1640,7 +1637,7 @@ namespace Game.Networking.Packets
public uint SendCastFlags; public uint SendCastFlags;
public SpellTargetData Target = new(); public SpellTargetData Target = new();
public MissileTrajectoryRequest MissileTrajectory; public MissileTrajectoryRequest MissileTrajectory;
public Optional<MovementInfo> MoveUpdate; public MovementInfo MoveUpdate;
public List<SpellWeight> Weight = new(); public List<SpellWeight> Weight = new();
public Array<SpellOptionalReagent> OptionalReagents = new(3); public Array<SpellOptionalReagent> OptionalReagents = new(3);
public Array<SpellExtraCurrencyCost> OptionalCurrencies = new(5 /*MAX_ITEM_EXT_COST_CURRENCIES*/); public Array<SpellExtraCurrencyCost> OptionalCurrencies = new(5 /*MAX_ITEM_EXT_COST_CURRENCIES*/);
@@ -1669,14 +1666,13 @@ namespace Game.Networking.Packets
OptionalCurrencies[i].Read(data); OptionalCurrencies[i].Read(data);
SendCastFlags = data.ReadBits<uint>(5); SendCastFlags = data.ReadBits<uint>(5);
if (data.HasBit()) bool hasMoveUpdate = data.HasBit();
MoveUpdate.Value = new();
var weightCount = data.ReadBits<uint>(2); var weightCount = data.ReadBits<uint>(2);
Target.Read(data); Target.Read(data);
if (MoveUpdate.HasValue) if (hasMoveUpdate)
MoveUpdate.Value = MovementExtensions.ReadMovementInfo(data); MoveUpdate = MovementExtensions.ReadMovementInfo(data);
for (var i = 0; i < weightCount; ++i) for (var i = 0; i < weightCount; ++i)
{ {
@@ -1834,7 +1830,7 @@ namespace Game.Networking.Packets
data.WriteBits(HitStatus.Count, 16); data.WriteBits(HitStatus.Count, 16);
data.WriteBits(MissStatus.Count, 16); data.WriteBits(MissStatus.Count, 16);
data.WriteBits(RemainingPower.Count, 9); data.WriteBits(RemainingPower.Count, 9);
data.WriteBit(RemainingRunes.HasValue); data.WriteBit(RemainingRunes != null);
data.WriteBits(TargetPoints.Count, 16); data.WriteBits(TargetPoints.Count, 16);
data.FlushBits(); data.FlushBits();
@@ -1855,8 +1851,8 @@ namespace Game.Networking.Packets
foreach (SpellPowerData power in RemainingPower) foreach (SpellPowerData power in RemainingPower)
power.Write(data); power.Write(data);
if (RemainingRunes.HasValue) if (RemainingRunes != null)
RemainingRunes.Value.Write(data); RemainingRunes.Write(data);
foreach (TargetLocation targetLoc in TargetPoints) foreach (TargetLocation targetLoc in TargetPoints)
targetLoc.Write(data); targetLoc.Write(data);
@@ -1877,7 +1873,7 @@ namespace Game.Networking.Packets
public List<SpellMissStatus> MissStatus = new(); public List<SpellMissStatus> MissStatus = new();
public SpellTargetData Target = new(); public SpellTargetData Target = new();
public List<SpellPowerData> RemainingPower = new(); public List<SpellPowerData> RemainingPower = new();
public Optional<RuneData> RemainingRunes; public RuneData RemainingRunes;
public MissileTrajectoryResult MissileTrajectory; public MissileTrajectoryResult MissileTrajectory;
public SpellAmmo Ammo; public SpellAmmo Ammo;
public byte DestLocSpellCastIndex; public byte DestLocSpellCastIndex;
@@ -1960,8 +1956,8 @@ namespace Game.Networking.Packets
public int CategoryRecoveryTime; public int CategoryRecoveryTime;
public float ModRate = 1.0f; public float ModRate = 1.0f;
public bool OnHold; public bool OnHold;
Optional<uint> unused622_1; // This field is not used for anything in the client in 6.2.2.20444 uint? unused622_1; // This field is not used for anything in the client in 6.2.2.20444
Optional<uint> unused622_2; // This field is not used for anything in the client in 6.2.2.20444 uint? unused622_2; // This field is not used for anything in the client in 6.2.2.20444
} }
public class SpellChargeEntry public class SpellChargeEntry
@@ -25,11 +25,7 @@ namespace Game.Networking.Packets
{ {
public class FeatureSystemStatus : ServerPacket public class FeatureSystemStatus : ServerPacket
{ {
public FeatureSystemStatus() : base(ServerOpcodes.FeatureSystemStatus) public FeatureSystemStatus() : base(ServerOpcodes.FeatureSystemStatus) { }
{
SessionAlert = new Optional<SessionAlertConfig>();
EuropaTicketSystemStatus = new Optional<EuropaTicketConfig>();
}
public override void Write() public override void Write()
{ {
@@ -140,10 +136,10 @@ namespace Game.Networking.Packets
public bool BrowserEnabled; public bool BrowserEnabled;
public bool BpayStoreAvailable; public bool BpayStoreAvailable;
public bool BpayStoreEnabled; public bool BpayStoreEnabled;
public Optional<SessionAlertConfig> SessionAlert; public SessionAlertConfig? SessionAlert;
public uint ScrollOfResurrectionMaxRequestsPerDay; public uint ScrollOfResurrectionMaxRequestsPerDay;
public bool ScrollOfResurrectionEnabled; public bool ScrollOfResurrectionEnabled;
public Optional<EuropaTicketConfig> EuropaTicketSystemStatus; public EuropaTicketConfig? EuropaTicketSystemStatus;
public uint ScrollOfResurrectionRequestsRemaining; public uint ScrollOfResurrectionRequestsRemaining;
public uint CfgRealmID; public uint CfgRealmID;
public byte ComplaintStatus; public byte ComplaintStatus;
@@ -303,7 +299,7 @@ namespace Game.Networking.Packets
public bool LiveRegionAccountCopyEnabled; // NYI public bool LiveRegionAccountCopyEnabled; // NYI
public bool LiveRegionKeyBindingsCopyEnabled = false; public bool LiveRegionKeyBindingsCopyEnabled = false;
public bool Unknown901CheckoutRelated = false; // NYI public bool Unknown901CheckoutRelated = false; // NYI
public Optional<EuropaTicketConfig> EuropaTicketSystemStatus; public EuropaTicketConfig? EuropaTicketSystemStatus;
public List<int> LiveRegionCharacterCopySourceRegions = new(); public List<int> LiveRegionCharacterCopySourceRegions = new();
public uint TokenPollTimeSeconds; // NYI public uint TokenPollTimeSeconds; // NYI
public long TokenBalanceAmount; // NYI public long TokenBalanceAmount; // NYI
@@ -73,7 +73,7 @@ namespace Game.Networking.Packets
_worldPacket.WriteUInt8(node); _worldPacket.WriteUInt8(node);
} }
public Optional<ShowTaxiNodesWindowInfo> WindowInfo; public ShowTaxiNodesWindowInfo? WindowInfo;
public byte[] CanLandNodes = null; // Nodes known by player public byte[] CanLandNodes = null; // Nodes known by player
public byte[] CanUseNodes = null; // Nodes available for use - this can temporarily disable a known node public byte[] CanUseNodes = null; // Nodes available for use - this can temporarily disable a known node
} }
+36 -44
View File
@@ -147,8 +147,9 @@ namespace Game.Networking.Packets
if (hasClubMessage) if (hasClubMessage)
{ {
CommunityMessage.Value = new(); SupportTicketCommunityMessage communityMessage = new();
CommunityMessage.Value.IsPlayerUsingVoice = _worldPacket.HasBit(); communityMessage.IsPlayerUsingVoice = _worldPacket.HasBit();
CommunityMessage = communityMessage;
_worldPacket.ResetBitPos(); _worldPacket.ResetBitPos();
} }
@@ -158,49 +159,49 @@ namespace Game.Networking.Packets
if (hasMailInfo) if (hasMailInfo)
{ {
MailInfo.Value = new(); MailInfo = new();
MailInfo.Value.Read(_worldPacket); MailInfo.Value.Read(_worldPacket);
} }
if (hasCalendarInfo) if (hasCalendarInfo)
{ {
CalenderInfo.Value = new(); CalenderInfo = new();
CalenderInfo.Value.Read(_worldPacket); CalenderInfo.Value.Read(_worldPacket);
} }
if (hasPetInfo) if (hasPetInfo)
{ {
PetInfo.Value = new(); PetInfo = new();
PetInfo.Value.Read(_worldPacket); PetInfo.Value.Read(_worldPacket);
} }
if (hasGuildInfo) if (hasGuildInfo)
{ {
GuildInfo.Value = new(); GuildInfo = new();
GuildInfo.Value.Read(_worldPacket); GuildInfo.Value.Read(_worldPacket);
} }
if (hasLFGListSearchResult) if (hasLFGListSearchResult)
{ {
LFGListSearchResult.Value = new(); LFGListSearchResult = new();
LFGListSearchResult.Value.Read(_worldPacket); LFGListSearchResult.Value.Read(_worldPacket);
} }
if (hasLFGListApplicant) if (hasLFGListApplicant)
{ {
LFGListApplicant.Value = new(); LFGListApplicant = new();
LFGListApplicant.Value.Read(_worldPacket); LFGListApplicant.Value.Read(_worldPacket);
} }
if (hasClubFinderResult) if (hasClubFinderResult)
{ {
ClubFinderResult.Value = new(); ClubFinderResult = new();
ClubFinderResult.Value.Read(_worldPacket); ClubFinderResult.Value.Read(_worldPacket);
} }
if (hasUnk910) if (hasUnk910)
{ {
Unused910.Value = new(); Unused910 = new();
Unused910.Value.Read(_worldPacket); Unused910.Value.Read(_worldPacket);
} }
} }
@@ -211,15 +212,15 @@ namespace Game.Networking.Packets
public byte ComplaintType; public byte ComplaintType;
public string Note; public string Note;
public SupportTicketHorusChatLog HorusChatLog; public SupportTicketHorusChatLog HorusChatLog;
public Optional<SupportTicketMailInfo> MailInfo; public SupportTicketMailInfo? MailInfo;
public Optional<SupportTicketCalendarEventInfo> CalenderInfo; public SupportTicketCalendarEventInfo? CalenderInfo;
public Optional<SupportTicketPetInfo> PetInfo; public SupportTicketPetInfo? PetInfo;
public Optional<SupportTicketGuildInfo> GuildInfo; public SupportTicketGuildInfo? GuildInfo;
public Optional<SupportTicketLFGListSearchResult> LFGListSearchResult; public SupportTicketLFGListSearchResult? LFGListSearchResult;
public Optional<SupportTicketLFGListApplicant> LFGListApplicant; public SupportTicketLFGListApplicant? LFGListApplicant;
public Optional<SupportTicketCommunityMessage> CommunityMessage; public SupportTicketCommunityMessage? CommunityMessage;
public Optional<SupportTicketClubFinderResult> ClubFinderResult; public SupportTicketClubFinderResult? ClubFinderResult;
public Optional<SupportTicketUnused910> Unused910; public SupportTicketUnused910? Unused910;
public struct SupportTicketChatLine public struct SupportTicketChatLine
{ {
@@ -250,20 +251,19 @@ namespace Game.Networking.Packets
public void Read(WorldPacket data) public void Read(WorldPacket data)
{ {
uint linesCount = data.ReadUInt32(); uint linesCount = data.ReadUInt32();
if (data.HasBit()) bool hasReportLineIndex = data.HasBit();
ReportLineIndex.Value = new();
data.ResetBitPos(); data.ResetBitPos();
for (uint i = 0; i < linesCount; i++) for (uint i = 0; i < linesCount; i++)
Lines.Add(new SupportTicketChatLine(data)); Lines.Add(new SupportTicketChatLine(data));
if (ReportLineIndex.HasValue) if (hasReportLineIndex)
ReportLineIndex.Value = data.ReadUInt32(); ReportLineIndex = data.ReadUInt32();
} }
public List<SupportTicketChatLine> Lines = new(); public List<SupportTicketChatLine> Lines = new();
public Optional<uint> ReportLineIndex; public uint? ReportLineIndex;
} }
public struct SupportTicketHorusChatLine public struct SupportTicketHorusChatLine
@@ -280,30 +280,22 @@ namespace Game.Networking.Packets
uint textLength = data.ReadBits<uint>(12); uint textLength = data.ReadBits<uint>(12);
if (hasClubID) if (hasClubID)
{ ClubID = data.ReadUInt64();
ClubID.Value = new();
ClubID.Value = data.ReadUInt64();
}
if (hasChannelGUID) if (hasChannelGUID)
{ ChannelGUID = data.ReadPackedGuid();
ChannelGUID.Value = new();
ChannelGUID.Value = data.ReadPackedGuid();
}
if (hasRealmAddress) if (hasRealmAddress)
{ {
RealmAddress.Value = new(); SenderRealm senderRealm = new();
RealmAddress.Value.VirtualRealmAddress = data.ReadUInt32(); senderRealm.VirtualRealmAddress = data.ReadUInt32();
RealmAddress.Value.field_4 = data.ReadUInt16(); senderRealm.field_4 = data.ReadUInt16();
RealmAddress.Value.field_6 = data.ReadUInt8(); senderRealm.field_6 = data.ReadUInt8();
RealmAddress = senderRealm;
} }
if (hasSlashCmd) if (hasSlashCmd)
{ SlashCmd = data.ReadInt32();
SlashCmd.Value = new();
SlashCmd.Value = data.ReadInt32();
}
Text = data.ReadString(textLength); Text = data.ReadString(textLength);
} }
@@ -317,10 +309,10 @@ namespace Game.Networking.Packets
public long Timestamp; public long Timestamp;
public ObjectGuid AuthorGUID; public ObjectGuid AuthorGUID;
public Optional<ulong> ClubID; public ulong? ClubID;
public Optional<ObjectGuid> ChannelGUID; public ObjectGuid? ChannelGUID;
public Optional<SenderRealm> RealmAddress; public SenderRealm? RealmAddress;
public Optional<int> SlashCmd; public int? SlashCmd;
public string Text; public string Text;
} }
@@ -241,18 +241,18 @@ namespace Game.Networking.Packets
data.WriteInt32(StackCount); data.WriteInt32(StackCount);
data.WritePackedGuid(GiftCreator); data.WritePackedGuid(GiftCreator);
Item.Write(data); Item.Write(data);
data.WriteBit(Unwrapped.HasValue); data.WriteBit(Unwrapped != null);
data.FlushBits(); data.FlushBits();
if (Unwrapped.HasValue) if (Unwrapped != null)
Unwrapped.Value.Write(data); Unwrapped.Write(data);
} }
public byte Slot; public byte Slot;
public ItemInstance Item = new(); public ItemInstance Item = new();
public int StackCount; public int StackCount;
public ObjectGuid GiftCreator; public ObjectGuid GiftCreator;
public Optional<UnwrappedTradeItem> Unwrapped; public UnwrappedTradeItem Unwrapped;
} }
public ulong Gold; public ulong Gold;
+2 -2
View File
@@ -118,7 +118,7 @@ namespace Game.Networking.Packets
ShowArenaPlayers = data.HasBit(); ShowArenaPlayers = data.HasBit();
ExactName = data.HasBit(); ExactName = data.HasBit();
if (data.HasBit()) if (data.HasBit())
ServerInfo.Value = new(); ServerInfo = new();
data.ResetBitPos(); data.ResetBitPos();
@@ -149,7 +149,7 @@ namespace Game.Networking.Packets
public bool ShowEnemies; public bool ShowEnemies;
public bool ShowArenaPlayers; public bool ShowArenaPlayers;
public bool ExactName; public bool ExactName;
public Optional<WhoRequestServerInfo> ServerInfo; public WhoRequestServerInfo? ServerInfo;
} }
public class WhoEntry public class WhoEntry
+2 -2
View File
@@ -775,8 +775,8 @@ namespace Game.Networking
public void SendAuthResponseError(BattlenetRpcErrorCode code) public void SendAuthResponseError(BattlenetRpcErrorCode code)
{ {
AuthResponse response = new(); AuthResponse response = new();
response.SuccessInfo.Clear(); response.SuccessInfo = null;
response.WaitInfo.Clear(); response.WaitInfo = null;
response.Result = code; response.Result = code;
SendPacket(response); SendPacket(response);
} }
+5 -5
View File
@@ -30,7 +30,7 @@ namespace Game
public List<WorldObject> Objects = new(); public List<WorldObject> Objects = new();
public List<ushort> Grids = new(); public List<ushort> Grids = new();
public Optional<TimeSpan> DurationRemaining; public TimeSpan? DurationRemaining;
public bool IsEmpty() { return Objects.Empty() && Grids.Empty(); } public bool IsEmpty() { return Objects.Empty() && Grids.Empty(); }
} }
@@ -57,21 +57,21 @@ namespace Game
// Loop over all our tracked phases. If any don't exist - delete them // Loop over all our tracked phases. If any don't exist - delete them
foreach (var (phaseId, spawns) in _spawns) foreach (var (phaseId, spawns) in _spawns)
if (!spawns.DurationRemaining.HasValue && !phaseShift.HasPhase(phaseId)) if (!spawns.DurationRemaining.HasValue && !phaseShift.HasPhase(phaseId))
spawns.DurationRemaining.Set(PersonalPhaseSpawns.DELETE_TIME_DEFAULT); spawns.DurationRemaining = PersonalPhaseSpawns.DELETE_TIME_DEFAULT;
// loop over all owner phases. If any exist and marked for deletion - reset delete // loop over all owner phases. If any exist and marked for deletion - reset delete
foreach (var phaseRef in phaseShift.GetPhases()) foreach (var phaseRef in phaseShift.GetPhases())
{ {
PersonalPhaseSpawns spawns = _spawns.LookupByKey(phaseRef.Key); PersonalPhaseSpawns spawns = _spawns.LookupByKey(phaseRef.Key);
if (spawns != null) if (spawns != null)
spawns.DurationRemaining.Clear(); spawns.DurationRemaining = null;
} }
} }
public void MarkAllPhasesForDeletion() public void MarkAllPhasesForDeletion()
{ {
foreach (var spawns in _spawns.Values) foreach (var spawns in _spawns.Values)
spawns.DurationRemaining.Set(PersonalPhaseSpawns.DELETE_TIME_DEFAULT); spawns.DurationRemaining = PersonalPhaseSpawns.DELETE_TIME_DEFAULT;
} }
public void Update(Map map, uint diff) public void Update(Map map, uint diff)
@@ -80,7 +80,7 @@ namespace Game
{ {
if (itr.Value.DurationRemaining.HasValue) if (itr.Value.DurationRemaining.HasValue)
{ {
itr.Value.DurationRemaining.Value = itr.Value.DurationRemaining.Value - TimeSpan.FromMilliseconds(diff); itr.Value.DurationRemaining = itr.Value.DurationRemaining.Value - TimeSpan.FromMilliseconds(diff);
if (itr.Value.DurationRemaining.Value <= TimeSpan.Zero) if (itr.Value.DurationRemaining.Value <= TimeSpan.Zero)
{ {
DespawnPhase(map, itr.Value); DespawnPhase(map, itr.Value);
+5 -5
View File
@@ -237,11 +237,11 @@ namespace Game.Spells
if (remove) if (remove)
return; return;
auraInfo.AuraData.Value = new(); auraInfo.AuraData = new();
Aura aura = GetBase(); Aura aura = GetBase();
AuraDataInfo auraData = auraInfo.AuraData.Value; AuraDataInfo auraData = auraInfo.AuraData;
auraData.CastID = aura.GetCastId(); auraData.CastID = aura.GetCastId();
auraData.SpellID = (int)aura.GetId(); auraData.SpellID = (int)aura.GetId();
auraData.Visual = aura.GetSpellVisual(); auraData.Visual = aura.GetSpellVisual();
@@ -261,12 +261,12 @@ namespace Game.Spells
if (!aura.GetCasterGUID().IsUnit()) if (!aura.GetCasterGUID().IsUnit())
auraData.CastUnit = ObjectGuid.Empty; // optional data is filled in, but cast unit contains empty guid in packet auraData.CastUnit = ObjectGuid.Empty; // optional data is filled in, but cast unit contains empty guid in packet
else if (!auraData.Flags.HasFlag(AuraFlags.NoCaster)) else if (!auraData.Flags.HasFlag(AuraFlags.NoCaster))
auraData.CastUnit.Set(aura.GetCasterGUID()); auraData.CastUnit = aura.GetCasterGUID();
if (auraData.Flags.HasFlag(AuraFlags.Duration)) if (auraData.Flags.HasFlag(AuraFlags.Duration))
{ {
auraData.Duration.Set(aura.GetMaxDuration()); auraData.Duration = aura.GetMaxDuration();
auraData.Remaining.Set(aura.GetDuration()); auraData.Remaining = aura.GetDuration();
} }
if (auraData.Flags.HasFlag(AuraFlags.Scalable)) if (auraData.Flags.HasFlag(AuraFlags.Scalable))
+11 -9
View File
@@ -3666,9 +3666,9 @@ namespace Game.Spells
if (castFlags.HasAnyFlag(SpellCastFlags.RuneList)) // rune cooldowns list if (castFlags.HasAnyFlag(SpellCastFlags.RuneList)) // rune cooldowns list
{ {
castData.RemainingRunes.Value = new(); castData.RemainingRunes = new();
RuneData runeData = castData.RemainingRunes.Value; RuneData runeData = castData.RemainingRunes;
//TODO: There is a crash caused by a spell with CAST_FLAG_RUNE_LIST casted by a creature //TODO: There is a crash caused by a spell with CAST_FLAG_RUNE_LIST casted by a creature
//The creature is the mover of a player, so HandleCastSpellOpcode uses it as the caster //The creature is the mover of a player, so HandleCastSpellOpcode uses it as the caster
@@ -3781,8 +3781,8 @@ namespace Game.Spells
if (Convert.ToBoolean(castFlags & SpellCastFlags.RuneList)) // rune cooldowns list if (Convert.ToBoolean(castFlags & SpellCastFlags.RuneList)) // rune cooldowns list
{ {
castData.RemainingRunes.Value = new(); castData.RemainingRunes = new();
RuneData runeData = castData.RemainingRunes.Value; RuneData runeData = castData.RemainingRunes;
Player player = m_caster.ToPlayer(); Player player = m_caster.ToPlayer();
runeData.Start = m_runesState; // runes state before runeData.Start = m_runesState; // runes state before
@@ -4095,9 +4095,11 @@ namespace Game.Spells
if (schoolImmunityMask != 0 || mechanicImmunityMask != 0) if (schoolImmunityMask != 0 || mechanicImmunityMask != 0)
{ {
spellChannelStart.InterruptImmunities.Value = new(); SpellChannelStartInterruptImmunities interruptImmunities = new();
spellChannelStart.InterruptImmunities.Value.SchoolImmunities = (int)schoolImmunityMask; interruptImmunities.SchoolImmunities = (int)schoolImmunityMask;
spellChannelStart.InterruptImmunities.Value.Immunities = (int)mechanicImmunityMask; interruptImmunities.Immunities = (int)mechanicImmunityMask;
spellChannelStart.InterruptImmunities = interruptImmunities;
} }
unitCaster.SendMessageToSet(spellChannelStart, true); unitCaster.SendMessageToSet(spellChannelStart, true);
@@ -7177,7 +7179,7 @@ namespace Game.Spells
m_spellValue.DurationMul = (float)value / 100.0f; m_spellValue.DurationMul = (float)value / 100.0f;
break; break;
case SpellValueMod.Duration: case SpellValueMod.Duration:
m_spellValue.Duration.Set(value); m_spellValue.Duration = value;
break; break;
} }
} }
@@ -8439,7 +8441,7 @@ namespace Game.Spells
public int AuraStackAmount; public int AuraStackAmount;
public float DurationMul; public float DurationMul;
public float CriticalChance; public float CriticalChance;
public Optional<int> Duration; public int? Duration;
} }
// Spell modifier (used for modify other spells) // Spell modifier (used for modify other spells)
+2 -4
View File
@@ -88,7 +88,6 @@ namespace Game.Spells
if (m_targetMask.HasAnyFlag(SpellCastTargetFlags.SourceLocation)) if (m_targetMask.HasAnyFlag(SpellCastTargetFlags.SourceLocation))
{ {
data.SrcLocation.Value = new();
TargetLocation target = new(); TargetLocation target = new();
target.Transport = m_src.TransportGUID; // relative position guid here - transport for example target.Transport = m_src.TransportGUID; // relative position guid here - transport for example
if (!m_src.TransportGUID.IsEmpty()) if (!m_src.TransportGUID.IsEmpty())
@@ -96,12 +95,11 @@ namespace Game.Spells
else else
target.Location = m_src.Position; target.Location = m_src.Position;
data.SrcLocation.Value = target; data.SrcLocation = target;
} }
if (Convert.ToBoolean(m_targetMask & SpellCastTargetFlags.DestLocation)) if (Convert.ToBoolean(m_targetMask & SpellCastTargetFlags.DestLocation))
{ {
data.DstLocation.Value = new();
TargetLocation target = new(); TargetLocation target = new();
target.Transport = m_dst.TransportGUID; // relative position guid here - transport for example target.Transport = m_dst.TransportGUID; // relative position guid here - transport for example
if (!m_dst.TransportGUID.IsEmpty()) if (!m_dst.TransportGUID.IsEmpty())
@@ -109,7 +107,7 @@ namespace Game.Spells
else else
target.Location = m_dst.Position; target.Location = m_dst.Position;
data.DstLocation.Value = target; data.DstLocation = target;
} }
if (Convert.ToBoolean(m_targetMask & SpellCastTargetFlags.String)) if (Convert.ToBoolean(m_targetMask & SpellCastTargetFlags.String))
+9 -9
View File
@@ -5587,28 +5587,28 @@ namespace Game.Spells
if (jumpParams.TreatSpeedAsMoveTimeSeconds) if (jumpParams.TreatSpeedAsMoveTimeSeconds)
speed = unitCaster.GetExactDist(destTarget) / jumpParams.Speed; speed = unitCaster.GetExactDist(destTarget) / jumpParams.Speed;
Optional<JumpArrivalCastArgs> arrivalCast = new(); JumpArrivalCastArgs arrivalCast = null;
if (effectInfo.TriggerSpell != 0) if (effectInfo.TriggerSpell != 0)
{ {
arrivalCast.Value = new(); arrivalCast = new();
arrivalCast.Value.SpellId = effectInfo.TriggerSpell; arrivalCast.SpellId = effectInfo.TriggerSpell;
} }
Optional<SpellEffectExtraData> effectExtra = new(); SpellEffectExtraData effectExtra = null;
if (jumpParams.SpellVisualId.HasValue || jumpParams.ProgressCurveId.HasValue || jumpParams.ParabolicCurveId.HasValue) if (jumpParams.SpellVisualId.HasValue || jumpParams.ProgressCurveId.HasValue || jumpParams.ParabolicCurveId.HasValue)
{ {
effectExtra.Value = new(); effectExtra = new();
if (jumpParams.SpellVisualId.HasValue) if (jumpParams.SpellVisualId.HasValue)
effectExtra.Value.SpellVisualId = jumpParams.SpellVisualId.Value; effectExtra.SpellVisualId = jumpParams.SpellVisualId.Value;
if (jumpParams.ProgressCurveId.HasValue) if (jumpParams.ProgressCurveId.HasValue)
effectExtra.Value.ProgressCurveId = jumpParams.ProgressCurveId.Value; effectExtra.ProgressCurveId = jumpParams.ProgressCurveId.Value;
if (jumpParams.ParabolicCurveId.HasValue) if (jumpParams.ParabolicCurveId.HasValue)
effectExtra.Value.ParabolicCurveId = jumpParams.ParabolicCurveId.Value; effectExtra.ParabolicCurveId = jumpParams.ParabolicCurveId.Value;
} }
unitCaster.GetMotionMaster().MoveJumpWithGravity(destTarget, speed, jumpParams.JumpGravity, EventId.Jump, false, arrivalCast.Value, effectExtra.Value); unitCaster.GetMotionMaster().MoveJumpWithGravity(destTarget, speed, jumpParams.JumpGravity, EventId.Jump, false, arrivalCast, effectExtra);
} }
[SpellEffectHandler(SpellEffectName.LearnTransmogSet)] [SpellEffectHandler(SpellEffectName.LearnTransmogSet)]
+1 -1
View File
@@ -242,7 +242,7 @@ namespace Game.SupportSystem
_complaintType = (GMSupportComplaintType)fields.Read<byte>(++idx); _complaintType = (GMSupportComplaintType)fields.Read<byte>(++idx);
int reportLineIndex = fields.Read<int>(++idx); int reportLineIndex = fields.Read<int>(++idx);
if (reportLineIndex != -1) if (reportLineIndex != -1)
_chatLog.ReportLineIndex.Set((uint)reportLineIndex); _chatLog.ReportLineIndex = (uint)reportLineIndex;
long closedBy = fields.Read<long>(++idx); long closedBy = fields.Read<long>(++idx);
if (closedBy == 0) if (closedBy == 0)
+6 -6
View File
@@ -41,7 +41,7 @@ namespace Game.Chat
// caches // caches
public ChatPkt UntranslatedPacket; public ChatPkt UntranslatedPacket;
public Optional<ChatPkt> TranslatedPacket; public ChatPkt TranslatedPacket;
public ChatPacketSender(ChatMsg chatType, Language language, WorldObject sender, WorldObject receiver, string message, uint achievementId = 0, Locale locale = Locale.enUS) public ChatPacketSender(ChatMsg chatType, Language language, WorldObject sender, WorldObject receiver, string message, uint achievementId = 0, Locale locale = Locale.enUS)
{ {
@@ -66,14 +66,14 @@ namespace Game.Chat
return; return;
} }
if (!TranslatedPacket.HasValue) if (TranslatedPacket == null)
{ {
TranslatedPacket.Value = new(); TranslatedPacket = new();
TranslatedPacket.Value.Initialize(Type, Language, Sender, Receiver, Global.LanguageMgr.Translate(Text, (uint)Language, player.GetSession().GetSessionDbcLocale()), AchievementId, "", Locale); TranslatedPacket.Initialize(Type, Language, Sender, Receiver, Global.LanguageMgr.Translate(Text, (uint)Language, player.GetSession().GetSessionDbcLocale()), AchievementId, "", Locale);
TranslatedPacket.Value.Write(); TranslatedPacket.Write();
} }
player.SendPacket(TranslatedPacket.Value); player.SendPacket(TranslatedPacket);
} }
} }