mirror of
https://github.com/modernuo/ModernUO
synced 2026-08-11 22:23:06 -04:00
### Summary * Added World.NewVirtual for creating virtual serial numbers * Reserved range 0x7EEEEEEE to 0x7FFFFFFF for virtual serials * Hair and Facial hair (for mobiles) now use virtual serials instead of FakeSerial() functions * Consolidated virtual hair to a single `VirtualHairInfo` class. Corpse hair and facial hair now persists across save/load and hair and facial hair no longer teleport to newest corpse.
24 lines
753 B
C#
24 lines
753 B
C#
using Xunit;
|
|
|
|
namespace Server.Tests;
|
|
|
|
[Collection("Sequential Tests")]
|
|
public class VirtualSerialTests : IClassFixture<ServerFixture>
|
|
{
|
|
[Fact]
|
|
public void TestNewVirtualGetsAndRollover()
|
|
{
|
|
// Acquire virtual serials until we hit the max
|
|
Serial lastSerial = World.NewVirtual;
|
|
do
|
|
{
|
|
Serial virtualSerial = World.NewVirtual;
|
|
Assert.Equal(lastSerial + 1, virtualSerial);
|
|
lastSerial = (Serial) (uint) virtualSerial;
|
|
} while (lastSerial != World.MaxVirtualSerial);
|
|
|
|
// Next one should be MaxItemSerial (the first VirtualSerial) due to rollover
|
|
var nextSerial = World.NewVirtual;
|
|
Assert.Equal(nextSerial, (Serial)World.ResetVirtualSerial);
|
|
}
|
|
}
|