Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
f1809f37fe
@ -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
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 参数校验
|
||||
@ -131,12 +132,15 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
||||
record.Data[conf.Key].Line = &pb.LineData{
|
||||
Leadpos: Leadpos,
|
||||
Line: szLine,
|
||||
Bid: req.Report.Info.Id, // 记录战报数据
|
||||
}
|
||||
mapData["data"] = record.Data
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
mapData["uinfo"] = comm.GetUserBaseInfo(user)
|
||||
}
|
||||
|
||||
go this.module.battlerecord.WrietBattleRecord(session.GetUserId(), req.Report, time.Now().Add(time.Hour*24*8))
|
||||
|
||||
this.module.modulerank.ModifyCrossPagodaCycleData(session.GetUserId(), mapData)
|
||||
|
||||
// 加经验
|
||||
|
@ -100,7 +100,7 @@ func (this *ModelRank) queryRankUser(key int32) (ranks []string, err error) {
|
||||
|
||||
tableName := fmt.Sprintf("%s-%s-%d", db.CrossTag(), this.TableName, key)
|
||||
if result, err = model.Redis.ZRevRange(tableName, 0, comm.MaxRankNum).Result(); err != nil {
|
||||
//this.module.Errorln(err)
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
ranks = make([]string, 0)
|
||||
@ -119,7 +119,7 @@ func (this *ModelRank) queryPlayers(uIds []string) (result []*pb.DBPagodaRecord,
|
||||
}
|
||||
result = make([]*pb.DBPagodaRecord, 0)
|
||||
if _, err = model.GetByUids(uIds, &result); err != nil && err != mgo.MongodbNil {
|
||||
//this.module.Errorln(err)
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
return
|
||||
|
@ -31,6 +31,7 @@ type Pagoda struct {
|
||||
friend comm.IFriend
|
||||
modelRacePagoda *ModelRace
|
||||
modelCyclePagoda *ModelCycle
|
||||
battlerecord comm.IBattleRecord // 战报模块
|
||||
}
|
||||
|
||||
func NewModule() core.IModule {
|
||||
@ -92,6 +93,11 @@ func (this *Pagoda) Start() (err error) {
|
||||
return
|
||||
}
|
||||
this.friend = module.(comm.IFriend)
|
||||
|
||||
if module, err = this.service.GetModule(comm.ModuleBattleRecord); err != nil {
|
||||
return
|
||||
}
|
||||
this.battlerecord = module.(comm.IBattleRecord)
|
||||
//this.service.RegisterFunctionName(string(comm.Rpc_ModuleSeasonPagodaReward), this.Rpc_ModuleSeasonPagodaReward)
|
||||
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