mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-20 23:47:16 -05:00
added loaders for misscalc.txt and skillcalc.txt (#661)
Co-authored-by: BojanoN <bojan.novkovic@kset.org>
This commit is contained in:
parent
44e84c8b10
commit
38852d0285
@ -244,6 +244,8 @@ func (a *App) loadDataDict() error {
|
|||||||
{d2resource.SuperUniques, d2datadict.LoadSuperUniques},
|
{d2resource.SuperUniques, d2datadict.LoadSuperUniques},
|
||||||
{d2resource.Inventory, d2datadict.LoadInventory},
|
{d2resource.Inventory, d2datadict.LoadInventory},
|
||||||
{d2resource.Skills, d2datadict.LoadSkills},
|
{d2resource.Skills, d2datadict.LoadSkills},
|
||||||
|
{d2resource.SkillCalc, d2datadict.LoadSkillCalculations},
|
||||||
|
{d2resource.MissileCalc, d2datadict.LoadMissileCalculations},
|
||||||
{d2resource.Properties, d2datadict.LoadProperties},
|
{d2resource.Properties, d2datadict.LoadProperties},
|
||||||
{d2resource.SkillDesc, d2datadict.LoadSkillDescriptions},
|
{d2resource.SkillDesc, d2datadict.LoadSkillDescriptions},
|
||||||
{d2resource.ItemTypes, d2datadict.LoadItemTypes},
|
{d2resource.ItemTypes, d2datadict.LoadItemTypes},
|
||||||
|
56
d2common/d2data/d2datadict/calculations.go
Normal file
56
d2common/d2data/d2datadict/calculations.go
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
package d2datadict
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
||||||
|
)
|
||||||
|
|
||||||
|
// The skillcalc.txt and misscalc.txt files are essentially lookup tables for the Skills.txt and Missiles.txt Calc functions
|
||||||
|
// To avoid duplication (since they have identical fields) they are both represented by the CalculationRecord type
|
||||||
|
type CalculationRecord struct {
|
||||||
|
Code string
|
||||||
|
Description string
|
||||||
|
}
|
||||||
|
|
||||||
|
var SkillCalculations map[string]*CalculationRecord
|
||||||
|
var MissileCalculations map[string]*CalculationRecord
|
||||||
|
|
||||||
|
func LoadSkillCalculations(file []byte) {
|
||||||
|
SkillCalculations = make(map[string]*CalculationRecord)
|
||||||
|
|
||||||
|
d := d2common.LoadDataDictionary(file)
|
||||||
|
for d.Next() {
|
||||||
|
record := &CalculationRecord{
|
||||||
|
Code: d.String("code"),
|
||||||
|
Description: d.String("*desc"),
|
||||||
|
}
|
||||||
|
SkillCalculations[record.Code] = record
|
||||||
|
}
|
||||||
|
|
||||||
|
if d.Err != nil {
|
||||||
|
panic(d.Err)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Printf("Loaded %d Skill Calculation records", len(SkillCalculations))
|
||||||
|
}
|
||||||
|
|
||||||
|
func LoadMissileCalculations(file []byte) {
|
||||||
|
MissileCalculations = make(map[string]*CalculationRecord)
|
||||||
|
|
||||||
|
d := d2common.LoadDataDictionary(file)
|
||||||
|
for d.Next() {
|
||||||
|
record := &CalculationRecord{
|
||||||
|
Code: d.String("code"),
|
||||||
|
Description: d.String("*desc"),
|
||||||
|
}
|
||||||
|
MissileCalculations[record.Code] = record
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if d.Err != nil {
|
||||||
|
panic(d.Err)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Printf("Loaded %d Missile Calculation records", len(MissileCalculations))
|
||||||
|
}
|
@ -194,6 +194,8 @@ const (
|
|||||||
CubeRecipes = "/data/global/excel/cubemain.txt"
|
CubeRecipes = "/data/global/excel/cubemain.txt"
|
||||||
Skills = "/data/global/excel/skills.txt"
|
Skills = "/data/global/excel/skills.txt"
|
||||||
SkillDesc = "/data/global/excel/skilldesc.txt"
|
SkillDesc = "/data/global/excel/skilldesc.txt"
|
||||||
|
SkillCalc = "/data/global/excel/skillcalc.txt"
|
||||||
|
MissileCalc = "/data/global/excel/misscalc.txt"
|
||||||
TreasureClass = "/data/global/excel/TreasureClassEx.txt"
|
TreasureClass = "/data/global/excel/TreasureClassEx.txt"
|
||||||
States = "/data/global/excel/states.txt"
|
States = "/data/global/excel/states.txt"
|
||||||
SoundEnvirons = "/data/global/excel/soundenviron.txt"
|
SoundEnvirons = "/data/global/excel/soundenviron.txt"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user