Skip to content
Casper1123 edited this page Aug 21, 2022 · 17 revisions

Welcome to the smogon-moveset-file-decoder wiki! Well.. for how much it is a wiki. Here will be some useful information on how to use this:

Getting started

Step 1

Start with importing the file into your project. Quite simple, as this isn't a project put on pip (quite yet?). Just throw the .py file into the same folder as your project and add import smogon_decoder to it. Or, if you want to prevent yourself from stubbing your toe on the stupidly long name I gave it, either rename it import smogon_decoder as sd or just import everything from it if you dare from smogon_decoder import *.

Step 2

Get to work.

Main information

Data location

The data this package pulls from is located here.

convert_to_json(dictionaries)

dictionaries: list[dict] or dict -> Takes a dictionary as input and returns a json-loadable string as output.\

get_mon_data_from_data(data_list, pokemon_name)

data_list: list[dict] -> list[dict] containing processed data from files. Get processed data with some of the function in this package. pokemon_name: str -> the name of the Pokémon you want your data from. Make sure to enter in quite precisely (though it's not capital sensitive). I.E. Tapu Koko or Metagross-Mega.
return: dict -> following the data structure up top
May raise the following: UnfoundMon: Could not find or wrong string.

General (no special filepath)

Data structure

All of the data will be given in dictionaries, currently in the following format:

[
    {
        "name": str,
        "rank": int,
        "usage": float,
        "raw": int,
        "raw%": float,
        "real": int,
        "real%": float,
        "general": {
            "total_battles": int,
            "avg_weight/team": float
        }
    }
]

get_general_file(year, month, generation, gamemode, mmr)

year: int
month: int -> year and month of how old the data should be. Will only go up to last month.
generation: int -> the generation the data needs to be from.
gamemode: str -> the gamemode the data needs to be from. I.E. ou
mmr: int -> mmr the data needs to come from. Most modes have mmr data on 0, 1500, 1630, 1760.
return: str -> this is the raw, unprocessed string of the file you were looking for. You can throw this directly into one of the two processing functions if you want. This is really long and may take a lot of RAM.
May raise the following: RegistryError: Impossible year or month; Error404: Did not find anything with given parameters (probably mmr setting at fault)

decode_smogon_general_data(general_file)

moveset_file: str or list[str] -> The raw data from a general file.
return: list[dict] -> all mons in the file with their own dict following the above data structure. This can be really long, and take up quite some RAM.

/moveset/

Data structure

All of the data will be given in dictionaries, currently in the following format:

    {
        "name": str,
        "general":
            {
                "raw_count": int,
                "average_weight": float,
                "viability_ceiling": int
            },
        "abilities": [
            {
                "name": str,
                "usage": float
            }
        ],
        "items": [
            {
                "name": str,
                "usage": float
            }
        ],
        "spreads": [
            {
                "nature": str,
                "evs": {
                    "health": int,
                    "attack": int,
                    "defense": int,
                    "special-attack": int,
                    "special-defense": int,
                    "speed": int
                },
                "usage": float
            }
        ],
        "moves": [
            {
                "name": str,
                "usage": float
            }
        ],
        "teammates": [
            {
                "name": str,
                "usage": float
            }
        ],
        "checks_and_counters": [
            {
                "name": str,
                "effectiveness": float,
                "effectiveness_offset": float,
                "unknown_statistic": float,
                "ko": float,
                "switched_out": float
            }
        ]
    }

checks_and_counters["unknock_statistic"] is a statistic that I could not find the meaning of. Any assistance will be greatly appreciated.

Functions

get_moveset_file(year, month, generation, gamemode, mmr, monotype)

year: int
month: int -> year and month of how old the data should be. Will only go up to last month.
generation: int -> the generation the data needs to be from.
gamemode: str -> the gamemode the data needs to be from. I.E. ou.
mmr: int -> mmr the data needs to come from. Most modes have mmr data on 0, 1500, 1630, 1760.
monotype: Optional bool (default: False) -> Redirects to the /monotype/ subfolder. Also prefixes gamemode with monotype-. Does not include the natdexmonotype gamemodes.
return: str -> this is the raw, unprocessed string of the file you were looking for. You can throw this directly into one of the two processing functions if you want. This is really long and may take a lot of RAM.
May raise the following: RegistryError: Impossible year or month; Error404: Did not find anything with given parameters (probably mmr setting at fault)

decode_smogon_moveset_data(moveset_file)

moveset_file: str or list[str] -> The raw data from a moveset file.
return: list[dict] -> all mons in the file with their own dict following the above data structure. This can be really long, and take up quite some RAM.

/leads/

Data Structure

All of the data will be given in dictionaries, currently in the following format:

    {
        "name": str,
        "rank": int,
        "usage": float,
        "raw": int,
        "raw%": float,
        "general": {
            "total_leads": int
        }
    }

get_leads_file(year, month, generation, gamemode, mmr, monotype)

year: int
month: int -> year and month of how old the data should be. Will only go up to last month.
generation: int -> the generation the data needs to be from
gamemode: str -> the gamemode the data needs to be from. I.E. ou.
mmr: int -> mmr the data needs to come from. Most modes have mmr data on 0, 1500, 1630, 1760.
monotype: Optional bool (default: False) -> Redirects to the /monotype/ subfolder. Also prefixes gamemode with monotype-. Does not include the natdexmonotype gamemodes.
return: str -> this is the raw, unprocessed string of the file you were looking for. You can throw this directly into one of the two processing functions if you want. This is really long and may take a lot of RAM.
May raise the following: RegistryError: Impossible year or month; Error404: Did not find anything with given parameters (probably mmr setting at fault)

decode_smogon_leads_data(leads_file)

moveset_file: str or list[str] -> The raw data from a leads file.
return: list[dict] -> all mons in the file with their own dict following the above data structure. This can be really long, and take up quite some RAM.

/metagame/

Data structure:

All of the data will be given in dictionaries, currently in the following format:

{
    "playstyles": [
        {
            "name": str,
            "usage": float
        }
    ],
    "stalliness": {
        "mean": float,
        "detailed": [
                {
                    "weight": float,
                    "value": float
                }
            ]
        }
}

get_metagame_file(year, month, generation, gamemode, mmr, monotype)

year: int
month: int -> year and month of how old the data should be. Will only go up to last month.
generation: int -> the generation the data needs to be from
gamemode: str -> the gamemode the data needs to be from. I.E. ou.
mmr: int -> mmr the data needs to come from. Most modes have mmr data on 0, 1500, 1630, 1760.
monotype: Optional bool (default: False) -> Redirects to the /monotype/ subfolder. Also prefixes gamemode with monotype-. Does not include the natdexmonotype gamemodes.
return: str -> this is the raw, unprocessed string of the file you were looking for. You can throw this directly into one of the two processing functions if you want. This is really long and may take a lot of RAM.
May raise the following: RegistryError: Impossible year or month; Error404: Did not find anything with given parameters (probably mmr setting at fault)

decode_smogon_metagame_data(metagame_file)

metagame_file: str or list[str] -> The raw data from a metagame file.
return: dict -> all metagame statistics present in /metagame/ files nicely compacted into a single dict.