예제 #1
0
    async def start(self):
        # Edit to dungeon selection embed
        await self.setup_msg.edit(embed=self.dungeonembed)

        def dungeon_check(m):
            return m.author == self.ctx.author and m.channel == self.ctx.channel and m.content.isdigit(
            )

        # Wait for author to select a dungeon
        while True:
            try:
                msg = await self.client.wait_for('message',
                                                 timeout=60,
                                                 check=dungeon_check)
            except asyncio.TimeoutError:
                embed = discord.Embed(
                    title="Timed out!",
                    description="You didn't choose a dungeon in time!",
                    color=discord.Color.red())
                await self.setup_msg.clear_reactions()
                return await self.setup_msg.edit(embed=embed)

            if msg.content.isdigit():
                if int(msg.content) == -1:
                    embed = discord.Embed(
                        title="Cancelled!",
                        description="You chose to cancel this afk creation.",
                        color=discord.Color.red())
                    await self.setup_msg.clear_reactions()
                    return await self.setup_msg.edit(embed=embed)
                if 0 < int(msg.content) < 57:
                    break
            await self.ctx.send("Please choose a number between 1-56!",
                                delete_after=7)

        # Grab dungeon info from utils
        self.dungeon_info = utils.dungeon_info(int(msg.content))
        self.dungeontitle = self.dungeon_info[0]
        self.emojis = self.dungeon_info[1]
        try:
            await msg.delete()
        except discord.NotFound:
            pass

        await self.start_afk()
예제 #2
0
def dungeon_select(hc=False, manual_log=False):
    descrip = "Please select a dungeon type by typing the number corresponding to the  dungeon for which you would like to start a raid.\n" \
              "To start a random dungeon headcount type: `(0)` <:defaultdungeon:682212333182910503> Random Dungeons." if hc else \
        "Please select the dungeon type of the raid you did." if manual_log else \
        "Please select a dungeon type by typing the number corresponding to the  dungeon for which you would like to start a raid.\nType `-1` to cancel."

    embed = discord.Embed(title="Dungeon Selection",
                          description=descrip,
                          color=discord.Color.orange())
    dungeons = utils.dungeon_info()
    endgame = ""
    realmrelated = ""
    midtier = ""
    lowtier = ""
    other = ""
    mini = ""
    events = ""
    for i, d in enumerate(dungeons.values(), 1):
        if i < 10:
            endgame += f"`({i})` {d[1][0]} {d[0]}\n"
        elif i < 19:
            realmrelated += f"`({i})` {d[1][0]} {d[0]}\n"
        elif i < 29:
            midtier += f"`({i})` {d[1][0]} {d[0]}\n"
        elif i < 39:
            lowtier += f"`({i})` {d[1][0]} {d[0]}\n"
        elif i < 47:
            other += f"`({i})` {d[1][0]} {d[0]}\n"
        elif i < 57:
            mini += f"`({i})` {d[1][0]} {d[0]}\n"
        else:
            events += f"`({i})` {d[1][0]} {d[0]}\n"

    embed.add_field(name="Endgame Dungeons", value=endgame, inline=True)
    embed.add_field(name="Realm-Related Dungeons",
                    value=realmrelated,
                    inline=True)
    embed.add_field(name="Mid-Tier Dungeons", value=midtier, inline=True)
    embed.add_field(name="Low-Tier Dungeons", value=lowtier, inline=True)
    embed.add_field(name="Misc. Dungeons", value=other, inline=True)
    embed.add_field(name="Mini Dungeons", value=mini, inline=True)
    # embed.add_field(name="Events", value=events)
    return embed
예제 #3
0
    async def start(self):
        await self.setup_msg.edit(embed=self.dungeonembed)

        def dungeon_check(m):
            return m.author == self.ctx.author and m.channel == self.ctx.channel and m.content.isdigit(
            )

        while True:
            try:
                msg = await self.client.wait_for('message',
                                                 timeout=60,
                                                 check=dungeon_check)
            except asyncio.TimeoutError:
                embed = discord.Embed(
                    title="Timed out!",
                    description="You didn't choose a dungeon in time!",
                    color=discord.Color.red())
                await self.setup_msg.clear_reactions()
                return await self.setup_msg.edit(embed=embed)
            if -1 < int(msg.content) < 56 or 60 < int(msg.content) < 62:
                break
            await self.ctx.send(
                "Please choose a number between 0-55 or 61-62!",
                delete_after=7)

        self.keyed_run = False
        num = int(msg.content)
        if num == 0:
            self.dungeontitle = "Random Dungeons"
            self.emojis = utils.rand_dungon_keys()
            self.thumbnail = "https://static.drips.pw/rotmg/wiki/Environment/Portals/Rainbow%20Road.png"
            await msg.delete()
            await self.setup_msg.delete()
            embed = embeds.headcount_base(self.dungeontitle,
                                          self.ctx.author,
                                          False,
                                          self.emojis, [],
                                          thumbnail=self.thumbnail)
            embed.description = f"React to {self.emojis[0]} to participate in the run!\nIf you have keys, react to the appropriate emojis " \
                                f"below!"
            hcmsg = await self.hcchannel.send(
                f"@here Headcount for `{self.dungeontitle}` {self.emojis[0]} started by "
                f"{self.ctx.author.mention} for {self.vcchannel.name}",
                embed=embed)
            for emoji in self.emojis[:20]:
                await hcmsg.add_reaction(emoji)
            msg1 = await self.hcchannel.send("More Keys:")
            for emoji in self.emojis[20:40]:
                await msg1.add_reaction(emoji)
            msg2 = await self.hcchannel.send("Even More Keys:")
            for emoji in self.emojis[40:]:
                await msg2.add_reaction(emoji)
            return
        elif num == 61:
            self.dungeontitle = "Realm Clearing"
            self.emojis = [
                "<:defaultdungeon:682212333182910503>",
                "<:trickster:682214467483861023>",
                "<:Warrior_1:585616162407186433>",
                "<:ninja_3:585616162151202817>"
            ]
            self.rusher_emojis = ["<:planewalker:682212363889279091>"]
            self.hc_color = discord.Color.from_rgb(20, 125, 236)
            self.thumbnail = "https://www.realmeye.com/forum/uploads/default/original/1X/842ee5c4e569c7b7c1b0bf688e465a7435235fc8.png"
        elif num == 62:
            self.dungeontitle = "Fame Train"
            self.emojis = [
                "<:fame:682209281722024044>", "<:sorcerer:682214487490560010>",
                "<:necromancer:682214503106215966>",
                "<:sseal:683815374403141651>", "<:puri:682205769973760001>"
            ]
            self.rusher_emojis = []
            self.hc_color = discord.Color.from_rgb(233, 127, 33)
            self.thumbnail = "https://cdn.discordapp.com/attachments/679309966128971797/696452960825376788/fame2.png"
        else:
            self.dungeon_info = utils.dungeon_info(int(msg.content))
            self.keyed_run = True
            self.dungeontitle = self.dungeon_info[0]
            self.emojis = self.dungeon_info[1]
            self.confirmreactions = self.dungeon_info[2]
            self.rusher_emojis = self.dungeon_info[3]
            self.hc_color = self.dungeon_info[4]
            self.thumbnail = self.dungeon_info[5]
        await msg.delete()
        await self.setup_msg.delete()

        afkmsg = await self.hcchannel.send(
            f"@here Headcount for `{self.dungeontitle}` {self.emojis[0]} started by {self.ctx.author.mention} for {self.vcchannel.name}",
            embed=embeds.headcount_base(self.dungeontitle, self.ctx.author,
                                        self.keyed_run, self.emojis,
                                        self.rusher_emojis, self.thumbnail,
                                        self.hc_color))

        if 0 < num < 61:
            embed = discord.Embed(
                title="Headcount",
                description=f"{self.ctx.author.mention} - your headcount for"
                f" `{self.dungeontitle}` has been started!\nTo convert this headcount into an "
                "afk check, press the 🔀 button.",
                color=discord.Color.green())
        else:
            embed = discord.Embed(
                title="Headcount",
                description=f"{self.ctx.author.mention} - your headcount for"
                f" `{self.dungeontitle}` has been started!",
                color=discord.Color.green())
        hcmsg = await self.ctx.send(embed=embed)

        for e in self.emojis:
            await afkmsg.add_reaction(e)

        for e in self.confirmreactions:
            await afkmsg.add_reaction(e)

        for e in self.rusher_emojis:
            await afkmsg.add_reaction(e)

        if 0 < num < 61:
            await hcmsg.add_reaction("🔀")
            while True:

                def check(react, usr):
                    return not usr.bot and react.message.id == hcmsg.id and usr == self.ctx.author and str(
                        react.emoji) == '🔀'

                try:
                    reaction, user = await self.client.wait_for(
                        'reaction_add', timeout=3600,
                        check=check)  # Wait max 1 hour
                except asyncio.TimeoutError:
                    embed.description = f"{self.ctx.author.mention} - your headcount for `{self.dungeontitle}` has been started!\n" \
                                        f"Conversion to an afk check timed out. Try starting a new headcount/afk."
                    await hcmsg.edit(embed=embed)
                    return await hcmsg.clear_reactions()

                if self.ctx.author.id in self.client.raid_db[
                        self.ctx.guild.id]['leaders']:
                    await self.ctx.send(
                        "You cannot start another AFK while an AFK check is still up or a run log has not been "
                        "completed.",
                        delete_after=10)
                    await reaction.remove()
                    continue

                embed = discord.Embed(
                    title="Location Selection",
                    description=
                    "Please type the location you'd like to set for this run.")
                setup_msg = await self.ctx.send(embed=embed)

                def location_check(m):
                    return m.author == self.ctx.author and m.channel == self.ctx.channel

                try:
                    msg = await self.client.wait_for('message',
                                                     timeout=600,
                                                     check=location_check
                                                     )  # Wait max 10 Minutes
                except asyncio.TimeoutError:
                    continue

                location = msg.content
                await msg.delete()
                afk = AfkCheck(self.client, self.ctx, location, self.raidnum,
                               self.inraiding, self.invet, self.inevents,
                               self.raiderrole, self.rlrole, self.hcchannel,
                               self.vcchannel, setup_msg)
                await afk.convert_from_headcount(
                    afkmsg, self.dungeon_info, self.dungeontitle, self.emojis,
                    self.raidnum, self.inraiding, self.invet, self.inevents,
                    self.raiderrole, self.rlrole, self.hcchannel,
                    self.vcchannel)
예제 #4
0
    async def logrun(self,
                     ctx,
                     member: utils.MemberLookupConverter = None,
                     number=1):
        if not member:
            member = ctx.author

        setup = VCSelect(self.client, ctx, manual_log=True)
        data = await setup.start()
        if isinstance(data, tuple):
            (raidnum, inraiding, invet, inevents, raiderrole, rlrole,
             hcchannel, vcchannel, setup_msg) = data
        else:
            return

        try:
            await setup_msg.delete()
        except discord.NotFound:
            pass
        r_msg = await ctx.send(embed=embeds.dungeon_select(manual_log=True))

        def dungeon_check(m):
            return m.author == ctx.author and m.channel == ctx.channel and m.content.isdigit(
            )

        while True:
            try:
                msg = await self.client.wait_for('message',
                                                 timeout=60,
                                                 check=dungeon_check)
            except asyncio.TimeoutError:
                embed = discord.Embed(
                    title="Timed out!",
                    description="You didn't choose a dungeon in time!",
                    color=discord.Color.red())
                await r_msg.clear_reactions()
                return await r_msg.edit(embed=embed)

            if msg.content.isdigit():
                if 0 < int(msg.content) < 57:
                    break
            await ctx.send("Please choose a number between 1-56!",
                           delete_after=7)

        await r_msg.delete()
        dungeon_info = utils.dungeon_info(int(msg.content))
        try:
            await msg.delete()
        except discord.NotFound:
            pass
        dungeontitle = dungeon_info[0]
        emojis = dungeon_info[1]
        guild_db = self.client.guild_db.get(ctx.guild.id)
        logrun = LogRun(self.client,
                        ctx.author,
                        ctx.channel,
                        ctx.guild,
                        emojis, [],
                        dungeontitle, [member.id],
                        guild_db.get(sql.gld_cols.rlroleid),
                        hcchannel,
                        events=inevents,
                        vialreacts=[],
                        helmreacts=[],
                        shieldreacts=[],
                        swordreacts=[],
                        numruns=number,
                        runleader=member)
        await logrun.start()