Skip to content

Rework TradeQueryGenerator to use exported stat names and values#2355

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

Rework TradeQueryGenerator to use exported stat names and values#2355
vaisest wants to merge 9 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"] = {
	},
},

Implicit mod IDs are also exported for item bases.

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.

This PR shouldn't have many functional changes, but this does fix the roll ranges for # to # flat damage mods. Previously, e.g. 1 to 300 lightning damage would be tested as 150 to 150 lightning damage, which might not be realistic.

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
@vaisest vaisest force-pushed the refactor-weight-gen branch from 9f25374 to 81ac2ee Compare July 7, 2026 15:32
@vaisest vaisest force-pushed the refactor-weight-gen branch from 3a76dd3 to f067202 Compare July 7, 2026 16:22
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