home
·
contact
·
privacy
projects
/
plomrogue
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7cb786b
)
Server/py: Proper inventory handling in worldstate file.
author
Christian Heller
<c.heller@plomlompom.de>
Tue, 3 Mar 2015 00:22:24 +0000
(
01:22
+0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Tue, 3 Mar 2015 00:22:24 +0000
(
01:22
+0100)
plomrogue-server.py
patch
|
blob
|
history
diff --git
a/plomrogue-server.py
b/plomrogue-server.py
index f5c3c102a16c7182ce510c15414e9f33964802f0..6562e9f94ab48e8c437325ff934d7ab150268428 100755
(executable)
--- a/
plomrogue-server.py
+++ b/
plomrogue-server.py
@@
-249,14
+249,21
@@
def read_command():
def try_worldstate_update():
"""Write worldstate file if io_db["worldstate_updateable"] is set."""
if io_db["worldstate_updateable"]:
def try_worldstate_update():
"""Write worldstate file if io_db["worldstate_updateable"] is set."""
if io_db["worldstate_updateable"]:
+ inventory = ""
+ if [] == world_db["Things"][0]["T_CARRIES"]:
+ inventory = "(none)\n"
+ else:
+ for id in world_db["Things"][0]["T_CARRIES"]:
+ type_id = world_db["Things"][id]["T_TYPE"]
+ name = world_db["ThingTypes"][type_id]["TT_NAME"]
+ inventory = inventory + name + "\n"
string = str(world_db["TURN"]) + "\n" + \
str(world_db["Things"][0]["T_LIFEPOINTS"]) + "\n" + \
str(world_db["Things"][0]["T_SATIATION"]) + "\n" + \
string = str(world_db["TURN"]) + "\n" + \
str(world_db["Things"][0]["T_LIFEPOINTS"]) + "\n" + \
str(world_db["Things"][0]["T_SATIATION"]) + "\n" + \
-
"(none)\n
%\n" + \
+
inventory + "
%\n" + \
str(world_db["Things"][0]["T_POSY"]) + "\n" + \
str(world_db["Things"][0]["T_POSX"]) + "\n" + \
str(world_db["MAP_LENGTH"]) + "\n"
str(world_db["Things"][0]["T_POSY"]) + "\n" + \
str(world_db["Things"][0]["T_POSX"]) + "\n" + \
str(world_db["MAP_LENGTH"]) + "\n"
- # TODO: no inventory so far
length = world_db["MAP_LENGTH"]
for i in range(length):
line = world_db["MAP"][i * length:(i * length) + length].decode()
length = world_db["MAP_LENGTH"]
for i in range(length):
line = world_db["MAP"][i * length:(i * length) + length].decode()