Files
OucH-Classic/OutH.lua
2025-12-31 17:07:11 +01:00

67 lines
1.9 KiB
Lua

-- ==========================================
-- OutcH v1.0 - Erstellt von Quasimoder
-- ==========================================
-- 1. EINSTELLUNGEN & VARIABLEN
local enableFlash = true
local soundPath = "Interface\\AddOns\\OutcH\\media\\"
-- 2. FLASH-FRAME ERSTELLEN
local flashFrame = CreateFrame("Frame", nil, UIParent)
flashFrame:SetAllPoints(UIParent)
flashFrame:SetFrameStrata("BACKGROUND")
flashFrame:Hide()
local texture = flashFrame:CreateTexture(nil, "BACKGROUND")
texture:SetAllPoints(flashFrame)
texture:SetTexture("Interface\\FullScreenTextures\\LowHealth")
texture:SetBlendMode("ADD")
texture:SetVertexColor(1, 0, 0, 1)
-- 3. SLASH-BEFEHL (/outch)
SLASH_OUTCH1 = "/outch"
SlashCmdList["OUTCH"] = function()
enableFlash = not enableFlash
local status = enableFlash and "|cFF00FF00AN|r" or "|cFFFF0000AUS|r"
print("|cFFFF0000OutcH|r: Flackern ist jetzt " .. status)
end
-- 4. LOGIK FÜR HP-VERLUST & GESCHLECHT
local lastHealth = UnitHealth("player")
local mainFrame = CreateFrame("Frame")
mainFrame:RegisterEvent("UNIT_HEALTH")
mainFrame:SetScript("OnEvent", function(self, event, unit)
if unit == "player" then
local currentHealth = UnitHealth("player")
if currentHealth < lastHealth then
-- Geschlecht prüfen: 2 = Männlich, 3 = Weiblich
local gender = UnitSex("player")
local prefix = "m_" -- Standard auf männlich setzen
if gender == 3 then
prefix = "f_"
end
-- Zufallszahl 1-4 generieren
local randomNumber = math.random(1, 4)
-- Dateiname zusammenbauen (z.B. m_outch01.ogg)
local soundFile = string.format("%soutch0%d.ogg", prefix, randomNumber)
-- Sound abspielen
PlaySoundFile(soundPath .. soundFile, "Master")
-- Flackern
if enableFlash then
flashFrame:Show()
C_Timer.After(0.15, function() flashFrame:Hide() end)
end
end
lastHealth = currentHealth
end
end)
print("|cFFFF0000OutcH|r v1.0 geladen! (Gender-Detection aktiv)")