Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RareScanner support for Retail Carbonite #7

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions 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"
4 changes: 4 additions & 0 deletions Locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,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 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 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 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 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 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"
4 changes: 4 additions & 0 deletions 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 Locales/ruRU.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"] = "Показывать на карте отметки плагина 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 Notes"
L["NxTOGGLEFAV"] = "show/hide Notes"
4 changes: 4 additions & 0 deletions 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 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: 135 additions & 4 deletions 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 @@ -77,7 +79,7 @@ local function notesConfig()
return Nx.fdb.profile.Notes.HandyNotes
end,
set = function()
local map = Nx.Map:GetMap (1)
local map = Nx.Map:GetMap (1)
Nx.fdb.profile.Notes.HandyNotes = not Nx.fdb.profile.Notes.HandyNotes
if Nx.fdb.profile.Notes.HandyNotes then
Nx.Notes:HandyNotes(Nx.Map:GetCurrentMapAreaID())
Expand All @@ -96,15 +98,15 @@ local function notesConfig()
order = 3,
type = "range",
width = "normal",
min = 10,
min = 10,
max = 60,
step = 5,
name = L["Handnotes Icon Size"],
get = function()
return Nx.fdb.profile.Notes.HandyNotesSize
end,
set = function(input,value)
local map = Nx.Map:GetMap (1)
local map = Nx.Map:GetMap (1)
Nx.fdb.profile.Notes.HandyNotesSize = value
map:ClearIconType("!HANDY")
Nx.Notes:HandyNotes(Nx.Map:GetCurrentMapAreaID())
Expand All @@ -116,6 +118,55 @@ local function notesConfig()
return true
end,
},
rarescanner = {
order = 4,
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")
end
end,
disabled = function()
if RareScanner then
return false
end
return true
end,
},
raresize = {
order = 5,
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")
Nx.Notes:RareScanner(Nx.Map:GetCurrentMapAreaID())
end,
disabled = function()
if RareScanner then
return false
end
return true
end,
},
},
}
end
Expand All @@ -128,7 +179,7 @@ function CarboniteNotes:OnInitialize()
CarbNotesInit = Nx:ScheduleTimer(CarboniteNotes.OnInitialize,1)
return
end
Nx.fdb = LibStub("AceDB-3.0"):New("NXNotes",defaults, true)
Nx.fdb = LibStub("AceDB-3.0"):New("NXNotes",defaults, true)
Nx.Notes:Init()
CarboniteNotes:RegisterComm("carbmodule",Nx.Notes.OnChat_msg_addon)
local function func()
Expand Down Expand Up @@ -1516,6 +1567,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 @@ -1593,6 +1645,85 @@ 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 = {}

WorldMapFrame:RefreshAll(true)

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)

for _,rspin in ipairs(rspins) do
if rspin.POI then
if rspin.POI.mapID == map.MapId then
local x = rspin.normalizedX * 100
local y = rspin.normalizedY * 100
local texture = rspin.Texture:GetTexture()
if not texture then
texture = rspin.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 rsnote = map:AddIconPt("!RSR", wx, wy, level, "FFFFFF", texture)
local tooltip = rspin.POI.name
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 rsnote = map:AddIconPt("!RSR", wx, wy, level, color, texture)
local tooltip = rspin.pin.POI.name
map:SetIconTip(rsnote,tooltip)
map:SetIconUserData(rsnote, rspin.pin)
end
end
end
end
end
end

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

function Nx.Notes:OnButToggleFav (but)
Expand Down