mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-04 14:22:26 +08:00
配置表访问接口化,简化常量访问
This commit is contained in:
@@ -2,18 +2,18 @@ package gdconf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hk4e/pkg/endec"
|
||||
"hk4e/pkg/logger"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"hk4e/pkg/endec"
|
||||
"hk4e/pkg/logger"
|
||||
|
||||
"github.com/hjson/hjson-go/v4"
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// 角色配置表
|
||||
|
||||
// AvatarData 角色配置表
|
||||
type AvatarData struct {
|
||||
AvatarId int32 `csv:"AvatarId"` // ID
|
||||
HpBase float64 `csv:"HpBase,omitempty"` // 基础生命值
|
||||
@@ -97,6 +97,14 @@ func (g *GameDataConfig) loadAvatarData() {
|
||||
logger.Info("AvatarData count: %v", len(g.AvatarDataMap))
|
||||
}
|
||||
|
||||
func GetAvatarDataById(avatarId int32) *AvatarData {
|
||||
return CONF.AvatarDataMap[avatarId]
|
||||
}
|
||||
|
||||
func GetAvatarDataMap() map[int32]*AvatarData {
|
||||
return CONF.AvatarDataMap
|
||||
}
|
||||
|
||||
// TODO 成长属性要读表
|
||||
|
||||
func (a *AvatarData) GetBaseHpByLevel(level uint8) float64 {
|
||||
|
||||
@@ -2,13 +2,13 @@ package gdconf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"hk4e/pkg/logger"
|
||||
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// 角色等级配置表
|
||||
|
||||
// AvatarLevelData 角色等级配置表
|
||||
type AvatarLevelData struct {
|
||||
Level int32 `csv:"Level"` // 等级
|
||||
Exp int32 `csv:"Exp,omitempty"` // 升到下一级所需经验
|
||||
@@ -29,3 +29,11 @@ func (g *GameDataConfig) loadAvatarLevelData() {
|
||||
}
|
||||
logger.Info("AvatarLevelData count: %v", len(g.AvatarLevelDataMap))
|
||||
}
|
||||
|
||||
func GetAvatarLevelDataByLevel(level int32) *AvatarLevelData {
|
||||
return CONF.AvatarLevelDataMap[level]
|
||||
}
|
||||
|
||||
func GetAvatarLevelDataMap() map[int32]*AvatarLevelData {
|
||||
return CONF.AvatarLevelDataMap
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ package gdconf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"hk4e/pkg/logger"
|
||||
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// 角色突破配置表
|
||||
|
||||
// AvatarPromoteData 角色突破配置表
|
||||
type AvatarPromoteData struct {
|
||||
PromoteId int32 `csv:"PromoteId"` // 角色突破ID
|
||||
PromoteLevel int32 `csv:"PromoteLevel,omitempty"` // 突破等级
|
||||
@@ -59,3 +59,11 @@ func (g *GameDataConfig) loadAvatarPromoteData() {
|
||||
}
|
||||
logger.Info("AvatarPromoteData count: %v", len(g.AvatarPromoteDataMap))
|
||||
}
|
||||
|
||||
func GetAvatarPromoteDataByIdAndLevel(promoteId int32, promoteLevel int32) *AvatarPromoteData {
|
||||
value, exist := CONF.AvatarPromoteDataMap[promoteId]
|
||||
if !exist {
|
||||
return nil
|
||||
}
|
||||
return value[promoteLevel]
|
||||
}
|
||||
|
||||
@@ -8,8 +8,7 @@ import (
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// 角色技能配置表
|
||||
|
||||
// AvatarSkillData 角色技能配置表
|
||||
type AvatarSkillData struct {
|
||||
AvatarSkillId int32 `csv:"AvatarSkillId"` // ID
|
||||
AbilityName string `csv:"AbilityName,omitempty"` // Ability名称
|
||||
@@ -34,3 +33,11 @@ func (g *GameDataConfig) loadAvatarSkillData() {
|
||||
}
|
||||
logger.Info("AvatarSkillData count: %v", len(g.AvatarSkillDataMap))
|
||||
}
|
||||
|
||||
func GetAvatarSkillDataById(avatarSkillId int32) *AvatarSkillData {
|
||||
return CONF.AvatarSkillDataMap[avatarSkillId]
|
||||
}
|
||||
|
||||
func GetAvatarSkillDataMap() map[int32]*AvatarSkillData {
|
||||
return CONF.AvatarSkillDataMap
|
||||
}
|
||||
|
||||
@@ -11,8 +11,7 @@ import (
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// 角色技能库配置表
|
||||
|
||||
// AvatarSkillDepotData 角色技能库配置表
|
||||
type AvatarSkillDepotData struct {
|
||||
AvatarSkillDepotId int32 `csv:"AvatarSkillDepotId"` // ID
|
||||
EnergySkill int32 `csv:"EnergySkill,omitempty"` // 充能技能
|
||||
@@ -127,7 +126,15 @@ func (g *GameDataConfig) loadAvatarSkillDepotData() {
|
||||
logger.Info("AvatarSkillDepotData count: %v", len(g.AvatarSkillDepotDataMap))
|
||||
}
|
||||
|
||||
func (g *GameDataConfig) GetAvatarEnergySkillConfig(avatarId uint32) *AvatarSkillData {
|
||||
func GetAvatarSkillDepotDataById(avatarSkillDepotId int32) *AvatarSkillDepotData {
|
||||
return CONF.AvatarSkillDepotDataMap[avatarSkillDepotId]
|
||||
}
|
||||
|
||||
func GetAvatarSkillDepotDataMap() map[int32]*AvatarSkillDepotData {
|
||||
return CONF.AvatarSkillDepotDataMap
|
||||
}
|
||||
|
||||
func GetAvatarEnergySkillConfig(avatarId uint32) *AvatarSkillData {
|
||||
if avatarId == 10000005 || avatarId == 10000007 {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// FetterData 角色资料解锁配置表
|
||||
type FetterData struct {
|
||||
FetterId int32 `csv:"FetterId"` // ID
|
||||
AvatarId int32 `csv:"AvatarId"` // 角色ID
|
||||
@@ -38,3 +39,15 @@ func (g *GameDataConfig) loadFetterData() {
|
||||
}
|
||||
logger.Info("FetterData count: %v", len(g.FetterDataMap))
|
||||
}
|
||||
|
||||
func GetFetterDataByFetterId(fetterId int32) *FetterData {
|
||||
return CONF.FetterDataMap[fetterId]
|
||||
}
|
||||
|
||||
func GetFetterIdListByAvatarId(avatarId int32) []int32 {
|
||||
return CONF.FetterDataAvatarIdMap[avatarId]
|
||||
}
|
||||
|
||||
func GetFetterDataMap() map[int32]*FetterData {
|
||||
return CONF.FetterDataMap
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ type GameDataConfig struct {
|
||||
GCGSkillDataMap map[int32]*GCGSkillData // 卡牌技能
|
||||
SceneDataMap map[int32]*SceneData // 场景
|
||||
ScenePointMap map[int32]*ScenePoint // 场景传送点
|
||||
SceneTagDataMap map[int32]*SceneTagData // 场景地图图标
|
||||
SceneMap map[int32]*Scene // 场景详情
|
||||
SceneTagDataMap map[int32]*SceneTagData // 场景标签
|
||||
SceneDetailMap map[int32]*SceneDetail // 场景详情LUA配置数据
|
||||
WorldAreaDataMap map[int32]*WorldAreaData // 世界区域
|
||||
GatherDataMap map[int32]*GatherData // 采集物
|
||||
GatherDataPointTypeMap map[int32]*GatherData // 采集物场景节点索引
|
||||
|
||||
@@ -147,7 +147,7 @@ func TestSceneBlock(t *testing.T) {
|
||||
config.InitConfig("./bin/application.toml")
|
||||
logger.InitLogger("SceneBlock")
|
||||
InitGameDataConfig()
|
||||
scene, exist := CONF.SceneMap[3]
|
||||
scene, exist := CONF.SceneDetailMap[3]
|
||||
if !exist {
|
||||
panic("scene 3 not exist")
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// GatherData 采集物配置表
|
||||
type GatherData struct {
|
||||
PointType int32 `csv:"PointType"` // 挂节点类型
|
||||
GatherId int32 `csv:"GatherId"` // ID
|
||||
@@ -32,3 +33,15 @@ func (g *GameDataConfig) loadGatherData() {
|
||||
}
|
||||
logger.Info("GatherData count: %v", len(g.GatherDataMap))
|
||||
}
|
||||
|
||||
func GetGatherDataById(gatherId int32) *GatherData {
|
||||
return CONF.GatherDataMap[gatherId]
|
||||
}
|
||||
|
||||
func GetGatherDataByPointType(pointType int32) *GatherData {
|
||||
return CONF.GatherDataPointTypeMap[pointType]
|
||||
}
|
||||
|
||||
func GetGatherDataMap() map[int32]*GatherData {
|
||||
return CONF.GatherDataMap
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@ import (
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// 角色卡牌配置表
|
||||
|
||||
// GCGCharData 角色卡牌配置表
|
||||
type GCGCharData struct {
|
||||
CharId int32 `csv:"CharId"` // ID
|
||||
TagId1 int32 `csv:"TagId1,omitempty"` // 卡牌标签列表1
|
||||
@@ -64,3 +63,11 @@ func (g *GameDataConfig) loadGCGCharData() {
|
||||
}
|
||||
logger.Info("GCGCharData count: %v", len(g.GCGCharDataMap))
|
||||
}
|
||||
|
||||
func GetGCGCharDataById(charId int32) *GCGCharData {
|
||||
return CONF.GCGCharDataMap[charId]
|
||||
}
|
||||
|
||||
func GetGCGCharDataMap() map[int32]*GCGCharData {
|
||||
return CONF.GCGCharDataMap
|
||||
}
|
||||
|
||||
@@ -2,16 +2,16 @@ package gdconf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hk4e/pkg/logger"
|
||||
"os"
|
||||
|
||||
"hk4e/pkg/logger"
|
||||
|
||||
"github.com/hjson/hjson-go/v4"
|
||||
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// 卡牌技能配置表
|
||||
|
||||
// GCGSkillData 卡牌技能配置表
|
||||
type GCGSkillData struct {
|
||||
SkillId int32 `csv:"SkillId"` // ID
|
||||
ConfigJson string `csv:"ConfigJson,omitempty"` // 效果config
|
||||
@@ -109,3 +109,11 @@ func (g *GameDataConfig) loadGCGSkillData() {
|
||||
}
|
||||
logger.Info("GCGSkillData count: %v", len(g.GCGSkillDataMap))
|
||||
}
|
||||
|
||||
func GetGCGSkillDataById(skillId int32) *GCGSkillData {
|
||||
return CONF.GCGSkillDataMap[skillId]
|
||||
}
|
||||
|
||||
func GetGCGSkillDataMap() map[int32]*GCGSkillData {
|
||||
return CONF.GCGSkillDataMap
|
||||
}
|
||||
|
||||
@@ -2,14 +2,16 @@ package gdconf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hk4e/common/constant"
|
||||
"hk4e/pkg/logger"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"hk4e/common/constant"
|
||||
"hk4e/pkg/logger"
|
||||
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// ItemData 统一道具配置表
|
||||
type ItemData struct {
|
||||
// 公共字段
|
||||
ItemId int32 `csv:"ItemId"` // ID
|
||||
@@ -57,7 +59,7 @@ func (g *GameDataConfig) loadItemData() {
|
||||
itemData.SkillAffix = append(itemData.SkillAffix, itemData.SkillAffix2)
|
||||
}
|
||||
// 武器精炼摩拉消耗列表读取转换
|
||||
if itemData.Type == int32(constant.ItemTypeConst.ITEM_WEAPON) && itemData.AwakenCoinCostStr != "" {
|
||||
if itemData.Type == int32(constant.ITEM_TYPE_WEAPON) && itemData.AwakenCoinCostStr != "" {
|
||||
tempCostList := strings.Split(strings.ReplaceAll(itemData.AwakenCoinCostStr, " ", ""), "#")
|
||||
itemData.AwakenCoinCostList = make([]uint32, 0, len(tempCostList))
|
||||
for _, s := range tempCostList {
|
||||
@@ -74,3 +76,11 @@ func (g *GameDataConfig) loadItemData() {
|
||||
}
|
||||
logger.Info("ItemData count: %v", len(g.ItemDataMap))
|
||||
}
|
||||
|
||||
func GetItemDataById(itemId int32) *ItemData {
|
||||
return CONF.ItemDataMap[itemId]
|
||||
}
|
||||
|
||||
func GetItemDataMap() map[int32]*ItemData {
|
||||
return CONF.ItemDataMap
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ package gdconf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"hk4e/pkg/logger"
|
||||
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// 玩家等级配置表
|
||||
|
||||
// PlayerLevelData 玩家等级配置表
|
||||
type PlayerLevelData struct {
|
||||
Level int32 `csv:"Level"` // 等级
|
||||
Exp int32 `csv:"Exp,omitempty"` // 升到下一级所需经验
|
||||
@@ -29,3 +29,11 @@ func (g *GameDataConfig) loadPlayerLevelData() {
|
||||
}
|
||||
logger.Info("PlayerLevelData count: %v", len(g.PlayerLevelDataMap))
|
||||
}
|
||||
|
||||
func GetPlayerLevelDataById(level int32) *PlayerLevelData {
|
||||
return CONF.PlayerLevelDataMap[level]
|
||||
}
|
||||
|
||||
func GetPlayerLevelDataMap() map[int32]*PlayerLevelData {
|
||||
return CONF.PlayerLevelDataMap
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ package gdconf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"hk4e/pkg/logger"
|
||||
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// 奖励配置表
|
||||
|
||||
// RewardData 奖励配置表
|
||||
type RewardData struct {
|
||||
RewardID int32 `csv:"RewardID"` // 奖励ID
|
||||
RewardItem1ID int32 `csv:"RewardItem1ID,omitempty"` // Reward道具1ID
|
||||
@@ -66,3 +66,11 @@ func (g *GameDataConfig) loadRewardData() {
|
||||
}
|
||||
logger.Info("RewardData count: %v", len(g.RewardDataMap))
|
||||
}
|
||||
|
||||
func GetRewardDataById(rewardID int32) *RewardData {
|
||||
return CONF.RewardDataMap[rewardID]
|
||||
}
|
||||
|
||||
func GetRewardDataMap() map[int32]*RewardData {
|
||||
return CONF.RewardDataMap
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// SceneData 场景配置表
|
||||
type SceneData struct {
|
||||
SceneId int32 `csv:"SceneId"` // ID
|
||||
SceneType int32 `csv:"SceneType,omitempty"` // 类型
|
||||
@@ -28,3 +29,11 @@ func (g *GameDataConfig) loadSceneData() {
|
||||
}
|
||||
logger.Info("SceneData count: %v", len(g.SceneDataMap))
|
||||
}
|
||||
|
||||
func GetSceneDataById(sceneId int32) *SceneData {
|
||||
return CONF.SceneDataMap[sceneId]
|
||||
}
|
||||
|
||||
func GetSceneDataMap() map[int32]*SceneData {
|
||||
return CONF.SceneDataMap
|
||||
}
|
||||
|
||||
@@ -8,11 +8,13 @@ import (
|
||||
"hk4e/pkg/logger"
|
||||
)
|
||||
|
||||
// 场景详情配置数据
|
||||
|
||||
const (
|
||||
SceneGroupLoaderLimit = 4 // 加载文件的并发数 此操作很耗内存 调大之前请确保你的机器内存足够
|
||||
)
|
||||
|
||||
type Scene struct {
|
||||
type SceneDetail struct {
|
||||
Id int32
|
||||
SceneConfig *SceneConfig // 地图配置
|
||||
BlockMap map[int32]*Block // 所有的区块
|
||||
@@ -130,7 +132,7 @@ func (g *GameDataConfig) loadGroup(group *Group, block *Block, sceneId int32, bl
|
||||
}
|
||||
|
||||
func (g *GameDataConfig) loadScene() {
|
||||
g.SceneMap = make(map[int32]*Scene)
|
||||
g.SceneDetailMap = make(map[int32]*SceneDetail)
|
||||
sceneLuaPrefix := g.luaPrefix + "scene/"
|
||||
for _, sceneData := range g.SceneDataMap {
|
||||
sceneId := sceneData.SceneId
|
||||
@@ -141,17 +143,17 @@ func (g *GameDataConfig) loadScene() {
|
||||
continue
|
||||
}
|
||||
luaState := fixLuaState(string(mainLuaData))
|
||||
scene := new(Scene)
|
||||
scene.Id = sceneId
|
||||
sceneDetail := new(SceneDetail)
|
||||
sceneDetail.Id = sceneId
|
||||
// scene_config
|
||||
scene.SceneConfig = new(SceneConfig)
|
||||
ok := parseLuaTableToObject[*SceneConfig](luaState, "scene_config", scene.SceneConfig)
|
||||
sceneDetail.SceneConfig = new(SceneConfig)
|
||||
ok := parseLuaTableToObject[*SceneConfig](luaState, "scene_config", sceneDetail.SceneConfig)
|
||||
if !ok {
|
||||
logger.Error("get scene_config object error, sceneId: %v", sceneId)
|
||||
luaState.Close()
|
||||
continue
|
||||
}
|
||||
scene.BlockMap = make(map[int32]*Block)
|
||||
sceneDetail.BlockMap = make(map[int32]*Block)
|
||||
// blocks
|
||||
blockIdList := make([]int32, 0)
|
||||
ok = parseLuaTableToObject[*[]int32](luaState, "blocks", &blockIdList)
|
||||
@@ -205,9 +207,9 @@ func (g *GameDataConfig) loadScene() {
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
scene.BlockMap[block.Id] = block
|
||||
sceneDetail.BlockMap[block.Id] = block
|
||||
}
|
||||
g.SceneMap[sceneId] = scene
|
||||
g.SceneDetailMap[sceneId] = sceneDetail
|
||||
}
|
||||
sceneCount := 0
|
||||
blockCount := 0
|
||||
@@ -215,7 +217,7 @@ func (g *GameDataConfig) loadScene() {
|
||||
monsterCount := 0
|
||||
npcCount := 0
|
||||
gadgetCount := 0
|
||||
for _, scene := range g.SceneMap {
|
||||
for _, scene := range g.SceneDetailMap {
|
||||
for _, block := range scene.BlockMap {
|
||||
for _, group := range block.GroupMap {
|
||||
monsterCount += len(group.MonsterList)
|
||||
@@ -231,11 +233,19 @@ func (g *GameDataConfig) loadScene() {
|
||||
sceneCount, blockCount, groupCount, monsterCount, npcCount, gadgetCount)
|
||||
}
|
||||
|
||||
func (g *GameDataConfig) GetSceneBlockConfig(sceneId int32, blockId int32) ([]*Monster, []*Npc, []*Gadget, bool) {
|
||||
func GetSceneDetailById(sceneId int32) *SceneDetail {
|
||||
return CONF.SceneDetailMap[sceneId]
|
||||
}
|
||||
|
||||
func GetSceneDetailMap() map[int32]*SceneDetail {
|
||||
return CONF.SceneDetailMap
|
||||
}
|
||||
|
||||
func GetSceneBlockConfig(sceneId int32, blockId int32) ([]*Monster, []*Npc, []*Gadget, bool) {
|
||||
monsterList := make([]*Monster, 0)
|
||||
npcList := make([]*Npc, 0)
|
||||
gadgetList := make([]*Gadget, 0)
|
||||
sceneConfig, exist := g.SceneMap[sceneId]
|
||||
sceneConfig, exist := CONF.SceneDetailMap[sceneId]
|
||||
if !exist {
|
||||
return nil, nil, nil, false
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
"hk4e/pkg/logger"
|
||||
)
|
||||
|
||||
// 场景传送点配置数据
|
||||
|
||||
// 传送点类型
|
||||
const (
|
||||
PointTypeStrTransPointNormal = "TransPointNormal"
|
||||
@@ -126,3 +128,19 @@ func (g *GameDataConfig) loadScenePoint() {
|
||||
}
|
||||
logger.Info("ScenePoint count: %v", scenePointCount)
|
||||
}
|
||||
|
||||
func GetScenePointBySceneIdAndPointId(sceneId int32, pointId int32) *PointData {
|
||||
value, exist := CONF.ScenePointMap[sceneId]
|
||||
if !exist {
|
||||
return nil
|
||||
}
|
||||
return value.PointMap[pointId]
|
||||
}
|
||||
|
||||
func GetScenePointMapBySceneId(sceneId int32) map[int32]*PointData {
|
||||
value, exist := CONF.ScenePointMap[sceneId]
|
||||
if !exist {
|
||||
return nil
|
||||
}
|
||||
return value.PointMap
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// SceneTagData 场景标签配置表
|
||||
type SceneTagData struct {
|
||||
SceneTagId int32 `csv:"SceneTagId"` // ID
|
||||
SceneId int32 `csv:"SceneId,omitempty"` // 场景ID
|
||||
@@ -28,3 +29,11 @@ func (g *GameDataConfig) loadSceneTagData() {
|
||||
}
|
||||
logger.Info("SceneTagData count: %v", len(g.SceneTagDataMap))
|
||||
}
|
||||
|
||||
func GetSceneTagDataById(sceneTagId int32) *SceneTagData {
|
||||
return CONF.SceneTagDataMap[sceneTagId]
|
||||
}
|
||||
|
||||
func GetSceneTagDataMap() map[int32]*SceneTagData {
|
||||
return CONF.SceneTagDataMap
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ package gdconf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"hk4e/pkg/logger"
|
||||
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// 武器等级配置表
|
||||
|
||||
// WeaponLevelData 武器等级配置表
|
||||
type WeaponLevelData struct {
|
||||
Level int32 `csv:"Level"` // 等级
|
||||
ExpByStar1 int32 `csv:"ExpByStar1,omitempty"` // 武器升级经验1
|
||||
@@ -42,3 +42,11 @@ func (g *GameDataConfig) loadWeaponLevelData() {
|
||||
}
|
||||
logger.Info("WeaponLevelData count: %v", len(g.WeaponLevelDataMap))
|
||||
}
|
||||
|
||||
func GetWeaponLevelDataByLevel(level int32) *WeaponLevelData {
|
||||
return CONF.WeaponLevelDataMap[level]
|
||||
}
|
||||
|
||||
func GetWeaponLevelDataMap() map[int32]*WeaponLevelData {
|
||||
return CONF.WeaponLevelDataMap
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ package gdconf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"hk4e/pkg/logger"
|
||||
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// 武器突破配置表
|
||||
|
||||
// WeaponPromoteData 武器突破配置表
|
||||
type WeaponPromoteData struct {
|
||||
PromoteId int32 `csv:"PromoteId"` // 武器突破ID
|
||||
PromoteLevel int32 `csv:"PromoteLevel,omitempty"` // 突破等级
|
||||
@@ -56,3 +56,11 @@ func (g *GameDataConfig) loadWeaponPromoteData() {
|
||||
}
|
||||
logger.Info("WeaponPromoteData count: %v", len(g.WeaponPromoteDataMap))
|
||||
}
|
||||
|
||||
func GetWeaponPromoteDataByIdAndLevel(promoteId int32, promoteLevel int32) *WeaponPromoteData {
|
||||
value, exist := CONF.WeaponPromoteDataMap[promoteId]
|
||||
if !exist {
|
||||
return nil
|
||||
}
|
||||
return value[promoteLevel]
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/jszwec/csvutil"
|
||||
)
|
||||
|
||||
// WorldAreaData 世界区域配置表
|
||||
type WorldAreaData struct {
|
||||
WorldAreaId int32 `csv:"WorldAreaId"` // 条目ID
|
||||
SceneId int32 `csv:"SceneId,omitempty"` // 场景ID
|
||||
@@ -30,3 +31,11 @@ func (g *GameDataConfig) loadWorldAreaData() {
|
||||
}
|
||||
logger.Info("WorldAreaData count: %v", len(g.WorldAreaDataMap))
|
||||
}
|
||||
|
||||
func GetWorldAreaDataById(worldAreaId int32) *WorldAreaData {
|
||||
return CONF.WorldAreaDataMap[worldAreaId]
|
||||
}
|
||||
|
||||
func GetWorldAreaDataMap() map[int32]*WorldAreaData {
|
||||
return CONF.WorldAreaDataMap
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user