From b595bc557332b70f1b1aaf255b76cdf8558ce62c Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sun, 18 May 2025 14:16:07 +0200 Subject: [PATCH] Refactor API functions to enhance parameter aliasing and improve documentation clarity --- api/CalendarSetMonth.lua | 7 ++----- api/CollapseGuildTradeSkillHeader.lua | 28 ++++++++++++++------------- api/SetBattlefieldScoreFaction.lua | 12 +++++++----- api/SetGuildBankTabPermissions.lua | 14 ++++++++------ api/SetMapZoom.lua | 26 +++++++++++++------------ api/SetNextBarberShopStyle.lua | 14 ++++++++------ api/SetRaidTarget.lua | 28 ++++++++++++++------------- api/StartAuction.lua | 15 ++++++-------- api/TargetTotem.lua | 14 ++++++++------ api/UnitResistance.lua | 26 +++++++++++++------------ api/UnitStat.lua | 26 +++++++++++++------------ 11 files changed, 111 insertions(+), 99 deletions(-) diff --git a/api/CalendarSetMonth.lua b/api/CalendarSetMonth.lua index 4604214..ab31c72 100644 --- a/api/CalendarSetMonth.lua +++ b/api/CalendarSetMonth.lua @@ -1,9 +1,6 @@ ---@diagnostic disable: missing-return, lowercase-global ---@meta ----@param monthOffset 1 ----@param -1 ----@param 0 ----@param 1 +---@param monthOffset monthOffset ---Sets the calendar's month relative to its current month -function CalendarSetMonth(monthOffset, -1, 0, 1) end \ No newline at end of file +function CalendarSetMonth(monthOffset) end diff --git a/api/CollapseGuildTradeSkillHeader.lua b/api/CollapseGuildTradeSkillHeader.lua index de5a4e3..c27c26d 100644 --- a/api/CollapseGuildTradeSkillHeader.lua +++ b/api/CollapseGuildTradeSkillHeader.lua @@ -1,17 +1,19 @@ ---@diagnostic disable: missing-return, lowercase-global ---@meta ----@param professionID 773 ----@param 164 ----@param 165 ----@param 171 ----@param 182 ----@param 186 ----@param 197 ----@param 202 ----@param 333 ----@param 393 ----@param 755 ----@param 773 +---@alias professionID +---| 164 - Blacksmithing +---| 165 - Leatherworking +---| 171 - Alchemy +---| 182 - Herbalism +---| 186 - Mining +---| 197 - Tailoring +---| 202 - Engineering +---| 333 - Enchanting +---| 393 - Skinning +---| 755 - Jewelcrafting +---| 773 - Inscription + +---@param professionID professionID ---Collapses the corresponding profession in the guild window. This function is used to collapse a single profession in the guild window (professions view) based on its ID. Can also be done while window is not visible. See ExpandGuildTradeSkillHeader() for opening the view. -function CollapseGuildTradeSkillHeader(professionID, 164, 165, 171, 182, 186, 197, 202, 333, 393, 755, 773) end \ No newline at end of file +function CollapseGuildTradeSkillHeader(professionID) end diff --git a/api/SetBattlefieldScoreFaction.lua b/api/SetBattlefieldScoreFaction.lua index 36d8e4e..2066796 100644 --- a/api/SetBattlefieldScoreFaction.lua +++ b/api/SetBattlefieldScoreFaction.lua @@ -1,9 +1,11 @@ ---@diagnostic disable: missing-return, lowercase-global ---@meta ----@param faction nil ----@param 0 ----@param 1 ----@param nil +---@alias battlegroundFaction +---| 0 - Horde +---| 1 - Alliance +---| nil - All + +---@param faction battlegroundFaction ---Filters the battleground scoreboard by faction/team -function SetBattlefieldScoreFaction(faction, 0, 1, nil) end \ No newline at end of file +function SetBattlefieldScoreFaction(faction) end diff --git a/api/SetGuildBankTabPermissions.lua b/api/SetGuildBankTabPermissions.lua index 7bcbffb..79c6a80 100644 --- a/api/SetGuildBankTabPermissions.lua +++ b/api/SetGuildBankTabPermissions.lua @@ -1,10 +1,12 @@ ---@diagnostic disable: missing-return, lowercase-global ---@meta ----@param tab number ----@param permission 2 ----@param 1 ----@param 2 ----@param enabled boolean +---@alias guildBankTab +---| 1 - View tab +---| 2 - Deposit items + +---@param tab guildBankTab +---@param permission guildBankTab +---@param enabled boolean ---Changes guild bank tab permissions for the guild rank being edited -function SetGuildBankTabPermissions(tab, permission, 1, 2, enabled) end \ No newline at end of file +function SetGuildBankTabPermissions(tab, permission, enabled) end diff --git a/api/SetMapZoom.lua b/api/SetMapZoom.lua index 741b16e..87c2f70 100644 --- a/api/SetMapZoom.lua +++ b/api/SetMapZoom.lua @@ -1,16 +1,18 @@ ---@diagnostic disable: missing-return, lowercase-global ---@meta ----@param continentIndex 7 ----@param -1 ----@param 0 ----@param 1 ----@param 2 ----@param 3 ----@param 4 ----@param 5 ----@param 6 ----@param 7 ----@param zoneIndex number +---@alias continentIndex +---| -1 - Cosmic map +---| 0 - Entire Azeroth map +---| 1 - Kalimdor +---| 2 - Eastern Kingdoms +---| 3 - Outland +---| 4 - Northrend +---| 5 - The Maelstrom +---| 6 - Pandaria +---| 7 - Draenor + +---@param continentIndex continentIndex +---@param zoneIndex number ---Sets the world map to show a specific zone or continent -function SetMapZoom(continentIndex, -1, 0, 1, 2, 3, 4, 5, 6, 7, zoneIndex) end \ No newline at end of file +function SetMapZoom(continentIndex, zoneIndex) end diff --git a/api/SetNextBarberShopStyle.lua b/api/SetNextBarberShopStyle.lua index f288408..2d61b16 100644 --- a/api/SetNextBarberShopStyle.lua +++ b/api/SetNextBarberShopStyle.lua @@ -1,10 +1,12 @@ ---@diagnostic disable: missing-return, lowercase-global ---@meta ----@param styleIndex 3 ----@param 1 ----@param 2 ----@param 3 ----@param reverse boolean +---@alias barberShopStyleIndex +---| 1 - Hair (or Horn) Style +---| 2 - Hair (or Horn) Color +---| 3 - Varies by race and gender: Facial Hair, Earrings, Features, Hair, Horns, Markings, Normal, Piercings, or Tusks + +---@param styleIndex barberShopStyleIndex +---@param reverse boolean ---Selects the next style for a barber shop style option. Changes the underlying data (and thus the character's appearance) only; the default barbershop UI does not update. -function SetNextBarberShopStyle(styleIndex, 1, 2, 3, reverse) end \ No newline at end of file +function SetNextBarberShopStyle(styleIndex, reverse) end diff --git a/api/SetRaidTarget.lua b/api/SetRaidTarget.lua index 680d3bb..3220feb 100644 --- a/api/SetRaidTarget.lua +++ b/api/SetRaidTarget.lua @@ -1,17 +1,19 @@ ---@diagnostic disable: missing-return, lowercase-global ---@meta ----@param unit string ----@param name string ----@param index 8 ----@param 0 ----@param 1 ----@param 2 ----@param 3 ----@param 4 ----@param 5 ----@param 6 ----@param 7 ----@param 8 +---@alias raidTargetIndex +---| 0 - Clear any raid target markers +---| 1 - Star +---| 2 - Circle +---| 3 - Diamond +---| 4 - Triangle +---| 5 - Moon +---| 6 - Square +---| 7 - Cross +---| 8 - Skull + +---@param unit string +---@param name string +---@param index raidTargetIndex ---Puts a raid target marker on a unit -function SetRaidTarget(unit, name, index, 0, 1, 2, 3, 4, 5, 6, 7, 8) end \ No newline at end of file +function SetRaidTarget(unit, name, index) end diff --git a/api/StartAuction.lua b/api/StartAuction.lua index b249dc6..f628dde 100644 --- a/api/StartAuction.lua +++ b/api/StartAuction.lua @@ -1,13 +1,10 @@ ---@diagnostic disable: missing-return, lowercase-global ---@meta ----@param minBid number ----@param buyoutPrice number ----@param runTime 3 ----@param 1 ----@param 2 ----@param 3 ----@param stackSize number ----@param numStacks number +---@param minBid number +---@param buyoutPrice number +---@param runTime auctionRunTime +---@param stackSize number +---@param numStacks number ---Creates an auction for the item currently in the "auction item" slot. Has no effect unless an item has been placed in the Create Auction UI's "auction item" slot (see ClickAuctionSellItemButton()). With patch 3.3.3 the runTime arg was changed from minutes to an index and the stackSize/numStacks args were added for batch posting. -function StartAuction(minBid, buyoutPrice, runTime, 1, 2, 3, stackSize, numStacks) end \ No newline at end of file +function StartAuction(minBid, buyoutPrice, runTime, stackSize, numStacks) end diff --git a/api/TargetTotem.lua b/api/TargetTotem.lua index f226537..ec0a886 100644 --- a/api/TargetTotem.lua +++ b/api/TargetTotem.lua @@ -1,10 +1,12 @@ ---@diagnostic disable: missing-return, lowercase-global ---@meta ----@param slot 4 ----@param 1 ----@param 2 ----@param 3 ----@param 4 +---@alias totemSlot +---| 1 - Fire (or Death Knight's ghoul) +---| 2 - Earth +---| 3 - Water +---| 4 - Air + +---@param slot totemSlot ---Targets one of the player's totems (or a Death Knight's ghoul). Totem functions are also used for ghouls summoned by a Death Knight's Raise Dead ability (if the ghoul is not made a controllable pet by the Master of Ghouls talent). -function TargetTotem(slot, 1, 2, 3, 4) end \ No newline at end of file +function TargetTotem(slot) end diff --git a/api/UnitResistance.lua b/api/UnitResistance.lua index fcdc710..6fd315a 100644 --- a/api/UnitResistance.lua +++ b/api/UnitResistance.lua @@ -1,16 +1,18 @@ ---@diagnostic disable: missing-return, lowercase-global ---@meta ----@param unit string ----@param resistanceIndex 5 ----@param 1 ----@param 2 ----@param 3 ----@param 4 ----@param 5 ----@return number base ----@return number resistance ----@return number positive ----@return number negative +---@alias resistanceIndex +---| 1 - Fire +---| 2 - Nature +---| 3 - Frost +---| 4 - Shadow +---| 5 - Arcane + +---@param unit string +---@param resistanceIndex resistanceIndex +---@return number base +---@return number resistance +---@return number positive +---@return number negative ---Returns information about the player's or pet's magic resistance -function UnitResistance(unit, resistanceIndex, 1, 2, 3, 4, 5) end \ No newline at end of file +function UnitResistance(unit, resistanceIndex) end diff --git a/api/UnitStat.lua b/api/UnitStat.lua index 17e3e6f..20115ff 100644 --- a/api/UnitStat.lua +++ b/api/UnitStat.lua @@ -1,16 +1,18 @@ ---@diagnostic disable: missing-return, lowercase-global ---@meta ----@param unit string ----@param statIndex 5 ----@param 1 ----@param 2 ----@param 3 ----@param 4 ----@param 5 ----@return number stat ----@return number effectiveStat ----@return number posBuff ----@return number negBuff +---@alias statIndex +---| 1 - Strength +---| 2 - Agility +---| 3 - Stamina +---| 4 - Intellect +---| 5 - Spirit + +---@param unit string +---@param statIndex statIndex +---@return number stat +---@return number effectiveStat +---@return number posBuff +---@return number negBuff ---Returns information about a basic character statistic for the player or pet -function UnitStat(unit, statIndex, 1, 2, 3, 4, 5) end \ No newline at end of file +function UnitStat(unit, statIndex) end