+ if char >= 0 and chr(char) in commands:
+ commands[chr(char)]()
+ cursed_main.redraw = True
+ new_data_from_server = io["file_in"].read()
+ ping_test()
+ read_into_message_queue()
+ read_worldstate()
+ read_message_queue()
+
+
+def win_foo():
+ winmap = [('.', 0), ('o', 0), ('.', 0), ('o', 0), ('O', 0), ('o', 0),
+ ('.', 0), ('o', 0), ('.', 0), ('x', 0), ('y', 0), ('x', 0)]
+ winmap_size = [4, 3]
+ offset = [0, 0]
+ return offset, winmap_size, winmap
+
+
+def win_map():
+ win_size = next(win["size"] for win in windows if win["func"] == win_map)
+ offset = [0, 0]
+ for i in range(2):
+ if world_data["map_center"][i] * (i + 1) > win_size[i] / 2:
+ if world_data["map_center"][i] * (i + 1) \
+ < world_data["map_size"] * (i + 1) - win_size[i] / 2:
+ offset[i] = world_data["map_center"][i] * (i + 1) \
+ - int(win_size[i] / 2)
+ else:
+ offset[i] = world_data["map_size"] * (i + 1) - win_size[i] + i
+ winmap_size = [world_data["map_size"], world_data["map_size"] * 2 + 1]
+ winmap = []
+ curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE)
+ curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_BLACK)
+ for y in range(world_data["map_size"]):
+ for x in range(world_data["map_size"]):
+ char = world_data["fov_map"][y * world_data["map_size"] + x]
+ if world_data["look_mode"] and y == world_data["map_center"][0] \
+ and x == world_data["map_center"][1]:
+ if char == " ":
+ char = \
+ world_data["mem_map"][y * world_data["map_size"] + x]
+ winmap += [(char, curses.A_REVERSE), (" ", curses.A_REVERSE)]
+ continue
+ if char == " ":
+ char = world_data["mem_map"][y * world_data["map_size"] + x]
+ attribute = curses.color_pair(1) if char == " " \
+ else curses.color_pair(2)
+ winmap += [(char, attribute), (" ", attribute)]
+ else:
+ winmap += char + " "
+ if y % 2 == 0:
+ winmap += " "
+ return offset, winmap_size, winmap
+
+
+def win_inventory():
+ winmap = ""
+ winmap_size = [0, 0]
+ for line in world_data["inventory"]:
+ winmap_size[1] = winmap_size[1] if len(line) <= winmap_size[1] \
+ else len(line)
+ for line in world_data["inventory"]:
+ padding_size = winmap_size[1] - len(line)
+ winmap += line + (" " * padding_size)
+ winmap_size[0] = winmap_size[0] + 1
+ offset = [0, 0]
+ return offset, winmap_size, winmap
+
+
+def win_info():
+ winmap = "T: " + str(world_data["turn"]) \
+ + " H: " + str(world_data["lifepoints"]) \
+ + " S: " + str(world_data["satiation"])
+ winmap_size = [1, len(winmap)]
+ offset = [0, 0]
+ return offset, winmap_size, winmap