def accept(self):
        logging.info("New Game Wizard accept")
        logging.info("======================")

        blueFaction = [c for c in db.FACTIONS][self.field("blueFaction")]
        redFaction = [c for c in db.FACTIONS][self.field("redFaction")]

        selectedCampaign = self.field("selectedCampaign")
        if selectedCampaign is None:
            selectedCampaign = self.campaigns[0]

        conflictTheater = selectedCampaign.theater

        timePeriod = db.TIME_PERIODS[list(
            db.TIME_PERIODS.keys())[self.field("timePeriod")]]
        midGame = self.field("midGame")
        multiplier = self.field("multiplier")
        no_carrier = self.field("no_carrier")
        no_lha = self.field("no_lha")
        supercarrier = self.field("supercarrier")
        no_player_navy = self.field("no_player_navy")
        no_enemy_navy = self.field("no_enemy_navy")
        invertMap = self.field("invertMap")
        starting_money = int(self.field("starting_money"))

        player_name = blueFaction
        enemy_name = redFaction

        settings = Settings()
        settings.inverted = invertMap
        settings.supercarrier = supercarrier
        settings.do_not_generate_carrier = no_carrier
        settings.do_not_generate_lha = no_lha
        settings.do_not_generate_player_navy = no_player_navy
        settings.do_not_generate_enemy_navy = no_enemy_navy

        generator = GameGenerator(player_name, enemy_name, conflictTheater,
                                  settings, timePeriod, starting_money,
                                  multiplier, midGame)
        self.generatedGame = generator.generate()

        super(NewGameWizard, self).accept()
Example #2
0
    def accept(self):

        blueFaction = [c for c in db.FACTIONS][self.field("blueFaction")]
        redFaction = [c for c in db.FACTIONS][self.field("redFaction")]
        isTerrainPg = self.field("isTerrainPg")
        isTerrainNttr = self.field("isTerrainNttr")
        isTerrainCaucasusSmall = self.field("isTerrainCaucasusSmall")
        isTerrainRussia = self.field("isTerrainRussia")
        isTerrainCaucasusNorth = self.field("isTerrainCaucasusNorth")
        isIranianCampaignTheater = self.field("isIranianCampaignTheater")
        isTerrainNormandy = self.field("isTerrainNormandy")
        isTerrainNormandySmall = self.field("isTerrainNormandySmall")
        isTerrainChannel = self.field("isTerrainChannel")
        isTerrainChannelComplete = self.field("isTerrainChannelComplete")
        isTerrainEmirates = self.field("isTerrainEmirates")
        timePeriod = db.TIME_PERIODS[list(
            db.TIME_PERIODS.keys())[self.field("timePeriod")]]
        midGame = self.field("midGame")
        multiplier = self.field("multiplier")
        no_carrier = self.field("no_carrier")
        no_lha = self.field("no_lha")
        supercarrier = self.field("supercarrier")
        no_player_navy = self.field("no_player_navy")
        no_enemy_navy = self.field("no_enemy_navy")
        invertMap = self.field("invertMap")

        player_name = blueFaction
        enemy_name = redFaction

        if isTerrainPg:
            conflicttheater = persiangulf.PersianGulfTheater()
        elif isTerrainNttr:
            conflicttheater = nevada.NevadaTheater()
        elif isTerrainCaucasusSmall:
            conflicttheater = caucasus.WesternGeorgia()
        elif isTerrainRussia:
            conflicttheater = caucasus.RussiaSmall()
        elif isTerrainCaucasusNorth:
            conflicttheater = caucasus.NorthCaucasus()
        elif isIranianCampaignTheater:
            conflicttheater = persiangulf.IranianCampaign()
        elif isTerrainEmirates:
            conflicttheater = persiangulf.Emirates()
        elif isTerrainNormandy:
            conflicttheater = normandy.NormandyTheater()
        elif isTerrainNormandySmall:
            conflicttheater = normandy.NormandySmall()
        elif isTerrainChannel:
            conflicttheater = thechannel.ChannelTheater()
        elif isTerrainChannelComplete:
            conflicttheater = thechannel.ChannelTheaterComplete()
        else:
            conflicttheater = caucasus.CaucasusTheater()

        settings = Settings()
        settings.inverted = invertMap
        settings.supercarrier = supercarrier
        settings.do_not_generate_carrier = no_carrier
        settings.do_not_generate_lha = no_lha
        settings.do_not_generate_player_navy = no_player_navy
        settings.do_not_generate_enemy_navy = no_enemy_navy

        self.generatedGame = self.start_new_game(player_name, enemy_name,
                                                 conflicttheater, midGame,
                                                 multiplier, timePeriod,
                                                 settings)

        super(NewGameWizard, self).accept()