From 3a3a6613cd9783f421df0a152c8675a669910557 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sun, 8 Sep 2024 15:14:44 -0700 Subject: add preliminary frontline losing streak bonus tracking --- Malmstone/Windows/MainWindow.cs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'Malmstone/Windows/MainWindow.cs') diff --git a/Malmstone/Windows/MainWindow.cs b/Malmstone/Windows/MainWindow.cs index 0e91c4d..8da004f 100644 --- a/Malmstone/Windows/MainWindow.cs +++ b/Malmstone/Windows/MainWindow.cs @@ -101,6 +101,41 @@ namespace Malmstone.Windows ImGui.BulletText($"Take 2nd Place: {xpResult.FrontlineDailyLose2nd} " + (xpResult.FrontlineDailyLose2nd == 1 ? "time" : "times")); ImGui.BulletText($"Take 3rd Place: {xpResult.FrontlineDailyLose3rd} " + (xpResult.FrontlineDailyLose3rd == 1 ? "time" : "times")); + + if (Plugin.Configuration.TrackFrontlineBonus) + { + if (Plugin.PvPService.CurrentFrontlineLosingBonus == -1) + { + ImGui.TextColored(new Vector4(0.0f, 1.0f, 0.0f, 1.0f), "Complete a Frontline match to view current reward bonus"); + if (ImGui.IsItemHovered()) + { + ImGui.BeginTooltip(); + ImGui.Text("This calculates the losing streak bonus you receive after consecutive losses in Frontlines" + + "\nPlay a match of Frontline to confirm your existing losing bonus" + + "\nYou can turn off tracking entirely in the settings"); + ImGui.EndTooltip(); + } + } + else + { + if(Plugin.PvPService.CurrentFrontlineLosingBonus == 0) + { + ImGui.TextColored(new Vector4(0.0f, 1.0f, 0.0f, 1.0f), "No Frontline Reward Bonus Currently Active"); + } + else + { + ImGui.TextColored(new Vector4(0.0f, 1.0f, 0.0f, 1.0f), "You'll receive a " + Plugin.PvPService.CurrentFrontlineLosingBonus + "%% reward boost next Frontline match"); + if (ImGui.IsItemHovered()) + { + ImGui.BeginTooltip(); + ImGui.Text("You will earn a " + Plugin.PvPService.CurrentFrontlineLosingBonus + "%% bonus on PvP EXP, Series EXP, and Wolf Marks " + + "until attain First Place" ); + ImGui.EndTooltip(); + } + } + } + } + ImGui.Spacing(); ImGui.Separator(); -- cgit v1.2.3 From 031440201d24531d6a1d5a0e93579d76e1e4ba18 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sun, 8 Sep 2024 16:52:23 -0700 Subject: add saving functionality to frontline reward bonus - marks as outdated if FrontlineRecord listener is disabled at any point --- Malmstone/Addons/PvPMatchAddon.cs | 7 ++++++- Malmstone/Configuration.cs | 4 +++- Malmstone/Plugin.cs | 1 + Malmstone/Windows/MainWindow.cs | 18 +++++++++++++++--- 4 files changed, 25 insertions(+), 5 deletions(-) (limited to 'Malmstone/Windows/MainWindow.cs') diff --git a/Malmstone/Addons/PvPMatchAddon.cs b/Malmstone/Addons/PvPMatchAddon.cs index c3f726a..896001a 100644 --- a/Malmstone/Addons/PvPMatchAddon.cs +++ b/Malmstone/Addons/PvPMatchAddon.cs @@ -53,7 +53,8 @@ namespace Malmstone.Addons public void EnableFrontlinePostMatch() { Plugin.AddonLifeCycle.RegisterListener(AddonEvent.PostSetup, "FrontlineRecord", OnFrontlineRecordTrigger); - Plugin.PvPService.CurrentFrontlineLosingBonus = -1; // Reset bonus tracking for now until config save is done + Plugin.PvPService.CurrentFrontlineLosingBonus = Plugin.Configuration.SavedFrontlineRewardBonus; + Plugin.Configuration.OutdatedFrontlineRewardBonus = true; FrontlineRecordPostSetupEnabled = true; } @@ -121,6 +122,7 @@ namespace Malmstone.Addons { FrontlineMatchResult = FrontlinePlacement.ThirdPlace; } + Plugin.Logger.Debug("Frontline Match Result: " + FrontlineMatchResult.ToString()); if (FrontlineMatchResult != FrontlinePlacement.Unknown) { unsafe @@ -135,6 +137,9 @@ namespace Malmstone.Addons if (int.TryParse(SeriesExpText, out int SeriesExpEarned)) { int CurrentLossBonus = Plugin.PvPService.GenerateFrontlineBonus(FrontlineMatchResult, SeriesExpEarned); + Plugin.Logger.Debug("Series EXP Earned: " + SeriesExpEarned.ToString()); + Plugin.Configuration.SavedFrontlineRewardBonus = CurrentLossBonus; + Plugin.Configuration.OutdatedFrontlineRewardBonus = false; } else { diff --git a/Malmstone/Configuration.cs b/Malmstone/Configuration.cs index c4d091b..4f62a96 100644 --- a/Malmstone/Configuration.cs +++ b/Malmstone/Configuration.cs @@ -17,7 +17,9 @@ public class Configuration : IPluginConfiguration public bool ShowMainWindowOnPVPReward { get; set; } = true; public bool SkipProgressionToastAfterGoal { get; set; } = false; public bool SkipProgressionChatAfterGoal { get; set; } = false; - public bool TrackFrontlineBonus { get; set; } = false; + public bool TrackFrontlineBonus { get; set; } = true; + public int SavedFrontlineRewardBonus { get; set; } = -1; + public bool OutdatedFrontlineRewardBonus { get; set; } = false; // the below exist just to make saving less cumbersome public void Save() diff --git a/Malmstone/Plugin.cs b/Malmstone/Plugin.cs index 87ebb06..ada8202 100644 --- a/Malmstone/Plugin.cs +++ b/Malmstone/Plugin.cs @@ -24,6 +24,7 @@ public sealed class Plugin : IDalamudPlugin [PluginService] internal static IChatGui Chat { get; private set; } = null!; [PluginService] internal static IAddonLifecycle AddonLifeCycle { get; private set; } = null!; [PluginService] internal static IToastGui ToastGui { get; private set; } = null!; + [PluginService] internal static IPluginLog Logger { get; set; } = default!; private const string CommandName = "/pmalm"; diff --git a/Malmstone/Windows/MainWindow.cs b/Malmstone/Windows/MainWindow.cs index 8da004f..bd1ef5d 100644 --- a/Malmstone/Windows/MainWindow.cs +++ b/Malmstone/Windows/MainWindow.cs @@ -26,7 +26,7 @@ namespace Malmstone.Windows { SizeConstraints = new WindowSizeConstraints { - MinimumSize = new Vector2(460, 510), + MinimumSize = new Vector2(460, 530), MaximumSize = new Vector2(float.MaxValue, float.MaxValue) }; @@ -120,7 +120,7 @@ namespace Malmstone.Windows { if(Plugin.PvPService.CurrentFrontlineLosingBonus == 0) { - ImGui.TextColored(new Vector4(0.0f, 1.0f, 0.0f, 1.0f), "No Frontline Reward Bonus Currently Active"); + ImGui.Text("No Frontline Reward Bonus Currently Active"); } else { @@ -129,7 +129,19 @@ namespace Malmstone.Windows { ImGui.BeginTooltip(); ImGui.Text("You will earn a " + Plugin.PvPService.CurrentFrontlineLosingBonus + "%% bonus on PvP EXP, Series EXP, and Wolf Marks " + - "until attain First Place" ); + "until attaining First Place" ); + ImGui.EndTooltip(); + } + } + if (Plugin.Configuration.OutdatedFrontlineRewardBonus) + { + ImGui.SameLine(); + ImGui.TextColored(new Vector4(1.0f, 0.0f, 0.0f, 1.0f),"(Outdated)"); + if (ImGui.IsItemHovered()) + { + ImGui.BeginTooltip(); + ImGui.Text("This information may be outdated due to Frontline tracking loading and unloading!" + + "\nCalculations will refresh after your next match of Frontlines"); ImGui.EndTooltip(); } } -- cgit v1.2.3 From c434ed7e5b557ff82882d7ac74068169eb83de7c Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sun, 8 Sep 2024 18:31:03 -0700 Subject: fix: logic with calculating start of losing streak bonus --- Malmstone/Services/PVPService.cs | 33 ++++++++------------------------- Malmstone/Windows/MainWindow.cs | 31 ++++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 28 deletions(-) (limited to 'Malmstone/Windows/MainWindow.cs') diff --git a/Malmstone/Services/PVPService.cs b/Malmstone/Services/PVPService.cs index ef16df9..12b4c2a 100644 --- a/Malmstone/Services/PVPService.cs +++ b/Malmstone/Services/PVPService.cs @@ -5,6 +5,7 @@ namespace Malmstone.Services public class PvPService { public int CurrentFrontlineLosingBonus = -1; + public int ConsecutiveThirdPlaceFrontline = 0; public enum FrontlinePlacement { @@ -65,10 +66,11 @@ namespace Malmstone.Services // 1500 (no bonus), 1650, 1800, 1950, 2100, 2250 1st if (FrontlineResult == FrontlinePlacement.ThirdPlace) { + ConsecutiveThirdPlaceFrontline++; switch (EarnedSeriesEXP) - { + { // Next 3rd place will get +10% value case 1000: - CurrentFrontlineLosingBonus = 0; + CurrentFrontlineLosingBonus = 0; // Primed for buff return 0; case 1100: CurrentFrontlineLosingBonus = 10; @@ -117,29 +119,10 @@ namespace Malmstone.Services } else if (FrontlineResult == FrontlinePlacement.FirstPlace) { - switch (EarnedSeriesEXP) - { - case 1500: - CurrentFrontlineLosingBonus = 0; - return 0; - case 1650: - CurrentFrontlineLosingBonus = 10; - return 10; - case 1800: - CurrentFrontlineLosingBonus = 20; - return 20; - case 1950: - CurrentFrontlineLosingBonus = 30; - return 30; - case 1750: - CurrentFrontlineLosingBonus = 40; - return 40; - case 1875: - CurrentFrontlineLosingBonus = 50; - return 50; - default: - return -1; - } + // Buff is reset regardless + ConsecutiveThirdPlaceFrontline = 0; + CurrentFrontlineLosingBonus = 0; + return 0; } return -1; } diff --git a/Malmstone/Windows/MainWindow.cs b/Malmstone/Windows/MainWindow.cs index bd1ef5d..1617a00 100644 --- a/Malmstone/Windows/MainWindow.cs +++ b/Malmstone/Windows/MainWindow.cs @@ -26,7 +26,7 @@ namespace Malmstone.Windows { SizeConstraints = new WindowSizeConstraints { - MinimumSize = new Vector2(460, 530), + MinimumSize = new Vector2(460, 545), MaximumSize = new Vector2(float.MaxValue, float.MaxValue) }; @@ -120,18 +120,43 @@ namespace Malmstone.Windows { if(Plugin.PvPService.CurrentFrontlineLosingBonus == 0) { + if(Plugin.PvPService.ConsecutiveThirdPlaceFrontline == 1) + { + ImGui.TextColored(new Vector4(0.0f, 1.0f, 0.0f, 1.0f), "You'll receive 10%% reward bonus if you place 3rd"); + } + if (ImGui.IsItemHovered()) + { + ImGui.BeginTooltip(); + ImGui.Text("You're primed for a reward bonus! You will get a 10% reward bonus if you place 3rd again" + + "\nCounter resets if you rank 1st"); + ImGui.EndTooltip(); + } ImGui.Text("No Frontline Reward Bonus Currently Active"); } else { - ImGui.TextColored(new Vector4(0.0f, 1.0f, 0.0f, 1.0f), "You'll receive a " + Plugin.PvPService.CurrentFrontlineLosingBonus + "%% reward boost next Frontline match"); + if (Plugin.PvPService.CurrentFrontlineLosingBonus != 50) + ImGui.TextColored(new Vector4(0.0f, 1.0f, 0.0f, 1.0f), "You'll receive a " + Plugin.PvPService.CurrentFrontlineLosingBonus + "%% reward bonus placing 1st or 2nd"); + else + ImGui.TextColored(new Vector4(0.0f, 1.0f, 0.0f, 1.0f), "You'll receive a " + Plugin.PvPService.CurrentFrontlineLosingBonus + "%% reward bonus placing 1st, 2nd, or 3rd"); if (ImGui.IsItemHovered()) { ImGui.BeginTooltip(); - ImGui.Text("You will earn a " + Plugin.PvPService.CurrentFrontlineLosingBonus + "%% bonus on PvP EXP, Series EXP, and Wolf Marks " + + ImGui.Text("You'll earn a percentage bonus on PvP EXP, Series EXP, and Wolf Marks " + "until attaining First Place" ); ImGui.EndTooltip(); } + if (Plugin.PvPService.CurrentFrontlineLosingBonus != 50) + { + ImGui.TextColored(new Vector4(0.0f, 1.0f, 0.0f, 1.0f), "Your reward bonus will increase to " + (Plugin.PvPService.CurrentFrontlineLosingBonus + 10) + "%% if place 3rd"); + if (ImGui.IsItemHovered()) + { + ImGui.BeginTooltip(); + ImGui.Text($"Finishing 3rd again will increase your bonus to {Plugin.PvPService.CurrentFrontlineLosingBonus + 10}%." + + "\nThis increased bonus will also apply to the match where this happens."); + ImGui.EndTooltip(); + } + } } if (Plugin.Configuration.OutdatedFrontlineRewardBonus) { -- cgit v1.2.3