-
Notifications
You must be signed in to change notification settings - Fork 0
/
module_dnd.py
104 lines (76 loc) · 3.62 KB
/
module_dnd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import math
import random
import re
import nextcord
from nextcord.ext import commands
class ListenerDnD(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.glock = False
@commands.command()
async def prices(self, ctx):
""""DnD prices"""
embed = nextcord.Embed(
colour = nextcord.Colour.dark_purple()
)
prices_list = {"Korath fuel": "100(V) / 1 dL", "Nutrient paste": "2(V) / 1 L (Okella Station)\n 4(V) / 1 L (Black Market)", "O2 canister": "10(V) / 1, refill 1(V)"}
for price in prices_list:
embed.add_field(name = price, value = prices_list[price], inline = False)
embed.set_author(name = "Prices", icon_url = "https://i0.kym-cdn.com/entries/icons/facebook/000/019/601/smilelaugh.jpg", url = "https://www.youtube.com/watch?v=90hIAXlBGzY")
await ctx.send(embed = embed)
@commands.command()
async def survival(self, ctx, name):
""""DnD prices"""
embed = nextcord.Embed(
colour = nextcord.Colour.dark_purple()
)
chance = random.randint(0, 100)
if name == "Tasha": chance = 0.001
if name == "Rey": chance = 200
if self.glock:
chance = 0
self.glock = False
embed.add_field(name = "Chance of Survival", value = str(chance) + "%")
embed.set_author(name = "Calculations", icon_url = "https://i0.kym-cdn.com/entries/icons/facebook/000/019/601/smilelaugh.jpg", url = "https://www.youtube.com/watch?v=90hIAXlBGzY")
await ctx.send(embed = embed)
@commands.command()
async def travel(self, ctx, light_years, size_class, days, do_fuel = False):
""""Life is a highway..."""
try:
if do_fuel:
days_taken = (float(size_class) / math.sqrt((float(days) / float(light_years))))
await ctx.send("It's gonna take " + str(round(days_taken, 3)) + " days")
else:
fuel = (float(light_years) * ((float(size_class) / float(days)) ** 2))
await ctx.send("You're gonna need " + str(round(fuel, 3)) + " dL")
except ValueError:
await ctx.send("*am i a joke to you*")
@commands.command()
async def calc_food(self, ctx, people, food_dl):
try:
days = (float(food_dl) / float(people))
await ctx.send(f"That's gonna last you {round(days, 3)} days")
except ValueError:
await ctx.send("*am i a joke to you*")
@commands.Cog.listener()
async def on_message(self, message):
if not message.author.id == 762063323201536020:
channel = message.channel
if "Bruh imagine going somewhere with different exchange rates" in message.content:
await channel.send("bruh")
if "Hail Dirko" in message.content:
await channel.send("Hail Dirko")
if "me after I buy a glock" in message.content:
self.glock = True
found_vb = re.findall("(\d+\.?\d*) *(\((V|v)\)|V|v){1}", message.content)
for full_match in found_vb:
amount = full_match[0]
amount = float(amount)
gold = amount * 5 / 4
await channel.send(f"{str(amount)}(V) = " + str("{:,}".format(round(gold, 3))) + "gp")
found_gp = re.findall("(\d+\.?\d*) *(gp){1}", message.content)
for full_match in found_gp:
amount = full_match[0]
amount = float(amount)
v_bucks = amount * 4 / 5
await channel.send(f"{str(amount)}gp = " + str("{:,}".format(round(v_bucks, 3))) + "(V))")