This commit is contained in:
Lucca Faria Ferri 2023-01-27 09:42:44 -08:00
parent bc90c73d99
commit 6325e82502
2 changed files with 59 additions and 25 deletions

View File

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

View File

@ -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
@ -93,18 +94,7 @@ 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()
{
#if DEBUG
@ -116,6 +106,7 @@ 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"));
@ -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*/ }
}
}
}