def open(self): ensure_imports() spells = spell.spells() rarity = get_rarity(self.min_rarity, self.max_rarity) while rarity >= 0: lst = [s.id for s in spells if s.drop and self.min_level <= s.level <= self.max_level and s.rarity == rarity] if len(lst) > 0: break rarity -= 1 self.spell_id = random.choice(lst) return CardLoot.open(self)
def shop(user): res = {"shop": [s.js() for s in spell.spells() if s.shop and s.level <= user["level"]]} res.update(user.js_deck()) return res