mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-01-03 14:23:43 +01:00
Fix some issues with Unlocked Mode and NPC stuff.
This commit is contained in:
parent
4e2b719122
commit
fa4f22f6f5
5 changed files with 13 additions and 16 deletions
|
|
@ -18,7 +18,6 @@ public class AutoDesignApplier : IDisposable
|
|||
{
|
||||
private readonly Configuration _config;
|
||||
private readonly AutoDesignManager _manager;
|
||||
private readonly CodeService _code;
|
||||
private readonly StateManager _state;
|
||||
private readonly JobService _jobs;
|
||||
private readonly ActorService _actors;
|
||||
|
|
@ -28,13 +27,12 @@ public class AutoDesignApplier : IDisposable
|
|||
private readonly AutomationChanged _event;
|
||||
private readonly ObjectManager _objects;
|
||||
|
||||
public AutoDesignApplier(Configuration config, AutoDesignManager manager, CodeService code, StateManager state, JobService jobs,
|
||||
public AutoDesignApplier(Configuration config, AutoDesignManager manager, StateManager state, JobService jobs,
|
||||
CustomizationService customizations, ActorService actors, ItemUnlockManager itemUnlocks, CustomizeUnlockManager customizeUnlocks,
|
||||
AutomationChanged @event, ObjectManager objects)
|
||||
{
|
||||
_config = config;
|
||||
_manager = manager;
|
||||
_code = code;
|
||||
_state = state;
|
||||
_jobs = jobs;
|
||||
_customizations = customizations;
|
||||
|
|
@ -243,7 +241,7 @@ public class AutoDesignApplier : IDisposable
|
|||
if (equipFlags.HasFlag(flag))
|
||||
{
|
||||
var item = design.Item(slot);
|
||||
if (!_config.UnlockedItemMode || _itemUnlocks.IsUnlocked(item.ItemId, out _))
|
||||
if (!_config.UnlockedItemMode || _itemUnlocks.IsUnlocked(item.Id, out _))
|
||||
{
|
||||
if (!respectManual || state[slot, false] is not StateChanged.Source.Manual)
|
||||
_state.ChangeItem(state, slot, item, source);
|
||||
|
|
@ -264,7 +262,7 @@ public class AutoDesignApplier : IDisposable
|
|||
{
|
||||
var item = design.Item(EquipSlot.MainHand);
|
||||
if (state.ModelData.Item(EquipSlot.MainHand).Type == item.Type
|
||||
&& (!_config.UnlockedItemMode || _itemUnlocks.IsUnlocked(item.ItemId, out _)))
|
||||
&& (!_config.UnlockedItemMode || _itemUnlocks.IsUnlocked(item.Id, out _)))
|
||||
{
|
||||
if (!respectManual || state[EquipSlot.MainHand, false] is not StateChanged.Source.Manual)
|
||||
_state.ChangeItem(state, EquipSlot.MainHand, item, source);
|
||||
|
|
@ -276,7 +274,7 @@ public class AutoDesignApplier : IDisposable
|
|||
{
|
||||
var item = design.Item(EquipSlot.OffHand);
|
||||
if (state.ModelData.Item(EquipSlot.OffHand).Type == item.Type
|
||||
&& (!_config.UnlockedItemMode || _itemUnlocks.IsUnlocked(item.ItemId, out _)))
|
||||
&& (!_config.UnlockedItemMode || _itemUnlocks.IsUnlocked(item.Id, out _)))
|
||||
{
|
||||
if (!respectManual || state[EquipSlot.OffHand, false] is not StateChanged.Source.Manual)
|
||||
_state.ChangeItem(state, EquipSlot.OffHand, item, source);
|
||||
|
|
@ -350,7 +348,7 @@ public class AutoDesignApplier : IDisposable
|
|||
|
||||
var value = design.Customize[index];
|
||||
if (CustomizationService.IsCustomizationValid(set, face, index, value, out var data)
|
||||
&& (!_config.UnlockedItemMode || _customizeUnlocks.IsUnlocked(data.Value, out _)))
|
||||
&& (data.HasValue && (!_config.UnlockedItemMode || _customizeUnlocks.IsUnlocked(data.Value, out _))))
|
||||
{
|
||||
if (!respectManual || state[index] is not StateChanged.Source.Manual)
|
||||
_state.ChangeCustomize(state, index, value, source);
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ public class SetPanel
|
|||
continue;
|
||||
|
||||
var item = design.Design!.DesignData.Item(slot);
|
||||
if (!_itemUnlocks.IsUnlocked(item.ItemId, out _))
|
||||
if (!_itemUnlocks.IsUnlocked(item.Id, out _))
|
||||
sb.AppendLine($"{item.Name} in {slot.ToName()} slot is not unlocked. Consider obtaining it via gameplay means!");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ public class UnlockOverview
|
|||
|
||||
void DrawItem(EquipItem item)
|
||||
{
|
||||
var unlocked = _itemUnlocks.IsUnlocked(item.ItemId, out var time);
|
||||
var unlocked = _itemUnlocks.IsUnlocked(item.Id, out var time);
|
||||
var iconHandle = _textures.LoadIcon(item.IconId);
|
||||
if (!iconHandle.HasValue)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -120,8 +120,7 @@ public sealed class CustomizationService : AsyncServiceWrapper<ICustomizationMan
|
|||
|
||||
/// <summary> Returns whether a customization value is valid for a given clan/gender set and face. </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
public static bool IsCustomizationValid(CustomizationSet set, CustomizeValue face, CustomizeIndex type, CustomizeValue value,
|
||||
[NotNullWhen(true)] out CustomizeData? data)
|
||||
public static bool IsCustomizationValid(CustomizationSet set, CustomizeValue face, CustomizeIndex type, CustomizeValue value, out CustomizeData? data)
|
||||
=> set.Validate(type, value, out data, face);
|
||||
|
||||
/// <summary> Returns whether a customization value is valid for a given clan, gender and face. </summary>
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ public class ItemUnlockManager : ISavable, IDisposable
|
|||
Save();
|
||||
}
|
||||
|
||||
public bool IsUnlocked(uint itemId, out DateTimeOffset time)
|
||||
public bool IsUnlocked(ulong itemId, out DateTimeOffset time)
|
||||
{
|
||||
// Pseudo items are always unlocked.
|
||||
if (itemId >= _items.ItemSheet.RowCount)
|
||||
|
|
@ -210,18 +210,18 @@ public class ItemUnlockManager : ISavable, IDisposable
|
|||
return true;
|
||||
}
|
||||
|
||||
if (_unlocked.TryGetValue(itemId, out var t))
|
||||
if (_unlocked.TryGetValue((uint) itemId, out var t))
|
||||
{
|
||||
time = DateTimeOffset.FromUnixTimeMilliseconds(t);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IsGameUnlocked(itemId))
|
||||
if (IsGameUnlocked((uint) itemId))
|
||||
{
|
||||
time = DateTimeOffset.UtcNow;
|
||||
if (_unlocked.TryAdd(itemId, time.ToUnixTimeMilliseconds()))
|
||||
if (_unlocked.TryAdd((uint) itemId, time.ToUnixTimeMilliseconds()))
|
||||
{
|
||||
_event.Invoke(ObjectUnlocked.Type.Item, itemId, time);
|
||||
_event.Invoke(ObjectUnlocked.Type.Item, (uint) itemId, time);
|
||||
Save();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue