d2datadict

package
v0.0.0-...-c8cfab0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommonItems map[string]*ItemCommonRecord

Loading Functions

View Source
var LevelPresets map[int]LevelPresetRecord
View Source
var LevelTypes []LevelTypeRecord
View Source
var LevelWarps map[int]*LevelWarpRecord
View Source
var MiscItems map[string]*ItemCommonRecord
View Source
var Missiles map[int]*MissileRecord
View Source
var MonStatsDictionary *d2common.DataDictionary
View Source
var ObjectTypes []ObjectTypeRecord
View Source
var Objects map[int]*ObjectRecord
View Source
var Sounds map[string]SoundEntry
View Source
var UniqueItems map[string]*UniqueItemRecord

Functions

func LoadArmors

func LoadArmors(fileProvider d2interface.FileProvider)

func LoadCommonItems

func LoadCommonItems(fileProvider d2interface.FileProvider, filepath string, source d2enum.InventoryItemType) *map[string]*ItemCommonRecord

func LoadLevelPresets

func LoadLevelPresets(fileProvider d2interface.FileProvider)

func LoadLevelTypes

func LoadLevelTypes(fileProvider d2interface.FileProvider)

func LoadLevelWarps

func LoadLevelWarps(fileProvider d2interface.FileProvider)

func LoadMiscItems

func LoadMiscItems(fileProvider d2interface.FileProvider)

func LoadMissiles

func LoadMissiles(fileProvider d2interface.FileProvider)

func LoadMonStats

func LoadMonStats(fileProvider d2interface.FileProvider)

func LoadObjectTypes

func LoadObjectTypes(fileProvider d2interface.FileProvider)

func LoadObjects

func LoadObjects(fileProvider d2interface.FileProvider)

func LoadPalettes

func LoadPalettes(mpqFiles map[string]string, fileProvider d2interface.FileProvider)

func LoadSounds

func LoadSounds(fileProvider d2interface.FileProvider)

func LoadUniqueItems

func LoadUniqueItems(fileProvider d2interface.FileProvider)

func LoadWeapons

func LoadWeapons(fileProvider d2interface.FileProvider)

func MapHeaders

func MapHeaders(line string) map[string]int

func MapLoadBool

func MapLoadBool(r *[]string, mapping *map[string]int, field string) bool

func MapLoadInt

func MapLoadInt(r *[]string, mapping *map[string]int, field string) int

func MapLoadString

func MapLoadString(r *[]string, mapping *map[string]int, field string) string

func MapLoadUint8

func MapLoadUint8(r *[]string, mapping *map[string]int, field string) uint8

Types

type ItemCommonRecord

