Advertisement
Guest User

HH++ (OCD edit) 0.10.3

a guest
Oct 20th, 2019
2,524
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name            Hentai Heroes++ (OCD edit)
  3. // @namespace       hentaiheroes.com
  4. // @description     Adding things here and there in the Hentai Heroes game.
  5. // @version         0.10.3
  6. // @match           https://www.hentaiheroes.com/*
  7. // @match           https://nutaku.haremheroes.com/*
  8. // @match           https://eroges.hentaiheroes.com/*
  9. // @match           https://thrix.hentaiheroes.com/*
  10. // @match           https://www.gayharem.com/*
  11. // @match           https://nutaku.gayharem.com/*
  12. // @match           https://test.hentaiheroes.com/*
  13. // @run-at          document-end
  14. // @grant           none
  15. // @author          Raphael, 1121, Sluimerstand, shal
  16. // ==/UserScript==
  17.  
  18. /*  ===========
  19.      CHANGELOG
  20.     =========== */
  21.  
  22. // TO DO: Translate options menu.
  23. // TO DO: Clean up code, learn JSON.parse.
  24. // TO DO: Check Ben's League sim tweaks.
  25. // TO DO: Check Ben's Villain menu tweaks.
  26. // TO DO: Possibly add item comparison.
  27. // TO DO: Add daily missions XP to get.
  28.  
  29. // 0.10.3: Now supporting girl XP level calculations up to new level 500 cap (with thanks to piturda for the reminder).
  30. // 0.10.2: Incorporated piturda's Market fix (for server-side change 16/10/19) and Champion update. Added display of Club bonuses and Ginseng boosters to Market stats. Lots and lots of code clean-up.
  31. // 0.10.1: Fixed calculation of demotion and non-promotion points >1000 and remaining tokens in League info. Disabled display of highest obtainable League reward. Some League info code clean-up.
  32. // 0.10.0: Updated and expanded stats formula to reflect Patch of 14/08/19. (Hare)
  33. // 0.9.9: Fixed a bug in the Champions information caused by server-side changes to the code.
  34. // 0.9.8: Added Champions information (credit: Entwine). Fixed no longer working icons.
  35. // 0.9.7: Fixed League rewards calculating badly when it involves usernames with spaces. Fixed League rewards at 0 challenges left.
  36. // 0.9.6: Changed money abbreviations from K,M,G,T to K,M,B,T. Player values in Leagues are now exact. Sim result is orange if it's a close call.
  37. // 0.9.5: Fixed an issue for the Villain menu when the localStorage does not exist yet or anymore.
  38. // 0.9.4: Fixed a rare error in which the script would crash for trying to pull non-existent numbers to add thousand spacing to.
  39. // 0.9.3: Fixed League rewards not properly calculating for point values higher than 999.
  40. // 0.9.2: Added an options menu. Removed modifyScenes. Tweaked sim refresh. Tweaked League info. Tweaked better XP and money. Tweaked harem info.
  41. // 0.9.1: Fixed sims not refreshing anymore because I wanted to wrap up the previous version so I could watch the new Game of Thrones.
  42. // 0.9.0: Expanded on the extra League info. Added some missing translations for Spanish.
  43. // 0.8.9: Fixed player beta/omega stats not calculating properly for girls with spëcìál characters in their names. I'm a professional, I swear.
  44. // 0.8.8: Added Jackson's Crew villain name. Fixed Charm and Know-How defence in sim results. Added extra League info.
  45. // 0.8.7: Fixed Charm proc not occurring in sim results. Fixed Know-How proc not calculating correctly. Added opponent name in the console logs.
  46. // 0.8.6: Fixed wrong class defence stats for beta/omega girls. Fixed new line creation for wide sim results.
  47. // 0.8.5: Fixed wrong class Harmony procs for League sims.
  48. // 0.8.4: More tweaks to League sims.
  49. // 0.8.3: Fixed excitement for League sims (formerly known as match rating formerly known as power levels).
  50. // 0.8.2: Fixed an oopsie I made when calculating worst-case scenario. Console log (F12) is now also available.
  51. // 0.8.1: Fixed League numbers for French and Spanish localisations. Changed League ratings to show a worst-case scenario.
  52. // 0.8.0: Fixed the event villains issue.
  53. // 0.7.9: Properly fixed the button displacement. Match rating is now even more accurate.
  54. // 0.7.8: Fixed the collect all button displacement. Fixed Excitement stat in Leagues. Match rating is now more accurate.
  55. // 0.7.7: Replaced the League power levels with a match rating.
  56. // 0.7.6: Added better XP and better money.
  57. // 0.7.5: Added the @downloadURL, so the script can be updated directly from Tampermonkey.
  58. // 0.7.4: Removed the added mission and arena timers and the extra quest button. Added an auto refresh for the home screen.
  59. // 0.7.3: Cleaned up the code and prepared the file for "public launch." Added power levels to Leagues.
  60. // 0.7.2: Updated the harem info pane to be more pleasing to the eyes.
  61.  
  62. /* =========
  63.     GENERAL
  64.    ========= */
  65.  
  66. // Define jQuery
  67. var $ = window.jQuery;
  68.  
  69. // Define CSS
  70. var sheet = (function() {
  71.     var style = document.createElement('style');
  72.     document.head.appendChild(style);
  73.     return style.sheet;
  74. })();
  75.  
  76. // Numbers: thousand spacing
  77. function nThousand(x) {
  78.     if (typeof x != 'number') {
  79.         x = 0;
  80.     }
  81.     return x.toLocaleString();
  82. }
  83.  
  84. // Numbers: rounding to K, M, G and T
  85. function nRounding(num, digits) {
  86.     var si = [
  87.         { value: 1, symbol: '' },
  88.         { value: 1E3, symbol: 'K' },
  89.         { value: 1E6, symbol: 'M' },
  90.         { value: 1E9, symbol: 'B' },
  91.         { value: 1E12, symbol: 'T' },
  92.     ];
  93.     var rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
  94.     var i;
  95.     for (i = si.length - 1; i > 0; i--) {
  96.         if (num >= si[i].value) {
  97.             break;
  98.         }
  99.     }
  100.     return (num / si[i].value).toFixed(digits).replace(rx, '$1') + si[i].symbol;
  101. }
  102.  
  103. /* ==============
  104.     TRANSLATIONS
  105.    ============== */
  106.  
  107. var lang = 'en';
  108.  
  109. if ($('html')[0].lang === 'en') {
  110.     lang = 'en';
  111. }
  112. else if ($('html')[0].lang === 'fr') {
  113.     lang = 'fr';
  114. }
  115. else if ($('html')[0].lang === 'es_ES') {
  116.     lang = 'es';
  117. }
  118.  
  119. var texts = [];
  120.  
  121. texts.en = {
  122.     optionsRefresh: 'Home screen refresh',
  123.     optionsVillain: 'Fight a villain menu',
  124.     optionsXP: 'Better XP',
  125.     optionsMoney: 'Better money',
  126.     optionsMarket: 'Market information',
  127.     optionsHarem: 'Harem information',
  128.     optionsLeague: 'League information',
  129.     optionsSim: 'League sim',
  130.     optionsChampions: 'Champions information',
  131.     navigate: 'Navigate',
  132.     current: 'current',
  133.     locked: 'locked',
  134.     unlock_it: 'unlock it!',
  135.     scene: 'scene',
  136.     harem: 'Harem',
  137.     bottom: 'Bottom',
  138.     or: 'or',
  139.     total: 'Total',
  140.     affection: 'affection',
  141.     harem_stats: 'Harem Stats',
  142.     haremettes: 'haremettes',
  143.     hardcore: 'Hardcore',
  144.     charm: 'Charm',
  145.     know_how: 'Know-how',
  146.     unlocked_scenes: 'unlocked scenes',
  147.     money_incomes: 'Money income',
  148.     per_hour: 'per hour',
  149.     when_all_collectable: 'when all collectable',
  150.     required_to_unlock: 'Required to upgrade all haremettes',
  151.     my_stocks: 'My stock',
  152.     top: 'Top',
  153.     equipments: 'equipments',
  154.     boosters: 'boosters',
  155.     books: 'books',
  156.     gifts: 'gifts',
  157.     currently_buyable: 'Currently buyable stock',
  158.     visit_the: 'Visit the <a href="../shop.html">Market</a> first.',
  159.     not_compatible: 'Your webbrowser is not compatible.',
  160.     or_level: 'or level',
  161.     restock: 'Restock',
  162.     wiki: '\'s wiki page',
  163.     she_is_your: 'She is your',
  164.     evolution_costs: 'Upgrade costs are',
  165.     world: 'World ',
  166.     villain: ' villain',
  167.     fight_villain: 'Fight a villain',
  168.     you_own: 'You own',
  169.     you_can_give: 'You can give a total of',
  170.     you_can_sell: 'You can sell everything for',
  171.     stat_points_need: 'Stat points need to max',
  172.     money_need: 'Money need to max',
  173.     money_spent: 'Money spent in market',
  174.     points_from_level: 'Stat points from level',
  175.     bought_points: 'Bought points from market',
  176.     equipment_points: 'Equipments stat points',
  177.     club_points: 'Club bonus stat points',
  178.     ginseng_points: 'Ginseng',
  179.     quick_list: 'Quick list',
  180.     required_to_get_max_level: 'Required to level all haremettes',
  181.     Xp: 'XP',
  182.     starter: 'Starter',
  183.     common: 'Common',
  184.     rare: 'Rare',
  185.     epic: 'Epic',
  186.     legendary: 'Legendary',
  187.     day: 'd',
  188.     hour: 'h',
  189.     minute: 'm',
  190.     rank: 'Rank',
  191.     demote: 'To <u>demote</u> you can have a maximum of ',
  192.     promote: 'To <u>not promote</u> you can have a maximum of ',
  193.     points: 'points',
  194.     challenges_regen: 'Natural regeneration: ',
  195.     challenges_left: '<br />Challenges left: '
  196. };
  197.  
  198. texts.fr = {
  199.     optionsRefresh: 'Home screen refresh',
  200.     optionsVillain: 'Fight a villain menu',
  201.     optionsXP: 'Better XP',
  202.     optionsMoney: 'Better money',
  203.     optionsMarket: 'Market information',
  204.     optionsHarem: 'Harem information',
  205.     optionsLeague: 'League information',
  206.     optionsSim: 'League sim',
  207.     optionsChampions: 'Champions information',
  208.     navigate: 'Déplace-toi',
  209.     current: 'actuelle',
  210.     locked: 'bloquée',
  211.     unlock_it: 'débloque-la!',
  212.     scene: 'scène',
  213.     harem: 'Harem',
  214.     bottom: 'bas',
  215.     or: 'ou',
  216.     total: 'total',
  217.     affection: 'affection',
  218.     harem_stats: 'Stats du harem',
  219.     haremettes: 'haremettes',
  220.     hardcore: 'Hardcore',
  221.     charm: 'Charme',
  222.     know_how: 'Savoir-faire',
  223.     unlocked_scenes: 'scènes débloquées',
  224.     money_incomes: 'Revenus',
  225.     per_hour: 'par heure',
  226.     when_all_collectable: 'quand tout est disponible',
  227.     required_to_unlock: 'Requis pour débloquer la scène',
  228.     my_stocks: 'Mes stocks',
  229.     top: 'haut',
  230.     equipments: 'équipements',
  231.     boosters: 'boosters',
  232.     books: 'livres',
  233.     gifts: 'cadeaux',
  234.     currently_buyable: 'Stock disponible au marché',
  235.     visit_the: 'Visite le <a href="../shop.html">marché</a> first.',
  236.     not_compatible: 'Votre navigateur n\'est pas compatible.',
  237.     or_level: 'ou niveau',
  238.     restock: 'Restock',
  239.     wiki: 'Page wiki de ',
  240.     she_is_your: 'Elle est ta', //He_is_your: 'Il est ton',
  241.     evolution_costs: 'Ses couts d\'évolution sont',
  242.     world: 'Monde ',
  243.     villain: ' troll',
  244.     fight_villain: 'Combats un troll',
  245.     you_own: 'Tu possèdes',
  246.     you_can_give: 'Tu peux donner un total de',
  247.     you_can_sell: 'Tu peux tout vendre pour',
  248.     stat_points_need: 'Nombre de points requis pour max',
  249.     money_need: 'Argent demandé pour max',
  250.     money_spent: 'Argent dépensé dans le marché',
  251.     points_from_level: 'Points donnés par ton niveau',
  252.     bought_points: 'Points achetés au marché',
  253.     equipment_points: 'Points donnés par ton équipement',
  254.     club_points: 'Points donnés par ton club',
  255.     ginseng_points: 'Ginseng',
  256.     quick_list: 'Liste rapide',
  257.     required_to_get_max_level: 'Requis pour obtenir toutes les filles au niveau maximum',
  258.     Xp: 'XP',
  259.     starter: 'Fille de départ',
  260.     common: 'Commun',
  261.     rare: 'Rare',
  262.     epic: 'Épique',
  263.     legendary: 'Légendaire',
  264.     day: 'j',
  265.     hour: 'h',
  266.     minute: 'm',
  267.     rank: 'Rang',
  268.     demote: 'Pour <u>rétrograder</u> vous pouvez avoir un maximum de ',
  269.     promote: 'Pour <u>ne pas monter</u> vous pouvez avoir un maximum de ',
  270.     points: 'points',
  271.     challenges_regen: 'Régénération naturelle: ',
  272.     challenges_left: '<br />Défis restants: '
  273. };
  274.  
  275. texts.es = {
  276.     optionsRefresh: 'Home screen refresh',
  277.     optionsVillain: 'Fight a villain menu',
  278.     optionsXP: 'Better XP',
  279.     optionsMoney: 'Better money',
  280.     optionsMarket: 'Market information',
  281.     optionsHarem: 'Harem information',
  282.     optionsLeague: 'League information',
  283.     optionsSim: 'League sim',
  284.     optionsChampions: 'Champions information',
  285.     navigate: 'Navegar',
  286.     current: 'actual',
  287.     locked: 'bloqueado',
  288.     unlock_it: 'desbloquealo!',
  289.     scene: 'escena',
  290.     harem: 'Harén',
  291.     bottom: 'Fondo',
  292.     or: 'o',
  293.     total: 'Total',
  294.     affection: 'afecto',
  295.     harem_stats: 'Estatus del Harén',
  296.     haremettes: 'haremettes',
  297.     hardcore: 'Folladas',
  298.     charm: 'Encanto',
  299.     know_how: 'Saber-hacer',
  300.     unlocked_scenes: 'escenas desbloqueadas',
  301.     money_incomes: 'Ingreso de dinero',
  302.     per_hour: 'por hora',
  303.     when_all_collectable: 'cuando todo es coleccionable',
  304.     required_to_unlock: 'Requerido para desbloquear todas las escenas bloqueadas',
  305.     my_stocks: 'Mi Stock',
  306.     top: 'Tope',
  307.     equipments: 'equipamiento',
  308.     boosters: 'potenciadores',
  309.     books: 'libros',
  310.     gifts: 'regalos',
  311.     currently_buyable: 'Stocks Comprables Actualmente',
  312.     visit_the: 'Visita el <a href="../shop.html">Mercado</a> primero.',
  313.     not_compatible: 'Tu navegador no es compatible.',
  314.     or_level: 'o nivel',
  315.     restock: 'Restock',
  316.     wiki: 'wiki',
  317.     she_is_your: 'Ella es tu',
  318.     evolution_costs: 'Sus costo de evolucion son',
  319.     world: 'Mundo ',
  320.     villain: ' villano',
  321.     fight_villain: 'Pelear un villano',
  322.     you_own: 'Tienes',
  323.     you_can_give: 'Puedes dar un total de',
  324.     you_can_sell: 'Puedes vender todo por',
  325.     stat_points_need: 'Puntos de estatus necesarios para maximo',
  326.     money_need: 'Dinero necesario para maximo',
  327.     money_spent: 'Dinero usado en el mercado',
  328.     points_from_level: 'Puntos de estatus de nivel',
  329.     bought_points: 'Puntos comprados del mercado',
  330.     equipment_points: 'Puntos de estatus de equipamiento',
  331.     club_points: 'Puntos de estatus del club',
  332.     ginseng_points: 'Ginseng',
  333.     quick_list: 'Lista Rapida',
  334.     required_to_get_max_level: 'Requerido para obtener el máximo nivel de todas las chicas',
  335.     Xp: 'XP',
  336.     starter: 'Principiante',
  337.     common: 'Común',
  338.     rare: 'Raro',
  339.     epic: 'Épico',
  340.     legendary: 'Legendario',
  341.     day: 'd',
  342.     hour: 'h',
  343.     minute: 'm',
  344.     rank: 'Rango',
  345.     demote: 'Para <u>degradar</u> puedes tener un máximo de ',
  346.     promote: 'Para <u>no promocionarte</u> puedes tener un máximo de ',
  347.     points: 'puntos',
  348.     challenges_regen: 'Regeneracion naturel: ',
  349.     challenges_left: '<br />Retos pendientes: '
  350. };
  351.  
  352. /* ==================
  353.     WHEN TO RUN WHAT
  354.    ================== */
  355.  
  356. var currentPage = window.location.pathname;
  357. if (currentPage.indexOf('home') != -1) options();
  358.  
  359. // Show which modules are enabled and if so, run them when appropriate
  360. if (localStorage.getItem('HHS.refresh') === '1') {
  361.     $('#hhsRefresh').attr('checked', 'checked');
  362.     if (currentPage.indexOf('home') != -1) {
  363.         moduleRefresh();
  364.     }
  365. }
  366. if (localStorage.getItem('HHS.villain') === '1') {
  367.     $('#hhsVillain').attr('checked', 'checked');
  368.     moduleVillain();
  369. }
  370. if (localStorage.getItem('HHS.xp') === '1') {
  371.     $('#hhsXP').attr('checked', 'checked');
  372.     moduleXP();
  373. }
  374. if (localStorage.getItem('HHS.money') === '1') {
  375.     $('#hhsMoney').attr('checked', 'checked');
  376.     moduleMoney();
  377. }
  378. if (localStorage.getItem('HHS.market') === '1') {
  379.     $('#hhsMarket').attr('checked', 'checked');
  380.     if (currentPage.indexOf('shop') != -1) {
  381.         moduleMarket();
  382.     }
  383. }
  384. if (localStorage.getItem('HHS.harem') === '1') {
  385.     $('#hhsHarem').attr('checked', 'checked');
  386.     if (currentPage.indexOf('harem') != -1) {
  387.         moduleHarem();
  388.     }
  389. }
  390. if (localStorage.getItem('HHS.league') === '1') {
  391.     $('#hhsLeague').attr('checked', 'checked');
  392.     if (currentPage.indexOf('tower-of-fame') != -1) {
  393.         moduleLeague();
  394.     }
  395. }
  396. if (localStorage.getItem('HHS.sim') === '1') {
  397.     $('#hhsSim').attr('checked', 'checked');
  398.     if (currentPage.indexOf('tower-of-fame') != -1) {
  399.         moduleSim();
  400.     }
  401. }
  402. if (localStorage.getItem('HHS.champions') === '1') {
  403.     $('#hhsChampions').attr('checked', 'checked');
  404.     moduleChampions();
  405. }
  406.  
  407. /* =========
  408.     OPTIONS
  409.    ========= */
  410.  
  411. function options() {
  412.     // Create localStorage if it doesn't exist yet
  413.     if (localStorage.getItem('HHS.refresh') === null) {
  414.         localStorage.setItem('HHS.refresh', '1');
  415.     }
  416.     if (localStorage.getItem('HHS.villain') === null) {
  417.         localStorage.setItem('HHS.villain', '1');
  418.     }
  419.     if (localStorage.getItem('HHS.xp') === null) {
  420.         localStorage.setItem('HHS.xp', '1');
  421.     }
  422.     if (localStorage.getItem('HHS.money') === null) {
  423.         localStorage.setItem('HHS.money', '1');
  424.     }
  425.     if (localStorage.getItem('HHS.market') === null) {
  426.         localStorage.setItem('HHS.market', '1');
  427.     }
  428.     if (localStorage.getItem('HHS.harem') === null) {
  429.         localStorage.setItem('HHS.harem', '1');
  430.     }
  431.     if (localStorage.getItem('HHS.league') === null) {
  432.         localStorage.setItem('HHS.league', '1');
  433.     }
  434.     if (localStorage.getItem('HHS.sim') === null) {
  435.         localStorage.setItem('HHS.sim', '1');
  436.     }
  437.     if (localStorage.getItem('HHS.champions') === null) {
  438.         localStorage.setItem('HHS.champions', '1');
  439.     }
  440.  
  441.     // Options menu
  442.     $('div#contains_all').append('<a href="#"><img src="https://i.imgur.com/z8hYMMZ.png" id="hhsButton"></a>');
  443.     $('div#contains_all').append('<div id="hhsOptions" class="hhsTooltip" style="display: none;">'
  444.         + '<label class="switch"><input type="checkbox" id="hhsRefresh"><span class="slider"></span></label>' + texts[lang].optionsRefresh + '<br />'
  445.         + '<label class="switch"><input type="checkbox" id="hhsVillain"><span class="slider"></span></label>' + texts[lang].optionsVillain + '<br />'
  446.         + '<label class="switch"><input type="checkbox" id="hhsXP"><span class="slider"></span></label>' + texts[lang].optionsXP + '<br />'
  447.         + '<label class="switch"><input type="checkbox" id="hhsMoney"><span class="slider"></span></label>' + texts[lang].optionsMoney + '<br />'
  448.         + '<label class="switch"><input type="checkbox" id="hhsMarket"><span class="slider"></span></label>' + texts[lang].optionsMarket + '<br />'
  449.         + '<label class="switch"><input type="checkbox" id="hhsHarem"><span class="slider"></span></label>' + texts[lang].optionsHarem + '<br />'
  450.         + '<label class="switch"><input type="checkbox" id="hhsLeague"><span class="slider"></span></label>' + texts[lang].optionsLeague + '<br />'
  451.         + '<label class="switch"><input type="checkbox" id="hhsSim"><span class="slider"></span></label>' + texts[lang].optionsSim + '<br />'
  452.         + '<label class="switch"><input type="checkbox" id="hhsChampions"><span class="slider"></span></label>' + texts[lang].optionsChampions
  453.         + '</div>');
  454.  
  455.     // Show and hide options menu
  456.     $('#hhsButton').click(function() {
  457.         var x = document.getElementById('hhsOptions');
  458.         if (x.style.display === 'none') {
  459.             x.style.display = 'block';
  460.         }
  461.         else {
  462.             x.style.display = 'none';
  463.         }
  464.     });
  465.  
  466.     // Save changed options
  467.     $('#hhsRefresh').click(function() {
  468.         if (document.getElementById('hhsRefresh').checked == true) {
  469.             localStorage.setItem('HHS.refresh', '1');
  470.         }
  471.         if (document.getElementById('hhsRefresh').checked == false) {
  472.             localStorage.setItem('HHS.refresh', '0');
  473.         }
  474.     });
  475.  
  476.     $('#hhsVillain').click(function() {
  477.         if (document.getElementById('hhsVillain').checked == true) {
  478.             localStorage.setItem('HHS.villain', '1');
  479.         }
  480.         if (document.getElementById('hhsVillain').checked == false) {
  481.             localStorage.setItem('HHS.villain', '0');
  482.         }
  483.     });
  484.  
  485.     $('#hhsXP').click(function() {
  486.         if (document.getElementById('hhsXP').checked == true) {
  487.             localStorage.setItem('HHS.xp', '1');
  488.         }
  489.         if (document.getElementById('hhsXP').checked == false) {
  490.             localStorage.setItem('HHS.xp', '0');
  491.         }
  492.     });
  493.  
  494.     $('#hhsMoney').click(function() {
  495.         if (document.getElementById('hhsMoney').checked == true) {
  496.             localStorage.setItem('HHS.money', '1');
  497.         }
  498.         if (document.getElementById('hhsMoney').checked == false) {
  499.             localStorage.setItem('HHS.money', '0');
  500.         }
  501.     });
  502.  
  503.     $('#hhsMarket').click(function() {
  504.         if (document.getElementById('hhsMarket').checked == true) {
  505.             localStorage.setItem('HHS.market', '1');
  506.         }
  507.         if (document.getElementById('hhsMarket').checked == false) {
  508.             localStorage.setItem('HHS.market', '0');
  509.         }
  510.     });
  511.  
  512.     $('#hhsHarem').click(function() {
  513.         if (document.getElementById('hhsHarem').checked == true) {
  514.             localStorage.setItem('HHS.harem', '1');
  515.         }
  516.         if (document.getElementById('hhsHarem').checked == false) {
  517.             localStorage.setItem('HHS.harem', '0');
  518.         }
  519.     });
  520.  
  521.     $('#hhsLeague').click(function() {
  522.         if (document.getElementById('hhsLeague').checked == true) {
  523.             localStorage.setItem('HHS.league', '1');
  524.         }
  525.         if (document.getElementById('hhsLeague').checked == false) {
  526.             localStorage.setItem('HHS.league', '0');
  527.         }
  528.     });
  529.  
  530.     $('#hhsSim').click(function() {
  531.         if (document.getElementById('hhsSim').checked == true) {
  532.             localStorage.setItem('HHS.sim', '1');
  533.         }
  534.         if (document.getElementById('hhsSim').checked == false) {
  535.             localStorage.setItem('HHS.sim', '0');
  536.         }
  537.     });
  538.  
  539.     $('#hhsChampions').click(function() {
  540.         if (document.getElementById('hhsChampions').checked == true) {
  541.             localStorage.setItem('HHS.champions', '1');
  542.         }
  543.         if (document.getElementById('hhsChampions').checked == false) {
  544.             localStorage.setItem('HHS.champions', '0');
  545.         }
  546.     });
  547.  
  548.     //CSS
  549.     sheet.insertRule('#hhsButton {'
  550.         + 'height: 35px; '
  551.         + 'position: absolute; '
  552.         + 'top: 55px; '
  553.         + 'right: 15px; '
  554.         + 'filter: drop-shadow(0px 0px 5px white);}'
  555.     );
  556.  
  557.     sheet.insertRule('.hhsTooltip {'
  558.         + 'font-size: 12px; '
  559.         + 'text-align: left; '
  560.         + 'padding: 3px 5px 3px 5px; '
  561.         + 'border: 2px solid #905312; '
  562.         + 'border-radius: 6px; '
  563.         + 'background-color: rgba(32,3,7,.9); '
  564.         + 'position: absolute; right: 55px; top: 55px;}'
  565.     );
  566.  
  567.     sheet.insertRule('.switch {'
  568.         + 'position: relative; '
  569.         + 'display: inline-block; '
  570.         + 'width: 34px; '
  571.         + 'height: 17px;}'
  572.     );
  573.  
  574.     sheet.insertRule('.slider {'
  575.         + 'position: absolute; '
  576.         + 'cursor: pointer; '
  577.         + 'top: 0; '
  578.         + 'left: 0; '
  579.         + 'right: 0; '
  580.         + 'bottom: 0; '
  581.         + 'background-color: #CCCCCC; '
  582.         + '-webkit-transition: .4s; '
  583.         + 'transition: .4s; '
  584.         + 'border-radius: 17px; '
  585.         + 'margin-right: 4px;}'
  586.     );
  587.  
  588.     sheet.insertRule('.slider:before {'
  589.         + 'position: absolute; '
  590.         + 'content: \'\'; '
  591.         + 'height: 13px; '
  592.         + 'width: 13px; '
  593.         + 'left: 2px; '
  594.         + 'bottom: 2px; '
  595.         + 'background-color: white; '
  596.         + '-webkit-transition: .4s; '
  597.         + 'transition: .4s; '
  598.         + 'border-radius: 50%;}'
  599.     );
  600.  
  601.     sheet.insertRule('input:checked + .slider {'
  602.         + 'background-color: #F11F64;}'
  603.     );
  604.  
  605.     sheet.insertRule('input:checked + .slider:before {'
  606.         + '-webkit-transform: translateX(13px); '
  607.         + '-ms-transform: translateX(13px); '
  608.         + 'transform: translateX(13px);}'
  609.     );
  610. }
  611.  
  612. /* =====================
  613.     HOME SCREEN REFRESH
  614.    ===================== */
  615.  
  616. function moduleRefresh() {
  617.     setInterval(function() {
  618.         window.location.reload();
  619.     }, 600000);
  620. }
  621.  
  622. /* ======================
  623.     FIGHT A VILLAIN MENU
  624.    ====================== */
  625.  
  626. function moduleVillain() {
  627.     //Create localStorage if it doesn't exist yet
  628.     if (localStorage.getItem('eventTrolls') === null) {
  629.         localStorage.setItem('eventTrolls', '[]');
  630.     }
  631.  
  632.     var eventTrolls = JSON.parse(localStorage.getItem('eventTrolls'));
  633.  
  634.     //Check if event girls have been collected
  635.     if (currentPage.indexOf('home') != -1) {
  636.         eventTrolls = [];
  637.         if (typeof event_object_data !== 'undefined') {
  638.             event_object_data.girls.forEach(function(girl) {
  639.                 if (girl.hasOwnProperty('troll')) {
  640.                     if (!girl.hasOwnProperty('owned_girl')) {
  641.                         eventTrolls.push(girl.troll.id_troll);
  642.                     }
  643.                 }
  644.             });
  645.         }
  646.         localStorage.setItem('eventTrolls', JSON.stringify(eventTrolls));
  647.     }
  648.  
  649.     //Add the actual menu
  650.     var Trolls = ['Dark Lord', 'Ninja Spy', 'Gruntt', 'Edwarda', 'Donatien', 'Silvanus', 'Bremen', 'Finalmecia', 'Roko Senseï', 'Karole', 'Jackson&#8217;s Crew'];
  651.  
  652.     var CurrentWorld = Hero.infos.questing.id_world - 1,
  653.         TrollName = '',
  654.         TrollsMenu = '';
  655.  
  656.     for (var i = 0; i < CurrentWorld; i++) {
  657.         if (typeof Trolls[i] !== typeof undefined && Trolls[i] !== false) {
  658.             TrollName = Trolls[i];
  659.         }
  660.         else TrollName = texts[lang].world + ' ' + (i + 2) + ' ' + texts[lang].villain;
  661.         var type = 'regular';
  662.         for (var j = 0, len = eventTrolls.length; j < len; j++) {
  663.             if (eventTrolls[j] == (i + 1)) {
  664.                 type = 'eventTroll';
  665.             }
  666.         }
  667.         TrollsMenu += '<a class="' + type + '" href="/battle.html?id_troll=' + (i + 1) + '">' + TrollName + '</a><br />';
  668.     }
  669.  
  670.     $('#contains_all > header').children('[type=energy_fight]').append('<div class="scriptInfo" id="FightTroll">' + texts[lang].fight_villain + '<span class="Arrow"></span><div class="TrollsMenu">' + TrollsMenu + '</div></div>');
  671.  
  672.     //CSS
  673.     sheet.insertRule('.scriptInfo {'
  674.         + 'position: absolute; '
  675.         + 'z-index: 99; '
  676.         + 'width: 90%; '
  677.         + 'margin: 5px 0 0 13px; '
  678.         + 'border-radius: 8px 10px 10px 8px; '
  679.         + 'background-color: rgba(0,0,0,.8); '
  680.         + 'box-shadow: 0 0 0 1px rgba(255,255,255,0.73); '
  681.         + 'font-size: 12px; '
  682.         + 'font-weight: 400; '
  683.         + 'letter-spacing: .22px; '
  684.         + 'color: #fff; '
  685.         + 'text-align: center;}'
  686.     );
  687.  
  688.     sheet.insertRule('.scriptInfo a {'
  689.         + 'font-family: \'Carter One\', \'Alegreya Sans\', cursive !important; '
  690.         + 'color: rgb(255, 255, 255); '
  691.         + 'text-decoration: none;}'
  692.     );
  693.  
  694.     sheet.insertRule('#FightTroll {'
  695.         + 'width: 70%; '
  696.         + 'left: 30px;}'
  697.     );
  698.  
  699.     sheet.insertRule('.eventTroll {'
  700.         + 'color: #f70 !important;}'
  701.     );
  702.  
  703.     sheet.insertRule('.eventTroll:hover {'
  704.         + 'color: #fa0 !important;}'
  705.     );
  706.  
  707.     sheet.insertRule('#FightTroll > .Arrow {'
  708.         + 'float: right; '
  709.         + 'background-image: url("https://i.imgur.com/QlIv2XB.png"); '
  710.         + 'background-size: 18px 18px; '
  711.         + 'background-repeat: no-repeat; '
  712.         + 'width: 18px; '
  713.         + 'height: 18px;}'
  714.     );
  715.  
  716.     sheet.insertRule('#FightTroll > .TrollsMenu {'
  717.         + 'position: absolute; '
  718.         + 'width: 88%; '
  719.         + 'margin-left: 6px; '
  720.         + 'border-radius: 0px 0 8px 8px; '
  721.         + 'background-color: rgba(0,0,0,.8); '
  722.         + 'line-height: 15px; '
  723.         + 'opacity: 0; '
  724.         + 'visibility: hidden; '
  725.         + 'transition: opacity 400ms, visibility 400ms;}'
  726.     );
  727.  
  728.     sheet.insertRule('#FightTroll:hover > .TrollsMenu {'
  729.         + 'opacity: 1; '
  730.         + 'visibility: visible;}'
  731.     );
  732.  
  733.     sheet.insertRule('#FightTroll a {'
  734.         + 'color: rgb(255, 255, 255); '
  735.         + 'text-decoration: none;}'
  736.     );
  737.  
  738.     sheet.insertRule('#FightTroll a:hover {'
  739.         + 'color: rgb(255, 247, 204); '
  740.         + 'text-decoration: underline;}'
  741.     );
  742. }
  743.  
  744. /* ===========
  745.     BETTER XP
  746.    =========== */
  747.  
  748. function moduleXP() {
  749.     function betterXP() {
  750.         $('span[hero="xp"]').empty().append('Next: ');
  751.         $('span[hero="xp_sep"]').empty().append(nThousand(Hero.infos.Xp.left));
  752.         $('span[hero="xp_max"]').empty().append(' XP');
  753.     };
  754.  
  755.     betterXP();
  756.  
  757.     $('.button_glow').click(function() {
  758.         setInterval(function() {
  759.             betterXP();
  760.         }, 3000)
  761.     });
  762. }
  763.  
  764. /* ==============
  765.     BETTER MONEY
  766.    ============== */
  767.  
  768. function moduleMoney() {
  769.     function betterMoney() {
  770.         $('div[hero="soft_currency"]').empty().append(nRounding(Hero.infos.soft_currency, 2));
  771.     };
  772.  
  773.     betterMoney();
  774.  
  775.     $('.button_glow').click(function() {
  776.         setInterval(function() {
  777.             betterMoney();
  778.         }, 3000)
  779.     });
  780.  
  781.     $('#collect_all').click(function() {
  782.         setInterval(function() {
  783.             betterMoney();
  784.         }, 3000)
  785.     });
  786.  
  787.     $('.collect_money').click(function() {
  788.         setInterval(function() {
  789.             betterMoney();
  790.         }, 3000)
  791.     });
  792. }
  793.  
  794. /* ====================
  795.     MARKET INFORMATION
  796.    ==================== */
  797.  
  798. function moduleMarket() {
  799.     var loc2 = $('.hero_stats').children();
  800.     loc2.each(function() {
  801.         var stat = $(this).attr('hero');
  802.         if (stat == 'carac1' || stat == 'carac2' || stat == 'carac3') {
  803.             $(this).append('<span class="CustomStats"></span><div id="CustomStats' + stat + '" class="StatsTooltip"></div>');
  804.         }
  805.     });
  806.  
  807.     updateStats();
  808.  
  809.     function updateStats() {
  810.         var loc2 = $('.hero_stats').children();
  811.         var last_cost = 0,
  812.             levelMoney = 0,
  813.             levelPoints = Hero.infos.level * 30;
  814.         levelMoney = calculateTotalPrice(levelPoints);
  815.         loc2.each(function() {
  816.             var stat = $(this).attr('hero');
  817.             $('.CustomStats').html('');
  818.             if (stat == 'carac1' || stat == 'carac2' || stat == 'carac3') {
  819.                 var boughtPoints = Hero.infos[stat],
  820.                     remainingPoints = levelPoints - boughtPoints,
  821.                     spentMoney = calculateTotalPrice(boughtPoints),
  822.                     remainingMoney = levelMoney - spentMoney;
  823.  
  824.                 var totalPoints = Hero.infos.caracs[stat],
  825.                     skillPoints = Hero.infos.caracs['stat' + stat.substr(5)] - boughtPoints;
  826.  
  827.                 var equipmentsData = $('.armor#equiped .armor').children(),
  828.                     itemPoints = 0;
  829.                 equipmentsData.each(function() {
  830.                     var equipmentsStats = $(this).attr('data-d'),
  831.                         statPosStart = equipmentsStats.indexOf(stat + '_equip') + 15,
  832.                         statPosEnd = equipmentsStats.substr(statPosStart).indexOf(',');
  833.                     itemPoints = itemPoints + parseInt(equipmentsStats.substr(statPosStart, statPosEnd - 1));
  834.                 });
  835.  
  836.                 var boostersData = $('.armor#equiped .sub_block .booster').children(),
  837.                     ginsengPoints = 0,
  838.                     ginsengPointsText = '',
  839.                     ginsengLegendary = 0;
  840.                 boostersData.each(function() {
  841.                     if ($(this).attr('class') != 'slot empty') {
  842.                         if ($(this).attr('id_item') == '7') {
  843.                             ginsengPoints = ginsengPoints + 100;
  844.                         }
  845.                         else if ($(this).attr('id_item') == '8') {
  846.                             ginsengPoints = ginsengPoints + 350;
  847.                         }
  848.                         else if ($(this).attr('id_item') == '9') {
  849.                             ginsengPoints = ginsengPoints + 1225;
  850.                         }
  851.                         else if ($(this).attr('id_item') == '316') {
  852.                             ginsengLegendary = ginsengLegendary + 1;
  853.                         }
  854.                     }
  855.                 });
  856.                 ginsengPoints = ginsengPoints + Math.ceil((skillPoints + boughtPoints + itemPoints + ginsengPoints) * 0.06 * ginsengLegendary);
  857.                 if (ginsengPoints != 0) {
  858.                     ginsengPointsText = ' (+ ' + nThousand(ginsengPoints) + ' ' + texts[lang].ginseng_points + ')';
  859.                 }
  860.  
  861.                 var clubPoints = totalPoints - skillPoints - boughtPoints - itemPoints - ginsengPoints;
  862.  
  863.                 $('#CustomStats' + stat).html(
  864.                     '<b>' + texts[lang].stat_points_need + ':</b> ' + nThousand(remainingPoints) + '<br />' +
  865.                     '<b>' + texts[lang].money_need + ': </b>' + nThousand(remainingMoney) + '<br />' +
  866.                     '<b>' + texts[lang].money_spent + ': </b>' + nThousand(spentMoney) + '<br /><br />' +
  867.                     '<b>' + texts[lang].points_from_level + ': </b>' + nThousand(skillPoints) + '<br />' +
  868.                     '<b>' + texts[lang].bought_points + ': </b>' + nThousand(boughtPoints) + '<br />' +
  869.                     '<b>' + texts[lang].equipment_points + ': </b>' + nThousand(itemPoints) + ginsengPointsText + '<br />' +
  870.                     '<b>' + texts[lang].club_points + ': </b>' + nThousand(clubPoints) + '<br />'
  871.                 );
  872.             }
  873.         });
  874.     }
  875.  
  876.     function calculateTotalPrice(points) {
  877.         var last_price = calculateStatPrice(points);
  878.         var price = 0;
  879.         if (points < 2001) {
  880.             price = (5 + last_price) / 2 * points;
  881.         }
  882.         else if (points < 4001) {
  883.             price = 4012005 + (4009 + last_price) / 2 * (points - 2001);
  884.         }
  885.         else if (points < 6001) {
  886.             price = 20026005 + (12011 + last_price) / 2 * (points - 4001);
  887.         }
  888.         else if (points < 8001) {
  889.             price = 56042005 + (24013 + last_price) / 2 * (points - 6001);
  890.         }
  891.         else if (points < 10001) {
  892.             price = 120060005 + (40015 + last_price) / 2 * (points - 8001);
  893.         }
  894.         else if (points < 12001) {
  895.             price = 220080005 + (60017 + last_price) / 2 * (points - 10001);
  896.         }
  897.         else if (points < 14001) {
  898.             price = 364102005 + (84019 + last_price) / 2 * (points - 12001);
  899.         }
  900.         else if (points < 16001) {
  901.             price = 560126005 + (112021 + last_price) / 2 * (points - 14001);
  902.         }
  903.         return price;
  904.     }
  905.  
  906.     function calculateStatPrice(points) {
  907.         var cost = 0;
  908.         if (points < 2001) {
  909.             cost = 3 + points * 2;
  910.         }
  911.         else if (points < 4001) {
  912.             cost = 4005 + (points - 2001) * 4;
  913.         }
  914.         else if (points < 6001) {
  915.             cost = 12005 + (points - 4001) * 6;
  916.         }
  917.         else if (points < 8001) {
  918.             cost = 24005 + (points - 6001) * 8;
  919.         }
  920.         else if (points < 10001) {
  921.             cost = 40005 + (points - 8001) * 10;
  922.         }
  923.         else if (points < 12001) {
  924.             cost = 60005 + (points - 10001) * 12;
  925.         }
  926.         else if (points < 14001) {
  927.             cost = 84005 + (points - 12001) * 14;
  928.         }
  929.         else if (points < 16001) {
  930.             cost = 112005 + (points - 14001) * 16;
  931.         }
  932.         return cost;
  933.     }
  934.  
  935.     var lsMarket = {};
  936.     lsMarket.buyable = {};
  937.     lsMarket.stocks = {};
  938.     lsMarket.restock = {};
  939.  
  940.     setTimeout(function() {
  941.         var restocktime = 0;
  942.         var time = $('#shop > .shop_count > span').text();
  943.         if (time.indexOf('h') > -1) {
  944.             restocktime = parseInt(time.substring(0, time.indexOf('h'))) * 3600;
  945.             time = time.substring(time.indexOf('h') + 1);
  946.         }
  947.         if (time.indexOf('m') > -1) {
  948.             restocktime += parseInt(time.substring(0, time.indexOf('m'))) * 60;
  949.             time = time.substring(time.indexOf('h') + 1);
  950.         }
  951.         if (time.indexOf('s') > -1) {
  952.             restocktime += parseInt(time.substring(0, time.indexOf('s')));
  953.         }
  954.  
  955.         lsMarket.restock.herolvl = Hero.infos.level;
  956.         lsMarket.restock.time = (new Date()).getTime() + restocktime * 1000;
  957.  
  958.         get_buyableStocks('potion');
  959.         get_buyableStocks('gift');
  960.         equipments_shop(0);
  961.         boosters_shop(0);
  962.         books_shop(0);
  963.         gifts_shop(0);
  964.     }, 500);
  965.  
  966.     var timer;
  967.     $('#shop > button, #inventory > button').click(function() {
  968.         var clickedButton = $(this).attr('rel'),
  969.             opened_shop = $('#shop').children('.selected');
  970.         clearTimeout(timer);
  971.         timer = setTimeout(function() {
  972.             if (opened_shop.hasClass('armor')) {
  973.                 equipments_shop(1);
  974.             }
  975.             else if (opened_shop.hasClass('booster')) {
  976.                 boosters_shop(1);
  977.             }
  978.             else if (opened_shop.hasClass('potion')) {
  979.                 if (clickedButton == 'buy' || clickedButton == 'shop_reload') get_buyableStocks('potion');
  980.                 books_shop(1);
  981.             }
  982.             else if (opened_shop.hasClass('gift')) {
  983.                 if (clickedButton == 'buy' || clickedButton == 'shop_reload') get_buyableStocks('gift');
  984.                 gifts_shop(1);
  985.             }
  986.         }, 500);
  987.     });
  988.  
  989.     function get_buyableStocks(loc_class) {
  990.         var itemsNb = 0,
  991.             itemsXp = 0,
  992.             itemsPrice = 0,
  993.             loc = $('#shop').children('.' + loc_class);
  994.         loc.find('.slot').each(function() {
  995.             if ($(this).hasClass('empty')) return false;
  996.             var item = $(this).data('d');
  997.             itemsNb++;
  998.             itemsXp += parseInt(item.value, 10);
  999.             itemsPrice += parseInt(item.price, 10);
  1000.         });
  1001.         lsMarket.buyable[loc_class] = {'Nb':itemsNb, 'Xp':itemsXp, 'Value':itemsPrice};
  1002.     }
  1003.  
  1004.     function equipments_shop(update) {
  1005.         tt_create(update, 'armor', 'EquipmentsTooltip', 'equipments', '');
  1006.     }
  1007.     function boosters_shop(update) {
  1008.         tt_create(update, 'booster', 'BoostersTooltip', 'boosters', '');
  1009.     }
  1010.     function books_shop(update) {
  1011.         tt_create(update, 'potion', 'BooksTooltip', 'books', 'Xp');
  1012.     }
  1013.     function gifts_shop(update) {
  1014.         tt_create(update, 'gift', 'GiftsTooltip', 'gifts', 'affection');
  1015.     }
  1016.  
  1017.     function tt_create(update, loc_class, tt_class, itemName, itemUnit) {
  1018.         var itemsNb = 0,
  1019.             itemsXp = (itemUnit === '') ? -1 : 0,
  1020.             itemsSell = 0,
  1021.             loc = $('#inventory').children('.' + loc_class);
  1022.  
  1023.         loc.find('.slot').each(function() {
  1024.             if ($(this).hasClass('empty')) return false;
  1025.             var item = $(this).data('d'),
  1026.                 Nb = parseInt(item.count, 10);
  1027.             itemsNb += Nb;
  1028.             itemsSell += Nb * parseInt(item.price_sell, 10);
  1029.             if (itemsXp != -1) itemsXp += Nb * parseInt(item.value, 10);
  1030.         });
  1031.  
  1032.         var tooltip = texts[lang].you_own + ' <b>' + nThousand(itemsNb) + '</b> ' + texts[lang][itemName] + '.<br />' +
  1033.             (itemsXp == -1 ? '' : texts[lang].you_can_give + ' <b>' + nThousand(itemsXp) + '</b> ' + texts[lang][itemUnit] + '.<br />') +
  1034.             texts[lang].you_can_sell + ' <b>' + nThousand(itemsSell) + '</b> <span class="imgMoney"></span>.';
  1035.  
  1036.         lsMarket.stocks[loc_class] = (loc_class == 'potion' || loc_class == 'gift') ? {'Nb':itemsNb, 'Xp':itemsXp} : {'Nb':itemsNb};
  1037.         localStorage.setItem('lsMarket', JSON.stringify(lsMarket));
  1038.  
  1039.         if (update === 0) {
  1040.             loc.prepend('<span class="CustomTT"></span><div class="' + tt_class + '">' + tooltip + '</div>');
  1041.         }
  1042.         else {
  1043.             loc.children('.' + tt_class).html(tooltip);
  1044.         }
  1045.     }
  1046.     $('plus').on('click', function (event) {
  1047.         var stat = 'carac' + $(this).attr('for_carac');
  1048.         Hero.infos[stat]++;
  1049.         timer = setTimeout(function() {
  1050.             updateStats();
  1051.         }, 400);
  1052.     });
  1053.  
  1054.     //CSS
  1055.     sheet.insertRule('#inventory .CustomTT {'
  1056.         + 'float: right; '
  1057.         + 'margin: 11px 1px 0 0; '
  1058.         + 'background-image: url("https://i.imgur.com/7nhmtbM.png"); '
  1059.         + 'background-size: 20px 20px; '
  1060.         + 'width: 20px; '
  1061.         + 'height: 20px;}'
  1062.     );
  1063.  
  1064.     sheet.insertRule('#inventory .CustomTT:hover {'
  1065.         + 'cursor: help;}'
  1066.     );
  1067.  
  1068.     sheet.insertRule('#inventory .CustomTT:hover + div {'
  1069.         + 'opacity: 1; '
  1070.         + 'visibility: visible;}'
  1071.     );
  1072.  
  1073.     sheet.insertRule('#inventory .EquipmentsTooltip, #inventory .BoostersTooltip, #inventory .BooksTooltip, #inventory .GiftsTooltip {'
  1074.         + 'position: absolute; '
  1075.         + 'z-index: 99; '
  1076.         + 'width: 240px; '
  1077.         + 'border: 1px solid rgb(162, 195, 215); '
  1078.         + 'border-radius: 8px; '
  1079.         + 'box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.1); '
  1080.         + 'padding: 3px 7px 4px 7px; '
  1081.         + 'background-color: #F2F2F2; '
  1082.         + 'font: normal 10px/17px Tahoma, Helvetica, Arial, sans-serif; '
  1083.         + 'color: #057; '
  1084.         + 'opacity: 0; '
  1085.         + 'visibility: hidden; '
  1086.         + 'transition: opacity 400ms, visibility 400ms;}'
  1087.     );
  1088.  
  1089.     sheet.insertRule('#inventory .EquipmentsTooltip, #inventory .BoostersTooltip {'
  1090.         + 'margin: -33px 0 0 210px; '
  1091.         + 'height: 43px;}'
  1092.     );
  1093.  
  1094.     sheet.insertRule('#inventory .BooksTooltip, #inventory .GiftsTooltip {'
  1095.         + 'margin: -50px 0 0 210px; '
  1096.         + 'height: 60px;}'
  1097.     );
  1098.  
  1099.     sheet.insertRule('#inventory .EquipmentsTooltip b, #inventory .BoostersTooltip b, #inventory .BooksTooltip b, #inventory .GiftsTooltip b {'
  1100.         + 'font-weight: bold;}'
  1101.     );
  1102.  
  1103.     sheet.insertRule('#inventory .imgMoney {'
  1104.         + 'background-size: 12px 12px; '
  1105.         + 'background-repeat: no-repeat; '
  1106.         + 'width: 12px; '
  1107.         + 'height: 14px; '
  1108.         + 'vertical-align: text-bottom; '
  1109.         + 'background-image: url("https://i.imgur.com/hnnHBux.png"); '
  1110.         + 'display: inline-block;}'
  1111.     );
  1112.  
  1113.     sheet.insertRule('.hero_stats .CustomStats:hover {'
  1114.         + 'cursor: help;}'
  1115.     );
  1116.  
  1117.     sheet.insertRule('.hero_stats .CustomStats {'
  1118.         + 'float: right; '
  1119.         + 'margin-left: -25px; '
  1120.         + 'margin-top: 5px; '
  1121.         + 'background-image: url("https://i.imgur.com/7nhmtbM.png"); '
  1122.         + 'background-size: 18px 18px; '
  1123.         + 'background-position: center; '
  1124.         + 'background-repeat: no-repeat; '
  1125.         + 'width: 18px; '
  1126.         + 'height: 100%; '
  1127.         + 'visibility: none;}'
  1128.     );
  1129.  
  1130.     sheet.insertRule('.hero_stats .CustomStats:hover + div {'
  1131.         + 'opacity: 1; '
  1132.         + 'visibility: visible;}'
  1133.     );
  1134.  
  1135.     sheet.insertRule('.hero_stats .StatsTooltip {'
  1136.         + 'position: absolute; '
  1137.         + 'z-index: 99; '
  1138.         + 'margin: -130px 0 0 -28px; '
  1139.         + 'width: 280px; '
  1140.         + 'border: 1px solid rgb(162, 195, 215); '
  1141.         + 'border-radius: 8px; '
  1142.         + 'box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.1); '
  1143.         + 'padding: 2px 7px 2px 7px; '
  1144.         + 'background-color: #F2F2F2; '
  1145.         + 'font: normal 10px/17px Tahoma, Helvetica, Arial, sans-serif; '
  1146.         + 'text-align: left; '
  1147.         + 'opacity: 0; '
  1148.         + 'visibility: hidden; '
  1149.         + 'transition: opacity 400ms, visibility 400ms;}'
  1150.     );
  1151.  
  1152.     sheet.insertRule('.hero_stats .StatsTooltip b {'
  1153.         + 'font-weight: bold;}'
  1154.     );
  1155. }
  1156.  
  1157. /* ===================
  1158.     HAREM INFORMATION
  1159.    =================== */
  1160.  
  1161. function moduleHarem() {
  1162.     var stats = [];
  1163.     var girlsList = [];
  1164.     var haremRight = $('#harem_right');
  1165.  
  1166.     stats.girls = 0;
  1167.     stats.hourlyMoney = 0;
  1168.     stats.allCollect = 0;
  1169.     stats.unlockedScenes = 0;
  1170.     stats.allScenes = 0;
  1171.     stats.rarities = {starting: 0, common: 0, rare: 0, epic: 0, legendary: 0};
  1172.     stats.caracs = {1: 0, 2: 0, 3: 0};
  1173.     stats.stars = {affection: 0, money: 0, kobans: 0};
  1174.     stats.xp = 0;
  1175.     stats.affection = 0;
  1176.     stats.money = 0;
  1177.     stats.kobans = 0;
  1178.  
  1179.     var GIRLS_EXP_LEVELS = [];
  1180.  
  1181.     GIRLS_EXP_LEVELS.starting = [10, 21, 32, 43, 54, 65, 76, 87, 98, 109, 120, 131, 142, 154, 166, 178, 190, 202, 214, 226, 238, 250, 262, 274, 286, 299, 312, 325, 338, 351, 364, 377, 390, 403, 416, 429, 443, 457, 471, 485, 499, 513, 527, 541, 555, 569, 584, 599, 614, 629, 644, 659, 674, 689, 704, 720, 736, 752, 768, 784, 800, 816, 832, 849, 866, 883, 900, 917, 934, 951, 968, 985, 1003, 1021, 1039, 1057, 1075, 1093, 1111, 1130, 1149, 1168, 1187, 1206, 1225, 1244, 1264, 1284, 1304, 1324, 1344, 1364, 1384, 1405, 1426, 1447, 1468, 1489, 1510, 1531, 1553, 1575, 1597, 1619, 1641, 1663, 1686, 1709, 1732, 1755, 1778, 1801, 1825, 1849, 1873, 1897, 1921, 1945, 1970, 1995, 2020, 2045, 2070, 2096, 2122, 2148, 2174, 2200, 2227, 2254, 2281, 2308, 2335, 2363, 2391, 2419, 2447, 2475, 2504, 2533, 2562, 2591, 2620, 2650, 2680, 2710, 2740, 2770, 2801, 2832, 2863, 2894, 2926, 2958, 2990, 3022, 3055, 3088, 3121, 3154, 3188, 3222, 3256, 3290, 3325, 3360, 3395, 3430, 3466, 3502, 3538, 3574, 3611, 3648, 3685, 3722, 3760, 3798, 3836, 3875, 3914, 3953, 3992, 4032, 4072, 4112, 4153, 4194, 4235, 4277, 4319, 4361, 4403, 4446, 4489, 4532, 4576, 4620, 4664, 4709, 4754, 4799, 4845, 4891, 4937, 4984, 5031, 5078, 5126, 5174, 5223, 5272, 5321, 5371, 5421, 5471, 5522, 5573, 5624, 5676, 5728, 5781, 5834, 5887, 5941, 5995, 6050, 6105, 6160, 6216, 6272, 6329, 6386, 6444, 6502, 6560, 6619, 6678, 6738, 6798, 6859, 6920, 6981, 7043, 7105, 7168, 7231, 7295, 7359, 7424, 7489, 7555, 7621, 7688, 7755, 7823, 7891, 7960, 8029, 8099, 8169, 8240, 8311, 8383, 8455, 8528, 8601, 8675, 8750, 8825, 8901, 8977, 9054, 9131, 9209, 9288, 9367, 9447, 9527, 9608, 9690, 9772, 9855, 9938, 10022, 10107, 10192, 10278, 10365, 10452, 10540, 10628, 10717, 10807, 10897, 10988, 11080, 11172, 11265, 11359, 11454, 11549, 11645, 11742, 11839, 11937, 12036, 12136, 12236, 12337, 12439, 12542, 12645, 12749, 12854, 12960, 13067, 13174, 13282, 13391, 13501, 13612, 13723, 13835, 13948, 14062, 14177, 14293, 14409, 14526, 14644, 14763, 14883, 15004, 15126, 15249, 15373, 15498, 15623, 15749, 15876, 16004, 16133, 16263, 16394, 16526, 16659, 16793, 16928, 17064, 17201, 17339, 17478, 17618, 17759, 17901, 18044, 18189, 18335, 18482, 18630, 18779, 18929, 19080, 19232, 19385, 19540, 19696, 19853, 20011, 20170, 20330, 20492, 20655, 20819, 20984, 21151, 21319, 21488, 21658, 21830, 22003, 22177, 22352, 22529, 22707, 22886, 23067, 23249, 23432, 23617, 23803, 23991, 24180, 24370, 24562, 24755, 24950, 25146, 25344, 25543, 25744, 25946, 26150, 26355, 26562, 26770, 26980, 27191, 27404, 27619, 27835, 28053, 28272, 28493, 28716, 28940, 29166, 29394, 29623, 29854, 30087, 30322, 30558, 30796, 31036, 31278, 31522, 31767, 32014, 32263, 32514, 32767, 33022, 33279, 33537, 33797, 34059, 34323, 34589, 34857, 35127, 35399, 35673, 35949, 36228, 36509, 36792, 37077, 37364, 37653, 37944, 38237, 38533, 38831, 39131, 39433, 39738, 40045, 40354, 40665, 40979, 41295, 41614, 41935, 42258, 42584, 42912, 43243, 43576, 43912, 44250, 44591, 44934, 45280, 45628, 45979, 46333, 46689, 47048, 47410, 47774, 48141, 48511, 48884, 49259, 49637, 50018, 50402, 50789, 51179, 51572, 51967, 52365, 52766, 53170, 53577, 53988, 54402, 54819];
  1182.  
  1183.     GIRLS_EXP_LEVELS.common = [10, 21, 32, 43, 54, 65, 76, 87, 98, 109, 120, 131, 142, 154, 166, 178, 190, 202, 214, 226, 238, 250, 262, 274, 286, 299, 312, 325, 338, 351, 364, 377, 390, 403, 416, 429, 443, 457, 471, 485, 499, 513, 527, 541, 555, 569, 584, 599, 614, 629, 644, 659, 674, 689, 704, 720, 736, 752, 768, 784, 800, 816, 832, 849, 866, 883, 900, 917, 934, 951, 968, 985, 1003, 1021, 1039, 1057, 1075, 1093, 1111, 1130, 1149, 1168, 1187, 1206, 1225, 1244, 1264, 1284, 1304, 1324, 1344, 1364, 1384, 1405, 1426, 1447, 1468, 1489, 1510, 1531, 1553, 1575, 1597, 1619, 1641, 1663, 1686, 1709, 1732, 1755, 1778, 1801, 1825, 1849, 1873, 1897, 1921, 1945, 1970, 1995, 2020, 2045, 2070, 2096, 2122, 2148, 2174, 2200, 2227, 2254, 2281, 2308, 2335, 2363, 2391, 2419, 2447, 2475, 2504, 2533, 2562, 2591, 2620, 2650, 2680, 2710, 2740, 2770, 2801, 2832, 2863, 2894, 2926, 2958, 2990, 3022, 3055, 3088, 3121, 3154, 3188, 3222, 3256, 3290, 3325, 3360, 3395, 3430, 3466, 3502, 3538, 3574, 3611, 3648, 3685, 3722, 3760, 3798, 3836, 3875, 3914, 3953, 3992, 4032, 4072, 4112, 4153, 4194, 4235, 4277, 4319, 4361, 4403, 4446, 4489, 4532, 4576, 4620, 4664, 4709, 4754, 4799, 4845, 4891, 4937, 4984, 5031, 5078, 5126, 5174, 5223, 5272, 5321, 5371, 5421, 5471, 5522, 5573, 5624, 5676, 5728, 5781, 5834, 5887, 5941, 5995, 6050, 6105, 6160, 6216, 6272, 6329, 6386, 6444, 6502, 6560, 6619, 6678, 6738, 6798, 6859, 6920, 6981, 7043, 7105, 7168, 7231, 7295, 7359, 7424, 7489, 7555, 7621, 7688, 7755, 7823, 7891, 7960, 8029, 8099, 8169, 8240, 8311, 8383, 8455, 8528, 8601, 8675, 8750, 8825, 8901, 8977, 9054, 9131, 9209, 9288, 9367, 9447, 9527, 9608, 9690, 9772, 9855, 9938, 10022, 10107, 10192, 10278, 10365, 10452, 10540, 10628, 10717, 10807, 10897, 10988, 11080, 11172, 11265, 11359, 11454, 11549, 11645, 11742, 11839, 11937, 12036, 12136, 12236, 12337, 12439, 12542, 12645, 12749, 12854, 12960, 13067, 13174, 13282, 13391, 13501, 13612, 13723, 13835, 13948, 14062, 14177, 14293, 14409, 14526, 14644, 14763, 14883, 15004, 15126, 15249, 15373, 15498, 15623, 15749, 15876, 16004, 16133, 16263, 16394, 16526, 16659, 16793, 16928, 17064, 17201, 17339, 17478, 17618, 17759, 17901, 18044, 18189, 18335, 18482, 18630, 18779, 18929, 19080, 19232, 19385, 19540, 19696, 19853, 20011, 20170, 20330, 20492, 20655, 20819, 20984, 21151, 21319, 21488, 21658, 21830, 22003, 22177, 22352, 22529, 22707, 22886, 23067, 23249, 23432, 23617, 23803, 23991, 24180, 24370, 24562, 24755, 24950, 25146, 25344, 25543, 25744, 25946, 26150, 26355, 26562, 26770, 26980, 27191, 27404, 27619, 27835, 28053, 28272, 28493, 28716, 28940, 29166, 29394, 29623, 29854, 30087, 30322, 30558, 30796, 31036, 31278, 31522, 31767, 32014, 32263, 32514, 32767, 33022, 33279, 33537, 33797, 34059, 34323, 34589, 34857, 35127, 35399, 35673, 35949, 36228, 36509, 36792, 37077, 37364, 37653, 37944, 38237, 38533, 38831, 39131, 39433, 39738, 40045, 40354, 40665, 40979, 41295, 41614, 41935, 42258, 42584, 42912, 43243, 43576, 43912, 44250, 44591, 44934, 45280, 45628, 45979, 46333, 46689, 47048, 47410, 47774, 48141, 48511, 48884, 49259, 49637, 50018, 50402, 50789, 51179, 51572, 51967, 52365, 52766, 53170, 53577, 53988, 54402, 54819];
  1184.  
  1185.     GIRLS_EXP_LEVELS.rare = [12, 25, 38, 51, 64, 77, 90, 103, 116, 129, 142, 156, 170, 184, 198, 212, 226, 240, 254, 268, 282, 297, 312, 327, 342, 357, 372, 387, 402, 417, 433, 449, 465, 481, 497, 513, 529, 545, 561, 578, 595, 612, 629, 646, 663, 680, 697, 715, 733, 751, 769, 787, 805, 823, 841, 860, 879, 898, 917, 936, 955, 974, 994, 1014, 1034, 1054, 1074, 1094, 1114, 1135, 1156, 1177, 1198, 1219, 1240, 1262, 1284, 1306, 1328, 1350, 1372, 1394, 1417, 1440, 1463, 1486, 1509, 1532, 1556, 1580, 1604, 1628, 1652, 1677, 1702, 1727, 1752, 1777, 1802, 1828, 1854, 1880, 1906, 1932, 1959, 1986, 2013, 2040, 2067, 2095, 2123, 2151, 2179, 2207, 2236, 2265, 2294, 2323, 2352, 2382, 2412, 2442, 2472, 2503, 2534, 2565, 2596, 2627, 2659, 2691, 2723, 2755, 2788, 2821, 2854, 2887, 2921, 2955, 2989, 3023, 3058, 3093, 3128, 3163, 3199, 3235, 3271, 3307, 3344, 3381, 3418, 3456, 3494, 3532, 3570, 3609, 3648, 3687, 3727, 3767, 3807, 3847, 3888, 3929, 3970, 4012, 4054, 4096, 4139, 4182, 4225, 4269, 4313, 4357, 4402, 4447, 4492, 4538, 4584, 4630, 4677, 4724, 4771, 4819, 4867, 4915, 4964, 5013, 5062, 5112, 5162, 5213, 5264, 5315, 5367, 5419, 5471, 5524, 5577, 5631, 5685, 5739, 5794, 5849, 5905, 5961, 6017, 6074, 6131, 6189, 6247, 6306, 6365, 6424, 6484, 6544, 6605, 6666, 6728, 6790, 6853, 6916, 6980, 7044, 7108, 7173, 7238, 7304, 7370, 7437, 7504, 7572, 7640, 7709, 7778, 7848, 7918, 7989, 8061, 8133, 8206, 8279, 8353, 8427, 8502, 8577, 8653, 8729, 8806, 8884, 8962, 9041, 9120, 9200, 9281, 9362, 9444, 9526, 9609, 9693, 9777, 9862, 9947, 10033, 10120, 10207, 10295, 10384, 10473, 10563, 10654, 10745, 10837, 10930, 11023, 11117, 11212, 11308, 11404, 11501, 11599, 11697, 11796, 11896, 11997, 12098, 12200, 12303, 12407, 12511, 12616, 12722, 12829, 12937, 13045, 13154, 13264, 13375, 13487, 13600, 13713, 13827, 13942, 14058, 14175, 14293, 14412, 14531, 14651, 14772, 14894, 15017, 15141, 15266, 15392, 15519, 15647, 15776, 15906, 16037, 16169, 16302, 16436, 16571, 16707, 16844, 16982, 17121, 17261, 17402, 17544, 17687, 17831, 17976, 18122, 18269, 18417, 18566, 18716, 18868, 19021, 19175, 19330, 19486, 19643, 19802, 19962, 20123, 20285, 20448, 20613, 20779, 20946, 21114, 21284, 21455, 21627, 21800, 21975, 22151, 22328, 22507, 22687, 22868, 23051, 23235, 23420, 23607, 23795, 23985, 24176, 24368, 24562, 24757, 24954, 25152, 25352, 25553, 25756, 25960, 26166, 26373, 26582, 26792, 27004, 27218, 27433, 27650, 27868, 28088, 28310, 28533, 28758, 28985, 29213, 29443, 29675, 29909, 30144, 30381, 30620, 30861, 31103, 31347, 31593, 31841, 32091, 32343, 32597, 32852, 33109, 33368, 33629, 33892, 34157, 34424, 34693, 34964, 35237, 35512, 35789, 36068, 36349, 36633, 36919, 37207, 37497, 37789, 38083, 38380, 38679, 38980, 39283, 39588, 39896, 40206, 40518, 40833, 41150, 41469, 41791, 42115, 42442, 42771, 43103, 43437, 43774, 44113, 44455, 44799, 45146, 45495, 45847, 46202, 46559, 46919, 47282, 47647, 48015, 48386, 48760, 49136, 49515, 49897, 50282, 50670, 51061, 51455, 51852, 52252, 52655, 53061, 53470, 53882, 54297, 54715, 55136, 55560, 55987, 56418, 56852, 57289, 57729, 58173, 58620, 59070, 59524, 59981, 60442, 60906, 61373, 61844, 62318, 62796, 63278, 63763, 64252, 64745, 65241, 65741];
  1186.  
  1187.     GIRLS_EXP_LEVELS.epic = [14, 29, 44, 59, 74, 89, 104, 119, 134, 149, 165, 181, 197, 213, 229, 245, 261, 277, 294, 311, 328, 345, 362, 379, 396, 413, 431, 449, 467, 485, 503, 521, 539, 557, 576, 595, 614, 633, 652, 671, 690, 710, 730, 750, 770, 790, 810, 830, 851, 872, 893, 914, 935, 956, 977, 999, 1021, 1043, 1065, 1087, 1109, 1132, 1155, 1178, 1201, 1224, 1247, 1271, 1295, 1319, 1343, 1367, 1391, 1416, 1441, 1466, 1491, 1516, 1542, 1568, 1594, 1620, 1646, 1673, 1700, 1727, 1754, 1781, 1809, 1837, 1865, 1893, 1921, 1950, 1979, 2008, 2037, 2066, 2096, 2126, 2156, 2186, 2217, 2248, 2279, 2310, 2341, 2373, 2405, 2437, 2469, 2502, 2535, 2568, 2601, 2635, 2669, 2703, 2737, 2772, 2807, 2842, 2877, 2913, 2949, 2985, 3021, 3058, 3095, 3132, 3169, 3207, 3245, 3283, 3322, 3361, 3400, 3439, 3479, 3519, 3559, 3600, 3641, 3682, 3724, 3766, 3808, 3850, 3893, 3936, 3979, 4023, 4067, 4111, 4156, 4201, 4246, 4292, 4338, 4384, 4431, 4478, 4525, 4573, 4621, 4670, 4719, 4768, 4818, 4868, 4918, 4969, 5020, 5071, 5123, 5175, 5228, 5281, 5334, 5388, 5442, 5497, 5552, 5607, 5663, 5719, 5776, 5833, 5891, 5949, 6007, 6066, 6125, 6185, 6245, 6306, 6367, 6429, 6491, 6553, 6616, 6679, 6743, 6807, 6872, 6937, 7003, 7069, 7136, 7203, 7271, 7339, 7408, 7477, 7547, 7617, 7688, 7759, 7831, 7903, 7976, 8049, 8123, 8198, 8273, 8349, 8425, 8502, 8579, 8657, 8736, 8815, 8895, 8975, 9056, 9138, 9220, 9303, 9386, 9470, 9555, 9640, 9726, 9813, 9900, 9988, 10076, 10165, 10255, 10345, 10436, 10528, 10621, 10714, 10808, 10903, 10998, 11094, 11191, 11288, 11386, 11485, 11585, 11685, 11786, 11888, 11991, 12094, 12198, 12303, 12409, 12516, 12623, 12731, 12840, 12950, 13061, 13172, 13284, 13397, 13511, 13626, 13742, 13859, 13976, 14094, 14213, 14333, 14454, 14576, 14699, 14823, 14948, 15074, 15200, 15327, 15455, 15584, 15714, 15845, 15977, 16110, 16244, 16379, 16515, 16652, 16790, 16929, 17069, 17210, 17352, 17496, 17641, 17787, 17934, 18082, 18231, 18381, 18532, 18684, 18837, 18992, 19148, 19305, 19463, 19622, 19782, 19944, 20107, 20271, 20436, 20603, 20771, 20940, 21110, 21282, 21455, 21629, 21804, 21981, 22159, 22338, 22519, 22701, 22884, 23069, 23255, 23443, 23632, 23822, 24014, 24207, 24402, 24598, 24796, 24995, 25196, 25398, 25602, 25807, 26014, 26222, 26432, 26643, 26856, 27071, 27287, 27505, 27724, 27945, 28168, 28392, 28618, 28846, 29075, 29306, 29539, 29774, 30010, 30248, 30488, 30730, 30974, 31219, 31466, 31715, 31966, 32219, 32474, 32731, 32990, 33250, 33512, 33776, 34042, 34310, 34580, 34852, 35126, 35402, 35681, 35962, 36245, 36530, 36817, 37106, 37397, 37690, 37986, 38284, 38584, 38886, 39191, 39498, 39807, 40119, 40433, 40749, 41068, 41389, 41712, 42038, 42366, 42697, 43030, 43366, 43704, 44045, 44388, 44734, 45082, 45433, 45787, 46143, 46502, 46864, 47228, 47595, 47965, 48338, 48713, 49091, 49472, 49856, 50243, 50633, 51026, 51422, 51821, 52223, 52628, 53036, 53447, 53861, 54278, 54698, 55121, 55547, 55976, 56409, 56845, 57284, 57726, 58172, 58621, 59073, 59529, 59988, 60451, 60917, 61387, 61860, 62337, 62817, 63301, 63789, 64280, 64775, 65274, 65776, 66282, 66792, 67306, 67823, 68344, 68869, 69398, 69931, 70468, 71009, 71554, 72103, 72656, 73214, 73776, 74342, 74912, 75487, 76066, 76649];
  1188.  
  1189.     GIRLS_EXP_LEVELS.legendary = [16, 33, 50, 67, 84, 101, 118, 135, 152, 170, 188, 206, 224, 242, 260, 278, 297, 316, 335, 354, 373, 392, 411, 431, 451, 471, 491, 511, 531, 551, 572, 593, 614, 635, 656, 677, 698, 720, 742, 764, 786, 808, 830, 853, 876, 899, 922, 945, 968, 992, 1016, 1040, 1064, 1088, 1112, 1137, 1162, 1187, 1212, 1237, 1263, 1289, 1315, 1341, 1367, 1394, 1421, 1448, 1475, 1502, 1529, 1557, 1585, 1613, 1641, 1670, 1699, 1728, 1757, 1786, 1816, 1846, 1876, 1906, 1936, 1967, 1998, 2029, 2060, 2092, 2124, 2156, 2188, 2221, 2254, 2287, 2320, 2354, 2388, 2422, 2456, 2491, 2526, 2561, 2596, 2632, 2668, 2704, 2740, 2777, 2814, 2851, 2888, 2926, 2964, 3002, 3041, 3080, 3119, 3158, 3198, 3238, 3278, 3319, 3360, 3401, 3443, 3485, 3527, 3569, 3612, 3655, 3698, 3742, 3786, 3830, 3875, 3920, 3965, 4011, 4057, 4103, 4150, 4197, 4244, 4292, 4340, 4388, 4437, 4486, 4536, 4586, 4636, 4687, 4738, 4789, 4841, 4893, 4946, 4999, 5052, 5106, 5160, 5215, 5270, 5325, 5381, 5437, 5494, 5551, 5608, 5666, 5724, 5783, 5842, 5902, 5962, 6023, 6084, 6145, 6207, 6269, 6332, 6395, 6459, 6523, 6588, 6653, 6719, 6785, 6852, 6919, 6987, 7055, 7124, 7193, 7263, 7333, 7404, 7475, 7547, 7619, 7692, 7765, 7839, 7914, 7989, 8065, 8141, 8218, 8295, 8373, 8451, 8530, 8610, 8690, 8771, 8852, 8934, 9017, 9100, 9184, 9269, 9354, 9440, 9526, 9613, 9701, 9789, 9878, 9968, 10058, 10149, 10241, 10333, 10426, 10520, 10615, 10710, 10806, 10903, 11000, 11098, 11197, 11297, 11397, 11498, 11600, 11703, 11806, 11910, 12015, 12121, 12227, 12334, 12442, 12551, 12661, 12771, 12882, 12994, 13107, 13221, 13336, 13452, 13568, 13685, 13803, 13922, 14042, 14163, 14285, 14408, 14532, 14656, 14781, 14907, 15034, 15162, 15291, 15421, 15552, 15684, 15817, 15951, 16086, 16222, 16359, 16497, 16636, 16776, 16917, 17059, 17202, 17346, 17492, 17639, 17787, 17936, 18086, 18237, 18389, 18542, 18696, 18852, 19009, 19167, 19326, 19486, 19648, 19811, 19975, 20140, 20306, 20474, 20643, 20813, 20984, 21157, 21331, 21506, 21683, 21861, 22040, 22221, 22403, 22586, 22771, 22957, 23144, 23333, 23523, 23715, 23908, 24103, 24299, 24496, 24695, 24895, 25097, 25300, 25505, 25712, 25920, 26130, 26341, 26554, 26768, 26984, 27202, 27421, 27642, 27865, 28089, 28315, 28543, 28772, 29003, 29236, 29470, 29706, 29944, 30184, 30426, 30669, 30914, 31161, 31410, 31661, 31914, 32168, 32424, 32682, 32942, 33204, 33468, 33734, 34002, 34272, 34544, 34818, 35094, 35372, 35652, 35934, 36219, 36506, 36795, 37086, 37379, 37674, 37972, 38272, 38574, 38878, 39185, 39494, 39805, 40119, 40435, 40753, 41074, 41397, 41722, 42050, 42380, 42713, 43048, 43386, 43726, 44069, 44415, 44763, 45114, 45467, 45823, 46182, 46543, 46907, 47274, 47644, 48016, 48391, 48769, 49150, 49534, 49920, 50309, 50701, 51096, 51494, 51895, 52299, 52706, 53116, 53529, 53945, 54364, 54787, 55213, 55642, 56074, 56509, 56948, 57390, 57835, 58284, 58736, 59191, 59650, 60112, 60578, 61047, 61520, 61996, 62476, 62959, 63446, 63937, 64431, 64929, 65431, 65937, 66446, 66959, 67476, 67997, 68522, 69051, 69584, 70121, 70662, 71207, 71756, 72309, 72866, 73427, 73992, 74562, 75136, 75714, 76297, 76884, 77475, 78071, 78671, 79276, 79885, 80499, 81117, 81740, 82368, 83000, 83637, 84279, 84926, 85578, 86235, 86896, 87562];
  1190.  
  1191.     var EvoReq = [];
  1192.  
  1193.     var starting = [];
  1194.     starting.push({affection: 90, money: 36000, kobans: 36, taffection: 90, tmoney: 36000, tkobans: 36});
  1195.     starting.push({affection: 225, money: 90000, kobans: 60, taffection: 315, tmoney: 126000, tkobans: 96});
  1196.     starting.push({affection: 563, money: 225000, kobans: 114, taffection: 878, tmoney: 351000, tkobans: 210});
  1197.     starting.push({affection: 1125, money: 450000, kobans: 180, taffection: 2003, tmoney: 801000, tkobans: 390});
  1198.     starting.push({affection: 2250, money: 900000, kobans: 300, taffection: 4253, tmoney: 1701000, tkobans: 690});
  1199.     EvoReq.starting = starting;
  1200.  
  1201.     var commonGirls = [];
  1202.     commonGirls.push({affection: 180, money: 72000, kobans: 72, taffection: 180, tmoney: 72000, tkobans: 72});
  1203.     commonGirls.push({affection: 450, money: 180000, kobans: 120, taffection: 630, tmoney: 252000, tkobans: 192});
  1204.     commonGirls.push({affection: 1125, money: 450000, kobans: 228, taffection: 1755, tmoney: 702000, tkobans: 420});
  1205.     commonGirls.push({affection: 2250, money: 900000, kobans: 360, taffection: 4005, tmoney: 1602000, tkobans: 780});
  1206.     commonGirls.push({affection: 4500, money: 1800000, kobans: 600, taffection: 8505, tmoney: 3402000, tkobans: 1380});
  1207.     EvoReq.common = commonGirls;
  1208.  
  1209.     var rareGirls = [];
  1210.     rareGirls.push({affection: 540, money: 216000, kobans: 216, taffection: 540, tmoney: 216000, tkobans: 216});
  1211.     rareGirls.push({affection: 1350, money: 540000, kobans: 360, taffection: 1890, tmoney: 756000, tkobans: 576});
  1212.     rareGirls.push({affection: 3375, money: 1350000, kobans: 678, taffection: 5265, tmoney: 2106000, tkobans: 1254});
  1213.     rareGirls.push({affection: 6750, money: 2700000, kobans: 1080, taffection: 12015, tmoney: 4806000, tkobans: 2334});
  1214.     rareGirls.push({affection: 13500, money: 5400000, kobans: 1800, taffection: 25515, tmoney: 10206000, tkobans: 4134});
  1215.     EvoReq.rare = rareGirls;
  1216.  
  1217.     var epicGirls = [];
  1218.     epicGirls.push({affection: 1260, money: 504000, kobans: 504, taffection: 1260, tmoney: 504000, tkobans: 504});
  1219.     epicGirls.push({affection: 3150, money: 1260000, kobans: 840, taffection: 4410, tmoney: 1764000, tkobans: 1344});
  1220.     epicGirls.push({affection: 7875, money: 3150000, kobans: 1578, taffection: 12285, tmoney: 4914000, tkobans: 2922});
  1221.     epicGirls.push({affection: 15750, money: 6300000, kobans: 2520, taffection: 28035, tmoney: 11214000, tkobans: 5442});
  1222.     epicGirls.push({affection: 31500, money: 12600000, kobans: 4200, taffection: 59535, tmoney: 23814000, tkobans: 9642});
  1223.     EvoReq.epic = epicGirls;
  1224.  
  1225.     var legendGirls = [];
  1226.     legendGirls.push({affection: 1800, money: 720000, kobans: 720, taffection: 1800, tmoney: 720000, tkobans: 720});
  1227.     legendGirls.push({affection: 4500, money: 1800000, kobans: 1200, taffection: 6300, tmoney: 2520000, tkobans: 1920});
  1228.     legendGirls.push({affection: 11250, money: 4500000, kobans: 2250, taffection: 17550, tmoney: 7020000, tkobans: 4170});
  1229.     legendGirls.push({affection: 22500, money: 9000000, kobans: 3600, taffection: 40050, tmoney: 16020000, tkobans: 7770});
  1230.     legendGirls.push({affection: 45000, money: 18000000, kobans: 6000, taffection: 85050, tmoney: 34020000, tkobans: 13770});
  1231.     EvoReq.legendary = legendGirls;
  1232.  
  1233.     for (var id in girlsDataList) {
  1234.         var girl = jQuery.extend(true, {}, girlsDataList[id]);
  1235.         if (girl.own) {
  1236.             stats.allCollect += girl.salary;
  1237.             stats.rarities[girl.rarity]++;
  1238.             stats.caracs[girl.class]++;
  1239.             stats.girls++;
  1240.             stats.hourlyMoney += Math.round(girl.salary_per_hour);
  1241.             stats.unlockedScenes += girl.graded;
  1242.             stats.allScenes += parseInt(girl.nb_grades);
  1243.             var nbgrades = parseInt(girl.nb_grades);
  1244.             if (girl.graded != nbgrades) {
  1245.                 stats.affection += EvoReq[girl.rarity][nbgrades - 1].taffection - girl.Affection.cur;
  1246.                 var currentLevelMoney = 0,
  1247.                     currentLevelKobans = 0;
  1248.                 if (girl.graded != 0) {
  1249.                     currentLevelMoney = EvoReq[girl.rarity][girl.graded - 1].tmoney;
  1250.                     currentLevelKobans = EvoReq[girl.rarity][girl.graded - 1].tkobans;
  1251.                 }
  1252.                 stats.money += EvoReq[girl.rarity][nbgrades - 1].tmoney - currentLevelMoney;
  1253.                 if (hh_nutaku) {
  1254.                     stats.kobans += Math.ceil((EvoReq[girl.rarity][nbgrades - 1].tkobans - currentLevelKobans) / 6);
  1255.                 }
  1256.                 else {
  1257.                     stats.kobans += EvoReq[girl.rarity][nbgrades - 1].tkobans - currentLevelKobans;
  1258.                 }
  1259.             }
  1260.  
  1261.             var expToMax = (GIRLS_EXP_LEVELS[girl.rarity][Hero.infos.level - 2] - girl.Xp.cur);
  1262.             if (expToMax < 0) expToMax = 0;
  1263.             stats.xp += expToMax;
  1264.         }
  1265.     }
  1266.  
  1267.     try {
  1268.         var lsMarket = JSON.parse(localStorage.getItem('lsMarket')),
  1269.             d = new Date(lsMarket.restock.time),
  1270.             RestockInfo;
  1271.  
  1272.         if (new Date() > lsMarket.restock.time || Hero.infos.level > lsMarket.restock.herolvl) {
  1273.  
  1274.             RestockInfo = '> The <a href="../shop.html">Market</a> restocked since your last visit.';
  1275.         }
  1276.         else {
  1277.             var marketBookTxt = lsMarket.buyable.potion.Nb + ' ' + texts[lang].books + ' (' + nThousand(lsMarket.buyable.potion.Xp) + ' ' + texts[lang].Xp + ')',
  1278.                 marketGiftTxt = lsMarket.buyable.gift.Nb + ' ' + texts[lang].gifts + ' (' + nThousand(lsMarket.buyable.gift.Xp) + ' ' + texts[lang].affection + ')';
  1279.             RestockInfo = '- ' + marketBookTxt + ' = ' + nThousand(lsMarket.buyable.potion.Value) + ' <span class="imgMoney"></span>'
  1280.                 + '<br />- ' + marketGiftTxt + ' = ' + nThousand(lsMarket.buyable.gift.Value) + ' <span class="imgMoney"></span>'
  1281.                 + '<br /><font style="color: gray;">' + texts[lang].restock + ': ' + d.toLocaleString() + ' (' + texts[lang].or_level + ' ' + (Hero.infos.level+1) + ')</font>';
  1282.         }
  1283.  
  1284.         var myArmorTxt = nThousand(lsMarket.stocks.armor.Nb) + (lsMarket.stocks.armor.Nb > 99 ? '+ ' : ' ') + ' ' + texts[lang].equipments,
  1285.             myBoosterTxt = nThousand(lsMarket.stocks.booster.Nb) + ' ' + texts[lang].boosters,
  1286.             myBookTxt = nThousand(lsMarket.stocks.potion.Nb) + ' ' + texts[lang].books + ' (' + nThousand(lsMarket.stocks.potion.Xp) + ' ' + texts[lang].Xp + ')',
  1287.             myGiftTxt = nThousand(lsMarket.stocks.gift.Nb) + ' ' + texts[lang].gifts + ' (' + nThousand(lsMarket.stocks.gift.Xp) + ' ' + texts[lang].affection + ')',
  1288.             MarketStocks = '- ' + myArmorTxt + ', ' + myBoosterTxt
  1289.         + '<br />- ' + myBookTxt
  1290.         + '<br />- ' + myGiftTxt
  1291.         + '<span class="subTitle">' + texts[lang].currently_buyable + ':</span>'
  1292.         + RestockInfo;
  1293.     } catch(e) {
  1294.         MarketStocks = (lsAvailable == 'yes') ? '> ' + texts[lang].visit_the : '> ' + texts[lang].not_compatible;
  1295.     }
  1296.  
  1297.     var StatsString = '<div class="StatsContent"><span class="Title">' + texts[lang].harem_stats + ':</span>' +
  1298.         '<span class="subTitle" style="margin-top: -10px;">' + stats.girls + ' ' + texts[lang].haremettes + ':</span>' +
  1299.         '- ' + stats.caracs[1] + ' ' + texts[lang].hardcore + ', ' + stats.caracs[2] + ' ' + texts[lang].charm + ', ' + stats.caracs[3] + ' ' + texts[lang].know_how + '<br />- '
  1300.     + (stats.rarities.starting + stats.rarities.common) + ' ' + texts[lang].common + ', ' + stats.rarities.rare + ' ' + texts[lang].rare + ', ' + stats.rarities.epic + ' ' + texts[lang].epic + ', ' + stats.rarities.legendary + ' ' + texts[lang].legendary + ' <br />- '
  1301.     + document.getElementsByClassName('focus_text')[0].innerHTML + '/' + nThousand(Hero.infos.level * stats.girls) + ' harem level (' + nThousand(Hero.infos.level * stats.girls - document.getElementsByClassName('focus_text')[0].innerHTML.replace(/,/g, '')) + ' to go)<br />- '
  1302.     + stats.unlockedScenes + '/' + stats.allScenes + ' ' + texts[lang].unlocked_scenes + ' (' + nThousand(stats.allScenes - stats.unlockedScenes) + ' to go)'
  1303.     + '<span class="subTitle">' + texts[lang].money_incomes + ':</span>'
  1304.     + '~' + nThousand(stats.hourlyMoney) + ' <span class="imgMoney"></span> ' + texts[lang].per_hour
  1305.     + '<br />' + nThousand(stats.allCollect) + ' <span class="imgMoney"></span> ' + texts[lang].when_all_collectable
  1306.     + '<span class="subTitle">' + texts[lang].required_to_unlock + ':</span>'
  1307.     + addPriceRow('', stats.affection, stats.money, stats.kobans)
  1308.     + '<span class="subTitle">' + texts[lang].required_to_get_max_level + ':</span>'
  1309.     + nThousand(stats.xp) + ' ' + texts[lang].Xp + ' (' + nThousand(stats.xp * 200) + ' <span class="imgMoney"></span>) <br />'
  1310.     + '<span class="subTitle">' + texts[lang].my_stocks + ':</span>'
  1311.     + MarketStocks
  1312.     + '</div>';
  1313.  
  1314.     $('#harem_left').append('<div id="CustomBar">'
  1315.                             + '<img f="stats" src="https://i.imgur.com/DwsBavN.png">'
  1316.                             + '</div>'
  1317.                             + '<div id="TabsContainer">' + StatsString + '</div>');
  1318.  
  1319.     var TabsContainer = $('#TabsContainer');
  1320.     var Stats = TabsContainer.children('.StatsContent');
  1321.  
  1322.     $('body').click(function(e) {
  1323.         var clickOn = e.target.getAttribute('f');
  1324.         switch (clickOn) {
  1325.             case 'stats':
  1326.                 toggleTabs(Stats);
  1327.                 break;
  1328.             default:
  1329.                 var clickedContainer = $(e.target).closest('[id]').attr('id');
  1330.                 if (clickedContainer == 'TabsContainer') return;
  1331.                 TabsContainer.fadeOut(400);
  1332.         }
  1333.     });
  1334.  
  1335.     function toggleTabs(tabIn) {
  1336.         if (TabsContainer.css('display') == 'block') {
  1337.             setTimeout(function() { tabIn.fadeIn(300); }, 205);
  1338.             TabsContainer.fadeOut(400);
  1339.         }
  1340.         else {
  1341.             tabIn.toggle(true);
  1342.             TabsContainer.fadeIn(400);
  1343.         }
  1344.     }
  1345.  
  1346.     function addPriceRow(rowName, affection, money, kobans) {
  1347.         return '<b>' + rowName + '</b> ' +
  1348.             nThousand(affection) + ' ' + texts[lang].affection + ' (' + nThousand(affection * 417) + ' <span class="imgMoney"></span>) and <br />' +
  1349.             nThousand(money) + ' <span class="imgMoney"></span> ' + texts[lang].or + ' ' +
  1350.             nThousand(kobans) + ' <span class="imgKobans"></span><br />';
  1351.     }
  1352.  
  1353.     function addPriceRowGirl(rowName, affection, money, kobans) {
  1354.         return '<b>' + rowName + ':</b> ' +
  1355.             nThousand(affection) + ' ' + texts[lang].affection + ' (' + nThousand(affection * 417) + ' <span class="imgMoney"></span>) and ' +
  1356.             nThousand(money) + ' <span class="imgMoney"></span> ' + texts[lang].or + ' ' +
  1357.             nThousand(kobans) + ' <span class="imgKobans"></span><br />';
  1358.     }
  1359.  
  1360.     $('.girls_list div[id_girl]').click(function() {
  1361.         updateInfo();
  1362.     });
  1363.  
  1364.     updateInfo();
  1365.  
  1366.     function updateInfo() {
  1367.         setTimeout(function () {
  1368.             haremRight.children('[girl]').each(function() {
  1369.                 var girl = girlsDataList[$(this).attr('girl')];
  1370.  
  1371.                 if (!girl.own) {
  1372.                     if (HH_UNIVERSE == 'gay') {
  1373.                         $(this).find('p').after('<div class="WikiLinkDialogbox"><a href="https://harem-battle.club/wiki/Gay-Harem/GH:' + girl.Name + '" target="_blank"> ' + girl.Name + texts[lang].wiki + ' </a></div>');
  1374.                     }
  1375.                     else if (lang == 'fr') {
  1376.                         $(this).find('p').after('<div class="WikiLinkDialogbox"><a href="http://hentaiheroes.wikidot.com/' + girl.Name + '" target="_blank"> ' + texts[lang].wiki + girl.Name + ' </a></div>');
  1377.                     }
  1378.                     else {
  1379.                         $(this).find('p').after('<div class="WikiLinkDialogbox"><a href="https://harem-battle.club/wiki/Harem-Heroes/HH:' + girl.Name + '" target="_blank"> ' + girl.Name + texts[lang].wiki + ' </a></div>');
  1380.                     }
  1381.                 }
  1382.                 if (girl.own) {
  1383.                     if (HH_UNIVERSE == 'gay') {
  1384.                         $(this).find('h3').after('<div class="WikiLink"><a href="https://harem-battle.club/wiki/Gay-Harem/GH:' + girl.Name + '" target="_blank"> ' + girl.Name + texts[lang].wiki + ' </a></div>');
  1385.                     }
  1386.                     else if (lang == 'fr') {
  1387.                         $(this).find('h3').after('<div class="WikiLink"><a href="http://hentaiheroes.wikidot.com/' + girl.Name + '" target="_blank"> ' + texts[lang].wiki + girl.Name + ' </a></div>');
  1388.                     }
  1389.                     else {
  1390.                         $(this).find('h3').after('<div class="WikiLink"><a href="https://harem-battle.club/wiki/Harem-Heroes/HH:' + girl.Name + '" target="_blank"> ' + girl.Name + texts[lang].wiki + ' </a></div>');
  1391.                     }
  1392.                 }
  1393.                 var j = 0,
  1394.                     FirstLockedScene = 1,
  1395.                     AffectionTT = texts[lang].evolution_costs + ':<br />',
  1396.                     ScenesLink = '',
  1397.                     girl_quests = $(this).find('.girl_quests');
  1398.                 girl_quests.find('g').each(function() {
  1399.  
  1400.                     j++;
  1401.                     var aff = 0,
  1402.                         money = 0,
  1403.                         kobans = 0;
  1404.                     var currentLevelMoney = 0,
  1405.                         currentLevelKobans = 0;
  1406.                     if (girl.graded != 0) {
  1407.                         currentLevelMoney = EvoReq[girl.rarity][girl.graded - 1].tmoney;
  1408.                         currentLevelKobans = EvoReq[girl.rarity][girl.graded - 1].tkobans;
  1409.                     }
  1410.                     if (girl.graded >= j) {
  1411.                     }
  1412.                     else if ((girl.graded + 1) == j && girl.Affection.level == j) {
  1413.                         money = EvoReq[girl.rarity][j - 1].tmoney - currentLevelMoney;
  1414.                         if (hh_nutaku) {
  1415.                             kobans = Math.ceil((EvoReq[girl.rarity][j - 1].tkobans - currentLevelKobans) / 6);
  1416.                         }
  1417.                         else {
  1418.                             kobans = EvoReq[girl.rarity][j - 1].tkobans - currentLevelKobans;
  1419.                         }
  1420.                     }
  1421.                     else {
  1422.                         aff = EvoReq[girl.rarity][j - 1].taffection - girl.Affection.cur;
  1423.                         money = EvoReq[girl.rarity][j - 1].tmoney - currentLevelMoney;
  1424.                         if (hh_nutaku) {
  1425.                             kobans = Math.ceil((EvoReq[girl.rarity][j - 1].tkobans - currentLevelKobans) / 6);
  1426.                         }
  1427.                         else {
  1428.                             kobans = EvoReq[girl.rarity][j - 1].tkobans - currentLevelKobans;
  1429.                         }
  1430.                     }
  1431.                     AffectionTT += addPriceRowGirl(j + '</b><span class="imgStar"></span>', aff, money, kobans);
  1432.                     ScenesLink += (ScenesLink === '') ? 'hh_scenes=' : ',';
  1433.                     var SceneHref = $(this).parent().attr('href');
  1434.                     if ($(this).hasClass('grey') || $(this).hasClass('green')) {
  1435.                         if (FirstLockedScene === 0) {
  1436.                             ScenesLink += '0';
  1437.                         }
  1438.                         else {
  1439.                             FirstLockedScene = 0;
  1440.                             var XpLeft = girl_quests.parent().parent().children('.girl_exp_left');
  1441.                             var isUpgradable = girl_quests.parent().children('.green_text_button');
  1442.                             ScenesLink += (isUpgradable.length) ? '0.' + isUpgradable.attr('href').substr(7) : '0';
  1443.                         }
  1444.                     }
  1445.                     else {
  1446.                         var attrHref = $(this).parent().attr('href');
  1447.                         if (typeof attrHref != 'undefined') {
  1448.                             ScenesLink += attrHref.substr(7);
  1449.                         }
  1450.                     }
  1451.                 });
  1452.  
  1453.                 girl_quests.children('a').each(function() {
  1454.                     var attr = $(this).attr('href');
  1455.                     if (typeof attr !== typeof undefined && attr !== false) {
  1456.                         $(this).attr('href', attr + '?' + ScenesLink);
  1457.                     }
  1458.                 });
  1459.                 ScenesLink = '';
  1460.  
  1461.                 girl_quests.parent().children('h4').prepend('<span class="CustomTT"></span><div class="AffectionTooltip">' + AffectionTT + '</div>');
  1462.  
  1463.             });
  1464.         }, 50);
  1465.     }
  1466.  
  1467.     //CSS
  1468.     sheet.insertRule('#harem_left .HaremetteNb {'
  1469.         + 'float: right; '
  1470.         + 'line-height: 14px; '
  1471.         + 'font-size: 12px;}'
  1472.     );
  1473.  
  1474.     sheet.insertRule('#CustomBar {'
  1475.         + 'z-index: 99; '
  1476.         + 'width: 100%; '
  1477.         + 'padding: 3px 10px 0 3px; '
  1478.         + 'font: bold 10px Tahoma, Helvetica, Arial, sans-serif; '
  1479.         + 'position: absolute; bottom: 3px; left: 0px;}'
  1480.     );
  1481.  
  1482.     sheet.insertRule('#CustomBar img {'
  1483.         + 'width: 20px; '
  1484.         + 'height: 20px; '
  1485.         + 'margin-right: 3px; '
  1486.         + 'margin-bottom: 3px; '
  1487.         + 'opacity: 0.5;}'
  1488.     );
  1489.  
  1490.     sheet.insertRule('#CustomBar img:hover {'
  1491.         + 'opacity: 1; '
  1492.         + 'cursor: pointer;}'
  1493.     );
  1494.  
  1495.     sheet.insertRule('#CustomBar .TopBottomLinks {'
  1496.         + 'float: right; '
  1497.         + 'margin-top: 2px;}'
  1498.     );
  1499.  
  1500.     sheet.insertRule('#CustomBar a, #TabsContainer a {'
  1501.         + 'color: #008; '
  1502.         + 'text-decoration: none;}'
  1503.     );
  1504.  
  1505.     sheet.insertRule('#harem_whole .WikiLink a {'
  1506.         + 'color: #87CEFA; '
  1507.         + 'text-decoration: none;}'
  1508.     );
  1509.  
  1510.     sheet.insertRule('#CustomBar a:hover, #TabsContainer a:hover, #harem_right .WikiLink a:hover {'
  1511.         + 'color: #B14; '
  1512.         + 'text-decoration: underline;}'
  1513.     );
  1514.  
  1515.     sheet.insertRule('#TabsContainer {'
  1516.         + 'z-index: 99; '
  1517.         + 'position: absolute; '
  1518.         + 'bottom: 30px; '
  1519.         + 'left: 12px; '
  1520.         + 'box-sizing: content-box; '
  1521.         + 'border: 1px solid rgb(156, 182, 213); '
  1522.         + 'box-shadow: 1px -1px 1px 0px rgba(0,0,0,0.3); '
  1523.         + 'font: normal 10px/16px Tahoma, Helvetica, Arial, sans-serif; '
  1524.         + 'color: #000000; '
  1525.         + 'background-color: #ffffff; '
  1526.         + 'display: none;}'
  1527.     );
  1528.  
  1529.     sheet.insertRule('#TabsContainer > div {'
  1530.         + 'padding: 1px 0 8px 10px;}'
  1531.     );
  1532.  
  1533.     sheet.insertRule('#TabsContainer .Title {'
  1534.         + 'margin-left: -5px; '
  1535.         + 'font: bold 12px/22px Tahoma, Helvetica, Arial, sans-serif; '
  1536.         + 'color: #B14;}'
  1537.     );
  1538.  
  1539.     sheet.insertRule('#TabsContainer .subTitle {'
  1540.         + 'padding-top: 10px; '
  1541.         + 'font-weight: bold; '
  1542.         + 'display: block;}'
  1543.     );
  1544.  
  1545.     sheet.insertRule('#TabsContainer img {'
  1546.         + 'width: 14px; '
  1547.         + 'height: 14px; '
  1548.         + 'vertical-align: text-bottom;}'
  1549.     );
  1550.  
  1551.     sheet.insertRule('.StatsContent, #TabsContainer span, #TabsContainer img, #TabsContainer a, #TabsContainer b, #TabsContainer br {'
  1552.         + 'box-sizing: content-box;}'
  1553.     );
  1554.  
  1555.     sheet.insertRule('#harem_whole .CustomTT {'
  1556.         + 'float: right; '
  1557.         + 'margin-left: -25px; '
  1558.         + 'background-image: url("https://i.imgur.com/7nhmtbM.png"); '
  1559.         + 'background-size: 18px 18px; '
  1560.         + 'width: 18px; '
  1561.         + 'height: 18px; '
  1562.         + 'visibility: none;}'
  1563.     );
  1564.  
  1565.     sheet.insertRule('#harem_whole .CustomTT:hover {'
  1566.         + 'cursor: help;}'
  1567.     );
  1568.  
  1569.     sheet.insertRule('#harem_whole .CustomTT:hover + div {'
  1570.         + 'opacity: 1; '
  1571.         + 'visibility: visible;}'
  1572.     );
  1573.  
  1574.     sheet.insertRule('#harem_whole .AffectionTooltip {'
  1575.         + 'position: absolute; '
  1576.         + 'z-index: 99; '
  1577.         + 'margin: 20px 0 0 0; '
  1578.         + 'width: 320px; '
  1579.         + 'display: block; overflow: auto; '
  1580.         + 'border: 1px solid rgb(162, 195, 215); '
  1581.         + 'border-radius: 8px; '
  1582.         + 'box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.1); '
  1583.         + 'padding: 3px 7px 4px 7px; '
  1584.         + 'background-color: #F2F2F2; '
  1585.         + 'color: #1E90FF; '
  1586.         + 'font: normal 10px/17px Tahoma, Helvetica, Arial, sans-serif; '
  1587.         + 'text-align: left; '
  1588.         + 'text-shadow: none; '
  1589.         + 'opacity: 0; '
  1590.         + 'visibility: hidden; '
  1591.         + 'transition: opacity 400ms, visibility 400ms;}'
  1592.     );
  1593.  
  1594.     sheet.insertRule('#collect_all_container {'
  1595.         + 'margin-top: 0px !important;}'
  1596.     );
  1597.  
  1598.     sheet.insertRule('#harem_whole .AffectionTooltip b {'
  1599.         + 'font-weight: bold;}'
  1600.     );
  1601.  
  1602.     sheet.insertRule('#harem_whole .WikiLink {'
  1603.         + 'font-size: 12px;}'
  1604.     );
  1605.  
  1606.     sheet.insertRule('#harem_whole .WikiLinkDialogbox a {'
  1607.         + 'text-decoration: none; '
  1608.         + 'color: #24a0ff !important;}'
  1609.     );
  1610.  
  1611.     sheet.insertRule('#harem_whole .imgStar, #harem_whole .imgMoney, #harem_whole .imgKobans, #haremwhole .imgStar, #harem_whole .imgMoney, #harem_whole .imgKobans {'
  1612.         + 'background-size: 10px 10px; '
  1613.         + 'background-repeat: no-repeat; '
  1614.         + 'width: 10px; '
  1615.         + 'height: 14px; '
  1616.         + 'display: inline-block;}'
  1617.     );
  1618.  
  1619.     sheet.insertRule('#harem_whole .imgStar, #harem_left .imgStar {'
  1620.         + 'background-image: url("https://i.imgur.com/gcHRutY.png");}'
  1621.     );
  1622.  
  1623.     sheet.insertRule('#harem_whole .imgMoney, #harem_left .imgMoney {'
  1624.         + 'background-image: url("https://i.imgur.com/hnnHBux.png");}'
  1625.     );
  1626.  
  1627.     sheet.insertRule('#harem_whole .imgKobans, #harem_left .imgKobans {'
  1628.         + 'background-image: url("https://i.imgur.com/sXeZTZL.png");}'
  1629.     );
  1630. }
  1631.  
  1632. /* ====================
  1633.     LEAGUE INFORMATION
  1634.    ==================== */
  1635.  
  1636. function moduleLeague() {
  1637.     var seasonEnds;
  1638.     var challengesLeft;
  1639.     var challengesTotal;
  1640.     var challengesPossibleParse;
  1641.     var challengesPossibleMinutes;
  1642.     var challengesPossible;
  1643.     var playerCurrentParse;
  1644.     var playerCurrentPos;
  1645.     var playerCurrentPoints;
  1646.     var maxDemoteParse;
  1647.     var maxDemotePoints;
  1648.     var maxDemoteDiff;
  1649.     var maxDemoteDisplay;
  1650.     var maxStagnateParse;
  1651.     var maxStagnatePoints;
  1652.     var maxStagnateDiff;
  1653.     var maxStagnateDisplay;
  1654.     var leagueRefillCost;
  1655.     var leagueFifteenCost;
  1656.     var leagueHighestPossible;
  1657.     var leagueKobans;
  1658.     var leagueWinnings;
  1659.  
  1660.     challengesPossibleParse = $('div.bar-wrap div.over span:nth-child(3) span[rel=count]').text();
  1661.     if (challengesPossibleParse == '') {
  1662.         challengesPossibleMinutes = 0;
  1663.     }
  1664.     else if (challengesPossibleParse.indexOf('s') > -1) {
  1665.         if (challengesPossibleParse.indexOf('m') > -1) {
  1666.             challengesPossibleMinutes = 33;
  1667.         }
  1668.         else {
  1669.             challengesPossibleMinutes = 34;
  1670.         }
  1671.     }
  1672.     else {
  1673.         challengesPossibleMinutes = 34 - parseInt(challengesPossibleParse.match(/[+-]?\d+(?:\.\d+)?/g));
  1674.     }
  1675.  
  1676.     seasonEnds = $('div.league_end_in span[rel=timer]').text();
  1677.     if (seasonEnds.indexOf(texts[lang].day) > -1) {
  1678.         challengesPossibleMinutes += seasonEnds.match(/[+-]?\d+(?:\.\d+)?/g)[0] * 1440;
  1679.         if (seasonEnds.indexOf(texts[lang].hour) > -1) {
  1680.             challengesPossibleMinutes += seasonEnds.match(/[+-]?\d+(?:\.\d+)?/g)[1] * 60;
  1681.             if (seasonEnds.indexOf(texts[lang].minute) > -1) {
  1682.                 challengesPossibleMinutes += seasonEnds.match(/[+-]?\d+(?:\.\d+)?/g)[2] * 1;
  1683.             }
  1684.         }
  1685.         else {
  1686.             if (seasonEnds.indexOf(texts[lang].minute) > -1) {
  1687.                 challengesPossibleMinutes += seasonEnds.match(/[+-]?\d+(?:\.\d+)?/g)[1] * 1;
  1688.             }
  1689.         }
  1690.     }
  1691.     else if (seasonEnds.indexOf(texts[lang].day) === -1 && seasonEnds.indexOf(texts[lang].hour) > -1) {
  1692.         challengesPossibleMinutes += seasonEnds.match(/[+-]?\d+(?:\.\d+)?/g)[0] * 60;
  1693.         if (seasonEnds.indexOf(texts[lang].minute) > -1) {
  1694.             challengesPossibleMinutes += seasonEnds.match(/[+-]?\d+(?:\.\d+)?/g)[1] * 1;
  1695.         }
  1696.     }
  1697.     else {
  1698.         if (seasonEnds.indexOf(texts[lang].minute) > -1) {
  1699.             challengesPossibleMinutes += seasonEnds.match(/[+-]?\d+(?:\.\d+)?/g)[0] * 1;
  1700.         }
  1701.     }
  1702.  
  1703.     challengesLeft = 3 * ((' ' + $('div.leagues_table table tbody.leadTable').text() + ' ').split('0/').length - 1) + 2 * ((' ' + $('div.leagues_table table tbody.leadTable').text() + ' ').split('1/').length - 1) + ((' ' + $('div.leagues_table table tbody.leadTable').text() + ' ').split('2/').length - 1);
  1704.     challengesTotal = 3 * ((' ' + $('div.leagues_table table tbody.leadTable').text() + ' ').split('/3').length - 1);
  1705.     challengesPossible = Math.floor(challengesPossibleMinutes/35) + parseInt($('div.bar-wrap div.over span[energy]').text());
  1706.  
  1707.     playerCurrentParse = $('div.leagues_table table tr td:nth-child(4):contains(-)').parent().text().replace(/,/g,'').match(/[+-]?\d+(?:\.\d+)?/g);
  1708.     playerCurrentPos = parseInt(playerCurrentParse[0]);
  1709.     playerCurrentPoints = parseInt(playerCurrentParse[playerCurrentParse.length - 1]);
  1710.  
  1711.     maxDemoteParse = $('div.leagues_table table tr td:nth-child(1):contains(' + (challengesTotal / 3 - 14) + ')').parent().text().replace(/,/g,'').match(/[+-]?\d+(?:\.\d+)?/g);
  1712.     maxDemotePoints = parseInt(maxDemoteParse[maxDemoteParse.length - 1]);
  1713.     maxDemoteDiff = maxDemotePoints - playerCurrentPoints;
  1714.     if (maxDemoteDiff > 0) {
  1715.         maxDemoteDisplay = '+' + (nThousand(maxDemoteDiff));
  1716.     }
  1717.     else {
  1718.         maxDemoteDisplay = nThousand(maxDemoteDiff);
  1719.     }
  1720.  
  1721.     maxStagnateParse = $('div.leagues_table table tr td:nth-child(1) span').filter(function(){return $(this).text() === '15';}).parent().parent().text().replace(/,/g,'').match(/[+-]?\d+(?:\.\d+)?/g);
  1722.     maxStagnatePoints = parseInt(maxStagnateParse[maxStagnateParse.length - 1]);
  1723.     maxStagnateDiff = maxStagnatePoints - playerCurrentPoints;
  1724.     if (maxStagnateDiff > 0) {
  1725.         maxStagnateDisplay = '+' + (nThousand(maxStagnateDiff));
  1726.     }
  1727.     else {
  1728.         maxStagnateDisplay = nThousand(maxStagnateDiff);
  1729.     }
  1730.  
  1731. /* === Disabled until possible rework ===
  1732.  
  1733.     if (hh_nutaku) {
  1734.         leagueRefillCost = Math.ceil((parseInt(challengesLeft) - parseInt($('div.bar-wrap div.over span[energy]').text())) * 2.1);
  1735.         if (leagueRefillCost < 0) {
  1736.             leagueRefillCost = 0
  1737.         }
  1738.         leagueFifteenCost = Math.floor(parseInt(challengesLeft) / 15) * 2;
  1739.     }
  1740.     else {
  1741.         leagueRefillCost = Math.ceil((parseInt(challengesLeft) - parseInt($('div.bar-wrap div.over span[energy]').text())) * 12.6);
  1742.         if (leagueRefillCost < 0) {
  1743.             leagueRefillCost = 0
  1744.         }
  1745.         leagueFifteenCost = Math.floor(parseInt(challengesLeft) / 15) * 12;
  1746.     }
  1747.  
  1748.     leagueHighestPossible = playerCurrentPoints + parseInt(challengesLeft * 3);
  1749.     if (challengesLeft == 0) {
  1750.         if (playerCurrentPos <= 75) {
  1751.             leagueKobans = league_rewards[league_tag][75].hc;
  1752.         }
  1753.         if (playerCurrentPos <= 60) {
  1754.             leagueKobans = league_rewards[league_tag][60].hc;
  1755.         }
  1756.         if (playerCurrentPos <= 45) {
  1757.             leagueKobans = league_rewards[league_tag][45].hc;
  1758.         }
  1759.         if (playerCurrentPos <= 30) {
  1760.             leagueKobans = league_rewards[league_tag][30].hc;
  1761.         }
  1762.         if (playerCurrentPos <= 15) {
  1763.             leagueKobans = league_rewards[league_tag][15].hc;
  1764.         }
  1765.         if (playerCurrentPos <= 4) {
  1766.             leagueKobans = league_rewards[league_tag][4].hc;
  1767.         }
  1768.         if (playerCurrentPos <= 1) {
  1769.             leagueKobans = league_rewards[league_tag][1].hc;
  1770.         }
  1771.     }
  1772.     else {
  1773.         if (leagueHighestPossible > parseInt($('div.leagues_table table tr td:nth-child(1) span').filter(function(){return $(this).text() === '75';}).parent().parent().text().replace(/\s\s+/g, ' ').split(' ').reverse()[1].replace(/\D/g,''))) {
  1774.             leagueKobans = league_rewards[league_tag][75].hc;
  1775.         }
  1776.         if (leagueHighestPossible > parseInt($('div.leagues_table table tr td:nth-child(1) span').filter(function(){return $(this).text() === '60';}).parent().parent().text().replace(/\s\s+/g, ' ').split(' ').reverse()[1].replace(/\D/g,''))) {
  1777.             leagueKobans = league_rewards[league_tag][60].hc;
  1778.         }
  1779.         if (leagueHighestPossible > parseInt($('div.leagues_table table tr td:nth-child(1) span').filter(function(){return $(this).text() === '45';}).parent().parent().text().replace(/\s\s+/g, ' ').split(' ').reverse()[1].replace(/\D/g,''))) {
  1780.             leagueKobans = league_rewards[league_tag][45].hc;
  1781.         }
  1782.         if (leagueHighestPossible > parseInt($('div.leagues_table table tr td:nth-child(1) span').filter(function(){return $(this).text() === '30';}).parent().parent().text().replace(/\s\s+/g, ' ').split(' ').reverse()[1].replace(/\D/g,''))) {
  1783.             leagueKobans = league_rewards[league_tag][30].hc;
  1784.         }
  1785.         if (leagueHighestPossible > parseInt($('div.leagues_table table tr td:nth-child(1) span').filter(function(){return $(this).text() === '15';}).parent().parent().text().replace(/\s\s+/g, ' ').split(' ').reverse()[1].replace(/\D/g,''))) {
  1786.             leagueKobans = league_rewards[league_tag][15].hc;
  1787.         }
  1788.         if (leagueHighestPossible > parseInt($('div.leagues_table table tr td:nth-child(1) span').filter(function(){return $(this).text() === '4';}).parent().parent().text().replace(/\s\s+/g, ' ').split(' ').reverse()[1].replace(/\D/g,''))) {
  1789.             leagueKobans = league_rewards[league_tag][4].hc;
  1790.         }
  1791.         if (leagueHighestPossible > parseInt($('div.leagues_table table tr td:nth-child(1) span').filter(function(){return $(this).text() === '1';}).parent().parent().text().replace(/\s\s+/g, ' ').split(' ').reverse()[1].replace(/\D/g,''))) {
  1792.             leagueKobans = league_rewards[league_tag][1].hc;
  1793.         }
  1794.     }
  1795.  
  1796.     if (leagueKobans - leagueRefillCost > 0) {
  1797.         leagueWinnings = '+' + nThousand(leagueKobans - leagueRefillCost);
  1798.     }
  1799.     else {
  1800.         leagueWinnings = nThousand(leagueKobans - leagueRefillCost);
  1801.     }
  1802.  
  1803. */
  1804.  
  1805.     if (league_tag == 9) {
  1806.         $('div.league_end_in').append('<span class="scriptLeagueInfo">'
  1807. //      + '<span class="kobanWinnings"><img src="https://i.imgur.com/sXeZTZL.png" height="12" style="margin-bottom: 2px;"> " + leagueWinnings
  1808. //      + '<span class="scriptLeagueInfoTooltip kobanWinningsTooltip">Refill costs: " + nThousand(leagueRefillCost) + ' (+' + leagueFifteenCost + ')<br />Highest reward: ' + nThousand(leagueKobans) + '</span></span>'
  1809.         + '<span class="possibleChallenges"><img src="https://i.imgur.com/Rjo3f7p.png" style="margin-left: 10px; margin-bottom: 2px;"> ' + challengesPossible + '/' + challengesLeft
  1810.         + '<span class="scriptLeagueInfoTooltip possibleChallengesTooltip">' + texts[lang].challenges_regen + challengesPossible + texts[lang].challenges_left + challengesLeft + '</span></span>'
  1811.         + '<span class="maxDemote"><img src="https://i.imgur.com/poOOrLC.png" style="margin-left: 10px; margin-bottom: 2px;"> ' + maxDemoteDisplay
  1812.         + '<span class="scriptLeagueInfoTooltip maxDemoteTooltip">' + texts[lang].demote + nThousand(maxDemotePoints) + ' ' + texts[lang].points + '.</span></span>'
  1813.         + '</span>');
  1814.     }
  1815.     else {
  1816.         $('div.league_end_in').append('<span class="scriptLeagueInfo">'
  1817. //      + '<span class="kobanWinnings"><img src="https://i.imgur.com/sXeZTZL.png" height="12" style="margin-bottom: 2px;"> ' + leagueWinnings
  1818. //      + '<span class="scriptLeagueInfoTooltip kobanWinningsTooltip">Refill costs: ' + nThousand(leagueRefillCost) + ' (+' + leagueFifteenCost + ')<br />Highest reward: ' + nThousand(leagueKobans) + '</span></span>'
  1819.         + '<span class="possibleChallenges"><img src="https://i.imgur.com/Rjo3f7p.png" style="margin-left: 10px; margin-bottom: 2px;"> ' + challengesPossible + '/' + challengesLeft
  1820.         + '<span class="scriptLeagueInfoTooltip possibleChallengesTooltip">' + texts[lang].challenges_regen + challengesPossible + texts[lang].challenges_left + challengesLeft + '</span></span>'
  1821.         + '<span class="maxStagnate"><img src="https://i.imgur.com/rubGfwc.png" style="margin-left: 10px; margin-bottom: 2px;"> ' + maxStagnateDisplay
  1822.         + '<span class="scriptLeagueInfoTooltip maxStagnateTooltip">' + texts[lang].promote + nThousand(maxStagnatePoints) + ' ' + texts[lang].points + '.</span></span>'
  1823.         + '<span class="maxDemote"><img src="https://i.imgur.com/poOOrLC.png" style="margin-left: 10px; margin-bottom: 2px;"> ' + maxDemoteDisplay
  1824.         + '<span class="scriptLeagueInfoTooltip maxDemoteTooltip">' + texts[lang].demote + nThousand(maxDemotePoints) + ' ' + texts[lang].points + '.</span></span>'
  1825.         + '</span>');
  1826.     }
  1827.  
  1828.     //CSS
  1829.     sheet.insertRule('.scriptLeagueInfo {'
  1830.         + 'font-size: 13px; '
  1831.         + 'display: block; '
  1832.         + 'float: right; '
  1833.         + 'margin-right: 10px;}'
  1834.     );
  1835.  
  1836.     sheet.insertRule('.scriptLeagueInfoTooltip {'
  1837.         + 'visibility: hidden; '
  1838.         + 'font-size: 12px; '
  1839.         + 'background-color: black; '
  1840.         + 'color: #fff; '
  1841.         + 'text-align: center; '
  1842.         + 'padding: 3px 5px 3px 5px; '
  1843.         + 'border: 2px solid #905312; '
  1844.         + 'border-radius: 6px; '
  1845.         + 'background-color: rgba(32,3,7,.9); '
  1846.         + 'position: absolute; '
  1847.         + 'margin-top: 5px; '
  1848.         + 'z-index: 9;}'
  1849.     );
  1850.  
  1851.     sheet.insertRule('.scriptLeagueInfoTooltip::after {'
  1852.         + 'content: " "; '
  1853.         + 'position: absolute; '
  1854.         + 'bottom: 100%; '
  1855.         + 'left: 50%; '
  1856.         + 'margin-left: -10px; '
  1857.         + 'border-width: 10px; '
  1858.         + 'border-style: solid; '
  1859.         + 'border-color: transparent transparent #905312 transparent;}'
  1860.     );
  1861.  
  1862.     sheet.insertRule('.kobanWinningsTooltip {'
  1863.         + 'top: 65px; '
  1864.         + 'margin-left: -95px;}'
  1865.     );
  1866.  
  1867.     sheet.insertRule('.kobanWinnings:hover .kobanWinningsTooltip {'
  1868.         + 'visibility: visible;}'
  1869.     );
  1870.  
  1871.     sheet.insertRule('.possibleChallengesTooltip {'
  1872.         + 'top: 65px; '
  1873.         + 'margin-left: -110px;}'
  1874.     );
  1875.  
  1876.     sheet.insertRule('.possibleChallenges:hover .possibleChallengesTooltip {'
  1877.         + 'visibility: visible;}'
  1878.     );
  1879.  
  1880.     sheet.insertRule('.maxStagnateTooltip {'
  1881.         + 'max-width: 190px; '
  1882.         + 'top: 65px; '
  1883.         + 'margin-left: -115px;}'
  1884.     );
  1885.  
  1886.     sheet.insertRule('.maxStagnate:hover .maxStagnateTooltip {'
  1887.         + 'visibility: visible;}'
  1888.     );
  1889.  
  1890.     sheet.insertRule('.maxDemoteTooltip {'
  1891.         + 'max-width: 170px; '
  1892.         + 'top: 65px; '
  1893.         + 'margin-left: -100px;}'
  1894.     );
  1895.  
  1896.     sheet.insertRule('.maxDemote:hover .maxDemoteTooltip {'
  1897.         + 'visibility: visible;}'
  1898.     );
  1899. }
  1900.  
  1901. /* ============
  1902.     LEAGUE SIM
  1903.    ============ */
  1904.  
  1905. function moduleSim() {
  1906.     var playerEgo;
  1907.     var playerEgo2;
  1908.     var playerDefHC;
  1909.     var playerDefKH;
  1910.     var playerDefCH;
  1911.     var playerAtk;
  1912.     var playerExcitement;
  1913.     var playerClass;
  1914.     var opponentEgo;
  1915.     var opponentEgoBase;
  1916.     var opponentDefHC;
  1917.     var opponentDefKH;
  1918.     var opponentDefCH;
  1919.     var opponentAtk;
  1920.     var opponentExcitement;
  1921.     var opponentClass;
  1922.     var totalHarmony;
  1923.     var playerDef;
  1924.     var opponentDef;
  1925.     var opponentDefBase;
  1926.     var playerOrgasm;
  1927.     var playerOrgasmCount;
  1928.     var opponentOrgasm;
  1929.     var opponentOrgasmCount;
  1930.     var girlStat;
  1931.     var girlStat2;
  1932.     var matchRating;
  1933.  
  1934.     function calculatePower() {
  1935.         //Get all the numbers safely
  1936.         playerEgo = parseInt(Hero.infos.caracs.ego);
  1937.         playerDefHC = parseInt(Hero.infos.caracs.def_carac1);
  1938.         playerDefCH = parseInt(Hero.infos.caracs.def_carac2);
  1939.         playerDefKH = parseInt(Hero.infos.caracs.def_carac3);
  1940.         playerAtk = parseInt(Hero.infos.caracs.damage);
  1941.  
  1942.         //Learn how to JSON.parse
  1943.         playerExcitement = ($('div#leagues_left .girls_wrapper div:nth-child(1)').attr('girl-tooltip-data')).match(/[+-]?\d+(?:\.\d+)?/g);
  1944.         playerExcitement = (parseInt(playerExcitement[2]) + parseInt(playerExcitement[4]) + parseInt(playerExcitement[6])) * 28;
  1945.  
  1946.         opponentEgo = parseInt($('div#leagues_right div.lead_ego div:nth-child(2)').text().replace(/[^0-9]/gi, ''));
  1947.         opponentEgoBase = opponentEgo;
  1948.  
  1949.         opponentDefHC = $('div#leagues_right div.stats_wrap div:nth-child(2)').text();
  1950.         if (opponentDefHC.includes('.') || opponentDefHC.includes(',')) {
  1951.             opponentDefHC = parseInt($('div#leagues_right div.stats_wrap div:nth-child(2)').text().replace('K', '00').replace(/[^0-9]/gi, ''));
  1952.         }
  1953.         else {
  1954.             opponentDefHC = parseInt($('div#leagues_right div.stats_wrap div:nth-child(2)').text().replace('K', '000').replace(/[^0-9]/gi, ''));
  1955.         }
  1956.  
  1957.         opponentDefCH = $('div#leagues_right div.stats_wrap div:nth-child(4)').text();
  1958.         if (opponentDefCH.includes('.') || opponentDefCH.includes(',')) {
  1959.             opponentDefCH = parseInt($('div#leagues_right div.stats_wrap div:nth-child(4)').text().replace('K', '00').replace(/[^0-9]/gi, ''));
  1960.         }
  1961.         else {
  1962.             opponentDefCH = parseInt($('div#leagues_right div.stats_wrap div:nth-child(4)').text().replace('K', '000').replace(/[^0-9]/gi, ''));
  1963.         }
  1964.  
  1965.         opponentDefKH = $('div#leagues_right div.stats_wrap div:nth-child(6)').text();
  1966.         if (opponentDefKH.includes('.') || opponentDefKH.includes(',')) {
  1967.             opponentDefKH = parseInt($('div#leagues_right div.stats_wrap div:nth-child(6)').text().replace('K', '00').replace(/[^0-9]/gi, ''));
  1968.         }
  1969.         else {
  1970.             opponentDefKH = parseInt($('div#leagues_right div.stats_wrap div:nth-child(6)').text().replace('K', '000').replace(/[^0-9]/gi, ''));
  1971.         }
  1972.  
  1973.         opponentAtk = $('div#leagues_right div.stats_wrap div:nth-child(8)').text();
  1974.         if (opponentAtk.includes('.') || opponentAtk.includes(',')) {
  1975.             opponentAtk = parseInt($('div#leagues_right div.stats_wrap div:nth-child(8)').text().replace('K', '00').replace(/[^0-9]/gi, ''));
  1976.         }
  1977.         else {
  1978.             opponentAtk = parseInt($('div#leagues_right div.stats_wrap div:nth-child(8)').text().replace('K', '000').replace(/[^0-9]/gi, ''));
  1979.         }
  1980.  
  1981.         opponentExcitement = ($('div#leagues_right .girls_wrapper div:nth-child(1)').attr('girl-tooltip-data')).match(/[+-]?\d+(?:\.\d+)?/g);
  1982.         opponentExcitement = (parseInt(opponentExcitement[1]) + parseInt(opponentExcitement[3]) + parseInt(opponentExcitement[5])) * 28;
  1983.  
  1984.         //Log opponent name
  1985.         console.log('Simulation log for: ' + $('div#leagues_right div.player_block div.title').text());
  1986.  
  1987.         //Determine class defence
  1988.         playerClass = $('div#leagues_left .icon').attr('carac');
  1989.         opponentClass = $('div#leagues_right .icon').attr('carac');
  1990.  
  1991.         if (playerClass == 'class1') {
  1992.             opponentDef = opponentDefHC;
  1993.         }
  1994.         if (playerClass == 'class2') {
  1995.             opponentDef = opponentDefCH;
  1996.         }
  1997.         if (playerClass == 'class3') {
  1998.             opponentDef = opponentDefKH;
  1999.         }
  2000.         opponentDefBase = opponentDef;
  2001.  
  2002.         if (opponentClass == 'class1') {
  2003.             playerDef = playerDefHC;
  2004.         }
  2005.         if (opponentClass == 'class2') {
  2006.             playerDef = playerDefCH;
  2007.         }
  2008.         if (opponentClass == 'class3') {
  2009.             playerDef = playerDefKH;
  2010.         }
  2011.  
  2012.         playerOrgasm = 0;
  2013.         playerOrgasmCount = 0;
  2014.         opponentOrgasm = 0;
  2015.         opponentOrgasmCount = 0;
  2016.         girlStat = 0;
  2017.         girlStat2 = 0;
  2018.  
  2019.         function playerTurn() {
  2020.             //Orgasm
  2021.             if (playerOrgasm >= playerExcitement) {
  2022.                 //Orgasm damage
  2023.                 opponentEgo -= Math.round(playerAtk * 1.5 - opponentDef);
  2024.                 playerOrgasmCount++;
  2025.  
  2026.                 //Log results
  2027.                 console.log('Player orgasm!');
  2028.  
  2029.                 //Orgasm 1
  2030.                 if (playerOrgasmCount == 1) {
  2031.                     //Add Beta stats
  2032.                     girlStat = $('div#leagues_left .girls_wrapper .team_girl[g=2]').attr('girl-tooltip-data');
  2033.                     girlStat = girlStat.substring(girlStat.indexOf('caracs') + 1).match(/[+-]?\d+(?:\.\d+)?/g);
  2034.                     girlStat2 = $('div#leagues_right .girls_wrapper .team_girl[g=2]').attr('girl-tooltip-data').match(/[+-]?\d+(?:\.\d+)?/g);
  2035.  
  2036.                     if (playerClass == 'class1') { //HC
  2037.                         playerAtk += Math.round(1.3 * girlStat[1]);
  2038.                     }
  2039.                     if (playerClass == 'class2') { //CH
  2040.                         playerAtk += Math.round(1.3 * girlStat[3]);
  2041.                     }
  2042.                     if (playerClass == 'class3') { //KH
  2043.                         playerAtk += Math.round(1.3 * girlStat[5]);
  2044.                     }
  2045.                     if (opponentClass == 'class1') { //HC
  2046.                         opponentDef += Math.round(1.75 * girlStat2[1]);
  2047.                     }
  2048.                     if (opponentClass == 'class2') { //CH
  2049.                         opponentDef += Math.round(1.75 * girlStat2[3]);
  2050.                     }
  2051.                     if (opponentClass == 'class3') { //KH
  2052.                         opponentDef += Math.round(1.75 * girlStat2[5]);
  2053.                     }
  2054.                 }
  2055.  
  2056.                 //Orgasm 2
  2057.                 if (playerOrgasmCount == 2) {
  2058.                     //Add Omega stats
  2059.                     girlStat = $('div#leagues_left .girls_wrapper .team_girl[g=3]').attr('girl-tooltip-data');
  2060.                     girlStat = girlStat.substring(girlStat.indexOf('caracs') + 1).match(/[+-]?\d+(?:\.\d+)?/g);
  2061.                     girlStat2 = $('div#leagues_right .girls_wrapper .team_girl[g=3]').attr('girl-tooltip-data').match(/[+-]?\d+(?:\.\d+)?/g);
  2062.  
  2063.                     if (playerClass == 'class1') { //HC
  2064.                         playerAtk += Math.round(girlStat[1]);
  2065.                     }
  2066.                     if (playerClass == 'class2') { //CH
  2067.                         playerAtk += Math.round(girlStat[3]);
  2068.                     }
  2069.                     if (playerClass == 'class3') { //KH
  2070.                         playerAtk += Math.round(girlStat[5]);
  2071.                     }
  2072.                     if (opponentClass == 'class1') { //HC
  2073.                         opponentDef += Math.round(girlStat2[1]);
  2074.                     }
  2075.                     if (opponentClass == 'class2') { //CH
  2076.                         opponentDef += Math.round(girlStat2[3]);
  2077.                     }
  2078.                     if (opponentClass == 'class3') { //KH
  2079.                         opponentDef += Math.round(girlStat2[5]);
  2080.                     }
  2081.                 }
  2082.  
  2083.                 //Reset excitement value
  2084.                 playerOrgasm = 0;
  2085.             }
  2086.  
  2087.             //No orgasm
  2088.             else {
  2089.                 opponentEgo -= Math.round(playerAtk - opponentDef);
  2090.                 playerOrgasm += playerAtk * 2;
  2091.             }
  2092.  
  2093.             //Log results
  2094.             console.log('Opponent ego: ' + opponentEgo);
  2095.         }
  2096.  
  2097.         function opponentTurn() {
  2098.             //Orgasm
  2099.             if (opponentOrgasm >= opponentExcitement) {
  2100.                 opponentOrgasmCount++;
  2101.  
  2102.                 //Orgasm 1
  2103.                 if (opponentOrgasmCount == 1) {
  2104.                     //Orgasm damage
  2105.                     girlStat = $('div#leagues_right .girls_wrapper .team_girl[g=1]').attr('girl-tooltip-data');
  2106.                     girlStat = parseInt(girlStat.substring(girlStat.indexOf('class')).match(/[+-]?\d+(?:\.\d+)?/g)[0]);
  2107.  
  2108.                     if (girlStat == 1) {
  2109.                         playerEgo -= Math.round(opponentAtk * 2.25 - playerDef);
  2110.  
  2111.                         //Log results
  2112.                         console.log('Opponent orgasm + HC Harmony proc!');
  2113.                     }
  2114.                     else {
  2115.                         playerEgo -= Math.round(opponentAtk * 1.5 - playerDef);
  2116.  
  2117.                         if (girlStat == 2) {
  2118.                             opponentEgo += Math.round(opponentDefBase);
  2119.  
  2120.                             //Log results
  2121.                             console.log('Opponent orgasm + CH Harmony proc!');
  2122.                         }
  2123.                         if (girlStat == 3) {
  2124.                             opponentEgo += Math.round(opponentEgoBase * 0.1);
  2125.  
  2126.                             //Log results
  2127.                             console.log('Opponent orgasm + KH Harmony proc!');
  2128.                         }
  2129.                     }
  2130.  
  2131.                     //Add Beta stats
  2132.                     girlStat = $('div#leagues_right .girls_wrapper .team_girl[g=2]').attr('girl-tooltip-data').match(/[+-]?\d+(?:\.\d+)?/g);
  2133.                     girlStat2 = $('div#leagues_left .girls_wrapper .team_girl[g=2]').attr('girl-tooltip-data');
  2134.                     girlStat2 = girlStat2.substring(girlStat2.indexOf('caracs') + 1).match(/[+-]?\d+(?:\.\d+)?/g);
  2135.  
  2136.                     if (opponentClass == 'class1') { //HC
  2137.                         opponentAtk += Math.round(1.3 * girlStat[1]);
  2138.                     }
  2139.                     if (opponentClass == 'class2') { //CH
  2140.                         opponentAtk += Math.round(1.3 * girlStat[3]);
  2141.                     }
  2142.                     if (opponentClass == 'class3') { //KH
  2143.                         opponentAtk += Math.round(1.3 * girlStat[5]);
  2144.                     }
  2145.                     if (playerClass == 'class1') { //HC
  2146.                         playerDef += Math.round(1.75 * girlStat2[1]);
  2147.                     }
  2148.                     if (playerClass == 'class2') { //CH
  2149.                         playerDef += Math.round(1.75 * girlStat2[3]);
  2150.                     }
  2151.                     if (playerClass == 'class3') { //KH
  2152.                         playerDef += Math.round(1.75 * girlStat2[5]);
  2153.                     }
  2154.                 }
  2155.  
  2156.                 //Orgasm 2
  2157.                 if (opponentOrgasmCount == 2) {
  2158.                     //Orgasm damage
  2159.                     playerEgo -= Math.round(opponentAtk * 1.5 - playerDef);
  2160.  
  2161.                     //Add Omega stats
  2162.                     girlStat = $('div#leagues_right .girls_wrapper .team_girl[g=3]').attr('girl-tooltip-data').match(/[+-]?\d+(?:\.\d+)?/g);
  2163.                     girlStat2 = $('div#leagues_left .girls_wrapper .team_girl[g=3]').attr('girl-tooltip-data');
  2164.                     girlStat2 = girlStat2.substring(girlStat2.indexOf('caracs') + 1).match(/[+-]?\d+(?:\.\d+)?/g);
  2165.  
  2166.                     if (opponentClass == 'class1') { //HC
  2167.                         opponentAtk += Math.round(girlStat[1]);
  2168.                     }
  2169.                     if (opponentClass == 'class2') { //CH
  2170.                         opponentAtk += Math.round(girlStat[3]);
  2171.                     }
  2172.                     if (opponentClass == 'class3') { //KH
  2173.                         opponentAtk += Math.round(girlStat[5]);
  2174.                     }
  2175.                     if (playerClass == 'class1') { //HC
  2176.                         playerDef += Math.round(girlStat2[1]);
  2177.                     }
  2178.                     if (playerClass == 'class2') { //CH
  2179.                         playerDef += Math.round(girlStat2[3]);
  2180.                     }
  2181.                     if (playerClass == 'class3') { //KH
  2182.                         playerDef += Math.round(girlStat2[5]);
  2183.                     }
  2184.                 }
  2185.  
  2186.                 //Reset excitement value
  2187.                 opponentOrgasm = 0;
  2188.             }
  2189.  
  2190.             //No orgasm
  2191.             else {
  2192.                 playerEgo -= Math.round(opponentAtk - playerDef);
  2193.                 opponentOrgasm += opponentAtk * 2;
  2194.             }
  2195.  
  2196.             //Log results
  2197.             console.log('Player ego: ' + playerEgo);
  2198.         }
  2199.  
  2200.         //Simulate challenge
  2201.         for (var turns = 0; turns < 10; turns++) {
  2202.             if (playerEgo > 0) {
  2203.                 playerTurn()
  2204.             }
  2205.             else {
  2206.                 break
  2207.             }
  2208.             if (opponentEgo > 0) {
  2209.                 opponentTurn()
  2210.             }
  2211.             else {
  2212.                 //Check if victory is only a one turn advantage
  2213.                 playerEgo2 = playerEgo;
  2214.  
  2215.                 //Orgasm
  2216.                 if (opponentOrgasm >= opponentExcitement) {
  2217.                     opponentOrgasmCount++;
  2218.  
  2219.                     //Orgasm 1
  2220.                     if (opponentOrgasmCount == 1) {
  2221.                         //Orgasm damage
  2222.                         girlStat = $('div#leagues_right .girls_wrapper .team_girl[g=1]').attr('girl-tooltip-data');
  2223.                         girlStat = parseInt(girlStat.substring(girlStat.indexOf('class')).match(/[+-]?\d+(?:\.\d+)?/g)[0]);
  2224.  
  2225.                         if (girlStat == 1) {
  2226.                             playerEgo2 -= Math.round(opponentAtk * 2.25 - playerDef);
  2227.                         }
  2228.                         else {
  2229.                             playerEgo2 -= Math.round(opponentAtk * 1.5 - playerDef);
  2230.                         }
  2231.                     }
  2232.  
  2233.                     //Orgasm 2
  2234.                     if (opponentOrgasmCount == 2) {
  2235.                     //Orgasm damage
  2236.                         playerEgo2 -= Math.round(opponentAtk * 1.5 - playerDef);
  2237.                     }
  2238.                 }
  2239.  
  2240.                 //No orgasm
  2241.                 else {
  2242.                     playerEgo2 -= Math.round(opponentAtk - playerDef);
  2243.                 }
  2244.  
  2245.                 if (playerEgo2 <= 0) {
  2246.                     console.log('Close call!');
  2247.                 }
  2248.  
  2249.                 break
  2250.             }
  2251.         }
  2252.  
  2253.         //Round defeated player's ego up to 0 to not skew results
  2254.         if (playerEgo < 0) {
  2255.             playerEgo = 0;
  2256.         }
  2257.         if (opponentEgo < 0) {
  2258.             opponentEgo = 0;
  2259.         }
  2260.  
  2261.         //Publish the ego difference as a match rating
  2262.         matchRating = playerEgo - opponentEgo;
  2263.         if (matchRating >= 0) {
  2264.             matchRating = '+' + nThousand(matchRating);
  2265.  
  2266.             if (playerEgo2 <= 0) {
  2267.                 $('div#leagues_right .lead_player_profile').append('<div class="matchRating close"><img id="powerLevelScouter" src="https://i.imgur.com/B9dSU1S.png">' + matchRating + '</div>');
  2268.             }
  2269.             else {
  2270.                 $('div#leagues_right .lead_player_profile').append('<div class="matchRating plus"><img id="powerLevelScouter" src="https://i.imgur.com/iGhgBju.png">' + matchRating + '</div>');
  2271.             }
  2272.         }
  2273.         else {
  2274.             matchRating = nThousand(matchRating);
  2275.             $('div#leagues_right .lead_player_profile').append('<div class="matchRating minus"><img id="powerLevelScouter" src="https://i.imgur.com/AZDCJGy.png">' + matchRating + '</div>');
  2276.         }
  2277.  
  2278.         //Replace opponent excitement with the correct value
  2279.         $('div#leagues_right div.stats_wrap div:nth-child(9) span:nth-child(2)').empty().append(nRounding(opponentExcitement,0));
  2280.     }
  2281.  
  2282.     calculatePower();
  2283.  
  2284.     //Replace player excitement with the correct value
  2285.     $('div#leagues_left div.stats_wrap div:nth-child(9) span:nth-child(2)').empty().append(nRounding(playerExcitement,0));
  2286.  
  2287.     // Refresh sim on new opponent selection (Credit: BenBrazke)
  2288.     var opntName;
  2289.     $('.leadTable').click(function() {
  2290.         opntName=''
  2291.     })
  2292.     function waitOpnt() {
  2293.         setTimeout(function() {
  2294.             if (JSON.parse($('div#leagues_right .girls_wrapper .team_girl[g=3]').attr('girl-tooltip-data'))) {
  2295.                 sessionStorage.setItem('opntName', opntName);
  2296.                 calculatePower();
  2297.             }
  2298.             else {
  2299.                 waitOpnt()
  2300.             }
  2301.         }, 50);
  2302.     }
  2303.     var observeCallback = function() {
  2304.         var opntNameNew = $('div#leagues_right div.player_block div.title')[0].innerHTML
  2305.         if (opntName !== opntNameNew) {
  2306.             opntName = opntNameNew;
  2307.             waitOpnt();
  2308.         }
  2309.     }
  2310.     var observer = new MutationObserver(observeCallback);
  2311.     var test = document.getElementById('leagues_right');
  2312.     observer.observe(test, {attributes: false, childList: true, subtree: false});
  2313.  
  2314.     //CSS
  2315.     sheet.insertRule('#leagues_right .player_block .lead_player_profile .level_wrapper {'
  2316.         + 'top: -8px !important;}'
  2317.     );
  2318.  
  2319.     sheet.insertRule('#leagues_right .player_block .lead_player_profile .icon {'
  2320.         + 'top: 5px !important;}'
  2321.     );
  2322.  
  2323.     sheet.insertRule('.matchRating {'
  2324.         + 'margin-top: -25px; '
  2325.         + 'margin-left: 70px; '
  2326.         + 'text-shadow: 1px 1px 0 #000, -1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000; '
  2327.         + 'line-height: 17px; '
  2328.         + 'font-size: 14px;}'
  2329.     );
  2330.  
  2331.     sheet.insertRule('.plus {'
  2332.         + 'color: #66CD00;}'
  2333.     );
  2334.  
  2335.     sheet.insertRule('.minus {'
  2336.         + 'color: #FF2F2F;}'
  2337.     );
  2338.  
  2339.     sheet.insertRule('.close {'
  2340.         + 'color: #FFA500;}'
  2341.     );
  2342.  
  2343.     sheet.insertRule('#powerLevelScouter {'
  2344.         + 'margin-left: -8px; '
  2345.         + 'margin-right: 1px; '
  2346.         + 'width: 25px;}'
  2347.     );
  2348. }
  2349.  
  2350. /* =========================================
  2351.     CHAMPIONS INFORMATION (Credit: Entwine)
  2352.    ========================================= */
  2353.  
  2354. function moduleChampions() {
  2355.     if (sessionStorage.getItem('championsCallBack') && $('.page-shop').length) {
  2356.         const championsCallBack = JSON.parse(sessionStorage.getItem('championsCallBack'));
  2357.         $('#breadcrumbs .back').after('<span>&gt;</span><a class="back" href="/champions-map.html" >'
  2358.         + $('nav [rel="content"] a[href="/champions-map.html"]').text().trim()
  2359.         + '<span class="mapArrowBack_flat_icn"></span></a><span>&gt;</span><a class="back" href="'
  2360.         + championsCallBack.location + '">'
  2361.         + championsCallBack.name + '<span class="mapArrowBack_flat_icn"></span></a>');
  2362.         sessionStorage.removeItem('championsCallBack');
  2363.     }
  2364.     else if ($('.page-champions').length) {
  2365.         const DEFAULT_CHAMPIONS_DATA = '{"attempts": {}, "config" : {}, "positions" : {}, "statistics" : {}}';
  2366.         const personalKey = Hero.infos.id + '/' + championData.champion.id;
  2367.         let championsData = JSON.parse(localStorage.getItem('championsData') || DEFAULT_CHAMPIONS_DATA);
  2368.         let positions = championsData.positions[personalKey];
  2369.         let positions2 = championData.champion.poses;
  2370.         let statistics = championsData.statistics[championData.champion.id];
  2371.         let attempts = championsData.attempts[personalKey];
  2372.         let config = championsData.config[Hero.infos.id] || {};
  2373.         let isSkipButtonClicked;
  2374.         markMatchedPositions();
  2375.         showAdditionalInformation();
  2376.         showNumberOfTicketsWhileTeamResting();
  2377.         $('.page-champions')
  2378.         .on('click', '.champions-bottom__draft-box > button', () => {setTimeout(markMatchedPositions, 500)})
  2379.         .on('click', '.champions-bottom__confirm-team', showNumberOfTicketsWhileTeamResting)
  2380.         .on('click', '.champions-bottom__skip-champion-cooldown', () => {isSkipButtonClicked = true});
  2381.         $(window).on('beforeunload', () => {
  2382.             championsData = JSON.parse(localStorage.getItem('championsData') || DEFAULT_CHAMPIONS_DATA);
  2383.             championsData.positions[personalKey] = positions;
  2384.             championsData.attempts[personalKey] = attempts;
  2385.             championsData.statistics[championData.champion.id] = statistics;
  2386.             championsData.config[Hero.infos.id] = Object.keys(config).length? config : undefined;
  2387.             localStorage.setItem('championsData', JSON.stringify(championsData));
  2388.         });
  2389.         $(document).ajaxComplete(function(event, xhr, options) {
  2390.             const response = JSON.parse(xhr.responseText);
  2391.             if (response.positions) {
  2392.                 if (!positions) {
  2393.                     if (!statistics) {
  2394.                         statistics = Array(positionImages.length).fill(0);
  2395.                     }
  2396.                     response.positions.forEach((e) => statistics[e]++);
  2397.                     attempts = 0;
  2398.                 }
  2399.                 if (response.final.attacker_ego > 0 || response.final.winner.type == 'hero') {
  2400.                     positions = undefined;
  2401.                 }
  2402.                 else {
  2403.                     positions = response.positions;
  2404.                 }
  2405.                 attempts++;
  2406.             }
  2407.             else {
  2408.                 markMatchedPositions();
  2409.             }
  2410.             if (isSkipButtonClicked) {
  2411.                 showAdditionalInformation();
  2412.                 isSkipButtonClicked = false;
  2413.             }
  2414.         });
  2415.         const restTimer = $('.champions-bottom__rest [timer], .champions-middle__champion-resting[timer]');
  2416.         if (restTimer.is(':visible')) {
  2417.             const delayTime = Math.ceil(restTimer.attr('timer') * 1000 - Date.now());
  2418.             setTimeout(markMatchedPositions, delayTime + 400);
  2419.         }
  2420.  
  2421.         function showAdditionalInformation() {
  2422.             if ($('.champions-middle__champion-resting').is(':visible') && positions) {
  2423.                 positions = undefined;
  2424.             }
  2425.             if ($('#additionalInformation').is(':visible')) {
  2426.                 return;
  2427.             }
  2428.             if (positions) {
  2429.                 createCurrentPositionsInfo();
  2430.             }
  2431.             else if (statistics) {
  2432.                 createStatisticsInfo();
  2433.             }
  2434.             if (positions || statistics) {
  2435.                 configureInfoBox();
  2436.             }
  2437.         }
  2438.  
  2439.         function markMatchedPositions() {
  2440.             $('.girl-selection__girl-box').each(function(index) {
  2441.                 const currentGirlsPose = $(this).find('.girl-box__pose');
  2442.                 if (currentGirlsPose.next().size() === 0) {
  2443.                     currentGirlsPose.parent().append('<span style="margin-left: 35px; filter: hue-rotate(-45deg);" />');
  2444.                 }
  2445.                 if (positions2) {
  2446.                     if (currentGirlsPose.attr('src').indexOf(preparePositionImage(positions2[index % positions2.length])) >= 0) {
  2447.                         currentGirlsPose.next().removeClass('empty');
  2448.                         currentGirlsPose.next().addClass('green-tick-icon');
  2449.                     }
  2450.                     else if (positions2.some((e) => (preparePositionImage(e) === currentGirlsPose.attr('src')))) {
  2451.                         currentGirlsPose.next().addClass('green-tick-icon empty');
  2452.                     }
  2453.                     else {
  2454.                         currentGirlsPose.next().removeClass('green-tick-icon');
  2455.                     }
  2456.                 }
  2457.                 else if (statistics) {
  2458.                     currentGirlsPose.next().css({'filter': 'invert'});
  2459.                     if (statistics.some((elem, idx) => (elem > 0 && preparePositionImage(idx) === currentGirlsPose.attr('src')))) {
  2460.                         currentGirlsPose.next().addClass('green-tick-icon empty');
  2461.                     }
  2462.                     else {
  2463.                         currentGirlsPose.next().removeClass('green-tick-icon');
  2464.                     }
  2465.                 }
  2466.             });
  2467.         }
  2468.  
  2469.         function showNumberOfTicketsWhileTeamResting() {
  2470.             if ($('.champions-bottom__ticket-amount').is(':visible') == false) {
  2471.                 $('.champions-bottom__rest').css({'width': '280px'})
  2472.                     .before('<div class="champions-bottom__ticket-amount"><span cur="ticket">x ' + championData.champion.currentTickets + '</span></div>');
  2473.             }
  2474.         }
  2475.  
  2476.         function preparePositionImage(positionID) {
  2477.             return IMAGES_URL + '/pictures/design/battle_positions/' + positionImages[positionID];
  2478.         }
  2479.  
  2480.         function createCurrentPositionsInfo() {
  2481.             let positionsBox = ('<div id="additionalInformation" style="position: absolute; top:' + (config.top || 165) + 'px; right:' + (config.right || -165)
  2482.             + 'px;"><div style="border: 2px solid #ffa23e; background-color: rgba(60,20,30,.8); border-radius: 7px; width: max-content;">&nbsp;Current positions:<div>');
  2483.             positions.forEach((e) => {
  2484.                 positionsBox += '<img style="height: 48px; width: 48px; cursor: pointer;" src="' + preparePositionImage(e) + '" hh_title="' + GT.figures[e]+ '">';
  2485.             });
  2486.             positionsBox += '</div>&nbsp;Current stage: ' + attempts + ' attempt' + (attempts == 1 ? '':'s') + '&nbsp;</div></div>';
  2487.             $('.champions-over__champion-wrapper').append(positionsBox);
  2488.         }
  2489.  
  2490.         function createStatisticsInfo() {
  2491.             let statisticsBox = ('<div id="additionalInformation" style="position: absolute; top:' + (config.top || 165) + 'px; right:' + (config.right || -165)
  2492.             + 'px;"><div style="border: 2px solid #ffa23e; background-color: rgba(0,0,0,.8); border-radius: 7px; width: max-content;">&nbsp;Statistics:'
  2493.             + '<div class="scroll-area" style="font-size: 14px; max-width: 208px;"><div>');
  2494.             let total = statistics.reduce((a, b) => a + b);
  2495.             let positionList = (statistics.map((elem, idx) => ({'index': idx, 'value': elem}))
  2496.             .filter((e) => e.index > 0 && e.value > 0)
  2497.             .sort((a, b) => (a.value == b.value)? a.index - b.index : b.value - a.value));
  2498.             positionList.forEach((p) => {
  2499.                 statisticsBox += '<div style="display: inline-block; width: 52px; text-align: center;">'
  2500.                 + '<img style="height: 48px; width: 48px; margin-bottom: -6px; cursor: pointer;" src="'
  2501.                 + preparePositionImage(p.index) + '" hh_title="' + GT.figures[p.index] + '" ><span>'
  2502.                 + Math.round(p.value / total * 1000) / 10 + '%</span></div>';
  2503.             });
  2504.             statisticsBox += '</div></div>' + (attempts? ('&nbsp;Prev stage: ' + attempts + ' attempt' + (attempts == 1 ? '':'s') + '&nbsp;') : '') + '</div></div>';
  2505.             $('.champions-over__champion-wrapper').append(statisticsBox);
  2506.             $('.champions-over__champion-wrapper').find('.scroll-area > div').css({'width': positionList.length * 52 + 'px'});
  2507.             if (positionList.length > 4) {
  2508.                 if (is_mobile_size()) {
  2509.                     $('.champions-over__champion-wrapper').find('.scroll-area').css({'padding-bottom': '10px', 'margin-bottom': '-5px'});
  2510.                 }
  2511.                 else {
  2512.                     $('.champions-over__champion-wrapper').find('.scroll-area').css({'padding-bottom': '', 'margin-bottom': '5px'});
  2513.                 }
  2514.                 $('.champions-over__champion-wrapper').find('.scroll-area').niceScroll().resize();
  2515.             }
  2516.         }
  2517.  
  2518.         function configureInfoBox() {
  2519.             $('.girl-box__draggable').droppable('option', 'accept', (e) => e.hasClass('girl-box__draggable'));
  2520.             $('#additionalInformation').on('click', '.eye', (e) => {
  2521.                 config.visible = config.visible == undefined? false : undefined;
  2522.                 $(e.currentTarget).next().toggle('slow');
  2523.                 $(e.currentTarget).children().toggle('fast');
  2524.             }).draggable({
  2525.                 cursor: 'move',
  2526.                 start: function () {
  2527.                     $(this).css({'right': ''});
  2528.                 },
  2529.                 drag: function (event, ui) {
  2530.                     ui.position.top /= FullSize.scale;
  2531.                     ui.position.left /= FullSize.scale;
  2532.                 },
  2533.                 stop: function (event, ui) {
  2534.                     config.right = Math.round($(this).parent().width() - ui.position.left - $(this).width());
  2535.                     config.top = Math.round(ui.position.top);
  2536.                     $(this).css({'left': '', 'right': config.right + 'px'});
  2537.                     $(event.originalEvent.target).one('click', (e) => e.stopImmediatePropagation());
  2538.                 }
  2539.             }).prepend('<a class="eye" style="top: 3px; right: 3px; position: absolute; cursor: pointer;">'
  2540.             + '<img src="https://hh.hh-content.com/quest/ic_eyeclosed.svg" style="width: 30px; display: block;">'
  2541.             + '<img src="https://hh.hh-content.com/quest/ic_eyeopen.svg" style="width: 50px; display: none;">'
  2542.             + '</div></a>');
  2543.             if (config.visible == false) {
  2544.                 $('#additionalInformation .eye').children().toggle();
  2545.                 $('#additionalInformation .eye').next().toggle();
  2546.             }
  2547.         }
  2548.     }
  2549. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement