Skip to content

Commit

Permalink
WIP craft menu.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sehkah committed Sep 10, 2024
1 parent 3cc64cd commit 277d162
Show file tree
Hide file tree
Showing 11 changed files with 420 additions and 3 deletions.
1 change: 1 addition & 0 deletions Arrowgene.Ddon.GameServer/DdonGameServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
50 changes: 50 additions & 0 deletions Arrowgene.Ddon.GameServer/Handler/MandragoraBeginCraftHandler.cs
Original file line number Diff line number Diff line change
@@ -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<C2SMandragoraBeginCraftReq, S2CMandragoraBeginCraftRes>
{
private static readonly ServerLogger Logger = LogProvider.Logger<ServerLogger>(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<CDataMyMandragoraBeginCraftResUnk0Unk7Unk2>
{
new CDataMyMandragoraBeginCraftResUnk0Unk7Unk2
{
Unk0 = 0,
Unk1 = 0
}
},
Unk3 = 0
}
};

return res;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<CDataMyMandragoraCraftRecipeUnk4>
{
Expand Down Expand Up @@ -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<CDataMyMandragoraCraftRecipeUnk4>
{
new CDataMyMandragoraCraftRecipeUnk4
{
Unk0 = 1,
Unk1 = 1
}
},
Unk5 = true,
CraftMaterialList = new List<CDataMDataCraftMaterial>
{
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<CDataMyMandragoraCraftRecipeUnk4>
{
new CDataMyMandragoraCraftRecipeUnk4
{
Unk0 = 1,
Unk1 = 1
}
},
Unk5 = false,
CraftMaterialList = new List<CDataMDataCraftMaterial>
{
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<CDataMyMandragoraCraftRecipeUnk4>
{
new CDataMyMandragoraCraftRecipeUnk4
{
Unk0 = 1,
Unk1 = 1
}
},
Unk5 = true,
CraftMaterialList = new List<CDataMDataCraftMaterial>
{
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
}
}
}
};

Expand Down
6 changes: 6 additions & 0 deletions Arrowgene.Ddon.Shared/Entity/EntitySerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

/// <summary>
/// Recipe ID as provided via the previous GetCraftRecipeList request
/// </summary>
public uint RecipeId { get; set; }
/// <summary>
/// Mandragora chosen to perform crafting.
/// </summary>
public byte MandragoraId { get; set; }
/// <summary>
/// List of items used to "fertilize" or raise the mandragora.
/// </summary>
public List<CDataMyMandragoraBeginCraftFertilizerItem> CraftFertilizerItemList { get; set; }
/// <summary>
/// Actual craft recipe ingredient items.
/// </summary>
public List<CDataCraftMaterial> CraftMaterialList { get; set; }

public C2SMandragoraBeginCraftReq()
{
CraftMaterialList = new List<CDataCraftMaterial>();
}

public class Serializer : PacketEntitySerializer<C2SMandragoraBeginCraftReq>
{
public override void Write(IBuffer buffer, C2SMandragoraBeginCraftReq obj)
{
WriteUInt32(buffer, obj.RecipeId);
WriteByte(buffer, obj.MandragoraId);
WriteEntityList<CDataMyMandragoraBeginCraftFertilizerItem>(buffer, obj.CraftFertilizerItemList);
WriteEntityList<CDataCraftMaterial>(buffer, obj.CraftMaterialList);
}

public override C2SMandragoraBeginCraftReq Read(IBuffer buffer)
{
C2SMandragoraBeginCraftReq obj = new C2SMandragoraBeginCraftReq();

obj.RecipeId = ReadUInt32(buffer);
obj.MandragoraId = ReadByte(buffer);
obj.CraftFertilizerItemList = ReadEntityList<CDataMyMandragoraBeginCraftFertilizerItem>(buffer);
obj.CraftMaterialList = ReadEntityList<CDataCraftMaterial>(buffer);

return obj;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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<S2CMandragoraBeginCraftRes>
{
public override void Write(IBuffer buffer, S2CMandragoraBeginCraftRes obj)
{
WriteServerResponse(buffer, obj);

WriteEntity<CDataMyMandragoraBeginCraftResUnk0>(buffer, obj.Unk0);
}

public override S2CMandragoraBeginCraftRes Read(IBuffer buffer)
{
S2CMandragoraBeginCraftRes obj = new S2CMandragoraBeginCraftRes();

ReadServerResponse(buffer, obj);

obj.Unk0 = ReadEntity<CDataMyMandragoraBeginCraftResUnk0>(buffer);

return obj;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System.Collections.Generic;
using Arrowgene.Buffers;

namespace Arrowgene.Ddon.Shared.Entity.Structure
{
public class CDataMyMandragoraBeginCraftFertilizerItem
{
/// <summary>
/// ItemUID, taken from the lefthand side of the menu where you choose fertilizer items
/// </summary>
public string ItemUID { get; set; }
/// <summary>
/// Always 1
/// </summary>
public byte ItemNum { get; set; }

public class Serializer : EntitySerializer<CDataMyMandragoraBeginCraftFertilizerItem>
{
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;
}
}
}
}
Loading

0 comments on commit 277d162

Please sign in to comment.