/branches
------------------------------------------------------------------------------ |
--SETTING UP... THESE ARE YOUR OPTIONS TO EDIT!!!-- |
------------------------------------------------------------------------------ |
local font = "Interface\\AddOns\\PocketPlot\\BLUEHIGH.ttf" --file path to a .ttf font |
local size = 14 --font size (clock is size + 2) |
local scale = .9 --scale of the minimap |
local x,y = -10, -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. |
local blips = "Interface\\AddOns\\PocketPlot\\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") |
local r,g,b = 0,0,0 --border colors (red, green, blue) -- values are a range from 0-1 (0,0,0 is black and 1,1,1 is white) |
local PocketPlot = CreateFrame("Frame", nil, Minimap) |
local movershown |
local mover = CreateFrame("Frame", nil, UIParent) |
mover:SetBackdrop({ |
bgFile ="Interface\\Buttons\\WHITE8x8", |
}) |
mover:SetBackdropColor(.2,.2,.9) |
mover:SetMovable(1) |
mover:Hide() |
local moverText = mover:CreateFontString(nil, "OVERLAY") |
moverText:SetFont("Fonts\\ARIALN.ttf", 14) |
moverText:SetParent(mover) |
moverText:SetPoint("CENTER") |
local defaults = { |
font = "Interface\\AddOns\\PocketPlot\\media\\BLUEHIGH.ttf", --file path to a .ttf font |
size = 14, --font size (clock is size + 2) |
scale = .9, --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}, --border colors (red, green, blue) -- values are a range from 0-1 (0,0,0 is black and 1,1,1 is white) |
} |
------------------------------------------------------------------------------------------------ |
local PocketPlot = CreateFrame("Frame") |
--so minimap buttons follow the square shape instead of round(?) |
--so minimap buttons follow the square shape instead of round |
function GetMinimapShape() |
return "SQUARE" |
end |
local function MapSetup() |
--MINIMAP LOCATION AND SIZE |
Minimap:ClearAllPoints() |
Minimap:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", x, y) --this says that the topright of the minimap is anchored to the topright of your screen (UIParent), with offsets of 10 to the left and 10 down |
Minimap:SetScale(scale) --this says that the minimap is set to 90% scale |
Minimap:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", PocketPlotDB.mapPos.x, PocketPlotDB.mapPos.y) --this says that the topright of the minimap is anchored to the topright of your screen (UIParent), with offsets of 10 to the left and 10 down |
Minimap:SetScale(PocketPlotDB.scale) --this says that the minimap is set to 90% scale |
--ZONE TEXT |
MinimapZoneTextButton:SetParent("Minimap") |
MinimapZoneTextButton:SetPoint("TOP", Minimap, "TOP", 0, -1) --where the zone text is located |
MinimapZoneTextButton:SetFrameLevel(5) |
MinimapZoneText:SetFont(font, size, "OUTLINE") --font and font size for zone text |
MinimapZoneText:SetFont(PocketPlotDB.font, PocketPlotDB.size, "OUTLINE") --font and font size for zone text |
--MINIMAP ICONS/BLIPS |
Minimap:SetBlipTexture(blips) --custom texture for blips |
Minimap:SetBlipTexture(PocketPlotDB.blips) --custom texture for blips |
--MAKE THE MINIMAP SQUARE WITH A THIN BORDER |
MinimapBorder:Hide() |
Minimap:SetMaskTexture("Interface\\AddOns\\PocketPlot\\mask.blp") |
PocketPlot:SetParent(Minimap) |
Minimap:SetMaskTexture("Interface\\AddOns\\PocketPlot\\media\\mask.blp") |
PocketPlot:SetFrameLevel(1) |
PocketPlot:SetBackdrop({ --border is actually a background frame that's slightly larger than minimap |
bgFile ="Interface\\Tooltips\\UI-Tooltip-Background", |
insets = {left = -2, right = -2, top = -2, bottom = -2}, |
insets = {left = -3, right = -3, top = -3, bottom = -3}, |
}) |
PocketPlot:SetBackdropColor(r,g,b) |
PocketPlot:SetBackdropColor(PocketPlotDB.bg.r,PocketPlotDB.bg.g,PocketPlotDB.bg.b) |
PocketPlot:SetAllPoints(Minimap) |
--MAKE THE MINIMAP ZOOM WITH MOUSEWHEEL |
end |
local clockFrame, clockTime = TimeManagerClockButton:GetRegions() |
clockFrame:Hide() |
clockTime:SetFont(font, size + 3, "OUTLINE") |
clockTime:SetFont(PocketPlotDB.font, PocketPlotDB.size + 3, "OUTLINE") |
TimeManagerClockButton:SetPoint("TOP", Minimap, "BOTTOM", 0, 0) |
--CALENDAR BUTTON/FRAME |
GameTimeFrame:SetAlpha(0) --calendar button (old day/night indicator) --Set alpha to 0 so that it's still hidden, but we'll see the ? flash for new invites |
GameTimeFrame:EnableMouse(false) --so that we don't get the tooltip/click behavior still |
GameTimeCalendarInvitesTexture:SetParent("Minimap") --the ? texture |
Minimap:SetScript("OnMouseDown", function(_,click) |
if click == "RightButton" then |
if not CalendarFrame then |
CalendarFrame:Show() |
end |
end) |
GameTimeCalendarInvitesTexture:SetParent("Minimap") |
--TRACKING ICON/MENU |
MiniMapTrackingButton:SetAlpha(0) |
MiniMapTrackingBackground:Hide() |
MiniMapTracking:ClearAllPoints() |
MiniMapTracking:SetPoint("BOTTOMLEFT", Minimap, "BOTTOMLEFT", -5, -5) --where the tracking icon/menu is located |
MiniMapTracking:SetPoint("BOTTOMLEFT", Minimap, "BOTTOMLEFT", -5, -6) --where the tracking icon/menu is located |
--BATTLEGROUND QUEUE ICON |
MiniMapBattlefieldBorder:Hide() |
MiniMapBattlefieldFrame:ClearAllPoints() |
MiniMapBattlefieldFrame:SetPoint("BOTTOM", Minimap, "BOTTOM", 0, -1) --where the battleground icon is located |
MiniMapBattlefieldFrame:SetPoint("BOTTOM", Minimap, "BOTTOM", 2, -3) --where the battleground icon is located |
--NEW MAIL ICON |
MiniMapMailBorder:Hide() |
MiniMapVoiceChatFrameBorder:Hide() |
MiniMapVoiceChatFrameBackground:Hide() |
MiniMapVoiceChatFrame:ClearAllPoints() |
MiniMapVoiceChatFrame:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT", -20, -5) |
MiniMapVoiceChatFrame:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT", -25, -5) |
--LFG ICON |
MiniMapMeetingStoneBorder:Hide() |
MinimapNorthTag:SetAlpha(0) --Hide() wasn't working, but SetAlpha() is... |
MinimapBorderTop:Hide() |
MinimapToggleButton:Hide() |
end |
local function MoveFrames(frame) |
if frame == "None" then |
mover:Hide() |
mover:EnableMouse(0) |
return |
else |
mover:Show() |
moverText:SetText(frame) |
mover:EnableMouse(1) |
local r,p,a,x,y = _G[frame]:GetPoint() |
local height = _G[frame]:GetHeight() |
local width = _G[frame]:GetWidth() |
mover:SetHeight(height) |
mover:SetWidth(width) |
mover:ClearAllPoints() |
mover:SetPoint(r,p,a,x,y) |
end |
end |
local function SavePosition() |
local origsetpoint = QuestWatchFrame:SetPoint |
local r,p,a,x,y = mover:GetPoint() |
_G[movershown]:ClearAllPoints() |
origsetpoint(r,p,a,x,y) |
_G[movershown].SetPoint = function() return end |
PocketPlotDB[movershown] = {r,a,x,y} |
DEFAULT_CHAT_FRAME:AddMessage(r..",UIParent,"..a..","..x..","..y) |
end |
local function PocketPlotOptions(panel) |
local title, subText = panel:MakeTitleTextAndSubText("PocketPlot Plus!", "You can now edit the minimap without touching the lua. :)") |
local scrollFrame = panel:MakeScrollFrame() |
panel:MakeSlider( |
"name", "Scale", |
"description", "Set the scale of the minimap.", |
"minText", "25%", |
"maxText", "200%", |
"minValue", .25, |
"maxValue", 2, |
"step", .05, |
"default", .9, |
"current", PocketPlotDB.scale, |
"setFunc", function(value) PocketPlotDB.scale = value Minimap:SetScale(PocketPlotDB.scale) end, |
"currentTextFunc", function(value) return ("%.0f%%"):format(PocketPlotDB.scale*100) end |
):SetPoint("TOPLEFT", subText, "BOTTOMLEFT", 0, -30) |
panel:MakeColorPicker( |
"name", "Border color", |
"description", "Select a color for the minimap's border.", |
"hasAlpha", false, |
"defaultR", 0, |
"defaultG", 0, |
"defaultB", 0, |
"currentR", PocketPlotDB.bg.r, |
"currentG", PocketPlotDB.bg.g, |
"currentB", PocketPlotDB.bg.b, |
"setFunc", function(retr,retg,retb) PocketPlotDB.bg.r,PocketPlotDB.bg.g,PocketPlotDB.bg.b,PocketPlotDB.bg.a = retr,retg,retb,reta PocketPlot:SetBackdropColor(PocketPlotDB.bg.r,PocketPlotDB.bg.g,PocketPlotDB.bg.b) end |
):SetPoint("TOPLEFT", subText, "CENTER", 0, -30) |
panel:MakeDropDown( |
"name", "Enable mover for...", |
"description", 'Shows an anchor to move the selected frame.\n\nPress the "Default" button to return the frame to its normal position (requires you to reload your UI).', |
"values", { "DurabilityFrame", "Durability Frame", |
"QuestWatchFrame", "Quest Tracker", |
"QuestTimerFrame", "Quest Timer", |
"AchievementWatchFrame", "Achievement Tracker", |
"None", "None", |
}, |
"default", "None", |
"current", movershown or "None", |
"setFunc", function(frame) movershown = frame MoveFrames(frame) end |
):SetPoint("TOPLEFT", subText, "TOPLEFT", 0, -100) |
end |
local function PlayerLogin() |
if not PocketPlotDB then |
PocketPlotDB = defaults |
end |
DEFAULT_CHAT_FRAME:AddMessage(PocketPlotDB.bg.a) |
-- db = PocketPlotDB or defaults |
MapSetup() |
LibStub("LibSimpleOptions-1.0").AddOptionsPanel("PocketPlot", function(panel) PocketPlotOptions(panel) end) |
LibStub("LibSimpleOptions-1.0").AddSlashCommand("PocketPlot", "/pocketplot", "/pp") |
end |
mover:SetScript("OnMouseDown", function() this:StartMoving() end) |
mover:SetScript("OnMouseUp", function() this:StopMovingOrSizing() SavePosition() end) |
PocketPlot:SetScript("OnEvent", PlayerLogin) |
PocketPlot:RegisterEvent("PLAYER_LOGIN") |
## Version: 2.0 |
## X-Category: Minimap |
## OptionalDeps: LibSimpleOptions-1.0 |
## SavedVariables: PocketPlotDB |
libs\LibStub.lua |
libs\LibSimpleOptions-1.0.lua |