1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-12 23:43:24 -05:00
OpenDiablo2/d2core/d2records/monster_sound_loader.go
gravestench d6c9748fef
refactored logging in d2loader, d2record, and d2asset (#898)
* refactored logging in d2config, d2record, and d2asset

* asset manager, record manager, and file loader now utilitize d2util.Logger
* added colored logging to d2util.Logger (excluding windows platforms)
* removed mpq file verification from d2config; d2loader handles this
* record loaders now use the record manager's logger for printing info
* added command line argument for setting log level (`--loglevel 4`, `-l4`, or `-l 4`
* added `LogLevel` parameter to config file
* default log level will show errors, warnings, and info log messages
* specifying log level as an argument overrides setting from config file

* fixed log level tests
2020-11-02 21:23:07 -05:00

66 lines
2.1 KiB
Go

package d2records
import (
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2txt"
)
// Information gathered from [https://d2mods.info/forum/kb/viewarticle?a=418]
// LoadMonsterSounds loads MonsterSoundRecords into MonsterSounds
func monsterSoundsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records := make(MonsterSounds)
for d.Next() {
record := &MonsterSoundRecord{
ID: d.String("Id"),
Attack1: d.String("Attack1"),
Weapon1: d.String("Weapon1"),
Attack1Delay: d.Number("Att1Del"),
Weapon1Delay: d.Number("Wea1Del"),
Attack1Probability: d.Number("Att1Prb"),
Weapon1Volume: d.Number("Wea1Vol"),
Attack2: d.String("Attack2"),
Weapon2: d.String("Weapon2"),
Attack2Delay: d.Number("Att2Del"),
Weapon2Delay: d.Number("Wea2Del"),
Attack2Probability: d.Number("Att2Prb"),
Weapon2Volume: d.Number("Wea2Vol"),
Skill1: d.String("Skill1"),
Skill2: d.String("Skill2"),
Skill3: d.String("Skill3"),
Skill4: d.String("Skill4"),
Footstep: d.String("Footstep"),
FootstepLayer: d.String("FootstepLayer"),
FootstepCount: d.Number("FsCnt"),
FootstepOffset: d.Number("FsOff"),
FootstepProbability: d.Number("FsPrb"),
Neutral: d.String("Neutral"),
NeutralTime: d.Number("NeuTime"),
Init: d.String("Init"),
Taunt: d.String("Taunt"),
Flee: d.String("Flee"),
CvtMo1: d.String("CvtMo1"),
CvtMo2: d.String("CvtMo2"),
CvtMo3: d.String("CvtMo3"),
CvtSk1: d.String("CvtSk1"),
CvtSk2: d.String("CvtSk2"),
CvtSk3: d.String("CvtSk3"),
CvtTgt1: d.String("CvtTgt1"),
CvtTgt2: d.String("CvtTgt2"),
CvtTgt3: d.String("CvtTgt3"),
}
records[record.ID] = record
}
if d.Err != nil {
return d.Err
}
r.Logger.Infof("Loaded %d Monster Sound records", len(records))
r.Monster.Sounds = records
return nil
}