Quantcast

Added Clock as LoD Module

p3lim-52096 [10-20-08 - 13:52]
Added Clock as LoD Module
Added Config as LoD Module
Added Coords as LoD Module
Added Durability as LoD Module

git-svn-id: svn://svn.wowinterface.com/pMinimap-54/trunk@31 ae24c21f-2f0c-4c94-9256-0092abe71e0d
Filename
pMinimap/pMinimap.toc
pMinimap/pMinimapConfig.lua
pMinimap_Clock/pMinimap_Clock.lua
pMinimap_Clock/pMinimap_Clock.toc
pMinimap_Config/pMinimap_Config.lua
pMinimap_Config/pMinimap_Config.toc
pMinimap_Coords/pMinimap_Coords.lua
pMinimap_Coords/pMinimap_Coords.toc
pMinimap_Durability/pMinimap_Durability.lua
pMinimap_Durability/pMinimap_Durability.toc
diff --git a/pMinimap/pMinimap.toc b/pMinimap/pMinimap.toc
index 0de0190..ddc126d 100644
--- a/pMinimap/pMinimap.toc
+++ b/pMinimap/pMinimap.toc
@@ -3,11 +3,6 @@
 ## Version: 30000.wowi:revision
 ## Title: |cffff6000p|rMinimap
 ## Notes: Yet another square minimap addon
-## OptionalDeps: LibStub, LibSimpleOptions-1.0
 ## SavedVariablesPerCharacter: pMinimapDB

