上传红点信息

This commit is contained in:
liwei 2023-08-01 13:40:00 +08:00
parent 32433c9c25
commit 09d202d65d
3 changed files with 47 additions and 18 deletions

View File

@ -535,7 +535,7 @@ const (
//竞技场
Reddot22100 ReddotType = 22100 //当玩家竞技场可挑战次数到达最大时
Reddot22102 ReddotType = 22102 //当竞技场npc可以挑战时
Reddot22202 ReddotType = 22102 //今日剩余挑战券x
Reddot22202 ReddotType = 22202 //今日剩余挑战券x
Reddot6 ReddotType = 10006 //爬塔----可挑战红点
Reddot7 ReddotType = 10007 //爬塔----奖励红点

View File

@ -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 (
info *pb.DBArenaUser
ticketitem *cfg.Gameatn
err error
)
if info, err = this.queryPlayerInfo(session.GetUserId()); err != nil && err != mgo.MongodbNil {
return false
activated = false
info = nil
return
}
if err == mgo.MongodbNil {
global := this.module.ModuleTools.GetGlobalConf()
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 {
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 {
return true
activated = true
return
}
return false
return
}

View File

@ -97,14 +97,38 @@ func (this *Arena) Rpc_ModuleArenaModifyIntegral(ctx context.Context, args *pb.R
// 红点需求
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)
for _, v := range rid {
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:
result[comm.Reddot22102] = &pb.ReddotItem{
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
}
}