SHADERMOD_VERSION = "|cFFFFFFFFv3.16";

DISPLAY_RED = ".55";	
DISPLAY_GREEN = ".55";
DISPLAY_BLUE = ".5"; 

FDISPLAY_RED = ".7";	
FDISPLAY_GREEN = ".1";
FDISPLAY_BLUE = ".1"; 

function SMOnLoad()

	this:RegisterEvent("VARIABLES_LOADED");
	this:RegisterEvent("CHAT_MSG_COMBAT_SELF_HITS");
	this:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE");
	this:RegisterEvent("CHAT_MSG_SPELL_SELF_BUFF");
	this:RegisterEvent("CHAT_MSG_COMBAT_SELF_MISSES");
	this:RegisterEvent("PLAYER_ENTERING_WORLD");
	this:RegisterEvent("PLAYER_REGEN_ENABLED");
	this:RegisterEvent("UNIT_COMBO_POINTS");
	this:RegisterEvent("PLAYER_TARGET_CHANGED");
	this:RegisterEvent("UNIT_HEALTH");
	this:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH");
	this:RegisterEvent("CHAT_MSG_COMBAT_FRIENDLY_DEATH");

	KillingBlow = 0;
	KillingBlowMsg =".";
	CritDmg = 0;
	CritCombo = 0;
	CritComboDmg = 0;
	CritDmgHeal = 0;
	CritComboHeal = 0;
	CritComboHealDmg = 0;
	CurrentSpell = 0;
	CritMsg = ".";

	SMMessageFrame:SetBackdropColor( 1.0, 1.0, 1.0, 0.0 );
	SMMessageFrame:SetBackdropBorderColor( 1.0, 1.0, 1.0, 0.0 );
	SMMessageFrameBackground:SetAlpha(0.0);
	SMMessageFrame:EnableMouse(false);

	SM_OUT = {};
	SM_OUT.EXEC_ANNOUNCED = false;						

	DEFAULT_CHAT_FRAME:AddMessage("|cFF00FFFFSky-|cFF0000FFDexter. |cFF00FF00ShaderMod " .. SHADERMOD_VERSION .. " |cFFFF0000.:Loaded:. |cFFFFFFFF: /sm for options", .2, .0);
	
	SMPlayerRealm = GetCVar("realmName");
	SMPlayerName = UnitName("player");	
	
	UIPanelWindows["ShaderModOptionsFrame"] = {area = "center", pushable = 0};
end

function SMInitialize()
	SlashCmdList["CritCombo"] = SMCommand;
	SLASH_CritCombo1 = "/ShaderMod";
	SLASH_CritCombo2 = "/ShaderM";
	SLASH_CritCombo3 = "/sm"
	
	SMInitializeSMData();
	SMSetFontSizes();
end

function SMSetDefaultOptions()
	SMData[SMPlayerRealm][SMPlayerName].Reset_Combo = true;
	SMData[SMPlayerRealm][SMPlayerName].Announce_Display = false;
	SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits = false;
	SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display = true;
	SMData[SMPlayerRealm][SMPlayerName].Running_Hit_Display = true;
	SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display = true;
	SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display = false;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Rogue = false;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Execute = false;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Yeah = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Oh_Yeah = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Unstoppable = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Killing_Spree = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Dominating = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Ultra_Kill = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Wicked_Sick = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Log_God_Like = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Holy_Shit = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Monster_Kill = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Ludicrous_Kill = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Ownage = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Rogue = false;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Execute = false;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Yeah = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Oh_Yeah = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Unstoppable = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Killing_Spree = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Dominating = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ultra_Kill = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Wicked_Sick = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_God_Like = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Holy_Shit = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Monster_Kill = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ludicrous_Kill = true;
	SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ownage = true;
	SMData[SMPlayerRealm][SMPlayerName].JustifyH_Left = true;													
	SMData[SMPlayerRealm][SMPlayerName].JustifyH_Center = false;
	SMData[SMPlayerRealm][SMPlayerName].JustifyH_Right = false;
	SMData[SMPlayerRealm][SMPlayerName].SMiniMapButton_Visible = true;
	SMData[SMPlayerRealm][SMPlayerName].SMiniMapButton_Locked = false;
	SMData[SMPlayerRealm][SMPlayerName].White_Crits = true;
	SMData[SMPlayerRealm][SMPlayerName].No_White_Normal = false;
	SMData[SMPlayerRealm][SMPlayerName].Heal = false;
	SMData[SMPlayerRealm][SMPlayerName].Merge_Heal_And_Damage_Combos = false;
	SMData[SMPlayerRealm][SMPlayerName]["Channel"] = "Party";
	SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] = "4";
	SMData[SMPlayerRealm][SMPlayerName]["Splash"] = "3";
	SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Display = true;
	SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Sound = true;
	SMData[SMPlayerRealm][SMPlayerName].Display_Killing_Blow = false;
	SMData[SMPlayerRealm][SMPlayerName].Display_Killing_Blow_Reset_Death = true;
	SMData[SMPlayerRealm][SMPlayerName].Display_Killing_Blow_Reset_Bg = true;
end

SMSavedVars = { 
	SMFontSize = 30;
};

function getVar( varName)
	return SMSavedVars[varName];
end

function SMUpdate()
	ChannelBox:SetText(SMData[SMPlayerRealm][SMPlayerName]["Channel"]);
	AnnounceBox:SetText(SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"]);
	SplashBox:SetText(SMData[SMPlayerRealm][SMPlayerName]["Splash"]);
end 

function SM_SetChannel()
	SMData[SMPlayerRealm][SMPlayerName]["Channel"] = this:GetText();
end

function SM_SetAnnounceBox()
	SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] = this:GetText();
end

function SM_SetSplashBox()
	SMData[SMPlayerRealm][SMPlayerName]["Splash"] = this:GetText();
end

function setVar( varName, value)
	SMSavedVars[varName] = value;
end

function SMFontSize_OnValueChanged()
	setVar("SMFontSize", this:GetValue());
	getglobal(this:GetName() .. "Text"):SetText(SM_FONT_SIZE .. " " .. this:GetValue());
	SMSetFontSizes();
end

function SMFontSize_OnShow()
	getglobal(this:GetName().."High"):SetText("32");
	getglobal(this:GetName().."Low"):SetText("8");

	this:SetMinMaxValues(8, 32);
	this:SetValueStep(1);
	this:SetValue(getVar("SMFontSize"));

	getglobal(this:GetName() .. "Text"):SetText(SM_FONT_SIZE .. " " .. this:GetValue());
end

function SMSetFontSizes()
	local font, fontHeight, flags = SMMessageFrame:GetFont();
 	SMMessageFrame:SetFont(font, getVar("SMFontSize"), flags);
end

function SMCommand(msg)
	if (string.lower(msg) == "records") then
		DEFAULT_CHAT_FRAME:AddMessage("[ShaderMod] " .. SHADERMOD_VERSION .. " ", .2, .0);
		DEFAULT_CHAT_FRAME:AddMessage("--- Hits Based Record ---", .65, .65, .6);
		DEFAULT_CHAT_FRAME:AddMessage("*" .. SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritCombo .. "* crits for *" .. SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboDmg .. "* damage. ");
		DEFAULT_CHAT_FRAME:AddMessage("--- Damage Based Record ---", .65, .65, .6);
		DEFAULT_CHAT_FRAME:AddMessage("*" .. SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritCombo .. "* crits for *" .. SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboDmg .. "* damage. ");
		DEFAULT_CHAT_FRAME:AddMessage("--- Healing Combos Based Record ---", .65, .65, .6);
		DEFAULT_CHAT_FRAME:AddMessage("*" .. SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHeal .. "* crits for *" .. SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHealDmg .. "* Total Healing. ");
		DEFAULT_CHAT_FRAME:AddMessage("--- Total Healing Based Record ---", .65, .65, .6);
		DEFAULT_CHAT_FRAME:AddMessage("*" .. SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHeal .. "* crits for *" .. SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHealDmg .. "* Total Healing. ");
		return;
	end
	
	if (string.lower(msg) == "help") then
		SMDisplayHelp();
		return;
	end
	if (string.lower(msg) == "lock") then
		SMMessageFrame.Locked = true;
		SMMessageFrame:SetBackdropColor( 1.0, 1.0, 1.0, 0.0 );
		SMMessageFrame:SetBackdropBorderColor( 1.0, 1.0, 1.0, 0.0 );
		SMMessageFrameBackground:SetAlpha(0.0);
		SMMessageFrame:EnableMouse(false);
		ShaderModMessageFrame.Locked = true;
		ShaderModMessageFrame:SetBackdropColor( 1.0, 1.0, 1.0, 0.0 );
		ShaderModMessageFrame:SetBackdropBorderColor( 1.0, 1.0, 1.0, 0.0 );
		ShaderModMessageFrameBackground:SetAlpha(0.0);
		ShaderModMessageFrame:EnableMouse(false);
		SMKillingBlowFrame.Locked = true;
		SMKillingBlowFrame:SetBackdropColor( 1.0, 1.0, 1.0, 0.0 );
		SMKillingBlowFrame:SetBackdropBorderColor( 1.0, 1.0, 1.0, 0.0 );
		SMKillingBlowFrameBackground:SetAlpha(0.0);
		SMKillingBlowFrame:EnableMouse(false);
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FFFFSky-|cFF0000FFDexter. |cFF00FF00ShaderMod " .. SHADERMOD_VERSION .. " : |cFF00FF00Now |cFFFF0000Locked ", .2, .0);
	  return;
	end
	if (string.lower(msg) == "unlock") then
		SMMessageFrame.Locked = false;
		SMMessageFrame:SetBackdropColor( 1.0, 1.0, 1.0, 1.0 );
		SMMessageFrame:SetBackdropBorderColor( 1.0, 1.0, 1.0, 1.0 );
		SMMessageFrameBackground:SetAlpha(1.0); 
		SMMessageFrame:EnableMouse(true);
		ShaderModMessageFrame.Locked = false;
		ShaderModMessageFrame:SetBackdropColor( 1.0, 1.0, 1.0, 1.0 );
		ShaderModMessageFrame:SetBackdropBorderColor( 1.0, 1.0, 1.0, 1.0 );
		ShaderModMessageFrameBackground:SetAlpha(1.0); 
		ShaderModMessageFrame:EnableMouse(true);
		SMKillingBlowFrame.Locked = false;
		SMKillingBlowFrame:SetBackdropColor( 1.0, 1.0, 1.0, 0.0 );
		SMKillingBlowFrame:SetBackdropBorderColor( 1.0, 1.0, 1.0, 0.0 );
		SMKillingBlowFrameBackground:SetAlpha(1.0);
		SMKillingBlowFrame:EnableMouse(true);
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FFFFSky-|cFF0000FFDexter. |cFF00FF00ShaderMod " .. SHADERMOD_VERSION .. " : |cFF00FF00Now |cFFFF0000Unlocked ", .2, .0);
	  return;
	end
	if (string.lower(msg) == "minimap lock") then
		SMData[SMPlayerRealm][SMPlayerName].SMiniMapButton_Locked = true;
		SMMiniMapButton.Locked = true;
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FFFFSky-|cFF0000FFDexter. |cFF00FF00ShaderMod " .. SHADERMOD_VERSION .. " : MiniMap Button |cFF00FF00Now |cFFFF0000Locked ", .2, .0);
	  return;
	end
	if (string.lower(msg) == "minimap unlock") then
		SMData[SMPlayerRealm][SMPlayerName].SMiniMapButton_Locked = false;
		SMMiniMapButton.Locked = false;
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FFFFSky-|cFF0000FFDexter. |cFF00FF00ShaderMod " .. SHADERMOD_VERSION .. " : MiniMap Button |cFFFF0000Unlocked ", .2, .0);
	  return;
	end
	if (string.lower(msg) == "hide") then
		SMMessageFrame.Visible = false;
		SMMessageFrame:Hide();
		ShaderModMessageFrame.Visible = false;
		ShaderModMessageFrame:Hide();
		SMKillingBlowFrame.Visible = false;
		SMKillingBlowFrame:Hide();
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FFFFSky-|cFF0000FFDexter. |cFF00FF00ShaderMod " .. SHADERMOD_VERSION .. " : |cFF00FF00Now |cFFFF0000Hidden ", .2, .0);
	  return;
	end
	if (string.lower(msg) == "show") then
		SMMessageFrame.Visible = true;
		SMMessageFrame:Show();
		ShaderModMessageFrame.Visible = true;
		ShaderModMessageFrame:Show();
		SMKillingBlowFrame.Visible = true;
		SMKillingBlowFrame:Show();
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FFFFSky-|cFF0000FFDexter. |cFF00FF00ShaderMod " .. SHADERMOD_VERSION .. " : |cFF00FF00Now |cFFFF0000Visible ", .2, .0);
	  return;
	end
	if (string.lower(msg) == "minimap show") then
		SMData[SMPlayerRealm][SMPlayerName].SMiniMapButton_Visible = true;
		SMMiniMapButton:Show();
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FFFFSky-|cFF0000FFDexter. |cFF00FF00ShaderMod " .. SHADERMOD_VERSION .. " : MiniMap Button |cFF00FF00Now |cFFFF0000Visible ", .2, .0);
	  return;
	end
	if (string.lower(msg) == "minimap hide") then
		SMData[SMPlayerRealm][SMPlayerName].SMiniMapButton_Visible = false;
		SMMiniMapButton:Hide();
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FFFFSky-|cFF0000FFDexter. |cFF00FF00ShaderMod " .. SHADERMOD_VERSION .. " : MiniMap Button |cFF00FF00Now |cFFFF0000Hidden ", .2, .0);
	  return;
	end
	
	if (string.lower(msg) == "minimap") then
		DEFAULT_CHAT_FRAME:AddMessage("/SM Minimap Show ", .2, .0);
		DEFAULT_CHAT_FRAME:AddMessage("/SM Minimap Hide", .2, .0);
		DEFAULT_CHAT_FRAME:AddMessage("/SM Minimap Lock", .2, .0);
		DEFAULT_CHAT_FRAME:AddMessage("/SM Minimap Unlock", .2, .0);
	  return;
	end
	
	if (string.lower(msg) == "menu") then
		PlaySound("igMainMenuOpen");
		ShowUIPanel(ShaderModOptionsFrame);
	  return;
	end

	if (string.lower(msg) == "options") then
		PlaySound("igMainMenuOpen");
		ShowUIPanel(ShaderModOptionsFrame);
	  return;
	end
	
	if (string.lower(msg) == "version") then
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FFFFSky-|cFF0000FFDexter. |cFF00FF00ShaderMod |cFFFFFFFFCurrent Version: " .. SHADERMOD_VERSION, .2, .0);
	  return;
	end
	
	if (string.lower(msg) == "killingblow on") then
		SMData[SMPlayerRealm][SMPlayerName].Display_Killing_Blow = true;
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00ShaderMod |cFFFFFFFFKilling Blow Frame = On", .2, .0);
	  return;
	end
	
	if (string.lower(msg) == "killingblow off") then
		SMData[SMPlayerRealm][SMPlayerName].Display_Killing_Blow = false;
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00ShaderMod |cFFFFFFFFKilling Blow Frame = Off", .2, .0);
	  return;
	end
	if (string.lower(msg) == "killingblow") then
		DEFAULT_CHAT_FRAME:AddMessage("/SM KillingBlow On/Off", .2, .0);
		DEFAULT_CHAT_FRAME:AddMessage("/SM KillingBlow Reset BG On/Off", .2, .0);
		DEFAULT_CHAT_FRAME:AddMessage("/SM KillingBlow Reset Death On/Off", .2, .0);
	  return;
	end
	
	if (string.lower(msg) == "killingblow reset") then
		DEFAULT_CHAT_FRAME:AddMessage("/SM KillingBlow Reset BG On/Off", .2, .0);
		DEFAULT_CHAT_FRAME:AddMessage("/SM KillingBlow Reset Death On/Off", .2, .0);
	  return;
	end
	
	if (string.lower(msg) == "killingblow reset bg on") then
		SMData[SMPlayerRealm][SMPlayerName].Display_Killing_Blow_Reset_Bg = true;
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00ShaderMod |cFFFFFFFFKilling Blow : Will now reset when entering Battlegrounds.", .2, .0);
	  return;
	end
	
	if (string.lower(msg) == "killingblow reset bg off") then
		SMData[SMPlayerRealm][SMPlayerName].Display_Killing_Blow_Reset_Bg = true;
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00ShaderMod |cFFFFFFFFKilling Blow : Will not reset when entering Battlegrounds.", .2, .0);
	  return;
	end
	
	if (string.lower(msg) == "killingblow reset death on") then
		SMData[SMPlayerRealm][SMPlayerName].Display_Killing_Blow_Reset_Death = true;
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00ShaderMod |cFFFFFFFFKilling Blow : Will now reset when you die.", .2, .0);
	  return;
	end
	
	if (string.lower(msg) == "killingblow reset death off") then
		SMData[SMPlayerRealm][SMPlayerName].Display_Killing_Blow_Reset_Death = false;
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00ShaderMod |cFFFFFFFFKilling Blow : Will not reset if you die", .2, .0);
	  return;
	end
	
	if (string.lower(msg) == "resetconfig") then
		SMSetDefaultOptions();
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FFFFSky-|cFF0000FFDexter. |cFF00FF00ShaderMod |cFFFFFFFFConfiguration Reset.", .2, .0);
	  return;
	end
	
	SMDisplayHelp();
