Initial commit

This commit is contained in:
nullifierwastaken
2026-01-19 13:25:52 +11:00
commit 278f080a53
2 changed files with 122 additions and 0 deletions

119
main.py Normal file
View File

@@ -0,0 +1,119 @@
import sqlite3
from random import randint
import os
races = ["Hill Dwarf", "Mountain Dwarf", "High Elf", "Wood Elf", "Drow", "Lightfoot Halfling", "Stout Halfling", "Human", "Dragonborn", "Forest Gnome", "Rock Gnome", "Half-Orc", "Tiefling", "Aasimar", "Eladrin Elf", "Aarakocra", "Deep Gnome", "Air Genasi", "Earth Genasi", "Fire Genasi", "Water Genasi", "Grey Duergar Dwarf", "Ghostwise Halfling", "Deep Svirfneblin Gnome", "Feral Tiefling", "Protector Aasimar", "Scourge Aasimar", "Fallen Aasimar", "Firbolg", "Goliath", "Kenku", "Lizardfolk", "Tabaxi", "Triton", "Bugbear", "Goblin", "Hobgoblin", "Kobold", "Orc", "Yuan-ti Pureblood", "Sea Elf", "Shadar-kai Elf", "Duergar Dwarf", "Githyanki", "Githzerai", "Tortle", "Verdan", "Kalashtar", "Beasthide Shifter", "Longtooth Shifter", "Swiftstride Shifter", "Wildhunt Swiftstride", "Centaur", "Loxodon", "Minotaur", "Vedalken", "Leonin", "Satyr"]
classes = ["Barbarian", "Bard", "Cleric", "Druid", "Fighter", "Monk", "Paladin", "Ranger", "Rogue", "Sorcerer", "Warlock", "Wizard", "Artificer"]
genders = ["male", "female", "non-binary"]
if os.path.exists("data.db") == False:
db = sqlite3.connect("data.db")
cursor = db.cursor()
cursor.execute("CREATE TABLE party (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, gender TEXT, race TEXT, class TEXT, level INTEGER, exp INTEGER, gold INTEGER, strength INTEGER, dexterity INTEGER, constitution INTEGER, intelligence INTEGER, wisdom INTEGER, charisma INTEGER, main INTEGER)")
cursor.execute("CREATE TABLE races (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, strength INTEGER, dexterity INTEGER, constitution INTEGER, intelligence INTEGER, wisdom INTEGER, charisma INTEGER)")
mainname = input("What do you wish to be called? ")
while True:
maingender = input("What gender are you? (Male, Female, Non-Binary) ")
if maingender.lower() not in genders:
print("Not a valid input")
else:
break
while True:
mainrace = input("Which race do you wish to be (type help for list of races) ")
if mainrace.lower() == "help":
for i in races:
print(i)
elif mainrace.title() in races:
break
else:
print("Not a valid input")
while True:
mainclass = input("Which class do you wish to be (type help for list of classes) ")
if mainclass.lower() == "help":
for i in classes:
print(i)
elif mainclass.title() in classes:
break
else:
print("Not a valid input")
cursor.execute("INSERT INTO party (name, gender, race, class, level, exp, gold, strength, dexterity, constitution, intelligence, wisdom, charisma, main) VALUES (?, ?, ?, ?, 1, 0, 50, ?, ?, ?, ?, ?, ?, 1)", (mainname.title(), maingender.title(), mainrace.title(), mainclass.title(), (randint(1,6) + randint(1,6) + randint(1,6) + randint(1,6)), (randint(1,6) + randint(1,6) + randint(1,6) + randint(1,6)), (randint(1,6) + randint(1,6) + randint(1,6) + randint(1,6)), (randint(1,6) + randint(1,6) + randint(1,6) + randint(1,6)), (randint(1,6) + randint(1,6) + randint(1,6) + randint(1,6)), (randint(1,6) + randint(1,6) + randint(1,6) + randint(1,6))))
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Hill Dwarf', 0, 0, 2, 0, 1, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Mountain Dwarf', 2, 0, 2, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('High Elf', 0, 2, 0, 1, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Wood Elf', 0, 2, 0, 0, 1, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Drow', 0, 2, 0, 0, 0, 1)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Lightfoot Halfling', 0, 2, 1, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Stout Halfling', 0, 2, 1, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Human', 1, 1, 1, 1, 1, 1)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Dragonborn', 2, 0, 0, 0, 0, 1)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Forest Gnome', 0, 1, 0, 2, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Rock Gnome', 0, 1, 0, 2, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Half-Orc', 2, 0, 1, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Tiefling', 0, 0, 0, 1, 0, 2)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Aasimar', 0, 0, 0, 0, 1, 2)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Eladrin Elf', 0, 2, 0, 1, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Aarkocra', 0, 2, 0, 0, 1, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Deep Gnome', 0, 1, 0, 2, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Air Genasi', 0, 1, 2, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Earth Genasi', 1, 0, 2, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Fire Genasi', 0, 0, 2, 1, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Water Genasi', 0, 0, 2, 0, 1, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Goliath', 2, 0, 1, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Grey Duergar Dwarf', 1, 0, 2, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Ghostwise Halfling', 1, 0, 2, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Deep Svirfneblin Gnome', 0, 1, 0, 2, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Feral Tiefling', 0, 2, 0, 1, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Protector Aasimar', 0, 0, 0, 0, 1, 2)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Scourge Aasimar', 0, 0, 1, 0, 0, 2)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Fallen Aasimar', 1, 0, 0, 0, 0, 2)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Firbolg', 1, 0, 0, 0, 2, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Kenku', 0, 2, 0, 0, 1, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Lizardfolk', 0, 0, 2, 0, 1, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Tabaxi', 0, 2, 0, 0, 0, 1)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Triton', 1, 0, 1, 0, 0, 1)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Bugbear', 2, 1, 0, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Goblin', 0, 2, 1, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Hobgoblin', 0, 0, 2, 1, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Kobold', 0, 2, 0, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Orc', 2, 0, 1, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Yuan-ti Pureblood', 0, 0, 0, 1, 0, 2)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Sea Elf', 0, 2, 1, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Shadar-kai Elf', 0, 2, 1, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Duergar Dwarf', 1, 0, 2, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Githyanki', 2, 0, 0, 1, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Githzerai', 0, 0, 0, 1, 2, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Tortle', 2, 0, 0, 0, 1, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Verdan', 0, 0, 1, 0, 0, 2)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Kalashtar', 0, 0, 0, 0, 2, 1)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Beasthide Shifter', 1, 0, 2, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Longtooth Shifter', 2, 1, 0, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Swiftstride Shifter', 0, 2, 0, 0, 0, 1)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Wildhunt Swiftstride', 0, 1, 0, 0, 2, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Centaur', 2, 0, 0, 0, 1, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Loxodon', 0, 0, 2, 0, 1, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Minotaur', 2, 0, 1, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Vedalken', 0, 0, 0, 2, 1, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Leonin', 1, 0, 2, 0, 0, 0)")
cursor.execute("INSERT INTO races (name, strength, dexterity, constitution, intelligence, wisdom, charisma) VALUES ('Satyr', 0, 1, 0, 0, 0, 2)")
db.commit()
cursor.execute("SELECT races.strength, races.dexterity, races.constitution, races.intelligence, races.wisdom, races.charisma FROM races INNER JOIN party ON races.name = party.race WHERE party.main = 1")
modifiers = cursor.fetchone()
cursor.execute("UPDATE party SET strength = strength + ? WHERE main = 1", (modifiers[0],))
cursor.execute("UPDATE party SET dexterity = dexterity + ? WHERE main = 1", (modifiers[1],))
cursor.execute("UPDATE party SET constitution = constitution + ? WHERE main = 1", (modifiers[2],))
cursor.execute("UPDATE party SET intelligence = intelligence + ? WHERE main = 1", (modifiers[3],))
cursor.execute("UPDATE party SET wisdom = wisdom + ? WHERE main = 1", (modifiers[4],))
cursor.execute("UPDATE party SET charisma = charisma + ? WHERE main = 1", (modifiers[5],))
db.commit()
cursor.execute("SELECT strength, dexterity, constitution, intelligence, wisdom, charisma FROM party WHERE main = 1")
mainstats = cursor.fetchone()
print("Your stats: ")
print(f'Strength: {mainstats[0]}')
print(f'Dexterity: {mainstats[1]}')
print(f'Constitution: {mainstats[2]}')
print(f'Intelligence: {mainstats[3]}')
print(f'Wisdom: {mainstats[4]}')
print(f'Charisma: {mainstats[5]}')