Lua errors with TWW prepatch
KatyPurry opened this issue · 11 comments
Hello, I got some LUA errors with TWW Prepatch :
Message: Interface/AddOns/AngryKeystones/ObjectiveTracker.lua:134: hooksecurefunc(): Scenario_ChallengeMode_UpdateTime is not a function
Time: Wed Jul 24 09:27:02 2024
Count: 1
Stack: Interface/AddOns/AngryKeystones/ObjectiveTracker.lua:134: hooksecurefunc(): Scenario_ChallengeMode_UpdateTime is not a function
Locals
Message: Interface/AddOns/AngryKeystones/ProgressTracker.lua:334: hooksecurefunc(): ScenarioTrackerProgressBar_SetValue is not a function
Time: Wed Jul 24 09:27:02 2024
Count: 1
Stack: Interface/AddOns/AngryKeystones/ProgressTracker.lua:334: hooksecurefunc(): ScenarioTrackerProgressBar_SetValue is not a function
Locals:
Also this:
2x AngryKeystones/Config.lua:311: attempt to call global 'InterfaceOptions_AddCategory' (a nil value)
[string "@AngryKeystones/Config.lua"]:311: in function `CreatePanel'
[string "@AngryKeystones/Config.lua"]:330: in function `?'
[string "@AngryKeystones/Core.lua"]:212: in function `ForAllModules'
[string "@AngryKeystones/Core.lua"]:219: in function `?'
[string "@AngryKeystones/Core.lua"]:10: in function <AngryKeystones/Core.lua:6>
Locals:
self = <table> {
Name = "Config"
}
panel = Frame {
name = "Angry Keystones"
}
(*temporary) = nil
(*temporary) = Frame {
name = "Angry Keystones"
}
(*temporary) = "attempt to call global 'InterfaceOptions_AddCategory' (a nil value)"
Addon = <table> {
Modules = <table> {
}
ShortName = "AngryKeystones"
Version = "v0.30.12"
Name = "Angry Keystones"
ModulePrototype = <table> {
}
}
I’ll try to fix it soon, but won’t have access to the game for about a week. So there will be a bit of a delay.
10x WindTools [ERROR]
...vUI_WindTools/Modules/Skins/Addons/AngryKeystone.lua:13: hooksecurefunc(): Scenario_ChallengeMode_ShowBlock is not a function
[string "=[C]"]: ?
[string "@ElvUI_WindTools/Modules/Skins/Addons/AngryKeystone.lua"]:13: in function <...vUI_WindTools/Modules/Skins/Addons/AngryKeystone.lua:8>
[string "=[C]"]: ?
[string "@ElvUI_WindTools/Modules/Skins/Core.lua"]:344: in function CallLoadedAddon' [string "@ElvUI_WindTools/Modules/Skins/Core.lua"]:522: in function <ElvUI_WindTools/Modules/Skins/Core.lua:507> [string "=[C]"]: ? [string "@ElvUI_WindTools/Core/Core.lua"]:110: in function
InitializeModules'
[string "@ElvUI_WindTools/Initialize.lua"]:68: in function ?' [string "@ElvUI_Libraries/Core/LibElvUIPlugin-1.0-45/LibElvUIPlugin-1.0.lua"]:309: in function <...aries/Core/LibElvUIPlugin-1.0/LibElvUIPlugin-1.0.lua:305> [string "=[C]"]: in function
Initialize'
[string "@ElvUI/Core/init.lua"]:302: in function <ElvUI/Core/init.lua:301>
[string "=[C]"]: ?
[string "@ElvUI_Libraries/Core/Ace3/AceAddon-3.0-13/AceAddon-3.0.lua"]:66: in function <...UI_Libraries/Core/Ace3/AceAddon-3.0/AceAddon-3.0.lua:61>
[string "@ElvUI_Libraries/Core/Ace3/AceAddon-3.0-13/AceAddon-3.0.lua"]:523: in function `EnableAddon'
[string "@ElvUI_Libraries/Core/Ace3/AceAddon-3.0-13/AceAddon-3.0.lua"]:626: in function <...UI_Libraries/Core/Ace3/AceAddon-3.0/AceAddon-3.0.lua:611>
Locals:
10x WindTools [ERROR] ...vUI_WindTools/Modules/Skins/Addons/AngryKeystone.lua:13: hooksecurefunc(): Scenario_ChallengeMode_ShowBlock is not a function [string "=[C]"]: ? [string "@ElvUI_WindTools/Modules/Skins/Addons/AngryKeystone.lua"]:13: in function <...vUI_WindTools/Modules/Skins/Addons/AngryKeystone.lua:8> [string "=[C]"]: ? [string "@ElvUI_WindTools/Modules/Skins/Core.lua"]:344: in function
CallLoadedAddon' [string "@ElvUI_WindTools/Modules/Skins/Core.lua"]:522: in function <ElvUI_WindTools/Modules/Skins/Core.lua:507> [string "=[C]"]: ? [string "@ElvUI_WindTools/Core/Core.lua"]:110: in function
InitializeModules' [string "@ElvUI_WindTools/Initialize.lua"]:68: in function?' [string "@ElvUI_Libraries/Core/LibElvUIPlugin-1.0-45/LibElvUIPlugin-1.0.lua"]:309: in function <...aries/Core/LibElvUIPlugin-1.0/LibElvUIPlugin-1.0.lua:305> [string "=[C]"]: in function
Initialize' [string "@ElvUI/Core/init.lua"]:302: in function <ElvUI/Core/init.lua:301> [string "=[C]"]: ? [string "@ElvUI_Libraries/Core/Ace3/AceAddon-3.0-13/AceAddon-3.0.lua"]:66: in function <...UI_Libraries/Core/Ace3/AceAddon-3.0/AceAddon-3.0.lua:61> [string "@ElvUI_Libraries/Core/Ace3/AceAddon-3.0-13/AceAddon-3.0.lua"]:523: in function `EnableAddon' [string "@ElvUI_Libraries/Core/Ace3/AceAddon-3.0-13/AceAddon-3.0.lua"]:626: in function <...UI_Libraries/Core/Ace3/AceAddon-3.0/AceAddon-3.0.lua:611>Locals:
That is an issue with ElvUI_WindTools, not this addon.
I'm having issues too....
5x AngryKeystones/Config.lua:311: attempt to call global 'InterfaceOptions_AddCategory' (a nil value)
[string "@AngryKeystones/Config.lua"]:311: in function `CreatePanel'
[string "@AngryKeystones/Config.lua"]:330: in function `?'
[string "@AngryKeystones/Core.lua"]:212: in function `ForAllModules'
[string "@AngryKeystones/Core.lua"]:219: in function `?'
[string "@AngryKeystones/Core.lua"]:10: in function <AngryKeystones/Core.lua:6>
Locals:
self = <table> {
Name = "Config"
}
panel = Frame {
name = "Angry Keystones"
}
(*temporary) = nil
(*temporary) = Frame {
name = "Angry Keystones"
}
(*temporary) = "attempt to call global 'InterfaceOptions_AddCategory' (a nil value)"
Addon = <table> {
Modules = <table> {
}
ShortName = "AngryKeystones"
Version = "v0.30.12"
Name = "Angry Keystones"
ModulePrototype = <table> {
}
}
Some heads up: C_ScenarioInfo.GetCriteriaInfo doesn't provide quantityString anymore.
Attached my local changes as a zipped .diff file, if you're interested.
AngryKeystones.diff.zip
Some help with the interface options. Following can be used to add the category:
local category = Settings.RegisterCanvasLayoutCategory(panel, Addon.Name, Addon.Name) category.ID = Addon.Name Settings.RegisterAddOnCategory(category)
However I haven't fully gotten it to work as the panel then doesn't actually show the settings. My best bet it has something to do with when the panel gets populated?
Also to open the options category you can use this:
Settings.OpenToCategory(Addon.Name);
In Config.lua:
function Config:CreatePanel()
self:InitializeDropdown()
local panel = CreateFrame("FRAME")
panel.name = Addon.Name
panel.okay = Panel_OnSave
panel.cancel = Panel_OnCancel
panel.OnDefault = Panel_OnDefaults
panel.OnRefresh = Panel_OnRefresh
local category = Settings.RegisterCanvasLayoutCategory(panel, panel.name)
Settings.RegisterAddOnCategory(category)
panel.settingsCategory = category
return panel
end
function SlashCmdList.AngryKeystones(msg, editbox)
if optionPanel then
Settings.OpenToCategory(optionPanel.settingsCategory.ID)
end
end
Some help with the interface options. Following can be used to add the category:
local category = Settings.RegisterCanvasLayoutCategory(panel, Addon.Name, Addon.Name)
category.ID = Addon.Name
Settings.RegisterAddOnCategory(category)
However I haven't fully gotten it to work as the panel then doesn't actually show the settings. My best bet it has something to do with when the panel gets populated?
Also to open the options category you can use this:
Settings.OpenToCategory(Addon.Name);
Changes so far for 11.0.2:
diff --git a/AddOns/AngryKeystones/Core.lua b/AddOns/AngryKeystones/Core.lua
index 79e03e371..bda4f8858 100644
--- a/AddOns/AngryKeystones/Core.lua
+++ b/AddOns/AngryKeystones/Core.lua
@@ -58,7 +58,7 @@ end
function Addon:RegisterAddOnLoaded(name, callback, func)
if func == nil then func = 0 end
- if IsAddOnLoaded(name) then
+ if C_AddOns.IsAddOnLoaded(name) then
if func == 0 then
callback[name](callback)
else
@@ -223,7 +223,7 @@ function Addon:PLAYER_LOGIN()
self:UnregisterEvent('PLAYER_LOGIN', self)
end
-Addon.Name = GetAddOnMetadata(ADDON, "Title")
-Addon.ShortName = GetAddOnMetadata(ADDON, "X-Short-Name") or string.sub(ADDON, 1, 16)
-Addon.Version = GetAddOnMetadata(ADDON, "X-Packaged-Version")
+Addon.Name = C_AddOns.GetAddOnMetadata(ADDON, "Title")
+Addon.ShortName = C_AddOns.GetAddOnMetadata(ADDON, "X-Short-Name") or string.sub(ADDON, 1, 16)
+Addon.Version = C_AddOns.GetAddOnMetadata(ADDON, "X-Packaged-Version")
_G[ADDON] = Addon
diff --git a/AddOns/AngryKeystones/ObjectiveTracker.lua b/AddOns/AngryKeystones/ObjectiveTracker.lua
index a7633c672..55eb0fad8 100644
--- a/AddOns/AngryKeystones/ObjectiveTracker.lua
+++ b/AddOns/AngryKeystones/ObjectiveTracker.lua
@@ -127,7 +127,7 @@ local function ShowBlock(timerID, elapsedTime, timeLimit)
end
end
-if IsAddOnLoaded("!KalielsTracker") then
+if C_AddOns.IsAddOnLoaded("!KalielsTracker") then
hooksecurefunc("KT_Scenario_ChallengeMode_UpdateTime", UpdateTime)
hooksecurefunc("KT_Scenario_ChallengeMode_ShowBlock", ShowBlock)
else
diff --git a/AddOns/AngryKeystones/Schedule.lua b/AddOns/AngryKeystones/Schedule.lua
index 0cd38c324..9ae5cb3a8 100644
--- a/AddOns/AngryKeystones/Schedule.lua
+++ b/AddOns/AngryKeystones/Schedule.lua
@@ -50,7 +50,7 @@ local function UpdatePartyKeystones()
end
if not scheduleEnabled then return end
- if not IsAddOnLoaded("Blizzard_ChallengesUI") then return end
+ if not C_AddOns.IsAddOnLoaded("Blizzard_ChallengesUI") then return end
local playerRealm = select(2, UnitFullName("player")) or ""
@@ -369,7 +369,7 @@ end
function Mod:SetPartyKeystoneRequest()
requestPartyKeystones = true
- if IsAddOnLoaded("Blizzard_ChallengesUI") and ChallengesFrame:IsShown() then
+ if C_AddOns.IsAddOnLoaded("Blizzard_ChallengesUI") and ChallengesFrame:IsShown() then
self:SendPartyKeystonesRequest()
UpdatePartyKeystones()
end
C_ScenarioInfo.GetCriteriaInfo
has now been fixed to also include the field "quantityString".
Some code I'm testing out:
diff --git a/AddOns/AngryKeystones/ProgressTracker.lua b/AddOns/AngryKeystones/ProgressTracker.lua
index c2f19c814..8f67620a7 100644
--- a/AddOns/AngryKeystones/ProgressTracker.lua
+++ b/AddOns/AngryKeystones/ProgressTracker.lua
@@ -38,7 +38,7 @@ function Mod:COMBAT_LOG_EVENT_UNFILTERED()
lastDied = tonumber(npc_id)
lastDiedTime = GetTime()
lastDiedName = destName
- -- ProcessLasts()
+ ProcessLasts()
end
if bit.band(destFlags, COMBATLOG_OBJECT_TYPE_PLAYER) > 0 then
if UnitIsFeignDeath(destName) then
@@ -61,13 +61,12 @@ function Mod:SCENARIO_CRITERIA_UPDATE()
-- local criteriaString, criteriaType, _, quantity, totalQuantity, _, _, quantityString, _, _, _, _, isWeightedProgress = C_Scenario.GetCriteriaInfo(criteriaIndex)
local criteriaInfo = C_ScenarioInfo.GetCriteriaInfo(criteriaIndex)
if criteriaInfo and criteriaInfo.isWeightedProgress then
- local quantityString = criteriaInfo.description
- -- local currentQuantity = quantityString and tonumber( strsub(quantityString, 1, -2) )
- local currentQuantity = criteriaInfo.quantity
+ local quantityString = criteriaInfo.quantityString
+ local currentQuantity = quantityString and tonumber( quantityString:match("%d+") )
if lastQuantity and currentQuantity < criteriaInfo.totalQuantity and currentQuantity > lastQuantity then
lastAmount = currentQuantity - lastQuantity
lastAmountTime = GetTime()
- -- ProcessLasts()
+ ProcessLasts()
end
lastQuantity = currentQuantity
break
@@ -83,9 +82,8 @@ local function StartTime()
-- local criteriaString, criteriaType, _, quantity, totalQuantity, _, _, quantityString, _, _, _, _, isWeightedProgress = C_Scenario.GetCriteriaInfo(criteriaIndex)
local criteriaInfo = C_ScenarioInfo.GetCriteriaInfo(criteriaIndex)
if criteriaInfo and criteriaInfo.isWeightedProgress then
- -- local quantityString = criteriaInfo.description
- -- lastQuantity = quantityString and tonumber( strsub(quantityString, 1, -2) )
- lastQuantity = criteriaInfo.quantity
+ local quantityString = criteriaInfo.quantityString
+ lastQuantity = quantityString and tonumber( quantityString:match("%d+") )
break
end
end
@@ -191,29 +189,36 @@ function Mod:GeneratePreset()
return ret
end
+function Mod:PLAYER_ENTERING_WORLD(...) CheckTime(GetWorldElapsedTimers()) end
function Mod:WORLD_STATE_TIMER_START(...) local timerID = ...; CheckTime(timerID) end
function Mod:WORLD_STATE_TIMER_STOP(...) local timerID = ...; StopTime(timerID) end
function Mod:CHALLENGE_MODE_START(...) CheckTime(GetWorldElapsedTimers()) end
function Mod:CHALLENGE_MODE_RESET(...) wipe(Mod.playerDeaths) end
local function ProgressBar_SetValue(self, percent)
---[[
-- local _, _, _, _, totalQuantity, _, _, quantityString, _, _, _, _, _ = C_Scenario.GetCriteriaInfo(self.criteriaIndex)
- local criteriaInfo
-
+
+ local scenarioType = select(10, C_Scenario.GetInfo())
+
+ if scenarioType ~= LE_SCENARIO_TYPE_CHALLENGE_MODE then return end
+
local numCriteria = select(3, C_Scenario.GetStepInfo())
+ local criteriaInfo
+ local cInfo
for criteriaIndex = 1, numCriteria do
- criteriaInfo = C_ScenarioInfo.GetCriteriaInfo(criteriaIndex)
- if criteriaInfo and criteriaInfo.isWeightedProgress then break end
+ cInfo = C_ScenarioInfo.GetCriteriaInfo(criteriaIndex)
+ if cInfo and cInfo.isWeightedProgress then
+ criteriaInfo = cInfo
+ break
+ end
end
-
+
if not criteriaInfo then return end
-
+
local totalQuantity = criteriaInfo.totalQuantity
- local quantityString = criteriaInfo.description
- -- local currentQuantity = quantityString and tonumber( strsub(quantityString, 1, -2) )
- local currentQuantity = criteriaInfo.quantity
+ local quantityString = criteriaInfo.quantityString
+ local currentQuantity = quantityString and tonumber( quantityString:match("%d+") )
if currentQuantity and totalQuantity then
if Addon.Config.progressFormat == 1 then
@@ -230,26 +235,33 @@ local function ProgressBar_SetValue(self, percent)
self.Bar.Label:SetFormattedText("%.2f%% (%.2f%%) - %d/%d (%d)", currentQuantity/totalQuantity*100, (totalQuantity-currentQuantity)/totalQuantity*100, currentQuantity, totalQuantity, totalQuantity - currentQuantity)
end
end
-]]--
end
-function Mod:PLAYER_ENTERING_WORLD(...)
- CheckTime(GetWorldElapsedTimers())
+local progressBarFound = false
+
+local function findProgressBar()
+
+ if progressBarFound then return end
+
local usedBars = ScenarioObjectiveTracker.usedProgressBars or {}
+
for _, bar in pairs(usedBars) do
if bar.used then
hooksecurefunc(bar, "SetValue", ProgressBar_SetValue)
+ progressBarFound = true
break
end
end
end
+hooksecurefunc(ScenarioObjectiveTracker.ObjectivesBlock, "AddProgressBar", findProgressBar )
local function DeathCount_OnEnter(self)
- local timeLost = tonumber(self.Count:GetText()) * 5
+ local parent = self:GetParent()
+
GameTooltip:SetOwner(self, "ANCHOR_LEFT")
- GameTooltip:SetText(CHALLENGE_MODE_DEATH_COUNT_TITLE:format(tonumber(self.Count:GetText())), 1, 1, 1)
- GameTooltip:AddLine(CHALLENGE_MODE_DEATH_COUNT_DESCRIPTION:format(SecondsToClock(timeLost, false)))
+ GameTooltip:SetText(CHALLENGE_MODE_DEATH_COUNT_TITLE:format(parent.deathCount), 1, 1, 1)
+ GameTooltip:AddLine(CHALLENGE_MODE_DEATH_COUNT_DESCRIPTION:format(SecondsToClock(parent.timeLost, false)))
GameTooltip:AddLine(" ")
local list = {}