From 8cb7edda3f424bd06745e2042a1fb2ec6aef98bf Mon Sep 17 00:00:00 2001
From: Florian Aucomte <33633200+faucomte97@users.noreply.github.com>
Date: Thu, 30 Nov 2023 16:35:35 +0000
Subject: [PATCH 1/2] feat: Enable automatic Christmas theme in December
(#1538)
* feat: Enable automatic Christmas theme in December
* Add test
* Merge branch 'master' into automatic_rudolph
* Update CFC xmas URL for grass theme
* Merge branch 'master' into automatic_rudolph
* Merge branch 'master' into automatic_rudolph
---
game/character.py | 36 +-
game/decor.py | 229 +-
game/level_management.py | 1 +
.../game/image/characters/top_view/Sleigh.svg | 436 +
game/static/game/image/decor/snow/barn.svg | 1788 ++++
game/static/game/image/decor/snow/cfc.svg | 1197 ++-
game/static/game/image/decor/snow/crops.svg | 7370 +++++++++++++++++
.../static/game/image/decor/snow/hospital.svg | 1220 +++
game/static/game/image/decor/snow/house1.svg | 971 +++
game/static/game/image/decor/snow/house2.svg | 1574 ++++
game/static/game/image/decor/snow/school.svg | 1071 +++
game/static/game/image/decor/snow/shop.svg | 3211 +++++++
game/static/game/js/drawing.js | 5 +-
game/static/game/js/game.js | 4 +
.../characters/top_view/Sleigh.svg | 436 +
.../game/raphael_image/decor/snow/barn.svg | 1788 ++++
.../game/raphael_image/decor/snow/cfc.svg | 1197 ++-
.../game/raphael_image/decor/snow/crops.svg | 7370 +++++++++++++++++
.../raphael_image/decor/snow/hospital.svg | 1220 +++
.../game/raphael_image/decor/snow/house1.svg | 971 +++
.../game/raphael_image/decor/snow/house2.svg | 1574 ++++
.../game/raphael_image/decor/snow/school.svg | 1071 +++
.../game/raphael_image/decor/snow/shop.svg | 3211 +++++++
.../game/raphael_image/sleigh_wreckage.svg | 430 +
game/templates/game/game.html | 174 +-
game/tests/test_level_selection.py | 69 +-
game/theme.py | 40 +-
game/views/level.py | 29 +-
28 files changed, 38134 insertions(+), 559 deletions(-)
create mode 100644 game/static/game/image/characters/top_view/Sleigh.svg
create mode 100644 game/static/game/image/decor/snow/barn.svg
create mode 100644 game/static/game/image/decor/snow/crops.svg
create mode 100644 game/static/game/image/decor/snow/hospital.svg
create mode 100644 game/static/game/image/decor/snow/house1.svg
create mode 100644 game/static/game/image/decor/snow/house2.svg
create mode 100644 game/static/game/image/decor/snow/school.svg
create mode 100644 game/static/game/image/decor/snow/shop.svg
create mode 100644 game/static/game/raphael_image/characters/top_view/Sleigh.svg
create mode 100644 game/static/game/raphael_image/decor/snow/barn.svg
create mode 100644 game/static/game/raphael_image/decor/snow/crops.svg
create mode 100644 game/static/game/raphael_image/decor/snow/hospital.svg
create mode 100644 game/static/game/raphael_image/decor/snow/house1.svg
create mode 100644 game/static/game/raphael_image/decor/snow/house2.svg
create mode 100644 game/static/game/raphael_image/decor/snow/school.svg
create mode 100644 game/static/game/raphael_image/decor/snow/shop.svg
create mode 100644 game/static/game/raphael_image/sleigh_wreckage.svg
diff --git a/game/character.py b/game/character.py
index 59a73629c..cb282964e 100644
--- a/game/character.py
+++ b/game/character.py
@@ -19,51 +19,51 @@ def __init__(self, pk, name, en_face, top_down, width, height):
CHARACTER_DATA = {
"Van": Character(
pk=1,
- name=u"Van",
+ name="Van",
# FUTURE: add external branding option
- en_face=u"characters/front_view/Van.svg",
- top_down=u"characters/top_view/Van.svg",
+ en_face="characters/front_view/Van.svg",
+ top_down="characters/top_view/Van.svg",
height="20",
width="40",
),
"Dee": Character(
pk=2,
- name=u"Dee",
+ name="Dee",
# FUTURE: add external branding option
- en_face=u"characters/front_view/Dee.svg",
- top_down=u"characters/top_view/Dee.svg",
+ en_face="characters/front_view/Dee.svg",
+ top_down="characters/top_view/Dee.svg",
height="28",
width="52",
),
"Nigel": Character(
pk=3,
- name=u"Nigel",
- en_face=u"characters/front_view/Nigel.svg",
- top_down=u"characters/top_view/Nigel.svg",
+ name="Nigel",
+ en_face="characters/front_view/Nigel.svg",
+ top_down="characters/top_view/Nigel.svg",
height="32",
width="56",
),
"Kirsty": Character(
pk=4,
- name=u"Kirsty",
- en_face=u"characters/front_view/Kirsty.svg",
- top_down=u"characters/top_view/Kirsty.svg",
+ name="Kirsty",
+ en_face="characters/front_view/Kirsty.svg",
+ top_down="characters/top_view/Kirsty.svg",
height="32",
width="60",
),
"Wes": Character(
pk=5,
- name=u"Wes",
- en_face=u"characters/front_view/Wes.svg",
- top_down=u"characters/top_view/Wes.svg",
+ name="Wes",
+ en_face="characters/front_view/Wes.svg",
+ top_down="characters/top_view/Wes.svg",
height="20",
width="40",
),
"Phil": Character(
pk=6,
- name=u"Phil",
- en_face=u"characters/front_view/Phil.svg",
- top_down=u"characters/top_view/Phil.svg",
+ name="Phil",
+ en_face="characters/front_view/Phil.svg",
+ top_down="characters/top_view/Phil.svg",
height="40",
width="40",
),
diff --git a/game/decor.py b/game/decor.py
index 539c1aed9..51d070475 100644
--- a/game/decor.py
+++ b/game/decor.py
@@ -3,15 +3,18 @@
"""
from builtins import object
+
from rest_framework.reverse import reverse
+
from game.theme import get_theme, get_all_themes
class Decor(object):
- def __init__(self, pk, name, url, width, height, theme, z_index):
+ def __init__(self, pk, name, url, xmas_url, width, height, theme, z_index):
self.id = self.pk = pk
self.name = name
self.url = url
+ self.xmas_url = xmas_url
self.width = width
self.height = height
self.theme = theme
@@ -19,292 +22,324 @@ def __init__(self, pk, name, url, width, height, theme, z_index):
DECOR_DATA = {
- (u"tree1", u"grass"): Decor(
+ ("tree1", "grass"): Decor(
z_index=4,
- name=u"tree1",
- url=u"decor/grass/tree1.svg",
+ name="tree1",
+ url="decor/grass/tree1.svg",
+ xmas_url="decor/snow/tree1.svg",
height=100,
width=100,
theme=get_theme("grass"),
pk=1,
),
- (u"tree2", u"grass"): Decor(
+ ("tree2", "grass"): Decor(
z_index=4,
- name=u"tree2",
- url=u"decor/grass/tree2.svg",
+ name="tree2",
+ url="decor/grass/tree2.svg",
+ xmas_url="decor/snow/tree2.svg",
height=100,
width=100,
theme=get_theme("grass"),
pk=2,
),
- (u"bush", u"grass"): Decor(
+ ("bush", "grass"): Decor(
z_index=3,
- name=u"bush",
- url=u"decor/grass/bush.svg",
+ name="bush",
+ url="decor/grass/bush.svg",
+ xmas_url="decor/snow/bush.svg",
height=50,
width=50,
theme=get_theme("grass"),
pk=3,
),
- (u"house", u"grass"): Decor(
+ ("house", "grass"): Decor(
z_index=1,
- name=u"house",
- url=u"decor/grass/house.svg",
+ name="house",
+ url="decor/grass/house.svg",
+ xmas_url="decor/snow/house.svg",
height=50,
width=50,
theme=get_theme("grass"),
pk=4,
),
- (u"cfc", u"grass"): Decor(
+ ("cfc", "grass"): Decor(
z_index=1,
- name=u"cfc",
+ name="cfc",
# FUTURE: add external branding option
- url=u"decor/grass/cfc.svg",
+ url="decor/grass/cfc.svg",
+ xmas_url="decor/snow/cfc.svg",
height=107,
width=100,
theme=get_theme("grass"),
pk=5,
),
- (u"pond", u"grass"): Decor(
+ ("pond", "grass"): Decor(
z_index=2,
- name=u"pond",
- url=u"decor/grass/pond.svg",
+ name="pond",
+ url="decor/grass/pond.svg",
+ xmas_url="decor/snow/pond.svg",
height=100,
width=150,
theme=get_theme("grass"),
pk=6,
),
- (u"tree1", u"snow"): Decor(
+ ("tree1", "snow"): Decor(
z_index=4,
- name=u"tree1",
- url=u"decor/snow/tree1.svg",
+ name="tree1",
+ url="decor/snow/tree1.svg",
+ xmas_url="decor/snow/tree1.svg",
height=100,
width=100,
theme=get_theme("snow"),
pk=7,
),
- (u"tree2", u"snow"): Decor(
+ ("tree2", "snow"): Decor(
z_index=4,
- name=u"tree2",
- url=u"decor/snow/tree2.svg",
+ name="tree2",
+ url="decor/snow/tree2.svg",
+ xmas_url="decor/snow/tree2.svg",
height=100,
width=100,
theme=get_theme("snow"),
pk=8,
),
- (u"bush", u"snow"): Decor(
+ ("bush", "snow"): Decor(
z_index=3,
- name=u"bush",
- url=u"decor/snow/bush.svg",
+ name="bush",
+ url="decor/snow/bush.svg",
+ xmas_url="decor/snow/bush.svg",
height=50,
width=50,
theme=get_theme("snow"),
pk=9,
),
- (u"house", u"snow"): Decor(
+ ("house", "snow"): Decor(
z_index=1,
- name=u"house",
- url=u"decor/snow/house.svg",
+ name="house",
+ url="decor/snow/house.svg",
+ xmas_url="decor/snow/house.svg",
height=50,
width=50,
theme=get_theme("snow"),
pk=10,
),
- (u"cfc", u"snow"): Decor(
+ ("cfc", "snow"): Decor(
z_index=1,
- name=u"cfc",
+ name="cfc",
# FUTURE: add external branding option
- url=u"decor/snow/cfc.svg",
+ url="decor/snow/cfc.svg",
+ xmas_url="decor/snow/cfc.svg",
height=107,
width=100,
theme=get_theme("snow"),
pk=11,
),
- (u"pond", u"snow"): Decor(
+ ("pond", "snow"): Decor(
z_index=2,
- name=u"pond",
- url=u"decor/snow/pond.svg",
+ name="pond",
+ url="decor/snow/pond.svg",
+ xmas_url="decor/snow/pond.svg",
height=100,
width=150,
theme=get_theme("snow"),
pk=12,
),
- (u"tile1", u"grass"): Decor(
+ ("tile1", "grass"): Decor(
z_index=0,
- name=u"tile1",
- url=u"decor/grass/tile1.svg",
+ name="tile1",
+ url="decor/grass/tile1.svg",
+ xmas_url="decor/snow/tile1.svg",
height=100,
width=100,
theme=get_theme("grass"),
pk=13,
),
- (u"tile1", u"snow"): Decor(
+ ("tile1", "snow"): Decor(
z_index=0,
- name=u"tile1",
- url=u"decor/snow/tile1.svg",
+ name="tile1",
+ url="decor/snow/tile1.svg",
+ xmas_url="decor/snow/tile1.svg",
height=100,
width=100,
theme=get_theme("snow"),
pk=14,
),
- (u"tile2", u"snow"): Decor(
+ ("tile2", "snow"): Decor(
z_index=0,
- name=u"tile2",
- url=u"decor/snow/tile2.svg",
+ name="tile2",
+ url="decor/snow/tile2.svg",
+ xmas_url="decor/snow/tile2.svg",
height=100,
width=100,
theme=get_theme("snow"),
pk=15,
),
- (u"house", u"farm"): Decor(
+ ("house", "farm"): Decor(
z_index=1,
- name=u"house",
- url=u"decor/farm/house1.svg",
+ name="house",
+ url="decor/farm/house1.svg",
+ xmas_url="decor/snow/house1.svg",
height=224,
width=184,
theme=get_theme("farm"),
pk=16,
),
- (u"cfc", u"farm"): Decor(
+ ("cfc", "farm"): Decor(
z_index=1,
- name=u"cfc",
- url=u"decor/farm/cfc.svg",
+ name="cfc",
+ url="decor/farm/cfc.svg",
+ xmas_url="decor/snow/barn.svg",
height=301,
width=332,
theme=get_theme("farm"),
pk=17,
),
- (u"bush", u"farm"): Decor(
+ ("bush", "farm"): Decor(
z_index=3,
- name=u"bush",
- url=u"decor/farm/bush.svg",
+ name="bush",
+ url="decor/farm/bush.svg",
+ xmas_url="decor/snow/bush.svg",
height=30,
width=50,
theme=get_theme("farm"),
pk=18,
),
- (u"tree1", u"farm"): Decor(
+ ("tree1", "farm"): Decor(
z_index=4,
- name=u"tree1",
- url=u"decor/farm/tree1.svg",
+ name="tree1",
+ url="decor/farm/tree1.svg",
+ xmas_url="decor/snow/tree1.svg",
height=100,
width=100,
theme=get_theme("farm"),
pk=19,
),
- (u"tree2", u"farm"): Decor(
+ ("tree2", "farm"): Decor(
z_index=4,
- name=u"tree2",
- url=u"decor/farm/house2.svg",
+ name="tree2",
+ url="decor/farm/house2.svg",
+ xmas_url="decor/snow/house.svg",
height=88,
width=65,
theme=get_theme("farm"),
pk=20,
),
- (u"pond", u"farm"): Decor(
+ ("pond", "farm"): Decor(
z_index=2,
- name=u"pond",
- url=u"decor/farm/crops.svg",
+ name="pond",
+ url="decor/farm/crops.svg",
+ xmas_url="decor/snow/crops.svg",
height=100,
width=150,
theme=get_theme("farm"),
pk=21,
),
- (u"tile1", u"farm"): Decor(
+ ("tile1", "farm"): Decor(
z_index=0,
- name=u"tile1",
- url=u"decor/farm/tile1.svg",
+ name="tile1",
+ url="decor/farm/tile1.svg",
+ xmas_url="decor/snow/tile1.svg",
height=337,
width=194,
theme=get_theme("farm"),
pk=22,
),
- (u"tile1", u"city"): Decor(
+ ("tile1", "city"): Decor(
z_index=0,
- name=u"tile1",
- url=u"decor/city/pavementTile.png",
+ name="tile1",
+ url="decor/city/pavementTile.png",
+ xmas_url="decor/snow/tile1.svg",
height=100,
width=100,
theme=get_theme("city"),
pk=23,
),
- (u"house", u"city"): Decor(
+ ("house", "city"): Decor(
z_index=1,
- name=u"house",
- url=u"decor/city/house.svg",
+ name="house",
+ url="decor/city/house.svg",
+ xmas_url="decor/snow/house2.svg",
height=50,
width=50,
theme=get_theme("city"),
pk=24,
),
- (u"bush", u"city"): Decor(
+ ("bush", "city"): Decor(
z_index=3,
- name=u"bush",
- url=u"decor/city/bush.svg",
+ name="bush",
+ url="decor/city/bush.svg",
+ xmas_url="decor/snow/bush.svg",
height=50,
width=50,
theme=get_theme("city"),
pk=25,
),
- (u"tree1", u"city"): Decor(
+ ("tree1", "city"): Decor(
z_index=4,
- name=u"tree1",
- url=u"decor/city/shop.svg",
+ name="tree1",
+ url="decor/city/shop.svg",
+ xmas_url="decor/snow/shop.svg",
height=70,
width=70,
theme=get_theme("city"),
pk=26,
),
- (u"tree2", u"city"): Decor(
+ ("tree2", "city"): Decor(
z_index=4,
- name=u"tree2",
- url=u"decor/city/school.svg",
+ name="tree2",
+ url="decor/city/school.svg",
+ xmas_url="decor/snow/school.svg",
height=100,
width=100,
theme=get_theme("city"),
pk=27,
),
- (u"pond", u"city"): Decor(
+ ("pond", "city"): Decor(
z_index=2,
- name=u"pond",
- url=u"decor/city/hospital.svg",
+ name="pond",
+ url="decor/city/hospital.svg",
+ xmas_url="decor/snow/hospital.svg",
height=157,
width=140,
theme=get_theme("city"),
pk=28,
),
- (u"cfc", u"city"): Decor(
+ ("cfc", "city"): Decor(
z_index=1,
- name=u"cfc",
+ name="cfc",
# FUTURE: add external branding option
- url=u"decor/grass/cfc.svg",
+ url="decor/grass/cfc.svg",
+ xmas_url="decor/snow/cfc.svg",
height=107,
width=100,
theme=get_theme("city"),
pk=29,
),
- (u"tile2", u"grass"): Decor(
+ ("tile2", "grass"): Decor(
z_index=0,
- name=u"tile2",
- url=u"decor/snow/tile2.svg",
+ name="tile2",
+ url="decor/snow/tile2.svg",
+ xmas_url="decor/snow/tile2.svg",
height=100,
width=100,
theme=get_theme("grass"),
pk=30,
),
- (u"tile2", u"farm"): Decor(
+ ("tile2", "farm"): Decor(
z_index=0,
- name=u"tile2",
- url=u"decor/snow/tile2.svg",
+ name="tile2",
+ url="decor/snow/tile2.svg",
+ xmas_url="decor/snow/tile2.svg",
height=100,
width=100,
theme=get_theme("farm"),
pk=31,
),
- (u"tile2", u"city"): Decor(
+ ("tile2", "city"): Decor(
z_index=0,
- name=u"tile2",
- url=u"decor/snow/tile2.svg",
+ name="tile2",
+ url="decor/snow/tile2.svg",
+ xmas_url="decor/snow/tile2.svg",
height=100,
width=100,
theme=get_theme("city"),
diff --git a/game/level_management.py b/game/level_management.py
index 96c119884..5182385fb 100644
--- a/game/level_management.py
+++ b/game/level_management.py
@@ -66,6 +66,7 @@ def get_decor(level):
"width": int(decor.width),
"height": int(decor.height),
"url": str(decor.url),
+ "xmas_url": str(decor.xmas_url),
}
)
diff --git a/game/static/game/image/characters/top_view/Sleigh.svg b/game/static/game/image/characters/top_view/Sleigh.svg
new file mode 100644
index 000000000..8303bf7e9
--- /dev/null
+++ b/game/static/game/image/characters/top_view/Sleigh.svg
@@ -0,0 +1,436 @@
+
+
+
diff --git a/game/static/game/image/decor/snow/barn.svg b/game/static/game/image/decor/snow/barn.svg
new file mode 100644
index 000000000..6c27b2198
--- /dev/null
+++ b/game/static/game/image/decor/snow/barn.svg
@@ -0,0 +1,1788 @@
+
+
+
diff --git a/game/static/game/image/decor/snow/cfc.svg b/game/static/game/image/decor/snow/cfc.svg
index 0e5acfbf4..249d76137 100644
--- a/game/static/game/image/decor/snow/cfc.svg
+++ b/game/static/game/image/decor/snow/cfc.svg
@@ -1,160 +1,1063 @@
-
+
diff --git a/game/static/game/image/decor/snow/crops.svg b/game/static/game/image/decor/snow/crops.svg
new file mode 100644
index 000000000..ebb748e8d
--- /dev/null
+++ b/game/static/game/image/decor/snow/crops.svg
@@ -0,0 +1,7370 @@
+
+
+
diff --git a/game/static/game/image/decor/snow/hospital.svg b/game/static/game/image/decor/snow/hospital.svg
new file mode 100644
index 000000000..c28973abd
--- /dev/null
+++ b/game/static/game/image/decor/snow/hospital.svg
@@ -0,0 +1,1220 @@
+
+
+
diff --git a/game/static/game/image/decor/snow/house1.svg b/game/static/game/image/decor/snow/house1.svg
new file mode 100644
index 000000000..7b33f66d2
--- /dev/null
+++ b/game/static/game/image/decor/snow/house1.svg
@@ -0,0 +1,971 @@
+
+
+
diff --git a/game/static/game/image/decor/snow/house2.svg b/game/static/game/image/decor/snow/house2.svg
new file mode 100644
index 000000000..a15942f9b
--- /dev/null
+++ b/game/static/game/image/decor/snow/house2.svg
@@ -0,0 +1,1574 @@
+
+
+
diff --git a/game/static/game/image/decor/snow/school.svg b/game/static/game/image/decor/snow/school.svg
new file mode 100644
index 000000000..96a671727
--- /dev/null
+++ b/game/static/game/image/decor/snow/school.svg
@@ -0,0 +1,1071 @@
+
+
+
diff --git a/game/static/game/image/decor/snow/shop.svg b/game/static/game/image/decor/snow/shop.svg
new file mode 100644
index 000000000..7af5f6eae
--- /dev/null
+++ b/game/static/game/image/decor/snow/shop.svg
@@ -0,0 +1,3211 @@
+
+
+
diff --git a/game/static/game/js/drawing.js b/game/static/game/js/drawing.js
index 8cefe64ad..806551491 100644
--- a/game/static/game/js/drawing.js
+++ b/game/static/game/js/drawing.js
@@ -668,7 +668,8 @@ ocargo.Drawing = function (startingPosition) {
this.renderDecor = function (decors) {
for (let i = 0; i < decors.length; i++) {
let decor = decors[i]
- let src = ocargo.Drawing.raphaelImageDir + decor.url
+ let decorUrl = new Date().getMonth() === 11 ? decor.xmas_url : decor.url
+ let src = ocargo.Drawing.raphaelImageDir + decorUrl
let x = decor.x + PAPER_PADDING
let y = PAPER_HEIGHT - decor.y - decor.height + PAPER_PADDING
let width = decor.width
@@ -903,7 +904,7 @@ ocargo.Drawing = function (startingPosition) {
for (let j = 0; j < GRID_HEIGHT; j++) {
grid[i][j].attr({
stroke: currentTheme.border,
- fill: currentTheme.background,
+ fill: new Date().getMonth() === 11 ? THEMES.snow.background : currentTheme.background,
'fill-opacity': 1
})
}
diff --git a/game/static/game/js/game.js b/game/static/game/js/game.js
index 1086ac286..485ef39ae 100644
--- a/game/static/game/js/game.js
+++ b/game/static/game/js/game.js
@@ -10,6 +10,10 @@ ocargo.Game = function () {
}
ocargo.Game.prototype.setup = function () {
+ if(new Date().getMonth() === 11) {
+ $("#paper").css('background-color', '#eef7ff')
+ }
+
if (NIGHT_MODE_FEATURE_ENABLED) {
if (NIGHT_MODE) {
$('#paper').css('background-color', 'black')
diff --git a/game/static/game/raphael_image/characters/top_view/Sleigh.svg b/game/static/game/raphael_image/characters/top_view/Sleigh.svg
new file mode 100644
index 000000000..8303bf7e9
--- /dev/null
+++ b/game/static/game/raphael_image/characters/top_view/Sleigh.svg
@@ -0,0 +1,436 @@
+
+
+
diff --git a/game/static/game/raphael_image/decor/snow/barn.svg b/game/static/game/raphael_image/decor/snow/barn.svg
new file mode 100644
index 000000000..6c27b2198
--- /dev/null
+++ b/game/static/game/raphael_image/decor/snow/barn.svg
@@ -0,0 +1,1788 @@
+
+
+
diff --git a/game/static/game/raphael_image/decor/snow/cfc.svg b/game/static/game/raphael_image/decor/snow/cfc.svg
index 0e5acfbf4..249d76137 100644
--- a/game/static/game/raphael_image/decor/snow/cfc.svg
+++ b/game/static/game/raphael_image/decor/snow/cfc.svg
@@ -1,160 +1,1063 @@
-
+
diff --git a/game/static/game/raphael_image/decor/snow/crops.svg b/game/static/game/raphael_image/decor/snow/crops.svg
new file mode 100644
index 000000000..ebb748e8d
--- /dev/null
+++ b/game/static/game/raphael_image/decor/snow/crops.svg
@@ -0,0 +1,7370 @@
+
+
+
diff --git a/game/static/game/raphael_image/decor/snow/hospital.svg b/game/static/game/raphael_image/decor/snow/hospital.svg
new file mode 100644
index 000000000..c28973abd
--- /dev/null
+++ b/game/static/game/raphael_image/decor/snow/hospital.svg
@@ -0,0 +1,1220 @@
+
+
+
diff --git a/game/static/game/raphael_image/decor/snow/house1.svg b/game/static/game/raphael_image/decor/snow/house1.svg
new file mode 100644
index 000000000..7b33f66d2
--- /dev/null
+++ b/game/static/game/raphael_image/decor/snow/house1.svg
@@ -0,0 +1,971 @@
+
+
+
diff --git a/game/static/game/raphael_image/decor/snow/house2.svg b/game/static/game/raphael_image/decor/snow/house2.svg
new file mode 100644
index 000000000..a15942f9b
--- /dev/null
+++ b/game/static/game/raphael_image/decor/snow/house2.svg
@@ -0,0 +1,1574 @@
+
+
+
diff --git a/game/static/game/raphael_image/decor/snow/school.svg b/game/static/game/raphael_image/decor/snow/school.svg
new file mode 100644
index 000000000..96a671727
--- /dev/null
+++ b/game/static/game/raphael_image/decor/snow/school.svg
@@ -0,0 +1,1071 @@
+
+
+
diff --git a/game/static/game/raphael_image/decor/snow/shop.svg b/game/static/game/raphael_image/decor/snow/shop.svg
new file mode 100644
index 000000000..7af5f6eae
--- /dev/null
+++ b/game/static/game/raphael_image/decor/snow/shop.svg
@@ -0,0 +1,3211 @@
+
+
+
diff --git a/game/static/game/raphael_image/sleigh_wreckage.svg b/game/static/game/raphael_image/sleigh_wreckage.svg
new file mode 100644
index 000000000..9f23e5e6e
--- /dev/null
+++ b/game/static/game/raphael_image/sleigh_wreckage.svg
@@ -0,0 +1,430 @@
+
+
+
diff --git a/game/templates/game/game.html b/game/templates/game/game.html
index 81a6024e6..224025a20 100644
--- a/game/templates/game/game.html
+++ b/game/templates/game/game.html
@@ -14,69 +14,69 @@
data-traffic-lights="{{level.traffic_lights|trim}}"
data-cows="{{level.cows|trim}}"
data-episode="{{level.episode.id|trim}}"
- data-level-id="{{level.id|default_if_none:""|trim}}"
+ data-level-id="{{level.id|default_if_none:''|trim}}"
data-level-name="{{level.name|trim}}"
>
- var ANONYMOUS = {{level.anonymous|booltojs}};
- var PATH = $('#data').data('path');
- var ORIGIN = $('#data').data('origin');
- var DESTINATIONS = $('#data').data('destinations');
- var DECOR = {{decor|safe}};
- var BACKGROUND_URL = "{{background}}";
- var HOUSE_URL = "{{house}}";
- var CFC_URL = "{{cfc}}";
- var TRAFFIC_LIGHTS = $('#data').data('trafficLights');
- var COWS = $('#data').data('cows');
- var EPISODE = $('#data').data('episode');
- var LEVEL_ID = $('#data').data('levelId');
- var LEVEL_NAME = $('#data').data('levelName');
- var PREV_LEVEL_URL = "{% if prev_level_url %}{{prev_level_url}}{% else %}{% endif %}";
- var NEXT_LEVEL_URL = "{% if next_level_url %}{{next_level_url}}{% else %}{% endif %}";
- var MODEL_SOLUTION = {{model_solution|default:"[]"}};
- var DISABLE_ROUTE_SCORE = {{level.disable_route_score|booltojs}};
- var DISABLE_ALGORITHM_SCORE = {{level.disable_algorithm_score|booltojs}};
- var LESSON = "{{lesson|escapejs}}";
- var HINT = "{{hint|escapejs}}";
- var DEFAULT_LEVEL = {{level.default|booltojs}};
- var FUEL_GAUGE = {{level.fuel_gauge|booltojs}};
- var CHARACTER_NAME = "{{character.name}}";
- var CHARACTER_EN_FACE_URL = "{{character.en_face}}";
- var CHARACTER_URL = "{{character_url}}";
- var CHARACTER_HEIGHT = "{{character_height}}";
- var CHARACTER_WIDTH = "{{character_width}}";
- var WRECKAGE_URL = "{{wreckage_url}}";
- var NIGHT_MODE_FEATURE_ENABLED = {{night_mode_feature_enabled}};
- var NIGHT_MODE = {{night_mode}};
- var FLIP_NIGHT_MODE_URL = "{{flip_night_mode_url|default:""}}";
- var USER_LOGGED_IN = {{request.user.is_authenticated|booltojs}};
-
- var RANDOM = {{episode.random_levels_enabled|booltojs}};
- var IS_RANDOM_LEVEL = {{random_level|booltojs}};
-
- var BLOCKS = [];
- var maxInstances = {};
+ var ANONYMOUS = {{level.anonymous|booltojs}}
+ var PATH = $('#data').data('path')
+ var ORIGIN = $('#data').data('origin')
+ var DESTINATIONS = $('#data').data('destinations')
+ var DECOR = {{decor|safe}}
+ var BACKGROUND_URL = "{{background}}"
+ var HOUSE_URL = "{{house}}"
+ var CFC_URL = "{{cfc}}"
+ var TRAFFIC_LIGHTS = $('#data').data('trafficLights')
+ var COWS = $('#data').data('cows')
+ var EPISODE = $('#data').data('episode')
+ var LEVEL_ID = $('#data').data('levelId')
+ var LEVEL_NAME = $('#data').data('levelName')
+ var PREV_LEVEL_URL = "{% if prev_level_url %}{{prev_level_url}}{% else %}{% endif %}"
+ var NEXT_LEVEL_URL = "{% if next_level_url %}{{next_level_url}}{% else %}{% endif %}"
+ var MODEL_SOLUTION = {{model_solution|default:"[]"}}
+ var DISABLE_ROUTE_SCORE = {{level.disable_route_score|booltojs}}
+ var DISABLE_ALGORITHM_SCORE = {{level.disable_algorithm_score|booltojs}}
+ var LESSON = "{{lesson|escapejs}}"
+ var HINT = "{{hint|escapejs}}"
+ var DEFAULT_LEVEL = {{level.default|booltojs}}
+ var FUEL_GAUGE = {{level.fuel_gauge|booltojs}}
+ var CHARACTER_NAME = "{{character.name}}"
+ var CHARACTER_EN_FACE_URL = "{{character.en_face}}"
+ var CHARACTER_URL = "{{character_url}}"
+ var CHARACTER_HEIGHT = "{{character_height}}"
+ var CHARACTER_WIDTH = "{{character_width}}"
+ var WRECKAGE_URL = "{{wreckage_url}}"
+ var NIGHT_MODE_FEATURE_ENABLED = {{night_mode_feature_enabled}}
+ var NIGHT_MODE = {{night_mode}}
+ var FLIP_NIGHT_MODE_URL = "{{flip_night_mode_url|default:""}}"
+ var USER_LOGGED_IN = {{request.user.is_authenticated|booltojs}}
+
+ var RANDOM = {{episode.random_levels_enabled|booltojs}}
+ var IS_RANDOM_LEVEL = {{random_level|booltojs}}
+
+ var BLOCKS = []
+ var maxInstances = {}
{% for block in blocks %}
- BLOCKS.push({'type':"{{block.type}}"{% if block.number %}, 'number':{{block.number}} {% endif %}});
+ BLOCKS.push({'type':"{{block.type}}"{% if block.number %}, 'number':{{block.number}} {% endif %}})
{% if block.number %}
- maxInstances["{{block.type}}"] = {{block.number}};
+ maxInstances["{{block.type}}"] = {{block.number}}
{% endif %}
{% endfor %}
- var BLOCKLY_XML = '';
+ var BLOCKLY_XML = ''
for (var i = 0; i < BLOCKS.length; i++) {
- BLOCKLY_XML += '';
+ BLOCKLY_XML += ''
}
- BLOCKLY_XML += '';
- var MAX_FUEL = {{level.max_fuel}};
- var DIRECT_DRIVE = {{level.direct_drive|booltojs}};
- var NEXT_EPISODE = {% if level.episode.next_episode == None %}null{% else %}"{{level.episode.next_episode.id}}"{% endif %};
- var WORKSPACE = {% if workspace == None %}null{% else %}"{{workspace}}"{% endif %};
- var BLOCKLY_ENABLED = {{level.blocklyEnabled|booltojs}};
- var PYTHON_ENABLED = {{level.pythonEnabled|booltojs}};
- var PYTHON_VIEW_ENABLED = {{level.pythonViewEnabled|booltojs}};
- var RETURN_URL = "{{return_url}}";
- var PYTHON_WORKSPACE = {% if python_workspace == None %}null{% else %}"{{python_workspace|linebreaksbr}}"{% endif %};
+ BLOCKLY_XML += ''
+ var MAX_FUEL = {{level.max_fuel}}
+ var DIRECT_DRIVE = {{level.direct_drive|booltojs}}
+ var NEXT_EPISODE = {% if level.episode.next_episode == None %}null{% else %}"{{level.episode.next_episode.id}}"{% endif %}
+ var WORKSPACE = {% if workspace == None %}null{% else %}"{{workspace}}"{% endif %}
+ var BLOCKLY_ENABLED = {{level.blocklyEnabled|booltojs}}
+ var PYTHON_ENABLED = {{level.pythonEnabled|booltojs}}
+ var PYTHON_VIEW_ENABLED = {{level.pythonViewEnabled|booltojs}}
+ var RETURN_URL = "{{return_url}}"
+ var PYTHON_WORKSPACE = {% if python_workspace == None %}null{% else %}"{{python_workspace|linebreaksbr}}"{% endif %}
@@ -144,7 +144,7 @@
{% block content %}
{{ block.super }}
-
+
@@ -155,14 +155,14 @@
@@ -170,7 +170,7 @@
@@ -180,7 +180,7 @@
@@ -189,7 +189,7 @@
@@ -197,7 +197,7 @@
@@ -205,25 +205,25 @@
-
+
{% if request.user.is_authenticated %}
-
+
@@ -231,16 +231,16 @@
{% if user|get_user_status == 'TEACHER' and not level.default%}
-
+
@@ -251,7 +251,7 @@
@@ -259,7 +259,7 @@
@@ -267,7 +267,7 @@
@@ -276,19 +276,19 @@
-
+
@@ -301,7 +301,7 @@
-
+
{% if level.pythonViewEnabled %}
@@ -327,7 +327,7 @@
{% trans "Python Program" %}
{% trans "Use the Python editor below to design your program, and then click play to try it out!" %}
@@ -340,7 +340,7 @@ {% trans "Python Program" %}
{% trans "Console log" %}
@@ -379,12 +379,12 @@
{% trans "Delete" %}
@@ -392,7 +392,7 @@ {% trans "Save" %}
+ {% trans "Save" %}
{% trans "Here you can save your program so you can retrieve it later!" %}