示例#1
0
func (this *RoleStatusReq) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
示例#2
0
文件: login.go 项目: dulumao/gsgo
func (this *LoginResp) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	buf.PutRawValue(this.RandomCode)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
示例#3
0
文件: proxy.go 项目: dulumao/gsgo
func (this *ProxyClientOfflineResp) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	buf.PutRawValue(this.UserID)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
示例#4
0
文件: comm.go 项目: dulumao/gsgo
func (this *ServerErrorNt) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	buf.PutRawValue(this.ReqCmdID)
	buf.PutRawValue(this.ErrCode)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
示例#5
0
func (this *InitTimeStampNt) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	buf.PutRawValue(this.TimeStamp)
	buf.PutRawValue(this.SyncCode)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
示例#6
0
func (this *CreateRoleReq) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	buf.PutRawValue(this.RoleName)
	buf.PutRawValue(this.RoleJob)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
示例#7
0
func (this *PlayerLoginReq) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	buf.PutRawValue(this.UserName)
	buf.PutRawValue(this.UserPwd)
	buf.PutRawValue(this.UserID)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
示例#8
0
文件: proxy.go 项目: dulumao/gsgo
func (this *ProxyRouteResp) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	buf.PutRawValue(this.Ip)
	buf.PutRawValue(this.Port)
	buf.PutRawValue(this.ExtStrVal)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
示例#9
0
文件: comm.go 项目: dulumao/gsgo
func (this *VersionCheckResp) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	buf.PutRawValue(this.NodeType)
	buf.PutRawValue(this.GameID)
	buf.PutRawValue(this.GameCode)
	buf.PutRawValue(this.Code)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
示例#10
0
func (this *RoleListResp) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	if len(this.RoleList) > 0 {
		buf.PutRawValue(uint16(len(this.RoleList)))
		for _, tmp := range this.RoleList {
			buf = tmp.EncodeEntity(buf)
		}
	}
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
示例#11
0
文件: packet.go 项目: dulumao/gsgo
func (h *Header) Encode(writeBuf *iobuffer.OutBuffer) *iobuffer.OutBuffer {
	if writeBuf == nil {
		writeBuf = iobuffer.NewOutBuffer(1024)
	}
	writeBuf.PutUint16(h.PackLen)
	writeBuf.PutUint16(h.CmdID)
	writeBuf.PutUint32(h.ID)
	writeBuf.PutUint16(h.FSID)
	writeBuf.PutUint16(h.TSID)
	writeBuf.PutUint16(h.ValidCode)
	writeBuf.PutUint8(h.Version)
	writeBuf.PutUint8(h.ClientSrc)
	writeBuf.PutUint16(h.ErrCode)
	return writeBuf
}
示例#12
0
func (this *MyClient) HandleMsg(cmdid uint16, pack *packet.Packet, conn netio.ConnInf) {
	//fmt.Println("[C]...read a msg, id = ", cmdid)
	buf := iobuffer.NewOutBuffer(int(pack.PackLen + packet.PACKET_PROXY_HEADER_LEN))
	buf = pack.Header.Encode(buf)
	for _, tmp := range pack.RawData {
		buf.PutByte(tmp)
	}

	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)

	//	if conn != nil {
	//		conn.Write(buf.GetData())
	//	}
}
示例#13
0
文件: login.go 项目: dulumao/gsgo
func (this *LoginValidResp) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	buf.PutRawValue(this.UFID)
	buf.PutRawValue(this.UserId)
	buf.PutRawValue(this.ValidFlag)
	buf.PutRawValue(this.NeedRecover)
	buf.PutRawValue(this.GameAreaId)
	buf.PutRawValue(this.GameId)
	buf.PutRawValue(this.GameServerId)
	buf.PutRawValue(this.GameServerIp)
	buf.PutRawValue(this.GameServerPort)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
示例#14
0
文件: proxy.go 项目: dulumao/gsgo
func (this *NodeRegReq) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	buf.PutRawValue(this.NodeType)
	buf.PutRawValue(this.IP)
	buf.PutRawValue(this.Port)
	buf.PutRawValue(this.GameId)
	buf.PutRawValue(this.GameAreaId)
	buf.PutRawValue(this.GameServerId)
	buf.PutRawValue(this.GameCode)
	buf.PutRawValue(this.GameServerName)
	buf.PutRawValue(this.GameServerDesc)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}