上传海岛协议代码

This commit is contained in:
liwei1dao 2023-11-20 16:03:57 +08:00
parent e37ebb9190
commit ba09658fda
2 changed files with 41 additions and 6 deletions

View File

@ -18,6 +18,7 @@ func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.IsLandBuyReq) (
func (this *apiComp) Buy(session comm.IUserSession, req *pb.IsLandBuyReq) (errdata *pb.ErrorData) { func (this *apiComp) Buy(session comm.IUserSession, req *pb.IsLandBuyReq) (errdata *pb.ErrorData) {
var ( var (
conf *cfg.GameHeroData conf *cfg.GameHeroData
coinconf *cfg.GamePuggsyRecruitData
info *pb.DBIsland info *pb.DBIsland
heros []*pb.DBHero heros []*pb.DBHero
hero *pb.DBHero hero *pb.DBHero
@ -36,6 +37,14 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.IsLandBuyReq) (errda
return return
} }
if coinconf, err = this.module.configure.getGamePuggsyRecruit(conf.Star); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Message: err.Error(),
}
return
}
if info, err = this.module.model.getmodel(session.GetUserId()); err != nil { if info, err = this.module.model.getmodel(session.GetUserId()); err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError, Code: pb.ErrorCode_DBError,
@ -43,6 +52,11 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.IsLandBuyReq) (errda
} }
return return
} }
if errdata = this.module.ConsumeRes(session, coinconf.Need, true); errdata != nil {
return
}
if _, ok = info.Heroshop[req.Cids]; ok { if _, ok = info.Heroshop[req.Cids]; ok {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError, Code: pb.ErrorCode_ReqParameterError,

View File

@ -16,6 +16,7 @@ const (
game_puggsyscore = "game_puggsyscore.json" game_puggsyscore = "game_puggsyscore.json"
game_puggsypasscheck = "game_puggsypasscheck.json" game_puggsypasscheck = "game_puggsypasscheck.json"
game_puggsystar = "game_puggsystar.json" game_puggsystar = "game_puggsystar.json"
game_puggsyrecruit = "game_puggsyrecruit.json"
) )
// /背包配置管理组件 // /背包配置管理组件
@ -34,6 +35,7 @@ func (this *ConfigureComp) Init(service core.IService, module core.IModule, comp
err = this.LoadConfigure(game_puggsyscore, cfg.NewGamePuggsyScore) err = this.LoadConfigure(game_puggsyscore, cfg.NewGamePuggsyScore)
err = this.LoadConfigure(game_puggsypasscheck, cfg.NewGamePuggsyPasscheck) err = this.LoadConfigure(game_puggsypasscheck, cfg.NewGamePuggsyPasscheck)
err = this.LoadConfigure(game_puggsystar, cfg.NewGamePuggsyStar) err = this.LoadConfigure(game_puggsystar, cfg.NewGamePuggsyStar)
err = this.LoadConfigure(game_puggsyrecruit, cfg.NewGamePuggsyRecruit)
return return
} }
@ -185,3 +187,22 @@ func (this *ConfigureComp) getGamePuggsyStarData(id int32) (conf *cfg.GamePuggsy
} }
return return
} }
// 获取伤害对应的评分组
func (this *ConfigureComp) getGamePuggsyRecruit(id int32) (conf *cfg.GamePuggsyRecruitData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_puggsyrecruit); err != nil {
return
} else {
if conf, ok = v.(*cfg.GamePuggsyRecruit).GetDataMap()[id]; !ok {
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_puggsyrecruit, id)
this.module.Errorf("err:%v", err)
return
}
}
return
}