From bf438260b4f4973019a1084d75443cf578693bfd Mon Sep 17 00:00:00 2001 From: alborrajo Date: Sun, 30 Jan 2022 15:56:48 +0100 Subject: [PATCH 1/2] Training room request and response structures --- .../C2STraningRoomGetEnemyListReq.cs | 22 ++++++++++ .../C2STraningRoomSetEnemyReq.cs | 36 +++++++++++++++++ .../S2CTraningRoomGetEnemyListRes.cs | 40 +++++++++++++++++++ .../S2CTraningRoomSetEnemyRes.cs | 26 ++++++++++++ .../Structure/CDataTraningRoomEnemyHeader.cs | 34 ++++++++++++++++ 5 files changed, 158 insertions(+) create mode 100644 Arrowgene.Ddon.Shared/Entity/PacketStructure/C2STraningRoomGetEnemyListReq.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/PacketStructure/C2STraningRoomSetEnemyReq.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CTraningRoomGetEnemyListRes.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CTraningRoomSetEnemyRes.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/Structure/CDataTraningRoomEnemyHeader.cs diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2STraningRoomGetEnemyListReq.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2STraningRoomGetEnemyListReq.cs new file mode 100644 index 000000000..7169853bc --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2STraningRoomGetEnemyListReq.cs @@ -0,0 +1,22 @@ +using Arrowgene.Buffers; +using Arrowgene.Ddon.Shared.Network; + +namespace Arrowgene.Ddon.Shared.Entity.PacketStructure +{ + public class C2STraningRoomGetEnemyListReq : IPacketStructure + { + public PacketId Id => PacketId.C2S_INSTANCE_TRANING_ROOM_GET_ENEMY_LIST_REQ; + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, C2STraningRoomGetEnemyListReq obj) + { + } + + public override C2STraningRoomGetEnemyListReq Read(IBuffer buffer) + { + return new C2STraningRoomGetEnemyListReq(); + } + } + } + +} \ No newline at end of file diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2STraningRoomSetEnemyReq.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2STraningRoomSetEnemyReq.cs new file mode 100644 index 000000000..5b3cce30c --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2STraningRoomSetEnemyReq.cs @@ -0,0 +1,36 @@ +using Arrowgene.Buffers; +using Arrowgene.Ddon.Shared.Network; + +namespace Arrowgene.Ddon.Shared.Entity.PacketStructure +{ + public class C2STraningRoomSetEnemyReq : IPacketStructure + { + public PacketId Id => PacketId.C2S_INSTANCE_TRANING_ROOM_SET_ENEMY_REQ; + + public uint ID { get; set; } + public uint Lv { get; set; } + + public C2STraningRoomSetEnemyReq() + { + ID = 0; + Lv = 0; + } + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, C2STraningRoomSetEnemyReq obj) + { + WriteUInt32(buffer, obj.ID); + WriteUInt32(buffer, obj.Lv); + } + + public override C2STraningRoomSetEnemyReq Read(IBuffer buffer) + { + C2STraningRoomSetEnemyReq obj = new C2STraningRoomSetEnemyReq(); + obj.ID = ReadUInt32(buffer); + obj.Lv = ReadUInt32(buffer); + return obj; + } + } + } +} \ No newline at end of file diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CTraningRoomGetEnemyListRes.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CTraningRoomGetEnemyListRes.cs new file mode 100644 index 000000000..4614c98ac --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CTraningRoomGetEnemyListRes.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using Arrowgene.Buffers; +using Arrowgene.Ddon.Shared.Entity.Structure; +using Arrowgene.Ddon.Shared.Network; + +namespace Arrowgene.Ddon.Shared.Entity.PacketStructure +{ + public class S2CTraningRoomGetEnemyListRes : ServerResponse + { + public S2CTraningRoomGetEnemyListRes() + { + InfoList = new List(); + MaxLv = 100; + } + + public override PacketId Id => PacketId.S2C_INSTANCE_TRANING_ROOM_GET_ENEMY_LIST_RES; + + public List InfoList { get; set; } + public uint MaxLv { get; set; } + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, S2CTraningRoomGetEnemyListRes obj) + { + WriteServerResponse(buffer, obj); + WriteEntityList(buffer, obj.InfoList); + WriteUInt32(buffer, obj.MaxLv); + } + + public override S2CTraningRoomGetEnemyListRes Read(IBuffer buffer) + { + S2CTraningRoomGetEnemyListRes obj = new S2CTraningRoomGetEnemyListRes(); + ReadServerResponse(buffer, obj); + obj.InfoList = ReadEntityList(buffer); + obj.MaxLv = ReadUInt32(buffer); + return obj; + } + } + } +} \ No newline at end of file diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CTraningRoomSetEnemyRes.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CTraningRoomSetEnemyRes.cs new file mode 100644 index 000000000..eb0b3fdab --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CTraningRoomSetEnemyRes.cs @@ -0,0 +1,26 @@ +using Arrowgene.Buffers; +using Arrowgene.Ddon.Shared.Network; + +namespace Arrowgene.Ddon.Shared.Entity.PacketStructure +{ + public class S2CTraningRoomSetEnemyRes : ServerResponse + { + public override PacketId Id => PacketId.S2C_INSTANCE_TRANING_ROOM_SET_ENEMY_RES; + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, S2CTraningRoomSetEnemyRes obj) + { + WriteServerResponse(buffer, obj); + } + + public override S2CTraningRoomSetEnemyRes Read(IBuffer buffer) + { + S2CTraningRoomSetEnemyRes obj = new S2CTraningRoomSetEnemyRes(); + ReadServerResponse(buffer, obj); + return obj; + } + } + + } +} \ No newline at end of file diff --git a/Arrowgene.Ddon.Shared/Entity/Structure/CDataTraningRoomEnemyHeader.cs b/Arrowgene.Ddon.Shared/Entity/Structure/CDataTraningRoomEnemyHeader.cs new file mode 100644 index 000000000..8c0a1fbd1 --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/Structure/CDataTraningRoomEnemyHeader.cs @@ -0,0 +1,34 @@ +using System; +using Arrowgene.Buffers; + +namespace Arrowgene.Ddon.Shared.Entity.Structure +{ + public class CDataTraningRoomEnemyHeader + { + public CDataTraningRoomEnemyHeader() + { + ID = 0; + StrName = string.Empty; + } + + public uint ID { get; set; } + public string StrName { get; set; } + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, CDataTraningRoomEnemyHeader obj) + { + WriteUInt32(buffer, obj.ID); + WriteMtString(buffer, obj.StrName); + } + + public override CDataTraningRoomEnemyHeader Read(IBuffer buffer) + { + CDataTraningRoomEnemyHeader obj = new CDataTraningRoomEnemyHeader(); + obj.ID = ReadUInt32(buffer); + obj.StrName = ReadMtString(buffer); + return obj; + } + } + } +} \ No newline at end of file From 5e1970042be631e7edfc921de0bcb987fefbe85e Mon Sep 17 00:00:00 2001 From: alborrajo Date: Sun, 30 Jan 2022 15:58:42 +0100 Subject: [PATCH 2/2] Stage list and area change structures and handler --- Arrowgene.Ddon.GameServer/DdonGameServer.cs | 12 ++++ .../Handler/InstanceGetEnemySetListHandler.cs | 17 ++++- .../Handler/StageAreaChangeHandler.cs | 32 ++++++--- .../Handler/StageGetStageListHandler.cs | 13 ++-- .../Entity/EntitySerializer.cs | 13 ++++ .../C2SQuestGetTutorialQuestListRes.cs | 32 +++++++++ .../PacketStructure/C2SStageAreaChangeReq.cs | 35 ++++++++++ .../C2SStageGetStageListReq.cs | 22 ++++++ .../PacketStructure/S2CStageAreaChangeRes.cs | 50 +++++++++++++ .../S2CStageGetStageListRes.cs | 31 ++++++++ .../Entity/Structure/CDataCommonU32.cs | 29 ++++++++ .../Entity/Structure/CDataStageAttribute.cs | 70 +++++++++++++++++++ .../Entity/Structure/CDataStageInfo.cs | 49 +++++++++++++ ...taStageLayoutEnemyPresetEnemyInfoClient.cs | 2 +- Arrowgene.Ddon.Shared/Util.cs | 17 +++++ 15 files changed, 407 insertions(+), 17 deletions(-) create mode 100644 Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SQuestGetTutorialQuestListRes.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SStageAreaChangeReq.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SStageGetStageListReq.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CStageAreaChangeRes.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CStageGetStageListRes.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/Structure/CDataCommonU32.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/Structure/CDataStageAttribute.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/Structure/CDataStageInfo.cs diff --git a/Arrowgene.Ddon.GameServer/DdonGameServer.cs b/Arrowgene.Ddon.GameServer/DdonGameServer.cs index 99dc2f1e9..8091f414b 100644 --- a/Arrowgene.Ddon.GameServer/DdonGameServer.cs +++ b/Arrowgene.Ddon.GameServer/DdonGameServer.cs @@ -22,10 +22,14 @@ using System.Collections.Generic; using Arrowgene.Ddon.Database; +using Arrowgene.Ddon.GameServer.Dump; using Arrowgene.Ddon.GameServer.Handler; using Arrowgene.Ddon.Server; using Arrowgene.Ddon.Server.Network; using Arrowgene.Ddon.Shared; +using Arrowgene.Ddon.Shared.Entity; +using Arrowgene.Ddon.Shared.Entity.PacketStructure; +using Arrowgene.Ddon.Shared.Entity.Structure; using Arrowgene.Logging; using Arrowgene.Networking.Tcp; @@ -37,11 +41,17 @@ public class DdonGameServer : DdonServer private readonly List _clients; + private readonly List _stageInfo; + public DdonGameServer(GameServerSetting setting, IDatabase database, AssetRepository assetRepository) : base(setting.ServerSetting, database, assetRepository) { Setting = new GameServerSetting(setting); _clients = new List(); + + S2CStageGetStageListRes stageListPacket = EntitySerializer.Get().Read(GameDump.data_Dump_19); + _stageInfo = stageListPacket.StageList; + LoadPacketHandler(); } @@ -49,6 +59,8 @@ public DdonGameServer(GameServerSetting setting, IDatabase database, AssetReposi public override List Clients => new List(_clients); + public List StageList => new List(_stageInfo); + protected override void ClientConnected(GameClient client) { client.InitializeChallenge(); diff --git a/Arrowgene.Ddon.GameServer/Handler/InstanceGetEnemySetListHandler.cs b/Arrowgene.Ddon.GameServer/Handler/InstanceGetEnemySetListHandler.cs index dc316e1cb..d0fd39469 100644 --- a/Arrowgene.Ddon.GameServer/Handler/InstanceGetEnemySetListHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/InstanceGetEnemySetListHandler.cs @@ -1,7 +1,9 @@ -using Arrowgene.Buffers; +using System.Collections.Generic; +using Arrowgene.Buffers; using Arrowgene.Ddon.GameServer.Dump; using Arrowgene.Ddon.Server; using Arrowgene.Ddon.Server.Network; +using Arrowgene.Ddon.Shared; using Arrowgene.Ddon.Shared.Entity; using Arrowgene.Ddon.Shared.Entity.PacketStructure; using Arrowgene.Ddon.Shared.Network; @@ -19,11 +21,22 @@ public InstanceGetEnemySetListHandler(DdonGameServer server) : base(server) public override void Handle(GameClient client, StructurePacket request) { - S2CInstanceGetEnemySetListRes response = new S2CInstanceGetEnemySetListRes(); //note that the enemy array is inside this and is currently hardcoded + S2CInstanceGetEnemySetListRes response = new S2CInstanceGetEnemySetListRes(); response.LayoutId.StageID = request.Structure.LayoutId.StageID; response.LayoutId.LayerNo = request.Structure.LayoutId.LayerNo; response.LayoutId.GroupID = request.Structure.LayoutId.GroupID; response.SubGroupId = request.Structure.SubGroupId; + response.RandomSeed = 0xFFFFFFFF; + + CDataLayoutEnemyData layoutEnemyData = new CDataLayoutEnemyData(); + layoutEnemyData.EnemyInfo.EnemyId = 0x010314; + layoutEnemyData.EnemyInfo.NamedEnemyParamsId = 0x8FA; + layoutEnemyData.EnemyInfo.Scale = 0x64; // Normal + layoutEnemyData.EnemyInfo.Lv = 0x5E; + layoutEnemyData.EnemyInfo.EnemyTargetTypesId = 1; + response.EnemyList.Add(layoutEnemyData); + + Logger.Debug(client, Util.ToXML(response)); client.Send(response); } diff --git a/Arrowgene.Ddon.GameServer/Handler/StageAreaChangeHandler.cs b/Arrowgene.Ddon.GameServer/Handler/StageAreaChangeHandler.cs index 5cd041e7e..06ec01094 100644 --- a/Arrowgene.Ddon.GameServer/Handler/StageAreaChangeHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/StageAreaChangeHandler.cs @@ -1,13 +1,13 @@ -using System; -using Arrowgene.Ddon.GameServer.Dump; -using Arrowgene.Ddon.Server; +using Arrowgene.Ddon.Server; using Arrowgene.Ddon.Server.Network; -using Arrowgene.Ddon.Shared.Network; +using Arrowgene.Ddon.Shared.Entity.PacketStructure; +using Arrowgene.Ddon.Shared.Entity.Structure; using Arrowgene.Logging; +using Arrowgene.Ddon.Shared; namespace Arrowgene.Ddon.GameServer.Handler { - public class StageAreaChangeHandler : PacketHandler + public class StageAreaChangeHandler : StructurePacketHandler { private static readonly ServerLogger Logger = LogProvider.Logger(typeof(StageAreaChangeHandler)); @@ -16,11 +16,27 @@ public StageAreaChangeHandler(DdonGameServer server) : base(server) { } - public override PacketId Id => PacketId.C2S_STAGE_AREA_CHANGE_REQ; + public override void Handle(GameClient client, StructurePacket packet) + { + S2CStageAreaChangeRes res = new S2CStageAreaChangeRes(); + res.StageNo = convertIdToStageNo(packet.Structure.StageId); // TODO: Convert StageId to StageNo + res.IsBase = false; + + Logger.Debug(client, Util.ToXML(res)); - public override void Handle(GameClient client, Packet packet) + client.Send(res); + } + + private uint convertIdToStageNo(uint stageId) { - client.Send(GameFull.Dump_109); + foreach(CDataStageInfo stageInfo in (Server as DdonGameServer).StageList) + { + if(stageInfo.ID == stageId) + return stageInfo.StageNo; + } + + Logger.Error($"No stage found with ID ${stageId}"); + return 0; // TODO: Maybe throw an exception? } } } diff --git a/Arrowgene.Ddon.GameServer/Handler/StageGetStageListHandler.cs b/Arrowgene.Ddon.GameServer/Handler/StageGetStageListHandler.cs index 2937e7d3e..85b2b1659 100644 --- a/Arrowgene.Ddon.GameServer/Handler/StageGetStageListHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/StageGetStageListHandler.cs @@ -1,25 +1,26 @@ using Arrowgene.Ddon.GameServer.Dump; using Arrowgene.Ddon.Server; using Arrowgene.Ddon.Server.Network; +using Arrowgene.Ddon.Shared.Entity.PacketStructure; using Arrowgene.Ddon.Shared.Network; using Arrowgene.Logging; namespace Arrowgene.Ddon.GameServer.Handler { - public class StageGetStageListHandler : PacketHandler + public class StageGetStageListHandler : StructurePacketHandler { private static readonly ServerLogger Logger = LogProvider.Logger(typeof(StageGetStageListHandler)); - public StageGetStageListHandler(DdonGameServer server) : base(server) { } - public override PacketId Id => PacketId.C2S_STAGE_GET_STAGE_LIST_REQ; - - public override void Handle(GameClient client, Packet packet) + public override void Handle(GameClient client, StructurePacket packet) { - client.Send(GameDump.Dump_19); + S2CStageGetStageListRes obj = new S2CStageGetStageListRes(); + obj.StageList = (Server as DdonGameServer).StageList; + + client.Send(obj); } } } diff --git a/Arrowgene.Ddon.Shared/Entity/EntitySerializer.cs b/Arrowgene.Ddon.Shared/Entity/EntitySerializer.cs index 4120e25b8..e2a07904b 100644 --- a/Arrowgene.Ddon.Shared/Entity/EntitySerializer.cs +++ b/Arrowgene.Ddon.Shared/Entity/EntitySerializer.cs @@ -23,6 +23,7 @@ public abstract class EntitySerializer Create(new CDataCharacterListInfoSerializer()), Create(new CDataCharacterMessageSerializer()), Create(new CDataCharacterMsgSetSerializer()), + Create(new CDataCommonU32.Serializer()), Create(new CDataCommunicationShortCutSerializer()), Create(new CDataDropItemSetInfo.Serializer()), Create(new CDataEditInfoSerializer()), @@ -44,8 +45,11 @@ public abstract class EntitySerializer Create(new CDataOrbPageStatusSerializer()), Create(new CDataPlayPointDataSerializer()), Create(new CDataShortCutSerializer()), + Create(new CDataStageAttribute.Serializer()), + Create(new CDataStageInfo.Serializer()), Create(new CDataStageLayoutEnemyPresetEnemyInfoClient.Serializer()), Create(new CDataStatusInfoSerializer()), + Create(new CDataTraningRoomEnemyHeader.Serializer()), Create(new CDataURLInfoSerializer()), Create(new CDataWarpPointSerializer()), Create(new CStageLayoutID.Serializer()), @@ -70,6 +74,11 @@ public abstract class EntitySerializer Create(new C2SInstanceGetEnemySetListReqSerializer()), Create(new C2SLobbyChatMsgReq.Serializer()), Create(new C2SLobbyJoinReq.Serializer()), + Create(new C2SQuestGetTutorialQuestListRes.Serializer()), + Create(new C2SStageAreaChangeReq.Serializer()), + Create(new C2SStageGetStageListReq.Serializer()), + Create(new C2STraningRoomGetEnemyListReq.Serializer()), + Create(new C2STraningRoomSetEnemyReq.Serializer()), Create(new C2SWarpGetReturnLocationReq.Serializer()), Create(new C2SWarpRegisterFavoriteWarpReq.Serializer()), Create(new C2SWarpWarpReq.Serializer()), @@ -95,6 +104,10 @@ public abstract class EntitySerializer Create(new S2CLobbyChatMsgNotice.Serializer()), Create(new S2CLobbyChatMsgNoticeCharacterSerializer()), Create(new S2CLobbyJoinRes.Serializer()), + Create(new S2CStageAreaChangeRes.Serializer()), + Create(new S2CStageGetStageListRes.Serializer()), + Create(new S2CTraningRoomGetEnemyListRes.Serializer()), + Create(new S2CTraningRoomSetEnemyRes.Serializer()), Create(new S2CWarpGetReturnLocationRes.Serializer()), Create(new S2CWarpRegisterFavoriteWarpRes.Serializer()), Create(new S2CWarpWarpRes.Serializer()), diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SQuestGetTutorialQuestListRes.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SQuestGetTutorialQuestListRes.cs new file mode 100644 index 000000000..c15fd5f2a --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SQuestGetTutorialQuestListRes.cs @@ -0,0 +1,32 @@ +using Arrowgene.Buffers; +using Arrowgene.Ddon.Shared.Network; + +namespace Arrowgene.Ddon.Shared.Entity.PacketStructure +{ + public class C2SQuestGetTutorialQuestListRes : IPacketStructure + { + public PacketId Id => PacketId.C2S_QUEST_GET_TUTORIAL_QUEST_LIST_REQ; + + public uint StageNo { get; set; } + + public C2SQuestGetTutorialQuestListRes() + { + StageNo = 0; + } + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, C2SQuestGetTutorialQuestListRes obj) + { + WriteUInt32(buffer, obj.StageNo); + } + + public override C2SQuestGetTutorialQuestListRes Read(IBuffer buffer) + { + C2SQuestGetTutorialQuestListRes obj = new C2SQuestGetTutorialQuestListRes(); + obj.StageNo = ReadUInt32(buffer); + return obj; + } + } + } +} \ No newline at end of file diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SStageAreaChangeReq.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SStageAreaChangeReq.cs new file mode 100644 index 000000000..6756f4f36 --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SStageAreaChangeReq.cs @@ -0,0 +1,35 @@ +using Arrowgene.Buffers; +using Arrowgene.Ddon.Shared.Network; + +namespace Arrowgene.Ddon.Shared.Entity.PacketStructure +{ + public class C2SStageAreaChangeReq : IPacketStructure + { + public PacketId Id => PacketId.C2S_STAGE_AREA_CHANGE_REQ; + + public uint StageId { get; set; } + public uint JumpType { get; set; } + + public C2SStageAreaChangeReq() { + StageId=0; + JumpType=0; + } + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, C2SStageAreaChangeReq obj) + { + WriteUInt32(buffer, obj.StageId); + WriteUInt32(buffer, obj.JumpType); + } + + public override C2SStageAreaChangeReq Read(IBuffer buffer) + { + C2SStageAreaChangeReq obj = new C2SStageAreaChangeReq(); + obj.StageId = ReadUInt32(buffer); + obj.JumpType = ReadUInt32(buffer); + return obj; + } + } + } +} \ No newline at end of file diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SStageGetStageListReq.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SStageGetStageListReq.cs new file mode 100644 index 000000000..b5b9f1b7f --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SStageGetStageListReq.cs @@ -0,0 +1,22 @@ +using Arrowgene.Buffers; +using Arrowgene.Ddon.Shared.Network; + +namespace Arrowgene.Ddon.Shared.Entity.PacketStructure +{ + public class C2SStageGetStageListReq : IPacketStructure + { + public PacketId Id => PacketId.C2S_STAGE_GET_STAGE_LIST_REQ; + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, C2SStageGetStageListReq obj) + { + } + + public override C2SStageGetStageListReq Read(IBuffer buffer) + { + return new C2SStageGetStageListReq(); + } + } + } +} \ No newline at end of file diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CStageAreaChangeRes.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CStageAreaChangeRes.cs new file mode 100644 index 000000000..3f2f46c90 --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CStageAreaChangeRes.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using Arrowgene.Buffers; +using Arrowgene.Ddon.Shared.Entity.Structure; +using Arrowgene.Ddon.Shared.Network; + +namespace Arrowgene.Ddon.Shared.Entity.PacketStructure +{ + public class S2CStageAreaChangeRes : ServerResponse + { + public override PacketId Id => PacketId.S2C_STAGE_AREA_CHANGE_RES; + + public uint StageNo { get; set; } + public bool IsBase { get; set; } + public List StageFeatureList { get; set; } + public List Unk0 { get; set; } + public List Unk1 { get; set; } + + public S2CStageAreaChangeRes() + { + StageNo=0; + IsBase=false; + StageFeatureList=new List(); + } + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, S2CStageAreaChangeRes obj) + { + WriteServerResponse(buffer, obj); + WriteUInt32(buffer, obj.StageNo); + WriteBool(buffer, obj.IsBase); + WriteEntityList(buffer, obj.StageFeatureList); + // TODO: Unk0 and Unk1 + WriteEntityList(buffer, new List()); + WriteEntityList(buffer, new List()); + } + + public override S2CStageAreaChangeRes Read(IBuffer buffer) + { + S2CStageAreaChangeRes obj = new S2CStageAreaChangeRes(); + ReadServerResponse(buffer, obj); + obj.StageNo = ReadUInt32(buffer); + obj.IsBase = ReadBool(buffer); + obj.StageFeatureList = ReadEntityList(buffer); + // TODO: Unk0 and Unk1 + return obj; + } + } + } +} \ No newline at end of file diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CStageGetStageListRes.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CStageGetStageListRes.cs new file mode 100644 index 000000000..149430c2f --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CStageGetStageListRes.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using Arrowgene.Buffers; +using Arrowgene.Ddon.Shared.Entity.Structure; +using Arrowgene.Ddon.Shared.Network; + +namespace Arrowgene.Ddon.Shared.Entity.PacketStructure +{ + public class S2CStageGetStageListRes : ServerResponse + { + public override PacketId Id => PacketId.S2C_STAGE_GET_STAGE_LIST_RES; + + public List StageList { get; set; } + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, S2CStageGetStageListRes obj) + { + WriteServerResponse(buffer, obj); + WriteEntityList(buffer, obj.StageList); + } + + public override S2CStageGetStageListRes Read(IBuffer buffer) + { + S2CStageGetStageListRes obj = new S2CStageGetStageListRes(); + ReadServerResponse(buffer, obj); + obj.StageList = ReadEntityList(buffer); + return obj; + } + } + } +} \ No newline at end of file diff --git a/Arrowgene.Ddon.Shared/Entity/Structure/CDataCommonU32.cs b/Arrowgene.Ddon.Shared/Entity/Structure/CDataCommonU32.cs new file mode 100644 index 000000000..21859a2fa --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/Structure/CDataCommonU32.cs @@ -0,0 +1,29 @@ +using Arrowgene.Buffers; + +namespace Arrowgene.Ddon.Shared.Entity.Structure +{ + public class CDataCommonU32 + { + public CDataCommonU32() + { + Value=0; + } + + public uint Value { get; set; } + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, CDataCommonU32 obj) + { + WriteUInt32(buffer, obj.Value); + } + + public override CDataCommonU32 Read(IBuffer buffer) + { + CDataCommonU32 obj = new CDataCommonU32(); + obj.Value = ReadUInt32(buffer); + return obj; + } + } + } +} \ No newline at end of file diff --git a/Arrowgene.Ddon.Shared/Entity/Structure/CDataStageAttribute.cs b/Arrowgene.Ddon.Shared/Entity/Structure/CDataStageAttribute.cs new file mode 100644 index 000000000..855ba7b15 --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/Structure/CDataStageAttribute.cs @@ -0,0 +1,70 @@ +using Arrowgene.Buffers; + +namespace Arrowgene.Ddon.Shared.Entity.Structure +{ + public class CDataStageAttribute + { + // Please note i haven't checked if the fields are in the same order as in the PS4 build + public bool IsSolo { get; set; } + public bool IsEnablePartyFunc { get; set; } + public bool IsAdventureCountKeep { get; set; } + public bool IsEnableCraft { get; set; } + public bool IsEnableStorage { get; set; } + public bool IsEnableStorageInCharge { get; set; } + public bool IsNotSessionReturn { get; set; } + public bool IsEnableBaggage { get; set; } + public bool IsClanBase { get; set; } + public bool Unk0 { get; set; } + public bool Unk1 { get; set; } + + public CDataStageAttribute() + { + IsSolo=false; + IsEnablePartyFunc=false; + IsAdventureCountKeep=false; + IsEnableCraft=false; + IsEnableStorage=false; + IsEnableStorageInCharge=false; + IsNotSessionReturn=false; + IsEnableBaggage=false; + IsClanBase=false; + Unk0=false; + Unk1=false; + } + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, CDataStageAttribute obj) + { + WriteBool(buffer,obj.IsSolo); + WriteBool(buffer,obj.IsEnablePartyFunc); + WriteBool(buffer,obj.IsAdventureCountKeep); + WriteBool(buffer,obj.IsEnableCraft); + WriteBool(buffer,obj.IsEnableStorage); + WriteBool(buffer,obj.IsEnableStorageInCharge); + WriteBool(buffer,obj.IsNotSessionReturn); + WriteBool(buffer,obj.IsEnableBaggage); + WriteBool(buffer,obj.IsClanBase); + WriteBool(buffer,obj.Unk0); + WriteBool(buffer,obj.Unk1); + } + + public override CDataStageAttribute Read(IBuffer buffer) + { + CDataStageAttribute obj = new CDataStageAttribute(); + obj.IsSolo = ReadBool(buffer); + obj.IsEnablePartyFunc = ReadBool(buffer); + obj.IsAdventureCountKeep = ReadBool(buffer); + obj.IsEnableCraft = ReadBool(buffer); + obj.IsEnableStorage = ReadBool(buffer); + obj.IsEnableStorageInCharge = ReadBool(buffer); + obj.IsNotSessionReturn = ReadBool(buffer); + obj.IsEnableBaggage = ReadBool(buffer); + obj.IsClanBase = ReadBool(buffer); + obj.Unk0 = ReadBool(buffer); + obj.Unk1 = ReadBool(buffer); + return obj; + } + } + } +} \ No newline at end of file diff --git a/Arrowgene.Ddon.Shared/Entity/Structure/CDataStageInfo.cs b/Arrowgene.Ddon.Shared/Entity/Structure/CDataStageInfo.cs new file mode 100644 index 000000000..8bd130778 --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/Structure/CDataStageInfo.cs @@ -0,0 +1,49 @@ +using Arrowgene.Buffers; + +namespace Arrowgene.Ddon.Shared.Entity.Structure +{ + public class CDataStageInfo + { + public uint ID { get; set; } + public uint StageNo { get; set; } + public uint RandomStageGroupID { get; set; } + public uint Type { get; set; } + public CDataStageAttribute StageAttribute { get; set; } + public bool IsAutoSetBloodEnemy { get; set; } + + public CDataStageInfo() + { + ID=0; + StageNo=0; + RandomStageGroupID=0; + Type=0; + StageAttribute=new CDataStageAttribute(); + IsAutoSetBloodEnemy=false; + } + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, CDataStageInfo obj) + { + WriteUInt32(buffer, obj.ID); + WriteUInt32(buffer, obj.StageNo); + WriteUInt32(buffer, obj.RandomStageGroupID); + WriteUInt32(buffer, obj.Type); + WriteEntity(buffer, obj.StageAttribute); + WriteBool(buffer, obj.IsAutoSetBloodEnemy); + } + + public override CDataStageInfo Read(IBuffer buffer) + { + CDataStageInfo obj = new CDataStageInfo(); + obj.ID = ReadUInt32(buffer); + obj.StageNo = ReadUInt32(buffer); + obj.RandomStageGroupID = ReadUInt32(buffer); + obj.Type = ReadUInt32(buffer); + obj.StageAttribute = ReadEntity(buffer); + obj.IsAutoSetBloodEnemy = ReadBool(buffer); + return obj; + } + } + } +} \ No newline at end of file diff --git a/Arrowgene.Ddon.Shared/Entity/Structure/CDataStageLayoutEnemyPresetEnemyInfoClient.cs b/Arrowgene.Ddon.Shared/Entity/Structure/CDataStageLayoutEnemyPresetEnemyInfoClient.cs index 92cb82152..57964934a 100644 --- a/Arrowgene.Ddon.Shared/Entity/Structure/CDataStageLayoutEnemyPresetEnemyInfoClient.cs +++ b/Arrowgene.Ddon.Shared/Entity/Structure/CDataStageLayoutEnemyPresetEnemyInfoClient.cs @@ -32,7 +32,7 @@ public CDataStageLayoutEnemyPresetEnemyInfoClient() public uint RaidBossId { get; set; } public ushort Scale { get; set; } public ushort Lv { get; set; } // Level - public ushort HmPresetNo { get; set; } + public ushort HmPresetNo { get; set; } // Preset for human enemies? public byte StartThinkTblNo { get; set; } // Start Think Table Number??? public byte RepopNum { get; set; } public byte RepopCount { get; set; } diff --git a/Arrowgene.Ddon.Shared/Util.cs b/Arrowgene.Ddon.Shared/Util.cs index 57bb2be81..8896680e8 100644 --- a/Arrowgene.Ddon.Shared/Util.cs +++ b/Arrowgene.Ddon.Shared/Util.cs @@ -323,5 +323,22 @@ public static byte[] ReplaceBytes(byte[] src, byte[] search, byte[] repl) return dst; } + + public static string ToXML(object obj) + { + System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(obj.GetType()); + using (System.IO.StringWriter sw = new System.IO.StringWriter()) + { + try + { + xs.Serialize(sw, obj); + return sw.ToString(); + } + catch (Exception ex) + { + return null; + } + } + } } }