Utilities
There are also a few utility functions provided to help the user convert typical string names to the relevant ID for their corresponding Dex Class.
Dex Data Utilities:
Provides tools for cleaning Dex IDs back and forth from strings, as well as other utility functions.
cast2dex(name, dex_class)
Clean and cast name to the corresponding entry in the given dex_class.
EX: Magikarp -> Cleaned to: MAGIKARP -> DexPokemon.POKEMON_MAGIKARP (Which is secretly the int 129000)
EX: Scizor-Mega -> Cleaned to: SCIZORMEGA -> DexPokemon.POKEMON_SCIZORMEGA (Which is secretly the int 208001)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the entry. |
required |
dex_class |
AnyDex
|
Which Dex Enum to use in labeling. Must be a valid Dex{NAME} class. |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
The corresponding value for this cleaned entry. |
Source code in poketypes\dex\dexdata.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
clean_forme(species)
Transform a pokemon species (DexPokemon) into the string name of it's base forme.
Makes use of the fact that DexPokemon are of the form {dex_number}{3-digit forme number},
and that the base forme is always forme-number 000
.
If this changes, this function will no longer work.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species |
ValueType
|
The input species to clean to base forme. |
required |
Returns:
Type | Description |
---|---|
ValueType
|
DexPokemon.ValueType: The corresponding ID of the base forme species. |
Source code in poketypes\dex\dexdata.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
|
clean_name(name)
Format a given uncleaned string name as the format needed for searching the corresponding Enum.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Optional[str]
|
An optional name to clean. If None is given, we immediately return None. |
required |
Returns:
Type | Description |
---|---|
Optional[str]
|
Optional[str]: The clean-form of the input name, if it wasn't None or blank. |
Source code in poketypes\dex\dexdata.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|