def __init__(self): # Public self.name = "" self.image = "" self.characters = [] self.sorted = False self.multi = 10 # Private self.__lr = [] self.__ur = [] self.__ssr = [] self.__sr = [] self.__r = [] self.__n = [] # Droprate as % self.__lr_droprate = 0.07 self.__ur_droprate = 3 self.__ssr_droprate = 15 self.__sr_droprate = 33 self.__r_droprate = 50 self.__n_droprate = 100 # tool self.__global_tool = GlobalTool()
def __init__(self, client): self.client = client self.global_tool = GlobalTool() # Private self.__dragonstone = 5 self.__zeni = 10000 self.__experience = 0 self.__combo_rate = 1.2 # +20 % self.__tool_time = ToolTime() self.__time_hourly = 3600 self.__time_combo = 7200
def __init__(self, client): """:param client: (`discord.ext.commands.Bot`)""" # Public self.client = client self.reference = 0 # Info self.name = "" self.icon = "" # Private self.__database = client.database self.__global_tool = GlobalTool()
def __init__(self, client): self.client = client self.global_tool = GlobalTool() self.reference = 0 self.name = "" self.description = "" self.difficulty = 1 self.opponent = [] self.opponent_lvl = 1 self.experience = None self.zenis = None self.dragonstone = None self.capsule = None
def __init__(self, context, client, player): """:param context: (`discord.ext.commands.Context`) :param client: (`discord.ext.commands.Bot`) :param player: (`Player`)""" # Public self.client = client self.context = context self.player = player self.game_icon = GameIcon() # Info self.name = "" self.icon = "" self.reference = 0 self.unique_id = "" # Rewards self.dragonstone = 0 self.zeni = 0 self.experience = 0 self.item = [] # Rate # As % # One of the rates must be 100 as we eliminate self.rate_dragonstone = 0 self.rate_zeni = 0 self.rate_experience = 0 self.rate_item = 0 # Reward gap self.reward_gap = 0.9 # 10 % # Private self.__database = self.client.database self.__global_tool = GlobalTool() # Generation % self.__gen_n = 100 self.__gen_r = 66 self.__gen_sr = 33 self.__gen_ssr = 16.5 self.__gen_ur = 8.25 self.__gen_lr = 3
async def box(self, context, rarity: str = None): # Log await self.client.logger.log(context) # Init player = Player(context, self.client, context.message.author) box_tool = ToolBox(self.client, context) global_tool = GlobalTool() # Normal box if rarity is None: await box_tool.box_manager(player) else: # Get the rarity value value = await global_tool.get_rarity_value(rarity) if value is not None: await box_tool.box_manager(player, rarity=value) else: await context.send(f"Sorry, I can't find the rarity `{rarity}`" )
async def recycle(self, context, rarity=None): """Allows the player to recycle his characters""" tool = GlobalTool() player = Player(context, self.client, context.message.author) characters = [] generated_shards = 0 deleted_amount = 0 # Get the rarity value if specified if rarity is not None: rarity = await tool.get_rarity_value(rarity) if rarity is None: await context.send(f":x: Unknown rarity `{rarity}`") return # If the rarity passed is correct if rarity is not None: # Get all the character with the passed rarity characters = await self.client.database.fetch_row(""" SELECT reference, character_rarity, character_unique_id FROM character_unique WHERE character_rarity = $1 AND character_owner_id = $2 AND locked = false; """,[rarity, player.id]) else: characters = await self.client.database.fetch_row( """ SELECT reference, character_rarity, character_unique_id FROM character_unique WHERE character_owner_id = $1 AND locked = false; """, [player.id] ) # Generate and delete characters deleted_amount = len(characters) shop = ToolShop(self.client, context) waiting_msg = await context.send("Recycling your characters ...") for character in characters: await asyncio.sleep(0) reference = character[0] rarity = character[1] unique = character[2] # If the character is not in the shop if not await shop.find_character(unique): if rarity == 0: generated_shards += self.__n elif rarity == 1: generated_shards += self.__r elif rarity == 2: generated_shards += self.__sr elif rarity == 3: generated_shards += self.__ssr elif rarity == 4: generated_shards += self.__ur elif rarity == 5: generated_shards += self.__lr # Remove the character from the character unique await self.client.database.execute( """ DELETE FROM character_unique WHERE reference = $1; """, [reference] ) else: deleted_amount -= 1 # Add the shards to the player's resources player_shard = await self.client.database.fetch_value( """ SELECT player_dragonstone_shard FROM player_resource WHERE player_id = $1; """, [player.id] ) new_shard = player_shard + generated_shards await self.client.database.execute( """ UPDATE player_resource SET player_dragonstone_shard = $1 WHERE player_id = $2; """, [new_shard, player.id] ) # Send message await waiting_msg.delete() await context.send(f"♻️ You have recycled **{deleted_amount:,}** characters and generated **{generated_shards:.2f}** {GameIcon().dragonstone}") # Add the dragonstone to the player added_ds = int(await player.resource.get_dragonstone_shard()) await player.resource.add_dragonstone(added_ds) # Remove the shard await player.resource.remove_dragonstone_shard(added_ds)
def __init__(self, client): self.client = client self.icon = GameIcon() self.tool = GlobalTool() self.rarity = ['n', 'r', "sr", "ssr", "ur", "lr"]