From c9744caa15350f07626676d0dc48e38be317494a Mon Sep 17 00:00:00 2001 From: troido Date: Fri, 18 Jan 2019 18:11:04 +0100 Subject: changed filenames for resource configs --- asciifarm/charmaps/default.json | 53 ---------------------------------- asciifarm/charmaps/halfwidth.json | 53 ++++++++++++++++++++++++++++++++++ asciifarm/client/display/health.py | 6 ++-- asciifarm/client/loaders.py | 8 +++-- asciifarm/client/paths.py | 2 +- asciifarm/keybindings/default.json | 42 +++++++++++++++++++++++++++ asciifarm/keybindings/keybindings.json | 42 --------------------------- 7 files changed, 104 insertions(+), 102 deletions(-) delete mode 100644 asciifarm/charmaps/default.json create mode 100644 asciifarm/charmaps/halfwidth.json create mode 100644 asciifarm/keybindings/default.json delete mode 100644 asciifarm/keybindings/keybindings.json diff --git a/asciifarm/charmaps/default.json b/asciifarm/charmaps/default.json deleted file mode 100644 index 2952ab0..0000000 --- a/asciifarm/charmaps/default.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "mapping":{ - "tree": ["T", 0, 2], - "wall": ["#", 7, 8], - "rock": ["X", 7, 8], - "stone": ["o", 7], - "pebble": ["*", 7], - "player": ["@", 15], - "ground": [".", 3], - "grass1": [",", 2], - "grass2": ["'", 2], - "grass3": ["`", 10], - "water": ["~", 4, 4], - "rabbit": ["b", 15], - "floor": [".", 8], - "portal": ["$", 5], - "stairdown": [">",7], - "stairup": ["<",7], - "dummy": ["d", 3], - "spikes": ["^",7], - "goblin": ["g",2], - "seed": [":",10], - "plantedseed": [".",10], - "seedling": [",", 10], - "youngplant": ["v", 10], - "smallplant": ["v", 2], - "plant": ["Y",2], - "food": ["8",13], - "troll": ["T",1], - "sword": ["/",7], - "club": ["!", 3], - "house": ["^", 3, 1], - "bridge": ["=", 9,3], - "smallbridge": ["=", 3,4], - "entry": ["%", 7], - "fence": ["#", 3], - "armour": ["[", 7], - "wound": [" ", 7, 1], - "rat": ["r", 7], - "closeddoor": ["+",1 ,3], - "opendoor": ["\"",3 ], - " ": [" ", 7] - }, - "writable": { - "engravedwall": [15, 8], - "emptyletter": [7, 0] - }, - "default": ["?", 7], - "charwidth": 1, - "healthfull": ["#", 7, 2], - "healthempty": ["_", 7, 1], - "alphabet": "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" -} diff --git a/asciifarm/charmaps/halfwidth.json b/asciifarm/charmaps/halfwidth.json new file mode 100644 index 0000000..2952ab0 --- /dev/null +++ b/asciifarm/charmaps/halfwidth.json @@ -0,0 +1,53 @@ +{ + "mapping":{ + "tree": ["T", 0, 2], + "wall": ["#", 7, 8], + "rock": ["X", 7, 8], + "stone": ["o", 7], + "pebble": ["*", 7], + "player": ["@", 15], + "ground": [".", 3], + "grass1": [",", 2], + "grass2": ["'", 2], + "grass3": ["`", 10], + "water": ["~", 4, 4], + "rabbit": ["b", 15], + "floor": [".", 8], + "portal": ["$", 5], + "stairdown": [">",7], + "stairup": ["<",7], + "dummy": ["d", 3], + "spikes": ["^",7], + "goblin": ["g",2], + "seed": [":",10], + "plantedseed": [".",10], + "seedling": [",", 10], + "youngplant": ["v", 10], + "smallplant": ["v", 2], + "plant": ["Y",2], + "food": ["8",13], + "troll": ["T",1], + "sword": ["/",7], + "club": ["!", 3], + "house": ["^", 3, 1], + "bridge": ["=", 9,3], + "smallbridge": ["=", 3,4], + "entry": ["%", 7], + "fence": ["#", 3], + "armour": ["[", 7], + "wound": [" ", 7, 1], + "rat": ["r", 7], + "closeddoor": ["+",1 ,3], + "opendoor": ["\"",3 ], + " ": [" ", 7] + }, + "writable": { + "engravedwall": [15, 8], + "emptyletter": [7, 0] + }, + "default": ["?", 7], + "charwidth": 1, + "healthfull": ["#", 7, 2], + "healthempty": ["_", 7, 1], + "alphabet": "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" +} diff --git a/asciifarm/client/display/health.py b/asciifarm/client/display/health.py index 3f149ea..a8d0823 100644 --- a/asciifarm/client/display/health.py +++ b/asciifarm/client/display/health.py @@ -4,9 +4,9 @@ from .widimp import WidImp class Health(WidImp): - def __init__(self, char=('@',7,0), emptyChar=('-',7,0), colours=False): - self.char = char - self.emptyChar = emptyChar + def __init__(self, char=None, emptyChar=None, colours=False): + self.char = char or ('@',7,0) + self.emptyChar = emptyChar or ('-',7,0) self.changed = False self.colours = colours self.health = 0 diff --git a/asciifarm/client/loaders.py b/asciifarm/client/loaders.py index 8330e0e..fef4769 100644 --- a/asciifarm/client/loaders.py +++ b/asciifarm/client/loaders.py @@ -6,7 +6,7 @@ import json standardKeyFiles = { - "default": os.path.join(keybindingsPath, "keybindings.json"), + "default": os.path.join(keybindingsPath, "default.json"), "azerty": os.path.join(keybindingsPath, "azerty.json") } @@ -32,8 +32,10 @@ def loadKeybindings(name): standardCharFiles = {name: os.path.join(charmapPath, file) for name, file in { - "default": "default.json", - "fullwith": "fullwidth.json", + "default": "halfwidth.json", + "halfwidth": "halfwidth.json", + "hw": "halfwidth.json", + "fullwidth": "fullwidth.json", "fw": "fullwidth.json", "emoji": "emoji.json" }.items()} diff --git a/asciifarm/client/paths.py b/asciifarm/client/paths.py index 3042f92..407d54c 100644 --- a/asciifarm/client/paths.py +++ b/asciifarm/client/paths.py @@ -2,6 +2,6 @@ import os.path clientPath = os.path.dirname(__file__) -farmsPath = os.path.join(clientPath, "..") +farmsPath = os.path.normpath(os.path.join(clientPath, "..")) charmapPath = os.path.join(farmsPath, "charmaps") keybindingsPath = os.path.join(farmsPath, "keybindings") diff --git a/asciifarm/keybindings/default.json b/asciifarm/keybindings/default.json new file mode 100644 index 0000000..a816527 --- /dev/null +++ b/asciifarm/keybindings/default.json @@ -0,0 +1,42 @@ +{ +"actions": { +"w": ["move", "north"], +"s": ["move", "south"], +"d": ["move", "east"], +"a": ["move", "west"], +"KEY_UP": ["move", "north"], +"KEY_DOWN": ["move", "south"], +"KEY_RIGHT": ["move", "east"], +"KEY_LEFT": ["move", "west"], +"k": ["move", "north"], +"j": ["move", "south"], +"l": ["move", "east"], +"h": ["move", "west"], +"e": ["input", ["take"]], +"q": ["unuse"], +"Q": ["take"], +"E": ["use"], +"R": ["input", ["interact"]], +"r": ["input", ["interact", [null, "north", "south", "east", "west"]]], +"x": ["selectitem", -1, true, true], +"c": ["selectitem", 1, true, true], +"v": ["selectwidget", -1, true, true], +"b": ["selectwidget", 1, true, true], +"-": ["selectitem", -1, true, true], +"+": ["selectitem", 1, true, true], +"/": ["selectwidget", -1, true, true], +"*": ["selectwidget", 1, true, true], +"f": ["input", ["attack", [null, "north", "south", "east", "west"]]], +"F": ["input", ["attack"]], +"W": ["input", ["attack", "north"]], +"S": ["input", ["attack", "south"]], +"D": ["input", ["attack", "east"]], +"A": ["input", ["attack", "west"]], +"t": ["runinput"], +"NEWLINE": ["runinput"], +"KEY_PPAGE": ["scrollchat", 1], +"KEY_NPAGE": ["scrollchat", -1], +"/": ["runinput", "/"] +}, +"help": "Controls:\n wasd or arrows:\n Move around\n e: Grab\n q: Drop/unequip\n selected\n r: Interact\n f: Attack\n t: Chat\n E: Use selected\n Q: Take selected\n xc: select item\n vb: select menu\n ctrl-c: close client" +} diff --git a/asciifarm/keybindings/keybindings.json b/asciifarm/keybindings/keybindings.json deleted file mode 100644 index a816527..0000000 --- a/asciifarm/keybindings/keybindings.json +++ /dev/null @@ -1,42 +0,0 @@ -{ -"actions": { -"w": ["move", "north"], -"s": ["move", "south"], -"d": ["move", "east"], -"a": ["move", "west"], -"KEY_UP": ["move", "north"], -"KEY_DOWN": ["move", "south"], -"KEY_RIGHT": ["move", "east"], -"KEY_LEFT": ["move", "west"], -"k": ["move", "north"], -"j": ["move", "south"], -"l": ["move", "east"], -"h": ["move", "west"], -"e": ["input", ["take"]], -"q": ["unuse"], -"Q": ["take"], -"E": ["use"], -"R": ["input", ["interact"]], -"r": ["input", ["interact", [null, "north", "south", "east", "west"]]], -"x": ["selectitem", -1, true, true], -"c": ["selectitem", 1, true, true], -"v": ["selectwidget", -1, true, true], -"b": ["selectwidget", 1, true, true], -"-": ["selectitem", -1, true, true], -"+": ["selectitem", 1, true, true], -"/": ["selectwidget", -1, true, true], -"*": ["selectwidget", 1, true, true], -"f": ["input", ["attack", [null, "north", "south", "east", "west"]]], -"F": ["input", ["attack"]], -"W": ["input", ["attack", "north"]], -"S": ["input", ["attack", "south"]], -"D": ["input", ["attack", "east"]], -"A": ["input", ["attack", "west"]], -"t": ["runinput"], -"NEWLINE": ["runinput"], -"KEY_PPAGE": ["scrollchat", 1], -"KEY_NPAGE": ["scrollchat", -1], -"/": ["runinput", "/"] -}, -"help": "Controls:\n wasd or arrows:\n Move around\n e: Grab\n q: Drop/unequip\n selected\n r: Interact\n f: Attack\n t: Chat\n E: Use selected\n Q: Take selected\n xc: select item\n vb: select menu\n ctrl-c: close client" -} -- cgit