Skip to content

Commit

Permalink
Merge pull request #115 from Tmktahu/tk-display-total-mastery
Browse files Browse the repository at this point in the history
Display Total Build Mastery
  • Loading branch information
Tmktahu authored Dec 19, 2023
2 parents 20b3b3d + e70a050 commit 0bf5026
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wakfu-wizard",
"version": "2.1.1",
"version": "2.2.0",
"private": true,
"scripts": {
"serve": "vite",
Expand Down
14 changes: 11 additions & 3 deletions src/components/characterSheet/StatDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,16 @@
</div>
</div>

<!-- <div class="section-header py-1 mb-1">Summary</div> -->
<!-- <div class="summary-area px-2"> This is where we will display a summary of various conditional and other things </div> -->
<div class="flex flex-column">
<div class="section-header py-1 mb-1">{{ $t('characterSheet.statsDisplay.statsSummary') }}</div>

<div class="stat-block pr-2">
<p-image src="https://tmktahu.github.io/WakfuAssets/characteristics/223.png" style="height: 20px" image-style="height: 20px" />
<span class="ml-1">{{ $t('characterSheet.statsDisplay.totalMastery') }}</span>
<div class="flex-grow-1" />
<span>{{ calcTotalMastery() }}</span>
</div>
</div>
</div>
</template>

Expand All @@ -304,7 +312,7 @@ import { useStats } from '@/models/useStats';
const currentCharacter = inject('currentCharacter');
const { calcElemResistancePercentage } = useStats();
const { calcElemResistancePercentage, calcTotalMastery } = useStats(currentCharacter);
</script>

<style lang="scss" scoped>
Expand Down
49 changes: 20 additions & 29 deletions src/models/useStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ export const useStats = (currentCharacter) => {

// Other masteries
currentCharacter.value.masteries.melee =
currentCharacter.value.characteristics.strength.meleeMastery * 8 +
calcItemContribution(EFFECT_TYPE_DATA.meleeMastery) +
calcRuneContribution(RUNE_TYPES.meleeMastery);
currentCharacter.value.characteristics.strength.meleeMastery * 8 + calcItemContribution(EFFECT_TYPE_DATA.meleeMastery) + calcRuneContribution(RUNE_TYPES.meleeMastery);
currentCharacter.value.masteries.distance =
currentCharacter.value.characteristics.strength.distanceMastery * 8 +
calcItemContribution(EFFECT_TYPE_DATA.distanceMastery) +
Expand All @@ -93,17 +91,11 @@ export const useStats = (currentCharacter) => {
calcItemContribution(EFFECT_TYPE_DATA.criticalMastery) +
calcRuneContribution(RUNE_TYPES.criticalMastery);
currentCharacter.value.masteries.rear =
currentCharacter.value.characteristics.fortune.rearMastery * 6 +
calcItemContribution(EFFECT_TYPE_DATA.rearMastery) +
calcRuneContribution(RUNE_TYPES.rearMastery);
currentCharacter.value.characteristics.fortune.rearMastery * 6 + calcItemContribution(EFFECT_TYPE_DATA.rearMastery) + calcRuneContribution(RUNE_TYPES.rearMastery);
currentCharacter.value.masteries.berserk =
currentCharacter.value.characteristics.fortune.berserkMastery * 8 +
calcItemContribution(EFFECT_TYPE_DATA.berserkMastery) +
calcRuneContribution(RUNE_TYPES.berserkMastery);
currentCharacter.value.characteristics.fortune.berserkMastery * 8 + calcItemContribution(EFFECT_TYPE_DATA.berserkMastery) + calcRuneContribution(RUNE_TYPES.berserkMastery);
currentCharacter.value.masteries.healing =
currentCharacter.value.characteristics.fortune.healingMastery * 6 +
calcItemContribution(EFFECT_TYPE_DATA.healingMastery) +
calcRuneContribution(RUNE_TYPES.healingMastery);
currentCharacter.value.characteristics.fortune.healingMastery * 6 + calcItemContribution(EFFECT_TYPE_DATA.healingMastery) + calcRuneContribution(RUNE_TYPES.healingMastery);

// Resistances
currentCharacter.value.resistances.water =
Expand All @@ -129,8 +121,7 @@ export const useStats = (currentCharacter) => {

currentCharacter.value.resistances.critical =
currentCharacter.value.characteristics.fortune.criticalResistance * 4 + calcItemContribution(EFFECT_TYPE_DATA.criticalResistance);
currentCharacter.value.resistances.rear =
currentCharacter.value.characteristics.fortune.rearResistance * 4 + calcItemContribution(EFFECT_TYPE_DATA.rearResistance);
currentCharacter.value.resistances.rear = currentCharacter.value.characteristics.fortune.rearResistance * 4 + calcItemContribution(EFFECT_TYPE_DATA.rearResistance);

// Other stats
currentCharacter.value.stats.lock =
Expand All @@ -154,9 +145,7 @@ export const useStats = (currentCharacter) => {
);

currentCharacter.value.stats.initiative =
currentCharacter.value.characteristics.agility.initiative * 4 +
calcItemContribution(EFFECT_TYPE_DATA.initiative) +
calcRuneContribution(RUNE_TYPES.initiative);
currentCharacter.value.characteristics.agility.initiative * 4 + calcItemContribution(EFFECT_TYPE_DATA.initiative) + calcRuneContribution(RUNE_TYPES.initiative);

currentCharacter.value.stats.forceOfWill =
currentCharacter.value.characteristics.agility.forceOfWill * 1 +
Expand Down Expand Up @@ -188,14 +177,10 @@ export const useStats = (currentCharacter) => {
);

currentCharacter.value.stats.range =
currentCharacter.value.characteristics.major.rangeAndDamage +
calcItemContribution(EFFECT_TYPE_DATA.range) +
calcPassivesContribution(EFFECT_TYPE_DATA.range);
currentCharacter.value.characteristics.major.rangeAndDamage + calcItemContribution(EFFECT_TYPE_DATA.range) + calcPassivesContribution(EFFECT_TYPE_DATA.range);

currentCharacter.value.stats.control =
currentCharacter.value.characteristics.major.controlAndDamage * 2 +
calcItemContribution(EFFECT_TYPE_DATA.control) +
calcPassivesContribution(EFFECT_TYPE_DATA.control);
currentCharacter.value.characteristics.major.controlAndDamage * 2 + calcItemContribution(EFFECT_TYPE_DATA.control) + calcPassivesContribution(EFFECT_TYPE_DATA.control);

currentCharacter.value.stats.indirectDamage = calcPassivesContribution(EFFECT_TYPE_DATA.indirectDamageInflicted);
currentCharacter.value.stats.healsReceived = calcPassivesContribution(EFFECT_TYPE_DATA.healsReceived);
Expand Down Expand Up @@ -388,12 +373,7 @@ export const useStats = (currentCharacter) => {
rune.id === RUNE_TYPES.healingMastery
) {
baseValue = RUNE_MASTERY_LEVEL_VALUES[level - 1];
} else if (
rune.id === RUNE_TYPES.earthResistance ||
rune.id === RUNE_TYPES.fireResistance ||
rune.id === RUNE_TYPES.waterResistance ||
rune.id === RUNE_TYPES.airResistance
) {
} else if (rune.id === RUNE_TYPES.earthResistance || rune.id === RUNE_TYPES.fireResistance || rune.id === RUNE_TYPES.waterResistance || rune.id === RUNE_TYPES.airResistance) {
baseValue = RUNE_RESISTANCE_LEVEL_VALUES[level - 1];
} else if (rune.id === RUNE_TYPES.lock || rune.id === RUNE_TYPES.dodge) {
baseValue = RUNE_DODGE_LOCK_LEVEL_VALUES[level - 1];
Expand All @@ -417,10 +397,21 @@ export const useStats = (currentCharacter) => {
return finalValue;
};

const calcTotalMastery = () => {
let totalMastery = 0;

Object.keys(currentCharacter.value?.masteries).forEach((masteryKey) => {
totalMastery += currentCharacter.value?.masteries?.[masteryKey];
});

return totalMastery;
};

return {
setup,
calcElemResistancePercentage,
calcItemContribution,
getRuneValue,
calcTotalMastery,
};
};
3 changes: 2 additions & 1 deletion src/plugins/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ export const en = {
secondary: 'Secondary',
armorReceived: 'Armor Received',
indirectDamage: 'Indirect Damage',
totalMastery: 'Total Mastery',
statsSummary: 'Stats Summary',
},

characteristicsContent: {
Expand Down Expand Up @@ -200,7 +202,6 @@ export const en = {
shiftClick: 'SHIFT-Click a rune to toggle it white.',
rightClick: 'Right-Click a rune for more options.',
hightlightClick: 'Highlight a slot and click a rune on the right to assign it.',
statsSummary: 'Stats Summary',
runeLevelTooltip: `The maximum possible rune level is tied to the item's level, but for our purposes I limit this input by your character level.`,
runeLevel: 'Rune Level',
toggleWhite: 'Toggle White',
Expand Down

0 comments on commit 0bf5026

Please sign in to comment.