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.
9 from client.config.world_data import world_data
16 if world_data["map_center"][i] * (i + 1) > win_size[i] / 2 and \
17 win_size[i] < world_data["map_size"] * (i + 1):
18 if world_data["map_center"][i] * (i + 1) \
19 < world_data["map_size"] * (i + 1) - win_size[i] / 2:
20 offset[i] = world_data["map_center"][i] * (i + 1) \
21 - int(win_size[i] / 2)
23 offset[1] = offset[1] + world_data["map_center"][0] % 2
25 offset[i] = world_data["map_size"] * (i + 1) - win_size[i] + i
26 winmap_size = [world_data["map_size"], world_data["map_size"] * 2 + 1]
28 curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE)
29 curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_BLACK)
30 for y in range(world_data["map_size"]):
31 for x in range(world_data["map_size"]):
32 char = world_data["fov_map"][y * world_data["map_size"] + x]
33 if world_data["look_mode"] and y == world_data["map_center"][0] \
34 and x == world_data["map_center"][1]:
37 world_data["mem_map"][y * world_data["map_size"] + x]
38 winmap += [(char, curses.A_REVERSE), (" ", curses.A_REVERSE)]
41 char = world_data["mem_map"][y * world_data["map_size"] + x]
42 attribute = curses.color_pair(1) if char == " " \
43 else curses.color_pair(2)
44 winmap += [(char, attribute), (" ", attribute)]
49 return offset, winmap_size, winmap
52 def win_inventory(self):
55 winmap_size = [0, win_size[1]]
56 for line in world_data["inventory"]:
57 winmap_size[1] = winmap_size[1] if len(line) <= winmap_size[1] \
60 for line in world_data["inventory"]:
61 padding_size = winmap_size[1] - len(line)
62 line += (" " * padding_size)
63 if count == world_data["inventory_selection"]:
65 for x in range(len(line)):
66 line_new += [(line[x], curses.A_REVERSE)]
69 winmap_size[0] = winmap_size[0] + 1
72 if world_data["inventory_selection"] > win_size[0]/2:
73 if world_data["inventory_selection"] < len(world_data["inventory"]) \
75 offset[0] = world_data["inventory_selection"] - int(win_size[0]/2)
77 offset[0] = len(world_data["inventory"]) - win_size[0]
78 return offset, winmap_size, winmap
84 for line in world_data["look"]:
85 winmap_size[1] = winmap_size[1] if len(line) <= winmap_size[1] \
87 for line in world_data["look"]:
88 padding_size = winmap_size[1] - len(line)
89 winmap += line + (" " * padding_size)
90 winmap_size[0] = winmap_size[0] + 1
91 offset = [world_data["look_scroll"], 0]
92 return offset, winmap_size, winmap
96 winmap = "T: " + str(world_data["turn"]) \
97 + " H: " + str(world_data["lifepoints"]) \
98 + " S: " + str(world_data["satiation"])
99 winmap_size = [1, len(winmap)]
101 return offset, winmap_size, winmap
109 for line in world_data["log"]:
110 number_of_lines += math.ceil(len(line) / win_size[1])
111 padding_size = win_size[1] - (len(line) % win_size[1])
112 winmap += line + (padding_size * " ")
113 if number_of_lines < win_size[0]:
114 winmap = (" " * win_size[1] * (win_size[0] - number_of_lines)) + winmap
115 number_of_lines = win_size[0]
116 elif number_of_lines > win_size[0]:
117 offset[0] = number_of_lines - win_size[0]
118 winmap_size = [number_of_lines, win_size[1]]
119 return offset, winmap_size, winmap