View Single Post
03-28-24, 06:30 AM   #4
sirpucna
An Aku'mai Servant
Join Date: Nov 2016
Posts: 34
i got ChatGPT to whip this up for me a bit ago.

Lua Code:
  1. --/dump C_GossipInfo.GetOptions()
  2.         --use above on every dialog to capture gossip IDs
  3.         local NPC_LIST = {
  4.             ["Katy Stampwhistle"] = {48598},
  5.             ["Haephesta"] = {56395, 55039}, --selects option 1, then 3
  6.         }
  7.  
  8.         local AutoGossip = CreateFrame("Frame")
  9.         function AutoGossip:OnEvent(_, type)
  10.             if IsShiftKeyDown() then return end
  11.             if type ~= Enum.PlayerInteractionType.Gossip then return end
  12.             local npcName = GossipFrame.TitleContainer.TitleText:GetText()
  13.             if not npcName then return end
  14.             local gossips = NPC_LIST[npcName]
  15.             if not gossips then return end
  16.             local options = C_GossipInfo.GetOptions()
  17.             if not options then return end
  18.             for _, option in ipairs(options) do
  19.                 if tContains(gossips, option.gossipOptionID) then
  20.                     C_GossipInfo.SelectOption(option.gossipOptionID)
  21.                     return
  22.                 end
  23.             end
  24.         end
  25.  
  26.         AutoGossip:SetScript("OnEvent", AutoGossip.OnEvent)
  27.         AutoGossip:RegisterEvent("PLAYER_INTERACTION_MANAGER_FRAME_SHOW")
  Reply With Quote