def isInCollection(self): toyCollection = self._itemsCache.items.festivity.getToyCollection() toyID = self.getID() bytePos = YEARS_INFO.getToyCollectionOffsetForYear(self.COLLECTION_NAME) + toyID / 8 mask = 1 << toyID % 8 return True if toyCollection[bytePos] & mask else False
def getToyMask(toyID, year): offset = YEARS_INFO.getToyCollectionOffsetForYear(year) bytePos = offset + toyID / 8 mask = 1 << toyID % 8 return (bytePos, mask)