-- Owen Ouimette LevelBuddy 2017

-- DONT DELETE THESE TOP COMMENT DASHES

-- To change the song that plays get the file you want then make sure you can see the
-- file extensions. Change .mp3 (.mov .mp4 etc) to .ogg. Then put the .ogg into LB_Cheer.
-- Rename PlaySoundFile("Interface\\AddOns\\LB_Cheer\\Hotel.ogg") from instead of Hotel.ogg to your 
-- song then save. I'd recommend putting Coin.ogg or cheer.ogg on top but if you want to
-- completely disable either sound put 2 dashes in front of PlaySoundFile.

-- I've already put multiple songs into the LB_Cheer folder.

local Congrats_EventFrame = CreateFrame("Frame")
Congrats_EventFrame:RegisterEvent("PLAYER_LEVEL_UP")
Congrats_EventFrame:SetScript("OnEvent",
    function(self, event, ...)
	    local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 = ...
		print("Congratulations on reaching level" ..arg1.. ', ' .. UnitName("Player").. "! You gained " ..arg2.. ' Health and ' ..arg3.. ' Mana!') 
		local money = GetMoney()
		local gold = floor(abs(money / 10000))
		local silver = floor(abs(mod(money / 100, 100)))
		local copper = floor(abs(mod(money, 100)))
		print(format("I have %d gold %d silver %d copper.", gold, silver, copper))
		print ('You have ' .. GetTotalAchievementPoints('player') .. ' Achivement Points')
		print ('Currently you have ' .. UnitXP("player") .. 'XP. You need ' ..  UnitXPMax("player") ' to level up!')
	end)