Beispiel #1
0
    def update_config(self):
        self.loginErrorString = l10n(config.get('login/pingServers/errorString', '--'))
        self.hangarErrorString = l10n(config.get('hangar/pingServers/errorString', '--'))
        self.loginShowTitle = config.get('login/pingServers/showTitle', True)
        self.hangarShowTitle = config.get('hangar/pingServers/showTitle', True)
        ignoredServers = config.get('hangar/pingServers/ignoredServers', [])

        self.hosts_urls = {}
        self.loginHosts = []
        self.hangarHosts = []
        if self.loginSection is not None:
            for (name, subSec) in self.loginSection.items():
                host_name = subSec.readStrings('name')[0]
                if 'Supertest' not in host_name:
                    if len(host_name) >= 13:
                        host_name = subSec.readStrings('short_name')[0]
                    elif host_name.startswith('WOT '):
                        host_name = host_name[4:]
                self.hosts_urls[host_name] = subSec.readStrings('url')[0]
                self.loginHosts.append(host_name)
                if host_name not in ignoredServers:
                    self.hangarHosts.append(host_name)
            alphanumeric_sort(self.loginHosts)
            alphanumeric_sort(self.hangarHosts)
            self.done_config = True
Beispiel #2
0
def onConfigLoaded(self, e=None):
    g_minimap.enabled = config.get('minimap/enabled', True)
    g_minimap.opt_labelsEnabled = config.get('minimap/labelsEnabled', True)
    g_minimap.opt_linesEnabled = config.get('minimap/linesEnabled', True)
    g_minimap.opt_circlesEnabled = config.get('minimap/circlesEnabled', True)
    g_minimap.opt_minimapDeadSwitch = config.get('battle/minimapDeadSwitch',
                                                 True)
Beispiel #3
0
def __changeColor(base, diff):
    if 'isColorBlind' not in diff:
        return
    cType = 'colorBlind' if diff['isColorBlind'] else 'common'
    isHangar = isinstance(BigWorld.player(), PlayerAccount)
    colors = g_instance._EdgeDetectColorController__colors[cType]

    if isSquad:
        friend = colorVector(
            config.get('colors/system/squadman_alive', '#FFB964'),
            colors['friend'])
        enemy = colorVector(config.get('colors/system/enemy_alive', '#2C9AFF'),
                            colors['enemy'])
    elif isTeamKill:
        currentColor = config.get('colors/system/teamKiller_alive', '#00EAFF')
        friend = colorVector(currentColor, colors['friend'])
        enemy = colorVector(currentColor, colors['enemy'])
    else:
        friend = colorVector(config.get('colors/system/ally_alive', '#96FF00'),
                             colors['friend'])
        enemy = colorVector(config.get('colors/system/enemy_alive', '#2C9AFF'),
                            colors['enemy'])

    colorsSet = (colors['hangar'] if isHangar else colors['self'], enemy,
                 friend, colors['flag'])
    BigWorld.wgSetEdgeDetectColors(colorsSet)
Beispiel #4
0
def onConfigLoaded(self, e=None):
    global cfg_hangar_enableGoldLocker
    global cfg_hangar_enableFreeXpLocker
    cfg_hangar_enableGoldLocker = config.get('hangar/enableGoldLocker',
                                             False) == True
    cfg_hangar_enableFreeXpLocker = config.get('hangar/enableFreeXpLocker',
                                               False) == True
Beispiel #5
0
def _CrosshairPanelContainer_as_setSettingsS(base, self, data):
    if config.get('battle/camera/enabled') and config.get(
            'battle/camera/sniper/zoomIndicator/enabled'):
        sniperData = data.get(CROSSHAIR_VIEW_ID.SNIPER, None)
        if sniperData:
            sniperData['zoomIndicatorAlphaValue'] = 0
    base(self, data)
Beispiel #6
0
    def _getOnlineAsync(self):
        try:
            res = {}
            for host in self.hosts:
                res[host] = l10n_macros_replace(config.get('hangar/onlineServers/errorString', '--k') if g_hangarSpace.inited else config.get('login/onlineServers/errorString', '--k'))
            req = "onlineUsersCount/0"
            server = XVM.SERVERS[randint(0, len(XVM.SERVERS) - 1)]
            (response, delay, error) = loadUrl(server, req, showLog=False)
            # typical response:
            #{
            #    "eu":  [{"players_online":4297,"server":"EU2"},{"players_online":8331,"server":"EU1"}],
            #    "na":  [{"players_online":22740,"server":"NA EAST"},{"players_online":7431,"server":"NA WEST"}],
            #    "asia":[{"players_online":6603,"server":"ASIA"}],
            #    "kr":  [{"players_online":868,"server":"KR"}],
            #    "ru":  [{"players_online":14845,"server":"RU8"},{"players_online":8597,"server":"RU2"},{"players_online":9847,"server":"RU1"},{"players_online":3422,"server":"RU3"},{"players_online":11508,"server":"RU6"},{"players_online":6795,"server":"RU5"},{"players_online":3354,"server":"RU4"}]
            #}
            region = GAME_REGION.lower()
            if 'CT' in URLS.WG_API_SERVERS and region == 'ct': # CT is uncommented in xfw.constants to check on test server
                region = 'ru'
            response_data = None if response is None else simplejson.loads(response).get(region, [])

            best_online = 0
            if not error and type(response_data) is list:
                for host in response_data:
                    if host['server'].find('NA ') == 0: # API returns "NA EAST" instead of "US East" => can't determine current server
                        host['server'] = 'US ' + host['server'][3:].capitalize()
                    res[str(host['server'])] = host['players_online']
                    best_online = max(best_online, int(host['players_online']))
            if (g_hangarSpace.inited and config.get('hangar/onlineServers/showTitle')) or (not g_hangarSpace.inited and config.get('login/onlineServers/showTitle')):
                res['###best_online###'] = str(best_online)  # will be first in sorting, key is replaced by localized "Online"
        except Exception, ex:
            err('_getOnlineAsync() exception: ' + traceback.format_exc())
 def __init__(self, section):
     self.section = section
     self.numberLine = {}
     self.listLog = []
     self.countLines = 0
     self.maxCountLines = None
     # self.numberLine = 0
     self.S_GROUP_HITS_PLAYER = section + GROUP_HITS_PLAYER
     self.S_ADD_TO_END = section + ADD_TO_END
     self.S_LINES = section + LINES
     self.S_FORMAT_HISTORY = section + FORMAT_HISTORY
     self.S_MOVE_IN_BATTLE = section + MOVE_IN_BATTLE
     self.S_X = section + 'x'
     self.S_Y = section + 'y'
     self._data = None
     if config.get(self.S_MOVE_IN_BATTLE, False):
         _data = userprefs.get('assistLog/log', {'x': config.get(self.S_X, DEFAULT_X), 'y': config.get(self.S_Y, DEFAULT_Y)})
         if section == SECTION_LOG:
             as_callback("assistLog_mouseDown", self.mouse_down)
             as_callback("assistLog_mouseUp", self.mouse_up)
             as_callback("assistLog_mouseMove", self.mouse_move)
     else:
         _data = {'x': config.get(self.S_X, DEFAULT_X), 'y': config.get(self.S_Y, DEFAULT_Y)}
     self.x = _data['x']
     self.y = _data['y']
 def groupDamages(self):
     isGroupRamming_WorldCollision = (data.data['attackReasonID'] in [2, 3]) and config.get(self.S_GROUP_DAMAGE_RAMMING_COLLISION)
     isGroupFire = (data.data['attackReasonID'] == 1) and config.get(self.S_GROUP_DAMAGE_FIRE)
     if isGroupRamming_WorldCollision or isGroupFire:
         dataLog = data.data.copy()
         attackerID = dataLog['attackerID']
         attackReasonID = dataLog['attackReasonID']
         if attackerID in self.dictVehicle:
             if attackReasonID in self.dictVehicle[attackerID]:
                 key = self.dictVehicle[attackerID][attackReasonID]
                 if ('time' in key) and ('damage' in key) and ((BigWorld.serverTime() - key['time']) < 1):
                     key['time'] = BigWorld.serverTime()
                     key['damage'] += dataLog['damage']
                     dataLog['damage'] = key['damage']
                     dataLog['dmgRatio'] = dataLog['damage'] * 100 // dataLog['maxHealth']
                     dataLog['fireDuration'] = BigWorld.time() - key['startAction'] if (attackReasonID == 1) and (key['startAction'] is not None) else None
                     dataLog['hitTime'] = key['hitTime']
             else:
                 self.dictVehicle[attackerID][attackReasonID] = {'time': BigWorld.serverTime(),
                                                                 'damage': dataLog['damage'],
                                                                 'startAction': BigWorld.time() if attackReasonID == 1 else None,
                                                                 'hitTime': dataLog['hitTime']}
                 dataLog['fireDuration'] = 0 if attackReasonID == 1 else None
         else:
             self.dictVehicle[attackerID] = {}
             self.dictVehicle[attackerID][attackReasonID] = {'time': BigWorld.serverTime(),
                                                             'damage': dataLog['damage'],
                                                             'startAction': BigWorld.time() if attackReasonID == 1 else None,
                                                             'hitTime': dataLog['hitTime']}
             dataLog['fireDuration'] = 0 if attackReasonID == 1 else None
         self.setOutParameters(dataLog)
     else:
         self.setOutParameters(data.data)
Beispiel #9
0
def PlayerAvatar_targetFocus(self, entity):
    global targetName, targetVehicle, targetVType, targetColorsVType, targetReload, targetVisionRadius, targetDistance
    global targetVehicleName, isAlly, targetAlive
    if config.get('sight/enabled', True) and battle.isBattleTypeSupported:
        targetAlive = entity.isAlive()
        if entity in self._PlayerAvatar__vehicles and targetAlive:
            if f_delayHideTarget is not None:
                BigWorld.cancelCallback(f_delayHideTarget)
            td = entity.typeDescriptor
            _type = td.type
            _gun = td.gun
            _miscAttrs = td.miscAttrs
            _turret = td.turret
            crewLevelIncrease = 0.0043 * _miscAttrs.get('crewLevelIncrease', 0)
            targetVehicle = _type.shortUserString
            targetVehicleName = td.name.replace(':', '-', 1)
            targetName = entity.publicInfo.name
            isAlly = 'al' if entity.publicInfo.team == self.team else 'en'
            targetReload = _gun.reloadTime * _miscAttrs.get(
                'gunReloadTimeFactor', 1) / (1.0695 + crewLevelIncrease)
            targetVisionRadius = _turret.circularVisionRadius * _miscAttrs.get(
                'circularVisionRadiusFactor', 1) * (1.0434 + crewLevelIncrease)
            vehClass = VEHICLE_CLASSES[list(
                _type.tags.intersection(VEHICLE_CLASSES.keys()))[0]]
            targetVType = config.get('texts/vtype/' + vehClass)
            targetColorsVType = config.get('colors/vtype/' + vehClass)
            targetAlive = entity.isAlive()
            # targetDistance = int(math.sqrt(self.getVehicleAttached().position.distSqrTo(entity.position)))
            as_event('ON_TARGET')
Beispiel #10
0
 def output(self):
     if config.get(self.S_SHOW_HIT_NO_DAMAGE) or data.data['isDamage']:
         isGroupRamming_WorldCollision = (data.data['attackReasonID'] in [2, 3]) and config.get(self.S_GROUP_DAMAGE_RAMMING_COLLISION)
         isGroupFire = (data.data['attackReasonID'] == 1) and config.get(self.S_GROUP_DAMAGE_FIRE)
         if isGroupRamming_WorldCollision or isGroupFire:
             self.dataLog = data.data.copy()
             attackerID = self.dataLog['attackerID']
             attackReasonID = self.dataLog['attackReasonID']
             if attackerID in self.dictVehicle:
                 if (attackReasonID in self.dictVehicle[attackerID]) and ((BigWorld.serverTime() - self.dictVehicle[attackerID][attackReasonID]['time']) < 1.0):
                     key = self.dictVehicle[attackerID][attackReasonID]
                     key['time'] = BigWorld.serverTime()
                     key['damage'] += self.dataLog['damage']
                     key['criticalHit'] = (key['criticalHit'] or self.dataLog['criticalHit'])
                     if key['damage'] > 0:
                         self.dataLog['hitEffect'] = 'armor_pierced'
                     self.dataLog['criticalHit'] = key['criticalHit']
                     self.dataLog['damage'] = key['damage']
                     self.dataLog['dmgRatio'] = self.dataLog['damage'] * 100 // self.dataLog['maxHealth']
                     self.dataLog['number'] = len(self.listLog) - key['numberLine']
                     self.dataLog['fireDuration'] = BigWorld.time() - key['startAction'] if (attackReasonID == 1) and (key['startAction'] is not None) else None
                     self.dataLog['hitTime'] = key['hitTime']
                     self.setOutParameters(key['numberLine'])
                 else:
                     if attackReasonID in self.dictVehicle[attackerID]:
                         del self.dictVehicle[attackerID][attackReasonID]
                     self.addLine(attackerID, attackReasonID)
             else:
                 self.dictVehicle[attackerID] = {}
                 self.addLine(attackerID, attackReasonID)
         else:
             self.dataLog = data.data
             self.addLine()
         if self.callEvent:
             as_event('ON_HIT')
Beispiel #11
0
 def setOutParameters(self, dataLog):
     updateValueMacros(self.section, dataLog)
     self.strLastHit = parser(config.get(self.S_FORMAT_LAST_HIT))
     if not config.get(self.S_MOVE_IN_BATTLE):
         self.x = parser(config.get(self.S_X))
         self.y = parser(config.get(self.S_Y))
     self.shadow = shadow_value(self.section)
