From 9bb0d46e956087d1edef1bbcd3270d698140fc2f Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Fri, 9 Jun 2023 10:53:21 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=8E=A8=E9=80=81=E6=B8=85=E7=90=86?= =?UTF-8?q?=E5=B7=B2=E5=AE=8C=E6=88=90=E7=9A=84=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/worldtask/model_worldtask.go | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/worldtask/model_worldtask.go b/modules/worldtask/model_worldtask.go index 35639f8f5..5661e5d40 100644 --- a/modules/worldtask/model_worldtask.go +++ b/modules/worldtask/model_worldtask.go @@ -222,6 +222,7 @@ func (this *ModelWorldtask) taskFinishPush(session comm.IUserSession, userTask * // 章节完成 if _, ok := userTask.Chapters[curTaskConf.Group]; !ok { delete(userTask.CurrentTasks, curTaskConf.Group) + delete(nextTask, curTaskConf.Group) if userTask.Chapters == nil { userTask.Chapters = make(map[int32]int32) } From 4f0192d25f45041bd7c2041daef56665d6d7be6b Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 9 Jun 2023 11:08:02 +0800 Subject: [PATCH 2/4] =?UTF-8?q?GM=20=E8=A7=A3=E9=94=81=E6=89=80=E6=9C=89?= =?UTF-8?q?=E9=9A=BE=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hunting/comp_configure.go | 21 +++++++++++++++++++++ modules/hunting/module.go | 27 ++++++++++----------------- modules/viking/comp_configure.go | 23 +++++++++++++++++++++++ modules/viking/module.go | 18 +++++++++--------- 4 files changed, 63 insertions(+), 26 deletions(-) diff --git a/modules/hunting/comp_configure.go b/modules/hunting/comp_configure.go index 3828d8df0..f04df51ed 100644 --- a/modules/hunting/comp_configure.go +++ b/modules/hunting/comp_configure.go @@ -94,3 +94,24 @@ func (this *configureComp) GetHuntingBossTypeConfigData() (mapType map[int32]str } return } + +// 警告: 此接口只允许GM调用 +func (this *configureComp) GetHuntingBossAllData() (data map[int32]int32) { + data = make(map[int32]int32) + if v, err := this.GetConfigure(game_huntingboss); err == nil { + if configure, ok := v.(*cfg.GameHuntingBoss); ok { + + for _, value := range configure.GetDataList() { + if v1, ok := data[value.Type]; !ok { + data[value.Type] = value.Difficulty + } else { + if v1 < value.Difficulty { + data[value.Type] = value.Difficulty + } + } + } + + } + } + return +} diff --git a/modules/hunting/module.go b/modules/hunting/module.go index 1e6970f71..8216ba121 100644 --- a/modules/hunting/module.go +++ b/modules/hunting/module.go @@ -182,26 +182,19 @@ func (this *Hunting) Reddot(session comm.IUserSession, rid ...comm.ReddotType) ( // 解锁远征所有难度 func (this *Hunting) CompleteAllLevel(session comm.IUserSession) (errdata *pb.ErrorData) { - list, err := this.modelHunting.getHuntingList(session.GetUserId()) - if err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_DBError, - Title: pb.ErrorCode_DBError.ToString(), - Message: err.Error(), - } - return + list, _ := this.modelHunting.getHuntingList(session.GetUserId()) + + list.Boss = make(map[int32]int32) + list.BossTime = make(map[string]int32) + + conf := this.configure.GetHuntingBossAllData() + for k, v := range conf { + list.Boss[k] = v } mapData := make(map[string]interface{}, 0) - // 查配置获取每个Boss的最大难度 - for k := range list.Boss { - for i := 1; ; i++ { - conf, _ := this.configure.GetHuntingBossConfigData(k, int32(i)) - if conf == nil { - list.Boss[k] = int32(i - 1) - } - } - } + mapData["boss"] = list.Boss + mapData["bossTime"] = list.BossTime errdata = this.ModifyHuntingData(session.GetUserId(), mapData) session.SendMsg(string(this.GetType()), HuntingGetListResp, &pb.HuntingGetListResp{Data: list}) diff --git a/modules/viking/comp_configure.go b/modules/viking/comp_configure.go index 27720fb75..44e9da455 100644 --- a/modules/viking/comp_configure.go +++ b/modules/viking/comp_configure.go @@ -44,6 +44,8 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp log.Errorf("get game_viking conf err:%v", err) return }) + + this.GetVikingBossAllData() return } @@ -90,3 +92,24 @@ func (this *configureComp) GetVikingBossTypeConfigData() map[int32]struct{} { } return mapType } + +// 警告: 此接口只允许GM调用 +func (this *configureComp) GetVikingBossAllData() (data map[int32]int32) { + data = make(map[int32]int32) + if v, err := this.GetConfigure(game_vikingboss); err == nil { + if configure, ok := v.(*cfg.GameVikingBoss); ok { + + for _, value := range configure.GetDataList() { + if v1, ok := data[value.Bossid]; !ok { + data[value.Bossid] = value.Difficulty + } else { + if v1 < value.Difficulty { + data[value.Bossid] = value.Difficulty + } + } + } + + } + } + return +} diff --git a/modules/viking/module.go b/modules/viking/module.go index f6521f3e4..7b65a55a9 100644 --- a/modules/viking/module.go +++ b/modules/viking/module.go @@ -200,17 +200,17 @@ func (this *Viking) CompleteAllLevel(session comm.IUserSession) (errdata *pb.Err } return } - mapData := make(map[string]interface{}, 0) - // 查配置获取每个Boss的最大难度 - for k := range list.Boss { - for i := 1; ; i++ { - conf, _ := this.configure.GetVikingBossConfigData(k, int32(i)) - if conf == nil { - list.Boss[k] = int32(i - 1) - } - } + list.Boss = make(map[int32]int32) + list.BossTime = make(map[string]int32) + + conf := this.configure.GetVikingBossAllData() + for k, v := range conf { + list.Boss[k] = v } + mapData := make(map[string]interface{}, 0) + mapData["boss"] = list.Boss + mapData["bossTime"] = list.BossTime errdata = this.ModifyVikingData(session.GetUserId(), mapData) session.SendMsg(string(this.GetType()), VikingGetListResp, &pb.VikingGetListResp{Data: list}) From 1267ff1129a43f374c5e1e8250dc88de9fc1585c Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 9 Jun 2023 11:20:31 +0800 Subject: [PATCH 3/4] =?UTF-8?q?gm=20=E8=B0=83=E6=95=B4vip=20=E7=AD=89?= =?UTF-8?q?=E7=BA=A7=E5=81=9A=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 2 +- modules/gm/module.go | 3 ++- modules/user/module.go | 22 +++++++++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index d414c23ec..279c2587d 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -163,7 +163,7 @@ type ( CheckTujianHero(session IUserSession, heros []string) []bool // bingo设置玩家等级 BingoSetUserLv(session IUserSession, lv int32) error - BingoSetUserVipLv(session IUserSession, lv int32) error + BingoSetUserVipLv(session IUserSession, lv int32) (errdata *pb.ErrorData) //添加皮肤资源接口 AddPer(session IUserSession, pers map[string]int32, bPush bool) (errdata *pb.ErrorData) } diff --git a/modules/gm/module.go b/modules/gm/module.go index 704640419..fc3062d51 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -469,7 +469,8 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er } return } - if err = module1.(comm.IUser).BingoSetUserVipLv(session, int32(num)); err == nil { + if errdata = module1.(comm.IUser).BingoSetUserVipLv(session, int32(num)); errdata != nil { + return } this.Debug("使用bingo命令:uid = %s ", log.Field{Key: "uid", Value: session.GetUserId()}, diff --git a/modules/user/module.go b/modules/user/module.go index cc2ac01cc..30305a230 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -999,16 +999,28 @@ func (this *User) recoverUserPs(uid string) { } } -func (this *User) BingoSetUserVipLv(session comm.IUserSession, lv int32) error { +func (this *User) BingoSetUserVipLv(session comm.IUserSession, lv int32) (errdata *pb.ErrorData) { if lv <= 0 { - return comm.NewCustomError(pb.ErrorCode_ReqParameterError) + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), + } + return } update := map[string]interface{}{ "vip": lv, "vipexp": 0, } + // vip 等级校验 + if conf := this.configure.GetVipConfigureData(lv); conf == nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), + } + return + } if err := this.modelUser.Change(session.GetUserId(), update); err == nil { - if err := session.SendMsg(string(this.GetType()), UserSubTypeLvChangedPush, + if err := session.SendMsg(string(this.GetType()), UserSubTypeVipChangedPush, &pb.UserVipChangedPush{Uid: session.GetUserId(), VipExp: 0, VipLv: lv}); err != nil { this.Error("Bingo玩家等级变化 UserVipChangedPush推送失败", log.Field{Key: "uid", Value: session.GetUserId()}, @@ -1032,8 +1044,8 @@ func (this *User) AddPer(session comm.IUserSession, pers map[string]int32, bPush ) if user = this.GetUser(session.GetUserId()); user == nil { errdata = &pb.ErrorData{ - Code: pb.ErrorCode_UserSessionNobeing, - Title: pb.ErrorCode_UserSessionNobeing.ToString(), + Code: pb.ErrorCode_UserSessionNobeing, + Title: pb.ErrorCode_UserSessionNobeing.ToString(), } return } From 752ef2d4b12e9aeec35c6fe120f9123fd20f0a4a Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 9 Jun 2023 12:01:19 +0800 Subject: [PATCH 4/4] =?UTF-8?q?gm=20=E8=B7=B3=E8=BD=AC=E5=8A=9F=E5=A4=AB?= =?UTF-8?q?=E5=A4=A7=E5=B8=88=E5=A1=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 2 +- modules/gm/api_cmd.go | 2 +- modules/gm/module.go | 19 ++++++++++++++----- modules/pagoda/comp_configure.go | 30 +++++++++++++++++++++++++++++- modules/pagoda/module.go | 29 ++++++++++++++++------------- 5 files changed, 61 insertions(+), 21 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index 279c2587d..81b734918 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -310,7 +310,7 @@ type ( } // 修改爬塔 IPagoda interface { - ModifyPagodaFloor(session IUserSession, level int32) (errdata *pb.ErrorData) + ModifyPagodaFloor(session IUserSession, d1 int32, d2 int32) (errdata *pb.ErrorData) CheckUserBasePagodaInfo(uid string) (data *pb.DBPagodaRecord) // 查询玩家最佳通关记录 // Check Rtype84 Rtype85 Rtype86 diff --git a/modules/gm/api_cmd.go b/modules/gm/api_cmd.go index c0eb332d8..1c8641b3a 100644 --- a/modules/gm/api_cmd.go +++ b/modules/gm/api_cmd.go @@ -11,7 +11,7 @@ import ( //bingo:equi,xxx,1 // xxx 装备id -3、修改心魔塔进度:bingo:pataid,10(10代表层数) +3、修改心魔塔进度:bingo:pataid,1,10(页签+层数) 4、修改玩家经验值:bingo:attr,exp,1000(1000代表新增的经验值 // diff --git a/modules/gm/module.go b/modules/gm/module.go index fc3062d51..6f214a319 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -94,12 +94,12 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er log.Field{Key: "T", Value: datas[1]}, log.Field{Key: "N", Value: int32(num)}, ) - } else if len(datas) == 2 && (datas[0] == "pataid") { + } else if len(datas) == 3 && (datas[0] == "pataid") { module1, err := this.service.GetModule(comm.ModulePagoda) if err != nil { return } - num, err := strconv.Atoi(datas[1]) + d1, err := strconv.Atoi(datas[1]) if err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ReqParameterError, @@ -107,11 +107,20 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er } return } - errdata = module1.(comm.IPagoda).ModifyPagodaFloor(session, int32(num)) + d2, err := strconv.Atoi(datas[2]) + if err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Title: pb.ErrorCode_ReqParameterError.ToString(), + } + return + } + errdata = module1.(comm.IPagoda).ModifyPagodaFloor(session, int32(d1), int32(d2)) this.Debug("使用bingo命令:uid = %s ", log.Field{Key: "uid", Value: session.GetUserId()}, - log.Field{Key: "0", Value: datas[0]}, - log.Field{Key: "N", Value: int32(num)}, + log.Field{Key: "p0", Value: datas[0]}, + log.Field{Key: "p1", Value: datas[1]}, + log.Field{Key: "p3", Value: datas[2]}, ) } else if len(datas) == 1 && (datas[0] == "Iamyoudad" || datas[0] == "iamyoudad") { var ( diff --git a/modules/pagoda/comp_configure.go b/modules/pagoda/comp_configure.go index 140bc1a70..7f75f6180 100644 --- a/modules/pagoda/comp_configure.go +++ b/modules/pagoda/comp_configure.go @@ -1,6 +1,7 @@ package pagoda import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/log" @@ -25,6 +26,7 @@ type configureComp struct { hlock sync.RWMutex _checkType map[int32][]*cfg.GamePassCheckData // key type + _mapPagoda map[int32]*cfg.GamePagodaData } //组件初始化接口 @@ -38,7 +40,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp this._checkType = make(map[int32][]*cfg.GamePassCheckData, 0) configure.RegisterConfigure(game_passcheck, cfg.NewGamePassCheck, this.LoadPassCheck) - + configure.RegisterConfigure(game_pagoda, cfg.NewGamePagoda, this.LoadPagoda) return } @@ -161,3 +163,29 @@ func (this *configureComp) GetPagodaConfigData(id int32) (data *cfg.GamePagodaDa err = comm.NewNotFoundConfErr(moduleName, game_pagoda, id) return } + +func (this *configureComp) LoadPagoda() { + var err error + if v, err := this.GetConfigure(game_pagoda); err == nil { + if configure, ok := v.(*cfg.GamePagoda); ok { + this._mapPagoda = make(map[int32]*cfg.GamePagodaData) + this.hlock.Lock() + defer this.hlock.Unlock() + for _, value := range configure.GetDataList() { + key := value.Tab<<16 + value.LayerNum + this._mapPagoda[key] = value + } + return + } + } + log.Errorf("get game_pagoda conf err:%v", err) + return +} + +func (this *configureComp) GetPagodaConfBytab(tab int32, ly int32) (data *cfg.GamePagoda, err error) { + if _, ok := this._mapPagoda[tab<<16+ly]; ok { + return + } + err = comm.NewNotFoundConfErr("pagoda", game_pagoda, fmt.Errorf("tab %d ,ly %d not found", tab, ly)) + return +} diff --git a/modules/pagoda/module.go b/modules/pagoda/module.go index e5796861a..d83d347e5 100644 --- a/modules/pagoda/module.go +++ b/modules/pagoda/module.go @@ -85,22 +85,25 @@ func (this *Pagoda) Start() (err error) { } // 给gm 调用修改爬塔层数 -func (this *Pagoda) ModifyPagodaFloor(session comm.IUserSession, level int32) (errdata *pb.ErrorData) { +func (this *Pagoda) ModifyPagodaFloor(session comm.IUserSession, d1 int32, d2 int32) (errdata *pb.ErrorData) { list, _ := this.modelPagoda.getPagodaList(session.GetUserId()) - if list != nil { - - list.PagodaId = level - mapData := make(map[string]interface{}, 0) - mapData["pagodaId"] = level - // 通关校验 - _, err := this.configure.GetPagodaConfigData(level + 1) - if err == nil { - list.Complete = true - mapData["complete"] = true + //参数校验 + _, err := this.configure.GetPagodaConfBytab(d1, d2) + if err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), + Message: err.Error(), } - errdata = this.ModifyPagodaData(session.GetUserId(), mapData) - session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list}) + return } + list.Data[d1] = d2 + list.PagodaId = d2 + mapData := make(map[string]interface{}, 0) + mapData["data"] = list.Data + mapData["pagodaId"] = list.PagodaId + errdata = this.ModifyPagodaData(session.GetUserId(), mapData) + session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list}) return }