diff --git a/Dalamud.Injector/Dalamud.Injector.csproj b/Dalamud.Injector/Dalamud.Injector.csproj index 1c55d90b4..c6a08a365 100644 --- a/Dalamud.Injector/Dalamud.Injector.csproj +++ b/Dalamud.Injector/Dalamud.Injector.csproj @@ -14,10 +14,10 @@ true - 5.2.3.3 - 5.2.3.3 + 5.2.3.5 + 5.2.3.5 XIVLauncher addon injection - 5.2.3.3 + 5.2.3.5 diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj index df8c101f1..d33f3e29f 100644 --- a/Dalamud/Dalamud.csproj +++ b/Dalamud/Dalamud.csproj @@ -15,9 +15,9 @@ true - 5.2.3.3 - 5.2.3.3 - 5.2.3.3 + 5.2.3.5 + 5.2.3.5 + 5.2.3.5 diff --git a/Dalamud/DalamudCommands.cs b/Dalamud/DalamudCommands.cs index 9edce0b79..81ee3f6e3 100644 --- a/Dalamud/DalamudCommands.cs +++ b/Dalamud/DalamudCommands.cs @@ -100,6 +100,13 @@ namespace Dalamud HelpMessage = "ImGui DEBUG", ShowInHelp = false }); + + // Only april fools 2021 + this.dalamud.CommandManager.AddHandler("/dontfoolme", new CommandInfo(this.OnDisableAprilFools2021Command) + { + HelpMessage = "Disable April Fools 2021", + ShowInHelp = true + }); } private void OnUnloadCommand(string command, string arguments) @@ -248,5 +255,11 @@ namespace Dalamud private void OnOpenSettingsCommand(string command, string arguments) { this.dalamud.DalamudUi.OpenSettings(); } + + private void OnDisableAprilFools2021Command(string command, string arguments) + { + if (this.dalamud.Fools != null) + this.dalamud.Fools.IsEnabled = false; + } } } diff --git a/Dalamud/Fools2021.cs b/Dalamud/Fools2021.cs index e993a9740..08d86cfca 100644 --- a/Dalamud/Fools2021.cs +++ b/Dalamud/Fools2021.cs @@ -32,7 +32,7 @@ namespace Dalamud private readonly Stopwatch tippyFrameTimer = new Stopwatch(); private readonly Stopwatch tippyLogicTimer = new Stopwatch(); - public bool IsEnabled = true; + public bool IsEnabled = false; public Fools2021(Dalamud dalamud) { @@ -40,10 +40,13 @@ namespace Dalamud this.dalamud.ClientState.OnLogin += (sender, args) => { this.isTippyDrawing = true; + this.IsEnabled = true; this.tippyLogicTimer.Restart(); }; this.dalamud.ClientState.OnLogout += (sender, args) => { this.isTippyDrawing = false; + this.frames = 0; + this.IsEnabled = false; this.tippyText = string.Empty; this.tippyState = TippyState.BeforeIntro; @@ -65,25 +68,44 @@ namespace Dalamud if (!IsEnabled) return; - if (this.frames < 2000) - { - ImGui.SetNextWindowSize(new Vector2(this.welcomeTex.Width, this.welcomeTex.Height) * ImGui.GetIO().FontGlobalScale * WelcomeTexScale, ImGuiCond.Always); + try { + /* + if (this.frames < 1900) { - ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(0f, 0f)); - ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0f); + var windowSize = new Vector2(this.welcomeTex.Width, this.welcomeTex.Height) * + ImGui.GetIO().FontGlobalScale * + WelcomeTexScale; + ImGui.SetNextWindowSize(windowSize, ImGuiCond.Always); - ImGui.Begin("Please wait...", - ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoTitleBar); + var screenSize = ImGui.GetIO().DisplaySize; + ImGui.SetNextWindowPos(new Vector2((screenSize.X / 2) - windowSize.X / 2, (screenSize.Y / 2) - windowSize.Y / 2), ImGuiCond.Always); - ImGui.Image(this.welcomeTex.ImGuiHandle, new Vector2(this.welcomeTex.Width, this.welcomeTex.Height) * ImGui.GetIO().FontGlobalScale * WelcomeTexScale); + ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(0f, 0f)); + ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0f); - ImGui.End(); + ImGui.Begin("Please wait...", + ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoScrollbar | + ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoCollapse | + ImGuiWindowFlags.NoTitleBar); - ImGui.PopStyleVar(2); + ImGui.Image(this.welcomeTex.ImGuiHandle, + new Vector2(this.welcomeTex.Width, this.welcomeTex.Height) * + ImGui.GetIO().FontGlobalScale * WelcomeTexScale); + + ImGui.End(); + + ImGui.PopStyleVar(2); + } + */ + + this.frames++; + + if (this.isTippyDrawing) + DrawTippy(); + } catch (Exception ex) { + Log.Error(ex, "Fools exception OnDraw caught"); } - - this.frames++; - + #if DEBUG ImGui.Begin("Tippy AI debug"); @@ -119,8 +141,7 @@ namespace Dalamud ImGui.End(); #endif - if (this.isTippyDrawing) - DrawTippy(); + } private bool isTippyDrawing = false; @@ -246,14 +267,40 @@ namespace Dalamud "Piety matters as much as tenacity." }; - private static Dictionary jobTipDict = new Dictionary() { - { 1, PldTips }, - - { 33, AstTips } + private static readonly string[] GunTips = new[] { + "Much like doing a \"brake check\" on the\nroad, you can do a \"heal check\"\nin-game! \n\nJust pop Superbolide at a random time,\npreferably about five seconds before \nraidwide damage.", }; - private string currentTip = string.Empty; - private long lastTipFrame = 0; + private static Dictionary jobTipDict = new Dictionary() { + { 1, PldTips }, + { 2, MnkTips }, + { 3, WarTips }, + { 4, DrgTips }, + { 5, BrdTips }, + { 6, WhmTips }, + { 7, BlmTips }, + + { 19, PldTips }, + { 20, MnkTips }, + { 21, WarTips }, + { 22, DrgTips }, + { 23, BrdTips }, + { 24, WhmTips }, + { 25, BlmTips }, + { 26, SchTips.Concat(SmnTips).ToArray() }, + { 27, SmnTips }, + { 28, SchTips }, + { 29, NinTips }, + { 30, NinTips }, + { 31, BrdTips }, + + { 33, AstTips }, + { 34, SamTips }, + + { 36, BluTips }, + { 37, GunTips }, + { 38, DncTips } + }; private string tippyText = string.Empty; private bool showTippyButton = false; @@ -287,7 +334,7 @@ namespace Dalamud switch (tippyState) { case TippyState.Tips: - if (this.tippyLogicTimer.ElapsedMilliseconds > 120000 && string.IsNullOrEmpty(this.tippyText)) + if (this.tippyLogicTimer.ElapsedMilliseconds > 600000 && string.IsNullOrEmpty(this.tippyText)) // New tip every 10 minutes SetNewTip(); break; case TippyState.Timeout: @@ -497,24 +544,35 @@ namespace Dalamud } } - private Queue lastGeneralTips = new Queue(); + private Queue lastTips = new Queue(); private string GetGeneralTip() { - var gti = this.rand.Next(0, GeneralTips.Length); - var generalTip = GeneralTips[gti]; + var lp = this.dalamud.ClientState.LocalPlayer; - while (this.lastGeneralTips.Any(x => x == generalTip)) { - gti = this.rand.Next(0, GeneralTips.Length); - generalTip = GeneralTips[gti]; + var classJob = 0u; + if (lp != null) + classJob = lp.ClassJob.Id; + + var tAry = GeneralTips; + + if (jobTipDict.TryGetValue(classJob, out var ccTips)) + tAry = tAry.Concat(ccTips).Concat(ccTips).ToArray(); // Concat job tips twice so they have a greater chance of being seen + + var index = this.rand.Next(0, tAry.Length); + var tip = tAry[index]; + + while (this.lastTips.Any(x => x == tip)) { + index = this.rand.Next(0, tAry.Length); + tip = tAry[index]; } - this.lastGeneralTips.Enqueue(generalTip); + this.lastTips.Enqueue(tip); - if (this.lastGeneralTips.Count > 5) - this.lastGeneralTips.Dequeue(); + if (this.lastTips.Count > 5) + this.lastTips.Dequeue(); - return generalTip; + return tip; } private void SetNewTip() @@ -529,8 +587,6 @@ namespace Dalamud break; } - var lp = this.dalamud.ClientState.LocalPlayer; - var generalTip = GetGeneralTip(); var choice = this.rand.Next(0, 28); @@ -538,20 +594,7 @@ namespace Dalamud Log.Information($"Choice: {choice}"); - var classJob = 14u; - if (lp != null) - classJob = lp.ClassJob.Id; - - var hasJobTips = jobTipDict.TryGetValue(classJob, out var ccTips); - - if (choice < 8) - { - this.tippyText = generalTip; - - PlayTada(); - this.showTippyButton = true; - } - else if (choice == 9 || choice == 10) { + if (choice == 1 || choice == 2) { this.tippyState = TippyState.Timeout; this.tippyText = "Analyzing ERP logs..."; SetTippyAnim(TippyAnimState.Reading, true); @@ -561,7 +604,7 @@ namespace Dalamud PlayChord(); } - else if (choice == 11) { + else if (choice == 3 || choice == 5) { this.tippyState = TippyState.Timeout; this.tippyText = "I'm always watching."; SetTippyAnim(TippyAnimState.CheckingYouOut, true); @@ -571,7 +614,7 @@ namespace Dalamud PlayChord(); } - else if (choice == 12) + else if (choice == 4 || choice == 6) { this.tippyState = TippyState.Parse; this.tippyText = "It seems like you are parsing grey.\n\nDo you want me to help you play your\njob better?"; @@ -584,15 +627,7 @@ namespace Dalamud } else { - if (hasJobTips) - { - var ti = rand.Next(0, ccTips.Length); - this.tippyText = ccTips[ti]; - } - else - { - this.tippyText = generalTip; - } + this.tippyText = generalTip; PlayTada(); this.showTippyButton = true; diff --git a/Dalamud/Interface/DalamudInterface.cs b/Dalamud/Interface/DalamudInterface.cs index 7e55e50a9..945aa3c91 100644 --- a/Dalamud/Interface/DalamudInterface.cs +++ b/Dalamud/Interface/DalamudInterface.cs @@ -137,7 +137,11 @@ namespace Dalamud.Interface { OpenChangelog(); } - ImGui.MenuItem("Draw Tippy", "", ref this.dalamud.Fools.IsEnabled); + + if (this.dalamud.Fools != null) { + ImGui.MenuItem("Draw Tippy", "", ref this.dalamud.Fools.IsEnabled); + } + ImGui.MenuItem("Draw ImGui demo", "", ref this.isImguiDrawDemoWindow); ImGui.Separator(); if (ImGui.MenuItem("Unload Dalamud"))