-LibSimpleOptions\LibStub\LibStub.lua
-LibSimpleOptions\LibSimpleOptions-1.0.lua
-
-pMinimap.lua
-pMinimapConfig.lua
+pMinimap.lua
\ No newline at end of file
diff --git a/pMinimap/pMinimapConfig.lua b/pMinimap/pMinimapConfig.lua
deleted file mode 100644
index ebe5e12..0000000
--- a/pMinimap/pMinimapConfig.lua
+++ /dev/null
@@ -1,103 +0,0 @@
-local function CreateOptions(self, db)
-	local title, sub = self:MakeTitleTextAndSubText('pMinimap', 'These options allow you to customize the looks of pMinimap.')
-
-	self:MakeToggle(
-		'name', 'Toggle Minimap locked state',
-		'description', 'Set whether Minimap is locked or not',
-		'default', true,
-		'current', true,
-		'setFunc', function(x)
-			if(x) then
-				local p,_,r,x,y = pMinimap:GetPoint()
-				db.point[1], db.point[3], db.point[4], db.point[5] = p, r, x, y
-				pMinimap:EnableMouse(false)
-				pMinimap:SetAlpha(0)
-			else
-				pMinimap:EnableMouse(true)
-				pMinimap:SetAlpha(1)
-			end
-		end
-	):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -16)
-
-	self:MakeSlider(
-		'name', 'Minimap Scale',
-		'description', 'Drag to change the minimap scale',
-		'default', 0.9,
-		'minText', '0.75', 'maxText', '2.50',
-		'minValue', 0.75, 'maxValue', 2.50,
-		'step', 0.01,
-		'current', db.scale,
-		'setFunc', function(x)
-			db.scale = x
-			Minimap:SetScale(x)
-			pMinimap:SetWidth(Minimap:GetWidth() * x)
-			pMinimap:SetHeight(Minimap:GetHeight() * x)
-		end,
-		'currentTextFunc', function(num)
-			return format('%.2f', num)
-		end
-	):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -56)
-
-	self:MakeToggle(
-		'name', 'Toggle durability recoloring',
-		'description', 'Set whether backdrop is recolored by durability or not',
-		'default', true,
-		'current', db.durability,
-		'setFunc', function(x)
-			db.durability = x
-			if(x) then
-				pMinimap:RegisterEvent('UPDATE_INVENTORY_ALERTS')
-				pMinimap.UPDATE_INVENTORY_ALERTS()
-				DurabilityFrame:SetAlpha(0)
-			else
-				pMinimap:UnregisterEvent('UPDATE_INVENTORY_ALERTS')
-				Minimap:SetBackdropColor(unpack(db.colors))
-				DurabilityFrame:SetAlpha(1)
-			end
-		end
-	):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -86)
-
-	self:MakeSlider(
-		'name', 'Backdrop offset',
-		'description', 'Drag to change the backdrop border size',
-		'default', 1,
-		'minText', '0', 'maxText', '10',
-		'minValue', 0, 'maxValue', 10,
-		'step', 1,
-		'current', db.offset,
-		'setFunc', function(x)
-			db.offset = x
-			Minimap:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], insets = {top = - x, left = - x, bottom = - x, right = - x}})
-			Minimap:SetBackdropColor(unpack(db.colors))
-		end,
-		'currentTextFunc', function(num)
-			return num
-		end
-	):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -126)
-
-	self:MakeColorPicker(
-		'name', 'Custom color',
-		'description', 'Click to set custom backdrop color',
-		'hasAlpha', true,
-		'defaultR', 0,
-		'defaultG', 0,
-		'defaultB', 0,
-		'defaultA', 1,
-		'getFunc', function() return unpack(db.colors) end,
-		'setFunc', function(r, g, b, a)
-			db.colors[1], db.colors[2], db.colors[3], db.colors[4] = r, g, b, a
-			Minimap:SetBackdropColor(unpack(db.colors))
-		end
-	):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -156)
-end
-
-function pMinimap.PLAYER_ENTERING_WORLD(self, event)
-	local db = pMinimapDB or {point = {'TOPRIGHT', 'UIParent', 'TOPRIGHT', -15, -15}, scale = 0.9, offset = 1, colors = {0, 0, 0, 1}, durability = true}
-
-	LibStub('LibSimpleOptions-1.0').AddOptionsPanel('pMinimap', function(self) CreateOptions(self, db) end)
-	LibStub('LibSimpleOptions-1.0').AddSlashCommand('pMinimap', '/pminimap', '/pmm')
-
-	self:UnregisterEvent(event)
-
-	pMinimapDB = db
-end
\ No newline at end of file
diff --git a/pMinimap_Clock/pMinimap_Clock.lua b/pMinimap_Clock/pMinimap_Clock.lua
new file mode 100644
index 0000000..4fde667
--- /dev/null
+++ b/pMinimap_Clock/pMinimap_Clock.lua
@@ -0,0 +1 @@
+if(not IsAddOnLoaded('Blizzard_TimeManager')) then
	LoadAddOn('Blizzard_TimeManager')
end

TimeManagerClockButton:ClearAllPoints()
if(pMinimapDB.coords) then
	TimeManagerClockButton:SetPoint('BOTTOMLEFT', Minimap)
else
	TimeManagerClockButton:SetPoint('BOTTOM', Minimap)
end

TimeManagerClockButton:SetWidth(40)
TimeManagerClockButton:SetHeight(14)
TimeManagerClockButton:GetRegions():Hide()
TimeManagerClockTicker:SetPoint('CENTER', TimeManagerClockButton)
TimeManagerClockTicker:SetFont([=[Interface\AddOns\pMinimap\font.ttf]=], 13, 'OUTLINE')
TimeManagerAlarmFiredTexture.Show = function() TimeManagerClockTicker:SetTextColor(1, 0, 0) end
TimeManagerAlarmFiredTexture.Hide = function() TimeManagerClockTicker:SetTextColor(1, 1, 1) end

