mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-22 12:47:46 +00:00
Merged in takhlaq/ffxiv-classic-server/ezpz (pull request #32)
added launch args for ip/port and default config loading
This commit is contained in:
commit
f4e238f4be
13 changed files with 146 additions and 36 deletions
|
@ -1,6 +1,8 @@
|
||||||
using FFXIVClassic.Common;
|
using FFXIVClassic.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Lobby_Server
|
||||||
{
|
{
|
||||||
|
@ -23,7 +25,7 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
if (!File.Exists("./lobby_config.ini"))
|
if (!File.Exists("./lobby_config.ini"))
|
||||||
{
|
{
|
||||||
Program.Log.Error("FILE NOT FOUND!");
|
Program.Log.Error("FILE NOT FOUND!");
|
||||||
return false;
|
Program.Log.Error("Loading defaults...");
|
||||||
}
|
}
|
||||||
|
|
||||||
INIFile configIni = new INIFile("./lobby_config.ini");
|
INIFile configIni = new INIFile("./lobby_config.ini");
|
||||||
|
@ -40,5 +42,34 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
public static void ApplyLaunchArgs(string[] launchArgs)
|
||||||
|
{
|
||||||
|
var args = (from arg in launchArgs select arg.ToLower().Trim().TrimStart('-')).ToList();
|
||||||
|
|
||||||
|
for (var i = 0; i + 1 < args.Count; i += 2)
|
||||||
|
{
|
||||||
|
var arg = args[i];
|
||||||
|
var val = args[i + 1];
|
||||||
|
var legit = false;
|
||||||
|
|
||||||
|
if (arg == "ip")
|
||||||
|
{
|
||||||
|
IPAddress ip;
|
||||||
|
if (IPAddress.TryParse(val, out ip) && (legit = true))
|
||||||
|
OPTIONS_BINDIP = val;
|
||||||
|
}
|
||||||
|
else if (arg == "port")
|
||||||
|
{
|
||||||
|
UInt16 port;
|
||||||
|
if (UInt16.TryParse(val, out port) && (legit = true))
|
||||||
|
OPTIONS_PORT = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!legit)
|
||||||
|
{
|
||||||
|
Program.Log.Error("Invalid parameter <{0}> for argument: <--{1}> or argument doesnt exist!", val, arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>copy "$(SolutionDir)data\lobby_config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)"</PostBuildEvent>
|
<PostBuildEvent>xcopy "$(SolutionDir)data\lobby_config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)" /y</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
|
@ -25,8 +25,8 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
bool startServer = true;
|
bool startServer = true;
|
||||||
|
|
||||||
//Load Config
|
//Load Config
|
||||||
if (!ConfigConstants.Load())
|
ConfigConstants.Load();
|
||||||
startServer = false;
|
ConfigConstants.ApplyLaunchArgs(args);
|
||||||
|
|
||||||
//Test DB Connection
|
//Test DB Connection
|
||||||
Program.Log.Info("Testing DB connection to \"{0}\"... ", ConfigConstants.DATABASE_HOST);
|
Program.Log.Info("Testing DB connection to \"{0}\"... ", ConfigConstants.DATABASE_HOST);
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
using FFXIVClassic.Common;
|
using FFXIVClassic.Common;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using MoonSharp.Interpreter.Interop;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server
|
namespace FFXIVClassic_Map_Server
|
||||||
{
|
{
|
||||||
|
@ -24,7 +29,7 @@ namespace FFXIVClassic_Map_Server
|
||||||
if (!File.Exists("./map_config.ini"))
|
if (!File.Exists("./map_config.ini"))
|
||||||
{
|
{
|
||||||
Program.Log.Error("FILE NOT FOUND");
|
Program.Log.Error("FILE NOT FOUND");
|
||||||
return false;
|
Program.Log.Error("Loading defaults... ");
|
||||||
}
|
}
|
||||||
|
|
||||||
INIFile configIni = new INIFile("./map_config.ini");
|
INIFile configIni = new INIFile("./map_config.ini");
|
||||||
|
@ -42,5 +47,35 @@ namespace FFXIVClassic_Map_Server
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ApplyLaunchArgs(string[] launchArgs)
|
||||||
|
{
|
||||||
|
var args = (from arg in launchArgs select arg.ToLower().Trim().TrimStart('-')).ToList();
|
||||||
|
|
||||||
|
for (var i = 0; i + 1 < args.Count; i += 2)
|
||||||
|
{
|
||||||
|
var arg = args[i];
|
||||||
|
var val = args[i + 1];
|
||||||
|
var legit = false;
|
||||||
|
|
||||||
|
if (arg == "ip")
|
||||||
|
{
|
||||||
|
IPAddress ip;
|
||||||
|
if (IPAddress.TryParse(val, out ip) && (legit = true))
|
||||||
|
OPTIONS_BINDIP = val;
|
||||||
|
}
|
||||||
|
else if (arg == "port")
|
||||||
|
{
|
||||||
|
UInt16 port;
|
||||||
|
if (UInt16.TryParse(val, out port) && (legit = true))
|
||||||
|
OPTIONS_PORT = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!legit)
|
||||||
|
{
|
||||||
|
Program.Log.Error("Invalid parameter <{0}> for argument: <--{1}> or argument doesnt exist!", val, arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,9 @@
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<RunPostBuildEvent>Always</RunPostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Cyotek.Collections.Generic.CircularBuffer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=58daa28b0b2de221, processorArchitecture=MSIL">
|
<Reference Include="Cyotek.Collections.Generic.CircularBuffer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=58daa28b0b2de221, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Cyotek.CircularBuffer.1.0.0.0\lib\net20\Cyotek.Collections.Generic.CircularBuffer.dll</HintPath>
|
<HintPath>..\packages\Cyotek.CircularBuffer.1.0.0.0\lib\net20\Cyotek.Collections.Generic.CircularBuffer.dll</HintPath>
|
||||||
|
@ -313,7 +316,12 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>copy "$(SolutionDir)data\map_config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)"</PostBuildEvent>
|
<PostBuildEvent>xcopy "$(SolutionDir)data\map_config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)" /d
|
||||||
|
xcopy "$(SolutionDir)data\scripts" "$(SolutionDir)$(ProjectName)\$(OutDir)scripts" /e /d /y /s</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>
|
||||||
|
</PreBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
|
@ -31,8 +31,8 @@ namespace FFXIVClassic_Map_Server
|
||||||
Program.Log.Info("---------FFXIV 1.0 Map Server---------");
|
Program.Log.Info("---------FFXIV 1.0 Map Server---------");
|
||||||
|
|
||||||
//Load Config
|
//Load Config
|
||||||
if (!ConfigConstants.Load())
|
ConfigConstants.Load();
|
||||||
startServer = false;
|
ConfigConstants.ApplyLaunchArgs(args);
|
||||||
|
|
||||||
//Test DB Connection
|
//Test DB Connection
|
||||||
Program.Log.Info("Testing DB connection... ");
|
Program.Log.Info("Testing DB connection... ");
|
||||||
|
|
|
@ -207,7 +207,7 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
public static void RunGMCommand(Player player, String cmd, string[] param, bool help = false)
|
public static void RunGMCommand(Player player, String cmd, string[] param, bool help = false)
|
||||||
{
|
{
|
||||||
// load from scripts/commands/gm/ directory
|
// load from scripts/commands/gm/ directory
|
||||||
var path = String.Format("./scripts/commands/gm/{0}.lua", cmd.ToString().ToLower());
|
var path = String.Format("./scripts/commands/gm/{0}.lua", cmd.ToLower());
|
||||||
|
|
||||||
// check if the file exists
|
// check if the file exists
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
using FFXIVClassic.Common;
|
using FFXIVClassic.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
namespace FFXIVClassic_World_Server
|
namespace FFXIVClassic_World_Server
|
||||||
{
|
{
|
||||||
|
@ -23,7 +25,7 @@ namespace FFXIVClassic_World_Server
|
||||||
if (!File.Exists("./world_config.ini"))
|
if (!File.Exists("./world_config.ini"))
|
||||||
{
|
{
|
||||||
Program.Log.Error("FILE NOT FOUND!");
|
Program.Log.Error("FILE NOT FOUND!");
|
||||||
return false;
|
Program.Log.Error("Loading defaults...");
|
||||||
}
|
}
|
||||||
|
|
||||||
INIFile configIni = new INIFile("./world_config.ini");
|
INIFile configIni = new INIFile("./world_config.ini");
|
||||||
|
@ -40,5 +42,35 @@ namespace FFXIVClassic_World_Server
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ApplyLaunchArgs(string[] launchArgs)
|
||||||
|
{
|
||||||
|
var args = (from arg in launchArgs select arg.ToLower().Trim().TrimStart('-')).ToList();
|
||||||
|
|
||||||
|
for (var i = 0; i + 1 < args.Count; i += 2)
|
||||||
|
{
|
||||||
|
var arg = args[i];
|
||||||
|
var val = args[i + 1];
|
||||||
|
var legit = false;
|
||||||
|
|
||||||
|
if (arg == "ip")
|
||||||
|
{
|
||||||
|
IPAddress ip;
|
||||||
|
if (IPAddress.TryParse(val, out ip) && (legit = true))
|
||||||
|
OPTIONS_BINDIP = val;
|
||||||
|
}
|
||||||
|
else if (arg == "port")
|
||||||
|
{
|
||||||
|
UInt16 port;
|
||||||
|
if (UInt16.TryParse(val, out port) && (legit = true))
|
||||||
|
OPTIONS_PORT = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!legit)
|
||||||
|
{
|
||||||
|
Program.Log.Error("Invalid parameter <{0}> for argument: <--{1}> or argument doesnt exist!", val, arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,9 @@
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>xcopy "$(SolutionDir)data\world_config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)" /d</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
|
|
@ -36,8 +36,8 @@ namespace FFXIVClassic_World_Server
|
||||||
Log.Info("==================================");
|
Log.Info("==================================");
|
||||||
|
|
||||||
//Load Config
|
//Load Config
|
||||||
if (!ConfigConstants.Load())
|
ConfigConstants.Load();
|
||||||
startServer = false;
|
ConfigConstants.ApplyLaunchArgs(args);
|
||||||
|
|
||||||
//Test DB Connection
|
//Test DB Connection
|
||||||
Log.Info("Testing DB connection... ");
|
Log.Info("Testing DB connection... ");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[General]
|
[General]
|
||||||
server_ip=127.0.0.1
|
server_ip=0.0.0.0
|
||||||
showtimestamp = true
|
showtimestamp = true
|
||||||
|
|
||||||
[Database]
|
[Database]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[General]
|
[General]
|
||||||
server_ip=127.0.0.1
|
server_ip=0.0.0.0
|
||||||
showtimestamp = true
|
showtimestamp = true
|
||||||
|
|
||||||
[Database]
|
[Database]
|
||||||
|
|
|
@ -11,6 +11,7 @@ SET FOREIGN_KEY_CHECKS=0;
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for characters
|
-- Table structure for characters
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `characters`;
|
||||||
CREATE TABLE `characters` (
|
CREATE TABLE `characters` (
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`userId` int(11) unsigned NOT NULL,
|
`userId` int(11) unsigned NOT NULL,
|
||||||
|
@ -30,11 +31,11 @@ CREATE TABLE `characters` (
|
||||||
`currentZoneId` smallint(5) unsigned DEFAULT '0',
|
`currentZoneId` smallint(5) unsigned DEFAULT '0',
|
||||||
`destinationZoneId` smallint(5) unsigned DEFAULT '0',
|
`destinationZoneId` smallint(5) unsigned DEFAULT '0',
|
||||||
`destinationSpawnType` tinyint(3) unsigned DEFAULT '0',
|
`destinationSpawnType` tinyint(3) unsigned DEFAULT '0',
|
||||||
`guardian` tinyint(3) unsigned NOT NULL,
|
`guardian` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||||
`birthDay` tinyint(3) unsigned NOT NULL,
|
`birthDay` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||||
`birthMonth` tinyint(3) unsigned NOT NULL,
|
`birthMonth` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||||
`initialTown` tinyint(3) unsigned NOT NULL,
|
`initialTown` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||||
`tribe` tinyint(3) unsigned NOT NULL,
|
`tribe` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||||
`gcCurrent` tinyint(3) unsigned DEFAULT '0',
|
`gcCurrent` tinyint(3) unsigned DEFAULT '0',
|
||||||
`gcLimsaRank` tinyint(3) unsigned DEFAULT '127',
|
`gcLimsaRank` tinyint(3) unsigned DEFAULT '127',
|
||||||
`gcGridaniaRank` tinyint(3) unsigned DEFAULT '127',
|
`gcGridaniaRank` tinyint(3) unsigned DEFAULT '127',
|
||||||
|
|
Loading…
Add table
Reference in a new issue