From 620bf8824451ff9a0220cd84a2d32e7c768bc022 Mon Sep 17 00:00:00 2001 From: Taka Date: Sun, 31 Mar 2019 10:51:25 +0000 Subject: [PATCH] Added templates for Japanese THH. --- .../default-template-pack/extras/thh-count.j2 | 7 +++ .../webapp/data/default-template-pack/thh.j2 | 44 +++++++++++++++++++ vasl_templates/webapp/static/main.js | 1 + vasl_templates/webapp/static/snippets.js | 2 + vasl_templates/webapp/static/vassal.js | 9 ++-- vasl_templates/webapp/templates/tabs-ob1.html | 1 + .../data/default-template-pack/thh.j2 | 1 + .../tests/fixtures/template-packs/full/thh.j2 | 1 + .../template-packs/new-default/thh.j2 | 1 + vasl_templates/webapp/tests/test_ob.py | 1 + vasl_templates/webapp/tests/utils.py | 1 + 11 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 vasl_templates/webapp/data/default-template-pack/extras/thh-count.j2 create mode 100644 vasl_templates/webapp/data/default-template-pack/thh.j2 create mode 100644 vasl_templates/webapp/tests/fixtures/data/default-template-pack/thh.j2 create mode 100644 vasl_templates/webapp/tests/fixtures/template-packs/full/thh.j2 create mode 100644 vasl_templates/webapp/tests/fixtures/template-packs/new-default/thh.j2 diff --git a/vasl_templates/webapp/data/default-template-pack/extras/thh-count.j2 b/vasl_templates/webapp/data/default-template-pack/extras/thh-count.j2 new file mode 100644 index 0000000..5260c2c --- /dev/null +++ b/vasl_templates/webapp/data/default-template-pack/extras/thh-count.j2 @@ -0,0 +1,7 @@ + + + + + + +
{{THH_COUNT:/3|Number of THH}} diff --git a/vasl_templates/webapp/data/default-template-pack/thh.j2 b/vasl_templates/webapp/data/default-template-pack/thh.j2 new file mode 100644 index 0000000..cc247fa --- /dev/null +++ b/vasl_templates/webapp/data/default-template-pack/thh.j2 @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + +{% if SCENARIO_YEAR %} +
+ {%if PLAYER_FLAG%} {%endif%}Tank-Hunter Heroes + +
+ THH creation: dr ≤ 3 (△) + + + + +
+2 if Conscript +
+1 if HS +
-2 if DC Hero +
+ original 6 = pinned (unless Banzai Charge) + +
+ ATMM check: dr ≤ {%if SCENARIO_YEAR < 1944%} 2 {%else%} 3 {%endif%} (△) +{%endif%} + +
+ + diff --git a/vasl_templates/webapp/static/main.js b/vasl_templates/webapp/static/main.js index 6dda418..f454bd4 100644 --- a/vasl_templates/webapp/static/main.js +++ b/vasl_templates/webapp/static/main.js @@ -15,6 +15,7 @@ var NATIONALITY_SPECIFIC_BUTTONS = { "german": [ "pf", "psk", "atmm" ], "american": [ "baz" ], "british": [ "piat" ], + "japanese": [ "thh" ], } ; GENERATE_SNIPPET_HINT = "Generate an HTML snippet (shift-click to get an image)." ; diff --git a/vasl_templates/webapp/static/snippets.js b/vasl_templates/webapp/static/snippets.js index 7d26e4f..0bfdf9b 100644 --- a/vasl_templates/webapp/static/snippets.js +++ b/vasl_templates/webapp/static/snippets.js @@ -359,6 +359,8 @@ function make_snippet( $btn, params, extra_params, show_date_warnings ) showWarningMsg( "BAZ are only available from November 1942." ) ; if ( template_id === "atmm" && ! is_atmm_available() ) showWarningMsg( "ATMM are only available from 1944." ) ; + if ( template_id == "thh" && ! params.SCENARIO_YEAR ) + showWarningMsg( "Can't determine the THH ATMM check dr without the scenario year." ) ; } // add in any extra parameters diff --git a/vasl_templates/webapp/static/vassal.js b/vasl_templates/webapp/static/vassal.js index 2c09dc1..1a967f7 100644 --- a/vasl_templates/webapp/static/vassal.js +++ b/vasl_templates/webapp/static/vassal.js @@ -164,9 +164,10 @@ function _generate_snippets() for ( var nat in NATIONALITY_SPECIFIC_BUTTONS ) { for ( var i=0 ; i < NATIONALITY_SPECIFIC_BUTTONS[nat].length ; ++i ) { var template_id = NATIONALITY_SPECIFIC_BUTTONS[nat][i] ; - if ( ["pf","atmm"].indexOf( template_id ) !== -1 ) { - // NOTE: PF and ATMM are always available as an inherent part of a squad's capabilities (subject to date restrictions), - // so we always auto-create these labels, unlike, say MOL or BAZ, which are only present by SSR or OB counter). + if ( ["pf","atmm","thh"].indexOf( template_id ) !== -1 ) { + // NOTE: PF, ATMM, THH are always available as an inherent part of a squad's capabilities + // (subject to date restrictions), so we always auto-create these labels, unlike, say MOL or BAZ, + // which are only present by SSR or OB counter). continue ; } no_autocreate[template_id] = true ; @@ -291,6 +292,8 @@ function _get_raw_content( snippet_id, $btn, params ) return [ "PIAT", "Range", "TH#", "B#", "TK#" ] ; if ( snippet_id === "baz" ) return [ "Bazooka", "Range", "TH#" ] ; + if ( snippet_id === "thh" ) + return [ "Tank-Hunter Heroes", "Banzai Charge" ] ; // handle vehicle/ordnance notes // NOTE: These were implemented after we added snippet ID's, so there's no need to support legacy labels. diff --git a/vasl_templates/webapp/templates/tabs-ob1.html b/vasl_templates/webapp/templates/tabs-ob1.html index 3b9093f..ba9f0f8 100644 --- a/vasl_templates/webapp/templates/tabs-ob1.html +++ b/vasl_templates/webapp/templates/tabs-ob1.html @@ -35,6 +35,7 @@ +
diff --git a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/thh.j2 b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/thh.j2 new file mode 100644 index 0000000..b633a27 --- /dev/null +++ b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/thh.j2 @@ -0,0 +1 @@ +Banzai!!! diff --git a/vasl_templates/webapp/tests/fixtures/template-packs/full/thh.j2 b/vasl_templates/webapp/tests/fixtures/template-packs/full/thh.j2 new file mode 100644 index 0000000..88559d6 --- /dev/null +++ b/vasl_templates/webapp/tests/fixtures/template-packs/full/thh.j2 @@ -0,0 +1 @@ +Customized THH. diff --git a/vasl_templates/webapp/tests/fixtures/template-packs/new-default/thh.j2 b/vasl_templates/webapp/tests/fixtures/template-packs/new-default/thh.j2 new file mode 100644 index 0000000..233ec60 --- /dev/null +++ b/vasl_templates/webapp/tests/fixtures/template-packs/new-default/thh.j2 @@ -0,0 +1 @@ +New default THH. diff --git a/vasl_templates/webapp/tests/test_ob.py b/vasl_templates/webapp/tests/test_ob.py index f3daa71..274d236 100644 --- a/vasl_templates/webapp/tests/test_ob.py +++ b/vasl_templates/webapp/tests/test_ob.py @@ -183,6 +183,7 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo "atmm": [ "german", check_atmm_snippets ], "baz": [ "american", check_baz_snippets ], "piat": [ "british", "piat template ; col=[OBCOL:british]/[OBCOL-BORDER:british]" ], + "thh": [ "japanese", "Banzai!!!" ], } btn_elems = { btn: find_child( "button[data-id='{}']".format( btn ) ) diff --git a/vasl_templates/webapp/tests/utils.py b/vasl_templates/webapp/tests/utils.py index a0e7f0e..12fd634 100644 --- a/vasl_templates/webapp/tests/utils.py +++ b/vasl_templates/webapp/tests/utils.py @@ -37,6 +37,7 @@ _NAT_TEMPLATES = { "russian": [ "mol", "mol-p" ], "american": [ "baz" ], "british": [ "piat" ], + "japanese": [ "thh" ], } _webapp = None