def duelCountdown(count, map, mode): players = sbserver.players() if len(sbserver.players()) != 2 or players[0] not in duelers or players[1] not in duelers: cancelDuel() elif count == 0: currently_dueling[0] = True sbserver.message(green('Fight!')) sbserver.setMap(map, mode) sbserver.setPaused(False) else: sbserver.message(green('%i seconds' % count)) addTimer(1000, duelCountdown, (count-1, map, mode))
def duelCountdown(count, map, mode): players = sbserver.players() if len(sbserver.players() ) != 2 or players[0] not in duelers or players[1] not in duelers: cancelDuel() elif count == 0: currently_dueling[0] = True sbserver.message(green('Fight!')) sbserver.setMap(map, mode) sbserver.setPaused(False) else: sbserver.message(green('%i seconds' % count)) addTimer(1000, duelCountdown, (count - 1, map, mode))
def onDuelCommand(cn, args): if args == '': sbserver.playerMessage( cn, error('Usage: #duel <mapname> (mode) (cn) (cn)')) args = args.split(' ') players = sbserver.players() if len(players) != 2: sbserver.playerMessage( cn, error( 'There must be only two unspectated players to enter duel mode.' )) else: if len(args) == 2: map = args[0] mode = int(args[1]) elif len(args) == 1: map = args[0] mode = sbserver.gameMode() else: sbserver.playerMessage(cn, error('Usage: #duel <mapname> (mode)')) return duelers[0] = players[0] duelers[1] = players[1] prev_mastermode = sbserver.masterMode() sbserver.setMasterMode(2) sbserver.message(green('Duel begins in...')) duelCountdown(5, map, mode)
def login(cn, user): if isLoggedIn(cn): raise StateError('You are already logged in') player(cn).user = user player(cn).logged_in = True triggerServerEvent('player_logged_in', (cn,)) sbserver.message(info(green(sbserver.playerName(cn)) + ' is verified'))
def handle_read(self): self.buff += self.recv(4096) if self.buff != "": m = re.search(self.pattern, self.buff) self.buff = "" sbserver.playerMessage(self.cn, green('Translation: ') + white(m.group(1))) remove_request(self.cn, self)
def clanWarTimer(count, cn): if count > 0: message(notice('Clan war starts in ' + green(str(count)))) addTimer(1000, clanWarTimer, (count-1, cn)) else: message(notice('Fight!')) setFrozen(False) setPaused(False)
def clanWarTimer(count, cn): if count > 0: message(notice('Clan war starts in ' + green(str(count)))) addTimer(1000, clanWarTimer, (count - 1, cn)) else: message(notice('Fight!')) setFrozen(False) setPaused(False)
def onDuelCommand(cn, args): if args == '': sbserver.playerMessage(cn, error('Usage: #duel <mapname> (mode) (cn) (cn)')) args = args.split(' ') players = sbserver.players() if len(players) != 2: sbserver.playerMessage(cn, error('There must be only two unspectated players to enter duel mode.')) else: if len(args) == 2: map = args[0] mode = int(args[1]) elif len(args) == 1: map = args[0] mode = sbserver.gameMode() else: sbserver.playerMessage(cn, error('Usage: #duel <mapname> (mode)')) return duelers[0] = players[0] duelers[1] = players[1] prev_mastermode = sbserver.masterMode() sbserver.setMasterMode(2) sbserver.message(green('Duel begins in...')) duelCountdown(5, map, mode)
def setMM(cn, mm): sbserver.message((info(green('%s') + ' set master mode to ' + blue('%s')) % (sbserver.playerName(cn), MMNAMES[mm]))) sbserver.setMasterMode(mm)
def onCommand(cn, command): for i in urllib2.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'): if 'EST' in i: sbserver.playerMessage(cn, green('The Eastern Standard Time is: ') + white(i))
from xsbs.ui import error, notice, warning, info from xsbs.colors import colordict, green, orange from xsbs.players import player, all as allPlayers, playerByName, playerByIpString import sbserver import time import string config = PluginConfig('ownage') spreemessagesenable = config.getOption('Config', 'spreemessages', 'yes') == 'yes' neomessagesenable = config.getOption('Config', 'neomessages', 'yes') == 'yes' dommessagesenable = config.getOption('Config', 'dommessages', 'yes') == 'yes' interval = int(config.getOption('Config', 'max_time_btwn_kills', '2')) del config spreemessages = { 5: string.Template(green('$name') + ' is on a ' + orange('KILLING SPREE!')), 10: string.Template(green('$name') + ' is ' + orange('UNSTOPPABLE!')), 15: string.Template(green('$name') + ' is ' + orange('GODLIKE!')) } endmsg = string.Template(orange('$victimname') + '\'s killing spree ended by ' + green('$killername')) suicideendmsg = string.Template(orange('$victimname') + 'has ended his own killing spree!') neomessages = { 2: string.Template(orange('DOUBLE KILL!')), 3: string.Template(orange('TRIPLE KILL!')), 5: string.Template(orange('OVERKILL!')), 7: string.Template(orange('KILLTACULAR!')), 10: string.Template(orange('KILLOTROCITY!')), 15: string.Template(orange('KILLTASTROPHE!')), 20: string.Template(orange('KILLAPOCALYPSE!')), 25: string.Template(orange('KILLIONAIRE!'))
def onCommand(cn, command): sbserver.playerMessage(cn, green(command) + green(": ") + red(commands[command]))
def resumeTimer(count, cn): if count > 0: sendServerMessage(notice('Resuming in ' + green(str(count)) + white('...'))) addTimer(1000, resumeTimer, (count-1, cn)) else: setPaused(False, cn)