type ItemCommonRecord struct {
	Source d2enum.InventoryItemType

	Name string

	Version     int  // 0 = classic, 100 = expansion
	CompactSave bool // if true, doesn't store any stats upon saving
	Rarity      int  // higher, the rarer
	Spawnable   bool // if 0, cannot spawn in shops

	MinAC            int
	MaxAC            int
	Absorbs          int // unused?
	Speed            int // affects movement speed of wielder, >0 = you move slower, <0 = you move faster
	RequiredStrength int
	Block            int  // chance to block, capped at 75%
	Durability       int  // base durability 0-255
	NoDurability     bool // if true, item has no durability

	Level         int    // base item level (controls monster drops, for instance a lv20 monster cannot drop a lv30 item)
	RequiredLevel int    // required level to wield
	Cost          int    // base cost
	GambleCost    int    // for reference only, not used
	Code          string // identifies the item
	NameString    string // seems to be identical to code?
	MagicLevel    int    // additional magic level (for gambling?)
	AutoPrefix    int    // prefix automatically assigned to this item on spawn, maps to group column of Automagic.txt

	AlternateGfx string // code of the DCC used when equipped
	OpenBetaGfx  string // unknown
	NormalCode   string
	UberCode     string
	UltraCode    string

	SpellOffset int // unknown

	Component       int // corresponds to Composit.txt, player animation layer used by this
	InventoryWidth  int
	InventoryHeight int
	HasInventory    bool // if true, item can store gems or runes
	GemSockets      int  // number of gems to store
	GemApplyType    int  // what kind of gem effect is applied

	FlippyFile          string // DC6 file animation to play when item drops on the ground
	InventoryFile       string // DC6 file used in your inventory
	UniqueInventoryFile string // DC6 file used by the unique version of this item
	SetInventoryFile    string // DC6 file used by the set version of this item

	// these represent how player animations and graphics change upon wearing this
	// these come from ArmType.txt
	AnimRightArm         int
	AnimLeftArm          int
	AnimTorso            int
	AnimLegs             int
	AnimRightShoulderPad int
	AnimLeftShoulderPad  int

	Useable bool // can be used via right click if true
	// game knows what to do if used by item code
	Throwable bool
	Stackable bool // can be stacked in inventory
	MinStack  int  // min size of stack when item is spawned, used if stackable
	MaxStack  int  // max size of stack when item is spawned

	Type  string // base type in ItemTypes.txt
	Type2 string

	DropSound    string // sfx for dropping
	DropSfxFrame int    // what frame of drop animation the sfx triggers on
	UseSound     string // sfx for using

	Unique      bool // if true, only spawns as unique
	Transparent bool // unused
	TransTable  int  // unknown, related to blending mode?
	Quivered    bool // if true, requires ammo to use
	LightRadius int  // apparently unused
	Belt        bool // tells what kind of belt this item is

	Quest int // indicates that this item belongs to a given quest?

	MissileType       int // missile gfx for throwing
	DurabilityWarning int // controls what warning icon appears when durability is low
	QuantityWarning   int // controls at what quantity the low quantity warning appears

	MinDamage      int
	MaxDamage      int
	StrengthBonus  int
	DexterityBonus int

	GemOffset int // unknown
	BitField1 int // 1 = leather item, 3 = metal

	Vendors map[string]*ItemVendorParams // controls vendor settings

	SourceArt               string // unused?
	GameArt                 string // unused?
	ColorTransform          int    // colormap to use for player's gfx
	InventoryColorTransform int    // colormap to use for inventory's gfx

	SkipName         bool   // if true, don't include the base name in the item description
	NightmareUpgrade string // upgraded in higher difficulties
	HellUpgrade      string

	Nameable bool // if true, item can be personalized

	// weapon params
	BarbOneOrTwoHanded bool // if true, barb can wield this in one or two hands
	UsesTwoHands       bool // if true, it's a 2handed weapon
	Min2HandDamage     int
	Max2HandDamage     int
	MinMissileDamage   int // ranged damage stats
	MaxMissileDamage   int
	MissileSpeed       int // unknown, affects movement speed of wielder during ranged attacks?
	ExtraRange         int // base range = 1, if this is non-zero add this to the range
	// final mindam = min * str / strbonus + min * dex / dexbonus
	// same for maxdam
	RequiredDexterity int

	WeaponClass      string // what kind of attack does this weapon have (i.e. determines attack animations)
	WeaponClass2Hand string // what kind of attack when wielded with two hands
	HitClass         string // determines sounds/graphic effects when attacking
	SpawnStack       int    // unknown, something to do with stack size when spawned (sold maybe?)

	SpecialFeature string // Just a comment

	QuestDifficultyCheck bool // if true, item only works in the difficulty it was found in

	PermStoreItem bool // if true, vendor will always sell this

	// misc params
	FlavorText string // unknown, probably just for reference

	Transmogrify bool   // if true, can be turned into another item via right click
	TransmogCode string // the 3 char code representing the item this becomes via transmog
	TransmogMin  int    // min amount of the transmog item to create
	TransmogMax  int    // max ”

	AutoBelt bool // if true, item is put into your belt when picked up

	SpellIcon         int              // which icon to display when used? Is this always -1?
	SpellType         int              // determines what kind of function is used when you use this item
	OverlayState      string           // name of the overlay state to be applied upon use of this item
	CureOverlayStates [2]string        // name of the overlay states that are removed upon use of this item
	EffectLength      int              // timer for timed usage effects
	UsageStats        [3]ItemUsageStat // stat boosts applied upon usage

	SpellDescriptionType int // specifies how to format the usage description
	// 0 = none, 1 = use desc string, 2 = use desc string + calc value
	SpellDescriptionString string              // points to a string containing the description
	SpellDescriptionCalc   d2common.CalcString // a calc string what value to display

	BetterGem string // 3 char code pointing to the gem this upgrades to (non if not applicable)

	Multibuy bool // if true, when you buy via right click + shift it will fill your belt automatically
}