Beispiel #12
0
 def results_arrived(self, results):
     try:
         results = dict(results)
         if DUMMY_ADDRESS not in results:  # not our callback
             g_preDefinedHosts._PreDefinedHostList__onPingPerformed(results)
         else:
             del results[DUMMY_ADDRESS]
         if not len(results) or not len(self.url_to_serverName):
             return
         ping_results = {}
         best_ping = 999
         for url, ping in results.iteritems():
             server_name = self.url_to_serverName[url]
             smoothed_ping = self.smooth_ping(server_name, ping)
             if smoothed_ping <= 0:
                 ping_results[server_name] = 'Error'
             else:
                 ping_results[server_name] = smoothed_ping
                 best_ping = min(best_ping, smoothed_ping)
         if (self.hangarSpace.spaceInited
                 and config.get('hangar/pingServers/showTitle')) or (
                     not self.hangarSpace.spaceInited
                     and config.get('login/pingServers/showTitle')):
             ping_results[
                 '###best_ping###'] = best_ping  # will be first in sorting by server, key is replaced by localized "Ping"
         as_xfw_cmd(XVM_PING_COMMAND.AS_PINGDATA, ping_results)
     except Exception as ex:
         err('results_arrived() exception: ' + traceback.format_exc())
         as_xfw_cmd(XVM_PING_COMMAND.AS_PINGDATA, {'Error': ex})
Beispiel #13
0
def text_styles_getStyle(base, style, ctx=None):
    if ctx is None:
        ctx = {}
    try:
        if style not in styles_templates:
            template = g_htmlTemplates['html_templates:lobby/textStyle'][
                style].source
            template_string = template if type(
                template) is str else template['text']
            if "size='14'" in template_string and "face='$FieldFont'" in template_string:
                template_string = template_string \
                    .replace("size='14'", "size='%s'" % config.get('tooltips/fontSize', 14)) \
                    .replace("face='$FieldFont'", "face='%s'" % config.get('tooltips/fontName', '$FieldFont'))
            styles_templates[style] = template_string if type(
                template) is str else {
                    'text': template_string
                }
        if type(styles_templates[style]) is str:
            return styles_templates[style]
        else:
            if ctx:
                return styles_templates[style]['text'] % ctx
            else:
                return base(style, ctx)
    except Exception as ex:
        err(traceback.format_exc())
        return base(style, ctx)
Beispiel #14
0
 def results_arrived(self, results):
     try:
         results = dict(results)
         if DUMMY_ADDRESS not in results:  # not our callback
             g_preDefinedHosts._PreDefinedHostList__onPingPerformed(results)
         else:
             del results[DUMMY_ADDRESS]
         if not len(results) or not len(self.url_to_serverName):
             return
         ping_results = {}
         best_ping = 999
         for url, ping in results.iteritems():
             server_name = self.url_to_serverName[url]
             smoothed_ping = self.smooth_ping(server_name, ping)
             if smoothed_ping <= 0:
                 ping_results[server_name] = "Error"
             else:
                 ping_results[server_name] = smoothed_ping
                 best_ping = min(best_ping, smoothed_ping)
         if (g_hangarSpace.spaceInited and config.get("hangar/pingServers/showTitle")) or (
             not g_hangarSpace.spaceInited and config.get("login/pingServers/showTitle")
         ):
             ping_results[
                 "###best_ping###"
             ] = best_ping  # will be first in sorting by server, key is replaced by localized "Ping"
         as_xfw_cmd(XVM_PING_COMMAND.AS_PINGDATA, ping_results)
     except Exception as ex:
         err("results_arrived() exception: " + traceback.format_exc())
         as_xfw_cmd(XVM_PING_COMMAND.AS_PINGDATA, {"Error": ex})
Beispiel #15
0
def getPreferredAutorotationMode(base, self):
    if config.get('battle/camera/enabled') and config.get(
            'battle/camera/sniper/noCameraLimit/enabled') and config.get(
                'battle/camera/sniper/noCameraLimit/mode') == "full":
        return avatar_getter.getVehicleTypeDescriptor(
        ).chassis.rotationIsAroundCenter
    return base(self)
Beispiel #16
0
 def groupDamages(self):
     isGroupRamming_WorldCollision = (data.data['attackReasonID'] in [2, 3]) and config.get(self.S_GROUP_DAMAGE_RAMMING_COLLISION)
     isGroupFire = (data.data['attackReasonID'] == 1) and config.get(self.S_GROUP_DAMAGE_FIRE)
     if isGroupRamming_WorldCollision or isGroupFire:
         dataLog = data.data.copy()
         attackerID = dataLog['attackerID']
         attackReasonID = dataLog['attackReasonID']
         if attackerID in self.dictVehicle:
             if attackReasonID in self.dictVehicle[attackerID]:
                 key = self.dictVehicle[attackerID][attackReasonID]
                 if ('time' in key) and ('damage' in key) and ((BigWorld.serverTime() - key['time']) < 1):
                     key['time'] = BigWorld.serverTime()
                     key['damage'] += dataLog['damage']
                     dataLog['damage'] = key['damage']
                     dataLog['dmgRatio'] = dataLog['damage'] * 100 // dataLog['maxHealth']
                     dataLog['fireDuration'] = BigWorld.time() - key['startAction'] if (attackReasonID == 1) and (key['startAction'] is not None) else None
                     dataLog['hitTime'] = key['hitTime']
             else:
                 self.dictVehicle[attackerID][attackReasonID] = {'time': BigWorld.serverTime(),
                                                                 'damage': dataLog['damage'],
                                                                 'startAction': BigWorld.time() if attackReasonID == 1 else None,
                                                                 'hitTime': dataLog['hitTime']}
                 dataLog['fireDuration'] = 0 if attackReasonID == 1 else None
         else:
             self.dictVehicle[attackerID] = {}
             self.dictVehicle[attackerID][attackReasonID] = {'time': BigWorld.serverTime(),
                                                             'damage': dataLog['damage'],
                                                             'startAction': BigWorld.time() if attackReasonID == 1 else None,
                                                             'hitTime': dataLog['hitTime']}
             dataLog['fireDuration'] = 0 if attackReasonID == 1 else None
         self.setOutParameters(dataLog)
     else:
         self.setOutParameters(data.data)
Beispiel #17
0
def DestructibleEntity_onHealthChanged(self, newHealth, attackerID, attackReasonID, hitFlags):
    destructibleEntityComponent = BigWorld.player().arena.componentSystem.destructibleEntityComponent
    if config.get(ENABLED, True) and battle.isBattleTypeSupported and (destructibleEntityComponent is not None):
        if (_data.playerVehicleID == attackerID) and (self.id not in _data.vehDead):
            if not self.isPlayerTeam or config.get(SHOW_ALLY_DAMAGE, True):
                _data.onHealthChanged(self, newHealth, attackerID, attackReasonID, False)
        _data.updateVehInfo(self)
Beispiel #18
0
 def __init__(self, section):
     self.section = section
     self.players = {}
     self.listLog = []
     self.countLines = 0
     self.maxCountLines = None
     self.numberLine = 0
     self.S_GROUP_HITS_PLAYER = section + GROUP_HITS_PLAYER
     self.S_ADD_TO_END = section + ADD_TO_END
     self.S_LINES = section + LINES
     self.S_FORMAT_HISTORY = section + FORMAT_HISTORY
     self.S_MOVE_IN_BATTLE = section + MOVE_IN_BATTLE
     self.S_X = section + 'x'
     self.S_Y = section + 'y'
     self._data = None
     if config.get(self.S_MOVE_IN_BATTLE, False):
         _data = userprefs.get('hitLog/log', {'x': config.get(self.S_X, DEFAULT_X), 'y': config.get(self.S_Y, DEFAULT_Y)})
         if section == SECTION_LOG:
             as_callback("hitLog_mouseDown", self.mouse_down)
             as_callback("hitLog_mouseUp", self.mouse_up)
             as_callback("hitLog_mouseMove", self.mouse_move)
     else:
         _data = {'x': config.get(self.S_X, DEFAULT_X), 'y': config.get(self.S_Y, DEFAULT_Y)}
     self.x = _data['x']
     self.y = _data['y']
Beispiel #19
0
def _ArcadeCamera_create(base, self, pivotPos, onChangeControlMode = None, postmortemMode = False):
    #debug('_ArcadeCamera_create: {}'.format(postmortemMode))
    if config.get('battle/camera/enabled'):
        mode = 'arcade' if not postmortemMode else 'postmortem'
        c = config.get('battle/camera/%s' % mode)
        cfg = self._ArcadeCamera__cfg
        bcfg = self._ArcadeCamera__baseCfg
        ucfg = self._ArcadeCamera__userCfg
        dcfg = self._ArcadeCamera__dynamicCfg

        if not c['shotRecoilEffect']:
            _disableShotRecoilEffect(dcfg)

        value = c['distRange']
        if value is not None:
            cfg['distRange'] = MinMax(float(value[0]), float(value[1]))

        value = c['startDist']
        if value is not None:
            cfg['startDist'] = float(value)

        value = c['scrollSensitivity']
        if value is not None:
            bcfg['scrollSensitivity'] = float(value)
            cfg['scrollSensitivity'] = float(value) * ucfg['scrollSensitivity']

    base(self, pivotPos, onChangeControlMode, postmortemMode)
Beispiel #20
0
 def setOutParameters(self, dataLog):
     updateValueMacros(self.section, dataLog)
     self.strLastHit = parser(config.get(self.S_FORMAT_LAST_HIT))
     if not config.get(self.S_MOVE_IN_BATTLE):
         self.x = parser(config.get(self.S_X))
         self.y = parser(config.get(self.S_Y))
     self.shadow = shadow_value(self.section)
Beispiel #21
0
def onConfigLoaded(self, e=None):
    global cfg_hangar_enableGoldLocker
    global cfg_hangar_enableFreeXpLocker
    global cfg_hangar_enableCrystalLocker
    cfg_hangar_enableGoldLocker = config.get('hangar/enableGoldLocker', False) == True
    cfg_hangar_enableFreeXpLocker = config.get('hangar/enableFreeXpLocker', False) == True
    cfg_hangar_enableCrystalLocker = config.get('hangar/enableCrystalLocker', False) == True
Beispiel #22
0
def _ArcadeCamera_create(base,
                         self,
                         pivotPos,
                         onChangeControlMode=None,
                         postmortemMode=False):
    #debug('_ArcadeCamera_create: {}'.format(postmortemMode))
    if config.get('battle/camera/enabled'):
        mode = 'arcade' if not postmortemMode else 'postmortem'
        c = config.get('battle/camera/%s' % mode)
        cfg = self._ArcadeCamera__cfg
        bcfg = self._ArcadeCamera__baseCfg
        ucfg = self._ArcadeCamera__userCfg
        dcfg = self._ArcadeCamera__dynamicCfg

        if not c['shotRecoilEffect']:
            _disableShotRecoilEffect(dcfg)

        value = c['distRange']
        if value is not None:
            cfg['distRange'] = MinMax(float(value[0]), float(value[1]))

        value = c['startDist']
        if value is not None:
            cfg['startDist'] = float(value)

        value = c['scrollSensitivity']
        if value is not None:
            bcfg['scrollSensitivity'] = float(value)
            cfg['scrollSensitivity'] = float(value) * ucfg['scrollSensitivity']

    base(self, pivotPos, onChangeControlMode, postmortemMode)
Beispiel #23
0
def CrosshairPanelContainerMeta_as_setNetVisibleS(base, self, mask):
    if config.get('sight/enabled', True):
        if config.get('sight/removeIndicator', False):
            mask &= 2
        if config.get('sight/removeQuantityShells', False):
            mask &= 1
    return base(self, mask)
Beispiel #24
0
 def __init__(self):
     self.rotation = 0
     self.showInArcade = config.get('armorPanel/protractor/showInArcade',
                                    False)
     self.useCameraRotation = config.get(
         'armorPanel/protractor/useCameraRotation', True)
     self.circle_xscale = 1
     self.circle_x = 0
     self.atRMax = False
     self.atLMax = False
     self.middleLine_x = 0
     self.x = None
     self.y = None
     self.useProtractorTD = False
     self.useProtractorSPG = False
     self.rightArc = None
     self.heightSPG = 0.0
     self.midX = BigWorld.screenWidth() / 2
     self.midY = BigWorld.screenHeight() / 2
     self.leftArc = None
     self.enable = False
     self.realMidLine_right_alpha = 0.0
     self.realMidLine_left_alpha = 0.0
     self.leftLine_x = 0
     self.mask_x = 0
     self.rightLine_x = 0
     self.mask_width = 0
     self.middleLine_txt_text = ""
     self.leftLine_img = "LeftLine"
     self.rightLine_img = "RightLine"
     self.middleLine_img = "middleLine"
     self.xSpacing = config.get('armorPanel/protractor/xSpacing', 0)
     # self.m2pix = config.get('armorPanel/protractor/m2pix', 40.4761904762)
     self.protractorOffsetWhenTD = config.get(
         'armorPanel/protractor/protractorOffsetWhenTD', 43)
Beispiel #25
0
 def initialValues(self):
     if config.get('armorPanel/protractor/xSpacing', 0) == 0:
         # xSpacing = leftArc + rightArc < 30 ? 32 : 16
         if (ME_Tank.leftArc + ME_Tank.rightArc) < 30:
             self.xSpacing = 32
         else:
             self.xSpacing = 16
     else:
         config.get('armorPanel/protractor/xSpacing', 32)
     turretYawRad = 0.0
     self.middleLine_x = turretYawRad * self.xSpacing
     self.leftLine_img = "LeftLine"
     self.rightLine_img = "RightLine"
     self.middleLine_img = "middleLine"
     self.leftLine_x = (0 - (ME_Tank.leftArc * self.xSpacing -
                             turretYawRad * self.xSpacing)) - 12
     self.rightLine_x = (ME_Tank.rightArc * self.xSpacing +
                         turretYawRad * self.xSpacing) + 11
     self.middleLine_txt_text = " 0"
     self.mask_width = self.rightLine_x - self.leftLine_x
     self.mask_x = self.leftLine_x  # self.leftLine_x + (self.mask_width / 2)
     if self.xSpacing == 0.0:
         self.circle_xscale = 1.0
     else:
         self.circle_xscale = self.xSpacing / self.xSpacing * 100.0  # circle is the line itself
         self.circle_x = self.leftLine_x + (self.mask_width / 2)
         self.realMidLine_left_alpha = 0.0
         self.realMidLine_right_alpha = 0.0
