fix(core): Core cleanup, adds event loop synchronization, and fixes gumps (#429)
- [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;
}
```
This commit is contained in:
parent
07751654b7
commit
6f0e1a22f9
24 changed files with 763 additions and 449 deletions
|
|
@ -0,0 +1,33 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.0-preview-20210106-01" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
||||
<PackageReference Include="Moq" Version="4.16.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue