X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=rogue_chat_curses.py;h=a6f152cc9483254e5a5952df9025fcab2017e3ef;hb=3ea5a9fb6797a438f6f9847c2c442613bc8b0d1c;hp=d91c51703fecd8269b6ba4e11aea95dac1994d06;hpb=fb52d96afadba85295054b18eec101b2665c1278;p=plomrogue2 diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index d91c517..a6f152c 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -827,7 +827,7 @@ class TUI: else: for t in self.game.things: if t.position == self.explorer: - info_to_cache += '%s' % self.get_thing_info(t) + info_to_cache += '%s' % self.get_thing_info(t, True) terrain_char = self.game.map_content[pos_i] terrain_desc = '?' if terrain_char in self.game.terrains: @@ -847,8 +847,11 @@ class TUI: self.info_cached = info_to_cache return self.info_cached - def get_thing_info(self, t): - info = '- %s' % self.game.thing_types[t.type_] + def get_thing_info(self, t, detailed=False): + info = '' + if detailed: + info += '- ' + info += self.game.thing_types[t.type_] if hasattr(t, 'thing_char'): info += t.thing_char if hasattr(t, 'name'): @@ -856,32 +859,40 @@ class TUI: info += ' (%s' % t.type_ if hasattr(t, 'installed'): info += '/installed' - protection = t.protection - if protection != '.': - info += '/protection:%s' % protection - info += ')\n' - if hasattr(t, 'hat') or hasattr(t, 'face'): - info += '----------\n' - if hasattr(t, 'hat'): - info += '| %s |\n' % t.hat[0:6] - info += '| %s |\n' % t.hat[6:12] - info += '| %s |\n' % t.hat[12:18] - if hasattr(t, 'face'): - info += '| %s |\n' % t.face[0:6] - info += '| %s |\n' % t.face[6:12] - info += '| %s |\n' % t.face[12:18] - info += '----------\n' - if hasattr(t, 'design'): - line_length = t.design[0].x - lines = [] - for i in range(t.design[0].y): - start = i * line_length - end = (i + 1) * line_length - lines += [t.design[1][start:end]] - info += '-' * (line_length + 4) + '\n' - for line in lines: - info += '| %s |\n' % line - info += '-' * (line_length + 4) + '\n' + if t.type_ == 'Bottle': + if t.thing_char == '_': + info += '/empty' + elif t.thing_char == '~': + info += '/full' + if detailed: + protection = t.protection + if protection != '.': + info += '/protection:%s' % protection + info += ')\n' + if hasattr(t, 'hat') or hasattr(t, 'face'): + info += '----------\n' + if hasattr(t, 'hat'): + info += '| %s |\n' % t.hat[0:6] + info += '| %s |\n' % t.hat[6:12] + info += '| %s |\n' % t.hat[12:18] + if hasattr(t, 'face'): + info += '| %s |\n' % t.face[0:6] + info += '| %s |\n' % t.face[6:12] + info += '| %s |\n' % t.face[12:18] + info += '----------\n' + if hasattr(t, 'design'): + line_length = t.design[0].x + lines = [] + for i in range(t.design[0].y): + start = i * line_length + end = (i + 1) * line_length + lines += [t.design[1][start:end]] + info += '-' * (line_length + 4) + '\n' + for line in lines: + info += '| %s |\n' % line + info += '-' * (line_length + 4) + '\n' + else: + info += ')' return info def loop(self, stdscr): @@ -1065,21 +1076,22 @@ class TUI: return start_x = self.window_width - 10 - t_char = ' ' - if hasattr(t, 'thing_char'): - t_char = t.thing_char def draw_body_part(body_part, end_y): - safe_addstr(end_y - 4, start_x, ' _[ @' + t_char + ' ]_ ') - safe_addstr(end_y - 3, start_x, '| |') + safe_addstr(end_y - 3, start_x, '----------') safe_addstr(end_y - 2, start_x, '| ' + body_part[0:6] + ' |') safe_addstr(end_y - 1, start_x, '| ' + body_part[6:12] + ' |') safe_addstr(end_y, start_x, '| ' + body_part[12:18] + ' |') if hasattr(t, 'face'): - draw_body_part(t.face, self.size.y - 2) + draw_body_part(t.face, self.size.y - 3) if hasattr(t, 'hat'): - draw_body_part(t.hat, self.size.y - 5) - safe_addstr(self.size.y - 1, start_x, '| |') + draw_body_part(t.hat, self.size.y - 6) + safe_addstr(self.size.y - 2, start_x, '----------') + name = t.name[:] + if len(name) > 6: + name = name[:6] + '…' + safe_addstr(self.size.y - 1, start_x, + '@%s:%s' % (t.thing_char, name)) def draw_help(): content = "%s help\n\n%s\n\n" % (self.mode.short_desc,