From 01ab7fbbe37bfbc731de188df6b711176ce2f2bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Sun, 26 Dec 2021 23:07:14 +0100 Subject: [PATCH] feat: add helper data records --- Core/NosSmooth.Game/Data/Characters/Skill.cs | 34 +++++++++++++++++++ Core/NosSmooth.Game/Data/Characters/Skills.cs | 20 +++++++++++ Core/NosSmooth.Game/Data/Entities/IPet.cs | 14 ++++++++ Core/NosSmooth.Game/Data/Info/Health.cs | 17 ++++++++++ Core/NosSmooth.Game/Data/Info/Level.cs | 15 ++++++++ Core/NosSmooth.Game/Data/Info/Morph.cs | 28 +++++++++++++++ .../Data/Maps/MinilandObject.cs | 9 +++++ Core/NosSmooth.Game/Data/Social/Group.cs | 18 ++++++++++ 8 files changed, 155 insertions(+) create mode 100644 Core/NosSmooth.Game/Data/Characters/Skill.cs create mode 100644 Core/NosSmooth.Game/Data/Characters/Skills.cs create mode 100644 Core/NosSmooth.Game/Data/Entities/IPet.cs create mode 100644 Core/NosSmooth.Game/Data/Info/Health.cs create mode 100644 Core/NosSmooth.Game/Data/Info/Level.cs create mode 100644 Core/NosSmooth.Game/Data/Info/Morph.cs create mode 100644 Core/NosSmooth.Game/Data/Maps/MinilandObject.cs create mode 100644 Core/NosSmooth.Game/Data/Social/Group.cs diff --git a/Core/NosSmooth.Game/Data/Characters/Skill.cs b/Core/NosSmooth.Game/Data/Characters/Skill.cs new file mode 100644 index 0000000..91ed156 --- /dev/null +++ b/Core/NosSmooth.Game/Data/Characters/Skill.cs @@ -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; + +/// +/// Represents nostale skill entity. +/// +/// The vnum of the skill. +/// The level of the skill. Unknown feature. +public record Skill(long SkillVNum, int? Level = default) +{ + /// + /// Gets the last time this skill was used. + /// + public DateTimeOffset LastUseTime { get; internal set; } + + /// + /// Gets the cooldown of the skill. + /// + public TimeSpan? Cooldown { get; internal set; } + + /// + /// Gets whether the skill is on cooldown. + /// + /// + /// This is set when the server sends sr packet, + /// prefer to use this instead of checking the LastUseTime and Cooldown. + /// + public bool IsOnCooldown { get; internal set; } +} \ No newline at end of file diff --git a/Core/NosSmooth.Game/Data/Characters/Skills.cs b/Core/NosSmooth.Game/Data/Characters/Skills.cs new file mode 100644 index 0000000..35a845e --- /dev/null +++ b/Core/NosSmooth.Game/Data/Characters/Skills.cs @@ -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; + +/// +/// Holds skill of a Character. +/// +/// The VNum of the primary skill. This skill is used with the primary weapon. (Could be different for sp cards.) +/// The VNum of the secondary skill. This skill is used with the secondary weapon. (Could be different for sp cards) +/// The VNums of other skills. +public record Skills +( + Skill PrimarySkill, + Skill SecondarySkill, + IReadOnlyList OtherSkills +); \ No newline at end of file diff --git a/Core/NosSmooth.Game/Data/Entities/IPet.cs b/Core/NosSmooth.Game/Data/Entities/IPet.cs new file mode 100644 index 0000000..0a0b0bc --- /dev/null +++ b/Core/NosSmooth.Game/Data/Entities/IPet.cs @@ -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; + +/// +/// Represents base type for a pet or a partner. +/// +public interface IPet +{ +} \ No newline at end of file diff --git a/Core/NosSmooth.Game/Data/Info/Health.cs b/Core/NosSmooth.Game/Data/Info/Health.cs new file mode 100644 index 0000000..2ec133d --- /dev/null +++ b/Core/NosSmooth.Game/Data/Info/Health.cs @@ -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; + +/// +/// Represents the health or mana of an entity. +/// +/// The current amount of health. +/// The maximum amount of health. +public record Health(long Amount, long Maximum) +{ + private decimal Percentage => (decimal)Amount / Maximum; +} \ No newline at end of file diff --git a/Core/NosSmooth.Game/Data/Info/Level.cs b/Core/NosSmooth.Game/Data/Info/Level.cs new file mode 100644 index 0000000..03e4695 --- /dev/null +++ b/Core/NosSmooth.Game/Data/Info/Level.cs @@ -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; + +/// +/// Represents a level, such as job level, hero level, character level. +/// +/// The level. +/// Current xp. +/// Maximum xp of the current level. +public record Level(ushort Lvl, long Xp, long XpLoad); \ No newline at end of file diff --git a/Core/NosSmooth.Game/Data/Info/Morph.cs b/Core/NosSmooth.Game/Data/Info/Morph.cs new file mode 100644 index 0000000..8f31474 --- /dev/null +++ b/Core/NosSmooth.Game/Data/Info/Morph.cs @@ -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; + +/// +/// Represents players morph. +/// +/// +/// Morphs are used mainly for special cards. +/// The VNum will contain the vnum of the special card. +/// +/// The vnum of the morph. +/// The upgrade to show wings. +/// The design of the wings. +/// Unknown. +/// The skin of the wings. +public record Morph +( + long VNum, + byte Upgrade, + short? Design = default, + byte? Bonus = default, + short? Skin = default +); \ No newline at end of file diff --git a/Core/NosSmooth.Game/Data/Maps/MinilandObject.cs b/Core/NosSmooth.Game/Data/Maps/MinilandObject.cs new file mode 100644 index 0000000..83983c7 --- /dev/null +++ b/Core/NosSmooth.Game/Data/Maps/MinilandObject.cs @@ -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 diff --git a/Core/NosSmooth.Game/Data/Social/Group.cs b/Core/NosSmooth.Game/Data/Social/Group.cs new file mode 100644 index 0000000..1fde2bb --- /dev/null +++ b/Core/NosSmooth.Game/Data/Social/Group.cs @@ -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; + +/// +/// Represents nostale group of players or pets and partners. +/// +/// The id of the group. +/// The size of the group. +/// The members of the group. (excluding the character) +public record Group(short? Id, byte? Size, IReadOnlyList>? Members); \ No newline at end of file -- 2.48.1