Esempio n. 1
0
def inspect_universe_generation_interface(*args, **kwargs):
    import freeorion as fo
    tech = fo.getTech('LRN_ARTIF_MINDS')
    universe = fo.get_universe()
    empire = fo.get_empire(1)
    rules = fo.getGameRules()
    hull_type = fo.getHullType('SH_XENTRONIUM')
    species = fo.getSpecies('SP_ABADDONI')
    inspect(
        fo,
        instances=[
            fo.getFieldType('FLD_ION_STORM'),
            fo.getBuildingType('BLD_SHIPYARD_BASE'),
            hull_type,
            hull_type.slots,
            fo.getPartType('SR_WEAPON_1_1'),
            fo.getSpecial('MODERATE_TECH_NATIVES_SPECIAL'),
            species,
            fo.diplomaticMessage(1, 2, fo.diplomaticMessageType.acceptPeaceProposal),
            rules,
            tech,
            tech.unlockedItems,
            rules.getRulesAsStrings,
            universe,
            universe.effectAccounting,
            universe.buildingIDs,
            fo.get_galaxy_setup_data(),
            empire,
            empire.colour,
            empire.productionQueue,
            empire.researchQueue,
        ],
        classes_to_ignore=(
            'IntBoolMap', 'IntDblMap', 'IntFltMap', 'IntIntMap', 'IntPairVec', 'IntSetSet',
            'MeterTypeAccountingInfoVecMap', 'MeterTypeMeterMap', 'MeterTypeStringPair', 'MonsterFleetPlan',
            'PairIntInt_IntMap', 'RuleValueStringStringPair', 'ShipPartMeterMap', 'VisibilityIntMap',
            'AccountingInfoVec', 'IntSet', 'StringSet', 'StringVec',
        ),
        path=".",
    )
Esempio n. 2
0
def inspect_universe_generation():
    """
    Inspect function for universe generation interface.

    We have no way to run it without modifying of game code.

    To generate interface
    put call before return section of universe_generation.universe_generator.create_universe function
    """
    import freeorion as fo
    techs = fo.techs()
    universe = fo.get_universe()
    planet_ids = universe.planetIDs

    system_ids = universe.systemIDs
    system = universe.getSystem(system_ids[0])

    building_ids = universe.buildingIDs
    building = universe.getBuilding(building_ids[0])
    empire_ids = fo.get_all_empires()
    empire = fo.get_empire(empire_ids[0])
    fields_ids = universe.fieldIDs
    field = universe.getField(fields_ids[0])

    fleets_ids = universe.fleetIDs
    fleet = universe.getFleet(fleets_ids[0])
    tech = fo.getTech(techs[0])
    unlocked_items = tech.unlockedItems

    ship = universe.getShip(list(fleet.shipIDs)[0])
    # meter = ship.getMeter(fo.meterType.maxFuel)

    design = ship.design

    universe_object = universe.getObject(universe.systemIDs[0])

    # fo.getHullType ?

    species = None
    special = None
    planets = [universe.getPlanet(pid) for pid in planet_ids]
    for planet in planets:
        species_name = planet.speciesName
        if species_name:
            species = fo.getSpecies(species_name)
        specials = list(planet.specials)
        if specials:
            special = fo.getSpecial(specials[0])

    inspect(
        fo,
        instances=[
            fo.get_galaxy_setup_data(),
            universe,
            planet_ids,
            universe.getPlanet(planet_ids[0]),
            system,
            techs,
            tech,
            tech.unlockedTechs,
            building,
            fo.getBuildingType(building.buildingTypeName),
            empire,
            field,
            fo.getFieldType(field.fieldTypeName),
            fleet,
            ship,
            # meter,
            design,
            fleet.shipIDs,  # int set wtf?
            universe_object,
            system.starlanesWormholes,
            empire.systemSupplyRanges,
            empire.supplyProjections(),
            empire.obstructedStarlanes(),
            empire.planetsWithWastedPP,
            unlocked_items,
            species,
            special
        ],
        classes_to_ignore=(
            'FleetPlan', 'GGColor', 'MonsterFleetPlan', 'PlayerSetupData', 'ShipPartMeterMap', 'ShipSlotVec',
            'VisibilityIntMap', 'diplomaticMessage', 'diplomaticStatusUpdate', 'meter',
        ),
        path=''
    )
    # fo.sys_get_star_type(system),
    # fo.planet_get_size(pid),
    # fo.planet_get_type(planet),
    # fo.species_get_planet_environment(species, planet_type),
    # fo.species_preferred_focus(species),

    # fo.getBuildingType(string)
    # fo.getFieldType(string)
    # fo.getHullType(string)
    # fo.getPartType(string)
    # fo.getShipDesign(number)
    # fo.getSpecial(string)
    # fo.getSpecies(string)
    # fo.getTech(string)
    # fo.getTechCategories(obj)
    # fo.get_empire(number)
    # fo.planet_get_species(number)
    # fo.techsInCategory(string)
    exit(1)
