fix: restore battle entry and character profile initialization

This commit is contained in:
CAtlas0784 committed 2026-10-17 11:58:20 +07:00
1 parent cfbbc7b970
commit 5c4d0d4149
16 files changed
+888 -228

No files matched your search

+18 -1
View File
@@ -75,6 +75,7 @@ type LevelOutputConfig struct {
type AvatarConfig struct {
WeaknessBuffID uint32 `json:"weaknessBuffId"`
DamageType string `json:"damageType"`
}
type JsonConfig struct {
@@ -185,6 +186,23 @@ func GameRes() (*JsonConfig, error) {
}
func loadSupplementaryResources(res *JsonConfig) {
// PearlSR's resource export keeps avatar data in AvatarConfig.json;
// res.json may legitimately contain an empty avatarConfigs object.
if raw, err := readResourceFile("resources/AvatarConfig.json"); err == nil {
var avatars struct {
Entries []struct {
ID uint32 `json:"AvatarID"`
DamageType string `json:"DamageType"`
} `json:"avatar_config"`
}
if err := json.Unmarshal(raw, &avatars); err == nil {
for _, avatar := range avatars.Entries {
cfg := res.AvatarConfigs[avatar.ID]
cfg.DamageType = avatar.DamageType
res.AvatarConfigs[avatar.ID] = cfg
}
}
}
entrancesByEntry := map[uint32]MapEntranceEntry{}
if raw, err := readResourceFile("resources/MapEntrance.json", "MapEntrance.json"); err == nil {
var list []MapEntranceEntry
@@ -369,4 +387,3 @@ func Teleports() map[uint32]map[uint32]TeleportInfo {
})
return teleportDB
}