06-27-10, 10:20 AM | #1 |
Issues Checking Buffs
Hi All,
I am writting my own flask/food checking function, it works as I want, but it doesnt seem to recognise when someone has actually flasked since the last check; I am using for the UnitHasBuff call. local aura = LibStub("LibLordFarlander-SpecialEvents-Aura-4.0") Do i need to be forcing a refresh or something :S Ta Function is; Code:
function UpysRaidTools:RaidConsumableCheck(output) local flaskchecktime = UpysRaidTools:GetCurrentTime() local MissingFlaskList={} local MissingElixirList={} local MissingFoodList={} local foundfoodfail = false local foundflaskfail = false local foundelixerfail = false inRaid = UnitInRaid("player") if (inRaid == nil) then totalInGroup = GetNumPartyMembers(); else totalInGroup = GetNumRaidMembers(); end i=1; -- set initial value of i while i <= totalInGroup do if(totalInGroup > 0 and inRaid ~= nil)then unittype = "raid" ourunit = unittype .. i elseif(totalInGroup > 0 and inRaid == nil)then unittype = "party" ourunit = unittype .. i end name = UnitName(ourunit) if(name ~= nil)then -- Insert Our Toon Into the List MissingFlaskList[name] = name MissingFoodList[name] = name -- Food for k, v in ipairs(foods) do if aura:UnitHasBuff(ourunit, v) then MissingFoodList[name] = nil end end -- Flasks for k, v in ipairs(buffs) do if aura:UnitHasBuff(ourunit, v) then MissingFlaskList[name] = nil end end if(MissingFlaskList[name])then -- Ok no Flask so lets add to MissingElixirList toonelixers=0 for k, v in ipairs(elixirs) do if aura:UnitHasBuff(ourunit, v) then -- Ok we know they are using an elixer toonelixers=toonelixers+1 -- add to count -- Add to Lix List MissingElixirList[name] = name -- If we find a second one remove them again if(toonelixers == 2)then MissingElixirList[name] = nil end end end if (toonelixers>0)then MissingFlaskList[name] = nil end end end i = i + 1; end -- Our Messages flaskmsg = "Nubs Missing Flasks: " for i, v in pairsByKeys(MissingFlaskList) do foundflaskfail = true flaskmsg = flaskmsg .. " , " .. v if (addon.db.global.consumableFails[v]) then addon.db.global.consumableFails[v] = { toon = v, flask = addon.db.global.consumableFails[v].flask+1, elixer = addon.db.global.consumableFails[v].elixer, food = addon.db.global.consumableFails[v].food } else addon.db.global.consumableFails[v] = { toon = v, flask = 1, elixer = 0, food = 0 } end end if(foundflaskfail == false) then flaskmsg = flaskmsg .. "All Clear" end elixermsg = "Nubs With Only One Elixer: " for i, v in pairsByKeys(MissingElixirList) do foundelixerfail = true elixermsg = elixermsg .. v .. "," if (addon.db.global.consumableFails[v]) then addon.db.global.consumableFails[v] = { toon = v, flask = addon.db.global.consumableFails[v].flask, elixer = addon.db.global.consumableFails[v].elixer+1, food = addon.db.global.consumableFails[v].food } else addon.db.global.consumableFails[v] = { toon = v, flask = 0, elixer = 1, food = 0 } end end if(foundelixerfail == false) then elixermsg = elixermsg .. "All Clear" end foodmsg = "Nubs Missing Food: " for i, v in pairsByKeys(MissingFoodList) do foundfoodfail = true foodmsg = foodmsg .. v .. "," if (addon.db.global.consumableFails[v]) then addon.db.global.consumableFails[v] = { toon = v, flask = addon.db.global.consumableFails[v].flask, elixer = addon.db.global.consumableFails[v].elixer, food = addon.db.global.consumableFails[v].food+1 } else addon.db.global.consumableFails[v] = { toon = v, flask = 0, elixer = 0, food = 1 } end end if(foundfoodfail == false) then foodmsg = foodmsg .. "All Clear" end if output == "guild" then SendChatMessage(foodmsg, "GUILD"); SendChatMessage(flaskmsg, "GUILD"); SendChatMessage(elixermsg, "GUILD"); elseif output == "raid" then SendChatMessage(foodmsg, "RAID"); SendChatMessage(flaskmsg, "RAID"); SendChatMessage(elixermsg, "RAID"); elseif output == "officer" then SendChatMessage(foodmsg, "OFFICER"); SendChatMessage(flaskmsg, "OFFICER"); SendChatMessage(elixermsg, "OFFICER"); else print(foodmsg) print(flaskmsg) print(elixermsg) end end |
|
06-28-10, 03:20 AM | #2 |
got it had to execute "aura:ScanAllAuras()" to refresh first
|
|
WoWInterface » Developer Discussions » Lua/XML Help » Issues Checking Buffs |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|