PageRenderTime 562ms CodeModel.GetById 135ms app.highlight 268ms RepoModel.GetById 95ms app.codeStats 2ms

/Tukui/modules/panels/asphyxia_panels.lua

http://github.com/Asphyxia/Tukui
Lua | 423 lines | 344 code | 54 blank | 25 comment | 21 complexity | 5be12dd98e747d8e67b62aa3ce1a6fe5 MD5 | raw file
  1local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
  2
  3local DataVisibility = 1
  4
  5local function ModifiedBackdrop(self)
  6	local color = RAID_CLASS_COLORS[T.myclass]
  7	self:SetBackdropColor(color.r*.15, color.g*.15, color.b*.15)
  8	self:SetBackdropBorderColor(color.r, color.g, color.b)
  9end
 10
 11local function OriginalBackdrop(self)
 12	self:SetTemplate("Default")
 13end
 14
 15---------------------------------------------------------
 16---[[ ADDITIONAL (Asphyxia) PANELS ]]---
 17---------------------------------------------------------
 18
 19-- INFO CENTER (FOR STATS)
 20local icenter = CreateFrame("Frame", "TukuiInfoCenter", TukuiBar1)
 21icenter:CreatePanel("Default", TukuiBar1:GetWidth(), 20, "TOP", TukuiBar1, "BOTTOM", 0, -3)
 22icenter:CreateOverlay(icenter)
 23icenter:CreateShadow("Default")
 24icenter:SetFrameLevel(2)
 25icenter:SetFrameStrata("BACKGROUND")
 26
 27-- INFO CENTER LEFT (FOR STATS)
 28local icenterleft = CreateFrame("Frame", "TukuiInfoCenterLeft", TukuiSplitBarLeft)
 29icenterleft:CreatePanel("Default", TukuiSplitBarLeft:GetWidth(), 20, "TOP", TukuiSplitBarLeft, "BOTTOM", 0, -3)
 30icenterleft:CreateOverlay(icenterleft)
 31icenterleft:CreateShadow("Default")
 32icenterleft:SetFrameLevel(2)
 33icenterleft:SetFrameStrata("BACKGROUND")
 34
 35-- INFO CENTER RIGHT (FOR STATS)
 36local icenterright = CreateFrame("Frame", "TukuiInfoCenterRight", TukuiSplitBarRight)
 37icenterright:CreatePanel("Default", TukuiSplitBarRight:GetWidth(), 20, "TOP", TukuiSplitBarRight, "BOTTOM", 0, -3)
 38icenterright:CreateOverlay(icenterright)
 39icenterright:CreateShadow("Default")
 40icenterright:SetFrameLevel(2)
 41icenterright:SetFrameStrata("BACKGROUND")
 42
 43-- SPECSWITCHER
 44if C.datatext.enable_specswitcher then
 45	local specswitcher = CreateFrame("Button", "TukuiSpecSwitcher", TukuiTabsLeftBackground)
 46	specswitcher :Size(75, TukuiTabsLeftBackground:GetHeight())
 47	specswitcher :Point("RIGHT", TukuiTabsLeftBackground, "RIGHT", -41, 0)
 48	specswitcher :SetFrameStrata(TukuiTabsLeftBackground:GetFrameStrata())
 49	specswitcher :SetFrameLevel(TukuiTabsLeftBackground:GetFrameLevel() + 1)
 50
 51	local talenticon = CreateFrame("Frame", "TukuiTalentIcon", TukuiSpecSwitcher)
 52	talenticon:CreatePanel("Default", TukuiTabsLeftBackground:GetHeight()-4, TukuiTabsLeftBackground:GetHeight()-4, "LEFT", specswitcher, "RIGHT", 20, 0)
 53	talenticon:SetFrameLevel(2)
 54	talenticon:SetFrameStrata("BACKGROUND")
 55
 56	talenticon.tex = talenticon:CreateTexture(nil, "ARTWORK")
 57	talenticon.tex:Point("TOPLEFT", 2, -2)
 58	talenticon.tex:Point("BOTTOMRIGHT", -2, 2)
 59	talenticon.tex:SetTexCoord(0.08, 0.92, 0.08, 0.92)
 60
 61	local UpdateTexture = function(self)
 62		if not GetPrimaryTalentTree() then return end
 63		local primary = GetPrimaryTalentTree()
 64		local tex = select(4, GetTalentTabInfo(primary))
 65
 66		self.tex:SetTexture(tex)
 67	end
 68
 69	talenticon:RegisterEvent("PLAYER_ENTERING_WORLD")
 70	talenticon:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
 71	talenticon:RegisterEvent("PLAYER_TALENT_UPDATE")
 72	talenticon:SetScript("OnEvent", UpdateTexture)
 73end
 74
 75-- TIME PANEL
 76local watch = CreateFrame("Frame", "Tukuiwatch", Minimap)
 77watch:CreatePanel("Default", 53, 17, "TOP", Minimap, "BOTTOM", T.Scale(0), 8)
 78watch:CreateShadow("Default")
 79watch:SetFrameStrata("MEDIUM")
 80watch:CreateOverlay(watch)
 81watch:SetFrameLevel(2)
 82
 83-- SWITCH LAYOUT
 84if C.chat.background then
 85	local swl = CreateFrame("Button", "TukuiSwitchLayoutButton", TukuiTabsRightBackground)
 86	swl:Size(75, TukuiTabsRightBackground:GetHeight())
 87	swl:Point("RIGHT", TukuiTabsRightBackground, "RIGHT", -21, 0)
 88	swl:SetFrameStrata(TukuiTabsRightBackground:GetFrameStrata())
 89	swl:SetFrameLevel(TukuiTabsRightBackground:GetFrameLevel() + 1)
 90	swl:RegisterForClicks("AnyUp") swl:SetScript("OnClick", function()
 91		if IsAddOnLoaded("Tukui_Raid") then
 92			DisableAddOn("Tukui_Raid")
 93			EnableAddOn("Tukui_Raid_Healing")
 94			ReloadUI()
 95		elseif IsAddOnLoaded("Tukui_Raid_Healing") then
 96			DisableAddOn("Tukui_Raid_Healing")
 97			EnableAddOn("Tukui_Raid")
 98			ReloadUI()
 99		elseif not IsAddOnLoaded("Tukui_Raid_Healing") and not IsAddOnLoaded("Tukui_Raid") then
100			EnableAddOn("Tukui_Raid")
101			ReloadUI()
102		end
103	end)
104
105	swl.Text = T.SetFontString(swl, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
106	swl.Text:Point("RIGHT", swl, "RIGHT", -5, 0.5)
107	swl.Text:SetText(T.datacolor..L.datatext_switch_layout)
108end
109
110-- VERSION BUTTON
111local verbutton = CreateFrame("Button", "TukuiVersionButton", TukuiMinimap, "SecureActionButtonTemplate")
112verbutton:CreatePanel("Default", 13, 17, "LEFT", Tukuiwatch, "RIGHT", 3, 0)
113verbutton:CreateShadow("Default")
114verbutton:CreateOverlay(verbutton)
115verbutton:SetAttribute("type", "macro")
116verbutton:SetAttribute("macrotext", "/version")
117verbutton:SetFrameStrata("MEDIUM")
118verbutton:SetFrameLevel(2)
119
120verbutton.Text = T.SetFontString(verbutton, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
121verbutton.Text:Point("CENTER", verbutton, "CENTER", 2, 1)
122verbutton.Text:SetText(T.datacolor.."V")
123
124verbutton:SetScript("OnMouseDown", function(self)
125if InCombatLockdown() then print(ERR_NOT_IN_COMBAT) return end
126	if not TukuiVersionFrame:IsShown() then
127		T.fadeIn(TukuiVersionFrame)
128	else
129		T.fadeOut(TukuiVersionFrame)
130	end
131end)
132
133-- VERSION LOGO (Asphyxia Avatar)
134	local avatar = CreateFrame("Frame", "Avatar", TukuiVersionFrame)
135	avatar:CreatePanel(avatar, 58, 58, "BOTTOM", TukuiVersionFrame, "TOP", 0, 2)
136	avatar:SetFrameLevel(2)
137	avatar:SetFrameStrata("BACKGROUND")
138	avatar:SetTemplate("Default")
139	avatar:CreateShadow("Default")
140	
141local avatar_tex = avatar:CreateTexture(nil, "OVERLAY")
142avatar_tex:SetTexture(C.media.asphyxia)
143avatar_tex:SetPoint("TOPLEFT", avatar, "TOPLEFT", 2, -2)
144avatar_tex:SetPoint("BOTTOMRIGHT", avatar, "BOTTOMRIGHT", -2, 2)
145
146-- HELP BUTTON
147local helpbutton = CreateFrame("Button", "TukuiHelpButton", TukuiMinimap, "SecureActionButtonTemplate")
148helpbutton:CreatePanel("Default", 13, 17, "RIGHT", Tukuiwatch, "LEFT", -3, 0)
149helpbutton:CreateShadow("Default")
150helpbutton:CreateOverlay(helpbutton)
151helpbutton:SetAttribute("type", "macro")
152helpbutton:SetAttribute("macrotext", "/ahelp")
153helpbutton:SetFrameStrata("MEDIUM")
154helpbutton:SetFrameLevel(2)
155
156helpbutton.Text = T.SetFontString(helpbutton, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
157helpbutton.Text:Point("CENTER", helpbutton, "CENTER", 1.5, 1)
158helpbutton.Text:SetText(T.datacolor.."H")
159
160-- ANIMATION FUNCTION [HELP FRAME]
161TukuiAsphyxiaHelpFrame:Animate( 0, 500, 0.8 )
162TukuiHelpButton:EnableMouse( true )
163TukuiHelpButton:SetScript("OnClick", function(self)
164if InCombatLockdown() then return end
165
166if TukuiAsphyxiaHelpFrame:IsVisible() then
167TukuiAsphyxiaHelpFrame:SlideOut()
168else
169TukuiAsphyxiaHelpFrame:SlideIn()
170end
171end )
172
173-- INVISIBLE BUTTON (...Don't ask)
174local invisButton = CreateFrame("Frame", "invisButton", UIParent)
175invisButton:CreatePanel("Transparent", 100, 20, "BOTTOM", UIParent, "BOTTOM", 0, 2, true)
176invisButton:SetFrameLevel(0)
177
178-- RESETUI BUTTON
179local resetuibutton = CreateFrame("Button", "TukuiResetUIButton", UIParent, "SecureActionButtonTemplate")
180resetuibutton:CreatePanel("Default", 26, 20, "RIGHT", invisButton, "LEFT", -3, 0)
181resetuibutton:SetFrameStrata("HIGH")
182resetuibutton:CreateShadow("Default")
183resetuibutton:CreateOverlay(resetuibutton)
184resetuibutton:SetAttribute("type", "macro")
185resetuibutton:SetAttribute("macrotext", "/resetui")
186resetuibutton:HookScript("OnEnter", ModifiedBackdrop)
187resetuibutton:HookScript("OnLeave", OriginalBackdrop)
188
189resetuibutton.Text = T.SetFontString(resetuibutton, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
190resetuibutton.Text:Point("CENTER", resetuibutton, "CENTER", 1, 1)
191resetuibutton.Text:SetText(T.datacolor.."RS")
192
193-- RELOADUI BUTTON
194local rluibutton = CreateFrame("Button", "TukuiReloadUIButton", UIParent, "SecureActionButtonTemplate")
195rluibutton:CreatePanel("Default", 26, 20, "LEFT", invisButton, "RIGHT", 3, 0)
196rluibutton:SetFrameStrata("HIGH")
197rluibutton:CreateShadow("Default")
198rluibutton:CreateOverlay(rluibutton)
199rluibutton:SetAttribute("type", "macro")
200rluibutton:SetAttribute("macrotext", "/rl")
201rluibutton:HookScript("OnEnter", ModifiedBackdrop)
202rluibutton:HookScript("OnLeave", OriginalBackdrop)
203
204rluibutton.Text = T.SetFontString(rluibutton, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
205rluibutton.Text:Point("CENTER", rluibutton, "CENTER", 1, 1)
206rluibutton.Text:SetText(T.datacolor.."RL")
207
208-- WORLD STATE FRAME 
209WorldStateAlwaysUpFrame:ClearAllPoints()
210WorldStateAlwaysUpFrame:SetPoint("TOP", UIParent, "TOP", 0, T.Scale(-35))
211
212-- UNITFRAME SHOW/HIDE
213if C["unitframes"].hideunitframes == true then
214local HideUnitframes = function(self, event)
215	if event == "PLAYER_REGEN_DISABLED" then
216		UIFrameFadeIn(TukuiPlayer, 0.5, 0, 1)
217	else
218		UIFrameFadeIn(TukuiPlayer, 0.5, 1, 0)
219	end
220end
221
222local f = CreateFrame("Frame")
223f:RegisterEvent("PLAYER_ENTERING_WORLD")
224f:RegisterEvent("PLAYER_REGEN_ENABLED")
225f:RegisterEvent("PLAYER_REGEN_DISABLED")
226f:SetScript("OnEvent", HideUnitframes)
227end
228
229-- DATATEXT PANEL TOGGLE (Button)
230local cp = "|cff9a1212-|r" 
231local cm = "|cff9a1212+|r" 
232local icb = CreateFrame("Frame", "InfoCenterButton", TukuiChatBackgroundRight)
233icb:CreatePanel(nil, 30, 15, "TOPRIGHT", TukuiChatBackgroundRight, "TOPRIGHT", -2, -68)
234icb:SetAlpha(0)
235icb:SetFrameStrata("MEDIUM")
236icb:CreateOverlay(icb)
237icb:EnableMouse(true)
238icb.f = icb:CreateFontString(nil, overlay)
239icb.f:SetPoint("CENTER")
240icb.f:SetFont(C["media"].pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
241icb.f:SetText(cp)
242icb.f:Point("CENTER", 1, 0)
243icb:SetScript("OnMouseDown", function(self)
244	ToggleFrame(TukuiInfoCenterRight)
245	ToggleFrame(TukuiInfoCenterLeft)
246	ToggleFrame(TukuiInfoCenter)
247	if icenter:IsShown() then
248		self.f:SetText(cp)
249	else
250		self.f:SetText(cm)
251	end
252end)
253
254icb:SetScript("OnEnter", function()
255		if InCombatLockdown() then return end
256		icb:FadeIn()
257	end)
258
259	icb:SetScript("OnLeave", function()
260		icb:FadeOut()
261	end)
262	
263-- MINIMAP BUTTONS SKINNING [Credit Elv22 for the base code and Smelly for modification.]
264local function SkinButton(f)
265    if f:GetObjectType() ~= "Button" then return end
266	f:SetPushedTexture(nil)
267    f:SetHighlightTexture(nil)
268    f:SetDisabledTexture(nil)
269	f:SetSize(22, 22)
270	
271    for i=1, f:GetNumRegions() do
272        local region = select(i, f:GetRegions())
273        if region:GetObjectType() == "Texture" then
274            local tex = region:GetTexture()
275            if tex:find("Border") or tex:find("Background") then
276                region:SetTexture(nil)
277            else
278				region:SetDrawLayer("OVERLAY", 5)
279                region:ClearAllPoints()
280                region:Point("TOPLEFT", f, "TOPLEFT", 2, -2)
281                region:Point("BOTTOMRIGHT", f, "BOTTOMRIGHT", -2, 2)
282                region:SetTexCoord(.08, .92, .08, .92)
283            end
284        end
285    end
286	f:SetTemplate("Default")
287	f:SetFrameLevel(f:GetFrameLevel() + 2)
288	
289end
290local x = CreateFrame("Frame")
291x:RegisterEvent("PLAYER_LOGIN")
292x:SetScript("OnEvent", function(self, event)
293    for i=1, Minimap:GetNumChildren() do
294        SkinButton(select(i, Minimap:GetChildren()))
295    end
296    self = nil
297end)
298
299-- WORLD STATE UP (move frame)
300MiniMapBattlefieldFrame:ClearAllPoints()
301MiniMapBattlefieldFrame:Point("BOTTOMRIGHT", TukuiMinimap, "BOTTOMRIGHT", -4, 4)
302
303-- MINIMAP TOGGLE
304local mToggle = CreateFrame("Button", "TukuiMinimapToggle", UIParent)
305mToggle:CreatePanel("Default", 11, 30, "TOPLEFT", TukuiPlayerBuffs, "TOPRIGHT", 5, 2)
306mToggle:CreateShadow("Default")
307mToggle:CreateOverlay(mToggle)
308mToggle:HookScript("OnEnter", ModifiedBackdrop)
309mToggle:HookScript("OnLeave", OriginalBackdrop)
310
311mToggle.Text = T.SetFontString(mToggle, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
312mToggle.Text:Point("CENTER", mToggle, "CENTER", 2, 0.5)
313mToggle.Text:SetText("|cffFF0000-|r")
314
315mToggle:SetScript("OnMouseDown", function()
316    if TukuiMinimap:IsVisible() then
317		TukuiMinimap:Hide()
318		TukuiPlayerBuffs:ClearAllPoints()
319		TukuiPlayerBuffs:Point("TOPRIGHT", -20, -12)
320		TukuiPlayerDebuffs:Point("TOPRIGHT", -20, -150)
321		mToggle.Text:SetText("|cff00FF00+|r")
322    else
323		TukuiMinimap:Show()
324		TukuiPlayerBuffs:ClearAllPoints()
325		TukuiPlayerBuffs:Point("TOPRIGHT", -206, -12)
326		TukuiPlayerDebuffs:Point("TOPRIGHT", -206, -150)
327		mToggle.Text:SetText("|cffFF0000-|r")
328    end
329end)
330
331------------------------------------------------------------------------
332	-- Filger Movers Stuff Below (Credits to Sapz)
333------------------------------------------------------------------------
334
335local PlayerBuffs = CreateFrame("Frame","FilgerPlayerBuffs",UIParent)
336PlayerBuffs:CreatePanel("Default",150,36,"CENTER", UIParent, "CENTER", -273, -65)
337PlayerBuffs:SetMovable(true)
338PlayerBuffs:SetBackdropBorderColor(1,0,0)
339PlayerBuffs.text = T.SetFontString(PlayerBuffs, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
340PlayerBuffs.text:SetPoint("CENTER")
341PlayerBuffs.text:SetText("Move Player Buffs")
342PlayerBuffs:Hide()
343
344local PlayerDebuffs = CreateFrame("Frame","FilgerPlayerDebuffs",UIParent)
345PlayerDebuffs:CreatePanel("Default",150,72,"CENTER", UIParent, "CENTER", -273, -145)
346PlayerDebuffs:SetMovable(true)
347PlayerDebuffs:SetBackdropBorderColor(1,0,0)
348PlayerDebuffs.text = T.SetFontString(PlayerDebuffs, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
349PlayerDebuffs.text:SetPoint("CENTER")
350PlayerDebuffs.text:SetText("Move Player Debuffs")
351PlayerDebuffs:Hide()
352
353local PlayerProccs = CreateFrame("Frame","FilgerPlayerProccs",UIParent)
354PlayerProccs:CreatePanel("Default",150,32,"CENTER", UIParent, "CENTER", -273, -243)
355PlayerProccs:SetMovable(true)
356PlayerProccs:SetBackdropBorderColor(1,0,0)
357PlayerProccs.text = T.SetFontString(PlayerProccs, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
358PlayerProccs.text:SetPoint("CENTER")
359PlayerProccs.text:SetText("Move Player Proccs")
360PlayerProccs:Hide()
361
362local PlayerHealBuffs = CreateFrame("Frame","FilgerPlayerHealBuffs",UIParent)
363PlayerHealBuffs:CreatePanel("Default",150,32,"CENTER", UIParent, "CENTER", -273, -16)
364PlayerHealBuffs:SetMovable(true)
365PlayerHealBuffs:SetBackdropBorderColor(1,0,0)
366PlayerHealBuffs.text = T.SetFontString(PlayerHealBuffs, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
367PlayerHealBuffs.text:SetPoint("CENTER")
368PlayerHealBuffs.text:SetText("Move Heal/CD Frame")
369PlayerHealBuffs:Hide()
370
371local TargetDebuffs = CreateFrame("Frame","FilgerTargetDebuffs",UIParent)
372TargetDebuffs:CreatePanel("Default",150,36,"CENTER", UIParent, "CENTER", 273, -136)
373TargetDebuffs:SetMovable(true)
374TargetDebuffs:SetBackdropBorderColor(1,0,0)
375TargetDebuffs.text = T.SetFontString(TargetDebuffs, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
376TargetDebuffs.text:SetPoint("CENTER")
377TargetDebuffs.text:SetText("Move Target Debuffs")
378TargetDebuffs:Hide()
379
380local TargetHeals = CreateFrame("Frame","FilgerTargetHeals",UIParent)
381TargetHeals:CreatePanel("Default",150,32,"CENTER", UIParent, "CENTER", 273, -136)
382TargetHeals:SetMovable(true)
383TargetHeals:SetBackdropBorderColor(1,0,0)
384TargetHeals.text = T.SetFontString(TargetHeals, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
385TargetHeals.text:SetPoint("CENTER")
386TargetHeals.text:SetText("Move Target Heals")
387TargetHeals:Hide()
388
389local PvPBuffs = CreateFrame("Frame","FilgerPvPBuffs",UIParent)
390PvPBuffs:CreatePanel("Default",150,72,"CENTER", UIParent, "CENTER", 273, -75)
391PvPBuffs:SetMovable(true)
392PvPBuffs:SetBackdropBorderColor(1,0,0)
393PvPBuffs.text = T.SetFontString(PvPBuffs, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
394PvPBuffs.text:SetPoint("CENTER")
395PvPBuffs.text:SetText("Move PvP Buffs")
396PvPBuffs:Hide()
397
398local WLBuffs = CreateFrame("Frame","FilgerWLBuffs",UIParent)
399WLBuffs:CreatePanel("Default",150,50,"CENTER", UIParent, "CENTER", 20, 145)
400WLBuffs:SetMovable(true)
401WLBuffs:SetBackdropBorderColor(1,0,0)
402WLBuffs.text = T.SetFontString(WLBuffs, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
403WLBuffs.text:SetPoint("CENTER")
404WLBuffs.text:SetText("Move WL Buffs")
405WLBuffs:Hide()
406
407local DebuffBars = CreateFrame("Frame","FilgerDebuffBars",UIParent)
408DebuffBars:CreatePanel("Default",150,50,"CENTER", UIParent, "CENTER", 273, 145)
409DebuffBars:SetMovable(true)
410DebuffBars:SetBackdropBorderColor(1,0,0)
411DebuffBars.text = T.SetFontString(DebuffBars, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
412DebuffBars.text:SetPoint("CENTER")
413DebuffBars.text:SetText("Move Debuff Bars")
414DebuffBars:Hide()
415
416local CDBars = CreateFrame("Frame","FilgerCDBars",UIParent)
417CDBars:CreatePanel("Default",150,50,"CENTER", UIParent, "CENTER", -273, 145)
418CDBars:SetMovable(true)
419CDBars:SetBackdropBorderColor(1,0,0)
420CDBars.text = T.SetFontString(CDBars, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
421CDBars.text:SetPoint("CENTER")
422CDBars.text:SetText("Move CD Bars")
423CDBars:Hide()