|
@@ -0,0 +1,429 @@
|
|
|
+diff -ruN /tmp/tmpko_jq3r7/DBM-Core/DBM-BossHealth.lua ./AddOns/DBM-Core/DBM-BossHealth.lua
|
|
|
+--- /tmp/tmpko_jq3r7/DBM-Core/DBM-BossHealth.lua 1970-01-01 01:00:00.000000000 +0100
|
|
|
++++ ./AddOns/DBM-Core/DBM-BossHealth.lua 2022-10-23 19:11:05.902083115 +0200
|
|
|
+@@ -0,0 +1,287 @@
|
|
|
++---------------
|
|
|
++-- Globals --
|
|
|
++---------------
|
|
|
++DBM.BossHealth = {}
|
|
|
++
|
|
|
++
|
|
|
++-------------
|
|
|
++-- Locals --
|
|
|
++-------------
|
|
|
++local bossHealth = DBM.BossHealth
|
|
|
++local bars = {}
|
|
|
++local barCache = {}
|
|
|
++local updateFrame
|
|
|
++local getBarId
|
|
|
++local updateBar
|
|
|
++local anchor
|
|
|
++local header
|
|
|
++local dropdownFrame
|
|
|
++--local sortingEnabled
|
|
|
++
|
|
|
++do
|
|
|
++ local id = 0
|
|
|
++ function getBarId()
|
|
|
++ id = id + 1
|
|
|
++ return id
|
|
|
++ end
|
|
|
++end
|
|
|
++
|
|
|
++------------
|
|
|
++-- Menu --
|
|
|
++------------
|
|
|
++local menu
|
|
|
++menu = {
|
|
|
++ {
|
|
|
++ text = DBM_CORE_RANGECHECK_LOCK,
|
|
|
++ checked = false, -- requires DBM.Options which is not available yet
|
|
|
++ func = function()
|
|
|
++ menu[1].checked = not menu[1].checked
|
|
|
++ DBM.Options.HealthFrameLocked = menu[1].checked
|
|
|
++ end
|
|
|
++ },
|
|
|
++ {
|
|
|
++ text = DBM_CORE_BOSSHEALTH_HIDE_FRAME,
|
|
|
++ notCheckable = true,
|
|
|
++ func = function() bossHealth:Hide() end
|
|
|
++ }
|
|
|
++}
|
|
|
++
|
|
|
++
|
|
|
++-----------------------
|
|
|
++-- Script Handlers --
|
|
|
++-----------------------
|
|
|
++local function onMouseDown(self, button)
|
|
|
++ if button == "LeftButton" and not DBM.Options.HealthFrameLocked then
|
|
|
++ anchor.moving = true
|
|
|
++ anchor:StartMoving()
|
|
|
++ end
|
|
|
++end
|
|
|
++
|
|
|
++local function onMouseUp(self, button)
|
|
|
++ anchor.moving = nil
|
|
|
++ anchor:StopMovingOrSizing()
|
|
|
++ local point, _, _, x, y = anchor:GetPoint(1)
|
|
|
++ DBM.Options.HPFramePoint = point
|
|
|
++ DBM.Options.HPFrameX = x
|
|
|
++ DBM.Options.HPFrameY = y
|
|
|
++ if button == "RightButton" then
|
|
|
++ EasyMenu(menu, dropdownFrame, "cursor", nil, nil, "MENU")
|
|
|
++ end
|
|
|
++end
|
|
|
++
|
|
|
++local onHide = onMouseUp
|
|
|
++
|
|
|
++
|
|
|
++-----------------
|
|
|
++-- Apply Style --
|
|
|
++-----------------
|
|
|
++local function updateBarStyle(bar, id)
|
|
|
++ bar:ClearAllPoints()
|
|
|
++ if DBM.Options.HealthFrameGrowUp then
|
|
|
++ bar:SetPoint("BOTTOM", bars[id - 1] or anchor, "TOP", 0, 0)
|
|
|
++ else
|
|
|
++ bar:SetPoint("TOP", bars[id - 1] or anchor, "BOTTOM", 0, 0)
|
|
|
++ end
|
|
|
++ local barborder = _G[bar:GetName().."BarBorder"]
|
|
|
++ local barbar = _G[bar:GetName().."Bar"]
|
|
|
++ local width = DBM.Options.HealthFrameWidth
|
|
|
++ if width < 175 then -- these health frames really suck :(
|
|
|
++ barbar:ClearAllPoints()
|
|
|
++ barbar:SetPoint("CENTER", barbar:GetParent(), "CENTER", -6, 0)
|
|
|
++ bar:SetWidth(DBM.Options.HealthFrameWidth)
|
|
|
++ barborder:SetWidth(DBM.Options.HealthFrameWidth * 0.99)
|
|
|
++ barbar:SetWidth(DBM.Options.HealthFrameWidth * 0.95)
|
|
|
++ elseif width >= 225 then
|
|
|
++ barbar:ClearAllPoints()
|
|
|
++ barbar:SetPoint("CENTER", barbar:GetParent(), "CENTER", 5, 0)
|
|
|
++ bar:SetWidth(DBM.Options.HealthFrameWidth)
|
|
|
++ barborder:SetWidth(DBM.Options.HealthFrameWidth * 0.995)
|
|
|
++ barbar:SetWidth(DBM.Options.HealthFrameWidth * 0.965)
|
|
|
++ else
|
|
|
++ bar:SetWidth(DBM.Options.HealthFrameWidth)
|
|
|
++ barborder:SetWidth(DBM.Options.HealthFrameWidth * 0.99)
|
|
|
++ barbar:SetWidth(DBM.Options.HealthFrameWidth * 0.95)
|
|
|
++ end
|
|
|
++end
|
|
|
++
|
|
|
++-----------------------
|
|
|
++-- Create the Frame --
|
|
|
++-----------------------
|
|
|
++local function createFrame(self)
|
|
|
++ anchor = CreateFrame("Frame", nil, UIParent)
|
|
|
++ anchor:SetWidth(60)
|
|
|
++ anchor:SetHeight(10)
|
|
|
++ anchor:SetMovable(1)
|
|
|
++ anchor:EnableMouse(1)
|
|
|
++ anchor:SetPoint(DBM.Options.HPFramePoint, UIParent, DBM.Options.HPFramePoint, DBM.Options.HPFrameX, DBM.Options.HPFrameY)
|
|
|
++ header = anchor:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
|
|
|
++ header:SetPoint("BOTTOM", anchor, "BOTTOM")
|
|
|
++ anchor:SetScript("OnUpdate", updateFrame)
|
|
|
++ anchor:SetScript("OnMouseDown", onMouseDown)
|
|
|
++ anchor:SetScript("OnMouseUp", onMouseUp)
|
|
|
++ anchor:SetScript("OnHide", onHide)
|
|
|
++ dropdownFrame = CreateFrame("Frame", "DBMBossHealthDropdown", anchor, "UIDropDownMenuTemplate")
|
|
|
++ menu[1].checked = DBM.Options.HealthFrameLocked
|
|
|
++end
|
|
|
++
|
|
|
++local function createBar(self, cId, name)
|
|
|
++ local bar = table.remove(barCache, #barCache) or CreateFrame("Frame", "DBM_BossHealth_Bar_"..getBarId(), anchor, "DBMBossHealthBarTemplate")
|
|
|
++ bar:Show()
|
|
|
++ local bartext = _G[bar:GetName().."BarName"]
|
|
|
++ local barborder = _G[bar:GetName().."BarBorder"]
|
|
|
++ local barbar = _G[bar:GetName().."Bar"]
|
|
|
++ barborder:SetScript("OnMouseDown", onMouseDown)
|
|
|
++ barborder:SetScript("OnMouseUp", onMouseUp)
|
|
|
++ barborder:SetScript("OnHide", onHide)
|
|
|
++ bar.id = cId
|
|
|
++ bar.hidden = false
|
|
|
++ bar:ClearAllPoints()
|
|
|
++ bartext:SetText(name)
|
|
|
++ updateBar(bar, 100)
|
|
|
++ return bar
|
|
|
++end
|
|
|
++
|
|
|
++
|
|
|
++
|
|
|
++------------------
|
|
|
++-- Bar Update --
|
|
|
++------------------
|
|
|
++function updateBar(bar, percent, dontShowDead)
|
|
|
++ local bartimer = _G[bar:GetName().."BarTimer"]
|
|
|
++ local barbar = _G[bar:GetName().."Bar"]
|
|
|
++ bartimer:SetText((percent > 0 or dontShowDead) and math.floor(percent).."%" or DBM_CORE_DEAD)
|
|
|
++ barbar:SetValue(percent)
|
|
|
++ barbar:SetStatusBarColor((100 - percent) / 100, percent/100, 0)
|
|
|
++ bar.value = percent
|
|
|
++ local bossAlive = false
|
|
|
++ for i = 1, #bars do
|
|
|
++ if bars[i].value > 0 then
|
|
|
++ bossAlive = true
|
|
|
++ break
|
|
|
++ end
|
|
|
++ end
|
|
|
++ if not bossAlive and #bars > 0 then
|
|
|
++ bossHealth:Hide()
|
|
|
++ end
|
|
|
++end
|
|
|
++
|
|
|
++do
|
|
|
++ local t = 0
|
|
|
++ local targetCache = {}
|
|
|
++
|
|
|
++ local function getCIDfromGUID(guid)
|
|
|
++ local guidType, _, playerdbID, _, _, cid, _ = strsplit("-", guid or "")
|
|
|
++ if guidType and (guidType == "Creature" or guidType == "Vehicle" or guidType == "Pet") then
|
|
|
++ return tonumber(cid)
|
|
|
++ elseif type and (guidType == "Player" or guidType == "Item") then
|
|
|
++ return tonumber(playerdbID)
|
|
|
++ end
|
|
|
++ return 0
|
|
|
++ end
|
|
|
++
|
|
|
++-- local function compareBars(b1, b2)
|
|
|
++-- return b1.value > b2.value
|
|
|
++-- end
|
|
|
++
|
|
|
++ function updateFrame(self, e)
|
|
|
++ t = t + e
|
|
|
++ if t >= 0.5 then
|
|
|
++ t = 0
|
|
|
++-- if #bars > DBM.Options.HPFrameMaxEntries then
|
|
|
++-- sortingEnabled = true
|
|
|
++-- end
|
|
|
++-- if sortingEnabled then
|
|
|
++-- table.sort(bars, compareBars)
|
|
|
++-- end
|
|
|
++ for i, v in ipairs(bars) do
|
|
|
++-- if i > DBM.Options.HPFrameMaxEntries then
|
|
|
++-- v:Hide()
|
|
|
++-- else
|
|
|
++-- v:Show()
|
|
|
++-- end
|
|
|
++ if type(v.id) == "number" then
|
|
|
++ local id = targetCache[v.id] -- ask the cache if we already know where the mob is
|
|
|
++ if getCIDfromGUID(UnitGUID(id or "")) ~= v.id then -- the cache doesn't know it, update the cache
|
|
|
++ targetCache[v.id] = nil
|
|
|
++ -- check focus target
|
|
|
++ if getCIDfromGUID(UnitGUID("focus")) == v.id then
|
|
|
++ targetCache[v.id] = "focus"
|
|
|
++ else
|
|
|
++ -- check target and raid/party targets
|
|
|
++ local uId = ((IsInRaid()) and "raid") or "party"
|
|
|
++ for i = 0, GetNumGroupMembers() do
|
|
|
++ id = (i == 0 and "target") or uId..i.."target"
|
|
|
++ if getCIDfromGUID(UnitGUID(id or "")) == v.id then
|
|
|
++ targetCache[v.id] = id
|
|
|
++ break
|
|
|
++ end
|
|
|
++ end
|
|
|
++ end
|
|
|
++ end
|
|
|
++ if getCIDfromGUID(UnitGUID(id or "")) == v.id then -- did we find the mob? if yes: update the health bar
|
|
|
++ updateBar(v, ((UnitHealth(id)) / (UnitHealthMax(id)) * 100 or 100))
|
|
|
++ end
|
|
|
++ elseif type(v.id) == "function" then -- generic bars
|
|
|
++ updateBar(v, v.id(), true)
|
|
|
++ end
|
|
|
++ end
|
|
|
++ end
|
|
|
++ end
|
|
|
++end
|
|
|
++
|
|
|
++-----------------------
|
|
|
++-- General Methods --
|
|
|
++-----------------------
|
|
|
++function bossHealth:Show(name)
|
|
|
++ if not anchor then createFrame(bossHealth) end
|
|
|
++ header:SetText(name)
|
|
|
++ anchor:Show()
|
|
|
++ bossHealth:Clear()
|
|
|
++end
|
|
|
++
|
|
|
++function bossHealth:Clear()
|
|
|
++ if not anchor or not anchor:IsShown() then return end
|
|
|
++ for i = #bars, 1, -1 do
|
|
|
++ local bar = bars[i]
|
|
|
++ bar:Hide()
|
|
|
++ bar:ClearAllPoints()
|
|
|
++ barCache[#barCache + 1] = bar
|
|
|
++ bars[i] = nil
|
|
|
++ end
|
|
|
++-- sortingEnabled = false
|
|
|
++end
|
|
|
++
|
|
|
++function bossHealth:Hide()
|
|
|
++ if anchor then anchor:Hide() end
|
|
|
++end
|
|
|
++
|
|
|
++function bossHealth:AddBoss(cId, name)
|
|
|
++ if not anchor or not anchor:IsShown() then return end
|
|
|
++ table.insert(bars, createBar(self, cId, name))
|
|
|
++ updateBarStyle(bars[#bars], #bars)
|
|
|
++end
|
|
|
++
|
|
|
++function bossHealth:RemoveBoss(cId)
|
|
|
++ if not anchor or not anchor:IsShown() then return end
|
|
|
++ for i = #bars, 1, -1 do
|
|
|
++ local bar = bars[i]
|
|
|
++ if bar.id == cId then
|
|
|
++ if bars[i + 1] then
|
|
|
++ local next = bars[i + 1]
|
|
|
++ next:SetPoint("TOP", bars[i - 1] or anchor, "BOTTOM", 0, 0)
|
|
|
++ end
|
|
|
++ bar:Hide()
|
|
|
++ bar:ClearAllPoints()
|
|
|
++ barCache[#barCache + 1] = bar
|
|
|
++ table.remove(bars, i)
|
|
|
++ end
|
|
|
++ end
|
|
|
++end
|
|
|
++
|
|
|
++function bossHealth:UpdateSettings()
|
|
|
++ if not anchor then createFrame(bossHealth) end
|
|
|
++ anchor:SetPoint(DBM.Options.HPFramePoint, UIParent, DBM.Options.HPFramePoint, DBM.Options.HPFrameX, DBM.Options.HPFrameY)
|
|
|
++ for i, v in ipairs(bars) do
|
|
|
++ updateBarStyle(v, i)
|
|
|
++ end
|
|
|
++end
|
|
|
+diff -ruN /tmp/tmpko_jq3r7/DBM-Core/DBM-BossHealth.xml ./AddOns/DBM-Core/DBM-BossHealth.xml
|
|
|
+--- /tmp/tmpko_jq3r7/DBM-Core/DBM-BossHealth.xml 1970-01-01 01:00:00.000000000 +0100
|
|
|
++++ ./AddOns/DBM-Core/DBM-BossHealth.xml 2022-10-23 12:32:08.208657820 +0200
|
|
|
+@@ -0,0 +1,71 @@
|
|
|
++<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
|
|
++..\FrameXML\UI.xsd">
|
|
|
++ <Frame name="DBMBossHealthBarTemplate" enableMouse="true" virtual="true" frameStrata="MEDIUM" topLevel="true">
|
|
|
++ <Size>
|
|
|
++ <AbsDimension x="200" y="20"/>
|
|
|
++ </Size>
|
|
|
++ <Frames>
|
|
|
++ <StatusBar name="$parentBar">
|
|
|
++ <Size>
|
|
|
++ <AbsDimension x="190" y="12"/>
|
|
|
++ </Size>
|
|
|
++ <Anchors>
|
|
|
++ <Anchor point="CENTER" relativePoint="CENTER">
|
|
|
++ <Offset>
|
|
|
++ <AbsDimension x="2" y="0"/>
|
|
|
++ </Offset>
|
|
|
++ </Anchor>
|
|
|
++ </Anchors>
|
|
|
++ <Layers>
|
|
|
++ <Layer level="BACKGROUND">
|
|
|
++ <Texture name="$parentBackground">
|
|
|
++ <Color r="0" g="0" b="0" a="0.3"/>
|
|
|
++ </Texture>
|
|
|
++ </Layer>
|
|
|
++ <Layer level="OVERLAY">
|
|
|
++ <FontString name="$parentName" inherits="GameFontHighlightSmall" text="">
|
|
|
++ <Anchors>
|
|
|
++ <Anchor point="LEFT" relativePoint="LEFT">
|
|
|
++ <Offset>
|
|
|
++ <AbsDimension x="2" y="1"/>
|
|
|
++ </Offset>
|
|
|
++ </Anchor>
|
|
|
++ </Anchors>
|
|
|
++ </FontString>
|
|
|
++ <FontString name="$parentTimer" inherits="GameFontHighlightSmall" text="">
|
|
|
++ <Anchors>
|
|
|
++ <Anchor point="RIGHT" relativePoint="RIGHT">
|
|
|
++ <Offset>
|
|
|
++ <AbsDimension x="-2" y="1"/>
|
|
|
++ </Offset>
|
|
|
++ </Anchor>
|
|
|
++ </Anchors>
|
|
|
++ </FontString>
|
|
|
++ </Layer>
|
|
|
++ </Layers>
|
|
|
++ <Frames>
|
|
|
++ <Button name="$parentBorder">
|
|
|
++ <Size>
|
|
|
++ <AbsDimension x="198" y="32"/>
|
|
|
++ </Size>
|
|
|
++ <Anchors>
|
|
|
++ <Anchor point="LEFT">
|
|
|
++ <Offset>
|
|
|
++ <AbsDimension x="-4" y="0"/>
|
|
|
++ </Offset>
|
|
|
++ </Anchor>
|
|
|
++ </Anchors>
|
|
|
++ <NormalTexture name="$parentTextureNormal" file="Interface\PaperDollInfoFrame\UI-Character-Skills-BarBorder"/>
|
|
|
++ </Button>
|
|
|
++ </Frames>
|
|
|
++ <BarTexture name="$parentTextureBar" file="Interface\PaperDollInfoFrame\UI-Character-Skills-Bar"/>
|
|
|
++ <BarColor r="1.0" g="0.7" b="0.0"/>
|
|
|
++ <Scripts>
|
|
|
++ <OnLoad>
|
|
|
++ self:SetMinMaxValues(0, 100)
|
|
|
++ </OnLoad>
|
|
|
++ </Scripts>
|
|
|
++ </StatusBar>
|
|
|
++ </Frames>
|
|
|
++ </Frame>
|
|
|
++</Ui>
|
|
|
+diff -ruN /tmp/tmpko_jq3r7/DBM-Core/DBM-Core.lua ./AddOns/DBM-Core/DBM-Core.lua
|
|
|
+--- /tmp/tmpko_jq3r7/DBM-Core/DBM-Core.lua 2022-10-23 21:39:59.728572004 +0200
|
|
|
++++ ./AddOns/DBM-Core/DBM-Core.lua 2022-10-23 13:24:33.675244610 +0200
|
|
|
+@@ -370,6 +370,16 @@
|
|
|
+ ChatFrame = "DEFAULT_CHAT_FRAME",
|
|
|
+ CoreSavedRevision = 1,
|
|
|
+ SilentMode = false,
|
|
|
++ -- Custom
|
|
|
++ AlwaysShowHealthFrame = false,
|
|
|
++ HealthFrameGrowUp = false,
|
|
|
++ HealthFrameLocked = false,
|
|
|
++ HealthFrameWidth = 200,
|
|
|
++ HPFramePoint = "CENTER",
|
|
|
++ HPFrameX = -50,
|
|
|
++ HPFrameY = 50,
|
|
|
++ HPFrameMaxEntries = 5,
|
|
|
++
|
|
|
+ }
|
|
|
+
|
|
|
+ DBM.Mods = {}
|
|
|
+@@ -5020,6 +5030,19 @@
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
++
|
|
|
++ -- Custom
|
|
|
++ if (DBM.Options.AlwaysShowHealthFrame or mod.Options.HealthFrame) and mod.Options.Enabled then
|
|
|
++ DBM.BossHealth:Show(mod.localization.general.name)
|
|
|
++ if mod.bossHealthInfo then
|
|
|
++ for i = 1, #mod.bossHealthInfo, 2 do
|
|
|
++ DBM.BossHealth:AddBoss(mod.bossHealthInfo[i], mod.bossHealthInfo[i + 1])
|
|
|
++ end
|
|
|
++ else
|
|
|
++ DBM.BossHealth:AddBoss(mod.combatInfo.mob, mod.localization.general.name)
|
|
|
++ end
|
|
|
++ end
|
|
|
++
|
|
|
+ --call OnCombatStart
|
|
|
+ if mod.OnCombatStart then
|
|
|
+ local startEvent = syncedEvent or event
|
|
|
+@@ -5436,6 +5459,8 @@
|
|
|
+ self:CreatePizzaTimer(time, "", nil, nil, nil, true)--Auto Terminate infinite loop timers on combat end
|
|
|
+ self:TransitionToDungeonBGM(false, true)
|
|
|
+ self:Schedule(22, self.TransitionToDungeonBGM, self)
|
|
|
++ -- Custom
|
|
|
++ DBM.BossHealth:Hide()
|
|
|
+ --module cleanup
|
|
|
+ private:ClearModuleTasks()
|
|
|
+ end
|
|
|
+diff -ruN /tmp/tmpko_jq3r7/DBM-Core/DBM-Core.toc ./AddOns/DBM-Core/DBM-Core.toc
|
|
|
+--- /tmp/tmpko_jq3r7/DBM-Core/DBM-Core.toc 2022-10-23 21:39:59.741905320 +0200
|
|
|
++++ ./AddOns/DBM-Core/DBM-Core.toc 2022-10-23 12:32:46.308588636 +0200
|
|
|
+@@ -85,3 +85,10 @@
|
|
|
+ modules\UpdateReminder.lua
|
|
|
+
|
|
|
+ modules\objects\Localization.lua
|
|
|
++
|
|
|
++
|
|
|
++
|
|
|
++# Custom
|
|
|
++DBM-BossHealth.lua
|
|
|
++DBM-BossHealth.xml
|
|
|
++
|