vrtc / chorus (public) (License: CC0) (since 2023-08-12) (hash sha1)
World of Warcraft add-on stub. The overall goal is to create a specialized raid frame.

/src/ChorusRaidTargetIconFrameTemplate.lua (2682b7d245743833089f6d697f72b7639c6e84d7) (1919 bytes) (mode 100644) (type blob)

--[[--
@submodule chorus
]]

local Chorus = Chorus

local UnitExists = Chorus.test.UnitExists or UnitExists
local UnitIsConnected = Chorus.test.UnitIsConnected or UnitIsConnected
local GetRaidTargetIndex = GetRaidTargetIndex

local SecureButton_GetUnit = Chorus.test.SecureButton_GetUnit or SecureButton_GetUnit
--[[ See FrameXML/TargetFrame.lua:682 ]]--
local SetRaidTargetIconTexture = SetRaidTargetIconTexture

local function raidTargetIconFrameEventProcessor(self)
	assert(self ~= nil)

	local u = SecureButton_GetUnit(self) or 'none'

	assert(u ~= nil)
	assert('string' == type(u))
	u = string.lower(strtrim(u))
	assert(string.len(u) >= 1)
	assert(string.len(u) <= 256)

	local raidIconIndex = GetRaidTargetIndex(u)

	local artwork = self.artwork or _G[self:GetName() .. 'Artwork']
	assert(artwork ~= nil)

	if UnitExists(u) and UnitIsConnected(u) and raidIconIndex then
		SetRaidTargetIconTexture(artwork, raidIconIndex)
		self:Show()
	else
		SetRaidTargetIconTexture(artwork, 0)
		self:Hide()
	end
end

--[[--
`ChorusRaidTargetIconFrameTemplate` shows the corresponding unit raid marker,
like {skull}, {diamond}, {moon}, {star}, etc.

@function raidTargetIconFrameMain
@tparam frame self this raid target icon frame
]]
function Chorus.raidTargetIconFrameMain(self)
	assert(self ~= nil)

	local artwork = _G[self:GetName() .. 'Artwork']
	assert(artwork ~= nil)
	self.artwork = artwork

	--artwork:SetSize(RAID_TARGET_ICON_DIMENSION, RAID_TARGET_ICON_DIMENSION)
	SetRaidTargetIconTexture(artwork, 0)

	self:SetScript('OnEvent', raidTargetIconFrameEventProcessor)

	self:RegisterEvent('PARTY_CONVERTED_TO_RAID')
	self:RegisterEvent('PARTY_MEMBERS_CHANGED')
	self:RegisterEvent('PLAYER_ENTERING_WORLD')
	self:RegisterEvent('PLAYER_FOCUS_CHANGED')
	self:RegisterEvent('PLAYER_LOGIN')
	self:RegisterEvent('PLAYER_TARGET_CHANGED')
	self:RegisterEvent('RAID_ROSTER_UPDATE')
	self:RegisterEvent('RAID_TARGET_UPDATE')
end


Mode Type Size Ref File
100644 blob 35 5c40e6e2862d70b5c51c326a13073a4012ac05c7 .gitignore
100644 blob 3606 f73da473168d1897963fd2e32d89841ca0461ec0 README.adoc
040000 tree - 271296b4bafcaa151458a0192fd313641ca9b409 bin
100644 blob 228 c7dd24afa7d5c2375ff60a91c73623a304b808f9 chorus.toc
040000 tree - 99c99c3cbc641f8954a5be291e61681cb5e74629 conf
040000 tree - efa7258757edf7b888ea13c215e14b497fef8a16 doc
100644 blob 2391 1b0ca1bc25f74a34476360e5a8f14e28767b204e makefile
040000 tree - b9d3ea9d61b99ee71b5fcdbc6b18843df20c8c3c src
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/vrtc/chorus

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/vrtc/chorus

Clone this repository using git:
git clone git://git.rocketgit.com/user/vrtc/chorus

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main