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