Documentation

Index

Constants

View Source
const (
	// center
	C_tabname_userinfo = "userinfo"
	C_tabname_svrlist  = "svrlist"
	C_tabname_userload = "userload"
	C_tabname_seqid    = "seqid"
	C_tabname_names    = "names"
	C_tabname_giftinfo = "giftinfo"
	C_tabname_giftuse  = "giftuse"

	// stats
	C_tabname_login  = "login"
	C_tabname_bill   = "bill"
	C_tabname_online = "online"

	// cross
	C_tabname_gsinfo = "gsinfo"
	C_tabname_rank   = "rank"

	// user
	C_tabname_user  = "user"
	C_tabname_guild = "guild"

	// game
	C_tabname_worlddata    = "worlddata"
	C_tabname_battleRecord = "battleRecord"
	C_tabname_gmail        = "gmail"
	C_tabname_act          = "act"
	C_tabname_replay       = "replay"
	C_tabname_tower        = "tower"
	C_tabname_worldrecord  = "worldrecord"
	C_tabname_chat         = "chat"
	C_tabname_arena        = "arena"
	C_tabname_escort       = "escort"
	C_tabname_auction      = "auction"
	C_tabname_actrank      = "actrank"

	// log
	C_tabname_log = "log"
)
View Source
const (
	C_prop_min_pct_id       = 1000
	C_prop_min_aggregate_id = 3000
	C_prop_pct_plus_id      = 1000
)

属性Id 规则

* 固定点属性:     fixed = value                    [1,     99]
* 百分比加成属性: pct   = fixed + 1000              [1001,   1099]
* 聚集加成属性:   agr   = fixed(pct) + 3000 + count*100    [3001, 4999]
View Source
const (
	PROP_PAtk         = 10 // 物理攻击
	PROP_MAtk         = 11 // 魔法攻击
	PROP_MDef         = 13 // 魔法防御
	PROP_PDef         = 14 // 物理防御
	PROP_Hp           = 16 // 生命
	PROP_Magic        = 17 // 魔法值
	PROP_MSpeed       = 19 // 移动速度
	PROP_DefDuce      = 33 // 无视防御
	PROP_Hit          = 34 // 命中值
	PROP_Dodge        = 35 // 闪避值
	PROP_Crit         = 36 // 暴击值
	PROP_CritRes      = 37 // 抗暴值
	PROP_CritDmg      = 38 // 暴伤值
	PROP_CritDmgRes   = 39 // 暴伤抵抗值
	PROP_DmgUp        = 40 // 增伤值
	PROP_DmgDown      = 41 // 伤害减免
	PROP_DmgBack      = 42 // 伤害反弹
	PROP_Blood        = 43 // 吸血值
	PROP_DmgExt       = 44 // 额外伤害
	PROP_DmgPct       = 45 // 最终伤害百分比加成
	PROP_SkillPct     = 46 // 技能伤害百分比加成
	PROP_SKillDmgDuce = 47 // 技能承伤减少
	PROP_ExpAdd       = 83 // 经验增加
	PROP_CoinAdd      = 84 // 金币增加

	PROP_AtkPct = 4210  // 攻击百分比
	PROP_HpPct  = 1016  // 生命百分比
	PROP_DefPct = 4213  // 防御百分比
	PROP_CurHp  = 10002 // 当前血量
)

固定属性 Id 含义

Variables

View Source
var (
	DBGame *db.MyMongo
)

============================================================================

View Source
var NetMgr = &netmgr_t{}
View Source
var PlayerMgr = &plrmgr_t{
	plrs_by_id:   make(map[uint64]*Player),
	plrs_by_name: make(map[string]*Player),
	plrs_online:  make(map[uint64]*Player),
}

Functions

func AddAttributeTeam

func AddAttributeTeam(self PropMap, AttributeTeam []*MPB.AttributeType)

计算额外的加成属性

func AddAttributeType

func AddAttributeType(self *MPB.ClassAttributeType, new *MPB.ClassAttributeType)

func AddPropMods

func AddPropMods(self *MPB.PropMods, m *MPB.PropMods)

func AddProps

func AddProps(self *MPB.ClassAttributeType, Type, id int32, num float32)

func DatabaseOpen

func DatabaseOpen()

============================================================================

func ModBase

func ModBase(self *MPB.PropMods, id int32, v float32)

func ModBasePct

func ModBasePct(self *MPB.PropMods, id int32, v float32)

func ModExt

func ModExt(self *MPB.PropMods, id int32, v float32)

func NewPropMods

func NewPropMods() *MPB.PropMods

func SubPropMods

func SubPropMods(self *MPB.PropMods, m *MPB.PropMods)

Types

type ClassProp

type ClassProp struct {
	Prop_mods   *MPB.PropMods           //统计个人属性
	Props2other *MPB.ClassAttributeType `bson:"-"` //自己加其他人的范围属性
	Props2map   *MPB.PropMods           //加自己的范围属性
	Prop_map    PropMap                 //最后属性
}

func NewClassProp

func NewClassProp() *ClassProp

============================================================================

type Handlers

type Handlers struct{}

func (*Handlers) Client2Game

func (e *Handlers) Client2Game(ctx context.Context, in *MPB.Bytes, out *MPB.Bytes) error

func (*Handlers) Login

func (e *Handlers) Login(ctx context.Context, in *MPB.GW_UserOnline, out *MPB.GS_UserInfo) error

func (*Handlers) LogoutPlayer

func (e *Handlers) LogoutPlayer(ctx context.Context, in *MPB.GW_LogoutPlayer, out *MPB.Response) error

func (*Handlers) PlayerUpdate_AtkPower

func (e *Handlers) PlayerUpdate_AtkPower(ctx context.Context, in *MPB.GS_PlayerUpdate_AtkPower, out *MPB.Response) error

func (*Handlers) UserReconnect

func (e *Handlers) UserReconnect(ctx context.Context, in *MPB.GW_UserReconnect, out *MPB.Response) error

type Player

type Player struct {
	*MPB.GS_UserInfo
	AuthId      string // 认证 Id
	Svr0        string // 原始服名称
	Svr         string // 当前服名称
	Sdk         string // sdk
	Plat        string // 登录平台
	DevId       string // 上次登录设备码
	CreateTs    int64  // 创建时间
	LoginTs     int64  // 上次登录时间
	LoginCtDays int32  // 最近连续登录天数
	OnlineDur   int32  // 累计在线时长 (秒)
	Offline_ts  int64  // 上次离线时间
	Rst_ts      int64  // 上次重置时间
	// contains filtered or unexported fields
}

type PropMap

type PropMap map[int32]float32

func UpdatePropMap

func UpdatePropMap(self PropMap, mods *MPB.PropMods) (updated PropMap)