from .entity import Entity import random import struct from . import ChatColor, ChatType from dpnet.DFrame import DFrame class PlayerPhases: NONE = 0 CFRAME_CONNECT = 1 CFRAME_CONNECTED = 2 DN_INTERNAL_MESSAGE_PLAYER_CONNECT_INFO_EX = 3 DN_SEND_CONNECT_INFO = 4 DN_ACK_CONNECT_INFO = 5 INGAME = 6 class Player(Entity): def __init__(self, name, session): super().__init__() self.name = name self.session = session self.team = 2 self.score = 0 self.id = random.getrandbits(16) self.phase = PlayerPhases.NONE self.ping = 1 self.oid = 0 self.opts = {"debug": False} async def change_team(self, newteam): self.team = newteam await self.session.server.broadcast_event("on_player_change_team", self, self.team) await self.session.server.broadcast_gamedata(b"\x10"+struct.pack("