mirror of
https://codeberg.org/Duvelcorp/MetaHunt.git
synced 2026-10-13 20:00:50 +00:00
Animations: wire remaining effects + 2-column options panel
- Shared FX toolkit in fx-celebrate.lua: mth_shake tween type, MTH_FX_Flash glow helper, MTH_CelebrateRunaway red shaking banner, gold title reset. - pet.runaway, pet.happiness, pet.loyaltyup, pet.feed - combat.ammoswap, combat.rangedswap, combat.mmprocs - ui.zbar, ui.stable, ui.minimapping, ui.optionsclose - book.model, book.search - Options > Animations panel now uses a balanced two-column layout. - CHANGELOG Animations entry expanded (no version bump).
This commit is contained in:
@@ -33,6 +33,7 @@ MTH_FX_DBG = {
|
||||
-- Sections shown, in order, in the options panel. `titleKey` localizes `title`.
|
||||
MTH_FX_ANIM_SECTIONS = {
|
||||
{ id = "pet", title = "Pet", titleKey = "ANIM_SECTION_PET" },
|
||||
{ id = "combat", title = "Combat", titleKey = "ANIM_SECTION_COMBAT" },
|
||||
{ id = "book", title = "Book", titleKey = "ANIM_SECTION_BOOK" },
|
||||
{ id = "ui", title = "Interface", titleKey = "ANIM_SECTION_UI" },
|
||||
}
|
||||
@@ -46,6 +47,34 @@ MTH_FX_ANIM_DEFS = {
|
||||
label = "Celebrate new pet abilities", labelKey = "ANIM_PET_CELEBRATE",
|
||||
tooltip = "Play a firework and a banner in the middle of the screen when your pet learns a new ability or a new rank.",
|
||||
tooltipKey = "ANIM_PET_CELEBRATE_TIP" },
|
||||
{ key = "pet.runaway", section = "pet", default = true,
|
||||
label = "Warn when a pet runs away", labelKey = "ANIM_PET_RUNAWAY",
|
||||
tooltip = "Flash a red, shaking banner in the middle of the screen when one of your pets runs away for good.",
|
||||
tooltipKey = "ANIM_PET_RUNAWAY_TIP" },
|
||||
{ key = "pet.happiness", section = "pet", default = true,
|
||||
label = "Flash on happiness change", labelKey = "ANIM_PET_HAPPINESS",
|
||||
tooltip = "Briefly flash the pet happiness area green when your pet cheers up, or red when it gets unhappy.",
|
||||
tooltipKey = "ANIM_PET_HAPPINESS_TIP" },
|
||||
{ key = "pet.loyaltyup", section = "pet", default = true,
|
||||
label = "Glow on loyalty gain", labelKey = "ANIM_PET_LOYALTYUP",
|
||||
tooltip = "Give a short golden glow when your pet gains a loyalty level.",
|
||||
tooltipKey = "ANIM_PET_LOYALTYUP_TIP" },
|
||||
{ key = "pet.feed", section = "pet", default = true,
|
||||
label = "Flash when feeding your pet", labelKey = "ANIM_PET_FEED",
|
||||
tooltip = "Give a short green flash when Feed-O-Matic feeds your pet.",
|
||||
tooltipKey = "ANIM_PET_FEED_TIP" },
|
||||
{ key = "combat.ammoswap", section = "combat", default = true,
|
||||
label = "Flash on Smart Ammo swap", labelKey = "ANIM_COMBAT_AMMOSWAP",
|
||||
tooltip = "Briefly highlight the zAmmo button when Smart Ammo swaps your ammo.",
|
||||
tooltipKey = "ANIM_COMBAT_AMMOSWAP_TIP" },
|
||||
{ key = "combat.rangedswap", section = "combat", default = true,
|
||||
label = "Flash on ranged weapon swap", labelKey = "ANIM_COMBAT_RANGEDSWAP",
|
||||
tooltip = "Briefly highlight the zRanged button when you hot-swap a ranged weapon.",
|
||||
tooltipKey = "ANIM_COMBAT_RANGEDSWAP_TIP" },
|
||||
{ key = "combat.mmprocs", section = "combat", default = true,
|
||||
label = "Pulse MM Widget procs", labelKey = "ANIM_COMBAT_MMPROCS",
|
||||
tooltip = "Pulse an MM Widget cell when a Lock and Load or Experimental ammo proc lights up.",
|
||||
tooltipKey = "ANIM_COMBAT_MMPROCS_TIP" },
|
||||
{ key = "book.open", section = "book", default = true,
|
||||
label = "Fade in the Hunter's Book", labelKey = "ANIM_BOOK_OPEN",
|
||||
tooltip = "Fade the Hunter's Book window in when you open it.",
|
||||
@@ -54,6 +83,14 @@ MTH_FX_ANIM_DEFS = {
|
||||
label = "Fade Hunter's Book tab changes", labelKey = "ANIM_BOOK_TABS",
|
||||
tooltip = "Fade the results list back in when you switch tabs inside the Hunter's Book.",
|
||||
tooltipKey = "ANIM_BOOK_TABS_TIP" },
|
||||
{ key = "book.model", section = "book", default = true,
|
||||
label = "Fade in beast models", labelKey = "ANIM_BOOK_MODEL",
|
||||
tooltip = "Fade the beast model viewer in when it loads a new model.",
|
||||
tooltipKey = "ANIM_BOOK_MODEL_TIP" },
|
||||
{ key = "book.search", section = "book", default = true,
|
||||
label = "Fade search results", labelKey = "ANIM_BOOK_SEARCH",
|
||||
tooltip = "Fade the results list when your search filter changes.",
|
||||
tooltipKey = "ANIM_BOOK_SEARCH_TIP" },
|
||||
{ key = "ui.options", section = "ui", default = true,
|
||||
label = "Slide the options window open", labelKey = "ANIM_UI_OPTIONS",
|
||||
tooltip = "Slide and fade the MetaHunt options window in when you open it.",
|
||||
@@ -62,14 +99,30 @@ MTH_FX_ANIM_DEFS = {
|
||||
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.optionsclose", section = "ui", default = true,
|
||||
label = "Fade windows closed", labelKey = "ANIM_UI_OPTIONSCLOSE",
|
||||
tooltip = "Fade the options and Hunter's Book windows out when you close them.",
|
||||
tooltipKey = "ANIM_UI_OPTIONSCLOSE_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.minimapping", section = "ui", default = true,
|
||||
label = "Ping the minimap on locate", labelKey = "ANIM_UI_MINIMAPPING",
|
||||
tooltip = "Send a short ping ripple over the minimap when you locate a tracked NPC.",
|
||||
tooltipKey = "ANIM_UI_MINIMAPPING_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.zbar", section = "ui", default = true,
|
||||
label = "Fade the zBar in", labelKey = "ANIM_UI_ZBAR",
|
||||
tooltip = "Fade the unified zBar buttons in when the bar becomes active.",
|
||||
tooltipKey = "ANIM_UI_ZBAR_TIP" },
|
||||
{ key = "ui.stable", section = "ui", default = true,
|
||||
label = "Flash stable slots on change", labelKey = "ANIM_UI_STABLE",
|
||||
tooltip = "Flash a stable slot in the Hunter's Book when a pet is deposited or withdrawn.",
|
||||
tooltipKey = "ANIM_UI_STABLE_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.",
|
||||
@@ -166,6 +219,63 @@ else
|
||||
end
|
||||
MTH_FX_DBG.step = "3-after-registertype"
|
||||
|
||||
-- Register a decaying "shake" tween type: oscillates the frame around its own
|
||||
-- current anchor point, with the amplitude fading to zero over the tween so it
|
||||
-- always lands back exactly where it started. Used for negative events.
|
||||
if Sauce and type(Sauce.RegisterType) == "function" and not Sauce.MTH_HasShake then
|
||||
local ok, err = pcall(function()
|
||||
Sauce.MTH_HasShake = true
|
||||
Sauce:RegisterType("mth_shake", {
|
||||
init = function(target)
|
||||
local p, rel, rp, x, y = target:GetPoint(1)
|
||||
return { p or "CENTER", rel, rp or p or "CENTER", x or 0, y or 0 }
|
||||
end,
|
||||
apply = function(target, from, to, t, tween)
|
||||
local mag = tween.magnitude or 8
|
||||
local freq = tween.freq or 34
|
||||
local decay = 1 - t
|
||||
local offset = math.sin(t * freq) * mag * decay
|
||||
target:ClearAllPoints()
|
||||
target:SetPoint(from[1], from[2], from[3], (from[4] or 0) + offset, from[5] or 0)
|
||||
end,
|
||||
})
|
||||
end)
|
||||
MTH_FX_DBG.shakeOk = ok
|
||||
MTH_FX_DBG.shakeErr = err
|
||||
end
|
||||
|
||||
-- Reusable flash: overlays a short additive colour glow on any frame/button and
|
||||
-- fades it out. Safe on any frame that supports CreateTexture; silent no-op
|
||||
-- otherwise. The overlay texture is cached on the frame for reuse.
|
||||
function MTH_FX_Flash(frame, r, g, b, duration)
|
||||
if not Sauce or not frame then
|
||||
return
|
||||
end
|
||||
if type(frame.CreateTexture) ~= "function" then
|
||||
return
|
||||
end
|
||||
local tex = frame.mthFxFlash
|
||||
if not tex then
|
||||
tex = frame:CreateTexture(nil, "OVERLAY")
|
||||
tex:SetTexture("Interface\\Buttons\\CheckButtonHilight")
|
||||
tex:SetBlendMode("ADD")
|
||||
tex:SetAllPoints(frame)
|
||||
frame.mthFxFlash = tex
|
||||
end
|
||||
tex:SetVertexColor(r or 1, g or 1, b or 1)
|
||||
tex:SetAlpha(0)
|
||||
tex:Show()
|
||||
local dur = duration or 0.45
|
||||
Sauce:Stop(tex)
|
||||
Sauce:Sequence({
|
||||
Sauce:FadeTo(tex, 0.85, dur * 0.35),
|
||||
Sauce:FadeTo(tex, 0, dur * 0.65, "inQuad", {
|
||||
onFinish = function() tex:Hide() end,
|
||||
}),
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
local MTH_FX_NUM_SPARKS = 22
|
||||
local MTH_FX_Container
|
||||
local MTH_FX_MsgFrame
|
||||
@@ -240,6 +350,7 @@ function MTH_Celebrate(title, subtitle)
|
||||
return
|
||||
end
|
||||
|
||||
MTH_FX_TitleFS:SetTextColor(1, 0.82, 0)
|
||||
MTH_FX_TitleFS:SetText(title or "")
|
||||
MTH_FX_SubFS:SetText(subtitle or "")
|
||||
|
||||
@@ -305,6 +416,39 @@ function MTH_CelebratePetAbility(label)
|
||||
MTH_Celebrate(MTH_FX_L("ANIM_PET_LEARNED_TITLE", "New Pet Ability!"), label)
|
||||
end
|
||||
|
||||
-- Dramatic negative banner: a red, shaking message shown when a pet runs away
|
||||
-- for good. Gated on pet.runaway. Reuses the shared message frame.
|
||||
function MTH_CelebrateRunaway(petName)
|
||||
if not MTH_FX_IsEnabled("pet.runaway") then
|
||||
return
|
||||
end
|
||||
if not Sauce then
|
||||
return
|
||||
end
|
||||
if not MTH_FX_EnsureFrames() then
|
||||
return
|
||||
end
|
||||
|
||||
MTH_FX_TitleFS:SetTextColor(1, 0.15, 0.15)
|
||||
MTH_FX_TitleFS:SetText(MTH_FX_L("ANIM_PET_RUNAWAY_TITLE", "Your pet ran away!"))
|
||||
MTH_FX_SubFS:SetText(petName or "")
|
||||
|
||||
Sauce:Stop(MTH_FX_MsgFrame)
|
||||
MTH_FX_MsgFrame:SetAlpha(0)
|
||||
MTH_FX_MsgFrame:Show()
|
||||
Sauce:Sequence({
|
||||
Sauce:FadeTo(MTH_FX_MsgFrame, 1, 0.18),
|
||||
Sauce:Tween(MTH_FX_MsgFrame, {
|
||||
type = "mth_shake",
|
||||
duration = 0.55,
|
||||
easing = "linear",
|
||||
magnitude = 11,
|
||||
freq = 42,
|
||||
}),
|
||||
Sauce:FadeOut(MTH_FX_MsgFrame, 0.7, "inQuad", { delay = 1.6 }),
|
||||
})
|
||||
end
|
||||
|
||||
-- DEBUG: mark that the whole file finished loading and record which globals it
|
||||
-- successfully defined. TEMP diagnostic.
|
||||
MTH_FX_DBG.step = "4-complete"
|
||||
|
||||
Reference in New Issue
Block a user