Skip to content

Commit

Permalink
Basic InstanceEnemyKill handling
Browse files Browse the repository at this point in the history
  • Loading branch information
alborrajo committed Feb 7, 2022
1 parent 414f26e commit 5b77b25
Show file tree
Hide file tree
Showing 7 changed files with 130 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 @@ -125,6 +125,7 @@ private void LoadPacketHandler()

AddHandler(new GroupChatGroupChatGetMemberListHandler(this));

AddHandler(new InstanceEnemyKillHandler(this));
AddHandler(new InstanceGetEnemySetListHandler(this));
AddHandler(new InstanceGetItemSetListHandler(this));

Expand Down
23 changes: 23 additions & 0 deletions Arrowgene.Ddon.GameServer/Handler/InstanceEnemyKillHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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 InstanceEnemyKillHandler : StructurePacketHandler<GameClient, C2SInstanceEnemyKillReq>
{
private static readonly ServerLogger Logger = LogProvider.Logger<ServerLogger>(typeof(InstanceEnemyKillHandler));


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

public override void Handle(GameClient client, StructurePacket<C2SInstanceEnemyKillReq> packet)
{
client.Send(new S2CInstanceEnemyKillRes());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public override void Handle(GameClient client, StructurePacket<C2SInstanceGetEne
CDataLayoutEnemyData layoutEnemyData = new CDataLayoutEnemyData();
layoutEnemyData.EnemyInfo.EnemyId = 0x010314;
layoutEnemyData.EnemyInfo.NamedEnemyParamsId = 0x8FA;
layoutEnemyData.EnemyInfo.Scale = 0x64; // Normal
layoutEnemyData.EnemyInfo.Lv = 0x5E;
layoutEnemyData.EnemyInfo.Scale = 100;
layoutEnemyData.EnemyInfo.Lv = 94;
layoutEnemyData.EnemyInfo.EnemyTargetTypesId = 1;
response.EnemyList.Add(layoutEnemyData);

Expand Down
2 changes: 2 additions & 0 deletions Arrowgene.Ddon.Shared/Entity/EntitySerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public abstract class EntitySerializer
Create(new C2SConnectionMoveInServerReq.Serializer()),
Create(new C2SConnectionMoveOutServerReq.Serializer()),
Create(new C2SContextGetSetContextReq.Serializer()),
Create(new C2SInstanceEnemyKillReq.Serializer()),
Create(new C2SInstanceGetEnemySetListReqSerializer()),
Create(new C2SLobbyChatMsgReq.Serializer()),
Create(new C2SLobbyJoinReq.Serializer()),
Expand Down Expand Up @@ -103,6 +104,7 @@ public abstract class EntitySerializer
Create(new S2CConnectionMoveOutServerRes.Serializer()),
Create(new S2CContext_35_14_16_Ntc.Serializer()),
Create(new S2CContextGetSetContextRes.Serializer()),
Create(new S2CInstanceEnemyKillRes.Serializer()),
Create(new S2CInstanceEnemyRepopNtc.Serializer()),
Create(new S2CInstanceGetEnemySetListRes.Serializer()),
Create(new S2CLobbyChatMsgRes.Serializer()),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using Arrowgene.Buffers;
using Arrowgene.Ddon.Shared.Entity.Structure;
using Arrowgene.Ddon.Shared.Network;

namespace Arrowgene.Ddon.Shared.Entity.PacketStructure
{
public class C2SInstanceEnemyKillReq : IPacketStructure
{
public PacketId Id => PacketId.C2S_INSTANCE_ENEMY_KILL_REQ;

public C2SInstanceEnemyKillReq()
{
LayoutId=new CStageLayoutID();
SetId=0;
InnerId=0;
DropPosX=0;
DropPosY=0;
DropPosZ=0;
IsNoBattleReword=false;
Unk0=false;
RegionFlag=0;
}

public CStageLayoutID LayoutId { get; set; }
public uint SetId { get; set; }
public uint InnerId { get; set; }
public double DropPosX { get; set; }
public float DropPosY { get; set; }
public double DropPosZ { get; set; }
public bool IsNoBattleReword { get; set; }
public bool Unk0 { get; set; } // It's possible that IsNoBattleReword is this data instead
public uint RegionFlag { get; set; }

public class Serializer : EntitySerializer<C2SInstanceEnemyKillReq>
{
public override void Write(IBuffer buffer, C2SInstanceEnemyKillReq obj)
{
WriteEntity<CStageLayoutID>(buffer, obj.LayoutId);
WriteUInt32(buffer, obj.SetId);
WriteUInt32(buffer, obj.InnerId);
WriteDouble(buffer, obj.DropPosX);
WriteFloat(buffer, obj.DropPosY);
WriteDouble(buffer, obj.DropPosZ);
WriteBool(buffer, obj.IsNoBattleReword);
WriteBool(buffer, obj.Unk0);
WriteUInt32(buffer, obj.RegionFlag);
}

public override C2SInstanceEnemyKillReq Read(IBuffer buffer)
{
C2SInstanceEnemyKillReq obj = new C2SInstanceEnemyKillReq();
obj.LayoutId = ReadEntity<CStageLayoutID>(buffer);
obj.SetId = ReadUInt32(buffer);
obj.InnerId = ReadUInt32(buffer);
obj.DropPosX = ReadDouble(buffer);
obj.DropPosY = ReadFloat(buffer);
obj.DropPosZ = ReadDouble(buffer);
obj.IsNoBattleReword = ReadBool(buffer);
obj.Unk0 = ReadBool(buffer);
obj.RegionFlag = ReadUInt32(buffer);
return obj;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Arrowgene.Buffers;
using Arrowgene.Ddon.Shared.Network;

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

public S2CInstanceEnemyKillRes()
{
EnemyId = 0;
KillNum = 0;
}

public uint EnemyId { get; set; }
public uint KillNum { get; set; }

public class Serializer : EntitySerializer<S2CInstanceEnemyKillRes>
{
public override void Write(IBuffer buffer, S2CInstanceEnemyKillRes obj)
{
WriteUInt32(buffer, obj.EnemyId);
WriteUInt32(buffer, obj.KillNum);
}

public override S2CInstanceEnemyKillRes Read(IBuffer buffer)
{
S2CInstanceEnemyKillRes obj = new S2CInstanceEnemyKillRes();
obj.EnemyId = ReadUInt32(buffer);
obj.KillNum = ReadUInt32(buffer);
return obj;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public CDataStageLayoutEnemyPresetEnemyInfoClient()
public uint EnemyId { get; set; }
public uint NamedEnemyParamsId { get; set; }
public uint RaidBossId { get; set; }
public ushort Scale { get; set; }
public ushort Scale { get; set; } // Scale as a percentage, 100(%) is normal
public ushort Lv { get; set; } // Level
public ushort HmPresetNo { get; set; } // Preset for human enemies?
public byte StartThinkTblNo { get; set; } // Start Think Table Number???
Expand Down

0 comments on commit 5b77b25

Please sign in to comment.