上传随机宝箱批量使用代码
This commit is contained in:
parent
926b45ffde
commit
7a7c076dec
@ -754,21 +754,27 @@ func (this *ModelItemsComp) useitem(session comm.IUserSession, gid string, amoun
|
||||
}
|
||||
case itemuse_randombox: //宝箱
|
||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||
if prop := this.module.ModuleTools.GetGroupDataByLottery(itemcf.BoxId, user.Vip, user.Lv); len(prop) == 0 {
|
||||
//if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: fmt.Sprintf("掉落组未找到:%d", itemcf.BoxId),
|
||||
props := make([]*cfg.Gameatn, 0)
|
||||
for i := int32(0); i < amount; i++ {
|
||||
if prop := this.module.ModuleTools.GetGroupDataByLottery(itemcf.BoxId, user.Vip, user.Lv); len(prop) == 0 {
|
||||
//if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: fmt.Sprintf("掉落组未找到:%d", itemcf.BoxId),
|
||||
}
|
||||
return
|
||||
} else {
|
||||
props = append(props, prop...)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if errdata = this.module.AddItemforGrid(session, gid, -1*int32(amount), true); errdata != nil {
|
||||
return
|
||||
}
|
||||
if errdata = this.module.DispenseRes(session, props, true); errdata != nil {
|
||||
return
|
||||
} else {
|
||||
if errdata = this.module.AddItemforGrid(session, gid, -1*int32(amount), true); errdata != nil {
|
||||
return
|
||||
}
|
||||
if errdata = this.module.DispenseRes(session, prop, true); errdata != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case itemuse_staminapotion: //体力药剂使用
|
||||
|
Loading…
Reference in New Issue
Block a user