Skip to content

Commit

Permalink
Added a new success
Browse files Browse the repository at this point in the history
  • Loading branch information
Didiloy committed Jan 8, 2025
1 parent 129f0b5 commit 466bb76
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/renderer/src/assets/images/successes/team_player.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/renderer/src/components/TeamList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@
:title="item.why_playing.description + ''"
class="success"
/>
<img
v-if="item.computed_successes && item.team_player.unlocked"
:src="item.team_player.image"
:title="item.team_player.description + ''"
class="success"
/>
</div>
</div>
<div class="team-playtime">
Expand Down Expand Up @@ -235,6 +241,7 @@ function filterTeam() {
thousand_hours: team.thousand_hours,
stinky: team.stinky,
why_playing: team.why_playing,
team_player: team.team_player,
}));
return;
}
Expand Down Expand Up @@ -277,6 +284,7 @@ function getSuccesses() {
thousand_hours,
stinky,
why_playing,
team_player,
} = useSuccesses(i18n);
calculateSuccesses(team.name, sessions.value);
team.relentless = relentless.value;
Expand All @@ -294,6 +302,7 @@ function getSuccesses() {
team.thousand_hours = thousand_hours.value;
team.stinky = stinky.value;
team.why_playing = why_playing.value;
team.team_player = team_player.value;
team.computed_successes = true;
});
}
Expand Down
17 changes: 17 additions & 0 deletions src/renderer/src/composables/successes.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import important_person_logo from "../assets/images/successes/important_person.s
import thousand_hours_logo from "../assets/images/successes/thousand_hours.svg";
import stinky_logo from "../assets/images/successes/stinky.svg";
import why_playing_logo from "../assets/images/successes/why_playing.svg";
import team_player_logo from "../assets/images/successes/team_player.svg";

export function useSuccesses(i18n) {
const store = useStore();
Expand Down Expand Up @@ -49,6 +50,7 @@ export function useSuccesses(i18n) {

let bad_session = new Map(); //relentless
let session_number = 0; //young_gamer, gamer, passionnate
let sessions_in_team = 0; //team_player
let different_games = new Set(); //curious
let bad_session_acc = 0; //depressed
//important_person
Expand Down Expand Up @@ -106,6 +108,11 @@ export function useSuccesses(i18n) {
//stinky
sessions_of_ten_hours++;
}

//team_player
if (session.teams.length > 1) {
sessions_in_team++;
}
}

//relentless and why_playing
Expand Down Expand Up @@ -210,6 +217,15 @@ export function useSuccesses(i18n) {
stinky.value.image = stinky_logo;
stinky.value.description = i18n.t("Successes.descriptions.stinky");
}

//team_player
if (sessions_in_team > session_number / 2) {
team_player.value.unlocked = true;
team_player.value.image = team_player_logo;
team_player.value.description = i18n.t(
"Successes.descriptions.team_player",
);
}
}

return {
Expand All @@ -229,5 +245,6 @@ export function useSuccesses(i18n) {
thousand_hours,
stinky,
why_playing,
team_player,
};
}
2 changes: 2 additions & 0 deletions src/renderer/src/views/Team.vue
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ onMounted(() => {
thousand_hours,
stinky,
why_playing,
team_player,
} = useSuccesses(i18n);
calculateSuccesses(useRoute().params.name, sessions_of_team.value, false);
let unlocked = [];
Expand All @@ -280,6 +281,7 @@ onMounted(() => {
unlocked.push(thousand_hours.value);
unlocked.push(stinky.value);
unlocked.push(why_playing.value);
unlocked.push(team_player.value);
unlocked_successes.value = unlocked.filter((s) => s.unlocked);
selected_success.value = unlocked_successes.value[0];
});
Expand Down

0 comments on commit 466bb76

Please sign in to comment.