<commit_before>/*
 * Copyright  2014 <NAME>
 * Distributed under the GNU Affero General Public License, version 3.
 * Your changes must be made public.
 * For the full license text, see LICENSE.txt.
 */
var/EventScheduler/scheduler = new()
atom/var/tmp/list/StatusEffect/LStatusEffects

atom/proc/AddStatusEffect(StatusEffect/pStatusEffect)
	if(src.LStatusEffects)
		src.LStatusEffects += pStatusEffect
	else
		src.LStatusEffects = list(pStatusEffect)

atom/proc/RemoveStatusEffect(StatusEffect/pStatusEffect)
	if(src.LStatusEffects)
		src.LStatusEffects -= pStatusEffect
		if(!LStatusEffects.len)
			LStatusEffects = null
Event
	e_StatusEffect
		var/StatusEffect/AttachedStatusEffect

		New(StatusEffect/pStatusEffect)
			//Set Event's parent to the StatusEffect
			..()
			src.AttachedStatusEffect = pStatusEffect

		fire()
			..()
			if(AttachedStatusEffect)AttachedStatusEffect.Deactivate()

	AFKCheck

		fire()
			..()
			spawn()
				AFK_Train_Scan()
				scheduler.schedule(src, world.tick_lag * rand(9000, 12000)) // 15 to 20 minutes

	ClanWars

		fire()
			..()
			spawn()
				toggle_clanwars()
				scheduler.schedule(src, world.tick_lag * 6048000) // 1 week

	Weather
		fire()
			..()
			spawn()
				if(prob(5))       weather.acid()
				else if(prob(6))  weather.snow()
				else if(prob(10)) weather.rain()
				else if(prob(10)) weather.clear(100) // cloudy
				else if(prob(20)) weather.clear(50)  // partial cloudy
				else              weather.clear()

				scheduler.schedule(src, world.tick_lag * rand(9000, 27000)) // // 15 to 45 minutes

	RandomEvents
		fire()
			..()
			spawn()
				if(prob(30)) // old system event
					var/delay = rand(10,30) // event will be 10 to 30 minutes
					world << infomsg("Old dueling system is active for [delay] minutes outside!")
					for(var/area/A in outside_areas)
						A.oldsystem = 1
						spawn(delay * 600) A.oldsystem = 0


				scheduler.schedule(src, world.tick_lag * rand(36000, 108000))  // 1 to 3 hours

proc
	init_events()
		scheduler.start()

		init_books()
		spawn() init_clanwars()
		init_weather()
		scheduler.schedule(new/Event/RandomEvents, world.tick_lag * rand(3000, 36000)) // 5 minutes to 1 hour

RandomEvents
mob/verb/testareas()
	for(var/i in outside_areas)
		world << i

mob/proc/RevertTrans()
	if(src.LStatusEffects)
		var/StatusEffect/Transfiguration/S = locate() in src.LStatusEffects
		if(S)
			S.Deactivate()
atom/var/TransLastIcon
atom/var/TransLastIconState


atom/proc/findStatusEffect(var/type)
	return src.LStatusEffects ? locate(type) in src.LStatusEffects : 0
proc/issafezone(area/A)
		return safemode && !A.safezoneoverride && (!istype(A,/area/hogwarts/Duel_Arenas) && (istype(A,/area/hogwarts) || istype(A,/area/Diagon_Alley)))
proc/canUse(mob/Player/M,var/StatusEffect/cooldown=null,var/needwand=1,var/inarena=1,var/insafezone=1,var/inhogwarts=1,var/mob/Player/target=null,var/mpreq=0,var/againstocclumens=1,var/againstflying=1,var/againstcloaked=1,var/projectile=0)
	//Returns 1 if you can use the item/cast the spell. Also handles the printing of messages if you can't.
	if(!M.loc)
		M << "<b>You cannot use this in the void.</b>"
		return 0
	var/area/A = M.loc.loc
	if(M.z > SWAPMAP_Z && !inhogwarts)
		M << "<b>You cannot use this in a vault.</b>"
		return 0
	if(target && !insafezone && issafezone(target.loc.loc))
		M << "<b>[target] is inside a safezone.</b>"
		return 0
	if(!A.safezoneoverride)
		if(!inhogwarts && istype(M.loc.loc,/area/hogwarts))
			M << "<b>You can't use this inside hogwarts.</b>"<commit_msg>Removes a testing verb<commit_after>/*
 * Copyright  2014 <NAME>
 * Distributed under the GNU Affero General Public License, version 3.
 * Your changes must be made public.
 * For the full license text, see LICENSE.txt.
 */
