Пример #1
0
def namesCmd(cn, args):
    '''@description Display names used by client
	   @usage cn
	   @public'''
    if master_required and not isAtLeastMaster(cn):
        insufficientPermissions(cn)
        return
    if args == '':
        raise UsageError()
        return
    try:
        tcn = int(args)
        names = dbmanager.query(IpToNick).filter(
            IpToNick.ip == sbserver.playerIpLong(tcn)).all()
        if len(names) == 0:
            sbserver.playerMessage(cn, info('No names found'))
            return
    except NoResultFound:
        sbserver.playerMessage(cn, info('No names found'))
        return
    except ValueError:
        sbserver.playerMessage(cn, error('Invalid cn'))
        return
    namestr = 'Other known names: '
    for name in names:
        namestr += name.nick + ' '
    sbserver.playerMessage(cn, info(namestr))
Пример #2
0
def namesCmd(cn, args):
	'''@description Display names used by client
	   @usage cn
	   @public'''
	if master_required and not isAtLeastMaster(cn):
		insufficientPermissions(cn)
		return
	if args == '':
		raise UsageError()
		return
	try:
		tcn = int(args)
		names = dbmanager.query(IpToNick).filter(IpToNick.ip==sbserver.playerIpLong(tcn)).all()
		if len(names) == 0:
			sbserver.playerMessage(cn, info('No names found'))
			return
	except NoResultFound:
		sbserver.playerMessage(cn, info('No names found'))
		return
	except ValueError:
		sbserver.playerMessage(cn, error('Invalid cn'))
		return
	namestr = 'Other known names: '
	for name in names:
		namestr += name.nick + ' '
	sbserver.playerMessage(cn, info(namestr))
Пример #3
0
def onReqSpectate(cn, tcn):
    if tcn != cn:
        if isAtLeastMaster(cn):
            sbserver.spectate(tcn)
        else:
            insufficientPermissions(cn)
    else:
        sbserver.spectate(tcn)
Пример #4
0
def onReqSpectate(cn, tcn):
	if tcn != cn:
		if isAtLeastMaster(cn):
			sbserver.spectate(tcn)
		else:
			insufficientPermissions(cn)
	else:
		sbserver.spectate(tcn)
Пример #5
0
def onReqUnspectate(cn, tcn):
	if tcn != cn:
		if isAtLeastMaster(cn):
			sbserver.unspectate(tcn)
		else:
			insufficientPermissions(cn)
	else:
		if sbserver.masterMode() > 1 and not isAtLeastMaster(cn):
			sbserver.playerMessage(cn, error('Master mode is locked.  You cannot unspectate.'))
		else:
			sbserver.unspectate(tcn)
Пример #6
0
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)
Пример #7
0
def onReqUnspectate(cn, tcn):
    if tcn != cn:
        if isAtLeastMaster(cn):
            sbserver.unspectate(tcn)
        else:
            insufficientPermissions(cn)
    else:
        if sbserver.masterMode() > 1 and not isAtLeastMaster(cn):
            sbserver.playerMessage(
                cn, error('Master mode is locked.  You cannot unspectate.'))
        else:
            sbserver.unspectate(tcn)
Пример #8
0
def onSetTeam(tcn, cn, team):
    p = player(cn)
    r = player(tcn)
    if cn != tcn and not isAtLeastMaster(tcn):
        insufficientPermissions(tcn)
        return
    mode = currentMode()
    if isSafeTeam(team):
        execLater(p.suicide, ())
        p.setTeam(team)
    else:
        r.message(
            error('You cannot join team \'%s\' in game mode %s' %
                  (team, modeName(currentMode()))))
Пример #9
0
def onSetTeam(tcn, cn, team):
	p = player(cn)
	r = player(tcn)
	if cn != tcn and not isAtLeastMaster(tcn):
		insufficientPermissions(tcn)
		return
	mode = currentMode()
	if isSafeTeam(team):
		execLater(p.suicide, ())
		p.setTeam(team)
	else:
		r.message(error('You cannot join team \'%s\' in game mode %s' % (
				team,
				modeName(currentMode())
				)))
Пример #10
0
def onCommand(cn, args):
	'''@description Stats for the current match
	   @usage (cn)
	   @public'''
	cp = player(cn)
	if args != '':
		if require_master and not isPlayerMaster(cn):
			insufficientPermissions(cn)
			return
		try:
			p = player(int(args))
		except ValueError:
			cp.message(error('Usage: #stats (cn)'))
			return
	else:
		p = cp
	if not p.name():
		cp.message(error('You must use a valid cn'))
		return

	msg = template.substitute(colordict, name=p.name(), frags=p.frags(), deaths=p.deaths(), teamkills=p.teamkills(), shots=p.shots(), hits=p.hits(), accuracy=p.accuracy(), ktd=p.kpd(), score=p.score())
	cp.message(msg)
Пример #11
0
	def __call__(self, *args):
		if not isAdmin(args[0]):
			insufficientPermissions(args[0])
		else:
			self.func(*args)
Пример #12
0
	def __call__(self, *args):
		if not isAtLeastMaster(args[0]):
			insufficientPermissions(args[0])
		else:
			self.func(*args)
Пример #13
0
 def __call__(self, *args):
     if not isAdmin(args[0]):
         insufficientPermissions(args[0])
     else:
         self.func(*args)
Пример #14
0
 def __call__(self, *args):
     if not isAtLeastMaster(args[0]):
         insufficientPermissions(args[0])
     else:
         self.func(*args)