app

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

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 含义

View Source
const (
	C_max_gateid = 100000
)

Variables

View Source
var (
	C_op_register_gate = (&PB.GW_RegisterGate{}).MsgId()
	C_op_test          = (&PB.C_Test{}).MsgId()
)
View Source
var (
	GSReport = &gs_report_t{}
)
View Source
var NetMgr = &netmgr_t{
	gates:    make(map[int32]*SocketGW),
	connectq: tcp.NewConnectQ(),
	cnn_rt:   make(map[int32]*SocketRt),
}
View Source
var PlayerMgr = &plrmgr_t{
	plrs_by_id:   make(map[string]*Player),
	plrs_by_name: make(map[string]*Player),
	plrs_online:  make(map[uint64]*Player),
}
View Source
var Ranks = &ranks{
	Rank:         make(map[string]*A_rank),
	next_sort_ts: time.Unix(0, 0),
}

Functions

func AddAttributeTeam

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

计算额外的加成属性

func AddAttributeType

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

func AddPropMods

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

func AddProps

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

func GetMyRank

func GetMyRank(req *PB.GS_GetRank) (res *PB.GS_GetRank_R)

func GetNextRankSortTs

func GetNextRankSortTs() int64

func GetRankType

func GetRankType(RankType PB.RankType) string

func InitRank

func InitRank()

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

func ModBase

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

func ModBasePct

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

func ModExt

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

func NewPropMods

func NewPropMods() *PB.PropMods

func RankAdd

func RankAdd()

func RankOpen

func RankOpen()

func RankReset

func RankReset()

func RankSave

func RankSave(req *PB.GS_SetRank)

存盘

func RankSort

func RankSort()

func SubPropMods

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

Types

type A_rank

type A_rank struct {
	Map     map[string]*Rank_rec
	Records []*Rank_rec //排行榜列表
}

func (A_rank) GenSaveData

func (self A_rank) GenSaveData(num int) interface{}

生成排名存盘数据

func (*A_rank) GetRank

func (self *A_rank) GetRank(uid string) (rank, score int32)

获取排名

func (A_rank) GetRankData

func (self A_rank) GetRankData(num int) *OneRank

func (*A_rank) GetUid

func (self *A_rank) GetUid(rank int) string

获取Id

type ClassProp

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

func NewClassProp

func NewClassProp() *ClassProp

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

type OneRank

type OneRank struct {
	Records []*Rank_rec
}

type Player

type Player struct {
	// contains filtered or unexported fields
}

func (*Player) AccOnlineDur

func (self *Player) AccOnlineDur()

func (*Player) AddExp

func (self *Player) AddExp(v int64) bool

func (*Player) AddGiftCodeLog

func (self *Player) AddGiftCodeLog(s string)

func (*Player) BindGuild

func (self *Player) BindGuild(gldid string)

func (*Player) BuyCount

func (self *Player) BuyCount(counter_id int32, num int32) int32

func (*Player) CalcHeroesProps

func (self *Player) CalcHeroesProps(sendUpdate bool)

计算全体属性变化

func (*Player) CalcProp

func (self *Player) CalcProp(Calc bool) *PB.ClassAttributeType

func (*Player) CalcTeamProps

func (self *Player) CalcTeamProps(sendUpdate bool)

计算上阵属性变化

func (*Player) ChangeName

func (self *Player) ChangeName(name string, f func(bool))

func (*Player) CheckGmailDeliverCond

func (self *Player) CheckGmailDeliverCond(cond string) bool

func (*Player) CreateBattlePlayer

func (self *Player) CreateBattlePlayer() *PB.BattlePlayer

func (*Player) CreateMainHero

func (self *Player) CreateMainHero(id int32) *hero.MainHero

func (*Player) DB

func (self *Player) DB() *db.Database

func (*Player) Drop

func (self *Player) Drop(args ...interface{}) (ret []int32)

func (*Player) GetAct

func (self *Player) GetAct() *act.Act

func (*Player) GetActPersonalStage

func (self *Player) GetActPersonalStage(actid int32) int32

func (*Player) GetActRawData

func (self *Player) GetActRawData(actid int32) interface{}

func (*Player) GetAtkPower

func (self *Player) GetAtkPower() int32

func (*Player) GetBag

func (self *Player) GetBag() *comp.Bag

func (*Player) GetBill

func (self *Player) GetBill() *bill.Bill

func (*Player) GetBillSumDiam

func (self *Player) GetBillSumDiam() int32

总充值等值钻石数量

func (*Player) GetClientData

func (self *Player) GetClientData() *PB.GS_UserInfo

