示例#1
0
def runBountyMenu(cp=-1):
    if cp == -1:
        cp = VS.getCurrentPlayer()
    un = VS.getPlayerX(cp)
    id = None

    def callback(dialog, result):
        print('id is: ', id)
        action, inputs = dialog_box.fromValues(result)
        if action == 'Cancel':
            dialog.undraw()
            custom.respond(['close'], None, id)
            return False
        if action == 'OK':
            dialog.undraw()
            custom.respond(['close'], None, id)

            callsign = inputs['logged_in_users']
            if callsign == '' or callsign == 'OR, Type in a user:'******'callsign']

            print('I would now place a bounty on ' + str(callsign) + ' for ' +
                  str(float(inputs['credits'])) + ' credits.')
            print('User value IS: ' + str(inputs['logged_in_users']))
            server_lib.placeBounty(callsign, float(inputs['credits']))
            return False
        return True

    items = [
        'width',
        1.5,
        'text',
        "Place a bounty on someone's head",
    ]
    items += [
        'height', 0.05, 'row', 'textwidth',
        'Credits:', 0.3, 'textinput', 'credits',
        ('%g' % max(1000.,
                    un.getCredits() / 100.)), 'endrow', 'height', 0.05
    ]
    if VS.isserver():
        import server
        logged_in_users = server.getDirector().getCallsignList()
        logged_in_users.append('OR, Type in a user:'******'text', 'Select a player in this system:', 'list',
            'logged_in_users',
            len(logged_in_users)
        ] + logged_in_users
        items += [
            'row', 'textwidth', 'Other Player:', 0.3, 'textinput', 'callsign',
            '', 'endrow'
        ]
    else:
        items += [
            'list', 'logged_in_users', 15, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
            'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o'
        ]
    items += dialog_box.button_row(1.5, 'OK', 'Cancel')
    id = dialog_box.dialog(items, callback)
示例#2
0
def runBountyMenu(cp=-1):
	if cp==-1:
		cp=VS.getCurrentPlayer()
	un = VS.getPlayerX(cp)
	id=None
	
	def callback(dialog,result):
		print 'id is: ',id
		action,inputs = dialog_box.fromValues(result)
		if action=='Cancel':
			dialog.undraw()
			custom.respond(['close'],None,id)
			return False
		if action=='OK':
			dialog.undraw()
			custom.respond(['close'],None,id)

			callsign = inputs['logged_in_users']
			if callsign=='' or callsign=='OR, Type in a user:'******'callsign']

			print 'I would now place a bounty on '+str(callsign)+' for '+str(float(inputs['credits']))+' credits.'
			print 'User value IS: '+str(inputs['logged_in_users'])
			server_lib.placeBounty(callsign,float(inputs['credits']))
			return False
		return True
	
	items=['width', 1.5,
		'text', "Place a bounty on someone's head",
]
	items+=['height',0.05,
		'row',
		'textwidth','Credits:',0.3,
		'textinput','credits',('%g'%max(1000.,un.getCredits()/100.)),
		'endrow',
		'height',0.05]
	if VS.isserver():
		import server
		logged_in_users=server.getDirector().getCallsignList()
		logged_in_users.append('OR, Type in a user:'******'text','Select a player in this system:',
			'list','logged_in_users',len(logged_in_users)]+logged_in_users
		items+=['row',
			'textwidth','Other Player:',0.3,
			'textinput','callsign','',
			'endrow']
	else:
		items+=['list','logged_in_users',15,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o']
	items += dialog_box.button_row(1.5,'OK','Cancel')
	id = dialog_box.dialog(items,callback)
示例#3
0
def serverDirector():
	return server.getDirector()