<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_Player_Pet.lua"/>

        <!-- Pet Frame -->

        <Frame name="XPerl_Player_Pet" clampedToScreen="true" parent="UIParent" frameStrata="LOW" hidden="true" enableMouse="true" movable="true">
		<Size>
			<!-- The size of this frame determines what can be clicked for the menu and moving, hence it is the same size as the name frame. -->
			<AbsDimension x="140" y="50"/>
		</Size>
		<Anchors>
                        <Anchor point="TOPLEFT">
				<Offset>
                                        <AbsDimension x="103" y="-89"/>
				</Offset>
			</Anchor>
		</Anchors>

		<!-- Script Events -->
		<Scripts>
			<OnLoad>
                                XPerl_Player_Pet_OnLoad()
			</OnLoad>
		</Scripts>

		<Frames>
                        <!-- Portrait -->
                        <Frame name="$parent_PortraitFrame" inherits="XPerl_Portrait_Template">
                                <Size>
                                        <AbsDimension x="54" y="56"/>
                                </Size>
				<Anchors>
                                        <Anchor point="TOPLEFT"/>
				</Anchors>
			</Frame>

                        <!-- Pet Name -->
                        <Frame name="$parent_NameFrame">
				<Size>
					<AbsDimension x="80" y="24"/>
				</Size>f
				<Anchors>
                                        <Anchor point="TOPLEFT" relativeTo="$parent_PortraitFrame" relativePoint="TOPRIGHT">
						<Offset>
                                                        <AbsDimension x="-3" y="0"/>
						</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>
				<Layers>
					<Layer level="OVERLAY">
                                                <!-- Combat Icon -->
                                                <Texture name="$parent_ActivityStatus" file="Interface\CharacterFrame\UI-StateIcon" hidden="true">
							<Size>
								<AbsDimension x="32" y="31"/>
							</Size>
							<Anchors>
                                                                <Anchor point="RIGHT"/>
							</Anchors>
                                                        <TexCoords left="0.5" right = "1.0" top="0.0" bottom="0.5"/>
						</Texture>

                                                <!-- Warning Icon -->
                                                <Texture name="$parent_Warning" file="Interface\Minimap\Ping\ping6" alphaMode="ADD" hidden="true">
							<Size>
								<AbsDimension x="32" y="31"/>
							</Size>
							<Anchors>
                                                                <Anchor point="TOP" relativePoint="TOP">
									<Offset>
                                                                                <AbsDimension x="0" y="2"/>
									</Offset>
								</Anchor>
							</Anchors>
						</Texture>

                                                <FontString name="$parent_NameBarText" inherits="GameFontNormalSmall" text="Error!" justifyH="LEFT">
							<Anchors>
                                                                <Anchor point="TOPLEFT">
									<Offset>
                                                                                <AbsDimension x="6" y="0"/>
									</Offset>
								</Anchor>
                                                                <Anchor point="BOTTOMRIGHT">
									<Offset>
                                                                                <AbsDimension x="0" y="1"/>
									</Offset>
								</Anchor>
							</Anchors>
                                                </FontString>

					</Layer>
				</Layers>
			</Frame>

			<!--Level Frame-->

                        <Frame name="$parent_LevelFrame">
				<Size>
                                        <AbsDimension x="27" y="24"/>
				</Size>
				<Anchors>
                                        <Anchor point="TOPRIGHT" relativePoint="TOPLEFT" relativeTo="$parent_PortraitFrame">
						<Offset>
                                                        <AbsDimension x="2" y="0"/>
						</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>
				<Layers>
					<Layer level="OVERLAY">
                                                <FontString name="$parentText" inherits="GameFontNormalSmall" text="Error!" setAllPoints="true"/>
					</Layer>
				</Layers>
			</Frame>

                        <!-- Pet Happiness Frame -->

                        <Frame name="$parent_HappyFrame" hidden="true" topLevel="true">    --frameStrata="MEDIUM">
				<Size>
                                        <AbsDimension x="34" y="34"/>
				</Size>
				<Anchors>
                                        <Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMLEFT" relativeTo="$parent_PortraitFrame">
						<Offset>
                                                        <AbsDimension x="2" y="0"/>
						</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>
				<Frames>
                                        <Frame name="$parent_PetHappiness">
						<Size>
                                                        <AbsDimension x="27" y="27"/>
						</Size>
						<Anchors>
                                                        <Anchor point="CENTER" />
						</Anchors>
						<Layers>
							<Layer level="BACKGROUND">
                                                                <Texture name="$parentTexture" file="Interface\PetPaperDollFrame\UI-PetHappiness" setAllPoints="true">
									<Size>
                                                                                <AbsDimension x="27" y="27"/>
									</Size>
									<TexCoords left="0" right="0.1875" top="0" bottom="0.359375"/>
								</Texture>
							</Layer>
						</Layers>
						<Scripts>
                                                        <OnLoad>
                                                                this:RegisterForDrag("LeftButton");
                                                        </OnLoad>
                                                        <OnDragStart>
                                                                if (XPerlLocked == 0) then
                                                                        XPerl_Player_Pet:StartMoving()
                                                                end
                                                        </OnDragStart>
                                                        <OnDragStop>
                                                                XPerl_Player_Pet:StopMovingOrSizing()
                                                        </OnDragStop>
							<OnEnter>
								if ( this.tooltip ) then
									GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
									GameTooltip:SetText(this.tooltip);
									if ( this.tooltipDamage ) then
										GameTooltip:AddLine(this.tooltipDamage, "", 1, 1, 1);
									end
									if ( this.tooltipLoyalty ) then
										GameTooltip:AddLine(this.tooltipLoyalty, "", 1, 1, 1);
									end
									GameTooltip:Show();
								end
							</OnEnter>
                                                        <OnLeave>
                                                                XPerl_PlayerTipHide()
                                                        </OnLeave>
						</Scripts>
					</Frame>
				</Frames>
			</Frame>

                        <!-- Pet Stats -->
                        <Frame name="$parent_StatsFrame" inherits="XPerl_StatsXP_Template">
				<Size>
					<AbsDimension x="80" y="34"/>
				</Size>
				<Anchors>
                                        <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent_NameFrame">
						<Offset>
                                                        <AbsDimension x="0" y="2"/>
						</Offset>
					</Anchor>
				</Anchors>
                        </Frame>

			<!-- Buffs Frame -->
                        <Frame name="$parent_BuffFrame">
				<Size>
					<AbsDimension x="100" y="34"/>
				</Size>
				<Anchors>
                                        <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent_PortraitFrame">
						<Offset>
                                                        <AbsDimension x="3" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Frame>

                        <Button name="$parent_CastClickOverlay" topLevel="true">    --frameStrata="MEDIUM">
                                <HighlightTexture file="Interface\Addons\XPerl\Images\XPerl_Highlight" alphaMode="ADD">
                                        <TexCoords left="0.25" right="0.75" top="0" bottom="0.5"/>
                                </HighlightTexture>
                                <Anchors>
                                        <Anchor point="TOPLEFT" relativeTo="$parent_PortraitFrame"/>
                                        <Anchor point="BOTTOMRIGHT" relativeTo="$parent_StatsFrame"/>
                                </Anchors>
                                <Scripts>
                                        <OnLoad>
                                                this:RegisterForClicks('LeftButtonUp', 'RightButtonUp', 'MiddleButtonUp', 'Button4Up', 'Button5Up', 'AnyUp')
                                                this:RegisterForDrag("LeftButton")
                                        </OnLoad>
                                        <OnClick>
                                                XPerl_Player_Pet_OnClick(arg1)
                                        </OnClick>
                                        <OnDragStart>
                                                if (XPerlLocked == 0) then
                                                        XPerl_Player_Pet:StartMoving()
                                                end
                                        </OnDragStart>
                                        <OnDragStop>
                                                XPerl_Player_Pet:StopMovingOrSizing()
                                        </OnDragStop>
                                        <OnEnter>
                                                GameTooltip_SetDefaultAnchor(GameTooltip, this)
                                                GameTooltip:SetUnit("pet")
                                        </OnEnter>
                                        <OnLeave>
                                                XPerl_PlayerTipHide()
                                        </OnLeave>
                                </Scripts>
                        </Button>
		</Frames>
	</Frame>
</Ui>
