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

@ -92,7 +92,8 @@ namespace HISP.Game.Chat
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket);
GameServer.ShutdownServer();
GameServer.ShutdownServer("Administrator initiated");
return true;
}

View file

@ -24,7 +24,7 @@ namespace HISP.Game.Services
if (Item.ItemIdExist(stock))
this.Inventory.AddInfinity(Item.GetItemById(stock));
else
Logger.WarnPrint("Item ID: " + stock + " Does not exist.");
Logger.WarnPrint("Item ID: " + stock + " doesn't exist, but shop " + id + " stocks it");
}
ItemInstance[] instances = Database.GetShopInventory(this.Id);

View file

@ -30,8 +30,8 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.8.55.0")]
[assembly: AssemblyFileVersion("1.8.55.0")]
[assembly: AssemblyVersion("1.8.56.0")]
[assembly: AssemblyFileVersion("1.8.56.0")]

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)
{