Combo-Bild erzeugt und eingebunden
This commit is contained in:
158
MoanS.lua
158
MoanS.lua
@@ -2,11 +2,20 @@ local addonName = "MoanS"
|
|||||||
local MOAN_NAME = "|cFFFF69B4MoanS|r"
|
local MOAN_NAME = "|cFFFF69B4MoanS|r"
|
||||||
local MOAN_TEXT = "|cFFFF69B4Moan!|r"
|
local MOAN_TEXT = "|cFFFF69B4Moan!|r"
|
||||||
local COMBO_COLOR = "|cFF00FF00"
|
local COMBO_COLOR = "|cFF00FF00"
|
||||||
|
local COMBO_IMAGE_PATH = "Interface\\AddOns\\MoanS\\media\\combo_pic.tga"
|
||||||
|
|
||||||
local defaults = {
|
local defaults = {
|
||||||
active = true, chat = true, petEnabled = true, healEnabled = true,
|
active = true,
|
||||||
totalMoans = 0, showCounter = true,
|
chat = true,
|
||||||
framePos = nil, soundBaseName = "moan", comboTimeout = 4.0, locked = false,
|
petEnabled = true,
|
||||||
|
healEnabled = true,
|
||||||
|
totalMoans = 0,
|
||||||
|
showCounter = true,
|
||||||
|
showImages = true,
|
||||||
|
framePos = nil,
|
||||||
|
soundBaseName = "moan",
|
||||||
|
comboTimeout = 4.0,
|
||||||
|
locked = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
local frame = CreateFrame("Frame")
|
local frame = CreateFrame("Frame")
|
||||||
@@ -15,10 +24,51 @@ frame:RegisterEvent("ADDON_LOADED")
|
|||||||
|
|
||||||
local lastSoundTime, comboCount = 0, 0
|
local lastSoundTime, comboCount = 0, 0
|
||||||
|
|
||||||
|
-- CHAOS-VISUAL FUNKTION (Zufällige Bilder)
|
||||||
|
local function TriggerComboVisual()
|
||||||
|
if not MoanSDB or not MoanSDB.showImages then return end
|
||||||
|
|
||||||
|
local f = CreateFrame("Frame", nil, UIParent)
|
||||||
|
|
||||||
|
-- Chaos-Faktor: Größe und Position
|
||||||
|
local randomSize = math.random(300, 500)
|
||||||
|
f:SetSize(randomSize, randomSize)
|
||||||
|
|
||||||
|
local randomX = math.random(-600, 600)
|
||||||
|
local randomY = math.random(-300, 400)
|
||||||
|
f:SetPoint("CENTER", randomX, randomY)
|
||||||
|
|
||||||
|
local tex = f:CreateTexture(nil, "OVERLAY")
|
||||||
|
tex:SetAllPoints()
|
||||||
|
tex:SetTexture(COMBO_IMAGE_PATH)
|
||||||
|
|
||||||
|
local randomAlpha = math.random(50, 85) / 100
|
||||||
|
tex:SetAlpha(randomAlpha)
|
||||||
|
|
||||||
|
local ag = f:CreateAnimationGroup()
|
||||||
|
local scale = ag:CreateAnimation("Scale")
|
||||||
|
scale:SetScale(1.4, 1.4)
|
||||||
|
scale:SetDuration(0.15)
|
||||||
|
scale:SetOrder(1)
|
||||||
|
|
||||||
|
local fade = ag:CreateAnimation("Alpha")
|
||||||
|
fade:SetFromAlpha(1)
|
||||||
|
fade:SetToAlpha(0)
|
||||||
|
fade:SetStartDelay(0.5)
|
||||||
|
fade:SetDuration(0.6)
|
||||||
|
fade:SetOrder(2)
|
||||||
|
|
||||||
|
ag:SetScript("OnFinished", function()
|
||||||
|
f:Hide()
|
||||||
|
f:SetParent(nil)
|
||||||
|
end)
|
||||||
|
|
||||||
|
ag:Play()
|
||||||
|
end
|
||||||
|
|
||||||
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 >= 1000 then return string.format("%.1fK", amount / 1000)
|
||||||
elseif amount >= 1000 then return string.format("%.1fK", amount / 1000)
|
|
||||||
else return tostring(amount) end
|
else return tostring(amount) end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -35,22 +85,15 @@ if not amount or type(amount) ~= "number" then return amount or "0" end
|
|||||||
local function ShowCritText(amount, isHighCombo)
|
local function ShowCritText(amount, isHighCombo)
|
||||||
local f = CreateFrame("Frame", nil, CounterFrame); f:SetSize(200, 30)
|
local f = CreateFrame("Frame", nil, CounterFrame); f:SetSize(200, 30)
|
||||||
f:SetPoint("CENTER", CounterFrame, "CENTER", 0, 0)
|
f:SetPoint("CENTER", CounterFrame, "CENTER", 0, 0)
|
||||||
local text = f:CreateFontString(nil, "OVERLAY", "NumberFontNormal")
|
local text = f:CreateFontString(nil, "OVERLAY", "NumberFont_Outline_Huge")
|
||||||
text:SetPoint("CENTER"); text:SetText(FormatNumber(amount))
|
text:SetPoint("CENTER"); text:SetText(FormatNumber(amount))
|
||||||
|
text:SetTextColor(isHighCombo and 0 or 1, isHighCombo and 1 or 0.41, isHighCombo and 0 or 0.7)
|
||||||
if isHighCombo then
|
|
||||||
text:SetTextColor(0, 1, 0)
|
|
||||||
text:SetFont(text:GetFont(), 26, "OUTLINE")
|
|
||||||
else
|
|
||||||
text:SetTextColor(1, 0.41, 0.7)
|
|
||||||
text:SetFont(text:GetFont(), 22, "OUTLINE")
|
|
||||||
end
|
|
||||||
|
|
||||||
local ag = f:CreateAnimationGroup()
|
local ag = f:CreateAnimationGroup()
|
||||||
local targetX, targetY = math.random(-120, 120), math.random(80, 150)
|
local tX, tY = math.random(-100, 100), math.random(60, 120)
|
||||||
local scale = ag:CreateAnimation("Scale"); scale:SetScale(1.4, 1.4); scale:SetDuration(0.15); scale:SetOrder(1)
|
local s = ag:CreateAnimation("Scale"); s:SetScale(1.4, 1.4); s:SetDuration(0.1); s:SetOrder(1)
|
||||||
local translation = ag:CreateAnimation("Translation"); translation:SetOffset(targetX, targetY); translation:SetDuration(1.4); translation:SetSmoothing("OUT"); translation:SetOrder(2)
|
local t = ag:CreateAnimation("Translation"); t:SetOffset(tX, tY); t:SetDuration(1.2); t:SetSmoothing("OUT"); t:SetOrder(2)
|
||||||
local alpha = ag:CreateAnimation("Alpha"); alpha:SetFromAlpha(1); alpha:SetToAlpha(0); alpha:SetStartDelay(0.7); alpha:SetDuration(0.7); alpha:SetOrder(2)
|
local a = ag:CreateAnimation("Alpha"); a:SetFromAlpha(1); a:SetToAlpha(0); a:SetStartDelay(0.6); a:SetDuration(0.6); a:SetOrder(2)
|
||||||
ag:SetScript("OnFinished", function() f:Hide() end); ag:Play()
|
ag:SetScript("OnFinished", function() f:Hide() end); ag:Play()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -64,38 +107,33 @@ if not amount or type(amount) ~= "number" then return amount or "0" 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, _, rel, x, y = self:GetPoint()
|
local p, _, r, x, y = self:GetPoint()
|
||||||
if MoanSDB then MoanSDB.framePos = { point, rel, x, y } end
|
if MoanSDB then MoanSDB.framePos = { p, r, x, y } end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function GetNextSound()
|
local function GetNextSound()
|
||||||
local currentTime = GetTime()
|
local currentTime = GetTime()
|
||||||
local timeout = MoanSDB and MoanSDB.comboTimeout or 4.0
|
local timeout = MoanSDB and MoanSDB.comboTimeout or 4.0
|
||||||
|
if (currentTime - lastSoundTime) > timeout then comboCount = 1 else comboCount = comboCount + 1 end
|
||||||
if (currentTime - lastSoundTime) > timeout then
|
|
||||||
comboCount = 1
|
|
||||||
else
|
|
||||||
comboCount = comboCount + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
lastSoundTime = currentTime
|
lastSoundTime = currentTime
|
||||||
CounterFrame.Cooldown:SetCooldown(currentTime, timeout)
|
CounterFrame.Cooldown:SetCooldown(currentTime, timeout)
|
||||||
|
|
||||||
-- Sound-Rotation Logik
|
|
||||||
local soundIndex = comboCount % 10
|
local soundIndex = comboCount % 10
|
||||||
if soundIndex == 0 then soundIndex = 10 end -- Bei 10, 20, 30... spiele moan10
|
if soundIndex == 0 then
|
||||||
|
soundIndex = 10
|
||||||
local sFile = (MoanSDB.soundBaseName or "moan") .. soundIndex .. ".ogg"
|
TriggerComboVisual()
|
||||||
local isHigh = comboCount >= 10
|
|
||||||
|
|
||||||
return "Interface\\AddOns\\MoanS\\media\\" .. sFile, comboCount, isHigh
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local MoanSPanel = CreateFrame("Frame", "MoanSConfigPanel", UIParent)
|
local sFile = (MoanSDB.soundBaseName or "moan") .. soundIndex .. ".ogg"
|
||||||
local category
|
return "Interface\\AddOns\\MoanS\\media\\" .. sFile, comboCount, (comboCount >= 10)
|
||||||
|
end
|
||||||
|
|
||||||
local function CreateCB(parent, label, x, y, dbKey)
|
-- Menü-Panel für Classic
|
||||||
local cb = CreateFrame("CheckButton", nil, parent, "InterfaceOptionsCheckButtonTemplate")
|
local MoanSPanel = CreateFrame("Frame", "MoanSConfigPanel", UIParent)
|
||||||
|
MoanSPanel.name = MOAN_NAME
|
||||||
|
|
||||||
|
local function CreateCB(label, x, y, dbKey)
|
||||||
|
local cb = CreateFrame("CheckButton", nil, MoanSPanel, "InterfaceOptionsCheckButtonTemplate")
|
||||||
cb:SetPoint("TOPLEFT", x, y); cb.Text:SetText(label)
|
cb:SetPoint("TOPLEFT", x, y); cb.Text:SetText(label)
|
||||||
cb:SetScript("OnShow", function(self) if MoanSDB then self:SetChecked(MoanSDB[dbKey]) end end)
|
cb:SetScript("OnShow", function(self) if MoanSDB then self:SetChecked(MoanSDB[dbKey]) end end)
|
||||||
cb:SetScript("OnClick", function(self) MoanSDB[dbKey] = self:GetChecked(); UpdateCounterDisplay() end)
|
cb:SetScript("OnClick", function(self) MoanSDB[dbKey] = self:GetChecked(); UpdateCounterDisplay() end)
|
||||||
@@ -107,21 +145,21 @@ if not amount or type(amount) ~= "number" then return amount or "0" end
|
|||||||
if not MoanSDB then MoanSDB = CopyTable(defaults) end
|
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
|
for k, v in pairs(defaults) do if MoanSDB[k] == nil then MoanSDB[k] = v end end
|
||||||
|
|
||||||
category = Settings.RegisterCanvasLayoutCategory(MoanSPanel, MOAN_NAME)
|
InterfaceOptions_AddCategory(MoanSPanel)
|
||||||
Settings.RegisterAddOnCategory(category)
|
|
||||||
|
|
||||||
local title = MoanSPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
local title = MoanSPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
||||||
title:SetPoint("TOPLEFT", 16, -16); title:SetText(MOAN_NAME .. " - Classic")
|
title:SetPoint("TOPLEFT", 16, -16); title:SetText(MOAN_NAME .. " - Classic")
|
||||||
|
|
||||||
CreateCB(MoanSPanel, "Addon Aktiviert", 16, -50, "active")
|
CreateCB("Addon Aktiviert", 16, -50, "active")
|
||||||
CreateCB(MoanSPanel, "Chat Nachrichten", 16, -80, "chat")
|
CreateCB("Chat Nachrichten", 16, -80, "chat")
|
||||||
CreateCB(MoanSPanel, "Fenster anzeigen", 16, -110, "showCounter")
|
CreateCB("Fenster anzeigen", 16, -110, "showCounter")
|
||||||
CreateCB(MoanSPanel, "Fenster fixieren (Lock)", 16, -140, "locked")
|
CreateCB("Bilder bei Ultra-Combo", 16, -140, "showImages")
|
||||||
CreateCB(MoanSPanel, "Pet Crits zählen", 16, -170, "petEnabled")
|
CreateCB("Fenster fixieren (Lock)", 16, -170, "locked")
|
||||||
CreateCB(MoanSPanel, "Heil-Crits zählen", 16, -200, "healEnabled")
|
CreateCB("Pet Crits zählen", 16, -200, "petEnabled")
|
||||||
|
CreateCB("Heil-Crits zählen", 16, -230, "healEnabled")
|
||||||
|
|
||||||
local slider = CreateFrame("Slider", "MoanSTimeoutSlider", MoanSPanel, "OptionsSliderTemplate")
|
local slider = CreateFrame("Slider", "MoanSTimeoutSlider", MoanSPanel, "OptionsSliderTemplate")
|
||||||
slider:SetPoint("TOPLEFT", 20, -250); slider:SetMinMaxValues(0.5, 10.0); slider:SetValueStep(0.5); slider:SetWidth(180)
|
slider:SetPoint("TOPLEFT", 20, -280); 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")
|
_G[slider:GetName().."Low"]:SetText("0.5s"); _G[slider:GetName().."High"]:SetText("10s")
|
||||||
local sliderVal = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
|
local sliderVal = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
|
||||||
sliderVal:SetPoint("BOTTOM", slider, "TOP", 0, 5)
|
sliderVal:SetPoint("BOTTOM", slider, "TOP", 0, 5)
|
||||||
@@ -132,19 +170,6 @@ if not amount or type(amount) ~= "number" then return amount or "0" end
|
|||||||
end)
|
end)
|
||||||
slider:SetValue(MoanSDB.comboTimeout)
|
slider:SetValue(MoanSDB.comboTimeout)
|
||||||
|
|
||||||
local btnTest = CreateFrame("Button", nil, MoanSPanel, "UIPanelButtonTemplate")
|
|
||||||
btnTest:SetPoint("TOPLEFT", 16, -300); btnTest:SetSize(160, 25); btnTest:SetText("Combo Testen")
|
|
||||||
btnTest:SetScript("OnClick", function()
|
|
||||||
local sPath, cIdx, isHigh = GetNextSound()
|
|
||||||
local amount = math.random(100, 5000)
|
|
||||||
PlaySoundFile(sPath, "Master")
|
|
||||||
ShowCritText(amount, isHigh)
|
|
||||||
if MoanSDB.chat then
|
|
||||||
local prefix = isHigh and (COMBO_COLOR .. "[ULTRA COMBO x" .. cIdx .. "]|r") or ("[Combo " .. cIdx .. "/9]")
|
|
||||||
print(MOAN_TEXT .. " " .. prefix .. " Crit: " .. FormatNumber(amount))
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
if MoanSDB.framePos then
|
if MoanSDB.framePos then
|
||||||
CounterFrame:ClearAllPoints(); CounterFrame:SetPoint(MoanSDB.framePos[1], UIParent, MoanSDB.framePos[2], MoanSDB.framePos[3], MoanSDB.framePos[4])
|
CounterFrame:ClearAllPoints(); CounterFrame:SetPoint(MoanSDB.framePos[1], UIParent, MoanSDB.framePos[2], MoanSDB.framePos[3], MoanSDB.framePos[4])
|
||||||
end
|
end
|
||||||
@@ -157,15 +182,14 @@ if not amount or type(amount) ~= "number" then return amount or "0" end
|
|||||||
if sub == "SWING_DAMAGE" then amount, isCrit = a12, a17
|
if sub == "SWING_DAMAGE" then amount, isCrit = a12, a17
|
||||||
elseif sub:find("_DAMAGE") then amount, isCrit = a15, a21
|
elseif sub:find("_DAMAGE") then amount, isCrit = a15, a21
|
||||||
elseif sub == "SPELL_HEAL" and MoanSDB.healEnabled then amount, isCrit = a15, a18 end
|
elseif sub == "SPELL_HEAL" and MoanSDB.healEnabled then amount, isCrit = a15, a18 end
|
||||||
|
|
||||||
if isCrit then
|
if isCrit then
|
||||||
local sPath, cIdx, isHigh = GetNextSound()
|
local sPath, cIdx, isHigh = GetNextSound()
|
||||||
PlaySoundFile(sPath, "Master")
|
PlaySoundFile(sPath, "Master"); ShowCritText(amount, isHigh)
|
||||||
ShowCritText(amount, isHigh)
|
MoanSDB.totalMoans = MoanSDB.totalMoans + 1; UpdateCounterDisplay()
|
||||||
MoanSDB.totalMoans = MoanSDB.totalMoans + 1
|
|
||||||
UpdateCounterDisplay()
|
|
||||||
if MoanSDB.chat then
|
if MoanSDB.chat then
|
||||||
local prefix = isHigh and (COMBO_COLOR .. "[ULTRA COMBO x" .. cIdx .. "]|r") or ("[Combo " .. cIdx .. "/9]")
|
local prefix = isHigh and (COMBO_COLOR .. "[ULTRA COMBO x" .. cIdx .. "]|r") or ("[Combo " .. cIdx .. "/9]")
|
||||||
print(MOAN_TEXT .. " " .. prefix .. " Crit: " .. FormatNumber(amount) .. " (Total: " .. MoanSDB.totalMoans .. ")")
|
print(MOAN_TEXT .. " " .. prefix .. " Crit: " .. FormatNumber(amount))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -173,6 +197,4 @@ if not amount or type(amount) ~= "number" then return amount or "0" end
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
SLASH_MOANS1 = "/moans"
|
SLASH_MOANS1 = "/moans"
|
||||||
SlashCmdList["MOANS"] = function()
|
SlashCmdList["MOANS"] = function() InterfaceOptionsFrame_OpenToCategory(MoanSPanel); InterfaceOptionsFrame_OpenToCategory(MoanSPanel) end
|
||||||
if category and category.GetID then Settings.OpenToCategory(category:GetID()) else InterfaceOptionsFrame_OpenToCategory("MoanS") end
|
|
||||||
end
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
## Title: |cffFF69B4MoanS|r
|
## Title: |cffFF69B4MoanS|r
|
||||||
## Notes: Krit-Sound Addon
|
## Notes: Krit-Sound Addon
|
||||||
## Author: Quasimoder
|
## Author: Quasimoder
|
||||||
## Version: 3.1
|
## Version: 4.0
|
||||||
## SavedVariables: MoanSDB
|
## SavedVariables: MoanSDB
|
||||||
|
|
||||||
MoanS.lua
|
MoanS.lua
|
||||||
|
|||||||
BIN
media/combo_pic.tga
Normal file
BIN
media/combo_pic.tga
Normal file
Binary file not shown.
Reference in New Issue
Block a user