game.tui.switch_mode('post_login_wait')
game.tui.send('GET_GAMESTATE')
game.tui.log_msg('@ welcome!')
- game.tui.log_msg('@ hint: see top of terminal for how to get help.')
- game.tui.log_msg('@ hint: enter study mode to understand your environment.')
cmd_LOGIN_OK.argtypes = ''
def cmd_ADMIN_OK(game):
self.disconnected = False
self.game.thing_types = {}
self.game.terrains = {}
+ self.is_admin = False
time.sleep(0.1) # give potential SSL negotation some time …
self.socket.send('TASKS')
self.socket.send('TERRAINS')
self.log_msg('@ finished tile protection drawing.')
self.draw_face = False
self.tile_draw = False
+ self.ascii_draw_stage = 0
+ self.full_ascii_draw = ''
if mode_name == 'command_thing' and\
(not self.game.player.carrying or
not self.game.player.carrying.commandable):
self.restore_input_values()
def set_default_colors(self):
- curses.init_color(1, 1000, 1000, 1000)
- curses.init_color(2, 0, 0, 0)
+ if curses.can_change_color():
+ curses.init_color(7, 1000, 1000, 1000)
+ curses.init_color(0, 0, 0, 0)
self.do_refresh = True
def set_random_colors(self):
import random
return int(offset + random.random()*375)
- curses.init_color(1, rand(625), rand(625), rand(625))
- curses.init_color(2, rand(0), rand(0), rand(0))
+ if curses.can_change_color():
+ curses.init_color(7, rand(625), rand(625), rand(625))
+ curses.init_color(0, rand(0), rand(0), rand(0))
self.do_refresh = True
def get_info(self):
term_y += 1
map_y += 1
+ def draw_names():
+ players = [t for t in self.game.things if t.type_ == 'Player']
+ players.sort(key=lambda t: len(t.name))
+ players.reverse()
+ shrink_offset = max(0, (self.size.y - self.left_window_width // 2) // 2)
+ y = 0
+ for t in players:
+ offset_y = y - shrink_offset
+ max_len = max(5, (self.left_window_width // 2) - (offset_y * 2) - 8)
+ name = t.name[:]
+ if len(name) > max_len:
+ name = name[:max_len - 1] + '…'
+ safe_addstr(y, 0, '@%s:%s' % (t.thing_char, name))
+ y += 1
+ if y >= self.size.y:
+ break
+
def draw_face_popup():
t = self.game.get_thing(self.draw_face)
if not t or not hasattr(t, 'face'):
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] + '…'
+ if len(name) > 7:
+ name = name[:6 - 1] + '…'
safe_addstr(self.size.y - 1, start_x,
'@%s:%s' % (t.thing_char, name))
draw_map()
if self.show_help:
draw_help()
- if self.draw_face and self.mode.name in {'chat', 'play'}:
- draw_face_popup()
+ if self.mode.name in {'chat', 'play'}:
+ draw_names()
+ if self.draw_face:
+ draw_face_popup()
def pick_selectable(task_name):
try:
'dance': 'DANCE',
}
- curses.curs_set(False) # hide cursor
+ curses.curs_set(0) # hide cursor
curses.start_color()
self.set_default_colors()
- curses.init_pair(1, 1, 2)
+ curses.init_pair(1, 7, 0)
+ if not curses.can_change_color():
+ self.log_msg('@ unfortunately, your terminal does not seem to '
+ 'support re-definition of colors; you might miss out '
+ 'on some color effects')
stdscr.timeout(10)
reset_screen_size()
self.explorer = YX(0, 0)