AlleyKat |
02-10-11 01:40 PM |
Client crashes with my party layout
got error 132? when fighting on bg with this:
Code:
local Wiskas = select(2,...)
local oUF = Wiskas.oUF
local M = Hissy[1]
local colors = Wiskas.colors
local getP = function()
if GetCVar("hidePartyInRaid") == "1" then
return ("party")
else
return ("raid,party")
end
end
local SetAnim = Wiskas.makeanim
local PortraitPostUpdate = function(Portrait, unit)
Portrait:SetPortraitZoom(1.001) -- to fix focking worgen models
local englass = select(2, UnitClass(unit))
if (colors.class[englass]) then
local r, g, b = unpack(colors.class[englass])
Portrait:SetBackdropColor(r, g, b)
end
end
local updateHealth = function(bar, unit, current, maxhp)
local anim = bar.second.anim:IsPlaying()
if (UnitIsDead(unit)) or (UnitIsGhost(unit)) or not(UnitIsConnected(unit)) then
bar:SetStatusBarColor(0,0,0,0)
bar.second:SetStatusBarColor(0.2, 0.2, 0.2, 0.68)
bar.second:SetMinMaxValues(0,maxhp)
bar.second:SetValue(maxhp)
bar.second:SetAlpha(1)
if anim then
bar.second.anim:Finish()
bar:SetFrameLevel(6)
bar.second:SetFrameLevel(5)
bar.second:SetAlpha(1)
end
if (UnitIsDead(unit)) then
bar.deadornot:SetText("|cffFFFFFFDead|r")
elseif (UnitIsGhost(unit)) then
bar.deadornot:SetText("|cffFFFFFFGhost|r")
elseif not UnitIsConnected(unit) then
bar.deadornot:SetText("|cffFFFFFFOffline|r")
end
else
bar:SetValue(maxhp-current)
bar.second:SetMinMaxValues(0,maxhp)
bar.second:SetValue(maxhp-current)
bar.deadornot:SetText()
if (current/maxhp) <= .25 then
if not anim then
bar.second.anim:Play()
bar:SetFrameLevel(5)
bar.second:SetFrameLevel(6)
bar.second:SetAlpha(1)
end
bar.second:SetStatusBarColor(1, 0, 0, .95)
bar:SetStatusBarColor(0.09, 0, 0, 0.7)
else
if anim then
bar.second.anim:Finish()
bar:SetFrameLevel(6)
bar.second:SetFrameLevel(5)
bar.second:SetAlpha(1)
end
bar.second:SetAlpha(1)
bar:SetStatusBarColor(0.1, 0, 0, 0.666)
bar.second:SetStatusBarColor(0.5, 0, 0, 0.6)
end
end
end
local updatePower = function(bar, unit, min, max)
if UnitIsDead(unit) or UnitIsGhost(unit) or not(UnitIsConnected(unit)) then
bar:SetValue(0)
else
bar:SetValue(min)
local ptype = select(2, UnitPowerType(unit))
if(colors.power[ptype]) then
local r, g, b = unpack(colors.power[ptype])
bar:SetStatusBarColor(r, g, b)
if bar.value then
bar.value:SetTextColor(r, g, b)
end
end
end
end
local re_color = function(self,r,g,b,ag,type_s)
self:SetBackdropBorderColor(r,g,b,ag or 1)
local p
if type_s then
p = self.Health.port
else
p = self
end
if ag then r,g,b = 0,0,0 end
p.top:SetTexture(r,g,b)
p.bottom:SetTexture(r,g,b)
p.left:SetTexture(r,g,b)
p.right:SetTexture(r,g,b)
end
local function UpdateThreat(self, event, unit)
if (self.unit ~= unit) then
return
end
local threat = UnitThreatSituation(self.unit)
if (threat == 3) then
re_color(self,1,0,0,nil,true)
re_color(self.infobg,1,0,0)
re_color(self.Power.glow,1,0,0)
elseif (threat == 2) then
re_color(self,1,.5,0,nil,true)
re_color(self.infobg,1,.5,0)
re_color(self.Power.glow,1,.5,0)
elseif (threat == 1) then
re_color(self,1,1,0,nil,true)
re_color(self.infobg,1,1,0)
re_color(self.Power.glow,1,1,0)
else
local r,g,b,h = unpack(M["media"].color)
re_color(self,r,g,b,h,true)
re_color(self.infobg,r,g,b,h)
re_color(self.Power.glow,r,g,b,h)
end
end
local function menu(self)
if(self.unit:match('party')) then
ToggleDropDownMenu(1, nil, _G['PartyMemberFrame'..self.id..'DropDown'], 'cursor')
end
end
local mk_hell_4 = function(self,unit)
if not(IsAddOnLoaded("oUF_HealComm4")) then return end
local text = self.level_:CreateFontString(nil, 'OVERLAY')
text:SetFont(M["media"].font,19,"OUTLINE")
text:SetTextColor(0, 1, 0)
text:SetPoint('TOP', self.infobg,"BOTTOM", 0, -32)
self.allowHealCommOverflow = true
return text
end
local function CreateParty(self, unit)
local high_level = CreateFrame("Frame",nil,self)
high_level:SetFrameLevel(9)
self.level_ = high_level
self.menu = menu
self:RegisterForClicks('AnyDown')
self:SetAttribute('*type2', 'menu')
self:SetFrameLevel(0)
self:SetFrameStrata("LOW")
self:SetScript('OnEnter', UnitFrame_OnEnter)
self:SetScript('OnLeave', UnitFrame_OnLeave)
M.setbackdrop(self)
local i_bg = M.frame(self,3,"LOW")
i_bg:SetPoint ("BOTTOMLEFT",self,"TOPLEFT", 0, -2)
i_bg:SetWidth (96)
i_bg:SetHeight(21)
local info = i_bg:CreateFontString(nil, "OVERLAY")
info:SetFont(M["media"].font, 13)
info:SetShadowOffset(1, -1)
info:SetPoint("BOTTOMLEFT",self,"TOPLEFT", 5, 2.3)
info:SetPoint("BOTTOMRIGHT",self,"TOPRIGHT", 15.5, 2.3)
info:SetJustifyH("CENTER")
self:Tag(info, '[name]')
self.infobg = i_bg
local port = CreateFrame("PlayerModel", nil, self)
port:SetAlpha(1)
port:SetPoint("TOPLEFT",4,-4)
port:SetPoint("BOTTOMRIGHT",-4,4)
port:SetFrameLevel(4)
M.style(port,true,-1)
port:SetBackdrop{bgFile = M["media"].walltex, tile = true, tileSize = 46}
port:SetAlpha(1)
port:SetFrameLevel(3)
local mask = CreateFrame("Frame",nil,port)
mask:SetFrameLevel(5)
mask:SetPoint("TOPLEFT")
mask:SetPoint("TOPRIGHT")
mask:SetHeight(25)
local tex = mask:CreateTexture(nil,"Border")
tex:SetAllPoints()
tex:SetTexture(1,1,1,1)
tex:SetGradientAlpha("VERTICAL",0,0,0,0,0,0,0,.666)
tex:SetBlendMode("BLEND")
local health = CreateFrame("StatusBar", nil, self)
health:SetStatusBarTexture(M["media"].barv)
health:SetAllPoints(port)
health:SetFrameLevel(6)
health.Smooth = true
health.deadornot = health:CreateFontString (nil,"OVERLAY")
health.deadornot:SetFont(M["media"].font,15)
health.deadornot:SetShadowOffset(1,-1)
health.deadornot:SetJustifyH("CENTER")
health.deadornot:SetPoint("CENTER",0,1.3)
health.second = CreateFrame("StatusBar",nil,health)
health.second:SetFrameLevel(health:GetFrameLevel()-1)
health.second:SetAllPoints(health)
health.second:SetStatusBarTexture(M["media"].blank)
health.second:SetStatusBarColor(0,0,0,0)
health.second:SetFrameLevel(5)
SetAnim(health.second,.3,1,2)
health.port = port
self.Health = health
self.Auras = CreateFrame("Frame", nil, self)
self.Auras.initialAnchor = "TOPLEFT"
self.Auras["growth-x"] = "RIGHT"
self.Auras["growth-y"] = "DOWN"
self.Auras.numDebuffs = 6
self.Auras.spacing = 4
self.Auras.size = 28
self.Auras.numBuffs = 0
self.Auras:SetHeight(self.Auras.size*2+4)
self.Auras:SetWidth(28*3+8)
self.Auras:SetPoint("TOPLEFT",info,"TOPRIGHT",5,0)
self.Auras.cc_font_size = 13
self.Auras.PostCreateIcon = Wiskas.auraIcon
self.Auras.PostUpdateIcon = Wiskas.auraUpdateIcon
local cc = CreateFrame("StatusBar", nil, self.infobg)
cc:SetFrameLevel(3)
local invise = cc:CreateTexture(nil,"OVERLAY")
invise:SetTexture(0,0,0,0)
cc:SetPoint("TOPLEFT",self.infobg,4,-4)
cc:SetPoint("BOTTOMRIGHT",self.infobg,-4,4)
cc:SetStatusBarTexture(invise)
cc.Spark = cc:CreateTexture(nil, "OVERLAY")
cc.Spark:SetWidth(9)
cc.Spark:SetBlendMode("ADD")
cc.Spark:SetAlpha(1)
local iconbg = M.frame(cc,10,self.Health:GetFrameStrata(),true)
iconbg:SetPoint("TOPLEFT", self.Health, -2, 2)
iconbg:SetAlpha(.9)
cc.Icon = iconbg:CreateTexture(nil, "BORDER")
cc.Icon:SetTexCoord(.1,.9,.1,.9)
cc.Icon:SetGradient("VERTICAL",.5,.5,.5,1,1,1)
cc.Icon:SetPoint("TOPLEFT",4,-4)
cc.Icon:SetPoint("BOTTOMRIGHT",-4,4)
self.Castbar = cc
local lead = high_level:CreateFontString(nil,"OVERLAY")
lead:SetFont(M["media"].font, 13)
lead:SetShadowOffset(1, -1)
lead:SetPoint("TOPLEFT",self.Health,2.3,0)
self:Tag(lead, '[leader]')
local power = CreateFrame("StatusBar", nil, self)
power:SetPoint("BOTTOMLEFT",self,"BOTTOMRIGHT",2,4)
power:SetPoint("TOPLEFT",self,"TOPRIGHT",2,-4)
power:SetWidth(14)
power:SetFrameLevel(6)
power:SetStatusBarTexture(M["media"].barv)
power.frequentUpdates = true
power.Smooth = true
self.Power = power
local p_glow = M.frame(self.Power,0)
p_glow:SetPoint("TOPRIGHT",4,4)
p_glow:SetPoint("BOTTOMLEFT",-4,-4)
self.Power.glow = p_glow
local ri = high_level:CreateTexture(nil, "OVERLAY")
ri:SetHeight(20)
ri:SetWidth(20)
ri:SetPoint("TOP", self, 0 , 2)
ri:SetTexture(HissyData['media'].ricon)
self.RaidIcon = ri
local lfd = high_level:CreateTexture(nil, "OVERLAY")
lfd:SetHeight(16)
lfd:SetWidth(16)
lfd:SetPoint("BOTTOMLEFT",self,2,2)
self.LFDRole = lfd
table.insert(self.__elements, UpdateThreat)
self:RegisterEvent('PLAYER_TARGET_CHANGED', UpdateThreat)
self:RegisterEvent('UNIT_THREAT_LIST_UPDATE', UpdateThreat)
self:RegisterEvent('UNIT_THREAT_SITUATION_UPDATE', UpdateThreat)
self.Power:SetOrientation("VERTICAL")
self.Health:SetOrientation("VERTICAL")
self.Health.second:SetOrientation("VERTICAL")
if IsAddOnLoaded('oUF_SpellRange') or WiskasStuff.spellrange then
local x = WiskasStuff.rangealpha/100
self.SpellRange = {
["insideAlpha"] = 1,
["outsideAlpha"] = x,}
end
self.Portrait = port
self.Portrait.PostUpdate = PortraitPostUpdate
self.Health.PostUpdate = updateHealth
self.Power.PostUpdate = updatePower
self.HealCommText = mk_hell_4(self,unit)
return self
end
oUF:RegisterStyle('AlleyParty', CreateParty)
oUF:SetActiveStyle('AlleyParty')
local party = oUF:SpawnHeader("oUF_AlleyParty", nil ,getP(),"showParty", true, "yOffset", -21, 'oUF-initialConfigFunction',
([[
self:SetWidth(76)
self:SetHeight(47)
]]))
party:SetPoint("TOPLEFT", UIParent, "LEFT", 2, 121)
party:Show()
TT
|