Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
cf0e0a5a2a
@ -40,7 +40,7 @@ func (this *ModelRank) ChangeUserRank(uid string, objId string, value map[string
|
||||
func (this *ModelRank) GetRankData(bossType int32) (data []*pb.DBHuntingRank, err error) {
|
||||
tmpdata := make([]*pb.DBHuntingRank, 0)
|
||||
data = make([]*pb.DBHuntingRank, 0)
|
||||
err = this.Redis.LRange(comm.TableVikingRank, 0, -1, &tmpdata)
|
||||
err = this.Redis.LRange(comm.TableVikingRankList, 0, -1, &tmpdata)
|
||||
if err == nil {
|
||||
for _, v := range tmpdata {
|
||||
if v.Bosstype == bossType {
|
||||
|
@ -22,9 +22,9 @@ func (this *apiComp) ChallengeOverCheck(session comm.IUserSession, req *pb.Mainl
|
||||
///挑战主线关卡
|
||||
func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineChallengeOverReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
curChapter *pb.DBMainline // 当前章节信息
|
||||
bBranch bool // 当前挑战关卡是不是分支
|
||||
res []*cfg.Gameatn // 小章节奖励
|
||||
mainline *pb.DBMainline // 当前章节信息
|
||||
bBranch bool // 当前挑战关卡是不是分支
|
||||
res []*cfg.Gameatn // 小章节奖励
|
||||
)
|
||||
res = make([]*cfg.Gameatn, 0)
|
||||
|
||||
@ -33,54 +33,47 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
// 校验关卡存不存在
|
||||
curChapter = this.module.modelMainline.getOneChapterInfo(session.GetUserId(), req.ChapterObj)
|
||||
if curChapter == nil {
|
||||
mainline = this.module.modelMainline.getOneChapterInfo(session.GetUserId(), req.ChapterObj)
|
||||
if mainline == nil {
|
||||
code = pb.ErrorCode_MainlineNotFound
|
||||
return
|
||||
}
|
||||
|
||||
node := this.module.configure.GetMainlineConfigData(int32(req.MainlineId), curChapter.Intensity)
|
||||
node := this.module.configure.GetMainlineConfigData(int32(req.MainlineId), mainline.Intensity)
|
||||
if node == nil { // 配置文件校验
|
||||
code = pb.ErrorCode_MainlineNotFindChapter
|
||||
return
|
||||
}
|
||||
if node.Route == 1 {
|
||||
if node.Previoustage != curChapter.MainlineId {
|
||||
for _, v := range mainline.BranchID {
|
||||
if v == int32(req.MainlineId) { // 重复挑战
|
||||
code = pb.ErrorCode_MainlineNotFindChapter
|
||||
return
|
||||
}
|
||||
} else {
|
||||
for _, v := range curChapter.BranchID {
|
||||
if v == int32(req.MainlineId) { // 重复挑战
|
||||
code = pb.ErrorCode_MainlineNotFindChapter
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
res = append(res, node.Award...)
|
||||
|
||||
curChapter.MainlineId = int32(req.MainlineId)
|
||||
mainline.MainlineId = int32(req.MainlineId)
|
||||
if bBranch {
|
||||
curChapter.BranchID = append(curChapter.BranchID, int32(req.MainlineId)) // 记录分支关卡
|
||||
mainline.BranchID = append(mainline.BranchID, int32(req.MainlineId)) // 记录分支关卡
|
||||
}
|
||||
|
||||
mainline.BranchID = append(mainline.BranchID, int32(req.MainlineId))
|
||||
update := map[string]interface{}{
|
||||
"mainlineId": req.MainlineId,
|
||||
"ChapterId": curChapter.ChapterId,
|
||||
"branchID": curChapter.BranchID,
|
||||
"ChapterId": mainline.ChapterId,
|
||||
"branchID": mainline.BranchID,
|
||||
}
|
||||
err := this.module.modelMainline.modifyMainlineData(session.GetUserId(), curChapter.Id, update)
|
||||
err := this.module.modelMainline.modifyMainlineData(session.GetUserId(), mainline.Id, update)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
newChaptConfig := this.module.modelMainline.checkNewCapter(curChapter.ChapterId+1, curChapter.Intensity, curChapter.MainlineId)
|
||||
newChaptConfig := this.module.modelMainline.checkNewCapter(mainline.ChapterId+1, mainline.Intensity, mainline.MainlineId)
|
||||
if newChaptConfig != nil {
|
||||
// 如果本章节打完 则创建新的章节
|
||||
_data := &pb.DBMainline{}
|
||||
_data.Id = primitive.NewObjectID().Hex()
|
||||
_data.ChapterId = curChapter.ChapterId + 1
|
||||
_data.ChapterId = mainline.ChapterId + 1
|
||||
_data.MainlineId = 0 // 第二章数据默认0
|
||||
_mData := make(map[string]interface{}, 0)
|
||||
_data.Uid = session.GetUserId()
|
||||
@ -90,15 +83,14 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh
|
||||
// 推送新的章节
|
||||
session.SendMsg(string(this.module.GetType()), MainlineNewChapterPush, &pb.MainlineNewChapterPush{Data: _data})
|
||||
} else { // 切换下个难度
|
||||
|
||||
node := this.module.configure.GetMainlineConfigData(int32(req.MainlineId+1), curChapter.Intensity)
|
||||
if node == nil && curChapter.Intensity < comm.MaxMainlineIntensity { // 配置文件校验
|
||||
node := this.module.configure.GetMainlineConfigData(int32(req.MainlineId+1), mainline.Intensity)
|
||||
if node == nil && mainline.Intensity < comm.MaxMainlineIntensity { // 配置文件校验
|
||||
_data := &pb.DBMainline{}
|
||||
_data.Id = primitive.NewObjectID().Hex()
|
||||
_data.ChapterId = 1 // 默认第一章节
|
||||
_mData := make(map[string]interface{}, 0)
|
||||
_data.Uid = session.GetUserId()
|
||||
_data.Intensity = curChapter.Intensity + 1 // 难度+1
|
||||
_data.Intensity = mainline.Intensity + 1 // 难度+1
|
||||
_mData[_data.Id] = _data
|
||||
this.module.modelMainline.addNewChapter(session.GetUserId(), _mData)
|
||||
session.SendMsg(string(this.module.GetType()), MainlineNewChapterPush, &pb.MainlineNewChapterPush{Data: _data})
|
||||
@ -109,6 +101,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh
|
||||
if code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), MainlineChallengeOverResp, &pb.MainlineChallengeOverResp{Data: curChapter})
|
||||
session.SendMsg(string(this.module.GetType()), MainlineChallengeOverResp, &pb.MainlineChallengeOverResp{Data: mainline})
|
||||
return
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng
|
||||
if code != pb.ErrorCode_Success {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
viking, err := this.module.modelViking.getVikingList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_VikingBoosType
|
||||
|
@ -64,19 +64,21 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
||||
}
|
||||
viking.Boss[req.BossType] += 1
|
||||
mapData["Boss"] = viking.Boss
|
||||
// viking.ChallengeTime[req.BossType<<16+req.Difficulty] = 0 // todo 耗时
|
||||
// mapData["challengeTime"] = viking.ChallengeTime
|
||||
sz := make([]*pb.LineUp, 5)
|
||||
for i, v := range req.Report.Info.Redflist[0].Team {
|
||||
if v != nil {
|
||||
sz[i] = &pb.LineUp{
|
||||
Cid: v.HeroID,
|
||||
Star: v.Star,
|
||||
Lv: v.Lv,
|
||||
|
||||
if req.Report != nil && len(req.Report.Info.Redflist) > 0 {
|
||||
sz := make([]*pb.LineUp, 5)
|
||||
for i, v := range req.Report.Info.Redflist[0].Team {
|
||||
if v != nil {
|
||||
sz[i] = &pb.LineUp{
|
||||
Cid: v.HeroID,
|
||||
Star: v.Star,
|
||||
Lv: v.Lv,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.module.modulerank.updateVikingRankList(session, req.Difficulty, req.BossType, req.Report.Info.Redflist[0].Leadpos, sz)
|
||||
}
|
||||
this.module.modulerank.updateVikingRankList(session, req.Difficulty, req.BossType, req.Report.Info.Redflist[0].Leadpos, sz)
|
||||
}
|
||||
// 耗时校验 当前战斗胜利时间消耗小于之前刷新数据
|
||||
|
||||
|
@ -48,7 +48,7 @@ func (this *ModelRank) ChangeUserRank(uid string, objId string, value map[string
|
||||
func (this *ModelRank) GetRankData(bossType int32) (data []*pb.DBVikingRank, err error) {
|
||||
tmpdata := make([]*pb.DBVikingRank, 0)
|
||||
data = make([]*pb.DBVikingRank, 0)
|
||||
err = this.Redis.LRange(comm.TableVikingRank, 0, -1, &tmpdata)
|
||||
err = this.Redis.LRange(comm.TableVikingRankList, 0, -1, &tmpdata)
|
||||
if err == nil {
|
||||
for _, v := range tmpdata {
|
||||
if v.Bosstype == bossType {
|
||||
|
Loading…
Reference in New Issue
Block a user