示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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"
示例#4
0
 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"
示例#5
0
def storage_increment(key):
    if server.is_online():
        s = get_from_storage(key)
        put_to_storage(key, s + 1)
示例#6
0
def storage_increment(key):
    if server.is_online():
        s = get_from_storage(key)
        put_to_storage(key, s + 1)