Skip to content

Commit

Permalink
Merge pull request #373 from artscout/master
Browse files Browse the repository at this point in the history
RareScanner support (#262)
  • Loading branch information
IrcDirk authored Jul 18, 2024
2 parents 8cafe2e + ebb9728 commit fa26f66
Show file tree
Hide file tree
Showing 14 changed files with 208 additions and 17 deletions.
5 changes: 5 additions & 0 deletions Carbonite.Notes/Locales/deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 6 additions & 0 deletions Carbonite.Notes/Locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"


4 changes: 4 additions & 0 deletions Carbonite.Notes/Locales/esES.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 4 additions & 0 deletions Carbonite.Notes/Locales/esMX.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 4 additions & 0 deletions Carbonite.Notes/Locales/frFR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 4 additions & 0 deletions Carbonite.Notes/Locales/itIT.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 4 additions & 0 deletions Carbonite.Notes/Locales/koKR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
28 changes: 14 additions & 14 deletions Carbonite.Notes/Locales/locales.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\..\FrameXML\UI.xsd">
<Include file="enUS.lua"/>
<Include file="deDE.lua"/>
<Include file="esES.lua"/>
<Include file="esMX.lua"/>
<Include file="frFR.lua"/>
<Include file="itIT.lua"/>
<Include file="koKR.lua"/>
<Include file="ptBR.lua"/>
<Include file="ruRU.lua"/>
<Include file="zhTW.lua"/>
<Include file="zhCN.lua"/>
</Ui>
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\..\FrameXML\UI.xsd">
<Include file="enUS.lua"/>
<Include file="deDE.lua"/>
<Include file="esES.lua"/>
<Include file="esMX.lua"/>
<Include file="frFR.lua"/>
<Include file="itIT.lua"/>
<Include file="koKR.lua"/>
<Include file="ptBR.lua"/>
<Include file="ruRU.lua"/>
<Include file="zhTW.lua"/>
<Include file="zhCN.lua"/>
</Ui>
4 changes: 4 additions & 0 deletions Carbonite.Notes/Locales/ptBR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 4 additions & 0 deletions Carbonite.Notes/Locales/ruRU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = "Показать/Скрыть Заметки"
4 changes: 4 additions & 0 deletions Carbonite.Notes/Locales/zhCN.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = "显示/隐藏标记"
4 changes: 4 additions & 0 deletions Carbonite.Notes/Locales/zhTW.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
139 changes: 138 additions & 1 deletion Carbonite.Notes/NxFav.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ local defaults = {
ShowMap = true,
HandyNotes = true,
HandyNotesSize = 15,
RareScanner = true,
RareScannerSize = 32,
},
Addons = {
},
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1521,6 +1574,7 @@ function Nx.Notes:UpdateIcons()
end
end
Nx.Notes:HandyNotes(mapId)
Nx.Notes:RareScanner(mapId)
--WorldMap_HijackTooltip(map.Frm)
GameTooltip:Hide()
end
Expand Down Expand Up @@ -1566,7 +1620,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)
Expand Down Expand Up @@ -1604,6 +1658,89 @@ function Nx.Notes:HandyNotes(mapId)
end
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
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 level = nil

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)
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
end

---------------------------------------------------------------------------------------

function Nx.Notes:OnButToggleFav (but)
Expand Down
11 changes: 9 additions & 2 deletions Carbonite/NxMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ function Nx.Map:Init()
self.Maps = {}
self.Created = false

self.RareScannerOverlays = {}

self:InitFuncs()
self:InitTables()

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit fa26f66

Please sign in to comment.