mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-21 15:07:43 +01:00
.
This commit is contained in:
parent
ee98d6b600
commit
20cc67275a
25 changed files with 324 additions and 173 deletions
|
|
@ -26,9 +26,13 @@ public class CodeService
|
|||
public Race EnabledOops { get; private set; }
|
||||
public bool EnabledMesmer { get; private set; }
|
||||
public bool EnabledInventory { get; private set; }
|
||||
public bool EnabledArtisan { get; private set; }
|
||||
|
||||
public CodeService(Configuration config)
|
||||
=> _config = config;
|
||||
{
|
||||
_config = config;
|
||||
Load();
|
||||
}
|
||||
|
||||
private void Load()
|
||||
{
|
||||
|
|
@ -84,6 +88,7 @@ public class CodeService
|
|||
_ when CodeOops7.SequenceEqual(sha) => v => EnabledOops = v ? Race.Hrothgar : Race.Unknown,
|
||||
_ when CodeOops8.SequenceEqual(sha) => v => EnabledOops = v ? Race.Viera : Race.Unknown,
|
||||
_ when CodeInventory.SequenceEqual(sha) => v => EnabledInventory = v,
|
||||
_ when CodeArtisan.SequenceEqual(sha) => v => EnabledArtisan = v,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
|
@ -104,5 +109,6 @@ public class CodeService
|
|||
private static ReadOnlySpan<byte> CodeOops7 => new byte[] { 0x41, 0xEC, 0x65, 0x05, 0x8D, 0x20, 0x68, 0x5A, 0xB7, 0xEB, 0x92, 0x15, 0x43, 0xCF, 0x15, 0x05, 0x27, 0x51, 0xFE, 0x20, 0xC9, 0xB6, 0x2B, 0x84, 0xD9, 0x6A, 0x49, 0x5A, 0x5B, 0x7F, 0x2E, 0xE7 };
|
||||
private static ReadOnlySpan<byte> CodeOops8 => new byte[] { 0x16, 0xFF, 0x63, 0x85, 0x1C, 0xF5, 0x34, 0x33, 0x67, 0x8C, 0x46, 0x8E, 0x3E, 0xE3, 0xA6, 0x94, 0xF9, 0x74, 0x47, 0xAA, 0xC7, 0x29, 0x59, 0x1F, 0x6C, 0x6E, 0xF2, 0xF5, 0x87, 0x24, 0x9E, 0x2B };
|
||||
private static ReadOnlySpan<byte> CodeInventory => new byte[] { 0xD1, 0x35, 0xD7, 0x18, 0xBE, 0x45, 0x42, 0xBD, 0x88, 0x77, 0x7E, 0xC4, 0x41, 0x06, 0x34, 0x4D, 0x71, 0x3A, 0xC5, 0xCC, 0xA4, 0x1B, 0x7D, 0x3F, 0x3B, 0x86, 0x07, 0xCB, 0x63, 0xD7, 0xF9, 0xDB };
|
||||
private static ReadOnlySpan<byte> CodeArtisan => new byte[] { 0xDE, 0x01, 0x32, 0x1E, 0x7F, 0x22, 0x80, 0x3D, 0x76, 0xDF, 0x74, 0x0E, 0xEC, 0x33, 0xD3, 0xF4, 0x1A, 0x98, 0x9E, 0x9D, 0x22, 0x5C, 0xAC, 0x3B, 0xFE, 0x0B, 0xC2, 0x13, 0xB9, 0x91, 0x24, 0x61 };
|
||||
// @formatter:on
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public sealed class CustomizationService : AsyncServiceWrapper<ICustomizationMan
|
|||
=> HumanModels = humanModels;
|
||||
|
||||
public (Customize NewValue, CustomizeFlag Applied, CustomizeFlag Changed) Combine(Customize oldValues, Customize newValues,
|
||||
CustomizeFlag applyWhich)
|
||||
CustomizeFlag applyWhich, bool allowUnknown)
|
||||
{
|
||||
CustomizeFlag applied = 0;
|
||||
CustomizeFlag changed = 0;
|
||||
|
|
@ -46,7 +46,7 @@ public sealed class CustomizationService : AsyncServiceWrapper<ICustomizationMan
|
|||
continue;
|
||||
|
||||
var value = newValues[index];
|
||||
if (IsCustomizationValid(set, ret.Face, index, value))
|
||||
if (allowUnknown || IsCustomizationValid(set, ret.Face, index, value))
|
||||
{
|
||||
if (ret[index].Value != value.Value)
|
||||
changed |= flag;
|
||||
|
|
@ -194,7 +194,7 @@ public sealed class CustomizationService : AsyncServiceWrapper<ICustomizationMan
|
|||
|
||||
/// <summary>
|
||||
/// Check that the given model id is valid.
|
||||
/// The returned model id is 0.
|
||||
/// The returned model id is 0 if it is not.
|
||||
/// The return value is an empty string if everything was correct and a warning otherwise.
|
||||
/// </summary>
|
||||
public string ValidateModelId(uint modelId, out uint actualModelId, out bool isHuman)
|
||||
|
|
@ -217,9 +217,9 @@ public sealed class CustomizationService : AsyncServiceWrapper<ICustomizationMan
|
|||
/// The return value is an empty string or a warning message.
|
||||
/// </summary>
|
||||
public static string ValidateCustomizeValue(CustomizationSet set, CustomizeValue face, CustomizeIndex index, CustomizeValue value,
|
||||
out CustomizeValue actualValue)
|
||||
out CustomizeValue actualValue, bool allowUnknown)
|
||||
{
|
||||
if (IsCustomizationValid(set, face, index, value))
|
||||
if (allowUnknown || IsCustomizationValid(set, face, index, value))
|
||||
{
|
||||
actualValue = value;
|
||||
return string.Empty;
|
||||
|
|
@ -279,7 +279,7 @@ public sealed class CustomizationService : AsyncServiceWrapper<ICustomizationMan
|
|||
CustomizeFlag flags = 0;
|
||||
foreach (var idx in Enum.GetValues<CustomizeIndex>().Where(set.IsAvailable))
|
||||
{
|
||||
if (ValidateCustomizeValue(set, customize.Face, idx, customize[idx], out var fixedValue).Length > 0)
|
||||
if (ValidateCustomizeValue(set, customize.Face, idx, customize[idx], out var fixedValue, false).Length > 0)
|
||||
{
|
||||
customize[idx] = fixedValue;
|
||||
flags |= idx.ToFlag();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using Lumina.Excel;
|
|||
using Penumbra.GameData.Data;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using static OtterGui.Raii.ImRaii;
|
||||
using Race = Penumbra.GameData.Enums.Race;
|
||||
|
||||
namespace Glamourer.Services;
|
||||
|
|
@ -111,7 +112,7 @@ public class ItemManager : IDisposable
|
|||
var item = IdentifierService.AwaitedService.Identify(id, variant, slot).FirstOrDefault();
|
||||
return item.Valid
|
||||
? item
|
||||
: new EquipItem($"Unknown ({id.Value}-{variant})", 0, 0, id, 0, variant, 0);
|
||||
: new EquipItem($"Unknown ({id.Value}-{variant})", 0, 0, id, 0, variant, slot.ToEquipType());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +132,7 @@ public class ItemManager : IDisposable
|
|||
var item = IdentifierService.AwaitedService.Identify(id, type, variant, slot).FirstOrDefault();
|
||||
return item.Valid
|
||||
? item
|
||||
: new EquipItem($"Unknown ({id.Value}-{type.Value}-{variant})", 0, 0, id, type, variant, 0);
|
||||
: EquipItem.FromIds(0, 0, id, type, variant, slot.ToEquipType(), null);
|
||||
}
|
||||
|
||||
/// <summary> Returns whether an item id represents a valid item for a slot and gives the item. </summary>
|
||||
|
|
@ -147,12 +148,20 @@ public class ItemManager : IDisposable
|
|||
/// The returned item is either the resolved correct item, or the Nothing item for that slot.
|
||||
/// The return value is an empty string if there was no problem and a warning otherwise.
|
||||
/// </summary>
|
||||
public string ValidateItem(EquipSlot slot, uint itemId, out EquipItem item)
|
||||
public string ValidateItem(EquipSlot slot, ulong itemId, out EquipItem item, bool allowUnknown)
|
||||
{
|
||||
if (slot is EquipSlot.MainHand or EquipSlot.OffHand)
|
||||
throw new Exception("Internal Error: Used armor functionality for weapons.");
|
||||
|
||||
if (IsItemValid(slot, itemId, out item))
|
||||
if (itemId > uint.MaxValue)
|
||||
{
|
||||
var id = (SetId)(itemId & ushort.MaxValue);
|
||||
var variant = (byte)(itemId >> 32);
|
||||
item = new EquipItem($"Unknown ({id}-{variant})", 0, 0, id, 0, variant, slot.ToEquipType());
|
||||
return allowUnknown ? string.Empty : $"The item {itemId} yields an unknown item.";
|
||||
}
|
||||
|
||||
if (IsItemValid(slot, (uint) itemId, out item))
|
||||
return string.Empty;
|
||||
|
||||
item = NothingItem(slot);
|
||||
|
|
@ -169,9 +178,9 @@ public class ItemManager : IDisposable
|
|||
/// The returned stain id is either the input or 0.
|
||||
/// The return value is an empty string if there was no problem and a warning otherwise.
|
||||
/// </summary>
|
||||
public string ValidateStain(StainId stain, out StainId ret)
|
||||
public string ValidateStain(StainId stain, out StainId ret, bool allowUnknown)
|
||||
{
|
||||
if (IsStainValid(stain))
|
||||
if (allowUnknown || IsStainValid(stain))
|
||||
{
|
||||
ret = stain;
|
||||
return string.Empty;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue