上传红点信息
This commit is contained in:
parent
32433c9c25
commit
09d202d65d
@ -535,7 +535,7 @@ const (
|
|||||||
//竞技场
|
//竞技场
|
||||||
Reddot22100 ReddotType = 22100 //当玩家竞技场可挑战次数到达最大时
|
Reddot22100 ReddotType = 22100 //当玩家竞技场可挑战次数到达最大时
|
||||||
Reddot22102 ReddotType = 22102 //当竞技场npc可以挑战时
|
Reddot22102 ReddotType = 22102 //当竞技场npc可以挑战时
|
||||||
Reddot22202 ReddotType = 22102 //今日剩余挑战券:x
|
Reddot22202 ReddotType = 22202 //今日剩余挑战券:x
|
||||||
|
|
||||||
Reddot6 ReddotType = 10006 //爬塔----可挑战红点
|
Reddot6 ReddotType = 10006 //爬塔----可挑战红点
|
||||||
Reddot7 ReddotType = 10007 //爬塔----奖励红点
|
Reddot7 ReddotType = 10007 //爬塔----奖励红点
|
||||||
|
@ -446,29 +446,34 @@ func (this *modelArena) recoverTicket(session comm.IUserSession, info *pb.DBAren
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *modelArena) reddot(session comm.IUserSession) bool {
|
func (this *modelArena) reddot(session comm.IUserSession) (info *pb.DBArenaUser, ticket int32, activated bool) {
|
||||||
var (
|
var (
|
||||||
info *pb.DBArenaUser
|
|
||||||
ticketitem *cfg.Gameatn
|
ticketitem *cfg.Gameatn
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
if info, err = this.queryPlayerInfo(session.GetUserId()); err != nil && err != mgo.MongodbNil {
|
if info, err = this.queryPlayerInfo(session.GetUserId()); err != nil && err != mgo.MongodbNil {
|
||||||
return false
|
activated = false
|
||||||
|
info = nil
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if err == mgo.MongodbNil {
|
if err == mgo.MongodbNil {
|
||||||
global := this.module.ModuleTools.GetGlobalConf()
|
global := this.module.ModuleTools.GetGlobalConf()
|
||||||
if global.ArenaTicketMax >= global.ArenaTicketCos.N {
|
if global.ArenaTicketMax >= global.ArenaTicketCos.N {
|
||||||
return true
|
ticket = global.ArenaTicketMax
|
||||||
|
activated = true
|
||||||
|
return
|
||||||
}
|
}
|
||||||
return false
|
activated = false
|
||||||
}
|
}
|
||||||
if ticketitem = this.module.ModuleTools.GetGlobalConf().ArenaTicketCos; ticketitem == nil {
|
if ticketitem = this.module.ModuleTools.GetGlobalConf().ArenaTicketCos; ticketitem == nil {
|
||||||
this.module.Error("竞技场配置未找到!", log.Field{Key: "key", Value: "ArenaTicketCos"})
|
this.module.Error("竞技场配置未找到!", log.Field{Key: "key", Value: "ArenaTicketCos"})
|
||||||
return false
|
activated = false
|
||||||
|
return
|
||||||
}
|
}
|
||||||
ticket := int32(this.module.ModuleItems.QueryItemAmount(info.Uid, ticketitem.T))
|
ticket = int32(this.module.ModuleItems.QueryItemAmount(info.Uid, ticketitem.T))
|
||||||
if ticket > this.module.ModuleTools.GetGlobalConf().ArenaTicketCos.N {
|
if ticket > this.module.ModuleTools.GetGlobalConf().ArenaTicketCos.N {
|
||||||
return true
|
activated = true
|
||||||
|
return
|
||||||
}
|
}
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
|
@ -39,12 +39,12 @@ type Arena struct {
|
|||||||
modelRank *modelRank
|
modelRank *modelRank
|
||||||
}
|
}
|
||||||
|
|
||||||
//模块名
|
// 模块名
|
||||||
func (this *Arena) GetType() core.M_Modules {
|
func (this *Arena) GetType() core.M_Modules {
|
||||||
return comm.ModuleArena
|
return comm.ModuleArena
|
||||||
}
|
}
|
||||||
|
|
||||||
//模块初始化接口 注册用户创建角色事件
|
// 模块初始化接口 注册用户创建角色事件
|
||||||
func (this *Arena) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
func (this *Arena) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||||
err = this.ModuleBase.Init(service, module, options)
|
err = this.ModuleBase.Init(service, module, options)
|
||||||
this.service = service.(base.IRPCXService)
|
this.service = service.(base.IRPCXService)
|
||||||
@ -70,7 +70,7 @@ func (this *Arena) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//装备组件
|
// 装备组件
|
||||||
func (this *Arena) OnInstallComp() {
|
func (this *Arena) OnInstallComp() {
|
||||||
this.ModuleBase.OnInstallComp()
|
this.ModuleBase.OnInstallComp()
|
||||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||||
@ -79,7 +79,7 @@ func (this *Arena) OnInstallComp() {
|
|||||||
this.modelRank = this.RegisterComp(new(modelRank)).(*modelRank)
|
this.modelRank = this.RegisterComp(new(modelRank)).(*modelRank)
|
||||||
}
|
}
|
||||||
|
|
||||||
//比赛结算
|
// 比赛结算
|
||||||
func (this *Arena) Rpc_ModuleArenaRaceSettlement(ctx context.Context, args *pb.EmptyReq, reply *pb.EmptyResp) (err error) {
|
func (this *Arena) Rpc_ModuleArenaRaceSettlement(ctx context.Context, args *pb.EmptyReq, reply *pb.EmptyResp) (err error) {
|
||||||
this.Debug("Rpc_ModuleArenaRaceSettlement",
|
this.Debug("Rpc_ModuleArenaRaceSettlement",
|
||||||
log.Field{Key: "args", Value: args.String()},
|
log.Field{Key: "args", Value: args.String()},
|
||||||
@ -88,23 +88,47 @@ func (this *Arena) Rpc_ModuleArenaRaceSettlement(ctx context.Context, args *pb.E
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改用户积分
|
// 修改用户积分
|
||||||
func (this *Arena) Rpc_ModuleArenaModifyIntegral(ctx context.Context, args *pb.RPCModifyIntegralReq, reply *pb.EmptyResp) (err error) {
|
func (this *Arena) Rpc_ModuleArenaModifyIntegral(ctx context.Context, args *pb.RPCModifyIntegralReq, reply *pb.EmptyResp) (err error) {
|
||||||
this.Debug("Rpc_ModuleArenaModifyIntegral", log.Field{Key: "args", Value: args.String()})
|
this.Debug("Rpc_ModuleArenaModifyIntegral", log.Field{Key: "args", Value: args.String()})
|
||||||
err = this.modelArena.modifyIntegral(args.Uid, args.Integral)
|
err = this.modelArena.modifyIntegral(args.Uid, args.Integral)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//红点需求
|
// 红点需求
|
||||||
func (this *Arena) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (result map[comm.ReddotType]*pb.ReddotItem) {
|
func (this *Arena) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (result map[comm.ReddotType]*pb.ReddotItem) {
|
||||||
|
var (
|
||||||
|
info *pb.DBArenaUser = &pb.DBArenaUser{}
|
||||||
|
activated bool
|
||||||
|
ticket int32
|
||||||
|
)
|
||||||
|
if info, ticket, activated = this.modelArena.reddot(session); info == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
result = make(map[comm.ReddotType]*pb.ReddotItem)
|
result = make(map[comm.ReddotType]*pb.ReddotItem)
|
||||||
for _, v := range rid {
|
for _, v := range rid {
|
||||||
switch v {
|
switch v {
|
||||||
|
case comm.Reddot22100:
|
||||||
|
result[comm.Reddot22102] = &pb.ReddotItem{
|
||||||
|
Rid: int32(comm.Reddot22102),
|
||||||
|
}
|
||||||
|
if ticket == this.ModuleTools.GetGlobalConf().ArenaTicketCos.N {
|
||||||
|
result[comm.Reddot22102].Activated = true
|
||||||
|
}
|
||||||
|
break
|
||||||
case comm.Reddot22102:
|
case comm.Reddot22102:
|
||||||
result[comm.Reddot22102] = &pb.ReddotItem{
|
result[comm.Reddot22102] = &pb.ReddotItem{
|
||||||
Rid: int32(comm.Reddot22102),
|
Rid: int32(comm.Reddot22102),
|
||||||
}
|
}
|
||||||
result[comm.Reddot22102].Activated = this.modelArena.reddot(session)
|
result[comm.Reddot22102].Activated = activated
|
||||||
|
break
|
||||||
|
|
||||||
|
case comm.Reddot22202:
|
||||||
|
result[comm.Reddot22102] = &pb.ReddotItem{
|
||||||
|
Rid: int32(comm.Reddot22102),
|
||||||
|
Activated: true,
|
||||||
|
Progress: ticket,
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,7 +152,7 @@ func (this *Arena) SetUserIntegral(session comm.IUserSession, Integral int32) (e
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
///获取竞技场匹配目标战斗阵型数据
|
// /获取竞技场匹配目标战斗阵型数据
|
||||||
func (this *Arena) GetMatcheBattleRoles(uid string) (captain int32, rules []*pb.BattleRole, err error) {
|
func (this *Arena) GetMatcheBattleRoles(uid string) (captain int32, rules []*pb.BattleRole, err error) {
|
||||||
var (
|
var (
|
||||||
global *cfg.GameGlobalData
|
global *cfg.GameGlobalData
|
||||||
|
Loading…
Reference in New Issue
Block a user