~ruther/NosSmooth

01ab7fbbe37bfbc731de188df6b711176ce2f2bb — František Boháček 3 years ago 19aaedd
feat: add helper data records
A Core/NosSmooth.Game/Data/Characters/Skill.cs => Core/NosSmooth.Game/Data/Characters/Skill.cs +34 -0
@@ 0,0 1,34 @@
//
//  Skill.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace NosSmooth.Game.Data.Characters;

/// <summary>
/// Represents nostale skill entity.
/// </summary>
/// <param name="SkillVNum">The vnum of the skill.</param>
/// <param name="Level">The level of the skill. Unknown feature.</param>
public record Skill(long SkillVNum, int? Level = default)
{
    /// <summary>
    /// Gets the last time this skill was used.
    /// </summary>
    public DateTimeOffset LastUseTime { get; internal set; }

    /// <summary>
    /// Gets the cooldown of the skill.
    /// </summary>
    public TimeSpan? Cooldown { get; internal set; }

    /// <summary>
    /// Gets whether the skill is on cooldown.
    /// </summary>
    /// <remarks>
    /// This is set when the server sends sr packet,
    /// prefer to use this instead of checking the LastUseTime and Cooldown.
    /// </remarks>
    public bool IsOnCooldown { get; internal set; }
}
\ No newline at end of file

A Core/NosSmooth.Game/Data/Characters/Skills.cs => Core/NosSmooth.Game/Data/Characters/Skills.cs +20 -0
@@ 0,0 1,20 @@
//
//  Skills.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace NosSmooth.Game.Data.Characters;

/// <summary>
/// Holds skill of a Character.
/// </summary>
/// <param name="PrimarySkill">The VNum of the primary skill. This skill is used with the primary weapon. (Could be different for sp cards.)</param>
/// <param name="SecondarySkill">The VNum of the secondary skill. This skill is used with the secondary weapon. (Could be different for sp cards)</param>
/// <param name="OtherSkills">The VNums of other skills.</param>
public record Skills
(
    Skill PrimarySkill,
    Skill SecondarySkill,
    IReadOnlyList<Skill> OtherSkills
);
\ No newline at end of file

A Core/NosSmooth.Game/Data/Entities/IPet.cs => Core/NosSmooth.Game/Data/Entities/IPet.cs +14 -0
@@ 0,0 1,14 @@
//
//  IPet.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace NosSmooth.Game.Data.Entities;

/// <summary>
/// Represents base type for a pet or a partner.
/// </summary>
public interface IPet
{
}
\ No newline at end of file

A Core/NosSmooth.Game/Data/Info/Health.cs => Core/NosSmooth.Game/Data/Info/Health.cs +17 -0
@@ 0,0 1,17 @@
//
//  Health.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace NosSmooth.Game.Data.Info;

/// <summary>
/// Represents the health or mana of an entity.
/// </summary>
/// <param name="Amount">The current amount of health.</param>
/// <param name="Maximum">The maximum amount of health.</param>
public record Health(long Amount, long Maximum)
{
    private decimal Percentage => (decimal)Amount / Maximum;
}
\ No newline at end of file

A Core/NosSmooth.Game/Data/Info/Level.cs => Core/NosSmooth.Game/Data/Info/Level.cs +15 -0
@@ 0,0 1,15 @@
//
//  Level.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace NosSmooth.Game.Data.Info;

/// <summary>
/// Represents a level, such as job level, hero level, character level.
/// </summary>
/// <param name="Lvl">The level.</param>
/// <param name="Xp">Current xp.</param>
/// <param name="XpLoad">Maximum xp of the current level.</param>
public record Level(ushort Lvl, long Xp, long XpLoad);
\ No newline at end of file

A Core/NosSmooth.Game/Data/Info/Morph.cs => Core/NosSmooth.Game/Data/Info/Morph.cs +28 -0
@@ 0,0 1,28 @@
//
//  Morph.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace NosSmooth.Game.Data.Info;

/// <summary>
/// Represents players morph.
/// </summary>
/// <remarks>
/// Morphs are used mainly for special cards.
/// The VNum will contain the vnum of the special card.
/// </remarks>
/// <param name="VNum">The vnum of the morph.</param>
/// <param name="Upgrade">The upgrade to show wings.</param>
/// <param name="Design">The design of the wings.</param>
/// <param name="Bonus">Unknown.</param>
/// <param name="Skin">The skin of the wings.</param>
public record Morph
(
    long VNum,
    byte Upgrade,
    short? Design = default,
    byte? Bonus = default,
    short? Skin = default
);
\ No newline at end of file

A Core/NosSmooth.Game/Data/Maps/MinilandObject.cs => Core/NosSmooth.Game/Data/Maps/MinilandObject.cs +9 -0
@@ 0,0 1,9 @@
//
//  MinilandObject.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace NosSmooth.Game.Data.Maps;

public record MinilandObject();
\ No newline at end of file

A Core/NosSmooth.Game/Data/Social/Group.cs => Core/NosSmooth.Game/Data/Social/Group.cs +18 -0
@@ 0,0 1,18 @@
//
//  Group.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using NosSmooth.Game.Data.Entities;
using OneOf;

namespace NosSmooth.Game.Data.Social;

/// <summary>
/// Represents nostale group of players or pets and partners.
/// </summary>
/// <param name="Id">The id of the group.</param>
/// <param name="Size">The size of the group.</param>
/// <param name="Members">The members of the group. (excluding the character)</param>
public record Group(short? Id, byte? Size, IReadOnlyList<OneOf<Player, IPet>>? Members);
\ No newline at end of file

Do not follow this link