Merge pull request #988 from Intyre/log

Cleanup d2records logging
This commit is contained in:
Tim Sarbin 2020-12-18 19:24:01 -05:00 committed by GitHub
commit a4a7c8d7e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
103 changed files with 159 additions and 163 deletions

View File

@ -31,7 +31,7 @@ const originalFPS float64 = 25
// A Sound that can be started and stopped
type Sound struct {
effect d2interface.SoundEffect
entry *d2records.SoundDetailsRecord
entry *d2records.SoundDetailRecord
volume float64
vTarget float64
vRate float64

View File

@ -110,7 +110,7 @@ func (f *HeroStateFactory) GetAllHeroStates() ([]*HeroState, error) {
}
// CreateHeroSkillsState will assemble the hero skills from the class stats record.
func (f *HeroStateFactory) CreateHeroSkillsState(classStats *d2records.CharStatsRecord, heroType d2enum.Hero) (map[int]*HeroSkill, error) {
func (f *HeroStateFactory) CreateHeroSkillsState(classStats *d2records.CharStatRecord, heroType d2enum.Hero) (map[int]*HeroSkill, error) {
baseSkills := map[int]*HeroSkill{}
for idx := range classStats.BaseSkill {

View File

@ -30,7 +30,7 @@ type HeroStatsState struct {
}
// CreateHeroStatsState generates a running state from a hero stats.
func (f *HeroStateFactory) CreateHeroStatsState(heroClass d2enum.Hero, classStats *d2records.CharStatsRecord) *HeroStatsState {
func (f *HeroStateFactory) CreateHeroStatsState(heroClass d2enum.Hero, classStats *d2records.CharStatRecord) *HeroStatsState {
result := HeroStatsState{
Level: 1,
Experience: 0,

View File

@ -277,7 +277,7 @@ var itemStatCosts = map[string]*d2records.ItemStatCostRecord{
}
// nolint:gochecknoglobals // just a test
var charStats = map[d2enum.Hero]*d2records.CharStatsRecord{
var charStats = map[d2enum.Hero]*d2records.CharStatRecord{
d2enum.HeroPaladin: {
Class: d2enum.HeroPaladin,
SkillStrAll: "to Paladin Skill Levels",
@ -297,7 +297,7 @@ var skillDetails = map[int]*d2records.SkillRecord{
}
// nolint:gochecknoglobals // just a test
var monStats = map[string]*d2records.MonStatsRecord{
var monStats = map[string]*d2records.MonStatRecord{
"Specter": {NameString: "Specter", ID: 40},
}

View File

@ -180,7 +180,7 @@ func (f *MapEntityFactory) NewItem(x, y int, codes ...string) (*Item, error) {
}
// NewNPC creates a new NPC and returns a pointer to it.
func (f *MapEntityFactory) NewNPC(x, y int, monstat *d2records.MonStatsRecord, direction int) (*NPC, error) {
func (f *MapEntityFactory) NewNPC(x, y int, monstat *d2records.MonStatRecord, direction int) (*NPC, error) {
// https://github.com/OpenDiablo2/OpenDiablo2/issues/803
result := &NPC{
mapEntity: newMapEntity(x, y),
@ -263,7 +263,7 @@ func (f *MapEntityFactory) NewCastOverlay(x, y int, overlayRecord *d2records.Ove
}
// NewObject creates an instance of AnimatedComposite
func (f *MapEntityFactory) NewObject(x, y int, objectRec *d2records.ObjectDetailsRecord,
func (f *MapEntityFactory) NewObject(x, y int, objectRec *d2records.ObjectDetailRecord,
palettePath string) (*Object, error) {
locX, locY := float64(x), float64(y)
entity := &Object{

View File

@ -22,8 +22,8 @@ type NPC struct {
action int
path int
repetitions int
monstatRecord *d2records.MonStatsRecord
monstatEx *d2records.MonStats2Record
monstatRecord *d2records.MonStatRecord
monstatEx *d2records.MonStat2Record
HasPaths bool
isDone bool
}

View File

@ -20,7 +20,7 @@ type Object struct {
composite *d2asset.Composite
highlight bool
// nameLabel d2ui.Label
objectRecord *d2records.ObjectDetailsRecord
objectRecord *d2records.ObjectDetailRecord
drawLayer int
name string
}

View File

@ -22,7 +22,7 @@ func armorTypesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Animation.Token.Armor = records
r.Logger.Infof("Loaded %d ArmorType records", len(records))
r.Debugf("Loaded %d ArmorType records", len(records))
return nil
}

View File

@ -79,7 +79,7 @@ func autoMagicLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d AutoMagic records", len(records))
r.Debugf("Loaded %d AutoMagic records", len(records))
r.Item.AutoMagic = records

View File

@ -37,7 +37,7 @@ func autoMapLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d AutoMapRecord records", len(records))
r.Debugf("Loaded %d AutoMap records", len(records))
r.Level.AutoMaps = records

View File

@ -102,7 +102,7 @@ func beltsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d belts", len(records))
r.Debugf("Loaded %d Belt records", len(records))
r.Item.Belts = records

View File

@ -19,7 +19,7 @@ func bodyLocationsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
panic(d.Err)
}
r.Logger.Infof("Loaded %d Body Location records", len(records))
r.Debugf("Loaded %d BodyLocation records", len(records))
r.BodyLocations = records

View File

@ -8,7 +8,7 @@ func booksLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records := make(Books)
for d.Next() {
record := &BooksRecord{
record := &BookRecord{
Name: d.String("Name"),
Namco: d.String("Namco"),
Completed: d.String("Completed"),
@ -28,7 +28,7 @@ func booksLoader(r *RecordManager, d *d2txt.DataDictionary) error {
panic(d.Err)
}
r.Logger.Infof("Loaded %d book items", len(records))
r.Debugf("Loaded %d Book records", len(records))
r.Item.Books = records

View File

@ -1,10 +1,10 @@
package d2records
// Books stores all of the BooksRecords
type Books map[string]*BooksRecord
// Books stores all of the BookRecords
type Books map[string]*BookRecord
// BooksRecord is a representation of a row from books.txt
type BooksRecord struct {
// BookRecord is a representation of a row from books.txt
type BookRecord struct {
Name string
Namco string // The displayed name, where the string prefix is "Tome"
Completed string

View File

@ -5,32 +5,28 @@ import (
)
func skillCalcLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records, err := loadCalculations(r, d)
records, err := loadCalculations(r, d, "Skill")
if err != nil {
return err
}
r.Logger.Infof("Loaded %d Skill Calculation records", len(records))
r.Calculation.Skills = records
return nil
}
func missileCalcLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records, err := loadCalculations(r, d)
records, err := loadCalculations(r, d, "Missile")
if err != nil {
return err
}
r.Logger.Infof("Loaded %d Missile Calculation records", len(records))
r.Calculation.Missiles = records
return nil
}
func loadCalculations(r *RecordManager, d *d2txt.DataDictionary) (Calculations, error) {
func loadCalculations(r *RecordManager, d *d2txt.DataDictionary, name string) (Calculations, error) {
records := make(Calculations)
for d.Next() {
@ -45,7 +41,7 @@ func loadCalculations(r *RecordManager, d *d2txt.DataDictionary) (Calculations,
return nil, d.Err
}
r.Logger.Infof("Loaded %d Skill Calculation records", len(records))
r.Debugf("Loaded %d %s Calculation records", len(records), name)
return records, nil
}

View File

@ -38,7 +38,7 @@ func charStatsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
}
for d.Next() {
record := &CharStatsRecord{
record := &CharStatRecord{
Class: stringMap[d.String("class")],
InitStr: d.Number("str"),
@ -136,7 +136,7 @@ func charStatsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d CharStats records", len(records))
r.Debugf("Loaded %d CharStat records", len(records))
r.Character.Stats = records

View File

@ -2,11 +2,11 @@ package d2records
import "github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
// CharStats holds all of the CharStatsRecords
type CharStats map[d2enum.Hero]*CharStatsRecord
// CharStats holds all of the CharStatRecords
type CharStats map[d2enum.Hero]*CharStatRecord
// CharStatsRecord is a struct that represents a single row from charstats.txt
type CharStatsRecord struct {
// CharStatRecord is a struct that represents a single row from charstats.txt
type CharStatRecord struct {
Class d2enum.Hero
// the initial stats at character level 1

View File

@ -22,7 +22,7 @@ func colorsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Colors = records
r.Logger.Infof("Loaded %d Color records", len(records))
r.Debugf("Loaded %d Color records", len(records))
return nil
}

View File

@ -19,7 +19,7 @@ func componentCodesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d ComponentCode records", len(records))
r.Debugf("Loaded %d ComponentCode records", len(records))
r.ComponentCodes = records

View File

@ -22,7 +22,7 @@ func compositeTypeLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Animation.Token.Composite = records
r.Logger.Infof("Loaded %d Composite Type records", len(records))
r.Debugf("Loaded %d CompositeType records", len(records))
return nil
}

View File

@ -22,7 +22,7 @@ func cubeModifierLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Item.Cube.Modifiers = records
r.Logger.Infof("Loaded %d Cube Modifier records", len(records))
r.Debugf("Loaded %d CubeModifier records", len(records))
return nil
}

View File

@ -22,7 +22,7 @@ func cubeTypeLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Item.Cube.Types = records
r.Logger.Infof("Loaded %d Cube Type records", len(records))
r.Debugf("Loaded %d CubeType records", len(records))
return nil
}

View File

@ -96,7 +96,7 @@ func cubeRecipeLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d CubeMainRecord records", len(records))
r.Debugf("Loaded %d CubeRecipe records", len(records))
r.Item.Cube.Recipes = records

View File

@ -42,7 +42,7 @@ func difficultyLevelsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d DifficultyLevel records", len(records))
r.Debugf("Loaded %d DifficultyLevel records", len(records))
r.DifficultyLevels = records

View File

@ -20,7 +20,7 @@ func elemTypesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d ElemType records", len(records))
r.Debugf("Loaded %d ElemType records", len(records))
r.ElemTypes = records

View File

@ -20,7 +20,7 @@ func eventsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d Event records", len(records))
r.Debugf("Loaded %d Event records", len(records))
r.Character.Events = records

View File

@ -48,7 +48,7 @@ func experienceLoader(r *RecordManager, d *d2txt.DataDictionary) error {
}
for d.Next() {
record := &ExperienceBreakpointsRecord{
record := &ExperienceBreakpointRecord{
Level: d.Number("Level"),
HeroBreakpoints: map[d2enum.Hero]int{
d2enum.HeroAmazon: d.Number("Amazon"),
@ -68,7 +68,7 @@ func experienceLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d Experience Breakpoint records", len(breakpoints))
r.Debugf("Loaded %d ExperienceBreakpoint records", len(breakpoints))
r.Character.MaxLevel = maxLevels
r.Character.Experience = breakpoints

View File

@ -4,14 +4,14 @@ import "github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
// ExperienceBreakpoints describes the required experience
// for each level for each character class
type ExperienceBreakpoints map[int]*ExperienceBreakpointsRecord
type ExperienceBreakpoints map[int]*ExperienceBreakpointRecord
// ExperienceMaxLevels defines the max character levels
type ExperienceMaxLevels map[d2enum.Hero]int
// ExperienceBreakpointsRecord describes the experience points required to
// ExperienceBreakpointRecord describes the experience points required to
// gain a level for all character classes
type ExperienceBreakpointsRecord struct {
type ExperienceBreakpointRecord struct {
Level int
HeroBreakpoints map[d2enum.Hero]int
Ratio int

View File

@ -19,7 +19,7 @@ func gambleLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d gamble records", len(records))
r.Debugf("Loaded %d Gamble records", len(records))
r.Gamble = records

View File

@ -4,12 +4,12 @@ import (
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2txt"
)
// LoadGems loads gem records into a map[string]*GemsRecord
// LoadGems loads gem records into a map[string]*GemRecord
func gemsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records := make(Gems)
for d.Next() {
gem := &GemsRecord{
gem := &GemRecord{
Name: d.String("name"),
Letter: d.String("letter"),
Transform: d.Number("transform"),
@ -60,7 +60,7 @@ func gemsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d Gems records", len(records))
r.Debugf("Loaded %d Gem records", len(records))
r.Item.Gems = records

View File

@ -1,11 +1,11 @@
package d2records
// Gems stores all of the GemsRecords
type Gems map[string]*GemsRecord
// Gems stores all of the GemRecords
type Gems map[string]*GemRecord
// GemsRecord is a representation of a single row of gems.txt
// GemRecord is a representation of a single row of gems.txt
// it describes the properties of socketable items
type GemsRecord struct {
type GemRecord struct {
Name string
Letter string
Transform int

View File

@ -22,7 +22,7 @@ func hirelingDescriptionLoader(r *RecordManager, d *d2txt.DataDictionary) error
r.Hireling.Descriptions = records
r.Logger.Infof("Loaded %d Hireling Descriptions records", len(records))
r.Debugf("Loaded %d HirelingDescription records", len(records))
return nil
}

View File

@ -90,7 +90,7 @@ func hirelingLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d Hireling records", len(records))
r.Debugf("Loaded %d Hireling records", len(records))
r.Hireling.Details = records

View File

@ -22,7 +22,7 @@ func hitClassLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Animation.Token.HitClass = records
r.Logger.Infof("Loaded %d HitClass records", len(records))
r.Debugf("Loaded %d HitClass records", len(records))
return nil
}

View File

@ -130,7 +130,7 @@ func inventoryLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d Inventory Panel records", len(records))
r.Debugf("Loaded %d Inventory records", len(records))
r.Layout.Inventory = records

View File

@ -70,7 +70,7 @@ func loadAffixDictionary(
}
name := getAffixString(superType, subType)
r.Logger.Infof("Loaded %d %s records", len(records), name)
r.Debugf("Loaded %d %s records", len(records), name)
return records, groups, nil
}

View File

@ -16,7 +16,7 @@ func armorLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return err
}
r.Logger.Infof("Loaded %d armors", len(records))
r.Debugf("Loaded %d Armor Item records", len(records))
r.Item.Armors = records

View File

@ -21,7 +21,7 @@ func lowQualityLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Item.LowQualityPrefixes = records
r.Logger.Infof("Loaded %d Low Item Quality records", len(records))
r.Debugf("Loaded %d LowQuality records", len(records))
return nil
}

View File

@ -13,7 +13,7 @@ func miscItemsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return err
}
r.Logger.Infof("Loaded %d misc items", len(records))
r.Debugf("Loaded %d Misc Item records", len(records))
r.Item.Misc = records

View File

@ -45,7 +45,7 @@ func itemQualityLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Item.Quality = records
r.Logger.Infof("Loaded %d ItemQualities records", len(records))
r.Debugf("Loaded %d ItemQuality records", len(records))
return nil
}

View File

@ -55,7 +55,7 @@ func itemRatioLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d ItemRatio records", len(records))
r.Debugf("Loaded %d ItemRatio records", len(records))
r.Item.Ratios = records

View File

@ -76,7 +76,7 @@ func itemTypesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d ItemType records", len(records))
r.Debugf("Loaded %d ItemType records", len(records))
r.Item.Types = records
r.Item.Equivalency = equivMap

View File

@ -13,7 +13,7 @@ func weaponsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return err
}
r.Logger.Infof("Loaded %d weapons", len(records))
r.Debugf("Loaded %d Weapon records", len(records))
r.Item.Weapons = records

View File

@ -95,7 +95,7 @@ func itemStatCostLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d ItemStatCost records", len(records))
r.Debugf("Loaded %d ItemStatCost records", len(records))
r.Item.Stats = records

View File

@ -11,7 +11,7 @@ func levelDetailsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records := make(LevelDetails)
for d.Next() {
record := &LevelDetailsRecord{
record := &LevelDetailRecord{
Name: d.String("Name "),
ID: d.Number("Id"),
Palette: d.Number("Pal"),
@ -165,7 +165,7 @@ func levelDetailsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d LevelDetails records", len(records))
r.Debugf("Loaded %d LevelDetail records", len(records))
r.Level.Details = records

View File

@ -2,13 +2,13 @@ package d2records
import "github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
// LevelDetails has all of the LevelDetailsRecords
type LevelDetails map[int]*LevelDetailsRecord
// LevelDetails has all of the LevelDetailRecords
type LevelDetails map[int]*LevelDetailRecord
// LevelDetailsRecord is a representation of a row from levels.txt
// LevelDetailRecord is a representation of a row from levels.txt
// it describes lots of things about the levels, like where they are connected,
// what kinds of monsters spawn, the level generator type, and lots of other stuff.
type LevelDetailsRecord struct {
type LevelDetailRecord struct {
// Name
// This column has no function, it only serves as a comment field to make it

View File

@ -8,7 +8,7 @@ func levelMazeDetailsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records := make(LevelMazeDetails)
for d.Next() {
record := &LevelMazeDetailsRecord{
record := &LevelMazeDetailRecord{
Name: d.String("Name"),
LevelID: d.Number("Level"),
NumRoomsNormal: d.Number("Rooms"),
@ -24,7 +24,7 @@ func levelMazeDetailsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d LevelMazeDetails records", len(records))
r.Debugf("Loaded %d LevelMazeDetail records", len(records))
r.Level.Maze = records

View File

@ -1,11 +1,11 @@
package d2records
// LevelMazeDetails stores all of the LevelMazeDetailsRecords
type LevelMazeDetails map[int]*LevelMazeDetailsRecord
// LevelMazeDetails stores all of the LevelMazeDetailRecords
type LevelMazeDetails map[int]*LevelMazeDetailRecord
// LevelMazeDetailsRecord is a representation of a row from lvlmaze.txt
// LevelMazeDetailRecord is a representation of a row from lvlmaze.txt
// these records define the parameters passed to the maze level generator
type LevelMazeDetailsRecord struct {
type LevelMazeDetailRecord struct {
// descriptive, not loaded in game. Corresponds with Name field in
// Levels.txt
Name string // Name

View File

@ -42,7 +42,7 @@ func levelPresetLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records[record.DefinitionID] = record
}
r.Logger.Infof("Loaded %d level presets", len(records))
r.Debugf("Loaded %d LevelPresets records", len(records))
if d.Err != nil {
return d.Err

View File

@ -40,7 +40,7 @@ func levelSubstitutionsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d LevelSubstitution records", len(records))
r.Debugf("Loaded %d LevelSubstitution records", len(records))
r.Level.Sub = records

View File

@ -58,7 +58,7 @@ func levelTypesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d LevelType records", len(records))
r.Debugf("Loaded %d LevelType records", len(records))
r.Level.Types = records

View File

@ -30,7 +30,7 @@ func levelWarpsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d level warps", len(records))
r.Debugf("Loaded %d LevelWarp records", len(records))
r.Level.Warp = records

View File

@ -304,7 +304,7 @@ func missilesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d Missile Records", len(records))
r.Debugf("Loaded %d Missile records", len(records))
r.Missiles = records

View File

@ -19,7 +19,7 @@ func monsterAiLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d MonsterAI records", len(records))
r.Debugf("Loaded %d MonsterAI records", len(records))
r.Monster.AI = records

View File

@ -49,7 +49,7 @@ func monsterEquipmentLoader(r *RecordManager, d *d2txt.DataDictionary) error {
length += len(records[k])
}
r.Logger.Infof("Loaded %d MonsterEquipment records", length)
r.Debugf("Loaded %d MonsterEquipment records", length)
r.Monster.Equipment = records

View File

@ -52,7 +52,7 @@ func monsterLevelsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d MonsterLevel records", len(records))
r.Debugf("Loaded %d MonsterLevel records", len(records))
r.Monster.Levels = records

View File

@ -21,7 +21,7 @@ func monsterModeLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d MonMode records", len(records))
r.Debugf("Loaded %d MonMode records", len(records))
r.Monster.Modes = records

View File

@ -1,6 +1,6 @@
package d2records
// MonModes stores all of the GemsRecords
// MonModes stores all of the MonModeRecords
type MonModes map[string]*MonModeRecord
// MonModeRecord is a representation of a single row of Monmode.txt

View File

@ -18,7 +18,7 @@ func monsterPlacementsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Monster.Placements = records
r.Logger.Infof("Loaded %d MonsterPlacement records", len(records))
r.Debugf("Loaded %d MonsterPlacement records", len(records))
return nil
}

View File

@ -21,7 +21,7 @@ func monsterPresetLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d MonPreset records", len(records))
r.Debugf("Loaded %d MonPreset records", len(records))
r.Monster.Presets = records

View File

@ -57,7 +57,7 @@ func monsterPropertiesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d MonProp records", len(records))
r.Debugf("Loaded %d MonProp records", len(records))
r.Monster.Props = records

View File

@ -31,7 +31,7 @@ func monsterSequencesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d MonsterSequence records", len(records))
r.Debugf("Loaded %d MonsterSequence records", len(records))
r.Monster.Sequences = records

View File

@ -57,7 +57,7 @@ func monsterSoundsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d Monster Sound records", len(records))
r.Debugf("Loaded %d MonsterSound records", len(records))
r.Monster.Sounds = records

View File

@ -7,7 +7,7 @@ import (
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2txt"
)
// LoadMonStats2 loads MonStats2Records from monstats2.txt
// LoadMonStats2 loads MonStat2Records from monstats2.txt
//nolint:funlen //just a big data loader
func monsterStats2Loader(r *RecordManager, d *d2txt.DataDictionary) error {
records := make(MonStats2)
@ -18,7 +18,7 @@ func monsterStats2Loader(r *RecordManager, d *d2txt.DataDictionary) error {
return err
}
record := &MonStats2Record{
record := &MonStat2Record{
Key: d.String("Id"),
Height: d.Number("Height"),
OverlayHeight: d.Number("OverlayHeight"),
@ -161,7 +161,7 @@ func monsterStats2Loader(r *RecordManager, d *d2txt.DataDictionary) error {
panic(d.Err)
}
r.Logger.Infof("Loaded %d MonStats2 records", len(records))
r.Debugf("Loaded %d MonStat2 records", len(records))
r.Monster.Stats2 = records

View File

@ -2,11 +2,11 @@ package d2records
import "github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
// MonStats2 stores all of the MonStats2Records
type MonStats2 map[string]*MonStats2Record
// MonStats2 stores all of the MonStat2Records
type MonStats2 map[string]*MonStat2Record
// MonStats2Record is a representation of a row from monstats2.txt
type MonStats2Record struct {
// MonStat2Record is a representation of a row from monstats2.txt
type MonStat2Record struct {
// Available options for equipment
// randomly selected from
EquipmentOptions [16][]string

View File

@ -10,7 +10,7 @@ func monsterStatsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records := make(MonStats)
for d.Next() {
record := &MonStatsRecord{
record := &MonStatRecord{
Key: d.String("Id"),
ID: d.Number("hcIdx"),
BaseKey: d.String("BaseId"),
@ -272,7 +272,7 @@ func monsterStatsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d MonStats records", len(records))
r.Debugf("Loaded %d MonStat records", len(records))
r.Monster.Stats = records

View File

@ -4,13 +4,13 @@ import "github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
// https://d2mods.info/forum/kb/viewarticle?a=360
// MonStats stores all of the MonStat Records
type MonStats map[string]*MonStatsRecord
// MonStats stores all of the MonStatRecords
type MonStats map[string]*MonStatRecord
type (
// MonStatsRecord represents a single row from `data/global/excel/monstats.txt` in the MPQ files.
// MonStatRecord represents a single row from `data/global/excel/monstats.txt` in the MPQ files.
// These records are used for creating monsters.
MonStatsRecord struct {
MonStatRecord struct {
// Key contains the pointer that will be used in other txt files
// such as levels.txt and superuniques.txt.

View File

@ -40,7 +40,7 @@ func monsterSuperUniqeLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Monster.Unique.Super = records
r.Logger.Infof("Loaded %d SuperUnique records", len(records))
r.Debugf("Loaded %d SuperUnique records", len(records))
return nil
}

View File

@ -23,7 +23,7 @@ func monsterTypesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
panic(d.Err)
}
r.Logger.Infof("Loaded %d MonType records", len(records))
r.Debugf("Loaded %d MonType records", len(records))
r.Monster.Types = records

View File

@ -59,7 +59,7 @@ func uniqueMonsterPrefixLoader(r *RecordManager, d *d2txt.DataDictionary) error
r.Monster.Name.Prefix = records
r.Logger.Infof("Loaded %d unique monster prefix records", len(records))
r.Debugf("Loaded %d UniqueMonsterPrefix records", len(records))
return nil
}
@ -72,7 +72,7 @@ func uniqueMonsterSuffixLoader(r *RecordManager, d *d2txt.DataDictionary) error
r.Monster.Name.Suffix = records
r.Logger.Infof("Loaded %d unique monster suffix records", len(records))
r.Debugf("Loaded %d UniqueMonsterSuffix records", len(records))
return nil
}

View File

@ -48,7 +48,7 @@ func monsterUniqModifiersLoader(r *RecordManager, d *d2txt.DataDictionary) error
return d.Err
}
r.Logger.Infof("Loaded %d MonsterUniqueModifier records", len(records))
r.Debugf("Loaded %d MonsterUniqueModifier records", len(records))
r.Monster.Unique.Mods = records
r.Monster.Unique.Constants = constants

View File

@ -64,7 +64,7 @@ func npcLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.NPCs = records
r.Logger.Infof("Loaded %d NPC records", len(records))
r.Debugf("Loaded %d NPC records", len(records))
return nil
}

View File

@ -11,7 +11,7 @@ func objectDetailsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
i := 0
for d.Next() {
record := &ObjectDetailsRecord{
record := &ObjectDetailRecord{
Index: i,
Name: d.String("Name"),
Description: d.String("description - not loaded"),
@ -225,7 +225,7 @@ func objectDetailsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d objects", len(records))
r.Debugf("Loaded %d ObjectDetail records", len(records))
r.Object.Details = records

View File

@ -1,10 +1,10 @@
package d2records
// ObjectDetails stores all of the ObjectDetailRecords
type ObjectDetails map[int]*ObjectDetailsRecord
type ObjectDetails map[int]*ObjectDetailRecord
// ObjectDetailsRecord represents the settings for one type of object from objects.txt
type ObjectDetailsRecord struct {
// ObjectDetailRecord represents the settings for one type of object from objects.txt
type ObjectDetailRecord struct {
Index int // Line number in file, this is the actual index used for objects
FrameCount [8]int // how many frames does this mode have, 0 = skip
FrameDelta [8]int // what rate is the animation played at (256 = 100% speed)

View File

@ -32,7 +32,7 @@ func objectGroupsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d ObjectGroup records", len(records))
r.Debugf("Loaded %d ObjectGroup records", len(records))
return nil
}

View File

@ -22,7 +22,7 @@ func objectModesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Object.Modes = records
r.Logger.Infof("Loaded %d ObjectMode records", len(records))
r.Debugf("Loaded %d ObjectMode records", len(records))
return nil
}

View File

@ -23,7 +23,7 @@ func objectTypesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d object types", len(records))
r.Debugf("Loaded %d ObjectType records", len(records))
r.Object.Types = records

View File

@ -35,7 +35,7 @@ func overlaysLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d Overlay records", len(records))
r.Debugf("Loaded %d Overlay records", len(records))
r.Layout.Overlays = records

View File

@ -39,7 +39,7 @@ func petTypesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d PetType records", len(records))
r.Debugf("Loaded %d PetType records", len(records))
r.PetTypes = records

View File

@ -29,7 +29,7 @@ func playerClassLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return d.Err
}
r.Logger.Infof("Loaded %d PlayerClass records", len(records))
r.Debugf("Loaded %d PlayerClass records", len(records))
r.Character.Classes = records

View File

@ -23,7 +23,7 @@ func playerModesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Character.Modes = records
r.Logger.Infof("Loaded %d PlayerMode records", len(records))
r.Debugf("Loaded %d PlayerMode records", len(records))
return nil
}

View File

@ -24,7 +24,7 @@ func playerTypeLoader(r *RecordManager, d *d2txt.DataDictionary) error {
panic(d.Err)
}
r.Logger.Infof("Loaded %d PlayerType records", len(records))
r.Debugf("Loaded %d PlayerType records", len(records))
r.Animation.Token.Player = records

View File

@ -67,7 +67,7 @@ func propertyLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Properties = records
r.Logger.Infof("Loaded %d Property records", len(records))
r.Debugf("Loaded %d Property records", len(records))
return nil
}

View File

@ -12,7 +12,7 @@ func rareItemPrefixLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Item.Rare.Prefix = records
r.Logger.Infof("Loaded %d RarePrefix records", len(records))
r.Debugf("Loaded %d RarePrefix records", len(records))
return nil
}

View File

@ -10,7 +10,7 @@ func rareItemSuffixLoader(r *RecordManager, d *d2txt.DataDictionary) error {
return err
}
r.Logger.Infof("Loaded %d RareSuffix records", len(records))
r.Debugf("Loaded %d RareSuffix records", len(records))
r.Item.Rare.Suffix = records

View File

@ -334,8 +334,8 @@ func (r *RecordManager) GetExperienceBreakpoint(heroType d2enum.Hero, level int)
return r.Character.Experience[level].HeroBreakpoints[heroType]
}
// GetLevelDetails gets a LevelDetailsRecord by the record Id
func (r *RecordManager) GetLevelDetails(id int) *LevelDetailsRecord {
// GetLevelDetails gets a LevelDetailRecord by the record Id
func (r *RecordManager) GetLevelDetails(id int) *LevelDetailRecord {
for i := 0; i < len(r.Level.Details); i++ {
if r.Level.Details[i].ID == id {
return r.Level.Details[i]
@ -433,7 +433,7 @@ func (r *RecordManager) lookupObject(act, typ, id int) *ObjectLookupRecord {
}
// SelectSoundByIndex selects a sound by its ID
func (r *RecordManager) SelectSoundByIndex(index int) *SoundDetailsRecord {
func (r *RecordManager) SelectSoundByIndex(index int) *SoundDetailRecord {
for idx := range r.Sound.Details {
if r.Sound.Details[idx].Index == index {
return r.Sound.Details[idx]

View File

@ -24,12 +24,12 @@ const (
fmtRunewordPropMax = "T1Max%d"
)
// Loadrecords loads runes records into a map[string]*RunesRecord
// Loadrecords loads runes records into a map[string]*RuneRecord
func runewordLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records := make(map[string]*RunesRecord)
records := make(map[string]*RuneRecord)
for d.Next() {
record := &RunesRecord{
record := &RuneRecord{
Name: d.String("name"),
RuneName: d.String("Rune Name"),
Complete: d.Bool("complete"),
@ -89,7 +89,7 @@ func runewordLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Item.Runewords = records
r.Logger.Infof("Loaded %d records records", len(records))
r.Debugf("Loaded %d Rune records", len(records))
return nil
}

View File

@ -1,11 +1,11 @@
package d2records
// Runewords stores all of the RunesRecords
type Runewords map[string]*RunesRecord
// Runewords stores all of the RuneRecords
type Runewords map[string]*RuneRecord
// RunesRecord is a representation of a single row of runes.txt. It defines
// RuneRecord is a representation of a single row of runes.txt. It defines
// runewords available in the game.
type RunesRecord struct {
type RuneRecord struct {
Name string
RuneName string // More of a note - the actual name should be read from the TBL files.
Complete bool // An enabled/disabled flag. Only "Complete" runewords work in game.

View File

@ -94,7 +94,7 @@ func setItemLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Item.SetItems = records
r.Logger.Infof("Loaded %d SetItem records", len(records))
r.Debugf("Loaded %d SetItem records", len(records))
return nil
}

View File

@ -107,7 +107,7 @@ func setLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Item.Sets = records
r.Logger.Infof("Loaded %d records records", len(records))
r.Debugf("Loaded %d Set records", len(records))
return nil
}

View File

@ -31,7 +31,7 @@ func shrineLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Object.Shrines = records
r.Logger.Infof("Loaded %d shrines", len(records))
r.Debugf("Loaded %d Shrine records", len(records))
return nil
}

View File

@ -139,7 +139,7 @@ func skillDescriptionLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Skill.Descriptions = records
r.Logger.Infof("Loaded %d Skill Description records", len(records))
r.Debugf("Loaded %d SkillDescription records", len(records))
return nil
}

View File

@ -277,7 +277,7 @@ func skillDetailsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Skill.Details = records
r.Logger.Infof("Loaded %d Skill records", len(records))
r.Debugf("Loaded %d Skill records", len(records))
return nil
}

View File

@ -9,7 +9,7 @@ func soundDetailsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records := make(SoundDetails)
for d.Next() {
entry := &SoundDetailsRecord{
entry := &SoundDetailRecord{
Handle: d.String("Sound"),
Index: d.Number("Index"),
FileName: d.String("FileName"),
@ -46,7 +46,7 @@ func soundDetailsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Sound.Details = records
r.Logger.Infof("Loaded %d sound definitions", len(records))
r.Debugf("Loaded %d SoundDetail records", len(records))
return nil
}

View File

@ -1,10 +1,10 @@
package d2records
// SoundDetails is a map of the SoundEntries
type SoundDetails map[string]*SoundDetailsRecord
type SoundDetails map[string]*SoundDetailRecord
// SoundDetailsRecord represents a sound entry
type SoundDetailsRecord struct {
// SoundDetailRecord represents a sound entry
type SoundDetailRecord struct {
Handle string
FileName string
Index int

View File

@ -44,7 +44,7 @@ func soundEnvironmentLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Sound.Environment = records
r.Logger.Infof("Loaded %d SoundEnviron records", len(records))
r.Debugf("Loaded %d SoundEnviron records", len(records))
return nil
}

View File

@ -89,7 +89,7 @@ func statesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.States = records
r.Logger.Infof("Loaded %d State records", len(records))
r.Debugf("Loaded %d State records", len(records))
return nil
}

View File

@ -21,7 +21,7 @@ func storePagesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Item.StorePages = records
r.Logger.Infof("Loaded %d StorePage records", len(records))
r.Debugf("Loaded %d StorePage records", len(records))
return nil
}

View File

@ -20,7 +20,7 @@ func treasureClassLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Item.Treasure.Normal = records
r.Logger.Infof("Loaded %d treasure class (normal) records", len(records))
r.Debugf("Loaded %d TreasureClass (normal) records", len(records))
return nil
}
@ -33,7 +33,7 @@ func treasureClassExLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Item.Treasure.Expansion = records
r.Logger.Infof("Loaded %d treasure class (expansion) records", len(records))
r.Debugf("Loaded %d TreasureClass (expansion) records", len(records))
return nil
}

View File

@ -21,7 +21,7 @@ func uniqueAppellationsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
r.Monster.Unique.Appellations = records
r.Logger.Infof("Loaded %d UniqueAppellation records", len(records))
r.Debugf("Loaded %d UniqueAppellation records", len(records))
return nil
}

Some files were not shown because too many files have changed in this diff Show More