From e2700dd37f741b1d6d5e9904af309e6610331c53 Mon Sep 17 00:00:00 2001 From: Albert Valiev Date: Thu, 18 Jul 2024 03:54:04 +0200 Subject: [PATCH 1/4] RareScanner support --- Carbonite.Notes/NxFav.lua | 89 ++++++++++++++++++++++++++++++++++++++- Carbonite/Carbonite.lua | 1 + Carbonite/NxMap.lua | 11 ++++- 3 files changed, 98 insertions(+), 3 deletions(-) diff --git a/Carbonite.Notes/NxFav.lua b/Carbonite.Notes/NxFav.lua index c13efd7..5019926 100644 --- a/Carbonite.Notes/NxFav.lua +++ b/Carbonite.Notes/NxFav.lua @@ -1521,6 +1521,7 @@ function Nx.Notes:UpdateIcons() end end Nx.Notes:HandyNotes(mapId) + Nx.Notes:RareScanner(mapId) --WorldMap_HijackTooltip(map.Frm) GameTooltip:Hide() end @@ -1566,7 +1567,7 @@ function Nx.Notes:HandyNotes(mapId) end else texture = iconpath - end + end local icon = CreateFrame("Frame", "HandyCarb", UIParent) local tmpFrame = WorldMapFrame:GetCanvas() icon:SetParent(tmpFrame) @@ -1604,6 +1605,92 @@ function Nx.Notes:HandyNotes(mapId) end end +function Nx.Notes:RareScanner(mapId) + + if not RareScanner then + return + end + + rspins = {} + + local FROM_ON_SHOW = true + WorldMapFrame:RefreshAll(FROM_ON_SHOW) + + for pin in WorldMapFrame:EnumeratePinsByTemplate("RSEntityPinTemplate") do + rspins[#rspins + 1] = pin + end + + for pin in WorldMapFrame:EnumeratePinsByTemplate("RSOverlayTemplate") do + rspins[#rspins + 1] = pin + end + + local map = Nx.Map:GetMap (1) + local level = nil --"PIN_FRAME_LEVEL_AREA_POI" + + map:InitIconType ("!RSR", "WP", "", 36, 36) + map:SetIconTypeChop ("!RSR", true) + map:SetIconTypeLevel ("!RSR", 20) + + map:InitIconType ("!RSRC", "WP", "", 36, 36) + map:SetIconTypeChop ("!RSRC", true) + map:SetIconTypeLevel ("!RSRC", 20) + + for _,rspin in ipairs(rspins) do + if rspin.POI then + if rspin.POI.mapID == map.MapId then + local x = rspin.POI.x / 100 + local y = rspin.POI.y / 100 + local texture = rspin.POI.Texture + local scale = rspin.startScale + local wx, wy = Nx.Map:GetWorldPos(mapId,x,y) + local icon = CreateFrame("Button", "RSCarb", UIParent) + local tmpFrame = WorldMapFrame:GetCanvas() + icon:SetParent(tmpFrame) + icon:ClearAllPoints() + icon:SetHeight(scale) + icon:SetWidth(scale) + icon:SetPoint("CENTER", tmpFrame, "TOPLEFT", x*tmpFrame:GetWidth(), -y*tmpFrame:GetHeight()) + local tooltip = rspin.POI.name + local tooltipName = "GameTooltip" + local rsnote = map:AddIconPt("!RSR", wx, wy, level, "FFFFFF", texture) + map:SetIconTip(rsnote,tooltip) + map:SetIconUserData(rsnote, rspin) + end + else + if rspin.pin.POI.mapID == map.MapId then + local x = rspin.normalizedX * 100 + local y = rspin.normalizedY * 100 + if (rspin.normalizedX ~= rspin.pin.normalizedX or rspin.normalizedY ~= rspin.pin.normalizedY) then + local texture = rspin.Texture:GetTexture() + local colr, colg, colb = rspin.Texture:GetVertexColor() + local color = "FFFFFF" + if colr and colg and colb then + IconColor = CreateColor(colr, colg, colb) + color = IconColor:GenerateHexColor() + end + if not texture then + texture = rspin.pin.POI.Texture + end + local scale = rspin.startScale + local wx, wy = Nx.Map:GetWorldPos(mapId,x,y) + local icon = CreateFrame("Button", "RSCarb", UIParent) + local tmpFrame = WorldMapFrame:GetCanvas() + icon:SetParent(tmpFrame) + icon:ClearAllPoints() + icon:SetHeight(scale) + icon:SetWidth(scale) + icon:SetPoint("CENTER", tmpFrame, "TOPLEFT", x*tmpFrame:GetWidth(), -y*tmpFrame:GetHeight()) + local tooltip = rspin.pin.POI.name + local tooltipName = "GameTooltip" + local rsnote = map:AddIconPt("!RSRC", wx, wy, level, color, texture) + map:SetIconTip(rsnote,tooltip) + map:SetIconUserData(rsnote, rspin) + end + end + end + end +end + --------------------------------------------------------------------------------------- function Nx.Notes:OnButToggleFav (but) diff --git a/Carbonite/Carbonite.lua b/Carbonite/Carbonite.lua index ec3992f..d4fc4e6 100644 --- a/Carbonite/Carbonite.lua +++ b/Carbonite/Carbonite.lua @@ -103,6 +103,7 @@ Nx.Map = {} Nx.Map.Dock = {} Nx.Map.Guide = {} Nx.Map.Guide.PlayerTargets = {} +Nx.Map.RareScannerOverlays = {} Nx.Travel = {} diff --git a/Carbonite/NxMap.lua b/Carbonite/NxMap.lua index b20bc90..9d44d7c 100644 --- a/Carbonite/NxMap.lua +++ b/Carbonite/NxMap.lua @@ -149,6 +149,8 @@ function Nx.Map:Init() self.Maps = {} self.Created = false + self.RareScannerOverlays = {} + self:InitFuncs() self:InitTables() @@ -8601,7 +8603,6 @@ function Nx.Map:IconOnMouseDown (button) map.ClickFrm = this map.ClickType = this.NXType map.ClickIcon = this.NXData - local shift = IsShiftKeyDown() if button == "LeftButton" then @@ -8638,7 +8639,13 @@ function Nx.Map:IconOnMouseDown (button) end else - map.OnMouseDown (map.Frm, button) + if map.ClickIcon.iconType == "!RSR" and RareScanner then + local rspin = this.NXData.UData + rspin:OnMouseDown(button) + Nx.Notes:RareScanner(map.MapId) + else + map.OnMouseDown (map.Frm, button) + end end end From e1507d989449b44ac634cd8d18036b242de5ed36 Mon Sep 17 00:00:00 2001 From: Albert Valiev Date: Thu, 18 Jul 2024 03:55:41 +0200 Subject: [PATCH 2/4] remove unneeded variable --- Carbonite/Carbonite.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/Carbonite/Carbonite.lua b/Carbonite/Carbonite.lua index d4fc4e6..ec3992f 100644 --- a/Carbonite/Carbonite.lua +++ b/Carbonite/Carbonite.lua @@ -103,7 +103,6 @@ Nx.Map = {} Nx.Map.Dock = {} Nx.Map.Guide = {} Nx.Map.Guide.PlayerTargets = {} -Nx.Map.RareScannerOverlays = {} Nx.Travel = {} From 555e772c208cc306d2cac98c33dd38b79bf24ffe Mon Sep 17 00:00:00 2001 From: Albert Valiev Date: Thu, 18 Jul 2024 04:27:22 +0200 Subject: [PATCH 3/4] Add settings for RareScanner icons --- Carbonite.Notes/Locales/deDE.lua | 5 + Carbonite.Notes/Locales/enUS.lua | 6 + Carbonite.Notes/Locales/esES.lua | 4 + Carbonite.Notes/Locales/esMX.lua | 4 + Carbonite.Notes/Locales/frFR.lua | 4 + Carbonite.Notes/Locales/itIT.lua | 4 + Carbonite.Notes/Locales/koKR.lua | 4 + Carbonite.Notes/Locales/locales.xml | 28 ++--- Carbonite.Notes/Locales/ptBR.lua | 4 + Carbonite.Notes/Locales/ruRU.lua | 4 + Carbonite.Notes/Locales/zhCN.lua | 4 + Carbonite.Notes/Locales/zhTW.lua | 4 + Carbonite.Notes/NxFav.lua | 175 ++++++++++++++++++---------- 13 files changed, 174 insertions(+), 76 deletions(-) diff --git a/Carbonite.Notes/Locales/deDE.lua b/Carbonite.Notes/Locales/deDE.lua index a8fb19c..3607fbe 100644 --- a/Carbonite.Notes/Locales/deDE.lua +++ b/Carbonite.Notes/Locales/deDE.lua @@ -44,6 +44,11 @@ L["Reset old notes data"] = "Alte Notizdaten zur\195\188cksetzen" L["Display Handynotes On Map"] = "HandyNotes auf der Karte anzeigen" L["If you have HandyNotes installed, allows them on the Carbonite map"] = "Falls das Addon HandyNotes installiert ist, werden sie Auf der Carbonite Karte angezeigt" L["Handnotes Icon Size"] = "HandyNotes Symbolgr\195\182\195\159e" + +L["Display RareScanner icons On Map"] = true +L["If you have RareScanner installed, allows it's icons on the Carbonite map"] = true +L["RareScanner Icon Size"] = true + -- Keybinds L["Carbonite Notes"] = "Carbonite Notizen" L["NxTOGGLEFAV"] = "Notizen ein/ausblenden" diff --git a/Carbonite.Notes/Locales/enUS.lua b/Carbonite.Notes/Locales/enUS.lua index 3a4c121..d54ff04 100644 --- a/Carbonite.Notes/Locales/enUS.lua +++ b/Carbonite.Notes/Locales/enUS.lua @@ -41,6 +41,12 @@ L["Display Handynotes On Map"] = true L["If you have HandyNotes installed, allows them on the Carbonite map"] = true L["Handnotes Icon Size"] = true +L["Display RareScanner icons On Map"] = true +L["If you have RareScanner installed, allows it's icons on the Carbonite map"] = true +L["RareScanner Icon Size"] = true + -- Keybinds L["Carbonite Notes"] = "Carbonite Notes" L["NxTOGGLEFAV"] = "show/hide Notes" + + diff --git a/Carbonite.Notes/Locales/esES.lua b/Carbonite.Notes/Locales/esES.lua index 9cd1a1a..fb9a22e 100644 --- a/Carbonite.Notes/Locales/esES.lua +++ b/Carbonite.Notes/Locales/esES.lua @@ -45,6 +45,10 @@ L["Display Handynotes On Map"] = true L["If you have HandyNotes installed, allows them on the Carbonite map"] = true L["Handnotes Icon Size"] = true +L["Display RareScanner icons On Map"] = true +L["If you have RareScanner installed, allows it's icons on the Carbonite map"] = true +L["RareScanner Icon Size"] = true + -- Keybinds L["Carbonite Notes"] = "Carbonite Notes" L["NxTOGGLEFAV"] = "show/hide Notes" diff --git a/Carbonite.Notes/Locales/esMX.lua b/Carbonite.Notes/Locales/esMX.lua index 6864070..05692e0 100644 --- a/Carbonite.Notes/Locales/esMX.lua +++ b/Carbonite.Notes/Locales/esMX.lua @@ -45,6 +45,10 @@ L["Display Handynotes On Map"] = true L["If you have HandyNotes installed, allows them on the Carbonite map"] = true L["Handnotes Icon Size"] = true +L["Display RareScanner icons On Map"] = true +L["If you have RareScanner installed, allows it's icons on the Carbonite map"] = true +L["RareScanner Icon Size"] = true + -- Keybinds L["Carbonite Notes"] = "Carbonite Notes" L["NxTOGGLEFAV"] = "show/hide Notes" diff --git a/Carbonite.Notes/Locales/frFR.lua b/Carbonite.Notes/Locales/frFR.lua index 5b1744b..899870a 100644 --- a/Carbonite.Notes/Locales/frFR.lua +++ b/Carbonite.Notes/Locales/frFR.lua @@ -45,6 +45,10 @@ L["Display Handynotes On Map"] = "Afficher Handynotes sur la Map" L["If you have HandyNotes installed, allows them on the Carbonite map"] = "Si vous avez Handynotes install\195\169, autorise celui-ci \195\160 afficher sur la map Carbonite" L["Handnotes Icon Size"] = "Taille de l'ic\195\180ne Handynotes" +L["Display RareScanner icons On Map"] = true +L["If you have RareScanner installed, allows it's icons on the Carbonite map"] = true +L["RareScanner Icon Size"] = true + -- Keybinds L["Carbonite Notes"] = "Carbonite Notes" L["NxTOGGLEFAV"] = "Afficher/Cacher Notes" diff --git a/Carbonite.Notes/Locales/itIT.lua b/Carbonite.Notes/Locales/itIT.lua index b680e7e..09110cb 100644 --- a/Carbonite.Notes/Locales/itIT.lua +++ b/Carbonite.Notes/Locales/itIT.lua @@ -45,6 +45,10 @@ L["Display Handynotes On Map"] = true L["If you have HandyNotes installed, allows them on the Carbonite map"] = true L["Handnotes Icon Size"] = true +L["Display RareScanner icons On Map"] = true +L["If you have RareScanner installed, allows it's icons on the Carbonite map"] = true +L["RareScanner Icon Size"] = true + -- Keybinds L["Carbonite Notes"] = "Note Carbonite" L["NxTOGGLEFAV"] = "mostra/nascondi Note" diff --git a/Carbonite.Notes/Locales/koKR.lua b/Carbonite.Notes/Locales/koKR.lua index 5717230..0e179d6 100644 --- a/Carbonite.Notes/Locales/koKR.lua +++ b/Carbonite.Notes/Locales/koKR.lua @@ -45,6 +45,10 @@ L["Display Handynotes On Map"] = true L["If you have HandyNotes installed, allows them on the Carbonite map"] = true L["Handnotes Icon Size"] = true +L["Display RareScanner icons On Map"] = true +L["If you have RareScanner installed, allows it's icons on the Carbonite map"] = true +L["RareScanner Icon Size"] = true + -- Keybinds L["Carbonite Notes"] = "Carbonite Notes" L["NxTOGGLEFAV"] = "show/hide Notes" diff --git a/Carbonite.Notes/Locales/locales.xml b/Carbonite.Notes/Locales/locales.xml index 11a90c8..5e22d36 100644 --- a/Carbonite.Notes/Locales/locales.xml +++ b/Carbonite.Notes/Locales/locales.xml @@ -1,14 +1,14 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/Carbonite.Notes/Locales/ptBR.lua b/Carbonite.Notes/Locales/ptBR.lua index d180b03..0b2b0b8 100644 --- a/Carbonite.Notes/Locales/ptBR.lua +++ b/Carbonite.Notes/Locales/ptBR.lua @@ -45,6 +45,10 @@ L["Display Handynotes On Map"] = true L["If you have HandyNotes installed, allows them on the Carbonite map"] = true L["Handnotes Icon Size"] = true +L["Display RareScanner icons On Map"] = true +L["If you have RareScanner installed, allows it's icons on the Carbonite map"] = true +L["RareScanner Icon Size"] = true + -- Keybinds L["Carbonite Notes"] = "Carbonite Notes" L["NxTOGGLEFAV"] = "show/hide Notes" diff --git a/Carbonite.Notes/Locales/ruRU.lua b/Carbonite.Notes/Locales/ruRU.lua index fff69cd..8436e2d 100644 --- a/Carbonite.Notes/Locales/ruRU.lua +++ b/Carbonite.Notes/Locales/ruRU.lua @@ -45,6 +45,10 @@ L["Display Handynotes On Map"] = "Показывать на карте отме L["If you have HandyNotes installed, allows them on the Carbonite map"] = "Если у вас установлен плагин HandyNotes, то включение этого параметра отобразит иконки HandyNotes на карте" L["Handnotes Icon Size"] = "Размер иконки HandyNotes" +L["Display RareScanner icons On Map"] = "Показывать на карте отметки плагина RareScanner" +L["If you have RareScanner installed, allows it's icons on the Carbonite map"] = "Если у вас установлен плагин RareScanner, то включение этого параметра отобразит иконки RareScanner на карте" +L["RareScanner Icon Size"] = "Размер иконки RareScanner" + -- Keybinds L["Carbonite Notes"] = "Заметки Carbonite" L["NxTOGGLEFAV"] = "Показать/Скрыть Заметки" diff --git a/Carbonite.Notes/Locales/zhCN.lua b/Carbonite.Notes/Locales/zhCN.lua index 2d593ce..264de71 100644 --- a/Carbonite.Notes/Locales/zhCN.lua +++ b/Carbonite.Notes/Locales/zhCN.lua @@ -41,6 +41,10 @@ L["Display Handynotes On Map"] = "地图上显示Handynotes" L["If you have HandyNotes installed, allows them on the Carbonite map"] = "允许Handynotes图标显示在Carbonite地图上" L["Handnotes Icon Size"] = "Handynotes图标大小" +L["Display RareScanner icons On Map"] = true +L["If you have RareScanner installed, allows it's icons on the Carbonite map"] = true +L["RareScanner Icon Size"] = true + -- Keybinds L["Carbonite Notes"] = "Carbonite 标记模块" L["NxTOGGLEFAV"] = "显示/隐藏标记" diff --git a/Carbonite.Notes/Locales/zhTW.lua b/Carbonite.Notes/Locales/zhTW.lua index 0c60dc6..80c267e 100644 --- a/Carbonite.Notes/Locales/zhTW.lua +++ b/Carbonite.Notes/Locales/zhTW.lua @@ -45,6 +45,10 @@ L["Display Handynotes On Map"] = true L["If you have HandyNotes installed, allows them on the Carbonite map"] = true L["Handnotes Icon Size"] = true +L["Display RareScanner icons On Map"] = true +L["If you have RareScanner installed, allows it's icons on the Carbonite map"] = true +L["RareScanner Icon Size"] = true + -- Keybinds L["Carbonite Notes"] = "Carbonite Notes" L["NxTOGGLEFAV"] = "show/hide Notes" diff --git a/Carbonite.Notes/NxFav.lua b/Carbonite.Notes/NxFav.lua index 5019926..de170ad 100644 --- a/Carbonite.Notes/NxFav.lua +++ b/Carbonite.Notes/NxFav.lua @@ -41,6 +41,8 @@ local defaults = { ShowMap = true, HandyNotes = true, HandyNotesSize = 15, + RareScanner = true, + RareScannerSize = 32, }, Addons = { }, @@ -116,6 +118,57 @@ local function notesConfig() return true end, }, + rarescanner = { + order = 2, + type = "toggle", + width = "full", + name = L["Display RareScanner icons On Map"], + desc = L["If you have RareScanner installed, allows it's icons on the Carbonite map"], + get = function() + return Nx.fdb.profile.Notes.RareScanner + end, + set = function() + local map = Nx.Map:GetMap (1) + Nx.fdb.profile.Notes.RareScanner = not Nx.fdb.profile.Notes.RareScanner + if Nx.fdb.profile.Notes.RareScanner then + Nx.Notes:RareScanner(Nx.Map:GetCurrentMapAreaID()) + else + map:ClearIconType("!RSR") + map:ClearIconType("!RSRC") + end + end, + disabled = function() + if RareScanner then + return false + end + return true + end, + }, + raresize = { + order = 3, + type = "range", + width = "normal", + min = 10, + max = 60, + step = 5, + name = L["RareScanner Icon Size"], + get = function() + return Nx.fdb.profile.Notes.RareScannerSize + end, + set = function(input,value) + local map = Nx.Map:GetMap (1) + Nx.fdb.profile.Notes.RareScannerSize = value + map:ClearIconType("!RSR") + map:ClearIconType("!RSRC") + Nx.Notes:RareScanner(Nx.Map:GetCurrentMapAreaID()) + end, + disabled = function() + if RareScanner then + return false + end + return true + end, + }, }, } end @@ -1606,71 +1659,38 @@ function Nx.Notes:HandyNotes(mapId) end function Nx.Notes:RareScanner(mapId) + if (Nx.fdb.profile.Notes.RareScanner and RareScanner) then - if not RareScanner then - return - end - - rspins = {} + rspins = {} - local FROM_ON_SHOW = true - WorldMapFrame:RefreshAll(FROM_ON_SHOW) + local FROM_ON_SHOW = true + WorldMapFrame:RefreshAll(FROM_ON_SHOW) - for pin in WorldMapFrame:EnumeratePinsByTemplate("RSEntityPinTemplate") do - rspins[#rspins + 1] = pin - end + for pin in WorldMapFrame:EnumeratePinsByTemplate("RSEntityPinTemplate") do + rspins[#rspins + 1] = pin + end - for pin in WorldMapFrame:EnumeratePinsByTemplate("RSOverlayTemplate") do - rspins[#rspins + 1] = pin - end + for pin in WorldMapFrame:EnumeratePinsByTemplate("RSOverlayTemplate") do + rspins[#rspins + 1] = pin + end - local map = Nx.Map:GetMap (1) - local level = nil --"PIN_FRAME_LEVEL_AREA_POI" - - map:InitIconType ("!RSR", "WP", "", 36, 36) - map:SetIconTypeChop ("!RSR", true) - map:SetIconTypeLevel ("!RSR", 20) - - map:InitIconType ("!RSRC", "WP", "", 36, 36) - map:SetIconTypeChop ("!RSRC", true) - map:SetIconTypeLevel ("!RSRC", 20) - - for _,rspin in ipairs(rspins) do - if rspin.POI then - if rspin.POI.mapID == map.MapId then - local x = rspin.POI.x / 100 - local y = rspin.POI.y / 100 - local texture = rspin.POI.Texture - local scale = rspin.startScale - local wx, wy = Nx.Map:GetWorldPos(mapId,x,y) - local icon = CreateFrame("Button", "RSCarb", UIParent) - local tmpFrame = WorldMapFrame:GetCanvas() - icon:SetParent(tmpFrame) - icon:ClearAllPoints() - icon:SetHeight(scale) - icon:SetWidth(scale) - icon:SetPoint("CENTER", tmpFrame, "TOPLEFT", x*tmpFrame:GetWidth(), -y*tmpFrame:GetHeight()) - local tooltip = rspin.POI.name - local tooltipName = "GameTooltip" - local rsnote = map:AddIconPt("!RSR", wx, wy, level, "FFFFFF", texture) - map:SetIconTip(rsnote,tooltip) - map:SetIconUserData(rsnote, rspin) - end - else - if rspin.pin.POI.mapID == map.MapId then - local x = rspin.normalizedX * 100 - local y = rspin.normalizedY * 100 - if (rspin.normalizedX ~= rspin.pin.normalizedX or rspin.normalizedY ~= rspin.pin.normalizedY) then - local texture = rspin.Texture:GetTexture() - local colr, colg, colb = rspin.Texture:GetVertexColor() - local color = "FFFFFF" - if colr and colg and colb then - IconColor = CreateColor(colr, colg, colb) - color = IconColor:GenerateHexColor() - end - if not texture then - texture = rspin.pin.POI.Texture - end + local map = Nx.Map:GetMap (1) + local level = nil --"PIN_FRAME_LEVEL_AREA_POI" + + map:InitIconType ("!RSR", "WP", "", Nx.fdb.profile.Notes.RareScannerSize or 32, Nx.fdb.profile.Notes.RareScannerSize or 32) + map:SetIconTypeChop ("!RSR", true) + map:SetIconTypeLevel ("!RSR", 20) + + map:InitIconType ("!RSRC", "WP", "", Nx.fdb.profile.Notes.RareScannerSize or 32, Nx.fdb.profile.Notes.RareScannerSize or 32) + map:SetIconTypeChop ("!RSRC", true) + map:SetIconTypeLevel ("!RSRC", 20) + + for _,rspin in ipairs(rspins) do + if rspin.POI then + if rspin.POI.mapID == map.MapId then + local x = rspin.POI.x / 100 + local y = rspin.POI.y / 100 + local texture = rspin.POI.Texture local scale = rspin.startScale local wx, wy = Nx.Map:GetWorldPos(mapId,x,y) local icon = CreateFrame("Button", "RSCarb", UIParent) @@ -1680,12 +1700,43 @@ function Nx.Notes:RareScanner(mapId) icon:SetHeight(scale) icon:SetWidth(scale) icon:SetPoint("CENTER", tmpFrame, "TOPLEFT", x*tmpFrame:GetWidth(), -y*tmpFrame:GetHeight()) - local tooltip = rspin.pin.POI.name + local tooltip = rspin.POI.name local tooltipName = "GameTooltip" - local rsnote = map:AddIconPt("!RSRC", wx, wy, level, color, texture) + local rsnote = map:AddIconPt("!RSR", wx, wy, level, "FFFFFF", texture) map:SetIconTip(rsnote,tooltip) map:SetIconUserData(rsnote, rspin) end + else + if rspin.pin.POI.mapID == map.MapId then + local x = rspin.normalizedX * 100 + local y = rspin.normalizedY * 100 + if (rspin.normalizedX ~= rspin.pin.normalizedX or rspin.normalizedY ~= rspin.pin.normalizedY) then + local texture = rspin.Texture:GetTexture() + local colr, colg, colb = rspin.Texture:GetVertexColor() + local color = "FFFFFF" + if colr and colg and colb then + IconColor = CreateColor(colr, colg, colb) + color = IconColor:GenerateHexColor() + end + if not texture then + texture = rspin.pin.POI.Texture + end + local scale = rspin.startScale + local wx, wy = Nx.Map:GetWorldPos(mapId,x,y) + local icon = CreateFrame("Button", "RSCarb", UIParent) + local tmpFrame = WorldMapFrame:GetCanvas() + icon:SetParent(tmpFrame) + icon:ClearAllPoints() + icon:SetHeight(scale) + icon:SetWidth(scale) + icon:SetPoint("CENTER", tmpFrame, "TOPLEFT", x*tmpFrame:GetWidth(), -y*tmpFrame:GetHeight()) + local tooltip = rspin.pin.POI.name + local tooltipName = "GameTooltip" + local rsnote = map:AddIconPt("!RSRC", wx, wy, level, color, texture) + map:SetIconTip(rsnote,tooltip) + map:SetIconUserData(rsnote, rspin) + end + end end end end From ebb9728619ab610ac16f755400e2621cd34aaed7 Mon Sep 17 00:00:00 2001 From: Albert Valiev Date: Thu, 18 Jul 2024 04:30:43 +0200 Subject: [PATCH 4/4] rearrange code --- Carbonite.Notes/NxFav.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Carbonite.Notes/NxFav.lua b/Carbonite.Notes/NxFav.lua index de170ad..81fad19 100644 --- a/Carbonite.Notes/NxFav.lua +++ b/Carbonite.Notes/NxFav.lua @@ -1659,8 +1659,8 @@ function Nx.Notes:HandyNotes(mapId) end function Nx.Notes:RareScanner(mapId) + local map = Nx.Map:GetMap (1) if (Nx.fdb.profile.Notes.RareScanner and RareScanner) then - rspins = {} local FROM_ON_SHOW = true @@ -1673,9 +1673,8 @@ function Nx.Notes:RareScanner(mapId) for pin in WorldMapFrame:EnumeratePinsByTemplate("RSOverlayTemplate") do rspins[#rspins + 1] = pin end - - local map = Nx.Map:GetMap (1) - local level = nil --"PIN_FRAME_LEVEL_AREA_POI" + + local level = nil map:InitIconType ("!RSR", "WP", "", Nx.fdb.profile.Notes.RareScannerSize or 32, Nx.fdb.profile.Notes.RareScannerSize or 32) map:SetIconTypeChop ("!RSR", true)