declineInvite_conf = { ["ENABLED"] = true, }; function declineInvite_OnLoad() SlashCmdList["declineInvite"] = declineInvite_SlashCmd; SLASH_declineInvite1 = "/declineinvite"; SLASH_declineInvite2 = "/di"; DEFAULT_CHAT_FRAME:AddMessage("Loaded declineIvite addon."); end function declineInvite_SlashCmd(a, msg) if( declineInvite_conf["ENABLED"] ) then declineInvite_conf["ENABLED"] = false; DEFAULT_CHAT_FRAME:AddMessage("declineInvite disabled."); else declineInvite_conf["ENABLED"] = true; DEFAULT_CHAT_FRAME:AddMessage("declineInvite enabled."); end; end local timeInvited = nil; local timeDeclineDelay = 2 + math.random(7); function declineInvite_OnUpdate() if( timeInvited ~= nil and os.difftime(os.time(), timeInvited) > timeDeclineDelay ) then StaticPopup_OnClick(StaticPopup1, 2); timeInvited = nil; timeDeclineDelay = 2 + math.random(7); end if( timeInvited ~= nil and os.difftime(os.time(), timeInvited) > timeDeclineDelay ) then StaticPopup_OnClick(StaticPopup1, 2); timeInvited = nil; timeDeclineDelay = 2 + math.random(7); end if( timeInvited ~= nil and os.difftime(os.time(), timeInvited) > timeDeclineDelay ) then StaticPopup_OnClick(StaticPopup1, 2); timeInvited = nil; timeDeclineDelay = 2 + math.random(7); end end function playsound() local interfacevolume = InterfaceSFXVolumeSlider_GetValue() local mastervolume = MasterVolumeSlider_GetValue() if mastervolume > 90 and 100 >= mastervolume then InterfaceSFXVolumeSlider_SetValue(30) end if mastervolume > 80 and 90 >= mastervolume then InterfaceSFXVolumeSlider_SetValue(35) end if mastervolume > 70 and 80 >= mastervolume then InterfaceSFXVolumeSlider_SetValue(40) end if mastervolume > 60 and 70 >= mastervolume then InterfaceSFXVolumeSlider_SetValue(50) end if mastervolume > 50 and 60 >= mastervolume then InterfaceSFXVolumeSlider_SetValue(60) end if mastervolume > 40 and 50 >= mastervolume then InterfaceSFXVolumeSlider_SetValue(70) end if mastervolume > 30 and 40 >= mastervolume then InterfaceSFXVolumeSlider_SetValue(80) end if mastervolume > 20 and 30 >= mastervolume then InterfaceSFXVolumeSlider_SetValue(90) end if 20 >= mastervolume then MasterVolumeSlider_SetValue(20) InterfaceSFXVolumeSlider_SetValue(100) end PlaySoundByPath("Interface/AddOns/declineInvite/Sound/alarm.wav") InterfaceSFXVolumeSlider_SetValue(interfacevolume) MasterVolumeSlider_SetValue(mastervolume) end function declineInvite_OnEvent(event) if( declineInvite_conf["ENABLED"] == false ) then return; end; if( event == "PARTY_INVITE_REQUEST" ) then DEFAULT_CHAT_FRAME:AddMessage("Enqueued a decline for party invite in " .. timeDeclineDelay .. " seconds."); playsound() timeInvited = os.time(); end if( event == "GUILD_INVITE_REQUEST" ) then DEFAULT_CHAT_FRAME:AddMessage("Enqueued a decline for guild invite in " .. timeDeclineDelay .. " seconds."); DEFAULT_CHAT_FRAME:AddMessage("guildinvite: "..StaticPopup_Visible("GUILD_INVITE")) playsound() timeInvited = os.time(); end if( event == "TRADE_REQUEST" ) then DEFAULT_CHAT_FRAME:AddMessage("Enqueued a decline for trade request in " .. timeDeclineDelay .. " seconds."); playsound() timeInvited = os.time(); end end