mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-16 09:25:57 -05:00
174 lines
7.9 KiB
Go
174 lines
7.9 KiB
Go
package d2records
|
|
|
|
import (
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2txt"
|
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
|
|
)
|
|
|
|
// nolint:funlen // cant reduce
|
|
func levelDetailsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
|
|
records := make(LevelDetails)
|
|
|
|
for d.Next() {
|
|
record := &LevelDetailRecord{
|
|
Name: d.String("Name "),
|
|
ID: d.Number("Id"),
|
|
Palette: d.Number("Pal"),
|
|
Act: d.Number("Act"),
|
|
QuestFlag: d.Number("QuestFlag"),
|
|
QuestFlagExpansion: d.Number("QuestFlagEx"),
|
|
AutomapIndex: d.Number("Layer"),
|
|
SizeXNormal: d.Number("SizeX"),
|
|
SizeYNormal: d.Number("SizeY"),
|
|
SizeXNightmare: d.Number("SizeX(N)"),
|
|
SizeYNightmare: d.Number("SizeY(N)"),
|
|
SizeXHell: d.Number("SizeX(H)"),
|
|
SizeYHell: d.Number("SizeY(H)"),
|
|
WorldOffsetX: d.Number("OffsetX"),
|
|
WorldOffsetY: d.Number("OffsetY"),
|
|
DependantLevelID: d.Number("Depend"),
|
|
TeleportFlag: d2enum.TeleportFlag(d.Number("Teleport")),
|
|
EnableRain: d.Number("Rain") > 0,
|
|
EnableMud: d.Number("Mud") > 0,
|
|
EnablePerspective: d.Number("NoPer") > 0,
|
|
EnableLineOfSightDraw: d.Number("LOSDraw") > 0,
|
|
EnableFloorFliter: d.Number("FloorFilter") > 0,
|
|
EnableBlankScreen: d.Number("BlankScreen") > 0,
|
|
EnableDrawEdges: d.Number("DrawEdges") > 0,
|
|
IsInside: d.Number("IsInside") > 0,
|
|
LevelGenerationType: d2enum.LevelGenerationType(d.Number("DrlgType")),
|
|
LevelType: d.Number("LevelType"),
|
|
SubType: d.Number("SubType"),
|
|
SubTheme: d.Number("SubTheme"),
|
|
SubWaypoint: d.Number("SubWaypoint"),
|
|
SubShrine: d.Number("SubShrine"),
|
|
LevelLinkID0: d.Number("Vis0"),
|
|
LevelLinkID1: d.Number("Vis1"),
|
|
LevelLinkID2: d.Number("Vis2"),
|
|
LevelLinkID3: d.Number("Vis3"),
|
|
LevelLinkID4: d.Number("Vis4"),
|
|
LevelLinkID5: d.Number("Vis5"),
|
|
LevelLinkID6: d.Number("Vis6"),
|
|
LevelLinkID7: d.Number("Vis7"),
|
|
WarpGraphicsID0: d.Number("Warp0"),
|
|
WarpGraphicsID1: d.Number("Warp1"),
|
|
WarpGraphicsID2: d.Number("Warp2"),
|
|
WarpGraphicsID3: d.Number("Warp3"),
|
|
WarpGraphicsID4: d.Number("Warp4"),
|
|
WarpGraphicsID5: d.Number("Warp5"),
|
|
WarpGraphicsID6: d.Number("Warp6"),
|
|
WarpGraphicsID7: d.Number("Warp7"),
|
|
LightIntensity: d.Number("Intensity"),
|
|
Red: d.Number("Red"),
|
|
Green: d.Number("Green"),
|
|
Blue: d.Number("Blue"),
|
|
PortalEnable: d.Number("Portal") > 0,
|
|
PortalRepositionEnable: d.Number("Position") > 0,
|
|
SaveMonsterStates: d.Number("SaveMonsters") > 0,
|
|
SaveMerchantStates: d.Number("SaveMonsters") > 0,
|
|
QuestID: d.Number("Quest"),
|
|
WarpClearanceDistance: d.Number("WarpDist"),
|
|
MonsterLevelNormal: d.Number("MonLvl1"),
|
|
MonsterLevelNightmare: d.Number("MonLvl2"),
|
|
MonsterLevelHell: d.Number("MonLvl3"),
|
|
MonsterLevelNormalEx: d.Number("MonLvl1Ex"),
|
|
MonsterLevelNightmareEx: d.Number("MonLvl2Ex"),
|
|
MonsterLevelHellEx: d.Number("MonLvl3Ex"),
|
|
MonsterDensityNormal: d.Number("MonDen"),
|
|
MonsterDensityNightmare: d.Number("MonDen(N)"),
|
|
MonsterDensityHell: d.Number("MonDen(H)"),
|
|
MonsterUniqueMinNormal: d.Number("MonUMin"),
|
|
MonsterUniqueMinNightmare: d.Number("MonUMin(N)"),
|
|
MonsterUniqueMinHell: d.Number("MonUMin(H)"),
|
|
MonsterUniqueMaxNormal: d.Number("MonUMax"),
|
|
MonsterUniqueMaxNightmare: d.Number("MonUMax(N)"),
|
|
MonsterUniqueMaxHell: d.Number("MonUMax(H)"),
|
|
MonsterWanderEnable: d.Number("MonWndr") > 0,
|
|
MonsterSpecialWalk: d.Number("MonSpcWalk") > 0,
|
|
NumMonsterTypes: d.Number("NumMon"),
|
|
MonsterID1Normal: d.String("mon1"),
|
|
MonsterID2Normal: d.String("mon2"),
|
|
MonsterID3Normal: d.String("mon3"),
|
|
MonsterID4Normal: d.String("mon4"),
|
|
MonsterID5Normal: d.String("mon5"),
|
|
MonsterID6Normal: d.String("mon6"),
|
|
MonsterID7Normal: d.String("mon7"),
|
|
MonsterID8Normal: d.String("mon8"),
|
|
MonsterID9Normal: d.String("mon9"),
|
|
MonsterID10Normal: d.String("mon10"),
|
|
MonsterID1Nightmare: d.String("nmon1"),
|
|
MonsterID2Nightmare: d.String("nmon2"),
|
|
MonsterID3Nightmare: d.String("nmon3"),
|
|
MonsterID4Nightmare: d.String("nmon4"),
|
|
MonsterID5Nightmare: d.String("nmon5"),
|
|
MonsterID6Nightmare: d.String("nmon6"),
|
|
MonsterID7Nightmare: d.String("nmon7"),
|
|
MonsterID8Nightmare: d.String("nmon8"),
|
|
MonsterID9Nightmare: d.String("nmon9"),
|
|
MonsterID10Nightmare: d.String("nmon10"),
|
|
MonsterID1Hell: d.String("nmon1"),
|
|
MonsterID2Hell: d.String("nmon2"),
|
|
MonsterID3Hell: d.String("nmon3"),
|
|
MonsterID4Hell: d.String("nmon4"),
|
|
MonsterID5Hell: d.String("nmon5"),
|
|
MonsterID6Hell: d.String("nmon6"),
|
|
MonsterID7Hell: d.String("nmon7"),
|
|
MonsterID8Hell: d.String("nmon8"),
|
|
MonsterID9Hell: d.String("nmon9"),
|
|
MonsterID10Hell: d.String("nmon10"),
|
|
MonsterPreferRanged: d.Number("rangedspawn") > 0,
|
|
MonsterUniqueID1: d.String("umon1"),
|
|
MonsterUniqueID2: d.String("umon2"),
|
|
MonsterUniqueID3: d.String("umon3"),
|
|
MonsterUniqueID4: d.String("umon4"),
|
|
MonsterUniqueID5: d.String("umon5"),
|
|
MonsterUniqueID6: d.String("umon6"),
|
|
MonsterUniqueID7: d.String("umon7"),
|
|
MonsterUniqueID8: d.String("umon8"),
|
|
MonsterUniqueID9: d.String("umon9"),
|
|
MonsterUniqueID10: d.String("umon10"),
|
|
MonsterCritterID1: d.String("cmon1"),
|
|
MonsterCritterID2: d.String("cmon2"),
|
|
MonsterCritterID3: d.String("cmon3"),
|
|
MonsterCritterID4: d.String("cmon4"),
|
|
MonsterCritter1SpawnChance: d.Number("cpct1"),
|
|
MonsterCritter2SpawnChance: d.Number("cpct2"),
|
|
MonsterCritter3SpawnChance: d.Number("cpct3"),
|
|
MonsterCritter4SpawnChance: d.Number("cpct4"),
|
|
SoundEnvironmentID: d.Number("SoundEnv"),
|
|
WaypointID: d.Number("Waypoint"),
|
|
LevelDisplayName: d.String("LevelName"),
|
|
LevelWarpName: d.String("LevelWarp"),
|
|
TitleImageName: d.String("EntryFile"),
|
|
ObjectGroupID0: d.Number("ObjGrp0"),
|
|
ObjectGroupID1: d.Number("ObjGrp1"),
|
|
ObjectGroupID2: d.Number("ObjGrp2"),
|
|
ObjectGroupID3: d.Number("ObjGrp3"),
|
|
ObjectGroupID4: d.Number("ObjGrp4"),
|
|
ObjectGroupID5: d.Number("ObjGrp5"),
|
|
ObjectGroupID6: d.Number("ObjGrp6"),
|
|
ObjectGroupID7: d.Number("ObjGrp7"),
|
|
ObjectGroupSpawnChance0: d.Number("ObjPrb0"),
|
|
ObjectGroupSpawnChance1: d.Number("ObjPrb1"),
|
|
ObjectGroupSpawnChance2: d.Number("ObjPrb2"),
|
|
ObjectGroupSpawnChance3: d.Number("ObjPrb3"),
|
|
ObjectGroupSpawnChance4: d.Number("ObjPrb4"),
|
|
ObjectGroupSpawnChance5: d.Number("ObjPrb5"),
|
|
ObjectGroupSpawnChance6: d.Number("ObjPrb6"),
|
|
ObjectGroupSpawnChance7: d.Number("ObjPrb7"),
|
|
}
|
|
records[record.ID] = record
|
|
}
|
|
|
|
if d.Err != nil {
|
|
return d.Err
|
|
}
|
|
|
|
r.Debugf("Loaded %d LevelDetail records", len(records))
|
|
|
|
r.Level.Details = records
|
|
|
|
return nil
|
|
}
|