diff --git a/Libs/DF/cooltip.lua b/Libs/DF/cooltip.lua index c38007f0..a2301656 100644 --- a/Libs/DF/cooltip.lua +++ b/Libs/DF/cooltip.lua @@ -1267,6 +1267,19 @@ function DF:CreateCoolTip() if (height > frame.hHeight) then frame.hHeight = height end + + --override the text width if this line has a custom width + if (type(leftTextSettings[9]) == "number") then + menuButton.leftText:SetWidth(leftTextSettings[9]) + --print("width", leftTextSettings[9]) + --/dump GameCooltipSecButton2_StatusBar_LeftText:GetSize() + end + + --override the text height if this line has a custom height + if (type(leftTextSettings[10]) == "number") then + menuButton.leftText:SetHeight(leftTextSettings[10]) + --print("height", leftTextSettings[10]) + end end function gameCooltip:RefreshSpark(menuButton) @@ -1844,6 +1857,81 @@ function DF:CreateCoolTip() end end + function gameCooltip:SetSpellByID(spellId, bShowDescriptionOnly) --~spell + if (type(spellId) == "number") then + spellId = C_SpellBook.GetOverrideSpell(spellId) + local spellName, spellRank, spellIcon, castTime, minRange, maxRange = GetSpellInfo(spellId) + if (spellName) then + local spellDescription = GetSpellDescription(spellId) + local cooldownTime, globalCooldown = GetSpellBaseCooldown(spellId) + --local cooldown = cooldownTime / 1000 + local bIsPassive = IsPassiveSpell(spellId, "player") + local chargesAvailable, maxCharges, chargeCooldownStart, rechargeTime, chargeModRate = GetSpellCharges(spellId) + local tResourceCost = GetSpellPowerCost(spellId) + + --[=[ + hasRequiredAura=false, + type=0, + name="MANA", + cost=7000, + minCost=7000, + requiredAuraID=0, + costPercent=3, + costPerSec=0 + } + --]=] + + gameCooltip:Preset(2) + gameCooltip:SetOption("FixedWidth", 250) + + gameCooltip:AddLine(spellName, nil, 1, 1, 1, 1, nil, 12) + gameCooltip:AddIcon(spellIcon, 1, 1, 20, 20, .1, .9, .1, .9) + + if (not bShowDescriptionOnly) then + if (tResourceCost.cost and tResourceCost.cost > 0) then + if (maxRange and maxRange > 0) then + gameCooltip:AddLine(tResourceCost.cost .. " " .. (_G[tResourceCost.name] or tResourceCost.name), string.format(_G.SPELL_RANGE, math.floor(maxRange)), 1, 1, 1, 1, nil, 12) + else + gameCooltip:AddLine(tResourceCost.cost .. " " .. (_G[tResourceCost.name] or tResourceCost.name), nil, 1, 1, 1, 1, nil, 12) + end + else + if (maxRange and maxRange > 0) then + gameCooltip:AddLine(string.format(_G.SPELL_RANGE, math.floor(maxRange)), nil, 1, 1, 1, 1, nil, 12) + end + end + + --SPELL_CAST_CHANNELED + + if (castTime and castTime > 0) then + castTime = castTime / 1000 + --recharge or cooldown time + if (cooldownTime and cooldownTime > 0) then + gameCooltip:AddLine(string.format(_G.SPELL_CAST_TIME_SEC, castTime), string.format(_G.SPELL_RECAST_TIME_SEC, cooldownTime), 1, 1, 1, 1, nil, 12) + elseif (rechargeTime and rechargeTime > 0) then + gameCooltip:AddLine(string.format(_G.SPELL_CAST_TIME_SEC, castTime), string.format(_G.SPELL_RECAST_TIME_CHARGES_SEC, rechargeTime), 1, 1, 1, 1, nil, 12) + else + gameCooltip:AddLine(string.format(_G.SPELL_CAST_TIME_SEC, castTime), nil, 1, 1, 1, 1, nil, 12) + end + + elseif (castTime == 0) then --spell is instant (has no cast time) + if (cooldownTime and cooldownTime > 0) then + gameCooltip:AddLine(_G.SPELL_CAST_TIME_INSTANT, string.format(_G.SPELL_RECAST_TIME_SEC, cooldownTime/1000), 1, 1, 1, 1, nil, 12) + elseif (rechargeTime and rechargeTime > 0) then + gameCooltip:AddLine(_G.SPELL_CAST_TIME_INSTANT, string.format(_G.SPELL_RECAST_TIME_CHARGES_SEC, rechargeTime), 1, 1, 1, 1, nil, 12) + else + gameCooltip:AddLine(_G.SPELL_CAST_TIME_INSTANT, nil, 1, 1, 1, 1, nil, 12) + end + end + end + + gameCooltip:AddLine(spellDescription, nil, 1, 1, 1, 1, nil, 12) + + --mana range + --instant cooldown + end + end + end + --~inicio ~start ~tooltip function gameCooltip:BuildTooltip() --~refresh --hide select bar @@ -3134,13 +3222,13 @@ function DF:CreateCoolTip() --adds a line. --only works with cooltip type1 and 2 (tooltip and tooltip with bars) --parameters: left text, right text[, L color R, L color G, L color B, L color A[, R color R, R color G, R color B, R color A[, wrap]]] - function gameCooltip:AddDoubleLine (leftText, rightText, menuType, ColorR1, ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag) - return gameCooltip:AddLine(leftText, rightText, menuType, ColorR1, ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag) + function gameCooltip:AddDoubleLine (leftText, rightText, menuType, ColorR1, ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag, textWidth, textHeight) --ãddline ~addline + return gameCooltip:AddLine(leftText, rightText, menuType, ColorR1, ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag, textWidth, textHeight) end --adds a line for tooltips --AddLine creates a new line on the tooltip - function gameCooltip:AddLine(leftText, rightText, menuType, ColorR1, ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag) + function gameCooltip:AddLine(leftText, rightText, menuType, ColorR1, ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag, textWidth, textHeight) --check data integrity local leftTextType = type(leftText) if (leftTextType ~= "string") then @@ -3161,7 +3249,7 @@ function DF:CreateCoolTip() end if (type(ColorR1) ~= "number") then - ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag = ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2 + ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag, textWidth, textHeight = ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace if (type(ColorR1) == "boolean" or not ColorR1) then ColorR1, ColorG1, ColorB1, ColorA1 = 0, 0, 0, 0 else @@ -3170,7 +3258,7 @@ function DF:CreateCoolTip() end if (type(ColorR2) ~= "number") then - fontSize, fontFace, fontFlag = ColorG2, ColorB2, ColorA2 + fontSize, fontFace, fontFlag, textWidth, textHeight = ColorG2, ColorB2, ColorA2, fontSize, fontFace if (type(ColorR2) == "boolean" or not ColorR2) then ColorR2, ColorG2, ColorB2, ColorA2 = 0, 0, 0, 0 else @@ -3269,6 +3357,8 @@ function DF:CreateCoolTip() lineTable_Left[6] = fontSize lineTable_Left[7] = fontFace lineTable_Left[8] = fontFlag + lineTable_Left[9] = textWidth + lineTable_Left[10] = textHeight lineTable_Right[1] = rightText lineTable_Right[2] = ColorR2 @@ -3278,6 +3368,8 @@ function DF:CreateCoolTip() lineTable_Right[6] = fontSize lineTable_Right[7] = fontFace lineTable_Right[8] = fontFlag + lineTable_Right[9] = textWidth + lineTable_Right[10] = textHeight end function gameCooltip:AddSpecial(widgetType, index, subIndex, ...) diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 1a2fb6be..de1b4566 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 496 +local dversion = 497 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -523,6 +523,21 @@ function DF.table.find(t, value) end end +---find a value inside a sub table +---@param index number +---@param value any +---@return integer|nil +function DF.table.findsubtable(t, index, value) + for i = 1, #t do + if (type(t[i]) == "table") then + if (t[i][index] == value) then + return i + end + end + end +end + + function DF:GetParentKeyPath(object) local parentKey = object:GetParentKey() if (not parentKey) then diff --git a/Libs/LibOpenRaid/LibOpenRaid.lua b/Libs/LibOpenRaid/LibOpenRaid.lua index 09bd3558..e76eddfb 100644 --- a/Libs/LibOpenRaid/LibOpenRaid.lua +++ b/Libs/LibOpenRaid/LibOpenRaid.lua @@ -43,7 +43,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not isExpansion_Dragonflight()) t end local major = "LibOpenRaid-1.0" -local CONST_LIB_VERSION = 118 +local CONST_LIB_VERSION = 119 if (LIB_OPEN_RAID_MAX_VERSION) then if (CONST_LIB_VERSION <= LIB_OPEN_RAID_MAX_VERSION) then @@ -563,8 +563,8 @@ end ["sendPvPTalent_Schedule"] = 14, ["leaveCombat_Schedule"] = 18, ["encounterEndCooldownsCheck_Schedule"] = 24, - ["sendKeystoneInfoToParty_Schedule"] = 7, - ["sendKeystoneInfoToGuild_Schedule"] = 7, + ["sendKeystoneInfoToParty_Schedule"] = 2, + ["sendKeystoneInfoToGuild_Schedule"] = 2, } openRaidLib.Schedules = { diff --git a/boot.lua b/boot.lua index 610cd20c..37a3cb00 100644 --- a/boot.lua +++ b/boot.lua @@ -13,8 +13,8 @@ local addonName, Details222 = ... local version, build, date, tocversion = GetBuildInfo() - Details.build_counter = 12190 - Details.alpha_build_counter = 12190 --if this is higher than the regular counter, use it instead + Details.build_counter = 12197 + Details.alpha_build_counter = 12197 --if this is higher than the regular counter, use it instead Details.dont_open_news = true Details.game_version = version Details.userversion = version .. " " .. Details.build_counter diff --git a/functions/boss.lua b/functions/boss.lua index 1e11b85a..dfd2eb07 100644 --- a/functions/boss.lua +++ b/functions/boss.lua @@ -197,7 +197,8 @@ do ---@type details_encounterinfo local encounterInfo = Details:GetEncounterInfo(encounterName) if (not encounterInfo) then - Details:Msg("did not find encounter info for: " .. (encounterName or "no-name") .. ".") + --Details:Msg("did not find encounter info for: " .. (encounterName or "no-name") .. ".") + --print(debugstack()) return "", 32, 20, 0, 1, 0, 1 end return encounterInfo.creatureIcon, 32, 20, 0, 1, 0, 0.9