end


function SMOnEvent(event, arg1)
if (event == "VARIABLES_LOADED") then 
		SMInitialize(); 
	if (SMData[SMPlayerRealm][SMPlayerName].JustifyH_Left == true) then
		SMMessageFrame:SetJustifyH("Left");
	end	
	if (SMData[SMPlayerRealm][SMPlayerName].JustifyH_Center == true) then
		SMMessageFrame:SetJustifyH("Center");
	end
	if (SMData[SMPlayerRealm][SMPlayerName].JustifyH_Right == true) then
		SMMessageFrame:SetJustifyH("Right");
	end
	if (SMData[SMPlayerRealm][SMPlayerName].SMiniMapButton_Visible == false) then
		SMMiniMapButton:Hide();
	end
	if (SMData[SMPlayerRealm][SMPlayerName].SMiniMapButton_Locked == true) then
		SMMiniMapButton.Locked = true;
	end	
end

	SMKillingBlow();

    		if (event == "UNIT_HEALTH") then
			if (UnitClass("player") == MAGE) then
    				local targetHealth = UnitHealth("target");
    
		    		if (targetHealth < 20 and targetHealth > 0) and (not SM_OUT.EXEC_ANNOUNCED) then
		    				if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Execute == true) then
							PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\finishhim.wav");
						end
						if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Execute == true) then
							SMMessageFrame:AddMessage("Execute Range - Finish Him!", DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
						end
		    				SM_OUT.EXEC_ANNOUNCED = true;
		    		elseif (targetHealth <= 0) then
		    				SM_OUT.EXEC_ANNOUNCED = false;
		    		end
				
				if (event == "PLAYER_TARGET_CHANGED") then
						SM_OUT.EXEC_ANNOUNCED = false;
				end
			end
			if ((UnitClass("player") == WARRIOR) or (UnitClass("player") == PALADIN)) then
    				local targetHealth = UnitHealth("target");
    
		    		if (targetHealth < 20 and targetHealth > 0) and (not SM_OUT.EXEC_ANNOUNCED) then
		    				if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Execute == true) then
							PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\finishhim.wav");
						end
						if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Execute == true) then
							SMMessageFrame:AddMessage("Execute Range - Finish Him!", DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
						end
		    				SM_OUT.EXEC_ANNOUNCED = true;
		    		elseif (targetHealth <= 0) then
		    				SM_OUT.EXEC_ANNOUNCED = false;
		    		end
				
				if (event == "PLAYER_TARGET_CHANGED") then
						SM_OUT.EXEC_ANNOUNCED = false;
				end
			end
			if ((UnitClass("player") == ROGUE) or 
				(UnitClass("player") == PRIEST) or 
				(UnitClass("player") == WARLOCK) or
				(UnitClass("player") == HUNTER) or
				(UnitClass("player") == DRUID) or
				(UnitClass("player") == SHAMAN)) then
    				local targetHealth = UnitHealth("target");
    
		    		if (targetHealth < 20 and targetHealth > 0) and (not SM_OUT.EXEC_ANNOUNCED) then
		    				if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Execute == true) then
							PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\finishhim.wav");
						end
						if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Execute == true) then
							SMMessageFrame:AddMessage("Target Low HP - Finish Him!", DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
						end
		    				SM_OUT.EXEC_ANNOUNCED = true;
		    		elseif (targetHealth <= 0) then
		    				SM_OUT.EXEC_ANNOUNCED = false;
		    		end
				
				if (event == "PLAYER_TARGET_CHANGED") then
						SM_OUT.EXEC_ANNOUNCED = false;
				end
			end
				
		end

if (SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits == false) then
	if (event == "CHAT_MSG_SPELL_SELF_DAMAGE") then
		CurrentSpell = 0;
		for spellname, creaturename, damage in string.gmatch(arg1, SPELL_HIT)do
		CurrentSpell = tostring(spellname);
			if ((CurrentSpell == MOONFIRE) or 
			(CurrentSpell == STARFIRE) or 
			(CurrentSpell == WRATH) or 
			(CurrentSpell == SWIPE) or 
			(CurrentSpell == MAUL) or 
			(CurrentSpell == CLAW) or
			(CurrentSpell == MAIM) or
			(CurrentSpell == LACERATE) or
			(CurrentSpell == MANGLE) or 
			(CurrentSpell == SHRED) or 
			(CurrentSpell == RAVAGE) or 
			(CurrentSpell == POUNCE) or 
			(CurrentSpell == FEROCIOUS_BITE) or 
			(CurrentSpell == RAPTOR_STRIKE) or
			(CurrentSpell == STEADY_SHOT) or
			(CurrentSpell == SILENCING_SHOT) or 
			(CurrentSpell == AUTO_SHOT) or 
			(CurrentSpell == ARCANE_SHOT) or 
			(CurrentSpell == MULTI_SHOT) or 
			(CurrentSpell == AIMED_SHOT) or 
			(CurrentSpell == ARCANE_MISSILES) or 
			(CurrentSpell == FIRE_BLAST) or 
			(CurrentSpell == FIREBALL) or
			(CurrentSpell == PYROBLAST) or  
			(CurrentSpell == INCINERATE) or 
			(CurrentSpell == SCORCH) or 
			(CurrentSpell == FROSTBOLT) or 
			(CurrentSpell == ICE_LANCE) or 
			(CurrentSpell == SMITE) or 
			(CurrentSpell == MIND_BLAST) or 
			(CurrentSpell == HOLY_FIRE) or
			(CurrentSpell == SHADOWWORD_DEATH) or 
			(CurrentSpell == BACKSTAB) or 
			(CurrentSpell == SINISTER_STRIKE) or 
			(CurrentSpell == EVISCERATE) or 
			(CurrentSpell == DEADLY_THROW) or
			(CurrentSpell == ENVENOM) or
			(CurrentSpell == SHIV) or
			(CurrentSpell == MUTILATE) or
			(CurrentSpell == AMBUSH) or 
			(CurrentSpell == BLADE_FLURRY) or 
			(CurrentSpell == RIPOSTE) or 
			(CurrentSpell == EARTH_SHOCK) or 
			(CurrentSpell == FLAME_SHOCK) or
			(CurrentSpell == LIGHTNING_BOLT) or 
			(CurrentSpell == CHAIN_LIGHTNING) or 
			(CurrentSpell == FROST_SHOCK) or  
			(CurrentSpell == SEARING_PAIN) or 
			(CurrentSpell == IMMOLATE) or 
			(CurrentSpell == SOUL_FIRE) or 
			(CurrentSpell == CONFLAGRATE) or 
			(CurrentSpell == SHADOWBURN) or 
			(CurrentSpell == SHADOW_BOLT) or 
			(CurrentSpell == HEROIC_STRIKE) or 
			(CurrentSpell == SLAM) or 
			(CurrentSpell == RETALIATION) or 
			(CurrentSpell == EXECUTE) or 
			(CurrentSpell == OVERPOWER) or 
			(CurrentSpell == CLEAVE) or 
			(CurrentSpell == VICTORY_RUSH) or
			(CurrentSpell == RAMPAGE) or
			(CurrentSpell == DEVASTATE) or
			(CurrentSpell == WHIRLWIND) or 
			(CurrentSpell == MORTAL_STRIKE) or 
			(CurrentSpell == SWEEPING_STRIKES) or 
			(CurrentSpell == CRUSADER_STRIKE) or
			(CurrentSpell == AVENGERS_STRIKE) or
			(CurrentSpell == SHIELD_SLAM) or 
			(CurrentSpell == EXORCISM) or
			(CurrentSpell == JUDGEMENT_OF_COMMAND) or
			(CurrentSpell == SEAL_OF_COMMAND) or
			(CurrentSpell == JUDGEMENT_OF_RIGHTEOUSNESS) or
			(CurrentSpell == ANOTHER_SPELL1) or
			(CurrentSpell == ANOTHER_SPELL2) or
			(CurrentSpell == ANOTHER_SPELL3) or
			(CurrentSpell == ANOTHER_SPELL4) or
			(CurrentSpell == HEMORRHAGE) or
			(CurrentSpell == HOLY_SHOCK)) then
				if (GetComboPoints("Player") == 5) then
					if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Rogue == true) then
						PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\finishhim.wav");
					end
					if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Rogue == true) then
						SMMessageFrame:AddMessage("5Combos Points - Finish Him!", DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
					end
				end
				if (CritCombo ~= 0) then
					SMCompare_Combos();
				end
				if ((SMData[SMPlayerRealm][SMPlayerName].Running_Hit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
					SMMessageFrame:AddMessage(" [" .. damage .. "] Damage" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
				end
			end
		end
		for spellname, creaturename, damage in string.gmatch(arg1, SPELL_HIT2)do
		CurrentSpell = tostring(spellname);
			if ((CurrentSpell == MOONFIRE) or 
			(CurrentSpell == STARFIRE) or 
			(CurrentSpell == WRATH) or 
			(CurrentSpell == SWIPE) or 
			(CurrentSpell == MAUL) or 
			(CurrentSpell == CLAW) or
			(CurrentSpell == MAIM) or
			(CurrentSpell == LACERATE) or
			(CurrentSpell == MANGLE) or 
			(CurrentSpell == SHRED) or 
			(CurrentSpell == RAVAGE) or 
			(CurrentSpell == POUNCE) or 
			(CurrentSpell == FEROCIOUS_BITE) or 
			(CurrentSpell == RAPTOR_STRIKE) or
			(CurrentSpell == STEADY_SHOT) or
			(CurrentSpell == SILENCING_SHOT) or 
			(CurrentSpell == AUTO_SHOT) or 
			(CurrentSpell == ARCANE_SHOT) or 
			(CurrentSpell == MULTI_SHOT) or 
			(CurrentSpell == AIMED_SHOT) or 
			(CurrentSpell == ARCANE_MISSILES) or 
			(CurrentSpell == FIRE_BLAST) or 
			(CurrentSpell == FIREBALL) or
			(CurrentSpell == PYROBLAST) or  
			(CurrentSpell == INCINERATE) or 
			(CurrentSpell == SCORCH) or 
			(CurrentSpell == FROSTBOLT) or 
			(CurrentSpell == ICE_LANCE) or 
			(CurrentSpell == SMITE) or 
			(CurrentSpell == MIND_BLAST) or 
			(CurrentSpell == HOLY_FIRE) or
			(CurrentSpell == SHADOWWORD_DEATH) or 
			(CurrentSpell == BACKSTAB) or 
			(CurrentSpell == SINISTER_STRIKE) or 
			(CurrentSpell == EVISCERATE) or 
			(CurrentSpell == DEADLY_THROW) or
			(CurrentSpell == ENVENOM) or
			(CurrentSpell == SHIV) or
			(CurrentSpell == MUTILATE) or
			(CurrentSpell == AMBUSH) or 
			(CurrentSpell == BLADE_FLURRY) or 
			(CurrentSpell == RIPOSTE) or 
			(CurrentSpell == EARTH_SHOCK) or 
			(CurrentSpell == FLAME_SHOCK) or
			(CurrentSpell == LIGHTNING_BOLT) or 
			(CurrentSpell == CHAIN_LIGHTNING) or 
			(CurrentSpell == FROST_SHOCK) or  
			(CurrentSpell == SEARING_PAIN) or 
			(CurrentSpell == IMMOLATE) or 
			(CurrentSpell == SOUL_FIRE) or 
			(CurrentSpell == CONFLAGRATE) or 
			(CurrentSpell == SHADOWBURN) or 
			(CurrentSpell == SHADOW_BOLT) or 
			(CurrentSpell == HEROIC_STRIKE) or 
			(CurrentSpell == SLAM) or 
			(CurrentSpell == RETALIATION) or 
			(CurrentSpell == EXECUTE) or 
			(CurrentSpell == OVERPOWER) or 
			(CurrentSpell == CLEAVE) or 
			(CurrentSpell == VICTORY_RUSH) or
			(CurrentSpell == RAMPAGE) or
			(CurrentSpell == DEVASTATE) or
			(CurrentSpell == WHIRLWIND) or 
			(CurrentSpell == MORTAL_STRIKE) or 
			(CurrentSpell == SWEEPING_STRIKES) or 
			(CurrentSpell == CRUSADER_STRIKE) or
			(CurrentSpell == AVENGERS_STRIKE) or
			(CurrentSpell == SHIELD_SLAM) or 
			(CurrentSpell == EXORCISM) or
			(CurrentSpell == JUDGEMENT_OF_COMMAND) or
			(CurrentSpell == SEAL_OF_COMMAND) or
			(CurrentSpell == JUDGEMENT_OF_RIGHTEOUSNESS) or
			(CurrentSpell == ANOTHER_SPELL1) or
			(CurrentSpell == ANOTHER_SPELL2) or
			(CurrentSpell == ANOTHER_SPELL3) or
			(CurrentSpell == ANOTHER_SPELL4) or
			(CurrentSpell == HEMORRHAGE) or
			(CurrentSpell == HOLY_SHOCK)) then
				if (GetComboPoints("Player") == 5) then
					if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Rogue == true) then
						PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\finishhim.wav");
					end
					if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Rogue == true) then
						SMMessageFrame:AddMessage("5Combos Points - Finish Him!", DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
					end
				end
				if (CritCombo ~= 0) then
					SMCompare_Combos();
				end
				if ((SMData[SMPlayerRealm][SMPlayerName].Running_Hit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
					SMMessageFrame:AddMessage(" [" .. damage .. "] Damage" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
				end
			end
		end
		for spellname, creaturename, damage in string.gmatch(arg1, SPELL_CRIT)do
		CurrentSpell = tostring(spellname);
			if ((CurrentSpell == MOONFIRE) or 
			(CurrentSpell == STARFIRE) or 
			(CurrentSpell == WRATH) or 
			(CurrentSpell == SWIPE) or 
			(CurrentSpell == MAUL) or 
			(CurrentSpell == CLAW) or
			(CurrentSpell == MAIM) or
			(CurrentSpell == LACERATE) or
			(CurrentSpell == MANGLE) or 
			(CurrentSpell == SHRED) or 
			(CurrentSpell == RAVAGE) or 
			(CurrentSpell == POUNCE) or 
			(CurrentSpell == FEROCIOUS_BITE) or 
			(CurrentSpell == RAPTOR_STRIKE) or
			(CurrentSpell == STEADY_SHOT) or
			(CurrentSpell == SILENCING_SHOT) or 
			(CurrentSpell == AUTO_SHOT) or 
			(CurrentSpell == ARCANE_SHOT) or 
			(CurrentSpell == MULTI_SHOT) or 
			(CurrentSpell == AIMED_SHOT) or 
			(CurrentSpell == ARCANE_MISSILES) or 
			(CurrentSpell == FIRE_BLAST) or 
			(CurrentSpell == FIREBALL) or
			(CurrentSpell == PYROBLAST) or  
			(CurrentSpell == INCINERATE) or 
			(CurrentSpell == SCORCH) or 
			(CurrentSpell == FROSTBOLT) or 
			(CurrentSpell == ICE_LANCE) or 
			(CurrentSpell == SMITE) or 
			(CurrentSpell == MIND_BLAST) or 
			(CurrentSpell == HOLY_FIRE) or
			(CurrentSpell == SHADOWWORD_DEATH) or 
			(CurrentSpell == BACKSTAB) or 
			(CurrentSpell == SINISTER_STRIKE) or 
			(CurrentSpell == EVISCERATE) or 
			(CurrentSpell == DEADLY_THROW) or
			(CurrentSpell == ENVENOM) or
			(CurrentSpell == SHIV) or
			(CurrentSpell == MUTILATE) or
			(CurrentSpell == AMBUSH) or 
			(CurrentSpell == BLADE_FLURRY) or 
			(CurrentSpell == RIPOSTE) or 
			(CurrentSpell == EARTH_SHOCK) or 
			(CurrentSpell == FLAME_SHOCK) or
			(CurrentSpell == LIGHTNING_BOLT) or 
			(CurrentSpell == CHAIN_LIGHTNING) or 
			(CurrentSpell == FROST_SHOCK) or  
			(CurrentSpell == SEARING_PAIN) or 
			(CurrentSpell == IMMOLATE) or 
			(CurrentSpell == SOUL_FIRE) or 
			(CurrentSpell == CONFLAGRATE) or 
			(CurrentSpell == SHADOWBURN) or 
			(CurrentSpell == SHADOW_BOLT) or 
			(CurrentSpell == HEROIC_STRIKE) or 
			(CurrentSpell == SLAM) or 
			(CurrentSpell == RETALIATION) or 
			(CurrentSpell == EXECUTE) or 
			(CurrentSpell == OVERPOWER) or 
			(CurrentSpell == CLEAVE) or 
			(CurrentSpell == VICTORY_RUSH) or
			(CurrentSpell == RAMPAGE) or
			(CurrentSpell == DEVASTATE) or
			(CurrentSpell == WHIRLWIND) or 
			(CurrentSpell == MORTAL_STRIKE) or 
			(CurrentSpell == SWEEPING_STRIKES) or 
			(CurrentSpell == CRUSADER_STRIKE) or
			(CurrentSpell == AVENGERS_STRIKE) or
			(CurrentSpell == SHIELD_SLAM) or 
			(CurrentSpell == EXORCISM) or
			(CurrentSpell == JUDGEMENT_OF_COMMAND) or
			(CurrentSpell == SEAL_OF_COMMAND) or
			(CurrentSpell == JUDGEMENT_OF_RIGHTEOUSNESS) or
			(CurrentSpell == ANOTHER_SPELL1) or
			(CurrentSpell == ANOTHER_SPELL2) or
			(CurrentSpell == ANOTHER_SPELL3) or
			(CurrentSpell == ANOTHER_SPELL4) or
			(CurrentSpell == HEMORRHAGE) or
			(CurrentSpell == HOLY_SHOCK)) then
				if (GetComboPoints("Player") == 5) then
					if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Rogue == true) then
						PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\finishhim.wav");
					end
					if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Rogue == true) then
						SMMessageFrame:AddMessage("5Combos Points - Finish Him!", DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
					end
				end
				CritDmg = tonumber(damage);
				LastDmg = tonumber(damage);
				CritCombo = CritCombo + 1;
				CritComboDmg = CritComboDmg + damage;
				if (CritCombo >= 1) then
				SMSoundAndDisplayDamage();
				end
			end
		end
	end
end

if (SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits == true) then
	if (event == "CHAT_MSG_SPELL_SELF_DAMAGE") then
		CurrentSpell = 0;
		for spellname, creaturename, damage in string.gmatch(arg1, SPELL_CRIT)do
		CurrentSpell = tostring(spellname);
			if ((CurrentSpell == MOONFIRE) or 
			(CurrentSpell == STARFIRE) or 
			(CurrentSpell == WRATH) or 
			(CurrentSpell == SWIPE) or 
			(CurrentSpell == MAUL) or 
			(CurrentSpell == CLAW) or
			(CurrentSpell == MAIM) or
			(CurrentSpell == LACERATE) or
			(CurrentSpell == MANGLE) or 
			(CurrentSpell == SHRED) or 
			(CurrentSpell == RAVAGE) or 
			(CurrentSpell == POUNCE) or 
			(CurrentSpell == FEROCIOUS_BITE) or 
			(CurrentSpell == RAPTOR_STRIKE) or
			(CurrentSpell == STEADY_SHOT) or
			(CurrentSpell == SILENCING_SHOT) or 
			(CurrentSpell == AUTO_SHOT) or 
			(CurrentSpell == ARCANE_SHOT) or 
			(CurrentSpell == MULTI_SHOT) or 
			(CurrentSpell == AIMED_SHOT) or 
			(CurrentSpell == ARCANE_MISSILES) or 
			(CurrentSpell == FIRE_BLAST) or 
			(CurrentSpell == FIREBALL) or
			(CurrentSpell == PYROBLAST) or  
			(CurrentSpell == INCINERATE) or 
			(CurrentSpell == SCORCH) or 
			(CurrentSpell == FROSTBOLT) or 
			(CurrentSpell == ICE_LANCE) or 
			(CurrentSpell == SMITE) or 
			(CurrentSpell == MIND_BLAST) or 
			(CurrentSpell == HOLY_FIRE) or
			(CurrentSpell == SHADOWWORD_DEATH) or 
			(CurrentSpell == BACKSTAB) or 
			(CurrentSpell == SINISTER_STRIKE) or 
			(CurrentSpell == EVISCERATE) or 
			(CurrentSpell == DEADLY_THROW) or
			(CurrentSpell == ENVENOM) or
			(CurrentSpell == SHIV) or
			(CurrentSpell == MUTILATE) or
			(CurrentSpell == AMBUSH) or 
			(CurrentSpell == BLADE_FLURRY) or 
			(CurrentSpell == RIPOSTE) or 
			(CurrentSpell == EARTH_SHOCK) or 
			(CurrentSpell == FLAME_SHOCK) or
			(CurrentSpell == LIGHTNING_BOLT) or 
			(CurrentSpell == CHAIN_LIGHTNING) or 
			(CurrentSpell == FROST_SHOCK) or  
			(CurrentSpell == SEARING_PAIN) or 
			(CurrentSpell == IMMOLATE) or 
			(CurrentSpell == SOUL_FIRE) or 
			(CurrentSpell == CONFLAGRATE) or 
			(CurrentSpell == SHADOWBURN) or 
			(CurrentSpell == SHADOW_BOLT) or 
			(CurrentSpell == HEROIC_STRIKE) or 
			(CurrentSpell == SLAM) or 
			(CurrentSpell == RETALIATION) or 
			(CurrentSpell == EXECUTE) or 
			(CurrentSpell == OVERPOWER) or 
			(CurrentSpell == CLEAVE) or 
			(CurrentSpell == VICTORY_RUSH) or
			(CurrentSpell == RAMPAGE) or
			(CurrentSpell == DEVASTATE) or
			(CurrentSpell == WHIRLWIND) or 
			(CurrentSpell == MORTAL_STRIKE) or 
			(CurrentSpell == SWEEPING_STRIKES) or 
			(CurrentSpell == CRUSADER_STRIKE) or
			(CurrentSpell == AVENGERS_STRIKE) or
			(CurrentSpell == SHIELD_SLAM) or 
			(CurrentSpell == EXORCISM) or
			(CurrentSpell == JUDGEMENT_OF_COMMAND) or
			(CurrentSpell == SEAL_OF_COMMAND) or
			(CurrentSpell == JUDGEMENT_OF_RIGHTEOUSNESS) or
			(CurrentSpell == ANOTHER_SPELL1) or
			(CurrentSpell == ANOTHER_SPELL2) or
			(CurrentSpell == ANOTHER_SPELL3) or
			(CurrentSpell == ANOTHER_SPELL4) or
			(CurrentSpell == HEMORRHAGE) or
			(CurrentSpell == HOLY_SHOCK)) then
				if (GetComboPoints("Player") == 5) then
					if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Rogue == true) then
						PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\finishhim.wav");
					end
					if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Rogue == true) then
						SMMessageFrame:AddMessage("5Combos Points - Finish Him!", DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
					end
				end
				CritDmg = tonumber(damage);
				LastDmg = tonumber(damage);
				CritCombo = CritCombo + 1;
				CritComboDmg = CritComboDmg + damage;
				if (CritCombo >= 1) then
				SMSoundAndDisplayDamage();
				end
			end
		end
	end
end

if ((SMData[SMPlayerRealm][SMPlayerName].White_Crits == true) and (SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits == false)) then
	if (event == "CHAT_MSG_COMBAT_SELF_HITS") then
		if (SMData[SMPlayerRealm][SMPlayerName].No_White_Normal == false) then
			for spellname, creaturename, damage in string.gmatch(arg1, SPELL_HIT)do
			CurrentSpell = tostring(spellname);
				if (CurrentSpell == AUTO_SHOT) then
					if (GetComboPoints("Player") == 5) then
						if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Rogue == true) then
							PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\finishhim.wav");
						end
						if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Rogue == true) then
							SMMessageFrame:AddMessage("5Combos Points - Finish Him!", DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
						end
					end
					if (CritCombo ~= 0) then
						SMCompare_Combos();
					end
					if ((SMData[SMPlayerRealm][SMPlayerName].Running_Hit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
						SMMessageFrame:AddMessage(" [" .. damage .. "] Damage" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
					end
				end
			end
		end
		for spellname, creaturename, damage in string.gmatch(arg1, SPELL_CRIT)do
		CurrentSpell = tostring(spellname);
			if (CurrentSpell == AUTO_SHOT) then
				if (GetComboPoints("Player") == 5) then
					if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Rogue == true) then
						PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\finishhim.wav");
					end
					if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Rogue == true) then
						SMMessageFrame:AddMessage("5Combos Points - Finish Him!", DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
					end
				end
				CritDmg = tonumber(damage);
				LastDmg = tonumber(damage);
				CritCombo = CritCombo + 1;
				CritComboDmg = CritComboDmg + damage;
				if (CritCombo >= 1) then
				SMSoundAndDisplayDamage();
				end
			end
		end
	end
end

if ((SMData[SMPlayerRealm][SMPlayerName].White_Crits == true) and (SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits == false)) then
	if (event == "CHAT_MSG_COMBAT_SELF_HITS") then
		if (SMData[SMPlayerRealm][SMPlayerName].No_White_Normal == false) then
			for creaturename, damage in string.gmatch(arg1, COMBAT_HIT)do
			CurrentSpell = tostring(spellname);
				if (GetComboPoints("Player") == 5) then
					if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Rogue == true) then
						PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\finishhim.wav");
					end
					if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Rogue == true) then
						SMMessageFrame:AddMessage("5Combos Points - Finish Him!", DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
					end
				end
				if (CritCombo ~= 0) then
					SMCompare_Combos();
				end
				if ((SMData[SMPlayerRealm][SMPlayerName].Running_Hit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
					SMMessageFrame:AddMessage(" [" .. damage .. "] Damage" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
				end
			end
		end
		for creaturename, damage in string.gmatch(arg1, COMBAT_CRIT)do
		CurrentSpell = tostring(spellname);
			if (GetComboPoints("Player") == 5) then
				if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Rogue == true) then
					PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\finishhim.wav");
				end
				if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Rogue == true) then
					SMMessageFrame:AddMessage("5Combos Points - Finish Him!", DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
				end
			end
			CritDmg = tonumber(damage);
			LastDmg = tonumber(damage);
			CritCombo = CritCombo + 1;
			CritComboDmg = CritComboDmg + damage;
			if (CritCombo >= 1) then
			SMSoundAndDisplayDamage();
			end
		end
	end
end


if ((SMData[SMPlayerRealm][SMPlayerName].White_Crits == true) and (SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits == true)) then
	if (event == "CHAT_MSG_COMBAT_SELF_HITS") then
		for spellname, creaturename, damage in string.gmatch(arg1, SPELL_CRIT)do
		CurrentSpell = tostring(spellname);
			if (CurrentSpell == AUTO_SHOT) then
				if (GetComboPoints("Player") == 5) then
					if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Rogue == true) then
						PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\finishhim.wav");
					end
					if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Rogue == true) then
						SMMessageFrame:AddMessage("5Combos Points - Finish Him!", DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
					end
				end
				CritDmg = tonumber(damage);
				LastDmg = tonumber(damage);
				CritCombo = CritCombo + 1;
				CritComboDmg = CritComboDmg + damage;
				if (CritCombo >= 1) then
				SMSoundAndDisplayDamage();
				end
			end
		end
	end
end

if ((SMData[SMPlayerRealm][SMPlayerName].White_Crits == true) and (SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits == true)) then
	if (event == "CHAT_MSG_COMBAT_SELF_HITS") then
		for creaturename, damage in string.gmatch(arg1, COMBAT_CRIT)do
		CurrentSpell = tostring(spellname);
			if (GetComboPoints("Player") == 5) then
				if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Rogue == true) then
					PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\finishhim.wav");
				end
				if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Rogue == true) then
					SMMessageFrame:AddMessage("5Combos Points - Finish Him!", DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
				end
			end
			CritDmg = tonumber(damage);
			LastDmg = tonumber(damage);
			CritCombo = CritCombo + 1;
			CritComboDmg = CritComboDmg + damage;
			if (CritCombo >= 1) then
			SMSoundAndDisplayDamage();
			end
		end
	end
end

if ((SMData[SMPlayerRealm][SMPlayerName].Heal == true) and (SMData[SMPlayerRealm][SMPlayerName].Merge_Heal_And_Damage_Combos == false)) then
	if (SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits == false) then
		if (event == "CHAT_MSG_SPELL_SELF_BUFF") then
			CurrentSpell = 0;
			for spellname, creaturename, damage in string.gmatch(arg1, HEAL_HIT)do
			CurrentSpell = tostring(spellname);
				if ((CurrentSpell == FLASHHEAL) or 
				(CurrentSpell == LESSERHEAL) or
				(CurrentSpell == DESPERATEPRAYER) or
				(CurrentSpell == HEAL) or
				(CurrentSpell == GREATERHEAL) or
				(CurrentSpell == HOLYLIGHT) or
				(CurrentSpell == LAYONHANDS) or
				(CurrentSpell == FLASHOFLIGHT) or
				(CurrentSpell == HEALINGWAVE) or
				(CurrentSpell == LESSERHEALINGWAVE) or
				(CurrentSpell == CHAINHEAL) or
				(CurrentSpell == HEALINGTOUCH) or
				(CurrentSpell == REGROWTH) or
				(CurrentSpell == MOREHEALINGSPELL) or 
				(CurrentSpell == MOREHEALINGSPELL2) or 
				(CurrentSpell == MOREHEALINGSPELL3) or 
				(CurrentSpell == SWIFTMEND)) then
					if (CritComboHeal ~= 0) then
					SMCompare_Combos();
					end
					if ((SMData[SMPlayerRealm][SMPlayerName].Running_Hit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
					SMMessageFrame:AddMessage(" [" .. damage .. "] Healing" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
					end
				end
			end
			for spellname, creaturename, damage in string.gmatch(arg1, HEAL_CRIT)do
			CurrentSpell = tostring(spellname);
				if ((CurrentSpell == FLASHHEAL) or 
				(CurrentSpell == LESSERHEAL) or
				(CurrentSpell == DESPERATEPRAYER) or
				(CurrentSpell == HEAL) or
				(CurrentSpell == GREATERHEAL) or
				(CurrentSpell == HOLYLIGHT) or
				(CurrentSpell == LAYONHANDS) or
				(CurrentSpell == FLASHOFLIGHT) or
				(CurrentSpell == HEALINGWAVE) or
				(CurrentSpell == LESSERHEALINGWAVE) or
				(CurrentSpell == CHAINHEAL) or
				(CurrentSpell == HEALINGTOUCH) or
				(CurrentSpell == REGROWTH) or
				(CurrentSpell == MOREHEALINGSPELL) or 
				(CurrentSpell == MOREHEALINGSPELL2) or 
				(CurrentSpell == MOREHEALINGSPELL3) or 
				(CurrentSpell == SWIFTMEND)) then
					CritDmgHeal = tonumber(damage);
					LastDmg = tonumber(damage);
					CritComboHeal = CritComboHeal + 1;
					CritComboHealDmg = CritComboHealDmg + damage;
					if (CritComboHeal >= 1) then
					SMSoundAndDisplayHealing();
					end
				end
			end
		end
	end
end

if ((SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits == true) and (SMData[SMPlayerRealm][SMPlayerName].Merge_Heal_And_Damage_Combos == false)) then
	if (event == "CHAT_MSG_SPELL_SELF_BUFF") then
		CurrentSpell = 0;
		for spellname, creaturename, damage in string.gmatch(arg1, HEAL_CRIT)do
		CurrentSpell = tostring(spellname);
			if ((CurrentSpell == FLASHHEAL) or 
			(CurrentSpell == LESSERHEAL) or
			(CurrentSpell == DESPERATEPRAYER) or
			(CurrentSpell == HEAL) or
			(CurrentSpell == GREATERHEAL) or
			(CurrentSpell == HOLYLIGHT) or
			(CurrentSpell == LAYONHANDS) or
			(CurrentSpell == FLASHOFLIGHT) or
			(CurrentSpell == HEALINGWAVE) or
			(CurrentSpell == LESSERHEALINGWAVE) or
			(CurrentSpell == CHAINHEAL) or
			(CurrentSpell == HEALINGTOUCH) or 
			(CurrentSpell == REGROWTH) or
			(CurrentSpell == MOREHEALINGSPELL) or 
			(CurrentSpell == MOREHEALINGSPELL2) or 
			(CurrentSpell == MOREHEALINGSPELL3) or 
			(CurrentSpell == SWIFTMEND)) then
				CritDmgHeal = tonumber(damage);
				LastDmg = tonumber(damage);
				CritComboHeal = CritComboHeal + 1;
				CritComboHealDmg = CritComboHealDmg + damage;
				if (CritComboHeal >= 1) then
				SMSoundAndDisplayHealing();
				end
			end
		end
	end
end

if ((SMData[SMPlayerRealm][SMPlayerName].Heal == true) and (SMData[SMPlayerRealm][SMPlayerName].Merge_Heal_And_Damage_Combos == true)) then
	if (SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits == false) then
		if (event == "CHAT_MSG_SPELL_SELF_BUFF") then
			CurrentSpell = 0;
			for spellname, creaturename, damage in string.gmatch(arg1, HEAL_HIT)do
			CurrentSpell = tostring(spellname);
				if ((CurrentSpell == FLASHHEAL) or 
				(CurrentSpell == LESSERHEAL) or
				(CurrentSpell == DESPERATEPRAYER) or
				(CurrentSpell == HEAL) or
				(CurrentSpell == GREATERHEAL) or
				(CurrentSpell == HOLYLIGHT) or
				(CurrentSpell == LAYONHANDS) or
				(CurrentSpell == FLASHOFLIGHT) or
				(CurrentSpell == HEALINGWAVE) or
				(CurrentSpell == LESSERHEALINGWAVE) or
				(CurrentSpell == CHAINHEAL) or
				(CurrentSpell == HEALINGTOUCH) or 
				(CurrentSpell == REGROWTH) or
				(CurrentSpell == MOREHEALINGSPELL) or 
				(CurrentSpell == MOREHEALINGSPELL2) or 
				(CurrentSpell == MOREHEALINGSPELL3) or 
				(CurrentSpell == SWIFTMEND)) then
					if (CritCombo ~= 0) then
					SMCompare_Combos();
					end
					if ((SMData[SMPlayerRealm][SMPlayerName].Running_Hit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
					SMMessageFrame:AddMessage(" [" .. damage .. "] Healing" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
					end
				end
			end
			for spellname, creaturename, damage in string.gmatch(arg1, HEAL_CRIT)do
			CurrentSpell = tostring(spellname);
				if ((CurrentSpell == FLASHHEAL) or 
				(CurrentSpell == LESSERHEAL) or
				(CurrentSpell == DESPERATEPRAYER) or
				(CurrentSpell == HEAL) or
				(CurrentSpell == GREATERHEAL) or
				(CurrentSpell == HOLYLIGHT) or
				(CurrentSpell == LAYONHANDS) or
				(CurrentSpell == FLASHOFLIGHT) or
				(CurrentSpell == HEALINGWAVE) or
				(CurrentSpell == LESSERHEALINGWAVE) or
				(CurrentSpell == CHAINHEAL) or
				(CurrentSpell == HEALINGTOUCH) or 
				(CurrentSpell == REGROWTH) or
				(CurrentSpell == MOREHEALINGSPELL) or 
				(CurrentSpell == MOREHEALINGSPELL2) or 
				(CurrentSpell == MOREHEALINGSPELL3) or 
				(CurrentSpell == SWIFTMEND)) then
					CritDmg = tonumber(damage);
					LastDmg = tonumber(damage);
					CritCombo = CritCombo + 1;
					CritComboDmg = CritComboDmg + damage;
					if (CritCombo >= 1) then
					SMSoundAndDisplayDamage();
					end
				end
			end
		end
	end
end

if ((SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits == true) and (SMData[SMPlayerRealm][SMPlayerName].Merge_Heal_And_Damage_Combos == true)) then
	if (event == "CHAT_MSG_SPELL_SELF_BUFF") then
		CurrentSpell = 0;
		for spellname, creaturename, damage in string.gmatch(arg1, HEAL_CRIT)do
		CurrentSpell = tostring(spellname);
			if ((CurrentSpell == FLASHHEAL) or 
			(CurrentSpell == LESSERHEAL) or
			(CurrentSpell == DESPERATEPRAYER) or
			(CurrentSpell == HEAL) or
			(CurrentSpell == GREATERHEAL) or
			(CurrentSpell == HOLYLIGHT) or
			(CurrentSpell == LAYONHANDS) or
			(CurrentSpell == FLASHOFLIGHT) or
			(CurrentSpell == HEALINGWAVE) or
			(CurrentSpell == LESSERHEALINGWAVE) or
			(CurrentSpell == CHAINHEAL) or
			(CurrentSpell == HEALINGTOUCH) or
			(CurrentSpell == REGROWTH) or
			(CurrentSpell == MOREHEALINGSPELL) or 
			(CurrentSpell == MOREHEALINGSPELL2) or 
			(CurrentSpell == MOREHEALINGSPELL3) or 
			(CurrentSpell == SWIFTMEND)) then
				CritDmg = tonumber(damage);
				LastDmg = tonumber(damage);
				CritCombo = CritCombo + 1;
				CritComboDmg = CritComboDmg + damage;
				if (CritCombo >= 1) then
				SMSoundAndDisplayDamage();
				end
			end
		end
	end
end

if ((SMData[SMPlayerRealm][SMPlayerName].Heal == true) and (SMData[SMPlayerRealm][SMPlayerName].Merge_Heal_And_Damage_Combos == false)) then
	if (SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits == false) then
		if (event == "CHAT_MSG_SPELL_SELF_BUFF") then
			CurrentSpell = 0;
			for spellname, damage in string.gmatch(arg1, HEAL_HIT_SELF)do
			CurrentSpell = tostring(spellname);
				if ((CurrentSpell == FLASHHEAL) or 
				(CurrentSpell == LESSERHEAL) or
				(CurrentSpell == DESPERATEPRAYER) or
				(CurrentSpell == HEAL) or
				(CurrentSpell == GREATERHEAL) or
				(CurrentSpell == HOLYLIGHT) or
				(CurrentSpell == LAYONHANDS) or
				(CurrentSpell == FLASHOFLIGHT) or
				(CurrentSpell == HEALINGWAVE) or
				(CurrentSpell == LESSERHEALINGWAVE) or
				(CurrentSpell == CHAINHEAL) or
				(CurrentSpell == HEALINGTOUCH) or
				(CurrentSpell == REGROWTH) or
				(CurrentSpell == MOREHEALINGSPELL) or 
				(CurrentSpell == MOREHEALINGSPELL2) or 
				(CurrentSpell == MOREHEALINGSPELL3) or 
				(CurrentSpell == SWIFTMEND)) then
					if (CritComboHeal ~= 0) then
					SMCompare_Combos();
					end
					if ((SMData[SMPlayerRealm][SMPlayerName].Running_Hit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
					SMMessageFrame:AddMessage(" [" .. damage .. "] Healing" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
					end
				end
			end
			for spellname, damage in string.gmatch(arg1, HEAL_CRIT_SELF)do
			CurrentSpell = tostring(spellname);
				if ((CurrentSpell == FLASHHEAL) or 
				(CurrentSpell == LESSERHEAL) or
				(CurrentSpell == DESPERATEPRAYER) or
				(CurrentSpell == HEAL) or
				(CurrentSpell == GREATERHEAL) or
				(CurrentSpell == HOLYLIGHT) or
				(CurrentSpell == LAYONHANDS) or
				(CurrentSpell == FLASHOFLIGHT) or
				(CurrentSpell == HEALINGWAVE) or
				(CurrentSpell == LESSERHEALINGWAVE) or
				(CurrentSpell == CHAINHEAL) or
				(CurrentSpell == HEALINGTOUCH) or
				(CurrentSpell == REGROWTH) or
				(CurrentSpell == MOREHEALINGSPELL) or 
				(CurrentSpell == MOREHEALINGSPELL2) or 
				(CurrentSpell == MOREHEALINGSPELL3) or 
				(CurrentSpell == SWIFTMEND)) then
					CritDmgHeal = tonumber(damage);
					LastDmg = tonumber(damage);
					CritComboHeal = CritComboHeal + 1;
					CritComboHealDmg = CritComboHealDmg + damage;
					if (CritComboHeal >= 1) then
					SMSoundAndDisplayHealing();
					end
				end
			end
		end
	end
end

if ((SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits == true) and (SMData[SMPlayerRealm][SMPlayerName].Merge_Heal_And_Damage_Combos == false)) then
	if (event == "CHAT_MSG_SPELL_SELF_BUFF") then
		CurrentSpell = 0;
		for spellname, damage in string.gmatch(arg1, HEAL_CRIT_SELF)do
		CurrentSpell = tostring(spellname);
			if ((CurrentSpell == FLASHHEAL) or 
			(CurrentSpell == LESSERHEAL) or
			(CurrentSpell == DESPERATEPRAYER) or
			(CurrentSpell == HEAL) or
			(CurrentSpell == GREATERHEAL) or
			(CurrentSpell == HOLYLIGHT) or
			(CurrentSpell == LAYONHANDS) or
			(CurrentSpell == FLASHOFLIGHT) or
			(CurrentSpell == HEALINGWAVE) or
			(CurrentSpell == LESSERHEALINGWAVE) or
			(CurrentSpell == CHAINHEAL) or
			(CurrentSpell == HEALINGTOUCH) or 
			(CurrentSpell == REGROWTH) or
			(CurrentSpell == MOREHEALINGSPELL) or 
			(CurrentSpell == MOREHEALINGSPELL2) or 
			(CurrentSpell == MOREHEALINGSPELL3) or 
			(CurrentSpell == SWIFTMEND)) then
				CritDmgHeal = tonumber(damage);
				LastDmg = tonumber(damage);
				CritComboHeal = CritComboHeal + 1;
				CritComboHealDmg = CritComboHealDmg + damage;
				if (CritComboHeal >= 1) then
				SMSoundAndDisplayHealing();
				end
			end
		end
	end
end

if ((SMData[SMPlayerRealm][SMPlayerName].Heal == true) and (SMData[SMPlayerRealm][SMPlayerName].Merge_Heal_And_Damage_Combos == true)) then
	if (SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits == false) then
		if (event == "CHAT_MSG_SPELL_SELF_BUFF") then
			CurrentSpell = 0;
			for spellname, damage in string.gmatch(arg1, HEAL_HIT_SELF)do
			CurrentSpell = tostring(spellname);
				if ((CurrentSpell == FLASHHEAL) or 
				(CurrentSpell == LESSERHEAL) or
				(CurrentSpell == DESPERATEPRAYER) or
				(CurrentSpell == HEAL) or
				(CurrentSpell == GREATERHEAL) or
				(CurrentSpell == HOLYLIGHT) or
				(CurrentSpell == LAYONHANDS) or
				(CurrentSpell == FLASHOFLIGHT) or
				(CurrentSpell == HEALINGWAVE) or
				(CurrentSpell == LESSERHEALINGWAVE) or
				(CurrentSpell == CHAINHEAL) or
				(CurrentSpell == HEALINGTOUCH) or 
				(CurrentSpell == REGROWTH) or
				(CurrentSpell == MOREHEALINGSPELL) or 
				(CurrentSpell == MOREHEALINGSPELL2) or 
				(CurrentSpell == MOREHEALINGSPELL3) or 
				(CurrentSpell == SWIFTMEND)) then
					if (CritCombo ~= 0) then
					SMCompare_Combos();
					end
					if ((SMData[SMPlayerRealm][SMPlayerName].Running_Hit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
					SMMessageFrame:AddMessage(" [" .. damage .. "] Healing" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
					end
				end
			end
			for spellname, damage in string.gmatch(arg1, HEAL_CRIT_SELF)do
			CurrentSpell = tostring(spellname);
				if ((CurrentSpell == FLASHHEAL) or 
				(CurrentSpell == LESSERHEAL) or
				(CurrentSpell == DESPERATEPRAYER) or
				(CurrentSpell == HEAL) or
				(CurrentSpell == GREATERHEAL) or
				(CurrentSpell == HOLYLIGHT) or
				(CurrentSpell == LAYONHANDS) or
				(CurrentSpell == FLASHOFLIGHT) or
				(CurrentSpell == HEALINGWAVE) or
				(CurrentSpell == LESSERHEALINGWAVE) or
				(CurrentSpell == CHAINHEAL) or
				(CurrentSpell == HEALINGTOUCH) or 
				(CurrentSpell == REGROWTH) or
				(CurrentSpell == MOREHEALINGSPELL) or 
				(CurrentSpell == MOREHEALINGSPELL2) or 
				(CurrentSpell == MOREHEALINGSPELL3) or 
				(CurrentSpell == SWIFTMEND)) then
					CritDmg = tonumber(damage);
					LastDmg = tonumber(damage);
					CritCombo = CritCombo + 1;
					CritComboDmg = CritComboDmg + damage;
					if (CritCombo >= 1) then
					SMSoundAndDisplayDamage();
					end
				end
			end
		end
	end
end

if ((SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits == true) and (SMData[SMPlayerRealm][SMPlayerName].Merge_Heal_And_Damage_Combos == true)) then
	if (event == "CHAT_MSG_SPELL_SELF_BUFF") then
		CurrentSpell = 0;
		for spellname, damage in string.gmatch(arg1, HEAL_CRIT_SELF)do
		CurrentSpell = tostring(spellname);
			if ((CurrentSpell == FLASHHEAL) or 
			(CurrentSpell == LESSERHEAL) or
			(CurrentSpell == DESPERATEPRAYER) or
			(CurrentSpell == HEAL) or
			(CurrentSpell == GREATERHEAL) or
			(CurrentSpell == HOLYLIGHT) or
			(CurrentSpell == LAYONHANDS) or
			(CurrentSpell == FLASHOFLIGHT) or
			(CurrentSpell == HEALINGWAVE) or
			(CurrentSpell == LESSERHEALINGWAVE) or
			(CurrentSpell == CHAINHEAL) or
			(CurrentSpell == HEALINGTOUCH) or 
			(CurrentSpell == REGROWTH) or
			(CurrentSpell == MOREHEALINGSPELL) or 
			(CurrentSpell == MOREHEALINGSPELL2) or 
			(CurrentSpell == MOREHEALINGSPELL3) or 
			(CurrentSpell == SWIFTMEND)) then
				CritDmg = tonumber(damage);
				LastDmg = tonumber(damage);
				CritCombo = CritCombo + 1;
				CritComboDmg = CritComboDmg + damage;
				if (CritCombo >= 1) then
				SMSoundAndDisplayDamage();
				end	
			end
		end
	end
end

	
	if (event == "PLAYER_REGEN_ENABLED") then
		if (SMData[SMPlayerRealm][SMPlayerName].Reset_Combo == true and CritCombo ~= 0) then
			SMCompare_Combos();
		end
		if (SMData[SMPlayerRealm][SMPlayerName].Reset_Combo == true and CritComboHeal ~= 0) then
			SMCompare_Combos();
		end
	end

end

function SMMiniMap()
	if arg1=="LeftButton" then
		CritCombo = 0;
		CritComboDmg = 0;
		CritComboHeal = 0;
		CritComboHealDmg = 0;
		KillingBlow = 0;
		DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00ShaderMod " .. SHADERMOD_VERSION .. " |cFFFFFFFF: Combos Reset.", .2, .0);
			elseif arg1=="RightButton" then
			ShowUIPanel(ShaderModOptionsFrame);
	end
end

function SMSoundAndDisplayDamage()
	if (CritCombo > 0 and CritCombo < 2) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Yeah == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\yeah.wav");
		end
		CritMsg = "Yeah!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Yeah == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo .. " [" .. CritComboDmg .. "] Total Damage (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end	
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritCombo > 1 and CritCombo < 3) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Oh_Yeah == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\ohyeah.wav");
		end
		CritMsg = "Oh Yeah!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Oh_Yeah == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo .. " [" .. CritComboDmg .. "] Total Damage (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end	
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritCombo > 2 and CritCombo < 4) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Unstoppable == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\unstoppable.wav");
		end
		CritMsg = "Unstoppable!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Unstoppable == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo .. " [" .. CritComboDmg .. "] Total Damage (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end	
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritCombo > 3 and CritCombo < 5) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Killing_Spree == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\killer.wav");
		end
		CritMsg = "Killing Spree!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Killing_Spree == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo .. " [" .. CritComboDmg .. "] Total Damage (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end	
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritCombo > 4 and CritCombo < 6) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Dominating == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\dominating.wav");
		end
		CritMsg = "Dominating!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Dominating == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo .. " [" .. CritComboDmg .. "] Total Damage (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end	
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritCombo > 5 and CritCombo < 7) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ultra_Kill == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\ultrakill.wav");
		end
		CritMsg = "Ultra Kill!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Ultra_Kill == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo .. " [" .. CritComboDmg .. "] Total Damage (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end	
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritCombo > 6 and CritCombo < 8) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Wicked_Sick == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\wickedsick.wav");
		end
		CritMsg = "Wicked Sick!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Wicked_Sick == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo .. " [" .. CritComboDmg .. "] Total Damage (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end	
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritCombo > 7 and CritCombo < 10) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_God_Like == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\godlike.wav");
		end
		CritMsg = "God Like!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_God_Like == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo .. " [" .. CritComboDmg .. "] Total Damage (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end	
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritCombo > 9 and CritCombo < 15) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Holy_Shit == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\holyshit.wav");
		end
		CritMsg = "Holy Shit!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Holy_Shit == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo .. " [" .. CritComboDmg .. "] Total Damage (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end	
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritCombo > 14 and CritCombo < 20) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Monster_Kill == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\monsterkill.wav");
		end
		CritMsg = "Mm-mmm-Monster Kill!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Monster_Kill == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo .. " [" .. CritComboDmg .. "] Total Damage (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end	
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritCombo > 19 and CritCombo < 22) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ludicrous_Kill == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\ludicrouskill.wav");
		end
		CritMsg = "Lu-lu-lu-lu-ludicrous kill!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Ludicrous_Kill == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo .. " [" .. CritComboDmg .. "] Total Damage (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end	
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritCombo > 21) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ownage == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\ownage.wav");
		end
		CritMsg = "Ownage!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Ownage == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo .. " [" .. CritComboDmg .. "] Total Damage (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end	
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsg .. " x" .. CritCombo, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
end

function SMSoundAndDisplayHealing()
	if (CritComboHeal > 0 and CritComboHeal < 2) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Yeah == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\yeah.wav");
		end
		CritMsgHeal = "Yeah!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Yeah == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal .. " [" .. CritComboHealDmg .. "] Total Healing (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritComboHeal > 1 and CritComboHeal < 3) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Oh_Yeah == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\ohyeah.wav");
		end
		CritMsgHeal = "Oh Yeah!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Oh_Yeah == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal .. " [" .. CritComboHealDmg .. "] Total Healing (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritComboHeal > 2 and CritComboHeal < 4) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Unstoppable == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\unstoppable.wav");
		end
		CritMsgHeal = "Unstoppable!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Unstoppable == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal .. " [" .. CritComboHealDmg .. "] Total Healing (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritComboHeal > 3 and CritComboHeal < 5) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Killing_Spree == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\killer.wav");
		end
		CritMsgHeal = "Killing Spree!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Killing_Spree == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal .. " [" .. CritComboHealDmg .. "] Total Healing (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritComboHeal > 4 and CritComboHeal < 6) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Dominating == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\dominating.wav");
		end
		CritMsgHeal = "Dominating!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Dominating == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal .. " [" .. CritComboHealDmg .. "] Total Healing (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritComboHeal > 5 and CritComboHeal < 7) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ultra_Kill == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\ultrakill.wav");
		end
		CritMsgHeal = "Ultra Kill!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Ultra_Kill == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal .. " [" .. CritComboHealDmg .. "] Total Healing (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritComboHeal > 6 and CritComboHeal < 8) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Wicked_Sick == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\wickedsick.wav");
		end
		CritMsgHeal = "Wicked Sick!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Wicked_Sick == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal .. " [" .. CritComboHealDmg .. "] Total Healing (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritComboHeal > 7 and CritComboHeal < 10) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_God_Like == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\godlike.wav");
		end
		CritMsgHeal = "God Like!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_God_Like == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal .. " [" .. CritComboHealDmg .. "] Total Healing (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritComboHeal > 9 and CritComboHeal < 15) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Holy_Shit == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\holyshit.wav");
		end
		CritMsgHeal = "Holy Shit!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Holy_Shit == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal .. " [" .. CritComboHealDmg .. "] Total Healing (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritComboHeal > 14 and CritComboHeal < 20) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Monster_Kill == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\monsterkill.wav");
		end
		CritMsgHeal = "Mm-mmm-Monster Kill!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Monster_Kill == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal .. " [" .. CritComboHealDmg .. "] Total Healing (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritComboHeal > 19 and CritComboHeal < 22) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ludicrous_Kill == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\ludicrouskill.wav");
		end
		CritMsgHeal = "Lu-lu-lu-lu-ludicrous kill!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Ludicrous_Kill == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal .. " [" .. CritComboHealDmg .. "] Total Healing (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
	if (CritComboHeal > 21) then
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ownage == true) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\ownage.wav");
		end
		CritMsgHeal = "Ownage!";
		if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Ownage == true) then
			if ((SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display == true)) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal .. " [" .. CritComboHealDmg .. "] Total Healing (+" .. LastDmg .. ")" , DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
			if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display == true) then
				SMMessageFrame:AddMessage(CritMsgHeal .. " x" .. CritComboHeal, DISPLAY_RED, DISPLAY_GREEN, DISPLAY_BLUE, 1, 3);
			end
		end
	end
end


function SMCompare_Combos()
	extra_crits_toggle = 0;
	if (CritCombo >= SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritCombo and CritComboDmg >= SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboDmg) then
		SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritCombo = CritCombo;
		SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboDmg = CritComboDmg;
		SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritCombo = CritCombo;
		SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboDmg = CritComboDmg;
	else
		if (CritCombo >= SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritCombo) then
			if (CritCombo == SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritCombo) then
				if (CritComboDmg > SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboDmg) then
					SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritCombo = CritCombo;
					SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboDmg = CritComboDmg;
				end
			end
			if (CritCombo > SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritCombo) then
				SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritCombo = CritCombo;
				SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboDmg = CritComboDmg;
			end
		end
		
		if (CritComboDmg >= SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboDmg) then
			if (CritComboDmg == SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboDmg) then
				if (CritCombo > SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritCombo) then
					SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritCombo = CritCombo;
					SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboDmg = CritComboDmg;
				end
			end
			if (CritComboDmg > SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboDmg) then
				SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritCombo = CritCombo;
				SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboDmg = CritComboDmg;
			end
		end
	end

	if (CritComboHeal >= SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHeal and CritComboHealDmg >= SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHealDmg) then
		SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHeal = CritComboHeal;
		SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHealDmg = CritComboHealDmg;
		SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHeal = CritComboHeal;
		SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHealDmg = CritComboHealDmg;
	else
		if (CritComboHeal >= SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHeal) then
			if (CritComboHeal == SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHeal) then
				if (CritComboHealDmg > SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHealDmg) then
					SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHeal = CritComboHeal;
					SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHealDmg = CritComboHealDmg;
				end
			end
			if (CritComboHeal > SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHeal) then
				SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHeal = CritComboHeal;
				SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHealDmg = CritComboHealDmg;
			end
		end
		
		if (CritComboHealDmg >= SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHealDmg) then
			if (CritComboHealDmg == SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHealDmg) then
				if (CritComboHeal > SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHeal) then
					SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHeal = CritComboHeal;
					SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHealDmg = CritComboHealDmg;
				end
			end
			if (CritComboHealDmg > SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHealDmg) then
				SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHeal = CritComboHeal;
				SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHealDmg = CritComboHealDmg;
			end
		end
	end
	
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "0") then
	Splash = 0
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "1") then
	Splash = 1
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "2") then
	Splash = 2
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "3") then
	Splash = 3
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "4") then
	Splash = 4
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "5") then
	Splash = 5
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "6") then
	Splash = 6
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "7") then
	Splash = 7
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "8") then
	Splash = 8
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "9") then
	Splash = 9
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "10") then
	Splash = 10
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "11") then
	Splash = 11
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "12") then
	Splash = 12
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "13") then
	Splash = 13
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "14") then
	Splash = 14
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "15") then
	Splash = 15
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "16") then
	Splash = 16
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "17") then
	Splash = 17
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "18") then
	Splash = 18
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "19") then
	Splash = 19
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "20") then
	Splash = 20
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "21") then
	Splash = 21
end
if (SMData[SMPlayerRealm][SMPlayerName]["Splash"] == "22") then
	Splash = 22
end

if not(Splash > 1) then
	if ((CritCombo > 0 and CritCombo < 2) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Display == true)) then
		if ((SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Yeah == true) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Sound == true)) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\yeah.wav");
		end
		ShaderModMessageFrame:AddMessage("Damage: " .. CritComboDmg, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Combo: " .. CritCombo, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Yeah!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
end
if not(Splash > 2) then
	if ((CritCombo > 1 and CritCombo < 3) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Display == true)) then
		if ((SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Oh_Yeah == true) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Sound == true)) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\ohyeah.wav");
		end
		ShaderModMessageFrame:AddMessage("Damage: " .. CritComboDmg, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Combo: " .. CritCombo, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Oh Yeah!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
end
if not(Splash > 3) then
	if ((CritCombo > 2 and CritCombo < 4) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Display == true)) then
		if ((SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Unstoppable == true) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Sound == true)) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\unstoppable.wav");
		end
		ShaderModMessageFrame:AddMessage("Damage: " .. CritComboDmg, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Combo: " .. CritCombo, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Unstoppable!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
end
if not(Splash > 4) then
	if ((CritCombo > 3 and CritCombo < 5) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Display == true)) then
		if ((SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Killing_Spree == true) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Sound == true)) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\killer.wav");
		end
		ShaderModMessageFrame:AddMessage("Damage: " .. CritComboDmg, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Combo: " .. CritCombo, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Killing Spree!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
end
if not(Splash > 5) then
	if ((CritCombo > 4 and CritCombo < 6) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Display == true)) then
		if ((SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Dominating == true) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Sound == true)) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\dominating.wav");
		end
		ShaderModMessageFrame:AddMessage("Damage: " .. CritComboDmg, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Combo: " .. CritCombo, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Dominating!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
end
if not(Splash > 6) then
	if ((CritCombo > 5 and CritCombo < 7) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Display == true)) then
		if ((SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ultra_Kill == true) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Sound == true)) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\ultrakill.wav");
		end
		ShaderModMessageFrame:AddMessage("Damage: " .. CritComboDmg, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Combo: " .. CritCombo, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Ultra Kill!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
end
if not(Splash > 7) then
	if ((CritCombo > 6 and CritCombo < 8) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Display == true)) then
		if ((SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Wicked_Sick == true) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Sound == true)) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\wickedsick.wav");
		end
		ShaderModMessageFrame:AddMessage("Damage: " .. CritComboDmg, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Combo: " .. CritCombo, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Wicked Sick!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
end
if not(Splash > 8) then
	if ((CritCombo > 7 and CritCombo < 10) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Display == true)) then
		if ((SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_God_Like == true) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Sound == true)) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\godlike.wav");
		end
		ShaderModMessageFrame:AddMessage("Damage: " .. CritComboDmg, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Combo: " .. CritCombo, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("God Like!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
end
if not(Splash > 10) then
	if ((CritCombo > 9 and CritCombo < 15) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Display == true)) then
		if ((SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Holy_Shit == true) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Sound == true)) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\holyshit.wav");
		end
		ShaderModMessageFrame:AddMessage("Damage: " .. CritComboDmg, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Combo: " .. CritCombo, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Holy Shit!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
end
if not(Splash > 15) then
	if ((CritCombo > 14 and CritCombo < 20) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Display == true)) then
		if ((SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Monster_Kill == true) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Sound == true)) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\monsterkill.wav");
		end
		ShaderModMessageFrame:AddMessage("Damage: " .. CritComboDmg, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Combo: " .. CritCombo, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Mm-Mmm-Monster Kill!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
end
if not(Splash > 20) then
	if ((CritCombo > 19 and CritCombo < 22) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Display == true)) then
		if ((SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ludicrous_Kill == true) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Sound == true)) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\LudicrousKill.wav");
		end
		ShaderModMessageFrame:AddMessage("Damage: " .. CritComboDmg, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Combo: " .. CritCombo, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Lu-Lu-Lu-Ludicrous Kill!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
end
if not(Splash > 21) then
	if ((CritCombo > 21) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Display == true)) then
		if ((SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ownage == true) and (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Sound == true)) then
			PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\Ownage.wav");
		end
		ShaderModMessageFrame:AddMessage("Damage: " .. CritComboDmg, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Combo: " .. CritCombo, 1, 1, 1, 1, 3);
		ShaderModMessageFrame:AddMessage("Ownnnaaaaaggge!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
end
	
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "0") then
	Annonce = 0
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "1") then
	Annonce = 1
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "2") then
	Annonce = 2
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "3") then
	Annonce = 3
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "4") then
	Annonce = 4
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "5") then
	Annonce = 5
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "6") then
	Annonce = 6
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "7") then
	Annonce = 7
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "8") then
	Annonce = 8
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "9") then
	Annonce = 9
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "10") then
	Annonce = 10
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "11") then
	Annonce = 11
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "12") then
	Annonce = 12
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "13") then
	Annonce = 13
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "14") then
	Annonce = 14
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "15") then
	Annonce = 15
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "16") then
	Annonce = 16
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "17") then
	Annonce = 17
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "18") then
	Annonce = 18
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "19") then
	Annonce = 19
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "20") then
	Annonce = 20
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "21") then
	Annonce = 21
