This commit is contained in:
liwei1dao 2024-01-17 19:51:30 +08:00
commit e75f8cf4b3
3 changed files with 60 additions and 3 deletions

View File

@ -275,6 +275,17 @@ func (this *MCompConfigure) GetItemConfigureByType(useType int32) (item []*cfg.G
}
return
}
func (this *MCompConfigure) GetItemConfigureByBagType(bagType int32) (item []*cfg.GameItemData) {
if v, err := this.GetConfigure(game_item); err == nil {
for _, v1 := range v.(*cfg.GameItem).GetDataMap() {
if v1.Bagtype == bagType {
item = append(item, v1)
}
}
}
return
}
func (this *MCompConfigure) GetEquipmentConfigureById(equipmentId string) (configure *cfg.GameEquipData) {
if v, err := this.GetConfigure(game_equip); err == nil {

View File

@ -477,15 +477,53 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
return
}
_data := this.configure.GetItemConfigureByType(int32(num1))
var res []*cfg.Gameatn
for _, v := range _data {
res := &cfg.Gameatn{
res = append(res, &cfg.Gameatn{
A: "item",
T: v.Id,
N: int32(num2),
})
}
if errdata = this.DispenseRes(session, res, true); errdata != nil {
this.Debugf("DispenseRes err :uid = %s,code = %d", datas[0], errdata)
}
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]},
)
} else if len(datas) == 3 && (datas[0] == "bagtype") {
num1, err := strconv.Atoi(datas[1])
if err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(),
}
if errdata = this.DispenseRes(session, []*cfg.Gameatn{res}, true); errdata != nil {
this.Debugf("DispenseRes err :uid = %s,code = %d", datas[0], errdata)
return
}
num2, err := strconv.Atoi(datas[2])
if err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(),
}
return
}
_data := this.configure.GetItemConfigureByBagType(int32(num1))
var res []*cfg.Gameatn
for _, v := range _data {
res = append(res, &cfg.Gameatn{
A: "item",
T: v.Id,
N: int32(num2),
})
}
if errdata = this.DispenseRes(session, res, true); errdata != nil {
this.Debugf("DispenseRes err :uid = %s,code = %d", datas[0], errdata)
}
this.Debug("使用bingo命令:uid = %s ",
log.Field{Key: "uid", Value: session.GetUserId()},

View File

@ -41,6 +41,14 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PlunderGetListRe
this.module.modelPlunder.changePlunderData(session.GetUserId(), map[string]interface{}{
"landid": list.Landid,
})
} else {
if land, err = this.module.modelLand.getPlunderLandData(list.Landid); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Message: err.Error(),
}
return
}
}
session.SendMsg(string(this.module.GetType()), "getlist", &pb.PlunderGetListResp{
List: list,