Beispiel #1
0
                        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(
                'Skipping Level 1 factory'
            )  # because we do not know yet how to detect unrevealed factories yet
            continue
from time import sleep

if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description='Generate prestige overview for association members')
    parser.add_argument('session_id', help='The current PHPSESSID')
    parser.add_argument('--server',
                        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"])
    print(f"Info for {len(assoc_info['Body'])} members")

    # fetch all prestige details
    prestiges = {}
    for user_id, member in tqdm(assoc_info['Body'].items()):
        prestiges[user_id] = {}
        prestiges[user_id]['overview'] = api.call(
            'BudgetInterface', 'getPrestigeHistoryDetails',
            [user_id, 9])['Body']['balance']
        sleep(1)
        prestiges[user_id]['cities'] = api.call(
            'BudgetInterface', 'getPrestigeHistoryDetails',
            [user_id, 9, '0', '1'])['Body']['balance']
        sleep(1)
        prestiges[user_id]['landmarks'] = api.call(
import argparse

from server import ServerCaller

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description='Collect all train spotters')
    parser.add_argument('session_id', help='The current PHPSESSID')
    parser.add_argument('--server',
                        default='s1.railnation.de',
                        help='The server where the session is active')
    args = parser.parse_args()

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

    # train spotters
    spotters = api.call('TrainSpotterInterface',
                        'getWaitingAndCollected',
                        short_call=1236)
    print(
        f'Found {len(spotters["Body"]["Waiting"]["TrainSpotter"])} train spotters'
    )

    collected_spotters = list(
        api.bulk_call('TrainSpotterInterface', 'collect',
                      spotters['Body']['Waiting']['TrainSpotter']))
    print(f'Collected {len(collected_spotters)} train spotters')
Beispiel #4
0
from collections import defaultdict

if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description='Calculate break-even for bonus workers')
    parser.add_argument('session_id', help='The current PHPSESSID')
    parser.add_argument('--server',
                        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'),
    }