Fixes configurations (#130)
This commit is contained in:
parent
cf8620d558
commit
11227391d3
10 changed files with 34 additions and 16 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
namespace Server.Misc
|
namespace Server.Misc
|
||||||
{
|
{
|
||||||
public class MapDefinitions
|
public static class MapDefinitions
|
||||||
{
|
{
|
||||||
public static void Configure()
|
public static void Configure()
|
||||||
{
|
{
|
||||||
|
|
@ -33,11 +33,12 @@ namespace Server.Misc
|
||||||
* - <season> : Season of the map. 0 = Spring, 1 = Summer, 2 = Fall, 3 = Winter, 4 = Desolation
|
* - <season> : Season of the map. 0 = Spring, 1 = Summer, 2 = Fall, 3 = Winter, 4 = Desolation
|
||||||
* - <name> : Reference name for the map, used in props gump, get/set commands, region loading, etc
|
* - <name> : Reference name for the map, used in props gump, get/set commands, region loading, etc
|
||||||
* - <rules> : Rules and restrictions associated with the map. See documentation for details
|
* - <rules> : Rules and restrictions associated with the map. See documentation for details
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TileMatrixPatch.Enabled = false; // OSI Client Patch 6.0.0.0
|
// Using this requires the old mapDif files to be present. Only needed to support Clients < 6.0.0.0
|
||||||
|
TileMatrixPatch.Enabled = ServerConfiguration.GetOrUpdateSetting("maps.enableTileMatrixPatches", !Core.SE);
|
||||||
|
|
||||||
MultiComponentList.PostHSFormat = true; // OSI Client Patch 7.0.9.0
|
MultiComponentList.PostHSFormat = ServerConfiguration.GetOrUpdateSetting("maps.enablePostHSMultiComponentFormat", true); // OSI Client Patch 7.0.9.0
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RegisterMap(int mapIndex, int mapID, int fileIndex, int width, int height, int season,
|
public static void RegisterMap(int mapIndex, int mapID, int fileIndex, int width, int height, int season,
|
||||||
|
|
@ -49,4 +50,4 @@ namespace Server.Misc
|
||||||
Map.AllMaps.Add(newMap);
|
Map.AllMaps.Add(newMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ namespace Server.Misc
|
||||||
{
|
{
|
||||||
Address = ServerConfiguration.GetOrUpdateSetting("serverListing.address", "(-null-)");
|
Address = ServerConfiguration.GetOrUpdateSetting("serverListing.address", "(-null-)");
|
||||||
AutoDetect = ServerConfiguration.GetOrUpdateSetting("serverListing.autoDetect", true);
|
AutoDetect = ServerConfiguration.GetOrUpdateSetting("serverListing.autoDetect", true);
|
||||||
|
ServerName = ServerConfiguration.GetOrUpdateSetting("serverListing.serverName", "ModernUO");
|
||||||
|
|
||||||
if (Address == null)
|
if (Address == null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers.Binary;
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@ namespace Server.Tests
|
||||||
|
|
||||||
public ServerFixture()
|
public ServerFixture()
|
||||||
{
|
{
|
||||||
|
// Load Configurations
|
||||||
|
ServerConfiguration.Load(true);
|
||||||
|
|
||||||
// Configure / Initialize
|
// Configure / Initialize
|
||||||
MapDefinitions.Configure();
|
MapDefinitions.Configure();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ namespace Server
|
||||||
private const string m_RelPath = "Configuration/modernuo.json";
|
private const string m_RelPath = "Configuration/modernuo.json";
|
||||||
private static readonly string m_FilePath = Path.Join(Core.BaseDirectory, m_RelPath);
|
private static readonly string m_FilePath = Path.Join(Core.BaseDirectory, m_RelPath);
|
||||||
private static ServerSettings m_Settings;
|
private static ServerSettings m_Settings;
|
||||||
|
private static bool m_Mocked;
|
||||||
|
|
||||||
public static List<string> DataDirectories => m_Settings.dataDirectories;
|
public static List<string> DataDirectories => m_Settings.dataDirectories;
|
||||||
|
|
||||||
|
|
@ -119,7 +120,7 @@ namespace Server
|
||||||
public static void SetSetting(string key, string value)
|
public static void SetSetting(string key, string value)
|
||||||
{
|
{
|
||||||
m_Settings.settings[key] = value;
|
m_Settings.settings[key] = value;
|
||||||
SaveConfiguration();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static T GetMetadata<T>(string key) where T : class
|
public static T GetMetadata<T>(string key) where T : class
|
||||||
|
|
@ -133,8 +134,10 @@ namespace Server
|
||||||
m_Settings.metadata[key] = value;
|
m_Settings.metadata[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LoadConfiguration()
|
// If mock is enabled we skip the console readline.
|
||||||
|
public static void Load(bool mocked = false)
|
||||||
{
|
{
|
||||||
|
m_Mocked = mocked;
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
|
|
||||||
if (File.Exists(m_FilePath))
|
if (File.Exists(m_FilePath))
|
||||||
|
|
@ -158,6 +161,9 @@ namespace Server
|
||||||
m_Settings = new ServerSettings();
|
m_Settings = new ServerSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mocked)
|
||||||
|
return;
|
||||||
|
|
||||||
if (m_Settings.dataDirectories.Count == 0)
|
if (m_Settings.dataDirectories.Count == 0)
|
||||||
{
|
{
|
||||||
updated = true;
|
updated = true;
|
||||||
|
|
@ -167,7 +173,7 @@ namespace Server
|
||||||
|
|
||||||
if (updated)
|
if (updated)
|
||||||
{
|
{
|
||||||
SaveConfiguration();
|
Save();
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
Console.WriteLine($"Core: Configuration saved to {m_RelPath}.");
|
Console.WriteLine($"Core: Configuration saved to {m_RelPath}.");
|
||||||
Console.ResetColor();
|
Console.ResetColor();
|
||||||
|
|
@ -200,8 +206,10 @@ namespace Server
|
||||||
return directory;
|
return directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SaveConfiguration()
|
public static void Save()
|
||||||
{
|
{
|
||||||
|
if (m_Mocked) return;
|
||||||
|
|
||||||
JsonConfig.Serialize(m_FilePath, m_Settings);
|
JsonConfig.Serialize(m_FilePath, m_Settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -380,7 +380,7 @@ namespace Server
|
||||||
Console.WriteLine("SecureRandomImpl: {0} ({1})", SecureRandomImpl.Name,
|
Console.WriteLine("SecureRandomImpl: {0} ({1})", SecureRandomImpl.Name,
|
||||||
SecureRandomImpl.IsHardwareRNG ? "Hardware" : "Software");
|
SecureRandomImpl.IsHardwareRNG ? "Hardware" : "Software");
|
||||||
|
|
||||||
ServerConfiguration.LoadConfiguration();
|
ServerConfiguration.Load();
|
||||||
|
|
||||||
// Load Assembly Scripts.CS.dll
|
// Load Assembly Scripts.CS.dll
|
||||||
AssemblyHandler.LoadScripts();
|
AssemblyHandler.LoadScripts();
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,6 @@ namespace Server
|
||||||
}
|
}
|
||||||
|
|
||||||
[Parsable]
|
[Parsable]
|
||||||
// [CustomEnum( new string[]{ "Felucca", "Trammel", "Ilshenar", "Malas", "Internal" } )]
|
|
||||||
public sealed class Map : IComparable<Map>
|
public sealed class Map : IComparable<Map>
|
||||||
{
|
{
|
||||||
public const int SectorSize = 16;
|
public const int SectorSize = 16;
|
||||||
|
|
|
||||||
|
|
@ -2063,7 +2063,10 @@ namespace Server
|
||||||
{
|
{
|
||||||
ns.Sequence = 0;
|
ns.Sequence = 0;
|
||||||
ns.Send(new MapChange(this));
|
ns.Send(new MapChange(this));
|
||||||
ns.Send(new MapPatches());
|
|
||||||
|
if (!Core.SE && ns.ProtocolChanges < ProtocolChanges.Version6000)
|
||||||
|
ns.Send(new MapPatches());
|
||||||
|
|
||||||
ns.Send(SeasonChange.Instantiate(GetSeason(), true));
|
ns.Send(SeasonChange.Instantiate(GetSeason(), true));
|
||||||
|
|
||||||
if (ns.StygianAbyss)
|
if (ns.StygianAbyss)
|
||||||
|
|
@ -2185,7 +2188,10 @@ namespace Server
|
||||||
{
|
{
|
||||||
ns.Sequence = 0;
|
ns.Sequence = 0;
|
||||||
ns.Send(new MapChange(this));
|
ns.Send(new MapChange(this));
|
||||||
ns.Send(new MapPatches());
|
|
||||||
|
if (!Core.SE && ns.ProtocolChanges < ProtocolChanges.Version6000)
|
||||||
|
ns.Send(new MapPatches());
|
||||||
|
|
||||||
ns.Send(SeasonChange.Instantiate(GetSeason(), true));
|
ns.Send(SeasonChange.Instantiate(GetSeason(), true));
|
||||||
|
|
||||||
if (ns.StygianAbyss)
|
if (ns.StygianAbyss)
|
||||||
|
|
|
||||||
|
|
@ -1940,7 +1940,8 @@ namespace Server.Network
|
||||||
if (m.Map != null)
|
if (m.Map != null)
|
||||||
state.Send(new MapChange(m));
|
state.Send(new MapChange(m));
|
||||||
|
|
||||||
state.Send(new MapPatches());
|
if (!Core.SE && state.ProtocolChanges < ProtocolChanges.Version6000)
|
||||||
|
state.Send(new MapPatches());
|
||||||
|
|
||||||
state.Send(SeasonChange.Instantiate(m.GetSeason(), true));
|
state.Send(SeasonChange.Instantiate(m.GetSeason(), true));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ namespace Server.Network
|
||||||
{
|
{
|
||||||
public MapPatches() : base(0xBF)
|
public MapPatches() : base(0xBF)
|
||||||
{
|
{
|
||||||
EnsureCapacity(9 + 3 * 8);
|
EnsureCapacity(9 + 4 * 8);
|
||||||
|
|
||||||
Stream.Write((short)0x0018);
|
Stream.Write((short)0x0018);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue