1 # This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
2 # or any later version. For details on its copyright, license, and warranties,
3 # see the file NOTICE in the root directory of the PlomRogue source package.
6 from server.config.world_data import world_db
11 if [] == world_db["Things"][0]["T_CARRIES"]:
12 inventory = "(none)\n"
14 for id in world_db["Things"][0]["T_CARRIES"]:
15 type_id = world_db["Things"][id]["T_TYPE"]
16 name = world_db["ThingTypes"][type_id]["TT_NAME"]
17 inventory = inventory + name + "\n"
21 def write_map(map, length):
23 for i in range(length):
24 line = map[i * length:(i * length) + length].decode()
25 string = string + line + "\n"
29 length = world_db["MAP_LENGTH"]
30 fov = bytearray(b' ' * (length ** 2))
32 for pos in [pos for pos in range(length ** 2)
33 if ord_v == world_db["Things"][0]["fovmap"][pos]]:
34 fov[pos] = world_db["MAP"][pos]
35 for id in [id for tid in reversed(sorted(list(world_db["ThingTypes"])))
36 for id in world_db["Things"]
37 if not world_db["Things"][id]["carried"]
38 if world_db["Things"][id]["T_TYPE"] == tid
39 if world_db["Things"][0]["fovmap"][
40 world_db["Things"][id]["pos"]] == ord_v]:
41 type = world_db["Things"][id]["T_TYPE"]
42 c = ord(world_db["ThingTypes"][type]["TT_SYMBOL"])
43 fov[world_db["Things"][id]["pos"]] = c
44 return write_map(fov, length)
47 length = world_db["MAP_LENGTH"]
48 mem = world_db["Things"][0]["T_MEMMAP"][:]
49 for mt in [mt for tid in reversed(sorted(list(world_db["ThingTypes"])))
50 for mt in world_db["Things"][0]["T_MEMTHING"]
52 c = world_db["ThingTypes"][mt[0]]["TT_SYMBOL"]
53 mem[(mt[1] * length) + mt[2]] = ord(c)
54 return write_map(mem, length)