type ItemUsageStat

type ItemUsageStat struct {
	Stat string              // name of the stat to add to
	Calc d2common.CalcString // calc string representing the amount to add
}

type ItemVendorParams

type ItemVendorParams struct {
	Min        int // minimum of this item they can stock
	Max        int // max they can stock
	MagicMin   int
	MagicMax   int
	MagicLevel uint8
}

type LevelPresetRecord

type LevelPresetRecord struct {
	Name         string
	DefinitionId int
	LevelId      int
	Populate     bool
	Logicals     bool
	Outdoors     bool
	Animate      bool
	KillEdge     bool
	FillBlanks   bool
	SizeX        int
	SizeY        int
	AutoMap      bool
	Scan         bool
	Pops         int
	PopPad       int
	FileCount    int
	Files        [6]string
	Dt1Mask      uint
	Beta         bool
	Expansion    bool
}

type LevelTypeRecord

type LevelTypeRecord struct {
	Name      string
	Id        int
	Files     [32]string
	Beta      bool
	Act       int
	Expansion bool
}

type LevelWarpRecord

type LevelWarpRecord struct {
	Id         int32
	SelectX    int32
	SelectY    int32
	SelectDX   int32
	SelectDY   int32
	ExitWalkX  int32
	ExitWalkY  int32
	OffsetX    int32
	OffsetY    int32
	LitVersion bool
	Tiles      int32
	Direction  string
}

type MissileAnimation

type MissileAnimation struct {
	StepsBeforeVisible int
	StepsBeforeActive  int
	LoopAnimation      bool
	CelFileName        string
	AnimationRate      int // seems to do nothing
	AnimationLength    int
	AnimationSpeed     int
	StartingFrame      int  // called "RandFrame"
	HasSubLoop         bool // runs after first animation ends
	SubStartingFrame   int
	SubEndingFrame     int
}

type MissileCalc

type MissileCalc struct {
	Calc   d2common.CalcString
	Desc   string
	Params []MissileCalcParam
}

type MissileCalcParam

type MissileCalcParam struct {
	Param int
	Desc  string
}

type MissileCollision

type MissileCollision struct {
	CollisionType int // controls the kind of collision
	// 0 = none, 1 = units only, 3 = normal (units, walls),
	// 6 = walls only, 8 = walls, units, and floors
	DestroyedUponCollision bool
	FriendlyFire           bool
	LastCollide            bool // unknown
	Collision              bool // unknown
	ClientCollision        bool // unknown
	ClientSend             bool // unclear
	UseCollisionTimer      bool // after hit, use timer before dying
	TimerFrames            int  // how many frames to persist
}

type MissileDamage

type MissileDamage struct {
	MinDamage      int
	MaxDamage      int
	MinLevelDamage [5]int // additional damage per missile level
	// [0]: lvs 2-8, [1]: lvs 9-16, [2]: lvs 17-22, [3]: lvs 23-28, [4]: lv 29+
	MaxLevelDamage       [5]int              // see above
	DamageSynergyPerCalc d2common.CalcString // works like synergy in skills.txt, not clear
}

type MissileElementalDamage

type MissileElementalDamage struct {
	Damage        MissileDamage
	ElementType   string
	Duration      int    // frames, 25 = 1 second
	LevelDuration [3]int // 0,1,2, unknown level intervals, bonus duration per level
}

