types

package
v0.0.0-...-254d333 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2015 License: MIT Imports: 5 Imported by: 0

README

玩家数据/会话信息定义

Documentation

Index

Constants

View Source
const (
	UNKNOWN = byte(iota)
	OFF_FREE
	OFF_RAID
	OFF_PROT
	ON_FREE
	ON_PROT
)

------------------------------------------------ 状态机定义

View Source
const (
	SESS_LOGGED_IN  = 0x1
	SESS_KICKED_OUT = 0x2
	SESS_REGISTERED = 0x4
	SESS_KEYEXCG    = 0x8
	SESS_ENCRYPT    = 0x10
)
View Source
const (
	SYS_USR = 0
)

Variables

This section is empty.

Functions

func S

func S(a interface{}) string

------------------------------------------------ integer to string

Types

type IPCObject

type IPCObject struct {
	SrcID      int32   // 发送方用户ID
	DestID     int32   // 接收放用户ID
	AuxIDs     []int32 `bson:",omitempty"` // 目标用户ID集合(用于组播)
	Service    int16   // 服务号
	Object     []byte  // 投递的 JSON STRING
	Time       int64   // 发送时间
	MarkDelete bool    // 数据库标记删除
}

---------------------------------------------------------- IPCObject 定义

func (*IPCObject) Json

func (obj *IPCObject) Json() []byte

---------------------------------------------------------- 将整个IPCObject转为JSON

type Session

type Session struct {
	IP      net.IP
	MQ      chan IPCObject // Player's Internal Message Queue
	Encoder *pike.Pike
	Decoder *pike.Pike

	// TODO: all user data structure
	User *User

	// session related
	LoggedIn bool // flag for weather the user is logged in
	KickOut  bool // flag for player is kicked out

	// session flag
	Flag int32

	// time related variables
	ConnectTime    time.Time // tcp connection establish time, in millsecond(ms)
	PacketTime     time.Time // last packet time
	LastPacketTime time.Time // last packet arrive time, in seconds(s)

	// packet rate control
	PacketCount int64 // count packets
	// contains filtered or unexported fields
}

func (*Session) DirtyCount

func (sess *Session) DirtyCount() int32

func (*Session) MarkClean

func (sess *Session) MarkClean()

func (*Session) MarkDirty

func (sess *Session) MarkDirty()

type User

type User struct {
	Id             int32  // 用户id
	Domain         string // 玩家所在分服
	Name           string // 用户名
	Flag           int32  // 状态标记
	Pass           []byte // 密码(MD5 Hash)
	Score          int32  // 分数
	ProtectTimeout int64  // 护盾截止时间
	Mac            string // 玩家MAC地址
	CountryCode    string // 国家代码
	Language       string // 界面语言
	DeviceType     string // 设备类型
	LastSaveTime   int64  // 服务器最后一次刷入数据库的时间
	CreatedAt      int64  // 注册时间
}

type Words

type Words struct {
	Words   string
	Speaker string
}

---------------------------------------------------------- 单条聊天记录

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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