end
if (SMData[SMPlayerRealm][SMPlayerName]["AnnounceBox"] == "22") then
	Annonce = 22
end

	
if ((SMData[SMPlayerRealm][SMPlayerName].Announce_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Heal == false)) then
	Channel = GetChannelName(SMData[SMPlayerRealm][SMPlayerName]["Channel"]);
	if ((CritCombo > 21)) then
		if not(Annonce > 21) then
		SendChatMessage("Ownage!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
		end
	else
		if ((CritCombo > 19 and CritCombo < 22)) then
			if not(Annonce > 21) then
			SendChatMessage("Lu-lu-lu-lu-ludicrous Kill!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
			end
		else
			if ((CritCombo > 14 and CritCombo < 19)) then
				if not(Annonce > 15) then
				SendChatMessage("Mm-mmm-Monster Kill!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
				end
		     	else
			   	 if ((CritCombo > 9 and CritCombo < 15)) then
					if not(Annonce > 10) then	
					SendChatMessage("Holy Shit!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
					end
			 	else
					if ((CritCombo > 7 and CritCombo < 10)) then
						if not(Annonce > 8) then
						SendChatMessage("God Like!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel); 
						end
					else
						if ((CritCombo > 6 and CritCombo < 8)) then
							if not(Annonce > 7) then
							SendChatMessage("Wicked Sick!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel); 
							end
						else
							if ((CritCombo > 5 and CritCombo < 7)) then 
								if not(Annonce > 6) then
								SendChatMessage("Ultra Kill!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
								end 
							else
								if ((CritCombo > 4 and CritCombo < 6)) then 
									if not(Annonce > 5) then
									SendChatMessage("Dominating!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
									end
								else
									if ((CritCombo > 3 and CritCombo < 5)) then 
										if not(Annonce > 4)then
										SendChatMessage("Killing Spree!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
										end
									else
										if ((CritCombo > 2 and CritCombo < 4)) then
											if not(Annonce > 3) then 
											SendChatMessage("Unstoppable!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
											end
										else
											if ((CritCombo > 1 and CritCombo < 3)) then
												if not(Annonce > 2) then 
												SendChatMessage("Oh Yeah!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
												end	
											else
												if ((CritCombo > 0 and CritCombo < 2)) then 
													if not(Annonce > 1) then
													SendChatMessage("Yeah!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
													end
												end
											end
										end
									end
								end
							end
						end
					end
				end
			end
		end
	end
 end

if ((SMData[SMPlayerRealm][SMPlayerName].Announce_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Heal == true)) then
	if (SMData[SMPlayerRealm][SMPlayerName].Merge_Heal_And_Damage_Combos == true) then
	Channel = GetChannelName(SMData[SMPlayerRealm][SMPlayerName]["Channel"]);
	if ((CritCombo > 21)) then
		if not(Annonce > 21) then
		SendChatMessage("Ownage!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
		end
	else
		if ((CritCombo > 19 and CritCombo < 22)) then
			if not(Annonce > 21) then
			SendChatMessage("Lu-lu-lu-lu-ludicrous Kill!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
			end
		else
			if ((CritCombo > 14 and CritCombo < 19)) then
				if not(Annonce > 15) then
				SendChatMessage("Mm-mmm-Monster Kill!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
				end
		     	else
			   	 if ((CritCombo > 9 and CritCombo < 15)) then
					if not(Annonce > 10) then	
					SendChatMessage("Holy Shit!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
					end
			 	else
					if ((CritCombo > 7 and CritCombo < 10)) then
						if not(Annonce > 8) then
						SendChatMessage("God Like!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel); 
						end
					else
						if ((CritCombo > 6 and CritCombo < 8)) then
							if not(Annonce > 7) then
							SendChatMessage("Wicked Sick!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel); 
							end
						else
							if ((CritCombo > 5 and CritCombo < 7)) then 
								if not(Annonce > 6) then
								SendChatMessage("Ultra Kill!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
								end 
							else
								if ((CritCombo > 4 and CritCombo < 6)) then 
									if not(Annonce > 5) then
									SendChatMessage("Dominating!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
									end
								else
									if ((CritCombo > 3 and CritCombo < 5)) then 
										if not(Annonce > 4)then
										SendChatMessage("Killing Spree!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
										end
									else
										if ((CritCombo > 2 and CritCombo < 4)) then
											if not(Annonce > 3) then 
											SendChatMessage("Unstoppable!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
											end
										else
											if ((CritCombo > 1 and CritCombo < 3)) then
												if not(Annonce > 2) then 
												SendChatMessage("Oh Yeah!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
												end	
											else
												if ((CritCombo > 0 and CritCombo < 2)) then 
													if not(Annonce > 1) then
													SendChatMessage("Yeah!  *" .. CritCombo .. "* crits for *" .. CritComboDmg .. "* total damage! ", "CHANNEL", nil, Channel);
													end
												end
											end
										end
									end
								end
							end
						end
					end
				end
			end
		end
	end
	end
 end

if ((SMData[SMPlayerRealm][SMPlayerName].Announce_Display == true) and (SMData[SMPlayerRealm][SMPlayerName].Heal == true)) then
	if (SMData[SMPlayerRealm][SMPlayerName].Merge_Heal_And_Damage_Combos == false) then
	Channel = GetChannelName(SMData[SMPlayerRealm][SMPlayerName]["Channel"]);
	if ((CritComboHeal > 21)) then
		if not(Annonce > 21) then
		SendChatMessage("Ownage!  *" .. CritComboHeal .. "* crits for *" .. CritComboHealDmg .. "* total damage! ", "CHANNEL", nil, Channel);
		end
	else
		if ((CritComboHeal > 19 and CritComboHeal < 22)) then
			if not(Annonce > 21) then
			SendChatMessage("Lu-lu-lu-lu-ludicrous Kill!  *" .. CritComboHeal .. "* crits for *" .. CritComboHealDmg .. "* total damage! ", "CHANNEL", nil, Channel);
			end
		else
			if ((CritComboHeal > 14 and CritComboHeal < 19)) then
				if not(Annonce > 15) then
				SendChatMessage("Mm-mmm-Monster Kill!  *" .. CritComboHeal .. "* crits for *" .. CritComboHealDmg .. "* total damage! ", "CHANNEL", nil, Channel);
				end
		     	else
			   	 if ((CritComboHeal > 9 and CritComboHeal < 15)) then
					if not(Annonce > 10) then	
					SendChatMessage("Holy Shit!  *" .. CritComboHeal .. "* crits for *" .. CritComboHealDmg .. "* total damage! ", "CHANNEL", nil, Channel);
					end
			 	else
					if ((CritComboHeal > 7 and CritComboHeal < 10)) then
						if not(Annonce > 8) then
						SendChatMessage("God Like!  *" .. CritComboHeal .. "* crits for *" .. CritComboHealDmg .. "* total damage! ", "CHANNEL", nil, Channel); 
						end
					else
						if ((CritComboHeal > 6 and CritComboHeal < 8)) then
							if not(Annonce > 7) then
							SendChatMessage("Wicked Sick!  *" .. CritComboHeal .. "* crits for *" .. CritComboHealDmg .. "* total damage! ", "CHANNEL", nil, Channel); 
							end
						else
							if ((CritComboHeal > 5 and CritComboHeal < 7)) then 
								if not(Annonce > 6) then
								SendChatMessage("Ultra Kill!  *" .. CritComboHeal .. "* crits for *" .. CritComboHealDmg .. "* total damage! ", "CHANNEL", nil, Channel);
								end 
							else
								if ((CritComboHeal > 4 and CritComboHeal < 6)) then 
									if not(Annonce > 5) then
									SendChatMessage("Dominating!  *" .. CritComboHeal .. "* crits for *" .. CritComboHealDmg .. "* total damage! ", "CHANNEL", nil, Channel);
									end
								else
									if ((CritComboHeal > 3 and CritComboHeal < 5)) then 
										if not(Annonce > 4)then
										SendChatMessage("Killing Spree!  *" .. CritComboHeal .. "* crits for *" .. CritComboHealDmg .. "* total damage! ", "CHANNEL", nil, Channel);
										end
									else
										if ((CritComboHeal > 2 and CritComboHeal < 4)) then
											if not(Annonce > 3) then 
											SendChatMessage("Unstoppable!  *" .. CritComboHeal .. "* crits for *" .. CritComboHealDmg .. "* total damage! ", "CHANNEL", nil, Channel);
											end
										else
											if ((CritComboHeal > 1 and CritComboHeal < 3)) then
												if not(Annonce > 2) then 
												SendChatMessage("Oh Yeah!  *" .. CritComboHeal .. "* crits for *" .. CritComboHealDmg .. "* total damage! ", "CHANNEL", nil, Channel);
												end	
											else
												if ((CritComboHeal > 0 and CritComboHeal < 2)) then 
													if not(Annonce > 1) then
													SendChatMessage("Yeah!  *" .. CritComboHeal .. "* crits for *" .. CritComboHealDmg .. "* total damage! ", "CHANNEL", nil, Channel);
													end
												end
											end
										end
									end
								end
							end
						end
					end
				end
			end
		end
	end
	end
 end
	
	CritCombo = 0;
	CritComboDmg = 0;
	CritComboHeal = 0;
	CritComboHealDmg = 0;
end

function SMInitializeSMData()
	if (SMData == nil) then
		SMData = {};
	end
	
	if (SMData[SMPlayerRealm] == nil) then
		SMData[SMPlayerRealm] = {};
	end

	if (SMPlayerName ~= nil and SMPlayerName ~= UNKNOWNOBJECT and SMPlayerName ~= UKNOWNBEING) then
		if (SMData[SMPlayerRealm][SMPlayerName] == nil) then
			SMData[SMPlayerRealm][SMPlayerName] = {};
			SMSetCurrentPlayerToZeros();
			SMSetDefaultOptions();
		end
	end
end

function SMSetCurrentPlayerToZeros()
	SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritCombo = 0;
	SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboDmg = 0;
	SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritCombo = 0;
	SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboDmg = 0;
	SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHeal = 0;
	SMData[SMPlayerRealm][SMPlayerName].RecordHitsCritComboHealDmg = 0;
	SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHeal = 0;
	SMData[SMPlayerRealm][SMPlayerName].RecordDmgCritComboHealDmg = 0;
end

function SMResetAll()
	SMData = {};
	SMInitializeSMData();
	SMOptionsFrame_OnShow();
		
	DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00[ShaderMod] " .. SHADERMOD_VERSION .. " All records and options reset.", .2, .0);
end

function SMDisplayHelp()
	DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00[ShaderMod] " .. SHADERMOD_VERSION .. " |cFF00FF00: Modded by |cFF00FFFFSky-|cFF0000FFDexter.", .2, .0);
	DEFAULT_CHAT_FRAME:AddMessage("[Commands] (/ShaderMod, /ShaderM, /sm)",.65,.65,.6);
	DEFAULT_CHAT_FRAME:AddMessage("   Menu - Shows the options menu.");
	DEFAULT_CHAT_FRAME:AddMessage("   Records - Shows your records.");
	DEFAULT_CHAT_FRAME:AddMessage("   Lock/Unlock - Lock or unlock messages frames.");
	DEFAULT_CHAT_FRAME:AddMessage("   Hide/Show - Hide or show messages frames.");
	DEFAULT_CHAT_FRAME:AddMessage("   MiniMap - Show MiniMap Options.");
	DEFAULT_CHAT_FRAME:AddMessage("   KillingBlow - Show KillingBlow Options.");
end

function SMOptionsFrame_OnShow()	
	if (SMData[SMPlayerRealm][SMPlayerName].Running_Crit_Display) then
		SMCheckBoxRunning_Crit_Display:SetChecked(1);
	else
		SMCheckBoxRunning_Crit_Display:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].White_Crits) then
		SMCheckBoxEnable_White_Crits:SetChecked(1);
	else
		SMCheckBoxEnable_White_Crits:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Display) then
		SMCheckBoxEnable_Old_Combo_Display:SetChecked(1);
	else
		SMCheckBoxEnable_Old_Combo_Display:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Old_Combo_Sound) then
		SMCheckBoxEnable_Old_Combo_Sound:SetChecked(1);
	else
		SMCheckBoxEnable_Old_Combo_Sound:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].No_White_Normal) then
		SMCheckBoxEnable_No_White_Normal:SetChecked(1);
	else
		SMCheckBoxEnable_No_White_Normal:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Only_Count_Crits) then
		SMCheckBoxRunning_Only_Count_Crits:SetChecked(1);
	else
		SMCheckBoxRunning_Only_Count_Crits:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Running_Combat_Log_Display) then
		SMCheckBoxRunning_Combat_Log_Display:SetChecked(1);
	else
		SMCheckBoxRunning_Combat_Log_Display:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Running_Old_School_Display) then
		SMCheckBoxRunning_Old_School_Display:SetChecked(1);
	else
		SMCheckBoxRunning_Old_School_Display:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Running_Hit_Display) then
		SMCheckBoxRunning_Hit_Display:SetChecked(1);
	else
		SMCheckBoxRunning_Hit_Display:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Reset_Combo) then
		SMCheckBoxRunning_Reset_Combo:SetChecked(1);
	else
		SMCheckBoxRunning_Reset_Combo:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Announce_Display) then
		SMCheckBoxAnnounce_Display:SetChecked(1);
	else
		SMCheckBoxAnnounce_Display:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Rogue) then
		SMCheckBoxEnable_Sound_Finish_Him_Rogue:SetChecked(1);
	else
		SMCheckBoxEnable_Sound_Finish_Him_Rogue:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Finish_Him_Execute) then
		SMCheckBoxEnable_Sound_Finish_Him_Execute:SetChecked(1);
	else
		SMCheckBoxEnable_Sound_Finish_Him_Execute:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Execute) then
		SMCheckBoxEnable_Log_Finish_Him_Execute:SetChecked(1);
	else
		SMCheckBoxEnable_Log_Finish_Him_Execute:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Finish_Him_Rogue) then
		SMCheckBoxEnable_Log_Finish_Him_Rogue:SetChecked(1);
	else
		SMCheckBoxEnable_Log_Finish_Him_Rogue:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Yeah) then
		SMCheckBoxEnable_Sound_Yeah:SetChecked(1);
	else
		SMCheckBoxEnable_Sound_Yeah:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Yeah) then
		SMCheckBoxEnable_Log_Yeah:SetChecked(1);
	else
		SMCheckBoxEnable_Log_Yeah:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Merge_Heal_And_Damage_Combos) then
		SMCheckBoxEnable_Merge_Heal_And_Damage_Combos:SetChecked(1);
	else
		SMCheckBoxEnable_Merge_Heal_And_Damage_Combos:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Heal) then
		SMCheckBoxEnable_Heal:SetChecked(1);
	else
		SMCheckBoxEnable_Heal:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Oh_Yeah) then
		SMCheckBoxEnable_Sound_Oh_Yeah:SetChecked(1);
	else
		SMCheckBoxEnable_Sound_Oh_Yeah:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Unstoppable) then
		SMCheckBoxEnable_Sound_Unstoppable:SetChecked(1);
	else
		SMCheckBoxEnable_Sound_Unstoppable:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Killing_Spree) then
		SMCheckBoxEnable_Sound_Killing_Spree:SetChecked(1);
	else
		SMCheckBoxEnable_Sound_Killing_Spree:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Dominating) then
		SMCheckBoxEnable_Sound_Dominating:SetChecked(1);
	else
		SMCheckBoxEnable_Sound_Dominating:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ultra_Kill) then
		SMCheckBoxEnable_Sound_Ultra_Kill:SetChecked(1);
	else
		SMCheckBoxEnable_Sound_Ultra_Kill:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Wicked_Sick) then
		SMCheckBoxEnable_Sound_Wicked_Sick:SetChecked(1);
	else
		SMCheckBoxEnable_Sound_Wicked_Sick:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_God_Like) then
		SMCheckBoxEnable_Sound_God_Like:SetChecked(1);
	else
		SMCheckBoxEnable_Sound_God_Like:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Holy_Shit) then
		SMCheckBoxEnable_Sound_Holy_Shit:SetChecked(1);
	else
		SMCheckBoxEnable_Sound_Holy_Shit:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Monster_Kill) then
		SMCheckBoxEnable_Sound_Monster_Kill:SetChecked(1);
	else
		SMCheckBoxEnable_Sound_Monster_Kill:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ludicrous_Kill) then
		SMCheckBoxEnable_Sound_Ludicrous_Kill:SetChecked(1);
	else
		SMCheckBoxEnable_Sound_Ludicrous_Kill:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Sound_Ownage) then
		SMCheckBoxEnable_Sound_Ownage:SetChecked(1);
	else
		SMCheckBoxEnable_Sound_Ownage:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Oh_Yeah) then
		SMCheckBoxEnable_Log_Oh_Yeah:SetChecked(1);
	else
		SMCheckBoxEnable_Log_Oh_Yeah:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Unstoppable) then
		SMCheckBoxEnable_Log_Unstoppable:SetChecked(1);
	else
		SMCheckBoxEnable_Log_Unstoppable:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Killing_Spree) then
		SMCheckBoxEnable_Log_Killing_Spree:SetChecked(1);
	else
		SMCheckBoxEnable_Log_Killing_Spree:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Dominating) then
		SMCheckBoxEnable_Log_Dominating:SetChecked(1);
	else
		SMCheckBoxEnable_Log_Dominating:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Ultra_Kill) then
		SMCheckBoxEnable_Log_Ultra_Kill:SetChecked(1);
	else
		SMCheckBoxEnable_Log_Ultra_Kill:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Wicked_Sick) then
		SMCheckBoxEnable_Log_Wicked_Sick:SetChecked(1);
	else
		SMCheckBoxEnable_Log_Wicked_Sick:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_God_Like) then
		SMCheckBoxEnable_Log_God_Like:SetChecked(1);
	else
		SMCheckBoxEnable_Log_God_Like:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Holy_Shit) then
		SMCheckBoxEnable_Log_Holy_Shit:SetChecked(1);
	else
		SMCheckBoxEnable_Log_Holy_Shit:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Monster_Kill) then
		SMCheckBoxEnable_Log_Monster_Kill:SetChecked(1);
	else
		SMCheckBoxEnable_Log_Monster_Kill:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Ludicrous_Kill) then
		SMCheckBoxEnable_Log_Ludicrous_Kill:SetChecked(1);
	else
		SMCheckBoxEnable_Log_Ludicrous_Kill:SetChecked(0);
	end

	if (SMData[SMPlayerRealm][SMPlayerName].Enable_Log_Ownage) then
		SMCheckBoxEnable_Log_Ownage:SetChecked(1);
	else
		SMCheckBoxEnable_Log_Ownage:SetChecked(0);
	end

