Quantcast
WoWInterface - View Single Post - Detecting conduits
View Single Post
09-29-20, 06:51 AM   #11
doofus
A Flamescale Wyrmkin
Join Date: Feb 2018
Posts: 148
OK, I have managed to hook onto the chat functions!

Regarding covenants and conduits, I think the below extracts your active conduits. I have just tested it with all combinations I could think of, eg some conduits taken, some not, changing paths etc. It returns a table with spell ID and spell name for each node and conduit in your chosen soulbind's path.

Code:
-- *********************************************************************
-- patch 9.x.x Shadowlands SL
local function DetermineActiveCovenantAndSoulbindAndConduits()
  local covenantID = C_Covenants.GetActiveCovenantID();
  if ( not covenantID or covenantID == 0 ) then 
    BA_Data["function LogTextLine"](string.format("No active covenants"));
    return nil;
  end
  local covenantData = C_Covenants.GetCovenantData(covenantID);
  if ( not covenantData ) then 
    BA_Data["function LogTextLine"](string.format("No covenant found"));
    return nil;
  end
  local covenantName = covenantData.name;
  BA_Data["function LogTextLine"](string.format("Covenant:[%s]",covenantName));
  local soulbindID = C_Soulbinds.GetActiveSoulbindID();
  if ( not soulbindID or soulbindID == 0 ) then 
    BA_Data["function LogTextLine"](string.format("No active soulbinds"));
    return nil;
  end
  local soulbindData = C_Soulbinds.GetSoulbindData(soulbindID);
  if ( not soulbindData ) then 
    BA_Data["function LogTextLine"](string.format("No active soulbinds"));
    return nil;
  end
  local id = soulbindData["ID"];
  --local covenantID = soulbindData["covenantID"];
  local soulbindName = soulbindData["name"];
  local description = soulbindData["description"];
  local tree = soulbindData["tree"];
  local nodes = tree["nodes"];
  --BA_Data["function LogTextLine"](string.format("covenant:[%s] - soulbind ID:[%d] - id:[%d] - covenantID:[%d] - name:[%s]",covenantName,soulbindID,id,covenantID,name));
  --BA_Data["function LogTextLine"](string.format("nodes:-"));
  local activeConduitsSpells = {};
  activeConduitsSpells.covenantName = covenantName;
  activeConduitsSpells.soulbindName = soulbindName;
  activeConduitsSpells.conduits = {};
  for _, ve in pairs(nodes) do
    local node_id = ve["ID"];
    local node_row = ve.row;
    local node_column = ve.column;
    local node_spellID = ve.spellID; -- this will be 0 for uninit spell, not nil
    local node_conduitID = ve.conduitID; -- this will be 0 for uninit conduit, not nil
    local node_conduitRank = ve.conduitRank;
    local node_state = ve.state;
    local node_conduitType = ve.conduitType; -- this can be nil
    if ( node_state == 3 ) then
      --[====[
      BA_Data["function LogTextLine"](string.format("nodeid:[%s] - row:[%s] - col:[%s] - spellID:[%s] - conduitID:[%s] - conduitRank:[%s] - state:[%s][%s] - conduitType:[%s][%s]",
          tostring(node_id),
          tostring(node_row),
          tostring(node_column),
          tostring(node_spellID),
          tostring(node_conduitID),
          tostring(node_conduitRank),
          tostring(node_state),
          tostring(( node_state == 1 and "blank" or node_state == 3 and "used" or "unknown" )),
          tostring(node_conduitType),
          tostring(( node_conduitType == 1 and "Potency" or node_conduitType == 2 and "Endurance" or node_conduitType == 0 and "Finesse" or "Unknown"  ))
        ));
      --]====]
      
      local node_spellName;
      if ( node_spellID ~= 0 ) then
        node_spellName = GetSpellInfo(node_spellID);
      elseif ( node_conduitID ~= 0 ) then
        local conduitSpellID = C_Soulbinds.GetConduitSpellID(node_conduitID,node_conduitRank);
        node_spellID = conduitSpellID;
        node_spellName = GetSpellInfo(conduitSpellID);
      else
        node_spellID = nil;
        node_spellName = nil;
      end
      if ( node_spellID ) then
        activeConduitsSpells.conduits[#activeConduitsSpells.conduits + 1] = { spellID = node_spellID, spellName = node_spellName };
      end
    end
  end
  BA_Data["function LogTextLine"](string.format("covenant:[%s] - soulbindName:[%s]",activeConduitsSpells.covenantName,activeConduitsSpells.soulbindName));
  for _, ve in pairs(activeConduitsSpells.conduits) do
    BA_Data["function LogTextLine"](string.format("spellID:[%d] - spellName:[%s]",ve.spellID,tostring(ve.spellName)));
  end
  
  --BA_Data["function LogTextLine"](string.format("-- end nodes"));
  return activeConduitsSpells;
end







and also

  -- patch 9.x.x Shadowlands SL
  -- listen to soulbinds/conduits changes
  self:RegisterEvent("COVENANT_CALLINGS_UPDATED");
  self:RegisterEvent("COVENANT_CHOSEN");
  self:RegisterEvent("SOULBIND_ACTIVATED");
  self:RegisterEvent("SOULBIND_PATH_CHANGED");
  self:RegisterEvent("SOULBIND_CONDUITS_RESET");
  self:RegisterEvent("SOULBIND_NODE_UPDATED");
  self:RegisterEvent("GARRISON_UPDATE");

Last edited by doofus : 09-29-20 at 12:13 PM.
  Reply With Quote