/trunk/PocketPlot
--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\\PPblips3.blp" |
local blips = "Interface\\AddOns\\PocketPlot\\media\\PPblips2.blp" |
------------------------------------------------------------------------------------------------------------------------------------- |
local PocketPlot = CreateFrame("Frame", nil, Minimap) |
local LSM = LibStub("LibSharedMedia-3.0") |
local widgetLists = AceGUIWidgetLSMlists |
local fonts = widgetLists.font |
--local fonts = LSM:List("font") |
local fonts = LSM:List("font") |
local class = select(2, UnitClass("player")) |
local classColor, movershown, clockFrame, clockTime, db, options |
local Minimap = Minimap |
local MiniMapMailFrame = MiniMapMailFrame |
local MiniMapVoiceChatFrame = MiniMapVoiceChatFrame |
local MiniMapMeetingStoneFrame = MiniMapMeetingStoneFrame |
local TimeManagerClockFrame = TimeManagerClockFrame |
PP_oldMinimap, PP_oldDurabilityFrame, PP_oldVehicleSeatIndicator = nil --, PP_oldWatchFrame = nil |
local _G = _G |
local mover = CreateFrame("Frame", nil, UIParent) |
moverText:SetPoint("CENTER") |
local coordframe = CreateFrame("Frame", nil, Minimap) |
coordframe:SetHeight(28) --height of clock button |
coordframe:SetWidth(100) |
coordframe:SetWidth(60) --width of clock button |
coordframe:EnableMouse(true) |
local coords = coordframe:CreateFontString(nil, "OVERLAY") |
coords:SetParent(coordframe) |
alpha = 1, |
top = false, |
coords = true, |
clock = true, |
coordSize = 16, |
classbg = false, |
classfont = false, |
clockFrame, clockTime = TimeManagerClockButton:GetRegions() |
clockFrame:Hide() |
clockTime:SetFont(LSM:Fetch("font", db.lsmfont), db.clockSize, db.fontFlag) |
clockTime:SetAllPoints(TimeManagerClockButton) |
if not db.clock then --toggle the clock, since CVar is removed in 4.0 |
TimeManagerClockButton:Hide() |
end |
--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 |
--thanks, Elviswind, for shadow code to match clock |
coords:SetShadowOffset(1,-1) |
coords:SetShadowColor(0,0,0,1) |
coords:SetAllPoints(coordframe) |
if not db.coords then |
if db.coords then |
coordframe:Show() |
else |
coordframe:Hide() |
end |
end |
local function CoordPosition() |
local clockshown = db.clock |
local coordshown = db.coords |
local clockshown = TimeManagerClockButton:IsShown() |
local coordshown = coordframe:IsShown() |
TimeManagerClockButton:ClearAllPoints() |
coords:ClearAllPoints() |
coordframe:ClearAllPoints() |
if not db.top then |
if clockshown and not coordshown then |
TimeManagerClockButton:SetPoint("TOP", Minimap, "BOTTOM", 0, 0) |
clockTime:SetJustifyH("CENTER") |
end |
if coordshown and not clockshown then |
coords:SetJustifyH("CENTER") |
coords:SetPoint("CENTER") |
coordframe:SetPoint("TOP", Minimap, "BOTTOM", 0, 0) |
end |
if clockshown and coordshown then |
TimeManagerClockButton:SetPoint("TOPLEFT", Minimap, "BOTTOMLEFT", 2, 0) |
clockTime:SetJustifyH("LEFT") |
coords:SetJustifyH("RIGHT") |
TimeManagerClockButton:SetPoint("TOPLEFT", Minimap, "BOTTOMLEFT", -10, 0) |
coords:SetPoint("RIGHT") |
coordframe:SetPoint("TOPRIGHT", Minimap, "BOTTOMRIGHT", 0, 0) |
end |
else |
if clockshown and not coordshown then |
TimeManagerClockButton:SetPoint("BOTTOM", Minimap, "TOP", 2, 0) |
clockTime:SetJustifyH("CENTER") |
TimeManagerClockButton:SetPoint("BOTTOM", Minimap, "TOP", 0, 0) |
end |
if coordshown and not clockshown then |
coords:SetJustifyH("CENTER") |
coords:SetPoint("CENTER") |
coordframe:SetPoint("BOTTOM", Minimap, "TOP", 0, 0) |
end |
if clockshown and coordshown then |
TimeManagerClockButton:SetPoint("BOTTOMLEFT", Minimap, "TOPLEFT", 0, 0) |
clockTime:SetJustifyH("LEFT") |
coords:SetJustifyH("RIGHT") |
TimeManagerClockButton:SetPoint("BOTTOMLEFT", Minimap, "TOPLEFT", -10, 0) |
coords:SetPoint("RIGHT") |
coordframe:SetPoint("BOTTOMRIGHT", Minimap, "TOPRIGHT", 0, 0) |
end |
end |
name = "Font", |
desc = "Select a font to use.", |
type = "select", |
dialogControl = "LSM30_Font", |
values = fonts, |
get = function() |
--[[for k,v in pairs(fonts) do |
for k,v in pairs(fonts) do |
if v == db.lsmfont then |
return k |
end |
end]] |
return db.lsmfont |
end |
end, |
set = function(_,font) |
--db.lsmfont = fonts[font] |
db.lsmfont = font |
db.lsmfont = fonts[font] |
clockTime:SetFont(LSM:Fetch("font", db.lsmfont), db.clockSize, db.fontFlag) |
MinimapZoneText:SetFont(LSM:Fetch("font", db.lsmfont), db.zoneSize, db.fontFlag) |
coords:SetFont(LSM:Fetch("font",db.lsmfont), db.coordSize, db.fontFlag) |
end, |
order = 11, |
}, |
clock = { |
name = "Display clock", |
desc = "Toggle showing the clock.", |
type = "toggle", |
get = function() return db.clock end, |
set = function() |
db.clock = not db.clock |
if db.clock then |
TimeManagerClockButton:Show() |
else |
TimeManagerClockButton:Hide() |
end |
CoordPosition() |
end, |
order = 11.5, |
}, |
zoneText = { |
name = "Display zone text", |
desc = "Toggle showing the zone text.", |
SLASH_POCKETPLOT2 = "/pp" |
MapSetup() |
CoordPosition() |
-- --restore moved frame positions-- |
-- for i=1, #frames do |
-- end |
-- end |
--is here because it wasn't working down below for some odd reason...-- |
TimeManagerClockButton:SetScript("OnHide", CoordPosition) |
TimeManagerClockButton:SetScript("OnShow", CoordPosition) |
PocketPlot:UnregisterEvent("PLAYER_LOGIN") |
end |
--this is here instead of in the above function because Grid would throw some dumb error that shouldn't have been occuring, imo |
LSM:Register("font", "Negotiate Free", "Interface\\AddOns\\PocketPlot\\media\\negotiate_free.ttf") |
LSM:Register("font", "Blue Highway", "Interface\\AddOns\\PocketPlot\\media\\BLUEHIGH.ttf") |
mover:SetScript("OnMouseDown", function() mover:StartMoving() end) |
mover:SetScript("OnMouseUp", function() mover:StopMovingOrSizing() SetPosition(movershown) end) |
coordframe:SetScript("OnEnter", function(self) |
GameTooltip:SetOwner(self, "ANCHOR_LEFT") |
GameTooltip:AddLine("Location Functions", 1,1,1) |
coordframe:SetScript("OnLeave", function() GameTooltip:Hide() end) |
coordframe:SetScript("OnMouseUp", function() |
if IsShiftKeyDown() then |
ChatFrame1EditBox:Insert("["..coords:GetText().."]") |
ChatFrameEditBox:Insert("["..coords:GetText().."]") |
elseif WorldMapFrame:IsShown() then |
WorldMapFrame:Hide() |
else |
WorldMapFrame:Show() |
end |
end) |
local throttle = 0 |
coordframe:SetScript("OnUpdate", function(self, elapsed) |
throttle = throttle + elapsed |
if throttle >= .3 then |
local coordx,coordy = GetPlayerMapPosition("player") |
coords:SetFormattedText("%.1f/%.1f", coordx*100, coordy*100) |
throttle = 0 |
coordframe:SetScript("OnUpdate", function() |
local coordx,coordy = GetPlayerMapPosition("player") |
coords:SetFormattedText("%.1f/%.1f", coordx*100, coordy*100) |
end) |
coordframe:SetScript("OnEvent", function(self) |
if db.coords then |
if IsInInstance() then |
self:Hide() |
else |
self:Show() |
end |
CoordPosition() |
end |
end) |
PocketPlot:SetScript("OnEvent", PlayerLogin) |
coordframe:RegisterEvent("PLAYER_ENTERING_WORLD") |
PocketPlot:RegisterEvent("PLAYER_LOGIN") |
## Interface: 40000 |
## Interface: 30300 |
## Title: PocketPlot |
## Author: Seerah |
## Notes: Minimap customization |
## Version: 2.10 |
## Version: 2.9.5 |
## X-Category: Minimap |
## OptionalDeps: Ace3, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets |
## OptionalDeps: Ace3, LibSharedMedia-3.0 |
## SavedVariables: PocketPlotDB |
## SavedVariablesPerCharacter: PocketPlotPCDB |
libs\AceGUI-3.0\AceGUI-3.0.xml |
libs\AceConfig-3.0\AceConfig-3.0.xml |
libs\LibSharedMedia-3.0\lib.xml |
Libs\AceGUI-3.0-SharedMediaWidgets\widget.xml |
pocketplot.lua |