示例#1
0
 def onContinueWithOld(self):
     # show main dialog
     self.win.hide()
     if not gdata.mainGameDlg:
         gdata.mainGameDlg = MainGameDlg(self.app)
         gdata.mainGameDlg.display()
     client.updateDatabase()
示例#2
0
	def onContinueWithOld(self):
			# show main dialog
			self.win.hide()
			if not gdata.mainGameDlg:
				gdata.mainGameDlg = MainGameDlg(self.app)
				gdata.mainGameDlg.display()
			client.updateDatabase()
示例#3
0
 def _selectPlayer(self, playerID):
     self.win.setStatus(_('Executing SELECT PLAYER command...'))
     client.cmdProxy.selectPlayer(playerID)
     self.previousSelection = playerID
     self.win.setStatus(_('Command has been executed.'))
     self.hide()
     if not gdata.mainGameDlg:
         gdata.mainGameDlg = MainGameDlg(self.app)
         gdata.mainGameDlg.display()
     client.updateDatabase()
示例#4
0
 def _selectPlayer(self, playerID):
     self.win.setStatus(_('Executing SELECT PLAYER command...'))
     client.cmdProxy.selectPlayer(playerID)
     self.previousSelection = playerID
     self.win.setStatus(_('Command has been executed.'))
     self.hide()
     if not gdata.mainGameDlg:
         gdata.mainGameDlg = MainGameDlg(self.app)
         gdata.mainGameDlg.display()
     client.updateDatabase()
示例#5
0
 def doLogin(self, gameID, login, password):
     result = client.login(gameID, login, password)
     self.win.hide()
     if result == 1:
         gdata.config.game.lastlogin = login
         # TODO: remove in 0.6
         gdata.config.game.lastpassword = None
         #
         if gdata.savePassword:
             gdata.config.game.lastpasswordcrypted = binascii.b2a_base64(password).strip()
         else:
             gdata.config.game.lastpasswordcrypted = None
         gdata.config.game.lastgameid = gameID
         gdata.config.game.accountcreated = 1
         # write configuration
         gdata.config.save()
         gdata.config.game.lastpasswordcrypted = binascii.b2a_base64(password).strip()
         # check version
         log.debug("Comparing server and client versions", client.serverVersion, version)
         if client.serverVersion != version and not self.versionChecked:
             # don't check next time in this session
             self.versionChecked = True
             # wow, a different version!
             self.confirmDlg.display(
                 _("Your client version does not match server version %d.%d.%d%s. Do you want to continue?")
                 % (
                     client.serverVersion["major"],
                     client.serverVersion["minor"],
                     client.serverVersion["revision"],
                     client.serverVersion["status"],
                 ),
                 _("Yes"),
                 _("No"),
                 self.onContinueWithOld,
                 self.app.exit,
             )
             return
         # show main dialog
         if not gdata.mainGameDlg:
             gdata.mainGameDlg = MainGameDlg(self.app)
             gdata.mainGameDlg.display()
         client.updateDatabase()
     elif result == 2:
         pass
     else:
         # login failed
         self.win.vPassword.text = ""
         self.win.vMessage.text = _("Wrong login and/or password")
         self.win.show()
示例#6
0
 def onToggle(self, widget, action, data):
     selection = self.win.vGalaxer.selection
     try:
         selectedType = selection[0].text
     except IndexError:
         selectedType = None
     if selectedType:
         result = client.setPlayerPreference(selectedType)
         if not type(result) == type(True) and not result == True:
             self.galaxerInfo = result
             self.show()
         else:
             self.win.setStatus(_('Command has been executed.'))
             self.hide()
             if not gdata.mainGameDlg:
                 gdata.mainGameDlg = MainGameDlg(self.app)
                 gdata.mainGameDlg.display()
             client.updateDatabase(clearDB = 1)
