Skip to content

Commit

Permalink
Merge pull request #272 from pacampbell/fix_common_crafting_hangs
Browse files Browse the repository at this point in the history
feat: Add empty handler for craft skill analyze option
  • Loading branch information
alborrajo authored Apr 28, 2024
2 parents 3c64a56 + c59941c commit 4f0bf75
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 0 deletions.
1 change: 1 addition & 0 deletions Arrowgene.Ddon.GameServer/DdonGameServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ private void LoadPacketHandler()
AddHandler(new CraftGetCraftSettingHandler(this));
AddHandler(new CraftRecipeGetCraftRecipeHandler(this));
AddHandler(new CraftStartCraftHandler(this));
AddHandler(new CraftSkillAnalyzeHandler(this));

AddHandler(new DailyMissionListGetHandler(this));

Expand Down
32 changes: 32 additions & 0 deletions Arrowgene.Ddon.GameServer/Handler/CraftSkillAnalyzeHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Linq;
using Arrowgene.Ddon.GameServer.Characters;
using Arrowgene.Ddon.Server;
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
using Arrowgene.Ddon.Shared.Entity.Structure;
using Arrowgene.Ddon.Shared.Model;
using Arrowgene.Ddon.Shared.Network;
using Arrowgene.Logging;
using System;

namespace Arrowgene.Ddon.GameServer.Handler
{
public class CraftSkillAnalyzeHandler : GameStructurePacketHandler<C2SCraftSkillAnalyzeReq>
{
private static readonly ServerLogger Logger = LogProvider.Logger<ServerLogger>(typeof(CraftSkillAnalyzeHandler));


public CraftSkillAnalyzeHandler(DdonGameServer server) : base(server)
{
}

public override void Handle(GameClient client, StructurePacket<C2SCraftSkillAnalyzeReq> packet)
{
S2CCraftSkillAnalyzeRes resp = new S2CCraftSkillAnalyzeRes()
{
Result = 0
};

client.Send(resp);
}
}
}
3 changes: 3 additions & 0 deletions Arrowgene.Ddon.Shared/Entity/EntitySerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ static EntitySerializer()
Create(new CDataCraftSkillRate.Serializer());
Create(new CDataCraftSupportPawnID.Serializer());
Create(new CDataCraftTimeSaveCost.Serializer());
Create(new CDataCraftSkillAnalyzeResult.Serializer());
Create(new CDataDeliveredItem.Serializer());
Create(new CDataDeliveredItemRecord.Serializer());
Create(new CDataDeliveryItem.Serializer());
Expand Down Expand Up @@ -277,6 +278,7 @@ static EntitySerializer()
Create(new C2SCraftGetCraftSettingReq.Serializer());
Create(new C2SCraftRecipeGetCraftRecipeReq.Serializer());
Create(new C2SCraftStartCraftReq.Serializer());
Create(new C2SCraftSkillAnalyzeReq.Serializer());

Create(new C2SEquipChangeCharacterEquipJobItemReq.Serializer());
Create(new C2SEquipChangeCharacterEquipReq.Serializer());
Expand Down Expand Up @@ -494,6 +496,7 @@ static EntitySerializer()
Create(new S2CCraftGetCraftSettingRes.Serializer());
Create(new S2CCraftRecipeGetCraftRecipeRes.Serializer());
Create(new S2CCraftStartCraftRes.Serializer());
Create(new S2CCraftSkillAnalyzeRes.Serializer());

