-from plomrogue.tasks import Task_WAIT, Task_MOVE
+from plomrogue.tasks import Task_WAIT, Task_MOVE, Task_WRITE
from plomrogue.errors import GameError
-from plomrogue.commands import cmd_ALL, cmd_LOGIN, cmd_QUERY
+from plomrogue.commands import cmd_ALL, cmd_LOGIN, cmd_QUERY, cmd_PING
from plomrogue.io import GameIO
from plomrogue.misc import quote
from plomrogue.things import Thing, ThingPlayer
self.changed = True
self.io = GameIO(self)
self.tasks = {'WAIT': Task_WAIT,
- 'MOVE': Task_MOVE}
+ 'MOVE': Task_MOVE,
+ 'WRITE': Task_WRITE}
self.map_geometry = MapGeometrySquare(YX(24, 40))
self.commands = {'QUERY': cmd_QUERY,
'ALL': cmd_ALL,
- 'LOGIN': cmd_LOGIN}
+ 'LOGIN': cmd_LOGIN,
+ 'PING': cmd_PING}
self.thing_type = Thing
self.thing_types = {'player': ThingPlayer}
self.sessions = {}
self.map = Map(self.map_geometry.size)
def get_string_options(self, string_option_type):
+ import string
if string_option_type == 'direction':
return self.map_geometry.get_directions()
+ if string_option_type == 'char':
+ return [c for c in
+ string.digits + string.ascii_letters + string.punctuation]
return None
def send_gamestate(self, connection_id=None):
for connection_id in [c_id for c_id in self.sessions
if self.sessions[c_id] == t.id_]:
self.io.send('GAME_ERROR ' + quote(str(e)), connection_id)
- self.turn += 1
if self.changed:
+ self.turn += 1
self.send_gamestate()
self.changed = False