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,105 @@
--COMBAT_LOG_EVENT_UNFILTERED PLAYER_REGEN_ENABLED
--I fucked it up.
function(e, msg, sender)
if not WeakAurasSaved.MagusKeywords then WeakAurasSaved.MagusKeywords = {["tb"] = "Thunder Bluff", ["org"] = "Orgrimmar", ["uc"] = "Undercity", ["portal"] = "Portal", ["port"] = "Portal", ["water"] = "Water", ["waters"] = "Waters", ["food"] = "Food"} end
if e == "CHAT_MSG_SAY" or e == "CHAT_MSG_YELL" or e == "CHAT_MSG_WHISPER" then
if msg and aura_env.toggle == 1 then
msg = msg:lower()
local noRealmSender = sender:match("(.+)-%w+")
--print(sender, noRealmSender, UnitClass(sender), UnitClass(noRealmSender))
if select(3, UnitClass(noRealmSender)) == 8 and not WeakAurasSaved.MagusKeywords.AntiMagusTable[noRealmSender] then
print("Adding", noRealmSender, "to the ignore")
WeakAurasSaved.MagusKeywords.AntiMagusTable[noRealmSender] = 1
end
for k,v in pairs(WeakAurasSaved.MagusKeywords) do
if msg:match(k) then
local st, en = msg:find(k)
if not (st > 1 and msg:match(".", st - 1) ~= " ") and not (en < strlen(msg) and msg:match(".", en + 1) ~= " ") and select(3, UnitClass(noRealmSender)) ~= 8 then
if not WeakAurasSaved.MagusKeywords.AntiMagusTable[noRealmSender] then
InviteUnit(sender)
end
end
end
end
end
elseif e == "TOGGLE_MAGUS" then
if aura_env.toggle == 0 then
print("Toggling script on")
SendWho('z-"azsuna" c-"Mage"')
aura_env.toggle = 1
else
print("Toggling script off")
aura_env.toggle = 0
end
elseif e == "WHO_LIST_UPDATE" then
for i = 1, GetNumWhoResults() do
local name = select(1, GetWhoInfo(i))
local class = select(5, GetWhoInfo(i))
if class:match("Mage") then
if not WeakAurasSaved.MagusKeywords.AntiMagusTable[name] then
print("Adding", name, "to the ignore table")
WeakAurasSaved.MagusKeywords.AntiMagusTable[name] = 1
end
end
end
FriendsFrameCloseButton:Click()
elseif e == "NAME_PLATE_UNIT_ADDED" then
local name, class = UnitName(msg), select(3, UnitClass(msg))
local ispl = UnitIsPlayer(msg)
if class == 8 and WeakAurasSaved.MagusKeywords.AntiMagusTable[name] == nil and ispl == true then
print("Adding", name, "to the ignore table")
WeakAurasSaved.MagusKeywords.AntiMagusTable[name] = 1
end
elseif e =="NAME_PLATE_UNIT_REMOVED" then
local name, class = UnitName(msg), select(3, UnitClass(msg))
local ispl = UnitIsPlayer(msg)
if class == 8 and WeakAurasSaved.MagusKeywords.AntiMagusTable[name] == nil and ispl == true then
print("Adding", name, "to the ignore table")
WeakAurasSaved.MagusKeywords.AntiMagusTable[name] = 1
end
elseif e == "ADD_KEYWORD" then
print("Adding", msg)
msg = msg:lower()
WeakAurasSaved.MagusKeywords[msg] = 1
elseif e == "LIST_KEYWORDS" then
for k,v in pairs(WeakAurasSaved.MagusKeywords) do
print(k)
end
elseif e == "REMOVE_KEYWORD" then
if WeakAurasSaved.MagusKeywords[msg] then
print("Removing", msg)
WeakAurasSaved.MagusKeywords[msg] = nil
else
print(msg, "does not exist in the keyword table")
end
end
end
--EVERY FRAME 1
function()
if (WeakAurasSaved.CustomTrash.swingone - GetTime()) > 0 then
return string.format("%.1f", WeakAurasSaved.CustomTrash.swingone - GetTime())
end
end
--EVERY FRAME 2
function()
if (WeakAurasSaved.CustomTrash.swingtwo - GetTime()) > 0 then
return string.format("%.1f", WeakAurasSaved.CustomTrash.swingtwo - GetTime())
end
end
--DISPLAY
function()
if WeakAurasSaved.CustomTrash.swingRotation == 1 then
return "MH"
elseif WeakAurasSaved.CustomTrash.swingRotation == 2 then
return "OH"
end
end
--INIT
if not WeakAurasSaved.CustomTrash then WeakAurasSaved.CustomTrash = {} end
WeakAurasSaved.CustomTrash.swingRotation = 1
WeakAurasSaved.CustomTrash.swingone = 0
WeakAurasSaved.CustomTrash.swingtwo = 0