示例#1
0
func (c *POClient) UpdateMyPoke() {
	if poke := c.battle.currentPoke(c.battle.me); poke != nil {
		packet := pnet.NewPacketExt(pnet.HEADER_BATTLE_UPDATEMYPOKE)
		packet.AddString(poke.RNick)
		packet.AddUint32(uint32(poke.Level))
		packet.AddUint8(uint8(poke.Gender))
		packet.AddUint32(uint32(poke.GetStatus()))

	}
}
示例#2
0
// WritePacket write the needed object data to a Packet and returns it
func (m *LoginMessage) WritePacket() (*pnet.Packet, error) {
	packet := pnet.NewPacketExt(m.GetHeader())
	packet.AddUint32(m.Status)

	if m.Status == LOGINSTATUS_READY {
		packet.AddUint32(uint32(len(m.Servers)))

		for name, server := range m.Servers {
			packet.AddString(name)
			packet.AddString(server.Name)
			packet.AddString(server.Ip)
			packet.AddUint8(server.Online)
		}
	}

	return packet, nil
}