Animations: add option-tab fade, minimap pulse, zButton expand fade, map-pin drop-in; wire BeastTraining debug log to /mth err

This commit is contained in:
DuvelCorp
2026-09-10 16:05:36 +02:00
parent 566f3f4925
commit d2fb04f7c5
7 changed files with 91 additions and 2 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ Resurrecting on Octowow.
### Added
- **Animations**: MetaHunt now plays optional animations that make the interface feel alive. A firework-and-banner celebration bursts on screen when your pet learns a new ability or a new rank, the Great Book slides up and fades in when you open it and gently fades its list when you switch tabs, and the options window slides in when opened. Everything is optional and off-switchable: a new **Animations** tab (Options → Animations) lets you toggle each effect on its own — or disable them all at once. Powered by the PizzaSauce animation library.
- **Animations**: MetaHunt now plays optional animations that make the interface feel alive. A firework-and-banner celebration bursts on screen when your pet learns a new ability or a new rank, the Great Book slides up and fades in when you open it and gently fades its list when you switch tabs, the options window slides in when opened and its tabs fade as you switch them, the minimap button pulses when clicked, collapsible zButton bars fade their buttons in as they expand, and world-map markers fade in when you locate a beast, vendor or master. Everything is optional and off-switchable: a new **Animations** tab (Options → Animations) lets you toggle each effect on its own — or disable them all at once. Powered by the PizzaSauce animation library.
- **zTrack — Find Fish**: Added new spell Find Fish to the zTrack list of trackings.
+14 -1
View File
@@ -168,7 +168,10 @@ function MTH_PT_HasBeastTrainingRows()
end
local function MTH_PT_DebugLog(line)
return
if line == nil then return end
if MTH_DebugFrame and type(MTH_DebugFrame.AddInfo) == "function" then
MTH_DebugFrame:AddInfo("[BeastTraining] " .. tostring(line))
end
end
local function MTH_PT_IsScanMessageEnabled()
@@ -381,6 +384,10 @@ local function MTH_PT_ProcessLearnSystemMessage(rawMessage)
_, _, abilityName, rankText = string.find(message, "^[Yy]ou have learned a new spell:%s*(.-)%s*[Rr]ank%s*(%d+)%.?$")
end
if not abilityName or not rankText then
-- Only trace messages that look like a learn line, to avoid flooding the log.
if MTH_PT_DebugLog and string.find(message, "[Ll]earned") then
MTH_PT_DebugLog("learn-msg parse FAILED: '" .. tostring(message) .. "'")
end
return false
end
@@ -412,6 +419,12 @@ local function MTH_PT_ProcessLearnSystemMessage(rawMessage)
petRecorded = MTH_PETS_RecordCurrentPetLearnedAbility(abilityName, rankNumber, "beasttraining:learn-msg") and true or false
end
if MTH_PT_DebugLog then
MTH_PT_DebugLog("learn-msg matched: ability='" .. tostring(abilityName) .. "' rank=" .. tostring(rankNumber)
.. " token='" .. tostring(token) .. "' alreadyKnown=" .. tostring(alreadyKnown)
.. " changed=" .. tostring(changed) .. " petRecorded=" .. tostring(petRecorded))
end
if changed or petRecorded then
if MTH_PT_DebugLog then
MTH_PT_DebugLog("learn-msg captured: source='you have learned a new spell' ability='" .. tostring(abilityName) .. "' rank=" .. tostring(rankNumber) .. " token='" .. tostring(token) .. "' changed=" .. tostring(changed) .. " petRecorded=" .. tostring(petRecorded))
+16
View File
@@ -58,6 +58,22 @@ MTH_FX_ANIM_DEFS = {
label = "Slide the options window open", labelKey = "ANIM_UI_OPTIONS",
tooltip = "Slide and fade the MetaHunt options window in when you open it.",
tooltipKey = "ANIM_UI_OPTIONS_TIP" },
{ key = "ui.optiontabs", section = "ui", default = true,
label = "Fade options tab changes", labelKey = "ANIM_UI_OPTIONTABS",
tooltip = "Fade the settings panel when you switch tabs inside the options window.",
tooltipKey = "ANIM_UI_OPTIONTABS_TIP" },
{ key = "ui.minimap", section = "ui", default = true,
label = "Pulse the minimap button on click", labelKey = "ANIM_UI_MINIMAP",
tooltip = "Give the minimap button a quick pulse when you click it.",
tooltipKey = "ANIM_UI_MINIMAP_TIP" },
{ key = "ui.zbuttons", section = "ui", default = true,
label = "Fade zButton bars open", labelKey = "ANIM_UI_ZBUTTONS",
tooltip = "Fade the child buttons in when a collapsible zButton bar (pet, tracking, aspects...) expands.",
tooltipKey = "ANIM_UI_ZBUTTONS_TIP" },
{ key = "ui.mappins", section = "ui", default = true,
label = "Fade map markers in", labelKey = "ANIM_UI_MAPPINS",
tooltip = "Fade the world map markers in when you locate a beast, vendor or master.",
tooltipKey = "ANIM_UI_MAPPINS_TIP" },
}
local function MTH_FX_Store()
+10
View File
@@ -29,6 +29,15 @@ MTH_Map = {
minimapTickIdle = 0.75,
}
-- Capture our PizzaSauce instance for the world map pin drop-in (guarded; may be nil).
local MTH_MAP_Sauce = PizzaSauce
local function MTH_Map_AnimatePin(pin)
if not MTH_MAP_Sauce or not pin then return end
if type(MTH_FX_IsEnabled) == "function" and not MTH_FX_IsEnabled("ui.mappins") then return end
if type(pin.SetAlpha) == "function" then pin:SetAlpha(0) end
MTH_MAP_Sauce:FadeIn(pin, 0.3)
end
local MTH_MAP_MINIMAP_ZOOM = {
[0] = { [0] = 300, [1] = 240, [2] = 180, [3] = 120, [4] = 80, [5] = 50 },
[1] = { [0] = 466 + 2/3, [1] = 400, [2] = 333 + 1/3, [3] = 266 + 2/6, [4] = 200, [5] = 133 + 1/3 },
@@ -1041,6 +1050,7 @@ function MTH_Map:UpdateWorldMap()
pin:ClearAllPoints()
pin:SetPoint("CENTER", worldButton, "TOPLEFT", x, -y)
pin:Show()
MTH_Map_AnimatePin(pin)
end
end
+14
View File
@@ -14,6 +14,19 @@ if not MTH_MinimapButton then
MTH_MinimapButton = {}
end
-- Capture our PizzaSauce instance for the click pulse (guarded; may be nil).
local MTH_MB_Sauce = PizzaSauce
local function MTH_MB_AnimateClick()
if not MTH_MB_Sauce then return end
if type(MTH_FX_IsEnabled) == "function" and not MTH_FX_IsEnabled("ui.minimap") then return end
local icon = MTH_MinimapButton and MTH_MinimapButton.icon
if not icon or type(icon.SetWidth) ~= "function" then return end
-- Reset to base size first so rapid clicks can't make the icon drift in size.
icon:SetWidth(20)
icon:SetHeight(20)
MTH_MB_Sauce:Pulse(icon, 1.35, 0.28)
end
local function MTH_MB_L(key, default)
if MTH and MTH.GetLocalization then
return MTH:GetLocalization(key, default)
@@ -164,6 +177,7 @@ function MTH_MinimapButton:Initialize()
button:SetScript("OnClick", function()
local mouseButton = arg1
MTH_MB_AnimateClick()
if mouseButton == "RightButton" then
if type(MTH_OpenOptions) == "function" then
MTH_OpenOptions("General")
+18
View File
@@ -30,6 +30,23 @@ local function MTH_OPT_AnimateOpen(frame)
MTH_OPT_Sauce:SlideIn(frame, "UP", 60, 0.4, "outCubic")
end
-- Fade the active settings panel when switching options tabs, unless disabled.
local function MTH_OPT_AnimateTabContent(tabKey)
if not MTH_OPT_Sauce then return end
if type(MTH_FX_IsEnabled) == "function" and not MTH_FX_IsEnabled("ui.optiontabs") then return end
if type(MTH_OPTIONS_TABS) ~= "table" then return end
for i = 1, table.getn(MTH_OPTIONS_TABS) do
if MTH_OPTIONS_TABS[i].key == tabKey then
local frame = MTH_GetFrame(MTH_OPTIONS_TABS[i].frame)
if frame then
if type(frame.SetAlpha) == "function" then frame:SetAlpha(0) end
MTH_OPT_Sauce:FadeIn(frame, 0.22)
end
return
end
end
end
local function MTH_RegisterEscClose(frameName)
if not (frameName and UISpecialFrames) then
return
@@ -277,6 +294,7 @@ function MTH_SelectOptionsTab(tabKey)
end
end
end
MTH_OPT_AnimateTabContent(tabKey)
end
function MTH_ResetAndSelectOptionsTab(tabKey)
+18
View File
@@ -1,5 +1,15 @@
-- MAX_SPELLS = 1024
-- Capture our PizzaSauce instance for the expand animation (guarded; may be nil).
local ZSB_Sauce = PizzaSauce
local function ZSpellButton_AnimateExpand(parent)
if not ZSB_Sauce or not parent or not parent.children then return end
if type(MTH_FX_IsEnabled) == "function" and not MTH_FX_IsEnabled("ui.zbuttons") then return end
-- Hide alpha this frame so there is no one-frame opaque flash before onStart.
if type(parent.children.SetAlpha) == "function" then parent.children:SetAlpha(0) end
ZSB_Sauce:FadeIn(parent.children, 0.2)
end
-- Key binding prefix mapping (button name → Bindings.xml binding prefix)
local ZHUNTER_BINDING_PREFIX = {
zButtonAspect = "ZAspect",
@@ -378,6 +388,7 @@ function ZSpellButton_SetChildrenExpanded(parent, expanded)
end
if expanded then
saved["children"]["expanded"] = 1
local wasCollapsed = parent.children and not parent.children:IsShown()
if parent.children then
parent.children:Show()
end
@@ -394,6 +405,11 @@ function ZSpellButton_SetChildrenExpanded(parent, expanded)
end
end
ZSpellButton_StartFadeTimer(parent)
-- Animate only on a genuine collapsed->expanded toggle, and never on the
-- very first apply at login (guarded by _zbAnimReady, set in ApplyChildrenExpanded).
if wasCollapsed and parent._zbAnimReady then
ZSpellButton_AnimateExpand(parent)
end
else
saved["children"]["expanded"] = 0
if parent.children then
@@ -417,6 +433,8 @@ function ZSpellButton_ApplyChildrenExpanded(parent)
end
ZSpellButton_SetChildrenExpanded(parent, ZSpellButton_GetChildrenExpanded(parent))
ZSpellButton_UpdateKeybindingText(parent)
-- Mark ready so future user toggles animate, but the initial login apply above does not.
parent._zbAnimReady = true
end
-- ========== Fade Timer ==========