diff --git a/Fallback.exe b/Fallback.exe index f41a36cb..ca242099 100644 Binary files a/Fallback.exe and b/Fallback.exe differ diff --git a/lib/PoEScripts_CheckCorrectClientLanguage.ahk b/lib/PoEScripts_CheckCorrectClientLanguage.ahk new file mode 100644 index 00000000..14d5e076 --- /dev/null +++ b/lib/PoEScripts_CheckCorrectClientLanguage.ahk @@ -0,0 +1,54 @@ +PoEScripts_CheckCorrectClientLanguage() { + iniPath := A_MyDocuments . "\My Games\Path of Exile\" + configs := [] + productionIni := iniPath . "production_Config.ini" + betaIni := iniPath . "beta_Config.ini" + + configs.push(productionIni) + configs.push(betaIni) + If (not FileExist(productionIni) and not FileExist(betaIni)) { + Loop %iniPath%\*.ini + { + configs.push(iniPath . A_LoopFileName) + } + } + + wrongLanguage := false + readFile := "" + For key, val in configs { + IniRead, language, %val%, LANGUAGE, language + If (language != "ERROR") { + If (language != "en") { + wrongLanguage := true + } + RegExMatch(val, "i)([^\\]+)\.[^\\]+$", readFile) + Break + } + } + + If (wrongLanguage) { + msg := "It seems that you aren't using 'English' as your game clients language, according to the file '" readFile "'." "`n`n" + msg .= "As long as GGG doesn't add a way to get the items data in english when using different game clients, this script won't work with those languages." "`n`n" + msg .= "Please change your language or click 'continue' if you want to start the script anyway." + + MsgBox, 0x1012, Wrong PoE Game Client Language, % msg + + IfMsgBox, Ignore + { + Return 1 + } + IfMsgBox, Retry + { + PoEScripts_CheckCorrectClientLanguage() + } + IfMsgBox, Cancel + { + Return 0 + } + IfMsgBox, Abort + { + Return 0 + } + } + Return 1 +} \ No newline at end of file diff --git a/lib/PoEScripts_CheckFolderWriteAccess.ahk b/lib/PoEScripts_CheckFolderWriteAccess.ahk index 5542949b..b5488316 100644 --- a/lib/PoEScripts_CheckFolderWriteAccess.ahk +++ b/lib/PoEScripts_CheckFolderWriteAccess.ahk @@ -1,4 +1,4 @@ -PoE_Scripts_CheckFolderWriteAccess(Folder, critical = true) { +PoEScripts_CheckFolderWriteAccess(Folder, critical = true) { access := FolderWriteAccess(Folder) msg := "The script is not able to write any file to " Folder ".`nYour user may not have the necessary permissions. " diff --git a/lib/PoEScripts_Download.ahk b/lib/PoEScripts_Download.ahk index 3f6af134..9bd92a18 100644 --- a/lib/PoEScripts_Download.ahk +++ b/lib/PoEScripts_Download.ahk @@ -72,9 +72,14 @@ If (StrLen(ioData)) { commandData .= "--data """ ioData """ " } - - commandData .= "--max-time 90 " - commandHdr .= "--max-time 90 " + + If (binaryDL) { + commandData .= "--connect-timeout 30 " + commandData .= "--connect-timeout 30 " + } Else { + commandData .= "--max-time 30 " + commandHdr .= "--max-time 30 " + } ; get data html := StdOutStream(curl """" url """" commandData) diff --git a/resources/Updates_Trade.txt b/resources/Updates_Trade.txt index e25f34e5..71e882a1 100644 --- a/resources/Updates_Trade.txt +++ b/resources/Updates_Trade.txt @@ -1,5 +1,11 @@ The following is a list of what has been updated, starting with 1.1.0 +2.5.7 +================================================================================================ +Added client language check since ItemInfo/TradeMacro only work with the english client. +Fixed the changed poe.ninja API url. +Improved cURL timeouts and StartupLog.txt. + 2.5.6 ================================================================================================ Changed the currency search tooltip to show 4 decimal places. diff --git a/resources/VersionTrade.txt b/resources/VersionTrade.txt index 3e6d9e01..9ee37ddf 100644 --- a/resources/VersionTrade.txt +++ b/resources/VersionTrade.txt @@ -1,2 +1,2 @@ -TradeReleaseVersion := "v2.5.6" +TradeReleaseVersion := "v2.5.7" TradeAHKVersionRequired := "1.1.26.00" diff --git a/resources/ahk/Merge_ItemInfo.ahk b/resources/ahk/Merge_ItemInfo.ahk index ea76cd8f..b5180243 100644 --- a/resources/ahk/Merge_ItemInfo.ahk +++ b/resources/ahk/Merge_ItemInfo.ahk @@ -5,6 +5,7 @@ ; #################################################################################################### #Include, %A_ScriptDir%\..\..\lib\PoEScripts_CheckFolderWriteAccess.ahk #Include, %A_ScriptDir%\..\..\lib\PoEScripts_CompareUserFolderWithScriptFolder.ahk +#Include, %A_ScriptDir%\..\..\lib\PoEScripts_CheckCorrectClientLanguage.ahk #Include, %A_ScriptDir%\..\..\lib\PoEScripts_CreateTempFolder.ahk #Include, %A_ScriptDir%\..\..\lib\PoEScripts_HandleUserSettings.ahk @@ -23,6 +24,9 @@ projectName := "PoE-ItemInfo" PoE_Scripts_CheckFolderWriteAccess(A_MyDocuments . "\" . projectName) PoE_Scripts_CheckFolderWriteAccess(scriptDir) +If (not PoEScripts_CheckCorrectClientLanguage()) { + ExitApp +} If (!PoEScripts_CreateTempFolder(scriptDir, projectName)) { ExitApp } diff --git a/resources/ahk/Merge_TradeMacro.ahk b/resources/ahk/Merge_TradeMacro.ahk index ca724997..56017952 100644 --- a/resources/ahk/Merge_TradeMacro.ahk +++ b/resources/ahk/Merge_TradeMacro.ahk @@ -5,6 +5,7 @@ ; ##################################################################################################################### #Include, %A_ScriptDir%\..\..\lib\PoEScripts_CheckFolderWriteAccess.ahk #Include, %A_ScriptDir%\..\..\lib\PoEScripts_CompareUserFolderWithScriptFolder.ahk +#Include, %A_ScriptDir%\..\..\lib\PoEScripts_CheckCorrectClientLanguage.ahk #Include, %A_ScriptDir%\..\..\lib\PoEScripts_CreateTempFolder.ahk #Include, %A_ScriptDir%\..\..\lib\PoEScripts_HandleUserSettings.ahk @@ -38,9 +39,12 @@ projectName := "PoE-TradeMacro" Check some folder permissions */ -PoE_Scripts_CheckFolderWriteAccess(A_MyDocuments . "\" . projectName) -PoE_Scripts_CheckFolderWriteAccess(scriptDir) +PoEScripts_CheckFolderWriteAccess(A_MyDocuments . "\" . projectName) +PoEScripts_CheckFolderWriteAccess(scriptDir) +If (not PoEScripts_CheckCorrectClientLanguage()) { + ExitApp +} If (!PoEScripts_CreateTempFolder(scriptDir, projectName)) { ExitApp } diff --git a/resources/ahk/POE-ItemInfo.ahk b/resources/ahk/POE-ItemInfo.ahk index dec8f53a..5eb57ab4 100644 --- a/resources/ahk/POE-ItemInfo.ahk +++ b/resources/ahk/POE-ItemInfo.ahk @@ -10544,7 +10544,7 @@ FetchCurrencyData: Loop, % currencyLeagues.Length() { currencyLeague := currencyLeagues[A_Index] - url := "http://poeninja.azureedge.net/api/Data/GetCurrencyOverview?league=" . currencyLeague + url := "http://poe.ninja/api/Data/GetCurrencyOverview?league=" . currencyLeague file := A_ScriptDir . "\temp\currencyData_" . currencyLeague . ".json" UrlDownloadToFile, %url% , %file% diff --git a/resources/ahk/TradeMacro.ahk b/resources/ahk/TradeMacro.ahk index db0867c9..1c4c32b4 100644 --- a/resources/ahk/TradeMacro.ahk +++ b/resources/ahk/TradeMacro.ahk @@ -3123,7 +3123,6 @@ TradeFunc_AdvancedPriceCheckGui(advItem, Stats, Sockets, Links, UniqueStats = "" } ; make sure that the lower vaule is always min (reduced mana cost of minion skills) - console.log(switchValue) If (not StrLen(switchValue)) { minLabelFirst := minLF maxLabelFirst := maxLF @@ -3781,7 +3780,7 @@ ReadPoeNinjaCurrencyData: sampleValue := ChaosEquivalents["Chaos Orb"] league := TradeUtils.UriEncode(TradeGlobals.Get("LeagueName")) fallback := "" - url := "http://poeninja.azureedge.net/api/Data/GetCurrencyOverview?league=" . league + url := "http://poe.ninja/api/Data/GetCurrencyOverview?league=" . league parsedJSON := TradeFunc_DowloadURLtoJSON(url, sampleValue) ; fallback to Standard and Hardcore league if used league seems to not be available @@ -3794,7 +3793,7 @@ ReadPoeNinjaCurrencyData: fallback := "Standard" } - url := "http://poeninja.azureedge.net/api/Data/GetCurrencyOverview?league=" . league + url := "http://poe.ninja/api/Data/GetCurrencyOverview?league=" . league parsedJSON := TradeFunc_DowloadURLtoJSON(url, sampleValue, true, league) } global CurrencyHistoryData := parsedJSON.lines diff --git a/resources/ahk/TradeMacroInit.ahk b/resources/ahk/TradeMacroInit.ahk index 50890dd4..b8f07ce1 100644 --- a/resources/ahk/TradeMacroInit.ahk +++ b/resources/ahk/TradeMacroInit.ahk @@ -1290,8 +1290,12 @@ TradeFunc_DownloadDataFiles() { Loop % files.Length() { file := files[A_Index] filePath = %dir%\%file% - FileCopy, %filePath%, %filePath%.bak - output := PoEScripts_Download(url . file, postData := "", reqHeaders := "", options := "", false) + FileCopy, %filePath%, %filePath%.bak + output := PoEScripts_Download(url . file, postData := "", ioHdr := reqHeaders := "", options := "", false, false, false, "", reqHeadersCurl) + If (A_Index = 1) { + TradeFunc_WriteToLogFile("Data file download from " url "...`n`n" "cURL command:`n" reqHeadersCurl "`n`nAnswer:`n" ioHdr) + } + FileDelete, %filePath% FileAppend, %output%, %filePath%