feat: Splits Server in Core and Application (#1806)
> [!Note] > **Developer Note** > Now developers will only need to build/run the Application project instead of everything. > When adding new projects, make sure to: > 1. Add a reference to that project in the Application project. > 2. Add the dll file to the Distribution/Data/assemblies.json file ### Summary - Adds an application project - Consolidates process restarts to use `Core.Kill(true)` - Removes some old messaging, for example processor optimization - Fixes missing build cleanup
This commit is contained in:
parent
e85c56ec2d
commit
60a3a6f501
43 changed files with 572 additions and 585 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,6 +1,8 @@
|
||||||
# Distribution Files
|
# Distribution Files
|
||||||
/Distribution/ModernUO
|
/Distribution/ModernUO
|
||||||
/Distribution/ModernUO.*
|
/Distribution/ModernUO.*
|
||||||
|
/Distribution/Server
|
||||||
|
/Distribution/Server.*
|
||||||
/Distribution/Assemblies
|
/Distribution/Assemblies
|
||||||
/Distribution/bsdtar
|
/Distribution/bsdtar
|
||||||
/Distribution/Configuration/antimacro.json
|
/Distribution/Configuration/antimacro.json
|
||||||
|
|
@ -19,6 +21,7 @@
|
||||||
/Distribution/*.dylib
|
/Distribution/*.dylib
|
||||||
/Distribution/*.so
|
/Distribution/*.so
|
||||||
/Distribution/*.dll
|
/Distribution/*.dll
|
||||||
|
/Distribution/*.exe
|
||||||
/Distribution/runtimes
|
/Distribution/runtimes
|
||||||
/Distribution/nohup.out
|
/Distribution/nohup.out
|
||||||
/Distribution/ref
|
/Distribution/ref
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server.Tests", "Projects\Se
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UOContent.Tests", "Projects\UOContent.Tests\UOContent.Tests.csproj", "{3C4797F9-603E-44EF-8E8C-9275CC9EA74B}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UOContent.Tests", "Projects\UOContent.Tests\UOContent.Tests.csproj", "{3C4797F9-603E-44EF-8E8C-9275CC9EA74B}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application", "Projects\Application\Application.csproj", "{E9849FA1-D4F5-4D68-A36B-249F4CB4E374}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Analyze|Any CPU = Analyze|Any CPU
|
Analyze|Any CPU = Analyze|Any CPU
|
||||||
|
|
@ -41,6 +43,12 @@ Global
|
||||||
{3C4797F9-603E-44EF-8E8C-9275CC9EA74B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{3C4797F9-603E-44EF-8E8C-9275CC9EA74B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{3C4797F9-603E-44EF-8E8C-9275CC9EA74B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{3C4797F9-603E-44EF-8E8C-9275CC9EA74B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{3C4797F9-603E-44EF-8E8C-9275CC9EA74B}.Release|Any CPU.Build.0 = Release|Any CPU
|
{3C4797F9-603E-44EF-8E8C-9275CC9EA74B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{E9849FA1-D4F5-4D68-A36B-249F4CB4E374}.Analyze|Any CPU.ActiveCfg = Analyze|Any CPU
|
||||||
|
{E9849FA1-D4F5-4D68-A36B-249F4CB4E374}.Analyze|Any CPU.Build.0 = Analyze|Any CPU
|
||||||
|
{E9849FA1-D4F5-4D68-A36B-249F4CB4E374}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E9849FA1-D4F5-4D68-A36B-249F4CB4E374}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E9849FA1-D4F5-4D68-A36B-249F4CB4E374}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E9849FA1-D4F5-4D68-A36B-249F4CB4E374}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
||||||
23
Projects/Application/Application.cs
Normal file
23
Projects/Application/Application.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Server;
|
||||||
|
|
||||||
|
public class Application
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
bool profiling = false;
|
||||||
|
|
||||||
|
foreach (var a in args)
|
||||||
|
{
|
||||||
|
if (a.InsensitiveEquals("-profile"))
|
||||||
|
{
|
||||||
|
profiling = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Core.Setup(profiling, Assembly.GetEntryAssembly(), Process.GetCurrentProcess());
|
||||||
|
}
|
||||||
|
}
|
||||||
20
Projects/Application/Application.csproj
Normal file
20
Projects/Application/Application.csproj
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<ApplicationIcon>MUO.ico</ApplicationIcon>
|
||||||
|
<StartupObject>Server.Application</StartupObject>
|
||||||
|
<AssemblyName>ModernUO</AssemblyName>
|
||||||
|
<Win32Resource />
|
||||||
|
<Product>ModernUO Server</Product>
|
||||||
|
<OutDir>..\..\Distribution</OutDir>
|
||||||
|
<Version>0.0.0</Version>
|
||||||
|
<Configurations>Debug;Release;Analyze</Configurations>
|
||||||
|
<RootNamespace>Server</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Server\Server.csproj" />
|
||||||
|
<ProjectReference Include="..\UOContent\UOContent.csproj" Private="false" PrivateAssets="All" IncludeAssets="None">
|
||||||
|
<IncludeInPackage>false</IncludeInPackage>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |
|
|
@ -1,5 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace Server.Tests;
|
namespace Server.Tests;
|
||||||
|
|
||||||
|
|
@ -8,14 +10,14 @@ internal class ServerFixture : IDisposable
|
||||||
// Global setup
|
// Global setup
|
||||||
static ServerFixture()
|
static ServerFixture()
|
||||||
{
|
{
|
||||||
Core.Assembly = Assembly.GetExecutingAssembly(); // Server.Tests.dll
|
Core.ApplicationAssembly = Assembly.GetExecutingAssembly(); // Server.Tests.dll
|
||||||
|
|
||||||
// Load Configurations
|
// Load Configurations
|
||||||
ServerConfiguration.Load(true);
|
ServerConfiguration.Load(true);
|
||||||
|
|
||||||
// Load an empty assembly list into the resolver
|
// Load an empty assembly list into the resolver
|
||||||
ServerConfiguration.AssemblyDirectories.Add(Core.BaseDirectory);
|
ServerConfiguration.AssemblyDirectories.Add(Core.BaseDirectory);
|
||||||
AssemblyHandler.LoadAssemblies(new[]{ "ModernUO.dll" });
|
AssemblyHandler.LoadAssemblies(["Server.dll"]);
|
||||||
|
|
||||||
Core.LoopContext = new EventLoopContext();
|
Core.LoopContext = new EventLoopContext();
|
||||||
Core.Expansion = Expansion.EJ;
|
Core.Expansion = Expansion.EJ;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<Configurations>Debug;Release;Analyze</Configurations>
|
<Configurations>Debug;Release;Analyze</Configurations>
|
||||||
|
<RootNamespace>Server.Tests</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
|
||||||
|
|
@ -10,9 +11,9 @@
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<ProjectReference Include="..\Server\Server.csproj" />
|
<ProjectReference Include="..\Application\Application.csproj" />
|
||||||
<ProjectReference Include="..\UOContent\UOContent.csproj" />
|
|
||||||
<DataFiles Include="$(SolutionDir)\Distribution\Data\**" />
|
<DataFiles Include="$(SolutionDir)\Distribution\Data\**" />
|
||||||
|
<ProjectReference Include="..\UOContent\UOContent.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Target Name="CopyData" AfterTargets="AfterBuild">
|
<Target Name="CopyData" AfterTargets="AfterBuild">
|
||||||
<Copy SourceFiles="@(DataFiles)" DestinationFolder="$(OutDir)\Data\%(RecursiveDir)" />
|
<Copy SourceFiles="@(DataFiles)" DestinationFolder="$(OutDir)\Data\%(RecursiveDir)" />
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,7 @@ public static class Core
|
||||||
private static bool _profiling;
|
private static bool _profiling;
|
||||||
private static long _profileStart;
|
private static long _profileStart;
|
||||||
private static long _profileTime;
|
private static long _profileTime;
|
||||||
#nullable enable
|
|
||||||
private static bool? _isRunningFromXUnit;
|
private static bool? _isRunningFromXUnit;
|
||||||
#nullable restore
|
|
||||||
|
|
||||||
private static int _itemCount;
|
private static int _itemCount;
|
||||||
private static int _mobileCount;
|
private static int _mobileCount;
|
||||||
|
|
@ -114,6 +112,7 @@ public static class Core
|
||||||
public static TimeSpan ProfileTime =>
|
public static TimeSpan ProfileTime =>
|
||||||
TimeSpan.FromTicks(_profileStart > 0 ? _profileTime + (Stopwatch.GetTimestamp() - _profileStart) : _profileTime);
|
TimeSpan.FromTicks(_profileStart > 0 ? _profileTime + (Stopwatch.GetTimestamp() - _profileStart) : _profileTime);
|
||||||
|
|
||||||
|
public static Assembly ApplicationAssembly { get; set; }
|
||||||
public static Assembly Assembly { get; set; }
|
public static Assembly Assembly { get; set; }
|
||||||
|
|
||||||
// Assembly file version
|
// Assembly file version
|
||||||
|
|
@ -177,10 +176,6 @@ public static class Core
|
||||||
|
|
||||||
public static double AverageCPS => _cyclesPerSecond.Average();
|
public static double AverageCPS => _cyclesPerSecond.Average();
|
||||||
|
|
||||||
public static bool MultiProcessor { get; private set; }
|
|
||||||
|
|
||||||
public static int ProcessorCount { get; private set; }
|
|
||||||
|
|
||||||
public static string BaseDirectory
|
public static string BaseDirectory
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -189,7 +184,7 @@ public static class Core
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_baseDirectory = Assembly.Location;
|
_baseDirectory = ApplicationAssembly.Location;
|
||||||
|
|
||||||
if (_baseDirectory.Length > 0)
|
if (_baseDirectory.Length > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -312,7 +307,7 @@ public static class Core
|
||||||
_restartOnKill = restart;
|
_restartOnKill = restart;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
public static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e.IsTerminating ? "Error:" : "Warning:");
|
Console.WriteLine(e.IsTerminating ? "Error:" : "Warning:");
|
||||||
Console.WriteLine(e.ExceptionObject);
|
Console.WriteLine(e.ExceptionObject);
|
||||||
|
|
@ -378,23 +373,32 @@ public static class Core
|
||||||
|
|
||||||
if (restart)
|
if (restart)
|
||||||
{
|
{
|
||||||
if (IsWindows)
|
try
|
||||||
{
|
{
|
||||||
Process.Start("dotnet", Assembly.Location);
|
logger.Information("Restarting");
|
||||||
}
|
if (IsWindows)
|
||||||
else
|
|
||||||
{
|
|
||||||
var process = new Process
|
|
||||||
{
|
{
|
||||||
StartInfo = new ProcessStartInfo
|
Process.Start("dotnet", ApplicationAssembly.Location);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var process = new Process
|
||||||
{
|
{
|
||||||
FileName = "dotnet",
|
StartInfo = new ProcessStartInfo
|
||||||
Arguments = Assembly.Location,
|
{
|
||||||
UseShellExecute = true
|
FileName = "dotnet",
|
||||||
}
|
Arguments = ApplicationAssembly.Location,
|
||||||
};
|
UseShellExecute = true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
process.Start();
|
process.Start();
|
||||||
|
}
|
||||||
|
logger.Information("Restart done");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.Error(e, "Restart failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -417,39 +421,22 @@ public static class Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Main(string[] args)
|
public static void Setup(bool profiling, Assembly applicationAssembly, Process process)
|
||||||
{
|
{
|
||||||
Console.OutputEncoding = Encoding.UTF8;
|
Process = process;
|
||||||
|
ApplicationAssembly = applicationAssembly;
|
||||||
|
Assembly = Assembly.GetAssembly(typeof(Core));
|
||||||
|
Thread = Thread.CurrentThread;
|
||||||
|
LoopContext = new EventLoopContext();
|
||||||
|
SynchronizationContext.SetSynchronizationContext(LoopContext);
|
||||||
|
Profiling = profiling;
|
||||||
|
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
|
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
|
||||||
AppDomain.CurrentDomain.AssemblyResolve += AssemblyHandler.AssemblyResolver;
|
AppDomain.CurrentDomain.AssemblyResolve += AssemblyHandler.AssemblyResolver;
|
||||||
|
|
||||||
LoopContext = new EventLoopContext();
|
Console.OutputEncoding = Encoding.UTF8;
|
||||||
|
Thread.Name = "Core Thread";
|
||||||
SynchronizationContext.SetSynchronizationContext(LoopContext);
|
|
||||||
|
|
||||||
foreach (var a in args)
|
|
||||||
{
|
|
||||||
if (a.InsensitiveEquals("-profile"))
|
|
||||||
{
|
|
||||||
Profiling = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread = Thread.CurrentThread;
|
|
||||||
Process = Process.GetCurrentProcess();
|
|
||||||
Assembly = Assembly.GetEntryAssembly();
|
|
||||||
|
|
||||||
if (Assembly == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Assembly entry is missing.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Thread != null)
|
|
||||||
{
|
|
||||||
Thread.Name = "Core Thread";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BaseDirectory.Length > 0)
|
if (BaseDirectory.Length > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -476,13 +463,6 @@ public static class Core
|
||||||
".TrimMultiline());
|
".TrimMultiline());
|
||||||
Utility.PopColor();
|
Utility.PopColor();
|
||||||
|
|
||||||
ProcessorCount = Environment.ProcessorCount;
|
|
||||||
|
|
||||||
if (ProcessorCount > 1)
|
|
||||||
{
|
|
||||||
MultiProcessor = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.CancelKeyPress += Console_CancelKeyPressed;
|
Console.CancelKeyPress += Console_CancelKeyPressed;
|
||||||
|
|
||||||
ServerConfiguration.Load();
|
ServerConfiguration.Load();
|
||||||
|
|
@ -496,11 +476,6 @@ public static class Core
|
||||||
logger.Information("Running with arguments: {Args}", s);
|
logger.Information("Running with arguments: {Args}", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MultiProcessor)
|
|
||||||
{
|
|
||||||
logger.Information($"Optimizing for {{ProcessorCount}} processor{(ProcessorCount == 1 ? "" : "s")}", ProcessorCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
var assemblyPath = Path.Join(BaseDirectory, AssembliesConfiguration);
|
var assemblyPath = Path.Join(BaseDirectory, AssembliesConfiguration);
|
||||||
|
|
||||||
// Load UOContent.dll
|
// Load UOContent.dll
|
||||||
|
|
|
||||||
10
Projects/Server/Server.csproj
Executable file → Normal file
10
Projects/Server/Server.csproj
Executable file → Normal file
|
|
@ -1,15 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
|
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<Product>ModernUO Core</Product>
|
||||||
<ApplicationIcon>MUO.ico</ApplicationIcon>
|
|
||||||
<StartupObject>Server.Core</StartupObject>
|
|
||||||
<AssemblyName>ModernUO</AssemblyName>
|
|
||||||
<Win32Resource />
|
|
||||||
<Product>ModernUO Server</Product>
|
|
||||||
<OutDir>..\..\Distribution</OutDir>
|
<OutDir>..\..\Distribution</OutDir>
|
||||||
<Version>0.0.0</Version>
|
<Version>0.0.0</Version>
|
||||||
<Configurations>Debug;Release;Analyze</Configurations>
|
<Configurations>Debug;Release;Analyze</Configurations>
|
||||||
|
<RootNamespace>Server</RootNamespace>
|
||||||
|
<PackageId>Server</PackageId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Target Name="CleanPub" AfterTargets="Clean">
|
<Target Name="CleanPub" AfterTargets="Clean">
|
||||||
<Message Text="Removing distribution files..." />
|
<Message Text="Removing distribution files..." />
|
||||||
|
|
@ -32,6 +29,7 @@
|
||||||
<Delete Files="..\..\Distribution\LibDeflate.Bindings.dll" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\LibDeflate.Bindings.dll" ContinueOnError="true" />
|
||||||
<Delete Files="..\..\Distribution\libdeflate.dll" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\libdeflate.dll" ContinueOnError="true" />
|
||||||
<Delete Files="..\..\Distribution\libdeflate.dylib" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\libdeflate.dylib" ContinueOnError="true" />
|
||||||
|
<Delete Files="..\..\Distribution\System.IO.Hashing.dll" ContinueOnError="true" />
|
||||||
</Target>
|
</Target>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommunityToolkit.HighPerformance" Version="8.2.2" />
|
<PackageReference Include="CommunityToolkit.HighPerformance" Version="8.2.2" />
|
||||||
|
|
|
||||||
|
|
@ -2,48 +2,46 @@ using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Server.Misc;
|
using Server.Misc;
|
||||||
|
|
||||||
namespace Server.Tests
|
namespace Server.Tests;
|
||||||
|
|
||||||
|
internal class ServerFixture : IDisposable
|
||||||
{
|
{
|
||||||
internal class ServerFixture : IDisposable
|
// Global setup
|
||||||
|
static ServerFixture()
|
||||||
{
|
{
|
||||||
// Global setup
|
Core.ApplicationAssembly = Assembly.GetExecutingAssembly();
|
||||||
static ServerFixture()
|
Core.LoopContext = new EventLoopContext();
|
||||||
{
|
Core.Expansion = Expansion.EJ;
|
||||||
Core.Assembly = Assembly.GetExecutingAssembly();
|
|
||||||
Core.LoopContext = new EventLoopContext();
|
|
||||||
Core.Expansion = Expansion.EJ;
|
|
||||||
|
|
||||||
// Load Configurations
|
// Load Configurations
|
||||||
ServerConfiguration.Load(true);
|
ServerConfiguration.Load(true);
|
||||||
|
|
||||||
// Load UOContent.dll into the type resolver
|
// Load UOContent.dll into the type resolver
|
||||||
ServerConfiguration.AssemblyDirectories.Add(Core.BaseDirectory);
|
ServerConfiguration.AssemblyDirectories.Add(Core.BaseDirectory);
|
||||||
var assembles = new [] { "ModernUO.dll", "UOContent.dll" };
|
AssemblyHandler.LoadAssemblies(["Server.dll", "UOContent.dll"]);
|
||||||
AssemblyHandler.LoadAssemblies(assembles);
|
|
||||||
|
|
||||||
// Load Skills
|
// Load Skills
|
||||||
SkillsInfo.Configure();
|
SkillsInfo.Configure();
|
||||||
|
|
||||||
// Configure / Initialize
|
// Configure / Initialize
|
||||||
TestMapDefinitions.ConfigureTestMapDefinitions();
|
TestMapDefinitions.ConfigureTestMapDefinitions();
|
||||||
|
|
||||||
// Configure the world
|
// Configure the world
|
||||||
World.Configure();
|
World.Configure();
|
||||||
|
|
||||||
Timer.Init(0);
|
Timer.Init(0);
|
||||||
|
|
||||||
// Configure Races
|
// Configure Races
|
||||||
RaceDefinitions.Configure();
|
RaceDefinitions.Configure();
|
||||||
|
|
||||||
// Load the world
|
// Load the world
|
||||||
World.Load();
|
World.Load();
|
||||||
|
|
||||||
World.ExitSerializationThreads();
|
World.ExitSerializationThreads();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Timer.Init(0);
|
Timer.Init(0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,20 @@ using Server.Accounting;
|
||||||
using Server.Accounting.Security;
|
using Server.Accounting.Security;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Server.Tests.Accounting.Security
|
namespace Server.Tests.Accounting.Security;
|
||||||
{
|
|
||||||
public class PasswordProtectionTest
|
|
||||||
{
|
|
||||||
private const string plainPassword = "hello-good-sir";
|
|
||||||
|
|
||||||
[Theory]
|
public class PasswordProtectionTest
|
||||||
[InlineData(typeof(Argon2PasswordProtection), null)]
|
{
|
||||||
[InlineData(typeof(PBKDF2PasswordProtection), null)]
|
private const string plainPassword = "hello-good-sir";
|
||||||
[InlineData(typeof(HashAlgorithmPasswordProtection), "MD5")]
|
|
||||||
[InlineData(typeof(HashAlgorithmPasswordProtection), "SHA1")]
|
[Theory]
|
||||||
[InlineData(typeof(HashAlgorithmPasswordProtection), "SHA2")]
|
[InlineData(typeof(Argon2PasswordProtection), null)]
|
||||||
public void TestValidates(Type protectionType, string algorithmType)
|
[InlineData(typeof(PBKDF2PasswordProtection), null)]
|
||||||
{
|
[InlineData(typeof(HashAlgorithmPasswordProtection), "MD5")]
|
||||||
|
[InlineData(typeof(HashAlgorithmPasswordProtection), "SHA1")]
|
||||||
|
[InlineData(typeof(HashAlgorithmPasswordProtection), "SHA2")]
|
||||||
|
public void TestValidates(Type protectionType, string algorithmType)
|
||||||
|
{
|
||||||
IPasswordProtection passwordProtection;
|
IPasswordProtection passwordProtection;
|
||||||
if (protectionType == typeof(HashAlgorithmPasswordProtection))
|
if (protectionType == typeof(HashAlgorithmPasswordProtection))
|
||||||
{
|
{
|
||||||
|
|
@ -42,14 +42,14 @@ namespace Server.Tests.Accounting.Security
|
||||||
Assert.True(passwordProtection.ValidatePassword(encryptedPassword, plainPassword));
|
Assert.True(passwordProtection.ValidatePassword(encryptedPassword, plainPassword));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(typeof(Argon2PasswordProtection), null)]
|
[InlineData(typeof(Argon2PasswordProtection), null)]
|
||||||
[InlineData(typeof(PBKDF2PasswordProtection), null)]
|
[InlineData(typeof(PBKDF2PasswordProtection), null)]
|
||||||
[InlineData(typeof(HashAlgorithmPasswordProtection), "MD5")]
|
[InlineData(typeof(HashAlgorithmPasswordProtection), "MD5")]
|
||||||
[InlineData(typeof(HashAlgorithmPasswordProtection), "SHA1")]
|
[InlineData(typeof(HashAlgorithmPasswordProtection), "SHA1")]
|
||||||
[InlineData(typeof(HashAlgorithmPasswordProtection), "SHA2")]
|
[InlineData(typeof(HashAlgorithmPasswordProtection), "SHA2")]
|
||||||
public void TestPasswordDoesNotValidate(Type protectionType, string algorithmType)
|
public void TestPasswordDoesNotValidate(Type protectionType, string algorithmType)
|
||||||
{
|
{
|
||||||
IPasswordProtection passwordProtection;
|
IPasswordProtection passwordProtection;
|
||||||
if (protectionType == typeof(HashAlgorithmPasswordProtection))
|
if (protectionType == typeof(HashAlgorithmPasswordProtection))
|
||||||
{
|
{
|
||||||
|
|
@ -74,5 +74,4 @@ namespace Server.Tests.Accounting.Security
|
||||||
|
|
||||||
Assert.False(passwordProtection.ValidatePassword(encryptedPassword, "Not the same password"));
|
Assert.False(passwordProtection.ValidatePassword(encryptedPassword, "Not the same password"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -3,15 +3,15 @@ using Server.Tests;
|
||||||
using Server.Tests.Network;
|
using Server.Tests.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
public class ChatPacketTests
|
||||||
{
|
{
|
||||||
public class ChatPacketTests
|
[Theory]
|
||||||
|
[InlineData(null, 100, "some param", "some other param")]
|
||||||
|
[InlineData("ENU", 200, "a third param", "another param")]
|
||||||
|
public void TestSendChatMessage(string lang, int number, string param1, string param2)
|
||||||
{
|
{
|
||||||
[Theory]
|
|
||||||
[InlineData(null, 100, "some param", "some other param")]
|
|
||||||
[InlineData("ENU", 200, "a third param", "another param")]
|
|
||||||
public void TestSendChatMessage(string lang, int number, string param1, string param2)
|
|
||||||
{
|
|
||||||
var expected = new ChatMessagePacket(lang, number, param1, param2).Compile();
|
var expected = new ChatMessagePacket(lang, number, param1, param2).Compile();
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
|
@ -20,5 +20,4 @@ namespace UOContent.Tests
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Engines.Chat
|
namespace Server.Engines.Chat;
|
||||||
|
|
||||||
|
public sealed class ChatMessagePacket : Packet
|
||||||
{
|
{
|
||||||
public sealed class ChatMessagePacket : Packet
|
public ChatMessagePacket(string lang, int number, string param1, string param2) : base(0xB2)
|
||||||
{
|
{
|
||||||
public ChatMessagePacket(string lang, int number, string param1, string param2) : base(0xB2)
|
|
||||||
{
|
|
||||||
param1 ??= string.Empty;
|
param1 ??= string.Empty;
|
||||||
param2 ??= string.Empty;
|
param2 ??= string.Empty;
|
||||||
|
|
||||||
|
|
@ -25,5 +25,4 @@ namespace Server.Engines.Chat
|
||||||
Stream.WriteBigUniNull(param1);
|
Stream.WriteBigUniNull(param1);
|
||||||
Stream.WriteBigUniNull(param2);
|
Stream.WriteBigUniNull(param2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
namespace Server.Network
|
namespace Server.Network;
|
||||||
|
|
||||||
|
public class DisplayHelpTopic : Packet
|
||||||
{
|
{
|
||||||
public class DisplayHelpTopic : Packet
|
public DisplayHelpTopic(int topicID, bool display) : base(0xBF)
|
||||||
{
|
{
|
||||||
public DisplayHelpTopic(int topicID, bool display) : base(0xBF)
|
|
||||||
{
|
|
||||||
EnsureCapacity(11);
|
EnsureCapacity(11);
|
||||||
|
|
||||||
Stream.Write((short)0x17);
|
Stream.Write((short)0x17);
|
||||||
|
|
@ -11,5 +11,4 @@ namespace Server.Network
|
||||||
Stream.Write(topicID);
|
Stream.Write(topicID);
|
||||||
Stream.Write(display);
|
Stream.Write(display);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -4,15 +4,15 @@ using Server.Tests;
|
||||||
using Server.Tests.Network;
|
using Server.Tests.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
public class TestHelpTopicPacket
|
||||||
{
|
{
|
||||||
public class TestHelpTopicPacket
|
[Theory]
|
||||||
|
[InlineData(HelpTopic.Healing, false)]
|
||||||
|
[InlineData(HelpTopic.EmptyingBowl, true)]
|
||||||
|
public void TestDisplayHelpTopic(int topic, bool display)
|
||||||
{
|
{
|
||||||
[Theory]
|
|
||||||
[InlineData(HelpTopic.Healing, false)]
|
|
||||||
[InlineData(HelpTopic.EmptyingBowl, true)]
|
|
||||||
public void TestDisplayHelpTopic(int topic, bool display)
|
|
||||||
{
|
|
||||||
var expected = new DisplayHelpTopic(topic, display).Compile();
|
var expected = new DisplayHelpTopic(topic, display).Compile();
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
|
@ -21,5 +21,4 @@ namespace UOContent.Tests
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Engines.MLQuests
|
namespace Server.Engines.MLQuests;
|
||||||
|
|
||||||
|
public sealed class RaceChanger : Packet
|
||||||
{
|
{
|
||||||
public sealed class RaceChanger : Packet
|
public RaceChanger(bool female, Race targetRace) : base(0xBF)
|
||||||
{
|
{
|
||||||
public RaceChanger(bool female, Race targetRace) : base(0xBF)
|
|
||||||
{
|
|
||||||
EnsureCapacity(7);
|
EnsureCapacity(7);
|
||||||
|
|
||||||
Stream.Write((short)0x2A);
|
Stream.Write((short)0x2A);
|
||||||
Stream.Write((byte)(female ? 1 : 0));
|
Stream.Write((byte)(female ? 1 : 0));
|
||||||
Stream.Write((byte)(targetRace.RaceID + 1));
|
Stream.Write((byte)(targetRace.RaceID + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class CloseRaceChanger : Packet
|
public sealed class CloseRaceChanger : Packet
|
||||||
|
{
|
||||||
|
public CloseRaceChanger() : base(0xBF)
|
||||||
{
|
{
|
||||||
public CloseRaceChanger() : base(0xBF)
|
|
||||||
{
|
|
||||||
EnsureCapacity(7);
|
EnsureCapacity(7);
|
||||||
|
|
||||||
Stream.Write((short)0x2A);
|
Stream.Write((short)0x2A);
|
||||||
Stream.Write((byte)0);
|
Stream.Write((byte)0);
|
||||||
Stream.Write((byte)0xFF);
|
Stream.Write((byte)0xFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Engines.PartySystem
|
namespace Server.Engines.PartySystem;
|
||||||
|
|
||||||
|
public sealed class PartyEmptyList : Packet
|
||||||
{
|
{
|
||||||
public sealed class PartyEmptyList : Packet
|
public PartyEmptyList(Serial m) : base(0xBF)
|
||||||
{
|
{
|
||||||
public PartyEmptyList(Serial m) : base(0xBF)
|
|
||||||
{
|
|
||||||
EnsureCapacity(7);
|
EnsureCapacity(7);
|
||||||
|
|
||||||
Stream.Write((short)0x0006);
|
Stream.Write((short)0x0006);
|
||||||
|
|
@ -13,12 +13,12 @@ namespace Server.Engines.PartySystem
|
||||||
Stream.Write((byte)0);
|
Stream.Write((byte)0);
|
||||||
Stream.Write(m);
|
Stream.Write(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class PartyMemberList : Packet
|
public sealed class PartyMemberList : Packet
|
||||||
|
{
|
||||||
|
public PartyMemberList(Party p) : base(0xBF)
|
||||||
{
|
{
|
||||||
public PartyMemberList(Party p) : base(0xBF)
|
|
||||||
{
|
|
||||||
EnsureCapacity(7 + p.Count * 4);
|
EnsureCapacity(7 + p.Count * 4);
|
||||||
|
|
||||||
Stream.Write((short)0x0006);
|
Stream.Write((short)0x0006);
|
||||||
|
|
@ -30,12 +30,12 @@ namespace Server.Engines.PartySystem
|
||||||
Stream.Write(p[i].Mobile.Serial);
|
Stream.Write(p[i].Mobile.Serial);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class PartyRemoveMember : Packet
|
public sealed class PartyRemoveMember : Packet
|
||||||
|
{
|
||||||
|
public PartyRemoveMember(Serial removed, Party p) : base(0xBF)
|
||||||
{
|
{
|
||||||
public PartyRemoveMember(Serial removed, Party p) : base(0xBF)
|
|
||||||
{
|
|
||||||
EnsureCapacity(11 + p.Count * 4);
|
EnsureCapacity(11 + p.Count * 4);
|
||||||
|
|
||||||
Stream.Write((short)0x0006);
|
Stream.Write((short)0x0006);
|
||||||
|
|
@ -49,12 +49,12 @@ namespace Server.Engines.PartySystem
|
||||||
Stream.Write(p[i].Mobile.Serial);
|
Stream.Write(p[i].Mobile.Serial);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class PartyTextMessage : Packet
|
public sealed class PartyTextMessage : Packet
|
||||||
|
{
|
||||||
|
public PartyTextMessage(bool toAll, Serial from, string text) : base(0xBF)
|
||||||
{
|
{
|
||||||
public PartyTextMessage(bool toAll, Serial from, string text) : base(0xBF)
|
|
||||||
{
|
|
||||||
text ??= "";
|
text ??= "";
|
||||||
|
|
||||||
EnsureCapacity(12 + text.Length * 2);
|
EnsureCapacity(12 + text.Length * 2);
|
||||||
|
|
@ -64,17 +64,16 @@ namespace Server.Engines.PartySystem
|
||||||
Stream.Write(from);
|
Stream.Write(from);
|
||||||
Stream.WriteBigUniNull(text);
|
Stream.WriteBigUniNull(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class PartyInvitation : Packet
|
public sealed class PartyInvitation : Packet
|
||||||
|
{
|
||||||
|
public PartyInvitation(Serial leader) : base(0xBF)
|
||||||
{
|
{
|
||||||
public PartyInvitation(Serial leader) : base(0xBF)
|
|
||||||
{
|
|
||||||
EnsureCapacity(10);
|
EnsureCapacity(10);
|
||||||
|
|
||||||
Stream.Write((short)0x0006);
|
Stream.Write((short)0x0006);
|
||||||
Stream.Write((byte)0x07);
|
Stream.Write((byte)0x07);
|
||||||
Stream.Write(leader);
|
Stream.Write(leader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -4,13 +4,13 @@ using Server.Tests;
|
||||||
using Server.Tests.Network;
|
using Server.Tests.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
public class PartyPacketTests : IClassFixture<ServerFixture>
|
||||||
{
|
{
|
||||||
public class PartyPacketTests : IClassFixture<ServerFixture>
|
[Fact]
|
||||||
|
public void TestPartyEmptyList()
|
||||||
{
|
{
|
||||||
[Fact]
|
|
||||||
public void TestPartyEmptyList()
|
|
||||||
{
|
|
||||||
Serial m = (Serial)0x1024u;
|
Serial m = (Serial)0x1024u;
|
||||||
|
|
||||||
var expected = new PartyEmptyList(m).Compile();
|
var expected = new PartyEmptyList(m).Compile();
|
||||||
|
|
@ -22,9 +22,9 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestPartyRemoveMember()
|
public void TestPartyRemoveMember()
|
||||||
{
|
{
|
||||||
var leader = new Mobile((Serial)0x1024u);
|
var leader = new Mobile((Serial)0x1024u);
|
||||||
leader.DefaultMobileInit();
|
leader.DefaultMobileInit();
|
||||||
|
|
||||||
|
|
@ -43,9 +43,9 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestPartyMemberList()
|
public void TestPartyMemberList()
|
||||||
{
|
{
|
||||||
var leader = new Mobile((Serial)0x1024u);
|
var leader = new Mobile((Serial)0x1024u);
|
||||||
leader.DefaultMobileInit();
|
leader.DefaultMobileInit();
|
||||||
|
|
||||||
|
|
@ -64,11 +64,11 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(true)]
|
[InlineData(true)]
|
||||||
[InlineData(false)]
|
[InlineData(false)]
|
||||||
public void TestPartyTextMessage(bool toAll)
|
public void TestPartyTextMessage(bool toAll)
|
||||||
{
|
{
|
||||||
Serial serial = (Serial)0x1024u;
|
Serial serial = (Serial)0x1024u;
|
||||||
var text = "[Party] Stuff Happens";
|
var text = "[Party] Stuff Happens";
|
||||||
|
|
||||||
|
|
@ -81,9 +81,9 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestPartyInvitation()
|
public void TestPartyInvitation()
|
||||||
{
|
{
|
||||||
Serial m = (Serial)0x1024u;
|
Serial m = (Serial)0x1024u;
|
||||||
|
|
||||||
var expected = new PartyInvitation(m).Compile();
|
var expected = new PartyInvitation(m).Compile();
|
||||||
|
|
@ -94,5 +94,4 @@ namespace UOContent.Tests
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -5,14 +5,14 @@ using Server.Tests;
|
||||||
using Server.Tests.Network;
|
using Server.Tests.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
public class CharacterStatuePacketTests
|
||||||
{
|
{
|
||||||
public class CharacterStatuePacketTests
|
[Theory]
|
||||||
|
[InlineData(0x1024u, 1, 100, 200)]
|
||||||
|
public void TestSendStatueAnimation(uint s, int status, int anim, int frame)
|
||||||
{
|
{
|
||||||
[Theory]
|
|
||||||
[InlineData(0x1024u, 1, 100, 200)]
|
|
||||||
public void TestSendStatueAnimation(uint s, int status, int anim, int frame)
|
|
||||||
{
|
|
||||||
var expected = new UpdateStatueAnimation((Serial)s, status, anim, frame).Compile();
|
var expected = new UpdateStatueAnimation((Serial)s, status, anim, frame).Compile();
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
|
@ -21,5 +21,4 @@ namespace UOContent.Tests
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
namespace Server.Network
|
namespace Server.Network;
|
||||||
|
|
||||||
|
public class UpdateStatueAnimation : Packet
|
||||||
{
|
{
|
||||||
public class UpdateStatueAnimation : Packet
|
public UpdateStatueAnimation(Serial serial, int status, int animation, int frame) : base(0xBF, 17)
|
||||||
{
|
{
|
||||||
public UpdateStatueAnimation(Serial serial, int status, int animation, int frame) : base(0xBF, 17)
|
|
||||||
{
|
|
||||||
Stream.Write((short)0x11);
|
Stream.Write((short)0x11);
|
||||||
Stream.Write((short)0x19);
|
Stream.Write((short)0x19);
|
||||||
Stream.Write((byte)0x5);
|
Stream.Write((byte)0x5);
|
||||||
|
|
@ -16,5 +16,4 @@ namespace Server.Network
|
||||||
Stream.Write((byte)0);
|
Stream.Write((byte)0);
|
||||||
Stream.Write((byte)frame);
|
Stream.Write((byte)frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -5,24 +5,24 @@ using Server.Tests;
|
||||||
using Server.Tests.Network;
|
using Server.Tests.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
public class TestBook : BaseBook
|
||||||
{
|
{
|
||||||
public class TestBook : BaseBook
|
public TestBook(int itemID, int pageCount = 20, bool writable = true) : base(itemID, pageCount, writable)
|
||||||
{
|
{
|
||||||
public TestBook(int itemID, int pageCount = 20, bool writable = true) : base(itemID, pageCount, writable)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestBook(int itemID, string title, string author, int pageCount, bool writable) : base(itemID, title, author, pageCount, writable)
|
public TestBook(int itemID, string title, string author, int pageCount, bool writable) : base(itemID, title, author, pageCount, writable)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestBook(int itemID, bool writable) : base(itemID, writable)
|
public TestBook(int itemID, bool writable) : base(itemID, writable)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestBook(Serial serial) : base(serial)
|
public TestBook(Serial serial) : base(serial)
|
||||||
{
|
{
|
||||||
Pages = new BookPageInfo[20];
|
Pages = new BookPageInfo[20];
|
||||||
|
|
||||||
for (var i = 0; i < Pages.Length; ++i)
|
for (var i = 0; i < Pages.Length; ++i)
|
||||||
|
|
@ -30,14 +30,14 @@ namespace UOContent.Tests
|
||||||
Pages[i] = new BookPageInfo();
|
Pages[i] = new BookPageInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BookPacketTests : IClassFixture<ServerFixture>
|
public class BookPacketTests : IClassFixture<ServerFixture>
|
||||||
|
{
|
||||||
|
[Theory]
|
||||||
|
[InlineData("🅵🅰🅽🅲🆈 🆃🅴🆇🆃 Author", "🅵🅰🅽🅲🆈 🆃🅴🆇🆃 Title")]
|
||||||
|
public void TestBookCover(string author, string title)
|
||||||
{
|
{
|
||||||
[Theory]
|
|
||||||
[InlineData("🅵🅰🅽🅲🆈 🆃🅴🆇🆃 Author", "🅵🅰🅽🅲🆈 🆃🅴🆇🆃 Title")]
|
|
||||||
public void TestBookCover(string author, string title)
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1);
|
var m = new Mobile((Serial)0x1);
|
||||||
m.DefaultMobileInit();
|
m.DefaultMobileInit();
|
||||||
|
|
||||||
|
|
@ -53,9 +53,9 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestBookContent()
|
public void TestBookContent()
|
||||||
{
|
{
|
||||||
var m = new Mobile((Serial)0x1);
|
var m = new Mobile((Serial)0x1);
|
||||||
m.DefaultMobileInit();
|
m.DefaultMobileInit();
|
||||||
|
|
||||||
|
|
@ -89,5 +89,4 @@ namespace UOContent.Tests
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
using Server.Items;
|
using Server.Items;
|
||||||
using Server.Text;
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server.Network
|
namespace Server.Network;
|
||||||
|
|
||||||
|
public sealed class BookPageDetails : Packet
|
||||||
{
|
{
|
||||||
public sealed class BookPageDetails : Packet
|
public BookPageDetails(BaseBook book) : base(0x66)
|
||||||
{
|
{
|
||||||
public BookPageDetails(BaseBook book) : base(0x66)
|
|
||||||
{
|
|
||||||
EnsureCapacity(256);
|
EnsureCapacity(256);
|
||||||
|
|
||||||
Stream.Write(book.Serial);
|
Stream.Write(book.Serial);
|
||||||
|
|
@ -28,12 +28,12 @@ namespace Server.Network
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class BookHeader : Packet
|
public sealed class BookHeader : Packet
|
||||||
|
{
|
||||||
|
public BookHeader(Mobile from, BaseBook book) : base(0xD4)
|
||||||
{
|
{
|
||||||
public BookHeader(Mobile from, BaseBook book) : base(0xD4)
|
|
||||||
{
|
|
||||||
var title = book.Title ?? "";
|
var title = book.Title ?? "";
|
||||||
var author = book.Author ?? "";
|
var author = book.Author ?? "";
|
||||||
|
|
||||||
|
|
@ -55,5 +55,4 @@ namespace Server.Network
|
||||||
Stream.Write(authorBuffer, 0, authorBuffer.Length);
|
Stream.Write(authorBuffer, 0, authorBuffer.Length);
|
||||||
Stream.Write((byte)0); // terminate
|
Stream.Write((byte)0); // terminate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -5,17 +5,17 @@ using Server.Tests;
|
||||||
using Server.Tests.Network;
|
using Server.Tests.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
[Collection("Sequential Tests")]
|
||||||
|
public class BulletinBoardPacketTests : IClassFixture<ServerFixture>
|
||||||
{
|
{
|
||||||
[Collection("Sequential Tests")]
|
[Theory]
|
||||||
public class BulletinBoardPacketTests : IClassFixture<ServerFixture>
|
[InlineData("Test Name")]
|
||||||
|
[InlineData(null)]
|
||||||
|
[InlineData("🅵🅰🅽🅲🆈 🆃🅴🆇🆃")]
|
||||||
|
public void TestSendBBDisplayBoard(string boardName)
|
||||||
{
|
{
|
||||||
[Theory]
|
|
||||||
[InlineData("Test Name")]
|
|
||||||
[InlineData(null)]
|
|
||||||
[InlineData("🅵🅰🅽🅲🆈 🆃🅴🆇🆃")]
|
|
||||||
public void TestSendBBDisplayBoard(string boardName)
|
|
||||||
{
|
|
||||||
var bb = new TestBulletinBoard(0x234) { BoardName = boardName };
|
var bb = new TestBulletinBoard(0x234) { BoardName = boardName };
|
||||||
|
|
||||||
var expected = new BBDisplayBoard(bb).Compile();
|
var expected = new BBDisplayBoard(bb).Compile();
|
||||||
|
|
@ -27,15 +27,15 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("The Subject", false, "First Line", "Second Line", "Third Line")]
|
[InlineData("The Subject", false, "First Line", "Second Line", "Third Line")]
|
||||||
[InlineData("", false, "")]
|
[InlineData("", false, "")]
|
||||||
[InlineData("🅵🅰🅽🅲🆈 🆃🅴🆇🆃", false, "First Line", "Second Line")]
|
[InlineData("🅵🅰🅽🅲🆈 🆃🅴🆇🆃", false, "First Line", "Second Line")]
|
||||||
[InlineData("The Subject", true, "First Line", "Second Line", "Third Line")]
|
[InlineData("The Subject", true, "First Line", "Second Line", "Third Line")]
|
||||||
[InlineData("", true, "")]
|
[InlineData("", true, "")]
|
||||||
[InlineData("🅵🅰🅽🅲🆈 🆃🅴🆇🆃", true, "First Line", "Second Line")]
|
[InlineData("🅵🅰🅽🅲🆈 🆃🅴🆇🆃", true, "First Line", "Second Line")]
|
||||||
public void TestSendBBHeaderMessage(string subject, bool content, params string[] lines)
|
public void TestSendBBHeaderMessage(string subject, bool content, params string[] lines)
|
||||||
{
|
{
|
||||||
var poster = new Mobile((Serial)0x1024u) { Name = "Kamron" };
|
var poster = new Mobile((Serial)0x1024u) { Name = "Kamron" };
|
||||||
poster.DefaultMobileInit();
|
poster.DefaultMobileInit();
|
||||||
|
|
||||||
|
|
@ -53,16 +53,15 @@ namespace UOContent.Tests
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
internal class TestBulletinBoard : BaseBulletinBoard
|
|
||||||
{
|
|
||||||
public TestBulletinBoard(int itemID) : base(itemID)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public TestBulletinBoard(Serial serial) : base(serial)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class TestBulletinBoard : BaseBulletinBoard
|
||||||
|
{
|
||||||
|
public TestBulletinBoard(int itemID) : base(itemID)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public TestBulletinBoard(Serial serial) : base(serial)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,14 +4,14 @@ using Server.Tests;
|
||||||
using Server.Tests.Network;
|
using Server.Tests.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
[Collection("Sequential Tests")]
|
||||||
|
public class MahjongPacketTests : IClassFixture<ServerFixture>
|
||||||
{
|
{
|
||||||
[Collection("Sequential Tests")]
|
[Fact]
|
||||||
public class MahjongPacketTests : IClassFixture<ServerFixture>
|
public void TestMahjongJoinGame()
|
||||||
{
|
{
|
||||||
[Fact]
|
|
||||||
public void TestMahjongJoinGame()
|
|
||||||
{
|
|
||||||
Serial game = (Serial)0x1024u;
|
Serial game = (Serial)0x1024u;
|
||||||
|
|
||||||
var expected = new MahjongJoinGame(game).Compile();
|
var expected = new MahjongJoinGame(game).Compile();
|
||||||
|
|
@ -23,11 +23,11 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(true)]
|
[InlineData(true)]
|
||||||
[InlineData(false)]
|
[InlineData(false)]
|
||||||
public void TestMahjongPlayersInfo(bool showScores)
|
public void TestMahjongPlayersInfo(bool showScores)
|
||||||
{
|
{
|
||||||
var m = new Mobile((Serial)0x1);
|
var m = new Mobile((Serial)0x1);
|
||||||
m.DefaultMobileInit();
|
m.DefaultMobileInit();
|
||||||
|
|
||||||
|
|
@ -43,13 +43,13 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(true, true)]
|
[InlineData(true, true)]
|
||||||
[InlineData(true, false)]
|
[InlineData(true, false)]
|
||||||
[InlineData(false, true)]
|
[InlineData(false, true)]
|
||||||
[InlineData(false, false)]
|
[InlineData(false, false)]
|
||||||
public void TestMahjongGeneralInfo(bool showScores, bool spectatorVision)
|
public void TestMahjongGeneralInfo(bool showScores, bool spectatorVision)
|
||||||
{
|
{
|
||||||
var game = new MahjongGame { ShowScores = showScores, SpectatorVision = spectatorVision};
|
var game = new MahjongGame { ShowScores = showScores, SpectatorVision = spectatorVision};
|
||||||
|
|
||||||
var expected = new MahjongGeneralInfo(game).Compile();
|
var expected = new MahjongGeneralInfo(game).Compile();
|
||||||
|
|
@ -61,11 +61,11 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(true)]
|
[InlineData(true)]
|
||||||
[InlineData(false)]
|
[InlineData(false)]
|
||||||
public void TestMahjongTilesInfo(bool spectatorVision)
|
public void TestMahjongTilesInfo(bool spectatorVision)
|
||||||
{
|
{
|
||||||
var m = new Mobile((Serial)0x1);
|
var m = new Mobile((Serial)0x1);
|
||||||
m.DefaultMobileInit();
|
m.DefaultMobileInit();
|
||||||
|
|
||||||
|
|
@ -81,11 +81,11 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(true)]
|
[InlineData(true)]
|
||||||
[InlineData(false)]
|
[InlineData(false)]
|
||||||
public void TestMahjongTileInfo(bool spectatorVision)
|
public void TestMahjongTileInfo(bool spectatorVision)
|
||||||
{
|
{
|
||||||
var m = new Mobile((Serial)0x1);
|
var m = new Mobile((Serial)0x1);
|
||||||
m.DefaultMobileInit();
|
m.DefaultMobileInit();
|
||||||
|
|
||||||
|
|
@ -101,9 +101,9 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestMahjongRelieve()
|
public void TestMahjongRelieve()
|
||||||
{
|
{
|
||||||
Serial game = (Serial)0x1024u;
|
Serial game = (Serial)0x1024u;
|
||||||
|
|
||||||
var expected = new MahjongRelieve(game).Compile();
|
var expected = new MahjongRelieve(game).Compile();
|
||||||
|
|
@ -114,5 +114,4 @@ namespace UOContent.Tests
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -1,24 +1,24 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Engines.Mahjong
|
namespace Server.Engines.Mahjong;
|
||||||
|
|
||||||
|
public sealed class MahjongJoinGame : Packet
|
||||||
{
|
{
|
||||||
public sealed class MahjongJoinGame : Packet
|
public MahjongJoinGame(Serial game) : base(0xDA)
|
||||||
{
|
{
|
||||||
public MahjongJoinGame(Serial game) : base(0xDA)
|
|
||||||
{
|
|
||||||
EnsureCapacity(9);
|
EnsureCapacity(9);
|
||||||
|
|
||||||
Stream.Write(game);
|
Stream.Write(game);
|
||||||
Stream.Write((byte)0);
|
Stream.Write((byte)0);
|
||||||
Stream.Write((byte)0x19);
|
Stream.Write((byte)0x19);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class MahjongPlayersInfo : Packet
|
public sealed class MahjongPlayersInfo : Packet
|
||||||
|
{
|
||||||
|
public MahjongPlayersInfo(MahjongGame game, Mobile to) : base(0xDA)
|
||||||
{
|
{
|
||||||
public MahjongPlayersInfo(MahjongGame game, Mobile to) : base(0xDA)
|
|
||||||
{
|
|
||||||
var players = game.Players;
|
var players = game.Players;
|
||||||
|
|
||||||
EnsureCapacity(11 + 45 * players.Seats);
|
EnsureCapacity(11 + 45 * players.Seats);
|
||||||
|
|
@ -86,12 +86,12 @@ namespace Server.Engines.Mahjong
|
||||||
Stream.Write((byte)n);
|
Stream.Write((byte)n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class MahjongGeneralInfo : Packet
|
public sealed class MahjongGeneralInfo : Packet
|
||||||
|
{
|
||||||
|
public MahjongGeneralInfo(MahjongGame game) : base(0xDA)
|
||||||
{
|
{
|
||||||
public MahjongGeneralInfo(MahjongGame game) : base(0xDA)
|
|
||||||
{
|
|
||||||
EnsureCapacity(13);
|
EnsureCapacity(13);
|
||||||
|
|
||||||
Stream.Write(game.Serial);
|
Stream.Write(game.Serial);
|
||||||
|
|
@ -114,12 +114,12 @@ namespace Server.Engines.Mahjong
|
||||||
Stream.Write((short)game.WallBreakIndicator.Position.Y);
|
Stream.Write((short)game.WallBreakIndicator.Position.Y);
|
||||||
Stream.Write((short)game.WallBreakIndicator.Position.X);
|
Stream.Write((short)game.WallBreakIndicator.Position.X);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class MahjongTilesInfo : Packet
|
public sealed class MahjongTilesInfo : Packet
|
||||||
|
{
|
||||||
|
public MahjongTilesInfo(MahjongGame game, Mobile to) : base(0xDA)
|
||||||
{
|
{
|
||||||
public MahjongTilesInfo(MahjongGame game, Mobile to) : base(0xDA)
|
|
||||||
{
|
|
||||||
var tiles = game.Tiles;
|
var tiles = game.Tiles;
|
||||||
var players = game.Players;
|
var players = game.Players;
|
||||||
|
|
||||||
|
|
@ -162,12 +162,12 @@ namespace Server.Engines.Mahjong
|
||||||
Stream.Write(tile.Flipped ? (byte)0x10 : (byte)0x0);
|
Stream.Write(tile.Flipped ? (byte)0x10 : (byte)0x0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class MahjongTileInfo : Packet
|
public sealed class MahjongTileInfo : Packet
|
||||||
|
{
|
||||||
|
public MahjongTileInfo(MahjongTile tile, Mobile to) : base(0xDA)
|
||||||
{
|
{
|
||||||
public MahjongTileInfo(MahjongTile tile, Mobile to) : base(0xDA)
|
|
||||||
{
|
|
||||||
var game = tile.Game;
|
var game = tile.Game;
|
||||||
var players = game.Players;
|
var players = game.Players;
|
||||||
|
|
||||||
|
|
@ -205,17 +205,16 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
Stream.Write(tile.Flipped ? (byte)0x10 : (byte)0x0);
|
Stream.Write(tile.Flipped ? (byte)0x10 : (byte)0x0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class MahjongRelieve : Packet
|
public sealed class MahjongRelieve : Packet
|
||||||
|
{
|
||||||
|
public MahjongRelieve(Serial game) : base(0xDA)
|
||||||
{
|
{
|
||||||
public MahjongRelieve(Serial game) : base(0xDA)
|
|
||||||
{
|
|
||||||
EnsureCapacity(9);
|
EnsureCapacity(9);
|
||||||
|
|
||||||
Stream.Write(game);
|
Stream.Write(game);
|
||||||
Stream.Write((byte)0);
|
Stream.Write((byte)0);
|
||||||
Stream.Write((byte)0x1A);
|
Stream.Write((byte)0x1A);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Items
|
namespace Server.Items;
|
||||||
|
|
||||||
|
public sealed class MapDetails : Packet
|
||||||
{
|
{
|
||||||
public sealed class MapDetails : Packet
|
public MapDetails(MapItem map) : base(0x90, 19)
|
||||||
{
|
{
|
||||||
public MapDetails(MapItem map) : base(0x90, 19)
|
|
||||||
{
|
|
||||||
Stream.Write(map.Serial);
|
Stream.Write(map.Serial);
|
||||||
Stream.Write((short)0x139D);
|
Stream.Write((short)0x139D);
|
||||||
Stream.Write((short)map.Bounds.Start.X);
|
Stream.Write((short)map.Bounds.Start.X);
|
||||||
|
|
@ -15,12 +15,12 @@ namespace Server.Items
|
||||||
Stream.Write((short)map.Width);
|
Stream.Write((short)map.Width);
|
||||||
Stream.Write((short)map.Height);
|
Stream.Write((short)map.Height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class MapDetailsNew : Packet
|
public sealed class MapDetailsNew : Packet
|
||||||
|
{
|
||||||
|
public MapDetailsNew(MapItem map) : base(0xF5, 21)
|
||||||
{
|
{
|
||||||
public MapDetailsNew(MapItem map) : base(0xF5, 21)
|
|
||||||
{
|
|
||||||
Stream.Write(map.Serial);
|
Stream.Write(map.Serial);
|
||||||
Stream.Write((short)0x139D);
|
Stream.Write((short)0x139D);
|
||||||
Stream.Write((short)map.Bounds.Start.X);
|
Stream.Write((short)map.Bounds.Start.X);
|
||||||
|
|
@ -31,38 +31,37 @@ namespace Server.Items
|
||||||
Stream.Write((short)map.Height);
|
Stream.Write((short)map.Height);
|
||||||
Stream.Write((short)(map.Facet?.MapID ?? 0));
|
Stream.Write((short)(map.Facet?.MapID ?? 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MapCommand : Packet
|
public class MapCommand : Packet
|
||||||
|
{
|
||||||
|
public MapCommand(MapItem map, int command, int number, int x, int y) : base(0x56, 11)
|
||||||
{
|
{
|
||||||
public MapCommand(MapItem map, int command, int number, int x, int y) : base(0x56, 11)
|
|
||||||
{
|
|
||||||
Stream.Write(map.Serial);
|
Stream.Write(map.Serial);
|
||||||
Stream.Write((byte)command);
|
Stream.Write((byte)command);
|
||||||
Stream.Write((byte)number);
|
Stream.Write((byte)number);
|
||||||
Stream.Write((short)x);
|
Stream.Write((short)x);
|
||||||
Stream.Write((short)y);
|
Stream.Write((short)y);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class MapDisplay : MapCommand
|
|
||||||
{
|
|
||||||
public MapDisplay(MapItem map) : base(map, 5, 0, 0, 0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class MapAddPin : MapCommand
|
|
||||||
{
|
|
||||||
public MapAddPin(MapItem map, Point2D point) : base(map, 1, 0, point.X, point.Y)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class MapSetEditable : MapCommand
|
|
||||||
{
|
|
||||||
public MapSetEditable(MapItem map, bool editable) : base(map, 7, editable ? 1 : 0, 0, 0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sealed class MapDisplay : MapCommand
|
||||||
|
{
|
||||||
|
public MapDisplay(MapItem map) : base(map, 5, 0, 0, 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class MapAddPin : MapCommand
|
||||||
|
{
|
||||||
|
public MapAddPin(MapItem map, Point2D point) : base(map, 1, 0, point.X, point.Y)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class MapSetEditable : MapCommand
|
||||||
|
{
|
||||||
|
public MapSetEditable(MapItem map, bool editable) : base(map, 7, editable ? 1 : 0, 0, 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,16 +5,16 @@ using Server.Tests;
|
||||||
using Server.Tests.Network;
|
using Server.Tests.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
[Collection("Sequential Tests")]
|
||||||
|
public class TestMapItemPackets : IClassFixture<ServerFixture>
|
||||||
{
|
{
|
||||||
[Collection("Sequential Tests")]
|
[Theory]
|
||||||
public class TestMapItemPackets : IClassFixture<ServerFixture>
|
[InlineData(ProtocolChanges.NewCharacterList)]
|
||||||
|
[InlineData(ProtocolChanges.None)]
|
||||||
|
public void TestSendMapDetails(ProtocolChanges changes)
|
||||||
{
|
{
|
||||||
[Theory]
|
|
||||||
[InlineData(ProtocolChanges.NewCharacterList)]
|
|
||||||
[InlineData(ProtocolChanges.None)]
|
|
||||||
public void TestSendMapDetails(ProtocolChanges changes)
|
|
||||||
{
|
|
||||||
var mapItem = new MapItem(Map.Trammel);
|
var mapItem = new MapItem(Map.Trammel);
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
|
@ -28,13 +28,13 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(5, 0, 0, 0)]
|
[InlineData(5, 0, 0, 0)]
|
||||||
[InlineData(1, 0, 100, 200)]
|
[InlineData(1, 0, 100, 200)]
|
||||||
[InlineData(7, 1, 0, 0)]
|
[InlineData(7, 1, 0, 0)]
|
||||||
[InlineData(7, 0, 0, 0)]
|
[InlineData(7, 0, 0, 0)]
|
||||||
public void TestSendMapCommand(int command, int number, int x, int y)
|
public void TestSendMapCommand(int command, int number, int x, int y)
|
||||||
{
|
{
|
||||||
var mapItem = new MapItem(Map.Trammel);
|
var mapItem = new MapItem(Map.Trammel);
|
||||||
|
|
||||||
var expected = new MapCommand(mapItem, command, number, x, y).Compile();
|
var expected = new MapCommand(mapItem, command, number, x, y).Compile();
|
||||||
|
|
@ -45,5 +45,4 @@ namespace UOContent.Tests
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -5,14 +5,14 @@ using Server.Tests;
|
||||||
using Server.Tests.Network;
|
using Server.Tests.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
[Collection("Sequential Tests")]
|
||||||
|
public class CorpsePacketTests : IClassFixture<ServerFixture>
|
||||||
{
|
{
|
||||||
[Collection("Sequential Tests")]
|
[Fact]
|
||||||
public class CorpsePacketTests : IClassFixture<ServerFixture>
|
public void TestCorpseEquipPacket()
|
||||||
{
|
{
|
||||||
[Fact]
|
|
||||||
public void TestCorpseEquipPacket()
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1);
|
var m = new Mobile((Serial)0x1);
|
||||||
m.DefaultMobileInit();
|
m.DefaultMobileInit();
|
||||||
|
|
||||||
|
|
@ -30,11 +30,11 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(ProtocolChanges.None)]
|
[InlineData(ProtocolChanges.None)]
|
||||||
[InlineData(ProtocolChanges.ContainerGridLines)]
|
[InlineData(ProtocolChanges.ContainerGridLines)]
|
||||||
public void TestCorpseContainerPacket(ProtocolChanges changes)
|
public void TestCorpseContainerPacket(ProtocolChanges changes)
|
||||||
{
|
{
|
||||||
var m = new Mobile((Serial)0x1);
|
var m = new Mobile((Serial)0x1);
|
||||||
m.DefaultMobileInit();
|
m.DefaultMobileInit();
|
||||||
|
|
||||||
|
|
@ -53,5 +53,4 @@ namespace UOContent.Tests
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Server.Items;
|
using Server.Items;
|
||||||
|
|
||||||
namespace Server.Network
|
namespace Server.Network;
|
||||||
|
|
||||||
|
public sealed class CorpseEquip : Packet
|
||||||
{
|
{
|
||||||
public sealed class CorpseEquip : Packet
|
public CorpseEquip(Mobile beholder, Corpse beheld) : base(0x89)
|
||||||
{
|
{
|
||||||
public CorpseEquip(Mobile beholder, Corpse beheld) : base(0x89)
|
|
||||||
{
|
|
||||||
var list = beheld.EquipItems;
|
var list = beheld.EquipItems;
|
||||||
|
|
||||||
var count = list.Count;
|
var count = list.Count;
|
||||||
|
|
@ -49,13 +49,13 @@ namespace Server.Network
|
||||||
|
|
||||||
Stream.Write((byte)Layer.Invalid);
|
Stream.Write((byte)Layer.Invalid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class CorpseContent : Packet
|
public sealed class CorpseContent : Packet
|
||||||
|
{
|
||||||
|
public CorpseContent(Mobile beholder, Corpse beheld)
|
||||||
|
: base(0x3C)
|
||||||
{
|
{
|
||||||
public CorpseContent(Mobile beholder, Corpse beheld)
|
|
||||||
: base(0x3C)
|
|
||||||
{
|
|
||||||
var items = beheld.EquipItems;
|
var items = beheld.EquipItems;
|
||||||
var count = items.Count;
|
var count = items.Count;
|
||||||
|
|
||||||
|
|
@ -127,13 +127,13 @@ namespace Server.Network
|
||||||
Stream.Seek(pos, SeekOrigin.Begin);
|
Stream.Seek(pos, SeekOrigin.Begin);
|
||||||
Stream.Write((ushort)written);
|
Stream.Write((ushort)written);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class CorpseContent6017 : Packet
|
public sealed class CorpseContent6017 : Packet
|
||||||
|
{
|
||||||
|
public CorpseContent6017(Mobile beholder, Corpse beheld)
|
||||||
|
: base(0x3C)
|
||||||
{
|
{
|
||||||
public CorpseContent6017(Mobile beholder, Corpse beheld)
|
|
||||||
: base(0x3C)
|
|
||||||
{
|
|
||||||
var items = beheld.EquipItems;
|
var items = beheld.EquipItems;
|
||||||
var count = items.Count;
|
var count = items.Count;
|
||||||
|
|
||||||
|
|
@ -208,5 +208,4 @@ namespace Server.Network
|
||||||
Stream.Seek(pos, SeekOrigin.Begin);
|
Stream.Seek(pos, SeekOrigin.Begin);
|
||||||
Stream.Write((ushort)written);
|
Stream.Write((ushort)written);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -3,17 +3,17 @@ using Server.Tests;
|
||||||
using Server.Tests.Network;
|
using Server.Tests.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
public class WeaponAbilityPacketTests
|
||||||
{
|
{
|
||||||
public class WeaponAbilityPacketTests
|
[Theory]
|
||||||
|
[InlineData(0, true)]
|
||||||
|
[InlineData(0, false)]
|
||||||
|
[InlineData(100, true)]
|
||||||
|
[InlineData(1000, false)]
|
||||||
|
public void TestSpecialAbility(int abilityId, bool active)
|
||||||
{
|
{
|
||||||
[Theory]
|
|
||||||
[InlineData(0, true)]
|
|
||||||
[InlineData(0, false)]
|
|
||||||
[InlineData(100, true)]
|
|
||||||
[InlineData(1000, false)]
|
|
||||||
public void TestSpecialAbility(int abilityId, bool active)
|
|
||||||
{
|
|
||||||
var expected = new ToggleSpecialAbility(abilityId, active).Compile();
|
var expected = new ToggleSpecialAbility(abilityId, active).Compile();
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
|
@ -23,9 +23,9 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestClearAbility()
|
public void TestClearAbility()
|
||||||
{
|
{
|
||||||
var expected = new ClearWeaponAbility().Compile();
|
var expected = new ClearWeaponAbility().Compile();
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
|
@ -34,5 +34,4 @@ namespace UOContent.Tests
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
public sealed class ToggleSpecialAbility : Packet
|
||||||
{
|
{
|
||||||
public sealed class ToggleSpecialAbility : Packet
|
public ToggleSpecialAbility(int abilityID, bool active) : base(0xBF)
|
||||||
{
|
{
|
||||||
public ToggleSpecialAbility(int abilityID, bool active) : base(0xBF)
|
|
||||||
{
|
|
||||||
EnsureCapacity(7);
|
EnsureCapacity(7);
|
||||||
|
|
||||||
Stream.Write((short)0x25);
|
Stream.Write((short)0x25);
|
||||||
|
|
@ -13,17 +13,16 @@ namespace UOContent.Tests
|
||||||
Stream.Write((short)abilityID);
|
Stream.Write((short)abilityID);
|
||||||
Stream.Write(active);
|
Stream.Write(active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class ClearWeaponAbility : Packet
|
public sealed class ClearWeaponAbility : Packet
|
||||||
|
{
|
||||||
|
public static readonly Packet Instance = SetStatic(new ClearWeaponAbility());
|
||||||
|
|
||||||
|
public ClearWeaponAbility() : base(0xBF)
|
||||||
{
|
{
|
||||||
public static readonly Packet Instance = SetStatic(new ClearWeaponAbility());
|
|
||||||
|
|
||||||
public ClearWeaponAbility() : base(0xBF)
|
|
||||||
{
|
|
||||||
EnsureCapacity(5);
|
EnsureCapacity(5);
|
||||||
|
|
||||||
Stream.Write((short)0x21);
|
Stream.Write((short)0x21);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -5,16 +5,16 @@ using Server.Items;
|
||||||
using Server.Multis;
|
using Server.Multis;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
public sealed class MoveBoatHS : Packet
|
||||||
{
|
{
|
||||||
public sealed class MoveBoatHS : Packet
|
public MoveBoatHS(
|
||||||
|
Mobile beholder, BaseBoat boat, Direction d,
|
||||||
|
int speed, PooledRefList<IEntity> ents, int xOffset,
|
||||||
|
int yOffset
|
||||||
|
) : base(0xF6)
|
||||||
{
|
{
|
||||||
public MoveBoatHS(
|
|
||||||
Mobile beholder, BaseBoat boat, Direction d,
|
|
||||||
int speed, PooledRefList<IEntity> ents, int xOffset,
|
|
||||||
int yOffset
|
|
||||||
) : base(0xF6)
|
|
||||||
{
|
|
||||||
EnsureCapacity(3 + 15 + ents.Count * 10);
|
EnsureCapacity(3 + 15 + ents.Count * 10);
|
||||||
|
|
||||||
Stream.Write(boat.Serial);
|
Stream.Write(boat.Serial);
|
||||||
|
|
@ -40,12 +40,12 @@ namespace UOContent.Tests
|
||||||
Stream.Seek(16, SeekOrigin.Begin);
|
Stream.Seek(16, SeekOrigin.Begin);
|
||||||
Stream.Write((short)count);
|
Stream.Write((short)count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class DisplayBoatHS : Packet
|
public sealed class DisplayBoatHS : Packet
|
||||||
|
{
|
||||||
|
public DisplayBoatHS(Mobile beholder, BaseBoat boat) : base(0xF7)
|
||||||
{
|
{
|
||||||
public DisplayBoatHS(Mobile beholder, BaseBoat boat) : base(0xF7)
|
|
||||||
{
|
|
||||||
var ents = boat.GetMovingEntities(true);
|
var ents = boat.GetMovingEntities(true);
|
||||||
|
|
||||||
EnsureCapacity(3 + 2 + 5 * 26);
|
EnsureCapacity(3 + 2 + 5 * 26);
|
||||||
|
|
@ -128,5 +128,4 @@ namespace UOContent.Tests
|
||||||
Stream.Seek(3, SeekOrigin.Begin);
|
Stream.Seek(3, SeekOrigin.Begin);
|
||||||
Stream.Write((short)count);
|
Stream.Write((short)count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -6,14 +6,14 @@ using Server.Tests;
|
||||||
using Server.Tests.Network;
|
using Server.Tests.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
public class HousePacketTests
|
||||||
{
|
{
|
||||||
public class HousePacketTests
|
[Theory]
|
||||||
|
[InlineData(0x1001u)]
|
||||||
|
public void TestBeginHouseCustomization(uint serial)
|
||||||
{
|
{
|
||||||
[Theory]
|
|
||||||
[InlineData(0x1001u)]
|
|
||||||
public void TestBeginHouseCustomization(uint serial)
|
|
||||||
{
|
|
||||||
var expected = new BeginHouseCustomization((Serial)serial).Compile();
|
var expected = new BeginHouseCustomization((Serial)serial).Compile();
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
|
@ -23,10 +23,10 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(0x1001u)]
|
[InlineData(0x1001u)]
|
||||||
public void TestEndHouseCustomization(uint serial)
|
public void TestEndHouseCustomization(uint serial)
|
||||||
{
|
{
|
||||||
var expected = new EndHouseCustomization((Serial)serial).Compile();
|
var expected = new EndHouseCustomization((Serial)serial).Compile();
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
|
@ -36,11 +36,11 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(0x1001u, 0)]
|
[InlineData(0x1001u, 0)]
|
||||||
[InlineData(0x1001u, 100)]
|
[InlineData(0x1001u, 100)]
|
||||||
public void TestDesignStateGeneral(uint serial, int revision)
|
public void TestDesignStateGeneral(uint serial, int revision)
|
||||||
{
|
{
|
||||||
var expected = new DesignStateGeneral((Serial)serial, revision).Compile();
|
var expected = new DesignStateGeneral((Serial)serial, revision).Compile();
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
|
@ -50,9 +50,9 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestHouseDesignStateDetailed()
|
public void TestHouseDesignStateDetailed()
|
||||||
{
|
{
|
||||||
Serial serial = (Serial)0x40000001;
|
Serial serial = (Serial)0x40000001;
|
||||||
var revision = 10;
|
var revision = 10;
|
||||||
var tiles = new MultiTileEntry[250];
|
var tiles = new MultiTileEntry[250];
|
||||||
|
|
@ -76,5 +76,4 @@ namespace UOContent.Tests
|
||||||
|
|
||||||
AssertThat.Equal(actual, expected);
|
AssertThat.Equal(actual, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Server.Tests.Network
|
namespace Server.Tests.Network;
|
||||||
|
|
||||||
|
public class ArrowPacketTests
|
||||||
{
|
{
|
||||||
public class ArrowPacketTests
|
[Fact]
|
||||||
|
public void TestCancelArrow()
|
||||||
{
|
{
|
||||||
[Fact]
|
|
||||||
public void TestCancelArrow()
|
|
||||||
{
|
|
||||||
var expected = new CancelArrow().Compile();
|
var expected = new CancelArrow().Compile();
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
|
@ -17,12 +17,12 @@ namespace Server.Tests.Network
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(0, 0)]
|
[InlineData(0, 0)]
|
||||||
[InlineData(100, 10)]
|
[InlineData(100, 10)]
|
||||||
[InlineData(100000, 100000)]
|
[InlineData(100000, 100000)]
|
||||||
public void TestSetArrow(int x, int y)
|
public void TestSetArrow(int x, int y)
|
||||||
{
|
{
|
||||||
var expected = new SetArrow(x, y).Compile();
|
var expected = new SetArrow(x, y).Compile();
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
|
@ -32,12 +32,12 @@ namespace Server.Tests.Network
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(0, 0)]
|
[InlineData(0, 0)]
|
||||||
[InlineData(100, 10)]
|
[InlineData(100, 10)]
|
||||||
[InlineData(100000, 100000)]
|
[InlineData(100000, 100000)]
|
||||||
public void TestCancelArrowHS(int x, int y)
|
public void TestCancelArrowHS(int x, int y)
|
||||||
{
|
{
|
||||||
Serial serial = (Serial)0x1024;
|
Serial serial = (Serial)0x1024;
|
||||||
|
|
||||||
var expected = new CancelArrowHS(x, y, serial).Compile();
|
var expected = new CancelArrowHS(x, y, serial).Compile();
|
||||||
|
|
@ -50,12 +50,12 @@ namespace Server.Tests.Network
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(0, 0)]
|
[InlineData(0, 0)]
|
||||||
[InlineData(100, 10)]
|
[InlineData(100, 10)]
|
||||||
[InlineData(100000, 100000)]
|
[InlineData(100000, 100000)]
|
||||||
public void TestSetArrowHS(int x, int y)
|
public void TestSetArrowHS(int x, int y)
|
||||||
{
|
{
|
||||||
Serial serial = (Serial)0x1024;
|
Serial serial = (Serial)0x1024;
|
||||||
|
|
||||||
var expected = new SetArrowHS(x, y, serial).Compile();
|
var expected = new SetArrowHS(x, y, serial).Compile();
|
||||||
|
|
@ -67,5 +67,4 @@ namespace Server.Tests.Network
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -1,44 +1,43 @@
|
||||||
namespace Server.Network
|
namespace Server.Network;
|
||||||
|
|
||||||
|
public sealed class CancelArrow : Packet
|
||||||
{
|
{
|
||||||
public sealed class CancelArrow : Packet
|
public CancelArrow() : base(0xBA, 6)
|
||||||
{
|
{
|
||||||
public CancelArrow() : base(0xBA, 6)
|
|
||||||
{
|
|
||||||
Stream.Write((byte)0);
|
Stream.Write((byte)0);
|
||||||
Stream.Write((short)-1);
|
Stream.Write((short)-1);
|
||||||
Stream.Write((short)-1);
|
Stream.Write((short)-1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class SetArrow : Packet
|
|
||||||
{
|
|
||||||
public SetArrow(int x, int y) : base(0xBA, 6)
|
|
||||||
{
|
|
||||||
Stream.Write((byte)1);
|
|
||||||
Stream.Write((short)x);
|
|
||||||
Stream.Write((short)y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class CancelArrowHS : Packet
|
|
||||||
{
|
|
||||||
public CancelArrowHS(int x, int y, Serial s) : base(0xBA, 10)
|
|
||||||
{
|
|
||||||
Stream.Write((byte)0);
|
|
||||||
Stream.Write((short)x);
|
|
||||||
Stream.Write((short)y);
|
|
||||||
Stream.Write(s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class SetArrowHS : Packet
|
|
||||||
{
|
|
||||||
public SetArrowHS(int x, int y, Serial s) : base(0xBA, 10)
|
|
||||||
{
|
|
||||||
Stream.Write((byte)1);
|
|
||||||
Stream.Write((short)x);
|
|
||||||
Stream.Write((short)y);
|
|
||||||
Stream.Write(s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sealed class SetArrow : Packet
|
||||||
|
{
|
||||||
|
public SetArrow(int x, int y) : base(0xBA, 6)
|
||||||
|
{
|
||||||
|
Stream.Write((byte)1);
|
||||||
|
Stream.Write((short)x);
|
||||||
|
Stream.Write((short)y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class CancelArrowHS : Packet
|
||||||
|
{
|
||||||
|
public CancelArrowHS(int x, int y, Serial s) : base(0xBA, 10)
|
||||||
|
{
|
||||||
|
Stream.Write((byte)0);
|
||||||
|
Stream.Write((short)x);
|
||||||
|
Stream.Write((short)y);
|
||||||
|
Stream.Write(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class SetArrowHS : Packet
|
||||||
|
{
|
||||||
|
public SetArrowHS(int x, int y, Serial s) : base(0xBA, 10)
|
||||||
|
{
|
||||||
|
Stream.Write((byte)1);
|
||||||
|
Stream.Write((short)x);
|
||||||
|
Stream.Write((short)y);
|
||||||
|
Stream.Write(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,15 +5,15 @@ using Server.Tests;
|
||||||
using Server.Tests.Network;
|
using Server.Tests.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
public class BuffIconPacketTests
|
||||||
{
|
{
|
||||||
public class BuffIconPacketTests
|
[Theory]
|
||||||
|
[InlineData(0x1024u, BuffIcon.Clumsy, 500100, 300200, "123456", 8000)]
|
||||||
|
[InlineData(0x2048u, BuffIcon.Disguised, 500102, 300203, null, 9000)]
|
||||||
|
public void TestAddBuffIcon(uint mob, BuffIcon iconID, int titleCliloc, int secondaryCliloc, string args, int ts)
|
||||||
{
|
{
|
||||||
[Theory]
|
|
||||||
[InlineData(0x1024u, BuffIcon.Clumsy, 500100, 300200, "123456", 8000)]
|
|
||||||
[InlineData(0x2048u, BuffIcon.Disguised, 500102, 300203, null, 9000)]
|
|
||||||
public void TestAddBuffIcon(uint mob, BuffIcon iconID, int titleCliloc, int secondaryCliloc, string args, int ts)
|
|
||||||
{
|
|
||||||
var timeSpan = new TimeSpan(ts);
|
var timeSpan = new TimeSpan(ts);
|
||||||
var expected = new AddBuffPacket(
|
var expected = new AddBuffPacket(
|
||||||
(Serial)mob, iconID, titleCliloc, secondaryCliloc, args, timeSpan
|
(Serial)mob, iconID, titleCliloc, secondaryCliloc, args, timeSpan
|
||||||
|
|
@ -26,9 +26,9 @@ namespace UOContent.Tests
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestRemoveBuffIcon()
|
public void TestRemoveBuffIcon()
|
||||||
{
|
{
|
||||||
Serial m = (Serial)0x1024;
|
Serial m = (Serial)0x1024;
|
||||||
var buffIcon = BuffIcon.Disguised;
|
var buffIcon = BuffIcon.Disguised;
|
||||||
var expected = new RemoveBuffPacket(m, buffIcon).Compile();
|
var expected = new RemoveBuffPacket(m, buffIcon).Compile();
|
||||||
|
|
@ -39,5 +39,4 @@ namespace UOContent.Tests
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -10,9 +10,8 @@
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<ProjectReference Include="..\Server\Server.csproj" />
|
<ProjectReference Include="..\Application\Application.csproj" />
|
||||||
<ProjectReference Include="..\Server.Tests\Server.Tests.csproj" />
|
<ProjectReference Include="..\Server.Tests\Server.Tests.csproj" />
|
||||||
<ProjectReference Include="..\UOContent\UOContent.csproj" />
|
|
||||||
<DataFiles Include="$(SolutionDir)\Distribution\Data\**" />
|
<DataFiles Include="$(SolutionDir)\Distribution\Data\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Target Name="CopyData" AfterTargets="AfterBuild">
|
<Target Name="CopyData" AfterTargets="AfterBuild">
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,8 @@ namespace Server.Misc
|
||||||
|
|
||||||
if (RestartServer)
|
if (RestartServer)
|
||||||
{
|
{
|
||||||
Restart(e);
|
e.Close = true;
|
||||||
|
Core.Kill(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,23 +61,6 @@ namespace Server.Misc
|
||||||
Email.SendCrashEmail(filePath);
|
Email.SendCrashEmail(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Restart(ServerCrashedEventArgs e)
|
|
||||||
{
|
|
||||||
logger.Information("Restarting");
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Process.Start(Core.Assembly.Location, Core.Arguments);
|
|
||||||
logger.Information("Restart done");
|
|
||||||
|
|
||||||
e.Close = true;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
logger.Error("Restart failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void DirectoryCopy(string sourceDirName, string destDirName)
|
private static void DirectoryCopy(string sourceDirName, string destDirName)
|
||||||
{
|
{
|
||||||
// Get the subdirectories for the specified directory.
|
// Get the subdirectories for the specified directory.
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,8 @@
|
||||||
<Target Name="CleanPub" AfterTargets="Clean">
|
<Target Name="CleanPub" AfterTargets="Clean">
|
||||||
<Message Text="Removing distribution assemblies..." />
|
<Message Text="Removing distribution assemblies..." />
|
||||||
<Delete Files="..\..\Distribution\Assemblies\Argon2.Bindings.dll" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\Assemblies\Argon2.Bindings.dll" ContinueOnError="true" />
|
||||||
<Delete Files="..\..\Distribution\Assemblies\BouncyCastle.Crypto.dll" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\Assemblies\libargon2.dll" ContinueOnError="true" />
|
||||||
|
<Delete Files="..\..\Distribution\Assemblies\BouncyCastle.Cryptography.dll" ContinueOnError="true" />
|
||||||
<Delete Files="..\..\Distribution\Assemblies\MailKit.dll" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\Assemblies\MailKit.dll" ContinueOnError="true" />
|
||||||
<Delete Files="..\..\Distribution\Assemblies\MimeKit.dll" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\Assemblies\MimeKit.dll" ContinueOnError="true" />
|
||||||
<Delete Files="..\..\Distribution\Assemblies\Microsoft.Toolkit.HighPerformance.dll" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\Assemblies\Microsoft.Toolkit.HighPerformance.dll" ContinueOnError="true" />
|
||||||
|
|
@ -24,10 +25,11 @@
|
||||||
<Delete Files="..\..\Distribution\Assemblies\ref\$(AssemblyName).dll" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\Assemblies\ref\$(AssemblyName).dll" ContinueOnError="true" />
|
||||||
<Delete Files="..\..\Distribution\Assemblies\$(AssemblyName).deps.json" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\Assemblies\$(AssemblyName).deps.json" ContinueOnError="true" />
|
||||||
<Delete Files="..\..\Distribution\Assemblies\$(AssemblyName).pdb" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\Assemblies\$(AssemblyName).pdb" ContinueOnError="true" />
|
||||||
<Delete Files="..\..\Distribution\LibDeflate.Bindings.dll" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\Assemblies\LibDeflate.Bindings.dll" ContinueOnError="true" />
|
||||||
<Delete Files="..\..\Distribution\libdeflate.dll" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\Assemblies\libdeflate.dll" ContinueOnError="true" />
|
||||||
<Delete Files="..\..\Distribution\libdeflate.dylib" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\Assemblies\libdeflate.dylib" ContinueOnError="true" />
|
||||||
<Delete Files="..\..\Distribution\Assemblies\Zstd.Binaries.dll" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\Assemblies\Zstd.Binaries.dll" ContinueOnError="true" />
|
||||||
|
<Delete Files="..\..\Distribution\Assemblies\zstd.exe" ContinueOnError="true" />
|
||||||
<Delete Files="..\..\Distribution\Assemblies\ModernUO.Serialization.Annotations.dll" ContinueOnError="true" />
|
<Delete Files="..\..\Distribution\Assemblies\ModernUO.Serialization.Annotations.dll" ContinueOnError="true" />
|
||||||
</Target>
|
</Target>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Thank you to all of our generous sponsors that make ModernUO possible.
|
||||||
We greatly appreciate the support! Use one of the following platforms below:
|
We greatly appreciate the support! Use one of the following platforms below:
|
||||||
|
|
||||||
#### GitHub
|
#### GitHub
|
||||||
[<img alt="Github Sponsors | ModernUO" data-canonical-src="https://camo.githubusercontent.com/dec0683928f7db306904f8ea2e7c0d81ca83800fe09fcd5ac792c962eaee02dc/68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f696d616765732f6d6f64756c65732f736974652f73706f6e736f72732f6c6f676f2d6d6f6e612e737667" src="https://camo.githubusercontent.com/dec0683928f7db306904f8ea2e7c0d81ca83800fe09fcd5ac792c962eaee02dc/68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f696d616765732f6d6f64756c65732f736974652f73706f6e736f72732f6c6f676f2d6d6f6e612e737667" width=100px />](https://github.com/sponsors/modernuo)
|
[<img alt="Github Sponsors | ModernUO" data-canonical-src="https://camo.githubusercontent.com/a44b124b41d702cb4a66abb48cf746ffb7aabcc96d0c72cdb34e0bf8f761ff49/68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f696d616765732f6d6f64756c65732f736974652f73706f6e736f72732f6c6f676f2d6d6f6e612e737667" src="https://camo.githubusercontent.com/a44b124b41d702cb4a66abb48cf746ffb7aabcc96d0c72cdb34e0bf8f761ff49/68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f696d616765732f6d6f64756c65732f736974652f73706f6e736f72732f6c6f676f2d6d6f6e612e737667" width=128px />](https://github.com/sponsors/modernuo)
|
||||||
|
|
||||||
#### Patreon
|
#### Patreon
|
||||||
[<img alt="Patreon | ModernUO" data-canonical-src="https://user-images.githubusercontent.com/3953314/104968719-7c96e980-599b-11eb-839b-28745496b1a4.png" src="https://user-images.githubusercontent.com/3953314/104968719-7c96e980-599b-11eb-839b-28745496b1a4.png" width=128px />](https://muo.gg/patreon)
|
[<img alt="Patreon | ModernUO" data-canonical-src="https://user-images.githubusercontent.com/3953314/104968719-7c96e980-599b-11eb-839b-28745496b1a4.png" src="https://user-images.githubusercontent.com/3953314/104968719-7c96e980-599b-11eb-839b-28745496b1a4.png" width=128px />](https://muo.gg/patreon)
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,8 @@ dotnet clean --verbosity quiet
|
||||||
echo dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json
|
echo dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json
|
||||||
dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json
|
dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json
|
||||||
|
|
||||||
echo dotnet publish %config% %os%-%arch% --no-restore --self-contained=false -o Distribution\Assemblies Projects\UOContent\UOContent.csproj
|
echo dotnet publish %config% %os%-%arch% --no-restore --self-contained=false -o Distribution Projects\Application\Application.csproj
|
||||||
dotnet publish %config% %os%-%arch% --no-restore --self-contained=false -o Distribution\Assemblies Projects\UOContent\UOContent.csproj
|
dotnet publish %config% %os%-%arch% --no-restore --self-contained=false -o Distribution Projects\Application\Application.csproj
|
||||||
|
|
||||||
echo Generating serialization migration schema...
|
echo Generating serialization migration schema...
|
||||||
dotnet tool run ModernUOSchemaGenerator -- ModernUO.sln
|
dotnet tool run ModernUOSchemaGenerator -- ModernUO.sln
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ dotnet clean --verbosity quiet
|
||||||
echo dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json
|
echo dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json
|
||||||
dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json
|
dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json
|
||||||
|
|
||||||
echo dotnet publish ${config} ${os}-${arch} --no-restore --self-contained=false -o Distribution/Assemblies Projects/UOContent/UOContent.csproj
|
echo dotnet publish ${config} ${os}-${arch} --no-restore --self-contained=false -o Distribution Projects/Application/Application.csproj
|
||||||
dotnet publish ${config} ${os}-${arch} --no-restore --self-contained=false -o Distribution/Assemblies Projects/UOContent/UOContent.csproj
|
dotnet publish ${config} ${os}-${arch} --no-restore --self-contained=false -o Distribution Projects/Application/Application.csproj
|
||||||
|
|
||||||
echo Generating serialization migration schema...
|
echo Generating serialization migration schema...
|
||||||
dotnet tool run ModernUOSchemaGenerator -- ModernUO.sln
|
dotnet tool run ModernUOSchemaGenerator -- ModernUO.sln
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
|
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
|
||||||
"version": "0.13.3"
|
"version": "0.13.4"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue