def __onBuyFullCollection(self, *_): collectionStrID = YEARS_INFO.getCollectionSettingID( self._collectionType, self._collectionBuilder.YEAR_NAME) collectionID = YEARS_INFO.getCollectionIntID(collectionStrID) builder = AlbumCollectionDialogBuilder(collectionID) self.__confirmationWindow = builder.build(withBlur=True) result = yield BuyCollectionProcessor( collectionID, self.__confirmationWindow).request() self.__confirmationWindow = None if result.userMsg: SystemMessages.pushI18nMessage( result.userMsg, type=result.sysMsgType, priority=NotificationPriorityLevel.MEDIUM) if not self.isLoaded or not result.success: return else: with self.viewModel.transaction() as model: for toyRenderer in model.getToys(): if not toyRenderer.getIsInCollection(): toyRenderer.setIsNew(True) toyRenderer.setIsInCollection(True) model.setCollectedToysCount(model.getTotalToysCount()) model.setCurrentRankToysCount(model.getTotalRankToysCount()) model.setIsCollectionFull(True) self.__updateShards() return
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
def getCollectionLevelByName(cls, collectionName): config = getBonusConfig() requester = cls._itemsCache.items.festivity collectionDistrs = requester.getCollectionDistributions() collectionStrID = YEARS_INFO.getCollectionSettingID( collectionName, YEARS_INFO.CURRENT_YEAR_STR) collectionID = YEARS_INFO.getCollectionIntID(collectionStrID) return config.getCollectionLevel( collectionDistrs[collectionID]) if requester.isSynced() else 0
def readCollectionRewards(xmlPath): cache = {} with openSection(xmlPath) as section: if section is None: raise NYSoftException("Can't open '%s'" % xmlPath) for reward in section.values(): rewardID = reward.readString('id') collName = reward.readString('collection') if rewardID in cache: raise NYSoftException("Repeated boxID '%s'" % rewardID) prefix = rewardID[:4] year = prefix[2:4] collectionStrID = YEARS_INFO.getCollectionSettingID( collName, prefix) cache[rewardID] = collectionStrID cache[collectionStrID] = rewardID cache[collName + year] = rewardID return cache
def __getCollectionIntID(self): collectionStrID = YEARS_INFO.getCollectionSettingID( self.__collectionName, self.__yearName) return new_year.g_cache.collections[collectionStrID]
def getToySettingID(toyID=None, toyDescr=None): if toyDescr is None: toyDescr = g_cache.toys[toyID] return YEARS_INFO.getCollectionSettingID(toyDescr.setting, toyDescr.collection)