You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

296 lines
12 KiB

  1. {% extends "base.html" %}
  2. {% set active_page = "npcparty" %}
  3. {% block title %}NPC Party Generation{% endblock %}
  4. {% block content %}
  5. <div class="uk-flex uk-flex-center uk-margin-bottom uk-margin-top">
  6. <h1>Adventurer Conqueror King NPC Party Generator</h1>
  7. </div>
  8. <div class="uk-flex uk-flex-bottom uk-flex-center uk-margin-large-bottom">
  9. <div>
  10. <label for="base_level">Base level of party to generate: </label>
  11. <input type="number" name="base_level" id="base_level" class="uk-input" value="{{ base_level if base_level else 1 }}" >
  12. </div>
  13. <div class="uk-margin-left">
  14. <button class="uk-button uk-button-primary" onclick="generateParty();">Generate</button>
  15. </div>
  16. </div>
  17. <hr class="uk-divider-icon">
  18. {% if party %}
  19. <div class="uk-flex uk-flex-between uk-margin-large-top">
  20. <h3 class="uk-display-inline-block">NPC Party of Size {{ party | length }} </h3>
  21. <div class="uk-text-right uk-display-inline-block">
  22. <a class="uk-button uk-button-small uk-button-secondary uk-border-rounded" onclick="showExportModal();">Roll20 Export</a>
  23. </div>
  24. </div>
  25. <div class="uk-grid-medium uk-grid-match uk-flex-center" uk-grid>
  26. {% for npc in party %}
  27. <div class="acks-npc-card">
  28. <div class="uk-card uk-card-body uk-card-default uk-box-shadow-hover-large">
  29. <h4 class="uk-card-title uk-margin-small-top">{{ npc.name }}</h4>
  30. <div class="uk-card-badge uk-label uk-label-primary">{{ npc.guild.name }}</div>
  31. <div class="uk-flex uk-flex-around uk-text-center uk-margin-bottom">
  32. <div>
  33. <div class="uk-text-bold">Level</div>
  34. <div>{{ npc.level }}</div>
  35. </div>
  36. <div>
  37. <div class="uk-text-bold">HP</div>
  38. <div>{{ npc.hp }}</div>
  39. </div>
  40. <div>
  41. <div class="uk-text-bold">AC</div>
  42. <div>{{ npc.armour.ac_mod }}</div>
  43. </div>
  44. </div>
  45. <div class="uk-flex uk-flex-around stat-block">
  46. <div>
  47. <div title="{{ npc.str_mod }}">{{ npc.str }}</div>
  48. <div title="{{ npc.str_mod }}">Str</div>
  49. </div>
  50. <div>
  51. <div title="{{ npc.int_mod }}">{{ npc.int }}</div>
  52. <div title="{{ npc.int_mod }}">Int</div>
  53. </div>
  54. <div>
  55. <div title="{{ npc.wis_mod }}">{{ npc.wis }}</div>
  56. <div title="{{ npc.wis_mod }}">Wis</div>
  57. </div>
  58. <div>
  59. <div title="{{ npc.dex_mod }}">{{ npc.dex }}</div>
  60. <div title="{{ npc.dex_mod }}">Dex</div>
  61. </div>
  62. <div>
  63. <div title="{{ npc.con_mod }}">{{ npc.con }}</div>
  64. <div title="{{ npc.con_mod }}">Con</div>
  65. </div>
  66. <div>
  67. <div title="{{ npc.chr_mod }}">{{ npc.chr }}</div>
  68. <div title="{{ npc.chr_mod }}">Chr</div>
  69. </div>
  70. </div>
  71. <hr class="uk-divider-small uk-text-center">
  72. <div class="uk-flex uk-flex-around uk-text-center uk-margin-bottom save-block uk-margin-top">
  73. <div>
  74. <div title="Petrification & Paralysis">{{ npc.save_pp }}</div>
  75. <div title="Petrification & Paralysis">P &amp; P</div>
  76. </div>
  77. <div>
  78. <div title="Poison & Death">{{ npc.save_pd }}</div>
  79. <div title="Poison & Death">P &amp; D</div>
  80. </div>
  81. <div>
  82. <div title="Blast & Breath">{{ npc.save_bb }}</div>
  83. <div title="Blast & Breath">B &amp; B</div>
  84. </div>
  85. <div>
  86. <div title="Staffs & Wands">{{ npc.save_sw }}</div>
  87. <div title="Staffs & Wands">S &amp; W</div>
  88. </div>
  89. <div>
  90. <div title="Spells">{{ npc.save_sp }}</div>
  91. <div title="Spells">Spells</div>
  92. </div>
  93. </div>
  94. <ul uk-tab>
  95. <li class="uk-active"><a href="">Equipment</a></li>
  96. <li {% if not npc.spellcaster %}class="uk-disabled"{% endif %}><a href="">Spells</a></li>
  97. </ul>
  98. <ul class="uk-switcher uk-margin">
  99. <li>
  100. <table class="uk-table uk-table-hover uk-table-small item-table">
  101. <thead>
  102. <tr> <th>Name</th><th>Worth</th><th>Thr</th><th>Dmg</th> </tr>
  103. </thead>
  104. <tbody>
  105. <tr>
  106. <td>{{ npc.melee.name }}</td>
  107. <td>{{ npc.melee.gp_value }}gp</td>
  108. <td>{{ npc.attack_throw }}</td>
  109. <td>{{ npc.melee.damage_die }}</td>
  110. </tr>
  111. {% if npc.ranged %}
  112. <tr>
  113. <td>{{ npc.ranged.name }}</td>
  114. <td>{{ npc.ranged.gp_value }}gp</td>
  115. <td>{{ npc.attack_throw }}</td>
  116. <td>{{ npc.ranged.damage_die }}</td>
  117. </tr>
  118. {% endif %}
  119. <tr>
  120. <td>{{ npc.armour.name }}</td>
  121. <td>{{ npc.armour.gp_value }}gp</td>
  122. <td></td>
  123. <td></td>
  124. </tr>
  125. </tbody>
  126. </table>
  127. </li>
  128. <li>
  129. <table class="uk-table uk-table-hover uk-table-small item-table">
  130. <thead>
  131. <tr> <th>Name</th><th>Worth</th><th>Thr</th><th>Dmg</th> </tr>
  132. </thead>
  133. <tbody>
  134. <tr>
  135. <td>{{ npc.melee.name }}</td>
  136. <td>{{ npc.melee.gp_value }}gp</td>
  137. <td>{{ npc.attack_throw }}</td>
  138. <td>{{ npc.melee.damage_die }}</td>
  139. </tr>
  140. {% if npc.ranged %}
  141. <tr>
  142. <td>{{ npc.ranged.name }}</td>
  143. <td>{{ npc.ranged.gp_value }}gp</td>
  144. <td>{{ npc.attack_throw }}</td>
  145. <td>{{ npc.ranged.damage_die }}</td>
  146. </tr>
  147. {% endif %}
  148. <tr>
  149. <td>{{ npc.armour.name }}</td>
  150. <td>{{ npc.armour.gp_value }}gp</td>
  151. <td></td>
  152. <td></td>
  153. </tr>
  154. </tbody>
  155. </table>
  156. </li>
  157. </ul>
  158. </div>
  159. </div>
  160. {% endfor %}
  161. </div>
  162. {% endif %}
  163. <div id="party-export-modal" uk-modal>
  164. <div class="uk-modal-dialog uk-margin-auto-vertical">
  165. <button class="uk-modal-close-default" type="button" uk-close></button>
  166. <div class="uk-modal-header">
  167. <h2 class="uk-modal-title">Roll20 Export</h2>
  168. </div>
  169. <div class="uk-modal-body">
  170. <div class="uk-margin">
  171. <h5>Characters to Export:</h5>
  172. <div id="pe_selects" class="uk-grid-small uk-grid uk-child-width-auto">
  173. {% if party %}
  174. {% for npc in party %}
  175. <label><input class="uk-checkbox" type="checkbox" name="ch{{ loop.index }}" onchange="prepareSelectiveExport();" checked> {{ npc.name }}</label>
  176. {% endfor %}
  177. {% endif %}
  178. </div>
  179. <div class="uk-margin uk-align-right">
  180. <div class="uk-button-group">
  181. <button id="pe_none" class="uk-button uk-button-small uk-button-default" onclick="partyExportToggle();">None</button>
  182. <button id="pe_all" class="uk-button uk-button-small uk-button-secondary" onclick="partyExportToggle();">All</button>
  183. </div>
  184. </div>
  185. </div>
  186. <textarea id="party-export-show" class="uk-textarea uk-text-small" rows="10"></textarea>
  187. <textarea id="party-export-data" class="uk-textarea uk-hidden"></textarea>
  188. </div>
  189. <div class="uk-modal-footer uk-text-right">
  190. <button class="uk-button uk-button-default uk-modal-close" type="button">Cancel</button>
  191. <button class="uk-button uk-button-primary" type="button" onclick="exportParty();">Copy</button>
  192. </div>
  193. </div>
  194. </div>
  195. <br>
  196. <style>
  197. table.item-table, table.item-table th {
  198. font-size: 12px;
  199. }
  200. div.stat-block > div {
  201. text-align: center;
  202. padding: 3px;
  203. width: 26px;
  204. }
  205. div.stat-block > div > div:first-child {
  206. font-weight: bold;
  207. color: green;
  208. }
  209. div.stat-block > div > div:last-child {
  210. font-weight: bold;
  211. font-size: 12px;
  212. color: #888;
  213. }
  214. div.save-block > div > div:first-child {
  215. font-weight: bold;
  216. color: purple;
  217. }
  218. div.save-block > div > div:last-child {
  219. font-weight: bold;
  220. font-size: 12px;
  221. color: #888;
  222. }
  223. div.acks-npc-card {
  224. width: 400px;
  225. }
  226. </style>
  227. <script type="text/javascript">
  228. var party = [];
  229. function generateParty() {
  230. let bl = document.querySelector('#base_level').value;
  231. window.location = "/npc/party/" + bl.toString();
  232. }
  233. function showExportModal() {
  234. {% if party %}
  235. {% for npc in party %}
  236. party.push(JSON.parse('{{ npc.roll20_format | tojson }}'));
  237. {% endfor %}
  238. {% endif %}
  239. for(let cb of document.querySelectorAll('#pe_selects > label > input')) {
  240. cb.checked = true;
  241. }
  242. prepareSelectiveExport();
  243. UIkit.modal(document.querySelector('#party-export-modal')).show();
  244. }
  245. function prepareSelectiveExport() {
  246. var selected_party = [];
  247. var checkboxes = document.querySelectorAll('#pe_selects > label > input');
  248. for(let [i, cb] of checkboxes.entries()) {
  249. if(cb.checked) {
  250. selected_party.push(party[i]);
  251. }
  252. }
  253. document.querySelector('#party-export-data').value = "!acksimport " + JSON.stringify(selected_party);
  254. document.querySelector('#party-export-show').value = JSON.stringify(selected_party, undefined, 2);
  255. }
  256. function exportParty() {
  257. let party_data = document.querySelector('#party-export-data')
  258. party_data.classList.remove('uk-hidden');
  259. party_data.select();
  260. document.execCommand("copy");
  261. party_data.classList.add('uk-hidden');
  262. UIkit.modal(document.querySelector('#party-export-modal')).hide();
  263. }
  264. function partyExportToggle() {
  265. var checkboxes = document.querySelectorAll('#pe_selects > label > input');
  266. for(let cb of checkboxes) {
  267. if(event.target.id === "pe_none") {
  268. cb.checked = false;
  269. }
  270. if(event.target.id === "pe_all") {
  271. cb.checked = true;
  272. }
  273. }
  274. prepareSelectiveExport();
  275. }
  276. </script>
  277. {% endblock %}