Add more item flags (#69)

* Add more item flags

- Add more item flags
- Modify some of the stat strings

* fix ethereal

* Rename flag
This commit is contained in:
Arto Simonyan
2025-02-09 01:08:58 +02:00
committed by GitHub
parent 415ac29ab1
commit 09dfe3c65d
3 changed files with 57 additions and 24 deletions

View File

@@ -75,16 +75,24 @@ type UnitID int
type Item struct { type Item struct {
ID int ID int
UnitID UnitID
Name item.Name Name item.Name
Quality item.Quality Quality item.Quality
Position Position Position Position
Location item.Location Location item.Location
Ethereal bool Ethereal bool
IsHovered bool IsHovered bool
BaseStats stat.Stats BaseStats stat.Stats
Stats stat.Stats Stats stat.Stats
Identified bool Identified bool
IsRuneword bool IsRuneword bool
IsNamed bool
IsStartItem bool
IsEar bool
IsBroken bool
IsEquipped bool
HasSockets bool
InTradeOrStoreScreen bool
IsInSocket bool
} }
type Drop struct { type Drop struct {

View File

@@ -785,15 +785,15 @@ var StatStringMap = map[int]map[int]string{
19: {0: "+# to Attack Rating"}, // tohit 19: {0: "+# to Attack Rating"}, // tohit
20: {0: "#% Increased Chance of Blocking"}, // toblock 20: {0: "#% Increased Chance of Blocking"}, // toblock
21: { 21: {
0: "Adds #-# Damage", // mindamage 0: "#-# Damage", // mindamage
1: "+# to Minimum Damage", // plusmindamage 1: "+# to Minimum Damage", // plusmindamage
}, },
22: { 22: {
0: "maxdamage ????", 0: "#", // maxdamage
1: "+# to Maximum Damage", // plusmaxdamage 1: "+# to Maximum Damage", // plusmaxdamage
}, },
23: {0: "secondarymindamage ????"}, 23: {0: "#"}, //minimum dmg for 2hand weapons - secondarymindamage
24: {0: "secondarymaxdamage ????"}, 24: {0: "#"}, // maximum dmg for 2hand weapons - secondarymaxdamage
25: {0: "damagepercent ????"}, 25: {0: "damagepercent ????"},
26: {0: "manarecovery ????"}, 26: {0: "manarecovery ????"},
27: {0: "Regenerate Mana #%"}, // manarecoverybonus 27: {0: "Regenerate Mana #%"}, // manarecoverybonus
@@ -840,17 +840,17 @@ var StatStringMap = map[int]map[int]string{
65: {0: "stamdrainmaxdam ????"}, 65: {0: "stamdrainmaxdam ????"},
66: {0: "stunlength ????"}, 66: {0: "stunlength ????"},
67: {0: "+#% Faster Run/Walk"}, 67: {0: "+#% Faster Run/Walk"},
68: {0: "+#% Increased Attack Speed"}, 68: {0: "#"}, // attackrate
69: {0: "otheranimrate ????"}, 69: {0: "otheranimrate ????"},
70: {0: "Quantity: #"}, 70: {0: "Quantity: #"},
71: {0: "Value: #"}, 71: {0: "Value: #"},
72: {0: "Durability: # of #"}, // durability 72: {0: "Durability: # of #"}, // durability
73: {0: "Increase Maximum Durability #%"}, // maxdurability 73: {0: "#"}, // maxdurability
74: {0: "Replenish Life +#"}, // hpregen 74: {0: "Replenish Life +#"}, // hpregen
75: {0: "Increase Maximum Durability #%"}, //itemmaxdurabilitypercent 75: {0: "Increase Maximum Durability #%"}, //itemmaxdurabilitypercent
76: {0: "Increase Maximum Life #%"}, //itemmaxmanapercent 76: {0: "Increase Maximum Life #%"}, //itemmaxmanapercent
77: {0: "Increase Maximum Mana #%"}, //itemmaxmanapercent 77: {0: "Increase Maximum Mana #%"}, //itemmaxmanapercent
78: {0: "itemattackertakesdamage"}, //itemattackertakesdamage 78: {0: "Attacker Takes Damage of #"}, //itemattackertakesdamage
79: {0: "#% Extra Gold from Monsters"}, //itemgoldbonus 79: {0: "#% Extra Gold from Monsters"}, //itemgoldbonus
80: {0: "#% Better Chance of Getting Magic Items"}, //itemmagicbonus 80: {0: "#% Better Chance of Getting Magic Items"}, //itemmagicbonus
81: {0: "Knockback"}, //itemknockback 81: {0: "Knockback"}, //itemknockback

View File

@@ -266,13 +266,38 @@ func (gd *GameReader) getItemStats(statsListExPtr uintptr) (stat.Stats, stat.Sta
} }
func setProperties(item *data.Item, flags uint32) { func setProperties(item *data.Item, flags uint32) {
if 0x00400000&flags != 0 { if 0x4000000&flags != 0 {
item.Ethereal = true
}
if 0x00000010&flags != 0 {
item.Identified = true
}
if 0x04000000&flags != 0 {
item.IsRuneword = true item.IsRuneword = true
} }
if 0x1000000&flags != 0 {
item.IsNamed = true
}
if 0x400000&flags != 0 {
item.Ethereal = true
}
if 0x20000&flags != 0 {
item.IsStartItem = true
}
if 0x10000&flags != 0 {
item.IsEar = true
}
if 0x2000&flags != 0 {
item.InTradeOrStoreScreen = true
}
if 0x800&flags != 0 {
item.HasSockets = true
}
if 0x100&flags != 0 {
item.IsBroken = true
}
if 0x10&flags != 0 {
item.Identified = true
}
// Only jewels and runes, gems don't work
if 0x8&flags != 0 {
item.IsInSocket = true
}
if 0x1&flags != 0 {
item.IsEquipped = true
}
} }