1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-25 06:07:46 +00:00

servers now log (almost) everything to file

- regex'd in mysqlexception logging
- servers can now specify server_port, log_path, log_file
- added scripts to import/export all tables (exporting will export a handful of garbage table names, open and check for structure before deleting)
- fixed packet logging (thanks deviltti)
This commit is contained in:
Tahir Akhlaq 2016-06-08 22:29:04 +01:00
parent 92339ba0c4
commit 8b93abe86e
238 changed files with 684 additions and 1532 deletions

View file

@ -1,14 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Sockets; using System.Net.Sockets;
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Lobby_Server.packets;
using System.Diagnostics;
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Lobby_Server.common;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.IO;
using Cyotek.Collections.Generic; using Cyotek.Collections.Generic;
using System.Net; using System.Net;

View file

@ -1,18 +1,16 @@
using FFXIVClassic_Lobby_Server.common; using STA.Settings;
using STA.Settings;
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server namespace FFXIVClassic_Lobby_Server
{ {
class ConfigConstants class ConfigConstants
{ {
public static String OPTIONS_BINDIP; public static String OPTIONS_BINDIP;
public static bool OPTIONS_TIMESTAMP = false; public static String OPTIONS_PORT;
public static bool OPTIONS_TIMESTAMP = false;
public static String OPTIONS_LOGPATH;
public static String OPTIONS_LOGFILE;
public static String DATABASE_HOST; public static String DATABASE_HOST;
public static String DATABASE_PORT; public static String DATABASE_PORT;
@ -22,20 +20,23 @@ namespace FFXIVClassic_Lobby_Server
public static bool load() public static bool load()
{ {
Console.Write("Loading config.ini file... "); Console.Write("Loading lobby_config.ini file... ");
if (!File.Exists("./config.ini")) if (!File.Exists("./lobby_config.ini"))
{ {
Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("[FILE NOT FOUND]"); Console.WriteLine(String.Format("[FILE NOT FOUND]"));
Console.ForegroundColor = ConsoleColor.Gray; Console.ForegroundColor = ConsoleColor.Gray;
return false; return false;
} }
INIFile configIni = new INIFile("./config.ini"); INIFile configIni = new INIFile("./lobby_config.ini");
ConfigConstants.OPTIONS_BINDIP = configIni.GetValue("General", "server_ip", "127.0.0.1"); ConfigConstants.OPTIONS_BINDIP = configIni.GetValue("General", "server_ip", "127.0.0.1");
ConfigConstants.OPTIONS_TIMESTAMP = configIni.GetValue("General", "showtimestamp", "true").ToLower().Equals("true"); ConfigConstants.OPTIONS_PORT = configIni.GetValue("General", "server_port", "54994");
ConfigConstants.OPTIONS_TIMESTAMP = configIni.GetValue("General", "showtimestamp", "true").ToLower().Equals("true");
ConfigConstants.OPTIONS_LOGPATH = configIni.GetValue("General", "log_path", "./logs/");
ConfigConstants.OPTIONS_LOGFILE = configIni.GetValue("General", "log_file_name", String.Format("lobby_{0}_{1}.log", OPTIONS_BINDIP, OPTIONS_PORT));
ConfigConstants.DATABASE_HOST = configIni.GetValue("Database", "host", ""); ConfigConstants.DATABASE_HOST = configIni.GetValue("Database", "host", "");
ConfigConstants.DATABASE_PORT = configIni.GetValue("Database", "port", ""); ConfigConstants.DATABASE_PORT = configIni.GetValue("Database", "port", "");
@ -44,7 +45,7 @@ namespace FFXIVClassic_Lobby_Server
ConfigConstants.DATABASE_PASSWORD = configIni.GetValue("Database", "password", ""); ConfigConstants.DATABASE_PASSWORD = configIni.GetValue("Database", "password", "");
Console.ForegroundColor = ConsoleColor.Green; Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("[OK]"); Console.WriteLine(String.Format("[OK]"));
Console.ForegroundColor = ConsoleColor.Gray; Console.ForegroundColor = ConsoleColor.Gray;
return true; return true;

View file

@ -1,14 +1,11 @@
using FFXIVClassic_Lobby_Server.dataobjects; using FFXIVClassic_Lobby_Server.dataobjects;
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using Dapper; using Dapper;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Lobby_Server.utils; using FFXIVClassic_Lobby_Server.utils;
using FFXIVClassic_Lobby_Server.common;
namespace FFXIVClassic_Lobby_Server namespace FFXIVClassic_Lobby_Server
{ {
@ -35,7 +32,10 @@ namespace FFXIVClassic_Lobby_Server
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -88,6 +88,10 @@ namespace FFXIVClassic_Lobby_Server
} }
catch (MySqlException e) catch (MySqlException e)
{ {
Log.error(e.ToString());
Log.error(e.ToString());
pid = 0; pid = 0;
cid = 0; cid = 0;
} }
@ -179,6 +183,8 @@ namespace FFXIVClassic_Lobby_Server
} }
catch (MySqlException e) catch (MySqlException e)
{ {
Log.error(e.ToString());
conn.Dispose(); conn.Dispose();
return; return;
} }
@ -202,6 +208,8 @@ namespace FFXIVClassic_Lobby_Server
} }
catch (MySqlException e) catch (MySqlException e)
{ {
Log.error(e.ToString());
conn.Dispose(); conn.Dispose();
return; return;
} }
@ -222,6 +230,8 @@ namespace FFXIVClassic_Lobby_Server
} }
catch (MySqlException e) catch (MySqlException e)
{ {
Log.error(e.ToString());
} }
finally finally
@ -267,6 +277,8 @@ namespace FFXIVClassic_Lobby_Server
} }
catch (MySqlException e) catch (MySqlException e)
{ {
Log.error(e.ToString());
} }
finally finally
@ -298,6 +310,8 @@ namespace FFXIVClassic_Lobby_Server
} }
catch (MySqlException e) catch (MySqlException e)
{ {
Log.error(e.ToString());
} }
finally finally
@ -320,7 +334,9 @@ namespace FFXIVClassic_Lobby_Server
worldList = conn.Query<World>("SELECT * FROM servers WHERE isActive=true").ToList(); worldList = conn.Query<World>("SELECT * FROM servers WHERE isActive=true").ToList();
} }
catch (MySqlException e) catch (MySqlException e)
{ worldList = new List<World>(); } {
Log.error(e.ToString());
worldList = new List<World>(); }
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -340,7 +356,9 @@ namespace FFXIVClassic_Lobby_Server
world = conn.Query<World>("SELECT * FROM servers WHERE id=@ServerId", new {ServerId = serverId}).SingleOrDefault(); world = conn.Query<World>("SELECT * FROM servers WHERE id=@ServerId", new {ServerId = serverId}).SingleOrDefault();
} }
catch (MySqlException e) catch (MySqlException e)
{ {
Log.error(e.ToString());
} }
finally finally
{ {
@ -476,6 +494,8 @@ namespace FFXIVClassic_Lobby_Server
} }
catch (MySqlException e) catch (MySqlException e)
{ {
Log.error(e.ToString());
} }
finally finally
{ {
@ -497,7 +517,9 @@ namespace FFXIVClassic_Lobby_Server
nameList = conn.Query<String>("SELECT name FROM reserved_names WHERE userId=@UserId", new { UserId = userId }).ToList(); nameList = conn.Query<String>("SELECT name FROM reserved_names WHERE userId=@UserId", new { UserId = userId }).ToList();
} }
catch (MySqlException e) catch (MySqlException e)
{ nameList = new List<String>(); } {
Log.error(e.ToString());
nameList = new List<String>(); }
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -517,7 +539,9 @@ namespace FFXIVClassic_Lobby_Server
retainerList = conn.Query<Retainer>("SELECT * FROM retainers WHERE id=@UserId ORDER BY characterId, slot", new { UserId = userId }).ToList(); retainerList = conn.Query<Retainer>("SELECT * FROM retainers WHERE id=@UserId ORDER BY characterId, slot", new { UserId = userId }).ToList();
} }
catch (MySqlException e) catch (MySqlException e)
{ retainerList = new List<Retainer>(); } {
Log.error(e.ToString());
retainerList = new List<Retainer>(); }
finally finally
{ {
conn.Dispose(); conn.Dispose();

View file

@ -11,6 +11,21 @@
<AssemblyName>FFXIVClassic_Lobby_Server</AssemblyName> <AssemblyName>FFXIVClassic_Lobby_Server</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -94,9 +109,21 @@
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>copy "$(SolutionDir)data\config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)"</PostBuildEvent> <PostBuildEvent>copy "$(SolutionDir)data\lobby_config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)"</PostBuildEvent>
</PropertyGroup> </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.

View file

@ -3,16 +3,11 @@ using FFXIVClassic_Lobby_Server.dataobjects;
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Lobby_Server.packets.receive; using FFXIVClassic_Lobby_Server.packets.receive;
using FFXIVClassic_Lobby_Server.utils; using FFXIVClassic_Lobby_Server.utils;
using MySql.Data.MySqlClient;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server namespace FFXIVClassic_Lobby_Server
{ {

View file

@ -1,17 +1,14 @@
using FFXIVClassic_Lobby_Server.packets; using System;
using System;
using System.Diagnostics; using System.Diagnostics;
using System.Threading; using System.Threading;
using FFXIVClassic_Lobby_Server.common;
using System.Runtime.InteropServices;
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using System.Reflection; using System.Reflection;
using FFXIVClassic_Lobby_Server.common;
namespace FFXIVClassic_Lobby_Server namespace FFXIVClassic_Lobby_Server
{ {
class Program class Program
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
#if DEBUG #if DEBUG
@ -21,36 +18,33 @@ namespace FFXIVClassic_Lobby_Server
bool startServer = true; bool startServer = true;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("--------FFXIV 1.0 Lobby Server--------");
Console.ForegroundColor = ConsoleColor.Gray;
Assembly assem = Assembly.GetExecutingAssembly();
Version vers = assem.GetName().Version;
Console.WriteLine("Version: " + vers.ToString());
//Load Config //Load Config
if (!ConfigConstants.load()) if (!ConfigConstants.load())
startServer = false; startServer = false;
Log.log("--------FFXIV 1.0 Lobby Server--------", Log.LogType.Debug);
Assembly assem = Assembly.GetExecutingAssembly();
Version vers = assem.GetName().Version;
Log.info("Version: " + vers.ToString());
//Test DB Connection //Test DB Connection
Console.Write("Testing DB connection to \"{0}\"... ", ConfigConstants.DATABASE_HOST); Log.info(String.Format("Testing DB connection to \"{0}\"... ", ConfigConstants.DATABASE_HOST));
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD))) using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
{ {
try try
{ {
conn.Open(); conn.Open();
conn.Close(); conn.Close();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("[OK]"); Log.conn("[OK]");
Console.ForegroundColor = ConsoleColor.Gray;
} }
catch (MySqlException e) catch (MySqlException e)
{ {
Console.ForegroundColor = ConsoleColor.Red; Log.error(e.ToString());
Console.WriteLine("[FAILED]"); Log.error("[FAILED]");
Console.ForegroundColor = ConsoleColor.Gray;
startServer = false; startServer = false;
} }
} }
@ -64,7 +58,7 @@ namespace FFXIVClassic_Lobby_Server
while (true) Thread.Sleep(10000); while (true) Thread.Sleep(10000);
} }
Console.WriteLine("Press any key to continue..."); Log.info("Press any key to continue...");
Console.ReadKey(); Console.ReadKey();
} }

