Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function(
self.controls.logoutApiButton.shown = function()
return (self.charImportMode == "SELECTCHAR" or self.charImportMode == "GETACCOUNTNAME") and main.api.authToken ~= nil
end

self.controls.characterImportAnchor = new("Control", {"TOPLEFT",self.controls.sectionCharImport,"TOPLEFT"}, {6, 40, 200, 16})
self.controls.sectionCharImport.height = function() return self.charImportMode == "AUTHENTICATION" and 60 or 200 end

Expand Down Expand Up @@ -442,7 +442,7 @@ function ImportTabClass:DownloadCharacterList()
return "Standard"
end
end

self.charImportMode = "DOWNLOADCHARLIST"
self.charImportStatus = "Retrieving character list..."
local realm = realmList[self.controls.accountRealm.selIndex]
Expand Down Expand Up @@ -954,10 +954,10 @@ function ImportTabClass:ImportItemsAndSkills(charData)
local funcGetGemInstance = function(skillData)
local typeLine = sanitiseText(skillData.typeLine) .. (skillData.support and " Support" or "")
local gemId = self.build.data.gemForBaseName[typeLine:lower()]

if typeLine:match("^Spectre:") then
gemId = "Metadata/Items/Gems/SkillGemSummonSpectre"
end
end
if typeLine:match("^Companion:") then
gemId = "Metadata/Items/Gems/SkillGemSummonBeast"
end
Expand Down Expand Up @@ -1061,7 +1061,7 @@ function ImportTabClass:ImportItemsAndSkills(charData)
end
for _, skillData in pairs(charData.skills) do
local gemInstance = funcGetGemInstance(skillData)

if gemInstance then
local group = { label = "", enabled = true, gemList = { } }
t_insert(group.gemList, gemInstance )
Expand Down Expand Up @@ -1291,6 +1291,9 @@ function ImportTabClass:ImportItem(itemData, slotName)
end
if itemData.requirements and (not itemData.socketedItems or not itemData.socketedItems[1]) then
-- Requirements cannot be trusted if there are socketed gems, as they may override the item's natural requirements
-- This means some uniques will not import Level requirement properly for now. We probably need to compare the level to the equipped rune levels,
-- and only accept the imported level if it's higher than the runes. Problem with that, when we remove the runes, the required level will drop back
-- to the base item level. Which is sometimes incorrect for uniques (they can be higher than the base, like Sylvan's Effigy)
item.requirements = { }
for _, req in ipairs(itemData.requirements) do
if req.name == "Level" then
Expand Down
67 changes: 8 additions & 59 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,11 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
end
self.checkSection = false
end
local levelReq = line:match("^Requires:? Level (%d+)")
if levelReq then
self.requirements.level = tonumber(levelReq)
goto continue
end
local specName, specVal = line:match("^([%a %(%)]+:?): (.+)$")
if specName then
if specName == "Class:" then
Expand Down Expand Up @@ -604,13 +609,11 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
end
self.armourData = self.armourData or { }
self.armourData[specName] = specToNumber(specVal)
elseif specName == "Requires Level" then
self.requirements.level = specToNumber(specVal)
minimumReqLevel = minimumReqLevel or {}
table.insert(minimumReqLevel, { name = self.name, level = specVal })
elseif specName == "Level" then
-- Requirements from imported items can't always be trusted
importedLevelReq = specToNumber(specVal)
elseif specName == "Requires Level" then
self.requirements.level = specToNumber(specVal)
elseif specName == "LevelReq" then
self.requirements.level = specToNumber(specVal)
elseif specName == "Has Alt Variant" then
Expand Down Expand Up @@ -690,9 +693,6 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
self.catalystQuality = specToNumber(specVal)
elseif specName == "Note" then
self.note = specVal
elseif specName == "Str" or specName == "Strength" or specName == "Dex" or specName == "Dexterity" or
specName == "Int" or specName == "Intelligence" then
self.requirements[specName:sub(1,3):lower()] = specToNumber(specVal)
elseif specName == "Critical Hit Range" or specName == "Attacks per Second" or specName == "Weapon Range" or
specName == "Critical Hit Chance" or specName == "Physical Damage" or specName == "Elemental Damage" or
specName == "Chaos Damage" or specName == "Fire Damage" or specName == "Cold Damage" or specName == "Lightning Damage" or
Expand Down Expand Up @@ -1210,19 +1210,6 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
self.requirements.level = self.base.req.level
end
end
if self.base and not self.requirements.baseLevel then
-- Add only if not already present, to prevent overwriting original value.
local exists = false
for _, entry in ipairs(minimumReqLevel) do
if entry.name == self.title then
exists = true
break
end
end
if not exists then
self.requirements.baseLevel = self.base.req.level
end
end
self.affixLimit = 0
if self.crafted then
if not self.affixes then
Expand Down Expand Up @@ -1651,7 +1638,7 @@ function ItemClass:Craft()
elseif mod.type == "Suffix" then
self.nameSuffix = self.nameSuffix .. " " .. mod.affix
end
self.requirements.level = m_max(self.requirements.level or 0, m_floor(mod.level * 0.8))
self.requirements.level = m_max(self.requirements.level or 0, m_floor(mod.level * 0.8), self.requirements.runeLevel or 0)
local rangeScalar = getCatalystScalar(self.catalyst, mod, self.catalystQuality)
for i, line in ipairs(mod) do
line = itemLib.applyRange(line, affix.range or 0.5, rangeScalar)
Expand Down Expand Up @@ -2153,44 +2140,6 @@ function ItemClass:BuildModList()
self.canSocketJewelBase["Ruby"] = calcLocal(baseList, "CanSocketJewelBaseRuby", "FLAG", 0)
end

local reqLevel = 0
local minReqLevel

for _, entry in ipairs(minimumReqLevel) do
if entry.name == self.title then
minReqLevel = tonumber(entry.level)
break
end
end

if #self.grantedSkills >= 1 then
local skillDef = data.skills[self.grantedSkills[1].skillId]
local gemId = data.gemForSkill[skillDef]
local gem = data.gems[gemId]

local skillLevel = self.grantedSkills[1].level or #skillDef.levels
local chosenLevel = skillDef.levels[skillLevel] or skillDef.levels[#skillDef.levels]
local gemLevelReq = chosenLevel.levelRequirement

reqLevel = m_max(gemLevelReq, minReqLevel or 0, self.requirements.runeLevel or 0, self.requirements.baseLevel or 0)

-- Rune level and unique base level don't scale attribute requirements. Example, Cursecarver has 33 minimum required level
-- but the intelligence requirement will be 21 at level 4 skill.
local attrLevel = m_max(gemLevelReq, self.requirements.baseLevel or 0)

if self.base.type == "Sceptre" or self.base.type == "Wand" or self.base.type == "Staff" then
self.requirements.int = calcLib.getGemStatRequirement(attrLevel, gem.reqInt)
self.requirements.dex = calcLib.getGemStatRequirement(attrLevel, gem.reqDex)
self.requirements.str = calcLib.getGemStatRequirement(attrLevel, gem.reqStr)
end
else
-- If no granted skills, we want to use the "Requires Level" from the unique instead of the base armour type level requirement.
-- Currently there are no Uniques that use a lower level than the base, but maybe in the future.
reqLevel = m_max(minReqLevel or 0, self.requirements.runeLevel or 0, self.requirements.baseLevel or 0)
end

self.requirements.level = reqLevel

if self.name == "Tabula Rasa, Simple Robe" or self.name == "Skin of the Loyal, Simple Robe" or self.name == "Skin of the Lords, Simple Robe" or self.name == "The Apostate, Cabalist Regalia" then
-- Hack to remove the energy shield and base int requirement
baseList:NewMod("ArmourData", "LIST", { key = "EnergyShield", value = 0 })
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Bases/amulet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ itemBases["Absent Amulet"] = {
variantList = { "Cast on Elemental Ailment", "Cast on Critical", "Cast on Dodge", "Rhoa Mount", "Archmage", "Trinity", "Eternal Rage", },
implicit = "-1 Prefix Modifier allowed\n-1 Suffix Modifier allowed\n{variant:1}Grants Skill: Level (1-20) Cast on Elemental Ailment\n{variant:2}Grants Skill: Level (1-20) Cast on Critical\n{variant:3}Grants Skill: Level (1-20) Cast on Dodge\n{variant:4}Grants Skill: Level (1-20) Rhoa Mount\n{variant:5}Grants Skill: Level (1-20) Archmage\n{variant:6}Grants Skill: Level (1-20) Trinity\n{variant:7}Grants Skill: Level (1-20) Eternal Rage",
implicitModTypes = { { }, { }, },
req = { level = 49, },
req = { level = 50, },
}
itemBases["Corona Amulet"] = {
type = "Amulet",
Expand Down
40 changes: 20 additions & 20 deletions src/Data/Bases/sceptre.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ itemBases["Stoic Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Discipline",
implicitModTypes = { },
req = { int = 12, },
req = { level = 6, int = 12, },
}
itemBases["Lupine Sceptre"] = {
type = "Sceptre",
Expand All @@ -30,7 +30,7 @@ itemBases["Lupine Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
req = { int = 24, },
req = { level = 12, int = 24, },
}
itemBases["Omen Sceptre"] = {
type = "Sceptre",
Expand All @@ -40,7 +40,7 @@ itemBases["Omen Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Malice",
implicitModTypes = { },
req = { str = 12, int = 25, },
req = { level = 16, str = 12, int = 25, },
}
itemBases["Ochre Sceptre"] = {
type = "Sceptre",
Expand All @@ -50,7 +50,7 @@ itemBases["Ochre Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
req = { int = 40, },
req = { level = 21, int = 40, },
}
itemBases["Shrine Sceptre"] = {
type = "Sceptre",
Expand All @@ -60,7 +60,7 @@ itemBases["Shrine Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Fire",
implicitModTypes = { },
req = { str = 17, int = 38, },
req = { level = 26, str = 17, int = 38, },
}
itemBases["Shrine Sceptre"] = {
type = "Sceptre",
Expand All @@ -70,7 +70,7 @@ itemBases["Shrine Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Ice",
implicitModTypes = { },
req = { str = 17, int = 38, },
req = { level = 26, str = 17, int = 38, },
}
itemBases["Shrine Sceptre"] = {
type = "Sceptre",
Expand All @@ -80,7 +80,7 @@ itemBases["Shrine Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Lightning",
implicitModTypes = { },
req = { str = 17, int = 38, },
req = { level = 26, str = 17, int = 38, },
}
itemBases["Devouring Sceptre"] = {
type = "Sceptre",
Expand All @@ -90,7 +90,7 @@ itemBases["Devouring Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
req = { int = 60, },
req = { level = 33, int = 60, },
}
itemBases["Clasped Sceptre"] = {
type = "Sceptre",
Expand All @@ -100,7 +100,7 @@ itemBases["Clasped Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Heart of Ice",
implicitModTypes = { },
req = { int = 65, },
req = { level = 36, int = 65, },
}
itemBases["Devotional Sceptre"] = {
type = "Sceptre",
Expand All @@ -110,7 +110,7 @@ itemBases["Devotional Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
req = { str = 26, int = 63, },
req = { level = 45, str = 26, int = 63, },
}
itemBases["Wrath Sceptre"] = {
type = "Sceptre",
Expand All @@ -120,7 +120,7 @@ itemBases["Wrath Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Fulmination",
implicitModTypes = { },
req = { int = 87, },
req = { level = 49, int = 87, },
}
itemBases["Aromatic Sceptre"] = {
type = "Sceptre",
Expand All @@ -130,7 +130,7 @@ itemBases["Aromatic Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
req = { int = 92, },
req = { level = 52, int = 92, },
}
itemBases["Pious Sceptre"] = {
type = "Sceptre",
Expand All @@ -140,7 +140,7 @@ itemBases["Pious Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
req = { int = 102, },
req = { level = 58, int = 102, },
}
itemBases["Hallowed Sceptre"] = {
type = "Sceptre",
Expand All @@ -150,7 +150,7 @@ itemBases["Hallowed Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
req = { int = 114, },
req = { level = 65, int = 114, },
}

itemBases["Shrine Sceptre"] = {
Expand All @@ -162,7 +162,7 @@ itemBases["Shrine Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Fire",
implicitModTypes = { },
req = { str = 17, int = 38, },
req = { level = 26, str = 17, int = 38, },
}
itemBases["Shrine Sceptre"] = {
type = "Sceptre",
Expand All @@ -173,7 +173,7 @@ itemBases["Shrine Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Ice",
implicitModTypes = { },
req = { str = 17, int = 38, },
req = { level = 26, str = 17, int = 38, },
}
itemBases["Shrine Sceptre"] = {
type = "Sceptre",
Expand All @@ -184,7 +184,7 @@ itemBases["Shrine Sceptre"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Lightning",
implicitModTypes = { },
req = { str = 17, int = 38, },
req = { level = 26, str = 17, int = 38, },
}

itemBases["Shrine Sceptre (Purity of Fire)"] = {
Expand All @@ -195,7 +195,7 @@ itemBases["Shrine Sceptre (Purity of Fire)"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Fire",
implicitModTypes = { },
req = { str = 17, int = 38, },
req = { level = 26, str = 17, int = 38, },
}
itemBases["Shrine Sceptre (Purity of Cold)"] = {
type = "Sceptre",
Expand All @@ -205,7 +205,7 @@ itemBases["Shrine Sceptre (Purity of Cold)"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Ice",
implicitModTypes = { },
req = { str = 17, int = 38, },
req = { level = 26, str = 17, int = 38, },
}
itemBases["Shrine Sceptre (Purity of Lighting)"] = {
type = "Sceptre",
Expand All @@ -215,5 +215,5 @@ itemBases["Shrine Sceptre (Purity of Lighting)"] = {
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Lightning",
implicitModTypes = { },
req = { str = 17, int = 38, },
req = { level = 26, str = 17, int = 38, },
}
Loading
Loading