From fb389eab0241db7d546c66601f870411c92e2f37 Mon Sep 17 00:00:00 2001 From: tercio Date: Wed, 19 Nov 2014 17:23:58 -0200 Subject: [PATCH] - More fixes for dungeon bosses recognition. - Fixes for few errors during combat parser. - Broker is now 'data source' type instead of 'launcher'. --- boot.lua | 12 +-- core/network.lua | 9 ++ core/parser.lua | 11 ++- core/windows.lua | 2 +- functions/slash.lua | 4 +- .../Details_DungeonInfo-Warlords.lua | 31 ++++--- startup.lua | 91 +++++++++++++++++++ 7 files changed, 136 insertions(+), 24 deletions(-) diff --git a/boot.lua b/boot.lua index 784e2cf7..eb5f5c76 100644 --- a/boot.lua +++ b/boot.lua @@ -3,16 +3,14 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.build_counter = 217 --it's 217 for release - _detalhes.userversion = "v3.2.3" + _detalhes.build_counter = 220 --it's 220 for release + _detalhes.userversion = "v3.2.4" _detalhes.realversion = 47 --core version _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> initialization stuff --- remover print do power types differente. - do local _detalhes = _G._detalhes @@ -21,13 +19,11 @@ do --[[ -|cFFFFFF00v3.2.3 (|cFFFFCC00Nov 18, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed Monk's Stagger ability which was counting as damage done.\n\n|cFFFFFF00-|r Added WoD dungeon information, this fixes dungeon bosses being assigned as 'trash cleanup'.\n\n -|cFFFFFF00-|r Added more information on API.txt document (is on Details! root folder).\n\n -|cFFFFFF00-|r .\n\n +|cFFFFFF00v3.2.4 (|cFFFFCC00Nov 19, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r More fixes for dungeon bosses recognition.\n\n|cFFFFFF00-|r Fixes for few errors during combat parser.\n\n --]] - Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v3.2.3 (|cFFFFCC00Nov 18, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed Monk's Stagger ability which was counting as damage done.\n\n|cFFFFFF00-|r Added WoD dungeon information, this fixes dungeon bosses being assigned as 'trash cleanup'.\n\n|cFFFFFF00-|r Added more information on API.txt document (is in Details! root folder).\n\n|cFFFFFF00v3.2.1 (|cFFFFCC00Nov 14, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Custom Displays updated to track WoD potions.\n\n|cFFFFFF00-|r Added Feedback panel at options panel.\n\n|cFFFFFF00v3.2.0 (|cFFFFCC00Nov 11, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Major changes on the way Details! store information, these changes saves up to 40% memory and 4% cpu usage.\n\n|cFFFFFF00-|r Fixed problem with pet's healing messing with the owner activity time.\n\n|cFFFFFF00-|r Added Energy -> Resources.\n\n|cFFFFFF00-|r Fixed combat initialization when the player start casting a Dot spell.\n\n|cFFFFFF00-|r Added new custom display: Damage Taken By Spell.\n\n|cFFFFFF00v2.2.3 (|cFFFFCC00Oct 26, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed the healing done problem with Priest's Spirit of Redemption.\n\n|cFFFFFF00-|r Fixed avoidance by absorb when the hit missed was a multistrike hit.\n\n|cFFFFFF00-|r Fixed a script time out problem when erasing data while in combat.\n\n|cFFFFFF00-|r Fixed bug with interrupt tooltip when the player have a pet.\n\n|cFFFFFF00v2.2.1 (|cFFFFCC00Oct 22, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed the gap between the button and its menu which sometimes traveling the mouse between them was activating tooltips from window's bars.\n\n|cFFFFFF00-|r Fixed an annoying menu blink when the window was near the right side of the screen.\n\n|cFFFFFF00-|r Fixed the stretch grab which was over other windows even with the 'stretch always on top' option disabled.\n\n|cFFFFFF00-|r Few fixes on healing done from absorbs.\n\n|cFFFFFF00v2.1.6 (|cFFFFCC00Oct 21, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed death's tooltip which wasn't respecting tooltip's configuration set on options panel.\n\n|cFFFFFF00-|r Now when the window is close to the top of the screen, menus will anchor on bottom side of the menu icons.\n\n|cFFFFFF00-|r Added micro displays options on Window Settings bracket.\n\n|cFFFFFF00-|r Fixed the problem with bar's custom texts.\n\n|cFFFFFF00-|r Lua functions inside custom texts, Chart Data scripts and Custom Displays scripts are now protected calls and won't break the addon functionality if an error occurs. Unfortunately we still doesn't have a documentation for Details! API.\n\n|cFFFFFF00-|r Fixed an incomum bug with tank avoidance tables.\n\n|cFFFFFF00-|r Tiny Threat: added option to use class colors instead of green-to-red colors.\n\n|cFFFFFF00-|r Added option to enable shadows on toolbar's buttons.\n\n|cFFFFFF00-|r Added option to set the specing between each button on toolbar.\n\n|cFFFFFF00-|r Finally we merged the left and right menus into only one with 6 icons.\n\n|cFFFFFF00-|r Removed window button and added a new option bracket to manage windows under Mode Menu.\n\n|cFFFFFF00-|r Few changes on 'Default Skin', 'Minimalistic', 'Simple Gray' and 'ElvUI Frame Style BW' (need reaply).\n\n|cFFFFFF00- Important:|r If the menus is out of the position, just reaply the skin.\n\nv2.0.15 (|cFFFFCC00Oct 15, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed tooltips where sometimes it wans't showing at all.\n\n|cFFFFFF00-|r Fixed the healing done amount on Malkorok encounter.\n\nv2.0.14 (|cFFFFCC00Oct 14, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added pre-potion recognition for WoD pots.\n\n|cFFFFFF00-|r Added spell list for Blackrock Foundry encounters.\n\n|cFFFFFF00-|r Added mouse wheel scroll speed option.\n\n|cFFFFFF00-|r Added support for healing multistrike and damage multistrike.\n\n|cFFFFFF00-|r Added a Change Log button on Options Panel.\n\n|cFFFFFF00-|r When the windows is locked, trying to move the window through toolbar will stretch it instead.\n\n|cFFFFFF00-|r Renamed overheal for shields, now its called 'shield wasted'.\n\n|cFFFFFF00-|r Fine tuning on healing done, should have high accuracy now.\n\n|cFFFFFF00-|r Encounter Details plugin now supports Highmaul and Blackrock Foundry.\n\n|cFFFFFF00-|r New class cooldowns and spells recognition.\n\n|cFFFFFF00-|r Fixed few bugs on comparison panel and avoidance panel.\n\n|cFFFFFF00-|r Fixed encounter recognition, now it should show the encounter name over segments menu.\n\n|cFFFFFF00-|r Fixed Graphic part of Encounter Details Plugin, now he draws more accurately.\n\n|cFFFFFF00v1.29.3 (|cFFFFCC00Oct 11, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an addon crash bug when clicking directly on the sword button.\n\n|cFFFFFF00-|r Removed Flat Skin, added new skin: Serenity.\n\n|cFFFFFF00-|r Fixed many issues with bar animations.\n\n|cFFFFFF00-|r Fixed combat encounter start if the player already is in combat when the boss is pulled.\n\n|cFFFFFF00-|r Fixed wheel scroll when sometimes it move very slow or doesn't move the bars at all.\n\n|cFFFFFF00-|r Added option 'Always Show Me' which when enabled and you aren't at the top ranked players shown in the window, it forces to show you in the last bar.\n\n|cFFFFFF00-|r Added option 'First Hit' which when enabled show who did the first struck in the combat (normally is who pulled the boss).\n\n|cFFFFFF00-|r Added a panel to change class colors.\n\n|cFFFFFF00v1.28.3 (|cFFFFCC00Oct 04, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added support for plugin descriptions on options panel.\n\n|cFFFFFF00-|r Added scale option.\n\n|cFFFFFF00-|r Added a Change Log button on Options Panel.\n\n|cFFFFFF00-|r Added option to use the same profile on all characters without asking.\n\n|cFFFFFF00-|r Added a shortcut color button on main panel on Options Panel." + Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v3.2.4 (|cFFFFCC00Nov 19, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r More fixes for dungeon bosses recognition.\n\n|cFFFFFF00-|r Fixes for few errors during combat parser.\n\n|cFFFFFF00v3.2.3 (|cFFFFCC00Nov 18, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed Monk's Stagger ability which was counting as damage done.\n\n|cFFFFFF00-|r Added WoD dungeon information, this fixes dungeon bosses being assigned as 'trash cleanup'.\n\n|cFFFFFF00-|r Added more information on API.txt document (is in Details! root folder).\n\n|cFFFFFF00v3.2.1 (|cFFFFCC00Nov 14, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Custom Displays updated to track WoD potions.\n\n|cFFFFFF00-|r Added Feedback panel at options panel.\n\n|cFFFFFF00v3.2.0 (|cFFFFCC00Nov 11, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Major changes on the way Details! store information, these changes saves up to 40% memory and 4% cpu usage.\n\n|cFFFFFF00-|r Fixed problem with pet's healing messing with the owner activity time.\n\n|cFFFFFF00-|r Added Energy -> Resources.\n\n|cFFFFFF00-|r Fixed combat initialization when the player start casting a Dot spell.\n\n|cFFFFFF00-|r Added new custom display: Damage Taken By Spell.\n\n|cFFFFFF00v2.2.3 (|cFFFFCC00Oct 26, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed the healing done problem with Priest's Spirit of Redemption.\n\n|cFFFFFF00-|r Fixed avoidance by absorb when the hit missed was a multistrike hit.\n\n|cFFFFFF00-|r Fixed a script time out problem when erasing data while in combat.\n\n|cFFFFFF00-|r Fixed bug with interrupt tooltip when the player have a pet.\n\n|cFFFFFF00v2.2.1 (|cFFFFCC00Oct 22, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed the gap between the button and its menu which sometimes traveling the mouse between them was activating tooltips from window's bars.\n\n|cFFFFFF00-|r Fixed an annoying menu blink when the window was near the right side of the screen.\n\n|cFFFFFF00-|r Fixed the stretch grab which was over other windows even with the 'stretch always on top' option disabled.\n\n|cFFFFFF00-|r Few fixes on healing done from absorbs.\n\n|cFFFFFF00v2.1.6 (|cFFFFCC00Oct 21, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed death's tooltip which wasn't respecting tooltip's configuration set on options panel.\n\n|cFFFFFF00-|r Now when the window is close to the top of the screen, menus will anchor on bottom side of the menu icons.\n\n|cFFFFFF00-|r Added micro displays options on Window Settings bracket.\n\n|cFFFFFF00-|r Fixed the problem with bar's custom texts.\n\n|cFFFFFF00-|r Lua functions inside custom texts, Chart Data scripts and Custom Displays scripts are now protected calls and won't break the addon functionality if an error occurs. Unfortunately we still doesn't have a documentation for Details! API.\n\n|cFFFFFF00-|r Fixed an incomum bug with tank avoidance tables.\n\n|cFFFFFF00-|r Tiny Threat: added option to use class colors instead of green-to-red colors.\n\n|cFFFFFF00-|r Added option to enable shadows on toolbar's buttons.\n\n|cFFFFFF00-|r Added option to set the specing between each button on toolbar.\n\n|cFFFFFF00-|r Finally we merged the left and right menus into only one with 6 icons.\n\n|cFFFFFF00-|r Removed window button and added a new option bracket to manage windows under Mode Menu.\n\n|cFFFFFF00-|r Few changes on 'Default Skin', 'Minimalistic', 'Simple Gray' and 'ElvUI Frame Style BW' (need reaply).\n\n|cFFFFFF00- Important:|r If the menus is out of the position, just reaply the skin.\n\nv2.0.15 (|cFFFFCC00Oct 15, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed tooltips where sometimes it wans't showing at all.\n\n|cFFFFFF00-|r Fixed the healing done amount on Malkorok encounter.\n\nv2.0.14 (|cFFFFCC00Oct 14, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added pre-potion recognition for WoD pots.\n\n|cFFFFFF00-|r Added spell list for Blackrock Foundry encounters.\n\n|cFFFFFF00-|r Added mouse wheel scroll speed option.\n\n|cFFFFFF00-|r Added support for healing multistrike and damage multistrike.\n\n|cFFFFFF00-|r Added a Change Log button on Options Panel.\n\n|cFFFFFF00-|r When the windows is locked, trying to move the window through toolbar will stretch it instead.\n\n|cFFFFFF00-|r Renamed overheal for shields, now its called 'shield wasted'.\n\n|cFFFFFF00-|r Fine tuning on healing done, should have high accuracy now.\n\n|cFFFFFF00-|r Encounter Details plugin now supports Highmaul and Blackrock Foundry.\n\n|cFFFFFF00-|r New class cooldowns and spells recognition.\n\n|cFFFFFF00-|r Fixed few bugs on comparison panel and avoidance panel.\n\n|cFFFFFF00-|r Fixed encounter recognition, now it should show the encounter name over segments menu.\n\n|cFFFFFF00-|r Fixed Graphic part of Encounter Details Plugin, now he draws more accurately.\n\n|cFFFFFF00v1.29.3 (|cFFFFCC00Oct 11, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an addon crash bug when clicking directly on the sword button.\n\n|cFFFFFF00-|r Removed Flat Skin, added new skin: Serenity.\n\n|cFFFFFF00-|r Fixed many issues with bar animations.\n\n|cFFFFFF00-|r Fixed combat encounter start if the player already is in combat when the boss is pulled.\n\n|cFFFFFF00-|r Fixed wheel scroll when sometimes it move very slow or doesn't move the bars at all.\n\n|cFFFFFF00-|r Added option 'Always Show Me' which when enabled and you aren't at the top ranked players shown in the window, it forces to show you in the last bar.\n\n|cFFFFFF00-|r Added option 'First Hit' which when enabled show who did the first struck in the combat (normally is who pulled the boss).\n\n|cFFFFFF00-|r Added a panel to change class colors.\n\n|cFFFFFF00v1.28.3 (|cFFFFCC00Oct 04, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added support for plugin descriptions on options panel.\n\n|cFFFFFF00-|r Added scale option.\n\n|cFFFFFF00-|r Added a Change Log button on Options Panel.\n\n|cFFFFFF00-|r Added option to use the same profile on all characters without asking.\n\n|cFFFFFF00-|r Added a shortcut color button on main panel on Options Panel." Loc ["STRING_DETAILS1"] = "|cffffaeaeDetails!:|r " diff --git a/core/network.lua b/core/network.lua index 7ba67033..784920cc 100644 --- a/core/network.lua +++ b/core/network.lua @@ -487,6 +487,15 @@ ["Darnassus"] = true, ["Ironforge"] = true, ["TheExodar"] = true, + + ["garrisonffhorde_tier1"] = true, + ["garrisonffhorde_tier2"] = true, + ["garrisonffhorde_tier3"] = true, + + ["garrisonsmvalliance_tier1"] = true, + ["garrisonsmvalliance_tier2"] = true, + ["garrisonsmvalliance_tier3"] = true, + ["garrisonsmvalliance_tier4"] = true, } local sub_zones = { diff --git a/core/parser.lua b/core/parser.lua index fe11462e..8dfe0995 100644 --- a/core/parser.lua +++ b/core/parser.lua @@ -165,10 +165,17 @@ --if (npcId == 76933) then -- return --end + --using pattern, calling API is too slow here - if (alvo_serial:match ("^Creature:0:%d+:%d+:%d+:76933:%w+$")) then + if (alvo_serial:match ("^Creature%-0%-%d+%-%d+%-%d+%-76933%-%w+$")) then return end + + --> Second try with :find + -- it's 20% faster when comparing Npcs serials, but very slow when comparing other things. + --if (alvo_serial:find ("-76933-")) then + -- return + --end ------------------------------------------------------------------------------------------------ --> check if need start an combat @@ -1488,7 +1495,7 @@ end if (jogador_alvo.powertype ~= este_jogador.powertype) then - print ("error: different power types: who -> ", este_jogador.powertype, " target -> ", jogador_alvo.powertype) + --print ("error: different power types: who -> ", este_jogador.powertype, " target -> ", jogador_alvo.powertype) return end diff --git a/core/windows.lua b/core/windows.lua index bf6215db..46cebc64 100644 --- a/core/windows.lua +++ b/core/windows.lua @@ -2042,7 +2042,7 @@ if LDB then local databroker = LDB:NewDataObject ("Details!", { - type = "launcher", + type = "data source", icon = [[Interface\AddOns\Details\images\minimap]], text = "0", diff --git a/functions/slash.lua b/functions/slash.lua index 6bdf9de3..a1e7e737 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -668,8 +668,8 @@ function SlashCmdList.DETAILS (msg, editbox) if (pass_guid == "-") then local guid = UnitGUID ("target") if (guid) then - print (guid.. " -> " .. tonumber (guid:sub(6, 10), 16)) - _detalhes.id_frame.texto:SetText (""..tonumber (guid:sub(6, 10), 16)) + local g = _detalhes:GetNpcIdFromGuid (guid) + _detalhes.id_frame.texto:SetText ("" .. g) _detalhes.id_frame.texto:HighlightText() end diff --git a/plugins/Details_DungeonInfo-Warlords/Details_DungeonInfo-Warlords.lua b/plugins/Details_DungeonInfo-Warlords/Details_DungeonInfo-Warlords.lua index 41e9ef00..5c811287 100644 --- a/plugins/Details_DungeonInfo-Warlords/Details_DungeonInfo-Warlords.lua +++ b/plugins/Details_DungeonInfo-Warlords/Details_DungeonInfo-Warlords.lua @@ -2,11 +2,12 @@ --Bloodmail Slag Mines --The Everbloom --GrimrailDepot ---IronDocks +--IronDocks --ShadowmoonBurialGrounds --Skyreach --UpperBlackrockSpire +--82682 3 everbloom local Auchindoun = { id = 1182, --mapid @@ -51,11 +52,11 @@ local Auchindoun = { _detalhes:InstallEncounter (Auchindoun) -local BloodmailSlagMines = { - id = 0, --mapid +local BloodmaulSlagMines = { + id = 1175, --mapid ej_id = 385, --encounter journal id - name = "Bloodmail Slag Mines", + name = "Bloodmaul Slag Mines", boss_names = { "Slave Watcher Crushto", @@ -92,10 +93,10 @@ local BloodmailSlagMines = { } -_detalhes:InstallEncounter (BloodmailSlagMines) +_detalhes:InstallEncounter (BloodmaulSlagMines) local TheEverbloom = { - id = 0, --mapid + id = 1279, --mapid ej_id = 556, --encounter journal id name = "The Everbloom", @@ -110,9 +111,11 @@ local TheEverbloom = { boss_ids = { [83894] = 1, --Ancient Protectors + [86244] = 1, --Ancient Protectors [86246] = 2, --Archmage Sol [86247] = 3, --Xeri'tac [86242] = 4, --Witherbark + [82682] = 4, --Witherbark [86248] = 5, --Yalnu }, @@ -157,9 +160,10 @@ local GrimrailDepot = { boss_ids = { [86228] = 1, --Skylord Tovra [86225] = 2, --Rocketspark and Borka + [86226] = 2, --Rocketspark and Borka [86227] = 3, --Nitrogg Thundertower }, - + encounters = { [1] = { boss = "Skylord Tovra", @@ -179,7 +183,7 @@ local GrimrailDepot = { _detalhes:InstallEncounter (GrimrailDepot) local IronDocks = { - id = 0, --mapid + id = 1195, --mapid ej_id = 558, --encounter journal id name = "Iron Docks", @@ -194,10 +198,12 @@ local IronDocks = { boss_ids = { [87451] = 1, --Fleshrender Nok'gar [87452] = 2, --Ahri'ok Dugru + [86231] = 2, --Makogg Emberblade + [80808] = 2, --Neesa Nox [86232] = 3, --Oshir [86233] = 4, --Skulloc }, - + encounters = { [1] = { boss = "Fleshrender Nok'gar", @@ -221,7 +227,7 @@ local IronDocks = { _detalhes:InstallEncounter (IronDocks) local ShadowmoonBurialGrounds = { - id = 0, --mapid + id = 1176, --mapid ej_id = 537, --encounter journal id name = "Shadowmoon Burial Grounds", @@ -321,13 +327,16 @@ local UpperBlackrockSpire = { boss_ids = { [86249] = 1, --Orebender Gor'ashan + [76413] = 1, --Orebender Gor'ashan [86250] = 2, --Kyrak + [76021] = 2, --Kyrak [86251] = 3, --Commander Tharbek + [79912] = 3, --Commander Tharbek [76585] = 4, --Ragewing the Untamed [77120] = 5, --Warlord Zaela [77081] = 6, --The Lanticore }, - + encounters = { [1] = { boss = "Orebender Gor'ashan", diff --git a/startup.lua b/startup.lua index 02d45326..11d67fd3 100644 --- a/startup.lua +++ b/startup.lua @@ -489,5 +489,96 @@ function _G._detalhes:Start() end) --]] + --[[ start world map zoom + WorldMapScrollFrame:HookScript ("OnMouseWheel", function() + local HScroll = WorldMapScrollFrame:GetHorizontalScroll() + local VScroll = WorldMapScrollFrame:GetVerticalScroll() + + if (MantainWorldMapZoomH ~= HScroll or MantainWorldMapZoomV ~= VScroll) then + MantainWorldMapZoomMouseX, MantainWorldMapZoomMouseY = GetCursorPosition() + end + MantainWorldMapZoomH = HScroll + MantainWorldMapZoomV = VScroll + MantainWorldMapZoomScale = WorldMapDetailFrame:GetScale(); + end) + + local MAX_ZOOM = 1.495; + + hooksecurefunc ("ToggleWorldMap", function() + + if (WorldMapFrame:IsShown()) then + + if ((MantainWorldMapZoomV and MantainWorldMapZoomH) and (MantainWorldMapZoomH ~= 0 or MantainWorldMapZoomV ~= 0)) then + + local last_opened = MantainWorldMapZoomLastOpened or time() + MantainWorldMapZoomLastOpened = time() + + if (last_opened+60 < time()) then + WorldMapScrollFrame_ResetZoom() + MantainWorldMapZoomMouseX, MantainWorldMapZoomMouseY = nil, nil + MantainWorldMapZoomH = nil + MantainWorldMapZoomV = nil + MantainWorldMapZoomScale = nil + return + end + + local scrollFrame = WorldMapScrollFrame; + local oldScrollH = MantainWorldMapZoomH + local oldScrollV = MantainWorldMapZoomV + + -- get the mouse position on the frame, with 0,0 at top left + local cursorX, cursorY = MantainWorldMapZoomMouseX, MantainWorldMapZoomMouseY + local relativeFrame; + if ( WorldMapFrame_InWindowedMode() ) then + relativeFrame = UIParent; + else + relativeFrame = WorldMapFrame; + end + local frameX = cursorX / relativeFrame:GetScale() - scrollFrame:GetLeft(); + local frameY = scrollFrame:GetTop() - cursorY / relativeFrame:GetScale(); + + local oldScale = WorldMapDetailFrame:GetScale(); + --local newScale = oldScale + delta * 0.3; + local newScale = MantainWorldMapZoomScale + newScale = max(WORLDMAP_SETTINGS.size, newScale); + newScale = min(MAX_ZOOM, newScale); + WorldMapDetailFrame:SetScale(newScale); + QUEST_POI_FRAME_WIDTH = WorldMapDetailFrame:GetWidth() * newScale; + QUEST_POI_FRAME_HEIGHT = WorldMapDetailFrame:GetHeight() * newScale; + + scrollFrame.maxX = QUEST_POI_FRAME_WIDTH - 1002 * WORLDMAP_SETTINGS.size; + scrollFrame.maxY = QUEST_POI_FRAME_HEIGHT - 668 * WORLDMAP_SETTINGS.size; + scrollFrame.zoomedIn = abs(WorldMapDetailFrame:GetScale() - WORLDMAP_SETTINGS.size) > 0.05; + scrollFrame.continent = GetCurrentMapContinent(); + scrollFrame.mapID = GetCurrentMapAreaID(); + + -- figure out new scroll values + local scaleChange = newScale / oldScale; + local newScrollH = scaleChange * ( frameX + oldScrollH ) - frameX; + local newScrollV = scaleChange * ( frameY + oldScrollV ) - frameY; + -- clamp scroll values + newScrollH = min(newScrollH, scrollFrame.maxX); + newScrollH = max(0, newScrollH); + newScrollV = min(newScrollV, scrollFrame.maxY); + newScrollV = max(0, newScrollV); + + -- set scroll values + scrollFrame:SetHorizontalScroll(oldScrollH); + scrollFrame:SetVerticalScroll(oldScrollV); + + WorldMapFrame_Update(); + WorldMapScrollFrame_ReanchorQuestPOIs(); + WorldMapBlobFrame_ResetHitTranslations(); + WorldMapBlobFrame_DelayedUpdateBlobs(); + + + end + else + MantainWorldMapZoomLastOpened = time() + end + end) + + --]] + end