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
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -5,6 +5,7 @@
|
||||||
/Distribution/bsdtar
|
/Distribution/bsdtar
|
||||||
/Distribution/Configuration/antimacro.json
|
/Distribution/Configuration/antimacro.json
|
||||||
/Distribution/Configuration/assistants.json
|
/Distribution/Configuration/assistants.json
|
||||||
|
/Distribution/Configuration/expansion.json
|
||||||
/Distribution/Configuration/modernuo.json
|
/Distribution/Configuration/modernuo.json
|
||||||
/Distribution/Configuration/email-settings.json
|
/Distribution/Configuration/email-settings.json
|
||||||
/Distribution/Configuration/throttles.json
|
/Distribution/Configuration/throttles.json
|
||||||
|
|
@ -25,6 +26,7 @@
|
||||||
/Projects/*/bin
|
/Projects/*/bin
|
||||||
/Projects/*/Generated
|
/Projects/*/Generated
|
||||||
|
|
||||||
|
*.swp
|
||||||
*.log
|
*.log
|
||||||
*.user
|
*.user
|
||||||
/.idea
|
/.idea
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
"Id": 0,
|
||||||
"Name": "None",
|
"Name": "None",
|
||||||
"ClientVersion": null,
|
"RequiredClient": null,
|
||||||
"ClientFlags": null,
|
"ClientFlags": "None",
|
||||||
"FeatureFlags": {
|
"FeatureFlags": {
|
||||||
"T2A": false,
|
"T2A": false,
|
||||||
"UOR": false,
|
"UOR": false,
|
||||||
|
|
@ -29,6 +30,14 @@
|
||||||
"TOL": false,
|
"TOL": false,
|
||||||
"EJ": false
|
"EJ": false
|
||||||
},
|
},
|
||||||
|
"MapSelectionFlags": {
|
||||||
|
"Felucca": true,
|
||||||
|
"Trammel": false,
|
||||||
|
"Ilshenar": false,
|
||||||
|
"Malas": false,
|
||||||
|
"Tokuno": false,
|
||||||
|
"TerMer": false
|
||||||
|
},
|
||||||
"CharacterListFlags": {
|
"CharacterListFlags": {
|
||||||
"Unk1": false,
|
"Unk1": false,
|
||||||
"OverwriteConfigButton": false,
|
"OverwriteConfigButton": false,
|
||||||
|
|
@ -64,8 +73,9 @@
|
||||||
"MobileStatusVersion": 3
|
"MobileStatusVersion": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": 1,
|
||||||
"Name": "The Second Age",
|
"Name": "The Second Age",
|
||||||
"ClientVersion": null,
|
"RequiredClient": null,
|
||||||
"ClientFlags": "Felucca",
|
"ClientFlags": "Felucca",
|
||||||
"FeatureFlags": {
|
"FeatureFlags": {
|
||||||
"T2A": true,
|
"T2A": true,
|
||||||
|
|
@ -93,6 +103,14 @@
|
||||||
"TOL": false,
|
"TOL": false,
|
||||||
"EJ": false
|
"EJ": false
|
||||||
},
|
},
|
||||||
|
"MapSelectionFlags": {
|
||||||
|
"Felucca": true,
|
||||||
|
"Trammel": true,
|
||||||
|
"Ilshenar": false,
|
||||||
|
"Malas": false,
|
||||||
|
"Tokuno": false,
|
||||||
|
"TerMer": false
|
||||||
|
},
|
||||||
"CharacterListFlags": {
|
"CharacterListFlags": {
|
||||||
"Unk1": false,
|
"Unk1": false,
|
||||||
"OverwriteConfigButton": false,
|
"OverwriteConfigButton": false,
|
||||||
|
|
@ -128,8 +146,9 @@
|
||||||
"MobileStatusVersion": 3
|
"MobileStatusVersion": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": 2,
|
||||||
"Name": "Renaissance",
|
"Name": "Renaissance",
|
||||||
"ClientVersion": null,
|
"RequiredClient": null,
|
||||||
"ClientFlags": "Trammel",
|
"ClientFlags": "Trammel",
|
||||||
"FeatureFlags": {
|
"FeatureFlags": {
|
||||||
"T2A": true,
|
"T2A": true,
|
||||||
|
|
@ -157,6 +176,14 @@
|
||||||
"TOL": false,
|
"TOL": false,
|
||||||
"EJ": false
|
"EJ": false
|
||||||
},
|
},
|
||||||
|
"MapSelectionFlags": {
|
||||||
|
"Felucca": true,
|
||||||
|
"Trammel": true,
|
||||||
|
"Ilshenar": false,
|
||||||
|
"Malas": false,
|
||||||
|
"Tokuno": false,
|
||||||
|
"TerMer": false
|
||||||
|
},
|
||||||
"CharacterListFlags": {
|
"CharacterListFlags": {
|
||||||
"Unk1": false,
|
"Unk1": false,
|
||||||
"OverwriteConfigButton": false,
|
"OverwriteConfigButton": false,
|
||||||
|
|
@ -192,8 +219,9 @@
|
||||||
"MobileStatusVersion": 3
|
"MobileStatusVersion": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": 3,
|
||||||
"Name": "Third Dawn",
|
"Name": "Third Dawn",
|
||||||
"ClientVersion": null,
|
"RequiredClient": null,
|
||||||
"ClientFlags": "Ilshenar",
|
"ClientFlags": "Ilshenar",
|
||||||
"FeatureFlags": {
|
"FeatureFlags": {
|
||||||
"T2A": true,
|
"T2A": true,
|
||||||
|
|
@ -221,6 +249,14 @@
|
||||||
"TOL": false,
|
"TOL": false,
|
||||||
"EJ": false
|
"EJ": false
|
||||||
},
|
},
|
||||||
|
"MapSelectionFlags": {
|
||||||
|
"Felucca": true,
|
||||||
|
"Trammel": true,
|
||||||
|
"Ilshenar": true,
|
||||||
|
"Malas": false,
|
||||||
|
"Tokuno": false,
|
||||||
|
"TerMer": false
|
||||||
|
},
|
||||||
"CharacterListFlags": {
|
"CharacterListFlags": {
|
||||||
"Unk1": false,
|
"Unk1": false,
|
||||||
"OverwriteConfigButton": false,
|
"OverwriteConfigButton": false,
|
||||||
|
|
@ -256,8 +292,9 @@
|
||||||
"MobileStatusVersion": 3
|
"MobileStatusVersion": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": 4,
|
||||||
"Name": "Blackthorn's Revenge",
|
"Name": "Blackthorn's Revenge",
|
||||||
"ClientVersion": null,
|
"RequiredClient": null,
|
||||||
"ClientFlags": "Ilshenar",
|
"ClientFlags": "Ilshenar",
|
||||||
"FeatureFlags": {
|
"FeatureFlags": {
|
||||||
"T2A": true,
|
"T2A": true,
|
||||||
|
|
@ -285,6 +322,14 @@
|
||||||
"TOL": false,
|
"TOL": false,
|
||||||
"EJ": false
|
"EJ": false
|
||||||
},
|
},
|
||||||
|
"MapSelectionFlags": {
|
||||||
|
"Felucca": true,
|
||||||
|
"Trammel": true,
|
||||||
|
"Ilshenar": true,
|
||||||
|
"Malas": false,
|
||||||
|
"Tokuno": false,
|
||||||
|
"TerMer": false
|
||||||
|
},
|
||||||
"CharacterListFlags": {
|
"CharacterListFlags": {
|
||||||
"Unk1": false,
|
"Unk1": false,
|
||||||
"OverwriteConfigButton": false,
|
"OverwriteConfigButton": false,
|
||||||
|
|
@ -320,8 +365,9 @@
|
||||||
"MobileStatusVersion": 3
|
"MobileStatusVersion": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": 5,
|
||||||
"Name": "Age of Shadows",
|
"Name": "Age of Shadows",
|
||||||
"ClientVersion": null,
|
"RequiredClient": null,
|
||||||
"ClientFlags": "Malas",
|
"ClientFlags": "Malas",
|
||||||
"FeatureFlags": {
|
"FeatureFlags": {
|
||||||
"T2A": true,
|
"T2A": true,
|
||||||
|
|
@ -349,6 +395,14 @@
|
||||||
"TOL": false,
|
"TOL": false,
|
||||||
"EJ": false
|
"EJ": false
|
||||||
},
|
},
|
||||||
|
"MapSelectionFlags": {
|
||||||
|
"Felucca": true,
|
||||||
|
"Trammel": true,
|
||||||
|
"Ilshenar": true,
|
||||||
|
"Malas": true,
|
||||||
|
"Tokuno": false,
|
||||||
|
"TerMer": false
|
||||||
|
},
|
||||||
"CharacterListFlags": {
|
"CharacterListFlags": {
|
||||||
"Unk1": false,
|
"Unk1": false,
|
||||||
"OverwriteConfigButton": false,
|
"OverwriteConfigButton": false,
|
||||||
|
|
@ -384,8 +438,9 @@
|
||||||
"MobileStatusVersion": 6
|
"MobileStatusVersion": 6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": 6,
|
||||||
"Name": "Samurai Empire",
|
"Name": "Samurai Empire",
|
||||||
"ClientVersion": null,
|
"RequiredClient": null,
|
||||||
"ClientFlags": "Tokuno",
|
"ClientFlags": "Tokuno",
|
||||||
"FeatureFlags": {
|
"FeatureFlags": {
|
||||||
"T2A": true,
|
"T2A": true,
|
||||||
|
|
@ -413,6 +468,14 @@
|
||||||
"TOL": false,
|
"TOL": false,
|
||||||
"EJ": false
|
"EJ": false
|
||||||
},
|
},
|
||||||
|
"MapSelectionFlags": {
|
||||||
|
"Felucca": true,
|
||||||
|
"Trammel": true,
|
||||||
|
"Ilshenar": true,
|
||||||
|
"Malas": true,
|
||||||
|
"Tokuno": true,
|
||||||
|
"TerMer": false
|
||||||
|
},
|
||||||
"CharacterListFlags": {
|
"CharacterListFlags": {
|
||||||
"Unk1": false,
|
"Unk1": false,
|
||||||
"OverwriteConfigButton": false,
|
"OverwriteConfigButton": false,
|
||||||
|
|
@ -448,9 +511,10 @@
|
||||||
"MobileStatusVersion": 6
|
"MobileStatusVersion": 6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": 7,
|
||||||
"Name": "Mondain's Legacy",
|
"Name": "Mondain's Legacy",
|
||||||
"ClientVersion": "5.0.0a",
|
"RequiredClient": "5.0.0a",
|
||||||
"ClientFlags": null,
|
"ClientFlags": "None",
|
||||||
"FeatureFlags": {
|
"FeatureFlags": {
|
||||||
"T2A": true,
|
"T2A": true,
|
||||||
"UOR": true,
|
"UOR": true,
|
||||||
|
|
@ -477,6 +541,14 @@
|
||||||
"TOL": false,
|
"TOL": false,
|
||||||
"EJ": false
|
"EJ": false
|
||||||
},
|
},
|
||||||
|
"MapSelectionFlags": {
|
||||||
|
"Felucca": true,
|
||||||
|
"Trammel": true,
|
||||||
|
"Ilshenar": true,
|
||||||
|
"Malas": true,
|
||||||
|
"Tokuno": true,
|
||||||
|
"TerMer": false
|
||||||
|
},
|
||||||
"CharacterListFlags": {
|
"CharacterListFlags": {
|
||||||
"Unk1": false,
|
"Unk1": false,
|
||||||
"OverwriteConfigButton": false,
|
"OverwriteConfigButton": false,
|
||||||
|
|
@ -512,8 +584,9 @@
|
||||||
"MobileStatusVersion": 6
|
"MobileStatusVersion": 6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": 8,
|
||||||
"Name": "Stygian Abyss",
|
"Name": "Stygian Abyss",
|
||||||
"ClientVersion": null,
|
"RequiredClient": null,
|
||||||
"ClientFlags": "TerMur",
|
"ClientFlags": "TerMur",
|
||||||
"FeatureFlags": {
|
"FeatureFlags": {
|
||||||
"T2A": true,
|
"T2A": true,
|
||||||
|
|
@ -541,6 +614,14 @@
|
||||||
"TOL": false,
|
"TOL": false,
|
||||||
"EJ": false
|
"EJ": false
|
||||||
},
|
},
|
||||||
|
"MapSelectionFlags": {
|
||||||
|
"Felucca": true,
|
||||||
|
"Trammel": true,
|
||||||
|
"Ilshenar": true,
|
||||||
|
"Malas": true,
|
||||||
|
"Tokuno": true,
|
||||||
|
"TerMer": true
|
||||||
|
},
|
||||||
"CharacterListFlags": {
|
"CharacterListFlags": {
|
||||||
"Unk1": false,
|
"Unk1": false,
|
||||||
"OverwriteConfigButton": false,
|
"OverwriteConfigButton": false,
|
||||||
|
|
@ -576,9 +657,10 @@
|
||||||
"MobileStatusVersion": 6
|
"MobileStatusVersion": 6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": 9,
|
||||||
"Name": "High Seas",
|
"Name": "High Seas",
|
||||||
"ClientVersion": "7.0.9.0",
|
"RequiredClient": "7.0.9.0",
|
||||||
"ClientFlags": null,
|
"ClientFlags": "None",
|
||||||
"FeatureFlags": {
|
"FeatureFlags": {
|
||||||
"T2A": true,
|
"T2A": true,
|
||||||
"UOR": true,
|
"UOR": true,
|
||||||
|
|
@ -605,6 +687,14 @@
|
||||||
"TOL": false,
|
"TOL": false,
|
||||||
"EJ": false
|
"EJ": false
|
||||||
},
|
},
|
||||||
|
"MapSelectionFlags": {
|
||||||
|
"Felucca": true,
|
||||||
|
"Trammel": true,
|
||||||
|
"Ilshenar": true,
|
||||||
|
"Malas": true,
|
||||||
|
"Tokuno": true,
|
||||||
|
"TerMer": true
|
||||||
|
},
|
||||||
"CharacterListFlags": {
|
"CharacterListFlags": {
|
||||||
"Unk1": false,
|
"Unk1": false,
|
||||||
"OverwriteConfigButton": false,
|
"OverwriteConfigButton": false,
|
||||||
|
|
@ -640,9 +730,10 @@
|
||||||
"MobileStatusVersion": 6
|
"MobileStatusVersion": 6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": 10,
|
||||||
"Name": "Time of Legends",
|
"Name": "Time of Legends",
|
||||||
"ClientVersion": "7.0.45.65",
|
"RequiredClient": "7.0.45.65",
|
||||||
"ClientFlags": null,
|
"ClientFlags": "None",
|
||||||
"FeatureFlags": {
|
"FeatureFlags": {
|
||||||
"T2A": true,
|
"T2A": true,
|
||||||
"UOR": true,
|
"UOR": true,
|
||||||
|
|
@ -669,6 +760,14 @@
|
||||||
"TOL": true,
|
"TOL": true,
|
||||||
"EJ": false
|
"EJ": false
|
||||||
},
|
},
|
||||||
|
"MapSelectionFlags": {
|
||||||
|
"Felucca": true,
|
||||||
|
"Trammel": true,
|
||||||
|
"Ilshenar": true,
|
||||||
|
"Malas": true,
|
||||||
|
"Tokuno": true,
|
||||||
|
"TerMer": true
|
||||||
|
},
|
||||||
"CharacterListFlags": {
|
"CharacterListFlags": {
|
||||||
"Unk1": false,
|
"Unk1": false,
|
||||||
"OverwriteConfigButton": false,
|
"OverwriteConfigButton": false,
|
||||||
|
|
@ -704,9 +803,10 @@
|
||||||
"MobileStatusVersion": 6
|
"MobileStatusVersion": 6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": 11,
|
||||||
"Name": "Endless Journey",
|
"Name": "Endless Journey",
|
||||||
"ClientVersion": "7.0.61.0",
|
"RequiredClient": "7.0.61.0",
|
||||||
"ClientFlags": null,
|
"ClientFlags": "None",
|
||||||
"FeatureFlags": {
|
"FeatureFlags": {
|
||||||
"T2A": true,
|
"T2A": true,
|
||||||
"UOR": true,
|
"UOR": true,
|
||||||
|
|
@ -733,6 +833,14 @@
|
||||||
"TOL": true,
|
"TOL": true,
|
||||||
"EJ": true
|
"EJ": true
|
||||||
},
|
},
|
||||||
|
"MapSelectionFlags": {
|
||||||
|
"Felucca": true,
|
||||||
|
"Trammel": true,
|
||||||
|
"Ilshenar": true,
|
||||||
|
"Malas": true,
|
||||||
|
"Tokuno": true,
|
||||||
|
"TerMer": true
|
||||||
|
},
|
||||||
"CharacterListFlags": {
|
"CharacterListFlags": {
|
||||||
"Unk1": false,
|
"Unk1": false,
|
||||||
"OverwriteConfigButton": false,
|
"OverwriteConfigButton": false,
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Server.Buffers;
|
using Server.Text;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Server.Tests.Buffers;
|
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
|
int mobileStatusVersion
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
var expansionInfo = ExpansionInfo.GetInfo(Core.Expansion);
|
var expansionInfo = ExpansionInfo.CoreExpansion;
|
||||||
var oldExpansion = Core.Expansion;
|
var oldExpansion = Core.Expansion;
|
||||||
var oldVersion = expansionInfo.MobileStatusVersion;
|
var oldVersion = expansionInfo.MobileStatusVersion;
|
||||||
Core.Expansion = expansion;
|
Core.Expansion = expansion;
|
||||||
ExpansionInfo.GetInfo(Core.Expansion).MobileStatusVersion = mobileStatusVersion;
|
ExpansionInfo.CoreExpansion.MobileStatusVersion = mobileStatusVersion;
|
||||||
|
|
||||||
var m = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
var m = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
||||||
m.DefaultMobileInit();
|
m.DefaultMobileInit();
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@ using System.Buffers;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Server.Buffers;
|
using Server.Buffers;
|
||||||
|
|
||||||
|
namespace Server.Text;
|
||||||
|
|
||||||
public ref struct ValueStringBuilder
|
public ref struct ValueStringBuilder
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using Server.Buffers;
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server;
|
namespace Server;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public struct ArrayEnumerator<T> : IEnumerator<T>
|
||||||
|
|
||||||
if ((uint)_index < (uint)localList.Length)
|
if ((uint)_index < (uint)localList.Length)
|
||||||
{
|
{
|
||||||
_current = _array[_index++];
|
_current = localList[_index++];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
118
Projects/Server/Configuration/ExpansionConfigurationPrompts.cs
Normal file
118
Projects/Server/Configuration/ExpansionConfigurationPrompts.cs
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
using Server.Maps;
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace Server;
|
||||||
|
|
||||||
|
public static class ExpansionConfigurationPrompts
|
||||||
|
{
|
||||||
|
internal static Expansion GetExpansion()
|
||||||
|
{
|
||||||
|
Console.WriteLine("Please choose an expansion by typing the number or short name:");
|
||||||
|
var expansions = ExpansionInfo.Table;
|
||||||
|
|
||||||
|
for (var i = 0; i < expansions.Length; i++)
|
||||||
|
{
|
||||||
|
var info = expansions[i];
|
||||||
|
Console.WriteLine(" - {0,2}: {1} ({2})", i, ((Expansion)info.Id).ToString(), info.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
var maxExpansion = (Expansion)expansions[^1].Id;
|
||||||
|
var maxExpansionName = maxExpansion.ToString();
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Console.Write("[enter for {0}]> ", maxExpansionName);
|
||||||
|
var input = Console.ReadLine();
|
||||||
|
Expansion expansion;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(input))
|
||||||
|
{
|
||||||
|
expansion = maxExpansion;
|
||||||
|
}
|
||||||
|
else if (int.TryParse(input, NumberStyles.Integer, null, out var number) &&
|
||||||
|
number >= 0 && number < expansions.Length)
|
||||||
|
{
|
||||||
|
expansion = (Expansion)number;
|
||||||
|
}
|
||||||
|
else if (!Enum.TryParse(input, out expansion))
|
||||||
|
{
|
||||||
|
Utility.PushColor(ConsoleColor.Red);
|
||||||
|
Console.Write(input);
|
||||||
|
Utility.PopColor();
|
||||||
|
Console.WriteLine(" is an invalid expansion option.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.Write("Expansion set to ");
|
||||||
|
Utility.PushColor(ConsoleColor.Green);
|
||||||
|
Console.Write(ExpansionInfo.GetInfo(expansion).Name);
|
||||||
|
Utility.PopColor();
|
||||||
|
Console.WriteLine(".");
|
||||||
|
return expansion;
|
||||||
|
} while (true);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void OutputSelectedMaps(Expansion expansion, MapSelectionFlags selectedMaps)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Selected maps:");
|
||||||
|
|
||||||
|
var i = 0;
|
||||||
|
foreach (var flag in MapSelection.EnumFromExpansion(expansion))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"{i + 1}. {flag} [{(selectedMaps.Includes(flag) ? "*" : "")}]");
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine();
|
||||||
|
Console.WriteLine($"[1-{i} and enter to toggle, or enter to finish]");
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static MapSelectionFlags GetSelectedMaps(Expansion expansion)
|
||||||
|
{
|
||||||
|
var expansionMaps = ExpansionInfo.GetInfo(expansion).MapSelectionFlags;
|
||||||
|
var selectedMaps = expansionMaps;
|
||||||
|
|
||||||
|
string lastInput;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
OutputSelectedMaps(expansion, selectedMaps);
|
||||||
|
lastInput = Console.ReadLine()?.TrimEnd();
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(lastInput))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!int.TryParse(lastInput, out var selectedNumber))
|
||||||
|
{
|
||||||
|
Console.WriteLine("You need to choose a number, or press ENTER on its own to accept");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedNumber is < 1 or > 31)
|
||||||
|
{
|
||||||
|
Console.WriteLine("That number was not an option. Please try again...");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var selectedFlag = (MapSelectionFlags)(1 << (selectedNumber - 1));
|
||||||
|
|
||||||
|
if (!expansionMaps.Includes(selectedFlag))
|
||||||
|
{
|
||||||
|
Console.WriteLine("That number was not an option. Please try again...");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedMaps.Toggle(selectedFlag);
|
||||||
|
} while (lastInput != "");
|
||||||
|
|
||||||
|
Console.WriteLine("These maps will be populated and moongates will not lead to other maps: ");
|
||||||
|
Utility.PushColor(ConsoleColor.Green);
|
||||||
|
Console.WriteLine(selectedMaps.ToCommaDelimitedString());
|
||||||
|
Utility.PopColor();
|
||||||
|
Console.WriteLine($"To change the selected maps, modify {ExpansionInfo.ExpansionConfigurationPath}.");
|
||||||
|
|
||||||
|
return selectedMaps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -28,56 +28,57 @@ public static class ServerConfiguration
|
||||||
|
|
||||||
private const string _relPath = "Configuration/modernuo.json";
|
private const string _relPath = "Configuration/modernuo.json";
|
||||||
private static readonly string m_FilePath = Path.Join(Core.BaseDirectory, _relPath);
|
private static readonly string m_FilePath = Path.Join(Core.BaseDirectory, _relPath);
|
||||||
private static ServerSettings m_Settings;
|
|
||||||
|
private static ServerSettings _settings;
|
||||||
private static bool m_Mocked;
|
private static bool m_Mocked;
|
||||||
|
|
||||||
public static List<string> AssemblyDirectories => m_Settings.AssemblyDirectories;
|
public static List<string> AssemblyDirectories => _settings.AssemblyDirectories;
|
||||||
|
|
||||||
public static HashSet<string> DataDirectories => m_Settings.DataDirectories;
|
public static HashSet<string> DataDirectories => _settings.DataDirectories;
|
||||||
|
|
||||||
public static List<IPEndPoint> Listeners => m_Settings.Listeners;
|
public static List<IPEndPoint> Listeners => _settings.Listeners;
|
||||||
|
|
||||||
public static string ConfigurationFilePath => _relPath;
|
public static string ConfigurationFilePath => _relPath;
|
||||||
|
|
||||||
public static ClientVersion GetSetting(string key, ClientVersion defaultValue) =>
|
public static ClientVersion GetSetting(string key, ClientVersion defaultValue) =>
|
||||||
m_Settings.Settings.TryGetValue(key, out var value) ? new ClientVersion(value) : defaultValue;
|
_settings.Settings.TryGetValue(key, out var value) ? new ClientVersion(value) : defaultValue;
|
||||||
|
|
||||||
public static string GetSetting(string key, string defaultValue) =>
|
public static string GetSetting(string key, string defaultValue) =>
|
||||||
m_Settings.Settings.TryGetValue(key, out var value) ? value : defaultValue;
|
_settings.Settings.TryGetValue(key, out var value) ? value : defaultValue;
|
||||||
|
|
||||||
public static int GetSetting(string key, int defaultValue)
|
public static int GetSetting(string key, int defaultValue)
|
||||||
{
|
{
|
||||||
m_Settings.Settings.TryGetValue(key, out var strValue);
|
_settings.Settings.TryGetValue(key, out var strValue);
|
||||||
return int.TryParse(strValue, out var value) ? value : defaultValue;
|
return int.TryParse(strValue, out var value) ? value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long GetSetting(string key, long defaultValue)
|
public static long GetSetting(string key, long defaultValue)
|
||||||
{
|
{
|
||||||
m_Settings.Settings.TryGetValue(key, out var strValue);
|
_settings.Settings.TryGetValue(key, out var strValue);
|
||||||
return long.TryParse(strValue, out var value) ? value : defaultValue;
|
return long.TryParse(strValue, out var value) ? value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool GetSetting(string key, bool defaultValue)
|
public static bool GetSetting(string key, bool defaultValue)
|
||||||
{
|
{
|
||||||
m_Settings.Settings.TryGetValue(key, out var strValue);
|
_settings.Settings.TryGetValue(key, out var strValue);
|
||||||
return bool.TryParse(strValue, out var value) ? value : defaultValue;
|
return bool.TryParse(strValue, out var value) ? value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static T GetSetting<T>(string key, T defaultValue) where T : struct, Enum
|
public static T GetSetting<T>(string key, T defaultValue) where T : struct, Enum
|
||||||
{
|
{
|
||||||
m_Settings.Settings.TryGetValue(key, out var strValue);
|
_settings.Settings.TryGetValue(key, out var strValue);
|
||||||
return Enum.TryParse(strValue, out T value) ? value : defaultValue;
|
return Enum.TryParse(strValue, out T value) ? value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double GetSetting(string key, double defaultValue)
|
public static double GetSetting(string key, double defaultValue)
|
||||||
{
|
{
|
||||||
m_Settings.Settings.TryGetValue(key, out var strValue);
|
_settings.Settings.TryGetValue(key, out var strValue);
|
||||||
return double.TryParse(strValue, out var value) ? value : defaultValue;
|
return double.TryParse(strValue, out var value) ? value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static T? GetSetting<T>(string key) where T : struct, Enum
|
public static T? GetSetting<T>(string key) where T : struct, Enum
|
||||||
{
|
{
|
||||||
if (!m_Settings.Settings.TryGetValue(key, out var strValue))
|
if (!_settings.Settings.TryGetValue(key, out var strValue))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +88,7 @@ public static class ServerConfiguration
|
||||||
|
|
||||||
public static string GetOrUpdateSetting(string key, string defaultValue)
|
public static string GetOrUpdateSetting(string key, string defaultValue)
|
||||||
{
|
{
|
||||||
if (m_Settings.Settings.TryGetValue(key, out var value))
|
if (_settings.Settings.TryGetValue(key, out var value))
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
@ -100,7 +101,7 @@ public static class ServerConfiguration
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
if (m_Settings.Settings.TryGetValue(key, out var strValue))
|
if (_settings.Settings.TryGetValue(key, out var strValue))
|
||||||
{
|
{
|
||||||
value = int.TryParse(strValue, out value) ? value : defaultValue;
|
value = int.TryParse(strValue, out value) ? value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
@ -116,7 +117,7 @@ public static class ServerConfiguration
|
||||||
{
|
{
|
||||||
long value;
|
long value;
|
||||||
|
|
||||||
if (m_Settings.Settings.TryGetValue(key, out var strValue))
|
if (_settings.Settings.TryGetValue(key, out var strValue))
|
||||||
{
|
{
|
||||||
value = long.TryParse(strValue, out value) ? value : defaultValue;
|
value = long.TryParse(strValue, out value) ? value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
@ -132,7 +133,7 @@ public static class ServerConfiguration
|
||||||
{
|
{
|
||||||
bool value;
|
bool value;
|
||||||
|
|
||||||
if (m_Settings.Settings.TryGetValue(key, out var strValue))
|
if (_settings.Settings.TryGetValue(key, out var strValue))
|
||||||
{
|
{
|
||||||
value = bool.TryParse(strValue, out value) ? value : defaultValue;
|
value = bool.TryParse(strValue, out value) ? value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
@ -148,7 +149,7 @@ public static class ServerConfiguration
|
||||||
{
|
{
|
||||||
TimeSpan value;
|
TimeSpan value;
|
||||||
|
|
||||||
if (m_Settings.Settings.TryGetValue(key, out var strValue))
|
if (_settings.Settings.TryGetValue(key, out var strValue))
|
||||||
{
|
{
|
||||||
value = TimeSpan.TryParse(strValue, out value) ? value : defaultValue;
|
value = TimeSpan.TryParse(strValue, out value) ? value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +165,7 @@ public static class ServerConfiguration
|
||||||
{
|
{
|
||||||
T value;
|
T value;
|
||||||
|
|
||||||
if (m_Settings.Settings.TryGetValue(key, out var strValue))
|
if (_settings.Settings.TryGetValue(key, out var strValue))
|
||||||
{
|
{
|
||||||
value = Enum.TryParse(strValue, out value) ? value : defaultValue;
|
value = Enum.TryParse(strValue, out value) ? value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
@ -180,7 +181,7 @@ public static class ServerConfiguration
|
||||||
{
|
{
|
||||||
double value;
|
double value;
|
||||||
|
|
||||||
if (m_Settings.Settings.TryGetValue(key, out var strValue))
|
if (_settings.Settings.TryGetValue(key, out var strValue))
|
||||||
{
|
{
|
||||||
value = double.TryParse(strValue, out value) ? value : defaultValue;
|
value = double.TryParse(strValue, out value) ? value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
@ -207,7 +208,7 @@ public static class ServerConfiguration
|
||||||
|
|
||||||
public static void SetSetting(string key, string value)
|
public static void SetSetting(string key, string value)
|
||||||
{
|
{
|
||||||
m_Settings.Settings[key] = value;
|
_settings.Settings[key] = value;
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -220,9 +221,9 @@ public static class ServerConfiguration
|
||||||
if (File.Exists(m_FilePath))
|
if (File.Exists(m_FilePath))
|
||||||
{
|
{
|
||||||
logger.Information("Reading server configuration from {Path}...", _relPath);
|
logger.Information("Reading server configuration from {Path}...", _relPath);
|
||||||
m_Settings = JsonConfig.Deserialize<ServerSettings>(m_FilePath);
|
_settings = JsonConfig.Deserialize<ServerSettings>(m_FilePath);
|
||||||
|
|
||||||
if (m_Settings == null)
|
if (_settings == null)
|
||||||
{
|
{
|
||||||
logger.Error("Reading server configuration failed");
|
logger.Error("Reading server configuration failed");
|
||||||
throw new FileNotFoundException($"Failed to deserialize {m_FilePath}.");
|
throw new FileNotFoundException($"Failed to deserialize {m_FilePath}.");
|
||||||
|
|
@ -233,7 +234,7 @@ public static class ServerConfiguration
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
updated = true;
|
updated = true;
|
||||||
m_Settings = new ServerSettings();
|
_settings = new ServerSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mocked)
|
if (mocked)
|
||||||
|
|
@ -241,12 +242,12 @@ public static class ServerConfiguration
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Settings.DataDirectories.Count == 0)
|
if (_settings.DataDirectories.Count == 0)
|
||||||
{
|
{
|
||||||
updated = true;
|
updated = true;
|
||||||
foreach (var directory in ServerConfigurationPrompts.GetDataDirectories())
|
foreach (var directory in ServerConfigurationPrompts.GetDataDirectories())
|
||||||
{
|
{
|
||||||
m_Settings.DataDirectories.Add(directory);
|
_settings.DataDirectories.Add(directory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -258,19 +259,27 @@ public static class ServerConfiguration
|
||||||
DataDirectories.Add(cuoClientFiles);
|
DataDirectories.Add(cuoClientFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Settings.Listeners.Count == 0)
|
if (_settings.Listeners.Count == 0)
|
||||||
{
|
{
|
||||||
updated = true;
|
updated = true;
|
||||||
m_Settings.Listeners.AddRange(ServerConfigurationPrompts.GetListeners());
|
_settings.Listeners.AddRange(ServerConfigurationPrompts.GetListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Settings.Expansion == null)
|
// We have a known, current expansion, so we can deserialize it from Configuration
|
||||||
|
if (!ExpansionInfo.LoadConfiguration(out var currentExpansion))
|
||||||
{
|
{
|
||||||
m_Settings.Expansion = GetSetting<Expansion>("currentExpansion") ?? ServerConfigurationPrompts.GetExpansion();
|
currentExpansion = (_settings.Data.Remove("expansion", out var el)
|
||||||
|
? el.ToObject<Expansion?>(JsonConfig.DefaultOptions)
|
||||||
|
: null) ?? ExpansionConfigurationPrompts.GetExpansion();
|
||||||
|
|
||||||
|
// We've updated the selected expansion, so choose the maps we want from it, then store and save our selection
|
||||||
|
var selectedMaps = ExpansionConfigurationPrompts.GetSelectedMaps(currentExpansion);
|
||||||
|
ExpansionInfo.StoreMapSelection(selectedMaps, currentExpansion);
|
||||||
|
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core.Expansion = m_Settings.Expansion.Value;
|
Core.Expansion = currentExpansion;
|
||||||
|
|
||||||
if (updated)
|
if (updated)
|
||||||
{
|
{
|
||||||
|
|
@ -279,6 +288,14 @@ public static class ServerConfiguration
|
||||||
Utility.PushColor(ConsoleColor.Green);
|
Utility.PushColor(ConsoleColor.Green);
|
||||||
Console.WriteLine($"{_relPath}.");
|
Console.WriteLine($"{_relPath}.");
|
||||||
Utility.PopColor();
|
Utility.PopColor();
|
||||||
|
|
||||||
|
// Either the expansion.json file has never existed, or it's been deleted, so create it now
|
||||||
|
ExpansionInfo.SaveConfiguration();
|
||||||
|
|
||||||
|
Console.Write("Expansion configuration saved to ");
|
||||||
|
Utility.PushColor(ConsoleColor.Green);
|
||||||
|
Console.WriteLine($"{ExpansionInfo.ExpansionConfigurationPath}.");
|
||||||
|
Utility.PopColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -289,6 +306,6 @@ public static class ServerConfiguration
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonConfig.Serialize(m_FilePath, m_Settings);
|
JsonConfig.Serialize(m_FilePath, _settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
|
|
@ -83,53 +82,6 @@ public static class ServerConfigurationPrompts
|
||||||
} while (true);
|
} while (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Expansion GetExpansion()
|
|
||||||
{
|
|
||||||
Console.WriteLine("Please choose an expansion by typing the number or short name:");
|
|
||||||
var expansions = ExpansionInfo.Table;
|
|
||||||
|
|
||||||
for (int i = 0; i < expansions.Length; i++)
|
|
||||||
{
|
|
||||||
var info = expansions[i];
|
|
||||||
Console.WriteLine(" - {0,2}: {1} ({2})", i, ((Expansion)info.ID).ToString(), info.Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
var maxExpansion = (Expansion)expansions[^1].ID;
|
|
||||||
var maxExpansionName = maxExpansion.ToString();
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Console.Write("[enter for {0}]> ", maxExpansionName);
|
|
||||||
var input = Console.ReadLine();
|
|
||||||
Expansion expansion;
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(input))
|
|
||||||
{
|
|
||||||
expansion = maxExpansion;
|
|
||||||
}
|
|
||||||
else if (int.TryParse(input, NumberStyles.Integer, null, out var number) &&
|
|
||||||
number >= 0 && number < expansions.Length)
|
|
||||||
{
|
|
||||||
expansion = (Expansion)number;
|
|
||||||
}
|
|
||||||
else if (!Enum.TryParse(input, out expansion))
|
|
||||||
{
|
|
||||||
Utility.PushColor(ConsoleColor.Red);
|
|
||||||
Console.Write(input);
|
|
||||||
Utility.PopColor();
|
|
||||||
Console.WriteLine(" is an invalid expansion option.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.Write("Expansion set to ");
|
|
||||||
Utility.PushColor(ConsoleColor.Green);
|
|
||||||
Console.Write(ExpansionInfo.GetInfo(expansion).Name);
|
|
||||||
Utility.PopColor();
|
|
||||||
Console.WriteLine(".");
|
|
||||||
return expansion;
|
|
||||||
} while (true);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static List<string> GetDataDirectories()
|
internal static List<string> GetDataDirectories()
|
||||||
{
|
{
|
||||||
Console.WriteLine("Please enter the absolute path to your ClassicUO or Ultima Online data:");
|
Console.WriteLine("Please enter the absolute path to your ClassicUO or Ultima Online data:");
|
||||||
|
|
@ -214,7 +166,6 @@ public static class ServerConfigurationPrompts
|
||||||
Utility.PopColor();
|
Utility.PopColor();
|
||||||
Console.WriteLine(".");
|
Console.WriteLine(".");
|
||||||
} while (true);
|
} while (true);
|
||||||
|
|
||||||
return ips;
|
return ips;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Server;
|
namespace Server;
|
||||||
|
|
@ -30,9 +31,10 @@ public class ServerSettings
|
||||||
[JsonPropertyName("listeners")]
|
[JsonPropertyName("listeners")]
|
||||||
public List<IPEndPoint> Listeners { get; set; } = new();
|
public List<IPEndPoint> Listeners { get; set; } = new();
|
||||||
|
|
||||||
[JsonPropertyName("expansion")]
|
|
||||||
public Expansion? Expansion { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("settings")]
|
[JsonPropertyName("settings")]
|
||||||
public SortedDictionary<string, string> Settings { get; set; } = new();
|
public SortedDictionary<string, string> Settings { get; set; } = new();
|
||||||
|
|
||||||
|
// For backward compatibility
|
||||||
|
[JsonExtensionData]
|
||||||
|
public Dictionary<string, JsonElement> Data { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,10 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using Server.Json;
|
using Server.Json;
|
||||||
|
using Server.Maps;
|
||||||
|
|
||||||
namespace Server;
|
namespace Server;
|
||||||
|
|
||||||
|
|
@ -158,7 +158,10 @@ public enum HousingFlags
|
||||||
|
|
||||||
public class ExpansionInfo
|
public class ExpansionInfo
|
||||||
{
|
{
|
||||||
|
public const string ExpansionConfigurationPath = "Configuration/expansion.json";
|
||||||
|
|
||||||
public static bool ForceOldAnimations { get; private set; }
|
public static bool ForceOldAnimations { get; private set; }
|
||||||
|
|
||||||
public static void Configure()
|
public static void Configure()
|
||||||
{
|
{
|
||||||
ForceOldAnimations = ServerConfiguration.GetSetting("expansion.forceOldAnimations", false);
|
ForceOldAnimations = ServerConfiguration.GetSetting("expansion.forceOldAnimations", false);
|
||||||
|
|
@ -188,46 +191,44 @@ public class ExpansionInfo
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void StoreMapSelection(MapSelectionFlags mapSelectionFlags, Expansion expansion)
|
||||||
|
{
|
||||||
|
int expansionIndex = (int)expansion;
|
||||||
|
Table[expansionIndex].MapSelectionFlags = mapSelectionFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SaveConfiguration()
|
||||||
|
{
|
||||||
|
var pathToExpansionFile = Path.Combine(Core.BaseDirectory, ExpansionConfigurationPath);
|
||||||
|
JsonConfig.Serialize(pathToExpansionFile, GetInfo(Core.Expansion));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool LoadConfiguration(out Expansion expansion)
|
||||||
|
{
|
||||||
|
var pathToExpansionFile = Path.Combine(Core.BaseDirectory, ExpansionConfigurationPath);
|
||||||
|
|
||||||
|
ExpansionInfo expansionConfig = JsonConfig.Deserialize<ExpansionInfo>(pathToExpansionFile);
|
||||||
|
if (expansionConfig == null)
|
||||||
|
{
|
||||||
|
expansion = Expansion.None;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int currentExpansionIndex = expansionConfig.Id;
|
||||||
|
Table[currentExpansionIndex] = expansionConfig;
|
||||||
|
expansion = (Expansion)currentExpansionIndex;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static ExpansionInfo()
|
static ExpansionInfo()
|
||||||
{
|
{
|
||||||
var path = Path.Combine(Core.BaseDirectory, "Data/expansion.json");
|
var path = Path.Combine(Core.BaseDirectory, "Data/expansions.json");
|
||||||
if (!File.Exists(path))
|
if (!File.Exists(path))
|
||||||
{
|
{
|
||||||
throw new FileNotFoundException($"Expansion file '{path}' could not be found.");
|
throw new FileNotFoundException($"Expansion file '{path}' could not be found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var expansions = JsonConfig.Deserialize<List<ExpansionConfig>>(path);
|
Table = JsonConfig.Deserialize<ExpansionInfo[]>(path);
|
||||||
|
|
||||||
Table = new ExpansionInfo[expansions.Count];
|
|
||||||
|
|
||||||
for (var i = 0; i < expansions.Count; i++)
|
|
||||||
{
|
|
||||||
var expansion = expansions[i];
|
|
||||||
if (expansion.ClientVersion != null)
|
|
||||||
{
|
|
||||||
Table[i] = new ExpansionInfo(
|
|
||||||
i,
|
|
||||||
expansion.Name,
|
|
||||||
expansion.ClientVersion,
|
|
||||||
expansion.FeatureFlags,
|
|
||||||
expansion.CharacterListFlags,
|
|
||||||
expansion.HousingFlags,
|
|
||||||
expansion.MobileStatusVersion
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Table[i] = new ExpansionInfo(
|
|
||||||
i,
|
|
||||||
expansion.Name,
|
|
||||||
expansion.ClientFlags ?? ClientFlags.None,
|
|
||||||
expansion.FeatureFlags,
|
|
||||||
expansion.CharacterListFlags,
|
|
||||||
expansion.HousingFlags,
|
|
||||||
expansion.MobileStatusVersion
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExpansionInfo(
|
public ExpansionInfo(
|
||||||
|
|
@ -237,8 +238,9 @@ public class ExpansionInfo
|
||||||
FeatureFlags supportedFeatures,
|
FeatureFlags supportedFeatures,
|
||||||
CharacterListFlags charListFlags,
|
CharacterListFlags charListFlags,
|
||||||
HousingFlags customHousingFlag,
|
HousingFlags customHousingFlag,
|
||||||
int mobileStatusVersion
|
int mobileStatusVersion,
|
||||||
) : this(id, name, supportedFeatures, charListFlags, customHousingFlag, mobileStatusVersion) =>
|
MapSelectionFlags mapSelectionFlags
|
||||||
|
) : this(id, name, supportedFeatures, charListFlags, customHousingFlag, mobileStatusVersion, mapSelectionFlags) =>
|
||||||
ClientFlags = clientFlags;
|
ClientFlags = clientFlags;
|
||||||
|
|
||||||
public ExpansionInfo(
|
public ExpansionInfo(
|
||||||
|
|
@ -248,41 +250,54 @@ public class ExpansionInfo
|
||||||
FeatureFlags supportedFeatures,
|
FeatureFlags supportedFeatures,
|
||||||
CharacterListFlags charListFlags,
|
CharacterListFlags charListFlags,
|
||||||
HousingFlags customHousingFlag,
|
HousingFlags customHousingFlag,
|
||||||
int mobileStatusVersion
|
int mobileStatusVersion,
|
||||||
) : this(id, name, supportedFeatures, charListFlags, customHousingFlag, mobileStatusVersion) =>
|
MapSelectionFlags mapSelectionFlags
|
||||||
|
) : this(id, name, supportedFeatures, charListFlags, customHousingFlag, mobileStatusVersion, mapSelectionFlags) =>
|
||||||
RequiredClient = requiredClient;
|
RequiredClient = requiredClient;
|
||||||
|
|
||||||
private ExpansionInfo(
|
[JsonConstructor]
|
||||||
|
public ExpansionInfo(
|
||||||
int id,
|
int id,
|
||||||
string name,
|
string name,
|
||||||
FeatureFlags supportedFeatures,
|
FeatureFlags supportedFeatures,
|
||||||
CharacterListFlags charListFlags,
|
CharacterListFlags characterListFlags,
|
||||||
HousingFlags customHousingFlag,
|
HousingFlags housingFlags,
|
||||||
int mobileStatusVersion
|
int mobileStatusVersion,
|
||||||
|
MapSelectionFlags mapSelectionFlags
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ID = id;
|
Id = id;
|
||||||
Name = name;
|
Name = name;
|
||||||
|
|
||||||
SupportedFeatures = supportedFeatures;
|
SupportedFeatures = supportedFeatures;
|
||||||
CharacterListFlags = charListFlags;
|
CharacterListFlags = characterListFlags;
|
||||||
CustomHousingFlag = customHousingFlag;
|
HousingFlags = housingFlags;
|
||||||
MobileStatusVersion = mobileStatusVersion;
|
MobileStatusVersion = mobileStatusVersion;
|
||||||
|
MapSelectionFlags = mapSelectionFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ExpansionInfo CoreExpansion => GetInfo(Core.Expansion);
|
public static ExpansionInfo CoreExpansion => GetInfo(Core.Expansion);
|
||||||
|
|
||||||
public static ExpansionInfo[] Table { get; }
|
public static ExpansionInfo[] Table { get; }
|
||||||
|
|
||||||
public int ID { get; }
|
public int Id { get; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public ClientFlags ClientFlags { get; set; }
|
public ClientFlags ClientFlags { get; set; }
|
||||||
|
|
||||||
|
[JsonConverter(typeof(FlagsConverter<FeatureFlags>))]
|
||||||
public FeatureFlags SupportedFeatures { get; set; }
|
public FeatureFlags SupportedFeatures { get; set; }
|
||||||
|
|
||||||
|
[JsonConverter(typeof(FlagsConverter<CharacterListFlags>))]
|
||||||
public CharacterListFlags CharacterListFlags { get; set; }
|
public CharacterListFlags CharacterListFlags { get; set; }
|
||||||
public ClientVersion RequiredClient { get; set; }
|
public ClientVersion RequiredClient { get; set; }
|
||||||
public HousingFlags CustomHousingFlag { get; set; }
|
|
||||||
|
[JsonConverter(typeof(FlagsConverter<HousingFlags>))]
|
||||||
|
public HousingFlags HousingFlags { get; set; }
|
||||||
public int MobileStatusVersion { get; set; }
|
public int MobileStatusVersion { get; set; }
|
||||||
|
|
||||||
|
[JsonConverter(typeof(FlagsConverter<MapSelectionFlags>))]
|
||||||
|
public MapSelectionFlags MapSelectionFlags { get; set; }
|
||||||
|
|
||||||
public static ExpansionInfo GetInfo(Expansion ex) => GetInfo((int)ex);
|
public static ExpansionInfo GetInfo(Expansion ex) => GetInfo((int)ex);
|
||||||
|
|
||||||
public static ExpansionInfo GetInfo(int ex)
|
public static ExpansionInfo GetInfo(int ex)
|
||||||
|
|
@ -299,23 +314,3 @@ public class ExpansionInfo
|
||||||
|
|
||||||
public override string ToString() => Name;
|
public override string ToString() => Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public record ExpansionConfig
|
|
||||||
{
|
|
||||||
public string Name { get; init; }
|
|
||||||
|
|
||||||
public ClientVersion? ClientVersion { get; init; }
|
|
||||||
|
|
||||||
public ClientFlags? ClientFlags { get; init; }
|
|
||||||
|
|
||||||
[JsonConverter(typeof(FlagsConverter<FeatureFlags>))]
|
|
||||||
public FeatureFlags FeatureFlags { get; init; }
|
|
||||||
|
|
||||||
[JsonConverter(typeof(FlagsConverter<CharacterListFlags>))]
|
|
||||||
public CharacterListFlags CharacterListFlags { get; init; }
|
|
||||||
|
|
||||||
[JsonConverter(typeof(FlagsConverter<HousingFlags>))]
|
|
||||||
public HousingFlags HousingFlags { get; init; }
|
|
||||||
|
|
||||||
public int MobileStatusVersion { get; set; }
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -17,28 +17,27 @@ using System;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Server.Json
|
namespace Server.Json;
|
||||||
{
|
|
||||||
public class TextDefinitionConverter : JsonConverter<TextDefinition>
|
|
||||||
{
|
|
||||||
public override TextDefinition Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
|
|
||||||
reader.TokenType switch
|
|
||||||
{
|
|
||||||
JsonTokenType.String => TextDefinition.Of(reader.GetString()),
|
|
||||||
JsonTokenType.Number => TextDefinition.Of(reader.GetInt32()),
|
|
||||||
_ => throw new JsonException("TextDefinition value must be an integer or string")
|
|
||||||
};
|
|
||||||
|
|
||||||
public override void Write(Utf8JsonWriter writer, TextDefinition value, JsonSerializerOptions options)
|
public class TextDefinitionConverter : JsonConverter<TextDefinition>
|
||||||
|
{
|
||||||
|
public override TextDefinition Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
|
||||||
|
reader.TokenType switch
|
||||||
{
|
{
|
||||||
if (value.Number > 0)
|
JsonTokenType.String => TextDefinition.Of(reader.GetString()),
|
||||||
{
|
JsonTokenType.Number => TextDefinition.Of(reader.GetInt32()),
|
||||||
writer.WriteNumberValue(value.Number);
|
_ => throw new JsonException("TextDefinition value must be an integer or string")
|
||||||
}
|
};
|
||||||
else
|
|
||||||
{
|
public override void Write(Utf8JsonWriter writer, TextDefinition value, JsonSerializerOptions options)
|
||||||
writer.WriteStringValue(value.String);
|
{
|
||||||
}
|
if (value.Number > 0)
|
||||||
|
{
|
||||||
|
writer.WriteNumberValue(value.Number);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writer.WriteStringValue(value.String);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -17,13 +17,12 @@ using System;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Server.Json
|
namespace Server.Json;
|
||||||
{
|
|
||||||
public class TextDefinitionConverterFactory : JsonConverterFactory
|
|
||||||
{
|
|
||||||
public override bool CanConvert(Type typeToConvert) => typeToConvert == typeof(TextDefinition);
|
|
||||||
|
|
||||||
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options) =>
|
public class TextDefinitionConverterFactory : JsonConverterFactory
|
||||||
new TextDefinitionConverter();
|
{
|
||||||
}
|
public override bool CanConvert(Type typeToConvert) => typeToConvert == typeof(TextDefinition);
|
||||||
}
|
|
||||||
|
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options) =>
|
||||||
|
new TextDefinitionConverter();
|
||||||
|
}
|
||||||
|
|
@ -17,6 +17,7 @@ using System;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Server.Buffers;
|
using Server.Buffers;
|
||||||
|
using Server.Text;
|
||||||
using Server.Collections;
|
using Server.Collections;
|
||||||
|
|
||||||
namespace Server;
|
namespace Server;
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@ using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Server.Buffers;
|
|
||||||
using Server.Json;
|
using Server.Json;
|
||||||
using Server.Logging;
|
using Server.Logging;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server;
|
namespace Server;
|
||||||
|
|
||||||
|
|
@ -227,7 +227,6 @@ public static class Core
|
||||||
public static int ScriptMobiles => _mobileCount;
|
public static int ScriptMobiles => _mobileCount;
|
||||||
|
|
||||||
public static Expansion Expansion { get; set; }
|
public static Expansion Expansion { get; set; }
|
||||||
|
|
||||||
public static bool T2A => Expansion >= Expansion.T2A;
|
public static bool T2A => Expansion >= Expansion.T2A;
|
||||||
|
|
||||||
public static bool UOR => Expansion >= Expansion.UOR;
|
public static bool UOR => Expansion >= Expansion.UOR;
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,6 @@ public sealed class Map : IComparable<Map>, ISpanFormattable, ISpanParsable<Map>
|
||||||
public const int SectorActiveRange = 2;
|
public const int SectorActiveRange = 2;
|
||||||
|
|
||||||
private static ILogger logger = LogFactory.GetLogger(typeof(Map));
|
private static ILogger logger = LogFactory.GetLogger(typeof(Map));
|
||||||
|
|
||||||
private readonly int m_FileIndex;
|
private readonly int m_FileIndex;
|
||||||
private readonly Sector[][] m_Sectors;
|
private readonly Sector[][] m_Sectors;
|
||||||
private readonly int m_SectorsHeight;
|
private readonly int m_SectorsHeight;
|
||||||
|
|
|
||||||
113
Projects/Server/Maps/MapSelection.cs
Normal file
113
Projects/Server/Maps/MapSelection.cs
Normal file
|
|
@ -0,0 +1,113 @@
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Server.Text;
|
||||||
|
|
||||||
|
namespace Server.Maps;
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum MapSelectionFlags
|
||||||
|
{
|
||||||
|
Felucca = 0x00000001,
|
||||||
|
Trammel = 0x00000002,
|
||||||
|
Ilshenar = 0x00000004,
|
||||||
|
Malas = 0x00000008,
|
||||||
|
Tokuno = 0x00000010,
|
||||||
|
TerMur = 0x00000020
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MapSelection
|
||||||
|
{
|
||||||
|
public static MapSelectionFlags[] MapSelectionValues { get; } = Enum.GetValues<MapSelectionFlags>();
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static bool Includes(this MapSelectionFlags flags, MapSelectionFlags flag) => (flags & flag) == flag;
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static void Toggle(this ref MapSelectionFlags flags, MapSelectionFlags flag)
|
||||||
|
{
|
||||||
|
flags ^= flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static void Enable(this ref MapSelectionFlags flags, MapSelectionFlags flag)
|
||||||
|
{
|
||||||
|
flags |= flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static void Disable(this ref MapSelectionFlags flags, MapSelectionFlags flag)
|
||||||
|
{
|
||||||
|
flags &= ~flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToCommaDelimitedString(this MapSelectionFlags flags)
|
||||||
|
{
|
||||||
|
using var builder = ValueStringBuilder.Create();
|
||||||
|
|
||||||
|
foreach (var flag in flags.GetEnumerable())
|
||||||
|
{
|
||||||
|
builder.Append(builder.Length > 0 ? $", {flag}" : $"{flag}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.Length == 0 ? "None" : builder.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MapSelectionFlags ToSelectionFlag(this Map map) => (MapSelectionFlags)(1 << map.MapID);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static MapSelectionEnumerable GetEnumerable(this MapSelectionFlags flags) => new(flags);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static MapSelectionEnumerable EnumFromExpansion(Expansion expansion) => ExpansionInfo.GetInfo(expansion).MapSelectionFlags.GetEnumerable();
|
||||||
|
|
||||||
|
public class MapSelectionEnumerable
|
||||||
|
{
|
||||||
|
private readonly MapSelectionFlags _flags;
|
||||||
|
|
||||||
|
public MapSelectionEnumerable(MapSelectionFlags flags) => _flags = flags;
|
||||||
|
|
||||||
|
public MapSelectionEnumerator GetEnumerator() => new(MapSelectionValues, _flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ref struct MapSelectionEnumerator
|
||||||
|
{
|
||||||
|
private readonly MapSelectionFlags[] _allMaps;
|
||||||
|
private readonly MapSelectionFlags _mapSelections;
|
||||||
|
private int _index;
|
||||||
|
private MapSelectionFlags _current;
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
internal MapSelectionEnumerator(MapSelectionFlags[] allMaps, MapSelectionFlags mapSelections)
|
||||||
|
{
|
||||||
|
_allMaps = allMaps;
|
||||||
|
_mapSelections = mapSelections;
|
||||||
|
_index = 0;
|
||||||
|
_current = default;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool MoveNext()
|
||||||
|
{
|
||||||
|
MapSelectionFlags[] localList = _allMaps;
|
||||||
|
|
||||||
|
while ((uint)_index < (uint)localList.Length)
|
||||||
|
{
|
||||||
|
_current = localList[_index++];
|
||||||
|
|
||||||
|
if ((_mapSelections & _current) == _current)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapSelectionFlags Current
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
get => _current;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -2,7 +2,6 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using Server.Accounting;
|
using Server.Accounting;
|
||||||
using Server.Buffers;
|
|
||||||
using Server.ContextMenus;
|
using Server.ContextMenus;
|
||||||
using Server.Guilds;
|
using Server.Guilds;
|
||||||
using Server.Gumps;
|
using Server.Gumps;
|
||||||
|
|
@ -14,6 +13,7 @@ using Server.Mobiles;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
using Server.Prompts;
|
using Server.Prompts;
|
||||||
using Server.Targeting;
|
using Server.Targeting;
|
||||||
|
using Server.Text;
|
||||||
using Server.Utilities;
|
using Server.Utilities;
|
||||||
using CalcMoves = Server.Movement.Movement;
|
using CalcMoves = Server.Movement.Movement;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ public partial class NetState
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SupportsExpansion(ExpansionInfo info, bool checkCoreExpansion = true) =>
|
public bool SupportsExpansion(ExpansionInfo info, bool checkCoreExpansion = true) =>
|
||||||
info != null && (!checkCoreExpansion || (int)Core.Expansion >= info.ID) && ExpansionInfo.ID >= info.ID;
|
info != null && (!checkCoreExpansion || (int)Core.Expansion >= info.Id) && ExpansionInfo.Id >= info.Id;
|
||||||
|
|
||||||
public bool SupportsExpansion(Expansion ex, bool checkCoreExpansion = true) =>
|
public bool SupportsExpansion(Expansion ex, bool checkCoreExpansion = true) =>
|
||||||
SupportsExpansion(ExpansionInfo.GetInfo(ex), checkCoreExpansion);
|
SupportsExpansion(ExpansionInfo.GetInfo(ex), checkCoreExpansion);
|
||||||
|
|
|
||||||
|
|
@ -463,7 +463,7 @@ public static class OutgoingMobilePackets
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var maxVersion = ExpansionInfo.CoreExpansion.MobileStatusVersion;
|
var maxVersion = ExpansionInfo.CoreExpansion.MobileStatusVersion;
|
||||||
var nsExpansion = (Expansion)ns.ExpansionInfo.ID;
|
var nsExpansion = (Expansion)ns.ExpansionInfo.Id;
|
||||||
|
|
||||||
if (maxVersion >= 6 && nsExpansion >= Expansion.HS && ns.ExtendedStatus)
|
if (maxVersion >= 6 && nsExpansion >= Expansion.HS && ns.ExtendedStatus)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using Server.Json;
|
using Server.Json;
|
||||||
using Server.Logging;
|
using Server.Logging;
|
||||||
|
|
|
||||||
|
|
@ -860,7 +860,7 @@ public class Skills
|
||||||
|
|
||||||
while ((uint)_index < (uint)localList.Length)
|
while ((uint)_index < (uint)localList.Length)
|
||||||
{
|
{
|
||||||
_current = _skills[_index++];
|
_current = localList[_index++];
|
||||||
if (_current != null)
|
if (_current != null)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Server.Buffers;
|
|
||||||
|
|
||||||
namespace Server.Text;
|
namespace Server.Text;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Server.Misc;
|
using Server.Misc;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1192,7 +1192,7 @@ namespace Server.Accounting
|
||||||
|
|
||||||
while ((uint)_index < (uint)localList.Length)
|
while ((uint)_index < (uint)localList.Length)
|
||||||
{
|
{
|
||||||
_current = _mobiles[_index++];
|
_current = localList[_index++];
|
||||||
if (_current?.Deleted == false)
|
if (_current?.Deleted == false)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Server.Buffers;
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server.Commands.Generic
|
namespace Server.Commands.Generic
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Server.Buffers;
|
|
||||||
using Server.Commands;
|
using Server.Commands;
|
||||||
using Server.Commands.Generic;
|
using Server.Commands.Generic;
|
||||||
using Server.Gumps;
|
using Server.Gumps;
|
||||||
using Server.Targeting;
|
using Server.Targeting;
|
||||||
|
using Server.Text;
|
||||||
using CPA = Server.CommandPropertyAttribute;
|
using CPA = Server.CommandPropertyAttribute;
|
||||||
|
|
||||||
using static Server.Attributes;
|
using static Server.Attributes;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using Server.Buffers;
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server.Compression
|
namespace Server.Compression
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using Server.Buffers;
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server.Ethics.Evil
|
namespace Server.Ethics.Evil
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using Server.Buffers;
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server.Ethics.Hero
|
namespace Server.Ethics.Hero
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,11 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Server.Buffers;
|
|
||||||
using Server.Commands.Generic;
|
using Server.Commands.Generic;
|
||||||
using Server.Engines.Spawners;
|
using Server.Engines.Spawners;
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
using Server.Text;
|
||||||
using CPA = Server.CommandPropertyAttribute;
|
using CPA = Server.CommandPropertyAttribute;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using Server.Mobiles;
|
|
||||||
|
|
||||||
namespace Server.Engines.Spawners
|
namespace Server.Engines.Spawners
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,14 @@ using System.Net;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Server.Accounting;
|
using Server.Accounting;
|
||||||
using Server.Buffers;
|
|
||||||
using Server.Collections;
|
using Server.Collections;
|
||||||
using Server.Commands;
|
using Server.Commands;
|
||||||
|
using Server.Maps;
|
||||||
using Server.Misc;
|
using Server.Misc;
|
||||||
using Server.Multis;
|
using Server.Multis;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
using Server.Prompts;
|
using Server.Prompts;
|
||||||
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
{
|
{
|
||||||
|
|
@ -2085,29 +2086,37 @@ namespace Server.Gumps
|
||||||
}
|
}
|
||||||
case 103:
|
case 103:
|
||||||
{
|
{
|
||||||
if (Core.SA)
|
var folder = Core.SA ? "post-uoml" : "uoml";
|
||||||
|
|
||||||
|
var availableMaps = ExpansionInfo.CoreExpansion.MapSelectionFlags;
|
||||||
|
if (Core.SA && availableMaps.Includes(MapSelectionFlags.TerMur))
|
||||||
{
|
{
|
||||||
InvokeCommand("GenerateSpawners Data/Spawns/post-uoml/*/*.json");
|
InvokeCommand($"GenerateSpawners Data/Spawns/post-uoml/termur/*.json");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (availableMaps.Includes(MapSelectionFlags.Malas))
|
||||||
{
|
{
|
||||||
if (Core.ML)
|
InvokeCommand($"GenerateSpawners Data/Spawns/{folder}/malas/*.json");
|
||||||
{
|
}
|
||||||
InvokeCommand("GenerateSpawners Data/Spawns/uoml/malas/*.json");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Core.SE)
|
if (availableMaps.Includes(MapSelectionFlags.Tokuno))
|
||||||
{
|
{
|
||||||
InvokeCommand("GenerateSpawners Data/Spawns/uoml/tokuno/*.json");
|
InvokeCommand($"GenerateSpawners Data/Spawns/{folder}/tokuno/*.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Core.AOS)
|
if (availableMaps.Includes(MapSelectionFlags.Ilshenar))
|
||||||
{
|
{
|
||||||
InvokeCommand("GenerateSpawners Data/Spawns/uoml/ilshenar/*.json");
|
InvokeCommand($"GenerateSpawners Data/Spawns/{folder}/ilshenar/*.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
InvokeCommand("GenerateSpawners Data/Spawns/uoml/trammel/*.json");
|
if (availableMaps.Includes(MapSelectionFlags.Trammel))
|
||||||
InvokeCommand("GenerateSpawners Data/Spawns/uoml/felucca/*.json");
|
{
|
||||||
|
InvokeCommand($"GenerateSpawners Data/Spawns/{folder}/trammel/*.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (availableMaps.Includes(MapSelectionFlags.Felucca))
|
||||||
|
{
|
||||||
|
InvokeCommand($"GenerateSpawners Data/Spawns/{folder}/felucca/*.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
notice = "Spawners have been generated.";
|
notice = "Spawners have been generated.";
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using ModernUO.Serialization;
|
using ModernUO.Serialization;
|
||||||
using Server.Buffers;
|
|
||||||
using Server.ContextMenus;
|
using Server.ContextMenus;
|
||||||
using Server.Gumps;
|
using Server.Gumps;
|
||||||
using Server.Multis;
|
using Server.Multis;
|
||||||
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server.Items
|
namespace Server.Items
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using ModernUO.Serialization;
|
using ModernUO.Serialization;
|
||||||
|
using Server.Collections;
|
||||||
using Server.Factions;
|
using Server.Factions;
|
||||||
using Server.Gumps;
|
using Server.Gumps;
|
||||||
|
using Server.Maps;
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
using Server.Spells;
|
using Server.Spells;
|
||||||
|
|
@ -105,11 +107,11 @@ public partial class PublicMoongate : Item
|
||||||
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
||||||
count += MoonGen(PMList.Trammel);
|
count += MoonGen(PMList.Trammel, MapSelectionFlags.Trammel);
|
||||||
count += MoonGen(PMList.Felucca);
|
count += MoonGen(PMList.Felucca, MapSelectionFlags.Felucca);
|
||||||
count += MoonGen(PMList.Ilshenar);
|
count += MoonGen(PMList.Ilshenar, MapSelectionFlags.Ilshenar);
|
||||||
count += MoonGen(PMList.Malas);
|
count += MoonGen(PMList.Malas, MapSelectionFlags.Malas);
|
||||||
count += MoonGen(PMList.Tokuno);
|
count += MoonGen(PMList.Tokuno, MapSelectionFlags.Tokuno);
|
||||||
|
|
||||||
World.Broadcast(0x35, true, $"{count} moongates generated.");
|
World.Broadcast(0x35, true, $"{count} moongates generated.");
|
||||||
}
|
}
|
||||||
|
|
@ -137,8 +139,13 @@ public partial class PublicMoongate : Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int MoonGen(PMList list)
|
private static int MoonGen(PMList list, MapSelectionFlags flag)
|
||||||
{
|
{
|
||||||
|
if (!ExpansionInfo.CoreExpansion.MapSelectionFlags.Includes(flag))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var entry in list.Entries)
|
foreach (var entry in list.Entries)
|
||||||
{
|
{
|
||||||
Item item = new PublicMoongate();
|
Item item = new PublicMoongate();
|
||||||
|
|
@ -355,11 +362,23 @@ public class MoongateGump : Gump
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
_lists = new PMList[checkLists.Length];
|
var availableMaps = ExpansionInfo.CoreExpansion.MapSelectionFlags;
|
||||||
|
using var filteredBySelectedMaps = PooledRefList<PMList>.Create();
|
||||||
|
|
||||||
for (var i = 0; i < _lists.Length; ++i)
|
for (var i = 0; i < checkLists.Length; ++i)
|
||||||
{
|
{
|
||||||
_lists[i] = checkLists[i];
|
var pmList = checkLists[i];
|
||||||
|
if (availableMaps.Includes(pmList.Map.ToSelectionFlag()))
|
||||||
|
{
|
||||||
|
filteredBySelectedMaps.Add(pmList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int mapCount = filteredBySelectedMaps.Count;
|
||||||
|
_lists = new PMList[mapCount];
|
||||||
|
for (var i = 0; i < mapCount; i++)
|
||||||
|
{
|
||||||
|
_lists[i] = filteredBySelectedMaps[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < _lists.Length; ++i)
|
for (var i = 0; i < _lists.Length; ++i)
|
||||||
|
|
@ -383,15 +402,15 @@ public class MoongateGump : Gump
|
||||||
|
|
||||||
AddHtmlLocalized(5, 5, 200, 20, 1012011); // Pick your destination:
|
AddHtmlLocalized(5, 5, 200, 20, 1012011); // Pick your destination:
|
||||||
|
|
||||||
for (var i = 0; i < checkLists.Length; ++i)
|
for (var i = 0; i < filteredBySelectedMaps.Count; ++i)
|
||||||
{
|
{
|
||||||
AddButton(10, 35 + i * 25, 2117, 2118, 0, GumpButtonType.Page, Array.IndexOf(_lists, checkLists[i]) + 1);
|
AddButton(10, 35 + i * 25, 2117, 2118, 0, GumpButtonType.Page, Array.IndexOf(_lists, filteredBySelectedMaps[i]) + 1);
|
||||||
AddHtmlLocalized(30, 35 + i * 25, 150, 20, checkLists[i].Number);
|
AddHtmlLocalized(30, 35 + i * 25, 150, 20, filteredBySelectedMaps[i].Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < _lists.Length; ++i)
|
for (var i = 0; i < _lists.Length; ++i)
|
||||||
{
|
{
|
||||||
RenderPage(i, Array.IndexOf(checkLists, _lists[i]));
|
RenderPage(i, filteredBySelectedMaps.IndexOf(_lists[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using ModernUO.Serialization;
|
using ModernUO.Serialization;
|
||||||
using Server.Buffers;
|
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
using Server.Spells;
|
using Server.Spells;
|
||||||
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server.Items;
|
namespace Server.Items;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@ using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using ModernUO.Serialization;
|
using ModernUO.Serialization;
|
||||||
using Server.Accounting;
|
using Server.Accounting;
|
||||||
using Server.Buffers;
|
|
||||||
using Server.ContextMenus;
|
using Server.ContextMenus;
|
||||||
using Server.Gumps;
|
using Server.Gumps;
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
using Server.Regions;
|
using Server.Regions;
|
||||||
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server.Items;
|
namespace Server.Items;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using System.Runtime.CompilerServices;
|
||||||
using Server.Accounting;
|
using Server.Accounting;
|
||||||
using Server.Items;
|
using Server.Items;
|
||||||
using Server.Logging;
|
using Server.Logging;
|
||||||
|
using Server.Maps;
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
|
|
@ -197,7 +198,6 @@ public static class CharacterCreation
|
||||||
}
|
}
|
||||||
|
|
||||||
var city = GetStartLocation(args, young);
|
var city = GetStartLocation(args, young);
|
||||||
|
|
||||||
newChar.MoveToWorld(city.Location, city.Map);
|
newChar.MoveToWorld(city.Location, city.Map);
|
||||||
|
|
||||||
logger.Information(
|
logger.Information(
|
||||||
|
|
@ -218,11 +218,13 @@ public static class CharacterCreation
|
||||||
|
|
||||||
private static CityInfo GetStartLocation(CharacterCreatedEventArgs args, bool isYoung)
|
private static CityInfo GetStartLocation(CharacterCreatedEventArgs args, bool isYoung)
|
||||||
{
|
{
|
||||||
|
// We don't get the actual client version until after character creation
|
||||||
var post6000Supported = !TileMatrix.Pre6000ClientSupport;
|
var post6000Supported = !TileMatrix.Pre6000ClientSupport;
|
||||||
|
var availableMaps = ExpansionInfo.CoreExpansion.MapSelectionFlags;
|
||||||
|
|
||||||
if (Core.ML && post6000Supported)
|
if (Core.ML && post6000Supported && availableMaps.Includes(MapSelectionFlags.Trammel))
|
||||||
{
|
{
|
||||||
return _newHavenInfo; // We don't get the client Version until AFTER Character creation
|
return _newHavenInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
var useHaven = isYoung;
|
var useHaven = isYoung;
|
||||||
|
|
@ -236,7 +238,7 @@ public static class CharacterCreation
|
||||||
{
|
{
|
||||||
case "necromancer":
|
case "necromancer":
|
||||||
{
|
{
|
||||||
if ((flags & ClientFlags.Malas) != 0)
|
if ((flags & ClientFlags.Malas) != 0 && availableMaps.Includes(MapSelectionFlags.Malas))
|
||||||
{
|
{
|
||||||
return new CityInfo("Umbra", "Mardoth's Tower", 2114, 1301, -50, Map.Malas);
|
return new CityInfo("Umbra", "Mardoth's Tower", 2114, 1301, -50, Map.Malas);
|
||||||
}
|
}
|
||||||
|
|
@ -256,11 +258,21 @@ public static class CharacterCreation
|
||||||
}
|
}
|
||||||
case "paladin":
|
case "paladin":
|
||||||
{
|
{
|
||||||
return _newHavenInfo;
|
if (availableMaps.Includes(MapSelectionFlags.Trammel) && post6000Supported)
|
||||||
|
{
|
||||||
|
return _newHavenInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case "samurai":
|
case "samurai":
|
||||||
{
|
{
|
||||||
if ((flags & ClientFlags.Tokuno) != 0)
|
bool haotisAndTokunoAccessible =
|
||||||
|
(flags & ClientFlags.Tokuno) == ClientFlags.Tokuno &&
|
||||||
|
(flags & ClientFlags.Malas) == ClientFlags.Malas &&
|
||||||
|
availableMaps.Includes(MapSelectionFlags.Malas | MapSelectionFlags.Tokuno);
|
||||||
|
|
||||||
|
if (haotisAndTokunoAccessible)
|
||||||
{
|
{
|
||||||
return new CityInfo("Samurai DE", "Haoti's Grounds", 368, 780, -1, Map.Malas);
|
return new CityInfo("Samurai DE", "Haoti's Grounds", 368, 780, -1, Map.Malas);
|
||||||
}
|
}
|
||||||
|
|
@ -280,7 +292,12 @@ public static class CharacterCreation
|
||||||
}
|
}
|
||||||
case "ninja":
|
case "ninja":
|
||||||
{
|
{
|
||||||
if ((flags & ClientFlags.Tokuno) != 0)
|
bool enimosAndTokunoAccessible =
|
||||||
|
(flags & ClientFlags.Tokuno) == ClientFlags.Tokuno &&
|
||||||
|
(flags & ClientFlags.Malas) == ClientFlags.Malas &&
|
||||||
|
availableMaps.Includes(MapSelectionFlags.Malas | MapSelectionFlags.Tokuno);
|
||||||
|
|
||||||
|
if (enimosAndTokunoAccessible)
|
||||||
{
|
{
|
||||||
return new CityInfo("Ninja DE", "Enimo's Residence", 414, 823, -1, Map.Malas);
|
return new CityInfo("Ninja DE", "Enimo's Residence", 414, 823, -1, Map.Malas);
|
||||||
}
|
}
|
||||||
|
|
@ -300,7 +317,43 @@ public static class CharacterCreation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return post6000Supported && useHaven ? _newHavenInfo : args.City;
|
if (post6000Supported && useHaven && availableMaps.Includes(MapSelectionFlags.Trammel))
|
||||||
|
{
|
||||||
|
// New Haven is supported, so put them there...
|
||||||
|
// Note: if your server maps don't contain New Haven, this will place
|
||||||
|
// them in the wilderness of Ocllo
|
||||||
|
return _newHavenInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (useHaven)
|
||||||
|
{
|
||||||
|
// New Haven is not available, so place them in Ocllo instead, if they're aiming for Haven
|
||||||
|
CityInfo oclloBank = new CityInfo("Ocllo", "Near the bank", 3677, 2513, -1, Map.Trammel);
|
||||||
|
if (availableMaps.Includes(MapSelectionFlags.Trammel))
|
||||||
|
{
|
||||||
|
return oclloBank;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (availableMaps.Includes(MapSelectionFlags.Felucca))
|
||||||
|
{
|
||||||
|
oclloBank.Map = Map.Felucca;
|
||||||
|
return oclloBank;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// They're not trying to get to Haven, so use their city selection
|
||||||
|
// instead - adjusted according to available maps
|
||||||
|
if (args.City.Map == Map.Trammel && !availableMaps.Includes(MapSelectionFlags.Trammel))
|
||||||
|
{
|
||||||
|
args.City.Map = Map.Felucca;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.City.Map == Map.Felucca && !availableMaps.Includes(MapSelectionFlags.Felucca))
|
||||||
|
{
|
||||||
|
args.City.Map = Map.Trammel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return args.City;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SetStats(Mobile m, NetState state, StatNameValue[] stats, int prof)
|
private static void SetStats(Mobile m, NetState state, StatNameValue[] stats, int prof)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using Server.Buffers;
|
|
||||||
using Server.Gumps;
|
using Server.Gumps;
|
||||||
using Server.Logging;
|
using Server.Logging;
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server.Misc
|
namespace Server.Misc
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Server.Buffers;
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server.Misc
|
namespace Server.Misc
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
|
||||||
using Server.Buffers;
|
|
||||||
using Server.Engines.CannedEvil;
|
using Server.Engines.CannedEvil;
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server.Misc
|
namespace Server.Misc
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ namespace Server.Multis
|
||||||
multiID > 0 && multiID < m_MultiTable.Length && CheckValidity(m_MultiTable[multiID]);
|
multiID > 0 && multiID < m_MultiTable.Length && CheckValidity(m_MultiTable[multiID]);
|
||||||
|
|
||||||
public bool CheckValidity(int val) =>
|
public bool CheckValidity(int val) =>
|
||||||
val != -1 && (val == 0 || ((int)ExpansionInfo.CoreExpansion.CustomHousingFlag & val) != 0);
|
val != -1 && (val == 0 || ((int)ExpansionInfo.CoreExpansion.HousingFlags & val) != 0);
|
||||||
|
|
||||||
private int[] CreateTable(int length)
|
private int[] CreateTable(int length)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using Server.Buffers;
|
|
||||||
using Server.Items;
|
using Server.Items;
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
using Server.Targeting;
|
using Server.Targeting;
|
||||||
|
using Server.Text;
|
||||||
|
|
||||||
namespace Server.SkillHandlers
|
namespace Server.SkillHandlers
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue