/src/ChorusPartyFrame.lua (5f0bd9a88150180aecb9101c1c4fbffc7f6609ea) (2843 bytes) (mode 100644) (type blob)
local SecureButton_GetUnit = SecureButton_GetUnit
local Chorus = Chorus
--[[--
Given valid player unit designation, infer from it corresponding pet and target unit designations.
Does not check if unit exists.
Used in party frame initialization.
@function mapUnitDesignation
@tparam string unitDesignation unit designation in the same format as native
unit functions, specifically party, arena or raid members (party3, raid13,
arena2)
@treturn string sanitized given unit designation, for example party3
@treturn string given unit pet designation, for example partypet3
@treturn string given unit target designation, for example party3target
]]
local function mapUnitDesignation(unitDesignation)
assert(unitDesignation ~= nil)
if 'player' == unitDesignation then
return 'player', 'pet', 'target'
elseif string.match(unitDesignation, 'raid') then
local raidUnit = string.match(unitDesignation, 'raid%d+')
local raidPet = 'raidpet' .. string.match(unitDesignation, 'raid(%d+)')
local raidTarget = 'raid' .. string.match(unitDesignation, 'raid(%d+)') .. 'target'
return raidUnit, raidPet, raidTarget
elseif string.match(unitDesignation, 'party') then
local partyUnit = string.match(unitDesignation, 'party%d+')
local partyPet = 'partypet' .. string.match(unitDesignation, 'party(%d+)')
local partyTarget = 'party' .. string.match(unitDesignation, 'party(%d+)') .. 'target'
return partyUnit, partyPet, partyTarget
elseif string.match(unitDesignation, 'arena') then
local arenaUnit = string.match(unitDesignation, 'arena%d+')
local arenaPet = 'arenapet' .. string.match(unitDesignation, 'arena(%d+)')
local arenaTarget = 'arena' .. string.match(unitDesignation, 'arena(%d+)') .. 'target'
return arenaUnit, arenaPet, arenaTarget
else
error('invalid argument: must be a unit designation of a player character or a group member')
end
end
local function partyMemberFrameInit(partyMemberFrame)
assert(partyMemberFrame ~= nil)
local n = partyMemberFrame:GetName()
assert(n ~= nil)
local u = partyMemberFrame:GetAttribute('unit')
if not u then
u = SecureButton_GetUnit(partyMemberFrame)
end
local _, upet, utarget = mapUnitDesignation(u)
local unitFrame = _G[n .. 'UnitFrame']
local petFrame = _G[n .. 'PetFrame']
local targetFrame = _G[n .. 'TargetFrame']
assert(unitFrame ~= nil)
assert(petFrame ~= nil)
assert(targetFrame ~= nil)
unitFrame:SetAttribute('unit', u)
petFrame:SetAttribute('unit', upet)
targetFrame:SetAttribute('unit', utarget)
end
function Chorus.partyMemberFrameMain(partyMemberFrame)
assert(partyMemberFrame ~= nil)
partyMemberFrame:RegisterEvent('ADDON_LOADED')
partyMemberFrame:SetScript('OnEvent', partyMemberFrameInit)
partyMemberFrame:SetScript('OnAttributeChanged', partyMemberFrameInit)
end
function Chorus.partyFrameMain(self)
assert(self ~= nil)
end
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
35 |
5c40e6e2862d70b5c51c326a13073a4012ac05c7 |
.gitignore |
100644 |
blob |
1095 |
ea691376a4847fd792cb2ae4b1ffebbd6bd6e22a |
Makefile |
100644 |
blob |
3394 |
190d35463349336b8ed9d90078342c5643600a29 |
README.adoc |
100644 |
blob |
234 |
fca3e2be1b6aacf0e93e898255a4049a33b35d36 |
chorus.toc |
040000 |
tree |
- |
cac8af7ca5d8adc7771598e6faae482998b25fa2 |
doc |
040000 |
tree |
- |
b232717e4ce1bb949a6e4e68fbf679b026b48fd0 |
etc |
040000 |
tree |
- |
c04e1001c2dd401037b01ddd04fdeccc99be2ec3 |
share |
040000 |
tree |
- |
ebdeb4d98909af86d2423f9845ed706466beccbc |
src |
040000 |
tree |
- |
aa42c74ca307c2c3c635efd4186be6e5404a6303 |
test |
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