上传自选宝箱

This commit is contained in:
liwei 2023-07-06 15:27:25 +08:00
parent bea92b23d6
commit 6961827dbf

View File

@ -610,7 +610,6 @@ func (this *ModelItemsComp) useitem(session comm.IUserSession, gid string, amoun
var ( var (
item *pb.DB_UserItemData item *pb.DB_UserItemData
itemcf *cfg.GameItemData itemcf *cfg.GameItemData
prop []*cfg.GameDropData
err error err error
) )
if item, err = this.module.modelItems.QueryUserPackByGridId(session.GetUserId(), gid); err != nil { if item, err = this.module.modelItems.QueryUserPackByGridId(session.GetUserId(), gid); err != nil {
@ -717,11 +716,14 @@ func (this *ModelItemsComp) useitem(session comm.IUserSession, gid string, amoun
} }
} }
case itemuse_optionalbox: //自选宝箱 case itemuse_optionalbox: //自选宝箱
if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil { var (
lottery *cfg.GameLotteryData
)
if lottery, err = this.module.ModuleTools.GetGroupDataByLotteryId(slt); err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound, Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(), Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: fmt.Sprintf("掉落组未找到:%d", itemcf.BoxId), Message: fmt.Sprintf("掉落组未找到:%d", slt),
} }
return return
} }
@ -729,26 +731,11 @@ func (this *ModelItemsComp) useitem(session comm.IUserSession, gid string, amoun
return return
} }
var sale []*cfg.Gameatn var sale []*cfg.Gameatn
for _, v := range prop { sale = append(sale, &cfg.Gameatn{
if v.Id == slt { A: lottery.Itemid.A,
for _, v1 := range v.Prize { T: lottery.Itemid.T,
sale = append(sale, &cfg.Gameatn{ N: lottery.Itemid.N * int32(amount),
A: v1.A, })
T: v1.T,
N: v1.N * int32(amount),
})
}
}
}
if sale == nil {
this.module.Errorf("no found target sale:%v", slt)
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(),
}
return
}
if errdata = this.module.DispenseRes(session, sale, true); errdata != nil { if errdata = this.module.DispenseRes(session, sale, true); errdata != nil {
return return
} }