Beispiel #1
0
 def onHotkeyPressed(self, event):
     if (not hasattr(BigWorld.player(), 'databaseID')
             or not self.data['enabled'] or not event.isKeyDown()
             or self.isMSAOpen or not self.skinsData['models']):
         return
     if checkKeys(self.data['ChangeViewHotkey'], event.key):
         try:
             from gui.mods.mod_remodenabler import g_config as re_config
         except ImportError:
             re_config = None
         if re_config is None:
             newModeNum = (self.teams.index(self.currentTeam) + 1) % len(
                 self.teams)
             self.currentTeam = self.teams[newModeNum]
             if self.data['isDebug']:
                 print self.ID + ': changing display mode to', self.currentTeam
             SystemMessages.pushMessage(
                 'temp_SM%s<b>%s</b>' %
                 (self.i18n['UI_mode'],
                  self.i18n['UI_mode_' + self.currentTeam]),
                 SystemMessages.SM_TYPE.Warning)
             refreshCurrentVehicle()
     if checkKeys(self.data['DynamicSkinHotkey'], event.key):
         enabled = self.dynamicSkinEnabled
         self.dynamicSkinEnabled = not enabled
         SystemMessages.pushMessage(
             'temp_SM' + self.i18n['UI_%sableDynamicSkin' %
                                   ('en' if not enabled else 'dis')],
             SystemMessages.SM_TYPE.CustomizationForGold)
         refreshCurrentVehicle()
Beispiel #2
0
 def py_onSaveSettings(self, settings):
     settings = objToDict(settings)
     g_config.settings = settings['skins']
     loadJson(g_config.ID, 'settings', g_config.settings, g_config.configPath, True, quiet=not g_config.data['isDebug'])
     g_config.skinsData['priorities'] = settings['priorities']
     loadJson(g_config.ID, 'skinsPriority', g_config.skinsData['priorities'], g_config.configPath, True,
              quiet=not g_config.data['isDebug'])
     g_config.readCurrentSettings(not g_config.data['isDebug'])
     refreshCurrentVehicle()
Beispiel #3
0
 def py_onSaveSettings(self, settings, cache):
     g_config.settings = settings = objToDict(settings)
     g_config.modelsData['selected'] = cache = objToDict(cache)
     loadJson(g_config.ID,
              'remodsCache',
              cache,
              g_config.configPath,
              True,
              quiet=not g_config.data['isDebug'])
     loadJson(g_config.ID,
              'settings',
              settings,
              g_config.configPath,
              True,
              quiet=not g_config.data['isDebug'])
     g_config.readCurrentSettings(not g_config.data['isDebug'])
     refreshCurrentVehicle()
Beispiel #4
0
 def py_onSaveSettings(settings):
     remodNames = sorted(g_config.modelsData['models'])
     for idx, setObj in enumerate(settings.remods):
         modelsSettings = g_config.settings['remods'][remodNames[idx]]
         for key in ('player', 'ally', 'enemy'):
             modelsSettings['swap' + key.capitalize()] = getattr(setObj.useFor, key)
         for teamIdx, team in enumerate(('player', 'ally', 'enemy')):
             modelsSettings[team + 'Whitelist'] = ','.join(setObj.whitelists[teamIdx])
     for idx, settingsArray in enumerate(settings.skins):
         for nameIdx, setObj in enumerate(settingsArray):
             for key in ('player', 'ally', 'enemy'):
                 g_config.settings['skins' + ('', '_dynamic')[idx]][
                     sorted(g_config.skinsData['models'][('static', 'dynamic')[idx]])[nameIdx]][
                     'swap' + key.capitalize()] = getattr(setObj.useFor, key)
     for idx, prioritiesArray in enumerate(settings.priorities):
         for teamIdx, team in enumerate(('player', 'ally', 'enemy')):
             g_config.skinsData['priorities'][('static', 'dynamic')[idx]][team] = prioritiesArray[teamIdx]
     loadJson(g_config.ID, 'skinsPriority', g_config.skinsData['priorities'], g_config.configPath, True,
              quiet=not g_config.data['isDebug'])
     loadJson(g_config.ID, 'settings', g_config.settings, g_config.configPath, True, quiet=not g_config.data['isDebug'])
     g_config.readCurrentSettings(not g_config.data['isDebug'])
     refreshCurrentVehicle()
