- [X] Cleans up gump packets
- [X] Adds event loop task synchronization
- [X] Moves timer pause and cleans up the delay task timer class
- [X] Cleans up the conserve cpu
- [X] Renames variables to make them consistent with the new style
- [X] Removes process delta recursion checking.
- [X] Properly diposes net states. This fixes edge cases that may cause hanging connections to stay open longer than they should.
- [X] Fixes an issue with gump items not compiling properly
Users can now utilize `Timer.Pause()` since the code will be executed on the proper thread.
```cs
public void async void Talk()
{
_canTalk = false;
await Timer.Pause(Utility.RandomMinMax(5000, 8000)); // Talk after 5-8 seconds
DoTalk();
await Timer.Pause(Utility.RandomMinMax(12000, 25000)); // Reset ability to talk after 12-25 seconds
_canTalk = true;
}
```
33 lines
1 KiB
C#
33 lines
1 KiB
C#
using System;
|
|
using Server.Mobiles;
|
|
using Server.Network;
|
|
using Server.SkillHandlers;
|
|
using Server.Tests;
|
|
using Server.Tests.Network;
|
|
using Xunit;
|
|
|
|
namespace UOContent.Tests
|
|
{
|
|
public class TrackingGumpTests : IClassFixture<ServerFixture>
|
|
{
|
|
[Theory]
|
|
[InlineData(ProtocolChanges.None)]
|
|
[InlineData(ProtocolChanges.Unpack)]
|
|
// Regression test used to identify an issue with AddItem compilation of the packet
|
|
public void TestTrackingGump(ProtocolChanges changes)
|
|
{
|
|
var pm = new PlayerMobile();
|
|
pm.Skills.Tracking.BaseFixedPoint = 1000;
|
|
var g = new TrackWhatGump(pm);
|
|
|
|
using var ns = PacketTestUtilities.CreateTestNetState();
|
|
ns.ProtocolChanges = changes;
|
|
|
|
var expected = g.Compile(ns).Compile();
|
|
ns.SendDisplayGump(g, out var switches, out var entries);
|
|
|
|
var result = ns.SendPipe.Reader.TryRead();
|
|
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
|
|
}
|
|
}
|
|
}
|