DS Source Code
#Import section
import time
import csv
#Code Section
#Introduction to the area. Includes background worldbuilding information
about the setting, as well as time sections to allow users to read
print("You arrive at Reiksport, the deep-water port off the coast of Altdorf, capital
of the Empire.")
print("The journey from your old home was long and arduous, but after much
time, you've made it to port.")
print("For whatever reason, you've decided to come to the capital of the Empire,
the largest of the Order-aligned factions in the land.")
time.sleep(5)
print("Staunch opponents of the ruinous forces of Chaos, the Empire is primarily
a human faction, although it does see lucrative business with Elves, Dwarves and
Halflings.")
print("Departing from the boat onto the dock, you follow the throngs of other
travellers to the large building for arrivals.")
print("Inside, a wisened old man, looming over an equally wisened old book
behind a tall desk peers down the bridge of his nose at you.")
time.sleep(5)
# Character Building. Includes relevant information to make characters, including
out-of-game comments to explain mechanics.
print("'Who are you?' He says, his voice like a creaking old building")
NameSet = "Y"
while NameSet == "Y":
CharName = input("Input the name for your Character :> ")
NameSet = "N"
print("'Welcome to the Empire, " + CharName + ". Be so kind as to answer a few
questions so we know what to do with you.'")
print("Despite his asking, something tells you that it wasn't really up for
debate.")
print("'What people do you hail from, " + CharName +"?'")
RacSet = "Y"
RacLis = ["Elf", "Dwarf", "Human", "Halfling"]
while RacSet == "Y":
RacInp = input("Choose Elf, Dwarf, Human or Halfling. Remember to
capitalise :> ")
if RacInp in RacLis:
RacSet = "Check"
print("You have chosen" + RacInp)
else:
print("Bad Answer. Try again.")
print("'So you're a " + RacInp +", then.'")
print("'And your previous occupation?'")
print("Your choice for career in the full game is greatly expanded, but for this,
your options are as follows: ")
with open('SingleCareers.csv') as csv_file:
csv_reader = csv.reader(csv_file)
rows = list(csv_reader)
print(rows[0])
print(rows[1])
print(rows[2])
print(rows[3])
print(rows[4])
JobSet = "Y"
JobList = ['Entertainer', 'Watchman', 'Noble', 'Vagabond', 'Mercenary']
while JobSet == "Y":
JobInp = input("Choose one of the above Jobs. Remember to capitalize :> ")
if JobInp in JobList:
JobSet = "N"
print("You have chosen " + JobInp)
else:
print("That's not a job you can choose. Check spelling and capitalization and
try again.")
print("The man notes down your answer in the book, pushing his glasses back up
his nose as he continues.")
print("'A " + JobInp + "? Well, we always need another of those...'")
print("You have a hard time telling if he's being genuine, but something tells you
you shouldn't hold your breath on that.")
print("He sniffs a little before continuing. 'Reason for travel?'")
print("This chooses your characters motivation. This dictates what quest you will
be given.")
with open('SingleCareers.csv') as csv_file:
csv_reader = csv.reader(csv_file)
rows = list(csv_reader)
print(rows[6])
print(rows[7])
print(rows[8])
print(rows[9])
print(rows[10])
GoalSet = "Y"
GoalList = ['Money', 'Fame', 'Work', 'Leisure', 'Vengeance']
while GoalSet == "Y":
GoalInp = input("Pick one of the above goals. Remember to Capitalize :> ")
if GoalInp in GoalList:
GoalSet = "N"
print("You have chosen the path of " + GoalInp)
else:
print("That's not a goal you can choose in this game. Check capitalization
and try again.")
GoodGoalList = ['Money', 'Fame', 'Work']
BadGoalList = ['Leisure', 'Vengeance']
# Small bit of flavour code to determine the NPC’s reaction to the players goal.
“Good” and “Bad” is just a subjective term to differentiate them.
if GoalInp in GoodGoalList:
print("'" + GoalInp + ", is it? Well, aren't we all.'")
elif GoalInp in BadGoalList:
print("The man gives you a strange look. 'Better watch yourself with a goal like
that.'")
else:
print("Unexpected Goal Error.")
exit
print("'Right, let's see here...' The man regards you briefly before handing over a
sheet of paper. 'Here. Cause no trouble.'")
print("Your name is " + CharName)
print("You are a " + RacInp)
print("Previous to coming here, your job was " + JobInp)
print("Most importantly, you come seeking " + GoalInp)
#Section for writing the player-input variables such as name, race, job or goal
input.
with open('profiles1.csv', 'w', newline='') as file:
writer = csv.writer(file)
writer.writerow(CharName + RacInp + JobInp + GoalInp)
#Login page. Includes important login information. Password is just set as
‘Admin’ and ‘Password’, but the full code would include access to a full database
from the school.
#Import Section
import time
import random
import os
import tkinter as tk
from tkinter import messagebox
from tkinter import PhotoImage
# main window
window = tk.Tk()
window.title ("Login Page")
window.geometry ('750x400')
window.configure (bg='#8F00FF')
# login def
def login():
username = "Admin"
password = "password"
if username_entry.get()==username and password_entry.get() ==password:
messagebox.showinfo(title="Login Successful", message="Login
Successful, Welcome User")
else:
messagebox.showerror(title="Invalid Login", message="Invalid Login.
Check Spelling and Punctuation.")
frame = tk.Frame(bg='#FFFFFF')
login_label = tk.Label(frame, text="WFRP Login", bg='#000000', fg="#DC143C",
font=("Arial", 30))
username_label = tk.Label(frame, text="Username", bg='#000000',
fg="#FFFFFF", font=("Arial", 16, 'bold'))
password_label = tk.Label(frame, text="Password", bg='#000000',
fg="#FFFFFF", font=("Arial", 16, 'bold'))
username_entry = tk.Entry(frame, font=("Arial", 16))
password_entry = tk.Entry(frame, show="*", font=("Arial", 16))
login_button = tk.Button(frame, text="Login", bg="#DC143C", fg="#FFFFFF",
font=("Arial, 16"), command=login)
# Item placement in frame.
login_label.grid(row=0, column=0, columnspan=2, sticky="news", pady=40)
username_label.grid(row=1, column=0)
username_entry.grid(row=1, column=1, pady=20)
password_label.grid(row=2, column=0)
password_entry.grid(row=2, column=1, pady=20)
login_button.grid(row=3, column=0, columnspan=2, pady=30)
frame.pack()
window.mainloop()