A Data/NosSmooth.Data.Abstractions/Enums/EquipmentSlot.cs => Data/NosSmooth.Data.Abstractions/Enums/EquipmentSlot.cs +35 -0
@@ 0,0 1,35 @@
+//
+// EquipmentSlot.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>
+/// An equipment slot that wearable item goes to.
+/// </summary>
+[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:Enumeration items should be documented", Justification = "Self-explanatory.")]
+public enum EquipmentSlot
+{
+ MainWeapon = 0,
+ Armor = 1,
+ Hat = 2,
+ Gloves = 3,
+ Boots = 4,
+ SecondaryWeapon = 5,
+ Necklace = 6,
+ Ring = 7,
+ Bracelet = 8,
+ Mask = 9,
+ Fairy = 10,
+ Amulet = 11,
+ Sp = 12,
+ CostumeSuit = 13,
+ CostumeHat = 14,
+ WeaponSkin = 15,
+ Wings = 16
+}<
\ No newline at end of file
A Data/NosSmooth.Data.Abstractions/Enums/ItemType.cs => Data/NosSmooth.Data.Abstractions/Enums/ItemType.cs +48 -0
@@ 0,0 1,48 @@
+//
+// ItemType.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>
+/// Type of an item.
+/// </summary>
+[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:Enumeration items should be documented", Justification = "Self-explanatory.")]
+public enum ItemType
+{
+ None = -1,
+ Weapon = 0,
+ Armor = 1,
+ Fashion = 2,
+ Jewelery = 3,
+ Specialist = 4,
+ Box = 5,
+ Shell = 6,
+ Main = 10,
+ Upgrade = 11,
+ Production = 12,
+ Map = 13,
+ Special = 14,
+ Potion = 15,
+ Event = 16,
+ Title = 17,
+ Quest1 = 18,
+ Sell = 20,
+ Food = 21,
+ Snack = 22,
+ Magical = 24,
+ Part = 25,
+ Teacher = 26,
+ Ammo = 27,
+ Quest2 = 28,
+ House = 30,
+ Garden = 31,
+ Minigame = 32,
+ Terrace = 33,
+ MinilandTheme = 34
+}<
\ No newline at end of file
M Data/NosSmooth.Data.Abstractions/Infos/IItemInfo.cs => Data/NosSmooth.Data.Abstractions/Infos/IItemInfo.cs +7 -2
@@ 20,9 20,9 @@ public interface IItemInfo : IVNumInfo
TranslatableString Name { get; }
/// <summary>
- /// Gets the type of the item. TODO UNKNOWN.
+ /// Gets the type of the item.
/// </summary>
- int Type { get; }
+ ItemType Type { get; }
/// <summary>
/// Gets the subtype of the item. TODO UNKNOWN.
@@ 30,6 30,11 @@ public interface IItemInfo : IVNumInfo
int SubType { get; }
/// <summary>
+ /// Gets the equipment slot the item goes to, if any.
+ /// </summary>
+ EquipmentSlot? EquipmentSlot { get; }
+
+ /// <summary>
/// Gets the bag the item belongs to.
/// </summary>
BagType BagType { get; }
M Data/NosSmooth.Data.Abstractions/NosSmooth.Data.Abstractions.csproj => Data/NosSmooth.Data.Abstractions/NosSmooth.Data.Abstractions.csproj +4 -2
@@ 7,9 7,11 @@
<LangVersion>10</LangVersion>
<RepositoryUrl>https://github.com/Rutherther/NosSmooth/</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
- <PackageVersion>2.0.0</PackageVersion>
+ <PackageVersion>2.1.0</PackageVersion>
<TargetFramework>net7.0</TargetFramework>
- <PackageReleaseNotes>Make Monster level ushort</PackageReleaseNotes>
+ <PackageReleaseNotes>Add item type and equipment slot enums.</PackageReleaseNotes>
+ <AssemblyVersion>2.1.0</AssemblyVersion>
+ <FileVersion>2.1.0</FileVersion>
</PropertyGroup>
<ItemGroup>
M Data/NosSmooth.Data.Database/Data/ItemInfo.cs => Data/NosSmooth.Data.Database/Data/ItemInfo.cs +4 -1
@@ 40,12 40,15 @@ public class ItemInfo : IItemInfo
public TranslatableString Name { get; set; }
/// <inheritdoc />
- public int Type { get; set; }
+ public ItemType Type { get; set; }
/// <inheritdoc />
public int SubType { get; set; }
/// <inheritdoc />
+ public EquipmentSlot? EquipmentSlot { get; set; }
+
+ /// <inheritdoc />
public BagType BagType { get; set; }
/// <inheritdoc/>
M Data/NosSmooth.Data.Database/DatabaseMigrator.cs => Data/NosSmooth.Data.Database/DatabaseMigrator.cs +1 -0
@@ 113,6 113,7 @@ public class DatabaseMigrator
{
BagType = item.BagType,
Data = item.Data,
+ EquipmentSlot = item.EquipmentSlot,
NameKey = item.Name.Key,
SubType = item.SubType,
Type = item.Type,
M Data/NosSmooth.Data.Database/NosSmooth.Data.Database.csproj => Data/NosSmooth.Data.Database/NosSmooth.Data.Database.csproj +3 -1
@@ 7,9 7,11 @@
<LangVersion>10</LangVersion>
<RepositoryUrl>https://github.com/Rutherther/NosSmooth/</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
- <PackageVersion>2.0.0</PackageVersion>
+ <PackageVersion>2.0.1</PackageVersion>
<TargetFramework>net7.0</TargetFramework>
<PackageReleaseNotes>Make Monster level ushort</PackageReleaseNotes>
+ <AssemblyVersion>2.0.1</AssemblyVersion>
+ <FileVersion>2.0.1</FileVersion>
</PropertyGroup>
<ItemGroup>
M Data/NosSmooth.Data.NOSFiles/NosSmooth.Data.NOSFiles.csproj => Data/NosSmooth.Data.NOSFiles/NosSmooth.Data.NOSFiles.csproj +4 -4
@@ 7,11 7,11 @@
<LangVersion>10</LangVersion>
<RepositoryUrl>https://github.com/Rutherther/NosSmooth/</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
- <PackageVersion>2.0.2</PackageVersion>
- <PackageReleaseNotes>Correct skill mp cost position</PackageReleaseNotes>
+ <PackageVersion>2.1.0</PackageVersion>
+ <PackageReleaseNotes>Make correct parsing of item bag, type, equipment slot</PackageReleaseNotes>
<TargetFramework>net7.0</TargetFramework>
- <AssemblyVersion>2.0.2</AssemblyVersion>
- <FileVersion>2.0.2</FileVersion>
+ <AssemblyVersion>2.1.0</AssemblyVersion>
+ <FileVersion>2.1.0</FileVersion>
</PropertyGroup>
<ItemGroup>
M Data/NosSmooth.Data.NOSFiles/Parsers/ItemParser.cs => Data/NosSmooth.Data.NOSFiles/Parsers/ItemParser.cs +33 -3
@@ 33,6 33,34 @@ public class ItemParser : IInfoParser<IItemInfo>
var vnum = item.GetEntry("VNUM").Read<int>(1);
var nameKey = item.GetEntry("NAME").Read<string>(1);
+
+ var bagTypeData = item.GetEntry("INDEX").Read<int>(1);
+ var bagType = bagTypeData switch
+ {
+ 4 or 8 => BagType.Equipment,
+ 9 => BagType.Main,
+ 10 => BagType.Etc,
+ _ => (BagType)bagTypeData
+ };
+
+ var itemTypeData = indexEntry.Read<int>(2);
+ var itemType = itemTypeData switch
+ {
+ -1 => ItemType.None,
+ _ => Enum.Parse<ItemType>($"{(int)bagType}{itemTypeData}")
+ };
+
+ var equipmentSlotData = indexEntry.Read<int>(4);
+ EquipmentSlot? equipmentSlot = null;
+ if (bagType is BagType.Equipment && equipmentSlotData != -1)
+ {
+ equipmentSlot = (EquipmentSlot)equipmentSlotData;
+ }
+ else if (bagType is BagType.Specialist)
+ {
+ equipmentSlot = EquipmentSlot.Sp;
+ }
+
result.Add
(
vnum,
@@ 40,9 68,10 @@ public class ItemParser : IInfoParser<IItemInfo>
(
vnum,
new TranslatableString(TranslationRoot.Item, nameKey),
- indexEntry.Read<int>(2),
+ itemType,
indexEntry.Read<int>(3),
- (BagType)indexEntry.Read<int>(1),
+ equipmentSlot,
+ bagType,
item.GetEntry("DATA").GetValues()
)
);
@@ 55,8 84,9 @@ public class ItemParser : IInfoParser<IItemInfo>
(
int VNum,
TranslatableString Name,
- int Type,
+ ItemType Type,
int SubType,
+ EquipmentSlot? EquipmentSlot,
BagType BagType,
string[] Data
)