@@ -379,54 +379,15 @@ holding Shift will put it in the second.]])
379
379
380
380
-- Section: Enchant / Anoint / Corrupt
381
381
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
383
383
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 ()
397
385
self :AnointDisplayItem (1 )
398
386
end )
399
387
self .controls .displayItemAnoint .shown = function ()
400
388
return self .displayItem and (self .displayItem .base .type == " Amulet" or self .displayItem .canBeAnointed )
401
389
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 ()
430
391
self :CorruptDisplayItem ()
431
392
end )
432
393
self .controls .displayItemCorrupt .shown = function ()
@@ -2036,133 +1997,6 @@ function ItemsTabClass:EditDisplayItemText(alsoAddItem)
2036
1997
main :OpenPopup (500 , 500 , self .displayItem and " Edit Item Text" or " Create Custom Item from Text" , controls , nil , " edit" )
2037
1998
end
2038
1999
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
-
2166
2000
--- Gets the name of the anointed node on an item
2167
2001
--- @param item table @The item to get the anoint from
2168
2002
--- @return string @The name of the anointed node , or nil if there is no anoint
0 commit comments