<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()
			set waitfor = 0
			scheduler.schedule(src, rand(9000, 12000) + 600) // 16 to 21 minutes
			AFK_Train_Scan()

	Auction

		fire()
			set waitfor = 0
			scheduler.schedule(src, 36000)
			auctionBidTime()

	AutoClass

		fire()
			set waitfor = 0
			spawn()
				scheduler.schedule(src, 6048000) // 1 week
				var/RandomEvent/Class/auto_class = locate() in worldData.events
				auto_class.start()

	ClanWars

		fire()
			set waitfor = 0
			spawn()
				scheduler.schedule(src, 6048000) // 1 week
				toggle_clanwars()

	Weather
		fire()
			set waitfor = 0

			scheduler.schedule(src, rand(9000, 27000)) // // 15 to 45 minutes
			var/i = pickweight(worldData.weather_effects)
			switch(i)
				if("acid")        weather.acid()
				if("snow")        weather.snow()
				if("rain")        weather.rain()
				if("cloudy")      weather.clear(40)
				if("half cloudy") weather.clear(20)
				if("sunny")       weather.clear()

	WeeklyEvents
		fire()
			set waitfor = 0
			scheduler.schedule(src, 6048000) // 1 week
			RandomizeShop()
			rewardExpWeek()

			worldData.elderWand = null

			// player shops
			if(worldData.playerShops)
				for(var/shopId in worldData.playerShops)
					var/playerShop/shop = worldData.playerShops[shopId]

					if(!shop.loaded && !shop.owner && !shop.bidCkey)
						worldData.playerShops -= shopId
						continue

					if(shop.owner != shop.bidCkey)
						if(shop.owner)
							shop.reset()

					if(shop.bidCkey)
						shop.owner = shop.bidCkey
						mail(shop.owner, "You won the bid on [shop.id] shop.")

					shop.bidCkey  = null
					shop.bidCount = 0

			// elects major guilds
			if(worldData.guilds && worldData.guilds.len >= 2)

				var/list/guilds = list()
				for(var/id in worldData.guilds)
					var/guild/g = worldData.guilds[id]
					guilds[id] = g.Score()

				bubblesort_by_value(guilds)

				worldData.majorChaos = guilds[1]
				worldData.majorPeace = guilds[guilds.len]

			// rep/fame decay + clean player data
			cleanPlayerData(1)

	RandomEvents
		fire()
			set waitfor = 0

			if(classdest || clanwars)<commit_msg>Disables reputation decay<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()
			set waitfor = 0
			scheduler.schedule(src, rand(9000, 12000) + 600) // 16 to 21 minutes
			AFK_Train_Scan()

	Auction

		fire()
			set waitfor = 0
			scheduler.schedule(src, 36000)
			auctionBidTime()

	AutoClass

		fire()
			set waitfor = 0
			spawn()
				scheduler.schedule(src, 6048000) // 1 week
				var/RandomEvent/Class/auto_class = locate() in worldData.events
				auto_class.start()

	ClanWars

		fire()
			set waitfor = 0
			spawn()
				scheduler.schedule(src, 6048000) // 1 week
				toggle_clanwars()

	Weather
		fire()
			set waitfor = 0

			scheduler.schedule(src, rand(9000, 27000)) // // 15 to 45 minutes
			var/i = pickweight(worldData.weather_effects)
			switch(i)
				if("acid")        weather.acid()
				if("snow")        weather.snow()
				if("rain")        weather.rain()
				if("cloudy")      weather.clear(40)
				if("half cloudy") weather.clear(20)
				if("sunny")       weather.clear()

	WeeklyEvents
		fire()
			set waitfor = 0
			scheduler.schedule(src, 6048000) // 1 week
			RandomizeShop()
			rewardExpWeek()

			worldData.elderWand = null

			// player shops
			if(worldData.playerShops)
				for(var/shopId in worldData.playerShops)
					var/playerShop/shop = worldData.playerShops[shopId]

					if(!shop.loaded && !shop.owner && !shop.bidCkey)
						worldData.playerShops -= shopId
						continue

					if(shop.owner != shop.bidCkey)
						if(shop.owner)
							shop.reset()

					if(shop.bidCkey)
						shop.owner = shop.bidCkey
						mail(shop.owner, "You won the bid on [shop.id] shop.")

					shop.bidCkey  = null
					shop.bidCount = 0

			// elects major guilds
			if(worldData.guilds && worldData.guilds.len >= 2)

				var/list/guilds = list()
				for(var/id in worldData.guilds)
					var/guild/g = worldData.guilds[id]
					guilds[id] = g.Score()

				bubblesort_by_value(guilds)

				worldData.majorChaos = guilds[1]
				worldData.majorPeace = guilds[guilds.len]

			// rep/fame decay + clean player data
			cleanPlayerData(0)

	RandomEvents
		fire()
			set waitfor = 0

			if(classdest || clanwars)
{'fraction_non_alphanumeric': 0.11290866194809572, 'fraction_numerical': 0.0262891809908999, 'mean_word_length': 3.1186675919500346, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '472193', 'n_tokens_mistral': 2610, 'n_tokens_neox': 2026, 'n_words': 427}