商队结算积分超出部分转其他道具

This commit is contained in:
meixiongfeng 2023-08-02 18:54:09 +08:00
parent 6f09e9996f
commit 2107b54b65
2 changed files with 20 additions and 9 deletions

View File

@ -24,9 +24,10 @@ const (
///配置管理基础组件 ///配置管理基础组件
type configureComp struct { type configureComp struct {
modules.MCompConfigure modules.MCompConfigure
module *Caravan module *Caravan
lock sync.RWMutex lock sync.RWMutex
event map[int32][]*cfg.GameCaravanEventData event map[int32][]*cfg.GameCaravanEventData
overflow int32
} }
//组件初始化接口 //组件初始化接口
@ -52,7 +53,19 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
} }
this.lock.Unlock() this.lock.Unlock()
}) })
configure.RegisterConfigure(game_caravan_reward, cfg.NewGameCaravanReward, func() {
if v, err := this.GetConfigure(game_caravan_event); err != nil {
this.module.Errorf("err:%v", err)
return
} else {
for _, v := range v.(*cfg.GameCaravanReward).GetDataList() {
if v.Key < 0 {
this.overflow = v.Id
return
}
}
}
})
return return
} }
@ -209,12 +222,10 @@ func (this *configureComp) GetCaravanReward() (reward []*cfg.GameCaravanRewardDa
return return
} }
func (this *configureComp) GetCaravanMoreReward() (reward []*cfg.Gameatn) { func (this *configureComp) GetCaravanMoreReward() (reward *cfg.GameCaravanRewardData) {
if v, err := this.GetConfigure(game_caravan_reward); err == nil { if v, err := this.GetConfigure(game_caravan_reward); err == nil {
if configure, ok := v.(*cfg.GameCaravanReward); ok { if configure, ok := v.(*cfg.GameCaravanReward); ok {
if configure.Get(0) != nil { reward = configure.Get(this.overflow)
return configure.Get(0).Reward
}
} }
} else { } else {
log.Errorf("get GetCaravanInitCity conf err:%v", err) log.Errorf("get GetCaravanInitCity conf err:%v", err)

View File

@ -465,7 +465,7 @@ func (this *Caravan) Rpc_ModuleCaravanSettlement(ctx context.Context, args *pb.E
if maxKey <= temp.Merchantmoney { if maxKey <= temp.Merchantmoney {
var res []*cfg.Gameatn var res []*cfg.Gameatn
for _, v := range moreReard { for _, v := range moreReard.Reward {
if v.N == 0 { if v.N == 0 {
continue continue
} }