Esempio n. 3
0
def inspect_universe_generation():
    """
    Inspect function for universe generation interface.

    We have no way to run it without modifying of game code.

    To generate interface
    put call before return section of universe_generation.universe_generator.create_universe function
    """
    import freeorion as fo
    techs = fo.techs()
    universe = fo.get_universe()
    planet_ids = universe.planetIDs

    system_ids = universe.systemIDs
    system = universe.getSystem(system_ids[0])

    building_ids = universe.buildingIDs
    building = universe.getBuilding(building_ids[0])
    empire_ids = fo.get_all_empires()
    empire = fo.get_empire(empire_ids[0])
    fields_ids = universe.fieldIDs
    field = universe.getField(fields_ids[0])

    fleets_ids = universe.fleetIDs
    fleet = universe.getFleet(fleets_ids[0])
    tech = fo.getTech(techs[0])
    unlocked_items = tech.unlockedItems

    ship = universe.getShip(list(fleet.shipIDs)[0])
    # meter = ship.getMeter(fo.meterType.maxFuel)

    design = ship.design

    universe_object = universe.getObject(universe.systemIDs[0])

    # fo.getHullType ?

    species = None
    special = None
    planets = [universe.getPlanet(pid) for pid in planet_ids]
    for planet in planets:
        species_name = planet.speciesName
        if species_name:
            species = fo.getSpecies(species_name)
        specials = list(planet.specials)
        if specials:
            special = fo.getSpecial(specials[0])

    inspect(
        fo,
        instances=[
            fo.get_galaxy_setup_data(),
            universe,
            planet_ids,
            universe.getPlanet(planet_ids[0]),
            system,
            techs,
            tech,
            tech.unlockedTechs,
            building,
            fo.getBuildingType(building.buildingTypeName),
            empire,
            field,
            fo.getFieldType(field.fieldTypeName),
            fleet,
            ship,
            # meter,
            design,
            fleet.shipIDs,  # int set wtf?
            universe_object,
            system.starlanesWormholes,
            empire.systemSupplyRanges,
            empire.supplyProjections(),
            empire.obstructedStarlanes(),
            empire.planetsWithWastedPP,
            unlocked_items,
            species,
            special
        ],
        classes_to_ignore=(
            'FleetPlan',
            'GGColor',
            'MonsterFleetPlan',
            'PlayerSetupData',
            'ShipPartMeterMap',
            'ShipSlotVec',
            'VisibilityIntMap',
            'diplomaticMessage',
            'diplomaticStatusUpdate',
            'meter',
        ),
        path='')
    # fo.sys_get_star_type(system),
    # fo.planet_get_size(pid),
    # fo.planet_get_type(planet),
    # fo.species_get_planet_environment(species, planet_type),
    # fo.species_preferred_focus(species),

    # fo.getBuildingType(string)
    # fo.getFieldType(string)
    # fo.getHullType(string)
    # fo.getShipPart(string)
    # fo.getShipDesign(number)
    # fo.getSpecial(string)
    # fo.getSpecies(string)
    # fo.getTech(string)
    # fo.getTechCategories(obj)
    # fo.get_empire(number)
    # fo.planet_get_species(number)
    # fo.techsInCategory(string)
    exit(1)
def inspect_ai_interface():
    capital_id = PlanetUtilsAI.get_capital()
    universe = fo.getUniverse()
    fleets_int_vector = universe.fleetIDs
    fleet = universe.getFleet(list(fleets_int_vector)[0])
    ship = universe.getShip(list(universe.shipIDs)[0])
    design = fo.getShipDesign(ship.designID)
    empire = fo.getEmpire()

    tech = fo.getTech('SHP_WEAPON_2_1')
    tech_spec = list(tech.unlockedItems)[0]

    part_id = list(empire.availableShipParts)[0]
    part_type = fo.getPartType(part_id)

    prod_queue = empire.productionQueue
    fo.issueEnqueueShipProductionOrder(list(empire.availableShipDesigns)[0], capital_id)

    research_queue = empire.researchQueue

    fo.issueEnqueueTechOrder('SHP_WEAPON_1_2', -1)

    planet = universe.getPlanet(capital_id)

    building = list(planet.buildingIDs)[0]

    color = empire.colour

    part_meters = ship.partMeters

    meter = planet.getMeter(fo.meterType.population)

    inspect(
        fo,
        instances=[
            meter,
            part_meters,
            color,
            universe,
            fleet,
            planet,
            universe.getSystem(planet.systemID),
            ship,
            empire,
            design,
            tech,
            tech_spec,
            fo.getFieldType('FLD_ION_STORM'),
            fo.getBuildingType('BLD_SHIPYARD_BASE'),
            fo.getGalaxySetupData(),
            fo.getHullType('SH_XENTRONIUM'),
            fo.getPartType('SR_WEAPON_1_1'),
            fo.getSpecial('MODERATE_TECH_NATIVES_SPECIAL'),
            fo.getSpecies('SP_ABADDONI'),
            fo.getTech('SHP_WEAPON_4_1'),
            fo.diplomaticMessage(1, 2, fo.diplomaticMessageType.acceptPeaceProposal),
            fleets_int_vector,
            part_type,
            prod_queue,
            prod_queue.allocatedPP,
            prod_queue[0],
            research_queue,
            research_queue[0],
            empire.getSitRep(0),
            universe.getBuilding(building)
        ],
        classes_to_ignore=(
            'IntSet', 'StringSet', 'IntIntMap', 'ShipSlotVec', 'VisibilityIntMap', 'IntDblMap',
            'IntBoolMap', 'ItemSpecVec', 'PairIntInt_IntMap', 'IntSetSet', 'StringVec',
            'IntPairVec', 'IntFltMap', 'MeterTypeStringPair', 'MeterTypeMeterMap', 'universeObject',
            # this item cannot be get from generate orders
            'diplomaticStatusUpdate',
        ),
        path='AI'
    )
    exit(1)  # exit game to main menu no need to play anymore.