This commit is contained in:
Ottermandias 2023-07-02 15:34:27 +02:00
parent b63b02ae5e
commit 60443f6a53
17 changed files with 970 additions and 225 deletions

View file

@ -48,9 +48,16 @@ public class CustomizeUnlockManager : IDisposable, ISavable
/// <summary> Check if a customization is unlocked for Glamourer. </summary>
public bool IsUnlocked(CustomizeData data, out DateTimeOffset time)
{
// All other customizations are not unlockable.
if (data.Index is not CustomizeIndex.Hairstyle and not CustomizeIndex.FacePaint)
{
time = DateTime.MinValue;
return true;
}
if (!Unlockable.TryGetValue(data, out var pair))
{
time = DateTime.MaxValue;
time = DateTime.MinValue;
return true;
}
@ -62,7 +69,7 @@ public class CustomizeUnlockManager : IDisposable, ISavable
if (!IsUnlockedGame(pair.Data))
{
time = DateTimeOffset.MinValue;
time = DateTimeOffset.MaxValue;
return false;
}

View file

@ -196,6 +196,7 @@ public class ItemUnlockManager : ISavable, IDisposable
}
}
changes = false;
var inventoryManager = InventoryManager.Instance();
if (inventoryManager != null)
{
@ -216,7 +217,6 @@ public class ItemUnlockManager : ISavable, IDisposable
_currentInventoryIndex = 0;
}
}
if (changes)
Save();
}
@ -226,7 +226,7 @@ public class ItemUnlockManager : ISavable, IDisposable
// Pseudo items are always unlocked.
if (itemId >= _items.ItemSheet.RowCount)
{
time = DateTimeOffset.MaxValue;
time = DateTimeOffset.MinValue;
return true;
}
@ -244,7 +244,7 @@ public class ItemUnlockManager : ISavable, IDisposable
return true;
}
time = DateTimeOffset.MinValue;
time = DateTimeOffset.MaxValue;
return false;
}
@ -283,7 +283,7 @@ public class ItemUnlockManager : ISavable, IDisposable
=> fileNames.UnlockFileItems;
public void Save()
=> _saveService.QueueSave(this);
=> _saveService.DelaySave(this, TimeSpan.FromSeconds(10));
public void Save(StreamWriter writer)
{ }