Exemple #1
0
def start():
    LOG_DEBUG('start')
    if OfflineMode.onStartup():
        LOG_DEBUG('OfflineMode')
        return
    else:
        connectionManager.onConnected += onConnected
        connectionManager.onDisconnected += onDisconnected
        if len(sys.argv) > 2:
            if sys.argv[1] == 'scriptedTest':
                try:
                    scriptName = sys.argv[2]
                    if scriptName[-3:] == '.py':
                        scriptName = scriptName[:-3]
                    try:
                        __import__(scriptName)
                    except ImportError:
                        try:
                            __import__('tests.' + scriptName)
                        except ImportError:
                            __import__('cat.' + scriptName)

                except:
                    LOG_CURRENT_EXCEPTION()
                    BigWorld.wg_writeToStdOut(
                        'Failed to run scripted test, Python exception was thrown, see python.log'
                    )
                    BigWorld.quit()

            elif sys.argv[1] == 'offlineTest':
                try:
                    from cat.tasks.TestArena2 import TestArena2Object
                    LOG_DEBUG(sys.argv)
                    LOG_DEBUG('starting offline test: %s', sys.argv[2])
                    if len(sys.argv) > 3:
                        TestArena2Object.startOffline(sys.argv[2], sys.argv[3])
                    else:
                        TestArena2Object.startOffline(sys.argv[2])
                except:
                    LOG_DEBUG('Game start FAILED with:')
                    LOG_CURRENT_EXCEPTION()

            elif sys.argv[1] == 'spinTest':
                try:
                    from cat.tasks.TestArena2 import TestArena2Object
                    LOG_DEBUG(sys.argv)
                    targetDirectory = sys.argv[4] if len(
                        sys.argv) > 4 else 'SpinTestResult'
                    LOG_DEBUG('starting offline test: %s %s %s', sys.argv[2],
                              sys.argv[3], targetDirectory)
                    TestArena2Object.startOffline(
                        sys.argv[2],
                        mapName=sys.argv[3],
                        targetDirectory=targetDirectory)
                except:
                    LOG_DEBUG('Game start FAILED with:')
                    LOG_CURRENT_EXCEPTION()

            elif sys.argv[1] == 'hangarOverride':
                try:
                    LOG_DEBUG(sys.argv)
                    from tests.auto.HangarOverride import HangarOverride
                    HangarOverride.setHangar('spaces/' + sys.argv[2])
                except:
                    LOG_DEBUG('Game start FAILED with:')
                    LOG_CURRENT_EXCEPTION()

                gui_personality.start()
            elif sys.argv[1] == 'replayTimeout':
                try:
                    g_replayCtrl.replayTimeout = float(sys.argv[2])
                except:
                    LOG_DEBUG('Game start FAILED with:')
                    LOG_CURRENT_EXCEPTION()

                gui_personality.start()
            elif sys.argv[1] == 'botInit' or sys.argv[1] == 'botExecute':
                gui_personality.start()
                try:
                    LOG_DEBUG(
                        'BOTNET: Playing scenario "%s" with bot "%s"...' %
                        (sys.argv[2], sys.argv[3]))
                    if sys.argv[1] == 'botInit':
                        scenarioPlayer().initBot(sys.argv[3], sys.argv[2])
                    elif sys.argv[1] == 'botExecute':
                        scenarioPlayer().execute(sys.argv[3], sys.argv[2])
                except:
                    LOG_DEBUG('BOTNET: Failed to start the client with:')
                    LOG_CURRENT_EXCEPTION()

            else:
                gui_personality.start()
        else:
            gui_personality.start()
        try:
            import Vibroeffects
            Vibroeffects.VibroManager.g_instance.start()
        except:
            LOG_CURRENT_EXCEPTION()

        try:
            from LightFx import LightManager
            if LightManager.g_instance is not None:
                LightManager.g_instance.start()
            from AuxiliaryFx import g_instance
            if g_instance is not None:
                g_instance.start()
        except:
            LOG_CURRENT_EXCEPTION()

        return
