acd3caa9 by Barry

Added default player json rather than having it in the main file.

1 parent 7f12eb43
1 {
2 "name": null,
3 "room": null,
4 "inventory": {},
5 "prompt": "hp %hp mp %mp> ",
6 "aliases": {},
7 "hp": 100,
8 "mp": 100,
9 "maxhp": 100,
10 "maxmp": 100,
11 "maxsta": 10,
12 "sta": 10,
13 "aa": "1d2",
14 "mpr": 0.25,
15 "star": 0.4
16 }
...\ No newline at end of file ...\ No newline at end of file
...@@ -98,16 +98,7 @@ while True: ...@@ -98,16 +98,7 @@ while True:
98 # The dictionary key is the player's id number. We set their room to 98 # The dictionary key is the player's id number. We set their room to
99 # None initially until they have entered a name 99 # None initially until they have entered a name
100 # Try adding more player stats - level, gold, inventory, etc 100 # Try adding more player stats - level, gold, inventory, etc
101 players[id] = { 101 players[id] = utils.load_object_from_file("defaultplayer.json")
102 "name": None,
103 "room": None,
104 "inventory": {},
105 "prompt": "hp %hp mp %mp> ",
106 "aliases": {},
107 "hp": 100,
108 "mp": 100,
109 "sta": 10,
110 }
111 with open('welcome.txt', 'r', encoding='utf-8') as f: 102 with open('welcome.txt', 'r', encoding='utf-8') as f:
112 for line in f: 103 for line in f:
113 mud.send_message(id, line, "\r") 104 mud.send_message(id, line, "\r")
......
1 {"name": "test", "room": "Tavern", "inventory": {"candle": 1}, "prompt": "%hp> ", "aliases": {}, "hp": 953, "mp": 100, "sta": 10}
...\ No newline at end of file ...\ No newline at end of file
1 {"name": "test", "room": "Tavern", "inventory": {"candle": 1}, "prompt": "%hp> ", "aliases": {}, "hp": 953, "mp": 100, "sta": 10, "aa": "1d2", "mpr": 0.25, "star": 0.4, "maxhp": 953, "maxmp": 100, "maxsta": 10}
...\ No newline at end of file ...\ No newline at end of file
......
1 {"cricket": {"max": 1, "active": [{"hp": 100, "mp": 1.0, "sta": 3.950000000000027, "maxhp": 100, "maxmp": 10, "maxsta": 10, "action": "attack", "target": "test"}]}}
...\ No newline at end of file ...\ No newline at end of file
1 {"cricket": {"max": 1, "active": [{"hp": 100, "mp": 2.0, "sta": 5.550000000000028, "maxhp": 100, "maxmp": 10, "maxsta": 10, "action": "attack", "target": "test"}]}}
...\ No newline at end of file ...\ No newline at end of file
......