Beispiel #1
0
def cache():
    if not iv.g_cache:
        with VsePaths():
            from items import init
            init(False, None)
            from items.vehicles import init
            init(False, None)
    return iv.g_cache
Beispiel #2
0
def init(scriptConfig, engineConfig, userPreferences, loadingScreenGUI = None):
    global g_replayCtrl
    try:
        if constants.IS_DEVELOPMENT:
            autoFlushPythonLog()
        LOG_DEBUG('init')
        BigWorld.wg_initCustomSettings()
        Settings.g_instance = Settings.Settings(scriptConfig, engineConfig, userPreferences)
        CommandMapping.g_instance = CommandMapping.CommandMapping()
        from helpers import DecalMap
        DecalMap.g_instance = DecalMap.DecalMap(scriptConfig['decal'])
        from helpers import EdgeDetectColorController
        EdgeDetectColorController.g_instance = EdgeDetectColorController.EdgeDetectColorController(scriptConfig['silhouetteColors'])
        import SoundGroups
        SoundGroups.g_instance = SoundGroups.SoundGroups()
        import BattleReplay
        g_replayCtrl = BattleReplay.g_replayCtrl = BattleReplay.BattleReplay()
        g_replayCtrl.registerWotReplayFileExtension()
        try:
            import Vibroeffects
            Vibroeffects.VibroManager.g_instance = Vibroeffects.VibroManager.VibroManager()
            Vibroeffects.VibroManager.g_instance.connect()
        except:
            LOG_CURRENT_EXCEPTION()

        tutorialLoaderInit()
        BigWorld.callback(0.1, asyncore_call)
        MessengerEntry.g_instance.init()
        import items
        items.init(True, None if not constants.IS_DEVELOPMENT else {})
        import ArenaType
        ArenaType.init()
        import dossiers1
        dossiers1.init()
        import dossiers2
        dossiers2.init()
        BigWorld.worldDrawEnabled(False)
        import LcdKeyboard
        LcdKeyboard.enableLcdKeyboardSpecificKeys(True)
        gui_personality.init(loadingScreenGUI=loadingScreenGUI)
        AreaDestructibles.init()
        MusicController.init()
        TriggersManager.init()
        RSSDownloader.init()
        g_postProcessing.init()
        try:
            from LightFx import LightManager
            LightManager.g_instance = LightManager.LightManager()
            import AuxiliaryFx
            AuxiliaryFx.g_instance = AuxiliaryFx.AuxiliaryFxManager()
        except:
            LOG_CURRENT_EXCEPTION()

    except Exception:
        LOG_CURRENT_EXCEPTION()
        BigWorld.quit()

    return
Beispiel #3
0
 def __init__(self):
     self.basedir = os.path.dirname(sys.modules[self.__module__].__file__)
     self.open_save_game()
     items.init(self.basedir)
     self.name = "Renegade game"
     self.save_data = SaveGameObject()
     self.save_data.map = None
     try:
       self.load()
     except:
       self.new_game()
       self.save()
     self.hud = hud.HUD(self.save_data.hero)
     #self.fps = dialog.FpsDialog()
     core.display.set_caption(self.name)
     self.impending_actions = []
     self.inventory_screen = InventoryScreen()
 def __init__(self):
     self.basedir = os.path.dirname(sys.modules[self.__module__].__file__)
     self.open_save_game()
     items.init(self.basedir)
     self.name = "Renegade game"
     self.save_data = SaveGameObject()
     self.save_data.map = None
     try:
         self.load()
     except:
         self.new_game()
         self.save()
     self.hud = hud.HUD(self.save_data.hero)
     #self.fps = dialog.FpsDialog()
     core.display.set_caption(self.name)
     self.impending_actions = []
     self.inventory_screen = InventoryScreen()
Beispiel #5
0
def game_loading():
    logger.addLog("Starting game loading!", logger.loglevel["debug"])
    # Start loading, dispatch events when aspect of loading completed

    logger.addLog("Init items", logger.loglevel["debug"])
    # check to see if all item packs are in item pack db, and if all item xml is without error
    # add item packs and individual items to multidimensional array
    import items
    items.init()

    logger.addLog("Init levels", logger.loglevel["debug"])
    # check to see if all levels are in level db, otherwise raise warning, and do not load
    # Render level thumbnails, and put them as sprite objects into array
    import levels
    levels.init()

    logger.addLog("Init game modes", logger.loglevel["debug"])
    # check to see if all game modes exist in game mode db
    # render game mode metadata and add to multidimensional array dict
    import modes
    modes.init()

    events.mainmenuevents.onProgressFinished()
Beispiel #6
0
 def __init__(self):
     super().__init__()
     self.setupUi(self)
     if getattr(sys, 'frozen', False):
         self.currentItemsPath = sys._MEIPASS + "/" + self.currentItemsPath
         self.currentSchemaPath = sys._MEIPASS + "/" + self.currentSchemaPath
         self.itemsRoot = self.currentItemsPath
         self.schemasRoot = self.currentSchemaPath
         self.procPath = sys._MEIPASS + "/Processes"
         self.iconsPath = sys._MEIPASS + "/Icons"
     self.itemRoot=items.init(self.currentItemsPath)
     self.procRoot=processes.init(self.procPath, self.itemRoot)
     self.char = chars.init()
     self.system = systems.init()
     self.facility = facilities.init()
     self.setWindowTitle("Production planner  v"+version)
     self.buttonBack.clicked.connect(self.buttonBackClick)
     self.buttonAdd.clicked.connect(self.buttonAddClick)
     self.buttonAddDir.clicked.connect(self.buttonAddDirClick)
 
     self.mainFieldWidget = TabPlusWidget(parent=self)
     self.mainFieldWidget.setDocumentMode(True)
     self.mainFieldWidget.setObjectName("mainFieldWidget")
     self.horizontalLayout.addWidget(self.mainFieldWidget)
     
     self.buttonBack.setText("")
     self.buttonAdd.setText("")
     self.buttonAddDir.setText("")
     self.buttonBack.setIcon(QtGui.QIcon(QtGui.QPixmap(self.iconsPath+'/back.png')))
     self.buttonAdd.setIcon(QtGui.QIcon(QtGui.QPixmap(self.iconsPath+'/newFile.png')))
     self.buttonAddDir.setIcon(QtGui.QIcon(QtGui.QPixmap(self.iconsPath+'/newFolder.png')))
 
     tab = self.fillTabEmpty()
     self.mainFieldWidget.addTab(tab, "Empty")
 
     self.mainFieldWidget.plusClicked.connect(self.addTab)
