-
Notifications
You must be signed in to change notification settings - Fork 17
/
ConfigUI.cs
156 lines (129 loc) · 6.04 KB
/
ConfigUI.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
using System;
using ImGuiNET;
namespace PriceInsight;
internal class ConfigUI(PriceInsightPlugin plugin) : IDisposable {
private bool settingsVisible = false;
public bool SettingsVisible {
get => settingsVisible;
set => settingsVisible = value;
}
public void Dispose() {
}
public void Draw() {
if (!SettingsVisible) {
return;
}
var conf = plugin.Configuration;
if (ImGui.Begin("Price Insight Config", ref settingsVisible,
ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.AlwaysAutoResize)) {
var configValue = conf.RefreshWithAlt;
if (ImGui.Checkbox("Tap Alt to refresh prices", ref configValue)) {
conf.RefreshWithAlt = configValue;
conf.Save();
}
configValue = conf.PrefetchInventory;
if (ImGui.Checkbox("Prefetch prices for items in inventory", ref configValue)) {
conf.PrefetchInventory = configValue;
conf.Save();
}
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Prefetch prices for all items in inventory, chocobo saddlebag and retainer when logging in.");
configValue = conf.UseCurrentWorld;
if (ImGui.Checkbox("Use current world as home world", ref configValue)) {
conf.UseCurrentWorld = configValue;
conf.Save();
plugin.ClearCache();
}
if (ImGui.IsItemHovered())
ImGui.SetTooltip("The current world you're on will be considered your \"home world\".\nUseful if you're datacenter travelling and want to see prices there.");
ImGui.Separator();
ImGui.PushID(0);
ImGui.Text("Show cheapest price in:");
configValue = conf.ShowRegion;
if (ImGui.Checkbox("Region", ref configValue)) {
conf.ShowRegion = configValue;
conf.Save();
}
TooltipRegion();
configValue = conf.ShowDatacenter;
if (ImGui.Checkbox("Datacenter", ref configValue)) {
conf.ShowDatacenter = configValue;
conf.Save();
}
configValue = conf.ShowWorld;
if (ImGui.Checkbox("Home world", ref configValue)) {
conf.ShowWorld = configValue;
conf.Save();
}
ImGui.PopID();
ImGui.Separator();
ImGui.PushID(1);
ImGui.Text("Show most recent purchase in:");
configValue = conf.ShowMostRecentPurchaseRegion;
if (ImGui.Checkbox("Region", ref configValue)) {
conf.ShowMostRecentPurchaseRegion = configValue;
conf.Save();
}
TooltipRegion();
configValue = conf.ShowMostRecentPurchase;
if (ImGui.Checkbox("Datacenter", ref configValue)) {
conf.ShowMostRecentPurchase = configValue;
conf.Save();
}
configValue = conf.ShowMostRecentPurchaseWorld;
if (ImGui.Checkbox("Home world", ref configValue)) {
conf.ShowMostRecentPurchaseWorld = configValue;
conf.Save();
}
ImGui.PopID();
ImGui.Separator();
var selectValue = conf.ShowDailySaleVelocityIn;
if (ImGui.Combo("Show sales per day", ref selectValue, "Do not show\0World\0Datacenter\0Region")) {
conf.ShowDailySaleVelocityIn = selectValue;
conf.Save();
}
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Show the average sales per day based on sales of the last 4 days.");
selectValue = conf.ShowAverageSalePriceIn;
if (ImGui.Combo("Show average sale price", ref selectValue, "Do not show\0World\0Datacenter\0Region")) {
conf.ShowAverageSalePriceIn = selectValue;
conf.Save();
}
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Show the average sale price based on sales of the last 4 days.");
configValue = conf.ShowStackSalePrice;
if (ImGui.Checkbox("Show stack sale price", ref configValue)) {
conf.ShowStackSalePrice = configValue;
conf.Save();
}
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Show the price of the hovered stack if sold at the given unit price.");
configValue = conf.ShowAge;
if (ImGui.Checkbox("Show age of data", ref configValue)) {
conf.ShowAge = configValue;
conf.Save();
}
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Show when the price info was last refreshed.\nCan be turned off to reduce tooltip bloat.");
configValue = conf.ShowDatacenterOnCrossWorlds;
if (ImGui.Checkbox("Show datacenter for foreign worlds", ref configValue)) {
conf.ShowDatacenterOnCrossWorlds = configValue;
conf.Save();
}
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Show the datacenter for worlds from other datacenters when displaying prices for the entire region.\nCan be turned off to reduce tooltip bloat.");
configValue = conf.ShowBothNqAndHq;
if (ImGui.Checkbox("Always display NQ and HQ prices", ref configValue)) {
conf.ShowBothNqAndHq = configValue;
conf.Save();
}
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Show the prices for both NQ and HQ of an item.\nWhen turned off will only display price for the current quality (use Ctrl to switch between NQ and HQ).");
}
ImGui.End();
}
private static void TooltipRegion() {
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Include all datacenters available via datacenter traveling.");
}
}