mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-21 20:00:48 +00:00
mount cancel via Dismount
Replaces the Phase 1 buff-slot loop + tooltip-scanned mount-string match
with a single Dismount() call. The implementation in ClassicAPI scans
for SPELL_AURA_MOUNTED on the player's auras and sends the cancel
packet itself, so we don't have to maintain a localized list of mount
tooltip patterns ("Increases speed by X%", "Erhöht Tempo um X%", etc.).
Drops pfUI.autoshift.mounts (the 20-line localized-string table) and
pfUI.autoshift.scanner (its only consumer). Module is down to ~50 lines
from ~150 at session start.
This commit is contained in:
+7
-38
@@ -3,26 +3,6 @@ pfUI:RegisterModule("autoshift", "vanilla", function ()
|
|||||||
pfUI.autoshift:RegisterEvent("UI_ERROR_MESSAGE")
|
pfUI.autoshift:RegisterEvent("UI_ERROR_MESSAGE")
|
||||||
|
|
||||||
pfUI.autoshift.scanString = string.gsub(SPELL_FAILED_ONLY_SHAPESHIFT, "%%s", "(.+)")
|
pfUI.autoshift.scanString = string.gsub(SPELL_FAILED_ONLY_SHAPESHIFT, "%%s", "(.+)")
|
||||||
pfUI.autoshift.mounts = {
|
|
||||||
-- deDE
|
|
||||||
"^Erhöht Tempo um (.+)%%",
|
|
||||||
-- enUS
|
|
||||||
"^Increases speed by (.+)%%",
|
|
||||||
-- esES
|
|
||||||
"^Aumenta la velocidad en un (.+)%%",
|
|
||||||
-- frFR
|
|
||||||
"^Augmente la vitesse de (.+)%%",
|
|
||||||
-- ruRU
|
|
||||||
"^Скорость увеличена на (.+)%%",
|
|
||||||
-- koKR
|
|
||||||
"^이동 속도 (.+)%%만큼 증가",
|
|
||||||
-- zhCN
|
|
||||||
"^速度提高(.+)%%",
|
|
||||||
-- turtle-wow
|
|
||||||
"speed based on", "Slow and steady...", "Riding",
|
|
||||||
"Lento y constante...", "Aumenta la velocidad según tu habilidad de Montar.",
|
|
||||||
"根据您的骑行技能提高速度。", "根据骑术技能提高速度。", "又慢又稳......",
|
|
||||||
}
|
|
||||||
|
|
||||||
pfUI.autoshift.errors = { SPELL_FAILED_NOT_MOUNTED, ERR_ATTACK_MOUNTED, ERR_TAXIPLAYERALREADYMOUNTED,
|
pfUI.autoshift.errors = { SPELL_FAILED_NOT_MOUNTED, ERR_ATTACK_MOUNTED, ERR_TAXIPLAYERALREADYMOUNTED,
|
||||||
SPELL_FAILED_NOT_SHAPESHIFT, SPELL_FAILED_NO_ITEMS_WHILE_SHAPESHIFTED, SPELL_NOT_SHAPESHIFTED,
|
SPELL_FAILED_NOT_SHAPESHIFT, SPELL_FAILED_NO_ITEMS_WHILE_SHAPESHIFTED, SPELL_NOT_SHAPESHIFTED,
|
||||||
@@ -30,8 +10,6 @@ pfUI:RegisterModule("autoshift", "vanilla", function ()
|
|||||||
ERR_NO_ITEMS_WHILE_SHAPESHIFTED, ERR_TAXIPLAYERSHAPESHIFTED,ERR_MOUNT_SHAPESHIFTED,
|
ERR_NO_ITEMS_WHILE_SHAPESHIFTED, ERR_TAXIPLAYERSHAPESHIFTED,ERR_MOUNT_SHAPESHIFTED,
|
||||||
ERR_EMBLEMERROR_NOTABARDGEOSET }
|
ERR_EMBLEMERROR_NOTABARDGEOSET }
|
||||||
|
|
||||||
pfUI.autoshift.scanner = libtipscan:GetScanner("dismount")
|
|
||||||
|
|
||||||
pfUI.autoshift:SetScript("OnEvent", function()
|
pfUI.autoshift:SetScript("OnEvent", function()
|
||||||
-- switch stance if required
|
-- switch stance if required
|
||||||
for stances in string.gfind(arg1, pfUI.autoshift.scanString) do
|
for stances in string.gfind(arg1, pfUI.autoshift.scanString) do
|
||||||
@@ -54,22 +32,13 @@ pfUI:RegisterModule("autoshift", "vanilla", function ()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Phase 1: mounts take priority (mount/shapeshift can't coexist in
|
-- Mounts take priority over shapeshifts (the two can't coexist in
|
||||||
-- vanilla, but the original error list also covers mount-only states).
|
-- vanilla, but the error list covers mount-only states too). Both
|
||||||
for i = 0, 31 do
|
-- helpers do their own engine-side aura scan and send the cancel
|
||||||
pfUI.autoshift.scanner:SetPlayerBuff(i)
|
-- packet directly, so no buff iteration or bid lookup is needed.
|
||||||
for _, str in pairs(pfUI.autoshift.mounts) do
|
if IsMounted() then
|
||||||
if pfUI.autoshift.scanner:Find(str) then
|
Dismount()
|
||||||
CancelPlayerBuff(i)
|
elseif GetShapeshiftFormID() ~= 0 then
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Phase 2: cancel the active shapeshift. CancelShapeshiftForm finds
|
|
||||||
-- the form buff via the engine's Spell.dbc effect-array scan and
|
|
||||||
-- sends the cancel packet directly — no bid lookup needed.
|
|
||||||
if GetShapeshiftFormID() ~= 0 then
|
|
||||||
CancelShapeshiftForm()
|
CancelShapeshiftForm()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user