mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-23 14:32:27 +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 {
|
||||
|
||||
Reference in New Issue
Block a user