mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-09-05 19:14:14 -04:00
Fix monpreset for other acts (#478)
This commit is contained in:
parent
3f1fe538e2
commit
6c56027731
@ -6,23 +6,26 @@ import (
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
||||
)
|
||||
|
||||
type MonPresetRecord struct {
|
||||
Act int
|
||||
Place string
|
||||
}
|
||||
|
||||
var MonPresets []MonPresetRecord
|
||||
var MonPresets [][]string
|
||||
|
||||
func LoadMonPresets(file []byte) {
|
||||
dict := d2common.LoadDataDictionary(string(file))
|
||||
numRecords := len(dict.Data)
|
||||
MonPresets = make([]MonPresetRecord, numRecords)
|
||||
for idx := range dict.Data {
|
||||
record := MonPresetRecord{
|
||||
Act: dict.GetNumber("Act", idx),
|
||||
Place: dict.GetString("Place", idx),
|
||||
MonPresets = make([][]string, numRecords)
|
||||
for idx := range MonPresets {
|
||||
MonPresets[idx] = make([]string, numRecords)
|
||||
}
|
||||
|
||||
lastAct := 0
|
||||
placeIdx := 0
|
||||
for dictIdx := range dict.Data {
|
||||
act := dict.GetNumber("Act", dictIdx)
|
||||
if act != lastAct {
|
||||
placeIdx = 0
|
||||
}
|
||||
MonPresets[idx] = record
|
||||
MonPresets[act][placeIdx] = dict.GetString("Place", dictIdx)
|
||||
placeIdx++
|
||||
lastAct = act
|
||||
}
|
||||
log.Printf("Loaded %d MonPreset records", len(MonPresets))
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ func (ds1 *DS1) loadObjects(br *d2common.StreamReader) {
|
||||
newObject.Lookup = d2datadict.LookupObject(int(ds1.Act), newObject.Type, newObject.Id)
|
||||
|
||||
if newObject.Lookup != nil && newObject.Type == 1 {
|
||||
newObject.Lookup.Name = d2datadict.MonPresets[newObject.Id].Place
|
||||
newObject.Lookup.Name = d2datadict.MonPresets[ds1.Act][newObject.Id]
|
||||
}
|
||||
|
||||
if newObject.Lookup != nil && newObject.Lookup.ObjectsTxtId != -1 {
|
||||
|
Loading…
Reference in New Issue
Block a user