8.3.0 > 9.0.1

This commit is contained in:
Tercio Jose
2020-10-16 19:51:44 -03:00
parent 530a825358
commit c42a35657d
223 changed files with 93840 additions and 94757 deletions
+365
View File
@@ -0,0 +1,365 @@
local _detalhes = _G._detalhes
--code from blizzard AlertFrames
function _detalhes:PlayGlow (frame)
frame:Show()
frame.glow:Show()
frame.glow.animIn:Play()
frame.shine:Show()
frame.shine.animIn:Play()
--PlaySound ("LFG_Rewards", "master")
end
--> WatchFrame copy, got removed on WoD
local function DetailsTutorialAlertFrame_OnFinishSlideIn (frame)
frame.ScrollChild.Shine:Show();
frame.ScrollChild.IconShine:Show();
frame.ScrollChild.Shine.Flash:Play();
frame.ScrollChild.IconShine.Flash:Play();
end
local function DetailsTutorialAlertFrame_OnUpdate (frame, timestep)
local animData = frame.animData;
local height = animData.height;
local scrollStart = animData.scrollStart;
local scrollEnd = animData.scrollEnd;
local endTime = animData.slideInTime + (animData.endDelay or 0);
if (frame.startDelay) then
frame.startDelay = frame.startDelay - timestep;
if (frame.startDelay <= 0) then
frame.startDelay = nil;
else
return;
end
end
if (frame.isFirst) then
height = height + 10;
scrollEnd = scrollEnd - 10;
end
frame.totalTime = frame.totalTime+timestep;
if (frame.totalTime > endTime) then
frame.totalTime = endTime;
end
local scrollPos = scrollEnd;
if (animData.slideInTime and animData.slideInTime > 0) then
height = height*(frame.totalTime/animData.slideInTime);
scrollPos = scrollStart + (scrollEnd-scrollStart)*(frame.totalTime/animData.slideInTime);
end
if ( animData.reverse ) then
height = max(animData.height - height, 1);
end
frame:SetHeight(height);
frame:UpdateScrollChildRect();
frame:SetVerticalScroll(floor(scrollPos+0.5));
if (frame.totalTime >= endTime) then
frame:SetScript("OnUpdate", nil);
if ( animData.onFinishFunc ) then
animData.onFinishFunc(frame);
end
end
end
function DetailsTutorialAlertFrame_SlideInFrame (frame, animType)
frame.totalTime = 0;
frame.animData = { height = 72, scrollStart = 65, scrollEnd = -9, slideInTime = 0.4, onFinishFunc = DetailsTutorialAlertFrame_OnFinishSlideIn };
frame.slideInTime = frame.animData.slideInTime;
frame:SetHeight(1);
if ( frame.animData.reverse ) then
frame:SetHeight(frame.animData["height"]);
else
frame:SetHeight(1);
end
frame.startDelay = frame.animData.startDelay;
frame:SetScript("OnUpdate", DetailsTutorialAlertFrame_OnUpdate);
end
function _detalhes.PlayBestDamageOnGuild (damage)
damage = damage or 100000000
--> create the main frame
local DetailsNewDamageRecord = CreateFrame ("frame", "DetailsNewDamageRecordAnimationFrame", UIParent)
DetailsNewDamageRecord:SetPoint ("CENTER", UIParent, "CENTER", 0, -200)
DetailsNewDamageRecord:SetSize (300, 300)
--> single animation group
local MainAnimationGroup = DetailsNewDamageRecord:CreateAnimationGroup ("DetailsNewDamageRecordAnimationGroup")
MainAnimationGroup:SetLooping ("NONE")
--> widgets:
----------------------------------------------
local BaseTexture = DetailsNewDamageRecord:CreateTexture ("BaseTextureTexture", "ARTWORK")
BaseTexture:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-Alert-Background-Mini]])
BaseTexture:SetDrawLayer ("ARTWORK", -5)
BaseTexture:SetPoint ("center", DetailsNewDamageRecord, "center", 0, 0)
BaseTexture:SetSize (256, 64)
BaseTexture:SetVertexColor (0.99999779462814, 0.99999779462814, 0.99999779462814, 0.99999779462814)
--> animations for BaseTexture
BaseTexture.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
BaseTexture.alpha:SetTarget (BaseTexture)
BaseTexture.alpha:SetOrder (1)
BaseTexture.alpha:SetDuration (0.14869952201843)
BaseTexture.alpha:SetStartDelay (0)
BaseTexture.alpha:SetEndDelay (0)
BaseTexture.alpha:SetFromAlpha (0)
BaseTexture.alpha:SetToAlpha (1)
BaseTexture.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
BaseTexture.alpha:SetTarget (BaseTexture)
BaseTexture.alpha:SetOrder (2)
BaseTexture.alpha:SetDuration (1)
BaseTexture.alpha:SetStartDelay (5)
BaseTexture.alpha:SetEndDelay (0)
BaseTexture.alpha:SetFromAlpha (1)
BaseTexture.alpha:SetToAlpha (0)
----------------------------------------------
local BigFlash = DetailsNewDamageRecord:CreateTexture ("BigFlashTexture", "OVERLAY")
BigFlash:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-Alert-Glow]])
BigFlash:SetDrawLayer ("OVERLAY", 0)
BigFlash:SetPoint ("center", DetailsNewDamageRecord, "center", -2, 2)
BigFlash:SetSize (314, 100)
BigFlash:SetDesaturated (false)
BigFlash:SetTexCoord (0.0010000000149012, 0.77400001525879, 0.0010000000149012, 0.65800003051758)
if (0 ~= 0) then
BigFlash:SetRotation (0)
end
BigFlash:SetVertexColor (0.96470373868942, 0.98823314905167, 0.99999779462814, 0.99999779462814)
BigFlash:SetAlpha (1)
BigFlash:SetBlendMode ("ADD")
--> animations for BigFlash
BigFlash.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
BigFlash.alpha:SetTarget (BigFlash)
BigFlash.alpha:SetOrder (1)
BigFlash.alpha:SetDuration (0.11600000411272)
BigFlash.alpha:SetStartDelay (0)
BigFlash.alpha:SetEndDelay (0)
BigFlash.alpha:SetFromAlpha (0)
BigFlash.alpha:SetToAlpha (1)
BigFlash.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
BigFlash.alpha:SetTarget (BigFlash)
BigFlash.alpha:SetOrder (2)
BigFlash.alpha:SetDuration (0.31600001454353)
BigFlash.alpha:SetStartDelay (0)
BigFlash.alpha:SetEndDelay (0)
BigFlash.alpha:SetFromAlpha (1)
BigFlash.alpha:SetToAlpha (0)
----------------------------------------------
local FlashSwipe = DetailsNewDamageRecord:CreateTexture ("FlashSwipeTexture", "OVERLAY")
FlashSwipe:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-Alert-Glow]])
FlashSwipe:SetDrawLayer ("OVERLAY", 7)
FlashSwipe:SetPoint ("center", DetailsNewDamageRecord, "center", -99, 0)
FlashSwipe:SetSize (100, 57)
FlashSwipe:SetDesaturated (false)
FlashSwipe:SetTexCoord (0.78199996948242, 0.91900001525879, 0.0010000000149012, 0.2760000038147)
if (0 ~= 0) then
FlashSwipe:SetRotation (0)
end
FlashSwipe:SetVertexColor (0.86666476726532, 0.54117530584335, 0, 0.99999779462814)
FlashSwipe:SetAlpha (1)
FlashSwipe:SetBlendMode ("ADD")
--> animations for FlashSwipe
FlashSwipe.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
FlashSwipe.alpha:SetTarget (FlashSwipe)
FlashSwipe.alpha:SetOrder (1)
FlashSwipe.alpha:SetDuration (0.31600001454353)
FlashSwipe.alpha:SetStartDelay (0.20000000298023)
FlashSwipe.alpha:SetEndDelay (0)
FlashSwipe.alpha:SetFromAlpha (0)
FlashSwipe.alpha:SetToAlpha (0.501051902771)
FlashSwipe.translation = MainAnimationGroup:CreateAnimation ("TRANSLATION")
FlashSwipe.translation:SetTarget (FlashSwipe)
FlashSwipe.translation:SetOrder (1)
FlashSwipe.translation:SetDuration (0.81599998474121)
FlashSwipe.translation:SetStartDelay (0.20000000298023)
FlashSwipe.translation:SetEndDelay (0)
FlashSwipe.translation:SetOffset (200, 0)
FlashSwipe.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
FlashSwipe.alpha:SetTarget (FlashSwipe)
FlashSwipe.alpha:SetOrder (1)
FlashSwipe.alpha:SetDuration (0.31600001454353)
FlashSwipe.alpha:SetStartDelay (0.69999998807907)
FlashSwipe.alpha:SetEndDelay (0)
FlashSwipe.alpha:SetFromAlpha (0.501051902771)
FlashSwipe.alpha:SetToAlpha (0)
----------------------------------------------
local Portrait = DetailsNewDamageRecord:CreateTexture ("PortraitTexture", "OVERLAY")
Portrait:SetTexture ([[Interface\ARCHEOLOGY\ARCH-FLAREEFFECT]])
Portrait:SetDrawLayer ("OVERLAY", -5)
Portrait:SetPoint ("center", DetailsNewDamageRecord, "center", 3, 0)
Portrait:SetSize (246, 44)
Portrait:SetDesaturated (false)
Portrait:SetTexCoord (0.051753740310669, 0.81701484680176, 0.086334381103516, 0.25102617263794)
if (0 ~= 0) then
Portrait:SetRotation (0)
end
Portrait:SetVertexColor (0.99999779462814, 0.99999779462814, 0.99999779462814, 0.99999779462814)
Portrait:SetAlpha (1)
Portrait:SetBlendMode ("BLEND")
--> animations for Portrait
Portrait.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
Portrait.alpha:SetTarget (Portrait)
Portrait.alpha:SetOrder (1)
Portrait.alpha:SetDuration (0.41600000858307)
Portrait.alpha:SetStartDelay (0)
Portrait.alpha:SetEndDelay (0)
Portrait.alpha:SetFromAlpha (0)
Portrait.alpha:SetToAlpha (1)
Portrait.scale = MainAnimationGroup:CreateAnimation ("SCALE")
Portrait.scale:SetTarget (Portrait)
Portrait.scale:SetOrder (1)
Portrait.scale:SetDuration (0.21600000560284)
Portrait.scale:SetStartDelay (0)
Portrait.scale:SetEndDelay (0)
Portrait.scale:SetFromScale (0, 0)
Portrait.scale:SetToScale (1, 1)
Portrait.scale:SetOrigin ("center", 0, 0)
Portrait.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
Portrait.alpha:SetTarget (Portrait)
Portrait.alpha:SetOrder (2)
Portrait.alpha:SetDuration (1)
Portrait.alpha:SetStartDelay (4.7000002861023)
Portrait.alpha:SetEndDelay (0)
Portrait.alpha:SetFromAlpha (1)
Portrait.alpha:SetToAlpha (0)
----------------------------------------------
local DamageIcon = DetailsNewDamageRecord:CreateTexture ("DamageIconTexture", "OVERLAY")
DamageIcon:SetTexture ([[Interface\LFGFRAME\UI-LFG-ICON-ROLES]])
DamageIcon:SetDrawLayer ("OVERLAY", 2)
DamageIcon:SetPoint ("center", DetailsNewDamageRecord, "center", -97, 1)
DamageIcon:SetSize (32, 32)
DamageIcon:SetDesaturated (false)
DamageIcon:SetTexCoord (0.27200000762939, 0.51899997711182, 0.25837841033936, 0.51399997711182)
if (0 ~= 0) then
DamageIcon:SetRotation (0)
end
DamageIcon:SetVertexColor (0.99999779462814, 0.99999779462814, 0.99999779462814, 0.99999779462814)
DamageIcon:SetAlpha (1)
DamageIcon:SetBlendMode ("BLEND")
--> animations for DamageIcon
DamageIcon.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
DamageIcon.alpha:SetTarget (DamageIcon)
DamageIcon.alpha:SetOrder (1)
DamageIcon.alpha:SetDuration (0.51599997282028)
DamageIcon.alpha:SetStartDelay (0)
DamageIcon.alpha:SetEndDelay (0)
DamageIcon.alpha:SetFromAlpha (0)
DamageIcon.alpha:SetToAlpha (1)
DamageIcon.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
DamageIcon.alpha:SetTarget (DamageIcon)
DamageIcon.alpha:SetOrder (2)
DamageIcon.alpha:SetDuration (1)
DamageIcon.alpha:SetStartDelay (4.5999999046326)
DamageIcon.alpha:SetEndDelay (0)
DamageIcon.alpha:SetFromAlpha (1)
DamageIcon.alpha:SetToAlpha (0)
----------------------------------------------
local NewDamageRecord = DetailsNewDamageRecord:CreateFontString ("NewDamageRecordFontString", "OVERLAY")
NewDamageRecord:SetFont ([=[Fonts\FRIZQT__.TTF]=], 12, "OUTLINE")
NewDamageRecord:SetText ("Damage Record!")
NewDamageRecord:SetDrawLayer ("OVERLAY", 0)
NewDamageRecord:SetPoint ("center", DetailsNewDamageRecord, "center", 18, 7)
NewDamageRecord:SetSize (181, 20)
NewDamageRecord:SetTextColor (1, 1, 1)
NewDamageRecord:SetAlpha (1)
NewDamageRecord:SetJustifyH ("CENTER")
--> animations for NewDamageRecord
NewDamageRecord.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
NewDamageRecord.alpha:SetTarget (NewDamageRecord)
NewDamageRecord.alpha:SetOrder (1)
NewDamageRecord.alpha:SetDuration (0.016000000759959)
NewDamageRecord.alpha:SetStartDelay (0)
NewDamageRecord.alpha:SetEndDelay (0)
NewDamageRecord.alpha:SetFromAlpha (0)
NewDamageRecord.alpha:SetToAlpha (0)
NewDamageRecord.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
NewDamageRecord.alpha:SetTarget (NewDamageRecord)
NewDamageRecord.alpha:SetOrder (2)
NewDamageRecord.alpha:SetDuration (0.51599997282028)
NewDamageRecord.alpha:SetStartDelay (0.40000000596046)
NewDamageRecord.alpha:SetEndDelay (4.0999999046326)
NewDamageRecord.alpha:SetFromAlpha (0)
NewDamageRecord.alpha:SetToAlpha (1)
NewDamageRecord.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
NewDamageRecord.alpha:SetTarget (NewDamageRecord)
NewDamageRecord.alpha:SetOrder (3)
NewDamageRecord.alpha:SetDuration (1)
NewDamageRecord.alpha:SetStartDelay (0.10000000149012)
NewDamageRecord.alpha:SetEndDelay (0)
NewDamageRecord.alpha:SetFromAlpha (1)
NewDamageRecord.alpha:SetToAlpha (0)
----------------------------------------------
local DamageAmount = DetailsNewDamageRecord:CreateFontString ("DamageAmountFontString", "OVERLAY")
DamageAmount:SetFont ([=[Fonts\FRIZQT__.TTF]=], 12, "THICKOUTLINE")
DamageAmount:SetText (_detalhes:comma_value (damage))
DamageAmount:SetDrawLayer ("OVERLAY", 0)
DamageAmount:SetPoint ("center", DetailsNewDamageRecord, "center", 18, -7)
DamageAmount:SetSize (100, 20)
DamageAmount:SetTextColor (1, 1, 1)
DamageAmount:SetAlpha (1)
DamageAmount:SetJustifyH ("CENTER")
--> animations for DamageAmount
DamageAmount.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
DamageAmount.alpha:SetTarget (DamageAmount)
DamageAmount.alpha:SetOrder (1)
DamageAmount.alpha:SetDuration (0.016000000759959)
DamageAmount.alpha:SetStartDelay (0)
DamageAmount.alpha:SetEndDelay (0)
DamageAmount.alpha:SetFromAlpha (0)
DamageAmount.alpha:SetToAlpha (0)
DamageAmount.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
DamageAmount.alpha:SetTarget (DamageAmount)
DamageAmount.alpha:SetOrder (2)
DamageAmount.alpha:SetDuration (0.51599997282028)
DamageAmount.alpha:SetStartDelay (0.40000000596046)
DamageAmount.alpha:SetEndDelay (0)
DamageAmount.alpha:SetFromAlpha (0)
DamageAmount.alpha:SetToAlpha (1)
DamageAmount.alpha = MainAnimationGroup:CreateAnimation ("ALPHA")
DamageAmount.alpha:SetTarget (DamageAmount)
DamageAmount.alpha:SetOrder (3)
DamageAmount.alpha:SetDuration (1.0160000324249)
DamageAmount.alpha:SetStartDelay (4.2000002861023)
DamageAmount.alpha:SetEndDelay (0)
DamageAmount.alpha:SetFromAlpha (1)
DamageAmount.alpha:SetToAlpha (0)
--> test the animation
MainAnimationGroup:Play()
end
+423
View File
@@ -0,0 +1,423 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<!-- code copied from blizzard's AlertFrames -->
<Frame name="DetailsAlert" virtual="true">
<Scripts>
<OnHide function="AlertFrame_FixAnchors"/>
</Scripts>
</Frame>
<Frame name="DetailsAlertRankUpTemplate" virtual="true">
<Size>
<AbsDimension x="296" y="74"/>
</Size>
<Anchors>
<Anchor point="BOTTOM">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Animations>
<AnimationGroup name="$parentAnimIn" parentKey="animIn">
<Alpha change="-1" duration="0" order="1"/>
<Alpha change="1" duration="0.2" order="2"/>
</AnimationGroup>
<AnimationGroup name="$parentWaitAndAnimOut" parentKey="waitAndAnimOut">
<Alpha startDelay="4.05" change="-1" duration="1.5" parentKey="animOut">
<Scripts>
<OnFinished>
self:GetRegionParent():Hide();
</OnFinished>
</Scripts>
</Alpha>
</AnimationGroup>
</Animations>
<Layers>
<Layer level="OVERLAY">
<Texture name="$parentGlow" file="Interface\AchievementFrame\UI-Achievement-Alert-Glow" alphaMode="ADD" hidden="true" parentKey="glow">
<Size>
<AbsDimension x="400" y="171"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset x="0" y="0"/>
</Anchor>
</Anchors>
<Animations>
<AnimationGroup name="$parentAnimIn" parentKey="animIn">
<Alpha change="1" duration="0.2" order="1"/>
<Alpha change="-1" duration="0.5" order="2"/>
<Scripts>
<OnFinished>
self:GetParent():Hide();
</OnFinished>
</Scripts>
</AnimationGroup>
</Animations>
<TexCoords left="0" right="0.78125" top="0" bottom="0.66796875"/>
</Texture>
<Texture name="$parentShine" file="Interface\AchievementFrame\UI-Achievement-Alert-Glow" alphaMode="ADD" hidden="true" parentKey="shine">
<Size>
<AbsDimension x="67" y="72"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset x="-20" y="1"/>
</Anchor>
</Anchors>
<Animations>
<AnimationGroup name="$parentAnimIn" parentKey="animIn">
<Alpha change="1" duration="0.2" order="1"/>
<Translation offsetX="200" offsetY="0" duration="0.85" order="2"/>
<Alpha startDelay="0.35" change="-1" duration="0.5" order="2"/>
<Scripts>
<OnFinished>
self:GetParent():Hide();
</OnFinished>
</Scripts>
</AnimationGroup>
</Animations>
<TexCoords left="0.78125" right="0.912109375" top="0" bottom="0.28125"/>
</Texture>
</Layer>
</Layers>
</Frame>
<!-- WatchFrame copy, got removed on WoD -->
<ScrollFrame name="DetailsTutorialAlertFrameTemplate" enableMouse="true" virtual="true">
<Size x="224" y="72"/>
<Scripts>
<OnLoad>
self:SetHorizontalScroll(-28.5);
</OnLoad>
</Scripts>
<ScrollChild>
<Frame name="$parentScrollChild" parentKey="ScrollChild">
<Size x="190" y="60"/>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentBg" setAllPoints="true">
<Color r="0" g="0" b="0" a="0.5"/>
</Texture>
</Layer>
<Layer level="BORDER">
<Texture name="$parentBorderTopLeft" file="Interface\QuestFrame\AutoQuest-Parts">
<Size x="16" y="16"/>
<TexCoords left="0.02539063" right="0.05664063" top="0.01562500" bottom="0.26562500"/>
<Anchors>
<Anchor point="TOPLEFT" x="-4" y="4" />
</Anchors>
</Texture>
<Texture name="$parentBorderTopRight" file="Interface\QuestFrame\AutoQuest-Parts">
<Size x="16" y="16"/>
<TexCoords left="0.02539063" right="0.05664063" top="0.29687500" bottom="0.54687500"/>
<Anchors>
<Anchor point="TOPRIGHT" x="4" y="4" />
</Anchors>
</Texture>
<Texture name="$parentBorderBotLeft" file="Interface\QuestFrame\AutoQuest-Parts">
<Size x="16" y="16"/>
<TexCoords left="0.02539063" right="0.05664063" top="0.57812500" bottom="0.82812500"/>
<Anchors>
<Anchor point="BOTTOMLEFT" x="-4" y="-4" />
</Anchors>
</Texture>
<Texture name="$parentBorderBotRight" file="Interface\QuestFrame\AutoQuest-Parts">
<Size x="16" y="16"/>
<TexCoords left="0.06054688" right="0.09179688" top="0.01562500" bottom="0.26562500"/>
<Anchors>
<Anchor point="BOTTOMRIGHT" x="4" y="-4"/>
</Anchors>
</Texture>
<Texture name="$parentBorderLeft" file="Interface\QuestFrame\AutoQuestToastBorder-LeftRight" vertTile="true">
<Size x="8" y="16"/>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentBorderTopLeft" relativePoint="BOTTOMLEFT"/>
<Anchor point="BOTTOMLEFT" relativeTo="$parentBorderBotLeft" relativePoint="TOPLEFT"/>
</Anchors>
<TexCoords left="0" right="0.5" top="0" bottom="1"/>
</Texture>
<Texture name="$parentBorderRight" file="Interface\QuestFrame\AutoQuestToastBorder-LeftRight" vertTile="true">
<Size x="8" y="16"/>
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parentBorderTopRight" relativePoint="BOTTOMRIGHT"/>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentBorderBotRight" relativePoint="TOPRIGHT"/>
</Anchors>
<TexCoords left="0.5" right="1" top="0" bottom="1"/>
</Texture>
<Texture name="$parentBorderTop" file="Interface\QuestFrame\AutoQuestToastBorder-TopBot" horizTile="true">
<Size x="16" y="8"/>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentBorderTopLeft" relativePoint="TOPRIGHT"/>
<Anchor point="TOPRIGHT" relativeTo="$parentBorderTopRight" relativePoint="TOPLEFT"/>
</Anchors>
<TexCoords left="0" right="1" top="0" bottom="0.5"/>
</Texture>
<Texture name="$parentBorderBottom" file="Interface\QuestFrame\AutoQuestToastBorder-TopBot" horizTile="true">
<Size x="16" y="8"/>
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parentBorderBotLeft" relativePoint="BOTTOMRIGHT"/>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentBorderBotRight" relativePoint="BOTTOMLEFT"/>
</Anchors>
<TexCoords left="0" right="1" top="0.5" bottom="1"/>
</Texture>
</Layer>
<Layer level="ARTWORK">
<Texture name="$parentQuestIconBg" inherits="QuestIcon-Large">
<Anchors>
<Anchor point="CENTER" relativePoint="LEFT"/>
</Anchors>
</Texture>
</Layer>
<Layer level="ARTWORK" textureSubLevel="1">
<Texture name="$parentExclamation" parentKey="Exclamation" hidden="true" file="Interface\QuestFrame\AutoQuest-Parts">
<Size x="19" y="33"/>
<TexCoords left="0.13476563" right="0.17187500" top="0.01562500" bottom="0.53125000"/>
<Anchors>
<Anchor point="CENTER" relativeTo="$parentQuestIconBg" x="0.5" />
</Anchors>
</Texture>
<Texture name="$parentQuestionMark" parentKey="QuestionMark" hidden="true" file="Interface\QuestFrame\AutoQuest-Parts">
<Size x="19" y="33"/>
<TexCoords left="0.17578125" right="0.21289063" top="0.01562500" bottom="0.53125000"/>
<Anchors>
<Anchor point="CENTER" relativeTo="$parentQuestIconBg" x="0.5" />
</Anchors>
</Texture>
</Layer>
<Layer level="BORDER">
<FontString name="$parentQuestName" inherits="QuestFont_Large" parentKey="QuestName">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentQuestIconBg" relativePoint="RIGHT" x="-6"/>
<Anchor point="RIGHT" x="-8"/>
<Anchor point="TOP" x="0" y="-24"/>
</Anchors>
<Color r="1" g="1" b="1"/>
</FontString>
<FontString name="$parentTopText" inherits="GameFontNormalSmall" parentKey="TopText">
<Anchors>
<Anchor point="TOP" x="0" y="-4"/>
<Anchor point="LEFT" relativeTo="$parentQuestIconBg" relativePoint="RIGHT" x="-6"/>
<Anchor point="RIGHT" x="-8"/>
</Anchors>
</FontString>
<FontString name="$parentBottomText" inherits="GameFontDisableSmall" parentKey="BottomText">
<Anchors>
<Anchor point="BOTTOM" x="0" y="4"/>
<Anchor point="LEFT" relativeTo="$parentQuestIconBg" relativePoint="RIGHT" x="-6"/>
<Anchor point="RIGHT" x="-8"/>
</Anchors>
</FontString>
</Layer>
<Layer level="BORDER" textureSubLevel="1">
<Texture name="$parentShine" alphaMode="ADD" alpha="0" hidden="true" parentKey="Shine">
<Animations>
<AnimationGroup name="$parentFlash" parentKey="Flash">
<Alpha startDelay="0" change="0.4" duration="0.25" order="1"/>
<Alpha startDelay="0.05" change="-0.4" duration="0.25" order="2"/>
<Scripts>
<OnStop>
self:GetParent():Hide();
</OnStop>
<OnFinished>
self:GetParent():Hide();
</OnFinished>
</Scripts>
</AnimationGroup>
</Animations>
<Anchors>
<Anchor point="TOPLEFT" x="-1" y="1"/>
<Anchor point="BOTTOMRIGHT" x="1" y="-1"/>
</Anchors>
<Color r="1" g="1" b="1"/>
</Texture>
</Layer>
<Layer level="OVERLAY">
<Texture name="$parentIconShine" alphaMode="ADD" alpha="0" hidden="true" parentKey="IconShine" file="Interface\QuestFrame\AutoQuest-Parts">
<Size x="42" y="42"/>
<TexCoords left="0.21679688" right="0.29882813" top="0.01562500" bottom="0.67187500"/>
<Anchors>
<Anchor point="CENTER" relativeTo="$parentQuestIconBg"/>
</Anchors>
<Animations>
<AnimationGroup name="$parentFlash" parentKey="Flash">
<Alpha change="0.9" duration="0.25" order="1"/>
<Alpha startDelay="0.05" change="-0.9" duration="0.25" order="2"/>
<Scripts>
<OnStop>
self:GetParent():Hide();
</OnStop>
<OnFinished>
self:GetParent():Hide();
--if (self:GetParent():GetParent():GetParent().type=="COMPLETED") then
--self:GetParent():GetParent().Flash:Show();
--end
</OnFinished>
</Scripts>
</AnimationGroup>
</Animations>
</Texture>
</Layer>
</Layers>
<Frames>
<Frame name="$parentFlash" useParentLevel="true" setAllPoints="true" hidden="true" parentKey="Flash">
<Layers>
<Layer level="BORDER">
<Texture name="QuestLogFrameCompleteButtonFlash" inherits="UIPanelButtonHighlightTexture" parentKey="Flash">
<Size x="180" y="28"/>
<Anchors>
<Anchor point="TOPLEFT" x="14" y="-2"/>
</Anchors>
</Texture>
</Layer>
<Layer level="OVERLAY">
<Texture name="$parentIconFlash" alphaMode="ADD" alpha="0.5" parentKey="IconFlash" file="Interface\QuestFrame\AutoQuest-Parts">
<Size x="42" y="42"/>
<TexCoords left="0.21679688" right="0.29882813" top="0.01562500" bottom="0.67187500"/>
<Anchors>
<Anchor point="CENTER" relativePoint="LEFT"/>
</Anchors>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
self.IconFlash:SetVertexColor(1, 0, 0);
</OnLoad>
<OnShow>
UIFrameFlash(self, 0.75, 0.75, -1, nil);
</OnShow>
<OnHide>
UIFrameFlashStop(self);
</OnHide>
</Scripts>
</Frame>
</Frames>
</Frame>
</ScrollChild>
</ScrollFrame>
<Frame name="DetailsBoxAlertTemplateUp" inherits="GlowBoxTemplate" hidden="false" frameStrata="FULLSCREEN" virtual="true">
<Layers>
<Layer level="OVERLAY">
<FontString name="$parentText" parentKey="text" inherits="GameFontHighlightLeft" justifyV="TOP" text="">
<Size x="280" y="0"/>
<Anchors>
<Anchor point="TOPLEFT" x="16" y="-15"/>
</Anchors>
</FontString>
</Layer>
</Layers>
<Size x="300" y="150"/>
<Frames>
<Frame name="$parentArrow" parentKey="arrow" inherits="GlowBoxArrowTemplate">
<Anchors>
<Anchor point="TOP" relativePoint="BOTTOM" x="40" y="1"/>
</Anchors>
</Frame>
</Frames>
</Frame>
<!-- raw copy of blizzard ui -->
<Frame name="DetailsHelpBoxTemplate" inherits="GlowBoxTemplate" parent="UIParent" hidden="true" frameStrata="FULLSCREEN_DIALOG" frameLevel="2" virtual="true">
<Size x="220" y="100"/>
<Layers>
<Layer level="OVERLAY">
<FontString parentKey="Text" inherits="GameFontHighlightLeft">
<Size x="200" y="0"/>
<Anchors>
<Anchor point="TOPLEFT" x="15" y="-15"/>
</Anchors>
</FontString>
</Layer>
<Layer level="ARTWORK">
<Texture parentKey="ArrowUP" inherits="HelpPlateArrowDOWN" hidden="true">
<Size x="53" y="21"/>
<Anchors>
<Anchor point="TOP" relativePoint="BOTTOM" x="0" y="3"/>
</Anchors>
</Texture>
<Texture parentKey="ArrowDOWN" inherits="HelpPlateArrowUP" hidden="true">
<Size x="53" y="21"/>
<Anchors>
<Anchor point="BOTTOM" relativePoint="TOP" x="0" y="-3"/>
</Anchors>
</Texture>
<Texture parentKey="ArrowRIGHT" inherits="HelpPlateArrowDOWN" hidden="true">
<Size x="53" y="21"/>
<Anchors>
<Anchor point="RIGHT" relativePoint="LEFT" x="3" y="0"/>
</Anchors>
</Texture>
<Texture parentKey="ArrowLEFT" inherits="HelpPlateArrowDOWN" hidden="true">
<Size x="53" y="21"/>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT" x="-3" y="0"/>
</Anchors>
</Texture>
</Layer>
<Layer level="BORDER">
<Texture parentKey="ArrowGlowUP" inherits="HelpPlateArrow-GlowDOWN" hidden="true" alphaMode="ADD" alpha="0.5">
<Size x="53" y="21"/>
<Anchors>
<Anchor point="TOP" relativePoint="BOTTOM" x="0" y="3"/>
</Anchors>
</Texture>
<Texture parentKey="ArrowGlowDOWN" inherits="HelpPlateArrow-GlowUP" hidden="true" alphaMode="ADD" alpha="0.5">
<Size x="53" y="21"/>
<Anchors>
<Anchor point="BOTTOM" relativePoint="TOP" x="0" y="-3"/>
</Anchors>
</Texture>
<Texture parentKey="ArrowGlowRIGHT" inherits="HelpPlateArrow-GlowDOWN" hidden="true" alphaMode="ADD" alpha="0.5">
<Size x="53" y="21"/>
<Anchors>
<Anchor point="RIGHT" relativePoint="LEFT" x="3" y="0"/>
</Anchors>
</Texture>
<Texture parentKey="ArrowGlowLEFT" inherits="HelpPlateArrow-GlowDOWN" hidden="true" alphaMode="ADD" alpha="0.5">
<Size x="53" y="21"/>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT" x="-3" y="0"/>
</Anchors>
</Texture>
</Layer>
</Layers>
<Frames>
<Button name="$parentCloseButton" inherits="UIPanelCloseButton">
<Size x="20" y="20"/>
<Anchors>
<Anchor point="TOPRIGHT" relativePoint="TOPRIGHT" x="3" y="3"/>
</Anchors>
</Button>
</Frames>
<Scripts>
<OnLoad>
self.Text:SetSpacing(4);
SetClampedTextureRotation(self.ArrowLEFT, 270);
SetClampedTextureRotation(self.ArrowRIGHT, 90);
SetClampedTextureRotation(self.ArrowGlowLEFT, 270);
SetClampedTextureRotation(self.ArrowGlowRIGHT, 90);
</OnLoad>
<OnShow>
self:SetHeight(self.Text:GetHeight()+30);
</OnShow>
</Scripts>
</Frame>
</Ui>
+716
View File
@@ -0,0 +1,716 @@
local cstr = tostring
local _string_len = string.len
local ceil = math.ceil
local math_floor = math.floor
local CreateFrame = CreateFrame
local GetTime = GetTime
local GetCursorPosition = GetCursorPosition
local GameTooltip = GameTooltip
local _select = select
local _detalhes = _G._detalhes
local gump = _detalhes.gump
function gump:NewLabel2 (parent, container, member, text, font, size, color)
font = font or "GameFontHighlightSmall"
local newFontString = parent:CreateFontString (nil, "OVERLAY", font)
if (member) then
container [member] = newFontString
end
newFontString:SetText (text)
if (size) then
_detalhes:SetFontSize (newFontString, size)
end
if (color) then
newFontString:SetTextColor (unpack (color))
end
newFontString:SetJustifyH ("LEFT")
return newFontString
end
function gump:NewDetailsButton (parent, container, instancia, func, param1, param2, w, h, pic_up, pic_down, pic_disabled, pic_highlight, options, FrameName, inherits, ischeck)
if (not parent) then
return nil
end
w = w or 16
h = h or 16
options = options or {}
local new_button
if (ischeck) then
new_button = CreateFrame ("CheckButton", FrameName, parent, inherits)
else
new_button = CreateFrame ("Button", FrameName, parent)
end
new_button:SetWidth (w)
new_button:SetHeight (h)
if (not pic_down and pic_up) then
pic_down = pic_up
end
if (not pic_disabled and pic_up) then
pic_disabled = pic_up
end
if (not pic_highlight and pic_up) then
pic_highlight = pic_up
end
new_button:SetNormalTexture (pic_up)
new_button:SetPushedTexture (pic_down)
new_button:SetDisabledTexture (pic_disabled)
new_button:SetHighlightTexture (pic_highlight, "ADD")
local new_text = new_button:CreateFontString (nil, "OVERLAY", "GameFontNormal")
new_text:SetPoint ("center", new_button, "center")
new_button.text = new_text
new_button.supportFrame = CreateFrame ("frame", nil, new_button)
new_button.supportFrame:SetPoint ("topleft", new_button, "topleft")
new_button.supportFrame:SetPoint ("bottomright", new_button, "bottomright")
new_button.supportFrame:SetFrameLevel (new_button:GetFrameLevel()+1)
new_button.supportFrame.disable_overlay = new_button.supportFrame:CreateTexture (nil, "overlay")
new_button.supportFrame.disable_overlay:SetTexture ("Interface\\AddOns\\Details\\images\\button_disable_overlay")
new_button.supportFrame.disable_overlay:SetPoint ("topleft", new_button.supportFrame, "topleft")
new_button.supportFrame.disable_overlay:SetPoint ("bottomright", new_button.supportFrame, "bottomright")
new_button.supportFrame.disable_overlay:Hide()
local rightFunction = options.rightFunc
new_button:SetScript ("OnDisable", function()
new_button.supportFrame.disable_overlay:Show()
end)
new_button:SetScript ("OnEnable", function()
new_button.supportFrame.disable_overlay:Hide()
end)
new_button.funcParam1 = param1
new_button.funcParam2 = param2
new_button.options = options
function new_button:ChangeOptions (_table)
options = _table
rightFunction = options.rightFunc
end
new_button.enter = false
new_button:SetScript ("OnMouseDown", function(self, button)
if (not self:IsEnabled()) then
return
end
self.mouse_down = GetTime()
local x, y = GetCursorPosition()
self.x = math_floor (x)
self.y = math_floor (y)
if (container) then
if (container:IsMovable() and not container.isLocked) then
container:StartMoving()
container.isMoving = true
end
end
if (new_button.texture) then
new_button.texture:SetTexCoord (0, 1, 0.5, 0.74609375)
end
if (options.OnGrab and options.OnGrab == "PassClick") then
if (rightFunction) then
if (button == "LeftButton") then
func (new_button.funcParam1, new_button.funcParam2)
else
rightFunction.func (rightFunction.param1, rightFunction.param2)
end
else
func (new_button.funcParam1, new_button.funcParam2)
end
end
end)
new_button:SetScript ("OnMouseUp", function (self, button)
if (not self:IsEnabled()) then
return
end
if (container) then
if (container.isMoving) then
container:StopMovingOrSizing()
container.isMoving = false
if (instancia) then
instancia:SaveMainWindowPosition()
end
end
end
if (new_button.texture) then
if (new_button.enter) then
new_button.texture:SetTexCoord (0, 1, 0.25, 0.49609375)
else
new_button.texture:SetTexCoord (0, 1, 0, 0.24609375)
end
end
local x, y = GetCursorPosition()
x = math_floor (x)
y = math_floor (y)
if ((self.mouse_down+0.4 > GetTime() and (x == self.x and y == self.y)) or (x == self.x and y == self.y)) then
if (rightFunction) then
if (button == "LeftButton") then
func (new_button.funcParam1, new_button.funcParam2)
else
rightFunction.func (rightFunction.param1, rightFunction.param2)
end
else
func (new_button.funcParam1, new_button.funcParam2)
end
end
end)
new_button.tooltip = nil
new_button:SetScript ("OnEnter", function()
new_button.enter = true
if (new_button.tooltip) then
GameCooltip:Reset()
GameCooltip:SetType ("tooltip")
GameCooltip:SetColor ("main", "transparent")
GameCooltip:AddLine (new_button.tooltip)
GameCooltip:SetOwner (new_button)
GameCooltip:ShowCooltip()
end
if (new_button.texture) then
new_button.texture:SetTexCoord (0, 1, 0.25+(0.0078125/2), 0.5+(0.0078125/2))
end
if (new_button.MouseOnEnterHook) then
new_button.MouseOnEnterHook (new_button)
end
end)
new_button:SetScript ("OnLeave", function()
new_button.enter = false
if (new_button.tooltip) then
_detalhes.popup:ShowMe (false)
end
if (new_button.texture) then
new_button.texture:SetTexCoord (0, 1, 0, 0.24609375)
end
if (new_button.MouseOnLeaveHook) then
new_button.MouseOnLeaveHook (new_button)
end
end)
function new_button:ChangeIcon (icon1, icon2, icon3, icon4)
new_button:SetNormalTexture (icon1)
new_button:SetPushedTexture (icon2)
new_button:SetDisabledTexture (icon3)
new_button:SetHighlightTexture (icon4, "ADD")
end
function new_button:InstallCustomTexture (texture, rect)
new_button:SetNormalTexture(nil)
new_button:SetPushedTexture(nil)
new_button:SetDisabledTexture(nil)
new_button:SetHighlightTexture(nil)
texture = texture or "Interface\\AddOns\\Details\\images\\default_button"
new_button.texture = new_button:CreateTexture (nil, "background")
if (not rect) then
new_button.texture:SetAllPoints (new_button)
else
new_button.texture:SetPoint ("topleft", new_button, "topleft", rect.x1, rect.y1)
new_button.texture:SetPoint ("bottomright", new_button, "bottomright", rect.x2, rect.y2)
end
new_button.texture:SetTexCoord (0, 1, 0, 0.24609375)
new_button.texture:SetTexture (texture)
end
new_button.textColor = {}
new_button.textColor.r, new_button.textColor.g, new_button.textColor.b = new_button.text:GetTextColor()
return new_button
end
local EditBoxBackdrop = {
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\ChatFrame\\ChatFrameBackground",
tile = true, edgeSize = 1, tileSize = 5,
}
function gump:NewTextBox (parent, container, member, func, param1, param2, w, h, options)
local editbox = CreateFrame ("EditBox", "DetailsEditBox1", parent)
container [member] = editbox
options = options or {}
editbox:SetAutoFocus (false)
editbox:SetFontObject (GameFontHighlightSmall)
editbox:SetWidth (w)
editbox:SetHeight (h)
editbox:SetJustifyH("CENTER")
editbox:EnableMouse (true)
editbox:SetBackdrop (EditBoxBackdrop)
editbox:SetBackdropColor (0, 0, 0, 0.5)
editbox:SetBackdropBorderColor (0.3, 0.3, 0.30, 0.80)
editbox:SetText ("") --localize-me
editbox.perdeu_foco = nil
editbox.text = ""
editbox.next = options.next
editbox.tooltip = options.tooltip
editbox.tab_on_enter = options.TabOnEnterPress
editbox.space = options.MySpace
gump:NewLabel (editbox, editbox, nil, "label", "", "GameFontHighlightSmall")
editbox ["label"]: SetPoint ("right", editbox, "left", -2, 0)
editbox.label:SetTextColor (.8, .8, .8, 1)
function editbox:SetPointAndSpace (MyAnchor, SnapTo, HisAnchor, x, y, Width)
if (type (MyAnchor) == "boolean" and MyAnchor and editbox.space) then
local textWidth = editbox ["label"]:GetStringWidth()+2
editbox:SetWidth (editbox.space - textWidth - 15)
return
elseif (not editbox.space and not Width) then
return
elseif (Width) then
editbox.space = Width
end
if (editbox.space) then
editbox ["label"]:ClearAllPoints()
editbox:ClearAllPoints()
editbox ["label"]:SetPoint (MyAnchor, SnapTo, HisAnchor, x, y)
editbox:SetPoint ("left", editbox["label"].widget, "right", 2, 0)
local textWidth = editbox ["label"]:GetStringWidth()+2
editbox:SetWidth (editbox.space - textWidth - 15)
end
end
function editbox:SetLabelText (text)
if (text) then
editbox ["label"]:SetText (text)
else
editbox ["label"]:SetText ("")
end
if (editbox.space) then
editbox:SetPointAndSpace (true) --> refresh
end
end
local EnterPress = function (byScript)
if (editbox.EnterHook) then
editbox.EnterHook()
end
local texto = _detalhes:trim (editbox:GetText())
if (_string_len (texto) > 0) then
editbox.text = texto
if (func) then
func (param1, param2, texto, editbox, byScript)
end
else
editbox:SetText ("")
editbox.text = ""
end
editbox.perdeu_foco = true --> isso aqui pra quando estiver editando e clicar em outra caixa
editbox:ClearFocus()
if (editbox.tab_on_enter and editbox.next) then
editbox.next:SetFocus()
end
end
function editbox:PressEnter (byScript)
EnterPress (byScript)
end
editbox:SetScript ("OnEnterPressed", EnterPress)
editbox:SetScript ("OnEscapePressed", function()
editbox:SetText("")
editbox.text = ""
editbox.perdeu_foco = true
editbox:ClearFocus()
if (editbox.OnEscapeHook) then
editbox.OnEscapeHook()
end
end)
editbox:SetScript ("OnEnter", function()
editbox.mouse_over = true
if (editbox:IsEnabled()) then
editbox:SetBackdropBorderColor (0.5, 0.5, 0.5, 1)
end
if (editbox.tooltip) then
GameCooltip:Reset()
GameCooltip:SetType ("tooltip")
GameCooltip:SetColor ("main", "transparent")
GameCooltip:AddLine (editbox.tooltip)
GameCooltip:SetOwner (editbox)
GameCooltip:ShowCooltip()
end
if (editbox.OnEnterHook) then
editbox:OnEnterHook()
end
end)
editbox:SetScript ("OnLeave", function()
editbox.mouse_over = false
if (editbox:IsEnabled()) then
editbox:SetBackdropBorderColor(0.3, 0.3, 0.3, 0.8)
end
if (not editbox:HasFocus()) then
--if (editbox:GetText() == "") then
-- editbox:SetText("insira o nome do buff")
--end
end
if (editbox.tooltip) then
if (not editbox.HaveMenu) then
_detalhes.popup:ShowMe (false)
end
end
if (editbox.OnLeaveHook) then
editbox:OnLeaveHook()
end
end)
editbox:SetScript ("OnEditFocusGained", function()
if (editbox.label) then
editbox.label:SetTextColor (1, 1, 1, 1)
end
if (editbox.OnFocusGainedHook) then
editbox.OnFocusGainedHook()
end
end)
editbox:SetScript ("OnEditFocusLost", function()
if (editbox:IsShown()) then
if (editbox.perdeu_foco == nil) then
local texto = _detalhes:trim (editbox:GetText())
if (_string_len (texto) > 0) then
editbox.text = texto
if (func) then
func (param1, param2, texto, editbox, nil)
end
else
editbox:SetText ("")
end
else
editbox.perdeu_foco = nil
end
if (editbox.label) then
editbox.label:SetTextColor (.8, .8, .8, 1)
end
if (editbox.OnFocusLostHook) then
editbox.OnFocusLostHook()
end
end
end)
editbox:SetScript ("OnChar", function (self, text)
if (editbox.InputHook) then
editbox:InputHook (text)
end
end)
editbox:SetScript ("OnTextChanged", function (self, userChanged)
if (editbox.TextChangeedHook and userChanged) then
editbox:TextChangeedHook (userChanged)
end
end)
editbox:SetScript ("OnTabPressed", function()
if (editbox.next) then
EnterPress()
editbox.next:SetFocus()
end
end)
editbox.SetNext = function (_, NextBox)
if (NextBox) then
editbox.next = NextBox
end
end
editbox.SetLabel = function (_, Label)
if (Label) then
editbox.label = Label
editbox.label:SetTextColor (.8, .8, .8, 1)
end
end
function editbox:Blink()
editbox.label:SetTextColor (1, .2, .2, 1)
end
if (options.Label) then
editbox:SetLabel (options.Label)
end
options = nil
return editbox
end
function gump:NewScrollBar2 (master, slave, x, y)
local slider_gump = CreateFrame ("Slider", master:GetName() and master:GetName() .. "SliderGump" or "DetailsSliderGump" .. math.random (1, 10000000), master)
slider_gump.scrollMax = 560 --default - tamanho da janela de fundo
-- ///// SLIDER /////
slider_gump:SetPoint ("TOPLEFT", master, "TOPRIGHT", x, y)
slider_gump.ativo = true
slider_gump.bg = slider_gump:CreateTexture (nil, "BACKGROUND")
slider_gump.bg:SetAllPoints (true)
slider_gump.bg:SetTexture (0, 0, 0, 0)
--coisinha do meio
slider_gump.thumb = slider_gump:CreateTexture (nil, "OVERLAY")
slider_gump.thumb:SetTexture ("Interface\\Buttons\\UI-ScrollBar-Knob")
slider_gump.thumb:SetSize (29, 30)
slider_gump:SetThumbTexture (slider_gump.thumb)
slider_gump:SetOrientation ("VERTICAL")
slider_gump:SetSize(16, 100)
slider_gump:SetMinMaxValues(0, slider_gump.scrollMax)
slider_gump:SetValue(0)
slider_gump.ultimo = 0
local botao_cima = CreateFrame ("Button", slider_gump:GetName() .. "UpButton", master)
botao_cima:SetWidth (29)
botao_cima:SetHeight (32)
botao_cima:SetNormalTexture ([[Interface\Buttons\Arrow-Up-Up]])
botao_cima:SetPushedTexture ([[Interface\Buttons\Arrow-Up-Down]])
botao_cima:SetDisabledTexture ([[Interface\Buttons\Arrow-Up-Disabled]])
botao_cima:Show()
botao_cima:Disable()
botao_cima:SetPoint ("BOTTOM", slider_gump, "TOP", 0, -12)
botao_cima.x = 0
botao_cima.y = -12
local botao_baixo = CreateFrame ("Button", slider_gump:GetName() .. "DownButton", master)
botao_baixo:SetPoint ("TOP", slider_gump, "BOTTOM", 0, 12)
botao_baixo.x = 0
botao_baixo.y = 12
botao_baixo:SetWidth (29)
botao_baixo:SetHeight (32)
botao_baixo:SetNormalTexture ([[Interface\Buttons\Arrow-Down-Up]])
botao_baixo:SetPushedTexture ([[Interface\Buttons\Arrow-Down-Down]])
botao_baixo:SetDisabledTexture ([[Interface\Buttons\Arrow-Down-Disabled]])
botao_baixo:Show()
botao_baixo:Disable()
master.baixo = botao_baixo
master.cima = botao_cima
master.slider = slider_gump
botao_baixo:SetScript ("OnMouseDown", function(self)
if (not slider_gump:IsEnabled()) then
return
end
local current = slider_gump:GetValue()
local minValue, maxValue = slider_gump:GetMinMaxValues()
if (current+5 < maxValue) then
slider_gump:SetValue (current+5)
else
slider_gump:SetValue (maxValue)
end
self.precionado = true
self.last_up = -0.3
self:SetScript ("OnUpdate", function(self, elapsed)
self.last_up = self.last_up + elapsed
if (self.last_up > 0.03) then
self.last_up = 0
local current = slider_gump:GetValue()
local minValue, maxValue = slider_gump:GetMinMaxValues()
if (current+2 < maxValue) then
slider_gump:SetValue (current+2)
else
slider_gump:SetValue (maxValue)
end
end
end)
end)
botao_baixo:SetScript ("OnMouseUp", function(self)
self.precionado = false
self:SetScript ("OnUpdate", nil)
end)
botao_cima:SetScript ("OnMouseDown", function(self)
if (not slider_gump:IsEnabled()) then
return
end
local current = slider_gump:GetValue()
if (current-5 > 0) then
slider_gump:SetValue (current-5)
else
slider_gump:SetValue (0)
end
self.precionado = true
self.last_up = -0.3
self:SetScript ("OnUpdate", function(self, elapsed)
self.last_up = self.last_up + elapsed
if (self.last_up > 0.03) then
self.last_up = 0
local current = slider_gump:GetValue()
if (current-2 > 0) then
slider_gump:SetValue (current-2)
else
slider_gump:SetValue (0)
end
end
end)
end)
botao_cima:SetScript ("OnMouseUp", function(self)
self.precionado = false
self:SetScript ("OnUpdate", nil)
end)
--> isso aqui pra quando o slider ativar, o scroll fica na posio zero
botao_cima:SetScript ("OnEnable", function (self)
local current = slider_gump:GetValue()
if (current == 0) then
botao_cima:Disable()
end
end)
slider_gump:SetScript ("OnValueChanged", function (self)
local current = self:GetValue()
master:SetVerticalScroll (current)
local minValue, maxValue = slider_gump:GetMinMaxValues()
if (current == minValue) then
botao_cima:Disable()
elseif (not botao_cima:IsEnabled()) then
botao_cima:Enable()
end
if (current == maxValue) then
botao_baixo:Disable()
elseif (not botao_baixo:IsEnabled()) then
botao_baixo:Enable()
end
end)
slider_gump:SetScript ("OnShow", function (self)
botao_cima:Show()
botao_baixo:Show()
end)
slider_gump:SetScript ("OnDisable", function (self)
botao_cima:Disable()
botao_baixo:Disable()
end)
slider_gump:SetScript ("OnEnable", function (self)
botao_cima:Enable()
botao_baixo:Enable()
end)
master:SetScript ("OnMouseWheel", function (self, delta)
if (not slider_gump:IsEnabled()) then
return
end
local current = slider_gump:GetValue()
if (delta < 0) then
--baixo
local minValue, maxValue = slider_gump:GetMinMaxValues()
if (current + (master.wheel_jump or 20) < maxValue) then
slider_gump:SetValue (current + (master.wheel_jump or 20))
else
slider_gump:SetValue (maxValue)
end
elseif (delta > 0) then
--cima
if (current + (master.wheel_jump or 20) > 0) then
slider_gump:SetValue (current - (master.wheel_jump or 20))
else
slider_gump:SetValue (0)
end
end
end)
function slider_gump:Altura (h)
self:SetHeight (h)
end
function slider_gump:Update (desativar)
if (desativar) then
slider_gump:Disable()
slider_gump:SetValue(0)
slider_gump.ativo = false
master:EnableMouseWheel (false)
return
end
self.scrollMax = slave:GetHeight()-master:GetHeight()
if (self.scrollMax > 0) then
slider_gump:SetMinMaxValues (0, self.scrollMax)
if (not slider_gump.ativo) then
slider_gump:Enable()
slider_gump.ativo = true
master:EnableMouseWheel (true)
end
else
slider_gump:Disable()
slider_gump:SetValue(0)
slider_gump.ativo = false
master:EnableMouseWheel (false)
end
end
function slider_gump:cimaPoint (x, y)
botao_cima:SetPoint ("BOTTOM", slider_gump, "TOP", x, (y)-12)
end
function slider_gump:baixoPoint (x, y)
botao_baixo:SetPoint ("TOP", slider_gump, "BOTTOM", x, (y)+12)
end
return slider_gump
end
+40
View File
@@ -0,0 +1,40 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
<Frame name="DetailsToolbarButton" virtual="true" hidden="true">
<Size>
<AbsDimension x="14" y="14"/>
</Size>
<Scripts>
<OnEnter>
DetailsToolbarButtonOnEnter (self);
</OnEnter>
<OnLeave>
DetailsToolbarButtonOnLeave (self);
</OnLeave>
</Scripts>
<Layers>
<Layer level="BORDER">
<Texture name="$parentStar" parentKey="Star" file="interface\cooldown\star4" alphaMode="ADD" alpha="0">
<Size x="40" y="40"/>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Color r="0.985" g="0.111" b="0.125"/>
</Texture>
</Layer>
</Layers>
<Animations>
<AnimationGroup parentKey="StarAnim">
<Rotation targetKey="$parent.$parent.Star" degrees="-90" duration="0.9" order="1"/>
<Alpha targetKey="$parent.$parent.Star" change="0.50" duration="0.3667" order="1"/>
<Alpha targetKey="$parent.$parent.Star" change="-0.50" duration="0.5333" order="2"/>
</AnimationGroup>
</Animations>
</Frame>
</Ui>
+349
View File
@@ -0,0 +1,349 @@
local Details = Details
local DetailsFramework = _G.DetailsFramework
local GameCooltip2 = GameCooltip2
function Details:CreateAPI2Frame()
if (not _G.DetailsAPI2Frame or not _G.DetailsAPI2Frame.Initialized) then
--menu settings
_G.DetailsAPI2Frame.Initialized = true
local panelWidth = 800
local panelHeight = 610
local scrollWidth = 200
local scrollHeight = 570
local lineHeight = 20
local lineAmount = 27
local backdropColor = {.2, .2, .2, 0.2}
local backdropColorOnEnter = {.8, .8, .8, 0.4}
local backdropColorSelected = {1, 1, .8, 0.4}
local yStart = -30
local xAnchorPoint = 250
local parametersAmount = 10
local returnAmount = 10
--local Api2Frame = DetailsFramework:CreateSimplePanel (UIParent, panelWidth, panelHeight, "Details! API 2.0", "DetailsAPI2Frame")
local Api2Frame = _G.DetailsAPI2Frame
Api2Frame:SetFrameStrata ("FULLSCREEN")
Api2Frame:SetPoint ("center")
DetailsFramework:ApplyStandardBackdrop (Api2Frame, false, 1.2)
--store
local apiFunctionNames = {}
local parametersLines = {}
local returnLines = {}
local currentSelected = 1
local api = Details.API_Description.namespaces[1].api
--on select api on the menu
local onSelectAPI = function (self)
local apiName = apiFunctionNames [self.index]
if (not apiName) then
Details:Msg ("API name not found:", apiName)
return
end
--fill the box in the right with information about the API
local apiInfo = api [self.index]
if (not apiInfo) then
Details:Msg ("API information for api not found", apiName)
return
end
currentSelected = self.index
--update name and desc
Api2Frame.ApiFunctionName.text = apiName
Api2Frame.ApiFunctionDesc.text = apiInfo.desc
--update the copy line text box
local parameters = ""
for parameterIndex, parameterInfo in ipairs (apiInfo.parameters) do
if (parameterInfo.required) then
parameters = parameters .. parameterInfo.name .. ", "
end
end
parameters = parameters:gsub (", $", "")
local returnValues = "local "
for returnIndex, returnInfo in ipairs (apiInfo.returnValues) do
returnValues = returnValues .. returnInfo.name .. ", "
end
returnValues = returnValues:gsub (", $", "")
returnValues = returnValues .. " = "
if (parameters ~= "") then
Api2Frame.ApiCopy.text = returnValues .. "Details." .. apiName .. "( " .. parameters .. " )"
else
Api2Frame.ApiCopy.text = returnValues .. "Details." .. apiName .. "()"
end
Api2Frame.ApiCopy:SetFocus (true)
Api2Frame.ApiCopy:HighlightText()
--parameters
for i = 1, #parametersLines do
local parameterLine = parametersLines [i]
local parameterInfo = apiInfo.parameters [i]
if (parameterInfo) then
parameterLine:Show()
parameterLine.index = i
parameterLine.name.text = parameterInfo.name
parameterLine.typeData.text = parameterInfo.type
parameterLine.required.text = parameterInfo.required and "yes" or "no"
parameterLine.default.text = parameterInfo.default or ""
else
parameterLine:Hide()
end
end
--return values
for i = 1, #returnLines do
local returnLine = returnLines [i]
local returnInfo = apiInfo.returnValues [i]
if (returnInfo) then
returnLine:Show()
returnLine.index = i
returnLine.name.text = returnInfo.name
returnLine.typeData.text = returnInfo.type
returnLine.desc.text = returnInfo.desc
else
returnLine:Hide()
end
end
--refresh the scroll box
Api2Frame.scrollMenu:Refresh()
end
--menu scroll
local apiMenuScrollRefresh = function (self, data, offset, total_lines)
for i = 1, total_lines do
local index = i + offset
local apiName = data [index]
if (apiName) then
local line = self:GetLine (i)
line.text:SetText (apiName)
line.index = index
if (currentSelected == index) then
line:SetBackdropColor (unpack (backdropColorSelected))
else
line:SetBackdropColor (unpack (backdropColor))
end
end
end
end
for apiIndex, apiDesc in ipairs (api) do
tinsert (apiFunctionNames, apiDesc.name)
end
local api2ScrollMenu = DetailsFramework:CreateScrollBox (Api2Frame, "$parentApi2MenuScroll", apiMenuScrollRefresh, apiFunctionNames, scrollWidth, scrollHeight, lineAmount, lineHeight)
DetailsFramework:ReskinSlider (api2ScrollMenu)
api2ScrollMenu:SetPoint ("topleft", Api2Frame, "topleft", 10, yStart)
Api2Frame.scrollMenu = api2ScrollMenu
local lineOnEnter = function (self)
self:SetBackdropColor (unpack (backdropColorOnEnter))
local apiName = apiFunctionNames [self.index]
if (not apiName) then
return
end
--fill the box in the right with information about the API
local apiInfo = api [self.index]
if (not apiInfo) then
return
end
GameCooltip2:Preset(2)
GameCooltip2:SetOwner (self, "left", "right", 2, 0)
GameCooltip2:AddLine (apiInfo.desc)
GameCooltip2:ShowCooltip()
end
local lineOnLeave = function (self)
if (currentSelected == self.index) then
self:SetBackdropColor (unpack (backdropColorSelected))
else
self:SetBackdropColor (unpack (backdropColor))
end
GameCooltip2:Hide()
end
--create lines
for i = 1, lineAmount do
api2ScrollMenu:CreateLine (function (self, index)
local line = CreateFrame ("button", "$parentLine" .. index, self, "BackdropTemplate")
line:SetPoint ("topleft", self, "topleft", 1, -((index-1)*(lineHeight+1)) - 1)
line:SetSize (scrollWidth - 2, lineHeight)
line.index = index
line:SetScript ("OnEnter", lineOnEnter)
line:SetScript ("OnLeave", lineOnLeave)
line:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
line:SetBackdropColor (unpack (backdropColor))
line.text = DetailsFramework:CreateLabel (line)
line.text:SetPoint ("left", line, "left", 2, 0)
line:SetScript ("OnMouseDown", onSelectAPI)
return line
end)
end
--info box
local infoWidth = panelWidth - xAnchorPoint - 10
--api name
Api2Frame.ApiFunctionName = DetailsFramework:CreateLabel (Api2Frame, "", 14, "orange")
Api2Frame.ApiFunctionName:SetPoint ("topleft", Api2Frame, "topleft", xAnchorPoint, yStart)
--api desc
Api2Frame.ApiFunctionDesc = DetailsFramework:CreateLabel (Api2Frame)
Api2Frame.ApiFunctionDesc:SetPoint ("topleft", Api2Frame.ApiFunctionName, "bottomleft", 0, -2)
Api2Frame.ApiFunctionDesc.width = infoWidth
Api2Frame.ApiFunctionDesc.height = 22
Api2Frame.ApiFunctionDesc.valign = "top"
--api func to copy
local apiCopyString = DetailsFramework:CreateLabel (Api2Frame, "Copy String", 12, "orange")
apiCopyString:SetPoint ("topleft", Api2Frame.ApiFunctionDesc, "bottomleft", 0, -20)
Api2Frame.ApiCopy = DetailsFramework:CreateTextEntry (Api2Frame, function() end, infoWidth, 20)
Api2Frame.ApiCopy:SetPoint ("topleft", apiCopyString, "bottomleft", 0, -2)
Api2Frame.ApiCopy:SetTemplate (DetailsFramework:GetTemplate ("button", "DETAILS_CUSTOMDISPLAY_CODE_BOX"))
--parameters
local parametersYStart = yStart - 110
local parametersString = DetailsFramework:CreateLabel (Api2Frame, "Parameters", 12, "orange")
parametersString:SetPoint ("topleft", Api2Frame, "topleft", xAnchorPoint, parametersYStart)
parametersYStart = parametersYStart - 20
local space1, space2, space3 = 150, 300, 450
local parametersHeader = CreateFrame ("frame", nil, Api2Frame, "BackdropTemplate")
parametersHeader:SetSize (infoWidth, 20)
parametersHeader:SetPoint ("topleft", Api2Frame, "topleft", xAnchorPoint, parametersYStart)
parametersHeader:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
parametersHeader:SetBackdropColor (unpack (backdropColor))
parametersHeader.name = DetailsFramework:CreateLabel (parametersHeader, "Name", 12, "yellow")
parametersHeader.typeData = DetailsFramework:CreateLabel (parametersHeader, "Type", 12, "yellow")
parametersHeader.required = DetailsFramework:CreateLabel (parametersHeader, "Is Required", 12, "yellow")
parametersHeader.default = DetailsFramework:CreateLabel (parametersHeader, "Default Value", 12, "yellow")
parametersHeader.name:SetPoint ("left", parametersHeader, "left", 2, 0)
parametersHeader.typeData:SetPoint ("left", parametersHeader, "left", space1, 0)
parametersHeader.required:SetPoint ("left", parametersHeader, "left", space2, 0)
parametersHeader.default:SetPoint ("left", parametersHeader, "left", space3, 0)
local parameterOnEnter = function (self)
GameCooltip2:Preset(2)
GameCooltip2:SetOwner (self)
--fill the box in the right with information about the API
local apiInfo = api [currentSelected]
if (not apiInfo) then
return
end
GameCooltip2:AddLine (apiInfo.parameters [self.index].desc)
GameCooltip2:ShowCooltip()
self:SetBackdropColor (unpack (backdropColorOnEnter))
end
local parameterOnLeave = function (self)
GameCooltip2:Hide()
self:SetBackdropColor (unpack (backdropColor))
end
for i = 1, parametersAmount do
local parameterLine = {}
local f = CreateFrame ("frame", nil, Api2Frame, "BackdropTemplate")
f:SetSize (infoWidth, 20)
f:SetScript ("OnEnter", parameterOnEnter)
f:SetScript ("OnLeave", parameterOnLeave)
f:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
f:SetBackdropColor (unpack (backdropColor))
f:Hide()
f.name = DetailsFramework:CreateLabel (f)
f.typeData = DetailsFramework:CreateLabel (f)
f.required = DetailsFramework:CreateLabel (f)
f.default = DetailsFramework:CreateLabel (f)
f:SetPoint ("topleft", Api2Frame, "topleft", xAnchorPoint, parametersYStart + (-i * 20))
f.name:SetPoint ("left", f, "left", 2, 0)
f.typeData:SetPoint ("left", f, "left", space1, 0)
f.required:SetPoint ("left", f, "left", space2, 0)
f.default:SetPoint ("left", f, "left", space3, 0)
tinsert (parametersLines, f)
end
--return value box
local returnYStart = yStart - 260
local returnString = DetailsFramework:CreateLabel (Api2Frame, "Return Values", 12, "orange")
returnString:SetPoint ("topleft", Api2Frame, "topleft", xAnchorPoint, returnYStart)
returnYStart = returnYStart - 20
local space1 = 200
local returnHeader = CreateFrame ("frame", nil, Api2Frame, "BackdropTemplate")
returnHeader:SetSize (infoWidth, 20)
returnHeader:SetPoint ("topleft", Api2Frame, "topleft", xAnchorPoint, returnYStart)
returnHeader:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
returnHeader:SetBackdropColor (unpack (backdropColor))
returnHeader.name = DetailsFramework:CreateLabel (returnHeader, "Name", 12, "yellow")
returnHeader.typeData = DetailsFramework:CreateLabel (returnHeader, "Type", 12, "yellow")
returnHeader.name:SetPoint ("left", returnHeader, "left", 2, 0)
returnHeader.typeData:SetPoint ("left", returnHeader, "left", space1, 0)
local returnOnEnter = function (self)
self:SetBackdropColor (unpack (backdropColorOnEnter))
end
local returnOnLeave = function (self)
self:SetBackdropColor (unpack (backdropColor))
end
for i = 1, returnAmount do
local parameterLine = {}
local f = CreateFrame ("frame", nil, Api2Frame, "BackdropTemplate")
f:SetSize (infoWidth, 20)
f:SetScript ("OnEnter", returnOnEnter)
f:SetScript ("OnLeave", returnOnLeave)
f:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
f:SetBackdropColor (unpack (backdropColor))
f:Hide()
f.name = DetailsFramework:CreateLabel (f)
f.typeData = DetailsFramework:CreateLabel (f)
f.desc = DetailsFramework:CreateLabel (f, "", 10, "gray")
f.desc.width = infoWidth
f.desc.height = 60
f.desc.valign = "top"
f:SetPoint ("topleft", Api2Frame, "topleft", xAnchorPoint, returnYStart + (-i * 20))
f.name:SetPoint ("left", f, "left", 2, 0)
f.typeData:SetPoint ("left", f, "left", space1, 0)
f.desc:SetPoint ("topleft", f.name, "bottomleft", 0, -5)
tinsert (returnLines, f)
end
function Api2Frame.Refresh()
onSelectAPI (api2ScrollMenu.Frames [1])
end
end
end
+289
View File
@@ -0,0 +1,289 @@
if (true) then
return
end
local Details = _G.Details
local DF = _G.DetailsFramework
local libwindow = LibStub("LibWindow-1.1")
--> this function isn't in use
function Details.OpenDpsBenchmark()
--main frame
local DF = _detalhes.gump
local _ = nil
--declaration
local f = CreateFrame ("frame", "DetailsBenchmark", UIParent,"BackdropTemplate")
f:SetSize (800, 600)
f:SetPoint ("left", UIParent, "left")
f:SetFrameStrata ("LOW")
f:EnableMouse (true)
f:SetMovable (true)
f:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
f:SetBackdropColor (0, 0, 0, 0.9)
f:SetBackdropBorderColor (0, 0, 0, 1)
--register to libwindow
local LibWindow = LibStub ("LibWindow-1.1")
LibWindow.RegisterConfig (f, _detalhes.benchmark_db.frame)
LibWindow.RestorePosition (f)
LibWindow.MakeDraggable (f)
LibWindow.SavePosition (f)
--titlebar
f.TitleBar = CreateFrame ("frame", "$parentTitleBar", f,"BackdropTemplate")
f.TitleBar:SetPoint ("topleft", f, "topleft", 2, -3)
f.TitleBar:SetPoint ("topright", f, "topright", -2, -3)
f.TitleBar:SetHeight (20)
f.TitleBar:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
f.TitleBar:SetBackdropColor (.2, .2, .2, 1)
f.TitleBar:SetBackdropBorderColor (0, 0, 0, 1)
--close button
f.Close = CreateFrame ("button", "$parentCloseButton", f,"BackdropTemplate")
f.Close:SetPoint ("right", f.TitleBar, "right", -2, 0)
f.Close:SetSize (16, 16)
f.Close:SetNormalTexture (_detalhes.gump.folder .. "icons")
f.Close:SetHighlightTexture (_detalhes.gump.folder .. "icons")
f.Close:SetPushedTexture (_detalhes.gump.folder .. "icons")
f.Close:GetNormalTexture():SetTexCoord (0, 16/128, 0, 1)
f.Close:GetHighlightTexture():SetTexCoord (0, 16/128, 0, 1)
f.Close:GetPushedTexture():SetTexCoord (0, 16/128, 0, 1)
f.Close:SetAlpha (0.7)
f.Close:SetScript ("OnClick", function() f:Hide() end)
--title
f.Title = f.TitleBar:CreateFontString ("$parentTitle", "overlay", "GameFontNormal")
f.Title:SetPoint ("center", f.TitleBar, "center")
f.Title:SetTextColor (.8, .8, .8, 1)
f.Title:SetText ("Details! Benchmark")
DF:InstallTemplate ("font", "DETAILS_BENCHMARK_NORMAL", {color = "white", size = 10, font = "Friz Quadrata TT"})
function f.CreateCombatObject()
local t = {}
return t
end
function f.StartNewBenchmark()
end
function f.StopCurrentBenchmark()
end
f.OnTickInterval = 0
function f.UpdateOnTick (self, deltaTime)
f.OnTickInterval = f.OnTickInterval + deltaTime
if (f.OnTickInterval >= 0.024) then
--do the update
--reset the interval
f.OnTickInterval = 0
end
end
function f.StartUpdateOnTick()
f:SetScript ("OnUpdate", f.UpdateOnTick)
end
--events
f:RegisterEvent ("PLAYER_REGEN_DISABLED")
f:RegisterEvent ("PLAYER_REGEN_ENABLED")
f:SetScript ("OnEvent", function (self, event, ...)
if (event == "PLAYER_REGEN_DISABLED") then
f.StartNewBenchmark()
elseif (event == "PLAYER_REGEN_ENABLED") then
f.StopCurrentBenchmark()
end
end)
local normal_text_template = DF:GetTemplate ("font", "DETAILS_BENCHMARK_NORMAL")
local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE")
local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE")
local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
--locations
f.FrameLocations = {
summary = {10, -30},
auras = {10, -120},
spells = {10, -180},
history = {10, -280},
}
f.FrameSizes = {
default = {300, 200},
}
--summary block
--declaration
local summaryFrame = CreateFrame ("frame", "$parentSummaryFrame", f,"BackdropTemplate")
summaryFrame:SetPoint ("topleft", f, "topleft", unpack (f.FrameLocations.summary))
summaryFrame:SetSize (unpack (f.FrameSizes.default))
summaryFrame:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
summaryFrame:SetBackdropColor (0, 0, 0, 0.9)
summaryFrame:SetBackdropBorderColor (0, 0, 0, 1)
--time to test string and dropdown
local build_time_list = function()
local t = {
{value = 40, label = "40 seconds"},
{value = 60, label = "60 seconds"},
{value = 90, label = "90 seconds"},
{value = 120, label = "2 minutes"},
{value = 180, label = "3 minutes"},
{value = 300, label = "5 minutes"},
}
return t
end
summaryFrame.TimeToTestLabel = DF:CreateLabel (summaryFrame, "Amount of Time", normal_text_template)
summaryFrame.TimeToTestDropdown = DF:CreateDropDown (summaryFrame, build_time_list, default, 150, 20, _, _, options_dropdown_template)
--description string and text entry
summaryFrame.DescriptionLabel = DF:CreateLabel (summaryFrame, "Description", normal_text_template)
summaryFrame.DescriptionEntry = DF:CreateTextEntry (summaryFrame, function()end, 120, 20, nil, _, nil, options_dropdown_template)
--DPS Amount string
summaryFrame.DPSLabel = DF:CreateLabel (summaryFrame, "100K", normal_text_template)
--TIME ELAPSED string
summaryFrame.TimeElapsedLabel = DF:CreateLabel (summaryFrame, "01:00", normal_text_template)
--boss simulation string and dropdown
local build_bosssimulation_list, default = function()
local t = {
{value = "patchwerk", label = "Patchwerk"},
}
return t
end
summaryFrame.BossSimulationLabel = DF:CreateLabel (summaryFrame, "Boss Simulation", normal_text_template)
summaryFrame.BossSimulationDropdown = DF:CreateDropDown (summaryFrame, build_bosssimulation_list, default, 150, 20, _, _, options_dropdown_template)
--boss records line with a tooltip importing data from the storage
summaryFrame.BossRecordsFrame = CreateFrame ("frame", nil, summaryFrame,"BackdropTemplate")
summaryFrame.BossRecordsFrame:SetSize (f.FrameSizes.default[1]-20, 20)
summaryFrame.BossRecordsFrame:SetBackdropColor (0, 0, 0, 0.3)
summaryFrame.BossRecordsFrame:SetScript ("OnEnter", function()
end)
summaryFrame.BossRecordsFrame:SetScript ("OnLeave", function()
end)
--set the points
do
local x, y = 10, -10
summaryFrame.TimeToTestLabel:SetPoint ("topleft", summaryFrame, "topleft", x, y)
summaryFrame.TimeToTestDropdown:SetPoint ("topleft", summaryFrame.TimeToTestLabel, "bottomleft", 0, -2)
--y = y - 40
summaryFrame.DescriptionLabel:SetPoint ("topleft", summaryFrame, "topleft", x+160, y)
summaryFrame.DescriptionEntry:SetPoint ("topleft", summaryFrame.DescriptionLabel, "bottomleft", 0, -2)
y = y - 40
summaryFrame.DPSLabel:SetPoint ("topleft", summaryFrame, "topleft", x, y)
summaryFrame.TimeElapsedLabel:SetPoint ("topleft", summaryFrame, "topleft", x + 100, y)
y = y - 40
summaryFrame.BossSimulationLabel:SetPoint ("topleft", summaryFrame, "topleft", x, y)
summaryFrame.BossSimulationDropdown:SetPoint ("topleft", summaryFrame.BossSimulationLabel, "bottomleft", 0, -2)
y = y - 40
summaryFrame.BossRecordsFrame:SetPoint ("topleft", summaryFrame, "topleft", 0, 0)
end
--spells block
--declaration
local spellsFrame = CreateFrame ("frame", "$parentSpellsFrame", f,"BackdropTemplate")
spellsFrame:SetPoint ("topleft", f, "topleft", unpack (f.FrameLocations.spells))
spellsFrame:SetSize (unpack (f.FrameSizes.default))
spellsFrame:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
spellsFrame:SetBackdropColor (0, 0, 0, 0.9)
spellsFrame:SetBackdropBorderColor (0, 0, 0, 1)
--header with the string titles:
--Spell Icon | DPS | Damage | Casts | Criticals | Highest Damage
--scrollpanel
--each line with:
--Texture for the icon
--5 strings for the data
--hover over scripts
--auras block
--declaration
local aurasFrame = CreateFrame ("frame", "$parentAurasFrame", f,"BackdropTemplate")
aurasFrame:SetPoint ("topleft", f, "topleft", unpack (f.FrameLocations.auras))
aurasFrame:SetSize (unpack (f.FrameSizes.default))
aurasFrame:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
aurasFrame:SetBackdropColor (0, 0, 0, 0.9)
aurasFrame:SetBackdropBorderColor (0, 0, 0, 1)
--will be 9 blocks?
--each block with:
--Texture for the icon
--3 strings for Total Update, Applications and Refreshes
--history block
--declaration
local historyFrame = CreateFrame ("frame", "$parentHistoryFrame", f,"BackdropTemplate")
historyFrame:SetPoint ("topleft", f, "topleft", unpack (f.FrameLocations.history))
historyFrame:SetSize (unpack (f.FrameSizes.default))
historyFrame:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
historyFrame:SetBackdropColor (0, 0, 0, 0.9)
historyFrame:SetBackdropBorderColor (0, 0, 0, 1)
--header with the string titles:
--Spec | ILevel | DPS | Time | Talents | Crit | Haste | Versatility | Mastery | Int | Description
--scrollpanel
--each line with:
--7 Textures for talent icons
--10 strings for the data
--hover over scripts
--mechanics
--to open the window
--on target a training dummy
--need to be on a specific map / sanctuary
--on start a new combat:
--start the timer
--start the boss script if not patchwerk
--create the graphic tables for *player total damage and *spell damage
--create aura tables / grab auras already applied to the player / auras with no duration wont be added
--on tick:
--*check if the time is gone *update the time string *update the graphic *update the spells *upate the auras
--on finishes:
--stop the timer and check if the elapsed time is done
--create a new benchmark object to store the test
--export the data to this new object
--add this new object to the benchmark storage table
--update the history scrollbar
end
+144
View File
@@ -0,0 +1,144 @@
local Details = _G.Details
local DF = _G.DetailsFramework
local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details")
--> config bookmarks
function Details:OpenBookmarkConfig()
if (not _G.DetailsBookmarkManager) then
DF:CreateSimplePanel (UIParent, 465, 460, Loc ["STRING_OPTIONS_MANAGE_BOOKMARKS"], "DetailsBookmarkManager")
local panel = _G.DetailsBookmarkManager
DF:ApplyStandardBackdrop (panel)
panel.blocks = {}
local clear_func = function (self, button, id)
if (Details.switch.table [id]) then
Details.switch.table [id].atributo = nil
Details.switch.table [id].sub_atributo = nil
panel:Refresh()
Details.switch:Update()
end
end
local select_attribute = function (_, _, _, attribute, sub_atribute)
if (not sub_atribute) then
return
end
Details.switch.table [panel.selecting_slot].atributo = attribute
Details.switch.table [panel.selecting_slot].sub_atributo = sub_atribute
panel:Refresh()
Details.switch:Update()
end
local cooltip_color = {.1, .1, .1, .3}
local set_att = function (self, button, id)
panel.selecting_slot = id
GameCooltip:Reset()
GameCooltip:SetType (3)
GameCooltip:SetOwner (self)
Details:MontaAtributosOption (Details:GetInstance(1), select_attribute)
GameCooltip:SetColor (1, cooltip_color)
GameCooltip:SetColor (2, cooltip_color)
GameCooltip:SetOption ("HeightAnchorMod", -7)
GameCooltip:SetOption ("TextSize", Details.font_sizes.menus)
GameCooltip:SetBackdrop (1, Details.tooltip_backdrop, nil, Details.tooltip_border_color)
GameCooltip:SetBackdrop (2, Details.tooltip_backdrop, nil, Details.tooltip_border_color)
GameCooltip:ShowCooltip()
end
local button_backdrop = {bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 64, insets = {left=0, right=0, top=0, bottom=0}}
local set_onenter = function (self, capsule)
self:SetBackdropColor (1, 1, 1, 0.9)
capsule.icon:SetBlendMode ("ADD")
end
local set_onleave = function (self, capsule)
self:SetBackdropColor (0, 0, 0, 0.5)
capsule.icon:SetBlendMode ("BLEND")
end
for i = 1, 40 do
local clear = DF:CreateButton (panel, clear_func, 16, 16, nil, i, nil, [[Interface\Glues\LOGIN\Glues-CheckBox-Check]])
if (i%2 ~= 0) then
--impar
clear:SetPoint (15, (( i*10 ) * -1) - 35) --left
else
--par
local o = i-1
clear:SetPoint (250, (( o*10 ) * -1) - 35) --right
end
local set = DF:CreateButton (panel, set_att, 16, 16, nil, i)
set:SetPoint ("left", clear, "right")
set:SetPoint ("right", clear, "right", 180, 0)
set:SetBackdrop (button_backdrop)
set:SetBackdropColor (0, 0, 0, 0.5)
set:SetHook ("OnEnter", set_onenter)
set:SetHook ("OnLeave", set_onleave)
--set:InstallCustomTexture (nil, nil, nil, nil, true)
set:SetTemplate (DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"))
local bg_texture = DF:CreateImage (set, [[Interface\AddOns\Details\images\bar_skyline]], 135, 30, "background")
bg_texture:SetAllPoints()
set.bg = bg_texture
local icon = DF:CreateImage (set, nil, 16, 16, nil, nil, "icon")
icon:SetPoint ("left", clear, "right", 4, 0)
local label = DF:CreateLabel (set, "")
label:SetPoint ("left", icon, "right", 2, 0)
tinsert (panel.blocks, {icon = icon, label = label, bg = set.bg, button = set})
end
local normal_coords = {0, 1, 0, 1}
local unknown_coords = {157/512, 206/512, 39/512, 89/512}
function panel:Refresh()
local bookmarks = Details.switch.table
for i = 1, 40 do
local bookmark = bookmarks [i]
local this_block = panel.blocks [i]
if (bookmark and bookmark.atributo and bookmark.sub_atributo) then
if (bookmark.atributo == 5) then --> custom
local CustomObject = Details.custom [bookmark.sub_atributo]
if (not CustomObject) then --> ele j foi deletado
this_block.label.text = "-- x -- x --"
this_block.icon.texture = "Interface\\ICONS\\Ability_DualWield"
this_block.icon.texcoord = normal_coords
this_block.bg:SetVertexColor (.4, .1, .1, .12)
else
this_block.label.text = CustomObject.name
this_block.icon.texture = CustomObject.icon
this_block.icon.texcoord = normal_coords
this_block.bg:SetVertexColor (.4, .4, .4, .6)
end
else
bookmark.atributo = bookmark.atributo or 1
bookmark.sub_atributo = bookmark.sub_atributo or 1
this_block.label.text = Details.sub_atributos [bookmark.atributo] and Details.sub_atributos [bookmark.atributo].lista [bookmark.sub_atributo]
this_block.icon.texture = Details.sub_atributos [bookmark.atributo] and Details.sub_atributos [bookmark.atributo].icones [bookmark.sub_atributo] [1]
this_block.icon.texcoord = Details.sub_atributos [bookmark.atributo] and Details.sub_atributos [bookmark.atributo].icones [bookmark.sub_atributo] [2]
this_block.bg:SetVertexColor (.4, .4, .4, .6)
end
this_block.button:SetAlpha (1)
else
this_block.label.text = "-- x -- x --"
this_block.icon.texture = [[Interface\AddOns\Details\images\icons]]
this_block.icon.texcoord = unknown_coords
this_block.bg:SetVertexColor (.1, .1, .1, .12)
this_block.button:SetAlpha (0.3)
end
end
end
end
_G.DetailsBookmarkManager:Show()
_G.DetailsBookmarkManager:Refresh()
end
+221
View File
@@ -0,0 +1,221 @@
local Details = _G.Details
local DF = _G.DetailsFramework
local Loc = LibStub("AceLocale-3.0"):GetLocale("Details")
local tabIndex = 11
function Details:OpenBrokerTextEditor()
if (not DetailsWindowOptionsBrokerTextEditor) then
local panel = Details:CreateWelcomePanel("DetailsWindowOptionsBrokerTextEditor", nil, 870, 300, true)
panel:SetPoint("center", UIParent, "center")
panel:Hide()
panel:SetFrameStrata("FULLSCREEN")
DF:ApplyStandardBackdrop(panel)
local titleBar = DF:CreateTitleBar (panel, "Broker Text Editor")
local textentry = DF:NewSpecialLuaEditorEntry (panel, 650, 270, "editbox", "$parentEntry", true)
textentry:SetPoint ("topleft", panel, "topleft", 2, -25)
DF:ApplyStandardBackdrop(textentry)
DF:ReskinSlider(textentry.scroll)
textentry.editbox:SetScript ("OnTextChanged", function()
local text = panel.editbox:GetText()
Details.data_broker_text = text
Details:BrokerTick()
if (_G.DetailsOptionsWindow) then
local dataBrokerString = _G["DetailsOptionsWindowTab" .. tabIndex].widget_list_by_type.textentry[1]
dataBrokerString:SetText (Details.data_broker_text)
end
end)
local option_selected = 1
local onclick= function (_, _, value)
option_selected = value
end
local AddOptions = {
{label = Loc ["STRING_OPTIONS_DATABROKER_TEXT_ADD1"], value = 1, onclick = onclick},
{label = Loc ["STRING_OPTIONS_DATABROKER_TEXT_ADD2"], value = 2, onclick = onclick},
{label = Loc ["STRING_OPTIONS_DATABROKER_TEXT_ADD3"], value = 3, onclick = onclick},
{label = Loc ["STRING_OPTIONS_DATABROKER_TEXT_ADD4"], value = 4, onclick = onclick},
{label = Loc ["STRING_OPTIONS_DATABROKER_TEXT_ADD5"], value = 5, onclick = onclick},
{label = Loc ["STRING_OPTIONS_DATABROKER_TEXT_ADD6"], value = 6, onclick = onclick},
{label = Loc ["STRING_OPTIONS_DATABROKER_TEXT_ADD7"], value = 7, onclick = onclick},
{label = Loc ["STRING_OPTIONS_DATABROKER_TEXT_ADD8"], value = 8, onclick = onclick},
{label = Loc ["STRING_OPTIONS_DATABROKER_TEXT_ADD9"], value = 9, onclick = onclick},
}
local buildAddMenu = function()
return AddOptions
end
local d = DF:NewDropDown (panel, _, "$parentTextOptionsDropdown", "TextOptionsDropdown", 150, 20, buildAddMenu, 1)
d:SetPoint ("topright", panel, "topright", -12, -25)
d:SetTemplate(DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
local optiontable = {"{dmg}", "{dps}", "{dpos}", "{ddiff}", "{heal}", "{hps}", "{hpos}", "{hdiff}", "{time}"}
local add_button = DF:NewButton (panel, nil, "$parentAddButton", nil, 20, 20, function()
textentry.editbox:Insert (optiontable [option_selected])
end,
nil, nil, nil, "<-")
add_button:SetPoint ("right", d, "left", -2, 0)
add_button:SetTemplate(DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"))
-- code author Saiket from http://www.wowinterface.com/forums/showpost.php?p=245759&postcount=6
--- @return StartPos, EndPos of highlight in this editbox.
local function GetTextHighlight ( self )
local Text, Cursor = self:GetText(), self:GetCursorPosition();
self:Insert( "" ); -- Delete selected text
local TextNew, CursorNew = self:GetText(), self:GetCursorPosition();
-- Restore previous text
self:SetText( Text );
self:SetCursorPosition( Cursor );
local Start, End = CursorNew, #Text - ( #TextNew - CursorNew );
self:HighlightText( Start, End );
return Start, End;
end
local StripColors;
do
local CursorPosition, CursorDelta;
--- Callback for gsub to remove unescaped codes.
local function StripCodeGsub ( Escapes, Code, End )
if ( #Escapes % 2 == 0 ) then -- Doesn't escape Code
if ( CursorPosition and CursorPosition >= End - 1 ) then
CursorDelta = CursorDelta - #Code;
end
return Escapes;
end
end
--- Removes a single escape sequence.
local function StripCode ( Pattern, Text, OldCursor )
CursorPosition, CursorDelta = OldCursor, 0;
return Text:gsub( Pattern, StripCodeGsub ), OldCursor and CursorPosition + CursorDelta;
end
--- Strips Text of all color escape sequences.
-- @param Cursor Optional cursor position to keep track of.
-- @return Stripped text, and the updated cursor position if Cursor was given.
function StripColors ( Text, Cursor )
Text, Cursor = StripCode( "(|*)(|c%x%x%x%x%x%x%x%x)()", Text, Cursor );
return StripCode( "(|*)(|r)()", Text, Cursor );
end
end
local COLOR_END = "|r";
--- Wraps this editbox's selected text with the given color.
local function ColorSelection ( self, ColorCode )
local Start, End = GetTextHighlight( self );
local Text, Cursor = self:GetText(), self:GetCursorPosition();
if ( Start == End ) then -- Nothing selected
--Start, End = Cursor, Cursor; -- Wrap around cursor
return; -- Wrapping the cursor in a color code and hitting backspace crashes the client!
end
-- Find active color code at the end of the selection
local ActiveColor;
if ( End < #Text ) then -- There is text to color after the selection
local ActiveEnd;
local CodeEnd, _, Escapes, Color = 0;
while ( true ) do
_, CodeEnd, Escapes, Color = Text:find( "(|*)(|c%x%x%x%x%x%x%x%x)", CodeEnd + 1 );
if ( not CodeEnd or CodeEnd > End ) then
break;
end
if ( #Escapes % 2 == 0 ) then -- Doesn't escape Code
ActiveColor, ActiveEnd = Color, CodeEnd;
end
end
if ( ActiveColor ) then
-- Check if color gets terminated before selection ends
CodeEnd = 0;
while ( true ) do
_, CodeEnd, Escapes = Text:find( "(|*)|r", CodeEnd + 1 );
if ( not CodeEnd or CodeEnd > End ) then
break;
end
if ( CodeEnd > ActiveEnd and #Escapes % 2 == 0 ) then -- Terminates ActiveColor
ActiveColor = nil;
break;
end
end
end
end
local Selection = Text:sub( Start + 1, End );
-- Remove color codes from the selection
local Replacement, CursorReplacement = StripColors( Selection, Cursor - Start );
self:SetText( ( "" ):join(
Text:sub( 1, Start ),
ColorCode, Replacement, COLOR_END,
ActiveColor or "", Text:sub( End + 1 )
) );
-- Restore cursor and highlight, adjusting for wrapper text
Cursor = Start + CursorReplacement;
if ( CursorReplacement > 0 ) then -- Cursor beyond start of color code
Cursor = Cursor + #ColorCode;
end
if ( CursorReplacement >= #Replacement ) then -- Cursor beyond end of color
Cursor = Cursor + #COLOR_END;
end
self:SetCursorPosition( Cursor );
-- Highlight selection and wrapper
self:HighlightText( Start, #ColorCode + ( #Replacement - #Selection ) + #COLOR_END + End );
end
local color_func = function (_, r, g, b, a)
local hex = Details:hex (a*255)..Details:hex (r*255)..Details:hex (g*255)..Details:hex (b*255)
ColorSelection ( textentry.editbox, "|c" .. hex)
end
local color_button = DF:NewColorPickButton (panel, "$parentButton5", nil, color_func)
color_button:SetSize (80, 20)
color_button:SetPoint ("topright", panel, "topright", -12, -102)
color_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_COLOR_TOOLTIP"]
color_button:SetTemplate(DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"))
local done = function()
local text = panel.editbox:GetText()
Details.data_broker_text = text
if (_G.DetailsOptionsWindow) then
local dataBrokerString = _G["DetailsOptionsWindowTab" .. tabIndex].widget_list_by_type.textentry[1]
dataBrokerString:SetText (Details.data_broker_text)
end
Details:BrokerTick()
panel:Hide()
end
local ok_button = DF:NewButton (panel, nil, "$parentButtonOk", nil, 80, 20, done, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_DONE"], 1)
ok_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_DONE_TOOLTIP"]
ok_button:SetPoint ("topright", panel, "topright", -12, -174)
ok_button:SetTemplate(DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"))
local reset_button = DF:NewButton (panel, nil, "$parentDefaultOk", nil, 80, 20, function() textentry.editbox:SetText ("") end, nil, nil, nil, "Reset", 1)
reset_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_RESET_TOOLTIP"]
reset_button:SetPoint ("topright", panel, "topright", -100, -152)
reset_button:SetTemplate(DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"))
local cancel_button = DF:NewButton (panel, nil, "$parentDefaultCancel", nil, 80, 20, function() textentry.editbox:SetText (panel.default_text); done(); end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_CANCEL"], 1)
cancel_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_CANCEL_TOOLTIP"]
cancel_button:SetPoint ("topright", panel, "topright", -100, -174)
cancel_button:SetTemplate(DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"))
end
local panel = DetailsWindowOptionsBrokerTextEditor
local text = Details.data_broker_text:gsub ("||", "|")
panel.default_text = text
panel.editbox:SetText (text)
panel:Show()
end
+95
View File
@@ -0,0 +1,95 @@
local Details = _G.Details
local DF = _G.DetailsFramework
local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details")
--> config class colors
function Details:OpenClassColorsConfig()
if (not _G.DetailsClassColorManager) then
DF:CreateSimplePanel (UIParent, 300, 280, Loc ["STRING_OPTIONS_CLASSCOLOR_MODIFY"], "DetailsClassColorManager")
local panel = _G.DetailsClassColorManager
DF:ApplyStandardBackdrop (panel)
local upper_panel = CreateFrame ("frame", nil, panel,"BackdropTemplate")
upper_panel:SetAllPoints (panel)
upper_panel:SetFrameLevel (panel:GetFrameLevel()+3)
local y = -50
local callback = function (button, r, g, b, a, self)
self.MyObject.my_texture:SetVertexColor (r, g, b)
Details.class_colors [self.MyObject.my_class][1] = r
Details.class_colors [self.MyObject.my_class][2] = g
Details.class_colors [self.MyObject.my_class][3] = b
Details:RefreshMainWindow (-1, true)
end
local set_color = function (self, button, class, index)
local current_class_color = Details.class_colors [class]
local r, g, b = unpack (current_class_color)
DF:ColorPick (self, r, g, b, 1, callback)
end
local reset_color = function (self, button, class, index)
local color_table = RAID_CLASS_COLORS [class]
local r, g, b = color_table.r, color_table.g, color_table.b
self.MyObject.my_texture:SetVertexColor (r, g, b)
Details.class_colors [self.MyObject.my_class][1] = r
Details.class_colors [self.MyObject.my_class][2] = g
Details.class_colors [self.MyObject.my_class][3] = b
Details:RefreshMainWindow (-1, true)
end
local on_enter = function (self, capsule)
--Details:CooltipPreset (1)
--GameCooltip:AddLine ("right click to reset")
--GameCooltip:Show (self)
end
local on_leave = function (self, capsule)
--GameCooltip:Hide()
end
local reset = DF:NewLabel (panel, panel, nil, nil, "|TInterface\\TUTORIALFRAME\\UI-TUTORIAL-FRAME:" .. 20 .. ":" .. 20 .. ":0:1:512:512:8:70:328:409|t " .. Loc ["STRING_OPTIONS_CLASSCOLOR_RESET"])
reset:SetPoint ("bottomright", panel, "bottomright", -23, 08)
local reset_texture = DF:CreateImage (panel, [[Interface\MONEYFRAME\UI-MONEYFRAME-BORDER]], 138, 45, "border")
reset_texture:SetPoint ("center", reset, "center", 0, -7)
reset_texture:SetDesaturated (true)
panel.buttons = {}
for index, class_name in ipairs (CLASS_SORT_ORDER) do
local icon = DF:CreateImage (upper_panel, [[Interface\Glues\CHARACTERCREATE\UI-CHARACTERCREATE-CLASSES]], 32, 32, nil, CLASS_ICON_TCOORDS [class_name], "icon_" .. class_name)
if (index%2 ~= 0) then
icon:SetPoint (10, y)
else
icon:SetPoint (150, y)
y = y - 33
end
local bg_texture = DF:CreateImage (panel, [[Interface\AddOns\Details\images\bar_skyline]], 135, 30, "artwork")
bg_texture:SetPoint ("left", icon, "right", -32, 0)
local button = DF:CreateButton (panel, set_color, 135, 30, "set color", class_name, index)
button:SetPoint ("left", icon, "right", -32, 0)
button:InstallCustomTexture (nil, nil, nil, nil, true)
button:SetFrameLevel (panel:GetFrameLevel()+1)
button.my_icon = icon
button.my_texture = bg_texture
button.my_class = class_name
button:SetHook ("OnEnter", on_enter)
button:SetHook ("OnLeave", on_leave)
button:SetClickFunction (reset_color, nil, nil, "RightClick")
panel.buttons [class_name] = button
end
end
for class, button in pairs (_G.DetailsClassColorManager.buttons) do
button.my_texture:SetVertexColor (unpack (Details.class_colors [class]))
end
_G.DetailsClassColorManager:Show()
end
+65
View File
@@ -0,0 +1,65 @@
do
local _detalhes = _G._detalhes
local DetailsFrameWork = _detalhes.gump
local _
--> panel
function _detalhes:CreateCopyPasteWindow()
local panel = CreateFrame ("frame", "DetailsCopy", UIParent, "ButtonFrameTemplate")
panel:SetSize (512, 148)
tinsert (UISpecialFrames, "DetailsCopy")
panel:SetFrameStrata ("TOOLTIP")
panel:SetPoint ("center", UIParent, "center")
panel.locked = false
panel:SetToplevel (true)
panel:SetMovable (true)
panel:SetScript ("OnMouseDown", function(self, button)
if (self.isMoving) then
return
end
if (button == "RightButton") then
self:Hide()
else
self:StartMoving()
self.isMoving = true
end
end)
panel:SetScript ("OnMouseUp", function(self, button)
if (self.isMoving and button == "LeftButton") then
self:StopMovingOrSizing()
self.isMoving = nil
end
end)
DetailsFrameWork:NewImage (panel, "Interface\\AddOns\\Details\\images\\copy", 512, 128, "overlay", nil, "background", "$parentBackGround")
panel.background:SetPoint (0, -25)
--> title
panel.TitleText:SetText ("Paste & Copy")
panel.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-BLOODELF]])
DetailsFrameWork:NewTextEntry (panel, _, "$parentTextEntry", "text", 476, 14)
panel.text:SetPoint (20, -127)
panel.text:SetHook ("OnEditFocusLost", function() panel:Hide() end)
panel.text:SetHook ("OnChar", function() panel:Hide() end)
DetailsFrameWork:NewLabel (panel, _, _, "desc", "paste on your web browser address bar", "OptionsFontHighlightSmall", 12)
panel.desc:SetPoint (340, -78)
panel.desc.width = 150
panel.desc.height = 25
panel.desc.align = "|"
panel.desc.color = "gray"
panel:Hide()
end
function _detalhes:CopyPaste (link)
_G.DetailsCopy.text.text = link
_G.DetailsCopy.text:HighlightText()
_G.DetailsCopy:Show()
_G.DetailsCopy.text:SetFocus()
end
end
+712
View File
@@ -0,0 +1,712 @@
local Details = _G.Details
local libwindow = LibStub("LibWindow-1.1")
function Details:OpenCurrentRealDPSOptions(from_options_panel)
if (not DetailsCurrentRealDPSOptions) then
local DF = _detalhes.gump
local f = DF:CreateSimplePanel (UIParent, 700, 400, "Details! The Current Real DPS Options", "DetailsCurrentRealDPSOptions")
f:SetPoint ("center", UIParent, "center")
f:SetScript ("OnMouseDown", nil)
f:SetScript ("OnMouseUp", nil)
local LibWindow = LibStub ("LibWindow-1.1")
LibWindow.RegisterConfig (f, _detalhes.current_dps_meter.options_frame)
LibWindow.MakeDraggable (f)
LibWindow.RestorePosition (f)
local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")
local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE")
local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE")
local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
local testUsing = "arena" --mythicdungeon
--> frame strata options
local set_frame_strata = function (_, _, strata)
Details.current_dps_meter.frame.strata = strata
Details:UpdateTheRealCurrentDPSFrame (testUsing)
end
local strataTable = {}
strataTable [1] = {value = "BACKGROUND", label = "BACKGROUND", onclick = set_frame_strata}
strataTable [2] = {value = "LOW", label = "LOW", onclick = set_frame_strata}
strataTable [3] = {value = "MEDIUM", label = "MEDIUM", onclick = set_frame_strata}
strataTable [4] = {value = "HIGH", label = "HIGH", onclick = set_frame_strata}
strataTable [5] = {value = "DIALOG", label = "DIALOG", onclick = set_frame_strata}
--> font options
local set_font_shadow= function (_, _, shadow)
Details.current_dps_meter.font_shadow = shadow
Details:UpdateTheRealCurrentDPSFrame (testUsing)
end
local fontShadowTable = {}
fontShadowTable [1] = {value = "NONE", label = "None", onclick = set_font_shadow}
fontShadowTable [2] = {value = "OUTLINE", label = "Outline", onclick = set_font_shadow}
fontShadowTable [3] = {value = "THICKOUTLINE", label = "Thick Outline", onclick = set_font_shadow}
local on_select_text_font = function (self, fixed_value, value)
Details.current_dps_meter.font_face = value
Details:UpdateTheRealCurrentDPSFrame (testUsing)
end
--> options table
local options = {
{type = "label", get = function() return "Frame Settings:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
--enabled
{
type = "toggle",
get = function() return Details.current_dps_meter.enabled end,
set = function (self, fixedparam, value)
Details.current_dps_meter.enabled = not Details.current_dps_meter.enabled
Details:LoadFramesForBroadcastTools()
end,
desc = "Enabled",
name = "Enabled",
text_template = options_text_template,
},
--locked
{
type = "toggle",
get = function() return Details.current_dps_meter.frame.locked end,
set = function (self, fixedparam, value)
Details.current_dps_meter.frame.locked = not Details.current_dps_meter.frame.locked
Details:UpdateTheRealCurrentDPSFrame (testUsing)
end,
desc = "Locked",
name = "Locked",
text_template = options_text_template,
},
--showtitle
{
type = "toggle",
get = function() return Details.current_dps_meter.frame.show_title end,
set = function (self, fixedparam, value)
Details.current_dps_meter.frame.show_title = not Details.current_dps_meter.frame.show_title
Details:UpdateTheRealCurrentDPSFrame (testUsing)
end,
desc = "Show Title",
name = "Show Title",
text_template = options_text_template,
},
--backdrop color
{
type = "color",
get = function()
return {Details.current_dps_meter.frame.backdrop_color[1], Details.current_dps_meter.frame.backdrop_color[2], Details.current_dps_meter.frame.backdrop_color[3], Details.current_dps_meter.frame.backdrop_color[4]}
end,
set = function (self, r, g, b, a)
local color = Details.current_dps_meter.frame.backdrop_color
color[1], color[2], color[3], color[4] = r, g, b, a
Details:UpdateTheRealCurrentDPSFrame (testUsing)
end,
desc = "Backdrop Color",
name = "Backdrop Color",
text_template = options_text_template,
},
--statra
{
type = "select",
get = function() return Details.current_dps_meter.frame.strata end,
values = function() return strataTable end,
name = "Frame Strata"
},
--width
{
type = "range",
get = function() return Details.current_dps_meter.frame.width end,
set = function (self, fixedparam, value)
Details.current_dps_meter.frame.width = value
Details:UpdateTheRealCurrentDPSFrame (testUsing)
end,
min = 1,
max = 300,
step = 1,
name = "Width",
text_template = options_text_template,
},
--height
{
type = "range",
get = function() return Details.current_dps_meter.frame.height end,
set = function (self, fixedparam, value)
Details.current_dps_meter.frame.height = value
Details:UpdateTheRealCurrentDPSFrame (testUsing)
end,
min = 1,
max = 300,
step = 1,
name = "Height",
text_template = options_text_template,
},
{type = "breakline"},
{type = "label", get = function() return "Enabled On:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
--arenas
{
type = "toggle",
get = function() return Details.current_dps_meter.arena_enabled end,
set = function (self, fixedparam, value)
Details.current_dps_meter.arena_enabled = not Details.current_dps_meter.arena_enabled
Details:LoadFramesForBroadcastTools()
end,
name = "Arena Matches",
text_template = options_text_template,
},
--mythic dungeon
{
type = "toggle",
get = function() return Details.current_dps_meter.mythic_dungeon_enabled end,
set = function (self, fixedparam, value)
Details.current_dps_meter.mythic_dungeon_enabled = not Details.current_dps_meter.mythic_dungeon_enabled
Details:LoadFramesForBroadcastTools()
end,
name = "Mythic Dungeons",
text_template = options_text_template,
},
{type = "breakline"},
{type = "label", get = function() return "Text Settings:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
--font size
{
type = "range",
get = function() return Details.current_dps_meter.font_size end,
set = function (self, fixedparam, value)
Details.current_dps_meter.font_size = value
Details:UpdateTheRealCurrentDPSFrame (testUsing)
end,
min = 4,
max = 32,
step = 1,
name = "Font Size",
text_template = options_text_template,
},
--font color
{
type = "color",
get = function()
return {Details.current_dps_meter.font_color[1], Details.current_dps_meter.font_color[2], Details.current_dps_meter.font_color[3], Details.current_dps_meter.font_color[4]}
end,
set = function (self, r, g, b, a)
local color = Details.current_dps_meter.font_color
color[1], color[2], color[3], color[4] = r, g, b, a
Details:UpdateTheRealCurrentDPSFrame (testUsing)
end,
desc = "Font Color",
name = "Font Color",
text_template = options_text_template,
},
--font shadow
{
type = "select",
get = function() return Details.current_dps_meter.font_shadow end,
values = function() return fontShadowTable end,
name = "Font Shadow"
},
--font face
{
type = "select",
get = function() return Details.current_dps_meter.font_face end,
values = function() return DF:BuildDropDownFontList (on_select_text_font) end,
name = "Font Face",
text_template = options_text_template,
},
}
DF:BuildMenu (f, options, 7, -30, 500, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
f:SetScript ("OnHide" , function()
if (DetailsCurrentDpsMeter) then
--> check if can hide the main frame as well
--> we force show the main frame for the user see the frame while editing the options
local zoneName, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo()
if ((instanceType ~= "party" and difficultyID ~= 8) and instanceType ~= "arena") then
DetailsCurrentDpsMeter:Hide()
end
end
--> reopen the options panel
if (f.FromOptionsPanel) then
C_Timer.After (0.2, function()
Details:OpenOptionsWindow(Details:GetInstance(1))
end)
end
end)
end
--> check if the frame was been created
if (not DetailsCurrentDpsMeter) then
Details:CreateCurrentDpsFrame(UIParent, "DetailsCurrentDpsMeter")
end
--> show the options
DetailsCurrentRealDPSOptions:Show()
DetailsCurrentRealDPSOptions:RefreshOptions()
DetailsCurrentRealDPSOptions.FromOptionsPanel = from_options_panel
--> start the frame for viewing while editing the options
DetailsCurrentDpsMeter:StartForArenaMatch()
end
function Details:CreateCurrentDpsFrame(parent, name)
local DF = _detalhes.gump
local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
--> some constants
local header_size = 12 --title bar size
local spacing_vertical = -6 --vertical space between the group anchor and the group dps
local green_team_color = {.5, 1, .5, 1}
local yellow_team_color = {1, 1, .5, 1}
--> main farame
local f = CreateFrame ("frame", name, parent or UIParent,"BackdropTemplate")
f:SetPoint ("center", UIParent, "center")
f:SetSize (_detalhes.current_dps_meter.frame.width, _detalhes.current_dps_meter.frame.height)
f:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}})
f:SetBackdropColor (unpack (_detalhes.current_dps_meter.frame.backdrop_color))
f:EnableMouse (true)
f:SetMovable (true)
f:SetClampedToScreen (true)
f.PlayerTeam = 0
local LibWindow = LibStub ("LibWindow-1.1")
LibWindow.RegisterConfig (f, _detalhes.current_dps_meter.frame)
LibWindow.MakeDraggable (f)
LibWindow.RestorePosition (f)
--> title bar
local TitleString = f:CreateFontString (nil, "overlay", "GameFontNormal")
TitleString:SetPoint ("top", f, "top", 0, -1)
TitleString:SetText ("Dps on Last 5 Seconds")
DF:SetFontSize (TitleString, 9)
local TitleBackground = f:CreateTexture (nil, "artwork")
TitleBackground:SetTexture ([[Interface\Tooltips\UI-Tooltip-Background]])
TitleBackground:SetVertexColor (.1, .1, .1, .9)
TitleBackground:SetPoint ("topleft", f, "topleft")
TitleBackground:SetPoint ("topright", f, "topright")
TitleBackground:SetHeight (header_size)
--> labels for arena
local labelPlayerTeam = f:CreateFontString (nil, "overlay", "GameFontNormal")
local labelYellowTeam = f:CreateFontString (nil, "overlay", "GameFontNormal")
labelPlayerTeam:SetText ("Player Team")
labelYellowTeam:SetText ("Enemy Team")
DF:SetFontSize (labelPlayerTeam, 14)
DF:SetFontSize (labelYellowTeam, 14)
DF:SetFontOutline (labelPlayerTeam, "NONE")
DF:SetFontOutline (labelYellowTeam, "NONE")
local labelPlayerTeam_DPS = f:CreateFontString (nil, "overlay", "GameFontNormal")
local labelYellowTeam_DPS = f:CreateFontString (nil, "overlay", "GameFontNormal")
labelPlayerTeam_DPS:SetText ("0")
labelYellowTeam_DPS:SetText ("0")
local labelPlayerTeam_DPS_Icon = f:CreateTexture (nil, "overlay")
local labelYellowTeam_DPS_Icon = f:CreateTexture (nil, "overlay")
labelPlayerTeam_DPS_Icon:SetTexture ([[Interface\LFGFRAME\UI-LFG-ICON-ROLES]])
labelYellowTeam_DPS_Icon:SetTexture ([[Interface\LFGFRAME\UI-LFG-ICON-ROLES]])
labelPlayerTeam_DPS_Icon:SetTexCoord (72/256, 130/256, 69/256, 127/256)
labelYellowTeam_DPS_Icon:SetTexCoord (72/256, 130/256, 69/256, 127/256)
local icon_size = 16
labelPlayerTeam_DPS_Icon:SetSize (icon_size, icon_size)
labelYellowTeam_DPS_Icon:SetSize (icon_size, icon_size)
labelPlayerTeam:SetPoint ("left", f, "left", 5, 10)
labelYellowTeam:SetPoint ("right", f, "right", -5, 10)
labelPlayerTeam_DPS_Icon:SetPoint ("topleft", labelPlayerTeam, "bottomleft", 0, -4)
labelYellowTeam_DPS_Icon:SetPoint ("topleft", labelYellowTeam, "bottomleft", 0, -4)
labelPlayerTeam_DPS:SetPoint ("left", labelPlayerTeam_DPS_Icon, "right", 4, 0)
labelYellowTeam_DPS:SetPoint ("left", labelYellowTeam_DPS_Icon, "right", 4, 0)
labelPlayerTeam:SetTextColor (unpack (green_team_color))
labelYellowTeam:SetTextColor (unpack (yellow_team_color))
function f.SwapArenaTeamColors()
if (f.PlayerTeam == 0) then
labelPlayerTeam:SetTextColor (unpack (yellow_team_color))
labelYellowTeam:SetTextColor (unpack (green_team_color))
else
labelPlayerTeam:SetTextColor (unpack (green_team_color))
labelYellowTeam:SetTextColor (unpack (yellow_team_color))
end
end
--> labels for mythic dungeon / group party
local labelGroupDamage = f:CreateFontString (nil, "overlay", "GameFontNormal")
labelGroupDamage:SetText ("Real Time Group DPS")
DF:SetFontSize (labelGroupDamage, 14)
DF:SetFontOutline (labelGroupDamage, "NONE")
local labelGroupDamage_DPS = f:CreateFontString (nil, "overlay", "GameFontNormal")
labelGroupDamage_DPS:SetText ("0")
labelGroupDamage:SetPoint ("center", f, "center", 0, 10)
labelGroupDamage_DPS:SetPoint ("center", labelGroupDamage, "center")
labelGroupDamage_DPS:SetPoint ("top", labelGroupDamage, "bottom", 0, spacing_vertical)
--[=[
local labelGroupDamage_DPS_Icon = f:CreateTexture (nil, "overlay")
labelGroupDamage_DPS_Icon:SetTexture ([[Interface\LFGFRAME\UI-LFG-ICON-ROLES]])
labelGroupDamage_DPS_Icon:SetTexCoord (72/256, 130/256, 69/256, 127/256)
labelGroupDamage_DPS_Icon:SetSize (icon_size, icon_size)
labelGroupDamage_DPS_Icon:SetPoint ("topleft", labelPlayerTeam, "bottomleft", 0, -4)
--]=]
--> frame update function
--> update
local time_fraction = 100/1000 --one tick per 100ms
f.NextUpdate = time_fraction --when the next tick occur
f.NextScreenUpdate = _detalhes.current_dps_meter.update_interval --when the labels on the frame receive update
--> arena
f.PlayerTeamBuffer = {}
f.YellowTeamBuffer = {}
f.PlayerTeamDamage = 0
f.YellowDamage = 0
f.LastPlayerTeamDamage = 0
f.LastYellowDamage = 0
--> mythic dungeon / party group
f.GroupBuffer = {}
f.GroupTotalDamage = 0
f.LastTickGroupDamage = 0
--> general
f.SampleSize = _detalhes.current_dps_meter.sample_size
f.MaxBufferIndex = 1
f.ShowingArena = false
function _detalhes:UpdateTheRealCurrentDPSFrame (scenario)
--> don't run if the featured hasn't loaded
if (not f) then
return
end
if (not _detalhes.current_dps_meter.enabled) then
f:Hide()
return
end
if (not _detalhes.current_dps_meter.arena_enabled and not _detalhes.current_dps_meter.mythic_dungeon_enabled) then
f:Hide()
return
end
--> where the player are
if (scenario == "arena") then
labelPlayerTeam_DPS:Show()
labelYellowTeam_DPS:Show()
labelPlayerTeam:Show()
labelYellowTeam:Show()
labelPlayerTeam_DPS_Icon:Show()
labelYellowTeam_DPS_Icon:Show()
--> update arena labels
DF:SetFontColor (labelPlayerTeam_DPS, _detalhes.current_dps_meter.font_color)
DF:SetFontFace (labelPlayerTeam_DPS, _detalhes.current_dps_meter.font_face)
DF:SetFontSize (labelPlayerTeam_DPS, _detalhes.current_dps_meter.font_size)
DF:SetFontOutline (labelPlayerTeam_DPS, _detalhes.current_dps_meter.font_shadow)
DF:SetFontColor (labelYellowTeam_DPS, _detalhes.current_dps_meter.font_color)
DF:SetFontFace (labelYellowTeam_DPS, _detalhes.current_dps_meter.font_face)
DF:SetFontSize (labelYellowTeam_DPS, _detalhes.current_dps_meter.font_size)
DF:SetFontOutline (labelYellowTeam_DPS, _detalhes.current_dps_meter.font_shadow)
--> wipe current data for arena
wipe (f.PlayerTeamBuffer)
wipe (f.YellowTeamBuffer)
--> reset damage
f.PlayerTeamDamage = 0
f.YellowDamage = 0
--> reset last tick damage
f.LastPlayerTeamDamage = 0
f.LastYellowDamage = 0
f:Show()
else
--> isn't arena, hide arena labels
labelPlayerTeam_DPS:Hide()
labelYellowTeam_DPS:Hide()
labelPlayerTeam:Hide()
labelYellowTeam:Hide()
labelPlayerTeam_DPS_Icon:Hide()
labelYellowTeam_DPS_Icon:Hide()
end
if (scenario == "mythicdungeon") then
labelGroupDamage:Show()
labelGroupDamage_DPS:Show()
DF:SetFontColor (labelGroupDamage_DPS, _detalhes.current_dps_meter.font_color)
DF:SetFontFace (labelGroupDamage_DPS, _detalhes.current_dps_meter.font_face)
DF:SetFontSize (labelGroupDamage_DPS, _detalhes.current_dps_meter.font_size)
DF:SetFontOutline (labelGroupDamage_DPS, _detalhes.current_dps_meter.font_shadow)
--> wipe current data for mythic dungeon
f.GroupBuffer = {}
--> reset damage
f.GroupTotalDamage = 0
--> reset last tick damage
f.LastTickGroupDamage = 0
f:Show()
else
labelGroupDamage:Hide()
labelGroupDamage_DPS:Hide()
end
--> frame position
f:SetSize (_detalhes.current_dps_meter.frame.width, _detalhes.current_dps_meter.frame.height)
LibWindow.RegisterConfig (f, _detalhes.current_dps_meter.frame)
LibWindow.RestorePosition (f)
--> backdrop color
f:SetBackdropColor (unpack (_detalhes.current_dps_meter.frame.backdrop_color))
--> set frame size
f:SetSize (_detalhes.current_dps_meter.frame.width, _detalhes.current_dps_meter.frame.height)
--> frame is locked
if (_detalhes.current_dps_meter.frame.locked) then
f:EnableMouse (false)
else
f:EnableMouse (true)
end
--> frame can show title
if (_detalhes.current_dps_meter.frame.show_title) then
TitleString:Show()
TitleBackground:Show()
else
TitleString:Hide()
TitleBackground:Hide()
end
--> frame strata
f:SetFrameStrata (_detalhes.current_dps_meter.frame.strata)
--> calcule buffer size
f.MaxBufferIndex = f.SampleSize * time_fraction * 100 --sample size in seconds * fraction * tick milliseconds
--> interval to update the frame
f.NextScreenUpdate = _detalhes.current_dps_meter.update_interval
end
_detalhes:UpdateTheRealCurrentDPSFrame()
local on_tick = function (self, deltaTime)
self.NextUpdate = self.NextUpdate - deltaTime
if (self.NextUpdate <= 0) then
--> update string
local currentCombat = _detalhes:GetCombat()
local damageContainer = currentCombat:GetContainer (DETAILS_ATTRIBUTE_DAMAGE)
--> show the current dps during an arena match
if (self.ShowingArena) then
--> the team damage done at this tick
local thisTickPlayerTeamDamage = 0
local thisTickYellowDamage = 0
for i, actor in damageContainer:ListActors() do
--actor.arena_team = actor.arena_team or 0 --debug
if (actor:IsPlayer() and actor.arena_team) then
if (actor.arena_team == 0) then
--green team / player team
thisTickPlayerTeamDamage = thisTickPlayerTeamDamage + actor.total
else
--yellow
thisTickYellowDamage = thisTickYellowDamage + actor.total
end
if (actor.nome == _detalhes.playername) then
--> if player isn't in green team > swap colors
if (f.PlayerTeam ~= actor.arena_team) then
f.SwapArenaTeamColors()
f.PlayerTeam = actor.arena_team
end
end
end
end
--> calculate how much damage the team made on this tick
local playerTeamDamageDone = thisTickPlayerTeamDamage - f.LastPlayerTeamDamage
local yellowDamageDone = thisTickYellowDamage - f.LastYellowDamage
--> add the damage to buffer
tinsert (f.PlayerTeamBuffer, 1, playerTeamDamageDone)
tinsert (f.YellowTeamBuffer, 1, yellowDamageDone)
--> save the current damage amount
f.LastPlayerTeamDamage = thisTickPlayerTeamDamage
f.LastYellowDamage = thisTickYellowDamage
--> add the damage to current total damage
f.PlayerTeamDamage = f.PlayerTeamDamage + playerTeamDamageDone
f.YellowDamage = f.YellowDamage + yellowDamageDone
--> remove player team damage
local removedDamage = tremove (f.PlayerTeamBuffer, f.MaxBufferIndex+1)
if (removedDamage) then
f.PlayerTeamDamage = f.PlayerTeamDamage - removedDamage
--> be save
f.PlayerTeamDamage = max (0, f.PlayerTeamDamage)
end
--> remove yellow damage
local removedDamage = tremove (f.YellowTeamBuffer, f.MaxBufferIndex+1)
if (removedDamage) then
f.YellowDamage = f.YellowDamage - removedDamage
--> be save
f.YellowDamage = max (0, f.YellowDamage)
end
self.NextScreenUpdate = self.NextScreenUpdate - time_fraction
if (self.NextScreenUpdate <= 0) then
if (f.PlayerTeam == 0) then
labelPlayerTeam_DPS:SetText (_detalhes:ToK2 (self.PlayerTeamDamage / self.SampleSize))
labelYellowTeam_DPS:SetText (_detalhes:ToK2 (self.YellowDamage / self.SampleSize))
else
labelPlayerTeam_DPS:SetText (_detalhes:ToK2 (self.YellowDamage / self.SampleSize))
labelYellowTeam_DPS:SetText (_detalhes:ToK2 (self.PlayerTeamDamage / self.SampleSize))
end
f.NextScreenUpdate = _detalhes.current_dps_meter.update_interval
end
elseif (self.ShowingMythicDungeon) then
--iniciava um novo combate e tinha o buffer do combate anterior
--ento dava o total de dano do combate recente menos o que tinha no buffer do round anterior
--> the party damage done at this tick
local thisTickGroupDamage = 0
for i, actor in damageContainer:ListActors() do
if (actor:IsPlayer() and actor:IsGroupPlayer()) then
thisTickGroupDamage = thisTickGroupDamage + actor.total
end
end
--> calculate how much damage the team made on this tick
local groupDamageDoneOnThisTick = thisTickGroupDamage - f.LastTickGroupDamage
--> add the damage to buffer
tinsert (f.GroupBuffer, 1, groupDamageDoneOnThisTick)
--> save the current damage amount
f.LastTickGroupDamage = thisTickGroupDamage
--> add the damage to current total damage
f.GroupTotalDamage = f.GroupTotalDamage + groupDamageDoneOnThisTick
--> cicle buffer removing the last index and subtract its damage
local removedDamage = tremove (f.GroupBuffer, f.MaxBufferIndex+1)
if (removedDamage) then
--> remove the value from the total damage
f.GroupTotalDamage = f.GroupTotalDamage - removedDamage
--> be save
f.GroupTotalDamage = max (0, f.GroupTotalDamage)
end
self.NextScreenUpdate = self.NextScreenUpdate - time_fraction
if (self.NextScreenUpdate <= 0) then
labelGroupDamage_DPS:SetText (_detalhes:ToK2 (f.GroupTotalDamage / self.SampleSize))
f.NextScreenUpdate = _detalhes.current_dps_meter.update_interval
end
end
--> set next update time
self.NextUpdate = time_fraction
end
end
f:SetScript ("OnHide", function()
f.ShowingArena = false
f.ShowingMythicDungeon = false
f:SetScript ("OnUpdate", nil)
end)
function f:StartForArenaMatch()
if (not f.ShowingArena) then
_detalhes:UpdateTheRealCurrentDPSFrame ("arena")
f.ShowingArena = true
f:SetScript ("OnUpdate", on_tick)
end
end
function f:StartForMythicDungeon()
if (not f.ShowingMythicDungeon) then
_detalhes:UpdateTheRealCurrentDPSFrame ("mythicdungeon")
f.ShowingMythicDungeon = true
f:SetScript ("OnUpdate", on_tick)
end
end
local eventListener = _detalhes:CreateEventListener()
function eventListener:ArenaStarted()
if (_detalhes.current_dps_meter.arena_enabled) then
f:StartForArenaMatch()
end
end
function eventListener:MythicDungeonStarted()
if (_detalhes.current_dps_meter.mythic_dungeon_enabled) then
f:StartForMythicDungeon()
end
end
function eventListener:ArenaEnded()
f:Hide()
end
function eventListener:MythicDungeonEnded()
f:Hide()
end
function eventListener:ResetBuffer()
if (f:IsShown()) then
wipe (f.PlayerTeamBuffer)
wipe (f.YellowTeamBuffer)
wipe (f.GroupBuffer)
f.GroupTotalDamage = 0
f.PlayerTeamDamage = 0
f.YellowDamage = 0
f.LastTickGroupDamage = 0
f.LastPlayerTeamDamage = 0
f.LastYellowDamage = 0
end
end
eventListener:RegisterEvent ("COMBAT_ARENA_START", "ArenaStarted")
eventListener:RegisterEvent ("COMBAT_ARENA_END", "ArenaEnded")
eventListener:RegisterEvent ("COMBAT_MYTHICDUNGEON_START", "MythicDungeonStarted")
eventListener:RegisterEvent ("COMBAT_MYTHICDUNGEON_END", "MythicDungeonEnded")
eventListener:RegisterEvent ("COMBAT_PLAYER_ENTER", "ResetBuffer")
_detalhes.Broadcaster_CurrentDpsLoaded = true
_detalhes.Broadcaster_CurrentDpsFrame = f
f:Hide()
end
File diff suppressed because it is too large Load Diff
+127
View File
@@ -0,0 +1,127 @@
local Details = _G.Details
local DetailsFramework = _G.DetailsFramework
local C_Timer = _G.C_Timer
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> dump table frame
function Details:DumpTable (t)
return Details:Dump (t)
end
function Details:Dump (t)
if (not DetailsDumpFrame) then
DetailsDumpFrame = DetailsFramework:CreateSimplePanel (_G.UIParent)
DetailsDumpFrame:SetSize (700, 600)
DetailsDumpFrame:SetTitle ("Details! Dump Table [|cFFFF3333Ready Only|r]")
local text_editor = DetailsFramework:NewSpecialLuaEditorEntry (DetailsDumpFrame, 680, 560, "Editbox", "$parentEntry", true)
text_editor:SetPoint ("topleft", DetailsDumpFrame, "topleft", 10, -30)
text_editor.scroll:SetBackdrop (nil)
text_editor.editbox:SetBackdrop (nil)
text_editor:SetBackdrop (nil)
DetailsFramework:ReskinSlider (text_editor.scroll)
if (not text_editor.__background) then
text_editor.__background = text_editor:CreateTexture (nil, "background")
end
text_editor:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
text_editor:SetBackdropBorderColor (0, 0, 0, 1)
text_editor.__background:SetColorTexture (0.2317647, 0.2317647, 0.2317647)
text_editor.__background:SetVertexColor (0.27, 0.27, 0.27)
text_editor.__background:SetAlpha (0.8)
text_editor.__background:SetVertTile (true)
text_editor.__background:SetHorizTile (true)
text_editor.__background:SetAllPoints()
end
t = t or {}
local s = Details.table.dump (t)
DetailsDumpFrame.Editbox:SetText (s)
DetailsDumpFrame:Show()
end
---------------------------------------------------------------------------------------------------------------------------------------
--> import export window
--show a window with a big text editor and 2 buttons: okay and cancel.
--cancel button always closes the window and okay calls the comfirm function passed in the argument
--default text is the text shown show the window is show()
function _detalhes:DumpString (text)
_detalhes:ShowImportWindow (text)
end
function _detalhes:ShowImportWindow (defaultText, confirmFunc, titleText)
if (not _G.DetailsExportWindow) then
local importWindow = DetailsFramework:CreateSimplePanel (_G.UIParent, 800, 610, "Details! Dump String", "DetailsExportWindow")
importWindow:SetFrameStrata ("FULLSCREEN")
importWindow:SetPoint ("center")
DetailsFramework:ApplyStandardBackdrop (importWindow, false, 1.2)
local importTextEditor = DetailsFramework:NewSpecialLuaEditorEntry (importWindow, 780, 540, "ImportEditor", "$parentEditor", true)
importTextEditor:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
importTextEditor:SetBackdropColor (.2, .2, .2, .5)
importTextEditor:SetBackdropBorderColor (0, 0, 0, 1)
importTextEditor:SetPoint ("topleft", importWindow, "topleft", 10, -30)
importTextEditor.scroll:SetBackdrop (nil)
importTextEditor.editbox:SetBackdrop (nil)
importTextEditor:SetBackdrop (nil)
DetailsFramework:ReskinSlider (importTextEditor.scroll)
if (not importTextEditor.__background) then
importTextEditor.__background = importTextEditor:CreateTexture (nil, "background")
end
importTextEditor:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
importTextEditor:SetBackdropBorderColor (0, 0, 0, 1)
importTextEditor.__background:SetColorTexture (0.2317647, 0.2317647, 0.2317647)
importTextEditor.__background:SetVertexColor (0.27, 0.27, 0.27)
importTextEditor.__background:SetAlpha (0.8)
importTextEditor.__background:SetVertTile (true)
importTextEditor.__background:SetHorizTile (true)
importTextEditor.__background:SetAllPoints()
--import button
local onClickImportButton = function()
if (_G.DetailsExportWindow.ConfirmFunction) then
DetailsFramework:Dispatch (_G.DetailsExportWindow.ConfirmFunction, importTextEditor:GetText())
end
importWindow:Hide()
end
local okayButton = DetailsFramework:CreateButton (importTextEditor, onClickImportButton, 120, 20, "Okay", -1, nil, nil, nil, nil, nil, _detalhes.gump:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), _detalhes.gump:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) --> localize-me
okayButton:SetIcon ([[Interface\BUTTONS\UI-Panel-BiggerButton-Up]], 20, 20, "overlay", {0.1, .9, 0.1, .9})
importTextEditor.OkayButton = okayButton
--cancel button
local cancelButton = DetailsFramework:CreateButton (importTextEditor, function() importWindow:Hide() end, 120, 20, "Cancel", -1, nil, nil, nil, nil, nil, _detalhes.gump:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), _detalhes.gump:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) --> localize-me
cancelButton:SetIcon ([[Interface\BUTTONS\UI-Panel-MinimizeButton-Up]], 20, 20, "overlay", {0.1, .9, 0.1, .9})
okayButton:SetPoint ("topright", importTextEditor, "bottomright", 0, -10)
cancelButton:SetPoint ("right", okayButton, "left", -20, 0)
end
_G.DetailsExportWindow.ConfirmFunction = confirmFunc
_G.DetailsExportWindow.ImportEditor:SetText (defaultText or "")
_G.DetailsExportWindow:Show()
titleText = titleText or "Details! Dump String"
_G.DetailsExportWindow.Title:SetText (titleText)
C_Timer.After (.2, function()
_G.DetailsExportWindow.ImportEditor:SetFocus (true)
_G.DetailsExportWindow.ImportEditor.editbox:HighlightText (0)
end)
end
+785
View File
@@ -0,0 +1,785 @@
local Details = _G.Details
local C_Timer = _G.C_Timer
local libwindow = LibStub("LibWindow-1.1")
function Details:OpenEventTrackerOptions (from_options_panel)
if (not _G.DetailsEventTrackerOptions) then
local DF = _detalhes.gump
local f = DF:CreateSimplePanel (_G.UIParent, 700, 400, "Details! Event Tracker Options", "DetailsEventTrackerOptions")
f:SetPoint ("center", _G.UIParent, "center")
f:SetScript ("OnMouseDown", nil)
f:SetScript ("OnMouseUp", nil)
local LibWindow = _G.LibStub("LibWindow-1.1")
LibWindow.RegisterConfig (f, _detalhes.event_tracker.options_frame)
LibWindow.MakeDraggable (f)
LibWindow.RestorePosition (f)
local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")
local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE")
local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE")
local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
--> frame strata options
local set_frame_strata = function (_, _, strata)
Details.event_tracker.frame.strata = strata
Details:UpdateEventTrackerFrame()
end
local strataTable = {}
strataTable [1] = {value = "BACKGROUND", label = "BACKGROUND", onclick = set_frame_strata}
strataTable [2] = {value = "LOW", label = "LOW", onclick = set_frame_strata}
strataTable [3] = {value = "MEDIUM", label = "MEDIUM", onclick = set_frame_strata}
strataTable [4] = {value = "HIGH", label = "HIGH", onclick = set_frame_strata}
strataTable [5] = {value = "DIALOG", label = "DIALOG", onclick = set_frame_strata}
--> font options
local set_font_shadow= function (_, _, shadow)
Details.event_tracker.font_shadow = shadow
Details:UpdateEventTrackerFrame()
end
local fontShadowTable = {}
fontShadowTable [1] = {value = "NONE", label = "None", onclick = set_font_shadow}
fontShadowTable [2] = {value = "OUTLINE", label = "Outline", onclick = set_font_shadow}
fontShadowTable [3] = {value = "THICKOUTLINE", label = "Thick Outline", onclick = set_font_shadow}
local on_select_text_font = function (self, fixed_value, value)
Details.event_tracker.font_face = value
Details:UpdateEventTrackerFrame()
end
--> texture options
local set_bar_texture = function (_, _, value)
Details.event_tracker.line_texture = value
Details:UpdateEventTrackerFrame()
end
local SharedMedia = _G.LibStub:GetLibrary ("LibSharedMedia-3.0")
local textures = SharedMedia:HashTable ("statusbar")
local texTable = {}
for name, texturePath in pairs (textures) do
texTable [#texTable + 1] = {value = name, label = name, statusbar = texturePath, onclick = set_bar_texture}
end
table.sort (texTable, function (t1, t2) return t1.label < t2.label end)
--> options table
local options = {
{type = "label", get = function() return "Frame Settings:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
--enabled
{
type = "toggle",
get = function() return Details.event_tracker.enabled end,
set = function (self, fixedparam, value)
Details.event_tracker.enabled = not Details.event_tracker.enabled
Details:LoadFramesForBroadcastTools()
end,
desc = "Enabled",
name = "Enabled",
text_template = options_text_template,
},
--locked
{
type = "toggle",
get = function() return Details.event_tracker.frame.locked end,
set = function (self, fixedparam, value)
Details.event_tracker.frame.locked = not Details.event_tracker.frame.locked
Details:UpdateEventTrackerFrame()
end,
desc = "Locked",
name = "Locked",
text_template = options_text_template,
},
--showtitle
{
type = "toggle",
get = function() return Details.event_tracker.frame.show_title end,
set = function (self, fixedparam, value)
Details.event_tracker.frame.show_title = not Details.event_tracker.frame.show_title
Details:UpdateEventTrackerFrame()
end,
desc = "Show Title",
name = "Show Title",
text_template = options_text_template,
},
--backdrop color
{
type = "color",
get = function()
return {Details.event_tracker.frame.backdrop_color[1], Details.event_tracker.frame.backdrop_color[2], Details.event_tracker.frame.backdrop_color[3], Details.event_tracker.frame.backdrop_color[4]}
end,
set = function (self, r, g, b, a)
local color = Details.event_tracker.frame.backdrop_color
color[1], color[2], color[3], color[4] = r, g, b, a
Details:UpdateEventTrackerFrame()
end,
desc = "Backdrop Color",
name = "Backdrop Color",
text_template = options_text_template,
},
--statra
{
type = "select",
get = function() return Details.event_tracker.frame.strata end,
values = function() return strataTable end,
name = "Frame Strata"
},
{type = "breakline"},
{type = "label", get = function() return "Line Settings:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
--line height
{
type = "range",
get = function() return Details.event_tracker.line_height end,
set = function (self, fixedparam, value)
Details.event_tracker.line_height = value
Details:UpdateEventTrackerFrame()
end,
min = 4,
max = 32,
step = 1,
name = "Line Height",
text_template = options_text_template,
},
--line texture
{
type = "select",
get = function() return Details.event_tracker.line_texture end,
values = function() return texTable end,
name = "Line Texture",
},
--line color
{
type = "color",
get = function()
return {Details.event_tracker.line_color[1], Details.event_tracker.line_color[2], Details.event_tracker.line_color[3], Details.event_tracker.line_color[4]}
end,
set = function (self, r, g, b, a)
local color = Details.event_tracker.line_color
color[1], color[2], color[3], color[4] = r, g, b, a
Details:UpdateEventTrackerFrame()
end,
desc = "Line Color",
name = "Line Color",
text_template = options_text_template,
},
--font size
{
type = "range",
get = function() return Details.event_tracker.font_size end,
set = function (self, fixedparam, value)
Details.event_tracker.font_size = value
Details:UpdateEventTrackerFrame()
end,
min = 4,
max = 32,
step = 1,
name = "Font Size",
text_template = options_text_template,
},
--font color
{
type = "color",
get = function()
return {Details.event_tracker.font_color[1], Details.event_tracker.font_color[2], Details.event_tracker.font_color[3], Details.event_tracker.font_color[4]}
end,
set = function (self, r, g, b, a)
local color = Details.event_tracker.font_color
color[1], color[2], color[3], color[4] = r, g, b, a
Details:UpdateEventTrackerFrame()
end,
desc = "Font Color",
name = "Font Color",
text_template = options_text_template,
},
--font shadow
{
type = "select",
get = function() return Details.event_tracker.font_shadow end,
values = function() return fontShadowTable end,
name = "Font Shadow"
},
--font face
{
type = "select",
get = function() return Details.event_tracker.font_face end,
values = function() return DF:BuildDropDownFontList (on_select_text_font) end,
name = "Font Face",
text_template = options_text_template,
},
}
DF:BuildMenu (f, options, 7, -30, 500, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
f:SetScript ("OnHide", function()
--> reopen the options panel
if (f.FromOptionsPanel) then
C_Timer.After (0.2, function()
Details:OpenOptionsWindow(Details:GetInstance(1))
end)
end
end)
end
_G.DetailsEventTrackerOptions:RefreshOptions()
_G.DetailsEventTrackerOptions:Show()
_G.DetailsEventTrackerOptions.FromOptionsPanel = from_options_panel
end
function Details:CreateEventTrackerFrame(parent, name)
local DF = _detalhes.gump
local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
--> main farame
local f = CreateFrame ("frame", name, parent or UIParent,"BackdropTemplate")
f:SetPoint ("center", UIParent, "center")
f:SetMinResize (150, 40)
f:SetMaxResize (800, 1024)
f:SetSize (_detalhes.event_tracker.frame.width, _detalhes.event_tracker.frame.height)
f:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}})
f:SetBackdropColor (unpack (_detalhes.event_tracker.frame.backdrop_color))
f:EnableMouse (true)
f:SetMovable (true)
f:SetResizable (true)
f:SetClampedToScreen (true)
local LibWindow = LibStub ("LibWindow-1.1")
LibWindow.RegisterConfig (f, _detalhes.event_tracker.frame)
LibWindow.MakeDraggable (f)
LibWindow.RestorePosition (f)
--> two resizers
local left_resize, right_resize = DF:CreateResizeGrips (f)
left_resize:SetScript ("OnMouseDown", function (self)
if (not f.resizing and not _detalhes.event_tracker.frame.locked) then
f.resizing = true
f:StartSizing ("bottomleft")
end
end)
left_resize:SetScript ("OnMouseUp", function (self)
if (f.resizing) then
f.resizing = false
f:StopMovingOrSizing()
_detalhes.event_tracker.frame.width = f:GetWidth()
_detalhes.event_tracker.frame.height = f:GetHeight()
end
end)
right_resize:SetScript ("OnMouseDown", function (self)
if (not f.resizing and not _detalhes.event_tracker.frame.locked) then
f.resizing = true
f:StartSizing ("bottomright")
end
end)
right_resize:SetScript ("OnMouseUp", function (self)
if (f.resizing) then
f.resizing = false
f:StopMovingOrSizing()
_detalhes.event_tracker.frame.width = f:GetWidth()
_detalhes.event_tracker.frame.height = f:GetHeight()
end
end)
f:SetScript ("OnSizeChanged", function (self)
end)
--> scroll frame
--> frame config
local scroll_line_amount = 1
local scroll_width = 195
local header_size = 20
--> on tick script
local lineOnTick = function (self, deltaTime)
--> when this event occured on combat log
local gameTime = self.GameTime
--> calculate how much time elapsed since the event got triggered
local elapsedTime = GetTime() - gameTime
--> set the bar animation:
local animationPercent = min (elapsedTime, 1)
self.Statusbar:SetValue (animationPercent)
--> set the spark location
if (animationPercent < 1) then
self.Spark:SetPoint ("left", self, "left", (self:GetWidth() * animationPercent) - 10, 0)
if (not self.Spark:IsShown()) then
self.Spark:Show()
end
else
if (self.Spark:IsShown()) then
self.Spark:Hide()
end
end
end
--> create a line on the scroll frame
local scroll_createline = function (self, index)
local line = CreateFrame ("frame", "$parentLine" .. index, self,"BackdropTemplate")
line:EnableMouse (false)
line.Index = index --> hack to not trigger error on UpdateWorldTrackerLines since Index is set after this function is ran
--> set its backdrop
line:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}})
--line:SetBackdropColor (1, 1, 1, 0.75)
--> statusbar
local statusbar = CreateFrame ("statusbar", "$parentStatusBar", line,"BackdropTemplate")
statusbar:SetAllPoints()
local statusbartexture = statusbar:CreateTexture (nil, "border")
statusbar:SetStatusBarTexture (statusbartexture)
statusbar:SetMinMaxValues (0, 1)
statusbar:SetValue (0)
local statusbarspark = statusbar:CreateTexture (nil, "artwork")
statusbarspark:SetTexture ([[Interface\CastingBar\UI-CastingBar-Spark]])
statusbarspark:SetSize (16, 30)
statusbarspark:SetBlendMode ("ADD")
statusbarspark:Hide()
--> create the icon textures and texts - they are all statusbar childs
local lefticon = statusbar:CreateTexture ("$parentLeftIcon", "overlay")
lefticon:SetPoint ("left", line, "left", 0, 0)
local righticon = statusbar:CreateTexture ("$parentRightIcon", "overlay")
righticon:SetPoint ("right", line, "right", 0, 0)
local lefttext = statusbar:CreateFontString ("$parentLeftText", "overlay", "GameFontNormal")
DF:SetFontSize (lefttext, 9)
lefttext:SetPoint ("left", lefticon, "right", 2, 0)
local righttext = statusbar:CreateFontString ("$parentRightText", "overlay", "GameFontNormal")
DF:SetFontSize (righttext, 9)
righttext:SetPoint ("right", righticon, "left", -2, 0)
lefttext:SetJustifyH ("left")
righttext:SetJustifyH ("right")
local actionicon = statusbar:CreateTexture ("$parentRightIcon", "overlay")
actionicon:SetPoint ("center", line, "center")
--> set members
line.LeftIcon = lefticon
line.RightIcon = righticon
line.LeftText = lefttext
line.RightText = righttext
line.Statusbar = statusbar
line.StatusbarTexture = statusbartexture
line.Spark = statusbarspark
line.ActionIcon = actionicon
--> set some parameters
_detalhes:UpdateWorldTrackerLines (line)
--> set scripts
line:SetScript ("OnUpdate", lineOnTick)
return line
end
--> some consts to help work with indexes
local SPELLTYPE_COOLDOWN = "cooldown"
local SPELLTYPE_INTERRUPT = "interrupt"
local SPELLTYPE_OFFENSIVE = "offensive"
local SPELLTYPE_CROWDCONTROL = "crowdcontrol"
local ABILITYTABLE_SPELLTYPE = 1
local ABILITYTABLE_SPELLID = 2
local ABILITYTABLE_CASTERNAME = 3
local ABILITYTABLE_TARGETNAME = 4
local ABILITYTABLE_TIME = 5
local ABILITYTABLE_EXTRASPELLID = 6
local ABILITYTABLE_GAMETIME = 7
local ABILITYTABLE_CASTERSERIAL = 8
local ABILITYTABLE_ISENEMY = 9
local ABILITYTABLE_TARGETSERIAL = 10
local get_spec_or_class = function (serial, name)
local class
local spec = _detalhes.cached_specs [serial]
if (not spec) then
local _, engClass = UnitClass (name)
if (engClass) then
class = engClass
else
local locClass, engClass, locRace, engRace, gender = GetPlayerInfoByGUID (serial)
if (engClass) then
class = engClass
end
end
end
return spec, class
end
local get_player_icon = function (spec, class)
if (spec) then
return [[Interface\AddOns\Details\images\spec_icons_normal]], unpack (_detalhes.class_specs_coords [spec])
elseif (class) then
return [[Interface\AddOns\Details\images\classes_small]], unpack (_detalhes.class_coords [class])
else
return [[Interface\AddOns\Details\images\classes_plus]], 0.50390625, 0.62890625, 0, 0.125
end
end
local add_role_and_class_color = function (player_name, player_serial)
--> get the actor object
local actor = _detalhes.tabela_vigente[1]:GetActor (player_name)
if (actor) then
--> remove realm name
player_name = _detalhes:GetOnlyName (player_name)
local class, spec, role = actor.classe, actor.spec, actor.role
if (not class) then
spec, class = get_spec_or_class (player_serial, player_name)
end
--> add the class color
if (_detalhes.player_class [class]) then
--> is a player, add the class color
player_name = _detalhes:AddColorString (player_name, class)
end
--add the role icon
if (role ~= "NONE") then
--> have a role
player_name = _detalhes:AddRoleIcon (player_name, role, _detalhes.event_tracker.line_height)
end
else
local spec, class = get_spec_or_class (player_serial, player_name)
player_name = _detalhes:GetOnlyName (player_name)
if (class) then
--> add the class color
if (_detalhes.player_class [class]) then
--> is a player, add the class color
player_name = _detalhes:AddColorString (player_name, class)
end
end
end
return player_name
end
local get_text_size = function()
local iconsSpace = _detalhes.event_tracker.line_height * 3
local textSpace = 4
local saveSpace = 14
local availableSpace = (f:GetWidth() - iconsSpace - textSpace - saveSpace) / 2
return availableSpace
end
local shrink_string = function (fontstring, size)
local text = fontstring:GetText()
local loops = 20
while (fontstring:GetStringWidth() > size and loops > 0) do
text = strsub (text, 1, #text-1)
fontstring:SetText (text)
loops = loops - 1
end
return fontstring
end
--refresh the scroll frame
local scroll_refresh = function (self, data, offset, total_lines)
local textSize = get_text_size()
for i = 1, total_lines do
local index = i + offset
local ability = data [index]
if (ability) then
local line = self:GetLine (i)
local spec, class = get_spec_or_class (ability [ABILITYTABLE_CASTERSERIAL], ability [ABILITYTABLE_CASTERNAME])
local texture, L, R, T, B = get_player_icon (spec, class)
line.LeftIcon:SetTexture (texture)
line.LeftIcon:SetTexCoord (L, R, T, B)
line.LeftText:SetText (_detalhes:GetOnlyName (ability [ABILITYTABLE_CASTERNAME]))
if (ability [ABILITYTABLE_ISENEMY]) then
line:SetBackdropColor (1, .3, .3, 0.5)
else
line:SetBackdropColor (1, 1, 1, 0.5)
end
if (ability [ABILITYTABLE_SPELLTYPE] == SPELLTYPE_COOLDOWN) then
local spellName, _, spellIcon = GetSpellInfo (ability [ABILITYTABLE_SPELLID])
line.RightIcon:SetTexture (spellIcon)
line.RightIcon:SetTexCoord (.06, .94, .06, .94)
local targetName = ability [ABILITYTABLE_TARGETNAME]
if (targetName) then
local targetSerial = ability [ABILITYTABLE_TARGETSERIAL]
targetName = add_role_and_class_color (targetName, targetSerial)
end
line.RightText:SetText (targetName or spellName)
line.ActionIcon:SetTexture ([[Interface\AddOns\Details\images\event_tracker_icons]])
line.ActionIcon:SetTexCoord (0, 0.125, 0, 1)
elseif (ability [ABILITYTABLE_SPELLTYPE] == SPELLTYPE_OFFENSIVE) then
local spellName, _, spellIcon = GetSpellInfo (ability [ABILITYTABLE_SPELLID])
line.RightIcon:SetTexture (spellIcon)
line.RightIcon:SetTexCoord (.06, .94, .06, .94)
line.RightText:SetText (spellName)
line.ActionIcon:SetTexture ([[Interface\AddOns\Details\images\event_tracker_icons]])
line.ActionIcon:SetTexCoord (0.127, 0.25, 0, 1)
elseif (ability [ABILITYTABLE_SPELLTYPE] == SPELLTYPE_INTERRUPT) then
local spellNameInterrupted, _, spellIconInterrupted = GetSpellInfo (ability [ABILITYTABLE_EXTRASPELLID])
line.RightIcon:SetTexture (spellIconInterrupted)
line.RightIcon:SetTexCoord (.06, .94, .06, .94)
line.RightText:SetText (spellNameInterrupted)
line.ActionIcon:SetTexture ([[Interface\AddOns\Details\images\event_tracker_icons]])
line.ActionIcon:SetTexCoord (0.251, 0.375, 0, 1)
elseif (ability [ABILITYTABLE_SPELLTYPE] == SPELLTYPE_CROWDCONTROL) then
local spellName, _, spellIcon = GetSpellInfo (ability [ABILITYTABLE_SPELLID])
line.RightIcon:SetTexture (spellIcon)
line.RightIcon:SetTexCoord (.06, .94, .06, .94)
local targetName = ability [ABILITYTABLE_TARGETNAME]
if (targetName) then
local targetSerial = ability [ABILITYTABLE_TARGETSERIAL]
targetName = add_role_and_class_color (targetName, targetSerial)
end
line.RightText:SetText (targetName or "unknown target")
line.ActionIcon:SetTexture ([[Interface\AddOns\Details\images\event_tracker_icons]])
line.ActionIcon:SetTexCoord (0.376, 0.5, 0, 1)
end
shrink_string (line.LeftText, textSize)
shrink_string (line.RightText, textSize)
--> set when the ability was registered on combat log
line.GameTime = ability [ABILITYTABLE_GAMETIME]
line:Show()
end
end
end
--title text
local TitleString = f:CreateFontString (nil, "overlay", "GameFontNormal")
TitleString:SetPoint ("top", f, "top", 0, -3)
TitleString:SetText ("Details!: Event Tracker")
local TitleBackground = f:CreateTexture (nil, "artwork")
TitleBackground:SetTexture ([[Interface\Tooltips\UI-Tooltip-Background]])
TitleBackground:SetVertexColor (.1, .1, .1, .9)
TitleBackground:SetPoint ("topleft", f, "topleft")
TitleBackground:SetPoint ("topright", f, "topright")
TitleBackground:SetHeight (header_size)
--> table with spells showing on the scroll frame
local CurrentShowing = {}
--> scrollframe
local scrollframe = DF:CreateScrollBox (f, "$parentScrollFrame", scroll_refresh, CurrentShowing, scroll_width, 400, scroll_line_amount, _detalhes.event_tracker.line_height, scroll_createline, true, true)
scrollframe:SetPoint ("topleft", f, "topleft", 0, -header_size)
scrollframe:SetPoint ("topright", f, "topright", 0, -header_size)
scrollframe:SetPoint ("bottomleft", f, "bottomleft", 0, 0)
scrollframe:SetPoint ("bottomright", f, "bottomright", 0, 0)
--> update line - used by 'UpdateWorldTrackerLines' function
local update_line = function (line)
--> get the line index
local index = line.Index
--> update left text
DF:SetFontColor (line.LeftText, _detalhes.event_tracker.font_color)
DF:SetFontFace (line.LeftText, _detalhes.event_tracker.font_face)
DF:SetFontSize (line.LeftText, _detalhes.event_tracker.font_size)
DF:SetFontOutline (line.LeftText, _detalhes.event_tracker.font_shadow)
--> update right text
DF:SetFontColor (line.RightText, _detalhes.event_tracker.font_color)
DF:SetFontFace (line.RightText, _detalhes.event_tracker.font_face)
DF:SetFontSize (line.RightText, _detalhes.event_tracker.font_size)
DF:SetFontOutline (line.RightText, _detalhes.event_tracker.font_shadow)
--> adjust where the line is anchored
line:SetPoint ("topleft", line:GetParent(), "topleft", 0, -((index-1)*(_detalhes.event_tracker.line_height+1)))
line:SetPoint ("topright", line:GetParent(), "topright", 0, -((index-1)*(_detalhes.event_tracker.line_height+1)))
--> set its height
line:SetHeight (_detalhes.event_tracker.line_height)
--> set texture
local texture = SharedMedia:Fetch ("statusbar", _detalhes.event_tracker.line_texture)
line.StatusbarTexture:SetTexture (texture)
line.StatusbarTexture:SetVertexColor (unpack (_detalhes.event_tracker.line_color))
--> set icon size
line.LeftIcon:SetSize (_detalhes.event_tracker.line_height, _detalhes.event_tracker.line_height)
line.RightIcon:SetSize (_detalhes.event_tracker.line_height, _detalhes.event_tracker.line_height)
line.ActionIcon:SetSize (_detalhes.event_tracker.line_height-4, _detalhes.event_tracker.line_height-4)
line.ActionIcon:SetAlpha (0.65)
end
-- /run _detalhes.event_tracker.font_shadow = 24
-- /run _detalhes:UpdateWorldTrackerLines()
function _detalhes:UpdateWorldTrackerLines (line)
--> don't run if the featured hasn't loaded
if (not f) then
return
end
if (line) then
update_line (line)
else
--> update all lines
for index, line in ipairs (scrollframe:GetFrames()) do
update_line (line)
end
scrollframe:SetFramesHeight (_detalhes.event_tracker.line_height)
scrollframe:Refresh()
end
end
function _detalhes:UpdateEventTrackerFrame()
--> don't run if the featured hasn't loaded
if (not f) then
return
end
f:SetSize (_detalhes.event_tracker.frame.width, _detalhes.event_tracker.frame.height)
LibWindow.RegisterConfig (f, _detalhes.event_tracker.frame)
LibWindow.RestorePosition (f)
scrollframe:OnSizeChanged()
if (_detalhes.event_tracker.frame.locked) then
f:EnableMouse (false)
left_resize:Hide()
right_resize:Hide()
else
f:EnableMouse (true)
left_resize:Show()
right_resize:Show()
end
if (_detalhes.event_tracker.frame.show_title) then
TitleString:Show()
TitleBackground:Show()
scrollframe:SetPoint ("topleft", f, "topleft", 0, -header_size)
scrollframe:SetPoint ("topright", f, "topright", 0, -header_size)
else
TitleString:Hide()
TitleBackground:Hide()
scrollframe:SetPoint ("topleft", f, "topleft", 0, 0)
scrollframe:SetPoint ("topright", f, "topright", 0, 0)
end
f:SetBackdropColor (unpack (_detalhes.event_tracker.frame.backdrop_color))
scrollframe.__background:SetVertexColor (unpack (_detalhes.event_tracker.frame.backdrop_color))
f:SetFrameStrata (_detalhes.event_tracker.frame.strata)
_detalhes:UpdateWorldTrackerLines()
scrollframe:Refresh()
end
--create the first line
for i = 1, 1 do
scrollframe:CreateLine (scroll_createline)
end
f.scrollframe = scrollframe
scrollframe:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16})
scrollframe:SetBackdropColor (0, 0, 0, 0)
--> get tables used inside the combat parser
local cooldownListFromFramework = DetailsFramework.CooldownsAllDeffensive
local attackCooldownsFromFramework = DetailsFramework.CooldownsAttack
local crowdControlFromFramework = DetailsFramework.CrowdControlSpells
local combatLog = CreateFrame ("frame")
combatLog:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
local OBJECT_TYPE_PLAYER = 0x00000400
local OBJECT_TYPE_ENEMY = 0x00000040
--> combat parser
local is_player = function (flag)
if (not flag) then
return false
end
return bit.band (flag, OBJECT_TYPE_PLAYER) ~= 0
end
local is_enemy = function (flag)
if (not flag) then
return false
end
return bit.band (flag, OBJECT_TYPE_ENEMY) ~= 0
end
combatLog:SetScript ("OnEvent", function (self, event)
local time, token, hidding, caster_serial, caster_name, caster_flags, caster_flags2, target_serial, target_name, target_flags, target_flags2, spellid, spellname, spelltype, extraSpellID, extraSpellName, extraSchool = CombatLogGetCurrentEventInfo()
local added = false
--> defensive cooldown
if (token == "SPELL_CAST_SUCCESS" and (cooldownListFromFramework [spellid]) and is_player (caster_flags)) then
tinsert (CurrentShowing, 1, {SPELLTYPE_COOLDOWN, spellid, caster_name, target_name, time, false, GetTime(), caster_serial, is_enemy (caster_flags), target_serial})
added = true
--> offensive cooldown
elseif (token == "SPELL_CAST_SUCCESS" and (attackCooldownsFromFramework [spellid]) and is_player (caster_flags)) then
tinsert (CurrentShowing, 1, {SPELLTYPE_OFFENSIVE, spellid, caster_name, target_name, time, false, GetTime(), caster_serial, is_enemy (caster_flags), target_serial})
added = true
--> crowd control
elseif (token == "SPELL_AURA_APPLIED" and (crowdControlFromFramework [spellid])) then
--check if isnt a pet
if (target_flags and is_player (target_flags)) then
tinsert (CurrentShowing, 1, {SPELLTYPE_CROWDCONTROL, spellid, caster_name, target_name, time, false, GetTime(), caster_serial, is_enemy (caster_flags), target_serial})
added = true
end
--> spell interrupt
elseif (token == "SPELL_INTERRUPT") then
tinsert (CurrentShowing, 1, {SPELLTYPE_INTERRUPT, spellid, caster_name, target_name, time, extraSpellID, GetTime(), caster_serial, is_enemy (caster_flags), target_serial})
added = true
end
if (added) then
local amountOfLines = scrollframe:GetNumFramesShown()
local amountToShow = #CurrentShowing
if (amountToShow > amountOfLines) then
tremove (CurrentShowing, amountToShow)
end
scrollframe:Refresh()
end
end)
_detalhes.Broadcaster_EventTrackerLoaded = true
_detalhes.Broadcaster_EventTrackerFrame = f
f:Hide()
end
File diff suppressed because it is too large Load Diff
+146
View File
@@ -0,0 +1,146 @@
local Details = _G.Details
local DF = _G.DetailsFramework
function Details:InitializeMacrosWindow()
local DetailsMacrosPanel = DF:CreateSimplePanel (UIParent, 700, 480, "Details! Useful Macros", "DetailsMacrosPanel")
DetailsMacrosPanel.Frame = DetailsMacrosPanel
DetailsMacrosPanel.__name = "Macros"
DetailsMacrosPanel.real_name = "DETAILS_MACROSWINDOW"
DetailsMacrosPanel.__icon = [[Interface\MacroFrame\MacroFrame-Icon]]
DetailsMacrosPanel.__iconcoords = {0, 1, 0, 1}
DetailsMacrosPanel.__iconcolor = "white"
DetailsPluginContainerWindow.EmbedPlugin (DetailsMacrosPanel, DetailsMacrosPanel, true)
function DetailsMacrosPanel.RefreshWindow()
Details.OpenMacrosWindow()
end
DetailsMacrosPanel:Hide()
end
function Details.OpenMacrosWindow()
if (not DetailsMacrosPanel or not DetailsMacrosPanel.Initialized) then
DetailsMacrosPanel.Initialized = true
local f = DetailsMacrosPanel or DF:CreateSimplePanel (UIParent, 700, 480, "Details! Useful Macros", "DetailsMacrosPanel")
local scrollbox_line_backdrop_color = {0, 0, 0, 0.2}
local scrollbox_line_backdrop_color_onenter = {.3, .3, .3, 0.5}
local scrollbox_lines = 7
local scrollbox_line_height = 79.5
local scrollbox_size = {890, 563}
f.bg1 = f:CreateTexture (nil, "background")
f.bg1:SetTexture ([[Interface\AddOns\Details\images\background]], true)
f.bg1:SetAlpha (0.8)
f.bg1:SetVertexColor (0.27, 0.27, 0.27)
f.bg1:SetVertTile (true)
f.bg1:SetHorizTile (true)
f.bg1:SetSize (790, 454)
f.bg1:SetAllPoints()
f:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true})
f:SetBackdropColor (.5, .5, .5, .7)
f:SetBackdropBorderColor (0, 0, 0, 1)
local macrosAvailable = Details.MacroList
local OnEnterMacroButton = function (self)
self:SetBackdropColor (unpack (scrollbox_line_backdrop_color_onenter))
end
local onLeaveMacroButton = function (self)
self:SetBackdropColor (unpack (scrollbox_line_backdrop_color))
end
local updateMacroLine = function (self, index, title, desc, macroText)
self.Title:SetText (title)
self.Desc:SetText (desc)
self.MacroTextEntry:SetText (macroText)
end
local textEntryOnFocusGained = function (self)
self:HighlightText()
end
local textEntryOnFocusLost = function (self)
self:HighlightText (0, 0)
end
local refreshMacroScrollbox = function (self, data, offset, totalLines)
for i = 1, totalLines do
local index = i + offset
local macro = macrosAvailable [index]
if (macro) then
local line = self:GetLine (i)
line:UpdateLine (index, macro.Name, macro.Desc, macro.MacroText)
end
end
end
local macroListCreateLine = function (self, index)
--create a new line
local line = CreateFrame ("button", "$parentLine" .. index, self,"BackdropTemplate")
--set its parameters
line:SetPoint ("topleft", self, "topleft", 0, -((index-1) * (scrollbox_line_height+1)))
line:SetSize (scrollbox_size[1], scrollbox_line_height)
line:SetScript ("OnEnter", OnEnterMacroButton)
line:SetScript ("OnLeave", onLeaveMacroButton)
line:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
line:SetBackdropColor (unpack (scrollbox_line_backdrop_color))
line:SetBackdropBorderColor (0, 0, 0, 0.3)
local titleLabel = DF:CreateLabel (line, "", DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE"))
titleLabel.textsize = 14
titleLabel.textcolor = "yellow"
local descLabel = DF:CreateLabel (line, "", DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE"))
descLabel.textsize = 12
local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
options_dropdown_template = DF.table.copy ({}, options_dropdown_template)
options_dropdown_template.backdropcolor = {.51, .51, .51, .3}
options_dropdown_template.onenterbordercolor = {.51, .51, .51, .2}
local textEntry = DF:CreateTextEntry (line, function()end, scrollbox_size[1] - 10, 40, "MacroTextEntry", _, _, options_dropdown_template)
textEntry:SetHook ("OnEditFocusGained", textEntryOnFocusGained)
textEntry:SetHook ("OnEditFocusLost", textEntryOnFocusLost)
textEntry:SetJustifyH ("left")
textEntry:SetTextInsets (8, 8, 0, 0)
titleLabel:SetPoint ("topleft", line, "topleft", 5, -5)
descLabel:SetPoint ("topleft", titleLabel, "bottomleft", 0, -2)
textEntry:SetPoint ("topleft", descLabel, "bottomleft", 0, -4)
line.Title = titleLabel
line.Desc = descLabel
line.MacroTextEntry = textEntry
line.UpdateLine = updateMacroLine
line:Hide()
return line
end
local macroScrollbox = DF:CreateScrollBox (f, "$parentMacroScrollbox", refreshMacroScrollbox, macrosAvailable, scrollbox_size[1], scrollbox_size[2], scrollbox_lines, scrollbox_line_height)
macroScrollbox:SetPoint ("topleft", f, "topleft", 5, -30)
macroScrollbox:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
macroScrollbox:SetBackdropColor (0, 0, 0, 0)
macroScrollbox:SetBackdropBorderColor (0, 0, 0, 1)
f.MacroScrollbox = macroScrollbox
DF:ReskinSlider (macroScrollbox)
macroScrollbox.__background:Hide()
--create the scrollbox lines
for i = 1, scrollbox_lines do
macroScrollbox:CreateLine (macroListCreateLine)
end
end
DetailsPluginContainerWindow.OpenPlugin (DetailsMacrosPanel)
DetailsMacrosPanel.MacroScrollbox:Refresh()
DetailsMacrosPanel:Show()
end
File diff suppressed because it is too large Load Diff
+169
View File
@@ -0,0 +1,169 @@
local Details = _G.Details
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
local g = Details.gump
local _
function Details:OpenNewsWindow(textToShow, dumpValues, keeptext)
Details.latest_news_saw = Details.userversion
local newsFrame = Details:CreateOrOpenNewsWindow()
if (dumpValues == "change_log" or textToShow == "LeftButton") then
newsFrame:Text (Loc ["STRING_VERSION_LOG"])
--newsFrame:Icon ([[Interface\AddOns\Details\images\icons2]], {108/512, 189/512, 319/512, 400/512})
newsFrame:Show()
return
end
if (textToShow and type (textToShow) == "table") then
DetailsNewsWindowLower:SetSize (450, 5000)
DetailsNewsWindowSlider:SetMinMaxValues (0, 5000)
DetailsNewsWindowText:SetHeight (5000)
local s = ""
for _, text in ipairs (textToShow) do
if (type (text) == "string" or type (text) == "number") then
s = s .. text .. "\n"
end
end
if (dumpValues) then
s = Details.table.dump (textToShow)
end
if (keeptext) then
newsFrame:Text ((DetailsNewsWindowText:GetText() or "") .. "\n\n" .. s)
else
if (dumpValues) then
newsFrame.DumpTableFrame:SetText (s)
else
newsFrame:Text (s)
end
end
else
if (keeptext) then
newsFrame:Text ((DetailsNewsWindowText:GetText() or "") .. "\n\n" .. (textToShow or Loc ["STRING_VERSION_LOG"]))
else
newsFrame:Text (textToShow or Loc["STRING_VERSION_LOG"])
end
end
newsFrame:Show()
end
function Details:CreateOrOpenNewsWindow()
local frame = _G.DetailsNewsWindow
if (not frame) then
--build news frame
frame = DetailsFramework:CreateSimplePanel(UIParent, 480, 460, "Details! Damage Meter " .. Details.version, "DetailsNewsWindow", panel_options, db)
tinsert(UISpecialFrames, "DetailsNewsWindow")
frame:SetPoint("left", UIParent, "left", 10, 0)
frame:SetFrameStrata("FULLSCREEN")
frame:SetMovable(true)
frame:Hide()
local dumpFrame = g:CreateTextEntry(frame, function()end, 500, 512, "DumpTable", "$parentDumpTable")
dumpFrame.editbox:SetMultiLine (true)
dumpFrame:SetPoint("topleft", frame, "topleft", 8, -68)
dumpFrame:SetBackdrop(nil)
dumpFrame.editbox:SetBackdrop(nil)
dumpFrame.editbox:SetJustifyH("left")
dumpFrame.editbox:SetJustifyV("top")
frame.DumpTableFrame = dumpFrame
local frame_upper = CreateFrame("scrollframe", nil, frame, "BackdropTemplate")
local frame_lower = CreateFrame("frame", "DetailsNewsWindowLower", frame_upper, "BackdropTemplate")
frame_lower:SetSize (450, 2000)
frame_upper:SetPoint ("topleft", frame, "topleft", 10, -30)
frame_upper:SetWidth(445)
frame_upper:SetHeight(400)
frame_upper:SetBackdrop({
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
tile = true, tileSize = 16,
insets = {left = 1, right = 1, top = 0, bottom = 1},})
frame_upper:SetBackdropColor (.1, .1, .1, .3)
frame_upper:SetScrollChild (frame_lower)
local slider = CreateFrame ("slider", "DetailsNewsWindowSlider", frame, "BackdropTemplate")
slider.bg = slider:CreateTexture (nil, "background")
slider.bg:SetAllPoints (true)
slider.bg:SetTexture (0, 0, 0, 0.5)
slider.thumb = slider:CreateTexture (nil, "OVERLAY")
slider.thumb:SetTexture ("Interface\\Buttons\\UI-ScrollBar-Knob")
slider.thumb:SetSize (25, 25)
slider:SetThumbTexture (slider.thumb)
slider:SetOrientation ("vertical");
slider:SetSize (16, 399)
slider:SetPoint ("topleft", frame_upper, "topright")
slider:SetMinMaxValues (0, 2000)
slider:SetValue(0)
slider:SetScript("OnValueChanged", function (self)
frame_upper:SetVerticalScroll (self:GetValue())
end)
frame_upper:EnableMouseWheel (true)
frame_upper:SetScript("OnMouseWheel", function (self, delta)
local current = slider:GetValue()
if (IsShiftKeyDown() and (delta > 0)) then
slider:SetValue(0)
elseif (IsShiftKeyDown() and (delta < 0)) then
slider:SetValue (2000)
elseif ((delta < 0) and (current < 2000)) then
slider:SetValue (current + 20)
elseif ((delta > 0) and (current > 1)) then
slider:SetValue (current - 20)
end
end)
--> text box
local texto = frame_lower:CreateFontString("DetailsNewsWindowText", "overlay", "GameFontNormal")
texto:SetPoint("topleft", frame_lower, "topleft")
texto:SetJustifyH("left")
texto:SetJustifyV("top")
texto:SetTextColor(1, 1, 1)
texto:SetWidth(450)
texto:SetHeight(2500)
local statusBar = CreateFrame("frame", nil, frame, "BackdropTemplate")
statusBar:SetPoint("bottomleft", frame, "bottomleft")
statusBar:SetPoint("bottomright", frame, "bottomright")
statusBar:SetHeight(20)
local onToggleAutoOpen = function(_, _, state)
Details.auto_open_news_window = state
end
local autoOpenCheckbox = DetailsFramework:CreateSwitch(statusBar, onToggleAutoOpen, Details.auto_open_news_window, _, _, _, _, "AutoOpenCheckbox", _, _, _, _, _, DetailsFramework:GetTemplate ("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"))
autoOpenCheckbox:SetAsCheckBox()
autoOpenCheckbox:SetPoint("left", statusBar, "left", 2, 0)
local autoOpenText = DetailsFramework:CreateLabel(statusBar, "Auto Open on New Changes")
autoOpenText:SetPoint("left", autoOpenCheckbox, "right", 2, 0)
DetailsFramework:ApplyStandardBackdrop(statusBar)
statusBar:SetAlpha (0.8)
DetailsFramework:BuildStatusbarAuthorInfo(statusBar, "", "")
statusBar.authorName:SetPoint ("left", statusBar, "left", 207, 0)
function frame:Title (title)
frame:SetTitle(title or "")
end
function frame:Text (text)
texto:SetText (text or "")
end
frame:Hide()
end
return frame
end
+315
View File
@@ -0,0 +1,315 @@
if (true) then
--return
end
local Details = _G.Details
local DF = _G.DetailsFramework
local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details")
local SharedMedia = _G.LibStub:GetLibrary("LibSharedMedia-3.0")
local LDB = _G.LibStub ("LibDataBroker-1.1", true)
local LDBIcon = LDB and _G.LibStub("LibDBIcon-1.0", true)
--options panel namespace
Details.options = {}
local tinsert = _G.tinsert
local unpack = _G.unpack
local CreateFrame = _G.CreateFrame
local UIParent = _G.UIParent
local _
local preset_version = 3
Details.preset_version = preset_version
--templates
local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")
local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE")
local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE")
local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
local options_button_template_selected = DF.table.copy({}, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"))
options_button_template_selected.backdropbordercolor = {1, .8, .2}
--options
local section_menu_button_width = 120
local section_menu_button_height = 20
--build the options window
function Details:InitializeOptionsWindow(instance)
return Details.options.InitializeOptionsWindow(instance)
end
function Details.options.InitializeOptionsWindow(instance)
local DetailsOptionsWindow = DF:NewPanel(UIParent, _, "DetailsOptionsWindow", _, 897, 592)
local f = DetailsOptionsWindow.frame
f.Frame = f
f.__name = "Options"
f.real_name = "DETAILS_OPTIONS"
f.__icon = [[Interface\Scenarios\ScenarioIcon-Interact]]
_G.DetailsPluginContainerWindow.EmbedPlugin (f, f, true)
f.sectionFramesContainer = {}
Details:FormatBackground(f)
DF:ApplyStandardBackdrop (f)
local titleBar = DF:CreateTitleBar (f, "Options Panel")
titleBar.Text:Hide()
local titleText = DF:NewLabel(titleBar, nil, "$parentTitleLabel", "title", "Details! " .. Loc ["STRING_OPTIONS_WINDOW"], "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255})
titleText:SetPoint("center", titleBar, "center")
--titleText:SetPoint("top", f, "top", 0, -8)
f:Hide()
DF:CreateScaleBar(DetailsOptionsWindow, Details.options_window)
DetailsOptionsWindow:SetScale (Details.options_window.scale)
local closeButton = CreateFrame("button", "DetailsOptionsWindowCloseButton", DetailsOptionsWindow.widget, "UIPanelCloseButton")
closeButton:SetWidth(32)
closeButton:SetHeight(32)
--closeButton:SetPoint("TOPRIGHT", DetailsOptionsWindow.widget, "TOPRIGHT", 0, 0)
closeButton:SetText("X")
closeButton:SetFrameLevel(closeButton:GetFrameLevel()+2)
--select the instance to edit
local onSelectInstance = function (_, _, instanceId)
local instance = _detalhes.tabela_instancias[instanceId]
if (not instance:IsEnabled() or not instance:IsStarted()) then
_detalhes.CriarInstancia (_, _, instance.meu_id)
end
Details.options.SetCurrentInstance(instance)
f.updateMicroFrames()
end
local buildInstanceMenu = function()
local instanceList = {}
for index = 1, math.min (#_detalhes.tabela_instancias, _detalhes.instances_amount) do
local instance = _detalhes.tabela_instancias[index]
--what the window is showing
local atributo = instance.atributo
local sub_atributo = instance.sub_atributo
if (atributo == 5) then --custom
local CustomObject = _detalhes.custom [sub_atributo]
if (not CustomObject) then
instance:ResetAttribute()
atributo = instance.atributo
sub_atributo = instance.sub_atributo
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. _detalhes.atributos.lista [atributo] .. " - " .. _detalhes.sub_atributos [atributo].lista [sub_atributo], onclick = onSelectInstance, icon = _detalhes.sub_atributos [atributo].icones[sub_atributo] [1], texcoord = _detalhes.sub_atributos [atributo].icones[sub_atributo] [2]}
else
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. CustomObject.name, onclick = onSelectInstance, icon = CustomObject.icon}
end
else
local modo = instance.modo
if (modo == 1) then --solo plugin
atributo = _detalhes.SoloTables.Mode or 1
local SoloInfo = _detalhes.SoloTables.Menu [atributo]
if (SoloInfo) then
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. SoloInfo [1], onclick = onSelectInstance, icon = SoloInfo [2]}
else
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""}
end
elseif (modo == 4) then --raid plugin
local plugin_name = instance.current_raid_plugin or instance.last_raid_plugin
if (plugin_name) then
local plugin_object = _detalhes:GetPlugin (plugin_name)
if (plugin_object) then
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. plugin_object.__name, onclick = onSelectInstance, icon = plugin_object.__icon}
else
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""}
end
else
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""}
end
else
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. _detalhes.atributos.lista [atributo] .. " - " .. _detalhes.sub_atributos [atributo].lista [sub_atributo], onclick = onSelectInstance, icon = _detalhes.sub_atributos [atributo].icones[sub_atributo] [1], texcoord = _detalhes.sub_atributos [atributo].icones[sub_atributo] [2]}
end
end
end
return instanceList
end
local instanceSelection = DF:NewDropDown (f, _, "$parentInstanceSelectDropdown", "instanceDropdown", 200, 18, buildInstanceMenu) --, nil, options_dropdown_template
instanceSelection:SetPoint("bottomright", f, "bottomright", -7, 09)
instanceSelection:SetHook("OnEnter", function()
GameCooltip:Reset()
GameCooltip:Preset (2)
GameCooltip:AddLine(Loc ["STRING_MINITUTORIAL_OPTIONS_PANEL1"])
GameCooltip:ShowCooltip(instanceSelection.widget, "tooltip")
end)
instanceSelection:SetHook("OnLeave", function()
GameCooltip:Hide()
end)
local instances_string = DF:NewLabel(f, nil, "$parentInstanceDropdownLabel", "instancetext", Loc ["STRING_OPTIONS_EDITINSTANCE"], "GameFontNormal", 12)
instances_string:SetPoint("right", instanceSelection, "left", -2, 1)
local bigdogImage = DF:NewImage(f, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 180*0.9, 200*0.9, nil, {1, 0, 0, 1}, "backgroundBigDog", "$parentBackgroundBigDog")
bigdogImage:SetPoint("bottomright", f, "bottomright", -3, 27)
bigdogImage:SetAlpha(.25)
--editing group checkbox
local onToggleEditingGroup = function(self, fixparam, value)
_detalhes.options_group_edit = value
end
local editingGroupCheckBox = DF:CreateSwitch(f, onToggleEditingGroup, _detalhes.options_group_edit, _, _, _, _, _, "$parentEditGroupCheckbox", _, _, _, _, DF:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"))
editingGroupCheckBox:SetAsCheckBox()
editingGroupCheckBox.tooltip = Loc ["STRING_MINITUTORIAL_OPTIONS_PANEL2"]
local editingGroupLabel = DF:NewLabel(f, nil, "$parentEditingGroupLabel", "editingGroupLabel", "Editing Group:", "GameFontNormal", 12) --localize-me
editingGroupLabel:SetPoint("bottomleft", instances_string, "topleft", 0, 5)
editingGroupCheckBox:SetPoint("left", editingGroupLabel, "right", 2, 0)
--create bars
DF:NewColor ("C_OptionsButtonOrange", 0.9999, 0.8196, 0, 1)
local create_test_bars_func = function()
_detalhes.CreateTestBars()
if (not _detalhes.test_bar_update) then
_detalhes:StartTestBarUpdate()
else
_detalhes:StopTestBarUpdate()
end
end
local fillbars = DF:NewButton (f, _, "$parentCreateExampleBarsButton", nil, 120, 20, create_test_bars_func, nil, nil, nil, Loc ["STRING_OPTIONS_TESTBARS"], 1)
fillbars:SetPoint ("bottomleft", f.widget, "bottomleft", 41, 12)
fillbars:SetTemplate(options_button_template)
--change log
local changelog = DF:NewButton (f, _, "$parentOpenChangeLogButton", nil, 120, 20, _detalhes.OpenNewsWindow, "change_log", nil, nil, Loc ["STRING_OPTIONS_CHANGELOG"], 1)
changelog:SetPoint ("left", fillbars, "right", 10, 0)
changelog:SetTemplate (options_button_template)
local sectionsName = { --section names
[1] = Loc ["STRING_OPTIONSMENU_DISPLAY"],
[3] = Loc ["STRING_OPTIONSMENU_ROWSETTINGS"],
[4] = Loc ["STRING_OPTIONSMENU_ROWTEXTS"],
[5] = Loc ["STRING_OPTIONSMENU_TITLEBAR"], --titlebar
[6] = Loc ["STRING_OPTIONSMENU_WINDOWBODY"], --window body
[7] = Loc ["STRING_OPTIONS_INSTANCE_STATUSBAR_ANCHOR"], --statusbar
[12] = Loc ["STRING_OPTIONSMENU_WALLPAPER"],
[13] = Loc ["STRING_OPTIONSMENU_AUTOMATIC"],
[9] = Loc ["STRING_OPTIONSMENU_PROFILES"],
[2] = Loc ["STRING_OPTIONSMENU_SKIN"],
[8] = Loc ["STRING_OPTIONSMENU_PLUGINS"],
[10] = Loc ["STRING_OPTIONSMENU_TOOLTIP"],
[11] = Loc ["STRING_OPTIONSMENU_DATAFEED"],
[14] = Loc ["STRING_OPTIONSMENU_RAIDTOOLS"],
[15] = "Broadcaster Tools",
[16] = Loc ["STRING_OPTIONSMENU_SPELLS"],
[17] = Loc ["STRING_OPTIONSMENU_DATACHART"],
}
local optionsSectionsOrder = {
1, "", 3, 4, "", 5, 6, 7, 12, 13, "", 9, 2, 8, 10, 11, "", 14, 15, 16, 17--, 18, 19
}
local maxSectionIds = 17
Details.options.maxSectionIds = maxSectionIds
local buttonYPosition = -40
function Details.options.SelectOptionsSection(sectionId)
for i = 1, maxSectionIds do
f.sectionFramesContainer[i]:Hide()
if (f.sectionFramesContainer[i].sectionButton) then
f.sectionFramesContainer[i].sectionButton:SetTemplate(options_button_template)
end
end
f.sectionFramesContainer[sectionId]:Show()
--hightlight the option button
f.sectionFramesContainer[sectionId].sectionButton:SetTemplate(options_button_template_selected)
end
Details.options.SetCurrentInstance(instance)
--create frames for sections
for index, sectionId in ipairs(optionsSectionsOrder) do
if (type(sectionId) == "number") then
local sectionFrame = CreateFrame("frame", "$parentTab" .. sectionId, f, "BackdropTemplate")
sectionFrame:SetAllPoints()
sectionFrame:EnableMouse(false)
--tinsert(f.sectionFramesContainer, sectionFrame)
f.sectionFramesContainer[sectionId] = sectionFrame
local buildOptionSectionFunc = Details.optionsSection[sectionId]
if (buildOptionSectionFunc) then
--call the function to create the frame
buildOptionSectionFunc(sectionFrame)
--create a button for the section
local sectionButton = DF:CreateButton(f, function() Details.options.SelectOptionsSection(sectionId) end, section_menu_button_width, section_menu_button_height, sectionsName[sectionId], sectionId, nil, nil, nil, "$parentButtonSection" .. sectionId, nil, options_button_template, options_text_template)
sectionButton:SetPoint("topleft", f, "topleft", 10, buttonYPosition)
buttonYPosition = buttonYPosition - (section_menu_button_height + 1)
sectionFrame.sectionButton = sectionButton
end
else
buttonYPosition = buttonYPosition - 15
end
end
function Details.options.GetOptionsSection(sectionId)
return f.sectionFramesContainer[sectionId]
end
function f.RefreshWindow()
if (not _G.DetailsOptionsWindow.instance) then
local lowerInstance = Details:GetLowerInstanceNumber()
if (not lowerInstance) then
local instance = Details:GetInstance(1)
Details.CriarInstancia(_, _, 1)
Details:OpenOptionsWindow(instance)
else
Details:OpenOptionsWindow(Details:GetInstance(lowerInstance))
end
else
Details:OpenOptionsWindow(_G.DetailsOptionsWindow.instance)
end
end
Details.options.SelectOptionsSection(1)
end
-- ~options
function Details:OpenOptionsWindow(instance, no_reopen, section)
if (not instance.GetId or not instance:GetId()) then
instance, no_reopen, section = unpack(instance)
end
if (not no_reopen and not instance:IsEnabled() or not instance:IsStarted()) then
Details:CreateInstance(instance:GetId())
end
GameCooltip:Close()
local window = _G.DetailsOptionsWindow
if (not window) then
Details.options.InitializeOptionsWindow(instance)
window = _G.DetailsOptionsWindow
end
Details.options.SetCurrentInstanceAndRefresh(instance)
_G.DetailsPluginContainerWindow.OpenPlugin(_G.DetailsOptionsWindow)
if (section) then
Details.options.SelectOptionsSection(section)
end
window.instanceDropdown:Refresh()
window.instanceDropdown:Select(instance:GetId())
window.updateMicroFrames()
end
File diff suppressed because it is too large Load Diff
+451
View File
@@ -0,0 +1,451 @@
local Details = _G.Details
local DF = _G.DetailsFramework
function Details:InitializePlaterIntegrationWindow()
local DetailsPlaterIntegrationPanel = DF:CreateSimplePanel (UIParent, 700, 480, "Details! Plater Nameplates Integration", "DetailsPlaterIntegrationPanel")
DetailsPlaterIntegrationPanel.Frame = DetailsPlaterIntegrationPanel
DetailsPlaterIntegrationPanel.__name = "Plater Nameplates"
DetailsPlaterIntegrationPanel.real_name = "DETAILS_PLATERWINDOW"
DetailsPlaterIntegrationPanel.__icon = [[Interface\AddOns\Details\images\plater_icon]]
DetailsPlaterIntegrationPanel.__iconcoords = {0, 1, 0, 1}
DetailsPlaterIntegrationPanel.__iconcolor = "white"
DetailsPluginContainerWindow.EmbedPlugin (DetailsPlaterIntegrationPanel, DetailsPlaterIntegrationPanel, true)
function DetailsPlaterIntegrationPanel.RefreshWindow()
Details.OpenPlaterIntegrationWindow()
end
DetailsPlaterIntegrationPanel:Hide()
end
function Details.OpenPlaterIntegrationWindow()
if (not DetailsPlaterIntegrationPanel or not DetailsPlaterIntegrationPanel.Initialized) then
DetailsPlaterIntegrationPanel.Initialized = true
local f = DetailsPlaterIntegrationPanel or DF:CreateSimplePanel (UIParent, 700, 480, "Details! Plater Nameplates Integration", "DetailsPlaterIntegrationPanel")
--background
f.bg1 = f:CreateTexture (nil, "background")
f.bg1:SetTexture ([[Interface\AddOns\Details\images\background]], true)
f.bg1:SetAlpha (0.8)
f.bg1:SetVertexColor (0.27, 0.27, 0.27)
f.bg1:SetVertTile (true)
f.bg1:SetHorizTile (true)
f.bg1:SetSize (790, 454)
f.bg1:SetAllPoints()
f:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true})
f:SetBackdropColor (.5, .5, .5, .7)
f:SetBackdropBorderColor (0, 0, 0, 1)
--> anchor text function
local anchor_names = {"Top Left", "Left", "Bottom Left", "Bottom", "Bottom Right", "Right", "Top Right", "Top", "Center", "Inner Left", "Inner Right", "Inner Top", "Inner Bottom"}
local build_anchor_side_table = function (member)
local t = {}
for i = 1, 13 do
tinsert (t, {
label = anchor_names[i],
value = i,
onclick = function (_, _, value)
Details.plater [member].side = value
if (Plater) then
Plater.UpdateAllPlates()
end
end
})
end
return t
end
local menu_table = {
{type = "label", get = function() return "Add Real Time DPS Info in the Nameplate:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
--> real time dps from all sources
{
type = "toggle",
get = function() return Details.plater.realtime_dps_enabled end,
set = function (self, fixedparam, value)
Details.plater.realtime_dps_enabled = value
Details:RefreshPlaterIntegration()
if (not value) then
Details:Msg ("a /reload might be needed to disable this setting.")
else
if (Plater) then
Plater.RefreshDBUpvalues()
end
end
end,
name = "Show Real Time Dps",
desc = "Show Real Time DPS on the nameplate.\n\nReal time DPS is how much damage has been inflicted to the unit in the last 5 seconds.",
},
--> text size
{
type = "range",
get = function() return Details.plater.realtime_dps_size end,
set = function (self, fixedparam, value)
Details.plater.realtime_dps_size = value
if (Plater) then
Plater.UpdateAllPlates()
end
end,
min = 6,
max = 32,
step = 1,
name = "Text Size",
desc = "Text Size",
},
--> text color
{
type = "color",
get = function()
local color = Details.plater.realtime_dps_color
return {color [1], color [2], color [3], color [4]}
end,
set = function (self, r, g, b, a)
local color = Details.plater.realtime_dps_color
color[1], color[2], color[3], color[4] = r, g, b, a
if (Plater) then
Plater.UpdateAllPlates()
end
end,
desc = "Text Color",
name = "Text Color",
text_template = options_text_template,
},
--> text shadow
{
type = "toggle",
get = function() return Details.plater.realtime_dps_shadow end,
set = function (self, fixedparam, value)
Details.plater.realtime_dps_shadow = value
if (Plater) then
Plater.UpdateAllPlates()
end
end,
name = "Text Shadow",
desc = "Text Shadow",
},
--> text anchor
--anchor location
{
type = "select",
get = function() return Details.plater.realtime_dps_anchor.side end,
values = function() return build_anchor_side_table ("realtime_dps_anchor") end,
name = "Anchor Point",
desc = "Which side of the nameplate the text is attach to.",
},
--anchor x offset
{
type = "range",
get = function() return Details.plater.realtime_dps_anchor.x end,
set = function (self, fixedparam, value)
Details.plater.realtime_dps_anchor.x = value
if (Plater) then
Plater.UpdateAllPlates()
end
end,
min = -20,
max = 20,
step = 1,
name = "Anchor X Offset",
desc = "Slightly move the text horizontally.",
},
--anchor x offset
{
type = "range",
get = function() return Details.plater.realtime_dps_anchor.y end,
set = function (self, fixedparam, value)
Details.plater.realtime_dps_anchor.y = value
if (Plater) then
Plater.UpdateAllPlates()
end
end,
min = -20,
max = 20,
step = 1,
name = "Anchor Y Offset",
desc = "Slightly move the text vertically.",
},
{type = "breakline"},
{type = "label", get = function() return "Add Real Time DPS Info Only From You in the Nameplate:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
--> real time dps from the player only
{
type = "toggle",
get = function() return Details.plater.realtime_dps_player_enabled end,
set = function (self, fixedparam, value)
Details.plater.realtime_dps_player_enabled = value
Details:RefreshPlaterIntegration()
if (not value) then
Details:Msg ("a /reload might be needed to disable this setting.")
else
if (Plater) then
Plater.RefreshDBUpvalues()
end
end
end,
name = "Show Real Time Dps (From You)",
desc = "Show Real Time DPS you are currently applying in the unit.\n\nReal time DPS is how much damage has been inflicted to the unit in the last 5 seconds.",
},
--> text size
{
type = "range",
get = function() return Details.plater.realtime_dps_player_size end,
set = function (self, fixedparam, value)
Details.plater.realtime_dps_player_size = value
if (Plater) then
Plater.UpdateAllPlates()
end
end,
min = 6,
max = 32,
step = 1,
name = "Text Size",
desc = "Text Size",
},
--> text color
{
type = "color",
get = function()
local color = Details.plater.realtime_dps_player_color
return {color [1], color [2], color [3], color [4]}
end,
set = function (self, r, g, b, a)
local color = Details.plater.realtime_dps_player_color
color[1], color[2], color[3], color[4] = r, g, b, a
if (Plater) then
Plater.UpdateAllPlates()
end
end,
desc = "Text Color",
name = "Text Color",
text_template = options_text_template,
},
--> text shadow
{
type = "toggle",
get = function() return Details.plater.realtime_dps_player_shadow end,
set = function (self, fixedparam, value)
Details.plater.realtime_dps_player_shadow = value
if (Plater) then
Plater.UpdateAllPlates()
end
end,
name = "Text Shadow",
desc = "Text Shadow",
},
--> text anchor
--anchor location
{
type = "select",
get = function() return Details.plater.realtime_dps_player_anchor.side end,
values = function() return build_anchor_side_table ("realtime_dps_player_anchor") end,
name = "Anchor Point",
desc = "Which side of the nameplate the text is attach to.",
},
--anchor x offset
{
type = "range",
get = function() return Details.plater.realtime_dps_player_anchor.x end,
set = function (self, fixedparam, value)
Details.plater.realtime_dps_player_anchor.x = value
if (Plater) then
Plater.UpdateAllPlates()
end
end,
min = -20,
max = 20,
step = 1,
name = "Anchor X Offset",
desc = "Slightly move the text horizontally.",
},
--anchor x offset
{
type = "range",
get = function() return Details.plater.realtime_dps_player_anchor.y end,
set = function (self, fixedparam, value)
Details.plater.realtime_dps_player_anchor.y = value
if (Plater) then
Plater.UpdateAllPlates()
end
end,
min = -20,
max = 20,
step = 1,
name = "Anchor Y Offset",
desc = "Slightly move the text vertically.",
},
{type = "breakline"},
{type = "label", get = function() return "Add Total Damage Taken in the Nameplate:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
--> total damage taken from all sources
{
type = "toggle",
get = function() return Details.plater.damage_taken_enabled end,
set = function (self, fixedparam, value)
Details.plater.damage_taken_enabled = value
Details:RefreshPlaterIntegration()
if (not value) then
Details:Msg ("a /reload might be needed to disable this setting.")
else
if (Plater) then
Plater.RefreshDBUpvalues()
end
end
end,
name = "Show Total Damage Taken",
desc = "Show the total damage taken by the unit",
},
--> text size
{
type = "range",
get = function() return Details.plater.damage_taken_size end,
set = function (self, fixedparam, value)
Details.plater.damage_taken_size = value
if (Plater) then
Plater.UpdateAllPlates()
end
end,
min = 6,
max = 32,
step = 1,
name = "Text Size",
desc = "Text Size",
},
--> text color
{
type = "color",
get = function()
local color = Details.plater.damage_taken_color
return {color [1], color [2], color [3], color [4]}
end,
set = function (self, r, g, b, a)
local color = Details.plater.damage_taken_color
color[1], color[2], color[3], color[4] = r, g, b, a
if (Plater) then
Plater.UpdateAllPlates()
end
end,
desc = "Text Color",
name = "Text Color",
text_template = options_text_template,
},
--> text shadow
{
type = "toggle",
get = function() return Details.plater.damage_taken_shadow end,
set = function (self, fixedparam, value)
Details.plater.damage_taken_shadow = value
if (Plater) then
Plater.UpdateAllPlates()
end
end,
name = "Text Shadow",
desc = "Text Shadow",
},
--> text anchor
--anchor location
{
type = "select",
get = function() return Details.plater.damage_taken_anchor.side end,
values = function() return build_anchor_side_table ("damage_taken_anchor") end,
name = "Anchor Point",
desc = "Which side of the nameplate the text is attach to.",
},
--anchor x offset
{
type = "range",
get = function() return Details.plater.damage_taken_anchor.x end,
set = function (self, fixedparam, value)
Details.plater.damage_taken_anchor.x = value
if (Plater) then
Plater.UpdateAllPlates()
end
end,
min = -20,
max = 20,
step = 1,
name = "Anchor X Offset",
desc = "Slightly move the text horizontally.",
},
--anchor x offset
{
type = "range",
get = function() return Details.plater.damage_taken_anchor.y end,
set = function (self, fixedparam, value)
Details.plater.damage_taken_anchor.y = value
if (Plater) then
Plater.UpdateAllPlates()
end
end,
min = -20,
max = 20,
step = 1,
name = "Anchor Y Offset",
desc = "Slightly move the text vertically.",
},
}
local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")
local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE")
local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE")
local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
local titleBackground = CreateFrame ("frame", nil, f,"BackdropTemplate")
titleBackground:SetPoint ("topleft", f, "topleft", 10, -30)
titleBackground:SetPoint ("topright", f, "topright", -10, -30)
titleBackground:SetHeight (80)
--background
titleBackground.bg1 = titleBackground:CreateTexture (nil, "background")
titleBackground.bg1:SetTexture ([[Interface\AddOns\Details\images\background]])
titleBackground.bg1:SetAlpha (0.8)
titleBackground.bg1:SetVertexColor (0.27, 0.27, 0.27)
titleBackground.bg1:SetVertTile (true)
titleBackground.bg1:SetHorizTile (true)
titleBackground.bg1:SetSize (790, 454)
titleBackground.bg1:SetAllPoints()
titleBackground:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true})
titleBackground:SetBackdropColor (.5, .5, .5, .7)
titleBackground:SetBackdropBorderColor (0, 0, 0, 1)
local platerTitle = DF:CreateLabel (titleBackground, "Plater Nameplates Integration", 16, "white")
local platerDesc1 = DF:CreateLabel (titleBackground, "Add DPS and Damage information directly into the nameplate", 11, "silver")
local platerDesc2 = DF:CreateLabel (titleBackground, "See how much damage the enemy is taking in real time!", 11, "silver")
local platerImage = DF:CreateImage (titleBackground, "Interface\\AddOns\\Details\\images\\plater_image")
platerImage:SetSize (256, 64)
platerImage:SetPoint ("topright", f, "topright", -150, -35)
platerTitle:SetPoint (10, -15)
platerDesc1:SetPoint (10, -35)
platerDesc2:SetPoint (10, -47)
DF:BuildMenu (f, menu_table, 10, -140, 460, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
if (not Plater) then
for _, widget in ipairs (f.widget_list) do
if (widget.Disable) then
widget:Disable()
end
end
local PlaterDisabled1 = DF:CreateLabel (f, "Plater isn't installed! you may download it from the Twitch app.", 16, "red")
PlaterDisabled1:SetPoint (10, -330)
end
end
DetailsPluginContainerWindow.OpenPlugin (DetailsPlaterIntegrationPanel)
end
File diff suppressed because it is too large Load Diff
+222
View File
@@ -0,0 +1,222 @@
local Details = _G.Details
local DF = _G.DetailsFramework
local breakdownWindowPlayerList = {}
local unpack = _G.unpack
local C_Timer = _G.C_Timer
local tinsert = _G.tinsert
local scrollbox_size = {200, 405}
local scrollbox_lines = 25
local player_line_height = 21.7
local scrollbox_line_backdrop_color = {0, 0, 0, 0.5}
local scrollbox_line_backdrop_color_selected = {.6, .6, .1, 0.7}
local scrollbox_line_backdrop_color_highlight = {.9, .9, .9, 0.5}
local player_scroll_size = {180, 288}
function breakdownWindowPlayerList.CreatePlayerListFrame()
local f = _G.DetailsPlayerDetailsWindow
local refreshPlayerList = function(self, data, offset, totalLines)
--update the scroll
for i = 1, totalLines do
local index = i + offset
local playerObject = data [index]
if (playerObject) then
local line = self:GetLine(i)
line.playerObject = playerObject
line:UpdateLine()
end
end
end
local lineOnClick = function(self)
if (self.playerObject ~= Details:GetPlayerObjectFromBreakdownWindow()) then
Details:OpenPlayerBreakdown(Details:GetActiveWindowFromBreakdownWindow(), self.playerObject)
f.playerScrollBox:Refresh()
end
end
local lineOnEnter = function(self)
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color_highlight))
self.specIcon:SetBlendMode("ADD")
self.roleIcon:SetBlendMode("ADD")
end
local lineOnLeave = function(self)
if (self.isSelected) then
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color_selected))
else
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color))
end
self.specIcon:SetBlendMode("BLEND")
self.roleIcon:SetBlendMode("BLEND")
end
local updatePlayerLine = function(self)
local playerSelected = Details:GetPlayerObjectFromBreakdownWindow()
if (playerSelected and playerSelected == self.playerObject) then
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color_selected))
self.isSelected = true
else
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color))
self.isSelected = nil
end
--adjust the player icon
local specIcon, L, R, T, B = Details:GetSpecIcon(self.playerObject.spec, false)
local specId, specName, specDescription, specIconId, specRole, specClass
if (specIcon) then
self.specIcon:SetTexture(specIcon)
self.specIcon:SetTexCoord(L, R, T, B)
specId, specName, specDescription, specIconId, specRole, specClass = _G.GetSpecializationInfoByID(self.playerObject.spec)
else
self.specIcon:SetTexture(nil)
end
--adjust the role icon
if (specRole) then
local roleIcon, L, R, T, B = Details:GetRoleIcon(specRole)
if (roleIcon) then
self.roleIcon:SetTexture(roleIcon)
self.roleIcon:SetTexCoord(L, R, T, B)
else
self.roleIcon:SetTexture(nil)
end
else
self.roleIcon:SetTexture(nil)
end
--do not show the role icon
self.roleIcon:SetTexture(nil)
--set the player name
self.playerName:SetText(Details:GetOnlyName(self.playerObject.nome))
--set the player class name
self.className:SetText(string.lower(_G.UnitClass(self.playerObject.nome) or self.playerObject:Class()))
end
local createPlayerLine = function(self, index)
--create a new line
local line = _G.CreateFrame("button", "$parentLine" .. index, self, "BackdropTemplate")
--set its parameters
line:SetPoint("topleft", self, "topleft", 1, -((index-1) * (player_line_height+1)) - 1)
line:SetSize(scrollbox_size[1]-19, player_line_height)
line:RegisterForClicks("LeftButtonDown", "RightButtonDown")
line:SetScript("OnEnter", lineOnEnter)
line:SetScript("OnLeave", lineOnLeave)
line:SetScript("OnClick", lineOnClick)
line:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
line:SetBackdropColor(unpack (scrollbox_line_backdrop_color))
line:SetBackdropBorderColor(0, 0, 0, 1)
local specIcon = line:CreateTexture("$parentSpecIcon", "artwork")
specIcon:SetSize (player_line_height, player_line_height)
local roleIcon = line:CreateTexture("$parentRoleIcon", "overlay")
roleIcon:SetSize ((player_line_height-2) / 2, (player_line_height-2) / 2)
local playerName = DF:CreateLabel(line, "", "GameFontNormal")
playerName.textcolor = {1, 1, 1, .9}
playerName.textsize = 11
local className = DF:CreateLabel(line, "", "GameFontNormal")
className.textcolor = {.5, .5, .5, .5}
className.textsize = 9
--setup anchors
specIcon:SetPoint("topleft", line, "topleft", 0, 0)
roleIcon:SetPoint("topleft", specIcon, "topright", 2, 0)
--playerName:SetPoint("left", roleIcon, "right", 2, 0)
playerName:SetPoint("topleft", specIcon, "topright", 2, -1)
className:SetPoint("topleft", roleIcon, "bottomleft", 0, -2)
line.specIcon = specIcon
line.roleIcon = roleIcon
line.playerName = playerName
line.className = className
line.UpdateLine = updatePlayerLine
return line
end
local playerScroll = DF:CreateScrollBox(f, "$parentPlayerScrollBox", refreshPlayerList, {}, player_scroll_size[1] + 22, player_scroll_size[2], scrollbox_lines, player_line_height)
DF:ReskinSlider (playerScroll)
playerScroll.ScrollBar:ClearAllPoints()
playerScroll.ScrollBar:SetPoint("topright", playerScroll, "topright", -2, -17)
playerScroll.ScrollBar:SetPoint("bottomright", playerScroll, "bottomright", -2, 17)
playerScroll:SetPoint("topright", f, "topleft", -1, 0)
playerScroll:SetPoint("bottomright", f, "bottomleft", -1, 0)
playerScroll:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
playerScroll:SetBackdropColor(0, 0, 0, 0.2)
playerScroll:SetBackdropBorderColor(0, 0, 0, 1)
f.playerScrollBox = playerScroll
--create the scrollbox lines
for i = 1, scrollbox_lines do
playerScroll:CreateLine(createPlayerLine)
end
local classIds = {
WARRIOR = 1,
PALADIN = 2,
HUNTER = 3,
ROGUE = 4,
PRIEST = 5,
DEATHKNIGHT = 6,
SHAMAN = 7,
MAGE = 8,
WARLOCK = 9,
MONK = 10,
DRUID = 11,
DEMONHUNTER = 12,
}
--get the player list from the segment and build a table compatible with the scroll box
function breakdownWindowPlayerList.BuildPlayerList()
local segment = Details:GetCombatFromBreakdownWindow()
local playerTable = {}
if (segment) then
--need to know if this is showing damage or heal
local displayType = Details:GetDisplayTypeFromBreakdownWindow()
local containerType = displayType == 1 and DETAILS_ATTRIBUTE_DAMAGE or DETAILS_ATTRIBUTE_HEAL
local container = segment:GetContainer(containerType)
for index, playerObject in container:ListActors() do
if (playerObject:IsPlayer()) then
local unitClassID = classIds [playerObject:Class()] or 13
local unitName = playerObject:Name()
local playerPosition = (((unitClassID or 0) + 128) ^ 4) + tonumber (string.byte (unitName, 1) .. "" .. string.byte (unitName, 2))
tinsert(playerTable, {playerObject, playerPosition})
end
end
end
table.sort (playerTable, DF.SortOrder2R)
local resultTable = {}
for i = 1, #playerTable do
resultTable [#resultTable+1] = playerTable[i][1]
end
return resultTable
end
f:HookScript("OnShow", function()
--run the update on the next tick
C_Timer.After(0, function()
local playerList = breakdownWindowPlayerList.BuildPlayerList()
playerScroll:SetData (playerList)
playerScroll:Refresh()
playerScroll:Show()
end)
end)
end
breakdownWindowPlayerList.CreatePlayerListFrame()
+86
View File
@@ -0,0 +1,86 @@
local Details = _G.Details
local L = _G.LibStub ("AceLocale-3.0"):GetLocale( "Details" )
function Details:OpenProfiler()
--> isn't first run, so just quit
if (not Details.character_first_run) then
return
elseif (Details.is_first_run) then
return
elseif (Details.always_use_profile) then
return
else
--> check is this is the first run of the addon (after being installed)
local amount = 0
for name, profile in pairs (_detalhes_global.__profiles) do
amount = amount + 1
end
if (amount == 1) then
return
end
end
local f = Details:CreateWelcomePanel (nil, nil, 250, 300, true)
f:SetPoint ("right", UIParent, "right", -5, 0)
local logo = f:CreateTexture (nil, "artwork")
logo:SetTexture ([[Interface\AddOns\Details\images\logotipo]])
logo:SetSize (256*0.8, 128*0.8)
logo:SetPoint ("center", f, "center", 0, 0)
logo:SetPoint ("top", f, "top", 20, 20)
local string_profiler = f:CreateFontString (nil, "artwork", "GameFontNormal")
string_profiler:SetPoint ("top", logo, "bottom", -20, 10)
string_profiler:SetText ("Profiler!")
local string_profiler = f:CreateFontString (nil, "artwork", "GameFontNormal")
string_profiler:SetPoint ("topleft", f, "topleft", 10, -130)
string_profiler:SetText (L["STRING_OPTIONS_PROFILE_SELECTEXISTING"])
string_profiler:SetWidth (230)
Details:SetFontSize (string_profiler, 11)
Details:SetFontColor (string_profiler, "white")
--> get the new profile name
local current_profile = Details:GetCurrentProfileName()
local on_select_profile = function (_, _, profilename)
if (profilename ~= Details:GetCurrentProfileName()) then
Details:ApplyProfile (profilename)
if (_G.DetailsOptionsWindow and _G.DetailsOptionsWindow:IsShown()) then
Details:OpenOptionsWindow (_G.DetailsOptionsWindow.instance)
end
end
end
local texcoord = {5/32, 30/32, 4/32, 28/32}
local fill_dropdown = function()
local t = {
{value = current_profile, label = L["STRING_OPTIONS_PROFILE_USENEW"], onclick = on_select_profile, icon = [[Interface\FriendsFrame\UI-Toast-FriendRequestIcon]], texcoord = {4/32, 30/32, 4/32, 28/32}, iconcolor = "orange"}
}
for _, profilename in ipairs (Details:GetProfileList()) do
if (profilename ~= current_profile) then
t[#t+1] = {value = profilename, label = profilename, onclick = on_select_profile, icon = [[Interface\FriendsFrame\UI-Toast-FriendOnlineIcon]], texcoord = texcoord, iconcolor = "yellow"}
end
end
return t
end
local dropdown = Details.gump:NewDropDown (f, f, "DetailsProfilerProfileSelectorDropdown", "dropdown", 220, 20, fill_dropdown, 1)
dropdown:SetPoint (15, -190)
local confirm_func = function()
if (current_profile ~= Details:GetCurrentProfileName()) then
Details:EraseProfile (current_profile)
end
f:Hide()
end
local confirm = Details.gump:NewButton (f, f, "DetailsProfilerProfileConfirmButton", "button", 150, 20, confirm_func, nil, nil, nil, "okey!")
confirm:SetPoint (50, -250)
confirm:InstallCustomTexture()
end
File diff suppressed because it is too large Load Diff
+198
View File
@@ -0,0 +1,198 @@
local Details = _G.Details
local DF = _G.DetailsFramework
local Loc = LibStub("AceLocale-3.0"):GetLocale("Details")
--row text editor
local windowWidth = 950
local scrollWidth = 825
local panel = Details:CreateWelcomePanel ("DetailsWindowOptionsBarTextEditor", nil, windowWidth, 600, true)
panel:SetPoint ("center", UIParent, "center")
panel:Hide()
panel:SetFrameStrata ("FULLSCREEN")
DF:ApplyStandardBackdrop (panel)
DF:CreateTitleBar (panel, "Details! Custom Line Text Editor")
function panel:Open (text, callback, host, default)
if (host) then
panel:ClearAllPoints()
panel:SetPoint ("center", host, "center")
end
text = text:gsub ("||", "|")
panel.default_text = text
panel.editbox:SetText (text)
panel.callback = callback
panel.default = default or ""
panel:Show()
end
local y = -32
local buttonTemplate = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
local textentry = DF:NewSpecialLuaEditorEntry (panel, scrollWidth, 555, "editbox", "$parentEntry")
textentry:SetPoint ("topleft", panel, "topleft", 10, y)
DF:ApplyStandardBackdrop (textentry)
DF:SetFontSize (textentry.editbox, 14)
DF:ReskinSlider (textentry.scroll)
local arg1_button = DF:NewButton (panel, nil, "$parentButton1", nil, 80, 20, function() textentry.editbox:Insert ("{data1}") end, nil, nil, nil, string.format (Loc ["STRING_OPTIONS_TEXTEDITOR_DATA"], "1"), 1)
local arg2_button = DF:NewButton (panel, nil, "$parentButton2", nil, 80, 20, function() textentry.editbox:Insert ("{data2}") end, nil, nil, nil, string.format (Loc ["STRING_OPTIONS_TEXTEDITOR_DATA"], "2"), 1)
local arg3_button = DF:NewButton (panel, nil, "$parentButton3", nil, 80, 20, function() textentry.editbox:Insert ("{data3}") end, nil, nil, nil, string.format (Loc ["STRING_OPTIONS_TEXTEDITOR_DATA"], "3"), 1)
arg1_button:SetPoint ("topright", panel, "topright", -12, y)
arg2_button:SetPoint ("topright", panel, "topright", -12, y - (20*1))
arg3_button:SetPoint ("topright", panel, "topright", -12, y - (20*2))
arg1_button:SetTemplate (buttonTemplate)
arg2_button:SetTemplate (buttonTemplate)
arg3_button:SetTemplate (buttonTemplate)
arg1_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_DATA_TOOLTIP"]
arg2_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_DATA_TOOLTIP"]
arg3_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_DATA_TOOLTIP"]
-- code author Saiket from http://www.wowinterface.com/forums/showpost.php?p=245759&postcount=6
--- @return StartPos, EndPos of highlight in this editbox.
local function GetTextHighlight ( self )
local Text, Cursor = self:GetText(), self:GetCursorPosition();
self:Insert( "" ); -- Delete selected text
local TextNew, CursorNew = self:GetText(), self:GetCursorPosition();
-- Restore previous text
self:SetText( Text );
self:SetCursorPosition( Cursor );
local Start, End = CursorNew, #Text - ( #TextNew - CursorNew );
self:HighlightText( Start, End );
return Start, End;
end
local StripColors;
do
local CursorPosition, CursorDelta;
--- Callback for gsub to remove unescaped codes.
local function StripCodeGsub ( Escapes, Code, End )
if ( #Escapes % 2 == 0 ) then -- Doesn't escape Code
if ( CursorPosition and CursorPosition >= End - 1 ) then
CursorDelta = CursorDelta - #Code;
end
return Escapes;
end
end
--- Removes a single escape sequence.
local function StripCode ( Pattern, Text, OldCursor )
CursorPosition, CursorDelta = OldCursor, 0;
return Text:gsub( Pattern, StripCodeGsub ), OldCursor and CursorPosition + CursorDelta;
end
--- Strips Text of all color escape sequences.
-- @param Cursor Optional cursor position to keep track of.
-- @return Stripped text, and the updated cursor position if Cursor was given.
function StripColors ( Text, Cursor )
Text, Cursor = StripCode( "(|*)(|c%x%x%x%x%x%x%x%x)()", Text, Cursor );
return StripCode( "(|*)(|r)()", Text, Cursor );
end
end
local COLOR_END = "|r";
--- Wraps this editbox's selected text with the given color.
local function ColorSelection ( self, ColorCode )
local Start, End = GetTextHighlight( self );
local Text, Cursor = self:GetText(), self:GetCursorPosition();
if ( Start == End ) then -- Nothing selected
--Start, End = Cursor, Cursor; -- Wrap around cursor
return; -- Wrapping the cursor in a color code and hitting backspace crashes the client!
end
-- Find active color code at the end of the selection
local ActiveColor;
if ( End < #Text ) then -- There is text to color after the selection
local ActiveEnd;
local CodeEnd, _, Escapes, Color = 0;
while ( true ) do
_, CodeEnd, Escapes, Color = Text:find( "(|*)(|c%x%x%x%x%x%x%x%x)", CodeEnd + 1 );
if ( not CodeEnd or CodeEnd > End ) then
break;
end
if ( #Escapes % 2 == 0 ) then -- Doesn't escape Code
ActiveColor, ActiveEnd = Color, CodeEnd;
end
end
if ( ActiveColor ) then
-- Check if color gets terminated before selection ends
CodeEnd = 0;
while ( true ) do
_, CodeEnd, Escapes = Text:find( "(|*)|r", CodeEnd + 1 );
if ( not CodeEnd or CodeEnd > End ) then
break;
end
if ( CodeEnd > ActiveEnd and #Escapes % 2 == 0 ) then -- Terminates ActiveColor
ActiveColor = nil;
break;
end
end
end
end
local Selection = Text:sub( Start + 1, End );
-- Remove color codes from the selection
local Replacement, CursorReplacement = StripColors( Selection, Cursor - Start );
self:SetText( ( "" ):join(
Text:sub( 1, Start ),
ColorCode, Replacement, COLOR_END,
ActiveColor or "", Text:sub( End + 1 )
) );
-- Restore cursor and highlight, adjusting for wrapper text
Cursor = Start + CursorReplacement;
if ( CursorReplacement > 0 ) then -- Cursor beyond start of color code
Cursor = Cursor + #ColorCode;
end
if ( CursorReplacement >= #Replacement ) then -- Cursor beyond end of color
Cursor = Cursor + #COLOR_END;
end
self:SetCursorPosition( Cursor );
-- Highlight selection and wrapper
self:HighlightText( Start, #ColorCode + ( #Replacement - #Selection ) + #COLOR_END + End );
end
local color_func = function (_, r, g, b, a)
local hex = Details:hex (a*255)..Details:hex (r*255)..Details:hex (g*255)..Details:hex (b*255)
ColorSelection ( textentry.editbox, "|c" .. hex)
end
local func_button = DF:NewButton (panel, nil, "$parentButton4", nil, 80, 20, function() textentry.editbox:Insert ("{func local player, combat = ...; return 0;}") end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_FUNC"], 1)
local color_button = DF:NewColorPickButton (panel, "$parentButton5", nil, color_func)
color_button:SetSize (80, 20)
color_button:SetTemplate (buttonTemplate)
func_button:SetPoint ("topright", panel, "topright", -12, y - (20*3))
func_button:SetTemplate (buttonTemplate)
color_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_COLOR_TOOLTIP"]
func_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_FUNC_TOOLTIP"]
local done = function()
local text = panel.editbox:GetText()
panel.callback (text)
panel:Hide()
end
local apply_button = DF:NewButton (panel, nil, "$parentApply", nil, 80, 20, function() panel.callback(panel.editbox:GetText()) end, nil, nil, nil, "Apply", 1) --localize-me
apply_button:SetTemplate (buttonTemplate)
apply_button:SetPoint ("topright", panel, "topright", -14, -128)
local ok_button = DF:NewButton (panel, nil, "$parentButtonOk", nil, 80, 20, done, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_DONE"], 1)
ok_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_DONE_TOOLTIP"]
ok_button:SetTemplate (buttonTemplate)
ok_button:SetPoint ("topright", panel, "topright", -14, -194)
local reset_button = DF:NewButton (panel, nil, "$parentDefaultOk", nil, 80, 20, function() textentry.editbox:SetText(panel.default); panel.callback(panel.editbox:GetText()) end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_RESET"], 1)
reset_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_RESET_TOOLTIP"]
reset_button:SetTemplate (buttonTemplate)
reset_button:SetPoint ("topright", panel, "topright", -14, -150)
local cancel_button = DF:NewButton (panel, nil, "$parentDefaultCancel", nil, 80, 20, function() textentry.editbox:SetText (panel.default_text); done(); end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_CANCEL"], 1)
cancel_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_CANCEL_TOOLTIP"]
cancel_button:SetTemplate (buttonTemplate)
cancel_button:SetPoint ("topright", panel, "topright", -14, -172)
+189
View File
@@ -0,0 +1,189 @@
local Details = _G.Details
local DF = _G.DetailsFramework
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ~run ~runcode
function Details:InitializeRunCodeWindow()
local DetailsRunCodePanel = DF:CreateSimplePanel (UIParent, 700, 480, "Details! Run Code", "DetailsRunCodePanel")
DetailsRunCodePanel.Frame = DetailsRunCodePanel
DetailsRunCodePanel.__name = "Auto Run Code"
DetailsRunCodePanel.real_name = "DETAILS_RUNCODEWINDOW"
--DetailsRunCodePanel.__icon = [[Interface\AddOns\Details\images\lua_logo]]
DetailsRunCodePanel.__icon = [[Interface\AddOns\Details\images\run_code]]
--DetailsRunCodePanel.__iconcoords = {0, 1, 0, 1}
DetailsRunCodePanel.__iconcoords = {0, 30/32, 0, 25/32}
DetailsRunCodePanel.__iconcoords = {0, 1, 0, 1}
DetailsRunCodePanel.__iconcolor = "white"
DetailsPluginContainerWindow.EmbedPlugin (DetailsRunCodePanel, DetailsRunCodePanel, true)
function DetailsRunCodePanel.RefreshWindow()
Details.OpenRunCodeWindow()
end
DetailsRunCodePanel:Hide()
end
function Details.OpenRunCodeWindow()
if (not DetailsRunCodePanel or not DetailsRunCodePanel.Initialized) then
DetailsRunCodePanel.Initialized = true
local f = DetailsRunCodePanel or DF:CreateSimplePanel (UIParent, 700, 480, "Details! Run Code", "DetailsRunCodePanel")
--> lua editor
local code_editor = DF:NewSpecialLuaEditorEntry (f, 885, 510, "text", "$parentCodeEditorWindow")
f.CodeEditor = code_editor
code_editor:SetPoint ("topleft", f, "topleft", 20, -56)
--> code editor appearance
code_editor.scroll:SetBackdrop (nil)
code_editor.editbox:SetBackdrop (nil)
code_editor:SetBackdrop (nil)
DF:ReskinSlider (code_editor.scroll)
if (not code_editor.__background) then
code_editor.__background = code_editor:CreateTexture (nil, "background")
end
code_editor:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
code_editor:SetBackdropBorderColor (0, 0, 0, 1)
code_editor.__background:SetColorTexture (0.2317647, 0.2317647, 0.2317647)
code_editor.__background:SetVertexColor (0.27, 0.27, 0.27)
code_editor.__background:SetAlpha (0.8)
code_editor.__background:SetVertTile (true)
code_editor.__background:SetHorizTile (true)
code_editor.__background:SetAllPoints()
--> code compile error warning
local errortext_frame = CreateFrame ("frame", nil, code_editor,"BackdropTemplate")
errortext_frame:SetPoint ("bottomleft", code_editor, "bottomleft", 1, 1)
errortext_frame:SetPoint ("bottomright", code_editor, "bottomright", -1, 1)
errortext_frame:SetHeight (20)
errortext_frame:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
errortext_frame:SetBackdropBorderColor (0, 0, 0, 1)
errortext_frame:SetBackdropColor (0, 0, 0)
DF:CreateFlashAnimation (errortext_frame)
local errortext_label = DF:CreateLabel (errortext_frame, "", DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE"))
errortext_label.textcolor = "red"
errortext_label:SetPoint ("left", errortext_frame, "left", 3, 0)
code_editor.NextCodeCheck = 0.33
code_editor:HookScript ("OnUpdate", function (self, deltaTime)
code_editor.NextCodeCheck = code_editor.NextCodeCheck - deltaTime
if (code_editor.NextCodeCheck < 0) then
local script = code_editor:GetText()
local func, errortext = loadstring (script, "Q")
if (not func) then
local firstLine = strsplit ("\n", script, 2)
errortext = errortext:gsub (firstLine, "")
errortext = errortext:gsub ("%[string \"", "")
errortext = errortext:gsub ("...\"]:", "")
errortext = errortext:gsub ("Q\"]:", "")
errortext = "Line " .. errortext
errortext_label.text = errortext
else
errortext_label.text = ""
end
code_editor.NextCodeCheck = 0.33
end
end)
--> script selector
local on_select_CodeType_option = function (self, fixedParameter, value)
--> set the current editing code type
f.EditingCode = Details.RunCodeTypes [value].Value
f.EditingCodeKey = Details.RunCodeTypes [value].ProfileKey
--> load the code for the event
local code = Details.run_code [f.EditingCodeKey]
code_editor:SetText (code)
end
local build_CodeType_dropdown_options = function()
local t = {}
for i = 1, #Details.RunCodeTypes do
local option = Details.RunCodeTypes [i]
t [#t + 1] = {label = option.Name, value = option.Value, onclick = on_select_CodeType_option, desc = option.Desc}
end
return t
end
local code_type_label = DF:CreateLabel (f, "Event:", DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE"))
local code_type_dropdown = DF:CreateDropDown (f, build_CodeType_dropdown_options, 1, 160, 20, "CodeTypeDropdown", _, DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
code_type_dropdown:SetPoint ("left", code_type_label, "right", 2, 0)
code_type_dropdown:SetFrameLevel (code_editor:GetFrameLevel() + 10)
code_type_label:SetPoint ("bottomleft", code_editor, "topleft", 0, 8)
--> create save button
local save_script = function()
local code = code_editor:GetText()
local func, errortext = loadstring (code, "Q")
if (func) then
Details.run_code [f.EditingCodeKey] = code
Details:RecompileAutoRunCode()
Details:Msg ("Code saved!")
code_editor:ClearFocus()
else
errortext_frame:Flash (0.2, 0.2, 0.4, true, nil, nil, "NONE")
Details:Msg ("Can't save the code: it has errors.")
end
end
local button_y = -6
local save_script_button = DF:CreateButton (f, save_script, 120, 20, "Save", -1, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate ("font", "PLATER_BUTTON"))
save_script_button:SetIcon ([[Interface\BUTTONS\UI-Panel-ExpandButton-Up]], 20, 20, "overlay", {0.1, .9, 0.1, .9})
save_script_button:SetPoint ("topright", code_editor, "bottomright", 0, button_y)
--> create cancel button
local cancel_script = function()
code_editor:SetText (Details.run_code [f.EditingCodeKey])
Details:Msg ("Code cancelled!")
code_editor:ClearFocus()
end
local cancel_script_button = DF:CreateButton (f, cancel_script, 120, 20, "Cancel", -1, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate ("font", "PLATER_BUTTON"))
cancel_script_button:SetIcon ([[Interface\BUTTONS\UI-Panel-MinimizeButton-Up]], 20, 20, "overlay", {0.1, .9, 0.1, .9})
cancel_script_button:SetPoint ("topleft", code_editor, "bottomleft", 0, button_y)
--> create run now button
local execute_script = function()
local script = code_editor:GetText()
local func, errortext = loadstring (script, "Q")
if (func) then
DF:SetEnvironment(func)
DF:QuickDispatch (func)
else
errortext_frame:Flash (0.2, 0.2, 0.4, true, nil, nil, "NONE")
end
end
local run_script_button = DF:CreateButton (f, execute_script, 120, 20, "Test Code", -1, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate ("font", "PLATER_BUTTON"))
run_script_button:SetIcon ([[Interface\BUTTONS\UI-SpellbookIcon-NextPage-Up]], 20, 20, "overlay", {0.05, 0.95, 0.05, 0.95})
run_script_button:SetPoint ("bottomright", code_editor, "topright", 0, 3)
end
DetailsPluginContainerWindow.OpenPlugin (DetailsRunCodePanel)
DetailsRunCodePanel.CodeTypeDropdown:Select (1, true)
--> show the initialization code when showing up this window
DetailsRunCodePanel.EditingCode = Details.RunCodeTypes [1].Value
DetailsRunCodePanel.EditingCodeKey = Details.RunCodeTypes [1].ProfileKey
local code = Details.run_code [DetailsRunCodePanel.EditingCodeKey]
DetailsRunCodePanel.CodeEditor:SetText (code)
end
+271
View File
@@ -0,0 +1,271 @@
local Details = _G.Details
local DF = _G.DetailsFramework
function Details:ScrollDamage()
if (not DetailsScrollDamage) then
DetailsScrollDamage = DetailsFramework:CreateSimplePanel(UIParent)
DetailsScrollDamage:SetSize (427 - 40 - 20 - 20, 505 - 150 + 20)
DetailsScrollDamage:SetTitle ("Details! Scroll Damage (/details scroll)")
DetailsScrollDamage.Data = {}
DetailsScrollDamage:ClearAllPoints()
DetailsScrollDamage:SetPoint ("left", UIParent, "left", 10, 0)
DetailsScrollDamage:Hide()
local scroll_width = 395 - 40 - 20 - 20
local scroll_height = 300
local scroll_lines = 14
local scroll_line_height = 20
local backdrop_color = {.2, .2, .2, 0.2}
local backdrop_color_on_enter = {.8, .8, .8, 0.4}
local backdrop_color_is_critical = {.4, .4, .2, 0.2}
local backdrop_color_is_critical_on_enter = {1, 1, .8, 0.4}
local y = -15
local headerY = y - 15
local scrollY = headerY - 20
local LibWindow = _G.LibStub("LibWindow-1.1")
DetailsScrollDamage:SetScript("OnMouseDown", nil)
DetailsScrollDamage:SetScript("OnMouseUp", nil)
LibWindow.RegisterConfig(DetailsScrollDamage, Details.damage_scroll_position)
LibWindow.MakeDraggable(DetailsScrollDamage)
LibWindow.RestorePosition(DetailsScrollDamage)
--header
local headerTable = {
{text = "Icon", width = 32},
{text = "Spell Name", width = 100},
{text = "Amount", width = 60},
{text = "Time", width = 60},
--{text = "Token", width = 80},
{text = "Spell ID", width = 80},
--{text = "School", width = 80},
}
local headerOptions = {
padding = 2,
}
DetailsScrollDamage.Header = DetailsFramework:CreateHeader(DetailsScrollDamage, headerTable, headerOptions)
DetailsScrollDamage.Header:SetPoint("topleft", DetailsScrollDamage, "topleft", 5, headerY)
local scroll_refresh = function (self, data, offset, total_lines)
local ToK = _detalhes:GetCurrentToKFunction()
for i = 1, total_lines do
local index = i + offset
local spellTable = data [index]
if (spellTable) then
local line = self:GetLine(i)
local time, token, hidding, sourceSerial, sourceName, sourceFlag, sourceFlag2, targetSerial, targetName, targetFlag, targetFlag2, spellID, spellName, spellType, amount, overKill, school, resisted, blocked, absorbed, isCritical = unpack (spellTable)
local spellName, _, spellIcon
if (token ~= "SWING_DAMAGE") then
spellName, _, spellIcon = GetSpellInfo(spellID)
else
spellName, _, spellIcon = GetSpellInfo(1)
end
line.SpellID = spellID
line.IsCritical = isCritical
if (isCritical) then
line:SetBackdropColor(unpack(backdrop_color_is_critical))
else
line:SetBackdropColor(unpack(backdrop_color))
end
if (spellName) then
line.Icon:SetTexture(spellIcon)
line.Icon:SetTexCoord(.1, .9, .1, .9)
line.DamageText.text = isCritical and "|cFFFFFF00" .. ToK (_, amount) or ToK (_, amount)
line.TimeText.text = format("%.2f", time - DetailsScrollDamage.Data.Started)
--line.TokenText.text = token:gsub ("SPELL_", "")
--line.SchoolText.text = _detalhes:GetSpellSchoolFormatedName (school)
line.SpellIDText.text = spellID
DF:TruncateText(line.SpellNameText, 90)
line.SpellNameText.text = spellName
else
line:Hide()
end
end
end
end
local lineOnEnter = function (self)
if (self.IsCritical) then
self:SetBackdropColor(unpack(backdrop_color_is_critical_on_enter))
else
self:SetBackdropColor(unpack(backdrop_color_on_enter))
end
if (self.SpellID) then
--spell tooltip removed, it's to much annoying
--GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT")
--GameTooltip:SetSpellByID(self.SpellID)
--GameTooltip:AddLine(" ")
--GameTooltip:Show()
end
end
local lineOnLeave = function (self)
if (self.IsCritical) then
self:SetBackdropColor(unpack(backdrop_color_is_critical))
else
self:SetBackdropColor(unpack(backdrop_color))
end
GameTooltip:Hide()
end
local scroll_createline = function (self, index)
local line = CreateFrame ("button", "$parentLine" .. index, self,"BackdropTemplate")
line:SetPoint ("topleft", self, "topleft", 1, -((index-1)*(scroll_line_height+1)) - 1)
line:SetSize (scroll_width - 2, scroll_line_height)
line:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
line:SetBackdropColor (unpack (backdrop_color))
DF:Mixin (line, DF.HeaderFunctions)
line:SetScript ("OnEnter", lineOnEnter)
line:SetScript ("OnLeave", lineOnLeave)
--icon
local icon = line:CreateTexture ("$parentSpellIcon", "overlay")
icon:SetSize (scroll_line_height - 2, scroll_line_height - 2)
--spellname
local spellNameText = DF:CreateLabel (line)
--damage
local damageText = DF:CreateLabel (line)
--time
local timeText = DF:CreateLabel (line)
--token
--local tokenText = DF:CreateLabel (line)
--spell ID
local spellIDText = DF:CreateLabel (line)
--school
--local schoolText = DF:CreateLabel (line)
line:AddFrameToHeaderAlignment (icon)
line:AddFrameToHeaderAlignment (spellNameText)
line:AddFrameToHeaderAlignment (damageText)
line:AddFrameToHeaderAlignment (timeText)
--line:AddFrameToHeaderAlignment (tokenText)
line:AddFrameToHeaderAlignment (spellIDText)
--line:AddFrameToHeaderAlignment (schoolText)
line:AlignWithHeader (DetailsScrollDamage.Header, "left")
line.Icon = icon
line.DamageText = damageText
line.TimeText = timeText
--line.TokenText = tokenText
--line.SchoolText = schoolText
line.SpellIDText = spellIDText
line.SpellNameText = spellNameText
return line
end
local damageScroll = DF:CreateScrollBox (DetailsScrollDamage, "$parentSpellScroll", scroll_refresh, DetailsScrollDamage.Data, scroll_width, scroll_height, scroll_lines, scroll_line_height)
DF:ReskinSlider (damageScroll)
damageScroll:SetPoint ("topleft", DetailsScrollDamage, "topleft", 5, scrollY)
--create lines
for i = 1, scroll_lines do
damageScroll:CreateLine (scroll_createline)
end
local combatLogReader = CreateFrame ("frame")
local playerSerial = UnitGUID ("player")
combatLogReader:SetScript ("OnEvent", function (self)
local timew, token, hidding, sourceSerial, sourceName, sourceFlag, sourceFlag2, targetSerial, targetName, targetFlag, targetFlag2, spellID, spellName, spellType, amount, overKill, school, resisted, blocked, absorbed, isCritical = CombatLogGetCurrentEventInfo()
if (sourceSerial == playerSerial) then
if (token == "SPELL_DAMAGE" or token == "SPELL_PERIODIC_DAMAGE" or token == "RANGE_DAMAGE" or token == "DAMAGE_SHIELD") then
if (not DetailsScrollDamage.Data.Started) then
DetailsScrollDamage.Data.Started = time()
end
tinsert (DetailsScrollDamage.Data, 1, {timew, token, hidding, sourceSerial, sourceName, sourceFlag, sourceFlag2, targetSerial, targetName, targetFlag, targetFlag2, spellID, spellName, spellType, amount, overKill or 0, school or 1, resisted or 0, blocked or 0, absorbed or 0, isCritical})
damageScroll:Refresh()
elseif (token == "SWING_DAMAGE") then
-- amount, overkill, school, resisted, blocked, absorbed, critical, glacing, crushing, isoffhand = spellID, spellName, spellType, amount, overKill, school, resisted, blocked, absorbed, isCritical
-- tinsert (DetailsScrollDamage.Data, 1, {timew, token, hidding, sourceSerial, sourceName, sourceFlag, sourceFlag2, targetSerial, targetName, targetFlag, targetFlag2, spellID, spellName, spellType, amount, overKill, school, resisted, blocked, absorbed, isCritical})
-- damageScroll:Refresh()
end
end
end)
DetailsScrollDamage:SetScript ("OnShow", function()
wipe (DetailsScrollDamage.Data)
damageScroll:Refresh()
combatLogReader:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
end)
DetailsScrollDamage:SetScript ("OnHide", function()
combatLogReader:UnregisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
end)
--statusbar and auto open checkbox
local statusBar = CreateFrame("frame", nil, DetailsScrollDamage, "BackdropTemplate")
statusBar:SetPoint("bottomleft", DetailsScrollDamage, "bottomleft")
statusBar:SetPoint("bottomright", DetailsScrollDamage, "bottomright")
statusBar:SetHeight(20)
statusBar:SetAlpha (0.8)
DF:ApplyStandardBackdrop(statusBar)
local onToggleAutoOpen = function(_, _, state)
Details.damage_scroll_auto_open = state
end
local autoOpenCheckbox = DetailsFramework:CreateSwitch(statusBar, onToggleAutoOpen, Details.auto_open_news_window, _, _, _, _, "AutoOpenCheckbox", _, _, _, _, _, DetailsFramework:GetTemplate ("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"))
autoOpenCheckbox:SetAsCheckBox()
autoOpenCheckbox:SetPoint("left", statusBar, "left", 5, 0)
local autoOpenText = DetailsFramework:CreateLabel(statusBar, "Auto Open on Training Dummy")
autoOpenText:SetPoint("left", autoOpenCheckbox, "right", 2, 0)
end
DetailsScrollDamage:Show()
end
local targetDummieHandle = CreateFrame("frame")
local targetDummiesIds = {
[31146] = true, --raider's training dummie
}
targetDummieHandle:SetScript("OnEvent", function(_, _, unit)
if (not Details.damage_scroll_auto_open) then
return
end
if (UnitExists("target")) then
local serial = UnitGUID("target")
if (serial) then
local npcId = DetailsFramework:GetNpcIdFromGuid(serial)
if (npcId) then
if (targetDummiesIds[npcId]) then
Details:ScrollDamage()
end
end
end
end
end)
targetDummieHandle:RegisterEvent("PLAYER_TARGET_CHANGED")
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2784
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff