From cfbd7a52fdf239817b1b9e78b315258cf37ac2aa Mon Sep 17 00:00:00 2001 From: PJacek Date: Sun, 15 Oct 2023 20:41:07 +0200 Subject: [PATCH 1/4] Remove unused variables --- src/Classes/SkillListControl.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Classes/SkillListControl.lua b/src/Classes/SkillListControl.lua index 6fce9da81b..f8710997fc 100644 --- a/src/Classes/SkillListControl.lua +++ b/src/Classes/SkillListControl.lua @@ -208,9 +208,6 @@ end function SkillListClass:GetRowIcon(column, index, socketGroup) if column == 1 then local slot = socketGroup.slot or nil - local color = "^7" - local currentMainSkill = self.skillsTab.build.mainSocketGroup == index - local disabled = not socketGroup.enabled or not socketGroup.slotEnabled local itemsTab = self.skillsTab.build.itemsTab local weapon1Sel = itemsTab.activeItemSet["Weapon 1"].selItemId or 0 local weapon1Type = itemsTab.items[weapon1Sel] and itemsTab.items[weapon1Sel].base.type or "None" From 0d72821431a58d83f754425ace4525558e8de61d Mon Sep 17 00:00:00 2001 From: PJacek Date: Sun, 15 Oct 2023 20:47:55 +0200 Subject: [PATCH 2/4] Refactor usage of global variables --- src/Classes/CheckBoxControl.lua | 2 +- src/Classes/DropDownControl.lua | 2 +- src/Classes/EditControl.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Classes/CheckBoxControl.lua b/src/Classes/CheckBoxControl.lua index 97ae93c440..6829818886 100644 --- a/src/Classes/CheckBoxControl.lua +++ b/src/Classes/CheckBoxControl.lua @@ -39,7 +39,7 @@ function CheckBoxClass:Draw(viewPort, noTooltip) elseif mOver then SetDrawColor(1, 1, 1) elseif self.borderFunc then - r, g, b = self.borderFunc() + local r, g, b = self.borderFunc() SetDrawColor(r, g, b) else SetDrawColor(0.5, 0.5, 0.5) diff --git a/src/Classes/DropDownControl.lua b/src/Classes/DropDownControl.lua index 39aaf303fb..0e39a6f53f 100644 --- a/src/Classes/DropDownControl.lua +++ b/src/Classes/DropDownControl.lua @@ -236,7 +236,7 @@ function DropDownClass:Draw(viewPort, noTooltip) elseif mOver or self.dropped then SetDrawColor(1, 1, 1) elseif self.borderFunc then - r, g, b = self.borderFunc() + local r, g, b = self.borderFunc() SetDrawColor(r, g, b) else SetDrawColor(0.5, 0.5, 0.5) diff --git a/src/Classes/EditControl.lua b/src/Classes/EditControl.lua index 647e54ddab..e35c122212 100644 --- a/src/Classes/EditControl.lua +++ b/src/Classes/EditControl.lua @@ -247,7 +247,7 @@ function EditClass:Draw(viewPort, noTooltip) elseif mOver then SetDrawColor(1, 1, 1) elseif self.borderFunc then - r, g, b = self.borderFunc() + local r, g, b = self.borderFunc() SetDrawColor(r, g, b) else SetDrawColor(0.5, 0.5, 0.5) From 19ae2cf5f5425e3674b00f7e5d03841be76f5f75 Mon Sep 17 00:00:00 2001 From: PJacek Date: Sun, 15 Oct 2023 20:50:06 +0200 Subject: [PATCH 3/4] Remove redundant code --- src/Classes/TradeQuery.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Classes/TradeQuery.lua b/src/Classes/TradeQuery.lua index 121418ab99..aa8477ff50 100644 --- a/src/Classes/TradeQuery.lua +++ b/src/Classes/TradeQuery.lua @@ -102,12 +102,9 @@ function TradeQueryClass:PullLeagueList() self:SetNotice(self.controls.pbNotice, "Failed to Get PoE League List response") return end - table.sort(json_data, function(a, b) + table.sort(json_data, function(a, b) if a.endAt == nil then return false end if b.endAt == nil then return true end - if a.endAt == b.endAt then - return #a.id < #b.id - end return #a.id < #b.id end) self.itemsTab.leagueDropList = {} From 4f88d6a2a4cc319f1e37693a08b26872ea9949bc Mon Sep 17 00:00:00 2001 From: PJacek Date: Mon, 16 Oct 2023 00:17:59 +0200 Subject: [PATCH 4/4] Simplify return --- src/Classes/SkillListControl.lua | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Classes/SkillListControl.lua b/src/Classes/SkillListControl.lua index f8710997fc..9143b072f3 100644 --- a/src/Classes/SkillListControl.lua +++ b/src/Classes/SkillListControl.lua @@ -207,7 +207,7 @@ end function SkillListClass:GetRowIcon(column, index, socketGroup) if column == 1 then - local slot = socketGroup.slot or nil + local slot = socketGroup.slot local itemsTab = self.skillsTab.build.itemsTab local weapon1Sel = itemsTab.activeItemSet["Weapon 1"].selItemId or 0 local weapon1Type = itemsTab.items[weapon1Sel] and itemsTab.items[weapon1Sel].base.type or "None" @@ -229,10 +229,6 @@ function SkillListClass:GetRowIcon(column, index, socketGroup) if slot == "Weapon 2 Swap" and (weapon2SwapType == "Quiver" or weapon2SwapType == "Shield") then slot = weapon2SwapType.." Swap" end - if slot_map[slot] then - return slot_map[slot].icon - else - return nil - end + return slot_map[slot] and slot_map[slot].icon end end