Quantcast

changed too much to list really

Kelly Crabbé [12-15-13 - 04:26]
changed too much to list really
Filename
core.lua
diff --git a/core.lua b/core.lua
index c30ff90..10b401d 100755
--- a/core.lua
+++ b/core.lua
@@ -1,27 +1,30 @@
-----------------------------------------------------------------------------------------------------
+------------------------------------------------------------------------
 --  Look In Teh Corner!  --
 --  Big thanks to haste"s oMinimap on which this is based.
 --  I mainly added coordinates, changed some positions,
 --  but as per his copyright thingie, the addon has changed name.
 --  I would like to thank Lyn for the awesome name.
-----------------------------------------------------------------------------------------------------
+------------------------------------------------------------------------

+------------------------------------------------------------------------
 -- Configuration and lessening the typing strains of the world.
---local color = RAID_CLASS_COLORS[select(2, UnitClass("Player"))] -- if you don"t want classcolored borders, then you can comment this out (add -- in front)
-local color = {.6, .6, .6, 1} -- uncomment and alter values for a set color ( {r, g, b, a} )
-local font = "Fonts\\ARIALN.ttf"
-local scale = 1.1
+------------------------------------------------------------------------
+local font = STANDARD_TEXT_FONT
+local scale = 1
 local backdrop = {
     bgFile = "Interface\\Buttons\\WHITE8x8",
     edgeFile = "Interface\\Buttons\\WHITE8x8",
     tiled = true,
     edgeSize = 1,
-    insets = { left = -2, right = -2, top = -2, bottom = -2}
+    insets = { left = -1, right = -1, top = -1, bottom = -1}
   }
-local backdropColor = { .1,.1,.1,1 }
-local borderColor = { .6,.6,.6,1 }
+local backdropColor = { r = .1, g = .1, b = .1, a = 1 }
+local borderColor = { r = .6, g = .6, b = .6, a = 1 }
+local showZoneText = true -- true shows zonetext

--- Global fluff
+------------------------------------------------------------------------
+-- Square maps ftw
+------------------------------------------------------------------------
 function GetMinimapShape() return "SQUARE" end

 -- Frame creation
@@ -44,10 +47,35 @@ local hiddenFrames = {
   GameTimeFrame
 }

--- Frame fluff
+------------------------------------------------------------------------
+-- Util funcs
+------------------------------------------------------------------------
+function LookInTehCorner:GetLocTextColor()
+  local pvpType = GetZonePVPInfo()
+  if pvpType == "arena" then
+    return 0.84, 0.03, 0.03
+  elseif pvpType == "friendly" then
+    return 0.05, 0.85, 0.03
+  elseif pvpType == "contested" then
+    return 0.9, 0.85, 0.05
+  elseif pvpType == "hostile" then
+    return 0.84, 0.03, 0.03
+  elseif pvpType == "sanctuary" then
+    return 0.035, 0.58, 0.84
+  elseif pvpType == "combat" then
+    return 0.84, 0.03, 0.03
+  else
+    return 0.84, 0.03, 0.03
+  end
+end
+
+------------------------------------------------------------------------
+-- PLAYER LOGIN func - the main shebang
+------------------------------------------------------------------------
 function events:PLAYER_LOGIN(...)
+  -- Relocating minimap and allowing it to be moved
   Minimap:ClearAllPoints()
-  Minimap:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -15, -15)
+  Minimap:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -10, -10)
   Minimap:SetMovable(true)
   Minimap:SetUserPlaced(true)
   Minimap:EnableMouse(true)
@@ -55,19 +83,20 @@ function events:PLAYER_LOGIN(...)
   Minimap:SetScript("OnDragStart", function(self) self:StartMoving() end)
   Minimap:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
   Minimap:SetFrameLevel(2)
+  Minimap:SetScale(scale)
+  Minimap:SetMaskTexture("Interface\\ChatFrame\\ChatFrameBackground")

-  --self:SetParent(Minimap)
-  self:SetAllPoints(Minimap)
-  self:SetWidth(Minimap:GetWidth()*scale+1)
-  self:SetHeight(Minimap:GetHeight()*scale+1)
+  -- Why not use the Event Handler as border too?
+  self:SetParent(Minimap)
+  self:SetPoint('CENTER')
+  self:SetWidth(Minimap:GetWidth()*scale+6)
+  self:SetHeight(Minimap:GetHeight()*scale+6)
   self:SetFrameLevel(1)
-  self:SetFrameStrata("BACKGROUND")

-  Minimap:SetScale(scale)
-  Minimap:SetMaskTexture("Interface\\ChatFrame\\ChatFrameBackground")
-  Minimap:SetBackdrop(backdrop)
-  Minimap:SetBackdropColor(r, g, b, a)
-  Minimap:SetBackdropBorderColor(borderColor.r, borderColor.g, borderColor.b)
+  -- Giving it a border
+  self:SetBackdrop(backdrop)
+  self:SetBackdropColor(backdropColor.r, backdropColor.g, backdropColor.b, backdropColor.a)
+  self:SetBackdropBorderColor(borderColor.r, borderColor.g, borderColor.b, borderColor.a)

 -- mousewheel scrolling
   Minimap:EnableMouseWheel()
@@ -82,11 +111,12 @@ function events:PLAYER_LOGIN(...)
 -- Tracking menu changes
   MiniMapTrackingIconOverlay:SetAlpha(0)
   MiniMapTrackingButtonBorder:Hide()
-  MiniMapTrackingIcon:SetTexCoord(0.065, 0.935, 0.065, 0.935)
-  MiniMapTracking:SetParent(Minimap)
-  MiniMapTracking:ClearAllPoints()
-  MiniMapTracking:SetScale(.8)
-  MiniMapTracking:SetPoint("TOPLEFT", -2, 2)
+  MiniMapTracking:Hide()
+  -- MiniMapTrackingIcon:SetTexCoord(0.065, 0.935, 0.065, 0.935)
+  -- MiniMapTracking:SetParent(Minimap)
+  -- MiniMapTracking:ClearAllPoints()
+  -- MiniMapTracking:SetScale(.8)
+  -- MiniMapTracking:SetPoint("TOPLEFT", -2, 2)

 --[[ PvP Icon
   MiniMapBattlefieldFrame:SetParent(Minimap)
@@ -96,17 +126,21 @@ function events:PLAYER_LOGIN(...)
 -- Mail icon changes
   MiniMapMailIcon:SetTexture("Interface\\AddOns\\LookInTehCorner\\media\\mail") -- remove this line if you want the default mail icon to show
   MiniMapMailFrame:ClearAllPoints()
-  MiniMapMailFrame:SetPoint("BOTTOM", Minimap,"BOTTOM")
+  MiniMapMailFrame:SetPoint("BOTTOM", Minimap,"BOTTOM", 0, -10)

 -- Minimap zone text stuff.
-  --MinimapZoneText:Hide() -- remove -- if you want to hide the ZoneText and add -- in front of the following lines.
-  MinimapZoneText:SetDrawLayer"OVERLAY"
-  MinimapZoneText:ClearAllPoints()
-  MinimapZoneText:SetPoint("LEFT", Minimap, 5, 0)
-  MinimapZoneText:SetPoint("RIGHT", Minimap, -5, 0)
-  MinimapZoneText:SetPoint("BOTTOM", Minimap, "TOP", 0, 5)
-  MinimapZoneText:SetFont(font, 11)
-  MinimapZoneText:SetJustifyH("CENTER")
+  if (showZoneText == true) then
+    MinimapZoneText:SetDrawLayer"OVERLAY"
+    MinimapZoneText:ClearAllPoints()
+    MinimapZoneText:SetPoint("LEFT", Minimap, 5, 0)
+    MinimapZoneText:SetPoint("RIGHT", Minimap, -5, 0)
+    MinimapZoneText:SetPoint("TOP", Minimap, "TOP", 0, -1)
+    MinimapZoneText:SetFont(font, 10)
+    MinimapZoneText:SetJustifyH("CENTER")
+    MinimapZoneText:SetTextColor(LookInTehCorner:GetLocTextColor())
+  else
+    MinimapZoneText:Hide()
+  end

 -- World PvP Frame
   if (WorldStateCaptureBar) then
@@ -118,15 +152,17 @@ function events:PLAYER_LOGIN(...)

   -- shitty 3.3 flag to move
   MiniMapInstanceDifficulty:ClearAllPoints()
-  MiniMapInstanceDifficulty:SetParent(Minimap)
-  MiniMapInstanceDifficulty:SetPoint("TOPRIGHT", Minimap, "TOPRIGHT", 0, 0)
-  MiniMapInstanceDifficulty:SetScale(.7)
+  MiniMapInstanceDifficulty:Hide()
+  -- MiniMapInstanceDifficulty:SetParent(Minimap)
+  -- MiniMapInstanceDifficulty:SetPoint("TOPRIGHT", Minimap, "TOPRIGHT", 0, 0)
+  -- MiniMapInstanceDifficulty:SetScale(.7)

   -- 4.0.6 Guild instance difficulty
   GuildInstanceDifficulty:ClearAllPoints()
-  GuildInstanceDifficulty:SetParent(Minimap)
-  GuildInstanceDifficulty:SetPoint("TOPLEFT", Minimap, "TOPLEFT", 0, 0)
-  GuildInstanceDifficulty:SetScale(.7)
+  GuildInstanceDifficulty:Hide()
+  -- GuildInstanceDifficulty:SetParent(Minimap)
+  -- GuildInstanceDifficulty:SetPoint("TOPLEFT", Minimap, "TOPLEFT", 0, 0)
+  -- GuildInstanceDifficulty:SetScale(.7)

   -- LFG Eye
   local function UpdateLFG()
@@ -151,8 +187,7 @@ end

 -- Event handling
 LookInTehCorner:SetScript("OnEvent", function(self, event, ...)
- events[event](self, ...) -- call one of the functions above
+ events[event](self, event, ...) -- call one of the functions above
 end)
 LookInTehCorner:RegisterEvent"PLAYER_LOGIN"
--- LookInTehCorner:RegisterEvent"CALENDAR_UPDATE_PENDING_INVITES"
 -- LookInTehCorner:RegisterEvent"UPDATE_PENDING_MAIL"
\ No newline at end of file