Skip to content

Commit

Permalink
(new) Installing Masque extensions for OPie and SUF
Browse files Browse the repository at this point in the history
  • Loading branch information
ELLIOTTCABLE committed Jun 20, 2015
1 parent fa2a6d3 commit b3446bf
Show file tree
Hide file tree
Showing 6 changed files with 387 additions and 0 deletions.
230 changes: 230 additions & 0 deletions Interface/AddOns/OPieMasque/Addon.lua
@@ -0,0 +1,230 @@
--[[--------------------------------------------------------------------
OPie Masque
Adds Masque skinning support to OPie.
Copyright (c) 2013-2015 Phanx. All rights reserved.
http://www.wowinterface.com/downloads/info22226-OPieMasque.html
http://www.curse.com/addons/wow/opie-masque/
https://github.com/Phanx/OPieMasque
----------------------------------------------------------------------]]
local SPECIAL_COLOR_ALPHA = 0.75
-- 0 = invisible, 1 = fully visible, lower it if your skin is ugly
------------------------------------------------------------------------
assert(OneRingLib and OneRingLib.ext and OneRingLib.ext.OPieUI, "OPie not found")
local Masque = LibStub("Masque", true)
assert(Masque, "Masque not found")
local id
local group
local buttons = {}
local prototype = {}
local STATE_USABLE, STATE_NOMANA, STATE_NORANGE, STATE_UNUSABLE = 0, 1, 2, 3
function prototype:SetIcon(texture)
self.Icon:SetTexture(texture)
end
function prototype:SetIconTexCoord(a, b, c, d, e, f, g, h)
if not a or not b or not c or not d then return end -- Broker plugins???
self.Icon:SetTexCoord(a, b, c, d, e, f, g, h)
end
function prototype:SetIconVertexColor(r, g, b)
if r == 0.5 and g == 0.5 and b == 0.5 then return end -- don't darken icons on cooldown
self.icon_r, self.icon_g, self.icon_b = r, g, b
if self.ustate == STATE_USABLE then
self.Icon:SetVertexColor(r, g, b)
end
end
function prototype:SetUsable(usable, usableCharge, cd, nomana, norange)
local state = usable and STATE_USABLE or (norange and STATE_NORANGE or (nomana and STATE_NOMANA or STATE_UNUSABLE))
if state == self.ustate then return end
self.ustate = state
if state == STATE_NORANGE then
self.Icon:SetVertexColor(0.8, 0.1, 0.1)
elseif state == STATE_NOMANA then
self.Icon:SetVertexColor(0.5, 0.5, 1)
elseif state == STATE_UNUSABLE and not cd then -- don't black it out while on cooldown
self.Icon:SetVertexColor(0.4, 0.4, 0.4)
else
self.Icon:SetVertexColor(self.icon_r or 1, self.icon_g or 1, self.icon_b or 1)
end
end
function prototype:SetDominantColor(r, g, b)
self.Border:SetShown(2.85 > (r + g + b)) -- don't override skin color if it's white
self.Border:SetVertexColor(r, g, b)
self.Border:SetAlpha(SPECIAL_COLOR_ALPHA)
for i = 1, #self.GlowTextures do
self.GlowTextures[i]:SetVertexColor(r, g, b)
end
end
function prototype:SetOverlayIcon(texture, w, h, ...) -- not entirely sure what this is for
if not texture then
self.OverlayIcon:Hide()
else
self.OverlayIcon:SetTexture(texture)
self.OverlayIcon:SetSize(w, h)
if ... then
self.OverlayIcon:SetTexCoord(...)
end
self.OverlayIcon:Show()
end
end
function prototype:SetCount(count)
self.Count:SetText(count or "")
end
local displaySubs = {
["ALT%-"] = "a",
["CTRL%-"] = "c",
["SHIFT%-"] = "s", -- fr, it: "m"
["BUTTON"] = "m", -- fr: souris, it: mouse
["MOUSEWHEEL"] = "w", -- fr: molette, it: rotellina
["NUMPAD"] = "n",
["PLUS"] = "+",
["MINUS"] = "-",
["MULTIPLY"] = "*",
["DIVIDE"] = "/",
["DECIMAL"] = ".",
}
function prototype:SetBinding(text)
if not text then
return self.HotKey:SetText("")
end
for k, v in pairs(displaySubs) do
text = gsub(text, k, v)
end
self.HotKey:SetText(text)
end
function prototype:SetCooldown(remain, duration, usable)
if duration and remain and duration > 0 and remain > 0 then
local start = GetTime() + remain - duration
-- TODO: detect and show loss of control ?
if usable then
-- show recharge time
self.Cooldown:SetDrawEdge(true)
self.Cooldown:SetDrawSwipe(false)
else
-- show cooldown time
self.Cooldown:SetDrawEdge(false)
self.Cooldown:SetDrawSwipe(true)
self.Cooldown:SetSwipeColor(0, 0, 0, 0.8)
end
self.Cooldown:SetCooldown(start, duration)
self.Cooldown:Show()
else
self.Cooldown:Hide()
end
end
function prototype:SetCooldownFormattedText(pattern, ...)
-- do nothing
end
function prototype:SetCooldownTextShown()
-- do nothing
end
function prototype:SetHighlighted(highlight)
self[highlight and "LockHighlight" or "UnlockHighlight"](self)
end
function prototype:SetActive(active)
self:SetChecked(active)
end
function prototype:SetOuterGlow(shown)
-- if shown then
-- print("GLOW!", self.Icon:GetTexture()) -- IS THIS EVEN USED?
-- end
for i = 1, #self.GlowTextures do
self.GlowTextures[i]:SetShown(shown)
end
end
function prototype:SetEquipState(inBags, isEquipped)
if isEquipped then
self.Flash:SetVertexColor(0.1, 0.9, 0.15)
self.Flash:Show()
elseif inBags then
self.Flash:SetVertexColor(1, 0.9, 0.2)
self.Flash:Show()
else
self.Flash:Hide()
end
end
local function Reskin()
for _, button in pairs(buttons) do
local r, g, b = button.GlowTextures[1]:GetVertexColor()
local _, _, _, a = button.Border:GetVertexColor()
button.Border:SetVertexColor(r, g, b, a)
end
end
local id = 0
local function CreateIndicator(name, parent, size, ghost)
id = id + 1
name = name or "OPieSliceButton"..id
parent = parent or UIParent
size = size or 36
local button = CreateFrame("CheckButton", name, parent, "ActionButtonTemplate")
button:SetSize(size, size)
button:EnableMouse(false)
button.Border = _G[name .. "Border"] -- highlight
button.Cooldown = _G[name .. "Cooldown"]
button.Count = _G[name .. "Count"]
button.Flash = _G[name .. "Flash"] -- inner glow / checked
button.HotKey = _G[name .. "HotKey"]
button.Icon = _G[name .. "Icon"]
button.NormalTexture = _G[name .. "NormalTexture"] -- border
-- Overlay icon (???)
button.OverlayIcon = button:CreateTexture(nil, "ARTWORK", 1)
button.OverlayIcon:SetPoint("BOTTOMLEFT", button, "BOTTOMLEFT", 4, 4)
-- Outer glow (doesn't seem to do anything?)
button.GlowTextures = {}
for i = 1, 4 do
local glow = button:CreateTexture(nil, "BACKGROUND", nil, -8)
glow:SetSize(size, size)
glow:SetTexture("Interface\\AddOns\\OPie\\gfx\\oglow")
glow:Hide()
button.GlowTextures[i] = glow
end
button.GlowTextures[1]:SetPoint("CENTER", button, "TOPLEFT")
button.GlowTextures[1]:SetTexCoord(0, 1, 0, 1)
button.GlowTextures[2]:SetPoint("CENTER", button, "TOPRIGHT")
button.GlowTextures[2]:SetTexCoord(1, 0, 0, 1)
button.GlowTextures[3]:SetPoint("CENTER", button, "BOTTOMRIGHT")
button.GlowTextures[3]:SetTexCoord(1, 0, 1, 0)
button.GlowTextures[4]:SetPoint("CENTER", button, "BOTTOMLEFT")
button.GlowTextures[4]:SetTexCoord(0, 1, 1, 0)
for k, v in pairs(prototype) do
button[k] = v
end
-- Let Masque skin it
if not group then
group = Masque:Group("OPie")
Masque:Register("OPie", Reskin)
end
group:AddButton(button)
tinsert(buttons, button)
return button
end
OneRingLib.ext.OPieUI:SetIndicatorConstructor(CreateIndicator)
33 changes: 33 additions & 0 deletions Interface/AddOns/OPieMasque/LICENSE.txt
@@ -0,0 +1,33 @@
Copyright (c) 2013-2015 Phanx. All rights reserved.

Permission is granted for anyone to use, read, or otherwise interpret this
software for any purpose, without any restrictions.

Permission is granted for anyone to modify this software or reuse portions
of it, and to distribute such modified versions or derivative works as long
as the names of this software and/or its author are not used in the work,
including in its name or title and in any associated documentation, outside
of an optional attribution or credit.

Permission is granted for anyone to aggregate this software with other works
not derived from this software for the purpose of creating a user interface
replacement (commonly referred to as a "compilation" or "addon pack") for the
"World of Warcraft" game client, and to distribute such collective works on
websites operated by Curse Inc or ZAM Network LLC (including curse.com,
curseforge.com, wowace.com and wowinterface.com) as long as the software is
not modified in any way, including by modifying or removing any files.

This software may not be redistributed by itself or in any other way, in whole
or in part, modified or unmodified, without specific prior written permission
from the author of this software.

The names of this software and/or its author may not be used to promote or
endorse works derived from this software without specific prior written
permission from the author of this software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 changes: 23 additions & 0 deletions Interface/AddOns/OPieMasque/OPieMasque.toc
@@ -0,0 +1,23 @@
## Interface: 60100
## Version: 6.1.0.10
## X-Curse-Packaged-Version: 6.1.0.10
## X-Curse-Project-Name: OPie Masque
## X-Curse-Project-ID: opie-masque
## X-Curse-Repository-ID: wow/opie-masque/mainline

## Title: OPie Masque
## Notes: Adds Masque skinning support to OPie.
## Notes-deDE: Ermöglicht die Verwendung der Masque-Skins auf Opie.
## Notes-esES: Capacita a Masque a cambiar la apariencia de OPie.
## Notes-esMX: Capacita a Masque a cambiar la apariencia de OPie.
## Notes-frFR: Accorde à Masque à modifier l'apparence du OPie.
## Notes-ptBR: Capacita a Masque a alterar a aparência de Opie.

## Author: Phanx
## X-Email: addons@phanx.net
## X-Copyright: Copyright (c) 2013-2015 Phanx. All rights reserved.
## X-Website: https://github.com/Phanx/OPieMasque

## Dependencies: Masque, OPie

Addon.lua
@@ -0,0 +1,13 @@
------------------------------------------------------------------------
r25 | cybeloras | 2014-10-14 04:36:58 +0000 (Tue, 14 Oct 2014) | 1 line
Changed paths:
A /tags/1.5.2 (from /trunk:24)

Tagging as 1.5.2
------------------------------------------------------------------------
r24 | cybeloras | 2014-10-14 04:36:51 +0000 (Tue, 14 Oct 2014) | 1 line
Changed paths:
M /trunk/ShadowedUFFacade.toc

Version bumps for Warlords of Draenor
------------------------------------------------------------------------
74 changes: 74 additions & 0 deletions Interface/AddOns/ShadowedUFFacade/ShadowedUFFacade.lua
@@ -0,0 +1,74 @@

local LMB = LibStub("Masque", true) or (LibMasque and LibMasque("Button"))
if not LMB then return end

local f = CreateFrame("Frame")
local parents = {}
local skinned = {}
local isSet
local pairs, wipe =
pairs, wipe

local function SetVertexColor(border, r, g, b, a)
if r == .6 and g == .6 and b == .6 then
a = 0
else
a = 1
end
border:setvertexcolor(r, g, b, a)
end
local function onupdate()
for frame, buttons in pairs(parents) do
local groupName = ShadowUF.L.units[frame.parent.unitType]
local group = LMB:Group("ShadowedUF", groupName)
for _, button in pairs(buttons) do
if not skinned[button] then
local border = button.border
border.button = button

border.setvertexcolor = border.SetVertexColor
border.SetVertexColor = SetVertexColor
local r, g, b = border:GetVertexColor()
border:SetVertexColor(floor(r*100+0.5)/100, floor(g*100+0.5)/100, floor(b*100+0.5)/100) -- round it, because ugly numbers come out of GetVertexColor

group:AddButton(button, {
Icon = button.icon,
Cooldown = button.cooldown,
Border = button.border,
Count = button.stack,
})

skinned[button] = 1
end
end
end
wipe(parents)
f:SetScript("OnUpdate", nil)
isSet = nil
end


hooksecurefunc("CreateFrame",
function(_, _, parent)
if parent and parent.buttons and parent.type and parent.totalAuras then -- make sure the parent is a SUF frame and not something else
parents[parent] = parent.buttons
if not isSet then
f:SetScript("OnUpdate", onupdate)
isSet = 1
end
end
end
)


local oldUpdate = ShadowUF.modules.auras.Update
function ShadowUF.modules.auras:Update(frame, ...)
-- raw hook is used here because if we securehook then we get movers.lua:247: "setfenv" cannot change environment of given object
oldUpdate(self, frame, ...)

local groupname = ShadowUF.L.units[frame.unitType]
local group = LMB:Group("ShadowedUF", groupname)

group:ReSkin()
end

14 changes: 14 additions & 0 deletions Interface/AddOns/ShadowedUFFacade/ShadowedUFFacade.toc
@@ -0,0 +1,14 @@
## Interface: 60000
## X-Compatible-With: 50400
## Title: Masque Skinner: ShadowedUF
## Version: 1.5.2
## Author: Cybeloras of Detheroc/Mal'Ganis
## Notes: Skins ShadowedUnitFrames' aura frames with Masque
## RequiredDeps: ShadowedUnitFrames, Masque
## X-Child-Of: ShadowedUnitFrames
## X-Curse-Packaged-Version: 1.5.2
## X-Curse-Project-Name: Masque Skinner: ShadowedUF
## X-Curse-Project-ID: shadoweduf-facade
## X-Curse-Repository-ID: wow/shadoweduf-facade/mainline

ShadowedUFFacade.lua

0 comments on commit b3446bf

Please sign in to comment.