type MissileLight

type MissileLight struct {
	Diameter int
	Flicker  int
	Red      uint8
	Green    uint8
	Blue     uint8
}

type MissileRecord

type MissileRecord struct {
	Name string
	Id   int

	ClientMovementFunc  int
	ClientCollisionFunc int
	ServerMovementFunc  int
	ServerCollisionFunc int
	ServerDamageFunc    int
	ServerMovementCalc  MissileCalc
	ClientMovementCalc  MissileCalc
	ServerCollisionCalc MissileCalc
	ClientCollisionCalc MissileCalc
	ServerDamageCalc    MissileCalc

	Velocity           int
	MaxVelocity        int
	LevelVelocityBonus int
	Accel              int
	Range              int
	LevelRangeBonus    int

	Light MissileLight

	Animation MissileAnimation

	Collision MissileCollision

	XOffset int
	YOffset int
	ZOffset int
	Size    int // diameter

	DestroyedByTP      bool // if true, destroyed when source player teleports to town
	DestroyedByTPFrame int  // see above, for client side, (this is a guess) which frame it vanishes on
	CanDestroy         bool // unknown

	UseAttackRating bool // if true, uses 'attack rating' to determine if it hits or misses
	// if false, has a 95% chance to hit.
	AlwaysExplode bool // if true, always calls its collision function when it is destroyed, even if it doesn't hit anything

	ClientExplosion bool // if true, does not really exist
	// is only aesthetic / client side
	TownSafe bool // if true, doesn't vanish when spawned in town
	// if false, vanishes when spawned in town
	IgnoreBossModifiers bool // if true, doesn't get bonuses from boss mods
	IgnoreMultishot     bool // if true, can't gain the mulitshot modifier
	HolyFilterType      int  // specifies what this missile can hit
	// 0 = all units, 1 = undead only, 2 = demons only, 3 = all units (again?)
	CanBeSlowed       bool // if true, is affected by skill_handofathena
	TriggersHitEvents bool // if true, triggers events that happen "upon getting hit" on targets
	TriggersGetHit    bool // if true, can cause target to enter hit recovery mode
	SoftHit           bool // unknown
	KnockbackPercent  int  // chance of knocking the target back, 0-100

	TransparencyMode int // controls rendering

	UseQuantity bool // if true, uses quantity
	// not clear what this means. Also apparently requires a special starting function in skills.txt
	AffectedByPierce bool // if true, affected by the pierce modifier and the Pierce skill
	SpecialSetup     bool // unknown, only true for potions

	MissileSkill bool   // if true, applies elemental damage from items to the splash radius instead of normal damage modifiers
	SkillName    string // if not empty, the missile will refer to this skill instead of its own data for the following:

	ResultFlags int // unknown
	// 4 = normal missiles, 5 = explosions, 8 = non-damaging missiles
	HitFlags int // unknown

	HitShift int // damage is measured in 256s
	// the actual damage is [damage] * 2 ^ [hitshift]
	// e.g. 100 damage, 8 hitshift = 100 * 2 ^ 8 = 100 * 256 = 25600
	// (visually, the damage is this result / 256)
	ApplyMastery bool // unknown
	SourceDamage int  // 0-128, 128 is 100%
	// percentage of source units attack properties to apply to the missile?
	// not only affects damage but also other modifiers like lifesteal and manasteal (need a complete list)
	// setting this to -1 "gets rid of SrcDmg from skills.txt", not clear what that means
	HalfDamageForTwoHander bool // if true, damage is halved when a two-handed weapon is used
	SourceMissDamage       int  // 0-128, 128 is 100%

	Damage          MissileDamage
	ElementalDamage MissileElementalDamage

	HitClass int // controls clientside aesthetic effects for collisions
	// particularly sound effects that are played on a hit
	NumDirections int // count of dirs in the DCC loaded by CelFile
	// apparently this value is no longer needed in D2
	LocalBlood int // blood effects?
	// 0 = no blood, 1 = blood, 2 = blood and affected by open wounds
	DamageReductionRate int // how many frames between applications of the

	TravelSound string // name of sound to play during lifetime
	// whether or not it loops depends on the specific sound's settings?
	// if it doesn't loop, it's just a on-spawn sound effect
	HitSound  string // sound plays upon collision
	ProgSound string // plays at "special events", like a mariachi band

	ProgOverlay      string // name of an overlay from overlays.txt to use at special events
	ExplosionMissile string // name of a missile from missiles.txt that is created upon collision

	SubMissile          [3]string // 0,1,2 name of missiles spawned by movement function
	HitSubMissile       [4]string // 0,1,2 name of missiles spawned by collision function
	ClientSubMissile    [3]string // see above, but for client only
	ClientHitSubMissile [4]string // see above, but for client only
}

