def main(difficulty=0): objectivelist = hb.rotate(hb.arrayreader("missionobjectives.txt")) objectivelist[1] = [float(i) for i in objectivelist[1]] #The complications has four rows, name, relative probability of expected complication, relative probability of unexpected complication, reward multiplier . complicationlist = hb.rotate(hb.arrayreader("missioncomplications.txt")) j = 1 while j < 3: complicationlist[j] = [float(i) for i in complicationlist[j]] j += 1 if difficulty == 0: difficulty = round(np.random.triangular(0.6, 0.6, 10.5)) reward = random.randint(8, 12) * 4**difficulty * 10 objectivenum = 1 objectivenum += 1 + round((random.random() * difficulty / 3)) objectives = [] while len(objectives) < objectivenum: objectivelist[1] = hb.normalise(objectivelist[1]) dumb = np.random.choice(objectivelist[0], p=objectivelist[1]) index = objectivelist[0].index(dumb) objectives.append(dumb) objectivelist = hb.arraycleaner(objectivelist, index) opencompicationnum = random.randint(0, 2) + round( (random.random() * difficulty / 4)) opencomplications = [] while len(opencomplications) < opencompicationnum: complicationlist[1] = hb.normalise(complicationlist[1]) dumb = np.random.choice(complicationlist[0], p=complicationlist[1]) index = complicationlist[0].index(dumb) opencomplications.append(dumb) reward *= float(complicationlist[3][index]) complicationlist = hb.arraycleaner(complicationlist, index) secretcompicationnum = random.randint(0, 2) + round( (random.random() * difficulty / 4)) secretcomplications = [] while len(secretcomplications) < secretcompicationnum: complicationlist[2] = hb.normalise(complicationlist[2]) dumb = np.random.choice(complicationlist[0], p=complicationlist[2]) index = complicationlist[0].index(dumb) secretcomplications.append(dumb) reward *= float(complicationlist[3][index]) complicationlist = hb.arraycleaner(complicationlist, index) reward = hb.sigfig(reward, 2) output = {} output["difficulty"] = difficulty output["objectives"] = objectives output["reward"] = reward output["opencomplications"] = opencomplications output["secretcomplications"] = secretcomplications return (output)
import numpy as np import innnamegenerator as name import homebrew as hb odditylist = (hb.arrayreader("innoddity.txt")) odditylist = (hb.rotate(odditylist)) with open("innspeciality.txt") as f: specialtylist = f.read().splitlines() with open("innsecret.txt") as f: secretlist = f.read().splitlines() def main(): output = {} output["name"] = name.main() output["oddity"] = np.random.choice(odditylist[0]) output["specialty"] = np.random.choice(specialtylist) if np.random.random() < 0.85: output["secret"] = "The beer is watered down" else: output["secret"] = np.random.choice(secretlist) return (output)
fantasyocupationstype = [ "Academia", "Artisan", "Bourgeoisie", "Common", "Law", "Magic", "Nature", "Outlaw", "Performer", "Religion", "Warrior" ] with open("NPCcharacteristics.txt", encoding='latin-1') as f: characteristiclist = f.read().splitlines() with open("medievalNPCcharacteristics.txt", encoding='latin-1') as f: characteristiclist += f.read().splitlines() with open("NPCtraits.txt", encoding='latin-1') as f: traitlist = f.read().splitlines() occupationlist = (hb.arrayreader("medievalNPCoccupation.txt")) occupationlist += (hb.arrayreader("fantasyNPCoccupation.txt")) occupationlist = hb.rotate(occupationlist) with open("NPCsecrets.txt", encoding='latin-1') as f: secretlist = f.read().splitlines() with open("fantasyNPCsecrets.txt", encoding='latin-1') as f: secretlist += f.read().splitlines() with open("medievalNPCsecrets.txt", encoding='latin-1') as f: secretlist += f.read().splitlines() with open("femalename.txt", encoding='latin-1') as f: femalenamelist = f.read().splitlines()
import numpy as np import innnamegenerator as name import homebrew as hb odditylist = (hb.arrayreader("innoddity.txt")) odditylist += (hb.arrayreader("fantasyinnoddity.txt")) odditylist = (hb.rotate(odditylist)) with open("innspeciality.txt") as f: specialtylist = f.read().splitlines() with open("innsecret.txt") as f: secretlist = f.read().splitlines() with open("fantasyinnsecret.txt") as f: secretlist += f.read().splitlines() def main(): output = {} output["name"] = name.main() output["oddity"] = np.random.choice(odditylist[0]) output["specialty"] = np.random.choice(specialtylist) if np.random.random() < 0.85: output["secret"] = "The beer is watered down" else: output["secret"] = np.random.choice(secretlist) return (output)
import numpy as np import homebrew as hb riddlelist = (hb.arrayreader("riddles.txt")) # List of all riddles, needs to be rotated to be human readable. def main(input): input = int(input) if (input == 0): #leveledlist is the list of riddles that fit the difficulty parameter leveledlist = riddlelist else: leveledlist = [] for riddle in riddlelist: if (int(riddle[0]) == input): leveledlist.append(riddle) leveledlist.append(riddle) leveledlist.append(riddle) if (abs(int(riddle[0]) - input) == 0): leveledlist.append(riddle) #Riddles with difficulties +- 1 the stated value can be picked but they are a 1/3 as likely. leveledlist = (hb.rotate(leveledlist)) output = {} i = np.random.randint(0, len(leveledlist[0])) output["riddle"] = leveledlist[1][i] output["answer"] = leveledlist[2][i] return (output)
import fantasysettlementgenerator import fantasybookgenerator import syfanplanetgenerator import riddlegenerator import weathergenerator import medievalshipnamegenerator import names import psqlfunctions as psqlf import homebrew as hb import racemanagement as rm import numpy as np from titlecase import titlecase taglist = (hb.arrayreader("universaltags.txt")) def main(ctx, races, item, *args): arg = [] for input in args: arg.append(input) # /|\\|//|\\|//|\\|//|\\|//|\\|//|\\|//|\\|//|\\|//|\\|/ # Genre prep # /|\\|//|\\|//|\\|//|\\|//|\\|//|\\|//|\\|//|\\|//|\\|/ dum = [] if item in ["fantasynpc", "fnpc", "fantasyinn", "finn", "fantasysettlement", "fsettlement", "fset", "fantasybookcase", "fbookcase", "fbc", "fantasybook", "fbook"]:
import numpy as np import homebrew as hb # import the content from the text files templist = (hb.arrayreader("temperatures.txt")) weatherlist = (hb.arrayreader("weathers.txt")) rareweatherlist = (hb.arrayreader("rareweathers.txt")) def main(input): rand = np.random.random() #initialize lists templistselect = [] templistselect2 = [] weatherlistselect = [] weatherlistselect2 = [] #sets a random but weighted temperature for the provided climate, temp takes values between 1 and 5 if (input == "arctic" or input == "polar" or input == "1"): if rand < 0.6: temp = 1 elif rand < 0.97: temp = 2 else: temp = 3 elif (input == "winter" or input == "cold" or input == "2"):
import discord from discord.ext import commands import interface import homebrew as hb with open("token.txt", encoding='latin-1') as f: TOKEN = f.read() with open("discordid.txt", encoding='latin-1') as f: idnum = f.read() prefixes = hb.rotate(hb.arrayreader("prefixes.txt")) prefixes[0] = [int(i) for i in prefixes[0]] with open("helptext.txt", encoding='latin-1') as f: helptext = f.read().splitlines() with open("itemlisttext.txt", encoding='latin-1') as f: itemlisttext = f.read().splitlines() def prefix(bot, message): # Function finds the prefix ussed by the guild prefix = "!" if isinstance(message.channel, discord.abc.GuildChannel): for n in range(len(prefixes[0])): if int(prefixes[0][n - 1]) == message.guild.id: prefix = int(prefixes[0][n - 1]) prefix = str(prefixes[1][n - 1]) return (prefix)