📄 tipbuddy.lua
字号:
text = line:GetText();
else
text = line:GetText();
end
--GREEN_FONT_COLOR_CODE..PVP_RANK_CIVILIAN..FONT_COLOR_CODE_CLOSE
TipBuddy.gtt_xtra[j] = text;
if (lineR:GetText() and lineR:IsShown()) then
TipBuddy.gtt_xtraR[j] = lineR:GetText();
else
TipBuddy.gtt_xtraR[j] = "";
end
TB_AddMessage(line:GetText());
j = j + 1;
--/script TB_AddMessage(GameTooltipTextLeft8:GetText());
end
else
return;
end
end
--------------------------------------------------------------------------------------------------------------------------------------
-- HEALTH TEXT
--------------------------------------------------------------------------------------------------------------------------------------
function TipBuddy_UpdateHealthText( frame, type, unit )
if (not TipBuddy_SavedVars[type].txt_hth or TipBuddy_SavedVars[type].txt_hth == 0) then
TipBuddy_SavedVars[type].txt_hth = 0;
frame:Hide();
return;
end
--TipBuddy_HealthTextGTT, TipBuddy_UpdateHealthTextGTT( TipBuddy_HealthTextGTT, unit )
--TipBuddy_HealthText
local health = UnitHealth(unit);
--local percent = tonumber(format("%.0f", ( (health / UnitHealthMax(unit)) * 100 ) ));
local text = getglobal(frame:GetName().."Text");
if ( unit == "player" or UnitInParty(unit) or UnitInRaid(unit)) then
text:SetText( health.." / "..UnitHealthMax(unit) );
else
if (MobHealthDB) then
local ppp = MobHealth_PPP(UnitName(unit)..":"..UnitLevel(unit));
local curHP = math.floor(health * ppp + 0.5);
local maxHP = math.floor(100 * ppp + 0.5);
if (curHP and maxHP and maxHP ~= 0) then
text:SetText( curHP.." / "..maxHP );
--TB_AddMessage(curHP.." / "..maxHP);
else
text:SetText( health.."%" );
end
else
text:SetText( health.."%" );
end
end
frame:Show();
end
function TipBuddy_UpdateManaText( frame, type, unit )
if (not frame or not unit or TipBuddy_SavedVars[type].txt_mna == 0) then
return;
end
frame:Hide();
--local percent = (UnitMana(unit) / UnitManaMax(unit)) * 100;
--local mana = UnitMana(unit);
local text = getglobal(frame:GetName().."Text");
if (UnitMana(unit) and UnitMana(unit) > 0) then
frame:Show();
text:SetText( UnitMana(unit).." / "..UnitManaMax(unit) );
end
end
function TB_GetHealth_Text( unit, type )
--TipBuddy_HealthTextGTT, TipBuddy_UpdateHealthTextGTT( TipBuddy_HealthTextGTT, unit )
--TipBuddy_HealthText
local health, healthmax;
if (type == "percent") then
health = UnitHealth(unit);
--local percent = tonumber(format("%.0f", ( (health / UnitHealthMax(unit)) * 100 ) ));
if ( unit == "player" or UnitInParty(unit) or UnitInRaid(unit)) then
--return health.."/"..UnitHealthMax(unit);
return tonumber(format("%.0f", ( (health / UnitHealthMax(unit)) * 100 ) ));
else
return health;
end
elseif (type == "current") then
health = UnitHealth(unit);
if ( unit == "player" or UnitInParty(unit) or UnitInRaid(unit)) then
return health;
else
if (MobHealthDB) then
local ppp = MobHealth_PPP(UnitName(unit)..":"..UnitLevel(unit));
local curHP = math.floor(health * ppp + 0.5);
local maxHP = math.floor(100 * ppp + 0.5);
if (curHP and maxHP and maxHP ~= 0) then
return curHP;
else
return health;
end
else
return health;
end
end
else
healthmax = UnitHealthMax(unit);
if ( unit == "player" or UnitInParty(unit) or UnitInRaid(unit)) then
return healthmax;
else
if (MobHealthDB) then
local ppp = MobHealth_PPP(UnitName(unit)..":"..UnitLevel(unit));
local maxHP = math.floor(100 * ppp + 0.5);
if (maxHP and maxHP ~= 0) then
return maxHP;
else
return healthmax;
end
else
return healthmax;
end
end
end
end
--------------------------------------------------------------------------------------------------------------------------------------
-- GET/SHOW FACTION
--------------------------------------------------------------------------------------------------------------------------------------
function TipBuddy_TargetInfo_ShowFaction( type, unit )
TipBuddy_FactionFrameGTT:Hide();
TipBuddy_FactionFrame:Hide();
if (not unit) then
return;
end
local factionGroup = UnitFactionGroup(unit);
if (not factionGroup) then
return;
end
local frame, sframe;
if ( TipBuddy_SavedVars[TipBuddy.targetType].off == 1 ) then
frame = getglobal("TipBuddy_FactionFrame");
sframe = "TipBuddy_FactionFrame";
else
frame = getglobal("TipBuddy_FactionFrameGTT");
sframe = "TipBuddy_FactionFrameGTT";
end
local frameIcon = getglobal(sframe.."Icon");
local frameText = getglobal(sframe.."Text");
--how in the world does this happen?
if ( UnitIsPVPFreeForAll(unit) ) then
frameIcon:SetTexture("Interface\\TargetingFrame\\UI-PVP-FFA");
frame:Show();
if (TipBuddy_SavedVars[TipBuddy.targetType].txt_pvp == 1) then
frameIcon:Hide();
frameText:Show();
frameText:SetText("FFA");
else
frameIcon:Show();
frameText:Hide();
end
elseif ( UnitIsPVP(unit) ) then
--TB_AddMessage("txt_pvp = "..TipBuddy_SavedVars[TipBuddy.targetType].txt_pvp);
frameIcon:SetTexture("Interface\\TargetingFrame\\UI-PVP-"..factionGroup);
frame:Show();
if (TipBuddy_SavedVars[TipBuddy.targetType].txt_pvp == 1) then
frameIcon:Hide();
frameText:Show();
frameText:SetText("PvP");
else
frameIcon:Show();
frameText:Hide();
end
else
frame:Hide();
end
end
--------------------------------------------------------------------------------------------------------------------------------------
-- SET BACKGROUND COLOR
--------------------------------------------------------------------------------------------------------------------------------------
function TipBuddy_SetFrame_BackgroundColor( type, unit )
if (not unit or not type) then
TipBuddy_SetFrame_NonUnit_BackgroundColor( type );
--TB_AddMessage("NO UNIT OR TYPE - SETTING BG");
return;
end
local targettype = TipBuddy_SavedVars[type];
local r, br, g, bg, b, bb, a, ba;
if (not targettype.c_bdp) then
targettype.c_bdp = 0;
end
if (not targettype.c_bdb) then
targettype.c_bdb = 0;
end
TB_AddMessage("bdp = "..targettype.c_bdp);
if (GetGuildInfo("player") and GetGuildInfo(unit) == GetGuildInfo("player")) then
type = "guild";
targettype = TipBuddy_SavedVars[type];
r, g, b, a = targettype.bgcolor.r, targettype.bgcolor.g, targettype.bgcolor.b, targettype.bgcolor.a;
TB_AddMessage("setting BG color to Guild");
elseif (targettype.c_bdp and targettype.c_bdp == 1) then
--[[
tbcolor_lvl_impossible = TipBuddy_RGBToHexColor(colors.lvl_imp.r, colors.lvl_imp.g, colors.lvl_imp.b);
tbcolor_lvl_verydifficult = TipBuddy_RGBToHexColor(colors.lvl_vdf.r, colors.lvl_vdf.g, colors.lvl_vdf.b);
tbcolor_lvl_difficult = TipBuddy_RGBToHexColor(colors.lvl_dif.r, colors.lvl_dif.g, colors.lvl_dif.b);
tbcolor_lvl_standard = TipBuddy_RGBToHexColor(colors.lvl_stn.r, colors.lvl_stn.g, colors.lvl_stn.b);
tbcolor_lvl_trivial = TipBuddy_RGBToHexColor(colors.lvl_trv.r, colors.lvl_trv.g, colors.lvl_trv.b);
]]
local levelDiff = UnitLevel("mouseover") - UnitLevel("player");
local colors = TipBuddy_SavedVars["textcolors"];
if ( levelDiff >= 5 ) then
r, g, b = colors.lvl_imp.r, colors.lvl_imp.g, colors.lvl_imp.b;
elseif ( levelDiff >= 3 ) then
r, g, b = colors.lvl_vdf.r, colors.lvl_vdf.g, colors.lvl_vdf.b;
elseif ( levelDiff >= -2 ) then
r, g, b = colors.lvl_dif.r, colors.lvl_dif.g, colors.lvl_dif.b;
elseif ( -levelDiff <= GetQuestGreenRange() ) then
r, g, b = colors.lvl_stn.r, colors.lvl_stn.g, colors.lvl_stn.b;
else
r, g, b = colors.lvl_trv.r, colors.lvl_trv.g, colors.lvl_trv.b;
end
r, g, b = TB_NoNegative(r - 0.35), TB_NoNegative(g - 0.35), TB_NoNegative(b - 0.35);
a = targettype.bgcolor.a;
elseif (targettype.c_bdp and targettype.c_bdp == 2) then
local reaction = TipBuddy_GetUnitReaction( unit );
local colors = TipBuddy_SavedVars["textcolors"];
TB_AddMessage("reaction = "..reaction);
--[[ tbcolor_nam_hostile = TipBuddy_RGBToHexColor(colors.nam_hos.r, colors.nam_hos.g, colors.nam_hos.b);
tbcolor_nam_neutral = TipBuddy_RGBToHexColor(colors.nam_neu.r, colors.nam_neu.g, colors.nam_neu.b);
tbcolor_nam_friendly = TipBuddy_RGBToHexColor(colors.nam_fri.r, colors.nam_fri.g, colors.nam_fri.b);
tbcolor_nam_caution = TipBuddy_RGBToHexColor(colors.nam_cau.r, colors.nam_cau.g, colors.nam_cau.b);
tbcolor_nam_pvp = TipBuddy_RGBToHexColor(colors.nam_pvp.r, colors.nam_pvp.g, colors.nam_pvp.b);
tbcolor_nam_tappedplayer = TipBuddy_RGBToHexColor(colors.nam_tpp.r, colors.nam_tpp.g, colors.nam_tpp.b);
tbcolor_nam_tappedother = TipBuddy_RGBToHexColor(colors.nam_tpo.r, colors.nam_tpo.g, colors.nam_tpo.b);]]
if (reaction == "hostile") then
r, g, b = colors.nam_hos.r, colors.nam_hos.g, colors.nam_hos.b;
elseif (reaction == "neutral") then
r, g, b = colors.nam_neu.r, colors.nam_neu.g, colors.nam_neu.b;
elseif (reaction == "friendly") then
r, g, b = colors.nam_fri.r, colors.nam_fri.g, colors.nam_fri.b;
elseif (reaction == "caution") then
r, g, b = colors.nam_cau.r, colors.nam_cau.g, colors.nam_cau.b;
elseif (reaction == "pvp") then
r, g, b = colors.nam_pvp.r, colors.nam_pvp.g, colors.nam_pvp.b;
elseif (reaction == "tappedplayer") then
r, g, b = colors.nam_tpp.r, colors.nam_tpp.g, colors.nam_tpp.b;
elseif (reaction == "tappedother") then
r, g, b = colors.nam_tpo.r, colors.nam_tpo.g, colors.nam_tpo.b;
else
r, g, b = targettype.bgcolor.r, targettype.bgcolor.g, targettype.bgcolor.b;
end
r, g, b = TB_NoNegative(r - 0.35), TB_NoNegative(g - 0.35), TB_NoNegative(b - 0.35);
a = targettype.bgcolor.a;
else
r, g, b, a = targettype.bgcolor.r, targettype.bgcolor.g, targettype.bgcolor.b, targettype.bgcolor.a;
TB_AddMessage("setting BG color to Custom");
end
if (targettype.c_bdb and targettype.c_bdb == 1) then
--[[
tbcolor_lvl_impossible = TipBuddy_RGBToHexColor(colors.lvl_imp.r, colors.lvl_imp.g, colors.lvl_imp.b);
tbcolor_lvl_verydifficult = TipBuddy_RGBToHexColor(colors.lvl_vdf.r, colors.lvl_vdf.g, colors.lvl_vdf.b);
tbcolor_lvl_difficult = TipBuddy_RGBToHexColor(colors.lvl_dif.r, colors.lvl_dif.g, colors.lvl_dif.b);
tbcolor_lvl_standard = TipBuddy_RGBToHexColor(colors.lvl_stn.r, colors.lvl_stn.g, colors.lvl_stn.b);
tbcolor_lvl_trivial = TipBuddy_RGBToHexColor(colors.lvl_trv.r, colors.lvl_trv.g, colors.lvl_trv.b);
]]
local levelDiff = UnitLevel("mouseover") - UnitLevel("player");
local colors = TipBuddy_SavedVars["textcolors"];
if ( levelDiff >= 5 ) then
br, bg, bb = colors.lvl_imp.r, colors.lvl_imp.g, colors.lvl_imp.b;
elseif ( levelDiff >= 3 ) then
br, bg, bb = colors.lvl_vdf.r, colors.lvl_vdf.g, colors.lvl_vdf.b;
elseif ( levelDiff >= -2 ) then
br, bg, bb = colors.lvl_dif.r, colors.lvl_dif.g, colors.lvl_dif.b;
elseif ( -levelDiff <= GetQuestGreenRange() ) then
br, bg, bb = colors.lvl_stn.r, colors.lvl_stn.g, colors.lvl_stn.b;
else
br, bg, bb = colors.lvl_trv.r, colors.lvl_trv.g, colors.lvl_trv.b;
end
ba = targettype.bgbcolor.a;
elseif (targettype.c_bdb and targettype.c_bdb == 2) then
local reaction = TipBuddy_GetUnitReaction( unit );
local colors = TipBuddy_SavedVars["textcolors"];
--[[ tbcolor_nam_hostile = TipBuddy_RGBToHexColor(colors.nam_hos.r, colors.nam_hos.g, colors.nam_hos.b);
tbcolor_nam_neutral = TipBuddy_RGBToHexColor(colors.nam_neu.r, colors.nam_neu.g, colors.nam_neu.b);
tbcolor_nam_friendly = TipBuddy_RGBToHexColor(colors.nam_fri.r, colors.nam_fri.g, colors.nam_fri.b);
tbcolor_nam_caution = TipBuddy_RGBToHexColor(colors.nam_cau.r, colors.nam_cau.g, colors.nam_cau.b);
tbcolor_nam_pvp = TipBuddy_RGBToHexColor(colors.nam_pvp.r, colors.nam_pvp.g, colors.nam_pvp.b);
tbcolor_nam_tappedplayer = TipBuddy_RGBToHexColor(colors.nam_tpp.r, colors.nam_tpp.g, colors.nam_tpp.b);
tbcolor_nam_tappedother = TipBuddy_RGBToHexColor(colors.nam_tpo.r, colors.nam_tpo.g, colors.nam_tpo.b);]]
if (reaction == "hostile") then
br, bg, bb = colors.nam_hos.r, colors.nam_hos.g, colors.nam_hos.b;
elseif (reaction == "neutral") then
br, bg, bb = colors.nam_neu.r, colors.nam_neu.g, colors.nam_neu.b;
elseif (reaction == "friendly") then
br, bg, bb = colors.nam_fri.r, colors.nam_fri.g, colors.nam_fri.b;
elseif (reaction == "caution") then
br, bg, bb = colors.nam_cau.r, colors.nam_cau.g, colors.nam_cau.b;
elseif (reaction == "pvp") then
br, bg, bb = colors.nam_pvp.r, colors.nam_pvp.g, colors.nam_pvp.b;
elseif (reaction == "tappedplayer") then
br, bg, bb = colors.nam_tpp.r, colors.nam_tpp.g, colors.nam_tpp.b;
elseif (reaction == "tappedother") then
br, bg, bb = colors.nam_tpo.r, colors.nam_tpo.g, colors.nam_tpo.b;
else
br, bg, bb = targettype.bgcolor.r, targettype.bgcolor.g, targettype.bgcolor.b;
end
ba = targettype.bgbcolor.a;
else
targettype = TipBuddy_SavedVars[type];
if (not targettype.bgbcolor) then
targettype.bgbcolor = {};
targettype.bgbcolor.r = 0.8;
targettype.bgbcolor.g = 0.8;
targettype.bgbcolor.b = 0.9;
targettype.bgbcolor.a = 1;
end
br, bg, bb, ba = targettype.bgbcolor.r, targettype.bgbcolor.g, targettype.bgbcolor.b, targettype.bgbcolor.a;
end
if (TipBuddy_SavedVars["general"].blizdefault == 1) then
GameTooltip:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b, 1);
GameTooltip:SetBackdropBorderColor(0.8, 0.8, 0.9, 1);
elseif (GameTooltip:IsVisible()) then
GameTooltip:SetBackdropColor( r, g, b, a );
GameTooltip:SetBackdropBorderColor( br, bg, bb, ba );
else
TipBuddy_Main_Frame:SetBackdropColor( r, g, b, a );
TipBuddy_Main_Frame:SetBackdropBorderColor( 0, 0, 0, 0.9 );
end
TB_AddMessage(r.." - "..g.." - "..b.." - "..a);
end
--------------------------------------------------------------------------------------------------------------------------------------
-- SET NON-UNIT BACKGROUND COLOR
--------------------------------------------------------------------------------------------------------------------------------------
function TipBuddy_SetFrame_NonUnit_BackgroundColor( type )
if (not type) then
type = "general";
end
local targettype = TipBuddy_SavedVars[type];
if (not targettype.bgcolor) then
targettype.bgcolor = {};
targettype.bgcolor.r = 0.1;
targettype.bgcolor.g = 0.1;
targettype.bgcolor.b = 0.1;
targettype.bgcolor.a = 0.78;
end
if (not targettype.bgbcolor) then
targettype.bgbcolor = {};
targettype.bgbcolor.r = 0.8;
targettype.bgbcolor.g = 0.8;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -