gm 一键增加教习资源
This commit is contained in:
parent
1b2e96a0c1
commit
7b48e25978
@ -475,6 +475,7 @@ type (
|
||||
|
||||
// 清除玩家踢馆状态
|
||||
CleanUpNpc(uid string)
|
||||
GetAllJxRes() (res []string, err error)
|
||||
}
|
||||
|
||||
//捕羊大赛
|
||||
|
@ -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) {
|
||||
|
@ -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},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user