View Single Post
09-30-16, 05:23 PM   #10
Sweetsour
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2014
Posts: 130
Lua Code:
  1. textFrame:RegisterEvent("UNIT_AURA")
  2.  textFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
  3.  textFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
  4.  textFrame:SetScript("OnEvent", function(self, event, ...)
  5.  
  6.         local combatcheck = "false"
  7.         local count = 0
  8.  
  9.     if event=="PLAYER_REGEN_DISABLED" then
  10.             combatcheck = true -- change to boolean
  11.         elseif event =="PLAYER_REGEN_ENABLED" then
  12.             combatcheck = false -- change to boolean
  13.         end
  14.  
  15.             if (unit and unit ~= "player") then
  16.                  return
  17.             end
  18.  
  19.              --  Check player buffs against the roll the bones buffs
  20.                 for buff in pairs(buffs) do
  21.                         if UnitBuff("player", buff) then
  22.                             count = count + 1
  23.                         end
  24.                 end
  25.  
  26.              --  Give warning if need to reroll the bones
  27.              if not combatcheck then -- same thing as cooldown == false
  28.                   textFrame:message("")
  29.                 elseif combatcheck and (UnitBuff("player", "True Bearing") or UnitBuff("player", "Shark Infested Waters") or count >= 2) then
  30.                      textFrame:message("")
  31.                  else
  32.                      textFrame:message("REROLL THE BONES!!".." "..tostring(combatcheck)) -- need to convert booldean to string to concatenate
  33.                 end
  34.  
  35.  end)

Made changes to lines 10, 12, 27, and 29.

In the last elseif (line 29), try encapsulating the "or" conditions within brackets.
  Reply With Quote