From 13b8517062c3ef58fbf9496c2aa4aba5fdfff6db Mon Sep 17 00:00:00 2001 From: Rutherther Date: Sat, 31 Dec 2022 00:56:14 +0100 Subject: [PATCH] fix(packets): correctly use cast id instead of vnum in UseSkill packet --- .../Apis/NostaleSkillsPacketApi.cs | 26 +++++++++++++------ .../Entities/SkillUsedResponder.cs | 2 +- .../Client/Battle/UseSkillPacket.cs | 2 +- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Core/NosSmooth.Game/Apis/NostaleSkillsPacketApi.cs b/Core/NosSmooth.Game/Apis/NostaleSkillsPacketApi.cs index 67c1e67..dd31fe3 100644 --- a/Core/NosSmooth.Game/Apis/NostaleSkillsPacketApi.cs +++ b/Core/NosSmooth.Game/Apis/NostaleSkillsPacketApi.cs @@ -37,7 +37,7 @@ public class NostaleSkillsPacketApi /// For skills that can be used only on self, use of the character. /// For skills that cannot be targeted on an entity, proceed to . /// - /// The id of the skill. + /// The cast id of the skill. /// The id of the entity to use the skill on. /// The type of the supplied entity. /// The x coordinate on the map. (Used for non targeted dashes etc., says where the dash will be to.) @@ -46,7 +46,7 @@ public class NostaleSkillsPacketApi /// A result that may or may not have succeeded. public Task UseSkillOn ( - long skillVNum, + short castId, long entityId, EntityType entityType, short? mapX = default, @@ -58,7 +58,7 @@ public class NostaleSkillsPacketApi ( new UseSkillPacket ( - skillVNum, + castId, entityType, entityId, mapX, @@ -75,7 +75,7 @@ public class NostaleSkillsPacketApi /// For skills that can be used only on self, use of the character. /// For skills that cannot be targeted on an entity, proceed to . /// - /// The id of the skill. + /// The cast id of the skill. /// The entity to use the skill on. /// The x coordinate on the map. (Used for non targeted dashes etc., says where the dash will be to.) /// The y coordinate on the map. (Used for non targeted dashes etc., says where the dash will be to.) @@ -83,7 +83,7 @@ public class NostaleSkillsPacketApi /// A result that may or may not have succeeded. public Task UseSkillOn ( - long skillVNum, + short castId, ILivingEntity entity, short? mapX = default, short? mapY = default, @@ -94,7 +94,7 @@ public class NostaleSkillsPacketApi ( new UseSkillPacket ( - skillVNum, + castId, entity.Type, entity.Id, mapX, @@ -132,11 +132,16 @@ public class NostaleSkillsPacketApi return Task.FromResult(new SkillOnCooldownError(skill)); } + if (skill.Info is null) + { + return Task.FromResult(new GenericError("Skill does not contain info.")); + } + return _client.SendPacketAsync ( new UseSkillPacket ( - skill.SkillVNum, + skill.Info.CastId, entity.Type, entity.Id, mapX, @@ -175,11 +180,16 @@ public class NostaleSkillsPacketApi return Task.FromResult(new SkillOnCooldownError(skill)); } + if (skill.Info is null) + { + return Task.FromResult(new GenericError("Skill does not contain info.")); + } + return _client.SendPacketAsync ( new UseSkillPacket ( - skill.SkillVNum, + skill.Info.CastId, entityType, entityId, mapX, diff --git a/Core/NosSmooth.Game/PacketHandlers/Entities/SkillUsedResponder.cs b/Core/NosSmooth.Game/PacketHandlers/Entities/SkillUsedResponder.cs index 6ee25da..8c2fac8 100644 --- a/Core/NosSmooth.Game/PacketHandlers/Entities/SkillUsedResponder.cs +++ b/Core/NosSmooth.Game/PacketHandlers/Entities/SkillUsedResponder.cs @@ -179,7 +179,7 @@ public class SkillUsedResponder : IPacketResponder, IPacketResponder