Characters implemented sorta

This commit is contained in:
NikolajDanger
2020-03-22 17:26:57 +01:00
parent 5e362001b9
commit a3dd2255b6
5 changed files with 102 additions and 73 deletions

Binary file not shown.

View File

@ -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": {}
}
}

View File

@ -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)

73
templates.json Normal file
View File

@ -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": {}
}
}

View File

@ -1,4 +1,4 @@
from swchar import charData
from swchar import charData, parseChar
from swroll import parseRoll
print(charData("Template","characteristics "))
print(parseChar("Yeet",""))