First try at updating command system to be like TC. Still needs alot of testing/work
This commit is contained in:
@@ -51,7 +51,7 @@ namespace Game.Networking.Packets
|
||||
KnownPets[i] = _worldPacket.ReadUInt8();
|
||||
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.HasValue = true;
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint nameLength = _worldPacket.ReadBits<uint>(8);
|
||||
uint itemClassFilterCount = _worldPacket.ReadBits<uint>(3);
|
||||
@@ -79,10 +79,12 @@ namespace Game.Networking.Packets
|
||||
public override void Read()
|
||||
{
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
if (_worldPacket.HasBit())
|
||||
{
|
||||
TaintedBy.Value = new();
|
||||
TaintedBy.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,10 +102,12 @@ namespace Game.Networking.Packets
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
ItemID = _worldPacket.ReadInt32();
|
||||
Quantity = _worldPacket.ReadUInt32();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
if (_worldPacket.HasBit())
|
||||
{
|
||||
TaintedBy.Value = new();
|
||||
TaintedBy.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +137,8 @@ namespace Game.Networking.Packets
|
||||
{
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
Offset = _worldPacket.ReadUInt32();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint auctionIDCount = _worldPacket.ReadBits<uint>(7);
|
||||
uint sortCount = _worldPacket.ReadBits<uint>(2);
|
||||
@@ -161,7 +166,8 @@ namespace Game.Networking.Packets
|
||||
public override void Read()
|
||||
{
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint bucketKeysCount = _worldPacket.ReadBits<uint>(7);
|
||||
uint sortCount = _worldPacket.ReadBits<uint>(2);
|
||||
@@ -193,7 +199,8 @@ namespace Game.Networking.Packets
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
Offset = _worldPacket.ReadUInt32();
|
||||
Unknown830 = _worldPacket.ReadInt8();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint sortCount = _worldPacket.ReadBits<uint>(2);
|
||||
for (var i = 0; i < sortCount; ++i)
|
||||
@@ -225,7 +232,7 @@ namespace Game.Networking.Packets
|
||||
Offset = _worldPacket.ReadUInt32();
|
||||
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.HasValue = true;
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint sortCount = _worldPacket.ReadBits<uint>(2);
|
||||
|
||||
@@ -250,7 +257,8 @@ namespace Game.Networking.Packets
|
||||
{
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
Offset = _worldPacket.ReadUInt32();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint sortCount = _worldPacket.ReadBits<uint>(2);
|
||||
|
||||
@@ -276,10 +284,12 @@ namespace Game.Networking.Packets
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
AuctionID = _worldPacket.ReadUInt32();
|
||||
BidAmount = _worldPacket.ReadUInt64();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
if (_worldPacket.HasBit())
|
||||
{
|
||||
TaintedBy.Value = new();
|
||||
TaintedBy.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,10 +305,12 @@ namespace Game.Networking.Packets
|
||||
{
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
AuctionID = _worldPacket.ReadUInt32();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
if (_worldPacket.HasBit())
|
||||
{
|
||||
TaintedBy.Value = new();
|
||||
TaintedBy.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,10 +332,12 @@ namespace Game.Networking.Packets
|
||||
ChangeNumberCursor = _worldPacket.ReadUInt32();
|
||||
ChangeNumberTombstone = _worldPacket.ReadUInt32();
|
||||
Count = _worldPacket.ReadUInt32();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
if (_worldPacket.HasBit())
|
||||
{
|
||||
TaintedBy.Value = new();
|
||||
TaintedBy.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,7 +356,9 @@ namespace Game.Networking.Packets
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
UnitPrice = _worldPacket.ReadUInt64();
|
||||
RunTime = _worldPacket.ReadUInt32();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint itemCount = _worldPacket.ReadBits<uint>(6);
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
@@ -371,7 +387,9 @@ namespace Game.Networking.Packets
|
||||
BuyoutPrice = _worldPacket.ReadUInt64();
|
||||
RunTime = _worldPacket.ReadUInt32();
|
||||
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
if (_worldPacket.HasBit())
|
||||
TaintedBy.Value = new();
|
||||
|
||||
uint itemCount = _worldPacket.ReadBits<uint>(6);
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
@@ -410,10 +428,12 @@ namespace Game.Networking.Packets
|
||||
Auctioneer = _worldPacket.ReadPackedGuid();
|
||||
ItemID = _worldPacket.ReadInt32();
|
||||
Quantity = _worldPacket.ReadUInt32();
|
||||
TaintedBy.HasValue = _worldPacket.HasBit();
|
||||
|
||||
if (TaintedBy.HasValue)
|
||||
if (_worldPacket.HasBit())
|
||||
{
|
||||
TaintedBy.Value = new();
|
||||
TaintedBy.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,12 +739,12 @@ namespace Game.Networking.Packets
|
||||
ItemID = data.ReadBits<uint>(20);
|
||||
|
||||
if (data.HasBit())
|
||||
BattlePetSpeciesID.HasValue = true;
|
||||
BattlePetSpeciesID.Value = new();
|
||||
|
||||
ItemLevel = data.ReadBits<ushort>(11);
|
||||
|
||||
if (data.HasBit())
|
||||
SuffixItemNameDescriptionID.HasValue = true;
|
||||
SuffixItemNameDescriptionID.Value = new();
|
||||
|
||||
if (BattlePetSpeciesID.HasValue)
|
||||
BattlePetSpeciesID.Set(data.ReadUInt16());
|
||||
|
||||
@@ -855,7 +855,7 @@ namespace Game.Networking.Packets
|
||||
List<uint> bonusListIds = item.m_itemData.BonusListIDs;
|
||||
if (!bonusListIds.Empty())
|
||||
{
|
||||
ItemBonus.HasValue = true;
|
||||
ItemBonus.Value = new();
|
||||
ItemBonus.Value.BonusListIDs.AddRange(bonusListIds);
|
||||
ItemBonus.Value.Context = item.GetContext();
|
||||
}
|
||||
@@ -870,7 +870,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (!lootItem.BonusListIDs.Empty() || lootItem.randomBonusListId != 0)
|
||||
{
|
||||
ItemBonus.HasValue = true;
|
||||
ItemBonus.Value = new();
|
||||
ItemBonus.Value.BonusListIDs = lootItem.BonusListIDs;
|
||||
ItemBonus.Value.Context = lootItem.context;
|
||||
if (lootItem.randomBonusListId != 0)
|
||||
@@ -890,7 +890,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (!voidItem.BonusListIDs.Empty())
|
||||
{
|
||||
ItemBonus.HasValue = true;
|
||||
ItemBonus.Value = new();
|
||||
ItemBonus.Value.Context = voidItem.Context;
|
||||
ItemBonus.Value.BonusListIDs = voidItem.BonusListIDs;
|
||||
}
|
||||
@@ -927,7 +927,9 @@ namespace Game.Networking.Packets
|
||||
{
|
||||
ItemID = data.ReadUInt32();
|
||||
|
||||
ItemBonus.HasValue = data.HasBit();
|
||||
if (data.HasBit())
|
||||
ItemBonus.Value = new();
|
||||
|
||||
data.ResetBitPos();
|
||||
|
||||
Modifications.Read(data);
|
||||
|
||||
@@ -674,7 +674,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (!isCurrency)
|
||||
{
|
||||
RewardItem.HasValue = true;
|
||||
RewardItem.Value = new();
|
||||
RewardItem.Value.ItemID = id;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -377,7 +377,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (splineFlags.HasFlag(SplineFlag.Animation))
|
||||
{
|
||||
movementSpline.AnimTierTransition.HasValue = true;
|
||||
movementSpline.AnimTierTransition.Value = new();
|
||||
movementSpline.AnimTierTransition.Value.TierTransitionID = (int)moveSpline.anim_tier.Value.TierTransitionId;
|
||||
movementSpline.AnimTierTransition.Value.StartTime = (uint)moveSpline.effect_start_time;
|
||||
movementSpline.AnimTierTransition.Value.AnimTier = moveSpline.anim_tier.Value.AnimTier;
|
||||
@@ -387,7 +387,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (splineFlags.HasFlag(SplineFlag.Parabolic) && (!moveSpline.spell_effect_extra.HasValue || moveSpline.effect_start_time != 0))
|
||||
{
|
||||
movementSpline.JumpExtraData.HasValue = true;
|
||||
movementSpline.JumpExtraData.Value = new();
|
||||
movementSpline.JumpExtraData.Value.JumpGravity = moveSpline.vertical_acceleration;
|
||||
movementSpline.JumpExtraData.Value.StartTime = (uint)moveSpline.effect_start_time;
|
||||
}
|
||||
@@ -397,7 +397,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (moveSpline.spell_effect_extra.HasValue)
|
||||
{
|
||||
movementSpline.SpellEffectExtraData.HasValue = true;
|
||||
movementSpline.SpellEffectExtraData.Value = new();
|
||||
movementSpline.SpellEffectExtraData.Value.TargetGuid = moveSpline.spell_effect_extra.Value.Target;
|
||||
movementSpline.SpellEffectExtraData.Value.SpellVisualID = moveSpline.spell_effect_extra.Value.SpellVisualId;
|
||||
movementSpline.SpellEffectExtraData.Value.ProgressCurveID = moveSpline.spell_effect_extra.Value.ProgressCurveId;
|
||||
@@ -915,7 +915,7 @@ namespace Game.Networking.Packets
|
||||
Ack.Read(_worldPacket);
|
||||
if (_worldPacket.HasBit())
|
||||
{
|
||||
Speeds.HasValue = true;
|
||||
Speeds.Value = new();
|
||||
Speeds.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ namespace Game.Networking.Packets
|
||||
{
|
||||
Pet pet = player.GetPet();
|
||||
|
||||
MemberStats.PetStats.HasValue = true;
|
||||
MemberStats.PetStats.Value = new();
|
||||
|
||||
MemberStats.PetStats.Value.GUID = pet.GetGUID();
|
||||
MemberStats.PetStats.Value.Name = pet.GetName();
|
||||
|
||||
@@ -1519,10 +1519,18 @@ namespace Game.Networking.Packets
|
||||
public void Read(WorldPacket data)
|
||||
{
|
||||
Flags = (SpellCastTargetFlags)data.ReadBits<uint>(26);
|
||||
SrcLocation.HasValue = data.HasBit();
|
||||
DstLocation.HasValue = data.HasBit();
|
||||
Orientation.HasValue = data.HasBit();
|
||||
MapID.HasValue = data.HasBit();
|
||||
if (data.HasBit())
|
||||
SrcLocation.Value = new();
|
||||
|
||||
if (data.HasBit())
|
||||
DstLocation.Value = new();
|
||||
|
||||
if (data.HasBit())
|
||||
Orientation.Value = new();
|
||||
|
||||
if (data.HasBit())
|
||||
MapID.Value = new();
|
||||
|
||||
uint nameLength = data.ReadBits<uint>(7);
|
||||
|
||||
Unit = data.ReadPackedGuid();
|
||||
@@ -1661,7 +1669,9 @@ namespace Game.Networking.Packets
|
||||
OptionalCurrencies[i].Read(data);
|
||||
|
||||
SendCastFlags = data.ReadBits<uint>(5);
|
||||
MoveUpdate.HasValue = data.HasBit();
|
||||
if (data.HasBit())
|
||||
MoveUpdate.Value = new();
|
||||
|
||||
var weightCount = data.ReadBits<uint>(2);
|
||||
Target.Read(data);
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (hasClubMessage)
|
||||
{
|
||||
CommunityMessage.HasValue = true;
|
||||
CommunityMessage.Value = new();
|
||||
CommunityMessage.Value.IsPlayerUsingVoice = _worldPacket.HasBit();
|
||||
_worldPacket.ResetBitPos();
|
||||
}
|
||||
@@ -158,49 +158,49 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (hasMailInfo)
|
||||
{
|
||||
MailInfo.HasValue = true;
|
||||
MailInfo.Value = new();
|
||||
MailInfo.Value.Read(_worldPacket);
|
||||
}
|
||||
|
||||
if (hasCalendarInfo)
|
||||
{
|
||||
CalenderInfo.HasValue = true;
|
||||
CalenderInfo.Value = new();
|
||||
CalenderInfo.Value.Read(_worldPacket);
|
||||
}
|
||||
|
||||
if (hasPetInfo)
|
||||
{
|
||||
PetInfo.HasValue = true;
|
||||
PetInfo.Value = new();
|
||||
PetInfo.Value.Read(_worldPacket);
|
||||
}
|
||||
|
||||
if (hasGuildInfo)
|
||||
{
|
||||
GuildInfo.HasValue = true;
|
||||
GuildInfo.Value = new();
|
||||
GuildInfo.Value.Read(_worldPacket);
|
||||
}
|
||||
|
||||
if (hasLFGListSearchResult)
|
||||
{
|
||||
LFGListSearchResult.HasValue = true;
|
||||
LFGListSearchResult.Value = new();
|
||||
LFGListSearchResult.Value.Read(_worldPacket);
|
||||
}
|
||||
|
||||
if (hasLFGListApplicant)
|
||||
{
|
||||
LFGListApplicant.HasValue = true;
|
||||
LFGListApplicant.Value = new();
|
||||
LFGListApplicant.Value.Read(_worldPacket);
|
||||
}
|
||||
|
||||
if (hasClubFinderResult)
|
||||
{
|
||||
ClubFinderResult.HasValue = true;
|
||||
ClubFinderResult.Value = new();
|
||||
ClubFinderResult.Value.Read(_worldPacket);
|
||||
}
|
||||
|
||||
if (hasUnk910)
|
||||
{
|
||||
Unused910.HasValue = true;
|
||||
Unused910.Value = new();
|
||||
Unused910.Value.Read(_worldPacket);
|
||||
}
|
||||
}
|
||||
@@ -250,7 +250,9 @@ namespace Game.Networking.Packets
|
||||
public void Read(WorldPacket data)
|
||||
{
|
||||
uint linesCount = data.ReadUInt32();
|
||||
ReportLineIndex.HasValue = data.HasBit();
|
||||
if (data.HasBit())
|
||||
ReportLineIndex.Value = new();
|
||||
|
||||
data.ResetBitPos();
|
||||
|
||||
for (uint i = 0; i < linesCount; i++)
|
||||
@@ -279,19 +281,19 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (hasClubID)
|
||||
{
|
||||
ClubID.HasValue = true;
|
||||
ClubID.Value = new();
|
||||
ClubID.Value = data.ReadUInt64();
|
||||
}
|
||||
|
||||
if (hasChannelGUID)
|
||||
{
|
||||
ChannelGUID.HasValue = true;
|
||||
ChannelGUID.Value = new();
|
||||
ChannelGUID.Value = data.ReadPackedGuid();
|
||||
}
|
||||
|
||||
if (hasRealmAddress)
|
||||
{
|
||||
RealmAddress.HasValue = true;
|
||||
RealmAddress.Value = new();
|
||||
RealmAddress.Value.VirtualRealmAddress = data.ReadUInt32();
|
||||
RealmAddress.Value.field_4 = data.ReadUInt16();
|
||||
RealmAddress.Value.field_6 = data.ReadUInt8();
|
||||
@@ -299,7 +301,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
if (hasSlashCmd)
|
||||
{
|
||||
SlashCmd.HasValue = true;
|
||||
SlashCmd.Value = new();
|
||||
SlashCmd.Value = data.ReadInt32();
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,9 @@ namespace Game.Networking.Packets
|
||||
ShowEnemies = data.HasBit();
|
||||
ShowArenaPlayers = data.HasBit();
|
||||
ExactName = data.HasBit();
|
||||
ServerInfo.HasValue = data.HasBit();
|
||||
if (data.HasBit())
|
||||
ServerInfo.Value = new();
|
||||
|
||||
data.ResetBitPos();
|
||||
|
||||
for (int i = 0; i < wordsCount; ++i)
|
||||
|
||||
@@ -775,8 +775,8 @@ namespace Game.Networking
|
||||
public void SendAuthResponseError(BattlenetRpcErrorCode code)
|
||||
{
|
||||
AuthResponse response = new();
|
||||
response.SuccessInfo.HasValue = false;
|
||||
response.WaitInfo.HasValue = false;
|
||||
response.SuccessInfo.Clear();
|
||||
response.WaitInfo.Clear();
|
||||
response.Result = code;
|
||||
SendPacket(response);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user