Example #1
0
 def __invalidate(self, year, collection):
     self.__yearName = year
     self.__collectionName = collection or YEARS_INFO.getCollectionTypesByYear(
         year, useMega=True)[0]
     with self.viewModel.transaction() as model:
         self.__updateState(model)
         self.__updateStyleInfo(model)
Example #2
0
def getCollectionByStrID(collectionStrID):
    year, settingID = YEARS_INFO.splitCollectionStrID(collectionStrID)
    if settingID < 0:
        return (None, None)
    else:
        collectionName = YEARS_INFO.getCollectionTypesByYear(year)[settingID]
        return (year, collectionName)
Example #3
0
    def getCollectionsFactor(cls):
        result = 0
        for name in YEARS_INFO.getCollectionTypesByYear(
                YEARS_INFO.CURRENT_YEAR, useMega=False):
            result += cls.getCollectionFactor(name)

        return result
Example #4
0
    def getCollectionLevels(cls):
        result = {}
        for collectionName in YEARS_INFO.getCollectionTypesByYear(
                YEARS_INFO.CURRENT_YEAR, useMega=False):
            result[collectionName] = cls.getCollectionLevelByName(
                collectionName)

        return result
Example #5
0
    def getCollectionSettingsIDs(cls, useMega=False):
        result = []
        for settingName in YEARS_INFO.getCollectionTypesByYear(
                cls._YEAR, useMega=useMega):
            result.append(
                YEARS_INFO.getCollectionIntID(
                    YEARS_INFO.getCollectionSettingID(settingName, cls._YEAR)))

        return result
Example #6
0
    def isRegularToysCollected(self):
        collectionDistribution = self._itemsCache.items.festivity.getCollectionDistributions(
        )
        for collectionName in YEARS_INFO.getCollectionTypesByYear(
                YEARS_INFO.CURRENT_YEAR_STR, useMega=False):
            collectionID = YEARS_INFO.CURRENT_SETTING_IDS_BY_NAME[
                collectionName]
            expectedToyCount = new_year.g_cache.toyCountByCollectionID[
                collectionID]
            collectedToyCount = sum(collectionDistribution[collectionID])
            if expectedToyCount != collectedToyCount:
                return False

        return True
Example #7
0
def _readToy(section, collectionName=None):
    cfg = {intern('collection'): collectionName} if collectionName else {}
    toyData = {
        intern(name):
        (section.readInt(name) if name in ('id', 'rank') else intern(
            section.readString(name)))
        for name, subsection in section.items()
    }
    if collectionName and collectionName != 'defaultToys':
        if not MIN_TOY_RANK <= toyData[
                'rank'] <= YEARS_INFO.getMaxToyRankByYear(collectionName):
            raise NYSoftException(
                'Invalid toy rank, toy collection:{}, toy id: {}'.format(
                    collectionName, toyData['id']))
        if toyData['setting'] not in YEARS_INFO.getCollectionTypesByYear(
                collectionName):
            raise NYSoftException(
                'Invalid setting, toy collection:{}, toy id: {}'.format(
                    collectionName, toyData['id']))
    cfg.update(toyData)
    return cfg
Example #8
0
 def getCollectionTypes(cls):
     return YEARS_INFO.getCollectionTypesByYear(cls._YEAR, useMega=False)
Example #9
0
def _getMaxCollectionLevels():
    toyCollections = YEARS_INFO.getCollectionTypesByYear(
        YEARS_INFO.CURRENT_YEAR, useMega=False)
    maxBonusLevel = len(getBonusConfig().getCollectionLevelsRating()) - 1
    return {collectionName: maxBonusLevel for collectionName in toyCollections}