Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
1b01c4ce59
@ -30,6 +30,7 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
|
||||
newEvent int32 // 是否有新的事件
|
||||
eventConf *cfg.GameStoneEventData
|
||||
reward []*pb.UserAtno
|
||||
curbuff int32
|
||||
)
|
||||
update = make(map[string]interface{})
|
||||
if errdata = this.EventCheck(session, req); errdata != nil {
|
||||
@ -78,6 +79,12 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
|
||||
}
|
||||
return
|
||||
}
|
||||
if len(eventConf.CostItem) > 0 {
|
||||
if errdata = this.module.CheckRes(session, eventConf.CostItem); errdata != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
switch eventConf.EventType {
|
||||
case EventType16: // 捡垃圾事件
|
||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||
@ -165,11 +172,11 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
|
||||
if bBox && stone.Rooms.Box[req.Eventid] < eventConf.Value2 {
|
||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||
// 校验消耗是否
|
||||
if len(eventConf.CostItem) > 0 {
|
||||
if errdata = this.module.ConsumeRes(session, eventConf.CostItem, true); errdata != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// if len(eventConf.CostItem) > 0 {
|
||||
// if errdata = this.module.ConsumeRes(session, eventConf.CostItem, true); errdata != nil {
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
if lotteryward := this.module.ModuleTools.GetGroupDataByLottery(eventConf.Value1, user.Vip, user.Lv); len(lotteryward) > 0 {
|
||||
if errdata, reward = this.module.DispenseAtno(session, lotteryward, true); errdata != nil {
|
||||
this.module.Debugf("Mline lotteryward DispenseRes err:+%v", lotteryward)
|
||||
@ -239,6 +246,42 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
|
||||
}
|
||||
}
|
||||
update["hero"] = stone.Hero
|
||||
case EventType23: // 事件buff 强化
|
||||
case EventType29: // 商店强化
|
||||
if num, err := strconv.Atoi(req.Param1); err == nil {
|
||||
buffid := int32(num)
|
||||
if _, ok := stone.Userbuff[buffid]; ok {
|
||||
if EventType29 == eventConf.EventType { // 商店消耗 走特殊消耗
|
||||
if oldbufConf, e := this.module.configure.GetStoneBuffDataById(buffid); e == nil {
|
||||
if oldbufConf.BuffUpgradeCost.N > 0 {
|
||||
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{oldbufConf.BuffUpgradeCost}, true); errdata != nil { // 校验消耗
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: e.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
if newbufConf, e := this.module.configure.GetStoneBuffDataById(buffid + 1); e == nil {
|
||||
stone.Userbuff[newbufConf.BuffId] = 1
|
||||
delete(stone.Userbuff, buffid) // 删除旧buff
|
||||
update["userbuff"] = stone.Userbuff
|
||||
curbuff = newbufConf.BuffId
|
||||
} else {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: e.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -247,31 +290,6 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
|
||||
if eventConf.Probability >= comm.GetRandNum(0, 1000) { // 命中
|
||||
newEvent = eventConf.PostEvent
|
||||
this.module.modelStonehenge.AddNewEvent([]int32{eventConf.PostEvent}, stone)
|
||||
// stone.Rooms.Eventid[newEvent] = false //
|
||||
// if newEventConf, err = this.module.configure.GetStoneEventDataById(newEvent); err != nil {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_ConfigNoFound,
|
||||
// Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
// Message: err.Error(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
||||
// switch newEventConf.EventType {
|
||||
// case EventType25: // buff是3选1
|
||||
// for _, v := range stone.Addweight {
|
||||
// ownerbuff := make(map[int32]struct{}, 0)
|
||||
// for k := range stone.Userbuff {
|
||||
// ownerbuff[k] = struct{}{}
|
||||
// }
|
||||
// stone.Rooms.Selectbuff = this.module.configure.GetBuffGroupDataByLottery(newEventConf.Value1, v, ownerbuff)
|
||||
// }
|
||||
// case EventType10: // 宝箱事件
|
||||
// if _, ok := stone.Rooms.Box[newEventConf.EventId]; !ok {
|
||||
// stone.Rooms.Box[newEventConf.EventId] = 0
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
stone.Rooms.Complete = true
|
||||
for _, v := range roomConf.Condition {
|
||||
@ -289,8 +307,10 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
|
||||
break
|
||||
}
|
||||
}
|
||||
// 通过条件判断
|
||||
|
||||
if errdata = this.module.ConsumeRes(session, eventConf.CostItem, true); errdata != nil { //真正的消耗
|
||||
return
|
||||
}
|
||||
update["rooms"] = stone.Rooms
|
||||
this.module.modelStonehenge.ChangeStonehengeData(session.GetUserId(), update)
|
||||
session.SendMsg(string(this.module.GetType()), "event", &pb.StonehengeEventResp{
|
||||
@ -300,6 +320,7 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
|
||||
Reward: reward,
|
||||
Hero: stone.Hero,
|
||||
Userbuff: stone.Userbuff,
|
||||
Curbuff: curbuff,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ const (
|
||||
EventType18 = 18 // 回血事件 非场景
|
||||
EventType19 = 19 // 扣血事件 非场景
|
||||
EventType20 = 20 // 克隆一名英雄
|
||||
EventType23 = 23 // 事件buff强化
|
||||
EventType25 = 25 // buff三选一
|
||||
EventType28 = 28 // BOSS 战斗
|
||||
EventType29 = 29 // 商店强化
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user