local t4bf = CreateFrame('Frame'); |
t4bf:SetScript('OnEvent', function(self, event, ...) |
--DEFAULT_CHAT_FRAME:AddMessage("Working # 1") |
local timestamp, eventType, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags = select(1, ...) |
local filter = bit.bor(COMBATLOG_OBJECT_AFFILIATION_OUTSIDER, COMBATLOG_OBJECT_REACTION_FRIENDLY, COMBATLOG_OBJECT_CONTROL_MASK, COMBATLOG_OBJECT_TYPE_MASK) |
if eventType == "SPELL_AURA_APPLIED" and destGUID == UnitGUID("player") and (CombatLog_Object_IsA(sourceFlags, filter) == 1) then |
t4bf:SetScript('OnEvent', function(self, event, ...) getglobal("T4B_"..event)(event, ...) end); |
t4bf:RegisterEvent("VARIABLES_LOADED") |
|
function T4B_VARIABLES_LOADED(event, ...) |
if T4BOpts == nil then |
T4BOpts = {} |
end |
|
if T4BOpts["macro"] == nil then |
T4BOpts["macro"] = false |
end |
|
if T4BOpts["spell"] == nil then |
T4BOpts["spell"] = true |
end |
t4bf:UnregisterEvent("VARIABLES_LOADED") |
t4bf:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
|
T4BAbout = LibStub("tekKonfig-AboutPanel").new(nil, "Thanks4Buff") |
|
-- Create the Main Options |
local T4BOptFrame = CreateFrame("Frame", "T4BOptions", InterfaceOptionsFramePanelContainer) |
T4BOptFrame.name = "General Options" |
T4BOptFrame.parent = "Thanks4Buff" |
local title, subtitle = LibStub("tekKonfig-Heading").new(T4BOptFrame, "Thanks 4 Buff Options", "This panel controls the various T4B options.") |
|
-- Add the option to have T4B create a buffing macro. |
local macrocheck = LibStub("tekKonfig-Checkbox").new(T4BOptFrame, nil, "Create a macro that can be used to automatically buff those that buff you?", "TOPLEFT", subtitle, "BOTTOMLEFT", -2, -8) |
local checksound = macrocheck:GetScript("OnClick") |
macrocheck:SetScript("OnClick", function(self) checksound(self); T4BOpts["macro"] = not T4BOpts["macro"]; end) |
local _, englishName = UnitClass("player") |
if T4B_Buffs[englishName] == nil then |
macrocheck:Disable() |
macrocheck:SetChecked(false) |
else |
macrocheck:Enable() |
macrocheck:SetChecked(T4BOpts["macro"]) |
end |
|
-- Add the option to include the spellname |
local spellcheck = LibStub("tekKonfig-Checkbox").new(T4BOptFrame, nil, "Add the name of the buff to the thank you emote?", "TOPLEFT", macrocheck, "BOTTOMLEFT", -2, -8) |
local checksound = spellcheck:GetScript("OnClick") |
spellcheck:SetScript("OnClick", function(self) checksound(self); T4BOpts["spell"] = not T4BOpts["spell"]; end) |
spellcheck:SetChecked(T4BOpts["spell"]) |
|
InterfaceOptions_AddCategory(T4BOptFrame) |
end |
|
|
|
function T4B_COMBAT_LOG_EVENT_UNFILTERED(event, ...) |
local timestamp, eventType, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags = select(1, ...) |
local filter = bit.bor(COMBATLOG_OBJECT_AFFILIATION_OUTSIDER, COMBATLOG_OBJECT_REACTION_FRIENDLY, COMBATLOG_OBJECT_CONTROL_MASK, COMBATLOG_OBJECT_TYPE_MASK) |
if eventType == "SPELL_AURA_APPLIED" and destGUID == UnitGUID("player") and (CombatLog_Object_IsA(sourceFlags, filter) == 1) then |
|
local emotetext |
if T4BOpts["spell"] then |
local spellId, spellName, spellSchool = select(9, ...) |
SendChatMessage("thanks "..sourceName.." for their "..spellName..".", "EMOTE") |
end |
end); |
t4bf:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |