Add support for previewing non-existing items from Penumbra.

This commit is contained in:
Ottermandias 2024-08-31 20:51:38 +02:00
parent 03043ba2c9
commit 9a02ba2987
4 changed files with 29 additions and 5 deletions

View file

@ -1,4 +1,4 @@
using Glamourer.Designs;
using Glamourer.Designs;
using Glamourer.Events;
using Glamourer.Interop;
using Glamourer.Interop.Penumbra;
@ -168,12 +168,23 @@ public sealed class PenumbraChangedItemTooltip : IDisposable
{
case ChangedItemType.ItemOffhand:
case ChangedItemType.Item:
{
if (!_items.ItemData.TryGetValue(id, type is ChangedItemType.Item ? EquipSlot.MainHand : EquipSlot.OffHand, out var item))
return;
CreateTooltip(item, "[Glamourer] ", false);
return;
}
case ChangedItemType.CustomArmor:
{
var (model, variant, slot) = IdentifiedItem.Split(id);
var item = _items.Identify(slot.ToSlot(), model, variant);
if (item.Valid)
CreateTooltip(item, "[Glamourer] ", false);
return;
}
case ChangedItemType.Customization:
{
var (race, gender, index, value) = IdentifiedCustomization.Split(id);
if (!_objects.Player.Model.IsHuman)
return;
@ -183,6 +194,7 @@ public sealed class PenumbraChangedItemTooltip : IDisposable
ImGui.TextUnformatted("[Glamourer] Right-Click to apply to current actor.");
return;
}
}
}
@ -212,17 +224,29 @@ public sealed class PenumbraChangedItemTooltip : IDisposable
{
case ChangedItemType.Item:
case ChangedItemType.ItemOffhand:
{
if (!_items.ItemData.TryGetValue(id, type is ChangedItemType.Item ? EquipSlot.MainHand : EquipSlot.OffHand, out var item))
return;
ApplyItem(state, item);
return;
}
case ChangedItemType.CustomArmor:
{
var (model, variant, slot) = IdentifiedItem.Split(id);
var item = _items.Identify(slot.ToSlot(), model, variant);
if (item.Valid)
ApplyItem(state, item);
return;
}
case ChangedItemType.Customization:
{
var (race, gender, index, value) = IdentifiedCustomization.Split(id);
var customize = state.ModelData.Customize;
if (CheckGenderRace(customize, race, gender) && VerifyValue(customize, index, value))
_stateManager.ChangeCustomize(state, index, value, ApplySettings.Manual);
return;
}
}
}
@ -236,7 +260,7 @@ public sealed class PenumbraChangedItemTooltip : IDisposable
else
{
var oldItem = state.ModelData.Item(slot);
if (oldItem.ItemId != item.ItemId)
if (oldItem.Id != item.Id)
_lastItems[slot.ToIndex()] = oldItem;
}
}

View file

@ -31,7 +31,7 @@ public readonly record struct ModSettings(Dictionary<string, List<string>> Setti
=> new();
}
public unsafe class PenumbraService : IDisposable
public class PenumbraService : IDisposable
{
public const int RequiredPenumbraBreakingVersion = 5;
public const int RequiredPenumbraFeatureVersion = 0;

@ -1 +1 @@
Subproject commit 552246e595ffab2aaba2c75f578d564f8938fc9a
Subproject commit 97e9f427406f82a59ddef764b44ecea654a51623

@ -1 +1 @@
Subproject commit d9d4b286d54ad4027a1e8a2bbf900ee79aefaa93
Subproject commit 66bc00dc8517204e58c6515af5aec0ba6d196716