Skip to content

Commit 25db581

Browse files
authored
Merge pull request #156 from QuickStick123/remove-enchantments
Remove enchantments
2 parents 3099e5e + 754a11b commit 25db581

File tree

11 files changed

+3
-644
lines changed

11 files changed

+3
-644
lines changed

src/Classes/Item.lua

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -663,15 +663,6 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
663663
self.affixes = (self.base.subType and data.itemMods[self.base.type..self.base.subType])
664664
or data.itemMods[self.base.type]
665665
or data.itemMods.Item
666-
if self.base.flask then
667-
if self.base.utility_flask then
668-
self.enchantments = data.enchantments["UtilityFlask"]
669-
else
670-
self.enchantments = data.enchantments["Flask"]
671-
end
672-
else
673-
self.enchantments = data.enchantments[self.base.type]
674-
end
675666
self.corruptible = self.base.type ~= "Flask" and self.base.type ~= "Charm" and self.base.type ~= "Rune" and self.base.type ~= "SoulCore"
676667
self.clusterJewel = data.clusterJewels and data.clusterJewels.jewels[self.baseName]
677668
self.requirements.str = self.base.req.str or 0
@@ -729,17 +720,6 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
729720
self.suffixes.limit = (self.suffixes.limit or 0) + (tonumber(lineLower:match("%+(%d+) suffix modifiers? allowed")) or 0) - (tonumber(lineLower:match("%-(%d+) suffix modifiers? allowed")) or 0)
730721
elseif lineLower == "this item can be anointed by cassia" then
731722
self.canBeAnointed = true
732-
elseif lineLower == "can have a second enchantment modifier" then
733-
self.canHaveTwoEnchants = true
734-
elseif lineLower == "can have 1 additional enchantment modifiers" then
735-
self.canHaveTwoEnchants = true
736-
elseif lineLower == "can have 2 additional enchantment modifiers" then
737-
self.canHaveTwoEnchants = true
738-
self.canHaveThreeEnchants = true
739-
elseif lineLower == "can have 3 additional enchantment modifiers" then
740-
self.canHaveTwoEnchants = true
741-
self.canHaveThreeEnchants = true
742-
self.canHaveFourEnchants = true
743723
end
744724

745725
local modLines

src/Classes/ItemsTab.lua

Lines changed: 3 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -379,54 +379,15 @@ holding Shift will put it in the second.]])
379379

