This commit is contained in:
meixiongfeng 2023-07-05 10:24:45 +08:00
commit c74f05e451
2 changed files with 25 additions and 7 deletions

View File

@ -158,7 +158,11 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR
if len(tconfigure.Ants) > 0 { //额外道具加成 if len(tconfigure.Ants) > 0 { //额外道具加成
ants1 = make([]*cfg.Gameatn, 0) ants1 = make([]*cfg.Gameatn, 0)
r := rand.New(rand.NewSource(time.Now().Unix())) r := rand.New(rand.NewSource(time.Now().Unix()))
num := r.Int31n(tconfigure.Num[1]-tconfigure.Num[0]) + tconfigure.Num[0] interval := tconfigure.Num[1] - tconfigure.Num[0]
num := tconfigure.Num[0]
if interval > 0 {
num = r.Int31n(interval) + tconfigure.Num[0]
}
if r.Int31n(100) < tconfigure.Probability { //随机一个道具 if r.Int31n(100) < tconfigure.Probability { //随机一个道具
total := 0 total := 0
for _, v := range tconfigure.Wget { for _, v := range tconfigure.Wget {

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/sys/configure" "go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
@ -34,7 +35,6 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
this.module = module.(*Practice) this.module = module.(*Practice)
this.LoadConfigure(game_pandamasmz, cfg.NewGamePandamasMz) this.LoadConfigure(game_pandamasmz, cfg.NewGamePandamasMz)
this.LoadConfigure(game_pandamasjs, cfg.NewGamePandamasJs) this.LoadConfigure(game_pandamasjs, cfg.NewGamePandamasJs)
this.LoadConfigure(game_pandamasjx, cfg.NewGamePandamasJx)
this.LoadConfigure(game_pandamasyxjx, cfg.NewGamePandamasYxjx) this.LoadConfigure(game_pandamasyxjx, cfg.NewGamePandamasYxjx)
this.LoadConfigure(game_pandamasmryl, cfg.NewGamePandamasMryl) this.LoadConfigure(game_pandamasmryl, cfg.NewGamePandamasMryl)
this.LoadConfigure(game_dispatch_battle, cfg.NewGameDispatch_Battle) this.LoadConfigure(game_dispatch_battle, cfg.NewGameDispatch_Battle)
@ -55,6 +55,20 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
} }
this.lock.Unlock() this.lock.Unlock()
}) })
configure.RegisterConfigure(game_pandamasjx, cfg.NewGamePandamasJx, func() {
if v, err := this.GetConfigure(game_pandamasjx); err != nil {
this.module.Errorf("err:%v", err)
this.lock.Unlock()
return
} else {
for _, v := range v.(*cfg.GamePandamasJx).GetDataList() {
if len(v.Ants) > 0 && (len(v.Num) != 2 || v.Num[1] < v.Num[0]) {
this.module.Error("配置错误!", log.Field{Key: "Num", Value: v.Num})
}
}
}
})
return return
} }