mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Make ItemUtil public (#2252)
This commit is contained in:
parent
c7cc771ee2
commit
39ac9f9dad
1 changed files with 9 additions and 9 deletions
|
|
@ -14,14 +14,14 @@ namespace Dalamud.Utility;
|
|||
/// <summary>
|
||||
/// Utilities related to Items.
|
||||
/// </summary>
|
||||
internal static class ItemUtil
|
||||
public static class ItemUtil
|
||||
{
|
||||
private static int? eventItemRowCount;
|
||||
|
||||
/// <summary>Converts raw item ID to item ID with its classification.</summary>
|
||||
/// <param name="rawItemId">Raw item ID.</param>
|
||||
/// <returns>Item ID and its classification.</returns>
|
||||
internal static (uint ItemId, ItemKind Kind) GetBaseId(uint rawItemId)
|
||||
public static (uint ItemId, ItemKind Kind) GetBaseId(uint rawItemId)
|
||||
{
|
||||
if (IsEventItem(rawItemId)) return (rawItemId, ItemKind.EventItem); // EventItem IDs are NOT adjusted
|
||||
if (IsHighQuality(rawItemId)) return (rawItemId - 1_000_000, ItemKind.Hq);
|
||||
|
|
@ -33,7 +33,7 @@ internal static class ItemUtil
|
|||
/// <param name="itemId">Item ID.</param>
|
||||
/// <param name="kind">Item classification.</param>
|
||||
/// <returns>Raw Item ID.</returns>
|
||||
internal static uint GetRawId(uint itemId, ItemKind kind)
|
||||
public static uint GetRawId(uint itemId, ItemKind kind)
|
||||
{
|
||||
return kind switch
|
||||
{
|
||||
|
|
@ -50,7 +50,7 @@ internal static class ItemUtil
|
|||
/// <param name="itemId">The item id to check.</param>
|
||||
/// <returns><c>true</c> when the item id belongs to a normal item.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static bool IsNormalItem(uint itemId)
|
||||
public static bool IsNormalItem(uint itemId)
|
||||
{
|
||||
return itemId < 500_000;
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ internal static class ItemUtil
|
|||
/// <param name="itemId">The item id to check.</param>
|
||||
/// <returns><c>true</c> when the item id belongs to a collectible item.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static bool IsCollectible(uint itemId)
|
||||
public static bool IsCollectible(uint itemId)
|
||||
{
|
||||
return itemId is >= 500_000 and < 1_000_000;
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ internal static class ItemUtil
|
|||
/// <param name="itemId">The item id to check.</param>
|
||||
/// <returns><c>true</c> when the item id belongs to a high quality item.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static bool IsHighQuality(uint itemId)
|
||||
public static bool IsHighQuality(uint itemId)
|
||||
{
|
||||
return itemId is >= 1_000_000 and < 2_000_000;
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ internal static class ItemUtil
|
|||
/// <param name="itemId">The item id to check.</param>
|
||||
/// <returns><c>true</c> when the item id belongs to an event item.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static bool IsEventItem(uint itemId)
|
||||
public static bool IsEventItem(uint itemId)
|
||||
{
|
||||
return itemId >= 2_000_000 && itemId - 2_000_000 < (eventItemRowCount ??= Service<DataManager>.Get().GetExcelSheet<EventItem>().Count);
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ internal static class ItemUtil
|
|||
/// <param name="includeIcon">Whether to include the High Quality or Collectible icon.</param>
|
||||
/// <param name="language">An optional client language override.</param>
|
||||
/// <returns>The item name.</returns>
|
||||
internal static ReadOnlySeString GetItemName(uint itemId, bool includeIcon = true, ClientLanguage? language = null)
|
||||
public static ReadOnlySeString GetItemName(uint itemId, bool includeIcon = true, ClientLanguage? language = null)
|
||||
{
|
||||
var dataManager = Service<DataManager>.Get();
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ internal static class ItemUtil
|
|||
/// <param name="itemId">The raw item Id.</param>
|
||||
/// <param name="isEdgeColor">Wheather this color is used as edge color.</param>
|
||||
/// <returns>The Color row id.</returns>
|
||||
internal static uint GetItemRarityColorType(uint itemId, bool isEdgeColor = false)
|
||||
public static uint GetItemRarityColorType(uint itemId, bool isEdgeColor = false)
|
||||
{
|
||||
var rarity = 1u;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue