WoWInterface SVN MyThreat

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/MyThreat
    from Rev 15 to Rev 14
    Reverse comparison

Rev 15 → Rev 14

MyThreat.lua
1,5 → 1,4
local MYTHREAT_VERSION = '1.4';
local MYTHREAT_ADJUST_VALUE = -410065408;
local MYTHREAT_VERSION = '1.3.4';
 
local options = {
type='group',
209,19 → 208,6
MyThreat:Print('Current version: ' .. MYTHREAT_VERSION);
end,
},
autoAdjust = {
type = 'toggle',
name = 'Auto-adjust threat',
desc = 'Auto-adjusts threat when abilities such as Fade and Mirror Image are active.',
get = function()
return MyThreat.db.profile.autoAdjust;
end,
set = function()
MyThreat.db.profile.autoAdjust = not MyThreat.db.profile.autoAdjust;
 
MyThreat:Process();
end;
}
}
};
 
264,7 → 250,6
},
fontSize = 16,
tankMode = false,
autoAdjust = true,
}
});
 
582,17 → 567,8
function MyThreat:GetThreat(pUnit, pTarget)
 
local isTanking, _, _, _, threatValue = UnitDetailedThreatSituation(pUnit, pTarget);
local adjusted = false;
 
-- adjust threat for Mirror Image and Fade abilities
if (threatValue and threatValue < 0 and pUnit == "player" and MyThreat.db.profile.autoAdjust) then
 
threatValue = threatValue - MYTHREAT_ADJUST_VALUE;
adjusted = true;
 
end
 
return threatValue, isTanking, adjusted;
return threatValue, isTanking;
 
end
 
601,7 → 577,7
function MyThreat:Process()
 
-- use current handler to get threat information
local threatDiff, threatDiffPercent, tankName, adjusted = MyThreat.threatSourceHandler();
local threatDiff, threatDiffPercent, tankName = MyThreat.threatSourceHandler();
 
-- if there is a current tank
if (tankName ~= nil and threatDiff ~= nil and threatDiffPercent ~= nil) then
617,54 → 593,36
MyThreat_ThreatFrameThreatPlayerName:Show();
 
end
 
local threatText, relativeThreatText;
local r = 0;
local g = 1;
local b = 0;
 
-- set the text for absolute threat diff
-- set the label for absolute threat diff
if (threatDiff >= 1000 or threatDiff <= -1000) then
threatText = format("%.2f", threatDiff / 1000) .. "k";
MyThreat_ThreatFrameThreatDiff:SetText(format("%.2f", threatDiff / 1000) .. "k");
else
threatText = format("%.0f", threatDiff);
MyThreat_ThreatFrameThreatDiff:SetText(format("%.0f", threatDiff));
end
 
-- set relative text
relativeThreatText = format("%.0f", threatDiffPercent * 100) .. "%";
 
if (adjusted) then
 
r = 0.4;
g = 0.8;
b = 0.95;
 
threatText = "(" .. threatText .. ")";
relativeThreatText = "(" .. relativeThreatText .. ")";
 
else
 
-- set the right bar colors
if (threatDiff <= MyThreat.db.profile.red.absolute or threatDiffPercent >= MyThreat.db.profile.red.relative) then
r = 1;
g = 0;
elseif (threatDiff <= MyThreat.db.profile.orange.absolute or threatDiffPercent >= MyThreat.db.profile.orange.relative) then
r = 1;
g = 0.5;
elseif (threatDiff <= MyThreat.db.profile.yellow.absolute or threatDiffPercent >= MyThreat.db.profile.yellow.relative) then
r = 1;
g = 1;
end
 
-- set the label for relative threat diff
MyThreat_ThreatFrameThreatPercDiff:SetText(format("%.0f", threatDiffPercent * 100) .. "%");
 
 
local r = 0;
local g = 1;
 
