├── .gitignore ├── icon.png ├── CurrencyAlert ├── images │ ├── 20.png │ ├── 21.png │ ├── 22.png │ ├── 25.png │ ├── 27.png │ ├── 28.png │ ├── 43.png │ ├── 44.png │ ├── 10307.png │ ├── 25199.png │ ├── 25200.png │ ├── 26533.png │ ├── 26807.png │ ├── 28063.png │ ├── 33913.png │ ├── 33914.png │ └── 36656.png ├── Enum │ ├── Category.cs │ ├── StackDirection.cs │ └── CurrencyType.cs ├── packages.lock.json ├── CurrencyAlert.json ├── Helper │ ├── PluginHelper.cs │ └── ImageHelper.cs ├── Entity │ └── Currency.cs ├── Configuration.cs ├── Provider │ └── CurrencyProvider.cs ├── CurrencyAlert.csproj ├── Plugin.cs └── PluginUI.cs ├── README.md └── CurrencyAlert.sln /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | obj/ 3 | bin/ 4 | *.user -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/icon.png -------------------------------------------------------------------------------- /CurrencyAlert/images/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/20.png -------------------------------------------------------------------------------- /CurrencyAlert/images/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/21.png -------------------------------------------------------------------------------- /CurrencyAlert/images/22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/22.png -------------------------------------------------------------------------------- /CurrencyAlert/images/25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/25.png -------------------------------------------------------------------------------- /CurrencyAlert/images/27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/27.png -------------------------------------------------------------------------------- /CurrencyAlert/images/28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/28.png -------------------------------------------------------------------------------- /CurrencyAlert/images/43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/43.png -------------------------------------------------------------------------------- /CurrencyAlert/images/44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/44.png -------------------------------------------------------------------------------- /CurrencyAlert/images/10307.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/10307.png -------------------------------------------------------------------------------- /CurrencyAlert/images/25199.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/25199.png -------------------------------------------------------------------------------- /CurrencyAlert/images/25200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/25200.png -------------------------------------------------------------------------------- /CurrencyAlert/images/26533.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/26533.png -------------------------------------------------------------------------------- /CurrencyAlert/images/26807.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/26807.png -------------------------------------------------------------------------------- /CurrencyAlert/images/28063.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/28063.png -------------------------------------------------------------------------------- /CurrencyAlert/images/33913.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/33913.png -------------------------------------------------------------------------------- /CurrencyAlert/images/33914.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/33914.png -------------------------------------------------------------------------------- /CurrencyAlert/images/36656.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyvorld/xiv-currency-alert/main/CurrencyAlert/images/36656.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ![Logo](icon.png) CurrencyAlert 2 | Dalamud plugin that alerts player when reaching a certain amount of currency (poetics, etc) 3 | -------------------------------------------------------------------------------- /CurrencyAlert/Enum/Category.cs: -------------------------------------------------------------------------------- 1 | namespace CurrencyAlert.Enum 2 | { 3 | public enum Category 4 | { 5 | Common, 6 | Battle, 7 | Other 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /CurrencyAlert/Enum/StackDirection.cs: -------------------------------------------------------------------------------- 1 | namespace CurrencyAlert.Enum 2 | { 3 | public enum StackDirection 4 | { 5 | Up, 6 | Down, 7 | Left, 8 | Right 9 | } 10 | } -------------------------------------------------------------------------------- /CurrencyAlert/packages.lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "dependencies": { 4 | "net6.0-windows7.0": { 5 | "DalamudPackager": { 6 | "type": "Direct", 7 | "requested": "[2.1.8, )", 8 | "resolved": "2.1.8", 9 | "contentHash": "YqagNXs9InxmqkXzq7kLveImxnodkBEicAhydMXVp7dFjC7xb76U6zGgAax4/BWIWfZeWzr5DJyQSev31kj81A==" 10 | } 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /CurrencyAlert/CurrencyAlert.json: -------------------------------------------------------------------------------- 1 | { 2 | "Author": "Lharz", 3 | "Name": "CurrencyAlert", 4 | "Punchline": "Display alerts upon reaching configurable currencies thresholds (such as Poetics or PVP marks).", 5 | "Description": "/currencyalert: shows the configuration panel.", 6 | "Changelog": null, 7 | "Tags": [ 8 | "plugin", 9 | "currency", 10 | "tomestones", 11 | "utility", 12 | "other" 13 | ], 14 | "CategoryTags": null, 15 | "RepoUrl": "https://github.com/Lharz/xiv-currency-alert", 16 | } 17 | -------------------------------------------------------------------------------- /CurrencyAlert/Enum/CurrencyType.cs: -------------------------------------------------------------------------------- 1 | namespace CurrencyAlert.Enum 2 | { 3 | public enum CurrencyType 4 | { 5 | TomestoneOfPoetics, 6 | TomestoneOfAphorism, 7 | TomestoneOfAstronomy, 8 | TomestoneOfCausality, 9 | 10 | StormSeal, 11 | SerpentSeal, 12 | FlameSeal, 13 | 14 | WolfMark, 15 | TrophyCrystal, 16 | 17 | AlliedSeal, 18 | CenturioSeal, 19 | SackOfNut, 20 | BicolorGemstone, 21 | 22 | WhiteCraftersScrip, 23 | PurpleCraftersScrip, 24 | WhiteGatherersScrip, 25 | PurpleGatherersScrip, 26 | SkybuildersScrip 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CurrencyAlert/Helper/PluginHelper.cs: -------------------------------------------------------------------------------- 1 | using Dalamud.Game.ClientState; 2 | using Dalamud.Game.Command; 3 | using Dalamud.Game.Gui; 4 | using Dalamud.IoC; 5 | using Dalamud.Plugin; 6 | 7 | namespace CurrencyAlert.Helper 8 | { 9 | internal class PluginHelper 10 | { 11 | [PluginService] public static DalamudPluginInterface PluginInterface { get; private set; } = null!; 12 | [PluginService] public static ClientState ClientState { get; private set; } = null!; 13 | [PluginService] public static CommandManager CommandManager { get; private set; } = null!; 14 | [PluginService] public static ChatGui Chat { get; private set; } = null!; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /CurrencyAlert/Helper/ImageHelper.cs: -------------------------------------------------------------------------------- 1 | using ImGuiScene; 2 | using System; 3 | using System.IO; 4 | 5 | namespace CurrencyAlert.Helper 6 | { 7 | internal class ImageHelper 8 | { 9 | public static TextureWrap? LoadImage(string imageName) 10 | { 11 | var assemblyLocation = PluginHelper.PluginInterface.AssemblyLocation.DirectoryName!; 12 | var imagePath = Path.Combine(assemblyLocation, $@"images\{imageName}.png"); 13 | 14 | try 15 | { 16 | return PluginHelper.PluginInterface.UiBuilder.LoadImage(imagePath); 17 | } 18 | catch (SystemException e) 19 | { 20 | return null; 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CurrencyAlert/Entity/Currency.cs: -------------------------------------------------------------------------------- 1 | using CurrencyAlert.Enum; 2 | using CurrencyAlert.Helper; 3 | using ImGuiScene; 4 | 5 | namespace CurrencyAlert.Entity 6 | { 7 | internal class Currency 8 | { 9 | public int Id { get; } 10 | public string Name { get; } 11 | public CurrencyType Type { get; } 12 | public Category Category { get; } 13 | public TextureWrap? Image { get; } 14 | public int DefaultThreshold { get; } 15 | 16 | public Currency(int id, string name, CurrencyType type, Category category, int defaultThreshold) 17 | { 18 | Id = id; 19 | Name = name; 20 | Type = type; 21 | Category = category; 22 | DefaultThreshold = defaultThreshold; 23 | Image = ImageHelper.LoadImage(id.ToString()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /CurrencyAlert.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31919.166 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CurrencyAlert", "CurrencyAlert\CurrencyAlert.csproj", "{13C812E9-0D42-4B95-8646-40EEBF30636F}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.ActiveCfg = Debug|x64 15 | {13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.Build.0 = Debug|x64 16 | {13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.ActiveCfg = Release|x64 17 | {13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {B17E85B1-5F60-4440-9F9A-3DDE877E8CDF} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /CurrencyAlert/Configuration.cs: -------------------------------------------------------------------------------- 1 | using CurrencyAlert.Enum; 2 | using CurrencyAlert.Helper; 3 | using CurrencyAlert.Provider; 4 | using Dalamud.Configuration; 5 | using Dalamud.Plugin; 6 | using System; 7 | using System.Collections.Generic; 8 | 9 | namespace CurrencyAlert 10 | { 11 | [Serializable] 12 | public class Configuration : IPluginConfiguration 13 | { 14 | public int Version { get; set; } = 5; 15 | 16 | public bool UiLocked { get; set; } = false; 17 | public bool MinimalDisplay { get; set; } = false; 18 | public StackDirection StackDirection { get; set;} = 0; 19 | public Dictionary AlertEnabled { get; } = new Dictionary(); 20 | public Dictionary Threshold { get; } = new Dictionary(); 21 | 22 | public Configuration() 23 | { 24 | foreach (var currency in CurrencyProvider.Instance.GetAll()) 25 | { 26 | this.AlertEnabled[currency.Id] = true; 27 | this.Threshold[currency.Id] = currency.DefaultThreshold; 28 | } 29 | } 30 | 31 | public void Initialize() 32 | { 33 | 34 | } 35 | 36 | public void Save() 37 | { 38 | PluginHelper.PluginInterface.SavePluginConfig(this); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CurrencyAlert/Provider/CurrencyProvider.cs: -------------------------------------------------------------------------------- 1 | using CurrencyAlert.Entity; 2 | using System.Collections.Generic; 3 | 4 | namespace CurrencyAlert.Provider 5 | { 6 | internal sealed class CurrencyProvider 7 | { 8 | private static CurrencyProvider? instance = null; 9 | public static CurrencyProvider Instance => instance ??= new CurrencyProvider(); 10 | 11 | private readonly List currencies; 12 | 13 | public CurrencyProvider() 14 | { 15 | currencies = new List 16 | { 17 | new Currency(28, "Tomestones of Poetics", Enum.CurrencyType.TomestoneOfPoetics, Enum.Category.Battle, 1400), 18 | new Currency(43, "Tomestones of Astronomy", Enum.CurrencyType.TomestoneOfAstronomy, Enum.Category.Battle, 1700), 19 | new Currency(44, "Tomestones of Causality", Enum.CurrencyType.TomestoneOfCausality, Enum.Category.Battle, 1700), 20 | 21 | new Currency(20, "Storm Seals", Enum.CurrencyType.StormSeal, Enum.Category.Common, 75000), 22 | new Currency(21, "Serpent Seals", Enum.CurrencyType.SerpentSeal, Enum.Category.Common, 75000), 23 | new Currency(22, "Flame Seals", Enum.CurrencyType.FlameSeal, Enum.Category.Common, 75000), 24 | 25 | new Currency(25, "Wolf Marks", Enum.CurrencyType.WolfMark, Enum.Category.Battle, 18000), 26 | new Currency(36656, "Trophy Crystals", Enum.CurrencyType.TrophyCrystal, Enum.Category.Battle, 18000), 27 | 28 | new Currency(27, "Allied Seals", Enum.CurrencyType.AlliedSeal, Enum.Category.Battle, 3500), 29 | new Currency(10307, "Centurio Seals", Enum.CurrencyType.CenturioSeal, Enum.Category.Battle, 3500), 30 | new Currency(26533, "Sack of Nuts", Enum.CurrencyType.SackOfNut, Enum.Category.Battle, 3500), 31 | new Currency(26807, "Bicolor Gemstone", Enum.CurrencyType.BicolorGemstone, Enum.Category.Battle, 800), 32 | 33 | new Currency(25199, "White Crafters' Scrip", Enum.CurrencyType.WhiteCraftersScrip, Enum.Category.Other, 1500), 34 | new Currency(33913, "Purple Crafters' Scrip", Enum.CurrencyType.PurpleCraftersScrip, Enum.Category.Other, 1500), 35 | new Currency(25200, "White Gatherers' Scrip", Enum.CurrencyType.WhiteGatherersScrip, Enum.Category.Other, 1500), 36 | new Currency(33914, "Purple Gatherers' Scrip", Enum.CurrencyType.PurpleGatherersScrip, Enum.Category.Other, 1500), 37 | new Currency(28063, "Skybuilders' Scrip", Enum.CurrencyType.SkybuildersScrip, Enum.Category.Other, 7500), 38 | }; 39 | } 40 | 41 | public IEnumerable GetAll() 42 | { 43 | return currencies; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /CurrencyAlert/CurrencyAlert.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 0.4.0.0 7 | Currency Alert 8 | 9 | https://github.com/Lharz/xiv-currency-alert 10 | 11 | 12 | 13 | 14 | 7 15 | Lharz 16 | CurrencyAlert 17 | Display alerts upon reaching configurable currencies thresholds (such as Poetics or PVP marks). 18 | /currencyalert: shows the configuration panel. 19 | 20 | Currency 21 | Utility 22 | 23 | 24 | ../icon.png 25 | 26 | False 27 | 28 | 29 | 30 | 31 | net6.0-windows 32 | x64 33 | enable 34 | latest 35 | true 36 | false 37 | false 38 | true 39 | true 40 | 41 | 42 | 43 | $(appdata)\XIVLauncher\addon\Hooks\dev\ 44 | https://github.com/Lharz/xiv-currency-alert 45 | git 46 | bin\ 47 | 48 | 49 | 50 | 51 | 52 | $(DalamudLibPath)FFXIVClientStructs.dll 53 | false 54 | 55 | 56 | $(DalamudLibPath)Newtonsoft.Json.dll 57 | false 58 | 59 | 60 | $(DalamudLibPath)Dalamud.dll 61 | false 62 | 63 | 64 | $(DalamudLibPath)ImGui.NET.dll 65 | false 66 | 67 | 68 | $(DalamudLibPath)ImGuiScene.dll 69 | false 70 | 71 | 72 | $(DalamudLibPath)Lumina.dll 73 | false 74 | 75 | 76 | $(DalamudLibPath)Lumina.Excel.dll 77 | false 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /CurrencyAlert/Plugin.cs: -------------------------------------------------------------------------------- 1 | using CurrencyAlert.Helper; 2 | using CurrencyAlert.Provider; 3 | using Dalamud.Game.Command; 4 | using Dalamud.Game.Gui; 5 | using Dalamud.IoC; 6 | using Dalamud.Plugin; 7 | using FFXIVClientStructs.FFXIV.Client.Game; 8 | using ImGuiNET; 9 | using Newtonsoft.Json; 10 | using System; 11 | using System.Reflection; 12 | 13 | namespace CurrencyAlert 14 | { 15 | public sealed class Plugin : IDalamudPlugin 16 | { 17 | public string Name => "Currency Alert"; 18 | 19 | private const string commandName = "/currencyalert"; 20 | 21 | private Configuration Configuration { get; init; } 22 | private PluginUI PluginUI { get; init; } 23 | 24 | [PluginService] public static ChatGui Chat { get; private set; } = null!; 25 | 26 | private bool LoggedIn => PluginHelper.ClientState.LocalPlayer != null && PluginHelper.ClientState.LocalContentId != 0; 27 | 28 | public Plugin(DalamudPluginInterface pluginInterface) 29 | { 30 | pluginInterface.Create(); 31 | 32 | try 33 | { 34 | this.Configuration = PluginHelper.PluginInterface.GetPluginConfig() as Configuration ?? new Configuration(); 35 | } 36 | catch (Exception e) 37 | { 38 | this.Configuration = new Configuration(); 39 | this.Configuration.Save(); 40 | 41 | PluginHelper.Chat.Print("Your CurrencyAlert configuration has been reset because of compatibility issues. Please check the plugin configuration window."); 42 | } 43 | 44 | this.Configuration.Initialize(); 45 | 46 | var assemblyLocation = Assembly.GetExecutingAssembly().Location; 47 | this.PluginUI = new PluginUI(this.Configuration); 48 | 49 | PluginHelper.CommandManager.AddHandler(commandName, new CommandInfo(OnCommand) 50 | { 51 | HelpMessage = "Lets you configure alert thresholds for various currencies" 52 | }); 53 | 54 | PluginHelper.PluginInterface.UiBuilder.Draw += DrawUI; 55 | PluginHelper.PluginInterface.UiBuilder.OpenConfigUi += DrawConfigUI; 56 | } 57 | 58 | public void Dispose() 59 | { 60 | this.PluginUI.Dispose(); 61 | PluginHelper.CommandManager.RemoveHandler(commandName); 62 | } 63 | 64 | private void OnCommand(string command, string args) 65 | { 66 | this.DrawConfigUI(); 67 | } 68 | 69 | private void DrawUI() 70 | { 71 | if (!this.LoggedIn) 72 | return; 73 | 74 | this.UpdateAlerts(); 75 | 76 | this.PluginUI.Draw(); 77 | } 78 | 79 | private void UpdateAlerts() 80 | { 81 | // TODO: move this logic elsewhere 82 | // TODO: do this only every X seconds 83 | unsafe 84 | { 85 | InventoryManager* inventoryManager = InventoryManager.Instance(); 86 | 87 | foreach (var currency in CurrencyProvider.Instance.GetAll()) 88 | { 89 | int quantity = inventoryManager->GetInventoryItemCount((uint)currency.Id); 90 | 91 | if (this.Configuration.AlertEnabled[currency.Id] && quantity >= this.Configuration.Threshold[currency.Id]) 92 | { 93 | this.PluginUI.AlertVisible[currency.Id] = true; 94 | } 95 | else 96 | { 97 | this.PluginUI.AlertVisible[currency.Id] = false; 98 | } 99 | } 100 | } 101 | } 102 | 103 | private void DrawConfigUI() 104 | { 105 | this.PluginUI.SettingsVisible = true; 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /CurrencyAlert/PluginUI.cs: -------------------------------------------------------------------------------- 1 | using CurrencyAlert.Enum; 2 | using CurrencyAlert.Provider; 3 | using ImGuiNET; 4 | using Microsoft.VisualBasic.FileIO; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Numerics; 9 | 10 | namespace CurrencyAlert 11 | { 12 | class PluginUI : IDisposable 13 | { 14 | private Configuration configuration; 15 | 16 | private bool settingsVisible = false; 17 | public bool SettingsVisible 18 | { 19 | get { return settingsVisible; } 20 | set { settingsVisible = value; } 21 | } 22 | public Dictionary AlertVisible { get; set; } = new Dictionary(); 23 | 24 | private Vector2 lastMainWindowPos = new Vector2 { X = 10, Y = 10 }; 25 | 26 | public PluginUI(Configuration configuration) 27 | { 28 | this.configuration = configuration; 29 | 30 | foreach (var currency in CurrencyProvider.Instance.GetAll()) 31 | { 32 | this.AlertVisible[currency.Id] = false; 33 | } 34 | } 35 | 36 | public void Dispose() 37 | { 38 | 39 | } 40 | 41 | public void Draw() 42 | { 43 | DrawMainWindow(); 44 | 45 | if (this.SettingsVisible) 46 | DrawSettingsWindow(); 47 | } 48 | 49 | int count = 0; 50 | 51 | void recordPos() 52 | { 53 | lastMainWindowPos = ImGui.GetWindowPos(); 54 | 55 | if (this.configuration.StackDirection == StackDirection.Up) 56 | { 57 | lastMainWindowPos.Y += ImGui.GetWindowHeight(); 58 | } 59 | else if (this.configuration.StackDirection == StackDirection.Left) 60 | { 61 | lastMainWindowPos.X += ImGui.GetWindowWidth(); 62 | } 63 | } 64 | 65 | public void DrawMainWindow() 66 | { 67 | var guiOptions = 68 | ImGuiWindowFlags.NoScrollbar | 69 | ImGuiWindowFlags.NoScrollWithMouse | 70 | ImGuiWindowFlags.AlwaysAutoResize | 71 | ImGuiWindowFlags.NoTitleBar | 72 | ImGuiWindowFlags.NoFocusOnAppearing; 73 | 74 | if (configuration.UiLocked) 75 | guiOptions |= ImGuiWindowFlags.NoMove; 76 | 77 | var visibleCurrency = CurrencyProvider.Instance.GetAll().Where(x => AlertVisible[x.Id]); 78 | 79 | if (ImGui.Begin("Currency Alert", guiOptions)) 80 | { 81 | if (count == 0) 82 | { 83 | recordPos(); 84 | count++; 85 | } 86 | else if (ImGui.IsMouseDragging(ImGuiMouseButton.Left)) 87 | { 88 | recordPos(); 89 | } 90 | else 91 | { 92 | Vector2 newPos = new Vector2 { X = lastMainWindowPos.X, Y = lastMainWindowPos.Y }; 93 | 94 | if (this.configuration.StackDirection == StackDirection.Up) 95 | { 96 | newPos.Y -= ImGui.GetWindowHeight(); 97 | } 98 | else if (this.configuration.StackDirection == StackDirection.Left) 99 | { 100 | newPos.X -= ImGui.GetWindowWidth(); 101 | } 102 | 103 | ImGui.SetNextWindowPos(newPos); 104 | } 105 | 106 | bool first = true; 107 | foreach (var currency in visibleCurrency) 108 | { 109 | ImGui.Begin("Currency Alert", guiOptions); 110 | 111 | if (first) 112 | { 113 | ImGui.Text($"You need to spend your"); 114 | if (this.configuration.StackDirection == StackDirection.Left || this.configuration.StackDirection == StackDirection.Right) 115 | { 116 | first = false; 117 | } 118 | } 119 | 120 | if (currency.Image != null) 121 | { 122 | ImGui.SameLine(); 123 | ImGui.Image(currency.Image.ImGuiHandle, new Vector2(22, 22)); 124 | } 125 | 126 | if (!this.configuration.MinimalDisplay) 127 | { 128 | ImGui.SameLine(); 129 | ImGui.Text($"{currency.Name}"); 130 | } 131 | 132 | if (this.configuration.StackDirection == StackDirection.Left || this.configuration.StackDirection == StackDirection.Right) 133 | { 134 | ImGui.SameLine(); 135 | } 136 | 137 | ImGui.End(); 138 | } 139 | } 140 | 141 | ImGui.End(); 142 | } 143 | 144 | public void DrawSettingsWindow() 145 | { 146 | ImGui.SetNextWindowSize(new Vector2(700, 500), ImGuiCond.FirstUseEver); 147 | if (ImGui.Begin("Currency Alert Configuration Window", ref this.settingsVisible)) 148 | { 149 | var uiLocked = this.configuration.UiLocked; 150 | 151 | if (ImGui.Checkbox("Lock alert window", ref uiLocked)) 152 | { 153 | this.configuration.UiLocked = uiLocked; 154 | this.configuration.Save(); 155 | } 156 | 157 | var minimalDisplay = this.configuration.MinimalDisplay; 158 | if (ImGui.Checkbox("Minimal Display", ref minimalDisplay)) 159 | { 160 | this.configuration.MinimalDisplay = minimalDisplay; 161 | this.configuration.Save(); 162 | } 163 | 164 | int stackDirection = (int) this.configuration.StackDirection; 165 | if (ImGui.Combo("Stack Direction", ref stackDirection, new string[] { "Up", "Down", "Left", "Right" }, 4)) 166 | { 167 | this.configuration.StackDirection = (StackDirection) stackDirection; 168 | this.configuration.Save(); 169 | }; 170 | 171 | if (ImGui.Button("Reset Position")) 172 | { 173 | lastMainWindowPos = new Vector2 { X = 100, Y = 100 }; 174 | } 175 | 176 | ImGui.NewLine(); 177 | 178 | if (ImGui.BeginTabBar("AlertsConfiguration_Tabs")) 179 | { 180 | foreach (var currency in CurrencyProvider.Instance.GetAll()) 181 | { 182 | var name = currency.Name; 183 | var category = currency.Category; 184 | var alertEnabled = this.configuration.AlertEnabled[currency.Id]; 185 | 186 | if (ImGui.BeginTabItem(category.ToString())) 187 | { 188 | if (currency.Image != null) 189 | { 190 | ImGui.Image(currency.Image.ImGuiHandle, new Vector2(22, 22)); 191 | ImGui.SameLine(); 192 | } 193 | 194 | ImGui.Text($"{currency.Name}"); 195 | 196 | if (ImGui.Checkbox($"Enabled##{name}", ref alertEnabled)) 197 | { 198 | this.configuration.AlertEnabled[currency.Id] = alertEnabled; 199 | this.configuration.Save(); 200 | } 201 | 202 | ImGui.SameLine(); 203 | 204 | var thresholdValue = this.configuration.Threshold[currency.Id]; 205 | 206 | if (ImGui.InputInt($"Threshold##{name}", ref thresholdValue, 1, 1, 207 | this.configuration.AlertEnabled[currency.Id] ? ImGuiInputTextFlags.None : ImGuiInputTextFlags.ReadOnly)) 208 | { 209 | this.configuration.Threshold[currency.Id] = thresholdValue; 210 | this.configuration.Save(); 211 | } 212 | 213 | ImGui.Separator(); 214 | 215 | ImGui.EndTabItem(); 216 | } 217 | } 218 | 219 | ImGui.EndTabBar(); 220 | } 221 | 222 | ImGui.End(); 223 | } 224 | } 225 | } 226 | } 227 | --------------------------------------------------------------------------------