mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-09-10 13:34:36 -04:00
* 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
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package d2records
|
|
|
|
import (
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2txt"
|
|
)
|
|
|
|
func petTypesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
|
|
records := make(PetTypes)
|
|
|
|
for d.Next() {
|
|
record := &PetTypeRecord{
|
|
Name: d.String("pet type"),
|
|
ID: d.Number("idx"),
|
|
GroupID: 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"),
|
|
IconName: 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"),
|
|
}
|
|
|
|
records[record.Name] = record
|
|
}
|
|
|
|
if d.Err != nil {
|
|
return d.Err
|
|
}
|
|
|
|
r.Logger.Infof("Loaded %d PetType records", len(records))
|
|
|
|
r.PetTypes = records
|
|
|
|
return nil
|
|
}
|