Esempio n. 1
0
def inspect_universe_generation_interface(*args, **kwargs):
    import freeorion as fo
    tech = fo.getTech('LRN_NASCENT_AI')
    universe = fo.get_universe()
    empire = fo.get_empire(1)
    rules = fo.getGameRules()
    ship_hull = fo.getShipHull('SH_XENTRONIUM')
    species = fo.getSpecies('SP_ABADDONI')
    generate_stub(
        fo,
        instances=[
            fo.getFieldType('FLD_ION_STORM'),
            fo.getBuildingType('BLD_SHIPYARD_BASE'),
            ship_hull,
            ship_hull.slots,
            fo.getShipPart('SR_WEAPON_1_1'),
            fo.getSpecial('MODERATE_TECH_NATIVES_SPECIAL'),
            species,
            fo.diplomaticMessage(1, 2,
                                 fo.diplomaticMessageType.acceptPeaceProposal),
            rules,
            tech,
            tech.unlockedItems,
            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=".",
        dump=False,
    )
Esempio n. 2
0
def inspect_ai_interface():
    # Put all related imports inside
    import freeOrionAIInterface as fo

    instances = list(get_item_with_location(collect_ai_instances()))

    generate_stub(fo,
                  instances=instances,
                  classes_to_ignore=classes_to_exclude_from_ai,
                  path='AI',
                  dump=False)
    exit(
        1
    )  # exit game to main menu, gameplay may be broken due to invasive instance generation.
def inspect_universe_generation_interface(*args, **kwargs):
    import freeorion as fo
    universe = fo.get_universe()

    # this field should be visible to AI
    empire_of_first_ai = fo.get_empire(2)  # first AI
    fo.create_field_in_system(
        "FLD_NEBULA_1", 100,
        universe.getPlanet(empire_of_first_ai.capitalID).systemID)
    instances = list(get_item_with_location(get_common_instances()))

    generate_stub(
        fo,
        instances=instances,
        classes_to_ignore=classes_to_exclude_from_universe,
        path=".",
        dump=False,
    )
Esempio n. 4
0
def inspect_ai_interface():
    # Put all related imports inside
    import PlanetUtilsAI
    import freeOrionAIInterface as fo

    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]
    ship_part = fo.getShipPart(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)

    generate_stub(
        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.getShipHull('SH_XENTRONIUM'),
            fo.getShipPart('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,
            ship_part,
            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', 'UnlockableItemVec', 'PairIntInt_IntMap', 'IntSetSet', 'StringVec',
            'IntPairVec', 'IntFltMap', 'MeterTypeStringPair', 'MeterTypeMeterMap', 'universeObject',
            # this item cannot be get from generate orders
            'diplomaticStatusUpdate',
        ),
        path='AI',
        dump=False
    )
    exit(1)  # exit game to main menu no need to play anymore.