Commit cb79ef21 authored by Landon Wu's avatar Landon Wu
Browse files

Replace Libthreat2 to WOW API

parent e33fed7c
Pipeline #428 failed with stage
......@@ -22,7 +22,6 @@
<Include file="LibCustomGlow-1.0\LibCustomGlow-1.0.xml" />
<Include file="NickTag-1.0\NickTag-1.0.xml" />
<Include file="LibThreatClassic2\lib.xml" />
<Include file="!LibTotemInfo\embeds.xml" />
<Include file="LibClassicDurations\LibClassicDurations.xml" />
<Include file="LibHealComm-4.0\LibHealComm-4.0.xml" />
......
......@@ -24,7 +24,8 @@ if VUHDO_LibClassicDurations then
VUHDO_LibClassicDurations:Register("VuhDo");
end
VUHDO_LibThreatClassic = LibStub:GetLibrary("LibThreatClassic2");
--VUHDO_LibThreatClassic = LibStub:GetLibrary("LibThreatClassic2");
VUHDO_LibThreatClassic = nil;
VUHDO_LibTotemInfo = LibStub("LibTotemInfo-1.0");
VUHDO_LibSharedMedia:Register("font", "Arial Black", "Interface\\AddOns\\VuhDo\\Fonts\\ariblk.ttf");
......
......@@ -43,7 +43,7 @@ local GetTime = GetTime;
local CheckInteractDistance = CheckInteractDistance;
local UnitInRange = UnitInRange;
local IsSpellInRange = IsSpellInRange;
local VUHDO_unitDetailedThreatSituation = VUHDO_unitDetailedThreatSituation;
local UnitDetailedThreatSituation = UnitDetailedThreatSituation;
local UnitIsCharmed = UnitIsCharmed;
local UnitCanAttack = UnitCanAttack;
local UnitName = UnitName;
......@@ -52,7 +52,7 @@ local UnitIsTrivial = UnitIsTrivial;
local GetSpellCooldown = GetSpellCooldown;
local HasFullControl = HasFullControl;
local pairs = pairs;
local VUHDO_unitThreatSituation = VUHDO_unitThreatSituation;
local UnitThreatSituation = UnitThreatSituation;
local InCombatLockdown = InCombatLockdown;
local type = type;
......@@ -198,7 +198,7 @@ local tEmpty = {};
local function VUHDO_updateThreat(aUnit)
tInfo = (VUHDO_RAID or tEmpty)[aUnit];
if tInfo then
tInfo["threat"] = VUHDO_unitThreatSituation(aUnit) or 0;
tInfo["threat"] = UnitThreatSituation(aUnit) or 0;
if VUHDO_INTERNAL_TOGGLES[17] then -- VUHDO_UPDATE_THREAT_LEVEL
VUHDO_updateBouquetsForEvent(aUnit, 17); -- VUHDO_UPDATE_THREAT_LEVEL
......@@ -505,9 +505,9 @@ function VUHDO_OnEvent(_, anEvent, anArg1, anArg2, anArg3, anArg4, anArg5, anArg
elseif "UNIT_SPELLCAST_SENT" == anEvent then
if VUHDO_VARIABLES_LOADED then VUHDO_spellcastSent(anArg1, anArg2, anArg4); end
--[[ elseif "UNIT_THREAT_SITUATION_UPDATE" == anEvent then
elseif "UNIT_THREAT_SITUATION_UPDATE" == anEvent then
if VUHDO_VARIABLES_LOADED then VUHDO_updateThreat(anArg1); end
]]
elseif "PLAYER_REGEN_ENABLED" == anEvent then
if VUHDO_VARIABLES_LOADED then
for tUnit, _ in pairs(VUHDO_RAID) do
......@@ -924,11 +924,11 @@ function VUHDO_updateGlobalToggles()
VUHDO_INTERNAL_TOGGLES[VUHDO_UPDATE_THREAT_LEVEL] = VUHDO_isAnyoneInterstedIn(VUHDO_UPDATE_THREAT_LEVEL);
--[[ VUHDO_UnRegisterEvent(VUHDO_INTERNAL_TOGGLES[VUHDO_UPDATE_THREAT_LEVEL]
VUHDO_UnRegisterEvent(VUHDO_INTERNAL_TOGGLES[VUHDO_UPDATE_THREAT_LEVEL]
or VUHDO_isAnyoneInterstedIn(VUHDO_UPDATE_AGGRO),
"UNIT_THREAT_SITUATION_UPDATE"
);
]]
VUHDO_INTERNAL_TOGGLES[VUHDO_UPDATE_THREAT_PERC] = VUHDO_isAnyoneInterstedIn(VUHDO_UPDATE_THREAT_PERC);
VUHDO_INTERNAL_TOGGLES[VUHDO_UPDATE_AGGRO] = VUHDO_isAnyoneInterstedIn(VUHDO_UPDATE_AGGRO);
......@@ -1052,7 +1052,7 @@ local function VUHDO_updateAllAggro()
tTarget = tInfo["targetUnit"];
if not UnitIsFriend(tUnit, tTarget) then
if VUHDO_INTERNAL_TOGGLES[14] then -- VUHDO_UPDATE_AGGRO
_, _, tThreatPerc = VUHDO_unitDetailedThreatSituation(tUnit, tTarget);
_, _, tThreatPerc = UnitDetailedThreatSituation(tUnit, tTarget);
tInfo["threatPerc"] = tThreatPerc or 0;
end
......@@ -1060,7 +1060,7 @@ local function VUHDO_updateAllAggro()
if tAggroUnit then
if VUHDO_INTERNAL_TOGGLES[14] then -- VUHDO_UPDATE_AGGRO
_, _, tThreatPerc = VUHDO_unitDetailedThreatSituation(tAggroUnit, tTarget);
_, _, tThreatPerc = UnitDetailedThreatSituation(tAggroUnit, tTarget);
VUHDO_RAID[tAggroUnit]["threatPerc"] = tThreatPerc or 0;
end
......
......@@ -1149,62 +1149,62 @@ end
function VUHDO_unitThreatSituation(aUnit)
if not aUnit then
return nil;
end
if not UnitThreatSituation then
if VUHDO_LibThreatClassic then
local tOtherUnit = nil;
-- check target and boss unit threat
if UnitExists(aUnit .. "target") and UnitIsEnemy(aUnit, aUnit .. "target") then
tOtherUnit = aUnit .. "target";
elseif UnitExists("target") and UnitIsEnemy("player", "target") then
tOtherUnit = "target";
elseif UnitExists("boss1") and UnitIsEnemy("player", "boss1") then
tOtherUnit = "boss1";
elseif UnitExists("boss2") and UnitIsEnemy("player", "boss2") then
tOtherUnit = "boss2";
elseif UnitExists("boss3") and UnitIsEnemy("player", "boss3") then
tOtherUnit = "boss3";
elseif UnitExists("boss4") and UnitIsEnemy("player", "boss4") then
tOtherUnit = "boss4";
elseif UnitExists("boss5") and UnitIsEnemy("player", "boss5") then
tOtherUnit = "boss5";
end
return VUHDO_LibThreatClassic:UnitThreatSituation(aUnit, tOtherUnit);
else
return nil;
end
else
return UnitThreatSituation(aUnit);
end
end
function VUHDO_unitDetailedThreatSituation(aUnit, aOtherUnit)
if not aUnit or not aOtherUnit then
return nil;
end
if not UnitDetailedThreatSituation then
if VUHDO_LibThreatClassic then
return VUHDO_LibThreatClassic:UnitDetailedThreatSituation(aUnit, aOtherUnit);
else
return nil;
end
else
return UnitDetailedThreatSituation(aUnit, aOtherUnit);
end
end
--function VUHDO_unitThreatSituation(aUnit)
-- if not aUnit then
-- return nil;
-- end
-- if not UnitThreatSituation then
-- if VUHDO_LibThreatClassic then
-- local tOtherUnit = nil;
-- -- check target and boss unit threat
-- if UnitExists(aUnit .. "target") and UnitIsEnemy(aUnit, aUnit .. "target") then
-- tOtherUnit = aUnit .. "target";
-- elseif UnitExists("target") and UnitIsEnemy("player", "target") then
-- tOtherUnit = "target";
-- elseif UnitExists("boss1") and UnitIsEnemy("player", "boss1") then
-- tOtherUnit = "boss1";
-- elseif UnitExists("boss2") and UnitIsEnemy("player", "boss2") then
-- tOtherUnit = "boss2";
-- elseif UnitExists("boss3") and UnitIsEnemy("player", "boss3") then
-- tOtherUnit = "boss3";
-- elseif UnitExists("boss4") and UnitIsEnemy("player", "boss4") then
-- tOtherUnit = "boss4";
-- elseif UnitExists("boss5") and UnitIsEnemy("player", "boss5") then
-- tOtherUnit = "boss5";
-- end
-- return VUHDO_LibThreatClassic:UnitThreatSituation(aUnit, tOtherUnit);
-- else
-- return nil;
-- end
-- else
-- return UnitThreatSituation(aUnit);
-- end
--end
--function VUHDO_unitDetailedThreatSituation(aUnit, aOtherUnit)
-- if not aUnit or not aOtherUnit then
-- return nil;
-- end
-- if not UnitDetailedThreatSituation then
-- if VUHDO_LibThreatClassic then
-- return VUHDO_LibThreatClassic:UnitDetailedThreatSituation(aUnit, aOtherUnit);
-- else
-- return nil;
-- end
-- else
-- return UnitDetailedThreatSituation(aUnit, aOtherUnit);
-- end
--end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment