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

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

@ -27,6 +27,7 @@ type configureComp struct {
module *Caravan
lock sync.RWMutex
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()
})
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
}
@ -209,12 +222,10 @@ func (this *configureComp) GetCaravanReward() (reward []*cfg.GameCaravanRewardDa
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 configure, ok := v.(*cfg.GameCaravanReward); ok {
if configure.Get(0) != nil {
return configure.Get(0).Reward
}
reward = configure.Get(this.overflow)
}
} else {
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 {
var res []*cfg.Gameatn
for _, v := range moreReard {
for _, v := range moreReard.Reward {
if v.N == 0 {
continue
}