Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 33 additions & 16 deletions !!Warmup/Warmup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@
-- tomchapin - Fixed CreateTitleRegion error so addon works with WoW 7.1
-- tomchapin - Renamed addon so it has a zero at the front and hopefully will load first.
-- tomchapin - Fixed the CreateFrame function (per recommendation from Bezal1)
-- Forked by ZZumMallen for WoW 11.0 prepatch
-- ZZumMallen - updated varrios Addon() functions to include the C_AddOns namespace to blizz change and restore functionality
-- ZZumMallen - added annotations to fix random type and param check errors
-- ZZumMallen - fixed debugger, timerlocked was not defined and causing errors
-- ZZumMallen - fixed debugger reset, was setting the timer to nil and unable to resume
-- ZZumMallen - updated slashcommand to refer to containerFrame class instead of the name paramter

local containerFrame = CreateFrame("Frame", "WarmupOutputFrame", UIParent, BackdropTemplateMixin and "BackdropTemplate")
---@type any
local bdTemplate = BackdropTemplateMixin and "BackdropTemplate" -- this parameter combo was causing errors when used inside the container, redefined as single parameter

local containerFrame = CreateFrame("Frame", "WarmupOutputFrame", UIParent, bdTemplate)
containerFrame:Hide()

local outputFrame = CreateFrame("ScrollingMessageFrame", "WarmupChatFrame", containerFrame, BackdropTemplateMixin and "BackdropTemplate")
local outputFrame = CreateFrame("ScrollingMessageFrame", "WarmupChatFrame", containerFrame, bdTemplate)
outputFrame:SetFontObject("ChatFontNormal")
outputFrame:SetMaxLines(512)

Expand Down Expand Up @@ -39,7 +48,7 @@ containerFrame:SetScript("OnShow", function(self)
bg:SetAlpha(0.9)
--bg:SetVertexColor(204/255, 225/255, 1)

local close = CreateFrame("Button", nil, self, "UIPanelCloseButton", BackdropTemplateMixin and "BackdropTemplate")
local close = CreateFrame("Button", nil, self, "UIPanelCloseButton", bdTemplate)
close:SetPoint("TOPRIGHT")

local title = self:CreateFontString(nil, "OVERLAY", "GameFontNormal")
Expand Down Expand Up @@ -91,25 +100,32 @@ local threshcolors = {"|cffff0000", "|cffff8000", "|cffffff80", "|cff80ff80"}
local sv, intransit, reloading, longestaddon, biggestaddon, varsloadtime, logging, mostgarbageaddon, leftworld
local memstack = {initmem}

local timerIsLocked
local timerIsLocked = debugprofilestop()
local previousTimer

local function start()
-- resets the timer - do not us debugprofilestart() for ... reasons. Use debugprofile stop like you would GetTime()
if previousTimer then
previousTimer = nil
end

if timerIsLocked then
-- outputFrame:AddMessage("ATTEMPTED TO START TIMER WHILE LOCKED")
-- outputFrame:AddMessage(debugstack())
-- outputFrame:AddMessage("ATTEMPTED TO START TIMER WHILE LOCKED")
-- outputFrame:AddMessage(debugstack())
end

timerIsLocked = debugprofilestop()
end

local function stop()
if not timerIsLocked then
-- outputFrame:AddMessage("ATTEMPTED TO STOP TIMER WHILE UNLOCKED")
-- outputFrame:AddMessage(debugstack())
-- outputFrame:AddMessage("ATTEMPTED TO STOP TIMER WHILE UNLOCKED")
-- outputFrame:AddMessage(debugstack())
end

local elapsed = debugprofilestop() - timerIsLocked
timerIsLocked = nil
return elapsed
previousTimer = timerIsLocked -- redefines old timer for reset
return elapsed, previousTimer
end

start()
Expand Down Expand Up @@ -185,10 +201,11 @@ do
end

do
for i=1,GetNumAddOns() do
if IsAddOnLoaded(i) then
if GetAddOnInfo(i) ~= "!!Warmup" then
outputFrame:AddMessage("Addon loaded before Warmup: ".. GetAddOnInfo(i))
-- These functions were all added to the C_AddOns namespace and no longer work unless parent is referenced
for i=1,C_AddOns.GetNumAddOns() do
if C_AddOns.IsAddOnLoaded(i) then
if C_AddOns.GetAddOnInfo(i) ~= "!!Warmup" then
outputFrame:AddMessage("Addon loaded before Warmup: " .. C_AddOns.GetAddOnInfo(i))
end
end
end
Expand Down Expand Up @@ -289,7 +306,7 @@ function Warmup:VARIABLES_LOADED()
SLASH_RELOADNODISABLE1 = "/rlnd"
]]
SlashCmdList["WARMUP"] = function()
WarmupOutputFrame:SetShown(not WarmupOutputFrame:IsShown())
containerFrame:SetShown(not containerFrame:IsShown()) -- was not working with the containerFrame name identifier
end

SLASH_WARMUP1 = "/wu"
Expand All @@ -308,7 +325,7 @@ function Warmup:PLAYER_LOGIN()
else
C_Timer.After(2, function() -- auto open window on login, delay required because of UISpecialFrames
if not UnitAffectingCombat("player") then
WarmupOutputFrame:Show()
containerFrame:Show()
end
end)
end
Expand Down
23 changes: 23 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"Lua.runtime.version": "Lua 5.1",
"Lua.runtime.builtin": {
"basic": "disable",
"debug": "disable",
"io": "disable",
"math": "disable",
"os": "disable",
"package": "disable",
"string": "disable",
"table": "disable",
"utf8": "disable"
},
"Lua.workspace.library": [
"~\\.vscode\\extensions\\ketho.wow-api-0.17.4\\Annotations"
],
"Lua.diagnostics.globals": [
"SlashCmdList",
"UIParent",
"UISpecialFrames",
"BackdropTemplateMixin"
]
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Don't leave Warmup enabled every time you log in. The changes for GC data will h

[Fixed for WoW 7.1](https://github.com/tomchapin/Warmup) by tomchapin

[Fixed for WoW 11.0](https://github.com/ZZumMallen/Warmup) by ZZumMallen

## Download Locations

https://mods.curse.com/addons/wow/255272-warmup
Expand Down