end

function SMCheckBoxClick(var_to_toggle)
	if ( this:GetChecked() ) then
		var_to_toggle = true;
	else
		var_to_toggle = false;
	end
end

function SMOnTooltip()
		GameTooltip:AddLine("ShaderMod")
		GameTooltip:AddLine("Left click: Reset combos\nRight click: Open options menu",.8,.8,.8,1)
		GameTooltip:Show()
end

function SMKillingBlow()
	if (SMData[SMPlayerRealm][SMPlayerName].Display_Killing_Blow == true) then
		if ((event == "PLAYER_ENTERING_WORLD") and (SMData[SMPlayerRealm][SMPlayerName].Display_Killing_Blow_Reset_Bg == true)) then
		KillingBlow = 0;
		end
		if ((event == "CHAT_MSG_COMBAT_FRIENDLY_DEATH") and (SMData[SMPlayerRealm][SMPlayerName].Display_Killing_Blow_Reset_Death == true)) then
			for spellname in string.gmatch(arg1, PLAYERDEATH)do
			KillingBlow = 0;
			end
		end
		if (event == "CHAT_MSG_COMBAT_HOSTILE_DEATH") then
			for spellname in string.gmatch(arg1, KILLINGBLOW)do
			KillingBlow = KillingBlow + 1;
				if (KillingBlow >= 1) then
					SMKillingBlowAnnounce();
				end
			end
		end
	end
