cs

package
v0.0.0-...-0e6f1c7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//proto start
	CS_PROTO_START      = 0
	CS_PROTO_PING_REQ   = 1
	CS_PROTO_PING_RSP   = 2
	CS_PROTO_LOGIN_REQ  = 3
	CS_PROTO_LOGIN_RSP  = 4
	CS_PROTO_LOGOUT_REQ = 5
	CS_PROTO_LOGOUT_RSP = 6
	CS_PROTO_REG_REQ    = 7
	CS_PROTO_REG_RSP    = 8
	//PS:new proto added should modify 'Proto2Msg' function
	//proto end = last + 1
	CS_PROTO_END = 9
)

CS PROTO ID

Variables

This section is empty.

Functions

func DecodeMsg

func DecodeMsg(data []byte, pmsg *GeneralMsg) error

* Decode GeneralMsg * @return

func EncodeMsg

func EncodeMsg(pmsg *GeneralMsg) ([]byte, error)

* Encode GeneralMsg * @return encoded_bytes , error

func Proto2Msg

func Proto2Msg(proto_id int) (interface{}, error)

* Get ProtoMsg By Proto

Types

type CSLoginReq

type CSLoginReq struct {
	Name    string `json:"name"`
	Pass    string `json:"pass"`
	Device  string `json:"device"`
	Version string `json:"version"`
}

type CSLoginRsp

type CSLoginRsp struct {
	Result int        `json:"result"`
	Name   string     `json:"name"`
	Basic  UserBasic  `json:"basic"`
	Detail UserDetail `json:"user_detail"`
}

type CSLogoutReq

type CSLogoutReq struct {
	Uid int64 `json:"uid"`
}

type CSLogoutRsp

type CSLogoutRsp struct {
	Result int    `json:"result"`
	Uid    int64  `json:"uid"`
	Msg    string `json:"msg"`
}

type CSPingReq

type CSPingReq struct {
	TimeStamp int64 `json:"ts"`
}

type CSPingRsp

type CSPingRsp struct {
	TimeStamp int64 `json:"ts"`
}

type CSRegReq

type CSRegReq struct {
	Name     string `json:"name"`
	Pass     string `json:"pass"`
	RoleName string `json:"role_name"`
	Sex      uint8  `json:"sex"`
	Addr     string `json:"addr"`
}

type CSRegRsp

type CSRegRsp struct {
	Result int    `json:result`
	Name   string `json:"name"`
}

type GeneralMsg

type GeneralMsg struct {
	ProtoId int         `json:"proto"`
	SubMsg  interface{} `json:"sub"`
}

* GeneralMsg

type Item

type Item struct {
	ResId  int32 `json:"res_id"`
	Instid int64 `json:"instid"`
	Count  int32 `json:"count"`
	Attr   int64 `json:"attr"`
}

type ProtoHead

type ProtoHead struct {
	ProtoId int         `json:"proto"`
	Sub     interface{} `json:"-"`
}

type UserBasic

type UserBasic struct {
	Uid   int64  `json:"uid"`
	Name  string `json:"name"`
	Addr  string `json:"addr"`
	Sex   uint8  `json:"sex"` //1:male 2:female
	Level int32  `json:"level"`
}

type UserDepot

type UserDepot struct {
	ItemsCount int32           `json:"item_count"`
	Items      map[int64]*Item `json:"items"`
}

type UserDetail

type UserDetail struct {
	Exp   int32      `json:"exp"`
	Depot *UserDepot `json:"user_depot"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL