This commit is contained in:
liwei1dao 2022-10-12 14:00:40 +08:00
commit ddab5ed2f2

View File

@ -15,6 +15,7 @@ const (
game_libraryhistory = "game_libraryhistory.json" // 往事id 对应的奖励 game_libraryhistory = "game_libraryhistory.json" // 往事id 对应的奖励
game_libraryfavor = "game_libraryfavor.json" // 英雄好感度升级所需的经验 game_libraryfavor = "game_libraryfavor.json" // 英雄好感度升级所需的经验
game_librarystory = "game_librarystory.json" // 羁绊id对应剧情奖励 game_librarystory = "game_librarystory.json" // 羁绊id对应剧情奖励
game_favornum = "game_favornum.json" // 羁绊id对应经验
) )
///配置管理基础组件 ///配置管理基础组件
@ -31,16 +32,17 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
game_libraryhistory: cfg.NewGameLibraryHistory, game_libraryhistory: cfg.NewGameLibraryHistory,
game_libraryfavor: cfg.NewGameLibraryFavor, game_libraryfavor: cfg.NewGameLibraryFavor,
game_librarystory: cfg.NewGameLibraryStory, game_librarystory: cfg.NewGameLibraryStory,
game_favornum: cfg.NewGameFavorNum,
}) })
this.fetter = make(map[int64]*cfg.GameLibraryFetterData, 0) this.fetter = make(map[int64]*cfg.GameLibraryFetterData, 0)
configure.RegisterConfigure(game_libraryfetter, cfg.NewGameLibraryFetter, this.SetLibraryFetter) configure.RegisterConfigure(game_libraryfetter, cfg.NewGameLibraryFetter, this.SetLibraryFetter)
// _data := this.GetLibraryStory(101) _data := this.GetFavorNum("10016")
// fmt.Printf("%v", _data) fmt.Printf("%v", _data)
// _data1 := this.GetLibraryFavor(2) _data1 := this.GetLibraryFavor(3)
// fmt.Printf("%v", _data1) fmt.Printf("%v", _data1)
// _data2 := this.GetLibraryHistory("350011") // _data2 := this.GetLibraryHistory("350011")
// fmt.Printf("%v", _data2) // fmt.Printf("%v", _data2)
return return
@ -90,10 +92,12 @@ func (this *configureComp) GetLibraryHero(hid string) (data *cfg.GameLibraryHero
return return
} }
func (this *configureComp) GetLibraryFavor(id int32) (data *cfg.GameLibraryFavorData) { func (this *configureComp) GetLibraryFavor(star int32) (data []int32) {
if v, err := this.GetConfigure(game_libraryfavor); err == nil { if v, err := this.GetConfigure(game_libraryfavor); err == nil {
if configure, ok := v.(*cfg.GameLibraryFavor); ok { if configure, ok := v.(*cfg.GameLibraryFavor); ok {
data = configure.Get(id) for _, v := range configure.GetDataList() {
data = append(data, v.Expneed)
}
} }
} else { } else {
log.Errorf("GetLibraryFavor conf err:%v", err) log.Errorf("GetLibraryFavor conf err:%v", err)
@ -122,3 +126,15 @@ func (this *configureComp) GetLibraryStory(fid int32) (data *cfg.GameLibraryStor
} }
return return
} }
// 获取羁绊英雄经验数据
func (this *configureComp) GetFavorNum(cid string) (data *cfg.GameFavorNumData) {
if v, err := this.GetConfigure(game_favornum); err == nil {
if configure, ok := v.(*cfg.GameFavorNum); ok {
data = configure.Get(cid)
}
} else {
log.Errorf("GetLibraryStory conf err:%v", err)
}
return
}