osu!ex v0.1.0 OsuEx.API.Utils View Source

Utility functions for handling enum values and mods.

Link to this section Summary

Functions

Translates the approved status enum to an atom and vice versa

Translates the genre enum to an atom and vice versa

Translates the language enum to an atom and vice versa

Translates the game mode enum to an atom and vice versa

Translates bitwise mods into a list of atoms and vice versa. This function does not handle the KeyMod, FreeModAllowed, or ScoreIncreaseMods

Translates the scoring type enum to an atom and vice versa

Translates the team enum to an atom and vice versa

Translates the team type enum to an atom and vice versa

Link to this section Functions

Link to this function approved(arg1) View Source
approved(-2..4) :: atom()
approved(atom()) :: -2..4

Translates the approved status enum to an atom and vice versa.

Examples

iex> OsuEx.API.Utils.approved(-2)
:graveyard

iex> OsuEx.API.Utils.approved(:wip)
-1
Link to this function genre(arg1) View Source
genre(0..10) :: atom()
genre(atom()) :: 0..10

Translates the genre enum to an atom and vice versa.

Examples

iex> OsuEx.API.Utils.genre(0)
:any

iex> OsuEx.API.Utils.genre(:unspecified)
1
Link to this function language(arg1) View Source
language(0..11) :: atom()
language(atom()) :: 0..11

Translates the language enum to an atom and vice versa.

Examples

iex> OsuEx.API.Utils.language(0)
:any

iex> OsuEx.API.Utils.language(:other)
1
Link to this function mode(arg1) View Source
mode(0..3) :: atom()
mode(atom()) :: 0..3

Translates the game mode enum to an atom and vice versa.

Examples

iex> OsuEx.API.Utils.mode(0)
:standard

iex> OsuEx.API.Utils.mode(:taiko)
1
Link to this function mods(n) View Source
mods(0..2_147_483_647) :: {:ok, MapSet.t()}
mods(Enum.t()) :: {:ok, 0..2_147_483_647} | {:error, {:unknown_mod, atom()}}

Translates bitwise mods into a list of atoms and vice versa. This function does not handle the KeyMod, FreeModAllowed, or ScoreIncreaseMods.

Examples

iex> OsuEx.API.Utils.mods(24) |> elem(1) |> MapSet.to_list()
[:HD, :HR]

iex> OsuEx.API.Utils.mods([:DT, :FL])
{:ok, 1088}

iex> OsuEx.API.Utils.mods([:QQ])
{:error, {:unknown_mod, :QQ}}
Link to this function scoring_type(arg1) View Source
scoring_type(0..3) :: atom()
scoring_type(atom()) :: 0..3

Translates the scoring type enum to an atom and vice versa.

Examples

iex> OsuEx.API.Utils.scoring_type(0)
:score

iex> OsuEx.API.Utils.scoring_type(:accuracy)
1
Link to this function team(arg1) View Source
team(1..2) :: atom()
team(atom()) :: 1..2

Translates the team enum to an atom and vice versa.

Examples

iex> OsuEx.API.Utils.team(1)
:blue

iex> OsuEx.API.Utils.team(:red)
2
Link to this function team_type(arg1) View Source
team_type(0..3) :: atom()
team_type(atom()) :: 0..3

Translates the team type enum to an atom and vice versa.

Examples

iex> OsuEx.API.Utils.team_type(0)
:head_to_head

iex> OsuEx.API.Utils.team_type(:tag_coop)
1