Beispiel #7
0
def init(scriptConfig, engineConfig, userPreferences, loadingScreenGUI=None):
    global g_replayCtrl
    try:
        if constants.IS_DEVELOPMENT:
            autoFlushPythonLog()
        BigWorld.wg_initCustomSettings()
        g_postProcessing.init()
        Settings.g_instance = Settings.Settings(scriptConfig, engineConfig,
                                                userPreferences)
        CommandMapping.g_instance = CommandMapping.CommandMapping()
        from helpers import DecalMap
        DecalMap.g_instance = DecalMap.DecalMap(scriptConfig['decal'])
        from helpers import EdgeDetectColorController
        EdgeDetectColorController.g_instance = EdgeDetectColorController.EdgeDetectColorController(
            scriptConfig['silhouetteColors'])
        import SoundGroups
        SoundGroups.g_instance = SoundGroups.SoundGroups()
        import BattleReplay
        g_replayCtrl = BattleReplay.g_replayCtrl = BattleReplay.BattleReplay()
        g_replayCtrl.registerWotReplayFileExtension()
        try:
            from Vibroeffects import VibroManager
            VibroManager.g_instance = VibroManager.VibroManager()
            VibroManager.g_instance.connect()
        except:
            LOG_CURRENT_EXCEPTION()

        tutorialLoaderInit()
        BigWorld.callback(0.1, asyncore_call)
        import items
        items.init(True, None if not constants.IS_DEVELOPMENT else {})
        import win_points
        win_points.init()
        import rage
        rage.init()
        import ArenaType
        ArenaType.init()
        import dossiers2
        dossiers2.init()
        import fortified_regions
        fortified_regions.init()
        import clubs_settings
        clubs_settings.init()
        import potapov_quests
        potapov_quests.init()
        import clubs_quests
        clubs_quests.init()
        import motivation_quests
        motivation_quests.init()
        BigWorld.worldDrawEnabled(False)
        import LcdKeyboard
        LcdKeyboard.enableLcdKeyboardSpecificKeys(True)
        dependency.configure(services_config.getClientServicesConfig)
        gui_personality.init(loadingScreenGUI=loadingScreenGUI)
        EdgeDetectColorController.g_instance.create()
        g_replayCtrl.subscribe()
        MessengerEntry.g_instance.init()
        AreaDestructibles.init()
        MusicControllerWWISE.create()
        TriggersManager.init()
        RSSDownloader.init()
        SoundGroups.loadLightSoundsDB()
        try:
            from LightFx import LightManager
            LightManager.g_instance = LightManager.LightManager()
            import AuxiliaryFx
            AuxiliaryFx.g_instance = AuxiliaryFx.AuxiliaryFxManager()
        except:
            LOG_CURRENT_EXCEPTION()

        from AvatarInputHandler.cameras import FovExtended
        FovExtended.instance().resetFov()
        BigWorld.pauseDRRAutoscaling(True)
    except Exception:
        LOG_CURRENT_EXCEPTION()
        BigWorld.quit()

    return
Beispiel #8
0
def getOfflineShop():
    shopItems = {}
    items.init(True, shopItems)
    return {
        'crystalExchangeRate':
        200,
        'camouflageCost': {
            0: (250, True),
            30: (100000, False),
            7: (25000, False)
        },
        'goodies': {
            'prices': {},
            'notInShop': set([]),
            'goodies': {}
        },
        'berthsPrices': (16, 16, [300]),
        'femalePassportChangeCost':
        50,
        'freeXPConversion': (100000, 0.1),
        'dropSkillsCost': {
            0: {
                'xpReuseFraction': 0.5,
                'gold': 0,
                'credits': 0
            },
            1: {
                'xpReuseFraction': 0.75,
                'gold': 0,
                'credits': 20000
            },
            2: {
                'xpReuseFraction': 1.0,
                'gold': 10,
                'credits': 1000
            }
        },
        'refSystem': {
            'maxNumberOfReferrals': 50,
            'posByXPinTeam': 10,
            'maxReferralXPPool': 350000,
            'periods': [(24, 3.0), (168, 2.0), (876000, 1.5)]
        },
        'playerEmblemCost': {
            0: (15, True),
            30: (6000, False),
            7: (1500, False)
        },
        'premiumCost': {
            1: 1,  #250
            3: 1,  #650
            7: 1,  #1250
            360: 1,  #24000
            180: 1,  #13500
            30: 1  #2500
        },
        'winXPFactorMode':
        0,
        'sellPriceModif':
        0.75,
        'passportChangeCost':
        50,
        'exchangeRateForShellsAndEqs':
        400,
        'exchangeRate':
        400,
        'tankmanCost': ({
            'isPremium': False,
            'baseRoleLoss': 0.20000000298023224,
            'gold': 0,
            'credits': 0,
            'classChangeRoleLoss': 0.20000000298023224,
            'roleLevel': 50
        }, {
            'isPremium': False,
            'baseRoleLoss': 0.10000000149011612,
            'gold': 0,
            'credits': 20000,
            'classChangeRoleLoss': 0.10000000149011612,
            'roleLevel': 75
        }, {
            'isPremium': True,
            'baseRoleLoss': 0.0,
            'gold': 200,
            'credits': 0,
            'classChangeRoleLoss': 0.0,
            'roleLevel': 100
        }),
        'paidRemovalCost':
        0,
        'dailyXPFactor':
        100,
        'changeRoleCost':
        500,
        'isEnabledBuyingGoldShellsForCredits':
        False,
        'items':
        shopItems,
        'slotsPrices': (9, [1]),
        'freeXPToTManXPRate':
        10,
        'defaults': {
            'items': {},
            'freeXPToTManXPRate': 0,
            'goodies': {
                'prices': {}
            }
        },
        'sellPriceFactor':
        0.5,
        'isEnabledBuyingGoldEqsForCredits':
        False,
        'playerInscriptionCost': {
            0: (15, True),
            7: (1500, False),
            30: (6000, False),
            'nations': {}
        }
    }
