Some improvements ..

This commit is contained in:
Li 2022-11-20 15:33:36 +13:00
parent 1909950409
commit d630abb66a
11 changed files with 51 additions and 39 deletions

View file

@ -1,7 +1,6 @@
using System;
using System.Net.Sockets;
using System.Threading;
using System.Collections.Generic;
using HISP.Player;
using HISP.Game;
using HISP.Game.Horse;
@ -9,7 +8,6 @@ using HISP.Game.Events;
using HISP.Game.Items;
using HISP.Util;
using HISP.Server.Network;
using System.Net;
namespace HISP.Server
{
@ -83,7 +81,7 @@ namespace HISP.Server
}
public static void OnShutdown()
public static void OnShutdown(string reason)
{
try
{
@ -101,8 +99,7 @@ namespace HISP.Server
client.LoggedinUser.TrackedItems.GetTrackedItem(Tracking.TrackableItem.GameUpdates).Count++;
Logger.DebugPrint("Kicking: " + client.LoggedinUser.Username);
}
client.Kick("Server shutdown.");
client.Kick("Server shutdown: "+reason);
}
}
catch (Exception) { };

View file

@ -416,7 +416,9 @@ namespace HISP.Server
if (gameData.quest_list[i].chained_questid != null)
quest.ChainedQuestId = gameData.quest_list[i].chained_questid;
quest.Minigame = gameData.quest_list[i].minigame;
Logger.DebugPrint("Registered Quest: " + quest.Id + " - " + quest.Title);
if(quest.Title.Trim() != "")
Logger.DebugPrint("Registered Quest: " + quest.Id + " - " + quest.Title);
Quest.AddQuestEntry(quest);
}

View file

@ -8240,12 +8240,12 @@ namespace HISP.Server
if (minuteTimer != null)
minuteTimer.Dispose();
}
public static void ShutdownServer()
public static void ShutdownServer(string shutdownReason = "No reason provided.")
{
Logger.InfoPrint("Server shutting down.");
Logger.InfoPrint("Server shutting down; " + shutdownReason);
try
{
GameClient.OnShutdown();
GameClient.OnShutdown(shutdownReason);
GameServer.OnShutdown();
Database.OnShutdown();
}

View file

@ -11,6 +11,14 @@ namespace HISP.Server
private static Action<bool, string, string> logFunction = defaultCallbackFunc;
private void log(bool error, string type, string text)
{
string[] msgs = text.Replace("\r", "").Split("\n");
foreach(string msg in msgs)
{
logFunction(error, type, msg);
}
}
public static void SetCallback(Action<bool, string, string> callback)
{