def hostGameClicked(self, item): ''' Hosting a game event ''' if not fa.exe.available(): return self.stopSearchRanked() # A simple Hosting dialog. if fa.exe.check(item.mod): hostgamewidget = HostgameWidget(self, item) if hostgamewidget.exec_() == 1 : if self.gamename: gameoptions = [] if len(self.options) != 0 : oneChecked = False for option in self.options : if option.isChecked() : oneChecked = True gameoptions.append(option.isChecked()) if oneChecked == False : QtGui.QMessageBox.warning(None, "No option checked !", "You have to check at least one option !") return modnames = [str(moditem.text()) for moditem in hostgamewidget.modList.selectedItems()] mods = [hostgamewidget.mods[modstr] for modstr in modnames] modvault.setActiveMods(mods, True) #should be removed later as it should be managed by the server. # #Send a message to the server with our intent. if self.ispassworded: self.client.send(dict(command="game_host", access="password", password = self.gamepassword, mod=item.mod, title=self.gamename, mapname=self.gamemap, gameport=self.client.gamePort, options = gameoptions)) else : self.client.send(dict(command="game_host", access="public", mod=item.mod, title=self.gamename, mapname=self.gamemap, gameport=self.client.gamePort, options = gameoptions))
def hostGameClicked(self, item): ''' Hosting a game event ''' self.load_last_hosted_settings() if not fa.instance.available(): return self.stopSearchRanked() hostgamewidget = HostgameWidget(self, item) # Abort if the client cancelled the host game dialogue. if hostgamewidget.exec_() != 1 : return # Make sure the binaries are all up to date, and abort if the update fails or is cancelled. if not fa.check.game(self.client): return # Ensure all mods are up-to-date, and abort up if the update process fails. if not fa.check.check(item.mod): return modnames = [str(moditem.text()) for moditem in hostgamewidget.modList.selectedItems()] mods = [hostgamewidget.mods[modstr] for modstr in modnames] modvault.setActiveMods(mods, True) #should be removed later as it should be managed by the server. self.client.host_game(title=self.gamename, mod=item.mod, visibility="friends" if self.friends_only else "public", mapname=self.gamemap, password=self.gamepassword if self.ispassworded else None)
def coopListDoubleClicked(self, item): ''' Hosting a coop event ''' if not hasattr(item, "mapUrl") : return if not fa.instance.available(): return self.client.games.stopSearchRanked() self.gamemap = fa.maps.link2name(item.mapUrl) fa.check.map(self.gamemap, force=True) # A simple Hosting dialog. if fa.check.check("coop"): hostgamewidget = HostgameWidget(self, item) if hostgamewidget.exec_() == 1 : if self.gamename: modnames = [str(moditem.text()) for moditem in hostgamewidget.modList.selectedItems()] mods = [hostgamewidget.mods[modstr] for modstr in modnames] modvault.setActiveMods(mods, True) #should be removed later as it should be managed by the server. # #Send a message to the server with our intent. if self.ispassworded: self.client.send(dict(command="game_host", access="password", password = self.gamepassword, mod=item.mod, title=self.gamename, mapname=self.gamemap, gameport=self.client.gamePort)) else : self.client.send(dict(command="game_host", access="public", mod=item.mod, title=self.gamename, mapname=self.gamemap, gameport=self.client.gamePort))
def hostGameClicked(self, item): ''' Hosting a game event ''' if not fa.exe.available(): return self.stopSearchRanked() # A simple Hosting dialog. if fa.exe.check(item.mod): hostgamewidget = HostgameWidget(self, item) if hostgamewidget.exec_() == 1: if self.gamename: gameoptions = [] if len(self.options) != 0: oneChecked = False for option in self.options: if option.isChecked(): oneChecked = True gameoptions.append(option.isChecked()) if oneChecked == False: QtGui.QMessageBox.warning( None, "No option checked !", "You have to check at least one option !") return modnames = [ str(moditem.text()) for moditem in hostgamewidget.modList.selectedItems() ] mods = [hostgamewidget.mods[modstr] for modstr in modnames] modvault.setActiveMods( mods, True ) #should be removed later as it should be managed by the server. # #Send a message to the server with our intent. if self.ispassworded: self.client.send( dict(command="game_host", access="password", password=self.gamepassword, mod=item.mod, title=self.gamename, mapname=self.gamemap, gameport=self.client.gamePort, options=gameoptions)) else: self.client.send( dict(command="game_host", access="public", mod=item.mod, title=self.gamename, mapname=self.gamemap, gameport=self.client.gamePort, options=gameoptions))
def coopListDoubleClicked(self, item): ''' Hosting a coop event ''' if not hasattr(item, "mapUrl"): return if not fa.instance.available(): return self.client.games.stopSearchRanked() self.gamemap = fa.maps.link2name(item.mapUrl) fa.check.map(self.gamemap, force=True) # A simple Hosting dialog. if fa.check.check("coop"): hostgamewidget = HostgameWidget(self, item) if hostgamewidget.exec_() == 1: if self.gamename: modnames = [ str(moditem.text()) for moditem in hostgamewidget.modList.selectedItems() ] mods = [hostgamewidget.mods[modstr] for modstr in modnames] modvault.setActiveMods( mods, True ) #should be removed later as it should be managed by the server. # #Send a message to the server with our intent. if self.ispassworded: self.client.send( dict(command="game_host", access="password", password=self.gamepassword, mod=item.mod, title=self.gamename, mapname=self.gamemap, gameport=self.client.gamePort)) else: self.client.send( dict(command="game_host", access="public", mod=item.mod, title=self.gamename, mapname=self.gamemap, gameport=self.client.gamePort))
def hostGameClicked(self, item): ''' Hosting a game event ''' self.load_last_hosted_settings() if not fa.instance.available(): return self.stopSearchRanked() hostgamewidget = HostgameWidget(self, item) # Abort if the client cancelled the host game dialogue. if hostgamewidget.exec_() != 1: return # Make sure the binaries are all up to date, and abort if the update fails or is cancelled. if not fa.check.game(self.client): return # Ensure all mods are up-to-date, and abort up if the update process fails. if not fa.check.check(item.mod): return modnames = [ str(moditem.text()) for moditem in hostgamewidget.modList.selectedItems() ] mods = [hostgamewidget.mods[modstr] for modstr in modnames] modvault.setActiveMods( mods, True ) #should be removed later as it should be managed by the server. self.client.host_game( title=self.gamename, mod=item.mod, visibility="friends" if self.friends_only else "public", mapname=self.gamemap, password=self.gamepassword if self.ispassworded else None)