1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-11 18:20:42 +00:00
OpenDiablo2/d2core/d2records/skill_description_loader.go

146 lines
4.2 KiB
Go
Raw Normal View History

package d2records
import (
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2calculation/d2parser"
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2txt"
)
// Loadrecords loads skill description records from skilldesc.txt
//nolint:funlen // doesn't make sense to split
func skillDescriptionLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records := make(map[string]*SkillDescriptionRecord)
parser := d2parser.New()
parser.SetCurrentReference("skill", "TODO: connect skill with description!")
for d.Next() {
record := &SkillDescriptionRecord{
d.String("skilldesc"),
d.Number("SkillPage"),
d.Number("SkillRow"),
d.Number("SkillColumn"),
d.Number("ListRow"),
d.String("ListPool"),
Removing d2datadict singletons (#738) * Remove weapons, armor, misc, itemCommon, itemTyps datadict singletons - removed loader calls from d2app - removed the HeroObjects singleton from `d2core/d2inventory` - added an InventoryItemFactory in d2inventory - package-level functions that use data records are now methods of the InventoryItemFactory - renamed ItemGenerator in d2item to ItemFactory - package-level functions that use records are now methods of ItemFactory - d2map.MapEntityFactory now has an item factory instance for creating items - fixed a bug in unique item record loader where it loaded an empty record - added a PlayerStateFactory for creating a player state (uses the asset manager) - updated the test inventory/equipment code in d2player to handle errors from the ItemFactory - character select and character creation screens have a player state and inventory item factory - updated item tests to use the item factory * minor edit * Removed d2datadict.Experience singleton added a HeroStatsFactory, much like the other factories. The factory gets an asset manager reference in order to use data records. * removed d2datadict.AutoMagic singleton * removed d2datadict.AutoMap singleton * removed d2datadict.BodyLocations singleton * removed d2datadict.Books singleton * Removed singletons for level records - removed loader calls in d2app - changed type references from d2datadict to d2records - added a `MapGenerator` in d2mapgen which uses thew asset manager and map engine - package-level map generation functions are now MapGenerator methods - `d2datadict.GetLevelDetails(id int)` is now a method of the RecordManager * remove SkillCalc and MissileCalc singletons * Removed CharStats and ItemStatCost singletons - added an ItemStatFactory which uses the asset manager to create stats - package-level functions for stats in d2item are now StatFactory methods - changed type references from d2datadict to d2records - `d2player.GetAllPlayerStates` is now a method of the `PlayerStateFactory` * Removed DkillDesc and Skills singletons from d2datadict - removed loader calls from d2app - diablo2stats.Stat instances are given a reference to the factory for doing record lookups * update the stats test to use mock a asset manager and stat factory * fixed diablo2stats tests and diablo2item tests * removed CompCodes singleton from d2datadict * remove cubemain singleton from d2datadict * removed DifficultyLevels singleton from d2datadict * removed ElemTypes singleton from d2datadict * removed events.go loader from d2datadict (was unused) * removed Gems singleton from d2datadict * removed Hireling and Inventory singletons from d2datadict * removed MagicPrefix and MagicSuffix singletons from d2datadict * removed ItemRatios singleton from d2datadict * removed Missiles singleton from d2datadict * removed MonModes singleton * Removed all monster and npc singletons from d2datadict - MapStamp instances now get a reference to their factory for doing record lookups * removed SoundEntry and SoundEnviron singletons from d2datadict
2020-09-20 21:52:01 +00:00
d.Number("IconCel"),
d.String("str name"),
d.String("str short"),
d.String("str long"),
d.String("str alt"),
d.String("str mana"),
d.String("descdam"),
parser.Parse(d.String("ddam calc1")),
parser.Parse(d.String("ddam calc2")),
d.String("p1dmelem"),
parser.Parse(d.String("p1dmmin")),
parser.Parse(d.String("p1dmmax")),
d.String("p2dmelem"),
parser.Parse(d.String("p2dmmin")),
parser.Parse(d.String("p2dmmax")),
d.String("p3dmelem"),
parser.Parse(d.String("p3dmmin")),
parser.Parse(d.String("p3dmmax")),
d.String("descatt"),
d.String("descmissile1"),
d.String("descmissile2"),
d.String("descmissile3"),
d.String("descline1"),
d.String("desctexta1"),
d.String("desctextb1"),
parser.Parse(d.String("desccalca1")),
parser.Parse(d.String("desccalcb1")),
d.String("descline2"),
d.String("desctexta2"),
d.String("desctextb2"),
parser.Parse(d.String("desccalca2")),
parser.Parse(d.String("desccalcb2")),
d.String("descline3"),
d.String("desctexta3"),
d.String("desctextb3"),
parser.Parse(d.String("desccalca3")),
parser.Parse(d.String("desccalcb3")),
d.String("descline4"),
d.String("desctexta4"),
d.String("desctextb4"),
parser.Parse(d.String("desccalca4")),
parser.Parse(d.String("desccalcb4")),
d.String("descline5"),
d.String("desctexta5"),
d.String("desctextb5"),
parser.Parse(d.String("desccalca5")),
parser.Parse(d.String("desccalcb5")),
d.String("descline6"),
d.String("desctexta6"),
d.String("desctextb6"),
parser.Parse(d.String("desccalca6")),
parser.Parse(d.String("desccalcb6")),
d.String("dsc2line1"),
d.String("dsc2texta1"),
d.String("dsc2textb1"),
parser.Parse(d.String("dsc2calca1")),
parser.Parse(d.String("dsc2calcb1")),
d.String("dsc2line2"),
d.String("dsc2texta2"),
d.String("dsc2textb2"),
parser.Parse(d.String("dsc2calca2")),
parser.Parse(d.String("dsc2calcb2")),
d.String("dsc2line3"),
d.String("dsc2texta3"),
d.String("dsc2textb3"),
parser.Parse(d.String("dsc2calca3")),
parser.Parse(d.String("dsc2calcb3")),
d.String("dsc2line4"),
d.String("dsc2texta4"),
d.String("dsc2textb4"),
parser.Parse(d.String("dsc2calca4")),
parser.Parse(d.String("dsc2calcb4")),
d.String("dsc3line1"),
d.String("dsc3texta1"),
d.String("dsc3textb1"),
parser.Parse(d.String("dsc3calca1")),
parser.Parse(d.String("dsc3calcb1")),
d.String("dsc3line2"),
d.String("dsc3texta2"),
d.String("dsc3textb2"),
parser.Parse(d.String("dsc3calca2")),
parser.Parse(d.String("dsc3calcb2")),
d.String("dsc3line3"),
d.String("dsc3texta3"),
d.String("dsc3textb3"),
parser.Parse(d.String("dsc3calca3")),
parser.Parse(d.String("dsc3calcb3")),
d.String("dsc3line4"),
d.String("dsc3texta4"),
d.String("dsc3textb4"),
parser.Parse(d.String("dsc3calca4")),
parser.Parse(d.String("dsc3calcb4")),
d.String("dsc3line5"),
d.String("dsc3texta5"),
d.String("dsc3textb5"),
parser.Parse(d.String("dsc3calca5")),
parser.Parse(d.String("dsc3calcb5")),
d.String("dsc3line6"),
d.String("dsc3texta6"),
d.String("dsc3textb6"),
parser.Parse(d.String("dsc3calca6")),
parser.Parse(d.String("dsc3calcb6")),
d.String("dsc3line7"),
d.String("dsc3texta7"),
d.String("dsc3textb7"),
parser.Parse(d.String("dsc3calca7")),
parser.Parse(d.String("dsc3calcb7")),
}
records[record.Name] = record
}
if d.Err != nil {
return d.Err
}
r.Skill.Descriptions = records
2020-12-18 06:40:54 +00:00
r.Debugf("Loaded %d SkillDescription records", len(records))
return nil
}