Beispiel #26
0
    def getRatingColor(stats):
        if stats is None:
            return None

        rating = config.networkServicesSettings.rating
        v = stats.get(rating, 0)
        if config.get('chat/customColors', False):
            # Use custom colors from chat.xc
            v = stats.get('x' + rating, v)  # normalized rating only
            colors = config.get('chat/colors', None)
            if colors is None:
                color = ''
            else:
                color = next((int(x['color'], 0)
                              for x in colors if v <= float(x['value'])),
                             0xFFFFFF)
                color = "#{0:06x}".format(color)
        else:
            # Use colors from colors.xc
            color = xvm_utils.getDynamicColorValue(
                'x' if rating.startswith('x') else rating,
                v if v is not None else 0)

        LOG_DEBUG('%s/%s => %s' % (rating, v, color))
        return color
Beispiel #27
0
    def update_config(self):
        self.loginErrorString = l10n(config.get('login/pingServers/errorString', '--'))
        self.hangarErrorString = l10n(config.get('hangar/pingServers/errorString', '--'))
        self.loginShowTitle = config.get('login/pingServers/showTitle', True)
        self.hangarShowTitle = config.get('hangar/pingServers/showTitle', True)
        ignoredServers = config.get('hangar/pingServers/ignoredServers', [])

        self.hosts_urls = {}
        self.loginHosts = []
        self.hangarHosts = []
        if self.loginSection is not None:
            for (name, subSec) in self.loginSection.items():
                host_name = subSec.readStrings('name')[0]
                if 'Supertest' not in host_name:
                    if len(host_name) >= 13:
                        host_name = subSec.readStrings('short_name')[0]
                    elif host_name.startswith('WOT '):
                        host_name = host_name[4:]
                self.hosts_urls[host_name] = subSec.readStrings('url')[0]
                self.loginHosts.append(host_name)
                if host_name not in ignoredServers:
                    self.hangarHosts.append(host_name)
            alphanumeric_sort(self.loginHosts)
            alphanumeric_sort(self.hangarHosts)
            self.done_config = True
Beispiel #28
0
def Vehicle_onEnterWorld(self, prereqs):
    if self.isPlayerVehicle and config.get('sight/enabled', True):
        global vehicle, currentDistance, timeFlight, timeAIM, cameraHeight, camera
        global _explosionRadius, isDisplaySphere, isDownHotkey, player, isAlive
        _explosionRadius = None
        currentDistance = None
        timeFlight = None
        timeAIM = None
        cameraHeight = None
        player = BigWorld.player()
        camera = BigWorld.camera()
        # isNotEvent = player.arenaGuiType not in [ARENA_GUI_TYPE.EPIC_BATTLE, ARENA_GUI_TYPE.EVENT_BATTLES]
        # isNotEvent = True
        if battle.isBattleTypeSupported:
            isAlive = self.isAlive
            vehicle = self
            td = self.typeDescriptor
            _type = td.type
            vehClass = VEHICLE_CLASSES[list(
                _type.tags.intersection(VEHICLE_CLASSES.keys()))[0]]
            isDisplaySphere = config.get('sight/sphereDispersion/enabled',
                                         False) and (vehClass in config.get(
                                             'sight/sphereDispersion/vtype',
                                             ['SPG']))
            isDownHotkey = not config.get(
                'sight/sphereDispersion/hotkey/enabled', False)
Beispiel #29
0
    def _pingAsync(self):
        try:
            res = dict()
            for host in self.hosts:
                res[host['name']] = l10n_macros_replace(config.get('hangar/pingServers/errorString', '--') if g_hangarSpace.inited else config.get('login/pingServers/errorString', '--'))
            if os.path.exists(LINUX_PING_PATH_IN_WINE):
                (pattern, processes) = self._pingAsyncLinux()
            else:
                (pattern, processes) = self._pingAsyncWindows()

            # Parse ping output
            best_ping = 999
            for x in self.hosts:
                proc = processes[x['name']]

                out, er = proc.communicate()
                errCode = proc.wait()
                if errCode != 0:
                    continue

                found = re.search(pattern, out)
                if not found:
                    res[x['name']] = '?'
                    debug('Ping regexp not found in %s' % out.replace('\n', '\\n'))
                    continue

                res[x['name']] = found.group(1)
                best_ping = min(best_ping, int(found.group(1)))
            if (g_hangarSpace.inited and config.get('hangar/pingServers/showTitle')) or (not g_hangarSpace.inited and config.get('login/pingServers/showTitle')):
                res['###best_ping###'] = best_ping # will be first in sorting by server, key is replaced by localized "Ping"

        except Exception, ex:
            err('_pingAsync() exception: ' + traceback.format_exc())
 def initialValues(self):
     if config.get('armorPanel/protractor/xSpacing', 0) == 0:
         # xSpacing = leftArc + rightArc < 30 ? 32 : 16
         if (ME_Tank.leftArc + ME_Tank.rightArc) < 30:
             self.xSpacing = 32
         else:
             self.xSpacing = 16
     else:
         config.get('armorPanel/protractor/xSpacing', 32)
     turretYawRad = 0.0
     self.middleLine_x = turretYawRad * self.xSpacing
     self.leftLine_img = "LeftLine"
     self.rightLine_img = "RightLine"
     self.middleLine_img = "middleLine"
     self.leftLine_x = (0 - (ME_Tank.leftArc * self.xSpacing - turretYawRad * self.xSpacing)) - 12
     self.rightLine_x = (ME_Tank.rightArc * self.xSpacing + turretYawRad * self.xSpacing) + 11
     self.middleLine_txt_text = " 0"
     self.mask_width = self.rightLine_x - self.leftLine_x
     self.mask_x = self.leftLine_x  # self.leftLine_x + (self.mask_width / 2)
     if self.xSpacing == 0.0:
         self.circle_xscale = 1.0
     else:
         self.circle_xscale = self.xSpacing / self.xSpacing * 100.0  # circle is the line itself
         self.circle_x = self.leftLine_x + (self.mask_width / 2)
         self.realMidLine_left_alpha = 0.0
         self.realMidLine_right_alpha = 0.0
 def __init__(self):
     self.rotation = 0
     self.showInArcade = config.get('armorPanel/protractor/showInArcade', False)
     self.useCameraRotation = config.get('armorPanel/protractor/useCameraRotation', True)
     self.circle_xscale = 1
     self.circle_x = 0
     self.atRMax = False
     self.atLMax = False
     self.middleLine_x = 0
     self.x = None
     self.y = None
     self.useProtractorTD = False
     self.useProtractorSPG = False
     self.rightArc = None
     self.heightSPG = 0.0
     self.midX = BigWorld.screenWidth() / 2
     self.midY = BigWorld.screenHeight() / 2
     self.leftArc = None
     self.enable = False
     self.realMidLine_right_alpha = 0.0
     self.realMidLine_left_alpha = 0.0
     self.leftLine_x = 0
     self.mask_x = 0
     self.rightLine_x = 0
     self.mask_width = 0
     self.middleLine_txt_text = ""
     self.leftLine_img = "LeftLine"
     self.rightLine_img = "RightLine"
     self.middleLine_img = "middleLine"
     self.xSpacing = config.get('armorPanel/protractor/xSpacing', 0)
     # self.m2pix = config.get('armorPanel/protractor/m2pix', 40.4761904762)
     self.protractorOffsetWhenTD = config.get('armorPanel/protractor/protractorOffsetWhenTD', 43)
