-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
gossip.lua
103 lines (88 loc) · 2.95 KB
/
gossip.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
local _, addon = ...
local DARKMOON_GOSSIP = {
[40007] = true, -- Darkmoon Faire Mystic Mage (Horde)
[40457] = true, -- Darkmoon Faire Mystic Mage (Alliance)
}
local QUEST_GOSSIP = {
-- usually only addeed if they're repeatable
[109275] = true, -- Soridormi - begin time rift
[120619] = true, -- Big Dig task
[120620] = true, -- Big Dig task
[120555] = true, -- Awakening The Machine
[120733] = true, -- Theater Troupe
-- Darkmoon Faire
[40563] = true, -- whack
[28701] = true, -- cannon
[31202] = true, -- shoot
[39245] = true, -- tonk
[40224] = true, -- ring toss
[43060] = true, -- firebird
[52651] = true, -- dance
[41759] = true, -- pet battle 1
[42668] = true, -- pet battle 2
[40872] = true, -- cannon return (Teleportologist Fozlebub)
}
local IGNORE_GOSSIP = {
-- when we don't want to automate gossip because it's counter-intuitive
[122442] = true, -- leave the dungeon in remix
}
function addon:GOSSIP_SHOW()
if addon:IsPaused() or addon:IsNPCIgnored() then
return
end
if C_PlayerInteractionManager.IsInteractingWithNpcOfType(Enum.PlayerInteractionType.TaxiNode) then
-- don't annoy taxi addons
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)
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 == 1 and addon:GetOption('autoquestgossip') then
C_GossipInfo.SelectOption(gossipSkips[1])
return
elseif #gossipQuests == 1 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
end
if #gossip ~= 1 then
-- more than 1 option
return
end
if not addon:GetOption('skipgossip') then
return
end
if not gossip[1].gossipOptionID then
-- intentionally blocked gossip
return
end
if IGNORE_GOSSIP[gossip[1].gossipOptionID] then
return
end
local _, instanceType = GetInstanceInfo()
if instanceType == 'raid' and addon:GetOption('skipgossipwhen') > 1 then
if GetNumGroupMembers() <= 1 or addon:GetOption('skipgossipwhen') == 3 then
C_GossipInfo.SelectOption(gossip[1].gossipOptionID)
end
elseif instanceType ~= 'raid' then
C_GossipInfo.SelectOption(gossip[1].gossipOptionID)
end
end