new config options
This commit is contained in:
parent
5f488b67d9
commit
d7ba6dcb6b
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -8,61 +9,95 @@ namespace Campofinale
|
|||||||
{
|
{
|
||||||
public class ConfigFile
|
public class ConfigFile
|
||||||
{
|
{
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public MongoDatabaseSettings mongoDatabase = new();
|
public MongoDatabaseSettings mongoDatabase = new();
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public DispatchServerSettings dispatchServer = new();
|
public DispatchServerSettings dispatchServer = new();
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public GameserverSettings gameServer = new();
|
public GameserverSettings gameServer = new();
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public ServerOptions serverOptions = new();
|
public ServerOptions serverOptions = new();
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public LogSettings logOptions = new();
|
public LogSettings logOptions = new();
|
||||||
}
|
}
|
||||||
public struct ServerOptions
|
public class ServerOptions
|
||||||
{
|
{
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public int defaultSceneNumId = 98;
|
public int defaultSceneNumId = 98;
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public int maxPlayers = 20;
|
public int maxPlayers = 20;
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
|
public CharactersOptions defaultCharacters = new();
|
||||||
public ServerOptions()
|
public ServerOptions()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CharactersOptions
|
||||||
|
{
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
|
public int defaultLevel = 1;
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
|
public bool giveAllCharacters = true;
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
|
public List<string> characters = new List<string>()
|
||||||
|
{
|
||||||
|
"chr_0002_endminm",
|
||||||
|
"chr_0003_endminf",
|
||||||
|
"chr_0015_lifeng"
|
||||||
|
}; //used if giveAllCharacters is false
|
||||||
|
|
||||||
|
public CharactersOptions() { }
|
||||||
|
}
|
||||||
/* public struct WelcomeMail
|
/* public struct WelcomeMail
|
||||||
{
|
{
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
public struct LogSettings
|
public class LogSettings
|
||||||
{
|
{
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public bool packets;
|
public bool packets;
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public bool debugPrint=false;
|
public bool debugPrint=false;
|
||||||
|
|
||||||
public LogSettings()
|
public LogSettings()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public struct GameserverSettings
|
public class GameserverSettings
|
||||||
{
|
{
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public string bindAddress = "127.0.0.1";
|
public string bindAddress = "127.0.0.1";
|
||||||
public int bindPort = 30000;
|
public int bindPort = 30000;
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public string accessAddress = "127.0.0.1";
|
public string accessAddress = "127.0.0.1";
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public int accessPort = 30000;
|
public int accessPort = 30000;
|
||||||
public GameserverSettings()
|
public GameserverSettings()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public struct DispatchServerSettings
|
public class DispatchServerSettings
|
||||||
{
|
{
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public string bindAddress = "127.0.0.1";
|
public string bindAddress = "127.0.0.1";
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public int bindPort = 5000;
|
public int bindPort = 5000;
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public string accessAddress = "127.0.0.1";
|
public string accessAddress = "127.0.0.1";
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public int accessPort = 5000;
|
public int accessPort = 5000;
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public string emailFormat = "@campofinale.ps";
|
public string emailFormat = "@campofinale.ps";
|
||||||
public DispatchServerSettings()
|
public DispatchServerSettings()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public struct MongoDatabaseSettings
|
public class MongoDatabaseSettings
|
||||||
{
|
{
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public string uri = "mongodb://localhost:27017";
|
public string uri = "mongodb://localhost:27017";
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public string collection = "Campofinale";
|
public string collection = "Campofinale";
|
||||||
public MongoDatabaseSettings()
|
public MongoDatabaseSettings()
|
||||||
{
|
{
|
||||||
|
@ -197,11 +197,22 @@ namespace Campofinale
|
|||||||
return chars.Find(c => c.id==templateId);
|
return chars.Find(c => c.id==templateId);
|
||||||
}
|
}
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
|
{
|
||||||
|
if (Server.config.serverOptions.defaultCharacters.giveAllCharacters)
|
||||||
{
|
{
|
||||||
foreach (var item in ResourceManager.characterTable)
|
foreach (var item in ResourceManager.characterTable)
|
||||||
{
|
{
|
||||||
chars.Add(new Character(roleId,item.Key,20));
|
chars.Add(new Character(roleId, item.Key, Server.config.serverOptions.defaultCharacters.defaultLevel));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var item in Server.config.serverOptions.defaultCharacters.characters)
|
||||||
|
{
|
||||||
|
chars.Add(new Character(roleId, item.Key, Server.config.serverOptions.defaultCharacters.defaultLevel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach(var item in itemTable)
|
foreach(var item in itemTable)
|
||||||
{
|
{
|
||||||
if(item.Value.maxStackCount == -1)
|
if(item.Value.maxStackCount == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user