Main Tank Helper



这个Addon添加了一个小巧的可移动框体在屏幕上能显示你的队员正准备攻击的怪物。如果只有一个玩家攻击这个怪物那这个框体显示绿色并且显示出正在攻击的怪物名称。如果另一个队员也使用近战伤害了这个怪物那这个框体就会显示红色并且显示攻击该怪物的玩家的所有名字



This addon adds a small movable bar to your UI that shows who in your party is being attacked by mobs. If the player is the only party member being hit (melee) the bar is green and shows the names of mobs hitting the character. If another member of the party is taking melee damage the bar turns red and shows the party member’s name and what is hitting them.

This addon was designed to help tanks easier tell if they have complete aggro on a group of mobs and alert them when a party member is taking damage.

— v1.1 - 4/24/05
settings such as on/off and enemy names on/off are now saved across sessions
added chat commands /mth onoffenemy onenemy off
resized window to half it’s original size & reduced font size

— Main Tank Helper
— Faylin - www.wow-ni.com

— v1.1 - 4/24/05
settings such as on/off and enemy names on/off are now saved across sessions
added chat commands /mth on|off|enemy on|enemy off
resized window to half it’s original size & reduced font size

— v1.0 - 4/21/05

function MTHelper_OnLoad()

RegisterForSave("mthenabled");
RegisterForSave("mthenemy");

this:RegisterEvent("PLAYER_REGEN_DISABLED");
this:RegisterEvent("PLAYER_REGEN_ENABLED" );
this:RegisterEvent("UNIT_COMBAT");
this:RegisterEvent("CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS");
this:RegisterEvent("CHAT_MSG_COMBAT_CREATURE_VS_SELF_MISSES");
this:RegisterEvent("CHAT_MSG_COMBAT_CREATURE_VS_PARTY_HITS");
this:RegisterEvent("CHAT_MSG_COMBAT_CREATURE_VS_PARTY_MISSES");
this:Hide();

SLASH_MTHELPER1 = "/mthelper";
SLASH_MTHELPER2 = "/mth";
SlashCmdList["MTHELPER"] = function (msg)
MTHelper_SlashCmd(msg);
end

end

function MTHelper_SlashCmd(arg)

if ( arg == "" ) then
DEFAULT_CHAT_FRAME:AddMessage("Use: /mth on|off|enemy on| enemy off");
end

if ( arg == "on" ) then
mthenabled = 1;
DEFAULT_CHAT_FRAME:AddMessage(mthenabled.." - MTHelper ON");
end

if ( arg == "off" ) then
mthenabled = 0;
DEFAULT_CHAT_FRAME:AddMessage(mthenabled.." - MTHelper OFF");
end

if ( arg == "enemy on" ) then
mthenemy = 1;
DEFAULT_CHAT_FRAME:AddMessage("MTHelper: Showing enemy names");
end

if ( arg == "enemy off" ) then
mthenemy = 0;
DEFAULT_CHAT_FRAME:AddMessage("MTHelper: Hiding enemy names");
end

end

function MTHelper_OnEvent(event)
if ( event == "PLAYER_REGEN_DISABLED" ) then
if ( mthenabled == 0 ) then
return;
else
this:Show();
return;
end
end
if ( event == "CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS" or event == "CHAT_MSG_COMBAT_CREATURE_VS_SELF_MISSES" ) then
textll = arg1;
if string.find(textll, "hits") then
hitpos = string.find(textll, "hits");
MTHelperBackdrop:SetBackdropColor(0, 1, 0, .75);
elseif string.find(textll, "crits") then
hitpos = string.find(textll, "crits");
MTHelperBackdrop:SetBackdropColor(0, 1, 0, .75);
elseif string.find(textll, "attacks") then
hitpos = string.find(textll, "attacks");
MTHelperBackdrop:SetBackdropColor(0, 1, 0, .75);
elseif string.find(textll, "misses") then
hitpos = string.find(textll, "misses");
MTHelperBackdrop:SetBackdropColor(0, 1, 0, .75);
end

enemy = string.sub(textll, 1, hitpos - 2);
ttarget:SetText(enemy)
return;
end
if ( event == "CHAT_MSG_COMBAT_CREATURE_VS_PARTY_HITS" or event == "CHAT_MSG_COMBAT_CREATURE_VS_PARTY_MISSES" ) then
if ( mthenemy == 1 ) then
textll = arg1;
—all victim searches have 1 extra added on for the space
if string.find(textll, "hits") then
hitpos = string.find(textll, "hits");
victim = string.sub(textll, hitpos + 5);
MTHelperBackdrop:SetBackdropColor(1, 0, 0, .75);
elseif string.find(textll, "crits") then
hitpos = string.find(textll, "crits");
victim = string.sub(textll, hitpos + 6);
MTHelperBackdrop:SetBackdropColor(1, 0, 0, .75);
elseif string.find(textll, "attacks") then
hitpos = string.find(textll, "attacks");
victim = string.sub(textll, hitpos + 9);
— have to +9 because there is a . after "attacks"
MTHelperBackdrop:SetBackdropColor(1, 0, 0, .75);
elseif string.find(textll, "misses") then
hitpos = string.find(textll, "misses");
victim = string.sub(textll, hitpos + 6);
MTHelperBackdrop:SetBackdropColor(1, 0, 0, .75);
end

enemy = string.sub(textll, 1, hitpos - 2);
namepos = string.find(victim, " ");
victim = string.sub(victim, 1, namepos);
ttarget:SetText(victim.." - "..enemy)
return;
else
textll = arg1;
—all victim searches have 1 extra added on for the space
if string.find(textll, "hits") then
hitpos = string.find(textll, "hits");
victim = string.sub(textll, hitpos + 5);
MTHelperBackdrop:SetBackdropColor(1, 0, 0, .75);
elseif string.find(textll, "crits") then
hitpos = string.find(textll, "crits");
victim = string.sub(textll, hitpos + 6);
MTHelperBackdrop:SetBackdropColor(1, 0, 0, .75);
elseif string.find(textll, "attacks") then
hitpos = string.find(textll, "attacks");
victim = string.sub(textll, hitpos + 9);
— have to +9 because there is a . after "attacks"
MTHelperBackdrop:SetBackdropColor(1, 0, 0, .75);
elseif string.find(textll, "misses") then
hitpos = string.find(textll, "misses");
victim = string.sub(textll, hitpos + 6);
MTHelperBackdrop:SetBackdropColor(1, 0, 0, .75);
end
namepos = string.find(victim, " ");
victim = string.sub(victim, 1, namepos);
ttarget:SetText(victim);
return;
end
end
if ( event == "PLAYER_REGEN_ENABLED" ) then
this:Hide();
return;
end
if ( event == "UNIT_COMBAT" ) then
— MTHelper_Update();
return;
end
end