Compare commits

..

No commits in common. "main" and "1.5.1.7" have entirely different histories.

8 changed files with 24 additions and 100 deletions

View file

@ -280,8 +280,8 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn
{ {
var name = tok["Name"]?.ToObject<string>(); var name = tok["Name"]?.ToObject<string>();
var directory = tok["Directory"]?.ToObject<string>(); var directory = tok["Directory"]?.ToObject<string>();
var enabled = tok["Enabled"]?.ToObject<bool>() ?? false; var enabled = tok["Enabled"]?.ToObject<bool>();
if (name == null || directory == null) if (name == null || directory == null || enabled == null)
{ {
Glamourer.Messager.NotificationMessage("The loaded design contains an invalid mod, skipped.", NotificationType.Warning); Glamourer.Messager.NotificationMessage("The loaded design contains an invalid mod, skipped.", NotificationType.Warning);
continue; continue;
@ -295,7 +295,7 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn
settings.Add(key, value); settings.Add(key, value);
var priority = tok["Priority"]?.ToObject<int>() ?? 0; var priority = tok["Priority"]?.ToObject<int>() ?? 0;
if (!design.AssociatedMods.TryAdd(new Mod(name, directory), if (!design.AssociatedMods.TryAdd(new Mod(name, directory),
new ModSettings(settings, priority, enabled, forceInherit, removeSetting))) new ModSettings(settings, priority, enabled.Value, forceInherit, removeSetting)))
Glamourer.Messager.NotificationMessage("The loaded design contains a mod more than once, skipped.", NotificationType.Warning); Glamourer.Messager.NotificationMessage("The loaded design contains a mod more than once, skipped.", NotificationType.Warning);
} }
} }

View file

@ -1,7 +1,6 @@
using Glamourer.GameData; using Glamourer.GameData;
using Glamourer.Interop.Material; using Glamourer.Interop.Material;
using Glamourer.Interop.Penumbra; using Glamourer.Interop.Penumbra;
using Glamourer.State;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
namespace Glamourer.Designs.History; namespace Glamourer.Designs.History;
@ -126,10 +125,7 @@ public readonly record struct MaterialTransaction(MaterialValueIndex Index, Colo
=> older is MaterialTransaction other && Index == other.Index ? new MaterialTransaction(Index, other.Old, New) : null; => older is MaterialTransaction other && Index == other.Index ? new MaterialTransaction(Index, other.Old, New) : null;
public void Revert(IDesignEditor editor, object data) 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> /// <remarks> Only Designs. </remarks>

View file

@ -194,7 +194,7 @@ public class UnlockTable : Table<EquipItem>, IDisposable
ImGui.Dummy(new Vector2(ImGui.GetFrameHeight())); ImGui.Dummy(new Vector2(ImGui.GetFrameHeight()));
ImGui.SameLine(); ImGui.SameLine();
ImGui.AlignTextToFramePadding(); ImGui.AlignTextToFramePadding();
if (ImGui.Selectable(item.Name) && item.Id is { IsBonusItem: false, IsCustom: false }) if (ImGui.Selectable(item.Name))
Glamourer.Messager.Chat.Print(new SeStringBuilder().AddItemLink(item.ItemId.Id, false).BuiltString); Glamourer.Messager.Chat.Print(new SeStringBuilder().AddItemLink(item.ItemId.Id, false).BuiltString);
if (ImGui.IsItemClicked(ImGuiMouseButton.Right) && _tooltip.Player(out var state)) if (ImGui.IsItemClicked(ImGuiMouseButton.Right) && _tooltip.Player(out var state))

View file

@ -1,58 +0,0 @@
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;
}

View file

@ -53,7 +53,6 @@ public class PenumbraService : IDisposable
private readonly EventSubscriber<ModSettingChange, Guid, string, bool> _modSettingChanged; private readonly EventSubscriber<ModSettingChange, Guid, string, bool> _modSettingChanged;
private readonly EventSubscriber<JObject, string, Guid> _pcpParsed; private readonly EventSubscriber<JObject, string, Guid> _pcpParsed;
private readonly EventSubscriber<JObject, ushort, string> _pcpCreated; 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.GetCollectionsByIdentifier? _collectionByIdentifier;
private global::Penumbra.Api.IpcSubscribers.GetCollections? _collections; private global::Penumbra.Api.IpcSubscribers.GetCollections? _collections;
@ -110,7 +109,6 @@ public class PenumbraService : IDisposable
_modSettingChanged = global::Penumbra.Api.IpcSubscribers.ModSettingChanged.Subscriber(pi); _modSettingChanged = global::Penumbra.Api.IpcSubscribers.ModSettingChanged.Subscriber(pi);
_pcpCreated = global::Penumbra.Api.IpcSubscribers.CreatingPcp.Subscriber(pi); _pcpCreated = global::Penumbra.Api.IpcSubscribers.CreatingPcp.Subscriber(pi);
_pcpParsed = global::Penumbra.Api.IpcSubscribers.ParsingPcp.Subscriber(pi); _pcpParsed = global::Penumbra.Api.IpcSubscribers.ParsingPcp.Subscriber(pi);
_modUsageQueried = global::Penumbra.Api.IpcSubscribers.ModUsageQueried.Subscriber(pi);
Reattach(); Reattach();
} }
@ -157,12 +155,6 @@ public class PenumbraService : IDisposable
remove => _pcpParsed.Event -= value; 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; public event Action? DrawSettingsSection;
private void InvokeDrawSettingsSection() private void InvokeDrawSettingsSection()

View file

@ -9,6 +9,7 @@ using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Conditions;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.Game.Character;
using FFXIVClientStructs.FFXIV.Client.Game.Object; using FFXIVClientStructs.FFXIV.Client.Game.Object;
using Glamourer.GameData; using Glamourer.GameData;
using Penumbra.GameData.DataContainers; using Penumbra.GameData.DataContainers;
@ -601,20 +602,13 @@ public class StateListener : IDisposable
change = UpdateState.Change; change = UpdateState.Change;
} }
var idsDiffer = baseData.Skeleton.Id != weapon.Skeleton.Id if (baseData.Skeleton.Id != weapon.Skeleton.Id || baseData.Weapon.Id != weapon.Weapon.Id || baseData.Variant != weapon.Variant)
|| 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) if (_isPlayerNpc)
return UpdateState.Transformed; return UpdateState.Transformed;
var item = _items.Identify(slot, weapon.Skeleton, weapon.Weapon, weapon.Variant, var item = _items.Identify(slot, weapon.Skeleton, weapon.Weapon, weapon.Variant,
slot is EquipSlot.OffHand ? state.BaseData.MainhandType : FullEquipType.Unknown); slot is EquipSlot.OffHand ? state.BaseData.MainhandType : FullEquipType.Unknown);
if (idsDiffer || item.Type != state.BaseData.OffhandType)
state.BaseData.SetItem(slot, item); state.BaseData.SetItem(slot, item);
change = UpdateState.Change; change = UpdateState.Change;
} }

@ -1 +1 @@
Subproject commit a79ff8d87c5b1ac12192f18563fb4247173ff4f0 Subproject commit 52a3216a525592205198303df2844435e382cf87

View file

@ -17,8 +17,8 @@
"Character" "Character"
], ],
"InternalName": "Glamourer", "InternalName": "Glamourer",
"AssemblyVersion": "1.5.1.8", "AssemblyVersion": "1.5.1.6",
"TestingAssemblyVersion": "1.5.1.8", "TestingAssemblyVersion": "1.5.1.6",
"RepoUrl": "https://github.com/Ottermandias/Glamourer", "RepoUrl": "https://github.com/Ottermandias/Glamourer",
"ApplicableVersion": "any", "ApplicableVersion": "any",
"DalamudApiLevel": 14, "DalamudApiLevel": 14,
@ -27,9 +27,9 @@
"IsTestingExclusive": "False", "IsTestingExclusive": "False",
"DownloadCount": 1, "DownloadCount": 1,
"LastUpdate": 1618608322, "LastUpdate": 1618608322,
"DownloadLinkInstall": "https://github.com/Ottermandias/Glamourer/releases/download/1.5.1.8/Glamourer.zip", "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.8/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.8/Glamourer.zip", "DownloadLinkTesting": "https://github.com/Ottermandias/Glamourer/releases/download/1.5.1.6/Glamourer.zip",
"IconUrl": "https://raw.githubusercontent.com/Ottermandias/Glamourer/main/images/icon.png" "IconUrl": "https://raw.githubusercontent.com/Ottermandias/Glamourer/main/images/icon.png"
} }
] ]