角色成长属性相关配置表读取
This commit is contained in:
1 parent
dd33a1357e
commit
74bd54efee
4 files changed
+169
No files matched your search
@@ -0,0 +1,89 @@
|
|||||||
|
package gdconf
|
||||||
|
|
||||||
|
import (
|
||||||
|
"hk4e/pkg/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Curve 曲线
|
||||||
|
type Curve struct {
|
||||||
|
Type int32 // 类型
|
||||||
|
Arithmetic int32 // 运算
|
||||||
|
Value float32 // 值
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvatarCurveData 角色曲线配置表
|
||||||
|
type AvatarCurveData struct {
|
||||||
|
Level int32 `csv:"等级"`
|
||||||
|
|
||||||
|
Curve1Type int32 `csv:"[曲线]1类型,omitempty"`
|
||||||
|
Curve1Arithmetic int32 `csv:"[曲线]1运算,omitempty"`
|
||||||
|
Curve1Value float32 `csv:"[曲线]1值,omitempty"`
|
||||||
|
Curve2Type int32 `csv:"[曲线]2类型,omitempty"`
|
||||||
|
Curve2Arithmetic int32 `csv:"[曲线]2运算,omitempty"`
|
||||||
|
Curve2Value float32 `csv:"[曲线]2值,omitempty"`
|
||||||
|
Curve3Type int32 `csv:"[曲线]3类型,omitempty"`
|
||||||
|
Curve3Arithmetic int32 `csv:"[曲线]3运算,omitempty"`
|
||||||
|
Curve3Value float32 `csv:"[曲线]3值,omitempty"`
|
||||||
|
Curve4Type int32 `csv:"[曲线]4类型,omitempty"`
|
||||||
|
Curve4Arithmetic int32 `csv:"[曲线]4运算,omitempty"`
|
||||||
|
Curve4Value float32 `csv:"[曲线]4值,omitempty"`
|
||||||
|
|
||||||
|
CurveList []*Curve
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GameDataConfig) loadAvatarCurveData() {
|
||||||
|
g.AvatarCurveDataMap = make(map[int32]*AvatarCurveData)
|
||||||
|
avatarCurveDataList := make([]*AvatarCurveData, 0)
|
||||||
|
readTable[AvatarCurveData](g.txtPrefix+"AvatarCurveData.txt", &avatarCurveDataList)
|
||||||
|
for _, avatarCurveData := range avatarCurveDataList {
|
||||||
|
curveList := make([]*Curve, 0)
|
||||||
|
if avatarCurveData.Curve1Type != 0 {
|
||||||
|
curveList = append(curveList, &Curve{
|
||||||
|
Type: avatarCurveData.Curve1Type,
|
||||||
|
Arithmetic: avatarCurveData.Curve1Arithmetic,
|
||||||
|
Value: avatarCurveData.Curve1Value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if avatarCurveData.Curve2Type != 0 {
|
||||||
|
curveList = append(curveList, &Curve{
|
||||||
|
Type: avatarCurveData.Curve2Type,
|
||||||
|
Arithmetic: avatarCurveData.Curve2Arithmetic,
|
||||||
|
Value: avatarCurveData.Curve2Value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if avatarCurveData.Curve3Type != 0 {
|
||||||
|
curveList = append(curveList, &Curve{
|
||||||
|
Type: avatarCurveData.Curve3Type,
|
||||||
|
Arithmetic: avatarCurveData.Curve3Arithmetic,
|
||||||
|
Value: avatarCurveData.Curve3Value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if avatarCurveData.Curve4Type != 0 {
|
||||||
|
curveList = append(curveList, &Curve{
|
||||||
|
Type: avatarCurveData.Curve4Type,
|
||||||
|
Arithmetic: avatarCurveData.Curve4Arithmetic,
|
||||||
|
Value: avatarCurveData.Curve4Value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
avatarCurveData.CurveList = curveList
|
||||||
|
g.AvatarCurveDataMap[avatarCurveData.Level] = avatarCurveData
|
||||||
|
}
|
||||||
|
logger.Info("AvatarCurveData count: %v", len(g.AvatarCurveDataMap))
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetAvatarCurveByLevelAndType(level int32, curveType int32) *Curve {
|
||||||
|
avatarCurveData, exist := CONF.AvatarCurveDataMap[level]
|
||||||
|
if !exist {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
for _, curve := range avatarCurveData.CurveList {
|
||||||
|
if curve.Type == curveType {
|
||||||
|
return curve
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetAvatarCurveDataMap() map[int32]*AvatarCurveData {
|
||||||
|
return CONF.AvatarCurveDataMap
|
||||||
|
}
|
||||||
@@ -10,6 +10,12 @@ import (
|
|||||||
"github.com/hjson/hjson-go/v4"
|
"github.com/hjson/hjson-go/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// PropGrow 属性成长
|
||||||
|
type PropGrow struct {
|
||||||
|
Type int32 // 类型
|
||||||
|
Curve int32 // 曲线
|
||||||
|
}
|
||||||
|
|
||||||
// AvatarData 角色配置表
|
// AvatarData 角色配置表
|
||||||
type AvatarData struct {
|
type AvatarData struct {
|
||||||
AvatarId int32 `csv:"ID"`
|
AvatarId int32 `csv:"ID"`
|
||||||
@@ -28,8 +34,16 @@ type AvatarData struct {
|
|||||||
PromoteRewardLevel IntArray `csv:"角色突破奖励获取等阶,omitempty"`
|
PromoteRewardLevel IntArray `csv:"角色突破奖励获取等阶,omitempty"`
|
||||||
PromoteReward IntArray `csv:"角色突破奖励,omitempty"`
|
PromoteReward IntArray `csv:"角色突破奖励,omitempty"`
|
||||||
|
|
||||||
|
PropGrow1Type int32 `csv:"[属性成长]1类型,omitempty"`
|
||||||
|
PropGrow1Curve int32 `csv:"[属性成长]1曲线,omitempty"`
|
||||||
|
PropGrow2Type int32 `csv:"[属性成长]2类型,omitempty"`
|
||||||
|
PropGrow2Curve int32 `csv:"[属性成长]2曲线,omitempty"`
|
||||||
|
PropGrow3Type int32 `csv:"[属性成长]3类型,omitempty"`
|
||||||
|
PropGrow3Curve int32 `csv:"[属性成长]3曲线,omitempty"`
|
||||||
|
|
||||||
AbilityHashCodeList []int32
|
AbilityHashCodeList []int32
|
||||||
PromoteRewardMap map[uint32]uint32
|
PromoteRewardMap map[uint32]uint32
|
||||||
|
PropGrowList []*PropGrow
|
||||||
}
|
}
|
||||||
|
|
||||||
type ConfigAvatar struct {
|
type ConfigAvatar struct {
|
||||||
@@ -73,6 +87,27 @@ func (g *GameDataConfig) loadAvatarData() {
|
|||||||
avatarData.PromoteRewardMap[uint32(promoteLevel)] = uint32(rewardId)
|
avatarData.PromoteRewardMap[uint32(promoteLevel)] = uint32(rewardId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 属性成长列表
|
||||||
|
propGrowList := make([]*PropGrow, 0)
|
||||||
|
if avatarData.PropGrow1Type != 0 {
|
||||||
|
propGrowList = append(propGrowList, &PropGrow{
|
||||||
|
Type: avatarData.PropGrow1Type,
|
||||||
|
Curve: avatarData.PropGrow1Curve,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if avatarData.PropGrow2Type != 0 {
|
||||||
|
propGrowList = append(propGrowList, &PropGrow{
|
||||||
|
Type: avatarData.PropGrow2Type,
|
||||||
|
Curve: avatarData.PropGrow2Curve,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if avatarData.PropGrow3Type != 0 {
|
||||||
|
propGrowList = append(propGrowList, &PropGrow{
|
||||||
|
Type: avatarData.PropGrow3Type,
|
||||||
|
Curve: avatarData.PropGrow3Curve,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
avatarData.PropGrowList = propGrowList
|
||||||
g.AvatarDataMap[avatarData.AvatarId] = avatarData
|
g.AvatarDataMap[avatarData.AvatarId] = avatarData
|
||||||
}
|
}
|
||||||
logger.Info("AvatarData count: %v", len(g.AvatarDataMap))
|
logger.Info("AvatarData count: %v", len(g.AvatarDataMap))
|
||||||
|
|||||||
@@ -4,6 +4,12 @@ import (
|
|||||||
"hk4e/pkg/logger"
|
"hk4e/pkg/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// AddProp 增加属性
|
||||||
|
type AddProp struct {
|
||||||
|
Type int32 // 类型
|
||||||
|
Value float32 // 值
|
||||||
|
}
|
||||||
|
|
||||||
// AvatarPromoteData 角色突破配置表
|
// AvatarPromoteData 角色突破配置表
|
||||||
type AvatarPromoteData struct {
|
type AvatarPromoteData struct {
|
||||||
PromoteId int32 `csv:"角色突破ID"`
|
PromoteId int32 `csv:"角色突破ID"`
|
||||||
@@ -20,7 +26,17 @@ type AvatarPromoteData struct {
|
|||||||
LevelLimit int32 `csv:"解锁等级上限,omitempty"`
|
LevelLimit int32 `csv:"解锁等级上限,omitempty"`
|
||||||
MinPlayerLevel int32 `csv:"冒险等级要求,omitempty"`
|
MinPlayerLevel int32 `csv:"冒险等级要求,omitempty"`
|
||||||
|
|
||||||
|
AddProp1Type int32 `csv:"[增加属性]1类型,omitempty"`
|
||||||
|
AddProp1Value float32 `csv:"[增加属性]1值,omitempty"`
|
||||||
|
AddProp2Type int32 `csv:"[增加属性]2类型,omitempty"`
|
||||||
|
AddProp2Value float32 `csv:"[增加属性]2值,omitempty"`
|
||||||
|
AddProp3Type int32 `csv:"[增加属性]3类型,omitempty"`
|
||||||
|
AddProp3Value float32 `csv:"[增加属性]3值,omitempty"`
|
||||||
|
AddProp4Type int32 `csv:"[增加属性]4类型,omitempty"`
|
||||||
|
AddProp4Value float32 `csv:"[增加属性]4值,omitempty"`
|
||||||
|
|
||||||
CostItemMap map[uint32]uint32 // 消耗物品列表
|
CostItemMap map[uint32]uint32 // 消耗物品列表
|
||||||
|
AddPropList []*AddProp // 增加属性列表
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameDataConfig) loadAvatarPromoteData() {
|
func (g *GameDataConfig) loadAvatarPromoteData() {
|
||||||
@@ -44,6 +60,33 @@ func (g *GameDataConfig) loadAvatarPromoteData() {
|
|||||||
delete(avatarPromoteData.CostItemMap, itemId)
|
delete(avatarPromoteData.CostItemMap, itemId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 增加属性列表
|
||||||
|
addPropList := make([]*AddProp, 0)
|
||||||
|
if avatarPromoteData.AddProp1Type != 0 {
|
||||||
|
addPropList = append(addPropList, &AddProp{
|
||||||
|
Type: avatarPromoteData.AddProp1Type,
|
||||||
|
Value: avatarPromoteData.AddProp1Value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if avatarPromoteData.AddProp2Type != 0 {
|
||||||
|
addPropList = append(addPropList, &AddProp{
|
||||||
|
Type: avatarPromoteData.AddProp2Type,
|
||||||
|
Value: avatarPromoteData.AddProp2Value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if avatarPromoteData.AddProp3Type != 0 {
|
||||||
|
addPropList = append(addPropList, &AddProp{
|
||||||
|
Type: avatarPromoteData.AddProp3Type,
|
||||||
|
Value: avatarPromoteData.AddProp3Value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if avatarPromoteData.AddProp4Type != 0 {
|
||||||
|
addPropList = append(addPropList, &AddProp{
|
||||||
|
Type: avatarPromoteData.AddProp4Type,
|
||||||
|
Value: avatarPromoteData.AddProp4Value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
avatarPromoteData.AddPropList = addPropList
|
||||||
// 通过突破等级找到突破数据
|
// 通过突破等级找到突破数据
|
||||||
g.AvatarPromoteDataMap[avatarPromoteData.PromoteId][avatarPromoteData.PromoteLevel] = avatarPromoteData
|
g.AvatarPromoteDataMap[avatarPromoteData.PromoteId][avatarPromoteData.PromoteLevel] = avatarPromoteData
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ type GameDataConfig struct {
|
|||||||
MonsterRelationshipDataMap map[int32]*MonsterRelationshipData // 怪物关联
|
MonsterRelationshipDataMap map[int32]*MonsterRelationshipData // 怪物关联
|
||||||
MonsterDataMap map[int32]*MonsterData // 怪物
|
MonsterDataMap map[int32]*MonsterData // 怪物
|
||||||
ProudSkillDataMap map[int32]map[int32]*ProudSkillData // 天赋
|
ProudSkillDataMap map[int32]map[int32]*ProudSkillData // 天赋
|
||||||
|
AvatarCurveDataMap map[int32]*AvatarCurveData // 角色曲线
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitGameDataConfig() {
|
func InitGameDataConfig() {
|
||||||
@@ -190,6 +191,7 @@ func (g *GameDataConfig) load(loadSceneLua bool) {
|
|||||||
g.loadMonsterRelationshipData() // 怪物关联
|
g.loadMonsterRelationshipData() // 怪物关联
|
||||||
g.loadMonsterData() // 怪物
|
g.loadMonsterData() // 怪物
|
||||||
g.loadProudSkillData() // 天赋
|
g.loadProudSkillData() // 天赋
|
||||||
|
g.loadAvatarCurveData() // 角色曲线
|
||||||
}
|
}
|
||||||
|
|
||||||
// CSV相关
|
// CSV相关
|
||||||
|
|||||||
Reference in new issue
Block a user