上传自选宝箱

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 (
item *pb.DB_UserItemData
itemcf *cfg.GameItemData
prop []*cfg.GameDropData
err error
)
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: //自选宝箱
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{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: fmt.Sprintf("掉落组未找到:%d", itemcf.BoxId),
Message: fmt.Sprintf("掉落组未找到:%d", slt),
}
return
}
@ -729,26 +731,11 @@ func (this *ModelItemsComp) useitem(session comm.IUserSession, gid string, amoun
return
}
var sale []*cfg.Gameatn
for _, v := range prop {
if v.Id == slt {
for _, v1 := range v.Prize {
sale = append(sale, &cfg.Gameatn{
A: v1.A,
T: v1.T,
N: v1.N * int32(amount),
A: lottery.Itemid.A,
T: lottery.Itemid.T,
N: lottery.Itemid.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 {
return
}