func (*Player) GetCloud

func (self *Player) GetCloud() *cloud.Cloud

func (*Player) GetCounter

func (self *Player) GetCounter() *counter.Counter

func (*Player) GetCreateTs

func (self *Player) GetCreateTs() time.Time

func (*Player) GetDevId

func (self *Player) GetDevId() string

func (*Player) GetExp

func (self *Player) GetExp() int64

func (*Player) GetFashions

func (self *Player) GetFashions() *hero.FashionMap

func (*Player) GetFields

func (self *Player) GetFields() *comp.Fields

func (*Player) GetFigure

func (self *Player) GetFigure() int32

func (*Player) GetFigureStore

func (self *Player) GetFigureStore() *comp.FigureStore

func (*Player) GetGiftCode

func (self *Player) GetGiftCode() []string

func (*Player) GetGuild

func (self *Player) GetGuild() *guild.Guild

func (*Player) GetGuildBuildingLv

func (self *Player) GetGuildBuildingLv(id int32) int32

func (*Player) GetGuildId

func (self *Player) GetGuildId() string

func (*Player) GetGuildName

func (self *Player) GetGuildName() string

func (*Player) GetGuildRank

func (self *Player) GetGuildRank() int32

func (*Player) GetHFrame

func (self *Player) GetHFrame() int32

func (*Player) GetHFrameStore

func (self *Player) GetHFrameStore() *comp.HFrameStore

func (*Player) GetHead

func (self *Player) GetHead() int32

func (*Player) GetHeadStore

func (self *Player) GetHeadStore() *comp.HeadStore

func (*Player) GetHeroes

func (self *Player) GetHeroes() *hero.Heroes

func (*Player) GetId

func (self *Player) GetId() string

func (*Player) GetLevel

func (self *Player) GetLevel() int32

func (*Player) GetMailBox

func (self *Player) GetMailBox() *mail.MailBox

func (*Player) GetMainHero

func (self *Player) GetMainHero() *hero.MainHero

func (*Player) GetMisc

func (self *Player) GetMisc() *misc.Misc

func (*Player) GetName

func (self *Player) GetName() string

func (*Player) GetOfflineTs

func (self *Player) GetOfflineTs() time.Time

func (*Player) GetOnlineDur

func (self *Player) GetOnlineDur() int32

func (*Player) GetPlat

func (self *Player) GetPlat() string

func (*Player) GetSdk

func (self *Player) GetSdk() string

func (*Player) GetShop

func (self *Player) GetShop() *shop.Shop

func (*Player) GetShopBuyCnt

func (self *Player) GetShopBuyCnt(shopid, itemid int32) int32

func (*Player) GetSvr

func (self *Player) GetSvr() string

func (*Player) GetSvrId

func (self *Player) GetSvrId() int32

func (*Player) GetTask

func (self *Player) GetTask(tasktype int32, args ...interface{}) (ret *PB.Unit)

func (*Player) GetTeam

func (self *Player) GetTeam() map[int32]int32

func (*Player) GetTutorial

func (self *Player) GetTutorial() *tutorial.Tutorial

func (*Player) GetUser

func (self *Player) GetUser() *User

func (*Player) GetVip

func (self *Player) GetVip() *vip.Vip

============================================================================ vip

func (*Player) GetVipLevel

func (self *Player) GetVipLevel() int32

func (*Player) GetWorld

func (self *Player) GetWorld() *world.World

func (*Player) HeartBeat

func (self *Player) HeartBeat()

func (*Player) InGuild

func (self *Player) InGuild() bool

func (*Player) IsCardValid

func (self *Player) IsCardValid(typeid int32) bool

func (*Player) IsOnline

func (self *Player) IsOnline() bool

func (*Player) Logout

func (self *Player) Logout()

func (*Player) OnLevelup

func (self *Player) OnLevelup(new_lv int32)

func (*Player) OnOffline

func (self *Player) OnOffline()

func (*Player) OnOnline

func (self *Player) OnOnline()

func (*Player) Reconnect

func (self *Player) Reconnect(sessionKey uint64)

func (*Player) Reset_Daily

func (self *Player) Reset_Daily()

func (*Player) Reset_GetTime

func (self *Player) Reset_GetTime() time.Time

func (*Player) Reset_SetTime

func (self *Player) Reset_SetTime(ts time.Time)

func (*Player) SendMail

func (self *Player) SendMail(mid int32, attachment []*comp.Object, dict map[string]string)

func (*Player) SendMsg

func (self *Player) SendMsg(message PB.Message)

func (*Player) SendMsgWithoutQueue