示例#7
0
	def doLogin(self,gameID,login,password):
		result = client.login(gameID, login, password)
		self.win.hide()
		if result == 1:
			gdata.config.game.lastlogin = login
			# TODO: remove in 0.6
			gdata.config.game.lastpassword = None
			#
			if gdata.savePassword:
				gdata.config.game.lastpasswordcrypted = binascii.b2a_base64(password).strip()
			else:
				gdata.config.game.lastpasswordcrypted = None
			gdata.config.game.lastgameid = gameID
			gdata.config.game.accountcreated = 1
			# write configuration
			gdata.config.save('var/osci.ini')
			gdata.config.game.lastpasswordcrypted = binascii.b2a_base64(password).strip()
			# init ruleset
			Rules.initRules(os.path.join("res", "rules", client.rulesetName))
			# check version
			if (client.lastClientVersion != version or client.lastClientRevision != revision) and version != (0,0,0,'a'):
				# wow, a different version!
				self.confirmDlg.display(
					_("Your client version does not match server version %d.%d.%d%s [Revision %d]. Do you want to continue?") % (
						client.lastClientVersion[0],
						client.lastClientVersion[1],
						client.lastClientVersion[2],
						client.lastClientVersion[3],
						client.lastClientRevision,
					),
					_('Yes'), _('No'), self.onContinueWithOld, self.app.exit)
				return
			# show main dialog
			if not gdata.mainGameDlg:
				gdata.mainGameDlg = MainGameDlg(self.app)
				gdata.mainGameDlg.display()
			client.updateDatabase()
		elif result == 2:
			pass
		else:
			# login failed
			self.win.vPassword.text = ''
			self.win.vMessage.text = _('Wrong login and/or password')
			self.win.show()
 def onSelect(self, widget, action, data):
     if not self.win.vPos.selection:
         self.win.setStatus(_('Select position.'))
         return
     item = self.win.vPos.selection[0]
     if item.tPosType == STARTPOS_NEWPLAYER:
         self.win.setStatus(_('Executing CREATE NEW PLAYER command...'))
         playerID = client.cmdProxy.createNewPlayer(item.tObjID)
         self.win.setStatus(_('Command has been executed.'))
         self.hide()
         if not gdata.mainGameDlg:
             gdata.mainGameDlg = MainGameDlg(self.app)
             gdata.mainGameDlg.display()
         client.updateDatabase(clearDB=1)
     elif item.tPosType == STARTPOS_AIPLAYER:
         self.win.setStatus(
             _('Executing TAKE OVER REBEL FACTION command...'))
         playerID = client.cmdProxy.takeOverAIPlayer(item.tObjID)
         self.win.setStatus(_('Command has been executed.'))
         self.hide()
         if not gdata.mainGameDlg:
             gdata.mainGameDlg = MainGameDlg(self.app)
             gdata.mainGameDlg.display()
         client.updateDatabase(clearDB=1)
     elif item.tPosType == STARTPOS_PIRATE:
         password = self.win.vPassword.text
         if not password:
             self.win.setStatus(_("Supply VIP password, please."))
             return
         self.win.setStatus(
             _('Executing TAKE OVER PIRATE FACTION command...'))
         try:
             playerID = client.cmdProxy.takeOverPirate(
                 item.tObjID, password)
         except ige.SecurityException:
             self.win.setStatus(_("Supply valid VIP password."))
             return
         self.win.setStatus(_('Command has been executed.'))
         self.hide()
         if not gdata.mainGameDlg:
             gdata.mainGameDlg = MainGameDlg(self.app)
             gdata.mainGameDlg.display()
         client.updateDatabase(clearDB=1)
