Giter VIP home page Giter VIP logo

bigbrotherbot / big-brother-bot Goto Github PK

View Code? Open in Web Editor NEW
145.0 145.0 145.0 15.77 MB

Big Brother Bot B3 is a complete and total server administration package for online games. B3 is designed primarily to keep your server free from the derelicts of online gaming, but offers more, much more.

Home Page: http://www.bigbrotherbot.net

Python 96.96% HTML 2.30% Makefile 0.10% Batchfile 0.09% Inno Setup 0.12% Shell 0.43%

big-brother-bot's People

Contributors

82ndab-bravo17 avatar ansa89 avatar bdgrell avatar cron410 avatar cyberplant avatar dahool avatar danielepantaleone avatar durzo avatar dwarfer avatar ehdspoon avatar fenixxx avatar gammelbob avatar grosbedo avatar hedayat avatar isala404 avatar ismael avatar iznogod avatar jonesman avatar justabaka avatar lrq3000 avatar markweirath avatar ozguruysal avatar ozon avatar stephano2000 avatar tanka8 avatar thomasleveil avatar thomaxius avatar timnboys avatar v0y avatar waindor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

big-brother-bot's Issues

[BF4] commander

The commander role is a entirely new concept to B3. Its support won't be easy to implement in the bf4.py parser.

Here's a list of features to check:

  • make sure the commander role is be detected when B3 starts and a commander commander is already playing
  • make sure the commander role is be detected when a player join the server and goes straight to commander position
  • make sure both commander are assigned either b3.TEAM_RED or b3.TEAM_BLUE to the client.team property.
  • add a new property named is_commander to the Client object and set its value to True or False accordingly. Maybe patch the Client object as with patch_b3_Client_isAlive ?
  • make sure that moving from commander to normal player is detected and is_commander changed

Difficulties to pay attention at:

  • figure out and document how the rcon player.isAlive command reacts with the commander role. Take a look at patch_b3_Client_isAlive in bf4.py and see if anything should be changed

depends: #97

[DOC] start a user documentation

as stated by @ozon the current state of the B3 documentation is poor and does not ease contributions.


The solution is to move the user documentation sources to github to ease contributions.
The framework for writing the documentation will be sphinx.
The documentation sources should be committed to b3/docs/user_documentation/

Table of Contents

  • Overview
  • Download
  • Install
  • Configure (just the mandatory stuff from b3.xml to get started)
  • First run
  • Usage
    • Groups / levels
    • Commands
  • Advanced configuration
  • Plugins

Of course suggestions for a different table of contents are welcome.

[CS:GO] Wrong bot detection ?

On my CS:GO installation B3 don't detect bot.

I fixed the detection in xlrstats.py and replaced the condition after # test if it is a bot and flag it
if client.guid == '':

Warning: Table 'current_svars' already exists

It was reported that B3 1.10dev.daily20 fails to detect that tables current_svars and current_clients already exist.

130403 03:03:08   BOT       'StatusPlugin: Loading config conf\\plugin_status.xml for StatusPlugin'
130403 03:03:08   DEBUG   'StatusPlugin: Using default table for saving server svars: current_svars'
130403 03:03:08   DEBUG   'StatusPlugin: Using default table for saving current clients: current_clients'
130403 03:03:08   ERROR   'STDERR "C:\\\\Documents and Settings\\\\Owner\\\\Desktop\\\\b3\\\\BigBrotherBot-1.10.0dev.daily20-20130331-win32\\\\b3.lib\\\\b3\\\\storage\\\\database.py:270: Warning: Table \'current_svars\' already exists\\n"'
130403 03:03:08   ERROR   'STDERR "C:\\\\Documents and Settings\\\\Owner\\\\Desktop\\\\b3\\\\BigBrotherBot-1.10.0dev.daily20-20130331-win32\\\\b3.lib\\\\b3\\\\storage\\\\database.py:270: Warning: Table \'current_clients\' already exists\\n"'
130403 03:03:08   VERBOSE   'Added crontab <bound method StatusPlugin.update of <b3.plugins.status.StatusPlugin instance at 0x00CA15D0>> (32141360) -
s -1m -1h -1d -1M -1DOW'
130403 03:03:08   DEBUG   'Register Event: Stop Process: StatusPlugin'
130403 03:03:08   DEBUG   'Register Event: Program Exit: StatusPlugin'

This needs to be analysed to decide if a fix is needed.

[BF4] spectators

Now that BF4 has a spectator mode, the B3 bf4 parser needs to handle it correctly.

TODO

  • correctly assign the value of client.team to b3.TEAM_SPEC to players in spectator mode. This is particularly important for plugins doing team balancing, etc. In the bf4.py file, see method getTeam.
  • make sure client.team is correct when B3 starts and a player is already in spectator mode
  • make sure client.team is correct when a player joins the server straight in spectator mode
  • make sure client.team is correctly changed when a player moves from/to spectator mode

depends: #97

[BF3] read player rank from server Player info block

In BF3 R38 the Player info block has a new field : rank

The PlayerInfoBlock class must be updated to be able to read correctly that kind of data from R38 game servers.

doc

Player info block

