def __readCondition_cumulative(self, _, section, node):
     for name, sub in section.items():
         if name not in battle_results_shared.VEH_FULL_RESULTS.names() and name not in battle_results_shared.VEH_BASE_RESULTS.names():
             raise SoftException("Unsupported misc variable '%s'" % name)
         node.addChild((name, int(sub.asFloat)))
 def setUniqueName(self, name):
     raise SoftException('This method is not implemented')
 def checkPointsList(path):
     if len(points[path]) != self.getTeamSize():
         raise SoftException('BattlePass len(season/points/{}/{}) {} != {}'.format(self.bonusType, path, points[path], self.getTeamSize()))
 def loadView(self, loadParams, *args, **kwargs):
     if loadParams.uiImpl == UIFrameworkImpl.UNBOUND:
         return self.__doLoadUBView(loadParams, *args, **kwargs)
     if loadParams.uiImpl == UIFrameworkImpl.SCALEFORM:
         return self.__doLoadSFView(loadParams, *args, **kwargs)
     raise SoftException('View can not be loaded. UI implementation "{}" is not handled'.format(loadParams.uiImpl))
Esempio n. 5
0
def _validateItemsRequiredFields(items):
    if not all((REQUIRED_ITEM_FIELDS.issubset(item) for item in items)):
        raise SoftException('Invalid item preview spec')
Esempio n. 6
0
 def status(self, value):
     if value not in GiftStatus.ALL:
         raise SoftException('Wrong status', value)
     self._status = value
Esempio n. 7
0
 def content(self, content):
     if content is not None and not isinstance(content, View):
         raise SoftException('Content should be View class or extends it')
     self.__proxy.content = getProxy(content)
     return
Esempio n. 8
0
 def getPathByStateName(self, stateName):
     path = getattr(self, stateName, None)
     if path is None:
         raise SoftException('State {} is not found'.format(stateName))
     return path
Esempio n. 9
0
 def _makeQueueCtxByAction(self, action=None):
     invID = g_currentVehicle.invID
     if not invID:
         raise SoftException('Inventory ID of vehicle can not be zero')
     return RankedQueueCtx(invID, waitingID='prebattle/join')
 def readFromInternalFile(self, path, curTime):
     ResMgr.purge(path)
     section = ResMgr.openSection(path)
     if section is None:
         raise SoftException("Can not open '%s'" % path)
     return {} if not section.has_key('quests') else self.__readXML(section['quests'], curTime)
Esempio n. 11
0
 def makeString(cls, key):
     raise SoftException('Unexpected call "i18n.makeString"')
 def __readCondition_IGRType(self, _, section, node):
     igrType = section.asInt
     if igrType not in IGR_TYPE.RANGE:
         raise SoftException('Invalid IGR type %s' % (igrType,))
     node.addChild(igrType)
 def __readCondition_attackReason(self, _, section, node):
     attackReason = section.asInt
     if not 0 <= attackReason < len(ATTACK_REASONS):
         raise SoftException('Invalid attack reason index')
     node.addChild(section.asInt)
 def __readCondition_keyResults(self, _, section, node):
     name = section.asString
     if name not in battle_results_shared.VEH_BASE_RESULTS.names() and name not in battle_results_shared.COMMON_RESULTS.names() and name not in battle_results_shared.VEH_FULL_RESULTS.names() and name not in battle_results_shared.AVATAR_BASE_RESULTS.names() and name not in battle_results_shared.AVATAR_FULL_RESULTS.names() and name != 'addQuestCompleted':
         raise SoftException("Unsupported battle result variable '%s'" % name)
     node.addChild(name)
Esempio n. 15
0
def createInstallableItem(itemTypeID, nationID, itemID, name):
    if itemTypeID in _TYPE_ID_TO_CLASS:
        clazz = _TYPE_ID_TO_CLASS[itemTypeID]
        return clazz(itemTypeID, (nationID, itemID), name, makeIntCompactDescrByID(ITEM_TYPE_NAMES[itemTypeID], nationID, itemID))
    raise SoftException('Item can not be created by type {}'.format(itemTypeID))
Esempio n. 16
0
    def __getInitialVO(self):
        vehicle = self.itemsCache.items.getItemByCD(self.__vehicleIntCD)
        isEnoughStatuses = getMoneyVO(
            Money.makeFromMoneyTuple((True, True, True)))
        rentalTermSlots = []
        isRestoreAvailable = vehicle.isRestoreAvailable()
        if isRestoreAvailable:
            enabled = isRestoreAvailable or not (constants.IS_CHINA
                                                 and vehicle.rentalIsActive)
            rentalTermSlots.append({
                'itemId':
                -1,
                'label':
                i18n.makeString(STORE.BUYVEHICLEWINDOW_RESTORE),
                'price':
                getItemPricesVO(
                    ItemPrice(vehicle.restorePrice, vehicle.restorePrice)),
                'enabled':
                enabled,
                'selected':
                self.__selectedRentID <= _NOT_RENT_IDX,
                'isEnoughStatuses':
                isEnoughStatuses
            })
        rentPackages = vehicle.rentPackages
        currentSeasonRent = vehicle.currentSeasonRent
        isSeasonRented = currentSeasonRent is not None
        for rentPackageIdx, rentPackage in enumerate(rentPackages):
            rentID = rentPackage['rentID']
            rentType, packageID = parseRentID(rentID)
            if rentType == constants.RentType.TIME_RENT:
                days = packageID
                standardRentDays = STORE.getRentTermDays(days)
                if standardRentDays is not None:
                    label = standardRentDays
                else:
                    label = i18n.makeString(
                        STORE.RENTALTERMSELECTIONPOPOVER_TERMSLOTANY,
                        days=days)
                inMaxRentTime = isWithinMaxRentTime(vehicle.maxRentDuration,
                                                    vehicle.rentLeftTime, days)
                enabled = not isSeasonRented and inMaxRentTime
            elif rentType in (constants.RentType.SEASON_RENT,
                              constants.RentType.SEASON_CYCLE_RENT):
                seasonType = rentPackage['seasonType']
                label = i18n.makeString(
                    _SEASON_RENT_TERMS[seasonType][rentType])
                if rentType == constants.RentType.SEASON_RENT:
                    enabled = not isSeasonRented or isSeasonRented and currentSeasonRent.duration == SeasonRentDuration.SEASON_CYCLE
                else:
                    enabled = not isSeasonRented
            else:
                raise SoftException(
                    'Unsupported rental type [{}]!'.format(rentType))
            price = ItemPrice(rentPackage['rentPrice'],
                              rentPackage['defaultRentPrice'])
            rentalTermSlots.append({
                'itemId': rentPackageIdx,
                'label': label,
                'price': getItemPricesVO(price),
                'enabled': enabled,
                'selected': self.__selectedRentID == rentID,
                'isEnoughStatuses': isEnoughStatuses
            })

        if not isRestoreAvailable:
            enabled = not vehicle.isDisabledForBuy and not vehicle.isHidden
            rentalTermSlots.append({
                'itemId':
                _NOT_RENT_IDX,
                'label':
                i18n.makeString(
                    STORE.RENTALTERMSELECTIONPOPOVER_TERMSLOTUNLIM),
                'price':
                getItemPricesVO(vehicle.buyPrices.itemPrice),
                'enabled':
                enabled,
                'selected':
                self.__selectedRentID <= _NOT_RENT_IDX,
                'isEnoughStatuses':
                isEnoughStatuses
            })
        return {
            'titleLabel':
            text_styles.highTitle(STORE.RENTALTERMSELECTIONPOPOVER_TITLELABEL),
            'rentalTermSlots':
            rentalTermSlots
        }
def _validateVehicle(vehicle):
    if not isinstance(vehicle, Vehicle):
        raise SoftException(
            'vehicle has to be valid gui_items.Vehicle, got: {}'.format(
                vehicle))
Esempio n. 18
0
 def lock(self):
     if not self.tryLock():
         raise SoftException('Lock is already locked!')
Esempio n. 19
0
 def decorator(self, decorator):
     if decorator is not None and not isinstance(decorator, View):
         raise SoftException('Decorator should be View class or extends it')
     self.__proxy.decorator = getProxy(decorator)
     return
 def _validateIndex(self, idx):
     if idx >= self.getCapacity():
         raise SoftException('Index {} exceeds the layout size!'.format(idx))
Esempio n. 21
0
 def parent(self, parent):
     if parent is not None and not isinstance(parent, Window):
         raise SoftException('Content should be Window class or extends it')
     self.__proxy.parent = getProxy(parent)
     return
 def _validateType(self, item):
     if item is not None and item.itemTypeID != self.__guiItemType:
         raise SoftException('The item {} is not suitable for {}!'.format(item, self))
     return
Esempio n. 23
0
def _doesVehicleCDExist(vehicleCD):
    itemTypeID, nationID, innationID = vehicles.parseIntCompactDescr(vehicleCD)
    if itemTypeID == GUI_ITEM_TYPE.VEHICLE and innationID in vehicles.g_list.getList(nationID):
        return True
    raise SoftException('Invalid vehicle CD: %d' % vehicleCD)
 def getSlot(self, slotIdx):
     if slotIdx < 0 or slotIdx >= len(self.slots):
         raise SoftException('Wrong slotIdx=[%r]' % slotIdx)
     return OptDeviceSlotData(self._dynSlotType, True) if self._dynSlotType and self.isSlotHasDynamicSpecialization(slotIdx) else OptDeviceSlotData(self.slots[slotIdx], False)
 def setAlias(self, alias):
     raise SoftException('This method is not implemented')
def _getSymOrderIdx(symbol):
    if not isinstance(symbol, types.UnicodeType):
        raise SoftException('')
    symIdx = ord(symbol)
    return _g_alphabetOrderExcept.get(symIdx, symIdx)
 def setCurrentScope(self, scope):
     raise SoftException('This method is not implemented')
 def init():
     for caps in ARENA_BONUS_TYPE_CAPS._typeToCaps.itervalues():
         for rule in ARENA_BONUS_TYPE_CAPS.__RULES:
             if not rule(caps):
                 raise SoftException('Caps is invalid')
 def checkPointsList(pointsList, path):
     if len(pointsList) != self.getTeamSize():
         raise SoftException('BattlePass len(season/points/{}) {} != {}'.format(path, len(pointsList), self.getTeamSize()))
 def __readCritName(self, _, section, node):
     critName = section.asString
     if critName not in vehicles.VEHICLE_DEVICE_TYPE_NAMES + vehicles.VEHICLE_TANKMAN_TYPE_NAMES:
         raise SoftException('Invalid crit name (%s)' % critName)
     node.addChild(critName)