-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #453 from hanzi/plugin-and-stats-docs
Add Wiki pages for plugins and the stats database
- Loading branch information
Showing
5 changed files
with
205 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
🏠 [`pokebot-gen3` Wiki Home](../Readme.md) | ||
|
||
# 🧩 Plugins | ||
|
||
If you know Python and want to customise the behaviour of the bot, you can create a plugin. | ||
|
||
Plugins are little scripts that get called for specific events during the game (such as a | ||
battle starting, an egg hatching, etc.) Take a look at | ||
[modules/plugin_interface.py](../../modules/plugin_interface.py) for a list of events that | ||
a plugin may be called for. | ||
|
||
|
||
## Creating a plugin | ||
|
||
To make a plugin, create a Python file inside the `plugins/` directory. This must have the | ||
`.py` file extension and it must be placed directly in the `plugins/` directory, not in a | ||
subdirectory. | ||
|
||
In this file, create a class that inherits from `BotPlugin`. So the most basic implementation | ||
of a plugin would be: | ||
|
||
```python | ||
from modules.plugin_interface import BotPlugin | ||
|
||
class MyFirstPlugin(BotPlugin): | ||
pass | ||
``` | ||
|
||
Of course, this doesn't do anything yet. You can choose some method from the parent `BotPlugin` | ||
class to overwrite (see [modules/plugin_interface.py](../../modules/plugin_interface.py) for | ||
a list.) | ||
|
||
|
||
## Why write a plugin and not just edit the bot's code? | ||
|
||
The `plugins/` directory is excluded from the Git repository and will also not be touched by | ||
the automatic updater. So code in that directory won't fall victim to future updates -- | ||
whereas if you edit the bot's code directly, this might get removed again when the bot updates | ||
and you're not careful. | ||
|
||
|
||
## Example plugins | ||
|
||
While not meant to be just an example, there are some features that use the bot's plugin | ||
infrastructure to work. | ||
|
||
You can find those 'default plugins' in [modules/built_in_plugins/](../../modules/built_in_plugins/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
🏠 [`pokebot-gen3` Wiki Home](../Readme.md) | ||
|
||
# 📊 Statistics Database | ||
|
||
The bot stores its statistics in an sqlite3 database. This file can be found in the | ||
profile directory, at `profiles/<profile name>/stats.db`. | ||
|
||
This contains 4 main tables: | ||
|
||
- **encounters** contains information about encountered Pokémon. If `log_encounters` is | ||
enabled (see [the Wiki page on logging](Console,%20Logging%20and%20Image%20Config.md)), | ||
this will contain _all_ encountered Pokémon. Otherwise it just contains shinies, | ||
roaming Pokémon as well as Pokémon that matched a custom catch filter. | ||
- **shiny_phases** contains information about Shiny Phases, etc. the time periods between | ||
two shiny encounters. | ||
- **encounter_summaries** contains information for each species (and in case of Unown, for | ||
each single letter) the bot has encountered in this profile and so can answer questions | ||
like 'How many Seedot have we encountered in total?' By summing all those individual | ||
species entries you get the total stats. | ||
- **pickup_items** contains a list of items that have been acquired using the Pickup ability, | ||
and how many of them have been picked up so far. |