Beispiel #32
0
def BarracksMeta_as_setTankmenS(base, self, data):
    try:
        show_flags = config.get('hangar/barracksShowFlags', True)
        show_skills = config.get('hangar/barracksShowSkills', True)
        if show_flags or show_skills:
            imgPath = 'img://../mods/shared_resources/xvm/res/icons/barracks'
            for tankman in data['tankmenData']:
                if 'role' not in tankman:
                    continue
                tankman['rank'] = tankman['role']
                tankman_role_arr = []
                if show_flags:
                    tankman_role_arr.append("<img src='%s/nations/%s.png' vspace='-3'>" % (imgPath, nations.NAMES[tankman['nationID']]))
                if show_skills:
                    tankman_role_arr.append('')
                    tankman_full_info = g_itemsCache.items.getTankman(tankman['tankmanID'])
                    for skill in tankman_full_info.skills:
                        tankman_role_arr[-1] += "<img src='%s/skills/%s' vspace='-3'>" % (imgPath, skill.icon)
                    if len(tankman_full_info.skills):
                        tankman_role_arr[-1] += "%s%%" % tankman_full_info.descriptor.lastSkillLevel
                    if tankman_full_info.hasNewSkill and tankman_full_info.newSkillCount[0] > 0:
                        tankman_role_arr[-1] += "<img src='%s/skills/new_skill.png' vspace='-3'>x%s" % (imgPath, tankman_full_info.newSkillCount[0])
                    if not tankman_role_arr[-1]:
                        tankman_role_arr[-1] = l10n('noSkills')
                tankman['role'] = ' '.join(tankman_role_arr)
    except Exception as ex:
        err(traceback.format_exc())
    return base(self, data)
def effarmorpanel_sqrt_y():
    if ME_Tank.tankType == "TD":
        APsqrty = config.get("armorPanel/eAP/ordinateWhenTD", 0.70) * (BigWorld.screenHeight() / 2) + 1.0
    elif ME_Tank.tankType == "SPG":
        APsqrty = config.get("armorPanel/protractor/ordinateWhenSPG", 0) * (BigWorld.screenHeight() / 2) + 1.0
    else:
        APsqrty = (config.get("armorPanel/eAP/ordinateWhenTank", 0.8) * (BigWorld.screenHeight() / 2)) + 1.0
    return APsqrty
def readyConfig(section):
    if autoReloadConfig or (section not in hitLogConfig):
        return {'vtype': keyLower(config.get(section + 'vtype', VTYPE)),
                'c:vtype': keyLower(config.get(section + 'c:vtype', C_VTYPE)),
                'c:assist-type': keyLower(config.get(section + 'c:assist-type', C_ASSIST_TYPE)),
                'assist-type': keyLower(config.get(section + 'assist-type', ASSIST_TYPE)),
                }
    else:
        return hitLogConfig[section]
Beispiel #35
0
def BattleLoading_as_setTipTitleS(base, self, title):
    title = cgi.escape('XVM v{}     {}'.format(config.get('__xvmVersion'), config.get('__xvmIntro')))
    stateInfo = config.get('__stateInfo')
    if 'error' in stateInfo:
        title = '<font color="#FF4040">{}</font>'.format(title)
    elif 'warning' in stateInfo:
        title = '<font color="#FFD040">{}</font>'.format(title)
    title = '<p align="left"><font size="16">{}</font></p>'.format(title)
    return base(self, title)
 def showProtractor(self):
     if ME_Tank.tankType == "SPG":
         if config.get('armorPanel/protractor/enableProtractorWhenSPG', True):
             self.enable = True
     elif ME_Tank.tankType == "TD":
         if config.get('armorPanel/eAP/enableProtractorWhenTD', True):
             self.enable = True
     else:
         self.enable = False
Beispiel #37
0
def _HangarCarouselDataProvider__getSupplyIndices(base, self):
    supplyIndices = base(self)
    if config.get('hangar/carousel/hideBuySlot'):
        supplyIndices.pop(_SUPPLY_ITEMS.BUY_SLOT)
        self._supplyItems = [x for x in self._supplyItems if not x.get('buySlot', False)]
    if config.get('hangar/carousel/hideBuyTank') and self._emptySlotsCount:
        supplyIndices.pop(_SUPPLY_ITEMS.BUY_TANK)
        self._supplyItems = [x for x in self._supplyItems if not x.get('buyTank', False)]
    return supplyIndices
Beispiel #38
0
def ArenaBorderController__getCurrentColor(base, self, colorBlind):
    # log('ArenaBorderController = %s' % base(self, colorBlind))
    color = int(config.get('battle/borderColor/color', COLOR), 16)
    alpha = int(config.get('battle/borderColor/alpha', ALPHA))
    red = ((color & 0xff0000) >> 16) / 255.0
    green = ((color & 0x00ff00) >> 8) / 255.0
    blue = (color & 0x0000ff) / 255.0
    alpha = alpha / 100.0
    return red, green, blue, alpha
Beispiel #39
0
def BattleLoading_as_setTipTitleS(base, self, title):
    title = cgi.escape('XVM v{}     {}'.format(config.get('__xvmVersion'), config.get('__xvmIntro')))
    stateInfo = config.get('__stateInfo')
    if 'error' in stateInfo:
        title = '<font color="#FF4040">{}</font>'.format(title)
    elif 'warning' in stateInfo:
        title = '<font color="#FFD040">{}</font>'.format(title)
    title = '<p align="left"><font size="16">{}</font></p>'.format(title)
    return base(self, title)
def _CarouselDataProvider__getSupplyIndices(base, self):
    supplyIndices = base(self)
    if config.get('hangar/carousel/hideBuySlot'):
        supplyIndices.pop(_SUPPLY_ITEMS.BUY_SLOT)
        self._supplyItems = [x for x in self._supplyItems if not x.get('buySlot', False)]
    if config.get('hangar/carousel/hideBuyTank') and self._emptySlotsCount:
        supplyIndices.pop(_SUPPLY_ITEMS.BUY_TANK)
        self._supplyItems = [x for x in self._supplyItems if not x.get('buyTank', False)]
    return supplyIndices
