feat: Customize expansion and set maps on first boot (#1425)
This commit is contained in:
parent
3ffe049e08
commit
a9a2a89908
45 changed files with 700 additions and 269 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using Server.Buffers;
|
||||
using Server.Text;
|
||||
using Xunit;
|
||||
|
||||
namespace Server.Tests.Buffers;
|
||||
|
|
|
|||
50
Projects/Server.Tests/Tests/Maps/MapSelectionTests.cs
Normal file
50
Projects/Server.Tests/Tests/Maps/MapSelectionTests.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
using Xunit;
|
||||
using Server.Maps;
|
||||
using Server.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Tests.Tests.Maps
|
||||
{
|
||||
public class MapSelectionTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(MapSelectionFlags.Felucca, "Felucca")]
|
||||
[InlineData(MapSelectionFlags.Felucca | MapSelectionFlags.Trammel, "Felucca, Trammel")]
|
||||
public void TestCommaSeparatedList(MapSelectionFlags flags, string expected)
|
||||
{
|
||||
Assert.Equal(expected, flags.ToCommaDelimitedString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestFormatFeluccaOnlyMapSelection()
|
||||
{
|
||||
const MapSelectionFlags flags = MapSelectionFlags.Felucca;
|
||||
|
||||
// When, Then
|
||||
Assert.Equal("Felucca", flags.ToCommaDelimitedString());
|
||||
}
|
||||
|
||||
public class TestMapConfig
|
||||
{
|
||||
[JsonConverter(typeof(FlagsConverter<MapSelectionFlags>))]
|
||||
public MapSelectionFlags TestMapFlags { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestSerializeAndDeserializeMapSelectionFlags()
|
||||
{
|
||||
TestMapConfig mapConfig = new()
|
||||
{
|
||||
TestMapFlags = MapSelectionFlags.Felucca | MapSelectionFlags.Ilshenar,
|
||||
};
|
||||
|
||||
// When
|
||||
string serialized = JsonConfig.Serialize(mapConfig);
|
||||
TestMapConfig deserialized = JsonSerializer.Deserialize<TestMapConfig>(serialized, JsonConfig.GetOptions());
|
||||
|
||||
// Then
|
||||
Assert.Equal(mapConfig.TestMapFlags, deserialized.TestMapFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -243,11 +243,11 @@ namespace Server.Tests.Network
|
|||
int mobileStatusVersion
|
||||
)
|
||||
{
|
||||
var expansionInfo = ExpansionInfo.GetInfo(Core.Expansion);
|
||||
var expansionInfo = ExpansionInfo.CoreExpansion;
|
||||
var oldExpansion = Core.Expansion;
|
||||
var oldVersion = expansionInfo.MobileStatusVersion;
|
||||
Core.Expansion = expansion;
|
||||
ExpansionInfo.GetInfo(Core.Expansion).MobileStatusVersion = mobileStatusVersion;
|
||||
ExpansionInfo.CoreExpansion.MobileStatusVersion = mobileStatusVersion;
|
||||
|
||||
var m = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
||||
m.DefaultMobileInit();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue