-
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.
- Loading branch information
Showing
8 changed files
with
209 additions
and
39 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
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
30 changes: 30 additions & 0 deletions
30
Arrowgene.Ddon.GameServer/Handler/SkillLearnPawnSkillHandler.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,30 @@ | ||
using System.Linq; | ||
using Arrowgene.Ddon.GameServer.Characters; | ||
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 SkillLearnPawnSkillHandler : GameStructurePacketHandler<C2SSkillLearnPawnSkillReq> | ||
{ | ||
private static readonly ServerLogger Logger = LogProvider.Logger<ServerLogger>(typeof(SkillLearnPawnSkillHandler)); | ||
|
||
private readonly JobManager jobManager; | ||
|
||
public SkillLearnPawnSkillHandler(DdonGameServer server) : base(server) | ||
{ | ||
this.jobManager = server.JobManager; | ||
} | ||
|
||
public override void Handle(GameClient client, StructurePacket<C2SSkillLearnPawnSkillReq> packet) | ||
{ | ||
Pawn pawn = client.Character.Pawns.Where(pawn => pawn.PawnId == packet.Structure.PawnId).Single(); | ||
this.jobManager.UnlockSkill(Server.Database, client, pawn, packet.Structure.Job, packet.Structure.SkillId, packet.Structure.SkillLv); | ||
} | ||
} | ||
} |
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
38 changes: 38 additions & 0 deletions
38
Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SSkillLearnPawnSkillReq.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,38 @@ | ||
using Arrowgene.Buffers; | ||
using Arrowgene.Ddon.Shared.Model; | ||
using Arrowgene.Ddon.Shared.Network; | ||
|
||
namespace Arrowgene.Ddon.Shared.Entity.PacketStructure | ||
{ | ||
public class C2SSkillLearnPawnSkillReq : IPacketStructure | ||
{ | ||
public PacketId Id => PacketId.C2S_SKILL_LEARN_PAWN_SKILL_REQ; | ||
|
||
public uint PawnId { get; set; } | ||
public JobId Job { get; set; } | ||
public uint SkillId { get; set; } | ||
public byte SkillLv { get; set; } | ||
|
||
public class Serializer : PacketEntitySerializer<C2SSkillLearnPawnSkillReq> | ||
{ | ||
public override void Write(IBuffer buffer, C2SSkillLearnPawnSkillReq obj) | ||
{ | ||
WriteUInt32(buffer, obj.PawnId); | ||
WriteByte(buffer, (byte) obj.Job); | ||
WriteUInt32(buffer, obj.SkillId); | ||
WriteByte(buffer, obj.SkillLv); | ||
} | ||
|
||
public override C2SSkillLearnPawnSkillReq Read(IBuffer buffer) | ||
{ | ||
C2SSkillLearnPawnSkillReq obj = new C2SSkillLearnPawnSkillReq(); | ||
obj.PawnId = ReadUInt32(buffer); | ||
obj.Job = (JobId) ReadByte(buffer); | ||
obj.SkillId = ReadUInt32(buffer); | ||
obj.SkillLv = ReadByte(buffer); | ||
return obj; | ||
} | ||
} | ||
|
||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CSkillLearnPawnSkillRes.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,42 @@ | ||
using Arrowgene.Buffers; | ||
using Arrowgene.Ddon.Shared.Model; | ||
using Arrowgene.Ddon.Shared.Network; | ||
|
||
namespace Arrowgene.Ddon.Shared.Entity.PacketStructure | ||
{ | ||
public class S2CSkillLearnPawnSkillRes : ServerResponse | ||
{ | ||
public override PacketId Id => PacketId.S2C_SKILL_LEARN_PAWN_SKILL_RES; | ||
|
||
public uint PawnId { get; set; } | ||
public JobId Job { get; set; } | ||
public uint NewJobPoint { get; set; } | ||
public uint SkillId { get; set; } | ||
public byte SkillLv { get; set; } | ||
|
||
public class Serializer : PacketEntitySerializer<S2CSkillLearnPawnSkillRes> | ||
{ | ||
public override void Write(IBuffer buffer, S2CSkillLearnPawnSkillRes obj) | ||
{ | ||
WriteServerResponse(buffer, obj); | ||
WriteUInt32(buffer, obj.PawnId); | ||
WriteByte(buffer, (byte) obj.Job); | ||
WriteUInt32(buffer, obj.NewJobPoint); | ||
WriteUInt32(buffer, obj.SkillId); | ||
WriteByte(buffer, obj.SkillLv); | ||
} | ||
|
||
public override S2CSkillLearnPawnSkillRes Read(IBuffer buffer) | ||
{ | ||
S2CSkillLearnPawnSkillRes obj = new S2CSkillLearnPawnSkillRes(); | ||
ReadServerResponse(buffer, obj); | ||
obj.PawnId = ReadUInt32(buffer); | ||
obj.Job = (JobId) ReadByte(buffer); | ||
obj.NewJobPoint = ReadUInt32(buffer); | ||
obj.SkillId = ReadUInt32(buffer); | ||
obj.SkillLv = ReadByte(buffer); | ||
return obj; | ||
} | ||
} | ||
} | ||
} |