Skip to content

Instantly share code, notes, and snippets.

@redeyes2015
Created June 23, 2009 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redeyes2015/134479 to your computer and use it in GitHub Desktop.
Save redeyes2015/134479 to your computer and use it in GitHub Desktop.
-- TODO:
-- Align Buff/Debuffs
-- The following lines will hide the default blizzard buffs
BuffFrame:Hide()
TemporaryEnchantFrame:Hide()
-- ItsCool and OhCrap are the two textures used to indicate percentage health
local font = [[Interface\AddOns\oUF_Metzerott\fonts\SFDiegoSans.ttf]]
local indicator = [[Interface\AddOns\oUF_Metzerott\textures\new]]
local ring = [[Interface\AddOns\oUF_Metzerott\textures\ring]]
local circle = [[Interface\AddOns\oUF_Metzerott\textures\circle]]
local glow = [[Interface\AddOns\oUF_Metzerott\textures\glow]]
local cast = [[Interface\AddOns\oUF_Metzerott\textures\cast]]
local safe = [[Interface\AddOns\oUF_Metzerott\textures\rothTex]]
-- Buff/Debuff Max size on target
local maxDebuff = 32
local maxBuff = 32
-- Default setting for style
style = "DPS"
-- How fast HealthRing Rotate
local HRRotatingPeriod = 18
-- Turn Castbars on/off
local castBarsToggle = true
-- Turn Party on/off
local partyToggle = true
-- Turn Raid on/off
local raidToggle = true
-- Percentage of health to kick in different behaviors
local fleshWound = .80
local ouch = .60
local uhOh = .40
local imToast = .20
local largeSize = 80
local smallSize = largeSize*.65
local groupSize = largeSize*.45
-- Set Castbar size
local castWidth = largeSize*1.5
local castHeight = largeSize*.75
-- Set Name font sizes and max length on group
local largeNameFont = 18
local smallNameFont = 14
local groupNameFont = 14
local nameLength = 5
local otherNameLength = 10
-- Tek tags
tekTagsToggle = true
local r2, r42, realUpdate, colorTable = math.sqrt(0.5^2+0.5^2), math.sqrt(42), true, {[4]=0.9};
local menu = function(self)
local unit = self.unit:sub(1, -2)
local cunit = self.unit:gsub("(.)", string.upper, 1)
if(unit == "party" or unit == "partypet") then
ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor", 0, 0)
elseif(_G[cunit.."FrameDropDown"]) then
ToggleDropDownMenu(1, nil, _G[cunit.."FrameDropDown"], "cursor", 0, 0)
end
end
local function SetFontString(parent, fontName, fontHeight, fontStyle)
local fs = parent:CreateFontString(nil, 'OVERLAY')
fs:SetFont(fontName, fontHeight, fontStyle)
fs:SetJustifyH('LEFT')
fs:SetShadowColor(0,0,0)
fs:SetShadowOffset(1.25, -1.25)
return fs
end
local classification = {
worldboss = '|cffD7BEA5Boss|r',
rareelite = '|cffD7BEA5%s+ Rare|r',
elite = '|cffD7BEA5%s+|r',
rare = '|cffD7BEA5%s Rare|r',
normal = '|cffD7BEA5%s|r',
trivial = '|cffD7BEA5%s|r',
}
local function updateColor(self, element, unit, func)
local color
local colorAlpha = 1
if(UnitIsDead(unit) or UnitIsGhost(unit) or not UnitIsConnected(unit) or (UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit))) then
return element[func](element, .84,.75,.65)
elseif(unit == 'pet') then
color = self.colors.happiness[GetPetHappiness()] or self.colors.power[UnitPowerType(unit)]
elseif(UnitIsPlayer(unit)) then
local _, class = UnitClass(unit)
color = self.colors.class[class]
else
color = self.colors.reaction[UnitReaction(unit, 'player')] or self.colors.health
end
if(color) then
element[func](element, color[1], color[2], color[3], colorAlpha)
end
end
if (tekTagsToggle) then
---------------------------
-- Custom tags --
---------------------------
oUF.Tags["[tekmd]"] = function(u) if UnitAura(u, "Misdirection") then return "|cff8E79FEMd|r" end end
oUF.Tags["[tekrep]"] = function(u) if UnitAura(u, "Replenishment") then return "|cff00A1DERep|r" end end
oUF.Tags["[teksac]"] = function(u) if UnitAura(u, "Sacrifice") then return "|cff000000Sac|r" end end
oUF.Tags["[tekss]"] = function(u) if UnitAura(u, "Soulstone Resurrection") then return "|cffCA21FFSS|r" end end
oUF.Tags["[tekinn]"] = function(u) if UnitAura(u, "Innervate") then return "|cff00FF33Innervate|r" end end
oUF.Tags["[tekpws]"] = function(u) if UnitAura(u, "Power Word: Shield") then return "|cffFFD800PW:S|r" end end
oUF.Tags["[tekrenew]"] = function(u) if UnitAura(u, "Renew") then return "|cff00FF10Renew|r" end end
oUF.Tags["[tekfood]"] = function(u) if UnitAura(u, "Food") then return "|cffD79A6DFood|r" end end
oUF.Tags["[tekdrink]"] = function(u) if UnitAura(u, "Drink") then return "|cff00A1DEDrink|r" end end
oUF.Tags["[tekms]"] = function(u) if UnitAura(u, "Mortal Strike") then return "|cffFF1111MS|r" end end
oUF.Tags["[tekfw]"] = function(u) if UnitAura(u, "Fear Ward") then return "|cff9900FFFW|r" end end
oUF.Tags["[tekrejuv]"] = function(u) if UnitAura(u, "Rejuvenation") then return "|cff00FEBFRejuv|r" end end
oUF.Tags["[tekregrow]"] = function(u) if UnitAura(u, "Regrowth") then return "|cff00FF10Regrowth|r" end end
oUF.Tags["[tekwildgrowth]"] = function(u) if UnitAura(u, "Wild Growth") then return "|cff33FF33Wild Growth|r" end end
oUF.Tags["[tekws]"] = function(u) if UnitDebuff(u, "Weakened Soul") then return "|cffFF5500WS|r" end end
oUF.Tags["[tekpom]"] = function(u) local c = select(4, UnitAura(u, "Prayer of Mending")) if c then return "|cffFFCF7FPofM("..c..")|r" end end
oUF.Tags["[teklb]"] = function(u) local c = select(4, UnitAura(u, "Lifebloom")) if c then return "|cffA7FD0ALB("..c..")|r" end end
local function HasDebuffType(unit, t)
for i=1,40 do
local name, _, _, _, debuffType = UnitDebuff(unit, i)
if not name then return
elseif debuffType == t then return true end
end
end
oUF.Tags["[tekdisease]"] = function(u) return HasDebuffType(u, "Disease") and "|cff996600Disease|r" or "" end
oUF.Tags["[tekmagic]"] = function(u) return HasDebuffType(u, "Magic") and "|cff3399FFMagic|r" or "" end
oUF.Tags["[tekcurse]"] = function(u) return HasDebuffType(u, "Curse") and "|cff9900FFCurse|r" or "" end
oUF.Tags["[tekpoison]"] = function(u) return HasDebuffType(u, "Poison") and "|cff009900Poison|r" or "" end
oUF.TagEvents["[teksac]"] = "UNIT_AURA"
oUF.TagEvents["[tekrep]"] = "UNIT_AURA"
oUF.TagEvents["[tekmd]"] = "UNIT_AURA"
oUF.TagEvents["[tekss]"] = "UNIT_AURA"
oUF.TagEvents["[tekinn]"] = "UNIT_AURA"
oUF.TagEvents["[tekpws]"] = "UNIT_AURA"
oUF.TagEvents["[tekrenew]"] = "UNIT_AURA"
oUF.TagEvents["[tekfood]"] = "UNIT_AURA"
oUF.TagEvents["[tekdrink]"] = "UNIT_AURA"
oUF.TagEvents["[tekms]"] = "UNIT_AURA"
oUF.TagEvents["[tekws]"] = "UNIT_AURA"
oUF.TagEvents["[tekfw]"] = "UNIT_AURA"
oUF.TagEvents["[tekpom]"] = "UNIT_AURA"
oUF.TagEvents["[teklb]"] = "UNIT_AURA"
oUF.TagEvents["[tekrejuv]"] = "UNIT_AURA"
oUF.TagEvents["[tekregrow]"] = "UNIT_AURA"
oUF.TagEvents["[tekwildgrowth]"] = "UNIT_AURA"
oUF.TagEvents["[tekdisease]"] = "UNIT_AURA"
oUF.TagEvents["[tekmagic]"] = "UNIT_AURA"
oUF.TagEvents["[tekcurse]"] = "UNIT_AURA"
oUF.TagEvents["[tekpoison]"] = "UNIT_AURA"
end
local numberize = function(value)
if value <= 99999 then
return value
elseif value <= 999999 then
return string.format('%.1fk', value / 1000)
else
return string.format('%.2fm', value / 1000000)
end
end
local PostUpdateName = function(self, event, unit, bar, min, max)
if(self.unit == unit) then
updateColor(self, self.Name, unit, 'SetTextColor')
local uName = UnitName(unit)
-- Get the class name, though getting the icon should go on the to do list..
local cName = UnitClass(unit)
if(unit == 'target' or unit == 'player') then
local level = (not UnitIsConnected(unit)) and '??' or UnitLevel(unit) < 0 and '??' or UnitLevel(unit)
-- Name length should not be an issue
-- However if the target does not have a class then we do not want the name repeated (I think this is only for NPC's and Pets)
-- It would be useful to know the type of creature targeted...
if(cName == uName) then
cName = UnitCreatureType(unit)
end
if (cName) then
self.Name:SetFormattedText('%s |cff0090ff%s|r \n [%s]', uName, format(classification[UnitClassification(unit)], level), cName)
else
self.Name:SetFormattedText('%s |cff0090ff%s|r \n [Pet]', uName, format(classification[UnitClassification(unit)], level))
end
elseif (unit == 'pet' and uName == 'Unknown') then
self.Name:SetText('Pet')
elseif (unit == 'targettarget' or unit == 'focus' or unit == 'pet') then
if string.len(uName) > otherNameLength then
self.Name:SetFormattedText('%s...', uName:sub(1, otherNameLength))
else
self.Name:SetText(uName)
end
else
if string.len(uName) > nameLength then
self.Name:SetFormattedText('%s...', uName:sub(1, 5))
else
self.Name:SetText(uName)
end
end
end
end
local PostUpdateThreat = function(event, unit, status)
end
local PostUpdatePower = function(self, event, unit, bar, min, max)
if(self.unit == unit) then
if(UnitIsDead(unit) or UnitIsGhost(unit)) then
bar:SetValue(0)
elseif(not UnitIsConnected(unit)) then
bar.value:SetText()
elseif( max == 0) then
bar.value:SetText()
else
if(min~=max) then
bar.value:SetTextColor(1,1,1)
else
updateColor(self, bar.value, unit, 'SetTextColor')
end
bar.value:SetText(numberize(min))
end
end
end
local PostUpdateHealth = function(self, event, unit, bar, min, max)
local LibMobHealth
if LibStub then LibMobHealth = LibStub('LibMobHealth-4.0', true) end
local cur, maxhp
if LibMobHealth then
cur, maxhp = LibMobHealth:GetUnitHealth(unit)
else
cur, maxhp = min, max
end
local percText = string.format('%.1f%%', min/max*100)
local perc = cur/maxhp
if(UnitIsDead(unit)) then
bar.value:SetText('Dead')
elseif(UnitIsGhost(unit)) then
bar:SetValue(max)
bar.value:SetText('Ghost')
elseif(not UnitIsConnected(unit)) then
bar.value:SetText('Offline')
else
if(cur~=maxhp) then
bar.value:SetText(percText)
bar.value:SetTextColor(1,1,1)
else
bar.value:SetText('|cffAF5050'..numberize(max))
end
end
self.HealthRing:SetTexture(nil)
self.HealthRing:SetTexture(indicator)
if(perc < imToast) then
self.HealthRing:SetTexture(nil)
self.HealthRing:SetTexture(indicator)
self.HealthRing:SetVertexColor(1,0,0,1)
elseif (perc < uhOh) then
self.HealthRing:SetTexture(nil)
self.HealthRing:SetTexture(indicator)
self.HealthRing:SetVertexColor(1,1,0,1)
elseif (perc < ouch) then
self.HealthRing:SetTexture(nil)
self.HealthRing:SetTexture(indicator)
self.HealthRing:SetVertexColor(0,1,0,1)
elseif (perc < fleshWound) then
self.HealthRing:SetTexture(nil)
self.HealthRing:SetTexture(indicator)
self.HealthRing:SetVertexColor(1,1,1,1)
else
self.HealthRing:SetTexture(nil)
end
if(perc > fleshWound and self.HealthRing.HRrotateAG:IsPlaying()) then
self.HealthRing.HRrotateAG:Stop()
elseif(not self.HealthRing.HRrotateAG:IsPlaying()) then
self.HealthRing.HRrotateAG:Play()
end
if(min <= 1) then
self.HealthRing:SetVertexColor(0,0,0,1)
end
--[[
if(not self:GetScript("OnUpdate")) then
self:SetScript("OnUpdate", function(self, elapsed)
local time = GetTime()
local ofs = time*135
local health = self.HealthRing
health:SetTexCoord(
0.5+r2*cos(ofs+135), 0.5+r2*sin(ofs+135),
0.5+r2*cos(ofs-135), 0.5+r2*sin(ofs-135),
0.5+r2*cos(ofs+45), 0.5+r2*sin(ofs+45),
0.5+r2*cos(ofs-45), 0.5+r2*sin(ofs-45))
end)
end
]]--
if(UnitIsDead(unit) or UnitIsGhost(unit) or not UnitIsConnected(unit) or (UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit))) then
bar:SetStatusBarColor(.31*.25, .45*.25, .63*.25)
self.HealthRing:SetVertexColor(0,0,0,1)
else
bar:SetStatusBarColor(1, 1, 1, 0)
end
self:UNIT_NAME_UPDATE(event, unit)
end
function TargetofTarget_Update()
local show;
if ( SHOW_TARGET_OF_TARGET == "1" and UnitExists("target") and UnitExists("targettarget") and ( not UnitIsUnit("player", "target") ) and ( UnitHealth("target") > 0 ) ) then
if ( ( SHOW_TARGET_OF_TARGET_STATE == "5" ) or
( SHOW_TARGET_OF_TARGET_STATE == "4" and ( (GetNumRaidMembers() > 0) or (GetNumPartyMembers() > 0) ) ) or
( SHOW_TARGET_OF_TARGET_STATE == "3" and ( (GetNumRaidMembers() == 0) and (GetNumPartyMembers() == 0) ) ) or
( SHOW_TARGET_OF_TARGET_STATE == "2" and ( (GetNumPartyMembers() > 0) and (GetNumRaidMembers() == 0) ) ) or
( SHOW_TARGET_OF_TARGET_STATE == "1" and ( GetNumRaidMembers() > 0 ) ) ) then
show = true;
end
end
if ( show ) then
if ( not TargetofTargetFrame:IsShown() ) then
TargetofTargetFrame:Show();
Target_Spellbar_AdjustPosition();
end
UnitFrame_Update();
TargetofTarget_CheckDead();
TargetofTargetHealthCheck();
RefreshBuffs(TargetofTargetFrame, 0, "targettarget");
else
if ( TargetofTargetFrame:IsShown() ) then
TargetofTargetFrame:Hide();
Target_Spellbar_AdjustPosition();
end
end
end
local function PostUpdateAuraIcon(self, button, icons, index, debuff)
icons.showDebuffType = true
button.cd:SetReverse()
button.icon:SetTexCoord(.07, .93, .07, .93)
button.count:SetPoint('BOTTOMRIGHT', button, 1, 0)
button.count:SetTextColor(.84,.75,.65)
button:SetScript('OnMouseUp', function(self, mouseButton)
if mouseButton == 'RightButton' then
local name, rank = UnitBuff('player', index)
end
end)
self.ButtonOverlay = button:CreateTexture(nil, 'OVERLAY')
self.ButtonOverlay:SetTexture('Interface\\AddOns\\oUF_Darnation\\media\\ring')
self.ButtonOverlay:SetParent(button)
self.ButtonOverlay:SetPoint('TOPLEFT', -5, 5)
self.ButtonOverlay:SetPoint('BOTTOMRIGHT', 5, -5)
self.ButtonOverlay:SetVertexColor(.31,.45,.63,1)
self.ButtonOverlay:SetBlendMode('BLEND')
end
local function styleFunc(self, unit)
local _, class = UnitClass('player')
self.menu = menu
self:RegisterForClicks('AnyUp')
self:SetAttribute('*type2', 'menu')
self:SetScript('OnEnter', UnitFrame_OnEnter)
self:SetScript('OnLeave', UnitFrame_OnLeave)
self:SetBackdrop({bgFile = circle, insets = {top = -30, left = -30, bottom = -30, right = -30}})
self:SetBackdropColor(1,1,1,0)
self.Health = CreateFrame('StatusBar', nil, self)
self.Highlight = self:CreateTexture(nil, 'HIGHLIGHT')
self.InnerRing = self:CreateTexture(nil, 'BORDER')
self.HealthRing = self:CreateTexture(nil, 'BORDER')
self.DebuffHighlight = self:CreateTexture(nil, 'HIGH')
self.Power = CreateFrame('StatusBar', nil, self)
self.VehicleSwitch = false
local size
if unit == 'player' or unit == 'target' then
size = largeSize
elseif unit == 'focus' or unit == 'targettarget' or unit == 'pet' then
size = smallSize
else
size = groupSize
end
self.Health:SetHeight(size*.95)
self.Health:SetWidth(size*.95)
self.Highlight:SetHeight(size*1.80)
self.Highlight:SetWidth(size*1.80)
self.InnerRing:SetWidth(size*1.4)
self.InnerRing:SetHeight(size*1.4)
self.DebuffHighlight:SetWidth(size*1.4)
self.DebuffHighlight:SetHeight(size*1.4)
self.HealthRing:SetWidth(size*1.40)
self.HealthRing:SetHeight(size*1.40)
self.Health:SetFrameLevel(1) -- puts the hp frame lower than the highlight frame
self.Health:SetPoint('CENTER')
self.Health:SetStatusBarTexture(circle)
self.Health.bg = self.Health:CreateTexture(nil, 'BORDER')
self.Health.bg:SetTexture(circle)
self.Health.bg:SetAllPoints(self.Health)
self.Health.bg:SetVertexColor(.15,.15,.15,0)
if (unit == 'target' or unit == 'player') then
self.Health.value = SetFontString(self.Health, font, 21)
self.Health.value:SetPoint('CENTER', self.Health,'CENTER',0, 5)
self.Power.value = SetFontString(self.Health, font, 17 )
self.Power.value:SetPoint('CENTER', self.Health, 'CENTER', 0, -size*.25)
elseif (unit == 'focus') then
self.Health.value = SetFontString(self.Health, font, 15 )
self.Health.value:SetPoint('CENTER', self.Health,'CENTER',0, 5)
self.Power.value = SetFontString(self.Health, font, 13)
self.Power.value:SetPoint('CENTER', self.Health, 'CENTER', 0, -size*.25)
else
self.Health.value = SetFontString(self.Health, font, 14)
self.Health.value:SetPoint('CENTER', self.Health,'CENTER',0, 5)
self.Power.value = SetFontString(self.Health, font, 11)
self.Power.value:SetPoint('CENTER', self.Health, 'CENTER', 0, -size*.25)
end
self.InnerRing:SetPoint('CENTER', self.Health,'CENTER',0, 0)
self.InnerRing:SetTexture(ring)
self.InnerRing:SetBlendMode('ADD')
self.InnerRing:SetVertexColor(1,1,1,.1)
self.HealthRing:SetPoint('CENTER', self.Health,'CENTER',0, 0)
self.HealthRing:SetTexture(indicator)
self.HealthRing:SetBlendMode('ADD')
self.HealthRing:SetVertexColor(1,1,1,0)
self.HealthRing.HRrotateAG = self.HealthRing:CreateAnimationGroup()
self.HealthRing.HRrotateAG:SetLooping("REPEAT")
local rotation = self.HealthRing.HRrotateAG:CreateAnimation("Rotation")
rotation:SetDegrees(360)
rotation:SetDuration(HRRotatingPeriod) -- Should be a variable...
self.Highlight:SetPoint('CENTER', self.Health,'CENTER',0, 0)
self.Highlight:SetTexture(glow)
self.Highlight:SetBlendMode('ADD')
self.Power:SetFrameLevel(1) -- puts the hp frame lower than the highlight frame
self.Power:SetPoint('CENTER', self.Health, 'CENTER', 0, 0)
if(unit=='target' or unit == 'player') then
self.Name = SetFontString(self.Health, font, largeNameFont)
self.Name:SetPoint('TOPLEFT', 1, 53)
elseif (unit=='party') then
self.Name = SetFontString(self.Health, font, groupNameFont)
self.Name:SetPoint('TOPLEFT', 1, 40)
else
self.Name = SetFontString(self.Health, font, smallNameFont)
self.Name:SetPoint('TOPLEFT', 1, 23)
end
if(not unit or unit=='player') then
self.Leader = self.Health:CreateTexture(nil, 'OVERLAY')
self.Leader:SetHeight(16)
self.Leader:SetWidth(16)
self.Leader:SetPoint('TOPLEFT', self.Health, -10, 8)
self.Leader:SetTexture('Interface\\GroupFrame\\UI-Group-LeaderIcon')
end
self.RaidIcon = self.Health:CreateTexture(nil, 'OVERLAY')
self.RaidIcon:SetHeight(16)
self.RaidIcon:SetWidth(16)
self.RaidIcon:SetPoint('TOPRIGHT', self.Health, 16, 8)
self.RaidIcon:SetTexture('Interface\\TargetingFrame\\UI-RaidTargetingIcons')
self.CombatIcon = self.Health:CreateTexture(nil, 'OVERLAY')
self.CombatIcon:SetPoint('TOPLEFT', self.Health, 'TOPRIGHT', -10, 15)
self.CombatIcon:SetHeight((unit and not unit:find('partypet%d')) and 14 or 10)
self.CombatIcon:SetWidth((unit and not unit:find('partypet%d')) and 14 or 10)
self.CombatIcon:SetTexture('Interface\\CharacterFrame\\UI-StateIcon')
self.CombatIcon:SetTexCoord(0.58, 0.90, 0.08, 0.41)
self.Combat = self.CombatIcon
local punit = 'not'
if (self.unit) then
punit = self.unit:sub(1, -2)
end
self.sortAuras = {} -- This will allow this frame to have its auras sorted
-- self.sortAuras.reverse = true -- Option to reverse the sorting.
self.sortAuras.selfFirst = true
if(unit == 'pet') then
self.Buffs = CreateFrame('Frame', nil, self)
self.Buffs.spacing = 5.3
self.Buffs:SetHeight(25)
self.Buffs:SetWidth(150)
self.Buffs:SetPoint('TOPRIGHT', self, 'TOPLEFT', -4, -1.5)
self.Buffs['growth-x'] = 'LEFT'
self.Buffs['growth-y'] = 'DOWN'
self.Buffs.initialAnchor = 'TOPRIGHT'
self.Buffs.size = math.floor(self.Buffs:GetHeight())
end
if(unit == 'target') then
self.Buffs = CreateFrame('Frame', nil, self)
self.Buffs.num = maxBuff
self.Buffs.spacing = 5.3
self.Buffs:SetHeight(28)
self.Buffs:SetWidth(250)
self.Buffs:SetPoint('TOPLEFT', self, 'TOPRIGHT', -4, -25)
self.Buffs.initialAnchor = 'TOPLEFT'
self.Buffs['growth-y'] = 'DOWN'
self.Buffs.size = math.floor(self.Buffs:GetHeight())
end
if(unit == 'target') then
self.Debuffs = CreateFrame('Frame', nil, self)
self.Debuffs.num = maxDebuff
self.Debuffs.spacing = 5.3
self.Debuffs:SetHeight(25)
self.Debuffs:SetWidth(230)
self.Debuffs:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', -10, -30)
self.Debuffs.initialAnchor = 'TOPLEFT'
self.Debuffs['growth-y'] = 'DOWN'
self.Debuffs.showDebuffType = true
self.Debuffs.size = math.floor(self.Debuffs:GetHeight())
if(class == 'ROGUE' or class == 'DRUID') then
self.CPoints = SetFontString(self.Health, font, 24, 'OUTLINE')
self.CPoints:SetPoint('RIGHT', self, 'LEFT', -9, 3)
self.CPoints:SetTextColor(.84, .75, .65)
self.CPoints:SetJustifyH('RIGHT')
end
end
if (unit == 'player' and tekTagsToggle) then
self.MyBuffs = CreateFrame('Frame', nil, self)
local auras = SetFontString(self.MyBuffs, font, 18)
auras:SetPoint("TOPLEFT", self, "TOPRIGHT",-20,10)
auras:SetTextColor(1, 1, 1)
self:Tag(auras, "[tekcurse( )][tekpoison( )][tekdisease( )][tekmagic( )][tekms( )][tekmd( )][tekpws( )][tekws( )][tekwildgrowth( )][teklb( )][tekregrow( )][tekrejuv( )][tekrenew( )][tekpom( )][tekss( )][tekfw( )][tekinn( )][tekfood( )][tekdrink( )][teksac( )][tekrep( )]")
end
if(castBarsToggle and (unit == 'player' or unit == 'focus' or (unit == 'target' and (style == 'DPS' or style == 'dps')))) then
self.Castbar = CreateFrame('StatusBar', nil, self)
self.Castbar:SetBackdrop({bgFile = safe, insets = {top = -10, left = -10, bottom = -10, right = -10}})
self.Castbar:SetBackdropColor(.95,.95,.95,.1)
self.Castbar:SetStatusBarTexture(safe)
self.Castbar:SetWidth(castWidth)
self.Castbar:SetHeight(castHeight)
self.Castbar:SetParent(self)
if (unit == 'focus') then
self.Castbar:SetStatusBarColor(1,0,0,1)
self.Castbar:SetPoint('LEFT', self.Health,'CENTER',80,0)
elseif (unit == 'player') then
self.Castbar:SetStatusBarColor(.5,1,0,1)
self.Castbar:SetPoint('LEFT', self.Health,'CENTER',80,0)
else
self.Castbar:SetStatusBarColor(1,.5,0,1)
self.Castbar:SetPoint('RIGHT', self.Health,'CENTER',-80,0)
end
self.Castbar:SetMinMaxValues(1, 100)
self.Castbar:SetValue(1)
self.Castbar:Hide()
Castbar = self.Castbar
self.Castbar.bg = self.Castbar:CreateTexture(nil, 'BORDER')
self.Castbar.bg:SetAllPoints(self.Castbar)
self.Castbar.bg:SetTexture(cast)
self.Castbar.bg:SetVertexColor(.15,.15,.15,0)
self.Castbar.bg = self.Castbar.bg
Castbar.bg = self.Castbar.bg
self.Castbar.Safezone = self.Castbar:CreateTexture(nil,'ARTWORK')
self.Castbar.Safezone:SetTexture(safe)
self.Castbar.Safezone:SetVertexColor(.31,.45,.63,1)
self.Castbar.Safezone:SetPoint('TOPRIGHT')
self.Castbar.Safezone:SetPoint('BOTTOMRIGHT')
Castbar.safezone = self.Castbar.Safezone
self.Castbar.Text = SetFontString(self.Castbar, font, 20)
self.Castbar.Text:SetPoint('CENTER', self.Castbar,'CENTER', 43, 0)
self.Castbar.Text:SetWidth(230)
self.Castbar.Text:SetTextColor(1,1,1)
Castbar.text = self.Castbar.Text
self.Castbar.Time = SetFontString(self.Castbar, font, 20)
self.Castbar.Time:SetPoint('LEFT', self.Castbar.Text,'LEFT', -1, 25)
self.Castbar.Time:SetTextColor(1,1,1)
self.Castbar.Time:SetJustifyH('CENTER',-5,0)
Castbar.casttime = self.Castbar.Time
end
-- self.DebuffHighlight:SetPoint('CENTER', self.Health,'CENTER',0, size*.3)
self.DebuffHighlight:SetPoint('CENTER', self.Health,'CENTER',0,0)
self.DebuffHighlight:SetTexture(circle)
self.DebuffHighlight:SetBlendMode('ADD')
self.DebuffHighlight:SetVertexColor(.84,.75,.65,0) -- set alpha to 0 to hide the texture
self.DebuffHighlightAlpha = .4
self.DebuffHighlightBackdrop = true
self.DebuffHighlightFilter = false
function self.Banzai(self, unit, aggro)
if aggro == 1 then
self.InnerRing:SetVertexColor(1,.55,0,.7)
else
self.InnerRing:SetVertexColor(1,1,1,.1)
end
end
if(unit == 'player' or unit == 'target') then
self.CombatFeedbackText = SetFontString(self.Health, font, 18, 'OUTLINE')
self.CombatFeedbackText:SetPoint('CENTER', self.Health, 'CENTER', 0, 25)
self:SetAttribute('initial-height', 120)
self:SetAttribute('initial-width', 120)
else
self:SetAttribute('initial-height', 60)
self:SetAttribute('initial-width', 60)
end
if(not unit) then
self.outsideRangeAlpha = 0.5
self.inRangeAlpha = 1.0
self.Range = true
end
self.PostUpdateHealth = PostUpdateHealth
self.PostUpdatePower = PostUpdatePower
self.PostUpdateThreat = PostUpdateThreat
self.PostCreateAuraIcon = PostUpdateAuraIcon
self.UNIT_NAME_UPDATE = PostUpdateName
self.UNIT_HAPPINESS = PostUpdateName
self.PLAYER_TARGET_CHANGED = updateTarget
return self
end
SLASH_OM1 = '/om'
function SlashCmdList.OM(msg, editbox)
print(msg)
style = msg
ReloadUI()
end
local frame = CreateFrame("FRAME"); -- Need a frame to respond to events
frame:RegisterEvent("ADDON_LOADED"); -- Fired when saved variables are loaded
frame:RegisterEvent("PLAYER_LOGOUT"); -- Fired when about to log out
function frame:OnEvent(event, arg1)
--local partytarget
local raid
local pets
local party
local partyFrame
if event == "ADDON_LOADED" and arg1 == "oUF_Metzerott" then
if ( style == 'DPS' or style == 'dps' ) then
oUF:RegisterStyle('Darnation', styleFunc)
oUF:SetActiveStyle('Darnation')
oUF:Spawn('player'):SetPoint('CENTER', UIParent, -250, -180)
oUF:Spawn('target'):SetPoint('CENTER', UIParent, 250, -180)
oUF:Spawn('pet'):SetPoint('BOTTOMLEFT', oUF.units.player, 'BOTTOMLEFT',-(largeSize*.70), 7)
oUF:Spawn('focus'):SetPoint('BOTTOMLEFT', oUF.units.player, 'TOPRIGHT', 0, largeSize*.40)
oUF:Spawn('targettarget'):SetPoint('BOTTOMRIGHT', oUF.units.target, 'TOPLEFT', 0, largeSize*.40)
if(partyToggle) then
partyFrame = CreateFrame('Frame')
party = oUF:Spawn("header", "oUF_Party")
party:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 15, -20)
party:SetManyAttributes('yOffset', -20, 'showParty', true)
partytarget = {}
for i = 1, 5 do
partytarget[i] = oUF:Spawn('party'..i..'target', 'oUF_Party'..i..'Target')
if i == 1 then
partytarget[i]:SetPoint('TOPLEFT', party, 'TOPRIGHT', 10, 0)
else
partytarget[i]:SetPoint('TOP', partytarget[i-1], 'BOTTOM', 0, -20)
end
end
end
raid = {}
if (raidToggle) then
for i = 1, 8 do
local raidgroup = oUF:Spawn('header', 'oUF_Raid'..i)
raidgroup:SetManyAttributes('groupFilter', tostring(i), 'showRaid', true, 'yOffSet', -5)
table.insert(raid, raidgroup)
if(i==1) then
raidgroup:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 15, -15)
else
raidgroup:SetPoint('TOPLEFT', raid[i-1], 'TOPRIGHT', 5, 0)
end
end
end
elseif (style == 'heal' or style == 'HEAL') then
oUF:RegisterStyle('Tarnation', styleFunc)
oUF:SetActiveStyle('Tarnation')
oUF:Spawn('player'):SetPoint('CENTER', UIParent, -350, 100)
oUF:Spawn('target'):SetPoint('TOPLEFT', oUF.units.player,'BOTTOMRIGHT', 0, -(largeSize*.20))
oUF:Spawn('pet'):SetPoint('BOTTOMLEFT', oUF.units.player, 'BOTTOMLEFT',-(largeSize*.70), 7)
oUF:Spawn('focus'):SetPoint('BOTTOMLEFT', oUF.units.player, 'TOPRIGHT', (largeSize*.50), (largeSize*.40))
oUF:Spawn('targettarget'):SetPoint('TOP', oUF.units.target, 'BOTTOM', 0, -(largeSize*.40))
pets = {}
if (partyToggle) then
partyFrame = CreateFrame('Frame')
party = oUF:Spawn("header", "oUF_Party")
party:SetManyAttributes("showParty", true, "yOffset", -10)
party:SetPoint("TOP", oUF.units.player, "BOTTOM", 0, -(largeSize*.40))
party:Show()
party:SetAttribute("showRaid", false)
pets[1] = oUF:Spawn('partypet1', 'oUF_PartyPet1')
pets[1]:SetPoint('BOTTOM', oUF.units.player, 'TOP', 0, 50)
for i =2, 4 do
pets[i] = oUF:Spawn('partypet'..i, 'oUF_PartyPet'..i)
pets[i]:SetPoint('BOTTOM', pets[i-1], 'TOP', 0, 25)
end
end
raid = {}
if (raidToggle) then
for i = 1, 8 do
local raidgroup = oUF:Spawn('header', 'oUF_Raid'..i)
raidgroup:SetManyAttributes('groupFilter', tostring(i), 'showRaid', true, 'yOffSet', -5)
table.insert(raid, raidgroup)
if(i==1) then
raidgroup:SetPoint("TOP", oUF.units.player, "BOTTOM", 0, -(largeSize*.40))
raidgroup:SetPoint('TOPRIGHT', oUF.units.player, 'TOPLEFT', -55, -15)
else
raidgroup:SetPoint('TOPRIGHT', raid[i-1], 'TOPLEFT', -5, 0)
end
end
end
else
print("FAIL")
end
if (partyToggle and raidToggle) then
partyFrame:RegisterEvent('PLAYER_LOGIN')
partyFrame:RegisterEvent('RAID_ROSTER_UPDATE')
partyFrame:RegisterEvent('PARTY_LEADER_CHANGED')
partyFrame:RegisterEvent('PARTY_MEMBER_CHANGED')
partyFrame:SetScript('OnEvent', function(self)
if(InCombatLockdown()) then
self:RegisterEvent('PLAYER_REGEN_ENABLED')
else
self:UnregisterEvent('PLAYER_REGEN_ENABLED')
if(GetNumRaidMembers() > 5 and raidToggle) then
party:Hide()
for i,v in ipairs(raid) do v:Show() end
if partytarget and partyToggle then
for i,v in ipairs(partytarget) do v:Disable() end
end
else
party:Show()
for i,v in ipairs(raid) do v:Hide() end
if partytarget then
for i,v in ipairs(partytarget) do v:Enable() end
end
end
end
end)
end
end
end
frame:SetScript("OnEvent", frame.OnEvent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment