Menü eingefügt
This commit is contained in:
53
OutH.lua
53
OutH.lua
@@ -3,16 +3,10 @@
|
|||||||
-- ==========================================
|
-- ==========================================
|
||||||
|
|
||||||
-- 1. EINSTELLUNGEN & VARIABLEN
|
-- 1. EINSTELLUNGEN & VARIABLEN
|
||||||
local enableFlash = true -- Standard: Flackern ist AN
|
local enableFlash = true
|
||||||
local soundPath = "Interface\\AddOns\\OutcH\\media\\"
|
local soundPath = "Interface\\AddOns\\OutcH\\media\\"
|
||||||
local sounds = {
|
|
||||||
"outch01.ogg",
|
|
||||||
"outch02.ogg",
|
|
||||||
"outch03.ogg",
|
|
||||||
"outch04.ogg"
|
|
||||||
}
|
|
||||||
|
|
||||||
-- 2. FLASH-FRAME ERSTELLEN (VISUELLER EFFEKT)
|
-- 2. FLASH-FRAME ERSTELLEN
|
||||||
local flashFrame = CreateFrame("Frame", nil, UIParent)
|
local flashFrame = CreateFrame("Frame", nil, UIParent)
|
||||||
flashFrame:SetAllPoints(UIParent)
|
flashFrame:SetAllPoints(UIParent)
|
||||||
flashFrame:SetFrameStrata("BACKGROUND")
|
flashFrame:SetFrameStrata("BACKGROUND")
|
||||||
@@ -20,48 +14,53 @@ flashFrame:Hide()
|
|||||||
|
|
||||||
local texture = flashFrame:CreateTexture(nil, "BACKGROUND")
|
local texture = flashFrame:CreateTexture(nil, "BACKGROUND")
|
||||||
texture:SetAllPoints(flashFrame)
|
texture:SetAllPoints(flashFrame)
|
||||||
-- Nutzt die Standard-WoW-Textur für den roten Rand
|
|
||||||
texture:SetTexture("Interface\\FullScreenTextures\\LowHealth")
|
texture:SetTexture("Interface\\FullScreenTextures\\LowHealth")
|
||||||
texture:SetBlendMode("ADD")
|
texture:SetBlendMode("ADD")
|
||||||
texture:SetVertexColor(1, 0, 0, 1) -- Farbe: Rot
|
texture:SetVertexColor(1, 0, 0, 1)
|
||||||
|
|
||||||
-- 3. SLASH-BEFEHL (/outch)
|
-- 3. SLASH-BEFEHL (/outch)
|
||||||
SLASH_OUTCH1 = "/outch"
|
SLASH_OUTCH1 = "/outch"
|
||||||
SlashCmdList["OUTCH"] = function()
|
SlashCmdList["OUTCH"] = function()
|
||||||
enableFlash = not enableFlash
|
enableFlash = not enableFlash
|
||||||
local status = enableFlash and "|cFF00FF00AN|r" or "|cFFFF0000AUS|r"
|
local status = enableFlash and "|cFF00FF00AN|r" or "|cFFFF0000AUS|r"
|
||||||
print("|cFFFF0000OutcH|r: Flackern ist jetzt " .. status)
|
print("|cFFFF0000OutcH|r: Flackern ist jetzt " .. status)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 4. LOGIK FÜR HP-VERLUST
|
-- 4. LOGIK FÜR HP-VERLUST & GESCHLECHT
|
||||||
local lastHealth = UnitHealth("player")
|
local lastHealth = UnitHealth("player")
|
||||||
local mainFrame = CreateFrame("Frame")
|
local mainFrame = CreateFrame("Frame")
|
||||||
mainFrame:RegisterEvent("UNIT_HEALTH")
|
mainFrame:RegisterEvent("UNIT_HEALTH")
|
||||||
|
|
||||||
mainFrame:SetScript("OnEvent", function(self, event, unit)
|
mainFrame:SetScript("OnEvent", function(self, event, unit)
|
||||||
-- Wir prüfen nur die HP des Spielers
|
if unit == "player" then
|
||||||
if unit == "player" then
|
|
||||||
local currentHealth = UnitHealth("player")
|
local currentHealth = UnitHealth("player")
|
||||||
|
|
||||||
-- Nur auslösen, wenn HP gesunken ist (nicht bei Heilung)
|
|
||||||
if currentHealth < lastHealth then
|
if currentHealth < lastHealth then
|
||||||
|
-- Geschlecht prüfen: 2 = Männlich, 3 = Weiblich
|
||||||
|
local gender = UnitSex("player")
|
||||||
|
local prefix = "m_" -- Standard auf männlich setzen
|
||||||
|
|
||||||
-- Zufälligen Sound aus der Liste wählen
|
if gender == 3 then
|
||||||
local randomSound = sounds[math.random(1, #sounds)]
|
prefix = "f_"
|
||||||
PlaySoundFile(soundPath .. randomSound, "Master")
|
end
|
||||||
|
|
||||||
-- Rotes Aufblitzen zeigen, falls aktiviert
|
-- Zufallszahl 1-4 generieren
|
||||||
if enableFlash then
|
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()
|
flashFrame:Show()
|
||||||
-- Nach 0.15 Sekunden wieder verstecken
|
|
||||||
C_Timer.After(0.15, function() flashFrame:Hide() end)
|
C_Timer.After(0.15, function() flashFrame:Hide() end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Aktuellen Wert für den nächsten Vergleich speichern
|
|
||||||
lastHealth = currentHealth
|
lastHealth = currentHealth
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Startmeldung im Chat
|
print("|cFFFF0000OutcH|r v1.0 geladen! (Gender-Detection aktiv)")
|
||||||
print("|cFFFF0000OutcH|r v1.0 geladen! Nutze |cFFFFFF00/outch|r zum Umschalten des Flackerns.")
|
|
||||||
|
|||||||
BIN
media/f_outch01.ogg
Normal file
BIN
media/f_outch01.ogg
Normal file
Binary file not shown.
BIN
media/f_outch02.ogg
Normal file
BIN
media/f_outch02.ogg
Normal file
Binary file not shown.
BIN
media/f_outch03.ogg
Normal file
BIN
media/f_outch03.ogg
Normal file
Binary file not shown.
BIN
media/m_outch01.ogg
Normal file
BIN
media/m_outch01.ogg
Normal file
Binary file not shown.
BIN
media/m_outch02.ogg
Normal file
BIN
media/m_outch02.ogg
Normal file
Binary file not shown.
BIN
media/m_outch03.ogg
Normal file
BIN
media/m_outch03.ogg
Normal file
Binary file not shown.
BIN
media/m_outch04.ogg
Normal file
BIN
media/m_outch04.ogg
Normal file
Binary file not shown.
Reference in New Issue
Block a user