Beispiel #5
0
def lobbyKeyControl(event):
    if not event.isKeyDown() or g_config.isMSAWindowOpen or not g_config.skinsData['models']:
        return
    if checkKeys(g_config.data['ChangeViewHotkey']):
        try:
            from gui.mods.mod_remodenabler import g_config as re_config
        except ImportError:
            re_config = None
        if re_config is None:
            newModeNum = (g_config.teams.index(g_config.currentTeam) + 1) % len(g_config.teams)
            g_config.currentTeam = g_config.teams[newModeNum]
            if g_config.data['isDebug']:
                print g_config.ID + ': changing display mode to', g_config.currentTeam
            SystemMessages.pushMessage(
                'temp_SM%s<b>%s</b>' % (g_config.i18n['UI_mode'], g_config.i18n['UI_mode_' + g_config.currentTeam]),
                SystemMessages.SM_TYPE.Warning)
            refreshCurrentVehicle()
    if checkKeys(g_config.data['DynamicSkinHotkey']):
        enabled = g_config.dynamicSkinEnabled
        g_config.dynamicSkinEnabled = not enabled
        SystemMessages.pushMessage(
            'temp_SM' + g_config.i18n['UI_%sableDynamicSkin' % ('en' if not enabled else 'dis')],
            SystemMessages.SM_TYPE.CustomizationForGold)
        refreshCurrentVehicle()
Beispiel #6
0
 def py_onModelRestore(self):
     g_config.previewRemod = None
     refreshCurrentVehicle()
Beispiel #7
0
 def py_onShowRemod(remodName):
     g_config.previewRemod = remodName
     refreshCurrentVehicle()
Beispiel #8
0
 def onHotkeyPressed(self, event):
     if (not hasattr(BigWorld.player(), 'databaseID')
             or not self.data['enabled'] or not event.isKeyDown()
             or self.isMSAOpen):
         return
     if self.modelsData['models'] and not self.previewRemod:
         if checkKeys(self.data['ChangeViewHotkey'], event.key):
             newModeNum = (self.teams.index(self.currentTeam) + 1) % len(
                 self.teams)
             self.currentTeam = self.teams[newModeNum]
             try:
                 from gui.mods.mod_skinner import g_config as _
                 _.currentTeam = self.currentTeam
             except ImportError:
                 _ = None
             if self.data['isDebug']:
                 print self.ID + ': changing display mode to', self.currentTeam
             SystemMessages.pushMessage(
                 'temp_SM%s<b>%s</b>' %
                 (self.i18n['UI_mode'],
                  self.i18n['UI_mode_' + self.currentTeam]),
                 SystemMessages.SM_TYPE.Warning)
             refreshCurrentVehicle()
         if checkKeys(self.data['SwitchRemodHotkey'], event.key):
             curTankType = self.currentTeam
             snameList = sorted(self.modelsData['models'].keys()) + ['']
             selected = self.modelsData['selected'][curTankType]
             vehName = RemodEnablerUI.py_getCurrentVehicleName()
             if vehName not in selected:
                 return
             snameIdx = (snameList.index(selected[vehName]) +
                         1) % len(snameList)
             for Idx in xrange(snameIdx, len(snameList) - 1):
                 curPRecord = self.modelsData['models'][snameList[Idx]]
                 if vehName not in curPRecord['whitelist']:
                     continue
                 selected[vehName] = curPRecord['name']
                 break
             else:
                 selected[vehName] = ''
             loadJson(self.ID,
                      'remodsCache',
                      self.modelsData['selected'],
                      self.configPath,
                      True,
                      quiet=not self.data['isDebug'])
             refreshCurrentVehicle()
     if checkKeys(self.data['CollisionHotkey'], event.key):
         SystemMessages.pushMessage(
             'temp_SM' + self.i18n['UI_collision_unavailable'],
             SystemMessages.SM_TYPE.CustomizationForGold)
         return
         # noinspection PyUnreachableCode
         self.collisionMode += 1
         self.collisionMode %= 3
         if self.collisionMode == 0:
             if self.data['isDebug']:
                 print self.ID + ': disabling collision displaying'
             SystemMessages.pushMessage(
                 'temp_SM' + self.i18n['UI_collision_compare_disable'],
                 SystemMessages.SM_TYPE.CustomizationForGold)
         elif self.collisionMode == 2:
             if self.data['isDebug']:
                 print self.ID + ': enabling collision display comparison mode'
             SystemMessages.pushMessage(
                 'temp_SM' + self.i18n['UI_collision_compare_enable'],
                 SystemMessages.SM_TYPE.CustomizationForGold)
         else:
             if self.data['isDebug']:
                 print self.ID + ': enabling collision display'
             SystemMessages.pushMessage(
                 'temp_SM' + self.i18n['UI_collision_enable'],
                 SystemMessages.SM_TYPE.CustomizationForGold)
         refreshCurrentVehicle()
Beispiel #9
0
 def onMSADestroy(self):
     refreshCurrentVehicle()
