From d6292879a3aeb5635e1cd86e142c650c59182104 Mon Sep 17 00:00:00 2001 From: Hiney Date: Tue, 10 Jan 2023 09:46:40 +1100 Subject: [PATCH 1/3] Set the league combo to the last used if possible, used for previously imported characters --- src/Classes/ImportTab.lua | 53 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/src/Classes/ImportTab.lua b/src/Classes/ImportTab.lua index ad66b43e58..b29b386dde 100644 --- a/src/Classes/ImportTab.lua +++ b/src/Classes/ImportTab.lua @@ -336,6 +336,8 @@ end) function ImportTabClass:Load(xml, fileName) self.lastRealm = xml.attrib.lastRealm self.controls.accountRealm:SelByValue( self.lastRealm or main.lastRealm or "PC", "id" ) + self.lastLeague = xml.attrib.lastLeague + self.controls.charSelectLeague:SelByValue( self.lastLeague or "Standard", "id" ) self.lastAccountHash = xml.attrib.lastAccountHash if self.lastAccountHash then for accountName in pairs(main.gameAccounts) do @@ -350,6 +352,7 @@ end function ImportTabClass:Save(xml) xml.attrib = { lastRealm = self.lastRealm, + lastLeague = self.lastLeague, lastAccountHash = self.lastAccountHash, lastCharacterHash = self.lastCharacterHash, } @@ -369,6 +372,23 @@ function ImportTabClass:Draw(viewPort, inputEvents) end function ImportTabClass:DownloadCharacterList() + function FindMatchingStandardLeague(league) + -- Find a Standard league name for a given league name + -- Reference https://api.pathofexile.com/league?realm=pc + if string.find(league, "Hardcore") then + return "Hardcore" + elseif string.find(league, "HC SSF") then + -- includes Ruthless "HC SSF R " + return "SSF Hardcore" + elseif string.find(league, "SSF") then + -- Any non HardCore SSF's - includes Ruthless "SSF R " + return "SSF Standard" + else + -- normal league and ruthless league (Sanctum, Ruthless Sanctum) + return "Standard" + end + end + self.charImportMode = "DOWNLOADCHARLIST" self.charImportStatus = "Retrieving character list..." -- Trim Trailing/Leading spaces @@ -436,6 +456,7 @@ function ImportTabClass:DownloadCharacterList() end end table.sort(leagueList) + charSelectLeague = self.controls.charSelectLeague wipeTable(self.controls.charSelectLeague.list) for _, league in ipairs(leagueList) do t_insert(self.controls.charSelectLeague.list, { @@ -446,11 +467,28 @@ function ImportTabClass:DownloadCharacterList() t_insert(self.controls.charSelectLeague.list, { label = "All", }) - if self.controls.charSelectLeague.selIndex > #self.controls.charSelectLeague.list then - self.controls.charSelectLeague.selIndex = 1 + -- set the league combo to the last used if possible, used for previously imported characters + if self.lastLeague then + charSelectLeague:SelByValue( self.lastLeague, "league" ) + -- check that it worked + if charSelectLeague:GetSelValue("league") ~= self.lastLeague then + -- League maybe over, Character will be in standard + standardLeagueName = FindMatchingStandardLeague(self.lastLeague) + self.controls.charSelectLeague:SelByValue( standardLeagueName, "league" ) + if charSelectLeague:GetSelValue("league") ~= standardLeagueName then + -- give up and select the first entry. Ruthless mode may not have Standard equivalents + charSelectLeague.selIndex = 1 + else + self.lastLeague = standardLeagueName + end + end + else + if self.controls.charSelectLeague.selIndex > #self.controls.charSelectLeague.list then + self.controls.charSelectLeague.selIndex = 1 + end end self.lastCharList = charList - self:BuildCharacterList(self.controls.charSelectLeague:GetSelValue("league")) + self:BuildCharacterList(charSelectLeague:GetSelValue("league")) -- We only get here if the accountname was correct, found, and not private, so add it to the account history. self:SaveAccountHistory() @@ -512,6 +550,9 @@ function ImportTabClass:DownloadPassiveTree() return end self.lastCharacterHash = common.sha1(charData.name) + if not self.lastLeague then + self.lastLeague = charSelectLeague:GetSelValue("league") + end self:ImportPassiveTreeAndJewels(response.body, charData) end, sessionID and { header = "Cookie: POESESSID=" .. sessionID }) end @@ -534,6 +575,9 @@ function ImportTabClass:DownloadItems() return end self.lastCharacterHash = common.sha1(charData.name) + if not self.lastLeague then + self.lastLeague = charSelectLeague:GetSelValue("league") + end self:ImportItemsAndSkills(response.body) end, sessionID and { header = "Cookie: POESESSID=" .. sessionID }) end @@ -582,6 +626,9 @@ function ImportTabClass:ImportPassiveTreeAndJewels(json, charData) self.build.itemsTab:AddUndoState() self.build.spec:ImportFromNodeList(charData.classId, charData.ascendancyClass, charPassiveData.hashes, charPassiveData.mastery_effects or {}) self.build.spec:AddUndoState() + if not self.lastLeague then + self.lastLeague = charSelectLeague:GetSelValue("league") + end self.build.characterLevel = charData.level self.build.controls.characterLevel:SetText(charData.level) self.build.buildFlag = true From 50cb1b5478387de7aff77249bcb8271662280a42 Mon Sep 17 00:00:00 2001 From: Wires77 Date: Wed, 15 Apr 2026 00:29:08 -0500 Subject: [PATCH 2/3] Fix spacing --- src/Classes/ImportTab.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Classes/ImportTab.lua b/src/Classes/ImportTab.lua index 7277d35146..acec52e7ee 100644 --- a/src/Classes/ImportTab.lua +++ b/src/Classes/ImportTab.lua @@ -37,8 +37,8 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function( self.controls.accountNameHeader.shown = function() return self.charImportMode == "GETACCOUNTNAME" end - self.controls.accountRealm = new("DropDownControl", {"TOPLEFT",self.controls.accountNameHeader,"BOTTOMLEFT"}, {0, 4, 60, 20}, realmList ) - self.controls.accountRealm:SelByValue( main.lastRealm or "PC", "id" ) + self.controls.accountRealm = new("DropDownControl", {"TOPLEFT",self.controls.accountNameHeader,"BOTTOMLEFT"}, {0, 4, 60, 20}, realmList) + self.controls.accountRealm:SelByValue(main.lastRealm or "PC", "id") self.controls.accountName = new("EditControl", {"LEFT",self.controls.accountRealm,"RIGHT"}, {8, 0, 200, 20}, main.lastAccountName or "", nil, "%c", nil, nil, nil, nil, true) self.controls.accountName.pasteFilter = function(text) return text:gsub(".", function(c) @@ -369,9 +369,9 @@ end) function ImportTabClass:Load(xml, fileName) self.lastRealm = xml.attrib.lastRealm - self.controls.accountRealm:SelByValue( self.lastRealm or main.lastRealm or "PC", "id" ) + self.controls.accountRealm:SelByValue(self.lastRealm or main.lastRealm or "PC", "id") self.lastLeague = xml.attrib.lastLeague - self.controls.charSelectLeague:SelByValue( self.lastLeague or "Standard", "id" ) + self.controls.charSelectLeague:SelByValue(self.lastLeague or "Standard", "id") self.lastAccountHash = xml.attrib.lastAccountHash self.importLink = xml.attrib.importLink self.controls.enablePartyExportBuffs.state = xml.attrib.exportParty == "true" @@ -521,12 +521,12 @@ function ImportTabClass:DownloadCharacterList() }) -- set the league combo to the last used if possible, used for previously imported characters if self.lastLeague then - charSelectLeague:SelByValue( self.lastLeague, "league" ) + charSelectLeague:SelByValue(self.lastLeague, "league") -- check that it worked if charSelectLeague:GetSelValue("league") ~= self.lastLeague then -- League maybe over, Character will be in standard standardLeagueName = FindMatchingStandardLeague(self.lastLeague) - self.controls.charSelectLeague:SelByValue( standardLeagueName, "league" ) + self.controls.charSelectLeague:SelByValue(standardLeagueName, "league") if charSelectLeague:GetSelValue("league") ~= standardLeagueName then -- give up and select the first entry. Ruthless mode may not have Standard equivalents charSelectLeague.selIndex = 1 From 5949b26e67ea00c3e0f9e3f421be1c80759e238d Mon Sep 17 00:00:00 2001 From: Wires77 Date: Wed, 15 Apr 2026 00:33:05 -0500 Subject: [PATCH 3/3] Update GetSelValue to GetSelValueByKey --- src/Classes/ImportTab.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Classes/ImportTab.lua b/src/Classes/ImportTab.lua index acec52e7ee..2ebd9a6048 100644 --- a/src/Classes/ImportTab.lua +++ b/src/Classes/ImportTab.lua @@ -523,11 +523,11 @@ function ImportTabClass:DownloadCharacterList() if self.lastLeague then charSelectLeague:SelByValue(self.lastLeague, "league") -- check that it worked - if charSelectLeague:GetSelValue("league") ~= self.lastLeague then + if charSelectLeague:GetSelValueByKey("league") ~= self.lastLeague then -- League maybe over, Character will be in standard standardLeagueName = FindMatchingStandardLeague(self.lastLeague) self.controls.charSelectLeague:SelByValue(standardLeagueName, "league") - if charSelectLeague:GetSelValue("league") ~= standardLeagueName then + if charSelectLeague:GetSelValueByKey("league") ~= standardLeagueName then -- give up and select the first entry. Ruthless mode may not have Standard equivalents charSelectLeague.selIndex = 1 else @@ -645,7 +645,7 @@ function ImportTabClass:DownloadPassiveTree() end self.lastCharacterHash = common.sha1(charData.name) if not self.lastLeague then - self.lastLeague = charSelectLeague:GetSelValue("league") + self.lastLeague = charSelectLeague:GetSelValueByKey("league") end self:ImportPassiveTreeAndJewels(response.body, charData) end, sessionID and { header = "Cookie: POESESSID=" .. sessionID }) @@ -670,7 +670,7 @@ function ImportTabClass:DownloadItems() end self.lastCharacterHash = common.sha1(charData.name) if not self.lastLeague then - self.lastLeague = charSelectLeague:GetSelValue("league") + self.lastLeague = charSelectLeague:GetSelValueByKey("league") end self:ImportItemsAndSkills(response.body) end, sessionID and { header = "Cookie: POESESSID=" .. sessionID }) @@ -756,7 +756,7 @@ function ImportTabClass:ImportPassiveTreeAndJewels(json, charData) self.build.spec:BuildClusterJewelGraphs() self.build.spec:AddUndoState() if not self.lastLeague then - self.lastLeague = charSelectLeague:GetSelValue("league") + self.lastLeague = charSelectLeague:GetSelValueByKey("league") end self.build.characterLevel = charData.level self.build.characterLevelAutoMode = false