end

function SMKillingBlowAnnounce()
	if (KillingBlow > 0 and KillingBlow < 2) then
		PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\firstblood.wav");
		SMKillingBlowFrame:AddMessage("Frags: " .. KillingBlow, 1, 1, 1, 1, 3);
		SMKillingBlowFrame:AddMessage("First Blood!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
	if (KillingBlow > 1 and KillingBlow < 3) then
		PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\doublekill.wav");
		SMKillingBlowFrame:AddMessage("Frags: " .. KillingBlow, 1, 1, 1, 1, 3);
		SMKillingBlowFrame:AddMessage("Double Kill!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
	if (KillingBlow > 2 and KillingBlow < 4) then
		PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\tripplekill.wav");
		SMKillingBlowFrame:AddMessage("Frags: " .. KillingBlow, 1, 1, 1, 1, 3);
		SMKillingBlowFrame:AddMessage("Tripple Kill!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
	if (KillingBlow > 3 and KillingBlow < 5) then
		PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\multikill.wav");
		SMKillingBlowFrame:AddMessage("Frags: " .. KillingBlow, 1, 1, 1, 1, 3);
		SMKillingBlowFrame:AddMessage("Multi Kill!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
	if (KillingBlow > 4 and KillingBlow < 6) then
		PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\ultrakill.wav");
		SMKillingBlowFrame:AddMessage("Frags: " .. KillingBlow, 1, 1, 1, 1, 3);
		SMKillingBlowFrame:AddMessage("Ultra Kill!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
	if (KillingBlow > 5 and KillingBlow < 7) then
		PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\megakill.wav");
		SMKillingBlowFrame:AddMessage("Frags: " .. KillingBlow, 1, 1, 1, 1, 3);
		SMKillingBlowFrame:AddMessage("Mega Kill!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
	if (KillingBlow > 6 and KillingBlow < 8) then
		PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\monsterkill.wav");
		SMKillingBlowFrame:AddMessage("Frags: " .. KillingBlow, 1, 1, 1, 1, 3);
		SMKillingBlowFrame:AddMessage("Monster Kill!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
	if (KillingBlow > 7 and KillingBlow < 9) then
		PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\ludicrouskill.wav");
		SMKillingBlowFrame:AddMessage("Frags: " .. KillingBlow, 1, 1, 1, 1, 3);
		SMKillingBlowFrame:AddMessage("Ludicrous Kill!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
	if (KillingBlow > 8 and KillingBlow < 11) then
		PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\wickedsick.wav");
		SMKillingBlowFrame:AddMessage("Frags: " .. KillingBlow, 1, 1, 1, 1, 3);
		SMKillingBlowFrame:AddMessage("Wicked Sick!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
	if (KillingBlow > 10 and KillingBlow < 14) then
		PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\holyshit.wav");
		SMKillingBlowFrame:AddMessage("Frags: " .. KillingBlow, 1, 1, 1, 1, 3);
		SMKillingBlowFrame:AddMessage("Holy Shit!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
	if (KillingBlow > 13 and KillingBlow < 17) then
		PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\godlike.wav");
		SMKillingBlowFrame:AddMessage("Frags: " .. KillingBlow, 1, 1, 1, 1, 3);
		SMKillingBlowFrame:AddMessage("God Like!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
	if (KillingBlow > 16) then
		PlaySoundFile("Interface\\AddOns\\ShaderMod\\Sounds\\Ownage.wav");
		SMKillingBlowFrame:AddMessage("Frags: " .. KillingBlow, 1, 1, 1, 1, 3);
		SMKillingBlowFrame:AddMessage("Ownage!",FDISPLAY_RED, FDISPLAY_GREEN, FDISPLAY_BLUE, 1, 3);
	end
end
