获取某种类型所有道具(道具类型,数量)
This commit is contained in:
parent
2f52223456
commit
b6e490ee17
@ -332,3 +332,14 @@ func (this *MCompConfigure) GetVipConfigureData(lv int32) (item *cfg.GameVipData
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *MCompConfigure) GetItemConfigureByType(useType int32) (item []*cfg.GameItemData) {
|
||||||
|
if v, err := this.GetConfigure(game_item); err == nil {
|
||||||
|
for _, v1 := range v.(*cfg.GameItem).GetDataMap() {
|
||||||
|
if v1.Usetype == useType {
|
||||||
|
item = append(item, v1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -37,6 +37,7 @@ import (
|
|||||||
20、bingo:cleanitem
|
20、bingo:cleanitem
|
||||||
21、bingo:allequip
|
21、bingo:allequip
|
||||||
21、bingo:chat,1
|
21、bingo:chat,1
|
||||||
|
22、bingo:itemtype,1,1 // 获取某种类型所有道具(道具类型,数量)
|
||||||
*/
|
*/
|
||||||
//参数校验
|
//参数校验
|
||||||
func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (code pb.ErrorCode) {
|
func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (code pb.ErrorCode) {
|
||||||
|
@ -425,6 +425,32 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
|||||||
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) == 3 && (datas[0] == "itemtype") {
|
||||||
|
num1, err := strconv.Atoi(datas[1])
|
||||||
|
if err != nil {
|
||||||
|
code = pb.ErrorCode_ReqParameterError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
num2, err := strconv.Atoi(datas[2])
|
||||||
|
if err != nil {
|
||||||
|
code = pb.ErrorCode_ReqParameterError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_data := this.configure.GetItemConfigureByType(int32(num1))
|
||||||
|
for _, v := range _data {
|
||||||
|
res := &cfg.Gameatn{
|
||||||
|
A: "item",
|
||||||
|
T: v.Id,
|
||||||
|
N: int32(num2),
|
||||||
|
}
|
||||||
|
this.DispenseRes(session, []*cfg.Gameatn{res}, true)
|
||||||
|
}
|
||||||
|
this.Debug("使用bingo命令:uid = %s ",
|
||||||
|
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||||
|
log.Field{Key: "0", Value: datas[0]},
|
||||||
|
log.Field{Key: "1", Value: datas[1]},
|
||||||
|
log.Field{Key: "2", Value: datas[2]},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user