diff --git a/lib/Class_GdipTooltip.ahk b/lib/Class_GdipTooltip.ahk index fa22b497..fdac0eaf 100644 --- a/lib/Class_GdipTooltip.ahk +++ b/lib/Class_GdipTooltip.ahk @@ -137,6 +137,9 @@ class GdipTooltip this.window.WriteText(String, options) this.window.Update({ x: Round(XCoord, 5), y: Round(YCoord, 5)}) + + ttWindowHwnd := this.window.hwnd + WinSet, ExStyle, +0x20, ahk_id %ttWindowHwnd% ; 0x20 = WS_EX_CLICKTHROUGH this.isVisible := true } diff --git a/lib/PoEScripts_HandleUserSettings.ahk b/lib/PoEScripts_HandleUserSettings.ahk index 7c2a68f0..bb8d6c76 100644 --- a/lib/PoEScripts_HandleUserSettings.ahk +++ b/lib/PoEScripts_HandleUserSettings.ahk @@ -70,7 +70,10 @@ PoEScripts_ConvertOldFiles(sourceDir, destDir, ByRef overwrittenFiles) { PoEScripts_ConvertOldConfig(sourceDir, destDir, fileFullName, ByRef overwrittenFiles) { OldConfigObj := PoEScripts_TrimEndingSpacesInKeys(class_EasyIni(destDir "\" fileFullName)) - if (InStr(OldConfigObj.GetTopComments(), "Converted")) { + if (InStr(OldConfigObj.GetTopComments(), "Converted with PoeScripts_ConvertOldConfig")) { + return + } + if (InStr(OldConfigObj.GetTopComments(), "Based on default file")) { return } PoEScripts_BackupUserFileOnDate(destDir, fileFullName) diff --git a/resources/Updates.txt b/resources/Updates.txt index 9f21b042..8cf83b3b 100644 --- a/resources/Updates.txt +++ b/resources/Updates.txt @@ -1,12 +1,20 @@ The following is a list of what has been updated, starting with 1.9.3. -Current Script Caretaker: aRTy42 +Current Script Caretaker: aRTy (GitHub/PoE Account: aRTy42, Reddit: -aRTy-) -3.0.04 +3.0.05-beta ================================ -from aRTy42, Eruyome, dein0s, esunder +from Eruyome, aRTy + +* Added a fix/workaround for the new and optional GDI+ tooltip causing FPS drops. +* Fixed ItemInfo/TradeMacro currency rate fetching/parsing (and ItemInfos currency stack conversion to chaos equivalent). +* Fixed MapModWarnings not working. + +3.0.04-beta +================================ +from aRTy, Eruyome, dein0s, esunder Three big new features: -1) Full rework of ItemInfo affix parsing (aRTy42) +1) Full rework of ItemInfo affix parsing (aRTy) 2) GDI+ display option (Eruyome and esunder) 3) Reworked .ini handling (mostly dein0s) @@ -56,7 +64,7 @@ These changes are quite extensive and will likely bring a few bugs that were not 3.0.03 ================================ -from aRTy42 +from aRTy Improvements for 3.0 mods: All new ailment mods should now be supported. Old Energy Shield mods should now all be fixed. Flat defense mods on hybrid armour bases are supported, hybrid life mods are not (if you see .5 prefixes, it's likely hybrid life). @@ -65,7 +73,7 @@ Updated Divination Cards and Uniques with data from the wiki. 3.0.02 ================================ -from aRTy42 +from aRTy Updated Divination cards with data from the wiki. Note that a lot of information is still missing. Updated and corrected Unique data from the wiki. @@ -75,13 +83,13 @@ Adopted the new wording for the two map mods concerning "Elemental Ailments" (no 3.0.01 ================================ -from aRTy42 +from aRTy Imported new unique data from the wiki. 3.0.00 ================================ -from aRTy42, Eruyome +from aRTy, Eruyome Reworked AdditionalMacros (by Eruyome). Refer to the ReadMe section at the start of the AdditionalMacros.txt file. Improved several technical aspects regarding file downloads and updates (by Eruyome). @@ -90,7 +98,7 @@ Added most unambiguous new mods and updated existing ones. NOT included: The new 2.6.04 ================================ -from aRTy42, Eruyome, Nightblade +from aRTy, Eruyome, Nightblade Map parsing: MapModWarnings can now be customized. Like AdditionalMacros the file is put into the user folder and can be accessed via the context menu "Edit -> Map Mod Warnings". @@ -101,14 +109,14 @@ AdditionalMacros: Added more functions and enabled more functions by default. 2.6.03 ================================ -from aRTy42 +from aRTy Map mod parsing improved. Includes mod warnings for unpopular or difficult mods. Map data: Tooltip now includes "Boss Arena: Yes/No". Updated most difficulty and layout ratings with the wiki's map article. 2.6.03-beta ================================ -from aRTy42 and Eruyome +from aRTy and Eruyome New feature: Map affix parsing which includes mod counting, so you no longer have to guesstimate 8-mods. Since this was a big chunk of code and is probably not completely bug-free yet this is a beta-release. If you want to test it: Please do! (and report any oddities you find). @@ -121,7 +129,7 @@ Updated Uniques and Maps with wiki info (with thanks to cirf for updating all th 2.6.01 ================================ -from aRTy42 +from aRTy Updated Uniques, Divination Cards and Maps with the current wiki info. Fixed Atlas info: Grotto Map and Dungeon Map now list each other as connected. (with thanks to "paulcdejean" on GitHub) @@ -129,14 +137,14 @@ Fixed a bug that only occured when ItemInfo was used via the TradeMacro: The pre 2.6.00 ================================ -from aRTy42 +from aRTy Updated Uniques, Divination Cards and Maps with the current wiki info. (Be still attentive when checking uniques since the wiki is not fully updated yet) 2.5.06 ================================ -from Eruyome, 4GForce, aRTy42 +from Eruyome, 4GForce, aRTy New features: Auto-updater and global user settings. (by Eruyome) The update notification window now comes with a button "update". This feature allows the script to download the new files @@ -160,14 +168,14 @@ Made some adjustments to the handling of Implicits. (by Eruyome) 2.5.05 ================================ -from aRTy42, Eruyome, 4GForce +from aRTy, Eruyome, 4GForce Fixed an issue with the file encoding of the config file and adjusted the handling of it. If you had weird characters instead of the three dots for abbreviating mods, try this release. 2.5.04 ================================ -from Eruyome, aRTy42, 4GForce +from Eruyome, aRTy, 4GForce UPDATE YOUR AUTOHOTKEY INSTALLATION (unless you updated in the last 2-3 months already) @@ -188,20 +196,20 @@ Updated Maps, Divination Cards and Uniques with the current wiki info. 2.5.03 ================================ -from aRTy42, Eruyome +from aRTy, Eruyome Included an update notifier for the script (by Eruyome). Updated Maps, Divination Cards and Uniques with the current wiki info. Included the name change of "Armory Map" to "Armoury Map" (again), because it got partially reverted with v2.5.02. 2.5.02 ================================ -from aRTy42 +from aRTy Fixed a bug with added elemental damage for bows that got introduced in 2.5.01. Moved the pause function key binding to the "AdditionalMacros" file so that people can change the key more easily. 2.5.01 ================================ -from aRTy42 +from aRTy Updated maps and divination cards with wiki info. Added gem quality info to cast while channeling. Fixed a bug that sometimes caused item types of rares to be mismatched if their randomly assigned name contained a keyword @@ -210,7 +218,7 @@ Corrected the data for the unique "Prismatic Eclipse" that was missing two mods 2.5.00 ================================ -from aRTy42, Eruyome +from aRTy, Eruyome Updated Uniques for PoE v2.5. Uniques now only show those values on the right side that actually have a range to roll. This should simplify comparing your rolls. The method of pulling the unique data was changed, so a few errors might have slipped in. Please report any errors you find. @@ -220,7 +228,7 @@ Fixed a bug that caused item flavour text or usage hints to appear at the bottom 2.4.05 ================================ -from aRTy42, Eruyome, Arkaf +from aRTy, Eruyome, Arkaf Changed Direct3DWindowClass to POEWindowClass and the relevant .exe names, so that the script works again. It should support both standalone and steam version and both 32 and 64 bit. Currency stacks of 1000+ in the currency tab should now read correctly for the currency conversion function. @@ -228,12 +236,12 @@ Currency stacks of 1000+ in the currency tab should now read correctly for the c 2.4.04 ================================ -from aRTy42 +from aRTy Minor fix for map matching (Ivory Temple Map and Vaal Temple Map were detected as Temple Map) 2.4.03 ================================ -from aRTy42 and Eruyome +from aRTy and Eruyome Updated Maps. Added shaped maps and included information from the wiki where possible. Corrected the data for the "Cast Speed" affix, which is higher for staves since PoE v2.4 Fixed item type detection for magic items (by Eruyome) @@ -242,13 +250,13 @@ Added or changed several functions and data storing methods so that the "PoE-Tra 2.4.02 ================================ -from aRTy42 +from aRTy Updated Uniques. Maps have updated Boss descriptions, general notes and ratings for difficulty (1-5) and layout (A-C). 2.4.01 ================================ -from aRTy42 +from aRTy Compiled new map info from various sources, see the forum thread for details. Updated Divinations cards with wiki information. Uniques not updated yet, because there are lots of things to fix and holding back @@ -256,14 +264,14 @@ Uniques not updated yet, because there are lots of things to fix and holding bac 2.4.00 ================================ -from aRTy42 +from aRTy Basic support for the new value range format ("#-#" was changed to "# to #"). The script will continue to display its results as before. Map and Divination card information was not updated yet. This will follow in a few days once there is enough on the wiki. Fixed how the "AdditionalMacros" file was included to support shortcuts to the script from the start menu and task bar. 2.3.07 ================================ -from aRTy42 +from aRTy New feature: Gem quality info. Full 20% quality effect and effect per quality point get displayed. Completely restructured jewels: Separated both the affix parsing code and the data files. This change should have no visible impact ingame. Please report bugs if you notice any. @@ -274,7 +282,7 @@ Updated Divination Cards with wiki infos 2.3.06 ================================ -from aRTy42 +from aRTy The new label "Map Drop" introduced in PoE v2.3.2 is now accounted for and thus no longer breaks parsing items. Added new file "AdditionalMacros.txt" in the main folder. The user macros that used to be at the very end of the ahk-file are now located here, for easier access. Added detection for the Steam version exe-file. The user macros are disabled @@ -298,7 +306,7 @@ Added Shavronne's Gambit to uniques, which was still missing (pointed out by mag 2.3.03 ================================ -from aRTy42 +from aRTy Uniques: Included more of the new 2.3 uniques. Updated implicits for Sceptres and Wands. Manually adjusted the display for a few more uniques (notable: Ventor's Gamble and several Jewels) Updated Divination Cards @@ -306,7 +314,7 @@ Updated Maps 2.3.02 ================================ -from underbent, vdorie, aRTy42 +from underbent, vdorie, aRTy Improved data thanks to underbent's additions to the data fetch script: https://github.com/underbent/scrape_poe_info This means divination cards are now updated to today's wiki infos and uniques with decimal point values (like 0.2% leech) no longer truncate the displayed value to 0 @@ -319,7 +327,7 @@ Included a fix from underbent so that the warning info of equipped items that yo 2.3.01 ================================ -from aRTy42 +from aRTy Added "Has Fated Variant" line to info for respective uniques "Max Sockets" should no longer show up on non armour/weapon items Fixed Drillneck data that got lost due to an odd wiki entry @@ -327,11 +335,11 @@ Fixed Drillneck data that got lost due to an odd wiki entry 2.3 ================================ from /u/trecko1234 and /u/netarc: https://www.reddit.com/r/pathofexile/comments/4nd1mj/updated_bahnzos_item_info_script_for_23/ -Merged with the latest version from Bahnzo by aRTy42 +Merged with the latest version from Bahnzo by aRTy 2.11 ================================ -from aRTy42 +from aRTy Armour matching with RegEx. MaxLife fix & cleanup 2.1 diff --git a/resources/Version.txt b/resources/Version.txt index a1fec32d..9e9d7de0 100644 --- a/resources/Version.txt +++ b/resources/Version.txt @@ -1,2 +1,2 @@ -ReleaseVersion := "3.0.04-beta" +ReleaseVersion := "3.0.05-beta" AHKVersionRequired := "1.1.26" diff --git a/resources/ahk/AdditionalMacros.ahk b/resources/ahk/AdditionalMacros.ahk index 3b2b397f..4dbf6d27 100644 --- a/resources/ahk/AdditionalMacros.ahk +++ b/resources/ahk/AdditionalMacros.ahk @@ -47,7 +47,9 @@ AM_AssignHotkeys: for labelIndex, labelName in StrSplit(AM_Config.GetSections("|", "C"), "|") { if (labelName != "General") { for labelKeyIndex, labelKeyName in StrSplit(AM_Config[labelName].Hotkeys, ", ") { - Hotkey, % KeyNameToKeyCode(labelKeyName, AM_KeyToSCState), %labelName%_HKey, % AM_Config[labelName].State + if (labelKeyName and labelKeyName != A_Space) { + Hotkey, % KeyNameToKeyCode(labelKeyName, AM_KeyToSCState), %labelName%_HKey, % AM_Config[labelName].State + } } } } diff --git a/resources/ahk/POE-ItemInfo.ahk b/resources/ahk/POE-ItemInfo.ahk index 706065b7..556b70e9 100644 --- a/resources/ahk/POE-ItemInfo.ahk +++ b/resources/ahk/POE-ItemInfo.ahk @@ -46,7 +46,7 @@ Globals.Set("AHKVersionRequired", AHKVersionRequired) Globals.Set("ReleaseVersion", ReleaseVersion) Globals.Set("DataDir", A_ScriptDir . "\data") Globals.Set("SettingsUIWidth", 545) -Globals.Set("SettingsUIHeight", 575) +Globals.Set("SettingsUIHeight", 600) Globals.Set("AboutWindowHeight", 340) Globals.Set("AboutWindowWidth", 435) Globals.Set("SettingsUITitle", "PoE ItemInfo Settings") @@ -436,7 +436,7 @@ If (StrLen(overwrittenUserFiles)) { } GoSub, AM_AssignHotkeys GoSub, FetchCurrencyData -global gdipTooltip = new GdipTooltip(2, 8,,,[Opts.GDIWindowOpacity, Opts.GDIWindowColor, 10],[Opts.GDIBorderOpacity, Opts.GDIBorderColor, 10],[Opts.GDITextOpacity, Opts.GDITextColor, 10],true, Opts.RenderingFix, -0.3) +GoSub, InitGDITooltip Menu, TextFiles, Add, Additional Macros Settings, EditAdditionalMacrosSettings Menu, TextFiles, Add, Map Mod Warnings, EditMapModWarningsConfig @@ -2262,28 +2262,28 @@ SetMapInfoLine(AffixType, ByRef MapAffixCount, EnumLabel="") ParseMapAffixes(ItemDataAffixes) { Global Globals, Opts, AffixTotals, AffixLines - - MapModWarn := class_EasyIni(userDirectory "\MapModWarnings.ini") + + MapModWarn := class_EasyIni(userDirectory "\MapModWarnings.ini").Affixes ; FileRead, File_MapModWarn, %userDirectory%\MapModWarnings.txt ; MapModWarn := JSON.Load(File_MapModWarn) - + ItemDataChunk := ItemDataAffixes - + ItemBaseType := Item.BaseType - ItemSubType := Item.SubType - - + ItemSubType := Item.SubType + + ; Reset the AffixLines "array" and other vars ResetAffixDetailVars() - + IfInString, ItemDataChunk, Unidentified { return ; Not interested in unidentified items } - + MapAffixCount := 0 TempAffixCount := 0 - + Index_RareMonst := Index_MonstSlowedTaunted := Index_BossDamageAttackCastSpeed := @@ -5993,7 +5993,7 @@ ParseAffixes(ItemDataAffixes, Item) AffixTotals.NumPrefixesMax := AffixTotals.NumPrefixes AffixTotals.NumSuffixesMax := AffixTotals.NumSuffixes AffixTotals.NumTotal := AffixTotals.NumPrefixes + AffixTotals.NumSuffixes - + AffixTotals.NumTotalMax := AffixTotals.NumTotal ; THIS FUNCTION IS QUITE COMPLICATED. IT INVOLVES FOUR LOOPS THAT FULFILL DIFFERENT JOBS AT DIFFERENT TIMES. ; CONSEQUENTLY THE CODE CAN'T BE SIMPLY READ FROM TOP TO BOTTOM. IT IS HEAVILY COMMENTED THOUGH. @@ -6900,40 +6900,24 @@ ConvertCurrency(ItemName, ItemStats, ByRef dataSource) ; Use downloaded currency rates if they exist, otherwise use hardcoded fallback fallback := A_ScriptDir . "\data\CurrencyRates.txt" - ninjaRates := [A_ScriptDir . "\temp\CurrencyRates_tmpstandard.txt", A_ScriptDir . "\temp\CurrencyRates_tmphardcore.txt", A_ScriptDir . "\temp\CurrencyRates_Standard.txt", A_ScriptDir . "\temp\CurrencyRates_Hardcore.txt"] result := [] - Loop, % ninjaRates.Length() - { - dataSource := "Currency rates powered by poe.ninja`n`n" - If (FileExist(ninjaRates[A_Index])) - { - ValueInChaos := 0 - leagueName := "" - file := ninjaRates[A_Index] - Loop, Read, %file% - { - Line := Trim(A_LoopReadLine) - RegExMatch(Line, "i)^;(.*)", match) - If (match) { - leagueName := match1 . ": " - Continue - } - - IfInString, Line, %ItemName% - { - StringSplit, LineParts, Line, | - ChaosRatio := LineParts2 - StringSplit, ChaosRatioParts,ChaosRatio, : - ChaosMult := ChaosRatioParts2 / ChaosRatioParts1 - ValueInChaos := (ChaosMult * StackSize) - } - } - - If (ValueInChaos) { - tmp := [leagueName, ValueInChaos, ChaosRatio] - result.push(tmp) - } + CurrencyDataRates := Globals.Get("CurrencyDataRates") + For league, ninjaRates in CurrencyDataRates { + ChaosRatio := ninjaRates[ItemName].OwnQuantity ":" ninjaRates[ItemName].ChaosQuantity + ChaosMult := ninjaRates[ItemName].ChaosQuantity / ninjaRates[ItemName].OwnQuantity + ValueInChaos := (ChaosMult * StackSize) + + If (league == "tmpstandard" or league == "tmphardcore" ) { + leagueName := InStr(league, "standard") ? "Challenge Standard" : "Challenge Hardcore" + } + Else { + leagueName := "Permanent " . league + } + + If (ValueInChaos) { + tmp := [leagueName ": ", ValueInChaos, ChaosRatio] + result.push(tmp) } } @@ -7289,9 +7273,18 @@ ParseItemData(ItemDataText, ByRef RarityLevel="") If (ValueInChaos.Length() and not Item.Name == "Chaos Orb") { CurrencyDetails := "`n" . dataSource + CurrencyValueLength := 0 + CurrencyRatioLength := 0 + Loop, % ValueInChaos.Length() + { + CurrencyValueLength := CurrencyValueLength < StrLen(ValueInChaos[A_Index][2]) ? StrLen(ValueInChaos[A_Index][2]) : CurrencyValueLength + CurrencyRatioLength := CurrencyRatioLength < StrLen(ValueInChaos[A_Index][3]) ? StrLen(ValueInChaos[A_Index][3]) : CurrencyRatioLength + } Loop, % ValueInChaos.Length() { - CurrencyDetails .= ValueInChaos[A_Index][1] . "" . ValueInChaos[A_Index][2] . " Chaos (" . ValueInChaos[A_Index][3] . "c)`n" + CurrencyDetails .= ValueInChaos[A_Index][1] + CurrencyDetails .= "" . StrPad(ValueInChaos[A_Index][2], CurrencyValueLength, "left") . " Chaos " + CurrencyDetails .= StrPad("(" . ValueInChaos[A_Index][3], CurrencyRatioLength + 1, "left") . "c)`n" } } } @@ -8607,7 +8600,7 @@ ChangeTooltipColorByItem(conditionalColors = false) { _bOpacity := 90 } } - + If (not StrLen(_bColor) or not conditionalColors) { gdipTooltip.UpdateColors(Opts.GDIWindowColor, Opts.GDIWindowOpacity, Opts.GDIBorderColor, Opts.GDIBorderOpacity, Opts.GDITextColor, Opts.GDITextOpacity, 10, 16) } Else { @@ -8641,7 +8634,7 @@ ShowToolTip(String, Centered = false, conditionalColors = false) YCoord := 0 + ScreenOffsetY If (Opts.UseGDI) - { + { ChangeTooltipColorByItem(conditionalColors) gdipTooltip.ShowGdiTooltip(Opts.FontSize, String, XCoord, YCoord, RelativeToActiveWindow, PoEWindowHwnd) } @@ -8904,14 +8897,14 @@ CreateSettingsUI() { Global + ; Note: window handles (hwnd) are only needed if a UI tooltip should be attached. + ExtraHeightOfTabsWithTradeMacro := SkipItemInfoUpdateCall ? 25 : 0 + generalHeight := SkipItemInfoUpdateCall ? "150" : "240" ; "180" : "270" with ParseItemHotKey + YShiftWhenIncludedInTradeMacro := SkipItemInfoUpdateCall ? -25 : 0 ; General - generalHeight := SkipItemInfoUpdateCall ? "150" : "240" ; "180" : "270" with ParseItemHotKey GuiAddGroupBox("General", "x7 ym" 5+ExtraHeightOfTabsWithTradeMacro " w260 h" generalHeight " Section") - - ; Note: window handles (hwnd) are only needed if a UI tooltip should be attached. - GuiAddCheckbox("Only show tooltip if PoE is frontmost", "xs10 yp+20 w210 h30", Opts.OnlyActiveIfPOEIsFront, "OnlyActiveIfPOEIsFront", "OnlyActiveIfPOEIsFrontH") AddToolTip(OnlyActiveIfPOEIsFrontH, "When checked the script only activates while you are ingame`n(technically while the game window is the frontmost)") @@ -8940,32 +8933,34 @@ CreateSettingsUI() } ; GDI+ - GuiAddGroupBox("GDI+", "x7 y+20 w260 h305 Section") - GuiAddCheckBox("Enable GDI+", "xs10 yp+20 w210", Opts.UseGDI, "UseGDI", "UseGDIH", "SettingsUI_ChkUseGDI") - AddToolTip(UseGDIH, "Enables rendering of tooltips using Windows gdip.dll`n(allowing limited styling options).") - GuiAddButton("Edit Window", "xs9 ys40 w80 h23", "SettingsUI_BtnGDIWindowColor", "BtnGDIWindowColor") - GuiAddText("Color (hex RGB):", "xs100 ys45 w150", "LblGDIWindowColor") - GuiAddEdit(Opts.GDIWindowColor, "xs190 ys42 w60", "GDIWindowColor", "GDIWindowColorH") - GuiAddText("Opactiy (0-100):", "xs100 ys75 w150", "LblGDIWindowOpacity") - GuiAddEdit(Opts.GDIWindowOpacity, "xs190 ys72 w60", "GDIWindowOpacity", "GDIWindowOpacityH") - GuiAddButton("Edit Border", "xs9 ys100 w80 h23", "SettingsUI_BtnGDIBorderColor", "BtnGDIBorderColor") - GuiAddText("Color (hex RGB):", "xs100 ys105 w150", "LblGDIBorderColor") - GuiAddEdit(Opts.GDIBorderColor, "xs190 ys102 w60", "GDIBorderColor", "GDIBorderColorH") - GuiAddText("Opacity (0-100):", "xs100 ys135 w150", "LblGDIBorderOpacity") - GuiAddEdit(Opts.GDIBorderOpacity, "xs190 ys132 w60", "GDIBorderOpacity", "GDIBorderOpacityH") - GuiAddButton("Edit Text", "xs9 ys160 w80 h23", "SettingsUI_BtnGDITextColor", "BtnGDITextColor") - GuiAddText("Color (hex RGB):", "xs100 ys165 w150", "LblGDITextColor") - GuiAddEdit(Opts.GDITextColor, "xs190 ys162 w60", "GDITextColor", "GDITextColorH") - GuiAddText("Opacity (0-100):", "xs100 ys195 w150", "LblGDITextOpacity") - GuiAddEdit(Opts.GDITextOpacity, "xs190 ys192 w60", "GDITextOpacity", "GDITextOpacityH") - GuiAddCheckBox("Rendering Fix", "xs10 ys216 w110", Opts.GDIRenderingFix, "GDIRenderingFix", "GDIRenderingFixH") + GuiAddGroupBox("GDI+", "x7 ym+" 255+YShiftWhenIncludedInTradeMacro " w260 h320 Section") + GuiAddCheckBox("Enable GDI+", "xs10 yp+20 w90", Opts.UseGDI, "UseGDI", "UseGDIH", "SettingsUI_ChkUseGDI") + AddToolTip(UseGDIH, "Enables rendering of tooltips using Windows gdip.dll`n(allowing limited styling options).") + GuiAddCheckBox("Rendering Fix", "xs10 yp+30 w90", Opts.GDIRenderingFix, "GDIRenderingFix", "GDIRenderingFixH") AddToolTip(GDIRenderingFixH, "In the case that rendered graphics (window, border and text) are`nunsharp/blurry this should fix the issue.") - GuiAddCheckBox("Style border depending on checked item.", "xs10 ys241 w210", Opts.GDIConditionalColors, "GDIConditionalColors", "GDIConditionalColorsH") - - GuiAddButton("GDI Defaults", "xs9 ys275 w80 h23", "SettingsUI_BtnGDIDefaults", "BtnGDIDefaults", "BtnGDIDefaultsH") - GuiAddButton("Preview", "xs170 ys275 w80 h23", "SettingsUI_BtnGDIPreviewTooltip", "BtnGDIPreviewTooltip", "BtnGDIPreviewTooltipH") - - + GuiAddText("Restart script after enabling/`ndisabling GDI+.`nMight cause general FPS drop.", "xs105 ys+22 w150 cRed", "") + + GuiAddButton("Edit Window", "xs9 ys80 w80 h23", "SettingsUI_BtnGDIWindowColor", "BtnGDIWindowColor") + GuiAddText("Color (hex RGB):", "xs100 ys85 w150", "LblGDIWindowColor") + GuiAddEdit(Opts.GDIWindowColor, "xs190 ys82 w60", "GDIWindowColor", "GDIWindowColorH") + GuiAddText("Opactiy (0-100):", "xs100 ys115 w150", "LblGDIWindowOpacity") + GuiAddEdit(Opts.GDIWindowOpacity, "xs190 ys112 w60", "GDIWindowOpacity", "GDIWindowOpacityH") + GuiAddButton("Edit Border", "xs9 ys140 w80 h23", "SettingsUI_BtnGDIBorderColor", "BtnGDIBorderColor") + GuiAddText("Color (hex RGB):", "xs100 ys145 w150", "LblGDIBorderColor") + GuiAddEdit(Opts.GDIBorderColor, "xs190 ys142 w60", "GDIBorderColor", "GDIBorderColorH") + GuiAddText("Opacity (0-100):", "xs100 ys175 w150", "LblGDIBorderOpacity") + GuiAddEdit(Opts.GDIBorderOpacity, "xs190 ys172 w60", "GDIBorderOpacity", "GDIBorderOpacityH") + GuiAddButton("Edit Text", "xs9 ys200 w80 h23", "SettingsUI_BtnGDITextColor", "BtnGDITextColor") + GuiAddText("Color (hex RGB):", "xs100 ys205 w150", "LblGDITextColor") + GuiAddEdit(Opts.GDITextColor, "xs190 ys202 w60", "GDITextColor", "GDITextColorH") + GuiAddText("Opacity (0-100):", "xs100 ys235 w150", "LblGDITextOpacity") + GuiAddEdit(Opts.GDITextOpacity, "xs190 ys232 w60", "GDITextOpacity", "GDITextOpacityH") + + GuiAddCheckBox("Style border depending on checked item.", "xs10 ys260 w210", Opts.GDIConditionalColors, "GDIConditionalColors", "GDIConditionalColorsH") + + GuiAddButton("GDI Defaults", "xs9 ys290 w80 h23", "SettingsUI_BtnGDIDefaults", "BtnGDIDefaults", "BtnGDIDefaultsH") + GuiAddButton("Preview", "xs170 ys290 w80 h23", "SettingsUI_BtnGDIPreviewTooltip", "BtnGDIPreviewTooltip", "BtnGDIPreviewTooltipH") + ; Tooltip GuiAddGroupBox("Tooltip", "x277 ym" 5+ExtraHeightOfTabsWithTradeMacro " w260 h140 Section") @@ -8973,7 +8968,6 @@ CreateSettingsUI() GuiAddText("Mouse move threshold (px):", "xs27 yp+3 w150 h20 0x0100", "LblMouseMoveThreshold", "LblMouseMoveThresholdH") AddToolTip(LblMouseMoveThresholdH, "Hide tooltip when the mouse cursor moved x pixel away from the initial position.`nEffectively permanent tooltip when using a value larger than the monitor diameter.") - GuiAddEdit(Opts.ToolTipTimeoutSeconds, "xs180 yp+27 w50 Number", "ToolTipTimeoutSeconds") GuiAddCheckBox("Use tooltip timeout (seconds)", "xs10 yp+3 w160", Opts.UseTooltipTimeout, "UseTooltipTimeout", "UseTooltipTimeoutH", "SettingsUI_ChkUseTooltipTimeout") AddToolTip(UseTooltipTimeoutH, "Hide tooltip automatically after defined time.") @@ -8987,8 +8981,7 @@ CreateSettingsUI() ; Display - - GuiAddGroupBox("Display", "x277 y+62 w260 h370 Section") + GuiAddGroupBox("Display", "x277 ym+" 205+YShiftWhenIncludedInTradeMacro " w260 h370 Section") GuiAddCheckbox("Show header for affix overview", "xs10 yp+20 w210 h30", Opts.ShowHeaderForAffixOverview, "ShowHeaderForAffixOverview", "ShowHeaderForAffixOverviewH") AddToolTip(ShowHeaderForAffixOverviewH, "Include a header above the affix overview:`n TierRange ilvl Total ilvl Tier") @@ -10021,6 +10014,14 @@ SettingsUI_BtnDefaults: ShowSettingsUI() return +InitGDITooltip: + Global Opts + ; some users experience FPS drops when gdi tooltip is initialized. + If (Opts.UseGDI) { + global gdipTooltip = new GdipTooltip(2, 8,,,[Opts.GDIWindowOpacity, Opts.GDIWindowColor, 10],[Opts.GDIBorderOpacity, Opts.GDIBorderColor, 10],[Opts.GDITextOpacity, Opts.GDITextColor, 10],true, Opts.RenderingFix, -0.3) + } + return + OpenGDIColorPicker(type, rgb, opacity, title, image) { ; GDI+ global @@ -10095,6 +10096,9 @@ SettingsUI_BtnGDIPreviewTooltip: Increased Mana Cost of Skill… 80-40 Energy Shield gained on Kill 15-20 ) + If (not gdipTooltip) { + GoSub, InitGDITooltip + } ShowToolTip(_testString) ; reset options Opts.UseGDI := _tempGDIState @@ -10135,6 +10139,9 @@ SettingsUI_ChkUseGDI: } Else { + If (not gdipTooltip) { + GoSub, InitGDITooltip + } GuiControl, Enable, GDIWindowColor GuiControl, Enable, GDIWindowOpacity GuiControl, Enable, GDIBorderColor @@ -10312,55 +10319,92 @@ CheckForUpdates: } return -FetchCurrencyData: - CurrencyDataJSON := {} - currencyLeagues := ["Standard", "Hardcore", "tmpstandard", "tmphardcore"] +; TODO: use this for trademacro also +CurrencyDataDowloadURLtoJSON(url, sampleValue, critical = false, league = "", project ="", tmpFileName = "", fallbackDir = "", ByRef usedFallback = false) { + errorMsg := "Parsing the currency data (json) from poe.ninja failed.`n" + errorMsg .= "This should only happen when the servers are down / unavailable." + errorMsg .= "`n`n" + errorMsg .= "Using archived data from a fallback file. League: """ league """." + errorMsg .= "`n`n" + errorMsg .= "This can fix itself when the servers are up again and the data gets updated automatically or if you restart the script at such a time." + + errors := 0 + Try { + reqHeaders.push("Host: poe.ninja") + reqHeaders.push("Connection: keep-alive") + reqHeaders.push("Cache-Control: max-age=0") + ;reqHeaders.push("Content-type: application/x-www-form-urlencoded; charset=UTF-8") + reqHeaders.push("Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8") + reqHeaders.push("User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36") + parsedJSON := PoEScripts_Download(url, postData, reqHeaders, options, true, true, false, "", reqHeadersCurl) + + ; first currency data parsing (script start) + If (critical and not sampleValue or not parsedJSON.lines.length()) { + errors++ + } + } Catch error { + ; first currency data parsing (script start) + If (critical and not sampleValue) { + errors++ + } + } + + If (errors and critical and not sampleValue) { + MsgBox, 16, %project% - Error, %errorMsg% + FileRead, JSONFile, %fallbackDir%\currencyData_Fallback_%league%.json + parsedJSON := JSON.Load(JSONFile) + usedFallback := true + } Else { + parsedJSON := JSON.Load(parsedJSON) + } + Return parsedJSON +} + +FetchCurrencyData: + _CurrencyDataJSON := {} + currencyLeagues := ["Standard", "Hardcore", "tmpstandard", "tmphardcore"] + sampleValue := "ff" + Loop, % currencyLeagues.Length() { currencyLeague := currencyLeagues[A_Index] url := "http://poe.ninja/api/Data/GetCurrencyOverview?league=" . currencyLeague file := A_ScriptDir . "\temp\currencyData_" . currencyLeague . ".json" - UrlDownloadToFile, %url% , %file% - + + url := "http://poe.ninja/api/Data/GetCurrencyOverview?league=" . currencyLeague + critical := StrLen(Globals.Get("LastCurrencyUpdate")) ? false : true + parsedJSON := CurrencyDataDowloadURLtoJSON(url, sampleValue, critical, currencyLeague, "PoE-ItemInfo", file, A_ScriptDir "\data", usedFallback) + Try { - If (FileExist(file)) { - FileRead, JSONFile, %file% - parsedJSON := JSON.Load(JSONFile) - CurrencyDataJSON[currencyLeague] := parsedJSON.lines - ParsedAtLeastOneLeague := True + If (parsedJSON) { + _CurrencyDataJSON[currencyLeague] := parsedJSON.lines + If (not usedFallback) { + ParsedAtLeastOneLeague := True + } } Else { - CurrencyDataJSON[currencyLeague] := null + _CurrencyDataJSON[currencyLeague] := null } } Catch error { errorMsg := "Parsing the currency data (json) from poe.ninja failed for league:" errorMsg .= "`n" currencyLeague ;MsgBox, 16, PoE-ItemInfo - Error, %errorMsg% - } + } + parsedJSON := } - + If (ParsedAtLeastOneLeague) { Globals.Set("LastCurrencyUpdate", A_NowUTC) } ; parse JSON and write files to disk (like \data\CurrencyRates.txt) - For league, data in CurrencyDataJSON { - ratesFile := A_ScriptDir . "\temp\currencyRates_" . league . ".txt" - ratesJSONFile := A_ScriptDir . "\temp\currencyData_" . league . ".json" - FileDelete, %ratesFile% - FileDelete, %ratesJSONFile% + _CurrencyDataRates := {} + For league, data in _CurrencyDataJSON { + _CurrencyDataRates[league] := {} - If (league == "tmpstandard" or league == "tmphardcore" ) { - comment := InStr(league, "standard") ? ";Challenge Standard`n" : ";Challenge Hardcore`n" - } - Else { - comment := ";Permanent " . league . "`n" - } - FileAppend, %comment%, %ratesFile% - - Loop, % data.Length() { - cName := data[A_Index].currencyBaseName - cChaosEquiv := data[A_Index].chaosEquivalent + For currency, cData in data { + cName := cData.currencyTypeName + cChaosEquiv := cData.chaosEquivalent If (cChaosEquiv >= 1) { cChaosQuantity := ZeroTrim(Round(cChaosEquiv, 2)) @@ -10369,14 +10413,17 @@ FetchCurrencyData: Else { cChaosQuantity := 1 cOwnQuantity := ZeroTrim(Round(1 / cChaosEquiv, 2)) - } - - result := cName . "|" . cOwnQuantity . ":" . cChaosQuantity . "`n" - FileAppend, %result%, %ratesFile% + } + + _CurrencyDataRates[league][cName] := {} + _CurrencyDataRates[league][cName].ChaosEquiv := cChaosEquiv + _CurrencyDataRates[league][cName].ChaosQuantity := cChaosQuantity + _CurrencyDataRates[league][cName].OwnQuantity := cOwnQuantity } } - - CurrencyDataJSON := + + Globals.Set("CurrencyDataRates", _CurrencyDataRates) + _CurrencyDataJSON := return ZeroTrim(number) { diff --git a/resources/default_UserFiles/config.ini b/resources/default_UserFiles/config.ini index b2142cc0..a3a10b0c 100644 --- a/resources/default_UserFiles/config.ini +++ b/resources/default_UserFiles/config.ini @@ -1,3 +1,4 @@ +; Based on default file from v3.0.05-beta. [General] ParseItemHotKey=^c ; Hotkey to invoke ItemInfo. Default: Ctrl+C.