商店购买打折
This commit is contained in:
parent
1045cca0f0
commit
23d44b7c00
@ -29,7 +29,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb
|
||||
totalCount int32 // 当前购买的总次数
|
||||
update map[string]interface{}
|
||||
price []int32 // 购买所需的价钱
|
||||
totalCost float32 // 购买打折系数
|
||||
totalCost float64 // 购买打折系数
|
||||
udata *pb.DBUser
|
||||
)
|
||||
update = make(map[string]interface{})
|
||||
@ -75,16 +75,17 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb
|
||||
for i := record.Onebuy; i < req.BuyCount; i++ {
|
||||
|
||||
if i >= int32(len(price)) {
|
||||
totalCost += float32(price[len(price)-1]) / 1000
|
||||
totalCost += float64(price[len(price)-1]) / 1000
|
||||
continue
|
||||
}
|
||||
totalCost += float32(price[i]) / 1000
|
||||
totalCost += float64(price[i]) / 1000
|
||||
}
|
||||
need = make([]*cfg.Gameatn, len(conf.Need))
|
||||
for i, v := range conf.Need {
|
||||
need[i] = &cfg.Gameatn{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: int32(math.Ceil(float64(v.N) * float64(totalCost))),
|
||||
N: int32(math.Ceil(float64(v.N) * totalCost)),
|
||||
}
|
||||
}
|
||||
// 消耗
|
||||
|
Loading…
Reference in New Issue
Block a user