BigBrotherBot v1.7.0
System Development Information for the BigBrotherBot project.

b3::parsers::frostbite::abstractParser::AbstractParser Class Reference

Inheritance diagram for b3::parsers::frostbite::abstractParser::AbstractParser:
b3::parser::Parser b3::parsers::bfbc2::Bfbc2Parser b3::parsers::moh::MohParser

List of all members.

Public Member Functions

def run
def routeFrostbitePacket
def startup
def sayqueuelistener
def joinPlayers
def sync
def getCommand
def write
def getWrap
def checkVersion
def getServerVars
def getClient
def getTeam
def getServerInfo
def getPlayerList
def getPlayerScores
def getPlayerPings
def getNextMap
def getNextMapIndex
def getMaps
def getMap
def getSupportedMaps
def getMapsSoundingLike
def OnPlayerChat
def OnPlayerLeave
def OnPlayerJoin
def OnPlayerAuthenticated
def OnPlayerSpawn
def OnPlayerKill
def OnServerLoadinglevel
def OnServerLevelstarted
def OnServerRoundover
def OnServerRoundoverplayers
def OnServerRoundoverteamscores
def OnPunkbusterMessage
def OnPBVersion
def OnPBNewConnection
def OnPBLostConnection
def OnPBScheduledTask
def OnPBMasterQuerySent
def OnPBPlayerGuid
def message
def say
def kick
def tempban
def unban
def ban
def authorizeClients
def getCvar
def setCvar

Public Attributes

 output

Static Public Attributes

 gameName = None
 OutputClass = rcon.Rcon
tuple sayqueue = Queue.Queue()
 sayqueuelistener = None
 PunkBuster = None

Private Attributes

 _pauseNotice
 _nbConsecutiveConnFailure

Static Private Attributes

 _serverConnection = None
int _nbConsecutiveConnFailure = 0
tuple _reColor = re.compile(r'(\^[0-9])')
dictionary _settings = {}
tuple _gameServerVars = ()
dictionary _commands = {}
dictionary _eventMap
tuple _punkbusterMessageFormats

Detailed Description

An abstract base class to help with developing frostbite parsers 

Member Function Documentation

def b3::parsers::frostbite::abstractParser::AbstractParser::authorizeClients (   self)
\
For all connected players, fill the client object with properties allowing to find 
the user in the database (usualy guid, or punkbuster id, ip) and call the 
Client.auth() method 

Reimplemented from b3::parser::Parser.

def b3::parsers::frostbite::abstractParser::AbstractParser::ban (   self,
  client,
  reason = '',
  admin = None,
  silent = False,
  kwargs 
)
Permanent ban

Reimplemented from b3::parser::Parser.

Reimplemented in b3::parsers::moh::MohParser.

def b3::parsers::frostbite::abstractParser::AbstractParser::checkVersion (   self)
def b3::parsers::frostbite::abstractParser::AbstractParser::getClient (   self,
  cid,
  _guid = None 
)
Get a connected client from storage or create it
B3 CID   <--> ingame character name
B3 GUID  <--> EA_guid

Reimplemented in b3::parsers::bfbc2::Bfbc2Parser, and b3::parsers::moh::MohParser.

def b3::parsers::frostbite::abstractParser::AbstractParser::getCommand (   self,
  cmd,
  kwargs 
)
Return a reference to a loaded command

Reimplemented from b3::parser::Parser.

def b3::parsers::frostbite::abstractParser::AbstractParser::getCvar (   self,
  cvarName 
)
Read a server var
def b3::parsers::frostbite::abstractParser::AbstractParser::getMap (   self)
Return the current level name (not easy map name)

Reimplemented from b3::parser::Parser.

def b3::parsers::frostbite::abstractParser::AbstractParser::getMaps (   self)
Return the map list for the current rotation. (as easy map names)
This does not return all available maps

Reimplemented from b3::parser::Parser.

def b3::parsers::frostbite::abstractParser::AbstractParser::getMapsSoundingLike (   self,
  mapname 
)
found matching level names for the given mapname (which can either
be a level name or map name)
If no exact match is found, then return close candidates using soundex
and then LevenshteinDistance algoritms
def b3::parsers::frostbite::abstractParser::AbstractParser::getNextMap (   self)
Return the name of the next map
def b3::parsers::frostbite::abstractParser::AbstractParser::getNextMapIndex (   self)
def b3::parsers::frostbite::abstractParser::AbstractParser::getPlayerList (   self,
  maxRetries = None 
)
return a dict which keys are cid and values a dict of player properties
as returned by admin.listPlayers.
Does not return client objects
def b3::parsers::frostbite::abstractParser::AbstractParser::getPlayerPings (   self)
Ask the server for a given client's pings

Reimplemented from b3::parser::Parser.

def b3::parsers::frostbite::abstractParser::AbstractParser::getPlayerScores (   self)
Ask the server for a given client's team

Reimplemented from b3::parser::Parser.

def b3::parsers::frostbite::abstractParser::AbstractParser::getServerInfo (   self)
query server info, update self.game and return query results
Response: OK <serverName: string> <current playercount: integer> <max playercount: integer> 
<current gamemode: string> <current map: string> <roundsPlayed: integer> 
<roundsTotal: string> <scores: team scores> <onlineState: online state>
def b3::parsers::frostbite::abstractParser::AbstractParser::getServerVars (   self)
def b3::parsers::frostbite::abstractParser::AbstractParser::getSupportedMaps (   self)
return a list of supported levels for the current game mod
def b3::parsers::frostbite::abstractParser::AbstractParser::getTeam (   self,
  team 
)
convert frostbite team numbers to B3 team numbers

Reimplemented in b3::parsers::bfbc2::Bfbc2Parser, and b3::parsers::moh::MohParser.

def b3::parsers::frostbite::abstractParser::AbstractParser::getWrap (   self,
  text,
  length = SAY_LINE_MAX_LENGTH,
  minWrapLen = SAY_LINE_MAX_LENGTH 
)
Returns a sequence of lines for text that fits within the limits

Reimplemented from b3::parser::Parser.

def b3::parsers::frostbite::abstractParser::AbstractParser::joinPlayers (   self)
def b3::parsers::frostbite::abstractParser::AbstractParser::kick (   self,
  client,
  reason = '',
  admin = None,
  silent = False,
  kwargs 
)
\
kick a given player

Reimplemented from b3::parser::Parser.

def b3::parsers::frostbite::abstractParser::AbstractParser::message (   self,
  client,
  text 
)
\
display a message to a given player

Reimplemented from b3::parser::Parser.

def b3::parsers::frostbite::abstractParser::AbstractParser::OnPBLostConnection (   self,
  match,
  data 
)
PB notifies us it lost track of a player. This is the only change
we have to save the ip of clients.
This event is triggered after the OnPlayerLeave, so normaly the client
is not connected. Anyway our task here is to save data into db not to 
connect/disconnect the client.

Part of this code is obsolete since R15, IP is saved to DB on OnPBNewConnection()
def b3::parsers::frostbite::abstractParser::AbstractParser::OnPBMasterQuerySent (   self,
  match,
  data 
)
We get notified that the server sent a ping to the PB masters
def b3::parsers::frostbite::abstractParser::AbstractParser::OnPBNewConnection (   self,
  match,
  data 
)
PunkBuster tells us a new player identified. The player is
normally already connected and authenticated by B3 by ea_guid

This is our first moment where we receive the clients IP address
so we also fire the custom event EVT_PUNKBUSTER_NEW_CONNECTION here
def b3::parsers::frostbite::abstractParser::AbstractParser::OnPBPlayerGuid (   self,
  match,
  data 
)
We get notified of a player punkbuster GUID
def b3::parsers::frostbite::abstractParser::AbstractParser::OnPBScheduledTask (   self,
  match,
  data 
)
We get notified the server ran a PB scheduled task
Nothing much to do but it can be interresting to have
this information logged
def b3::parsers::frostbite::abstractParser::AbstractParser::OnPBVersion (   self,
  match,
  data 
)
PB notifies us of the version numbers
version = match.group('version')
def b3::parsers::frostbite::abstractParser::AbstractParser::OnPlayerAuthenticated (   self,
  action,
  data 
)
player.onAuthenticated <soldier name: string> <player GUID: guid>

Effect: Player with name <soldier name> has been authenticated, and has the given GUID
def b3::parsers::frostbite::abstractParser::AbstractParser::OnPlayerChat (   self,
  action,
  data 
)
player.onChat <source soldier name: string> <text: string> <target group: player subset>

Effect: Player with name <source soldier name> (or the server, or the 
server admin) has sent chat message <text> to some people

Comment: The chat text is as represented before the profanity filtering 
If <source soldier name> is 'Server', then the message was sent from the 
server rather than from an actual player If sending to a specific player, 
and the player doesn't exist, then the target group will be 'player' ''
def b3::parsers::frostbite::abstractParser::AbstractParser::OnPlayerJoin (   self,
  action,
  data 
)
we don't have guid at this point. Wait for player.onAuthenticated
def b3::parsers::frostbite::abstractParser::AbstractParser::OnPlayerKill (   self,
  action,
  data 
)
Request: player.onKill <killing soldier name: string> <killed soldier name: string> <weapon: string> <headshot: boolean> <killer location: 3 x integer> <killed location: 3 x integes>

Effect: Player with name <killing soldier name> has killed <killed soldier name> Suicide is indicated with the same soldier name for killer and victim. If the server kills the player (through admin.killPlayer), it is indicated by showing the killing soldier name as Server. The locations of the killer and the killed have a random error of up to 10 meters in each direction.
def b3::parsers::frostbite::abstractParser::AbstractParser::OnPlayerLeave (   self,
  action,
  data 
)
def b3::parsers::frostbite::abstractParser::AbstractParser::OnPlayerSpawn (   self,
  action,
  data 
)
Request: player.onSpawn <spawning soldier name: string> <kit type: string> <gadget: string> <pistol: string> <primary weapon: string> <specialization 1: string> <specialization 2: string> <specialization 3: string>

Reimplemented in b3::parsers::moh::MohParser.

def b3::parsers::frostbite::abstractParser::AbstractParser::OnPunkbusterMessage (   self,
  action,
  data 
)
handles all punkbuster related events and 
route them to the appropriate method depending
on the type of PB message.
def b3::parsers::frostbite::abstractParser::AbstractParser::OnServerLevelstarted (   self,
  action,
  data 
)
server.onLevelStarted

Effect: Level is started
def b3::parsers::frostbite::abstractParser::AbstractParser::OnServerLoadinglevel (   self,
  action,
  data 
)
server.onLoadingLevel <level name: string> <roundsPlayed: int> <roundsTotal: int>

Effect: Level is loading
def b3::parsers::frostbite::abstractParser::AbstractParser::OnServerRoundover (   self,
  action,
  data 
)
server.onRoundOver <winning team: Team ID>

Effect: The round has just ended, and <winning team> won
def b3::parsers::frostbite::abstractParser::AbstractParser::OnServerRoundoverplayers (   self,
  action,
  data 
)
server.onRoundOverPlayers <end-of-round soldier info : player info block>

Effect: The round has just ended, and <end-of-round soldier info> is the final detailed player stats
def b3::parsers::frostbite::abstractParser::AbstractParser::OnServerRoundoverteamscores (   self,
  action,
  data 
)
server.onRoundOverTeamScores <end-of-round scores: team scores>

Effect: The round has just ended, and <end-of-round scores> is the final ticket/kill/life count for each team
def b3::parsers::frostbite::abstractParser::AbstractParser::routeFrostbitePacket (   self,
  packet 
)
def b3::parsers::frostbite::abstractParser::AbstractParser::run (   self)
Main worker thread for B3

Reimplemented from b3::parser::Parser.

def b3::parsers::frostbite::abstractParser::AbstractParser::say (   self,
  msg 
)
\
broadcast a message to all players

Reimplemented from b3::parser::Parser.

def b3::parsers::frostbite::abstractParser::AbstractParser::setCvar (   self,
  cvarName,
  value 
)
Set a server var
def b3::parsers::frostbite::abstractParser::AbstractParser::startup (   self)
\
Called after the parser is created before run(). Overwrite this
for anything you need to initialize you parser with.

Reimplemented from b3::parser::Parser.

Reimplemented in b3::parsers::bfbc2::Bfbc2Parser, and b3::parsers::moh::MohParser.

def b3::parsers::frostbite::abstractParser::AbstractParser::sync (   self)
\
For all connected players returned by self.getPlayerList(), get the matching Client
object from self.clients (with self.clients.getByCID(cid) or similar methods) and
look for inconsistencies. If required call the client.disconnect() method to remove
a client from self.clients.
This is mainly useful for games where clients are identified by the slot number they
occupy. On map change, a player A on slot 1 can leave making room for player B who
connects on slot 1.

Reimplemented from b3::parser::Parser.

def b3::parsers::frostbite::abstractParser::AbstractParser::tempban (   self,
  client,
  reason = '',
  duration = 2,
  admin = None,
  silent = False,
  kwargs 
)
\
tempban a given player on the game server and in case of success
fire the event ('EVT_CLIENT_BAN_TEMP', data={'reason': reason, 
'duration': duration, 'admin': admin}, client=target)

Reimplemented from b3::parser::Parser.

Reimplemented in b3::parsers::moh::MohParser.

def b3::parsers::frostbite::abstractParser::AbstractParser::unban (   self,
  client,
  reason = '',
  admin = None,
  silent = False,
  kwargs 
)
\
unban a given player on the game server

Reimplemented from b3::parser::Parser.

def b3::parsers::frostbite::abstractParser::AbstractParser::write (   self,
  msg,
  maxRetries = 1,
  needConfirmation = False 
)
Write a message to Rcon/Console
Unfortunaltely this has been abused all over B3 
and B3 plugins to broadcast text :(

Member Data Documentation

Reimplemented from b3::parser::Parser.

Initial value:
{
        'player.onKicked': b3.events.EVT_CLIENT_KICK,
    }
Initial value:
(
        (re.compile(r'^(?P<servername>.*): PunkBuster Server for BC2 \((?P<version>.+)\)\sEnabl.*$'), 'OnPBVersion'),
        (re.compile(r'^(?P<servername>.*): Running PB Scheduled Task \(slot #(?P<slot>\d+)\)\s+(?P<task>.*)$'), 'OnPBScheduledTask'),
        (re.compile(r'^(?P<servername>.*): Lost Connection \(slot #(?P<slot>\d+)\) (?P<ip>[^:]+):(?P<port>\d+) (?P<pbuid>[^\s]+)\(-\)\s(?P<name>.+)$'), 'OnPBLostConnection'),
        (re.compile(r'^(?P<servername>.*): Master Query Sent to \((?P<pbmaster>[^\s]+)\) (?P<ip>[^:]+)$'), 'OnPBMasterQuerySent'),
        (re.compile(r'^(?P<servername>.*): Player GUID Computed (?P<pbid>[0-9a-fA-F]+)\(-\) \(slot #(?P<slot>\d+)\) (?P<ip>[^:]+):(?P<port>\d+)\s(?P<name>.+)$'), 'OnPBPlayerGuid'),
        (re.compile(r'^(?P<servername>.*): New Connection \(slot #(?P<slot>\d+)\) (?P<ip>[^:]+):(?P<port>\d+) \[(?P<something>[^\s]+)\]\s"(?P<name>.+)".*$'), 'OnPBNewConnection')
     )
tuple b3::parsers::frostbite::abstractParser::AbstractParser::_reColor = re.compile(r'(\^[0-9])') [static, private]

Reimplemented from b3::parser::Parser.

Reimplemented from b3::parser::Parser.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Properties