from giants import ChatColor import asyncio import struct class Commands: def __init__(self, server): self.server = server async def on_player_chat(self, player, type, team, message): await self.server.broadcast_message("%s (%s,%s): %s" % (player.name, type, team, message), color=ChatColor.Yellow) print(message) command = message.split(" ") if len(command) > 1 and command[0] == "team": newteam = command[1].replace("\x00", "") print("Changing team of %s to %s" % (player.name, newteam)) await self.server.broadcast_message("%s switched to team %s" % (player.name, newteam)) await player.change_team(int(newteam)) if len(command) > 1 and command[0] == "ping": newping = command[1].replace("\x00", "") print("Changing ping of %s to %s" % (player.name, newping)) await self.server.broadcast_message("%s set his ping to %s" % (player.name, newping)) await player.send_ping(int(newping)) if command[0] == "ping": print("ping function") await self.server.broadcast_message("pong") if command[0] == "colors": # color codes seem to go from 01 to 0F, loop and show each value: for i in range(1, 0xf + 1): print("Trying value %s" % i) await player.send_message("Color %s" % i, color=i) await asyncio.sleep(2) # sleep between each value to see what value makes the client crash if command[0] == "chattypes": # type codes seem to go from 00 to 0F, loop and show each value: CRASH for i in range(0, 0xf+1): print("Trying value %s" % i) await self.server.broadcast_message("Type %s" % i, type=i) await asyncio.sleep(2) # sleep between each value to see what value makes the client crash if command[0] == "doomchat": # tries every value of first byte and second byte for i in range(3,0xff+1): for j in range(0, 0x81): if i == 0 and j == 2: break # ;) message = "(%s, %s)" % (i, j) print(message) await player.session.send_gamedata(b"\x35" + struct.pack(" 1: diemethod = int(command[1]) await player.send_message("Death by id: %s" % diemethod) await player.session.send_gamedata(bytes.fromhex("0b1a0000000002070000a5b0d4c35d9714c450abef354a68fb410914000000020700000402000000")+struct.pack("