Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
8c340f6955
@ -10,6 +10,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100101",
|
||||
"text": "1-1"
|
||||
@ -94,6 +95,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100102",
|
||||
"text": "1-2"
|
||||
@ -178,6 +180,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100103",
|
||||
"text": "1-3"
|
||||
@ -262,6 +265,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100104",
|
||||
"text": "1-4"
|
||||
@ -346,6 +350,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100105",
|
||||
"text": "1-5"
|
||||
@ -430,6 +435,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100106",
|
||||
"text": "1-6"
|
||||
@ -506,7 +512,7 @@
|
||||
{
|
||||
"id": 1100201,
|
||||
"chapterid": 11002,
|
||||
"previoustage": 0,
|
||||
"previoustage": 1100106,
|
||||
"Episodetype": 1,
|
||||
"openlevel": 1,
|
||||
"Episodelocation": {
|
||||
@ -514,6 +520,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100201",
|
||||
"text": "2-1"
|
||||
@ -598,6 +605,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100202",
|
||||
"text": "2-2"
|
||||
@ -683,6 +691,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100203",
|
||||
"text": "2-3"
|
||||
@ -767,6 +776,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100204",
|
||||
"text": "2-4"
|
||||
@ -851,6 +861,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100205",
|
||||
"text": "2-5"
|
||||
@ -935,6 +946,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100206",
|
||||
"text": "2-6"
|
||||
@ -1011,7 +1023,7 @@
|
||||
{
|
||||
"id": 1100301,
|
||||
"chapterid": 11003,
|
||||
"previoustage": 0,
|
||||
"previoustage": 1100206,
|
||||
"Episodetype": 1,
|
||||
"openlevel": 1,
|
||||
"Episodelocation": {
|
||||
@ -1019,6 +1031,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100301",
|
||||
"text": "3-1"
|
||||
@ -1103,6 +1116,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100302",
|
||||
"text": "3-2"
|
||||
@ -1187,6 +1201,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100303",
|
||||
"text": "3-3"
|
||||
@ -1271,6 +1286,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100304",
|
||||
"text": "3-4"
|
||||
@ -1356,6 +1372,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100305",
|
||||
"text": "3-5"
|
||||
@ -1439,6 +1456,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100306",
|
||||
"text": "3-6"
|
||||
@ -1514,7 +1532,7 @@
|
||||
{
|
||||
"id": 1100401,
|
||||
"chapterid": 11004,
|
||||
"previoustage": 0,
|
||||
"previoustage": 1100306,
|
||||
"Episodetype": 1,
|
||||
"openlevel": 1,
|
||||
"Episodelocation": {
|
||||
@ -1522,6 +1540,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100401",
|
||||
"text": "4-1"
|
||||
@ -1605,6 +1624,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100402",
|
||||
"text": "4-2"
|
||||
@ -1689,6 +1709,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100403",
|
||||
"text": "4-3"
|
||||
@ -1773,6 +1794,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100404",
|
||||
"text": "4-4"
|
||||
@ -1857,6 +1879,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100405",
|
||||
"text": "4-5"
|
||||
@ -1941,6 +1964,7 @@
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"EditorStage": 0,
|
||||
"mainlineName": {
|
||||
"key": "mainlineName1100406",
|
||||
"text": "4-6"
|
||||
|
@ -150,13 +150,18 @@ type (
|
||||
}
|
||||
IMainline interface {
|
||||
ModifyMainlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode)
|
||||
// 修改章节信息
|
||||
ModifyMainlineData(uid string, id int32) (code pb.ErrorCode)
|
||||
/// 查询章节ID
|
||||
GetUsermainLineData(uid string) (mainlineId int32)
|
||||
///红点
|
||||
IReddot
|
||||
}
|
||||
IMline interface {
|
||||
ModifyMlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode)
|
||||
/// 查询章节ID
|
||||
GetUsermLineData(uid string, chapterType int32) (chapterId int32)
|
||||
///红点
|
||||
IReddot
|
||||
}
|
||||
//任务
|
||||
ITask interface {
|
||||
//初始化 日常/周常/成就
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
//bingo:item,10001,1
|
||||
//bingo:attr,gold,1000000
|
||||
//bingo:equi,xxx,1 // xxx 装备id
|
||||
2、修改主线关卡进度:bingo:mapid,102(102代表关卡位置)
|
||||
|
||||
|
||||
3、修改心魔塔进度:bingo:pataid,10(10代表层数)
|
||||
|
||||
|
@ -91,23 +91,6 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
log.Field{Key: "T", Value: datas[1]},
|
||||
log.Field{Key: "N", Value: int32(num)},
|
||||
)
|
||||
} else if len(datas) == 2 && (datas[0] == "mapid") {
|
||||
module1, err := this.service.GetModule(comm.ModuleMainline)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
num, err := strconv.Atoi(datas[1])
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
code = module1.(comm.IMainline).ModifyMainlineData(session.GetUserId(), int32(num))
|
||||
|
||||
this.Debug("使用bingo命令",
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
log.Field{Key: "0", Value: datas[0]},
|
||||
log.Field{Key: "N", Value: int32(num)},
|
||||
)
|
||||
} else if len(datas) == 2 && (datas[0] == "pataid") {
|
||||
module1, err := this.service.GetModule(comm.ModulePagoda)
|
||||
if err != nil {
|
||||
|
@ -18,7 +18,6 @@ import (
|
||||
"go_dreamfactory/sys/configure"
|
||||
"go_dreamfactory/sys/db"
|
||||
"go_dreamfactory/utils"
|
||||
"math"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
@ -72,15 +71,22 @@ func GetMonthStartEnd() (int64, int64) {
|
||||
}
|
||||
func Test_Main(t *testing.T) {
|
||||
|
||||
var l int64
|
||||
var l1 int64
|
||||
var i int32
|
||||
var f float64
|
||||
i = math.MaxInt32
|
||||
l = int64(i) << 31
|
||||
l1 = 1 << 31
|
||||
f = float64(l)
|
||||
fmt.Printf("%d,%d,%f", l, l1, f)
|
||||
var star1, star2, star3 int32
|
||||
var rst int32
|
||||
star1 = 1 << 2
|
||||
star2 = 1 << 1
|
||||
star3 = 1 << 0
|
||||
|
||||
//rst = star1 ^ star2 ^ star3 // 三星
|
||||
//rst = star1 ^ star2 // 2星
|
||||
rst ^= star1
|
||||
rst ^= star2
|
||||
// 校验星
|
||||
b1 := (rst&star1 == star1)
|
||||
b2 := (rst&star2 == star2)
|
||||
b3 := (rst&star3 == star3)
|
||||
fmt.Printf("%d,%d,%d,%d", star1, star2, star3, rst)
|
||||
fmt.Printf("%v,%v,%v,%d", b1, b2, b3, rst)
|
||||
var list []int32
|
||||
var list2 []int32
|
||||
list = []int32{1, 2, 3, 4, 5, 6, 7, 8, 9}
|
||||
|
@ -40,42 +40,6 @@ func (this *Mainline) OnInstallComp() {
|
||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||
}
|
||||
|
||||
// 接口信息 给其他模块调用 用来修改主线关卡信息
|
||||
func (this *Mainline) ModifyMainlineData(uid string, id int32) (code pb.ErrorCode) {
|
||||
|
||||
conf := this.configure.GetMainlineConfigData(id, 1)
|
||||
list, err := this.modelMainline.getMainlineList(uid)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
for _, v := range list {
|
||||
if v.ChapterId == conf.Chapter {
|
||||
data := make(map[string]interface{}, 0)
|
||||
data["mainlineId"] = id
|
||||
data["chapterId"] = v.ChapterId
|
||||
this.modelMainline.modifyMainlineData(uid, v.Id, data)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
//add
|
||||
_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 = 1 // 难度1
|
||||
_mData[_data.Id] = _data
|
||||
|
||||
this.modelMainline.addNewChapter(uid, _mData)
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Mainline) GetUsermainLineData(uid string) (mainlineId int32) {
|
||||
|
||||
_szData, err := this.modelMainline.getMainlineList(uid)
|
||||
|
@ -43,17 +43,14 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
|
||||
}
|
||||
if curChapter == nil { // 校验是不是新的数据
|
||||
if stageConf.Previoustage == 0 { // 创建一条新的章节数据
|
||||
// 新章节数据校验
|
||||
chapter := this.module.configure.GetPreMainChapter(req.StageId)
|
||||
chapter := this.module.configure.GetPreMainChapter(req.StageId) // 新章节数据校验
|
||||
bCheck := false
|
||||
if chapter == 0 {
|
||||
bCheck = true
|
||||
} else {
|
||||
for _, v := range list {
|
||||
if chapter == v.ChapterId { // 有上一章节数据
|
||||
// 获取该章节最后一关卡ID
|
||||
stage := this.module.configure.GetLastStageIDByChapter(chapter)
|
||||
if _, ok := v.Star[stage]; ok {
|
||||
if _, ok := v.Star[stageConf.Previoustage]; ok {
|
||||
bCheck = true
|
||||
}
|
||||
break
|
||||
|
@ -67,7 +67,9 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
|
||||
curChapter.Ps[req.StageId] = 0 // 清空预扣体力值
|
||||
update["ps"] = curChapter.Ps
|
||||
this.module.modelMline.modifyMlineData(session.GetUserId(), curChapter.Id, update)
|
||||
code = pb.ErrorCode_BattleNoWin
|
||||
//code = pb.ErrorCode_BattleNoWin
|
||||
rsp.Data = curChapter
|
||||
session.SendMsg(string(this.module.GetType()), MlineChallengeOverResp, rsp) // 数据推送
|
||||
return
|
||||
}
|
||||
// 评星规则
|
||||
@ -76,16 +78,23 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
var star1, star2, star3 int32
|
||||
star1 = 1 << 2
|
||||
star2 = 1 << 1
|
||||
star3 = 1 << 0
|
||||
for i, v := range stageConf.StarType {
|
||||
if v == comm.MainStarType1 {
|
||||
star += stageConf.Star[i]
|
||||
//star += stageConf.Star[i]
|
||||
star ^= star1
|
||||
} else if v == comm.MainStarType2 {
|
||||
if req.Report.Death <= stageConf.StarValue[i] {
|
||||
star += stageConf.Star[i]
|
||||
//star += stageConf.Star[i]
|
||||
star ^= star2
|
||||
}
|
||||
} else if v == comm.MainStarType3 {
|
||||
if req.Report.Round <= stageConf.StarValue[i] {
|
||||
star += stageConf.Star[i]
|
||||
//star += stageConf.Star[i]
|
||||
star ^= star3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,20 +36,21 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.MlineGetListReq)
|
||||
}
|
||||
}
|
||||
if len(rsp.Data) == 0 { // 什么数据都没有 创建一条
|
||||
stageConf := this.module.configure.GetFirstStageIDByChapter(req.CType)
|
||||
if stageConf != nil { // 配置文件校验
|
||||
newData := &pb.DBMline{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: session.GetUserId(),
|
||||
CType: stageConf.Episodetype,
|
||||
ChapterId: stageConf.Chapterid,
|
||||
StageId: stageConf.Id,
|
||||
Star: map[int32]int32{},
|
||||
Award: map[int32]bool{},
|
||||
Ps: map[int32]int32{},
|
||||
if chapterConf := this.module.configure.GetFirstChapterIDByType(req.CType); chapterConf != nil { // 配置文件校验
|
||||
if stageConf := this.module.configure.GetFirstStageIDByChapter(chapterConf.Id); stageConf != nil {
|
||||
newData := &pb.DBMline{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: session.GetUserId(),
|
||||
CType: stageConf.Episodetype,
|
||||
ChapterId: stageConf.Chapterid,
|
||||
StageId: stageConf.Id,
|
||||
Star: map[int32]int32{},
|
||||
Award: map[int32]bool{},
|
||||
Ps: map[int32]int32{},
|
||||
}
|
||||
rsp.Data = append(rsp.Data, newData)
|
||||
this.module.modelMline.addNewChapter(session.GetUserId(), newData)
|
||||
}
|
||||
rsp.Data = append(rsp.Data, newData)
|
||||
this.module.modelMline.addNewChapter(session.GetUserId(), newData)
|
||||
} else {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
|
@ -75,7 +75,6 @@ func (this *configureComp) GetMainStageConf(id int32) (data *cfg.GameMainStageDa
|
||||
|
||||
// 获取上一章节信息
|
||||
func (this *configureComp) GetPreMainChapter(id int32) (stageID int32) {
|
||||
|
||||
if v, err := this.GetConfigure(game_mainchapter); err == nil {
|
||||
if configure, ok := v.(*cfg.GameMainChapter); ok {
|
||||
for index, v1 := range configure.GetDataList() {
|
||||
@ -95,32 +94,25 @@ func (this *configureComp) GetPreMainChapter(id int32) (stageID int32) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 获取该章节最后一关ID
|
||||
func (this *configureComp) GetLastStageIDByChapter(id int32) (stageID int32) {
|
||||
var (
|
||||
sz []int32
|
||||
)
|
||||
if v, err := this.GetConfigure(game_mainstage); err == nil {
|
||||
if configure, ok := v.(*cfg.GameMainStage); ok {
|
||||
func (this *configureComp) GetFirstChapterIDByType(iType int32) *cfg.GameMainChapterData {
|
||||
if v, err := this.GetConfigure(game_mainchapter); err == nil {
|
||||
if configure, ok := v.(*cfg.GameMainChapter); ok {
|
||||
for _, v := range configure.GetDataList() {
|
||||
if v.Chapterid == id {
|
||||
sz = append(sz, v.Id)
|
||||
if v.ChapterType == iType {
|
||||
return v
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(sz) > 0 {
|
||||
stageID = sz[len(sz)-1]
|
||||
}
|
||||
return nil
|
||||
|
||||
return stageID
|
||||
}
|
||||
func (this *configureComp) GetFirstStageIDByChapter(iType int32) *cfg.GameMainStageData {
|
||||
|
||||
func (this *configureComp) GetFirstStageIDByChapter(chapterID int32) *cfg.GameMainStageData {
|
||||
if v, err := this.GetConfigure(game_mainstage); err == nil {
|
||||
if configure, ok := v.(*cfg.GameMainStage); ok {
|
||||
for _, v := range configure.GetDataList() {
|
||||
if v.Episodetype == iType {
|
||||
if v.Chapterid == chapterID {
|
||||
return v
|
||||
}
|
||||
}
|
||||
@ -128,3 +120,51 @@ func (this *configureComp) GetFirstStageIDByChapter(iType int32) *cfg.GameMainSt
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 红点用 获取所有章节数据
|
||||
func (this *configureComp) GetAllChapterID() (chapter []int32) {
|
||||
if v, err := this.GetConfigure(game_mainchapter); err == nil {
|
||||
if configure, ok := v.(*cfg.GameMainChapter); ok {
|
||||
for _, v1 := range configure.GetDataList() {
|
||||
chapter = append(chapter, v1.Id)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 红点用 获取所有类型为1 的小关ID
|
||||
func (this *configureComp) GetAllStageByChapterID(chapterID int32) (stage []int32) {
|
||||
if v, err := this.GetConfigure(game_mainstage); err == nil {
|
||||
if configure, ok := v.(*cfg.GameMainStage); ok {
|
||||
for _, v1 := range configure.GetDataList() {
|
||||
if v1.Episodetype == 1 {
|
||||
stage = append(stage, v1.Id)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// gm 专用
|
||||
func (this *configureComp) GetGMChapter(chapterID, itype int32) (d map[int32][]int32) {
|
||||
// var d map[int32][]int32
|
||||
d = make(map[int32][]int32, 0)
|
||||
if v, err := this.GetConfigure(game_mainstage); err == nil {
|
||||
if configure, ok := v.(*cfg.GameMainStage); ok {
|
||||
for _, v1 := range configure.GetDataList() {
|
||||
if v1.Episodetype == itype && v1.Id <= chapterID {
|
||||
//chapter = append(chapter, v1.Id)
|
||||
stage := this.GetAllStageByChapterID(v1.Id)
|
||||
if len(stage) > 0 {
|
||||
d[v1.Id] = stage
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -62,3 +62,12 @@ func (this *ModelMline) cleanChapter(uId string) (err error) {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 清除数据
|
||||
func (this *ModelMline) cleanChapterDataById(uId string, ids ...string) (err error) {
|
||||
if err = this.DelListlds(uId, ids...); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -5,6 +5,9 @@ import (
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"sort"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
type Mline struct {
|
||||
@ -62,24 +65,78 @@ func (this *Mline) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (re
|
||||
|
||||
// 红点检测
|
||||
func (this *Mline) CheckPoint(uid string) bool {
|
||||
// list, err := this.modelMainline.getMainlineList(uid)
|
||||
// if err != nil {
|
||||
// return false
|
||||
// }
|
||||
// for _, v := range list {
|
||||
// conf := this.configure.GetMainlineChapter(v.ChapterId)
|
||||
// if conf == nil {
|
||||
// continue
|
||||
// }
|
||||
// if len(conf.Episode) != len(v.BranchID) {
|
||||
// return true
|
||||
// }
|
||||
// }
|
||||
list, err := this.modelMline.getMainlineList(uid)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
for _, v := range list {
|
||||
b := false
|
||||
for _, v1 := range this.configure.GetAllChapterID() {
|
||||
if v.ChapterId == v1 {
|
||||
b = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
if !b {
|
||||
return false
|
||||
}
|
||||
// 查看所有小关是否通关
|
||||
szStage := this.configure.GetAllStageByChapterID(v.ChapterId)
|
||||
if len(szStage) != len(v.Star) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 参数 难度 + 关卡id
|
||||
func (this *Mline) ModifyMainlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode) {
|
||||
// 参数 难度 + 章节id
|
||||
func (this *Mline) ModifyMlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode) {
|
||||
var del []string
|
||||
list, err := this.modelMline.getMainlineList(uid)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
for _, v := range list {
|
||||
if v.CType == nandu {
|
||||
del = append(del, v.Id)
|
||||
}
|
||||
}
|
||||
// 清除
|
||||
this.modelMline.cleanChapterDataById(uid, del...)
|
||||
d := this.configure.GetGMChapter(id, nandu)
|
||||
for k, v := range d {
|
||||
newData := &pb.DBMline{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: uid,
|
||||
CType: nandu,
|
||||
ChapterId: k,
|
||||
StageId: 0,
|
||||
Star: map[int32]int32{},
|
||||
Award: map[int32]bool{},
|
||||
Ps: map[int32]int32{},
|
||||
}
|
||||
for _, v1 := range v {
|
||||
newData.Star[v1] = 3 // gm 全给3星
|
||||
}
|
||||
this.modelMline.addNewChapter(uid, newData)
|
||||
}
|
||||
return
|
||||
}
|
||||
func (this *Mline) GetUsermLineData(uid string, chapterType int32) (chapterId int32) {
|
||||
var sz []*pb.DBMline
|
||||
_szData, err := this.modelMline.getMainlineList(uid)
|
||||
if err == nil {
|
||||
for _, v := range _szData {
|
||||
if v.ChapterId == chapterId {
|
||||
sz = append(sz, _szData...)
|
||||
}
|
||||
}
|
||||
|
||||
sort.SliceStable(sz, func(i, j int) bool { // 排序
|
||||
return sz[i].ChapterId > sz[j].ChapterId
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -91,6 +91,7 @@ func (this *Reddot) Start() (err error) {
|
||||
return
|
||||
}
|
||||
this.hunting = module.(comm.IHunting)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -127,8 +127,8 @@ func (this *ModelRtask) verifyRtype2(uid string, cfg *cfg.GameRdtaskCondiData) (
|
||||
return
|
||||
}
|
||||
|
||||
if ml, y := m.(comm.IMainline); y {
|
||||
qjId := ml.GetUsermainLineData(uid)
|
||||
if ml, y := m.(comm.IMline); y {
|
||||
qjId := ml.GetUsermLineData(uid, 1)
|
||||
return soEqual(qjId, cfg.Data1)
|
||||
}
|
||||
return
|
||||
|
@ -18,6 +18,7 @@ type GameMainStageData struct {
|
||||
Episodetype int32
|
||||
Openlevel int32
|
||||
Episodelocation serialization.Vector3
|
||||
EditorStage int32
|
||||
MainlineName string
|
||||
Title string
|
||||
Desc string
|
||||
@ -54,6 +55,7 @@ func (_v *GameMainStageData)Deserialize(_buf map[string]interface{}) (err error)
|
||||
_v.Episodelocation = serialization.NewVector3(_x_, _y_, _z_)
|
||||
}
|
||||
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["EditorStage"].(float64); !_ok_ { err = errors.New("EditorStage error"); return }; _v.EditorStage = int32(_tempNum_) }
|
||||
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["mainlineName"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.MainlineName error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.MainlineName, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
||||
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["title"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Title error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Title, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
||||
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["desc"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Desc error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Desc, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
||||
|
Loading…
Reference in New Issue
Block a user