Prefix,Suffix,LevelReq Socketed items on bases, bodyloc, Merc equipment (#74)
* Prefix,Suffix, Socketed with base, bodyloc, Merc equipment Will add better description later: Item that has socketed items now display their linked runes/jewels/gems in accurate order Rare prefix, rare suffix id Magic prefix1,2,3 magic suffix1,2,3 Prefix1 also used to tell wich runeword it is Spirit 20635, cta 20519 , infinity 20566 see : getlocalestring.txt Mercenary equipment now displaying in inventory list . Also has custom location : mercenary instead of equipped Bodyloc : // Body locations LocNone LocationType = "none" LocHead LocationType = "head" LocNeck LocationType = "neck" LocTorso LocationType = "torso" LocLeftArm LocationType = "left_arm" LocRightArm LocationType = "right_arm" LocLeftRing LocationType = "left_ring" LocRightRing LocationType = "right_ring" LocBelt LocationType = "belt" LocFeet LocationType = "feet" LocGloves LocationType = "gloves" LocLeftArmSecondary LocationType = "left_arm_secondary" LocRightArmSecondary LocationType = "right_arm_secondary" Note that if you begin game on secondary slot it will be left_arm then primary will be left_arm_secondary (inversed): With pr 62 (activeweaponslot) we will be able to solve this potential issue. * small optimization * Socketed items to base from pointer new helper functions. AutoAffix offset. * remove helpers fnc, flag isEquipped to HasBeenEquipped * Runewords names mapped * helper function not needed * Optimization * adjust pre-allocations * readd removed itemloc comment * Addex prefix/suffix to rules .nip new structure: [Type], [Quality],[Class], [Name], [Flag], [Color], [Prefix], [Suffix] # Stats Exemple : [name] == ring && [quality] == rare && [suffix] == 174 # Any magic ring with suffix 'of The Apprentice' ( 10 faster cast rate) Will be useful for trophy items with fool/cruel [prefix] == 1416 [prefix] == 1273 * LevelReq + Affixes mapping rare/magic/base/runewords. Nip parser LevelReq * Unique and set items mapping + LevelReq
This commit is contained in:
@@ -72,27 +72,44 @@ func (i Inventory) Matrix() [4][10]bool {
|
||||
|
||||
type UnitID int
|
||||
|
||||
type ItemAffixes struct {
|
||||
Rare struct {
|
||||
Prefix int16
|
||||
Suffix int16
|
||||
}
|
||||
Magic struct {
|
||||
Prefixes [3]int16 // Prefix1, Prefix2, Prefix3
|
||||
Suffixes [3]int16 // Suffix1, Suffix2, Suffix3
|
||||
}
|
||||
}
|
||||
|
||||
type Item struct {
|
||||
ID int
|
||||
UnitID
|
||||
Name item.Name
|
||||
Quality item.Quality
|
||||
IdentifiedName string
|
||||
RunewordName item.RunewordName
|
||||
LevelReq int
|
||||
Position Position
|
||||
Location item.Location
|
||||
Ethereal bool
|
||||
IsHovered bool
|
||||
BaseStats stat.Stats
|
||||
Stats stat.Stats
|
||||
Affixes ItemAffixes
|
||||
Sockets []Item
|
||||
Identified bool
|
||||
IsRuneword bool
|
||||
IsNamed bool
|
||||
IsStartItem bool
|
||||
IsEar bool
|
||||
IsBroken bool
|
||||
IsEquipped bool
|
||||
HasBeenEquipped bool
|
||||
HasSockets bool
|
||||
InTradeOrStoreScreen bool
|
||||
IsInSocket bool
|
||||
UniqueSetID int32
|
||||
}
|
||||
|
||||
type Drop struct {
|
||||
@@ -138,3 +155,70 @@ func (i Item) FindStat(id stat.ID, layer int) (stat.Data, bool) {
|
||||
|
||||
return i.BaseStats.FindStat(id, layer)
|
||||
}
|
||||
|
||||
func (i Item) HasPrefix(id int16) bool {
|
||||
// Check rare prefix
|
||||
if i.Affixes.Rare.Prefix == id {
|
||||
return true
|
||||
}
|
||||
|
||||
// Check magic prefixes
|
||||
for _, prefix := range i.Affixes.Magic.Prefixes {
|
||||
if prefix == id {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (i Item) HasSuffix(id int16) bool {
|
||||
// Check rare suffix
|
||||
if i.Affixes.Rare.Suffix == id {
|
||||
return true
|
||||
}
|
||||
|
||||
// Check magic suffixes
|
||||
for _, suffix := range i.Affixes.Magic.Suffixes {
|
||||
if suffix == id {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (a ItemAffixes) GetRarePrefix() (item.RarePrefix, bool) {
|
||||
prefix, exists := item.RarePrefixDesc[int(a.Rare.Prefix)]
|
||||
return prefix, exists
|
||||
}
|
||||
|
||||
func (a ItemAffixes) GetRareSuffix() (item.RareSuffix, bool) {
|
||||
suffix, exists := item.RareSuffixDesc[int(a.Rare.Suffix)]
|
||||
return suffix, exists
|
||||
}
|
||||
|
||||
func (a ItemAffixes) GetMagicPrefixes() []item.MagicPrefix {
|
||||
prefixes := make([]item.MagicPrefix, 0, 3)
|
||||
for _, id := range a.Magic.Prefixes {
|
||||
if prefix, exists := item.MagicPrefixDesc[int(id)]; exists && id != 0 {
|
||||
prefixes = append(prefixes, prefix)
|
||||
}
|
||||
}
|
||||
return prefixes
|
||||
}
|
||||
|
||||
func (a ItemAffixes) GetMagicSuffixes() []item.MagicSuffix {
|
||||
suffixes := make([]item.MagicSuffix, 0, 3)
|
||||
for _, id := range a.Magic.Suffixes {
|
||||
if suffix, exists := item.MagicSuffixDesc[int(id)]; exists && id != 0 {
|
||||
suffixes = append(suffixes, suffix)
|
||||
}
|
||||
}
|
||||
return suffixes
|
||||
}
|
||||
|
||||
func (i Item) GetSocketedItems() []Item {
|
||||
return i.Sockets
|
||||
}
|
||||
func (i Item) HasSocketedItems() bool {
|
||||
return len(i.Sockets) > 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user