mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-29 11:59:26 +01:00
Start rework of identified objects.
This commit is contained in:
parent
4454ac48da
commit
da3f3b8df3
41 changed files with 342 additions and 389 deletions
|
|
@ -345,7 +345,7 @@ internal unsafe partial record ResolveContext(
|
|||
_ => string.Empty,
|
||||
}
|
||||
+ item.Name;
|
||||
return new ResourceNode.UiData(name, ChangedItemDrawer.GetCategoryIcon(item.Name, item));
|
||||
return new ResourceNode.UiData(name, item.Type.GetCategoryIcon().ToFlag());
|
||||
}
|
||||
|
||||
var dataFromPath = GuessUiDataFromPath(gamePath);
|
||||
|
|
@ -353,8 +353,8 @@ internal unsafe partial record ResolveContext(
|
|||
return dataFromPath;
|
||||
|
||||
return isEquipment
|
||||
? new ResourceNode.UiData(Slot.ToName(), ChangedItemDrawer.GetCategoryIcon(Slot.ToSlot()))
|
||||
: new ResourceNode.UiData(null, ChangedItemDrawer.ChangedItemIcon.Unknown);
|
||||
? new ResourceNode.UiData(Slot.ToName(), Slot.ToEquipType().GetCategoryIcon().ToFlag())
|
||||
: new ResourceNode.UiData(null, ChangedItemIconFlag.Unknown);
|
||||
}
|
||||
|
||||
internal ResourceNode.UiData GuessUiDataFromPath(Utf8GamePath gamePath)
|
||||
|
|
@ -362,13 +362,13 @@ internal unsafe partial record ResolveContext(
|
|||
foreach (var obj in Global.Identifier.Identify(gamePath.ToString()))
|
||||
{
|
||||
var name = obj.Key;
|
||||
if (name.StartsWith("Customization:"))
|
||||
if (obj.Value is IdentifiedCustomization)
|
||||
name = name[14..].Trim();
|
||||
if (name != "Unknown")
|
||||
return new ResourceNode.UiData(name, ChangedItemDrawer.GetCategoryIcon(obj.Key, obj.Value));
|
||||
return new ResourceNode.UiData(name, obj.Value.GetIcon().ToFlag());
|
||||
}
|
||||
|
||||
return new ResourceNode.UiData(null, ChangedItemDrawer.ChangedItemIcon.Unknown);
|
||||
return new ResourceNode.UiData(null, ChangedItemIconFlag.Unknown);
|
||||
}
|
||||
|
||||
private static string? SafeGet(ReadOnlySpan<string> array, Index index)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using Penumbra.Api.Enums;
|
||||
using Penumbra.String;
|
||||
using Penumbra.String.Classes;
|
||||
using ChangedItemIcon = Penumbra.UI.ChangedItemDrawer.ChangedItemIcon;
|
||||
using Penumbra.UI;
|
||||
|
||||
namespace Penumbra.Interop.ResourceTree;
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ public class ResourceNode : ICloneable
|
|||
{
|
||||
public string? Name;
|
||||
public string? FallbackName;
|
||||
public ChangedItemIcon Icon;
|
||||
public ChangedItemIconFlag IconFlag;
|
||||
public readonly ResourceType Type;
|
||||
public readonly nint ObjectAddress;
|
||||
public readonly nint ResourceHandle;
|
||||
|
|
@ -51,7 +51,7 @@ public class ResourceNode : ICloneable
|
|||
{
|
||||
Name = other.Name;
|
||||
FallbackName = other.FallbackName;
|
||||
Icon = other.Icon;
|
||||
IconFlag = other.IconFlag;
|
||||
Type = other.Type;
|
||||
ObjectAddress = other.ObjectAddress;
|
||||
ResourceHandle = other.ResourceHandle;
|
||||
|
|
@ -79,7 +79,7 @@ public class ResourceNode : ICloneable
|
|||
public void SetUiData(UiData uiData)
|
||||
{
|
||||
Name = uiData.Name;
|
||||
Icon = uiData.Icon;
|
||||
IconFlag = uiData.IconFlag;
|
||||
}
|
||||
|
||||
public void PrependName(string prefix)
|
||||
|
|
@ -88,9 +88,9 @@ public class ResourceNode : ICloneable
|
|||
Name = prefix + Name;
|
||||
}
|
||||
|
||||
public readonly record struct UiData(string? Name, ChangedItemIcon Icon)
|
||||
public readonly record struct UiData(string? Name, ChangedItemIconFlag IconFlag)
|
||||
{
|
||||
public UiData PrependName(string prefix)
|
||||
=> Name == null ? this : new UiData(prefix + Name, Icon);
|
||||
=> Name == null ? this : new UiData(prefix + Name, IconFlag);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ public class ResourceTree
|
|||
{
|
||||
pbdNode = pbdNode.Clone();
|
||||
pbdNode.FallbackName = "Racial Deformer";
|
||||
pbdNode.Icon = ChangedItemDrawer.ChangedItemIcon.Customization;
|
||||
pbdNode.IconFlag = ChangedItemIconFlag.Customization;
|
||||
}
|
||||
|
||||
Nodes.Add(pbdNode);
|
||||
|
|
@ -192,7 +192,7 @@ public class ResourceTree
|
|||
{
|
||||
decalNode = decalNode.Clone();
|
||||
decalNode.FallbackName = "Face Decal";
|
||||
decalNode.Icon = ChangedItemDrawer.ChangedItemIcon.Customization;
|
||||
decalNode.IconFlag = ChangedItemIconFlag.Customization;
|
||||
}
|
||||
|
||||
Nodes.Add(decalNode);
|
||||
|
|
@ -209,7 +209,7 @@ public class ResourceTree
|
|||
{
|
||||
legacyDecalNode = legacyDecalNode.Clone();
|
||||
legacyDecalNode.FallbackName = "Legacy Body Decal";
|
||||
legacyDecalNode.Icon = ChangedItemDrawer.ChangedItemIcon.Customization;
|
||||
legacyDecalNode.IconFlag = ChangedItemIconFlag.Customization;
|
||||
}
|
||||
|
||||
Nodes.Add(legacyDecalNode);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ internal static class ResourceTreeApiHelper
|
|||
continue;
|
||||
|
||||
var fullPath = node.FullPath.ToPath();
|
||||
resDictionary.Add(node.ResourceHandle, (fullPath, node.Name ?? string.Empty, (uint)ChangedItemDrawer.ToApiIcon(node.Icon)));
|
||||
resDictionary.Add(node.ResourceHandle, (fullPath, node.Name ?? string.Empty, (uint)node.IconFlag.ToApiIcon()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ internal static class ResourceTreeApiHelper
|
|||
var ret = new JObject
|
||||
{
|
||||
[nameof(ResourceNodeDto.Type)] = new JValue(node.Type),
|
||||
[nameof(ResourceNodeDto.Icon)] = new JValue(ChangedItemDrawer.ToApiIcon(node.Icon)),
|
||||
[nameof(ResourceNodeDto.Icon)] = new JValue(node.IconFlag.ToApiIcon()),
|
||||
[nameof(ResourceNodeDto.Name)] = node.Name,
|
||||
[nameof(ResourceNodeDto.GamePath)] = node.GamePath.Equals(Utf8GamePath.Empty) ? null : node.GamePath.ToString(),
|
||||
[nameof(ResourceNodeDto.ActualPath)] = node.FullPath.ToString(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue