Skip to content

Commit

Permalink
Added options to better control !keys queries (close #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Jan 14, 2023
1 parent 39e7d0b commit 3e0f4f2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
3 changes: 2 additions & 1 deletion Locale/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ L["My new key"] = true
L["Display offline players"] = true
L["Don't shorten dungeon names"] = true
L["When checked tooltip will display full dungeon name."] = true
L["Respond to !keys query"] = true
L["Respond to !keys queries on the guild chat"] = true
L["Respond to !keys queries on the group/raid chat"] = true
L["Display minimap button"] = true
L["Pinned characters"] = true
L["Comma-separated list of character names. They will be shown at the top of the list regardless of status."] = true
34 changes: 21 additions & 13 deletions REKeys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ RE.MPlusDataReceived = false
RE.GroupFound = false
RE.TooltipDirty = false

RE.DefaultSettings = {["CurrentWeek"] = 0, ["ResetTimestamp"] = 0, ["ServerTimestamp"] = 0, ["PinnedCharacters"] = {}, ["Sorting"] = 1, ["FullDungeonName"] = false, ["ChatQuery"] = true, ["OfflinePlayers"] = false, ["MinimapButtonSettings"] = {["hide"] = false}}
RE.DefaultSettings = {["CurrentWeek"] = 0, ["ResetTimestamp"] = 0, ["ServerTimestamp"] = 0, ["PinnedCharacters"] = {}, ["Sorting"] = 1, ["FullDungeonName"] = false, ["ChatQueryGuild"] = true, ["ChatQueryGroup"] = true, ["OfflinePlayers"] = false, ["MinimapButtonSettings"] = {["hide"] = false}}
RE.AceConfig = {
type = "group",
args = {
Expand All @@ -68,28 +68,36 @@ RE.AceConfig = {
set = function(_, val) RE.Settings.MinimapButtonSettings.hide = not val; if RE.Settings.MinimapButtonSettings.hide then LDBI:Hide("REKeys") else LDBI:Show("REKeys") end end,
get = function(_) return not RE.Settings.MinimapButtonSettings.hide end
},
chatquery = {
name = L["Respond to !keys query"],
chatqueryguild = {
name = L["Respond to !keys queries on the guild chat"],
type = "toggle",
width = "full",
order = 3,
set = function(_, val) RE.Settings.ChatQuery = val end,
get = function(_) return RE.Settings.ChatQuery end
set = function(_, val) RE.Settings.ChatQueryGuild = val end,
get = function(_) return RE.Settings.ChatQueryGuild end
},
chatquerygroup = {
name = L["Respond to !keys queries on the group/raid chat"],
type = "toggle",
width = "full",
order = 4,
set = function(_, val) RE.Settings.ChatQueryGroup = val end,
get = function(_) return RE.Settings.ChatQueryGroup end
},
dungeonname = {
name = L["Don't shorten dungeon names"],
desc = L["When checked tooltip will display full dungeon name."],
type = "toggle",
width = "full",
order = 4,
order = 5,
set = function(_, val) RE.Settings.FullDungeonName = val end,
get = function(_) return RE.Settings.FullDungeonName end
},
sorting = {
name = _G.BAG_FILTER_TITLE_SORTING,
type = "select",
width = "double",
order = 5,
order = 6,
values = {
[1] = _G.CALENDAR_EVENT_NAME,
[2] = _G.RATING,
Expand All @@ -103,7 +111,7 @@ RE.AceConfig = {
desc = L["Comma-separated list of character names. They will be shown at the top of the list regardless of status."],
type = "input",
width = "double",
order = 6,
order = 7,
set = function(_, val)
RE.Settings.PinnedCharacters = {}
local input = {strsplit(",", val)}
Expand Down Expand Up @@ -324,11 +332,11 @@ function RE:OnEvent(self, event, name, ...)
end
After(5, function() RE:FindKey(true) end)
elseif event == "CHAT_MSG_GUILD" then
RE:ParseChat(name, "GUILD")
RE:ParseChat(name, "GUILD", RE.Settings.ChatQueryGuild)
elseif event == "CHAT_MSG_PARTY" or event == "CHAT_MSG_PARTY_LEADER" then
RE:ParseChat(name, "PARTY")
RE:ParseChat(name, "PARTY", RE.Settings.ChatQueryGroup)
elseif event == "CHAT_MSG_RAID" or event == "CHAT_MSG_RAID_LEADER" then
RE:ParseChat(name, IsPartyLFG() and "INSTANCE_CHAT" or "RAID")
RE:ParseChat(name, IsPartyLFG() and "INSTANCE_CHAT" or "RAID", RE.Settings.ChatQueryGroup)
elseif event == "MYTHIC_PLUS_CURRENT_AFFIX_UPDATE" then
RE.MPlusDataReceived = true
end
Expand Down Expand Up @@ -615,8 +623,8 @@ function RE:FindKeyDelay()
RE:LORSearchStart()
end

function RE:ParseChat(msg, channel)
if RE.Settings.ChatQuery and not RE.KeyQueryLimit and msg == "!keys" then
function RE:ParseChat(msg, channel, respond)
if respond and not RE.KeyQueryLimit and msg == "!keys" then
RE.KeyQueryLimit = true
After(30, function() RE.KeyQueryLimit = false end)
local keyLink = RE:GetKeystoneLink()
Expand Down
2 changes: 1 addition & 1 deletion REKeys.toc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Interface: 100002
## Title: |cFF74D06CRE|rKeys
## Notes: Collect information about keystones owned by your friends.
## Version: 2.0.0
## Version: 2.0.1
## Author: AcidWeb
## SavedVariables: REKeysSettings, REKeysDB2
## OptionalDeps: RaiderIO
Expand Down

0 comments on commit 3e0f4f2

Please sign in to comment.