Skip to content

Commit

Permalink
Updated Talent scan code.
Browse files Browse the repository at this point in the history
Added function  to scan auras of targets near you.
  • Loading branch information
Vae2009 committed Mar 11, 2023
1 parent b09ac13 commit 40698c6
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ConRO.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Title:-|cffFFFFFFConRO|r- Conflict Rotation Optimizer
## Notes: Rotation helper framework.
## Version: 10.0.29
## Version: 10.0.30
## Author: Vae
## Interface: 100005
## SavedVariables: ConROPreferences
Expand Down
78 changes: 75 additions & 3 deletions helper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,61 @@ end
function ConRO:CheckTalents()
--print("Bing")
self.PlayerTalents = {};

wipe(self.PlayerTalents)
if select(1, GetSpecialization()) ~= 5 then

local configId = C_ClassTalents.GetActiveConfigID()
if configId ~= nil then
local configInfo = C_Traits.GetConfigInfo(configId)
if configInfo ~= nil then
for _, treeId in pairs(configInfo.treeIDs) do
local nodes = C_Traits.GetTreeNodes(treeId)
for _, nodeId in pairs(nodes) do
local node = C_Traits.GetNodeInfo(configId, nodeId)
if node.currentRank and node.currentRank > 0 then
local entryId = nil

if node.activeEntry ~= nil then
entryId = node.activeEntry.entryID
elseif node.nextEntry ~= nil then
entryId = node.nextEntry.entryID
elseif node.entryIDs ~= nil then
entryId = node.entryIDs[1]
end

if entryId ~= nil then
local entryInfo = C_Traits.GetEntryInfo(configId, entryId)
local definitionInfo = C_Traits.GetDefinitionInfo(entryInfo.definitionID)

if definitionInfo ~= nil then
local spellId = nil
if definitionInfo.spellID ~= nil then
spellId = definitionInfo.spellID
elseif definitionInfo.overriddenSpellID ~= nil then
spellId = definitionInfo.overriddenSpellID
end

if spellId ~= nil then
local name = GetSpellInfo(spellId)
tinsert(self.PlayerTalents, entryId);
self.PlayerTalents[entryId] = {};

tinsert(self.PlayerTalents[entryId], {
id = entryId,
["talentName"] = name,
["rank"] = node.ranksPurchased,
})
end
end
end
end
end
end
end
end



--[[if select(1, GetSpecialization()) ~= 5 then
local specID = PlayerUtil.GetCurrentSpecID();
local configID = C_ClassTalents.GetLastSelectedSavedConfigID(specID);
if configID == nil then
Expand Down Expand Up @@ -45,7 +97,7 @@ function ConRO:CheckTalents()
end
end
end
end
end]]
end

function ConRO:IsPvP()
Expand Down Expand Up @@ -457,6 +509,26 @@ function ConRO:TargetAura(spellID, timeShift)
return self:UnitAura(spellID, timeShift, 'target', 'PLAYER|HARMFUL');
end

function ConRO:AnyTargetAura(spellID)
local haveBuff = false;
for i = 1, 15 do
if UnitExists('nameplate' .. i) then
for x=1, 40 do
local spell = select(10, UnitAura('nameplate' .. i, x, 'PLAYER|HARMFUL'));
if spell == spellID then
haveBuff = true;
break;
end
end
if haveBuff then
break;
end
end
end

return haveBuff;
end

function ConRO:Purgable()
local purgable = false;
for i=1,40 do
Expand Down

0 comments on commit 40698c6

Please sign in to comment.