From 96b94a8bd33da679c5f43fc78df9e420751f4f12 Mon Sep 17 00:00:00 2001 From: Repooc Date: Mon, 25 Mar 2013 06:10:14 -0400 Subject: [PATCH] Added World Markers with keybinding options in Key Bindings menu --- ElvUI_SLE/Bindings.xml | 17 ++++ ElvUI_SLE/ElvUI_SLE.toc | 5 +- ElvUI_SLE/config/profile.lua | 7 ++ ElvUI_SLE/modules/marks/flares.lua | 139 ++++++++++++++++++++++++++++++++ ElvUI_SLE/modules/marks/load_marks.xml | 1 + ElvUI_SLE/modules/marks/options.lua | 76 +++++++++++++++++ 6 files changed, 243 insertions(+), 2 deletions(-) create mode 100644 ElvUI_SLE/Bindings.xml create mode 100644 ElvUI_SLE/modules/marks/flares.lua diff --git a/ElvUI_SLE/Bindings.xml b/ElvUI_SLE/Bindings.xml new file mode 100644 index 0000000..f37f5e3 --- /dev/null +++ b/ElvUI_SLE/Bindings.xml @@ -0,0 +1,17 @@ + + + -- Square + + + -- Triangle + + + -- Diamond + + + -- Cross + + + -- Star + + \ No newline at end of file diff --git a/ElvUI_SLE/ElvUI_SLE.toc b/ElvUI_SLE/ElvUI_SLE.toc index 0b4e48a..1f70a76 100755 --- a/ElvUI_SLE/ElvUI_SLE.toc +++ b/ElvUI_SLE/ElvUI_SLE.toc @@ -3,7 +3,7 @@ ## Author: Darth Predator, Repooc ## Version: 1.62 ## Notes: Plugin-edit for |cff1784d1ElvUI|r. -## Notes-ruRU: Плагин-редакция для |cff1784d1ElvUI|r. +## Notes-ruRU: Плагин-редакци? дл? |cff1784d1ElvUI|r. ## eMail: darthpred@gmail.com, repooc@tukui.org ## URL: http://tukui.org/ ## RequiredDeps: ElvUI @@ -20,4 +20,5 @@ modules\load_modules.xml skins\load_skins.xml config\load_config.xml layout\layout.lua -dev\load_dev.xml \ No newline at end of file +dev\load_dev.xml +Bindings.xml \ No newline at end of file diff --git a/ElvUI_SLE/config/profile.lua b/ElvUI_SLE/config/profile.lua index 1c40d81..18aca2e 100755 --- a/ElvUI_SLE/config/profile.lua +++ b/ElvUI_SLE/config/profile.lua @@ -204,6 +204,13 @@ P['sle'] = { ['size'] = 18, }, + ['flares'] = { + ['enabled'] = true, + ['growth'] = "RIGHT", + ['showinside'] = false, + ['size'] = 20, + }, + --UI Buttons ['uibuttons'] = { ['enable'] = false, diff --git a/ElvUI_SLE/modules/marks/flares.lua b/ElvUI_SLE/modules/marks/flares.lua new file mode 100644 index 0000000..8515371 --- /dev/null +++ b/ElvUI_SLE/modules/marks/flares.lua @@ -0,0 +1,139 @@ +local E, L, V, P, G, _ = unpack(ElvUI); +local RF = E:NewModule('RaidFlares', 'AceHook-3.0', 'AceEvent-3.0'); + +BINDING_HEADER_SHADOWLIGHT_WORLDMARKER = GetAddOnMetadata(..., "Title"); +--BINDING_HEADER_SHADOWLIGHT_WORLDMARKER = string.format("|cffe1a500w|cff69ccf0Marker|r - %s",L["World markers"]); +_G["BINDING_NAME_CLICK SquareFlareMarker:LeftButton"] = L["Square"]; +_G["BINDING_NAME_CLICK TriangleFlareMarker:LeftButton"] = L["Triangle"]; +_G["BINDING_NAME_CLICK DiamondFlareMarker:LeftButton"] = L["Diamond"]; +_G["BINDING_NAME_CLICK CrossFlareMarker:LeftButton"] = L["Cross"]; +_G["BINDING_NAME_CLICK StarFlareMarker:LeftButton"] = L["Star"]; + +local mainFlares = CreateFrame("Frame", "Main_Flares", E.UIParent) +local f1 = CreateFrame("Button", "SquareFlareMarker", Main_Flares, "SecureActionButtonTemplate") +local f2 = CreateFrame("Button", "TriangleFlareMarker", Main_Flares, "SecureActionButtonTemplate") +local f3 = CreateFrame("Button", "DiamondFlareMarker", Main_Flares, "SecureActionButtonTemplate") +local f4 = CreateFrame("Button", "CrossFlareMarker", Main_Flares, "SecureActionButtonTemplate") +local f5 = CreateFrame("Button", "StarFlareMarker", Main_Flares, "SecureActionButtonTemplate") + +local FlareB = {f1,f2,f3,f4,f5} + +function RF:CreateFrame() + mainFlares:Point("CENTER", E.UIParent, "CENTER", 0, 40); + mainFlares:SetFrameStrata('LOW'); + mainFlares:CreateBackdrop(); + mainFlares.backdrop:SetAllPoints(); + mainFlares:Hide(); +end + +function RF:SetupButton(button, flare) + button:CreateBackdrop() + button.backdrop:SetAllPoints() + button:SetAttribute("type", "macro") + button:SetAttribute("macrotext", '/wm '..flare..'') + button.tex = button:CreateTexture(nil, 'OVERLAY') + --button.tex:Point('TOPLEFT', button, 'TOPLEFT', 2, -2) + button.tex:Point('TOPLEFT', button, 'TOPLEFT', 0, -1) + --button.tex:Point('BOTTOMRIGHT', button, 'BOTTOMRIGHT', -2, 2) + button.tex:Point('BOTTOMRIGHT', button, 'BOTTOMRIGHT', -2, 1) + if button == f1 then + button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_6") + elseif button == f2 then + button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_4") + elseif button == f3 then + button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_3") + elseif button == f4 then + button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_7") + elseif button == f5 then + button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_1") + end +end + +function RF:CreateButtons() + for i = 1, 5 do + RF:SetupButton(FlareB[i], i) + end +end + +function RF:FrameButtonsSize() + for i = 1, 5 do + FlareB[i]:Size(E.db.sle.flares.size) + end +end + +function RF:FrameButtonsGrowth() + local db = E.db.sle.flares + local size = db.size + local width, height, x, y, anchor, point + local t = {5*size+8,size+4,"LEFT","RIGHT","TOP","BOTTOM",1,0,-1} + for i = 1, 5 do + FlareB[i]:ClearAllPoints() + end + + if db.growth == "RIGHT" then + width, height, anchor, point, _, _, x, y = unpack(t) + elseif db.growth == "LEFT" then + width, height, point, anchor, _, _, _, y, x = unpack(t) + elseif db.growth == "UP" then + height, width, _, _, point, anchor, y, x = unpack(t) + elseif db.growth == "DOWN" then + height, width, _, _, anchor, point, _, x, y = unpack(t) + end + + mainFlares:SetWidth(width) + mainFlares:SetHeight(height) + + for i = 1, 5 do + if i == 1 then + FlareB[i]:Point(anchor, Main_Flares, anchor, 2 * x, 2 * y) + else + FlareB[i]:Point(anchor, FlareB[i-1], point, x, y) + end + end +end + +function RF:UpdateVisibility() + local inInstance, instanceType = IsInInstance() + local db = E.db.sle.flares + if db.enabled then + if (inInstance and instanceType ~= "pvp") and db.showinside then + E.FrameLocks['Main_Flares'] = true + mainFlares:Show() + elseif not inInstance and db.showinside then + E.FrameLocks['Main_Flares'] = nil + mainFlares:Hide() + elseif not db.showinside then + E.FrameLocks['Main_Flares'] = true + mainFlares:Show() + end + else + E.FrameLocks['Main_Flares'] = true + mainFlares:Hide() + end +end + +function RF:Backdrop() + if E.db.sle.flares.backdrop then + mainFlares.backdrop:Show() + else + mainFlares.backdrop:Hide() + end +end + +function RF:Update() + RF:FrameButtonsSize() + RF:FrameButtonsGrowth() + RF:UpdateVisibility() + RF:Backdrop() +end + +function RF:Initialize() + RF:CreateFrame() + RF:Update() + RF:CreateButtons() + self:RegisterEvent("PLAYER_ENTERING_WORLD", "UpdateVisibility"); + + E:CreateMover(mainFlares, "FlareMover", "RF", nil, nil, nil, "ALL,S&L,S&L MISC") +end + +E:RegisterModule(RF:GetName()) \ No newline at end of file diff --git a/ElvUI_SLE/modules/marks/load_marks.xml b/ElvUI_SLE/modules/marks/load_marks.xml index cbcf6d9..248f4e3 100755 --- a/ElvUI_SLE/modules/marks/load_marks.xml +++ b/ElvUI_SLE/modules/marks/load_marks.xml @@ -1,4 +1,5 @@ +