From 034c48473852343c8a49d172526fc0e743c69aaf Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Wed, 7 Feb 2024 18:28:25 +0100 Subject: [PATCH] A few type and spelling fixes --- .luarc.json | 10 ++++- WeakAuras/AuraEnvironmentWrappedSystems.lua | 5 ++- WeakAuras/AuraWarnings.lua | 15 +++++--- WeakAuras/DebugLog.lua | 5 +++ WeakAuras/GenericTrigger.lua | 42 ++++++++++++++++++++- WeakAuras/Init.lua | 19 +++++++--- WeakAuras/LibSpecializationWrapper.lua | 6 ++- WeakAuras/Prototypes.lua | 8 ++-- WeakAuras/Types.lua | 37 +++++++++++++++++- WeakAurasOptions/OptionsFrames/Update.lua | 2 +- cspell.json | 2 + 11 files changed, 129 insertions(+), 22 deletions(-) diff --git a/.luarc.json b/.luarc.json index 8c19367458..789505a3b3 100644 --- a/.luarc.json +++ b/.luarc.json @@ -210,7 +210,15 @@ "WeakAurasRealTimeProfiling", "WeakAurasRealTimeProfilingTitleText", "WeakAurasOptionsTitleText", - "WeakAurasOptionsPortrait" + "WeakAurasOptionsPortrait", + "C_Seasons", + "UnitAura", + "GetCurrencyInfo", + "SECOND_NUMBER_CAP_NO_SPACE", + "GetCurrencyListSize", + "FIRST_NUMBER_CAP_NO_SPACE", + "CreateFramePool", + "AceGUIWeakAurasMultiLineEditBoxWithEnterInsertLink" ], "runtime.version": "Lua 5.1", "workspace.ignoreDir": [ diff --git a/WeakAuras/AuraEnvironmentWrappedSystems.lua b/WeakAuras/AuraEnvironmentWrappedSystems.lua index 62d937fbcd..0a1990a5f6 100644 --- a/WeakAuras/AuraEnvironmentWrappedSystems.lua +++ b/WeakAuras/AuraEnvironmentWrappedSystems.lua @@ -7,7 +7,10 @@ local L = WeakAuras.L --- @field Get fun(systemName: string, id: auraId, cloneId: string?): any --- @type AuraEnvironmentWrappedSystem -Private.AuraEnvironmentWrappedSystem = {} +Private.AuraEnvironmentWrappedSystem = { + Get = function(systemName, id, cloneId) + end +} --- @type table>> Table of id, cloneId, systemName to wrapped system local wrappers = {} diff --git a/WeakAuras/AuraWarnings.lua b/WeakAuras/AuraWarnings.lua index 3d176f4992..b70ff6c323 100644 --- a/WeakAuras/AuraWarnings.lua +++ b/WeakAuras/AuraWarnings.lua @@ -9,10 +9,6 @@ local AddonName, Private = ... --- | "warning" --- | "error" ---- @class AuraWarnings ---- @field UpdateWarning fun(uid: uid, key: string, severity: AuraWarningSeverity?, message: string?, printOnConsole: boolean?) ---- @field FormatWarnings fun(uid: uid): string?, string?, string? - local WeakAuras = WeakAuras local L = WeakAuras.L @@ -27,7 +23,16 @@ local function OnDelete(event, uid) end Private.callbacks:RegisterCallback("Delete", OnDelete) -Private.AuraWarnings = {} + +--- @class AuraWarnings +--- @field UpdateWarning fun(uid: uid, key: string, severity: AuraWarningSeverity?, message: string?, printOnConsole: boolean?) +--- @field FormatWarnings fun(uid: uid): string?, string?, string? +Private.AuraWarnings = { + UpdateWarning = function(uid, key, severity, message, printOnConsole) + end, + FormatWarnings = function(uid) + end +} function Private.AuraWarnings.UpdateWarning(uid, key, severity, message, printOnConsole) if not uid then diff --git a/WeakAuras/DebugLog.lua b/WeakAuras/DebugLog.lua index b8ae0f1032..b6a2483753 100644 --- a/WeakAuras/DebugLog.lua +++ b/WeakAuras/DebugLog.lua @@ -19,6 +19,11 @@ local enabled = {} --- @type debugLog Private.DebugLog = { + Print = function(uid, text, ...) end, + Clear = function(uid) end, + SetEnabled = function(uid, enabled) end, + IsEnabled = function(uid) end, + GetLogs = function(uid) end } local function serialize(log, input) diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 9d0041f44c..6749b2ae51 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -486,6 +486,8 @@ local function callFunctionForActivateEvent(func, trigger, fallback, errorHandle return ok and value or fallback end +--- @class Private +--- @field ActivateEvent fun(id, triggernum, data, state, errorHandler) function Private.ActivateEvent(id, triggernum, data, state, errorHandler) local changed = state.changed or false; if (state.show ~= true) then @@ -893,6 +895,8 @@ do end end + --- @class Private + --- @field RunTriggerFuncWithDelay fun(delay, id, triggernum, data, event, ...) function Private.RunTriggerFuncWithDelay(delay, id, triggernum, data, event, ...) delayTimerEvents[id] = delayTimerEvents[id] or {} delayTimerEvents[id][triggernum] = delayTimerEvents[id][triggernum] or {} @@ -901,6 +905,8 @@ do end end +--- @class Private +--- @field CancelDelayedTrigger fun(id) function Private.CancelDelayedTrigger(id) if delayTimerEvents[id] then for triggernum, timers in pairs(delayTimerEvents[id]) do @@ -912,12 +918,16 @@ function Private.CancelDelayedTrigger(id) end end +--- @class Private +--- @field CancelAllDelayedTriggers fun() function Private.CancelAllDelayedTriggers() for id in pairs(delayTimerEvents) do Private.CancelDelayedTrigger(id) end end +--- @class Private +--- @field ScanEventsWatchedTrigger fun(id, watchedTriggernums) function Private.ScanEventsWatchedTrigger(id, watchedTriggernums) if #watchedTriggernums == 0 then return end Private.StartProfileAura(id); @@ -1760,6 +1770,8 @@ do Private.frames["Custom Trigger Every Frame Updater"] = update_frame; local updating = false; + --- @class Private + --- @field RegisterEveryFrameUpdate fun(id) function Private.RegisterEveryFrameUpdate(id) if not(update_clients[id]) then update_clients[id] = true; @@ -1778,11 +1790,15 @@ do end end + --- @class Private + --- @field EveryFrameUpdateRename fun(oldid, newid) function Private.EveryFrameUpdateRename(oldid, newid) update_clients[newid] = update_clients[oldid]; update_clients[oldid] = nil; end + --- @class Private + --- @field UnregisterEveryFrameUpdate fun(id) function Private.UnregisterEveryFrameUpdate(id) if(update_clients[id]) then update_clients[id] = nil; @@ -1794,6 +1810,8 @@ do end end + --- @class Private + --- @field UnregisterAllEveryFrameUpdate fun() function Private.UnregisterAllEveryFrameUpdate() if (not update_frame) then return; @@ -2280,6 +2298,8 @@ do local spellDetails = {} local mark_ACTIONBAR_UPDATE_COOLDOWN, mark_PLAYER_ENTERING_WORLD + --- @class Private + --- @field InitCooldownReady fun() function Private.InitCooldownReady() cdReadyFrame = CreateFrame("Frame"); cdReadyFrame.inWorld = 0 @@ -2615,6 +2635,8 @@ do WeakAuras.ScanEvents("ITEM_SLOT_COOLDOWN_READY", id); end + --- @class Private + --- @field CheckRuneCooldown fun() function Private.CheckRuneCooldown() local runeDuration = -100; for id, _ in pairs(runes) do @@ -2730,6 +2752,8 @@ do count, unifiedModRate, modRate, modRateCharges; end + --- @class Private + --- @field CheckSpellKnown fun() function Private.CheckSpellKnown() local overrides = {} -- First check for overrides, if we don't yet track a specific override, add it @@ -2785,6 +2809,8 @@ do end end + --- @class Private + --- @field CheckSpellCooldown fun(id, runeDuration) function Private.CheckSpellCooldown(id, runeDuration) local charges, maxCharges, startTime, duration, unifiedCooldownBecauseRune, startTimeCooldown, durationCooldown, cooldownBecauseRune, startTimeCharges, durationCharges, @@ -2839,12 +2865,16 @@ do end end + --- @class Private + --- @field CheckSpellCooldows fun(runeDuration) function Private.CheckSpellCooldows(runeDuration) for id, _ in pairs(spells) do Private.CheckSpellCooldown(id, runeDuration) end end + --- @class Private + --- @field CheckItemCooldowns fun() function Private.CheckItemCooldowns() for id, _ in pairs(items) do local startTime, duration, enabled = GetItemCooldown(id); @@ -2908,6 +2938,8 @@ do end end + --- @class Private + --- @field CheckItemSlotCooldowns fun() function Private.CheckItemSlotCooldowns() for id, itemId in pairs(itemSlots) do local startTime, duration, enable = GetInventoryItemCooldown("player", id); @@ -2965,6 +2997,8 @@ do end end + --- @class Private + --- @field CheckCooldownReady fun() function Private.CheckCooldownReady() CheckGCD(); local runeDuration = Private.CheckRuneCooldown(); @@ -3680,7 +3714,7 @@ function WeakAuras.RegisterItemCountWatch() itemCountWatchFrame:SetScript("OnEvent", function(self, event) Private.StartProfileSystem("generictrigger itemCountFrame") if event == "ACTIONBAR_UPDATE_COOLDOWN" then - -- workaround to blizzard bug: refreshing healthstones from soulwell dont trigger BAG_UPDATE_DELAYED + -- workaround to blizzard bug: refreshing healthstones from soulwell don't trigger BAG_UPDATE_DELAYED -- so, we fake it by listening to A_U_C and checking on next frame itemCountWatchFrame:SetScript("OnUpdate", batchUpdateCount) else @@ -3739,7 +3773,7 @@ function WeakAuras.GetUniqueCloneId() return uniqueId; end ---- @type fun(trigger: triggerData) : prototypeData +--- @type fun(trigger: triggerData) : prototypeData? function GenericTrigger.GetPrototype(trigger) if trigger.type and trigger.event then if Private.category_event_prototype[trigger.type] then @@ -4054,6 +4088,8 @@ local commonConditions = { } } +--- @class Private +--- @field ExpandCustomVariables fun(variables: table) function Private.ExpandCustomVariables(variables) -- Make the life of tsu authors easier, by automatically filling in the details for -- expirationTime, duration, value, total, stacks, if those exists but aren't a table value @@ -4473,6 +4509,8 @@ Private.ExecEnv.GetCurrencyInfo = function(id) end end +--- @class Private +--- @field GetCurrencyInfoForTrigger fun(trigger: triggerData) Private.GetCurrencyInfoForTrigger = function(trigger) if trigger.currencyId then local currencyId = tonumber(trigger.currencyId) diff --git a/WeakAuras/Init.lua b/WeakAuras/Init.lua index 8d87993ed3..0cdde87188 100644 --- a/WeakAuras/Init.lua +++ b/WeakAuras/Init.lua @@ -59,9 +59,9 @@ local GetAddOnMetadata = C_AddOns and C_AddOns.GetAddOnMetadata or GetAddOnMetad --- @field frames table --- @field function_strings table --- @field GetDataByUID fun(uid: uid): auraData ---- @field GetDiscoveredCurencies fun(): table ---- @field GetDiscoveredCurenciesSorted fun(): table ---- @field GetDiscoveredCurenciesHeaders fun(): table +--- @field GetDiscoveredCurrencies fun(): table +--- @field GetDiscoveredCurrenciesSorted fun(): table +--- @field GetDiscoveredCurrenciesHeaders fun(): table --- @field GetErrorHandlerId fun(id: auraId, context: string): function --- @field GetErrorHandlerUid fun(uid: uid, context: string): function --- @field GetRegionByUID fun(uid: uid, cloneId: string): Region @@ -82,7 +82,7 @@ local GetAddOnMetadata = C_AddOns and C_AddOns.GetAddOnMetadata or GetAddOnMetad --- @field non_transmissable_fields_v2000 table --- @field orientation_types table --- @field orientation_with_circle_types table ---- @field ParseNumber fun (numString: string|number): number? +--- @field ParseNumber fun (numString: string|number): number?, string? --- @field point_types table --- @field PreShowModels fun() --- @field PrintHelp fun() @@ -121,6 +121,8 @@ local GetAddOnMetadata = C_AddOns and C_AddOns.GetAddOnMetadata or GetAddOnMetad --- @field UpdatedTriggerState fun(id: auraId) --- @field validate fun(input: table, default:table) --- @field watched_trigger_events table>> +--- @field RegisterRegionType fun(regionType: string, createFunction: function, modifyFunction: function, defaults: table, properties: table|function|nil, validate: function?)) + --- @alias triggerTypes --- | "aura" @@ -144,7 +146,7 @@ local GetAddOnMetadata = C_AddOns and C_AddOns.GetAddOnMetadata or GetAddOnMetad --- @field instance_size table|nil --- @field itemName string? --- @field itemSetName string? ---- @field itemTypeName table|ni +--- @field itemTypeName table|nil --- @field range number?l --- @field realSpellName string? --- @field rune number? @@ -504,7 +506,8 @@ end function Private.RegisterRegionType(_, _, _ ,_) end ---- @type fun(regionType: string, createOptions: function, icon: string|function, displayName: string, createThumbnail: function?, modifyThumbnail: function?, description: string?, templates: table?, getAnchors: function?) +--- @class Private +--- @field RegisterRegionOptions fun(regionType: string, createOptions: function, icon: string|function, displayName: string, createThumbnail: function?, modifyThumbnail: function?, description: string?, templates: table?, getAnchors: function?) function Private.RegisterRegionOptions(_, _ , _ ,_ ) end @@ -520,9 +523,13 @@ end function Private.StopProfileAura(_) end +--- @class Private +--- @field StartProfileUID fun() function Private.StartProfileUID() end +--- @class Private +--- @field StopProfileUID fun() function Private.StopProfileUID() end diff --git a/WeakAuras/LibSpecializationWrapper.lua b/WeakAuras/LibSpecializationWrapper.lua index b497852ad4..c86fb7466a 100644 --- a/WeakAuras/LibSpecializationWrapper.lua +++ b/WeakAuras/LibSpecializationWrapper.lua @@ -25,7 +25,11 @@ local subscribers = {} --- @field SpecForUnit fun(unit: string): number? --- @field SpecRolePositionForUnit fun(unit: string): number?, string?, string? -Private.LibSpecWrapper = {} +Private.LibSpecWrapper = { + Register = function(callback) end, + SpecForUnit = function(unit) end, + SpecRolePositionForUnit = function(unit) end +} if LibSpec then local frame = CreateFrame("Frame") frame:RegisterEvent("PLAYER_LOGIN") diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index d51526028a..058aef67a7 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -10321,13 +10321,13 @@ Private.event_prototypes = { name = "currencyId", type = "currency", itemControl = "Dropdown-Currency", - values = Private.GetDiscoveredCurencies, - headers = Private.GetDiscoveredCurenciesHeaders, + values = Private.GetDiscoveredCurrencies, + headers = Private.GetDiscoveredCurrenciesHeaders, sorted = true, sortOrder = function() - local discovered_currencies_sorted = Private.GetDiscoveredCurenciesSorted() + local discovered_currencies_sorted = Private.GetDiscoveredCurrenciesSorted() local sortOrder = {} - for key, value in pairs(Private.GetDiscoveredCurencies()) do + for key, value in pairs(Private.GetDiscoveredCurrencies()) do tinsert(sortOrder, key) end table.sort(sortOrder, function(aKey, bKey) diff --git a/WeakAuras/Types.lua b/WeakAuras/Types.lua index cd1ea4d0d4..f5f637ff45 100644 --- a/WeakAuras/Types.lua +++ b/WeakAuras/Types.lua @@ -22,24 +22,31 @@ local function WA_GetClassColor(classFilename) return "ffffffff" end +--- @class Private +--- @field glow_action_types table Private.glow_action_types = { show = L["Show"], hide = L["Hide"] } +--- @class Private +--- @field glow_frame_types table Private.glow_frame_types = { UNITFRAME = L["Unit Frame"], NAMEPLATE = L["Nameplate"], FRAMESELECTOR = L["Frame Selector"] } ---- @type table +--- @class Private +--- @field circular_group_constant_factor_types table Private.circular_group_constant_factor_types = { ANGLE = L["Angle and Radius"], RADIUS = L["Radius"], SPACING = L["Spacing"] } +--- @class Private +--- @field frame_strata_types table Private.frame_strata_types = { [1] = L["Inherited"], [2] = "BACKGROUND", @@ -52,21 +59,29 @@ Private.frame_strata_types = { [9] = "TOOLTIP" } +--- @class Private +--- @field hostility_types table Private.hostility_types = { hostile = L["Hostile"], friendly = L["Friendly"] } +--- @class Private +--- @field character_types table Private.character_types = { player = L["Player Character"], npc = L["Non-player Character"] } +--- @class Private +--- @field spec_position_types table Private.spec_position_types = { RANGED = L["Ranged"], MELEE = L["Melee"] } +--- @class Private +--- @field group_sort_types table Private.group_sort_types = { ascending = L["Ascending"], descending = L["Descending"], @@ -75,28 +90,38 @@ Private.group_sort_types = { custom = L["Custom"] } +--- @class Private +--- @field group_hybrid_position_types table Private.group_hybrid_position_types = { hybridFirst = L["Marked First"], hybridLast = L["Marked Last"] } +--- @class Private +--- @field group_hybrid_sort_types table Private.group_hybrid_sort_types = { ascending = L["Ascending"], descending = L["Descending"] } +--- @class Private +--- @field time_format_types table Private.time_format_types = { [0] = L["WeakAuras Built-In (63:42 | 3:07 | 10 | 2.4)"], [1] = L["Old Blizzard (2h | 3m | 10s | 2.4)"], [2] = L["Modern Blizzard (1h 3m | 3m 7s | 10s | 2.4)"], } +--- @class Private +--- @field time_precision_types table Private.time_precision_types = { [1] = "12.3", [2] = "12.34", [3] = "12.345", } +--- @class Private +--- @field precision_types table Private.precision_types = { [0] = "12", [1] = "12.3", @@ -104,22 +129,30 @@ Private.precision_types = { [3] = "12.345", } +--- @class Private +--- @field big_number_types table Private.big_number_types = { ["AbbreviateNumbers"] = L["AbbreviateNumbers (Blizzard)"], ["AbbreviateLargeNumbers"] = L["AbbreviateLargeNumbers (Blizzard)"] } +--- @class Private +--- @field round_types table Private.round_types = { floor = L["Floor"], ceil = L["Ceil"], round = L["Round"] } +--- @class Private +--- @field unit_color_types table Private.unit_color_types = { none = L["None"], class = L["Class"] } +--- @class Private +--- @field unit_realm_name_types table Private.unit_realm_name_types = { never = L["Never"], star = L["* Suffix"], @@ -1343,6 +1376,8 @@ Private.combatlog_spell_school_types = { [127] = STRING_SCHOOL_CHAOS, } +--- @class Private +--- @field combatlog_spell_school_types_for_ui table Private.combatlog_spell_school_types_for_ui = {} for id, str in pairs(Private.combatlog_spell_school_types) do Private.combatlog_spell_school_types_for_ui[id] = ("%.3d - %s"):format(id, str) diff --git a/WeakAurasOptions/OptionsFrames/Update.lua b/WeakAurasOptions/OptionsFrames/Update.lua index 0da911af73..a2d604978f 100644 --- a/WeakAurasOptions/OptionsFrames/Update.lua +++ b/WeakAurasOptions/OptionsFrames/Update.lua @@ -298,7 +298,7 @@ local function BuildUidMap(data, children, type) --- import, otherwise nil --- @field matchedUid uid? for "update", the matched uid. Is from a different domain! --- @field diff any for "update", the diff and the categories of that diff between the aura and its match - --- @field categories the categories + --- @field categories table the categories --- @field index number helpers that transport data between phase 1 and 2 --- @field total number helpers that transport data between phase 1 and 2 --- @field parentIsDynamicGroup boolean helpers that transport data between phase 1 and 2 diff --git a/cspell.json b/cspell.json index 9556f63114..5e599a83d7 100644 --- a/cspell.json +++ b/cspell.json @@ -219,6 +219,7 @@ "perc", "pleft", "pright", + "prio", "pstop", "Psyfiend", "Psyflay", @@ -329,6 +330,7 @@ "yoffset", "Yogg", "Yoyodyne", + "yrange", "Ysera", "Yu'lon", "Zandalari",