mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-15 20:17:42 +01:00
Compare commits
7 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
360c8bb92a | ||
|
|
e96134a134 | ||
|
|
74517d8ec5 | ||
|
|
4d466fb7eb | ||
|
|
f8ca572d38 | ||
|
|
59c9601a9b | ||
|
|
0d9a0d49ab |
8 changed files with 100 additions and 24 deletions
|
|
@ -280,8 +280,8 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn
|
|||
{
|
||||
var name = tok["Name"]?.ToObject<string>();
|
||||
var directory = tok["Directory"]?.ToObject<string>();
|
||||
var enabled = tok["Enabled"]?.ToObject<bool>();
|
||||
if (name == null || directory == null || enabled == null)
|
||||
var enabled = tok["Enabled"]?.ToObject<bool>() ?? false;
|
||||
if (name == null || directory == null)
|
||||
{
|
||||
Glamourer.Messager.NotificationMessage("The loaded design contains an invalid mod, skipped.", NotificationType.Warning);
|
||||
continue;
|
||||
|
|
@ -295,7 +295,7 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn
|
|||
settings.Add(key, value);
|
||||
var priority = tok["Priority"]?.ToObject<int>() ?? 0;
|
||||
if (!design.AssociatedMods.TryAdd(new Mod(name, directory),
|
||||
new ModSettings(settings, priority, enabled.Value, forceInherit, removeSetting)))
|
||||
new ModSettings(settings, priority, enabled, forceInherit, removeSetting)))
|
||||
Glamourer.Messager.NotificationMessage("The loaded design contains a mod more than once, skipped.", NotificationType.Warning);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using Glamourer.GameData;
|
||||
using Glamourer.Interop.Material;
|
||||
using Glamourer.Interop.Penumbra;
|
||||
using Glamourer.State;
|
||||
using Penumbra.GameData.Enums;
|
||||
|
||||
namespace Glamourer.Designs.History;
|
||||
|
|
@ -125,7 +126,10 @@ public readonly record struct MaterialTransaction(MaterialValueIndex Index, Colo
|
|||
=> older is MaterialTransaction other && Index == other.Index ? new MaterialTransaction(Index, other.Old, New) : null;
|
||||
|
||||
public void Revert(IDesignEditor editor, object data)
|
||||
=> ((DesignManager)editor).ChangeMaterialValue((Design)data, Index, Old);
|
||||
{
|
||||
if (editor is DesignManager e)
|
||||
e.ChangeMaterialValue((Design)data, Index, Old);
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks> Only Designs. </remarks>
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ public class UnlockTable : Table<EquipItem>, IDisposable
|
|||
ImGui.Dummy(new Vector2(ImGui.GetFrameHeight()));
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
if (ImGui.Selectable(item.Name))
|
||||
if (ImGui.Selectable(item.Name) && item.Id is { IsBonusItem: false, IsCustom: false })
|
||||
Glamourer.Messager.Chat.Print(new SeStringBuilder().AddItemLink(item.ItemId.Id, false).BuiltString);
|
||||
|
||||
if (ImGui.IsItemClicked(ImGuiMouseButton.Right) && _tooltip.Player(out var state))
|
||||
|
|
|
|||
58
Glamourer/Interop/Penumbra/ModUsageInformer.cs
Normal file
58
Glamourer/Interop/Penumbra/ModUsageInformer.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
using Glamourer.Automation;
|
||||
using Glamourer.Designs;
|
||||
using OtterGui.Services;
|
||||
|
||||
namespace Glamourer.Interop.Penumbra;
|
||||
|
||||
public sealed class ModUsageInformer : IDisposable, IRequiredService
|
||||
{
|
||||
private readonly PenumbraService _penumbra;
|
||||
private readonly DesignManager _designs;
|
||||
private readonly AutoDesignManager _automation;
|
||||
|
||||
public ModUsageInformer(PenumbraService penumbra, DesignManager designs, AutoDesignManager automation)
|
||||
{
|
||||
_penumbra = penumbra;
|
||||
_designs = designs;
|
||||
_automation = automation;
|
||||
|
||||
_penumbra.ModUsageQueried += OnModUsageQueried;
|
||||
}
|
||||
|
||||
private void OnModUsageQueried(string modPath, string modName, Dictionary<Assembly, (bool, string)> notes)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
var inUse = false;
|
||||
foreach (var design in _designs.Designs)
|
||||
{
|
||||
if (!design.AssociatedMods.Any(p => ModMatches(modPath, modName, p.Key)))
|
||||
continue;
|
||||
|
||||
sb.AppendLine($"Contained in Design {design.Name}.");
|
||||
if (_automation.EnabledSets.Values.Any(s => s.Designs.Any(d => d.Type is not 0 && d.Design == design)))
|
||||
{
|
||||
inUse = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (inUse)
|
||||
notes.TryAdd(Assembly.GetAssembly(typeof(ModUsageInformer))!, (true, string.Empty));
|
||||
else if (sb.Length > 0)
|
||||
notes.TryAdd(Assembly.GetAssembly(typeof(ModUsageInformer))!, (false, sb.ToString()));
|
||||
}
|
||||
|
||||
private static bool ModMatches(string modPath, string modName, in Mod mod)
|
||||
{
|
||||
if (mod.DirectoryName.Equals(modPath, StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
|
||||
if (mod.Name.Equals(modName, StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
=> _penumbra.ModUsageQueried -= OnModUsageQueried;
|
||||
}
|
||||
|
|
@ -44,15 +44,16 @@ public class PenumbraService : IDisposable
|
|||
private const int KeyManual = -6160;
|
||||
private const string NameManual = "Glamourer (Manually)";
|
||||
|
||||
private readonly IDalamudPluginInterface _pluginInterface;
|
||||
private readonly Configuration _config;
|
||||
private readonly EventSubscriber<ChangedItemType, uint> _tooltipSubscriber;
|
||||
private readonly EventSubscriber<MouseButton, ChangedItemType, uint> _clickSubscriber;
|
||||
private readonly EventSubscriber<nint, Guid, nint, nint, nint> _creatingCharacterBase;
|
||||
private readonly EventSubscriber<nint, Guid, nint> _createdCharacterBase;
|
||||
private readonly EventSubscriber<ModSettingChange, Guid, string, bool> _modSettingChanged;
|
||||
private readonly EventSubscriber<JObject, string, Guid> _pcpParsed;
|
||||
private readonly EventSubscriber<JObject, ushort, string> _pcpCreated;
|
||||
private readonly IDalamudPluginInterface _pluginInterface;
|
||||
private readonly Configuration _config;
|
||||
private readonly EventSubscriber<ChangedItemType, uint> _tooltipSubscriber;
|
||||
private readonly EventSubscriber<MouseButton, ChangedItemType, uint> _clickSubscriber;
|
||||
private readonly EventSubscriber<nint, Guid, nint, nint, nint> _creatingCharacterBase;
|
||||
private readonly EventSubscriber<nint, Guid, nint> _createdCharacterBase;
|
||||
private readonly EventSubscriber<ModSettingChange, Guid, string, bool> _modSettingChanged;
|
||||
private readonly EventSubscriber<JObject, string, Guid> _pcpParsed;
|
||||
private readonly EventSubscriber<JObject, ushort, string> _pcpCreated;
|
||||
private readonly EventSubscriber<string, string, Dictionary<Assembly, (bool, string)>> _modUsageQueried;
|
||||
|
||||
private global::Penumbra.Api.IpcSubscribers.GetCollectionsByIdentifier? _collectionByIdentifier;
|
||||
private global::Penumbra.Api.IpcSubscribers.GetCollections? _collections;
|
||||
|
|
@ -109,6 +110,7 @@ public class PenumbraService : IDisposable
|
|||
_modSettingChanged = global::Penumbra.Api.IpcSubscribers.ModSettingChanged.Subscriber(pi);
|
||||
_pcpCreated = global::Penumbra.Api.IpcSubscribers.CreatingPcp.Subscriber(pi);
|
||||
_pcpParsed = global::Penumbra.Api.IpcSubscribers.ParsingPcp.Subscriber(pi);
|
||||
_modUsageQueried = global::Penumbra.Api.IpcSubscribers.ModUsageQueried.Subscriber(pi);
|
||||
Reattach();
|
||||
}
|
||||
|
||||
|
|
@ -155,6 +157,12 @@ public class PenumbraService : IDisposable
|
|||
remove => _pcpParsed.Event -= value;
|
||||
}
|
||||
|
||||
public event Action<string, string, Dictionary<Assembly, (bool, string)>> ModUsageQueried
|
||||
{
|
||||
add => _modUsageQueried.Event += value;
|
||||
remove => _modUsageQueried.Event -= value;
|
||||
}
|
||||
|
||||
public event Action? DrawSettingsSection;
|
||||
|
||||
private void InvokeDrawSettingsSection()
|
||||
|
|
@ -573,7 +581,7 @@ public class PenumbraService : IDisposable
|
|||
_changedItems = new global::Penumbra.Api.IpcSubscribers.GetChangedItemAdapterList(_pluginInterface).Invoke();
|
||||
_checkCurrentChangedItems =
|
||||
new global::Penumbra.Api.IpcSubscribers.CheckCurrentChangedItemFunc(_pluginInterface).Invoke();
|
||||
_registerSettingsSection = new global::Penumbra.Api.IpcSubscribers.RegisterSettingsSection(_pluginInterface);
|
||||
_registerSettingsSection = new global::Penumbra.Api.IpcSubscribers.RegisterSettingsSection(_pluginInterface);
|
||||
_unregisterSettingsSection = new global::Penumbra.Api.IpcSubscribers.UnregisterSettingsSection(_pluginInterface);
|
||||
|
||||
_registerSettingsSection.Invoke(InvokeDrawSettingsSection);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ using Penumbra.GameData.Enums;
|
|||
using Penumbra.GameData.Structs;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||
using Glamourer.GameData;
|
||||
using Penumbra.GameData.DataContainers;
|
||||
|
|
@ -602,14 +601,21 @@ public class StateListener : IDisposable
|
|||
change = UpdateState.Change;
|
||||
}
|
||||
|
||||
if (baseData.Skeleton.Id != weapon.Skeleton.Id || baseData.Weapon.Id != weapon.Weapon.Id || baseData.Variant != weapon.Variant)
|
||||
var idsDiffer = baseData.Skeleton.Id != weapon.Skeleton.Id
|
||||
|| baseData.Weapon.Id != weapon.Weapon.Id
|
||||
|| baseData.Variant != weapon.Variant;
|
||||
// Special case when nothing is equipped to the offhand which is already nothing, but we need to update the type.
|
||||
var nothingDiffers = baseData.Skeleton.Id is 0 && slot is EquipSlot.OffHand;
|
||||
|
||||
if (idsDiffer || nothingDiffers)
|
||||
{
|
||||
if (_isPlayerNpc)
|
||||
return UpdateState.Transformed;
|
||||
|
||||
var item = _items.Identify(slot, weapon.Skeleton, weapon.Weapon, weapon.Variant,
|
||||
slot is EquipSlot.OffHand ? state.BaseData.MainhandType : FullEquipType.Unknown);
|
||||
state.BaseData.SetItem(slot, item);
|
||||
if (idsDiffer || item.Type != state.BaseData.OffhandType)
|
||||
state.BaseData.SetItem(slot, item);
|
||||
change = UpdateState.Change;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 52a3216a525592205198303df2844435e382cf87
|
||||
Subproject commit a79ff8d87c5b1ac12192f18563fb4247173ff4f0
|
||||
10
repo.json
10
repo.json
|
|
@ -17,8 +17,8 @@
|
|||
"Character"
|
||||
],
|
||||
"InternalName": "Glamourer",
|
||||
"AssemblyVersion": "1.5.1.6",
|
||||
"TestingAssemblyVersion": "1.5.1.6",
|
||||
"AssemblyVersion": "1.5.1.8",
|
||||
"TestingAssemblyVersion": "1.5.1.8",
|
||||
"RepoUrl": "https://github.com/Ottermandias/Glamourer",
|
||||
"ApplicableVersion": "any",
|
||||
"DalamudApiLevel": 14,
|
||||
|
|
@ -27,9 +27,9 @@
|
|||
"IsTestingExclusive": "False",
|
||||
"DownloadCount": 1,
|
||||
"LastUpdate": 1618608322,
|
||||
"DownloadLinkInstall": "https://github.com/Ottermandias/Glamourer/releases/download/1.5.1.6/Glamourer.zip",
|
||||
"DownloadLinkUpdate": "https://github.com/Ottermandias/Glamourer/releases/download/1.5.1.6/Glamourer.zip",
|
||||
"DownloadLinkTesting": "https://github.com/Ottermandias/Glamourer/releases/download/1.5.1.6/Glamourer.zip",
|
||||
"DownloadLinkInstall": "https://github.com/Ottermandias/Glamourer/releases/download/1.5.1.8/Glamourer.zip",
|
||||
"DownloadLinkUpdate": "https://github.com/Ottermandias/Glamourer/releases/download/1.5.1.8/Glamourer.zip",
|
||||
"DownloadLinkTesting": "https://github.com/Ottermandias/Glamourer/releases/download/1.5.1.8/Glamourer.zip",
|
||||
"IconUrl": "https://raw.githubusercontent.com/Ottermandias/Glamourer/main/images/icon.png"
|
||||
}
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue