diff --git a/__pycache__/swchar.cpython-36.pyc b/__pycache__/swchar.cpython-36.pyc index ac9b0c1..20e451b 100644 Binary files a/__pycache__/swchar.cpython-36.pyc and b/__pycache__/swchar.cpython-36.pyc differ diff --git a/characters.json b/characters.json index 060ddd1..7a73a41 100644 --- a/characters.json +++ b/characters.json @@ -1,73 +1,2 @@ { - "Template": { - "Name": "", - "Species": "", - "Career": "", - "Specialization Trees": [], - "Soak": 0, - "Wound Threshold": 0, - "Wounds": 0, - "Strain Threshold": 0, - "Strain": 0, - "Defense, Ranged": 0, - "Defense, Melee": 0, - "Force Rating": 0, - "Characteristics": { - "Brawn": 0, - "Agility": 0, - "Intellect": 0, - "Cunning": 0, - "Willpower": 0, - "Presence": 0 - }, - "Skills": { - "Astrogation": 0, - "Computers": 0, - "Cool": 0, - "Vigilance": 0, - "Mechanics": 0, - "Melee": 0, - "Perception": 0, - "Piloting - Space": 0, - "Ranged - Heavy": 0, - "Ranged - Light": 0, - "Athletics": 0, - "Coercion": 0, - "Coordination": 0, - "Charm": 0, - "Medicine": 0, - "Negotiation": 0, - "Piloting - Planetary": 0, - "Stealth": 0, - "Skullduggery": 0, - "Brawl": 0, - "Discipline": 0, - "Gunnery": 0, - "Core Worlds": 0, - "Outer Rim": 0, - "Underworld": 0, - "Leadership": 0, - "Lore": 0, - "Resilience": 0, - "Streetwise": 0, - "Survival": 0, - "Xenology": 0, - "Lightsaber": 0 - }, - "Lightsaber Characteristic": "Brawn", - "Obligations": {}, - "Morality": { - "Emotional Weakness": "", - "Emotional Strength": "", - "Conflict": "", - "Morality": "" - }, - "Credits": 0, - "Equipment": [], - "Armor": "", - "Critical Injuries": {}, - "Weapons": {}, - "Talents": {}, - "Force Powers": {} - } } \ No newline at end of file diff --git a/swchar.py b/swchar.py index 37b1928..1140288 100644 --- a/swchar.py +++ b/swchar.py @@ -71,6 +71,9 @@ def lookUp(data : dict, key : str, cmd : str = ""): else: return key + " doesn't exist" +def characterSheet(character : dict): + return "```**"+character["Name"]+"**\nSpecies: "+character["Species"]+"\nCareer: "+character["Career"]+"```" + def charData(user : str,cmd : str): with open("characters.json", "r") as f: data = json.load(f) @@ -132,6 +135,30 @@ def charData(user : str,cmd : str): else: return "You don't have a character. You can make one with !swchar" +def parseChar(user : str, cmd : str): + with open("characters.json", "r") as f: + data = json.load(f) + + if cmd == " ": + cmd = "" + elif cmd != "": + while cmd[0] == " ": + cmd = cmd[1:] + if cmd == "": + break + + if cmd == "": + if user in data: + return characterSheet(data[user]) + else: + with open("templates.json", "r") as f: + templates = json.load(f) + newChar = templates["Character"] + data[user] = newChar + with open("characters.json", "w") as f: + json.dump(data,f,indent = 4) + return "Character for " + user + " created" + def lightsaberChar(user : str): with open("characters.json", "r") as f: data = json.load(f) diff --git a/templates.json b/templates.json new file mode 100644 index 0000000..efde848 --- /dev/null +++ b/templates.json @@ -0,0 +1,73 @@ +{ + "Character": { + "Name": "New Character", + "Species": "", + "Career": "", + "Specialization Trees": [], + "Soak": 0, + "Wound Threshold": 0, + "Wounds": 0, + "Strain Threshold": 0, + "Strain": 0, + "Defense, Ranged": 0, + "Defense, Melee": 0, + "Force Rating": 0, + "Characteristics": { + "Brawn": 0, + "Agility": 0, + "Intellect": 0, + "Cunning": 0, + "Willpower": 0, + "Presence": 0 + }, + "Skills": { + "Astrogation": 0, + "Computers": 0, + "Cool": 0, + "Vigilance": 0, + "Mechanics": 0, + "Melee": 0, + "Perception": 0, + "Piloting - Space": 0, + "Ranged - Heavy": 0, + "Ranged - Light": 0, + "Athletics": 0, + "Coercion": 0, + "Coordination": 0, + "Charm": 0, + "Medicine": 0, + "Negotiation": 0, + "Piloting - Planetary": 0, + "Stealth": 0, + "Skullduggery": 0, + "Brawl": 0, + "Discipline": 0, + "Gunnery": 0, + "Core Worlds": 0, + "Outer Rim": 0, + "Underworld": 0, + "Leadership": 0, + "Lore": 0, + "Resilience": 0, + "Streetwise": 0, + "Survival": 0, + "Xenology": 0, + "Lightsaber": 0 + }, + "Lightsaber Characteristic": "Brawn", + "Obligations": {}, + "Morality": { + "Emotional Weakness": "", + "Emotional Strength": "", + "Conflict": "", + "Morality": "" + }, + "Credits": 0, + "Equipment": [], + "Armor": "", + "Critical Injuries": {}, + "Weapons": {}, + "Talents": {}, + "Force Powers": {} + } +} \ No newline at end of file diff --git a/testing.py b/testing.py index fc1c33c..2673e33 100644 --- a/testing.py +++ b/testing.py @@ -1,4 +1,4 @@ -from swchar import charData +from swchar import charData, parseChar from swroll import parseRoll -print(charData("Template","characteristics ")) \ No newline at end of file +print(parseChar("Yeet","")) \ No newline at end of file