From 277d162c871ba3bb1e4d3cade31f30f418948211 Mon Sep 17 00:00:00 2001 From: Sehkah Date: Tue, 10 Sep 2024 22:34:21 +0200 Subject: [PATCH] WIP craft menu. --- Arrowgene.Ddon.GameServer/DdonGameServer.cs | 1 + .../Handler/MandragoraBeginCraftHandler.cs | 50 +++++++ .../MandragoraGetCraftRecipeListHandler.cs | 124 +++++++++++++++++- .../Entity/EntitySerializer.cs | 6 + .../C2SMandragoraBeginCraftReq.cs | 57 ++++++++ .../S2CMandragoraBeginCraftRes.cs | 38 ++++++ ...ataMyMandragoraBeginCraftFertilizerItem.cs | 34 +++++ .../CDataMyMandragoraBeginCraftResUnk0.cs | 45 +++++++ .../CDataMyMandragoraBeginCraftResUnk0Unk7.cs | 39 ++++++ ...taMyMandragoraBeginCraftResUnk0Unk7Unk2.cs | 27 ++++ .../Files/Assets/GpCourseInfo.json | 2 +- 11 files changed, 420 insertions(+), 3 deletions(-) create mode 100644 Arrowgene.Ddon.GameServer/Handler/MandragoraBeginCraftHandler.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SMandragoraBeginCraftReq.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CMandragoraBeginCraftRes.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftFertilizerItem.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftResUnk0.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftResUnk0Unk7.cs create mode 100644 Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftResUnk0Unk7Unk2.cs diff --git a/Arrowgene.Ddon.GameServer/DdonGameServer.cs b/Arrowgene.Ddon.GameServer/DdonGameServer.cs index 75b22c3be..55b565194 100644 --- a/Arrowgene.Ddon.GameServer/DdonGameServer.cs +++ b/Arrowgene.Ddon.GameServer/DdonGameServer.cs @@ -410,6 +410,7 @@ private void LoadPacketHandler() AddHandler(new MandragoraGetSpeciesCategoryListHandler(this)); AddHandler(new MandragoraGetSpeciesListHandler(this)); AddHandler(new MandragoraGetCraftRecipeListHandler(this)); + AddHandler(new MandragoraBeginCraftHandler(this)); AddHandler(new MyRoomFurnitureListGetHandler(this)); AddHandler(new MyRoomMyRoomBgmUpdateHandler(this)); diff --git a/Arrowgene.Ddon.GameServer/Handler/MandragoraBeginCraftHandler.cs b/Arrowgene.Ddon.GameServer/Handler/MandragoraBeginCraftHandler.cs new file mode 100644 index 000000000..587b1dceb --- /dev/null +++ b/Arrowgene.Ddon.GameServer/Handler/MandragoraBeginCraftHandler.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using Arrowgene.Ddon.Server; +using Arrowgene.Ddon.Shared.Entity.PacketStructure; +using Arrowgene.Ddon.Shared.Entity.Structure; +using Arrowgene.Logging; + +namespace Arrowgene.Ddon.GameServer.Handler +{ + public class MandragoraBeginCraftHandler : GameRequestPacketHandler + { + private static readonly ServerLogger Logger = LogProvider.Logger(typeof(MandragoraBeginCraftHandler)); + + public MandragoraBeginCraftHandler(DdonGameServer server) : base(server) + { + } + + public override S2CMandragoraBeginCraftRes Handle(GameClient client, C2SMandragoraBeginCraftReq request) + { + S2CMandragoraBeginCraftRes res = new S2CMandragoraBeginCraftRes(); + + // TODO: + res.Unk0 = new CDataMyMandragoraBeginCraftResUnk0 + { + SpeciesIndex = 101, + Unk1 = 0, + MandragoraId = 1, + Unk3 = "Test", + Unk4 = 0, + Unk5 = 0, + Unk6 = 0, + Unk7 = new CDataMyMandragoraBeginCraftResUnk0Unk7 + { + Unk0 = 0, + Unk1 = 0, + Unk2 = new List + { + new CDataMyMandragoraBeginCraftResUnk0Unk7Unk2 + { + Unk0 = 0, + Unk1 = 0 + } + }, + Unk3 = 0 + } + }; + + return res; + } + } +} diff --git a/Arrowgene.Ddon.GameServer/Handler/MandragoraGetCraftRecipeListHandler.cs b/Arrowgene.Ddon.GameServer/Handler/MandragoraGetCraftRecipeListHandler.cs index 6be5acca4..a0089c00c 100644 --- a/Arrowgene.Ddon.GameServer/Handler/MandragoraGetCraftRecipeListHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/MandragoraGetCraftRecipeListHandler.cs @@ -26,9 +26,9 @@ public override S2CMandragoraGetCraftRecipeListRes Handle(GameClient client, C2S { new CDataMyMandragoraCraftRecipe { - RecipeId = 1, + RecipeId = 123, ItemId = 17923, // Bonus Dungeon Ticket XP - Time = 30, + Time = 64800, Unk3 = 3000, Unk4 = new List { @@ -56,6 +56,126 @@ public override S2CMandragoraGetCraftRecipeListRes Handle(GameClient client, C2S IsSp = false } } + }, + new CDataMyMandragoraCraftRecipe + { + RecipeId = 456, + ItemId = 17924, // Bonus Dungeon Ticket RIM + Time = 64800, + Unk3 = 3000, + Unk4 = new List + { + new CDataMyMandragoraCraftRecipeUnk4 + { + Unk0 = 1, + Unk1 = 1 + } + }, + Unk5 = true, + CraftMaterialList = new List + { + new CDataMDataCraftMaterial + { + ItemId = 17881, + Num = 1, + SortNo = 1, + IsSp = false + }, + new CDataMDataCraftMaterial + { + ItemId = 14190, + Num = 1, + SortNo = 2, + IsSp = false + }, + new CDataMDataCraftMaterial + { + ItemId = 7896, + Num = 3, + SortNo = 3, + IsSp = false + } + } + }, + new CDataMyMandragoraCraftRecipe + { + RecipeId = 789, + ItemId = 18663, // Mandragora Leaf + Time = 64800, + Unk3 = 3000, + Unk4 = new List + { + new CDataMyMandragoraCraftRecipeUnk4 + { + Unk0 = 1, + Unk1 = 1 + } + }, + Unk5 = false, + CraftMaterialList = new List + { + new CDataMDataCraftMaterial + { + ItemId = 7824, + Num = 1, + SortNo = 1, + IsSp = false + }, + new CDataMDataCraftMaterial + { + ItemId = 17886, + Num = 1, + SortNo = 2, + IsSp = false + }, + new CDataMDataCraftMaterial + { + ItemId = 17884, + Num = 2, + SortNo = 3, + IsSp = false + } + } + }, + new CDataMyMandragoraCraftRecipe + { + RecipeId = 101112, + ItemId = 18664, // Mandragora Twig + Time = 64800, + Unk3 = 3000, + Unk4 = new List + { + new CDataMyMandragoraCraftRecipeUnk4 + { + Unk0 = 1, + Unk1 = 1 + } + }, + Unk5 = true, + CraftMaterialList = new List + { + new CDataMDataCraftMaterial + { + ItemId = 7824, + Num = 1, + SortNo = 1, + IsSp = false + }, + new CDataMDataCraftMaterial + { + ItemId = 17886, + Num = 1, + SortNo = 2, + IsSp = false + }, + new CDataMDataCraftMaterial + { + ItemId = 18507, + Num = 2, + SortNo = 3, + IsSp = false + } + } } }; diff --git a/Arrowgene.Ddon.Shared/Entity/EntitySerializer.cs b/Arrowgene.Ddon.Shared/Entity/EntitySerializer.cs index a49fbc207..f7567086b 100644 --- a/Arrowgene.Ddon.Shared/Entity/EntitySerializer.cs +++ b/Arrowgene.Ddon.Shared/Entity/EntitySerializer.cs @@ -201,6 +201,10 @@ static EntitySerializer() Create(new CDataMatchingProfileSerializer()); Create(new CDataMyMandragoraFurnitureItem.Serializer()); + Create(new CDataMyMandragoraBeginCraftFertilizerItem.Serializer()); + Create(new CDataMyMandragoraBeginCraftResUnk0.Serializer()); + Create(new CDataMyMandragoraBeginCraftResUnk0Unk7.Serializer()); + Create(new CDataMyMandragoraBeginCraftResUnk0Unk7Unk2.Serializer()); Create(new CDataMyMandragora.Serializer()); Create(new CDataMyMandragoraUnk1Unk7.Serializer()); Create(new CDataMyMandragoraUnk1Unk7Unk2.Serializer()); @@ -544,6 +548,7 @@ static EntitySerializer() Create(new C2SMandragoraGetSpeciesCategoryListReq.Serializer()); Create(new C2SMandragoraGetSpeciesListReq.Serializer()); Create(new C2SMandragoraGetCraftRecipeListReq.Serializer()); + Create(new C2SMandragoraBeginCraftReq.Serializer()); Create(new C2SMyRoomFurnitureListGetReq.Serializer()); Create(new C2SMyRoomMyRoomBgmUpdateReq.Serializer()); Create(new C2SMyRoomUpdatePlanetariumReq.Serializer()); @@ -968,6 +973,7 @@ static EntitySerializer() Create(new S2CMandragoraGetSpeciesCategoryListRes.Serializer()); Create(new S2CMandragoraGetSpeciesListRes.Serializer()); Create(new S2CMandragoraGetCraftRecipeListRes.Serializer()); + Create(new S2CMandragoraBeginCraftRes.Serializer()); Create(new S2CMyRoomFurnitureListGetRes.Serializer()); Create(new S2CMyRoomMyRoomBgmUpdateRes.Serializer()); Create(new S2CMyRoomUpdatePlanetariumRes.Serializer()); diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SMandragoraBeginCraftReq.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SMandragoraBeginCraftReq.cs new file mode 100644 index 000000000..62c8f6f42 --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SMandragoraBeginCraftReq.cs @@ -0,0 +1,57 @@ +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 C2SMandragoraBeginCraftReq : IPacketStructure + { + public PacketId Id => PacketId.C2S_MANDRAGORA_BEGIN_CRAFT_REQ; + + /// + /// Recipe ID as provided via the previous GetCraftRecipeList request + /// + public uint RecipeId { get; set; } + /// + /// Mandragora chosen to perform crafting. + /// + public byte MandragoraId { get; set; } + /// + /// List of items used to "fertilize" or raise the mandragora. + /// + public List CraftFertilizerItemList { get; set; } + /// + /// Actual craft recipe ingredient items. + /// + public List CraftMaterialList { get; set; } + + public C2SMandragoraBeginCraftReq() + { + CraftMaterialList = new List(); + } + + public class Serializer : PacketEntitySerializer + { + public override void Write(IBuffer buffer, C2SMandragoraBeginCraftReq obj) + { + WriteUInt32(buffer, obj.RecipeId); + WriteByte(buffer, obj.MandragoraId); + WriteEntityList(buffer, obj.CraftFertilizerItemList); + WriteEntityList(buffer, obj.CraftMaterialList); + } + + public override C2SMandragoraBeginCraftReq Read(IBuffer buffer) + { + C2SMandragoraBeginCraftReq obj = new C2SMandragoraBeginCraftReq(); + + obj.RecipeId = ReadUInt32(buffer); + obj.MandragoraId = ReadByte(buffer); + obj.CraftFertilizerItemList = ReadEntityList(buffer); + obj.CraftMaterialList = ReadEntityList(buffer); + + return obj; + } + } + } +} diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CMandragoraBeginCraftRes.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CMandragoraBeginCraftRes.cs new file mode 100644 index 000000000..f7605103f --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CMandragoraBeginCraftRes.cs @@ -0,0 +1,38 @@ +using Arrowgene.Buffers; +using Arrowgene.Ddon.Shared.Entity.Structure; +using Arrowgene.Ddon.Shared.Network; + +namespace Arrowgene.Ddon.Shared.Entity.PacketStructure +{ + public class S2CMandragoraBeginCraftRes : ServerResponse + { + public override PacketId Id => PacketId.S2C_MANDRAGORA_BEGIN_CRAFT_RES; + + public CDataMyMandragoraBeginCraftResUnk0 Unk0 { get; set; } + + public S2CMandragoraBeginCraftRes() + { + } + + public class Serializer : PacketEntitySerializer + { + public override void Write(IBuffer buffer, S2CMandragoraBeginCraftRes obj) + { + WriteServerResponse(buffer, obj); + + WriteEntity(buffer, obj.Unk0); + } + + public override S2CMandragoraBeginCraftRes Read(IBuffer buffer) + { + S2CMandragoraBeginCraftRes obj = new S2CMandragoraBeginCraftRes(); + + ReadServerResponse(buffer, obj); + + obj.Unk0 = ReadEntity(buffer); + + return obj; + } + } + } +} diff --git a/Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftFertilizerItem.cs b/Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftFertilizerItem.cs new file mode 100644 index 000000000..dc2063470 --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftFertilizerItem.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using Arrowgene.Buffers; + +namespace Arrowgene.Ddon.Shared.Entity.Structure +{ + public class CDataMyMandragoraBeginCraftFertilizerItem + { + /// + /// ItemUID, taken from the lefthand side of the menu where you choose fertilizer items + /// + public string ItemUID { get; set; } + /// + /// Always 1 + /// + public byte ItemNum { get; set; } + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, CDataMyMandragoraBeginCraftFertilizerItem obj) + { + WriteMtString(buffer, obj.ItemUID); + WriteByte(buffer, obj.ItemNum); + } + + public override CDataMyMandragoraBeginCraftFertilizerItem Read(IBuffer buffer) + { + CDataMyMandragoraBeginCraftFertilizerItem obj = new CDataMyMandragoraBeginCraftFertilizerItem(); + obj.ItemUID = ReadMtString(buffer); + obj.ItemNum = ReadByte(buffer); + return obj; + } + } + } +} diff --git a/Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftResUnk0.cs b/Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftResUnk0.cs new file mode 100644 index 000000000..07f5ca83b --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftResUnk0.cs @@ -0,0 +1,45 @@ +using Arrowgene.Buffers; + +namespace Arrowgene.Ddon.Shared.Entity.Structure +{ + public class CDataMyMandragoraBeginCraftResUnk0 + { + public uint SpeciesIndex { get; set; } + public byte Unk1 { get; set; } + public uint MandragoraId { get; set; } + public string Unk3 { get; set; } + public uint Unk4 { get; set; } + public long Unk5 { get; set; } + public uint Unk6 { get; set; } + public CDataMyMandragoraBeginCraftResUnk0Unk7 Unk7 { get; set; } + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, CDataMyMandragoraBeginCraftResUnk0 obj) + { + WriteUInt32(buffer, obj.SpeciesIndex); + WriteByte(buffer, obj.Unk1); + WriteUInt32(buffer, obj.MandragoraId); + WriteMtString(buffer, obj.Unk3); + WriteUInt32(buffer, obj.Unk4); + WriteInt64(buffer, obj.Unk5); + WriteUInt32(buffer, obj.Unk6); + WriteEntity(buffer, obj.Unk7); + } + + public override CDataMyMandragoraBeginCraftResUnk0 Read(IBuffer buffer) + { + CDataMyMandragoraBeginCraftResUnk0 obj = new CDataMyMandragoraBeginCraftResUnk0(); + obj.SpeciesIndex = ReadUInt32(buffer); + obj.Unk1 = ReadByte(buffer); + obj.MandragoraId = ReadUInt32(buffer); + obj.Unk3 = ReadMtString(buffer); + obj.Unk4 = ReadUInt32(buffer); + obj.Unk5 = ReadInt64(buffer); + obj.Unk6 = ReadUInt32(buffer); + obj.Unk7 = ReadEntity(buffer); + return obj; + } + } + } +} diff --git a/Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftResUnk0Unk7.cs b/Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftResUnk0Unk7.cs new file mode 100644 index 000000000..fa1199f25 --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftResUnk0Unk7.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using Arrowgene.Buffers; + +namespace Arrowgene.Ddon.Shared.Entity.Structure +{ + public class CDataMyMandragoraBeginCraftResUnk0Unk7 + { + public uint Unk0 { get; set; } + public uint Unk1 { get; set; } + public List Unk2 { get; set; } + public long Unk3 { get; set; } + + public CDataMyMandragoraBeginCraftResUnk0Unk7() + { + Unk2 = new List(); + } + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, CDataMyMandragoraBeginCraftResUnk0Unk7 obj) + { + WriteUInt32(buffer, obj.Unk0); + WriteUInt32(buffer, obj.Unk1); + WriteEntityList(buffer, obj.Unk2); + WriteInt64(buffer, obj.Unk3); + } + + public override CDataMyMandragoraBeginCraftResUnk0Unk7 Read(IBuffer buffer) + { + CDataMyMandragoraBeginCraftResUnk0Unk7 obj = new CDataMyMandragoraBeginCraftResUnk0Unk7(); + obj.Unk0 = ReadUInt32(buffer); + obj.Unk1 = ReadUInt32(buffer); + obj.Unk2 = ReadEntityList(buffer); + obj.Unk3 = ReadInt64(buffer); + return obj; + } + } + } +} diff --git a/Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftResUnk0Unk7Unk2.cs b/Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftResUnk0Unk7Unk2.cs new file mode 100644 index 000000000..62ceb5d2d --- /dev/null +++ b/Arrowgene.Ddon.Shared/Entity/Structure/CDataMyMandragoraBeginCraftResUnk0Unk7Unk2.cs @@ -0,0 +1,27 @@ +using Arrowgene.Buffers; + +namespace Arrowgene.Ddon.Shared.Entity.Structure +{ + public class CDataMyMandragoraBeginCraftResUnk0Unk7Unk2 + { + public uint Unk0 { get; set; } + public ushort Unk1 { get; set; } + + public class Serializer : EntitySerializer + { + public override void Write(IBuffer buffer, CDataMyMandragoraBeginCraftResUnk0Unk7Unk2 obj) + { + WriteUInt32(buffer, obj.Unk0); + WriteUInt16(buffer, obj.Unk1); + } + + public override CDataMyMandragoraBeginCraftResUnk0Unk7Unk2 Read(IBuffer buffer) + { + CDataMyMandragoraBeginCraftResUnk0Unk7Unk2 obj = new CDataMyMandragoraBeginCraftResUnk0Unk7Unk2(); + obj.Unk0 = ReadUInt32(buffer); + obj.Unk1 = ReadUInt16(buffer); + return obj; + } + } + } +} diff --git a/Arrowgene.Ddon.Shared/Files/Assets/GpCourseInfo.json b/Arrowgene.Ddon.Shared/Files/Assets/GpCourseInfo.json index 0ef8f7a95..1496eb632 100644 --- a/Arrowgene.Ddon.Shared/Files/Assets/GpCourseInfo.json +++ b/Arrowgene.Ddon.Shared/Files/Assets/GpCourseInfo.json @@ -9,7 +9,7 @@ ], "valid_courses": [ { - "course_id": 17, + "course_id": 15, "start_time": 1440993600, "end_time": 4103413199, "comment": "Course 17 valid until the year 2100"