From d3aca4014031eaea77b84068544f6eccc8c65222 Mon Sep 17 00:00:00 2001 From: Regisle Date: Tue, 19 Nov 2024 16:11:35 +1030 Subject: [PATCH] add preventative measures and extra warnings --- src/Classes/ImportTab.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Classes/ImportTab.lua b/src/Classes/ImportTab.lua index e58931bcb0..71aa14f987 100644 --- a/src/Classes/ImportTab.lua +++ b/src/Classes/ImportTab.lua @@ -63,7 +63,13 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function( self:DownloadCharacterList() end) self.controls.accountNameGo.enabled = function() - return self.controls.accountName.buf:match("%S") + return self.controls.accountName.buf:match("%S[#%-(%%23)]%d%d%d%d$") + end + self.controls.accountNameGo.tooltipFunc = function(tooltip) + tooltip:Clear() + if not self.controls.accountName.buf:match("[#%-(%%23)]%d%d%d%d$") then + tooltip:AddLine(16, "^7Missing discriminator eg " .. self.controls.accountName.buf .. "#0000") + end end self.controls.accountHistory = new("DropDownControl", {"LEFT",self.controls.accountNameGo,"RIGHT"}, {8, 0, 200, 20}, historyList, function() @@ -86,10 +92,16 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function( tooltip:AddLine(16, "^7Removes account from the dropdown list") end - self.controls.accountNameUnicode = new("LabelControl", {"TOPLEFT",self.controls.accountRealm,"BOTTOMLEFT"}, {0, 16, 0, 14}, "^7Note: if the account name contains non-ASCII characters then it must be URL encoded first.") + self.controls.accountNameUnicode = new("LabelControl", {"TOPLEFT",self.controls.accountRealm,"BOTTOMLEFT"}, {0, 34, 0, 14}, "^7Note: if the account name contains non-ASCII characters then it must be URL encoded first.") self.controls.accountNameURLEncoder = new("ButtonControl", {"TOPLEFT",self.controls.accountNameUnicode,"BOTTOMLEFT"}, {0, 4, 170, 18}, "^x4040FFhttps://www.urlencoder.org/", function() OpenURL("https://www.urlencoder.org/") end) + + self.controls.accountNameMissingDiscriminator = new("LabelControl", {"BOTTOMLEFT",self.controls.accountNameUnicode,"TOPLEFT"}, {0, -4, 0, 18}, "^1Missing discriminator eg #0000") + self.controls.accountNameMissingDiscriminator.shown = function() + return not self.controls.accountName.buf:match("[#%-(%%23)]%d%d%d%d$") + end + -- Stage: input POESESSID self.controls.sessionHeader = new("LabelControl", {"TOPLEFT",self.controls.sectionCharImport,"TOPLEFT"}, {6, 40, 200, 14})