Skip to content

Commit

Permalink
add bannerpreview bother
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaksuhn committed Dec 4, 2024
1 parent fe40aaa commit de834b3
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ECommons
1 change: 1 addition & 0 deletions YesAlready/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public partial class Configuration() : IPluginConfiguration
public bool AirShipExplorationResultRedeploy { get; set; } = false;
public bool MiragePrismRemoveDispel { get; set; } = false;
public bool MiragePrismExecuteCast { get; set; } = false;
public bool BannerPreviewUpdate { get; set; } = false;

public List<CustomBother> CustomCallbacks { get; set; } = [];

Expand Down
28 changes: 28 additions & 0 deletions YesAlready/Features/BannerPreview.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Dalamud.Game.Addon.Lifecycle;
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
using ECommons.Automation;
using YesAlready.BaseFeatures;

namespace YesAlready.Features;
internal class BannerPreview : BaseFeature
{
public override void Enable()
{
base.Enable();
Svc.AddonLifecycle.RegisterListener(AddonEvent.PostSetup, "BannerPreview", AddonSetup);
}

public override void Disable()
{
base.Disable();
Svc.AddonLifecycle.UnregisterListener(AddonSetup);
}

protected static unsafe void AddonSetup(AddonEvent eventType, AddonArgs addonInfo)
{
if (!P.Active || !P.Config.BannerPreviewUpdate) return;
Callback.Fire(addonInfo.Base(), true, 0);
// FIX: this causes a "Character not in frame error" when done PostSetup ... somehow
//new AddonMaster.BannerPreview(addonInfo.Base()).Update();
}
}
8 changes: 8 additions & 0 deletions YesAlready/UI/Tabs/Bothers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,14 @@ public static void Draw()
P.Config.Save();
}
ImGuiEx.IndentedTextColored("Automatically cast glamours when using Glamour Prisms.");

var bpu = P.Config.BannerPreviewUpdate;
if (ImGui.Checkbox("BannerPreviewUpdate", ref bpu))
{
P.Config.BannerPreviewUpdate = bpu;
P.Config.Save();
}
ImGuiEx.IndentedTextColored("Automatically update portraits.");
}

#endregion
Expand Down

0 comments on commit de834b3

Please sign in to comment.