TimeManagerClockButton:SetScript('OnClick', function(self, button)
	if(self.alarmFiring) then
		PlaySound('igMainMenuQuit')
		TimeManager_TurnOffAlarm()
	else
		if(button == 'RightButton') then
			if(not IsAddOnLoaded('Blizzard_Calendar')) then
				LoadAddOn('Blizzard_Calendar')
			end
			ToggleCalendar()
		else
			ToggleTimeManager()
		end
	end
end)
\ No newline at end of file
diff --git a/pMinimap_Clock/pMinimap_Clock.toc b/pMinimap_Clock/pMinimap_Clock.toc
new file mode 100644
index 0000000..d490a12
--- /dev/null
+++ b/pMinimap_Clock/pMinimap_Clock.toc
@@ -0,0 +1,9 @@
+## Interface: 30000
+## Author: p3lim
+## Version: 30000.wowi:revision
+## Title: |cffff6000p|rMinimap_Clock
+## Notes: Clock module for pMinimap
+## RequiredDeps: pMinimap
+## LoadOnDemand: 1
+
+pMinimap_Clock.lua
\ No newline at end of file
diff --git a/pMinimap_Config/pMinimap_Config.lua b/pMinimap_Config/pMinimap_Config.lua
new file mode 100644
index 0000000..004057b
--- /dev/null
+++ b/pMinimap_Config/pMinimap_Config.lua
@@ -0,0 +1 @@
+local function CreateOptions(self, db)
	local title, sub = self:MakeTitleTextAndSubText('pMinimap', 'These options allow you to customize the looks of pMinimap.')

	self:MakeToggle(
		'name', 'Toggle Minimap locked state',
		'description', 'Set whether Minimap is locked or not',
		'default', true,
		'current', true,
		'setFunc', function(x)
			if(x) then
				local p,_,r,x,y = pMinimap:GetPoint()
				db.point[1], db.point[3], db.point[4], db.point[5] = p, r, x, y
				pMinimap:EnableMouse(false)
				pMinimap:SetAlpha(0)
			else
				pMinimap:EnableMouse(true)
				pMinimap:SetAlpha(1)
			end
		end
	):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -16)

	self:MakeSlider(
		'name', 'Minimap Scale',
		'description', 'Drag to change the minimap scale',
		'default', 0.9,
		'minText', '0.75', 'maxText', '2.50',
		'minValue', 0.75, 'maxValue', 2.50,
		'step', 0.01,
		'current', db.scale,
		'setFunc', function(x)
			db.scale = x
			Minimap:SetScale(x)
			pMinimap:SetWidth(Minimap:GetWidth() * x)
			pMinimap:SetHeight(Minimap:GetHeight() * x)
		end,
		'currentTextFunc', function(num)
			return format('%.2f', num)
		end
	):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -56)

	self:MakeToggle(
		'name', 'Show Clock'
		'description', 'Check to enable the clock module',
		'default', true,
		'current', function() local c = GetCVar('showClock'); return c == '1' and true or false end,
		'setFunc', function(x)
			SetCVar('showClock', x)
			if(x) then
				if(not AddOnIsLoaded('pMinimap_Clock')) then
					LoadAddOn('pMinimap_Clock')
				end
				TimeManagerClockButton:ClearAllPoints()
				if(db.coords) then
					TimeManagerClockButton:SetPoint('BOTTOMLEFT', Minimap)
				else
					TimeManagerClockButton:SetPoint('BOTTOM', Minimap)
				end
			else
				if(db.coords) then
					MiniMapCoords:ClearAllPoints()
					MiniMapCoords:SetPoint('BOTTOM', Minimap)
				end
			end
		end
	):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -180)

	self:MakeToggle(
		'name', 'Show Coords',
		'description', 'Check to enable the coords module',
		'default', false,
		'current', db.coords,
		'setFunc', function(x)
			db.coords = x
			if(x) then
				if(not AddOnIsLoaded('pMinimap_Coords')) then
					LoadAddOn('pMinimap_Coords')
				end
				MiniMapCoords:Show()
				MiniMapCoords:ClearAllPoints()
				if(GetCVar('showClock') == '1') then
					MiniMapCoords:SetPoint('BOTTOMRIGHT', Minimap)
				else
					MiniMapCoords:SetPoint('BOTTOM', Minimap)
				end
			else
				MiniMapCoords:Hide()
				if(GetCVar('showClock') == '1') then
					TimeManagerClockButton:ClearAllPoints()
					TimeManagerClockButton:SetPoint('BOTTOM', Minimap)
				end
			end
		end
	):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -200)

	self:MakeToggle(
		'name', 'Check to enable durability module',
		'description', 'Set whether backdrop is recolored by durability or not',
		'default', true,
		'current', db.durability,
		'setFunc', function(x)
			db.durability = x
			if(x) then
				if(not AddOnIsLoaded('pMinimap_Durability')) then
					LoadAddOn('pMinimap_Durability')
				else
					pMinimap:RegisterEvent('UPDATE_INVENTORY_ALERTS')
					pMinimap.UPDATE_INVENTORY_ALERTS()
					DurabilityFrame:SetAlpha(0)
				end
			else
				pMinimap:UnregisterEvent('UPDATE_INVENTORY_ALERTS')
				Minimap:SetBackdropColor(unpack(db.colors))
				DurabilityFrame:SetAlpha(1)
			end
		end
	):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -86)

	self:MakeSlider(
		'name', 'Backdrop offset',
		'description', 'Drag to change the backdrop border size',
		'default', 1,
		'minText', '0', 'maxText', '10',
		'minValue', 0, 'maxValue', 10,
		'step', 1,
		'current', db.offset,
		'setFunc', function(x)
			db.offset = x
			Minimap:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], insets = {top = - x, left = - x, bottom = - x, right = - x}})
			Minimap:SetBackdropColor(unpack(db.colors))
		end,
		'currentTextFunc', function(num)
			return num
		end
	):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -126)

	self:MakeColorPicker(
		'name', 'Custom color',
		'description', 'Click to set custom backdrop color',
		'hasAlpha', true,
		'defaultR', 0,
		'defaultG', 0,
		'defaultB', 0,
		'defaultA', 1,
		'getFunc', function() return unpack(db.colors) end,
		'setFunc', function(r, g, b, a)
			db.colors[1], db.colors[2], db.colors[3], db.colors[4] = r, g, b, a
			Minimap:SetBackdropColor(unpack(db.colors))
		end
	):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -156)
end
	
local db = pMinimapDB or {point = {'TOPRIGHT', 'UIParent', 'TOPRIGHT', -15, -15}, scale = 0.9, offset = 1, colors = {0, 0, 0, 1}, durability = true, coords = false}

LibStub('LibSimpleOptions-1.0').AddOptionsPanel('pMinimap', function(self) CreateOptions(self, db) end)

pMinimapDB = db
\ No newline at end of file
diff --git a/pMinimap_Config/pMinimap_Config.toc b/pMinimap_Config/pMinimap_Config.toc
new file mode 100644
index 0000000..fb29d10
--- /dev/null
+++ b/pMinimap_Config/pMinimap_Config.toc
@@ -0,0 +1,12 @@
+## Interface: 30000
+## Author: p3lim
+## Version: 30000.wowi:revision
+## Title: |cffff6000p|rMinimap_Config
+## Notes: Options module for pMinimap
+## RequiredDeps: pMinimap
+## LoadOnDemand: 1
+
+LibSimpleOptions\LibStub\LibStub.lua
+LibSimpleOptions\LibSimpleOptions-1.0.lua
+
+pMinimap_Config.lua
\ No newline at end of file
diff --git a/pMinimap_Coords/pMinimap_Coords.lua b/pMinimap_Coords/pMinimap_Coords.lua
new file mode 100644
index 0000000..7af620b
--- /dev/null
+++ b/pMinimap_Coords/pMinimap_Coords.lua
@@ -0,0 +1 @@
+local total, font, size = 0, MiniMapMailText:GetFont()
MiniMapCoord = CreateFrame('Frame', 'MiniMapCoord', Minimap)
MiniMapCoord:SetWidth(40)
MiniMapCoord:SetHeight(14)
MiniMapCoord:Show()