Beispiel #9
0
def init(scriptConfig, engineConfig, userPreferences, loadingScreenGUI=None):
    global g_replayCtrl
    global g_onBeforeSendEvent
    try:
        log.config.setupFromXML()
        if constants.IS_DEVELOPMENT:
            autoFlushPythonLog()
            from development_features import initDevBonusTypes
            initDevBonusTypes()
        import Event
        g_onBeforeSendEvent = Event.Event()
        BigWorld.wg_initCustomSettings()
        Settings.g_instance = Settings.Settings(scriptConfig, engineConfig, userPreferences)
        CommandMapping.g_instance = CommandMapping.CommandMapping()
        from helpers import DecalMap
        DecalMap.g_instance = DecalMap.DecalMap(scriptConfig['decal'])
        from helpers import EdgeDetectColorController
        EdgeDetectColorController.g_instance = EdgeDetectColorController.EdgeDetectColorController(scriptConfig['silhouetteColors'])
        SoundGroups.g_instance = SoundGroups.SoundGroups()
        import BattleReplay
        g_replayCtrl = BattleReplay.g_replayCtrl = BattleReplay.BattleReplay()
        g_replayCtrl.registerWotReplayFileExtension()
        g_bootcamp.replayCallbackSubscribe()
        try:
            from Vibroeffects import VibroManager
            VibroManager.g_instance = VibroManager.VibroManager()
            VibroManager.g_instance.connect()
        except Exception:
            LOG_CURRENT_EXCEPTION()

        tutorialLoaderInit()
        BigWorld.callback(0.1, asyncore_call)
        import items
        items.init(True, None if not constants.IS_DEVELOPMENT else {})
        import win_points
        win_points.init()
        import rage
        rage.init()
        import ArenaType
        ArenaType.init()
        import dossiers2
        dossiers2.init()
        import personal_missions
        personal_missions.init()
        import motivation_quests
        motivation_quests.init()
        BigWorld.worldDrawEnabled(False)
        dependency.configure(services_config.getClientServicesConfig)
        gui_personality.init(loadingScreenGUI=loadingScreenGUI)
        EdgeDetectColorController.g_instance.create()
        g_replayCtrl.subscribe()
        MessengerEntry.g_instance.init()
        AreaDestructibles.init()
        MusicControllerWWISE.create()
        TriggersManager.init()
        RSSDownloader.init()
        items.clearXMLCache()
        SoundGroups.loadLightSoundsDB()
        import player_ranks
        player_ranks.init()
        import destructible_entities
        destructible_entities.init()
        try:
            from LightFx import LightManager
            LightManager.g_instance = LightManager.LightManager()
            import AuxiliaryFx
            AuxiliaryFx.g_instance = AuxiliaryFx.AuxiliaryFxManager()
        except Exception:
            LOG_CURRENT_EXCEPTION()

        from AvatarInputHandler.cameras import FovExtended
        FovExtended.instance().resetFov()
        BigWorld.pauseDRRAutoscaling(True)
    except Exception:
        LOG_CURRENT_EXCEPTION()
        BigWorld.quit()

    return
