上传充值月卡问题
This commit is contained in:
parent
01202296ee
commit
356c42614e
@ -25,6 +25,7 @@ const (
|
||||
itemuse_exchange int32 = 3 //合成/分解(体力,兑换)
|
||||
itemuse_optionalbox int32 = 4 //自选宝箱
|
||||
itemuse_randombox int32 = 5 //随机宝箱
|
||||
itemuse_staminapotion int32 = 6 //体力药剂使用
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -771,6 +771,49 @@ func (this *ModelItemsComp) useitem(session comm.IUserSession, gid string, amoun
|
||||
if errdata = this.module.DispenseRes(session, sale, true); errdata != nil {
|
||||
return
|
||||
}
|
||||
case itemuse_staminapotion: //体力药剂使用
|
||||
if itemcf.DecomposeGet == nil || len(itemcf.DecomposeGet) == 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: fmt.Sprintf("道具分解未配置! 道具id:%s ", itemcf.Id),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if itemcf.SynthetizeNum*int32(amount) > int32(item.Amount) { //碎片数量不够
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ItemsNoEnough,
|
||||
Title: pb.ErrorCode_ItemsNoEnough.ToString(),
|
||||
Message: fmt.Sprintf("道具Id:%s", itemcf.Id),
|
||||
}
|
||||
return
|
||||
}
|
||||
sale := make([]*cfg.Gameatn, 0, len(itemcf.DecomposeDeplete))
|
||||
for _, v := range itemcf.DecomposeDeplete {
|
||||
sale = append(sale, &cfg.Gameatn{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: v.N * int32(amount),
|
||||
})
|
||||
}
|
||||
if errdata = this.module.ConsumeRes(session, sale, true); errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if errdata = this.module.AddItemforGrid(session, gid, -1*int32(amount), true); errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
sale = make([]*cfg.Gameatn, len(itemcf.Sale))
|
||||
for i, v := range itemcf.DecomposeGet {
|
||||
temp := *v
|
||||
sale[i] = &temp
|
||||
sale[i].N = v.N * int32(amount)
|
||||
}
|
||||
if errdata = this.module.DispenseRes(session, sale, true); errdata != nil {
|
||||
return
|
||||
}
|
||||
default:
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ItemsUseNotSupported,
|
||||
|
@ -58,7 +58,7 @@ func (this *configureComp) GetPrivilegeCard(id string) (data *cfg.GamePrivilegeC
|
||||
v interface{}
|
||||
)
|
||||
if v, err = this.GetConfigure(game_privilegecard); err == nil {
|
||||
if configure, ok := v.(*cfg.GamePrivilegeCard); !ok {
|
||||
if configure, ok := v.(*cfg.GamePrivilegeCard); ok {
|
||||
if data = configure.Get(id); data != nil {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user