Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
7437087b27
@ -23,13 +23,13 @@ import (
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
///竞技场 数据组件
|
||||
// /竞技场 数据组件
|
||||
type modelArena struct {
|
||||
modules.MCompModel
|
||||
module *Arena
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
// 组件初始化接口
|
||||
func (this *modelArena) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
|
||||
this.TableName = comm.TableArena
|
||||
this.MCompModel.Init(service, module, comp, opt)
|
||||
@ -48,7 +48,7 @@ func (this *modelArena) Init(service core.IService, module core.IModule, comp co
|
||||
return
|
||||
}
|
||||
|
||||
//查询用户装备数据
|
||||
// 查询用户装备数据
|
||||
func (this *modelArena) queryPlayerInfo(uId string) (result *pb.DBArenaUser, err error) {
|
||||
result = &pb.DBArenaUser{}
|
||||
if err = this.Get(uId, result); err != nil && err != mgo.MongodbNil {
|
||||
@ -58,7 +58,7 @@ func (this *modelArena) queryPlayerInfo(uId string) (result *pb.DBArenaUser, err
|
||||
return
|
||||
}
|
||||
|
||||
//查询用户装备数据
|
||||
// 查询用户装备数据
|
||||
func (this *modelArena) queryPlayers(uIds []string) (result []*pb.DBArenaUser, err error) {
|
||||
result = make([]*pb.DBArenaUser, 0)
|
||||
if _, err = this.Gets(uIds, &result); err != nil && err != mgo.MongodbNil {
|
||||
@ -68,7 +68,7 @@ func (this *modelArena) queryPlayers(uIds []string) (result []*pb.DBArenaUser, e
|
||||
return
|
||||
}
|
||||
|
||||
//查询用户装备数据
|
||||
// 查询用户装备数据
|
||||
func (this *modelArena) queryArenaPlayer(uId string) (result *pb.ArenaPlayer, err error) {
|
||||
temp := &pb.DBArenaUser{}
|
||||
if err = this.Get(uId, temp); err != nil {
|
||||
@ -88,7 +88,7 @@ func (this *modelArena) queryArenaPlayer(uId string) (result *pb.ArenaPlayer, er
|
||||
return
|
||||
}
|
||||
|
||||
//查询用户英雄数据
|
||||
// 查询用户英雄数据
|
||||
func (this *modelArena) queryUserHeros(uid string, heroids []string) (results []*pb.DBHero, err error) {
|
||||
var (
|
||||
model *db.DBModel
|
||||
@ -105,7 +105,7 @@ func (this *modelArena) queryUserHeros(uid string, heroids []string) (results []
|
||||
return
|
||||
}
|
||||
|
||||
///保存用户竞技场信息
|
||||
// /保存用户竞技场信息
|
||||
func (this *modelArena) updateArenaUserInfo(info *pb.DBArenaUser) (err error) {
|
||||
var (
|
||||
dan int32
|
||||
@ -131,6 +131,8 @@ func (this *modelArena) updateArenaUserInfo(info *pb.DBArenaUser) (err error) {
|
||||
"defendtotaluum": info.Defendtotaluum,
|
||||
"loc": []float64{float64(dan), float64(rand.Int31n(100)) / 1000.0},
|
||||
"isdef": info.Isdef,
|
||||
"name": info.Name,
|
||||
"avatar": info.Avatar,
|
||||
"lv": info.Lv,
|
||||
})
|
||||
return
|
||||
@ -195,7 +197,7 @@ func (this *modelArena) computedan(integral int32) (dan int32, err error) {
|
||||
// return
|
||||
// }
|
||||
|
||||
//匹配机器人
|
||||
// 匹配机器人
|
||||
func (this *modelArena) matcheAI(dan, num int32) (results []*pb.ArenaPlayer, err error) {
|
||||
var (
|
||||
active *cfg.GameArenaActiveRewardData
|
||||
@ -276,7 +278,7 @@ func (this *modelArena) matcheAI(dan, num int32) (results []*pb.ArenaPlayer, err
|
||||
return
|
||||
}
|
||||
|
||||
//获取目标去陪数据
|
||||
// 获取目标去陪数据
|
||||
func (this *modelArena) matchePlayer(uid string, dan, num int32) (results []*pb.ArenaPlayer, err error) {
|
||||
var (
|
||||
cursor *mongo.Cursor
|
||||
@ -317,7 +319,7 @@ func (this *modelArena) matchePlayer(uid string, dan, num int32) (results []*pb.
|
||||
return
|
||||
}
|
||||
|
||||
//随机用户名
|
||||
// 随机用户名
|
||||
func (this *modelArena) randUserName() string {
|
||||
var s = []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*")
|
||||
r := rand.New(rand.NewSource(configure.Now().UnixNano() + rand.Int63n(10000)))
|
||||
@ -377,7 +379,7 @@ func (this *modelArena) getAI(mformatId int32) (ai *pb.ArenaPlayer, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
//积分计算
|
||||
// 积分计算
|
||||
func (this *modelArena) integralCompute(red, bule *pb.ArenaPlayer, iswin bool) {
|
||||
var (
|
||||
redactive *cfg.GameArenaActiveRewardData
|
||||
|
Loading…
Reference in New Issue
Block a user