Init commit
This commit is contained in:
140
Gwendolyn.py
Normal file
140
Gwendolyn.py
Normal file
@ -0,0 +1,140 @@
|
||||
import discord
|
||||
import asyncio
|
||||
import pickle
|
||||
import time
|
||||
|
||||
from GwendolynFuncs import roll_dice, helloFunc, imageFunc, movieFunc, cap
|
||||
from lookupFuncs import monsterFunc, spellFunc
|
||||
from generators import nameGen, tavernGen
|
||||
from swroll import parseRoll
|
||||
|
||||
client = discord.Client()
|
||||
|
||||
@client.event
|
||||
async def on_ready():
|
||||
print("Logged in as")
|
||||
print(client.user.name)
|
||||
print(client.user.id)
|
||||
print("-----------")
|
||||
game = discord.Game("Some weeb shit")
|
||||
await client.change_presence(activity=game)
|
||||
|
||||
@client.event
|
||||
async def on_message(message):
|
||||
if message.content.lower().startswith("!help"):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print(localtime+"\n"+message.author.name+" ran !help\n")
|
||||
file = open("help.txt","r")
|
||||
em = discord.Embed(title = "Help", description = file.read(),colour = 0x59f442)
|
||||
await message.channel.send(embed = em)
|
||||
|
||||
if message.content.lower().startswith("!hello"):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print(localtime+"\n"+message.author.name+" ran !hello")
|
||||
await message.channel.send(helloFunc(message.author.name))
|
||||
|
||||
elif message.content.lower().startswith("!roll"):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print(localtime+"\n"+message.author.name+" ran !roll")
|
||||
if message.content.lower() == "!roll" or message.content.lower() == "!roll ":
|
||||
print(roll_dice(message.author.name))
|
||||
await message.channel.send(roll_dice(message.author.name))
|
||||
else:
|
||||
await message.channel.send(roll_dice(message.author.name, message.content.lower().replace("!roll","")))
|
||||
|
||||
elif message.content.lower().startswith("!spell "):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print(localtime+"\n"+message.author.name+" ran !spell")
|
||||
await message.channel.send(spellFunc(message.content))
|
||||
|
||||
elif message.content.lower().startswith("!monster "):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print(localtime+"\n"+message.author.name+" ran !monster")
|
||||
title, text1, text2, text3, text4, text5 = monsterFunc(message.content)
|
||||
em1 = discord.Embed(title = title, description = text1, colour=0xDEADBF)
|
||||
await message.channel.send(embed = em1)
|
||||
if text2 != "":
|
||||
if len(text2) < 2048:
|
||||
em2 = discord.Embed(title = "Special Abilities", description = text2, colour=0xDEADBF)
|
||||
await message.channel.send(embed = em2)
|
||||
else:
|
||||
em2 = discord.Embed(title = "Special Abilities", description = text2[:2048], colour=0xDEADBF)
|
||||
await message.channel.send(embed = em2)
|
||||
em2_2 = discord.Embed(title = "", description = text2[2048:], colour=0xDEADBF)
|
||||
await message.channel.send(embed = em2_2)
|
||||
if text3 != "":
|
||||
if len(text3) < 2048:
|
||||
em3 = discord.Embed(title = "Actions", description = text3, colour=0xDEADBF)
|
||||
await message.channel.send(embed = em3)
|
||||
else:
|
||||
em3 = discord.Embed(title = "Actions", description = text3[:2048], colour=0xDEADBF)
|
||||
await message.channel.send(embed = em3)
|
||||
em3_2 = discord.Embed(title = "", description = text3[2048:], colour=0xDEADBF)
|
||||
await message.channel.send(embed = em3_2)
|
||||
if text4 != "":
|
||||
if len(text4) < 2048:
|
||||
em4 = discord.Embed(title = "Reactions", description = text4, colour=0xDEADBF)
|
||||
await message.channel.send(embed = em4)
|
||||
else:
|
||||
em4 = discord.Embed(title = "Reactions", description = text4[:2048], colour=0xDEADBF)
|
||||
await message.channel.send(embed = em4)
|
||||
em4_2 = discord.Embed(title = "", description = text4[2048:], colour=0xDEADBF)
|
||||
await message.channel.send(embed = em4_2)
|
||||
if text5 != "":
|
||||
if len(text5) < 2048:
|
||||
em5 = discord.Embed(title = "Legendary Actions", description = text5, colour=0xDEADBF)
|
||||
await message.channel.send(embed = em5)
|
||||
else:
|
||||
em5 = discord.Embed(title = "Legendary Actions", description = text5[:2048], colour=0xDEADBF)
|
||||
await message.channel.send(embed = em5)
|
||||
em5_2 = discord.Embed(title = "", description = text5[2048:], colour=0xDEADBF)
|
||||
await message.channel.send(embed = em5_2)
|
||||
|
||||
elif message.content.lower().startswith("!map"):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print(localtime+"\n"+message.author.name+" ran !map")
|
||||
await message.channel.send("https://i.imgur.com/diMXXJs.jpg")
|
||||
|
||||
elif message.content.lower().startswith("!image"):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print(localtime+"\n"+message.author.name+" ran !image")
|
||||
await message.channel.send(imageFunc())
|
||||
|
||||
elif message.content.lower().startswith("!movie"):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print(localtime+"\n"+message.author.name+" ran !movie")
|
||||
async with message.channel.typing():
|
||||
title, plot, cover, cast = movieFunc()
|
||||
if title == "error":
|
||||
await message.channel.send("An error occurred. Try again")
|
||||
else:
|
||||
embed = discord.Embed(title=title, description=plot, color=0x24ec19)
|
||||
embed.set_thumbnail(url=cover)
|
||||
embed.add_field(name="Cast", value=cast,inline = True)
|
||||
await message.channel.send(embed = embed)
|
||||
|
||||
elif message.content.lower().startswith("!name"):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print(localtime+"\n"+message.author.name+" ran !name")
|
||||
await message.channel.send(nameGen())
|
||||
|
||||
elif message.content.lower().startswith("!tavern"):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print(localtime+"\n"+message.author.name+" ran !tavern")
|
||||
await message.channel.send(tavernGen())
|
||||
|
||||
elif message.content.lower().startswith("!game "):
|
||||
gamePlaying = cap(message.content.lower().replace("!game ",""))
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print(localtime+"\n"+message.author.name+" ran !game, changing the game to '"+gamePlaying+"'")
|
||||
game = discord.Game(gamePlaying)
|
||||
await client.change_presence(activity=game)
|
||||
|
||||
elif message.content.lower().startswith("!swroll"):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print(localtime+"\n"+message.author.name+" ran !swroll")
|
||||
command = cap(message.content.lower().replace("!swroll",""))
|
||||
await message.channel.send(parseRoll(message.author.name,command))
|
||||
|
||||
client.run("MzgwNzI4OTkwMTEwODQyODgx.DO81GQ.rctkEQtieciETXnmsYbwZvvOkaA")
|
||||
|
128
GwendolynFuncs.py
Normal file
128
GwendolynFuncs.py
Normal file
@ -0,0 +1,128 @@
|
||||
from lxml import etree #used by imageFunc
|
||||
import re #used by roll_dice
|
||||
import datetime #used by helloFunc
|
||||
import json #used by spellFunc
|
||||
import random #used by imageFunc
|
||||
import urllib #used by imageFunc
|
||||
import imdb #used by movieFunc
|
||||
|
||||
from dice import roll
|
||||
|
||||
def roll_dice(author, rollStr: str = "1d20"):
|
||||
print("Rolling "+str(rollStr))
|
||||
if rollStr == '0/0': # easter eggs
|
||||
return("What do you expect me to do, destroy the universe?")
|
||||
|
||||
adv = 0
|
||||
if re.search('(^|\s+)(adv|dis)(\s+|$)', rollStr) is not None:
|
||||
adv = 1 if re.search('(^|\s+)adv(\s+|$)', rollStr) is not None else -1
|
||||
rollStr = re.sub('(adv|dis)(\s+|$)', '', rollStr)
|
||||
res = roll(rollStr, adv=adv)
|
||||
out = res.result
|
||||
outStr = author + ' :game_die:\n' + out
|
||||
if len(outStr) > 1999:
|
||||
outputs = author + ' :game_die:\n[Output truncated due to length]\n**Result:** ' + str(res.plain)
|
||||
else:
|
||||
outputs = outStr
|
||||
print("Successfully ran !roll")
|
||||
print("")
|
||||
return(outputs)
|
||||
no_caps_list = ["of","the"]
|
||||
def cap(s):
|
||||
word_number = 0
|
||||
lst = s.split()
|
||||
res = ''
|
||||
for word in lst:
|
||||
word_number += 1
|
||||
if word not in no_caps_list or word_number == 1:
|
||||
word = word.capitalize()
|
||||
res += word+" "
|
||||
res = res[:-1]
|
||||
return res
|
||||
|
||||
def time_in_range(start, end, x):
|
||||
"""Return true if x is in the range [start, end]"""
|
||||
if start <= end:
|
||||
return start <= x <= end
|
||||
else:
|
||||
return start <= x or x <= end
|
||||
|
||||
def helloFunc(author):
|
||||
print("")
|
||||
now = datetime.datetime.now()
|
||||
if time_in_range(now.replace(hour=5, minute=0, second=0, microsecond=0),now.replace(hour=10, minute=0, second=0, microsecond=0), now):
|
||||
return("Good morning, "+str(author))
|
||||
elif time_in_range(now.replace(hour=10, minute=0, second=0, microsecond=0),now.replace(hour=13, minute=0, second=0, microsecond=0), now):
|
||||
return("Good day, "+str(author))
|
||||
elif time_in_range(now.replace(hour=13, minute=0, second=0, microsecond=0),now.replace(hour=18, minute=0, second=0, microsecond=0), now):
|
||||
return("Good afternoon, "+str(author))
|
||||
elif time_in_range(now.replace(hour=18, minute=0, second=0, microsecond=0),now.replace(hour=22, minute=0, second=0, microsecond=0), now):
|
||||
return("Good evening, "+str(author))
|
||||
elif time_in_range(now.replace(hour=22, minute=0, second=0, microsecond=0),now.replace(hour=23, minute=59, second=59, microsecond=0), now):
|
||||
return("Good night, "+str(author))
|
||||
else:
|
||||
return("Why hello, "+str(author))
|
||||
|
||||
def imageFunc():
|
||||
mh = 730
|
||||
mw = 900
|
||||
cams = ("one","two","three","four")
|
||||
cam = random.choice(cams)
|
||||
if cam == "one":
|
||||
a = str(random.randint(0 ,9))
|
||||
b = str(random.randint(0,9))
|
||||
c = str(random.randint(0,9))
|
||||
d = str(random.randint(0,9))
|
||||
search = ("img_"+a+b+c+d)
|
||||
elif cam == "two":
|
||||
a = str(random.randint(2012,2016))
|
||||
b = str(random.randint(1,12)).zfill(2)
|
||||
c = str(random.randint(1,29)).zfill(2)
|
||||
search = ("IMG_"+a+b+c)
|
||||
elif cam == "three":
|
||||
a = str(random.randint(1,500)).zfill(4)
|
||||
search = ("IMAG_"+a)
|
||||
elif cam == "four":
|
||||
a = str(random.randint(0,9))
|
||||
b = str(random.randint(0,9))
|
||||
c = str(random.randint(0,9))
|
||||
d = str(random.randint(0,9))
|
||||
search = ("DSC_"+a+b+c+d)
|
||||
page = urllib.request.urlopen("https://www.bing.com/images/search?q="+search+"&safesearch=off")
|
||||
read = page.read()
|
||||
tree = etree.HTML(read)
|
||||
images = tree.xpath('//a[@class = "thumb"]/@href')
|
||||
number = random.randint(1,len(images))-1
|
||||
image = images[number]
|
||||
print("Successfully returned an image")
|
||||
print("")
|
||||
return(image)
|
||||
|
||||
def movieFunc():
|
||||
try:
|
||||
print("Creating IMDb object")
|
||||
ia = imdb.IMDb()
|
||||
|
||||
print("Picking a movie")
|
||||
movs = open("movies.txt", "r")
|
||||
movlist = movs.read().split("\n")
|
||||
mov = random.choice(movlist)
|
||||
movs.close()
|
||||
|
||||
print("Searching for "+mov)
|
||||
s_result = ia.search_movie(mov)
|
||||
|
||||
print("Getting the data")
|
||||
movie = s_result[0]
|
||||
ia.update(movie)
|
||||
cast = movie['cast']
|
||||
pcast = ""
|
||||
for x in range(3):
|
||||
if cast[x]:
|
||||
pcast += cast[x]['name']+", "
|
||||
print("Successfully ran !movie")
|
||||
print("")
|
||||
return(movie['title'], movie['plot'][0].split("::")[0], movie['cover url'].replace("150","600").replace("101","404"), pcast[:-2])
|
||||
except:
|
||||
print("Something bad happened...")
|
||||
return("error","","","")
|
10
characters.json
Normal file
10
characters.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Test": {
|
||||
"Name": "Bingo",
|
||||
"Species": "",
|
||||
"Career": "",
|
||||
"Specialization Trees": [],
|
||||
"Soak": 0,
|
||||
"Wound Threshold": 0
|
||||
}
|
||||
}
|
545
dice.py
Normal file
545
dice.py
Normal file
@ -0,0 +1,545 @@
|
||||
import logging
|
||||
import random
|
||||
import re
|
||||
import traceback
|
||||
from heapq import nlargest, nsmallest
|
||||
from math import floor
|
||||
from re import IGNORECASE
|
||||
|
||||
import numexpr
|
||||
|
||||
import errors
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
VALID_OPERATORS = 'k|rr|ro|mi|ma|ra|e|p'
|
||||
VALID_OPERATORS_ARRAY = VALID_OPERATORS.split('|')
|
||||
VALID_OPERATORS_2 = re.compile('|'.join(["({})".format(i) for i in VALID_OPERATORS_ARRAY]))
|
||||
DICE_PATTERN = re.compile(
|
||||
r'^\s*(?:(?:(\d*d\d+)(?:(?:' + VALID_OPERATORS + r')(?:[lh<>]?\d+))*|(\d+)|([-+*/().=])?)\s*(\[.*\])?)(.*?)\s*$',
|
||||
IGNORECASE)
|
||||
|
||||
|
||||
def list_get(index, default, l):
|
||||
try:
|
||||
a = l[index]
|
||||
except IndexError:
|
||||
a = default
|
||||
return a
|
||||
|
||||
|
||||
def roll(rollStr, adv: int = 0, rollFor='', inline=False, double=False, show_blurbs=True, **kwargs):
|
||||
roller = Roll()
|
||||
result = roller.roll(rollStr, adv, rollFor, inline, double, show_blurbs, **kwargs)
|
||||
return result
|
||||
|
||||
|
||||
def get_roll_comment(rollStr):
|
||||
"""Returns: A two-tuple (dice without comment, comment)"""
|
||||
try:
|
||||
comment = ''
|
||||
no_comment = ''
|
||||
dice_set = re.split('([-+*/().=])', rollStr)
|
||||
dice_set = [d for d in dice_set if not d in (None, '')]
|
||||
log.debug("Found dice set: " + str(dice_set))
|
||||
for index, dice in enumerate(dice_set):
|
||||
match = DICE_PATTERN.match(dice)
|
||||
log.debug("Found dice group: " + str(match.groups()))
|
||||
no_comment += dice.replace(match.group(5), '')
|
||||
if match.group(5):
|
||||
comment = match.group(5) + ''.join(dice_set[index + 1:])
|
||||
break
|
||||
|
||||
return no_comment, comment
|
||||
except:
|
||||
pass
|
||||
return rollStr, ''
|
||||
|
||||
|
||||
class Roll(object):
|
||||
def __init__(self, parts=None):
|
||||
if parts is None:
|
||||
parts = []
|
||||
self.parts = parts
|
||||
|
||||
def get_crit(self):
|
||||
"""Returns: 0 for no crit, 1 for 20, 2 for 1."""
|
||||
try:
|
||||
crit = next(p.get_crit() for p in self.parts if isinstance(p, SingleDiceGroup))
|
||||
except StopIteration:
|
||||
crit = 0
|
||||
return crit
|
||||
|
||||
def get_total(self):
|
||||
"""Returns: int"""
|
||||
return numexpr.evaluate(''.join(p.get_eval() for p in self.parts if not isinstance(p, Comment)))
|
||||
|
||||
# # Dice Roller
|
||||
def roll(self, rollStr, adv: int = 0, rollFor='', inline=False, double=False, show_blurbs=True, **kwargs):
|
||||
try:
|
||||
if '**' in rollStr:
|
||||
raise errors.InvalidArgument("Exponents are currently disabled.")
|
||||
self.parts = []
|
||||
# split roll string into XdYoptsSel [comment] or Op
|
||||
# set remainder to comment
|
||||
# parse each, returning a SingleDiceResult
|
||||
dice_set = re.split('([-+*/().=])', rollStr)
|
||||
dice_set = [d for d in dice_set if not d in (None, '')]
|
||||
log.debug("Found dice set: " + str(dice_set))
|
||||
for index, dice in enumerate(dice_set):
|
||||
match = DICE_PATTERN.match(dice)
|
||||
log.debug("Found dice group: " + str(match.groups()))
|
||||
# check if it's dice
|
||||
if match.group(1):
|
||||
roll = self.roll_one(dice.replace(match.group(5), ''), adv)
|
||||
self.parts.append(roll)
|
||||
# or a constant
|
||||
elif match.group(2):
|
||||
self.parts.append(Constant(value=int(match.group(2)), annotation=match.group(4)))
|
||||
# or an operator
|
||||
elif not match.group(5):
|
||||
self.parts.append(Operator(op=match.group(3), annotation=match.group(4)))
|
||||
|
||||
if match.group(5):
|
||||
self.parts.append(Comment(match.group(5) + ''.join(dice_set[index + 1:])))
|
||||
break
|
||||
|
||||
# calculate total
|
||||
crit = self.get_crit()
|
||||
try:
|
||||
total = self.get_total()
|
||||
except SyntaxError:
|
||||
raise errors.InvalidArgument("No dice found to roll.")
|
||||
rolled = ' '.join(str(res) for res in self.parts if not isinstance(res, Comment))
|
||||
if rollFor is '':
|
||||
rollFor = ''.join(str(c) for c in self.parts if isinstance(c, Comment))
|
||||
# return final solution
|
||||
if not inline:
|
||||
# Builds end result while showing rolls
|
||||
reply = ' '.join(
|
||||
str(res) for res in self.parts if not isinstance(res, Comment)) + '\n**Total:** ' + str(
|
||||
floor(total))
|
||||
skeletonReply = reply
|
||||
rollFor = rollFor if rollFor is not '' else 'Result'
|
||||
reply = '**{}:** '.format(rollFor) + reply
|
||||
if show_blurbs:
|
||||
if adv == 1:
|
||||
reply += '\n**Rolled with Advantage**'
|
||||
elif adv == -1:
|
||||
reply += '\n**Rolled with Disadvantage**'
|
||||
if crit == 1:
|
||||
critStr = "\n_**Critical Hit!**_ "
|
||||
reply += critStr
|
||||
elif crit == 2:
|
||||
critStr = "\n_**Critical Fail!**_ "
|
||||
reply += critStr
|
||||
else:
|
||||
# Builds end result while showing rolls
|
||||
reply = ' '.join(str(res) for res in self.parts if not isinstance(res, Comment)) + ' = `' + str(
|
||||
floor(total)) + '`'
|
||||
skeletonReply = reply
|
||||
rollFor = rollFor if rollFor is not '' else 'Result'
|
||||
reply = '**{}:** '.format(rollFor) + reply
|
||||
if show_blurbs:
|
||||
if adv == 1:
|
||||
reply += '\n**Rolled with Advantage**'
|
||||
elif adv == -1:
|
||||
reply += '\n**Rolled with Disadvantage**'
|
||||
if crit == 1:
|
||||
critStr = "\n_**Critical Hit!**_ "
|
||||
reply += critStr
|
||||
elif crit == 2:
|
||||
critStr = "\n_**Critical Fail!**_ "
|
||||
reply += critStr
|
||||
reply = re.sub(' +', ' ', reply)
|
||||
skeletonReply = re.sub(' +', ' ', str(skeletonReply))
|
||||
return DiceResult(result=int(floor(total)), verbose_result=reply, crit=crit, rolled=rolled,
|
||||
skeleton=skeletonReply, raw_dice=self)
|
||||
except Exception as ex:
|
||||
if not isinstance(ex, (SyntaxError, KeyError, errors.AvraeException)):
|
||||
log.error('Error in roll() caused by roll {}:'.format(rollStr))
|
||||
traceback.print_exc()
|
||||
return DiceResult(verbose_result="Invalid input: {}".format(ex))
|
||||
|
||||
def roll_one(self, dice, adv: int = 0):
|
||||
result = SingleDiceGroup()
|
||||
result.rolled = []
|
||||
# splits dice and comments
|
||||
split = re.match(r'^([^\[\]]*?)\s*(\[.*\])?\s*$', dice)
|
||||
dice = split.group(1).strip()
|
||||
annotation = split.group(2)
|
||||
result.annotation = annotation if annotation is not None else ''
|
||||
# Recognizes dice
|
||||
obj = re.findall('\d+', dice)
|
||||
obj = [int(x) for x in obj]
|
||||
numArgs = len(obj)
|
||||
|
||||
ops = []
|
||||
if numArgs == 1:
|
||||
if not dice.startswith('d'):
|
||||
raise errors.InvalidArgument('Please pass in the value of the dice.')
|
||||
numDice = 1
|
||||
diceVal = obj[0]
|
||||
if adv is not 0 and diceVal == 20:
|
||||
numDice = 2
|
||||
ops = ['k', 'h1'] if adv is 1 else ['k', 'l1']
|
||||
elif numArgs == 2:
|
||||
numDice = obj[0]
|
||||
diceVal = obj[-1]
|
||||
if adv is not 0 and diceVal == 20:
|
||||
ops = ['k', 'h' + str(numDice)] if adv is 1 else ['k', 'l' + str(numDice)]
|
||||
numDice = numDice * 2
|
||||
else: # split into xdy and operators
|
||||
numDice = obj[0]
|
||||
diceVal = obj[1]
|
||||
dice = re.split('(\d+d\d+)', dice)[-1]
|
||||
ops = VALID_OPERATORS_2.split(dice)
|
||||
ops = [a for a in ops if a is not None]
|
||||
|
||||
# dice repair/modification
|
||||
if numDice > 300 or diceVal < 1:
|
||||
raise errors.InvalidArgument('Too many dice rolled.')
|
||||
|
||||
result.max_value = diceVal
|
||||
result.num_dice = numDice
|
||||
result.operators = ops
|
||||
|
||||
for _ in range(numDice):
|
||||
try:
|
||||
tempdice = SingleDice()
|
||||
tempdice.value = random.randint(1, diceVal)
|
||||
tempdice.rolls = [tempdice.value]
|
||||
tempdice.max_value = diceVal
|
||||
tempdice.kept = True
|
||||
result.rolled.append(tempdice)
|
||||
except:
|
||||
result.rolled.append(SingleDice())
|
||||
|
||||
if ops is not None:
|
||||
|
||||
rerollList = []
|
||||
reroll_once = []
|
||||
keep = None
|
||||
to_explode = []
|
||||
to_reroll_add = []
|
||||
|
||||
valid_operators = VALID_OPERATORS_ARRAY
|
||||
last_operator = None
|
||||
for index, op in enumerate(ops):
|
||||
if last_operator is not None and op in valid_operators and not op == last_operator:
|
||||
result.reroll(reroll_once, 1)
|
||||
reroll_once = []
|
||||
result.reroll(rerollList, greedy=True)
|
||||
rerollList = []
|
||||
result.keep(keep)
|
||||
keep = None
|
||||
result.reroll(to_reroll_add, 1, keep_rerolled=True, unique=True)
|
||||
to_reroll_add = []
|
||||
result.reroll(to_explode, greedy=True, keep_rerolled=True)
|
||||
to_explode = []
|
||||
if op == 'rr':
|
||||
rerollList += parse_selectors([list_get(index + 1, 0, ops)], result, greedy=True)
|
||||
if op == 'k':
|
||||
keep = [] if keep is None else keep
|
||||
keep += parse_selectors([list_get(index + 1, 0, ops)], result)
|
||||
if op == 'p':
|
||||
keep = [] if keep is None else keep
|
||||
keep += parse_selectors([list_get(index + 1, 0, ops)], result, inverse=True)
|
||||
if op == 'ro':
|
||||
reroll_once += parse_selectors([list_get(index + 1, 0, ops)], result)
|
||||
if op == 'mi':
|
||||
_min = list_get(index + 1, 0, ops)
|
||||
for r in result.rolled:
|
||||
if r.value < int(_min):
|
||||
r.update(int(_min))
|
||||
if op == 'ma':
|
||||
_max = list_get(index + 1, 0, ops)
|
||||
for r in result.rolled:
|
||||
if r.value > int(_max):
|
||||
r.update(int(_max))
|
||||
if op == 'ra':
|
||||
to_reroll_add += parse_selectors([list_get(index + 1, 0, ops)], result)
|
||||
if op == 'e':
|
||||
to_explode += parse_selectors([list_get(index + 1, 0, ops)], result, greedy=True)
|
||||
if op in valid_operators:
|
||||
last_operator = op
|
||||
result.reroll(reroll_once, 1)
|
||||
result.reroll(rerollList, greedy=True)
|
||||
result.keep(keep)
|
||||
result.reroll(to_reroll_add, 1, keep_rerolled=True, unique=True)
|
||||
result.reroll(to_explode, greedy=True, keep_rerolled=True)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
class Part:
|
||||
"""Class to hold one part of the roll string."""
|
||||
pass
|
||||
|
||||
|
||||
class SingleDiceGroup(Part):
|
||||
def __init__(self, num_dice: int = 0, max_value: int = 0, rolled=None, annotation: str = "", result: str = "",
|
||||
operators=None):
|
||||
if operators is None:
|
||||
operators = []
|
||||
if rolled is None:
|
||||
rolled = []
|
||||
self.num_dice = num_dice
|
||||
self.max_value = max_value
|
||||
self.rolled = rolled # list of SingleDice
|
||||
self.annotation = annotation
|
||||
self.result = result
|
||||
self.operators = operators
|
||||
|
||||
def keep(self, rolls_to_keep):
|
||||
if rolls_to_keep is None: return
|
||||
for _roll in self.rolled:
|
||||
if not _roll.value in rolls_to_keep:
|
||||
_roll.kept = False
|
||||
elif _roll.kept:
|
||||
rolls_to_keep.remove(_roll.value)
|
||||
|
||||
def reroll(self, rerollList, max_iterations=1000, greedy=False, keep_rerolled=False, unique=False):
|
||||
if not rerollList: return # don't reroll nothing - minor optimization
|
||||
if unique:
|
||||
rerollList = list(set(rerollList)) # remove duplicates
|
||||
if len(rerollList) > 100:
|
||||
raise OverflowError("Too many dice to reroll (max 100)")
|
||||
last_index = 0
|
||||
count = 0
|
||||
should_continue = True
|
||||
while should_continue: # let's only iterate 250 times for sanity
|
||||
should_continue = False
|
||||
if any(d.value in set(rerollList) for d in self.rolled[last_index:] if d.kept and not d.exploded):
|
||||
should_continue = True
|
||||
to_extend = []
|
||||
for r in self.rolled[last_index:]: # no need to recheck everything
|
||||
count += 1
|
||||
if count > max_iterations:
|
||||
should_continue = False
|
||||
if r.value in rerollList and r.kept and not r.exploded:
|
||||
try:
|
||||
tempdice = SingleDice()
|
||||
tempdice.value = random.randint(1, self.max_value)
|
||||
tempdice.rolls = [tempdice.value]
|
||||
tempdice.max_value = self.max_value
|
||||
tempdice.kept = True
|
||||
to_extend.append(tempdice)
|
||||
if not keep_rerolled:
|
||||
r.drop()
|
||||
else:
|
||||
r.explode()
|
||||
except:
|
||||
to_extend.append(SingleDice())
|
||||
if not keep_rerolled:
|
||||
r.drop()
|
||||
else:
|
||||
r.explode()
|
||||
if not greedy:
|
||||
rerollList.remove(r.value)
|
||||
last_index = len(self.rolled)
|
||||
self.rolled.extend(to_extend)
|
||||
|
||||
def get_total(self):
|
||||
"""Returns:
|
||||
int - The total value of the dice."""
|
||||
return sum(r.value for r in self.rolled if r.kept)
|
||||
|
||||
def get_eval(self):
|
||||
return str(self.get_total())
|
||||
|
||||
def get_num_kept(self):
|
||||
return sum(1 for r in self.rolled if r.kept)
|
||||
|
||||
def get_crit(self):
|
||||
"""Returns:
|
||||
int - 0 for no crit, 1 for crit, 2 for crit fail."""
|
||||
if self.get_num_kept() == 1 and self.max_value == 20:
|
||||
if self.get_total() == 20:
|
||||
return 1
|
||||
elif self.get_total() == 1:
|
||||
return 2
|
||||
return 0
|
||||
|
||||
def __str__(self):
|
||||
return "{0.num_dice}d{0.max_value}{1} ({2}) {0.annotation}".format(
|
||||
self, ''.join(self.operators), ', '.join(str(r) for r in self.rolled))
|
||||
|
||||
def to_dict(self):
|
||||
return {'type': 'dice', 'dice': [d.to_dict() for d in self.rolled], 'annotation': self.annotation,
|
||||
'value': self.get_total(), 'is_crit': self.get_crit(), 'num_kept': self.get_num_kept(),
|
||||
'text': str(self), 'num_dice': self.num_dice, 'dice_size': self.max_value, 'operators': self.operators}
|
||||
|
||||
|
||||
class SingleDice:
|
||||
def __init__(self, value: int = 0, max_value: int = 0, kept: bool = True, exploded: bool = False):
|
||||
self.value = value
|
||||
self.max_value = max_value
|
||||
self.kept = kept
|
||||
self.rolls = [value] # list of ints (for X -> Y -> Z)
|
||||
self.exploded = exploded
|
||||
|
||||
def drop(self):
|
||||
self.kept = False
|
||||
|
||||
def explode(self):
|
||||
self.exploded = True
|
||||
|
||||
def update(self, new_value):
|
||||
self.value = new_value
|
||||
self.rolls.append(new_value)
|
||||
|
||||
def __str__(self):
|
||||
formatted_rolls = [str(r) for r in self.rolls]
|
||||
if int(formatted_rolls[-1]) == self.max_value or int(formatted_rolls[-1]) == 1:
|
||||
formatted_rolls[-1] = '**' + formatted_rolls[-1] + '**'
|
||||
if self.exploded:
|
||||
formatted_rolls[-1] = '__' + formatted_rolls[-1] + '__'
|
||||
if self.kept:
|
||||
return ' -> '.join(formatted_rolls)
|
||||
else:
|
||||
return '~~' + ' -> '.join(formatted_rolls) + '~~'
|
||||
|
||||
def __repr__(self):
|
||||
return "<SingleDice object: value={0.value}, max_value={0.max_value}, kept={0.kept}, rolls={0.rolls}>".format(
|
||||
self)
|
||||
|
||||
def to_dict(self):
|
||||
return {'type': 'single_dice', 'value': self.value, 'size': self.max_value, 'is_kept': self.kept,
|
||||
'rolls': self.rolls, 'exploded': self.exploded}
|
||||
|
||||
|
||||
class Constant(Part):
|
||||
def __init__(self, value: int = 0, annotation: str = ""):
|
||||
self.value = value
|
||||
self.annotation = annotation if annotation is not None else ''
|
||||
|
||||
def __str__(self):
|
||||
return "{0.value} {0.annotation}".format(self)
|
||||
|
||||
def get_eval(self):
|
||||
return str(self.value)
|
||||
|
||||
def to_dict(self):
|
||||
return {'type': 'constant', 'value': self.value, 'annotation': self.annotation}
|
||||
|
||||
|
||||
class Operator(Part):
|
||||
def __init__(self, op: str = "+", annotation: str = ""):
|
||||
self.op = op if op is not None else ''
|
||||
self.annotation = annotation if annotation is not None else ''
|
||||
|
||||
def __str__(self):
|
||||
return "{0.op} {0.annotation}".format(self)
|
||||
|
||||
def get_eval(self):
|
||||
return self.op
|
||||
|
||||
def to_dict(self):
|
||||
return {'type': 'operator', 'value': self.op, 'annotation': self.annotation}
|
||||
|
||||
|
||||
class Comment(Part):
|
||||
def __init__(self, comment: str = ""):
|
||||
self.comment = comment
|
||||
|
||||
def __str__(self):
|
||||
return self.comment.strip()
|
||||
|
||||
def to_dict(self):
|
||||
return {'type': 'comment', 'value': self.comment}
|
||||
|
||||
|
||||
def parse_selectors(opts, res, greedy=False, inverse=False):
|
||||
"""Returns a list of ints."""
|
||||
for o in range(len(opts)):
|
||||
if opts[o][0] is 'h':
|
||||
opts[o] = nlargest(int(opts[o].split('h')[1]), (d.value for d in res.rolled if d.kept))
|
||||
elif opts[o][0] is 'l':
|
||||
opts[o] = nsmallest(int(opts[o].split('l')[1]), (d.value for d in res.rolled if d.kept))
|
||||
elif opts[o][0] is '>':
|
||||
if greedy:
|
||||
opts[o] = list(range(int(opts[o].split('>')[1]) + 1, res.max_value + 1))
|
||||
else:
|
||||
opts[o] = [d.value for d in res.rolled if d.value > int(opts[o].split('>')[1])]
|
||||
elif opts[o][0] is '<':
|
||||
if greedy:
|
||||
opts[o] = list(range(1, int(opts[o].split('<')[1])))
|
||||
else:
|
||||
opts[o] = [d.value for d in res.rolled if d.value < int(opts[o].split('<')[1])]
|
||||
out = []
|
||||
for o in opts:
|
||||
if isinstance(o, list):
|
||||
out.extend(int(l) for l in o)
|
||||
elif not greedy:
|
||||
out.extend(int(o) for a in res.rolled if a.value is int(o) and a.kept)
|
||||
else:
|
||||
out.append(int(o))
|
||||
|
||||
if not inverse:
|
||||
return out
|
||||
|
||||
inverse_out = []
|
||||
for rolled in res.rolled:
|
||||
if rolled.kept and rolled.value in out:
|
||||
out.remove(rolled.value)
|
||||
elif rolled.kept:
|
||||
inverse_out.append(rolled.value)
|
||||
return inverse_out
|
||||
|
||||
|
||||
class DiceResult:
|
||||
"""Class to hold the output of a dice roll."""
|
||||
|
||||
def __init__(self, result: int = 0, verbose_result: str = '', crit: int = 0, rolled: str = '', skeleton: str = '',
|
||||
raw_dice: Roll = None):
|
||||
self.plain = result
|
||||
self.total = result
|
||||
self.result = verbose_result
|
||||
self.crit = crit
|
||||
self.rolled = rolled
|
||||
self.skeleton = skeleton if skeleton is not '' else verbose_result
|
||||
self.raw_dice = raw_dice # Roll
|
||||
|
||||
def __str__(self):
|
||||
return self.result
|
||||
|
||||
def __repr__(self):
|
||||
return '<DiceResult object: total={}>'.format(self.total)
|
||||
|
||||
def consolidated(self):
|
||||
"""Gets the most simplified version of the roll string."""
|
||||
if self.raw_dice is None:
|
||||
return "0"
|
||||
parts = [] # list of (part, annotation)
|
||||
last_part = ""
|
||||
for p in self.raw_dice.parts:
|
||||
if isinstance(p, SingleDiceGroup):
|
||||
last_part += str(p.get_total())
|
||||
else:
|
||||
last_part += str(p)
|
||||
if not isinstance(p, Comment) and p.annotation:
|
||||
parts.append((last_part, p.annotation))
|
||||
last_part = ""
|
||||
if last_part:
|
||||
parts.append((last_part, ""))
|
||||
|
||||
to_roll = ""
|
||||
last_annotation = ""
|
||||
out = ""
|
||||
for numbers, annotation in parts:
|
||||
if annotation and annotation != last_annotation and to_roll:
|
||||
out += f"{roll(to_roll).total:+} {last_annotation}"
|
||||
to_roll = ""
|
||||
if annotation:
|
||||
last_annotation = annotation
|
||||
to_roll += numbers
|
||||
if to_roll:
|
||||
out += f"{roll(to_roll).total:+} {last_annotation}"
|
||||
out = out.strip('+ ')
|
||||
return out
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
while True:
|
||||
print(roll(input().strip()))
|
162
errors.py
Normal file
162
errors.py
Normal file
@ -0,0 +1,162 @@
|
||||
class AvraeException(Exception):
|
||||
"""A base exception class."""
|
||||
|
||||
def __init__(self, msg):
|
||||
super().__init__(msg)
|
||||
|
||||
|
||||
class NoCharacter(AvraeException):
|
||||
"""Raised when a user has no active character."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("You have no character active.")
|
||||
|
||||
|
||||
class NoActiveBrew(AvraeException):
|
||||
"""Raised when a user has no active homebrew of a certain type."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("You have no homebrew of this type active.")
|
||||
|
||||
|
||||
class ExternalImportError(AvraeException):
|
||||
"""Raised when something fails to import."""
|
||||
|
||||
def __init__(self, msg):
|
||||
super().__init__(msg)
|
||||
|
||||
|
||||
class InvalidArgument(AvraeException):
|
||||
"""Raised when an argument is invalid."""
|
||||
pass
|
||||
|
||||
|
||||
class EvaluationError(AvraeException):
|
||||
"""Raised when a cvar evaluation causes an error."""
|
||||
|
||||
def __init__(self, original):
|
||||
super().__init__(f"Error evaluating expression: {original}")
|
||||
self.original = original
|
||||
|
||||
|
||||
class FunctionRequiresCharacter(AvraeException):
|
||||
"""
|
||||
Raised when a function that requires a character is called without one.
|
||||
"""
|
||||
|
||||
def __init__(self, msg=None):
|
||||
super().__init__(msg or "This alias requires an active character.")
|
||||
|
||||
|
||||
class OutdatedSheet(AvraeException):
|
||||
"""Raised when a feature is used that requires an updated sheet."""
|
||||
|
||||
def __init__(self, msg=None):
|
||||
super().__init__(msg or "This command requires an updated character sheet. Try running `!update`.")
|
||||
|
||||
|
||||
class NoSpellDC(AvraeException):
|
||||
def __init__(self):
|
||||
super().__init__("No spell save DC found.")
|
||||
|
||||
|
||||
class NoSpellAB(AvraeException):
|
||||
def __init__(self):
|
||||
super().__init__("No spell attack bonus found.")
|
||||
|
||||
|
||||
class InvalidSaveType(AvraeException):
|
||||
def __init__(self):
|
||||
super().__init__("Invalid save type.")
|
||||
|
||||
|
||||
class ConsumableException(AvraeException):
|
||||
"""A base exception for consumable exceptions to stem from."""
|
||||
pass
|
||||
|
||||
|
||||
class ConsumableNotFound(ConsumableException):
|
||||
"""Raised when a consumable is not found."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("The requested counter does not exist.")
|
||||
|
||||
|
||||
class CounterOutOfBounds(ConsumableException):
|
||||
"""Raised when a counter is set to a value out of bounds."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("The new value is out of bounds.")
|
||||
|
||||
|
||||
class NoReset(ConsumableException):
|
||||
"""Raised when a consumable without a reset is reset."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("The counter does not have a reset value.")
|
||||
|
||||
|
||||
class InvalidSpellLevel(ConsumableException):
|
||||
"""Raised when a spell level is invalid."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("The spell level is invalid.")
|
||||
|
||||
|
||||
class SelectionException(AvraeException):
|
||||
"""A base exception for message awaiting exceptions to stem from."""
|
||||
pass
|
||||
|
||||
|
||||
class NoSelectionElements(SelectionException):
|
||||
"""Raised when get_selection() is called with no choices."""
|
||||
|
||||
def __init__(self, msg=None):
|
||||
super().__init__(msg or "There are no choices to select from.")
|
||||
|
||||
|
||||
class SelectionCancelled(SelectionException):
|
||||
"""Raised when get_selection() is cancelled or times out."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("Selection timed out or was cancelled.")
|
||||
|
||||
|
||||
class CombatException(AvraeException):
|
||||
"""A base exception for combat-related exceptions to stem from."""
|
||||
pass
|
||||
|
||||
|
||||
class CombatNotFound(CombatException):
|
||||
"""Raised when a channel is not in combat."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("This channel is not in combat.")
|
||||
|
||||
|
||||
class RequiresContext(CombatException):
|
||||
"""Raised when a combat is committed without context."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("Combat not contextualized.")
|
||||
|
||||
|
||||
class ChannelInCombat(CombatException):
|
||||
"""Raised when a combat is started with an already active combat."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("Channel already in combat.")
|
||||
|
||||
|
||||
class CombatChannelNotFound(CombatException):
|
||||
"""Raised when a combat's channel is not in the channel list."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("Combat channel does not exist.")
|
||||
|
||||
|
||||
class NoCombatants(CombatException):
|
||||
"""Raised when a combat tries to advance turn with no combatants."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("There are no combatants.")
|
48
generators.py
Normal file
48
generators.py
Normal file
@ -0,0 +1,48 @@
|
||||
import numpy as np
|
||||
import random
|
||||
|
||||
|
||||
|
||||
def make_pairs(corpus):
|
||||
for i in range(len(corpus)-1):
|
||||
yield (corpus[i], corpus[i+1])
|
||||
|
||||
def nameGen():
|
||||
names = open('names.txt', encoding='utf8').read()
|
||||
corpus = list(names)
|
||||
|
||||
pairs = make_pairs(corpus)
|
||||
|
||||
word_dict = {}
|
||||
|
||||
for word_1, word_2 in pairs:
|
||||
if word_1 in word_dict.keys():
|
||||
word_dict[word_1].append(word_2)
|
||||
else:
|
||||
word_dict[word_1] = [word_2]
|
||||
|
||||
first_word = np.random.choice(corpus)
|
||||
|
||||
while first_word.islower() or first_word == " " or first_word == "-" or first_word == "\n":
|
||||
first_word = np.random.choice(corpus)
|
||||
|
||||
chain = [first_word]
|
||||
|
||||
done = False
|
||||
|
||||
while done == False:
|
||||
new_letter = np.random.choice(word_dict[chain[-1]])
|
||||
chain.append(new_letter)
|
||||
if new_letter == "\n":
|
||||
done = True
|
||||
genName = "".join(chain)
|
||||
print("Generated "+genName+"\n")
|
||||
return(genName)
|
||||
|
||||
def tavernGen():
|
||||
fp = ["The Silver","The Golden","The Staggering","The Laughing","The Prancing","The Gilded","The Running","The Howling","The Slaughtered","The Leering","The Drunken","The Leaping","The Roaring","The Frowning","The Lonely","The Wandering","The Mysterious","The Barking","The Black","The Gleaming","The Tap-Dancing","The Sad","The Sexy","The Artificial","The Groovy","The Merciful","The Confused","The Pouting","The Horny","The Okay","The Friendly","The Hungry","The Handicapped","The Fire-breathing","The One-Eyed","The Psychotic","The Mad","The Evil","The Idiotic"]
|
||||
sp = ["Eel","Dolphin","Dwarf","Pegasus","Pony","Rose","Stag","Wolf","Lamb","Demon","Goat","Spirit","Horde","Jester","Mountain","Eagle","Satyr","Dog","Spider","Star","Dad","Rat","Jeremy","Mouse","Unicorn","Pearl","Ant","Crab","Penguin","Octopus","Lawyer","Ghost","Toad","Handjob","Immigrant","SJW","Dragon","Bard","Sphinx","Soldier","Salmon","Owlbear","Kite","Frost Giant","'̶̧̗̣̰̞̜̤̦̖͗̈́̏͊͒͜+̴͎̰͓̱̻̝̬̼͕̥͍̪͕̮͙͂͝*̶̲̓̊̏'̷̥̺͈̞͒̆̏͋̀̐̇͆̓͊͠'̷͖̱̟̟͉̝̪̮͕̃͑́̍͆̓̌͒̄͛̇͘̚ͅ!̷̡̻̈́#̸̳̰̿̿̏͐̏̓̌̚̚͠¨̷̟͙̱͎̟̱̅̀͋̇͗͂͋͋̕͘´̴̡̡͎͔̦̜̟̼̠̰̤͋́̀̓́̄́̏͂̀͜.̸̛̭͍̮̜͑̋̀̋̈́̇̆̆̌_̸̡̥̜̞̝̮̑͑̓̓̇͜͜^̴̡̢͕̠̖̤̺̭̮̙͕̼̳̺̼͋̿̏̎̑͑̊̀̅͐̚͝͝","Arsonist"]
|
||||
tp = [" Tavern"," Inn","","","","","","","","",""]
|
||||
genTav = random.choice(fp)+" "+random.choice(sp)+random.choice(tp)
|
||||
print("Generated "+genTav+"\n")
|
||||
return(genTav)
|
24
help.txt
Normal file
24
help.txt
Normal file
@ -0,0 +1,24 @@
|
||||
**!hello** - En venlig hilsen.
|
||||
|
||||
**!roll** - Rul terninger i xdy format. Kan udføre matematik udover rullende. Kan også gøre følgende:
|
||||
kx: Beholder kun rul med værdien x.
|
||||
rox: Genrul rul med værdien x første gang.
|
||||
rrx: Genrul alle rul med værdien x
|
||||
mix: Gør alle rul under x til x.
|
||||
max: Gør alle rul over x til x.
|
||||
rax: Genruller og tilføjer rul med værdien x.
|
||||
l/h før x: For de laveste/højeste x rul.
|
||||
|
||||
**!spell** - Slå en besværgelse op.
|
||||
|
||||
**!monster** - Slå et monster op.
|
||||
|
||||
**!map** - Få et billede af Senkulpa kortet.
|
||||
|
||||
**!image** - Find et tilfældigt billede fra internettet.
|
||||
|
||||
**!movie** - Giver titlen på en tilfældig film fra Bedre Netflix
|
||||
|
||||
**!name** - Genererer et tilfældigt navn.
|
||||
|
||||
**!tavern** - Genererer en tilfældig tavern.
|
121
lookupFuncs.py
Normal file
121
lookupFuncs.py
Normal file
@ -0,0 +1,121 @@
|
||||
import math
|
||||
import discord
|
||||
import json
|
||||
|
||||
from GwendolynFuncs import cap
|
||||
|
||||
def modifier(statistic):
|
||||
mods = math.floor((statistic-10)/2)
|
||||
if mods >= 0:
|
||||
mods = "+"+str(mods)
|
||||
return(str(mods))
|
||||
|
||||
saves = ["strength_save","dexterity_save","constitution_save","intelligence_save","wisdom_save","charisma_save"]
|
||||
abilities = ["acrobatics","animal_handling","arcana","athletics","deception","history","insight","intimidation","investigation","medicine","nature","perception","performance","persuasion","religion","sleight_of_hand","stealth","survival"]
|
||||
|
||||
def monsterFunc(content):
|
||||
command = cap(content.lower().replace("!monster ",""))
|
||||
print("Looking up "+command)
|
||||
if len(content.lower().split()) < 2:
|
||||
print("Monster doesn't exist in database")
|
||||
print("")
|
||||
return("I don't know that monster...","","","","","")
|
||||
else:
|
||||
data = json.load(open('monsters.json', encoding = "utf8"))
|
||||
for monster in data:
|
||||
if str(command) == monster["name"]:
|
||||
if monster["subtype"] != "":
|
||||
typs = (monster["type"]+" ("+monster["subtype"]+")")
|
||||
else:
|
||||
typs = monster["type"]
|
||||
con_mod = math.floor((monster["constitution"]-10)/2)
|
||||
hit_dice = monster["hit_dice"]
|
||||
|
||||
stats = ("**Str:** "+str(monster["strength"])+" ("+modifier(monster["strength"])+")\t**Dex:** "+str(monster["dexterity"])+" ("+modifier(monster["dexterity"])+")\t**Con:** "+str(monster["constitution"])+" ("+modifier(monster["constitution"])+")\n**Int: **"+str(monster["intelligence"])+" ("+modifier(monster["intelligence"])+")\t**Wis: **"+str(monster["wisdom"])+" ("+modifier(monster["wisdom"])+")\t**Cha: **"+str(monster["charisma"])+" ("+modifier(monster["charisma"])+")")
|
||||
|
||||
saving_throws = ""
|
||||
for save in saves:
|
||||
if save in monster:
|
||||
if monster[save] >= 0:
|
||||
saving_throws += " "+cap(save[:3])+" +"+str(monster[save])+","
|
||||
else:
|
||||
saving_throws += " "+cap(save[:3])+" "+str(monster[save])+","
|
||||
if saving_throws != "":
|
||||
saving_throws = "\n**Saving Throws**"+saving_throws[:-1]
|
||||
|
||||
skills = ""
|
||||
for skill in abilities:
|
||||
if skill in monster:
|
||||
if monster[skill] >= 0:
|
||||
skills += " "+cap(skill.replace("_"," "))+" +"+str(monster[skill])+","
|
||||
else:
|
||||
skills += " "+cap(skill.replace("_"," "))+" "+str(monster[skill])+","
|
||||
if skills != "":
|
||||
skills = "\n**Skills**"+skills[:-1]
|
||||
|
||||
vulnerabilities = monster["damage_vulnerabilities"]
|
||||
if vulnerabilities != "":
|
||||
vulnerabilities = "\n**Damage Vulnerabilities** "+vulnerabilities
|
||||
|
||||
resistances = monster["damage_resistances"]
|
||||
if resistances != "":
|
||||
resistances = "\n**Damage Resistances** "+resistances
|
||||
|
||||
immunities = monster["damage_immunities"]
|
||||
if immunities != "":
|
||||
immunities = "\n**Damage Immunities** "+immunities
|
||||
|
||||
c_immunities = monster["condition_immunities"]
|
||||
if c_immunities != "":
|
||||
c_immunities = "\n**Condition Immunities** "+c_immunities
|
||||
|
||||
spec_ab = ""
|
||||
if "special_abilities" in monster:
|
||||
for ability in monster["special_abilities"]:
|
||||
spec_ab += "\n\n***"+ability["name"]+".*** "+ability["desc"]
|
||||
|
||||
act = ""
|
||||
if "actions" in monster:
|
||||
for action in monster["actions"]:
|
||||
act += "\n\n***"+action["name"]+".*** "+action["desc"]
|
||||
|
||||
react = ""
|
||||
if "reactions" in monster:
|
||||
for reaction in monster["reactions"]:
|
||||
react += "\n\n***"+reaction["name"]+".*** "+reaction["desc"]
|
||||
|
||||
leg_act = ""
|
||||
if "legendary_actions" in monster:
|
||||
for action in monster["legendary_actions"]:
|
||||
leg_act += "\n\n***"+action["name"]+".*** "+action["desc"]
|
||||
|
||||
if con_mod < 0:
|
||||
hit_dice += (" - "+str(con_mod * int(monster["hit_dice"].replace("d"," ").split()[0])*(-1)))
|
||||
if con_mod > 0:
|
||||
hit_dice += (" + "+str(con_mod * int(monster["hit_dice"].replace("d"," ").split()[0])))
|
||||
new_part = "\n--------------------"
|
||||
monster_type = monster["size"]+" "+typs+", "+monster["alignment"]+"*"
|
||||
basic_info = "\n**Armor Class** "+str(monster["armor_class"])+"\n**Hit Points** "+str(monster["hit_points"])+" ("+hit_dice+")\n**Speed **"+monster["speed"]+new_part+"\n"
|
||||
text1 = (monster_type+new_part+basic_info+stats+new_part+saving_throws+skills+vulnerabilities+resistances+immunities+c_immunities+"\n**Senses** "+monster["senses"]+"\n**Languages** "+monster["languages"]+"\n**Challenge** "+monster["challenge_rating"])
|
||||
text2 = (spec_ab)
|
||||
text3 = (act)
|
||||
text4 = (react)
|
||||
text5 = (leg_act)
|
||||
print("Returning monster information")
|
||||
print("")
|
||||
return(str(command),text1,text2,text3,text4,text5)
|
||||
print("")
|
||||
return("I don't know that monster...","","","","","")
|
||||
|
||||
def spellFunc(content):
|
||||
command = cap(content.lower().replace("!spell ",""))
|
||||
print("Looking up "+command)
|
||||
data = json.load(open('spells.json', encoding = "utf8"))
|
||||
if str(command) in data:
|
||||
print("Returning spell information")
|
||||
spell_output = ("***"+str(command)+"***\n*"+str(data[str(command)]["level"])+" level "+str(data[str(command)]["school"])+"\nCasting Time: "+str(data[str(command)]["casting_time"])+"\nRange: "+str(data[str(command)]["range"])+"\nComponents: "+str(data[str(command)]["components"])+"\nDuration: "+str(data[str(command)]["duration"])+"*\n \n"+str(data[str(command)]["description"]))
|
||||
else:
|
||||
print("I don't know that spell")
|
||||
spell_output = "I don't think that's a spell"
|
||||
print("Successfully ran !spell")
|
||||
return(spell_output)
|
18349
monsters.json
Normal file
18349
monsters.json
Normal file
File diff suppressed because it is too large
Load Diff
28
movie.py
Normal file
28
movie.py
Normal file
@ -0,0 +1,28 @@
|
||||
import imdb
|
||||
import random
|
||||
|
||||
def movieFunc():
|
||||
print("Running !movie")
|
||||
print("Creating IMDb object")
|
||||
ia = imdb.IMDb()
|
||||
|
||||
print("Picking a movie")
|
||||
movs = open("movies.txt", "r")
|
||||
movlist = movs.read().split("\n")
|
||||
mov = random.choice(movlist)
|
||||
movs.close()
|
||||
|
||||
print("Searching")
|
||||
s_result = ia.search_movie(mov)
|
||||
|
||||
print("Picking the movie")
|
||||
movie = s_result[0]
|
||||
ia.update(movie)
|
||||
cast = movie['cast']
|
||||
pcast = ""
|
||||
for x in range(3):
|
||||
if cast[x]:
|
||||
pcast += cast[x]['name']+", "
|
||||
print("Successfully ran !movie")
|
||||
print("")
|
||||
return(movie['title'], movie['plot'][0].split("::")[0], movie['cover url'].replace("150","600").replace("101","404"), pcast[:-2])
|
645
movies.txt
Normal file
645
movies.txt
Normal file
@ -0,0 +1,645 @@
|
||||
101 Dalmatians
|
||||
12 Angry Men
|
||||
12 Years a Slave
|
||||
17 Again
|
||||
2001: A Space Odyssey
|
||||
21 Jump Street
|
||||
22 Jump Street
|
||||
28 Days Later
|
||||
300
|
||||
500 Days of Summer
|
||||
8 Mile
|
||||
A Christmas Prince
|
||||
A Christmas Prince: The Royal Wedding
|
||||
A Clockwork Orange
|
||||
A Silent voice
|
||||
A Star is Born
|
||||
A View to a Kill
|
||||
Adaptation
|
||||
Aguirre, the Wrath of God
|
||||
Air Bud
|
||||
Airplane!
|
||||
Akira
|
||||
Aladdin
|
||||
Alice in Wonderland
|
||||
Alien
|
||||
Aliens
|
||||
Amadeus
|
||||
Amelie
|
||||
American Beauty
|
||||
American History X
|
||||
American Psycho
|
||||
Anchorman
|
||||
Anchorman 2
|
||||
Anders Matthesen/Thomas Hartmann: Bytte Bytte Koebmand
|
||||
Anders Matthesen: Anden Paa Coke?
|
||||
Anders Matthesen: Anders
|
||||
Anders Matthesen: Shhh
|
||||
Anders Matthesen: Tal For Dig Selv
|
||||
Anders Matthesen: Vender Tilbage
|
||||
Annihilation
|
||||
Ant-Man
|
||||
Ant-Man and the Wasp
|
||||
Apocalypse Now
|
||||
Apollo 13
|
||||
Aquaman
|
||||
Arrival
|
||||
Atlantis: The Lost Empire
|
||||
Austin Powers: International Man of Mystery
|
||||
Austin Powers: The Spy Who Shagged Me
|
||||
Austin Powers in Goldmember
|
||||
Avatar
|
||||
Baby Driver
|
||||
Back to the Future
|
||||
Back to the Future part II
|
||||
Back to the Future part III
|
||||
Bambi
|
||||
Barry Lyndon
|
||||
Batman Begins
|
||||
Batman V Superman: Dawn of Justice
|
||||
Beauty and the Beast
|
||||
Bee Movie
|
||||
Before Sunrise
|
||||
Before Sunset
|
||||
Being John Malkovich
|
||||
Big
|
||||
Big Hero 6
|
||||
Bird Box
|
||||
Birdemic
|
||||
Birdman
|
||||
Black Panther
|
||||
Black Swan
|
||||
Blade Runner
|
||||
Blade Runner 2049
|
||||
Blazing Saddles
|
||||
Blue is the Warmest Color
|
||||
Blue Velvet
|
||||
Bo Burnham: Make Happy
|
||||
Bo Burnham: What
|
||||
Bohemian Rhapsody
|
||||
Boogie Nights
|
||||
Boyhood
|
||||
Brazil
|
||||
Brokeback Mountain
|
||||
Brother Bear
|
||||
Bruce Almighty
|
||||
Buffy the Vampire Slayer
|
||||
Bumblebee
|
||||
Call Me By Your Name
|
||||
Captain America: Civil War
|
||||
Captain America: The First Avenger
|
||||
Captain America: The Winter Soldier
|
||||
Captain Fantastic
|
||||
Casablanca
|
||||
Casino Royale
|
||||
Castle in the Sky
|
||||
Catch Me if You Can
|
||||
Charlies Angels
|
||||
Children of Men
|
||||
Chinatown
|
||||
Christopher Robin
|
||||
Chronicle
|
||||
Chungking Express
|
||||
Cinderella
|
||||
Citizen Kane
|
||||
City Lights
|
||||
City of God
|
||||
Cloudy With a Chance of Meatballs
|
||||
Cloudy With a Chance of Meatballs 2
|
||||
Cloverfield
|
||||
Clueless
|
||||
Coco
|
||||
Coming to America
|
||||
Concussion
|
||||
Cool Runnings
|
||||
Coraline
|
||||
Creed
|
||||
Dances with Wolves
|
||||
Deadpool
|
||||
Deadpool 2
|
||||
Diamonds Are Forever
|
||||
Die Another Day
|
||||
Die Hard
|
||||
Die Hard 2
|
||||
Die Hard 3
|
||||
Die Hard 4
|
||||
Die Hard 5: A Good Day to Die Hard
|
||||
District 9
|
||||
Django Unchained
|
||||
Doctor Strange
|
||||
Do the Right Thing
|
||||
Dog Day Afternoon
|
||||
Dr. No
|
||||
Dr. Strangelove
|
||||
Drive
|
||||
Dumbo
|
||||
Easy A
|
||||
Edge of Tomorrow
|
||||
Elf
|
||||
Eraserhead
|
||||
ET
|
||||
Eternal Sunshine of the Spotless Mind
|
||||
Ex Machina
|
||||
Eyes Wide Shut
|
||||
Fantasia
|
||||
Fantasia 2000
|
||||
Fantastic Beasts and Where to Find Them
|
||||
Fantastic Beasts: The Crimes of Grindelwald
|
||||
Fantastic Four
|
||||
Fantastic Mr. Fox
|
||||
Fargo
|
||||
Ferris Bueller's day off
|
||||
Festival of the Spoken Nerd: Full Frontal Nerdity
|
||||
Festival of the Spoken Nerd: Just for Graphs
|
||||
Festival of the Spoken Nerd: You Cant Polish a Nerd
|
||||
Fifty Shades of Grey
|
||||
Fifty Shades Darker
|
||||
Fifty Shades Freed
|
||||
Fight Club
|
||||
Final Destination
|
||||
Final Destination 2
|
||||
Final Destination 3
|
||||
Final Destination 4
|
||||
Final Destination 5
|
||||
Finding Dory
|
||||
Finding Nemo
|
||||
For Your Eyes Only
|
||||
Forrest Gump
|
||||
From Russia with Love
|
||||
Frozen
|
||||
Full Metal Jacket
|
||||
Garfield: The Movie
|
||||
Garfield: A Tail of Two Kitties
|
||||
Get Out
|
||||
Ghost
|
||||
Ghost Rider
|
||||
Ghostbusters
|
||||
Gladiator
|
||||
Going Clear
|
||||
GoldenEye
|
||||
Goldfinger
|
||||
Gone Girl
|
||||
Good Will Hunting
|
||||
Goodfellas
|
||||
Grave of the fireflies
|
||||
Gravity
|
||||
Grease
|
||||
Green Street Hooligans
|
||||
Groundhog Day
|
||||
Guardians of the Galaxy
|
||||
Guardians of the Galaxy Vol. 2
|
||||
Guldhornene
|
||||
Halloween
|
||||
Hancock
|
||||
Harry Potter and the Chamber of Secrets
|
||||
Harry Potter and the Deathly Hallows Part
|
||||
Harry Potter and the Deathly Hallows Part 2
|
||||
Harry Potter and the Goblet of Fire
|
||||
Harry Potter and the Half-Blood Prince
|
||||
Harry Potter and the Order of the Phoenix
|
||||
Harry Potter and the Philosopher's Stone
|
||||
Harry Potter and the Prisoner of Azkaban
|
||||
Heat
|
||||
Her
|
||||
Hercules
|
||||
Home Alone
|
||||
Home Alone 2
|
||||
Home Alone 3
|
||||
Home Alone 4
|
||||
Home Alone 5
|
||||
Hot Fuzz
|
||||
How to Train Your Dragon
|
||||
How to Train Your Dragon 2
|
||||
Howl's Moving Castle
|
||||
Hunger Games
|
||||
Hunger Games: Catching Fire
|
||||
Hunger Games: Mockingjay part 1
|
||||
Hunger Games: Mockingjay part 2
|
||||
I Am Legend
|
||||
Ice Age
|
||||
Ice Age 2
|
||||
Ice Age 3
|
||||
Ice Age 4
|
||||
Ice Age 5
|
||||
Ikiru
|
||||
In Bruges
|
||||
In the Mood For Love
|
||||
Inception
|
||||
Independence Day
|
||||
Indiana Jones and the Kingdom of the Crystal Skull
|
||||
Indiana Jones and the Last Crusade
|
||||
Indiana Jones and the Raiders of the Lost Ark
|
||||
Indiana Jones and the Temple of Doom
|
||||
Inglourious Basterds
|
||||
Inside Llewyn Davis
|
||||
Inside Out
|
||||
Interstellar
|
||||
Into the Forest of Fireflies Light
|
||||
Into the Woods
|
||||
Iron Man
|
||||
Iron Man 2
|
||||
Iron Man 3
|
||||
It Follows
|
||||
Its a Wonderful Life
|
||||
I, Robot
|
||||
Jagten
|
||||
Jaws
|
||||
John Wick
|
||||
Juno
|
||||
Jurassic Park
|
||||
Jurassic Park: The Lost World
|
||||
Jurassic Park III
|
||||
Jurassic World
|
||||
Jurassic World: Fallen Kingdom
|
||||
Justice League
|
||||
Kick-Ass
|
||||
Kick-Ass 2
|
||||
Kill Bill: Vol. 1
|
||||
Kill Bill: Vol. 2
|
||||
Kingsman: The Secret Service
|
||||
Kiss Kiss Bang Bang
|
||||
Kung Fu Panda
|
||||
Kung Fu Panda 2
|
||||
Kung Fu Panda 3
|
||||
L.A. Confidential
|
||||
La La Land
|
||||
Lady Bird
|
||||
Lady and the Tramp
|
||||
Lawrence of Arabia
|
||||
Leon
|
||||
Let the Right One In
|
||||
Liar, Liar
|
||||
Licence to Kill
|
||||
Life of Brian
|
||||
Lilo and Stitch
|
||||
Live and Let Die
|
||||
Logan
|
||||
Lost in Translation
|
||||
Love Actually
|
||||
Love Simon
|
||||
M
|
||||
Mad Max: Fury Road
|
||||
Madagascar
|
||||
Magnolia
|
||||
Mamma Mia
|
||||
Mamma Mia: Here I Go Again
|
||||
Man of Steel
|
||||
Manchester by the Sea
|
||||
Mary and the Witchs Flower
|
||||
Mary Poppins
|
||||
Mary Poppins Returns
|
||||
Mean Girls
|
||||
Megamind
|
||||
Memento
|
||||
Men In Black
|
||||
Men In Black II
|
||||
Men In Black 3
|
||||
Metropolis
|
||||
Mikael Wulff: Forklarer Alt
|
||||
Moana
|
||||
Monsters, inc.
|
||||
Monsters Vs. Aliens
|
||||
Monty Python and the Holy Grail
|
||||
Moonlight
|
||||
Moonraker
|
||||
Moonrise Kingdom
|
||||
Mulan
|
||||
Mulholland Drive
|
||||
My Little Pony: The Movie
|
||||
My Neighbor Totoro
|
||||
National Treasure
|
||||
National Treasure: Book of Secrets
|
||||
Nausica of the Valley of the Wind
|
||||
Network
|
||||
Never Say Never Again
|
||||
Nightcrawler
|
||||
No Country for Old Men
|
||||
Now You See Me
|
||||
Now You See Me 2
|
||||
O Brother, Where Art Thou?
|
||||
Oceans Eleven
|
||||
Octopussy
|
||||
Office Space
|
||||
Oldboy
|
||||
Olsen-Banden
|
||||
Olsen-Banden Deruda
|
||||
Olsen-Banden Gaar i Krig
|
||||
Olsen-Banden Over Alle Bjerge
|
||||
Olsen-Banden Overgiver Sig Aldrig
|
||||
Olsen-Banden gaar Amok
|
||||
Olsen-Banden i Jylland
|
||||
Olsen-Banden paa Spanden
|
||||
Olsen-Banden paa Sporet
|
||||
Olsen-Banden ser Roedt
|
||||
Olsen-Bandens Flugt Over Plankevaerket
|
||||
Olsen-Bandens Sidste Bedrifter
|
||||
Olsen-Bandens Sidste Stik
|
||||
Olsen-Bandens Store Kup
|
||||
On Her Majesty's Secret Service
|
||||
On the Waterfront
|
||||
Once Upon a Time in the West
|
||||
One Flew Over The Cuckoos Nest
|
||||
Osmosis Jones
|
||||
Over the Hedge
|
||||
Pans Labyrinth
|
||||
Paprika
|
||||
Paranormal Activity
|
||||
Paranormal Activity 2
|
||||
Paranormal Activity 3
|
||||
Paranormal Activity 4
|
||||
Paranormal Activity: The Marked Ones
|
||||
Paris, Texas
|
||||
Paths of Glory
|
||||
Paul Blart Mall Cop
|
||||
Paul Blart Mall Cop 2
|
||||
Perfect Blue
|
||||
Persona
|
||||
Peter Pan
|
||||
Phantom Thread
|
||||
Pinocchio
|
||||
Pirates of the Caribbean: At World's End
|
||||
Pirates of the Caribbean: Dead Man's Chest
|
||||
Pirates of the Caribbean: Dead Men Tell No Tales
|
||||
Pirates of the Caribbean: On Stranger Tides
|
||||
Pirates of the Caribbean: The Curse of the Black Pearl
|
||||
Pitch Perfect
|
||||
Pitch Perfect 2
|
||||
Pitch Perfect 3
|
||||
Planes, Trains and Automobiles
|
||||
Pocahontas
|
||||
Porco Rosso
|
||||
Predator
|
||||
Primer
|
||||
Princess Mononoke
|
||||
Prisoners
|
||||
Psycho
|
||||
Punch-Drunk Love
|
||||
Quantum of Solace
|
||||
Raging Bull
|
||||
Rashomon
|
||||
Ratatouille
|
||||
Ready Player One
|
||||
Rear Window
|
||||
Reservoir Dogs
|
||||
Rio
|
||||
Robin Hood
|
||||
Robots
|
||||
Rocky
|
||||
Rocky II
|
||||
Rocky III
|
||||
Rocky IV
|
||||
Rocky V
|
||||
Rocky Balboa
|
||||
Rogue One: A Star Wars Story
|
||||
Room
|
||||
Rudy
|
||||
Rushmore
|
||||
Saving Mr. Banks
|
||||
Saving Private Ryan
|
||||
Saw
|
||||
Saw II
|
||||
Saw III
|
||||
Saw IV
|
||||
Saw V
|
||||
Saw VI
|
||||
Saw VII
|
||||
Schindlers List
|
||||
School of Rock
|
||||
Scott Pilgrim vs. the World
|
||||
Se7en
|
||||
Seven Samurai
|
||||
Shaun of the Dead
|
||||
Shrek
|
||||
Shrek 2
|
||||
Shrek the Third
|
||||
Shrek Forever After
|
||||
Shutter Island
|
||||
Sicario
|
||||
Signs
|
||||
Sinbad: Legend of the Seven Seas
|
||||
Singing in the Rain
|
||||
Sixth Sense
|
||||
Skyfall
|
||||
Sleeping Beauty
|
||||
Slumdog Millionaire
|
||||
Smokey and the Bandit
|
||||
Smurfs
|
||||
Snow White
|
||||
Solaris
|
||||
Solo: A Star Wars Story
|
||||
Some Like it Hot
|
||||
Space Jam
|
||||
Spectre
|
||||
Speed
|
||||
Spider-man
|
||||
Spider-man 2
|
||||
Spider-man 3
|
||||
Spiderman: Homecoming
|
||||
Spider-man: Into the Spider-verse
|
||||
Spirited away
|
||||
Split
|
||||
Stalker
|
||||
Stand By Me
|
||||
Star Wars Episode I
|
||||
Star Wars Episode II
|
||||
Star Wars Episode III
|
||||
Star Wars Episode IV
|
||||
Star Wars Episode V
|
||||
Star Wars Episode VI
|
||||
Star Wars Episode VII
|
||||
Star Wars Episode VIII
|
||||
Star Wars Holiday Special
|
||||
Starship Troopers
|
||||
Stay Alive
|
||||
Suicide Squad
|
||||
Sunset Blvd.
|
||||
Superbad
|
||||
Superman
|
||||
Superman II
|
||||
Superman III
|
||||
Superman IV: The Quest for Peace
|
||||
Superman Returns
|
||||
Sweeney Todd
|
||||
Synecdoche, New York
|
||||
Tangled
|
||||
Tarzan
|
||||
Taxi Driver
|
||||
Tempelriddernes Skat
|
||||
Tempelriddernes Skat II Stormesterens Hemmelighed
|
||||
Tempelriddernes Skat III
|
||||
Tenacious D in The Pick of Destiny
|
||||
Terminator
|
||||
Terminator 2
|
||||
Terminator 3
|
||||
Terminator Genisys
|
||||
Terminator Salvation
|
||||
The 400 Blows
|
||||
The Apartment
|
||||
The Aristocats
|
||||
The Assassination of Jesse James by the Coward Robert Ford
|
||||
The Avengers
|
||||
The Avengers: Age of Ultron
|
||||
The Avengers: Infinity War
|
||||
The Ballad of Big Al
|
||||
The Big Lebowski
|
||||
The Blind Side
|
||||
The Breakfast Club
|
||||
The Bridge on the River Kwai
|
||||
The Bucket List
|
||||
The Butterfly Effect
|
||||
The Cabin in the Woods
|
||||
The Dark Knight
|
||||
The Dark Knight Rises
|
||||
The Deer Hunter
|
||||
The Departed
|
||||
The Disaster Artist
|
||||
The Emperor's new Groove
|
||||
The Fast and the Furious
|
||||
The Fast and the Furious 2
|
||||
The Fast and the Furious 3
|
||||
The Fast and the Furious 4
|
||||
The Fast and the Furious 5
|
||||
The Fast and the Furious 6
|
||||
The Fast and the Furious 7
|
||||
The Fault in Our Stars
|
||||
The Florida Project
|
||||
The Founder
|
||||
The Game
|
||||
The Garden of Words
|
||||
The Godfather
|
||||
The Godfather: Part II
|
||||
The Godfather: Part III
|
||||
The Good, the Bad and the Ugly
|
||||
The Graduate
|
||||
The Grand Budapest Hotel
|
||||
The Great Dictator
|
||||
The Green Mile
|
||||
The Handmaiden
|
||||
The Hunchback of Notre Dame
|
||||
The Imitation Game
|
||||
The Incredible Hulk
|
||||
The Incredibles
|
||||
The Intern
|
||||
The Intouchables
|
||||
The Iron Giant
|
||||
The Jungle Book
|
||||
The LEGO Batman Movie
|
||||
The LEGO Movie
|
||||
The Lion King
|
||||
The Lion King 1
|
||||
The Little Mermaid
|
||||
The Living Daylights
|
||||
The Lord of the Rings: The Fellowship of the Ring
|
||||
The Lord of the Rings: The Return of the King
|
||||
The Lord of the Rings: The Two Towers
|
||||
The Man with the Golden Gun
|
||||
The Many Adventures of Winnie the Pooh
|
||||
The Martian
|
||||
The Mask
|
||||
The Master
|
||||
The Matrix
|
||||
The Matrix Reloaded
|
||||
The Matrix Revolutions
|
||||
The Mummy
|
||||
The Nice Guys
|
||||
The Nightmare Before Christmas
|
||||
The Nutty Professor
|
||||
The Perks of Being a Wallflower
|
||||
The Prestige
|
||||
The Prince of Egypt
|
||||
The Princess and the Frog
|
||||
The Princess Bride
|
||||
The Purge
|
||||
The Purge 2
|
||||
The Purge 3
|
||||
The Purge 4
|
||||
The Road to El Dorado
|
||||
The Room
|
||||
The Royal Tenenbaums
|
||||
The Santa Clause
|
||||
The Searchers
|
||||
The Seventh Seal
|
||||
The Shape of Water
|
||||
The Shawshank Redemption
|
||||
The Silence of the Lambs
|
||||
The Simpsons Movie
|
||||
The Social Network
|
||||
The Sound of Music
|
||||
The Spy Who Loved Me
|
||||
The Sting
|
||||
The Sword in the Stone
|
||||
The Terminal
|
||||
The Thing
|
||||
The Third Man
|
||||
The To Do List
|
||||
The Treasure of the Sierra Madre
|
||||
The Truman Show
|
||||
The Usual Suspects
|
||||
The Wolf of Wall Street
|
||||
The Wolverine
|
||||
The World Is Not Enough
|
||||
The Worlds End
|
||||
The Wind Rises
|
||||
The Wizard of Oz
|
||||
There Will Be Blood
|
||||
This Is Spinal Tap
|
||||
Thor
|
||||
Thor: Ragnarok
|
||||
Thor: The Dark World
|
||||
Three Billboards Outside Ebbing, Missouri
|
||||
Thunderball
|
||||
Titanic
|
||||
To Kill a Mockingbird
|
||||
Tokyo Story
|
||||
Tomorrow Never Dies
|
||||
Toy Story
|
||||
Toy Story 2
|
||||
Toy Story 3
|
||||
Trainspotting
|
||||
Transformers
|
||||
Transformers 2: Revenge of the Fallen
|
||||
Transformers 3: Dark of the Moon
|
||||
Transformers 4: Age of Extinction
|
||||
Transformers 5: The Last Knight
|
||||
Trolls
|
||||
Turbo
|
||||
Twilight
|
||||
Twilight: New Moon
|
||||
Twilight: Eclipse
|
||||
Twilight: Breaking Dawn part 1
|
||||
Twilight: Breaking Dawn part 2
|
||||
Unbreakable
|
||||
Uncle Buck
|
||||
Unforgiven
|
||||
Up
|
||||
Venom
|
||||
Vertigo
|
||||
Wall-E
|
||||
War of the Worlds
|
||||
Watchmen
|
||||
Waynes World
|
||||
What We Do in the Shadows
|
||||
Whiplash
|
||||
White Chicks
|
||||
Wild Strawberries
|
||||
Willy Wonka and the Chocolate Factory
|
||||
Wind River
|
||||
Wolf Children
|
||||
Wonder Woman
|
||||
Wreck-it-Ralph
|
||||
Wreck-it-Ralph Breaks the Internet
|
||||
X-Men
|
||||
X-Men 2
|
||||
X-Men: Apocalypse
|
||||
X-Men: Days of Future Past
|
||||
X-Men: First Class
|
||||
X-Men Origins: Wolverine
|
||||
X-Men: The Last Stand
|
||||
Yojimbo
|
||||
You Only Live Twice
|
||||
Young Frankenstein
|
||||
Your Name
|
||||
Zodiac
|
||||
Zombieland
|
||||
Zoolander
|
||||
Zootopia
|
307
names.txt
Normal file
307
names.txt
Normal file
@ -0,0 +1,307 @@
|
||||
Eddard Ned Stark
|
||||
Robert Baratheon
|
||||
Jaime Lannister
|
||||
Catelyn Stark
|
||||
Cersei Lannister
|
||||
Daenerys Targaryen
|
||||
Jorah Mormont
|
||||
Viserys Targaryen
|
||||
Jon Snow
|
||||
Sansa Stark
|
||||
Arya Stark
|
||||
Robb Stark
|
||||
Theon Greyjoy
|
||||
Bran Stark
|
||||
Joffrey Baratheon
|
||||
Sandor The Hound Clegane
|
||||
Tyrion Lannister
|
||||
Khal Drogo
|
||||
Petyr Littlefinger Baelish
|
||||
Davos Seaworth
|
||||
Samwell Tarly
|
||||
Stannis Baratheon
|
||||
Melisandre
|
||||
Jeor Mormont
|
||||
Bronn
|
||||
Varys
|
||||
Shae
|
||||
Margaery Tyrell
|
||||
Tywin Lannister
|
||||
Talisa Maegyr
|
||||
Ygritte
|
||||
Gendry
|
||||
Tormund Giantsbane
|
||||
Brienne of Tarth
|
||||
Ramsay Bolton
|
||||
Gilly
|
||||
Daario Naharis
|
||||
Missandei
|
||||
Ellaria Sand
|
||||
Tommen Baratheon
|
||||
Jaqen H'ghar
|
||||
Roose Bolton
|
||||
The High Sparrow
|
||||
Grand Maester Pycelle
|
||||
Meryn Trant
|
||||
Hodor
|
||||
Grenn
|
||||
Osha
|
||||
Rickon Stark
|
||||
Ros
|
||||
Gregor Clegane
|
||||
Janos Slynt
|
||||
Lancel Lannister
|
||||
Myrcella Baratheon
|
||||
Rodrik Cassel
|
||||
Maester Luwin
|
||||
Irri
|
||||
Doreah
|
||||
Kevan Lannister
|
||||
Barristan Selmy
|
||||
Rast
|
||||
Maester Aemon
|
||||
Pypar
|
||||
Alliser Thorne
|
||||
Othell Yarwyck
|
||||
Loras Tyrell
|
||||
Hot Pie
|
||||
Beric Dondarrion
|
||||
Podrick Payne
|
||||
Eddison Tollett
|
||||
Yara Greyjoy
|
||||
Selyse Florent
|
||||
Little Sam
|
||||
Grey Worm
|
||||
Qyburn
|
||||
Olenna Tyrell
|
||||
Shireen Baratheon
|
||||
Meera Reed
|
||||
Jojen Reed
|
||||
Thoros of Myr
|
||||
Yohn Royce
|
||||
Olly
|
||||
Mace Tyrell
|
||||
The Waif
|
||||
Bowen Marsh
|
||||
Aragorn
|
||||
Arwen
|
||||
Bilbo
|
||||
Boromir
|
||||
Celeborn
|
||||
Denethor
|
||||
Elrond
|
||||
Eomer
|
||||
Eowyn
|
||||
Faramir
|
||||
Frodo
|
||||
Galadriel
|
||||
Gandalf
|
||||
Gimli
|
||||
Gollum
|
||||
Legolas
|
||||
Merry
|
||||
Mouth of Sauron
|
||||
Old Man Willow
|
||||
Pippin
|
||||
Radagast
|
||||
Sam
|
||||
Saruman
|
||||
Sauron
|
||||
Shelob
|
||||
Theoden
|
||||
Tom Bombadil
|
||||
Treebeard
|
||||
Witch king
|
||||
Wormtongue
|
||||
Adon
|
||||
Methrammar Aerasume
|
||||
Sernius Alathar
|
||||
Alaundo
|
||||
Alias
|
||||
Alicia Kendrick
|
||||
Arganth Snarrl
|
||||
Khelben Arunsun
|
||||
Jorus Azuremantle
|
||||
Berg'inyon Baenre
|
||||
Dantrag Baenre
|
||||
Gromph Baenre
|
||||
Liriel Baenre
|
||||
Quenthel Baenre
|
||||
Triel Baenre
|
||||
Yvonnel Baenre
|
||||
Balduron
|
||||
Bruenor Battlehammer
|
||||
Akabar Bel Akash
|
||||
Belhifet
|
||||
Aballister Bonaduce
|
||||
Erevis Cale
|
||||
Captain Deudermont
|
||||
Catti-brie
|
||||
Clacker
|
||||
Companions of the Hall
|
||||
Elaith Craulnober
|
||||
Cyric
|
||||
Danica Maupoissant
|
||||
Montolio Debrouchee
|
||||
Briza Do'Urden
|
||||
Dinin Do'Urden
|
||||
Malice Do'Urden
|
||||
Maya Do'Urden
|
||||
Nalfein Do'Urden
|
||||
Shi'nayne Do'Urden
|
||||
Vartha Do'Urden
|
||||
Vierna Do'Urden
|
||||
Drizzt Do'Urden
|
||||
Dove Falconhand
|
||||
Dragonbait
|
||||
Gareth Dragonsbane
|
||||
Elk Tribe
|
||||
Ellifain
|
||||
Elminster
|
||||
Artemis Entreri
|
||||
Errtu
|
||||
Galaeron Nihmedu
|
||||
Volothamp Geddarm
|
||||
Halisstra Melarn
|
||||
Halueth Never
|
||||
Harkle Harpell
|
||||
Taern Hornblade
|
||||
Imoen
|
||||
Ingeloakastimizilian
|
||||
Innovindil
|
||||
Ivan and Pikel Bouldershoulder
|
||||
Jander Sunstar
|
||||
Jarlaxle
|
||||
Kelemvor Lyonsbane
|
||||
Kierkan Rufo
|
||||
Manshoon
|
||||
Obould Many-Arrows
|
||||
Minder the Golem
|
||||
Minsc
|
||||
Pharaun Mizzrym
|
||||
Arilyn Moonblade
|
||||
Narnra Shalace
|
||||
Nasher Alagondar
|
||||
Taegan Nightwind
|
||||
Nimor Imphraezl
|
||||
Thibbledorf Pwent
|
||||
Regis Rumblebelly
|
||||
Rizzen Do'Urden
|
||||
Sammaster
|
||||
Seven Sisters
|
||||
Shandril Shessair
|
||||
Alustriel Silverhand
|
||||
The Simbul
|
||||
Storm Silverhand
|
||||
Sylune
|
||||
Szass Tam
|
||||
Tarathiel
|
||||
Araevin Teshurr
|
||||
Danilo Thann
|
||||
Urlgen Threefist
|
||||
Valas Hune
|
||||
Vangerdahast
|
||||
Wulfgar
|
||||
Finder Wyvernspur
|
||||
Yharaskrik
|
||||
Zaknafein Do'Urden
|
||||
Johnny Depp
|
||||
Arnold Schwarzenegger
|
||||
Jim Carrey
|
||||
Emma Watson
|
||||
Daniel Radcliffe
|
||||
Leonardo DiCaprio
|
||||
Tom Cruise
|
||||
Brad Pitt
|
||||
Charles Chaplin
|
||||
Morgan Freeman
|
||||
Tom Hanks
|
||||
Hugh Jackman
|
||||
Matt Damon
|
||||
Sylvester Stallone
|
||||
Will Smith
|
||||
Clint Eastwood
|
||||
Cameron Diaz
|
||||
George Clooney
|
||||
Steven Spielberg
|
||||
Harrison Ford
|
||||
Robert De Niro
|
||||
Al Pacino
|
||||
Robert Downey Jr.
|
||||
Russell Crowe
|
||||
Liam Neeson
|
||||
Kate Winslet
|
||||
Mark Wahlberg
|
||||
Natalie Portman
|
||||
Pierce Brosnan
|
||||
Sean Connery
|
||||
Orlando Bloom
|
||||
Dwayne Johnson
|
||||
Jackie Chan
|
||||
Angelina Jolie
|
||||
Adam Sandler
|
||||
Scarlett Johansson
|
||||
Heath Ledger
|
||||
Anne Hathaway
|
||||
Jessica Alba
|
||||
Edward Norton
|
||||
Keira Knightley
|
||||
Bradley Cooper
|
||||
Will Ferrell
|
||||
Julia Roberts
|
||||
Nicolas Cage
|
||||
Daniel Craig
|
||||
Keanu Reeves
|
||||
Ian McKellen
|
||||
Halle Berry
|
||||
Bruce Willis
|
||||
Samuel L. Jackson
|
||||
Ben Stiller
|
||||
Tommy Lee Jones
|
||||
Antonio Banderas
|
||||
Denzel Washington
|
||||
Steve Carell
|
||||
Shia LaBeouf
|
||||
Megan Fox
|
||||
James Franco
|
||||
Mel Gibson
|
||||
Vin Diesel
|
||||
Tim Allen
|
||||
Robin Williams
|
||||
Kevin Spacey
|
||||
Jason Biggs
|
||||
Seann William Scott
|
||||
Jean-Claude Van Damme
|
||||
Zach Galifianakis
|
||||
Owen Wilson
|
||||
Christian Bale
|
||||
Peter Jackson
|
||||
Sandra Bullock
|
||||
Bruce Lee
|
||||
Drew Barrymore
|
||||
Macaulay Culkin
|
||||
Jack Nicholson
|
||||
Bill Murray
|
||||
Sigourney Weaver
|
||||
Jake Gyllenhaal
|
||||
Kamal Haasan
|
||||
Jason Statham
|
||||
Jet Li
|
||||
Kate Beckinsale
|
||||
Rowan Atkinson
|
||||
Marlon Brando
|
||||
John Travolta
|
||||
Channing Tatum
|
||||
Ben Affleck
|
||||
Shah Rukh Khan
|
||||
Jennifer Aniston
|
||||
Emma Stone
|
||||
Chris Hemsworth
|
||||
James McAvoy
|
||||
James Cameron
|
||||
Amitabh Bachchan
|
||||
Brendan Fraser
|
||||
Rachel McAdams
|
||||
Tom Hiddleston
|
||||
Aamir Khan
|
||||
Rajinikanth
|
3645
spells.json
Normal file
3645
spells.json
Normal file
File diff suppressed because it is too large
Load Diff
20
swchar.py
Normal file
20
swchar.py
Normal file
@ -0,0 +1,20 @@
|
||||
import json
|
||||
|
||||
def charData(user : str, key : str,cmd : str = ""):
|
||||
with open("characters.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
if user in data:
|
||||
if key in data[user]:
|
||||
if cmd == "":
|
||||
return data[user][key]
|
||||
else:
|
||||
data[user]["Name"] = cmd
|
||||
with open("characters.json", "w") as f:
|
||||
json.dump(data,f,indent = 4)
|
||||
return "Changed " + user + "'s character's name to " + cmd
|
||||
else:
|
||||
return "Couldn't find that data. Are you sure you spelled it correctly?"
|
||||
else:
|
||||
return "You don't have a character. You can make one with !swchar"
|
||||
|
135
swroll.py
Normal file
135
swroll.py
Normal file
@ -0,0 +1,135 @@
|
||||
import random
|
||||
import re
|
||||
|
||||
def roll(abi : int = 1, prof : int = 0, dif : int = 3, cha : int = 0, boo : int = 0, setb : int = 0, force : int = 0):
|
||||
result = ""
|
||||
for x in range(abi):
|
||||
result += random.choice(["","S","S","SS","A","A","SA","AA"])
|
||||
|
||||
for x in range(prof):
|
||||
result += random.choice(["","S","S","SS","SS","A","SA","SA","SA","AA","AA","R"])
|
||||
|
||||
for x in range(dif):
|
||||
result += random.choice(["","F","FF","H","H","H","HH","FH"])
|
||||
|
||||
for x in range(cha):
|
||||
result += random.choice(["","F","F","FF","FF","H","H","FH","FH","HH","HH","D"])
|
||||
|
||||
for x in range(boo):
|
||||
result += random.choice(["","","S","SA","AA","A"])
|
||||
|
||||
for x in range(setb):
|
||||
result += random.choice(["","","F","F","H","H"])
|
||||
|
||||
for x in range (force):
|
||||
result += random.choice(["B","B","B","B","B","B","BB","L","L","Ll","LL","LL"])
|
||||
|
||||
return result
|
||||
|
||||
def simplify(result : str):
|
||||
simp = ""
|
||||
success = (result.count('S') + result.count('R')) - (result.count('F') + result.count('D'))
|
||||
advantage = result.count('A') - result.count('H')
|
||||
result = re.sub("S|A|F|H","",result)
|
||||
|
||||
if success > 0:
|
||||
for x in range(success):
|
||||
simp += "S"
|
||||
elif success < 0:
|
||||
for x in range(abs(success)):
|
||||
simp += "F"
|
||||
|
||||
if advantage > 0:
|
||||
for x in range(advantage):
|
||||
simp += "A"
|
||||
elif advantage < 0:
|
||||
for x in range(abs(advantage)):
|
||||
simp += "H"
|
||||
|
||||
simp += result
|
||||
|
||||
return simp
|
||||
|
||||
def resultToEmoji(result : str):
|
||||
emoji = ""
|
||||
for char in result:
|
||||
if char == 'S':
|
||||
emoji += "<:success:690971244971163718> "
|
||||
if char == 'A':
|
||||
emoji += "<:advantage:690970761611051079> "
|
||||
if char == 'R':
|
||||
emoji += "<:swtriumph:690971267486187643> "
|
||||
if char == 'F':
|
||||
emoji += "<:failure:690970957786906664> "
|
||||
if char == 'H':
|
||||
emoji += "<:threat:690971009469382656> "
|
||||
if char == 'D':
|
||||
emoji += "<:despair:690971200163414238> "
|
||||
if char == 'L':
|
||||
emoji += "<:light:691010089905029171>"
|
||||
if char == 'B':
|
||||
emoji += "<:dark:691010101901000852>"
|
||||
|
||||
return emoji
|
||||
|
||||
def diceToEmoji(dice : list):
|
||||
emoji = ""
|
||||
|
||||
for x in range(dice[0]):
|
||||
emoji += "<:ability:690974213397282826> "
|
||||
for x in range(dice[1]):
|
||||
emoji += "<:proficiency:690973435354153071> "
|
||||
for x in range(dice[2]):
|
||||
emoji += "<:difficulty:690973992470708296> "
|
||||
for x in range(dice[3]):
|
||||
emoji += "<:challenge:690973419906400306> "
|
||||
for x in range(dice[4]):
|
||||
emoji += "<:boost:690972178216386561> "
|
||||
for x in range(dice[5]):
|
||||
emoji += "<:setback:690972157890658415> "
|
||||
for x in range(dice[6]):
|
||||
emoji += "<:force:690973451883774013> "
|
||||
|
||||
return emoji
|
||||
|
||||
def parseRoll(user : str,cmd : str):
|
||||
cmd = re.sub(' +',' ',cmd.upper()) + " "
|
||||
if cmd[0] == " ":
|
||||
cmd = cmd[1:]
|
||||
commands = cmd.split(" ")
|
||||
if commands[0] == "":
|
||||
rollParameters = [1,0,3,0,0,0,0]
|
||||
else:
|
||||
rollParameters = [0,0,0,0,0,0,0]
|
||||
|
||||
try:
|
||||
for x in range(len(commands)):
|
||||
if commands[x-1] != "":
|
||||
if commands[x-1][0] == "A":
|
||||
rollParameters[0] = int(commands[x-1].replace("A",""))
|
||||
elif commands[x-1][0] == "P":
|
||||
rollParameters[1] = int(commands[x-1].replace("P",""))
|
||||
elif commands[x-1][0] == "D":
|
||||
rollParameters[2] = int(commands[x-1].replace("D",""))
|
||||
elif commands[x-1][0] == "C":
|
||||
rollParameters[3] = int(commands[x-1].replace("C",""))
|
||||
elif commands[x-1][0] == "B":
|
||||
rollParameters[4] = int(commands[x-1].replace("B",""))
|
||||
elif commands[x-1][0] == "S":
|
||||
rollParameters[5] = int(commands[x-1].replace("S",""))
|
||||
elif commands[x-1][0] == "F":
|
||||
rollParameters[6] = int(commands[x-1].replace("F",""))
|
||||
else:
|
||||
rollParameters[x-1] = int(commands[x-1])
|
||||
except:
|
||||
return "Invalid input!"
|
||||
|
||||
rollResults = roll(rollParameters[0],rollParameters[1],rollParameters[2],rollParameters[3],rollParameters[4],rollParameters[5],rollParameters[6])
|
||||
|
||||
simplified = simplify(rollResults)
|
||||
|
||||
if simplified != rollResults:
|
||||
return user + " rolls " + diceToEmoji(rollParameters) + "\nResult: " + resultToEmoji(rollResults) + "\nSimplified: " + resultToEmoji(simplify(rollResults))
|
||||
else:
|
||||
return user + " rolls " + diceToEmoji(rollParameters) + "\nResult: " + resultToEmoji(rollResults)
|
||||
|
Reference in New Issue
Block a user