Skip to content

Commit

Permalink
Handler for the packet that gets sent when a non party leader throws …
Browse files Browse the repository at this point in the history
…a barrel
  • Loading branch information
alborrajo committed Dec 10, 2023
1 parent 16849c3 commit 91d8ed9
Show file tree
Hide file tree
Showing 6 changed files with 129 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 @@ -210,6 +210,7 @@ private void LoadPacketHandler()
AddHandler(new ConnectionReserveServerHandler(this));

AddHandler(new ContextGetSetContextHandler(this));
AddHandler(new ContextMasterThrowHandler(this));
AddHandler(new ContextSetContextHandler(this));
AddHandler(new CraftGetCraftProgressListHandler(this));
AddHandler(new DailyMissionListGetHandler(this));
Expand Down
30 changes: 30 additions & 0 deletions Arrowgene.Ddon.GameServer/Handler/ContextMasterThrowHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Linq;
using Arrowgene.Ddon.Server;
using Arrowgene.Ddon.Server.Network;
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;

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

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

public override void Handle(GameClient client, StructurePacket<C2SContextMasterThrowReq> packet)
{
client.Send(new S2CContextMasterThrowRes());

client.Party.SendToAll(new S2CContextMasterThrowNtc()
{
Info = packet.Structure.Info
});
}
}
}
3 changes: 3 additions & 0 deletions Arrowgene.Ddon.Shared/Entity/EntitySerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ static EntitySerializer()
Create(new C2SConnectionMoveOutServerReq.Serializer());

Create(new C2SContextGetSetContextReq.Serializer());
Create(new C2SContextMasterThrowReq.Serializer());
Create(new C2SContextSetContextNtc.Serializer());

Create(new C2SEquipChangeCharacterEquipJobItemReq.Serializer());
Expand Down Expand Up @@ -410,6 +411,8 @@ static EntitySerializer()
Create(new S2CContextGetSetContextRes.Serializer());
Create(new S2CContextMasterChangeNtc.Serializer());
Create(new S2CContextMasterInfoNtc.Serializer());
Create(new S2CContextMasterThrowNtc.Serializer());
Create(new S2CContextMasterThrowRes.Serializer());
Create(new S2CContextSetContextBaseNtc.Serializer());
Create(new S2CContextSetContextNtc.Serializer());

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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 C2SContextMasterThrowReq : IPacketStructure
{
public PacketId Id => PacketId.C2S_CONTEXT_MASTER_THROW_REQ;

public C2SContextMasterThrowReq()
{
Info = new List<CDataMasterInfo>();
}

public List<CDataMasterInfo> Info { get; set; }

public class Serializer : PacketEntitySerializer<C2SContextMasterThrowReq>
{
public override void Write(IBuffer buffer, C2SContextMasterThrowReq obj)
{
WriteEntityList<CDataMasterInfo>(buffer, obj.Info);
}

public override C2SContextMasterThrowReq Read(IBuffer buffer)
{
C2SContextMasterThrowReq obj = new C2SContextMasterThrowReq();
obj.Info = ReadEntityList<CDataMasterInfo>(buffer);
return obj;
}
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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 S2CContextMasterThrowNtc : IPacketStructure
{
public PacketId Id => PacketId.S2C_CONTEXT_MASTER_THROW_NTC;

public S2CContextMasterThrowNtc()
{
Info = new List<CDataMasterInfo>();
}

public List<CDataMasterInfo> Info { get; set; }

public class Serializer : PacketEntitySerializer<S2CContextMasterThrowNtc>
{
public override void Write(IBuffer buffer, S2CContextMasterThrowNtc obj)
{
WriteEntityList<CDataMasterInfo>(buffer, obj.Info);
}

public override S2CContextMasterThrowNtc Read(IBuffer buffer)
{
S2CContextMasterThrowNtc obj = new S2CContextMasterThrowNtc();
obj.Info = ReadEntityList<CDataMasterInfo>(buffer);
return obj;
}
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Arrowgene.Buffers;
using Arrowgene.Ddon.Shared.Network;

namespace Arrowgene.Ddon.Shared.Entity.PacketStructure
{
public class S2CContextMasterThrowRes : ServerResponse
{
public override PacketId Id => PacketId.S2C_CONTEXT_MASTER_THROW_RES;

public class Serializer : PacketEntitySerializer<S2CContextMasterThrowRes>
{
public override void Write(IBuffer buffer, S2CContextMasterThrowRes obj)
{
WriteServerResponse(buffer, obj);
}

public override S2CContextMasterThrowRes Read(IBuffer buffer)
{
S2CContextMasterThrowRes obj = new S2CContextMasterThrowRes();
ReadServerResponse(buffer, obj);
return obj;
}
}
}
}

0 comments on commit 91d8ed9

Please sign in to comment.