bus: use json for data transport, new plugins#1019
Open
Conversation
Contributor
|
it would be good to be able to send a message via bus,instead of just commands, just like the old one |
|
W |
Contributor
lututui
reviewed
Sep 16, 2017
control/sys.txt
Outdated
| # if loadPlugins is set to 2, this comma-separated list of plugin names (filename without the extension) | ||
| # specifies which plugin files to load at startup or when the "plugin load all" command is used. | ||
| loadPlugins_list macro,profiles,breakTime,raiseStat,raiseSkill,map,reconnect,eventMacro,item_weight_recorder | ||
| loadPlugins_list macro,profiles,breakTime,raiseStat,raiseSkill,map,reconnect,eventMacro,item_weight_recorder,bus_hook,bus_party,bus_command |
Member
There was a problem hiding this comment.
I don't think bus_party should be on by default
src/Bus/Messages.pm
Outdated
| use base qw(Exporter); | ||
| use Encode; | ||
| use Utils::Exceptions; | ||
| use JSON; |
Member
There was a problem hiding this comment.
JSON::Tiny is already part of src/deps, can we use it?
|
|
||
| use FindBin qw($RealBin); | ||
| use lib "$RealBin/.."; | ||
| use lib "$RealBin/../deps"; |
Member
There was a problem hiding this comment.
use lib "$RealBin/../..", since XSTools.dll is there by default.
The same goes for src/Bus/bus-server.pl
Member
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



bustransport mechanism from packed binary data to JSON.verboseoption toBus::Client.CLIENT_LIST2packet type, which returns data as an array of hashes instead of a flat hash.bus_hookpluginbus_hookplugin which converts bus messages into hook calls, and vice versa.** Hook
bus/send- allow plugins other thanbus_hookto send bus messages.** Hook
bus/sent- called wheneverbus_hooksends a bus message.** Hook
bus/recv- called wheneverbus_hookreceives a bus message.** Hook
bus/recv/$MID- where$MIDis the actual message ID (eg,JOINorLEAVE) - called wheneverbus_hookreceives a bus message with message ID equal to$MIDbus_partypluginbus_party 1inconfig.txt.bus_partyplugin which sends party update packets every 0.2 seconds, and updates the party with data from the bus.bus_commandpluginbus_commandplugin which runs commands sent over the bus.bus-command.plscript which sends a command over the bus, from the command line, to thebus_commandplugin.**
ALL= all bots (this is redundant, because not sending a group means the same thing)**
AI=auto= all bots with auto AI**
AI=manual= all bots with manual AI**
AI=off= all bots with AI turned off**
ONLINE= all bots fully in-game**
OFFLINE= all bots which are not fully in-game**
LEADERS= all bots which are not following (ie,followis turned off)**
FOLLOWERS= all bots which are following (ie,followis on andfollowTargetis set)**
MAP=...= all bots where...matches the map the bot is on (eg,prontera)**
var=...= all bots where...matches the value of the config variablevar.** Additionally, any value which matches a value in the
bus_command_groupscomma-separated config variable.ONLINE,MAP=prontera,SHOPSwould match bots which are fully in-game, on thepronteramap, and havebus_command_groupsset toSHOPS.