gm 一键增加教习资源

This commit is contained in:
meixiongfeng 2023-06-07 14:38:55 +08:00
parent 1b2e96a0c1
commit 7b48e25978
5 changed files with 46 additions and 3 deletions

View File

@ -475,6 +475,7 @@ type (
// 清除玩家踢馆状态 // 清除玩家踢馆状态
CleanUpNpc(uid string) CleanUpNpc(uid string)
GetAllJxRes() (res []string, err error)
} }
//捕羊大赛 //捕羊大赛

View File

@ -38,6 +38,7 @@ import (
22bingo:itemtype,1,1 // 获取某种类型所有道具(道具类型,数量) 22bingo:itemtype,1,1 // 获取某种类型所有道具(道具类型,数量)
23bingo:viplv,50 23bingo:viplv,50
24bingo:cleannpc 24bingo:cleannpc
31bingo:jx // 获得所有教习资源
*/ */
//参数校验 //参数校验
func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (errdata *pb.ErrorData) { func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (errdata *pb.ErrorData) {

View File

@ -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: "uid", Value: session.GetUserId()},
log.Field{Key: "0", Value: datas[0]}, log.Field{Key: "0", Value: datas[0]},
) )
} else if len(datas) == 1 && (datas[0] == "test") { } else if len(datas) == 1 && (datas[0] == "jx") {
module1, err := this.service.GetModule(comm.ModuleCaravan) module, err := this.service.GetModule(comm.ModulePractice)
if err != nil { if err != nil {
return 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},
)
} }
} }
} }

View File

@ -213,3 +213,20 @@ func (this *configureComp) getDispatchBattleData(id int32) (configure *cfg.GameD
} }
return 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
}

View File

@ -430,3 +430,7 @@ func (this *Practice) CleanUpNpc(uid string) {
"refresh": result.Refresh, "refresh": result.Refresh,
}) })
} }
func (this *Practice) GetAllJxRes() (res []string, err error) {
return this.configure.getAllGamePandamasJx()
}