Beispiel #10
0
def lobbyKeyControl(event):
    if not event.isKeyDown() or g_config.isMSAWindowOpen:
        return
    if (g_config.modelsData['enabled'] or g_config.skinsData['enabled']) and checkKeys(g_config.data['ChangeViewHotkey']):
        while True:
            newModeNum = (g_config.possibleModes.index(g_config.currentMode) + 1) % len(g_config.possibleModes)
            g_config.currentMode = g_config.possibleModes[newModeNum]
            if g_config.data.get(g_config.currentMode, True):
                break
        if g_config.data['isDebug']:
            print g_config.ID + ': changing display mode to', g_config.currentMode
        SystemMessages.pushMessage(
            'temp_SM%s<b>%s</b>' % (g_config.i18n['UI_mode'], g_config.i18n['UI_mode_' + g_config.currentMode]),
            SystemMessages.SM_TYPE.Warning)
        refreshCurrentVehicle()
    if checkKeys(g_config.data['CollisionHotkey']):
        if g_config.collisionComparisonEnabled:
            g_config.collisionComparisonEnabled = False
            if g_config.data['isDebug']:
                print g_config.ID + ': disabling collision displaying'
            SystemMessages.pushMessage('temp_SM' + g_config.i18n['UI_disableCollisionComparison'],
                                       SystemMessages.SM_TYPE.CustomizationForGold)
        elif g_config.collisionEnabled:
            g_config.collisionEnabled = False
            g_config.collisionComparisonEnabled = True
            if g_config.data['isDebug']:
                print g_config.ID + ': enabling collision display comparison mode'
            SystemMessages.pushMessage('temp_SM' + g_config.i18n['UI_enableCollisionComparison'],
                                       SystemMessages.SM_TYPE.CustomizationForGold)
        else:
            g_config.collisionEnabled = True
            if g_config.data['isDebug']:
                print g_config.ID + ': enabling collision display'
            SystemMessages.pushMessage('temp_SM' + g_config.i18n['UI_enableCollision'],
                                       SystemMessages.SM_TYPE.CustomizationForGold)
        refreshCurrentVehicle()
    if checkKeys(g_config.data['DynamicSkinHotkey']):
        enabled = g_config.dynamicSkinEnabled
        g_config.dynamicSkinEnabled = not enabled
        SystemMessages.pushMessage(
            'temp_SM' + g_config.i18n['UI_%sableDynamicSkin' % ('en' if not enabled else 'dis')],
            SystemMessages.SM_TYPE.CustomizationForGold)
        refreshCurrentVehicle()
    if g_config.modelsData['enabled'] and checkKeys(g_config.data['SwitchRemodHotkey']):
        if g_config.currentMode != 'remod':
            curTankType = g_config.currentMode
            snameList = sorted(g_config.modelsData['models'].keys()) + ['']
            selected = g_config.modelsData['selected'][curTankType]
            vehName = RemodEnablerUI.py_getCurrentVehicleName()
            if selected.get(vehName) not in snameList:
                snameIdx = 0
            else:
                snameIdx = snameList.index(selected[vehName]) + 1
                if snameIdx == len(snameList):
                    snameIdx = 0
            for Idx in xrange(snameIdx, len(snameList)):
                curPRecord = g_config.modelsData['models'].get(snameList[Idx])
                if snameList[Idx] and vehName not in curPRecord.whitelists[curTankType]:
                    continue
                if vehName in selected:
                    selected[vehName] = getattr(curPRecord, 'name', '')
                loadJson(g_config.ID, 'remodsCache', g_config.modelsData['selected'], g_config.configPath, True,
                         quiet=not g_config.data['isDebug'])
                break
        else:
            snameList = sorted(g_config.modelsData['models'].keys())
            if g_config.modelsData['selected']['remod'] not in snameList:
                snameIdx = 0
            else:
                snameIdx = snameList.index(g_config.modelsData['selected']['remod']) + 1
                if snameIdx == len(snameList):
                    snameIdx = 0
            sname = snameList[snameIdx]
            g_config.modelsData['selected']['remod'] = sname
            loadJson(g_config.ID, 'remodsCache', g_config.modelsData['selected'], g_config.configPath, True,
                     quiet=not g_config.data['isDebug'])
        refreshCurrentVehicle()
Beispiel #11
0
 def py_onModelRestore(self):
     g_config.currentMode = self.modeBackup
     g_config.modelsData['selected']['remod'] = self.remodBackup
     refreshCurrentVehicle()
Beispiel #12
0
 def py_onShowRemod(remodIdx):
     g_config.currentMode = 'remod'
     g_config.modelsData['selected']['remod'] = sorted(g_config.modelsData['models'])[remodIdx]
     refreshCurrentVehicle()
Beispiel #13
0
 def onMSADestroy(self):
     try:
         from gui.mods import mod_remodenabler
     except ImportError:
         refreshCurrentVehicle()