裂魂战报数据记录
This commit is contained in:
parent
a411cdb3e7
commit
b7ac0d3c49
@ -5,6 +5,7 @@ import (
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 参数校验
|
||||
@ -35,6 +36,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
||||
consumPs int32
|
||||
changExp map[string]int32
|
||||
szAtno []*pb.UserAtno // atno 类型
|
||||
bNewRecord bool // 新纪录
|
||||
)
|
||||
changExp = map[string]int32{}
|
||||
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 {
|
||||
hunting.BossTime[key] = req.Report.Costtime
|
||||
mapData["bossTime"] = hunting.BossTime // 更新时间
|
||||
|
||||
bNewRecord = true
|
||||
}
|
||||
// 发放通关随机奖励
|
||||
user, err := this.module.GetUserForSession(session)
|
||||
@ -186,27 +188,32 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
||||
Sell: del,
|
||||
Heroexp: changExp,
|
||||
})
|
||||
szLine := make([]*pb.LineUp, 0)
|
||||
var Leadpos int32
|
||||
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
|
||||
Leadpos = req.Report.Info.Redflist[0].Leadpos
|
||||
for _, v := range req.Report.Info.Redflist[0].Team {
|
||||
if v != nil {
|
||||
szLine = append(szLine, &pb.LineUp{
|
||||
Cid: v.HeroID,
|
||||
Star: v.Star,
|
||||
Lv: v.Lv,
|
||||
})
|
||||
|
||||
if bNewRecord { // 只有新记录才记录战报数据
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
szLine := make([]*pb.LineUp, 0)
|
||||
var Leadpos int32
|
||||
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
|
||||
Leadpos = req.Report.Info.Redflist[0].Leadpos
|
||||
for _, v := range req.Report.Info.Redflist[0].Team {
|
||||
if v != nil {
|
||||
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.Rtype81, req.Difficulty, req.BossType))
|
||||
|
@ -15,6 +15,7 @@ type Hunting struct {
|
||||
modulerank *ModelRank
|
||||
battle comm.IBattle
|
||||
service core.IService
|
||||
battlerecord comm.IBattleRecord // 战报模块
|
||||
}
|
||||
|
||||
func NewModule() core.IModule {
|
||||
@ -43,6 +44,10 @@ func (this *Hunting) Start() (err error) {
|
||||
}
|
||||
|
||||
this.battle = module.(comm.IBattle)
|
||||
if module, err = this.service.GetModule(comm.ModuleBattleRecord); err != nil {
|
||||
return
|
||||
}
|
||||
this.battlerecord = module.(comm.IBattleRecord)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
||||
total += v
|
||||
}
|
||||
|
||||
go func() {
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
szLine := make([]*pb.LineUp, 0)
|
||||
var Leadpos int32
|
||||
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
|
||||
}
|
||||
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)
|
||||
}
|
||||
// 连续自动战斗
|
||||
if len(viking.Round) == 10 {
|
||||
this.module.modelsrank.CheckSeasonRank(session.GetUserId(), req.BossId, req.Difficulty, line, total)
|
||||
}
|
||||
}()
|
||||
})
|
||||
reward = this.module.ModuleTools.GetGroupDataByLottery(vikingCfg.Drop, user.Vip, user.Lv)
|
||||
|
||||
b := this.module.ModuleActivity.HDCelebration(session, 2, req.BossId)
|
||||
|
Loading…
Reference in New Issue
Block a user