Skip to content

Commit

Permalink
feat: Customize expansion and set maps on first boot (#1425)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdodkins authored Aug 1, 2023
1 parent 3ffe049 commit a9a2a89
Show file tree
Hide file tree
Showing 45 changed files with 698 additions and 267 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/Distribution/bsdtar
/Distribution/Configuration/antimacro.json
/Distribution/Configuration/assistants.json
/Distribution/Configuration/expansion.json
/Distribution/Configuration/modernuo.json
/Distribution/Configuration/email-settings.json
/Distribution/Configuration/throttles.json
Expand All @@ -25,6 +26,7 @@
/Projects/*/bin
/Projects/*/Generated

*.swp
*.log
*.user
/.idea
Expand Down
142 changes: 125 additions & 17 deletions Distribution/Data/expansion.json → Distribution/Data/expansions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[
{
"Id": 0,
"Name": "None",
"ClientVersion": null,
"ClientFlags": null,
"RequiredClient": null,
"ClientFlags": "None",
"FeatureFlags": {
"T2A": false,
"UOR": false,
Expand All @@ -29,6 +30,14 @@
"TOL": false,
"EJ": false
},
"MapSelectionFlags": {
"Felucca": true,
"Trammel": false,
"Ilshenar": false,
"Malas": false,
"Tokuno": false,
"TerMer": false
},
"CharacterListFlags": {
"Unk1": false,
"OverwriteConfigButton": false,
Expand Down Expand Up @@ -64,8 +73,9 @@
"MobileStatusVersion": 3
},
{
"Id": 1,
"Name": "The Second Age",
"ClientVersion": null,
"RequiredClient": null,
"ClientFlags": "Felucca",
"FeatureFlags": {
"T2A": true,
Expand Down Expand Up @@ -93,6 +103,14 @@
"TOL": false,
"EJ": false
},
"MapSelectionFlags": {
"Felucca": true,
"Trammel": true,
"Ilshenar": false,
"Malas": false,
"Tokuno": false,
"TerMer": false
},
"CharacterListFlags": {
"Unk1": false,
"OverwriteConfigButton": false,
Expand Down Expand Up @@ -128,8 +146,9 @@
"MobileStatusVersion": 3
},
{
"Id": 2,
"Name": "Renaissance",
"ClientVersion": null,
"RequiredClient": null,
"ClientFlags": "Trammel",
"FeatureFlags": {
"T2A": true,
Expand Down Expand Up @@ -157,6 +176,14 @@
"TOL": false,
"EJ": false
},
"MapSelectionFlags": {
"Felucca": true,
"Trammel": true,
"Ilshenar": false,
"Malas": false,
"Tokuno": false,
"TerMer": false
},
"CharacterListFlags": {
"Unk1": false,
"OverwriteConfigButton": false,
Expand Down Expand Up @@ -192,8 +219,9 @@
"MobileStatusVersion": 3
},
{
"Id": 3,
"Name": "Third Dawn",
"ClientVersion": null,
"RequiredClient": null,
"ClientFlags": "Ilshenar",
"FeatureFlags": {
"T2A": true,
Expand Down Expand Up @@ -221,6 +249,14 @@
"TOL": false,
"EJ": false
},
"MapSelectionFlags": {
"Felucca": true,
"Trammel": true,
"Ilshenar": true,
"Malas": false,
"Tokuno": false,
"TerMer": false
},
"CharacterListFlags": {
"Unk1": false,
"OverwriteConfigButton": false,
Expand Down Expand Up @@ -256,8 +292,9 @@
"MobileStatusVersion": 3
},
{
"Id": 4,
"Name": "Blackthorn's Revenge",
"ClientVersion": null,
"RequiredClient": null,
"ClientFlags": "Ilshenar",
"FeatureFlags": {
"T2A": true,
Expand Down Expand Up @@ -285,6 +322,14 @@
"TOL": false,
"EJ": false
},
"MapSelectionFlags": {
"Felucca": true,
"Trammel": true,
"Ilshenar": true,
"Malas": false,
"Tokuno": false,
"TerMer": false
},
"CharacterListFlags": {
"Unk1": false,
"OverwriteConfigButton": false,
Expand Down Expand Up @@ -320,8 +365,9 @@
"MobileStatusVersion": 3
},
{
"Id": 5,
"Name": "Age of Shadows",
"ClientVersion": null,
"RequiredClient": null,
"ClientFlags": "Malas",
"FeatureFlags": {
"T2A": true,
Expand Down Expand Up @@ -349,6 +395,14 @@
"TOL": false,
"EJ": false
},
"MapSelectionFlags": {
"Felucca": true,
"Trammel": true,
"Ilshenar": true,
"Malas": true,
"Tokuno": false,
"TerMer": false
},
"CharacterListFlags": {
"Unk1": false,
"OverwriteConfigButton": false,
Expand Down Expand Up @@ -384,8 +438,9 @@
"MobileStatusVersion": 6
},
{
"Id": 6,
"Name": "Samurai Empire",
"ClientVersion": null,
"RequiredClient": null,
"ClientFlags": "Tokuno",
"FeatureFlags": {
"T2A": true,
Expand Down Expand Up @@ -413,6 +468,14 @@
"TOL": false,
"EJ": false
},
"MapSelectionFlags": {
"Felucca": true,
"Trammel": true,
"Ilshenar": true,
"Malas": true,
"Tokuno": true,
"TerMer": false
},
"CharacterListFlags": {
"Unk1": false,
"OverwriteConfigButton": false,
Expand Down Expand Up @@ -448,9 +511,10 @@
"MobileStatusVersion": 6
},
{
"Id": 7,
"Name": "Mondain's Legacy",
"ClientVersion": "5.0.0a",
"ClientFlags": null,
"RequiredClient": "5.0.0a",
"ClientFlags": "None",
"FeatureFlags": {
"T2A": true,
"UOR": true,
Expand All @@ -477,6 +541,14 @@
"TOL": false,
"EJ": false
},
"MapSelectionFlags": {
"Felucca": true,
"Trammel": true,
"Ilshenar": true,
"Malas": true,
"Tokuno": true,
"TerMer": false
},
"CharacterListFlags": {
"Unk1": false,
"OverwriteConfigButton": false,
Expand Down Expand Up @@ -512,8 +584,9 @@
"MobileStatusVersion": 6
},
{
"Id": 8,
"Name": "Stygian Abyss",
"ClientVersion": null,
"RequiredClient": null,
"ClientFlags": "TerMur",
"FeatureFlags": {
"T2A": true,
Expand Down Expand Up @@ -541,6 +614,14 @@
"TOL": false,
"EJ": false
},
"MapSelectionFlags": {
"Felucca": true,
"Trammel": true,
"Ilshenar": true,
"Malas": true,
"Tokuno": true,
"TerMer": true
},
"CharacterListFlags": {
"Unk1": false,
"OverwriteConfigButton": false,
Expand Down Expand Up @@ -576,9 +657,10 @@
"MobileStatusVersion": 6
},
{
"Id": 9,
"Name": "High Seas",
"ClientVersion": "7.0.9.0",
"ClientFlags": null,
"RequiredClient": "7.0.9.0",
"ClientFlags": "None",
"FeatureFlags": {
"T2A": true,
"UOR": true,
Expand All @@ -605,6 +687,14 @@
"TOL": false,
"EJ": false
},
"MapSelectionFlags": {
"Felucca": true,
"Trammel": true,
"Ilshenar": true,
"Malas": true,
"Tokuno": true,
"TerMer": true
},
"CharacterListFlags": {
"Unk1": false,
"OverwriteConfigButton": false,
Expand Down Expand Up @@ -640,9 +730,10 @@
"MobileStatusVersion": 6
},
{
"Id": 10,
"Name": "Time of Legends",
"ClientVersion": "7.0.45.65",
"ClientFlags": null,
"RequiredClient": "7.0.45.65",
"ClientFlags": "None",
"FeatureFlags": {
"T2A": true,
"UOR": true,
Expand All @@ -669,6 +760,14 @@
"TOL": true,
"EJ": false
},
"MapSelectionFlags": {
"Felucca": true,
"Trammel": true,
"Ilshenar": true,
"Malas": true,
"Tokuno": true,
"TerMer": true
},
"CharacterListFlags": {
"Unk1": false,
"OverwriteConfigButton": false,
Expand Down Expand Up @@ -704,9 +803,10 @@
"MobileStatusVersion": 6
},
{
"Id": 11,
"Name": "Endless Journey",
"ClientVersion": "7.0.61.0",
"ClientFlags": null,
"RequiredClient": "7.0.61.0",
"ClientFlags": "None",
"FeatureFlags": {
"T2A": true,
"UOR": true,
Expand All @@ -733,6 +833,14 @@
"TOL": true,
"EJ": true
},
"MapSelectionFlags": {
"Felucca": true,
"Trammel": true,
"Ilshenar": true,
"Malas": true,
"Tokuno": true,
"TerMer": true
},
"CharacterListFlags": {
"Unk1": false,
"OverwriteConfigButton": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Server.Buffers;
using Server.Text;
using Xunit;

namespace Server.Tests.Buffers;
Expand Down
50 changes: 50 additions & 0 deletions Projects/Server.Tests/Tests/Maps/MapSelectionTests.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
Loading

0 comments on commit a9a2a89

Please sign in to comment.