<!-- Train award -->
{% if p.award_count("train") %}
{% include "/awards/Christmas/Sleighs.html" %}
{% endif %}

<!-- Poop award -->
{% if p.award_count("shit") %}
<script defer src="/assets/CHRISTMAS/js/bugs.js?v=200"></script>
{% set minbugs = 10*p.award_count("shit") if p.award_count("shit") < 3 else 20 %}
{% set maxbugs = 20*p.award_count("shit") if p.award_count("shit") < 3 else 40 %}
<script>
	new BugController({
		imageSprite: "/assets/CHRISTMAS/images/fly-sprite.gif",
		canDie: false,
		minBugs: {{minbugs}},
		maxBugs: {{maxbugs}},
		mouseOver: "multiply"
	});
</script>
{% endif %}

<!-- Fireflies award -->
{% if p.award_count("fireflies") %}
<script defer src="/assets/CHRISTMAS/js/fireflies.js?v=200"></script>
{% set minbugs = 10*p.award_count("fireflies") if p.award_count("fireflies") < 3 else 20 %}
{% set maxbugs = 20*p.award_count("fireflies") if p.award_count("fireflies") < 3 else 40 %}
<script>
	new BugController({
		imageSprite: "/assets/CHRISTMAS/images/fireflies.gif",
		canDie: false,
		minBugs: {{minbugs}},
		maxBugs: {{maxbugs}},
		mouseOver: "multiply"
	});
</script>
{% endif %}

<!-- Christmas Awards -->

<!-- Ginger Marsey award -->
{% if p.award_count("gingerbread") %}
	{% include "/awards/Christmas/Gingerbread.html" %}
{% endif %}

<!-- Snow award -->
{% if p.award_count("snow") %}

{% include "/awards/Christmas/Snow.html" %}
{% if p.award_count("snow") > 5 %}
	<div class="frost"></div>
{% endif %}

{% set snowCount = p.award_count("snow") if p.award_count("snow") < 5 else 5 %}
<script defer>
	document.addEventListener('DOMContentLoaded', function(){
		var script = document.createElement('script');
		script.src = 'https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js';
		script.onload = function(){
			particlesJS("snow", {
				"particles": {
					"number": {
						"value": 60 * {{ snowCount }},
						"density": {
							"enable": true,
							"value_area": 800
						}
					},
					"color": {
						"value": "#ffffff"
					},
					"opacity": {
						"value": 0.7,
						"random": false,
						"anim": {
							"enable": false
						}
					},
					"size": {
						"value": 5,
						"random": true,
						"anim": {
							"enable": false
						}
					},
					"line_linked": {
						"enable": false
					},
					"move": {
						"enable": true,
						"speed": 4,
						"direction": "bottom",
						"random": true,
						"straight": false,
						"out_mode": "out",
						"bounce": false,
						"attract": {
							"enable": true,
							"rotateX": 300,
							"rotateY": 1200
						}
					}
				},
				"interactivity": {
					"events": {
						"onhover": {
							"enable": false
						},
						"onclick": {
							"enable": false
						},
						"resize": false
					}
				},
				"retina_detect": true
			});
		}
		document.head.append(script);
	});
</script>
{% endif %}

<!-- Songs & Fireplace awards (logged in) -->
{% if v and not v.grincheffect %}
	{% if p.award_count("snow") and p.award_count("fireplace") %}
		<script defer src="/assets/CHRISTMAS/js/christmas/deanmartin.js?v=200"></script>
	{% elif p.award_count("fireplace")%}
		<script defer src="/assets/CHRISTMAS/js/christmas/fireplace.js?v=200"></script>
	{% else %}
		<script defer src="/assets/CHRISTMAS/js/christmas/playlist.js?v=202"></script>
	{% endif %}
{% endif %}

<!-- Songs & Fireplace awards (logged out) -->
{% if not v %}
	{% if p.award_count("snow") and p.award_count("fireplace") %}
		<script defer src="/assets/CHRISTMAS/js/christmas/deanmartin.js?v=200"></script>
	{% elif p.award_count("fireplace")%}
		<script defer src="/assets/CHRISTMAS/js/christmas/fireplace.js?v=200"></script>
	{% else %}
		<script defer src="/assets/CHRISTMAS/js/christmas/playlist.js?v=202"></script>
	{% endif %}
{% endif %}

<!-- Fireplace award -->
{% if p.award_count("fireplace")%}
	{% include "/awards/Christmas/Fireplace.html" %}
{% endif %}

