diff --git a/modules/stonehenge/api_event.go b/modules/stonehenge/api_event.go index 47243cffb..7b097ca2a 100644 --- a/modules/stonehenge/api_event.go +++ b/modules/stonehenge/api_event.go @@ -102,7 +102,7 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq stone.Userbuff[buffid] = 1 stone.Rooms.Selectbuff = []int32{} update["userbuff"] = stone.Userbuff - this.module.modelStonehengeBook.addStonehengeBook(session.GetUserId(), conf.Type, buffid) + this.module.modelStonehengeBook.addStonehengeBook(session.GetUserId(), conf.Type, conf.SkillId) } } else { // 参数错误 errdata = &pb.ErrorData{ @@ -279,6 +279,48 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq } } } + case EventType13: // 扣除背包中指定道具数量 + amount := this.module.ModuleItems.QueryItemAmount(session.GetUserId(), strconv.Itoa(int(eventConf.Value2))) // 查询道具的数量 + if amount > 0 { + if n := math.Floor(float64(int32(amount)*eventConf.Value1) / 1000); n > 0 { + atn := &cfg.Gameatn{ + A: "item", + T: strconv.Itoa(int(eventConf.Value2)), + N: int32(n), + } + if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{atn}, true); errdata != nil { + return + } + } + } + case EventType24: // 增加背包中指定道具数量 + amount := this.module.ModuleItems.QueryItemAmount(session.GetUserId(), strconv.Itoa(int(eventConf.Value2))) + if amount > 0 { + if n := math.Floor(float64(int32(amount)*eventConf.Value1) / 1000); n > 0 { + atn := &cfg.Gameatn{ + A: "item", + T: strconv.Itoa(int(eventConf.Value2)), + N: int32(n), + } + if errdata = this.module.DispenseRes(session, []*cfg.Gameatn{atn}, true); errdata != nil { + return + } + } + } + case EventType26: //所有1级buff强化至2级 + // 查询所有1级buff + for _, v := range stone.Userbuff { + if conf, e := this.module.configure.GetStoneBuffDataById(v); e != nil { + if conf.BuffLevel == 1 { + // 是否有2级 + if nextConf, e := this.module.configure.GetStoneBuffDataById(v + 1); e != nil { + delete(stone.Userbuff, v) + stone.Userbuff[nextConf.BuffId] = 1 + } + } + } + } + update["userbuff"] = stone.Userbuff } diff --git a/modules/stonehenge/core.go b/modules/stonehenge/core.go index f15b79e48..514ee3a1c 100644 --- a/modules/stonehenge/core.go +++ b/modules/stonehenge/core.go @@ -4,6 +4,7 @@ package stonehenge const ( EventType10 = 10 // 宝箱事件 EventType11 = 11 // 剧情事件 + EventType13 = 13 // 扣除背包中指定道具数量 EventType14 = 14 // 战斗事件 EventType16 = 16 // 捡垃圾事件 EventType17 = 17 // 回血事件 @@ -11,7 +12,9 @@ const ( EventType19 = 19 // 扣血事件 非场景 EventType20 = 20 // 克隆一名英雄 EventType23 = 23 // 事件buff强化 + EventType24 = 24 // 增加背包中指定道具数量 EventType25 = 25 // buff三选一 + EventType26 = 26 // 所有1级buff强化至2级 EventType28 = 28 // BOSS 战斗 EventType29 = 29 // 商店强化 )