Move IPC Arguments around.

This commit is contained in:
Ottermandias 2023-09-18 17:06:16 +02:00
parent a241b933ca
commit ea79469abd
5 changed files with 12 additions and 9 deletions

View file

@ -1465,7 +1465,7 @@ public class IpcTester : IDisposable
if (ImGui.Button("Get##GameObjectResourcesOfType")) if (ImGui.Button("Get##GameObjectResourcesOfType"))
{ {
var gameObjects = GetSelectedGameObjects(); var gameObjects = GetSelectedGameObjects();
var resourcesOfType = Ipc.GetGameObjectResourcesOfType.Subscriber(_pi).Invoke(gameObjects, _type, _withUIData); var resourcesOfType = Ipc.GetGameObjectResourcesOfType.Subscriber(_pi).Invoke(_type, _withUIData, gameObjects);
_lastGameObjectResourcesOfType = gameObjects _lastGameObjectResourcesOfType = gameObjects
.Select(GameObjectToString) .Select(GameObjectToString)

View file

@ -24,7 +24,6 @@ using Penumbra.Interop.Services;
using Penumbra.UI; using Penumbra.UI;
using TextureType = Penumbra.Api.Enums.TextureType; using TextureType = Penumbra.Api.Enums.TextureType;
using Penumbra.Interop.ResourceTree; using Penumbra.Interop.ResourceTree;
using System.Collections.Immutable;
namespace Penumbra.Api; namespace Penumbra.Api;
@ -1033,7 +1032,8 @@ public class PenumbraApi : IDisposable, IPenumbraApi
return pathDictionaries.AsReadOnly(); return pathDictionaries.AsReadOnly();
} }
public IReadOnlyDictionary<nint, (string, string, ChangedItemIcon)>?[] GetGameObjectResourcesOfType(ushort[] gameObjects, ResourceType type, bool withUIData) public IReadOnlyDictionary<nint, (string, string, ChangedItemIcon)>?[] GetGameObjectResourcesOfType(ResourceType type, bool withUIData,
params ushort[] gameObjects)
{ {
var characters = gameObjects.Select(index => _dalamud.Objects[index]).OfType<Character>(); var characters = gameObjects.Select(index => _dalamud.Objects[index]).OfType<Character>();
var resourceTrees = _resourceTreeFactory.FromCharacters(characters, withUIData ? ResourceTreeFactory.Flags.WithUIData : 0); var resourceTrees = _resourceTreeFactory.FromCharacters(characters, withUIData ? ResourceTreeFactory.Flags.WithUIData : 0);
@ -1042,9 +1042,11 @@ public class PenumbraApi : IDisposable, IPenumbraApi
return Array.ConvertAll(gameObjects, obj => resDictionaries.TryGetValue(obj, out var resDict) ? resDict : null); return Array.ConvertAll(gameObjects, obj => resDictionaries.TryGetValue(obj, out var resDict) ? resDict : null);
} }
public IReadOnlyDictionary<ushort, IReadOnlyDictionary<nint, (string, string, ChangedItemIcon)>> GetPlayerResourcesOfType(ResourceType type, bool withUIData) public IReadOnlyDictionary<ushort, IReadOnlyDictionary<nint, (string, string, ChangedItemIcon)>> GetPlayerResourcesOfType(ResourceType type,
bool withUIData)
{ {
var resourceTrees = _resourceTreeFactory.FromObjectTable(ResourceTreeFactory.Flags.LocalPlayerRelatedOnly | (withUIData ? ResourceTreeFactory.Flags.WithUIData : 0)); var resourceTrees = _resourceTreeFactory.FromObjectTable(ResourceTreeFactory.Flags.LocalPlayerRelatedOnly
| (withUIData ? ResourceTreeFactory.Flags.WithUIData : 0));
var resDictionaries = ResourceTreeApiHelper.GetResourcesOfType(resourceTrees, type); var resDictionaries = ResourceTreeApiHelper.GetResourcesOfType(resourceTrees, type);
return resDictionaries.AsReadOnly(); return resDictionaries.AsReadOnly();

View file

@ -121,7 +121,7 @@ public class PenumbraIpcProviders : IDisposable
// Resource Tree // Resource Tree
internal readonly FuncProvider<ushort[], IReadOnlyDictionary<string, string[]>?[]> GetGameObjectResourcePaths; internal readonly FuncProvider<ushort[], IReadOnlyDictionary<string, string[]>?[]> GetGameObjectResourcePaths;
internal readonly FuncProvider<IReadOnlyDictionary<ushort, IReadOnlyDictionary<string, string[]>>> GetPlayerResourcePaths; internal readonly FuncProvider<IReadOnlyDictionary<ushort, IReadOnlyDictionary<string, string[]>>> GetPlayerResourcePaths;
internal readonly FuncProvider<ushort[], ResourceType, bool, IReadOnlyDictionary<nint, (string, string, ChangedItemIcon)>?[]> GetGameObjectResourcesOfType; internal readonly FuncProvider<ResourceType, bool, ushort[], IReadOnlyDictionary<nint, (string, string, ChangedItemIcon)>?[]> GetGameObjectResourcesOfType;
internal readonly FuncProvider<ResourceType, bool, IReadOnlyDictionary<ushort, IReadOnlyDictionary<nint, (string, string, ChangedItemIcon)>>> GetPlayerResourcesOfType; internal readonly FuncProvider<ResourceType, bool, IReadOnlyDictionary<ushort, IReadOnlyDictionary<nint, (string, string, ChangedItemIcon)>>> GetPlayerResourcesOfType;
public PenumbraIpcProviders(DalamudServices dalamud, IPenumbraApi api, ModManager modManager, CollectionManager collections, public PenumbraIpcProviders(DalamudServices dalamud, IPenumbraApi api, ModManager modManager, CollectionManager collections,

View file

@ -6,7 +6,7 @@ using OtterGui.Classes;
using OtterGui.Filesystem; using OtterGui.Filesystem;
using OtterGui.Widgets; using OtterGui.Widgets;
using Penumbra.Api.Enums; using Penumbra.Api.Enums;
using Penumbra.GameData.Enums; using Penumbra.Enums;
using Penumbra.Import.Structs; using Penumbra.Import.Structs;
using Penumbra.Interop.Services; using Penumbra.Interop.Services;
using Penumbra.Mods; using Penumbra.Mods;

View file

@ -3,6 +3,7 @@ using OtterGui.Widgets;
using Penumbra.Api.Enums; using Penumbra.Api.Enums;
using Penumbra.Mods; using Penumbra.Mods;
using Penumbra.Services; using Penumbra.Services;
using Watcher = Penumbra.UI.ResourceWatcher.ResourceWatcher;
namespace Penumbra.UI.Tabs; namespace Penumbra.UI.Tabs;
@ -17,7 +18,7 @@ public class ConfigTabBar : IDisposable
public readonly EffectiveTab Effective; public readonly EffectiveTab Effective;
public readonly DebugTab Debug; public readonly DebugTab Debug;
public readonly ResourceTab Resource; public readonly ResourceTab Resource;
public readonly ResourceWatcher Watcher; public readonly Watcher Watcher;
public readonly OnScreenTab OnScreenTab; public readonly OnScreenTab OnScreenTab;
public readonly ITab[] Tabs; public readonly ITab[] Tabs;
@ -26,7 +27,7 @@ public class ConfigTabBar : IDisposable
public TabType SelectTab = TabType.None; public TabType SelectTab = TabType.None;
public ConfigTabBar(CommunicatorService communicator, SettingsTab settings, ModsTab mods, CollectionsTab collections, public ConfigTabBar(CommunicatorService communicator, SettingsTab settings, ModsTab mods, CollectionsTab collections,
ChangedItemsTab changedItems, EffectiveTab effective, DebugTab debug, ResourceTab resource, ResourceWatcher watcher, ChangedItemsTab changedItems, EffectiveTab effective, DebugTab debug, ResourceTab resource, Watcher watcher,
OnScreenTab onScreenTab) OnScreenTab onScreenTab)
{ {
_communicator = communicator; _communicator = communicator;