WoW-Sitcomify/main.lua

46 lines
1.1 KiB
Lua
Raw Permalink Normal View History

2022-06-04 16:51:29 +02:00
Sitcomify = {}
Sitcomify.Laugh = function()
randomIndex = random(0,9);
PlaySoundFile("Interface\\AddOns\\Sitcomify\\laughtracks\\Audience Laughing-0" .. randomIndex .. ".wav", "MASTER");
end
local eventFrame = CreateFrame("frame", "SitcomifyMainframe");
eventFrame:RegisterEvent("PLAYER_DEAD");
eventFrame:RegisterEvent("ENCOUNTER_END");
eventFrame:RegisterEvent("LFG_PROPOSAL_FAILED");
eventFrame:RegisterEvent("LOSS_OF_CONTROL_ADDED");
eventFrame:SetScript("OnEvent", function(self, e, ...)
--> Laugh if the player dies
if (e == "PLAYER_DEAD") then
Sitcomify.Laugh();
--> Laugh if the players group wipes
elseif (e == "ENCOUNTER_END") then
encounterSuccessful = select(5, ...);
if (encounterSuccessful == 0) then
Sitcomify.Laugh();
end
--> Laugh if someone doesn't accept the LFR/LFG invite
elseif (e == "LFG_PROPOSAL_FAILED") then
Sitcomify.Laugh();
--> Laugh if the player gets stunned
elseif (e == "LOSS_OF_CONTROL_ADDED") then
Sitcomify.Laugh();
end
end);
SLASH_SITCOMIFY1 = "/laughtrack"
2022-06-05 13:16:52 +02:00
SLASH_SITCOMIFY2 = "/lt"
2022-06-04 16:51:29 +02:00
SlashCmdList["SITCOMIFY"] = function(msg)
Sitcomify.Laugh();
end