-- set the right bar colors
if (threatDiff <= MyThreat.db.profile.red.absolute or threatDiffPercent >= MyThreat.db.profile.red.relative) then
r = 1;
g = 0;
elseif (threatDiff <= MyThreat.db.profile.orange.absolute or threatDiffPercent >= MyThreat.db.profile.orange.relative) then
r = 1;
g = 0.5;
elseif (threatDiff <= MyThreat.db.profile.yellow.absolute or threatDiffPercent >= MyThreat.db.profile.yellow.relative) then
r = 1;
g = 1;
end
 
-- adjust labels
MyThreat_ThreatFrameThreatDiff:SetText(threatText);
MyThreat_ThreatFrameThreatPercDiff:SetText(relativeThreatText);
 
MyThreat_ThreatFrameThreatDiff:SetTextColor(r,g,b);
MyThreat_ThreatFrameThreatPercDiff:SetTextColor(r,g,b);
MyThreat_ThreatFrameThreatPlayerName:SetTextColor(r,g,b);
MyThreat_ThreatFrameThreatDiff:SetTextColor(r,g,0);
MyThreat_ThreatFrameThreatPercDiff:SetTextColor(r,g,0);
MyThreat_ThreatFrameThreatPlayerName:SetTextColor(r,g,0);
 
MyThreat_ThreatFrameThreatPlayerName:SetText(tankName);
 
700,8 → 658,7
return nil, nil, nil;
end
 
local currentTankName, currentTankThreat, playerThreat, threatDiff, threatDiffPercent, adjusted;
adjusted = false;
local currentTankName, currentTankThreat, playerThreat, threatDiff, threatDiffPercent;
 
-- first try for targettarget mode before using full scanning
if (UnitExists("targettarget")) then
741,7 → 698,7
 
if (currentTankName ~= nil) then
 
playerThreat, _, adjusted = MyThreat:GetThreat("player", "target");
playerThreat = MyThreat:GetThreat("player", "target");
 
if (playerThreat ~= nil) then
 
753,7 → 710,7
end
 
 
return threatDiff, threatDiffPercent, currentTankName, adjusted;
return threatDiff, threatDiffPercent, currentTankName;
 
end
 
766,9 → 723,8
return nil, nil, nil;
end
 
local currentTrailing, currentTrailingThreat, playerThreat, threatDiff, threatDiffPercent, adjusted;
local currentTrailing, currentTrailingThreat, playerThreat, threatDiff, threatDiffPercent;
currentTrailingThreat = 0;
adjusted = false;
 
for pName, uid in MyThreat:GetPartyUnitIds() do
 
789,7 → 745,7
 
if (currentTrailing ~= nil) then
 
playerThreat, _, adjusted = MyThreat:GetThreat("player", "target");
playerThreat = MyThreat:GetThreat("player", "target");
 
if (playerThreat ~= nil) then
 
801,7 → 757,7
end
 
 
return threatDiff, threatDiffPercent, currentTrailing, adjusted;
return threatDiff, threatDiffPercent, currentTrailing;
 
end
 
814,7 → 770,7
return nil, nil, nil;
end
 
local currentLowestFocus, currentLowestFocusThreat, playerThreat, threatDiff, threatDiffPercent, adjusted;
local currentLowestFocus, currentLowestFocusThreat, playerThreat, threatDiff, threatDiffPercent;
currentLowestFocusThreat = nil;
 
for i = 1, MyThreat.focusUnitsNum, 1 do
834,7 → 790,7
 
if (currentLowestFocus ~= nil) then
 
playerThreat, _, adjusted = MyThreat:GetThreat("player", "target");
playerThreat = MyThreat:GetThreat("player", "target");
 
if (playerThreat ~= nil) then
 
846,7 → 802,7
end
 
 
return threatDiff, threatDiffPercent, currentLowestFocus, adjusted;
return threatDiff, threatDiffPercent, currentLowestFocus;
 
end
 
MyThreat.toc
4,7 → 4,7
## Author: Brimm
## SavedVariables: MyThreatDB
## SavedVariablesPerCharacter: MyThreatDBPC
## Version: 1.4
## Version: 1.3.4
## X-Category: Interface Enhancements
## OptionalDeps: Ace3