Ejemplo n.º 1
0
 async def doubletravel(self, ctx, *, f3c):
     await ctx.send("**Note:** This command, along with other " + \
                    "speedrunning calculators, may not be used in a real speedrun.")
     try:
         x, z, _ = self.f3cProcessing(f3c)
         o = 520
         t = math.atan(z / x)
         xp = funcs.sign(x) * abs(o * math.cos(t))
         zp = funcs.sign(z) * abs(o * math.sin(t))
         blocks = round(self.coordsDifference((x, z), (xp, zp)))
         await ctx.reply(
             f"Build your first portal at: **{round(xp)}, {round(zp)}** " + \
             f"({'{:,}'.format(blocks)} block{'' if blocks == 1 else 's'} away)\n\n" + \
             f"Use `{self.client.command_prefix}educatedtravel` afterwards."
         )
     except Exception as ex:
         await ctx.reply(embed=funcs.errorEmbed(None, str(ex)))
Ejemplo n.º 2
0
 async def blindtravel(self, ctx, *, f3c):
     await ctx.send("**Note:** This command, along with other " + \
                    "speedrunning calculators, may not be used in a real speedrun.")
     try:
         x, z, _ = self.f3cProcessing(f3c)
         dist = self.coordsDist(x, z)
         o = 190 if dist < 190 else dist if dist < 290 else 290 if dist < 442 else 580 if dist < 580 else dist \
             if dist < 692 else 686 if dist < 825 else 970 if dist < 970 else dist if dist < 1060 else 1060
         t = math.atan(z / x)
         xp = funcs.sign(x) * abs(o * math.cos(t))
         zp = funcs.sign(z) * abs(o * math.sin(t))
         blocks = round(self.coordsDifference((x, z), (xp, zp)))
         await ctx.reply(
             f"Build your portal at: **{round(xp)}, {round(zp)}** " + \
             f"({'{:,}'.format(blocks)} block{'' if blocks == 1 else 's'} away)"
         )
     except Exception as ex:
         await ctx.reply(embed=funcs.errorEmbed(None, str(ex)))
Ejemplo n.º 3
0
 async def educatedtravel(self, ctx, *, f3c):
     await ctx.send("**Note:** This command, along with other " + \
                    "speedrunning calculators, may not be used in a real speedrun.")
     try:
         x, z, f = self.f3cProcessing(f3c)
         f = (360 + f if f < 0 else f) - 180
         o = 640 if self.coordsDist(x, z) > 3584 else 216
         m1 = -math.tan((90 - f) * (math.pi / 180))
         a = 1 + (m1**2)
         b1 = -m1 * (x / 8) + (z / 8)
         b = 2 * m1 * b1
         xp = ((-b) + (funcs.sign(f) * math.sqrt(b**2 - 4 * a *
                                                 (b1**2 - o**2)))) / (2 * a)
         zp = m1 * xp + b1
         await ctx.reply(
             f"Build your portal at: **{round(xp)}, {round(zp)}** ")
     except Exception as ex:
         await ctx.reply(embed=funcs.errorEmbed(None, str(ex)))
Ejemplo n.º 4
0
 async def triangulation(self, ctx, *, f3c):
     await ctx.send("**Note:** This command, along with other " + \
                    "speedrunning calculators, may not be used in a real speedrun.")
     try:
         x, z, f = self.f3cProcessing(f3c)
         x0, z0, f0 = x, z, f
         f = (360 + f if f < 0 else f) - 180
         r = (90 - f) * (math.pi / 180)
         b = 8 - abs(abs(x) % 16) + 16
         l = []
         s = 0
         while s < 11904:
             d = b * funcs.sign(f)
             x += d
             z += d * -math.tan(r)
             v = abs(abs(abs(z) % 16) - 8) + 0.5
             s = self.coordsDist(x, z)
             if s > 1408:
                 l.append({
                     "k": x,
                     "v": v,
                     "j": v * v * math.sqrt(1 + len(l)),
                     "r": z
                 })
             b = 16
         l.sort(key=lambda i: i["j"])
         xp, zp = l[0]["k"], l[0]["r"]
         blocks = round(self.coordsDifference((x0, z0), (xp, zp)))
         await ctx.reply(
             f"The stronghold could be at: **{round(xp)}, {round(zp)}** " + \
             f"({'{:,}'.format(blocks)} block{'' if blocks == 1 else 's'} away)\n\nMethod: 8, 8\n\nPaste your F3+" + \
             "C clipboard here once you are ready. The program will stop after 20 minutes of inactivity. " + \
             "Type `!cancel` to cancel."
         )
     except Exception as ex:
         return await ctx.reply(embed=funcs.errorEmbed(None, str(ex)))
     x1, z1, f1 = None, None, None
     blocks = 100
     try:
         while blocks > 40:
             while True:
                 msg = await self.client.wait_for(
                     "message",
                     timeout=1200,
                     check=lambda m: ctx.author == m.author and ctx.channel
                     == m.channel)
                 try:
                     x1, z1, f1 = self.f3cProcessing(msg.content)
                 except:
                     if msg.content.casefold() == "!cancel":
                         return await ctx.reply("Cancelling triangulation.")
                     continue
                 if x1 == x0 and z1 == z0 and f1 == f0:
                     continue
                 break
             try:
                 a0 = math.tan(self.angleProcessing(f0) * math.pi / 180)
                 a1 = math.tan(self.angleProcessing(f1) * math.pi / 180)
                 b = z0 - x0 * a0
                 xp = ((z1 - x1 * a1) - b) / (a0 - a1)
                 zp = xp * a0 + b
                 blocks = round(self.coordsDifference((x1, z1), (xp, zp)))
             except:
                 continue
             await msg.reply(
                 f"The stronghold could be at: **{round(xp)}, {round(zp)}** " + \
                 f"({'{:,}'.format(blocks)} block{'' if blocks == 1 else 's'} away)\n\nMethod: Triangulation\n\n" + \
                 "Paste your F3+C clipboard here once you are ready. The program will stop after 20 minutes of " + \
                 "inactivity. Type `!cancel` to cancel."
             )
             x0, z0, f0 = x1, z1, f1
         await ctx.send(
             "You are close to the stronghold, stopping triangulation program."
         )
     except TimeoutError:
         await ctx.send(
             "You have been inactive for over 20 minutes, stopping triangulation program."
         )