红点
This commit is contained in:
parent
edc845ca0e
commit
fdcd38e622
@ -1,6 +1,7 @@
|
||||
package library
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
@ -42,7 +43,7 @@ func (this *apiComp) ActivationFetter(session comm.IUserSession, req *pb.Library
|
||||
if len(fetter.Herofetter) != len(c) {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_LibraryNoData,
|
||||
Title: pb.ErrorCode_LibraryNoData.ToString(),
|
||||
Title: fmt.Sprintf("羁绊英雄数据数量不足,needLen :%d,curLen :%d", len(c), len(fetter.Herofetter)),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -81,3 +81,45 @@ func (this *modelLibrary) checkReddot19105(uid string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 有可激活
|
||||
func (this *modelLibrary) checkReddot19109(uid string) bool {
|
||||
list := this.getLibraryList(uid)
|
||||
for _, v := range list {
|
||||
if v.Fidlv == 0 {
|
||||
c, _ := this.module.configure.GetFriendData(v.Fid, 1)
|
||||
if len(v.Herofetter) == len(c) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 有升级的情况 非常耗性能o(╯□╰)o不建议使用
|
||||
func (this *modelLibrary) checkReddot19110(uid string) bool {
|
||||
list := this.getLibraryList(uid)
|
||||
for _, v := range list {
|
||||
if v.Fidlv > 0 {
|
||||
var totalFetterLv int32 // 羁绊累计等级
|
||||
for _, oid := range v.Herofetter {
|
||||
if _d := this.module.modelFetter.getOneHeroFetter(uid, oid); _d != nil {
|
||||
totalFetterLv += _d.Favorlv
|
||||
}
|
||||
}
|
||||
for i := 1; ; i++ {
|
||||
c, _err := this.module.configure.GetFriendData(v.Fid, int32(i))
|
||||
if _err != nil || len(c) == 0 {
|
||||
break
|
||||
}
|
||||
if c[0].FavorabilityLv > totalFetterLv {
|
||||
break
|
||||
}
|
||||
if _, ok := v.Prize[c[0].FriendId]; !ok {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -303,6 +303,12 @@ func (this *Library) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (
|
||||
case comm.Reddot19103:
|
||||
reddot[comm.Reddot19103] = this.modelFetter.checkReddot19103(session.GetUserId())
|
||||
break
|
||||
case comm.Reddot19109:
|
||||
reddot[comm.Reddot19109] = this.modelLibrary.checkReddot19109(session.GetUserId())
|
||||
break
|
||||
case comm.Reddot19110:
|
||||
reddot[comm.Reddot19110] = this.modelLibrary.checkReddot19110(session.GetUserId())
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
|
@ -28,6 +28,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
|
||||
stageConf *cfg.GameMainStageData // 当前章节数据
|
||||
preStageConf *cfg.GameMainStageData // 上一章节数据
|
||||
err error
|
||||
bNew bool // 是否是新章节
|
||||
)
|
||||
|
||||
if errdata = this.ChallengeCheck(session, req); errdata != nil {
|
||||
@ -86,7 +87,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
|
||||
Award: map[int32]bool{},
|
||||
Ps: map[int32]int32{},
|
||||
}
|
||||
this.module.modelMline.addNewChapter(session.GetUserId(), curChapter)
|
||||
bNew = true
|
||||
}
|
||||
if v1, ok := curChapter.Ps[req.StageId]; ok && v1 != 0 {
|
||||
if errdata = this.module.ConsumeRes(session, stageConf.PsMg, true); errdata != nil { // 扣1点
|
||||
@ -113,10 +114,11 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
|
||||
}
|
||||
|
||||
curChapter.Ps[req.StageId] = ps
|
||||
|
||||
this.module.modelMline.modifyMlineData(session.GetUserId(), curChapter.Id, map[string]interface{}{
|
||||
"ps": curChapter.Ps,
|
||||
})
|
||||
if bNew {
|
||||
this.module.modelMline.addNewChapter(session.GetUserId(), curChapter) // 首次打新的章节
|
||||
} else {
|
||||
this.module.modelMline.modifyMlineData(session.GetUserId(), curChapter.Id, map[string]interface{}{"ps": curChapter.Ps})
|
||||
}
|
||||
}
|
||||
errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Ptype: pb.PlayType_mainline,
|
||||
|
Loading…
Reference in New Issue
Block a user