def stats(): if not server.is_online(): return "server is not online" st = get_storage() return """played a total of {played} games won {win} of them lost {lost} of them, with honor draw {draw} of them and miserably surrendered {surrender} games""".format(**st)
def login(username, password): if not server.is_online(): return "server is not online now, retry later" response = s_login(username, password) if response.had_errors: return "login failed, " + response.error_desc usertoken = response.content game.username = username game.usertoken = usertoken game.context = "lobby" create_storage(usertoken) return "logged successful"
def storage_increment(key): if server.is_online(): s = get_from_storage(key) put_to_storage(key, s + 1)