diff --git a/modules/smithy/api_toolsup.go b/modules/smithy/api_toolsup.go index 365db72e8..1e709fed7 100644 --- a/modules/smithy/api_toolsup.go +++ b/modules/smithy/api_toolsup.go @@ -24,6 +24,25 @@ func (this *apiComp) ToolsUp(session comm.IUserSession, req *pb.SmithyToolsUpReq code = pb.ErrorCode_DBError return } + conf := this.module.configure.GetSmithyToolsData(req.Id) + if conf == nil { + code = pb.ErrorCode_ReqParameterError + return + } + // 校验前置条件 + if conf.Preconditions == 0 { + stove.Skill[conf.SkillType] = conf.SkillLv + } else { + //TODU + } + + if this.module.ConsumeRes(session, conf.UpMaterial, true); code != pb.ErrorCode_Success { + return + } + + update := make(map[string]interface{}) + update["skill"] = stove.Skill + this.module.modelStove.updateSmithyStove(session.GetUserId(), update) session.SendMsg(string(this.module.GetType()), "toolsup", &pb.SmithyToolsUpResp{Data: stove}) return diff --git a/modules/smithy/comp_configure.go b/modules/smithy/comp_configure.go index 21089c1d1..c44a03e24 100644 --- a/modules/smithy/comp_configure.go +++ b/modules/smithy/comp_configure.go @@ -27,6 +27,7 @@ type configureComp struct { _smithyMap map[int64]*cfg.GameSmithyData _mapProficile map[int64]*cfg.GameSmithyProficiencyData // 熟练度 key 卷轴ID+ 等级 + _mapskill map[int64]*cfg.GameSmithyToolData // 熟练度 key 技能类型+ 技能等级等级 } //组件初始化接口 @@ -51,6 +52,8 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp this._mapProficile = make(map[int64]*cfg.GameSmithyProficiencyData, 0) configure.RegisterConfigure(game_smproficiency, cfg.NewGameSmithyProficiency, this.LoadProficileData) + this._mapskill = make(map[int64]*cfg.GameSmithyToolData, 0) + configure.RegisterConfigure(game_smithytools, cfg.NewGameSmithyTool, this.LoadSmithySkillData) err = this.LoadConfigure(game_smithyreel, cfg.NewGameSmithyStove) err = this.LoadConfigure(game_smithystove, cfg.NewGameSmithyStoveV1) err = this.LoadConfigure(game_smithytools, cfg.NewGameSmithyTool) @@ -146,6 +149,27 @@ func (this *configureComp) GetSmithProficiencyConf(id int32) (data *cfg.GameSmit return } +// 获取铁匠铺的工具台技能 +func (this *configureComp) GetSmithySkill(skillType int32, skillLv int32) *cfg.GameSmithyToolData { + return this._mapskill[int64(skillType<<16)+int64(skillLv)] +} + +func (this *configureComp) LoadSmithySkillData() { + if v, err := this.GetConfigure(game_smithytools); err == nil { + if configure, ok := v.(*cfg.GameSmithyTool); ok { + this.hlock.Lock() + defer this.hlock.Unlock() + for _, value := range configure.GetDataList() { + this._mapskill[int64(value.SkillType<<16)+int64(value.SkillLv)] = value + } + return + } + } else { + log.Errorf("get LoadSmithySkillData conf err:%v", err) + + } +} + func (this *configureComp) LoadProficileData() { if v, err := this.GetConfigure(game_smproficiency); err == nil { @@ -180,7 +204,7 @@ func (this *configureComp) GetSmithyStoveConf(star int32) (data *cfg.GameSmithyS } // 获取铁匠铺工作台信息 -func (this *configureComp) GetSmithyStoveConf1(id int32) (data *cfg.GameSmithyToolData) { +func (this *configureComp) GetSmithyToolsData(id int32) (data *cfg.GameSmithyToolData) { if v, err := this.GetConfigure(game_smithytools); err == nil { if configure, ok := v.(*cfg.GameSmithyTool); ok { data = configure.Get(int32(id))