oUF ein Simpler Raid

wertzû

Welt-Boss
Mitglied seit
12.01.2008
Beiträge
2.803
Reaktionspunkte
20
Kommentare
76
Code:
 local _, class = UnitClass('player')
local font = YOURFONT
local fontsize = YOURFONTSIZE
local backdrop = YOURBACKDROP
local texture = YOURTEXTURE

local function utf8sub(str, start, numChars)
 local currentIndex = start
 while numChars > 0 and currentIndex <= #str do
	local char = string.byte(str, currentIndex)
	if char > 240 then
 	currentIndex = currentIndex + 4
	elseif char > 225 then
 	currentIndex = currentIndex + 3
	elseif char > 192 then
 	currentIndex = currentIndex + 2
	else 
 	currentIndex = currentIndex + 1
	end
	numChars = numChars -1
 end
 return str:sub(start, currentIndex - 1)
end

local SetFontString = function(parent, fontname, fontsize, anchorpoint, anchorto, xoffset, yoffset)
	local fs = parent:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
	fs:SetFont(fontname, fontsize)
	fs:SetShadowColor(0,0,0)
	fs:SetShadowOffset(1.25,-1.25)
	fs:SetPoint(anchorpoint, parent, anchorto, xoffset, yoffset)
	return fs
end

oUF.TagEvents['customname'] = 'UNIT_NAME_UPDATE'
oUF.Tags['customname'] = function(unit)
	return string.len(UnitName(unit)) > 4 and utf8sub(UnitName(unit), 1, 4) or UnitName(unit)
end

local function menu(self)
 if(self.unit:match('party')) then
	ToggleDropDownMenu(1, nil, _G['PartyMemberFrame'..self.id..'DropDown'], 'cursor')
 else
	ToggleDropDownMenu(1, nil, TargetFrameDropDown, 'cursor')
 end
end

local function Shared(self, unit)
	self.menu = menu
	self:RegisterForClicks('AnyUp')
	self:SetAttribute('*type2', 'menu')
	self:SetScript('OnEnter', UnitFrame_OnEnter)
	self:SetScript('OnLeave', UnitFrame_OnLeave)

	self:SetBackdrop(backdrop)
	self:SetBackdropColor(0, 0, 0)

	local hp = CreateFrame('StatusBar', self:GetName()..'_health', self)
	if unit == 'party' then
		hp:SetHeight(YOURPARTYFRAMEHEIGHT)
	elseif unit == 'raid' then
		hp:SetHeight(YOURRAIDFRAMEHEIGHT)
	end
	hp:SetParent(self)
	hp:SetPoint('TOPLEFT')
	hp:SetPoint('TOPRIGHT')
	hp:SetStatusBarTexture(texture)
	hp:GetStatusBarTexture():SetHorizTile(false)
	hp:GetStatusBarTexture():SetVertTile(false)
	hp.colorClass = true
	self.Health = hp

	local hpbg = hp:CreateTexture(nil, 'BORDER')
	hpbg:SetAllPoints(hp)
	hpbg:SetTexture(texture)
	hpbg.multiplier = 0.4
	self.Health.bg = hpbg

	if unit == 'party' then
		local name = SetFontString(hp,font,fontsize,'LEFT')
		name:SetJustifyH('LEFT')
		self:Tag(name, '[name]')
		
		local hpvalue = SetFontString(hp,font,fontsize,'RIGHT')
		hpvlaue:SetJustifyH('RIGHT')
		self:Tag(hpvalue, '[perhp]%')
		
		local debuffs = CreateFrame('Frame', nil, self)
		debuffs:SetSize(WIDTH,HEIGHT)
		debuffs.num = YOURNUMDEBUFFS
		debuffs.size = YOURSIZE
		debuffs.spacing = YOURSPACING
		debuffs:SetPoint(YOURSETPOINT)
		self.Debuffs = debuffs

	elseif unit == 'raid' then
		local name = SetFontString(hp,font,fontsize,'CENTER')
		name:SetJustifyH('CENTER')
		self:Tag(name, '[customname]')	
	end

	local RI = hp:CreateTexture(nil, 'OVERLAY')
	RI:SetPoint(YOURSETPOINT)
	RI:SetSize(WIDTH,HEIGHT)
	self.RaidIcon = RI

	self.Range = {outsideAlpha = 0.4, insideAlpha = 1.0}

	if unit == 'party' then
		self:SetAttribute('initial-height', YOURPARTYHEIGHT)
		self:SetAttribute('initial-width', YOURPARTYWIDTH)
	elseif unit == 'raid' then
		self:SetAttribute('initial-height', YOURRAIDHEIGHT)
		self:SetAttribute('initial-width', YOURRAIDWIDTH)
	end
end

oUF:RegisterStyle('YOURSTYLE', Shared)
oUF:Factory(function(self)
	self:SetActiveStyle('YOURSTYLE')

	local party = self:SpawnHeader('oUF_Party', nil, 'party',
		'showPlayer', true,
		'showSolo', false,
		'showParty', true,
		'xoffset', 5,
		'yOffset', 5,
		'point', 'TOP'
	)
	party:SetPoint(YOURSETPOINT)

	local raid = self:SpawnHeader('oUF_Raid', nil, 'raid',
		'showPlayer', true,
		'showSolo', false,
		'showParty', true,
		'showRaid', true,
		'xoffset', 5,
		'yOffset', 5,
		'point', 'TOP',
		'groupingOrder', '1,2,3,4,5,6,7,8',
		'groupBy', 'GROUP',
		'maxColumns', 8,
		'unitsPerColumn', 5,
		'columnSpacing', 5,
		'columnAnchorPoint', 'RIGHT'
	)
	raid:SetPoint(YOURSETPOINT)
end)

hab das mal gefunden, alle sachen die man editieren muss sind in grossbuchstaben geschrieben hf. (kein support von mir, ist ne kleine hilfe für leute die sich nicht so mit ouf auskennen, habs selber nicht geschrieben)
 
Zurück