The standard set of info for a group of players contains a lot of different fields. To reduce the risk of having to do backwards-incompatible changes to the protocol, the player info block includes some formatting information.

<number of parameters> number of parameters for each player
N x <parameter type: string> the parameter types that will be sent below
<number of players> number of players following
M x N x <parameter value> all parameter values for player 0, then all parameter values for player 1, etc.

Current parameters:

field name field type description
name string player name
guid GUID player’s GUID
teamId Team ID player’s current team
squadId Squad ID player’s current squad
kills integer number of kills, as shown in the in-game scoreboard
deaths integer number of deaths, as shown in the in-game scoreboard
score integer score, as shown in the in-game scoreboard
rank integer the rank of the player

[BF4] change tests for admin.listPlayers

admin.listPlayers all return in R17 the fields

( 'name', 'guid', 'teamId', 'squadId', 'kills', 'deaths', 'score', 'rank', 'ping', 'type')

B3 works fine but the tests dosnt respect all fields.

Make the MySQL database use the InnoDB engine

See forum discussion

Currently (B3 1.9b2) the MySQL database engine is MyISAM. The migration toward the InnoDB engine is motivated by administration concerns. Mainly :

  • no dataloss when database server crashes
  • hot backup without interruption of service

However migrating to the InnoDB engine involves changes to the B3 code :

  • in the SQL scripts obviously
  • in the python code that runs the SQL queries as the InnoDB engine supports transactions
  • a migration script that would be able to upgrade an existing B3 database using the MyISAM engine

[BF3] add new maps and gamemodes for DLC End Game

XPACK5 game maps

These are the different maps that are available in the Battlefield 3 PC XPACK5 game.

Engine name Human-readable name
XP5_001 Operation Riverside
XP5_002 Nebandan Flats
XP5_003 Kiasar Railroad
XP5_004 Sabalan Pipeline

XPACK5 game modes

These are the different gamemodes which are available for the Battlefield 3 PC XPACK5 game maps.

Engine name Human-readable name Intended player count
ConquestLarge0 Conquest64 Up to 64
ConquestSmall0 Conquest Up to 32
ConquestAssaultLarge0 Conquest Assault64 Up to 64
ConquestAssaultSmall0 Conquest Assault Up to 32
RushLarge0 Rush Up to 32
SquadRush0 Squad Rush Up to 8
SquadDeathMatch0 Squad Deathmatch Up to 16
TeamDeathMatch0 Team Deathmatch Up to 24
CaptureTheFlag0 Capture The Flag Up to 32
AirSuperiority0 Air Superiority Up to 24

[CORE] plugins can't perform operations upon enable/disable

Today I had the need to perform certain operations in a plugin before this plugin was going to be disabled. I noticed that b3 doesn't allow this. I'm suggesting to add 2 methods to the plugin class (respectively onEnable() and onDisable()) in order to provide such functionality.

[xlrstats] plugin sql queries do not escape string values

as the log below shows

