mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-20 23:47:16 -05:00
Clean up monstats2 (#555)
This commit is contained in:
parent
76862b756c
commit
252e6c6c23
@ -11,22 +11,7 @@ import (
|
|||||||
type MonStats2Record struct {
|
type MonStats2Record struct {
|
||||||
// Available options for equipment
|
// Available options for equipment
|
||||||
// randomly selected from
|
// randomly selected from
|
||||||
HDv []string
|
EquipmentOptions [16][]string
|
||||||
TRv []string
|
|
||||||
LGv []string
|
|
||||||
Rav []string
|
|
||||||
Lav []string
|
|
||||||
RHv []string
|
|
||||||
LHv []string
|
|
||||||
SHv []string
|
|
||||||
S1v []string
|
|
||||||
S2v []string
|
|
||||||
S3v []string
|
|
||||||
S4v []string
|
|
||||||
S5v []string
|
|
||||||
S6v []string
|
|
||||||
S7v []string
|
|
||||||
S8v []string
|
|
||||||
|
|
||||||
Key string // Key, the object ID MonStatEx feild from MonStat
|
Key string // Key, the object ID MonStatEx feild from MonStat
|
||||||
BaseWeaponClass string
|
BaseWeaponClass string
|
||||||
@ -56,29 +41,13 @@ type MonStats2Record struct {
|
|||||||
MeleeRng int
|
MeleeRng int
|
||||||
|
|
||||||
// base weaponclass?
|
// base weaponclass?
|
||||||
|
|
||||||
HitClass int
|
HitClass int
|
||||||
|
|
||||||
// Sum of available components
|
// Sum of available components
|
||||||
TotalPieces int
|
TotalPieces int
|
||||||
|
|
||||||
// Number of directions for each mode
|
// Number of directions for each mode
|
||||||
dDT int
|
DirectionsPerMode [16]int
|
||||||
dNU int
|
|
||||||
dWL int
|
|
||||||
dGH int
|
|
||||||
dA1 int
|
|
||||||
dA2 int
|
|
||||||
dBL int
|
|
||||||
dSC int
|
|
||||||
dS1 int
|
|
||||||
dS2 int
|
|
||||||
dS3 int
|
|
||||||
dS4 int
|
|
||||||
dDD int
|
|
||||||
dKB int
|
|
||||||
dSQ int
|
|
||||||
dRN int
|
|
||||||
|
|
||||||
// If the units is restored on map reload
|
// If the units is restored on map reload
|
||||||
Restore int
|
Restore int
|
||||||
@ -118,40 +87,10 @@ type MonStats2Record struct {
|
|||||||
NoGfxHitTest bool
|
NoGfxHitTest bool
|
||||||
|
|
||||||
// Does the unit have this component
|
// Does the unit have this component
|
||||||
HD bool
|
HasComponent [16]bool
|
||||||
TR bool
|
|
||||||
LG bool
|
|
||||||
RA bool
|
|
||||||
LA bool
|
|
||||||
RH bool
|
|
||||||
LH bool
|
|
||||||
SH bool
|
|
||||||
S1 bool
|
|
||||||
S2 bool
|
|
||||||
S3 bool
|
|
||||||
S4 bool
|
|
||||||
S5 bool
|
|
||||||
S6 bool
|
|
||||||
S7 bool
|
|
||||||
S8 bool
|
|
||||||
|
|
||||||
// Available animation modes
|
// Available animation modes
|
||||||
mDT bool
|
HasAnimationMode [16]bool
|
||||||
mNU bool
|
|
||||||
mWL bool
|
|
||||||
mGH bool
|
|
||||||
mA1 bool
|
|
||||||
mA2 bool
|
|
||||||
mBL bool
|
|
||||||
mSC bool
|
|
||||||
mS1 bool
|
|
||||||
mS2 bool
|
|
||||||
mS3 bool
|
|
||||||
mS4 bool
|
|
||||||
mDD bool
|
|
||||||
mKB bool
|
|
||||||
mSQ bool
|
|
||||||
mRN bool
|
|
||||||
|
|
||||||
// Available modes while moving aside from WL and RN
|
// Available modes while moving aside from WL and RN
|
||||||
A1mv bool
|
A1mv bool
|
||||||
@ -238,81 +177,89 @@ func LoadMonStats2(file []byte) {
|
|||||||
d := d2common.LoadDataDictionary(file)
|
d := d2common.LoadDataDictionary(file)
|
||||||
for d.Next() {
|
for d.Next() {
|
||||||
record := &MonStats2Record{
|
record := &MonStats2Record{
|
||||||
Key: d.String("Id"),
|
Key: d.String("Id"),
|
||||||
Height: d.Number("Height"),
|
Height: d.Number("Height"),
|
||||||
OverlayHeight: d.Number("OverlayHeight"),
|
OverlayHeight: d.Number("OverlayHeight"),
|
||||||
PixelHeight: d.Number("pixHeight"),
|
PixelHeight: d.Number("pixHeight"),
|
||||||
SizeX: d.Number("SizeX"),
|
SizeX: d.Number("SizeX"),
|
||||||
SizeY: d.Number("SizeY"),
|
SizeY: d.Number("SizeY"),
|
||||||
SpawnMethod: d.Number("spawnCol"),
|
SpawnMethod: d.Number("spawnCol"),
|
||||||
MeleeRng: d.Number("MeleeRng"),
|
MeleeRng: d.Number("MeleeRng"),
|
||||||
BaseWeaponClass: d.String("BaseW"),
|
BaseWeaponClass: d.String("BaseW"),
|
||||||
HitClass: d.Number("HitClass"),
|
HitClass: d.Number("HitClass"),
|
||||||
HDv: d.List("HDv"),
|
EquipmentOptions: [16][]string{
|
||||||
TRv: d.List("TRv"),
|
d.List("HDv"),
|
||||||
LGv: d.List("LGv"),
|
d.List("TRv"),
|
||||||
Rav: d.List("Rav"),
|
d.List("LGv"),
|
||||||
Lav: d.List("Lav"),
|
d.List("Rav"),
|
||||||
RHv: d.List("RHv"),
|
d.List("Lav"),
|
||||||
LHv: d.List("LHv"),
|
d.List("RHv"),
|
||||||
SHv: d.List("SHv"),
|
d.List("LHv"),
|
||||||
S1v: d.List("S1v"),
|
d.List("SHv"),
|
||||||
S2v: d.List("S2v"),
|
d.List("S1v"),
|
||||||
S3v: d.List("S3v"),
|
d.List("S2v"),
|
||||||
S4v: d.List("S4v"),
|
d.List("S3v"),
|
||||||
S5v: d.List("S5v"),
|
d.List("S4v"),
|
||||||
S6v: d.List("S6v"),
|
d.List("S5v"),
|
||||||
S7v: d.List("S7v"),
|
d.List("S6v"),
|
||||||
S8v: d.List("S8v"),
|
d.List("S7v"),
|
||||||
HD: d.Bool("HD"),
|
d.List("S8v"),
|
||||||
TR: d.Bool("TR"),
|
},
|
||||||
LG: d.Bool("LG"),
|
HasComponent: [16]bool{
|
||||||
RA: d.Bool("RA"),
|
d.Bool("HD"),
|
||||||
LA: d.Bool("LA"),
|
d.Bool("TR"),
|
||||||
RH: d.Bool("RH"),
|
d.Bool("LG"),
|
||||||
LH: d.Bool("LH"),
|
d.Bool("RA"),
|
||||||
SH: d.Bool("SH"),
|
d.Bool("LA"),
|
||||||
S1: d.Bool("S1"),
|
d.Bool("RH"),
|
||||||
S2: d.Bool("S2"),
|
d.Bool("LH"),
|
||||||
S3: d.Bool("S3"),
|
d.Bool("SH"),
|
||||||
S4: d.Bool("S4"),
|
d.Bool("S1"),
|
||||||
S5: d.Bool("S5"),
|
d.Bool("S2"),
|
||||||
S6: d.Bool("S6"),
|
d.Bool("S3"),
|
||||||
S7: d.Bool("S7"),
|
d.Bool("S4"),
|
||||||
S8: d.Bool("S8"),
|
d.Bool("S5"),
|
||||||
TotalPieces: d.Number("TotalPieces"),
|
d.Bool("S6"),
|
||||||
mDT: d.Bool("mDT"),
|
d.Bool("S7"),
|
||||||
mNU: d.Bool("mNU"),
|
d.Bool("S8"),
|
||||||
mWL: d.Bool("mWL"),
|
},
|
||||||
mGH: d.Bool("mGH"),
|
TotalPieces: d.Number("TotalPieces"),
|
||||||
mA1: d.Bool("mA1"),
|
HasAnimationMode: [16]bool{
|
||||||
mA2: d.Bool("mA2"),
|
d.Bool("mDT"),
|
||||||
mBL: d.Bool("mBL"),
|
d.Bool("mNU"),
|
||||||
mSC: d.Bool("mSC"),
|
d.Bool("mWL"),
|
||||||
mS1: d.Bool("mS1"),
|
d.Bool("mGH"),
|
||||||
mS2: d.Bool("mS2"),
|
d.Bool("mA1"),
|
||||||
mS3: d.Bool("mS3"),
|
d.Bool("mA2"),
|
||||||
mS4: d.Bool("mS4"),
|
d.Bool("mBL"),
|
||||||
mDD: d.Bool("mDD"),
|
d.Bool("mSC"),
|
||||||
mKB: d.Bool("mKB"),
|
d.Bool("mS1"),
|
||||||
mSQ: d.Bool("mSQ"),
|
d.Bool("mS2"),
|
||||||
mRN: d.Bool("mRN"),
|
d.Bool("mS3"),
|
||||||
dDT: d.Number("mDT"),
|
d.Bool("mS4"),
|
||||||
dNU: d.Number("mNU"),
|
d.Bool("mDD"),
|
||||||
dWL: d.Number("mWL"),
|
d.Bool("mKB"),
|
||||||
dGH: d.Number("mGH"),
|
d.Bool("mSQ"),
|
||||||
dA1: d.Number("mA1"),
|
d.Bool("mRN"),
|
||||||
dA2: d.Number("mA2"),
|
},
|
||||||
dBL: d.Number("mBL"),
|
DirectionsPerMode: [16]int{
|
||||||
dSC: d.Number("mSC"),
|
d.Number("dDT"),
|
||||||
dS1: d.Number("mS1"),
|
d.Number("dNU"),
|
||||||
dS2: d.Number("mS2"),
|
d.Number("dWL"),
|
||||||
dS3: d.Number("mS3"),
|
d.Number("dGH"),
|
||||||
dS4: d.Number("mS4"),
|
d.Number("dA1"),
|
||||||
dDD: d.Number("mDD"),
|
d.Number("dA2"),
|
||||||
dKB: d.Number("mKB"),
|
d.Number("dBL"),
|
||||||
dSQ: d.Number("mSQ"),
|
d.Number("dSC"),
|
||||||
dRN: d.Number("mRN"),
|
d.Number("dS1"),
|
||||||
|
d.Number("dS2"),
|
||||||
|
d.Number("dS3"),
|
||||||
|
d.Number("dS4"),
|
||||||
|
d.Number("dDD"),
|
||||||
|
d.Number("dKB"),
|
||||||
|
d.Number("dSQ"),
|
||||||
|
d.Number("dRN"),
|
||||||
|
},
|
||||||
A1mv: d.Bool("A1mv"),
|
A1mv: d.Bool("A1mv"),
|
||||||
A2mv: d.Bool("A2mv"),
|
A2mv: d.Bool("A2mv"),
|
||||||
SCmv: d.Bool("SCmv"),
|
SCmv: d.Bool("SCmv"),
|
||||||
|
@ -34,23 +34,10 @@ func CreateNPC(x, y int, monstat *d2datadict.MonStatsRecord, direction int) *NPC
|
|||||||
monstatEx: d2datadict.MonStats2[monstat.ExtraDataKey],
|
monstatEx: d2datadict.MonStats2[monstat.ExtraDataKey],
|
||||||
}
|
}
|
||||||
|
|
||||||
equipment := &[d2enum.CompositeTypeMax]string{
|
var equipment [16]string
|
||||||
d2enum.CompositeTypeHead: selectEquip(result.monstatEx.HDv),
|
|
||||||
d2enum.CompositeTypeTorso: selectEquip(result.monstatEx.TRv),
|
for compType, opts := range result.monstatEx.EquipmentOptions {
|
||||||
d2enum.CompositeTypeLegs: selectEquip(result.monstatEx.LGv),
|
equipment[compType] = selectEquip(opts)
|
||||||
d2enum.CompositeTypeRightArm: selectEquip(result.monstatEx.Rav),
|
|
||||||
d2enum.CompositeTypeLeftArm: selectEquip(result.monstatEx.Lav),
|
|
||||||
d2enum.CompositeTypeRightHand: selectEquip(result.monstatEx.RHv),
|
|
||||||
d2enum.CompositeTypeLeftHand: selectEquip(result.monstatEx.LHv),
|
|
||||||
d2enum.CompositeTypeShield: selectEquip(result.monstatEx.SHv),
|
|
||||||
d2enum.CompositeTypeSpecial1: selectEquip(result.monstatEx.S1v),
|
|
||||||
d2enum.CompositeTypeSpecial2: selectEquip(result.monstatEx.S2v),
|
|
||||||
d2enum.CompositeTypeSpecial3: selectEquip(result.monstatEx.S3v),
|
|
||||||
d2enum.CompositeTypeSpecial4: selectEquip(result.monstatEx.S4v),
|
|
||||||
d2enum.CompositeTypeSpecial5: selectEquip(result.monstatEx.S5v),
|
|
||||||
d2enum.CompositeTypeSpecial6: selectEquip(result.monstatEx.S6v),
|
|
||||||
d2enum.CompositeTypeSpecial7: selectEquip(result.monstatEx.S7v),
|
|
||||||
d2enum.CompositeTypeSpecial8: selectEquip(result.monstatEx.S8v),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
composite, _ := d2asset.LoadComposite(d2enum.ObjectTypeCharacter, monstat.AnimationDirectoryToken,
|
composite, _ := d2asset.LoadComposite(d2enum.ObjectTypeCharacter, monstat.AnimationDirectoryToken,
|
||||||
@ -58,11 +45,13 @@ func CreateNPC(x, y int, monstat *d2datadict.MonStatsRecord, direction int) *NPC
|
|||||||
result.composite = composite
|
result.composite = composite
|
||||||
|
|
||||||
composite.SetMode("NU", result.monstatEx.BaseWeaponClass)
|
composite.SetMode("NU", result.monstatEx.BaseWeaponClass)
|
||||||
composite.Equip(equipment)
|
composite.Equip(&equipment)
|
||||||
|
|
||||||
result.SetSpeed(float64(monstat.SpeedBase))
|
result.SetSpeed(float64(monstat.SpeedBase))
|
||||||
result.mapEntity.directioner = result.rotate
|
result.mapEntity.directioner = result.rotate
|
||||||
|
|
||||||
|
result.composite.SetDirection(direction)
|
||||||
|
|
||||||
if result.monstatRecord != nil && result.monstatRecord.IsInteractable {
|
if result.monstatRecord != nil && result.monstatRecord.IsInteractable {
|
||||||
result.name = d2common.TranslateString(result.monstatRecord.NameStringTableKey)
|
result.name = d2common.TranslateString(result.monstatRecord.NameStringTableKey)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user