Compare commits

...

2 Commits

Author SHA1 Message Date
robin e107ac2b97 Add fixes.lua for temporary fixes 2021-04-29 15:31:20 +02:00
robin 9449a22a73 Add positioning and coloring units 2021-04-29 12:19:17 +02:00
3 changed files with 98 additions and 0 deletions

16
fixes.lua Normal file
View File

@ -0,0 +1,16 @@
local addonName, addon = ...
local childName = addon['childName']
local child = addon[childName]
local init = {
Setup = function(self, childName, event)
-- Remove the cancel button (Reduce the taint caused by InterfaceOptionsFrame src: http://www.wowinterface.com/forums/showpost.php?p=275119&postcount=17 )
InterfaceOptionsFrameCancel:Hide()
InterfaceOptionsFrameOkay:SetAllPoints(InterfaceOptionsFrameCancel)
-- Make clicking cancel the same as clicking okay
InterfaceOptionsFrameCancel:SetScript("OnClick", function()
InterfaceOptionsFrameOkay:Click()
end)
end
}
addon.RegisterCallback(init, format("Init%s", childName), 'Setup', childName)

View File

@ -5,6 +5,8 @@
<Script file="broker.lua"/>
<Script file="chat.lua"/>
<Script file="cvars.lua"/>
<Script file="units.lua"/>
<Script file="fixes.lua"/>
<Script file="core.lua"/>
<Script file="litepanels.lua"/>
<Script file="layout.lua"/>

80
units.lua Normal file
View File

@ -0,0 +1,80 @@
local addonName, addon = ...
local childName = addon['childName']
local child = addon[childName]
local events = child['events']
local ClassColorUnits = {
["target"] = {
["name"] = "TargetFrame",
["back"] = "TargetFrame",
["x-offset"] = -104,
["y-offset"] = 60,
["x-offset2"] = 6,
["y-offset2"] = -22,
},
["player"] = {
["name"] = "PlayerFrame",
["back"] = "PlayerFrameBackground",
["x-offset"] = 0,
["y-offset"] = 22,
["x-offset2"] = 0,
["y-offset2"] = 0,
},
["focus"] = {
["name"] = "FocusFrame",
["back"] = "FocusFrame",
["x-offset"] = -104,
["y-offset"] = 60,
["x-offset2"] = 6,
["y-offset2"] = -22,
},
}
local function updateClassColor(unit)
if(unit and UnitExists(unit)) then
local _,class = UnitClass(unit)
if(class and RAID_CLASS_COLORS[class]) then
if(ClassColorUnits[unit]) then
local uf = _G[ClassColorUnits[unit]['name']]
local bg = _G[ClassColorUnits[unit]['back']]
if(not uf['unitClassColorBack']) then
uf['unitClassColorBack'] = uf:CreateTexture(nil, "ARTWORK")
uf['unitClassColorBack']:SetPoint("TOPLEFT", bg, ClassColorUnits[unit]['x-offset2'], ClassColorUnits[unit]['y-offset2'])
uf['unitClassColorBack']:SetPoint("BOTTOMRIGHT", bg, ClassColorUnits[unit]['x-offset'], ClassColorUnits[unit]['y-offset'])
uf['unitClassColorBack']:SetTexture("Interface\\TargetingFrame\\UI-StatusBar")
end
local col = RAID_CLASS_COLORS[class]
if(not UnitIsPlayer(unit)) then
uf['unitClassColorBack']:SetVertexColor(0, 0, 0, 0)
else
uf['unitClassColorBack']:SetVertexColor(col['r'], col['g'], col['b'],1)
end
end
end
end
end
function events:PLAYER_TARGET_CHANGED()
updateClassColor("target")
end
function events:PLAYER_FOCUS_CHANGED()
updateClassColor("focus")
end
local init = {
Setup = function(self, childName, event)
if(PlayerFrame:IsUserPlaced()) then
PlayerFrame:SetMoveable(false)
else
PlayerFrame:SetUserPlaced(true)
PlayerFrame:ClearAllPoints()
PlayerFrame:SetPoint("RIGHT", UIParent, "CENTER", 0, -140)
end
if(not TargetFrame:IsUserPlaced()) then
TargetFrame:SetUserPlaced(true)
TargetFrame:ClearAllPoints()
TargetFrame:SetPoint("TOPLEFT", PlayerFrame, "TOPRIGHT",0,0)
else
TargetFrame:SetMoveable(false)
end
updateClassColor("player")
end
}
addon.RegisterCallback(init, format("Init%s", childName), 'Setup', childName)