dist/models~ DataManagerBase

new DataManagerBase()

Represents a Pokedex.

Members

effects :Object.<number, MoveEffect>

A dictionary of move effects, indexed by ID.

Type:
  • Object.<number, MoveEffect>

itemByNameIndex :Map.<string, Item>

Gets a Map of items indexed by their name.

Type:
  • Map.<string, Item>

items :Object.<number, Item>

A dictionary of items, indexed by ID.

Type:
  • Object.<number, Item>

list_alolan :Array.<number>

Gets a list of Alolan Pokemon species IDs.

Type:
  • Array.<number>

list_event :Array.<number>

Gets a list of Event Pokemon species IDs.

Type:
  • Array.<number>

list_galarian :Array.<number>

Gets a list of Galarian Pokemon species IDs.

Type:
  • Array.<number>

list_hisuian :Array.<number>

Gets a list of Hisuian Pokemon species IDs.

Type:
  • Array.<number>

list_legendary :Array.<number>

Gets a list of Legendary Pokemon species IDs.

Type:
  • Array.<number>

list_mega :Array.<number>

Gets a list of Mega Evolution Pokemon species IDs.

Type:
  • Array.<number>

list_mythical :Array.<number>

Gets a list of Mythical Pokemon species IDs.

Type:
  • Array.<number>

list_paradox :Array.<number>

Gets a list of Paradox Pokemon species IDs.

Type:
  • Array.<number>

list_ub :Array.<number>

Gets a list of Ultra Beast Pokemon species IDs.

Type:
  • Array.<number>

moveByNameIndex :Map.<string, Move>

Gets a Map of moves indexed by their name.

Type:
  • Map.<string, Move>

moves :Object.<number, Move>

A dictionary of moves, indexed by ID.

Type:
  • Object.<number, Move>

pokemon :Object.<number, Species>

A dictionary of Pokemon species, indexed by ID.

Type:
  • Object.<number, Species>

speciesByDexNumberIndex :Map.<number, Array.<Species>>

Gets a Map of species indexed by their dex number.

Type:
  • Map.<number, Array.<Species>>

speciesByNameIndex :Map.<string, Array.<Species>>

Gets a Map of species indexed by their name.

Type:
  • Map.<string, Array.<Species>>

speciesIdByMoveIndex :Map.<number, Array.<number>>

Gets a Map of species IDs indexed by move ID.

Type:
  • Map.<number, Array.<number>>

speciesIdByRegionIndex :Map.<string, Array.<number>>

Gets a Map of species IDs indexed by Pokemon region.

Type:
  • Map.<string, Array.<number>>

species_id_by_type_index :Record.<string, Array.<number>>

Gets a dictionary of species IDs indexed by Pokemon type.

Type:
  • Record.<string, Array.<number>>

Methods

allItems() → {Array.<Item>}

Gets a list of all items.

Returns:

A list of all items.

Type: 
Array.<Item>

allPokemon() → {Array.<Species>}

Gets a list of all Pokemon species.

Returns:

A list of all Pokemon species.

Type: 
Array.<Species>

allSpeciesByName(name) → {Array.<Species>}

Gets a list of all species with the given name.

Parameters:
NameTypeDescription
namestring

The name of the Pokemon species.

Returns:

A list of Pokemon species.

Type: 
Array.<Species>

allSpeciesByNumber(number) → {Array.<Species>}

Gets a list of all species with the given dex number.

Parameters:
NameTypeDescription
numbernumber

The dex number.

Returns:

A list of Pokemon species.

Type: 
Array.<Species>

checkinitialized()

Checks if the DataManager has been initialized.

Throws:

If the DataManager is not initialized.

Type
Error

findSpeciesByNumber(number) → {Species|null}

Finds a species by its dex number.

Parameters:
NameTypeDescription
numbernumber

The dex number.

Returns:

The Pokemon species with the given dex number, or null if not found.

Type: 
Species | null

itemByName(name) → {Item|null}

Finds an item by its name.

Parameters:
NameTypeDescription
namestring

The name of the item.

Returns:

The item with the given name, or null if not found.

Type: 
Item | null

itemByNumber(number) → {Item|null}

Finds an item by its ID.

Parameters:
NameTypeDescription
numbernumber

The ID of the item.

Returns:

The item with the given ID, or null if not found.

Type: 
Item | null

listMove(moveName) → {Array.<number>}

Gets a list of Pokemon species IDs that can learn a given move.

Parameters:
NameTypeDescription
moveNamestring

The name of the move.

Returns:

A list of Pokemon species IDs.

Type: 
Array.<number>

listRegion(region) → {Array.<number>}

Gets a list of Pokemon species IDs for a given region.

Parameters:
NameTypeDescription
regionstring

The name of the region.

Returns:

A list of Pokemon species IDs.

Type: 
Array.<number>

moveByName(name) → {Move|null}

Finds a move by its name.

Parameters:
NameTypeDescription
namestring

The name of the move.

Returns:

The move with the given name, or null if not found.

Type: 
Move | null

moveByNumber(number) → {Move|null}

Finds a move by its ID.

Parameters:
NameTypeDescription
numbernumber

The ID of the move.

Returns:

The move with the given ID, or null if not found.

Type: 
Move | null

randomSpawn(rarityopt) → {Species}

Returns a random Pokemon species.

Parameters:
NameTypeAttributesDefaultDescription
raritystring<optional>
'normal'

The rarity of the Pokemon to spawn. Can be 'normal', 'mythical', 'legendary', or 'ultra_beast'.

Returns:

A random Pokemon species.

Type: 
Species

randomSpawnPokemon(rarityopt) → {PokemonBase}

Returns a random Pokemon.

Parameters:
NameTypeAttributesDefaultDescription
raritystring<optional>
'normal'

The rarity of the Pokemon to spawn. Can be 'normal', 'mythical', 'legendary', or 'ultra_beast'.

Returns:

A random Pokemon instance.

Type: 
PokemonBase

speciesByName(name) → {Species|null}

Finds a species by its name.

Parameters:
NameTypeDescription
namestring

The name of the Pokemon species.

Returns:

The Pokemon species with the given name, or null if not found.

Type: 
Species | null

weightedRandomChoice(weights) → {number}

Chooses a random element from a list of weights using weighted random selection.

Parameters:
NameTypeDescription
weightsArray.<number>

A list of weights.

Returns:

The index of the chosen element.

Type: 
number