diff options
author | Livio Recchia <recchialivio@libero.it> | 2020-02-10 23:06:34 +0100 |
---|---|---|
committer | Livio Recchia <recchialivio@libero.it> | 2020-02-10 23:06:34 +0100 |
commit | 9a13903a2f7d3a65fdf15a65fb59cccd622e2066 (patch) | |
tree | 9403b7dff39eb5e5d7fa0f79efb69b496add4c4b /gui/handlers.py | |
parent | 11cc316b74d5f3f283413a33e7693b314741aa4a (diff) | |
download | manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.gz manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.bz2 manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.xz manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.zip |
Initial commit
Diffstat (limited to 'gui/handlers.py')
-rw-r--r-- | gui/handlers.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gui/handlers.py b/gui/handlers.py new file mode 100644 index 0000000..b6f9d0b --- /dev/null +++ b/gui/handlers.py @@ -0,0 +1,49 @@ + +import net.mapserv as mapserv +from loggers import debuglog +from utils import extends + + +__all__ = ['app'] + + +map_name = "" +app = None + + +@extends('smsg_whisper_response') +def send_whisper_result(data): + if data.code == 0: + last_nick = mapserv.last_whisper['to'] + app.root.chat_input.text = '/w "{}" '.format(last_nick) + app.root.chat_input.focus = True + + +@extends('smsg_player_warp') +def player_warp(data): + mapserv.cmsg_map_loaded() + m = "[warp] {} ({},{})".format(data.map, data.x, data.y) + debuglog.info(m) + + +@extends('smsg_char_map_info') +def char_map_info(data): + global map_name + map_name = data.map_name + + +@extends('smsg_map_login_success') +def map_login_success(data): + m = "[map] {} ({},{})".format(map_name, data.coor.x, data.coor.y) + debuglog.info(m) + mapserv.server.raw = True + mapserv.cmsg_map_loaded() + + +@extends('smsg_connection_problem') +def connection_problem(data): + error_codes = { + 2 : "Account already in use" + } + msg = error_codes.get(data.code, str(data.code)) + debuglog.error('Connection problem: %s', msg) |