Beispiel #1
0
    parser.add_argument('--max_invest_count',
                        default=2,
                        type=int,
                        help='Maximum of invest clicks per factory')
    parser.add_argument('--max_invest_costs',
                        default=10000,
                        type=int,
                        help='Maximum costs for an individual invest')
    args = parser.parse_args()

    # let's go
    api = ServerCaller(args.server, args.session_id)
    tracks_graph = track_network(api)

    # factory properties
    factory_properties = api.properties('factories')
    factory_growth_properties = api.properties('factory_growth')
    factories = api.call('LocationInterface',
                         'getAllFactories',
                         short_call=1236)['Body']

    factories = [
        factory for factory in factories if factory['Id'] in tracks_graph.nodes
    ]
    print(f'Connected to {len(factories)} factories')

    # iterate over all connected factories
    for factory in factories:
        print(f"> Opening factory {factory['Id']}, money left: {api.money}")
        if factory['Level'] == 1:
            print(
Beispiel #2
0
                        default='s204.railnation.de',
                        help='The server where the session is active')
    args = parser.parse_args()

    # let's go
    api = ServerCaller(args.server, args.session_id)

    # association analysis
    assoc_info = api.call('CorporationInterface', 'getOtherMemberBuildings',
                          ["00000000-0000-0000-0000-000000000000"])
    # 7: Hotel, 8: Restaurant, 9: Mall
    print(f"Info for {len(assoc_info['Body'])} members")

    buildings = {
        "7":
        api.properties('building_hotel',
                       version='8984d44e15dc4d3481b18a42aa1969e6'),
        "8":
        api.properties('building_restaurant',
                       version='8984d44e15dc4d3481b18a42aa1969e6'),
        "9":
        api.properties('building_mall',
                       version='8984d44e15dc4d3481b18a42aa1969e6'),
    }

    all_balances = [
        int(value['moneyAmount']) for _, value in assoc_info['Body'].items()
    ]
    print(f"Current mean balance of all members: {mean(all_balances):,.0f}")

    member_buildings = defaultdict(lambda: dict())