Skip to content

Commit

Permalink
Merge pull request #798 from wowsims/feature/softcap-display
Browse files Browse the repository at this point in the history
Add breakpoint display
  • Loading branch information
1337LutZ authored Jun 28, 2024
2 parents 2900b73 + 044cca9 commit 5d14f72
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 14 deletions.
45 changes: 42 additions & 3 deletions ui/core/components/suggest_reforges_action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Player } from '../player';
import { Class, ItemSlot, Spec, Stat } from '../proto/common';
import { StatCapConfig, StatCapType } from '../proto/ui';
import { Gear } from '../proto_utils/gear';
import { getClassStatName } from '../proto_utils/names';
import { getClassStatName, statCapTypeNames } from '../proto_utils/names';
import { statPercentageOrPointsToNumber, Stats, statToPercentageOrPoints } from '../proto_utils/stats';
import { SpecTalents } from '../proto_utils/utils';
import { Sim } from '../sim';
Expand Down Expand Up @@ -150,9 +150,11 @@ export class ReforgeOptimizer {

if (!!this.softCapsConfig?.length)
tippy(startReforgeOptimizationButton, {
theme: 'suggest-reforges-softcaps',
content: this.buildReforgeButtonTooltip(),
placement: 'bottom',
maxWidth: 310,
interactive: true,
});

tippy(contextMenuButton, {
Expand Down Expand Up @@ -201,8 +203,45 @@ export class ReforgeOptimizer {
buildReforgeButtonTooltip() {
return (
<>
The following soft caps / breakpoints have been implemented for this spec:
<ul className="mt-1 mb-0">{this.softCapsConfig?.map(({ stat }) => <li>{getClassStatName(stat, this.player.getClass())}</li>)}</ul>
<p>The following breakpoints have been implemented for this spec:</p>
<table className="w-100">
<tbody>
{this.softCapsConfig?.map(({ stat, breakpoints, capType, postCapEPs }, index) => (
<>
<tr>
<th colSpan={2}>{getClassStatName(stat, this.player.getClass())}</th>
<td className="text-end">{statCapTypeNames.get(capType)}</td>
</tr>
<tr>
<th><em>Rating</em></th>
<th className="text-end">
<em>%</em>
</th>
<th className="text-end">
<em>Post cap EP</em>
</th>
</tr>
{breakpoints.map((breakpoint, breakpointIndex) => (
<tr>
<td>{Math.round(breakpoint)}</td>
<td className="text-end">{statToPercentageOrPoints(stat, breakpoint, new Stats()).toFixed(2)}</td>
<td className="text-end">{postCapEPs[breakpointIndex]}</td>
</tr>
))}
{index !== this.softCapsConfig.length - 1 && (
<>
<tr>
<td colSpan={2} className="border-bottom pb-2"></td>
</tr>
<tr>
<td colSpan={2} className="pb-2"></td>
</tr>
</>
)}
</>
))}
</tbody>
</table>
</>
);
}
Expand Down
19 changes: 10 additions & 9 deletions ui/core/proto_utils/names.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ResourceType } from '../proto/api.js';
import { ArmorType, Class, ItemSlot, Profession, PseudoStat, Race, RangedWeaponType, Spec, Stat, WeaponType } from '../proto/common.js';
import { DungeonDifficulty, RaidFilterOption, RepFaction, RepLevel, SourceFilterOption } from '../proto/ui.js';
import { DungeonDifficulty, RaidFilterOption, RepFaction, RepLevel, SourceFilterOption, StatCapType } from '../proto/ui.js';

export const armorTypeNames: Map<ArmorType, string> = new Map([
[ArmorType.ArmorTypeUnknown, 'Unknown'],
Expand Down Expand Up @@ -193,11 +193,7 @@ export const shortSecondaryStatNames: Map<Stat, string> = new Map([
[Stat.StatParry, 'Parry'],
]);

export const pseudoStatOrder: Array<PseudoStat> = [
PseudoStat.PseudoStatMainHandDps,
PseudoStat.PseudoStatOffHandDps,
PseudoStat.PseudoStatRangedDps,
];
export const pseudoStatOrder: Array<PseudoStat> = [PseudoStat.PseudoStatMainHandDps, PseudoStat.PseudoStatOffHandDps, PseudoStat.PseudoStatRangedDps];
export const pseudoStatNames: Map<PseudoStat, string> = new Map([
[PseudoStat.PseudoStatMainHandDps, 'Main Hand DPS'],
[PseudoStat.PseudoStatOffHandDps, 'Off Hand DPS'],
Expand Down Expand Up @@ -338,8 +334,8 @@ export const REP_FACTION_NAMES: Record<RepFaction, string> = {
[RepFaction.RepFactionDragonmawClan]: 'Dragonmaw Clan',
[RepFaction.RepFactionRamkahen]: 'Ramkahen',
[RepFaction.RepFactionWildhammerClan]: 'Wildhammer Clan',
[RepFaction.RepFactionBaradinsWardens]: 'Baradin\'s Wardens',
[RepFaction.RepFactionHellscreamsReach]: 'Hellscream\'s Reach',
[RepFaction.RepFactionBaradinsWardens]: "Baradin's Wardens",
[RepFaction.RepFactionHellscreamsReach]: "Hellscream's Reach",
[RepFaction.RepFactionAvengersOfHyjal]: 'Avengers of Hyjal',
};

Expand All @@ -354,7 +350,7 @@ export const REP_FACTION_QUARTERMASTERS: Record<RepFaction, number> = {
[RepFaction.RepFactionBaradinsWardens]: 47328,
[RepFaction.RepFactionHellscreamsReach]: 48531,
[RepFaction.RepFactionAvengersOfHyjal]: 54401,
}
};

export const masterySpellNames: Map<Spec, string> = new Map([
[Spec.SpecAssassinationRogue, 'Potent Poisons'],
Expand Down Expand Up @@ -423,3 +419,8 @@ export const masterySpellIDs: Map<Spec, number> = new Map([
[Spec.SpecDemonologyWarlock, 77219],
[Spec.SpecDestructionWarlock, 77220],
]);
export const statCapTypeNames = new Map<StatCapType, string>([
[StatCapType.TypeHardCap, 'Hard cap'],
[StatCapType.TypeSoftCap, 'Soft cap'],
[StatCapType.TypeThreshold, 'Threshold'],
]);
1 change: 0 additions & 1 deletion ui/core/proto_utils/stats.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as Mechanics from '../constants/mechanics.js';
import { Player } from '../player';
import { Class, PseudoStat, Stat, UnitStats } from '../proto/common.js';
import { getEnumValues } from '../utils.js';
import { getClassStatName, pseudoStatNames } from './names.js';
Expand Down
2 changes: 1 addition & 1 deletion ui/mage/fire/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const SPEC_CONFIG = registerSpecConfig(Spec.SpecFireMage, {
stat: Stat.StatSpellHaste,
breakpoints,
capType: StatCapType.TypeSoftCap,
postCapEPs: [0.96, 0.86, 0.77, 0.77, 1.17, 0.76, 0.65],
postCapEPs: [0.86, 0.77, 0.77, 1.17, 0.76, 0.65, 0.64],
};

return [hasteSoftCapConfig];
Expand Down
5 changes: 5 additions & 0 deletions ui/scss/core/components/_suggest_reforges_action.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
margin-bottom: 0;
}
}
.tippy-box[data-theme='suggest-reforges-softcaps'] {
max-height: 40vh;
overflow: auto;
}

.suggest-reforges-settings-group {
--settings-button-width: 36px;
position: relative;
Expand Down

0 comments on commit 5d14f72

Please sign in to comment.