示例#9
0
	def onSelect(self, widget, action, data):
		if not self.win.vPos.selection:
			self.win.setStatus(_('Select position.'))
			return
		item = self.win.vPos.selection[0]
		if item.tPosType == STARTPOS_NEWPLAYER:
			self.win.setStatus(_('Executing CREATE NEW PLAYER command...'))
			playerID = client.cmdProxy.createNewPlayer(item.tObjID)
			self.win.setStatus(_('Command has been executed.'))
			self.hide()
			if not gdata.mainGameDlg:
				gdata.mainGameDlg = MainGameDlg(self.app)
				gdata.mainGameDlg.display()
			client.updateDatabase(clearDB = 1)
		elif item.tPosType == STARTPOS_AIPLAYER:
			self.win.setStatus(_('Executing TAKE OVER REBEL FACTION command...'))
			playerID = client.cmdProxy.takeOverAIPlayer(item.tObjID)
			self.win.setStatus(_('Command has been executed.'))
			self.hide()
			if not gdata.mainGameDlg:
				gdata.mainGameDlg = MainGameDlg(self.app)
				gdata.mainGameDlg.display()
			client.updateDatabase(clearDB = 1)
		elif item.tPosType == STARTPOS_PIRATE:
			password = self.win.vPassword.text
			if not password:
				self.win.setStatus(_("Supply VIP password, please."))
				return
			self.win.setStatus(_('Executing TAKE OVER PIRATE FACTION command...'))
			try:
				playerID = client.cmdProxy.takeOverPirate(item.tObjID, password)
			except ige.SecurityException:
				self.win.setStatus(_("Supply valid VIP password."))
				return
			self.win.setStatus(_('Command has been executed.'))
			self.hide()
			if not gdata.mainGameDlg:
				gdata.mainGameDlg = MainGameDlg(self.app)
				gdata.mainGameDlg.display()
			client.updateDatabase(clearDB = 1)
示例#10
0
    def doLogin(self, gameID, login, password):
        # Check if vTargetServer is empty
        self.win.vTargetServer.text = self.win.vTargetServer.text.strip(
        ).rstrip()

        if (len(self.win.vTargetServer.text) != 0):
            server_info = self.win.vTargetServer.text.split(":")

            server_port = 9080
            if (len(server_info) == 2):
                try:
                    server_port = int(server_info[1])
                except ValueError:
                    self.messageDlg.display(
                        "The custom server specified doesn't appear to be valid.",
                        "OK")
                    return
            elif (len(server_info) > 2):
                self.messageDlg.display(
                    "The custom server specified doesn't appear to be valid.",
                    "OK")
                return

            server_host = server_info[0]
            gdata.config.game.server = "%s:%u" % (server_host, server_port)
            client.server = gdata.config.game.server

        result = client.login(gameID, login, password)
        self.win.hide()
        if result == 1:
            gdata.config.game.lastlogin = login
            # TODO: remove in 0.6
            gdata.config.game.lastpassword = None
            #
            if gdata.savePassword:
                gdata.config.game.lastpasswordcrypted = binascii.b2a_base64(
                    password).strip()
            else:
                gdata.config.game.lastpasswordcrypted = None
            gdata.config.game.lastgameid = gameID
            gdata.config.game.accountcreated = 1
            # write configuration
            gdata.config.save('var/osci.ini')
            gdata.config.game.lastpasswordcrypted = binascii.b2a_base64(
                password).strip()
            # init ruleset
            Rules.initRules(os.path.join("res", "rules", client.rulesetName))
            # check version
            if (client.lastClientVersion != version
                    or client.lastClientRevision != revision
                ) and version != (0, 0, 0, 'a'):
                # wow, a different version!
                self.confirmDlg.display(
                    _("Your client version does not match server version %d.%d.%d%s [Revision %d]. Do you want to continue?"
                      ) % (
                          client.lastClientVersion[0],
                          client.lastClientVersion[1],
                          client.lastClientVersion[2],
                          client.lastClientVersion[3],
                          client.lastClientRevision,
                      ), _('Yes'), _('No'), self.onContinueWithOld,
                    self.app.exit)
                return
            # show main dialog
            if not gdata.mainGameDlg:
                gdata.mainGameDlg = MainGameDlg(self.app)
                gdata.mainGameDlg.display()
            client.updateDatabase()
        elif result == 2:
            pass
        else:
            # login failed
            self.win.vPassword.text = ''
            self.win.vMessage.text = _('Wrong login and/or password')
            self.win.show()