Exemple #2
0
def start():
    LOG_DEBUG('start')
    connectionManager.onConnected += onConnected
    connectionManager.onDisconnected += onDisconnected
    if len(sys.argv) > 2:
        if sys.argv[1] == 'scriptedTest':
            try:
                scriptName = sys.argv[2]
                if scriptName[-3:] == '.py':
                    scriptName = scriptName[:-3]
                try:
                    __import__(scriptName)
                except ImportError:
                    try:
                        __import__('tests.' + scriptName)
                    except ImportError:
                        __import__('cat.' + scriptName)

            except:
                LOG_CURRENT_EXCEPTION()
                BigWorld.wg_writeToStdOut('Failed to run scripted test, Python exception was thrown, see python.log')
                BigWorld.quit()

        elif sys.argv[1] == 'offlineTest':
            try:
                from cat.tasks.TestArena2 import TestArena2Object
                LOG_DEBUG(sys.argv)
                LOG_DEBUG('starting offline test: %s', sys.argv[2])
                if len(sys.argv) > 3:
                    TestArena2Object.startOffline(sys.argv[2], sys.argv[3])
                else:
                    TestArena2Object.startOffline(sys.argv[2])
            except:
                LOG_DEBUG('Game start FAILED with:')
                LOG_CURRENT_EXCEPTION()

        elif sys.argv[1] == 'validationTest':
            try:
                gui_personality.start()
                LOG_DEBUG('starting validationTest')
                import Cat
                Cat.Tasks.Validation.ParamsObject.setResultFileName(sys.argv[2])
                BigWorld.callback(10, Cat.Tasks.Validation.startAllValidationTests)
            except:
                LOG_DEBUG('Game start FAILED with:')
                LOG_CURRENT_EXCEPTION()

        elif sys.argv[1] == 'resourcesValidationTest':
            try:
                gui_personality.start()
                LOG_DEBUG('starting resourcesValidationTest')
                import Cat
                Cat.Tasks.Validation.ParamsObject.setResultFileName(sys.argv[2])
                BigWorld.callback(10, Cat.Tasks.Validation.startResourcesValidationTest)
            except:
                LOG_DEBUG('Game start FAILED with:')
                LOG_CURRENT_EXCEPTION()

        elif sys.argv[1] == 'replayTimeout':
            try:
                g_replayCtrl.replayTimeout = float(sys.argv[2])
            except:
                LOG_DEBUG('Game start FAILED with:')
                LOG_CURRENT_EXCEPTION()

            gui_personality.start()
    else:
        gui_personality.start()
    try:
        import Vibroeffects
        Vibroeffects.VibroManager.g_instance.start()
    except:
        LOG_CURRENT_EXCEPTION()

    try:
        import LightFx
        if LightFx.LightManager.g_instance is not None:
            LightFx.LightManager.g_instance.start()
        import AuxiliaryFx
        AuxiliaryFx.g_instance.start()
    except:
        LOG_CURRENT_EXCEPTION()
Exemple #3
0
def start():
    LOG_DEBUG('start')
    connectionManager.onConnected += onConnected
    connectionManager.onDisconnected += onDisconnected
    if len(sys.argv) > 2:
        if sys.argv[1] == 'scriptedTest':
            try:
                scriptName = sys.argv[2]
                if scriptName[-3:] == '.py':
                    scriptName = scriptName[:-3]
                try:
                    __import__(scriptName)
                except ImportError:
                    __import__('cat.' + scriptName)

            except:
                LOG_CURRENT_EXCEPTION()
                BigWorld.wg_writeToStdOut(
                    'Failed to run scripted test, Python exception was thrown, see python.log'
                )
                BigWorld.quit()

        elif sys.argv[1] == 'offlineTest':
            try:
                from cat.tasks.TestArena2 import TestArena2Object
                LOG_DEBUG(sys.argv)
                LOG_DEBUG('starting offline test: %s', sys.argv[2])
                if len(sys.argv) > 3:
                    TestArena2Object.startOffline(sys.argv[2], sys.argv[3])
                else:
                    TestArena2Object.startOffline(sys.argv[2])
            except:
                LOG_DEBUG('Game start FAILED with:')
                LOG_CURRENT_EXCEPTION()

        elif sys.argv[1] == 'validationTest':
            try:
                gui_personality.start()
                LOG_DEBUG('starting validationTest')
                import Cat
                Cat.Tasks.Validation.ParamsObject.setResultFileName(
                    sys.argv[2])
                BigWorld.callback(10,
                                  Cat.Tasks.Validation.startAllValidationTests)
            except:
                LOG_DEBUG('Game start FAILED with:')
                LOG_CURRENT_EXCEPTION()

        elif sys.argv[1] == 'resourcesValidationTest':
            try:
                gui_personality.start()
                LOG_DEBUG('starting resourcesValidationTest')
                import Cat
                Cat.Tasks.Validation.ParamsObject.setResultFileName(
                    sys.argv[2])
                BigWorld.callback(
                    10, Cat.Tasks.Validation.startResourcesValidationTest)
            except:
                LOG_DEBUG('Game start FAILED with:')
                LOG_CURRENT_EXCEPTION()

    else:
        gui_personality.start()
    try:
        import Vibroeffects
        Vibroeffects.VibroManager.g_instance.start()
    except:
        LOG_CURRENT_EXCEPTION()

    try:
        import LightFx
        LightFx.LightManager.g_instance.start()
        import AuxiliaryFx
        AuxiliaryFx.g_instance.start()
    except:
        LOG_CURRENT_EXCEPTION()
