Esempio n. 1
0
 def dbcallback(db, data):
     db.undraw()
     custom.respond(["close"], None, db.id)
     arg = False
     if data[0] != buttons[0] and data[0] != "Cancel":
         arg = data[0]
     if callback:
         return callback(arg)
Esempio n. 2
0
 def dbcallback(db,data):
     db.undraw()
     custom.respond(["close"],None,db.id)
     arg = False
     if data[0]!=buttons[0] and data[0]!="Cancel":
         arg = data[0]
     if callback:
         return callback(arg)
    def myCallback(db, data):
        def serverCallback(data):
            if data[0] == "close":
                db.undraw()
            if data[0] == "reset":
                db.reset()

        custom.respond(data, serverCallback, id)
Esempio n. 4
0
	def callback(dialog,result):
		print 'id is: ',id
		action,inputs = dialog_box.fromValues(result)
		if action=='Test':
			print 'test clicked!!!!'
		if action=='Bounty Hunt':
			print 'hunting bounty'
			runBountyMenu(cp)
		if action=='OK' or action=="Exit Menu" or action=="Cancel":
			dialog.undraw()
			custom.respond(['close'],None,id)
			return False
		return True
Esempio n. 5
0
 def callback(dialog, result):
     print 'id is: ', id
     action, inputs = dialog_box.fromValues(result)
     if action == 'Test':
         print 'test clicked!!!!'
     if action == 'Bounty Hunt':
         print 'hunting bounty'
         runBountyMenu(cp)
     if action == 'OK' or action == "Exit Menu" or action == "Cancel":
         dialog.undraw()
         custom.respond(['close'], None, id)
         return False
     return True
Esempio n. 6
0
	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
Esempio n. 7
0
    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
Esempio n. 8
0
 def dbcallback(db, data):
     db.undraw()
     custom.respond(["close"], None, db.id)
     if callback:
         return callback()
Esempio n. 9
0
    def myCallback(db, data):
        def serverCallback(data):
            if data[0] == 'close':
                db.undraw()

        custom.respond(data, serverCallback, id)
