Add equipment manager auto-switching and "Unused" items panel (#70)

* Add equipment manager auto-switching and "Unused" items panel

Equipment manager (modules/equipmentmanager.lua):
- Add automatic set switching: ordered triggers (mounted, swimming,
  eating/drinking, shapeshift form/stance, zone, instance type, time
  of day, resting, stealthed, targeting a boss) equip a set; topmost
  matching trigger wins, with a 0.5s debounce
- Never swap gear in combat, while dead or casting; optionally restore
  the previous gear via a hidden "pfUI Auto-Restore" set
- Add an "Unused" side panel listing equippable items in bags, bank
  and paperdoll that no set uses, with an ignore list (tools and quest
  disguises pre-ignored), bank snapshot and bag highlighting
- Persist triggers, ignore list and bank snapshot in new per-character
  SavedVariable pfUI_eqmgr (all three .toc files)
- Add Character > Equipment Manager options (autoswitch, announce,
  minimum item quality, include bank) in gui.lua and config.lua
- Hide ignored-slot overlays when the manager frame is closed

Add frFR translations for the new equipment manager strings.

* equipmentmanager: lean on ClassicAPI for unused scan and autoswitch

- Unused panel: list items via GetInventoryItemsForSlot instead of
  hand-packing locations and walking the bags.
- Bank snapshot: record set membership while the bank is open.
  GetItemLocations reports bank items as missing once it closes, so set
  items in the bank were listed as unused.
- Autoswitch: check CanUseEquipmentSets and the UseEquipmentSet result
  before marking a trigger applied, and retry when the swap is blocked.
- Drive the engine from events (aura, form, zone, resting, target,
  regen) instead of a 4 Hz ticker; poll only swimming, time and eating.
- Detect eating/drinking by the localized names of the Food (433) and
  Drink (430) auras instead of hardcoded locale strings and icon paths.
- Drop presence guards on APIs that always exist; use strsplittable and
  strtrim for trigger values.

* equipmentmanager: wake the dining trigger on player health/mana events

Drop dining from the poll: listen to UNIT_HEALTH/UNIT_MANA for the player
while a dining trigger is enabled, so taking the set off once full is
event-driven. Register UNIT_AURA for the player only.

* equipmentmanager: split trigger values with strsplit

strsplittable needs ClassicAPI 1.17.11; strsplit has been there since
1.7.3, so this keeps the minimum where it is.

* equipmentmanager: let the trigger hint wrap

---------

Co-authored-by: Duciel <336374+Duciel@users.noreply.github.com>
Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com>
This commit is contained in:
Duciel
2026-10-27 11:02:44 -05:00
committed by GitHub
co-authored by Duciel Brues
parent fe376b8e51
commit 0cabf2ec29
7 changed files with 1376 additions and 6 deletions
+4
View File
@@ -976,6 +976,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("character", "inventory", "durability", "1")
pfUI:UpdateConfig("character", "inventory", "equipflyout", "0")
pfUI:UpdateConfig("equipmentmanager", nil, "autoswitch", "1")
pfUI:UpdateConfig("equipmentmanager", nil, "announce", "1")
pfUI:UpdateConfig("equipmentmanager", nil, "unusedquality", "1")
pfUI:UpdateConfig("equipmentmanager", nil, "unusedbank", "1")
pfUI:UpdateConfig("character", "reputation", "repRequired", "1")
pfUI:UpdateConfig("thirdparty", nil, "chatbg", "1")
pfUI:UpdateConfig("thirdparty", nil, "showmeter", "0")
+70
View File
@@ -890,4 +890,74 @@ pfUI_translation["frFR"] = {
["Zonetime"] = nil,
["Zoom & Fade"] = "Zoom et fondu",
["Zoom Target Nameplate"] = "Zoom la cible des barres de vie flottantes",
["%d items, %d ignored"] = "%d objets, %d ignorés",
["Add the current zone"] = "Ajouter la zone actuelle",
["Announce Automatic Set Switches In Chat"] = "Annoncer les changements automatiques d'ensemble dans le chat",
["Any Form"] = "N'importe quelle forme",
["Aquatic Form"] = "Forme aquatique",
["Automatic Set Switching"] = "Changement automatique d'ensemble",
["Battle Stance"] = "Posture de combat",
["Battleground"] = "Champ de bataille",
["Bear Form"] = "Forme d'ours",
["Berserker Stance"] = "Posture berserker",
["Cat Form"] = "Forme de félin",
["Condition met, but a trigger higher in the list wins"] = "Condition remplie, mais un déclencheur plus haut dans la liste est prioritaire",
["Create an equipment set first."] = "Créez d'abord un ensemble d'équipement.",
["Currently active"] = "Actuellement actif",
["Defensive Stance"] = "Posture défensive",
["Do Nothing"] = "Ne rien faire",
["Dungeon"] = "Donjon",
["Eating / Drinking"] = "Manger / Boire",
["Enable Automatic Set Switching"] = "Activer le changement automatique d'ensemble",
["Equip"] = "Équiper",
["Equip sets automatically when mounted, swimming, eating, in a zone, at a given time and more."] = "Équipe automatiquement des ensembles en monture, en nageant, en mangeant, dans une zone, à une heure donnée, etc.",
["Equipment Manager"] = "Gestionnaire d'équipement",
["Equippable items in your bags, bank and paperdoll that no equipment set uses."] = "Objets équipables dans vos sacs, votre banque et sur votre personnage qu'aucun ensemble n'utilise.",
["Equipping %s"] = "Équipement de %s",
["Equipping %s (%s)"] = "Équipement de %s (%s)",
["Every equippable item is part of a set."] = "Tous les objets équipables font partie d'un ensemble.",
["Ghost Wolf"] = "Loup fantôme",
["Here"] = "Ici",
["Ignored (Right-Click to unignore)"] = "Ignoré (clic droit pour ne plus ignorer)",
["In Bags"] = "Dans les sacs",
["In Bank"] = "En banque",
["Include Bank Items"] = "Inclure les objets en banque",
["Instance Type"] = "Type d'instance",
["Items Not In Any Set"] = "Objets hors de tout ensemble",
["Local time window, e.g. 20:00-23:00"] = "Plage horaire locale, ex. 20:00-23:00",
["Minimum Item Quality"] = "Qualité minimale des objets",
["Moonkin Form"] = "Forme de sélénien",
["Mounted"] = "En monture",
["New Trigger"] = "Nouveau déclencheur",
["No Form (Caster)"] = "Sans forme (lanceur de sorts)",
["No set selected"] = "Aucun ensemble choisi",
["No triggers yet. Click \"New Trigger\" to add one."] = "Aucun déclencheur. Cliquez sur \"Nouveau déclencheur\" pour en ajouter un.",
["Not part of any equipment set"] = "Ne fait partie d'aucun ensemble",
["Open World"] = "Monde extérieur",
["Resting (Inn / City)"] = "Repos (auberge / ville)",
["Restore Previous Gear"] = "Remettre l'équipement précédent",
["Restoring previous gear"] = "Remise de l'équipement précédent",
["Select a trigger to edit it."] = "Sélectionnez un déclencheur pour le modifier.",
["Selected Trigger"] = "Déclencheur sélectionné",
["Separate several zones with ;"] = "Séparez plusieurs zones par ;",
["Shadowform"] = "Forme d'Ombre",
["Shapeshift Form / Stance"] = "Forme / Posture",
["Shift-Click: Link Ctrl-Click: Preview\nRight-Click: Ignore / Unignore"] = "Maj-clic : lien Ctrl-clic : aperçu\nClic droit : ignorer / ne plus ignorer",
["Show Ignored"] = "Afficher les ignorés",
["Stealth"] = "Camouflage",
["Stealthed"] = "Camouflé",
["Swimming"] = "À la nage",
["Targeting A Boss"] = "Cible un boss",
["Time Of Day"] = "Heure de la journée",
["Travel Form"] = "Forme de voyage",
["Tree of Life Form"] = "Forme d'arbre de vie",
["Triggers"] = "Déclencheurs",
["Triggers higher in the list take priority. Gear is never swapped in combat, while dead or while casting: the switch waits until it can happen."] = "Les déclencheurs en haut de la liste sont prioritaires. L'équipement n'est jamais changé en combat, mort ou pendant une incantation : le changement attend que ce soit possible.",
["Unused"] = "Inutilisés",
["Value"] = "Valeur",
["When"] = "Quand",
["When It Ends"] = "À la fin",
["Windows may wrap past midnight (22:00-02:00)."] = "Une plage peut passer minuit (22:00-02:00).",
["Zone"] = "Zone",
["Zone or subzone name"] = "Nom de zone ou de sous-zone",
}
File diff suppressed because it is too large Load Diff
+15
View File
@@ -2428,6 +2428,21 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(nil, T["Always Show Equipment Slot Flyouts"], C.character.inventory, "equipflyout", "checkbox")
end)
CreateGUIEntry(T["Character"], T["Equipment Manager"], function()
CreateConfig(nil, T["Automatic Set Switching"], nil, nil, "header")
CreateConfig(U["equipmentmanager"], T["Enable Automatic Set Switching"], C.equipmentmanager, "autoswitch", "checkbox")
CreateConfig(U["equipmentmanager"], T["Announce Automatic Set Switches In Chat"], C.equipmentmanager, "announce", "checkbox")
CreateConfig(nil, T["Items Not In Any Set"], nil, nil, "header")
CreateConfig(U["equipmentmanager"], T["Minimum Item Quality"], C.equipmentmanager, "unusedquality", "dropdown", {
"0:" .. ITEM_QUALITY0_DESC,
"1:" .. ITEM_QUALITY1_DESC,
"2:" .. ITEM_QUALITY2_DESC,
"3:" .. ITEM_QUALITY3_DESC,
"4:" .. ITEM_QUALITY4_DESC,
})
CreateConfig(U["equipmentmanager"], T["Include Bank Items"], C.equipmentmanager, "unusedbank", "checkbox")
end)
CreateGUIEntry(T["Character"], T["Reputation"], function()
CreateConfig(nil, T["Show Reputation Remaining"], C.character.reputation, "repRequired", "checkbox")
end)
+1 -1
View File
@@ -5,7 +5,7 @@
## Notes-ruRU: Полная замена пользовательского интерфейса.
## Version: @project-version@
## SavedVariables: pfUI_profiles, pfUI_addon_profiles, pfUI_cache, pfUI_throttle
## SavedVariablesPerCharacter: pfUI_config, pfUI_init, pfUI_playerDB
## SavedVariablesPerCharacter: pfUI_config, pfUI_init, pfUI_playerDB, pfUI_eqmgr
## X-Website: https://github.com/brues-code/pfUI
# ClassicAPI-less fallback. ClassicAPI redirects this read to pfUI_Turtle.toc
+1 -1
View File
@@ -5,7 +5,7 @@
## Notes-ruRU: Полная замена пользовательского интерфейса.
## Version: @project-version@
## SavedVariables: pfUI_profiles, pfUI_addon_profiles, pfUI_cache, pfUI_throttle
## SavedVariablesPerCharacter: pfUI_config, pfUI_init, pfUI_playerDB
## SavedVariablesPerCharacter: pfUI_config, pfUI_init, pfUI_playerDB, pfUI_eqmgr
## X-Website: https://github.com/brues-code/pfUI
# Selected by ClassicAPI on every non-Turtle client. Turtle clients get
+1 -1
View File
@@ -5,7 +5,7 @@
## Notes-ruRU: Полная замена пользовательского интерфейса.
## Version: @project-version@
## SavedVariables: pfUI_profiles, pfUI_addon_profiles, pfUI_cache, pfUI_throttle
## SavedVariablesPerCharacter: pfUI_config, pfUI_init, pfUI_playerDB
## SavedVariablesPerCharacter: pfUI_config, pfUI_init, pfUI_playerDB, pfUI_eqmgr
## X-Website: https://github.com/brues-code/pfUI
# Selected by ClassicAPI on Turtle WoW, where it wins over pfUI_ClassicAPI.toc.