|
@@ -155,12 +155,10 @@ class PlayerInput(object):
|
|
|
line = self.input
|
|
|
self.input = ''
|
|
|
assert(not self.deferred is None)
|
|
|
- log.msg(self.deferred)
|
|
|
- self.deferred.callback(line)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ reactor.callLater(0, self.deferred.callback, line)
|
|
|
self.deferred = None
|
|
|
if ch.isprintable():
|
|
|
if len(self.input) + 1 <= self.limit:
|
|
@@ -230,7 +228,8 @@ class ProxyMenu(object):
|
|
|
key = chunk.upper()
|
|
|
log.msg("ProxyMenu.player({0})".format(key))
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
self.keepalive.stop()
|
|
|
|
|
|
if key == "T":
|
|
@@ -240,14 +239,17 @@ class ProxyMenu(object):
|
|
|
self.queue_game.put(self.nl + self.c1 + "Current time " + now.to_datetime_string() + self.nl)
|
|
|
elif key == 'Q':
|
|
|
self.queue_game.put(self.c + key + self.r + self.nl)
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
ask = PlayerInput(self.game)
|
|
|
d = ask.prompt("What is your quest? ", 20)
|
|
|
-
|
|
|
|
|
|
+
|
|
|
d.addCallback(ask.output)
|
|
|
-
|
|
|
+
|
|
|
d.addCallback(self.welcome_back)
|
|
|
return
|
|
|
|
|
@@ -325,12 +327,15 @@ class Game(protocol.Protocol):
|
|
|
if LOG_LINES:
|
|
|
log.msg(">> [{0}]".format(line))
|
|
|
|
|
|
- if "TWGS v2.20b" in line and "www.eisonline.com" in line:
|
|
|
- self.queue_game.put(
|
|
|
- "TWGS Proxy build "
|
|
|
- + version
|
|
|
- + " is active. \x1b[1;34m~\x1b[0m to activate.\n\r\n\r",
|
|
|
- )
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
if "TradeWars Game Server" in line and "Copyright (C) EIS" in line:
|
|
|
|
|
@@ -366,6 +371,20 @@ class Game(protocol.Protocol):
|
|
|
FUTURE: trigger on prompt. [cleanANSI(buffer)]
|
|
|
"""
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ self.buffer += chunk.decode("utf-8", "ignore")
|
|
|
+
|
|
|
+
|
|
|
+ if b'TWGS v2.20b' in chunk and b'www.eisonline.com' in chunk:
|
|
|
+
|
|
|
+ target = b'www.eisonline.com\n\r'
|
|
|
+ pos = chunk.find(target)
|
|
|
+ if pos != -1:
|
|
|
+
|
|
|
+ message = "TWGS Proxy build " + version + ". ~ to activate in game.\n\r"
|
|
|
+ chunk = chunk[0:pos + len(target)] + message.encode() + chunk[pos + len(target):]
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -375,7 +394,11 @@ class Game(protocol.Protocol):
|
|
|
if self.to_player:
|
|
|
self.queue_game.put(chunk)
|
|
|
|
|
|
- self.buffer += chunk.decode("utf-8", "ignore")
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
while "\b" in self.buffer:
|