Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variant Improvements #5680

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Regisle
Copy link
Member

@Regisle Regisle commented Feb 13, 2023

This modifies Variants a lot, so testing needs to be setup, though I could not find issues with my limited testing

Alt Variant names can now be almost arbitrary and you can have arbitrarily as many as you want
eg
image

This also lets you set a range for variants
eg precursor
image
only lets you pick the base for the first dropdown, and does not let you pick base for any other dropdown

paradoxica has one dropdown for prefixes, and one for suffixes
Cane of Kulemak has one for either prefix or suffix, one for only prefixes and one for only suffixes
Militant faith has one for selecting keystone and 2 for other mods
and a few others have been modified as well

I will likely add more modifications to this, some planned modifications are;

  1. variant influences (for Impresence drop from Uber Uber Elder)
  2. variant level requirements

possibly) variant variants (eg for watchers eye, if you pick a variant that enables a legacy mod then it activates a new variant dropdown to let you select between the current and any legacy variants of said mod)

@QuickStick123 QuickStick123 added the enhancement New feature, calculation, or mod label Feb 13, 2023
Comment on lines +293 to +300
local variantRange1, variantRange2
for i in specVal:gmatch("%d+") do
if variantRange1 then
variantRange2 = tonumber(i)
else
variantRange1 = tonumber(i)
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local variantRange1, variantRange2
for i in specVal:gmatch("%d+") do
if variantRange1 then
variantRange2 = tonumber(i)
else
variantRange1 = tonumber(i)
end
end
local variantRange1, variantRange2 = line:match("%((%d+),(%d+)%)")

This should work as well afaik

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had this originally but ran into some issues, do not remember what they were but i can take a look at setting it back to this

Comment on lines +301 to +310
if variantRange1 <= variantRange2 then
self.variantList[variantName].range = {variantRange1, variantRange2}
self.variantList[variantName].list = {}
local i = variantRange1
while i <= variantRange2 and self.variantNameList do
t_insert(self.variantList[variantName].list, self.variantNameList[i])
i = i + 1
end
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if variantRange1 <= variantRange2 then
self.variantList[variantName].range = {variantRange1, variantRange2}
self.variantList[variantName].list = {}
local i = variantRange1
while i <= variantRange2 and self.variantNameList do
t_insert(self.variantList[variantName].list, self.variantNameList[i])
i = i + 1
end
end
end
if variantRange1 <= variantRange2 and self.variantNameList then
self.variantList[variantName].range = {variantRange1, variantRange2}
self.variantList[variantName].list = {}
for i = variantRange1, variantRange2 do
t_insert(self.variantList[variantName].list, self.variantNameList[i])
end
end
end

Bit cleaner

self.variantList = { }
if not self.variantNameList then
self.variantNameList = { }
self.variantList = self.variantList or { Base = { } }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.variantList = self.variantList or { Base = { } }
self.variantList = self.variantList or { base = { } }

Fields seem to typical start with lowercase in this project needs changing elsewhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to match the other default names of "Two" "Three" "Four" etc which start with a capital, but I am indifferent and can change it

local variantName = specName == "Has Alt Variant" and "One" or specName:gsub("Has Alt Variant ","")
self.variantList = self.variantList or { Base = { } }
self.variantList[variantName] = {}
if specVal:match("%(%d+,%d+%)") then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if specVal:match("%(%d+,%d+%)") then
if specVal:match("%(%d+%-%d+%)") then

Ranges typically use (x-y) notations might be a better format?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was incase I wanted to mess with ranges to make it "min, max, step", but ended up not needing it at the time so can change it to use "-" if I dont need step

Comment on lines +656 to +660
local i = 1
while i <= lowestRange - 1 do
t_insert(self.variantList.Base.list, self.variantNameList[i])
i = i + 1
end
Copy link
Contributor

@QuickStick123 QuickStick123 Feb 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local i = 1
while i <= lowestRange - 1 do
t_insert(self.variantList.Base.list, self.variantNameList[i])
i = i + 1
end
for i = 1, lowestRange - 1 do
t_insert(self.variantList.Base.list, self.variantNameList[i])
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, calculation, or mod
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants