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:
Kamron Batman 2024-05-30 23:34:03 -07:00 • committed by GitHub
parent e85c56ec2d
commit 60a3a6f501
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 572 additions and 585 deletions

View file

@ -4,14 +4,14 @@ using Server.Tests;
using Server.Tests.Network;
using Xunit;
namespace UOContent.Tests
namespace UOContent.Tests;
[Collection("Sequential Tests")]
public class MahjongPacketTests : IClassFixture<ServerFixture>
{
[Collection("Sequential Tests")]
public class MahjongPacketTests : IClassFixture<ServerFixture>
[Fact]
public void TestMahjongJoinGame()
{
[Fact]
public void TestMahjongJoinGame()
{
Serial game = (Serial)0x1024u;
var expected = new MahjongJoinGame(game).Compile();
@ -23,11 +23,11 @@ namespace UOContent.Tests
AssertThat.Equal(result, expected);
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void TestMahjongPlayersInfo(bool showScores)
{
[Theory]
[InlineData(true)]
[InlineData(false)]
public void TestMahjongPlayersInfo(bool showScores)
{
var m = new Mobile((Serial)0x1);
m.DefaultMobileInit();
@ -43,13 +43,13 @@ namespace UOContent.Tests
AssertThat.Equal(result, expected);
}
[Theory]
[InlineData(true, true)]
[InlineData(true, false)]
[InlineData(false, true)]
[InlineData(false, false)]
public void TestMahjongGeneralInfo(bool showScores, bool spectatorVision)
{
[Theory]
[InlineData(true, true)]
[InlineData(true, false)]
[InlineData(false, true)]
[InlineData(false, false)]
public void TestMahjongGeneralInfo(bool showScores, bool spectatorVision)
{
var game = new MahjongGame { ShowScores = showScores, SpectatorVision = spectatorVision};
var expected = new MahjongGeneralInfo(game).Compile();
@ -61,11 +61,11 @@ namespace UOContent.Tests
AssertThat.Equal(result, expected);
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void TestMahjongTilesInfo(bool spectatorVision)
{
[Theory]
[InlineData(true)]
[InlineData(false)]
public void TestMahjongTilesInfo(bool spectatorVision)
{
var m = new Mobile((Serial)0x1);
m.DefaultMobileInit();
@ -81,11 +81,11 @@ namespace UOContent.Tests
AssertThat.Equal(result, expected);
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void TestMahjongTileInfo(bool spectatorVision)
{
[Theory]
[InlineData(true)]
[InlineData(false)]
public void TestMahjongTileInfo(bool spectatorVision)
{
var m = new Mobile((Serial)0x1);
m.DefaultMobileInit();
@ -101,9 +101,9 @@ namespace UOContent.Tests
AssertThat.Equal(result, expected);
}
[Fact]
public void TestMahjongRelieve()
{
[Fact]
public void TestMahjongRelieve()
{
Serial game = (Serial)0x1024u;
var expected = new MahjongRelieve(game).Compile();
@ -114,5 +114,4 @@ namespace UOContent.Tests
var result = ns.SendPipe.Reader.AvailableToRead();
AssertThat.Equal(result, expected);
}
}
}
}

View file

@ -1,24 +1,24 @@
using System.IO;
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);
Stream.Write(game);
Stream.Write((byte)0);
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;
EnsureCapacity(11 + 45 * players.Seats);
@ -86,12 +86,12 @@ namespace Server.Engines.Mahjong
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);
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.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 players = game.Players;
@ -162,12 +162,12 @@ namespace Server.Engines.Mahjong
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 players = game.Players;
@ -205,17 +205,16 @@ namespace Server.Engines.Mahjong
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);
Stream.Write(game);
Stream.Write((byte)0);
Stream.Write((byte)0x1A);
}
}
}
}