rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
g_message_board[self.address[0]] = message
g_message_board[self.ip] = message
def run(self): running = 1 while running: message = self.client.recv(self.size)
del g_message_board[self.address[0]]
del g_message_board[self.ip]
def run(self): running = 1 while running: message = self.client.recv(self.size)
for client in sorted(g_client_message_board.keys()) : html_content += '<p><strong>' + client + '</strong>: ' + g_client_message_board[client] + '</p>\n'
for client in sorted(g_message_board.keys()) : html_content += '<p><strong>' + client + '</strong>: ' + g_message_board[client] + '</p>\n'
def generate_html(self) : html_content = g_html_head for client in sorted(g_client_message_board.keys()) : html_content += '<p><strong>' + client + '</strong>: ' + g_client_message_board[client] + '</p>\n' html_content += g_html_tail
g_client_message_board[self.address[0]] = message
g_message_board[self.address[0]] = message
def run(self): running = 1 while running: message = self.client.recv(self.size)
del g_client_message_board[self.address[0]]
del g_message_board[self.address[0]]
def run(self): running = 1 while running: message = self.client.recv(self.size)
team_map = {}
team_count_map = {}
def testing_status() : server_name = 'rcssserver' server_user = '' process_list = get_cmd_output('export LANG="POSIX"; ps -e -o comm,user=').strip().split('\n') process_list.pop(0) team_map = {} cmd_count_map = {} matched_cmds = {} for process in process_list : info = process.split() (cmd, user) = (info[0], info[1])...
team_map[team_name] = 1 + team_map.get(team_name, 0)
team_count_map[team_name] = 1 + team_count_map.get(team_name, 0)
def testing_status() : server_name = 'rcssserver' server_user = '' process_list = get_cmd_output('export LANG="POSIX"; ps -e -o comm,user=').strip().split('\n') process_list.pop(0) team_map = {} cmd_count_map = {} matched_cmds = {} for process in process_list : info = process.split() (cmd, user) = (info[0], info[1])...
if len(team_map) <= 1 :
if len(team_count_map) <= 1 :
def testing_status() : server_name = 'rcssserver' server_user = '' process_list = get_cmd_output('export LANG="POSIX"; ps -e -o comm,user=').strip().split('\n') process_list.pop(0) team_map = {} cmd_count_map = {} matched_cmds = {} for process in process_list : info = process.split() (cmd, user) = (info[0], info[1])...
team_map['[' + cmd + ']'] = cmd_count_map[cmd] if len(team_map) >= 2 :
team_count_map['[' + cmd + ']'] = cmd_count_map[cmd] if len(team_count_map) >= 2 :
def testing_status() : server_name = 'rcssserver' server_user = '' process_list = get_cmd_output('export LANG="POSIX"; ps -e -o comm,user=').strip().split('\n') process_list.pop(0) team_map = {} cmd_count_map = {} matched_cmds = {} for process in process_list : info = process.split() (cmd, user) = (info[0], info[1])...
message += '%d, %s (' % (server_count, server_user) for team in sorted(team_map.keys()) : message += '%s x %s, ' % (team, team_map[team])
message += '%d, %s, (' % (server_count, server_user) for team in sorted(team_count_map.keys()) : message += '%s x %d, ' % (team, team_count_map[team])
def testing_status() : server_name = 'rcssserver' server_user = '' process_list = get_cmd_output('export LANG="POSIX"; ps -e -o comm,user=').strip().split('\n') process_list.pop(0) team_map = {} cmd_count_map = {} matched_cmds = {} for process in process_list : info = process.split() (cmd, user) = (info[0], info[1])...
random.shuffle(process_list)
def find_testing_team_map() : team_map = {} process_map = {} matched_process_map = {} process_list = get_output("ps -o comm= -e").strip().split('\n') random.shuffle(process_list) for process in process_list : process_map[process] = 1 + process_map.get(process, 0) for pattern in team_name_map.keys() : if pattern.match...
message = uptime().strip() + ", "
message = uptime() + ", "
def build_message( ): message = uptime().strip() + ", " message += rcssserver() return message
command = subprocess.Popen(['uptime'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) return command.communicate()[0]
return get_output('uptime').strip()
def uptime() : command = subprocess.Popen(['uptime'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) return command.communicate()[0]
command = subprocess.Popen(['ps', '-o', 'pid=', '-C', 'rcssserver'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) return '
return '
def rcssserver() : command = subprocess.Popen(['ps', '-o', 'pid=', '-C', 'rcssserver'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) return ' #rcssserver %d' % (len(command.communicate()[0].split('\n')) - 1)
def sending(s) :
def communicate(s) :
def sending(s) : while 1: try: s.sendall(build_message()) except socket.error, (value, message): print 'send error: ' + message s.close() break time.sleep(5)
s.close()
def sending(s) : while 1: try: s.sendall(build_message()) except socket.error, (value, message): print 'send error: ' + message s.close() break time.sleep(5)
sending(s)
communicate(s)
def sending(s) : while 1: try: s.sendall(build_message()) except socket.error, (value, message): print 'send error: ' + message s.close() break time.sleep(5)
count_map = {}
count_cmd_map = {}
def testing_status() : server_name = 'rcssserver' server_user = '' process_list = get_cmd_output('export LANG="POSIX"; ps -e -o comm,user=').strip().split('\n') process_list.pop(0) team_map = {} cmd_count_map = {} matched_cmds = {} for process in process_list : info = process.split() (cmd, user) = (info[0], info[1])...
count_map.setdefault(cmd_count_map[cmd], []).append(cmd)
count_cmd_map.setdefault(cmd_count_map[cmd], []).append(cmd)
def testing_status() : server_name = 'rcssserver' server_user = '' process_list = get_cmd_output('export LANG="POSIX"; ps -e -o comm,user=').strip().split('\n') process_list.pop(0) team_map = {} cmd_count_map = {} matched_cmds = {} for process in process_list : info = process.split() (cmd, user) = (info[0], info[1])...
count_list = count_map.keys()
count_list = count_cmd_map.keys()
def testing_status() : server_name = 'rcssserver' server_user = '' process_list = get_cmd_output('export LANG="POSIX"; ps -e -o comm,user=').strip().split('\n') process_list.pop(0) team_map = {} cmd_count_map = {} matched_cmds = {} for process in process_list : info = process.split() (cmd, user) = (info[0], info[1])...
for cmd in count_map[count] :
for cmd in count_cmd_map[count] :
def testing_status() : server_name = 'rcssserver' server_user = '' process_list = get_cmd_output('export LANG="POSIX"; ps -e -o comm,user=').strip().split('\n') process_list.pop(0) team_map = {} cmd_count_map = {} matched_cmds = {} for process in process_list : info = process.split() (cmd, user) = (info[0], info[1])...
while 1: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((host,port)) except socket.error, (value, message): print 'connect error: ' + message
def run() : while 1: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((host,port)) except socket.error, (value, message): print 'connect error: ' + message s.close() time.sleep(1) continue communicate(s)
def communicate(s) : while 1: try: s.sendall(build_message()) except socket.error, (value, message): print 'send error: ' + message break time.sleep(10)
time.sleep(1) continue communicate(s) s.close()
def communicate(s) : while 1: try: s.sendall(build_message()) except socket.error, (value, message): print 'send error: ' + message break time.sleep(10)
def generate_html() : html_content = g_html_head for client in sorted(g_client_message_board.keys()) : html_content += '<p><strong>' + client + '</strong>: ' + g_client_message_board[client] + '</p>\n' html_content += g_html_tail index_html = open('index.html', 'w') index_html.write(html_content) index_html.close()
def generate_html() : html_content = g_html_head for client in sorted(g_client_message_board.keys()) : html_content += '<p><strong>' + client + '</strong>: ' + g_client_message_board[client] + '</p>\n' html_content += g_html_tail index_html = open('index.html', 'w') index_html.write(html_content) index_html.close()
generate_html()
self.generate_html()
def run(self): while 1: g_mutex.acquire() generate_html() g_mutex.release() time.sleep(3)
time.sleep(6)
time.sleep(10)
def communicate(s) : while 1: try: s.sendall(build_message()) except socket.error, (value, message): print 'send error: ' + message break time.sleep(6)
def get_cmd_output(cmd) : pipe = os.popen(cmd) output = pipe.read() pipe.close() return output
def get_cmd_output(cmd) : pipe = os.popen(cmd) output = pipe.read() pipe.close() return output
return get_cmd_output('uptime').strip()
return commands.getoutput('uptime').strip()
def uptime() : return get_cmd_output('uptime').strip()
process_list = get_cmd_output('ps -e -o comm,user=').strip().split('\n')
process_list = commands.getoutput('ps -e -o comm,user=').strip().split('\n')
def testing_status() : server_name = 'rcssserver' server_user = '' process_list = get_cmd_output('ps -e -o comm,user=').strip().split('\n') process_list.pop(0) team_count_map = {} cmd_count_map = {} matched_cmds = {} for process in process_list : info = process.split() (cmd, user) = (info[0], info[1]) cmd_count_map...
teams.append(team_name_map[pattern])
team_name = team_name_map[pattern] if not team_name in teams : teams.append(team_name)
def find_testing_teams() : teams = [] process_list = get_output("ps -o comm= -e | sort | uniq").strip().split('\n') for process in process_list : for pattern in team_name_map.keys() : if pattern.match(process) : teams.append(team_name_map[pattern]) break if len(teams) >= 2 : break return teams
time.sleep(3)
time.sleep(1)
def run(self): while 1: g_mutex.acquire() self.generate_html() g_mutex.release() time.sleep(3)
return get_cmd_output('export LANG="POSIX"; uptime').strip()
return get_cmd_output('uptime').strip()
def uptime() : return get_cmd_output('export LANG="POSIX"; uptime').strip()
process_list = get_cmd_output('export LANG="POSIX"; ps -e -o comm,user=').strip().split('\n')
process_list = get_cmd_output('ps -e -o comm,user=').strip().split('\n')
def testing_status() : server_name = 'rcssserver' server_user = '' process_list = get_cmd_output('export LANG="POSIX"; ps -e -o comm,user=').strip().split('\n') process_list.pop(0) team_count_map = {} cmd_count_map = {} matched_cmds = {} for process in process_list : info = process.split() (cmd, user) = (info[0], in...
output = get_output('ps -o user= -C rcssserver').split('\n'); count = len(output) - 1; if count > 0: return ' return '
output = get_output('ps -o user= -C rcssserver').split('\n'); count = len(output) - 1; if count > 0: team = testing() return ' return '
def rcssserver() : output = get_output('ps -o user= -C rcssserver').split('\n'); count = len(output) - 1; if count > 0: return ' #rcssserver %d,%s' % (count, output[0]) return ' #rcssserver 0'
time.sleep(5)
time.sleep(6)
def communicate(s) : while 1: try: s.sendall(build_message()) except socket.error, (value, message): print 'send error: ' + message break time.sleep(5)
return get_cmd_output('uptime').strip()
return get_cmd_output('export LANG="POSIX"; uptime').strip()
def uptime() : return get_cmd_output('uptime').strip()
if len(team_count_map): message += ", (" for team in sorted(team_count_map.keys()): message += "%s x %d, " % (team, team_count_map[team]) message = message.rstrip(", ") + ")"
if len(team_count_map) >= 1: message += ", (" for team in sorted(team_count_map.keys()): message += "%s x %d, " % (team, team_count_map[team]) message = message.rstrip(", ") + ")"
def process_status(): server_name = "rcssserver" server_user = "" server_count = 0 process_list = commands.getoutput("ps -e -o comm,user=").strip().split("\n") process_list.pop(0) team_count_map = {} cmd_count_map = {} matched_cmds = {} for process in process_list: info = process.split() (cmd, user) = (info[0], info...
self.backlog = 5
def __init__(self): self.host = '' self.port = 50000 self.backlog = 5 self.size = 1024 self.server = None self.threads = []
g_mutex.acquire() f = open(self.address[0], 'w') message = '<p><strong>' + self.address[0] + '</strong>: ' + message + '</p>\n' f.write(message) f.close() os.system('./genhtml.sh') g_mutex.release()
g_client_table[self.address[0]] = message
def run(self): running = 1 while running: message = self.client.recv(self.size) if message: g_mutex.acquire()
s = Server() s.run()
def generate_html() : html_content = g_html_head for client in sorted(g_client_table.keys()) : html_content += '<p><strong>' + client + '</strong>: ' + g_client_table[client] + '</p>\n' html_content += g_html_tail
def run(self): running = 1 while running: message = self.client.recv(self.size) if message: g_mutex.acquire()
def find_testing_teams() : teams = []
def find_testing_team_map() : team_map = {}
def find_testing_teams() : teams = [] process_map = {} process_list = get_output("ps -o comm= -e | sort | uniq").strip().split('\n') random.shuffle(process_list) for process in process_list : for pattern in team_name_map.keys() : if pattern.match(process) : process_map[process] = 1 team_name = team_name_map[pattern] if...
process_list = get_output("ps -o comm= -e | sort | uniq").strip().split('\n')
matched_process_map = {} process_list = get_output("ps -o comm= -e").strip().split('\n')
def find_testing_teams() : teams = [] process_map = {} process_list = get_output("ps -o comm= -e | sort | uniq").strip().split('\n') random.shuffle(process_list) for process in process_list : for pattern in team_name_map.keys() : if pattern.match(process) : process_map[process] = 1 team_name = team_name_map[pattern] if...
process_map[process] = 1
matched_process_map[process] = 1
def find_testing_teams() : teams = [] process_map = {} process_list = get_output("ps -o comm= -e | sort | uniq").strip().split('\n') random.shuffle(process_list) for process in process_list : for pattern in team_name_map.keys() : if pattern.match(process) : process_map[process] = 1 team_name = team_name_map[pattern] if...
if not team_name in teams : teams.append(team_name)
team_map[team_name] = 1 + team_map.get(team_name, 0)
def find_testing_teams() : teams = [] process_map = {} process_list = get_output("ps -o comm= -e | sort | uniq").strip().split('\n') random.shuffle(process_list) for process in process_list : for pattern in team_name_map.keys() : if pattern.match(process) : process_map[process] = 1 team_name = team_name_map[pattern] if...
if len(teams) >= 2 : break
def find_testing_teams() : teams = [] process_map = {} process_list = get_output("ps -o comm= -e | sort | uniq").strip().split('\n') random.shuffle(process_list) for process in process_list : for pattern in team_name_map.keys() : if pattern.match(process) : process_map[process] = 1 team_name = team_name_map[pattern] if...
if len(teams) <= 1 : teams.extend(find_unknown_testing_teams(2 - len(teams), process_map))
if len(team_map) <= 1 : count_map = {} for process in process_map.keys() : count_map.setdefault(process_map[process], []).append(process) count_list = count_map.keys() count_list.sort() count_list.reverse() for count in count_list : for process in count_map[count] : if not matched_process_map.has_key(process) : team_ma...
def find_testing_teams() : teams = [] process_map = {} process_list = get_output("ps -o comm= -e | sort | uniq").strip().split('\n') random.shuffle(process_list) for process in process_list : for pattern in team_name_map.keys() : if pattern.match(process) : process_map[process] = 1 team_name = team_name_map[pattern] if...
teams.sort() return teams def find_unknown_testing_teams(left_count, process_map) : teams = [] process_list = get_output("ps -o comm= -e | sort | uniq -c | sort -nr | awk '{print $2}'").strip().split('\n') for process in process_list : if not process_map.has_key(process) : teams.append('[' + process + ']') left_count ...
return team_map
def find_testing_teams() : teams = [] process_map = {} process_list = get_output("ps -o comm= -e | sort | uniq").strip().split('\n') random.shuffle(process_list) for process in process_list : for pattern in team_name_map.keys() : if pattern.match(process) : process_map[process] = 1 team_name = team_name_map[pattern] if...
teams = find_testing_teams() if len(teams) > 0 :
team_map = find_testing_team_map() if len(team_map) > 0 :
def rcssserver() : output = get_output('ps -o user= -C rcssserver').split('\n'); count = len(output) - 1; message = ' #rcssserver: ' if count > 0: message += '%d,%s' % (count, output[0]) teams = find_testing_teams() if len(teams) > 0 : message += ' (' for team in teams : message += team + ',' message = message.strip(',...
for team in teams : message += team + ',' message = message.strip(',') + ')'
for team in sorted(team_map.keys()) : message += '%s x %s, ' % (team, team_map[team]) message = message.rstrip(', ') + ')'
def rcssserver() : output = get_output('ps -o user= -C rcssserver').split('\n'); count = len(output) - 1; message = ' #rcssserver: ' if count > 0: message += '%d,%s' % (count, output[0]) teams = find_testing_teams() if len(teams) > 0 : message += ' (' for team in teams : message += team + ',' message = message.strip(',...
try: self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server.bind((self.host,self.port)) self.server.listen(5) except socket.error, (value,message): if self.server: self.server.close() print "Could not open socket: " + message sys.exit(1)
while 1 : try: self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server.bind((self.host,self.port)) self.server.listen(5) break except socket.error, (value,message): if self.server: self.server.close() print "Could not open socket: " + message time.sleep(1)
def open_socket(self): try: self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server.bind((self.host,self.port)) self.server.listen(5) except socket.error, (value,message): if self.server: self.server.close() print "Could not open socket: " + message sys.exit(1)
g_mutex.acquire()
def run(self): running = 1 while running: message = self.client.recv(self.size) if message: f = open(self.address[0], 'w') message = '<p><strong>' + self.address[0] + '</strong>: ' + message + '</p>\n' f.write(message) f.close()
i = j + len(delim) if str[j:i] == delim: return i, ustr
def strconst(self, str, i, delim): """parse an N3 string constant delimited by delim. return index, val """
ustr = ustr + '"' j = j + 1 continue
if delim == '"': i = j + 1 return i, ustr if delim == '"""': if str[j:j+5] == '"""""': i = j + 5 ustr = ustr + '""' return i, ustr if str[j:j+4] == '""""': i = j + 4 ustr = ustr + '"' return i, ustr if str[j:j+3] == '"""': i = j + 3 return i, ustr j = j + 1 ustr = ustr + '"' continue
def strconst(self, str, i, delim): """parse an N3 string constant delimited by delim. return index, val """
idstr = u"$Id: notation3.py,v 1.200 2007-12-11 21:18:08 syosi Exp $"
idstr = u"$Id: notation3.py,v 1.201 2010-10-23 04:14:48 timbl Exp $"
def startDoc(self):
self.task.scheduleAttachRule(rule, self.ruleSource, self.variables)
if hasattr(rule.subject(), 'contains') and hasattr(rule.object(), 'contains'): self.task.scheduleAttachRule(rule, self.ruleSource, self.variables)
def think(self): rules = self.ruleSource.statementsMatching(pred=self.ruleSource.store.implies) rules.addConsumer(self) for rule in rules: self.task.scheduleAttachRule(rule, self.ruleSource, self.variables)
osmScale = 10000 self.pixels_per_m = 122.94/25.4 * 1000 / osmScale
vertical = subtended_y > subtended_x if vertical: if subtended_y / pageLong_m > subtended_x/pageShort_m: osmScale = subtended_y / pageLong_m hilo = self.midlo + 0.5 * (pageShort_m * osmScale/self.x_m_per_degree) lolo = self.midlo - 0.5 * (pageShort_m * osmScale/self.x_m_per_degree) else: osmScale = subtended_x/pageSho...
def __init__(self, minla, maxla, minlo, maxlo, svgStream=None): progress("Lat between %f and %f, Long %f and %f" % (minla, maxla, minlo, maxlo)) if svgStream==None: self.wr = sys.stdout.write else: self.wr = svgStream.write self.marks = [] # List of marks on the map to avoid overlap self.midla = (minla + maxla)/2....
self.pixels_per_deg_lat = self.pixels_per_m * r_earth * pi /180 self.pixels_per_deg_lon = self.pixels_per_deg_lat * cos(self.midla*degree) self.page_x = int(subtended_x * self.pixels_per_m) self.page_y = int(subtended_y * self.pixels_per_m)
def __init__(self, minla, maxla, minlo, maxlo, svgStream=None): progress("Lat between %f and %f, Long %f and %f" % (minla, maxla, minlo, maxlo)) if svgStream==None: self.wr = sys.stdout.write else: self.wr = svgStream.write self.marks = [] # List of marks on the map to avoid overlap self.midla = (minla + maxla)/2....
progress('Map page size (%i,%i)'% (self.page_x,self.page_y))
progress('Map page size (%f,%f)'% (self.page_x,self.page_y))
def __init__(self, minla, maxla, minlo, maxlo, svgStream=None): progress("Lat between %f and %f, Long %f and %f" % (minla, maxla, minlo, maxlo)) if svgStream==None: self.wr = sys.stdout.write else: self.wr = svgStream.write self.marks = [] # List of marks on the map to avoid overlap self.midla = (minla + maxla)/2....
return (int((lon - self.midlo) * self.pixels_per_deg_lon + self.page_x/2), int(self.page_y/2 - (lat - self.midla) * self.pixels_per_deg_lat))
return ((lon - self.lolo) * self.pixels_per_deg_lon, (self.hila - lat) * self.pixels_per_deg_lat)
def deg_to_px(self, lon, lat): "Note the lon, lat order on input like x,y"
self.wr(" <path style='fill:none; stroke:red' d='M %i %i " % (x,y))
self.wr(" <path style='fill:none; stroke:red' d='M %f %f " % (x,y))
def startPath(self, lon, lat, date): x, y = self.deg_to_px(lon, lat) self.last = (lon, lat, date) self.walking = 0.0 self.wr(" <path style='fill:none; stroke:red' d='M %i %i " % (x,y))
self.wr("L %i %i " % (x,y))
self.wr("L %f %f " % (x,y))
def straightPath(self, lon, lat, date): x, y = self.deg_to_px(lon, lat) self.wr("L %i %i " % (x,y)) lastlon, lastlat, lastdate = self.last dx = (lon-lastlon) * self.x_m_per_degree dy = (lat-lastlat) * self.y_m_per_degree ds = sqrt(dx*dx + dy*dy)
self.wr("M %i %i " % (x,y))
self.wr("M %f %f " % (x,y))
def skipPath(self, lon, lat, date): x, y = self.deg_to_px(lon, lat) self.wr("M %i %i " % (x,y)) self.last = (lon, lat, date)
progress('Track length so far:/m: %i' % (self.total_m)) progress('Time spent walking/m: %i' % (self.walking/60))
progress('Track length so far:/m: %f' % (self.total_m)) progress('Time spent walking/min: %f' % (self.walking/60.0))
def endPath(self): progress('Track length so far:/m: %i' % (self.total_m)) progress('Time spent walking/m: %i' % (self.walking/60)) self.wr("'/>\n\n")
minla, maxla = 90.0, 0.0
minla, maxla = 90.0, -90.0
def close(self): self.wr("</svg>\n")
def getPlayerList(self, maxRetries=None): data = self.write(('admin.listPlayers', 'all')) if not data: return {} players = {} pib = PlayerInfoBlock(data) for p in pib: players[p['name']] = p return players def getServerVars(self): """Update the game property from server fresh data""" try: self.game.is3dSpotting = sel...
def routeBfbc2Packet(self, packet): bfbc2EventType = packet[0] bfbc2EventData = packet[1:] match = re.search(r"^(?P<actor>[^.]+)\.on(?P<event>.+)$", bfbc2EventType) if match: func = 'On%s%s' % (string.capitalize(match.group('actor')), \ string.capitalize(match.group('event'))) #self.debug("-==== FUNC!!: " + func) if ...
def OnPlayerTeamChange(self, action, data):
def OnPlayerTeamchange(self, action, data):
def OnPlayerTeamChange(self, action, data): """ player.onTeamChange <soldier name: player name> <team: Team ID> <squad: Squad ID> Effect: Player might have changed team """ client = self.getClient(data[0]) if client: client.team = self.getTeam(data[1]) # .team setter will send team change event client.squad = data[2]
def OnPlayerSquadChange(self, action, data):
def OnPlayerSquadchange(self, action, data):
def OnPlayerSquadChange(self, action, data): """ player.onSquadChange <soldier name: player name> <team: Team ID> <squad: Squad ID> Effect: Player might have changed squad """ client = self.getClient(data[0]) if client: client.team = self.getTeam(data[1]) # .team setter will send team change event if client.squad != d...
def OnServerLoadingLevel(self, action, data):
def OnServerLoadinglevel(self, action, data):
def OnServerLoadingLevel(self, action, data): """ server.onLoadingLevel <level name: string> Effect: Level is loading """ self.game.mapName = data[0] return b3.events.Event(b3.events.EVT_GAME_WARMUP, data[0])
[currentPlaylist] = self.write(('admin.getPlaylist',)) supportedMaps = self.write(('admin.supportedMaps', currentPlaylist)) return self.getEasyName(supportedMaps[nextLevelIndex])
levelnames = self.write(('mapList.list',)) return self.getEasyName(levelnames[int(nextLevelIndex) % len(levelnames)])
def getNextMap(self): """Return the name of the next map """ [nextLevelIndex] = self.write(('mapList.nextLevelIndex',)) [currentPlaylist] = self.write(('admin.getPlaylist',)) supportedMaps = self.write(('admin.supportedMaps', currentPlaylist)) return self.getEasyName(supportedMaps[nextLevelIndex])
levelnames = self.write(('mapList.list',)) mapList = [] for l in levelnames: mapList.append(self.getEasyName(l)) return mapList def getMap(self): """Return the current level name (not easy map name)""" data = self.write(('admin.currentLevel',)) if not data: return None return data[0] def rotateMap(self): """Load the ...
def getMaps(self): """Return the map list""" [currentPlaylist] = self.write(('admin.getPlaylist',)) supportedMaps = self.write(('admin.supportedMaps', currentPlaylist)) mapList = [] for map in supportedMaps: mapList.append(self.getEasyName(map)) return mapList
mapList = [] for map in supportedMaps: mapList.append(self.getEasyName(map)) return mapList
return supportedMaps def 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 """ supportedMaps = self.getSupportedMaps() suppo...
def getMaps(self): """Return the map list""" [currentPlaylist] = self.write(('admin.getPlaylist',)) supportedMaps = self.write(('admin.supportedMaps', currentPlaylist)) mapList = [] for map in supportedMaps: mapList.append(self.getEasyName(map)) return mapList
if len(event.data) > self._ignoreLength:
if event.type == b3.events.EVT_CLIENT_AUTH or b3.events.EVT_CLIENT_NAME_CHANGE: self.checkBadName(event.client) elif len(event.data) > self._ignoreLength:
def onEvent(self, event): try: if not event.client: return elif event.client.cid == None: return elif event.client.maxLevel > self._maxLevel: return elif not event.client.connected: return if len(event.data) > self._ignoreLength: if event.type == b3.events.EVT_CLIENT_SAY or \ event.type == b3.events.EVT_CLIENT_TEAM_SAY...
elif event.type == b3.events.EVT_CLIENT_NAME_CHANGE: self.checkBadName(event.client)
def onEvent(self, event): try: if not event.client: return elif event.client.cid == None: return elif event.client.maxLevel > self._maxLevel: return elif not event.client.connected: return if len(event.data) > self._ignoreLength: if event.type == b3.events.EVT_CLIENT_SAY or \ event.type == b3.events.EVT_CLIENT_TEAM_SAY...
self.penalizeClient(w.penalty, client, '%s => %s' % (client.exactName, name)) t = threading.Timer(300, self.checkBadName, (client,))
self.penalizeClientBadname(w.penalty, client, '%s => %s' % (client.exactName, name)) t = threading.Timer(60, self.checkBadName, (client,))
def checkBadName(self, client): if not client.connected: return
self.penalizeClient(w.penalty, client, client.exactName) t = threading.Timer(300, self.checkBadName, (client,))
self.penalizeClientBadname(w.penalty, client, client.exactName) t = threading.Timer(60, self.checkBadName, (client,))
def checkBadName(self, client): if not client.connected: return
return b3.events.Event(b3.events.EVT_CLIENT_SUICIDE, (100, 1, 1), self, self)
return b3.events.Event(b3.events.EVT_CLIENT_SUICIDE, (100, 1, 1), attacker, victim)
def OnPlayerKill(self, action, data): #player.onKill: ['Juxta', '6blBaJlblu'] if not len(data) == 2: return None attacker = self.getClient(data[0]) if not attacker: self.debug('No attacker') return None
self.game.is3dSpotting = self.getCvar('3dSpotting') self.game.bannerUrl = self.getCvar('bannerUrl') self.game.crossHair = self.getCvar('crossHair') self.game.currentPlayerLimit = self.getCvar('currentPlayerLimit') self.game.friendlyFire = self.getCvar('friendlyFire') self.game.hardCore = self.getCvar('bbbbbbbbb') self....
self.game.is3dSpotting = self.getCvar('3dSpotting').getBoolean() self.game.bannerUrl = self.getCvar('bannerUrl').getString() self.game.crossHair = self.getCvar('crossHair').getBoolean() self.game.currentPlayerLimit = self.getCvar('currentPlayerLimit').getInt() self.game.friendlyFire = self.getCvar('friendlyFire').getBo...
def getServerVars(self): """Update the game property from server fresh data""" self.game.is3dSpotting = self.getCvar('3dSpotting') self.game.bannerUrl = self.getCvar('bannerUrl') self.game.crossHair = self.getCvar('crossHair') self.game.currentPlayerLimit = self.getCvar('currentPlayerLimit') self.game.friendlyFire = se...
self.debug('Get cvar %s = [%s]', cvarName, words)
self.debug('Get cvar %s = %s', cvarName, words)
def getCvar(self, cvarName): if cvarName not in self._gameServerVars: self.warning('unknown cvar \'%s\'' % cvarName) return None try: words = self.write(('vars.%s' % cvarName,)) except Bfbc2CommandFailedError, err: self.error(err) return self.debug('Get cvar %s = [%s]', cvarName, words) if words and len(words) == 1: ...
value = words[0] val = None if type(value) == tuple and len(value) == 1: if value[0] == 'true': val = True elif value[0] == 'false': val = False elif value[0] == '': val = '' else: try: val = int(value[0]) except ValueError: val = value[0] return b3.cvar.Cvar(cvarName, value=val)
return b3.cvar.Cvar(cvarName, value=words[0])
def getCvar(self, cvarName): if cvarName not in self._gameServerVars: self.warning('unknown cvar \'%s\'' % cvarName) return None try: words = self.write(('vars.%s' % cvarName,)) except Bfbc2CommandFailedError, err: self.error(err) return self.debug('Get cvar %s = [%s]', cvarName, words) if words and len(words) == 1: ...
self.OnClientuserinfo(None, userinfostring)
self.OnClientuserinfochanged(None, userinfostring)
def startup(self): # add the world client self.clients.newClient(-1, guid='WORLD', name='World', hide=True, pbid='WORLD') #if not self.config.has_option('server', 'punkbuster') or self.config.getboolean('server', 'punkbuster'): # self.PunkBuster = b3.parsers.punkbuster.PunkBuster(self)
self.debug('XLR--------> line matched %s' % f.pattern)
def getLineParts(self, line): line = re.sub(self._lineClear, '', line, 1)
def OnClientuserinfo(self, action, data, match=None):
def OnClientuserinfochanged(self, action, data, match=None):
def OnClientuserinfo(self, action, data, match=None): bclient = self.parseUserInfo(data) self.verbose('Parsed user info %s' % bclient) if bclient: cid = bclient['cid'] if cid in self._connectingSlots: self.debug('client on slot %s is already being connected' % cid) return self._connectingSlots.append(cid) client = se...
self.bot("^1KICKING ^3%s" % self._victim.exactName)
self._parent.bot("^1KICKING ^3%s" % self._victim.exactName)
def end_vote_yes(self, yes, no): if yes < self.min_votes: self.console.say(self._parent.getMessage('novotes')) return if self._victim.connected: self.bot("^1KICKING ^3%s" % self._victim.exactName) self.console.say("^1KICKING ^3%s" % self._victim.exactName) self._victim.kick("by popular vote (%s)" % self._reason, Non...
self.bot("Changing map to %s" % self._map)
self._parent.bot("Changing map to %s" % self._map)
def end_vote_yes(self, yes, no): if yes < self.min_votes: self.console.say(self._parent.getMessage('novotes')) return self.console.queueEvent(self.console.getEvent('EVT_VOTEMAP_COMMAND', (self._map,), self.client)) self.bot("Changing map to %s" % self._map) self.console.say(self._parent.getMessage('change_map', self....
self.bot("Changing next map to %s" % self._map)
self._parent.bot("Changing next map to %s" % self._map)
def end_vote_yes(self, yes, no): if yes < self.min_votes: self.console.say(self._parent.getMessage('novotes')) return self.console.queueEvent(self.console.getEvent('EVT_VOTEMAP_COMMAND', (self._map,), self.client)) self._voted = True self.bot("Changing next map to %s" % self._map) self.console.write( 'g_nextmap "%s"'...
self.bot("Shuffling")
self._parent.bot("Shuffling")
def end_vote_yes(self, yes, no): if yes < self.min_votes: self.console.say(self._parent.getMessage('novotes')) return player_count = int(round(len(self.get_players_able_to_vote()) * (self._shuffle_percent / 100.0))) if (yes + no) < player_count: self.console.say(self._parent.getMessage('cant_shuffle', str(player_coun...
self.bot("Cycling map")
self._parent.bot("Cycling map")
def end_vote_yes(self, yes, no): if yes < self.min_votes: self.console.say(self._parent.getMessage('novotes')) return self.bot("Cycling map") self.console.say(self._parent.getMessage('cycle')) time.sleep(1) self.console.write('cyclemap')
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAACWCAIAAAB7I84mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAINJREFUeNrEklEOwBAQRGcb56iPnsGRe6Gex0qJSHZbBGlSP5PHzBDQdR4AyDkXxRDS2CDFgOi1tjoZKQv05LRllZCJvujU53zQYuBfSzl1O6dvcMKiqqctheqv0gmMxMdJVzed5etTj2TZQKDVUtu2Vh1CEMLeJ%2FFZmFnQbm2UW4ABAG%2FHF...
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAACWCAYAAAAfduJyAAAAAXNSR0IArs4c6QAAAAZiS0dEAIcAiACHZn+LRgAAAAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU1FB9oCGRQCLt1vun0AAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAqklEQVQoz3WSwRXDMAhDv7RKZ8jIXagL0QMxNo5zgycBQsDv+wmu6woLMBKWhIEWUYBGypJyKBOWRirAgbDFjd7TRo...
def getHtml(self): cssstyle = """ #b3commands { border-collapse: collapse; } #b3commands th, #b3commands td { font-family: arial; border: 2px solid black; padding: 5px; } #b3commands th { font-weight: bold; background-color: lightgray; text-transform: capitalize; } #b3commands td { font-size: 12px; } #b3commands .b3M...
background: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%03%B6%00%00%00%96%08%06%00%00%00%EA%BE%143%00%00%00%04sBIT%08%08%08%08%7C%08d%88%00%00%00%09pHYs%00%00%0B%12%00%00%0B%12%01%D2%DD~%FC%00%00%00%18tEXtSoftware%00Adobe%20FireworksO%B3%1FN%00%00%04%11tEXtXML%3Acom.adobe.xmp%00%3C%3Fxpacket%20begin%3D...
def getHtml(self): cssstyle = """ #b3commands { border-collapse: collapse; } #b3commands th, #b3commands td { font-family: arial; border: 2px solid black; padding: 5px; } #b3commands th { font-weight: bold; background-color: lightgray; text-transform: capitalize; } #b3commands td { font-size: 12px; } #b3commands .b3M...
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAAZCAIAAACUxWgrAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADlJREFUeNpi/P//PwMDAxMDGLC8fv4cRDEyMoIoBgjFiJViAulhYULhESHHhKoSG4ViLdRlUAogwADulwZZy1%2BP%2BAAAAABJRU5ErkJggg%3D%3D") repeat-x scroll 0 0
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAAZCAIAAACUxWgrAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADlJREFUeNpi/P//PwMDAxMDGLC8fv4cRDEyMoIoBgjFiJViAulhYULhESHHhKoSG4ViLdRlUAogwADulwZZy1%2BP%2BAAAAABJRU5ErkJggg%3D%3D) repeat-x scroll 0 0
def getHtml(self): cssstyle = """ #b3commands { border-collapse: collapse; } #b3commands th, #b3commands td { font-family: arial; border: 2px solid black; padding: 5px; } #b3commands th { font-weight: bold; background-color: lightgray; text-transform: capitalize; } #b3commands td { font-size: 12px; } #b3commands .b3M...
<a title="go to BigBrotherBot website" href="http://www.bigbrotherbot.com/forums/index.php"></a>
<a title="go to BigBrotherBot website" href="http://www.bigbrotherbot.com/forums/index.php"> <img src='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEARwBHAAD/2wBDAAcFBQYFBAcGBQYIBwcIChELCgkJChUPEAwRGBUaGRgVGBcbHichGx0lHRcYIi4iJSgpKywrGiAvMy8qMicqKyr/2wBDAQcICAoJChQLCxQqHBgcKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi...
def getHtml(self): cssstyle = """ #b3commands { border-collapse: collapse; } #b3commands th, #b3commands td { font-family: arial; border: 2px solid black; padding: 5px; } #b3commands th { font-weight: bold; background-color: lightgray; text-transform: capitalize; } #b3commands td { font-size: 12px; } #b3commands .b3M...
seenCommands = set()
def _getCommandsDict(self): if self._maxlevel is not None: self._console.debug('AUTODOC: get commands with level <= %s' % self._maxlevel) seenCommands = set() commands = [] for cmd in self._adminPlugin._commands.values(): if cmd in seenCommands or \ cmd.level is None: continue if self._maxlevel is not None and cmd.leve...
if cmd in seenCommands or \
if cmd in commands or \
def _getCommandsDict(self): if self._maxlevel is not None: self._console.debug('AUTODOC: get commands with level <= %s' % self._maxlevel) seenCommands = set() commands = [] for cmd in self._adminPlugin._commands.values(): if cmd in seenCommands or \ cmd.level is None: continue if self._maxlevel is not None and cmd.leve...
seenCommands.add(cmd)
def _getCommandsDict(self): if self._maxlevel is not None: self._console.debug('AUTODOC: get commands with level <= %s' % self._maxlevel) seenCommands = set() commands = [] for cmd in self._adminPlugin._commands.values(): if cmd in seenCommands or \ cmd.level is None: continue if self._maxlevel is not None and cmd.leve...
commands = []
commands = {}
def _getCommandsDict(self): if self._maxlevel is not None: self._console.debug('AUTODOC: get commands with level <= %s' % self._maxlevel) commands = [] for cmd in self._adminPlugin._commands.values(): if cmd in commands or \ cmd.level is None: continue if self._maxlevel is not None and cmd.level[0] > self._maxlevel: co...
commands.append(tmp)
commands[cmd] = tmp
def _getCommandsDict(self): if self._maxlevel is not None: self._console.debug('AUTODOC: get commands with level <= %s' % self._maxlevel) commands = [] for cmd in self._adminPlugin._commands.values(): if cmd in commands or \ cmd.level is None: continue if self._maxlevel is not None and cmd.level[0] > self._maxlevel: co...
commands.sort(commands_compare) return commands
listCommands = commands.values() listCommands.sort(commands_compare) return listCommands
def commands_compare(x, y): if x['plugin'] < y['plugin']: return -1 elif x['plugin'] > y['plugin']: return 1
if (event.type == b3.events.EVT_CLIENT_KILL):
elif (event.type == b3.events.EVT_CLIENT_KILL):
def onEvent(self, event):
<img src='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEARwBHAAD/2wBDAAcFBQYFBAcGBQYIBwcIChELCgkJChUPEAwRGBUaGRgVGBcbHichGx0lHRcYIi4iJSgpKywrGiAvMy8qMicqKyr/2wBDAQcICAoJChQLCxQqHBgcKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKir/wgARCACWA7YDAREAAhEBAxEB/8QAGwABAAIDAQEAAAAAAAAAAAAAAAEDAgQGBQf/xAAaAQEAAwE...
<img alt="BigBrotherBot" src='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEARwBHAAD/2wBDAAcFBQYFBAcGBQYIBwcIChELCgkJChUPEAwRGBUaGRgVGBcbHichGx0lHRcYIi4iJSgpKywrGiAvMy8qMicqKyr/2wBDAQcICAoJChQLCxQqHBgcKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKir/wgARCACWA7YDAREAAhEBAxEB/8QAGwABAAIDAQEAAAAAAAAAAAAAAAE...
def getHtml(self): cssstyle = """ #b3commands { border-collapse: collapse; } #b3commands th, #b3commands td { font-family: arial; border: 2px solid black; padding: 5px; } #b3commands th { font-weight: bold; background-color: lightgray; text-transform: capitalize; } #b3commands td { font-size: 12px; } #b3commands .b3M...
self._maxLevel = self.config.getint('settings', 'max_level')
try: self._maxLevel = self.config.getint('settings', 'max_level') except: self._maxLevel = 0 try: self._ignoreLength = self.config.getint('settings', 'ignore_length') except: self._ignoreLength = 3
def onLoadConfig(self): self._maxLevel = self.config.getint('settings', 'max_level')