380380
-- Section: Enchant / Anoint / Corrupt
381381
self.controls.displayItemSectionEnchant = new("Control", {"TOPLEFT",self.controls.displayItemSectionSockets,"BOTTOMLEFT"}, {0, 0, 0, function()
382-
return (self.controls.displayItemEnchant:IsShown() or self.controls.displayItemEnchant2:IsShown() or self.controls.displayItemAnoint:IsShown() or self.controls.displayItemAnoint2:IsShown() or self.controls.displayItemCorrupt:IsShown() ) and 28 or 0
382+
return (self.controls.displayItemAnoint:IsShown() or self.controls.displayItemAnoint2:IsShown() or self.controls.displayItemCorrupt:IsShown() ) and 28 or 0
383383
end})
384-
self.controls.displayItemEnchant = new("ButtonControl", {"TOPLEFT",self.controls.displayItemSectionEnchant,"TOPLEFT"}, {0, 0, 160, 20}, "Apply Enchantment...", function()
385-
self:EnchantDisplayItem(1)
386-
end)
387-
self.controls.displayItemEnchant.shown = function()
388-
return self.displayItem and self.displayItem.enchantments
389-
end
390-
self.controls.displayItemEnchant2 = new("ButtonControl", {"TOPLEFT",self.controls.displayItemEnchant,"TOPRIGHT",true}, {8, 0, 160, 20}, "Apply Enchantment 2...", function()
391-
self:EnchantDisplayItem(2)
392-
end)
393-
self.controls.displayItemEnchant2.shown = function()
394-
return self.displayItem and self.displayItem.enchantments and self.displayItem.canHaveTwoEnchants and #self.displayItem.enchantModLines > 0
395-
end
396-
self.controls.displayItemAnoint = new("ButtonControl", {"TOPLEFT",self.controls.displayItemEnchant2,"TOPRIGHT",true}, {8, 0, 100, 20}, "Anoint...", function()
384+
self.controls.displayItemAnoint = new("ButtonControl", {"TOPLEFT",self.controls.displayItemSectionEnchant,"TOPLEFT"}, {0, 0, 100, 20}, "Anoint...", function()
397385
self:AnointDisplayItem(1)
398386
end)
399387
self.controls.displayItemAnoint.shown = function()
400388
return self.displayItem and (self.displayItem.base.type == "Amulet" or self.displayItem.canBeAnointed)
401389
end
402-
self.controls.displayItemAnoint2 = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint,"TOPRIGHT",true}, {8, 0, 100, 20}, "Anoint 2...", function()
403-
self:AnointDisplayItem(2)
404-
end)
405-
self.controls.displayItemAnoint2.shown = function()
406-
return self.displayItem and
407-
(self.displayItem.base.type == "Amulet" or self.displayItem.canBeAnointed) and
408-
self.displayItem.canHaveTwoEnchants and
409-
#self.displayItem.enchantModLines > 0
410-
end
411-
self.controls.displayItemAnoint3 = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint2,"TOPRIGHT",true}, {8, 0, 100, 20}, "Anoint 3...", function()
412-
self:AnointDisplayItem(3)
413-
end)
414-
self.controls.displayItemAnoint3.shown = function()
415-
return self.displayItem and
416-
(self.displayItem.base.type == "Amulet" or self.displayItem.canBeAnointed) and
417-
self.displayItem.canHaveThreeEnchants and
418-
#self.displayItem.enchantModLines > 1
419-
end
420-
self.controls.displayItemAnoint4 = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint3,"TOPRIGHT",true}, {8, 0, 100, 20}, "Anoint 4...", function()
421-
self:AnointDisplayItem(4)
422-
end)
423-
self.controls.displayItemAnoint4.shown = function()
424-
return self.displayItem and
425-
(self.displayItem.base.type == "Amulet" or self.displayItem.canBeAnointed) and
426-
self.displayItem.canHaveFourEnchants and
427-
#self.displayItem.enchantModLines > 2
428-
end
429-
self.controls.displayItemCorrupt = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint4,"TOPRIGHT",true}, {8, 10, 100, 20}, "Corrupt...", function()
390+
self.controls.displayItemCorrupt = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint,"TOPRIGHT",true}, {8, 0, 100, 20}, "Corrupt...", function()
430391
self:CorruptDisplayItem()
431392
end)
432393
self.controls.displayItemCorrupt.shown = function()
@@ -2036,133 +1997,6 @@ function ItemsTabClass:EditDisplayItemText(alsoAddItem)
20361997
main:OpenPopup(500, 500, self.displayItem and "Edit Item Text" or "Create Custom Item from Text", controls, nil, "edit")
20371998
end
20381999

