This commit is contained in:
liwei1dao 2023-01-31 17:07:03 +08:00
commit 69957984af
11 changed files with 329 additions and 197 deletions

View File

@ -7,11 +7,11 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -33,11 +33,11 @@
},
"main": [
{
"key": "platlv",
"param": 5
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -59,11 +59,11 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -85,11 +85,11 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -111,11 +111,11 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -137,11 +137,11 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -163,11 +163,11 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -189,11 +189,11 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -215,11 +215,11 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -241,11 +241,11 @@
},
"main": [
{
"key": "platlv",
"param": 2
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -267,11 +267,11 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -293,11 +293,11 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -319,11 +319,11 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -345,11 +345,11 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -371,11 +371,11 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -397,11 +397,11 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -423,11 +423,11 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -449,11 +449,11 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -475,11 +475,11 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -501,11 +501,11 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -527,11 +527,11 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -553,11 +553,11 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -579,11 +579,11 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -605,11 +605,11 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -631,11 +631,11 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -657,11 +657,11 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -683,11 +683,11 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -709,11 +709,11 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -735,7 +735,7 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
}
],
@ -757,11 +757,11 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -783,11 +783,11 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -809,11 +809,11 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -835,11 +835,11 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -861,11 +861,11 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -887,11 +887,11 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -913,11 +913,11 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -939,11 +939,11 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -965,11 +965,11 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -991,11 +991,11 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1017,11 +1017,11 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1043,11 +1043,11 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1069,11 +1069,11 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1095,11 +1095,11 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1121,11 +1121,11 @@
},
"main": [
{
"key": "platlv",
"param": 20
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1147,11 +1147,11 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1173,11 +1173,11 @@
},
"main": [
{
"key": "platlv",
"param": 13
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1199,11 +1199,11 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1225,7 +1225,7 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
}
],
@ -1247,7 +1247,7 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
}
],
@ -1269,7 +1269,7 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
}
],
@ -1291,11 +1291,11 @@
},
"main": [
{
"key": "platlv",
"param": 5
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1317,11 +1317,11 @@
},
"main": [
{
"key": "platlv",
"param": 4
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1343,11 +1343,11 @@
},
"main": [
{
"key": "platlv",
"param": 5
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1369,11 +1369,11 @@
},
"main": [
{
"key": "platlv",
"param": 5
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1395,11 +1395,11 @@
},
"main": [
{
"key": "platlv",
"param": 5
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1421,11 +1421,11 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1447,11 +1447,11 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1473,11 +1473,11 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1499,11 +1499,11 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1525,11 +1525,11 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1551,11 +1551,11 @@
},
"main": [
{
"key": "platlv",
"param": 30
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"key": 2,
"param": 1
}
],
@ -1577,8 +1577,8 @@
},
"main": [
{
"key": "worldtaskid",
"param": 20050
"key": 3,
"param": 20010
}
],
"optional": "",
@ -1599,8 +1599,8 @@
},
"main": [
{
"key": "worldtaskid",
"param": 20050
"key": 3,
"param": 20010
}
],
"optional": "",
@ -1621,8 +1621,8 @@
},
"main": [
{
"key": "worldtaskid",
"param": 20050
"key": 3,
"param": 20010
}
],
"optional": "",

View File

@ -2,6 +2,7 @@ package comm
import (
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
)
type (
@ -17,6 +18,7 @@ type (
type (
ISys interface {
IsAccess(funcName string, uid string) (code pb.ErrorCode)
ValidCond(uid string, conf *cfg.GameOpencondData) string
}
//邮件业务模块对外接口定义 提供给其他模块使用的

View File

@ -134,14 +134,19 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
if first { // 发奖
if rst, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { // 统计主线进度
_mp := rst.Mline
if v, ok := _mp[curChapter.CType]; ok {
if v <= req.StageId {
if _mp == nil {
_mp = make(map[int32]int32, 1)
_mp[curChapter.CType] = req.StageId
} else {
if v, ok := _mp[curChapter.CType]; ok {
if v <= req.StageId {
_mp[curChapter.CType] = req.StageId
}
} else {
_mp[curChapter.CType] = req.StageId
}
} else {
_mp = make(map[int32]int32, 0)
_mp[curChapter.CType] = req.StageId
}
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
"mline": _mp,
})

View File

@ -127,7 +127,31 @@ func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32)
this.modelMline.addNewChapter(session.GetUserId(), newData)
}
}
// 修改扩展数据
if rst, err := this.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { // 统计主线进度
_mp := rst.Mline
var cType int32
conf := this.configure.GetMainChapterConf(connf.Chapterid)
if conf != nil {
cType = conf.ChapterType
}
if _mp == nil {
_mp = make(map[int32]int32, 1)
_mp[cType] = id
} else {
if v, ok := _mp[cType]; ok {
if v <= id {
_mp[cType] = id
}
} else {
_mp[cType] = id
}
}
this.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
"mline": _mp,
})
}
return
}
func (this *Mline) GetUsermLineData(uid string, chapterType int32) (chapterId int32) {

View File

@ -25,13 +25,9 @@ func (this *apiComp) Funclist(session comm.IUserSession, req *pb.SysFuncListReq)
if len(req.Keys) == 0 {
confList := this.moduleSys.configure.getOpencondList()
for _, v := range confList {
// 返回未开启的功能列表
for _, conf := range v.Main {
// 校验玩家等级
if conf.Key == "platlv" && user.Lv >= conf.Param {
funcList = append(funcList, v.Id)
continue
}
id := this.moduleSys.modelSys.validCond(session.GetUserId(), v)
if id != "" {
funcList = append(funcList, id)
}
}
} else {
@ -41,12 +37,9 @@ func (this *apiComp) Funclist(session comm.IUserSession, req *pb.SysFuncListReq)
continue
}
if conf, ok := opencfg.GetDataMap()[key]; ok {
for _, main := range conf.Main {
// 校验玩家等级
if main.Key == "platlv" && user.Lv >= main.Param {
funcList = append(funcList, key)
continue
}
id := this.moduleSys.modelSys.validCond(session.GetUserId(), conf)
if id != "" {
funcList = append(funcList, id)
}
}
}

View File

@ -5,6 +5,7 @@ import (
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
)
type ModelSys struct {
@ -27,14 +28,73 @@ func (this *ModelSys) IsAccess(funName string, uid string) (code pb.ErrorCode) {
if user != nil {
conf := this.moduleSys.configure.getFuncCfg(funName)
if conf != nil {
for _, v := range conf.Main {
if v.Key == "platlv" && user.Lv < v.Param {
code = pb.ErrorCode_NoOpened
return
}
}
this.validCond(uid, conf)
}
}
return
}
func (this *ModelSys) validCond(uid string, condData *cfg.GameOpencondData) string {
var flag bool
for _, conf := range condData.Main {
switch conf.Key {
case 1: //等级
iuser := this.moduleSys.ModuleUser
user := iuser.GetUser(uid)
if user == nil {
flag = false
return ""
}
if user.Lv >= conf.Param {
flag = true
}else{
flag = false
}
case 2: //关卡ID
iuser := this.moduleSys.ModuleUser
ex, err := iuser.GetUserExpand(uid)
if err != nil {
flag = false
return ""
}
if ex.Uid == "" {
flag = false
return ""
}
if v, ok := ex.Mline[1]; ok {
if v >= conf.Param {
flag = true
}else{
flag = false
}
}else{
flag = false
}
case 3: //世界任务ID
module, err := this.service.GetModule(comm.ModuleWorldtask)
if err != nil {
this.moduleSys.Debugln(err)
flag = false
return ""
}
if i, ok := module.(comm.IWorldtask); ok {
d := i.GetMyWorldtask(uid)
if _, ok := d.LastTaskIds[conf.Param]; ok {
flag = true
}else{
flag = false
}
}else{
flag = false
}
}
}
if flag {
return condData.Id
}
return ""
}

View File

@ -5,6 +5,7 @@ import (
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
)
var _ comm.ISys = (*ModuleSys)(nil)
@ -40,3 +41,7 @@ func (this *ModuleSys) GetType() core.M_Modules {
func (this *ModuleSys) IsAccess(funcName string, userId string) (code pb.ErrorCode) {
return this.modelSys.IsAccess(funcName, userId)
}
func (this *ModuleSys) ValidCond(uid string, conf *cfg.GameOpencondData) string {
return this.modelSys.validCond(uid, conf)
}

View File

@ -68,6 +68,20 @@ func (this *configureComp) LoadSignData() {
return
}
func (this *configureComp) GetOpenCondList() []*cfg.GameOpencondData {
if v, err := this.GetConfigure(gameOpencond); err != nil {
return nil
} else {
data, ok := v.(*cfg.GameOpencond)
if !ok {
err = fmt.Errorf("%T no is *cfg.GameOpencond", v)
return nil
}
return data.GetDataList()
}
return nil
}
func (this *configureComp) FindFunc(lv int32) (funcIds []string) {
if v, err := this.GetConfigure(gameOpencond); err != nil {
return nil
@ -79,7 +93,7 @@ func (this *configureComp) FindFunc(lv int32) (funcIds []string) {
}
for _, d := range data.GetDataList() {
for _, v := range d.Main {
if v.Key == "platlv" && v.Param == lv {
if v.Key == 1 && v.Param == lv {
funcIds = append(funcIds, d.Id)
continue
}

View File

@ -273,7 +273,20 @@ func (this *ModelUser) ChangeLevel(event interface{}, next func(event interface{
)
return
}
et.TriggerEvent(comm.EventOpenCond, ul.session.GetUserId(), this.module.configure.FindFunc(curLv))
module, err2 := this.module.service.GetModule(comm.ModuleSys)
if err2 == nil {
if isys, ok := module.(comm.ISys); ok {
var funcList []string
for _, conf := range this.module.configure.GetOpenCondList() {
id := isys.ValidCond(ul.session.GetUserId(), conf)
if id != "" {
funcList = append(funcList, id)
}
}
et.TriggerEvent(comm.EventOpenCond, ul.session.GetUserId(), funcList)
}
}
if err := ul.session.SendMsg(string(this.module.GetType()), UserSubTypeLvChangedPush,
&pb.UserLvChangedPush{Uid: ul.session.GetUserId(), Exp: curExp, Lv: curLv}); err != nil {
this.module.Error("玩家等级变化 UserSubTypeLvChangedPush推送失败",

View File

@ -0,0 +1,16 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
const (
GameOpencondType_None = 0
GameOpencondType_Platlv = 1
GameOpencondType_Maxmapid = 2
GameOpencondType_Worldtaskid = 3
)

View File

@ -11,7 +11,7 @@ package cfg
import "errors"
type GameOpenedCond struct {
Key string
Key int32
Param int32
}
@ -22,7 +22,7 @@ func (*GameOpenedCond) GetTypeId() int32 {
}
func (_v *GameOpenedCond)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; if _v.Key, _ok_ = _buf["key"].(string); !_ok_ { err = errors.New("key error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["param"].(float64); !_ok_ { err = errors.New("param error"); return }; _v.Param = int32(_tempNum_) }
return
}