Libraries update

This commit is contained in:
Tercio Jose
2023-03-19 20:06:58 -03:00
parent d0ccba9e03
commit 33b0dd0138
7 changed files with 169 additions and 64 deletions
+43 -47
View File
@@ -15,7 +15,7 @@ local max = math.max
--api locals
local PixelUtil = PixelUtil or DFPixelUtil
local version = 16
local version = 17
local CONST_MENU_TYPE_MAINMENU = "main"
local CONST_MENU_TYPE_SUBMENU = "sub"
@@ -71,19 +71,6 @@ function DF:CreateCoolTip()
gameCooltip.LanguageEditBox:ClearFocus()
gameCooltip.LanguageEditBox:SetAutoFocus(false)
function gameCooltip.CheckNeedNewFont(text)
--local file = gameCooltip.LanguageEditBox:GetFont()
--print("1", file, text)
--gameCooltip.LanguageEditBox:SetText("Цены аукциона")
--local file2 = gameCooltip.LanguageEditBox:GetFont()
--print("2", file2)
--gameCooltip.LanguageEditBox:ClearFocus()
--if (file ~= file2) then
-- gameCooltip:SetOption("TextFont", file2)
--end
end
--containers
gameCooltip.LeftTextTable = {}
gameCooltip.LeftTextTableSub = {}
@@ -172,6 +159,8 @@ function DF:CreateCoolTip()
["SparkColor"] = true,
["SparkPositionXOffset"] = true,
["SparkPositionYOffset"] = true,
["NoLanguageDetection"] = true,
}
gameCooltip.AliasList = {
@@ -602,7 +591,7 @@ function DF:CreateCoolTip()
statusbar.rightText = statusbar:CreateFontString("$parent_TextRight", "overlay", "GameFontNormal")
statusbar.rightText:SetJustifyH("RIGHT")
statusbar.rightText:SetPoint("RIGHT", statusbar.rightIcon, "LEFT", -3, 0)
DF:SetFontSize(statusbar.leftText, 10)
DF:SetFontSize(statusbar.rightText, 10)
--background status bar
self.statusbar2 = CreateFrame("StatusBar", "$Parent_StatusBarBackground", self)
@@ -940,19 +929,20 @@ function DF:CreateCoolTip()
--set text
if (leftTextSettings) then
--font settings
local languageId = DF.Language.DetectLanguageId(leftTextSettings[1])
if (languageId ~= menuButton.leftText.languageId) then
local newFont = DF.Language.GetFontForLanguageID(languageId)
DF:SetFontFace(menuButton.leftText, newFont)
menuButton.leftText.languageId = languageId
--font language detection, can perform the detection if the font haven't been set by the user (usually by the options table)
if (not gameCooltip.OptionsTable.NoLanguageDetection and not gameCooltip.OptionsTable.TextFont) then
local languageId = DF.Language.DetectLanguageId(leftTextSettings[1])
if (languageId ~= menuButton.leftText.languageId) then
local newFont = DF.Language.GetFontForLanguageID(languageId)
DF:SetFontFace(menuButton.leftText, newFont)
menuButton.leftText.languageId = languageId
local bIsLatinAlphabet = DF:IsLatinLanguage(languageId)
if (not bIsLatinAlphabet) then
menuButton.leftText.requiredFont = newFont
gameCooltip.OptionsTable.TextFont = newFont
else
menuButton.leftText.requiredFont = nil
local bIsLatinAlphabet = DF:IsLatinLanguage(languageId)
if (not bIsLatinAlphabet) then
menuButton.leftText.requiredFont = newFont
else
menuButton.leftText.requiredFont = nil
end
end
end
@@ -987,7 +977,11 @@ function DF:CreateCoolTip()
menuButton.leftText:SetHeight(0)
end
if (gameCooltip.OptionsTable.TextFont and not leftTextSettings[7]) then --font
if (menuButton.leftText.requiredFont) then --the language detector require this font to be used
local _, size, flags = menuButton.leftText:GetFont()
menuButton.leftText:SetFont(menuButton.leftText.requiredFont, size, flags)
elseif (gameCooltip.OptionsTable.TextFont and not leftTextSettings[7]) then --font
if (_G[gameCooltip.OptionsTable.TextFont]) then
menuButton.leftText:SetFontObject(_G.GameFontRed or gameCooltip.OptionsTable.TextFont)
else
@@ -995,7 +989,7 @@ function DF:CreateCoolTip()
local _, size, flags = menuButton.leftText:GetFont()
flags = leftTextSettings[8] or gameCooltip.OptionsTable.TextShadow or nil
size = leftTextSettings[6] or gameCooltip.OptionsTable.TextSize or size
menuButton.leftText:SetFont(menuButton.leftText.requiredFont or font, size, flags)
menuButton.leftText:SetFont(font, size, flags)
end
--font settings
@@ -1026,18 +1020,20 @@ function DF:CreateCoolTip()
end
if (rightTextSettings) then
local languageId = DF.Language.DetectLanguageId(rightTextSettings[1])
if (languageId ~= menuButton.rightText.languageId) then
local newFont = DF.Language.GetFontForLanguageID(languageId)
DF:SetFontFace(menuButton.rightText, newFont)
menuButton.rightText.languageId = languageId
--font language detection, can perform the detection if the font haven't been set by the user (usually by the options table)
if (not gameCooltip.OptionsTable.NoLanguageDetection and not gameCooltip.OptionsTable.TextFont) then
local languageId = DF.Language.DetectLanguageId(rightTextSettings[1])
if (languageId ~= menuButton.rightText.languageId) then
local newFont = DF.Language.GetFontForLanguageID(languageId)
DF:SetFontFace(menuButton.rightText, newFont)
menuButton.rightText.languageId = languageId
local bIsLatinAlphabet = DF:IsLatinLanguage(languageId)
if (not bIsLatinAlphabet) then
menuButton.rightText.requiredFont = newFont
gameCooltip.OptionsTable.TextFont = newFont
else
menuButton.rightText.requiredFont = nil
local bIsLatinAlphabet = DF:IsLatinLanguage(languageId)
if (not bIsLatinAlphabet) then
menuButton.rightText.requiredFont = newFont
else
menuButton.rightText.requiredFont = nil
end
end
end
@@ -1069,7 +1065,11 @@ function DF:CreateCoolTip()
menuButton.rightText:SetWidth(0)
end
if (gameCooltip.OptionsTable.TextFont and not rightTextSettings[7]) then
if (menuButton.rightText.requiredFont) then --the language detector require this font to be used
local _, size, flags = menuButton.rightText:GetFont()
menuButton.rightText:SetFont(menuButton.rightText.requiredFont, size, flags)
elseif (gameCooltip.OptionsTable.TextFont and not rightTextSettings[7]) then
if (_G[gameCooltip.OptionsTable.TextFont]) then
menuButton.rightText:SetFontObject(gameCooltip.OptionsTable.TextFont)
else
@@ -1077,7 +1077,7 @@ function DF:CreateCoolTip()
local _, fontSize, fontFlags = menuButton.rightText:GetFont()
fontFlags = rightTextSettings[8] or gameCooltip.OptionsTable.TextShadow or nil
fontSize = rightTextSettings[6] or gameCooltip.OptionsTable.TextSize or fontSize
menuButton.rightText:SetFont(menuButton.leftText.requiredFont or fontFace, fontSize, fontFlags)
menuButton.rightText:SetFont(fontFace, fontSize, fontFlags)
end
elseif (rightTextSettings[7]) then
@@ -3132,8 +3132,6 @@ function DF:CreateCoolTip()
end
end
gameCooltip.CheckNeedNewFont(leftText)
local rightTextType = type(rightText)
if (rightTextType ~= "string") then
if (rightTextType == "number") then
@@ -3143,8 +3141,6 @@ function DF:CreateCoolTip()
end
end
gameCooltip.CheckNeedNewFont(rightText)
if (type(ColorR1) ~= "number") then
ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag = ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2
if (type(ColorR1) == "boolean" or not ColorR1) then
@@ -3602,7 +3598,7 @@ function DF:CreateCoolTip()
end
gameCooltip:SetOption("StatusBarTexture", [[Interface\WorldStateFrame\WORLDSTATEFINALSCORE-HIGHLIGHT]])
self:SetOption("TextFont", DF:GetBestFontForLanguage())
--self:SetOption("TextFont", DF.Language.GetFontForLanguageID(GetLocale()))
self:SetOption("TextColor", "orange")
self:SetOption("TextSize", 11)
self:SetOption("ButtonsYMod", -4)
+44 -2
View File
@@ -1,6 +1,6 @@
local dversion = 420
local dversion = 421
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
@@ -675,6 +675,42 @@ function DF:SplitTextInLines(text)
return lines
end
DF.strings = {}
---receive an array and output a string with the values separated by commas
---if bDoCompression is true, the string will be compressed using LibDeflate
---@param t table
---@param bDoCompression boolean|nil
---@return string
function DF.strings.tabletostring(t, bDoCompression)
local newString = ""
for i = 1, #t do
newString = newString .. t[i] .. ","
end
newString = newString:sub(1, -2)
if (bDoCompression) then
local LibDeflate = LibStub:GetLibrary("LibDeflate")
if (LibDeflate) then
newString = LibDeflate:CompressDeflate(newString, {level = 9})
end
end
return newString
end
function DF.strings.stringtotable(thisString, bDoCompression)
if (bDoCompression) then
local LibDeflate = LibStub:GetLibrary("LibDeflate")
if (LibDeflate) then
thisString = LibDeflate:DecompressDeflate(thisString)
end
end
local newTable = {strsplit(",", thisString)}
return newTable
end
DF.www_icons = {
texture = "feedback_sites",
@@ -1048,7 +1084,10 @@ function DF:trim(string)
return from > #string and "" or string:match(".*%S", from)
end
--truncated revoming at a maximum of 10 character from the string
---truncate removing at a maximum of 10 character from the string
---@param fontString table
---@param maxWidth number
function DF:TruncateTextSafe(fontString, maxWidth)
local text = fontString:GetText()
local numIterations = 10
@@ -1070,6 +1109,9 @@ function DF:TruncateTextSafe(fontString, maxWidth)
fontString:SetText(text)
end
---truncate removing characters from the string until the maxWidth is reach
---@param fontString table
---@param maxWidth number
function DF:TruncateText(fontString, maxWidth)
local text = fontString:GetText()
+49 -7
View File
@@ -206,8 +206,8 @@ local languagesAvailable = {
koKR = {text = "한국어", font = [[Fonts\2002.TTF]]},
ptBR = {text = "Português (BR)", font = "Fonts\\FRIZQT__.TTF"},
ruRU = {text = "Русский", font = "Fonts\\FRIZQT___CYR.TTF"},
zhCN = {text = "简体中文", font = [[Fonts\ARKai_T.ttf]]},
zhTW = {text = "繁體中文", font = [[Fonts\blei00d.TTF]]},
zhCN = {text = "简体中文", font = [[Fonts\ARHei.ttf]]},
zhTW = {text = "繁體中文", font = [[Fonts\ARHei.ttf]]},
}
local ignoredCharacters = {}
@@ -230,6 +230,7 @@ for character in latinAlphabet:gmatch("[%z\1-\127\194-\244][\128-\191]*") do
DF.LanguageKnowledge[character] = CONST_LANGUAGEID_ENUS
end
--version 1:
---register the letters and symbols used on phrases
---@param languageId any
---@param languageTable any
@@ -238,9 +239,7 @@ local registerCharacters = function(languageId, languageTable)
for character in textString:gmatch("[%z\1-\127\194-\244][\128-\191]*") do
if (not ignoredCharacters[character]) then
if (not DF.LanguageKnowledge[character]) then
if (fontLanguageCompatibility[languageId] == 1) then
DF.LanguageKnowledge[character] = CONST_LANGUAGEID_ENUS
else
if (fontLanguageCompatibility[languageId] ~= 1) then
DF.LanguageKnowledge[character] = languageId
end
end
@@ -249,6 +248,48 @@ local registerCharacters = function(languageId, languageTable)
end
end
---receives a character and attempt to get its byte code
---@param character string
---@return string, number
local getByteCodeForCharacter = function(character)
local byteCode = ""
local amountOfBytes = 0
for symbolPiece in character:gmatch(".") do --separate each byte, can one, two or three bytes
byteCode = byteCode .. string.byte(symbolPiece)
amountOfBytes = amountOfBytes + 1
end
return byteCode, amountOfBytes
end
---receives a character and attempt to get its byte code
---@param character string
---@return string
local getQuickByteCodeForCharacter = function(character)
local byte1, byte2, byte3, byte4 = string.byte(character, 1, #character)
return (byte1 or "") .. "" .. (byte2 or "") .. "" .. (byte3 or "") .. "" .. (byte4 or "")
end
--version 2:
---register the letters and symbols used on phrases
---@param languageId any
---@param languageTable any
local registerCharacters = function(languageId, languageTable)
if (fontLanguageCompatibility[languageId] ~= 1) then
for stringId, textString in pairs(languageTable) do
for character in textString:gmatch("[%z\1-\127\194-\244][\128-\191]*") do
local byteCode, amountOfBytes = getByteCodeForCharacter(character)
--latin letters and escape sequences always use one byte per character
if (amountOfBytes >= 2) then --at least 2 bytes
if (not DF.LanguageKnowledge[byteCode]) then
DF.LanguageKnowledge[byteCode] = languageId
end
end
end
end
end
end
local functionSignature = {
["RegisterLanguage"] = "RegisterLanguage(addonID, languageID[, gameLanguageOnly])",
["SetCurrentLanguage"] = "SetCurrentLanguage(addonID, languageID)",
@@ -894,8 +935,9 @@ function DF.Language.DetectLanguageId(text)
return "enUS"
end
for letter in text:gmatch("[%z\1-\127\194-\244][\128-\191]*") do
local languageId = DF.LanguageKnowledge[letter]
for character in text:gmatch("[%z\1-\127\194-\244][\128-\191]*") do
local byteCode, amountOfBytes = getByteCodeForCharacter(character)
local languageId = DF.LanguageKnowledge[byteCode]
if (languageId) then
return languageId
end
+2 -2
View File
@@ -8279,7 +8279,7 @@ detailsFramework.CastFrameFunctions = {
--set the statusbar color
self:UpdateCastColor()
if (not self:IsShown()) then
if (not self:IsShown() and not self.Settings.NoFadeEffects) then
self:Animation_FadeIn()
end
@@ -8427,7 +8427,7 @@ detailsFramework.CastFrameFunctions = {
--set the statusbar color
self:UpdateCastColor()
if (not self:IsShown()) then
if (not self:IsShown() and not self.Settings.NoFadeEffects) then
self:Animation_FadeIn()
end
+3
View File
@@ -21,6 +21,7 @@ local CONST_COOLDOWN_TYPE_INTERRUPT = 6
local CONST_COOLDOWN_TYPE_ITEMHEAL = 10
local CONST_COOLDOWN_TYPE_ITEMPOWER = 11
local CONST_COOLDOWN_TYPE_ITEMUTIL = 12
local CONST_COOLDOWN_TYPE_CROWDCONTROL = 8
--hold spellIds and which custom caches the spell is in
--map[spellId] = map[filterName] = true
@@ -185,6 +186,7 @@ local filterStringToCooldownType = {
["itemutil"] = CONST_COOLDOWN_TYPE_ITEMUTIL,
["itemheal"] = CONST_COOLDOWN_TYPE_ITEMHEAL,
["itempower"] = CONST_COOLDOWN_TYPE_ITEMPOWER,
["crowdcontrol"] = CONST_COOLDOWN_TYPE_CROWDCONTROL,
}
local filterStringToCooldownTypeReverse = {
@@ -197,6 +199,7 @@ local filterStringToCooldownTypeReverse = {
[CONST_COOLDOWN_TYPE_ITEMUTIL] = "itemutil",
[CONST_COOLDOWN_TYPE_ITEMHEAL] = "itemheal",
[CONST_COOLDOWN_TYPE_ITEMPOWER] = "itempower",
[CONST_COOLDOWN_TYPE_CROWDCONTROL] = "crowdcontrol",
}
local removeSpellFromCustomFilterCache = function(spellId, filterName)
+16 -3
View File
@@ -64,7 +64,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not isExpansion_Dragonflight()) t
end
local major = "LibOpenRaid-1.0"
local CONST_LIB_VERSION = 96
local CONST_LIB_VERSION = 97
if (not LIB_OPEN_RAID_MAX_VERSION) then
LIB_OPEN_RAID_MAX_VERSION = CONST_LIB_VERSION
@@ -666,10 +666,23 @@ end
local eventCallbacks = openRaidLib.publicCallback.events[event]
for i = 1, #eventCallbacks do
local thisCallback = eventCallbacks[i]
local addonObject = thisCallback[1]
local thisCallback = eventCallbacks[i] --got a case where this was nil, which is kinda impossible? | event: CooldownUpdate
local addonObject = thisCallback[1] --670: attempt to index local 'thisCallback' (a nil value)
local functionName = thisCallback[2]
--[=[
eventCallbacks = {
1 = {}
}
(for index) = 2
(for limit) = 2
(for step) = 1
i = 2
thisCallback = nil
--]=]
--get the function from within the addon object
local functionToCallback = addonObject[functionName]
@@ -419,6 +419,12 @@ do
[48020] = {cooldown = 30, duration = 0, specs = {265, 266, 267}, talent = false, charges = 1, class = "WARLOCK", type = 5}, --Demonic Circle: Teleport
[386997] = {cooldown = 60, duration = 8, specs = {265}, talent = false, charges = 1, class = "WARLOCK", type = 1}, --Soul Rot
[6789] = {cooldown = 45, duration = 0, specs = {265, 266, 267}, talent = false, charges = 1, class = "WARLOCK", type = 8}, --Mortal Coil
[89808] = {cooldown = 15, duration = 0, specs = {265, 266, 267}, talent = false, charges = 1, class = "WARLOCK", type = 7, pet = 416}, --Singe Magic
[132411] = {cooldown = 15, duration = 0, specs = {265, 266, 267}, talent = false, charges = 1, class = "WARLOCK", type = 7,}, --Singe Magic (sacrifice)
[17767] = {cooldown = 120, duration = 20, specs = {265, 266, 267}, talent = false, charges = 1, class = "WARLOCK", type = 2, pet = 1860}, --Shadow Bulwark
[132413] = {cooldown = 120, duration = 20, specs = {265, 266, 267}, talent = false, charges = 1, class = "WARLOCK", type = 2,}, --Shadow Bulwark (sacrifice)
[6358] = {cooldown = 30, duration = 30, specs = {265, 266, 267}, talent = false, charges = 1, class = "WARLOCK", type = 8, pet = 184600}, --Seduction
[261589] = {cooldown = 30, duration = 30, specs = {265, 266, 267}, talent = false, charges = 1, class = "WARLOCK", type = 8}, --Seduction (Sacrifice)
--shaman
-- 262 - Elemental
@@ -537,16 +543,17 @@ do
[740] = {cooldown = 180, duration = 8, specs = {105}, talent = false, charges = 1, class = "DRUID", type = 4}, --Tranquility
[132469] = {cooldown = 30, duration = 0, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 8}, --Typhoon
[102793] = {cooldown = 60, duration = 10, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 8}, --Ursol's Vortex
[124974] = {cooldown = 90, duration = 0, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 3}, --Nature's Vigil
[124974] = {cooldown = 90, duration = 0, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 4}, --Nature's Vigil
[77761] = {cooldown = 120, duration = 8, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 5}, --Stampeding Roar
[106898] = {cooldown = 120, duration = 8, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 5}, --Stampeding Roar
[77764] = {cooldown = 120, duration = 8, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 5}, --Stampeding Roar
--[106898] = {cooldown = 120, duration = 8, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 5}, --Stampeding Roar
--[77764] = {cooldown = 120, duration = 8, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 5}, --Stampeding Roar
[5211] = {cooldown = 60, duration = 0, specs = {}, talent = false, charges = 1, class = "DRUID", type = 8}, --Mighty Bash
[22570] = {cooldown = 20, duration = 5, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 8}, --Maim
[88423] = {cooldown = 8, duration = 0, specs = {105}, talent = false, charges = 1, class = "DRUID", type = 7}, --Nature's Cure
[2782] = {cooldown = 8, duration = 0, specs = {102, 103, 104}, talent = false, charges = 1, class = "DRUID", type = 7}, --Remove Corruption
[102359] = {cooldown = 30, duration = 30, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 8}, --Mass Entanglement
[205636] = {cooldown = 60, duration = 10, specs = {102}, talent = false, charges = 1, class = "DRUID", type = 5}, --Force of Nature
[200851] = {cooldown = 60, duration = 10, specs = {104}, talent = false, charges = 1, class = "DRUID", type = 2}, --Rage of the Sleeper
--death knight
-- 252 - Unholy
@@ -831,6 +838,8 @@ do
--[251523] = 19647, --wowhead list this spell as sibling spell
--[251922] = 19647, --wowhead list this spell as sibling spell
--axe toss (warlock pet)
[119905] = 89808, -- Singe Magic (warlock Imp) cast by Command Demon
[119907] = 17767, -- Shadow Bulwark (warlock Voidwalker) cast by Command Demon
[119914] = 89766, --"Uncategorized" on wowhead
[347008] = 89766, --"Uncategorized" on wowhead
--hex (shaman)