type ObjectLookupRecord

type ObjectLookupRecord struct {
	Act           int
	Type          ObjectType
	Id            int
	Description   string
	ObjectsTxtId  int
	MonstatsTxtId int
	Direction     int
	Base          string
	Token         string
	Mode          string
	Class         string
	HD            string
	TR            string
	LG            string
	RA            string
	LA            string
	RH            string
	LH            string
	SH            string
	S1            string
	S2            string
	S3            string
	S4            string
	S5            string
	S6            string
	S7            string
	S8            string
	ColorMap      string
	Index         int
}

func LookupObject

func LookupObject(act, typ, id int) *ObjectLookupRecord

type ObjectRecord

type ObjectRecord struct {
	Name        string
	Description string
	Id          int
	Token       string // refers to what graphics this object uses

	SpawnMax        int     // unused?
	Selectable      [8]bool // is this mode selectable
	TrapProbability int     // unused

	SizeX int
	SizeY int

	NTgtFX int // unknown
	NTgtFY int // unknown
	NTgtBX int // unknown
	NTgtBY int // unknown

	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)
	CycleAnimation [8]bool // probably whether animation loops
	LightDiameter  [8]int
	BlocksLight    [8]bool
	HasCollision   [8]bool
	IsAttackable   bool // do we kick it when interacting
	StartFrame     [8]int

	EnvEffect       bool // unknown
	IsDoor          bool
	BlockVisibility bool // only works with IsDoor
	Orientation     int  // unknown (1=sw, 2=nw, 3=se, 4=ne)
	Trans           int  // controls palette mapping

	OrderFlag        [8]int  //  0 = object, 1 = floor, 2 = wall
	PreOperate       bool    // unknown
	HasAnimationMode [8]bool // 'Mode' in source, true if this mode is used

	XOffset int // in pixels offset
	YOffset int
	Draw    bool // if false, object isn't drawn (shadow is still drawn and player can still select though)

	LightRed   byte // if lightdiameter is set, rgb of the light
	LightGreen byte
	LightBlue  byte

	SelHD bool // whether these DCC components are selectable
	SelTR bool
	SelLG bool
	SelRA bool
	SelLA bool
	SelRH bool
	SelLH bool
	SelSH bool
	SelS  [8]bool

	TotalPieces int // selectable DCC components count
	SubClass    int // subclass of object:

	XSpace int // unknown
	YSpace int

	NameOffset int // pixels to offset the name from the animation pivot

	MonsterOk      bool // unknown
	OperateRange   int  // distance object can be used from, might be unused
	ShrineFunction int  // unused
	Restore        bool // if true, object is stored in memory and will be retained if you leave and re-enter the area

	Parm           [8]int // unknown
	Act            int    // what acts this object can appear in (15 = all three)
	Lockable       bool
	Gore           bool // unknown, something with corpses
	Sync           bool // unknown
	Flicker        bool // light flickers if true
	Damage         int  // amount of damage done by this (used depending on operatefn)
	Beta           bool // if true, appeared in the beta?
	Overlay        bool // unknown
	CollisionSubst bool // unknown, controls some kind of special collision checking?

	Left   int // unknown, clickable bounding box?
	Top    int
	Width  int
	Height int

	OperateFn int // what function is called when the player clicks on the object
	// (todo: we should enumerate all the functions somewhere, but probably not here
	//        b/c it's a very long list)
	PopulateFn int // what function is used to spawn this object?
	// (see above todo)
	InitFn int // what function is run when the object is initialized?
	// (see above todo)
	ClientFn int // controls special audio-visual functions

	RestoreVirgins bool // if true, only restores unused objects (see Restore)
	BlockMissile   bool // if true, missiles collide with this
	DrawUnder      bool // if true, drawn as a floor tile is
	OpenWarp       bool // needs clarification, controls whether highlighting shows
	// 'To ...' or 'trap door' when highlighting, not sure which is T/F
	AutoMap int // controls how this object appears on the map

}

