added missing currencies
This commit is contained in:
parent
f0f6b6ae81
commit
0aa8a8b350
14
SamplePlugin/Attribute/CategoryAttribute.cs
Normal file
14
SamplePlugin/Attribute/CategoryAttribute.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace CurrencyAlert.Enum
|
||||
{
|
||||
internal class CategoryAttribute : Attribute
|
||||
{
|
||||
public CategoryAttribute(string v)
|
||||
{
|
||||
Value = v;
|
||||
}
|
||||
|
||||
public string Value { get; }
|
||||
}
|
||||
}
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace CurrencyAlert
|
||||
{
|
||||
internal class SlotAttribute : Attribute
|
||||
internal class ItemIDAttribute : Attribute
|
||||
{
|
||||
public SlotAttribute(int v)
|
||||
public ItemIDAttribute(int v)
|
||||
{
|
||||
Value = v;
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Authors></Authors>
|
||||
<Company></Company>
|
||||
<Version>0.2.4.0</Version>
|
||||
<Version>0.3.0.0</Version>
|
||||
<Description>Currency Alert</Description>
|
||||
<Copyright></Copyright>
|
||||
<PackageProjectUrl>https://github.com/Lharz/xiv-currency-alert</PackageProjectUrl>
|
||||
|
@ -8,19 +8,39 @@ namespace CurrencyAlert.Enum
|
||||
{
|
||||
public enum Currency
|
||||
{
|
||||
[Name("Tomestones of Poetics"), Slot(6), DefaultThreshold(1400)]
|
||||
[Name("Tomestones of Poetics"), ItemID(28), DefaultThreshold(1400), Category("Battle")]
|
||||
TomestoneOfPoetics,
|
||||
[Name("Tomestones of Astronomy"), Slot(10), DefaultThreshold(1800)]
|
||||
[Name("Tomestones of Aphorism"), ItemID(42), DefaultThreshold(1700), Category("Battle")]
|
||||
TomestoneOfAphorism,
|
||||
[Name("Tomestones of Astronomy"), ItemID(43), DefaultThreshold(1700), Category("Battle")]
|
||||
TomestoneOfAstronomy,
|
||||
[Name("Storm Seals"), Slot(1), DefaultThreshold(75000)]
|
||||
|
||||
[Name("Storm Seals"), ItemID(20), DefaultThreshold(75000), Category("Common")]
|
||||
StormSeal,
|
||||
[Name("Serpent Seals"), Slot(2), DefaultThreshold(75000)]
|
||||
[Name("Serpent Seals"), ItemID(21), DefaultThreshold(75000), Category("Common")]
|
||||
SerpentSeal,
|
||||
[Name("Flame Seals"), Slot(3), DefaultThreshold(75000)]
|
||||
[Name("Flame Seals"), ItemID(22), DefaultThreshold(75000), Category("Common")]
|
||||
FlameSeal,
|
||||
[Name("Wolf Marks"), Slot(4), DefaultThreshold(18000)]
|
||||
|
||||
[Name("Wolf Marks"), ItemID(25), DefaultThreshold(18000), Category("Battle")]
|
||||
WolfMark,
|
||||
[Name("Allied Seals"), Slot(8), DefaultThreshold(3500)]
|
||||
AlliedSeal
|
||||
|
||||
[Name("Allied Seals"), ItemID(27), DefaultThreshold(3500), Category("Battle")]
|
||||
AlliedSeal,
|
||||
[Name("Centurio Seals"), ItemID(10307), DefaultThreshold(3500), Category("Battle")]
|
||||
CenturioSeal,
|
||||
[Name("Sack of Nuts"), ItemID(26533), DefaultThreshold(3500), Category("Battle")]
|
||||
SackOfNut,
|
||||
|
||||
[Name("White Crafters' Scrip"), ItemID(25199), DefaultThreshold(1500), Category("Other")]
|
||||
WhiteCraftersScrip,
|
||||
[Name("Purple Crafters' Scrip"), ItemID(33913), DefaultThreshold(1500), Category("Other")]
|
||||
PurpleCraftersScrip,
|
||||
[Name("White Gatherers' Scrip"), ItemID(25200), DefaultThreshold(1500), Category("Other")]
|
||||
WhiteGatherersScrip,
|
||||
[Name("Purple Gatherers' Scrip"), ItemID(33914), DefaultThreshold(1500), Category("Other")]
|
||||
PurpleGatherersScrip,
|
||||
[Name("Skybuilders' Scrip"), ItemID(28063), DefaultThreshold(7500), Category("Other")]
|
||||
SkybuildersScrip
|
||||
}
|
||||
}
|
||||
|
@ -61,19 +61,11 @@ namespace CurrencyAlert
|
||||
unsafe
|
||||
{
|
||||
InventoryManager* inventoryManager = InventoryManager.Instance();
|
||||
InventoryContainer* currencyContainer = inventoryManager->GetInventoryContainer(InventoryType.Currency);
|
||||
|
||||
EnumHelper.Each<Currency>(currency =>
|
||||
{
|
||||
var slot = EnumHelper.GetAttributeOfType<SlotAttribute>(currency).Value;
|
||||
InventoryItem* item = currencyContainer->GetInventorySlot((int)slot);
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
return; // TODO: write a log somewhere
|
||||
}
|
||||
|
||||
uint quantity = item->Quantity;
|
||||
var itemID = EnumHelper.GetAttributeOfType<ItemIDAttribute>(currency).Value;
|
||||
int quantity = inventoryManager->GetInventoryItemCount((uint)itemID);
|
||||
|
||||
if (this.Configuration.AlertEnabled[currency] && quantity >= this.Configuration.Threshold[currency])
|
||||
{
|
||||
|
@ -80,30 +80,39 @@ namespace CurrencyAlert
|
||||
|
||||
public void DrawSettingsWindow()
|
||||
{
|
||||
ImGui.SetNextWindowSize(new Vector2(400, 600), ImGuiCond.Always);
|
||||
ImGui.SetNextWindowSize(new Vector2(700, 500), ImGuiCond.Always);
|
||||
if (ImGui.Begin("Currency Alert Configuration Window", ref this.settingsVisible,
|
||||
ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse))
|
||||
ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollWithMouse))
|
||||
{
|
||||
EnumHelper.Each<Currency>(currency =>
|
||||
if (ImGui.BeginTabBar("AlertsConfiguration_Tabs"))
|
||||
{
|
||||
var name = EnumHelper.GetAttributeOfType<NameAttribute>(currency).Value;
|
||||
var alertEnabled = this.configuration.AlertEnabled[currency];
|
||||
|
||||
if (ImGui.Checkbox($"{name} Alert Enabled", ref alertEnabled))
|
||||
EnumHelper.Each<Currency>(currency =>
|
||||
{
|
||||
this.configuration.AlertEnabled[currency] = alertEnabled;
|
||||
this.configuration.Save();
|
||||
}
|
||||
var name = EnumHelper.GetAttributeOfType<NameAttribute>(currency).Value;
|
||||
var category = EnumHelper.GetAttributeOfType<CategoryAttribute>(currency).Value;
|
||||
var alertEnabled = this.configuration.AlertEnabled[currency];
|
||||
|
||||
var thresholdValue = this.configuration.Threshold[currency];
|
||||
if (ImGui.BeginTabItem(category))
|
||||
{
|
||||
if (ImGui.Checkbox($"{name} Alert Enabled", ref alertEnabled))
|
||||
{
|
||||
this.configuration.AlertEnabled[currency] = alertEnabled;
|
||||
this.configuration.Save();
|
||||
}
|
||||
|
||||
if (ImGui.InputInt($"{name} Threshold Value", ref thresholdValue, 1, 1,
|
||||
this.configuration.AlertEnabled[currency] ? ImGuiInputTextFlags.None : ImGuiInputTextFlags.ReadOnly))
|
||||
{
|
||||
this.configuration.Threshold[currency] = thresholdValue;
|
||||
this.configuration.Save();
|
||||
}
|
||||
});
|
||||
var thresholdValue = this.configuration.Threshold[currency];
|
||||
|
||||
if (ImGui.InputInt($"{name} Threshold Value", ref thresholdValue, 1, 1,
|
||||
this.configuration.AlertEnabled[currency] ? ImGuiInputTextFlags.None : ImGuiInputTextFlags.ReadOnly))
|
||||
{
|
||||
this.configuration.Threshold[currency] = thresholdValue;
|
||||
this.configuration.Save();
|
||||
}
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
@ -125,8 +134,13 @@ namespace CurrencyAlert
|
||||
{
|
||||
InventoryManager* inventoryManager = InventoryManager.Instance();
|
||||
|
||||
ImGui.Text($"ItemID: 42 Value: {inventoryManager->GetInventoryItemCount(42)}");
|
||||
|
||||
EnumHelper.Each<InventoryType>(type =>
|
||||
{
|
||||
if (type != InventoryType.Currency)
|
||||
return;
|
||||
|
||||
InventoryContainer* currencyContainer = inventoryManager->GetInventoryContainer(type);
|
||||
|
||||
if (currencyContainer == null)
|
||||
|
Loading…
Reference in New Issue
Block a user