掠夺消耗资源解锁队列
This commit is contained in:
parent
40d54a061b
commit
c3a06a86f2
@ -3,6 +3,7 @@ package plunder
|
|||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/configure"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.PlunderGetListReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.PlunderGetListReq) (errdata *pb.ErrorData) {
|
||||||
@ -15,11 +16,12 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PlunderGetListRe
|
|||||||
err error
|
err error
|
||||||
list *pb.DBPlunder
|
list *pb.DBPlunder
|
||||||
land *pb.DBPlunderLand
|
land *pb.DBPlunderLand
|
||||||
|
update map[string]interface{}
|
||||||
)
|
)
|
||||||
if errdata = this.GetListCheck(session, req); errdata != nil {
|
if errdata = this.GetListCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
update = make(map[string]interface{})
|
||||||
if list, err = this.module.modelPlunder.getPlunderData(session.GetUserId()); err != nil {
|
if list, err = this.module.modelPlunder.getPlunderData(session.GetUserId()); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
@ -49,9 +51,17 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PlunderGetListRe
|
|||||||
if len(list.Source) == 0 {
|
if len(list.Source) == 0 {
|
||||||
list.Source, err = this.module.modelPlunder.refreshGoodsInfo()
|
list.Source, err = this.module.modelPlunder.refreshGoodsInfo()
|
||||||
list.Setout = []int32{}
|
list.Setout = []int32{}
|
||||||
this.module.modelPlunder.changePlunderData(session.GetUserId(), map[string]interface{}{
|
update["setout"] = list.Setout
|
||||||
"source": list.Source,
|
}
|
||||||
})
|
// 校验解锁的是否到期
|
||||||
|
for _, v := range list.Line {
|
||||||
|
if v.Closetime > 0 && v.Closetime < configure.Now().Unix() {
|
||||||
|
v.Closetime = -1
|
||||||
|
update["line"] = list.Line
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(update) > 0 {
|
||||||
|
this.module.modelPlunder.changePlunderData(session.GetUserId(), update)
|
||||||
}
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), "getlist", &pb.PlunderGetListResp{
|
session.SendMsg(string(this.module.GetType()), "getlist", &pb.PlunderGetListResp{
|
||||||
List: list,
|
List: list,
|
||||||
|
@ -3,6 +3,7 @@ package plunder
|
|||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/configure"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -42,12 +43,17 @@ func (this *apiComp) Unlock(session comm.IUserSession, req *pb.PlunderUnlockReq)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 校验数据够不够
|
// 校验数据够不够
|
||||||
|
|
||||||
globalConf := this.module.ModuleTools.GetGlobalConf()
|
globalConf := this.module.ModuleTools.GetGlobalConf()
|
||||||
|
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{globalConf.PlunderPvpCollegeNum}, true); errdata != nil {
|
||||||
this.module.ConsumeRes(session, []*cfg.Gameatn{globalConf.PlunderPvpCollegeNum}, true)
|
return
|
||||||
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), "unlock", &pb.PlunderUnlockReq{})
|
list.Line[req.Pos].Closetime = configure.Now().Unix() + int64(globalConf.PlunderPvpCollegeTime)*24*3600
|
||||||
|
this.module.modelPlunder.changePlunderData(session.GetUserId(), map[string]interface{}{
|
||||||
|
"line": list.Line,
|
||||||
|
})
|
||||||
|
session.SendMsg(string(this.module.GetType()), "unlock", &pb.PlunderUnlockResp{
|
||||||
|
Line: list.Line,
|
||||||
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user