local save = require("#Celeste.Mod.CrossoverCollab.Code.PointsStuff.PointsModule")
local bettertext = require("#Celeste.Mod.CrossoverCollab.Code.PointsStuff.BetterTextbox")

-- Returns if a flag exists, if it does, returns true, if it doesn't returns false
function isflagtrue(flag)
    return save.SaveData:IsFlagTrue(flag)
end

function onBegin()
	if not isflagtrue("shop_firstTime") then -- This controls whether Axi is sleeping the first time you enter the shop
		setFlag("shop_anim_sleeping",true)
		setFlag("shop_anim_notidle",true)
		setFlag("shop_anim_notidle_left",true)
	end
	
	math.randomseed(os.time())
	if isflagtrue("shop_firstTime") then
		 --Chooses a random dialog from different pools depending on certain conditions
		if isflagtrue("allMapsVisited") then
		welcomeRng = math.random(1,15)
		elseif isflagtrue("shop_secondTime") then
		welcomeRng = math.random(1,10)
		else
		welcomeRng = math.random(1,5)
		end
			
		if welcomeRng == 1 then
			miniTextbox("CC_Lobby_Welcome_1")
		end
		if welcomeRng == 2 then
			miniTextbox("CC_Lobby_Welcome_2")
		end
		if welcomeRng == 3 then
			miniTextbox("CC_Lobby_Welcome_3")
		end
		if welcomeRng == 4 then
			miniTextbox("CC_Lobby_Welcome_4")
		end
		if welcomeRng == 5 then
			miniTextbox("CC_Lobby_Welcome_5")
		end
		if welcomeRng == 6 then
			miniTextbox("CC_Lobby_Welcome_6")
		end
		if welcomeRng == 7 then
			miniTextbox("CC_Lobby_Welcome_7")
		end
		if welcomeRng == 8 then
			miniTextbox("CC_Lobby_Welcome_8")
		end
		if welcomeRng == 9 then
			miniTextbox("CC_Lobby_Welcome_9")
		end
		if welcomeRng == 10 then
			miniTextbox("CC_Lobby_Welcome_10")
		end
		if welcomeRng == 11 then
			miniTextbox("CC_Lobby_Welcome_11")
		end
		if welcomeRng == 12 then
			miniTextbox("CC_Lobby_Welcome_12")
		end
		if welcomeRng == 13 then
			miniTextbox("CC_Lobby_Welcome_13")
		end
		if welcomeRng == 14 then
			miniTextbox("CC_Lobby_Welcome_14")
		end
		if welcomeRng == 15 then
			miniTextbox("CC_Lobby_Welcome_15")
		end
	end
end