Skip to content

Commit

Permalink
Skip long dialogue options
Browse files Browse the repository at this point in the history
  • Loading branch information
p3lim committed Aug 6, 2024
1 parent 56ba900 commit b6ee616
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions gossip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,34 @@ function addon:GOSSIP_SHOW()
return
end

-- need to iterate all the options first before we can select them
local gossipQuests = {}
local gossipSkips = {}

local gossip = C_GossipInfo.GetOptions()
for _, info in next, gossip do
if DARKMOON_GOSSIP[info.gossipOptionID] and addon:GetOption('paydarkmoonfaire') then
-- we can select this one directly since it never interferes with the others
C_GossipInfo.SelectOption(info.gossipOptionID, '', true)
elseif QUEST_GOSSIP[info.gossipOptionID] and addon:GetOption('autoquestgossip') then
C_GossipInfo.SelectOption(info.gossipOptionID)
elseif FlagsUtil.IsSet(info.flags, Enum.GossipOptionRecFlags.QuestLabelPrepend) and addon:GetOption('autoquestgossip') then
C_GossipInfo.SelectOption(info.gossipOptionID)
return
elseif QUEST_GOSSIP[info.gossipOptionID] then
table.insert(gossipQuests, info.gossipOptionID)
elseif FlagsUtil.IsSet(info.flags, Enum.GossipOptionRecFlags.QuestLabelPrepend) then
table.insert(gossipQuests, info.gossipOptionID)
elseif info.name:sub(1, 11) == '|cFFFF0000<' then
-- TODO: this might get a flag in the future
table.insert(gossipSkips, info.gossipOptionID)
end
end

if #gossipSkips > 0 and addon:GetOption('autoquestgossip') then
C_GossipInfo.SelectOption(gossipSkips[1])
return
elseif #gossipQuests > 0 and addon:GetOption('autoquestgossip') then
C_GossipInfo.SelectOption(gossipQuests[1])
return
end

if (C_GossipInfo.GetNumActiveQuests() + C_GossipInfo.GetNumAvailableQuests()) > 0 then
-- don't automate misc gossip if the NPC is a quest giver
return
Expand Down

0 comments on commit b6ee616

Please sign in to comment.