Skip to content

Commit

Permalink
A few type and spelling fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanzilla authored and InfusOnWoW committed Feb 7, 2024
1 parent 6567062 commit 034c484
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 22 deletions.
10 changes: 9 additions & 1 deletion .luarc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
5 changes: 4 additions & 1 deletion WeakAuras/AuraEnvironmentWrappedSystems.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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<auraId, table<string, table<string, any>>> Table of id, cloneId, systemName to wrapped system
local wrappers = {}
Expand Down
15 changes: 10 additions & 5 deletions WeakAuras/AuraWarnings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions WeakAuras/DebugLog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
42 changes: 40 additions & 2 deletions WeakAuras/GenericTrigger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {}
Expand All @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -1794,6 +1810,8 @@ do
end
end

--- @class Private
--- @field UnregisterAllEveryFrameUpdate fun()
function Private.UnregisterAllEveryFrameUpdate()
if (not update_frame) then
return;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -2965,6 +2997,8 @@ do
end
end

--- @class Private
--- @field CheckCooldownReady fun()
function Private.CheckCooldownReady()
CheckGCD();
local runeDuration = Private.CheckRuneCooldown();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
19 changes: 13 additions & 6 deletions WeakAuras/Init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ local GetAddOnMetadata = C_AddOns and C_AddOns.GetAddOnMetadata or GetAddOnMetad
--- @field frames table<string, table>
--- @field function_strings table<string, string>
--- @field GetDataByUID fun(uid: uid): auraData
--- @field GetDiscoveredCurencies fun(): table<number|string, string>
--- @field GetDiscoveredCurenciesSorted fun(): table<number|string, number>
--- @field GetDiscoveredCurenciesHeaders fun(): table<string, boolean>
--- @field GetDiscoveredCurrencies fun(): table<number|string, string>
--- @field GetDiscoveredCurrenciesSorted fun(): table<number|string, number>
--- @field GetDiscoveredCurrenciesHeaders fun(): table<string, boolean>
--- @field GetErrorHandlerId fun(id: auraId, context: string): function
--- @field GetErrorHandlerUid fun(uid: uid, context: string): function
--- @field GetRegionByUID fun(uid: uid, cloneId: string): Region
Expand All @@ -82,7 +82,7 @@ local GetAddOnMetadata = C_AddOns and C_AddOns.GetAddOnMetadata or GetAddOnMetad
--- @field non_transmissable_fields_v2000 table<string, non_transmissable_field>
--- @field orientation_types table<string, string>
--- @field orientation_with_circle_types table<string, string>
--- @field ParseNumber fun (numString: string|number): number?
--- @field ParseNumber fun (numString: string|number): number?, string?
--- @field point_types table<string, string>
--- @field PreShowModels fun()
--- @field PrintHelp fun()
Expand Down Expand Up @@ -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<auraId, table<integer, table<integer, boolean>>>
--- @field RegisterRegionType fun(regionType: string, createFunction: function, modifyFunction: function, defaults: table, properties: table|function|nil, validate: function?))


--- @alias triggerTypes
--- | "aura"
Expand All @@ -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?
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
6 changes: 5 additions & 1 deletion WeakAuras/LibSpecializationWrapper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 4 additions & 4 deletions WeakAuras/Prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit 034c484

Please sign in to comment.