@@ -272,6 +272,18 @@ will automatically apply to the skill.]]
272272 self .controls .gemCountHeader = new (" LabelControl" , {" BOTTOMLEFT" , self .gemSlots [1 ].count , " TOPLEFT" }, {8 , - 2 , 0 , 16 }, " ^7Count:" )
273273end )
274274
275+ function SkillsTabClass :GetCorruptIndex (gemInstance )
276+ if gemInstance .corruptLevel == 1 then
277+ return 2 -- +1 to Gem Level
278+ elseif gemInstance .corruptLevel == - 1 then
279+ return 4 -- -1 to Gem Level
280+ elseif gemInstance .corrupted then
281+ return 3 -- Corrupted
282+ else
283+ return 1 -- Not Corrupted
284+ end
285+ end
286+
275287function SkillsTabClass :LoadSkill (node , skillSetId )
276288 if node .elem ~= " Skill" then
277289 return
@@ -651,17 +663,7 @@ function SkillsTabClass:CreateGemSlot(index)
651663 self .gemSlots [index2 ].enableGlobal1 .state = gemInstance .enableGlobal1
652664 self .gemSlots [index2 ].enableGlobal2 .state = gemInstance .enableGlobal2
653665 self .gemSlots [index2 ].count :SetText (gemInstance .count or 1 )
654- local selIndex
655- if gemInstance .corruptLevel == 1 then
656- selIndex = 2 -- +1 to Gem Level
657- elseif gemInstance .corruptLevel == - 1 then
658- selIndex = 4 -- -1 to Gem Level
659- elseif gemInstance .corrupted then
660- selIndex = 3 -- Corrupted
661- else
662- selIndex = 1 -- Not Corrupted
663- end
664- self .gemSlots [index2 ].corruptLevel .selIndex = selIndex
666+ self .gemSlots [index2 ].corruptLevel .selIndex = self :GetCorruptIndex (gemInstance )
665667 end
666668 self :AddUndoState ()
667669 self .build .buildFlag = true
@@ -708,17 +710,7 @@ function SkillsTabClass:CreateGemSlot(index)
708710 self .displayGroup .gemList [index ] = gemInstance
709711 slot .level :SetText (gemInstance .level )
710712 slot .quality :SetText (gemInstance .quality )
711- local selIndex
712- if gemInstance .corruptLevel == 1 then
713- selIndex = 2 -- +1 to Gem Level
714- elseif gemInstance .corruptLevel == - 1 then
715- selIndex = 4 -- -1 to Gem Level
716- elseif gemInstance .corrupted and gemInstance .corruptLevel == 0 then
717- selIndex = 3 -- Corrupted
718- else
719- selIndex = 1 -- Not Corrupted
720- end
721- slot .corruptLevel .selIndex = selIndex
713+ slot .corruptLevel .selIndex = self :GetCorruptIndex (gemInstance )
722714 slot .enabled .state = true
723715 slot .enableGlobal1 .state = true
724716 slot .enableGlobal2 .state = true
@@ -756,17 +748,7 @@ function SkillsTabClass:CreateGemSlot(index)
756748 slot .enabled .state = true
757749 slot .enableGlobal1 .state = true
758750 slot .count :SetText (gemInstance .count )
759- local selIndex
760- if gemInstance .corruptLevel == 1 then
761- selIndex = 2 -- +1 to Gem Level
762- elseif gemInstance .corruptLevel == - 1 then
763- selIndex = 4 -- -1 to Gem Level
764- elseif gemInstance .corrupted and gemInstance .corruptLevel == 0 then
765- selIndex = 3 -- Corrupted
766- else
767- selIndex = 1 -- Not Corrupted
768- end
769- slot .corruptLevel = selIndex
751+ slot .corruptLevel = self :GetCorruptIndex (gemInstance )
770752 end
771753 gemInstance .level = tonumber (buf ) or self .displayGroup .gemList [index ].naturalMaxLevel or self :ProcessGemLevel (gemInstance .gemData ) or 20
772754 self :ProcessSocketGroup (self .displayGroup )
@@ -789,17 +771,7 @@ function SkillsTabClass:CreateGemSlot(index)
789771 slot .enabled .state = true
790772 slot .enableGlobal1 .state = true
791773 slot .count :SetText (gemInstance .count )
792- local selIndex
793- if gemInstance .corruptLevel == 1 then
794- selIndex = 2 -- +1 to Gem Level
795- elseif gemInstance .corruptLevel == - 1 then
796- selIndex = 4 -- -1 to Gem Level
797- elseif gemInstance .corrupted and gemInstance .corruptLevel == 0 then
798- selIndex = 3 -- Corrupted
799- else
800- selIndex = 1 -- Not Corrupted
801- end
802- slot .corruptLevel = selIndex
774+ slot .corruptLevel = self :GetCorruptIndex (gemInstance )
803775 end
804776 gemInstance .quality = tonumber (buf ) or self .defaultGemQuality or 0
805777 self :ProcessSocketGroup (self .displayGroup )
@@ -894,17 +866,7 @@ function SkillsTabClass:CreateGemSlot(index)
894866 slot .level :SetText (gemInstance .level )
895867 slot .quality :SetText (gemInstance .quality )
896868 slot .count :SetText (gemInstance .count )
897- local selIndex
898- if gemInstance .corruptLevel == 1 then
899- selIndex = 2 -- +1 to Gem Level
900- elseif gemInstance .corruptLevel == - 1 then
901- selIndex = 4 -- -1 to Gem Level
902- elseif gemInstance .corrupted and gemInstance .corruptLevel == 0 then
903- selIndex = 3 -- Corrupted
904- else
905- selIndex = 1 -- Not Corrupted
906- end
907- slot .corruptLevel = selIndex
869+ slot .corruptLevel = self :GetCorruptIndex (gemInstance )
908870 end
909871 if not gemInstance .gemData .vaalGem then
910872 slot .enableGlobal1 .state = true
@@ -945,17 +907,7 @@ function SkillsTabClass:CreateGemSlot(index)
945907 slot .quality :SetText (gemInstance .quality )
946908 slot .enabled .state = true
947909 slot .enableGlobal1 .state = true
948- local selIndex
949- if gemInstance .corruptLevel == 1 then
950- selIndex = 2 -- +1 to Gem Level
951- elseif gemInstance .corruptLevel == - 1 then
952- selIndex = 4 -- -1 to Gem Level
953- elseif gemInstance .corrupted and gemInstance .corruptLevel == 0 then
954- selIndex = 3 -- Corrupted
955- else
956- selIndex = 1 -- Not Corrupted
957- end
958- slot .corruptLevel = selIndex
910+ slot .corruptLevel = self :GetCorruptIndex (gemInstance )
959911 end
960912 gemInstance .count = tonumber (buf ) or 1
961913 slot .count .buf = tostring (gemInstance .count )
@@ -1258,17 +1210,7 @@ function SkillsTabClass:SetDisplayGroup(socketGroup)
12581210 self .gemSlots [index ].enableGlobal1 .state = gemInstance .enableGlobal1
12591211 self .gemSlots [index ].enableGlobal2 .state = gemInstance .enableGlobal2
12601212 self .gemSlots [index ].count :SetText (gemInstance .count or 1 )
1261- local selIndex = 1
1262- if gemInstance .corruptLevel == 1 then
1263- selIndex = 2 -- +1 to Gem Level
1264- elseif gemInstance .corruptLevel == - 1 then
1265- selIndex = 4 -- -1 to Gem Level
1266- elseif gemInstance .corrupted and gemInstance .corruptLevel == 0 then
1267- selIndex = 3 -- Corrupted
1268- else
1269- selIndex = 1 -- Not Corrupted
1270- end
1271- self .gemSlots [index ].corruptLevel .selIndex = selIndex
1213+ self .gemSlots [index ].corruptLevel .selIndex = self :GetCorruptIndex (gemInstance )
12721214 end
12731215 end
12741216end
0 commit comments