-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from alborrajo/feature/npcs
Working enemies and other NPCs
- Loading branch information
Showing
15 changed files
with
370 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Arrowgene.Ddon.GameServer/Handler/InstanceEnemyKillHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SContextGetSetContextReq.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using Arrowgene.Buffers; | ||
using Arrowgene.Ddon.Shared.Network; | ||
|
||
namespace Arrowgene.Ddon.Shared.Entity.PacketStructure | ||
{ | ||
public class C2SContextGetSetContextReq : IPacketStructure | ||
{ | ||
public PacketId Id => PacketId.C2S_CONTEXT_GET_SET_CONTEXT_REQ; | ||
|
||
public C2SContextGetSetContextReq() | ||
{ | ||
ContextId=0; | ||
UniqueId=0; | ||
StageNo=0; | ||
EncountArea=0; | ||
MasterIndex=0; | ||
Unk0=0; | ||
} | ||
|
||
public uint ContextId { get; set; } // "Id" in the client code, renamed to ContextId to avoid collision with PacketId | ||
public ulong UniqueId { get; set; } | ||
public int StageNo { get; set; } | ||
public int EncountArea { get; set; } | ||
public int MasterIndex { get; set; } | ||
public uint Unk0 { get; set; } | ||
|
||
public class Serializer : EntitySerializer<C2SContextGetSetContextReq> | ||
{ | ||
public override void Write(IBuffer buffer, C2SContextGetSetContextReq obj) | ||
{ | ||
WriteUInt32(buffer, obj.ContextId); | ||
WriteUInt64(buffer, obj.UniqueId); | ||
WriteInt32(buffer, obj.StageNo); | ||
WriteInt32(buffer, obj.EncountArea); | ||
WriteInt32(buffer, obj.MasterIndex); | ||
WriteUInt32(buffer, obj.Unk0); | ||
} | ||
|
||
public override C2SContextGetSetContextReq Read(IBuffer buffer) | ||
{ | ||
C2SContextGetSetContextReq obj = new C2SContextGetSetContextReq(); | ||
obj.ContextId = ReadUInt32(buffer); | ||
obj.UniqueId = ReadUInt64(buffer); | ||
obj.StageNo = ReadInt32(buffer); | ||
obj.EncountArea = ReadInt32(buffer); | ||
obj.MasterIndex = ReadInt32(buffer); | ||
obj.Unk0 = ReadUInt32(buffer); | ||
return obj; | ||
} | ||
} | ||
|
||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SInstanceEnemyKillReq.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CContextGetSetContextRes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 S2CContextGetSetContextRes : ServerResponse | ||
{ | ||
public override PacketId Id => PacketId.S2C_CONTEXT_GET_SET_CONTEXT_RES; | ||
|
||
public class Serializer : EntitySerializer<S2CContextGetSetContextRes> | ||
{ | ||
public override void Write(IBuffer buffer, S2CContextGetSetContextRes obj) | ||
{ | ||
WriteServerResponse(buffer, obj); | ||
} | ||
|
||
public override S2CContextGetSetContextRes Read(IBuffer buffer) | ||
{ | ||
S2CContextGetSetContextRes obj = new S2CContextGetSetContextRes(); | ||
ReadServerResponse(buffer, obj); | ||
return obj; | ||
} | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CContext_35_14_16_Ntc.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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 S2CContext_35_14_16_Ntc : IPacketStructure | ||
{ | ||
public PacketId Id => PacketId.S2C_CONTEXT_35_14_16_NTC; | ||
|
||
public S2CContext_35_14_16_Ntc() | ||
{ | ||
Unk0 = new List<CData_35_14_16>(); | ||
} | ||
|
||
public List<CData_35_14_16> Unk0 { get; set; } // Probably a list of heartbeats for the different contexts? | ||
|
||
public class Serializer : EntitySerializer<S2CContext_35_14_16_Ntc> | ||
{ | ||
public override void Write(IBuffer buffer, S2CContext_35_14_16_Ntc obj) | ||
{ | ||
WriteEntityList<CData_35_14_16>(buffer, obj.Unk0); | ||
} | ||
|
||
public override S2CContext_35_14_16_Ntc Read(IBuffer buffer) | ||
{ | ||
S2CContext_35_14_16_Ntc obj = new S2CContext_35_14_16_Ntc(); | ||
obj.Unk0 = ReadEntityList<CData_35_14_16>(buffer); | ||
return obj; | ||
} | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CInstanceEnemyKillRes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.