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
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
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
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
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
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}}
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
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
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