Fix some issues with Unlocked Mode and NPC stuff.

This commit is contained in:
Ottermandias 2023-07-23 13:34:46 +02:00
parent 4e2b719122
commit fa4f22f6f5
5 changed files with 13 additions and 16 deletions

View file

@ -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();
}