* Ersthelfer

Wählt das nächstliegende Ersthelferfahrzeug aus

目前为 2024-02-28 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name * Ersthelfer
  3. // @namespace bos-ernie.leitstellenspiel.de
  4. // @version 1.0.0-alpha
  5. // @license BSD-3-Clause
  6. // @author BOS-Ernie
  7. // @description Wählt das nächstliegende Ersthelferfahrzeug aus
  8. // @match https://*.leitstellenspiel.de/missions/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=leitstellenspiel.de
  10. // @run-at document-idle
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function () {
  15. /**
  16. * Liste der Fahrzeugtypen die als Ersthelfer ausgewöhlt werden dürfen.
  17. *
  18. * Nicht zu verwendende Fahrzeuge auskommentieren oder entfernen. Die Liste aktueller Fahrzeugtypen wird im Forum
  19. * gepflegt (siehe Link).
  20. * https://forum.leitstellenspiel.de/index.php?thread/8406-infos-f%C3%BCr-entwickler/&postID=485487#post485487
  21. *
  22. * @type {number[]}
  23. */
  24. const firstResponderVehicleTypeIds = [
  25. 0, // LF 20
  26. 1, // LF 10
  27. 2, // DLK 23
  28. 3, // ELW 1
  29. 4, // RW
  30. 5, // GW-A
  31. 6, // LF 8/6
  32. 7, // LF 20/16
  33. 8, // LF 10/6
  34. 9, // LF 16-TS
  35. 10, // GW-Öl
  36. 11, // GW-L2-Wasser
  37. 12, // GW-Messtechnik
  38. 13, // SW 1000
  39. 14, // SW 2000
  40. 15, // SW 2000-Tr
  41. 16, // SW Kats
  42. 17, // TLF 2000
  43. 18, // TLF 3000
  44. 19, // TLF 8/8
  45. 20, // TLF 8/18
  46. 21, // TLF 16/24-Tr
  47. 22, // TLF 16/25
  48. 23, // TLF 16/45
  49. 24, // TLF 20/40
  50. 25, // TLF 20/40-SL
  51. 26, // TLF 16
  52. 27, // GW-Gefahrgut
  53. 28, // RTW
  54. 29, // NEF
  55. 30, // HLF 20
  56. 31, // RTH
  57. 32, // FuStW
  58. 33, // GW-Höhenrettung
  59. 34, // ELW 2
  60. 35, // leBefKw
  61. 36, // MTW
  62. 37, // TSF-W
  63. 38, // KTW
  64. 39, // GKW
  65. 40, // MTW-TZ
  66. 41, // MzGW (FGr N)
  67. 42, // LKW K 9
  68. 43, // BRmG R
  69. 44, // Anh DLE
  70. 45, // MLW 5
  71. 46, // WLF
  72. 47, // AB-Rüst
  73. 48, // AB-Atemschutz
  74. 49, // AB-Öl
  75. 50, // GruKw
  76. 51, // FüKw
  77. 52, // GefKw
  78. 53, // Dekon-P
  79. 54, // AB-Dekon-P
  80. 55, // KdoW-LNA
  81. 56, // KdoW-OrgL
  82. 57, // FwK
  83. 58, // KTW Typ B
  84. 59, // ELW 1 (SEG)
  85. 60, // GW-San
  86. 61, // Polizeihubschrauber
  87. 62, // AB-Schlauch
  88. 63, // GW-Taucher
  89. 64, // GW-Wasserrettung
  90. 65, // LKW 7 Lkr 19 tm
  91. 66, // Anh MzB
  92. 67, // Anh SchlB
  93. 68, // Anh MzAB
  94. 69, // Tauchkraftwagen
  95. 70, // MZB
  96. 71, // AB-MZB
  97. 72, // WaWe 10
  98. 73, // GRTW
  99. 74, // NAW
  100. 75, // FLF
  101. 76, // Rettungstreppe
  102. 77, // AB-Gefahrgut
  103. 78, // AB-Einsatzleitung
  104. 79, // SEK - ZF
  105. 80, // SEK - MTF
  106. 81, // MEK - ZF
  107. 82, // MEK - MTF
  108. 83, // GW-Werkfeuerwehr
  109. 84, // ULF mit Löscharm
  110. 85, // TM 50
  111. 86, // Turbolöscher
  112. 87, // TLF 4000
  113. 88, // KLF
  114. 89, // MLF
  115. 90, // HLF 10
  116. 91, // Rettungshundefahrzeug
  117. 92, // Anh Hund
  118. 93, // MTW-O
  119. 94, // DHuFüKw
  120. 95, // Polizeimotorrad
  121. 96, // Außenlastbehälter (allgemein)
  122. 97, // ITW
  123. 98, // Zivilstreifenwagen
  124. 100, // MLW 4
  125. 101, // Anh SwPu
  126. 102, // Anh 7
  127. 103, // FuStW (DGL)
  128. 104, // GW-L1
  129. 105, // GW-L2
  130. 106, // MTF-L
  131. 107, // LF-L
  132. 108, // AB-L
  133. 109, // MzGW SB
  134. 110, // NEA50
  135. 111, // NEA50
  136. 112, // NEA200
  137. 113, // NEA200
  138. 114, // GW-Lüfter
  139. 115, // Anh Lüfter
  140. 116, // AB-Lüfter
  141. 117, // AB-Tank
  142. 118, // Kleintankwagen
  143. 119, // AB-Lösch
  144. 120, // Tankwagen
  145. 121, // GTLF
  146. 122, // LKW 7 Lbw (FGr E)
  147. 123, // LKW 7 Lbw (FGr WP)
  148. 124, // MTW-OV
  149. 125, // MTW-Tr UL
  150. 126, // MTF Drohne
  151. 127, // GW UAS
  152. 128, // ELW Drohne
  153. 129, // ELW2 Drohne
  154. 130, // GW-Bt
  155. 131, // Bt-Kombi
  156. 132, // FKH
  157. 133, // Bt LKW
  158. 134, // Pferdetransporter klein
  159. 135, // Pferdetransporter groß
  160. 136, // Anh Pferdetransport
  161. 137, // Zugfahrzeug Pferdetransport
  162. ];
  163.  
  164. function addSelectButton() {
  165. const icon = document.createElement("span");
  166. icon.classList.add("glyphicon", "glyphicon-fire");
  167.  
  168. const firstResponderButton = document.createElement("button");
  169. firstResponderButton.classList.add("btn", "btn-primary");
  170. firstResponderButton.appendChild(icon);
  171. firstResponderButton.addEventListener("click", clickEventHandler);
  172.  
  173. const wrapper = document.createElement("div");
  174. wrapper.classList.add("flex-row", "flex-nowrap");
  175. wrapper.appendChild(firstResponderButton);
  176.  
  177. const iframeBottomContent = document.querySelector("#iframe-bottom-content");
  178. if (iframeBottomContent === null) {
  179. return;
  180. }
  181.  
  182. let parent = iframeBottomContent.querySelector("#mission_alliance_share_btn");
  183. if (parent === null) {
  184. parent = iframeBottomContent.querySelector("#mission_next_mission_btn");
  185. }
  186.  
  187. parent.parentElement.after(wrapper);
  188. }
  189.  
  190. function clickEventHandler(event) {
  191. event.preventDefault();
  192. selectFirstResponder();
  193. }
  194.  
  195. async function selectFirstResponder() {
  196. const checkboxes = document.getElementsByClassName("vehicle_checkbox");
  197.  
  198. let firstResponderFound = false;
  199. for (let i = 0; i < checkboxes.length; i++) {
  200. const checkbox = checkboxes[i];
  201.  
  202. if (checkbox.disabled) {
  203. continue;
  204. }
  205.  
  206. if (checkbox.checked) {
  207. continue;
  208. }
  209.  
  210. const vehicleTypeId = parseInt(checkbox.getAttribute("vehicle_type_id"));
  211. if (firstResponderVehicleTypeIds.includes(vehicleTypeId)) {
  212. checkbox.click();
  213. firstResponderFound = true;
  214.  
  215. break;
  216. }
  217. }
  218.  
  219. if (!firstResponderFound) {
  220. alert(
  221. "[Ersthelfer] Kein passendes Fahrzeug in der aktuellen Liste gefunden. Entweder Fahrzeuge nachladen oder Fahrzeugtypen überprüfen.",
  222. );
  223. }
  224. }
  225.  
  226. function main() {
  227. addSelectButton();
  228.  
  229. document.addEventListener("keydown", function (event) {
  230. if (event.key === "f") {
  231. selectFirstResponder();
  232. }
  233. });
  234. }
  235.  
  236. main();
  237. })();