Advertisement
Tikabum

## TROOP REPORT ## (Yoda Model)

Dec 21st, 2017
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 63.51 KB | None | 0 0
  1. // ==UserScript==
  2. // @name ## TROOP REPORT ## (Yoda Model)
  3. // @namespace https://pastebin.com/raw/6CcRxsB4
  4. // @icon https://i.imgur.com/B7OXBYK.png
  5. //⭐ESCOLHA SEU ÍCONE https://pastebin.com/raw/wpcDVCdE
  6. // @author TiKa and Tsalkapone
  7. // @include https://br*.tribalwars.com.br/*overview_villages&mode=units*
  8. // @version 3.9 (21/12/2017)
  9. // @changelog ⌛ PARA MOSTRAR/OCULTAR CLIQUE NA SETA AO LADO DO NÚMERO "10" NA LINHA ABAIXO! ⌛
  10. /*
  11. // 1.0 - Script do Tsalkapone
  12. // 2.0 - Script Otimizado
  13. // 2.1 - Áreas de Ação Corrigidas
  14. // 2.2 - Agora o Script Funciona em "Na Aldeia"
  15. // 2.3 - Script Completamente Traduzido ao Pt/Br
  16. // 2.4 - Corrigido bug onde o Script Contava ODD como ODA
  17. // 2.5 - Agora o Script Funciona em Todas as Seções de Tropas!
  18. // 2.6 - Populações de Grupos Otimizada
  19. // 2.7 - Valor de Full Definido em 20k
  20. // 2.8 - Códigos de Tabela e Mensagens Otimizados
  21. // 2.9 - Gif Alterado para Kate Upton
  22. // 3.0 - Tabela Otimizada
  23. // 3.1 - Emoticons Inseridos
  24. // 3.2 - Personagem Tema Inserido
  25. // 3.3 - Esquema de Cores Otimizado
  26. // 3.4 - Modelos de Personagens Incluídos
  27. // 3.5 - Informações Extra Adicionadas
  28. // 3.6 - Script Apelidado de ## TROOP REPORT ##
  29. // 3.7 - Adicionado "Legal" do Mestre Yoda
  30. // 3.8 - Esquema de Cores Otimizado
  31. // 3.9 - Bugs e Erros de Tradução Corrigidos!
  32. */
  33. // ==/UserScript==
  34.  
  35. var get_lang = localStorage.getItem("troops_counter_lang");
  36. var lang="";
  37. if (get_lang === null) {lang = "brazilian";}
  38. else { lang = ""+get_lang+"";}
  39. var supported_languages =["greek","english","brazilian"];
  40. var lang_check = supported_languages.indexOf(lang);
  41. if (lang_check < 0) {UI.ErrorMessage('<font color=gold><b><center><u>'+tsalkapone_trans.general.notification+' STRIKE</u></center></b></font> <br><br> The selected language is not supported. Please select one of the supported languages.', 5000);}
  42. else {
  43. var tsalkapone_trans = (function() {
  44. var tsalkapone_trans = {};
  45. tsalkapone_trans.brazilian= {
  46. general:{
  47. script:"Relatório e Contagem de Tropas",
  48. notification:"Notificação",
  49. twconfig:"Clique para Mostrar/Ocultar as Configurações",
  50. message_no:"Não",
  51. message_yes:"Sim",
  52. selected_one:"Idioma Selecionado Atualmente",
  53. available:"Idiomas Disponíveis",
  54. button_list:"Opções",
  55. lang_sel:"Clique para Trocar o Idioma Atual",
  56. message_1:"O Script Funciona em ~ Visualizações > Tropas > Todas as Seções Disponíveis",
  57. message_2:"Você gostaria de ser Redirecionado Automaticamente?",
  58. message_units1:"Vá para a Seção Todos",
  59. message_units2:"Vá para a Seção Próprias",
  60. message_units3:"Vá para a Seção Apoios",
  61. comm:"Sinta-se livre para Relatar qualquer BUG do Script ou Enviar Sugestões de Melhoria.",
  62. temp1:"NT Seguro 5 Nobres",
  63. temp2:"NT Casual 4 Nobres",
  64. temp3:"NT em Aldeia Defensiva",
  65. temp4:"Menos de 4 Nobres",
  66. temp5:"ATAQUE FULL",
  67. temp6:"Ataque 3/4",
  68. temp7:"Ataque 1/2",
  69. temp8:"Ataque 1/4",
  70. temp9:"Ataque com mais de 100 Catas",
  71. temp10:"Ataque com mais de 800 Aríetes",
  72. temp11:"Ataque com 500-800 Aríetes",
  73. temp12:"Ataque com 250-499 Aríetes",
  74. temp13:"Ataque com 100-249 Aríetes",
  75. temp14:"DEFESA FULL",
  76. temp15:"Defesa 3/4",
  77. temp16:"Defesa 1/2",
  78. temp17:"Defesa 1/4",
  79. temp18:"CATAPULTA FULL",
  80. temp19:"Catas 3/4",
  81. temp20:"Catas 1/2",
  82. temp21:"Aldeias com 500-1000 Catas",
  83. temp22:"Ao menos 1000 Pesadas",
  84. temp23:"Arqueiros",
  85. temp24:"Ao menos 1000 Lanças",
  86. temp25:"Ao menos 1000 Espadas",
  87. temp26:"Ao menos 1000 Lanças e Espadas",
  88. temp27:"Ao menos 1000",
  89. temp28:"Ao menos 1000 Lanças & Pesadas",
  90. temp29:"EXPLORADOR FULL",
  91. temp30:"Explorador 3/4",
  92. temp31:"Explorador 1/2",
  93. temp32:"Explorador 1/4",
  94. temp33:"Explorador 500-2500",
  95. temp34:"Aldeias com População Baixa",
  96. temp35:"Outras Aldeias com Nobre",
  97. temp36:"Espadas e Arcos",
  98. temp37:"Lanças e Catas",
  99. temp38:"Catas",
  100. temp39:"Aldeias Mistas",
  101. temp40:"Aldeia Ofensiva com Pesadas",
  102. temp41:"Aldeia Defensiva com Aríetes",
  103. temp42:"Aldeia Defensiva com Leves para Farm",
  104. temp43:"Aldeia Ofensiva com Defesa para Snip",
  105. edited:"Editado by",
  106. spear:"Lanceiro",
  107. sword:"Espadachin",
  108. axe:"Bárbaro",
  109. archer:"Arqueiro",
  110. spy:"Explorador",
  111. light:"Cavalaria Leve",
  112. heavy:"Cavalaria Pesada",
  113. marcher:"Arqueiro a Cavalo",
  114. ram:"Aríete",
  115. cats:"Catapulta",
  116. knight:"Paladino",
  117. snob:"Nobre",
  118. militia:"Milícia",
  119. offensive:"Tropas Ofensivas",
  120. defensive:"Tropas Defensivas",
  121. plithos:"Tropas Totais",
  122. monades:"Tropas",
  123. other:"Outras Tropas",
  124. farm:"Espaço TOTAL das Fazendas",
  125. report:"Relatório de Tropas",
  126. unit_info:"Cada número exibido abaixo refere-se a áreas de fazenda ocupadas por cada unidade ou categoria de unidades",
  127. sun:"&",
  128. groups:"⭐ GRUPOS DE ALDEIAS ⭐",
  129. counting:"⭐ CONTAGEM DE TROPAS ⭐",
  130. group1:"⚡ Aldeias com Nobre ⚡",
  131. group2:"⚡ Aldeias Ofensivas ⚡",
  132. group3:"⚡ Demolidores ⚡",
  133. group4:"⚡ Aldeias Defensivas ⚡",
  134. group5:"⚡ Aldeias com Catas ⚡",
  135. group6:"⚡ Modelos Defensivos ⚡",
  136. group7:"⚡ Aldeias de Exploração ⚡",
  137. group8:"⚡ Outros Tipos de Aldeias ⚡",
  138. group9:"Tropas Ofensivas",
  139. group10:"Tropas Defensivas",
  140. group11:"⚡ Outras Tropas ⚡",
  141. group12:"⚡ Tropas TOTAIS ⚡",
  142. group13:"⚡ Relatório de Tropas em Tabela ⚡",
  143. group14:"⚡ Relatório de Tropas em Mensagem ⚡",
  144. group15:"⚡ Selecionar Grupo de Coordenadas ⚡",
  145. player_name:"JOGADOR",
  146. oda_count:"TROPAS EM ODD",
  147. pop_count:"FULLS EM APOIO! (1 FULL = 20K POP)",
  148. },
  149. buttons:{
  150. lang_open:"Abrir Seleção de Idiomas",
  151. lang_close:"Fechar Seleção de Idiomas",
  152. set_show:"Mostrar",
  153. set_hide:"Ocultar",
  154. close_table:"Fechar",
  155. },
  156.  
  157. };
  158. tsalkapone_trans.english= {
  159. general:{
  160. script:"Troops Counting & Grouping",
  161. notification:"Notification from",
  162. twconfig:"Click to show/hide the configurations' and errors log in case you encounter any bug or error issues",
  163. message_no:"No",
  164. message_yes:"Yes",
  165. selected_one:"Current selected language",
  166. available:"Available languages",
  167. button_list:"Buttons List",
  168. lang_sel:"Click to change the selected language",
  169. message_1:"This script is activated on Overviews-> Troops-> All/Defenses/Support pages",
  170. message_2:" Do you want to automatically assign your location to one of these pages?",
  171. message_units1:"Go to All page",
  172. message_units2:"Go to Defenses page",
  173. message_units3:"Go to Support page",
  174. comm:"Feel free to send any message regarding script bugs or proposing ideas to",
  175. temp1:"Safe noble-trains",
  176. temp2:"Casual noble-trains",
  177. temp3:"Full defensive trains",
  178. temp4:"Less than 4 noblemen",
  179. temp5:"Full Nuke",
  180. temp6:"3/4 Nuke",
  181. temp7:"1/2 Nuke",
  182. temp8:"1/4 Nuke",
  183. temp9:"Nukes with more than 100 catapults",
  184. temp10:"Nukes with more than 800 rams",
  185. temp11:"Nukes with 500-800 rams",
  186. temp12:"Nukes with 250-499 rams",
  187. temp13:"Nukes with 100-249 rams",
  188. temp14:"Complete defense",
  189. temp15:"3/4 defense",
  190. temp16:"1/2 defense",
  191. temp17:"1/4 defense",
  192. temp18:"Complete cat-villages",
  193. temp19:"3/4 cat-villages",
  194. temp20:"1/2 cat-villages",
  195. temp21:"Cat-villages with 500-1000 cats",
  196. temp22:"At least 1000 heavy",
  197. temp23:"archers",
  198. temp24:"At least 1000 spears",
  199. temp25:"At least 1000 swords",
  200. temp26:"At least 1000 swords & spears",
  201. temp27:"At least 1000",
  202. temp28:"At least 1000 heavy & spears",
  203. temp29:"Complete scout-villages",
  204. temp30:"3/4 scout-villages",
  205. temp31:"1/2 scout-villages",
  206. temp32:"1/4 scout-villages",
  207. temp33:"500-2500 scouts",
  208. temp34:"Villages with low population",
  209. temp35:"Other villages with noblemen",
  210. temp36:"swords & archers",
  211. temp37:"spears & catapults",
  212. temp38:"catapults",
  213. temp39:"Mixed villages",
  214. temp40:"Offensive with heavy",
  215. temp41:"Defensive with rams",
  216. temp42:"Defensive with light for farming",
  217. temp43:"Offensive with defense",
  218. edited:"Edited by",
  219. spear:"Spearmen",
  220. sword:"Swordsmen",
  221. axe:"Axemen",
  222. archer:"Archers",
  223. spy:"Scouts",
  224. light:"Light cavalry",
  225. heavy:"Heavy cavalry",
  226. marcher:"Mounted archers",
  227. ram:"Rams",
  228. cats:"Catapults",
  229. knight:"Paladin",
  230. snob:"Noblemen",
  231. militia:"Militia",
  232. offensive:"Offensive units",
  233. defensive:"Defensive units",
  234. plithos:"Total units",
  235. monades:"Units",
  236. other:"Other units",
  237. farm:"Total farmspace",
  238. report:"Troops report",
  239. unit_info:"Every number displayed below refers to farmspace occupied by each unit or category of units",
  240. sun:"and",
  241. groups:"Village Groups",
  242. counting:"Troops Counting",
  243. group1:"Villages with noblemen",
  244. group2:"Offensive villages",
  245. group3:"Building Breakers",
  246. group4:"Defensive Villages",
  247. group5:"Villages with catapults",
  248. group6:"Defensive Templates",
  249. group7:"Scouting Villages",
  250. group8:"Other types of villages",
  251. group9:"Offensive units",
  252. group10:"Defensive units",
  253. group11:"Other units",
  254. group12:"Total units",
  255. group13:"Table code for tribal forums",
  256. group14:"Troops-report for mail/tribal forums",
  257. group15:"Selected Group Coordinates",
  258. player_name:"Player",
  259. oda_count:"ODA",
  260. pop_count:"Full Def Pop",
  261. },
  262. buttons:{
  263. lang_open:"Open language selection",
  264. lang_close:"Close language selection",
  265. set_show:"Show",
  266. set_hide:"Hide",
  267. close_table:"Close",
  268. },
  269.  
  270. };
  271. tsalkapone_trans.greek= {
  272. general:{
  273. script:"Ανάλυση και Κατηγοριοποίηση Στρατευμάτων",
  274. notification:"Ειδοποίηση από τον",
  275. twconfig:"Επιλέξτε για εμφάνιση/απόκρυψη σημειώσεων των ρυθμίσεων και αποτελεσμάτων σε περίπτωση που παρατηρήσετε οποιοδήποτε bug ή σφάλμα",
  276. selected_one:"Ενεργή γλώσσα",
  277. available:"Διαθέσιμες γλώσσες",
  278. button_list:"Πίνακας πλήκτρων",
  279. lang_sel:"Επιλέξτε για να αλλάξετε την επιλεγμένη γλώσσσα",
  280. message_no:"Όχι",
  281. message_yes:"Ναι",
  282. message_1:"Το συγκεκριμένο script ενεργοποιείται από τις Επισκοπήσεις->Στρατεύματα-> Όλα/Άμυνα/Υποστήριξη.",
  283. message_2:"Επιθυμείτε αυτόματη ανακατεύθυνση σε μία από τις παραπάνω σελίδες;",
  284. message_units1:"Μετάβαση σε Όλα",
  285. message_units2:"Μετάβαση σε Άμυνα",
  286. message_units3:"Μετάβαση σε Υποστήριξη",
  287. comm:"Επικοινωνήστε ανά πάσα στιγμή για οποιαδήποτε ιδέα ή πρόταση σχετικά με τα scripts με τον",
  288. temp1:"Ασφαλή τρένα",
  289. temp2:"Ολοκληρωμένες εκκαθαριστικές-τρένα",
  290. temp3:"Ολοκληρωμένα αμυντικά-τρένα",
  291. temp4:"Λιγότεροι από 4 αριστοκράτες",
  292. temp5:"Ολοκληρωμένη εκκαθαριστική",
  293. temp6:"3/4 εκκαθαριστικής",
  294. temp7:"1/2 εκκαθαριστικής",
  295. temp8:"1/4 εκκαθαριστικής",
  296. temp9:"Εκκαθαριστική με τουλάχιστον 100 καταπέλτες",
  297. temp10:"Εκκαθαριστικές με τουλάχιστον 800 κριούς",
  298. temp11:"Εκκαθαριστικές με 500-800 κριούς",
  299. temp12:"Εκκαθαριστικές με 250-499 κριούς",
  300. temp13:"Εκκαθαριστικές με 100-249 κριούς",
  301. temp14:"Ολοκληρωμένα αμυντικά",
  302. temp15:"3/4 αμυντικά",
  303. temp16:"1/2 αμυντικά",
  304. temp17:"1/4 αμυντικά",
  305. temp18:"Ολοκληρωμένα καταπελτάδικα",
  306. temp19:"3/4 καταπελτάδικα",
  307. temp20:"1/2 καταπελτάδικα",
  308. temp21:"Καταπελτάδικα με 500-1000 καταπέλτες",
  309. temp22:"Τουλάχιστον 1000 βαρύ",
  310. temp23:"τοξότες",
  311. temp24:"Τουλάχιστον 1000 δορατοφόροι",
  312. temp25:"Τουλάχιστον 1000 ξιφομάχοι",
  313. temp26:"Τουλάχιστον 1000 ξιφομάχοι & δορατοφόροι",
  314. temp27:"Τουλάχιστον 1000",
  315. temp28:"Τουλάχιστον 1000 βαρύ & δορατοφόροι",
  316. temp29:"Ολοκληρωμένα ανιχνευτάδικα",
  317. temp30:"3/4 ανιχνευτάδικα",
  318. temp31:"1/2 ανιχνευτάδικα",
  319. temp32:"1/4 ανιχνευτάδικα",
  320. temp33:"500-2500 ανιχνευτές",
  321. temp34:"Χωριά με μικρό πληθυσμό",
  322. temp35:"Άλλα χωριά με αρίστους",
  323. temp36:"ξιφομάχοι & τοξότες",
  324. temp37:"δορατοφόροι & καταπέλτες",
  325. temp38:"καταπέλτες",
  326. temp39:"Mικτά χωριά",
  327. temp40:"Επιθετικά με βαρύ",
  328. temp41:"Αμυντικά με κριούς",
  329. temp42:"Αμυντικά για farming",
  330. temp43:"Επιθετικά με άμυνα",
  331. edited:"Δημιουργήθηκε από τον",
  332. spear:"Δορατοφόροι",
  333. sword:"Ξιφομάχοι",
  334. axe:"Τσεκουρομάχοι",
  335. archer:"Τοξότες",
  336. spy:"Ανιχνευτές",
  337. light:"Ελαφρύ ιππικό",
  338. heavy:"Βαρύ ιππικό",
  339. marcher:"Έφιπποι τοξότες",
  340. ram:"Πολιορκητικοί κριοί",
  341. cats:"Καταπέλτες",
  342. knight:"Paladin",
  343. snob:"Αριστοκράτες",
  344. militia:"Εθνοφρουρά",
  345. offensive:"Επιθετικές μονάδες",
  346. defensive:"Αμυντικές μονάδες",
  347. plithos:"Σύνολο μονάδων",
  348. monades:"Μονάδες",
  349. other:"Άλλες μονάδες",
  350. farm:"Συνολικός χώρος αγροκτήματος",
  351. report:"Αναφορά στρατευμάτων",
  352. unit_info:"Κάθε αριθμός που παρουσιάζεται παρακάτω δηλώνει το χώρο αγροκτήματος που καταλαμβάνει μια μονάδα ή μια κατηγορία μονάδων",
  353. sun:"και",
  354. groups:"Ομάδες Χωριών",
  355. counting:"Υπολογισμός Στρατευμάτων",
  356. group1:"Χωριά με αρίστους",
  357. group2:"Επιθετικά χωριά",
  358. group3:"Χωριά καταρρίψεων",
  359. group4:"Αμυντικά χωριά",
  360. group5:"Χωριά με καταπέλτες",
  361. group6:"Πακέτα αμυνών",
  362. group7:"Χωριά με ανιχνευτές",
  363. group8:"Άλλα είδη χωριών",
  364. group9:"Επιθετικές Μονάδες",
  365. group10:"Αμυντικές Μονάδες",
  366. group11:"Άλλα είδη μονάδων",
  367. group12:"Συνολικές Μονάδες",
  368. group13:"Πίνακας στρατευμάτων για φυλετικό forum",
  369. group14:"Αναφορά στρατευμάτων για mail/forum",
  370. group15:"Συντεταγμένες επιλεγμένης Ομάδας",
  371. player_name:"Όνομα παίκτη",
  372. oda_count:"ODA",
  373. pop_count:"Σύνολο αμυντικών χωριών",
  374. },
  375. buttons:{
  376. lang_open:"Άνοιγμα επιλογής γλώσσας",
  377. lang_close:"Κλείσιμο επιλογής γλώσσας",
  378. set_show:"Εμφάνιση",
  379. set_hide:"Απόκρυψη",
  380. close_table:"Κλείσιμο",
  381. },
  382. };
  383. return tsalkapone_trans[lang];
  384. }());
  385. }
  386. var Tsalpage1 = location.href.indexOf('type=own_home') > -1;
  387. var Tsalpage2 = location.href.indexOf('type=away') > -1;
  388. var Tsalpage3 = location.href.indexOf('type=moving') > -1;
  389. var Tsalpage4 = location.href.indexOf('type=there') > -1;
  390. var Tsalpage5 = location.href.indexOf('type=support_detail') > -1;
  391. var Tsalpage6 = location.href.indexOf('type=away_detail') > -1;
  392. var Tsalactivepage = location.href.indexOf('mode=units') > -1;
  393. function Tsal_Number(x) {
  394. if (x=='' || x===undefined) {return x;}
  395. else { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");}
  396. }
  397. if (!Tsalactivepage || null) {
  398. var contact_url = "https://forum.tribalwars.net/member.php?114063-Tsalkapone";
  399. var content = '<div style=max-width:1000px;>' +
  400. '<h2 class="popup_box_header"><center><u><font color="darkgreen">## STRIKE TEAM ## '+tsalkapone_trans.general.script+'</font></u></center></h2>' +
  401. '<hr><p><center><font color=maroon><b>'+tsalkapone_trans.general.message_1+'</b></font></center></p>' +
  402. '<p><center><font color=maroon><b>'+tsalkapone_trans.general.message_2+'</b></font></center></p>' +
  403. '<br><br><center><input type="button" class="btn evt-confirm-btn btn-confirm-yes" id="go_man1" value="'+tsalkapone_trans.general.message_units1+'">&emsp;<input type="button" class="btn evt-confirm-btn btn-confirm-yes" id="go_man2" value="'+tsalkapone_trans.general.message_units2+'">&emsp;<input type="button" class="btn evt-confirm-btn btn-confirm-yes" id="go_man3" value="'+tsalkapone_trans.general.message_units3+'">&emsp;<input type="button" class="btn evt-cancel-btn btn-confirm-no" id="close_this" value="'+tsalkapone_trans.general.message_no+'"></center>'+
  404. '<br><br><hr><center><img class="tooltip-delayed" title="<font color=darkgreen>## STRIKE TEAM ## '+tsalkapone_trans.general.script+'</font>" src="https://i.imgur.com/RrAg5YW.gif" style="cursor:help; position: relative"></center><br><center><p>'+tsalkapone_trans.general.comm+' <a href="'+contact_url+'" title="Tsalkapone profile" target="_blank">Tsalkapone</a>.</p></center>' +
  405. '</div>';
  406. Dialog.show('fakescript1_info_intro', content);
  407. $("#go_man1").click(function () { window.location.assign(game_data.link_base_pure+"overview_villages&mode=units&type=complete");});
  408. $("#go_man2").click(function () { window.location.assign(game_data.link_base_pure+"overview_villages&mode=units&type=own_home");});
  409. $("#go_man3").click(function () { window.location.assign(game_data.link_base_pure+"overview_villages&mode=units&type=away_detail");});
  410. $("#close_this").click(function () { var close_this = document.getElementsByClassName('popup_box_close'); close_this[0].click(); });
  411. }
  412. else if (null) {
  413.  
  414.  
  415.  
  416. }
  417. else if (Tsalpage5 || Tsalpage6)
  418. {function Tsalkapone_Count_Support() {
  419. var doc=document;
  420. function ADS_Unterstuetzung_zaehlen(doc){
  421. var output = '';
  422. var world = ($("#units_table thead tr th:eq(5) img").attr("src").indexOf("unit_spy") == -1);
  423. var ar_img='<th style="text-align:center" ><img src="/graphic/unit/unit_spear.png" ></th><th style="text-align:center" ><img src="/graphic/unit/unit_sword.png" ></th>';
  424. ar_img+='<th style="text-align:center" ><img src="/graphic/unit/unit_archer.png" ></th><th style="text-align:center" ><img src="/graphic/unit/unit_spy.png" ></th>';
  425. ar_img+='<th style="text-align:center" ><img src="/graphic/unit/unit_marcher.png" ></th><th style="text-align:center" ><img src="/graphic/unit/unit_heavy.png" ></th>';
  426. ar_img+='<th style="text-align:center" ><img src="/graphic/unit/unit_catapult.png" ></th><th style="text-align:center" ><img src="/graphic/unit/unit_knight.png" ></th>';
  427. var nonar_img='<th style="text-align:center" ><img src="/graphic/unit/unit_spear.png" ></th><th style="text-align:center" ><img src="/graphic/unit/unit_sword.png" ></th>';
  428. nonar_img+='<th style="text-align:center" ><img src="/graphic/unit/unit_spy.png" ></th><th style="text-align:center" ><img src="/graphic/unit/unit_heavy.png" ></th>';
  429. nonar_img+='<th style="text-align:center" ><img src="/graphic/unit/unit_catapult.png" ></th><th style="text-align:center" ><img src="/graphic/unit/unit_knight.png" ></th>';
  430. var num_spear = 0;
  431. var num_sword = 1;
  432. var num_archer = (world ? 3:-999);
  433. var num_spy = (world ? 4:3);
  434. var num_marcher = (world ? 6:-999);
  435. var num_heavy = (world ? 7:5);
  436. var num_catapult = (world ? 9:7);
  437. var num_knight = (world ? 10:8);
  438. var units_img=(world ? ar_img:nonar_img);
  439. var obj = new Object();
  440. $('#units_table tr.row_a, #units_table tr.row_b').each(function(a) {
  441. acc = '';
  442. $(this).find('a').each(function(b) {
  443. if ($(this).attr('href').search(/info_player&/) != -1) {acc = '<a href="'+$(this).attr('href')+'" target="_blank">'+$(this).html()+'</a>';}
  444. }
  445. );
  446. if (acc != '') {
  447. var count = obj[acc];
  448. if (obj[acc] == undefined) {
  449. count = new Object();
  450. count.spear = 0;
  451. count.sword = 0;
  452. count.archer = 0;
  453. count.spy = 0;
  454. count.marcher = 0;
  455. count.heavy = 0;
  456. count.catapult = 0;
  457. count.knight = 0;
  458. obj[acc] = count;
  459. }
  460. count.spear += parseInt($(this).find('td.unit-item:eq('+ num_spear +')').html());
  461. count.sword += parseInt($(this).find('td.unit-item:eq('+ num_sword +')').html());
  462. if (world) count.archer += parseInt($(this).find('td.unit-item:eq('+ num_archer +')').html());
  463. count.spy += parseInt($(this).find('td.unit-item:eq('+ num_spy +')').html());
  464. if (world) count.marcher += parseInt($(this).find('td.unit-item:eq('+ num_marcher +')').html());
  465. count.heavy += parseInt($(this).find('td.unit-item:eq('+ num_heavy +')').html());
  466. count.catapult += parseInt($(this).find('td.unit-item:eq('+ num_catapult +')').html());
  467. count.knight += parseInt($(this).find('td.unit-item:eq('+ num_knight +')').html());
  468. obj[acc] = count;
  469. }
  470. });
  471. var counter = 0;
  472. var sum = 0;
  473. troops = (typeof(Truppenanzahl) == 'undefined') ? 20000 : Truppenanzahl; // ⚡ Definir valor do FULL
  474. $.each(obj, function(acc,count) {
  475. counter++;
  476. deffs = ((count.spear + count.sword + count.archer + 2*count.spy + 5*count.marcher + 6*count.heavy + 8*count.catapult)/troops).toFixed(1); // ⚡ Variável que conta as tropas por população
  477. odd= 4*count.spear + 5*count.sword + 6*count.archer + 1*count.spy + 6*count.marcher + 23*count.heavy + 12*count.catapult; // ⚡ Variável que conta as tropas em ODD
  478. output +='<tr><td><center>'+acc+ '</center></td><td><center>'+deffs+'</center></td><td><center>'+Tsal_Number(odd)+'</center></td><td><center>';
  479. var troops_count=Tsal_Number(count.spear)+'</center></td><td><center>'+Tsal_Number(count.sword)+'</center></td><td><center>'+Tsal_Number(count.archer)+'</center></td><td><center>'+Tsal_Number(count.spy)+'</center></td><td><center>';
  480. troops_count+=Tsal_Number(count.marcher)+'</center></td><td><center>'+Tsal_Number(count.heavy)+'</center></td><td><center>'+Tsal_Number(count.catapult)+'</center></td><td><center>'+Tsal_Number(count.knight)+'</center></td></<tr>';
  481. var troops_count1=Tsal_Number(count.spear)+'</center></td><td><center>'+Tsal_Number(count.sword)+'</center></td><td><center>'+Tsal_Number(count.spy)+'</center></td><td><center>';
  482. troops_count1+=Tsal_Number(count.heavy)+'</center></td><td><center>'+Tsal_Number(count.catapult)+'</center></td><td><center>'+Tsal_Number(count.knight)+'</center></td></<tr>';
  483. output+=(world ? troops_count:troops_count1);
  484. sum += Math.round(Number(deffs)*10)/10;
  485. //var output1+=tsalkapone_trans.general.support_units+'<br>[spoiler=Info]<br>[unit]spear[/unit]:'+Tsal_Number(count_spear)+'<br>[unit]sword[/unit]:'+Tsal_Number(count_sword)+'<br>[unit]archer[/unit]:
  486. });
  487. if ($('#ADS_Display').size()==0){
  488. var tsal_output="<div id='ADS_Display' style='border-radius: 8px; border: 2px #804000 solid; background-color: #F4E4BC'>";
  489. tsal_output+="<div id='inline_popup_menu' style='cursor: move; text-align:center;'><font color='darkgreen'>"+ game_data.player.name +" ("+ $('#serverDate').text() +")</font></div>";
  490. tsal_output+="<center><img style='width:237px;height:227px; position:relative' src='https://i.imgur.com/3pVFzW6.png'></center>\n";
  491. tsal_output+='<table class="vis" width="100%"><thead><tr><th><center><font color="darkgreen">'+tsalkapone_trans.general.player_name+'</font></center></th><th><center><font color="darkgreen">'+tsalkapone_trans.general.pop_count+'</font></center></th><th><center><font color="darkgreen">'+tsalkapone_trans.general.oda_count+'</font></center></th>'+units_img+'</tr></thead><tbody>';
  492. tsal_output+=output+'</tbody></table>';
  493. tsal_output+="<div style='padding: 15px 10px 5px 10px;'><table id='ADS_Display_Main' style='vertical-align:middle;'></table><hr><center><a onclick='$(\"#ADS_Display\").slideUp(2000);' style='cursor: pointer;' class='btn'>"+tsalkapone_trans.buttons.close_table+"</a></center></div></div>";
  494. $('#paged_view_content').prepend(tsal_output);
  495. } else {
  496. $("#ADS_Display").show();
  497. }
  498. }; ADS_Unterstuetzung_zaehlen(doc);
  499. }
  500. Tsalkapone_Count_Support();
  501.  
  502. }
  503. else {
  504.  
  505. function fnExecuteScript(){
  506. try{
  507. var strVersion="v3.9";
  508.  
  509. var unitDesc = {
  510. "spear":""+tsalkapone_trans.general.spear+"",
  511. "sword":""+tsalkapone_trans.general.sword+"",
  512. "axe":""+tsalkapone_trans.general.axe+"",
  513. "archer":""+tsalkapone_trans.general.archer+"",
  514. "spy":""+tsalkapone_trans.general.spy+"",
  515. "light":""+tsalkapone_trans.general.light+"",
  516. "marcher":""+tsalkapone_trans.general.marcher+"",
  517. "heavy":""+tsalkapone_trans.general.heavy+"",
  518. "ram":""+tsalkapone_trans.general.ram+"",
  519. "catapult":""+tsalkapone_trans.general.cats+"",
  520. "knight":""+tsalkapone_trans.general.knight+"",
  521. "snob":""+tsalkapone_trans.general.snob+"",
  522. "militia":""+tsalkapone_trans.general.militia+"",
  523. "offense":""+tsalkapone_trans.general.offensive+"",
  524. "defense":""+tsalkapone_trans.general.defensive+""
  525. };
  526. var imageDesc = {
  527. "spear":"<img src='graphic/unit/unit_spear.png'>",
  528. "sword":"<img src='graphic/unit/unit_sword.png'>",
  529. "axe":"<img src='graphic/unit/unit_axe.png'>",
  530. "archer":"<img src='graphic/unit/unit_archer.png'>",
  531. "spy":"<img src='graphic/unit/unit_spy.png'>",
  532. "light":"<img src='graphic/unit/unit_light.png'>",
  533. "marcher":"'<img src='graphic/unit/unit_marcher.png'>",
  534. "heavy":"<img src='graphic/unit/unit_heavy.png'>",
  535. "ram":"<img src='graphic/unit/unit_ram.png'>",
  536. "catapult":"<img src='graphic/unit/unit_catapult.png'>",
  537. "knight":"<img src='graphic/unit/unit_knight.png'>",
  538. "snob":"<img src='graphic/unit/unit_snob.png'>",
  539. "militia":"<img src='graphic/unit/unit_milita.png'>",
  540. "offense":"<img style='top:+5px; width:35px;height:30px; position: relative;' src='https://media.innogamescdn.com/com_DS_GR/Scripts/images/Tsalkapone_master_tool_images/Tsalkapone_off.png'>",
  541. "defense":"<img style='top:+5px; width:35px;height:30px; position: relative;' src='https://media.innogamescdn.com/com_DS_GR/Scripts/images/Tsalkapone_master_tool_images/Tsalkapone_gendef.png'>"
  542. };
  543. var tsaloutput='<font color="red"><b><u>'+tsalkapone_trans.general.twconfig+'</u></b></font><br><br>';
  544. tsaloutput+= '<span id="tsalkapone_rev_show"><input type="button" class="btn" id="tsalkapone_reveal" value="'+tsalkapone_trans.buttons.set_show+'"></span>';
  545. tsaloutput+='<span style="display:none" id="tsalkapone_rev_hide"><input type="button" class="btn" id="tsalkapone_hide" value="'+tsalkapone_trans.buttons.set_hide+'"></span>';
  546. tsaloutput+="<hr><div id='tsalkapone_twconfig1' style='display:none;'></div>";
  547. $("#ds_body").append(tsaloutput);
  548. function fnDebugLog(msg){
  549. $('#tsalkapone_twconfig1').append('<span>'+msg+'</span><br/>');
  550. }
  551.  
  552.  
  553. $("#tsalkapone_reveal").click(function(){
  554. document.getElementById('tsalkapone_rev_hide').style.display="";
  555. document.getElementById('tsalkapone_rev_show').style.display="none";
  556. document.getElementById('tsalkapone_twconfig1').style.display="";
  557. });
  558. $("#tsalkapone_hide").click(function(){
  559. document.getElementById('tsalkapone_rev_hide').style.display="none";
  560. document.getElementById('tsalkapone_rev_show').style.display="";
  561. document.getElementById('tsalkapone_twconfig1').style.display="none";
  562. });
  563.  
  564.  
  565. /* sendMethod = "GET" || "POST", params = json, type = xml,json,text */
  566. function fnAjaxRequest(url,sendMethod,params,type){
  567. var error=null,payload=null;
  568.  
  569. win.$.ajax({
  570. "async":false,
  571. "url":url,
  572. "data":params,
  573. "dataType":type,
  574. "type":String(sendMethod||"GET").toUpperCase(),
  575. "error":function(req,status,err){error="ajax: " + status;},
  576. "success":function(data,status,req){payload=data;}
  577. });
  578.  
  579. if(error){
  580. throw(error);
  581. }
  582.  
  583. return payload;
  584. }
  585.  
  586. function fnCreateConfig(name){return win.$(fnAjaxRequest("/interface.php","GET",{"func":name},"xml")).find("config");}
  587. function fnCreateWorldConfig(){return fnCreateConfig("get_config");}
  588. function fnCreateBuildingConfig(){return fnCreateConfig("get_building_info");}
  589. function fnCreateUnitConfig(){return fnCreateConfig("get_unit_info");}
  590.  
  591. function fnHasArchers(){return (parseInt(win.game_data.worldConfig.find("game archer").text()||"0",10)>0);}
  592. function fnHasChurch(){return (parseInt(win.game_data.worldConfig.find("game church").text()||"0",10)>0);}
  593. function fnHasNotebook(){return (win.$('[src*="note.png"],[class*="note-icon"]').length>0);}
  594. function fnHasPaladin(){return (parseInt(win.game_data.worldConfig.find("game knight").text()||"0",10)>0);}
  595. function fnHasMilitia(){return (win.game_data.unitConfig.find("militia").length>0);}
  596.  
  597. function fnTranslate(id){
  598. var tsald =""; var tsald2='';
  599. if(fnHasArchers()){tsald=tsalkapone_trans.general.temp36; tsald2=tsalkapone_trans.general.temp23;}
  600. else {tsald=tsalkapone_trans.general.temp37; tsald2=tsalkapone_trans.general.temp38;}
  601. var translation={
  602. "en":[
  603.  
  604. ""+tsalkapone_trans.general.temp1+"",
  605. ""+tsalkapone_trans.general.temp2+"",
  606. ""+tsalkapone_trans.general.temp3+"",
  607. ""+tsalkapone_trans.general.temp4+"",
  608. ""+tsalkapone_trans.general.temp35+"",
  609. ""+tsalkapone_trans.general.temp5+"",
  610. ""+tsalkapone_trans.general.temp6+"",
  611. ""+tsalkapone_trans.general.temp7+"",
  612. ""+tsalkapone_trans.general.temp8+"",
  613. ""+tsalkapone_trans.general.temp9+"",
  614. ""+tsalkapone_trans.general.temp10+"",
  615. ""+tsalkapone_trans.general.temp11+"",
  616. ""+tsalkapone_trans.general.temp12+"",
  617. ""+tsalkapone_trans.general.temp13+"",
  618. ""+tsalkapone_trans.general.temp14+"",
  619. ""+tsalkapone_trans.general.temp15+"",
  620. ""+tsalkapone_trans.general.temp16+"",
  621. ""+tsalkapone_trans.general.temp17+"",
  622. ""+tsalkapone_trans.general.temp18+"",
  623. ""+tsalkapone_trans.general.temp19+"",
  624. ""+tsalkapone_trans.general.temp20+"",
  625. ""+tsalkapone_trans.general.temp21+"",
  626. ""+tsalkapone_trans.general.temp22+"",
  627. ""+tsalkapone_trans.general.temp27+" "+tsald2+"",
  628. ""+tsalkapone_trans.general.temp24+"",
  629. ""+tsalkapone_trans.general.temp25+"",
  630. ""+tsalkapone_trans.general.temp26+"",
  631. ""+tsalkapone_trans.general.temp27+" "+tsald+"",
  632. ""+tsalkapone_trans.general.temp28+"",
  633. ""+tsalkapone_trans.general.temp29+"",
  634. ""+tsalkapone_trans.general.temp30+"",
  635. ""+tsalkapone_trans.general.temp31+"",
  636. ""+tsalkapone_trans.general.temp32+"",
  637. ""+tsalkapone_trans.general.temp33+"",
  638. ""+tsalkapone_trans.general.temp34+"",
  639. ""+tsalkapone_trans.general.temp39+"",
  640. ""+tsalkapone_trans.general.temp40+"",
  641. ""+tsalkapone_trans.general.temp41+"",
  642. ""+tsalkapone_trans.general.temp42+"",
  643. ""+tsalkapone_trans.general.temp43+"",
  644. "<font color='darkgreen'>"+tsalkapone_trans.general.script+"</font>",
  645. "<font color='black'>"+tsalkapone_trans.general.group1+"</font>",
  646. "<font color='black'>"+tsalkapone_trans.general.group2+"</font>",
  647. "<font color='black'>"+tsalkapone_trans.general.group3+"</font>",
  648. "<font color='black'>"+tsalkapone_trans.general.group4+"</font>",
  649. "<font color='black'>"+tsalkapone_trans.general.group5+"</font>",
  650. "<font color='black'>"+tsalkapone_trans.general.group6+"</font>",
  651. "<font color='black'>"+tsalkapone_trans.general.group7+"</font>",
  652. "<font color='black'>"+tsalkapone_trans.general.group8+"</font>",
  653. "<font color='black'>"+tsalkapone_trans.general.group9+"</font>",
  654. "<font color='black'>"+tsalkapone_trans.general.group10+"</font>",
  655. "<font color='black'>"+tsalkapone_trans.general.group11+"</font>",
  656. "<font color='black'>"+tsalkapone_trans.general.group12+"</font>",
  657. "<font color='black'>"+tsalkapone_trans.general.group13+"</font>",
  658. "<font color='black'>"+tsalkapone_trans.general.group14+"</font>",
  659. "<font color='black'>"+tsalkapone_trans.general.group15+":</font>"
  660. ]
  661. };
  662.  
  663. /* Default to English "en". */
  664. var lang=typeof(translation[win.game_data.market]=="undefined")?"en":win.game_data.market;
  665. if(typeof(translation[lang][id])=="undefined"){
  666. return "";
  667. }
  668.  
  669. return translation[lang][id];
  670. }
  671.  
  672.  
  673.  
  674. function fnGetTroopCount(){
  675. /* returns an array of: {"x":"xxx","y":"yyy","coords":"xxx|yyy","troops":[0,0,0,0,0,0,0,0,0,0,0,0,0]} */
  676.  
  677. /* Number of Columns - VillageColumn - ActionColumn */
  678. var gameVersion = parseFloat(win.game_data.version.match(/[\d|\.]+/g)[1]);
  679. var colCount = win.$('#units_table '+((gameVersion>=7.1)?'thead':'tbody:eq(0)')+' th').length - 2;
  680. var villageTroopInfo=[];
  681.  
  682. win.$('#units_table tbody'+((gameVersion<7.1)?':gt(0)':'')).each(function(row,eleRow){
  683. /* Reset for next Village */
  684. var villageData={"troops":[0,0,0,0,0,0,0,0,0,0,0,0,0]};
  685.  
  686. /* Village */
  687. coords=win.$(eleRow).find("td:eq(0)").text().match(/\d+\|\d+/g);
  688. coords=(coords?coords[coords.length-1].match(/(\d+)\|(\d+)/):null);
  689. villageData.x = parseInt(coords[1],10);
  690. villageData.y = parseInt(coords[2],10);
  691. villageData.coords = coords[0];
  692.  
  693. /* Skip the Village Cell */
  694. win.$(eleRow).find("td:gt(0):not(:has(>a))").each(function(cell,eleCell){
  695. /* Skip the RowType Cell */
  696. if(cell%colCount){
  697. /* Ignore In the village (your own + foreign) */
  698. if(Math.floor(cell/colCount) != 1){
  699. villageData.troops[cell%colCount-1] += parseInt(win.$(eleCell).text()||"0",10);
  700. }
  701. }
  702. });
  703.  
  704. /* Cache the Data */
  705. villageTroopInfo.push(villageData);
  706. });
  707.  
  708. return villageTroopInfo;
  709. }
  710.  
  711. function fnLogVersionInfo(){
  712. fnDebugLog("=========================");
  713. fnDebugLog("STRIKE - "+tsalkapone_trans.general.script+" : " + strVersion);
  714. fnDebugLog("=========================");
  715. fnDebugLog("Conta Premium: "+(win.game_data.isPremium?"Ativo":"Inativo"));
  716. fnDebugLog("Igreja : "+(fnHasChurch()?"Ativo":"Inativo"));
  717. fnDebugLog("Paladino : "+(fnHasPaladin()?"Ativo":"Inativo"));
  718. fnDebugLog("Arqueiros : "+(fnHasArchers()?"Ativo":"Inativo"));
  719. fnDebugLog("Milícia: "+(fnHasMilitia()?"Ativo":"Inativo"));
  720. fnDebugLog("MDF : "+(win.location.href.match(/t\=\d+/i)?"Ativo":"Inativo"));
  721. fnDebugLog("=========================");
  722. fnDebugLog("Versão: "+win.game_data.version);
  723. fnDebugLog("Mundo : "+win.game_data.world);
  724. fnDebugLog("Página Atual : "+win.game_data.screen);
  725. fnDebugLog("Modo : "+win.game_data.mode);
  726. fnDebugLog("URL : "+win.location.href);
  727. fnDebugLog("Navegador: "+navigator.userAgent);
  728. fnDebugLog("=========================");
  729. }
  730.  
  731. function fnCriteriaToStr(criteria){
  732. var valueStr = "";
  733.  
  734. if(criteria && (criteria.length > 0)){
  735. var valueStr1="<u><b><font color='maroon'>"+tsalkapone_trans.general.unit_info+":</b></font></u><br><br>";
  736. for(var ii=0; ii < criteria.length; ii++){
  737.  
  738. if(typeof(criteria[ii].minpop) != "undefined"){
  739. valueStr += (valueStr?" "+tsalkapone_trans.general.sun+" ":"") + ""+ imageDesc[criteria[ii].unit] + " >= " + criteria[ii].minpop + "";
  740. }
  741. if(typeof(criteria[ii].maxpop) != "undefined"){
  742. valueStr += (valueStr?" "+tsalkapone_trans.general.sun+" ":"") + "" + imageDesc[criteria[ii].unit] + " < " + criteria[ii].maxpop + "";
  743. }
  744. }
  745. }
  746.  
  747. return valueStr1+valueStr;
  748. }
  749.  
  750. function fnCalculateTroopCount(){
  751. var maxGroups=40;
  752. var tsal_debug="";
  753. var tsal_debug1='';
  754. var tsal_debug2='';
  755. if(fnHasArchers()){
  756. tsal_debug="archer";
  757. tsal_debug1=1000;
  758. tsal_debug2="sword";
  759. } else {tsal_debug="catapult"; tsal_debug1=3200; tsal_debug2="spear";}
  760. var outputSummary = {
  761. "Τουλάχιστον 5 αρίστους":{
  762. "group":"Nobles",
  763. "criteria":[{"unit":"snob","minpop":500}],
  764. "descID":0
  765. },
  766. "Ολοκληρωμένες εκκαθαριστικές με τουλάχιστον 4 αρίστους":{
  767. "group":"Nobles",
  768. "criteria":[{"unit":"snob","minpop":400},{"unit":"offense","minpop":19600}],
  769. "descID":1
  770. },
  771. "Ολοκληρωμένα αμυντικά με τουλάχιστον 4 αρίστους":{
  772. "group":"Nobles",
  773. "criteria":[{"unit":"snob","minpop":400},{"unit":"defense","minpop":19600}],
  774. "descID":2
  775. },
  776. "Ολοκληρωμένα χωριά με λιγότερους από 4 αρίστους":{
  777. "group":"Nobles",
  778. "criteria":[{"unit":"snob","maxpop":400},{"unit":"defense","minpop":19600},{"unit":"offense","minpop":19600}],
  779. "descID":3
  780. },
  781. "Άλλα χωριά με αρίστους":{
  782. "group":"Nobles",
  783. "criteria":[{"unit":"snob","minpop":100},{"unit":"defense","maxpop":19600},{"unit":"offense","maxpop":19600}],
  784. "descID":4
  785. },
  786. "Ολοκληρωμένες εκκαθαριστικές":{
  787. "group":"Επιθετικά",
  788. "criteria":[{"unit":"snob","maxpop":100},{"unit":"offense","minpop":20000}],
  789. "descID":5
  790. },
  791. "3/4 Εκκαθαριστικής":{
  792. "group":"Επιθετικά",
  793. "criteria":[{"unit":"offense","minpop":15000,"maxpop":20000}],
  794. "descID":6
  795. },
  796. "1/2 Εκκαθαριστικής":{
  797. "group":"Επιθετικά",
  798. "criteria":[{"unit":"offense","minpop":10000,"maxpop":15000}],
  799. "descID":7
  800. },
  801. "1/4 Εκκαθαριστικής":{
  802. "group":"Επιθετικά",
  803. "criteria":[{"unit":"offense","minpop":5000,"maxpop":10000}],
  804. "descID":8
  805. },
  806. "Επιθετικά με τουλάχιστον 100 καταπέλτες":{
  807. "group":"Κατάρριψη",
  808. "criteria":[{"unit":"catapult","minpop":800},{"unit":"offense","minpop":20000}],
  809. "descID":9
  810. },
  811. "Επιθετικά με περισσότερους από 800 κριούς":{
  812. "group":"Κατάρριψη",
  813. "criteria":[{"unit":"ram","minpop":4000},{"unit":"offense","minpop":20000}],
  814. "descID":10
  815. },
  816. "Επιθετικά με 500-800 κριούς":{
  817. "group":"Κατάρριψη",
  818. "criteria":[{"unit":"ram","minpop":2500,"maxpop":4000},{"unit":"offense","minpop":20000}],
  819. "descID":11
  820. },
  821. "Επιθετικά με 250-499 κριούς":{
  822. "group":"Κατάρριψη",
  823. "criteria":[{"unit":"ram","minpop":1250,"maxpop":2495},{"unit":"offense","minpop":20000}],
  824. "descID":12
  825. },
  826. "Επιθετικά με 100-249 κριούς":{
  827. "group":"Κατάρριψη",
  828. "criteria":[{"unit":"ram","minpop":500,"maxpop":1245},{"unit":"offense","minpop":20000}],
  829. "descID":13
  830. },
  831.  
  832. "Ολοκληρωμένα αμυντικά":{
  833. "group":"Αμυντικά",
  834. "criteria":[{"unit":"defense","minpop":20000}],
  835. "descID":14
  836. },
  837. "3/4 Αμυντικά":{
  838. "group":"Αμυντικά",
  839. "criteria":[{"unit":"defense","minpop":15000,"maxpop":20000}],
  840. "descID":15
  841. },
  842. "1/2 Αμυντικά":{
  843. "group":"Αμυντικά",
  844. "criteria":[{"unit":"defense","minpop":10000,"maxpop":15000}],
  845. "descID":16
  846. },
  847. "1/4 Αμυντικά":{
  848. "group":"Αμυντικά",
  849. "criteria":[{"unit":"defense","minpop":5000,"maxpop":10000}],
  850. "descID":17
  851. },
  852. "Ολοκληρωμένα Καταπελτάδικα":{
  853. "group":"Καταπελτάδικα",
  854. "criteria":[{"unit":"catapult","minpop":20000}],
  855. "descID":18
  856. },
  857. "3/4 Καταπελτάδικα":{
  858. "group":"Καταπελτάδικα",
  859. "criteria":[{"unit":"catapult","minpop":15000,"maxpop":20000}],
  860. "descID":19
  861. },
  862. "1/2 Καταπελτάδικα":{
  863. "group":"Καταπελτάδικα",
  864. "criteria":[{"unit":"catapult","minpop":8000,"maxpop":15000}],
  865. "descID":20
  866. },
  867. "Χωριά με 500-1000 καταπέλτες":{
  868. "group":"Καταπελτάδικα",
  869. "criteria":[{"unit":"catapult","minpop":4000, "maxpop":8000}],
  870. "descID":21
  871. },
  872. "Αμυντικά με 1000 βαρύ ιππικό":{
  873. "group":"πακέτα",
  874. "criteria":[{"unit":"heavy","minpop":6000}],
  875. "descID":22
  876. },
  877. "Αμυντικά με 1000 τοξότες":{
  878. "group":"πακέτα",
  879. "criteria":[{"unit":""+tsal_debug+"","minpop":tsal_debug1}],
  880. "descID":23
  881. },
  882. "Αμυντικά με 1000 δορατοφόρους":{
  883. "group":"πακέτα",
  884. "criteria":[{"unit":"spear","minpop":1000}],
  885. "descID":24
  886. },
  887. "Αμυντικά με 1000 ξιφομάχους":{
  888. "group":"πακέτα",
  889. "criteria":[{"unit":"sword","minpop":6000}],
  890. "descID":25
  891. },
  892. "Αμυντικά με 1000 ξιφομάχους-δορατοφόρους":{
  893. "group":"πακέτα",
  894. "criteria":[{"unit":"sword","minpop":1000},{"unit":"spear","minpop":1000}],
  895. "descID":26
  896. },
  897. "Αμυντικά με 1000 ξιφομάχους-τοξότες":{
  898. "group":"πακέτα",
  899. "criteria":[{"unit":""+tsal_debug2+"","minpop":1000},{"unit":""+tsal_debug+"","minpop":tsal_debug1}],
  900. "descID":27
  901. },
  902. "Αμυντικά με 1000 βαρύ ιππικό-δορατοφόρους":{
  903. "group":"πακέτα",
  904. "criteria":[{"unit":"heavy","minpop":1000},{"unit":"spear","minpop":1000}],
  905. "descID":28
  906. },
  907. "Ολοκληρωμένα ανιχνευτάδικα":{
  908. "group":"Ανιχνευτές",
  909. "criteria":[{"unit":"spy","minpop":20000}],
  910. "descID":29
  911. },
  912. "3/4 Ανιχνευτάδικα":{
  913. "group":"Ανιχνευτές",
  914. "criteria":[{"unit":"spy","minpop":15000,"maxpop":20000}],
  915. "descID":30
  916. },
  917. "1/2 Ανιχνευτάδικα":{
  918. "group":"Ανιχνευτές",
  919. "criteria":[{"unit":"spy","minpop":10000,"maxpop":15000}],
  920. "descID":31
  921. },
  922. "1/4 Ανιχνευτάδικα":{
  923. "group":"Ανιχνευτές",
  924. "criteria":[{"unit":"spy","minpop":5000,"maxpop":10000}],
  925. "descID":32
  926. },
  927. "Χωριά με 500-2500 ανιχνευτές":{
  928. "group":"Ανιχνευτές",
  929. "criteria":[{"unit":"spy","minpop":1000,"maxpop":5000}],
  930. "descID":33
  931. },
  932. "Άλλα No1":{
  933. "group":"Other",
  934. "criteria":[{"unit":"spy","maxpop":1000},{"unit":"defense","maxpop":5000},{"unit":"offense","maxpop":5000},],
  935. "descID":34
  936. },
  937. "Άλλα No4":{
  938. "group":"Other",
  939. "criteria":[{"unit":"spy","minpop":1000},{"unit":"defense","minpop":5000},{"unit":"offense","minpop":5000}],
  940. "descID":35
  941. },
  942. "Άλλα No2":{
  943. "group":"Other",
  944. "criteria":[{"unit":"heavy","minpop":2500},{"unit":"offense","minpop":15000}],
  945. "descID":36
  946. },
  947. "Άλλα No3":{
  948. "group":"Other",
  949. "criteria":[{"unit":"defense","minpop":15000},{"unit":"ram","maxpop":120}],
  950. "descID":37
  951. },
  952. "Άλλα No5":{
  953. "group":"Other",
  954. "criteria":[{"unit":"defense","minpop":10000},{"unit":"light","minpop":400}],
  955. "descID":38
  956. },
  957. "Άλλα No6":{
  958. "group":"Other",
  959. "criteria":[{"unit":"defense","maxpop":5000},{"unit":"offense","minpop":10000}],
  960. "descID":39
  961. }
  962. };
  963.  
  964. var ii,jj,village,total,index,count,unit,item,key,criteria,condition,isValid;
  965. var defense = ["spear","sword","heavy","catapult"];
  966. var offense = ["axe","light","ram","catapult"];
  967.  
  968. if(fnHasMilitia()){
  969. defense.push("militia");
  970. }
  971.  
  972. if(fnHasArchers()){
  973. defense.push("archer");
  974. offense.push("marcher");
  975. }
  976. /*
  977. if(fnHasPaladin()){
  978. offense.push("knight");
  979. }
  980. */
  981.  
  982. /* Initialize */
  983. var summary = {
  984. unitTotal:{"tally":0,"population":0},
  985. defense:{"tally":0,"count":0,"population":0,"coords":[]},
  986. offense:{"tally":0,"count":0,"population":0,"coords":[]}
  987. };
  988.  
  989. win.$(win.game_data.unitConfig).children().each(function(i,e){
  990. summary[e.nodeName]={"tally":0,"count":0,"population":0,"coords":[]};
  991. });
  992.  
  993. for(item in outputSummary){
  994. if(outputSummary.hasOwnProperty(item)){
  995. summary[item]={"tally":0,"count":0,"population":0,"coords":[]};
  996. }
  997. }
  998.  
  999. var villageTroops = fnGetTroopCount();
  1000. for(ii=0;ii<villageTroops.length;ii++){
  1001. village = villageTroops[ii];
  1002. total = {
  1003. defense:{"tally":0,"count":0,"population":0,"coords":[]},
  1004. offense:{"tally":0,"count":0,"population":0,"coords":[]}
  1005. };
  1006.  
  1007. win.$(win.game_data.unitConfig).children().each(function(i,e){
  1008. total[e.nodeName]={"tally":0,"count":0,"population":0,"coords":[]};
  1009. });
  1010.  
  1011. /* Calculate total count & population for each unit type */
  1012. index=0;
  1013. win.$(win.game_data.unitConfig).children().each(function(i,e){
  1014. var unit=e.nodeName;
  1015. total[unit].count += village.troops[index];
  1016. total[unit].population += village.troops[index]*parseInt(win.$(e).find("pop").text(),10);
  1017.  
  1018. /* Defense */
  1019. if (new RegExp('^(' + defense.join('|') + ')$').test(unit)){
  1020. total.defense.count += total[unit].count;
  1021. total.defense.population += total[unit].population;
  1022. }
  1023.  
  1024. /* Offense */
  1025. if (new RegExp('^(' + offense.join('|') + ')$').test(unit)){
  1026. total.offense.count += total[unit].count;
  1027. total.offense.population += total[unit].population;
  1028. }
  1029.  
  1030. /* Units */
  1031. summary[unit].count += total[unit].count;
  1032. summary[unit].population += total[unit].population;
  1033.  
  1034. /* All Units */
  1035. summary.unitTotal.tally += total[unit].count;
  1036. summary.unitTotal.population += total[unit].population;
  1037.  
  1038. index++;
  1039. });
  1040.  
  1041. summary.defense.count += total.defense.count;
  1042. summary.defense.population += total.defense.population;
  1043.  
  1044. summary.offense.count += total.offense.count;
  1045. summary.offense.population += total.offense.population;
  1046.  
  1047. /* Calculate other summaries */
  1048. for(item in outputSummary){
  1049. if(outputSummary.hasOwnProperty(item)){
  1050. isValid=true;
  1051.  
  1052. for(jj=0;jj<outputSummary[item].criteria.length;jj++){
  1053. criteria=outputSummary[item].criteria[jj];
  1054.  
  1055. if(!((typeof(criteria.minpop)=="undefined")||!criteria.minpop||(total[criteria.unit].population>=criteria.minpop))){
  1056. isValid=false;
  1057. }
  1058.  
  1059. if(!((typeof(criteria.maxpop)=="undefined")||!criteria.maxpop||(total[criteria.unit].population<criteria.maxpop))){
  1060. isValid=false;
  1061. }
  1062. }
  1063.  
  1064. if(isValid){
  1065. summary[item].coords.push(village.coords);
  1066. summary[item].tally++;
  1067. }
  1068. }
  1069. }
  1070. }
  1071.  
  1072. var groupSummary={};
  1073. for(item in outputSummary){
  1074. if(outputSummary.hasOwnProperty(item)){
  1075. if(typeof(groupSummary[outputSummary[item].group])=="undefined"){
  1076. groupSummary[outputSummary[item].group]=[];
  1077. }
  1078.  
  1079. groupSummary[outputSummary[item].group].push(item);
  1080. }
  1081. }
  1082.  
  1083. var curGroup=maxGroups;
  1084. var lang_img='';
  1085. if (lang=="greek") {lang_img ='<img title="Ελληνικά" style="cursor:help;" height="20px" width="30px" src="https://dl.dropboxusercontent.com/s/ivyojb6w9cb9pem/flag_greece.gif">';}
  1086. else if (lang=="english") {lang_img ='<img height="20px" style="cursor:help;" title="English/American" width="30px" src="https://dl.dropboxusercontent.com/s/y6tn9ko0g8k2xfx/flagenglezicon.gif">';}
  1087. else if (lang=="brazilian") {lang_img ='<img height="20px" style="cursor:help;" title="Português/Brasileiro" width="30px" src="https://i.imgur.com/39iH30N.gif">';}
  1088. var tsalkaponecell = "";
  1089. tsalkaponecell+='<div id="tsal_counter" class="target-select clearfix vis float_left"><h4><font color=darkgreen><center> '+tsalkapone_trans.general.button_list+' de Idioma</center></font></h4><table class="vis" style="width: 100%"><tbody>';
  1090. tsalkaponecell+='<tr><td><font color="maroon"><b>'+tsalkapone_trans.general.lang_sel+'</b></font></td>';
  1091. tsalkaponecell+='<td><font style="font-family: \'Arial Black\', Gadget, sans-serif;"><span id="openfilter1"><input type="button" value="'+tsalkapone_trans.buttons.lang_open+'" id="openfilterbut1" class="btn"></span><span id="closefilter1" style="display:none">';
  1092. tsalkaponecell+='<input class="btn" type="button" value="'+tsalkapone_trans.buttons.lang_close+'" id="closefilterbut1"></span></td></tr>';
  1093. tsalkaponecell+='<tr><td><font color="maroon"><b>'+tsalkapone_trans.general.selected_one+'</b></font></td>';
  1094. tsalkaponecell+='<td><span id="selectedone"><center>'+lang_img+'</center></span><span id="columnfilter1" style="display:none" class="vis"><font size="2">';
  1095. tsalkaponecell+='<br><br><center><font color="blue"><b><u>'+tsalkapone_trans.general.available+'</u></b></font></center>';
  1096. tsalkaponecell+='<input type="radio" name="language" value="greek" id="greek_lang" ><img title="Greek \n\nBy Tsalkapone" style="cursor:help;" height="20px" width="30px" src="https://dl.dropboxusercontent.com/s/ivyojb6w9cb9pem/flag_greece.gif"><br>';
  1097. tsalkaponecell+='<input type="radio" name="language" value="english" id="english_lang" checked><img height="20px" style="cursor:help;" title="English/American \n\nBy Tsalkapone" width="30px" src="https://dl.dropboxusercontent.com/s/y6tn9ko0g8k2xfx/flagenglezicon.gif"><br>';
  1098. tsalkaponecell+='<input type="radio" name="language" value="brazilian" id="brazilian_lang" checked><img height="20px" style="cursor:help;" title="Português/Brasileiro \n\nBy TiKa" width="30px" src="https://i.imgur.com/39iH30N.gif"><br>';
  1099. tsalkaponecell+='</span></td></tr>';
  1100. tsalkaponecell+='</tbody></table></div>';
  1101. if (! document.getElementById('tsal_counter')){
  1102. $('#content_value').prepend(tsalkaponecell);
  1103. }
  1104.  
  1105. if (get_lang == "greek") {document.getElementById('greek_lang').checked = true;}
  1106. else if (get_lang == "english") {document.getElementById('english_lang').checked = true; }
  1107. else if (get_lang == "brazilian") {document.getElementById('brazilian_lang').checked = true; }
  1108. $("#english_lang").click(function(){
  1109. localStorage.setItem("troops_counter_lang","english");
  1110. location.reload();
  1111. });
  1112.  
  1113. $("#brazilian_lang").click(function(){
  1114. localStorage.setItem("troops_counter_lang","brazilian");
  1115. location.reload();
  1116. });
  1117.  
  1118. $("#greek_lang").click(function(){
  1119. localStorage.setItem("troops_counter_lang","greek");
  1120. location.reload();
  1121. });
  1122.  
  1123. $("#openfilterbut1").click(function(){
  1124. document.getElementById('columnfilter1').style.display="";
  1125. document.getElementById('openfilter1').style.display="none";
  1126. document.getElementById('closefilter1').style.display="";
  1127. });
  1128. $("#closefilterbut1").click(function(){
  1129. document.getElementById('columnfilter1').style.display="none";
  1130. document.getElementById('openfilter1').style.display="";
  1131. document.getElementById('closefilter1').style.display="none";
  1132. });
  1133.  
  1134.  
  1135. var docSource = "";
  1136. var kosmos=game_data.world;
  1137. docSource += "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n";
  1138. docSource += "<html>\n";
  1139. docSource += "<style>";
  1140. docSource += "body {";
  1141. docSource += "background-color: #F2D7A0; background-image: url(\"null\");";
  1142. docSource += "}";
  1143. docSource += "<\/style>";
  1144. docSource += "<head>\n";
  1145. docSource +="<link rel=\"shortcut icon\" href=\"https://i.imgur.com/RrAg5YW.gif\">";
  1146. docSource += "<title>## STRIKE TEAM ## "+tsalkapone_trans.general.script+"</title>\n";
  1147. docSource += "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"/>\n";
  1148.  
  1149. /*
  1150. docSource += "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://dsgr.innogamescdn.com/assets/gr34/385a0cdb501ac5cb3f661c458a0294cb/css/game/overview_base.css\"/>\n";
  1151. */docSource += '<link rel="stylesheet" type="text/css" href="https://dl.dropboxusercontent.com/s/auhazqvi7p92go5/Tsalkapone.Count_and_Troops.css" />';
  1152. docSource += "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://dsen.innogamescdn.com/assets/"+kosmos+"/95c3ab748f3d3f5fbdbab6c8189ba568/merged/game.css\"/>\n";
  1153.  
  1154. docSource += "<script type=\"text/javascript\">\n";
  1155. docSource += "<!--\n";
  1156. docSource += "function fnShowCoords(id,description){\n";
  1157. docSource += "var coords={};\n";
  1158. for(item in outputSummary){
  1159. if(outputSummary.hasOwnProperty(item)){
  1160. if(summary[item].coords.length){
  1161. docSource += "coords[\"" + item + "\"] = \"" + summary[item].coords.join(" ") + "\";\n";
  1162. }
  1163. }
  1164. }
  1165. docSource += "document.getElementById(\"coords_group\").innerHTML = description;\n";
  1166. docSource += "\n";
  1167. docSource += "var eleCoords = document.getElementById(\"coords_container\");\n";
  1168. docSource += "eleCoords.value = coords[id]?coords[id]:\"\";\n";
  1169. docSource += "eleCoords.focus();\n";
  1170. docSource += "eleCoords.select();\n";
  1171. docSource += "}\n";
  1172. docSource += "-->\n";
  1173. docSource += "</script>\n";
  1174. docSource += "</head>\n";
  1175. docSource += "\n";
  1176. docSource += "<body>\n";
  1177. docSource += "<table align=\"center\" width='50%'><tr><td>\n";
  1178. docSource += "<table class=\"content-border\" width='100%'><tr><td>\n";
  1179. docSource += "<table class=\"main\" width=\"100%\" align=\"center\">\n";
  1180. docSource += "<tr>\n";
  1181. docSource += "<td id=\"content_value\">\n";
  1182. docSource += "<center><img style='width:237px;height:227px; position:relative' src='https://i.imgur.com/51P7F3K.png'></center>\n";
  1183. docSource += "<u><center><h1>" + fnTranslate(curGroup++) + "<sup><span style=\"font-size:small;\"><font color='black'>" + strVersion + "</font></span></sup><span><sub><br><span style=\"font-weight:70;font-style:italic;text-decoration:none;font-size:x-medium;\">"+tsalkapone_trans.general.edited+" TiKa</span></sub></h1></center></u>\n";
  1184. docSource += "<hr>\n";
  1185.  
  1186. docSource += "<center><table>\n";
  1187. docSource += "<tr><td width=\"450\" valign=\"top\"><table class=\"vis\" width=\"100%\"><tr><th width='50%' <style=\"right:100px\"><colspan=\"2\"><center><font color='darkgreen'>" + tsalkapone_trans.general.groups + "</font></center></th></tr>\n";
  1188. docSource += "<tr><td width=\"450\" valign=\"top\"><table class=\"vis\" width=\"100%\"><tr><th width='50%' colspan=\"2\"><center><font color='darkgreen' style=\"font-size:x-small;\">(Clique no Grupo Desejado para Adicionar as Aldeias no Campo de Seleção ao Fim da Página)</font></center></th></tr>\n";
  1189. for(item in groupSummary){
  1190. if(groupSummary.hasOwnProperty(item)){
  1191. count=0;
  1192. docSource += "<tr><th colspan=\"2\">" + fnTranslate(curGroup++) + "</th></tr>\n";
  1193. for(jj=0;jj<groupSummary[item].length;jj++){
  1194. docSource += "<tr class=\"" + ((count++%2)?"row_b":"row_a") + "\">\n";
  1195. docSource += "<td width=\"240\" style=\"white-space:nowrap;\">";
  1196. docSource+='<span class="tsaltooltip"><img style="cursor: help; height:13px; width:13px" src="graphic/questionmark.png" ><span class="tsalinfo">'+ fnCriteriaToStr(outputSummary[groupSummary[item][jj]].criteria) +'</span></span>&nbsp;';
  1197. docSource+="<a href=\"#\" onclick=\"fnShowCoords('" + groupSummary[item][jj] + "','" + fnTranslate(outputSummary[groupSummary[item][jj]].descID) + "');\" >";
  1198.  
  1199. docSource += " &raquo;&nbsp; " + fnTranslate(outputSummary[groupSummary[item][jj]].descID) + "</a></td>\n";
  1200. docSource += "<td width=\"240\"" + ((summary[groupSummary[item][jj]].tally>0)?"":" class=\"hidden\"") + " style=\"text-align:right;\"><span>" + summary[groupSummary[item][jj]].tally + "</span></td>\n";
  1201. docSource += "</tr>\n";
  1202. }
  1203. }
  1204. }
  1205. docSource += "</table></center>\n";
  1206. docSource += "<td valign=\"top\">\n";
  1207.  
  1208. /* Offensive Units */
  1209. docSource += "<table class=\"vis\" width=\"100%\">\n";
  1210. docSource += "<tr><th colspan=\"2\"><center><font color='darkgreen'>" + tsalkapone_trans.general.counting + "</font></center></th></tr>\n";
  1211. docSource += "<tr><th colspan=\"2\"><center><font color='darkgreen' style=\"font-size:x-small;\">(Copie Abaixo o Relatório de Tropas para Facilitar a Comunicação com a Tribo)</font></center></th></tr>\n";
  1212. docSource += "<tr><th colspan=\"2\" style=\"white-space:nowrap;\"><img style='top:+5px; width:35px;height:30px; position: relative;' src='https://media.innogamescdn.com/com_DS_GR/Scripts/images/Tsalkapone_master_tool_images/Tsalkapone_off.png'>&nbsp;" + fnTranslate(curGroup++) + "</th></tr>\n";
  1213. count = 0;
  1214. for(key in offense){
  1215. if(offense.hasOwnProperty(key)){
  1216. docSource += "<tr class=\"" + ((count++%2)?"row_b":"row_a") + "\"><td><img src=\"https://" + win.location.hostname + "/graphic/unit/unit_" + offense[key] + ".png?1\" alt=\"\"/></td><td style=\"white-space:nowrap;\"><span> " + summary[offense[key]].count + " " + unitDesc[offense[key]] + "</span></td></tr>\n";
  1217. }
  1218. }
  1219. docSource += "</table>\n";
  1220.  
  1221.  
  1222. /* Defensive Units */
  1223. docSource += "<table class=\"vis\" width=\"100%\">\n";
  1224. docSource += "<tr><th colspan=\"2\" style=\"white-space:nowrap;\"><img style='top:+5px; width:35px;height:30px; position: relative;' src='https://media.innogamescdn.com/com_DS_GR/Scripts/images/Tsalkapone_master_tool_images/Tsalkapone_gendef.png'>&nbsp;" + fnTranslate(curGroup++) + "</th></tr>\n";
  1225. count = 0;
  1226. for(key in defense){
  1227. if(defense.hasOwnProperty(key)){
  1228. docSource += "<tr class=\"" + ((count++%2)?"row_b":"row_a") + "\"><td><img src=\"https://" + win.location.hostname + "/graphic/unit/unit_" + defense[key] + ".png?1\" alt=\"\"/></td><td style=\"white-space:nowrap;\"><span> " + summary[defense[key]].count + " " + unitDesc[defense[key]] + "</span></td></tr>\n";
  1229. }
  1230. }
  1231. docSource += "</table>\n";
  1232.  
  1233. /* Other Units */
  1234. docSource += "<table class=\"vis\" width=\"100%\">\n";
  1235. docSource += "<tr><th colspan=\"2\" style=\"white-space:nowrap;\">" + fnTranslate(curGroup++) + "</th></tr>\n";
  1236. count = 0;
  1237. win.$(win.game_data.unitConfig).children().each(function(i,e){
  1238. var unit=e.nodeName;
  1239. if(!new RegExp('^(' + defense.join('|') + '|' + offense.join('|') + ')$').test(unit)){
  1240. docSource += "<tr class=\"" + ((count++%2)?"row_b":"row_a") + "\"><td><img src=\"https://" + win.location.hostname + "/graphic/unit/unit_" + unit + ".png?1\" alt=\"\"/></td><td style=\"white-space:nowrap;\"><span> " + summary[unit].count + " " + unitDesc[unit] + "</span></td></tr>\n";
  1241. }
  1242. });
  1243. docSource += "</table>\n";
  1244.  
  1245. /* Total Units */
  1246. docSource += "<table class=\"vis\" width=\"100%\">\n";
  1247. docSource += "<tr><th colspan=\"2\" style=\"white-space:nowrap;\">" + fnTranslate(curGroup++) + "</th></tr>\n";
  1248. docSource += "<tr class=\"" + "row_a" + "\"><td><b><font color='red'><span>"+tsalkapone_trans.general.plithos+":</span></font></b></td><td style=\"white-space:nowrap;\"><span> " + summary.unitTotal.tally + " </span></td></tr>\n";
  1249. docSource += "<tr class=\"" + "row_b" + "\"><td><b><font color='red'><span>"+tsalkapone_trans.general.farm+":</span></font></b></td><td style=\"white-space:nowrap;\"><span> " + summary.unitTotal.population + "</span></td></tr>\n";
  1250. /* Units in Table */
  1251. docSource += "<tr><th colspan='2'>" + fnTranslate(curGroup++) + "</th></tr>";
  1252. docSource += "<tr class=\"" + "row_b" + "\"><td colspan='2'>";
  1253. docSource += "<textarea onclick='this.select();' rows='5' cols='50'>[spoiler=⚫ "+game_data.player.name+" ⚡ "+tsalkapone_trans.general.report+"][table]";
  1254. docSource+="[**][color=#D6352F]"+tsalkapone_trans.general.offensive+"[/color][||]"+tsalkapone_trans.general.monades+"[/**]";
  1255. count = 0;
  1256. docSource += "";
  1257. for(key in offense){
  1258. if(offense.hasOwnProperty(key)){
  1259.  
  1260. docSource += "[*][unit]" + offense[key] + "[/unit][|]";
  1261. docSource += "" + summary[offense[key]].count + "\n";
  1262.  
  1263. }}
  1264. docSource+="[/*][**]"+tsalkapone_trans.general.defensive+"[||]"+tsalkapone_trans.general.monades+"[/**]";
  1265. for(key in defense){
  1266. if(defense.hasOwnProperty(key)){
  1267.  
  1268. docSource += "[*][unit]" + defense[key] + "[/unit][|]";
  1269. docSource += "" + summary[defense[key]].count + "\n";
  1270.  
  1271. }}
  1272. docSource+="[/*][**]"+tsalkapone_trans.general.other+"[||]"+tsalkapone_trans.general.monades+"[/**]";
  1273. count = 0;
  1274. win.$(win.game_data.unitConfig).children().each(function(i,e){
  1275. var unit=e.nodeName;
  1276. if(!new RegExp('^(' + defense.join('|') + '|' + offense.join('|') + ')$').test(unit)){
  1277. docSource += "[*][unit]" + unit + "[/unit][|]";
  1278. docSource += "" + summary[unit].count + "\n";
  1279. }});
  1280.  
  1281. docSource+="[/table][/spoiler]</textarea></td></tr>";
  1282. /* Units for Mail, Forum */
  1283. docSource += "<tr><th colspan='2'>" + fnTranslate(curGroup++) + "</th></tr>";
  1284. docSource += "<tr class=\"" + "row_b" + "\"><td colspan='2'>";
  1285. docSource += "<textarea onclick='this.select();' rows='5' cols='50'>";
  1286. docSource+="[spoiler=⚫ "+game_data.player.name+" ⚡ "+tsalkapone_trans.general.report+"][b][color=red]"+tsalkapone_trans.general.offensive+"[/color][/b]\n[spoiler]";
  1287. count = 0;
  1288. docSource += "";
  1289. for(key in offense){
  1290. if(offense.hasOwnProperty(key)){
  1291.  
  1292. docSource += "[unit]" + offense[key] + "[/unit] -> ";
  1293. docSource += "" + summary[offense[key]].count + "\n";
  1294.  
  1295. }}
  1296. docSource+="[/spoiler]\n[b][color=red]"+tsalkapone_trans.general.defensive+"[/color][/b]\n[spoiler]";
  1297. for(key in defense){
  1298. if(defense.hasOwnProperty(key)){
  1299.  
  1300. docSource += "[unit]" + defense[key] + "[/unit] -> ";
  1301. docSource += "" + summary[defense[key]].count + "\n";
  1302.  
  1303. }}
  1304. docSource+="[/spoiler]\n[b][color=red]"+tsalkapone_trans.general.other+"[/color][/b]\n[spoiler]";
  1305. count = 0;
  1306. win.$(win.game_data.unitConfig).children().each(function(i,e){
  1307. var unit=e.nodeName;
  1308. if(!new RegExp('^(' + defense.join('|') + '|' + offense.join('|') + ')$').test(unit)){
  1309. docSource += "[unit]" + unit + "[/unit] -> ";
  1310. docSource += "" + summary[unit].count + "\n";
  1311. }});
  1312.  
  1313. docSource+="[/spoiler][/spoiler]</textarea></td></tr><tr><td><img width='400px;' height='200px;' src='https://i.imgur.com/RrAg5YW.gif'></td></tr>";
  1314. docSource += "</table>\n";
  1315.  
  1316. docSource += "</td>\n";
  1317. docSource += "</td>\n";
  1318. docSource += "</tr>\n";
  1319. docSource += "</table>\n";
  1320. docSource += "<hr>\n";
  1321. docSource += "<table id=\"coordinate_table\" class=\"vis\" style=\"width:100%;\">\n";
  1322. docSource += "<tr><th>" + fnTranslate(curGroup++) + " <i><b><font color='maroon'><span id=\"coords_group\" style=\"font-weight:100;\"></span></font></b></i>\n";
  1323. docSource += "<tr><td style=\"padding:1em;\"><textarea id=\"coords_container\" style=\"width:100%;\"></textarea></td></tr>\n";
  1324. docSource += "";
  1325.  
  1326. docSource += "</table>\n";
  1327. docSource += "</table>\n";
  1328. docSource += "</table>\n";
  1329. docSource += "</body>\n";
  1330. docSource += "</html>\n";
  1331.  
  1332. var popup=win.open('about:blank','Tsalkapone_Aνάλυση_&_Κατηγοριοποίηση_Στρατευμάτων','width=1000,height=700,scrollbars=yes');
  1333. popup.document.open('text/html','replace');
  1334. popup.document.write(docSource);
  1335. popup.document.close();
  1336. }
  1337.  
  1338. /*==== register ====*/
  1339. var script = {
  1340. scriptname: 'Army Reported',
  1341. version: '1.0',
  1342. author: 'Tsalkapone',
  1343. email: 'tsalkapone@hotmail.com',
  1344. broken: false
  1345. };
  1346. $.post(ScriptAPI.url,script);
  1347.  
  1348. var win=window;
  1349.  
  1350. /* HACK: fix null mode */
  1351. if(!win.game_data.mode){
  1352. var vmode=win.$("#overview_menu td[class=selected] a").attr("href").match(/mode\=(\w*)/i);
  1353. if(vmode){
  1354. win.game_data.mode=vmode[1];
  1355. }
  1356. }
  1357.  
  1358. win.game_data.isPremium=(win.$("#quickbar_outer").length>0);
  1359.  
  1360. if(typeof(win.game_data.worldConfig)=="undefined"){
  1361. win.game_data.worldConfig=fnCreateWorldConfig();
  1362. }
  1363.  
  1364. if(typeof(win.game_data.unitConfig)=="undefined"){
  1365. win.game_data.unitConfig=fnCreateUnitConfig();
  1366. }
  1367.  
  1368. /* Todo: Handle different scripts by name */
  1369. if(typeof(win.game_data.versionDumped)=="undefined"){
  1370. win.game_data.versionDumped=fnLogVersionInfo();
  1371. }
  1372.  
  1373.  
  1374.  
  1375. fnCalculateTroopCount();
  1376.  
  1377. void(0);
  1378. }
  1379. catch(objError){
  1380. var errMsg=String(objError.message||objError||"");
  1381. if(errMsg){
  1382. fnDebugLog("ΕΙΔΟΠΟΙΗΣΗ: " + errMsg);
  1383. alert("ΕΙΔΟΠΟΙΗΣΗ: " + errMsg);
  1384. }
  1385. }}
  1386.  
  1387. fnExecuteScript();
  1388.  
  1389.  
  1390. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement