adde88

Untitled

Sep 17th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.97 KB | None | 0 0
  1. function _G.talentAnywhere()
  2.     local removeTalent = RemoveTalent
  3.     local learnTalent = LearnTalent
  4.     -- Load Talent UI if not opened before
  5.     if not IsAddOnLoaded("Blizzard_TalentUI") and not UnitAffectingCombat("player") then
  6.        LoadAddOn("Blizzard_TalentUI")
  7.     end
  8.  
  9.     local function talentSelection(row)
  10.       _G.selectedTalent = nil
  11.       for column = 1, 3 do
  12.         if IsMouseButtonDown(1) and _G.newTalent == nil and MouseIsOver(_G["PlayerTalentFrameTalentsTalentRow"..row.."Talent"..column])
  13.         and not select(4, GetTalentInfoByID(GetTalentInfo(row, column, 1), 1))
  14.         then
  15.           _G.selectedTalent = nil
  16.           _G.newTalent = select(1,GetTalentInfo(row, column, 1))
  17.           _G.newTalentRow = row
  18.         end
  19.         if _G.newTalentRow ~= nil then
  20.           if select(4, GetTalentInfoByID(GetTalentInfo(_G.newTalentRow, column, 1), 1)) then
  21.             _G.selectedTalent = select(1,GetTalentInfo(_G.newTalentRow, column, 1))
  22.           end
  23.         end
  24.       end
  25.       return _G.selectedTalent, _G.newTalent -- selectedNew
  26.     end
  27.  
  28.     if PlayerTalentFrame and PlayerTalentFrame:IsVisible() and not IsResting() then
  29.         for row = 1, 7 do
  30.           _G.selectedTalent, _G.newTalent, _G.selectedNew  = talentSelection(row)
  31.         end
  32.         _G.ChatOverlay(tostring(_G.selectedTalent).." | "..tostring(_G.newTalent).." | "..tostring(_G.selectedNew))
  33.         if _G.newTalent ~= nil then
  34.           if _G.selectedTalent ~= nil and _G.selectedTalent ~= _G.newTalent and not _G.selectedNew and Zylla.timer:useTimer("RemoveTalent", 0.1) then
  35.             removeTalent(_G.selectedTalent)
  36.             end
  37.             if _G.selectedTalent == nil and _G.selectedTalent ~= _G.newTalent and not _G.selectedNew then
  38.             learnTalent(_G.newTalent)
  39.             _G.selectedNew = true
  40.             end
  41.             if _G.selectedTalent == _G.newTalent then
  42.             _G.selectedNew = false
  43.             _G.newTalent = nil
  44.             end
  45.         end
  46.     end
  47. end
Add Comment
Please, Sign In to add comment