Compare commits

..

3 Commits

Author SHA1 Message Date
62e991cc66 Update 2025-03-13 16:28:23 +01:00
468a68c3e7 Fix stinky detector spam 2024-12-14 23:56:44 +01:00
5ef92b23de Rework stinky detector to be a little more simple and a lot more functional 2024-12-13 13:54:37 +01:00
27 changed files with 231 additions and 523 deletions

View File

@@ -1,4 +1,5 @@
--- PLAYER_TARGET_CHANGED --- PLAYER_TARGET_CHANGED
function(allstates) --- Deprecated in favor of Heimdall.AchievementSniffer
aura_env.TryInspect() --function(allstates)
end -- aura_env.TryInspect()
--end

View File

@@ -1,15 +1,16 @@
--- INSPECT_ACHIEVEMENT_READY --- INSPECT_ACHIEVEMENT_READY
function() --- Deprecated in favor of Heimdall.AchievementSniffer
local targetGuid = UnitGUID("target") --function()
if not targetGuid then return end -- local targetGuid = UnitGUID("target")
if not string.match(targetGuid, "Player") then return end -- if not targetGuid then return end
local targetName = UnitName("target") -- if not string.match(targetGuid, "Player") then return end
-- local targetName = UnitName("target")
local should = false --
if not WeakAurasSaved.Cyka.AchievementSniffer[targetName] then should = true end -- local should = false
if WeakAurasSaved.Cyka.AchievementSniffer2[targetName] then should = false end -- if not WeakAurasSaved.Cyka.AchievementSniffer[targetName] then should = true end
if aura_env.config.rescan then should = true end -- if WeakAurasSaved.Cyka.AchievementSniffer2[targetName] then should = false end
if not should then return end -- if aura_env.config.rescan then should = true end
-- if not should then return end
aura_env.Scan(targetName) --
end -- aura_env.Scan(targetName)
--end

View File

