Skip to content

Commit

Permalink
Code cleanup (#6820)
Browse files Browse the repository at this point in the history
* Remove unused variables

* Refactor usage of global variables

* Remove redundant code

* Simplify return
  • Loading branch information
PJacek authored Dec 5, 2023
1 parent a3317a5 commit f372dc0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Classes/CheckBoxControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Classes/DropDownControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Classes/EditControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 2 additions & 9 deletions src/Classes/SkillListControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,7 @@ 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 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"
Expand All @@ -232,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
5 changes: 1 addition & 4 deletions src/Classes/TradeQuery.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down

0 comments on commit f372dc0

Please sign in to comment.