140110 20:45:31   VERBOSE  'Parsing Event: Client Action: XlrstatsPlugin'
140110 20:45:31   ERROR u'[SELECT * from xlr_actionstats WHERE name = "purchased "taser"" LIMIT 1] None'
140110 20:45:31   ERROR 'handler XlrstatsPlugin could not handle event Client Action: ProgrammingError: (1064, \'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \\\'taser"" LIMIT 1\\\' at line 1\') [(\'/usr/lib/python2.7/site-packages/b3-1.10.0dev.daily147_20140110-py2.7.egg/b3/parser.py\', 1075, \'handleEvents\', \'hfunc.parseEvent(event)\'), (\'/usr/lib/python2.7/site-packages/b3-1.10.0dev.daily147_20140110-py2.7.egg/b3/plugin.py\', 197, \'parseEvent\', \'self.onEvent(event)  # keep backwards compatibility\'), (\'/usr/lib/python2.7/site-packages/b3-1.10.0dev.daily147_20140110-py2.7.egg/b3/extplugins/xlrstats.py\', 459, \'onEvent\', \'self.action(event.client, event.data)\'), (\'/usr/lib/python2.7/site-packages/b3-1.10.0dev.daily147_20140110-py2.7.egg/b3/extplugins/xlrstats.py\', 1326, \'action\', \'action = self.get_ActionStats(name=data)\'), (\'/usr/lib/python2.7/site-packages/b3-1.10.0dev.daily147_20140110-py2.7.egg/b3/extplugins/xlrstats.py\', 695, \'get_ActionStats\', \'cursor = self.query(q)\'), (\'/usr/lib/python2.7/site-packages/b3-1.10.0dev.daily147_20140110-py2.7.egg/b3/storage/database.py\', 347, \'query\', \'raise e\')]'
140110 20:45:31   VERBOS2  'Client Action event handled by XlrstatsPlugin in 0.639 ms'
140110 20:45:39   CONSOLE  'L 01/10/2014 - 20:45:39: World triggered "Round_Start"'
140110 20:45:39   VERBOS2  "calling on_world_action{'event_name': u'Round_Start', 'properties': u''}"
140110 20:45:39   VERBOSE  'Queueing event Game Round Start <b3.game.Game object at 0x143bad0>'
140110 20:45:39   VERBOSE  'Parsing Event: Game Round Start: XlrstatsPlugin'
140110 20:45:39   VERBOS2  'Game Round Start event handled by XlrstatsPlugin in 0.319 ms'
140110 20:45:53   CONSOLE  'L 01/10/2014 - 20:45:53: "Toubrave<37><BOT><TERRORIST>" threw hegrenade [119 104 -215]'
140110 20:45:53   VERBOS2  "calling on_player_threw{'cid': u'37', 'item': u'hegrenade', 'guid': u'BOT', 'name': u'Toubrave', 'team': u'TERRORIST'}"
140110 20:45:53   VERBOS2  u'Aborted Making Alias for cid: 37, name is the same'
140110 20:45:53   VERBOSE  u'Queueing event Client Action threw "hegrenade"'
140110 20:45:53   VERBOSE  'Parsing Event: Client Action: XlrstatsPlugin'
140110 20:45:53   ERROR u'[SELECT * from xlr_actionstats WHERE name = "threw "hegrenade"" LIMIT 1] None'
140110 20:45:53   ERROR 'handler XlrstatsPlugin could not handle event Client Action: ProgrammingError: (1064, \'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \\\'hegrenade"" LIMIT 1\\\' at line 1\') [(\'/usr/lib/python2.7/site-packages/b3-1.10.0dev.daily147_20140110-py2.7.egg/b3/parser.py\', 1075, \'handleEvents\', \'hfunc.parseEvent(event)\'), (\'/usr/lib/python2.7/site-packages/b3-1.10.0dev.daily147_20140110-py2.7.egg/b3/plugin.py\', 197, \'parseEvent\', \'self.onEvent(event)  # keep backwards compatibility\'), (\'/usr/lib/python2.7/site-packages/b3-1.10.0dev.daily147_20140110-py2.7.egg/b3/extplugins/xlrstats.py\', 459, \'onEvent\', \'self.action(event.client, event.data)\'), (\'/usr/lib/python2.7/site-packages/b3-1.10.0dev.daily147_20140110-py2.7.egg/b3/extplugins/xlrstats.py\', 1326, \'action\', \'action = self.get_ActionStats(name=data)\'), (\'/usr/lib/python2.7/site-packages/b3-1.10.0dev.daily147_20140110-py2.7.egg/b3/extplugins/xlrstats.py\', 695, \'get_ActionStats\', \'cursor = self.query(q)\'), (\'/usr/lib/python2.7/site-packages/b3-1.10.0dev.daily147_20140110-py2.7.egg/b3/storage/database.py\', 347, \'query\', \'raise e\')]'
140110 20:45:53   VERBOS2  'Client Action event handled by XlrstatsPlugin in 0.668 ms'
140110 20:46:00   VERBOSE  'StatusPlugin: Building XML status'
140110 20:46:00   DEBUG 'StatusPlugin: Writing XML status to /home/oxman/Steam/SteamApps/csgo-ds/b3/status.xml'

The fix is to replace code like

q = 'INSERT INTO %s ( name, kills, suicides, teamkills, rounds ) VALUES ("%s", %s, %s, %s, %s)' % (self._table, self.name, self.kills, self.suicides, self.teamkills, self.rounds)
cursor = self.query(q)

with

q = 'INSERT INTO %s ( name, kills, suicides, teamkills, rounds ) VALUES (?, ?, ?, ?, ?)' % self._table
cursor = self.query(q, (self.name, self.kills, self.suicides, self.teamkills, self.rounds))

[CS:GO] Wrong count of rounds

Rounds count for user is wrong.
When the game change round, the player stats don't increment round for user connected.
But the round increase each time the user join the server.

Feature getPlayerPing

I made some thoughts about the player pings.
Currently, B3 get all pings with ´´´console.getPlayerPings´´´.
This causes a lot of traffic which we not always need.
Most parsers fire for each player a single command to the server.

I wanted getPlayerPings() to expand the parameters client_ids = Noneso that we can pass a list of client id's. This should be done for all parser and would also make it a lot broken. So rather a bad idea.

Therefore I would suggest that parsers implement getPlayerPing(player_id) or even better, the client get an attribute with the name 'ping' (which would still include a getPlayerPing).

What is your opinion on this?

use BigText (sayLoudOrPM) only if client alive

BigText is a nice feature. It only has one flaw - at least in BF3. One can not see BigText messages when you are not spawned. So I had the idea to use bigText only when the client is spawned.

The implementation would be relatively easy if you could query whether the client is spawned or not. We cannot query this, but we have the event EVT_CLIENT_SPAWN.

Now I see 2 ways to BigText useful to use in BF3.

  1. Send a message via BigText and normally via chat
  2. use EVT_CLIENT_SPAWN and EVT_CLIENT_KILL to create a variable as like client.isAlive and evaluate it in sayLoudOrPM.

Both are optimal solutions if they can be activated by each configuration.

The problem relates generally to "yell" ... but I think at least PM messages should be displayed definitely.

[punkbuster plugin] make sure pb is enabled in b3.xml

It appears that the pb plugin does not make sure that B3 has punbuster capabilities enabled and this make some commands to crash