Exemple #4
0
def start():
    LOG_DEBUG('start')
    if OfflineMode.onStartup():
        LOG_DEBUG('OfflineMode')
        return
    else:
        connectionManager.onConnected += onConnected
        connectionManager.onDisconnected += onDisconnected
        if len(sys.argv) > 2:
            if sys.argv[1] == 'scriptedTest':
                try:
                    scriptName = sys.argv[2]
                    if scriptName[-3:] == '.py':
                        scriptName = scriptName[:-3]
                    try:
                        __import__(scriptName)
                    except ImportError:
                        try:
                            __import__('tests.' + scriptName)
                        except ImportError:
                            __import__('cat.' + scriptName)

                except:
                    LOG_CURRENT_EXCEPTION()
                    BigWorld.wg_writeToStdOut('Failed to run scripted test, Python exception was thrown, see python.log')
                    BigWorld.quit()

            elif sys.argv[1] == 'offlineTest':
                try:
                    from cat.tasks.TestArena2 import TestArena2Object
                    LOG_DEBUG(sys.argv)
                    LOG_DEBUG('starting offline test: %s', sys.argv[2])
                    if len(sys.argv) > 3:
                        TestArena2Object.startOffline(sys.argv[2], sys.argv[3])
                    else:
                        TestArena2Object.startOffline(sys.argv[2])
                except:
                    LOG_DEBUG('Game start FAILED with:')
                    LOG_CURRENT_EXCEPTION()

            elif sys.argv[1] == 'spinTest':
                try:
                    from cat.tasks.TestArena2 import TestArena2Object
                    LOG_DEBUG(sys.argv)
                    targetDirectory = sys.argv[4] if len(sys.argv) > 4 else 'SpinTestResult'
                    LOG_DEBUG('starting offline test: %s %s %s', sys.argv[2], sys.argv[3], targetDirectory)
                    TestArena2Object.startOffline(sys.argv[2], mapName=sys.argv[3], targetDirectory=targetDirectory)
                except:
                    LOG_DEBUG('Game start FAILED with:')
                    LOG_CURRENT_EXCEPTION()

            elif sys.argv[1] == 'validationTest':
                try:
                    gui_personality.start()
                    LOG_DEBUG('starting validationTest')
                    import Cat
                    Cat.Tasks.Validation.ParamsObject.setResultFileName(sys.argv[2])
                    BigWorld.callback(10, Cat.Tasks.Validation.startAllValidationTests)
                except:
                    LOG_DEBUG('Game start FAILED with:')
                    LOG_CURRENT_EXCEPTION()

            elif sys.argv[1] == 'resourcesValidationTest':
                try:
                    gui_personality.start()
                    LOG_DEBUG('starting resourcesValidationTest')
                    import Cat
                    Cat.Tasks.Validation.ParamsObject.setResultFileName(sys.argv[2])
                    BigWorld.callback(10, Cat.Tasks.Validation.startResourcesValidationTest)
                except:
                    LOG_DEBUG('Game start FAILED with:')
                    LOG_CURRENT_EXCEPTION()

            elif sys.argv[1] == 'replayTimeout':
                try:
                    g_replayCtrl.replayTimeout = float(sys.argv[2])
                except:
                    LOG_DEBUG('Game start FAILED with:')
                    LOG_CURRENT_EXCEPTION()

                gui_personality.start()
            elif sys.argv[1] == 'botInit' or sys.argv[1] == 'botExecute':
                gui_personality.start()
                try:
                    LOG_DEBUG('BOTNET: Playing scenario "%s" with bot "%s"...' % (sys.argv[2], sys.argv[3]))
                    if sys.argv[1] == 'botInit':
                        scenarioPlayer().initBot(sys.argv[3], sys.argv[2])
                    elif sys.argv[1] == 'botExecute':
                        scenarioPlayer().execute(sys.argv[3], sys.argv[2])
                except:
                    LOG_DEBUG('BOTNET: Failed to start the client with:')
                    LOG_CURRENT_EXCEPTION()

            else:
                gui_personality.start()
        else:
            gui_personality.start()
        try:
            import Vibroeffects
            Vibroeffects.VibroManager.g_instance.start()
        except:
            LOG_CURRENT_EXCEPTION()

        try:
            from LightFx import LightManager
            if LightManager.g_instance is not None:
                LightManager.g_instance.start()
            from AuxiliaryFx import g_instance
            if g_instance is not None:
                g_instance.start()
        except:
            LOG_CURRENT_EXCEPTION()

        return
