pokemon-showdown/dev-tools/globals.ts
Guangcong Luo ab1f995daa Rewrite Process Manager
Process Manager is now lib/process-manager.js

It's been entirely rewritten to reflect what I think a process manager
API should look like.

In particular, there are now two Process Managers, QueryProcessManager
and StreamProcessManager.

Pass QueryProcessManager a pure-ish query function (sync or async) that
takes a JSON value and returns a JSON value, and PM.query() will
execute that function in a subprocess, and return a Promise for its
return value.

StreamProcessManager is the same idea: Pass it a function to create an
ObjectReadWriteStream, and PM.createStream() will create a stream in a
subprocess and return a stream connected to it.
2018-01-18 03:34:16 -06:00

92 lines
2.7 KiB
TypeScript

interface AnyObject {[k: string]: any}
let Config = require('../config/config');
let Monitor = require('../monitor');
let LoginServer = require('../loginserver');
type RoomBattle = AnyObject;
let Verifier = require('../verifier');
let Dnsbl = require('../dnsbl');
let Sockets = require('../sockets');
// let TeamValidator = require('../sim/team-validator');
let TeamValidatorAsync = require('../team-validator-async');
type GenderName = 'M' | 'F' | 'N' | '';
type StatName = 'hp' | 'atk' | 'def' | 'spa' | 'spd' | 'spe';
type StatsTable = {hp: number, atk: number, def: number, spa: number, spd: number, spe: number};
type SparseStatsTable = {hp?: number, atk?: number, def?: number, spa?: number, spd?: number, spe?: number};
type PokemonSet = {
name: string,
species: string,
item: string,
ability: string,
moves: string[],
nature: string,
evs?: SparseStatsTable,
gender?: string,
ivs?: SparseStatsTable,
shiny?: boolean,
level?: number,
happiness?: number,
pokeball?: string,
hpType?: string,
};
/**
* Describes a possible way to get a move onto a pokemon.
*
* First character is a generation number, 1-7.
* Second character is a source ID, one of:
*
* - L = start or level-up, 3rd char+ is the level
* - M = TM/HM
* - T = tutor
* - E = egg
* - S = event, 3rd char+ is the index in .eventPokemon
* - D = Dream World, only 5D is valid
* - V = Virtual Console transfer, only 7V is valid
* - C = NOT A REAL SOURCE, see note, only 3C/4C is valid
*
* C marks certain moves learned by a pokemon's prevo. It's used to
* work around the chainbreeding checker's shortcuts for performance;
* it lets the pokemon be a valid father for teaching the move, but
* is otherwise ignored by the learnset checker (which will actually
* check prevos for compatibility).
*/
type MoveSource = string;
/**
* Describes a possible way to get a pokemon. Is not exhaustive!
* sourcesBefore covers all sources that do not have exclusive
* moves (like catching wild pokemon).
*
* First character is a generation number, 1-7.
* Second character is a source ID, one of:
*
* - E = egg, 3rd char+ is the father in gen 2-5, empty in gen 6-7
* because egg moves aren't restricted to fathers anymore
* - S = event, 3rd char+ is the index in .eventPokemon
* - D = Dream World, only 5D is valid
* - V = Virtual Console transfer, only 7V is valid
*
* Designed to match MoveSource where possible.
*/
type PokemonSource = string;
type EventInfo = {
generation: number,
level?: number,
shiny?: true | 1,
gender?: GenderName,
nature?: string,
ivs?: SparseStatsTable,
perfectIVs?: number,
isHidden?: boolean,
abilities?: string[],
moves?: string[],
pokeball?: string,
from: string,
};