mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-20 23:47:16 -05:00
re-ordered structures to optimize memory layout (#627)
This commit is contained in:
parent
63aa1eebe9
commit
53599928f7
@ -10,6 +10,29 @@ import (
|
||||
// AutoMagicRecord describes rules for automatically generating magic properties when spawning
|
||||
// items
|
||||
type AutoMagicRecord struct {
|
||||
// IncludeItemCodes
|
||||
// itype 1 to itype7
|
||||
// "Include Type" fields. You need to place item codes in any of these columns to allow that item
|
||||
// to receive mods from this row. See the note below.
|
||||
IncludeItemCodes [7]string
|
||||
|
||||
// ModCode
|
||||
// They're the Property codes from Properties.txt.
|
||||
// These determine the actual properties which make up this autoprefix.
|
||||
// Each autoprefix can include up to three modifiers.
|
||||
ModCode [3]string
|
||||
|
||||
// ExcludeItemCodes
|
||||
// etype 1 to etype3
|
||||
// 'Exclude type' . This field prevents certain mods from spawning on specific item codes.
|
||||
ExcludeItemCodes [3]string
|
||||
|
||||
// ModParam, min, max
|
||||
// Parameter, min, and max values for the property
|
||||
ModParam [3]int
|
||||
ModMin [3]int
|
||||
ModMax [3]int
|
||||
|
||||
// Name
|
||||
// String Comment Blizzard lists the equivalent prefix/affix here.
|
||||
// You can use what ever you wish here though. Handy for keeping track of groups.
|
||||
@ -23,28 +46,18 @@ type AutoMagicRecord struct {
|
||||
// as Items with " version" set to 100 will NOT be generated in Classic Diablo II.
|
||||
Version int
|
||||
|
||||
// Spawnable
|
||||
// It is a boolean type field, and states if this autoprefix can actually spawn in the game.
|
||||
// You can disable this row by setting it to 0 , or enable it by setting it to 1
|
||||
Spawnable bool
|
||||
|
||||
// SpawnOnRare
|
||||
// It decides whether this autoprefix spawns on rare quality items or not.
|
||||
// You can prevent that from happening by setting it to 0 , or you can allow it by setting it to 1
|
||||
SpawnOnRare bool // rare
|
||||
|
||||
// MinSpawnLevel
|
||||
// this field accepts numeric values and specifies the minimum level from which this autoprefix
|
||||
// can spawn. The column in question can be combined with the following maxlevel: to effectively
|
||||
// control groups of automods,
|
||||
// because you can use this field to combine multiple rows so that the autoprefixes are assigned
|
||||
// based on the level of the treasure drop [see below].
|
||||
MinSpawnLevel int // level
|
||||
MinSpawnLevel int
|
||||
|
||||
// MaxSpawnLevel
|
||||
// this field accepts numeric values and specifies the maximum level beyond which the automod
|
||||
// stop spawning.
|
||||
MaxSpawnLevel int // maxlevel
|
||||
MaxSpawnLevel int
|
||||
|
||||
// LevelRequirement
|
||||
// It is the level requirement for this autoprefix.
|
||||
@ -60,7 +73,7 @@ type AutoMagicRecord struct {
|
||||
// This is a polite thing to do,
|
||||
// as other classes gain no advantage from class specific modifiers.
|
||||
// I am uncertain that this actually works.
|
||||
ClassLevelRequirement int // classlevelreq
|
||||
ClassLevelRequirement int
|
||||
|
||||
// Frequency
|
||||
// For autoprefix groups, it states the chance to spawn this specific group member vs others.
|
||||
@ -77,49 +90,36 @@ type AutoMagicRecord struct {
|
||||
// Weapons.txt or Armor.txt in order for the property to appear.
|
||||
Group int
|
||||
|
||||
// ModCode
|
||||
// They're the Property codes from Properties.txt.
|
||||
// These determine the actual properties which make up this autoprefix.
|
||||
// Each autoprefix can include up to three modifiers.
|
||||
ModCode [3]string
|
||||
// PaletteTransform
|
||||
// If transform is set to 1 then the item will be colored with the chosen color code,
|
||||
// taken from Colors.txt
|
||||
PaletteTransform int
|
||||
|
||||
// ModParam, min, max
|
||||
// Parameter, min, and max values for the property
|
||||
ModParam [3]int
|
||||
ModMin [3]int
|
||||
ModMax [3]int
|
||||
// CostDivide
|
||||
// Numeric value that acts as divisor for the item price.
|
||||
CostDivide int
|
||||
|
||||
// CostMultiply
|
||||
// Numeric value that acts as multiplier for the item price.
|
||||
CostMultiply int
|
||||
|
||||
// CostAdd
|
||||
// Numeric value that acts as a flat sum added to the item price.
|
||||
CostAdd int
|
||||
|
||||
// Spawnable
|
||||
// It is a boolean type field, and states if this autoprefix can actually spawn in the game.
|
||||
// You can disable this row by setting it to 0 , or enable it by setting it to 1
|
||||
Spawnable bool
|
||||
|
||||
// SpawnOnRare
|
||||
// It decides whether this autoprefix spawns on rare quality items or not.
|
||||
// You can prevent that from happening by setting it to 0 , or you can allow it by setting it to 1
|
||||
SpawnOnRare bool
|
||||
|
||||
// transform
|
||||
// It is a boolean value whichallows the colorization of the items.
|
||||
Transform bool
|
||||
|
||||
// PaletteTransform
|
||||
// If transform is set to 1 then the item will be colored with the chosen color code,
|
||||
// taken from Colors.txt
|
||||
PaletteTransform int // transformcolor
|
||||
|
||||
// IncludeItemCodes
|
||||
// itype 1 to itype7
|
||||
// "Include Type" fields. You need to place item codes in any of these columns to allow that item
|
||||
// to receive mods from this row. See the note below.
|
||||
IncludeItemCodes [7]string
|
||||
|
||||
// ExcludeItemCodes
|
||||
// etype 1 to etype3
|
||||
// 'Exclude type' . This field prevents certain mods from spawning on specific item codes.
|
||||
ExcludeItemCodes [3]string
|
||||
|
||||
// CostDivide
|
||||
// Numeric value that acts as divisor for the item price.
|
||||
CostDivide int // divide
|
||||
|
||||
// CostMultiply
|
||||
// Numeric value that acts as multiplier for the item price.
|
||||
CostMultiply int // multiply
|
||||
|
||||
// CostAdd
|
||||
// Numeric value that acts as a flat sum added to the item price.
|
||||
CostAdd int // add
|
||||
}
|
||||
|
||||
// AutoMagic has all of the AutoMagicRecords, used for generating magic properties for spawned items
|
||||
|
@ -33,24 +33,6 @@ type ItemTypeRecord struct {
|
||||
Equiv1 string
|
||||
Equiv2 string
|
||||
|
||||
// Repair
|
||||
// Boolean, 1=Merchants can repair this item type, 0=Merchants cannot repair this iType (note,
|
||||
// this also refers to charges being rechargeable).
|
||||
Repair bool
|
||||
|
||||
// Body
|
||||
// Boolean, 1=The character can wear this iType,
|
||||
// 0=This iType can only be carried in the inventory,
|
||||
// cube or stash (and belt if it is set as “beltable” in the other item related txt files)
|
||||
Body bool
|
||||
|
||||
// BodyLoc1-2
|
||||
// If you have set the previous column to 1,
|
||||
// you need to specify the inventory slots in which the item has to be equipped. (
|
||||
// the codes used by this field are read from BodyLocs.txt)
|
||||
BodyLoc1 int
|
||||
BodyLoc2 int
|
||||
|
||||
// Shoots
|
||||
// This column specifies which type of quiver (“ammo”) this iType (
|
||||
// in case it is a weapon) requires in order to shoot (
|
||||
@ -67,6 +49,88 @@ type ItemTypeRecord struct {
|
||||
// this also uses the ID pointer of course).
|
||||
Quiver string
|
||||
|
||||
// InvGfx1-6
|
||||
// This column contains the file names of the inventory graphics that are randomly picked for
|
||||
// this iType, so if you use columns 1-3, you will set VarInvGfx to 3 (duh).
|
||||
InvGfx1 string
|
||||
InvGfx2 string
|
||||
InvGfx3 string
|
||||
InvGfx4 string
|
||||
InvGfx5 string
|
||||
InvGfx6 string
|
||||
|
||||
// StorePage
|
||||
// The page code for the page a vendor should place this iType in when sold,
|
||||
// if you enable the magic tab in D2Client.dll,
|
||||
// you need to use the proper code here to put items in that tab.
|
||||
// Right now the ones used are weap = weapons1 and 2, armo = armor and misc = miscellaneous.
|
||||
StorePage string
|
||||
|
||||
// BodyLoc1-2
|
||||
// If you have set the previous column to 1,
|
||||
// you need to specify the inventory slots in which the item has to be equipped. (
|
||||
// the codes used by this field are read from BodyLocs.txt)
|
||||
BodyLoc1 int
|
||||
BodyLoc2 int
|
||||
|
||||
// MaxSock1, MaxSock25, MaxSock40
|
||||
// Maximum sockets for iLvl 1-25,
|
||||
// 26-40 and 40+. The range is hardcoded but the location is known,
|
||||
// so you can alter around the range to your liking. On normal,
|
||||
// items dropped from monsters are limited to 3, on nightmare to 4 and on hell to 6 sockets,
|
||||
// irregardless of this columns content.
|
||||
MaxSock1 int
|
||||
MaxSock25 int
|
||||
MaxSock40 int
|
||||
|
||||
// TreasureClass
|
||||
// Can this iType ID Pointer be used as an auto TC in TreasureClassEx.txt. 1=Yes,
|
||||
// 0=No. *Such as armo3-99 and weap3-99 etc.
|
||||
TreasureClass int
|
||||
|
||||
// Rarity
|
||||
// Dunno what it does, may have to do with the chance that an armor or weapon rack will pick
|
||||
// items of this iType. If it works like other rarity fields,
|
||||
// the chance is rarity / total_rarity * 100.
|
||||
Rarity int
|
||||
|
||||
// StaffMods
|
||||
// Contains the class code for the character class that should get +skills from this iType (
|
||||
// such as wands that can spawn with +Necromancer skills). Note,
|
||||
// this only works if the item is not low quality, set or unique. Note,
|
||||
// that this uses the vanilla min/max skill IDs for each class as the range for the skill pool,
|
||||
// so if you add new class skills to the end of the file, you should use automagic.txt instead
|
||||
StaffMods d2enum.Hero
|
||||
|
||||
// CostFormula
|
||||
// Does the game generate the sell/repair/buy prices of this iType based on its modifiers or does
|
||||
// it use only the cost specific in the respective item txt files. 2=Organ (
|
||||
// probably higher price based on unit that dropped the organ), 1=Yes, 0=No.
|
||||
// Note: Only applies to items that are not unique or set, for those the price is solely controlled
|
||||
// by the base item file and by the bonus to price given in SetItems and UniqueItems txt files.
|
||||
// The exact functionality remains unknown, as for example charms, have this disabled.
|
||||
CostFormula int
|
||||
|
||||
// Class
|
||||
// Contains the class code for the class that should be able to use this iType (
|
||||
// for class specific items).
|
||||
Class d2enum.Hero
|
||||
|
||||
// VarInvGfx
|
||||
// This column contains the sum of randomly picked inventory graphics this iType can have.
|
||||
VarInvGfx int
|
||||
|
||||
// Repair
|
||||
// Boolean, 1=Merchants can repair this item type, 0=Merchants cannot repair this iType (note,
|
||||
// this also refers to charges being rechargeable).
|
||||
Repair bool
|
||||
|
||||
// Body
|
||||
// Boolean, 1=The character can wear this iType,
|
||||
// 0=This iType can only be carried in the inventory,
|
||||
// cube or stash (and belt if it is set as “beltable” in the other item related txt files)
|
||||
Body bool
|
||||
|
||||
// Throwable
|
||||
// Can this iType be thrown (determines whenever it uses the quantity and throwing damage columns
|
||||
// in Weapons.txt for example).
|
||||
@ -118,70 +182,6 @@ type ItemTypeRecord struct {
|
||||
// Can this iType be placed in your characters belt slots? 1=Yes,
|
||||
// 0=No. (This requires further tweaking in other txt files).
|
||||
Beltable bool
|
||||
|
||||
// MaxSock1, MaxSock25, MaxSock40
|
||||
// Maximum sockets for iLvl 1-25,
|
||||
// 26-40 and 40+. The range is hardcoded but the location is known,
|
||||
// so you can alter around the range to your liking. On normal,
|
||||
// items dropped from monsters are limited to 3, on nightmare to 4 and on hell to 6 sockets,
|
||||
// irregardless of this columns content.
|
||||
MaxSock1 int
|
||||
MaxSock25 int
|
||||
MaxSock40 int
|
||||
|
||||
// TreasureClass
|
||||
// Can this iType ID Pointer be used as an auto TC in TreasureClassEx.txt. 1=Yes,
|
||||
// 0=No. *Such as armo3-99 and weap3-99 etc.
|
||||
TreasureClass int
|
||||
|
||||
// Rarity
|
||||
// Dunno what it does, may have to do with the chance that an armor or weapon rack will pick
|
||||
// items of this iType. If it works like other rarity fields,
|
||||
// the chance is rarity / total_rarity * 100.
|
||||
Rarity int
|
||||
|
||||
// StaffMods
|
||||
// Contains the class code for the character class that should get +skills from this iType (
|
||||
// such as wands that can spawn with +Necromancer skills). Note,
|
||||
// this only works if the item is not low quality, set or unique. Note,
|
||||
// that this uses the vanilla min/max skill IDs for each class as the range for the skill pool,
|
||||
// so if you add new class skills to the end of the file, you should use automagic.txt instead
|
||||
StaffMods d2enum.Hero
|
||||
|
||||
// CostFormula
|
||||
// Does the game generate the sell/repair/buy prices of this iType based on its modifiers or does
|
||||
// it use only the cost specific in the respective item txt files. 2=Organ (
|
||||
// probably higher price based on unit that dropped the organ), 1=Yes, 0=No.
|
||||
// Note: Only applies to items that are not unique or set, for those the price is solely controlled
|
||||
// by the base item file and by the bonus to price given in SetItems and UniqueItems txt files.
|
||||
// The exact functionality remains unknown, as for example charms, have this disabled.
|
||||
CostFormula int
|
||||
|
||||
// Class
|
||||
// Contains the class code for the class that should be able to use this iType (
|
||||
// for class specific items).
|
||||
Class d2enum.Hero
|
||||
|
||||
// VarInvGfx
|
||||
// This column contains the sum of randomly picked inventory graphics this iType can have.
|
||||
VarInvGfx int
|
||||
|
||||
// InvGfx1-6
|
||||
// This column contains the file names of the inventory graphics that are randomly picked for
|
||||
// this iType, so if you use columns 1-3, you will set VarInvGfx to 3 (duh).
|
||||
InvGfx1 string
|
||||
InvGfx2 string
|
||||
InvGfx3 string
|
||||
InvGfx4 string
|
||||
InvGfx5 string
|
||||
InvGfx6 string
|
||||
|
||||
// StorePage
|
||||
// The page code for the page a vendor should place this iType in when sold,
|
||||
// if you enable the magic tab in D2Client.dll,
|
||||
// you need to use the proper code here to put items in that tab.
|
||||
// Right now the ones used are weap = weapons1 and 2, armo = armor and misc = miscellaneous.
|
||||
StorePage string
|
||||
}
|
||||
|
||||
// ItemTypes stores all of the ItemTypeRecords
|
||||
|
@ -14,15 +14,15 @@ import (
|
||||
|
||||
// TextBox represents a text input box
|
||||
type TextBox struct {
|
||||
text string
|
||||
x int
|
||||
y int
|
||||
visible bool
|
||||
enabled bool
|
||||
bgSprite *Sprite
|
||||
textLabel Label
|
||||
lineBar Label
|
||||
text string
|
||||
filter string
|
||||
x int
|
||||
y int
|
||||
bgSprite *Sprite
|
||||
visible bool
|
||||
enabled bool
|
||||
isFocused bool
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user