mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-04 15:52:27 +08:00
优化
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
// ChestDropData 宝箱掉落配置表
|
||||
type ChestDropData struct {
|
||||
Level int32 `csv:"最小等级"`
|
||||
MinLevel int32 `csv:"最小等级"`
|
||||
DropTag string `csv:"总索引"`
|
||||
DropId int32 `csv:"掉落ID,omitempty"`
|
||||
DropCount int32 `csv:"掉落次数,omitempty"`
|
||||
@@ -21,7 +21,7 @@ func (g *GameDataConfig) loadChestDropData() {
|
||||
if !exist {
|
||||
g.ChestDropDataMap[chestDropData.DropTag] = make(map[int32]*ChestDropData)
|
||||
}
|
||||
g.ChestDropDataMap[chestDropData.DropTag][chestDropData.Level] = chestDropData
|
||||
g.ChestDropDataMap[chestDropData.DropTag][chestDropData.MinLevel] = chestDropData
|
||||
}
|
||||
logger.Info("ChestDropData count: %v", len(g.ChestDropDataMap))
|
||||
}
|
||||
@@ -31,7 +31,16 @@ func GetChestDropDataByDropTagAndLevel(dropTag string, level int32) *ChestDropDa
|
||||
if !exist {
|
||||
return nil
|
||||
}
|
||||
return value[level]
|
||||
resultLevel := int32(0)
|
||||
for minLevel := range value {
|
||||
if level < minLevel {
|
||||
continue
|
||||
}
|
||||
if minLevel > resultLevel {
|
||||
resultLevel = minLevel
|
||||
}
|
||||
}
|
||||
return value[resultLevel]
|
||||
}
|
||||
|
||||
func GetChestDropDataMap() map[string]map[int32]*ChestDropData {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
// MonsterDropData 怪物掉落配置表
|
||||
type MonsterDropData struct {
|
||||
Level int32 `csv:"最小等级"`
|
||||
MinLevel int32 `csv:"最小等级"`
|
||||
DropTag string `csv:"总索引"`
|
||||
DropId int32 `csv:"掉落ID,omitempty"`
|
||||
DropCount int32 `csv:"掉落次数,omitempty"`
|
||||
@@ -21,7 +21,7 @@ func (g *GameDataConfig) loadMonsterDropData() {
|
||||
if !exist {
|
||||
g.MonsterDropDataMap[monsterDropData.DropTag] = make(map[int32]*MonsterDropData)
|
||||
}
|
||||
g.MonsterDropDataMap[monsterDropData.DropTag][monsterDropData.Level] = monsterDropData
|
||||
g.MonsterDropDataMap[monsterDropData.DropTag][monsterDropData.MinLevel] = monsterDropData
|
||||
}
|
||||
logger.Info("MonsterDropData count: %v", len(g.MonsterDropDataMap))
|
||||
}
|
||||
@@ -31,7 +31,16 @@ func GetMonsterDropDataByDropTagAndLevel(dropTag string, level int32) *MonsterDr
|
||||
if !exist {
|
||||
return nil
|
||||
}
|
||||
return value[level]
|
||||
resultLevel := int32(0)
|
||||
for minLevel := range value {
|
||||
if level < minLevel {
|
||||
continue
|
||||
}
|
||||
if minLevel > resultLevel {
|
||||
resultLevel = minLevel
|
||||
}
|
||||
}
|
||||
return value[resultLevel]
|
||||
}
|
||||
|
||||
func GetMonsterDropDataMap() map[string]map[int32]*MonsterDropData {
|
||||
|
||||
Reference in New Issue
Block a user