Skip to content

Commit

Permalink
icon, bookkeeping changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tesu committed Oct 5, 2021
1 parent d266252 commit 0364046
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 34 deletions.
43 changes: 24 additions & 19 deletions PennyPincher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public class PennyPincher : IDalamudPlugin
private int configMin;
private int configMod;
private int configDelta;
private bool configAlwaysOn;

private int configMode;
private bool configHq;
private bool configSmart;
private bool configVerbose;

private bool _config;
Expand Down Expand Up @@ -99,24 +99,22 @@ private void DrawWindow()
{
if (!_config) return;

ImGui.SetNextWindowSize(new Num.Vector2(600, 600), ImGuiCond.FirstUseEver);
ImGui.SetNextWindowSize(new Num.Vector2(550, 270), ImGuiCond.FirstUseEver);
ImGui.Begin($"{Name} Config", ref _config);

ImGui.InputInt("Delta", ref configDelta);
ImGui.TextWrapped("Sets the undercutting amount to be <delta>.");
ImGui.InputInt("Amount to undercut by", ref configDelta);

ImGui.InputInt("Minimum Price", ref configMin);
ImGui.TextWrapped("Sets a minimum value to be copied. <min> cannot be below 1.");
ImGui.InputInt("Minimum price to copy", ref configMin);

ImGui.InputInt("Mod", ref configMod);
ImGui.TextWrapped("Adjusts base price by subtracting <price> % <mod> from <price> before subtracting <delta>.\nThis makes the last digits of your posted prices consistent.");
ImGui.InputInt("Modulo*", ref configMod);
ImGui.TextWrapped("*Subtracts an additional [<lowest price> %% <modulo>] from the price (no effect if modulo is 1).\nThis can be used to make the last digits of your copied prices consistent.");

ImGui.Separator();
ImGui.Checkbox($"Always On: Toggles whether {Name} is always on (supersedes 'Smart Mode')", ref configAlwaysOn);
ImGui.Checkbox($"HQ: Toggles whether {Name} should only undercut HQ items when you're listing an HQ item", ref configHq);
ImGui.Checkbox($"Smart Mode: Toggles whether {Name} should automatically copy when you're using a retainer", ref configSmart);
ImGui.Checkbox($"Verbose: Toggles whether {Name} prints whenever it copies to clipboard", ref configVerbose);

string[] modes = { "Never", "Only at Retainer", "Always" };
ImGui.Combo("When to copy", ref configMode, modes, modes.Length);
ImGui.Checkbox($"When listing an item that can be HQ, only undercut HQ items", ref configHq);
ImGui.Checkbox($"Print chat message when prices are copied to clipboard", ref configVerbose);

ImGui.Separator();
if (ImGui.Button("Save and Close Config"))
Expand All @@ -135,27 +133,34 @@ private void LoadConfig()
configMin = configuration.min;
configMod = configuration.mod;

configAlwaysOn = configuration.alwaysOn;
configMode = configuration.alwaysOn ? 2 : (configuration.smart ? 1 : 0);

configHq = configuration.hq;
configSmart = configuration.smart;
configVerbose = configuration.verbose;
}

private void SaveConfig()
{
if (configMin < 1)
{
Chat.Print($"{Name}: <min> cannot be lower than 1.");
Chat.Print("Minimum price must be positive.");
configMin = 1;
}

if (configMod < 1)
{
Chat.Print("Modulo must be positive.");
configMod = 1;
}

configuration.delta = configDelta;
configuration.min = configMin;
configuration.mod = configMod;

configuration.alwaysOn = configAlwaysOn;
configuration.alwaysOn = configMode == 2;
configuration.smart = configMode == 1;

configuration.hq = configHq;
configuration.smart = configSmart;
configuration.verbose = configVerbose;

PluginInterface.SavePluginConfig(configuration);
Expand Down
3 changes: 0 additions & 3 deletions PennyPincher.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"Name": "Penny Pincher",
"Punchline": "Copies 1 below the cheapest offer to your clipboard when you check marketboard prices",
"Description": "Plugin for simplifying \"pennying\" (undercutting current lowest offer by 1).\n\nThe usual workflow for this is the following:\n1. Open up the adjust price menu for the item you're undercutting\n2. Click on the compare prices menu to view the current listings\n3. Take a mental note of what the current lowest offer is\n4. Subtract one from it\n5. Close the current listings window\n6. Update your item's price with the number you noted\n7. Confirm your new price\n\nThis plugin eliminates the mental notekeeping steps in the middle by automatically copying the number you want onto your clipboard when you open the current listings window. \n\nTherefore, your new workflow becomes this:\n1. Open up the adjust price menu for the item you're undercutting\n2. Click on the compare prices menu to view the current listings\n3. Close the current listings window\n4. Paste the undercut value in\n5. Confirm your new price\n\nThis both speeds up the process and reduces room for error from typos.",
"InternalName": "PennyPincher",
"AssemblyVersion": "1.4.0.0",
"RepoUrl": "https://github.com/tesu/PennyPincher",
"ApplicableVersion": "any",
"Tags": [ "marketboard", "undercut", "penny", "clipboard" ],
"ImageUrls": [],
"IconUrl": "https://github.com/tesu/PennyPincher/raw/master/images/icon.png",
Expand Down
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@ Therefore, your new workflow becomes this:

This both speeds up the process and reduces room for error from typos.

## Commands
| Command&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Description | Default |
|---------|-------------|---------|
|`/penny`|Toggles whether to always copy prices. Supercedes the `smart` setting.|disabled|
|`/penny delta <delta>`|Sets how much to undercut by. A delta of 0 would copy the same price as the lowest offer, and a delta of 100 would copy 100 under the lowest offer. Negative numbers work exactly how you would expect, though it's not obvious to me how this could be useful.|1|
|`/penny hq`|Toggles whether to only undercut HQ items when listing an item that can be HQ.|enabled|
|`/penny mod <mod>`|Adjusts base price by subtracting `<price> % <mod>` from `<price>` before subtracting `<delta>`. This makes the last digits of your posted prices consistent.|1|
|`/penny min <min>`|Sets a minimum value that <price> will not go lower than. <min> cannot be below 1.|1|
|`/penny smart`|Toggles whether to always copy prices when accessing the marketboard from a retainer.|enabled|
|`/penny verbose`|Toggles whether to print to chat when a price to copied.|enabled|
|`/penny help`|Displays the list of commands.||

## Changelog
1.4.0.0: Configuration via UI instead of slash-commands
1.3.0.0: `/penny min` added, `/penny hq` behavior reverted to the old dumb behavior, updated to dalamud API v4
Expand Down
Binary file modified images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0364046

Please sign in to comment.