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