slay.py
1from slay import Info 2 3def GlobalChatHistory(limit: int = 25): 4 return f'{{"gcHistory":{{"channel":"global","limit":{limit}}}}}' 5 6def GameList(): 7 return "req-games-list" 8 9def JoinGameRoom(id: int): 10 """ Server will not respond if the game room not found """ 11 12 return f"join-game${id}" 13 14def JoinGame(team_id: int = 1): 15 return f"joinTeam${team_id}" 16 17def LeaveGame(): 18 return "leave-game" 19 20def LogIn(username: str, password: str): 21 return f"login${username}${password}" 22 23def StartMoving(direction: Info.MovingDirection): 24 return f"kd${direction.value}" 25 26def StopMoving(direction: Info.MovingDirection): 27 return f"ku${direction.value}" 28 29def JoinRandomGameRoom(mode: Info.GameMode): 30 return f"joinRandomGame$undefined${mode.id}" 31 32def UpdateHeadDirection(direction: Info.HeadDirection): 33 return f"dirU${direction.value}" 34 35def UseAbility(ability: Info.Ability): 36 return f"ab${ability.value}" 37 38def Respawn(): 39 return "respawn" 40 41def UpdateProfileText(text: str): 42 if len(text) > 255: 43 raise OverflowError("The length of profile text cannot be over 255.") 44 45 return f"update-profile-text${text}" 46 47def MessageInGame(content: str): 48 49 if len(content) > 140: 50 raise OverflowError("The length of message in game cannot be over 140.") 51 52 return f"chat{content}" 53 54def CreateGame( 55 map_id: int, 56 round_minutes: int, 57 maximum_number_of_bots: int, 58 mode_id: int, 59 is_private: bool = False, 60): 61 return f"create-game${map_id}${round_minutes}${maximum_number_of_bots}${mode_id}${int(is_private)}" 62 63def ClanInfo(clan_tag: str): 64 if clan_tag: 65 return f"myClanInfo${clan_tag}" 66 else: 67 return "myClanInfo" 68 69def ClanMemberList(clan_tag: str): 70 return f"getMemberList${clan_tag}"
def
GlobalChatHistory(limit: int = 25):
def
GameList():
def
JoinGameRoom(id: int):
10def JoinGameRoom(id: int): 11 """ Server will not respond if the game room not found """ 12 13 return f"join-game${id}"
Server will not respond if the game room not found
def
JoinGame(team_id: int = 1):
def
LeaveGame():
def
LogIn(username: str, password: str):
def
Respawn():
def
UpdateProfileText(text: str):
def
MessageInGame(content: str):
def
CreateGame( map_id: int, round_minutes: int, maximum_number_of_bots: int, mode_id: int, is_private: bool = False):
def
ClanInfo(clan_tag: str):
def
ClanMemberList(clan_tag: str):