![Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack](https://cdn.sanity.io/images/cgdhsj6q/production/6af25114feaaac7179b18127c83327568ff592d1-1024x1024.webp?w=800&fit=max&auto=format)
Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
@pkmn/client
Advanced tools
Readme
@pkmn/client
Package encapsulating a refactored and extended version of the generic parts of the official Pokémon Showdown's client's engine.
The package has the following goals:
@pkmn
projectsTo that end, any divergence from the canonical Pokémon Showdown's client can be explained as desirable to meet one of more of these requirements.
$ npm install @pkmn/client
Note that either @pkmn/dex
or @pkmn/sim
must also be installed to provide
a Dex
implementation for the @pkmn/data
library @pkmn/client
depends on.
@pkmn/client
maintains a battle's state based on information contained in the Pokémon Showdown
protocol. A
Battle
can be instantiated with a Generations
instance and used to track the
state of a battle by add
-ing protocol messages off the wire. The Battle
can then be queried
to determine information about the sides / field / Pokemon involved and their current status. The
state information that can be obtained from the protocol goes beyond the information provided in
the |request|
messages sent from the server and together both provide a more complete view of the
true state of the battle.
import {Battle} from '@pkmn/client';
import {Generations} from '@pkmn/data';
import {Dex} from '@pkmn/dex';
const battle = new Battle(new Generations(Dex));
for await (const chunk of stream) {
// Alternatively: for (const {args, kwArgs} of Protocol.parse(chunk))
for (const line of chunk.split('\n')) {
battle.add(line);
}
battle.update(); // optional, only relevant if stream contains |request|
... // manipulate battle
}
The UI integration test serves as an example for how the
@pkmn/client
library can be used to display the results of a battle visually. Note how it makes
use of multiple Handler
's ordered carefully to account for when the Battle
state was
updated. @pkmn/view
's LogFormatter
is an example of
a Handler
which depends on being run before the client's Handler
(and has been designed to
work hand-in-hand with Battle
).
The recommended way of using @pkmn/client
in a web browser is to configure your bundler
(Webpack, Rollup,
Parcel, etc) to minimize it and package it with the rest of your
application.
@pkmn/client
departs from Pokémon Showdown's client in the following ways:
@pkmn/protocol
to help improve type-safety and
relies on a separate Handler
which is used to build up the Battle
state.@pkmn/sim
representations and the types required by other @pkmn
projects.|request|
messages in addition to the regular output log protocol.
Pokémon Showdown handles |request|
messages separately and allows for the information from the
request to be used to improve the accuracy of the state that has been built up from battle output
with optional 'ServerPokemon
' parameters to various methods, @pkmn/client
merges the request
state with the state it has determined from the other protocol messages to ensure the Battle
state always reflects the totality of information we have received from the server.@pkmn/client
allows for the sets of either team to be provided when a Battle
is instantiated
so that the set information can be included with the tracked Pokemon
instances (though note that
the TeamValidator
inside the simulator may make modifications to the set which may cause
discrepancies).This package is distributed under the terms of the MIT License. Substantial amounts of the code have been derived from the portions of the Pokémon Showdown client which are distributed under the MIT License.
FAQs
Client battle engine for Pokémon Showdown
The npm package @pkmn/client receives a total of 17 weekly downloads. As such, @pkmn/client popularity was classified as not popular.
We found that @pkmn/client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.