Exemplo n.º 1
0
    def getDeltaParams(self, paramName, paramValue):
        """
        Calculates delta and return it in formatted HTML string
        :param paramName: parameter name as string ('damage', 'turretArmor', etc...)
        :param paramValue: parameter value
        :return: formatted HTML string
        """
        params = self.getParams()
        if paramName in params:
            pInfo = getParamExtendedData(paramName, params[paramName],
                                         paramValue)
            states = pInfo.state
            if isinstance(pInfo.value, (tuple, list)):
                deltaVals = []
                isTheSame = True
                for st in states:
                    diff = st[1]
                    isTheSame = isTheSame and diff == 0
                    deltaVals.append(diff)

                if isTheSame:
                    return None
            else:
                deltaVals = states[1]
            return formatters.formatParameter(pInfo.name, deltaVals, states,
                                              _DELTA_PARAM_COLOR_SCHEME,
                                              _CMP_FORMAT_SETTINGS, False)
        else:
            return None
Exemplo n.º 2
0
 def extractBonus(self, bonusGroup, bonusID):
     oldValue = self.__currValue
     self.__vehicle = _VEHICLE_MODIFIERS[bonusGroup](self.__vehicle, bonusID)
     if bonusGroup == 'extra' and bonusID == EXTRAS_CAMOUFLAGE:
         self.__removeCamouflage = True
     self.__updateCurrValue()
     return getParamExtendedData(self.__paramName, oldValue, self.__currValue)
Exemplo n.º 3
0
 def getExtendedData(self, paramName):
     isInvertedValue = paramName in _BACKWARD_QUALITY_PARAMS or None
     return getParamExtendedData(paramName,
                                 self._currentParams.get(paramName),
                                 self._otherParams.get(paramName),
                                 self._getPenaltiesAndBonuses(paramName),
                                 customQualityParams=isInvertedValue)
    def getDeltaParams(self, paramName, paramValue):
        """
        Calculates delta and return it in formatted HTML string
        :param paramName: parameter name as string ('damage', 'turretArmor', etc...)
        :param paramValue: parameter value
        :return: formatted HTML string
        """
        params = self.getParams()
        if paramName in params:
            pInfo = getParamExtendedData(paramName, params[paramName], paramValue)
            states = pInfo.state
            if isinstance(pInfo.value, (tuple, list)):
                deltaVals = []
                isTheSame = True
                for st in states:
                    diff = st[1]
                    isTheSame = isTheSame and diff == 0
                    deltaVals.append(diff)

                if isTheSame:
                    return None
            else:
                deltaVals = states[1]
            return formatters.formatParameter(pInfo.name, deltaVals, states, _DELTA_PARAM_COLOR_SCHEME, _CMP_FORMAT_SETTINGS)
        else:
            return None
 def getDeltaParams(self, paramName, paramValue):
     params = self.getParams()
     if paramName in params:
         pInfo = getParamExtendedData(paramName, params[paramName],
                                      paramValue)
         return formatters.formatParameterDelta(pInfo,
                                                _DELTA_PARAM_COLOR_SCHEME,
                                                _CMP_FORMAT_SETTINGS)
Exemplo n.º 6
0
 def getDeltaParams(self, paramName, paramValue):
     """
     Calculates delta and return it in formatted HTML string
     :param paramName: parameter name as string ('damage', 'turretArmor', etc...)
     :param paramValue: parameter value
     :return: formatted HTML string
     """
     params = self.getParams()
     if paramName in params:
         pInfo = getParamExtendedData(paramName, params[paramName], paramValue)
         return formatters.formatParameterDelta(pInfo, _DELTA_PARAM_COLOR_SCHEME, _CMP_FORMAT_SETTINGS)
Exemplo n.º 7
0
 def __extractBonus(self, bonusGroup, bonusID):
     """
     Remove bonus influence factor by vehicle modification and save previous params,
     return _ParameterInfo which contains parameters diffs
     """
     oldValue = self.__currValue
     self.__vehicle = _VEHICLE_MODIFIERS[bonusGroup](self.__vehicle,
                                                     bonusID)
     if bonusGroup == 'extra' and bonusID == EXTRAS_CAMOUFLAGE:
         self.__removeCamouflage = True
     self.__updateCurrValue()
     return getParamExtendedData(self.__paramName, oldValue,
                                 self.__currValue)