2039-
-- Opens the item enchanting popup
2040-
function ItemsTabClass:EnchantDisplayItem(enchantSlot)
2041-
self.enchantSlot = enchantSlot or 1
2042-
2043-
local controls = { }
2044-
local enchantments = self.displayItem.enchantments
2045-
local haveSkills = true
2046-
for _, source in ipairs(self.build.data.enchantmentSource) do
2047-
if self.displayItem.enchantments[source.name] then
2048-
haveSkills = false
2049-
break
2050-
end
2051-
end
2052-
local skillList = { }
2053-
local skillsUsed = { }
2054-
if haveSkills then
2055-
for _, socketGroup in ipairs(self.build.skillsTab.socketGroupList) do
2056-
for _, gemInstance in ipairs(socketGroup.gemList) do
2057-
if gemInstance.gemData then
2058-
for _, grantedEffect in ipairs(gemInstance.gemData.grantedEffectList) do
2059-
if not grantedEffect.support and enchantments[grantedEffect.name] then
2060-
skillsUsed[grantedEffect.name] = true
2061-
end
2062-
end
2063-
end
2064-
end
2065-
end
2066-
end
2067-
local function buildSkillList(onlyUsedSkills)
2068-
wipeTable(skillList)
2069-
for skillName in pairs(enchantments) do
2070-
if not onlyUsedSkills or not next(skillsUsed) or skillsUsed[skillName] then
2071-
t_insert(skillList, skillName)
2072-
end
2073-
end
2074-
table.sort(skillList)
2075-
end
2076-
local enchantmentSourceList = { }
2077-
local function buildEnchantmentSourceList()
2078-
wipeTable(enchantmentSourceList)
2079-
local list = haveSkills and enchantments[skillList[controls.skill and controls.skill.selIndex or 1]] or enchantments
2080-
for _, source in ipairs(self.build.data.enchantmentSource) do
2081-
if list[source.name] then
2082-
t_insert(enchantmentSourceList, source)
2083-
end
2084-
end
2085-
end
2086-
local enchantmentList = { }
2087-
local function buildEnchantmentList()
2088-
wipeTable(enchantmentList)
2089-
local list = haveSkills and enchantments[skillList[controls.skill and controls.skill.selIndex or 1]] or enchantments
2090-
for _, enchantment in ipairs(list[enchantmentSourceList[controls.enchantmentSource and controls.enchantmentSource.selIndex or 1].name]) do
2091-
t_insert(enchantmentList, enchantment)
2092-
end
2093-
end
2094-
if haveSkills then
2095-
buildSkillList(true)
2096-
end
2097-
buildEnchantmentSourceList()
2098-
buildEnchantmentList()
2099-
local function enchantItem(idx, remove)
2100-
local item = new("Item", self.displayItem:BuildRaw())
2101-
local index = idx or controls.enchantment.selIndex
2102-
item.id = self.displayItem.id
2103-
local list = haveSkills and enchantments[controls.skill.list[controls.skill.selIndex]] or enchantments
2104-
local line = list[controls.enchantmentSource.list[controls.enchantmentSource.selIndex].name][index]
2105-
local first, second = line:match("([^/]+)/([^/]+)")
2106-
if remove then
2107-
t_remove(item.enchantModLines, self.enchantSlot)
2108-
elseif first then
2109-
item.enchantModLines = { { enchant = true, line = first }, { enchant = true, line = second } }
2110-
else
2111-
if not item.canHaveTwoEnchants and #item.enchantModLines > 1 then
2112-
item.enchantModLines = { item.enchantModLines[1] }
2113-
end
2114-
if #item.enchantModLines >= self.enchantSlot then
2115-
t_remove(item.enchantModLines, self.enchantSlot)
2116-
end
2117-
t_insert(item.enchantModLines, self.enchantSlot, { enchant = true, line = line})
2118-
end
2119-
item:BuildAndParseRaw()
2120-
return item
2121-
end
2122-
if haveSkills then
2123-
controls.skillLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {95, 20, 0, 16}, "^7Skill:")
2124-
controls.skill = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 20, 180, 18}, skillList, function(index, value)
2125-
buildEnchantmentSourceList()
2126-
buildEnchantmentList()
2127-
controls.enchantment:SetSel(1)
2128-
end)
2129-
controls.allSkills = new("CheckBoxControl", {"TOPLEFT",nil,"TOPLEFT"}, {350, 20, 18}, "All skills:", function(state)
2130-
buildSkillList(not state)
2131-
controls.skill:SetSel(1)
2132-
buildEnchantmentList()
2133-
controls.enchantment:SetSel(1)
2134-
end)
2135-
controls.allSkills.tooltipText = "Show all skills, not just those used by this build."
2136-
if not next(skillsUsed) then
2137-
controls.allSkills.state = true
2138-
controls.allSkills.enabled = false
2139-
end
2140-
end
2141-
controls.enchantmentSourceLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {95, 45, 0, 16}, "^7Source:")
2142-
controls.enchantmentSource = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 45, 180, 18}, enchantmentSourceList, function(index, value)
2143-
buildEnchantmentList()
2144-
controls.enchantment:SetSel(m_min(controls.enchantment.selIndex, #enchantmentList))
2145-
end)
2146-
controls.enchantmentLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {95, 70, 0, 16}, "^7Enchantment:")
2147-
controls.enchantment = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 70, 440, 18}, enchantmentList)
2148-
controls.enchantment.tooltipFunc = function(tooltip, mode, index)
2149-
tooltip:Clear()
2150-
self:AddItemTooltip(tooltip, enchantItem(index), nil, true)
2151-
end
2152-
controls.save = new("ButtonControl", nil, {-88, 100, 80, 20}, "Enchant", function()
2153-
self:SetDisplayItem(enchantItem())
2154-
main:ClosePopup()
2155-
end)
2156-
controls.remove = new("ButtonControl", nil, {0, 100, 80, 20}, "Remove", function()
2157-
self:SetDisplayItem(enchantItem(nil, true))
2158-
main:ClosePopup()
2159-
end)
2160-
controls.close = new("ButtonControl", nil, {88, 100, 80, 20}, "Cancel", function()
2161-
main:ClosePopup()
2162-
end)
2163-
main:OpenPopup(550, 130, "Enchant Item", controls)
2164-
end
2165-
21662000
---Gets the name of the anointed node on an item
21672001
---@param item table @The item to get the anoint from
21682002
---@return string @The name of the anointed node, or nil if there is no anoint

src/Data/EnchantmentBelt.lua

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/Data/EnchantmentBody.lua

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/Data/EnchantmentBoots.lua

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/Data/EnchantmentFlask.lua

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/Data/EnchantmentGloves.lua

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/Data/EnchantmentHelmet.lua

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/Data/EnchantmentWeapon.lua

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)