2020-07-31 17:56:00 -04:00
|
|
|
package d2datadict
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
|
|
|
)
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Information gathered from [https://d2mods.info/forum/kb/viewarticle?a=418]
|
|
|
|
|
|
|
|
// MonsterSoundRecord represents a single line in MonSounds.txt
|
2020-07-31 17:56:00 -04:00
|
|
|
type MonsterSoundRecord struct {
|
2020-08-04 11:16:06 -04:00
|
|
|
// ID is the identifier, used in MonStats.txt to refer to a particular sound record
|
2020-07-31 17:56:00 -04:00
|
|
|
ID string
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Melee attack sound ID, refers to a sound from Sounds.txt
|
2020-07-31 17:56:00 -04:00
|
|
|
Attack1 string
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Weapon attack sound ID, refers to a sound from Sounds.txt
|
2020-07-31 17:56:00 -04:00
|
|
|
Weapon1 string
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Delay in frames of Attack1 sound
|
2020-07-31 17:56:00 -04:00
|
|
|
Attack1Delay int
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Delay in frames of Weapon1 sound
|
2020-07-31 17:56:00 -04:00
|
|
|
Weapon1Delay int
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Probability of playing Attack1 sound instead of Weapon1
|
2020-07-31 17:56:00 -04:00
|
|
|
Attack1Probability int
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Overrides weapon volume from Sounds.txt
|
2020-07-31 17:56:00 -04:00
|
|
|
Weapon1Volume int
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Ditto, 2 sets of sounds are possible
|
2020-07-31 17:56:00 -04:00
|
|
|
Attack2 string
|
|
|
|
Weapon2 string
|
|
|
|
Attack2Delay int
|
|
|
|
Weapon2Delay int
|
|
|
|
Attack2Probability int
|
|
|
|
Weapon2Volume int
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Sound when monster takes a hit, refers to a sound from Sounds.txt
|
2020-07-31 17:56:00 -04:00
|
|
|
HitSound string
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Sound when monster dies, refers to a sound from Sounds.txt
|
2020-07-31 17:56:00 -04:00
|
|
|
DeathSound string
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Delay in frames of HitSound
|
2020-07-31 17:56:00 -04:00
|
|
|
HitDelay int
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Delay in frames of DeathSound
|
2020-07-31 17:56:00 -04:00
|
|
|
DeaDelay int
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Sound when monster enters skill mode
|
2020-07-31 17:56:00 -04:00
|
|
|
Skill1 string
|
|
|
|
Skill2 string
|
|
|
|
Skill3 string
|
|
|
|
Skill4 string
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Sound played each loop of the WL animation
|
2020-07-31 17:56:00 -04:00
|
|
|
Footstep string
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Additional WL animation sound
|
2020-07-31 17:56:00 -04:00
|
|
|
FootstepLayer string
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Number of footstep sounds played (e.g. 2 for two-legged monsters)
|
2020-07-31 17:56:00 -04:00
|
|
|
FootstepCount int
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// FsOff, possibly delay between footstep sounds
|
2020-07-31 17:56:00 -04:00
|
|
|
FootstepOffset int
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Probability of playing footstep sound, percentage
|
2020-07-31 17:56:00 -04:00
|
|
|
FootstepProbability int
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Sound when monster is neutral (also played when walking)
|
2020-07-31 17:56:00 -04:00
|
|
|
Neutral string
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Delay in frames between neutral sounds
|
2020-07-31 17:56:00 -04:00
|
|
|
NeutralTime int
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Sound when monster is initialized
|
2020-07-31 17:56:00 -04:00
|
|
|
Init string
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Sound when monster is encountered
|
2020-07-31 17:56:00 -04:00
|
|
|
Taunt string
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// Sound when monster retreats
|
2020-07-31 17:56:00 -04:00
|
|
|
Flee string
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// The following are related to skills in some way
|
|
|
|
// Initial monster animation code (MonMode.txt)
|
2020-07-31 17:56:00 -04:00
|
|
|
CvtMo1 string
|
2020-08-04 11:16:06 -04:00
|
|
|
// ID of skill
|
2020-07-31 17:56:00 -04:00
|
|
|
CvtSk1 string
|
2020-08-04 11:16:06 -04:00
|
|
|
// End monster animation code (MonMode.txt)
|
2020-07-31 17:56:00 -04:00
|
|
|
CvtTgt1 string
|
|
|
|
|
|
|
|
CvtMo2 string
|
|
|
|
CvtSk2 string
|
|
|
|
CvtTgt2 string
|
|
|
|
|
|
|
|
CvtMo3 string
|
|
|
|
CvtSk3 string
|
|
|
|
CvtTgt3 string
|
|
|
|
}
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// MonsterSounds stores the MonsterSoundRecords
|
|
|
|
//nolint:gochecknoglobals // Currently global by design
|
2020-07-31 17:56:00 -04:00
|
|
|
var MonsterSounds map[string]*MonsterSoundRecord
|
|
|
|
|
2020-08-04 11:16:06 -04:00
|
|
|
// LoadMonsterSounds loads MonsterSoundRecords into MonsterSounds
|
2020-07-31 17:56:00 -04:00
|
|
|
func LoadMonsterSounds(file []byte) {
|
|
|
|
MonsterSounds = make(map[string]*MonsterSoundRecord)
|
|
|
|
|
|
|
|
d := d2common.LoadDataDictionary(file)
|
|
|
|
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"),
|
|
|
|
}
|
|
|
|
MonsterSounds[record.ID] = record
|
|
|
|
}
|
|
|
|
|
|
|
|
if d.Err != nil {
|
|
|
|
panic(d.Err)
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Printf("Loaded %d MonsterUniqueModifier records", len(MonsterUniqueModifiers))
|
|
|
|
}
|