Create(new S2CEquipChangeCharacterEquipJobItemNtc.Serializer());
Create(new S2CEquipChangeCharacterEquipJobItemRes.Serializer());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;
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 C2SCraftSkillAnalyzeReq : IPacketStructure
{
public PacketId Id => PacketId.C2S_CRAFT_CRAFT_SKILL_ANALYZE_REQ;

public C2SCraftSkillAnalyzeReq()
{
AssistPawnIds = new List<CDataCommonU32>();
}

public byte CraftType { get; set; }
public UInt32 RecipeId { get; set; }
public UInt32 ItemId { get; set; }
public UInt32 PawnId { get; set; }
public List<CDataCommonU32> AssistPawnIds { get; set; }
public UInt32 CreateCount { get; set; }

public class Serializer : PacketEntitySerializer<C2SCraftSkillAnalyzeReq>
{
public override void Write(IBuffer buffer, C2SCraftSkillAnalyzeReq obj)
{
WriteByte(buffer, obj.CraftType);
WriteUInt32(buffer, obj.RecipeId);
WriteUInt32(buffer, obj.ItemId);
WriteEntityList<CDataCommonU32>(buffer, obj.AssistPawnIds);
WriteUInt32(buffer, obj.CreateCount);
}

public override C2SCraftSkillAnalyzeReq Read(IBuffer buffer)
{
C2SCraftSkillAnalyzeReq obj = new C2SCraftSkillAnalyzeReq();
obj.CraftType = ReadByte(buffer);
obj.RecipeId = ReadUInt32(buffer);
obj.ItemId = ReadUInt32(buffer);
obj.AssistPawnIds = ReadEntityList<CDataCommonU32>(buffer);
obj.CreateCount = ReadUInt32(buffer);
return obj;
}
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
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 S2CCraftSkillAnalyzeRes : ServerResponse
{
public override PacketId Id => PacketId.S2C_CRAFT_CRAFT_SKILL_ANALYZE_RES;

public S2CCraftSkillAnalyzeRes()
{
AnalyzeResultList = new List<CDataCraftSkillAnalyzeResult>();
}

public Int32 ReqResult { get; set; } // renamed from result due to name conflict
public List<CDataCraftSkillAnalyzeResult> AnalyzeResultList { get; set; }

public class Serializer : PacketEntitySerializer<S2CCraftSkillAnalyzeRes>
{
public override void Write(IBuffer buffer, S2CCraftSkillAnalyzeRes obj)
{
WriteServerResponse(buffer, obj);
WriteInt32(buffer, obj.ReqResult);
WriteEntityList<CDataCraftSkillAnalyzeResult>(buffer, obj.AnalyzeResultList);
}

public override S2CCraftSkillAnalyzeRes Read(IBuffer buffer)
{
S2CCraftSkillAnalyzeRes obj = new S2CCraftSkillAnalyzeRes();
ReadServerResponse(buffer, obj);
obj.ReqResult = ReadInt32(buffer);
obj.AnalyzeResultList = ReadEntityList<CDataCraftSkillAnalyzeResult>(buffer);
return obj;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using Arrowgene.Buffers;
using Arrowgene.Ddon.Shared.Model;

namespace Arrowgene.Ddon.Shared.Entity.Structure
{
public class CDataCraftSkillAnalyzeResult
{
public CDataCraftSkillAnalyzeResult()
{
}

public byte SkillType { get; set; }
public byte Rate { get; set; }
public UInt32 Value0 { get; set; }
public UInt32 Value1 { get; set; }

public class Serializer : EntitySerializer<CDataCraftSkillAnalyzeResult>
{
public override void Write(IBuffer buffer, CDataCraftSkillAnalyzeResult obj)
{
WriteByte(buffer, obj.SkillType);
WriteByte(buffer, obj.Rate);
WriteUInt32(buffer, obj.Value0);
WriteUInt32(buffer, obj.Value1);
}

public override CDataCraftSkillAnalyzeResult Read(IBuffer buffer)
{
CDataCraftSkillAnalyzeResult obj = new CDataCraftSkillAnalyzeResult();
obj.SkillType = ReadByte(buffer);
obj.Rate = ReadByte(buffer);
obj.Value0 = ReadUInt32(buffer);
obj.Value1 = ReadUInt32(buffer);
return obj;
}
}
}
}

0 comments on commit 4f0bf75

Please sign in to comment.