From 75f55f1fffba8f8f0cc164643ea6f13e5f64a8a9 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Mon, 27 Oct 2014 15:01:58 +0100 Subject: [PATCH] Add more options for the gossip automization --- Config.lua | 32 ++++++++++++++++++++++++++++---- QuickQuest.lua | 29 +++++++++++++++-------------- 2 files changed, 43 insertions(+), 18 deletions(-) diff --git a/Config.lua b/Config.lua index 7494477..d94d6fb 100644 --- a/Config.lua +++ b/Config.lua @@ -8,7 +8,7 @@ local defaults = { items = true, faireport = true, gossip = true, - gossipraid = true, + gossipraid = 1, modifier = 'SHIFT', reverse = false, itemBlacklist = { @@ -60,6 +60,14 @@ Panel:SetScript('OnEvent', function() QuickQuestDB.ignoredQuests = nil end + if(type(QuickQuestDB.gossipraid) == 'boolean') then + if(QuickQuestDB.gossipraid) then + QuickQuestDB.gossipraid = 0 + else + QuickQuestDB.gossipraid = 2 + end + end + for key, value in next, defaults do if(QuickQuestDB[key] == nil) then QuickQuestDB[key] = value @@ -189,10 +197,22 @@ do Menu:GetParent().Label:SetText(self:GetText()) end + local function Enable(self) + self.Label:SetTextColor(1, 1, 1) + self.Button:Enable() + end + + local function Disable(self) + self.Label:SetTextColor(1/3, 1/3, 1/3) + self.Button:Disable() + end + function CreateDropdown(parent, key, items) local Dropdown = CreateFrame('Frame', nil, parent) Dropdown:SetSize(110, 32) Dropdown:SetScript('OnHide', OnHide) + Dropdown.Enable = Enable + Dropdown.Disable = Disable Dropdown.keys = items local LeftTexture = Dropdown:CreateTexture() @@ -312,9 +332,13 @@ Panel:SetScript('OnShow', function(self) Gossip:SetPoint('TOPLEFT', Items, 'BOTTOMLEFT', 0, -8) Gossip.Text:SetText(L['Select gossip option if there is only one']) - local GossipRaid = CreateCheckButton(self, 'gossipraid', Gossip) - GossipRaid:SetPoint('TOPLEFT', Gossip, 'BOTTOMLEFT', 24, -8) - GossipRaid.Text:SetText(L['Only select gossip option while not in a raid']) + local GossipRaid = CreateDropdown(self, 'gossipraid', { + [0] = L['Never'], + [1] = L['Soloing'], + [2] = L['Always'] + }) + GossipRaid:SetPoint('TOPLEFT', Gossip, 'BOTTOMLEFT', 24, -10) + GossipRaid.Text:SetText(L['When to select gossip while in a raid']) Gossip:HookScript('OnClick', function(self) if(self:GetChecked()) then diff --git a/QuickQuest.lua b/QuickQuest.lua index 9459e39..bc27ac3 100644 --- a/QuickQuest.lua +++ b/QuickQuest.lua @@ -76,24 +76,25 @@ QuickQuest:Register('GOSSIP_SHOW', function() end end - if(QuickQuestDB.gossip) then - if(available == 0 and active == 0 and GetNumGossipOptions() == 1) then + if(available == 0 and active == 0 and GetNumGossipOptions() == 1) then + if(QuickQuestDB.faireport) then + local npcID = GetNPCID() + if(npcID == 57850) then + return SelectGossipOption(1) + end + end + + if(QuickQuestDB.gossip) then local _, instance = GetInstanceInfo() - if(not (QuickQuestDB.gossipraid and instance == 'raid')) then - local _, type = GetGossipOptions() - if(type == 'gossip') then - SelectGossipOption(1) + if(instance == 'raid' and QuickQuestDB.gossipraid > 0) then + if(GetNumGroupMembers() > 1 and QuickQuestDB.gossipraid < 2) then return end - end - end - end - if(QuickQuestDB.faireport) then - local npcID = GetNPCID() - if(npcID and npcID == 57850) then - -- See if 1 is the right option - SelectGossipOption(1) + SelectGossipOption(1) + elseif(instance ~= 'raid') then + SelectGossipOption(1) + end end end end) -- 1.7.9.5