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 persistentTeamsCmd(cn, args): '''@description Keep current teams as they are across multiple games. @usage on/off''' if args == 'on': persistentTeams(True) sbserver.message(notice('Persistent teams enabled')) elif args == 'off': persistentTeams(False) sbserver.message(notice('Persistent teams disabled')) else: raise UsageError('on/off')
def persistentTeamsCmd(cn, args): """@description Keep current teams as they are across multiple games. @usage on/off""" if args == "on": persistentTeams(True) sbserver.message(notice("Persistent teams enabled")) elif args == "off": persistentTeams(False) sbserver.message(notice("Persistent teams disabled")) else: raise UsageError("on/off")
def pingLimiterCmd(cn, args): '''@description Enable or disable kicking high ping users @usage enable/disable''' if args == 'enable': limiter.enabled = True sbserver.playerMessage(cn, notice('Ping limiter enabled')) elif args == 'disable': limiter.enabled = False sbserver.playerMessage(cn, notice('Ping limiter disabled')) else: raise UsageError('enable/disable')
def allowMsg(cn, text): try: p = player(cn) if mute_spectators[0] == True and p.isSpectator(): p.message(notice('Spectators are currently muted. No one will recieve your message')) return False if p.is_muted: p.message(notice('You are currently muted. No one will recieve your message')) return False except (AttributeError, ValueError): pass return True
def allowMsg(cn, text): try: p = player(cn) if mute_spectators[0] == True and p.isSpectator(): p.message( notice( 'Spectators are currently muted. No one will recieve your message' )) return False if p.is_muted: p.message( notice( 'You are currently muted. No one will recieve your message' )) return False except (AttributeError, ValueError): pass return True
def onUnMuteSpectatorsCmd(cn, args): '''@description Unmute spectators @usage''' if args == '': if mute_spectators[0] == False: raise StateError('Spectators are not currently muted') else: mute_spectators[0] = False sbserver.message(notice('Spectators are no longer muted')) else: raise ExtraArgumentError()
def onMuteSpectatorsCmd(cn, args): '''@description Mute all spectators @usage''' if args == '': if mute_spectators[0] == True: raise StateError('Spectators are arleady muted') else: mute_spectators[0] = True sbserver.message(notice('Spectators are now muted')) else: raise ExtraArgumentError()
def playerRecordNextMatch(cn, val): if permissions_ok(cn): if val == sbserver.nextMatchRecorded(): return if val: act = 'enabled' else: act = 'disabled' sbserver.setRecordNextMatch(val) sbserver.message(notice(action_temp.substitute(colordict, action=act, user=sbserver.playerName(cn)))) else: insufficientPermissions(cn)
def setPaused(val, cn=-1): '''Pause or unpause the game''' if isFrozen(): raise StateError('Server is currently frozen') if val == isPaused(): return if val: action = 'paused' else: action = 'unpaused' try: p = player(cn) except ValueError: name = 'Unknown' else: name = p.name() sbserver.message(notice(pause_message.substitute( colordict, action=action, name=name))) sbserver.setPaused(val)
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)
def sendMessage(self): message(notice(self.msg)) addTimer(self.delay, self.sendMessage, ())