diff --git a/src/DiIiS-NA/Core/MPQ/Data.cs b/src/DiIiS-NA/Core/MPQ/Data.cs index d229589..70825bc 100644 --- a/src/DiIiS-NA/Core/MPQ/Data.cs +++ b/src/DiIiS-NA/Core/MPQ/Data.cs @@ -199,17 +199,19 @@ using (StreamWriter sw = new StreamWriter(writePath, false, System.Text.Encoding this.LoadSNODict(DictSNOWeathers, SNOGroup.Weather); this.LoadSNODict(DictSNOWorlds, SNOGroup.Worlds); this.LoadDBCatalog(); - + #if DEBUG SnoBreakdown(); + #endif } public void SnoBreakdown(bool fullBreakdown = false) { Console.WriteLine(); + if (Program.IsTargetEnabled("ansi")) + Console.Clear(); var breakdownChart = new BreakdownChart() .FullSize() .AddItem("Actor", DictSNOActor.Count, Color.Blue) - .AddItem("Boss Encounter", DictSNOBossEncounter.Count, Color.Aquamarine1) .AddItem("Effect Group", DictSNOEffectGroup.Count, Color.Yellow) .AddItem("Game Balance", DictSNOGameBalance.Count, Color.Cyan3) .AddItem("Monster", DictSNOMonster.Count, Color.Red) @@ -217,17 +219,18 @@ using (StreamWriter sw = new StreamWriter(writePath, false, System.Text.Encoding .AddItem("Quest", DictSNOQuest.Count, Color.Fuchsia) .AddItem("Quest Range", DictSNOQuestRange.Count, Color.Magenta2_1) .AddItem("Recipe", DictSNORecipe.Count, Color.Lime) - .AddItem("Scene", DictSNOScene.Count, Color.DarkOrange3) - .AddItem("Act", DictSNOAct.Count, Color.Green); + .AddItem("Scene", DictSNOScene.Count, Color.DarkOrange3); if (fullBreakdown) { breakdownChart.AddItem("Accolade", DictSNOAccolade.Count, Color.Gold1) + .AddItem("Boss Encounter", DictSNOBossEncounter.Count, Color.Cornsilk1) + .AddItem("Act", DictSNOAct.Count, Color.IndianRed) .AddItem("Adventure", DictSNOAdventure.Count, Color.Orange4_1) .AddItem("Ambient Sound", DictSNOAmbientSound.Count, Color.OrangeRed1) .AddItem("Animations", DictSNOAnim.Count, Color.Orchid) .AddItem("Animation 2D", DictSNOAnimation2D.Count, Color.BlueViolet) - .AddItem("Animation Set", DictSNOAnimSet.Count, Color.Blue3) + .AddItem("Animation Set", DictSNOAnimSet.Count, Color.LightGoldenrod1) .AddItem("Conversation", DictSNOConversation.Count, Color.Aquamarine1_1) .AddItem("Encounter", DictSNOEncounter.Count, Color.Green3_1) .AddItem("Level Area", DictSNOLevelArea.Count, Color.Grey62) diff --git a/src/DiIiS-NA/Program.cs b/src/DiIiS-NA/Program.cs index 3107c42..b52d6d7 100644 --- a/src/DiIiS-NA/Program.cs +++ b/src/DiIiS-NA/Program.cs @@ -54,6 +54,7 @@ using System.Globalization; using System.Linq; //Blizzless Project 2022 using System.Runtime.ExceptionServices; +using System.Runtime.InteropServices; //Blizzless Project 2022 using System.Security; //Blizzless Project 2022 @@ -67,10 +68,10 @@ using Environment = System.Environment; namespace DiIiS_NA { - + class Program { - private static readonly Logger Logger = LogManager.CreateLogger("BZ.Net"); + private static readonly Logger Logger = LogManager.CreateLogger("BZ.Net"); public static readonly DateTime StartupTime = DateTime.Now; public static BattleBackend BattleBackend { get; set; } public bool GameServersAvailable = true; @@ -80,9 +81,9 @@ namespace DiIiS_NA public static GameServer.ClientSystem.GameServer GameServer; public static Watchdog Watchdog; - public static Thread GameServerThread; - public static Thread WatchdogThread; - + public static Thread GameServerThread; + public static Thread WatchdogThread; + public static string LOGINSERVERIP = DiIiS_NA.LoginServer.Config.Instance.BindIP; public static string GAMESERVERIP = DiIiS_NA.GameServer.Config.Instance.BindIP; public static string RESTSERVERIP = DiIiS_NA.REST.Config.Instance.IP; @@ -93,19 +94,8 @@ namespace DiIiS_NA private static readonly string TypeBuild = "BETA"; private static bool D3CoreEnabled = DiIiS_NA.GameServer.Config.Instance.CoreActive; - static bool SetTitle(string text) - { - try - { - Console.Title = text; - return true; - } - catch (PlatformNotSupportedException) - { - return false; - } - } - static async Task LoginServer() + + static async Task LoginServer() { #if DEBUG D3CoreEnabled = true; @@ -116,12 +106,13 @@ namespace DiIiS_NA string name = $"Blizzless: Build {Build}, Stage: {Stage} - {TypeBuild}"; SetTitle(name); + Maximize(); AnsiConsole.Write(new Rule("[dodgerblue1]Blizz[/][deepskyblue2]less[/]").RuleStyle("steelblue1")); AnsiConsole.Write(new Rule($"[dodgerblue3]Build [/][deepskyblue3]{Build}[/]").RightJustified().RuleStyle("steelblue1_1")); AnsiConsole.Write(new Rule($"[dodgerblue3]Stage [/][deepskyblue3]{Stage}[/]").RightJustified().RuleStyle("steelblue1_1")); AnsiConsole.Write(new Rule($"[deepskyblue3]{TypeBuild}[/]").RightJustified().RuleStyle("steelblue1_1")); AnsiConsole.Write(new Rule($"[red3_1]Diablo III[/] [red]RoS 2.7.4.84161[/] - [link=https://github.com/blizzless/blizzless-diiis]https://github.com/blizzless/blizzless-diiis[/]").RuleStyle("red")); - + AnsiConsole.MarkupLine(""); Console.WriteLine(); Console.Title = name; @@ -276,6 +267,8 @@ namespace DiIiS_NA } if (line.ToLower().StartsWith("!sno")) { + if (IsTargetEnabled("ansi")) + Console.Clear(); MPQStorage.Data.SnoBreakdown(line.ToLower().Equals("!sno 1") || line.ToLower().Equals("!sno true")); continue; } @@ -284,6 +277,7 @@ namespace DiIiS_NA if (PlayerManager.OnlinePlayers.Count > 0) { + Logger.Info($"Server is shutting down in 1 minute, $[blue]${PlayerManager.OnlinePlayers.Count} players$[/]$ are still online."); PlayerManager.SendWhisper("Server is shutting down in 1 minute."); await Task.Delay(TimeSpan.FromMinutes(1)); } @@ -343,7 +337,7 @@ namespace DiIiS_NA } static int TargetsEnabled(string target) => LogConfig.Instance.Targets.Count(t => t.Target.ToLower() == target && t.Enabled); - static bool IsTargetEnabled(string target) => TargetsEnabled(target) > 0; + public static bool IsTargetEnabled(string target) => TargetsEnabled(target) > 0; private static void InitLoggers() { LogManager.Enabled = true; @@ -417,5 +411,42 @@ namespace DiIiS_NA return true; } + static bool SetTitle(string text) + { + try + { + Console.Title = text; + return true; + } + catch (PlatformNotSupportedException) + { + return false; + } + } + + [DllImport("kernel32.dll", ExactSpelling = true)] + + static extern IntPtr GetConsoleWindow(); + static IntPtr ThisConsole = GetConsoleWindow(); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + + static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); + const int HIDE = 0; + const int MAXIMIZE = 3; + const int MINIMIZE = 6; + const int RESTORE = 9; + private static void Maximize() + { + // if it's running on windows + try + { + if (Environment.OSVersion.Platform == PlatformID.Win32NT) + { + ShowWindow(ThisConsole, MAXIMIZE); + } + } + catch{ /*ignore*/ } + } } }