Beispiel #41
0
 def output(self):
     if config.get(self.S_SHOW_HIT_NO_DAMAGE) or data.data['isDamage']:
         self.groupDamages()
         if self.strLastHit:
             if (self.timerLastHit is not None) and self.timerLastHit.isStarted:
                 self.timerLastHit.stop()
             timeDisplayLastHit = float(parser(config.get(self.S_TIME_DISPLAY_LAST_HIT)))
             self.timerLastHit = TimeInterval(timeDisplayLastHit, self, 'hideLastHit')
             self.timerLastHit.start()
             as_event('ON_LAST_HIT')
def _MarkersManager_as_setShowExInfoFlagS(base, self, flag):
    if g_markers.active and config.get('hotkeys/markersAltMode/enabled'):
        global _exInfo
        if config.get('hotkeys/markersAltMode/onHold'):
            _exInfo = flag
        elif flag:
            _exInfo = not _exInfo
        base(self, _exInfo)
    else:
        base(self, flag)
 def isOneLine(self):
     if self.maxCountLines == 0:
         return True
     if self.maxCountLines == 1:
         if self.countLines == 1:
             self.listLog[0] = parser(config.get(self.S_FORMAT_HISTORY, ''))
         else:
             self.listLog.append(parser(config.get(self.S_FORMAT_HISTORY, '')))
         return True
     return False
Beispiel #44
0
def getPreferredAutorotationMode(base, self):
    if config.get('battle/camera/enabled') and config.get('battle/camera/sniper/noCameraLimit/enabled') and config.get('battle/camera/sniper/noCameraLimit/mode') == "full":
        vehicle = BigWorld.entities.get(BigWorld.player().playerVehicleID)
        if vehicle is None:
            return
        else:
            desc = vehicle.typeDescriptor
            isRotationAroundCenter = desc.chassis['rotationIsAroundCenter']
            return isRotationAroundCenter
    return base(self)
Beispiel #45
0
 def showProtractor(self):
     if ME_Tank.tankType == "SPG":
         if config.get('armorPanel/protractor/enableProtractorWhenSPG',
                       True):
             self.enable = True
     elif ME_Tank.tankType == "TD":
         if config.get('armorPanel/eAP/enableProtractorWhenTD', True):
             self.enable = True
     else:
         self.enable = False
Beispiel #46
0
def _MarkersManager_as_setShowExInfoFlagS(base, self, flag):
    if g_markers.active and config.get('hotkeys/markersAltMode/enabled'):
        global _exInfo
        if config.get('hotkeys/markersAltMode/onHold'):
            _exInfo = flag
        elif flag:
            _exInfo = not _exInfo
        base(self, _exInfo)
    else:
        base(self, flag)
Beispiel #47
0
def PlayerAvatar_showVehicleDamageInfo(self, vehicleID, damageIndex, extraIndex, entityID, equipmentID):
    global isImpact
    if config.get(DAMAGE_LOG_ENABLED) and not isEpicBattle:
        if not isImpact and (self.playerVehicleID == vehicleID):
            damageCode = DAMAGE_INFO_CODES[damageIndex]
            isImpact = damageCode not in ['DEVICE_REPAIRED_TO_CRITICAL', 'DEVICE_REPAIRED', 'TANKMAN_RESTORED', 'FIRE_STOPPED']
            if isImpact:
                as_event('ON_IMPACT')
        if (vehicleID == self.playerVehicleID) and config.get(DAMAGE_LOG_ENABLED):
            data.showVehicleDamageInfo(self, vehicleID, damageIndex, extraIndex, entityID, equipmentID)
Beispiel #48
0
 def output(self):
     if config.get(self.S_SHOW_HIT_NO_DAMAGE) or data.data['isDamage']:
         self.groupDamages()
         if self.strLastHit:
             if (self.timerLastHit is not None) and self.timerLastHit.isStarted:
                 self.timerLastHit.stop()
             timeDisplayLastHit = float(parser(config.get(self.S_TIME_DISPLAY_LAST_HIT)))
             self.timerLastHit = TimeInterval(timeDisplayLastHit, self, 'hideLastHit')
             self.timerLastHit.start()
             as_event('ON_LAST_HIT')
Beispiel #49
0
def plugins_makeSettingsVO(base, settingsCore, *keys):
    data = base(settingsCore, *keys)
    if config.get('sight/enabled', True) and battle.isBattleTypeSupported:
        for mode in data:
            if config.get('sight/removeCentralMarker',
                          False) and ('centerAlphaValue' in data[mode]):
                data[mode]['centerAlphaValue'] = 0
            if config.get('sight/removeIndicator', False) and config.get(
                    'sight/removeQuantityShells', False) and ('netAlphaValue'
                                                              in data[mode]):
                data[mode]['netAlphaValue'] = 0
            if config.get('sight/removeLoad', False) and ('reloaderAlphaValue'
                                                          in data[mode]):
                data[mode]['reloaderAlphaValue'] = 0
            if config.get('sight/removeCondition',
                          False) and ('conditionAlphaValue' in data[mode]):
                data[mode]['conditionAlphaValue'] = 0
            if config.get('sight/removeContainers',
                          False) and ('cassetteAlphaValue' in data[mode]):
                data[mode]['cassetteAlphaValue'] = 0
            if config.get('sight/removeLoadingTimer',
                          False) and ('reloaderTimerAlphaValue' in data[mode]):
                data[mode]['reloaderTimerAlphaValue'] = 0
            if config.get('sight/removeZoomIndicator',
                          False) and ('zoomIndicatorAlphaValue' in data[mode]):
                data[mode]['zoomIndicatorAlphaValue'] = 0
    return data
Beispiel #50
0
def _Vehicle_onHealthChanged(self, newHealth, attackerID, attackReasonID):
    if config.get(ENABLED, True) and battle.isBattleTypeSupported:
        if (_data.playerVehicleID == attackerID) and (self.id not in _data.vehDead):
            attacked = _data.player.arena.vehicles.get(self.id)
            if (_data.player.team != attacked['team']) or config.get(SHOW_ALLY_DAMAGE, True):
                if (self.id != attackerID) or config.get(SHOW_SELF_DAMAGE, True):
                    _data.onHealthChanged(self, newHealth, attackerID, attackReasonID)
            else:
                if (self.id == attackerID) and config.get(SHOW_SELF_DAMAGE, True):
                    _data.onHealthChanged(self, newHealth, attackerID, attackReasonID)
        _data.updateVehInfo(self)
