Exemplo n.º 1
0
 def getCrewBoosterAction(self, isPerkReplace):
     if not self.isCrewBooster():
         raise SoftException(
             'This action description is only for Crew Booster!')
     token = _TOKEN_CREW_PERK_REPLACE if isPerkReplace else _TOKEN_CREW_PERK_BOOST
     return i18n.makeString(
         ARTEFACTS.getCrewActionForBattleBooster(self.name, token))
Exemplo n.º 2
0
 def getCrewBoosterAction(self, isPerkReplace):
     """
     Constructs 'action' description for crew booster. It is used in tooltip and booster
     buy window. The text is little bit different than in 'getCrewBoosterDescription' method
     :param isPerkReplace: should 'perk replace' or 'perk boost' text be returned
     :return: string without formatting
     """
     raise self.isCrewBooster() or AssertionError(
         'This action description is only for Crew Booster!')
     token = _TOKEN_CREW_PERK_REPLACE if isPerkReplace else _TOKEN_CREW_PERK_BOOST
     return i18n.makeString(
         ARTEFACTS.getCrewActionForBattleBooster(self.name, token))
Exemplo n.º 3
0
    def getOptDeviceBoosterDescription(self, vehicle, valueFormatter=None):
        if self.isCrewBooster():
            raise SoftException('This description is only for Opt. Dev. Booster!')
        deviceType = _TOKEN_OPT_DEVICE_SIMPLE
        if vehicle is not None:
            for device in vehicle.optDevices:
                if self.isOptionalDeviceCompatible(device) and device.isDeluxe():
                    deviceType = _TOKEN_OPT_DEVICE_DELUXE
                    break

        gain = i18n.makeString(ARTEFACTS.getDeviceGainForBattleBooster(self.name, deviceType))
        formatted = valueFormatter(gain) if valueFormatter is not None else gain
        return self.shortDescription % formatted
Exemplo n.º 4
0
    def getOptDeviceBoosterGainValue(self, vehicle):
        if self.isCrewBooster():
            raise SoftException(
                'This description is only for Opt. Dev. Booster!')
        deviceType = _TOKEN_OPT_DEVICE_SIMPLE
        if vehicle is not None:
            for device in vehicle.optDevices.installed:
                if self.isOptionalDeviceCompatible(device) and device.isDeluxe:
                    deviceType = _TOKEN_OPT_DEVICE_DELUXE
                    break

        gain = i18n.makeString(
            ARTEFACTS.getDeviceGainForBattleBooster(self.name, deviceType))
        return gain
Exemplo n.º 5
0
    def getOptDeviceBoosterDescription(self, vehicle, valueFormatter=None):
        """
        Constructs booster description for an optional device.
        The gain value is depending on type of opt. device: regular or deluxe
        :param vehicle: information is gathered from this object.
        :param valueFormatter: pass function to format the result, None - without formatting
        :return: formatted string
        """
        raise not self.isCrewBooster() or AssertionError(
            'This description is only for Opt. Dev. Booster!')
        deviceType = _TOKEN_OPT_DEVICE_SIMPLE
        if vehicle is not None:
            for device in vehicle.optDevices:
                if self.isOptionalDeviceCompatible(
                        device) and device.isDeluxe():
                    deviceType = _TOKEN_OPT_DEVICE_DELUXE
                    break

        gain = i18n.makeString(
            ARTEFACTS.getDeviceGainForBattleBooster(self.name, deviceType))
        formatted = valueFormatter(
            gain) if valueFormatter is not None else gain
        return self.shortDescription % formatted