얼마전에도 여쭈워봤는데 염치불구하고 질문 드릴게욥
10가지 차단기 등록 후 각 프레임위치에 정상적으로 표시되는데요
여기서 궁금한게 표시 프레임의 1위치 를 정해주고 최대프레임을 4~6 정도 정해주고 들어온 차단기가 플레이어(본인)에게 들어온 순서대로 마차,비난,발차기,정얼,주잠,손날,자루 이 들어왔다는 가정하에
1프레임 위치만 정해주면 이런식으로 들어오게 하는법 없나요?
1 2 3 4
마차 비난 발차기 정얼
주잠 손날 자루
1번인 마차가 아직 쿨 표시 되고있는 상황이라면 5,6,7로 넘어가고 넘어가다가
1이 쿨이 끝났다면 사라지고 다음 차단기가 들어오면 들어온 순서대로 1,2,3,4... 가능한가요?
현재는 각 스킬 프레임 위치고정이고 쿨이돌아오면 사라지게까지는 되어있는데
이런식으로 만들면 정말 보기 좋을거같아요
local spellList = {
[116709] = 15,--손날찌르기
[6552] = 15,--자루 공격
[1766] = 15,--발차기
[96231] = 15,--비난
[34490] = 20,--침묵의 사격
[47528] = 15,--정신 얼리기
[57994] = 12,--날카로운 바람
[93985] = 15,--두개골 강타(표범)
[93984] = 15,--두개골 강타(곰)
[2139] = 20, --"마법 차단" (14시즌 입으면 20초)
[119308] =20, --"마법 차단" (문양)
[19647] = 24, -- 주문 잠금
[132409] = 24,--똥개먹은 흑마가 날린 주잠?
[115781] = 24, -- 안구 광선
}
-- r g b a
local fadedcolor = {0.45,0.45,0.45,0.70};
local upcolor = {1.00,1.00,1.00,1.00};
local frames = {}
local numframes = 0
InterruptTrackerUnlock = false
InterruptTrackerScale = 0.8 --아이콘 스케일.
InterruptTrackerRotate = false
InterruptTrackerMaxFrames = 15 --최대 아이콘 수.
InterruptTrackerRotate = false --아이콘 수직 정렬
local function InterruptTrackerFormatTime(time)
if(time >= 1) then
return floor(time);
else
return "."..floor(time*10);
end
end
local function InterruptTrackerCreateFrame()
numframes = numframes + 1
frames[numframes] = CreateFrame("Frame", nil, UIParent)
local frame = frames[numframes]
frame:SetFrameStrata("LOW")
frame:SetSize(36, 36)
frame:SetScale(InterruptTrackerScale);
frame:Hide()
frame.fading = false
frame.startTime = nil
frame.icon = frame:CreateTexture(nil,"ARTWORK")
frame.icon:SetAllPoints(frame)
frame.overlay = CreateFrame("Frame", "InterruptTrackerActivationAlert" .. numframes, frame, "InterruptTrackerActivationAlert")
frame.overlay:SetSize(36*1.4, 36*1.4)
frame.overlay:SetPoint("TOPLEFT", frame, "TOPLEFT", -36*0.2, 36*0.2)
frame.overlay:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", 36*0.2, -36*0.2)
frame.ooccounter = CreateFrame("Frame", nil, frame)
frame.ooccounter:SetScript("OnUpdate", InterruptTrackerOOCCounterFunc)
frame.ooccounter:Hide()
frame.ooccounter.startTime = nil
frame.countframe = CreateFrame("Frame", nil, frame)
frame.countframe:SetScript("OnUpdate", InterruptTrackerFrameCounter)
frame.countframe:Hide()
frame.countframe.endTime = nil
frame.countframe.durtext = frame.countframe:CreateFontString(nil, "OVERLAY", "InterruptTrackerDurText")
frame.countframe.durtext:SetPoint("CENTER", frame, "CENTER", 0, 0)
if(numframes == 1) then
frame:SetPoint("TOPLEFT", InterruptTrackerHeader, "TOPLEFT", 3, -3)
else
if(InterruptTrackerRotate) then
frame:SetPoint("TOPLEFT", frames[numframes-1], "BOTTOMLEFT", 0, -5)
else
frame:SetPoint("TOPLEFT", frames[numframes-1], "TOPRIGHT", 5, 0)
end
end
end
local function InterruptTrackerShowFrame(num, spellId)
if(not frames[num]:IsVisible() or frames[num].fading) then
frames[num]:SetScript("OnUpdate",InterruptTrackerFadeFunc)
frames[num]:Show()
frames[num].fading = false
frames[num].startTime = GetTime()
end
local dur = spellList[spellId]
local icon = select(3, GetSpellInfo(spellId))
frames[num].icon:SetTexture(icon)
frames[num].spellId = spellId
frames[num].dur = dur
frames[num].ooccounter.enable = false
frames[num].icon:SetVertexColor(fadedcolor[1], fadedcolor[2], fadedcolor[3], fadedcolor[4])
end
local function InterruptTrackerHideFrame(self)
if(self:IsVisible() and not self.fading) then
self:SetScript("OnUpdate",InterruptTrackerFadeFunc)
self.fading = true
self.startTime = GetTime()
end
self.dur = nil
self.countframe:Hide()
self.ooccounter:Hide()
end
local function InterruptTrackerInstaHideAll()
for i=1, numframes do
frames[i].dur = nil
frames[i]:Hide()
frames[i].countframe:Hide()
frames[i].ooccounter:Hide()
end
end
local function InterruptTrackerStartCounter(num)
frames[num].countframe:Show()
frames[num].countframe.endTime = GetTime() + frames[num].dur
frames[num].overlay.animIn:Play()
frames[num].icon:SetVertexColor(upcolor[1], upcolor[2], upcolor[3], upcolor[4])
end
local function InterruptTrackerStopCounter(frame)
frame.countframe:Hide()
frame.icon:SetVertexColor(fadedcolor[1], fadedcolor[2], fadedcolor[3], fadedcolor[4])
end
function InterruptTracker(self)
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("ADDON_LOADED")
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:SetBackdropColor(0, 0, 0);
self:RegisterForClicks("RightButtonUp")
self:RegisterForDrag("LeftButton")
self:SetClampedToScreen(true)
end
function InterruptTrackerOnEvent(self, event, ...)
if(event == "COMBAT_LOG_EVENT_UNFILTERED") then
if(UnitIsDeadOrGhost("player")) then
return
end
local type = select(2, ...)
local sourceGUID = select(4, ...)
local sourceFlags = select(6, ...)
local isSrcEnemy = (bit.band(sourceFlags, COMBATLOG_OBJECT_REACTION_HOSTILE) == COMBATLOG_OBJECT_REACTION_HOSTILE)
local isSrcPlayerControlled = (bit.band(sourceFlags, COMBATLOG_OBJECT_CONTROL_PLAYER) == COMBATLOG_OBJECT_CONTROL_PLAYER)
if(not isSrcEnemy or not isSrcPlayerControlled) then
return
end
if (type == "SPELL_CAST_SUCCESS" or type == "SPELL_MISS") then
local spellId = select(12, ...)
if spellList[spellId] then
for i=1, numframes do
if frames[i].spellId==spellId then
InterruptTrackerShowFrame(i, spellId)
InterruptTrackerStartCounter(i)
return;
end
--frames[i]:SetPoint("TOPLEFT", frames[i-1], "TOPRIGHT", 5, 0);
end
InterruptTrackerCreateFrame()
InterruptTrackerShowFrame(numframes, spellId)
InterruptTrackerStartCounter(numframes)
end
end
elseif(event == "PLAYER_ENTERING_WORLD") then
InterruptTrackerInstaHideAll()
elseif(event == "PLAYER_DEAD") then
for i=1, numframes do
InterruptTrackerHideFrame(frames[i])
end
elseif(event == "ADDON_LOADED" and arg1 == "InterruptTracker") then
InterruptTrackerSetScale()
InterruptTrackerSetLayout()
end
end
------------------------
-- OnUpdate Functions --
------------------------
function InterruptTrackerFrameCounter(self)
local time = self.endTime - GetTime()
if(time <= 0) then
local p = self:GetParent()
InterruptTrackerStopCounter(p)
p.ooccounter.enable = true
p.ooccounter:Show()
p.ooccounter.startTime = GetTime()
else
self.durtext:SetText(InterruptTrackerFormatTime(time))
end
end
function InterruptTrackerFadeFunc(self)
local elapsed = GetTime() - self.startTime;
if(elapsed > 0.4) then
self:SetScript("OnUpdate", nil);
if(self.fading) then
self:Hide()
end
end
if(self.fading) then
self:SetAlpha(1-elapsed*2.5);
else
self:SetAlpha(elapsed*2.5);
end
end
function InterruptTrackerOOCCounterFunc(self)
if self.enable then
if(GetTime() - self.startTime > 1) then
InterruptTrackerHideFrame(self:GetParent())
end
end
end
---------------------------
-- Config Menu Functions --
---------------------------
function InterruptTrackerUnlockFunc()
InterruptTrackerHeader:Show();
InterruptTrackerUnlock = true
InterruptTrackerInstaHideAll()
if(numframes < 10) then
for i=numframes+1, 10 do
InterruptTrackerCreateFrame()
end
end
InterruptTrackerShowFrame(1, 57994)-- = 12, -- "날카로운 바람
InterruptTrackerShowFrame(2, 6552)-- = 15, --"자루공격"
InterruptTrackerShowFrame(3, 1766)-- = 15, --"발차기"
InterruptTrackerShowFrame(4, 96231)-- = 15, --"비난"
InterruptTrackerShowFrame(5, 47528)-- = 15, --"정신얼리기"
InterruptTrackerShowFrame(6, 116709)-- = 15, --"손날찌르기"
InterruptTrackerShowFrame(7, 93984)-- = 15, --"두개골강타"(곰)
InterruptTrackerShowFrame(7, 93985)-- = 15, --"두개골강타"(표범)
InterruptTrackerShowFrame(8, 34490)-- = 20, -- "침묵의 사격"
InterruptTrackerShowFrame(9, 19647)-- = 24, -- "주문 잠금"
InterruptTrackerShowFrame(9, 115781)-- = 24, -- "안구 광선"
InterruptTrackerShowFrame(9, 132409)-- = 24, -- "희생 주문 잠금"
InterruptTrackerShowFrame(10, 2139)-- = 20, --"마법 차단"
InterruptTrackerShowFrame(10, 119308)-- = 20, --"마법 차단"(문양)
InterruptTrackerStartCounter(1)
InterruptTrackerStartCounter(2)
InterruptTrackerStartCounter(3)
InterruptTrackerStartCounter(4)
InterruptTrackerStartCounter(5)
InterruptTrackerStartCounter(6)
InterruptTrackerStartCounter(7)
InterruptTrackerStartCounter(8)
InterruptTrackerStartCounter(9)
InterruptTrackerStartCounter(10)
end
function InterruptTrackerLockFunc()
InterruptTrackerHeader:Hide();
InterruptTrackerUnlock = false
InterruptTrackerInstaHideAll()
end
function InterruptTrackerSetLayout()
if(InterruptTrackerRotate) then
InterruptTrackerHeader:SetHeight(InterruptTrackerMaxFrames*41+1)
InterruptTrackerHeader:SetWidth(44)
if(numframes > 1) then
for i=2, numframes do
frames[i]:ClearAllPoints()
frames[i]:SetPoint("TOPLEFT", frames[i-1], "BOTTOMLEFT", 0, -5);
end
end
else
InterruptTrackerHeader:SetHeight(44)
InterruptTrackerHeader:SetWidth(InterruptTrackerMaxFrames*41+1)
if(numframes > 1) then
for i=2, numframes do
frames[i]:ClearAllPoints()
frames[i]:SetPoint("TOPLEFT", frames[i-1], "TOPRIGHT", 5, 0);
end
end
end
end
function InterruptTrackerUpdateMaxNum()
if(not inArena and not InterruptTrackerUnlock and InterruptTrackerMaxFrames < numframes) then
for i=InterruptTrackerMaxFrames+1, numframes do
InterruptTrackerHideFrame(frames[i])
end
end
end
function InterruptTrackerSetScale()
for i=1, numframes do
frames[i]:SetScale(InterruptTrackerScale);
end
InterruptTrackerHeader:SetScale(InterruptTrackerScale);
end