Advertisement
_shal_

HH++ (OCD) 0.12.4

Oct 20th, 2019 (edited)
143,578
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name            Hentai Heroes++ (OCD)
  3. // @namespace       hentaiheroes.com
  4. // @description     Adding things here and there in the Hentai Heroes game.
  5. // @version         0.12.4
  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. // @downloadURL     https://pastebin.com/raw/t3y82cvf
  15. // @grant           none
  16. // @author          Raphael, 1121, Sluimerstand, shal
  17. // ==/UserScript==
  18.  
  19. /*  ===========
  20.      CHANGELOG
  21.     =========== */
  22.  
  23. // 0.12.4: Fixed display of villains menu after server-side code changes 2020/11/25.
  24. // 0.12.3: Support for Pandora Witch tier 2 / 3 girls.
  25. // 0.12.2: Added support for German language. Cleaned up some old unused text strings in all languages.
  26. // 0.12.1: Fixed recognition of villain event girl presence (again) after server-side code changes 2020/08/19.
  27. // 0.12.0: Support for new world 14 villain Nike and her tier 1 girls.
  28. // 0.11.9: Changed exponentiation operator from ** to Math.pow() after reports of it breaking on (very) old browsers.
  29. // 0.11.8: Added support for Italian language (translation courtesy of Godius). Options menu now available in French (Tom208) and Spanish (Marcezeq), completing these localizations.
  30. // 0.11.7: Minor changes to rounding logic for money and battle excitement displays.
  31. // 0.11.6: Fixed an issue with non-promotion points targets in league information when league brackets have 115+ players.
  32. // 0.11.5: Support for Karole tier 2 / 3 and Jackson's Crew tier 3 girls.
  33. // 0.11.4: Cleaned up and improved calculations for demotion and non-promotion points targets in league information. (Additional es/fr info texts contributed by Marcezeq and Tom208.)
  34. // 0.11.3: Fixed some number display issues in harem and league information when the game is played in languages other than English. (With thanks to Tom208.)
  35. // 0.11.2: Support for Finalmecia and Roko Senseï tier 3 girls.
  36. // 0.11.1: Replaced image links on imgur with Postimage after files were removed. Minor changes to affection tooltip display in harem.
  37. // 0.11.0: Re-added support for automatic script updating.
  38. // 0.10.9: Fixed recognition of villain event girl presence after server-side code changes 2020/05/14.
  39. // 0.10.8: Extended villain menu to show which tiers still have world girls to get; can be toggled in options menu. (Note: Will require script update when new tier girls are released.)
  40. // 0.10.7: Fixed market stats cost formulas; cost is now 7 rather than 5 for first stat purchase, 1999 increases from first to second price level rather than 2000.
  41. // 0.10.6: Tweaked league sim to account for recently buffed charm proc, changed how procs are included in the sim, fixed omega girl effects, and generally cleaned up sim code.
  42. // 0.10.5: Moved the market stats tooltip buttons from right to left to account for Kinkoid's new multi-buy button. Tweaked tooltip texts and display.
  43. // 0.10.4: Added name of World 13 villain. Added localized villain names in fr/es language versions. Minor text tweaks in en version.
  44. // 0.10.3: Now supporting girl XP level calculations up to new level 500 cap (with thanks to piturda for the reminder).
  45. // 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.
  46. // 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.
  47. // 0.10.0: Updated and expanded stats formula to reflect Patch of 14/08/19. (Contributed by Hare.)
  48. // 0.9.9: Fixed a bug in the Champions information caused by server-side changes to the code. (Last update by Sluimerstand.)
  49. // 0.9.8: Added Champions information (credit: Entwine). Fixed no longer working icons.
  50. // 0.9.7: Fixed League rewards calculating badly when it involves usernames with spaces. Fixed League rewards at 0 challenges left.
  51. // 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.
  52. // 0.9.5: Fixed an issue for the Villain menu when the localStorage does not exist yet or anymore.
  53. // 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.
  54. // 0.9.3: Fixed League rewards not properly calculating for point values higher than 999.
  55. // 0.9.2: Added an options menu. Removed modifyScenes. Tweaked sim refresh. Tweaked League info. Tweaked better XP and money. Tweaked harem info.
  56. // 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.
  57. // 0.9.0: Expanded on the extra League info. Added some missing translations for Spanish.
  58. // 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.
  59. // 0.8.8: Added Jackson's Crew villain name. Fixed Charm and Know-How defence in sim results. Added extra League info.
  60. // 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.
  61. // 0.8.6: Fixed wrong class defence stats for beta/omega girls. Fixed new line creation for wide sim results.
  62. // 0.8.5: Fixed wrong class Harmony procs for League sims.
  63. // 0.8.4: More tweaks to League sims.
  64. // 0.8.3: Fixed excitement for League sims (formerly known as match rating formerly known as power levels).
  65. // 0.8.2: Fixed an oopsie I made when calculating worst-case scenario. Console log (F12) is now also available.
  66. // 0.8.1: Fixed League numbers for French and Spanish localisations. Changed League ratings to show a worst-case scenario.
  67. // 0.8.0: Fixed the event villains issue.
  68. // 0.7.9: Properly fixed the button displacement. Match rating is now even more accurate.
  69. // 0.7.8: Fixed the collect all button displacement. Fixed Excitement stat in Leagues. Match rating is now more accurate.
  70. // 0.7.7: Replaced the League power levels with a match rating.
  71. // 0.7.6: Added better XP and better money.
  72. // 0.7.5: Added the @downloadURL, so the script can be updated directly from Tampermonkey.
  73. // 0.7.4: Removed the added mission and arena timers and the extra quest button. Added an auto refresh for the home screen.
  74. // 0.7.3: Cleaned up the code and prepared the file for "public launch." Added power levels to Leagues.
  75. // 0.7.2: Updated the harem info pane to be more pleasing to the eyes.
  76.  
  77. /* =========
  78.     GENERAL
  79.    ========= */
  80.  
  81. // Define jQuery
  82. var $ = window.jQuery;
  83.  
  84. // Define CSS
  85. var sheet = (function() {
  86.     var style = document.createElement('style');
  87.     document.head.appendChild(style);
  88.     return style.sheet;
  89. })();
  90.  
  91. // Numbers: thousand spacing
  92. function nThousand(x) {
  93.     if (typeof x != 'number') {
  94.         x = 0;
  95.     }
  96.     return x.toLocaleString();
  97. }
  98.  
  99. // Numbers: rounding to K, M, G and T
  100. function nRounding(num, digits, updown) {
  101.     var power = [
  102.         { value: 1, symbol: '' },
  103.         { value: 1E3, symbol: 'K' },
  104.         { value: 1E6, symbol: 'M' },
  105.         { value: 1E9, symbol: 'B' },
  106.         { value: 1E12, symbol: 'T' },
  107.     ];
  108.     var i;
  109.     for (i = power.length - 1; i > 0; i--) {
  110.         if (num >= power[i].value) {
  111.             break;
  112.         }
  113.     }
  114.     if (updown == 1) {
  115.         return (Math.ceil(num / power[i].value * Math.pow(10, digits)) / Math.pow(10, digits)).toFixed(digits) + power[i].symbol;
  116.     }
  117.     else if (updown == 0) {
  118.         return (Math.round(num / power[i].value * Math.pow(10, digits)) / Math.pow(10, digits)).toFixed(digits) + power[i].symbol;
  119.     }
  120.     else if (updown == -1) {
  121.         return (Math.floor(num / power[i].value * Math.pow(10, digits)) / Math.pow(10, digits)).toFixed(digits) + power[i].symbol;
  122.     }
  123. }
  124.  
  125. /* ==============
  126.     TRANSLATIONS
  127.    ============== */
  128.  
  129. var lang = 'en';
  130.  
  131. if ($('html')[0].lang === 'en') {
  132.     lang = 'en';
  133. }
  134. else if ($('html')[0].lang === 'fr') {
  135.     lang = 'fr';
  136. }
  137. else if ($('html')[0].lang === 'es_ES') {
  138.     lang = 'es';
  139. }
  140. else if ($('html')[0].lang === 'it_IT') {
  141.     lang = 'it';
  142. }
  143. else if ($('html')[0].lang === 'de_DE') {
  144.     lang = 'de';
  145. }
  146.  
  147. var texts = [];
  148.  
  149. texts.en = {
  150.     optionsRefresh: 'Home screen refresh',
  151.     optionsVillain: 'Fight a villain menu',
  152.     optionsTiers: 'Show tiers with girls',
  153.     optionsXP: 'Better XP',
  154.     optionsMoney: 'Better money',
  155.     optionsMarket: 'Market information',
  156.     optionsHarem: 'Harem information',
  157.     optionsLeague: 'League information',
  158.     optionsSim: 'League sim',
  159.     optionsChampions: 'Champions information',
  160.     and: 'and',
  161.     or: 'or',
  162.     affection: 'affection',
  163.     harem_stats: 'Harem Stats',
  164.     haremettes: 'haremettes',
  165.     hardcore: 'Hardcore',
  166.     charm: 'Charm',
  167.     know_how: 'Know-how',
  168.     harem_level: 'harem level',
  169.     to_go: 'to go',
  170.     unlocked_scenes: 'scenes unlocked',
  171.     money_income: 'Money income',
  172.     per_hour: 'per hour',
  173.     when_all_collectable: 'when all collectable',
  174.     required_to_unlock: 'Required to upgrade all haremettes',
  175.     required_to_get_max_level: 'Required to level all haremettes',
  176.     my_stocks: 'My stock',
  177.     equipments: 'equipments',
  178.     boosters: 'boosters',
  179.     books: 'books',
  180.     gifts: 'gifts',
  181.     currently_buyable: 'Currently buyable stock',
  182.     visit_the: 'Visit the <a href="../shop.html">Market</a> first.',
  183.     not_compatible: 'Your webbrowser is not compatible.',
  184.     or_level: 'or level',
  185.     restock: 'Restock',
  186.     wiki: '\'s wiki page',
  187.     evolution_costs: 'Upgrade costs are',
  188.     world: 'World ',
  189.     villain: ' villain',
  190.     fight_villain: 'Fight a villain',
  191.     you_own: 'You own',
  192.     you_can_give: 'You can give a total of',
  193.     you_can_sell: 'You can sell everything for',
  194.     stat_points_need: 'Stat points buyable to max',
  195.     money_need: 'Money required to max',
  196.     money_spent: 'Money spent in market',
  197.     points_from_level: 'Level-based stat points',
  198.     bought_points: 'Market-bought stat points',
  199.     equipment_points: 'Equipments stat points',
  200.     ginseng_points: 'Boosters stat points',
  201.     club_points: 'Club bonus stat points',
  202.     Xp: 'XP',
  203.     starting: 'Starting',
  204.     common: 'Common',
  205.     rare: 'Rare',
  206.     epic: 'Epic',
  207.     legendary: 'Legendary',
  208.     day: 'd',
  209.     hour: 'h',
  210.     minute: 'm',
  211.     demote_up: 'To <u>demote</u> you can have a maximum of ',
  212.     demote_down: 'To <u>demote</u> you must be passed by players with as few as ',
  213.     demote_holdzero: 'To <u>demote</u> you must remain at ',
  214.     stagnate_up: 'To <u>not promote</u> you can have a maximum of ',
  215.     stagnate_down: 'To <u>not promote</u> you must be passed by players with as few as ',
  216.     stagnate_holdzero: 'To <u>not promote</u> you must remain at ',
  217.     points: 'points',
  218.     challenges_regen: 'Natural regeneration: ',
  219.     challenges_left: '<br />Challenges left: '
  220. };
  221.  
  222. texts.fr = {
  223.     optionsRefresh: 'Rafraîchir page d\'accueil',
  224.     optionsVillain: 'Menu combats un troll',
  225.     optionsTiers: 'Montrer les paliers avec les filles',
  226.     optionsXP: 'XP + précise',
  227.     optionsMoney: 'Argent + précis',
  228.     optionsMarket: 'Infos marché',
  229.     optionsHarem: 'Infos harem',
  230.     optionsLeague: 'Infos ligue',
  231.     optionsSim: 'Simu ligue',
  232.     optionsChampions: 'Infos des champions',
  233.     and: 'et',
  234.     or: 'ou',
  235.     affection: 'affection',
  236.     harem_stats: 'Stats du harem',
  237.     haremettes: 'haremettes',
  238.     hardcore: 'Hardcore',
  239.     charm: 'Charme',
  240.     know_how: 'Savoir-faire',
  241.     harem_level: 'niveau de harem',
  242.     to_go: 'restant',
  243.     unlocked_scenes: 'scènes débloquées',
  244.     money_income: 'Revenus',
  245.     per_hour: 'par heure',
  246.     when_all_collectable: 'quand tout est disponible',
  247.     required_to_unlock: 'Requis pour débloquer la scène',
  248.     required_to_get_max_level: 'Requis pour obtenir toutes les filles au niveau maximum',
  249.     my_stocks: 'Mes stocks',
  250.     equipments: 'équipements',
  251.     boosters: 'boosters',
  252.     books: 'livres',
  253.     gifts: 'cadeaux',
  254.     currently_buyable: 'Stock disponible au marché',
  255.     visit_the: 'Visite le <a href="../shop.html">marché</a> first.',
  256.     not_compatible: 'Votre navigateur n\'est pas compatible.',
  257.     or_level: 'ou niveau',
  258.     restock: 'Restock',
  259.     wiki: 'Page wiki de ',
  260.     evolution_costs: 'Ses couts d\'évolution sont',
  261.     world: 'Monde ',
  262.     villain: ' troll',
  263.     fight_villain: 'Combats un troll',
  264.     you_own: 'Tu possèdes',
  265.     you_can_give: 'Tu peux donner un total de',
  266.     you_can_sell: 'Tu peux tout vendre pour',
  267.     stat_points_need: 'Nombre de points requis pour max',
  268.     money_need: 'Argent demandé pour max',
  269.     money_spent: 'Argent dépensé dans le marché',
  270.     points_from_level: 'Points donnés par ton niveau',
  271.     bought_points: 'Points achetés au marché',
  272.     equipment_points: 'Points donnés par ton équipement',
  273.     ginseng_points: 'Points donnés par tes boosters',
  274.     club_points: 'Points donnés par ton club',
  275.     Xp: 'XP',
  276.     starting: 'Fille de départ',
  277.     common: 'Commun',
  278.     rare: 'Rare',
  279.     epic: 'Épique',
  280.     legendary: 'Légendaire',
  281.     day: 'j',
  282.     hour: 'h',
  283.     minute: 'm',
  284.     demote_up: 'Pour <u>être rétrogradé</u> vous pouvez avoir un maximum de ',
  285.     demote_down: 'Pour <u>être rétrogradé</u> vous devez être dépassé par les joueurs qui ont ',
  286.     demote_holdzero: 'Pour <u>être rétrogradé</u> vous devez rester avec ',
  287.     stagnate_up: 'Pour <u>ne pas être promu</u> vous pouvez avoir un maximum de ',
  288.     stagnate_down: 'Pour <u>ne pas être promu</u> vous devez être dépassé par les joueurs qui ont ',
  289.     stagnate_holdzero: 'Pour <u>ne pas être promu</u> vous devez rester avec ',
  290.     points: 'points',
  291.     challenges_regen: 'Régénération naturelle: ',
  292.     challenges_left: '<br />Défis restants: '
  293. };
  294.  
  295. texts.es = {
  296.     optionsRefresh: 'Actualizacion Menu principal',
  297.     optionsVillain: 'Menu Pelear contra villano',
  298.     optionsTiers: 'Mostrar Rangos con Chicas',
  299.     optionsXP: 'Mejor XP',
  300.     optionsMoney: 'Mejor Dinero',
  301.     optionsMarket: 'Informacion de Mercado',
  302.     optionsHarem: 'Informacion de Harén',
  303.     optionsLeague: 'Informacion de Liga',
  304.     optionsSim: 'Simulacion de Liga',
  305.     optionsChampions: 'Informacion de Campeones',
  306.     and: 'y',
  307.     or: 'o',
  308.     affection: 'afecto',
  309.     harem_stats: 'Estatus del Harén',
  310.     haremettes: 'haremettes',
  311.     hardcore: 'Folladas',
  312.     charm: 'Encanto',
  313.     know_how: 'Saber-hacer',
  314.     harem_level: 'nivel de harén',
  315.     to_go: 'restante',
  316.     unlocked_scenes: 'escenas desbloqueadas',
  317.     money_income: 'Ingreso de dinero',
  318.     per_hour: 'por hora',
  319.     when_all_collectable: 'cuando todo es coleccionable',
  320.     required_to_unlock: 'Requerido para desbloquear todas las escenas bloqueadas',
  321.     required_to_get_max_level: 'Requerido para obtener el máximo nivel de todas las chicas',
  322.     my_stocks: 'Mi Stock',
  323.     equipments: 'equipamiento',
  324.     boosters: 'potenciadores',
  325.     books: 'libros',
  326.     gifts: 'regalos',
  327.     currently_buyable: 'Stocks Comprables Actualmente',
  328.     visit_the: 'Visita el <a href="../shop.html">Mercado</a> primero.',
  329.     not_compatible: 'Tu navegador no es compatible.',
  330.     or_level: 'o nivel',
  331.     restock: 'Restock',
  332.     wiki: ' wiki',
  333.     evolution_costs: 'Sus costo de evolucion son',
  334.     world: 'Mundo ',
  335.     villain: ' villano',
  336.     fight_villain: 'Pelear un villano',
  337.     you_own: 'Tienes',
  338.     you_can_give: 'Puedes dar un total de',
  339.     you_can_sell: 'Puedes vender todo por',
  340.     stat_points_need: 'Puntos de estatus necesarios para maximo',
  341.     money_need: 'Dinero necesario para maximo',
  342.     money_spent: 'Dinero usado en el mercado',
  343.     points_from_level: 'Puntos de estatus de nivel',
  344.     bought_points: 'Puntos comprados del mercado',
  345.     equipment_points: 'Puntos de estatus de equipamiento',
  346.     ginseng_points: 'Puntos de estatus de los potenciadores',
  347.     club_points: 'Puntos de estatus del club',
  348.     Xp: 'XP',
  349.     starting: 'Principiante',
  350.     common: 'Común',
  351.     rare: 'Raro',
  352.     epic: 'Épico',
  353.     legendary: 'Legendario',
  354.     day: 'd',
  355.     hour: 'h',
  356.     minute: 'm',
  357.     demote_up: 'Para <u>degradar</u> puedes tener un máximo de ',
  358.     demote_down: 'Para <u>degradar</u> debes ser superado por jugadores con tan solo ',
  359.     demote_holdzero: 'Para <u>degradar</u> debes mantenerte en ',
  360.     stagnate_up: 'Para <u>no promocionar</u> puedes tener un máximo de ',
  361.     stagnate_down: 'Para <u>no promocionar</u> debes ser superado por jugadores con tan solo ',
  362.     stagnate_holdzero: 'Para <u>no promocionar</u> debes mantenerte en ',
  363.     points: 'puntos',
  364.     challenges_regen: 'Regeneracion naturel: ',
  365.     challenges_left: '<br />Retos pendientes: '
  366. };
  367.  
  368. texts.it = {
  369.     optionsRefresh: 'Refresh pagina Home',
  370.     optionsVillain: 'Menù battaglia Troll',
  371.     optionsTiers: 'Mostra battaglie con ragazze',
  372.     optionsXP: 'Mostra XP mancante al lvl successivo',
  373.     optionsMoney: 'Migliora soldi',
  374.     optionsMarket: 'Informazioni negozio',
  375.     optionsHarem: 'Informazioni Harem',
  376.     optionsLeague: 'Informazioni sulle Leghe',
  377.     optionsSim: 'Simulazione Leghe',
  378.     optionsChampions: 'Informazioni sui Campioni',
  379.     and: 'e',
  380.     or: 'o',
  381.     affection: 'affetto',
  382.     harem_stats: 'Stato dell Harem',
  383.     haremettes: 'ragazze dell harem',
  384.     hardcore: 'Scopata',
  385.     charm: 'Amante',
  386.     know_how: 'Esperto',
  387.     harem_level: 'livello harem',
  388.     to_go: 'mancanti',
  389.     unlocked_scenes: 'scene sbloccate',
  390.     money_income: 'Guadagni',
  391.     per_hour: 'orario',
  392.     when_all_collectable: 'quando si può raccogliere tutto',
  393.     required_to_unlock: 'Necessario per sbloccare tutte le scene',
  394.     required_to_get_max_level: 'Necessario per livellare tutte le ragazze',
  395.     my_stocks: 'Mio inventario',
  396.     equipments: 'equipaggiamento',
  397.     boosters: 'potenziamenti',
  398.     books: 'libri',
  399.     gifts: 'regali',
  400.     currently_buyable: 'Correntemente acquistabili',
  401.     visit_the: 'Visita il <a href="../shop.html">negozio</a> prima.',
  402.     not_compatible: 'Il tuo browser non è compatibile.',
  403.     or_level: 'o livello',
  404.     restock: 'Rifornimento',
  405.     wiki: ' -> wiki',
  406.     evolution_costs: 'Il costo del potenziamento è',
  407.     world: 'Mondo ',
  408.     villain: ' nemico',
  409.     fight_villain: 'Combattimenti',
  410.     you_own: 'Possiedi',
  411.     you_can_give: 'Puoi dare il massimo a',
  412.     you_can_sell: 'Puoi vendere tutto per',
  413.     stat_points_need: 'Punti statistica necessari per il massimo',
  414.     money_need: 'Soldi necessari per il massimo',
  415.     money_spent: 'Soldi spesi al negozio',
  416.     points_from_level: 'Punti acquisiti da aumento livello',
  417.     bought_points: 'Punti comprati al negozio',
  418.     equipment_points: 'Punti statistica da equipaggiamento',
  419.     ginseng_points: 'Punti statistica dei potenziamenti',
  420.     club_points: 'Punti statistica bonus del Club',
  421.     Xp: 'XP',
  422.     starting: 'Starter',
  423.     common: 'Comuni',
  424.     rare: 'Rare',
  425.     epic: 'Epiche',
  426.     legendary: 'Leggendarie',
  427.     day: 'g',
  428.     hour: 'h',
  429.     minute: 'm',
  430.     demote_up: 'Per <u>il degrado</u> devi avere al massimo ',
  431.     demote_down: 'Per <u>il degrado</u> devi essere sorpassato da giocatori con ',
  432.     demote_holdzero: 'Per <u>il degrado</u> devi rimanere a ',
  433.     stagnate_up: 'Per <u>restare</u> devi avere al massimo ',
  434.     stagnate_down: 'Per <u>restare</u> devi essere sorpassato da giocatori con ',
  435.     stagnate_holdzero: 'Per <u>restare</u> devi rimanere a ',
  436.     points: 'punti',
  437.     challenges_regen: 'Rigenerazione naturale: ',
  438.     challenges_left: '<br />Combattimenti mancanti: '
  439. };
  440.  
  441. texts.de = {
  442. optionsRefresh: 'Homepage aktualisieren',
  443. optionsVillain: 'Widersacher-Menü',
  444. optionsTiers: 'Stufen mit Girls anzeigen',
  445. optionsXP: 'Verbesserte XP-Anzeige',
  446. optionsMoney: 'Verbesserte Geld-Anzeige',
  447. optionsMarket: 'Marktplatz-Informationen',
  448. optionsHarem: 'Harem-Informationen',
  449. optionsLeague: 'Liga-Informationen',
  450. optionsSim: 'Liga-Simulation',
  451. optionsChampions: 'Champion-Informationen',
  452. and: 'und',
  453. or: 'oder',
  454. affection: 'Zuneigung',
  455. harem_stats: 'Harem-Statistiken',
  456. haremettes: 'Harem-Mädchen',
  457. hardcore: 'Hardcore',
  458. charm: 'Charme',
  459. know_how: 'Wissen',
  460. harem_level: 'Harem-Level',
  461. to_go: 'übrig',
  462. unlocked_scenes: 'Szenen freigeschaltet',
  463. money_income: 'Einkommen',
  464. per_hour: 'pro Stunde',
  465. when_all_collectable: 'wenn komplett einsammelbar',
  466. required_to_unlock: 'Erforderlich für alle Mädchen-Upgrades',
  467. required_to_get_max_level: 'Erforderlich für maximale Mädchen-Level',
  468. my_stocks: 'Meine Bestände',
  469. equipments: 'Ausrüstungen',
  470. boosters: 'Booster',
  471. books: 'Bücher',
  472. gifts: 'Geschenke',
  473. currently_buyable: 'Aktuelle Bestände am Marktplatz',
  474. visit_the: 'Besuche zuerst den <a href="../shop.html">Marktplatz</a>.',
  475. not_compatible: 'Dein Browser ist nicht kompatibel.',
  476. or_level: 'oder Level',
  477. restock: 'neue Angebote',
  478. wiki: '-Wikiseite',
  479. evolution_costs: 'Die Upgradekosten betragen',
  480. world: 'Welt ',
  481. villain: ' Widersacher',
  482. fight_villain: 'Widersacher',
  483. you_own: 'Du besitzt',
  484. you_can_give: 'Insgesamt verteilbar:',
  485. you_can_sell: 'Du kannst alles verkaufen für',
  486. stat_points_need: 'bis Maximum käufliche Statpunkte',
  487. money_need: 'zum Maximieren nötiges Geld',
  488. money_spent: 'bisher ausgegebenes Geld',
  489. points_from_level: 'Statpunkte durch Heldenlevel',
  490. bought_points: 'Statpunkte durch Markt-Käufe',
  491. equipment_points: 'Statpunkte durch Ausrüstungen',
  492. ginseng_points: 'Statpunkte durch Booster',
  493. club_points: 'Statpunkte durch Club-Boni',
  494. Xp: 'XP',
  495. starting: 'Starting',
  496. common: 'Common',
  497. rare: 'Rare',
  498. epic: 'Epic',
  499. legendary: 'Legendary',
  500. day: 'd',
  501. hour: 'h',
  502. minute: 'm',
  503. demote_up: 'Für den <u>Abstieg</u> maximal möglich: ',
  504. demote_down: 'Für den <u>Abstieg</u> musst du überholt werden von Spielern mit höchstens ',
  505. demote_holdzero: 'Für den <u>Abstieg</u> musst du verbleiben bei ',
  506. stagnate_up: 'Für den <u>Nichtaufstieg</u> maximal möglich: ',
  507. stagnate_down: 'Für den <u>Nichtaufstieg</u> musst du überholt werden von Spielern mit höchstens ',
  508. stagnate_holdzero: 'Für den <u>Nichtaufstieg</u> musst du verbleiben bei ',
  509. points: 'Punkte',
  510. challenges_regen: 'Natürliche Regeneration: ',
  511. challenges_left: '<br />verbleibende Kämpfe: '
  512. };
  513.  
  514. var tierGirlsID = [
  515.     ['8', '9', '10', '7270263', '979916751'],
  516.     ['14', '13', '12', '318292466', '936580004'],
  517.     ['19', '16', '18', '610468472', '54950499'],
  518.     ['29', '28', '26', '4749652', '345655744'],
  519.     ['39', '40', '41', '267784162', '763020698'],
  520.     ['64', '63', '31', '406004250', '864899873'],
  521.     ['85', '86', '84', '267120960', '536361248'],
  522.     ['114', '115', '116', '379441499', '447396000'],
  523.     ['1247315', '4649579', '7968301', '46227677', '933487713'],
  524.     ['1379661', '4479579', '1800186', '985085118', '339765042'],
  525.     ['24316446', '219651566', '501847856', '383709663', '90685795'],
  526.     ['225365882', '478693885', '231765083', '155415482', '769649470'],
  527.     ['86962133', '243793871', '284483399', 0, 0]
  528. ];
  529.  
  530. /* ==================
  531.     WHEN TO RUN WHAT
  532.    ================== */
  533.  
  534. var currentPage = window.location.pathname;
  535. if (currentPage.indexOf('home') != -1) options();
  536.  
  537. // Show which modules are enabled and if so, run them when appropriate
  538. if (localStorage.getItem('HHS.refresh') === '1') {
  539.     $('#hhsRefresh').attr('checked', 'checked');
  540.     if (currentPage.indexOf('home') != -1) {
  541.         moduleRefresh();
  542.     }
  543. }
  544. if (localStorage.getItem('HHS.villain') === '1') {
  545.     $('#hhsVillain').attr('checked', 'checked');
  546.     moduleVillain();
  547. }
  548. if (localStorage.getItem('HHS.tiers') === '1') {
  549.     $('#hhsTiers').attr('checked', 'checked');
  550. }
  551. if (localStorage.getItem('HHS.xp') === '1') {
  552.     $('#hhsXP').attr('checked', 'checked');
  553.     moduleXP();
  554. }
  555. if (localStorage.getItem('HHS.money') === '1') {
  556.     $('#hhsMoney').attr('checked', 'checked');
  557.     moduleMoney();
  558. }
  559. if (localStorage.getItem('HHS.market') === '1') {
  560.     $('#hhsMarket').attr('checked', 'checked');
  561.     if (currentPage.indexOf('shop') != -1) {
  562.         moduleMarket();
  563.     }
  564. }
  565. if (localStorage.getItem('HHS.harem') === '1') {
  566.     $('#hhsHarem').attr('checked', 'checked');
  567.     if (currentPage.indexOf('harem') != -1) {
  568.         moduleHarem();
  569.     }
  570. }
  571. if (localStorage.getItem('HHS.league') === '1') {
  572.     $('#hhsLeague').attr('checked', 'checked');
  573.     if (currentPage.indexOf('tower-of-fame') != -1) {
  574.         moduleLeague();
  575.     }
  576. }
  577. if (localStorage.getItem('HHS.sim') === '1') {
  578.     $('#hhsSim').attr('checked', 'checked');
  579.     if (currentPage.indexOf('tower-of-fame') != -1) {
  580.         moduleSim();
  581.     }
  582. }
  583. if (localStorage.getItem('HHS.champions') === '1') {
  584.     $('#hhsChampions').attr('checked', 'checked');
  585.     moduleChampions();
  586. }
  587.  
  588. /* =========
  589.     OPTIONS
  590.    ========= */
  591.  
  592. function options() {
  593.     // Create localStorage if it doesn't exist yet
  594.     if (localStorage.getItem('HHS.refresh') === null) {
  595.         localStorage.setItem('HHS.refresh', '1');
  596.     }
  597.     if (localStorage.getItem('HHS.villain') === null) {
  598.         localStorage.setItem('HHS.villain', '1');
  599.     }
  600.     if (localStorage.getItem('HHS.tiers') === null) {
  601.         localStorage.setItem('HHS.tiers', '1');
  602.     }
  603.     if (localStorage.getItem('HHS.xp') === null) {
  604.         localStorage.setItem('HHS.xp', '1');
  605.     }
  606.     if (localStorage.getItem('HHS.money') === null) {
  607.         localStorage.setItem('HHS.money', '1');
  608.     }
  609.     if (localStorage.getItem('HHS.market') === null) {
  610.         localStorage.setItem('HHS.market', '1');
  611.     }
  612.     if (localStorage.getItem('HHS.harem') === null) {
  613.         localStorage.setItem('HHS.harem', '1');
  614.     }
  615.     if (localStorage.getItem('HHS.league') === null) {
  616.         localStorage.setItem('HHS.league', '1');
  617.     }
  618.     if (localStorage.getItem('HHS.sim') === null) {
  619.         localStorage.setItem('HHS.sim', '1');
  620.     }
  621.     if (localStorage.getItem('HHS.champions') === null) {
  622.         localStorage.setItem('HHS.champions', '1');
  623.     }
  624.  
  625.     // Options menu
  626.     $('div#contains_all').append('<a href="#"><img src="https://i.postimg.cc/c1F37PYz/icon-options.png" id="hhsButton"></a>');
  627.     $('div#contains_all').append('<div id="hhsOptions" class="hhsTooltip" style="display: none;">'
  628.         + '<label class="switch"><input type="checkbox" id="hhsRefresh"><span class="slider"></span></label>' + texts[lang].optionsRefresh + '<br />'
  629.         + '<label class="switch"><input type="checkbox" id="hhsVillain"><span class="slider"></span></label>' + texts[lang].optionsVillain + '<br />'
  630.         + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label class="switch"><input type="checkbox" id="hhsTiers"><span class="slider"></span></label>' + texts[lang].optionsTiers + '<br />'
  631.         + '<label class="switch"><input type="checkbox" id="hhsXP"><span class="slider"></span></label>' + texts[lang].optionsXP + '<br />'
  632.         + '<label class="switch"><input type="checkbox" id="hhsMoney"><span class="slider"></span></label>' + texts[lang].optionsMoney + '<br />'
  633.         + '<label class="switch"><input type="checkbox" id="hhsMarket"><span class="slider"></span></label>' + texts[lang].optionsMarket + '<br />'
  634.         + '<label class="switch"><input type="checkbox" id="hhsHarem"><span class="slider"></span></label>' + texts[lang].optionsHarem + '<br />'
  635.         + '<label class="switch"><input type="checkbox" id="hhsLeague"><span class="slider"></span></label>' + texts[lang].optionsLeague + '<br />'
  636.         + '<label class="switch"><input type="checkbox" id="hhsSim"><span class="slider"></span></label>' + texts[lang].optionsSim + '<br />'
  637.         + '<label class="switch"><input type="checkbox" id="hhsChampions"><span class="slider"></span></label>' + texts[lang].optionsChampions
  638.         + '</div>');
  639.  
  640.     // Show and hide options menu
  641.     $('#hhsButton').click(function() {
  642.         var x = document.getElementById('hhsOptions');
  643.         if (x.style.display === 'none') {
  644.             x.style.display = 'block';
  645.         }
  646.         else {
  647.             x.style.display = 'none';
  648.         }
  649.     });
  650.  
  651.     // Dependency of villain menu options
  652.     $('#hhsVillain').click(function(event) {
  653.         if (!$(this).is(':checked')) {
  654.             $('#hhsTiers').prop('checked', false);
  655.         }
  656.     });
  657.     $('#hhsTiers').click(function(event) {
  658.         if ($(this).is(':checked')) {
  659.             $('#hhsVillain').prop('checked', true);
  660.         }
  661.     });
  662.  
  663.     // Save changed options
  664.     $('#hhsRefresh').click(function() {
  665.         if (document.getElementById('hhsRefresh').checked == true) {
  666.             localStorage.setItem('HHS.refresh', '1');
  667.         }
  668.         if (document.getElementById('hhsRefresh').checked == false) {
  669.             localStorage.setItem('HHS.refresh', '0');
  670.         }
  671.     });
  672.  
  673.     $('#hhsVillain').click(function() {
  674.         if (document.getElementById('hhsVillain').checked == true) {
  675.             localStorage.setItem('HHS.villain', '1');
  676.         }
  677.         if (document.getElementById('hhsVillain').checked == false) {
  678.             localStorage.setItem('HHS.villain', '0');
  679.             localStorage.setItem('HHS.tiers', '0');
  680.         }
  681.     });
  682.  
  683.     $('#hhsTiers').click(function() {
  684.         if (document.getElementById('hhsTiers').checked == true) {
  685.             localStorage.setItem('HHS.villain', '1');
  686.             localStorage.setItem('HHS.tiers', '1');
  687.         }
  688.         if (document.getElementById('hhsTiers').checked == false) {
  689.             localStorage.setItem('HHS.tiers', '0');
  690.         }
  691.     });
  692.  
  693.     $('#hhsXP').click(function() {
  694.         if (document.getElementById('hhsXP').checked == true) {
  695.             localStorage.setItem('HHS.xp', '1');
  696.         }
  697.         if (document.getElementById('hhsXP').checked == false) {
  698.             localStorage.setItem('HHS.xp', '0');
  699.         }
  700.     });
  701.  
  702.     $('#hhsMoney').click(function() {
  703.         if (document.getElementById('hhsMoney').checked == true) {
  704.             localStorage.setItem('HHS.money', '1');
  705.         }
  706.         if (document.getElementById('hhsMoney').checked == false) {
  707.             localStorage.setItem('HHS.money', '0');
  708.         }
  709.     });
  710.  
  711.     $('#hhsMarket').click(function() {
  712.         if (document.getElementById('hhsMarket').checked == true) {
  713.             localStorage.setItem('HHS.market', '1');
  714.         }
  715.         if (document.getElementById('hhsMarket').checked == false) {
  716.             localStorage.setItem('HHS.market', '0');
  717.         }
  718.     });
  719.  
  720.     $('#hhsHarem').click(function() {
  721.         if (document.getElementById('hhsHarem').checked == true) {
  722.             localStorage.setItem('HHS.harem', '1');
  723.         }
  724.         if (document.getElementById('hhsHarem').checked == false) {
  725.             localStorage.setItem('HHS.harem', '0');
  726.         }
  727.     });
  728.  
  729.     $('#hhsLeague').click(function() {
  730.         if (document.getElementById('hhsLeague').checked == true) {
  731.             localStorage.setItem('HHS.league', '1');
  732.         }
  733.         if (document.getElementById('hhsLeague').checked == false) {
  734.             localStorage.setItem('HHS.league', '0');
  735.         }
  736.     });
  737.  
  738.     $('#hhsSim').click(function() {
  739.         if (document.getElementById('hhsSim').checked == true) {
  740.             localStorage.setItem('HHS.sim', '1');
  741.         }
  742.         if (document.getElementById('hhsSim').checked == false) {
  743.             localStorage.setItem('HHS.sim', '0');
  744.         }
  745.     });
  746.  
  747.     $('#hhsChampions').click(function() {
  748.         if (document.getElementById('hhsChampions').checked == true) {
  749.             localStorage.setItem('HHS.champions', '1');
  750.         }
  751.         if (document.getElementById('hhsChampions').checked == false) {
  752.             localStorage.setItem('HHS.champions', '0');
  753.         }
  754.     });
  755.  
  756.     //CSS
  757.     sheet.insertRule('#hhsButton {'
  758.         + 'height: 35px; '
  759.         + 'position: absolute; '
  760.         + 'top: 55px; '
  761.         + 'right: 15px; '
  762.         + 'filter: drop-shadow(0px 0px 5px white);}'
  763.     );
  764.  
  765.     sheet.insertRule('.hhsTooltip {'
  766.         + 'font-size: 12px; '
  767.         + 'text-align: left; '
  768.         + 'padding: 3px 5px 3px 5px; '
  769.         + 'border: 2px solid #905312; '
  770.         + 'border-radius: 6px; '
  771.         + 'background-color: rgba(32,3,7,.9); '
  772.         + 'position: absolute; right: 55px; top: 55px;}'
  773.     );
  774.  
  775.     sheet.insertRule('.switch {'
  776.         + 'position: relative; '
  777.         + 'display: inline-block; '
  778.         + 'width: 34px; '
  779.         + 'height: 17px;}'
  780.     );
  781.  
  782.     sheet.insertRule('.slider {'
  783.         + 'position: absolute; '
  784.         + 'cursor: pointer; '
  785.         + 'top: 0; '
  786.         + 'left: 0; '
  787.         + 'right: 0; '
  788.         + 'bottom: 0; '
  789.         + 'background-color: #CCCCCC; '
  790.         + '-webkit-transition: .4s; '
  791.         + 'transition: .4s; '
  792.         + 'border-radius: 17px; '
  793.         + 'margin-right: 4px;}'
  794.     );
  795.  
  796.     sheet.insertRule('.slider:before {'
  797.         + 'position: absolute; '
  798.         + 'content: \'\'; '
  799.         + 'height: 13px; '
  800.         + 'width: 13px; '
  801.         + 'left: 2px; '
  802.         + 'bottom: 2px; '
  803.         + 'background-color: white; '
  804.         + '-webkit-transition: .4s; '
  805.         + 'transition: .4s; '
  806.         + 'border-radius: 50%;}'
  807.     );
  808.  
  809.     sheet.insertRule('input:checked + .slider {'
  810.         + 'background-color: #F11F64;}'
  811.     );
  812.  
  813.     sheet.insertRule('input:checked + .slider:before {'
  814.         + '-webkit-transform: translateX(13px); '
  815.         + '-ms-transform: translateX(13px); '
  816.         + 'transform: translateX(13px);}'
  817.     );
  818. }
  819.  
  820. /* =====================
  821.     HOME SCREEN REFRESH
  822.    ===================== */
  823.  
  824. function moduleRefresh() {
  825.     setInterval(function() {
  826.         window.location.reload();
  827.     }, 600000);
  828. }
  829.  
  830. /* ======================
  831.     FIGHT A VILLAIN MENU
  832.    ====================== */
  833.  
  834. function moduleVillain() {
  835.     //Create localStorage if it doesn't exist yet
  836.     if (localStorage.getItem('eventTrolls') === null) {
  837.         localStorage.setItem('eventTrolls', '[]');
  838.     }
  839.     if (localStorage.getItem('tierGirlsOwned') === null) {
  840.         localStorage.setItem('tierGirlsOwned', '[[], [], [], [], [], [], [], [], [], [], [], [], []]');
  841.     }
  842.  
  843.     var eventTrolls = JSON.parse(localStorage.getItem('eventTrolls'));
  844.     var tierGirlsOwned = JSON.parse(localStorage.getItem('tierGirlsOwned'));
  845.     var includeTiers = false;
  846.  
  847.     if (localStorage.getItem('HHS.tiers') === '1') {
  848.             includeTiers = true;
  849.     }
  850.  
  851.     if (currentPage.indexOf('home') != -1) {
  852.  
  853.         //Check if event girls have been collected
  854.         eventTrolls = [];
  855.         if (typeof event_data !== 'undefined') {
  856.             event_data.girls.forEach(function(girl) {
  857.                 if (girl.troll !== null) {
  858.                     if (girl.shards !== 100) {
  859.                         eventTrolls.push(girl.troll.id_troll);
  860.                     }
  861.                 }
  862.             });
  863.         }
  864.         localStorage.setItem('eventTrolls', JSON.stringify(eventTrolls));
  865.  
  866.         if (includeTiers) {
  867.             //Check if villain tier girls have been collected
  868.             tierGirlsOwned = [[], [], [], [], [], [], [], [], [], [], [], [], []];
  869.  
  870.             for (var tIdx = 0; tIdx < tierGirlsID.length; tIdx++) {
  871.                 for (var gIdx = 0; gIdx < 5; gIdx++) {
  872.                     if (girlsDataList.hasOwnProperty(tierGirlsID[tIdx][gIdx]) || tierGirlsID[tIdx][gIdx] == 0) {
  873.                         tierGirlsOwned[tIdx][gIdx] = true;
  874.                     }
  875.                     else {
  876.                         tierGirlsOwned[tIdx][gIdx] = false;
  877.                     }
  878.                 }
  879.             }
  880.             localStorage.setItem('tierGirlsOwned', JSON.stringify(tierGirlsOwned));
  881.         }
  882.     }
  883.  
  884.     //Add the actual menu
  885.     var trolls = ['Dark Lord', 'Ninja Spy', 'Gruntt', 'Edwarda', 'Donatien', 'Silvanus', 'Bremen', 'Finalmecia', 'Roko Senseï', 'Karole', 'Jackson&#8217;s Crew', 'Pandora Witch', 'Nike'];
  886.     if (lang == 'fr') {
  887.         trolls[1] = 'Espion Ninja';
  888.         trolls[10] = 'Éq. de Jackson';
  889.         trolls[11] = 'Sorcière Pandora';
  890.     }
  891.     if (lang == 'es') {
  892.         trolls[0] = 'Señor Oscuro';
  893.         trolls[1] = 'Ninja espía';
  894.     }
  895.     if (lang == 'it') {
  896.         trolls[0] = 'Signore Oscuro';
  897.         trolls[1] = 'Spia Ninja';
  898.         trolls[10] ='Ciurma di Jackson';
  899.         trolls[11] ='Strega Pandora';
  900.     }
  901.     if (lang == 'de') {
  902.         trolls[0] = 'Dunkler Lord';
  903.     }
  904.  
  905.     var currentWorld = Hero.infos.questing.id_world - 1,
  906.         trollName = '',
  907.         trollNameTiers = '',
  908.         trollsMenu = '';
  909.  
  910.     for (var i = 0; i < currentWorld; i++) {
  911.         if (typeof trolls[i] !== typeof undefined && trolls[i] !== false) {
  912.             trollName = trolls[i];
  913.             if (includeTiers) {
  914.                 trollNameTiers = ' ';
  915.                 if (!(tierGirlsOwned[i][0] && tierGirlsOwned[i][1] && tierGirlsOwned[i][2])) {
  916.                     trollNameTiers = trollNameTiers + '&#185;';
  917.                 }
  918.                 if (!(tierGirlsOwned[i][3])) {
  919.                     trollNameTiers = trollNameTiers + '&#178;';
  920.                 }
  921.                 if (!(tierGirlsOwned[i][4])) {
  922.                     trollNameTiers = trollNameTiers + '&#179;';
  923.                 }
  924.             }
  925.         }
  926.         else trollName = texts[lang].world + ' ' + (i + 2) + ' ' + texts[lang].villain;
  927.         var type = 'regular';
  928.         for (var j = 0, len = eventTrolls.length; j < len; j++) {
  929.             if (eventTrolls[j] == (i + 1)) {
  930.                 type = 'eventTroll';
  931.             }
  932.         }
  933.         trollsMenu += '<a class="' + type + '" href="/battle.html?id_troll=' + (i + 1) + '">' + trollName + trollNameTiers + '</a><br />';
  934.     }
  935.  
  936.     $('#contains_all > header').children('[type=fight]').append('<div class="scriptInfo" id="FightTroll">' + texts[lang].fight_villain + '<span class="Arrow"></span><div class="TrollsMenu">' + trollsMenu + '</div></div>');
  937.  
  938.     //CSS
  939.     sheet.insertRule('.scriptInfo {'
  940.         + 'position: absolute; '
  941.         + 'z-index: 99; '
  942.         + 'width: 90%; '
  943.         + 'margin: 5px 0 0 13px; '
  944.         + 'border-radius: 8px 10px 10px 8px; '
  945.         + 'background-color: rgba(0,0,0,.8); '
  946.         + 'box-shadow: 0 0 0 1px rgba(255,255,255,0.73); '
  947.         + 'font-size: 12px; '
  948.         + 'font-weight: 400; '
  949.         + 'letter-spacing: .22px; '
  950.         + 'color: #fff; '
  951.         + 'text-align: center;}'
  952.     );
  953.  
  954.     sheet.insertRule('.scriptInfo a {'
  955.         + 'font-family: \'Carter One\', \'Alegreya Sans\', cursive !important; '
  956.         + 'color: rgb(255, 255, 255); '
  957.         + 'text-decoration: none;}'
  958.     );
  959.  
  960.     sheet.insertRule('#FightTroll {'
  961.         + 'width: 80%; '
  962.         + 'left: 20px;}'
  963.     );
  964.  
  965.     sheet.insertRule('.eventTroll {'
  966.         + 'color: #f70 !important;}'
  967.     );
  968.  
  969.     sheet.insertRule('.eventTroll:hover {'
  970.         + 'color: #fa0 !important;}'
  971.     );
  972.  
  973.     sheet.insertRule('#FightTroll > .Arrow {'
  974.         + 'float: right; '
  975.         + 'background-image: url("https://i.postimg.cc/d0cZtFPh/icon-arrow.png"); '
  976.         + 'background-size: 18px 18px; '
  977.         + 'background-repeat: no-repeat; '
  978.         + 'width: 18px; '
  979.         + 'height: 18px;}'
  980.     );
  981.  
  982.     sheet.insertRule('#FightTroll > .TrollsMenu {'
  983.         + 'position: absolute; '
  984.         + 'width: 88%; '
  985.         + 'margin-left: 6px; '
  986.         + 'border-radius: 0px 0 8px 8px; '
  987.         + 'background-color: rgba(0,0,0,.8); '
  988.         + 'line-height: 15px; '
  989.         + 'opacity: 0; '
  990.         + 'visibility: hidden; '
  991.         + 'transition: opacity 400ms, visibility 400ms;}'
  992.     );
  993.  
  994.     sheet.insertRule('#FightTroll:hover > .TrollsMenu {'
  995.         + 'opacity: 1; '
  996.         + 'visibility: visible;}'
  997.     );
  998.  
  999.     sheet.insertRule('#FightTroll a {'
  1000.         + 'color: rgb(255, 255, 255); '
  1001.         + 'text-decoration: none;}'
  1002.     );
  1003.  
  1004.     sheet.insertRule('#FightTroll a:hover {'
  1005.         + 'color: rgb(255, 247, 204); '
  1006.         + 'text-decoration: underline;}'
  1007.     );
  1008. }
  1009.  
  1010. /* ===========
  1011.     BETTER XP
  1012.    =========== */
  1013.  
  1014. function moduleXP() {
  1015.     function betterXP() {
  1016.         $('span[hero="xp"]').empty().append('Next: ');
  1017.         $('span[hero="xp_sep"]').empty().append(nThousand(Hero.infos.Xp.left));
  1018.         $('span[hero="xp_max"]').empty().append(' XP');
  1019.     };
  1020.  
  1021.     betterXP();
  1022.  
  1023.     $('.button_glow').click(function() {
  1024.         setInterval(function() {
  1025.             betterXP();
  1026.         }, 3000)
  1027.     });
  1028. }
  1029.  
  1030. /* ==============
  1031.     BETTER MONEY
  1032.    ============== */
  1033.  
  1034. function moduleMoney() {
  1035.     function betterMoney() {
  1036.         $('div[hero="soft_currency"]').empty().append(nRounding(Hero.infos.soft_currency, 2, -1));
  1037.     };
  1038.  
  1039.     betterMoney();
  1040.  
  1041.     $('.button_glow').click(function() {
  1042.         setInterval(function() {
  1043.             betterMoney();
  1044.         }, 3000)
  1045.     });
  1046.  
  1047.     $('#collect_all').click(function() {
  1048.         setInterval(function() {
  1049.             betterMoney();
  1050.         }, 3000)
  1051.     });
  1052.  
  1053.     $('.collect_money').click(function() {
  1054.         setInterval(function() {
  1055.             betterMoney();
  1056.         }, 3000)
  1057.     });
  1058. }
  1059.  
  1060. /* ====================
  1061.     MARKET INFORMATION
  1062.    ==================== */
  1063.  
  1064. function moduleMarket() {
  1065.     var loc2 = $('.hero_stats').children();
  1066.     loc2.each(function() {
  1067.         var stat = $(this).attr('hero');
  1068.         if (stat == 'carac1' || stat == 'carac2' || stat == 'carac3') {
  1069.             $(this).append('<span class="CustomStats"></span><div id="CustomStats' + stat + '" class="StatsTooltip"></div>');
  1070.         }
  1071.     });
  1072.  
  1073.     updateStats();
  1074.  
  1075.     function updateStats() {
  1076.         var loc2 = $('.hero_stats').children();
  1077.         var last_cost = 0,
  1078.             levelMoney = 0,
  1079.             levelPoints = Hero.infos.level * 30;
  1080.         levelMoney = calculateTotalPrice(levelPoints);
  1081.         loc2.each(function() {
  1082.             var stat = $(this).attr('hero');
  1083.             $('.CustomStats').html('');
  1084.             if (stat == 'carac1' || stat == 'carac2' || stat == 'carac3') {
  1085.                 var boughtPoints = Hero.infos[stat],
  1086.                     remainingPoints = levelPoints - boughtPoints,
  1087.                     spentMoney = calculateTotalPrice(boughtPoints),
  1088.                     remainingMoney = levelMoney - spentMoney;
  1089.  
  1090.                 var totalPoints = Hero.infos.caracs[stat],
  1091.                     skillPoints = Hero.infos.caracs['stat' + stat.substr(5)] - boughtPoints;
  1092.  
  1093.                 var equipmentsData = $('.armor#equiped .armor').children(),
  1094.                     itemPoints = 0;
  1095.                 equipmentsData.each(function() {
  1096.                     var equipmentsStats = $(this).attr('data-d'),
  1097.                         statPosStart = equipmentsStats.indexOf(stat + '_equip') + 15,
  1098.                         statPosEnd = equipmentsStats.substr(statPosStart).indexOf(',');
  1099.                     itemPoints = itemPoints + parseInt(equipmentsStats.substr(statPosStart, statPosEnd - 1));
  1100.                 });
  1101.  
  1102.                 var boostersData = $('.armor#equiped .sub_block .booster').children(),
  1103.                     ginsengPoints = 0,
  1104.                     ginsengLegendary = 0;
  1105.                 boostersData.each(function() {
  1106.                     if ($(this).attr('class') != 'slot empty') {
  1107.                         if ($(this).attr('id_item') == '7') {
  1108.                             ginsengPoints = ginsengPoints + 100;
  1109.                         }
  1110.                         else if ($(this).attr('id_item') == '8') {
  1111.                             ginsengPoints = ginsengPoints + 350;
  1112.                         }
  1113.                         else if ($(this).attr('id_item') == '9') {
  1114.                             ginsengPoints = ginsengPoints + 1225;
  1115.                         }
  1116.                         else if ($(this).attr('id_item') == '316') {
  1117.                             ginsengLegendary = ginsengLegendary + 1;
  1118.                         }
  1119.                     }
  1120.                 });
  1121.                 ginsengPoints = ginsengPoints + Math.ceil((skillPoints + boughtPoints + itemPoints + ginsengPoints) * 0.06 * ginsengLegendary);
  1122.  
  1123.                 var clubPoints = totalPoints - skillPoints - boughtPoints - itemPoints - ginsengPoints;
  1124.  
  1125.                 $('#CustomStats' + stat).html(
  1126.                     '<b>' + texts[lang].stat_points_need + ':</b> ' + nThousand(remainingPoints) + '<br />' +
  1127.                     '<b>' + texts[lang].money_need + ':</b> ' + nThousand(remainingMoney) + '<br />' +
  1128.                     '<b>' + texts[lang].money_spent + ':</b> ' + nThousand(spentMoney) + '<br /><br />' +
  1129.                     '<b>' + texts[lang].points_from_level + ':</b> ' + nThousand(skillPoints) + '<br />' +
  1130.                     '<b>' + texts[lang].bought_points + ':</b> ' + nThousand(boughtPoints) + '<br />' +
  1131.                     '<b>' + texts[lang].equipment_points + ':</b> ' + nThousand(itemPoints) + '<br />' +
  1132.                     '<b>' + texts[lang].ginseng_points + ':</b> ' + nThousand(ginsengPoints) + '<br />' +
  1133.                     '<b>' + texts[lang].club_points + ':</b> ' + nThousand(clubPoints) + '<br />'
  1134.                 );
  1135.             }
  1136.         });
  1137.     }
  1138.  
  1139.     function calculateTotalPrice(points) {
  1140.         var last_price = calculateStatPrice(points);
  1141.         var price = 0;
  1142.         if (points < 2000) {
  1143.             price = (7 + last_price) / 2 * points;
  1144.         }
  1145.         else if (points < 4000) {
  1146.             price = 4012000 + (4009 + last_price) / 2 * (points - 2000);
  1147.         }
  1148.         else if (points < 6000) {
  1149.             price = 20026000 + (12011 + last_price) / 2 * (points - 4000);
  1150.         }
  1151.         else if (points < 8000) {
  1152.             price = 56042000 + (24013 + last_price) / 2 * (points - 6000);
  1153.         }
  1154.         else if (points < 10000) {
  1155.             price = 120060000 + (40015 + last_price) / 2 * (points - 8000);
  1156.         }
  1157.         else if (points < 12000) {
  1158.             price = 220080000 + (60017 + last_price) / 2 * (points - 10000);
  1159.         }
  1160.         else if (points < 14000) {
  1161.             price = 364102000 + (84019 + last_price) / 2 * (points - 12000);
  1162.         }
  1163.         else if (points < 16000) {
  1164.             price = 560126000 + (112021 + last_price) / 2 * (points - 14000);
  1165.         }
  1166.         return price;
  1167.     }
  1168.  
  1169.     function calculateStatPrice(points) {
  1170.         var cost = 0;
  1171.         if (points < 2000) {
  1172.             cost = 5 + points * 2;
  1173.         }
  1174.         else if (points < 4000) {
  1175.             cost = 4005 + (points - 2000) * 4;
  1176.         }
  1177.         else if (points < 6000) {
  1178.             cost = 12005 + (points - 4000) * 6;
  1179.         }
  1180.         else if (points < 8000) {
  1181.             cost = 24005 + (points - 6000) * 8;
  1182.         }
  1183.         else if (points < 10000) {
  1184.             cost = 40005 + (points - 8000) * 10;
  1185.         }
  1186.         else if (points < 12000) {
  1187.             cost = 60005 + (points - 10000) * 12;
  1188.         }
  1189.         else if (points < 14000) {
  1190.             cost = 84005 + (points - 12000) * 14;
  1191.         }
  1192.         else if (points < 16000) {
  1193.             cost = 112005 + (points - 14000) * 16;
  1194.         }
  1195.         return cost;
  1196.     }
  1197.  
  1198.     var lsMarket = {};
  1199.     lsMarket.buyable = {};
  1200.     lsMarket.stocks = {};
  1201.     lsMarket.restock = {};
  1202.  
  1203.     setTimeout(function() {
  1204.         var restocktime = 0;
  1205.         var time = $('#shop > .shop_count > span').text();
  1206.         if (time.indexOf('h') > -1) {
  1207.             restocktime = parseInt(time.substring(0, time.indexOf('h'))) * 3600;
  1208.             time = time.substring(time.indexOf('h') + 1);
  1209.         }
  1210.         if (time.indexOf('m') > -1) {
  1211.             restocktime += parseInt(time.substring(0, time.indexOf('m'))) * 60;
  1212.             time = time.substring(time.indexOf('h') + 1);
  1213.         }
  1214.         if (time.indexOf('s') > -1) {
  1215.             restocktime += parseInt(time.substring(0, time.indexOf('s')));
  1216.         }
  1217.  
  1218.         lsMarket.restock.herolvl = Hero.infos.level;
  1219.         lsMarket.restock.time = (new Date()).getTime() + restocktime * 1000;
  1220.  
  1221.         get_buyableStocks('potion');
  1222.         get_buyableStocks('gift');
  1223.         equipments_shop(0);
  1224.         boosters_shop(0);
  1225.         books_shop(0);
  1226.         gifts_shop(0);
  1227.     }, 500);
  1228.  
  1229.     var timer;
  1230.     $('#shop > button, #inventory > button').click(function() {
  1231.         var clickedButton = $(this).attr('rel'),
  1232.             opened_shop = $('#shop').children('.selected');
  1233.         clearTimeout(timer);
  1234.         timer = setTimeout(function() {
  1235.             if (opened_shop.hasClass('armor')) {
  1236.                 equipments_shop(1);
  1237.             }
  1238.             else if (opened_shop.hasClass('booster')) {
  1239.                 boosters_shop(1);
  1240.             }
  1241.             else if (opened_shop.hasClass('potion')) {
  1242.                 if (clickedButton == 'buy' || clickedButton == 'shop_reload') get_buyableStocks('potion');
  1243.                 books_shop(1);
  1244.             }
  1245.             else if (opened_shop.hasClass('gift')) {
  1246.                 if (clickedButton == 'buy' || clickedButton == 'shop_reload') get_buyableStocks('gift');
  1247.                 gifts_shop(1);
  1248.             }
  1249.         }, 500);
  1250.     });
  1251.  
  1252.     function get_buyableStocks(loc_class) {
  1253.         var itemsNb = 0,
  1254.             itemsXp = 0,
  1255.             itemsPrice = 0,
  1256.             loc = $('#shop').children('.' + loc_class);
  1257.         loc.find('.slot').each(function() {
  1258.             if ($(this).hasClass('empty')) return false;
  1259.             var item = $(this).data('d');
  1260.             itemsNb++;
  1261.             itemsXp += parseInt(item.value, 10);
  1262.             itemsPrice += parseInt(item.price, 10);
  1263.         });
  1264.         lsMarket.buyable[loc_class] = {'Nb':itemsNb, 'Xp':itemsXp, 'Value':itemsPrice};
  1265.     }
  1266.  
  1267.     function equipments_shop(update) {
  1268.         tt_create(update, 'armor', 'EquipmentsTooltip', 'equipments', '');
  1269.     }
  1270.     function boosters_shop(update) {
  1271.         tt_create(update, 'booster', 'BoostersTooltip', 'boosters', '');
  1272.     }
  1273.     function books_shop(update) {
  1274.         tt_create(update, 'potion', 'BooksTooltip', 'books', 'Xp');
  1275.     }
  1276.     function gifts_shop(update) {
  1277.         tt_create(update, 'gift', 'GiftsTooltip', 'gifts', 'affection');
  1278.     }
  1279.  
  1280.     function tt_create(update, loc_class, tt_class, itemName, itemUnit) {
  1281.         var itemsNb = 0,
  1282.             itemsXp = (itemUnit === '') ? -1 : 0,
  1283.             itemsSell = 0,
  1284.             loc = $('#inventory').children('.' + loc_class);
  1285.  
  1286.         loc.find('.slot').each(function() {
  1287.             if ($(this).hasClass('empty')) return false;
  1288.             var item = $(this).data('d'),
  1289.                 Nb = parseInt(item.count, 10);
  1290.             itemsNb += Nb;
  1291.             itemsSell += Nb * parseInt(item.price_sell, 10);
  1292.             if (itemsXp != -1) itemsXp += Nb * parseInt(item.value, 10);
  1293.         });
  1294.  
  1295.         var tooltip = texts[lang].you_own + ' <b>' + nThousand(itemsNb) + '</b> ' + texts[lang][itemName] + '.<br />' +
  1296.             (itemsXp == -1 ? '' : texts[lang].you_can_give + ' <b>' + nThousand(itemsXp) + '</b> ' + texts[lang][itemUnit] + '.<br />') +
  1297.             texts[lang].you_can_sell + ' <b>' + nThousand(itemsSell) + '</b> <span class="imgMoney"></span>.';
  1298.  
  1299.         lsMarket.stocks[loc_class] = (loc_class == 'potion' || loc_class == 'gift') ? {'Nb':itemsNb, 'Xp':itemsXp} : {'Nb':itemsNb};
  1300.         localStorage.setItem('lsMarket', JSON.stringify(lsMarket));
  1301.  
  1302.         if (update === 0) {
  1303.             loc.prepend('<span class="CustomTT"></span><div class="' + tt_class + '">' + tooltip + '</div>');
  1304.         }
  1305.         else {
  1306.             loc.children('.' + tt_class).html(tooltip);
  1307.         }
  1308.     }
  1309.     $('plus').on('click', function (event) {
  1310.         var stat = 'carac' + $(this).attr('for_carac');
  1311.         Hero.infos[stat]++;
  1312.         timer = setTimeout(function() {
  1313.             updateStats();
  1314.         }, 400);
  1315.     });
  1316.  
  1317.     //CSS
  1318.     sheet.insertRule('#inventory .CustomTT {'
  1319.         + 'float: right; '
  1320.         + 'margin: 11px 1px 0 0; '
  1321.         + 'background-image: url("https://i.postimg.cc/qBDt6yHV/icon-question.png"); '
  1322.         + 'background-size: 20px 20px; '
  1323.         + 'width: 20px; '
  1324.         + 'height: 20px;}'
  1325.     );
  1326.  
  1327.     sheet.insertRule('#inventory .CustomTT:hover {'
  1328.         + 'cursor: help;}'
  1329.     );
  1330.  
  1331.     sheet.insertRule('#inventory .CustomTT:hover + div {'
  1332.         + 'opacity: 1; '
  1333.         + 'visibility: visible;}'
  1334.     );
  1335.  
  1336.     sheet.insertRule('#inventory .EquipmentsTooltip, #inventory .BoostersTooltip, #inventory .BooksTooltip, #inventory .GiftsTooltip {'
  1337.         + 'position: absolute; '
  1338.         + 'z-index: 99; '
  1339.         + 'width: 240px; '
  1340.         + 'border: 1px solid rgb(162, 195, 215); '
  1341.         + 'border-radius: 8px; '
  1342.         + 'box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.1); '
  1343.         + 'padding: 3px 7px 4px 7px; '
  1344.         + 'background-color: #F2F2F2; '
  1345.         + 'font: normal 10px/17px Tahoma, Helvetica, Arial, sans-serif; '
  1346.         + 'color: #057; '
  1347.         + 'opacity: 0; '
  1348.         + 'visibility: hidden; '
  1349.         + 'transition: opacity 400ms, visibility 400ms;}'
  1350.     );
  1351.  
  1352.     sheet.insertRule('#inventory .EquipmentsTooltip, #inventory .BoostersTooltip {'
  1353.         + 'margin: -33px 0 0 210px; '
  1354.         + 'height: 43px;}'
  1355.     );
  1356.  
  1357.     sheet.insertRule('#inventory .BooksTooltip, #inventory .GiftsTooltip {'
  1358.         + 'margin: -50px 0 0 210px; '
  1359.         + 'height: 60px;}'
  1360.     );
  1361.  
  1362.     sheet.insertRule('#inventory .EquipmentsTooltip b, #inventory .BoostersTooltip b, #inventory .BooksTooltip b, #inventory .GiftsTooltip b {'
  1363.         + 'font-weight: bold;}'
  1364.     );
  1365.  
  1366.     sheet.insertRule('#inventory .imgMoney {'
  1367.         + 'background-size: 12px 12px; '
  1368.         + 'background-repeat: no-repeat; '
  1369.         + 'width: 12px; '
  1370.         + 'height: 14px; '
  1371.         + 'vertical-align: text-bottom; '
  1372.         + 'background-image: url("https://i.postimg.cc/wv01VstN/icon-currency-ymen.png"); '
  1373.         + 'display: inline-block;}'
  1374.     );
  1375.  
  1376.     sheet.insertRule('.hero_stats .CustomStats:hover {'
  1377.         + 'cursor: help;}'
  1378.     );
  1379.  
  1380.     sheet.insertRule('.hero_stats .CustomStats {'
  1381.         + 'float: left; '
  1382.         + 'margin-left: -20px; '
  1383.         + 'margin-top: 0px; '
  1384.         + 'background-image: url("https://i.postimg.cc/qBDt6yHV/icon-question.png"); '
  1385.         + 'background-size: 18px 18px; '
  1386.         + 'background-position: center; '
  1387.         + 'background-repeat: no-repeat; '
  1388.         + 'width: 18px; '
  1389.         + 'height: 100%; '
  1390.         + 'visibility: none;}'
  1391.     );
  1392.  
  1393.     sheet.insertRule('.hero_stats .CustomStats:hover + div {'
  1394.         + 'opacity: 1; '
  1395.         + 'visibility: visible;}'
  1396.     );
  1397.  
  1398.     sheet.insertRule('.hero_stats .StatsTooltip {'
  1399.         + 'position: absolute; '
  1400.         + 'z-index: 99; '
  1401.         + 'margin: -50px 0 0 -50px; '
  1402.         + 'border: 1px solid rgb(162, 195, 215); '
  1403.         + 'border-radius: 8px; '
  1404.         + 'box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.1); '
  1405.         + 'padding: 2px 17px 2px 7px; '
  1406.         + 'background-color: #F2F2F2; '
  1407.         + 'font: normal 10px/17px Tahoma, Helvetica, Arial, sans-serif; '
  1408.         + 'text-align: left; '
  1409.         + 'white-space: nowrap; '
  1410.         + 'opacity: 0; '
  1411.         + 'visibility: hidden; '
  1412.         + 'transition: opacity 400ms, visibility 400ms;}'
  1413.     );
  1414.  
  1415.     sheet.insertRule('.hero_stats .StatsTooltip b {'
  1416.         + 'font-weight: bold;}'
  1417.     );
  1418. }
  1419.  
  1420. /* ===================
  1421.     HAREM INFORMATION
  1422.    =================== */
  1423.  
  1424. function moduleHarem() {
  1425.     var stats = [];
  1426.     var girlsList = [];
  1427.     var haremRight = $('#harem_right');
  1428.  
  1429.     stats.girls = 0;
  1430.     stats.hourlyMoney = 0;
  1431.     stats.allCollect = 0;
  1432.     stats.unlockedScenes = 0;
  1433.     stats.allScenes = 0;
  1434.     stats.rarities = {starting: 0, common: 0, rare: 0, epic: 0, legendary: 0};
  1435.     stats.caracs = {1: 0, 2: 0, 3: 0};
  1436.     stats.stars = {affection: 0, money: 0, kobans: 0};
  1437.     stats.xp = 0;
  1438.     stats.affection = 0;
  1439.     stats.money = 0;
  1440.     stats.kobans = 0;
  1441.  
  1442.     var GIRLS_EXP_LEVELS = [];
  1443.  
  1444.     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];
  1445.  
  1446.     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];
  1447.  
  1448.     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];
  1449.  
  1450.     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];
  1451.  
  1452.     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];
  1453.  
  1454.     var EvoReq = [];
  1455.  
  1456.     var starting = [];
  1457.     starting.push({affection: 90, money: 36000, kobans: 36, taffection: 90, tmoney: 36000, tkobans: 36});
  1458.     starting.push({affection: 225, money: 90000, kobans: 60, taffection: 315, tmoney: 126000, tkobans: 96});
  1459.     starting.push({affection: 563, money: 225000, kobans: 114, taffection: 878, tmoney: 351000, tkobans: 210});
  1460.     starting.push({affection: 1125, money: 450000, kobans: 180, taffection: 2003, tmoney: 801000, tkobans: 390});
  1461.     starting.push({affection: 2250, money: 900000, kobans: 300, taffection: 4253, tmoney: 1701000, tkobans: 690});
  1462.     EvoReq.starting = starting;
  1463.  
  1464.     var commonGirls = [];
  1465.     commonGirls.push({affection: 180, money: 72000, kobans: 72, taffection: 180, tmoney: 72000, tkobans: 72});
  1466.     commonGirls.push({affection: 450, money: 180000, kobans: 120, taffection: 630, tmoney: 252000, tkobans: 192});
  1467.     commonGirls.push({affection: 1125, money: 450000, kobans: 228, taffection: 1755, tmoney: 702000, tkobans: 420});
  1468.     commonGirls.push({affection: 2250, money: 900000, kobans: 360, taffection: 4005, tmoney: 1602000, tkobans: 780});
  1469.     commonGirls.push({affection: 4500, money: 1800000, kobans: 600, taffection: 8505, tmoney: 3402000, tkobans: 1380});
  1470.     EvoReq.common = commonGirls;
  1471.  
  1472.     var rareGirls = [];
  1473.     rareGirls.push({affection: 540, money: 216000, kobans: 216, taffection: 540, tmoney: 216000, tkobans: 216});
  1474.     rareGirls.push({affection: 1350, money: 540000, kobans: 360, taffection: 1890, tmoney: 756000, tkobans: 576});
  1475.     rareGirls.push({affection: 3375, money: 1350000, kobans: 678, taffection: 5265, tmoney: 2106000, tkobans: 1254});
  1476.     rareGirls.push({affection: 6750, money: 2700000, kobans: 1080, taffection: 12015, tmoney: 4806000, tkobans: 2334});
  1477.     rareGirls.push({affection: 13500, money: 5400000, kobans: 1800, taffection: 25515, tmoney: 10206000, tkobans: 4134});
  1478.     EvoReq.rare = rareGirls;
  1479.  
  1480.     var epicGirls = [];
  1481.     epicGirls.push({affection: 1260, money: 504000, kobans: 504, taffection: 1260, tmoney: 504000, tkobans: 504});
  1482.     epicGirls.push({affection: 3150, money: 1260000, kobans: 840, taffection: 4410, tmoney: 1764000, tkobans: 1344});
  1483.     epicGirls.push({affection: 7875, money: 3150000, kobans: 1578, taffection: 12285, tmoney: 4914000, tkobans: 2922});
  1484.     epicGirls.push({affection: 15750, money: 6300000, kobans: 2520, taffection: 28035, tmoney: 11214000, tkobans: 5442});
  1485.     epicGirls.push({affection: 31500, money: 12600000, kobans: 4200, taffection: 59535, tmoney: 23814000, tkobans: 9642});
  1486.     EvoReq.epic = epicGirls;
  1487.  
  1488.     var legendGirls = [];
  1489.     legendGirls.push({affection: 1800, money: 720000, kobans: 720, taffection: 1800, tmoney: 720000, tkobans: 720});
  1490.     legendGirls.push({affection: 4500, money: 1800000, kobans: 1200, taffection: 6300, tmoney: 2520000, tkobans: 1920});
  1491.     legendGirls.push({affection: 11250, money: 4500000, kobans: 2250, taffection: 17550, tmoney: 7020000, tkobans: 4170});
  1492.     legendGirls.push({affection: 22500, money: 9000000, kobans: 3600, taffection: 40050, tmoney: 16020000, tkobans: 7770});
  1493.     legendGirls.push({affection: 45000, money: 18000000, kobans: 6000, taffection: 85050, tmoney: 34020000, tkobans: 13770});
  1494.     EvoReq.legendary = legendGirls;
  1495.  
  1496.     for (var id in girlsDataList) {
  1497.         var girl = jQuery.extend(true, {}, girlsDataList[id]);
  1498.         if (girl.own) {
  1499.             stats.allCollect += girl.salary;
  1500.             stats.rarities[girl.rarity]++;
  1501.             stats.caracs[girl.class]++;
  1502.             stats.girls++;
  1503.             stats.hourlyMoney += Math.round(girl.salary_per_hour);
  1504.             stats.unlockedScenes += girl.graded;
  1505.             stats.allScenes += parseInt(girl.nb_grades);
  1506.             var nbgrades = parseInt(girl.nb_grades);
  1507.             if (girl.graded != nbgrades) {
  1508.                 stats.affection += EvoReq[girl.rarity][nbgrades - 1].taffection - girl.Affection.cur;
  1509.                 var currentLevelMoney = 0,
  1510.                     currentLevelKobans = 0;
  1511.                 if (girl.graded != 0) {
  1512.                     currentLevelMoney = EvoReq[girl.rarity][girl.graded - 1].tmoney;
  1513.                     currentLevelKobans = EvoReq[girl.rarity][girl.graded - 1].tkobans;
  1514.                 }
  1515.                 stats.money += EvoReq[girl.rarity][nbgrades - 1].tmoney - currentLevelMoney;
  1516.                 if (hh_nutaku) {
  1517.                     stats.kobans += Math.ceil((EvoReq[girl.rarity][nbgrades - 1].tkobans - currentLevelKobans) / 6);
  1518.                 }
  1519.                 else {
  1520.                     stats.kobans += EvoReq[girl.rarity][nbgrades - 1].tkobans - currentLevelKobans;
  1521.                 }
  1522.             }
  1523.  
  1524.             var expToMax = (GIRLS_EXP_LEVELS[girl.rarity][Hero.infos.level - 2] - girl.Xp.cur);
  1525.             if (expToMax < 0) expToMax = 0;
  1526.             stats.xp += expToMax;
  1527.         }
  1528.     }
  1529.  
  1530.     try {
  1531.         var lsMarket = JSON.parse(localStorage.getItem('lsMarket')),
  1532.             d = new Date(lsMarket.restock.time),
  1533.             RestockInfo;
  1534.  
  1535.         if (new Date() > lsMarket.restock.time || Hero.infos.level > lsMarket.restock.herolvl) {
  1536.  
  1537.             RestockInfo = '> The <a href="../shop.html">Market</a> restocked since your last visit.';
  1538.         }
  1539.         else {
  1540.             var marketBookTxt = lsMarket.buyable.potion.Nb + ' ' + texts[lang].books + ' (' + nThousand(lsMarket.buyable.potion.Xp) + ' ' + texts[lang].Xp + ')',
  1541.                 marketGiftTxt = lsMarket.buyable.gift.Nb + ' ' + texts[lang].gifts + ' (' + nThousand(lsMarket.buyable.gift.Xp) + ' ' + texts[lang].affection + ')';
  1542.             RestockInfo = '- ' + marketBookTxt + ' = ' + nThousand(lsMarket.buyable.potion.Value) + ' <span class="imgMoney"></span>'
  1543.                 + '<br />- ' + marketGiftTxt + ' = ' + nThousand(lsMarket.buyable.gift.Value) + ' <span class="imgMoney"></span>'
  1544.                 + '<br /><font style="color: gray;">' + texts[lang].restock + ': ' + d.toLocaleString() + ' (' + texts[lang].or_level + ' ' + (Hero.infos.level+1) + ')</font>';
  1545.         }
  1546.  
  1547.         var myArmorTxt = nThousand(lsMarket.stocks.armor.Nb) + (lsMarket.stocks.armor.Nb > 99 ? '+ ' : ' ') + ' ' + texts[lang].equipments,
  1548.             myBoosterTxt = nThousand(lsMarket.stocks.booster.Nb) + ' ' + texts[lang].boosters,
  1549.             myBookTxt = nThousand(lsMarket.stocks.potion.Nb) + ' ' + texts[lang].books + ' (' + nThousand(lsMarket.stocks.potion.Xp) + ' ' + texts[lang].Xp + ')',
  1550.             myGiftTxt = nThousand(lsMarket.stocks.gift.Nb) + ' ' + texts[lang].gifts + ' (' + nThousand(lsMarket.stocks.gift.Xp) + ' ' + texts[lang].affection + ')',
  1551.             MarketStocks = '- ' + myArmorTxt + ', ' + myBoosterTxt
  1552.         + '<br />- ' + myBookTxt
  1553.         + '<br />- ' + myGiftTxt
  1554.         + '<span class="subTitle">' + texts[lang].currently_buyable + ':</span>'
  1555.         + RestockInfo;
  1556.     } catch(e) {
  1557.         MarketStocks = (lsAvailable == 'yes') ? '> ' + texts[lang].visit_the : '> ' + texts[lang].not_compatible;
  1558.     }
  1559.  
  1560.     var StatsString = '<div class="StatsContent"><span class="Title">' + texts[lang].harem_stats + ':</span>' +
  1561.         '<span class="subTitle" style="margin-top: -10px;">' + stats.girls + ' ' + texts[lang].haremettes + ':</span>' +
  1562.         '- ' + stats.caracs[1] + ' ' + texts[lang].hardcore + ', ' + stats.caracs[2] + ' ' + texts[lang].charm + ', ' + stats.caracs[3] + ' ' + texts[lang].know_how + '<br />- '
  1563.     + (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 />- '
  1564.     + nThousand(parseInt(document.getElementsByClassName('focus_text')[0].innerHTML.replace(/\D/g, ''))) + '/' + nThousand(Hero.infos.level * stats.girls) + ' ' + texts[lang].harem_level + ' (' + nThousand(Hero.infos.level * stats.girls - parseInt(document.getElementsByClassName('focus_text')[0].innerHTML.replace(/\D/g, ''))) + ' ' + texts[lang].to_go + ')<br />- '
  1565.     + stats.unlockedScenes + '/' + stats.allScenes + ' ' + texts[lang].unlocked_scenes + ' (' + nThousand(stats.allScenes - stats.unlockedScenes) + ' ' + texts[lang].to_go + ')'
  1566.     + '<span class="subTitle">' + texts[lang].money_income + ':</span>'
  1567.     + '~' + nThousand(stats.hourlyMoney) + ' <span class="imgMoney"></span> ' + texts[lang].per_hour
  1568.     + '<br />' + nThousand(stats.allCollect) + ' <span class="imgMoney"></span> ' + texts[lang].when_all_collectable
  1569.     + '<span class="subTitle">' + texts[lang].required_to_unlock + ':</span>'
  1570.     + addPriceRow('', stats.affection, stats.money, stats.kobans)
  1571.     + '<span class="subTitle">' + texts[lang].required_to_get_max_level + ':</span>'
  1572.     + nThousand(stats.xp) + ' ' + texts[lang].Xp + ' (' + nThousand(stats.xp * 200) + ' <span class="imgMoney"></span>) <br />'
  1573.     + '<span class="subTitle">' + texts[lang].my_stocks + ':</span>'
  1574.     + MarketStocks
  1575.     + '</div>';
  1576.  
  1577.     $('#harem_left').append('<div id="CustomBar">'
  1578.                             + '<img f="stats" src="https://i.postimg.cc/8cYj8QmP/icon-info.png">'
  1579.                             + '</div>'
  1580.                             + '<div id="TabsContainer">' + StatsString + '</div>');
  1581.  
  1582.     var TabsContainer = $('#TabsContainer');
  1583.     var Stats = TabsContainer.children('.StatsContent');
  1584.  
  1585.     $('body').click(function(e) {
  1586.         var clickOn = e.target.getAttribute('f');
  1587.         switch (clickOn) {
  1588.             case 'stats':
  1589.                 toggleTabs(Stats);
  1590.                 break;
  1591.             default:
  1592.                 var clickedContainer = $(e.target).closest('[id]').attr('id');
  1593.                 if (clickedContainer == 'TabsContainer') return;
  1594.                 TabsContainer.fadeOut(400);
  1595.         }
  1596.     });
  1597.  
  1598.     function toggleTabs(tabIn) {
  1599.         if (TabsContainer.css('display') == 'block') {
  1600.             setTimeout(function() { tabIn.fadeIn(300); }, 205);
  1601.             TabsContainer.fadeOut(400);
  1602.         }
  1603.         else {
  1604.             tabIn.toggle(true);
  1605.             TabsContainer.fadeIn(400);
  1606.         }
  1607.     }
  1608.  
  1609.     function addPriceRow(rowName, affection, money, kobans) {
  1610.         return '<b>' + rowName + '</b> ' +
  1611.             nThousand(affection) + ' ' + texts[lang].affection + ' (' + nThousand(affection * 417) + ' <span class="imgMoney"></span>) ' + texts[lang].and + ' <br />' +
  1612.             nThousand(money) + ' <span class="imgMoney"></span> ' + texts[lang].or + ' ' +
  1613.             nThousand(kobans) + ' <span class="imgKobans"></span><br />';
  1614.     }
  1615.  
  1616.     function addPriceRowGirl(rowName, affection, money, kobans) {
  1617.         return '<b>' + rowName + ':</b> ' +
  1618.             nThousand(affection) + ' ' + texts[lang].affection + ' (' + nThousand(affection * 417) + ' <span class="imgMoney"></span>) ' + texts[lang].and + ' ' +
  1619.             nThousand(money) + ' <span class="imgMoney"></span> ' + texts[lang].or + ' ' +
  1620.             nThousand(kobans) + ' <span class="imgKobans"></span><br />';
  1621.     }
  1622.  
  1623.     $('.girls_list div[id_girl]').click(function() {
  1624.         updateInfo();
  1625.     });
  1626.  
  1627.     updateInfo();
  1628.  
  1629.     function updateInfo() {
  1630.         setTimeout(function () {
  1631.             haremRight.children('[girl]').each(function() {
  1632.                 var girl = girlsDataList[$(this).attr('girl')];
  1633.  
  1634.                 if (!girl.own) {
  1635.                     if (HH_UNIVERSE == 'gay') {
  1636.                         $(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>');
  1637.                     }
  1638.                     else if (lang == 'fr') {
  1639.                         $(this).find('p').after('<div class="WikiLinkDialogbox"><a href="http://hentaiheroes.wikidot.com/' + girl.Name + '" target="_blank"> ' + texts[lang].wiki + girl.Name + ' </a></div>');
  1640.                     }
  1641.                     else {
  1642.                         $(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>');
  1643.                     }
  1644.                 }
  1645.                 if (girl.own) {
  1646.                     if (HH_UNIVERSE == 'gay') {
  1647.                         $(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>');
  1648.                     }
  1649.                     else if (lang == 'fr') {
  1650.                         $(this).find('h3').after('<div class="WikiLink"><a href="http://hentaiheroes.wikidot.com/' + girl.Name + '" target="_blank"> ' + texts[lang].wiki + girl.Name + ' </a></div>');
  1651.                     }
  1652.                     else {
  1653.                         $(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>');
  1654.                     }
  1655.                 }
  1656.                 var j = 0,
  1657.                     FirstLockedScene = 1,
  1658.                     AffectionTT = texts[lang].evolution_costs + ':<br />',
  1659.                     ScenesLink = '',
  1660.                     girl_quests = $(this).find('.girl_quests');
  1661.                 girl_quests.find('g').each(function() {
  1662.  
  1663.                     j++;
  1664.                     var aff = 0,
  1665.                         money = 0,
  1666.                         kobans = 0;
  1667.                     var currentLevelMoney = 0,
  1668.                         currentLevelKobans = 0;
  1669.                     if (girl.graded != 0) {
  1670.                         currentLevelMoney = EvoReq[girl.rarity][girl.graded - 1].tmoney;
  1671.                         currentLevelKobans = EvoReq[girl.rarity][girl.graded - 1].tkobans;
  1672.                     }
  1673.                     if (girl.graded >= j) {
  1674.                     }
  1675.                     else if ((girl.graded + 1) == j && girl.Affection.level == j) {
  1676.                         money = EvoReq[girl.rarity][j - 1].tmoney - currentLevelMoney;
  1677.                         if (hh_nutaku) {
  1678.                             kobans = Math.ceil((EvoReq[girl.rarity][j - 1].tkobans - currentLevelKobans) / 6);
  1679.                         }
  1680.                         else {
  1681.                             kobans = EvoReq[girl.rarity][j - 1].tkobans - currentLevelKobans;
  1682.                         }
  1683.                     }
  1684.                     else {
  1685.                         aff = EvoReq[girl.rarity][j - 1].taffection - girl.Affection.cur;
  1686.                         money = EvoReq[girl.rarity][j - 1].tmoney - currentLevelMoney;
  1687.                         if (hh_nutaku) {
  1688.                             kobans = Math.ceil((EvoReq[girl.rarity][j - 1].tkobans - currentLevelKobans) / 6);
  1689.                         }
  1690.                         else {
  1691.                             kobans = EvoReq[girl.rarity][j - 1].tkobans - currentLevelKobans;
  1692.                         }
  1693.                     }
  1694.                     AffectionTT += addPriceRowGirl(j + '</b><span class="imgStar"></span>', aff, money, kobans);
  1695.                     ScenesLink += (ScenesLink === '') ? 'hh_scenes=' : ',';
  1696.                     var SceneHref = $(this).parent().attr('href');
  1697.                     if ($(this).hasClass('grey') || $(this).hasClass('green')) {
  1698.                         if (FirstLockedScene === 0) {
  1699.                             ScenesLink += '0';
  1700.                         }
  1701.                         else {
  1702.                             FirstLockedScene = 0;
  1703.                             var XpLeft = girl_quests.parent().parent().children('.girl_exp_left');
  1704.                             var isUpgradable = girl_quests.parent().children('.green_text_button');
  1705.                             ScenesLink += (isUpgradable.length) ? '0.' + isUpgradable.attr('href').substr(7) : '0';
  1706.                         }
  1707.                     }
  1708.                     else {
  1709.                         var attrHref = $(this).parent().attr('href');
  1710.                         if (typeof attrHref != 'undefined') {
  1711.                             ScenesLink += attrHref.substr(7);
  1712.                         }
  1713.                     }
  1714.                 });
  1715.  
  1716.                 girl_quests.children('a').each(function() {
  1717.                     var attr = $(this).attr('href');
  1718.                     if (typeof attr !== typeof undefined && attr !== false) {
  1719.                         $(this).attr('href', attr + '?' + ScenesLink);
  1720.                     }
  1721.                 });
  1722.                 ScenesLink = '';
  1723.  
  1724.                 girl_quests.parent().children('h4').prepend('<span class="CustomTT"></span><div class="AffectionTooltip">' + AffectionTT + '</div>');
  1725.  
  1726.             });
  1727.         }, 50);
  1728.     }
  1729.  
  1730.     //CSS
  1731.     sheet.insertRule('#harem_left .HaremetteNb {'
  1732.         + 'float: right; '
  1733.         + 'line-height: 14px; '
  1734.         + 'font-size: 12px;}'
  1735.     );
  1736.  
  1737.     sheet.insertRule('#CustomBar {'
  1738.         + 'z-index: 99; '
  1739.         + 'width: 100%; '
  1740.         + 'padding: 3px 10px 0 3px; '
  1741.         + 'font: bold 10px Tahoma, Helvetica, Arial, sans-serif; '
  1742.         + 'position: absolute; bottom: 3px; left: 0px;}'
  1743.     );
  1744.  
  1745.     sheet.insertRule('#CustomBar img {'
  1746.         + 'width: 20px; '
  1747.         + 'height: 20px; '
  1748.         + 'margin-right: 3px; '
  1749.         + 'margin-bottom: 3px; '
  1750.         + 'opacity: 0.5;}'
  1751.     );
  1752.  
  1753.     sheet.insertRule('#CustomBar img:hover {'
  1754.         + 'opacity: 1; '
  1755.         + 'cursor: pointer;}'
  1756.     );
  1757.  
  1758.     sheet.insertRule('#CustomBar .TopBottomLinks {'
  1759.         + 'float: right; '
  1760.         + 'margin-top: 2px;}'
  1761.     );
  1762.  
  1763.     sheet.insertRule('#CustomBar a, #TabsContainer a {'
  1764.         + 'color: #008; '
  1765.         + 'text-decoration: none;}'
  1766.     );
  1767.  
  1768.     sheet.insertRule('#harem_whole .WikiLink a {'
  1769.         + 'color: #87CEFA; '
  1770.         + 'text-decoration: none;}'
  1771.     );
  1772.  
  1773.     sheet.insertRule('#CustomBar a:hover, #TabsContainer a:hover, #harem_right .WikiLink a:hover {'
  1774.         + 'color: #B14; '
  1775.         + 'text-decoration: underline;}'
  1776.     );
  1777.  
  1778.     sheet.insertRule('#TabsContainer {'
  1779.         + 'z-index: 99; '
  1780.         + 'position: absolute; '
  1781.         + 'bottom: 30px; '
  1782.         + 'left: 12px; '
  1783.         + 'box-sizing: content-box; '
  1784.         + 'border: 1px solid rgb(156, 182, 213); '
  1785.         + 'box-shadow: 1px -1px 1px 0px rgba(0,0,0,0.3); '
  1786.         + 'font: normal 10px/16px Tahoma, Helvetica, Arial, sans-serif; '
  1787.         + 'color: #000000; '
  1788.         + 'background-color: #ffffff; '
  1789.         + 'display: none;}'
  1790.     );
  1791.  
  1792.     sheet.insertRule('#TabsContainer > div {'
  1793.         + 'padding: 1px 10px 8px 10px;}'
  1794.     );
  1795.  
  1796.     sheet.insertRule('#TabsContainer .Title {'
  1797.         + 'margin-left: -5px; '
  1798.         + 'font: bold 12px/22px Tahoma, Helvetica, Arial, sans-serif; '
  1799.         + 'color: #B14;}'
  1800.     );
  1801.  
  1802.     sheet.insertRule('#TabsContainer .subTitle {'
  1803.         + 'padding-top: 10px; '
  1804.         + 'font-weight: bold; '
  1805.         + 'display: block;}'
  1806.     );
  1807.  
  1808.     sheet.insertRule('#TabsContainer img {'
  1809.         + 'width: 14px; '
  1810.         + 'height: 14px; '
  1811.         + 'vertical-align: text-bottom;}'
  1812.     );
  1813.  
  1814.     sheet.insertRule('.StatsContent, #TabsContainer span, #TabsContainer img, #TabsContainer a, #TabsContainer b, #TabsContainer br {'
  1815.         + 'box-sizing: content-box;}'
  1816.     );
  1817.  
  1818.     sheet.insertRule('#harem_whole .CustomTT {'
  1819.         + 'float: right; '
  1820.         + 'margin-left: -25px; '
  1821.         + 'margin-top: -5px; '
  1822.         + 'background-image: url("https://i.postimg.cc/qBDt6yHV/icon-question.png"); '
  1823.         + 'background-size: 18px 18px; '
  1824.         + 'width: 18px; '
  1825.         + 'height: 18px; '
  1826.         + 'visibility: none;}'
  1827.     );
  1828.  
  1829.     sheet.insertRule('#harem_whole .CustomTT:hover {'
  1830.         + 'cursor: help;}'
  1831.     );
  1832.  
  1833.     sheet.insertRule('#harem_whole .CustomTT:hover + div {'
  1834.         + 'opacity: 1; '
  1835.         + 'visibility: visible;}'
  1836.     );
  1837.  
  1838.     sheet.insertRule('#harem_whole .AffectionTooltip {'
  1839.         + 'position: absolute; '
  1840.         + 'z-index: 99; '
  1841.         + 'margin: 20px 0 0 0; '
  1842.         + 'display: block; overflow: auto; '
  1843.         + 'border: 1px solid rgb(162, 195, 215); '
  1844.         + 'border-radius: 8px; '
  1845.         + 'box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.1); '
  1846.         + 'padding: 3px 7px 4px 7px; '
  1847.         + 'background-color: #F2F2F2; '
  1848.         + 'color: #1E90FF; '
  1849.         + 'font: normal 9px/17px Tahoma, Helvetica, Arial, sans-serif; '
  1850.         + 'text-align: left; '
  1851.         + 'text-shadow: none; '
  1852.         + 'opacity: 0; '
  1853.         + 'visibility: hidden; '
  1854.         + 'transition: opacity 400ms, visibility 400ms;}'
  1855.     );
  1856.  
  1857.     sheet.insertRule('#collect_all_container {'
  1858.         + 'margin-top: 0px !important;}'
  1859.     );
  1860.  
  1861.     sheet.insertRule('#harem_whole .AffectionTooltip b {'
  1862.         + 'font-weight: bold;}'
  1863.     );
  1864.  
  1865.     sheet.insertRule('#harem_whole .WikiLink {'
  1866.         + 'font-size: 12px;}'
  1867.     );
  1868.  
  1869.     sheet.insertRule('#harem_whole .WikiLinkDialogbox a {'
  1870.         + 'text-decoration: none; '
  1871.         + 'color: #24a0ff !important;}'
  1872.     );
  1873.  
  1874.     sheet.insertRule('#harem_whole .imgStar, #harem_whole .imgMoney, #harem_whole .imgKobans, #haremwhole .imgStar, #harem_whole .imgMoney, #harem_whole .imgKobans {'
  1875.         + 'background-size: 10px 10px; '
  1876.         + 'background-repeat: no-repeat; '
  1877.         + 'width: 10px; '
  1878.         + 'height: 14px; '
  1879.         + 'display: inline-block;}'
  1880.     );
  1881.  
  1882.     sheet.insertRule('#harem_whole .imgStar, #harem_left .imgStar {'
  1883.         + 'background-image: url("https://i.postimg.cc/L6h1xv38/icon-star.png");}'
  1884.     );
  1885.  
  1886.     sheet.insertRule('#harem_whole .imgMoney, #harem_left .imgMoney {'
  1887.         + 'background-image: url("https://i.postimg.cc/wv01VstN/icon-currency-ymen.png");}'
  1888.     );
  1889.  
  1890.     sheet.insertRule('#harem_whole .imgKobans, #harem_left .imgKobans {'
  1891.         + 'background-image: url("https://i.postimg.cc/9fPRDkCJ/icon-currency-koban.png");}'
  1892.     );
  1893. }
  1894.  
  1895. /* ====================
  1896.     LEAGUE INFORMATION
  1897.    ==================== */
  1898.  
  1899. function moduleLeague() {
  1900.     var seasonEnds;
  1901.     var playersTotal;
  1902.     var challengesLeft;
  1903.     var challengesPossibleParse;
  1904.     var challengesPossibleMinutes;
  1905.     var challengesPossible;
  1906.     var playerCurrentParse;
  1907.     var playerCurrentPos;
  1908.     var playerCurrentPoints;
  1909.     var maxDemoteParse;
  1910.     var maxDemotePoints;
  1911.     var maxDemoteDiff;
  1912.     var maxDemoteDisplay;
  1913.     var textDemote;
  1914.     var maxStagnateParse;
  1915.     var maxStagnatePoints;
  1916.     var maxStagnateDiff;
  1917.     var maxStagnateDisplay;
  1918.     var textStagnate;
  1919.  
  1920.     challengesPossibleParse = $('div.bar-wrap div.over span:nth-child(3) span[rel=count]').text();
  1921.     if (challengesPossibleParse == '') {
  1922.         challengesPossibleMinutes = 0;
  1923.     }
  1924.     else if (challengesPossibleParse.indexOf('s') > -1) {
  1925.         if (challengesPossibleParse.indexOf('m') > -1) {
  1926.             challengesPossibleMinutes = 33;
  1927.         }
  1928.         else {
  1929.             challengesPossibleMinutes = 34;
  1930.         }
  1931.     }
  1932.     else {
  1933.         challengesPossibleMinutes = 34 - parseInt(challengesPossibleParse.match(/[+-]?\d+(?:\.\d+)?/g));
  1934.     }
  1935.  
  1936.     seasonEnds = $('div.league_end_in span[rel=timer]').text();
  1937.     if (seasonEnds.indexOf(texts[lang].day) > -1) {
  1938.         challengesPossibleMinutes += seasonEnds.match(/[+-]?\d+(?:\.\d+)?/g)[0] * 1440;
  1939.         if (seasonEnds.indexOf(texts[lang].hour) > -1) {
  1940.             challengesPossibleMinutes += seasonEnds.match(/[+-]?\d+(?:\.\d+)?/g)[1] * 60;
  1941.             if (seasonEnds.indexOf(texts[lang].minute) > -1) {
  1942.                 challengesPossibleMinutes += seasonEnds.match(/[+-]?\d+(?:\.\d+)?/g)[2] * 1;
  1943.             }
  1944.         }
  1945.         else {
  1946.             if (seasonEnds.indexOf(texts[lang].minute) > -1) {
  1947.                 challengesPossibleMinutes += seasonEnds.match(/[+-]?\d+(?:\.\d+)?/g)[1] * 1;
  1948.             }
  1949.         }
  1950.     }
  1951.     else if (seasonEnds.indexOf(texts[lang].day) === -1 && seasonEnds.indexOf(texts[lang].hour) > -1) {
  1952.         challengesPossibleMinutes += seasonEnds.match(/[+-]?\d+(?:\.\d+)?/g)[0] * 60;
  1953.         if (seasonEnds.indexOf(texts[lang].minute) > -1) {
  1954.             challengesPossibleMinutes += seasonEnds.match(/[+-]?\d+(?:\.\d+)?/g)[1] * 1;
  1955.         }
  1956.     }
  1957.     else {
  1958.         if (seasonEnds.indexOf(texts[lang].minute) > -1) {
  1959.             challengesPossibleMinutes += seasonEnds.match(/[+-]?\d+(?:\.\d+)?/g)[0] * 1;
  1960.         }
  1961.     }
  1962.  
  1963.     playersTotal = (' ' + $('div.leagues_table table tbody.leadTable').text() + ' ').split('/3').length; // splits string into 'number of opponents' + 1 parts
  1964.     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);
  1965.     challengesPossible = Math.floor(challengesPossibleMinutes/35) + parseInt($('div.bar-wrap div.over span[energy]').text());
  1966.  
  1967.     playerCurrentParse = $('div.leagues_table table tr td:nth-child(4):contains(-)').parent().text();
  1968.     playerCurrentPos = parseInt(playerCurrentParse.trim().substr(0, 3).replace(/\D/g, ''));
  1969.     playerCurrentPoints = parseInt(playerCurrentParse.substr(playerCurrentParse.lastIndexOf('-') + 1).replace(/\D/g, ''));
  1970.  
  1971.     if (playerCurrentPos > (playersTotal - 15)) {
  1972.         maxDemoteParse = $('div.leagues_table table tr td:nth-child(1):contains(' + (playersTotal - 15) + ')').parent().text();
  1973.         maxDemotePoints = parseInt(maxDemoteParse.substr(maxDemoteParse.lastIndexOf('/3') + 2).replace(/\D/g, ''));
  1974.         maxDemoteDiff = maxDemotePoints - playerCurrentPoints;
  1975.         if (playerCurrentPoints == 0 && maxDemotePoints == 0) {
  1976.             maxDemoteDisplay = '±' + nThousand(maxDemoteDiff);
  1977.             textDemote = texts[lang].demote_holdzero;
  1978.         }
  1979.         else {
  1980.             maxDemoteDisplay = '+' + nThousand(maxDemoteDiff);
  1981.             textDemote = texts[lang].demote_up;
  1982.         }
  1983.     }
  1984.     else {
  1985.         maxDemoteParse = $('div.leagues_table table tr td:nth-child(1):contains(' + (playersTotal - 14) + ')').parent().text();
  1986.         maxDemotePoints = parseInt(maxDemoteParse.substr(maxDemoteParse.lastIndexOf('/3') + 2).replace(/\D/g, ''));
  1987.         maxDemoteDiff = maxDemotePoints - playerCurrentPoints;
  1988.         if (playerCurrentPoints == 0 && maxDemotePoints == 0) {
  1989.             maxDemoteDisplay = '±' + nThousand(maxDemoteDiff);
  1990.             textDemote = texts[lang].demote_holdzero;
  1991.         }
  1992.         else {
  1993.             if (maxDemoteDiff == 0) {
  1994.                 maxDemoteDisplay = '-' + nThousand(maxDemoteDiff);
  1995.             }
  1996.             else {
  1997.                 maxDemoteDisplay = nThousand(maxDemoteDiff);
  1998.             }
  1999.             textDemote = texts[lang].demote_down;
  2000.         }
  2001.     }
  2002.  
  2003.     if (playerCurrentPos > 15) {
  2004.         maxStagnateParse = $('div.leagues_table table tr td:nth-child(1):contains(\t15 )').parent().text() + $('div.leagues_table table tr td:nth-child(1):contains(\t15\t)').parent().text();
  2005.         maxStagnatePoints = parseInt(maxStagnateParse.substr(maxStagnateParse.lastIndexOf('/3') + 2).replace(/\D/g, ''));
  2006.         maxStagnateDiff = maxStagnatePoints - playerCurrentPoints;
  2007.         if (playerCurrentPoints == 0 && maxStagnatePoints == 0) {
  2008.             maxStagnateDisplay = '±' + nThousand(maxStagnateDiff);
  2009.             textStagnate = texts[lang].stagnate_holdzero;
  2010.         }
  2011.         else {
  2012.             maxStagnateDisplay = '+' + nThousand(maxStagnateDiff);
  2013.             textStagnate = texts[lang].stagnate_up;
  2014.         }
  2015.     }
  2016.     else {
  2017.         maxStagnateParse = $('div.leagues_table table tr td:nth-child(1):contains(\t16\t)').parent().text();
  2018.         maxStagnatePoints = parseInt(maxStagnateParse.substr(maxStagnateParse.lastIndexOf('/3') + 2).replace(/\D/g, ''));
  2019.         maxStagnateDiff = maxStagnatePoints - playerCurrentPoints;
  2020.         if (playerCurrentPoints == 0 && maxStagnatePoints == 0) {
  2021.             maxStagnateDisplay = '±' + nThousand(maxStagnateDiff);
  2022.             textStagnate = texts[lang].stagnate_holdzero;
  2023.         }
  2024.         else {
  2025.             if (maxStagnateDiff == 0) {
  2026.                 maxStagnateDisplay = '-' + nThousand(maxStagnateDiff);
  2027.             }
  2028.             else {
  2029.                 maxStagnateDisplay = nThousand(maxStagnateDiff);
  2030.             }
  2031.             textStagnate = texts[lang].stagnate_down;
  2032.         }
  2033.     }
  2034.  
  2035.     if (league_tag == 9) {
  2036.         $('div.league_end_in').append('<span class="scriptLeagueInfo">'
  2037.         + '<span class="possibleChallenges"><img src="https://i.postimg.cc/ydVJcTNB/icon-bluesquare.png" style="margin-left: 10px; margin-bottom: 2px;"> ' + challengesPossible + '/' + challengesLeft
  2038.         + '<span class="scriptLeagueInfoTooltip possibleChallengesTooltip">' + texts[lang].challenges_regen + challengesPossible + texts[lang].challenges_left + challengesLeft + '</span></span>'
  2039.         + '<span class="maxDemote"><img src="https://i.postimg.cc/qqqzZMn5/icon-league-demote.png" style="margin-left: 10px; margin-bottom: 2px;"> ' + maxDemoteDisplay
  2040.         + '<span class="scriptLeagueInfoTooltip maxDemoteTooltip">' + textDemote + nThousand(maxDemotePoints) + ' ' + texts[lang].points + '.</span></span>'
  2041.         + '</span>');
  2042.     }
  2043.     else if (league_tag == 1) {
  2044.         $('div.league_end_in').append('<span class="scriptLeagueInfo">'
  2045.         + '<span class="possibleChallenges"><img src="https://i.postimg.cc/ydVJcTNB/icon-bluesquare.png" style="margin-left: 10px; margin-bottom: 2px;"> ' + challengesPossible + '/' + challengesLeft
  2046.         + '<span class="scriptLeagueInfoTooltip possibleChallengesTooltip">' + texts[lang].challenges_regen + challengesPossible + texts[lang].challenges_left + challengesLeft + '</span></span>'
  2047.         + '<span class="maxStagnate"><img src="https://i.postimg.cc/HnkyDtG3/icon-league-hold.png" style="margin-left: 10px; margin-bottom: 2px;"> ' + maxStagnateDisplay
  2048.         + '<span class="scriptLeagueInfoTooltip maxStagnateTooltip">' + textStagnate + nThousand(maxStagnatePoints) + ' ' + texts[lang].points + '.</span></span>'
  2049.         + '</span>');
  2050.     }
  2051.     else {
  2052.         $('div.league_end_in').append('<span class="scriptLeagueInfo">'
  2053.         + '<span class="possibleChallenges"><img src="https://i.postimg.cc/ydVJcTNB/icon-bluesquare.png" style="margin-left: 10px; margin-bottom: 2px;"> ' + challengesPossible + '/' + challengesLeft
  2054.         + '<span class="scriptLeagueInfoTooltip possibleChallengesTooltip">' + texts[lang].challenges_regen + challengesPossible + texts[lang].challenges_left + challengesLeft + '</span></span>'
  2055.         + '<span class="maxStagnate"><img src="https://i.postimg.cc/HnkyDtG3/icon-league-hold.png" style="margin-left: 10px; margin-bottom: 2px;"> ' + maxStagnateDisplay
  2056.         + '<span class="scriptLeagueInfoTooltip maxStagnateTooltip">' + textStagnate + nThousand(maxStagnatePoints) + ' ' + texts[lang].points + '.</span></span>'
  2057.         + '<span class="maxDemote"><img src="https://i.postimg.cc/qqqzZMn5/icon-league-demote.png" style="margin-left: 10px; margin-bottom: 2px;"> ' + maxDemoteDisplay
  2058.         + '<span class="scriptLeagueInfoTooltip maxDemoteTooltip">' + textDemote + nThousand(maxDemotePoints) + ' ' + texts[lang].points + '.</span></span>'
  2059.         + '</span>');
  2060.     }
  2061.  
  2062.     //CSS
  2063.     sheet.insertRule('.scriptLeagueInfo {'
  2064.         + 'font-size: 13px; '
  2065.         + 'display: block; '
  2066.         + 'float: right; '
  2067.         + 'margin-right: 10px;}'
  2068.     );
  2069.  
  2070.     sheet.insertRule('.scriptLeagueInfoTooltip {'
  2071.         + 'visibility: hidden; '
  2072.         + 'font-size: 12px; '
  2073.         + 'background-color: black; '
  2074.         + 'color: #fff; '
  2075.         + 'text-align: center; '
  2076.         + 'padding: 3px 5px 3px 5px; '
  2077.         + 'border: 2px solid #905312; '
  2078.         + 'border-radius: 6px; '
  2079.         + 'background-color: rgba(32,3,7,.9); '
  2080.         + 'position: absolute; '
  2081.         + 'margin-top: 5px; '
  2082.         + 'z-index: 9;}'
  2083.     );
  2084.  
  2085.     sheet.insertRule('.scriptLeagueInfoTooltip::after {'
  2086.         + 'content: " "; '
  2087.         + 'position: absolute; '
  2088.         + 'bottom: 100%; '
  2089.         + 'left: 50%; '
  2090.         + 'margin-left: -10px; '
  2091.         + 'border-width: 10px; '
  2092.         + 'border-style: solid; '
  2093.         + 'border-color: transparent transparent #905312 transparent;}'
  2094.     );
  2095.  
  2096.     sheet.insertRule('.kobanWinningsTooltip {'
  2097.         + 'top: 65px; '
  2098.         + 'margin-left: -95px;}'
  2099.     );
  2100.  
  2101.     sheet.insertRule('.kobanWinnings:hover .kobanWinningsTooltip {'
  2102.         + 'visibility: visible;}'
  2103.     );
  2104.  
  2105.     sheet.insertRule('.possibleChallengesTooltip {'
  2106.         + 'top: 65px; '
  2107.         + 'margin-left: -110px;}'
  2108.     );
  2109.  
  2110.     sheet.insertRule('.possibleChallenges:hover .possibleChallengesTooltip {'
  2111.         + 'visibility: visible;}'
  2112.     );
  2113.  
  2114.     sheet.insertRule('.maxStagnateTooltip {'
  2115.         + 'max-width: 190px; '
  2116.         + 'top: 65px; '
  2117.         + 'margin-left: -115px;}'
  2118.     );
  2119.  
  2120.     sheet.insertRule('.maxStagnate:hover .maxStagnateTooltip {'
  2121.         + 'visibility: visible;}'
  2122.     );
  2123.  
  2124.     sheet.insertRule('.maxDemoteTooltip {'
  2125.         + 'max-width: 170px; '
  2126.         + 'top: 65px; '
  2127.         + 'margin-left: -100px;}'
  2128.     );
  2129.  
  2130.     sheet.insertRule('.maxDemote:hover .maxDemoteTooltip {'
  2131.         + 'visibility: visible;}'
  2132.     );
  2133. }
  2134.  
  2135. /* ============
  2136.     LEAGUE SIM
  2137.    ============ */
  2138.  
  2139. function moduleSim() {
  2140.     var playerEgo;
  2141.     var playerEgoCheck;
  2142.     var playerDefHC;
  2143.     var playerDefKH;
  2144.     var playerDefCH;
  2145.     var playerAtk;
  2146.     var playerClass;
  2147.     var playerAlpha;
  2148.     var playerBeta;
  2149.     var playerOmega;
  2150.     var playerExcitement;
  2151.     var playerBetaAdd;
  2152.     var playerOmegaAdd;
  2153.     var opponentEgo;
  2154.     var opponentDefHC;
  2155.     var opponentDefKH;
  2156.     var opponentDefCH;
  2157.     var opponentAtk;
  2158.     var opponentClass;
  2159.     var opponentAlpha;
  2160.     var opponentBeta;
  2161.     var opponentOmega;
  2162.     var opponentExcitement;
  2163.     var opponentBetaAdd;
  2164.     var opponentOmegaAdd;
  2165.     var opponentProcHCBase;
  2166.     var opponentProcHCAddOrgasm1;
  2167.     var opponentProcHCAddOrgasm2;
  2168.     var opponentProcHCAddOrgasm3;
  2169.     var opponentProcCH;
  2170.     var opponentProcKH;
  2171.     var opponentAlphaClass;
  2172.     var playerDef;
  2173.     var opponentDef;
  2174.     var playerOrgasm;
  2175.     var playerOrgasmCount;
  2176.     var opponentOrgasm;
  2177.     var opponentOrgasmCount;
  2178.     var matchRating;
  2179.  
  2180.     function calculatePower() {
  2181.         // player stats
  2182.         playerEgo = Math.round(Hero.infos.caracs.ego);
  2183.         playerDefHC = Math.round(Hero.infos.caracs.def_carac1);
  2184.         playerDefCH = Math.round(Hero.infos.caracs.def_carac2);
  2185.         playerDefKH = Math.round(Hero.infos.caracs.def_carac3);
  2186.         playerAtk = Math.round(Hero.infos.caracs.damage);
  2187.         playerClass = $('div#leagues_left .icon').attr('carac');
  2188.         playerAlpha = JSON.parse($('div#leagues_left .girls_wrapper .team_girl[g=1]').attr('girl-tooltip-data'));
  2189.         playerBeta = JSON.parse($('div#leagues_left .girls_wrapper .team_girl[g=2]').attr('girl-tooltip-data'));
  2190.         playerOmega = JSON.parse($('div#leagues_left .girls_wrapper .team_girl[g=3]').attr('girl-tooltip-data'));
  2191.         playerExcitement = Math.round((playerAlpha.caracs.carac1 + playerAlpha.caracs.carac2 + playerAlpha.caracs.carac3) * 28);
  2192.  
  2193.         if (playerClass == 'class1') {
  2194.             playerBetaAdd = playerBeta.caracs.carac1;
  2195.             playerOmegaAdd = playerOmega.caracs.carac1;
  2196.         }
  2197.         if (playerClass == 'class2') {
  2198.             playerBetaAdd = playerBeta.caracs.carac2;
  2199.             playerOmegaAdd = playerOmega.caracs.carac2;
  2200.         }
  2201.         if (playerClass == 'class3') {
  2202.             playerBetaAdd = playerBeta.caracs.carac3;
  2203.             playerOmegaAdd = playerOmega.caracs.carac3;
  2204.         }
  2205.  
  2206.         // opponent stats
  2207.         opponentEgo = parseInt($('div#leagues_right div.lead_ego div:nth-child(2)').text().replace(/[^0-9]/gi, ''));
  2208.  
  2209.         opponentDefHC = $('div#leagues_right div.stats_wrap div:nth-child(2)').text();
  2210.         if (opponentDefHC.includes('.') || opponentDefHC.includes(',')) {
  2211.             opponentDefHC = parseInt(opponentDefHC.replace('K', '00').replace(/[^0-9]/gi, ''));
  2212.         }
  2213.         else {
  2214.             opponentDefHC = parseInt(opponentDefHC.replace('K', '000').replace(/[^0-9]/gi, ''));
  2215.         }
  2216.  
  2217.         opponentDefCH = $('div#leagues_right div.stats_wrap div:nth-child(4)').text();
  2218.         if (opponentDefCH.includes('.') || opponentDefCH.includes(',')) {
  2219.             opponentDefCH = parseInt(opponentDefCH.replace('K', '00').replace(/[^0-9]/gi, ''));
  2220.         }
  2221.         else {
  2222.             opponentDefCH = parseInt(opponentDefCH.replace('K', '000').replace(/[^0-9]/gi, ''));
  2223.         }
  2224.  
  2225.         opponentDefKH = $('div#leagues_right div.stats_wrap div:nth-child(6)').text();
  2226.         if (opponentDefKH.includes('.') || opponentDefKH.includes(',')) {
  2227.             opponentDefKH = parseInt(opponentDefKH.replace('K', '00').replace(/[^0-9]/gi, ''));
  2228.         }
  2229.         else {
  2230.             opponentDefKH = parseInt(opponentDefKH.replace('K', '000').replace(/[^0-9]/gi, ''));
  2231.         }
  2232.  
  2233.         opponentAtk = $('div#leagues_right div.stats_wrap div:nth-child(8)').text();
  2234.         if (opponentAtk.includes('.') || opponentAtk.includes(',')) {
  2235.             opponentAtk = parseInt(opponentAtk.replace('K', '00').replace(/[^0-9]/gi, ''));
  2236.         }
  2237.         else {
  2238.             opponentAtk = parseInt(opponentAtk.replace('K', '000').replace(/[^0-9]/gi, ''));
  2239.         }
  2240.  
  2241.         opponentClass = $('div#leagues_right .icon').attr('carac');
  2242.         opponentAlpha = JSON.parse($('div#leagues_right .girls_wrapper .team_girl[g=1]').attr('girl-tooltip-data'));
  2243.         opponentBeta = JSON.parse($('div#leagues_right .girls_wrapper .team_girl[g=2]').attr('girl-tooltip-data'));
  2244.         opponentOmega = JSON.parse($('div#leagues_right .girls_wrapper .team_girl[g=3]').attr('girl-tooltip-data'));
  2245.         opponentExcitement = Math.round((opponentAlpha.caracs.carac1 + opponentAlpha.caracs.carac2 + opponentAlpha.caracs.carac3) * 28);
  2246.  
  2247.         if (opponentClass == 'class1') {
  2248.             opponentBetaAdd = opponentBeta.caracs.carac1;
  2249.             opponentOmegaAdd = opponentOmega.caracs.carac1;
  2250.         }
  2251.         if (opponentClass == 'class2') {
  2252.             opponentBetaAdd = opponentBeta.caracs.carac2;
  2253.             opponentOmegaAdd = opponentOmega.caracs.carac2;
  2254.         }
  2255.         if (opponentClass == 'class3') {
  2256.             opponentBetaAdd = opponentBeta.caracs.carac3;
  2257.             opponentOmegaAdd = opponentOmega.caracs.carac3;
  2258.         }
  2259.  
  2260.         //Determine each side's actual defense
  2261.         if (playerClass == 'class1') {
  2262.             opponentDef = opponentDefHC;
  2263.         }
  2264.         if (playerClass == 'class2') {
  2265.             opponentDef = opponentDefCH;
  2266.         }
  2267.         if (playerClass == 'class3') {
  2268.             opponentDef = opponentDefKH;
  2269.         }
  2270.  
  2271.         if (opponentClass == 'class1') {
  2272.             playerDef = playerDefHC;
  2273.         }
  2274.         if (opponentClass == 'class2') {
  2275.             playerDef = playerDefCH;
  2276.         }
  2277.         if (opponentClass == 'class3') {
  2278.             playerDef = playerDefKH;
  2279.         }
  2280.  
  2281.         //Calculate opponent proc values, determine applicable alpha class and adjust starting ego values for proc
  2282.         opponentProcHCBase = Math.round(opponentAtk * 0.5);
  2283.         opponentProcHCAddOrgasm1 = Math.round(opponentAtk * 0.25);
  2284.         opponentProcHCAddOrgasm2 = Math.round(opponentBetaAdd * 1.3 * 0.75);
  2285.         opponentProcHCAddOrgasm3 = Math.round(opponentOmegaAdd * 1.3 * 0.75);
  2286.         opponentProcCH = opponentDef * 2;
  2287.         opponentProcKH = Math.round(opponentEgo * 0.1);
  2288.         opponentAlphaClass = opponentAlpha.class;
  2289.  
  2290.         if (opponentAlphaClass == '1') {
  2291.             playerEgo -= opponentProcHCBase;
  2292.         }
  2293.         if (opponentAlphaClass == '2') {
  2294.             opponentEgo += opponentProcCH;
  2295.         }
  2296.         if (opponentAlphaClass == '3') {
  2297.             opponentEgo += opponentProcKH;
  2298.         }
  2299.  
  2300.         //Log opponent name and starting egos for sim
  2301.         console.log('Simulation log for: ' + $('div#leagues_right div.player_block div.title').text());
  2302.         console.log('Starting Egos adjusted for worst-case proc scenario:');
  2303.         console.log('Player Ego: ' + playerEgo);
  2304.         console.log('Opponent Ego: ' + opponentEgo);
  2305.  
  2306.         playerOrgasm = 0;
  2307.         playerOrgasmCount = 0;
  2308.         opponentOrgasm = 0;
  2309.         opponentOrgasmCount = 0;
  2310.  
  2311.         function playerTurn() {
  2312.             //Orgasm
  2313.             if (playerOrgasm >= playerExcitement) {
  2314.                 //Orgasm damage
  2315.                 opponentEgo -= Math.round(playerAtk * 1.5 - opponentDef);
  2316.                 playerOrgasmCount++;
  2317.  
  2318.                 //Log results
  2319.                 console.log('Round ' + (turns + 1) + ': Player orgasm! -' + Math.round(playerAtk * 1.5 - opponentDef));
  2320.  
  2321.                 //Orgasm 1
  2322.                 if (playerOrgasmCount == 1) {
  2323.                     playerAtk += Math.round(playerBetaAdd * 1.3);
  2324.                     opponentDef += Math.round(opponentBetaAdd * 1.75);
  2325.                 }
  2326.  
  2327.                 //Orgasm 2
  2328.                 if (playerOrgasmCount == 2) {
  2329.                     playerAtk += Math.round(playerOmegaAdd * 1.3);
  2330.                     opponentDef += Math.round(opponentOmegaAdd * 1.75);
  2331.                 }
  2332.  
  2333.                 //Reset excitement value
  2334.                 playerOrgasm = 0;
  2335.             }
  2336.  
  2337.             //No orgasm
  2338.             else {
  2339.                 opponentEgo -= playerAtk - opponentDef;
  2340.                 playerOrgasm += playerAtk * 2;
  2341.                 console.log('Round ' + (turns + 1) + ': Player hit! -' + (playerAtk - opponentDef));
  2342.             }
  2343.  
  2344.             //Log results
  2345.             console.log('after Round ' + (turns + 1) + ': Opponent ego: ' + opponentEgo);
  2346.         }
  2347.  
  2348.         function opponentTurn() {
  2349.             //Orgasm
  2350.             if (opponentOrgasm >= opponentExcitement) {
  2351.                 //Orgasm damage
  2352.                 playerEgo -= Math.round(opponentAtk * 1.5 - playerDef);
  2353.                 opponentOrgasmCount++;
  2354.  
  2355.                 //Log results
  2356.                 console.log('Round ' + (turns + 1) + ': Opponent orgasm! -' + Math.round(opponentAtk * 1.5 - playerDef));
  2357.  
  2358.                 //Orgasm 1
  2359.                 if (opponentOrgasmCount == 1) {
  2360.                     opponentAtk += Math.round(opponentBetaAdd * 1.3);
  2361.                     playerDef += Math.round(playerBetaAdd * 1.75);
  2362.                     if (opponentAlphaClass == '1') {
  2363.                         playerEgo -= opponentProcHCAddOrgasm1;
  2364.                         console.log('Round ' + (turns + 1) + ': HC opponent possibility of Wild Burst on first orgasm! -' + opponentProcHCAddOrgasm1);
  2365.                     }
  2366.                 }
  2367.  
  2368.                 //Orgasm 2
  2369.                 if (opponentOrgasmCount == 2) {
  2370.                     opponentAtk += Math.round(opponentOmegaAdd * 1.3);
  2371.                     playerDef += Math.round(playerOmegaAdd * 1.75);
  2372.                     if (opponentAlphaClass == '1') {
  2373.                         playerEgo -= opponentProcHCAddOrgasm2;
  2374.                         console.log('Round ' + (turns + 1) + ': HC opponent possibility of Wild Burst on second orgasm! -' + opponentProcHCAddOrgasm2);
  2375.                     }
  2376.                 }
  2377.  
  2378.                 //Orgasm 3
  2379.                 if (opponentOrgasmCount == 3) {
  2380.                     if (opponentAlphaClass == '1') {
  2381.                         playerEgo -= opponentProcHCAddOrgasm3;
  2382.                         console.log('Round ' + (turns + 1) + ': HC opponent possibility of Wild Burst on third orgasm! -' + opponentProcHCAddOrgasm3);
  2383.                     }
  2384.                 }
  2385.  
  2386.                 //Reset excitement value
  2387.                 opponentOrgasm = 0;
  2388.             }
  2389.  
  2390.             //No orgasm
  2391.             else {
  2392.                 playerEgo -= opponentAtk - playerDef;
  2393.                 opponentOrgasm += opponentAtk * 2;
  2394.                 console.log('Round ' + (turns + 1) + ': Opponent hit! -' + (opponentAtk - playerDef));
  2395.             }
  2396.  
  2397.             //Log results
  2398.             console.log('after Round ' + (turns + 1) + ': Player ego: ' + playerEgo);
  2399.         }
  2400.  
  2401.         //Simulate challenge
  2402.         for (var turns = 0; turns < 99; turns++) {
  2403.             if (playerEgo > 0) {
  2404.                 playerTurn()
  2405.             }
  2406.             else {
  2407.                 break
  2408.             }
  2409.             if (opponentEgo > 0) {
  2410.                 opponentTurn()
  2411.             }
  2412.             else {
  2413.                 //Check if victory is only a one-turn advantage
  2414.                 playerEgoCheck = playerEgo;
  2415.  
  2416.                 //Orgasm
  2417.                 if (opponentOrgasm >= opponentExcitement) {
  2418.                     playerEgoCheck -= Math.round(opponentAtk * 1.5 - playerDef);
  2419.                     opponentOrgasmCount++;
  2420.  
  2421.                     //Log results
  2422.                     console.log('Round ' + (turns + 1) + ': Possibly next: Opponent orgasm! -' + Math.round(opponentAtk * 1.5 - playerDef));
  2423.  
  2424.                     if (opponentAlphaClass == '1') {
  2425.                         if (opponentOrgasmCount == 1) {
  2426.                             playerEgoCheck -= opponentProcHCAddOrgasm1;
  2427.                             console.log('Round ' + (turns + 1) + ': Possibly next: HC opponent possibility of Wild Burst on first orgasm! -' + opponentProcHCAddOrgasm1);
  2428.                         }
  2429.                         if (opponentOrgasmCount == 2) {
  2430.                             playerEgoCheck -= opponentProcHCAddOrgasm2;
  2431.                             console.log('Round ' + (turns + 1) + ': Possibly next: HC opponent possibility of Wild Burst on second orgasm! -' + opponentProcHCAddOrgasm2);
  2432.                         }
  2433.                         if (opponentOrgasmCount == 3) {
  2434.                             playerEgoCheck -= opponentProcHCAddOrgasm3;
  2435.                             console.log('Round ' + (turns + 1) + ': Possibly next: HC opponent possibility of Wild Burst on third orgasm! -' + opponentProcHCAddOrgasm3);
  2436.                         }
  2437.                     }
  2438.                 }
  2439.                 //No orgasm
  2440.                 else {
  2441.                     playerEgoCheck -= opponentAtk - playerDef;
  2442.                     console.log('Round ' + (turns + 1) + ': Possibly next: Opponent hit! -' + (opponentAtk - playerDef));
  2443.                 }
  2444.  
  2445.                 if (playerEgoCheck <= 0) {
  2446.                     console.log('Close call! After Round ' + (turns + 1) + ': Player ego: ' + playerEgoCheck);
  2447.                 }
  2448.                 break
  2449.             }
  2450.         }
  2451.  
  2452.         //Round defeated player's ego up to 0 to not skew results
  2453.         if (playerEgo < 0) {
  2454.             playerEgo = 0;
  2455.         }
  2456.         if (opponentEgo < 0) {
  2457.             opponentEgo = 0;
  2458.         }
  2459.  
  2460.         //Publish the ego difference as a match rating
  2461.         matchRating = playerEgo - opponentEgo;
  2462.         if (matchRating >= 0) {
  2463.             matchRating = '+' + nThousand(matchRating);
  2464.  
  2465.             if (playerEgoCheck <= 0) {
  2466.                 $('div#leagues_right .lead_player_profile').append('<div class="matchRating close"><img id="powerLevelScouter" src="https://i.postimg.cc/3xvDTR6M/icon-sim-yellow.png">' + matchRating + '</div>');
  2467.             }
  2468.             else {
  2469.                 $('div#leagues_right .lead_player_profile').append('<div class="matchRating plus"><img id="powerLevelScouter" src="https://i.postimg.cc/J0YB1BM8/icon-sim-green.png">' + matchRating + '</div>');
  2470.             }
  2471.         }
  2472.         else {
  2473.             matchRating = nThousand(matchRating);
  2474.             $('div#leagues_right .lead_player_profile').append('<div class="matchRating minus"><img id="powerLevelScouter" src="https://i.postimg.cc/8P3r9WZB/icon-sim-red.png">' + matchRating + '</div>');
  2475.         }
  2476.  
  2477.         //Replace opponent excitement with the correct value
  2478.         $('div#leagues_right div.stats_wrap div:nth-child(9) span:nth-child(2)').empty().append(nRounding(opponentExcitement, 0, 1));
  2479.     }
  2480.  
  2481.     calculatePower();
  2482.  
  2483.     //Replace player excitement with the correct value
  2484.     $('div#leagues_left div.stats_wrap div:nth-child(9) span:nth-child(2)').empty().append(nRounding(playerExcitement, 0, 1));
  2485.  
  2486.     // Refresh sim on new opponent selection (Credit: BenBrazke)
  2487.     var opntName;
  2488.     $('.leadTable').click(function() {
  2489.         opntName=''
  2490.     })
  2491.     function waitOpnt() {
  2492.         setTimeout(function() {
  2493.             if (JSON.parse($('div#leagues_right .girls_wrapper .team_girl[g=3]').attr('girl-tooltip-data'))) {
  2494.                 sessionStorage.setItem('opntName', opntName);
  2495.                 calculatePower();
  2496.             }
  2497.             else {
  2498.                 waitOpnt()
  2499.             }
  2500.         }, 50);
  2501.     }
  2502.     var observeCallback = function() {
  2503.         var opntNameNew = $('div#leagues_right div.player_block div.title')[0].innerHTML
  2504.         if (opntName !== opntNameNew) {
  2505.             opntName = opntNameNew;
  2506.             waitOpnt();
  2507.         }
  2508.     }
  2509.     var observer = new MutationObserver(observeCallback);
  2510.     var test = document.getElementById('leagues_right');
  2511.     observer.observe(test, {attributes: false, childList: true, subtree: false});
  2512.  
  2513.     //CSS
  2514.     sheet.insertRule('#leagues_right .player_block .lead_player_profile .level_wrapper {'
  2515.         + 'top: -8px !important;}'
  2516.     );
  2517.  
  2518.     sheet.insertRule('#leagues_right .player_block .lead_player_profile .icon {'
  2519.         + 'top: 5px !important;}'
  2520.     );
  2521.  
  2522.     sheet.insertRule('.matchRating {'
  2523.         + 'margin-top: -25px; '
  2524.         + 'margin-left: 70px; '
  2525.         + 'text-shadow: 1px 1px 0 #000, -1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000; '
  2526.         + 'line-height: 17px; '
  2527.         + 'font-size: 14px;}'
  2528.     );
  2529.  
  2530.     sheet.insertRule('.plus {'
  2531.         + 'color: #66CD00;}'
  2532.     );
  2533.  
  2534.     sheet.insertRule('.minus {'
  2535.         + 'color: #FF2F2F;}'
  2536.     );
  2537.  
  2538.     sheet.insertRule('.close {'
  2539.         + 'color: #FFA500;}'
  2540.     );
  2541.  
  2542.     sheet.insertRule('#powerLevelScouter {'
  2543.         + 'margin-left: -8px; '
  2544.         + 'margin-right: 1px; '
  2545.         + 'width: 25px;}'
  2546.     );
  2547. }
  2548.  
  2549. /* =========================================
  2550.     CHAMPIONS INFORMATION (Credit: Entwine)
  2551.    ========================================= */
  2552.  
  2553. function moduleChampions() {
  2554.     if (sessionStorage.getItem('championsCallBack') && $('.page-shop').length) {
  2555.         const championsCallBack = JSON.parse(sessionStorage.getItem('championsCallBack'));
  2556.         $('#breadcrumbs .back').after('<span>&gt;</span><a class="back" href="/champions-map.html" >'
  2557.         + $('nav [rel="content"] a[href="/champions-map.html"]').text().trim()
  2558.         + '<span class="mapArrowBack_flat_icn"></span></a><span>&gt;</span><a class="back" href="'
  2559.         + championsCallBack.location + '">'
  2560.         + championsCallBack.name + '<span class="mapArrowBack_flat_icn"></span></a>');
  2561.         sessionStorage.removeItem('championsCallBack');
  2562.     }
  2563.     else if ($('.page-champions').length) {
  2564.         const DEFAULT_CHAMPIONS_DATA = '{"attempts": {}, "config" : {}, "positions" : {}, "statistics" : {}}';
  2565.         const personalKey = Hero.infos.id + '/' + championData.champion.id;
  2566.         let championsData = JSON.parse(localStorage.getItem('championsData') || DEFAULT_CHAMPIONS_DATA);
  2567.         let positions = championsData.positions[personalKey];
  2568.         let positions2 = championData.champion.poses;
  2569.         let statistics = championsData.statistics[championData.champion.id];
  2570.         let attempts = championsData.attempts[personalKey];
  2571.         let config = championsData.config[Hero.infos.id] || {};
  2572.         let isSkipButtonClicked;
  2573.         markMatchedPositions();
  2574.         showAdditionalInformation();
  2575.         showNumberOfTicketsWhileTeamResting();
  2576.         $('.page-champions')
  2577.         .on('click', '.champions-bottom__draft-box > button', () => {setTimeout(markMatchedPositions, 500)})
  2578.         .on('click', '.champions-bottom__confirm-team', showNumberOfTicketsWhileTeamResting)
  2579.         .on('click', '.champions-bottom__skip-champion-cooldown', () => {isSkipButtonClicked = true});
  2580.         $(window).on('beforeunload', () => {
  2581.             championsData = JSON.parse(localStorage.getItem('championsData') || DEFAULT_CHAMPIONS_DATA);
  2582.             championsData.positions[personalKey] = positions;
  2583.             championsData.attempts[personalKey] = attempts;
  2584.             championsData.statistics[championData.champion.id] = statistics;
  2585.             championsData.config[Hero.infos.id] = Object.keys(config).length? config : undefined;
  2586.             localStorage.setItem('championsData', JSON.stringify(championsData));
  2587.         });
  2588.         $(document).ajaxComplete(function(event, xhr, options) {
  2589.             const response = JSON.parse(xhr.responseText);
  2590.             if (response.positions) {
  2591.                 if (!positions) {
  2592.                     if (!statistics) {
  2593.                         statistics = Array(positionImages.length).fill(0);
  2594.                     }
  2595.                     response.positions.forEach((e) => statistics[e]++);
  2596.                     attempts = 0;
  2597.                 }
  2598.                 if (response.final.attacker_ego > 0 || response.final.winner.type == 'hero') {
  2599.                     positions = undefined;
  2600.                 }
  2601.                 else {
  2602.                     positions = response.positions;
  2603.                 }
  2604.                 attempts++;
  2605.             }
  2606.             else {
  2607.                 markMatchedPositions();
  2608.             }
  2609.             if (isSkipButtonClicked) {
  2610.                 showAdditionalInformation();
  2611.                 isSkipButtonClicked = false;
  2612.             }
  2613.         });
  2614.         const restTimer = $('.champions-bottom__rest [timer], .champions-middle__champion-resting[timer]');
  2615.         if (restTimer.is(':visible')) {
  2616.             const delayTime = Math.ceil(restTimer.attr('timer') * 1000 - Date.now());
  2617.             setTimeout(markMatchedPositions, delayTime + 400);
  2618.         }
  2619.  
  2620.         function showAdditionalInformation() {
  2621.             if ($('.champions-middle__champion-resting').is(':visible') && positions) {
  2622.                 positions = undefined;
  2623.             }
  2624.             if ($('#additionalInformation').is(':visible')) {
  2625.                 return;
  2626.             }
  2627.             if (positions) {
  2628.                 createCurrentPositionsInfo();
  2629.             }
  2630.             else if (statistics) {
  2631.                 createStatisticsInfo();
  2632.             }
  2633.             if (positions || statistics) {
  2634.                 configureInfoBox();
  2635.             }
  2636.         }
  2637.  
  2638.         function markMatchedPositions() {
  2639.             $('.girl-selection__girl-box').each(function(index) {
  2640.                 const currentGirlsPose = $(this).find('.girl-box__pose');
  2641.                 if (currentGirlsPose.next().size() === 0) {
  2642.                     currentGirlsPose.parent().append('<span style="margin-left: 35px; filter: hue-rotate(-45deg);" />');
  2643.                 }
  2644.                 if (positions2) {
  2645.                     if (currentGirlsPose.attr('src').indexOf(preparePositionImage(positions2[index % positions2.length])) >= 0) {
  2646.                         currentGirlsPose.next().removeClass('empty');
  2647.                         currentGirlsPose.next().addClass('green-tick-icon');
  2648.                     }
  2649.                     else if (positions2.some((e) => (preparePositionImage(e) === currentGirlsPose.attr('src')))) {
  2650.                         currentGirlsPose.next().addClass('green-tick-icon empty');
  2651.                     }
  2652.                     else {
  2653.                         currentGirlsPose.next().removeClass('green-tick-icon');
  2654.                     }
  2655.                 }
  2656.                 else if (statistics) {
  2657.                     currentGirlsPose.next().css({'filter': 'invert'});
  2658.                     if (statistics.some((elem, idx) => (elem > 0 && preparePositionImage(idx) === currentGirlsPose.attr('src')))) {
  2659.                         currentGirlsPose.next().addClass('green-tick-icon empty');
  2660.                     }
  2661.                     else {
  2662.                         currentGirlsPose.next().removeClass('green-tick-icon');
  2663.                     }
  2664.                 }
  2665.             });
  2666.         }
  2667.  
  2668.         function showNumberOfTicketsWhileTeamResting() {
  2669.             if ($('.champions-bottom__ticket-amount').is(':visible') == false) {
  2670.                 $('.champions-bottom__rest').css({'width': '280px'})
  2671.                     .before('<div class="champions-bottom__ticket-amount"><span cur="ticket">x ' + championData.champion.currentTickets + '</span></div>');
  2672.             }
  2673.         }
  2674.  
  2675.         function preparePositionImage(positionID) {
  2676.             return IMAGES_URL + '/pictures/design/battle_positions/' + positionImages[positionID];
  2677.         }
  2678.  
  2679.         function createCurrentPositionsInfo() {
  2680.             let positionsBox = ('<div id="additionalInformation" style="position: absolute; top:' + (config.top || 165) + 'px; right:' + (config.right || -165)
  2681.             + 'px;"><div style="border: 2px solid #ffa23e; background-color: rgba(60,20,30,.8); border-radius: 7px; width: max-content;">&nbsp;Current positions:<div>');
  2682.             positions.forEach((e) => {
  2683.                 positionsBox += '<img style="height: 48px; width: 48px; cursor: pointer;" src="' + preparePositionImage(e) + '" hh_title="' + GT.figures[e]+ '">';
  2684.             });
  2685.             positionsBox += '</div>&nbsp;Current stage: ' + attempts + ' attempt' + (attempts == 1 ? '':'s') + '&nbsp;</div></div>';
  2686.             $('.champions-over__champion-wrapper').append(positionsBox);
  2687.         }
  2688.  
  2689.         function createStatisticsInfo() {
  2690.             let statisticsBox = ('<div id="additionalInformation" style="position: absolute; top:' + (config.top || 165) + 'px; right:' + (config.right || -165)
  2691.             + 'px;"><div style="border: 2px solid #ffa23e; background-color: rgba(0,0,0,.8); border-radius: 7px; width: max-content;">&nbsp;Statistics:'
  2692.             + '<div class="scroll-area" style="font-size: 14px; max-width: 208px;"><div>');
  2693.             let total = statistics.reduce((a, b) => a + b);
  2694.             let positionList = (statistics.map((elem, idx) => ({'index': idx, 'value': elem}))
  2695.             .filter((e) => e.index > 0 && e.value > 0)
  2696.             .sort((a, b) => (a.value == b.value)? a.index - b.index : b.value - a.value));
  2697.             positionList.forEach((p) => {
  2698.                 statisticsBox += '<div style="display: inline-block; width: 52px; text-align: center;">'
  2699.                 + '<img style="height: 48px; width: 48px; margin-bottom: -6px; cursor: pointer;" src="'
  2700.                 + preparePositionImage(p.index) + '" hh_title="' + GT.figures[p.index] + '" ><span>'
  2701.                 + Math.round(p.value / total * 1000) / 10 + '%</span></div>';
  2702.             });
  2703.             statisticsBox += '</div></div>' + (attempts? ('&nbsp;Prev stage: ' + attempts + ' attempt' + (attempts == 1 ? '':'s') + '&nbsp;') : '') + '</div></div>';
  2704.             $('.champions-over__champion-wrapper').append(statisticsBox);
  2705.             $('.champions-over__champion-wrapper').find('.scroll-area > div').css({'width': positionList.length * 52 + 'px'});
  2706.             if (positionList.length > 4) {
  2707.                 if (is_mobile_size()) {
  2708.                     $('.champions-over__champion-wrapper').find('.scroll-area').css({'padding-bottom': '10px', 'margin-bottom': '-5px'});
  2709.                 }
  2710.                 else {
  2711.                     $('.champions-over__champion-wrapper').find('.scroll-area').css({'padding-bottom': '', 'margin-bottom': '5px'});
  2712.                 }
  2713.                 $('.champions-over__champion-wrapper').find('.scroll-area').niceScroll().resize();
  2714.             }
  2715.         }
  2716.  
  2717.         function configureInfoBox() {
  2718.             $('.girl-box__draggable').droppable('option', 'accept', (e) => e.hasClass('girl-box__draggable'));
  2719.             $('#additionalInformation').on('click', '.eye', (e) => {
  2720.                 config.visible = config.visible == undefined? false : undefined;
  2721.                 $(e.currentTarget).next().toggle('slow');
  2722.                 $(e.currentTarget).children().toggle('fast');
  2723.             }).draggable({
  2724.                 cursor: 'move',
  2725.                 start: function () {
  2726.                     $(this).css({'right': ''});
  2727.                 },
  2728.                 drag: function (event, ui) {
  2729.                     ui.position.top /= FullSize.scale;
  2730.                     ui.position.left /= FullSize.scale;
  2731.                 },
  2732.                 stop: function (event, ui) {
  2733.                     config.right = Math.round($(this).parent().width() - ui.position.left - $(this).width());
  2734.                     config.top = Math.round(ui.position.top);
  2735.                     $(this).css({'left': '', 'right': config.right + 'px'});
  2736.                     $(event.originalEvent.target).one('click', (e) => e.stopImmediatePropagation());
  2737.                 }
  2738.             }).prepend('<a class="eye" style="top: 3px; right: 3px; position: absolute; cursor: pointer;">'
  2739.             + '<img src="https://hh2.hh-content.com/quest/ic_eyeclosed.svg" style="width: 30px; display: block;">'
  2740.             + '<img src="https://hh2.hh-content.com/quest/ic_eyeopen.svg" style="width: 50px; display: none;">'
  2741.             + '</div></a>');
  2742.             if (config.visible == false) {
  2743.                 $('#additionalInformation .eye').children().toggle();
  2744.                 $('#additionalInformation .eye').next().toggle();
  2745.             }
  2746.         }
  2747.     }
  2748. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement