Dalamud/Dalamud/Utility/ObjectKindExtensions.cs
Haselnussbomber fdbfdbb2cd
Add SeStringEvaluator service (#2188)
* Add SeStringEvaluator service

* Move DrawCopyableText into WidgetUtil

* Use Icon2RemapTable in SeStringRenderer

* Beautify some code

* Make sure to use the correct language

* Add SeString Creator widget

* Fix getting local parameters

* Update expressionNames

* misc changes

* Use InvariantCulture in TryResolveSheet

* Add SeStringEvaluatorAgingStep

* Fix item id comparisons

* Add SheetRedirectResolverAgingStep

* Add NounProcessorAgingStep

* Update SeString.CreateItemLink

This also adds the internal ItemUtil class.

* Fix name of SeStringCreator widget

* Add Global Parameters tab to SeStringCreatorWidget

* Load widgets on demand

* Update SeStringCreatorWidget

* Resizable SeStringCreatorWidget panels

* Update GamepadStateAgingStep

* Experimental status was removed in #2144

* Update SheetRedirectResolver, rewrite Noun params

* Fixes for 4 am code

* Remove incorrect column offset

I have no idea how that happened.

* Draw names of linked things

---------

Co-authored-by: Soreepeong <3614868+Soreepeong@users.noreply.github.com>
Co-authored-by: KazWolfe <KazWolfe@users.noreply.github.com>
2025-03-24 09:00:27 -07:00

33 lines
1.2 KiB
C#

using Dalamud.Game.ClientState.Objects.Enums;
namespace Dalamud.Utility;
/// <summary>
/// Extension methods for the <see cref="ObjectKind"/> enum.
/// </summary>
public static class ObjectKindExtensions
{
/// <summary>
/// Converts the id of an ObjectKind to the id used in the ObjStr sheet redirect.
/// </summary>
/// <param name="objectKind">The ObjectKind this id is for.</param>
/// <param name="id">The id.</param>
/// <returns>An id that can be used in the ObjStr sheet redirect.</returns>
public static uint GetObjStrId(this ObjectKind objectKind, uint id)
{
// See "8D 41 FE 83 F8 0C 77 4D"
return objectKind switch
{
ObjectKind.BattleNpc => id < 1000000 ? id : id - 900000,
ObjectKind.EventNpc => id,
ObjectKind.Treasure or
ObjectKind.Aetheryte or
ObjectKind.GatheringPoint or
ObjectKind.Companion or
ObjectKind.Housing => id + (1000000 * (uint)objectKind) - 2000000,
ObjectKind.EventObj => id + (1000000 * (uint)objectKind) - 4000000,
ObjectKind.CardStand => id + 3000000,
_ => 0,
};
}
}