Struktur bereinigt: Sounddateien in media/ Unterordner verschoben und Pfade in der Lua angepasst
This commit is contained in:
275
MoanS.lua
275
MoanS.lua
@@ -1,28 +1,23 @@
|
|||||||
local addonName = "MoanS"
|
local addonName = "MoanS"
|
||||||
|
|
||||||
local defaults = {
|
local defaults = {
|
||||||
active = true,
|
active = true,
|
||||||
chat = true,
|
chat = true,
|
||||||
petEnabled = true,
|
petEnabled = true,
|
||||||
healEnabled = true,
|
healEnabled = true,
|
||||||
color = "|cffFF69B4",
|
|
||||||
totalMoans = 0,
|
totalMoans = 0,
|
||||||
showCounter = true,
|
showCounter = true,
|
||||||
framePos = nil,
|
framePos = nil,
|
||||||
soundBaseName = "moan",
|
soundBaseName = "moan",
|
||||||
comboTimeout = 4.0,
|
comboTimeout = 4.0,
|
||||||
locked = false, -- Neue Einstellung für die Verankerung
|
locked = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
local frame = CreateFrame("Frame")
|
local frame = CreateFrame("Frame")
|
||||||
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
||||||
frame:RegisterEvent("ADDON_LOADED")
|
frame:RegisterEvent("ADDON_LOADED")
|
||||||
|
|
||||||
local lastSoundTime = 0
|
local lastSoundTime, comboCount, MAX_SOUNDS = 0, 0, 9
|
||||||
local comboCount = 0
|
|
||||||
local MAX_SOUNDS = 9
|
|
||||||
|
|
||||||
-- Hilfsfunktion: Zahlen kürzen
|
|
||||||
local function FormatNumber(amount)
|
local function FormatNumber(amount)
|
||||||
if not amount or type(amount) ~= "number" then return amount or "0" end
|
if not amount or type(amount) ~= "number" then return amount or "0" end
|
||||||
if amount >= 1000000 then return string.format("%.1fM", amount / 1000000)
|
if amount >= 1000000 then return string.format("%.1fM", amount / 1000000)
|
||||||
@@ -30,7 +25,6 @@ if not amount or type(amount) ~= "number" then return amount or "0" end
|
|||||||
else return tostring(amount) end
|
else return tostring(amount) end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 1. GRAFISCHER COUNTER
|
|
||||||
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:SetPoint("CENTER", 0, 0)
|
||||||
@@ -38,216 +32,95 @@ if not amount or type(amount) ~= "number" then return amount or "0" end
|
|||||||
CounterFrame:EnableMouse(true)
|
CounterFrame:EnableMouse(true)
|
||||||
CounterFrame:RegisterForDrag("LeftButton")
|
CounterFrame:RegisterForDrag("LeftButton")
|
||||||
CounterFrame:SetClampedToScreen(true)
|
CounterFrame:SetClampedToScreen(true)
|
||||||
|
|
||||||
CounterFrame.bg = CounterFrame:CreateTexture(nil, "BACKGROUND")
|
CounterFrame.bg = CounterFrame:CreateTexture(nil, "BACKGROUND")
|
||||||
CounterFrame.bg:SetAllPoints()
|
CounterFrame.bg:SetAllPoints(); CounterFrame.bg:SetColorTexture(0, 0, 0, 0.6)
|
||||||
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:SetDrawEdge(false)
|
|
||||||
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")
|
||||||
CounterFrame.text:SetText("Moans: 0")
|
|
||||||
|
|
||||||
-- 2. FEUERWERK ANIMATION
|
|
||||||
local function ShowCritText(amount)
|
local function ShowCritText(amount)
|
||||||
local f = CreateFrame("Frame", nil, CounterFrame)
|
local f = CreateFrame("Frame", nil, CounterFrame); f:SetSize(200, 30)
|
||||||
f:SetSize(200, 30)
|
|
||||||
f:SetPoint("CENTER", CounterFrame, "CENTER", 0, 0)
|
f:SetPoint("CENTER", CounterFrame, "CENTER", 0, 0)
|
||||||
|
|
||||||
local text = f:CreateFontString(nil, "OVERLAY", "NumberFont_Outline_Huge")
|
local text = f:CreateFontString(nil, "OVERLAY", "NumberFont_Outline_Huge")
|
||||||
text:SetPoint("CENTER")
|
text:SetPoint("CENTER"); text:SetText(FormatNumber(amount)); text:SetTextColor(1, 0.41, 0.7)
|
||||||
text:SetText(FormatNumber(amount))
|
|
||||||
text:SetTextColor(1, 0.41, 0.7)
|
|
||||||
|
|
||||||
local ag = f:CreateAnimationGroup()
|
local ag = f:CreateAnimationGroup()
|
||||||
|
local targetX, targetY = math.random(-120, 120), math.random(80, 150)
|
||||||
-- Zufällige Richtung für das Feuerwerk
|
local scale = ag:CreateAnimation("Scale"); scale:SetScale(1.5, 1.5); scale:SetDuration(0.15); scale:SetOrder(1)
|
||||||
local targetX = math.random(-120, 120)
|
local translation = ag:CreateAnimation("Translation"); translation:SetOffset(targetX, targetY); translation:SetDuration(1.4); translation:SetSmoothing("OUT"); translation:SetOrder(2)
|
||||||
local targetY = math.random(80, 150)
|
local alpha = ag:CreateAnimation("Alpha"); alpha:SetFromAlpha(1); alpha:SetToAlpha(0); alpha:SetStartDelay(0.7); alpha:SetDuration(0.7); alpha:SetOrder(2)
|
||||||
|
ag:SetScript("OnFinished", function() f:Hide() end); ag:Play()
|
||||||
-- 1. Pop & Scale
|
|
||||||
local scale = ag:CreateAnimation("Scale")
|
|
||||||
scale:SetScale(1.5, 1.5)
|
|
||||||
scale:SetDuration(0.15)
|
|
||||||
scale:SetOrder(1)
|
|
||||||
|
|
||||||
-- 2. Flugbahn (Explosionseffekt)
|
|
||||||
local translation = ag:CreateAnimation("Translation")
|
|
||||||
translation:SetOffset(targetX, targetY)
|
|
||||||
translation:SetDuration(1.4)
|
|
||||||
translation:SetSmoothing("OUT")
|
|
||||||
translation:SetOrder(2)
|
|
||||||
|
|
||||||
-- 3. Rotation (leichtes Trudeln)
|
|
||||||
local rotation = ag:CreateAnimation("Rotation")
|
|
||||||
rotation:SetDegrees(math.random(-20, 20))
|
|
||||||
rotation:SetDuration(1.4)
|
|
||||||
rotation:SetOrder(2)
|
|
||||||
|
|
||||||
-- 4. Verzögertes Ausfaden
|
|
||||||
local alpha = ag:CreateAnimation("Alpha")
|
|
||||||
alpha:SetFromAlpha(1)
|
|
||||||
alpha:SetToAlpha(0)
|
|
||||||
alpha:SetStartDelay(0.7)
|
|
||||||
alpha:SetDuration(0.7)
|
|
||||||
alpha:SetOrder(2)
|
|
||||||
|
|
||||||
ag:SetScript("OnFinished", function() f:Hide() end)
|
|
||||||
ag:Play()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Verankerungs-Logik
|
local function UpdateCounterDisplay()
|
||||||
local function UpdateLockState()
|
|
||||||
if not MoanSDB then return end
|
if not MoanSDB then return end
|
||||||
if MoanSDB.locked then
|
CounterFrame.text:SetText("Moans: " .. (MoanSDB.totalMoans or 0))
|
||||||
CounterFrame:EnableMouse(false)
|
CounterFrame:SetShown(MoanSDB.showCounter and MoanSDB.active)
|
||||||
else
|
CounterFrame:EnableMouse(not MoanSDB.locked)
|
||||||
CounterFrame:EnableMouse(true)
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
CounterFrame:SetScript("OnDragStart", CounterFrame.StartMoving)
|
CounterFrame:SetScript("OnDragStart", CounterFrame.StartMoving)
|
||||||
CounterFrame:SetScript("OnDragStop", function(self)
|
CounterFrame:SetScript("OnDragStop", function(self)
|
||||||
self:StopMovingOrSizing()
|
self:StopMovingOrSizing()
|
||||||
local point, _, relativePoint, x, y = self:GetPoint()
|
local point, _, rel, x, y = self:GetPoint()
|
||||||
if MoanSDB then MoanSDB.framePos = { point, relativePoint, x, y } end
|
if MoanSDB then MoanSDB.framePos = { point, rel, x, y } end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function UpdateCounterDisplay()
|
local function TriggerCombo()
|
||||||
if not MoanSDB then return end
|
local currentTime = GetTime()
|
||||||
CounterFrame.text:SetText("Moans: " .. (MoanSDB.totalMoans or 0))
|
local timeout = MoanSDB and MoanSDB.comboTimeout or 4.0
|
||||||
if MoanSDB.showCounter and MoanSDB.active then CounterFrame:Show() else CounterFrame:Hide() end
|
if (currentTime - lastSoundTime) > timeout or comboCount >= MAX_SOUNDS then comboCount = 1 else comboCount = comboCount + 1 end
|
||||||
UpdateLockState()
|
lastSoundTime = currentTime
|
||||||
end
|
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"
|
||||||
|
end
|
||||||
|
|
||||||
local function TriggerCombo()
|
local MoanSPanel = CreateFrame("Frame", "MoanSConfigPanel", UIParent); MoanSPanel.name = addonName
|
||||||
local currentTime = GetTime()
|
local category
|
||||||
local timeout = MoanSDB and MoanSDB.comboTimeout or 4.0
|
|
||||||
local soundFile = ""
|
|
||||||
|
|
||||||
if (currentTime - lastSoundTime) > timeout or comboCount >= MAX_SOUNDS then
|
local function CreateCB(parent, label, x, y, dbKey)
|
||||||
comboCount = 1
|
local cb = CreateFrame("CheckButton", nil, parent, "InterfaceOptionsCheckButtonTemplate")
|
||||||
else
|
cb:SetPoint("TOPLEFT", x, y); cb.Text:SetText(label)
|
||||||
comboCount = comboCount + 1
|
cb:SetScript("OnShow", function(self) if MoanSDB then self:SetChecked(MoanSDB[dbKey]) end end)
|
||||||
end
|
cb:SetScript("OnClick", function(self) MoanSDB[dbKey] = self:GetChecked(); UpdateCounterDisplay() end)
|
||||||
|
return cb
|
||||||
|
end
|
||||||
|
|
||||||
lastSoundTime = currentTime
|
frame:SetScript("OnEvent", function(self, event, arg1)
|
||||||
CounterFrame.Cooldown:SetCooldown(currentTime, timeout)
|
if event == "ADDON_LOADED" and arg1 == addonName then
|
||||||
|
if not MoanSDB then MoanSDB = CopyTable(defaults) end
|
||||||
if comboCount == MAX_SOUNDS then
|
for k, v in pairs(defaults) do if MoanSDB[k] == nil then MoanSDB[k] = v end end
|
||||||
soundFile = "Interface\\AddOns\\MoanS\\moan10.ogg"
|
category = Settings.RegisterCanvasLayoutCategory(MoanSPanel, addonName)
|
||||||
else
|
Settings.RegisterAddOnCategory(category)
|
||||||
soundFile = "Interface\\AddOns\\MoanS\\" .. (MoanSDB.soundBaseName or "moan") .. comboCount .. ".ogg"
|
local title = MoanSPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
||||||
end
|
title:SetPoint("TOPLEFT", 16, -16); title:SetText("|cffFF69B4MoanS|r - Retail")
|
||||||
return soundFile
|
CreateCB(MoanSPanel, "Addon Aktiviert", 16, -50, "active")
|
||||||
end
|
CreateCB(MoanSPanel, "Fenster anzeigen", 16, -80, "showCounter")
|
||||||
|
CreateCB(MoanSPanel, "Fenster fixieren (Lock)", 16, -110, "locked")
|
||||||
-- 3. OPTIONS PANEL
|
if MoanSDB.framePos then
|
||||||
local MoanSPanel = CreateFrame("Frame", "MoanSConfigPanel", UIParent)
|
CounterFrame:ClearAllPoints()
|
||||||
MoanSPanel.name = addonName
|
CounterFrame:SetPoint(MoanSDB.framePos[1], UIParent, MoanSDB.framePos[2], MoanSDB.framePos[3], MoanSDB.framePos[4])
|
||||||
local category
|
end
|
||||||
|
UpdateCounterDisplay()
|
||||||
local function CreateCB(parent, label, x, y, dbKey)
|
elseif event == "COMBAT_LOG_EVENT_UNFILTERED" then
|
||||||
local cb = CreateFrame("CheckButton", nil, parent, "InterfaceOptionsCheckButtonTemplate")
|
if not MoanSDB or not MoanSDB.active then return end
|
||||||
cb:SetPoint("TOPLEFT", x, y)
|
local info = {CombatLogGetCurrentEventInfo()}
|
||||||
cb.Text:SetText(label)
|
local sub, sGUID = info[2], info[4]
|
||||||
cb:SetScript("OnShow", function(self) if MoanSDB then self:SetChecked(MoanSDB[dbKey]) end end)
|
if sGUID == UnitGUID("player") or sGUID == UnitGUID("pet") then
|
||||||
cb:SetScript("OnClick", function(self)
|
local isCrit, amount = false, 0
|
||||||
MoanSDB[dbKey] = self:GetChecked()
|
if sub == "SWING_DAMAGE" then amount, isCrit = info[12], info[18]
|
||||||
UpdateCounterDisplay()
|
elseif sub:find("_DAMAGE") then amount, isCrit = info[15], info[21]
|
||||||
end)
|
elseif sub == "SPELL_HEAL" then amount, isCrit = info[15], info[18] end
|
||||||
return cb
|
if isCrit then
|
||||||
end
|
PlaySoundFile(TriggerCombo(), "Master")
|
||||||
|
ShowCritText(amount)
|
||||||
-- 4. EVENT HANDLER
|
MoanSDB.totalMoans = MoanSDB.totalMoans + 1
|
||||||
frame:SetScript("OnEvent", function(self, event, arg1)
|
|
||||||
if event == "ADDON_LOADED" and arg1 == addonName then
|
|
||||||
if not MoanSDB then MoanSDB = CopyTable(defaults) end
|
|
||||||
for k, v in pairs(defaults) do if MoanSDB[k] == nil then MoanSDB[k] = v end end
|
|
||||||
|
|
||||||
category = Settings.RegisterCanvasLayoutCategory(MoanSPanel, addonName)
|
|
||||||
Settings.RegisterAddOnCategory(category)
|
|
||||||
|
|
||||||
local title = MoanSPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
||||||
title:SetPoint("TOPLEFT", 16, -16)
|
|
||||||
title:SetText("|cffFF69B4MoanS|r - Retail Edition")
|
|
||||||
|
|
||||||
CreateCB(MoanSPanel, "Addon Aktiviert", 16, -50, "active")
|
|
||||||
CreateCB(MoanSPanel, "Fenster anzeigen", 16, -80, "showCounter")
|
|
||||||
CreateCB(MoanSPanel, "Fenster fixieren (Lock)", 16, -110, "locked")
|
|
||||||
CreateCB(MoanSPanel, "Chat Nachrichten", 16, -140, "chat")
|
|
||||||
|
|
||||||
local slider = CreateFrame("Slider", "MoanSTimeoutSlider", MoanSPanel, "OptionsSliderTemplate")
|
|
||||||
slider:SetPoint("TOPLEFT", 20, -190)
|
|
||||||
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, -240)
|
|
||||||
btnTest:SetSize(160, 25)
|
|
||||||
btnTest:SetText("Feuerwerk Testen")
|
|
||||||
btnTest:SetScript("OnClick", function()
|
|
||||||
PlaySoundFile(TriggerCombo(), "Master")
|
|
||||||
ShowCritText(math.random(10000, 2000000))
|
|
||||||
end)
|
|
||||||
|
|
||||||
local btnReset = CreateFrame("Button", nil, MoanSPanel, "UIPanelButtonTemplate")
|
|
||||||
btnReset:SetPoint("TOPLEFT", 16, -275)
|
|
||||||
btnReset:SetSize(160, 25)
|
|
||||||
btnReset:SetText("Counter Reset")
|
|
||||||
btnReset:SetScript("OnClick", function() MoanSDB.totalMoans = 0; UpdateCounterDisplay() end)
|
|
||||||
|
|
||||||
if MoanSDB.framePos then
|
|
||||||
CounterFrame:ClearAllPoints()
|
|
||||||
CounterFrame:SetPoint(MoanSDB.framePos[1], UIParent, MoanSDB.framePos[2], MoanSDB.framePos[3], MoanSDB.framePos[4])
|
|
||||||
end
|
|
||||||
UpdateCounterDisplay()
|
UpdateCounterDisplay()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
elseif event == "COMBAT_LOG_EVENT_UNFILTERED" then
|
SLASH_MOANS1 = "/moans"
|
||||||
if not MoanSDB or not MoanSDB.active then return end
|
SlashCmdList["MOANS"] = function() if category and category.GetID then Settings.OpenToCategory(category:GetID()) end end
|
||||||
|
|
||||||
local info = {CombatLogGetCurrentEventInfo()}
|
|
||||||
local subevent, sourceGUID = info[2], info[4]
|
|
||||||
|
|
||||||
if sourceGUID == UnitGUID("player") or (sourceGUID == UnitGUID("pet") and MoanSDB.petEnabled) then
|
|
||||||
local critDetected, amount = false, 0
|
|
||||||
|
|
||||||
if subevent == "SWING_DAMAGE" then
|
|
||||||
amount, critDetected = info[12], info[18]
|
|
||||||
elseif subevent:find("_DAMAGE") then
|
|
||||||
amount, critDetected = info[15], info[21]
|
|
||||||
elseif subevent == "SPELL_HEAL" and MoanSDB.healEnabled then
|
|
||||||
amount, critDetected = info[15], info[18]
|
|
||||||
end
|
|
||||||
|
|
||||||
if critDetected then
|
|
||||||
PlaySoundFile(TriggerCombo(), "Master")
|
|
||||||
ShowCritText(amount)
|
|
||||||
MoanSDB.totalMoans = MoanSDB.totalMoans + 1
|
|
||||||
UpdateCounterDisplay()
|
|
||||||
if MoanSDB.chat then print("|cffFF69B4MoanS!|r Combo: "..comboCount.."/9 ("..FormatNumber(amount)..")") end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
SLASH_MOANS1 = "/moans"
|
|
||||||
SlashCmdList["MOANS"] = function()
|
|
||||||
if category then Settings.OpenToCategory(category:GetID()) end
|
|
||||||
end
|
|
||||||
|
|||||||
BIN
media/moan1.ogg
Normal file
BIN
media/moan1.ogg
Normal file
Binary file not shown.
BIN
media/moan10.ogg
Normal file
BIN
media/moan10.ogg
Normal file
Binary file not shown.
BIN
media/moan2.ogg
Normal file
BIN
media/moan2.ogg
Normal file
Binary file not shown.
BIN
media/moan3.ogg
Normal file
BIN
media/moan3.ogg
Normal file
Binary file not shown.
BIN
media/moan4.ogg
Normal file
BIN
media/moan4.ogg
Normal file
Binary file not shown.
BIN
media/moan5.ogg
Normal file
BIN
media/moan5.ogg
Normal file
Binary file not shown.
BIN
media/moan6.ogg
Normal file
BIN
media/moan6.ogg
Normal file
Binary file not shown.
BIN
media/moan7.ogg
Normal file
BIN
media/moan7.ogg
Normal file
Binary file not shown.
BIN
media/moan8.ogg
Normal file
BIN
media/moan8.ogg
Normal file
Binary file not shown.
BIN
media/moan9.ogg
Normal file
BIN
media/moan9.ogg
Normal file
Binary file not shown.
Reference in New Issue
Block a user