An ObjectRecord represents the settings for one type of object from objects.txt

type ObjectType

type ObjectType int
const (
	ObjectTypeCharacter ObjectType = 1
	ObjectTypeItem      ObjectType = 2
)

type ObjectTypeRecord

type ObjectTypeRecord struct {
	Name  string
	Token string
}

type PaletteRGB

type PaletteRGB struct {
	R, G, B uint8
}

PaletteRGB represents a color in a palette

type PaletteRec

type PaletteRec struct {
	Name   d2enum.PaletteType
	Colors [256]PaletteRGB
}

PaletteType represents a palette

func CreatePalette

func CreatePalette(name d2enum.PaletteType, data []byte) PaletteRec

CreatePalette creates a palette

type SoundEntry

type SoundEntry struct {
	Handle    string
	Index     int
	FileName  string
	Volume    byte
	GroupSize uint8
	Loop      bool
	FadeIn    uint8
	FadeOut   uint8
	DeferInst uint8
	StopInst  uint8
	Duration  uint8
	Compound  int8
	Reverb    bool
	Falloff   uint8
	Cache     uint8
	AsyncOnly bool
	Priority  uint8
	Stream    uint8
	Stereo    uint8
	Tracking  uint8
	Solo      uint8
	MusicVol  uint8
	Block1    int
	Block2    int
	Block3    int
}

SoundEntry represents a sound entry

type UniqueItemProperty

type UniqueItemProperty struct {
	Property  string
	Parameter d2common.CalcString // depending on the property, this may be an int (usually), or a string
	Min       int
	Max       int
}

type UniqueItemRecord

type UniqueItemRecord struct {
	Name    string
	Version int  // 0 = classic pre 1.07, 1 = 1.07-1.11, 100 = expansion
	Enabled bool // if false, this record won't be loaded (should always be true...)
	Ladder  bool // if true, can only be found on ladder and not in single player / tcp/ip
	Rarity  int  // 1-255, higher is more common (ironically...)
	NoLimit bool // if true, can drop more than once per game

	Level int // item's level, can only be dropped by monsters / recipes / vendors / objects of this level or higher
	// otherwise they would drop a rare item with enhanced durability
	RequiredLevel int    // character must have this level to use this item
	Code          string // three letter code, points to a record in Weapons, Armor, or Misc

	TypeDescription string
	UberDescription string
	SingleCopy      bool // if true, player can only hold one of these. can't trade it or pick it up
	CostMultiplier  int  // base price is multiplied by this when sold, repaired or bought
	CostAdd         int  // after multiplied by above, this much is added to the price

	CharacterGfxTransform string // palette shift applied to this items gfx when held and when
	// on the ground (flippy). Points to a record in Colors.txt
	InventoryGfxTransform string // palette shift applied to the inventory gfx
	FlippyFile            string // if non-empty, overrides the base item's dropped gfx
	InventoryFile         string // if non-empty, overrides the base item's inventory gfx

	DropSound    string // if non-empty, overrides the base item's drop sound
	DropSfxFrame int    // if non-empty, overrides the base item's frame at which the drop sound plays
	UseSound     string // if non-empty, overrides the sound played when item is used

	Properties [12]UniqueItemProperty
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL