Add files via upload

This commit is contained in:
totalllyswede
2026-02-24 18:13:53 -08:00
committed by GitHub
parent 97b89c0e92
commit c10b32c78f
3 changed files with 89 additions and 42 deletions
+70 -28
View File
@@ -1,21 +1,32 @@
-- InnerFireWatch (Turtle WoW / 1.12.1) -- InnerFireWatch (Turtle WoW / 1.12.1)
-- Alerts when "Inner Fire" buff falls off. -- Tracks key self-buffs and alerts when they fall off:
-- - Priest: Inner Fire
-- - Warrior: Battle Shout
-- - Shaman: Lightning Shield / Water Shield / Earth Shield
InnerFireWatchDB = InnerFireWatchDB or {} InnerFireWatchDB = InnerFireWatchDB or {}
local f = CreateFrame("Frame") local f = CreateFrame("Frame")
local wasActive = false
local DEFAULTS = { local DEFAULTS = {
enabled = true, enabled = true,
soundEnabled = true, soundEnabled = true,
gainedMessage = false, gainedMessage = false,
largeMessageEnabled = true, largeMessageEnabled = true,
useCustomSound = true, useCustomSound = true,
customSoundPath = "Interface\\AddOns\\InnerFireWatch\\sounds\\expire.wav", customSoundPath = "Interface\\AddOns\\InnerFireWatch\\sounds\\expire.wav",
fallbackSound = "igQuestFailed", fallbackSound = "igQuestFailed",
} }
local function ApplyDefaults()
for k, v in pairs(DEFAULTS) do
if InnerFireWatchDB[k] == nil then
InnerFireWatchDB[k] = v
end
end
end
-- Big center-screen text (independent of UIErrorsFrame) -- Big center-screen text (independent of UIErrorsFrame)
local CenterAlert = CreateFrame("Frame", "InnerFireWatchCenterAlert", UIParent) local CenterAlert = CreateFrame("Frame", "InnerFireWatchCenterAlert", UIParent)
CenterAlert:SetPoint("CENTER", UIParent, "CENTER", 0, 120) CenterAlert:SetPoint("CENTER", UIParent, "CENTER", 0, 120)
@@ -44,27 +55,19 @@ CenterAlert:SetScript("OnUpdate", function()
CenterAlert:Hide() CenterAlert:Hide()
return return
end end
-- 0.0 -> 1.6
local alpha = 1 - (t / 1.6) local alpha = 1 - (t / 1.6)
CenterAlert:SetAlpha(alpha) CenterAlert:SetAlpha(alpha)
end) end)
local function ApplyDefaults() -- Returns true if player currently has a buff whose texture contains textureNeedle (lowercase compare).
for k, v in pairs(DEFAULTS) do local function HasBuffByTexture(textureNeedle)
if InnerFireWatchDB[k] == nil then
InnerFireWatchDB[k] = v
end
end
end
local function HasInnerFire()
local i = 1 local i = 1
while true do while true do
local texture = UnitBuff("player", i) local texture = UnitBuff("player", i)
if not texture then break end if not texture then break end
texture = string.lower(texture) texture = string.lower(texture)
if string.find(texture, "spell_holy_innerfire") then if string.find(texture, textureNeedle) then
return true return true
end end
@@ -86,37 +89,74 @@ local function PlayExpireSound()
end end
end end
local function NotifyExpired() local function NotifyExpired(buffLabel)
DEFAULT_CHAT_FRAME:AddMessage("|cffff3333Inner Fire has expired!|r") local msg = buffLabel .. " has expired!"
DEFAULT_CHAT_FRAME:AddMessage("|cffff3333" .. msg .. "|r")
if InnerFireWatchDB.largeMessageEnabled then if InnerFireWatchDB.largeMessageEnabled then
ShowCenterAlert("INNER FIRE EXPIRED!") ShowCenterAlert(string.upper(buffLabel) .. " EXPIRED!")
end end
if UIErrorsFrame and UIErrorsFrame.AddMessage then if UIErrorsFrame and UIErrorsFrame.AddMessage then
UIErrorsFrame:AddMessage("Inner Fire expired!", 1.0, 0.1, 0.1, 1.0, 5) UIErrorsFrame:AddMessage(msg, 1.0, 0.1, 0.1, 1.0, 5)
end end
PlayExpireSound() PlayExpireSound()
end end
local function NotifyGained() local function NotifyGained(buffLabel)
if not InnerFireWatchDB.gainedMessage then return end if not InnerFireWatchDB.gainedMessage then return end
DEFAULT_CHAT_FRAME:AddMessage("|cff33ff33Inner Fire active.|r") DEFAULT_CHAT_FRAME:AddMessage("|cff33ff33" .. buffLabel .. " active.|r")
end
-- Build trackers based on class
local trackers = {}
local function BuildTrackers()
trackers = {}
local _, classToken = UnitClass("player")
if classToken == "PRIEST" then
table.insert(trackers, {
label = "Inner Fire",
needle = "spell_holy_innerfire",
active = false,
})
elseif classToken == "WARRIOR" then
table.insert(trackers, {
label = "Battle Shout",
needle = "ability_warrior_battleshout",
active = false,
})
elseif classToken == "SHAMAN" then
-- Texture needles are based on the icon file names.
-- Lightning Shield: Spell_Nature_LightningShield
-- Water Shield: Ability_Shaman_WaterShield
-- Earth Shield: Spell_Nature_SkinOfEarth (commonly used in TBC/clients that add it)
table.insert(trackers, { label = "Lightning Shield", needle = "spell_nature_lightningshield", active = false })
table.insert(trackers, { label = "Water Shield", needle = "ability_shaman_watershield", active = false })
table.insert(trackers, { label = "Earth Shield", needle = "spell_nature_skinofearth", active = false })
end
for _, t in ipairs(trackers) do
t.active = HasBuffByTexture(t.needle)
end
end end
local function Check() local function Check()
if not InnerFireWatchDB.enabled then return end if not InnerFireWatchDB.enabled then return end
if not trackers or table.getn(trackers) == 0 then return end
local active = HasInnerFire() for _, t in ipairs(trackers) do
local nowActive = HasBuffByTexture(t.needle)
if wasActive and not active then if t.active and (not nowActive) then
NotifyExpired() NotifyExpired(t.label)
elseif (not wasActive) and active then elseif (not t.active) and nowActive then
NotifyGained() NotifyGained(t.label)
end
t.active = nowActive
end end
wasActive = active
end end
f:RegisterEvent("PLAYER_LOGIN") f:RegisterEvent("PLAYER_LOGIN")
@@ -126,12 +166,14 @@ f:SetScript("OnEvent", function()
Check() Check()
end) end)
-- Init after saved vars load
f:SetScript("OnUpdate", function() f:SetScript("OnUpdate", function()
f:SetScript("OnUpdate", nil) f:SetScript("OnUpdate", nil)
ApplyDefaults() ApplyDefaults()
wasActive = HasInnerFire() BuildTrackers()
end) end)
-- Slash commands
SLASH_INNERFIREWATCH1 = "/ifw" SLASH_INNERFIREWATCH1 = "/ifw"
SlashCmdList["INNERFIREWATCH"] = function(msg) SlashCmdList["INNERFIREWATCH"] = function(msg)
msg = msg and string.lower(msg) or "" msg = msg and string.lower(msg) or ""
+1 -1
View File
@@ -1,6 +1,6 @@
## Interface: 11200 ## Interface: 11200
## Title: InnerFireWatch ## Title: InnerFireWatch
## Notes: Alerts you when Priest buff Inner Fire expires. ## Notes: Alerts you when key self-buffs expire (Priest/Warrior/Shaman).
## Author: Olzon ## Author: Olzon
## Version: 1.1 ## Version: 1.1
## SavedVariables: InnerFireWatchDB ## SavedVariables: InnerFireWatchDB
+18 -13
View File
@@ -1,18 +1,25 @@
# InnerFireWatch (Turtle WoW) # InnerFireWatch (Turtle WoW)
Version: 1.1 Version: 1.1\
Author: Olzon Author: Olzon
A lightweight Turtle WoW (1.12.1) addon that alerts you when **Inner A lightweight Turtle WoW (1.12.1) addon that alerts you when key
Fire** expires. self-buffs expire.
## What It Tracks
- **Priest:** Inner Fire
- **Warrior:** Battle Shout
- **Shaman:** Lightning Shield, Water Shield, Earth Shield
## What It Does ## What It Does
- Detects when Inner Fire falls off - Detects when the tracked buff falls off
- Prints a chat warning - Prints a chat warning
- Displays red error text in the center of the screen - Displays red error text in the center of the screen
- Optional big center-screen message
- Plays an alert sound - Plays an alert sound
- Minimal and vanillafriendly - Minimal and vanilla-friendly
------------------------------------------------------------------------ ------------------------------------------------------------------------
@@ -22,7 +29,7 @@ Fire** expires.
2. Place the `InnerFireWatch` folder inside: 2. Place the `InnerFireWatch` folder inside:
World of Warcraft`\Interface`{=tex}`\AddOns`{=tex}\ `World of Warcraft\Interface\AddOns\`
3. Restart the client. 3. Restart the client.
@@ -36,8 +43,10 @@ Fire** expires.
- `/ifw off` --- Disable addon - `/ifw off` --- Disable addon
- `/ifw sound on` --- Enable sound - `/ifw sound on` --- Enable sound
- `/ifw sound off` --- Disable sound - `/ifw sound off` --- Disable sound
- `/ifw gained on` --- Message when Inner Fire is gained - `/ifw gained on` --- Message when the buff is gained
- `/ifw gained off` --- Disable gained message - `/ifw gained off` --- Disable gained message
- `/ifw large on` --- Enable big center-screen message
- `/ifw large off` --- Disable big center-screen message
------------------------------------------------------------------------ ------------------------------------------------------------------------
@@ -53,9 +62,5 @@ If you want to use your own sound:
`expire.wav` `expire.wav`
The addon will automatically use it if the file exists. If not, it will If the file exists, the addon will play it on expiration. Otherwise it
use the default WoW alert sound. uses the default WoW alert sound.
------------------------------------------------------------------------
Made for Turtle WoW.