Exemple #5
0
def start():
    LOG_DEBUG('start')
    if OfflineMode.onStartup():
        LOG_DEBUG('OfflineMode')
        return
    connectionManager.onConnected += onConnected
    connectionManager.onDisconnected += onDisconnected
    if len(sys.argv) > 2:
        if sys.argv[1] == 'scriptedTest':
            try:
                scriptName = sys.argv[2]
                if scriptName[-3:] == '.py':
                    scriptName = scriptName[:-3]
                try:
                    __import__(scriptName)
                except ImportError:
                    try:
                        __import__('tests.' + scriptName)
                    except ImportError:
                        __import__('cat.' + scriptName)

            except:
                LOG_CURRENT_EXCEPTION()
                BigWorld.wg_writeToStdOut('Failed to run scripted test, Python exception was thrown, see python.log')
                BigWorld.quit()

        elif sys.argv[1] == 'offlineTest':
            try:
                from cat.tasks.TestArena2 import TestArena2Object
                LOG_DEBUG(sys.argv)
                LOG_DEBUG('starting offline test: %s', sys.argv[2])
                if len(sys.argv) > 3:
                    TestArena2Object.startOffline(sys.argv[2], sys.argv[3])
                else:
                    TestArena2Object.startOffline(sys.argv[2])
            except:
                LOG_DEBUG('Game start FAILED with:')
                LOG_CURRENT_EXCEPTION()

        elif sys.argv[1] == 'validationTest':
            try:
                gui_personality.start()
                LOG_DEBUG('starting validationTest')
                import Cat
                Cat.Tasks.Validation.ParamsObject.setResultFileName(sys.argv[2])
                BigWorld.callback(10, Cat.Tasks.Validation.startAllValidationTests)
            except:
                LOG_DEBUG('Game start FAILED with:')
                LOG_CURRENT_EXCEPTION()

        elif sys.argv[1] == 'resourcesValidationTest':
            try:
                gui_personality.start()
                LOG_DEBUG('starting resourcesValidationTest')
                import Cat
                Cat.Tasks.Validation.ParamsObject.setResultFileName(sys.argv[2])
                BigWorld.callback(10, Cat.Tasks.Validation.startResourcesValidationTest)
            except:
                LOG_DEBUG('Game start FAILED with:')
                LOG_CURRENT_EXCEPTION()

        elif sys.argv[1] == 'replayTimeout':
            try:
                g_replayCtrl.replayTimeout = float(sys.argv[2])
            except:
                LOG_DEBUG('Game start FAILED with:')
                LOG_CURRENT_EXCEPTION()

            gui_personality.start()
        elif sys.argv[1] == 'bot':
            gui_personality.start()
            try:
                LOG_DEBUG('BOTNET: Playing scenario "%s" with bot "%s"...' % (sys.argv[2], sys.argv[3]))
                sys.path.append('scripts/bot')
                from client.ScenarioPlayer import ScenarioPlayerObject
                ScenarioPlayerObject.play(sys.argv[2], sys.argv[3])
            except:
                LOG_DEBUG('BOTNET: Failed to start the client with:')
                LOG_CURRENT_EXCEPTION()

        else:
            gui_personality.start()
    else:
        gui_personality.start()
    try:
        import Vibroeffects
        Vibroeffects.VibroManager.g_instance.start()
    except:
        LOG_CURRENT_EXCEPTION()

    try:
        import LightFx
        if LightFx.LightManager.g_instance is not None:
            LightFx.LightManager.g_instance.start()
        import AuxiliaryFx
        AuxiliaryFx.g_instance.start()
    except:
        LOG_CURRENT_EXCEPTION()