Beispiel #10
0
def main_game_loop():
    '''Main game loop'''
    global DISPLAYSURF, FPSCLOCK, DECAL, decal_textures
  
    pygame.init()   #must call init before any pygame functions are used
    
    DISPLAYSURF = pygame.display.set_mode( (SCREENWIDTH, SCREENHEIGHT) )    #creates game window
    
    FPSCLOCK = pygame.time.Clock() #Use with .tick()
    
    quit_game = False

    map_data.init()
    DECAL = {}
    decal_textures = SpriteAtlas('decal.png', 32, 2, 2)
    all_sprites_list = pygame.sprite.Group() #Initializes Group
    
    #OBJECT_MANAGER = {}
    
    '''TESTING'''
    for i in range(5,12):
        map_data.data[8][i] = LADDER
        
    for j in range(7,10):
        map_data.data[12][j] = LADDER
        
    for x in range(9, 12):
        for y in range(7,10):
            map_data.data[x][y] = GRASSL
    
    #for i in range(25):
    unit = Unit(5, 9) #Base class in unit_manager
    all_sprites_list.add(unit)
    #/ [random.choice((-5, 5)), random.choice((-5, 5))])
    
       
       
    #fps vars
    fps_avg = 0.0
    fps_avg_cntr = 0
    fps_sum = 0.0
    fps_cntr = 0
    fps_text = pygame.font.SysFont('comicsansms.tff', 32)
    fps_low = 250
    fps_high = 0
    
    
    camera = Camera( SCREENWIDTH / 2, SCREENHEIGHT / 2 )
    #textRect = fps_text.render(str(30)).get_rect()
    '''path = pathfinding.get_path(map_data, MAP_WIDTH, MAP_HEIGHT, pathfinding.Node(0,0), pathfinding.Node(13,10))
    for pos in path:
        rint('{}, {}'.format(pos[0], pos[1]))'''
    #for t in range(2):
    map_data.data[15][9] = TREE
    
    #set stockpile position and add 5 wood   

    items.init((1,9))
    for i in range(2):
        items.add(items.WOOD)
        
    #test_surface = pygame.Surface((50,50),10, 10)
    #test_surface.set_colorkey
    gui.init()
    '''ENDTESTING'''
    
    #mouse control vars
    down_pos = None
    current_pos = None
    is_down = False
    
    paused = False
    #all_sprites_list = pygame.sprite.Group()
    #for run in range(25):
    while not quit_game:
#---EVENTS-------------------------------------------------------------------------------------------------------------------EVENTS---
        if is_down:
            cur_x, cur_y = pygame.mouse.get_pos()

        event_list = pygame.event.get()

        for event in event_list:
            if event.type == pygame.QUIT:
                quit_game = True
                pygame.quit()
            elif event.type == pygame.MOUSEBUTTONDOWN:
                is_down = True
                #print('Mouse Down', is_down)
                down_pos = pygame.mouse.get_pos()
            elif event.type == pygame.MOUSEBUTTONUP:
                is_down = False
                #print('Mouse Down', is_down)
                #x, y = pygame.mouse.get_pos()

                if gui.on_gui(cur_x,cur_y) == False:
                    x, y = screen_to_grid(cur_x, cur_y)
                    #add_decal(x, y, 0)
                    #print(x, y)
                    #do stuff at modified points
                #map_data.set_data(x//TILE_SIZE,y//TILE_SIZE, EMPTY)
                    #print(x,y, map_data.get_data(x, y) )
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_a:
                    camera.x = camera.x - 1
                elif event.key == pygame.K_d:
                    camera.x = camera.x + 1
                elif event.key == pygame.K_p:
                    paused = not paused
                elif event.key == pygame.K_s:
                    items.add(items.WOOD)
                elif event.key == pygame.K_x:
                    for item in items.item_storage:
                        if items.item_storage[item] > 0:
                            print(items.item_database[item], items.item_storage[item])
        if paused:
            continue



        all_sprites_list.update()
 
