事件模式下任务监听
This commit is contained in:
parent
d88706afec
commit
253b901833
@ -6,7 +6,7 @@
|
||||
"PreviouStage": 0,
|
||||
"StageName": {
|
||||
"key": "stonehenge_stageconfig_StageName_1",
|
||||
"text": "石阵1"
|
||||
"text": "石阵2"
|
||||
},
|
||||
"RoomId": 1,
|
||||
"RoomGroup": 110100,
|
||||
|
@ -710,4 +710,7 @@ type (
|
||||
IIsland interface {
|
||||
IPayDelivery
|
||||
}
|
||||
IIntegral interface {
|
||||
IBuriedUpdateNotify
|
||||
}
|
||||
)
|
||||
|
@ -75,6 +75,23 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.IntegralGetListR
|
||||
update["reward2"] = list.Reward2
|
||||
update["buff"] = list.Buff
|
||||
update["score"] = list.Score
|
||||
|
||||
if list.Itype == 2 {
|
||||
var szTaskid []int32
|
||||
for _, v := range this.module.configure.GetIntegralCondition() {
|
||||
szTaskid = append(szTaskid, v.TaskId) // 获取任务id
|
||||
}
|
||||
if data, err := this.module.ModuleBuried.CheckCondition(session.GetUserId(), szTaskid...); err == nil {
|
||||
for _, v := range data {
|
||||
|
||||
if v.State == pb.BuriedItemFinishState_buried_finish {
|
||||
if c, e := this.module.configure.GetIntegralConditionByTask(v.Conid); e == nil {
|
||||
list.Buff[v.Conid] = c.Id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(update) > 0 {
|
||||
if err = this.module.modelIntegral.modifyIntegralData(session.GetUserId(), update); err != nil {
|
||||
|
@ -60,8 +60,10 @@ func (this *modelIntegral) getIntegralList(uid string) (result *pb.DBIntegralBos
|
||||
|
||||
var conf *cfg.GameIntegralBossData
|
||||
if conf, err = this.module.configure.GetStageBoss(result.Hid, 1); err == nil {
|
||||
result.Itype = conf.Itype // 获取类型
|
||||
result.Itype = conf.Itype // 获取类型 1 难度模式 2 事件模式
|
||||
result.Nandu = 1 // 初始难度1
|
||||
// 只有 事件模式才有buff
|
||||
if result.Itype == 2 {
|
||||
var szTaskid []int32
|
||||
for _, v := range this.module.configure.GetIntegralCondition() {
|
||||
szTaskid = append(szTaskid, v.TaskId) // 获取任务id
|
||||
@ -77,6 +79,7 @@ func (this *modelIntegral) getIntegralList(uid string) (result *pb.DBIntegralBos
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err = this.Add(uid, result) // 入库
|
||||
return
|
||||
|
@ -4,7 +4,9 @@ import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/base"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
type Integral struct {
|
||||
@ -52,3 +54,56 @@ func (this *Integral) OnInstallComp() {
|
||||
this.modelIntegral = this.RegisterComp(new(modelIntegral)).(*modelIntegral)
|
||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||
}
|
||||
|
||||
// 任务条件达成通知
|
||||
func (this *Integral) BuriedsNotify(session comm.IUserSession, conds []*pb.ConIProgress) {
|
||||
var bChange bool
|
||||
this.Debug("积分bossm条件达成通知", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "conds", Value: conds})
|
||||
dt, err := this.modelIntegral.getIntegralList(session.GetUserId())
|
||||
|
||||
if dt.Itype != 2 { // 只有事件模式才有debuff
|
||||
return
|
||||
}
|
||||
confList := this.configure.GetIntegralCondition()
|
||||
if err != nil {
|
||||
this.Error(err.Error())
|
||||
return
|
||||
}
|
||||
condMap := make(map[int32]*pb.ConIProgress)
|
||||
for _, conf := range confList {
|
||||
for _, cond := range conds {
|
||||
if cond.Conid == conf.TaskId {
|
||||
condMap[conf.TaskId] = cond
|
||||
}
|
||||
}
|
||||
}
|
||||
update := make(map[string]interface{})
|
||||
|
||||
if dt.Buff == nil {
|
||||
dt.Buff = make(map[int32]int32)
|
||||
for _, v := range condMap {
|
||||
if v.State == pb.BuriedItemFinishState_buried_finish {
|
||||
if c, err := this.configure.GetIntegralConditionByTask(v.Conid); err == nil {
|
||||
dt.Buff[c.Id] = 1
|
||||
bChange = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range condMap {
|
||||
if dt.Buff[k] != 1 && v.State == pb.BuriedItemFinishState_buried_finish {
|
||||
dt.Buff[k] = 1
|
||||
bChange = true
|
||||
|
||||
}
|
||||
}
|
||||
if bChange {
|
||||
update["buff"] = dt.Buff
|
||||
if err := this.modelIntegral.modifyIntegralData(session.GetUserId(), update); err != nil {
|
||||
this.Error(err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user