Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
b00fd416f9
@ -133,6 +133,7 @@ type (
|
||||
AddEquipment(session IUserSession, equip *pb.DB_Equipment) (code pb.ErrorCode)
|
||||
}
|
||||
IMainline interface {
|
||||
ModifyMainlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode)
|
||||
// 修改章节信息
|
||||
ModifyMainlineData(uid string, id int32) (code pb.ErrorCode)
|
||||
/// 查询章节ID
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
9、bingo:season,10 赛季塔层数
|
||||
10、bingo:viking // 解锁维京所有难度
|
||||
11、bingo:hunting // 解锁狩猎所有难度
|
||||
12、bingo:mainline,1,101 // 难度 id
|
||||
*/
|
||||
//参数校验
|
||||
func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (code pb.ErrorCode) {
|
||||
|
@ -182,6 +182,24 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
|
||||
code = module1.(comm.IHunting).CompleteAllLevel(session)
|
||||
this.Debug("使用bingo命令:uid = %s ", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
||||
} else if len(datas) == 3 && (datas[0] == "mainline") {
|
||||
module1, err := this.service.GetModule(comm.ModuleMainline)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
num1, err := strconv.Atoi(datas[1])
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
num2, err := strconv.Atoi(datas[1])
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
code = module1.(comm.IMainline).ModifyMainlineDataByNanduID(session.GetUserId(), int32(num1), int32(num2))
|
||||
|
||||
this.Debug("使用bingo命令", log.Fields{"uid": session.GetUserId(), "key:": keys[1]})
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -82,3 +82,13 @@ func (this *configureComp) GetMainlineChapter(id int32) (data *cfg.GameMainlineC
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 获取章节数量
|
||||
func (this *configureComp) GetMaxMainlineChapter() int32 {
|
||||
if v, err := this.GetConfigure(game_mainlinechapter); err == nil {
|
||||
if configure, ok := v.(*cfg.GameMainlineChapter); ok {
|
||||
return int32(len(configure.GetDataList()))
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
@ -51,3 +51,13 @@ func (this *ModelMainline) getOneChapterInfo(uid, obj string) *pb.DBMainline {
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
// 增加新的章节数据
|
||||
func (this *ModelMainline) cleanChapter(uId string) (err error) {
|
||||
|
||||
if err = this.DelByUId(uId); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -128,3 +128,69 @@ func (this *Mainline) CheckPoint(uid string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 参数 难度 + 关卡id
|
||||
func (this *Mainline) ModifyMainlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode) {
|
||||
|
||||
conf := this.configure.GetMainlineConfigData(id, nandu)
|
||||
if conf != nil {
|
||||
code = pb.ErrorCode_ConfigNoFound // 找不到配置
|
||||
return
|
||||
}
|
||||
// 已现在设置的为准 删除之前的所有数据
|
||||
this.modelMainline.cleanChapter(uid)
|
||||
// 获取当前的章节数据
|
||||
jumpCap := conf.Chapter
|
||||
// 先加所有难度小于1 的章节
|
||||
for ndIndex := 1; ndIndex < int(nandu)-1; ndIndex++ {
|
||||
max := this.configure.GetMaxMainlineChapter()
|
||||
for i := 1; i <= int(max); i++ {
|
||||
_data := &pb.DBMainline{}
|
||||
_data.Id = primitive.NewObjectID().Hex()
|
||||
_data.ChapterId = conf.Chapter
|
||||
_data.MainlineId = conf.Id
|
||||
_mData := make(map[string]interface{}, 0)
|
||||
_data.Uid = uid
|
||||
_data.Intensity = int32(ndIndex) // 难度1
|
||||
confCap := this.configure.GetMainlineChapter(int32(i))
|
||||
for _, v := range confCap.Episode {
|
||||
_data.BranchID = append(_data.BranchID, v)
|
||||
}
|
||||
|
||||
_mData[_data.Id] = _data
|
||||
|
||||
this.modelMainline.addNewChapter(uid, _mData)
|
||||
}
|
||||
}
|
||||
// 加当前难度 的章节数据
|
||||
for i := 1; i < int(jumpCap-1); i++ {
|
||||
confCap := this.configure.GetMainlineChapter(int32(i))
|
||||
_data := &pb.DBMainline{}
|
||||
_data.Id = primitive.NewObjectID().Hex()
|
||||
_data.ChapterId = conf.Chapter
|
||||
_data.MainlineId = conf.Id
|
||||
_mData := make(map[string]interface{}, 0)
|
||||
_data.Uid = uid
|
||||
_data.Intensity = int32(nandu) // 难度1
|
||||
for _, v := range confCap.Episode {
|
||||
_data.BranchID = append(_data.BranchID, v)
|
||||
}
|
||||
_mData[_data.Id] = _data
|
||||
this.modelMainline.addNewChapter(uid, _mData)
|
||||
}
|
||||
// 加当前难度 当前章节的前置关卡数据
|
||||
_data := &pb.DBMainline{}
|
||||
_data.Id = primitive.NewObjectID().Hex()
|
||||
_data.ChapterId = conf.Chapter
|
||||
_data.MainlineId = conf.Id
|
||||
_mData := make(map[string]interface{}, 0)
|
||||
_data.Uid = uid
|
||||
_data.Intensity = int32(nandu) // 难度1
|
||||
// for _, v := range confCap.Episode {
|
||||
// _data.BranchID = append(_data.BranchID, v)
|
||||
// }
|
||||
_mData[_data.Id] = _data
|
||||
this.modelMainline.addNewChapter(uid, _mData)
|
||||
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user