Example #1
0
File: duel.py Project: pguenth/xsbs
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)
Example #2
0
def setMasterMode(mm_number):
	'''Set server master mode.
	   0 - open
	   1 - veto
	   2 - locked
	   3 - private'''
	sbserver.setMasterMode(mm_number)
Example #3
0
def masterMode(caller,name=None):
        """This changes the mastermode in the same way that /mastermode does without the need to have claimed master or admin."""
	if name==None:
		return sbserver.masterMode()
	mastermode=mastermodeNumber(name)
	
	if config["serverpublic"]=="1":
		if mastermode>=2:
			UserSessionManager.checkPermissions(caller,"trusted")
	if config["serverpublic"]=="2":
		if mastermode>=3:
			UserSessionManager.checkPermissions(caller,"trusted")
	
	return sbserver.setMasterMode(mastermode)
Example #4
0
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)
Example #5
0
def masterMode(caller,name=None):
	"""Changes the mastermode of the server."""
	if name==None:
		return sbserver.masterMode()
	mastermode=mastermodeNumber(name)
	
	if config["serverpublic"]=="1":
		if mastermode>=2:
			UserSessionManager.checkPermissions(caller,"trusted")
	if config["serverpublic"]=="2":
		if mastermode>=3:
			UserSessionManager.checkPermissions(caller,"trusted")
	
	return sbserver.setMasterMode(mastermode)
Example #6
0
def endDuel():
	sbserver.setMasterMode(prev_mastermode)
	sbserver.setPaused(False)
	currently_dueling[0] = False
	currently_dueling[1] = False
Example #7
0
def onNoClients():
    if sbserver.masterMode() > 1:
        sbserver.setMasterMode(1)
Example #8
0
def setMM(cn, mm):
    sbserver.message((info(green('%s') + ' set master mode to ' + blue('%s')) %
                      (sbserver.playerName(cn), MMNAMES[mm])))
    sbserver.setMasterMode(mm)
Example #9
0
File: duel.py Project: pguenth/xsbs
def endDuel():
    sbserver.setMasterMode(prev_mastermode)
    sbserver.setPaused(False)
    currently_dueling[0] = False
    currently_dueling[1] = False
Example #10
0
def onNoClients():
	if sbserver.masterMode() > 1:
		sbserver.setMasterMode(1)
Example #11
0
def setMM(cn, mm):
	sbserver.message((info(green('%s') + ' set master mode to ' + blue('%s')) % (sbserver.playerName(cn), MMNAMES[mm])))
	sbserver.setMasterMode(mm)