mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-09-25 20:55:55 -04:00
Add pettype.txt loader (#648)
* Add pettype.txt loader * Remove go.mod replace
This commit is contained in:
parent
bfd3f1046d
commit
333b8610ac
@ -257,6 +257,7 @@ func (a *App) loadDataDict() error {
|
|||||||
{d2resource.Shrines, d2datadict.LoadShrines},
|
{d2resource.Shrines, d2datadict.LoadShrines},
|
||||||
{d2resource.ElemType, d2datadict.LoadElemTypes},
|
{d2resource.ElemType, d2datadict.LoadElemTypes},
|
||||||
{d2resource.PlrMode, d2datadict.LoadPlrModes},
|
{d2resource.PlrMode, d2datadict.LoadPlrModes},
|
||||||
|
{d2resource.PetType, d2datadict.LoadPetTypes},
|
||||||
}
|
}
|
||||||
|
|
||||||
d2datadict.InitObjectRecords()
|
d2datadict.InitObjectRecords()
|
||||||
|
108
d2common/d2data/d2datadict/pettype.go
Normal file
108
d2common/d2data/d2datadict/pettype.go
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
package d2datadict
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
||||||
|
)
|
||||||
|
|
||||||
|
//PetTypeRecord represents a single line in PetType.txt
|
||||||
|
//The information has been gathered from [https://d2mods.info/forum/kb/viewarticle?a=355]
|
||||||
|
type PetTypeRecord struct {
|
||||||
|
//Name of the pet type, reffered by "pettype" in skills.txt
|
||||||
|
PetType string
|
||||||
|
|
||||||
|
//ID number of the pet type
|
||||||
|
Idx int
|
||||||
|
|
||||||
|
//ID number of the group this pet belongs to
|
||||||
|
Group int
|
||||||
|
|
||||||
|
BaseMax int
|
||||||
|
|
||||||
|
//If true, the pet warps with the player, otherwise it dies
|
||||||
|
Warp bool
|
||||||
|
|
||||||
|
//If true, and Warp is false, the pet only die if the distance between the player
|
||||||
|
//and the pet exceeds 41 sub-tiles.
|
||||||
|
Range bool
|
||||||
|
|
||||||
|
//Unknown
|
||||||
|
PartySend bool
|
||||||
|
|
||||||
|
//If true, can be unsummoned
|
||||||
|
Unsummon bool
|
||||||
|
|
||||||
|
//If true, pet is displayed on the automap
|
||||||
|
Automap bool
|
||||||
|
|
||||||
|
//String file for the text under the pet icon
|
||||||
|
Name string
|
||||||
|
|
||||||
|
//If true, the pet's HP will be displayed under the icon
|
||||||
|
DrawHP bool
|
||||||
|
|
||||||
|
//Pet icon type
|
||||||
|
IconType int
|
||||||
|
|
||||||
|
//.dc6 file for the pet's icon, located in /data/global/ui/hireables
|
||||||
|
BaseIcon string
|
||||||
|
|
||||||
|
//Alternative pet index from monstats.txt
|
||||||
|
MClass1 int
|
||||||
|
|
||||||
|
//Alternative pet icon .dc6 file
|
||||||
|
MIcon1 string
|
||||||
|
|
||||||
|
//ditto, there can be four alternatives
|
||||||
|
MClass2 int
|
||||||
|
MIcon2 string
|
||||||
|
MClass3 int
|
||||||
|
MIcon3 string
|
||||||
|
MClass4 int
|
||||||
|
MIcon4 string
|
||||||
|
|
||||||
|
//EOL int, not loaded
|
||||||
|
}
|
||||||
|
|
||||||
|
//PetTypes stores the PetTypeRecords
|
||||||
|
var PetTypes map[string]*PetTypeRecord //nolint:gochecknoglobals // Currently global by design
|
||||||
|
|
||||||
|
//LoadPetTypes loads PetTypeRecords into PetTypes
|
||||||
|
func LoadPetTypes(file []byte) {
|
||||||
|
PetTypes = make(map[string]*PetTypeRecord)
|
||||||
|
|
||||||
|
d := d2common.LoadDataDictionary(file)
|
||||||
|
for d.Next() {
|
||||||
|
record := &PetTypeRecord{
|
||||||
|
PetType: d.String("pet type"),
|
||||||
|
Idx: d.Number("idx"),
|
||||||
|
Group: d.Number("group"),
|
||||||
|
BaseMax: d.Number("basemax"),
|
||||||
|
Warp: d.Bool("warp"),
|
||||||
|
Range: d.Bool("range"),
|
||||||
|
PartySend: d.Bool("partysend"),
|
||||||
|
Unsummon: d.Bool("unsummon"),
|
||||||
|
Automap: d.Bool("automap"),
|
||||||
|
Name: d.String("name"),
|
||||||
|
DrawHP: d.Bool("drawhp"),
|
||||||
|
IconType: d.Number("icontype"),
|
||||||
|
BaseIcon: d.String("baseicon"),
|
||||||
|
MClass1: d.Number("mclass1"),
|
||||||
|
MIcon1: d.String("micon1"),
|
||||||
|
MClass2: d.Number("mclass2"),
|
||||||
|
MIcon2: d.String("micon2"),
|
||||||
|
MClass3: d.Number("mclass3"),
|
||||||
|
MIcon3: d.String("micon3"),
|
||||||
|
MClass4: d.Number("mclass4"),
|
||||||
|
MIcon4: d.String("micon4"),
|
||||||
|
}
|
||||||
|
PetTypes[record.PetType] = record
|
||||||
|
}
|
||||||
|
|
||||||
|
if d.Err != nil {
|
||||||
|
panic(d.Err)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Printf("Loaded %d PetType records", len(PetTypes))
|
||||||
|
}
|
13
d2common/d2enum/pet_icon_type.go
Normal file
13
d2common/d2enum/pet_icon_type.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package d2enum
|
||||||
|
|
||||||
|
// PetIconType determines the pet icon type
|
||||||
|
type PetIconType int
|
||||||
|
|
||||||
|
// Pet icon types
|
||||||
|
//The information has been gathered from [https://d2mods.info/forum/kb/viewarticle?a=355]
|
||||||
|
const (
|
||||||
|
NoIcon PetIconType = iota
|
||||||
|
ShowIconOnly
|
||||||
|
ShowIconAndQuantity //Quantity, such as the number of skeletons
|
||||||
|
ShowIconOnly2
|
||||||
|
)
|
@ -201,6 +201,7 @@ const (
|
|||||||
MonProp = "/data/global/excel/Monprop.txt"
|
MonProp = "/data/global/excel/Monprop.txt"
|
||||||
ElemType = "/data/global/excel/ElemTypes.txt"
|
ElemType = "/data/global/excel/ElemTypes.txt"
|
||||||
PlrMode = "/data/global/excel/PlrMode.txt"
|
PlrMode = "/data/global/excel/PlrMode.txt"
|
||||||
|
PetType = "/data/global/excel/pettype.txt"
|
||||||
|
|
||||||
// --- Animations ---
|
// --- Animations ---
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user