home · contact · privacy
TCE: Wet ground with urination.
[plomrogue] / plugins / client / TheCrawlingEater.py
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.
4
5
6 def win_bladder(self):
7     winmap = []
8     curses.init_pair(79, curses.COLOR_WHITE, curses.COLOR_BLUE)
9     for i in range(world_data["bladder"]):
10         winmap += [("~", curses.color_pair(79))]
11     winmap_size = [1, len(winmap)]
12     offset = [0, 0]
13     return offset, winmap_size, winmap
14
15
16 def win_bowel(self):
17     winmap = []
18     curses.init_pair(80, curses.COLOR_YELLOW, curses.COLOR_RED)
19     for i in range(world_data["bowel"]):
20         winmap += [("#", curses.color_pair(80))]
21     winmap_size = [1, len(winmap)]
22     offset = [0, 0]
23     return offset, winmap_size, winmap
24
25
26 def win_map(self):
27     win_size = self.size
28     offset = [0, 0]
29     for i in range(2):
30         if world_data["map_center"][i] * (i + 1) > win_size[i] / 2 and \
31                 win_size[i] < world_data["map_size"] * (i + 1):
32             if world_data["map_center"][i] * (i + 1) \
33                 < world_data["map_size"] * (i + 1) - win_size[i] / 2:
34                 offset[i] = world_data["map_center"][i] * (i + 1) \
35                     - int(win_size[i] / 2)
36                 if i == 1:
37                     offset[1] = offset[1] + world_data["map_center"][0] % 2
38             else:
39                 offset[i] = world_data["map_size"] * (i + 1) - win_size[i] + i
40     winmap_size = [world_data["map_size"], world_data["map_size"] * 2 + 1]
41     winmap = []
42     curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
43     curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_BLACK)
44     curses.init_pair(3, curses.COLOR_RED, curses.COLOR_BLACK)
45     curses.init_pair(4, curses.COLOR_YELLOW, curses.COLOR_BLACK)
46     curses.init_pair(5, curses.COLOR_CYAN, curses.COLOR_BLACK)
47     curses.init_pair(6, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
48     curses.init_pair(7, curses.COLOR_GREEN, curses.COLOR_BLACK)
49     curses.init_pair(8, curses.COLOR_BLACK, curses.COLOR_MAGENTA)
50     curses.init_pair(9, curses.COLOR_BLACK, curses.COLOR_BLUE)
51     curses.init_pair(10, curses.COLOR_BLACK, curses.COLOR_CYAN)
52     col_unknown = curses.color_pair(1)
53     col_mem_obstacle = curses.color_pair(2)
54     col_mem = curses.color_pair(2)
55     col_stone = curses.color_pair(1)
56     col_player = curses.color_pair(5)
57     col_ground = curses.color_pair(6)
58     col_ground_wet = curses.color_pair(8)
59     col_ground_wetter = curses.color_pair(9)
60     col_ground_wettest = curses.color_pair(10)
61     col_dirt = curses.color_pair(3)
62     col_dirt_wet = curses.color_pair(8)
63     col_dirt_wetter = curses.color_pair(9)
64     col_dirt_wettest = curses.color_pair(10)
65     col_earth = curses.color_pair(3)
66     col_earth_wet = curses.color_pair(8)
67     col_earth_wetter = curses.color_pair(9)
68     col_earth_wettest = curses.color_pair(10)
69     col_wall_dirt = curses.color_pair(4)
70     col_wall_dirt_wet = curses.color_pair(8)
71     col_wall_dirt_wetter = curses.color_pair(9)
72     col_wall_dirt_wettest = curses.color_pair(10)
73     col_wall_earth = curses.color_pair(4)
74     col_wall_earth_wet = curses.color_pair(8)
75     col_wall_earth_wetter = curses.color_pair(9)
76     col_wall_earth_wettest = curses.color_pair(10)
77     col_wall_stone = curses.color_pair(1)
78     col_wall_stone_wet = curses.color_pair(8)
79     col_wall_stone_wetter = curses.color_pair(9)
80     col_wall_stone_wettest = curses.color_pair(10)
81     for y in range(world_data["map_size"]):
82         for x in range(world_data["map_size"]):
83             pos = y * world_data["map_size"] + x
84             char = world_data["fov_map"][pos]
85             if world_data["look_mode"] and y == world_data["map_center"][0] \
86                     and x == world_data["map_center"][1]:
87                 if char == " ":
88                     char = world_data["mem_map"][pos]
89                 winmap += [(char, curses.A_REVERSE), ("?", curses.A_REVERSE)]
90                 continue
91             if char == " ":
92                 char = world_data["mem_map"][pos]
93                 attribute = col_mem
94                 if char == " ":
95                     attribute = col_unknown
96                 elif char in "%#XABCDEFGHI":
97                     attribute = col_mem_obstacle
98                     if char in "ADG":
99                         char = "%"
100                     elif char in "BEH":
101                         char = "#"
102                     elif char in "CFI":
103                         char = "X"
104                 elif char in "LO":
105                     char = "~"
106                 elif char in "JMP":
107                     char = "."
108                 elif char in "KNQ":
109                     char = ":"
110                 bonus = (" ", attribute)
111                 winmap += [(char, attribute), bonus]
112             else:
113                 attribute = col_stone
114                 bonus = " "
115                 if char == "_":
116                     attribute = col_ground
117                 elif char == "~":
118                     attribute = col_ground_wet
119                 elif char == "L":
120                     char = "~"
121                     attribute = col_ground_wetter
122                 elif char == "O":
123                     char = "~"
124                     attribute = col_ground_wettest
125                 if char == ".":
126                     attribute = col_dirt
127                 if char == "J":
128                     char = "."
129                     attribute = col_dirt_wet
130                 if char == "M":
131                     char = "."
132                     attribute = col_dirt_wetter
133                 if char == "P":
134                     char = "."
135                     attribute = col_dirt_wettest
136                 elif char == ":":
137                     attribute = col_earth
138                 elif char == "K":
139                     char = ":"
140                     attribute = col_earth_wet
141                 elif char == "N":
142                     char = ":"
143                     attribute = col_earth_wetter
144                 elif char == "Q":
145                     char = ":"
146                     attribute = col_earth_wettest
147                 elif char == "%":
148                     attribute = col_wall_dirt
149                 elif char == "A":
150                     char = "%"
151                     attribute = col_wall_dirt_wet
152                 elif char == "D":
153                     char = "%"
154                     attribute = col_wall_dirt_wetter
155                 elif char == "G":
156                     char = "%"
157                     attribute = col_wall_dirt_wettest
158                 elif char == "#":
159                     attribute = col_wall_earth
160                 elif char == "B":
161                     char = "#"
162                     attribute = col_wall_earth_wet
163                 elif char == "E":
164                     char = "#"
165                     attribute = col_wall_earth_wetter
166                 elif char == "H":
167                     char = "#"
168                     attribute = col_wall_earth_wettest
169                 elif char == "X":
170                     attribute = col_wall_stone
171                 elif char == "C":
172                     char = "X"
173                     attribute = col_wall_stone_wet
174                 elif char == "F":
175                     char = "X"
176                     attribute = col_wall_stone_wetter
177                 elif char == "I":
178                     char = "X"
179                     attribute = col_wall_stone_wettest
180                 elif char == "@":
181                     attribute = col_player
182                 winmap += [(char, attribute), bonus]
183         if y % 2 == 0:
184             winmap += "  "
185     return offset, winmap_size, winmap
186
187 from client.config.world_data import world_data
188 world_data["bowel"] = 0
189 world_data["bladder"] = 0
190 from client.config.io import io
191 io["worldstate_read_order"] += [["bowel", "int"]]
192 io["worldstate_read_order"] += [["bladder", "int"]]
193 from client.config.windows import windows_config
194 from client.windows import win_log
195 windows_config[:] = [
196     {"config": [0, -34], "func": win_map, "title": "The Crawling Eater"},
197     {"config": [1, 33], "func": win_bowel, "title": "bowel"},
198     {"config": [1, 33], "func": win_bladder, "title": "bladder"},
199     {"config": [-4, 33], "func": win_log, "title": "log"}
200 ]
201 from client.window_management import set_windows
202 set_windows()
203 from client.commands import command_sender
204 from client.config.commands import commands
205 commands["S"] = (command_sender("drop"),)
206 commands["D"] = (command_sender("drink"),)
207 commands["P"] = (command_sender("pee"),)