<commit_before>
var/list/events

proc/init_random_events()
	events = list()
	for(var/e in typesof(/RandomEvent/)-/RandomEvent)
		events += new e
	bubblesort_by_value(events, "chance")
	scheduler.schedule(new/Event/RandomEvents, world.tick_lag * rand(3000, 36000)) // 5 minutes to 1 hour


var/list/spawners = list()

obj/spawner
	invisibility = 10
	New()
		..()
		spawners += src

RandomEvent
	var/chance = 10
	var/name

	proc/start()
		for(var/mob/Player/p in Players)
			p.beep(1)

	Class
		name = "Class"
		start()
			var/spell = pick(spellList ^ list(/mob/Spells/verb/Self_To_Dragon, /mob/Spells/verb/Self_To_Human, /mob/Spells/verb/Episky, /mob/Spells/verb/Inflamari))

			var/class/c

			for(var/t in typesof(/class/))
				if(ends_with("[t]", spellList[spell]))
					c = new t
					break

			if(c)
				c.name      = spellList[spell]
				c.spelltype = spell
				curClass    = c.subject
				classdest   = locate("[c.subject] Class")

				var/obj/teacher/t = new (classdest.loc)
				t.classInfo = c
				c.professor = t

				for(var/mob/Player/p in Players)
					p.beep(2)

				for(var/i = 5; i > 0; i--)
					Players << announcemsg("[c.subject] Class is starting in [i] minutes. Click <a href=\"?src=\ref[src];action=class_path\">here</a> for directions.")
					sleep(600)


				c.start()
				sleep(600 * 30)
				t.loc = null
				t.classInfo = null
				c.professor = null

			else
				world.log << "TWC Error: [spell] not found in class type list (Class.dmi)"

	TheEvilSnowman
		name = "<NAME>"
		start()
			..()
			var/minutes = rand(15,45)
			var/list/m = list()
			world << infomsg("The Evil Snowman and his army appeared outside Hogwarts, defend yourselves until reinforcements arrive! Reinforcements will arrive in [minutes] minutes, if you manage to kill the evil snowman before then you might be able to get a nice prize!")<commit_msg>Properly end class guidance with auto classes<commit_after>
var/list/events

proc/init_random_events()
	events = list()
	for(var/e in typesof(/RandomEvent/)-/RandomEvent)
		events += new e
	bubblesort_by_value(events, "chance")
	scheduler.schedule(new/Event/RandomEvents, world.tick_lag * rand(3000, 36000)) // 5 minutes to 1 hour


var/list/spawners = list()

obj/spawner
	invisibility = 10
	New()
		..()
		spawners += src

RandomEvent
	var/chance = 10
	var/name

	proc/start()
		for(var/mob/Player/p in Players)
			p.beep(1)

	Class
		name = "Class"
		start()
			var/spell = pick(spellList ^ list(/mob/Spells/verb/Self_To_Dragon, /mob/Spells/verb/Self_To_Human, /mob/Spells/verb/Episky, /mob/Spells/verb/Inflamari))

			var/class/c

			for(var/t in typesof(/class/))
				if(ends_with("[t]", spellList[spell]))
					c = new t
					break

			if(c)
				c.name      = spellList[spell]
				c.spelltype = spell
				curClass    = c.subject
				classdest   = locate("[c.subject] Class")

				var/obj/teacher/t = new (classdest.loc)
				t.classInfo = c
				c.professor = t

				for(var/mob/Player/p in Players)
					p.beep(2)

				for(var/i = 5; i > 0; i--)
					Players << announcemsg("[c.subject] Class is starting in [i] minutes. Click <a href=\"?src=\ref[src];action=class_path\">here</a> for directions.")
					sleep(600)


				c.start()
				sleep(600 * 30)
				t.loc = null
				t.classInfo = null
				c.professor = null
				classdest = null

				for(var/mob/M in Players)
					if(M.classpathfinding)
						for(var/image/C in M.client.images)
							if(C.icon == 'arrows.dmi')
								M.client.images.Remove(C)
						M.classpathfinding = 0

			else
				world.log << "TWC Error: [spell] not found in class type list (Class.dmi)"

	TheEvilSnowman
		name = "<NAME>"
		start()
			..()
			var/minutes = rand(15,45)
			var/list/m = list()
			world << infomsg("The Evil Snowman and his army appeared outside Hogwarts, defend yourselves until reinforcements arrive! Reinforcements will arrive in [minutes] minutes, if you manage to kill the evil snowman before then you might be able to get a nice prize!")
{'fraction_non_alphanumeric': 0.13676731793960922, 'fraction_numerical': 0.015985790408525755, 'mean_word_length': 2.981818181818182, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3176477', 'n_tokens_mistral': 1734, 'n_tokens_neox': 1428, 'n_words': 355}