Skip to content

Commit

Permalink
Fixing mising mojo icon in season, harem teams filter and champions s…
Browse files Browse the repository at this point in the history
…hard count display after 07/12 update
  • Loading branch information
Numbers committed Dec 7, 2022
1 parent 0099f93 commit 801d446
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 90 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
1.28.13: Fixing mising mojo icon in season, harem teams filter and champions shard count display after 07/12 update
1.28.12: Pre-empting update that breaks upgrade page quicknav module
1.28.11: Pre-empting update that breaks pachinko names module
1.28.10: Fixing Double Date indicator on the home screen. Updating patrons list for December.
Expand Down
12 changes: 6 additions & 6 deletions dist/hh-plus-plus.dev.user.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/hh-plus-plus.meta.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name Hentai Heroes++ BDSM version
// @description Adding things here and there in the Hentai Heroes game. Also supports HHCore-based games such as GH and CxH.
// @version 1.28.12
// @version 1.28.13
// @match https://*.hentaiheroes.com/*
// @match https://nutaku.haremheroes.com/*
// @match https://*.gayharem.com/*
Expand Down
6 changes: 3 additions & 3 deletions dist/hh-plus-plus.user.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hh-plus-plus",
"version": "1.28.12",
"version": "1.28.13",
"description": "Adding things here and there in the Hentai Heroes game. Also supports HHCore-based games such as GH and CxH.",
"private": "true",
"scripts": {
Expand Down
30 changes: 15 additions & 15 deletions src/modules/BattleSimulatorModule/Season.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import I18n from '../../i18n'
import SimHelpers from './SimHelpers'

class Season {
constructor (idOpponent) {
constructor(idOpponent) {
this.idOpponent = idOpponent
}

extract () {
const {caracs_per_opponent} = window
extract() {
const { caracs_per_opponent } = window

const $playerData = $('#season-arena .battle_hero')
const $opponentData = $('#season-arena .opponents_arena .season_arena_opponent_container:nth-child(' + (2*this.idOpponent+1) + ')')
const $opponentData = $('#season-arena .opponents_arena .season_arena_opponent_container:nth-child(' + (2 * this.idOpponent + 1) + ')')
const opponentId = $opponentData.attr('data-opponent') // using attr as we want a string, not a number

const {
Expand All @@ -25,7 +25,7 @@ class Season {
const playerSynergyDataJSON = $playerData.find('.hero_team .icon-area').attr('synergy-data')
const playerSynergies = JSON.parse(playerSynergyDataJSON)
const playerTeam = $playerData.find('.hero_team .team-member img').map((i, el) => $(el).data('new-girl-tooltip')).toArray()
const playerTeamMemberElements = playerTeam.map(({element_data})=>element_data.type)
const playerTeamMemberElements = playerTeam.map(({ element_data }) => element_data.type)
const playerElements = SimHelpers.calculateThemeFromElements(playerTeamMemberElements)
const playerBonuses = {
critDamage: SimHelpers.findBonusFromSynergies(playerSynergies, 'fire'),
Expand All @@ -38,7 +38,7 @@ class Season {
const opponentAtk = parseInt($opponentData.find('.hero_stats div:nth-child(1) div:nth-child(1) span:nth-child(2)').text().replace(/[^0-9]/gi, ''), 10)
const opponentCrit = parseInt($opponentData.find('.hero_stats div:nth-child(2) div:nth-child(2) span:nth-child(2)').text().replace(/[^0-9]/gi, ''), 10)
const opponentTeam = $opponentData.find('.hero_team .team-member img').map((i, el) => $(el).data('new-girl-tooltip')).toArray()
const opponentTeamMemberElements = opponentTeam.map(({element})=>element)
const opponentTeamMemberElements = opponentTeam.map(({ element }) => element)
const opponentElements = SimHelpers.calculateThemeFromElements(opponentTeamMemberElements)
const opponentBonuses = SimHelpers.calculateSynergiesFromTeamMemberElements(opponentTeamMemberElements)

Expand All @@ -54,28 +54,28 @@ class Season {
hp: opponentEgo,
dmg: opponentAtk - playerDef,
critchance: SimHelpers.calculateCritChanceShare(opponentCrit, playerCrit) + dominanceBonuses.opponent.chance + opponentBonuses.critChance,
name: $('.season_arena_opponent_container:nth-child(' + (2*this.idOpponent+1) + ') > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1)').text(),
name: $('.season_arena_opponent_container:nth-child(' + (2 * this.idOpponent + 1) + ') > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1)').text(),
bonuses: opponentBonuses
}

return {player, opponent}
return { player, opponent }
}

display (result) {
const $opponentData = $('#season-arena .opponents_arena .season_arena_opponent_container:nth-child(' + (2*this.idOpponent+1) + ')')
display(result) {
const $opponentData = $('#season-arena .opponents_arena .season_arena_opponent_container:nth-child(' + (2 * this.idOpponent + 1) + ')')
let $gridWrapper = $opponentData.find('.gridWrapper')
if (!$gridWrapper.length) {
$opponentData.find('.average-lvl').wrap('<div class="gridWrapper"></div>')
$gridWrapper = $opponentData.find('.gridWrapper')
}

$gridWrapper.find('.matchRating').remove()
const {rewards} = $opponentData.find('.rewards_list').data('reward-display')
const pointsReward = rewards.find(({type})=>type==='victory_points')
const { rewards } = $opponentData.find('.rewards_list').data('reward-display')
const pointsReward = rewards.find(({ type }) => type === 'victory_points')
const points = parseInt($(pointsReward.value).text())
const expected = result.win*points-(1-result.win)*(40-points)
const pointClass = expected>15?'plus':expected<0?'minus':'close'
$gridWrapper.append(`<span class="matchRating"><span class="${result.scoreClass}">${I18n.nRounding(100*result.win, 2, -1)}%</span><br/><span class="${pointClass}">E[<span cur="victory_points"></span>]=${I18n.nRounding(expected, 1, -1)}</span></span>`)
const expected = result.win * points - (1 - result.win) * (40 - points)
const pointClass = expected > 15 ? 'plus' : expected < 0 ? 'minus' : 'close'
$gridWrapper.append(`<span class="matchRating"><span class="${result.scoreClass}">${I18n.nRounding(100 * result.win, 2, -1)}%</span><br/><span class="${pointClass}">E[<span cur="victory_points"></span>]=${I18n.nRounding(expected, 1, -1)}</span></span>`)
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/modules/BattleSimulatorModule/styles.lazy.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,14 @@ $minus-bg: #ff2f2f28;
margin-top: -10px;

[cur="victory_points"]::before {
content: " ";
display: inline-block;
background-image: var(--mojo-icon-s);
width: 14px;
height: 14px;
background-size: contain;
background-position: center;
background-repeat: no-repeat;
position: relative;
top: -4px;
filter: drop-shadow(0px 0px 1px #000);
Expand Down
34 changes: 17 additions & 17 deletions src/modules/HaremTeamsFilterModule/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import Sheet from '../../common/Sheet'

import styles from './styles.lazy.scss'

const {$} = Helpers
const { $ } = Helpers

const MODULE_KEY = 'haremTeamsFilter'

class HaremTeamsFilterModule extends CoreModule {
constructor () {
constructor() {
super({
baseKey: MODULE_KEY,
label: I18n.getModuleLabel('config', MODULE_KEY),
Expand All @@ -20,12 +20,12 @@ class HaremTeamsFilterModule extends CoreModule {
this.label = I18n.getModuleLabel.bind(this, MODULE_KEY)
}

shouldRun () {
shouldRun() {
return Helpers.isCurrentPage('harem') && !Helpers.isCurrentPage('hero')
}

run () {
if (this.hasRun || !this.shouldRun()) {return}
run() {
if (this.hasRun || !this.shouldRun()) { return }

styles.use()

Expand All @@ -43,7 +43,7 @@ class HaremTeamsFilterModule extends CoreModule {
Sheet.registerVar('cross-icon', `url('${Helpers.getCDNHost()}/clubs/ic_xCross.png')`)
}

loadFilter () {
loadFilter() {
const filters = Helpers.lsGet('filters')

if (filters && filters.team) {
Expand All @@ -56,18 +56,18 @@ class HaremTeamsFilterModule extends CoreModule {
observer.disconnect()
}
})
observer.observe($('.girls_list')[0], {childList: true})
observer.observe($('.girls_list')[0], { childList: true })
}
}
}

createAndAttach () {
createAndAttach() {
const $teamsButton = this.createTeamsButton()
const $teamsBox = this.createTeamsBox()
$('#filtering_girls .reset-filters-container').prepend($teamsButton)
$('#harem_whole').append($teamsBox)

$teamsButton.click(()=>$teamsBox.find('.team-selection').toggle())
$teamsButton.click(() => $teamsBox.find('.team-selection').toggle())
const doFilter = this.doFilter
$teamsBox.find('.team-slot-container').click(function () {
doFilter($(this).data('girl-ids'))
Expand All @@ -77,26 +77,26 @@ class HaremTeamsFilterModule extends CoreModule {
}

doFilter(girlIds) {
const {harem, hh_show_filtered_girls} = window
const { harem, hh_show_filtered_girls } = window
harem.haremFilter.resetFilters()
harem.filteredGirlsIds = girlIds
harem.filteredGirlsIds = girlIds.map(id => +id)
harem.filteredGirlsList = girlIds.map(id => harem.allGirls[id])

const filterData = girlIds.reduce((a, i) => {a[i] = {};return a}, {})
const filterData = girlIds.reduce((a, i) => { a[i] = {}; return a }, {})
hh_show_filtered_girls('.girls_list', filterData)

harem.resetGirlsList()
harem.loadMoreGirlsAfterCurrent()
harem.scrollToAndOpenGirl()

Helpers.lsSet('filters', {team: girlIds})
Helpers.lsSet('filters', { team: girlIds })
}

createTeamsButton () {
createTeamsButton() {
return $(`<button id="teams-filter" class="blue_button_L">${this.label('team')}</button>`)
}

createTeamsBox () {
createTeamsBox() {
const bdsmTeams = Helpers.lsGet(lsKeys.TEAMS_DICTIONARY)
if (!bdsmTeams) {
return $(`
Expand All @@ -107,7 +107,7 @@ class HaremTeamsFilterModule extends CoreModule {
</div>
</div>`)
}
const {teamIds, teamsDict} = bdsmTeams
const { teamIds, teamsDict } = bdsmTeams
return $(`
<div style="position:relative">
<div class="team-selection" style="display: none;">
Expand All @@ -118,7 +118,7 @@ class HaremTeamsFilterModule extends CoreModule {
<img src="${Helpers.getCDNHost()}/pictures/girls/${team.iconId}/ico${team.iconLevel}.png" />
${team.themeElements ? `
<div class="theme-icons">
${team.themeElements.map(element=>`<img class="theme-icon" src="${Helpers.getCDNHost()}/pictures/girls_elements/${element}.png"/>`).join('')}
${team.themeElements.map(element => `<img class="theme-icon" src="${Helpers.getCDNHost()}/pictures/girls_elements/${element}.png"/>`).join('')}
</div>
` : ''}
</div>
Expand Down
Loading

0 comments on commit 801d446

Please sign in to comment.