This commit is contained in:
liwei1dao 2023-02-27 10:21:26 +08:00
commit f1dfd0ba3d
4 changed files with 56 additions and 3 deletions

View File

@ -235,6 +235,7 @@ func (this *MCompConfigure) GetDropReward(dropId int32) (result []*cfg.Gameatn)
return
}
func (this *MCompConfigure) GetColor(id int32) (item *cfg.GameGameColorData, err error) {
var (
v interface{}

View File

@ -4,7 +4,7 @@ import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"github.com/golang/protobuf/proto"
"google.golang.org/protobuf/proto"
)
// 派遣

View File

@ -54,7 +54,7 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
return
}
stove.Data[req.ReelId] = &pb.Mastery{
Lv: 0,
Lv: 1,
Value: 0,
}
}
@ -150,8 +150,8 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
return
}
} else {
res := this.module.configure.GetDropReward(reelcfg.BasicDrop)
//res := this.module.configure.GetSmithyDropReward(reelcfg.BasicDrop)
if err, atno := this.module.DispenseAtno(session, res, true); err == pb.ErrorCode_Success {
for _, v := range atno {
if eq, err1 := this.module.ModuleEquipment.QueryEquipment(session.GetUserId(), v.O); err1 == pb.ErrorCode_Success {

View File

@ -1,6 +1,7 @@
package smithy
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
@ -35,6 +36,7 @@ type configureComp struct {
_mapProficile map[int64]*cfg.GameSmithyProficiencyData // 熟练度 key 卷轴ID+ 等级
_mapskill map[int64]*cfg.GameSmithyToolData // 熟练度 key 技能类型+ 技能等级等级
_mapAtlasScore map[int64]*cfg.GameSmithyAtlasScoreData // 图鉴积分
_dropMap map[int32][]*cfg.GameSmithyDropData // 掉落表 key 是DiropId
}
// 组件初始化接口
@ -73,6 +75,9 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
err = this.LoadConfigure(game_smithyatlaslv, cfg.NewGameSmithyAtlasLv)
err = this.LoadConfigure(game_smithyatlasscore, cfg.NewGameSmithyAtlasScore)
err = this.LoadConfigure(game_smithytask, cfg.NewGameSmithyTask)
this._dropMap = make(map[int32][]*cfg.GameSmithyDropData, 0)
configure.RegisterConfigure(game_smithyDrop, cfg.NewGameSmithyDrop, this.LoadSmithyDropData)
return
}
@ -304,3 +309,50 @@ func (this *configureComp) GetSmithyTask(taskId int32) (data *cfg.GameSmithyTask
this.module.Errorf("GetSmithyTask notfound taskId:%d", taskId)
return
}
func (this *configureComp) GetSmithyDropData(dropId int32) (data []*cfg.GameSmithyDropData) {
data = this._dropMap[dropId]
return
}
func (this *configureComp) GetSmithyDropReward(dropId int32) (result []*cfg.Gameatn) {
result = make([]*cfg.Gameatn, 0)
data := this.GetSmithyDropData(dropId)
if len(data) == 0 {
return
}
szW := make([]int32, 0)
for _, value := range data {
szW = append(szW, value.P)
}
index := comm.GetRandW(szW)
result = append(result, data[index].Prize...)
return
}
func (this *configureComp) LoadSmithyDropData() {
if v, err := this.GetConfigure(game_smithyDrop); err == nil {
if configure, ok := v.(*cfg.GameSmithyDrop); ok {
this.hlock.Lock()
defer this.hlock.Unlock()
for _, value := range configure.GetDataList() {
if value.Condition == 0 {
this._dropMap[value.Dropid] = append(this._dropMap[value.Dropid], value)
} else {
key := value.Condition
key = value.Dropid*100 + key
this._dropMap[key] = append(this._dropMap[key], value)
for _, v1 := range this._dropMap[value.Dropid] {
this._dropMap[key] = append(this._dropMap[key], v1)
}
}
}
}
} else {
log.Errorf("get game_pagoda conf err:%v", err)
}
return
}