焦点目标插件研究(wow2.4版本)
焦点目标插件研究(wow2.4版本)
-----------FocusFrame.lua------------------------
-- Localize it for non-English clients.
FOCUSFRAME_TITLE = "Focus";
FOCUSFRAME_DRAG = "Drag to move";
FOCUSFRAME_DRAG_LOCKED = "Use /focusframe unlock to move.";
if GetLocale() == "zhCN" then
FOCUSFRAME_TITLE = "焦点目标"
FOCUSFRAME_DRAG = "按住鼠标左键拖动来移动框体"
FOCUSFRAME_DRAG_LOCKED = "使用 /focusframe 解锁(移动)"
elseif GetLocale() == "zhTW" then
FOCUSFRAME_TITLE = "焦點目標"
FOCUSFRAME_DRAG = "按住滑鼠左鍵拖動來移動框體"
FOCUSFRAME_DRAG_LOCKED = "使用 /focusframe 解鎖(移動)"
end
-- Packages all local variables of FocusFrame Addon.
FocusFrameLocalVariables = {};
local l = FocusFrameLocalVariables;
local i,j,k;
l.MAX_FOCUS_DEBUFFS = 16;
l.MAX_FOCUS_BUFFS = 32;
l.CURRENT_FOCUS_NUM_DEBUFFS = 0;
l.TARGET_BUFFS_PER_ROW = 8;
l.TARGET_DEBUFFS_PER_ROW = 8;
l.LARGE_BUFF_SIZE = 21;
l.LARGE_BUFF_FRAME_SIZE = 23;
l.SMALL_BUFF_SIZE = 17;
l.SMALL_BUFF_FRAME_SIZE = 19;
l.FocusUnitReactionColor = {
{ r = 1.0, g = 0.0, b = 0.0 },
{ r = 1.0, g = 0.0, b = 0.0 },
{ r = 1.0, g = 0.5, b = 0.0 },
{ r = 1.0, g = 1.0, b = 0.0 },
{ r = 0.0, g = 1.0, b = 0.0 },
{ r = 0.0, g = 1.0, b = 0.0 },
{ r = 0.0, g = 1.0, b = 0.0 },
{ r = 0.0, g = 1.0, b = 0.0 },
};
l.largeBuffList = {};
l.largeDebuffList = {};
-- Saved variables
FocusFrameOptions = FocusFrameOptions or {};
local function FocusFrame_SlashCommand(msg)
local cmd,var = strsplit(' ', msg or "")
if cmd == "scale" and tonumber(var) then
FocusFrame_SetScale(var);
elseif cmd == "reset" then
FocusFrame_Reset();
elseif cmd == "lock" then
FocusFrameOptions.lockpos = true;
elseif cmd == "unlock" then
FocusFrameOptions.lockpos = nil;
elseif cmd == "hidewhendead" then
FocusFrame_HideWhenDead(true);
else
FocusFrame_Help();
end
end
SlashCmdList["FOCUSFRAME"] = FocusFrame_SlashCommand;
SLASH_FOCUSFRAME1 = "/focusframe";
function FocusFrame_Help()
DEFAULT_CHAT_FRAME:AddMessage('FocusFrame usage:');
DEFAULT_CHAT_FRAME:AddMessage('/focusframe scale <num> : Set scale (e.g. /focusframe scale 0.7).');
DEFAULT_CHAT_FRAME:AddMessage('/focusframe reset : Reset position.');
DEFAULT_CHAT_FRAME:AddMessage('/focusframe lock : Lock position.');
DEFAULT_CHAT_FRAME:AddMessage('/focusframe unlock : Unlock position.');
DEFAULT_CHAT_FRAME:AddMessage('/focusframe hidewhendead : Hide when focused enemy target is dead. ['..((FocusFrameOptions.hidewhendead and 'ON') or 'OFF')..']');
end
function FocusFrame_SetScale(scale)
if InCombatLockdown() then
DEFAULT_CHAT_FRAME:AddMessage('FocusFrame: You cannot change scale while in combat.');
return;
end
scalenum = tonumber(scale);
if scalenum and scalenum <= 10 then
FocusFrameOptions.scale = scalenum;
local os = FocusFrame:GetScale();
local ox = FocusFrame:GetLeft();
local oy = FocusFrame:GetTop();
FocusFrame:SetScale(scale);
FocusFrame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", ox*os/scale, oy*os/scale);
else
DEFAULT_CHAT_FRAME:AddMessage('Usage: /focusframe scale <num> : Set scale (e.g. /focusframe scale 0.7).');
end
end
function FocusFrame_Reset()
FocusFrame:SetPoint("TOPLEFT", UIParent, "CENTER", 0, 0);
end
function FocusFrame_HideWhenDead(toggle)
if FocusFrameOptions.hidewhendead == nil then
-- Default is ON
FocusFrameOptions.hidewhendead = true;
end
if toggle then
if InCombatLockdown() then
DEFAULT_CHAT_FRAME:AddMessage('FocusFrame: You cannot toggle hidewhendead while in combat.');
return;
end
if FocusFrameOptions.hidewhendead then
FocusFrameOptions.hidewhendead = false;
DEFAULT_CHAT_FRAME:AddMessage('FocusFrame: hidewhendead is now [OFF]. FocusFrame will be always shown.');
else
FocusFrameOptions.hidewhendead = true;
DEFAULT_CHAT_FRAME:AddMessage('FocusFrame: hidewhendead is now [ON]. FocusFrame will be hide when enemy target is dead.');
end
end
if FocusFrameOptions.hidewhendead then
RegisterStateDriver(FocusFrame, "visibility", "[target=focus,noexists][target=focus,harm,dead]hide;show");
else
RegisterStateDriver(FocusFrame, "visibility", "[target=focus,noexists]hide;show");
end
end
function FocusFrame_OnLoad()
this.statusCounter = 0;
this.statusSign = -1;
this.unitHPPercent = 1;
this.buffStartX = 5;
this.buffStartY = 32;
this.buffSpacing = 3;
FocusFrame_Update();
this:RegisterEvent("PLAYER_ENTERING_WORLD");
this:RegisterEvent("PLAYER_FOCUS_CHANGED");
this:RegisterEvent("UNIT_HEALTH");
this:RegisterEvent("UNIT_LEVEL");
this:RegisterEvent("UNIT_FACTION");
this:RegisterEvent("UNIT_CLASSIFICATION_CHANGED");
this:RegisterEvent("UNIT_AURA");
this:RegisterEvent("PLAYER_FLAGS_CHANGED");
this:RegisterEvent("PARTY_MEMBERS_CHANGED");
this:RegisterEvent("RAID_TARGET_UPDATE");
this:RegisterEvent("VARIABLES_LOADED");
local frameLevel = FocusFrameTextureFrame:GetFrameLevel();
FocusFrameHealthBar:SetFrameLevel(frameLevel-1);
FocusFrameManaBar:SetFrameLevel(frameLevel-1);
FocusFrameSpellBar:SetFrameLevel(frameLevel-1);
local showmenu = function()
ToggleDropDownMenu(1, nil, FocusFrameDropDown, "FocusFrame", 120, 10);
end
SecureUnitButton_OnLoad(this, "focus", showmenu);
ClickCastFrames = ClickCastFrames or { };
ClickCastFrames[this] = true;
end
function FocusFrame_Update()
-- This check is here so the frame will hide when the focus goes away
-- even if some of the functions below are hooked by addons.
if ( UnitExists("focus") ) then
TargetofFocus_Update();
UnitFrame_Update();
FocusFrame_CheckLevel();
FocusFrame_CheckFaction();
FocusFrame_CheckClassification();
FocusFrame_CheckDead();
if ( UnitIsPartyLeader("focus") ) then
FocusLeaderIcon:Show();
else
FocusLeaderIcon:Hide();
end
FocusDebuffButton_Update();
FocusPortrait:SetAlpha(1.0);
end
end
function FocusFrame_OnEvent(event)
UnitFrame_OnEvent(event);
if ( event == "PLAYER_ENTERING_WORLD" ) then
FocusFrame_Update();
elseif ( event == "PLAYER_FOCUS_CHANGED" ) then
FocusFrame_Update();
FocusFrame_UpdateRaidTargetIcon();
CloseDropDownMenus();
-- if ( UnitExists("focus") ) then
-- if ( UnitIsEnemy("focus", "player") ) then
-- PlaySound("igCreatureAggroSelect");
-- elseif ( UnitIsFriend("player", "focus") ) then
-- PlaySound("igCharacterNPCSelect");
-- else
-- PlaySound("igCreatureNeutralSelect");
-- end
-- end
elseif ( event == "UNIT_HEALTH" ) then
if ( arg1 == "focus" ) then
FocusFrame_CheckDead();
end
elseif ( event == "UNIT_LEVEL" ) then
if ( arg1 == "focus" ) then
FocusFrame_CheckLevel();
end
elseif ( event == "UNIT_FACTION" ) then
if ( arg1 == "focus" or arg1 == "player" ) then
FocusFrame_CheckFaction();
FocusFrame_CheckLevel();
end
elseif ( event == "UNIT_CLASSIFICATION_CHANGED" ) then
if ( arg1 == "focus" ) then
FocusFrame_CheckClassification();
end
elseif ( event == "UNIT_AURA" ) then
if ( arg1 == "focus" ) then
FocusDebuffButton_Update();
end
elseif ( event == "PLAYER_FLAGS_CHANGED" ) then
if ( arg1 == "focus" ) then
if ( UnitIsPartyLeader("focus") ) then
FocusLeaderIcon:Show();
else
FocusLeaderIcon:Hide();
end
end
elseif ( event == "PARTY_MEMBERS_CHANGED" ) then
TargetofFocus_Update();
FocusFrame_CheckFaction();
elseif ( event == "RAID_TARGET_UPDATE" ) then
FocusFrame_UpdateRaidTargetIcon();
elseif ( event == "VARIABLES_LOADED" ) then
FocusFrameOptions.scale = FocusFrameOptions.scale or 1;
FocusFrame_SetScale(FocusFrameOptions.scale);
FocusFrame_HideWhenDead(false);
end
end
function FocusFrame_OnHide()
PlaySound("INTERFACESOUND_LOSTTARGETUNIT");
CloseDropDownMenus();
end
function FocusFrame_CheckLevel()
local targetLevel = UnitLevel("focus");
if ( UnitIsCorpse("focus") ) then
FocusLevelText:Hide();
FocusHighLevelTexture:Show();
elseif ( targetLevel > 0 ) then
-- Normal level target
FocusLevelText:SetText(targetLevel);
-- Color level number
if ( UnitCanAttack("player", "focus") ) then
local color = GetDifficultyColor(targetLevel);
FocusLevelText:SetVertexColor(color.r, color.g, color.b);
else
FocusLevelText:SetVertexColor(1.0, 0.82, 0.0);
end
FocusLevelText:Show();
FocusHighLevelTexture:Hide();
else
-- Focus is too high level to tell
FocusLevelText:Hide();
FocusHighLevelTexture:Show();
end
end
function FocusFrame_CheckFaction()
if ( UnitPlayerControlled("focus") ) then
local r, g, b;
if ( UnitCanAttack("focus", "player") ) then
-- Hostile players are red
if ( not UnitCanAttack("player", "focus") ) then
r = 0.0;
g = 0.0;
b = 1.0;
else
r = l.FocusUnitReactionColor[2].r;
g = l.FocusUnitReactionColor[2].g;
b = l.FocusUnitReactionColor[2].b;
end
elseif ( UnitCanAttack("player", "focus") ) then
-- Players we can attack but which are not hostile are yellow
r = l.FocusUnitReactionColor[4].r;
g = l.FocusUnitReactionColor[4].g;
b = l.FocusUnitReactionColor[4].b;
elseif ( UnitIsPVP("focus") and not UnitIsPVPSanctuary("focus") and not UnitIsPVPSanctuary("player") ) then
-- Players we can assist but are PvP flagged are green
r = l.FocusUnitReactionColor[6].r;
g = l.FocusUnitReactionColor[6].g;
b = l.FocusUnitReactionColor[6].b;
else
-- All other players are blue (the usual state on the "blue" server)
r = 0.0;
g = 0.0;
b = 1.0;
end
FocusFrameNameBackground:SetVertexColor(r, g, b);
FocusPortrait:SetVertexColor(1.0, 1.0, 1.0);
elseif ( UnitIsTapped("focus") and not UnitIsTappedByPlayer("focus") ) then
FocusFrameNameBackground:SetVertexColor(0.5, 0.5, 0.5);
FocusPortrait:SetVertexColor(0.5, 0.5, 0.5);
else
local reaction = UnitReaction("focus", "player");
if ( reaction ) then
local r, g, b;
r = l.FocusUnitReactionColor[reaction].r;
g = l.FocusUnitReactionColor[reaction].g;
b = l.FocusUnitReactionColor[reaction].b;
FocusFrameNameBackground:SetVertexColor(r, g, b);
else
FocusFrameNameBackground:SetVertexColor(0, 0, 1.0);
end
FocusPortrait:SetVertexColor(1.0, 1.0, 1.0);
end
local factionGroup = UnitFactionGroup("focus");
if ( UnitIsPVPFreeForAll("focus") ) then
FocusPVPIcon:SetTexture("Interface//TargetingFrame//UI-PVP-FFA");
FocusPVPIcon:Show();
elseif ( factionGroup and UnitIsPVP("focus") ) then
FocusPVPIcon:SetTexture("Interface//TargetingFrame//UI-PVP-"..factionGroup);
FocusPVPIcon:Show();
else
FocusPVPIcon:Hide();
end
end
function FocusFrame_CheckClassification()
local classification = UnitClassification("focus");
if ( classification == "worldboss" ) then
FocusFrameTexture:SetTexture("Interface//TargetingFrame//UI-TargetingFrame-Elite");
elseif ( classification == "rareelite" ) then
FocusFrameTexture:SetTexture("Interface//TargetingFrame//UI-TargetingFrame-Rare-Elite");
elseif ( classification == "elite" ) then
FocusFrameTexture:SetTexture("Interface//TargetingFrame//UI-TargetingFrame-Elite");
elseif ( classification == "rare" ) then
FocusFrameTexture:SetTexture("Interface//TargetingFrame//UI-TargetingFrame-Rare");
else
FocusFrameTexture:SetTexture("Interface//TargetingFrame//UI-TargetingFrame");
end
end
function FocusFrame_CheckDead()
if ( (MobHealthDB == nil) and (UnitHealth("focus") <= 0) and UnitIsConnected("focus") ) then
FocusDeadText:Show();
else
FocusDeadText:Hide();
end
end
function FocusFrame_OnUpdate()
if ( TargetofFocusFrame:IsShown() ~= UnitExists("focustarget") ) then
TargetofFocus_Update();
end
end
function FocusDebuffButton_Update()
local button;
local name, rank, icon, count, duration, timeLeft;
local buffCount;
local numBuffs = 0;
-- local largeBuffList = {};
local playerIsFocus = UnitIsUnit("player", "focus");
local cooldown, startCooldownTime;
for i=1, l.MAX_FOCUS_BUFFS do
name, rank, icon, count, duration, timeLeft = UnitBuff("focus", i);
button = getglobal("FocusFrameBuff"..i);
if ( not button ) then
if ( not icon ) then
break;
else
button = CreateFrame("Button", "FocusFrameBuff"..i, FocusFrame, "FocusBuffButtonTemplate");
end
end
if ( icon ) then
getglobal("FocusFrameBuff"..i.."Icon"):SetTexture(icon);
buffCount = getglobal("FocusFrameBuff"..i.."Count");
button:Show();
if ( count > 1 ) then
buffCount:SetText(count);
buffCount:Show();
else
buffCount:Hide();
end
-- Handle cooldowns
cooldown = getglobal("FocusFrameBuff"..i.."Cooldown");
if ( duration ) then
if ( duration > 0 ) then
cooldown:Show();
startCooldownTime = GetTime()-(duration-timeLeft);
CooldownFrame_SetTimer(cooldown, startCooldownTime, duration, 1);
else
cooldown:Hide();
end
-- Set the buff to be big if the buff is cast by the player and the focus is not the player
if ( not playerIsFocus ) then
l.largeBuffList[i] = 1;
else
l.largeBuffList[i] = nil;
end
else
cooldown:Hide();
end
button.id = i;
numBuffs = numBuffs + 1;
button:ClearAllPoints();
else
button:Hide();
end
end
local debuffType, color;
local debuffCount;
local numDebuffs = 0;
-- local largeDebuffList = {};
for i=1, l.MAX_FOCUS_DEBUFFS do
local debuffBorder = getglobal("FocusFrameDebuff"..i.."Border");
name, rank, icon, count, debuffType, duration, timeLeft = UnitDebuff("focus", i);
button = getglobal("FocusFrameDebuff"..i);
if ( not button ) then
if ( not icon ) then
break;
else
button = CreateFrame("Button", "FocusFrameDebuff"..i, FocusFrame, "FocusDebuffButtonTemplate");
debuffBorder = getglobal("FocusFrameDebuff"..i.."Border");
end
end
if ( icon ) then
getglobal("FocusFrameDebuff"..i.."Icon"):SetTexture(icon);
debuffCount = getglobal("FocusFrameDebuff"..i.."Count");
if ( debuffType ) then
color = DebuffTypeColor[debuffType];
else
color = DebuffTypeColor["none"];
end
if ( count > 1 ) then
debuffCount:SetText(count);
debuffCount:Show();
else
debuffCount:Hide();
end
-- Handle cooldowns
cooldown = getglobal("FocusFrameDebuff"..i.."Cooldown");
if ( duration ) then
if ( duration > 0 ) then
cooldown:Show();
startCooldownTime = GetTime()-(duration-timeLeft);
CooldownFrame_SetTimer(cooldown, startCooldownTime, duration, 1);
else
cooldown:Hide();
end
-- Set the buff to be big if the buff is cast by the player
l.largeDebuffList[i] = 1;
else
cooldown:Hide();
l.largeDebuffList[i] = nil;
end
debuffBorder:SetVertexColor(color.r, color.g, color.b);
button:Show();
numDebuffs = numDebuffs + 1;
button:ClearAllPoints();
else
button:Hide();
end
button.id = i;
end
-- Figure out general information that affects buff sizing and positioning
local numFirstRowBuffs;
local buffSize = l.LARGE_BUFF_SIZE;
local buffFrameSize = l.LARGE_BUFF_FRAME_SIZE;
if ( TargetofFocusFrame:IsShown() ) then
numFirstRowBuffs = 5;
else
numFirstRowBuffs = 6;
end
if ( getn(l.largeBuffList) > 0 or getn(l.largeDebuffList) > 0 ) then
numFirstRowBuffs = numFirstRowBuffs - 1;
end
-- Shrink the buffs if there are too many of them
if ( (numBuffs >= numFirstRowBuffs) or (numDebuffs >= numFirstRowBuffs) ) then
buffSize = l.SMALL_BUFF_SIZE;
buffFrameSize = l.SMALL_BUFF_FRAME_SIZE;
end
-- Reset number of buff rows
FocusFrame.buffRows = 0;
-- Position buffs
local size;
local previousWasPlayerCast;
local offset;
for i=1, numBuffs do
if ( l.largeBuffList[i] ) then
size = l.LARGE_BUFF_SIZE;
offset = 3;
previousWasPlayerCast = 1;
else
size = buffSize;
offset = 3;
if ( previousWasPlayerCast ) then
offset = 6;
previousWasPlayerCast = nil;
end
end
FocusFrame_UpdateBuffAnchor("FocusFrameBuff", i, numFirstRowBuffs, numDebuffs, size, offset, TargetofFocusFrame:IsShown());
end
-- Position debuffs
previousWasPlayerCast = nil;
for i=1, numDebuffs do
if ( l.largeDebuffList[i] ) then
size = l.LARGE_BUFF_SIZE;
offset = 4;
previousWasPlayerCast = 1;
else
size = buffSize;
offset = 4;
if ( previousWasPlayerCast ) then
offset = 6;
previousWasPlayerCast = nil;
end
end
FocusFrame_UpdateDebuffAnchor("FocusFrameDebuff", i, numFirstRowBuffs, numBuffs, size, offset, TargetofFocusFrame:IsShown());
end
-- update the spell bar position
Focus_Spellbar_AdjustPosition();
end
function FocusFrame_UpdateBuffAnchor(buffName, index, numFirstRowBuffs, numDebuffs, buffSize, offset, hasTargetofFocus)
local buff = getglobal(buffName..index);
if ( index == 1 ) then
if ( UnitIsFriend("player", "focus") ) then
buff:SetPoint("TOPLEFT", FocusFrame, "BOTTOMLEFT", FocusFrame.buffStartX, FocusFrame.buffStartY);
else
if ( numDebuffs > 0 ) then
buff:SetPoint("TOPLEFT", FocusFrameDebuffs, "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
else
buff:SetPoint("TOPLEFT", FocusFrame, "BOTTOMLEFT", FocusFrame.buffStartX, FocusFrame.buffStartY);
end
end
FocusFrameBuffs:SetPoint("TOPLEFT", buff, "TOPLEFT", 0, 0);
FocusFrameBuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
elseif ( index == (numFirstRowBuffs+1) ) then
buff:SetPoint("TOPLEFT", getglobal(buffName..1), "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
FocusFrameBuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
elseif ( hasTargetofFocus and index == (2*numFirstRowBuffs+1) ) then
buff:SetPoint("TOPLEFT", getglobal(buffName..(numFirstRowBuffs+1)), "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
FocusFrameBuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
elseif ( (index > numFirstRowBuffs) and (mod(index+(l.TARGET_BUFFS_PER_ROW-numFirstRowBuffs), l.TARGET_BUFFS_PER_ROW) == 1) and not hasTargetofFocus ) then
-- Make a new row, have to take the number of buffs in the first row into account
buff:SetPoint("TOPLEFT", getglobal(buffName..(index-l.TARGET_BUFFS_PER_ROW)), "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
FocusFrameBuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
else
-- Just anchor to previous
buff:SetPoint("TOPLEFT", getglobal(buffName..(index-1)), "TOPRIGHT", offset, 0);
end
-- Resize
buff:SetWidth(buffSize);
buff:SetHeight(buffSize);
end
function FocusFrame_UpdateDebuffAnchor(buffName, index, numFirstRowBuffs, numBuffs, buffSize, offset, hasTargetofFocus)
local buff = getglobal(buffName..index);
if ( index == 1 ) then
if ( UnitIsFriend("player", "focus") and (numBuffs > 0) ) then
buff:SetPoint("TOPLEFT", FocusFrameBuffs, "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
else
buff:SetPoint("TOPLEFT", FocusFrame, "BOTTOMLEFT", FocusFrame.buffStartX, FocusFrame.buffStartY);
end
FocusFrameDebuffs:SetPoint("TOPLEFT", buff, "TOPLEFT", 0, 0);
FocusFrameDebuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
elseif ( index == (numFirstRowBuffs+1) ) then
buff:SetPoint("TOPLEFT", getglobal(buffName..1), "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
FocusFrameDebuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
elseif ( hasTargetofFocus and index == (2*numFirstRowBuffs+1) ) then
buff:SetPoint("TOPLEFT", getglobal(buffName..(numFirstRowBuffs+1)), "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
FocusFrameDebuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
elseif ( (index > numFirstRowBuffs) and (mod(index+(l.TARGET_DEBUFFS_PER_ROW-numFirstRowBuffs), l.TARGET_DEBUFFS_PER_ROW) == 1) and not hasTargetofFocus ) then
-- Make a new row
buff:SetPoint("TOPLEFT", getglobal(buffName..(index-l.TARGET_DEBUFFS_PER_ROW)), "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
FocusFrameDebuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
else
-- Just anchor to previous
buff:SetPoint("TOPLEFT", getglobal(buffName..(index-1)), "TOPRIGHT", offset, 0);
end
-- Resize
buff:SetWidth(buffSize);
buff:SetHeight(buffSize);
local debuffFrame = getglobal(buffName..index.."Border");
debuffFrame:SetWidth(buffSize+2);
debuffFrame:SetHeight(buffSize+2);
end
function FocusFrame_HealthUpdate(elapsed, unit)
if ( UnitIsPlayer(unit) ) then
if ( (this.unitHPPercent > 0) and (this.unitHPPercent <= 0.2) ) then
local alpha = 255;
local counter = this.statusCounter + elapsed;
local sign = this.statusSign;
if ( counter > 0.5 ) then
sign = -sign;
this.statusSign = sign;
end
counter = mod(counter, 0.5);
this.statusCounter = counter;
if ( sign == 1 ) then
alpha = (127 + (counter * 256)) / 255;
else
alpha = (255 - (counter * 256)) / 255;
end
FocusPortrait:SetAlpha(alpha);
end
end
end
function FocusHealthCheck()
if ( UnitIsPlayer("focus") ) then
local unitHPMin, unitHPMax, unitCurrHP;
unitHPMin, unitHPMax = this:GetMinMaxValues();
unitCurrHP = this:GetValue();
this:GetParent().unitHPPercent = unitCurrHP / unitHPMax;
if ( UnitIsDead("focus") ) then
FocusPortrait:SetVertexColor(0.35, 0.35, 0.35, 1.0);
elseif ( UnitIsGhost("focus") ) then
FocusPortrait:SetVertexColor(0.2, 0.2, 0.75, 1.0);
elseif ( (this:GetParent().unitHPPercent > 0) and (this:GetParent().unitHPPercent <= 0.2) ) then
FocusPortrait:SetVertexColor(1.0, 0.0, 0.0);
else
FocusPortrait:SetVertexColor(1.0, 1.0, 1.0, 1.0);
end
end
end
function FocusFrameDropDown_OnLoad()
UIDropDownMenu_Initialize(this, FocusFrameDropDown_Initialize, "MENU");
end
function FocusFrameDropDown_Initialize()
local menu;
local name;
local id = nil;
if ( UnitIsUnit("focus", "player") ) then
menu = "SELF";
elseif ( UnitIsUnit("focus", "pet") ) then
menu = "PET";
elseif ( UnitIsPlayer("focus") ) then
id = UnitInRaid("focus");
if ( id ) then
menu = "RAID_PLAYER";
elseif ( UnitInParty("focus") ) then
menu = "PARTY";
else
menu = "PLAYER";
end
else
menu = "RAID_TARGET_ICON";
name = RAID_TARGET_ICON;
end
if ( menu ) then
UnitPopup_ShowMenu(FocusFrameDropDown, menu, "focus", name, id);
end
end
-- Raid target icon function
function FocusFrame_UpdateRaidTargetIcon()
local index = GetRaidTargetIndex("focus");
if ( index ) then
SetRaidTargetIconTexture(FocusRaidTargetIcon, index);
FocusRaidTargetIcon:Show();
else
FocusRaidTargetIcon:Hide();
end
end
function TargetofFocus_OnLoad()
UnitFrame_Initialize("focustarget", TargetofFocusName, TargetofFocusPortrait, TargetofFocusHealthBar, TargetofFocusHealthBarText, TargetofFocusManaBar, TargetofFocusFrameManaBarText);
SetTextStatusBarTextZeroText(TargetofFocusHealthBar, TEXT(DEAD));
this:RegisterEvent("UNIT_AURA");
SecureUnitButton_OnLoad(this, "focustarget");
RegisterUnitWatch(TargetofFocusFrame);
ClickCastFrames = ClickCastFrames or { };
ClickCastFrames[this] = true;
end
function TargetofFocus_OnHide()
FocusDebuffButton_Update();
end
function TargetofFocus_Update()
if ( TargetofFocusFrame:IsShown() ) then
UnitFrame_Update();
TargetofFocus_CheckDead();
TargetofFocusHealthCheck();
RefreshBuffs(TargetofFocusFrame, 0, "focustarget");
end
end
function TargetofFocus_CheckDead()
if ( (UnitHealth("focustarget") <= 0) and UnitIsConnected("focustarget") ) then
TargetofFocusBackground:SetAlpha(0.9);
TargetofFocusDeadText:Show();
else
TargetofFocusBackground:SetAlpha(1);
TargetofFocusDeadText:Hide();
end
end
function TargetofFocusHealthCheck()
if ( UnitIsPlayer("focustarget") ) then
local unitHPMin, unitHPMax, unitCurrHP;
unitHPMin, unitHPMax = TargetofFocusHealthBar:GetMinMaxValues();
unitCurrHP = TargetofFocusHealthBar:GetValue();
TargetofFocusFrame.unitHPPercent = unitCurrHP / unitHPMax;
if ( UnitIsDead("focustarget") ) then
TargetofFocusPortrait:SetVertexColor(0.35, 0.35, 0.35, 1.0);
elseif ( UnitIsGhost("focustarget") ) then
TargetofFocusPortrait:SetVertexColor(0.2, 0.2, 0.75, 1.0);
elseif ( (TargetofFocusFrame.unitHPPercent > 0) and (TargetofFocusFrame.unitHPPercent <= 0.2) ) then
TargetofFocusPortrait:SetVertexColor(1.0, 0.0, 0.0);
else
TargetofFocusPortrait:SetVertexColor(1.0, 1.0, 1.0, 1.0);
end
end
end
function SetFocusSpellbarAspect()
local frameText = getglobal(FocusFrameSpellBar:GetName().."Text");
if ( frameText ) then
frameText:SetTextHeight(10);
frameText:ClearAllPoints();
frameText:SetPoint("TOP", FocusFrameSpellBar, "TOP", 0, 4);
end
local frameBorder = getglobal(FocusFrameSpellBar:GetName().."Border");
if ( frameBorder ) then
frameBorder:SetTexture("Interface//CastingBar//UI-CastingBar-Border-Small");
frameBorder:SetWidth(197);
frameBorder:SetHeight(49);
frameBorder:ClearAllPoints();
frameBorder:SetPoint("TOP", FocusFrameSpellBar, "TOP", 0, 20);
end
local frameFlash = getglobal(FocusFrameSpellBar:GetName().."Flash");
if ( frameFlash ) then
frameFlash:SetTexture("Interface//CastingBar//UI-CastingBar-Flash-Small");
frameFlash:SetWidth(197);
frameFlash:SetHeight(49);
frameFlash:ClearAllPoints();
frameFlash:SetPoint("TOP", FocusFrameSpellBar, "TOP", 0, 20);
end
end
function Focus_Spellbar_OnLoad()
this:RegisterEvent("PLAYER_FOCUS_CHANGED");
this:RegisterEvent("CVAR_UPDATE");
CastingBarFrame_OnLoad("focus", false);
local barIcon = getglobal(this:GetName().."Icon");
barIcon:Show();
-- check to see if the castbar should be shown
if (GetCVar("ShowTargetCastbar") == "0") then
this.showCastbar = false;
end
SetFocusSpellbarAspect();
end
function Focus_Spellbar_OnEvent()
local newevent = event;
local newarg1 = arg1;
-- Check for target specific events
if ( (event == "CVAR_UPDATE") and (arg1 == "SHOW_TARGET_CASTBAR") ) then
if (GetCVar("ShowTargetCastbar") == "0") then
this.showCastbar = false;
else
this.showCastbar = true;
end
if ( not this.showCastbar ) then
this:Hide();
elseif ( this.casting or this.channeling ) then
this:Show();
end
return;
elseif ( event == "PLAYER_FOCUS_CHANGED" ) then
-- check if the new target is casting a spell
local nameChannel = UnitChannelInfo(this.unit);
local nameSpell = UnitCastingInfo(this.unit);
if ( nameChannel ) then
newevent = "UNIT_SPELLCAST_CHANNEL_START";
newarg1 = "focus";
elseif ( nameSpell ) then
newevent = "UNIT_SPELLCAST_START";
newarg1 = "focus";
else
this.casting = nil;
this.channeling = nil;
this:SetMinMaxValues(0, 0);
this:SetValue(0);
this:Hide();
return;
end
-- The position depends on the classification of the target
Target_Spellbar_AdjustPosition();
end
if ( UnitIsUnit("player", "focus") ) then
return;
end
CastingBarFrame_OnEvent(newevent, newarg1);
end
function Focus_Spellbar_AdjustPosition()
local yPos = 5;
if ( FocusFrame.buffRows and FocusFrame.buffRows <= 2 ) then
yPos = 38;
elseif ( FocusFrame.buffRows ) then
yPos = 19 * FocusFrame.buffRows;
end
if ( TargetofFocusFrame:IsShown() ) then
if ( yPos <= 25 ) then
yPos = yPos + 25;
end
else
yPos = yPos - 5;
local classification = UnitClassification("focus");
if ( (yPos < 17) and ((classification == "worldboss") or (classification == "rareelite") or (classification == "elite") or (classification == "rare")) ) then
yPos = 17;
end
end
FocusFrameSpellBar:SetPoint("BOTTOM", "FocusFrame", "BOTTOM", -15, -yPos);
end
function FocusFrameHealthBarText_UpdateTextString(textStatusBar)
if ( not textStatusBar ) then
textStatusBar = this;
end
local string = FocusFrameHealthBarText;
local value = textStatusBar:GetValue();
local valueMin, valueMax = textStatusBar:GetMinMaxValues();
if ( valueMax > 0 ) then
if (MobHealthDB) then
-- No longer use default health bar text functions.
FocusFrameHealthBar.TextString = nil;
if (not UnitIsPlayer("focus") and not UnitIsUnit("focus", "pet")) then
local focusName,focusLevel = UnitName("focus"),UnitLevel("focus");
if (focusName == nil or focusLevel == nil) then
return;
end
local ppp = MobHealth_PPP(focusName..":"..focusLevel);
local curHP = math.floor(value * ppp + 0.5);
local maxHP = math.floor(100 * ppp + 0.5);
if (ppp and ppp ~= 0) then
string:SetText(curHP.." / "..maxHP);
else
string:SetText(value.."%");
end
else
string:SetText(value.." / "..valueMax);
end
string:Show();
end
end
end
function FocusFrameHealthBar_OnValueChanged(value)
FocusFrameHealthBarText_UpdateTextString();
HealthBar_OnValueChanged(value);
end
function FocusFrame_OnDragStart()
if (not FocusFrameOptions.lockpos) then
this:GetParent():StartMoving();
this.isMoving = true;
end
end
function FocusFrame_OnDragStop()
this:GetParent():StopMovingOrSizing();
this.isMoving = false;
end
function FocusFrame_OnEnter()
GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
if (not FocusFrameOptions.lockpos) then
GameTooltip:SetText(FOCUSFRAME_DRAG, nil, nil, nil, nil, 1);
else
GameTooltip:SetText(FOCUSFRAME_DRAG_LOCKED, nil, nil, nil, nil, 1);
end
end
-------------------FocusFrame.xml----------------------------------------
<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="FocusFrame.lua"/>
<Button name="FocusDebuffButtonTemplate" virtual="true">
<Size>
<AbsDimension x="17" y="17"/>
</Size>
<Layers>
<Layer level="ARTWORK">
<Texture name="$parentIcon" setAllPoints="true"/>
</Layer>
<Layer level="OVERLAY">
<Texture name="$parentBorder" file="Interface/Buttons/UI-Debuff-Overlays">
<Size>
<AbsDimension x="17" y="17"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.296875" right="0.5703125" top="0" bottom="0.515625"/>
</Texture>
<FontString name="$parentCount" inherits="NumberFontNormalSmall">
<Anchors>
<Anchor point="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-1" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Cooldown name="$parentCooldown" inherits="CooldownFrameTemplate" reverse="true" hidden="true">
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="0" y="-1"/>
</Offset>
</Anchor>
</Anchors>
</Cooldown>
</Frames>
<Scripts>
<OnUpdate>
if ( GameTooltip:IsOwned(this) ) then
GameTooltip:SetUnitDebuff("focus", this.id);
end
</OnUpdate>
<OnEnter>
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT", 15, -25);
GameTooltip:SetUnitDebuff("focus", this.id);
</OnEnter>
<OnLeave>
GameTooltip:Hide();
</OnLeave>
</Scripts>
</Button>
<Button name="FocusBuffButtonTemplate" virtual="true">
<Size>
<AbsDimension x="21" y="21"/>
</Size>
<Layers>
<Layer level="ARTWORK">
<Texture name="$parentIcon" setAllPoints="true"/>
</Layer>
<Layer level="OVERLAY">
<FontString name="$parentCount" inherits="NumberFontNormalSmall">
<Anchors>
<Anchor point="BOTTOMRIGHT">
<Offset>
<AbsDimension x="2" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Cooldown name="$parentCooldown" inherits="CooldownFrameTemplate" reverse="true">
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="0" y="-1"/>
</Offset>
</Anchor>
</Anchors>
</Cooldown>
</Frames>
<Scripts>
<OnUpdate>
if ( GameTooltip:IsOwned(this) ) then
GameTooltip:SetUnitBuff("focus", this.id);
end
</OnUpdate>
<OnEnter>
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT", 15, -25);
GameTooltip:SetUnitBuff("focus", this.id);
</OnEnter>
<OnLeave>
GameTooltip:Hide();
</OnLeave>
</Scripts>
</Button>
<Button name="FocusFrame" frameStrata="LOW" toplevel="true" movable="true" inherits="SecureUnitButtonTemplate" parent="UIParent" clampedToScreen="true">
<Size>
<AbsDimension x="232" y="100"/>
</Size>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<HitRectInsets>
<AbsInset left="96" right="6" top="4" bottom="9"/>
</HitRectInsets>
<Layers>
<Layer level="BACKGROUND">
<Texture name="FocusFrameBackground">
<Size>
<AbsDimension x="119" y="41"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="-106" y="-22"/>
</Offset>
</Anchor>
</Anchors>
<Color r="0" g="0" b="0" a="0.5"/>
</Texture>
<Texture name="FocusFrameNameBackground" file="Interface/TargetingFrame/UI-TargetingFrame-LevelBackground">
<Size>
<AbsDimension x="119" y="19"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="-106" y="-22"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
<Layer level="BORDER">
<Texture name="FocusPortrait">
<Size>
<AbsDimension x="64" y="64"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="-42" y="-12"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
<Frames>
<Frame name="FocusFrameTitle">
<Size>
<AbsDimension x="71" y="16"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="67" y="-20"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="FocusFrameTitleLeft" file="Interface/CharacterFrame/UI-CharacterFrame-GroupIndicator">
<Size>
<AbsDimension x="24" y="16"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT"/>
</Anchors>
<TexCoords left="0" right="0.1875" top="0" bottom="1"/>
</Texture>
<Texture name="FocusFrameTitleRight" file="Interface/CharacterFrame/UI-CharacterFrame-GroupIndicator">
<Size>
<AbsDimension x="24" y="16"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT"/>
</Anchors>
<TexCoords left="0.53125" right="0.71875" top="0" bottom="1"/>
</Texture>
<Texture name="FocusFrameTitleMiddle" file="Interface/CharacterFrame/UI-CharacterFrame-GroupIndicator">
<Size>
<AbsDimension x="0" y="16"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="FocusFrameTitleLeft" relativePoint="RIGHT"/>
<Anchor point="RIGHT" relativeTo="FocusFrameTitleRight" relativePoint="LEFT"/>
</Anchors>
<TexCoords left="0.1875" right="0.53125" top="0" bottom="1"/>
</Texture>
<FontString name="FocusFrameTitleText" inherits="GameFontHighlightSmall" text="FOCUSFRAME_TITLE">
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="10" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnLoad>
FocusFrameTitleLeft:SetAlpha(0.3);
FocusFrameTitleRight:SetAlpha(0.3);
FocusFrameTitleMiddle:SetAlpha(0.3);
FocusFrameTitleText:SetAlpha(0.7);
this:SetWidth(FocusFrameTitleText:GetWidth()+40);
this:RegisterForDrag("LeftButton");
</OnLoad>
<OnDragStart>
FocusFrame_OnDragStart();
</OnDragStart>
<OnDragStop>
FocusFrame_OnDragStop();
</OnDragStop>
<OnEnter>
FocusFrame_OnEnter();
</OnEnter>
<OnLeave>
GameTooltip:Hide();
</OnLeave>
</Scripts>
<Frames>
</Frames>
</Frame>
<Frame name="FocusFrameTextureFrame" setAllPoints="true">
<Layers>
<Layer level="BACKGROUND">
<Texture name="FocusFrameTexture" file="Interface/TargetingFrame/UI-TargetingFrame">
<TexCoords left="0.09375" right="1.0" top="0" bottom="0.78125"/>
</Texture>
<FontString name="FocusName" inherits="GameFontNormalSmall">
<Size>
<AbsDimension x="100" y="10"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="-50" y="19"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="FocusLevelText" inherits="GameFontNormalSmall">
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="63" y="-16"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="FocusDeadText" inherits="GameFontNormalSmall" text="DEAD">
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="-50" y="3"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="FocusFrameHealthBarText" inherits="TextStatusBarText">
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="-50" y="3"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="FocusFrameManaBarText" inherits="TextStatusBarText">
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="-50" y="-8"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
<Layer level="ARTWORK">
<Texture name="FocusHighLevelTexture" file="Interface/TargetingFrame/UI-TargetingFrame-Skull">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="63" y="-16"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<Texture name="FocusLeaderIcon" file="Interface/GroupFrame/UI-Group-LeaderIcon" hidden="true">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="-44" y="-10"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<Texture name="FocusPVPIcon" hidden="true">
<Size>
<AbsDimension x="64" y="64"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="3" y="-20"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<Texture name="FocusRaidTargetIcon" file="Interface/TargetingFrame/UI-RaidTargetingIcons" hidden="true">
<Size>
<AbsDimension x="26" y="26"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="-73" y="-14"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
</Frame>
<Frame name="FocusFrameDropDown" inherits="UIDropDownMenuTemplate" id="1" hidden="true">
<Size>
<AbsDimension x="10" y="10"/>
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="10" y="-60"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
FocusFrameDropDown_OnLoad();
</OnLoad>
</Scripts>
</Frame>
<StatusBar name="FocusFrameHealthBar" inherits="TextStatusBar">
<Size>
<AbsDimension x="119" y="12"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="-106" y="-41"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
TextStatusBar_Initialize();
this.textLockable = 1;
this.cvar = "targetStatusText";
this.cvarLabel = "STATUS_TEXT_TARGET";
this.zeroText = "";
</OnLoad>
<OnValueChanged>
FocusFrameHealthBar_OnValueChanged(arg1);
FocusHealthCheck();
</OnValueChanged>
</Scripts>
<BarTexture file="Interface/TargetingFrame/UI-StatusBar"/>
</StatusBar>
<StatusBar name="FocusFrameManaBar" inherits="TextStatusBar">
<Size>
<AbsDimension x="119" y="12"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="-106" y="-52"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
TextStatusBar_Initialize();
this.textLockable = 1;
this.cvar = "targetStatusText";
this.cvarLabel = "STATUS_TEXT_TARGET";
</OnLoad>
</Scripts>
<BarTexture file="Interface/TargetingFrame/UI-StatusBar"/>
<BarColor r="0" g="0" b="1.0"/>
</StatusBar>
<StatusBar name="FocusFrameSpellBar" inherits="CastingBarFrameTemplate" hidden="true">
<Size>
<AbsDimension x="150" y="10"/>
</Size>
<Anchors>
<Anchor point="BOTTOM">
<Offset>
<AbsDimension x="-15" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnShow>
Focus_Spellbar_AdjustPosition();
</OnShow>
<OnLoad>
Focus_Spellbar_OnLoad();
</OnLoad>
<OnEvent>
Focus_Spellbar_OnEvent();
</OnEvent>
</Scripts>
</StatusBar>
<Frame name="FocusFrameBuffs" hidden="true">
<Size>
<AbsDimension x="10" y="10"/>
</Size>
</Frame>
<Frame name="FocusFrameDebuffs" hidden="true">
<Size>
<AbsDimension x="10" y="10"/>
</Size>
</Frame>
</Frames>
<Scripts>
<OnLoad>
UnitFrame_Initialize("focus", FocusName, FocusPortrait,
FocusFrameHealthBar, FocusFrameHealthBarText,
FocusFrameManaBar, FocusFrameManaBarText);
this.noTextPrefix = true;
FocusFrame_OnLoad();
</OnLoad>
<OnEvent>
FocusFrame_OnEvent(event);
</OnEvent>
<OnUpdate>
FocusFrame_OnUpdate();
FocusFrame_HealthUpdate(arg1, "focus");
</OnUpdate>
<OnHide>
FocusFrame_OnHide();
</OnHide>
<OnEnter>
UnitFrame_OnEnter(self);
</OnEnter>
<OnLeave>
UnitFrame_OnLeave();
</OnLeave>
</Scripts>
</Button>
<Button name="TargetofFocusFrame" toplevel="true" movable="true" inherits="SecureUnitButtonTemplate" parent="FocusFrame" hidden="false">
<Size>
<AbsDimension x="93" y="45"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-35" y="-10"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="TargetofFocusBackground">
<Size>
<AbsDimension x="46" y="15"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset>
<AbsDimension x="42" y="13"/>
</Offset>
</Anchor>
</Anchors>
<Color r="0" g="0" b="0" a="0.5"/>
</Texture>
</Layer>
<Layer level="BORDER">
<Texture name="TargetofFocusPortrait">
<Size>
<AbsDimension x="35" y="35"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="6" y="-6"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
<Frames>
<Frame name="TargetofFocusTextureFrame" setAllPoints="true">
<Layers>
<Layer level="BORDER">
<Texture name="TargetofFocusTexture" file="Interface/TargetingFrame/UI-TargetofTargetFrame">
<TexCoords left="0.015625" right="0.7265625" top="0" bottom="0.703125"/>
</Texture>
<FontString name="TargetofFocusName" inherits="GameFontNormalSmall" justifyH="LEFT">
<Size>
<AbsDimension x="100" y="10"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset>
<AbsDimension x="42" y="2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="TargetofFocusDeadText" inherits="GameFontNormalSmall" text="DEAD">
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="15" y="1"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnLoad>
RaiseFrameLevel(this);
</OnLoad>
</Scripts>
</Frame>
<StatusBar name="TargetofFocusHealthBar" inherits="TextStatusBar">
<Size>
<AbsDimension x="46" y="7"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="-2" y="-15"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnValueChanged>
TargetofFocusHealthCheck();
</OnValueChanged>
</Scripts>
<BarTexture file="Interface/TargetingFrame/UI-StatusBar"/>
<BarColor r="0" g="1.0" b="0"/>
</StatusBar>
<StatusBar name="TargetofFocusManaBar" inherits="TextStatusBar">
<Size>
<AbsDimension x="46" y="7"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="-2" y="-23"/>
</Offset>
</Anchor>
</Anchors>
<BarTexture file="Interface/TargetingFrame/UI-StatusBar"/>
<BarColor r="0" g="0" b="1.0"/>
</StatusBar>
<Frame name="$parentDebuff1" inherits="TargetofTargetBuffButtonTemplate" id="1">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="4" y="-10"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentDebuff2" inherits="TargetofTargetBuffButtonTemplate" id="2">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentDebuff1" relativePoint="RIGHT">
<Offset>
<AbsDimension x="1" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentDebuff3" inherits="TargetofTargetBuffButtonTemplate" id="3">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentDebuff1" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentDebuff4" inherits="TargetofTargetBuffButtonTemplate" id="4">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentDebuff3" relativePoint="RIGHT">
<Offset>
<AbsDimension x="1" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
</Frames>
<Scripts>
<OnLoad>
TargetofFocus_OnLoad();
</OnLoad>
<OnShow>
FocusDebuffButton_Update();
</OnShow>
<OnHide>
TargetofFocus_OnHide();
</OnHide>
<OnEvent>
UnitFrame_OnEvent(event);
</OnEvent>
<OnUpdate>
TargetofFocus_Update();
</OnUpdate>
</Scripts>
</Button>
</Ui>
--------------------------------FocusFrame.toc-----------------------------------------
## Interface: 20400
## Title: FocusFrame
## Notes: A movable frame like TargetFrame to show your focus.
## Title-zhCN: 焦点目标 FocusFrame
## Notes-zhCN: 显示焦点目标(Focus)的头像|n使用方法:选定目标后/Focus
## Title-zhTW: 焦點目標 FocusFrame
## Notes-zhTW: 顯示焦點目標(Focus)的頭像|n使用方法:選定目標後/Focus
## Version: 2.3.6
## Author: Tageshi
## SavedVariables: FocusFrameOptions
FocusFrame.xml
焦点目标插件研究(wow2.4版本)相关推荐
- 基于深度学习的目标检测研究综述
基于深度学习的目标检测研究综述 摘要:深度学习是机器学习的一个研究领域,近年来受到越来越多的关注.最近几年,深度学习在目标检测领域取得了不少突破性的进展,已经运用到具体的目标检测任务上.本文首先详细介 ...
- 基于深度卷积神经网络的目标检测研究综述
基于深度卷积神经网络的目标检测研究综述 人工智能技术与咨询 来自<光学精密工程> ,作者范丽丽等 摘要:作为计算机视觉中的基本视觉识别问题,目标检测在过去的几十年中得到了广泛地研究.目标检 ...
- html 折叠焦点图切换,jQuery层叠式图片切换焦点图插件
本文作者html5tricks,转载请注明出处 之前我们为大家分享过一款jQuery内容层叠滚动切换动画插件,主要是针对文字的层叠式切换.今天要介绍的也是一款层叠式切换插件,不过它是一款 下面我们一起 ...
- 基于yolov5的交通标志牌的目标检测研究设计——思路及概念
有需要项目的可以私信博主!!!!! 一.选题的目的.意义及研究现状 (1)选题的目的和意义 随着人们对道路安全性的重视和城市交通量的不断增加,交通标志牌作为道路交通安全的重要组成部分之一,扮演着十分重 ...
- 安装旧版本插件_iOS 应用降级插件,支持任意版本升降
软件版本越来越高,功能越来越来越多,升级过后发现还是简简单单的老版本好用怎么办? 对于iOS用户来说,这还真不好办.在App Store下载的应用都是当前的最新版,安装方式也不像安卓系统需要先下载安装 ...
- jQuery图片轮播(焦点图)插件(转载)
本文转自http://www.oschina.net/code/snippet_206691_11515?p=3#comments 特点:兼容IE6+,Chrome,Firefox,Opera,saf ...
- Jquery插件使用 焦点图插件 MyFocus ,另外记录一款插件 KinMaxShow大背景图插件。...
以前用flash做首页图片轮播.最近的网站里用到一个插件MyFocus插件焦点图插件 用法如下: <script type="text/javascript"> //设 ...
- 分享10款常用的jQuery焦点图插件
爱编程一直在收集整理编程相关的知识和解决方案,今天小编为大家带来10款非常常用的jquery焦点图插件. 1.jQuery可自动播放动画的焦点图插件 之前我们已经分享过很多非常实用的jQuery焦点图 ...
- Android课题研究的主要观点,二、本课题的研究目标、研究内容、主要观点和创新之处.doc...
二.本课题的研究目标.研究内容.主要观点和创新之处 我们的研究分年级段分别有所侧重,并体现层次性. ... 通过前两阶段的研究,结合我校农村实验小学的实际情况,逐步形成以信息技术促进语.数.英课程目标 ...
最新文章
- JAVAC 命令详解
- LeetCode算法题9:递归和回溯-N皇后问题
- 深度学习核心技术精讲100篇(十四)-一文带你看懂GPflow的前世今生
- leetcode523 Continuous Subarray Sum
- NSArray ----NSMutableArray
- Android Activity标签属性
- Http与WWW服务精解
- xml转化为Dictionary
- python复习题答案_python的复习题和答案合集
- ModuleNotFoundError: No module named xxx 解决办法
- 爬虫伪装请求头-fake-useragent
- 1. 通用基础算法(1.1枚举算法/1.2递推算法/1.3递归算法)
- android客户端服务器传输,【图片】【转】通过Android 客户端上传数据到服务器【aide吧】_百度贴吧...
- git commit 规范不对导致报错subject may not be empty [subject-empty]type may not be empty [type-empty]
- C#POP3协议实现SSL验证登陆GMAIL
- java使用java.lang.Math类,生成100个0-99之间的随机整数,并找出它们中间的最大值和最小值,并统计大于50的整数的个数。打印3次运行结果,看是否相同。
- IP数据报首部的格式identification
- re.search与re.findall的区别
- 第一个发布成功的UI组件库
- Text to Speach文本转语音实现