Beispiel #1
0
def main(argv):
    """
        MAIN
    """
    MOO2_DIR = find_moo2_dir()

    if not MOO2_DIR:
        print("")
        print("ERROR: no MOO2 directory found")
        print("    OpenMOO2 requires original Master of Orion 2 game data to run, see README.TXT for more information")
        print("")
        sys.exit(1)

    default_options = {
        '-h':       "localhost",
        '-p':       9999,
        '-player':  0
    }

    (OPTIONS, PARAMS) = Game_Args.parse_cli_args(argv, default_options)

    HOST               = OPTIONS['-h']
    PORT               = OPTIONS['-p']
    PLAYER_ID          = OPTIONS['-player']
    SOCKET_BUFFER_SIZE = 4096

    GUI.init(MOO2_DIR)

    pygame.mouse.set_visible(False)
    pygame.display.set_caption("OpenMOO2: PLAYER_ID = %s" % PLAYER_ID)

    Data_BUILDINGS.regularize_building_keys()
    Data_CONST.regularize_government_keys()
    Data_TECH.regularize_tech_keys()

    Network_Client.Client.connect(HOST, PORT, SOCKET_BUFFER_SIZE)
    Network_Client.Client.login(PLAYER_ID)

#    Network_Client.Client.ping()
#    server_status = Network_Client.Client.get_server_status()
#    print("# server_status = %s" % str(server_status))


    # automation for development
#    scenario = autoplayer.AutoPlayer(CLIENT)
#    scenario.play()
#    sys.exit(0)

    #JWL#ICON = pygame.image.load(MOO2_DIR + "/orion2-icon.png")
    #JWL#pygame.display.set_icon(ICON)

    Gui.GUI.run()

    Network_Client.Client.disconnect()
Beispiel #2
0
def main(argv):
    """
        MAIN
    """
    MOO2_DIR = find_moo2_dir()

    if not MOO2_DIR:
        print("")
        print("ERROR: no MOO2 directory found")
        print(
            "    OpenMOO2 requires original Master of Orion 2 game data to run, see README.TXT for more information"
        )
        print("")
        sys.exit(1)

    default_options = {'-h': "localhost", '-p': 9999, '-player': 0}

    (OPTIONS, PARAMS) = Game_Args.parse_cli_args(argv, default_options)

    HOST = OPTIONS['-h']
    PORT = OPTIONS['-p']
    PLAYER_ID = OPTIONS['-player']
    SOCKET_BUFFER_SIZE = 4096

    GUI.init(MOO2_DIR)

    pygame.mouse.set_visible(False)
    pygame.display.set_caption("OpenMOO2: PLAYER_ID = %s" % PLAYER_ID)

    Network_Client.Client.connect(HOST, PORT, SOCKET_BUFFER_SIZE)
    Network_Client.Client.login(PLAYER_ID)

    #    Network_Client.Client.ping()
    #    server_status = Network_Client.Client.get_server_status()
    #    print("# server_status = %s" % str(server_status))

    # automation for development
    #    scenario = autoplayer.AutoPlayer(CLIENT)
    #    scenario.play()
    #    sys.exit(0)

    #JWL#ICON = pygame.image.load(MOO2_DIR + "/orion2-icon.png")
    #JWL#pygame.display.set_icon(ICON)

    Gui.GUI.run()

    Network_Client.Client.disconnect()
def main(argv):
    default_options = {
        '-g':   "SAVE1.GAM",
        '-h':	"localhost",
        '-p':	9999,
    }

    (OPTIONS, PARAMS) = Game_Args.parse_cli_args(argv, default_options)

    LISTEN_ADDR = OPTIONS['-h']
    LISTEN_PORT = OPTIONS['-p']
    GAME_FILE	= OPTIONS['-g']

    if GAME_FILE == '':
        show_usage(argv[0], "ERROR: Missing game file to load")
        sys.exit(1)

    print("* Init...")
    GAME = Game_Main.Game_Main(Game_Rules.DEFAULT_RULES)

    moo2_dir = openmoo2.find_moo2_dir()
    if moo2_dir is None:
        print "Error: MOO2 Game directory not found in ../, ../../ or ../../../"
        sys.exit(1)

    print("* Loading savegame from '%s/%s'" % (moo2_dir, GAME_FILE))

    Data_BUILDINGS.regularize_building_keys()
    Data_CONST.regularize_government_keys()
    Data_TECH.regularize_tech_keys()

    GAME.load_moo2_savegame(moo2_dir + "/" + GAME_FILE)
    GAME.show_stars()
    GAME.show_planets()
    GAME.show_players()
    GAME.show_colonies()
    GAME.show_ships()

    SERVER = Network_Server.Network_Server(LISTEN_ADDR, LISTEN_PORT, GAME)
    SERVER.s_name = GAME_FILE.split("/")[-1]

    print("* Run...")
    SERVER.run()

    print("* Exit...")
    sys.exit(0)
def main(argv):
    default_options = {
        '-g': "SAVE1.GAM",
        '-h': "localhost",
        '-p': 9999,
    }

    (OPTIONS, PARAMS) = Game_Args.parse_cli_args(argv, default_options)

    LISTEN_ADDR = OPTIONS['-h']
    LISTEN_PORT = OPTIONS['-p']
    GAME_FILE = OPTIONS['-g']

    if GAME_FILE == '':
        show_usage(argv[0], "ERROR: Missing game file to load")
        sys.exit(1)

    print("* Init...")
    GAME = Game_Main.Game_Main(Game_Rules.DEFAULT_RULES)

    moo2_dir = openmoo2.find_moo2_dir()
    if moo2_dir is None:
        print "Error: MOO2 Game directory not found in ../, ../../ or ../../../"
        sys.exit(1)

    print("* Loading savegame from '%s/%s'" % (moo2_dir, GAME_FILE))
    GAME.load_moo2_savegame(moo2_dir + "/" + GAME_FILE)
    GAME.show_stars()
    GAME.show_planets()
    GAME.show_players()
    GAME.show_colonies()
    GAME.show_ships()

    SERVER = Network_Server.Network_Server(LISTEN_ADDR, LISTEN_PORT, GAME)
    SERVER.s_name = GAME_FILE.split("/")[-1]

    print("* Run...")
    SERVER.run()

    print("* Exit...")
    sys.exit(0)