<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">
        <Script file="XPerl_AssistFrame.lua"/>

        <Frame name="XPerlListTemplate" virtual="true">
                <Layers>
                        <Layer level="ARTWORK">
                                <FontString name="$parentText" inherits="GameFontNormalSmall" justifyH="LEFT" justifyV="TOP">
					<Anchors>
						<Anchor point="TOPLEFT"/>
                                                <Anchor point="BOTTOMRIGHT"/>
					</Anchors>
				</FontString>
                        </Layer>
                </Layers>
        </Frame>

        <Frame name="XPerl_Assists_Frame" movable="true" frameStrata="LOW" resizable="true" parent="UIParent" hidden="true" enableMouse="true" clampedToScreen="true">
		<Size>
                        <AbsDimension x="330" y="124"/>
		</Size>
                <Anchors>
                        <Anchor point="CENTER"/>
                </Anchors>
                <Backdrop bgFile="Interface\AddOns\XPerl_RaidHelper\Images\XPerl_FrameBack" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
                        <EdgeSize>
                                <AbsValue val="16"/>
                        </EdgeSize>
                        <TileSize>
                                <AbsValue val="32"/>
                        </TileSize>
                        <BackgroundInsets>
                                <AbsInset left="5" right="5" top="5" bottom="5"/>
                        </BackgroundInsets>
                </Backdrop>
                <Frames>
                        <ScrollFrame name="XPerl_Target_Targetting_ScrollFrame">
                                <Anchors>
                                        <Anchor point="TOPLEFT">
                                                <Offset>
                                                        <AbsDimension x="4" y="-5"/>
                                                </Offset>
                                        </Anchor>
                                        <Anchor point="BOTTOMRIGHT" relativePoint="BOTTOM">
                                                <Offset>
                                                        <AbsDimension x="-1" y="4"/>
                                                </Offset>
                                        </Anchor>
                                </Anchors>
                                <ScrollChild>
                                        <Frame name="XPerl_Target_Assists_ScrollChild_Targetting" inherits="XPerlListTemplate">
                                                <Size>
                                                        <AbsDimension x="300" y="400"/>
                                                </Size>
                                                <Anchor point="TOPLEFT"/>
                                                <Anchor point="BOTTOMRIGHT"/>
                                        </Frame>
                                </ScrollChild>
                                <Scripts>
                                        <OnMouseDown>
                                                XPerl_Assists_MouseDown(arg1,"targetFrame");
                                        </OnMouseDown>
                                        <OnMouseUp>
                                                XPerl_Assists_MouseUp(arg1,"targetFrame");
                                        </OnMouseUp>
                                        <OnSizeChanged>
                                                XPerl_Target_Assists_ScrollChild_Targetting:SetWidth(XPerl_Target_Targetting_ScrollFrame:GetWidth() / XPerl_Target_Targetting_ScrollFrame:GetEffectiveScale())
                                        </OnSizeChanged>
                                </Scripts>
                        </ScrollFrame>
                        <ScrollFrame name="XPerl_Target_Assists_ScrollFrame">
                                <Anchors>
                                        <Anchor point="TOPLEFT" relativePoint="TOP">
                                                <Offset>
                                                        <AbsDimension x="0" y="-5"/>
                                                </Offset>
                                        </Anchor>
                                        <Anchor point="BOTTOMRIGHT">
                                                <Offset>
                                                        <AbsDimension x="-4" y="4"/>
                                                </Offset>
                                        </Anchor>
                                </Anchors>
                                <ScrollChild>
                                        <Frame name="XPerl_Target_Assists_ScrollChild_Assists" inherits="XPerlListTemplate">
                                                <Size>
                                                        <AbsDimension x="300" y="400"/>
                                                </Size>
                                                <Anchor point="TOPLEFT"/>
                                                <Anchor point="BOTTOMRIGHT"/>
                                        </Frame>
                                </ScrollChild>
                                <Scripts>
                                        <OnSizeChanged>
                                                XPerl_Target_Assists_ScrollChild_Assists:SetWidth(XPerl_Target_Assists_ScrollFrame:GetWidth() / XPerl_Target_Assists_ScrollFrame:GetEffectiveScale())
                                        </OnSizeChanged>
                                </Scripts>
                        </ScrollFrame>

                        <Frame name="XPerlScrollSeperator">
                                <Backdrop bgFile="Interface\AddOns\XPerl_RaidHelper\Images\XPerl_FrameBack" tile="true"/>
                                <Anchors>
                                        <Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="XPerl_Target_Targetting_ScrollFrame"/>
                                        <Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMLEFT" relativeTo="XPerl_Target_Assists_ScrollFrame"/>
                                </Anchors>
                        </Frame>

                        <Button>
                                <Size>
                                        <AbsDimension x="8" y="8"/>
                                </Size>
                                <Anchors>
                                        <Anchor point="BOTTOMRIGHT"/>
                                </Anchors>
                                <Scripts>
                                        <OnMouseDown>
                                                XPerl_Assists_MouseDown(arg1,"BOTTOMRIGHT");
                                        </OnMouseDown>
                                        <OnMouseUp>
                                                XPerl_Assists_MouseUp(arg1);
                                        </OnMouseUp>
                                </Scripts>
                        </Button>
                        <Button>
                                <Size>
                                        <AbsDimension x="8" y="8"/>
                                </Size>
                                <Anchors>
                                        <Anchor point="BOTTOMLEFT"/>
                                </Anchors>
                                <Scripts>
                                        <OnMouseDown>
                                                XPerl_Assists_MouseDown(arg1,"BOTTOMLEFT");
                                        </OnMouseDown>
                                        <OnMouseUp>
                                                XPerl_Assists_MouseUp(arg1);
                                        </OnMouseUp>
                                </Scripts>
                        </Button>
                        <Button>
                                <Size>
                                        <AbsDimension x="8" y="8"/>
                                </Size>
                                <Anchors>
                                        <Anchor point="TOPLEFT"/>
                                </Anchors>
                                <Scripts>
                                        <OnMouseDown>
                                                XPerl_Assists_MouseDown(arg1,"TOPLEFT");
                                        </OnMouseDown>
                                        <OnMouseUp>
                                                XPerl_Assists_MouseUp(arg1);
                                        </OnMouseUp>
                                </Scripts>
                        </Button>

                        <Button name="XPerlAssistsCloseButton" inherits="UIPanelCloseButton" toplevel="true">
                                <Size>
                                        <AbsDimension x="20" y="20"/>
                                </Size>
                                <Anchors>
                                        <Anchor point="TOPRIGHT"/>
                                </Anchors>
				<Scripts>
					<OnClick>
                                                XPerl_AssistsView_Close();
					</OnClick>
				</Scripts>
			</Button>

                        <Button name="XPerlAssistPin" inherits="XPerl_BasicButton" toplevel="true">
                                <Size>
                                        <AbsDimension x="11" y="11"/>
                                </Size>
                                <Anchors>
                                        <Anchor point="RIGHT" relativeTo="XPerlAssistsCloseButton" relativePoint="LEFT">
                                                <Offset>
                                                        <AbsDimension x="4" y="0"/>
                                                </Offset>
                                        </Anchor>
                                </Anchors>
                                <NormalTexture file="Interface\Addons\XPerl_RaidHelper\Images\XPerl_Pin">
                                        <TexCoords left="0" right="0.46875" top="0" bottom="0.453125"/>
                                </NormalTexture>

                                <PushedTexture file="Interface\Addons\XPerl_RaidHelper\Images\XPerl_Pin">
                                        <TexCoords left="0" right="0.46875" top="0.5" bottom="0.953125"/>
                                </PushedTexture>

                                <HighlightTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Highlight" alphaMode="ADD">
                                        <TexCoords left="0" right="0.9" top="0.1" bottom="0.9"/>
                                </HighlightTexture>

                                <Scripts>
                                        <OnLoad>
                                                this.SetButtonTex = function()
                                                        local tex = XPerlAssistPin:GetNormalTexture()
                                                        if (XPerlConfigHelper.AssistPinned) then
                                                                tex:SetTexCoord(0.5, 0.96875, 0, 0.453125)
                                                        else
                                                                tex:SetTexCoord(0, 0.46875, 0, 0.453125)
                                                        end

                                                        tex = XPerlAssistPin:GetPushedTexture()
                                                        if (XPerlConfigHelper.AssistPinned) then
                                                                tex:SetTexCoord(0.5, 0.96875, 0.5, 0.953125)
                                                        else
                                                                tex:SetTexCoord(0, 0.46875, 0.5, 0.953125)
                                                        end
                                                end
                                                this.tooltipText = XPERL_BUTTON_HELPER_PIN
                                        </OnLoad>
                                        <OnClick>
                                                XPerlConfigHelper.AssistPinned = not XPerlConfigHelper.AssistPinned
                                                this:SetButtonTex()
                                        </OnClick>
                                </Scripts>
                        </Button>
                </Frames>
		<Scripts>
                        <OnLoad>
                                this:SetMinResize(170,40)
                                this:SetMaxResize(1000,600)
                        </OnLoad>
			<OnMouseDown>
                                XPerl_Assists_MouseDown(arg1);
			</OnMouseDown>
			<OnMouseUp>
                                XPerl_Assists_MouseUp(arg1);
			</OnMouseUp>
                        <OnEvent>
                                XPerl_Assists_OnEvent();
                        </OnEvent>
		</Scripts>
        </Frame>

        <Frame>
                <Scripts>
                        <OnLoad>
                                this:SetScript("OnUpdate", XPerl_Assists_OnUpdate)
                        </OnLoad>
                </Scripts>
        </Frame>

        -- These two frames add to X-Perl UnitFrames. If X-Perl not loaded, then WoW will just ignore these without error
        <Button name="XPerl_Player_TargettingFrame" parent="XPerl_Player_CastClickOverlay" enableMouse="true" text="0" hidden="true">
                <Size>
                        <AbsDimension x="27" y="20"/>
                </Size>
                <NormalText inherits="GameFontNormalSmall" setAllPoints="true"/>
                <HighlightTexture file="Interface\Addons\XPerl\Images\XPerl_Highlight" alphaMode="ADD">
                        <TexCoords left="0" right="0.25" top="0" bottom="0.5"/>
                </HighlightTexture>
                <Anchors>
                        <Anchor point="TOPRIGHT" relativePoint="TOPLEFT" relativeTo="XPerl_Player_PortraitFrame">
                                <Offset>
                                        <AbsDimension x="2" y="-19"/>
                                </Offset>
                        </Anchor>
                </Anchors>
                <Backdrop bgFile="Interface\Addons\XPerl\Images\XPerl_FrameBack" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
                        <EdgeSize>
                                <AbsValue val="16"/>
                        </EdgeSize>
                        <TileSize>
                                <AbsValue val="32"/>
                        </TileSize>
                        <BackgroundInsets>
                                <AbsInset left="5" right="5" top="5" bottom="5"/>
                        </BackgroundInsets>
                </Backdrop>
                <Scripts>
                        <OnClick>
                                XPerl_ToggleAssistsFrame("targetting")
                                XPerl_SetFrameSides()
                                XPerl_ShowAssists()
                        </OnClick>
                        <OnEnter>
                                local title;
                                if (table.getn(XPerl_Assists_Frame.targetting) > 0 and XPerl_Assists_Frame.targetting[1][2] == "") then
                                        title = XPERL_TOOLTIP_ENEMYONME;
                                else
                                        if (XPerlConfigHelper.TargetCountersSelf == 0) then
                                                title = XPERL_TOOLTIP_ALLONME;
                                        else
                                                title = XPERL_TOOLTIP_HEALERS;
                                        end
                                end

                                local t = XPerl_MakeAssistsString(XPerl_Assists_Frame.targetting, title);
                                t = "|c00FFFFFF"..t.."\r|c009F6000"..XPERL_TOOLTIP_HELP;
                                GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT");
                                GameTooltip:SetText(t);
                                GameTooltip:Show();
                        </OnEnter>
                        <OnLeave>
                                XPerl_PlayerTipHide()
                        </OnLeave>
                </Scripts>
        </Button>

        <Button name="XPerl_Target_AssistFrame" parent="XPerl_Target_CastClickOverlay" text="0" hidden="true">
                <Size>
                        <AbsDimension x="27" y="20"/>
                </Size>
                <NormalText inherits="GameFontNormalSmall" setAllPoints="true"/>
                <HighlightTexture file="Interface\Addons\XPerl\Images\XPerl_Highlight" alphaMode="ADD">
                        <TexCoords left="0" right="0.25" top="0" bottom="0.5"/>
                </HighlightTexture>
                <Anchors>
                        <Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="XPerl_Target_PortraitFrame">
                                <Offset>
                                        <AbsDimension x="-2" y="-20"/>
                                </Offset>
                        </Anchor>
                </Anchors>
                <Backdrop bgFile="Interface\Addons\XPerl\Images\XPerl_FrameBack" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
                        <EdgeSize>
                                <AbsValue val="16"/>
                        </EdgeSize>
                        <TileSize>
                                <AbsValue val="32"/>
                        </TileSize>
                        <BackgroundInsets>
                                <AbsInset left="5" right="5" top="5" bottom="5"/>
                        </BackgroundInsets>
                </Backdrop>
                <Scripts>
                        <OnClick>
                                XPerl_ToggleAssistsFrame("assists")
                                XPerl_SetFrameSides()
                                XPerl_ShowAssists()
                        </OnClick>
                        <OnEnter>
                                local t = XPerl_MakeAssistsString(XPerl_Assists_Frame.assists, XPERL_TOOLTIP_ASSISTING);
                                t = "|c00FFFFFF"..t.."\r|c009F6000"..XPERL_TOOLTIP_HELP;
                                GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT");
                                GameTooltip:SetText(t);
                                GameTooltip:Show();
                        </OnEnter>
                        <OnLeave>
                                XPerl_PlayerTipHide()
                        </OnLeave>
                </Scripts>
        </Button>

        <Frame name="XPerl_Aggro" frameStrata="HIGH" parent="UIParent">
		<Size>
                        <AbsDimension x="256" y="64"/>
		</Size>
		<Anchors>
			<Anchor point="CENTER"/>
		</Anchors>
		<Layers>
			<Layer level="OVERLAY">
                                <FontString name="$parentPlayer" outline="THICK" font="Fonts\2002B.TTF" justifyH="CENTER" text="XPERL_AGGRO_PLAYER">
					<FontHeight>
						<AbsValue val="42"/>
					</FontHeight>
				</FontString>
                                <FontString name="$parentPet" outline="THICK" font="Fonts\2002B.TTF" justifyH="CENTER" text="XPERL_AGGRO_PET">
					<Anchors>
						<Anchor point="TOP" relativeTo="$parentPlayerText" relativePoint="BOTTOM" />
					</Anchors>
					<FontHeight>
						<AbsValue val="16"/>
					</FontHeight>
				</FontString>
			</Layer>
		</Layers>
        </Frame>
</Ui>
