"数据包类构建器"

class SubPacket_CmdOutputMsg:
	"""命令输出消息子包构建"""

	Success: bool
	Message: str
	Parameters: list

	def __init__(self, pkt: dict):
		self.Success = pkt["Success"]
		self.Parameters = pkt["Parameters"]
		self.Message = pkt["Message"]


class SubPacket_CmdOrigin:
	"命令来源子包构建"

	Origin: int
	UUID: str
	RequestID: str
	PlayerUniqueID: int

	def __init__(self, pkt: dict):
		self.Origin = pkt["Origin"]
		self.UUID = pkt["UUID"]
		self.RequestID = pkt["RequestID"]
		self.PlayerUniqueID = pkt["PlayerUniqueID"]


class Packet_CommandOutput:
	"命令输出包构建"

	CommandOrigin: SubPacket_CmdOrigin
	OutputType: int
	SuccessCount: int
	OutputMessages: list[SubPacket_CmdOutputMsg]
	as_dict: dict

	def __init__(self, pkt: dict):
		self.as_dict = pkt
		self.CommandOrigin = SubPacket_CmdOrigin(pkt["CommandOrigin"])
		self.OutputMessages = [
			SubPacket_CmdOutputMsg(imsg) for imsg in pkt["OutputMessages"]
		]
		self.SuccessCount = pkt["SuccessCount"]
		self.OutputType = pkt["OutputType"]
