diff --git a/comm/imodule.go b/comm/imodule.go index 6ca8e005a..53911c930 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -475,6 +475,7 @@ type ( // 清除玩家踢馆状态 CleanUpNpc(uid string) + GetAllJxRes() (res []string, err error) } //捕羊大赛 diff --git a/modules/gm/api_cmd.go b/modules/gm/api_cmd.go index bff398d25..c0eb332d8 100644 --- a/modules/gm/api_cmd.go +++ b/modules/gm/api_cmd.go @@ -38,6 +38,7 @@ import ( 22、bingo:itemtype,1,1 // 获取某种类型所有道具(道具类型,数量) 23、bingo:viplv,50 24、bingo:cleannpc +31、bingo:jx // 获得所有教习资源 */ //参数校验 func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (errdata *pb.ErrorData) { diff --git a/modules/gm/module.go b/modules/gm/module.go index b480d1f7b..704640419 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -488,13 +488,33 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "0", Value: datas[0]}, ) - } else if len(datas) == 1 && (datas[0] == "test") { - module1, err := this.service.GetModule(comm.ModuleCaravan) + } else if len(datas) == 1 && (datas[0] == "jx") { + module, err := this.service.GetModule(comm.ModulePractice) if err != nil { return } + var res []*cfg.Gameatn + if wt, ok := module.(comm.IPractice); ok { + if r, err := wt.GetAllJxRes(); err == nil { + for _, v1 := range r { + res = append(res, &cfg.Gameatn{ + A: "panda", + T: v1, + N: 1, + }) + } + } + } - module1.(comm.ICaravan).TestFunc(session) + errdata = this.DispenseRes(session, res, true) + if errdata != nil { + this.Errorf("资源发放失败,%v", errdata) + } + this.Debug("使用bingo命令", + log.Field{Key: "uid", Value: session.GetUserId()}, + log.Field{Key: "param", Value: datas[0]}, + log.Field{Key: "res", Value: res}, + ) } } } diff --git a/modules/practice/configure.go b/modules/practice/configure.go index 511c1b513..b6b3407e6 100644 --- a/modules/practice/configure.go +++ b/modules/practice/configure.go @@ -213,3 +213,20 @@ func (this *configureComp) getDispatchBattleData(id int32) (configure *cfg.GameD } return } + +func (this *configureComp) getAllGamePandamasJx() (res []string, err error) { + var ( + v interface{} + ) + if v, err = this.GetConfigure(game_pandamasjx); err == nil { + + if configure, ok := v.(*cfg.GamePandamasJx); ok { + for _, v := range configure.GetDataList() { + res = append(res, v.Id) + } + return + } + } + this.module.Errorln(err) + return +} diff --git a/modules/practice/module.go b/modules/practice/module.go index 872c00cc3..5b9be462e 100644 --- a/modules/practice/module.go +++ b/modules/practice/module.go @@ -430,3 +430,7 @@ func (this *Practice) CleanUpNpc(uid string) { "refresh": result.Refresh, }) } + +func (this *Practice) GetAllJxRes() (res []string, err error) { + return this.configure.getAllGamePandamasJx() +}