예제 #1
0
func readPlayer(conn net.Conn, buffer *sirius_net.Buffer, seq uint32) error {
	get := &dbproto.Get{
		MsgType: proto.String("Player"),
		Key:     proto.String(fmt.Sprintf("%d", seq)),
		//Flags:   proto.Uint32(uint32(Flags_FLAG_CACHE_ONLY)),
	}
	err := buffer.WriteMsg(get, uint32(dbproto.Command_CMD_GET_REQ), seq)
	if err != nil {
		fmt.Println(err)
	}
	assert(err == nil)
	return err
}
예제 #2
0
func writePlayer(conn net.Conn, buffer *sirius_net.Buffer, seq uint32) error {
	player := &immortaldb.Player{
		Account: proto.String("testaccount"),
		Name:    proto.String("testname"),
		Level:   proto.Uint32(1),
		Exp:     proto.Uint32(100),
		Extend:  make([]byte, extendSize),
		Roleid:  proto.Uint64(uint64(seq)),
	}
	set := &dbproto.Set{
		MsgType: proto.String("Player"),
		Key:     proto.String(fmt.Sprintf("%d", seq)),
		//Flags:   proto.Uint32(uint32(Flags_FLAG_CACHE_ONLY)),
	}
	set.Value, _ = proto.Marshal(player)
	err := buffer.WriteMsg(set, uint32(dbproto.Command_CMD_SET_REQ), seq)
	assert(err == nil)
	return err
}