Skip to content

Commit

Permalink
Merge pull request #8 from JP-Carr/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
why-keith authored Dec 23, 2020
2 parents 61502dd + 88c9f7a commit fc06d2d
Show file tree
Hide file tree
Showing 7 changed files with 830 additions and 33 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,4 @@ dmypy.json
*.pkl
log.txt
error_log.txt
/campaigns
369 changes: 337 additions & 32 deletions DnD_Time_Manager.py

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ At present D&DTM is only available as a standalone .zip archive for Microsoft W

## Usage
To start the program, run "DnD_Time_Manager.exe". This will present you with the app's GUI:
![GUI_v0.3.0](https://github.com/JP-Carr/DnD_Time_Manager/blob/media/Images/GUI/GUI_0.3.0.JPG)
![GUI_v0.5.0](https://github.com/JP-Carr/DnD_Time_Manager/blob/media/Images/GUI/v0.5.0/GUI_0.5.0_Default.JPG)
#### Layout
* Row 1 - In-game time: Time(hh:mm), Day, Tenday, Month, Year
* Row 2 - Temperature and precipitation level
Expand All @@ -17,5 +17,18 @@ To start the program, run "DnD_Time_Manager.exe". This will present you with the
Entering values in the time input boxes and clicking "Submit" will update the in-game time. Weather conditions are automatically rolled on a day change.
The "Log" function allows for notes to be recorded from the GUI, the log is stored alongside the in-game time and date for easy reference.

### Campaigns
Each campaign is handled separately and can be edited and switched between at will.

## Updating to v0.5.0
Due to the changes to campaigns, updating to v0.5.0 while keeping saved data requires further steps to work correctly.
1. Backup db.pkl and log.txt from your install directory to a separate location
2. Replace the old install with the new release version
3. Run "DnD_Time_Manager.exe" and name your campaign
4. Click "Open Log" to ensure a log file exists for this campaign
5. Access the campaign directory through: File → Open save directory... → [campaign name]
6. Replace the pkl and txt files found in this directory with the ones backed up in Step 1. Ensure that the old files renamed to match the newly created ones.
7. Close and reopen "DnD_Time_Manager.exe"

## Disclaimer
This is an unofficial piece of software and is in no way endorsed or sponsored by [Wizards of the Coast](https://company.wizards.com/)
152 changes: 152 additions & 0 deletions custom_themes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import PySimpleGUI as sg

sg.LOOK_AND_FEEL_TABLE["Default"] = {"BACKGROUND": "#c73032",
"TEXT": "#ffffff",
"INPUT": "#ffffff",
"TEXT_INPUT": "#000000",
"SCROLL": "#c7e78b", #not edited yet
"BUTTON": ("black", "#ffffff"),
"PROGRESS": ("#01826B", "#D0D0D0"), #not edited yet
"BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, #not edited yet
}

sg.LOOK_AND_FEEL_TABLE["Artificer"] = {"BACKGROUND": "#a8a0a0",
"TEXT": "#000000",
"INPUT": "#ffffff",
"TEXT_INPUT": "#000000",
"SCROLL": "#c7e78b", #not edited yet
"BUTTON": ("white", "#a16d37"),
"PROGRESS": ("#01826B", "#d59139"), #not edited yet
"BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, #not edited yet
}

sg.LOOK_AND_FEEL_TABLE["Barbarian"] = {"BACKGROUND": "#3b3638",
"TEXT": "#ffffff",
"INPUT": "#ffffff",
"TEXT_INPUT": "#000000",
"SCROLL": "#c7e78b", #not edited yet
"BUTTON": ("white", "#e7623e"),
"PROGRESS": ("#01826B", "#D0D0D0"), #not edited yet
"BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, #not edited yet
}

sg.LOOK_AND_FEEL_TABLE["Bard"] = {"BACKGROUND": "#ab6dac",
"TEXT": "#000000",
"INPUT": "#ffffff",
"TEXT_INPUT": "#000000",
"SCROLL": "#c7e78b", #not edited yet
"BUTTON": ("white", "#113685"),
"PROGRESS": ("#01826B", "#D0D0D0"), #not edited yet
"BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, #not edited yet
}

sg.LOOK_AND_FEEL_TABLE["Cleric"] = {"BACKGROUND": "#91a1b2",
"TEXT": "#000000",
"INPUT": "#ffffff",
"TEXT_INPUT": "#000000",
"SCROLL": "#c7e78b", #not edited yet
"BUTTON": ("white", "#4e535e"),
"PROGRESS": ("#01826B", "#D0D0D0"), #not edited yet
"BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, #not edited yet
}

sg.LOOK_AND_FEEL_TABLE["Druid"] = {"BACKGROUND": "#4f4026",
"TEXT": "#ffffff",
"INPUT": "#ffffff",
"TEXT_INPUT": "#000000",
"SCROLL": "#c7e78b", #not edited yet
"BUTTON": ("white", "#7a853b"),
"PROGRESS": ("#01826B", "#D0D0D0"), #not edited yet
"BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, #not edited yet
}

sg.LOOK_AND_FEEL_TABLE["Fighter"] = {"BACKGROUND": "#9c0202",
"TEXT": "#ffffff",
"INPUT": "#ffffff",
"TEXT_INPUT": "#000000",
"SCROLL": "#c7e78b", #not edited yet
"BUTTON": ("white", "#7f513e"),
"PROGRESS": ("#01826B", "#D0D0D0"), #not edited yet
"BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, #not edited yet
}

sg.LOOK_AND_FEEL_TABLE["Monk"] = {"BACKGROUND": "#666666",
"TEXT": "#ffffff",
"INPUT": "#ffffff",
"TEXT_INPUT": "#000000",
"SCROLL": "#c7e78b", #not edited yet
"BUTTON": ("black", "#51a5c5"),
"PROGRESS": ("#01826B", "#D0D0D0"), #not edited yet
"BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, #not edited yet
}

sg.LOOK_AND_FEEL_TABLE["Paladin"] = {"BACKGROUND": "#40469c",
"TEXT": "#ffffff",
"INPUT": "#ffffff",
"TEXT_INPUT": "#000000",
"SCROLL": "#c7e78b", #not edited yet
"BUTTON": ("white", "#b59e54"),
"PROGRESS": ("#01826B", "#D0D0D0"), #not edited yet
"BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, #not edited yet
}

sg.LOOK_AND_FEEL_TABLE["Ranger"] = {"BACKGROUND": "#828282",
"TEXT": "#ffffff",
"INPUT": "#ffffff",
"TEXT_INPUT": "#000000",
"SCROLL": "#c7e78b", #not edited yet
"BUTTON": ("white", "#507f62"),
"PROGRESS": ("#01826B", "#D0D0D0"), #not edited yet
"BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, #not edited yet
}

sg.LOOK_AND_FEEL_TABLE["Rogue"] = {"BACKGROUND": "#171717",
"TEXT": "#ffffff",
"INPUT": "#ffffff",
"TEXT_INPUT": "#000000",
"SCROLL": "#c7e78b", #not edited yet
"BUTTON": ("white", "#555752"),
"PROGRESS": ("#01826B", "#D0D0D0"), #not edited yet
"BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, #not edited yet
}

sg.LOOK_AND_FEEL_TABLE["Sorcerer"] = {"BACKGROUND": "#991e2e",
"TEXT": "#ffffff",
"INPUT": "#ffffff",
"TEXT_INPUT": "#000000",
"SCROLL": "#c7e78b", #not edited yet
"BUTTON": ("white", "#828282"),
"PROGRESS": ("#01826B", "#D0D0D0"), #not edited yet
"BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, #not edited yet
}

sg.LOOK_AND_FEEL_TABLE["Warlock"] = {"BACKGROUND": "#292929",
"TEXT": "#ffffff",
"INPUT": "#ffffff",
"TEXT_INPUT": "#000000",
"SCROLL": "#c7e78b", #not edited yet
"BUTTON": ("white", "#7b469b"),
"PROGRESS": ("#01826B", "#D0D0D0"), #not edited yet
"BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, #not edited yet
}

sg.LOOK_AND_FEEL_TABLE["Wizard"] = {"BACKGROUND": "#2a50a1",
"TEXT": "#ffffff",
"INPUT": "#ffffff",
"TEXT_INPUT": "#000000",
"SCROLL": "#c7e78b", #not edited yet
"BUTTON": ("black", "#b2bcd6"),
"PROGRESS": ("#01826B", "#D0D0D0"), #not edited yet
"BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, #not edited yet
}

themes=["Default", "Artificer", "Barbarian", "Bard", "Cleric", "Druid", "Fighter", "Monk", "Paladin", "Ranger", "Rogue", "Sorcerer", "Warlock", "Wizard"]

if __name__=="__main__":

theme=themes[1]
print(theme)
# Switch to use your newly created theme
sg.theme(theme)
# Call a popup to show what the theme looks like
sg.popup_get_text("This how the \"{}\" custom theme looks".format(theme))
122 changes: 122 additions & 0 deletions database_class.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import pickle
from random import choice, randint
import condition_lists as conditions
########################################################

class db:

def __init__(self):
print("Initalising database...")
"""
self.day_data={"day_raw":0,
"day": 1,
"hour":0,
"tenday":1,
"month":[1,conditions.months[1]],
"year":1491,
"precipitation": choice(conditions.precipitation),
"wind_dir": choice(conditions.wind_dir),
"windspeed": choice(conditions.wind_speed),
"temperature": choice(conditions.temp)
}
"""
self.day_raw=0
self.day=1
self.hour=0
self.tenday=1
self.month=[1,conditions.months[1]]
self.year=1491
self.precipitation= choice(conditions.precipitation)
self.wind_dir=choice(conditions.wind_dir)
self.windspeed=choice(conditions.wind_speed)
self.temperature= choice(conditions.temp)
# pickle.dump( self.day_data, open("db.pkl", "wb"))
"""
def save():
try:
pickle.dump( db, open("db.pkl", "wb"))
except:
print("UNABLE TO SAVE DATABASE")
else:
print("Database saved")
"""

def show_all(self):
for i in db:
print("{}: {}".format(i,self.day_data[i]))

def next_day(self, days=1):
for i in range(abs(days)):
x=[randint(0,5) for i in range(4)]
if x[0]==0:
self.precipitation=choice(conditions.precipitation)
if x[1]==0:
self.wind_dir=choice(conditions.wind_dir)
if x[2]==0:
self.windspeed=choice(conditions.wind_speed)
if x[3]==0:
self.temperature=choice(conditions.temp)

self.day=self.day_raw%30+1
self.tenday=int((self.day_raw%30)/10)+1
m=int((self.day_raw%360)/30)+1
self.month=[m,conditions.months[m]]
self.year=int(self.day_raw/360)+1491


def change_day(self, x):
#x=input("Enter number of days to pass:\n>>")
try:
self.day_raw+=int(x)
if int(x)!=0:
self.next_day(int(x))

except TypeError as e:
print("INVALID TIME INCREMENT")

def change_hour(self, x):
# x=input("Enter number of hours to pass:\n>>")
try:
self.hour+=int(x)
while self.hour>=24:
self.hour-=24
self.day_raw+=1
self.next_day()
while self.hour<0:
self.hour+=24
self.day_raw-=1
self.next_day(-1)
print("Time: {}:00".format(self.hour))
except TypeError as e:
print("INVALID TIME INCREMENT")


def pickler(path,obj):
outfile = open(path,'wb')
pickle.dump(obj,outfile)
outfile.close()
print(path+" pickled")

def unpickle(path):
try:
infile = open(path,'rb')
obj = pickle.load(infile)
infile.close()
print(path+" unpickled")
return obj
except FileNotFoundError:
return None


###########################################################
"""
try:
db=pickle.load(open( "db.pkl", "rb" ) )
except:
init()
db=pickle.load(open( "db.pkl", "rb" ) )
#while 1:
# x=input("Enter command:\n>>")
# commands(x)
"""
4 changes: 4 additions & 0 deletions default_pref.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
new_pref={"last campaign": [],
"theme": "Default",
"new_theme": "Default"
}
Loading

0 comments on commit fc06d2d

Please sign in to comment.