Add new code snippets

This commit is contained in:
2024-03-03 13:50:12 +01:00
commit 01b612a50b
409 changed files with 65292 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
--COMBAT_LOG_EVENT_UNFILTERED PLAYER_REGEN_ENABLED PLAYER_REGEN_DISABLED DRUID_HOTS_REMOVE_HOT
function(e, ...)
if not WeakAurasSaved.DruidHots then
WeakAurasSaved.DruidHots = {
["Rejuvenation"] = {["count"] = 0, ["duration"] = 18, ["timers"] = {}},
["Regrowth"] = {["count"] = 0, ["duration"] = 12, ["timers"] = {}},
["Lifebloom"] = {["count"] = 0, ["duration"] = 15, ["timers"] = {}},
["Wild Growth"] = {["count"] = 0, ["duration"] = 7, ["timers"] = {}},
["Spring Blossoms"] = {["count"] = 0, ["duration"] = 6, ["timers"] = {}},
["Grove Tending"] = {["count"] = 0, ["duration"] = 9, ["timers"] = {}},
["Rejuvenation (Germination)"] = {["count"] = 0, ["duration"] = 18, ["timers"] = {}},
}
end
if not WeakAurasSaved.DruidHots.ticker then WeakAurasSaved.DruidHots.ticker = C_Timer.NewTicker(0.5, function() WeakAuras.ScanEvents("UPDATE_HOTS") end) end
if e == "DRUID_HOTS_REMOVE_HOT" then
local name, id = ...
--DevTools_Dump(WeakAurasSaved.DruidHots)
if WeakAurasSaved.DruidHots[name].timers[id] then
if WeakAurasSaved.DruidHots[name].timers[id] then WeakAurasSaved.DruidHots[name].timers[id]:Cancel() end
WeakAurasSaved.DruidHots[name].timers[id] = nil
WeakAurasSaved.DruidHots[name].count = WeakAurasSaved.DruidHots[name].count - 1
end
WeakAuras.ScanEvents("UPDATE_HOTS")
--DevTools_Dump(WeakAurasSaved.DruidHots)
elseif e == "COMBAT_LOG_EVENT_UNFILTERED" then
local se = select(2, ...)
local caster = select(5, ...)
local spellname = select(13, ...)
local target = select(10, ...)
if se == "SPELL_AURA_APPLIED" then
if caster and caster == UnitName("player") then
if WeakAurasSaved.DruidHots[spellname] then
WeakAurasSaved.DruidHots[spellname].count = WeakAurasSaved.DruidHots[spellname].count + 1
WeakAurasSaved.DruidHots[spellname].timers[WeakAurasSaved.DruidHots[spellname].count] = C_Timer.NewTimer(WeakAurasSaved.DruidHots[spellname].duration * 4, function() WeakAuras.ScanEvents("DRUID_HOTS_REMOVE_HOT", spellname, WeakAurasSaved.DruidHots[spellname].count) end)
--DevTools_Dump(WeakAurasSaved.DruidHots)
WeakAuras.ScanEvents("UPDATE_HOTS")
end
end
elseif se == "SPELL_AURA_REMOVED" then
if caster and caster == UnitName("player") then
if WeakAurasSaved.DruidHots[spellname] then
if WeakAurasSaved.DruidHots[spellname].count > 0 then
WeakAurasSaved.DruidHots[spellname].count = WeakAurasSaved.DruidHots[spellname].count - 1
if WeakAurasSaved.DruidHots[spellname].timers[WeakAurasSaved.DruidHots[spellname].count + 1] then WeakAurasSaved.DruidHots[spellname].timers[WeakAurasSaved.DruidHots[spellname].count + 1]:Cancel(); WeakAurasSaved.DruidHots[spellname].timers[WeakAurasSaved.DruidHots[spellname].count + 1] = nil end
--DevTools_Dump(WeakAurasSaved.DruidHots)
WeakAuras.ScanEvents("UPDATE_HOTS")
end
end
end
end
elseif e == "PLAYER_REGEN_ENABLED" or e == "PLAYER_REGEN_DISABLED" then
WeakAurasSaved.DruidHots = {
["Rejuvenation"] = {["count"] = 0, ["duration"] = 18, ["timers"] = {}},
["Regrowth"] = {["count"] = 0, ["duration"] = 12, ["timers"] = {}},
["Lifebloom"] = {["count"] = 0, ["duration"] = 15, ["timers"] = {}},
["Wild Growth"] = {["count"] = 0, ["duration"] = 7, ["timers"] = {}},
["Spring Blossoms"] = {["count"] = 0, ["duration"] = 6, ["timers"] = {}},
["Grove Tending"] = {["count"] = 0, ["duration"] = 9, ["timers"] = {}},
["Rejuvenation (Germination)"] = {["count"] = 0, ["duration"] = 18, ["timers"] = {}},
}
local instance = "party"
if IsInRaid() then instance = "raid" end
local index = 1
--DevTools_Dump(UnitBuff("player", index, "PLAYER"))
while UnitBuff("player", index, "PLAYER") do
local name = UnitBuff("player", index, "PLAYER")
if WeakAurasSaved.DruidHots[name] then
WeakAurasSaved.DruidHots[name].count = WeakAurasSaved.DruidHots[name].count + 1
end
index = index + 1
if index > 20 then break end
end
for i = 1, GetNumGroupMembers() do
local index = 1
--DevTools_Dump(UnitBuff(instance .. i, index, "PLAYER"))
while UnitBuff(instance .. i, index, "PLAYER") do
--DevTools_Dump(UnitBuff(instance .. i , index, "PLAYER"))
local name = UnitBuff(instance .. i, index, "PLAYER")
if WeakAurasSaved.DruidHots[name] then
WeakAurasSaved.DruidHots[name].count = WeakAurasSaved.DruidHots[name].count + 1
end
index = index + 1
if index > 20 then break end
end
end
--DevTools_Dump(WeakAurasSaved.DruidHots)
WeakAuras.ScanEvents("UPDATE_HOTS")
end
end
--DISPLAY
function()
return WeakAurasSaved.DruidHots["Spring Blossoms"].count
end
--Mana bar
--DISPLAY
function()
local mana = UnitPower("player", 0)
if mana >= 1e3 and mana < 1e6 then
mana = string.format("%.1fk", mana / 1e3)
elseif mana >= 1e6 and mana < 1e9 then
mana = string.format("%.1fM", mana / 1e6)
end
return mana
end
--INIT
if not WeakAurasSaved.DruidHots then
WeakAurasSaved.DruidHots = {
["Rejuvenation"] = {["count"] = 0, ["duration"] = 18, ["timer"] = nil},
["Regrowth"] = {["count"] = 0, ["duration"] = 12, ["timer"] = nil},
["Lifebloom"] = {["count"] = 0, ["duration"] = 15, ["timer"] = nil},
["Wild Growth"] = {["count"] = 0, ["duration"] = 7, ["timer"] = nil},
["Spring Blossoms"] = {["count"] = 0, ["duration"] = 6, ["timer"] = nil},
["Grove Tending"] = {["count"] = 0, ["duration"] = 9, ["timer"] = nil},
["Rejuvenation (Germination)"] = {["count"] = 0, ["duration"] = 18, ["timer"] = nil},
}
end