Funktionen aus Classic wieder eingebaut

This commit is contained in:
2025-12-31 10:14:28 +01:00
parent f52c865ec5
commit 67d3492147

View File

@@ -26,16 +26,12 @@ if not amount or type(amount) ~= "number" then return amount or "0" end
end end
local CounterFrame = CreateFrame("Frame", "MoanSCounterFrame", UIParent, "BackdropTemplate") local CounterFrame = CreateFrame("Frame", "MoanSCounterFrame", UIParent, "BackdropTemplate")
CounterFrame:SetSize(130, 40) CounterFrame:SetSize(130, 40); CounterFrame:SetPoint("CENTER", 0, 0); CounterFrame:SetMovable(true)
CounterFrame:SetPoint("CENTER", 0, 0) CounterFrame:EnableMouse(true); CounterFrame:RegisterForDrag("LeftButton"); CounterFrame:SetClampedToScreen(true)
CounterFrame:SetMovable(true)
CounterFrame:EnableMouse(true)
CounterFrame:RegisterForDrag("LeftButton")
CounterFrame:SetClampedToScreen(true)
CounterFrame.bg = CounterFrame:CreateTexture(nil, "BACKGROUND") CounterFrame.bg = CounterFrame:CreateTexture(nil, "BACKGROUND")
CounterFrame.bg:SetAllPoints(); CounterFrame.bg:SetColorTexture(0, 0, 0, 0.6) CounterFrame.bg:SetAllPoints(); CounterFrame.bg:SetColorTexture(0, 0, 0, 0.6)
CounterFrame.Cooldown = CreateFrame("Cooldown", nil, CounterFrame, "CooldownFrameTemplate") CounterFrame.Cooldown = CreateFrame("Cooldown", nil, CounterFrame, "CooldownFrameTemplate")
CounterFrame.Cooldown:SetAllPoints() CounterFrame.Cooldown:SetAllPoints(); CounterFrame.Cooldown:SetSwipeColor(1, 0.41, 0.7, 0.5)
CounterFrame.text = CounterFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge") CounterFrame.text = CounterFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
CounterFrame.text:SetPoint("CENTER") CounterFrame.text:SetPoint("CENTER")
@@ -72,7 +68,6 @@ if not amount or type(amount) ~= "number" then return amount or "0" end
if (currentTime - lastSoundTime) > timeout or comboCount >= MAX_SOUNDS then comboCount = 1 else comboCount = comboCount + 1 end if (currentTime - lastSoundTime) > timeout or comboCount >= MAX_SOUNDS then comboCount = 1 else comboCount = comboCount + 1 end
lastSoundTime = currentTime lastSoundTime = currentTime
CounterFrame.Cooldown:SetCooldown(currentTime, timeout) CounterFrame.Cooldown:SetCooldown(currentTime, timeout)
-- PFAD GEÄNDERT AUF MEDIA UNTERORDNER
return "Interface\\AddOns\\MoanS\\media\\" .. (comboCount == MAX_SOUNDS and "moan10" or (MoanSDB.soundBaseName or "moan") .. comboCount) .. ".ogg" return "Interface\\AddOns\\MoanS\\media\\" .. (comboCount == MAX_SOUNDS and "moan10" or (MoanSDB.soundBaseName or "moan") .. comboCount) .. ".ogg"
end end
@@ -93,11 +88,30 @@ if not amount or type(amount) ~= "number" then return amount or "0" end
for k, v in pairs(defaults) do if MoanSDB[k] == nil then MoanSDB[k] = v end end for k, v in pairs(defaults) do if MoanSDB[k] == nil then MoanSDB[k] = v end end
category = Settings.RegisterCanvasLayoutCategory(MoanSPanel, addonName) category = Settings.RegisterCanvasLayoutCategory(MoanSPanel, addonName)
Settings.RegisterAddOnCategory(category) Settings.RegisterAddOnCategory(category)
local title = MoanSPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") local title = MoanSPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
title:SetPoint("TOPLEFT", 16, -16); title:SetText("|cffFF69B4MoanS|r - Retail") title:SetPoint("TOPLEFT", 16, -16); title:SetText("|cffFF69B4MoanS|r - Retail")
CreateCB(MoanSPanel, "Addon Aktiviert", 16, -50, "active") CreateCB(MoanSPanel, "Addon Aktiviert", 16, -50, "active")
CreateCB(MoanSPanel, "Fenster anzeigen", 16, -80, "showCounter") CreateCB(MoanSPanel, "Fenster anzeigen", 16, -80, "showCounter")
CreateCB(MoanSPanel, "Fenster fixieren (Lock)", 16, -110, "locked") CreateCB(MoanSPanel, "Fenster fixieren (Lock)", 16, -110, "locked")
local slider = CreateFrame("Slider", "MoanSTimeoutSlider", MoanSPanel, "OptionsSliderTemplate")
slider:SetPoint("TOPLEFT", 20, -160); slider:SetMinMaxValues(0.5, 10.0); slider:SetValueStep(0.5); slider:SetWidth(180)
_G[slider:GetName().."Low"]:SetText("0.5s"); _G[slider:GetName().."High"]:SetText("10s")
local sliderVal = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
sliderVal:SetPoint("BOTTOM", slider, "TOP", 0, 5)
slider:SetScript("OnValueChanged", function(s, val)
val = math.floor(val * 2 + 0.5) / 2
MoanSDB.comboTimeout = val
sliderVal:SetText("Combo-Zeit: "..val.."s")
end)
slider:SetValue(MoanSDB.comboTimeout)
local btnTest = CreateFrame("Button", nil, MoanSPanel, "UIPanelButtonTemplate")
btnTest:SetPoint("TOPLEFT", 16, -210); btnTest:SetSize(160, 25); btnTest:SetText("Feuerwerk Testen")
btnTest:SetScript("OnClick", function() PlaySoundFile(TriggerCombo(), "Master"); ShowCritText(math.random(100, 5000)) end)
if MoanSDB.framePos then if MoanSDB.framePos then
CounterFrame:ClearAllPoints() CounterFrame:ClearAllPoints()
CounterFrame:SetPoint(MoanSDB.framePos[1], UIParent, MoanSDB.framePos[2], MoanSDB.framePos[3], MoanSDB.framePos[4]) CounterFrame:SetPoint(MoanSDB.framePos[1], UIParent, MoanSDB.framePos[2], MoanSDB.framePos[3], MoanSDB.framePos[4])
@@ -105,19 +119,13 @@ if not amount or type(amount) ~= "number" then return amount or "0" end
UpdateCounterDisplay() UpdateCounterDisplay()
elseif event == "COMBAT_LOG_EVENT_UNFILTERED" then elseif event == "COMBAT_LOG_EVENT_UNFILTERED" then
if not MoanSDB or not MoanSDB.active then return end if not MoanSDB or not MoanSDB.active then return end
local info = {CombatLogGetCurrentEventInfo()} local _, sub, _, sGUID, _, _, _, _, _, _, _, arg12, _, _, _, arg15, _, arg17, arg18, _, arg21 = CombatLogGetCurrentEventInfo()
local sub, sGUID = info[2], info[4]
if sGUID == UnitGUID("player") or sGUID == UnitGUID("pet") then if sGUID == UnitGUID("player") or sGUID == UnitGUID("pet") then
local isCrit, amount = false, 0 local isCrit, amount = false, 0
if sub == "SWING_DAMAGE" then amount, isCrit = info[12], info[18] if sub == "SWING_DAMAGE" then amount, isCrit = arg12, arg17
elseif sub:find("_DAMAGE") then amount, isCrit = info[15], info[21] elseif sub:find("_DAMAGE") then amount, isCrit = arg15, arg21
elseif sub == "SPELL_HEAL" then amount, isCrit = info[15], info[18] end elseif sub == "SPELL_HEAL" then amount, isCrit = arg15, arg18 end
if isCrit then if isCrit then PlaySoundFile(TriggerCombo(), "Master"); ShowCritText(amount); MoanSDB.totalMoans = MoanSDB.totalMoans + 1; UpdateCounterDisplay() end
PlaySoundFile(TriggerCombo(), "Master")
ShowCritText(amount)
MoanSDB.totalMoans = MoanSDB.totalMoans + 1
UpdateCounterDisplay()
end
end end
end end
end) end)