var/EventScheduler/scheduler = new()
atom/var/tmp/list/StatusEffect/LStatusEffects

atom/proc/AddStatusEffect(StatusEffect/pStatusEffect)
	if(src.LStatusEffects)
		src.LStatusEffects += pStatusEffect
	else
		src.LStatusEffects = list(pStatusEffect)

atom/proc/RemoveStatusEffect(StatusEffect/pStatusEffect)
	if(src.LStatusEffects)
		src.LStatusEffects -= pStatusEffect
		if(!LStatusEffects.len)
			LStatusEffects = null
Event
	e_StatusEffect
		var/StatusEffect/AttachedStatusEffect

		New(StatusEffect/pStatusEffect)
			//Set Event's parent to the StatusEffect
			..()
			src.AttachedStatusEffect = pStatusEffect

		fire()
			..()
			if(AttachedStatusEffect)AttachedStatusEffect.Deactivate()

	AFKCheck

		fire()
			..()
			spawn()
				AFK_Train_Scan()
				scheduler.schedule(src, world.tick_lag * rand(9000, 12000)) // 15 to 20 minutes

	ClanWars

		fire()
			..()
			spawn()
				toggle_clanwars()
				scheduler.schedule(src, world.tick_lag * 6048000) // 1 week

	Weather
		fire()
			..()
			spawn()
				if(prob(5))       weather.acid()
				else if(prob(6))  weather.snow()
				else if(prob(10)) weather.rain()
				else if(prob(10)) weather.clear(100) // cloudy
				else if(prob(20)) weather.clear(50)  // partial cloudy
				else              weather.clear()

				scheduler.schedule(src, world.tick_lag * rand(9000, 27000)) // // 15 to 45 minutes

	RandomEvents
		fire()
			..()
			spawn()
				if(prob(30)) // old system event
					var/delay = rand(10,30) // event will be 10 to 30 minutes
					world << infomsg("Old dueling system is active for [delay] minutes outside!")
					for(var/area/A in outside_areas)
						A.oldsystem = 1
						spawn(delay * 600) A.oldsystem = 0


				scheduler.schedule(src, world.tick_lag * rand(36000, 108000))  // 1 to 3 hours

proc
	init_events()
		scheduler.start()

		init_books()
		spawn() init_clanwars()
		init_weather()
		scheduler.schedule(new/Event/RandomEvents, world.tick_lag * rand(3000, 36000)) // 5 minutes to 1 hour

mob/proc/RevertTrans()
	if(src.LStatusEffects)
		var/StatusEffect/Transfiguration/S = locate() in src.LStatusEffects
		if(S)
			S.Deactivate()
atom/var/TransLastIcon
atom/var/TransLastIconState


atom/proc/findStatusEffect(var/type)
	return src.LStatusEffects ? locate(type) in src.LStatusEffects : 0
proc/issafezone(area/A)
		return safemode && !A.safezoneoverride && (!istype(A,/area/hogwarts/Duel_Arenas) && (istype(A,/area/hogwarts) || istype(A,/area/Diagon_Alley)))
proc/canUse(mob/Player/M,var/StatusEffect/cooldown=null,var/needwand=1,var/inarena=1,var/insafezone=1,var/inhogwarts=1,var/mob/Player/target=null,var/mpreq=0,var/againstocclumens=1,var/againstflying=1,var/againstcloaked=1,var/projectile=0)
	//Returns 1 if you can use the item/cast the spell. Also handles the printing of messages if you can't.
	if(!M.loc)
		M << "<b>You cannot use this in the void.</b>"
		return 0
	var/area/A = M.loc.loc
	if(M.z > SWAPMAP_Z && !inhogwarts)
		M << "<b>You cannot use this in a vault.</b>"
		return 0
	if(target && !insafezone && issafezone(target.loc.loc))
		M << "<b>[target] is inside a safezone.</b>"
		return 0
	if(!A.safezoneoverride)
		if(!inhogwarts && istype(M.loc.loc,/area/hogwarts))
			M << "<b>You can't use this inside hogwarts.</b>"
{'fraction_non_alphanumeric': 0.13564441887226697, 'fraction_numerical': 0.030207134637514385, 'mean_word_length': 3.8117647058823527, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 23, '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': '472192', 'n_tokens_mistral': 2923, 'n_tokens_neox': 2469, 'n_words': 531}