C_GossipInfo.GetOptions

From Warcraft Wiki
Jump to navigation Jump to search

Returns the available gossip options at a quest giver.

info = C_GossipInfo.GetOptions()

Returns

info
GossipOptionUIInfo[]
Field Type Description
gossipOptionID number? This can be nil to avoid automation
name string Text of the gossip item
icon number : fileID Icon of the gossip type
rewards GossipOptionRewardInfo[]
status Enum.GossipOptionStatus
spellID number?
flags number
overrideIconID number? : fileID
selectOptionWhenOnlyOption boolean
orderIndex number
GossipOptionRewardInfo
Field Type Description
id number
quantity number
rewardType Enum.GossipOptionRewardType
Enum.GossipOptionRewardType
Value Field Description
0 Item
1 Currency
Enum.GossipOptionStatus
Value Field Description
0 Available
1 Unavailable
2 Locked
3 AlreadyComplete

Details

Related Events GOSSIP_SHOW
Related API C_GossipInfo.SelectOption
C_GossipInfo.SelectOptionByIndex
C_GossipInfo.SelectActiveQuest
C_GossipInfo.SelectAvailableQuest

Example

Prints gossip options and automatically selects the vendor gossip when e.g. at an innkeeper.

local function OnEvent(self, event)
	local info = C_GossipInfo.GetOptions()
	for i, v in pairs(info) do
		print(i, v.icon, v.name, v.gossipOptionID)
		if v.icon == 132060 then -- interface/gossipframe/vendorgossipicon.blp
			print("Selecting vendor gossip option.")
			C_GossipInfo.SelectOption(v.gossipOptionID)
		end
	end
end

local f = CreateFrame("Frame")
f:RegisterEvent("GOSSIP_SHOW")
f:SetScript("OnEvent", OnEvent)

Patch changes

Dragonflight Patch 10.0.7 (2023-03-21): Changed the gossipOptionID field to be nilable.
Dragonflight Patch 10.0.0 (2022-10-25): Removed the type field (banker, battlemaster, binder, gossip, healer, petition, tabard, taxi, trainer, unlearn, vendor, workorder, chatbubble). Added gossipOptionID, icon, flags, overrideIconID, selectOptionWhenOnlyOption, orderIndex fields.
Shadowlands Patch 9.0.2 (2020-11-17): Added spellID field.
Shadowlands Patch 9.0.1 (2020-10-13): Namespaced to C_GossipInfo.GetOptions() and returns structured data.
WoW Icon update.png Patch 1.0.0 (2004-10-08): Added as GetGossipOptions()