func (self *Player) SendMsgWithoutQueue(message PB.Message)

func (*Player) SetActPersonalStage

func (self *Player) SetActPersonalStage(actid int32, v int32)

func (*Player) User

func (self *Player) User() *User

type PropMap

type PropMap map[int32]float32

func UpdatePropMap

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

type Rank_rec

type Rank_rec struct {
	Uid          string           `bson:"_id"`   // uid
	Score        int32            `bson:"Score"` // 排行值
	BattlePlayer *PB.BattlePlayer `bson:"BattlePlayer"`
}

type SocketGW

type SocketGW struct {
	// contains filtered or unexported fields
}

func (*SocketGW) Close

func (self *SocketGW) Close()

func (*SocketGW) Dispatch

func (self *SocketGW) Dispatch(p packet.Packet)

func (*SocketGW) SendMsg

func (self *SocketGW) SendMsg(message PB.Message)

func (*SocketGW) SendPacket

func (self *SocketGW) SendPacket(p packet.Packet)

type SocketRt

type SocketRt struct {
	Id int32
	// contains filtered or unexported fields
}

func (*SocketRt) Close

func (self *SocketRt) Close()

func (*SocketRt) Dispatch

func (self *SocketRt) Dispatch(p packet.Packet)

func (*SocketRt) Open

func (self *SocketRt) Open()

func (*SocketRt) SendMsg

func (self *SocketRt) SendMsg(message PB.Message)

func (*SocketRt) SendPacket

func (self *SocketRt) SendPacket(p packet.Packet)

type User

type User struct {
	Id       string    `bson:"-"`         // Id
	AuthId   string    `bson:"authid"`    // 认证 Id
	Svr0     string    `bson:"svr0"`      // 原始服名称
	Svr      string    `bson:"svr"`       // 当前服名称
	Sdk      string    `bson:"sdk"`       // sdk
	Plat     string    `bson:"plat"`      // 登录平台
	DevId    string    `bson:"devid"`     // 上次登录设备码
	CreateTs time.Time `bson:"create_ts"` // 创建时间
	LoginTs  time.Time `bson:"login_ts"`  // 上次登录时间
	LoginIP  string    `bson:"login_ip"`  // 上次登录 IP

	LoginCtDays int32     `bson:"login_ctdays"` // 最近连续登录天数
	OnlineDur   int32     `bson:"online_dur"`   // 累计在线时长 (秒)
	Offline_ts  time.Time `bson:"off_ts"`       // 上次离线时间
	Rst_ts      time.Time `bson:"rst_ts"`       // 上次重置时间

	Name        string            `bson:"name"`         // 名字
	Head        int32             `bson:"head"`         // 头像
	HFrame      int32             `bson:"hframe"`       // 相框
	Figure      int32             `bson:"figure"`       // 当前形象
	HeadStore   *comp.HeadStore   `bson:"head_store"`   // 头像库
	HFrameStore *comp.HFrameStore `bson:"hframe_store"` // 头像框库
	FigureStore *comp.FigureStore `bson:"figure_store"` // 形象库
	Lv          int32             `bson:"lv"`           // 等级
	Exp         int64             `bson:"exp"`          // 经验
	Vip         *vip.Vip          `bson:"vip"`          // vip等级
	Bag         *comp.Bag         `bson:"bag"`          // 背包

	MainHero *hero.MainHero   `bson:"main_hero"` //主角
	Heroes   *hero.Heroes     //获得的武将
	TeamMap  map[int32]int32  //布阵map<pos,heroId>
	Fashions *hero.FashionMap // 时装
	World    *world.World

	Fields   *comp.Fields       `bson:"flds"`     // 域
	Bill     *bill.Bill         `bson:"bill"`     // 充值
	MailBox  *mail.MailBox      `bson:"mailbox"`  // 邮箱
	Tutorial *tutorial.Tutorial `bson:"tutorial"` // 新手
	Cloud    *cloud.Cloud       `bson:"cloud"`    // 云数据
	Misc     *misc.Misc         `bson:"misc"`     // 杂项数据
	Act      *act.Act           `bson:"act"`      // 活动
	Counter  *counter.Counter   `bson:"cnt"`      // 计数恢复
	Shop     *shop.Shop         `bson:"shop"`     // 商店

	GuildId string       `bson:"guildid"` // 公会 Id
	Guild   *guild.Guild `bson:"-"`       // 公会

	GiftCode []string `bson:"gift_code"` // 已领取的礼包码

	ChatTs     time.Time `bson:"-"` // 玩家聊天时间
	ClientData *PB.GS_UserInfo
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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