
local login = CreateFrame("Frame")
login:RegisterEvent("PLAYER_LOGIN")
login:SetScript("OnEvent", function(self, event, arg1, ...)
	
	if ENABLED == nil then
		ENABLED = true
	else
	end
	
	if CLEAR_SPAM == nil then
		CLEAR_SPAM = 1
	else
	end
	
	if ENABLED == true then
		DEFAULT_CHAT_FRAME:AddMessage("LazyPet is enabled!", 0.0, 1.0, 0.0, 53, 5)
	else
		DEFAULT_CHAT_FRAME:AddMessage("LazyPet is disabled!", 1.0, 0.0, 0.0, 53, 5)
	end
	
end)
----------------------------------------------------------------------------------------------------
SLASH_LAZYPET1, SLASH_LAZYPET2, SLASH_LAZYPET3 = '/lazypet', '/lazy', '/lp';
local function handler(msg, editBox)
	arg = strsplit(" ", msg, 1)
	arg = string.lower(arg)

	if arg == "" then
	
		if ENABLED == true then
			ENABLED = false
			DEFAULT_CHAT_FRAME:AddMessage("LazyPet disabled.", 1.0, 0.0, 0.0, 53, 5)
		elseif ENABLED == false then
			ENABLED = true
			DEFAULT_CHAT_FRAME:AddMessage("LazyPet enabled.", 0.0, 1.0, 0.0, 53, 5)
		else
		end

	elseif arg == "help" then
		DEFAULT_CHAT_FRAME:AddMessage("LazyPet is a simple addon that gives out a warning when your pet is not attacking.", 0.0, 1.0, 0.0, 53, 5)
		DEFAULT_CHAT_FRAME:AddMessage("/lp, /lazy, /lazypet to disable/enable.", 0.0, 1.0, 0.0, 53, 5)
		
	else
	end

end
SlashCmdList["LAZYPET"] = handler

----------------------------------------------------------------------------------------------------

local frame = CreateFrame("Frame")
frame.elapsed = 3 -- once every 3 seconds, change this to adjust the refresh time
frame:SetScript("OnUpdate", function(self, elapsed)
	self.elapsed = self.elapsed - elapsed
	if self.elapsed > 0 then return end
	self.elapsed = 3 -- once every 3 seconds, change this to adjust the refresh time (to same as bove)
	----------------
	if ENABLED == true then
		if InCombatLockdown() == 1 then
			if GetPetActionsUsable() == 1 then
			
				local pettarget = UnitName("pettarget")
				
				if pettarget ~= nil then
				
					if CLEAR_SPAM == 0 then
						RaidNotice_AddMessage(RaidBossEmoteFrame, "", ChatTypeInfo["SYSTEM"])
						RaidNotice_AddMessage(RaidBossEmoteFrame, "", ChatTypeInfo["SYSTEM"])
						RaidNotice_AddMessage(RaidBossEmoteFrame, "", ChatTypeInfo["SYSTEM"])
						RaidNotice_AddMessage(RaidBossEmoteFrame, "", ChatTypeInfo["SYSTEM"])
						CLEAR_SPAM = 1
					else
					end
					
				else
					
					RaidNotice_AddMessage(RaidBossEmoteFrame, "", ChatTypeInfo["SYSTEM"])
					RaidNotice_AddMessage(RaidBossEmoteFrame, "", ChatTypeInfo["SYSTEM"])
					RaidNotice_AddMessage(RaidBossEmoteFrame, "", ChatTypeInfo["SYSTEM"])
					RaidNotice_AddMessage(RaidBossEmoteFrame, "Pet is passive", ChatTypeInfo["SYSTEM"])
					CLEAR_SPAM = 0
					
				end

			else
			end
		else
		end
	else
	end
	----------------
end)
----------------------------------------------------------------------------------------------------