mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	added nlog logging (todo: custom logger for packets)
This commit is contained in:
		| @@ -46,7 +46,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                     socket.Send(packetBytes); | ||||
|                 } | ||||
|                 catch (Exception e) | ||||
|                 { Program.Log.Error(String.Format("Weird case, socket was d/ced: {0}", e)); } | ||||
|                 { Program.Log.Error("Weird case, socket was d/ced: {0}", e); } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -142,7 +142,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                 foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList) | ||||
|                 { | ||||
|                     Player p = entry.Value.getActor(); | ||||
|                     Program.Log.Info(String.Format("{0}\'s position: ZoneID: {1}, X: {2}, Y: {3}, Z: {4}, Rotation: {5}", p.customDisplayName, p.zoneId, p.positionX, p.positionY, p.positionZ, p.rotation)); | ||||
|                     Program.Log.Info("{0}\'s position: ZoneID: {1}, X: {2}, Y: {3}, Z: {4}, Rotation: {5}", p.customDisplayName, p.zoneId, p.positionX, p.positionY, p.positionZ, p.rotation); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| @@ -607,7 +607,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                 { | ||||
|                     if (client != null) | ||||
|                     { | ||||
|                         Program.Log.Info(String.Format("Got request to reset zone: {0}", client.getActor().zoneId)); | ||||
|                         Program.Log.Info("Got request to reset zone: {0}", client.getActor().zoneId); | ||||
|                         client.getActor().zone.clear(); | ||||
|                         client.getActor().zone.addActorToZone(client.getActor()); | ||||
|                         client.getActor().sendInstanceUpdate(); | ||||
| @@ -621,11 +621,11 @@ namespace FFXIVClassic_Map_Server | ||||
|                 #region !reloaditems | ||||
|                 else if (split[0].Equals("reloaditems")) | ||||
|                 { | ||||
|                     Program.Log.Info(String.Format("Got request to reload item gamedata")); | ||||
|                     Program.Log.Info("Got request to reload item gamedata"); | ||||
|                     sendMessage(client, "Reloading Item Gamedata..."); | ||||
|                     gamedataItems.Clear(); | ||||
|                     gamedataItems = Database.getItemGamedata(); | ||||
|                     Program.Log.Info(String.Format("Loaded {0} items.", gamedataItems.Count)); | ||||
|                     Program.Log.Info("Loaded {0} items.", gamedataItems.Count); | ||||
|                     sendMessage(client, String.Format("Loaded {0} items.", gamedataItems.Count)); | ||||
|                     return true; | ||||
|                 } | ||||
|   | ||||
| @@ -9,9 +9,6 @@ namespace FFXIVClassic_Map_Server | ||||
|         public static String OPTIONS_BINDIP; | ||||
|         public static String OPTIONS_PORT; | ||||
|         public static bool   OPTIONS_TIMESTAMP = false; | ||||
|         public static String OPTIONS_LOGPATH; | ||||
|         public static String OPTIONS_LOGFILE; | ||||
|         public static String OPTIONS_LOGLEVEL; | ||||
|  | ||||
|         public static uint   DATABASE_WORLDID; | ||||
|         public static String DATABASE_HOST; | ||||
| @@ -37,9 +34,6 @@ namespace FFXIVClassic_Map_Server | ||||
|             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_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.OPTIONS_LOGLEVEL =      configIni.GetValue("General", "log_level", "127"); | ||||
|  | ||||
|             ConfigConstants.DATABASE_WORLDID =      UInt32.Parse(configIni.GetValue("Database", "worldid", "0")); | ||||
|             ConfigConstants.DATABASE_HOST =         configIni.GetValue("Database", "host", ""); | ||||
| @@ -49,7 +43,7 @@ namespace FFXIVClassic_Map_Server | ||||
|             ConfigConstants.DATABASE_PASSWORD =     configIni.GetValue("Database", "password", ""); | ||||
|  | ||||
|             Console.ForegroundColor = ConsoleColor.Green; | ||||
|             Console.WriteLine(String.Format("[OK]")); | ||||
|             Console.WriteLine("[OK]"); | ||||
|             Console.ForegroundColor = ConsoleColor.Gray; | ||||
|  | ||||
|             return true; | ||||
|   | ||||
| @@ -322,7 +322,7 @@ namespace FFXIVClassic_Map_Server | ||||
|             int slot = player.getQuestSlot(quest.actorId); | ||||
|             if (slot == -1) | ||||
|             { | ||||
|                 Program.Log.Error(String.Format("Tried saving quest player didn't have: Player: {0:x}, QuestId: {0:x}", player.actorId, quest.actorId)); | ||||
|                 Program.Log.Error("Tried saving quest player didn't have: Player: {0:x}, QuestId: {0:x}", player.actorId, quest.actorId); | ||||
|                 return; | ||||
|             } | ||||
|             else | ||||
|   | ||||
| @@ -57,6 +57,10 @@ | ||||
|       <HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> | ||||
|       <Private>True</Private> | ||||
|     </Reference> | ||||
|     <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> | ||||
|       <HintPath>..\packages\NLog.4.3.5\lib\net45\NLog.dll</HintPath> | ||||
|       <Private>True</Private> | ||||
|     </Reference> | ||||
|     <Reference Include="System" /> | ||||
|     <Reference Include="System.Core" /> | ||||
|     <Reference Include="System.Xml.Linq" /> | ||||
| @@ -268,6 +272,12 @@ | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <None Include="App.config" /> | ||||
|     <Content Include="NLog.config"> | ||||
|       <CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||||
|     </Content> | ||||
|     <None Include="NLog.xsd"> | ||||
|       <SubType>Designer</SubType> | ||||
|     </None> | ||||
|     <None Include="packages.config" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|   | ||||
							
								
								
									
										45
									
								
								FFXIVClassic Map Server/NLog.config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								FFXIVClassic Map Server/NLog.config
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" | ||||
|       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|       xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" | ||||
|       autoReload="true" | ||||
|       throwExceptions="false" | ||||
|       internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log" > | ||||
|  | ||||
|  | ||||
|   <!-- optional, add some variabeles | ||||
|   https://github.com/nlog/NLog/wiki/Configuration-file#variables | ||||
|   --> | ||||
|   <variable name="myvar" value="myvalue"/> | ||||
|  | ||||
|   <!--  | ||||
|   See https://github.com/nlog/nlog/wiki/Configuration-file  | ||||
|   for information on customizing logging rules and outputs. | ||||
|    --> | ||||
|   <targets async="true"> | ||||
|  | ||||
|     <!--  | ||||
|     add your targets here  | ||||
|     See https://github.com/nlog/NLog/wiki/Targets for possible targets. | ||||
|     See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers. | ||||
|     --> | ||||
|        | ||||
|     <!-- | ||||
|     Write events to a file with the date in the filename.  | ||||
|     <target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log" | ||||
|             layout="${longdate} ${uppercase:${level}} ${message}" /> | ||||
|     --> | ||||
|       <target xsi:type="ColoredConsole" name="console" layout="[${longdate}] [${uppercase:${level}}] ${message}" /> | ||||
|       <target xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}/map.log" layout="[${longdate}] [${uppercase:${level}}] ${message}"/> | ||||
|   </targets> | ||||
|  | ||||
|   <rules> | ||||
|     <!-- add your logging rules here --> | ||||
|       <logger name='*' minlevel='Trace' writeTo='file' /> | ||||
|       <logger name='*' minlevel='Trace' writeTo='console' /> | ||||
|     <!-- | ||||
|     Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace)  to "f" | ||||
|     <logger name="*" minlevel="Debug" writeTo="f" /> | ||||
|     --> | ||||
|   </rules> | ||||
| </nlog> | ||||
							
								
								
									
										2601
									
								
								FFXIVClassic Map Server/NLog.xsd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2601
									
								
								FFXIVClassic Map Server/NLog.xsd
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -127,9 +127,9 @@ namespace FFXIVClassic_Map_Server | ||||
|                     player.setConnection(packet.header.connectionType, client); | ||||
|  | ||||
|                     if (packet.header.connectionType == BasePacket.TYPE_ZONE) | ||||
|                         Program.Log.Debug(String.Format("Got {0} connection for ActorID {1} @ {2}.", "zone", actorID, client.getAddress())); | ||||
|                         Program.Log.Debug("Got {0} connection for ActorID {1} @ {2}.", "zone", actorID, client.getAddress()); | ||||
|                     else if (packet.header.connectionType == BasePacket.TYPE_CHAT) | ||||
|                         Program.Log.Debug(String.Format("Got {0} connection for ActorID {1} @ {2}.", "chat", actorID, client.getAddress())); | ||||
|                         Program.Log.Debug("Got {0} connection for ActorID {1} @ {2}.", "chat", actorID, client.getAddress()); | ||||
|  | ||||
|                     //Create player actor | ||||
|                     reply1.debugPrintPacket(); | ||||
| @@ -180,7 +180,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                         //Chat Received | ||||
|                         case 0x0003: | ||||
|                             ChatMessagePacket chatMessage = new ChatMessagePacket(subpacket.data); | ||||
|                             Program.Log.Info(String.Format("Got type-{5} message: {0} @ {1}, {2}, {3}, Rot: {4}", chatMessage.message, chatMessage.posX, chatMessage.posY, chatMessage.posZ, chatMessage.posRot, chatMessage.logType)); | ||||
|                             Program.Log.Info("Got type-{5} message: {0} @ {1}, {2}, {3}, Rot: {4}", chatMessage.message, chatMessage.posX, chatMessage.posY, chatMessage.posZ, chatMessage.posRot, chatMessage.logType); | ||||
|                             subpacket.debugPrintSubPacket(); | ||||
|  | ||||
|                             if (chatMessage.message.StartsWith("!")) | ||||
| @@ -268,7 +268,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                                         ownerActor = player.getActor().currentDirector; | ||||
|                                     else | ||||
|                                     { | ||||
|                                         Program.Log.Debug(String.Format("\n===Event START===\nCould not find actor 0x{0:X} for event started by caller: 0x{1:X}\nEvent Starter: {2}\nParams: {3}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.triggerName, LuaUtils.dumpParams(eventStart.luaParams))); | ||||
|                                         Program.Log.Debug("\n===Event START===\nCould not find actor 0x{0:X} for event started by caller: 0x{1:X}\nEvent Starter: {2}\nParams: {3}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.triggerName, LuaUtils.dumpParams(eventStart.luaParams)); | ||||
|                                         break; | ||||
|                                     } | ||||
|                                 }                                     | ||||
| @@ -276,7 +276,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                              | ||||
|                             LuaEngine.doActorOnEventStarted(player.getActor(), ownerActor, eventStart); | ||||
|  | ||||
|                             Program.Log.Debug(String.Format("\n===Event START===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nEvent Starter: {4}\nParams: {5}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.val1, eventStart.val2, eventStart.triggerName, LuaUtils.dumpParams(eventStart.luaParams))); | ||||
|                             Program.Log.Debug("\n===Event START===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nEvent Starter: {4}\nParams: {5}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.val1, eventStart.val2, eventStart.triggerName, LuaUtils.dumpParams(eventStart.luaParams)); | ||||
|                             break; | ||||
|                         //Unknown, happens at npc spawn and cutscene play???? | ||||
|                         case 0x00CE: | ||||
| @@ -285,7 +285,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                         case 0x012E: | ||||
|                             subpacket.debugPrintSubPacket(); | ||||
|                             EventUpdatePacket eventUpdate = new EventUpdatePacket(subpacket.data); | ||||
|                             Program.Log.Debug(String.Format("\n===Event UPDATE===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nStep: 0x{4:X}\nParams: {5}", eventUpdate.actorID, eventUpdate.scriptOwnerActorID, eventUpdate.val1, eventUpdate.val2, eventUpdate.step, LuaUtils.dumpParams(eventUpdate.luaParams))); | ||||
|                             Program.Log.Debug("\n===Event UPDATE===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nStep: 0x{4:X}\nParams: {5}", eventUpdate.actorID, eventUpdate.scriptOwnerActorID, eventUpdate.val1, eventUpdate.val2, eventUpdate.step, LuaUtils.dumpParams(eventUpdate.luaParams)); | ||||
|  | ||||
|                             //Is it a static actor? If not look in the player's instance | ||||
|                             Actor updateOwnerActor = Server.getStaticActors(player.getActor().currentEventOwner); | ||||
| @@ -406,7 +406,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                             client.queuePacket(BasePacket.createPacket(EndGMTicketPacket.buildPacket(player.actorID), true, false)); | ||||
|                             break; | ||||
|                         default: | ||||
|                             Program.Log.Debug(String.Format("Unknown command 0x{0:X} received.", subpacket.gameMessage.opcode)); | ||||
|                             Program.Log.Debug("Unknown command 0x{0:X} received.", subpacket.gameMessage.opcode); | ||||
|                             subpacket.debugPrintSubPacket(); | ||||
|                             break; | ||||
|                     } | ||||
|   | ||||
| @@ -1,16 +1,21 @@ | ||||
| using System; | ||||
| using System.Diagnostics; | ||||
| using System.Threading; | ||||
| using System.Text; | ||||
| using MySql.Data.MySqlClient; | ||||
| using System.Reflection; | ||||
| using FFXIVClassic_Map_Server.dataobjects; | ||||
| using FFXIVClassic.Common; | ||||
| using NLog; | ||||
| using NLog.Targets; | ||||
| using NLog.Targets.Wrappers; | ||||
| using NLog.Config; | ||||
|  | ||||
| namespace FFXIVClassic_Map_Server | ||||
| { | ||||
|     class Program | ||||
|     { | ||||
|         public static Log Log; | ||||
|         public static Logger Log; | ||||
|  | ||||
|         static void Main(string[] args) | ||||
|         { | ||||
| @@ -22,22 +27,11 @@ namespace FFXIVClassic_Map_Server | ||||
|  | ||||
|             //Load Config | ||||
|             if (!ConfigConstants.load()) | ||||
|                 startServer = false; | ||||
|  | ||||
|             Log = new Log(ConfigConstants.OPTIONS_LOGPATH, ConfigConstants.OPTIONS_LOGFILE, Int32.Parse(ConfigConstants.OPTIONS_LOGLEVEL)); | ||||
|  | ||||
|             Thread thread = new Thread(() => | ||||
|             { | ||||
|                 while (true) | ||||
|                 { | ||||
|                     if (Log.LogQueue.Count > 0) | ||||
|                     { | ||||
|                         var message = Program.Log.LogQueue.Dequeue(); | ||||
|                         Program.Log.WriteMessage(message.Item1, message.Item2); | ||||
|                     } | ||||
|                 } | ||||
|             }); | ||||
|             thread.Start(); | ||||
|                 startServer = false; | ||||
|  | ||||
|             // set up logging | ||||
|  | ||||
|             Log = LogManager.GetCurrentClassLogger(); | ||||
|  | ||||
|             Program.Log.Info("---------FFXIV 1.0 Map Server---------");             | ||||
|  | ||||
| @@ -54,7 +48,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                     conn.Open(); | ||||
|                     conn.Close(); | ||||
|  | ||||
|                     Program.Log.Status("[OK]"); | ||||
|                     Program.Log.Info("[OK]"); | ||||
|                 } | ||||
|                 catch (MySqlException e) | ||||
|                 { | ||||
| @@ -66,7 +60,7 @@ namespace FFXIVClassic_Map_Server | ||||
|             //Check World ID | ||||
|             DBWorld thisWorld = Database.getServer(ConfigConstants.DATABASE_WORLDID); | ||||
|             if (thisWorld != null) | ||||
|                 Program.Log.Info(String.Format("Successfully pulled world info from DB. Server name is {0}.", thisWorld.name)); | ||||
|                 Program.Log.Info("Successfully pulled world info from DB. Server name is {0}.", thisWorld.name); | ||||
|             else | ||||
|                 Program.Log.Info("World info could not be retrieved from the DB. Welcome and MOTD will not be displayed."); | ||||
|  | ||||
| @@ -77,9 +71,10 @@ namespace FFXIVClassic_Map_Server | ||||
|                 CommandProcessor cp = new CommandProcessor(server.getConnectedPlayerList()); | ||||
|                 server.startServer(); | ||||
|  | ||||
|                 while (true) | ||||
|                 while (startServer) | ||||
|                 { | ||||
|                     String input = Console.ReadLine(); | ||||
|                     Log.Info("[Console Input] " + input); | ||||
|                     cp.doCommand(input, null);   | ||||
|                 } | ||||
|             } | ||||
|   | ||||
| @@ -6,6 +6,7 @@ using System.Threading; | ||||
| using FFXIVClassic_Map_Server.dataobjects; | ||||
| using FFXIVClassic_Map_Server.packets; | ||||
| using FFXIVClassic.Common; | ||||
| using NLog; | ||||
| using FFXIVClassic_Map_Server.Actors; | ||||
| using FFXIVClassic_Map_Server.lua; | ||||
|  | ||||
| @@ -39,7 +40,7 @@ namespace FFXIVClassic_Map_Server | ||||
|  | ||||
|         private void connectionHealth() | ||||
|         { | ||||
|             Program.Log.Info(String.Format("Connection Health thread started; it will run every {0} seconds.", HEALTH_THREAD_SLEEP_TIME)); | ||||
|             Program.Log.Info("Connection Health thread started; it will run every {0} seconds.", HEALTH_THREAD_SLEEP_TIME); | ||||
|             while (!killHealthThread) | ||||
|             { | ||||
|                 lock (mConnectedPlayerList) | ||||
| @@ -77,7 +78,7 @@ namespace FFXIVClassic_Map_Server | ||||
|             mStaticActors = new StaticActors(STATIC_ACTORS_PATH); | ||||
|  | ||||
|             gamedataItems = Database.getItemGamedata(); | ||||
|             Program.Log.Info(String.Format("Loaded {0} items.", gamedataItems.Count)); | ||||
|             Program.Log.Info("Loaded {0} items.", gamedataItems.Count); | ||||
|  | ||||
|             mWorldManager = new WorldManager(this); | ||||
|             mWorldManager.LoadZoneList(); | ||||
| @@ -113,7 +114,7 @@ namespace FFXIVClassic_Map_Server | ||||
|             } | ||||
|  | ||||
|             Console.ForegroundColor = ConsoleColor.White; | ||||
|             Program.Log.Debug(String.Format("Map Server has started @ {0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port)); | ||||
|             Program.Log.Debug("Map Server has started @ {0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port); | ||||
|             Console.ForegroundColor = ConsoleColor.Gray; | ||||
|  | ||||
|             mProcessor = new PacketProcessor(this, mConnectedPlayerList, mConnectionList); | ||||
| @@ -150,7 +151,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                     mConnectionList.Add(conn); | ||||
|                 } | ||||
|  | ||||
|                 Program.Log.Status(String.Format("Connection {0}:{1} has connected.", (conn.socket.RemoteEndPoint as IPEndPoint).Address, (conn.socket.RemoteEndPoint as IPEndPoint).Port)); | ||||
|                 Program.Log.Info("Connection {0}:{1} has connected.", (conn.socket.RemoteEndPoint as IPEndPoint).Address, (conn.socket.RemoteEndPoint as IPEndPoint).Port); | ||||
|                 //Queue recieving of data from the connection | ||||
|                 conn.socket.BeginReceive(conn.buffer, 0, conn.buffer.Length, SocketFlags.None, new AsyncCallback(receiveCallback), conn); | ||||
|                 //Queue the accept of the next incomming connection | ||||
| @@ -217,7 +218,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                     mConnectionList.Remove(conn); | ||||
|                 } | ||||
|                 if (conn.connType == BasePacket.TYPE_ZONE) | ||||
|                     Program.Log.Status(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner)); | ||||
|                     Program.Log.Info("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
| @@ -261,7 +262,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     Program.Log.Status(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner)); | ||||
|                     Program.Log.Info("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner); | ||||
|  | ||||
|                     lock (mConnectionList) | ||||
|                     { | ||||
| @@ -273,7 +274,7 @@ namespace FFXIVClassic_Map_Server | ||||
|             { | ||||
|                 if (conn.socket != null) | ||||
|                 { | ||||
|                     Program.Log.Status(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner)); | ||||
|                     Program.Log.Info("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner); | ||||
|  | ||||
|                     lock (mConnectionList) | ||||
|                     { | ||||
|   | ||||
| @@ -125,7 +125,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             Program.Log.Info(String.Format("Loaded {0} zones and {1} private areas.", count1, count2)); | ||||
|             Program.Log.Info("Loaded {0} zones and {1} private areas.", count1, count2); | ||||
|         } | ||||
|  | ||||
|         public void LoadZoneEntranceList() | ||||
| @@ -178,7 +178,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             Program.Log.Info(String.Format("Loaded {0} zone spawn locations.", count)); | ||||
|             Program.Log.Info("Loaded {0} zone spawn locations.", count); | ||||
|         } | ||||
|  | ||||
|         public void LoadNPCs() | ||||
| @@ -250,7 +250,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             Program.Log.Info(String.Format("Loaded {0} npc(s).", count)); | ||||
|             Program.Log.Info("Loaded {0} npc(s).", count); | ||||
|         } | ||||
|  | ||||
|         public void LoadNPCs(uint zoneId) | ||||
| @@ -323,7 +323,7 @@ namespace FFXIVClassic_Map_Server | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             Program.Log.Info(String.Format("Loaded {0} npc(s).", count)); | ||||
|             Program.Log.Info("Loaded {0} npc(s).", count); | ||||
|         } | ||||
|  | ||||
|         //Moves the actor to the new zone if exists. No packets are sent nor position changed. | ||||
|   | ||||
| @@ -91,7 +91,7 @@ namespace FFXIVClassic_Map_Server.Actors | ||||
|             catch(FileNotFoundException e) | ||||
|             { Program.Log.Error("Could not find staticactors file."); return false; } | ||||
|  | ||||
|             Program.Log.Info(String.Format("Loaded {0} static actors.", mStaticActors.Count())); | ||||
|             Program.Log.Info("Loaded {0} static actors.", mStaticActors.Count()); | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|   | ||||
| @@ -642,7 +642,7 @@ namespace FFXIVClassic_Map_Server.Actors | ||||
|             Database.savePlayerPlayTime(this); | ||||
|             Database.savePlayerPosition(this); | ||||
|  | ||||
|             Program.Log.Info(String.Format("{0} has been logged out and saved.", this.customDisplayName)); | ||||
|             Program.Log.Info("{0} has been logged out and saved.", this.customDisplayName); | ||||
|         } | ||||
|  | ||||
|         public Area getZone() | ||||
|   | ||||
| @@ -68,7 +68,7 @@ namespace FFXIVClassic_Map_Server.Actors | ||||
|         { | ||||
|             if (bitIndex >= 32) | ||||
|             { | ||||
|                 Program.Log.Error(String.Format("Tried to access bit flag >= 32 for questId: {0}", actorId)); | ||||
|                 Program.Log.Error("Tried to access bit flag >= 32 for questId: {0}", actorId); | ||||
|                 return; | ||||
|             } | ||||
|              | ||||
| @@ -86,7 +86,7 @@ namespace FFXIVClassic_Map_Server.Actors | ||||
|         { | ||||
|             if (bitIndex >= 32) | ||||
|             { | ||||
|                 Program.Log.Error(String.Format("Tried to access bit flag >= 32 for questId: {0}", actorId)); | ||||
|                 Program.Log.Error("Tried to access bit flag >= 32 for questId: {0}", actorId); | ||||
|                 return false; | ||||
|             } | ||||
|             else | ||||
|   | ||||
| @@ -217,7 +217,7 @@ namespace FFXIVClassic_Map_Server.lua | ||||
|             } | ||||
|             catch(SyntaxErrorException e) | ||||
|             { | ||||
|                 Program.Log.Error(String.Format("LUAERROR: {0}.", e.DecoratedMessage)); | ||||
|                 Program.Log.Error("LUAERROR: {0}.", e.DecoratedMessage); | ||||
|                 return null; | ||||
|             } | ||||
|             return script; | ||||
|   | ||||
| @@ -1,8 +1,11 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <packages> | ||||
|   <package id="Cyotek.CircularBuffer" version="1.0.0.0" targetFramework="net45" /> | ||||
|   <package id="Dapper" version="1.42" targetFramework="net45" /> | ||||
|   <package id="MoonSharp" version="1.2.1.0" targetFramework="net45" /> | ||||
|   <package id="MySql.Data" version="6.9.7" targetFramework="net45" /> | ||||
|   <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" /> | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <packages> | ||||
|   <package id="Cyotek.CircularBuffer" version="1.0.0.0" targetFramework="net45" /> | ||||
|   <package id="Dapper" version="1.42" targetFramework="net45" /> | ||||
|   <package id="MoonSharp" version="1.2.1.0" targetFramework="net45" /> | ||||
|   <package id="MySql.Data" version="6.9.7" targetFramework="net45" /> | ||||
|   <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" /> | ||||
|   <package id="NLog" version="4.3.5" targetFramework="net45" /> | ||||
|   <package id="NLog.Config" version="4.3.5" targetFramework="net45" /> | ||||
|   <package id="NLog.Schema" version="4.3.4" targetFramework="net45" /> | ||||
| </packages> | ||||
| @@ -334,7 +334,7 @@ namespace FFXIVClassic_Map_Server.packets | ||||
| #if DEBUG | ||||
|             Console.BackgroundColor = ConsoleColor.DarkYellow; | ||||
|  | ||||
|             Program.Log.Debug(String.Format("IsAuth: {0} IsEncrypted: {1}, Size: 0x{2:X}, NumSubpackets: {3}{4}{5}", header.isAuthenticated, header.isCompressed, header.packetSize, header.numSubpackets, Environment.NewLine, Utils.ByteArrayToHex(getHeaderBytes()))); | ||||
|             Program.Log.Debug("IsAuth: {0} IsEncrypted: {1}, Size: 0x{2:X}, NumSubpackets: {3}{4}{5}", header.isAuthenticated, header.isCompressed, header.packetSize, header.numSubpackets, Environment.NewLine, Utils.ByteArrayToHex(getHeaderBytes())); | ||||
|  | ||||
|             foreach (SubPacket sub in getSubpackets()) | ||||
|             { | ||||
|   | ||||
| @@ -142,15 +142,15 @@ namespace FFXIVClassic_Map_Server.packets | ||||
| #if DEBUG | ||||
|             Console.BackgroundColor = ConsoleColor.DarkRed; | ||||
|  | ||||
|             Program.Log.Debug(String.Format("Size: 0x{0:X}{1}{2}", header.subpacketSize, Environment.NewLine, Utils.ByteArrayToHex(getHeaderBytes()))); | ||||
|             Program.Log.Debug("Size: 0x{0:X}{1}{2}", header.subpacketSize, Environment.NewLine, Utils.ByteArrayToHex(getHeaderBytes())); | ||||
|              | ||||
|             if (header.type == 0x03) | ||||
|             { | ||||
|                 Program.Log.Debug(String.Format("Opcode: 0x{0:X}{1}{2}", gameMessage.opcode, Environment.NewLine, Utils.ByteArrayToHex(getGameMessageBytes(), SUBPACKET_SIZE))); | ||||
|                 Program.Log.Debug("Opcode: 0x{0:X}{1}{2}", gameMessage.opcode, Environment.NewLine, Utils.ByteArrayToHex(getGameMessageBytes(), SUBPACKET_SIZE)); | ||||
|  | ||||
|                 Console.BackgroundColor = ConsoleColor.DarkMagenta; | ||||
|  | ||||
|                 Program.Log.Debug(String.Format("Data: {0}{1}", Environment.NewLine, Utils.ByteArrayToHex(data, SUBPACKET_SIZE + GAMEMESSAGE_SIZE))); | ||||
|                 Program.Log.Debug("Data: {0}{1}", Environment.NewLine, Utils.ByteArrayToHex(data, SUBPACKET_SIZE + GAMEMESSAGE_SIZE)); | ||||
|             } | ||||
|  | ||||
|             Console.BackgroundColor = ConsoleColor.Black; | ||||
|   | ||||
| @@ -79,7 +79,7 @@ namespace FFXIVClassic_Map_Server.utils | ||||
|  | ||||
|                         cmd.Parameters["@placename"].Value = placenames[pId]; | ||||
|  | ||||
|                         Program.Log.Debug(String.Format("Wrote: {0}", id)); | ||||
|                         Program.Log.Debug("Wrote: {0}", id); | ||||
|                         cmd.ExecuteNonQuery(); | ||||
|  | ||||
|                     } | ||||
| @@ -137,7 +137,7 @@ namespace FFXIVClassic_Map_Server.utils | ||||
|                         cmd.Parameters["@id"].Value = id; | ||||
|                         cmd.Parameters["@displayNameId"].Value = nameId; | ||||
|  | ||||
|                         Program.Log.Debug(String.Format("Wrote: {0} : {1}", id, nameId)); | ||||
|                         Program.Log.Debug("Wrote: {0} : {1}", id, nameId); | ||||
|                         cmd.ExecuteNonQuery(); | ||||
|  | ||||
|                     } | ||||
| @@ -203,7 +203,7 @@ namespace FFXIVClassic_Map_Server.utils | ||||
|  | ||||
|                         cmd.Parameters["@id"].Value = id; | ||||
|  | ||||
|                         Program.Log.Debug(String.Format("Wrote: {0}", id));                         | ||||
|                         Program.Log.Debug("Wrote: {0}", id);                         | ||||
|                         cmd.ExecuteNonQuery(); | ||||
|  | ||||
|                     } | ||||
| @@ -288,7 +288,7 @@ namespace FFXIVClassic_Map_Server.utils | ||||
|                         else if (id == 1500) | ||||
|                             otherId = SetCompletedAchievementsPacket.CATEGORY_GRAND_COMPANY; | ||||
|  | ||||
|                         Program.Log.Debug(String.Format("Wrote: {0} : {1} : {2} : {3}", id, name, otherId, points)); | ||||
|                         Program.Log.Debug("Wrote: {0} : {1} : {2} : {3}", id, name, otherId, points); | ||||
|                         cmd.Parameters["@id"].Value = id; | ||||
|                         cmd.Parameters["@name"].Value = name; | ||||
|                         cmd.Parameters["@otherId"].Value = otherId;                         | ||||
|   | ||||
		Reference in New Issue
	
	Block a user