@@ -5,8 +5,12 @@ function(allstates)
if UnitIsPlayer(unit) then if UnitIsPlayer(unit) then
local name = UnitName(unit) local name = UnitName(unit)
local seen = false local seen = false
if WeakAurasSaved.Cyka.AchievementSniffer[name] then seen = true end if not Heimdall_Achievements then return end
if WeakAurasSaved.Cyka.AchievementSniffer2[name] then seen = true end if not Heimdall_Achievements.players then return end
if not Heimdall_Achievements.alreadySeen then return end
if Heimdall_Achievements.players[name] then seen = true end
if Heimdall_Achievements.alreadySeen[name] then seen = true end
allstates[unit] = { allstates[unit] = {
show = true, show = true,

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
--DUEL_REQUESTED
function(e, sender)
if aura_env.whitelist[sender] then
print("Accepting duel from " .. sender)
AcceptDuel()
else
print("Declining duel from " .. sender)
CancelDuel()
end
end

View File

@@ -0,0 +1,18 @@
---@param input string
---@param deliminer string
---@return string[], string|nil
local function StrSplit(input, deliminer)
if not deliminer then return {}, "deliminer is nil" end
if not input then return {}, "input is nil" end
local parts = {}
for part in string.gmatch(input, "([^" .. deliminer .. "]+)") do
table.insert(parts, strtrim(part))
end
return parts, nil
end
aura_env.whitelist = {}
local swhitelist = StrSplit(aura_env.config.whitelist, ",")
for _, name in ipairs(swhitelist) do
aura_env.whitelist[name] = true
end

View File

@@ -1,14 +1,12 @@
-- COMBAT_LOG_EVENT_UNFILTERED -- COMBAT_LOG_EVENT_UNFILTERED
---@param e string ---@param e string
function(e, ...) function(e, ...)
-- /run RegisterAddonMessagePrefix("STINKY_DETECTOR")
-- RegisterAddonMessagePrefix(aura_env.addonprefix)
local detected = false local detected = false
local stinky = "" local stinky = ""
local source, err = CLEUParser.GetSourceName(...) local source, err = CLEUParser.GetSourceName(...)
if not err then if not err then
if WeakAurasSaved.Cyka.stinkies[source] then if aura_env.stinkies[source] then
stinky = source stinky = source
detected = true detected = true
end end
@@ -16,7 +14,7 @@ function(e, ...)
if not detected then if not detected then
local destination, err = CLEUParser.GetDestName(...) local destination, err = CLEUParser.GetDestName(...)
if not err then if not err then
if WeakAurasSaved.Cyka.stinkies[destination] then if aura_env.stinkies[destination] then
stinky = destination stinky = destination
detected = true detected = true
end end
@@ -27,36 +25,5 @@ function(e, ...)
aura_env.StinkyDetected(stinky) aura_env.StinkyDetected(stinky)
end end
local overkill, err = CLEUParser.GetOverkill(...)
if err == nil then
local source, err = CLEUParser.GetSourceName(...)
if err ~= nil then source = "unknown" end
local destination, err = CLEUParser.GetDestName(...)
if err ~= nil then destination = "unknown" end
local spellName, err = CLEUParser.GetSpellName(...)
if err ~= nil then spellName = "unknown" end
local sourceid, err = CLEUParser.GetSourceGUID(...)
if err and aura_env.config.debug then
print("Could not get source id for " .. source)
print(...)
return true
end
local destid, err = CLEUParser.GetDestGUID(...)
if err and aura_env.config.debug then
print("Could not get destination id for " .. destination)
print(...)
return true
end
if not string.match(sourceid, "Player") then
-- print("Source is not a player, nevermind...")
return true
end
if not string.match(destid, "Player") then
-- print("Destination is not a player, nevermind...")
return true
end
aura_env.RegisterKill(source, destination, spellName, overkill)
end
return true return true
end end

View File

@@ -1,18 +1,44 @@
-- TICKER_100 -- TICKER_1000
function() ---@param allstates allstates
---@type Message ---@param e string
local message = aura_env.messageQueue[1] ---@param prefix string
if message == nil then return end ---@param msg string
function(allstates, e, prefix, msg, ...)
table.remove(aura_env.messageQueue, 1) for i = 1, 40 do
if aura_env.config.debug then if UnitIsPlayer("nameplate" .. i) then
print(string.format("Processing message; %d in queue", #aura_env.messageQueue)) local name = UnitName("nameplate" .. i)
DevTools_Dump(message) if aura_env.stinkies[name] then
aura_env.StinkyDetected(name)
end
end
end end
if message.addon then local ttl = aura_env.config.ttl or 10
SendAddonMessage(aura_env.addonprefix, message.message, message.channel, message.to) for stinky, data in pairs(aura_env.detectedStinkies) do
else local elapsed = GetTime() - data.seen
SendChatMessage(message.message, message.channel, nil, message.to) if allstates[stinky] then
if elapsed > ttl then
allstates[stinky].show = false
allstates[stinky].changed = true
aura_env.detectedStinkies[stinky] = nil
else
allstates[stinky].progress = string.format("%20ss", string.format("%.1f", elapsed))
allstates[stinky].changed = true
end
else
allstates[stinky] = {
show = true,
changed = true,
name = string.format("%-20s", stinky),
progressType = "timed",
duration = ttl,
expirationTime = GetTime() + ttl,
autohide = true,
index = GetTime(),
progress = string.format("%20ss", string.format("%.1f", elapsed))
}
end
end end
end
return true
end

View File

@@ -1,114 +0,0 @@
-- CHAT_MSG_ADDON TICKER_1000
---@param allstates allstates
---@param e string
---@param prefix string
---@param msg string
function(allstates, e, prefix, msg, ...)
if e == "TICKER_1000" then
local ttl = aura_env.config.ttl or 120
for _, state in pairs(allstates) do
if state.progress then
local elapsedTime = GetTime() - state.index
if elapsedTime > ttl then
state.show = false
state.changed = true
else
local prettyTime = ""
local minutes = 0
while elapsedTime > 60 do
elapsedTime = elapsedTime - 60
minutes = minutes + 1
end
if minutes > 0 then
prettyTime = string.format("%s%dm", prettyTime, minutes)
end
if elapsedTime > 0 then
prettyTime = string.format("%s %ds", prettyTime, elapsedTime)
end
state.progress = string.format("%20s", prettyTime)
state.changed = true
end
end
end
for i = 1, 40 do
if UnitIsPlayer("nameplate" .. i) then
local name = UnitName("nameplate" .. i)
local faction = UnitFactionGroup("nameplate" .. i)
local _, race = UnitRace("nameplate" .. i)
local raceFaction = aura_env.raceFactions[race]
if not raceFaction and aura_env.config.debug then
print("Unknown race faction", race)
else
faction = raceFaction
end
WeakAurasSaved.Cyka.PlayerFactionCache[name] = faction
end
end
return true
end
if not prefix or prefix ~= aura_env.addonprefix then return end
local parts = {}
for part in string.gmatch(msg, "([^" .. aura_env.separator .. "]+)") do
table.insert(parts, part)
end
local name = parts[1]
local threat = tonumber(parts[2])
local note = parts[3]
if not name then
if aura_env.config.debug then
print(string.format("Could not get name for %s (%s) with deliminer '%s'", msg, name or "nil", aura_env.separator))
end
return
end
if not threat then
if aura_env.config.debug then
print(string.format("Could not get threat for %s (%s) with deliminer '%s'", msg, threat or "nil", aura_env.separator))
end
return
end
if not note then
if aura_env.config.debug then
print(string.format("Could not get note for %s (%s) with deliminer '%s'", msg, note or "nil", aura_env.separator))
end
end
if threat < aura_env.config.threatThreshold then
if aura_env.config.debug then
print(string.format("Skipping notify due to low threat (%d < %d)", threat, aura_env.config.threatThreshold))
end
return
end
local stinky = WeakAurasSaved.Cyka.stinkies[name]
if not stinky then
if aura_env.config.debug then
print(string.format("Could not find stinky for %s", name))
end
return false
end
if not aura_env.soundNotifyTimer[name] or aura_env.soundNotifyTimer[name] < GetTime() then
PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master")
aura_env.soundNotifyTimer[name] = GetTime() + aura_env.config.alertThrottle
end
allstates[name] = {
show = true,
changed = true,
name = string.format("%-20s%2d%35s", name, stinky.threat, note),
progressType = "timed",
duration = 60,
expirationTime = GetTime() + aura_env.config.alertThrottle,
autohide = true,
index = GetTime(),
progress = string.format("%20s", "0s"),
}
return true
end

View File

@@ -1,21 +1,10 @@
---@class aura_env ---@class aura_env
---@field messageQueue Message[]
---@field separator string
---@field addonprefix string
---@field config table<string, any> ---@field config table<string, any>
---@field stinkies Stinky[] ---@field stinkies table<string, boolean>
---@field raceFactions table<string, string> ---@field detectedStinkies table<string, {seen: number, muteUntil: number?}>
---@field localStinkies table<string, Stinky>
---@field soundNotifyTimer table<string, number>
---@field GetZone fun(): string
---@field RegisterKill fun(source: string, destination: string, spellName: string, overkill: number)
---@field StinkyDetected fun(name: string) ---@field StinkyDetected fun(name: string)
aura_env.stinkies = {}
aura_env.soundNotifyTimer = {} aura_env.detectedStinkies = {}
aura_env.messageQueue = {}
aura_env.separator = "ž"
aura_env.addonprefix = "STINKY_DETECTOR"
RegisterAddonMessagePrefix(aura_env.addonprefix)
---@param input string ---@param input string
---@param deliminer string ---@param deliminer string
@@ -30,273 +19,22 @@ local function StrSplit(input, deliminer)
return parts, nil return parts, nil
end end
---@type string[]
local toNotify = StrSplit(aura_env.config.notify, ",")
for i, part in ipairs(toNotify) do
toNotify[i] = strtrim(part)
end
WeakAurasSaved.Cyka.stinkies = {}
if not WeakAurasSaved.Cyka.PlayerFactionCache then WeakAurasSaved.Cyka.PlayerFactionCache = {} end
---@class Message
---@field message string
---@field to string
---@field channel string
---@field addon boolean
Message = {
message = "",
to = "",
channel = "",
addon = false,
---@param message string
---@param to string
---@param channel string
---@param addon? boolean
---@return Message
new = function(message, to, channel, addon)
local self = setmetatable({}, {
__index = Message
})
self.message = message
self.to = to
self.channel = channel
self.addon = addon or false
return self
end,
---@param stinky Stinky
QueueNotifyGuild = function(stinky)
if not aura_env.config.stinkyNotifyGuild then return end
if aura_env.config.debug then print("Queueing notify guild:") end
local message = Message.new(stinky:FormMessage(), nil, "GUILD")
if aura_env.config.debug then DevTools_Dump(message) end
table.insert(aura_env.messageQueue, message)
end,
---@param stinky Stinky
QueueNotifyWhisper = function(stinky)
if not aura_env.config.stinkyNotifyWhisper then return end
if aura_env.config.debug then print("Queueing notify whisper:") end
local text = stinky:FormMessage()
for _, to in ipairs(toNotify) do
local message = Message.new(text, to, "WHISPER")
if aura_env.config.debug then DevTools_Dump(message) end
table.insert(aura_env.messageQueue, message)
end
end,
---@param stinky Stinky
QueueNotifyAddonGuild = function(stinky)
if not aura_env.config.stinkyNotifyAddonGuild then return end
if aura_env.config.debug then print("Queueing notify addon guild:") end
local message = Message.new(stinky:FormAddonMessage(), nil, "GUILD", true)
if aura_env.config.debug then DevTools_Dump(message) end
table.insert(aura_env.messageQueue, message)
end,
---@param stinky Stinky
QueueNotifyAddonWhisper = function(stinky)
if not aura_env.config.stinkyNotifyAddonWhisper then return end
if aura_env.config.debug then print("Queueing notify addon whisper:") end
local text = stinky:FormAddonMessage()
for _, to in ipairs(toNotify) do
local message = Message.new(text, to, "WHISPER", true)
if aura_env.config.debug then DevTools_Dump(message) end
table.insert(aura_env.messageQueue, message)
end
end,
---@param faction string
---@param source string
---@param destination string
---@param spellName string
QueueNotifyKilledAddonGuild = function(faction, source, destination, spellName)
if not aura_env.config.killNotifyAddonGuild then return end
if aura_env.config.debug then print("Queueing notify addon guild:") end
local text = table.concat({ faction, source, spellName }, aura_env.separator)
local message = Message.new(text, nil, "GUILD", true)
if aura_env.config.debug then DevTools_Dump(message) end
table.insert(aura_env.messageQueue, message)
end,
---@param faction string
---@param source string
---@param destination string
---@param spellName string
QueueNotifyKilledAddonWhisper = function(faction, source, destination, spellName)
if not aura_env.config.killNotifyAddonWhisper then return end
if aura_env.config.debug then print("Queueing notify addon whisper:") end
local text = table.concat({ faction, source, destination, spellName }, aura_env.separator)
for _, to in ipairs(toNotify) do
local message = Message.new(text, to, "WHISPER", true)
if aura_env.config.debug then DevTools_Dump(message) end
table.insert(aura_env.messageQueue, message)
end
end,
---@param faction string
---@param source string
---@param destination string
---@param spellName string
QueueNotifyKilledGuild = function(faction, source, destination, spellName)
if not aura_env.config.killNotifyGuild then return end
if aura_env.config.debug then print("Queueing notify guild:") end
local text = string.format("%s %s убил %s с помощью %s", faction, source, destination, spellName)
local message = Message.new(text, nil, "GUILD")
if aura_env.config.debug then DevTools_Dump(message) end
table.insert(aura_env.messageQueue, message)
end,
---@param faction string
---@param source string
---@param destination string
---@param spellName string
QueueNotifyKilledWhisper = function(faction, source, destination, spellName)
if not aura_env.config.killNotifyWhisper then return end
if aura_env.config.debug then print("Queueing notify whisper:") end
local text = string.format("%s %s убил %s с помощью %s", faction, source, destination, spellName)
for _, to in ipairs(toNotify) do
local message = Message.new(text, to, "WHISPER")
if aura_env.config.debug then DevTools_Dump(message) end
table.insert(aura_env.messageQueue, message)
end
end
}
---@class Stinky
---@field name string
---@field threat number 1-10 10 being maxima threat
---@field note string|nil
Stinky = {
name = "",
threat = 0,
note = "",
---@param name string
---@param threat number
---@param note string|nil
---@return Stinky
new = function(name, threat, note)
local self = setmetatable({}, {
__index = Stinky
})
self.name = name
self.threat = threat
self.note = note
return self
end,
---@param self Stinky
---@return string
FormMessage = function(self)
return string.format("%s in %s!", self.name, aura_env.GetZone())
end,
---@param self Stinky
---@return string
FormAddonMessage = function(self)
return table.concat({ self.name, self.threat, aura_env.GetZone() }, aura_env.separator)
end,
}
aura_env.raceFactions = {
["Orc"] = "Horde",
["Undead"] = "Horde",
["Tauren"] = "Horde",
["Troll"] = "Horde",
["BloodElf"] = "Horde",
["Goblin"] = "Horde",
["Human"] = "Alliance",
["Dwarf"] = "Alliance",
["NightElf"] = "Alliance",
["Gnome"] = "Alliance",
["Draenei"] = "Alliance",
["Worgen"] = "Alliance",
}
aura_env.GetZone = function()
return string.format("%s (%s)", GetZoneText(), GetSubZoneText())
end
local stinkies = StrSplit(aura_env.config.stinkies, ",") local stinkies = StrSplit(aura_env.config.stinkies, ",")
for i, part in ipairs(stinkies) do for _, name in ipairs(stinkies) do
local datum = StrSplit(part, ":") aura_env.stinkies[name] = true
local name = strtrim(datum[1])
if name then
local threat = tonumber(strtrim(datum[2] or "5"))
WeakAurasSaved.Cyka.stinkies[name] = Stinky.new(name, threat)
end
end end
local killSpamTime = 10
local recentlyKilled = {}
aura_env.RegisterKill = function(source, destination, spellName, overkill)
if recentlyKilled[source] and recentlyKilled[source] > GetTime() - killSpamTime then
print("Death already reported")
return
end
if overkill <= 0 then return end
local faction = "Неизвестная фракция"
if WeakAurasSaved.Cyka.PlayerFactionCache[source] then
faction = WeakAurasSaved.Cyka.PlayerFactionCache[source]
end
Message.QueueNotifyKilledGuild(faction, source, destination, spellName)
Message.QueueNotifyKilledWhisper(faction, source, destination, spellName)
Message.QueueNotifyKilledAddonGuild(faction, source, destination, spellName)
Message.QueueNotifyKilledAddonWhisper(faction, source, destination, spellName)
recentlyKilled[source] = GetTime()
end
aura_env.localStinkies = {}
---@param name string
aura_env.StinkyDetected = function(name) aura_env.StinkyDetected = function(name)
if aura_env.config.debug then print(string.format("StinkyDetected (%s)", name)) end local now = GetTime()
local stinky = WeakAurasSaved.Cyka.stinkies[name] local existing = aura_env.detectedStinkies[name]
if not aura_env.localStinkies[name] or aura_env.localStinkies[name] < if not existing then
GetTime() - aura_env.config.messageThrottle then aura_env.detectedStinkies[name] = { seen = now, muteUntil = 0 }
Message.QueueNotifyGuild(stinky) else
Message.QueueNotifyWhisper(stinky) existing.seen = now
end end
if not aura_env.localStinkies[name] or aura_env.localStinkies[name] < if existing.muteUntil < now then
GetTime() - aura_env.config.messageThrottleAddon then print(existing.muteUntil, now)
Message.QueueNotifyAddonGuild(stinky) PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master")
Message.QueueNotifyAddonWhisper(stinky)
end end
WeakAuras.ScanEvents("CHAT_MSG_ADDON", aura_env.addonprefix, stinky:FormAddonMessage()) aura_env.detectedStinkies[name].muteUntil = now + aura_env.config.alertThrottle
aura_env.localStinkies[name] = GetTime()
end end
if aura_env.config.addFriends and not aura_env.config.addFriends2 then
local friends = {}
local numfriends = GetNumFriends()
for i = 1, numfriends do
local name = GetFriendInfo(i)
friends[name] = true
end
for k, v in pairs(WeakAurasSaved.Cyka.stinkies) do
if not friends[k] then
AddFriend(k)
end
end
C_Timer.After(1, function()
local numfriends = GetNumFriends()
for i = 1, numfriends do
local name = GetFriendInfo(i)
if WeakAurasSaved.Cyka.stinkies[name] then
C_Timer.After(1, function()
-- print(name .. " " .. i .. " Stinky!")
SetFriendNotes(i, "STINKY")
end)
else
C_Timer.After(1, function()
-- print(name .. " " .. i .. " Not stinky")
SetFriendNotes(i, "Not stinky?")
end)
end
end
end)
end
--/run WeakAurasSaved.Cyka.Stinkies["Totleta"] = true
-- /dump WeakAurasSaved.Cyka.Stinkies

View File

@@ -0,0 +1,38 @@
--Integrate into a channel instead of whispers
--But probably also keep whispers, do both
--So for channel see
JoinPermanentChannel("foo")
LeaveChannelByName("foo")
--For existing channels see:
local foo = {GetChannelList()}
--There is also:
GetChannelName(0)
--Opa this also works:
ChannelKick("foobar", "Succpotato")
--But kick is actually ban...
--And unban does not actually work...
--Hmm...
--Relog (of the banned) seems to fix it (fix the kick that is)
--But relog does not fix the ban!
ChannelBan("foobar", "Succpotato")
ChannelUnban("foobar", "Succpotato")
--Mute and unmute both seem to work fine
ChannelMute("foobar", "Succpotato")
ChannelUnmute("foobar", "Succpotato")
--A player can be owner/moderator only for as long as they are online
--So these commands don't make much sense...
ChannelModerator("foobar", "Succpotato")
ChannelUnmoderator("foobar", "Succpotato")
--We can also set password!!
--But only by owner and only via chat
--/pass foobar secret
--Wiki:
--You can only be in ten chat channels at any given time. This does not include other chat types such as say, yell, party, raid, guild, officer, or whisper which are not considered channels.

View File

@@ -1,8 +1,5 @@
---@meta ---@meta
---@param unitId string
---@param index string|number index or name of debuff to query
---@param removable? boolean If 1, only debuffs removable by player will be returned; debuffIndex still begins at 1.
---@return string name The name of the spell or effect of the debuff, or nil if no debuff was found with the specified name or at the specified index. This is the name shown in yellow when you mouse over the icon. ---@return string name The name of the spell or effect of the debuff, or nil if no debuff was found with the specified name or at the specified index. This is the name shown in yellow when you mouse over the icon.
---@return string icon The identifier of (path and filename to) the indicated debuff, or nil if no debuff ---@return string icon The identifier of (path and filename to) the indicated debuff, or nil if no debuff
---@return number count The number of times the debuff has been applied to the target. Returns 0 for any debuff which doesn't stack. ---@return number count The number of times the debuff has been applied to the target. Returns 0 for any debuff which doesn't stack.
@@ -13,4 +10,9 @@
---@return boolean isStealable 1 if it is stealable otherwise nil ---@return boolean isStealable 1 if it is stealable otherwise nil
---@return boolean shouldConsolidate 1 if the buff should be placed in a buff consolidation box (usually long-term effects). ---@return boolean shouldConsolidate 1 if the buff should be placed in a buff consolidation box (usually long-term effects).
---@return number spellId spell ID of the aura. ---@return number spellId spell ID of the aura.
UnitDebuff = function(unitId, index, removable) end ---@overload fun(unit: string, index: number)
---@overload fun(unit: string, index: number, filter: string)
---@overload fun(unit: string, name: string)
---@overload fun(unit: string, name: string, rank: string|nil)
---@overload fun(unit: string, name: string, rank: string|nil, filter: auraFilter)
UnitDebuff = function() end

View File

@@ -1,15 +1,21 @@
---@diagnostic disable: missing-return, lowercase-global ---@diagnostic disable: missing-return, lowercase-global
---@alias auraFilter
---| 'RAID'
---| 'CANCELABLE'
---| 'HARMFUL'
---| 'HELPFUL'
---| 'NOT_CANCELABLE'
---| 'PLAYER'
---| 'RAID'
---@param unit string ---@param unit string
---@param index number ---@param index number
---@param name string
---@param rank string
---@param filter RAID
---@param CANCELABLE
---@param HARMFUL
---@param HELPFUL
---@param NOT_CANCELABLE
---@param PLAYER
---@param RAID
---Cancels a buff on the player. CancelUnitBuff becomes a protected function while under combat lockdown. ---Cancels a buff on the player. CancelUnitBuff becomes a protected function while under combat lockdown.
function CancelUnitBuff(unit, index, name, rank, filter, CANCELABLE, HARMFUL, HELPFUL, NOT_CANCELABLE, PLAYER, RAID) end ---@overload fun(unit: string, index: number)
---@overload fun(unit: string, index: number, rank: string)
---@overload fun(unit: string, index: number, rank: string, filter: auraFilter)
---@overload fun(unit: string, name: string)
---@overload fun(unit: string, name: string, rank: string)
---@overload fun(unit: string, name: string, rank: string, filter: auraFilter)
function CancelUnitBuff(unit, index, name, rank, filter) end

View File

@@ -1,9 +1,7 @@
---@diagnostic disable: missing-return, lowercase-global ---@diagnostic disable: missing-return, lowercase-global
---@param frameType string ---@overload fun(frameType: string): table
---@param name string ---@overload fun(frameType: string, name: string): table
---@param parent table ---@overload fun(frameType: string, name: string, parent: table): table
---@param template string ---@overload fun(frameType: string, name: string, parent: table, template: string): table
---@return table frame function CreateFrame(frameType, name, parent, template) end
---Creates a new Frame object
function CreateFrame(frameType, name, parent, template) end

View File

@@ -1,7 +1,7 @@
---@diagnostic disable: missing-return, lowercase-global ---@diagnostic disable: missing-return, lowercase-global
---@param emote string ---@param emote string
---@param target string
---@param hold boolean
---Performs a preset emote (with optional target). The list of built-in emote tokens can be found in global variables whose names follow the format "EMOTE"..num.."_TOKEN", where num is a number between 1 and MAXEMOTEINDEX (a variable local to ChatFrame.lua.) For custom emotes (as performed using the /emote or /me commands in the default UI), see SendChatMessage(). ---Performs a preset emote (with optional target). The list of built-in emote tokens can be found in global variables whose names follow the format "EMOTE"..num.."_TOKEN", where num is a number between 1 and MAXEMOTEINDEX (a variable local to ChatFrame.lua.) For custom emotes (as performed using the /emote or /me commands in the default UI), see SendChatMessage().
---@overload fun(emote: string, target: string)
---@overload fun(emote: string, target: string, hold: boolean)
function DoEmote(emote, target, hold) end function DoEmote(emote, target, hold) end

View File

@@ -1,8 +1,6 @@
---@diagnostic disable: missing-return, lowercase-global ---@diagnostic disable: missing-return, lowercase-global
---@param itemID number ---@param itemName string
---@param itemName string
---@param itemLink string
---@return string name ---@return string name
---@return string link ---@return string link
---@return number quality ---@return number quality
@@ -15,4 +13,6 @@
---@return string texture ---@return string texture
---@return number vendorPrice ---@return number vendorPrice
---Returns information about an item, by name, link or id. Will only return item information if it is directly available in memory. An item is present in memory if: It has been seen this session, OR It's present in Cache/enUS/Item-sparse.dba, where enUS is the user's locale If item information is not readily available, the client will first look on disk in DBFilesClient/Item-sparse.db2. If an item is found there, the client fires the GET_ITEM_INFO_RECEIVED event and keeps the result in memory for further GetItemInfo requests. If an item is not found on disk either, the client will send a server request for it. If the request fails, nothing happens. If the request succeeds, the client stores the item in memory and writes it to Cache/Locale/Item-sparse.dba. The client will never send more than one server request per id per session. ---Returns information about an item, by name, link or id. Will only return item information if it is directly available in memory. An item is present in memory if: It has been seen this session, OR It's present in Cache/enUS/Item-sparse.dba, where enUS is the user's locale If item information is not readily available, the client will first look on disk in DBFilesClient/Item-sparse.db2. If an item is found there, the client fires the GET_ITEM_INFO_RECEIVED event and keeps the result in memory for further GetItemInfo requests. If an item is not found on disk either, the client will send a server request for it. If the request fails, nothing happens. If the request succeeds, the client stores the item in memory and writes it to Cache/Locale/Item-sparse.dba. The client will never send more than one server request per id per session.
function GetItemInfo(itemID, itemName, itemLink) end ---@overload fun(itemID: number): table
---@overload fun(itemLink: string): table
function GetItemInfo(itemName) end

View File

@@ -1,4 +1,13 @@
---@diagnostic disable: missing-return, lowercase-global ---@diagnostic disable: missing-return, lowercase-global
---@class LootInfo
---@field isQuestItem boolean?
---@field item string Item name
---@field locked boolean Can loot?
---@field quality number Item quality
---@field quantity number Item quantity
---@field roll boolean
---@field texture number Texture file ID
---@return LootInfo[]
function GetLootInfo() end function GetLootInfo() end

View File

@@ -5,6 +5,6 @@
---@return string item ---@return string item
---@return number quantity ---@return number quantity
---@return number quality ---@return number quality
---@return 1nil locked ---@return number? locked (1 if locked, nil if not)
---Returns information about an item available as loot ---Returns information about an item available as loot
function GetLootSlotInfo(slot) end function GetLootSlotInfo(slot) end

View File

@@ -1,13 +1,15 @@
---@diagnostic disable: missing-return, lowercase-global ---@diagnostic disable: missing-return, lowercase-global
---@alias bookType
---| 'SPELL'
---| 'PET'
---@param index number ---@param index number
---@param bookType spell ---@param bookType bookType
---@param pet
---@param spell
---@param name string
---@param id number
---@return number start ---@return number start
---@return number duration ---@return number duration
---@return number enable ---@return number enable
---Returns cooldown information about a spell in the spellbook ---Returns cooldown information about a spell in the spellbook
function GetSpellCooldown(index, bookType, pet, spell, name, id) end ---@overload fun(name: string)
---@overload fun(id: number)
function GetSpellCooldown(index, bookType) end

View File

@@ -1,7 +1,7 @@
---@diagnostic disable: missing-return, lowercase-global ---@diagnostic disable: missing-return, lowercase-global
---@param unit string ---@param unit string
---@param name string
---@param exactMatch boolean
---Promotes a raid member to raid assistant ---Promotes a raid member to raid assistant
---@overload fun(name: string, exactMatch: boolean)
---@overload fun(unit: string)
function PromoteToAssistant(unit, name, exactMatch) end function PromoteToAssistant(unit, name, exactMatch) end

View File

@@ -1,20 +1,22 @@
---@diagnostic disable: missing-return, lowercase-global ---@diagnostic disable: missing-return, lowercase-global
---@alias channel
---| 'CHANNEL' channel
---| 'DND' text
---| 'EMOTE' /e
---| 'GUILD' /g
---| 'INSTANCE_CHAT' /i
---| 'OFFICER' /o
---| 'PARTY' /p
---| 'RAID' /ra
---| 'RAID_WARNING' /rw
---| 'SAY' /s
---| 'WHISPER' channel
---| 'YELL' /y
---@param text string ---@param text string
---@param chatType /y ---@param chatType channel
---@param CHANNEL channel
---@param DND text
---@param EMOTE /e
---@param GUILD /g
---@param INSTANCE_CHAT /i
---@param OFFICER /o
---@param PARTY /p
---@param RAID /ra
---@param RAID_WARNING /rw
---@param SAY /s
---@param WHISPER channel
---@param YELL /y
---@param languageIndex number
---@param channel string
---Sends a chat message ---Sends a chat message
function SendChatMessage(text, chatType, CHANNEL, DND, EMOTE, GUILD, INSTANCE_CHAT, OFFICER, PARTY, RAID, RAID_WARNING, SAY, WHISPER, YELL, languageIndex, channel) end ---@overload fun(text: string, chatType: channel, languageIndex: number)
---@overload fun(text: string, chatType: channel, languageIndex: number, channel: string)
function SendChatMessage(text, chatType, languageIndex, channel) end

View File

@@ -1,9 +1,9 @@
---@diagnostic disable: missing-return, lowercase-global ---@diagnostic disable: missing-return, lowercase-global
---@param unit string ---@param unit string
---@param name string
---@return string class ---@return string class
---@return string classFileName ---@return string classFileName
---@return number classIndex ---@return number classIndex
---Returns a unit's class. The second return (classFileName) can be used for locale-independent verification of a unit's class, or to look up class-related data in various global tables: RAID_CLASS_COLORS provides a standard color for each class (as seen in the default who, guild, calendar, and raid UIs) CLASS_ICON_TCOORDS provides coordinates to locate each class' icon within the "Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes" texture For non-player units, the first return (class) will be the unit's name; to always get a localized class name regardless of unit type, use UnitClassBase instead. ---Returns a unit's class. The second return (classFileName) can be used for locale-independent verification of a unit's class, or to look up class-related data in various global tables: RAID_CLASS_COLORS provides a standard color for each class (as seen in the default who, guild, calendar, and raid UIs) CLASS_ICON_TCOORDS provides coordinates to locate each class' icon within the "Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes" texture For non-player units, the first return (class) will be the unit's name; to always get a localized class name regardless of unit type, use UnitClassBase instead.
function UnitClass(unit, name) end ---@overload fun(name: string)
function UnitClass(unit) end

View File

@@ -1,7 +1,7 @@
---@diagnostic disable: missing-return, lowercase-global ---@diagnostic disable: missing-return, lowercase-global
---@param unit string ---@param unit string
---@param name string ---@return boolean exists
---@return 1nil exists
---Returns whether a unit exists. A unit "exists" if it can be referenced by the player; e.g. party1 exists if the player is in a party with at least one other member (regardless of whether that member is nearby), target exists if the player has a target, npc exists if the player is currently interacting with an NPC, etc. ---Returns whether a unit exists. A unit "exists" if it can be referenced by the player; e.g. party1 exists if the player is in a party with at least one other member (regardless of whether that member is nearby), target exists if the player has a target, npc exists if the player is currently interacting with an NPC, etc.
---@overload fun(name: string)
function UnitExists(unit, name) end function UnitExists(unit, name) end

View File

@@ -1,7 +1,7 @@
---@diagnostic disable: missing-return, lowercase-global ---@diagnostic disable: missing-return, lowercase-global
---@param unit string ---@param unit string
---@param name string ---@return boolean leader
---@return bool leader
---Returns whether a unit is the raid leader. ---Returns whether a unit is the raid leader.
---@overload fun(name: string)
function UnitIsGroupLeader(unit, name) end function UnitIsGroupLeader(unit, name) end

View File

@@ -2,7 +2,7 @@
---@param sep string ---@param sep string
---@param text string ---@param text string
---@param limit number ---@param limit number?
---@return string ... ---@return string ...
---Splits a string based on another seperator string. Also available as string.split (though not provided by the Lua standard library). ---Splits a string based on another seperator string. Also available as string.split (though not provided by the Lua standard library).
function strsplit(sep, text, limit) end function strsplit(sep, text, limit) end

View File

@@ -1,7 +1,7 @@
---@diagnostic disable: missing-return, lowercase-global ---@diagnostic disable: missing-return, lowercase-global
---@param str string ---@param str string
---@param trimChars string
---@return string text ---@return string text
---Trims leading and trailing characters (whitespace by default) from a string. Also available as string.trim (though not provided by the Lua standard library). ---Trims leading and trailing characters (whitespace by default) from a string. Also available as string.trim (though not provided by the Lua standard library).
---@overload fun(str: string, trimChars: string)
function strtrim(str, trimChars) end function strtrim(str, trimChars) end

View File

@@ -1 +1 @@
print(string.find("10 Gold", "%d+ ((Gold)|(Silver)|(Copper))")) print(string.gsub("SHIFT-Y", "SHIFT%-", "S"))