View file

@ -1,5 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following

View file

@ -1,13 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Threading.Tasks;
using System.Threading; using System.Threading;
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Lobby_Server.common;
namespace FFXIVClassic_Lobby_Server namespace FFXIVClassic_Lobby_Server
{ {
@ -28,7 +25,7 @@ namespace FFXIVClassic_Lobby_Server
private void socketCleanup() private void socketCleanup()
{ {
Console.WriteLine("Cleanup thread started; it will run every {0} seconds.", CLEANUP_THREAD_SLEEP_TIME); Log.debug(String.Format("Cleanup thread started; it will run every {0} seconds.", CLEANUP_THREAD_SLEEP_TIME));
while (!killCleanupThread) while (!killCleanupThread)
{ {
int count = 0; int count = 0;
@ -55,7 +52,7 @@ namespace FFXIVClassic_Lobby_Server
//cleanupThread.Name = "LobbyThread:Cleanup"; //cleanupThread.Name = "LobbyThread:Cleanup";
//cleanupThread.Start(); //cleanupThread.Start();
IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), FFXIV_LOBBY_PORT); IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), int.Parse(ConfigConstants.OPTIONS_PORT));
try{ try{
mServerSocket = new System.Net.Sockets.Socket(serverEndPoint.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp); mServerSocket = new System.Net.Sockets.Socket(serverEndPoint.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
@ -82,9 +79,8 @@ namespace FFXIVClassic_Lobby_Server
throw new ApplicationException("Error occured starting listeners, check inner exception", e); throw new ApplicationException("Error occured starting listeners, check inner exception", e);
} }
Console.Write("Server has started @ ");
Console.ForegroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("{0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port); Log.debug(String.Format("Lobby Server has started @ {0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port));
Console.ForegroundColor = ConsoleColor.Gray; Console.ForegroundColor = ConsoleColor.Gray;
mProcessor = new PacketProcessor(); mProcessor = new PacketProcessor();

View file

@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.common namespace FFXIVClassic_Lobby_Server.common
{ {

View file

@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.common namespace FFXIVClassic_Lobby_Server.common
{ {

View file

@ -1,56 +1,73 @@
using System; using System;
using System.Collections.Generic; using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.common namespace FFXIVClassic_Lobby_Server.common
{ {
class Log class Log
{ {
public enum LogType
{
Error = ConsoleColor.Red,
Debug = ConsoleColor.Yellow,
Info = ConsoleColor.Cyan,
Sql = ConsoleColor.Magenta,
Conn = ConsoleColor.Green,
Default = ConsoleColor.Gray
}
public static void error(String message) public static void error(String message)
{ {
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm")); log(message, LogType.Error);
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("[ERROR] ");
Console.ForegroundColor = ConsoleColor.Gray ;
Console.WriteLine(message);
} }
public static void debug(String message) public static void debug(String message)
{ {
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm")); #if DEBUG
Console.ForegroundColor = ConsoleColor.Yellow; log(message, LogType.Debug);
Console.Write("[DEBUG] "); #endif
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine(message);
} }
public static void info(String message) public static void info(String message)
{ {
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm")); log(message, LogType.Info);
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("[INFO] ");
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine(message);
} }
public static void database(String message) public static void database(String message)
{ {
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm")); log(message, LogType.Sql);
Console.ForegroundColor = ConsoleColor.Magenta;
Console.Write("[SQL] ");
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine(message);
} }
public static void conn(String message) public static void conn(String message)
{ {
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm")); log(message, LogType.Conn);
Console.ForegroundColor = ConsoleColor.Green; }
Console.Write("[CONN] ");
public static void log(String message, LogType type)
{
var timestamp = String.Format("[{0}] ", DateTime.Now.ToString("dd/MMM HH:mm:ss"));
var typestr = String.Format("[{0}] ", type.ToString().ToUpper());
Console.Write(timestamp);
Console.ForegroundColor = (ConsoleColor)type;
Console.Write(typestr);
Console.ForegroundColor = ConsoleColor.Gray; Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine(message); Console.WriteLine(message);
message = message.Insert(0, typestr);
message = message.Insert(0, timestamp);
Directory.CreateDirectory(ConfigConstants.OPTIONS_LOGPATH);
try
{
File.AppendAllText(ConfigConstants.OPTIONS_LOGPATH + ConfigConstants.OPTIONS_LOGFILE, message + Environment.NewLine);
}
catch (Exception e)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.Write(e.Message);
Console.ForegroundColor = ConsoleColor.Gray;
}
} }
} }
} }

View file

@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.common namespace FFXIVClassic_Lobby_Server.common
{ {
@ -23,26 +20,64 @@ namespace FFXIVClassic_Lobby_Server.common
public static string ByteArrayToHex(byte[] bytes) public static string ByteArrayToHex(byte[] bytes)
{ {
var lookup32 = _lookup32; if (bytes == null) return "<null>";
var result = new char[(bytes.Length * 3) + ((bytes.Length / 16) < 1 ? 1 : (bytes.Length / 16) * 3) + bytes.Length + 60]; int bytesLength = bytes.Length;
int numNewLines = 0; var bytesPerLine = 16;
for (int i = 0; i < bytes.Length; i++) char[] HexChars = "0123456789ABCDEF".ToCharArray();
{
var val = lookup32[bytes[i]]; int firstHexColumn =
result[(3 * i) + (17 * numNewLines) + 0] = (char)val; 8 // 8 characters for the address
result[(3 * i) + (17 * numNewLines) + 1] = (char)(val >> 16); + 3; // 3 spaces
result[(3 * i) + (17 * numNewLines) + 2] = ' ';
int firstCharColumn = firstHexColumn
result[(numNewLines * (3 * 16 + 17)) + (3 * 16) + (i % 16)] = (char)bytes[i] >= 32 && (char)bytes[i] <= 126 ? (char)bytes[i] : '.'; + bytesPerLine * 3 // - 2 digit for the hexadecimal value and 1 space
+ (bytesPerLine - 1) / 8 // - 1 extra space every 8 characters from the 9th
if (i != bytes.Length - 1 && bytes.Length > 16 && i != 0 && (i + 1) % 16 == 0) + 2; // 2 spaces
{
result[(numNewLines * (3 * 16 + 17)) + (3 * 16) + (16)] = '\n'; int lineLength = firstCharColumn
numNewLines++; + bytesPerLine // - characters to show the ascii value
} + Environment.NewLine.Length; // Carriage return and line feed (should normally be 2)
} char[] line = (new String(' ', lineLength - Environment.NewLine.Length) + Environment.NewLine).ToCharArray();
return new string(result); int expectedLines = (bytesLength + bytesPerLine - 1) / bytesPerLine;
StringBuilder result = new StringBuilder(expectedLines * lineLength);
for (int i = 0; i < bytesLength; i += bytesPerLine)
{
line[0] = HexChars[(i >> 28) & 0xF];
line[1] = HexChars[(i >> 24) & 0xF];
line[2] = HexChars[(i >> 20) & 0xF];
line[3] = HexChars[(i >> 16) & 0xF];
line[4] = HexChars[(i >> 12) & 0xF];
line[5] = HexChars[(i >> 8) & 0xF];
line[6] = HexChars[(i >> 4) & 0xF];
line[7] = HexChars[(i >> 0) & 0xF];
int hexColumn = firstHexColumn;
int charColumn = firstCharColumn;
for (int j = 0; j < bytesPerLine; j++)
{
if (j > 0 && (j & 7) == 0) hexColumn++;
if (i + j >= bytesLength)
{
line[hexColumn] = ' ';
line[hexColumn + 1] = ' ';
line[charColumn] = ' ';
}
else
{
byte b = bytes[i + j];
line[hexColumn] = HexChars[(b >> 4) & 0xF];
line[hexColumn + 1] = HexChars[b & 0xF];
line[charColumn] = (b < 32 ? '.' : (char)b);
}
hexColumn += 3;
charColumn++;
}
result.Append(line);
}
return Environment.NewLine + result.ToString();
} }
public static UInt32 UnixTimeStampUTC() public static UInt32 UnixTimeStampUTC()

View file

@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.dataobjects namespace FFXIVClassic_Lobby_Server.dataobjects
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Lobby_Server.dataobjects
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.dataobjects
{ {
class Appearance class Appearance
{ {

View file

@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Lobby_Server.common;
using System.IO; using System.IO;
@ -231,7 +227,7 @@ namespace FFXIVClassic_Lobby_Server.dataobjects
{ {
byte[] bytes = File.ReadAllBytes("./packets/charaappearance.bin"); byte[] bytes = File.ReadAllBytes("./packets/charaappearance.bin");
Console.WriteLine(Utils.ByteArrayToHex(bytes)); Log.debug(Utils.ByteArrayToHex(bytes));
return Convert.ToBase64String(bytes).Replace('+', '-').Replace('/', '_'); return Convert.ToBase64String(bytes).Replace('+', '-').Replace('/', '_');
} }

View file

@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Lobby_Server.dataobjects; using FFXIVClassic_Lobby_Server.dataobjects;
@ -37,9 +33,9 @@ namespace FFXIVClassic_Lobby_Server
charaInfo.Replace("/", "_"); charaInfo.Replace("/", "_");
byte[] data = System.Convert.FromBase64String(charaInfo); byte[] data = System.Convert.FromBase64String(charaInfo);
Console.WriteLine("------------Base64 printout------------------"); Log.debug("------------Base64 printout------------------");
Console.WriteLine(Utils.ByteArrayToHex(data)); Log.debug(Utils.ByteArrayToHex(data));
Console.WriteLine("------------Base64 printout------------------"); Log.debug("------------Base64 printout------------------");
CharaInfo chara = new CharaInfo(); CharaInfo chara = new CharaInfo();

View file

@ -1,11 +1,4 @@
using System; namespace FFXIVClassic_Lobby_Server
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FFXIVClassic_Lobby_Server.common;
namespace FFXIVClassic_Lobby_Server
{ {
class Retainer class Retainer
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Lobby_Server.dataobjects
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.dataobjects
{ {
class World class World
{ {

View file

@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Diagnostics; using System.Diagnostics;
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Lobby_Server.common;
@ -338,8 +335,8 @@ namespace FFXIVClassic_Lobby_Server.packets
{ {
#if DEBUG #if DEBUG
Console.BackgroundColor = ConsoleColor.DarkYellow; Console.BackgroundColor = ConsoleColor.DarkYellow;
Console.WriteLine("IsAuthed: {0}, IsEncrypted: {1}, Size: 0x{2:X}, Num Subpackets: {3}", header.isAuthenticated, header.isEncrypted, header.packetSize, header.numSubpackets); Log.debug(String.Format("IsAuthed: {0}, IsEncrypted: {1}, Size: 0x{2:X}, Num Subpackets: {3}", header.isAuthenticated, header.isEncrypted, header.packetSize, header.numSubpackets));
Console.WriteLine("{0}", Utils.ByteArrayToHex(getHeaderBytes())); Log.debug(String.Format("{0}", Utils.ByteArrayToHex(getHeaderBytes())));
foreach (SubPacket sub in getSubpackets()) foreach (SubPacket sub in getSubpackets())
sub.debugPrintSubPacket(); sub.debugPrintSubPacket();
Console.BackgroundColor = ConsoleColor.Black; Console.BackgroundColor = ConsoleColor.Black;

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Lobby_Server.packets
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.packets
{ {
class HardCoded_Packets class HardCoded_Packets
{ {

View file

@ -1,10 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using FFXIVClassic_Lobby_Server;
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Lobby_Server.common;
namespace FFXIVClassic_Lobby_Server.packets namespace FFXIVClassic_Lobby_Server.packets
@ -146,14 +141,14 @@ namespace FFXIVClassic_Lobby_Server.packets
{ {
#if DEBUG #if DEBUG
Console.BackgroundColor = ConsoleColor.DarkRed; Console.BackgroundColor = ConsoleColor.DarkRed;
Console.WriteLine("Size: 0x{0:X}", header.subpacketSize); Log.debug(String.Format("Size: 0x{0:X}", header.subpacketSize));
if (header.type == 0x03) if (header.type == 0x03)
Console.WriteLine("Opcode: 0x{0:X}", gameMessage.opcode); Log.debug(String.Format("Opcode: 0x{0:X}", gameMessage.opcode));
Console.WriteLine("{0}", Utils.ByteArrayToHex(getHeaderBytes())); Log.debug(String.Format("{0}", Utils.ByteArrayToHex(getHeaderBytes())));
if (header.type == 0x03) if (header.type == 0x03)
Console.WriteLine("{0}", Utils.ByteArrayToHex(getGameMessageBytes())); Log.debug(String.Format("{0}", Utils.ByteArrayToHex(getGameMessageBytes())));
Console.BackgroundColor = ConsoleColor.DarkMagenta; Console.BackgroundColor = ConsoleColor.DarkMagenta;
Console.WriteLine("{0}", Utils.ByteArrayToHex(data)); Log.debug(String.Format("{0}", Utils.ByteArrayToHex(data)));
Console.BackgroundColor = ConsoleColor.Black; Console.BackgroundColor = ConsoleColor.Black;
#endif #endif
} }

View file

@ -1,9 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.packets.receive namespace FFXIVClassic_Lobby_Server.packets.receive
{ {

View file

@ -1,9 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.packets.receive namespace FFXIVClassic_Lobby_Server.packets.receive
{ {

View file

@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.packets.receive namespace FFXIVClassic_Lobby_Server.packets.receive
{ {

View file

@ -1,9 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.packets.receive namespace FFXIVClassic_Lobby_Server.packets.receive
{ {

View file

@ -2,9 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.packets namespace FFXIVClassic_Lobby_Server.packets
{ {

View file

@ -1,9 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.packets namespace FFXIVClassic_Lobby_Server.packets
{ {

View file

@ -1,11 +1,8 @@
using FFXIVClassic_Lobby_Server.dataobjects; using FFXIVClassic_Lobby_Server.dataobjects;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.packets namespace FFXIVClassic_Lobby_Server.packets
{ {

View file

@ -1,9 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.packets namespace FFXIVClassic_Lobby_Server.packets
{ {

View file

@ -1,10 +1,7 @@
using FFXIVClassic_Lobby_Server.dataobjects; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.packets namespace FFXIVClassic_Lobby_Server.packets
{ {

View file

@ -1,10 +1,7 @@
using FFXIVClassic_Lobby_Server.dataobjects; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.packets namespace FFXIVClassic_Lobby_Server.packets
{ {

View file

@ -1,9 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.packets namespace FFXIVClassic_Lobby_Server.packets
{ {

View file

@ -2,9 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.packets namespace FFXIVClassic_Lobby_Server.packets
{ {

View file

@ -1,8 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.utils namespace FFXIVClassic_Lobby_Server.utils
{ {

View file

@ -1,18 +1,11 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Sockets; using System.Net.Sockets;
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using System.Diagnostics; using FFXIVClassic_Map_Server.common;
using FFXIVClassic_Lobby_Server.common;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.IO;
using Cyotek.Collections.Generic;
using System.Net; using System.Net;
namespace FFXIVClassic_Lobby_Server namespace FFXIVClassic_Map_Server
{ {
class ClientConnection class ClientConnection
{ {

View file

@ -1,25 +1,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using FFXIVClassic_Map_Server.common;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
using System.Threading;
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Map_Server.dataobjects; using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using System.IO;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server;
using FFXIVClassic_Map_Server.packets.send; using FFXIVClassic_Map_Server.packets.send;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.actors.chara.player; using FFXIVClassic_Map_Server.actors.chara.player;
using FFXIVClassic_Map_Server.Properties; using FFXIVClassic_Map_Server.Properties;
namespace FFXIVClassic_Lobby_Server namespace FFXIVClassic_Map_Server
{ {
class CommandProcessor class CommandProcessor
{ {

View file

@ -1,18 +1,16 @@
using FFXIVClassic_Lobby_Server.common; using STA.Settings;
using STA.Settings;
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server namespace FFXIVClassic_Map_Server
{ {
class ConfigConstants class ConfigConstants
{ {
public static String OPTIONS_BINDIP; public static String OPTIONS_BINDIP;
public static String OPTIONS_PORT;
public static bool OPTIONS_TIMESTAMP = false; public static bool OPTIONS_TIMESTAMP = false;
public static String OPTIONS_LOGPATH;
public static String OPTIONS_LOGFILE;
public static uint DATABASE_WORLDID; public static uint DATABASE_WORLDID;
public static String DATABASE_HOST; public static String DATABASE_HOST;
@ -23,20 +21,23 @@ namespace FFXIVClassic_Lobby_Server
public static bool load() public static bool load()
{ {
Console.Write("Loading config.ini file... "); Console.Write("Loading map_config.ini file... ");
if (!File.Exists("./config.ini")) if (!File.Exists("./map_config.ini"))
{ {
Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("[FILE NOT FOUND]"); Console.WriteLine(String.Format("[FILE NOT FOUND]"));
Console.ForegroundColor = ConsoleColor.Gray; Console.ForegroundColor = ConsoleColor.Gray;
return false; return false;
} }
INIFile configIni = new INIFile("./config.ini"); INIFile configIni = new INIFile("./map_config.ini");
ConfigConstants.OPTIONS_BINDIP = configIni.GetValue("General", "server_ip", "127.0.0.1"); ConfigConstants.OPTIONS_BINDIP = configIni.GetValue("General", "server_ip", "127.0.0.1");
ConfigConstants.OPTIONS_PORT = configIni.GetValue("General", "server_port", "54992");
ConfigConstants.OPTIONS_TIMESTAMP = configIni.GetValue("General", "showtimestamp", "true").ToLower().Equals("true"); ConfigConstants.OPTIONS_TIMESTAMP = configIni.GetValue("General", "showtimestamp", "true").ToLower().Equals("true");
ConfigConstants.OPTIONS_LOGPATH = configIni.GetValue("General", "log_path", "./logs/");
ConfigConstants.OPTIONS_LOGFILE = configIni.GetValue("General", "log_file_name", String.Format("map_{0}_{1}.log", OPTIONS_BINDIP, OPTIONS_PORT));
ConfigConstants.DATABASE_WORLDID = configIni.GetValue("Database", "worldid", (uint)0); ConfigConstants.DATABASE_WORLDID = configIni.GetValue("Database", "worldid", (uint)0);
ConfigConstants.DATABASE_HOST = configIni.GetValue("Database", "host", ""); ConfigConstants.DATABASE_HOST = configIni.GetValue("Database", "host", "");
@ -46,7 +47,7 @@ namespace FFXIVClassic_Lobby_Server
ConfigConstants.DATABASE_PASSWORD = configIni.GetValue("Database", "password", ""); ConfigConstants.DATABASE_PASSWORD = configIni.GetValue("Database", "password", "");
Console.ForegroundColor = ConsoleColor.Green; Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("[OK]"); Console.WriteLine(String.Format("[OK]"));
Console.ForegroundColor = ConsoleColor.Gray; Console.ForegroundColor = ConsoleColor.Gray;
return true; return true;

View file

@ -1,24 +1,17 @@
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using Dapper; using Dapper;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using FFXIVClassic_Map_Server.common;
using System.Threading.Tasks;
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Map_Server.utils; using FFXIVClassic_Map_Server.utils;
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.packets.send.player; using FFXIVClassic_Map_Server.packets.send.player;
using FFXIVClassic_Lobby_Server.dataobjects;
using FFXIVClassic_Map_Server;
using FFXIVClassic_Map_Server.common.EfficientHashTables;
using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.dataobjects; using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.packets.send.Actor.inventory; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.actors.chara.player; using FFXIVClassic_Map_Server.actors.chara.player;
namespace FFXIVClassic_Lobby_Server namespace FFXIVClassic_Map_Server
{ {
class Database class Database
@ -43,7 +36,9 @@ namespace FFXIVClassic_Lobby_Server
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -63,7 +58,8 @@ namespace FFXIVClassic_Lobby_Server
world = conn.Query<DBWorld>("SELECT * FROM servers WHERE id=@ServerId", new {ServerId = serverId}).SingleOrDefault(); world = conn.Query<DBWorld>("SELECT * FROM servers WHERE id=@ServerId", new {ServerId = serverId}).SingleOrDefault();
} }
catch (MySqlException e) catch (MySqlException e)
{ {
Log.error(e.ToString());
} }
finally finally
{ {
@ -86,6 +82,7 @@ namespace FFXIVClassic_Lobby_Server
} }
catch (MySqlException e) catch (MySqlException e)
{ {
Log.error(e.ToString());
} }
finally finally
{ {
@ -140,7 +137,9 @@ namespace FFXIVClassic_Lobby_Server
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -196,7 +195,9 @@ namespace FFXIVClassic_Lobby_Server
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -230,7 +231,9 @@ namespace FFXIVClassic_Lobby_Server
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -270,7 +273,9 @@ namespace FFXIVClassic_Lobby_Server
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -302,7 +307,9 @@ namespace FFXIVClassic_Lobby_Server
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -352,7 +359,9 @@ namespace FFXIVClassic_Lobby_Server
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -780,7 +789,9 @@ namespace FFXIVClassic_Lobby_Server
player.getEquipment().SetEquipment(getEquipment(player, player.charaWork.parameterSave.state_mainSkill[0])); player.getEquipment().SetEquipment(getEquipment(player, player.charaWork.parameterSave.state_mainSkill[0]));
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -822,7 +833,9 @@ namespace FFXIVClassic_Lobby_Server
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -858,7 +871,9 @@ namespace FFXIVClassic_Lobby_Server
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -889,7 +904,9 @@ namespace FFXIVClassic_Lobby_Server
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -958,7 +975,9 @@ namespace FFXIVClassic_Lobby_Server
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -1012,7 +1031,9 @@ namespace FFXIVClassic_Lobby_Server
insertedItem = new InventoryItem((uint)cmd.LastInsertedId, itemId, quantity, (ushort)player.getInventory(type).getNextEmptySlot(), itemType, quality, durability, 0, 0, 0, 0, 0, 0); insertedItem = new InventoryItem((uint)cmd.LastInsertedId, itemId, quantity, (ushort)player.getInventory(type).getNextEmptySlot(), itemType, quality, durability, 0, 0, 0, 0, 0, 0);
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -1045,7 +1066,9 @@ namespace FFXIVClassic_Lobby_Server
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -1083,7 +1106,9 @@ namespace FFXIVClassic_Lobby_Server
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -1122,7 +1147,9 @@ namespace FFXIVClassic_Lobby_Server
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -1160,7 +1187,9 @@ namespace FFXIVClassic_Lobby_Server
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -1204,7 +1233,9 @@ namespace FFXIVClassic_Lobby_Server
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();

View file

@ -280,8 +280,7 @@
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>robocopy "$(SolutionDir)data" "$(SolutionDir)$(ProjectName)\$(OutDir)." /XO 2&gt;nul 1&gt;nul <PostBuildEvent>copy "$(SolutionDir)data\map_config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)"</PostBuildEvent>
EXIT 0</PostBuildEvent>
</PropertyGroup> </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.

View file

@ -1,40 +1,25 @@
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Map_Server.common;
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using MySql.Data.MySqlClient;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
using FFXIVClassic_Map_Server.dataobjects; using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.packets.receive; using FFXIVClassic_Map_Server.packets.receive;
using FFXIVClassic_Map_Server.packets.send; using FFXIVClassic_Map_Server.packets.send;
using FFXIVClassic_Map_Server.packets.send.login; using FFXIVClassic_Map_Server.packets.send.login;
using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
using FFXIVClassic_Map_Server.packets.send.Actor;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server;
using FFXIVClassic_Map_Server.packets.send.player;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.packets.send.supportdesk; using FFXIVClassic_Map_Server.packets.send.supportdesk;
using FFXIVClassic_Map_Server.packets.receive.social; using FFXIVClassic_Map_Server.packets.receive.social;
using FFXIVClassic_Map_Server.packets.send.social; using FFXIVClassic_Map_Server.packets.send.social;
using FFXIVClassic_Map_Server.packets.receive.supportdesk; using FFXIVClassic_Map_Server.packets.receive.supportdesk;
using FFXIVClassic_Map_Server.packets.receive.recruitment; using FFXIVClassic_Map_Server.packets.receive.recruitment;
using FFXIVClassic_Map_Server.packets.send.recruitment; using FFXIVClassic_Map_Server.packets.send.recruitment;
using FFXIVClassic_Map_Server.packets.send.list;
using FFXIVClassic_Map_Server.packets.receive.events; using FFXIVClassic_Map_Server.packets.receive.events;
using FFXIVClassic_Map_Server.packets.send.events;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using System.Net;
using FFXIVClassic_Map_Server.common.EfficientHashTables;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
namespace FFXIVClassic_Lobby_Server namespace FFXIVClassic_Map_Server
{ {
class PacketProcessor class PacketProcessor
{ {

View file

@ -1,17 +1,11 @@
using FFXIVClassic_Lobby_Server.packets; using System;
using System;
using System.Diagnostics; using System.Diagnostics;
using System.Threading;
using FFXIVClassic_Lobby_Server.common;
using System.Runtime.InteropServices;
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using System.Reflection; using System.Reflection;
using System.IO; using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Lobby_Server.dataobjects; using FFXIVClassic_Map_Server.common;
using System.Collections.Generic;
using System.Text;
namespace FFXIVClassic_Lobby_Server namespace FFXIVClassic_Map_Server
{ {
class Program class Program
{ {
@ -23,36 +17,30 @@ namespace FFXIVClassic_Lobby_Server
#endif #endif
bool startServer = true; bool startServer = true;
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("---------FFXIV 1.0 Map Server---------");
Console.ForegroundColor = ConsoleColor.Gray;
Assembly assem = Assembly.GetExecutingAssembly();
Version vers = assem.GetName().Version;
Console.WriteLine("Version: " + vers.ToString());
//Load Config //Load Config
if (!ConfigConstants.load()) if (!ConfigConstants.load())
startServer = false; startServer = false;
Log.info("---------FFXIV 1.0 Map Server---------");
Assembly assem = Assembly.GetExecutingAssembly();
Version vers = assem.GetName().Version;
Log.info("Version: " + vers.ToString());
//Test DB Connection //Test DB Connection
Console.Write("Testing DB connection... "); Log.info("Testing DB connection... ");
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD))) using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
{ {
try try
{ {
conn.Open(); conn.Open();
conn.Close(); conn.Close();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("[OK]"); Log.conn("[OK]");
Console.ForegroundColor = ConsoleColor.Gray;
} }
catch (MySqlException e) catch (MySqlException e)
{ {
Console.ForegroundColor = ConsoleColor.Red; Log.error(e.ToString());
Console.WriteLine("[FAILED]");
Console.ForegroundColor = ConsoleColor.Gray;
startServer = false; startServer = false;
} }
} }
@ -60,9 +48,9 @@ namespace FFXIVClassic_Lobby_Server
//Check World ID //Check World ID
DBWorld thisWorld = Database.getServer(ConfigConstants.DATABASE_WORLDID); DBWorld thisWorld = Database.getServer(ConfigConstants.DATABASE_WORLDID);
if (thisWorld != null) if (thisWorld != null)
Console.WriteLine("Successfully pulled world info from DB. Server name is {0}.", thisWorld.name); Log.info(String.Format("Successfully pulled world info from DB. Server name is {0}.", thisWorld.name));
else else
Console.WriteLine("World info could not be retrieved from the DB. Welcome and MOTD will not be displayed."); Log.info("World info could not be retrieved from the DB. Welcome and MOTD will not be displayed.");
//Start server if A-OK //Start server if A-OK
if (startServer) if (startServer)
@ -78,7 +66,7 @@ namespace FFXIVClassic_Lobby_Server
} }
} }
Console.WriteLine("Press any key to continue..."); Log.info("Press any key to continue...");
Console.ReadKey(); Console.ReadKey();
} }

View file

@ -1,5 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following

View file

@ -1,24 +1,15 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Threading.Tasks;
using System.Threading; using System.Threading;
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Map_Server.dataobjects; using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using System.IO; using FFXIVClassic_Map_Server.common;
using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server;
using FFXIVClassic_Map_Server.packets.send;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.actors.chara.player;
namespace FFXIVClassic_Lobby_Server namespace FFXIVClassic_Map_Server
{ {
class Server class Server
{ {
@ -93,7 +84,7 @@ namespace FFXIVClassic_Lobby_Server
mWorldManager.LoadZoneEntranceList(); mWorldManager.LoadZoneEntranceList();
mWorldManager.LoadNPCs(); mWorldManager.LoadNPCs();
IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), FFXIV_MAP_PORT); IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), int.Parse(ConfigConstants.OPTIONS_PORT));
try try
{ {
@ -121,9 +112,8 @@ namespace FFXIVClassic_Lobby_Server
throw new ApplicationException("Error occured starting listeners, check inner exception", e); throw new ApplicationException("Error occured starting listeners, check inner exception", e);
} }
Console.Write("Game server has started @ ");
Console.ForegroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("{0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port); Log.debug(String.Format("Map Server has started @ {0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port));
Console.ForegroundColor = ConsoleColor.Gray; Console.ForegroundColor = ConsoleColor.Gray;
mProcessor = new PacketProcessor(this, mConnectedPlayerList, mConnectionList); mProcessor = new PacketProcessor(this, mConnectedPlayerList, mConnectionList);

View file

@ -1,20 +1,12 @@
using FFXIVClassic_Lobby_Server; using FFXIVClassic_Map_Server.common;
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Map_Server.actors.area; using FFXIVClassic_Map_Server.actors.area;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.common.EfficientHashTables;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send; using FFXIVClassic_Map_Server.packets.send;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.packets.send.login;
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server namespace FFXIVClassic_Map_Server
{ {
@ -74,7 +66,10 @@ namespace FFXIVClassic_Map_Server
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -121,7 +116,9 @@ namespace FFXIVClassic_Map_Server
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -172,7 +169,9 @@ namespace FFXIVClassic_Map_Server
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -242,7 +241,9 @@ namespace FFXIVClassic_Map_Server
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -313,7 +314,9 @@ namespace FFXIVClassic_Map_Server
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();

View file

@ -1,19 +1,10 @@
using FFXIVClassic_Lobby_Server; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.actors; using FFXIVClassic_Map_Server.actors;
using FFXIVClassic_Map_Server.actors.area;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.packets.send.actor.events; using FFXIVClassic_Map_Server.packets.send.actor.events;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace FFXIVClassic_Map_Server.Actors namespace FFXIVClassic_Map_Server.Actors
{ {

View file

@ -1,8 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors namespace FFXIVClassic_Map_Server.actors
{ {

View file

@ -1,11 +1,9 @@
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Map_Server.common;
using FFXIVClassic_Map_Server.dataobjects;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors namespace FFXIVClassic_Map_Server.Actors
{ {

View file

@ -1,15 +1,9 @@
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using MoonSharp.Interpreter; using MoonSharp.Interpreter;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors namespace FFXIVClassic_Map_Server.Actors
{ {

View file

@ -1,12 +1,8 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.area namespace FFXIVClassic_Map_Server.actors.area
{ {

View file

@ -1,12 +1,8 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.area namespace FFXIVClassic_Map_Server.actors.area
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.Actors.Chara
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors.Chara
{ {
class AetheryteWork class AetheryteWork
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.Actors.Chara
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors.Chara
{ {
class BattleSave class BattleSave
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.Actors.Chara
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors.Chara
{ {
class BattleTemp class BattleTemp
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.Actors.Chara
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors.Chara
{ {
class CharaWork class CharaWork
{ {

View file

@ -1,11 +1,6 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.Actors.Chara; using FFXIVClassic_Map_Server.Actors.Chara;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors namespace FFXIVClassic_Map_Server.Actors
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.Actors.Chara
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors.Chara
{ {
class EventSave class EventSave
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.Actors.Chara
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors.Chara
{ {
class EventTemp class EventTemp
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.Actors.Chara
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors.Chara
{ {
class ParameterSave class ParameterSave
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.Actors.Chara
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors.Chara
{ {
class ParameterTemp class ParameterTemp
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.Actors.Chara
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors.Chara
{ {
class Work class Work
{ {

View file

@ -1,9 +1,7 @@
using FFXIVClassic_Lobby_Server; using FFXIVClassic_Map_Server.common;
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.actors; using FFXIVClassic_Map_Server.actors;
using FFXIVClassic_Map_Server.Actors.Chara; using FFXIVClassic_Map_Server.Actors.Chara;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.utils; using FFXIVClassic_Map_Server.utils;
@ -11,9 +9,6 @@ using MySql.Data.MySqlClient;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors namespace FFXIVClassic_Map_Server.Actors
{ {
@ -242,7 +237,9 @@ namespace FFXIVClassic_Map_Server.Actors
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } {
Log.error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.Actors.Chara
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors.Chara
{ {
class NpcWork class NpcWork
{ {

View file

@ -1,13 +1,8 @@
using FFXIVClassic_Lobby_Server; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.dataobjects; using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.packets.send.actor.inventory; using FFXIVClassic_Map_Server.packets.send.actor.inventory;
using FFXIVClassic_Map_Server.packets.send.Actor.inventory; using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.chara.player namespace FFXIVClassic_Map_Server.actors.chara.player
{ {

View file

@ -1,5 +1,4 @@
using FFXIVClassic_Lobby_Server; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.dataobjects; using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.packets.send.actor.inventory; using FFXIVClassic_Map_Server.packets.send.actor.inventory;
@ -7,8 +6,6 @@ using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.chara.player namespace FFXIVClassic_Map_Server.actors.chara.player
{ {

View file

@ -1,7 +1,5 @@
using FFXIVClassic_Lobby_Server; using FFXIVClassic_Map_Server.common;
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.actors.area;
using FFXIVClassic_Map_Server.actors.chara.player; using FFXIVClassic_Map_Server.actors.chara.player;
using FFXIVClassic_Map_Server.actors.director; using FFXIVClassic_Map_Server.actors.director;
using FFXIVClassic_Map_Server.dataobjects; using FFXIVClassic_Map_Server.dataobjects;
@ -10,19 +8,13 @@ using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send; using FFXIVClassic_Map_Server.packets.send;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.packets.send.actor.events; using FFXIVClassic_Map_Server.packets.send.actor.events;
using FFXIVClassic_Map_Server.packets.send.actor.inventory;
using FFXIVClassic_Map_Server.packets.send.Actor.inventory; using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
using FFXIVClassic_Map_Server.packets.send.events; using FFXIVClassic_Map_Server.packets.send.events;
using FFXIVClassic_Map_Server.packets.send.list; using FFXIVClassic_Map_Server.packets.send.list;
using FFXIVClassic_Map_Server.packets.send.login;
using FFXIVClassic_Map_Server.packets.send.player; using FFXIVClassic_Map_Server.packets.send.player;
using FFXIVClassic_Map_Server.utils; using FFXIVClassic_Map_Server.utils;
using MySql.Data.MySqlClient;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors namespace FFXIVClassic_Map_Server.Actors
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.dataobjects.chara
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects.chara
{ {
class PlayerWork class PlayerWork
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.Actors
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors
{ {
class Command : Actor class Command : Actor
{ {

View file

@ -1,12 +1,7 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors namespace FFXIVClassic_Map_Server.Actors
{ {

View file

@ -1,12 +1,8 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.director namespace FFXIVClassic_Map_Server.actors.director
{ {

View file

@ -1,12 +1,9 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.director namespace FFXIVClassic_Map_Server.actors.director
{ {

View file

@ -1,13 +1,9 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.actors.director; using FFXIVClassic_Map_Server.actors.director;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors namespace FFXIVClassic_Map_Server.Actors
{ {

View file

@ -1,12 +1,8 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.director namespace FFXIVClassic_Map_Server.actors.director
{ {

View file

@ -1,12 +1,8 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.director namespace FFXIVClassic_Map_Server.actors.director
{ {

View file

@ -1,12 +1,8 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.director namespace FFXIVClassic_Map_Server.actors.director
{ {

View file

@ -1,11 +1,4 @@
using FFXIVClassic_Map_Server.dataobjects; namespace FFXIVClassic_Map_Server.Actors
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors
{ {
class Judge : Actor class Judge : Actor
{ {

View file

@ -1,5 +1,4 @@
using FFXIVClassic_Lobby_Server; using FFXIVClassic_Map_Server.common;
using FFXIVClassic_Lobby_Server.common;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View file

@ -1,12 +1,7 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors namespace FFXIVClassic_Map_Server.Actors
{ {

View file

@ -1,10 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.common namespace FFXIVClassic_Map_Server.common
{ {
[global::System.AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] [global::System.AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
sealed class BitfieldLengthAttribute : Attribute sealed class BitfieldLengthAttribute : Attribute

View file

@ -1,10 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.common namespace FFXIVClassic_Map_Server.common
{ {
public class Blowfish public class Blowfish
{ {

View file

@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.common namespace FFXIVClassic_Map_Server.common
{ {

View file

@ -1,58 +1,73 @@
using System; using System;
using System.Collections.Generic; using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.common namespace FFXIVClassic_Map_Server.common
{ {
class Log class Log
{ {
public enum LogType
{
Error = ConsoleColor.Red,
Debug = ConsoleColor.Yellow,
Info = ConsoleColor.Cyan,
Sql = ConsoleColor.Magenta,
Conn = ConsoleColor.Green,
Default = ConsoleColor.Gray
}
public static void error(String message) public static void error(String message)
{ {
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm")); log(message, LogType.Error);
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("[ERROR] ");
Console.ForegroundColor = ConsoleColor.Gray ;
Console.WriteLine(message);
} }
public static void debug(String message) public static void debug(String message)
{ {
#if DEBUG #if DEBUG
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm")); log(message, LogType.Debug);
Console.ForegroundColor = ConsoleColor.Yellow; #endif
Console.Write("[DEBUG] ");
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine(message);
#endif
} }
public static void info(String message) public static void info(String message)
{ {
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm")); log(message, LogType.Info);
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("[INFO] ");
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine(message);
} }
public static void database(String message) public static void database(String message)
{ {
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm")); log(message, LogType.Sql);
Console.ForegroundColor = ConsoleColor.Magenta;
Console.Write("[SQL] ");
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine(message);
} }
public static void conn(String message) public static void conn(String message)
{ {
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm")); log(message, LogType.Conn);
Console.ForegroundColor = ConsoleColor.Green; }
Console.Write("[CONN] ");
private static void log(String message, LogType type)
{
var timestamp = String.Format("[{0}] ", DateTime.Now.ToString("dd/MMM HH:mm:ss"));
var typestr = String.Format("[{0}] ", type.ToString().ToUpper());
Console.Write(timestamp);
Console.ForegroundColor = (ConsoleColor)type;
Console.Write(typestr);
Console.ForegroundColor = ConsoleColor.Gray; Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine(message); Console.WriteLine(message);
message = message.Insert(0, typestr);
message = message.Insert(0, timestamp);
Directory.CreateDirectory(ConfigConstants.OPTIONS_LOGPATH);
try
{
File.AppendAllText(ConfigConstants.OPTIONS_LOGPATH + ConfigConstants.OPTIONS_LOGFILE, message + Environment.NewLine);
}
catch (Exception e)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.Write(e.Message);
Console.ForegroundColor = ConsoleColor.Gray;
}
} }
} }
} }

View file

@ -1,11 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.common namespace FFXIVClassic_Map_Server.common
{ {
static class Utils static class Utils
{ {
@ -24,26 +21,64 @@ namespace FFXIVClassic_Lobby_Server.common
public static string ByteArrayToHex(byte[] bytes) public static string ByteArrayToHex(byte[] bytes)
{ {
var lookup32 = _lookup32; if (bytes == null) return "<null>";
var result = new char[(bytes.Length * 3) + ((bytes.Length/16) < 1 ? 1 : (bytes.Length/16)*3) + bytes.Length+60]; int bytesLength = bytes.Length;
int numNewLines = 0; var bytesPerLine = 16;
for (int i = 0; i < bytes.Length; i++) char[] HexChars = "0123456789ABCDEF".ToCharArray();
{
var val = lookup32[bytes[i]]; int firstHexColumn =
result[(3 * i) + (17 * numNewLines) + 0] = (char)val; 8 // 8 characters for the address
result[(3 * i) + (17 * numNewLines) + 1] = (char)(val >> 16); + 3; // 3 spaces
result[(3 * i) + (17 * numNewLines) + 2] = ' ';
int firstCharColumn = firstHexColumn
result[(numNewLines * (3*16+17)) + (3 * 16) + (i % 16)] = (char)bytes[i] >= 32 && (char)bytes[i] <= 126 ? (char)bytes[i] : '.'; + bytesPerLine * 3 // - 2 digit for the hexadecimal value and 1 space
+ (bytesPerLine - 1) / 8 // - 1 extra space every 8 characters from the 9th
if (i != bytes.Length - 1 && bytes.Length > 16 && i != 0 && (i+1) % 16 == 0) + 2; // 2 spaces
{
result[(numNewLines * (3*16+17)) + (3 * 16) + (16)] = '\n'; int lineLength = firstCharColumn
numNewLines++; + bytesPerLine // - characters to show the ascii value
} + Environment.NewLine.Length; // Carriage return and line feed (should normally be 2)
} char[] line = (new String(' ', lineLength - Environment.NewLine.Length) + Environment.NewLine).ToCharArray();
return new string(result); int expectedLines = (bytesLength + bytesPerLine - 1) / bytesPerLine;
StringBuilder result = new StringBuilder(expectedLines * lineLength);
for (int i = 0; i < bytesLength; i += bytesPerLine)
{
line[0] = HexChars[(i >> 28) & 0xF];
line[1] = HexChars[(i >> 24) & 0xF];
line[2] = HexChars[(i >> 20) & 0xF];
line[3] = HexChars[(i >> 16) & 0xF];
line[4] = HexChars[(i >> 12) & 0xF];
line[5] = HexChars[(i >> 8) & 0xF];
line[6] = HexChars[(i >> 4) & 0xF];
line[7] = HexChars[(i >> 0) & 0xF];
int hexColumn = firstHexColumn;
int charColumn = firstCharColumn;
for (int j = 0; j < bytesPerLine; j++)
{
if (j > 0 && (j & 7) == 0) hexColumn++;
if (i + j >= bytesLength)
{
line[hexColumn] = ' ';
line[hexColumn + 1] = ' ';
line[charColumn] = ' ';
}
else
{
byte b = bytes[i + j];
line[hexColumn] = HexChars[(b >> 4) & 0xF];
line[hexColumn + 1] = HexChars[b & 0xF];
line[charColumn] = (b < 32 ? '.' : (char)b);
}
hexColumn += 3;
charColumn++;
}
result.Append(line);
}
return Environment.NewLine + result.ToString();
} }
public static UInt32 UnixTimeStampUTC() public static UInt32 UnixTimeStampUTC()
@ -223,7 +258,7 @@ namespace FFXIVClassic_Lobby_Server.common
offset += 4 + count2; offset += 4 + count2;
Console.WriteLine(result); Log.debug(result);
} }
} }

View file

@ -1,14 +1,9 @@
using FFXIVClassic_Lobby_Server; using FFXIVClassic_Map_Server.common;
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects namespace FFXIVClassic_Map_Server.dataobjects
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.dataobjects
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Lobby_Server.dataobjects
{ {
class DBWorld class DBWorld
{ {

View file

@ -1,10 +1,5 @@
using FFXIVClassic_Lobby_Server; using System;
using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects namespace FFXIVClassic_Map_Server.dataobjects
{ {

View file

@ -1,9 +1,5 @@
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects namespace FFXIVClassic_Map_Server.dataobjects
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.dataobjects
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects
{ {
class RecruitmentDetails class RecruitmentDetails
{ {

View file

@ -1,9 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects namespace FFXIVClassic_Map_Server.dataobjects
{ {

View file

@ -1,6 +1,5 @@
using FFXIVClassic_Lobby_Server; using FFXIVClassic_Map_Server.common;
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.actors.director; using FFXIVClassic_Map_Server.actors.director;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.dataobjects; using FFXIVClassic_Map_Server.dataobjects;
@ -13,9 +12,6 @@ using MoonSharp.Interpreter.Loaders;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.lua namespace FFXIVClassic_Map_Server.lua
{ {

View file

@ -1,10 +1,4 @@
using System; namespace FFXIVClassic_Map_Server.lua
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.lua
{ {
class LuaEvent class LuaEvent
{ {

View file

@ -1,13 +1,5 @@
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.packets.send;
using FFXIVClassic_Map_Server.packets.send.events;
using MoonSharp.Interpreter; using MoonSharp.Interpreter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.lua namespace FFXIVClassic_Map_Server.lua
{ {

View file

@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.lua namespace FFXIVClassic_Map_Server.lua
{ {

View file

@ -1,13 +1,7 @@
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.packets.send; using FFXIVClassic_Map_Server.packets.send;
using FFXIVClassic_Map_Server.packets.send.events;
using MoonSharp.Interpreter; using MoonSharp.Interpreter;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.lua namespace FFXIVClassic_Map_Server.lua
{ {

View file

@ -1,14 +1,11 @@
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Map_Server.common;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using MoonSharp.Interpreter; using MoonSharp.Interpreter;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server namespace FFXIVClassic_Map_Server
{ {

View file

@ -1,16 +1,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Diagnostics; using System.Diagnostics;
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Map_Server.common;
using System.IO; using System.IO;
namespace FFXIVClassic_Lobby_Server.packets namespace FFXIVClassic_Map_Server.packets
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct BasePacketHeader public struct BasePacketHeader
{ {
@ -336,8 +333,8 @@ namespace FFXIVClassic_Lobby_Server.packets
{ {
#if DEBUG #if DEBUG
Console.BackgroundColor = ConsoleColor.DarkYellow; Console.BackgroundColor = ConsoleColor.DarkYellow;
Console.WriteLine("IsAuthed: {0}, IsEncrypted: {1}, Size: 0x{2:X}, Num Subpackets: {3}", header.isAuthenticated, header.isCompressed, header.packetSize, header.numSubpackets); Log.debug(String.Format("IsAuthed: {0}, IsEncrypted: {1}, Size: 0x{2:X}, Num Subpackets: {3}", header.isAuthenticated, header.isCompressed, header.packetSize, header.numSubpackets));
Console.WriteLine("{0}", Utils.ByteArrayToHex(getHeaderBytes())); Log.debug(String.Format("{0}", Utils.ByteArrayToHex(getHeaderBytes())));
foreach (SubPacket sub in getSubpackets()) foreach (SubPacket sub in getSubpackets())
sub.debugPrintSubPacket(); sub.debugPrintSubPacket();
Console.BackgroundColor = ConsoleColor.Black; Console.BackgroundColor = ConsoleColor.Black;

View file

@ -1,13 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using FFXIVClassic_Lobby_Server; using FFXIVClassic_Map_Server.common;
using FFXIVClassic_Lobby_Server.common;
namespace FFXIVClassic_Lobby_Server.packets namespace FFXIVClassic_Map_Server.packets
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct SubPacketHeader public struct SubPacketHeader
@ -146,14 +141,14 @@ namespace FFXIVClassic_Lobby_Server.packets
{ {
#if DEBUG #if DEBUG
Console.BackgroundColor = ConsoleColor.DarkRed; Console.BackgroundColor = ConsoleColor.DarkRed;
Console.WriteLine("Size: 0x{0:X}", header.subpacketSize); Log.debug(String.Format("Size: 0x{0:X}", header.subpacketSize));
if (header.type == 0x03) if (header.type == 0x03)
Console.WriteLine("Opcode: 0x{0:X}", gameMessage.opcode); Log.debug(String.Format("Opcode: 0x{0:X}", gameMessage.opcode));
Console.WriteLine("{0}", Utils.ByteArrayToHex(getHeaderBytes())); Log.debug(String.Format("{0}", Utils.ByteArrayToHex(getHeaderBytes())));
if (header.type == 0x03) if (header.type == 0x03)
Console.WriteLine("{0}", Utils.ByteArrayToHex(getGameMessageBytes())); Log.debug(String.Format("{0}", Utils.ByteArrayToHex(getGameMessageBytes())));
Console.BackgroundColor = ConsoleColor.DarkMagenta; Console.BackgroundColor = ConsoleColor.DarkMagenta;
Console.WriteLine("{0}", Utils.ByteArrayToHex(data)); Log.debug(String.Format("{0}", Utils.ByteArrayToHex(data)));
Console.BackgroundColor = ConsoleColor.Black; Console.BackgroundColor = ConsoleColor.Black;
#endif #endif
} }

View file

@ -1,9 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.packets.receive namespace FFXIVClassic_Map_Server.packets.receive
{ {

View file

@ -1,9 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.packets.receive namespace FFXIVClassic_Map_Server.packets.receive
{ {

View file

@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.packets.receive namespace FFXIVClassic_Map_Server.packets.receive
{ {

View file

@ -1,10 +1,5 @@
using FFXIVClassic_Lobby_Server.packets; using System;
using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.packets.receive namespace FFXIVClassic_Map_Server.packets.receive
{ {

Some files were not shown because too many files have changed in this diff Show more