This commit is contained in:
liwei1dao 2023-10-09 17:00:38 +08:00
commit ce50e425c0
3 changed files with 33 additions and 48 deletions

View File

@ -37,9 +37,19 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.StonehengeFinishR
}
// 校验是否是通关
if conf := this.module.configure.GetStageConfByStageid(stone.StageID, stone.CurRoomIndes+1); conf == nil {
stone.Reward[stone.StageID] = true
update["reward"] = stone.Reward
if stone.Rooms.Complete {
if conf := this.module.configure.GetStageConfByStageid(stone.StageID, stone.CurRoomIndes+1); conf == nil {
stone.Reward[stone.StageID] = true
update["reward"] = stone.Reward // 设置关卡通关状态
if conf := this.module.configure.GetStageConfByStageid(stone.StageID, 1); conf != nil {
if len(conf.FirstReward) > 0 { // 完成关卡 发放当前关奖励
if errdata, reward = this.module.DispenseAtno(session, conf.FirstReward, true); errdata != nil {
return
}
atno = append(atno, reward...)
}
}
}
if conf := this.module.configure.GetStageConfByStageid(stone.StageID, stone.CurRoomIndes); conf != nil {
stone.Integral += conf.WeeklyPoint // 发放积分 和奖励
update["integral"] = stone.Integral
@ -49,17 +59,9 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.StonehengeFinishR
return
}
}
}
if stone.Rooms.Complete { // 完成关卡 发放当前关奖励
if conf := this.module.configure.GetStageConfByStageid(stone.StageID, 1); conf != nil {
if len(conf.FirstReward) > 0 {
if errdata, reward = this.module.DispenseAtno(session, conf.FirstReward, true); errdata != nil {
return
}
atno = append(atno, reward...)
}
}
}
stone.StageID = 0
update["stageID"] = stone.StageID
stone.CurRoomIndes = 0

View File

@ -100,7 +100,6 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
configure.RegisterConfigure(game_buffconf, cfg.NewGameStoneBuff, this.LoadGameStoneBuff)
configure.RegisterConfigure(game_storyconf, cfg.NewGameStoneStory, this.LoadGameStoneStory)
this.GetRoomGroupDataByLottery(110100)
return
}
@ -139,7 +138,7 @@ func (this *configureComp) LoadEventGroupData() {
}
if _, ok := this.StypeE[key]; !ok {
this.StypeE[key] = value.GroupType
this.StypeE[key] = value.SubGroupType
}
if _, ok := this.SNumE[key]; !ok {
this.SNumE[key] = value.SubGroupNum //value.Groupnum
@ -201,7 +200,7 @@ func (this *configureComp) LoadRoomGroupData() {
}
if _, ok := this.StypeR[key]; !ok {
this.StypeR[key] = value.GroupType
this.StypeR[key] = value.SubGroupType
}
if _, ok := this.SNumR[key]; !ok {
this.SNumR[key] = value.SubGroupNum //value.Groupnum
@ -279,20 +278,18 @@ func (this *configureComp) GetRoomGroupDataByLottery(lotteryId int32) (rooms []i
}
}
}
m := make(map[int64]int32, 0)
// 每个小组id 都随机取一次
szW = make([]int32, 0)
szID = make([]int32, 0)
for _, _data := range this._lotteryType2R[lotteryId] {
if _data.SubGroupId != 0 {
szW = append(szW, _data.SubGroupWt)
szID = append(szID, _data.SubGroupId)
key := int64(lotteryId)<<31 + int64(_data.SubGroupId)
if _, ok := m[key]; !ok {
m[key] = _data.SubGroupWt
}
}
// 类型为2 可能会同时获得多个组id
for pos, v := range szW {
key := int64(lotteryId)<<31 + int64(szID[pos])
for key, v := range m {
//fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id)
if v >= comm.GetRandNum(0, 1000) { // 命中
if this.StypeR[key] == 1 { // 随机一组数据
@ -696,14 +693,6 @@ func (this *configureComp) getGameStonePrivilegeData(privilegeId int32) (conf *c
this.module.Errorln(err)
return
}
func (this *configureComp) GetEventLotterConfById(id int32) (data *cfg.GameEventlotteryData) {
if v, err := this.GetConfigure(game_eventlottery); err == nil {
if configure, ok := v.(*cfg.GameEventlottery); ok {
return configure.Get(id)
}
}
return
}
// 实际掉落逻辑 (传入 掉落组ID vip等级 玩家等级 返回获得的道具)
func (this *configureComp) GetEventGroupDataByLottery(lotterys ...int32) (event []int32) {
@ -760,19 +749,16 @@ func (this *configureComp) GetEventGroupDataByLottery(lotterys ...int32) (event
}
// 每个小组id 都随机取一次
szW = make([]int32, 0)
szID = make([]int32, 0)
m := make(map[int64]int32, 0)
for _, _data := range this._lotteryType2E[lotteryId] {
if _data.SubGroupId != 0 {
szW = append(szW, _data.SubGroupWt)
szID = append(szID, _data.SubGroupId)
key := int64(lotteryId)<<31 + int64(_data.SubGroupId)
if _, ok := m[key]; !ok {
m[key] = _data.SubGroupWt
}
}
// 类型为2 可能会同时获得多个组id
for pos, v := range szW {
key := int64(lotteryId)<<31 + int64(szID[pos])
//fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id)
for key, v := range m {
if v >= comm.GetRandNum(0, 1000) { // 命中
if this.StypeE[key] == 1 { // 随机一组数据
for i := 0; i < int(this.SNumE[key]); i++ {
@ -792,7 +778,6 @@ func (this *configureComp) GetEventGroupDataByLottery(lotterys ...int32) (event
for _, _data := range this._groupType2E[key] {
if _data.EventWt >= comm.GetRandNum(1, 1000) { // 命中
event = append(event, _data.EventID)
}
}
}

View File

@ -238,20 +238,18 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
}
// 每个小组id 都随机取一次
szW = make([]int32, 0)
szID = make([]int32, 0)
m := make(map[int64]int32, 0)
for _, _data := range this._lotteryType2[lotteryId] {
if (_data.Playerlvmax == 0 || (_data.Playerlvmin <= lv && lv <= _data.Playerlvmax)) && (_data.VIPmax == 0 || (_data.VIPmin <= vipLv && vipLv <= _data.VIPmax)) { // 过滤等级等条件
if _data.Groupid != 0 {
szW = append(szW, _data.Groupwt)
szID = append(szID, _data.Groupid)
key := int64(lotteryId)<<31 + int64(_data.Groupid)
if _, ok := m[key]; !ok {
m[key] = _data.Groupwt
}
}
}
// 类型为2 可能会同时获得多个组id
for pos, v := range szW {
key := int64(lotteryId)<<31 + int64(szID[pos])
for key, v := range m {
//fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id)
if v >= comm.GetRandNum(0, 1000) { // 命中
if this.Stype[key] == 1 { // 随机一组数据