Skip to content

Commit e8d84c8

Browse files
committed
fix site import crash
1 parent 4baa6aa commit e8d84c8

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

src/Classes/ImportTab.lua

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,9 @@ function addAccountNameControls(self)
326326
end -- don't load the list many times
327327
self.controls.siteAccountNameGo = new("ButtonControl", { "LEFT", self.controls.siteAccountName, "RIGHT" }, { 8, 0, 60, 20 },
328328
"Start", function()
329-
self:DownloadSiteCharacterList()
330-
end)
329+
local realm = self.controls.siteAccountRealm:GetSelValue()
330+
self:DownloadSiteCharacterList(realm)
331+
end)
331332
self.controls.siteAccountNameGo.enabled = function()
332333
return self.controls.siteAccountName.buf:match("%S[#%-]%d%d%d%d$")
333334
end
@@ -391,26 +392,28 @@ function addAccountNameControls(self)
391392
{ 0, 16, 200, 16 }, "^7Import:")
392393
self.controls.siteCharImportTree = new("ButtonControl", { "LEFT", self.controls.siteCharImportHeader, "RIGHT" },
393394
{ 8, 0, 170, 20 }, "Passive Tree and Jewels", function()
394-
if self.build.spec:CountAllocNodes() > 0 then
395-
main:OpenConfirmPopup("Character Import", "Importing the passive tree will overwrite your current tree.",
396-
"Import", function()
397-
self:DownloadPassiveTree()
398-
end)
399-
else
400-
self:DownloadPassiveTree()
401-
end
402-
self:SetPredefinedBuildName()
403-
end)
395+
local realm = self.controls.siteAccountRealm:GetSelValue()
396+
if self.build.spec:CountAllocNodes() > 0 then
397+
main:OpenConfirmPopup("Character Import", "Importing the passive tree will overwrite your current tree.",
398+
"Import", function()
399+
self:DownloadPassiveTree(realm)
400+
end)
401+
else
402+
self:DownloadPassiveTree(realm)
403+
end
404+
self:SetPredefinedBuildName()
405+
end)
404406
self.controls.siteCharImportTree.enabled = function()
405407
return self.charImportMode == "SELECTCHAR"
406408
end
407409
self.controls.siteCharImportTreeClearJewels = new("CheckBoxControl", { "LEFT", self.controls.siteCharImportTree, "RIGHT" },
408410
{ 90, 0, 18 }, "Delete jewels:", nil, "Delete all existing jewels when importing.", true)
409411
self.controls.siteCharImportItems = new("ButtonControl", { "LEFT", self.controls.siteCharImportTree, "LEFT" },
410412
{ 0, 36, 110, 20 }, "Items and Skills", function()
411-
self:DownloadItems()
412-
self:SetPredefinedBuildName()
413-
end)
413+
local realm = self.controls.siteAccountRealm:GetSelValue()
414+
self:DownloadItems(realm)
415+
self:SetPredefinedBuildName()
416+
end)
414417
self.controls.siteCharImportItems.enabled = function()
415418
return self.charImportMode == "SELECTCHAR"
416419
end
@@ -754,10 +757,9 @@ function ImportTabClass:SaveAccountHistory()
754757
end
755758
end
756759

757-
function ImportTabClass:DownloadPassiveTree()
760+
function ImportTabClass:DownloadPassiveTree(realm)
758761
self.charImportMode = "IMPORTING"
759762
self.charImportStatus = "Retrieving character passive tree..."
760-
local realm = realmList[self.controls.siteAccountRealm.selIndex]
761763
local accountName = self.controls.siteAccountName.buf
762764
local charSelect = self.controls.siteCharSelect
763765
local charListData = charSelect.list[charSelect.selIndex].char
@@ -788,10 +790,9 @@ function ImportTabClass:DownloadPassiveTree()
788790
end)
789791
end
790792

791-
function ImportTabClass:DownloadItems()
793+
function ImportTabClass:DownloadItems(realm)
792794
self.charImportMode = "IMPORTING"
793795
self.charImportStatus = "Retrieving character items..."
794-
local realm = realmList[self.controls.siteAccountRealm.selIndex]
795796
local accountName = self.controls.siteAccountName.buf
796797
local charSelect = self.controls.siteCharSelect
797798
local charListData = charSelect.list[charSelect.selIndex].char
@@ -820,7 +821,7 @@ function ImportTabClass:DownloadItems()
820821
self:ImportItemsAndSkills(charData)
821822
end)
822823
end
823-
function ImportTabClass:DownloadSiteCharacterList()
824+
function ImportTabClass:DownloadSiteCharacterList(realm)
824825
function FindMatchingStandardLeague(league)
825826
-- Find a Standard league name for a given league name
826827
-- Reference https://api.pathofexile.com/league?realm=pc
@@ -840,7 +841,6 @@ function ImportTabClass:DownloadSiteCharacterList()
840841

841842
self.charImportMode = "DOWNLOADCHARLIST"
842843
self.charImportStatus = "Retrieving character list..."
843-
local realm = realmList[self.controls.siteAccountRealm.selIndex]
844844
local accountName
845845
-- Handle spaces in the account name
846846
if realm.realmCode == "pc" then

0 commit comments

Comments
 (0)