POC
This commit is contained in:
parent
82f714f0d6
commit
0d68ee0a54
@ -7,9 +7,9 @@ namespace SamplePlugin
|
||||
[Serializable]
|
||||
public class Configuration : IPluginConfiguration
|
||||
{
|
||||
public int Version { get; set; } = 0;
|
||||
public int Version { get; set; } = 1;
|
||||
|
||||
public bool SomePropertyToBeSavedAndWithADefault { get; set; } = true;
|
||||
public int PoeticsThreshold { get; set; } = 1500;
|
||||
|
||||
// the below exist just to make saving less cumbersome
|
||||
|
||||
|
@ -10,7 +10,7 @@ namespace SamplePlugin
|
||||
{
|
||||
public string Name => "Sample Plugin";
|
||||
|
||||
private const string commandName = "/pmycommand";
|
||||
private const string commandName = "/tsalert";
|
||||
|
||||
private DalamudPluginInterface PluginInterface { get; init; }
|
||||
private CommandManager CommandManager { get; init; }
|
||||
|
@ -1,4 +1,5 @@
|
||||
using ImGuiNET;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
using ImGuiNET;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
@ -25,13 +26,16 @@ namespace SamplePlugin
|
||||
{
|
||||
get { return this.settingsVisible; }
|
||||
set { this.settingsVisible = value; }
|
||||
}
|
||||
|
||||
// passing in the image here just for simplicity
|
||||
}
|
||||
|
||||
//public unsafe InventoryManager* InventoryManager { get; }
|
||||
|
||||
// passing in the image here just for simplicity
|
||||
public PluginUI(Configuration configuration, ImGuiScene.TextureWrap goatImage)
|
||||
{
|
||||
this.configuration = configuration;
|
||||
this.goatImage = goatImage;
|
||||
//this.InventoryManager = InventoryManager.Instance();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@ -54,30 +58,57 @@ namespace SamplePlugin
|
||||
|
||||
public void DrawMainWindow()
|
||||
{
|
||||
if (!Visible)
|
||||
{
|
||||
return;
|
||||
unsafe
|
||||
{
|
||||
InventoryManager* inventoryManager = InventoryManager.Instance();
|
||||
InventoryContainer* currencyContainer = inventoryManager->GetInventoryContainer(InventoryType.Currency);
|
||||
|
||||
// Poetics: 6
|
||||
// Wolf Marks: 4
|
||||
// Allied Seal: 8
|
||||
// Company Seals: 1,2,3
|
||||
|
||||
uint poetics = currencyContainer->GetInventorySlot(6)->Quantity;
|
||||
uint wolfMarks = currencyContainer->GetInventorySlot(4)->Quantity;
|
||||
uint stormSeals = currencyContainer->GetInventorySlot(1)->Quantity;
|
||||
uint serpentSeals = currencyContainer->GetInventorySlot(2)->Quantity;
|
||||
uint flameSeals = currencyContainer->GetInventorySlot(3)->Quantity;
|
||||
|
||||
uint poeticsThreshold = (uint) this.configuration.PoeticsThreshold;
|
||||
|
||||
Visible = false;
|
||||
|
||||
if (poetics >= poeticsThreshold)
|
||||
{
|
||||
Visible = true;
|
||||
}
|
||||
|
||||
//if (wolfMarks >= 15000)
|
||||
//{
|
||||
// ImGui.Text("Wolf Marks: " + wolfMarks);
|
||||
//}
|
||||
|
||||
if (!Visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.SetNextWindowSize(new Vector2(375, 330), ImGuiCond.FirstUseEver);
|
||||
ImGui.SetNextWindowSizeConstraints(new Vector2(375, 330), new Vector2(float.MaxValue, float.MaxValue));
|
||||
if (ImGui.Begin("My Amazing Window", ref this.visible, ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse))
|
||||
{
|
||||
if (ImGui.Button("Show Settings"))
|
||||
{
|
||||
SettingsVisible = true;
|
||||
}
|
||||
|
||||
if (poetics >= poeticsThreshold)
|
||||
{
|
||||
ImGui.Text("DEPENSE TES POETICS MERDE");
|
||||
}
|
||||
}
|
||||
ImGui.End();
|
||||
}
|
||||
|
||||
ImGui.SetNextWindowSize(new Vector2(375, 330), ImGuiCond.FirstUseEver);
|
||||
ImGui.SetNextWindowSizeConstraints(new Vector2(375, 330), new Vector2(float.MaxValue, float.MaxValue));
|
||||
if (ImGui.Begin("My Amazing Window", ref this.visible, ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse))
|
||||
{
|
||||
ImGui.Text($"The random config bool is {this.configuration.SomePropertyToBeSavedAndWithADefault}");
|
||||
|
||||
if (ImGui.Button("Show Settings"))
|
||||
{
|
||||
SettingsVisible = true;
|
||||
}
|
||||
|
||||
ImGui.Spacing();
|
||||
|
||||
ImGui.Text("Have a goat:");
|
||||
ImGui.Indent(55);
|
||||
ImGui.Image(this.goatImage.ImGuiHandle, new Vector2(this.goatImage.Width, this.goatImage.Height));
|
||||
ImGui.Unindent(55);
|
||||
}
|
||||
ImGui.End();
|
||||
}
|
||||
|
||||
public void DrawSettingsWindow()
|
||||
@ -92,10 +123,10 @@ namespace SamplePlugin
|
||||
ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse))
|
||||
{
|
||||
// can't ref a property, so use a local copy
|
||||
var configValue = this.configuration.SomePropertyToBeSavedAndWithADefault;
|
||||
if (ImGui.Checkbox("Random Config Bool", ref configValue))
|
||||
var configValue = this.configuration.PoeticsThreshold;
|
||||
if (ImGui.InputInt("Poetics Threshold", ref configValue))
|
||||
{
|
||||
this.configuration.SomePropertyToBeSavedAndWithADefault = configValue;
|
||||
this.configuration.PoeticsThreshold = configValue;
|
||||
// can save immediately on change, if you don't want to provide a "Save and Close" button
|
||||
this.configuration.Save();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user