fix: Fixes spawner timer deserialization, decimal deserialization, and adds potion keg reverse lookup (#1711)

### Summary
* Fixes spawner timer deserialization
* Adds a check for a null timer and allows the timer to get recreated
* Adds PotionKeg reverse lookup
* Heavily optimizes decimal serialize/deserialize
This commit is contained in:
Kamron Batman 2024-03-28 13:34:12 -07:00 • committed by GitHub
parent 70575e1517
commit 1a7e7c7c70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 126 additions and 49 deletions

View file

@ -1,22 +1,21 @@
using System;
using Xunit;
namespace Server.Tests
namespace Server.Tests;
public class EnumConversionTests
{
public class EnumConversionTests
[Fact]
public void TestToEnum()
{
[Fact]
public void TestToEnum()
{
var e = ReadEnum<TileFlag>();
var e = ReadEnum<TileFlag>();
Assert.Equal(TileFlag.Container, e);
}
Assert.Equal(TileFlag.Container, e);
}
private unsafe T ReadEnum<T>() where T : unmanaged, Enum
{
var num = (long)TileFlag.Container;
return *(T*)&num;
}
private static unsafe T ReadEnum<T>() where T : unmanaged, Enum
{
var num = (long)TileFlag.Container;
return *(T*)&num;
}
}