if(GetCVar('showClock') == '1') then
	MiniMapCoord:SetPoint('BOTTOMRIGHT', Minimap)
else
	MiniMapCoord:SetPoint('BOTTOM', Minimap)
end

MiniMapCoordText = MiniMapCoord:CreateFontString('MiniMapCoordText', 'OVERLAY')
MiniMapCoordText:SetPoint('CENTER', MiniMapCoord)
MiniMapCoordText:SetFont(font, size, 'OUTLINE')
MiniMapCoordText:SetTextColor(1, 1, 1)

MiniMapCoord:SetScript('OnUpdate', function(self, elapsed)
	total = total + elapsed
	if(total > 0.25) then
		if(IsInInstance()) then
			MiniMapCoordText:SetText()
		else
			local x, y = GetPlayerMapPosition('player')
			MiniMapCoordText:SetFormattedText('%.0f,%.0f', x*100, y*100)
		end
		total = 0
	end
end)
	
TimeManagerClockButton:ClearAllPoints()
TimeManagerClockButton:SetPoint('BOTTOMLEFT', Minimap)
TimeManagerClockButton.SetPoint = function() end

local handler = CreateFrame('Frame')
handler:RegisterEvent('ZONE_CHANGED_NEW_AREA')
handler:SetScript('OnEvent', function()
	SetMapToCurrentZone()
end)
\ No newline at end of file
diff --git a/pMinimap_Coords/pMinimap_Coords.toc b/pMinimap_Coords/pMinimap_Coords.toc
new file mode 100644
index 0000000..1dd657e
--- /dev/null
+++ b/pMinimap_Coords/pMinimap_Coords.toc
@@ -0,0 +1,9 @@
+## Interface: 30000
+## Author: p3lim
+## Version: 30000.wowi:revision
+## Title: |cffff6000p|rMinimap_Coords
+## Notes: Coords module for pMinimap
+## RequiredDeps: pMinimap
+## LoadOnDemand: 1
+
+pMinimap_Coords.lua
\ No newline at end of file
diff --git a/pMinimap_Durability/pMinimap_Durability.lua b/pMinimap_Durability/pMinimap_Durability.lua
new file mode 100644
index 0000000..d9888d8
--- /dev/null
+++ b/pMinimap_Durability/pMinimap_Durability.lua
@@ -0,0 +1 @@
+function pMinimap.UPDATE_INVENTORY_ALERTS()
	local db = pMinimapDB or {colors = {0, 0, 0, 1}}
	local maxStatus = 0
	for id in pairs(INVENTORY_ALERT_STATUS_SLOTS) do
		local status = GetInventoryAlertStatus(id)
		if(status > maxStatus) then
			maxStatus = status
		end
	end

	local color = INVENTORY_ALERT_COLORS[maxStatus]
	if(color) then
		Minimap:SetBackdropColor(color.r, color.g, color.b)
	else
		Minimap:SetBackdropColor(unpack(db.colors))
	end
end

pMinimap:RegisterEvent('UPDATE_INVENTORY_ALERTS')
pMinimap.UPDATE_INVENTORY_ALERTS()

DurabilityFrame:SetAlpha(0)
\ No newline at end of file
diff --git a/pMinimap_Durability/pMinimap_Durability.toc b/pMinimap_Durability/pMinimap_Durability.toc
new file mode 100644
index 0000000..ad235dc
--- /dev/null
+++ b/pMinimap_Durability/pMinimap_Durability.toc
@@ -0,0 +1,9 @@
+## Interface: 30000
+## Author: p3lim
+## Version: 30000.wowi:revision
+## Title: |cffff6000p|rMinimap_Durability
+## Notes: Durability module for pMinimap
+## RequiredDeps: pMinimap
+## LoadOnDemand: 1
+
+pMinimap_Durability.lua
\ No newline at end of file