diff --git a/LookInTehCorner.toc b/LookInTehCorner.toc new file mode 100644 index 0000000..925291b --- /dev/null +++ b/LookInTehCorner.toc @@ -0,0 +1,18 @@ +## Interface: 30100 +## Title: Look In Teh Corner +## Author: MoonWitch +## Version: 1.2 +## X-eMail: kelly.crabbe@gmail.com +## X-Website: http://other-net.com +## X-Credits: Haste for his oMinimap which acted as the base. Lyn for the name! +## Notes: Square minimap, with coords and the likes :P +## X-Category: Map +## OptionalDeps: Blizzard_TimeManager + +core.lua +clock.lua +compass.lua +coordinates.lua +#tooltip.lua +rightclick.lua +#instancing.lua \ No newline at end of file diff --git a/clock.lua b/clock.lua new file mode 100644 index 0000000..d6e772a --- /dev/null +++ b/clock.lua @@ -0,0 +1,50 @@ +if(not IsAddOnLoaded("Blizzard_TimeManager")) then + LoadAddOn("Blizzard_TimeManager") +end + +local function OnClick(self, button) + if(self.alarmFiring) then + PlaySound("igMainMenuQuit") + TimeManager_TurnOffAlarm() + else + if(button == "RightButton") then + ToggleCalendar() + else + if(not IsAddOnLoaded("Blizzard_Calendar")) then + LoadAddOn("Blizzard_Calendar") + end + ToggleTimeManager() + end + end +end + +LookInTehCorner.CALENDAR_UPDATE_PENDING_INVITES = function() + if(CalendarGetNumPendingInvites() ~= 0) then + TimeManagerClockTicker:SetTextColor(0, 1, 0) + else + TimeManagerClockTicker:SetTextColor(1, .8, 0) + end +end + +TimeManagerClockButton:ClearAllPoints() +TimeManagerClockButton:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT") +TimeManagerClockButton:SetWidth(40) +TimeManagerClockButton:SetHeight(14) +TimeManagerClockButton:GetRegions():Hide() +TimeManagerClockButton:Show() + +select(1, TimeManagerClockButton:GetRegions()):Hide() + +TimeManagerClockTicker:SetPoint("CENTER", TimeManagerClockButton) +TimeManagerClockTicker:SetFont(STANDARD_TEXT_FONT, 12, "THINOUTLINE") +TimeManagerClockTicker:SetTextColor(1, .8, 0) + +TimeManagerAlarmFiredTexture.Show = function() TimeManagerClockTicker:SetTextColor(1, 0, 0) end +TimeManagerAlarmFiredTexture.Hide = function() TimeManagerClockTicker:SetTextColor(1, 1, 1) end + +local clockFlash = select(3, TimeManagerClockButton:GetRegions()) +clockFlash.Show = function() TimeManagerClockTicker:SetTextColor(1, 0, 0) end +clockFlash.Hide = function() TimeManagerClockTicker:SetTextColor(1, .8, 0) end + +-- Event Handlers +TimeManagerClockButton:SetScript("OnClick", OnClick) \ No newline at end of file diff --git a/compass.lua b/compass.lua new file mode 100644 index 0000000..79f3796 --- /dev/null +++ b/compass.lua @@ -0,0 +1,13 @@ +MinimapNorthTag:SetAlpha(0) + +local Compass = CreateFrame("Frame", "Compass", Minimap) +Compass:SetAllPoints() +for dir,anchor in pairs{W = "LEFT", S = "BOTTOM", E = "RIGHT", N = "TOP"} do + local key = Compass:CreateFontString() + key:SetFontObject(GameFontWhite) + key:SetPoint("CENTER", Compass, anchor) + key:SetText(dir) +end + +--Compass:Show() +Compass:Hide() \ No newline at end of file diff --git a/coordinates.lua b/coordinates.lua new file mode 100644 index 0000000..af15477 --- /dev/null +++ b/coordinates.lua @@ -0,0 +1,35 @@ +-- Coordinates for LookInTehCorner + +local Coords = CreateFrame('Button', nil, Minimap) +local coordsf = Coords:CreateFontString(nil, 'OVERLAY') +coordsf:SetPoint('BOTTOMLEFT', Minimap, 'BOTTOMLEFT', 1, 1) +coordsf:SetJustifyH('LEFT') +coordsf:SetWidth(75) +coordsf:SetHeight(12) +coordsf:SetTextColor(1, .8, 0) +coordsf:SetShadowColor(0, 0, 0, .7) +coordsf:SetShadowOffset(1, -1) +coordsf:SetFont(STANDARD_TEXT_FONT, 12, "THINOUTLINE") + +-- Coordinate functions DO NOT TOUCH +local coords = function(self, elapsed) + local x, y = GetPlayerMapPosition('player') + coordsf:SetFormattedText('%.0f,%.0f', x * 100, y * 100) +end + +-- doesn't work +function onClickCoord(self, button) + if(button == 'RightButton') then + ToggleBattlefieldMinimap() + else + ToggleFrame(WorldMapFrame) + end +end + +if (event == 'ZONE_CHANGED_NEW_AREA') then + SetMapToCurrentZone() +end + +Coords:SetScript('OnUpdate', coords) +Coords:SetScript('OnClick', onClickCoord) +Coords:RegisterEvent'ZONE_CHANGED_NEW_AREA' \ No newline at end of file diff --git a/core.lua b/core.lua new file mode 100644 index 0000000..c19501a --- /dev/null +++ b/core.lua @@ -0,0 +1,148 @@ +---------------------------------------------------------------------------------------------------- +-- 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 + +-- Global fluff +function GetMinimapShape() return "SQUARE" end + +-- Frame creation +local LookInTehCorner = CreateFrame("Frame", "LookInTehCorner", Minimap) + +local frames = { + MinimapBorder, + MinimapBorderTop, + MinimapToggleButton, + MinimapZoomIn, + MinimapZoomOut, + MiniMapTrackingBackground, + MiniMapBattlefieldBorder, + MiniMapMeetingStoneFrame, + MiniMapVoiceChatFrame, + MiniMapWorldMapButton, + MiniMapMailBorder, + BattlegroundShine, + MiniMapZoneTextButton, + MiniMapLFGFrameBorder, + GameTimeFrame +} + +-- Frame fluff +LookInTehCorner.PLAYER_LOGIN = function(self) + Minimap:ClearAllPoints() + Minimap:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -15, -15) + Minimap:SetMovable(true) + Minimap:SetUserPlaced(true) + Minimap:EnableMouse(true) + Minimap:RegisterForDrag("LeftButton") + Minimap:SetScript("OnDragStart", function(self) self:StartMoving() end) + Minimap:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end) + Minimap:SetFrameLevel(2) + + --self:SetParent(Minimap) + self:SetAllPoints(Minimap) + self:SetWidth(Minimap:GetWidth()*scale) + self:SetHeight(Minimap:GetHeight()*scale) + self:SetFrameLevel(1) + self:SetFrameStrata("BACKGROUND") + + Minimap:SetScale(scale) + Minimap:SetMaskTexture("Interface\\ChatFrame\\ChatFrameBackground") + Minimap:SetBackdrop({bgFile = "Interface\\ChatFrame\\ChatFrameBackground", insets = { + top = -2 / scale, + left = -3 / scale, + bottom = -2 / scale, + right = -2 / scale + }}) + Minimap:SetBackdropColor(r, g, b, a) + +-- mousewheel scrolling + Minimap:EnableMouseWheel() + Minimap:SetScript("OnMouseWheel", function(self, dir) + if(dir > 0) then + Minimap_ZoomIn() + else + Minimap_ZoomOut() + end + end) + +-- 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) + +-- PvP Icon + MiniMapBattlefieldFrame:SetParent(Minimap) + MiniMapBattlefieldFrame:ClearAllPoints() + MiniMapBattlefieldFrame:SetPoint("TOPRIGHT", -2, -2) + +-- 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") + +-- 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") + +-- World PvP Frame + if (WorldStateCaptureBar) then + WorldStateCaptureBar:ClearAllPoints() + WorldStateCaptureBar:SetPoint("TOP", UIParent, "TOP", -75, -50) + WorldStateCaptureBar.SetPoint = function() end + WorldStateCaptureBar.ClearAllPoints = function() end + end + + -- shitty 3.3 flag to move + MiniMapInstanceDifficulty:ClearAllPoints() + MiniMapInstanceDifficulty:SetParent(Minimap) + MiniMapInstanceDifficulty:SetPoint("TOPRIGHT", Minimap, "TOPRIGHT", 0, 0) + MiniMapInstanceDifficulty:SetScale(.7) + + -- LFG Eye + MiniMapLFGFrame:ClearAllPoints() + MiniMapLFGFrame:SetParent(Minimap) + MiniMapLFGFrame:SetPoint("TOP", Minimap, 0, 0) + MiniMapLFGFrame:SetScale(1) + MiniMapLFGFrameBorder:Hide() + + --[[ Quest Watcher Frame + WatchFrame:ClearAllPoints() + WatchFrame.ClearAllPoints = function() end + WatchFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 20, -15) + WatchFrame.SetPoint = function() end + WatchFrame:SetClampedToScreen(true) +--]] +-- Frame hiding + for _, frame in pairs(frames) do + frame:Hide() + end + frames = nil + + self:UnregisterEvent"ADDON_LOADED" +end + + +-- Event handling +LookInTehCorner:SetScript("OnEvent", function(self, event, ...) self[event](self) end) +LookInTehCorner:RegisterEvent"PLAYER_LOGIN" +LookInTehCorner:RegisterEvent"CALENDAR_UPDATE_PENDING_INVITES" \ No newline at end of file diff --git a/instancing.lua b/instancing.lua new file mode 100644 index 0000000..9ff4196 --- /dev/null +++ b/instancing.lua @@ -0,0 +1,44 @@ +--[[ Instance Difficulty - should work now finally taken from Wanderlust by Ichik]] + +local _, class = UnitClass("player") +local color = RAID_CLASS_COLORS[class] +local id = CreateFrame("Frame", nil, UIParent) +LookInTehCorner:RegisterEvent("PLAYER_ENTERING_WORLD") +LookInTehCorner:RegisterEvent("PLAYER_DIFFICULTY_CHANGED") + +local idtext = id:CreateFontString(nil, "OVERLAY") +idtext:SetPoint("TOPRIGHT", Minimap, "TOPRIGHT", 0, -4) +idtext:SetFont("Fonts\\FRIZQT__.ttf", 14, "THINOUTLINE") +idtext:SetTextColor(color.r, color.g, color.b) + +function indiff() + local instance, instancetype = IsInInstance() + local _, _, difficultyIndex, _, _, playerDifficulty, isDynamic = GetInstanceInfo() + if instance and instancetype == "raid" then + if isDynamic and difficultyIndex == 1 then + if playerDifficulty == 0 then + idtext:SetText("10") end + if playerDifficulty == 1 then + idtext:SetText("10H") end + end + if isDynamic and difficultyIndex == 2 then + if playerDifficulty == 0 then + idtext:SetText("25") end + if playerDifficulty == 1 then + idtext:SetText("25H") end + end + if not isDynamic then + if difficultyIndex == 1 then + idtext:SetText("10") end + if difficultyIndex == 2 then + idtext:SetText("25") end + if difficultyIndex == 3 then + idtext:SetText("10H") end + if difficultyIndex == 4 then + idtext:SetText("25H") end + end + end + if not instance then + idtext:SetText("") end +end +id:SetScript("OnEvent", function() indiff() end) \ No newline at end of file diff --git a/license b/license new file mode 100644 index 0000000..3295bc0 --- /dev/null +++ b/license @@ -0,0 +1,31 @@ +--[[------------------------------------------------------------------------- + Copyright (c) 2006, Trond A Ekseth + Copyright (c) 2008, Kelly Crabbé + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of pMinimap nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +---------------------------------------------------------------------------]] \ No newline at end of file diff --git a/media/Border4.tga b/media/Border4.tga new file mode 100644 index 0000000..5205da5 Binary files /dev/null and b/media/Border4.tga differ diff --git a/media/SQUARE.tga b/media/SQUARE.tga new file mode 100644 index 0000000..38f05c3 Binary files /dev/null and b/media/SQUARE.tga differ diff --git a/media/blank.tga b/media/blank.tga new file mode 100644 index 0000000..1c60453 Binary files /dev/null and b/media/blank.tga differ diff --git a/media/border.tga b/media/border.tga new file mode 100644 index 0000000..24e2b83 Binary files /dev/null and b/media/border.tga differ diff --git a/media/border2.tga b/media/border2.tga new file mode 100644 index 0000000..3b3610b Binary files /dev/null and b/media/border2.tga differ diff --git a/media/mail.tga b/media/mail.tga new file mode 100644 index 0000000..e154114 Binary files /dev/null and b/media/mail.tga differ diff --git a/media/rounded_square.tga b/media/rounded_square.tga new file mode 100644 index 0000000..833101d Binary files /dev/null and b/media/rounded_square.tga differ diff --git a/rightclick.lua b/rightclick.lua new file mode 100644 index 0000000..120be9a --- /dev/null +++ b/rightclick.lua @@ -0,0 +1,41 @@ +---------------------------------------------------------------------------------------- +-- Right click menu +---------------------------------------------------------------------------------------- +local menuFrame = CreateFrame("Frame", "MinimapRightClickMenu", UIParent, "UIDropDownMenuTemplate") +local menuList = { + {text = CHARACTER_BUTTON, + func = function() ToggleCharacter("PaperDollFrame") end}, + {text = SPELLBOOK_ABILITIES_BUTTON, + func = function() ToggleFrame(SpellBookFrame) end}, + {text = TALENTS_BUTTON, + func = function() ToggleTalentFrame() end}, + {text = ACHIEVEMENT_BUTTON, + func = function() ToggleAchievementFrame() end}, + {text = QUESTLOG_BUTTON, + func = function() ToggleFrame(QuestLogFrame) end}, + {text = SOCIAL_BUTTON, + func = function() ToggleFriendsFrame(1) end}, + {text = PLAYER_V_PLAYER, + func = function() ToggleFrame(PVPParentFrame) end}, + {text = LFG_TITLE, + func = function() ToggleFrame(LFDParentFrame) end}, + {text = L_LFRAID, + func = function() ToggleFrame(LFRParentFrame) end}, + {text = HELP_BUTTON, + func = function() ToggleHelpFrame() end}, + {text = L_CALENDAR, + func = function() + if(not CalendarFrame) then LoadAddOn("Blizzard_Calendar") end + Calendar_Toggle() + end}, +} + +Minimap:SetScript("OnMouseUp", function(self, btn) + if btn == "RightButton" then + ToggleDropDownMenu(1, nil, MiniMapTrackingDropDown, self) + elseif btn == "MiddleButton" then + EasyMenu(menuList, menuFrame, "cursor", 0, 0, "MENU", 2) + else + Minimap_OnClick(self) + end +end) \ No newline at end of file diff --git a/todo b/todo new file mode 100644 index 0000000..d5f3c04 --- /dev/null +++ b/todo @@ -0,0 +1,9 @@ +mMinimap: + +ToDO: +- Create function to show/hide + - Gloss + - Coordinates + - Choose mask/border + - ZoneText +- Create Options Dialog \ No newline at end of file diff --git a/tooltip.lua b/tooltip.lua new file mode 100644 index 0000000..372ad1b --- /dev/null +++ b/tooltip.lua @@ -0,0 +1,76 @@ +------------------------------ +-- Localizing some crap -- +------------------------------ + +local MEMTHRESH = 32 +local string_format, math_modf, GetNetStats, GetFramerate, gcinfo = string.format, math.modf, GetNetStats, GetFramerate, gcinfo + +local function ColorGradient(perc, r1, g1, b1, r2, g2, b2, r3, g3, b3) + if perc >= 1 then return r3, g3, b3 elseif perc <= 0 then return r1, g1, b1 end + + local segment, relperc = math_modf(perc*2) + if segment == 1 then r1, g1, b1, r2, g2, b2 = r2, g2, b2, r3, g3, b3 end + return r1 + (r2-r1)*relperc, g1 + (g2-g1)*relperc, b1 + (b2-b1)*relperc +end + +local function formats(value) + if(value > 999) then + return format('%.1f MiB', value / 1024) + else + return format('%.1f KiB', value) + end +end + +------------------------ +-- Tooltip! -- +------------------------ + +local onEnter = function(self) + GameTooltip:SetOwner(TimeManagerClockButton, "ANCHOR_BOTTOMRIGHT") + + local fps = GetFramerate() + local r, g, b = ColorGradient(fps/75, 1,0,0, 1,1,0, 0,1,0) + GameTooltip:AddDoubleLine("FPS:", string_format("%.1f", fps), nil,nil,nil, r,g,b) + + local _, _, lag = GetNetStats() + local r, g, b = ColorGradient(lag/1000, 0,1,0, 1,1,0, 1,0,0) + GameTooltip:AddDoubleLine("Lag:", lag.. " ms", nil,nil,nil, r,g,b) + + GameTooltip:AddLine(" ") + + local addons, addon, total = {}, {}, 0 + + for i=1, GetNumAddOns() do + addon = {GetAddOnInfo(i), GetAddOnMemoryUsage(i)} + table.insert(addons, addon) + total = total + GetAddOnMemoryUsage(i) + end + + table.sort(addons, (function(a, b) return a[2] > b[2] end)) + + UpdateAddOnMemoryUsage() + + for i,addons in pairs(addons) do + if addons[2] > MEMTHRESH then + local r, g, b = ColorGradient((addons[2] - MEMTHRESH)/768, 0,1,0, 1,1,0, 1,0,0) + local memstr = addons[2] > 1024 and string_format("%.1f MiB", addons[2]/1024) or string_format("%.1f KiB", addons[2]) + GameTooltip:AddDoubleLine(addons[1], memstr, 1,1,1, r,g,b) + end + end + + GameTooltip:AddLine(" ") + + local r, g, b = ColorGradient(total/(40*1024), 0,1,0, 1,1,0, 1,0,0) + GameTooltip:AddDoubleLine("Addon memory:", string_format("%.2f MiB", total/1024), nil,nil,nil, r,g,b) + + local mem = collectgarbage("count") + local r, g, b = ColorGradient(mem/(20*1024), 0,1,0, 1,1,0, 1,0,0) + GameTooltip:AddDoubleLine("Default UI memory:", string_format("%.2f MiB", (gcinfo()-total)/1024), nil,nil,nil, r,g,b) + + GameTooltip:AddLine(" ") + + GameTooltip:Show() +end + +TimeManagerClockButton:SetScript("OnEnter", onEnter) +TimeManagerClockButton:SetScript("OnLeave", function() GameTooltip:Hide() end) \ No newline at end of file