From d36fc7bdfc90ab13479cd9e9734ac3407a2ff0cc Mon Sep 17 00:00:00 2001
From: Kkthnx <40672673+Kkthnx@users.noreply.github.com>
Date: Sat, 16 Nov 2024 16:22:40 -0500
Subject: [PATCH] Various updates and fixes. Release soon!
---
.../Config/Elements/AuraWatchList/All.lua | 13 +-
.../Config/Elements/AuraWatchList/Hunter.lua | 1 +
.../Elements/FilterLists/NameplateAuras.lua | 5 +-
KkthnxUI/Config/GUI.lua | 1 -
KkthnxUI/Config/Settings.lua | 1 -
KkthnxUI/Core/GUI.lua | 3 +-
KkthnxUI/Developer/Core.lua | 102 +++-
KkthnxUI/Libraries/LibAnim/LibAnim.lua | 6 +-
KkthnxUI/Libraries/LibDeflate/LibDeflate.lua | 563 ++++++------------
.../LibRangeCheck-3.0/LibRangeCheck-3.0.lua | 2 +-
.../Modules/ActionBars/Elements/Extrabar.lua | 20 +
KkthnxUI/Modules/Auras/Lumos/Evoker.lua | 8 +-
.../Automation/Elements/Screenshot.lua | 8 +-
KkthnxUI/Modules/Blizzard/Elements/Fixes.lua | 127 ++++
KkthnxUI/Modules/DataText/Elements/Gold.lua | 24 +-
KkthnxUI/Modules/DataText/Elements/Time.lua | 1 +
KkthnxUI/Modules/Load_Modules.xml | 2 +
KkthnxUI/Modules/Miscellaneous/Core.lua | 141 +----
.../Miscellaneous/Elements/QuickJoin.lua | 2 +-
.../Modules/Skins/Blizzard/FrameXML/Menu.lua | 1 +
.../Skins/Blizzard/ProfessionsBook.lua | 99 +++
.../Modules/UnitFrames/Elements/Tracking.lua | 24 +-
KkthnxUI/Modules/UnitFrames/Groups/Raid.lua | 6 -
.../UnitFrames/Plugins/oUF_RaidDebuffs.lua | 191 +++---
.../Modules/UnitFrames/Units/Nameplates.lua | 34 +-
25 files changed, 735 insertions(+), 650 deletions(-)
create mode 100644 KkthnxUI/Modules/Blizzard/Elements/Fixes.lua
create mode 100644 KkthnxUI/Modules/Skins/Blizzard/ProfessionsBook.lua
diff --git a/KkthnxUI/Config/Elements/AuraWatchList/All.lua b/KkthnxUI/Config/Elements/AuraWatchList/All.lua
index 0c6aac93..d38082b5 100644
--- a/KkthnxUI/Config/Elements/AuraWatchList/All.lua
+++ b/KkthnxUI/Config/Elements/AuraWatchList/All.lua
@@ -15,8 +15,13 @@ local list = {
{ AuraID = 371024, UnitID = "player" }, -- 元素强能药水
{ AuraID = 371028, UnitID = "player" }, -- 究极元素强能药水
-- 11.0 饰品
+ { AuraID = 92099, UnitID = "player" }, -- 灰鳞的优雅
+ { AuraID = 268769, UnitID = "player" }, -- 望远镜饰品
{ AuraID = 443531, UnitID = "player" }, -- 振奋之光
{ AuraID = 435493, UnitID = "player" }, -- 死亡之吻
+ { AuraID = 455451, UnitID = "player" }, -- 迅芯烛台
+ { AuraID = 449954, UnitID = "player" }, -- 奸邪发射机
+ { AuraID = 449947, UnitID = "player", Text = NPE_JUMP }, -- 奸邪发射机,跳3下
-- 10.0 饰品
{ AuraID = 381476, UnitID = "player" }, -- 爆发烈焰
{ AuraID = 383941, UnitID = "player" }, -- 崩坏之力
@@ -230,6 +235,7 @@ local list = {
{ AuraID = 464748, UnitID = "player", Flash = true }, -- 束缚之网,流丝
},
["Warning"] = { -- 目标重要光环组
+ { AuraID = 268756, UnitID = "target", Caster = "player" }, -- 望远镜饰品
{ AuraID = 355596, UnitID = "target", Flash = true }, -- 橙弓,哀痛箭
-- 大幻象
{ AuraID = 304975, UnitID = "target", Value = true }, -- 虚空哀嚎,吸收盾
@@ -237,6 +243,7 @@ local list = {
-- 大米
{ AuraID = 226510, UnitID = "target" }, -- 血池回血
{ AuraID = 343502, UnitID = "target" }, -- 鼓舞光环
+ { AuraID = 462704, UnitID = "target" }, -- 碎裂精华,TWW S1
-- 5人
{ AuraID = 372988, UnitID = "target", Value = true }, -- 寒冰壁垒,红玉
{ AuraID = 391050, UnitID = "target", Value = true }, -- 暴风骤雨之盾,红玉
@@ -284,12 +291,16 @@ local list = {
{ AuraID = 321754, UnitID = "target", Value = true }, -- 通灵战潮,冰缚之盾
{ AuraID = 343470, UnitID = "target", Value = true }, -- 通灵战潮,碎骨之盾
{ AuraID = 328351, UnitID = "target", Flash = true }, -- 通灵战潮,染血长枪
+ { AuraID = 273721, UnitID = "target", Flash = true }, -- 围攻,1号易伤
+ { AuraID = 423588, UnitID = "target", Value = true }, -- 修道院,圣光屏障
-- S1
{ AuraID = 445409, UnitID = "target", Value = true }, -- 加固壳壁,斯卡莫拉克
-- Raids
{ AuraID = 440177, UnitID = "target", Flash = true }, -- 准备饕餮,噬灭者乌格拉克斯
{ AuraID = 450980, UnitID = "target", Value = true }, -- 存在瓦解,阿努巴拉什
{ AuraID = 451277, UnitID = "target", Value = true }, -- 尖刺风暴,阿努巴拉什
+ { AuraID = 440179, UnitID = "target", Value = true }, -- 缠绕,阿努巴拉什
+ { AuraID = 456245, UnitID = "target", Value = true }, -- 刺痛谵妄,阿努巴拉什
{ AuraID = 448488, UnitID = "target", Value = true }, -- 崇拜者的保护,尾王
-- PVP
{ AuraID = 498, UnitID = "target" }, -- 圣佑术
@@ -334,7 +345,7 @@ local list = {
{ AuraID = 228323, UnitID = "target", Value = true }, -- 克罗塔的护盾
},
["InternalCD"] = { -- 自定义内置冷却组
- { IntID = 450978, Duration = 15.4 }, -- 皎月风暴,猎人英雄天赋
+ { IntID = 450978, Duration = 13.7 }, -- 皎月风暴,猎人英雄天赋
{ IntID = 114018, Duration = 15, OnSuccess = true, UnitID = "all" }, -- 帷幕
-- {IntID = 240447, Duration = 20}, -- 大米,践踏
-- {IntID = 316958, Duration = 30, OnSuccess = true, UnitID = "all"}, -- 红土
diff --git a/KkthnxUI/Config/Elements/AuraWatchList/Hunter.lua b/KkthnxUI/Config/Elements/AuraWatchList/Hunter.lua
index b07a122a..2a00a4c1 100644
--- a/KkthnxUI/Config/Elements/AuraWatchList/Hunter.lua
+++ b/KkthnxUI/Config/Elements/AuraWatchList/Hunter.lua
@@ -52,6 +52,7 @@ local list = {
{ AuraID = 392956, UnitID = "player" }, -- 巨熊之韧
{ AuraID = 407405, UnitID = "player" }, -- 弦之韵律
{ AuraID = 359844, UnitID = "player" }, -- 荒野的召唤
+ { AuraID = 360952, UnitID = "player" }, -- 协同进攻
{ AuraID = 388045, UnitID = "player", Flash = true }, -- 警戒
{ AuraID = 378770, UnitID = "player", Flash = true }, -- 夺命打击
{ AuraID = 378747, UnitID = "player", Flash = true }, -- 凶暴兽群
diff --git a/KkthnxUI/Config/Elements/FilterLists/NameplateAuras.lua b/KkthnxUI/Config/Elements/FilterLists/NameplateAuras.lua
index 5c1a63d4..4859fb0f 100644
--- a/KkthnxUI/Config/Elements/FilterLists/NameplateAuras.lua
+++ b/KkthnxUI/Config/Elements/FilterLists/NameplateAuras.lua
@@ -1,6 +1,7 @@
local C = KkthnxUI[2]
C.NameplateWhiteList = {
+ [268756] = true, -- 望远镜饰品
-- Buffs
[642] = true, -- Divine Shield
[1022] = true, -- Hand of Protection
@@ -94,7 +95,7 @@ C.NameplateShowPowerList = {
}
C.NameplateTargetNPCs = {
- [165251] = true, -- Sylvan Fox
+ -- [165251] = true, -- Sylvan Fox
[174773] = true, -- Spiteful Fiend
}
@@ -188,7 +189,7 @@ C.MajorSpells = {
[381694] = true, -- Decaying Senses, Fernskin
[388060] = true, -- Stinking Breath, Fernskin
[383385] = true, -- Rotting Surge, Fernskin
- [382172] = true, -- Necrotic Breath, Fernskin
+ [382712] = true, -- Necrotic Breath, Fernskin
[384899] = true, -- Bone Arrow Rain, Fernskin
[378282] = true, -- Molten Core, Nassarius
[383651] = true, -- Molten Legion, Nassarius
diff --git a/KkthnxUI/Config/GUI.lua b/KkthnxUI/Config/GUI.lua
index 59f014c0..d12f0b73 100644
--- a/KkthnxUI/Config/GUI.lua
+++ b/KkthnxUI/Config/GUI.lua
@@ -839,7 +839,6 @@ local Misc = function(self)
end
Window:CreateSwitch("Misc", "QuickJoin", newFeatureIcon .. L["QuickJoin"], L["QuickJoinTip"])
Window:CreateSwitch("Misc", "ItemLevel", L["Show Character/Inspect ItemLevel Info"])
- Window:CreateSwitch("Misc", "DeathCounter", "Track and display the total deaths and level-specific deaths")
end
local Nameplate = function(self)
diff --git a/KkthnxUI/Config/Settings.lua b/KkthnxUI/Config/Settings.lua
index 9c040d2f..08f553b0 100644
--- a/KkthnxUI/Config/Settings.lua
+++ b/KkthnxUI/Config/Settings.lua
@@ -422,7 +422,6 @@ C["Misc"] = {
MaxCameraZoom = 2.6,
MuteSounds = true,
NoTalkingHead = false,
- DeathCounter = true,
ParagonEnable = false,
QuestTool = false,
QueueTimers = false,
diff --git a/KkthnxUI/Core/GUI.lua b/KkthnxUI/Core/GUI.lua
index c62a9c8a..fbfc296b 100644
--- a/KkthnxUI/Core/GUI.lua
+++ b/KkthnxUI/Core/GUI.lua
@@ -397,7 +397,6 @@ local SwitchOnLeave = function(self)
end
local CreateSwitch = function(self, group, option, text, tooltip, hook)
- -- print("group:", group, "option:", option)
local Value = C[group][option]
local Anchor = CreateFrame("Frame", nil, self)
@@ -440,7 +439,7 @@ local CreateSwitch = function(self, group, option, text, tooltip, hook)
Switch.Label = Switch:CreateFontString(nil, "OVERLAY")
Switch.Label:SetPoint("LEFT", Switch, "RIGHT", Spacing, 0)
- Switch.Label:SetWidth(WidgetListWidth - SwitchWidth - (Spacing * 4))
+ Switch.Label:SetWidth(WidgetListWidth - SwitchWidth - 40, WidgetHeight)
Switch.Label:SetJustifyH("LEFT")
Switch.Label:SetFontObject(K.UIFont)
Switch.Label:SetText(text)
diff --git a/KkthnxUI/Developer/Core.lua b/KkthnxUI/Developer/Core.lua
index a58dc06d..46550cd8 100644
--- a/KkthnxUI/Developer/Core.lua
+++ b/KkthnxUI/Developer/Core.lua
@@ -1,5 +1,5 @@
local K, C, L = KkthnxUI[1], KkthnxUI[2], KkthnxUI[3]
--- local Module = K:NewModule("Developer")
+local Module = K:NewModule("Developer")
K.Devs = {
["Kkthnx-Area 52"] = true,
@@ -14,3 +14,103 @@ K.isDeveloper = isDeveloper
if not K.isDeveloper then
return
end
+
+local _G = _G
+local ShowUIPanel = ShowUIPanel
+local GetInstanceInfo = GetInstanceInfo
+local InCombatLockdown = InCombatLockdown
+
+local C_TalkingHead_SetConversationsDeferred = C_TalkingHead.SetConversationsDeferred
+
+local Config_ObjectiveFrameAutoHideInKeystone = true
+local Config_ObjectiveFrameAutoHide = true
+
+local function IsQuestTrackerLoaded()
+ return C_AddOns.IsAddOnLoaded("!KalielsTracker") or C_AddOns.IsAddOnLoaded("DugisGuideViewerZ")
+end
+
+local function IsObjectiveTrackerCollapsed(frame)
+ return frame:GetParent() == K.UIFrameHider
+end
+
+local function CollapseObjectiveTracker(frame)
+ frame:SetParent(K.UIFrameHider)
+end
+
+local function ExpandObjectiveTracker(frame)
+ frame:SetParent(_G.UIParent)
+end
+
+local function AutoHideObjectiveTrackerOnShow()
+ local tracker = _G.ObjectiveTrackerFrame
+ if tracker and IsObjectiveTrackerCollapsed(tracker) then
+ ExpandObjectiveTracker(tracker)
+ end
+end
+
+local function AutoHideObjectiveTrackerOnHide()
+ local tracker = _G.ObjectiveTrackerFrame
+ if not tracker or IsObjectiveTrackerCollapsed(tracker) then
+ return
+ end
+
+ if Config_ObjectiveFrameAutoHideInKeystone then
+ CollapseObjectiveTracker(tracker)
+ else
+ local _, _, difficultyID = GetInstanceInfo()
+ if difficultyID ~= 8 then -- ignore hide in keystone runs
+ CollapseObjectiveTracker(tracker)
+ end
+ end
+end
+
+local function AutoHideObjectiveTracker()
+ local tracker = _G.ObjectiveTrackerFrame
+ if not tracker then
+ return
+ end
+
+ if not AutoHider then
+ AutoHider = CreateFrame("Frame", nil, UIParent, "SecureHandlerStateTemplate")
+ AutoHider:SetAttribute("_onstate-objectiveHider", "if newstate == 1 then self:Hide() else self:Show() end")
+ AutoHider:SetScript("OnHide", AutoHideObjectiveTrackerOnHide)
+ AutoHider:SetScript("OnShow", AutoHideObjectiveTrackerOnShow)
+ end
+
+ if Config_ObjectiveFrameAutoHide then
+ RegisterStateDriver(AutoHider, "objectiveHider", "[@arena1,exists][@arena2,exists][@arena3,exists][@arena4,exists][@arena5,exists][@boss1,exists][@boss2,exists][@boss3,exists][@boss4,exists][@boss5,exists]1;0")
+ else
+ UnregisterStateDriver(AutoHider, "objectiveHider")
+ AutoHideObjectiveTrackerOnShow() -- reshow it when needed
+ end
+end
+
+local function SplashFrame_OnHide(frame)
+ local fromGameMenu = frame.screenInfo and frame.screenInfo.gameMenuRequest
+ frame.screenInfo = nil
+
+ C_TalkingHead_SetConversationsDeferred(false)
+ _G.AlertFrame:SetAlertsEnabled(true, "splashFrame")
+
+ if fromGameMenu and not frame.showingQuestDialog and not InCombatLockdown() then
+ ShowUIPanel(_G.GameMenuFrame)
+ end
+
+ frame.showingQuestDialog = nil
+end
+
+local function SetupObjectiveTracker()
+ AutoHideObjectiveTracker()
+
+ local splash = _G.SplashFrame
+ if splash then
+ splash:SetScript("OnHide", SplashFrame_OnHide)
+ end
+end
+
+-- Module's OnEnable function.
+function Module:OnEnable()
+ if not IsQuestTrackerLoaded() then
+ SetupObjectiveTracker()
+ end
+end
diff --git a/KkthnxUI/Libraries/LibAnim/LibAnim.lua b/KkthnxUI/Libraries/LibAnim/LibAnim.lua
index 22d0271a..4003264d 100644
--- a/KkthnxUI/Libraries/LibAnim/LibAnim.lua
+++ b/KkthnxUI/Libraries/LibAnim/LibAnim.lua
@@ -1,5 +1,5 @@
-- LibAnim by Hydra
-local Version = 2.901 -- based on 2.03
+local Version = 2.902 -- based on 2.03
-- Note, deprecated items will be removed next version.
-- Please update your usage accordingly. (ctrl + f - "Deprecated")
@@ -1102,11 +1102,11 @@ Update.color = function(self, elapsed, i)
elseif self.children then
self.ColorOffset = Easing[self.Easing](self.Timer, 0, self.Duration, self.Duration)
for _, child in pairs(self.children) do
- Set[self.ColorType](child, GetColor(self.Timer / self.Duration, self.StartR, self.StartG, self.StartB, self.EndR, self.EndG, self.EndB))
+ Set[self.ColorType](child, GetColor(self.ColorOffset / self.Duration, self.StartR, self.StartG, self.StartB, self.EndR, self.EndG, self.EndB))
end
else
self.ColorOffset = Easing[self.Easing](self.Timer, 0, self.Duration, self.Duration)
- Set[self.ColorType](self.Parent, GetColor(self.Timer / self.Duration, self.StartR, self.StartG, self.StartB, self.EndR, self.EndG, self.EndB))
+ Set[self.ColorType](self.Parent, GetColor(self.ColorOffset / self.Duration, self.StartR, self.StartG, self.StartB, self.EndR, self.EndG, self.EndB))
end
end
diff --git a/KkthnxUI/Libraries/LibDeflate/LibDeflate.lua b/KkthnxUI/Libraries/LibDeflate/LibDeflate.lua
index 055114ba..f6fb7e09 100644
--- a/KkthnxUI/Libraries/LibDeflate/LibDeflate.lua
+++ b/KkthnxUI/Libraries/LibDeflate/LibDeflate.lua
@@ -5,7 +5,7 @@ DEFLATE/zlib format.
@file LibDeflate.lua
@author Haoqian He (Github: SafeteeWoW; World of Warcraft: Safetyy-Illidan(US))
-@copyright LibDeflate <2018-2020> Haoqian He
+@copyright LibDeflate <2018-2021> Haoqian He
@license zlib License
This library is implemented according to the following specifications.
@@ -24,11 +24,10 @@ the library.
Submit suggestions or report bugs to
https://github.com/safeteeWow/LibDeflate/issues
]]
-
--[[
zlib License
-(C) 2018-2020 Haoqian He
+(C) 2018-2021 Haoqian He
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -75,7 +74,6 @@ Their original licenses shall be comply when used.
Licensed under GPLv2.
For the 6bit encoding and decoding.
]]
-
--[[
Curseforge auto-packaging replacements:
@@ -83,7 +81,6 @@ Their original licenses shall be comply when used.
Project Hash: @project-hash@
Project Version: @project-version@
--]]
-
local LibDeflate
do
@@ -107,7 +104,7 @@ do
-- 3 : v1.0.2
local _MINOR = 3
- local _COPYRIGHT = "LibDeflate " .. _VERSION .. " Copyright (C) 2018-2020 Haoqian He." .. " Licensed under the zlib License"
+ local _COPYRIGHT = "LibDeflate " .. _VERSION .. " Copyright (C) 2018-2021 Haoqian He." .. " Licensed under the zlib License"
-- Register in the World of Warcraft library "LibStub" if detected.
if LibStub then
@@ -144,10 +141,6 @@ local table_concat = table.concat
local table_sort = table.sort
local tostring = tostring
local type = type
-local coroutine_create = coroutine.create
-local coroutine_status = coroutine.status
-local coroutine_resume = coroutine.resume
-local coroutine_yield = coroutine.yield
-- Converts i to 2^i, (0<=i<=32)
-- This is used to implement bit left shift and bit right shift.
@@ -329,7 +322,27 @@ local _dist_deflate_code_to_extra_bitlen = {
-- The code order of the first huffman header in the dynamic deflate block.
-- See the page 12 of RFC1951
-local _rle_codes_huffman_bitlen_order = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 }
+local _rle_codes_huffman_bitlen_order = {
+ 16,
+ 17,
+ 18,
+ 0,
+ 8,
+ 7,
+ 9,
+ 6,
+ 10,
+ 5,
+ 11,
+ 4,
+ 12,
+ 3,
+ 13,
+ 2,
+ 14,
+ 1,
+ 15,
+}
-- The following tables are used by fixed deflate block.
-- The value of these tables are assigned at the bottom of the source.
@@ -647,45 +660,45 @@ local function IsValidDictionary(dictionary)
end
--[[
- key of the configuration table is the compression level,
- and its value stores the compression setting.
- These numbers come from zlib source code.
-
- Higher compression level usually means better compression.
- (Because LibDeflate uses a simplified version of zlib algorithm,
- there is no guarantee that higher compression level does not create
- bigger file than lower level, but I can say it's 99% likely)
-
- Be careful with the high compression level. This is a pure lua
- implementation compressor/decompressor, which is significant slower than
- a C/C++ equivalant compressor/decompressor. Very high compression level
- costs significant more CPU time, and usually compression size won't be
- significant smaller when you increase compression level by 1, when the
- level is already very high. Benchmark yourself if you can afford it.
-
- See also https://github.com/madler/zlib/blob/master/doc/algorithm.txt,
- https://github.com/madler/zlib/blob/master/deflate.c for more information.
-
- The meaning of each field:
- @field 1 use_lazy_evaluation:
- true/false. Whether the program uses lazy evaluation.
- See what is "lazy evaluation" in the link above.
- lazy_evaluation improves ratio, but relatively slow.
- @field 2 good_prev_length:
- Only effective if lazy is set, Only use 1/4 of max_chain,
- if prev length of lazy match is above this.
- @field 3 max_insert_length/max_lazy_match:
- If not using lazy evaluation,
- insert new strings in the hash table only if the match length is not
- greater than this length.
- If using lazy evaluation, only continue lazy evaluation,
- if previous match length is strictly smaller than this value.
- @field 4 nice_length:
- Number. Don't continue to go down the hash chain,
- if match length is above this.
- @field 5 max_chain:
- Number. The maximum number of hash chains we look.
---]]
+ key of the configuration table is the compression level,
+ and its value stores the compression setting.
+ These numbers come from zlib source code.
+
+ Higher compression level usually means better compression.
+ (Because LibDeflate uses a simplified version of zlib algorithm,
+ there is no guarantee that higher compression level does not create
+ bigger file than lower level, but I can say it's 99% likely)
+
+ Be careful with the high compression level. This is a pure lua
+ implementation compressor/decompressor, which is significant slower than
+ a C/C++ equivalant compressor/decompressor. Very high compression level
+ costs significant more CPU time, and usually compression size won't be
+ significant smaller when you increase compression level by 1, when the
+ level is already very high. Benchmark yourself if you can afford it.
+
+ See also https://github.com/madler/zlib/blob/master/doc/algorithm.txt,
+ https://github.com/madler/zlib/blob/master/deflate.c for more information.
+
+ The meaning of each field:
+ @field 1 use_lazy_evaluation:
+ true/false. Whether the program uses lazy evaluation.
+ See what is "lazy evaluation" in the link above.
+ lazy_evaluation improves ratio, but relatively slow.
+ @field 2 good_prev_length:
+ Only effective if lazy is set, Only use 1/4 of max_chain,
+ if prev length of lazy match is above this.
+ @field 3 max_insert_length/max_lazy_match:
+ If not using lazy evaluation,
+ insert new strings in the hash table only if the match length is not
+ greater than this length.
+ If using lazy evaluation, only continue lazy evaluation,
+ if previous match length is strictly smaller than this value.
+ @field 4 nice_length:
+ Number. Don't continue to go down the hash chain,
+ if match length is above this.
+ @field 5 max_chain:
+ Number. The maximum number of hash chains we look.
+ --]]
local _compression_level_configs = {
[0] = { false, nil, 0, 0, 0 }, -- level 0, no compression
[1] = { false, nil, 4, 8, 4 }, -- level 1, similar to zlib level 1
@@ -695,7 +708,7 @@ local _compression_level_configs = {
[5] = { true, 8, 16, 32, 32 }, -- level 5, similar to zlib level 5
[6] = { true, 8, 16, 128, 128 }, -- level 6, similar to zlib level 6
[7] = { true, 8, 32, 128, 256 }, -- (SLOW) level 7, similar to zlib level 7
- [8] = { true, 32, 128, 258, 1024 }, --(SLOW) level 8,similar to zlib level 8
+ [8] = { true, 32, 128, 258, 1024 }, -- (SLOW) level 8,similar to zlib level 8
[9] = { true, 32, 258, 258, 4096 },
-- (VERY SLOW) level 9, similar to zlib level 9
}
@@ -725,7 +738,7 @@ local function IsValidArguments(str, check_dictionary, dictionary, check_configs
end
if type_configs == "table" then
for k, v in pairs(configs) do
- if k ~= "level" and k ~= "strategy" and k ~= "chunksMode" and k ~= "yieldOnChunkSize" and k ~= "yieldOnChunkTime" and k ~= "timeFn" then
+ if k ~= "level" and k ~= "strategy" then
return false, ("'configs' - unsupported table key in the configs: '%s'."):format(k)
elseif k == "level" and not _compression_level_configs[v] then
return false, ("'configs' - unsupported 'level': %s."):format(tostring(v))
@@ -740,8 +753,8 @@ local function IsValidArguments(str, check_dictionary, dictionary, check_configs
end
--[[ --------------------------------------------------------------------------
- Compress code
---]]
+ Compress code
+ --]]
--------------------------------------------------------------------------
-- partial flush to save memory
@@ -754,12 +767,12 @@ local _FLUSH_MODE_BYTE_BOUNDARY = 2
local _FLUSH_MODE_NO_FLUSH = 3
--[[
- Create an empty writer to easily write stuffs as the unit of bits.
- Return values:
- 1. WriteBits(code, bitlen):
- 2. WriteString(str):
- 3. Flush(mode):
---]]
+ Create an empty writer to easily write stuffs as the unit of bits.
+ Return values:
+ 1. WriteBits(code, bitlen):
+ 2. WriteString(str):
+ 3. Flush(mode):
+ --]]
local function CreateWriter()
local buffer_size = 0
local cache = 0
@@ -994,11 +1007,11 @@ local function GetHuffmanBitlenAndCode(symbol_counts, max_bitlen, max_symbol)
local bitlen_counts = {}
--[[
- tree[1]: weight, temporarily used as parent and bitLengths
- tree[2]: symbol
- tree[3]: left child
- tree[4]: right child
- --]]
+ tree[1]: weight, temporarily used as parent and bitLengths
+ tree[2]: symbol
+ tree[3]: left child
+ tree[4]: right child
+ --]]
local number_unique_symbols = 0
for symbol, count in pairs(symbol_counts) do
number_unique_symbols = number_unique_symbols + 1
@@ -1194,21 +1207,15 @@ end
-- @param end str[index] will be the last character to be loaded
-- @param offset str[index] will be loaded into t[index-offset]
-- @return t
-local function LoadStringToTable(str, t, start, stop, offset, chunks)
+local function LoadStringToTable(str, t, start, stop, offset)
local i = start - offset
while i <= stop - 15 - offset do
t[i], t[i + 1], t[i + 2], t[i + 3], t[i + 4], t[i + 5], t[i + 6], t[i + 7], t[i + 8], t[i + 9], t[i + 10], t[i + 11], t[i + 12], t[i + 13], t[i + 14], t[i + 15] = string_byte(str, i + offset, i + 15 + offset)
i = i + 16
- if chunks then
- chunks:doYield(stop - start)
- end
end
while i <= stop - offset do
t[i] = string_byte(str, i + offset, i + offset)
i = i + 1
- if chunks then
- chunks:doYield(stop - start)
- end
end
return t
end
@@ -1259,7 +1266,7 @@ local function GetBlockLZ77Result(level, string_table, hash_tables, block_start,
local config = _compression_level_configs[level]
local config_use_lazy, config_good_prev_length, config_max_lazy_match, config_nice_length, config_max_hash_chain = config[1], config[2], config[3], config[4], config[5]
- local config_max_insert_length = not config_use_lazy and config_max_lazy_match or 2147483646
+ local config_max_insert_length = (not config_use_lazy) and config_max_lazy_match or 2147483646
local config_good_hash_chain = (config_max_hash_chain - config_max_hash_chain % 4 / 4)
local hash
@@ -1468,7 +1475,7 @@ local function GetBlockLZ77Result(level, string_table, hash_tables, block_start,
end
index = index + prev_len - (config_use_lazy and 1 or 0)
match_available = false
- elseif not config_use_lazy or match_available then
+ elseif (not config_use_lazy) or match_available then
local code = string_table[config_use_lazy and (string_table_index - 1) or string_table_index]
lcode_tblsize = lcode_tblsize + 1
lcodes[lcode_tblsize] = code
@@ -1750,7 +1757,6 @@ local function Deflate(configs, WriteBits, WriteString, FlushWriter, str, dictio
local level
local strategy
- local chunks
if configs then
if configs.level then
level = configs.level
@@ -1758,29 +1764,6 @@ local function Deflate(configs, WriteBits, WriteString, FlushWriter, str, dictio
if configs.strategy then
strategy = configs.strategy
end
- if configs.chunksMode then
- chunks = {
- currentSize = 0,
- yieldOnChunkSize = configs.yieldOnChunkSize or 32 * 1024 * 1024,
- currentTime = nil,
- yieldOnChunkTime = configs.yieldOnChunkTime,
- timeFn = configs.getTimeFn,
- }
- function chunks:doYield(addSize)
- if not self.currentTime and self.timeFn then
- self.currentTime = self.timeFn()
- end
-
- self.currentSize = self.currentSize + addSize
- if self.currentSize > self.yieldOnChunkSize or (self.currentTime and self.timeFn() - self.currentTime > self.yieldOnChunkTime) then
- self.currentSize = 0
- if self.timeFn then
- self.currentTime = self.timeFn()
- end
- coroutine_yield()
- end
- end
- end
end
if not level then
@@ -1821,7 +1804,7 @@ local function Deflate(configs, WriteBits, WriteString, FlushWriter, str, dictio
if level ~= 0 then
-- GetBlockLZ77 needs block_start to block_end+3 to be loaded.
- LoadStringToTable(str, string_table, block_start, block_end + 3, offset, chunks)
+ LoadStringToTable(str, string_table, block_start, block_end + 3, offset)
if block_start == 1 and dictionary then
local dict_string_table = dictionary.string_table
local dict_strlen = dictionary.strlen
@@ -1832,7 +1815,7 @@ local function Deflate(configs, WriteBits, WriteString, FlushWriter, str, dictio
if strategy == "huffman_only" then
lcodes = {}
- LoadStringToTable(str, lcodes, block_start, block_end, block_start - 1, nil, chunks)
+ LoadStringToTable(str, lcodes, block_start, block_end, block_start - 1)
lextra_bits = {}
lcodes_counts = {}
lcodes[block_end - block_start + 2] = 256 -- end of block
@@ -1847,7 +1830,10 @@ local function Deflate(configs, WriteBits, WriteString, FlushWriter, str, dictio
lcodes, lextra_bits, lcodes_counts, dcodes, dextra_bits, dcodes_counts = GetBlockLZ77Result(level, string_table, hash_tables, block_start, block_end, offset, dictionary)
end
- HLIT, HDIST, HCLEN, rle_codes_huffman_bitlens, rle_codes_huffman_codes, rle_deflate_codes, rle_extra_bits, lcodes_huffman_bitlens, lcodes_huffman_codes, dcodes_huffman_bitlens, dcodes_huffman_codes = GetBlockDynamicHuffmanHeader(lcodes_counts, dcodes_counts)
+ -- LuaFormatter off
+ HLIT, HDIST, HCLEN, rle_codes_huffman_bitlens, rle_codes_huffman_codes, rle_deflate_codes, rle_extra_bits, lcodes_huffman_bitlens, lcodes_huffman_codes, dcodes_huffman_bitlens, dcodes_huffman_codes =
+ -- LuaFormatter on
+ GetBlockDynamicHuffmanHeader(lcodes_counts, dcodes_counts)
dynamic_block_bitlen = GetDynamicHuffmanBlockSize(lcodes, dcodes, HCLEN, rle_codes_huffman_bitlens, rle_deflate_codes, lcodes_huffman_bitlens, dcodes_huffman_bitlens)
fixed_block_bitlen = GetFixedHuffmanBlockSize(lcodes, dcodes)
end
@@ -1930,43 +1916,15 @@ end
-- @field strategy The compression strategy. "fixed" to only use fixed deflate
-- compression block. "dynamic" to only use dynamic block. "huffman_only" to
-- do no LZ77 compression. Only do huffman compression.
--- @field chunksMode If true, function will return a coroutine handler
--- to resume the coroutine. See the readme for an example.
--- @field yieldOnChunkSize If chunksMode is true, how large should the buffer
--- be before yielding the coroutine. Defaults to 32 * 1024 * 1024.
--- @field yieldOnChunkTime If chunksMode is true, maximum duration between
--- yields. Requires timeFn.
--- @field timeFn If chunksMode is true, include a function to use to calculate
--- the current time for your environment.
-- @see LibDeflate:CompressDeflate(str, configs)
-- @see LibDeflate:CompressDeflateWithDict(str, dictionary, configs)
local function CompressDeflateInternal(str, dictionary, configs)
local WriteBits, WriteString, FlushWriter = CreateWriter()
-
- if configs and configs.chunksMode then
- local thread = coroutine_create(Deflate)
- -- return coroutine handler
- return function()
- local co_success = coroutine_resume(thread, configs, WriteBits, WriteString, FlushWriter, str, dictionary)
- if not co_success then
- return false
- elseif coroutine_status(thread) ~= "dead" then
- return true
- else
- local total_bitlen, result = FlushWriter(_FLUSH_MODE_OUTPUT)
- local padding_bitlen = (8 - total_bitlen % 8) % 8
- return false, result, padding_bitlen
- end
- end
- else
- -- if synchronous mode
- Deflate(configs, WriteBits, WriteString, FlushWriter, str, dictionary)
-
- local total_bitlen, result = FlushWriter(_FLUSH_MODE_OUTPUT)
- local padding_bitlen = (8 - total_bitlen % 8) % 8
- return result, padding_bitlen
- end
+ Deflate(configs, WriteBits, WriteString, FlushWriter, str, dictionary)
+ local total_bitlen, result = FlushWriter(_FLUSH_MODE_OUTPUT)
+ local padding_bitlen = (8 - total_bitlen % 8) % 8
+ return result, padding_bitlen
end
-- @see LibDeflate:CompressZlib
@@ -1975,7 +1933,7 @@ local function CompressZlibInternal(str, dictionary, configs)
local WriteBits, WriteString, FlushWriter = CreateWriter()
local CM = 8 -- Compression method
- local CINFO = 7 --Window Size = 32K
+ local CINFO = 7 -- Window Size = 32K
local CMF = CINFO * 16 + CM
WriteBits(CMF, 8)
@@ -2004,63 +1962,27 @@ local function CompressZlibInternal(str, dictionary, configs)
WriteBits(byte0, 8)
end
- if configs and configs.chunksMode then
- local thread = coroutine_create(Deflate)
+ Deflate(configs, WriteBits, WriteString, FlushWriter, str, dictionary)
+ FlushWriter(_FLUSH_MODE_BYTE_BOUNDARY)
- -- return coroutine handler
- return function()
- local co_success, result, status = coroutine_resume(thread, configs, WriteBits, WriteString, FlushWriter, str, dictionary)
- if not co_success then
- return false
- elseif coroutine_status(thread) ~= "dead" then
- return true
- else
- FlushWriter(_FLUSH_MODE_BYTE_BOUNDARY)
-
- local adler32 = LibDeflate:Adler32(str)
-
- -- Most significant byte first
- local byte3 = adler32 % 256
- adler32 = (adler32 - byte3) / 256
- local byte2 = adler32 % 256
- adler32 = (adler32 - byte2) / 256
- local byte1 = adler32 % 256
- adler32 = (adler32 - byte1) / 256
- local byte0 = adler32 % 256
-
- WriteBits(byte0, 8)
- WriteBits(byte1, 8)
- WriteBits(byte2, 8)
- WriteBits(byte3, 8)
- local total_bitlen, result = FlushWriter(_FLUSH_MODE_OUTPUT)
- local padding_bitlen = (8 - total_bitlen % 8) % 8
- return false, result, padding_bitlen
- end
- end
- else
- Deflate(configs, WriteBits, WriteString, FlushWriter, str, dictionary)
+ local adler32 = LibDeflate:Adler32(str)
- FlushWriter(_FLUSH_MODE_BYTE_BOUNDARY)
+ -- Most significant byte first
+ local byte3 = adler32 % 256
+ adler32 = (adler32 - byte3) / 256
+ local byte2 = adler32 % 256
+ adler32 = (adler32 - byte2) / 256
+ local byte1 = adler32 % 256
+ adler32 = (adler32 - byte1) / 256
+ local byte0 = adler32 % 256
- local adler32 = LibDeflate:Adler32(str)
-
- -- Most significant byte first
- local byte3 = adler32 % 256
- adler32 = (adler32 - byte3) / 256
- local byte2 = adler32 % 256
- adler32 = (adler32 - byte2) / 256
- local byte1 = adler32 % 256
- adler32 = (adler32 - byte1) / 256
- local byte0 = adler32 % 256
-
- WriteBits(byte0, 8)
- WriteBits(byte1, 8)
- WriteBits(byte2, 8)
- WriteBits(byte3, 8)
- local total_bitlen, result = FlushWriter(_FLUSH_MODE_OUTPUT)
- local padding_bitlen = (8 - total_bitlen % 8) % 8
- return result, padding_bitlen
- end
+ WriteBits(byte0, 8)
+ WriteBits(byte1, 8)
+ WriteBits(byte2, 8)
+ WriteBits(byte3, 8)
+ local total_bitlen, result = FlushWriter(_FLUSH_MODE_OUTPUT)
+ local padding_bitlen = (8 - total_bitlen % 8) % 8
+ return result, padding_bitlen
end
--- Compress using the raw deflate format.
@@ -2148,19 +2070,19 @@ function LibDeflate:CompressZlibWithDict(str, dictionary, configs)
end
--[[ --------------------------------------------------------------------------
- Decompress code
---]]
+ Decompress code
+ --]]
--------------------------------------------------------------------------
--[[
- Create a reader to easily reader stuffs as the unit of bits.
- Return values:
- 1. ReadBits(bitlen)
- 2. ReadBytes(bytelen, buffer, buffer_size)
- 3. Decode(huffman_bitlen_count, huffman_symbol, min_bitlen)
- 4. ReaderBitlenLeft()
- 5. SkipToByteBoundary()
---]]
+ Create a reader to easily reader stuffs as the unit of bits.
+ Return values:
+ 1. ReadBits(bitlen)
+ 2. ReadBytes(bytelen, buffer, buffer_size)
+ 3. Decode(huffman_bitlen_count, huffman_symbol, min_bitlen)
+ 4. ReaderBitlenLeft()
+ 5. SkipToByteBoundary()
+ --]]
local function CreateReader(input_string)
local input = input_string
local input_strlen = #input_string
@@ -2404,11 +2326,6 @@ local function DecodeUntilEndOfBlock(state, lcodes_huffman_bitlens, lcodes_huffm
repeat
local symbol = Decode(lcodes_huffman_bitlens, lcodes_huffman_symbols, lcodes_huffman_min_bitlen)
-
- if state.chunksMode then
- state.chunksMode:doYield(symbol)
- end
-
if symbol < 0 or symbol > 285 then
-- invalid literal/length or distance code in fixed or dynamic block
return -10
@@ -2604,7 +2521,7 @@ local function DecompressDynamicBlock(state)
end
local lcodes_err, lcodes_huffman_bitlen_counts, lcodes_huffman_symbols, lcodes_huffman_min_bitlen = GetHuffmanForDecode(lcodes_huffman_bitlens, nlen - 1, 15)
- --dynamic block code description: invalid literal/length code lengths,
+ -- dynamic block code description: invalid literal/length code lengths,
-- Incomplete code ok only for single length 1 code
if lcodes_err ~= 0 and (lcodes_err < 0 or nlen ~= (lcodes_huffman_bitlen_counts[0] or 0) + (lcodes_huffman_bitlen_counts[1] or 0)) then
return -7
@@ -2651,78 +2568,23 @@ local function Inflate(state)
return result
end
---- The description to decompression configuration table.
--- Any field can be nil to use its default.
--- Table with keys other than those below is an invalid table.
--- @class table
--- @name decompression_configs
--- @field chunksMode If true, function will return a coroutine handler
--- to resume the coroutine. See the readme for an example.
--- @field yieldOnChunkSize If chunksMode is true, how large should the buffer
--- be before yielding the coroutine. Defaults to 32 * 1024 * 1024.
--- @field yieldOnChunkTime If chunksMode is true, maximum duration between
--- yields. Requires timeFn.
--- @field timeFn If chunksMode is true, include a function to use to calculate
--- the current time for your environment.
-
--- @see LibDeflate:DecompressDeflate(str, configs)
--- @see LibDeflate:DecompressDeflateWithDict(str, dictionary, configs)
-local function DecompressDeflateInternal(str, dictionary, configs)
+-- @see LibDeflate:DecompressDeflate(str)
+-- @see LibDeflate:DecompressDeflateWithDict(str, dictionary)
+local function DecompressDeflateInternal(str, dictionary)
local state = CreateDecompressState(str, dictionary)
- if configs and configs.chunksMode then
- local thread = coroutine_create(Inflate)
- state.chunksMode = {
- currentSize = 0,
- yieldOnChunkSize = configs.yieldOnChunkSize or 32 * 1024 * 1024,
- currentTime = nil,
- yieldOnChunkTime = configs.yieldOnChunkTime,
- timeFn = configs.getTimeFn,
- }
- function state.chunksMode:doYield(addSize)
- if not self.currentTime and self.timeFn then
- self.currentTime = self.timeFn()
- end
-
- self.currentSize = self.currentSize + addSize
- if self.currentSize > self.yieldOnChunkSize or (self.currentTime and self.timeFn() - self.currentTime > self.yieldOnChunkTime) then
- self.currentSize = 0
- if self.timeFn then
- self.currentTime = self.timeFn()
- end
- coroutine_yield()
- end
- end
- local result, status
- -- return coroutine handler
- return function()
- local co_success, result, status = coroutine_resume(thread, state)
- if not co_success then
- return false
- elseif coroutine_status(thread) ~= "dead" then
- return true
- elseif not result then
- return false, nil, status
- else
- local bitlen_left = state.ReaderBitlenLeft()
- local bytelen_left = (bitlen_left - bitlen_left % 8) / 8
- return false, result, bytelen_left
- end
- end
- else
- local result, status = Inflate(state, configs)
- if not result then
- return nil, status
- end
-
- local bitlen_left = state.ReaderBitlenLeft()
- local bytelen_left = (bitlen_left - bitlen_left % 8) / 8
- return result, bytelen_left
+ local result, status = Inflate(state)
+ if not result then
+ return nil, status
end
+
+ local bitlen_left = state.ReaderBitlenLeft()
+ local bytelen_left = (bitlen_left - bitlen_left % 8) / 8
+ return result, bytelen_left
end
--- @see LibDeflate:DecompressZlib(str, configs)
--- @see LibDeflate:DecompressZlibWithDict(str, dictionary, configs)
-local function DecompressZlibInternal(str, dictionary, configs)
+-- @see LibDeflate:DecompressZlib(str)
+-- @see LibDeflate:DecompressZlibWithDict(str)
+local function DecompressZlibInternal(str, dictionary)
local state = CreateDecompressState(str, dictionary)
local ReadBits = state.ReadBits
@@ -2766,65 +2628,29 @@ local function DecompressZlibInternal(str, dictionary, configs)
return nil, -17 -- dictionary adler32 does not match
end
end
+ local result, status = Inflate(state)
+ if not result then
+ return nil, status
+ end
+ state.SkipToByteBoundary()
- if configs and configs.chunksMode then
- local thread = coroutine_create(Inflate)
- -- return coroutine handler
- return function()
- local co_success, result, status = coroutine_resume(thread, state, configs)
- if not co_success then
- return false
- elseif coroutine_status(thread) ~= "dead" then
- return true
- elseif not result then
- return false, nil, status
- else
- state.SkipToByteBoundary()
-
- local adler_byte0 = ReadBits(8)
- local adler_byte1 = ReadBits(8)
- local adler_byte2 = ReadBits(8)
- local adler_byte3 = ReadBits(8)
- if state.ReaderBitlenLeft() < 0 then
- return nil, 2 -- available inflate data did not terminate
- end
-
- local adler32_expected = adler_byte0 * 16777216 + adler_byte1 * 65536 + adler_byte2 * 256 + adler_byte3
- local adler32_actual = LibDeflate:Adler32(result)
- if not IsEqualAdler32(adler32_expected, adler32_actual) then
- return nil, -15 -- Adler32 checksum does not match
- end
-
- local bitlen_left = state.ReaderBitlenLeft()
- local bytelen_left = (bitlen_left - bitlen_left % 8) / 8
- return false, result, bytelen_left
- end
- end
- else
- local result, status = Inflate(state, configs)
- if not result then
- return nil, status
- end
- state.SkipToByteBoundary()
-
- local adler_byte0 = ReadBits(8)
- local adler_byte1 = ReadBits(8)
- local adler_byte2 = ReadBits(8)
- local adler_byte3 = ReadBits(8)
- if state.ReaderBitlenLeft() < 0 then
- return nil, 2 -- available inflate data did not terminate
- end
-
- local adler32_expected = adler_byte0 * 16777216 + adler_byte1 * 65536 + adler_byte2 * 256 + adler_byte3
- local adler32_actual = LibDeflate:Adler32(result)
- if not IsEqualAdler32(adler32_expected, adler32_actual) then
- return nil, -15 -- Adler32 checksum does not match
- end
+ local adler_byte0 = ReadBits(8)
+ local adler_byte1 = ReadBits(8)
+ local adler_byte2 = ReadBits(8)
+ local adler_byte3 = ReadBits(8)
+ if state.ReaderBitlenLeft() < 0 then
+ return nil, 2 -- available inflate data did not terminate
+ end
- local bitlen_left = state.ReaderBitlenLeft()
- local bytelen_left = (bitlen_left - bitlen_left % 8) / 8
- return result, bytelen_left
+ local adler32_expected = adler_byte0 * 16777216 + adler_byte1 * 65536 + adler_byte2 * 256 + adler_byte3
+ local adler32_actual = LibDeflate:Adler32(result)
+ if not IsEqualAdler32(adler32_expected, adler32_actual) then
+ return nil, -15 -- Adler32 checksum does not match
end
+
+ local bitlen_left = state.ReaderBitlenLeft()
+ local bytelen_left = (bitlen_left - bitlen_left % 8) / 8
+ return result, bytelen_left
end
--- Decompress a raw deflate compressed data.
@@ -2840,15 +2666,12 @@ end
-- If the decompression fails (The first return value of this function is nil),
-- this return value is undefined.
-- @see LibDeflate:CompressDeflate
-function LibDeflate:DecompressDeflate(str, configs)
- if not configs then
- configs = {}
- end
+function LibDeflate:DecompressDeflate(str)
local arg_valid, arg_err = IsValidArguments(str)
if not arg_valid then
- error(("Usage: LibDeflate:DecompressDeflate(str, configs): " .. arg_err), 2)
+ error(("Usage: LibDeflate:DecompressDeflate(str): " .. arg_err), 2)
end
- return DecompressDeflateInternal(str, nil, configs)
+ return DecompressDeflateInternal(str)
end
--- Decompress a raw deflate compressed data with a preset dictionary.
@@ -2869,15 +2692,12 @@ end
-- If the decompression fails (The first return value of this function is nil),
-- this return value is undefined.
-- @see LibDeflate:CompressDeflateWithDict
-function LibDeflate:DecompressDeflateWithDict(str, dictionary, configs)
- if not configs then
- configs = {}
- end
+function LibDeflate:DecompressDeflateWithDict(str, dictionary)
local arg_valid, arg_err = IsValidArguments(str, true, dictionary)
if not arg_valid then
error(("Usage: LibDeflate:DecompressDeflateWithDict(str, dictionary): " .. arg_err), 2)
end
- return DecompressDeflateInternal(str, dictionary, configs)
+ return DecompressDeflateInternal(str, dictionary)
end
--- Decompress a zlib compressed data.
@@ -2893,15 +2713,12 @@ end
-- If the decompression fails (The first return value of this function is nil),
-- this return value is undefined.
-- @see LibDeflate:CompressZlib
-function LibDeflate:DecompressZlib(str, configs)
- if not configs then
- configs = {}
- end
+function LibDeflate:DecompressZlib(str)
local arg_valid, arg_err = IsValidArguments(str)
if not arg_valid then
error(("Usage: LibDeflate:DecompressZlib(str): " .. arg_err), 2)
end
- return DecompressZlibInternal(str, nil, configs)
+ return DecompressZlibInternal(str)
end
--- Decompress a zlib compressed data with a preset dictionary.
@@ -2922,15 +2739,12 @@ end
-- If the decompression fails (The first return value of this function is nil),
-- this return value is undefined.
-- @see LibDeflate:CompressZlibWithDict
-function LibDeflate:DecompressZlibWithDict(str, dictionary, configs)
- if not configs then
- configs = {}
- end
+function LibDeflate:DecompressZlibWithDict(str, dictionary)
local arg_valid, arg_err = IsValidArguments(str, true, dictionary)
if not arg_valid then
error(("Usage: LibDeflate:DecompressZlibWithDict(str, dictionary): " .. arg_err), 2)
end
- return DecompressZlibInternal(str, dictionary, configs)
+ return DecompressZlibInternal(str, dictionary)
end
-- Calculate the huffman code of fixed block
@@ -3537,20 +3351,20 @@ LibDeflate.internals = {
}
--[[-- Commandline options
-@class table
-@name CommandlineOptions
-@usage lua LibDeflate.lua [OPTION] [INPUT] [OUTPUT]
-\-0 store only. no compression.
-\-1 fastest compression.
-\-9 slowest and best compression.
-\-d do decompression instead of compression.
-\--dict specify the file that contains
-the entire preset dictionary.
-\-h give this help.
-\--strategy specify a special compression strategy.
-\-v print the version and copyright info.
-\--zlib use zlib format instead of raw deflate.
-]]
+ @class table
+ @name CommandlineOptions
+ @usage lua LibDeflate.lua [OPTION] [INPUT] [OUTPUT]
+ \-0 store only. no compression.
+ \-1 fastest compression.
+ \-9 slowest and best compression.
+ \-d do decompression instead of compression.
+ \--dict specify the file that contains
+ the entire preset dictionary.
+ \-h give this help.
+ \--strategy specify a special compression strategy.
+ \-v print the version and copyright info.
+ \--zlib use zlib format instead of raw deflate.
+ ]]
-- currently no plan to support stdin and stdout.
-- Because Lua in Windows does not set stdout with binary mode.
@@ -3558,7 +3372,7 @@ if io and os and debug and _G.arg then
local io = io
local os = os
local debug = debug
- local arg = arg
+ local arg = _G.arg
local debug_info = debug.getinfo(1)
if debug_info.source == arg[0] or debug_info.short_src == arg[0] then
-- We are indeed runnning THIS file from the commandline.
@@ -3574,7 +3388,21 @@ if io and os and debug and _G.arg then
while arg[i] do
local a = arg[i]
if a == "-h" then
- print(LibDeflate._COPYRIGHT .. "\nUsage: lua LibDeflate.lua [OPTION] [INPUT] [OUTPUT]\n" .. " -0 store only. no compression.\n" .. " -1 fastest compression.\n" .. " -9 slowest and best compression.\n" .. " -d do decompression instead of compression.\n" .. " --dict specify the file that contains" .. " the entire preset dictionary.\n" .. " -h give this help.\n" .. " --strategy " .. " specify a special compression strategy.\n" .. " -v print the version and copyright info.\n" .. " --zlib use zlib format instead of raw deflate.\n")
+ print(
+ LibDeflate._COPYRIGHT
+ .. "\nUsage: lua LibDeflate.lua [OPTION] [INPUT] [OUTPUT]\n"
+ .. " -0 store only. no compression.\n"
+ .. " -1 fastest compression.\n"
+ .. " -9 slowest and best compression.\n"
+ .. " -d do decompression instead of compression.\n"
+ .. " --dict specify the file that contains"
+ .. " the entire preset dictionary.\n"
+ .. " -h give this help.\n"
+ .. " --strategy "
+ .. " specify a special compression strategy.\n"
+ .. " -v print the version and copyright info.\n"
+ .. " --zlib use zlib format instead of raw deflate.\n"
+ )
os.exit(0)
elseif a == "-v" then
print(LibDeflate._COPYRIGHT)
@@ -3636,10 +3464,7 @@ if io and os and debug and _G.arg then
end
local input_data = input:read("*all")
- local configs = {
- level = level,
- strategy = strategy,
- }
+ local configs = { level = level, strategy = strategy }
local output_data
if not is_decompress then
if not is_zlib then
diff --git a/KkthnxUI/Libraries/LibRangeCheck-3.0/LibRangeCheck-3.0.lua b/KkthnxUI/Libraries/LibRangeCheck-3.0/LibRangeCheck-3.0.lua
index 7fa898b5..16a3dfb5 100644
--- a/KkthnxUI/Libraries/LibRangeCheck-3.0/LibRangeCheck-3.0.lua
+++ b/KkthnxUI/Libraries/LibRangeCheck-3.0/LibRangeCheck-3.0.lua
@@ -40,7 +40,7 @@ License: MIT
-- @class file
-- @name LibRangeCheck-3.0
local MAJOR_VERSION = "LibRangeCheck-3.0-KkthnxUI"
-local MINOR_VERSION = 23 -- based off real minor version: 26
+local MINOR_VERSION = 24 -- based off real minor version: 26
-- GLOBALS: LibStub, CreateFrame
diff --git a/KkthnxUI/Modules/ActionBars/Elements/Extrabar.lua b/KkthnxUI/Modules/ActionBars/Elements/Extrabar.lua
index 19659184..69f26fc1 100644
--- a/KkthnxUI/Modules/ActionBars/Elements/Extrabar.lua
+++ b/KkthnxUI/Modules/ActionBars/Elements/Extrabar.lua
@@ -69,4 +69,24 @@ function Module:CreateExtrabar()
self:SetParent(zoneFrame)
end
end)
+
+ -- Extra button range, needs review
+ hooksecurefunc("ActionButton_UpdateRangeIndicator", function(self, checksRange, inRange)
+ if not self.action then
+ return
+ end
+
+ if checksRange and not inRange then
+ self.icon:SetVertexColor(0.8, 0.1, 0.1)
+ else
+ local isUsable, notEnoughMana = IsUsableAction(self.action)
+ if isUsable then
+ self.icon:SetVertexColor(1, 1, 1)
+ elseif notEnoughMana then
+ self.icon:SetVertexColor(0.5, 0.5, 1)
+ else
+ self.icon:SetVertexColor(0.4, 0.4, 0.4)
+ end
+ end
+ end)
end
diff --git a/KkthnxUI/Modules/Auras/Lumos/Evoker.lua b/KkthnxUI/Modules/Auras/Lumos/Evoker.lua
index bf249450..38e7495c 100644
--- a/KkthnxUI/Modules/Auras/Lumos/Evoker.lua
+++ b/KkthnxUI/Modules/Auras/Lumos/Evoker.lua
@@ -58,9 +58,9 @@ function Module:ChantLumos(self)
local hasBurst = GetUnitAura("player", 359618, "HELPFUL") --高亮精华迸发
if hasBurst then
K.ShowOverlayGlow(button3)
- K.ShowOverlayGlow(button3)
+ K.ShowOverlayGlow(button4)
else
- K.HideOverlayGlow(button4)
+ K.HideOverlayGlow(button3)
K.HideOverlayGlow(button4)
end
end
@@ -81,9 +81,9 @@ function Module:ChantLumos(self)
local hasBurst = GetUnitAura("player", 369299, "HELPFUL") --高亮精华迸发
if hasBurst then
K.ShowOverlayGlow(button2)
- K.ShowOverlayGlow(button2)
+ K.ShowOverlayGlow(button3)
else
- K.HideOverlayGlow(button3)
+ K.HideOverlayGlow(button2)
K.HideOverlayGlow(button3)
end
end
diff --git a/KkthnxUI/Modules/Automation/Elements/Screenshot.lua b/KkthnxUI/Modules/Automation/Elements/Screenshot.lua
index af7d21c9..4d234d91 100644
--- a/KkthnxUI/Modules/Automation/Elements/Screenshot.lua
+++ b/KkthnxUI/Modules/Automation/Elements/Screenshot.lua
@@ -8,9 +8,11 @@ local Screenshot = Screenshot
-- Achievement screenshot
local ScreenShotFrame
-local function ScreenShotOnEvent(alreadyEarnedOnAccount)
- print(alreadyEarnedOnAccount)
- if alreadyEarnedOnAccount then
+local function ScreenShotOnEvent(achievementID, alreadyEarned)
+ print("achievementID", achievementID)
+ print("alreadyEarned", alreadyEarned)
+
+ if alreadyEarned then
return
end
diff --git a/KkthnxUI/Modules/Blizzard/Elements/Fixes.lua b/KkthnxUI/Modules/Blizzard/Elements/Fixes.lua
new file mode 100644
index 00000000..29f5a034
--- /dev/null
+++ b/KkthnxUI/Modules/Blizzard/Elements/Fixes.lua
@@ -0,0 +1,127 @@
+local K = KkthnxUI[1]
+
+-- Unregister talent event
+if PlayerTalentFrame then
+ PlayerTalentFrame:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
+else
+ hooksecurefunc("TalentFrame_LoadUI", function()
+ PlayerTalentFrame:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
+ end)
+end
+
+-- Fix blizz bug in addon list
+local _AddonTooltip_Update = AddonTooltip_Update
+function AddonTooltip_Update(owner)
+ if not owner then
+ return
+ end
+ if owner:GetID() < 1 then
+ return
+ end
+ _AddonTooltip_Update(owner)
+end
+
+-- Fix Drag Collections taint
+do
+ local done
+ local function setupMisc(event, addon)
+ if event == "ADDON_LOADED" and addon == "Blizzard_Collections" then
+ -- Fix undragable issue
+ local checkBox = WardrobeTransmogFrame.ToggleSecondaryAppearanceCheckbox
+ checkBox.Label:ClearAllPoints()
+ checkBox.Label:SetPoint("LEFT", checkBox, "RIGHT", 2, 1)
+ checkBox.Label:SetWidth(152)
+
+ CollectionsJournal:HookScript("OnShow", function()
+ if not done then
+ if InCombatLockdown() then
+ K:RegisterEvent("PLAYER_REGEN_ENABLED", setupMisc)
+ else
+ K.CreateMoverFrame(CollectionsJournal)
+ end
+ done = true
+ end
+ end)
+ K:UnregisterEvent(event, setupMisc)
+ elseif event == "PLAYER_REGEN_ENABLED" then
+ K.CreateMoverFrame(CollectionsJournal)
+ K:UnregisterEvent(event, setupMisc)
+ end
+ end
+
+ K:RegisterEvent("ADDON_LOADED", setupMisc)
+end
+
+-- Select target when click on raid units
+do
+ local function fixRaidGroupButton()
+ for i = 1, 40 do
+ local bu = _G["RaidGroupButton" .. i]
+ if bu and bu.unit and not bu.clickFixed then
+ bu:SetAttribute("type", "target")
+ bu:SetAttribute("unit", bu.unit)
+
+ bu.clickFixed = true
+ end
+ end
+ end
+
+ local function setupMisc(event, addon)
+ if event == "ADDON_LOADED" and addon == "Blizzard_RaidUI" then
+ if not InCombatLockdown() then
+ fixRaidGroupButton()
+ else
+ K:RegisterEvent("PLAYER_REGEN_ENABLED", setupMisc)
+ end
+ K:UnregisterEvent(event, setupMisc)
+ elseif event == "PLAYER_REGEN_ENABLED" then
+ if RaidGroupButton1 and RaidGroupButton1:GetAttribute("type") ~= "target" then
+ fixRaidGroupButton()
+ K:UnregisterEvent(event, setupMisc)
+ end
+ end
+ end
+
+ K:RegisterEvent("ADDON_LOADED", setupMisc)
+end
+
+-- Fix blizz guild news hyperlink error
+do
+ local function fixGuildNews(event, addon)
+ if addon ~= "Blizzard_GuildUI" then
+ return
+ end
+
+ local _GuildNewsButton_OnEnter = GuildNewsButton_OnEnter
+ function GuildNewsButton_OnEnter(self)
+ if not (self.newsInfo and self.newsInfo.whatText) then
+ return
+ end
+ _GuildNewsButton_OnEnter(self)
+ end
+
+ K:UnregisterEvent(event, fixGuildNews)
+ end
+
+ K:RegisterEvent("ADDON_LOADED", fixGuildNews)
+end
+
+-- Fix guild news jam
+do
+ local lastTime, timeGap = 0, 1.5
+ local function updateGuildNews(self, event)
+ if event == "PLAYER_ENTERING_WORLD" then
+ QueryGuildNews()
+ else
+ if self:IsVisible() then
+ local nowTime = GetTime()
+ if nowTime - lastTime > timeGap then
+ CommunitiesGuildNews_Update(self)
+ lastTime = nowTime
+ end
+ end
+ end
+ end
+
+ CommunitiesFrameGuildDetailsFrameNews:SetScript("OnEvent", updateGuildNews)
+end
diff --git a/KkthnxUI/Modules/DataText/Elements/Gold.lua b/KkthnxUI/Modules/DataText/Elements/Gold.lua
index 4677fa7b..46a7b03c 100644
--- a/KkthnxUI/Modules/DataText/Elements/Gold.lua
+++ b/KkthnxUI/Modules/DataText/Elements/Gold.lua
@@ -15,7 +15,6 @@ local C_Timer_NewTicker = C_Timer.NewTicker
local C_WowTokenPublic_GetCurrentMarketPrice = C_WowTokenPublic.GetCurrentMarketPrice
local C_WowTokenPublic_UpdateMarketPrice = C_WowTokenPublic.UpdateMarketPrice
local GameTooltip = GameTooltip
-local GetAutoCompleteRealms = GetAutoCompleteRealms
local GetMoney = GetMoney
local IsControlKeyDown = IsControlKeyDown
local NO = NO
@@ -25,6 +24,7 @@ local YES = YES
-- Variables
local slotString = BAGSLOTTEXT .. ": %s%d"
+local showGoldGap = 100 * 1e4
local ticker
local profit = 0
local spent = 0
@@ -213,11 +213,13 @@ local function OnEnter(self) -- We need self for the bags since we use this on t
GameTooltip:AddLine(CHARACTER_BUTTON .. ":", 0.5, 0.7, 1)
if KkthnxUIDB.Gold[myRealm] then
for k, v in pairs(KkthnxUIDB.Gold[myRealm]) do
- local name = Ambiguate(k .. "-" .. myRealm, "none")
local gold, class, faction = unpack(v)
- local r, g, b = K.ColorClass(class)
- GameTooltip:AddDoubleLine(getFactionIcon(faction) .. getClassIcon(class) .. name, K.FormatMoney(gold), r, g, b, 1, 1, 1)
- totalGold = totalGold + gold
+ local name = Ambiguate(k .. "-" .. myRealm, "none")
+ if gold > showGoldGap or UnitIsUnit(name, "player") then
+ local r, g, b = K.ColorClass(class)
+ GameTooltip:AddDoubleLine(getFactionIcon(faction) .. getClassIcon(class) .. name, K.FormatMoney(gold), r, g, b, 1, 1, 1)
+ totalGold = totalGold + gold
+ end
end
end
@@ -226,12 +228,14 @@ local function OnEnter(self) -- We need self for the bags since we use this on t
if realm ~= myRealm then
for k, v in pairs(data) do
local gold, class, faction = unpack(v)
- if isShiftKeyDown then -- show other realms while holding shift
- local name = Ambiguate(k .. "-" .. realm, "none")
- local r, g, b = K.ColorClass(class)
- GameTooltip:AddDoubleLine(getFactionIcon(faction) .. getClassIcon(class) .. name, K.FormatMoney(gold), r, g, b, 1, 1, 1)
+ if gold > showGoldGap then
+ if isShiftKeyDown then -- show other realms while holding shift
+ local name = Ambiguate(k .. "-" .. realm, "none")
+ local r, g, b = K.ColorClass(class)
+ GameTooltip:AddDoubleLine(getFactionIcon(faction) .. getClassIcon(class) .. name, K.FormatMoney(gold), r, g, b, 1, 1, 1)
+ end
+ totalGold = totalGold + gold
end
- totalGold = totalGold + gold
end
end
end
diff --git a/KkthnxUI/Modules/DataText/Elements/Time.lua b/KkthnxUI/Modules/DataText/Elements/Time.lua
index fcd11ad3..5d56d599 100644
--- a/KkthnxUI/Modules/DataText/Elements/Time.lua
+++ b/KkthnxUI/Modules/DataText/Elements/Time.lua
@@ -90,6 +90,7 @@ local mapAreaPoiIDs = {
local questlist = {
{ name = "Feast of Winter Veil", id = 6983 },
{ name = "Blingtron Daily Gift", id = 34774 },
+ { name = "500 Timewarped Badges", id = 83285, texture = 6006158 }, -- Vanilla
{ name = "500 Timewarped Badges", id = 40168, texture = 1129674 }, -- TBC
{ name = "500 Timewarped Badges", id = 40173, texture = 1129686 }, -- WotLK
{ name = "500 Timewarped Badges", id = 40786, texture = 1304688 }, -- Cata
diff --git a/KkthnxUI/Modules/Load_Modules.xml b/KkthnxUI/Modules/Load_Modules.xml
index a27c5150..3750925b 100644
--- a/KkthnxUI/Modules/Load_Modules.xml
+++ b/KkthnxUI/Modules/Load_Modules.xml
@@ -17,6 +17,7 @@
+
@@ -161,6 +162,7 @@
+
diff --git a/KkthnxUI/Modules/Miscellaneous/Core.lua b/KkthnxUI/Modules/Miscellaneous/Core.lua
index b4fe5c64..f767c1df 100644
--- a/KkthnxUI/Modules/Miscellaneous/Core.lua
+++ b/KkthnxUI/Modules/Miscellaneous/Core.lua
@@ -52,17 +52,6 @@ function Module:RegisterMisc(name, func)
end
end
--- Unregister Talent Event
-local function unregisterTalentEvent()
- if PlayerTalentFrame then
- PlayerTalentFrame:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
- else
- hooksecurefunc("TalentFrame_LoadUI", function()
- PlayerTalentFrame:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
- end)
- end
-end
-
-- Enable Auto Chat Bubbles
local function enableAutoBubbles()
if C["Misc"].AutoBubbles then
@@ -74,6 +63,11 @@ local function enableAutoBubbles()
end
end
+-- Readycheck sound on master channel
+K:RegisterEvent("READY_CHECK", function()
+ PlaySound(SOUNDKIT.READY_CHECK, "master")
+end)
+
-- Modify Delete Dialog
local function modifyDeleteDialog()
local confirmationText = DELETE_GOOD_ITEM:gsub("[\r\n]", "@")
@@ -130,23 +124,6 @@ local function modifyDeleteDialog()
end)
end
--- Fix Addon Tooltip
-local function fixAddonTooltip()
- local _AddonTooltip_Update = AddonTooltip_Update
- function AddonTooltip_Update(owner)
- if owner and owner:GetID() >= 1 then
- _AddonTooltip_Update(owner)
- end
- end
-end
-
--- Fix Party Guide Promote
-local function fixPartyGuidePromote()
- if not PROMOTE_GUIDE then
- PROMOTE_GUIDE = PARTY_PROMOTE_GUIDE
- end
-end
-
-- Enable Module and Initialize Miscellaneous Modules
function Module:OnEnable()
for name, func in next, KKUI_MISC_MODULE do
@@ -159,13 +136,12 @@ function Module:OnEnable()
"CreateBossBanner",
"CreateBossEmote",
"CreateCustomWaypoint",
- "CreateDeathCounter",
"CreateDurabilityFrameMove",
"CreateErrorFrameToggle",
"CreateGUIGameMenuButton",
"CreateMinimapButtonToggle",
- "CreateObjectiveSizeUpdate",
- "CreateQuestSizeUpdate",
+ -- "CreateObjectiveSizeUpdate",
+ -- "CreateQuestSizeUpdate",
"CreateTicketStatusFrameMove",
"CreateTradeTargetInfo",
"CreateVehicleSeatMover",
@@ -191,11 +167,8 @@ function Module:OnEnable()
end
hooksecurefunc(BNToastFrame, "SetPoint", Module.PostBNToastMove)
- unregisterTalentEvent()
enableAutoBubbles()
modifyDeleteDialog()
- fixAddonTooltip()
- fixPartyGuidePromote()
end
-- BNToast Frame Mover Setup
@@ -462,18 +435,18 @@ function Module:CreateErrorFrameToggle()
end
end
--- Create Quest Size Update
-function Module:CreateQuestSizeUpdate()
- QuestTitleFont:SetFont(QuestTitleFont:GetFont(), C["Skins"].QuestFontSize + 3, "")
- QuestFont:SetFont(QuestFont:GetFont(), C["Skins"].QuestFontSize + 1, "")
- QuestFontNormalSmall:SetFont(QuestFontNormalSmall:GetFont(), C["Skins"].QuestFontSize, "")
-end
+-- -- Create Quest Size Update
+-- function Module:CreateQuestSizeUpdate()
+-- QuestTitleFont:SetFont(QuestTitleFont:GetFont(), C["Skins"].QuestFontSize + 3, "")
+-- QuestFont:SetFont(QuestFont:GetFont(), C["Skins"].QuestFontSize + 1, "")
+-- QuestFontNormalSmall:SetFont(QuestFontNormalSmall:GetFont(), C["Skins"].QuestFontSize, "")
+-- end
--- Create Objective Size Update
-function Module:CreateObjectiveSizeUpdate()
- ObjectiveFont:SetFontObject(K.UIFont)
- ObjectiveFont:SetFont(ObjectiveFont:GetFont(), C["Skins"].ObjectiveFontSize, select(3, ObjectiveFont:GetFont()))
-end
+-- -- Create Objective Size Update
+-- function Module:CreateObjectiveSizeUpdate()
+-- ObjectiveFont:SetFontObject(K.UIFont)
+-- ObjectiveFont:SetFont(ObjectiveFont:GetFont(), C["Skins"].ObjectiveFontSize, select(3, ObjectiveFont:GetFont()))
+-- end
-- TradeFrame Hook
function Module:CreateTradeTargetInfo()
@@ -551,84 +524,6 @@ do
end
end
--- Fix Collection Taint
-do
- local done
- local function fixCollectionTaint(event, addon)
- if event == "ADDON_LOADED" and addon == "Blizzard_Collections" then
- local checkBox = WardrobeTransmogFrame.ToggleSecondaryAppearanceCheckbox
- checkBox.Label:ClearAllPoints()
- checkBox.Label:SetPoint("LEFT", checkBox, "RIGHT", 2, 1)
- checkBox.Label:SetWidth(152)
-
- CollectionsJournal:HookScript("OnShow", function()
- if not done then
- if InCombatLockdown() then
- K:RegisterEvent("PLAYER_REGEN_ENABLED", fixCollectionTaint)
- else
- K.CreateMoverFrame(CollectionsJournal)
- end
- done = true
- end
- end)
- K:UnregisterEvent(event, fixCollectionTaint)
- elseif event == "PLAYER_REGEN_ENABLED" then
- K.CreateMoverFrame(CollectionsJournal)
- K:UnregisterEvent(event, fixCollectionTaint)
- end
- end
- K:RegisterEvent("ADDON_LOADED", fixCollectionTaint)
-end
-
--- Fix Raid Group Button Targeting
-do
- local function fixRaidGroupButton()
- for i = 1, 40 do
- local bu = _G["RaidGroupButton" .. i]
- if bu and bu.unit and not bu.clickFixed then
- bu:SetAttribute("type", "target")
- bu:SetAttribute("unit", bu.unit)
- bu.clickFixed = true
- end
- end
- end
-
- local function setupfixRaidGroup(event, addon)
- if event == "ADDON_LOADED" and addon == "Blizzard_RaidUI" then
- if not InCombatLockdown() then
- fixRaidGroupButton()
- else
- K:RegisterEvent("PLAYER_REGEN_ENABLED", setupfixRaidGroup)
- end
- K:UnregisterEvent(event, setupfixRaidGroup)
- elseif event == "PLAYER_REGEN_ENABLED" then
- if RaidGroupButton1 and RaidGroupButton1:GetAttribute("type") ~= "target" then
- fixRaidGroupButton()
- K:UnregisterEvent(event, setupfixRaidGroup)
- end
- end
- end
- K:RegisterEvent("ADDON_LOADED", setupfixRaidGroup)
-end
-
--- Fix Guild News Hyperlink Error
-do
- local function fixGuildNews(event, addon)
- if addon ~= "Blizzard_GuildUI" then
- return
- end
- local _GuildNewsButton_OnEnter = GuildNewsButton_OnEnter
- function GuildNewsButton_OnEnter(self)
- if not (self.newsInfo and self.newsInfo.whatText) then
- return
- end
- _GuildNewsButton_OnEnter(self)
- end
- K:UnregisterEvent(event, fixGuildNews)
- end
- K:RegisterEvent("ADDON_LOADED", fixGuildNews)
-end
-
-- Resurrect Sound on Request
do
local function soundOnResurrect()
diff --git a/KkthnxUI/Modules/Miscellaneous/Elements/QuickJoin.lua b/KkthnxUI/Modules/Miscellaneous/Elements/QuickJoin.lua
index 0ada6e57..2e436012 100644
--- a/KkthnxUI/Modules/Miscellaneous/Elements/QuickJoin.lua
+++ b/KkthnxUI/Modules/Miscellaneous/Elements/QuickJoin.lua
@@ -56,7 +56,7 @@ function Module:AddAutoAcceptButton()
local lastTime = 0
local function clickInviteButton(button)
if button.applicantID and button.InviteButton:IsEnabled() then
- button.InviteButton:Click()
+ C_LFGList.InviteApplicant(button.applicantID)
end
end
diff --git a/KkthnxUI/Modules/Skins/Blizzard/FrameXML/Menu.lua b/KkthnxUI/Modules/Skins/Blizzard/FrameXML/Menu.lua
index b97ca30b..6f0777c9 100644
--- a/KkthnxUI/Modules/Skins/Blizzard/FrameXML/Menu.lua
+++ b/KkthnxUI/Modules/Skins/Blizzard/FrameXML/Menu.lua
@@ -22,6 +22,7 @@ table_insert(C.defaultThemes, function()
menuFrame.bg = backdrops[menuFrame]
else
menuFrame.bg = CreateFrame("Frame", nil, menuFrame, "BackdropTemplate")
+ menuFrame.bg:SetFrameLevel(menuFrame:GetFrameLevel())
menuFrame.bg:SetAllPoints(menuFrame)
menuFrame.bg:CreateBorder()
backdrops[menuFrame] = menuFrame.bg
diff --git a/KkthnxUI/Modules/Skins/Blizzard/ProfessionsBook.lua b/KkthnxUI/Modules/Skins/Blizzard/ProfessionsBook.lua
new file mode 100644
index 00000000..1d7891da
--- /dev/null
+++ b/KkthnxUI/Modules/Skins/Blizzard/ProfessionsBook.lua
@@ -0,0 +1,99 @@
+local K, C = KkthnxUI[1], KkthnxUI[2]
+
+local pairs = pairs
+local GetProfessionInfo = GetProfessionInfo
+local hooksecurefunc = hooksecurefunc
+
+local function HandleSkillButton(button)
+ if not button or InCombatLockdown() then
+ return
+ end
+
+ button:SetCheckedTexture(0)
+ button:SetPushedTexture(0)
+
+ if button.IconTexture then
+ button.IconTexture:SetTexCoord(unpack(K.TexCoords))
+ button.IconTexture:SetPoint("TOPLEFT", button, "TOPLEFT", 3, -3)
+ button.IconTexture:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -3, 3)
+ if not button.KKUI_Border then
+ button:CreateBorder(nil, nil, nil, nil, -7, nil, nil, nil, nil, 3)
+ button.KKUI_Border = true
+ end
+ end
+
+ local nameFrame = _G[button:GetName() .. "NameFrame"]
+ if nameFrame then
+ nameFrame:Hide()
+ end
+end
+
+local function ReskinProfessionButton(professionButton)
+ local statusBar = professionButton.statusBar
+ statusBar:StripTextures()
+ statusBar:SetHeight(16)
+ statusBar:SetStatusBarTexture(K.GetTexture(C["General"].Texture))
+ statusBar:GetStatusBarTexture():SetGradient("VERTICAL", CreateColor(0, 0.6, 0, 1), CreateColor(0, 0.8, 0, 1))
+ statusBar.rankText:SetPoint("CENTER")
+ statusBar:CreateBorder()
+
+ if professionButton.SpellButton1 then
+ HandleSkillButton(professionButton.SpellButton1)
+ end
+ if professionButton.SpellButton2 then
+ HandleSkillButton(professionButton.SpellButton2)
+ end
+end
+
+local function ReskinProfessionIcons(professionIndex)
+ local professionButton = _G["PrimaryProfession" .. professionIndex]
+ local iconBorder = _G["PrimaryProfession" .. professionIndex .. "IconBorder"]
+ local professionIcon = professionButton.icon
+
+ iconBorder:Hide()
+ professionButton.professionName:ClearAllPoints()
+ professionButton.professionName:SetPoint("TOPLEFT", 100, -4)
+ professionIcon:SetAlpha(1)
+ professionIcon:SetDesaturated(false)
+ professionIcon:SetTexCoord(unpack(K.TexCoords))
+
+ local bg = CreateFrame("Frame", nil, professionButton)
+ bg:SetAllPoints(professionIcon)
+ bg:SetFrameLevel(professionButton:GetFrameLevel())
+ bg:CreateBorder()
+end
+
+local function HideTutorialButtons()
+ if C["General"].NoTutorialButtons then
+ _G.ProfessionsBookFrameTutorialButton:Hide()
+ end
+end
+
+C.themes["Blizzard_ProfessionsBook"] = function()
+ if not C["Skins"].BlizzardFrames then
+ return
+ end
+
+ local professions = { "PrimaryProfession1", "PrimaryProfession2", "SecondaryProfession1", "SecondaryProfession2", "SecondaryProfession3" }
+ for i, profession in pairs(professions) do
+ ReskinProfessionButton(_G[profession])
+ if i <= 2 then
+ ReskinProfessionIcons(i)
+ end
+ end
+
+ hooksecurefunc("FormatProfession", function(frame, index)
+ if InCombatLockdown() then
+ return
+ end
+
+ if index then
+ local _, texture = GetProfessionInfo(index)
+ if frame.icon and texture then
+ frame.icon:SetTexture(texture)
+ end
+ end
+ end)
+
+ HideTutorialButtons()
+end
diff --git a/KkthnxUI/Modules/UnitFrames/Elements/Tracking.lua b/KkthnxUI/Modules/UnitFrames/Elements/Tracking.lua
index 4335af4f..c1bd5f21 100644
--- a/KkthnxUI/Modules/UnitFrames/Elements/Tracking.lua
+++ b/KkthnxUI/Modules/UnitFrames/Elements/Tracking.lua
@@ -5,6 +5,24 @@ local Tracking = CreateFrame("Frame", "KKUI_Tracking", UIParent)
local ArrowUp = "Interface\\Buttons\\Arrow-Up-Down"
local ArrowDown = "Interface\\Buttons\\Arrow-Down-Down"
+do
+ local GetSpellInfo = GetSpellInfo
+ local C_Spell_GetSpellInfo = C_Spell.GetSpellInfo
+ Module.GetSpellInfo = function(spell)
+ if not spell then
+ return
+ end
+ if GetSpellInfo then
+ return GetSpellInfo(spell)
+ else
+ local info = C_Spell_GetSpellInfo(spell)
+ if info then
+ return info.name, info.rank, info.iconID, info.castTime, info.minRange, info.maxRange, info.spellID, info.originalIconID
+ end
+ end
+ end
+end
+
StaticPopupDialogs["TRACKING_ADD_PVE"] = {
text = "Which spell id would you like to add?",
button1 = ACCEPT,
@@ -12,7 +30,7 @@ StaticPopupDialogs["TRACKING_ADD_PVE"] = {
OnAccept = function(self)
local SpellID = tonumber(self.editBox:GetText())
local Table = KkthnxUIDB.Variables[K.Realm][K.Name].Tracking.PvE
- local Name, _, Icon = GetSpellInfo(SpellID)
+ local Name, _, Icon = Module.GetSpellInfo(SpellID)
local Values = { ["enable"] = true, ["priority"] = 1, ["stackThreshold"] = 0 }
local TrackingTitle = "|CFF00FF00[DEBUFF TRACKING] |r"
local PVETitle = "|CFF567AFF[PVE] |r"
@@ -45,7 +63,7 @@ StaticPopupDialogs["TRACKING_ADD_PVP"] = {
OnAccept = function(self)
local SpellID = tonumber(self.editBox:GetText())
local Table = KkthnxUIDB.Variables[K.Realm][K.Name].Tracking.PvP
- local Name, _, Icon = GetSpellInfo(SpellID)
+ local Name, _, Icon = Module.GetSpellInfo(SpellID)
local Values = { ["enable"] = true, ["priority"] = 1, ["stackThreshold"] = 0 }
local TrackingTitle = "|CFF00FF00[DEBUFF TRACKING] |r"
local PVPTitle = "|CFFFF5252[PVP] |r"
@@ -80,7 +98,7 @@ function Tracking:GetSpell(button, cat)
Count = Count + 1
if Count == ID then
- local Name, _, IconPath = GetSpellInfo(SpellID)
+ local Name, _, IconPath = Module.GetSpellInfo(SpellID)
return SpellID, Name, IconPath
end
diff --git a/KkthnxUI/Modules/UnitFrames/Groups/Raid.lua b/KkthnxUI/Modules/UnitFrames/Groups/Raid.lua
index 065bc125..aa67e714 100644
--- a/KkthnxUI/Modules/UnitFrames/Groups/Raid.lua
+++ b/KkthnxUI/Modules/UnitFrames/Groups/Raid.lua
@@ -329,9 +329,6 @@ function Module:CreateRaid()
RaidDebuffs.cd:SetHideCountdownNumbers(true)
RaidDebuffs.cd:SetAlpha(0.7)
- RaidDebuffs.onlyMatchSpellID = true
- RaidDebuffs.showDispellableDebuff = true
-
local parentFrame = CreateFrame("Frame", nil, RaidDebuffs)
parentFrame:SetAllPoints()
parentFrame:SetFrameLevel(RaidDebuffs:GetFrameLevel() + 6)
@@ -345,9 +342,6 @@ function Module:CreateRaid()
RaidDebuffs.count:SetPoint("BOTTOMRIGHT", RaidDebuffs, "BOTTOMRIGHT", 2, 0)
RaidDebuffs.count:SetTextColor(1, 0.9, 0)
- RaidDebuffs.forceShow = false
- RaidDebuffs.ShowDispellableDebuff = true
-
self.RaidDebuffs = RaidDebuffs
end
diff --git a/KkthnxUI/Modules/UnitFrames/Plugins/oUF_RaidDebuffs.lua b/KkthnxUI/Modules/UnitFrames/Plugins/oUF_RaidDebuffs.lua
index 83a3db84..d3bf24b1 100644
--- a/KkthnxUI/Modules/UnitFrames/Plugins/oUF_RaidDebuffs.lua
+++ b/KkthnxUI/Modules/UnitFrames/Plugins/oUF_RaidDebuffs.lua
@@ -1,20 +1,43 @@
---[=[
- Shows Debuffs on Unit Frames.
-
- Sub-Widgets will be created if not provided.
-
- Member Variables
- .font Font details used for timer and stacks
- .fontheight | used if Sub-Widgets aren't provided
- .fontFlags | not needed otherwise
-
- Sub-Widgets
- .icon The Icon/Texture of the debuff
- .cd A Cooldown frame
- .timer A Text showing the remaining duration
- .count A Text showing the number of stacks
- .Backdrop Backdrops border is used to indicate the debuff type
---]=]
+--[[
+# Element: Debuff Indicator
+
+ Shows a Debuff icon, duration and debuff type indication for debuffs the player can dispel.
+
+## Widget
+
+ RaidDebuffs - A 'Frame' used to display the debuff.
+
+## Sub-Widgets
+
+ .icon - The 'Texture' of the debuff
+ .cd - A 'Frame' with 'CooldownFrameTemplate'
+ .timer - A 'FontString' showing the remaining duration
+ .count - A 'FontString' showing the number of stacks
+ .Backdrop - Backdrops border is used to indicate the debuff type
+
+## Notes
+
+ Sub-Widgets will be created if not provided. The font options are only used in that case.
+ Font defaults to (NumberFontNormal, 12, nil)
+
+## Options
+
+ .font - Font used for timer and stacks (Font?)
+ .fontheight - Font height (number?)
+ .fontFlags - Font flags (string?)
+
+## Examples
+
+ -- position and size
+ local RaidDebuffs = CreateFrame("Frame", nil, Health)
+ RaidDebuffs:SetHeight(DebuffSize)
+ RaidDebuffs:SetWidth(DebuffSize)
+ RaidDebuffs:SetPoint("CENTER", Health)
+ RaidDebuffs:SetFrameLevel(Health:GetFrameLevel() + 10)
+
+ -- Register it with oUF
+ self.RaidDebuffs = RaidDebuffs
+--]]
local _, ns = ...
local oUF = ns.oUF or oUF
@@ -28,7 +51,9 @@ local ForEachAura = _G.AuraUtil.ForEachAura
local NewTicker = _G.C_Timer.NewTicker
local debuffColor = _G.DebuffTypeColor
---[[ Holds the dispel priority list. ]]
+local cacheWrite
+
+-- Holds the dispel priority list.
local priorityList = {
Magic = 4,
Curse = 3,
@@ -36,7 +61,7 @@ local priorityList = {
Disease = 1,
}
---[[ Holds which dispel types can currently be handled. Initialized to false for all. ]]
+-- Holds which dispel types can currently be handled. Initialized to false for all.
local dispelList = {
Magic = false,
Poison = false,
@@ -44,7 +69,7 @@ local dispelList = {
Curse = false,
}
---[[ Class functions to update the dispel types which can be handled. ]]
+-- Class functions to update the dispel types which can be handled.
local canDispel = {
DRUID = {
retail = function()
@@ -188,13 +213,8 @@ local canDispel = {
},
}
---[[ Event handler for SPELLS_CHANGED.
-
-Only fires for a player frame.
-
-* self - oUF UnitFrame
-* event - SPELLS_CHANGED
-]]
+-- Event handler for SPELLS_CHANGED.
+-- Only fires for a player frame.
local function UpdateDispelList(self, event)
if event == "SPELLS_CHANGED" then
local project = (oUF.isRetail and "retail") or (oUF.isClassic and "classic") or "other"
@@ -202,10 +222,7 @@ local function UpdateDispelList(self, event)
end
end
---[[ Returns a format string for timers.
-
-* time - Time in seconds
-]]
+-- Returns a format string for timers.
local function timeFormat(time)
if time < 3 then
return "%.1f"
@@ -216,12 +233,7 @@ local function timeFormat(time)
end
end
---[[ Show the debuff element.
-
-* self - oUF UnitFrame
-* unit - Tracked unit
-* auraInstanceID - auraInstanceID of the debuff to be displayed
-]]
+-- Show the debuff element for auraInstanceID.
local function ShowElement(self, unit, auraInstanceID)
local element = self.RaidDebuffs
local debuffCache = element.debuffCache
@@ -249,8 +261,7 @@ local function ShowElement(self, unit, auraInstanceID)
else
-- aura expired but we got no event for it
ticker:Cancel()
- debuffCache[auraInstanceID] = nil
- element.SelectPrioDebuff(self, unit)
+ cacheWrite(self, unit, auraInstanceID, nil, nil)
end
end)
end
@@ -260,11 +271,7 @@ local function ShowElement(self, unit, auraInstanceID)
end
end
---[[ Hide the debuff element.
-
-* self - oUF UnitFrame
-* unit - Tracked unit
-]]
+-- Hide the debuff element.
local function HideElement(self, unit)
local element = self.RaidDebuffs
local color = debuffColor["none"]
@@ -281,11 +288,7 @@ local function HideElement(self, unit)
element:Hide()
end
---[[ Select the Debuff with highest priority to display, hide element when none left.
-
-* self - oUF UnitFrame
-* unit - Tracked unit
-]]
+-- Select the Debuff with highest priority to display, hide element when none left.
local function SelectPrioDebuff(self, unit)
local debuffCache = self.RaidDebuffs.debuffCache
local auraInstanceID = nil
@@ -306,39 +309,49 @@ local function SelectPrioDebuff(self, unit)
end
end
---[[ Filter for dispellable debuffs.
-
-* self - oUF UnitFrame
-* unit - Tracked unit
-* AuraData - (optional) UNIT_AURA event payload
-]]
-local function FilterAura(self, unit, AuraData)
- if AuraData and AuraData.isHarmful then
- local debuffCache = self.RaidDebuffs.debuffCache
- local dispelName = AuraData.dispelName
-
- if dispelName and dispelList[dispelName] then
- debuffCache[AuraData.auraInstanceID] = {
- priority = priorityList[dispelName],
- AuraData = AuraData,
- }
- SelectPrioDebuff(self, unit)
- end
+-- After each write to the cache the display also needs to be updated.
+-- Struncture of the cache is: table>
+cacheWrite = function(self, unit, auraInstanceID, priority, AuraData)
+ local debuffCache = self.RaidDebuffs.debuffCache
+
+ if not priority or not AuraData then
+ debuffCache[auraInstanceID] = nil
+ else
+ debuffCache[auraInstanceID] = {
+ priority = priority,
+ AuraData = AuraData,
+ }
end
+
+ SelectPrioDebuff(self, unit)
end
---[[ Reset cache and full scan when isFullUpdate.
+-- Filter for dispellable debuffs and update the cache.
+local function FilterAura(self, unit, auraInstanceID, AuraData)
+ local debuffCache = self.RaidDebuffs.debuffCache
+
+ if AuraData then -- added aura or valid update
+ if AuraData.isHarmful then
+ local dispelName = AuraData.dispelName
-* self - oUF UnitFrame
-* unit - Tracked unit
-]]
+ if dispelName and dispelList[dispelName] then
+ cacheWrite(self, unit, auraInstanceID, priorityList[dispelName], AuraData)
+ end
+ end
+ elseif debuffCache[auraInstanceID] then -- removed aura or invalid update
+ cacheWrite(self, unit, auraInstanceID, nil, nil)
+ end -- aura we dont care about
+end
+
+-- Reset cache and full scan when isFullUpdate.
local function FullUpdate(self, unit)
table.wipe(self.RaidDebuffs.debuffCache)
+ HideElement(self, unit)
if ForEachAura then
-- Mainline iteration-style.
ForEachAura(unit, "HARMFUL", nil, function(AuraData)
- FilterAura(self, unit, AuraData)
+ FilterAura(self, unit, AuraData.auraInstanceID, AuraData)
end, true)
else
-- Classic iteration-style.
@@ -347,20 +360,14 @@ local function FullUpdate(self, unit)
repeat
AuraData = GetAuraDataByIndex(unit, i, "HARMFUL")
if AuraData then
- FilterAura(self, unit, AuraData)
+ FilterAura(self, unit, AuraData.auraInstanceID, AuraData)
end
i = i + 1
until not AuraData
end
end
---[[ Event handler for UNIT_AURA.
-
-* self - oUF UnitFrame
-* event - UNIT_AURA
-* unit - Payload of event: unitTarget
-* updateInfo - Payload of event: UnitAuraUpdateInfo
-]]
+-- Event handler for UNIT_AURA.
local function Update(self, event, unit, updateInfo)
-- Exit when unit doesn't match or target can't be assisted
if event ~= "UNIT_AURA" or self.unit ~= unit or not UnitCanAssist("player", unit) then
@@ -373,26 +380,20 @@ local function Update(self, event, unit, updateInfo)
end
if updateInfo.removedAuraInstanceIDs then
- local debuffCache = self.RaidDebuffs.debuffCache
for _, auraInstanceID in pairs(updateInfo.removedAuraInstanceIDs) do
- if debuffCache[auraInstanceID] then
- debuffCache[auraInstanceID] = nil
- SelectPrioDebuff(self, unit)
- end
+ FilterAura(self, unit, auraInstanceID, nil)
end
end
if updateInfo.updatedAuraInstanceIDs then
for _, auraInstanceID in pairs(updateInfo.updatedAuraInstanceIDs) do
- if auraInstanceID then
- FilterAura(self, unit, GetAuraDataByAuraInstanceID(unit, auraInstanceID))
- end
+ FilterAura(self, unit, auraInstanceID, GetAuraDataByAuraInstanceID(unit, auraInstanceID))
end
end
if updateInfo.addedAuras then
for _, AuraData in pairs(updateInfo.addedAuras) do
- FilterAura(self, unit, AuraData)
+ FilterAura(self, unit, AuraData.auraInstanceID, AuraData)
end
end
end
@@ -401,15 +402,11 @@ local function Enable(self)
local element = self.RaidDebuffs
if element and canDispel[playerClass] then
- --[[ Cache for active debuffs.
-
- table
- aura = {
- .priority - See priorityList
- .AuraData - See UNIT_AURA event payload
- }]]
element.debuffCache = {}
- element.SelectPrioDebuff = SelectPrioDebuff
+
+ element.font = element.font or NumberFontNormal
+ element.fontHeight = element.fontHeight or 12
+ element.fontFlags = element.fontFlags or ""
-- Create missing Sub-Widgets
if not element.icon then
diff --git a/KkthnxUI/Modules/UnitFrames/Units/Nameplates.lua b/KkthnxUI/Modules/UnitFrames/Units/Nameplates.lua
index e8008fc2..c855f12c 100644
--- a/KkthnxUI/Modules/UnitFrames/Units/Nameplates.lua
+++ b/KkthnxUI/Modules/UnitFrames/Units/Nameplates.lua
@@ -43,7 +43,7 @@ local UnitThreatSituation = UnitThreatSituation
local hooksecurefunc = hooksecurefunc
-- Custom data
-local aksCacheData = {} -- Cache for data of abilities used by players
+local mdtCacheData = {} -- Cache for data of abilities used by players
local customUnits = {} -- Custom unit data
local groupRoles = {} -- Group roles for players
local showPowerList = {} -- List of players who have their power displayed
@@ -598,55 +598,45 @@ function Module:UpdateClassIcon(self, unit)
end
end
--- Dungeon progress, AngryKeystones required
+-- Dungeon progress, MDT required
function Module:AddDungeonProgress(self)
if not C["Nameplate"].AKSProgress then
return
end
self.progressText = K.CreateFontString(self, 13, "", "", false, "LEFT", 0, 0)
+ self.progressText:ClearAllPoints()
self.progressText:SetPoint("LEFT", self, "RIGHT", 5, 0)
end
function Module:UpdateDungeonProgress(unit)
- if not self.progressText or not AngryKeystones_Data then
+ if not self.progressText or not MDT then
return
end
-
if unit ~= self.unit then
return
end
-
self.progressText:SetText("")
local name, _, _, _, _, _, _, _, _, scenarioType = C_Scenario_GetInfo()
if scenarioType == LE_SCENARIO_TYPE_CHALLENGE_MODE then
- local npcID = self.npcID
- local info = AngryKeystones_Data.progress[npcID]
- if info then
- local numCriteria = select(3, C_Scenario_GetStepInfo())
- local total = aksCacheData[name]
+ local value = MDT:GetEnemyForces(self.npcID)
+ if value and value > 0 then
+ local total = mdtCacheData[name]
if not total then
+ local numCriteria = select(3, C_Scenario_GetStepInfo())
for criteriaIndex = 1, numCriteria do
local criteriaInfo = C_ScenarioInfo.GetCriteriaInfo(criteriaIndex)
if criteriaInfo and criteriaInfo.isWeightedProgress then
- aksCacheData[name] = criteriaInfo.totalQuantity
- total = aksCacheData[name]
+ mdtCacheData[name] = criteriaInfo.totalQuantity
+ total = mdtCacheData[name]
break
end
end
end
- local value, valueCount
- for amount, count in pairs(info) do
- if not valueCount or count > valueCount or (count == valueCount and amount < value) then
- value = amount
- valueCount = count
- end
- end
-
- if value and total then
- self.progressText:SetText(string_format("+%.2f", value / total * 100))
+ if total then
+ self.progressText:SetText(format("+%.2f", value / total * 100))
end
end
end