Skip to content

Commit 9ea3115

Browse files
committed
Add a button to import both passive tree and items at once
1 parent 9b58355 commit 9ea3115

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

src/Classes/ImportTab.lua

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function(
4545
end
4646

4747
self.controls.characterImportAnchor = new("Control", {"TOPLEFT",self.controls.sectionCharImport,"TOPLEFT"}, {6, 40, 200, 16})
48-
self.controls.sectionCharImport.height = function() return self.charImportMode == "AUTHENTICATION" and 60 or 200 end
48+
self.controls.sectionCharImport.height = function() return self.charImportMode == "AUTHENTICATION" and 60 or 240 end
4949

5050
-- Stage: Authenticate
5151
self.controls.authenticateButton = new("ButtonControl", {"TOPLEFT",self.controls.characterImportAnchor,"TOPLEFT"}, {0, 0, 200, 16}, "^7Authorize with Path of Exile", function()
@@ -96,7 +96,20 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function(
9696
return self.charImportMode == "SELECTCHAR"
9797
end
9898
self.controls.charImportHeader = new("LabelControl", {"TOPLEFT",self.controls.charSelect,"BOTTOMLEFT"}, {0, 16, 200, 16}, "Import:")
99-
self.controls.charImportTree = new("ButtonControl", {"LEFT",self.controls.charImportHeader, "RIGHT"}, {8, 0, 170, 20}, "Passive Tree and Jewels", function()
99+
self.controls.charImportFull = new("ButtonControl", {"LEFT",self.controls.charImportHeader, "RIGHT"}, {8, 0, 80, 20}, "Full Import", function()
100+
if self.build.spec:CountAllocNodes() > 0 then
101+
main:OpenConfirmPopup("Character Import", "Full import will overwrite your current passive tree and replace items/skills.", "Import", function()
102+
self:DownloadFullImport()
103+
end)
104+
else
105+
self:DownloadFullImport()
106+
end
107+
end)
108+
self.controls.charImportFullOptions = new("LabelControl", {"LEFT",self.controls.charImportFull,"RIGHT"}, {8, 0, 200, 16}, "(uses below options)")
109+
self.controls.charImportFull.enabled = function()
110+
return self.charImportMode == "SELECTCHAR"
111+
end
112+
self.controls.charImportTree = new("ButtonControl", {"LEFT",self.controls.charImportHeader, "LEFT"}, {8, 36, 200, 20}, "Only Passive Tree and Jewels", function()
100113
if self.build.spec:CountAllocNodes() > 0 then
101114
main:OpenConfirmPopup("Character Import", "Importing the passive tree will overwrite your current tree.", "Import", function()
102115
self:DownloadPassiveTree()
@@ -109,7 +122,7 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function(
109122
return self.charImportMode == "SELECTCHAR"
110123
end
111124
self.controls.charImportTreeClearJewels = new("CheckBoxControl", {"LEFT",self.controls.charImportTree,"RIGHT"}, {90, 0, 18}, "Delete jewels:", nil, "Delete all existing jewels when importing.", true)
112-
self.controls.charImportItems = new("ButtonControl", {"LEFT",self.controls.charImportTree, "LEFT"}, {0, 36, 110, 20}, "Items and Skills", function()
125+
self.controls.charImportItems = new("ButtonControl", {"LEFT",self.controls.charImportTree, "LEFT"}, {0, 24, 140, 20}, "Only Items and Skills", function()
113126
self:DownloadItems()
114127
end)
115128
self.controls.charImportItems.enabled = function()
@@ -583,6 +596,14 @@ function ImportTabClass:DownloadItems()
583596
end)
584597
end
585598

599+
function ImportTabClass:DownloadFullImport()
600+
self:DownloadCharacter(function(charData)
601+
self:ImportPassiveTreeAndJewels(charData)
602+
self:ImportItemsAndSkills(charData)
603+
self.charImportStatus = colorCodes.POSITIVE.."Full import successful."
604+
end)
605+
end
606+
586607
function ImportTabClass:ImportPassiveTreeAndJewels(charData)
587608
local charPassiveData = charData.passives
588609
self.charImportStatus = colorCodes.POSITIVE.."Passive tree and jewels successfully imported."

0 commit comments

Comments
 (0)