Beispiel #51
0
 def readColor(sec, m, xm=None):
     colors = config.get('colors/' + sec)
     if m is not None and colors is not None:
         for val in colors:
             if val['value'] > m:
                 return '#' + val['color'][2:] if val['color'][:2] == '0x' else val['color']
     elif xm is not None:
         colors_x = config.get('colors/x')
         for val in colors_x:
             if val['value'] > xm:
                 return '#' + val['color'][2:] if val['color'][:2] == '0x' else val['color']
Beispiel #52
0
 def setOutParameters(self, numberLine):
     updateValueMacros(self.section, self.dataLog)
     if numberLine == ADD_LINE:
         self.listLog = [parser(config.get(self.S_FORMAT_HISTORY))] + self.listLog
     else:
         self.listLog[numberLine] = parser(config.get(self.S_FORMAT_HISTORY))
     if (self.section == SECTION_LOG) or (self.section == SECTION_LOG_ALT):
         if not config.get(self.S_MOVE_IN_BATTLE):
             self.x = parser(config.get(self.S_X))
             self.y = parser(config.get(self.S_Y))
         self.shadow = shadow_value(self.section)
Beispiel #53
0
 def setOutParameters(self, numberLine):
     updateValueMacros(self.section, self.dataLog)
     if numberLine == ADD_LINE:
         self.listLog = [parser(config.get(self.S_FORMAT_HISTORY))] + self.listLog
     else:
         self.listLog[numberLine] = parser(config.get(self.S_FORMAT_HISTORY))
     if (self.section == SECTION_LOG) or (self.section == SECTION_LOG_ALT):
         if not config.get(self.S_MOVE_IN_BATTLE):
             self.x = parser(config.get(self.S_X))
             self.y = parser(config.get(self.S_Y))
         self.shadow = shadow_value(self.section)
Beispiel #54
0
def onConfigLoaded(self, e=None):
    global cfg_hangar_barracksShowFlags
    cfg_hangar_barracksShowFlags = config.get('hangar/barracksShowFlags', True)

    global cfg_hangar_barracksShowSkills
    cfg_hangar_barracksShowSkills = config.get('hangar/barracksShowSkills', True)

    global cfg_hangar_blockVehicleIfLowAmmo
    cfg_hangar_blockVehicleIfLowAmmo = config.get('hangar/blockVehicleIfLowAmmo', False)

    Vehicle.NOT_FULL_AMMO_MULTIPLIER = config.get('hangar/lowAmmoPercentage', 20) / 100.0
Beispiel #55
0
def Vehicle_onEnterWorld(self, prereqs):
    if self.isPlayerVehicle and config.get('damageLog/enabled'):
        global on_fire, damageLogConfig, autoReloadConfig
        data.isReplay = BattleReplay.isPlaying()
        autoReloadConfig = config.get('autoReloadConfig')
        if not (autoReloadConfig or damageLogConfig):
            for section in SECTIONS:
                damageLogConfig[section] = readyConfig(section)
        on_fire = 0
        data.data['oldHealth'] = self.health
        data.data['maxHealth'] = self.health
Beispiel #56
0
def clampToLimits(base, self, turretYaw, gunPitch):
    if config.get('battle/camera/enabled') and config.get('battle/camera/sniper/noCameraLimit/enabled'):
        if not BigWorld.isKeyDown(KEY_RIGHTMOUSE) and self._SniperAimingSystem__yawLimits is not None and config.get('battle/camera/sniper/noCameraLimit/mode') == "hotkey":
            turretYaw = mathUtils.clamp(self._SniperAimingSystem__yawLimits[0], self._SniperAimingSystem__yawLimits[1], turretYaw)
        getPitchLimits = avatar_getter.getVehicleTypeDescriptor().gun.combinedPitchLimits
        pitchLimits = calcPitchLimitsFromDesc(turretYaw, getPitchLimits)
        adjustment = max(0, self._SniperAimingSystem__returningOscillator.deviation.y)
        pitchLimits[0] -= adjustment
        pitchLimits[1] += adjustment
        gunPitch = mathUtils.clamp(pitchLimits[0], pitchLimits[1] + self._SniperAimingSystem__pitchCompensating, gunPitch)
        return (turretYaw, gunPitch)
    return base(self, turretYaw, gunPitch)
def ME_AP_Vehicle_onEnterWorld(self, prereqs):
    if self.isPlayerVehicle and config.get('armorPanel/enable', True):
        AnglePanel.useProtractorTD = config.get('armorPanel/protractor/enableProtractorWhenTD', False)
        AnglePanel.useProtractorSPG = config.get('armorPanel/protractor/enableProtractorWhenSPG', False)
        debugRender.startBattle()
        ME_Tank.playerVehicleID = self.id
        playerVehicle = BigWorld.entity(self.id)
        ME_Tank.alive = True
        utills.eDebug("ME_AP_Vehicle_onEnterWorld ME_Tank.playerVehicleID:", ME_Tank.playerVehicleID)
        ME_Tank.player = BigWorld.player()
        setup(playerVehicle, ME_Tank.player)
        as_event('ON_ARMOR')
Beispiel #58
0
def _SniperCamera_enable(base, self, targetPos, saveZoom, isRemoteCamera=False):
    #debug('_SniperCamera_enable')
    if config.get('battle/camera/enabled'):
        zoom = config.get('battle/camera/sniper/startZoom')
        if zoom is not None:
            saveZoom = True
        else:
            zoom = self._SniperCamera__cfg['zoom']
        self._SniperCamera__cfg['zoom'] = utils.takeClosest(self._SniperCamera__cfg['zooms'], zoom)

    base(self, targetPos, saveZoom, isRemoteCamera)
    _sendSniperCameraFlash(True, self._SniperCamera__zoom)
Beispiel #59
0
def shadow_value(section, macroes):
    return {'distance': parser(config.get(section + 'shadow/distance'), macroes),
            'angle': parser(config.get(section + 'shadow/angle'), macroes),
            'alpha': parser(config.get(section + 'shadow/alpha'), macroes),
            'blur': parser(config.get(section + 'shadow/blur'), macroes),
            'strength': parser(config.get(section + 'shadow/strength'), macroes),
            'color': parser(config.get(section + 'shadow/color'), macroes),
            'hideObject': parser(config.get(section + 'shadow/hideObject'), macroes),
            'inner': parser(config.get(section + 'shadow/inner'), macroes),
            'knockout': parser(config.get(section + 'shadow/knockout'), macroes),
            'quality': parser(config.get(section + 'shadow/quality'), macroes)
            }
def xvm_team_strength(a, e):
    try:
        invalid_values = ['', '-']
        if a in invalid_values or e in invalid_values:
            return ''
        sign = '&gt;' if float(a) > float(e) else '&lt;' if float(a) < float(e) else '='
        ca = utils.brighten_color(int(config.get('colors/system/ally_alive'), 0), 50)
        ce = utils.brighten_color(int(config.get('colors/system/enemy_alive'), 0), 50)
        value = '<font color="#{:06x}">{}</font> {} <font color="#{:06x}">{}</font>'.format(ca, a, sign, ce, e)
        return value
    except Exception as ex:
        debug(traceback.format_exc())
        return ''