add missing IR documentation

This commit is contained in:
Hersi 2022-03-04 16:02:19 +01:00
parent af71838493
commit b96e80d490
2 changed files with 96 additions and 1 deletions

69
docs/lua_api/IR.lua Normal file
View File

@ -0,0 +1,69 @@
-- IR State enum
---@class States
local States = {
Unused = 0,
Pending = 10,
Success = 20,
Accepted = 22,
BadRequest = 40,
Unauthorized = 41,
ChartRefused = 42,
Forbidden = 43,
NotFound = 44,
ServerError = 50,
RequestFailure = 60
}
---@class IRData
---@field Active boolean # USC IR configured and active
---@field States States # IR reposonse state enum
IRData = {}
---@class IRHeartbeatResponseBody
---@field serverTime integer
---@field serverName string
---@field irVersion string
IRHeartbeatResponseBody = {}
---@class IRRecordResponseBody
---@field record IRScore
IRRecordResponseBody = {}
---@class IRLeaderboardResponseBody
---@field scores IRScore[]
IRLeaderboardResponseBody = {}
---@class IRResponse
---@field statusCode integer
---@field description string
---@field body nil|IRHeartbeatResponseBody|IRRecordResponseBody|IRLeaderboardResponseBody
IRResponse = {}
-- Performs a Heartbeat request.
---@param callback function # Callback function receives IRResponse as it's first parameter
local function Heartbeat(callback) end
-- Performs a Chart Tracked request for the chart with the provided hash.
---@param hash string # song hash
---@param callback function # Callback function receives IRResponse as it's first parameter
local function ChartTracked(hash, callback) end
-- Performs a Record request for the chart with the provided hash.
---@param hash string # song hash
---@param callback function # Callback function receives IRResponse as it's first parameter
local function Record(hash, callback) end
-- Performs a Leaderboard request for the chart with the provided hash, with parameters mode and n.
---@param hash string # song hash
---@param mode "best"|"rivals" # request leaderboard mode
---@param n integer # limit the number of requested scores
---@param callback function # Callback function receives IRResponse as it's first parameter
local function Leaderboard(hash, mode, n, callback) end
---@type table
IR = {
Heartbeat = Heartbeat,
ChartTracked = ChartTracked,
Record = Record,
Leaderboard = Leaderboard
}

View File

@ -41,6 +41,30 @@ Score = {};
---@field failReason string # Fail reason if a challenge requirement was not met
ChartResult = {};
---@class ServerScoreOptions
---@field gaugeType integer # An enum value representing the gauge type used. 0 = normal, 1 = hard. Further values are not currently specified.
---@field gaugeOpt integer # Reserved
---@field mirror boolean # Mirror mode enabled
---@field random boolean # Note shuffle enabled
---@field autoFlags integer # A bitfield of elements of the game that are automated. Any non-zero value means that the score was at least partially auto.
ServerScoreOptions = {}
---@class ServerScore
---@field score integer # Submitted score
---@field gauge number # Submitted Gauge result
---@field timestamp integer # Unix timestamp of the score
---@field crit integer # Hits inside the critical window
---@field near integer # Hits inside the near window
---@field early integer # Hits inside the near window which were early
---@field late integer # Hits inside the near window which were late
---@field combo integer # Best combo reached
---@field error integer # Missed notes
---@field options ServerScoreOptions # The options in use. Includes gauge type, etc.
---@field windows table # {perfect, good, hold, miss, slam} hit windows in milliseconds
---@field yours boolean # This score belongs to the current player
---@field justSet boolean # This score belongs to the current player, and is the score that was just achieved
ServerScore = {}
---@class result
---@field artist string # Chart artist
---@field auto_flags integer # Autoplay flag
@ -72,7 +96,9 @@ ChartResult = {};
---@field hitWindow HitWindow # Result hit windows
---@field holdHitStats HitStat[]|nil # Hit stats for every hold object, only available for singleplayer if `isSelf = true`
---@field illustrator string # Chart jacket illustrator
---@field irState integer # Internet ranking flag
---@field irState integer # Current state of the IR score submission request (a USC-IR code, including extensions 0/10/60)
---@field irDescription string # The description in the IR response (nil if irState is 0 or 10)
---@field irScores ServerScore[]|nil # Score submission result, nil if irState != 20
---@field isSelf boolean # Only for multiplayer, `false` if score is of another player
---@field jacketPath string # Full filepath to the jacket image on the disk
---@field laserHitStats HitStat[]|nil # Hit stats for every laser object, only available for singleplayer if `isSelf = true`