test: drop the fossilized v22 legacy-stream test
It served its purpose validating the migration during development; the legacy path is one-time upgrade code and the replica writer was most of the file. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
cdcf82cfd8
commit
6d7eb24cc1
1 changed files with 3 additions and 112 deletions
|
|
@ -6,11 +6,9 @@ using Xunit;
|
|||
|
||||
namespace UOContent.Tests.Mobiles;
|
||||
|
||||
// BaseCreature's move to the SerializationGenerator (v23) is guarded three ways: the new
|
||||
// SaveFlag format round-trips both a default and a fully-populated creature with exact
|
||||
// byte consumption, back-to-back saves are byte-identical (freeze-time stability), and a
|
||||
// byte-authentic pre-codegen v22 stream (written by a fossilized replica of the old
|
||||
// Serialize) loads through the legacy path with the table-speed migration applied.
|
||||
// BaseCreature's SaveFlag format round-trips both a default and a fully-populated
|
||||
// creature with exact byte consumption, and back-to-back saves are byte-identical
|
||||
// (freeze-time stability).
|
||||
[Collection("Sequential UOContent Tests")]
|
||||
public class BaseCreatureSerializationTests : IDisposable
|
||||
{
|
||||
|
|
@ -259,111 +257,4 @@ public class BaseCreatureSerializationTests : IDisposable
|
|||
Assert.Equal(0.9, copy.PassiveMoveSpeed);
|
||||
}
|
||||
|
||||
private sealed class MobileStub : Mobile
|
||||
{
|
||||
public MobileStub() => Body = 0xC9;
|
||||
}
|
||||
|
||||
// Byte-authentic replica of the pre-codegen v22 tail — fossilized so the legacy
|
||||
// upgrade path stays covered without an old save binary. The full stream is a plain
|
||||
// Mobile section (identical layout for every Mobile subclass) followed by this tail.
|
||||
private static void WriteLegacyV22Tail(IGenericWriter writer)
|
||||
{
|
||||
writer.Write(22); // version
|
||||
writer.Write((int)AIType.AI_Melee); // current AI
|
||||
writer.Write((int)AIType.AI_Melee); // default AI
|
||||
writer.Write(10); // RangePerception
|
||||
writer.Write(1); // RangeFight
|
||||
writer.Write(0); // Team
|
||||
writer.Write(0.3); // active (matches the stub table)
|
||||
writer.Write(0.6); // passive
|
||||
writer.Write(0.6); // current
|
||||
writer.Write(2000); // Home X
|
||||
writer.Write(2100); // Home Y
|
||||
writer.Write(7); // Home Z
|
||||
writer.Write(6); // RangeHome
|
||||
writer.Write((int)FightMode.Closest);
|
||||
writer.Write(false); // controlled
|
||||
writer.Write((Mobile)null); // control master
|
||||
writer.Write((Mobile)null); // control target
|
||||
writer.Write(Point3D.Zero); // control dest
|
||||
writer.Write((int)OrderType.None);
|
||||
writer.Write(0.0); // min tame skill
|
||||
writer.Write(true); // tamable
|
||||
writer.Write(false); // summoned
|
||||
writer.Write(2); // control slots
|
||||
writer.Write(73); // loyalty
|
||||
writer.Write((Item)null); // waypoint
|
||||
writer.Write((Mobile)null); // summon master
|
||||
writer.Write(180); // hits seed
|
||||
writer.Write(-1); // stam seed
|
||||
writer.Write(-1); // mana seed
|
||||
writer.Write(7); // damage min
|
||||
writer.Write(14); // damage max
|
||||
writer.Write(30); // phys resist
|
||||
writer.Write(100); // phys damage
|
||||
writer.Write(10); // fire resist
|
||||
writer.Write(0); // fire damage
|
||||
writer.Write(0); // cold resist
|
||||
writer.Write(0); // cold damage
|
||||
writer.Write(0); // poison resist
|
||||
writer.Write(0); // poison damage
|
||||
writer.Write(0); // energy resist
|
||||
writer.Write(0); // energy damage
|
||||
writer.Write(new List<Mobile>()); // owners
|
||||
writer.Write(false); // dead pet
|
||||
writer.Write(false); // bonded
|
||||
writer.Write(DateTime.MinValue); // bonding begin
|
||||
writer.Write(DateTime.MinValue); // abandon time
|
||||
writer.Write(true); // has generated loot
|
||||
writer.Write(false); // paragon
|
||||
writer.Write(false); // has friends
|
||||
writer.Write(false); // remove if untamed
|
||||
writer.Write(0); // remove step
|
||||
writer.Write(TimeSpan.Zero); // delete time left
|
||||
writer.Write((string)null); // corpse name override
|
||||
writer.Write((Map)null); // home map
|
||||
writer.Write(0.0); // active move speed (v22)
|
||||
writer.Write(0.0); // passive move speed (v22)
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LegacyV22Stream_LoadsThroughLegacyPath()
|
||||
{
|
||||
// Every serialized BaseCreature starts with the Mobile base section; a plain
|
||||
// Mobile donor produces a byte-authentic one.
|
||||
var donor = new MobileStub();
|
||||
donor.DefaultMobileInit();
|
||||
_created.Add(donor);
|
||||
|
||||
var writer = new BufferWriter(true);
|
||||
donor.Serialize(writer);
|
||||
WriteLegacyV22Tail(writer);
|
||||
|
||||
var buffer = new byte[writer.Position];
|
||||
writer.Buffer.AsSpan(0, (int)writer.Position).CopyTo(buffer);
|
||||
|
||||
var copy = new CreatureStub(World.NewMobile);
|
||||
_created.Add(copy);
|
||||
var reader = new BufferReader(buffer);
|
||||
copy.Deserialize(reader);
|
||||
|
||||
Assert.Equal(buffer.Length, reader.Position);
|
||||
Assert.Equal(10, copy.RangePerception);
|
||||
Assert.Equal(new Point3D(2000, 2100, 7), copy.Home);
|
||||
Assert.Equal(6, copy.RangeHome);
|
||||
Assert.True(copy.Tamable);
|
||||
Assert.Equal(2, copy.ControlSlots);
|
||||
Assert.Equal(73, copy.Loyalty);
|
||||
Assert.Equal(180, copy.HitsMaxSeed);
|
||||
Assert.Equal(7, copy.DamageMin);
|
||||
Assert.Equal(14, copy.DamageMax);
|
||||
Assert.Equal(30, copy.PhysicalResistanceSeed);
|
||||
Assert.Equal(10, copy.FireResistSeed);
|
||||
Assert.Equal(0.3, copy.ActiveSpeed);
|
||||
// v22 wrote explicit zeros for the move overrides ("inherit"), so the resolved
|
||||
// pace falls back to the think clock.
|
||||
Assert.Equal(0, copy.ActiveMoveSpeed);
|
||||
Assert.Equal(0.6, copy.CurrentMoveSpeed); // passive mode, inheriting
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue