diff --git a/d2common/d2resource/resource_paths.go b/d2common/d2resource/resource_paths.go index e785eb57..4a0921c3 100644 --- a/d2common/d2resource/resource_paths.go +++ b/d2common/d2resource/resource_paths.go @@ -227,6 +227,8 @@ const ( PlayerClass = "/data/global/excel/PlayerClass.txt" ObjectGroup = "/data/global/excel/objgroup.txt" CompCode = "/data/global/excel/compcode.txt" + Belts = "/data/global/excel/belts.txt" + // --- Animations --- diff --git a/d2core/d2inventory/doc.go b/d2core/d2inventory/doc.go index 60c5eb5c..974cabc4 100644 --- a/d2core/d2inventory/doc.go +++ b/d2core/d2inventory/doc.go @@ -1,2 +1,2 @@ -// Package d2inventory provides repreentations of player inventory +// Package d2inventory provides representations of player inventory package d2inventory diff --git a/d2core/d2records/belts_loader.go b/d2core/d2records/belts_loader.go new file mode 100644 index 00000000..194be7e6 --- /dev/null +++ b/d2core/d2records/belts_loader.go @@ -0,0 +1,110 @@ +package d2records + +import ( + "github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2txt" + "log" +) + +func beltsLoader(r *RecordManager, d *d2txt.DataDictionary) error { + records := make(Belts) + + for d.Next() { + record := &BeltRecord{ + Name: d.String("name"), + NumBoxes: d.Number("numboxes"), + BoxWidth: d.Number("boxwidth"), + BoxHeight: d.Number("boxheight"), + + Box1Left: d.Number("box1left"), + Box1Right: d.Number("box1right"), + Box1Top: d.Number("box1top"), + Box1Bottom: d.Number("box1bottom"), + + Box2Left: d.Number("box2left"), + Box2Right: d.Number("box2right"), + Box2Top: d.Number("box2top"), + Box2Bottom: d.Number("box2bottom"), + + Box3Left: d.Number("box3left"), + Box3Right: d.Number("box3right"), + Box3Top: d.Number("box3top"), + Box3Bottom: d.Number("box3bottom"), + + Box4Left: d.Number("box4left"), + Box4Right: d.Number("box4right"), + Box4Top: d.Number("box4top"), + Box4Bottom: d.Number("box4bottom"), + + Box5Left: d.Number("box5left"), + Box5Right: d.Number("box5right"), + Box5Top: d.Number("box5top"), + Box5Bottom: d.Number("box5bottom"), + + Box6Left: d.Number("box6left"), + Box6Right: d.Number("box6right"), + Box6Top: d.Number("box6top"), + Box6Bottom: d.Number("box6bottom"), + + Box7Left: d.Number("box7left"), + Box7Right: d.Number("box7right"), + Box7Top: d.Number("box7top"), + Box7Bottom: d.Number("box7bottom"), + + Box8Left: d.Number("box8left"), + Box8Right: d.Number("box8right"), + Box8Top: d.Number("box8top"), + Box8Bottom: d.Number("box8bottom"), + + Box9Left: d.Number("box9left"), + Box9Right: d.Number("box9right"), + Box9Top: d.Number("box9top"), + Box9Bottom: d.Number("box9bottom"), + + Box10Left: d.Number("box10left"), + Box10Right: d.Number("box10right"), + Box10Top: d.Number("box10top"), + Box10Bottom: d.Number("box10bottom"), + + Box11Left: d.Number("box11left"), + Box11Right: d.Number("box11right"), + Box11Top: d.Number("box11top"), + Box11Bottom: d.Number("box11bottom"), + + Box12Left: d.Number("box12left"), + Box12Right: d.Number("box12right"), + Box12Top: d.Number("box12top"), + Box12Bottom: d.Number("box12bottom"), + + Box13Left: d.Number("box13left"), + Box13Right: d.Number("box13right"), + Box13Top: d.Number("box13top"), + Box13Bottom: d.Number("box13bottom"), + + Box14Left: d.Number("box14left"), + Box14Right: d.Number("box14right"), + Box14Top: d.Number("box14top"), + Box14Bottom: d.Number("box14bottom"), + + Box15Left: d.Number("box15left"), + Box15Right: d.Number("box15right"), + Box15Top: d.Number("box15top"), + Box15Bottom: d.Number("box15bottom"), + + Box16Left: d.Number("box16left"), + Box16Right: d.Number("box16right"), + Box16Top: d.Number("box16top"), + Box16Bottom: d.Number("box16bottom"), + } + records[record.Name] = record + } + + if d.Err != nil { + return d.Err + } + + log.Printf("Loaded %d belts", len(records)) + + r.Item.Belts = records + + return nil +} diff --git a/d2core/d2records/belts_record.go b/d2core/d2records/belts_record.go new file mode 100644 index 00000000..55e7d18d --- /dev/null +++ b/d2core/d2records/belts_record.go @@ -0,0 +1,90 @@ +package d2records + +type Belts map[string]*BeltRecord + +type BeltRecord struct { + Name string + NumBoxes int + BoxWidth int + BoxHeight int + + Box1Left int + Box1Right int + Box1Top int + Box1Bottom int + + Box2Left int + Box2Right int + Box2Top int + Box2Bottom int + + Box3Left int + Box3Right int + Box3Top int + Box3Bottom int + + Box4Left int + Box4Right int + Box4Top int + Box4Bottom int + + Box5Left int + Box5Right int + Box5Top int + Box5Bottom int + + Box6Left int + Box6Right int + Box6Top int + Box6Bottom int + + Box7Left int + Box7Right int + Box7Top int + Box7Bottom int + + Box8Left int + Box8Right int + Box8Top int + Box8Bottom int + + Box9Left int + Box9Right int + Box9Top int + Box9Bottom int + + Box10Left int + Box10Right int + Box10Top int + Box10Bottom int + + Box11Left int + Box11Right int + Box11Top int + Box11Bottom int + + Box12Left int + Box12Right int + Box12Top int + Box12Bottom int + + Box13Left int + Box13Right int + Box13Top int + Box13Bottom int + + Box14Left int + Box14Right int + Box14Top int + Box14Bottom int + + Box15Left int + Box15Right int + Box15Top int + Box15Bottom int + + Box16Left int + Box16Right int + Box16Top int + Box16Bottom int +} diff --git a/d2core/d2records/record_manager.go b/d2core/d2records/record_manager.go index be270676..f77dedb8 100644 --- a/d2core/d2records/record_manager.go +++ b/d2core/d2records/record_manager.go @@ -57,6 +57,7 @@ type RecordManager struct { EquivalenceByRecord ItemEquivalenceByRecord // NOTE: populated when all items are loaded AutoMagic + Belts Books Gems Magic struct { @@ -149,6 +150,7 @@ func (r *RecordManager) init() error { {d2resource.Armor, armorLoader}, {d2resource.Misc, miscItemsLoader}, {d2resource.Books, booksLoader}, + {d2resource.Belts, beltsLoader}, {d2resource.ItemTypes, itemTypesLoader}, // WARN: needs to be after weapons, armor, and misc {d2resource.UniqueItems, uniqueItemsLoader}, {d2resource.Missiles, missilesLoader},