~ruther/NosSmooth

13b8517062c3ef58fbf9496c2aa4aba5fdfff6db — Rutherther 2 years ago 063ebd5
fix(packets): correctly use cast id instead of vnum in UseSkill packet
M Core/NosSmooth.Game/Apis/NostaleSkillsPacketApi.cs => Core/NosSmooth.Game/Apis/NostaleSkillsPacketApi.cs +18 -8
@@ 37,7 37,7 @@ public class NostaleSkillsPacketApi
    /// For skills that can be used only on self, use <paramref name="entityId"/> of the character.
    /// For skills that cannot be targeted on an entity, proceed to <see cref="UseSkillAt"/>.
    /// </remarks>
    /// <param name="skillVNum">The id of the skill.</param>
    /// <param name="castId">The cast id of the skill.</param>
    /// <param name="entityId">The id of the entity to use the skill on.</param>
    /// <param name="entityType">The type of the supplied entity.</param>
    /// <param name="mapX">The x coordinate on the map. (Used for non targeted dashes etc., says where the dash will be to.)</param>


@@ 46,7 46,7 @@ public class NostaleSkillsPacketApi
    /// <returns>A result that may or may not have succeeded.</returns>
    public Task<Result> 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 <paramref name="entityId"/> of the character.
    /// For skills that cannot be targeted on an entity, proceed to <see cref="UseSkillAt"/>.
    /// </remarks>
    /// <param name="skillVNum">The id of the skill.</param>
    /// <param name="castId">The cast id of the skill.</param>
    /// <param name="entity">The entity to use the skill on.</param>
    /// <param name="mapX">The x coordinate on the map. (Used for non targeted dashes etc., says where the dash will be to.)</param>
    /// <param name="mapY">The y coordinate on the map. (Used for non targeted dashes etc., says where the dash will be to.)</param>


@@ 83,7 83,7 @@ public class NostaleSkillsPacketApi
    /// <returns>A result that may or may not have succeeded.</returns>
    public Task<Result> 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<Result>(new SkillOnCooldownError(skill));
        }

        if (skill.Info is null)
        {
            return Task.FromResult<Result>(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<Result>(new SkillOnCooldownError(skill));
        }

        if (skill.Info is null)
        {
            return Task.FromResult<Result>(new GenericError("Skill does not contain info."));
        }

        return _client.SendPacketAsync
        (
            new UseSkillPacket
            (
                skill.SkillVNum,
                skill.Info.CastId,
                entityType,
                entityId,
                mapX,

M Core/NosSmooth.Game/PacketHandlers/Entities/SkillUsedResponder.cs => Core/NosSmooth.Game/PacketHandlers/Entities/SkillUsedResponder.cs +1 -1
@@ 179,7 179,7 @@ public class SkillUsedResponder : IPacketResponder<SuPacket>, IPacketResponder<S

        if (character is not null && character.Skills is not null)
        {
            var skillResult = character.Skills.TryGetSkillByVNum(packet.SkillId);
            var skillResult = character.Skills.TryGetSkillByCastId(packet.CastId);

            if (skillResult.IsDefined(out var skillEntity))
            {

M Packets/NosSmooth.Packets/Client/Battle/UseSkillPacket.cs => Packets/NosSmooth.Packets/Client/Battle/UseSkillPacket.cs +1 -1
@@ 20,7 20,7 @@ namespace NosSmooth.Packets.Client.Battle;
public record UseSkillPacket
(
    [PacketIndex(0)]
    long SkillId,
    short CastId,
    [PacketIndex(1)]
    EntityType TargetEntityType,
    [PacketIndex(2)]

Do not follow this link