相同资源整合一起
This commit is contained in:
parent
37d7998748
commit
18b4b318ed
@ -24,6 +24,7 @@ func (this *apiComp) WarOrder(session comm.IUserSession, req *pb.PagodaWarOrderR
|
||||
resID []int32 // 当前可领取的id
|
||||
vipID []int32 // 有vip的情况 可领取的id
|
||||
mapData map[string]interface{}
|
||||
bReward bool
|
||||
)
|
||||
mapData = make(map[string]interface{}, 0)
|
||||
//this.WarOrderCheck(session, req)
|
||||
@ -33,10 +34,6 @@ func (this *apiComp) WarOrder(session comm.IUserSession, req *pb.PagodaWarOrderR
|
||||
code = pb.ErrorCode_PagodaConditionErr // 领取条件没达到
|
||||
return
|
||||
}
|
||||
if list.PagodaId <= list.PassCheckID { // 层数校验
|
||||
code = pb.ErrorCode_PagodaConditionErr // 领取条件没达到
|
||||
return
|
||||
}
|
||||
|
||||
payPoint := this.module.configure.GetPassCheckPointByTtype(1)
|
||||
if payPoint != "" {
|
||||
@ -45,25 +42,39 @@ func (this *apiComp) WarOrder(session comm.IUserSession, req *pb.PagodaWarOrderR
|
||||
vip = true
|
||||
}
|
||||
}
|
||||
|
||||
if list.PagodaId < list.PassCheckID { // 层数校验
|
||||
//code = pb.ErrorCode_PagodaConditionErr // 领取条件没达到
|
||||
//return
|
||||
bReward = true
|
||||
}
|
||||
if vip && bReward {
|
||||
if list.PagodaId < list.VipPassCheckID { // 层数校验
|
||||
code = pb.ErrorCode_PagodaConditionErr // 领取条件没达到
|
||||
return
|
||||
}
|
||||
}
|
||||
conf := this.module.configure.GetPassCheckByTtype(1)
|
||||
|
||||
for pos, v := range conf {
|
||||
if int32(pos) <= list.PassCheckID {
|
||||
for _, v := range conf {
|
||||
if v.Parameter <= list.PassCheckID {
|
||||
continue
|
||||
}
|
||||
if v.Parameter >= list.PagodaId {
|
||||
if v.Parameter <= list.PagodaId {
|
||||
resID = append(resID, v.Id)
|
||||
mapData["passCheckID"] = v.Parameter
|
||||
list.PassCheckID = v.Parameter
|
||||
}
|
||||
}
|
||||
if vip {
|
||||
for pos, v := range conf {
|
||||
if int32(pos) <= list.VipPassCheckID {
|
||||
for _, v := range conf {
|
||||
if v.Parameter <= list.VipPassCheckID {
|
||||
continue
|
||||
}
|
||||
if v.Parameter >= list.PagodaId {
|
||||
if v.Parameter <= list.PagodaId {
|
||||
vipID = append(vipID, v.Id)
|
||||
mapData["vipPassCheckID"] = v.Parameter
|
||||
list.VipPassCheckID = v.Parameter
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,17 +89,36 @@ func (this *apiComp) WarOrder(session comm.IUserSession, req *pb.PagodaWarOrderR
|
||||
resCfg = append(resCfg, confCheck.PayReward)
|
||||
}
|
||||
}
|
||||
if code = this.module.DispenseRes(session, resCfg, true); code != pb.ErrorCode_Success { // 发放奖励
|
||||
// 资源整合
|
||||
var totalRes []*cfg.Gameatn
|
||||
for _, v := range resCfg {
|
||||
b := false
|
||||
for _, v1 := range totalRes {
|
||||
if v.A == v1.A && v.T == v1.T {
|
||||
b = true
|
||||
v1.N += v.N
|
||||
break
|
||||
}
|
||||
}
|
||||
if !b {
|
||||
totalRes = append(totalRes, v)
|
||||
}
|
||||
}
|
||||
if len(totalRes) > 0 {
|
||||
if code = this.module.DispenseRes(session, totalRes, true); code != pb.ErrorCode_Success { // 发放奖励
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 转成协议格式
|
||||
for _, v := range resCfg {
|
||||
for _, v := range totalRes {
|
||||
res = append(res, &pb.UserAssets{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: v.N,
|
||||
})
|
||||
}
|
||||
|
||||
code = this.module.ModifySeasonPagodaData(session.GetUserId(), mapData)
|
||||
session.SendMsg(string(this.module.GetType()), PagodaWarOrderResp, &pb.PagodaWarOrderResp{
|
||||
Data: list,
|
||||
|
Loading…
Reference in New Issue
Block a user