@@ -75,8 +75,8 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function(
7575 self .controls .accountNameHeader .shown = function ()
7676 return self .charImportMode == " GETACCOUNTNAME"
7777 end
78- self .controls .accountRealm = new (" DropDownControl" , {" TOPLEFT" ,self .controls .accountNameHeader ," BOTTOMLEFT" }, {0 , 4 , 60 , 20 }, realmList )
79- self .controls .accountRealm :SelByValue ( main .lastRealm or " PC" , " id" )
78+ self .controls .accountRealm = new (" DropDownControl" , {" TOPLEFT" ,self .controls .accountNameHeader ," BOTTOMLEFT" }, {0 , 4 , 60 , 20 }, realmList )
79+ self .controls .accountRealm :SelByValue (main .lastRealm or " PC" , " id" )
8080
8181 self .controls .accountNameGo = new (" ButtonControl" , {" LEFT" ,self .controls .accountNameHeader ," RIGHT" }, {8 , 0 , 60 , 20 }, " Start" , function ()
8282 self :DownloadCharacterList ()
357357
358358function ImportTabClass :Load (xml , fileName )
359359 self .lastRealm = xml .attrib .lastRealm
360- self .controls .accountRealm :SelByValue ( self .lastRealm or main .lastRealm or " PC" , " id" )
360+ self .controls .accountRealm :SelByValue (self .lastRealm or main .lastRealm or " PC" , " id" )
361+ self .lastLeague = xml .attrib .lastLeague
362+ self .controls .charSelectLeague :SelByValue (self .lastLeague or " Standard" , " id" )
361363 self .lastAccountHash = xml .attrib .lastAccountHash
362364 self .importLink = xml .attrib .importLink
363365 self .controls .enablePartyExportBuffs .state = xml .attrib .exportParty == " true"
375377function ImportTabClass :Save (xml )
376378 xml .attrib = {
377379 lastRealm = self .lastRealm ,
380+ lastLeague = self .lastLeague ,
378381 lastAccountHash = self .lastAccountHash ,
379382 lastCharacterHash = self .lastCharacterHash ,
380383 exportParty = tostring (self .controls .enablePartyExportBuffs .state ),
@@ -402,6 +405,23 @@ function ImportTabClass:Draw(viewPort, inputEvents)
402405end
403406
404407function ImportTabClass :DownloadCharacterList ()
408+ function FindMatchingStandardLeague (league )
409+ -- Find a Standard league name for a given league name
410+ -- Reference https://api.pathofexile.com/league?realm=pc
411+ if string.find (league , " Hardcore" ) then
412+ return " Hardcore"
413+ elseif string.find (league , " HC SSF" ) then
414+ -- includes Ruthless "HC SSF R "
415+ return " SSF Hardcore"
416+ elseif string.find (league , " SSF" ) then
417+ -- Any non HardCore SSF's - includes Ruthless "SSF R "
418+ return " SSF Standard"
419+ else
420+ -- normal league and ruthless league (Sanctum, Ruthless Sanctum)
421+ return " Standard"
422+ end
423+ end
424+
405425 self .charImportMode = " DOWNLOADCHARLIST"
406426 self .charImportStatus = " Retrieving character list..."
407427 local realm = realmList [self .controls .accountRealm .selIndex ]
@@ -463,6 +483,7 @@ function ImportTabClass:DownloadCharacterList()
463483 end
464484 end
465485 table.sort (leagueList )
486+ charSelectLeague = self .controls .charSelectLeague
466487 wipeTable (self .controls .charSelectLeague .list )
467488 for _ , league in ipairs (leagueList ) do
468489 t_insert (self .controls .charSelectLeague .list , {
@@ -473,8 +494,25 @@ function ImportTabClass:DownloadCharacterList()
473494 t_insert (self .controls .charSelectLeague .list , {
474495 label = " All" ,
475496 })
476- if self .controls .charSelectLeague .selIndex > # self .controls .charSelectLeague .list then
477- self .controls .charSelectLeague .selIndex = 1
497+ -- set the league combo to the last used if possible, used for previously imported characters
498+ if self .lastLeague then
499+ charSelectLeague :SelByValue (self .lastLeague , " league" )
500+ -- check that it worked
501+ if charSelectLeague :GetSelValueByKey (" league" ) ~= self .lastLeague then
502+ -- League maybe over, Character will be in standard
503+ local standardLeagueName = FindMatchingStandardLeague (self .lastLeague )
504+ self .controls .charSelectLeague :SelByValue (standardLeagueName , " league" )
505+ if charSelectLeague :GetSelValueByKey (" league" ) ~= standardLeagueName then
506+ -- give up and select the first entry. Ruthless mode may not have Standard equivalents
507+ charSelectLeague .selIndex = 1
508+ else
509+ self .lastLeague = standardLeagueName
510+ end
511+ end
512+ else
513+ if self .controls .charSelectLeague .selIndex > # self .controls .charSelectLeague .list then
514+ self .controls .charSelectLeague .selIndex = 1
515+ end
478516 end
479517 self .lastCharList = charList
480518 self :BuildCharacterList (self .controls .charSelectLeague :GetSelValueByKey (" league" ))
@@ -553,6 +591,9 @@ function ImportTabClass:DownloadCharacter(callback)
553591 return
554592 end
555593 self .lastCharacterHash = common .sha1 (charData .name )
594+ if not self .lastLeague then
595+ self .lastLeague = charSelectLeague :GetSelValueByKey (" league" )
596+ end
556597 -- local out = io.open("get-passive-skills.json", "w")
557598 -- out:write(json)
558599 -- out:close()
@@ -713,6 +754,9 @@ function ImportTabClass:ImportPassiveTreeAndJewels(charData)
713754
714755 self .build .spec :AddUndoState ()
715756 self :ImportQuestRewardConfig (charPassiveData .quest_stats )
757+ if not self .lastLeague then
758+ self .lastLeague = charSelectLeague :GetSelValueByKey (" league" )
759+ end
716760 self .build .characterLevel = charData .level
717761 self .build .characterLevelAutoMode = false
718762 self .build .configTab :UpdateLevel ()
0 commit comments