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:
@@ -20,7 +20,7 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
fixedPropsRegexp = regexp.MustCompile(`(\[(type|quality|class|name|flag|color)]\s*(<=|<|>|>=|!=|==)\s*([a-zA-Z0-9]+))`)
|
||||
fixedPropsRegexp = regexp.MustCompile(`(\[(type|quality|class|name|flag|color|prefix|suffix|levelreq)]\s*(<=|<|>|>=|!=|==)\s*([a-zA-Z0-9]+))`)
|
||||
statsRegexp = regexp.MustCompile(`\[(.*?)]`)
|
||||
maxQtyRegexp = regexp.MustCompile(`(\[maxquantity]\s*(<=|<|>|>=|!=|==)\s*([0-9]+))`)
|
||||
)
|
||||
@@ -61,7 +61,7 @@ func (r Rules) EvaluateAll(it data.Item) (Rule, RuleResult) {
|
||||
return bestMatchingRule, bestMatch
|
||||
}
|
||||
|
||||
var fixedPropsList = map[string]int{"type": 0, "quality": 0, "class": 0, "name": 0, "flag": 0, "color": 0}
|
||||
var fixedPropsList = map[string]int{"type": 0, "quality": 0, "class": 0, "name": 0, "flag": 0, "color": 0, "prefix": 0, "suffix": 0, "levelreq": 0}
|
||||
|
||||
func NewRule(rawRule string, filename string, lineNumber int) (Rule, error) {
|
||||
rule := sanitizeLine(rawRule)
|
||||
@@ -127,7 +127,6 @@ func NewRule(rawRule string, filename string, lineNumber int) (Rule, error) {
|
||||
return Rule{}, fmt.Errorf("error compiling rule: %w", err)
|
||||
}
|
||||
r.stage2 = program
|
||||
|
||||
// We only care about first and second part, third one is maxquantity and was already parsed
|
||||
break
|
||||
}
|
||||
@@ -150,6 +149,28 @@ func (r Rule) Evaluate(it data.Item) (RuleResult, error) {
|
||||
stage1Props["name"] = it.ID
|
||||
case "flag":
|
||||
stage1Props["flag"] = map[bool]int{true: 1, false: 0}[it.Ethereal]
|
||||
case "prefix":
|
||||
if it.Affixes.Rare.Prefix != 0 {
|
||||
stage1Props["prefix"] = int(it.Affixes.Rare.Prefix)
|
||||
}
|
||||
for _, prefix := range it.Affixes.Magic.Prefixes {
|
||||
if prefix != 0 {
|
||||
stage1Props["prefix"] = int(prefix)
|
||||
break
|
||||
}
|
||||
}
|
||||
case "suffix":
|
||||
if it.Affixes.Rare.Suffix != 0 {
|
||||
stage1Props["suffix"] = int(it.Affixes.Rare.Suffix)
|
||||
}
|
||||
for _, suffix := range it.Affixes.Magic.Suffixes {
|
||||
if suffix != 0 {
|
||||
stage1Props["suffix"] = int(suffix)
|
||||
break
|
||||
}
|
||||
}
|
||||
case "levelreq":
|
||||
stage1Props["levelreq"] = it.LevelReq
|
||||
case "color":
|
||||
// TODO: Not supported yet
|
||||
}
|
||||
@@ -217,6 +238,9 @@ func replaceStringPropertiesInStage1(stage1 string) (string, error) {
|
||||
replaceWith = strings.ReplaceAll(prop[0], prop[4], fmt.Sprintf("%d", item.GetIDByName(prop[4])))
|
||||
case "flag":
|
||||
replaceWith = strings.ReplaceAll(prop[0], prop[4], fmt.Sprintf("%d", 1))
|
||||
case "prefix", "suffix", "levelreq":
|
||||
// Handle prefix/suffix IDs and levelreq
|
||||
replaceWith = strings.ReplaceAll(prop[0], prop[4], prop[4])
|
||||
case "color":
|
||||
// TODO: Not supported yet
|
||||
return "", fmt.Errorf("property %s is not supported yet", prop[2])
|
||||
|
||||
Reference in New Issue
Block a user