Documentation ¶
Index ¶
- Constants
- type Reason
- type Role
- func (r *Role) AfterLogin(now int32)
- func (r *Role) DebugDepthf(depth int, format string, args ...interface{})
- func (r *Role) Debugf(format string, args ...interface{})
- func (r *Role) DiamondAdd(count int32, reason *Reason) int
- func (r *Role) DiamondCheckEnough(count int32) int
- func (r *Role) DiamondReduce(count int32, reason *Reason) int
- func (r *Role) Errorf(format string, args ...interface{})
- func (r *Role) ExpAdd(exp int32)
- func (r *Role) FrameAdd(id int32, reason *Reason) int
- func (r *Role) FrameChange(frameId int32) int
- func (r *Role) FrameGet(id int32, addIfExist bool) *g1_protocol.PbFrame
- func (r *Role) FrameHas(id int32) bool
- func (r *Role) FrameTouchRedPoint(id int32) int
- func (r *Role) FuncIsOpen(openFuncId int32) bool
- func (r *Role) GetBriefInfo() *g1_protocol.PbRoleBriefInfo
- func (r *Role) GetItemCount(itemId int32) int32
- func (r *Role) GetItemOutcomes(itemId int32) *[]*g1_protocol.PbItem
- func (r *Role) GoldAdd(count int32, reason *Reason) int
- func (r *Role) GoldCheckEnough(count int32) int
- func (r *Role) GoldReduce(count int32, reason *Reason) int
- func (r *Role) GuideCompleted(id int32) int
- func (r *Role) GuideInProgress(id int32) int
- func (r *Role) IconAdd(id int32, reason *Reason) int
- func (r *Role) IconChange(iconId int32) int
- func (r *Role) IconGet(id int32, addIfExist bool) *g1_protocol.PbIcon
- func (r *Role) IconGetIconDesc() *g1_protocol.PbIconDesc
- func (r *Role) IconHas(id int32) bool
- func (r *Role) IconTouchRedPoint(id int32) int
- func (r *Role) ImageChange(imageId int32) int
- func (r *Role) Infof(format string, args ...interface{})
- func (r *Role) IsOnline() bool
- func (r *Role) ItemAdd(itemId, itemCount int32, reason *Reason) int
- func (r *Role) ItemCheckAdd(itemId, itemCount int32) int
- func (r *Role) ItemCheckReduce(itemId, itemCount int32) (*[]*g1_protocol.PbItem, int)
- func (r *Role) ItemExchange(consumeID, consumeCnt, productId, productCnt int32, reason *Reason) int
- func (r *Role) ItemGetCountRef(itemId int32) *int32
- func (r *Role) ItemReduce(itemId, itemCount int32, reason *Reason) (*[]*g1_protocol.PbItem, int)
- func (r *Role) ItemRemove(itemId int32) int
- func (r *Role) ItemSee(item *g1_protocol.PbItem) *[]*g1_protocol.PbItem
- func (r *Role) ItemsAdd(items *[]*g1_protocol.PbItem, reason *Reason) int
- func (r *Role) ItemsCheckAdd(items *[]*g1_protocol.PbItem) int
- func (r *Role) ItemsCheckReduce(items *[]*g1_protocol.PbItem) (*[]*g1_protocol.PbItem, int)
- func (r *Role) ItemsReduce(items *[]*g1_protocol.PbItem, reason *Reason) (*[]*g1_protocol.PbItem, int)
- func (r *Role) ItemsSee(in *[]*g1_protocol.PbItem) *[]*g1_protocol.PbItem
- func (r *Role) LoginByTaskCheck()
- func (r *Role) MailAdd(c cmd_handler.IContext, mailType int32, confID int32, ...) int
- func (r *Role) MallAddBuyCount(confId int32)
- func (r *Role) MallCheckBuyCondition(confId int32) int
- func (r *Role) MallDailyRefresh()
- func (r *Role) MallGetItem(confId int32) *g1_protocol.PbMallItem
- func (r *Role) Now() int32
- func (r *Role) NowMs() int64
- func (r *Role) OnClientHeartbeat(now int32)
- func (r *Role) OnLogin(now int32)
- func (r *Role) OnRoleCreate()
- func (r *Role) RoleInitField(uid uint64)
- func (r *Role) SaveToDB(trans cmd_handler.IContext) error
- func (r *Role) SaveToDBIgnoreRsp()
- func (r *Role) SaveToMysql(trans cmd_handler.IContext) error
- func (r *Role) SinewAdd(count int32, reason *Reason) int
- func (r *Role) SinewCheckEnough(count int32) int
- func (r *Role) SinewReduce(count int32, reason *Reason) int
- func (r *Role) SyncDataToClient(dataFlag g1_protocol.ERoleSectionFlag) error
- func (r *Role) SyncOpenFuncData()
- func (r *Role) Uid() uint64
- func (r *Role) UpdateBriefInfo() error
- func (r *Role) Warningf(format string, args ...interface{})
- func (r *Role) Zone() int32
- type RoleMgr
Constants ¶
View Source
const ( REASON_INIT = 1 REASON_LOGIN = 1000 REASON_GM = 1001 REASON_CONSUME = 1002 REASON_MALL_BUY = 1003 REASON_INSTANCE = 1005 REASON_INSTANCE_FAIL = 1006 REASON_CHAPTOR_REWARD = 1007 REASON_RES_INSTANCE = 1008 REASON_INSTANCE_QUICK = 1009 REASON_RES_INSTANCE_QUICK = 1010 REASON_RENAME = 1011 REASON_MAIL_ATTACH = 1012 REASON_RECRUIT = 1013 REASON_HERO_UPGRADE_LEVEL = 1014 REASON_HERO_UPGRADE_STAR = 1015 REASON_HERO_UPGRADE_SKILL = 1016 REASON_OPVP = 1017 REASON_MEMOIR = 1018 REASON_BUY_MEMOIR_TIMES = 1019 REASON_EQUIP_LEVEL_UP = 1020 REASON_RES_INSTANCE_BUY_TIMES = 1021 REASON_COMPOSE = 1022 REASON_MACHINE_UNLOCK = 1023 REASON_MACHINE_LEVEL_UP = 1024 REASON_MACHINE_STAR_UP = 1025 REASON_MACHINE_REBORN = 1026 REASON_ARTIFACT_ADD_EXP = 1027 REASON_WORLD_BOSS_BUY_TIMES = 1028 REASON_BLACK_MARKET_BUY = 1029 REASON_BLACK_MARKET_REFRESH = 1030 REASON_MALL_PACKAGE = 1031 REASON_MALL_RECHARGE = 1032 )
数据变化原因枚举
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Role ¶
type Role struct { sync.Mutex // Role的锁交由外部来控制 PbRole *g1_protocol.RoleInfo // 下面可以添加临时内存数据,不会持久化到数据库 HeartBeatExpiryTime int32 HeartBeatCount int32 }
func (*Role) AfterLogin ¶
func (*Role) DebugDepthf ¶
func (*Role) DiamondCheckEnough ¶
func (*Role) FrameChange ¶
func (*Role) FrameTouchRedPoint ¶
func (*Role) FuncIsOpen ¶
func (*Role) GetBriefInfo ¶
func (r *Role) GetBriefInfo() *g1_protocol.PbRoleBriefInfo
玩家的简要信息,一般用于展示给其它玩家查看
func (*Role) GetItemOutcomes ¶
func (r *Role) GetItemOutcomes(itemId int32) *[]*g1_protocol.PbItem
TODO 道具使用后得到的新道具
func (*Role) GoldCheckEnough ¶
func (*Role) GuideCompleted ¶
func (*Role) GuideInProgress ¶
func (*Role) IconChange ¶
func (*Role) IconGetIconDesc ¶
func (r *Role) IconGetIconDesc() *g1_protocol.PbIconDesc
func (*Role) IconTouchRedPoint ¶
func (*Role) ImageChange ¶
func (*Role) ItemCheckAdd ¶
func (*Role) ItemCheckReduce ¶
func (r *Role) ItemCheckReduce(itemId, itemCount int32) (*[]*g1_protocol.PbItem, int)
返回道具消耗后获得的新道具,比如开宝箱消耗一个宝箱,获得宝箱内的道具
func (*Role) ItemExchange ¶
func (*Role) ItemReduce ¶
反回实际添加的东西
func (*Role) ItemSee ¶
func (r *Role) ItemSee(item *g1_protocol.PbItem) *[]*g1_protocol.PbItem
生成掉落(如果输入列表里面有drop类型的道具,则展开drop)
func (*Role) ItemsCheckAdd ¶
func (r *Role) ItemsCheckAdd(items *[]*g1_protocol.PbItem) int
func (*Role) ItemsCheckReduce ¶
func (r *Role) ItemsCheckReduce(items *[]*g1_protocol.PbItem) (*[]*g1_protocol.PbItem, int)
func (*Role) ItemsReduce ¶
func (r *Role) ItemsReduce(items *[]*g1_protocol.PbItem, reason *Reason) (*[]*g1_protocol.PbItem, int)
func (*Role) ItemsSee ¶
func (r *Role) ItemsSee(in *[]*g1_protocol.PbItem) *[]*g1_protocol.PbItem
生成掉落(如果输入列表里面有drop类型的道具,则展开drop)
func (*Role) LoginByTaskCheck ¶
func (r *Role) LoginByTaskCheck()
func (*Role) MailAdd ¶
func (r *Role) MailAdd(c cmd_handler.IContext, mailType int32, confID int32, attach *[]*g1_protocol.PbItem) int
添加邮件,这里一般是在trans中执行的,所以要加上cmd_handle参数
func (*Role) MallAddBuyCount ¶
func (*Role) MallCheckBuyCondition ¶
func (*Role) MallDailyRefresh ¶
func (r *Role) MallDailyRefresh()
func (*Role) MallGetItem ¶
func (r *Role) MallGetItem(confId int32) *g1_protocol.PbMallItem
func (*Role) OnClientHeartbeat ¶
客户端会每隔几秒发送一次心跳包到服务器 服务器根据时间来驱动玩家的周期性事件
func (*Role) OnRoleCreate ¶
func (r *Role) OnRoleCreate()
func (*Role) SaveToDBIgnoreRsp ¶
func (r *Role) SaveToDBIgnoreRsp()
保存玩家数据,不等待返回结果。只在特殊情况下使用。比如:RoleMgr::removeExpiredRoles中
func (*Role) SaveToMysql ¶
func (r *Role) SaveToMysql(trans cmd_handler.IContext) error
func (*Role) SinewCheckEnough ¶
func (*Role) SyncDataToClient ¶
func (r *Role) SyncDataToClient(dataFlag g1_protocol.ERoleSectionFlag) error
这里服务端主动同步数据到客户端 理论上每次玩家数据有变动,都要将相应的数据段同步过去 通过Flag控制同步有改变的数据段,减少数据的同步量
type RoleMgr ¶
type RoleMgr struct {
// contains filtered or unexported fields
}
func NewRoleMgr ¶
func NewRoleMgr() *RoleMgr
func (*RoleMgr) DeleteRole ¶
func (*RoleMgr) GetOrLoadOrCreateRole ¶
func (m *RoleMgr) GetOrLoadOrCreateRole(uid uint64, trans cmd_handler.IContext) *Role
func (*RoleMgr) GetOrLoadRole ¶
func (m *RoleMgr) GetOrLoadRole(uid uint64, trans cmd_handler.IContext) *Role
Click to show internal directories.
Click to hide internal directories.