Skip to content

Rework TradeQueryGenerator to use exported stat names and values#2355

Draft
vaisest wants to merge 8 commits into
PathOfBuildingCommunity:devfrom
vaisest:refactor-weight-gen
Draft

Rework TradeQueryGenerator to use exported stat names and values#2355
vaisest wants to merge 8 commits into
PathOfBuildingCommunity:devfrom
vaisest:refactor-weight-gen

Conversation

@vaisest

@vaisest vaisest commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Description of the problem being solved:

This PR reworks the QueryMods.lua and weight generation to avoid having to parse mod texts which is not easy and results in extra work, like having to figure out when you need to negate mod values, etc.

Instead, this exports stat names and values for mods:

["BodyArmourImplicitIncreasedLife1"] = {
	"+(60-80) to maximum Life",
	["affix"] = "",
	["group"] = "IncreasedLife",
	["level"] = 1,
	["modTags"] = {
		"resource",
		"life",
	},
	["statOrder"] = {
		887,
	},
	["tradeHashes"] = {
		[3299347043] = {
			["canonicalStat"] = "base_maximum_life",
			["statValues"] = {
				["base_maximum_life"] = {
					["max"] = 80,
					["min"] = 60,
				},
			},
		},
	},
	["weightKey"] = {
	},
	["weightVal"] = {
	},
},

These can be used to easily generate a modline later with data.describeStats(), while being able to plug the stat value directly into the trade site. This, in my opinion, makes the code a lot more readable and simpler. The existing code also works around some exceptions, like "an additional" being converted to 1 additional. Issues like these are completely avoided

This is based on #2347

Steps taken to verify a working solution:

  • wip

Link to a build that showcases this PR:

Before screenshot:

After screenshot:

@vaisest vaisest changed the title Rework TradeQueryGenerator to use Rework TradeQueryGenerator to use exported stat names and values Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant