mirror of
https://github.com/MikuLeaks/KianaBH3.git
synced 2025-12-13 13:24:34 +01:00
Init enter game
This commit is contained in:
84
Common/Configuration/ConfigContainer.cs
Normal file
84
Common/Configuration/ConfigContainer.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
namespace KianaBH.Configuration;
|
||||
|
||||
public class ConfigContainer
|
||||
{
|
||||
public HttpServerConfig HttpServer { get; set; } = new();
|
||||
public GameServerConfig GameServer { get; set; } = new();
|
||||
public PathConfig Path { get; set; } = new();
|
||||
public ServerOption ServerOption { get; set; } = new();
|
||||
}
|
||||
|
||||
public class HttpServerConfig
|
||||
{
|
||||
public string BindAddress { get; set; } = "0.0.0.0";
|
||||
public string PublicAddress { get; set; } = "127.0.0.1";
|
||||
public int Port { get; set; } = 80;
|
||||
|
||||
public string GetDisplayAddress()
|
||||
{
|
||||
return "http" + "://" + PublicAddress + ":" + Port;
|
||||
}
|
||||
|
||||
public string GetBindDisplayAddress()
|
||||
{
|
||||
return "http" + "://" + BindAddress + ":" + Port;
|
||||
}
|
||||
}
|
||||
|
||||
public class GameServerConfig
|
||||
{
|
||||
public string BindAddress { get; set; } = "0.0.0.0";
|
||||
public string PublicAddress { get; set; } = "127.0.0.1";
|
||||
public int Port { get; set; } = 21000;
|
||||
public int KcpAliveMs { get; set; } = 45000;
|
||||
public string DatabaseName { get; set; } = "kiana.db";
|
||||
public string GameServerId { get; set; } = "KianaBH";
|
||||
public string GameServerName { get; set; } = "KianaBH";
|
||||
public string GetDisplayAddress()
|
||||
{
|
||||
return PublicAddress + ":" + Port;
|
||||
}
|
||||
}
|
||||
|
||||
public class PathConfig
|
||||
{
|
||||
public string ResourcePath { get; set; } = "Resources";
|
||||
public string ConfigPath { get; set; } = "Config";
|
||||
public string DatabasePath { get; set; } = "Config/Database";
|
||||
public string HandbookPath { get; set; } = "Config/Handbook";
|
||||
public string LogPath { get; set; } = "Config/Logs";
|
||||
public string DataPath { get; set; } = "Config/Data";
|
||||
}
|
||||
|
||||
public class ServerOption
|
||||
{
|
||||
public bool EnableMission { get; set; } = false;
|
||||
public string DefaultGender { get; set; } = "Woman";
|
||||
public string Language { get; set; } = "EN";
|
||||
public string FallbackLanguage { get; set; } = "EN";
|
||||
public string[] DefaultPermissions { get; set; } = ["Admin"];
|
||||
public ServerProfile ServerProfile { get; set; } = new();
|
||||
public bool AutoCreateUser { get; set; } = true;
|
||||
public bool SavePersonalDebugFile { get; set; } = false;
|
||||
public bool AutoSendResponseWhenNoHandler { get; set; } = true;
|
||||
#if DEBUG
|
||||
public bool EnableDebug { get; set; } = true;
|
||||
#else
|
||||
public bool EnableDebug { get; set; } = false;
|
||||
#endif
|
||||
public bool DebugMessage { get; set; } = true;
|
||||
public bool DebugDetailMessage { get; set; } = true;
|
||||
public bool DebugNoHandlerPacket { get; set; } = true;
|
||||
}
|
||||
|
||||
public class ServerProfile
|
||||
{
|
||||
public string Name { get; set; } = "Server";
|
||||
public int Uid { get; set; } = 80;
|
||||
public string Signature { get; set; } = "Type /help for a list of commands";
|
||||
public int Level { get; set; } = 1;
|
||||
public int HeadIcon { get; set; } = 200105;
|
||||
public int ChatBubbleId { get; set; } = 220001;
|
||||
public int DisplayAvatarId { get; set; } = 1001;
|
||||
public int DisplayAvatarLevel { get; set; } = 1;
|
||||
}
|
||||
75
Common/Configuration/HotfixContainer.cs
Normal file
75
Common/Configuration/HotfixContainer.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace KianaBH.Configuration;
|
||||
|
||||
public class HotfixContainer
|
||||
{
|
||||
public bool UseLocalCache { get; set; } = false;
|
||||
public Dictionary<string, HotfixManfiset> Hotfixes { get; set; } = new();
|
||||
public Dictionary<string, string> AesKeys { get; set; } = new ();
|
||||
|
||||
public static string ExtractVersionNumber(string? version)
|
||||
{
|
||||
try
|
||||
{
|
||||
return version == null ? "" : version[..version.IndexOf('_')];
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HotfixManfiset
|
||||
{
|
||||
[JsonPropertyName("Asb")] public AsbData Asb { get; set; } = new();
|
||||
[JsonPropertyName("AsbPreDownload")] public AsbPreDownloadData AsbPreDownload { get; set; } = new();
|
||||
[JsonPropertyName("Audio")] public AudioData Audio { get; set; } = new();
|
||||
[JsonPropertyName("AudioPreDownload")] public AudioPreDownloadData AudioPreDownload { get; set; } = new();
|
||||
[JsonPropertyName("VideoEncrypt")] public VideoEncryptData VideoEncrypt { get; set; } = new();
|
||||
}
|
||||
|
||||
public class AsbData
|
||||
{
|
||||
[JsonPropertyName("android")] public PlatformInfo Android { get; set; } = new();
|
||||
[JsonPropertyName("iphone")] public PlatformInfo Iphone { get; set; } = new();
|
||||
[JsonPropertyName("pc")] public PlatformInfo Pc { get; set; } = new();
|
||||
}
|
||||
|
||||
public class AsbPreDownloadData
|
||||
{
|
||||
[JsonPropertyName("android")] public PlatformEncryptedInfo Android { get; set; } = new();
|
||||
[JsonPropertyName("iphone")] public PlatformEncryptedInfo Iphone { get; set; } = new();
|
||||
}
|
||||
|
||||
public class AudioData
|
||||
{
|
||||
[JsonPropertyName("platform")] public Dictionary<string, string> Platform { get; set; } = new();
|
||||
[JsonPropertyName("revision")] public int Revision { get; set; }
|
||||
}
|
||||
|
||||
public class AudioPreDownloadData
|
||||
{
|
||||
[JsonPropertyName("enable_time")] public long EnableTime { get; set; }
|
||||
[JsonPropertyName("platform")] public Dictionary<string, string> Platform { get; set; } = new();
|
||||
[JsonPropertyName("revision")] public int Revision { get; set; }
|
||||
}
|
||||
|
||||
public class VideoEncryptData
|
||||
{
|
||||
[JsonPropertyName("filename")] public string FileName { get; set; } = "";
|
||||
}
|
||||
|
||||
public class PlatformInfo
|
||||
{
|
||||
[JsonPropertyName("enable_time")] public long EnableTime { get; set; }
|
||||
[JsonPropertyName("revision")] public string Revision { get; set; } = "";
|
||||
[JsonPropertyName("suffix")] public string Suffix { get; set; } = "";
|
||||
}
|
||||
|
||||
public class PlatformEncryptedInfo : PlatformInfo
|
||||
{
|
||||
[JsonPropertyName("encrypt_key")] public string EncryptKey { get; set; } = "";
|
||||
}
|
||||
Reference in New Issue
Block a user