From 03a7e8c7f8f12ff7132fbac01fd8db2f3329342f Mon Sep 17 00:00:00 2001 From: D4KiR <23246564+d4kir92@users.noreply.github.com> Date: Thu, 4 Jul 2024 07:53:17 +0200 Subject: [PATCH] v0.9.81 --- ImproveAny.toc | 2 +- ImproveAny_Cata.toc | 2 +- ImproveAny_TBC.toc | 2 +- ImproveAny_Vanilla.toc | 2 +- ImproveAny_Wrath.toc | 2 +- libs/D4Lib/D4Frames.lua | 35 ++++++++++++++++++++++++++++++----- libs/D4Lib/D4Lib.lua | 17 ++++++++++++++++- libs/D4Lib/D4Translations.lua | 4 ++-- settings.lua | 4 ++-- 9 files changed, 55 insertions(+), 15 deletions(-) diff --git a/ImproveAny.toc b/ImproveAny.toc index 497b17f..463874a 100644 --- a/ImproveAny.toc +++ b/ImproveAny.toc @@ -4,7 +4,7 @@ ## Interface-Cata: 40400 ## Interface: 100207, 110000 -## Version: 0.9.80 +## Version: 0.9.81 ## Title: ImproveAny by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/ImproveAny_Cata.toc b/ImproveAny_Cata.toc index 980d590..2c17460 100644 --- a/ImproveAny_Cata.toc +++ b/ImproveAny_Cata.toc @@ -1,5 +1,5 @@ ## Interface: 40400 -## Version: 0.9.80 +## Version: 0.9.81 ## Title: ImproveAny |T136033:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/ImproveAny_TBC.toc b/ImproveAny_TBC.toc index f4411a3..f7f2238 100644 --- a/ImproveAny_TBC.toc +++ b/ImproveAny_TBC.toc @@ -1,5 +1,5 @@ ## Interface: 20504 -## Version: 0.9.80 +## Version: 0.9.81 ## Title: ImproveAny |T136033:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/ImproveAny_Vanilla.toc b/ImproveAny_Vanilla.toc index f271d6f..a199a00 100644 --- a/ImproveAny_Vanilla.toc +++ b/ImproveAny_Vanilla.toc @@ -1,5 +1,5 @@ ## Interface: 11502 -## Version: 0.9.80 +## Version: 0.9.81 ## Title: ImproveAny |T136033:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/ImproveAny_Wrath.toc b/ImproveAny_Wrath.toc index 514dedf..1fd5456 100644 --- a/ImproveAny_Wrath.toc +++ b/ImproveAny_Wrath.toc @@ -1,5 +1,5 @@ ## Interface: 30403 -## Version: 0.9.80 +## Version: 0.9.81 ## Title: ImproveAny |T136033:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/libs/D4Lib/D4Frames.lua b/libs/D4Lib/D4Frames.lua index 36d6d1c..52fc2e7 100644 --- a/libs/D4Lib/D4Frames.lua +++ b/libs/D4Lib/D4Frames.lua @@ -83,11 +83,21 @@ function D4:CreateEditBox(tab) end function D4:CreateSlider(tab) + if tab.key == nil then + D4:MSG("[D4][CreateSlider] Missing format string:", tab.key, tab.value) + + return + elseif tab.value == nil then + D4:MSG("[D4][CreateSlider] Missing value:", tab.key, tab.value) + + return + end + tab.sw = tab.sw or 200 tab.sh = tab.sh or 25 tab.parent = tab.parent or UIParent tab.pTab = tab.pTab or "CENTER" - tab.value = tab.value or nil + tab.value = tab.value or 1 tab.vmin = tab.vmin or 1 tab.vmax = tab.vmax or 1 tab.steps = tab.steps or 1 @@ -99,16 +109,17 @@ function D4:CreateSlider(tab) slider.Low:SetText(tab.vmin) slider.High:SetText(tab.vmax) local struct = D4:Trans(tab.key) - if struct then + if struct and tab.value then slider.Text:SetText(string.format(struct, tab.value)) - else - D4:MSG("[D4] missing format string:", tab.key) end slider:SetMinMaxValues(tab.vmin, tab.vmax) slider:SetObeyStepOnDrag(true) slider:SetValueStep(tab.steps) - slider:SetValue(tab.value) + if tab.value then + slider:SetValue(tab.value) + end + slider:SetScript( "OnValueChanged", function(sel, val) @@ -250,6 +261,20 @@ end function D4:AppendSlider(key, value, min, max, steps, decimals, func, lstr) Y = Y - 15 + if key == nil then + D4:MSG("[D4][AppendSlider] Missing key:", tab.key, tab.value) + + return + elseif value == nil then + D4:MSG("[D4][AppendSlider] Missing value:", tab.key, tab.value) + + return + end + + if TAB[key] == nil then + TAB[key] = value + end + local slider = {} slider.key = key slider.parent = PARENT diff --git a/libs/D4Lib/D4Lib.lua b/libs/D4Lib/D4Lib.lua index ff08d36..52daf0f 100644 --- a/libs/D4Lib/D4Lib.lua +++ b/libs/D4Lib/D4Lib.lua @@ -97,13 +97,28 @@ end function D4:GetSpellInfo(spellID) if spellID == nil then return nil end - if C_Spell and C_Spell.GetSpellInfo then return C_Spell.GetSpellInfo(spellID) end if GetSpellInfo then return GetSpellInfo(spellID) end + if C_Spell and C_Spell.GetSpellInfo then + local tab = C_Spell.GetSpellInfo(spellID) + if tab then return tab.name, tab.rank, tab.iconID, tab.castTime, tab.minRange, tab.maxRange, tab.spellID end + + return tab + end + D4:MSG("[D4][GetSpellInfo] FAILED") return nil end +function D4:IsSpellInRange(spellID, spellType, unit) + if spellID == nil then return nil end + if IsSpellInRange then return IsSpellInRange(spellID, spellType, unit) end + if C_Spell and C_Spell.IsSpellInRange then return C_Spell.IsSpellInRange(spellID, spellType, unit) end + D4:MSG("[D4][IsSpellInRange] FAILED") + + return nil +end + function D4:GetMouseFocus() if GetMouseFoci then return GetMouseFoci() end if GetMouseFocus then return GetMouseFocus() end diff --git a/libs/D4Lib/D4Translations.lua b/libs/D4Lib/D4Translations.lua index 9ff606a..78e7a1a 100644 --- a/libs/D4Lib/D4Translations.lua +++ b/libs/D4Lib/D4Translations.lua @@ -39,13 +39,13 @@ function D4:AddTrans(lang, key, value) end if key == nil then - D4:MSG("[D4:AddTrans] key is nil") + D4:MSG("[D4][AddTrans] key is nil") return false end if value == nil then - D4:MSG("[D4:AddTrans] value is nil") + D4:MSG("[D4][AddTrans] value is nil") return false end diff --git a/settings.lua b/settings.lua index a26cdfa..1d675d7 100644 --- a/settings.lua +++ b/settings.lua @@ -420,8 +420,8 @@ function ImproveAny:InitIASettings() IASettings:Hide() end - ImproveAny:SetVersion(AddonName, 136033, "0.9.80") - IASettings.TitleText:SetText(format("ImproveAny |T136033:16:16:0:0|t v|cff3FC7EB%s", "0.9.80")) + ImproveAny:SetVersion(AddonName, 136033, "0.9.81") + IASettings.TitleText:SetText(format("ImproveAny |T136033:16:16:0:0|t v|cff3FC7EB%s", "0.9.81")) IASettings.CloseButton:SetScript( "OnClick", function()