Added templates for Japanese THH.

master
Pacman Ghost 5 years ago
parent 418dc4732b
commit 620bf88244
  1. 7
      vasl_templates/webapp/data/default-template-pack/extras/thh-count.j2
  2. 44
      vasl_templates/webapp/data/default-template-pack/thh.j2
  3. 1
      vasl_templates/webapp/static/main.js
  4. 2
      vasl_templates/webapp/static/snippets.js
  5. 9
      vasl_templates/webapp/static/vassal.js
  6. 1
      vasl_templates/webapp/templates/tabs-ob1.html
  7. 1
      vasl_templates/webapp/tests/fixtures/data/default-template-pack/thh.j2
  8. 1
      vasl_templates/webapp/tests/fixtures/template-packs/full/thh.j2
  9. 1
      vasl_templates/webapp/tests/fixtures/template-packs/new-default/thh.j2
  10. 1
      vasl_templates/webapp/tests/test_ob.py
  11. 1
      vasl_templates/webapp/tests/utils.py

@ -0,0 +1,7 @@
<html> <!-- vasl-templates:id {{SNIPPET_ID}} -->
<!-- vasl-templates:name Tank-Hunter Hero count -->
<!-- vasl-templates:description Add the snippet as the label of a Tank-Hunter Hero counter, then press <i>Ctrl-L</i> when you need to update how many are left. -->
<!-- vasl-templates:comment The HTML is deliberately malformed, so that the number of remaining shots is the last thing in snippet, which makes it easier to change during the course of a game. -->
<div style="font-size:12px;font-weight:bold;"> {{THH_COUNT:/3|Number of THH}}

@ -0,0 +1,44 @@
<html> <!-- vasl-templates:id {{SNIPPET_ID}} -->
<head>
<meta charset="utf-8">
<style>
td { margin: 0 ; padding: 0 ; }
</style>
</head>
<table>
<tr>
<td colspan="3" style="
background: {{OB_COLOR}} ;
border-bottom: 1px solid {{OB_COLOR_2}} ;
padding: 2px 5px ;
font-weight: bold ;
">
{%if PLAYER_FLAG%}<img src="{{PLAYER_FLAG}}">&nbsp;{%endif%}Tank-Hunter Heroes
<tr>
<td valign="top" style="padding:2px 0 0 3px;">
THH creation: dr &le; 3 (&#9651;)
<table style="margin-left:10px;">
<tr>
<td style="width:20px;"> +2 <td> if Conscript
<tr>
<td> +1 <td> if HS
<tr>
<td> -2 <td> if DC Hero
</table>
original 6 = pinned (unless Banzai Charge)
<tr>
{% if SCENARIO_YEAR %}
<td valign="top" style="padding:10px 0 0 3px;">
ATMM check: dr &le; {%if SCENARIO_YEAR < 1944%} 2 {%else%} 3 {%endif%} (&#9651;)
{%endif%}
</table>
</html>

@ -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)." ;

@ -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

@ -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.

@ -35,6 +35,7 @@
<button class="generate" data-id="mol-p">MOL-P</button>
<button class="generate" data-id="baz">BAZ</button>
<button class="generate" data-id="piat">PIAT</button>
<button class="generate" data-id="thh">THH</button>
<button class="edit-template" data-id="ob_note"></button>
</span>
</div>

@ -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 ) )

@ -37,6 +37,7 @@ _NAT_TEMPLATES = {
"russian": [ "mol", "mol-p" ],
"american": [ "baz" ],
"british": [ "piat" ],
"japanese": [ "thh" ],
}
_webapp = None

Loading…
Cancel
Save