changed currencies default values

This commit is contained in:
Camille 2022-01-19 11:14:20 +01:00
parent d79572fe6f
commit be3d07dd8b
5 changed files with 61 additions and 12 deletions

View File

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Authors></Authors> <Authors></Authors>
<Company></Company> <Company></Company>
<Version>0.2.2.0</Version> <Version>0.2.2</Version>
<Description>Currency Alert</Description> <Description>Currency Alert</Description>
<Copyright></Copyright> <Copyright></Copyright>
<PackageProjectUrl>https://github.com/Lharz/xiv-currency-alert</PackageProjectUrl> <PackageProjectUrl>https://github.com/Lharz/xiv-currency-alert</PackageProjectUrl>
@ -22,6 +22,8 @@
<PropertyGroup> <PropertyGroup>
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath> <DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
<RepositoryUrl>https://github.com/Lharz/xiv-currency-alert</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -8,9 +8,9 @@ namespace CurrencyAlert.Enum
{ {
public enum Currency public enum Currency
{ {
[Name("Tomestones of Poetics"), Slot(6), DefaultThreshold(1500)] [Name("Tomestones of Poetics"), Slot(6), DefaultThreshold(1400)]
TomestoneOfPoetics, TomestoneOfPoetics,
[Name("Tomestones of Astronomy"), Slot(10), DefaultThreshold(1500)] [Name("Tomestones of Astronomy"), Slot(10), DefaultThreshold(1800)]
TomestoneOfAstronomy, TomestoneOfAstronomy,
[Name("Storm Seals"), Slot(1), DefaultThreshold(75000)] [Name("Storm Seals"), Slot(1), DefaultThreshold(75000)]
StormSeal, StormSeal,

View File

@ -66,7 +66,14 @@ namespace CurrencyAlert
EnumHelper.Each<Currency>(currency => EnumHelper.Each<Currency>(currency =>
{ {
var slot = EnumHelper.GetAttributeOfType<SlotAttribute>(currency).Value; var slot = EnumHelper.GetAttributeOfType<SlotAttribute>(currency).Value;
uint quantity = currencyContainer->GetInventorySlot((int)slot)->Quantity; InventoryItem* item = currencyContainer->GetInventorySlot((int)slot);
if (item == null)
{
return; // TODO: write a log somewhere
}
uint quantity = item->Quantity;
if (this.Configuration.AlertEnabled[currency] && quantity >= this.Configuration.Threshold[currency]) if (this.Configuration.AlertEnabled[currency] && quantity >= this.Configuration.Threshold[currency])
{ {

View File

@ -88,7 +88,7 @@ namespace CurrencyAlert
{ {
var name = EnumHelper.GetAttributeOfType<NameAttribute>(currency).Value; var name = EnumHelper.GetAttributeOfType<NameAttribute>(currency).Value;
var alertEnabled = this.configuration.AlertEnabled[currency]; var alertEnabled = this.configuration.AlertEnabled[currency];
if (ImGui.Checkbox($"{name} Alert Enabled", ref alertEnabled)) if (ImGui.Checkbox($"{name} Alert Enabled", ref alertEnabled))
{ {
this.configuration.AlertEnabled[currency] = alertEnabled; this.configuration.AlertEnabled[currency] = alertEnabled;
@ -124,17 +124,27 @@ namespace CurrencyAlert
unsafe unsafe
{ {
InventoryManager* inventoryManager = InventoryManager.Instance(); InventoryManager* inventoryManager = InventoryManager.Instance();
InventoryContainer* currencyContainer = inventoryManager->GetInventoryContainer(InventoryType.Currency);
for (var i = 0; i < 100000; ++i) EnumHelper.Each<InventoryType>(type =>
{ {
var item = currencyContainer->GetInventorySlot(i); InventoryContainer* currencyContainer = inventoryManager->GetInventoryContainer(type);
if (item == null) if (currencyContainer == null)
continue; {
return; // TODO: log something
}
ImGui.Text($"Index: {i} Value: {item->Quantity}"); ImGui.Text($"----- {type.ToString()} -----");
} for (var i = 0; i < int.MaxValue; ++i)
{
var item = currencyContainer->GetInventorySlot(i);
if (item == null)
break;
ImGui.Text($"Index: {i} Value: {item->Quantity}");
}
});
} }
} }

View File

@ -11,3 +11,33 @@
"tomestones" "tomestones"
] ]
} }
{
"Disabled": true,
"Testing": false,
"InstalledFromUrl": null,
"Author": "Lharz",
"Name": "Currency Alert",
"Punchline": "Configure alerts upon reaching various currencies amount.",
"Description": "This plugin lets you setup alerts upon reaching configurable currencies amount (such as Poetics or Wolf Marks). You will never overcap your currencies now.",
"Tags": [
"plugin",
"currency",
"tomestones"
],
"IsHide": false,
"InternalName": "CurrencyAlert",
"AssemblyVersion": "0.2.2.0",
"TestingAssemblyVersion": null,
"IsTestingExclusive": false,
"RepoUrl": null,
"ApplicableVersion": "any",
"DalamudApiLevel": 4,
"DownloadCount": 0,
"LastUpdate": 0,
"DownloadLinkInstall": null,
"DownloadLinkUpdate": null,
"DownloadLinkTesting": null,
"LoadPriority": 0,
"ImageUrls": null,
"IconUrl": null
}