A Data/NosSmooth.Data.Abstractions/Enums/BagType.cs => Data/NosSmooth.Data.Abstractions/Enums/BagType.cs +24 -0
@@ 0,0 1,24 @@
+//
+// BagType.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 System.Diagnostics.CodeAnalysis;
+
+#pragma warning disable CS1591
+namespace NosSmooth.Data.Abstractions.Enums;
+
+/// <summary>
+/// The type of a bag the item belongs to.
+/// </summary>
+[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:Enumeration items should be documented", Justification = "Self-explanatory.")]
+public enum BagType
+{
+ Equipment = 0,
+ Main = 1,
+ Etc = 2,
+ Miniland = 3,
+ Specialist = 6,
+ Costume = 7
+}<
\ No newline at end of file
A Data/NosSmooth.Data.Abstractions/Enums/HitType.cs => Data/NosSmooth.Data.Abstractions/Enums/HitType.cs +36 -0
@@ 0,0 1,36 @@
+//
+// HitType.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.Data.Abstractions.Enums;
+
+/// <summary>
+/// A hit type of a skill.
+/// </summary>
+public enum HitType
+{
+ /// <summary>
+ /// The skill is for just one target.
+ /// </summary>
+ TargetOnly,
+
+ /// <summary>
+ /// The skill will hit enemies in a zone.
+ /// </summary>
+ /// <remarks>
+ /// Can be AOE skill or a targeted skill that targets more enemies.
+ /// </remarks>
+ EnemiesInZone,
+
+ /// <summary>
+ /// The skill will hit allies in a zone, this is a buff.
+ /// </summary>
+ AlliesInZone,
+
+ /// <summary>
+ /// UNKNOWN TODO.
+ /// </summary>
+ SpecialArea
+}<
\ No newline at end of file
A Data/NosSmooth.Data.Abstractions/Enums/SkillType.cs => Data/NosSmooth.Data.Abstractions/Enums/SkillType.cs +43 -0
@@ 0,0 1,43 @@
+//
+// SkillType.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.Data.Abstractions.Enums;
+
+/// <summary>
+/// A type of a skill.
+/// </summary>
+public enum SkillType
+{
+ /// <summary>
+ /// The skill is a passive, used automatically.
+ /// </summary>
+ Passive,
+
+ /// <summary>
+ /// The skill is for players.
+ /// </summary>
+ Player,
+
+ /// <summary>
+ /// UNKNOWN TODO.
+ /// </summary>
+ Upgrade,
+
+ /// <summary>
+ /// Unknown TODO.
+ /// </summary>
+ Emote,
+
+ /// <summary>
+ /// The skill is for monsters.
+ /// </summary>
+ Monster,
+
+ /// <summary>
+ /// The skill is for partners.
+ /// </summary>
+ Partner
+}<
\ No newline at end of file
A Data/NosSmooth.Data.Abstractions/Enums/TargetType.cs => Data/NosSmooth.Data.Abstractions/Enums/TargetType.cs +33 -0
@@ 0,0 1,33 @@
+//
+// TargetType.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.Data.Abstractions.Enums;
+
+/// <summary>
+/// Type of a target of a skill.
+/// </summary>
+public enum TargetType
+{
+ /// <summary>
+ /// The skill has a (enemy) target.
+ /// </summary>
+ Target,
+
+ /// <summary>
+ /// The skill can be targeted only on self.
+ /// </summary>
+ Self,
+
+ /// <summary>
+ /// The skill can be targeted on self or a (enemy) target.
+ /// </summary>
+ SelfOrTarget,
+
+ /// <summary>
+ /// The skill has no target. UNKNOWN TODO.
+ /// </summary>
+ NoTarget
+}<
\ No newline at end of file
M Data/NosSmooth.Data.Abstractions/IInfoService.cs => Data/NosSmooth.Data.Abstractions/IInfoService.cs +5 -12
@@ 19,33 19,26 @@ public interface IInfoService
/// </summary>
/// <param name="vnum">The vnum identifier of the item.</param>
/// <returns>An item info or an error.</returns>
- public Result<IItemInfo> GetItemInfo(long vnum);
+ public Result<IItemInfo> GetItemInfo(int vnum);
/// <summary>
/// Gets the information about a map.
/// </summary>
- /// <param name="vnum">The vnum identifier of the map.</param>
+ /// <param name="id">The identifier of the map.</param>
/// <returns>A map info or an error.</returns>
- public Result<IMapInfo> GetMapInfo(long vnum);
+ public Result<IMapInfo> GetMapInfo(int id);
/// <summary>
/// Gets the information about a monster.
/// </summary>
/// <param name="vnum">The vnum identifier of the monster.</param>
/// <returns>A monster or an error.</returns>
- public Result<IMonsterInfo> GetMonsterInfo(long vnum);
+ public Result<IMonsterInfo> GetMonsterInfo(int vnum);
/// <summary>
/// Gets the information about a skill.
/// </summary>
/// <param name="vnum">The vnum identifier of the skill.</param>
/// <returns>A map or an error.</returns>
- public Result<ISkillInfo> GetSkillInfo(long vnum);
-
- /// <summary>
- /// Gets the information about a card.
- /// </summary>
- /// <param name="vnum">The vnum identifier of the card.</param>
- /// <returns>A card or an error.</returns>
- public Result<ICardInfo> GetCardInfo(long vnum);
+ public Result<ISkillInfo> GetSkillInfo(int vnum);
}=
\ No newline at end of file
D Data/NosSmooth.Data.Abstractions/Infos/ICardInfo.cs => Data/NosSmooth.Data.Abstractions/Infos/ICardInfo.cs +0 -14
@@ 1,14 0,0 @@
-//
-// ICardInfo.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.Data.Abstractions.Infos;
-
-/// <summary>
-/// The NosTale card information.
-/// </summary>
-public interface ICardInfo : IVNumInfo
-{
-}>
\ No newline at end of file
M Data/NosSmooth.Data.Abstractions/Infos/IItemInfo.cs => Data/NosSmooth.Data.Abstractions/Infos/IItemInfo.cs +27 -0
@@ 4,6 4,9 @@
// 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.Data.Abstractions.Enums;
+using NosSmooth.Data.Abstractions.Language;
+
namespace NosSmooth.Data.Abstractions.Infos;
/// <summary>
@@ 11,4 14,28 @@ namespace NosSmooth.Data.Abstractions.Infos;
/// </summary>
public interface IItemInfo : IVNumInfo
{
+ /// <summary>
+ /// Gets the translatable name of the item.
+ /// </summary>
+ TranslatableString Name { get; }
+
+ /// <summary>
+ /// Gets the type of the item. TODO UNKNOWN.
+ /// </summary>
+ int Type { get; }
+
+ /// <summary>
+ /// Gets the subtype of the item. TODO UNKNOWN.
+ /// </summary>
+ int SubType { get; }
+
+ /// <summary>
+ /// Gets the bag the item belongs to.
+ /// </summary>
+ BagType BagType { get; }
+
+ /// <summary>
+ /// Gets the data of the item.
+ /// </summary>
+ string[] Data { get; }
}=
\ No newline at end of file
M Data/NosSmooth.Data.Abstractions/Infos/IMapInfo.cs => Data/NosSmooth.Data.Abstractions/Infos/IMapInfo.cs +13 -1
@@ 4,14 4,26 @@
// 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.Data.Abstractions.Language;
+
namespace NosSmooth.Data.Abstractions.Infos;
/// <summary>
/// The NosTale map information.
/// </summary>
-public interface IMapInfo : IVNumInfo
+public interface IMapInfo
{
/// <summary>
+ /// Gets the Id of the map.
+ /// </summary>
+ public int Id { get; }
+
+ /// <summary>
+ /// Gets the translatable name of the map.
+ /// </summary>
+ public TranslatableString Name { get; }
+
+ /// <summary>
/// Gets the width of the grid.
/// </summary>
public short Width { get; }
M Data/NosSmooth.Data.Abstractions/Infos/IMonsterInfo.cs => Data/NosSmooth.Data.Abstractions/Infos/IMonsterInfo.cs +11 -0
@@ 4,6 4,8 @@
// 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.Data.Abstractions.Language;
+
namespace NosSmooth.Data.Abstractions.Infos;
/// <summary>
@@ 11,4 13,13 @@ namespace NosSmooth.Data.Abstractions.Infos;
/// </summary>
public interface IMonsterInfo : IVNumInfo
{
+ /// <summary>
+ /// Gets the name of the monster.
+ /// </summary>
+ TranslatableString Name { get; }
+
+ /// <summary>
+ /// Gets the default level of the monster.
+ /// </summary>
+ int Level { get; }
}=
\ No newline at end of file
M Data/NosSmooth.Data.Abstractions/Infos/ISkillInfo.cs => Data/NosSmooth.Data.Abstractions/Infos/ISkillInfo.cs +53 -1
@@ 4,11 4,63 @@
// 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.Data.Abstractions.Enums;
+using NosSmooth.Data.Abstractions.Language;
+
namespace NosSmooth.Data.Abstractions.Infos;
/// <summary>
/// The NosTale skill information.
/// </summary>
-public interface ISkillInfo
+public interface ISkillInfo : IVNumInfo
{
+ /// <summary>
+ /// Gets the translatable name of the skill.
+ /// </summary>
+ TranslatableString Name { get; }
+
+ /// <summary>
+ /// Gets the tile range of the skill.
+ /// </summary>
+ short Range { get; }
+
+ /// <summary>
+ /// Gets the zone tiles range.
+ /// </summary>
+ short ZoneRange { get; }
+
+ /// <summary>
+ /// Gets the time it takes to cast this skill. Units UNKNOWN TODO.
+ /// </summary>
+ int CastTime { get; }
+
+ /// <summary>
+ /// Gets the time of the cooldown. Units UNKNOWN TODO.
+ /// </summary>
+ int Cooldown { get; }
+
+ /// <summary>
+ /// Gets the type of the skill.
+ /// </summary>
+ SkillType SkillType { get; }
+
+ /// <summary>
+ /// Gets the mana points the skill cast costs.
+ /// </summary>
+ int MpCost { get; }
+
+ /// <summary>
+ /// Gets the cast id of the skill used in u_s, su packets.
+ /// </summary>
+ short CastId { get; }
+
+ /// <summary>
+ /// Gets the type of the target.
+ /// </summary>
+ TargetType TargetType { get; }
+
+ /// <summary>
+ /// Gets the hit type of the skill.
+ /// </summary>
+ HitType HitType { get; }
}=
\ No newline at end of file
M Data/NosSmooth.Data.Abstractions/Infos/IVNumInfo.cs => Data/NosSmooth.Data.Abstractions/Infos/IVNumInfo.cs +1 -1
@@ 14,5 14,5 @@ public interface IVNumInfo
/// <summary>
/// Gets the VNum of the info entry.
/// </summary>
- public long VNum { get; }
+ public int VNum { get; }
}=
\ No newline at end of file
D Data/NosSmooth.Data.Abstractions/Language/LanguageKey.cs => Data/NosSmooth.Data.Abstractions/Language/LanguageKey.cs +0 -36
@@ 1,36 0,0 @@
-//
-// LanguageKey.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.Data.Abstractions.Language;
-
-/// <summary>
-/// Key for language translation.
-/// </summary>
-public struct LanguageKey
-{
- /// <summary>
- /// Initializes a new instance of the <see cref="LanguageKey"/> struct.
- /// </summary>
- /// <param name="key">The key num.</param>
- public LanguageKey(long key)
- : this($"zts{key}e")
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="LanguageKey"/> struct.
- /// </summary>
- /// <param name="key">The key.</param>
- public LanguageKey(string key)
- {
- Key = key;
- }
-
- /// <summary>
- /// Gets the key.
- /// </summary>
- public string Key { get; }
-}>
\ No newline at end of file
M Data/NosSmooth.Data.NOSFiles/Files/FileArchive.cs => Data/NosSmooth.Data.NOSFiles/Files/FileArchive.cs +24 -1
@@ 4,6 4,29 @@
// 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 Remora.Results;
+
namespace NosSmooth.Data.NOSFiles.Files;
-public record FileArchive(IReadOnlyList<RawFile> Files);>
\ No newline at end of file
+/// <summary>
+/// An archive of files.
+/// </summary>
+/// <param name="Files">The files in the archive.</param>
+public record FileArchive(IReadOnlyList<RawFile> Files)
+{
+ /// <summary>
+ /// Try to find the given file.
+ /// </summary>
+ /// <param name="name">The name of the file.</param>
+ /// <returns>A file or an error.</returns>
+ public Result<RawFile> Search(string name)
+ {
+ var foundFile = Files.OfType<RawFile?>().FirstOrDefault(x => Path.GetFileName((RawFile)x.Path) == name, null);
+ if (foundFile is null)
+ {
+ return new NotFoundError();
+ }
+
+ return (RawFile)foundFile;
+ }
+}<
\ No newline at end of file