TeX;\x15!pbss tex'
130915 13:21:45 VERBOSE u'Queueing event Say !pbss tex'
130915 13:21:45 VERBOSE 'Parsing Event: Say: AdminPlugin'
130915 13:21:45 DEBUG u'AdminPlugin: OnSay handle 5:"!pbss tex"'
130915 13:21:45 DEBUG u'AdminPlugin: Handle command !pbss tex'
130915 13:21:45 ERROR 'handler AdminPlugin could not handle event Say: AttributeError: \'NoneType\' object has no attribute \'getSs\' [(\'C:\\\\UserFiles\\\\PANAGIOTISS\\\\GameServers\\\\TC85016765004468374626008\\\\b3\\\\parser.py\', 1053, \'handleEvents\', \'hfunc.parseEvent(event)\'), (\'C:\\\\UserFiles\\\\PANAGIOTISS\\\\GameServers\\\\TC85016765004468374626008\\\\b3\\\\plugin.py\', 158, \'parseEvent\', \'self.onEvent(event)\'), (\'C:\\\\UserFiles\\\\PANAGIOTISS\\\\GameServers\\\\TC85016765004468374626008\\\\b3\\\\plugin.py\', 176, \'onEvent\', \'self.handle(event)\'), (\'C:\\\\UserFiles\\\\PANAGIOTISS\\\\GameServers\\\\TC85016765004468374626008\\\\b3\\\\plugins\\\\admin.py\', 296, \'handle\', \'self.OnSay(event)\'), (\'C:\\\\UserFiles\\\\PANAGIOTISS\\\\GameServers\\\\TC85016765004468374626008\\\\b3\\\\plugins\\\\admin.py\', 441, \'OnSay\', \'results = command.execute(data, event.client)\'), (\'C:\\\\UserFiles\\\\PANAGIOTISS\\\\GameServers\\\\TC85016765004468374626008\\\\b3\\\\plugins\\\\admin.py\', 2227, \'execute\', \'self.func(data, client, copy.copy(self))\'), (\'C:\\\\UserFiles\\\\PANAGIOTISS\\\\GameServers\\\\TC85016765004468374626008\\\\b3\\\\plugins\\\\punkbuster.py\', 132, \'cmd_pbss\', "client.message(\'^3PunkBuster: ^7 %s\' % self.console.PunkBuster.getSs(sclient))")]'

The improvement would be to have the punkbuster plugin check if self.console.PunkBuster is not None at plugin start.
If it is None, then don't register plugin's commands and put a user friendly warning message in the B3 log file explaining to the user he has to enable Punkbuster capabilities in the b3.xml file.

[iourt42] auth by pbid failed

140120 18:06:30 DEBUG   'Urt42 Client Connected: [3] FakeName94 - THEGUIDOFTHEPLAYERWASHERE ({})'
140120 18:06:31 DEBUG   "Storage: getClientsMatching {'pbid': 'biobizz29'}"
140120 18:06:31 DEBUG   'Frozen Sand Account [biobizz29] unknown in database'
140120 18:06:31 DEBUG   'Storage: getClient Client42<@0:THEGUIDOFTHEPLAYERWASHERE|fakename94:"FakeName94":3>'
140120 18:06:31 ERROR   u'Client has pbid but its not the same fakename94<> None'
140120 18:06:31 BOT     u'Client found in storage @7454, welcome back FakeName94 (FSA: None)'
140120 18:06:31 ERROR   u'Client has pbid but its not the same None <> fakename94'

I changed player GUID and AUTH login with fake ones but keeping the same pattern.

Frostbite Event Queue Full

Im running v1.8.2 on a very popular 32 player Battlefield 3 Gun Master server.

My bot logs are filling up with:

130210 09:42:42 ERROR "Frostbite event queue full, dropping event ...

And the bot is ignoring commands when the server is active.

add a CONTRIBUTING.md file

add a CONTRIBUTING.md file with contributing guidelines as described at https://github.com/blog/1184-contributing-guidelines

The guidelines should have the following sections :

  • welcome
  • contributing issues
    • issues are not support requests, add a link to the B3 forums
    • issues structure : reproduction steps, expected result, actual result
  • contributing code
    • link to pull request help from the github.com website
    • keep one bug fix / feature per pull request
    • run and maintain the automated tests if you can

Anyone is welcome to help writing the content of the CONTRIBUTING.md file here and discussing its content here.

[BF4] add game support

DICE has not released any documentation. But I open this issue to avoid future parallel developments.


Edit by Courgette:

Please use this issue for synchronizing efforts between those who which to contribute on the BF4 parser.

ressources

  • BF4 rcon support topic on fpsadmin.com where Kalms (from DICE) is kindly answering questions. You can also report bugs there and share your issues or advices with other 3rd party rcon tools developers such as the ones from the Procon community.

[setup wizard] cannot set an empty value for bot_prefix while using the setup wizard for BF3

when using the B3 setup wizard to generate a b3.xml file for the bf3 game, when the wizards asks for the bot_prefix value it refuses to accept an empty value (due to no default set in the template).
However an empty value for bot_prefix is still valid.

The issue is that we force the user to enter a value on a non mandatory field ; the user then has to manually edit its b3.xml file to remove that unwanted value.

reproduction steps

  1. run python b3/setup.py --config c:\tmp\b3.xml --setup
  2. when asked for the game, enter bf3
  3. proceed until you are asked for the bot_prefix value and try to enter an empty value

actual result

  • the wizard keeps asking for the bot_prefix value until some value is entered

expected result

  • the wizard accepts an empty value
  • in the final b3.xml file the value for the bot_prefix field is empty

[BF3] make the BF3 parser handle server.onMaxPlayerCountChange game events

There is an unhandled frostbite event : 45:37 WARNING "TODO : handle '['server.onMaxPlayerCountChange', '16']' frostbite2 events" that needs to be cared of.

I'm not sure if there is any use to do of such info, but someone may think of something when developing a plugin. So the job is to catch those events and save that value in self.game.effectiveMaxPlayers.

Documentation from DICE

Events

Request: server.onMaxPlayerCountChange <count: int>
Response: OK
Effect: The game server has changed the effective max player count

Commands

Request: admin.effectiveMaxPlayers
Response: OK <current max players: int>
Response: InvalidArguments
Effect: Query the effective maximum number of players


Request: vars.maxPlayers [nr of players: integer]
Response: OK - for set operation
Response: OK <nr of players: integer> - for get operation
Response: InvalidArguments
Response: InvalidNrOfPlayers - Player limit must be in the range 8..32
Effect: Set desired maximum number of players
Comment: The effective maximum number of players is also effected by the server provider, and the game engine. If the desired maximum number of players is set to something that is accepted by the server, the effective maximum number of players will usually change within a second.

If the value is currently not accepted, then the server will continue to check every 10 seconds and change the effective count whenever the game engine allows it.

/wrong_cmd response nothing

If i enter !wrong_cmd, B3 responses [pm] Unrecognized command wrong_cmd or give a suggestion.

If i use /wrong_cmd, B3 response nothing. Known Commands work fine. The Log show no error. Working Quick Fix: add '/'

elif len(event.data) >= 2 and event.data[:1] in (self.cmdPrefix, self.cmdPrefixLoud, self.cmdPrefixBig, '/'):

in https://github.com/BigBrotherBot/big-brother-bot/blob/release-1.10/b3/plugins/admin.py#L471

Have B3 something like cmdPrefixPrivate to implement a clean Fix?

Relations between table

This is both a question and issue: Why there is no any relation between tables in b3 MySQL database? I.e. when we delete record from "clients" table, orphan (if we can even call it orphan) remains in "penalties" table and suddenly B3 itself "freaks" out.

[status plugin] call to sanitizeMe fails for some data

as reported on the forums, there are some cases where the call to method sanitizeMe fails in the status plugin.

Consequences are that the xml file is missing some of the player data ; but since B3 1.9.0 this error does not prevent the rest of the xml file from being generated.

log

130222 15:59:00 ERROR   "StatusPlugin: could not sanitize (15, '19', '5')"
Traceback (most recent call last):
  File "/usr/local/games/b3/b3/plugins/status.py", line 301, in update
    clean_data = sanitizeMe(v)
  File "/usr/local/games/b3/b3/functions.py", line 277, in sanitizeMe
    return re.sub(r'[\x00-\x1F]|[\x7F-\xff]', '?', s)
  File "/usr/lib/python2.6/re.py", line 151, in sub
    return _compile(pattern, 0).sub(repl, string, count)
TypeError: expected string or buffer
130222 15:59:00 ERROR   "StatusPlugin: could not sanitize (15, '19', '8')"
Traceback (most recent call last):
  File "/usr/local/games/b3/b3/plugins/status.py", line 301, in update
    clean_data = sanitizeMe(v)
  File "/usr/local/games/b3/b3/functions.py", line 277, in sanitizeMe
    return re.sub(r'[\x00-\x1F]|[\x7F-\xff]', '?', s)
  File "/usr/lib/python2.6/re.py", line 151, in sub
    return _compile(pattern, 0).sub(repl, string, count)
TypeError: expected string or buffer
130222 15:59:00 ERROR   "StatusPlugin: could not sanitize (15, '37', '9')"
Traceback (most recent call last):
  File "/usr/local/games/b3/b3/plugins/status.py", line 301, in update
    clean_data = sanitizeMe(v)
  File "/usr/local/games/b3/b3/functions.py", line 277, in sanitizeMe
    return re.sub(r'[\x00-\x1F]|[\x7F-\xff]', '?', s)
  File "/usr/lib/python2.6/re.py", line 151, in sub
    return _compile(pattern, 0).sub(repl, string, count)
TypeError: expected string or buffer
130222 15:59:00 ERROR   "StatusPlugin: could not sanitize (15, '37', '6')"
Traceback (most recent call last):
  File "/usr/local/games/b3/b3/plugins/status.py", line 301, in update
    clean_data = sanitizeMe(v)
  File "/usr/local/games/b3/b3/functions.py", line 277, in sanitizeMe
    return re.sub(r'[\x00-\x1F]|[\x7F-\xff]', '?', s)
  File "/usr/lib/python2.6/re.py", line 151, in sub
    return _compile(pattern, 0).sub(repl, string, count)
TypeError: expected string or buffer
130222 15:59:00 ERROR   "StatusPlugin: could not sanitize (15, '19', '6')"
Traceback (most recent call last):
  File "/usr/local/games/b3/b3/plugins/status.py", line 301, in update
    clean_data = sanitizeMe(v)
  File "/usr/local/games/b3/b3/functions.py", line 277, in sanitizeMe
    return re.sub(r'[\x00-\x1F]|[\x7F-\xff]', '?', s)
  File "/usr/lib/python2.6/re.py", line 151, in sub
    return _compile(pattern, 0).sub(repl, string, count)
TypeError: expected string or buffer
130222 15:59:00 ERROR   "StatusPlugin: could not sanitize (15, '20', '5')"
Traceback (most recent call last):
  File "/usr/local/games/b3/b3/plugins/status.py", line 301, in update
    clean_data = sanitizeMe(v)
  File "/usr/local/games/b3/b3/functions.py", line 277, in sanitizeMe
    return re.sub(r'[\x00-\x1F]|[\x7F-\xff]', '?', s)
  File "/usr/lib/python2.6/re.py", line 151, in sub
    return _compile(pattern, 0).sub(repl, string, count)
TypeError: expected string or buffer
130222 15:59:00 ERROR   "StatusPlugin: could not sanitize (15, '20', '7')"
Traceback (most recent call last):
  File "/usr/local/games/b3/b3/plugins/status.py", line 301, in update
    clean_data = sanitizeMe(v)
  File "/usr/local/games/b3/b3/functions.py", line 277, in sanitizeMe
    return re.sub(r'[\x00-\x1F]|[\x7F-\xff]', '?', s)
  File "/usr/lib/python2.6/re.py", line 151, in sub
    return _compile(pattern, 0).sub(repl, string, count)
TypeError: expected string or buffe

app dosnt shuthdown/restart right

Testet on Windows 7/8 and Linux with the current B3 Version.
Testet with 2 live BF3 Servers and rcondevserver - i take a build from the buildservis.

On ``KeyboardInterrupt´` or Server restart command shuthdown the Bot all Threads and hang on. pdb shows FrostbiteServer as last process. Systemtools like netstat or nc show the connection.

Send a SIGTERM signal to b3 process = same result.

[CS:GO] Chat color with xlrstats ?

Hello,

My .ini contain

cmd_xlrstats: ^3Stats: ^7$name ^7: K ^2$kills ^7D ^3$deaths ^7TK ^1$teamkills ^7Ratio ^5$ratio ^7Skill ^3$skill

But CS:GO need the character \x03, \x07, etc
I don't find any easy way to put this in the .ini

Do you have a solution ?

[DOC] start a B3 developer documentation

as stated by @ozon the current state of the B3 documentation is poor and does not ease contributions.


The solution is to start a B3 developer documentation sources to github to ease contributions.
The framework for writing the documentation will be sphinx.
The documentation sources should be committed to b3/docs/b3_developer_documentation/

Table of Contents

  • overview of B3
    • events
    • the two main threads (run() and handleEvents())
  • how B3 communicates with game servers
  • game parsers
  • B3 core
  • testing

[core] prevent the admin plugin from being loaded multiple times

reproduction steps

  • add <plugin name="admin" config="@conf/plugin_admin.xml" /> twice in the plugins section of the b3.xml file
  • start B3

actual results

  • B3 tries to load the admin plugin twice

expected results

  • B3 fails to start
  • a CRITICAL level message is written to the b3.log file to inform B3 could not start because the admin plugin can only be found once in the plugins section of the b3.xml file

[admin plugin] Plugin Management

The Admin Plugin provides the commands !enable <plugin> and !disable <plugin>.
I think it makes more sense to merge these commands and possibly expand.

Why?

  • The two existing commands are simple and treat incorrect inputs not useful. It is annoying when you type the command wrong and you do not get an overview right inputs.
  • The user can not see what plugins he can manage.
  • For both or more commands are different permissions. This is unnecessary.

I am in favor to implement the plugin administration over 1 command.
!plugin <name> <action>
Example:
!plugin pingkicker disable (Even "disable" be replaced by "stop" for easier typing,)
!plugin pingkicker start

!plugin pingkicker - If action is missing, then show the plugin status.
!plugin list - show a list of all plugins
!plugin list <enabled/disabled> - output a filtered list of plugins
!plugin pingkicker info - show stuff like !pluginfo <plugin>.

This is just an idea. What do you think?

[Xlrstats] unknown column 'None'

@Garrethpl reported :

Not sure if this is related to the new parser, however when client joins a team:

120807 11:09:32 CONSOLE '38:03 ClientBegin: 2'
120807 11:09:32 VERBOSE 'Queueing event Client Join Team 2'
120807 11:09:32 VERBOSE 'Parsing Event: Client Join Team: XlrstatsPlugin'
120807 11:09:32 ERROR 'XlrstatsPlugin: Map not recognized, trying to initialise map...'
120807 11:09:32 VERBOSE 'XlrstatsPlugin: Map ut4_algiers successfully initialised.'
120807 11:09:32 ERROR '[SELECT * from xlr_playermaps WHERE map_id = None AND player_id = 1 LIMIT 1] None'
120807 11:09:32 ERROR 'handler XlrstatsPlugin could not handle event Client Join Team: OperationalError: (1054, "Nieznana kolumna \'None\' w where clause") [(\'/home/majki/b3main/b3/parser.py\', 994, \'handleEvents\', \'hfunc.parseEvent(event)\'), (\'/home/majki/b3main/b3/plugin.py\', 158, \'parseEvent\', \'self.onEvent(event)\'), (\'/home/majki/b3main/b3/extplugins/xlrstats.py\', 535, \'onEvent\', \'self.join(event.client)\'), (\'/home/majki/b3main/b3/extplugins/xlrstats.py\', 1390, \'join\', \'playermap = self.get_PlayerMaps(player.id, map.id)\'), (\'/home/majki/b3main/b3/extplugins/xlrstats.py\', 754, \'get_PlayerMaps\', \'cursor = self.query(q)\'), (\'/home/majki/b3main/b3/storage/database.py\', 319, \'query\', \'raise e\')]'
120807 11:09:32 VERBOSE 'Parsing Event: Client Join Team: XlrstatscontrollerPlugin'
120807 11:09:32 DEBUG 'XlrstatscontrollerPlugin: Checking number of players online. Minimum = 8, Current = 1'
120807 11:09:32 DEBUG 'XlrstatscontrollerPlugin: Nothing to do at the moment. XLRstats is already Enabled'

[DOC] start a plugin developer documentation

as stated by @ozon the current state of the B3 documentation is poor and does not ease contributions.


The solution is to start a B3 developer documentation sources to github to ease contributions.
The framework for writing the documentation will be sphinx.
The documentation sources should be committed to b3/docs/plugin_developer_documentation/

Table of Contents

  • overview of B3
  • events
  • ...

[URT] create a new event when the bomb explode

from this thread on the B3 forums, it appears the B3 parser for Urban Terror is missing a useful event for when the bomb exploded.

130402 18:30:34 CONSOLE '17:24 Pop!'
130402 18:30:34 VERBOSE 'line did not match format: Pop!'

in such case, fire a new B3 event

Secure Responses

Some Responses need be fixed.
See it just ingame - a User register self and B3 response to all that he was put in group user.

But now.... playtime....

[stats plugin] with some games the stats can't be shown at map change

Issue reported on the B3 forums. Make sure to provide feed back on the forum topic once fixed and that the fix is available in a dev release.

reproduction steps

  • start B3 with the BFBC2 parser
  • make sure the stats plugin is enabled and that show_awards and show_awards_xp are set to yes in the stats plugin config file
  • have the game change the map

actual results

  • no stat is shown

expected results

  • topstats awards are shown
  • topxp awards are shown

Problem with bf4 parser not reconnecting / status plugin leaking file handles

When running the bot for several days, after a period of time I get the following in the log files:

131224 03:16:00 DEBUG   'Events waiting in queue stats : (ms) min(0.0), max(1000.0), mean(20.0), stddev(140.7)'
131224 03:16:00 VERBOSE u"RCON :\t ('admin.listPlayers', 'all')"
131224 03:16:00 DEBUG   "Unable to retrieve scores from playerlist (NetworkError('not connected',))"
131224 03:16:00 VERBOSE 'StatusPlugin: Building XML status'
131224 03:16:00 DEBUG   'StatusPlugin: Writing XML status to /home/b3/status_rush.xml'
131224 03:16:00 DEBUG   "getCommand: ('admin.say', 'Time: 03:16AM GMT 24/12/13', 'all')"
131224 03:16:00 VERBOSE u"RCON :\t ('admin.say', 'Time: 03:16AM GMT 24/12/13', 'all')"
131224 03:16:00 ERROR   'not connected'
131224 03:16:04 INFO    'Connecting to frostbite2 server ...'
131224 03:16:04 ERROR   'IOError [Errno 111] Connection refused'
131224 03:16:09 INFO    'Connecting to frostbite2 server ...'
131224 03:16:09 ERROR   'IOError [Errno 111] Connection refused'
131224 03:16:14 INFO    'Connecting to frostbite2 server ...'

which eventually changes to

131224 04:43:00 DEBUG   "Unable to retrieve scores from playerlist (NetworkError('not connected',))"
131224 04:43:00 VERBOSE 'StatusPlugin: Building XML status'
131224 04:43:00 DEBUG   'StatusPlugin: Writing XML status to /home/b3/status_rush.xml'
131224 04:43:00 ERROR   "Error executing crontab <bound method StatusPlugin.update of <b3.plugins.status.StatusPlugin instance at 0x1f0afc8>>: [Errno 24] Too many open files: '/home/b3/status_rush.xml'\n[('/home/b3/big-brother-bot/b3/cron.py', 277, 'run', 'c.run()'), ('/home/b3/big-brother-bot/b3/cron.py', 210, 'run', 'CronTab.run(self)'), ('/home/b3/big-brother-bot/b3/cron.py', 66, 'run', 'self.command()'), ('/home/b3/big-brother-bot/b3/plugins/status.py', 400, 'update', None), ('/home/b3/big-brother-bot/b3/plugins/status.py', 425, 'writeXML', None)]"
131224 04:43:01 INFO    'Connecting to frostbite2 server ...'
131224 04:43:01 ERROR   'IOError [Errno 24] Too many open files'
131224 04:43:06 INFO    'Connecting to frostbite2 server ...'
131224 04:43:06 ERROR   'IOError [Errno 24] Too many open files'
131224 04:43:11 INFO    'Connecting to frostbite2 server ...'

There seem to be 2 issues:

  • The bot fails to reconnect
  • The status plugin fails to close open file handles (when encountering an error)

Although that is just my educated guess

Restarting the bot fixes the issue (until it occurs again).

[BF3] implements getPlayerPings

With BF3 R38 there is a new rcon command player.ping that can be used to implement the parser getPlayerPings method.

doc

Request player.ping
Response OK <ping: integer>
Response InvalidArguments
Response InvalidPlayerName
Effect Returns the player’s ping

simple Dialog

I miss a simple dialog system. This would simplify the use dramatically. For example, I load a new card and write the map name wrong. B3 are indeed suggestions, but B3 might also ask whether the proposal should be used.

Another example would be confirmation questions.
User: /die
B3: Would you shut down really B3? (yes / no / cancel)
User: /yes

You can implement something locally in that cmd. But it would be very useful if a function would be generally available so that eg Plugin developers benefit. Before now implemented this feature, which would be taken into consideration?

I am thinking of the following:

  • session system with timeout
  • B3 should blocked while waiting for a response (session enough or is threading needed?
  • API design
  b3_dialog_question(question, options)

It is sometimes frustrating when you're in the rush enter a wrong command, B3 makes a proposal and then re-enter the command. (Even worse, you are in command again incorrectly :)) Confirmation dialogs for some commands are well protected against accidental incorrect entries.

[iourt42] auth login is not correctly retrieved

Didn't had the time to have a deep look at it but seems that the regular expression is failing in parsing the client auth login somehow. That's what I extracted from the b3.log file:

131103 20:58:32 VERBOS2 "RCON: Received 'auth: id: 1 - name: ^7:) - login: randomlogin - notoriety: basic - level: -1  \\n'"
131103 20:58:32 DEBUG   'Storage: getClient Client42<@0:GUIDGOESHERE|None:":)":1>'
131103 20:58:32 VERBOS2 'Aborted Making Alias for cid: 1, name is the same'
131103 20:58:32 BOT     u'Client found in storage @4, welcome back :) (FSA: )'

GUID and FSA replaced for privacy purpose. As you can see the FSA is shown in the first log line but it's missing in the last one

EDIT: just checked and the regex works as expected. The problem must be somewhere else

connection/b3 hang on exit

B3 with the frostbite2 hangs on KeyboardInterrupt or Restart.

For my new Plugin make i some experiments with gevent. e5c3745acf2855c464df4b61ebfe753c75ec8c65 - KeyboardInterrupt or restart B3 via command works fine.

Here a log output after a KeyboardInterrupt with b3_run.py;

19:40   BOT     'Shutting down...'
19:40   BOT     'Shutting down database connections...'
19:40   INFO    "STDOUT 'Goodbye'"
19:40   INFO    "STDOUT '\\n'"
19:40   INFO    'cron scheduler ended'
19:41   INFO    'sayqueuelistener job ended'
19:42   VERBOSE "dropping Frostbite event ['player.onKill', 'DevilBFC', 'andi03111983', 'M416', 'false']"
19:42   CONSOLE "['player.onKill', 'DevilBFC', 'andi03111983', 'M416', 'false']"
19:46   VERBOSE "dropping Frostbite event ['player.onKill', 'DevilBFC', 'norma_pro', 'M416', 'false']"
19:46   CONSOLE "['player.onKill', 'DevilBFC', 'norma_pro', 'M416', 'false']"```

[welcome] simplify the config file

The welcome plugin is known for being difficult to configure and generate more support requests on the B3 forums than most other plugin.
This is mainly due to the flags setting option that requires computer science background to figure out how the numbers work and why they can be summed up.


While improving the usability is great, care should be taken to keep the plugin backward compatible with old configuration files.

Proposal

A first improvement would be to change the config section "settings" to this :

    <settings name="settings">
        <!-- Set which message will be sent on player connection. 
            Expected values : yes/no
        -->
        <set name="welcome_user">yes</set>
        <set name="welcome_newb">yes</set>
        <set name="announce_user">yes</set>
        <set name="welcome_first">yes</set>
        <set name="announce_first">yes</set>
        <set name="show_greeting">yes</set>

        <!-- Maximum number of connections a user has to be consider 
            a newb for the newb message
        -->
        <set name="newb_connections">15</set>

        <!-- Time in seconds after connection to display the message.
            Accepted range: 15-90
        -->
        <set name="delay">30</set>

        <!-- Time in seconds the bot must wait before welcoming a player again. 
          i.e.: if you set min_gap to 3600 seconds (one hour) then the bot will not
          welcome a player more than once per hour
        -->
        <set name="min_gap">3600</set>
    </settings>

Feature Request: ftp for status.xml

It would be nice if we can create and update the status.xml to an ftp location as well. That would ease the installation hassle with xlrstats and also eliminate the need of having a secondary webserver when gameserver and webserver are at different locations.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.