Esempio n. 10
0
def processMessage(player, auth, command, args, id=''):
	if command in aliasinfo:
		command = aliasinfo[command]
	#cmdinfo = getCommandInfo(command, auth)
	if auth<1 and command in authcommandinfo:
		player.sendMessage("#884400You must be authorized to use "+command)
		return
	#if cmdinfo and len(args)<cmdinfo[0]:
	#	processMessage(player,True,"help",[command])
	#	return
	if command=='help':
		if len(args)<1:
			cmdstr = '#8800cc'+' '.join(commandinfo)
			if auth>=1:
				cmdstr += '#cc0088 '+' '.join(authcommandinfo)
			player.sendMessage('#888800Valid commands: '+cmdstr)
		else:
			cmdinfo = getCommandInfo(args[0], True)
			if cmdinfo and len(cmdinfo)>=3:
				player.sendMessage("#888800Usage: #880088"+cmdinfo[1]+"#888800 - "+cmdinfo[2])
			else:
				player.sendMessage("#884400/"+args[0]+" does not exist. Use /help for a list of commands.")
	elif command=='reload':
		if auth<1:
			return
		vsmod=VS
		reload(__import__('server_lib'))
		vsmod.IOmessage(0,"game","all","The server python script has been reloaded.")
	elif command=='userlist':
		cstr = '#44cc44Users on the server:#888800'
		print len(serverDirector().playerlist)
		for x in serverDirector().playerlist:
			#print x
			#print x.callsign
			if x.callsign:
				cstr += ' '+x.callsign
		player.sendMessage(cstr)
	elif command=='shipinfo':
		response = []
		if len(args)>=1:
			callsign = fixCallsign(args[0])
			if Director.getSaveDataLength(0,"bounty_"+callsign):
				amt = Director.getSaveData(0,"bounty_"+callsign,0)
				if amt > 1000.:
					response.append("WANTED for %g credits!"%amt)
			if callsign=='ai':
				response.append("* Artifically Intelligent *")
		if id:
			custom.respond(response,None,id)
		else:
			for msg in response:
				player.sendMessage(msg)
	elif command=='shiplist':
		cnt=0
		min=-1
		max=-1
		cstr=''
		if 1: #try:
			page=int(args[0])
			cstr = '#44cc44Available ships (#888800'+str(page)+'#44cc44):#888800'
			num=10
			min=(page-1)*num
			max=page*num
		else: #except:
			min=-1
		if min<0:
			processMessage(player,False,"help",[command])
		else:
			shiplist=faction_ships.stattableexp.keys()
			shiplist.sort()
			for x in shiplist:
				cnt+=1
				if cnt>=min and cnt<max:
					cstr+= ' '+x
			player.sendMessage(cstr)
	elif command=='launcheach':
		if auth<1:
			return
		shiplist = faction_ships.stattableexp.keys()
		for x in shiplist:
			processMessage(player,1,"launchme",[x])
	elif command=='setadmin':
		if len(args)<2:
			return
		if auth<1:
			return
		playerto = serverDirector().getPlayerByCallsign(args[0])
		if not playerto:
			print args[0]
			player.sendMessage("#884400Cannot find player "+args[0])
			return
		print args
		value=0.0
		if args[1]=='yes' or args[1]=='1':
			value=1.0
		pnum=playerto.player_num
		if Director.getSaveDataLength(pnum, 'serveradmin')<1:
			Director.pushSaveData(pnum, 'serveradmin', value)
		else:
			Director.putSaveData(pnum, 'serveradmin', 0, value)
		playerto.sendMessage("Your admin status set to "+str(value))
	elif command=='write':
		if len(args)<1:
			return
		playerto = serverDirector().getPlayerByCallsign(args[0])
		if not playerto:
			player.sendMessage("#884400Cannot find player "+args[0])
			return
		playerto.sendMessage(' '.join(args[1:]), player.callsign)
		player.sendMessage('Message to '+args[0]+': '+(' '.join(args[1:])))
	elif command=='say':
		VS.IOmessage(0, player.callsign,'all',' '.join(args))
	elif command=='launchme' or command=='launchtarg' or command=='launch':
		if auth<1:
			return
		if len(args)<1:
			return
		factquan=()
		if command=="launchtarg" or command=="launchme":
			if not player.current_un:
				player.sendMessage("#884400Use /launch <unit> <aroundname> to launch when you are null.")
				return
			if len(args)>=3:
				factquan=(args[1],args[2])
			elif len(args)>=2:
				factquan=(args[1],)
			targun = player.current_un
			if command=="launchtarg":
				metarg=targun.GetTarget()
				if metarg:
					targun = metarg
		else:
			if len(args)<2:
				processMessage(player,False,"help",[command])
				return
			if len(args)>=4:
				factquan=(args[2],args[3])
			elif len(args)>=3:
				factquan=(args[2],)
			targunname = args[1].lower()
			iter = VS.getUnitList()
			while iter.notDone():
				targun=iter.current()
				if targun.getName().lower()==targunname:
					break
				if targun.getFullname().lower()==targunname:
					break
				iter.advance()
		faction = targun.getFactionName()
		type=args[0]
		quantity=1
		for a in factquan:
			try:
				int(a)
				quantity=int(a)
				print quantity
			except ValueError:
				faction=a
				print faction
		fgname='AI'
		ainame='default'
		launch.launch_wave_around_unit(fgname,faction,type,ainame,quantity,2000.0,4000.0,targun)
	else:
		processMessage(player, auth, "help", [command])
Esempio n. 11
0
 def dbcallback(db,data):
     db.undraw()
     custom.respond(["close"],None,db.id)
     if callback:
         return callback()
Esempio n. 12
0
    def myCallback(db,data):
        def serverCallback(data):
            if data[0]=='close':
                db.undraw()

        custom.respond(data,serverCallback,id)