#---DRAW GAME-------------------------------------------------------------------------------------------------------------------DRAW GAME--- 
        DISPLAYSURF.fill(BGCOLOR)

        #Display FPS
        fps_cntr += 1
        fps = FPSCLOCK.get_fps()
        fps_sum = fps_sum + fps
        
        if fps < fps_low:
            fps_low = fps
        if fps > fps_high:
            fps_high = fps
            
        if fps_cntr >= 60:

            fps_avg_cntr += 1
            
            if fps_avg_cntr > 3:

                fps_avg = fps_sum / (fps_avg_cntr * fps_cntr)
                fps_sum = 0
                
                fps_avg_cntr = 0
                fps_low = 250
                fps_high = 0
            fps_cntr = 0    
#---Draw Game-----------------------------------------------------------------------         
        draw_map()

        DISPLAYSURF.blit(fps_text.render('{0:.2f}   {1:2.2f}   L:{2:.2f}   H:{3:.2f}'.format( fps, fps_avg, fps_low, fps_high ), 0, (0,0,0)), [0, 0])
        
        draw_decal()

        all_sprites_list.draw(DISPLAYSURF)
        
        
        gui.update(DISPLAYSURF)
        
        pygame.display.flip()
        
        FPSCLOCK.tick(FPS)      #Delays until FPS == 1sec, If code finishes before FPS timer
Beispiel #11
0
def init(scriptConfig, engineConfig, userPreferences, loadingScreenGUI=None):
    global g_replayCtrl
    try:
        if constants.IS_DEVELOPMENT:
            autoFlushPythonLog()
        LOG_DEBUG('init')
        BigWorld.wg_initCustomSettings()
        Settings.g_instance = Settings.Settings(scriptConfig, engineConfig,
                                                userPreferences)
        CommandMapping.g_instance = CommandMapping.CommandMapping()
        from helpers import DecalMap
        DecalMap.g_instance = DecalMap.DecalMap(scriptConfig['decal'])
        from helpers import EdgeDetectColorController
        EdgeDetectColorController.g_instance = EdgeDetectColorController.EdgeDetectColorController(
            scriptConfig['silhouetteColors'])
        import SoundGroups
        SoundGroups.g_instance = SoundGroups.SoundGroups()
        import BattleReplay
        g_replayCtrl = BattleReplay.g_replayCtrl = BattleReplay.BattleReplay()
        g_replayCtrl.registerWotReplayFileExtension()
        try:
            import Vibroeffects
            Vibroeffects.VibroManager.g_instance = Vibroeffects.VibroManager.VibroManager(
            )
            Vibroeffects.VibroManager.g_instance.connect()
        except:
            LOG_CURRENT_EXCEPTION()

        tutorialLoaderInit()
        BigWorld.callback(0.1, asyncore_call)
        MessengerEntry.g_instance.init()
        import items
        items.init(True, None if not constants.IS_DEVELOPMENT else {})
        import ArenaType
        ArenaType.init()
        import dossiers1
        dossiers1.init()
        import dossiers2
        dossiers2.init()
        BigWorld.worldDrawEnabled(False)
        import LcdKeyboard
        LcdKeyboard.enableLcdKeyboardSpecificKeys(True)
        gui_personality.init(loadingScreenGUI=loadingScreenGUI)
        AreaDestructibles.init()
        MusicController.init()
        TriggersManager.init()
        RSSDownloader.init()
        g_postProcessing.init()
        try:
            from LightFx import LightManager
            LightManager.g_instance = LightManager.LightManager()
            import AuxiliaryFx
            AuxiliaryFx.g_instance = AuxiliaryFx.AuxiliaryFxManager()
        except:
            LOG_CURRENT_EXCEPTION()

    except Exception:
        LOG_CURRENT_EXCEPTION()
        BigWorld.quit()

    return
Beispiel #12
0
 def setUp(self):
     items.init(os.path.join(os.path.dirname(__file__),"testgame"))
Beispiel #13
0
def main():
    itemRoot = items.init()
    procRoot = processes.init(itemRoot)
    processCatI(itemRoot)
    processCat(procRoot, itemRoot)
    itemRoot.save()