裂魂战报数据记录

This commit is contained in:
meixiongfeng 2024-02-20 15:59:12 +08:00
parent a411cdb3e7
commit b7ac0d3c49
3 changed files with 35 additions and 23 deletions

View File

@ -5,6 +5,7 @@ import (
"go_dreamfactory/pb" "go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
"strconv" "strconv"
"time"
) )
// 参数校验 // 参数校验
@ -35,6 +36,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
consumPs int32 consumPs int32
changExp map[string]int32 changExp map[string]int32
szAtno []*pb.UserAtno // atno 类型 szAtno []*pb.UserAtno // atno 类型
bNewRecord bool // 新纪录
) )
changExp = map[string]int32{} changExp = map[string]int32{}
mapData = make(map[string]interface{}, 0) mapData = make(map[string]interface{}, 0)
@ -114,7 +116,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
if hunting.BossTime[key] == 0 || hunting.BossTime[key] > req.Report.Costtime { if hunting.BossTime[key] == 0 || hunting.BossTime[key] > req.Report.Costtime {
hunting.BossTime[key] = req.Report.Costtime hunting.BossTime[key] = req.Report.Costtime
mapData["bossTime"] = hunting.BossTime // 更新时间 mapData["bossTime"] = hunting.BossTime // 更新时间
bNewRecord = true
} }
// 发放通关随机奖励 // 发放通关随机奖励
user, err := this.module.GetUserForSession(session) user, err := this.module.GetUserForSession(session)
@ -186,27 +188,32 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
Sell: del, Sell: del,
Heroexp: changExp, Heroexp: changExp,
}) })
szLine := make([]*pb.LineUp, 0)
var Leadpos int32 if bNewRecord { // 只有新记录才记录战报数据
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
Leadpos = req.Report.Info.Redflist[0].Leadpos szLine := make([]*pb.LineUp, 0)
for _, v := range req.Report.Info.Redflist[0].Team { var Leadpos int32
if v != nil { if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
szLine = append(szLine, &pb.LineUp{ Leadpos = req.Report.Info.Redflist[0].Leadpos
Cid: v.HeroID, for _, v := range req.Report.Info.Redflist[0].Team {
Star: v.Star, if v != nil {
Lv: v.Lv, szLine = append(szLine, &pb.LineUp{
}) Cid: v.HeroID,
Star: v.Star,
Lv: v.Lv,
})
}
}
} }
} line := &pb.LineData{
Leadpos: Leadpos,
Line: szLine,
Bid: req.Report.Info.Id, // 战报id
}
this.module.battlerecord.WrietBattleRecord(session.GetUserId(), req.Report, time.Now().Add(time.Hour*24*8))
this.module.modulerank.CheckRank(session.GetUserId(), req.BossType, req.Difficulty, line, req.Report.Costtime)
})
} }
go func() {
line := &pb.LineData{
Leadpos: Leadpos,
Line: szLine,
}
this.module.modulerank.CheckRank(session.GetUserId(), req.BossType, req.Difficulty, line, req.Report.Costtime)
}()
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype80, 1, req.BossType, req.Difficulty)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype80, 1, req.BossType, req.Difficulty))
// 随机任务统计 // 随机任务统计
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype81, req.Difficulty, req.BossType)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype81, req.Difficulty, req.BossType))

View File

@ -15,6 +15,7 @@ type Hunting struct {
modulerank *ModelRank modulerank *ModelRank
battle comm.IBattle battle comm.IBattle
service core.IService service core.IService
battlerecord comm.IBattleRecord // 战报模块
} }
func NewModule() core.IModule { func NewModule() core.IModule {
@ -43,6 +44,10 @@ func (this *Hunting) Start() (err error) {
} }
this.battle = module.(comm.IBattle) this.battle = module.(comm.IBattle)
if module, err = this.service.GetModule(comm.ModuleBattleRecord); err != nil {
return
}
this.battlerecord = module.(comm.IBattleRecord)
return return
} }

View File

@ -134,7 +134,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
total += v total += v
} }
go func() { go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
szLine := make([]*pb.LineUp, 0) szLine := make([]*pb.LineUp, 0)
var Leadpos int32 var Leadpos int32
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
@ -155,14 +155,14 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
Bid: req.Report.Info.Id, // 战报id Bid: req.Report.Info.Id, // 战报id
} }
if bNewRecord { if bNewRecord {
go this.module.battlerecord.WrietBattleRecord(session.GetUserId(), req.Report, time.Now().Add(time.Hour*24*8)) this.module.battlerecord.WrietBattleRecord(session.GetUserId(), req.Report, time.Now().Add(time.Hour*24*8))
this.module.modulerank.CheckRank(session.GetUserId(), req.BossId, req.Difficulty, line, req.Report.Costtime) this.module.modulerank.CheckRank(session.GetUserId(), req.BossId, req.Difficulty, line, req.Report.Costtime)
} }
// 连续自动战斗 // 连续自动战斗
if len(viking.Round) == 10 { if len(viking.Round) == 10 {
this.module.modelsrank.CheckSeasonRank(session.GetUserId(), req.BossId, req.Difficulty, line, total) this.module.modelsrank.CheckSeasonRank(session.GetUserId(), req.BossId, req.Difficulty, line, total)
} }
}() })
reward = this.module.ModuleTools.GetGroupDataByLottery(vikingCfg.Drop, user.Vip, user.Lv) reward = this.module.ModuleTools.GetGroupDataByLottery(vikingCfg.Drop, user.Vip, user.Lv)
b := this.module.ModuleActivity.HDCelebration(session, 2, req.BossId) b := this.module.ModuleActivity.HDCelebration(session, 2, req.BossId)