Merge branch 'master' of github.com:NikolajDanger/Gwendolyn

This commit is contained in:
NikolajDanger
2020-03-29 15:45:34 +02:00
25 changed files with 309 additions and 187 deletions

View File

@ -0,0 +1,2 @@
from .swchar import parseChar
from .swroll import parseRoll

View File

@ -1,73 +0,0 @@
{
"Nikolaj": {
"Name": "Jared",
"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": 5,
"Agility": 0,
"Intellect": 0,
"Cunning": 0,
"Willpower": 0,
"Presence": 0
},
"Skills": {
"Astrogation": 0,
"Athletics": 0,
"Brawl": 1,
"Charm": 0,
"Coercion": 0,
"Computers": 0,
"Cool": 0,
"Coordination": 0,
"Core Worlds": 0,
"Discipline": 0,
"Gunnery": 0,
"Leadership": 0,
"Lightsaber": 0,
"Lore": 0,
"Mechanics": 0,
"Medicine": 0,
"Melee": 0,
"Negotiation": 0,
"Outer Rim": 0,
"Perception": 0,
"Piloting - Planetary": 0,
"Piloting - Space": 0,
"Ranged - Heavy": 0,
"Ranged - Light": 0,
"Resilience": 0,
"Skullduggery": 0,
"Stealth": 0,
"Streetwise": 0,
"Survival": 0,
"Underworld": 0,
"Vigilance": 0,
"Xenology": 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,34 +0,0 @@
{
"Astrogation" : "Intellect",
"Computers" : "Intellect",
"Cool" : "Presence",
"Vigilance" : "Willpower",
"Mechanics" : "Intellect",
"Melee" : "Brawn",
"Perception" : "Cunning",
"Piloting - Space" : "Agility",
"Ranged - Heavy" : "Agility",
"Ranged - Light" : "Agility",
"Athletics" : "Brawn",
"Coercion" : "Willpower",
"Coordination" : "Agility",
"Charm" : "Presence",
"Medicine" : "Intellect",
"Negotiation" : "Presence",
"Piloting - Planetary" : "Agility",
"Stealth" : "Agility",
"Skullduggery" : "Cunning",
"Brawl" : "Brawn",
"Discipline" : "Willpower",
"Gunnery" : "Agility",
"Core Worlds" : "Intellect",
"Outer Rim" : "Intellect",
"Underworld" : "Intellect",
"Leadership" : "Presence",
"Lore" : "Intellect",
"Resilience" : "Brawn",
"Streetwise" : "Cunning",
"Survival" : "Cunning",
"Xenology" : "Intellect",
"Lightsaber" : "Brawn"
}

View File

@ -1,31 +0,0 @@
Astrogation
Computers
Cool
Vigilance
Mechanics
Melee
Perception
Piloting - Space
Ranged - Heavy
Ranged - Light
Athletics
Coercion
Coordination
Charm
Medicine
Negotiation
Piloting - Planetary
Stealth
Skullduggery
Brawl
Discipline
Gunnery
Core Worlds
Outer Rim
Underworld
Leadership
Lore
Resilience
Streetwise
Survival
Xenology

View File

@ -1,8 +1,11 @@
import json
import string
import logging
logging.basicConfig(filename="gwendolyn.log", level=logging.INFO)
def getName(user : str):
with open("funcs/swfuncs/characters.json", "r") as f:
with open("resources/swcharacters.json", "r") as f:
data = json.load(f)
if user in data:
@ -81,7 +84,7 @@ def characterSheet(character : dict):
return name, text1+"\n\n"+text2+divider+text3
def charData(user : str,cmd : str):
with open("funcs/swfuncs/characters.json", "r") as f:
with open("resources/swcharacters.json", "r") as f:
data = json.load(f)
key = string.capwords(cmd.split(" ")[0])
@ -107,7 +110,7 @@ def charData(user : str,cmd : str):
if type(lookUpResult) is dict:
data[user][key] = lookUpResult
with open("funcs/swfuncs/characters.json", "w") as f:
with open("resources/swcharacters.json", "w") as f:
json.dump(data,f,indent = 4)
return "Changed " + data[user]["Name"] + "'s " + key
else:
@ -133,7 +136,7 @@ def charData(user : str,cmd : str):
return "Can't add that"
else:
data[user][key] = cmd
with open("funcs/swfuncs/characters.json", "w") as f:
with open("resources/swcharacters.json", "w") as f:
json.dump(data,f,indent = 4)
return "Changed " + data[user]["Name"] + "'s " + key +" to " + cmd
else:
@ -142,7 +145,7 @@ def charData(user : str,cmd : str):
return "You don't have a character. You can make one with !swchar"
def parseChar(user : str, cmd : str):
with open("funcs/swfuncs/characters.json", "r") as f:
with open("resources/swcharacters.json", "r") as f:
data = json.load(f)
if cmd == " ":
@ -157,25 +160,30 @@ def parseChar(user : str, cmd : str):
if user in data:
return characterSheet(data[user])
else:
with open("funcs/swfuncs/templates.json", "r") as f:
with open("resources/swtemplates.json", "r") as f:
templates = json.load(f)
newChar = templates["Character"]
data[user] = newChar
with open("funcs/swfuncs/characters.json", "w") as f:
with open("resources/swcharacters.json", "w") as f:
json.dump(data,f,indent = 4)
return "", "Character for " + user + " created"
else:
if cmd == "purge":
del data[user]
with open("resources/swcharacters.json", "w") as f:
json.dump(data,f,indent = 4)
return "", "Character for " + user + " deleted"
return "", charData(user,cmd)
def lightsaberChar(user : str):
with open("funcs/swfuncs/characters.json", "r") as f:
with open("resources/swcharacters.json", "r") as f:
data = json.load(f)
if user in data:
return data[user]["Lightsaber Characteristic"]
def userHasChar(user : str):
with open("funcs/swfuncs/characters.json", "r") as f:
with open("resources/swcharacters.json", "r") as f:
data = json.load(f)
return user in data

View File

@ -2,10 +2,11 @@ import random
import re
import string
import json
import os
from . import swchar
with open("funcs/swfuncs/skills.json", "r") as f:
with open("resources/swskills.json", "r") as f:
skillData = json.load(f)
def roll(abi : int = 1, prof : int = 0, dif : int = 3, cha : int = 0, boo : int = 0, setb : int = 0, force : int = 0):

View File

@ -1,73 +0,0 @@
{
"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,
"Athletics": 0,
"Brawl": 0,
"Charm": 0,
"Coercion": 0,
"Computers": 0,
"Cool": 0,
"Coordination": 0,
"Core Worlds": 0,
"Discipline": 0,
"Gunnery": 0,
"Leadership": 0,
"Lightsaber": 0,
"Lore": 0,
"Mechanics": 0,
"Medicine": 0,
"Melee": 0,
"Negotiation": 0,
"Outer Rim": 0,
"Perception": 0,
"Piloting - Planetary": 0,
"Piloting - Space": 0,
"Ranged - Heavy": 0,
"Ranged - Light": 0,
"Resilience": 0,
"Skullduggery": 0,
"Stealth": 0,
"Streetwise": 0,
"Survival": 0,
"Underworld": 0,
"Vigilance": 0,
"Xenology": 0
},
"Lightsaber Characteristic": "Brawn",
"Obligations": {},
"Morality": {
"Emotional Weakness": "",
"Emotional Strength": "",
"Conflict": "",
"Morality": ""
},
"Credits": 0,
"Equipment": [],
"Armor": "",
"Critical Injuries": {},
"Weapons": {},
"Talents": {},
"Force Powers": {}
}
}