Thread Tools Display Modes
02/10/22, 02:54 AM   #1
MarcusUK
Join Date: Jun 2021
Posts: 15
Potion waste prevention addon

I find it's far too easy to "tap" the quickslot "up" on the D-pad on my controller leading to potions being consumed when not intended, which is wasteful and annoying. Looking for a QoL mod that helps improve this for gamepad, but I don't know if any of this is even possible or whether the API offers variables for each type of potion in the game to allow it. But in my mind it would function something like this:

Consumption requires "double tap" instead on a single "tap" so player is sort of required to confirm their intention to use a potion if a condition not met for the slotted potion:

For example, if using a Stamina potion and Stam-bar is not below an amount set in addon/settings e.g. 20% double-tap is required, else single-tap works (to speed things up in more urgent combat situations). If key-pushes can be put into functions, then the second tap would have to be registered within a certain time to count, such as 500ms.

Same principle for a Health or Magicka potion. Each stat may have different settings that a player requires to trigger usage with 1-tap or need a 2-tap because bar is not low enough, e.g. they may want to use Stam/Magic refills at ~<20% but Health at ~<50% in a crunch.

Not sure how to make this work for Tri-stat potions as I'm thinking mainly of potions that mainly target Stamina, Health or Magicka rather than 2 or 3 stats. Possibly having several custom options for how single-stat and multi-stat potions are triggered.

Would appreciate knowing if either such an addon exists or whether or not such an addon could be made.

Thanks.
  Reply With Quote
02/10/22, 07:09 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
The API meanwhile does not provide any "only" potion related identifers anymore :-(
In the past one could use the abilityId (buffId) of the potion which you were able to see at your character buffs.
I had worked on LibPotionBuff in the past but meanwhile the buffs that you will get via a potion share the same IDs with other skill's buffs. You are not able to detect if you currently have used a potion via their buff anymore.

But as you are searching for something "BEFORE" the potion is used and the buffId is transfered to your character buffs:

One could track the quickslots and maybe save when a potion was used from the quickslot, and maybe even get the cooldown left on that.
One also is able to read the active quickslot upon "selection" (not before using it though as the functions are private, or only via hacky inperformant ways of a stack trace, making the gamecode "wait" for the stack trace each time you try to use ANY skill or ACTIONBAR entry (including quickslots and utimates)! ) and try to do some checks with the quickslot item then, like check if it is a potion.
But that's all as there are not API functions to detect the "potion data"! You can only get the flavortext of the potion and then parse that text for info. It does not provide you a simple way to e.g. detect the potion type (stamina, magicka,health, ...), the potion's buff that it will apply (and the buff also does not tell you it will be a magicka + -> this could only have been mapped via LibPotionBuff then so it would need lookup tables), etc.

So there is no easy way to detect the potion in your slot is a stamina potion! Except for hardcoding a lookup table for ALL potions
LibPotionBuff does not provide them as it only stored the "buffIds" (abilityIds) and not the itemIds of the items. Maybe one could collect them and enhance it. But it would need updates each time they change or get new potion itemIds... and I dislike that. One maybe could scan all items ingame each API update once to check and dynamically collect them, but this takes time (~20-60 seconds) and lags your client then (once after an APIversion change) + will create SavedVariable files with the content that was dynamically selected which will make loading the game slower again as eah SV file increases loading time.

This all said: In keyboard mode. I do not knwo if gamepad mode provides the same but I guess somehow it will.

I'd say your request would be maybe somehow possible but there is a lot of manual effort to invest for updating it and keep it working.
I'd not count on someone trying or doing this.

My addon FCOStarveStop (keyboard mode I guess, never tested with gamepad as I do not own a controller) will provide a potion reminer based on LibPotionBuff. But soemhow it got instable as the potion buffs were changed by ZOs

Last edited by Baertram : 02/10/22 at 07:22 AM.
  Reply With Quote
02/10/22, 12:42 PM   #3
MarcusUK
Join Date: Jun 2021
Posts: 15
hmm, okay so from what I understand the API is very unlikely to make such an addon easy to create and even then it wouldn't be optimal. Got it. Thanks for detailed response even if it wasn't what I hoped for.
  Reply With Quote
02/10/22, 01:34 PM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
I guess it would be somehow possible this way, without having to know what potion "exactly" you are currently trying to use:

You define which potion type is slotted at what quickslot number via a settings menu.
e.g. slot 1 stamina, slot 2 magicka, slot 3 health, slot 3 tri stat
As you use the quickslots one could then check if the current used quickslot is slot 2, so check if your current magicka is below a threshold value, allow the usage then.

Not sure about the "allow the usage", if this would be even possible to "block", react on the double press key thing you had proposed, and if this all can be checked performantly. But this would be the easiest thing that comes into my mind for anyone wanting to try making that addon for you

Code of quickslot settings LibAddonMenu-2.0 menu can be spyed in my addon FCOStarveStop -> a dropdown box where the slotted quickslots are shown in and you are able to select one (please just give credit if you do so guys!) and the block of skills is e.g. handled in the addons that block necromancer skills out of combat (as the quickslot is a skill slot too somehow, or at least an action buton) -> LibSkillBlocker used in e.g. https://www.esoui.com/downloads/info...ecromancy.html (also credit where possible and if used, even if only spying code or ideas!)

Last edited by Baertram : 02/10/22 at 01:38 PM.
  Reply With Quote
02/13/22, 04:51 AM   #5
MarcusUK
Join Date: Jun 2021
Posts: 15
Been thinking about this, and wondered if a simpler approach might work with less focus on what potion is selected and more on preventing user input being applied when it is "unnecessary".

I saw a mod that auto-unbinds your crouch key when equipping Thrassian Stranglers that made me rethink this
https://www.esoui.com/downloads/info...Assistant.html

Do you suppose it is possible to have a mod that simply auto-unbinds the Quickslot D-pad "up" while all your stats (or one selected by the user in settings) are at 100% (or maybe a custom user setting such as 50%), that way if it is accidentally tapped no potion will be consumed?

If that could work, I suppose the real question then is whether any unbind/rebind process can happen in the background "instantly" so as not to cause issues whenever a potion is required in combat.

Does the API allow mod authors to recognise what percent HP, Stam and Magicka are currently at and do something with that data?

Last edited by MarcusUK : 02/13/22 at 07:27 AM.
  Reply With Quote
02/13/22, 11:22 AM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
I'm not sure if this would kick you from server for message spam as unbinding and binding a keybind needs to contact the server as the keybinds are stored there. And chekcing this on every power update (stamina, health, magicka) each time might be too much if e.g. your kebyind get's unbound and a few ms later bound again and then unbound again due to your stamina in- or decresing quite often through usage of ultimates, skills (depending on class passives or race passives e.g.) and so on...

And this would only unbind your keybind which makes it impossible to do anything with the quickslots, e.g. eat in combat when needed, or call companion again out of combat (if your power is above some value), so you also need to check for in/out of combat and so on ...

I'd not do such kind as it seems to be quite stressy for the server.

And yes there is an event for power change (powerTypes are magicka, stamina, health) afaik.
  Reply With Quote

ESOUI » AddOns » AddOn Search/Requests » Potion waste prevention addon

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off