diff --git a/modules/items/modelitems.go b/modules/items/modelitems.go index f9680c669..dc13e7309 100644 --- a/modules/items/modelitems.go +++ b/modules/items/modelitems.go @@ -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), - }) - } - } - } - 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 - } - + sale = append(sale, &cfg.Gameatn{ + A: lottery.Itemid.A, + T: lottery.Itemid.T, + N: lottery.Itemid.N * int32(amount), + }) if errdata = this.module.DispenseRes(session, sale, true); errdata != nil { return }