diff --git a/Locales/deDE.lua b/Locales/deDE.lua index 66850bc..7ac0578 100644 --- a/Locales/deDE.lua +++ b/Locales/deDE.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "deDE") if not L then return end +L["Fireworks Settings"] = "Fireworks Settings" +L["Fireworks Duration"] = "Fireworks Duration" +L["Duration of the fireworks animation"] = "Duration of the fireworks animation" + --L["Unfortunately Blizzard has not added a SCT API in Midnight, until they do this addon will not have any functionality."] --L["If you want to enable or disable the blizzard SCT you can do so here"] = true --L["Thank you for the years of support, and hopefully we'll be able to bring NameplateSCT back in the future! - Justwait"] = true @@ -53,6 +57,9 @@ L["Enable"] = "Aktivieren" --L["Font Flags"] = "Font Flags" L["Font"] = "Schriftart" --L["Fountain"] = "Fountain" +L["Fireworks"] = "Feuerwerk" +L["Fireworks Radius"] = "Fireworks Radius" +L["Start radius for fireworks animation"] = "Start radius for fireworks animation" --L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Has soft max/min, you can type whatever you'd like into the editbox" --L["Hide hits that are below a running average of your recent damage output"] = "Hide hits that are below a running average of your recent damage output" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/enUS.lua b/Locales/enUS.lua index 08bc726..bf51c1c 100644 --- a/Locales/enUS.lua +++ b/Locales/enUS.lua @@ -52,6 +52,12 @@ L["Filters"] = true L["Font Flags"] = true L["Font"] = true L["Fountain"] = true +L["Fireworks"] = true +L["Fireworks Radius"] = true +L["Fireworks Settings"] = true +L["Fireworks Duration"] = true +L["Duration of the fireworks animation"] = true +L["Start radius for fireworks animation"] = true L["Has soft max/min, you can type whatever you'd like into the editbox"] = true L["Hide hits that are below a running average of your recent damage output"] = true L["Hide hits that are below this threshold."] = true diff --git a/Locales/esES.lua b/Locales/esES.lua index 27bfedc..7ae1006 100644 --- a/Locales/esES.lua +++ b/Locales/esES.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "esES") if not L then return end +L["Fireworks Settings"] = "Fireworks Settings" +L["Fireworks Duration"] = "Fireworks Duration" +L["Duration of the fireworks animation"] = "Duration of the fireworks animation" + --L["Unfortunately Blizzard has not added a SCT API in Midnight, until they do this addon will not have any functionality."] --L["If you want to enable or disable the blizzard SCT you can do so here"] = true --L["Thank you for the years of support, and hopefully we'll be able to bring NameplateSCT back in the future! - Justwait"] = true @@ -53,6 +57,9 @@ L["Display only the icon for damage.\nWill not change Miss, Dodge, Parry, etc di --L["Font Flags"] = "Font Flags" --L["Font"] = "Font" --L["Fountain"] = "Fountain" +L["Fireworks"] = "Fuegos artificiales" +L["Fireworks Radius"] = "Fireworks Radius" +L["Start radius for fireworks animation"] = "Start radius for fireworks animation" --L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Has soft max/min, you can type whatever you'd like into the editbox" --L["Hide hits that are below a running average of your recent damage output"] = "Hide hits that are below a running average of your recent damage output" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/esMX.lua b/Locales/esMX.lua index a474554..bf854cf 100644 --- a/Locales/esMX.lua +++ b/Locales/esMX.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "esMX") if not L then return end +L["Fireworks Settings"] = "Fireworks Settings" +L["Fireworks Duration"] = "Fireworks Duration" +L["Duration of the fireworks animation"] = "Duration of the fireworks animation" + --L["Unfortunately Blizzard has not added a SCT API in Midnight, until they do this addon will not have any functionality."] --L["If you want to enable or disable the blizzard SCT you can do so here"] = true --L["Thank you for the years of support, and hopefully we'll be able to bring NameplateSCT back in the future! - Justwait"] = true @@ -53,6 +57,9 @@ if not L then return end --L["Font Flags"] = "Font Flags" --L["Font"] = "Font" --L["Fountain"] = "Fountain" +L["Fireworks"] = "Fuegos artificiales" +L["Fireworks Radius"] = "Fireworks Radius" +L["Start radius for fireworks animation"] = "Start radius for fireworks animation" --L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Has soft max/min, you can type whatever you'd like into the editbox" --L["Hide hits that are below a running average of your recent damage output"] = "Hide hits that are below a running average of your recent damage output" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/frFR.lua b/Locales/frFR.lua index d3a6c92..789ab65 100644 --- a/Locales/frFR.lua +++ b/Locales/frFR.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "frFR") if not L then return end +L["Fireworks Settings"] = "Fireworks Settings" +L["Fireworks Duration"] = "Fireworks Duration" +L["Duration of the fireworks animation"] = "Duration of the fireworks animation" + --L["Unfortunately Blizzard has not added a SCT API in Midnight, until they do this addon will not have any functionality."] --L["If you want to enable or disable the blizzard SCT you can do so here"] = true --L["Thank you for the years of support, and hopefully we'll be able to bring NameplateSCT back in the future! - Justwait"] = true @@ -53,6 +57,9 @@ L["Evaded"] = "Évité" --L["Font Flags"] = "Font Flags" L["Font"] = "Police de caractère" L["Fountain"] = "Fontaine" +L["Fireworks"] = "Feux d'artifice" +L["Fireworks Radius"] = "Fireworks Radius" +L["Start radius for fireworks animation"] = "Start radius for fireworks animation" --L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Has soft max/min, you can type whatever you'd like into the editbox" L["Hide hits that are below a running average of your recent damage output"] = "Cacher les dégâts qui sont en dessous de la moyenne des dégâts récents" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/koKR.lua b/Locales/koKR.lua index a5746fa..239d63a 100644 --- a/Locales/koKR.lua +++ b/Locales/koKR.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "koKR") if not L then return end +L["Fireworks Settings"] = "Fireworks Settings" +L["Fireworks Duration"] = "Fireworks Duration" +L["Duration of the fireworks animation"] = "Duration of the fireworks animation" + --L["Unfortunately Blizzard has not added a SCT API in Midnight, until they do this addon will not have any functionality."] --L["If you want to enable or disable the blizzard SCT you can do so here"] = true --L["Thank you for the years of support, and hopefully we'll be able to bring NameplateSCT back in the future! - Justwait"] = true @@ -53,6 +57,9 @@ L["Evaded"] = "벗어남" L["Font Flags"] = "글꼴 외곽선" L["Font"] = "글꼴" L["Fountain"] = "분수" +L["Fireworks"] = "불꽃놀이" +L["Fireworks Radius"] = "Fireworks Radius" +L["Start radius for fireworks animation"] = "Start radius for fireworks animation" L["Has soft max/min, you can type whatever you'd like into the editbox"] = "최대/최소 값이 있습니다, 입력창에 원하는 값을 입력할 수 있습니다." L["Hide hits that are below a running average of your recent damage output"] = "피해량이 최근 피해량의 평균보다 낮으면 숨깁니다" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/ruRU.lua b/Locales/ruRU.lua index c822b48..cd814d9 100644 --- a/Locales/ruRU.lua +++ b/Locales/ruRU.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "ruRU") if not L then return end +L["Fireworks Settings"] = "Fireworks Settings" +L["Fireworks Duration"] = "Fireworks Duration" +L["Duration of the fireworks animation"] = "Duration of the fireworks animation" + --L["Unfortunately Blizzard has not added a SCT API in Midnight, until they do this addon will not have any functionality."] --L["If you want to enable or disable the blizzard SCT you can do so here"] = true --L["Thank you for the years of support, and hopefully we'll be able to bring NameplateSCT back in the future! - Justwait"] = true @@ -53,6 +57,9 @@ L["Evaded"] = "Избежание" L["Font Flags"] = "Параметры шрифта" L["Font"] = "Шрифт" L["Fountain"] = "Фонтан" +L["Fireworks"] = "Фейерверк" +L["Fireworks Radius"] = "Fireworks Radius" +L["Start radius for fireworks animation"] = "Start radius for fireworks animation" L["Has soft max/min, you can type whatever you'd like into the editbox"] = "Имеет неограниченный минимум/максимум, можно ввести любое число в поле ввода" L["Hide hits that are below a running average of your recent damage output"] = "Скрыть слабые удары, которые ниже среднего урона персонажа" --L["Hide hits that are below this threshold."] = "Hide hits that are below this threshold." diff --git a/Locales/zhCN.lua b/Locales/zhCN.lua index bf77ee9..3769556 100644 --- a/Locales/zhCN.lua +++ b/Locales/zhCN.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "zhCN") if not L then return end +L["Fireworks Settings"] = "烟花设置" +L["Fireworks Duration"] = "烟花持续时间" +L["Duration of the fireworks animation"] = "烟花动画的持续时间" + L["Unfortunately Blizzard has not added a SCT API in Midnight, until they do this addon will not have any functionality."] = "不幸的是,暴雪在《至暗之夜》版本中仍未添加浮动战斗文字的相关API。在实现此功能前,该插件将无法正常运行。" L["If you want to enable or disable the blizzard SCT you can do so here"] = "如需启用或禁用暴雪浮动战斗文字(SCT),可在此处设置" L["Thank you for the years of support, and hopefully we'll be able to bring NameplateSCT back in the future! - Justwait"] = "感谢大家多年来的支持,希望未来我们能重新推出NameplateSCT!- Justwait" @@ -53,6 +57,9 @@ L["Filters"] = "过滤器" L["Font Flags"] = "字体描边" L["Font"] = "字体" L["Fountain"] = "弧形" +L["Fireworks"] = "烟花" +L["Fireworks Radius"] = "烟花起始半径" +L["Start radius for fireworks animation"] = "烟花动画的起始半径" L["Has soft max/min, you can type whatever you'd like into the editbox"] = "有最大值/最小值限制,可在输入框中输入规则内的任意数值" L["Hide hits that are below a running average of your recent damage output"] = "隐藏低于最近攻击平均值的伤害" L["Hide hits that are below this threshold."] = "隐藏低于此阈值的命中伤害。" diff --git a/Locales/zhTW.lua b/Locales/zhTW.lua index d7f76ee..54579ae 100644 --- a/Locales/zhTW.lua +++ b/Locales/zhTW.lua @@ -1,6 +1,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("NameplateSCT", "zhTW") if not L then return end +L["Fireworks Settings"] = "煙火設定" +L["Fireworks Duration"] = "煙火持續時間" +L["Duration of the fireworks animation"] = "煙火動畫的持續時間" + --L["Unfortunately Blizzard has not added a SCT API in Midnight, until they do this addon will not have any functionality."] --L["If you want to enable or disable the blizzard SCT you can do so here"] = true --L["Thank you for the years of support, and hopefully we'll be able to bring NameplateSCT back in the future! - Justwait"] = true @@ -53,6 +57,9 @@ L["Filters"] = "過濾器" L["Font Flags"] = "文字樣式" L["Font"] = "字體" L["Fountain"] = "潮吹噴泉" +L["Fireworks"] = "煙花" +L["Fireworks Radius"] = "煙火起始半徑" +L["Start radius for fireworks animation"] = "煙火動畫的起始半徑" L["Has soft max/min, you can type whatever you'd like into the editbox"] = "有軟上限 / 下限,請隨意輸入喜愛的數值。" L["Hide hits that are below a running average of your recent damage output"] = "隱藏低於最近輸出平均值的傷害。" L["Hide hits that are below this threshold."] = "隱藏低於此閥值的命中。" diff --git a/NameplateSCT.lua b/NameplateSCT.lua index e319798..6116466 100644 --- a/NameplateSCT.lua +++ b/NameplateSCT.lua @@ -47,6 +47,7 @@ local animationValues = { ["verticalDown"] = L["Vertical Down"], ["fountain"] = L["Fountain"], ["rainfall"] = L["Rainfall"], + ["fireworks"] = L["Fireworks"], ["disabled"] = L["Disabled"] } @@ -172,6 +173,8 @@ local defaults = { autoattack = "fountain", autoattackcrit = "verticalUp", animationspeed = 1, + fireworksRadius = 100, + fireworksDuration = 1, }, animationsPersonal = { @@ -583,6 +586,56 @@ local function powSizing(elapsed, duration, start, middle, finish) return size end +-- CSS linear() points +local linearPoints = { + {0, 0}, + {0.036, 0.21}, + {0.074, 0.402}, + {0.113, 0.568}, + {0.153, 0.711}, + {0.173, 0.772}, + {0.194, 0.83}, + {0.215, 0.882}, + {0.237, 0.929}, + {0.259, 0.97}, + {0.282, 1.008}, + {0.306, 1.04}, + {0.33, 1.067}, + {0.349, 1.084}, + {0.369, 1.099}, + {0.389, 1.111}, + {0.41, 1.12}, + {0.432, 1.127}, + {0.454, 1.13}, + {0.477, 1.132}, + {0.501, 1.13}, + {0.54, 1.124}, + {0.585, 1.111}, + {0.629, 1.095}, + {0.755, 1.044}, + {0.795, 1.03}, + {0.832, 1.019}, + {0.873, 1.01}, + {0.913, 1.004}, + {0.954, 1.001}, + {1, 1} +} + +local function GetLinearEasing(p) + if p <= 0 then return linearPoints[1][2] end + if p >= 1 then return linearPoints[#linearPoints][2] end + + for i = 1, #linearPoints - 1 do + local p1 = linearPoints[i] + local p2 = linearPoints[i+1] + if p >= p1[1] and p < p2[1] then + local percent = (p - p1[1]) / (p2[1] - p1[1]) + return p1[2] + (p2[2] - p1[2]) * percent + end + end + return linearPoints[#linearPoints][2] +end + local function AnimationOnUpdate() if (next(animating)) then for fontString, _ in pairs(animating) do @@ -656,15 +709,32 @@ local function AnimationOnUpdate() _, yOffset = verticalPath(elapsed, fontString.animatingDuration, -fontString.distance) xOffset = fontString.rainfallX yOffset = yOffset + fontString.rainfallStartY + elseif (fontString.animation == "fireworks") then + -- 烟花效果:从配置的起始半径圆周向四周发散 + local angle = fontString.fireworksAngle or (math.random() * 2 * math.pi) + local progress = elapsed / fontString.animatingDuration + -- 使用自定义的 linear() 缓动函数 + local easedProgress = GetLinearEasing(progress) + local distance = (fontString.fireworksDistance or 100) * easedProgress + + -- 获取配置的起始半径 + local startRadius = NameplateSCT.db.global.animations.fireworksRadius + xOffset = (startRadius + distance) * math.cos(angle) + yOffset = (startRadius + distance) * math.sin(angle) -- elseif (fontString.animation == "shake") then -- TODO end if (not UnitIsDead(fontString.unit) and fontString.anchorFrame and fontString.anchorFrame:IsShown()) then - if fontString.unit == "player" then -- player frame - fontString:SetPoint("CENTER", fontString.anchorFrame, "CENTER", NameplateSCT.db.global.xOffsetPersonal + xOffset + randomX[fontString], NameplateSCT.db.global.yOffsetPersonal + yOffset + randomY[fontString]) -- Only allows for adjusting vertical offset - else -- nameplate frames - fontString:SetPoint("CENTER", fontString.anchorFrame, "CENTER", NameplateSCT.db.global.xOffset + xOffset + randomX[fontString], NameplateSCT.db.global.yOffset + yOffset + randomY[fontString]) + if fontString.animation == "fireworks" then + -- 烟花效果忽略全局偏移和随机抖动,始终相对于中心 + fontString:SetPoint("CENTER", fontString.anchorFrame, "CENTER", xOffset, yOffset) + else + if fontString.unit == "player" then -- player frame + fontString:SetPoint("CENTER", fontString.anchorFrame, "CENTER", NameplateSCT.db.global.xOffsetPersonal + xOffset + randomX[fontString], NameplateSCT.db.global.yOffsetPersonal + yOffset + randomY[fontString]) -- Only allows for adjusting vertical offset + else -- nameplate frames + fontString:SetPoint("CENTER", fontString.anchorFrame, "CENTER", NameplateSCT.db.global.xOffset + xOffset + randomX[fontString], NameplateSCT.db.global.yOffset + yOffset + randomY[fontString]) + end end else recycleFontString(fontString) @@ -703,6 +773,9 @@ function NameplateSCT:Animate(fontString, anchorFrame, duration, animation) fontString.distance = math.random(ANIMATION_RAINFALL_Y_MIN, ANIMATION_RAINFALL_Y_MAX) fontString.rainfallX = math.random(-ANIMATION_RAINFALL_X_MAX, ANIMATION_RAINFALL_X_MAX) fontString.rainfallStartY = -math.random(ANIMATION_RAINFALL_Y_START_MIN, ANIMATION_RAINFALL_Y_START_MAX) + elseif (animation == "fireworks") then + fontString.fireworksAngle = math.random() * 2 * math.pi + fontString.fireworksDistance = math.random(80, 150) -- elseif (animation == "shake") then -- fontString.deflection = ANIMATION_SHAKE_DEFLECTION -- fontString.numShakes = ANIMATION_SHAKE_NUM_SHAKES @@ -1135,7 +1208,11 @@ function NameplateSCT:DisplayText(guid, text, size, animation, spellId, pow, spe end end end - self:Animate(fontString, nameplate, NameplateSCT.db.global.animations.animationspeed, animation) + local duration = NameplateSCT.db.global.animations.animationspeed + if animation == "fireworks" then + duration = NameplateSCT.db.global.animations.fireworksDuration + end + self:Animate(fontString, nameplate, duration, animation) end function NameplateSCT:DisplayIconWithoutText(guid, size, animation, spellId, pow, spellName) @@ -1201,7 +1278,11 @@ function NameplateSCT:DisplayIconWithoutText(guid, size, animation, spellId, pow end end end - self:Animate(fontString, nameplate, NameplateSCT.db.global.animations.animationspeed, animation) + local duration = NameplateSCT.db.global.animations.animationspeed + if animation == "fireworks" then + duration = NameplateSCT.db.global.animations.fireworksDuration + end + self:Animate(fontString, nameplate, duration, animation) end function NameplateSCT:DisplayTextOverkill(guid, text, size, animation, spellId, pow, spellName) @@ -1263,7 +1344,11 @@ function NameplateSCT:DisplayTextOverkill(guid, text, size, animation, spellId, end end end - self:Animate(fontString, nameplate, NameplateSCT.db.global.animations.animationspeed, animation) + local duration = NameplateSCT.db.global.animations.animationspeed + if animation == "fireworks" then + duration = NameplateSCT.db.global.animations.fireworksDuration + end + self:Animate(fontString, nameplate, duration, animation) end function NameplateSCT:ColorText(startingText, guid, playerGUID, school, spellName, crit) @@ -1416,6 +1501,43 @@ local menu = { order = 1, width = "full", }, + fireworksSettings = { + type = 'header', + name = L["Fireworks Settings"], + order = 1.2, + }, + fireworksRadius = { + type = 'range', + name = L["Fireworks Radius"], + desc = L["Start radius for fireworks animation"], + disabled = function() return not NameplateSCT.db.global.enabled end, + min = 0, + max = 200, + step = 20, + get = function() return NameplateSCT.db.global.animations.fireworksRadius end, + set = function(_, newValue) NameplateSCT.db.global.animations.fireworksRadius = newValue end, + order = 1.3, + width = "normal", + }, + fireworksDuration = { + type = 'range', + name = L["Fireworks Duration"], + desc = L["Duration of the fireworks animation"], + disabled = function() return not NameplateSCT.db.global.enabled end, + min = 0.5, + max = 3, + step = 0.5, + get = function() return NameplateSCT.db.global.animations.fireworksDuration end, + set = function(_, newValue) NameplateSCT.db.global.animations.fireworksDuration = newValue end, + order = 1.4, + width = "normal", + }, + fireworksSpacer = { + type = 'description', + name = "", + order = 1.5, + width = "full", + }, ability = { type = 'select', name = L["Abilities"],