code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" viewBox="0 0 1000 1000" style="enable-background:new 0 0 1000 1000;" xml:space="preserve" id="svg4356" sodipodi:docname="vector source.svg" inkscape:version="0.91 r13725">
  <metadata id="metadata4362">
    <rdf:RDF>
      <cc:Work rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
        <dc:title/>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <defs id="defs4360"/>
  <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1280" inkscape:window-height="952" id="namedview4358" showgrid="false" inkscape:zoom="1.2020815" inkscape:cx="434.47578" inkscape:cy="639.70571" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="svg4356" inkscape:object-nodes="true" inkscape:object-paths="false" inkscape:snap-smooth-nodes="true"/>
  <style type="text/css" id="style3680">
	.st0{fill:#FFFFFF;}
	.st1{fill:#76C043;}
	.st2{fill:#2680BC;}
	.st3{fill:#F6E0E8;}
	.st4{fill:#515351;}
	.st5{fill:#F4F1A3;}
	.st6{fill:#8E4F21;}
	.st7{fill:#BC2027;}
	.st8{fill:#60BB46;}
	.st9{fill:#4686C6;}
	.st10{fill:#D28DBD;}
	.st11{fill:#3F403F;}
	.st12{fill:#010101;}
	.st13{fill:#8F8F8E;}
	.st14{fill:#515251;}
	.st15{fill:#4F6AB2;}
	.st16{fill:#3E65B0;}
	.st17{fill:#15406D;}
	.st18{fill:#65AD45;}
	.st19{fill:#787878;}
	.st20{fill:#D76B93;}
	.st21{fill:#4DB748;}
	.st22{opacity:0.24;fill:#BF2126;enable-background:new    ;}
	.st23{fill:#070505;}
	.st24{fill:#BF2126;}
</style>
  <svg:g inkscape:groupmode="layer" id="Boob_5_straps" inkscape:label="Boob_5_straps" style="display:inline">
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 509.1,214.2 C 472.601,266.862 360.884,293.204 355.132,361.156" id="path7375" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 520.665,366.284 C 528.982,308.245 509.025,269.561 509.1,214.2" id="path7377" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 517.932,395.255 C 516.506,410.268 533.234,427.08 540.129,430.809" id="path7381" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 357.656,383.97 C 358.993,398.859 382.403,412.317 409.524,413.954" id="path7383" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 503.589,380.781 C 488.021,379.71 477.762,382.825 467.686,377.031" id="path7385" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 363.649,373.197 C 391.39,376.6 439.361,380.64 467.686,377.031" id="path7387" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 467.509,380.525 L 467.686,377.031 C 465.864,323.787 482.018,269.144 509.1,214.2" id="path7389" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc"/>
    <svg:path style="display:inline;fill:none;stroke:#b3b3b3;stroke-width:1.29999995;stroke-miterlimit:4;stroke-dasharray:none" inkscape:connector-curvature="0" d="M 354.25,361.436 C 358.444,360.729 362.352,366.45 363.086,370.638 C 363.909,375.338 362.568,383.163 357.865,383.967 C 353.588,384.699 350.473,378.058 349.768,373.777 C 349.057,369.459 349.935,362.164 354.25,361.436 Z" class="st20" id="path7391" sodipodi:nodetypes="ccccc"/>
    <svg:path style="display:inline;fill:none;stroke:#b3b3b3;stroke-width:1.29999983;stroke-miterlimit:4;stroke-dasharray:none" d="M 520.156,395.068 C 513.357,395.515 504.794,388.91 504.346,382.111 C 503.894,375.243 511.194,367.129 518.061,366.677 C 524.86,366.229 533.423,372.834 533.871,379.633 C 534.323,386.501 527.023,394.615 520.156,395.068 Z" id="path7393" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc"/>
    <svg:path id="path9222-3" style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 534.124,382.355 C 559.041,382.167 590.74,360.416 605.944,350.365 C 614.101,301.065 518.246,264.942 509.1,214.2" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc"/>
  </svg:g>
</svg>


code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" viewBox="0 0 1000 1000" style="enable-background:new 0 0 1000 1000;" xml:space="preserve" id="svg4356" sodipodi:docname="vector source.svg" inkscape:version="0.91 r13725">
  <metadata id="metadata4362">
    <rdf:RDF>
      <cc:Work rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
        <dc:title/>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <defs id="defs4360"/>
  <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1280" inkscape:window-height="952" id="namedview4358" showgrid="false" inkscape:zoom="1.2020815" inkscape:cx="434.47578" inkscape:cy="639.70571" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="svg4356" inkscape:object-nodes="true" inkscape:object-paths="false" inkscape:snap-smooth-nodes="true"/>
  <style type="text/css" id="style3680">
	.st0{fill:#FFFFFF;}
	.st1{fill:#76C043;}
	.st2{fill:#2680BC;}
	.st3{fill:#F6E0E8;}
	.st4{fill:#515351;}
	.st5{fill:#F4F1A3;}
	.st6{fill:#8E4F21;}
	.st7{fill:#BC2027;}
	.st8{fill:#60BB46;}
	.st9{fill:#4686C6;}
	.st10{fill:#D28DBD;}
	.st11{fill:#3F403F;}
	.st12{fill:#010101;}
	.st13{fill:#8F8F8E;}
	.st14{fill:#515251;}
	.st15{fill:#4F6AB2;}
	.st16{fill:#3E65B0;}
	.st17{fill:#15406D;}
	.st18{fill:#65AD45;}
	.st19{fill:#787878;}
	.st20{fill:#D76B93;}
	.st21{fill:#4DB748;}
	.st22{opacity:0.24;fill:#BF2126;enable-background:new    ;}
	.st23{fill:#070505;}
	.st24{fill:#BF2126;}
</style>
  <svg:g inkscape:groupmode="layer" id="Boob_6_straps" inkscape:label="Boob_6_straps" style="display:inline">
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 507.1,214.2 C 459.007,283.59 311.88,318.377 304.302,407.915" id="path7375" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 522.185,414.992 C 533.165,338.371 507.001,287.286 507.1,214.2" id="path7377" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 518.811,452.147 C 516.906,472.213 539.677,494.423 548.892,499.407" id="path7381" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 307.885,437.891 C 309.656,457.61 340.886,475.044 376.806,477.211" id="path7383" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 499.689,433.581 C 479.328,432.18 465.803,437.427 452.626,429.85" id="path7385" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 315.689,423.718 C 352.214,428.199 415.33,434.602 452.626,429.85" id="path7387" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 452.449,433.344 L 452.626,429.85 C 450.213,359.364 471.248,286.937 507.1,214.2" id="path7389" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc"/>
    <svg:path style="display:inline;fill:none;stroke:#b3b3b3;stroke-width:1.29999995;stroke-miterlimit:4;stroke-dasharray:none" inkscape:connector-curvature="0" d="M 303.15,408.236 C 308.67,407.305 313.959,414.696 314.924,420.21 C 316.014,426.432 314.321,436.823 308.094,437.888 C 302.454,438.853 298.419,430.037 297.489,424.392 C 296.562,418.761 297.524,409.186 303.15,408.236 Z" class="st20" id="path7391" sodipodi:nodetypes="ccccc"/>
    <svg:path style="display:inline;fill:none;stroke:#b3b3b3;stroke-width:1.29999983;stroke-miterlimit:4;stroke-dasharray:none" d="M 521.676,451.959 C 512.736,452.548 501.075,444.365 500.486,435.425 C 499.889,426.364 509.88,415.982 518.941,415.385 C 527.881,414.796 539.542,422.98 540.131,431.919 C 540.727,440.981 530.737,451.363 521.676,451.959 Z" id="path7393" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc"/>
    <svg:path id="path9222-3" style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 540.384,435.669 C 573.257,435.421 614.637,405.748 634.696,392.488 C 645.399,327.801 519.101,280.779 507.1,214.2" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc"/>
  </svg:g>
</svg>

license: mit


code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" viewBox="0 0 1000 1000" style="enable-background:new 0 0 1000 1000;" xml:space="preserve" id="svg4356" sodipodi:docname="vector source.svg" inkscape:version="0.91 r13725">
  <metadata id="metadata4362">
    <rdf:RDF>
      <cc:Work rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
        <dc:title/>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <defs id="defs4360"/>
  <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1280" inkscape:window-height="952" id="namedview4358" showgrid="false" inkscape:zoom="1.2020815" inkscape:cx="434.47578" inkscape:cy="639.70571" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="svg4356" inkscape:object-nodes="true" inkscape:object-paths="false" inkscape:snap-smooth-nodes="true"/>
  <style type="text/css" id="style3680">
	.st0{fill:#FFFFFF;}
	.st1{fill:#76C043;}
	.st2{fill:#2680BC;}
	.st3{fill:#F6E0E8;}
	.st4{fill:#515351;}
	.st5{fill:#F4F1A3;}
	.st6{fill:#8E4F21;}
	.st7{fill:#BC2027;}
	.st8{fill:#60BB46;}
	.st9{fill:#4686C6;}
	.st10{fill:#D28DBD;}
	.st11{fill:#3F403F;}
	.st12{fill:#010101;}
	.st13{fill:#8F8F8E;}
	.st14{fill:#515251;}
	.st15{fill:#4F6AB2;}
	.st16{fill:#3E65B0;}
	.st17{fill:#15406D;}
	.st18{fill:#65AD45;}
	.st19{fill:#787878;}
	.st20{fill:#D76B93;}
	.st21{fill:#4DB748;}
	.st22{opacity:0.24;fill:#BF2126;enable-background:new    ;}
	.st23{fill:#070505;}
	.st24{fill:#BF2126;}
</style>
  <svg:g inkscape:groupmode="layer" id="Boob_7_straps" inkscape:label="Boob_7_straps" style="display:inline">
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 508.3,214.2 C 449.714,298.729 270.477,341.098 261.246,450.171" id="path7375" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 526.574,459.199 C 539.97,365.712 508.179,303.374 508.3,214.2" id="path7377" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 522.623,503.54 C 520.28,528.215 548.507,555.384 559.839,561.514" id="path7381" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 265.667,486.42 C 267.838,510.591 306.187,531.841 350.216,534.498" id="path7383" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 499.189,481.381 C 474.478,479.681 457.992,487.065 442,477.868" id="path7385" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 275.097,469.249 C 319.63,474.712 396.528,483.662 442,477.868" id="path7387" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 441.823,481.362 L 442,477.868 C 439.051,391.71 464.477,303.109 508.3,214.2" id="path7389" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc"/>
    <svg:path style="display:inline;fill:none;stroke:#b3b3b3;stroke-width:1.29999995;stroke-miterlimit:4;stroke-dasharray:none" inkscape:connector-curvature="0" d="M 259.85,450.536 C 266.525,449.41 273.01,458.259 274.177,464.926 C 275.502,472.49 273.446,485.122 265.876,486.417 C 259.054,487.584 254.245,476.862 253.121,470.032 C 252.004,463.249 253.071,451.68 259.85,450.536 Z" class="st20" id="path7391" sodipodi:nodetypes="ccccc"/>
    <svg:path style="display:inline;fill:none;stroke:#b3b3b3;stroke-width:1.29999983;stroke-miterlimit:4;stroke-dasharray:none" d="M 526.065,503.352 C 515.208,504.067 500.738,494.532 500.023,483.676 C 499.297,472.661 511.737,460.317 522.752,459.592 C 533.609,458.877 548.079,468.412 548.794,479.268 C 549.52,490.283 537.08,502.627 526.065,503.352 Z" id="path7393" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc"/>
    <svg:path id="path9222-3" style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 549.048,483.92 C 589.096,483.618 639.217,446.836 663.654,430.681 C 676.663,352.064 522.885,295.117 508.3,214.2" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc"/>
  </svg:g>
</svg>


path: resources/vector/outfit/boot latex.svg


path: resources/vector/outfit/boot wide.svg


path: resources/vector/outfit/chastity male fore 0.svg


path: resources/vector/outfit/chastity male fore 1.svg


path: resources/vector/outfit/chastity male fore 2.svg


path: resources/vector/outfit/chastity male fore 3.svg


path: resources/vector/outfit/chastity male fore 4.svg


path: resources/vector/outfit/chastity male fore 5.svg


path: resources/vector/outfit/chastity male fore 6.svg


path: resources/vector/outfit/dildo gag.svg


path: resources/vector/outfit/extreme heel wide latex.svg


path: resources/vector/outfit/flat latex.svg


path: resources/vector/outfit/head latex.svg


path: resources/vector/outfit/heavy gold.svg


path: resources/vector/outfit/heel latex.svg


path: resources/vector/outfit/neck corset.svg


path: resources/vector/outfit/tight steel.svg


code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" viewBox="0 0 1000 1000" style="enable-background:new 0 0 1000 1000;" xml:space="preserve" id="svg4356" sodipodi:docname="vector source.svg" inkscape:version="0.91 r13725">
  <metadata id="metadata4362">
    <rdf:RDF>
      <cc:Work rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
        <dc:title/>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <defs id="defs4360"/>
  <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1280" inkscape:window-height="952" id="namedview4358" showgrid="false" inkscape:zoom="4.808326" inkscape:cx="531.76051" inkscape:cy="751.71421" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="Boob_Large_3_" inkscape:object-nodes="true" inkscape:object-paths="false" inkscape:snap-smooth-nodes="true" inkscape:snap-object-midpoints="true"/>
  <style type="text/css" id="style3680">
	.st0{fill:#FFFFFF;}
	.st1{fill:#76C043;}
	.st2{fill:#2680BC;}
	.st3{fill:#F6E0E8;}
	.st4{fill:#515351;}
	.st5{fill:#F4F1A3;}
	.st6{fill:#8E4F21;}
	.st7{fill:#BC2027;}
	.st8{fill:#60BB46;}
	.st9{fill:#4686C6;}
	.st10{fill:#D28DBD;}
	.st11{fill:#3F403F;}
	.st12{fill:#010101;}
	.st13{fill:#8F8F8E;}
	.st14{fill:#515251;}
	.st15{fill:#4F6AB2;}
	.st16{fill:#3E65B0;}
	.st17{fill:#15406D;}
	.st18{fill:#65AD45;}
	.st19{fill:#787878;}
	.st20{fill:#D76B93;}
	.st21{fill:#4DB748;}
	.st22{opacity:0.24;fill:#BF2126;enable-background:new    ;}
	.st23{fill:#070505;}
	.st24{fill:#BF2126;}
</style>
  <svg:g inkscape:groupmode="layer" id="Torso_Hourglass_straps" inkscape:label="Torso_Hourglass_straps" style="display:inline">
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="m 500.97796,204.16551 c -0.71264,4.69149 3.72511,8.09539 9.22204,11.23449 12.56584,-0.1687 25.13169,-3.25605 37.69753,-9.69857" id="path9218" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc"/>
    <svg:path id="path9222" style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3;stroke-dasharray:none;stroke-opacity:1" d="m 495.8,467.5 -14.5431,-61.0527 4.91522,-55.28426 5.08461,-71.0825 L 510.2,215.4 530.35082,279.04329 523.449,317.775 508.76009,353.35994 481.2569,406.4473 471.9861,352.02373 461.91384,309.87756 468.81988,275.6 510.2,215.4" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccccccccccc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="m 463.2324,352.85095 8.7537,-0.82722 14.18602,-0.86069 22.58797,2.1969 37.46362,7.77538" id="path9224" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="m 460.59329,375.71105 c 8.26177,10.3193 15.11821,15.52324 20.66361,30.73625 14.56337,-16.56115 48.05529,-16.49869 68.44366,-26.50672" id="path9226" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc"/>
    <svg:path id="path4809" style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="m 587.45053,268.9835 -27.76453,10.0025 -29.33518,0.0573 -39.09409,1.03724 -22.43685,-4.48053 -8.85992,-2.64861" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc"/>
  </svg:g>
</svg>


code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" viewBox="0 0 1000 1000" style="enable-background:new 0 0 1000 1000;" xml:space="preserve" id="svg4356" sodipodi:docname="vector source.svg" inkscape:version="0.91 r13725">
  <metadata id="metadata4362">
    <rdf:RDF>
      <cc:Work rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
        <dc:title/>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <defs id="defs4360"/>
  <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1280" inkscape:window-height="952" id="namedview4358" showgrid="false" inkscape:zoom="4.808326" inkscape:cx="531.76051" inkscape:cy="751.71421" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="Boob_Large_3_" inkscape:object-nodes="true" inkscape:object-paths="false" inkscape:snap-smooth-nodes="true" inkscape:snap-object-midpoints="true"/>
  <style type="text/css" id="style3680">
	.st0{fill:#FFFFFF;}
	.st1{fill:#76C043;}
	.st2{fill:#2680BC;}
	.st3{fill:#F6E0E8;}
	.st4{fill:#515351;}
	.st5{fill:#F4F1A3;}
	.st6{fill:#8E4F21;}
	.st7{fill:#BC2027;}
	.st8{fill:#60BB46;}
	.st9{fill:#4686C6;}
	.st10{fill:#D28DBD;}
	.st11{fill:#3F403F;}
	.st12{fill:#010101;}
	.st13{fill:#8F8F8E;}
	.st14{fill:#515251;}
	.st15{fill:#4F6AB2;}
	.st16{fill:#3E65B0;}
	.st17{fill:#15406D;}
	.st18{fill:#65AD45;}
	.st19{fill:#787878;}
	.st20{fill:#D76B93;}
	.st21{fill:#4DB748;}
	.st22{opacity:0.24;fill:#BF2126;enable-background:new    ;}
	.st23{fill:#070505;}
	.st24{fill:#BF2126;}
</style>
  <svg:g inkscape:groupmode="layer" id="Torso_Normal_straps" inkscape:label="Torso_Normal_straps" style="display:inline">
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 500.903,204.256 C 500.191,208.948 504.628,212.352 510.125,215.491 C 522.07,215.33 533.649,211.074 545.594,204.95" id="path9218" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc"/>
    <svg:path id="path9222" style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3;stroke-dasharray:none;stroke-opacity:1" d="M 492.779,466.2 L 479.154,404.326 L 481.969,348.317 L 491.442,278.56 L 510.125,215.491 L 531.396,274.432 L 535.475,313.426 L 525.004,352.471 L 479.154,404.326 L 467.783,349.178 L 461.718,308.021 L 469.006,274.079 L 510.125,215.491" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccccccccccc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 459.029,350.005 L 467.783,349.178 L 481.969,348.317 L 525.004,352.471 L 562.468,360.247" id="path9224" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 458.065,372.805 C 466.525,383.372 473.476,388.748 479.154,404.326 C 495.782,385.418 536.776,393.898 560.054,382.472" id="path9226" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc"/>
    <svg:path id="path4809" style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 587.622,264.803 L 560.344,274.43 L 531.396,274.432 L 491.442,278.56 L 469.006,274.079 L 460.146,271.43" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc"/>
  </svg:g>
</svg>


code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" viewBox="0 0 1000 1000" style="enable-background:new 0 0 1000 1000;" xml:space="preserve" id="svg4356" sodipodi:docname="vector source.svg" inkscape:version="0.91 r13725">
  <metadata id="metadata4362">
    <rdf:RDF>
      <cc:Work rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
        <dc:title/>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <defs id="defs4360"/>
  <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1280" inkscape:window-height="952" id="namedview4358" showgrid="false" inkscape:zoom="4.808326" inkscape:cx="531.76051" inkscape:cy="751.71421" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="Boob_Large_3_" inkscape:object-nodes="true" inkscape:object-paths="false" inkscape:snap-smooth-nodes="true" inkscape:snap-object-midpoints="true"/>
  <style type="text/css" id="style3680">
	.st0{fill:#FFFFFF;}
	.st1{fill:#76C043;}
	.st2{fill:#2680BC;}
	.st3{fill:#F6E0E8;}
	.st4{fill:#515351;}
	.st5{fill:#F4F1A3;}
	.st6{fill:#8E4F21;}
	.st7{fill:#BC2027;}
	.st8{fill:#60BB46;}
	.st9{fill:#4686C6;}
	.st10{fill:#D28DBD;}
	.st11{fill:#3F403F;}
	.st12{fill:#010101;}
	.st13{fill:#8F8F8E;}
	.st14{fill:#515251;}
	.st15{fill:#4F6AB2;}
	.st16{fill:#3E65B0;}
	.st17{fill:#15406D;}
	.st18{fill:#65AD45;}
	.st19{fill:#787878;}
	.st20{fill:#D76B93;}
	.st21{fill:#4DB748;}
	.st22{opacity:0.24;fill:#BF2126;enable-background:new    ;}
	.st23{fill:#070505;}
	.st24{fill:#BF2126;}
</style>
  <svg:g inkscape:groupmode="layer" id="Torso_Unnatural_straps" inkscape:label="Torso_Unnatural_straps" style="display:inline">
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 501.152,204.07 C 500.44,208.762 504.877,212.166 510.374,215.305 C 523.664,215.126 537.25,213.091 550.54,206.278" id="path9218" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc"/>
    <svg:path id="path9222" style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3;stroke-dasharray:none;stroke-opacity:1" d="M 496.678,465.98 L 482.188,407.3 L 491.521,353.918 L 491.181,281.745 L 510.374,215.305 L 528.877,283.779 L 512.809,320.263 L 498.229,354.208 L 482.188,407.3 L 477.335,354.779 L 462.265,311.869 L 468.744,277.264 L 510.374,215.305" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccccccccccc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 468.581,355.606 L 477.335,354.779 L 491.521,353.918 L 498.229,354.208 L 535.693,361.984" id="path9224" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc"/>
    <svg:path style="display:inline;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 465.026,377.931 C 472.614,387.409 477.095,393.328 482.188,407.3 C 495.417,392.256 523.809,387.614 542.329,378.524" id="path9226" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc"/>
    <svg:path id="path4809" style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 586.895,273.468 L 558.608,283.791 L 528.877,283.779 L 491.181,281.745 L 468.744,277.264 L 459.884,274.615" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc"/>
  </svg:g>
</svg>


code:
#!/bin/bash
if [ ! -d ".git" ]; then
	#not running in git repo, so can't use git commands :-)
	echo "No .git repo found - skipping sanity checks"
	exit 0
fi

WARNING='\033[93m'
WARNING='\033[93m'
ENDC='\033[0m'

myprint() {
	while read data; do
		echo -n -e "[$1]$WARNING"
		echo "$data"
	done
}

GREP="git grep -n --color"
# Check for missing right angle bracket: <</if>
$GREP "<</[^>]*>[^>]" -- 'src/*'  | myprint "MissingClosingAngleBracket"
$GREP "<<[^>()]*>[^()<>"$'\r]*\r'"\?$" -- 'src/*' | myprint "MissingClosingAngleBracket"
# Check for missing left angle bracket: </if>>
$GREP "\([^<]\|^\)</\?\(if\|else\|case\|set\|print\|elseif\)" -- 'src/*' | myprint "MissingOpeningAngleBracket2"
# Check for accidental assignment.  e.g.:   <<if $foo = "hello">>
$GREP "<<[ ]*if[^>=]*[^><\!=]=[^=][^>]*>>" -- 'src/*' | myprint "AccidentalAssignmentInIf"
# Check for accidental assignment.  e.g.:   <<elseif $foo = "hello">>
$GREP "<<[ ]*elseif[^>=]*[^><\!=]=[^=][^>]*>>" -- 'src/*' | myprint "AccidentalAssignmentInElseIf"
# Check for missing ".  e.g.:   <<if $foo == "hello>>
$GREP "<<[^\"<>]*\"[^\"<>]*>>" -- 'src/*' | myprint "MissingSpeechMark"
# Check for missing ".  e.g.:   <<if $foo = "hello)
$GREP -e "<<[^\"<>]*\([^\"<>]*\"[^><\"]*\"\| [<>] \)*\"\([^\"<>]*\"[^><\"]*\"\| [<>] \)*\([^\"<>]\| [<>] \)*>>" --and --not -e "*[^']*" -- 'src/*' | myprint "MissingSpeechMark2"
# Check for colors like: @@color:red   - should be @@.red
$GREP -e "@@color:" --and --not -e  "@@color:rgb([0-9 ]\+,[0-9 ]\+,[0-9 ]\+)" -- "src/*" | myprint "UseCssColors"
# Check for missing $ in activeSlave or PC
$GREP "<<[ ]*[^\$><_\[]*\(activeSlave\|PC\)[.]"  -- "src/*" | myprint "MissingDollar"
# Check for closing bracket without opening bracket.  e.g.:  <<if foo)>>      (but  <<case "foo")>>   is valid, so ignore those
$GREP -e "<<[ a-zA-Z]\+\([^()<>]\|[^()<>][<>][^()<>]\)*)" --and --not -e "<< *case"  -- "src/*" | myprint "MissingOpeningBracket"
# Check for opening bracket without closing bracket.  e.g.:  <<if (foo>>
$GREP -e "<<[ a-zA-Z]\([^<>]\|[^<>][<>][^<>]\)\+(\([^()<>]\|[^<>()][<>][^<>()]\|([^<>()]*])\)*>>" -- "src/*" | myprint "MissingClosingBracket"
# Check for two closing brackets but one opening bracket.  e.g.:  <<if (foo))>>
$GREP -e "<<[ a-zA-Z]\+[^()<>]*([^()]*)[^()]*)[^()<>]*>>"  -- "src/*" | myprint "MissingOpeningBracket2"
# Check for one closing bracket but two opening brackets.  e.g.:  <<if ((foo)>>
$GREP -e "<<[ a-zA-Z]\+[^()<>]*([^()]*([^()]*)[^()<>]*>>"  -- "src/*" | myprint "MissingClosingBracket2"
$GREP -e "<<.*[(][^<>)]*[(][^<>)]*)\?[^<>)]*>>" -- "src/*" | myprint "MissingClosingBracket3"
# Check for missing >>.  e.g.:   <<if $foo
$GREP "<<[^<>]*[^,\"\[{"$'\r]\r'"\?$" -- 'src/*' | myprint "MissingClosingAngleBrackets"
# Check for too many >>>.  e.g.: <</if>>>
$GREP "<<[^<>]*[<>]\?[^<>]*>>>" -- "src/*.tw" | myprint "TooManyAngleBrackets"
# Check for too many <<<.  e.g.: <<</if>>
$GREP "<<<[^<>]*[<>]\?[^<>]*>>" -- "src/*.tw" | myprint "TooManyAngleBrackets"
# Check for wrong capitalization on 'activeslave' and other common typos
$GREP -e "\$act" --and --not -e "\$\(activeSlave\|activeArcology\|activeStandard\|activeOrgan\|activeLimbs\|activeUnits\)" -- "src/*" | myprint "WrongCapitilization"
$GREP  "\(csae\|[a-z] She \|attepmts\|youreslf\|advnaces\|canAcheive\|setBellySize\|SetbellySize\|setbellySize\|bellypreg\|pregBelly\|bellyimplant\|bellyfluid\|pronounCaps\)" -- 'src/*' | myprint "SpellCheck"
$GREP "\$slave\[" -- 'src/*' | myprint "ShouldBeSlaves"
# Check for strange spaces e.g.  $slaves[$i]. lips
$GREP "\$slaves\[\$i\]\. " -- 'src/*' | myprint "MissingPropertyAfterSlaves"
# Check using refreshmentType instead of refreshment
$GREP "\$PC.refreshmentType[^ =]" -- 'src/*' | myprint "ShouldBeRefreshment"
# Check, e.g., <<//if>>
$GREP "<</[a-zA-Z]*[^a-zA-Z<>]\+[a-zA-Z]*>>" -- 'src/*' | myprint "DoubleSlash"
# Check, e.g.  <<else $foo==4
$GREP "<<else >\?[^>]" -- 'src/*' | myprint "ShouldBeElseIf"
# Check, e.g., =to
$GREP "=to" -- 'src/*' | myprint "EqualAndTo"
# Check doing  $slaves.foo instead of $slaves[i].foo
$GREP -e "[$]slaves[.]"  --and --not -e '[$]slaves[.]\(length\|random\|map\|filter\|deleteAt\|push\|find\|includes\|delete\|forEach\)' -- 'src/*' | myprint "MissingSlavesIndex"
# Try to check for accidentally mixing slaves[] and activeSlave.  This can have a lot of false matches, but has caught a lot of bugs so it's worth the pain
$GREP -e "activeSlave[.]" --and -e "slaves\[..\?\][.]" --and --not -e '[.]ID' --and --not -e 'slaves\[..\?\][.]\(slaveName\|slaveSurname\|actualAge\|relation\|assignment\|age\|devotion\|trust\|vagina\|mother\|father\)' -- 'src/*' | myprint "MaybeAccidentalMixingOfSlavesAndActiveSlave"
# Check, e.g.  <<set foo == 4>>
$GREP "<<set[^{>=]*==" -- 'src/*' | myprint "DoubleEqualsInSet"
# Check for, e.g   <<if slaves[foo]>>
$GREP "<<\([^>]\|[^>]>[^>]\)*[^$]slaves\[" -- 'src/*' | myprint "MissingDollar"
# Check for missing $ or _ in variable name:
$GREP -e "<<[a-zA-Z]\([^>\"]\|[^>]>[^>]\|\"[^\"]*\"\)* [a-zA-Z]\+ * =" -- src/*.tw | myprint "MissingDollar2"
# Check for missing command, e.g.  <<foo =
$GREP -e "<<[a-zA-Z]* = *" -- src/*.tw | myprint "BadCommand"
# Check for duplicate words, e.g. with with
$GREP -e  " \(\b[a-zA-Z][a-zA-Z]\+\) \1\b " --and --not -e " her her " --and --not -e " you you " --and --not -e " New New " --and --not -e " that that " --and --not -e " in in " --and --not -e " is is " -- 'src/*' | myprint "Duplicate words"
# Check for obsolete SugarCube macros
$GREP -E "<<display|<<click|<<.*\.contains" -- src/*.tw | myprint "ObsoleteMacro"
# Check for double articles
$GREP -E "\Wa an\W" -- src/*.tw | myprint "DoubleArticle"
# Check for incorrect articles
$GREP -i -E "\Wa (a|e|i|o|u)." -- src/*.tw | grep -i -vE "\Wa (un|eu|us|ut|on|ur|in)." | grep -i -vE "(&|<<s>>|UM)." | myprint "IncorrectArticle"
$GREP -i -E "\Wan (b|c|d|f|g|j|k|l|m|n|p|q|r|s|t|v|w|x|y|z)\w." -- src/*.tw | grep -i -vE "[A-Z]{3}" | myprint "IncorrectArticle"
# Check for $ sign mid-word
$GREP -i "\w$\w" -- src/*.tw | myprint "VarSignMidWord"
# check for $ sign at beginning of macro
$GREP '<<\s*\$' -- 'src/*'  | myprint "VarSignAtMacroStart"
# check for missing ; before statement
$GREP 'if $ ' -- 'src/*'  | myprint "missing ; before statement"
$GREP 'elseif $ ' -- 'src/*'  | myprint "missing ; before statement"
# Check for a . inside a <<>>
$GREP "<<[a-zA-Z]\([^\"'>]\|[^\"'>]>[^\"'>]\)*[a-zA-Z][.][^a-zA-Z]" | myprint "StrangeCharacterAfterDot"

# Check that we do not have any variables that we use only once.   e.g.     $onlyUsedOnce
# Ignore  *Nationalities
(
cd src/
cat $(find . -name "*.tw" ) | tr -c '$a-zA-Z' '\n'  | sed -n '/^[$]/p' | grep -v "Nationalities" | sort | uniq -u | sed 's/^[$]/-e[$]/' | sed 's/$/\\\\W/' | xargs -r  git grep -n --color | myprint "OnlyUsedOnce"
cat $(find . -name "*.tw" ) | tr -c '.$a-zA-Z[]_' '\n' | sed 's/SugarCube\.State\.variables\./$/g' | sed -n -e 's/^[$]\(PC\|activeSlave\|\(slaves\|tanks\)\[[^]]*\]*\)[.]\([a-zA-Z]\+\).*$/[.]\3/p' | sort | uniq -u |sed 's/^\(.*\)$/-e\1\\\\\b/'  | xargs -r git grep -n --color | myprint "SlaveAttributeUsedOnce"
$GREP "\$\(PC\|activeSlave\|slaves\|tanks\)[.][^a-zA-Z]" | myprint "UnexpectedCharAfterDot"

)

# Check that all the tags are properly opened and closed
git ls-files "src/*.tw" | xargs -d '\n' ./devTools/check.py

path: sanityCheck


code:
:: SecExpBackwardCompatibility [nobr]

<<set $nextButton = "Continue", $nextLink = "Main", $returnTo = "Main">>

/* base stats */
<<if ndef $authority>>
<<set $authority = 0>>
<</if>>
<<if ndef $security>>
<<set $security = 30>>
<</if>>
<<if ndef $secRestPoint>>
<<set $secRestPoint = 40>>
<</if>>
<<if ndef $crime>>
<<set $crime = 30>>
<</if>>
<<if ndef $crimeCap>>
<<set $crimeCap = 100>>
<</if>>
<<if ndef $readiness>>
<<set $readiness = 1>>
<</if>>
<<if ndef $recon>>
<<set $recon = 0>>
<</if>>
<<if ndef $maxUnits>>
<<set $maxUnits = 6>>
<</if>>
<<if ndef $trade>>
<<set $trade = 0>>
<<calcInitialTrade>>
<</if>>
<<if ndef $activeUnits>>
<<set $activeUnits = 0>>
<</if>>
<<if ndef $attackType>>
<<set $attackType = "none">>
<</if>>
<<if ndef $attackThisWeek>>
<<set $attackThisWeek = 0>>
<</if>>
<<if ndef $lastAttackWeeks>>
<<set $lastAttackWeeks = 0>>
<</if>>
<<if ndef $hasFoughtOnce>>
<<set $hasFoughtOnce = 0>>
<</if>>
<<if ndef $hasFoughtMajorBattleOnce>>
<<set $hasFoughtMajorBattleOnce = 0>>
<</if>>
<<if ndef $hasRebelledOnce>>
<<set $hasRebelledOnce = 0>>
<</if>>
<<if ndef $majorBattle>>
<<set $majorBattle = 0>>
<</if>>
<<if ndef $PCvictoryStreak>>
<<set $PCvictoryStreak = 0>>
<</if>>
<<if ndef $PClossStreak>>
<<set $PClossStreak = 0>>
<</if>>
<<if ndef $oldFlux>>
<<set $oldFlux = 0>>
<</if>>
<<if ndef $wasToggledBefore>>
<<set $wasToggledBefore = 0>>
<</if>>
<<if ndef $showBattleStatistics>>
<<set $showBattleStatistics = 0>>
<</if>>
<<if ndef $forceBattle>>
<<set $forceBattle = 0>>
<</if>>
<<if ndef $forceMajorBattle>>
<<set $forceMajorBattle = 0>>
<</if>>
<<if ndef $foughtThisWeek>>
<<set $foughtThisWeek = 0>>
<</if>>
<<if ndef $battlesEnabled>>
<<set $battlesEnabled = 1>>
<</if>>
<<if ndef $battlesEnabledOceanic>>
<<set $battlesEnabledOceanic = 0>>
<</if>>
<<if ndef $majorBattlesEnabled>>
<<set $majorBattlesEnabled = 1>>
<</if>>
<<if ndef $majorBattleGameOver>>
<<set $majorBattleGameOver = 1>>
<</if>>
<<if ndef $rebellionsEnabled>>
<<set $rebellionsEnabled = 1>>
<</if>>
<<if ndef $forceRebellion>>
<<set $forceRebellion = 0>>
<</if>>
<<if ndef $rebellionGameOver>>
<<set $rebellionGameOver = 1>>
<</if>>
<<if ndef $allowPrestigeFromBattles>>
<<set $allowPrestigeFromBattles = 1>>
<</if>>
<<if ndef $battleFrequency>>
<<set $battleFrequency = 1>>
<</if>>
<<if ndef $rebellionSpeed>>
<<set $rebellionSpeed = 1>>
<</if>>

/* edicts */
<<if ndef $edictsUpkeep>>
<<set $edictsUpkeep = 0>>
<</if>>
<<if ndef $edictsAuthUpkeep>>
<<set $edictsAuthUpkeep = 0>>
<</if>>
<<if ndef $alternativeRents>>
<<set $alternativeRents = 0>>
<</if>>
<<if ndef $enslavementRights>>
<<set $enslavementRights = 0>>
<</if>>
<<if ndef $securityExemption>>
<<set $securityExemption = 0>>
<</if>>
<<if ndef $sellData>>
<<set $sellData = 0>>
<</if>>
<<if ndef $propCampaignBoost>>
<<set $propCampaignBoost = 0>>
<</if>>
<<if ndef $slaveWatch>>
<<set $slaveWatch = 0>>
<</if>>
<<if ndef $subsidyChurch>>
<<set $subsidyChurch = 0>>
<</if>>
<<if ndef $limitImmigration>>
<<set $limitImmigration = 0>>
<</if>>
<<if ndef $openBorders>>
<<set $openBorders = 0>>
<</if>>
<<if ndef $limitSubhumans>>
<<set $limitSubhumans = 0>>
<</if>>
<<if ndef $slavesOfficers>>
<<set $slavesOfficers = 0>>
<</if>>
<<if ndef $martialSchool>>
<<set $martialSchool = 0>>
<</if>>
<<if ndef $discountMercenaries>>
<<set $discountMercenaries = 0>>
<</if>>
<<if ndef $militiaFounded>>
<<set $militiaFounded = 0>>
<</if>>
<<if ndef $recruitVolunteers>>
<<set $recruitVolunteers = 0>>
<</if>>
<<if ndef $militaryService>>
<<set $militaryService = 0>>
<</if>>
<<if ndef $militarizedSociety>>
<<set $militarizedSociety = 0>>
<</if>>
<<if ndef $militaryExemption>>
<<set $militaryExemption = 0>>
<</if>>
<<if ndef $lowerRquirements>>
<<set $lowerRquirements = 0>>
<</if>>
<<if ndef $noSubhumansInArmy>>
<<set $noSubhumansInArmy = 0>>
<</if>>
<<if ndef $pregExemption>>
<<set $pregExemption = 0>>
<</if>>
<<if ndef $eliteOfficers>>
<<set $eliteOfficers = 0>>
<</if>>
<<if ndef $liveTargets>>
<<set $liveTargets = 0>>
<</if>>
<<if ndef $legionTradition>>
<<set $legionTradition = 0>>
<</if>>
<<if ndef $eagleWarriors>>
<<set $eagleWarriors = 0>>
<</if>>
<<if ndef $ronin>>
<<set $ronin = 0>>
<</if>>
<<if ndef $sunTzu>>
<<set $sunTzu = 0>>
<</if>>
<<if ndef $weaponsLaw || $wasToggledBefore == 1>>
<<set $weaponsLaw = 3>>
<</if>>
<<if ndef $soldierWages>>
<<set $soldierWages = 1>>
<</if>>
<<if ndef $militiaSoldierPrivilege>>
<<set $militiaSoldierPrivilege = 0>>
<</if>>
<<if ndef $slaveSoldierPrivilege>>
<<set $slaveSoldierPrivilege = 0>>
<</if>>
<<if ndef $mercSoldierPrivilege>>
<<set $mercSoldierPrivilege = 0>>
<</if>>
<<if ndef $tradeLegalAid>>
<<set $tradeLegalAid = 0>>
<</if>>
<<if ndef $taxTrade>>
<<set $taxTrade = 0>>
<</if>>

/* proclamations */
<<if ndef $proclamationsCooldown>>
<<set $proclamationsCooldown = 0>>
<</if>>
<<if ndef $proclamationCurrency>>
<<set $proclamationCurrency = "authority">>
<</if>>
<<if ndef $proclamationType>>
<<set $proclamationType = "none">>
<</if>>

/* buildings */
<<if ndef $secHQ>>
<<set $secHQ = 0>>
<</if>>
<<if ndef $secBarracks>>
<<set $secBarracks = 0>>
<</if>>
<<if ndef $secBarracksUpgrades>>
<<set $secBarracksUpgrades ={
	size: 0,
	luxury: 0,
	training: 0,
	loyaltyMod:0 }>>
<</if>>
<<if ndef $secBarracksUpgrades.loyaltyMod>>
<<set $secBarracksUpgrades.loyaltyMod = 0>>
<</if>>
<<if ndef $secHelots>>
<<set $secHelots = 0>>
<</if>>
<<if ndef $reqHelots>>
<<set $reqHelots = 20>>
<</if>>
<<if ndef $secUpgrades >>
<<set $secUpgrades = {
	nanoCams: 0,
	cyberBots: 0,
	eyeScan: 0,
	cryptoAnalyzer: 0,
	coldstorage: 0}>>
<</if>>
<<if ndef $crimeUpgrades>>
<<set $crimeUpgrades = {
	autoTrial: 0,
	autoArchive: 0,
	worldProfiler: 0,
	advForensic: 0}>>
<</if>>
<<if ndef $intelUpgrades>>
	<<set $intelUpgrades = {
	sensors: 0,
	radar: 0,
	signalIntercept: 0}>>
<</if>>
<<if ndef $readinessUpgrades>>
<<set $readinessUpgrades = {
	earlyWarn: 0,
	rapidPlatforms: 0,
	pathways: 0,
	rapidVehicles: 0}>>
<</if>>
<<if ndef $propHub>>
	<<set $propHub = 0>>
<</if>>
<<if ndef $propCampaign>>
<<set $propCampaign = 0>>
<</if>>
<<if ndef $propFocus>>
<<set $propFocus = "none">>
<</if>>
<<if ndef $miniTruth>>
<<set $miniTruth = 0>>
<</if>>
<<if ndef $fakeNews>>
<<set $fakeNews = 0>>
<</if>>
<<if ndef $controlLeaks>>
<<set $controlLeaks = 0>>
<</if>>
<<if ndef $secretService>>
<<set $secretService = 0>>
<</if>>
<<if ndef $blackOps>>
<<set $blackOps = 0>>
<</if>>
<<if ndef $marketInfiltration>>
<<set $marketInfiltration = 0>>
<</if>>
<<if ndef $propHubUpkeep>>
<<set $propHubUpkeep = $facilityCost * 5>>
<</if>>
<<if ndef $secHQUpkeep>>
<<set $secHQUpkeep = $facilityCost * 5>>
<</if>>
<<if ndef $secBarracksUpkeep>>
<<set $secBarracksUpkeep = $facilityCost * 5>>
<</if>>
<<if ndef $upgradeUpkeep>>
<<set $upgradeUpkeep = 50>>
<</if>>
<<if ndef $riotCenter>>
<<set $riotCenter = 0>>
<</if>>
<<if ndef $riotUpkeep>>
<<set $riotUpkeep = $facilityCost * 5>>
<</if>>
<<if ndef $riotUpgrades>>
<<set $riotUpgrades = {
	freeMedia: 0,
	rapidUnit: 0,
	rapidUnitSpeed: 0}>>
<</if>>
<<if ndef $fort>>
<<set $fort = {
	reactor: 0,
	waterway: 0,
	assistant: 0}>>
<</if>>
<<if ndef $sentUnitCooldown>>
<<set $sentUnitCooldown = 0>>
<</if>>
<<if ndef $advancedRiotEquip>>
<<set $advancedRiotEquip = 0>>
<</if>>
<<if ndef $brainImplant>>
<<set $brainImplant = -1>>
<</if>>
<<if ndef $brainImplantProject>>
<<set $brainImplantProject = 0>>
<</if>>
<<if ndef $weapHelots>>
<<set $weapHelots = 0>>
<</if>>
<<if ndef $weapManu>>
<<set $weapManu = 0>>
<</if>>
<<if ndef $weapProductivity>>
<<set $weapProductivity = 1>>
<</if>>
<<if ndef $weapLab>>
<<set $weapLab = 1>>
<</if>>
<<if ndef $baseUpgradeTime>>
<<set $baseUpgradeTime = 10>>
<</if>>
<<if ndef $weapUpgrades>>
<<set $weapUpgrades = []>>
<</if>>
<<if ndef $currentUpgrade>>
<<set $currentUpgrade = {
	ID: 0,
	name: " ",
	unit: 0,
	type: 0,
	time: 0,
	value: 0}>>
<<else>>
	<<if ndef $currentUpgrade.ID>>
		<<if $currentUpgrade.name == "magnetic based ballistic weaponry">>
			<<set $currentUpgrade.ID = 0>>
		<<elseif $currentUpgrade.name == "ceramo-metallic alloys">>
			<<set $currentUpgrade.ID = 1>>
		<<elseif $currentUpgrade.name == "rapid action stimulants">>
			<<set $currentUpgrade.ID = 2>>
		<<elseif $currentUpgrade.name == "fast response neural stimulant">>
			<<set $currentUpgrade.ID = 3>>
		<<elseif $currentUpgrade.name == "universal cyber enhancements">>
			<<set $currentUpgrade.ID = 4>>
		<<elseif $currentUpgrade.name == "remote neural links">>
			<<set $currentUpgrade.ID = 5>>
		<<elseif $currentUpgrade.name == "combined training regimens with the special force">>
			<<set $currentUpgrade.ID = 6>>
		<<elseif $currentUpgrade.name == "a variant of the stimulant cocktail that the special force created">>
			<<set $currentUpgrade.ID = 7>>
		<<elseif $currentUpgrade.name == "a mesh network based off the custom network of the special force">>
			<<set $currentUpgrade.ID = 8>>
		<<elseif $currentUpgrade.name == "dynamic battle aware AI">>
			<<set $currentUpgrade.ID = -1>>
		<<elseif $currentUpgrade.name == "adaptive armored frames">>
			<<set $currentUpgrade.ID = -2>>
		<<elseif $currentUpgrade.name == "advanced synthetic alloys">>
			<<set $currentUpgrade.ID = -3>>
		<</if>>
	<</if>>
<</if>>
<<if ndef $droneUpgrades>>
	<<set $droneUpgrades = {
		attack: 0,
		defense: 0,
		hp:0}>>
<<elseif $droneUpgrades == null>>
	<<set $droneUpgrades = {
		attack: 0,
		defense: 0,
		hp:0}>>
<<else>>
	<<if isInt($droneUpgrades)>>
		<<unset $droneUpgrades>>
		<<set $droneUpgrades = {
			attack: 0,
			defense: 0,
			hp:0}>>
	<</if>>
	<<if ndef $droneUpgrades.attack || !isInt($droneUpgrades.attack)>>
		<<set $droneUpgrades.attack = 0>>
	<</if>>
	<<if ndef $droneUpgrades.defense || !isInt($droneUpgrades.defense)>>
		<<set $droneUpgrades.defense = 0>>
	<</if>>
	<<if ndef $droneUpgrades.hp || !isInt($droneUpgrades.hp)>>
		<<set $droneUpgrades.hp = 0>>
	<</if>>
<</if>>
<<if ndef $humanUpgrade>>
	<<set $humanUpgrade = {
		attack: 0,
		defense: 0,
		hp:0,
		morale: 0}>>
<<elseif $humanUpgrade == null>>
	<<set $humanUpgrade = {
		attack: 0,
		defense: 0,
		hp:0,
		morale: 0}>>
<<else>>
	<<if isInt($humanUpgrade)>>
		<<unset $humanUpgrade>>
		<<set $humanUpgrade = {
			attack: 0,
			defense: 0,
			hp:0,
			morale: 0}>>
	<</if>>
	<<if ndef $humanUpgrade.attack || !isInt($humanUpgrade.attack)>>
		<<set $humanUpgrade.attack = 0>>
	<</if>>
	<<if ndef $humanUpgrade.defense || !isInt($humanUpgrade.defense)>>
		<<set $humanUpgrade.defense = 0>>
	<</if>>
	<<if ndef $humanUpgrade.hp || !isInt($humanUpgrade.hp)>>
		<<set $humanUpgrade.hp = 0>>
	<</if>>
	<<if ndef $humanUpgrade.morale || !isInt($humanUpgrade.morale)>>
		<<set $humanUpgrade.morale = 0>>
	<</if>>
<</if>>
<<if ndef $sellTo>>
<<set $sellTo = {
	citizen: 1,
	raiders: 1,
	oldWorld: 1,
	FC: 1}>>
<</if>>
<<if ndef $completedUpgrades>>
<<set $completedUpgrades = []>>
<</if>>
<<if ndef $transportHub>>
<<set $transportHub = 0>>
<</if>>
<<if ndef $airport>>
<<set $airport = 1>>
<</if>>
<<if ndef $railway>>
<<set $railway = 1>>
<</if>>
<<if ndef $docks>>
<<set $docks = 1>>
<</if>>
<<if ndef $hubSecurity>>
<<set $hubSecurity = 1>>
<</if>>

/* events */
<<if ndef $smilingManProgress>>
<<set $smilingManProgress = 0>>
<</if>>
<<if ndef $investedFunds>>
<<set $investedFunds = 0>>
<</if>>
<<if ndef $relationshipLM>>
<<set $relationshipLM = 0>>
<</if>>
<<if ndef $captureRoute>>
<<set $captureRoute = 0>>
<</if>>
<<if ndef $collaborationRoute>>
<<set $collaborationRoute = 0>>
<</if>>
<<if ndef $hostileRoute>>
<<set $hostileRoute = 0>>
<</if>>
<<if ndef $smilingManWeek>>
<<set $smilingManWeek = 0>>
<</if>>
<<if ndef $globalCrisisWeeks>>
<<set $globalCrisisWeeks = 0>>
<</if>>
<<if ndef $smilingManFate>>
<<set $smilingManFate = 4>>
<</if>>

/* rebellions */
<<if ndef $tension>>
<<set $tension = 0>>
<</if>>
<<if ndef $slaveProgress>>
<<set $slaveProgress = 0>>
<</if>>
<<if ndef $citizenProgress>>
<<set $citizenProgress = 0>>
<</if>>
<<if ndef $slaveRebellionEventFires>>
<<set $slaveRebellionEventFires = 0>>
<</if>>
<<if ndef $citizenRebellionEventFires>>
<<set $citizenRebellionEventFires = 0>>
<</if>>
<<if ndef $slaveRebellion>>
<<set $slaveRebellion = 0>>
<</if>>
<<if ndef $citizenRebellion>>
<<set $citizenRebellion = 0>>
<</if>>
<<if ndef $rebellingUnits>>
<<set $rebellingUnits = []>>
<</if>>
<<if ndef $notInvolved>>
<<set $notInvolved = 0>>
<</if>>
<<if ndef $engageRule>>
<<set $engageRule = 0>>
<</if>>
<<if ndef $irregulars>>
<<set $irregulars = 0>>
<</if>>
<<if ndef $rebellingMilitia>>
<<set $rebellingMilitia = 0>>
<</if>>
<<if ndef $rebellingSlaves>>
<<set $rebellingSlaves = 0>>
<</if>>
<<if ndef $rebellingMercs>>
<<set $rebellingMercs = 0>>
<</if>>
<<if ndef $repairTime>>
<<set $repairTime = 3>>
<</if>>
<<if ndef $arcRepairTime>>
<<set $arcRepairTime = 0>>
<</if>>
<<if ndef $rebelDefeatAftermath>>
<<set $rebelDefeatAftermath = 0>>
<</if>>
<<if ndef $garrison>>
<<set $garrison = {
	penthouse: 0,
	reactor: 0,
	assistant: 0,
	waterway: 0,
	reactorTime: 0,
	assistantTime: 0,
	waterwayTime: 0}>>
<<else>>
	<<if ndef $garrison.penthouse>>
		<<set $garrison.penthouse = 0>>
	<</if>>
	<<if ndef $garrison.reactor>>
		<<set $garrison.reactor = 0>>
	<</if>>
	<<if ndef $garrison.assistant>>
		<<set $garrison.assistant = 0>>
	<</if>>
	<<if ndef $garrison.waterway>>
		<<set $garrison.waterway = 0>>
	<</if>>
	<<if ndef $garrison.reactorTime>>
		<<set $garrison.reactorTime = 0>>
	<</if>>
	<<if ndef $garrison.assistantTime>>
		<<set $garrison.assistantTime = 0>>
	<</if>>
	<<if ndef $garrison.waterwayTime>>
		<<set $garrison.waterwayTime = 0>>
	<</if>>
<</if>>
<<if ndef $rebellionsCount>>
<<set $rebellionsCount = 0>>
<</if>>
<<if ndef $PCrebWon>>
<<set $PCrebWon = 0>>
<</if>>
<<if ndef $PCrebLoss>>
<<set $PCrebLoss = 0>>
<</if>>

/* armed forces stats */
<<if ndef $difficulty>>
<<set $difficulty = 1>>
<</if>>
<<if ndef $targetUnit>>
<<set $targetUnit = 0>>
<</if>>
<<if ndef $targetIndex>>
<<set $targetIndex = 0>>
<</if>>
<<if ndef $secBotsCost>>
<<set $secBotsCost = 500>>
<</if>>
<<if ndef $secBotsUpgradeCost>>
<<set $secBotsUpgradeCost = 250>>
<</if>>
<<if ndef $equipUpgradeCost>>
<<set $equipUpgradeCost = 250>>
<</if>>
<<if ndef $maxTroops>>
<<set $maxTroops = 30>>
<</if>>
<<if ndef $militiaFounded>>
<<set $militiaFounded = 0>>
<</if>>
<<if ndef $militiaRecruitment>>
<<set $militiaRecruitment = 0>>
<</if>>
<<if ndef $militiaTotalManpower>>
<<set $militiaTotalManpower = 0>>
<</if>>
<<if ndef $militiaFreeManpower>>
<<set $militiaFreeManpower = 0>>
<</if>>
<<if ndef $militiaEmployedManpower>>
<<set $militiaEmployedManpower = 0>>
<</if>>
<<if ndef $militiaTotalCasualties>>
<<set $militiaTotalCasualties = 0>>
<</if>>
<<if ndef $slavesOfficers>>
<<set $slavesOfficers = 0>>
<</if>>
<<if ndef $slavesEmployedManpower>>
<<set $slavesEmployedManpower = 0>>
<</if>>
<<if ndef $slavesTotalCasualties>>
<<set $slavesTotalCasualties = 0>>
<</if>>
<<if ndef $slavesMaxTroops>>
<<set $slavesMaxTroops = 30>>
<</if>>
<<if ndef $mercTotalManpower>>
<<set $mercTotalManpower = 0>>
<</if>>
<<if ndef $mercFreeManpower>>
<<set $mercFreeManpower = 0>>
<</if>>
<<if ndef mercEmployedManpower>>
<<set $mercEmployedManpower = 0>>
<</if>>
<<if ndef $mercTotalCasualties>>
<<set $mercTotalCasualties = 0>>
<</if>>
<<if ndef $militiaLoyalty>>
<<set $militiaLoyalty = 0>>
<</if>>
<<if ndef $slaveArmyLoyalty>>
<<set $slaveArmyLoyalty = 0>>
<</if>>
<<if ndef $mercLoyalty>>
<<set $mercLoyalty = 0>>
<</if>>
<<if ndef $soldierUpkeep>>
<<set $soldierUpkeep = 10>>
<</if>>
<<if ndef $createdSlavesUnits>>
<<set $createdSlavesUnits = 0>>
<</if>>
<<if ndef $createdMilitiaUnits>>
<<set $createdMilitiaUnits = 0>>
<</if>>
<<if ndef $createdMercUnits>>
<<set $createdMercUnits = 0>>
<</if>>

/* battle relevant vars */
<<if ndef $troopCount>>
<<set $troopCount = 0>>
<</if>>
<<if ndef $slaveVictories>>
<<set $slaveVictories = []>>
<</if>>
<<if ndef $slaveIncreasedPrestige>>
<<set $slaveIncreasedPrestige = 0>>
<</if>>
<<if ndef $totalKills>>
<<set $totalKills = 0>>
<</if>>
<<if ndef $battlesCount>>
<<set $battlesCount = 0>>
<</if>>
<<if ndef $majorBattlesCount>>
<<set $majorBattlesCount = 0>>
<</if>>
<<if ndef $chosenTactic>>
	<<set $chosenTactic = "none">>
<</if>>
<<if ndef $leadingTroops>>
	<<set $leadingTroops = "none">>
<</if>>
<<if ndef $attackTroops>>
	<<set $attackTroops = 0>>
<</if>>
<<if ndef $attackEquip>>
	<<set $attackEquip = 0>>
<</if>>
<<if ndef $deployableUnits>>
	<<set $deployableUnits = 0>>
<</if>>
<<if ndef $deployedUnits>>
	<<set $deployedUnits = 0>>
<</if>>
<<if ndef $deployingBots>>
	<<set $deployingBots = 0>>
<</if>>
<<if ndef $deployingMilitia>>
	<<set $deployingMilitia = 0>>
<</if>>
<<if ndef $deployingSlaves>>
	<<set $deployingSlaves = 0>>
<</if>>
<<if ndef $deployingMercs>>
	<<set $deployingMercs = 0>>
<</if>>
<<if ndef $battleTerrain>>
	<<set $battleTerrain = "none">>
<</if>>
<<if ndef $maxTurns>>
	<<set $maxTurns = 10>>
<</if>>
<<if ndef $battleResult>>
	<<set $battleResult = 4>>				/* sets $battleResult value outside accepted range (-3,3) to avoid evaluation problems */
<</if>>
<<if ndef $losses>>
	<<set $losses = 0>>
<</if>>
<<if ndef $enemyLosses>>
	<<set $enemyLosses = 0>>
<</if>>
<<if ndef $battleTurns>>
	<<set $battleTurns = 0>>
<</if>>
<<if ndef $bribeCost>>
	<<set $bribeCost = 0>>
<</if>>
<<if ndef $tacticsSuccessful>>
	<<set $tacticsSuccessful = 0>>
<</if>>
<<if ndef $leaderWounded>>
	<<set $leaderWounded = 0>>				/* 0=no wound, 1=mute, 2=blind, 3=amputee, 4=health */
<</if>>
<<if ndef $gainedCombat>>
	<<set $gainedCombat = 0>>
<</if>>
<<if ndef $gainedWarfare>>
<<set $gainedWarfare = 0>>
<</if>>
<<if ndef $PCWounded>>
<<set $PCWounded = 0>>
<</if>>
<<if ndef $PCWoundCooldown>>
<<set $PCWoundCooldown = 0>>
<</if>>
<<if ndef $expectedEquip>>
<<set $expectedEquip = 0>>
<</if>>
<<if ndef $estimatedMen>>
<<set $estimatedMen = 0>>
<</if>>
<<if ndef $SFIntervention>>
<<set $SFIntervention = 0>>
<</if>>
<<if ndef $carriableSoldiers>>
<<set $carriableSoldiers = 0>>
<</if>>
<<if ndef $SFatk>>
<<set $SFatk = 0>>
<</if>>
<<if ndef $SFdef>>
<<set $SFdef = 0>>
<</if>>
<<if ndef $SFhp>>
<<set $SFhp = 0>>
<</if>>
<<if ndef $rebellingID>>
<<set $rebellingID = []>>
<</if>>

/* statistics */
<<if ndef $baseBribePerAttacker>>
<<set $baseBribePerAttacker = 5>>
<</if>>
<<if ndef $equipMod>>
<<set $equipMod = 0.15>>
<</if>>
<<if ndef $secBotsBaseAttack>>
<<set $secBotsBaseAttack = 7 + $droneUpgrades.attack>>
<</if>>
<<if ndef $secBotsBaseDefense>>
<<set $secBotsBaseDefense = 3 + $droneUpgrades.defense>>
<</if>>
<<if ndef $secBotsMorale>>
<<set $secBotsMorale = 200>>
<</if>>
<<if ndef $secBotsBaseHp>>
<<set $secBotsBaseHp = 3 + $droneUpgrades.hp>>
<</if>>
<<if ndef $militiaBaseAttack>>
<<set $militiaBaseAttack = 7 + $humanUpgrade.attack>>
<</if>>
<<if ndef $militiaBaseDefense>>
<<set $militiaBaseDefense = 5 + $humanUpgrade.defense>>
<</if>>
<<if ndef $militiaBaseMorale>>
<<set $militiaBaseMorale = 140 + $humanUpgrade.morale>>
<</if>>
<<if ndef $militiaBaseHp>>
<<set $militiaBaseHp = 3 + $humanUpgrade.hp>>
<</if>>
<<if ndef $slaveBaseAttack>>
<<set $slaveBaseAttack = 8 + $humanUpgrade.attack>>
<</if>>
<<if ndef $slaveBaseDefense>>
<<set $slaveBaseDefense = 3 + $humanUpgrade.defense>>
<</if>>
<<if ndef $slaveBaseMorale>>
<<set $slaveBaseMorale = 110 + $humanUpgrade.morale>>
<</if>>
<<if ndef $slaveBaseHp>>
<<set $slaveBaseHp = 3 + $humanUpgrade.hp>>
<</if>>
<<if ndef $mercBaseAttack>>
<<set $mercBaseAttack = 8 + $humanUpgrade.attack>>
<</if>>
<<if ndef $mercBaseDefense>>
<<set $mercBaseDefense = 4 + $humanUpgrade.defense>>
<</if>>
<<if ndef $mercBaseMorale>>
<<set $mercBaseMorale = 125 + $humanUpgrade.morale>>
<</if>>
<<if ndef $mercBaseHp>>
<<set $mercBaseHp = 4 + $humanUpgrade.hp>>
<</if>>
<<if ndef $SFBaseAttack>>
<<set $SFBaseAttack = 8 + $humanUpgrade.attack>>
<</if>>
<<if ndef $SFBaseDefense>>
<<set $SFBaseDefense = 4 + $humanUpgrade.defense>>
<</if>>
<<if ndef $SFBaseMorale>>
<<set $SFBaseMorale = 140 + $humanUpgrade.morale>>
<</if>>
<<if ndef $SFBaseHp>>
<<set $SFBaseHp = 4 + $humanUpgrade.hp>>
<</if>>

<<if ndef $raBaseAttack>>
<<set $raBaseAttack = 7>>
<</if>>
<<if ndef $raBaseDefense>>
<<set $raBaseDefense = 2>>
<</if>>
<<if ndef $raBaseMorale>>
<<set $raBaseMorale = 100>>
<</if>>
<<if ndef $raBaseHp>>
<<set $raBaseHp = 2>>
<</if>>
<<if ndef $fcBaseAttack>>
<<set $fcBaseAttack = 6>>
<</if>>
<<if ndef $fcBaseDefense>>
<<set $fcBaseDefense = 4>>
<</if>>
<<if ndef $fcBaseMorale>>
<<set $fcBaseMorale = 130>>
<</if>>
<<if ndef $fcBaseHp>>
<<set $fcBaseHp = 3>>
<</if>>
<<if ndef $owBaseAttack>>
<<set $owBaseAttack = 8>>
<</if>>
<<if ndef $owBaseDefense>>
<<set $owBaseDefense = 4>>
<</if>>
<<if ndef $owBaseMorale>>
<<set $owBaseMorale = 110>>
<</if>>
<<if ndef $owBaseHp>>
<<set $owBaseHp = 2>>
<</if>>
<<if ndef $ffBaseAttack>>
<<set $ffBaseAttack = 9>>
<</if>>
<<if ndef $ffBaseDefense>>
<<set $ffBaseDefense = 2>>
<</if>>
<<if ndef $ffBaseMorale>>
<<set $ffBaseMorale = 160>>
<</if>>
<<if ndef $ffBaseHp>>
<<set $ffBaseHp = 2>>
<</if>>

/* units */
<<if ndef $secBots>>
	<<if $arcologyUpgrade.drones == 0>>
		<<set $secBots = {
		active: 0,
		isDeployed: 0,
		troops: 0,
		maxTroops: 0,
		equip: 0} >>
	<<elseif $arcologyUpgrade.drones == 1>>
		<<set $secBots = {
		active: 1,
		isDeployed: 0,
		troops: 30,
		maxTroops: 30,
		equip: 0} >>
	<</if>>
<</if>>

<<if ndef $militiaUnits>>
	<<set $militiaUnits = []>>
<</if>>
<<if ndef $slaveUnits>>
	<<set $slaveUnits = []>>
<</if>>
<<if ndef $mercUnits>>
	<<set $mercUnits = []>>
<</if>>

/* SFanon additions */
<<if ndef $SFSupportLevel>>
	<<set $SFSupportLevel = 0>>
<</if>>
<<if ndef $SFSupportUpkeep>>
<<set $SFSupportUpkeep = 0>>
<</if>>
<<if ndef $secUpgrades.coldstorage>>
	<<set $secUpgrades.coldstorage = 0>>
<</if>>

/* recalculation widgets */
<<fixBrokenUnits>>
<<fixBrokenStats>>
<<fixBrokenFS>>
<<recalcSecRestPoint>>
<<recalcCrimeCap>>
<<recalcReqHelots>>
<<recalcManpower>>
<<recalcEdictsUpkeep>>
<<recalcBaseStats>>
<<recalcUnits>>

<<set $wasToggledBefore = 1>>

<br>Missing Security Expansion variables set. All done!


code:
:: attackGenerator [nobr]

/* _attackChance value is the chance out of 100 of an attack happening this week */
/* attacks are deactivated if battles are not enabled, the arcology is in the middle of the ocean, security drones are not around yet, there is not a rebellion this week or the last attack/rebellion happened within 3 weeks */
<<if $battlesEnabled == 0 || ($terrain == "oceanic" && $battlesEnabledOceanic == 0) || $arcologyUpgrade.drones != 1 || $lastAttackWeeks <= 3 || $citizenRebellion == 1 || $slaveRebellion == 1 || $lastRebellionWeeks <= 3>>
	<<set _attackChance = 0>>
<<else>>
	<<if $week < 30>>
		<<set _attackChance = 5>>
	<<elseif $week < 60>>
		<<set _attackChance = 8>>
	<<elseif $week < 90>>
		<<set _attackChance = 12>>
	<<elseif $week < 120>>
		<<set _attackChance =16>>
	<<else>>
		<<set _attackChance =20>>
	<</if>>
	<<if $hasFoughtOnce == 1>>
		<<set _attackChance = 25>>
	<</if>>
	<<if $lastAttackWeeks >= 10>>
		<<set _attackChance += 5>>
	<</if>>
<</if>>
/* battle frequency */
<<set _attackChance *= $battleFrequency>>

<<if $forceBattle == 1 && $forceRebellion != 1 && $foughtThisWeek == 0>>
	<<set _attackChance = 100>>
<</if>>

/* Rolls to see if attack happens this week */
/* raiders are attracted by low security */
/* the old world by "degenerate" future societies */
/* free Cities by high prosperity */
/* freedom fighters by high slave/citizen ratio */
<<if random(1,100) <= _attackChance>>
	<<set $attackThisWeek = 1>>
	<<set $lastAttackWeeks = 0>>
	<<set $leadingTroops = "assistant">>
	<<set $deployableUnits = 2 * $readiness>>
	<<set $chosenTactic = either("Bait and Bleed", "Guerrilla", "Choke Points", "Interior Lines", "Pincer Manouver", "Defense In Depth", "Blitzkrieg", "Human Wave")>>
	/* _type is the chance out of 100 of an attack of that type happening */
	<<set _raider = 25>>
	<<set _oldWorld = 25>>
	<<set _freeCity = 25>>
	<<set _free = 25>>
	/* old world */
	<<if $arcologies[0].FSRomanRevivalist != "unset" || $arcologies[0].FSEdoRevivalist != "unset" || $arcologies[0].FSArabianRevivalist != "unset" || $arcologies[0].FSChineseRevivalist != "unset" || $arcologies[0].FSEgyptianRevivalist != "unset" || $arcologies[0].FSAztecRevivalist != "unset" || $arcologies[0].FSRepopulationFocus != "unset" || $arcologies[0].FSGenderRadicalist != "unset" || $arcologies[0].FSPastoralist != "unset" || $arcologies[0].FSChattelReligionist != "unset">>
		<<set _oldWorld += 15>>
		<<set _raider -= 5>>
		<<set _freeCity -= 5>>
		<<set _free -= 5>>
	<<elseif ($arcologies[0].FSRomanRevivalist != "unset" || $arcologies[0].FSEdoRevivalist != "unset" || $arcologies[0].FSArabianRevivalist != "unset" || $arcologies[0].FSChineseRevivalist != "unset" || $arcologies[0].FSEgyptianRevivalist != "unset" || $arcologies[0].FSAztecRevivalist != "unset") && ($arcologies[0].FSRepopulationFocus != "unset" || $arcologies[0].FSGenderRadicalist != "unset" || $arcologies[0].FSPastoralist != "unset" || $arcologies[0].FSChattelReligionist != "unset")>>
		<<set _oldWorld += 24>>
		<<set _raider -= 8>>
		<<set _freeCity -= 8>>
		<<set _free -= 8>>
	<</if>>
	/* freedom fighter */
	<<if $ASlaves > $ACitizens * 2>>
		<<set _oldWorld -= 8>>
		<<set _raider -= 8>>
		<<set _freeCity -= 8>>
		<<set _free += 24>>
	<<elseif $ASlaves > $ACitizens * 1.2 || $arcologies[0].FSDegradationist != "unset">>
		<<set _oldWorld -= 5>>
		<<set _raider -= 5>>
		<<set _freeCity -= 5>>
		<<set _free += 15>>
	<</if>>
	/* free cities */
	<<if $arcologies[0].prosperity >= 10 && $arcologies[0].prosperity < 20>>
		<<set _oldWorld -= 5>>
		<<set _raider -= 5>>
		<<set _freeCity += 15>>
		<<set _free -= 5>>
	<<elseif $arcologies[0].prosperity >= 20>>
		<<set _oldWorld -= 8>>
		<<set _raider -= 8>>
		<<set _freeCity += 24>>
		<<set _free -= 8>>
	<</if>>
	/* raiders */
	<<if $security <= 50>>
		<<set _oldWorld -= 5>>
		<<set _raider += 15>>
		<<set _freeCity -= 5>>
		<<set _free -= 5>>
	<<elseif $security <= 25>>
		<<set _oldWorld -= 8>>
		<<set _raider += 24>>
		<<set _freeCity -= 8>>
		<<set _free -= 8>>
	<</if>>

	/* makes the actual roll */
	<<set _roll = random(1,100)>>
	<<if _roll <= _raider>>
		<<set $attackType = "raiders">>
	<<elseif _roll <= _raider + _oldWorld>>
		<<set $attackType = "old world">>
	<<elseif _roll <= _raider + _oldWorld + _freeCity>>
		<<set $attackType = "free city">>
	<<elseif _roll <= _raider + _oldWorld + _freeCity + _free>>
		<<set $attackType = "freedom fighters">>
	<</if>>
<<else>>
	<<set $lastAttackWeeks++>>
<</if>>

/* if an attack happens */
<<if $attackThisWeek == 1>>

	/* terrain */
	<<if $terrain == "urban">>
		<<set $battleTerrain = either("outskirts","urban","wasteland")>>
	<<elseif $terrain == "rural">>
		<<set $battleTerrain = either("hills","outskirts","rural","wasteland")>>
	<<elseif $terrain == "ravine">>
		<<set $battleTerrain = either("mountains","outskirts","hills","wasteland")>>
	<<elseif $terrain == "marine">>
		<<set $battleTerrain = either("coast","outskirts","hills","wasteland")>>
	<<elseif $terrain == "oceanic">>
		<<set $battleTerrain = either("coast","outskirts","hills","wasteland")>>
	<<else>>
		<<set $battleTerrain = "error">>
	<</if>>

	<<if $attackType == "raiders">>
		<<set $attackTroops = random(40,80)>>
		<<if $week < 30>>
			<<set $attackTroops *= random(1,2)>>
		<<elseif $week < 60>>
			<<set $attackTroops *= random(1,3)>>
		<<elseif $week < 90>>
			<<set $attackTroops *= random(2,3)>>
		<<elseif $week < 120>>
			<<set $attackTroops *= random(2,4)>>
		<<else>>
			<<set $attackTroops *= random(3,5)>>
		<</if>>
		<<if $week < 60>>
			<<set $attackEquip = random(0,1)>>
		<<elseif $week < 90>>
			<<set $attackEquip = random(0,2)>>
		<<elseif $week < 120>>
			<<set $attackEquip = random(0,3)>>
		<<else>>
			<<set $attackEquip = random(1,3)>>
		<</if>>
	<<elseif $attackType == "free city">>
		<<set $attackTroops = random(20,40)>>
		<<if $week < 30>>
			<<set $attackTroops *= random(1,2)>>
		<<elseif $week < 60>>
			<<set $attackTroops *= random(1,3)>>
		<<elseif $week < 90>>
			<<set $attackTroops *= random(2,3)>>
		<<elseif $week < 120>>
			<<set $attackTroops *= random(2,4)>>
		<<else>>
			<<set $attackTroops *= random(3,5)>>
		<</if>>
		<<if $week < 60>>
			<<set $attackEquip = random(0,1)>>
		<<elseif $week < 90>>
			<<set $attackEquip = random(0,3)>>
		<<elseif $week < 120>>
			<<set $attackEquip = random(1,3)>>
		<<else>>
			<<set $attackEquip = random(2,4)>>
		<</if>>
	<<elseif $attackType == "old world">>
		<<set $attackTroops = random(25,50)>>
		<<if $week < 30>>
			<<set $attackTroops *= random(1,2)>>
		<<elseif $week < 60>>
			<<set $attackTroops *= random(1,3)>>
		<<elseif $week < 90>>
			<<set $attackTroops *= random(2,3)>>
		<<elseif $week < 120>>
			<<set $attackTroops *= random(2,4)>>
		<<else>>
			<<set $attackTroops *= random(3,5)>>
		<</if>>
		<<if $week < 60>>
			<<set $attackEquip = random(0,1)>>
		<<elseif $week < 90>>
			<<set $attackEquip = random(0,3)>>
		<<elseif $week < 120>>
			<<set $attackEquip = random(1,3)>>
		<<else>>
			<<set $attackEquip = random(2,4)>>
		<</if>>
	<<elseif $attackType == "freedom fighters">>
		<<set $attackTroops = random(30,60)>>
		<<if $week < 30>>
			<<set $attackTroops *= random(1,2)>>
		<<elseif $week < 60>>
			<<set $attackTroops *= random(1,3)>>
		<<elseif $week < 90>>
			<<set $attackTroops *= random(2,3)>>
		<<elseif $week < 120>>
			<<set $attackTroops *= random(2,4)>>
		<<else>>
			<<set $attackTroops *= random(3,5)>>
		<</if>>
		<<if $week < 60>>
			<<set $attackEquip = random(0,1)>>
		<<elseif $week < 90>>
			<<set $attackEquip = random(0,3)>>
		<<elseif $week < 120>>
			<<set $attackEquip = random(1,3)>>
		<<else>>
			<<set $attackEquip = random(2,4)>>
		<</if>>
	<</if>>
	<<set $estimatedMen = Math.round($attackTroops * (1 + either(-1,1) * (random(3,4) - $recon) * 0.1))>>
	<<if $recon == 3>>
		<<set $expectedEquip = $attackEquip + random(-1,1)>>
	<<elseif $recon == 2>>
		<<set $expectedEquip = $attackEquip + random(-1,2)>>
	<<elseif $recon == 1>>
		<<set $expectedEquip = $attackEquip + random(-2,2)>>
	<<else>>
		<<set $expectedEquip = $attackEquip + random(-2,3)>>
	<</if>>
<</if>>

/* major battles have a 50% chance of firing after week 120 */
<<if $majorBattlesEnabled == 1>>
	<<if ($week >= 120 && $attackType != "none") || ($forceMajorBattle == 1 && $foughtThisWeek == 0)>>
		<<if random(1,100) >= 50 || $forceMajorBattle == 1>>
			<<set $majorBattle = 1>>
			<<set $attackTroops *= random(4,6)>>
			<<set $attackEquip = either(3,4)>>
			<<set $estimatedMen = Math.round($attackTroops * (1 + either(-1,1) * (random(3,4) - $recon) * 0.1))>>
			<<if $recon == 3>>
				<<set $expectedEquip = $attackEquip + random(-1,1)>>
			<<elseif $recon == 2>>
				<<set $expectedEquip = $attackEquip + random(-1,2)>>
			<<elseif $recon == 1>>
				<<set $expectedEquip = $attackEquip + random(-2,2)>>
			<<else>>
				<<set $expectedEquip = $attackEquip + random(-2,3)>>
			<</if>>
		<</if>>
	<</if>>
<</if>>