mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-19 02:46:35 -05:00
Add monlvl.txt loader (#655)
This commit is contained in:
parent
c840e140f7
commit
05fa7d93ce
@ -260,6 +260,7 @@ func (a *App) loadDataDict() error {
|
|||||||
{d2resource.PetType, d2datadict.LoadPetTypes},
|
{d2resource.PetType, d2datadict.LoadPetTypes},
|
||||||
{d2resource.NPC, d2datadict.LoadNPCs},
|
{d2resource.NPC, d2datadict.LoadNPCs},
|
||||||
{d2resource.MonsterUniqueModifier, d2datadict.LoadMonsterUniqueModifiers},
|
{d2resource.MonsterUniqueModifier, d2datadict.LoadMonsterUniqueModifiers},
|
||||||
|
{d2resource.MonsterLevel, d2datadict.LoadMonsterLevels},
|
||||||
}
|
}
|
||||||
|
|
||||||
d2datadict.InitObjectRecords()
|
d2datadict.InitObjectRecords()
|
||||||
|
113
d2common/d2data/d2datadict/monster_level.go
Normal file
113
d2common/d2data/d2datadict/monster_level.go
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
package d2datadict
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
||||||
|
)
|
||||||
|
|
||||||
|
//MonsterLevelRecord represents a single row in monlvl.txt
|
||||||
|
type MonsterLevelRecord struct {
|
||||||
|
|
||||||
|
//The level
|
||||||
|
Level int
|
||||||
|
|
||||||
|
//Values for Battle.net
|
||||||
|
BattleNet monsterLevelValues
|
||||||
|
|
||||||
|
//Values for ladder/single player/lan
|
||||||
|
Ladder monsterLevelValues
|
||||||
|
}
|
||||||
|
|
||||||
|
type monsterLevelValues struct {
|
||||||
|
//Armor class
|
||||||
|
//An AC is calcuated as (MonLvl.txt Ac * Monstats.txt AC) / 100)
|
||||||
|
ArmorClass int
|
||||||
|
ArmorClassNightmare int
|
||||||
|
ArmorClassHell int
|
||||||
|
|
||||||
|
//To hit, influences ToHit values for both attacks
|
||||||
|
// (MonLvl.txt TH * Monstats.txt A1TH
|
||||||
|
// and MonLvl.txt TH * Monstats.txt A2TH) / 100
|
||||||
|
ToHit int
|
||||||
|
ToHitNightmare int
|
||||||
|
ToHitHell int
|
||||||
|
|
||||||
|
//Hitpoints, influences both minimum and maximum HP
|
||||||
|
//(MonLvl.txt HP * Monstats.txt minHP) / 100
|
||||||
|
// and MonLvl.txt HP * Monstats.txt maxHP) / 100
|
||||||
|
Hitpoints int
|
||||||
|
HitpointsNightmare int
|
||||||
|
HitpointsHell int
|
||||||
|
|
||||||
|
//Damage, influences minimum and maximum damage for both attacks
|
||||||
|
//MonLvl.txt DM * Monstats.txt A1MinD) / 100
|
||||||
|
// and MonLvl.txt DM * Monstats.txt A1MaxD) / 100
|
||||||
|
// and MonLvl.txt DM * Monstats.txt A2MinD) / 100
|
||||||
|
// and MonLvl.txt DM * Monstats.txt A2MaxD) / 100
|
||||||
|
Damage int
|
||||||
|
DamageNightmare int
|
||||||
|
DamageHell int
|
||||||
|
|
||||||
|
//Experience points
|
||||||
|
//The formula is (MonLvl.txt XP * Monstats.txt Exp) / 100
|
||||||
|
Experience int
|
||||||
|
ExperienceNightmare int
|
||||||
|
ExperienceHell int
|
||||||
|
}
|
||||||
|
|
||||||
|
//MonsterLevels stores the MonsterLevelRecords
|
||||||
|
var MonsterLevels map[int]*MonsterLevelRecord
|
||||||
|
|
||||||
|
//LoadMonsterLevels loads LoadMonsterLevelRecords into MonsterLevels
|
||||||
|
func LoadMonsterLevels(file []byte) {
|
||||||
|
MonsterLevels = make(map[int]*MonsterLevelRecord)
|
||||||
|
|
||||||
|
d := d2common.LoadDataDictionary(file)
|
||||||
|
for d.Next() {
|
||||||
|
record := &MonsterLevelRecord{
|
||||||
|
Level: d.Number("Level"),
|
||||||
|
BattleNet: monsterLevelValues{
|
||||||
|
ArmorClass: d.Number("AC"),
|
||||||
|
ArmorClassNightmare: d.Number("AC(N)"),
|
||||||
|
ArmorClassHell: d.Number("AC(H)"),
|
||||||
|
ToHit: d.Number("TH"),
|
||||||
|
ToHitNightmare: d.Number("TH (N)"),
|
||||||
|
ToHitHell: d.Number("TH (H)"),
|
||||||
|
Hitpoints: d.Number("HP"),
|
||||||
|
HitpointsNightmare: d.Number("HP (N)"),
|
||||||
|
HitpointsHell: d.Number("HP (H)"),
|
||||||
|
Damage: d.Number("DM"),
|
||||||
|
DamageNightmare: d.Number("DM (N)"),
|
||||||
|
DamageHell: d.Number("DM (H)"),
|
||||||
|
Experience: d.Number("XP"),
|
||||||
|
ExperienceNightmare: d.Number("XP (N)"),
|
||||||
|
ExperienceHell: d.Number("XP (H)"),
|
||||||
|
},
|
||||||
|
Ladder: monsterLevelValues{
|
||||||
|
ArmorClass: d.Number("L-AC"),
|
||||||
|
ArmorClassNightmare: d.Number("L-AC(N)"),
|
||||||
|
ArmorClassHell: d.Number("L-AC(H)"),
|
||||||
|
ToHit: d.Number("L-TH"),
|
||||||
|
ToHitNightmare: d.Number("L-TH (N)"),
|
||||||
|
ToHitHell: d.Number("L-TH (H)"),
|
||||||
|
Hitpoints: d.Number("L-HP"),
|
||||||
|
HitpointsNightmare: d.Number("L-HP (N)"),
|
||||||
|
HitpointsHell: d.Number("L-HP (H)"),
|
||||||
|
Damage: d.Number("L-DM"),
|
||||||
|
DamageNightmare: d.Number("L-DM (N)"),
|
||||||
|
DamageHell: d.Number("L-DM (H)"),
|
||||||
|
Experience: d.Number("L-XP"),
|
||||||
|
ExperienceNightmare: d.Number("L-XP (N)"),
|
||||||
|
ExperienceHell: d.Number("L-XP (H)"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
MonsterLevels[record.Level] = record
|
||||||
|
}
|
||||||
|
|
||||||
|
if d.Err != nil {
|
||||||
|
panic(d.Err)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Printf("Loaded %d MonsterLevel records", len(MonsterLevels))
|
||||||
|
}
|
@ -204,6 +204,7 @@ const (
|
|||||||
PetType = "/data/global/excel/pettype.txt"
|
PetType = "/data/global/excel/pettype.txt"
|
||||||
NPC = "/data/global/excel/npc.txt"
|
NPC = "/data/global/excel/npc.txt"
|
||||||
MonsterUniqueModifier = "/data/global/excel/monumod.txt"
|
MonsterUniqueModifier = "/data/global/excel/monumod.txt"
|
||||||
|
MonsterLevel = "/data/global/excel/monlvl.txt"
|
||||||
|
|
||||||
// --- Animations ---
|
// --- Animations ---
|
||||||
|
|
||||||
@ -211,7 +212,7 @@ const (
|
|||||||
AnimationData = "/data/global/animdata.d2"
|
AnimationData = "/data/global/animdata.d2"
|
||||||
PlayerAnimationBase = "/data/global/CHARS"
|
PlayerAnimationBase = "/data/global/CHARS"
|
||||||
MissileData = "/data/global/missiles"
|
MissileData = "/data/global/missiles"
|
||||||
ItemGraphics = "/data/global/items"
|
ItemGraphics = "/data/global/items"
|
||||||
|
|
||||||
// --- Inventory Data ---
|
// --- Inventory Data ---
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user