Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix import with discriminators #8361

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ function ImportTabClass:DownloadCharacterList()
accountName = self.controls.accountName.buf:gsub("^[%s?]+", ""):gsub("[%s?]+$", ""):gsub("%s", "+")
end
local sessionID = #self.controls.sessionInput.buf == 32 and self.controls.sessionInput.buf or (main.gameAccounts[accountName] and main.gameAccounts[accountName].sessionID)
launch:DownloadPage(realm.hostName.."character-window/get-characters?accountName="..accountName.."&realm="..realm.realmCode, function(response, errMsg)
launch:DownloadPage(realm.hostName.."character-window/get-characters?accountName="..accountName:gsub("-", "%%23"):gsub("#", "%%23").."&realm="..realm.realmCode, function(response, errMsg)
if errMsg == "Response code: 401" then
self.charImportStatus = colorCodes.NEGATIVE.."Sign-in is required."
self.charImportMode = "GETSESSIONID"
Expand Down Expand Up @@ -443,7 +443,7 @@ function ImportTabClass:DownloadCharacterList()
end
-- GGG's character API has an issue where for /get-characters the account name is not case-sensitive, but for /get-passive-skills and /get-items it is.
-- This workaround grabs the profile page and extracts the correct account name from one of the URLs.
launch:DownloadPage(realm.hostName..realm.profileURL..accountName, function(response, errMsg)
launch:DownloadPage(realm.hostName..realm.profileURL..accountName:gsub("#", "%%23"), function(response, errMsg)
if errMsg then
self.charImportStatus = colorCodes.NEGATIVE.."Error retrieving character list, try again ("..errMsg:gsub("\n"," ")..")"
self.charImportMode = "GETACCOUNTNAME"
Expand All @@ -455,6 +455,7 @@ function ImportTabClass:DownloadCharacterList()
self.charImportMode = "GETSESSIONID"
return
end
realAccountName = realAccountName:gsub("-", "#")
self.controls.accountName:SetText(realAccountName)
accountName = realAccountName
self.charImportStatus = "Character list successfully retrieved."
Expand Down Expand Up @@ -558,11 +559,11 @@ function ImportTabClass:SaveAccountHistory()
if not historyList[self.controls.accountName.buf] then
t_insert(historyList, self.controls.accountName.buf)
historyList[self.controls.accountName.buf] = true
self.controls.accountHistory:SelByValue(self.controls.accountName.buf)
table.sort(historyList, function(a,b)
return a:lower() < b:lower()
end)
self.controls.accountHistory:CheckDroppedWidth(true)
self.controls.accountHistory:SelByValue(self.controls.accountName.buf)
end
end

Expand All @@ -574,7 +575,7 @@ function ImportTabClass:DownloadPassiveTree()
local sessionID = #self.controls.sessionInput.buf == 32 and self.controls.sessionInput.buf or (main.gameAccounts[accountName] and main.gameAccounts[accountName].sessionID)
local charSelect = self.controls.charSelect
local charData = charSelect.list[charSelect.selIndex].char
launch:DownloadPage(realm.hostName.."character-window/get-passive-skills?accountName="..accountName.."&character="..charData.name.."&realm="..realm.realmCode, function(response, errMsg)
launch:DownloadPage(realm.hostName.."character-window/get-passive-skills?accountName="..accountName:gsub("#", "%%23").."&character="..charData.name.."&realm="..realm.realmCode, function(response, errMsg)
self.charImportMode = "SELECTCHAR"
if errMsg then
self.charImportStatus = colorCodes.NEGATIVE.."Error importing character data, try again ("..errMsg:gsub("\n"," ")..")"
Expand All @@ -596,7 +597,7 @@ function ImportTabClass:DownloadItems()
local sessionID = #self.controls.sessionInput.buf == 32 and self.controls.sessionInput.buf or (main.gameAccounts[accountName] and main.gameAccounts[accountName].sessionID)
local charSelect = self.controls.charSelect
local charData = charSelect.list[charSelect.selIndex].char
launch:DownloadPage(realm.hostName.."character-window/get-items?accountName="..accountName.."&character="..charData.name.."&realm="..realm.realmCode, function(response, errMsg)
launch:DownloadPage(realm.hostName.."character-window/get-items?accountName="..accountName:gsub("#", "%%23").."&character="..charData.name.."&realm="..realm.realmCode, function(response, errMsg)
self.charImportMode = "SELECTCHAR"
if errMsg then
self.charImportStatus = colorCodes.NEGATIVE.."Error importing character data, try again ("..errMsg:gsub("\n"," ")..")"
Expand Down
Loading