/branches
------------------------------------------------------------------------------------------- |
-- WANT TO CHANGE THE STYLE OF THE MINIMAP BLIPS? -- |
------------------------------------------------------------------------------------------- |
--file path to blip textures (2 styles are included with this addon, or you can find/create your own.) |
--If you like the default blips instead, then use "Interface\\Minimap\\OBJECTICONS.blp" |
local blips = "Interface\\AddOns\\PocketPlot\\media\\PPblips2.blp" |
------------------------------------------------------------------------------------------------------------------------------------- |
local PocketPlot = CreateFrame("Frame", nil, Minimap) |
local movershown, clockFrame, clockTime, LSM, fonts, ppdb |
local movershown, clockFrame, clockTime, LSM, fonts |
PP_oldMinimap, PP_oldDurabilityFrame, PP_oldQuestWatchFrame, PP_oldQuestTimerFrame, PP_oldAchievementWatchFrame = "foo" |
local _G = _G |
local mover = CreateFrame("Frame", nil, UIParent) |
moverText:SetFont("Fonts\\ARIALN.ttf", 14) |
moverText:SetParent(mover) |
moverText:SetPoint("CENTER") |
frames = { "Minimap", |
"DurabilityFrame", |
"QuestWatchFrame", |
"QuestTimerFrame", |
"AchievementWatchFrame", |
"None", |
} |
local coordframe = CreateFrame("Frame", nil, Minimap) |
coordframe:SetHeight(28) --height of clock button |
coordframe:SetWidth(60) --width of clock button |
local coords = coordframe:CreateFontString(nil, "OVERLAY") |
coords:SetParent(coordframe) |
local frames = { "Minimap", |
"DurabilityFrame", |
"QuestWatchFrame", |
"QuestTimerFrame", |
"AchievementWatchFrame", |
"None", |
} |
local defaults = { |
font = "Interface\\AddOns\\PocketPlot\\media\\BLUEHIGH.ttf", --file path to a .ttf font |
lsmfont = "Blue Highway", |
zoneSize = 14, --font size |
clockSize = 16, --font size |
scale = .9, --scale of the minimap |
scale = 1, --scale of the minimap |
mapPos = {x = -10, y = -10}, --offset of the minimap from the top right corner. If you wish to change where the minimap is anchored, see the "Minimap Location and Size" section below Note: this will move the quest tracker, etc, unless you use other addons to control those frames. |
blips = "Interface\\AddOns\\PocketPlot\\media\\PPblips2.blp", --file path to blip textures (2 styles are included with this addon, or you can find/create your own. If you like the default blips, then use "Interface\\Minimap\\OBJECTICONS.blp") |
bg = {r = 0, g = 0, b = 0, a=1}, --border colors (red, green, blue) -- values are a range from 0-1 (0,0,0 is black and 1,1,1 is white) |
top = false, |
coords = true, |
coordSize = 16, |
} |
end |
--MINIMAP ICONS/BLIPS |
Minimap:SetBlipTexture(PocketPlotDB.blips) --custom texture for blips |
Minimap:SetBlipTexture(blips) --custom texture for blips |
--MAKE THE MINIMAP SQUARE WITH A THIN BORDER |
MinimapBorder:Hide() |
end |
clockFrame, clockTime = TimeManagerClockButton:GetRegions() |
clockFrame:Hide() |
TimeManagerClockButton:SetPoint("TOP", Minimap, "BOTTOM", 0, 0) |
if LSM then |
clockTime:SetFont(LSM:Fetch("font", PocketPlotDB.lsmfont), PocketPlotDB.clockSize, "OUTLINE") |
else |
MinimapNorthTag:SetAlpha(0) --Hide() wasn't working, but SetAlpha() is... |
MinimapBorderTop:Hide() |
MinimapToggleButton:Hide() |
--COORDINATES |
if LSM then |
coords:SetFont(LSM:Fetch("font",PocketPlotDB.lsmfont), PocketPlotDB.coordSize, "OUTLINE") |
else |
coords:SetFont(PocketPlotDB.font, PocketPlotDB.coordSize, "OUTLINE") |
end |
if PocketPlotDB.coords then |
coordframe:Show() |
else |
coordframe:Hide() |
end |
end |
local function CoordPosition() |
local clockshown = TimeManagerClockButton:IsShown() |
local coordshown = coordframe:IsShown() |
clockTime:ClearAllPoints() |
TimeManagerClockButton:ClearAllPoints() |
coords:ClearAllPoints() |
coordframe:ClearAllPoints() |
if not PocketPlotDB.top then |
if clockshown and not coordshown then |
clockTime:SetPoint("CENTER") |
TimeManagerClockButton:SetPoint("TOP", Minimap, "BOTTOM", 0, 0) |
end |
if coordshown and not clockshown then |
coords:SetPoint("CENTER") |
coordframe:SetPoint("TOP", Minimap, "BOTTOM", 0, 0) |
end |
if clockshown and coordshown then |
clockTime:SetPoint("LEFT") |
TimeManagerClockButton:SetPoint("TOPLEFT", Minimap, "BOTTOMLEFT", 0, 0) |
coords:SetPoint("RIGHT") |
coordframe:SetPoint("TOPRIGHT", Minimap, "BOTTOMRIGHT", 0, 0) |
end |
else |
if clockshown and not coordshown then |
clockTime:SetPoint("CENTER") |
TimeManagerClockButton:SetPoint("BOTTOM", Minimap, "TOP", 0, 0) |
end |
if coordshown and not clockshown then |
coords:SetPoint("CENTER") |
coordframe:SetPoint("BOTTOM", Minimap, "TOP", 0, 0) |
end |
if clockshown and coordshown then |
clockTime:SetPoint("LEFT") |
TimeManagerClockButton:SetPoint("BOTTOMLEFT", Minimap, "TOPLEFT", 0, 0) |
coords:SetPoint("RIGHT") |
coordframe:SetPoint("BOTTOMRIGHT", Minimap, "TOPRIGHT", 0, 0) |
end |
end |
end |
local function MoveFrames(frame) |
if frame == "None" then |
mover:Hide() |
name = "PocketPlot Options", |
type = "group", |
args = { |
movers = { |
name = "Enable mover for...", |
desc = "Shows an anchor to move the selected frame.", |
type = "select", |
values = frames, |
get = function() |
-- return movershown or "None" |
if movershown then |
for k,v in pairs(frames) do |
if v == movershown then |
return k |
end |
end |
else |
return 6 --key for "None" in frames table |
end |
end, |
set = function(_,frame) |
movershown = frames[frame] |
MoveFrames(movershown) |
end, |
order = 1, |
}, |
reset = { |
name = "Restore Positions", |
desc = "Clicking this will restore all frames to their default positions.\n\nWARNING: Your UI will be reloaded in the process!", |
type = "execute", |
func = function() |
for i=1, #frames do |
PocketPlotDB[frames[i]] = nil |
end |
ReloadUI() |
end, |
order = 2, |
}, |
div1 = { |
name = " ", |
type = "description", |
order = 3, |
}, |
scale = { |
name = "Scale", |
desc = "Set the scale of the minimap.", |
PocketPlotDB.scale = value |
Minimap:SetScale(PocketPlotDB.scale) |
end, |
order = 1, |
order = 4, |
}, |
border = { |
name = "Border Color", |
PocketPlotDB.bg.r,PocketPlotDB.bg.g,PocketPlotDB.bg.b,PocketPlotDB.bg.a = r,g,b,a |
PocketPlot:SetBackdropColor(PocketPlotDB.bg.r,PocketPlotDB.bg.g,PocketPlotDB.bg.b,PocketPlotDB.bg.a) |
end, |
order = 2, |
order = 5, |
}, |
div2 = { |
name = " ", |
type = "description", |
order = 6, |
}, |
zonesize = { |
name = "Zone Text Size", |
desc = "Change the font size of the Zone Text.", |
MinimapZoneText:SetFont(PocketPlotDB.font, PocketPlotDB.zoneSize, "OUTLINE") |
end |
end, |
order = 3, |
order = 7, |
}, |
clocksize = { |
name = "Clock Text Size", |
clockTime:SetFont(PocketPlotDB.font, PocketPlotDB.clockSize, "OUTLINE") |
end |
end, |
order = 4, |
order = 8, |
}, |
movers = { |
name = "Enable mover for...", |
desc = "Shows an anchor to move the selected frame.", |
type = "select", |
values = frames, |
get = function() |
-- return movershown or "None" |
if movershown then |
for k,v in pairs(frames) do |
if v == movershown then |
return k |
end |
end |
coordsize = { |
name = "Coords Text Size", |
desc = "Change the font size of the coordinates.", |
type = "range", |
min = 6, |
max = 24, |
step = 1, |
get = function() return PocketPlotDB.coordSize end, |
set = function(_,size) |
PocketPlotDB.coordSize = size |
if LSM then |
coords:SetFont(LSM:Fetch("font",PocketPlotDB.lsmfont), PocketPlotDB.coordSize, "OUTLINE") |
else |
return 6 --key for "None" in frames table |
coords:SetFont(PocketPlotDB.font, PocketPlotDB.coordSize, "OUTLINE") |
end |
end, |
set = function(_,frame) |
movershown = frames[frame] |
MoveFrames(movershown) |
end, |
order = 5, |
order = 9, |
}, |
div1 = { |
name = " ", |
type = "description", |
order = 7, |
}, |
div2 = { |
name = " ", |
type = "description", |
order = 8, |
}, |
--if LSM then font dropdown goes here, order = 10 |
div3 = { |
name = " ", |
type = "description", |
order = 9, |
order = 11, |
}, |
reset = { |
name = "Restore Positions", |
desc = "Clicking this will restore all frames to their default positions.\n\nWARNING: Your UI will be reloaded in the process!", |
type = "execute", |
func = function() |
for i=1, #frames do |
PocketPlotDB[frames[i]] = nil |
coords = { |
name = "Display coords", |
desc = "Toggle showing the coordinates display.", |
type = "toggle", |
get = function() return PocketPlotDB.coords end, |
set = function() |
PocketPlotDB.coords = not PocketPlotDB.coords |
if PocketPlotDB.coords then |
coordframe:Show() |
else |
coordframe:Hide() |
end |
ReloadUI() |
CoordPosition() |
end, |
order = 10, |
order = 12, |
}, |
top = { |
name = "Clock/coords on top", |
desc = "Toggle showing the clock and coordinates above or below the map.", |
type = "toggle", |
get = function() return PocketPlotDB.top end, |
set = function() |
PocketPlotDB.top = not PocketPlotDB.top |
CoordPosition() |
end, |
order = 13, |
}, |
}, |
} |
local function PlayerLogin() |
PocketPlotDB = PocketPlotDB or {} |
ppdb = {} |
local ppdb = {} |
setmetatable(PocketPlotDB, ppdb) |
ppdb.__index = defaults |
end, |
set = function(_,font) |
PocketPlotDB.lsmfont = fonts[font] |
DEFAULT_CHAT_FRAME:AddMessage(PocketPlotDB.lsmfont) |
clockTime:SetFont(LSM:Fetch("font", PocketPlotDB.lsmfont), PocketPlotDB.clockSize, "OUTLINE") |
MinimapZoneText:SetFont(LSM:Fetch("font", PocketPlotDB.lsmfont), PocketPlotDB.zoneSize, "OUTLINE") |
coords:SetFont(LSM:Fetch("font",PocketPlotDB.lsmfont), PocketPlotDB.coordSize, "OUTLINE") |
end, |
order = 6, |
order = 10, |
} |
end |
SetPosition(frames[i]) |
end |
end |
CoordPosition() |
TimeManagerClockButton:SetScript("OnHide", CoordPosition) |
TimeManagerClockButton:SetScript("OnShow", CoordPosition) |
PocketPlot:UnregisterEvent("PLAYER_LOGIN") |
end |
mover:SetScript("OnMouseDown", function() mover:StartMoving() end) |
mover:SetScript("OnMouseUp", function() mover:StopMovingOrSizing() SetPosition(movershown) end) |
coordframe:SetScript("OnUpdate", function() |
local coordx,coordy = GetPlayerMapPosition("player") |
coords:SetFormattedText("%.1f/%.1f", coordx*100, coordy*100) |
end) |
PocketPlot:SetScript("OnEvent", PlayerLogin) |
PocketPlot:RegisterEvent("PLAYER_LOGIN") |