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"
|
"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))
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
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{
|
record.Data[conf.Key].Line = &pb.LineData{
|
||||||
Leadpos: Leadpos,
|
Leadpos: Leadpos,
|
||||||
Line: szLine,
|
Line: szLine,
|
||||||
|
Bid: req.Report.Info.Id, // 记录战报数据
|
||||||
}
|
}
|
||||||
mapData["data"] = record.Data
|
mapData["data"] = record.Data
|
||||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||||
mapData["uinfo"] = comm.GetUserBaseInfo(user)
|
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)
|
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)
|
tableName := fmt.Sprintf("%s-%s-%d", db.CrossTag(), this.TableName, key)
|
||||||
if result, err = model.Redis.ZRevRange(tableName, 0, comm.MaxRankNum).Result(); err != nil {
|
if result, err = model.Redis.ZRevRange(tableName, 0, comm.MaxRankNum).Result(); err != nil {
|
||||||
//this.module.Errorln(err)
|
this.module.Errorln(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ranks = make([]string, 0)
|
ranks = make([]string, 0)
|
||||||
@ -119,7 +119,7 @@ func (this *ModelRank) queryPlayers(uIds []string) (result []*pb.DBPagodaRecord,
|
|||||||
}
|
}
|
||||||
result = make([]*pb.DBPagodaRecord, 0)
|
result = make([]*pb.DBPagodaRecord, 0)
|
||||||
if _, err = model.GetByUids(uIds, &result); err != nil && err != mgo.MongodbNil {
|
if _, err = model.GetByUids(uIds, &result); err != nil && err != mgo.MongodbNil {
|
||||||
//this.module.Errorln(err)
|
this.module.Errorln(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -31,6 +31,7 @@ type Pagoda struct {
|
|||||||
friend comm.IFriend
|
friend comm.IFriend
|
||||||
modelRacePagoda *ModelRace
|
modelRacePagoda *ModelRace
|
||||||
modelCyclePagoda *ModelCycle
|
modelCyclePagoda *ModelCycle
|
||||||
|
battlerecord comm.IBattleRecord // 战报模块
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewModule() core.IModule {
|
func NewModule() core.IModule {
|
||||||
@ -92,6 +93,11 @@ func (this *Pagoda) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.friend = module.(comm.IFriend)
|
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)
|
//this.service.RegisterFunctionName(string(comm.Rpc_ModuleSeasonPagodaReward), this.Rpc_ModuleSeasonPagodaReward)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user