Skip to content

Commit

Permalink
Merge pull request #1060 from Heroes-Profile/develop
Browse files Browse the repository at this point in the history
Heroes Profile v1.1.3
  • Loading branch information
Zemill authored Sep 8, 2024
2 parents 6897dd1 + 0523cb8 commit 9f4dc5b
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function getData(Request $request)
$page = $request['page'];
$role = $request['role'];
$game_map = $request['game_map'] ? Map::where('name', $request['game_map'])->pluck('map_id')->first() : null;

$season = $request['season'];

$result = Replay::join('player', 'player.replayID', '=', 'replay.replayID')
Expand Down Expand Up @@ -106,7 +107,7 @@ public function getData(Request $request)
->when($type == 'single' && $page == 'role', function ($query) use ($role) {
return $query->where('new_role', $role);
})
->when($type == 'single' && $page == 'map', function ($query) use ($game_map) {
->when($game_map && $type == 'single' && ($page == 'map' || $page == 'hero'), function ($query) use ($game_map) {
return $query->where('game_map', $game_map);
})
->when(! is_null($season), function ($query) use ($season) {
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/GameSummaryBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<stat-box :title="'Hero MMR'" :value="data.hero_mmr.toLocaleString('en-US')" :secondstat="data.player_change !== null ? data.hero_change.toFixed(2): null" :secondcaption="'Change'" secondtype="mmrchange" :color="data.winner === 1 ? 'blue' : 'red'"></stat-box>
<stat-box :title="'Role MMR'" :value="data.role_mmr.toLocaleString('en-US')" :secondstat="data.player_change !== null ? data.role_change.toFixed(2) : null" :secondcaption="'Change'" secondtype="mmrchange" :color="data.winner === 1 ? 'blue' : 'red'"></stat-box>
</div>
<div class="flex gap-x-1 mx-2 items-center justify-start md:w-[450px] pl-2">
<div class="flex gap-x-1 mx-2 items-center justify-start md:w-[450px] pl-2 max-md:flex-wrap">
<div class="flex-1"><talent-image-wrapper :talent="data.level_one" :size="'medium'"></talent-image-wrapper></div>
<div class="flex-1"><talent-image-wrapper :talent="data.level_four" :size="'medium'"></talent-image-wrapper></div>
<div class="flex-1"><talent-image-wrapper :talent="data.level_seven" :size="'medium'"></talent-image-wrapper></div>
Expand Down
138 changes: 80 additions & 58 deletions resources/js/components/Player/Heroes/PlayerHeroSingleStats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
<hero-image-wrapper :hero="heroobject" :size="'big'"></hero-image-wrapper>
</page-heading>

<div class="flex justify-center max-w-[1500px] mx-auto">
<div class="flex justify-center max-w-[1500px] mx-auto flex-wrap max-md:flex-col max-md:items-center">
<single-select-filter :values="gameTypesWithAll" :text="'Game Type'" @input-changed="handleInputChange" :trackclosure="true" :defaultValue="!modifiedgametype ? 'All' : modifiedgametype" :disabled="disableFilterInput"></single-select-filter>
<single-select-filter :values="seasonsWithAll" :text="'Season'" @input-changed="handleInputChange" :trackclosure="true" :defaultValue="'All'" :disabled="disableFilterInput"></single-select-filter>
<single-select-filter :values="gameMapWithAll" :text="'Game Map'" @input-changed="handleInputChange" :trackclosure="true" :defaultValue="'All'" :disabled="disableFilterInput"></single-select-filter>
<button :disabled="disableFilterInput" @click="applyFilter" :class="{'bg-teal rounded text-white md:ml-10 px-4 py-2 md:mt-auto mb-2 hover:bg-lteal max-md:mb-auto max-md:w-full max-md:mt-10': !disableFilterInput, 'bg-gray-md rounded text-white md:ml-10 px-4 py-2 mt-auto mb-2 hover:bg-gray-md max-md:mt-auto max-md:w-full': disableFilterInput}">
Filter
</button>
Expand All @@ -15,11 +16,13 @@
<dynamic-banner-ad :patreon-user="patreonUser"></dynamic-banner-ad>

<div v-if="data">
<div class="flex md:p-20 gap-10 mx-auto justify-center items-center ">
<div class="flex-1 flex flex-wrap justify-between max-w-[450px] w-full items-between mt-[1em]">
<div class="flex md:p-20 gap-10 mx-auto justify-center items-between max-md:flex-col max-md:items-center">
<div class="flex-1 flex flex-wrap justify-between max-w-[400px] w-full items-between mt-[1em] max-md:order-1">
<stat-box class="w-[48%]" :title="'Wins'" :value="data.wins.toLocaleString('en-US')"></stat-box>
<stat-box class="w-[48%]" :title="'Losses'" :value="data.losses.toLocaleString('en-US')"></stat-box>
<stat-bar-box class="w-full mb-5" size="full" :title="'Win Rate'" :value="data.win_rate.toFixed(2)" color="teal"></stat-bar-box>
<div class="w-full mx-auto text-center">
<stat-bar-box class="w-full mb-5" size="full" :title="'Win Rate'" :value="data.win_rate.toFixed(2)" color="teal"></stat-bar-box>
</div>
<stat-box class="w-[48%]" :title="'KDR'" :value="data.kdr" color="red"></stat-box>
<stat-box class="w-[48%]" :title="'KDA'" :value="data.kda" color="red"></stat-box>
</div>
Expand Down Expand Up @@ -65,77 +68,79 @@
<dynamic-banner-ad :patreon-user="patreonUser" :index="1" :mobile-override="false"></dynamic-banner-ad>

<div class="bg-lighten">
<div class="flex justify-center max-w-[1500px] mx-auto items-center">
<div class="max-w-[1000px] mx-auto">
<div class="grid grid-cols-4 items-center gap-10 md:px-20 py-5 justify-center" >
<h4 class="text-right">Quick Match</h4>
<stat-bar-box :title="'Win Rate'" :value=" data.qm_mmr_data ? data.qm_mmr_data.win_rate.toFixed(2) : 0 "></stat-bar-box>
<stat-box title="Rank Tier" :value="data.qm_mmr_data ? data.qm_mmr_data.rank_tier : ''"></stat-box>
<stat-box :title="'MMR'" :value="data.qm_mmr_data ? data.qm_mmr_data.mmr.toLocaleString('en-US') : 0 "></stat-box>
</div>
<div class="flex justify-center max-w-[1500px] mx-auto items-center max-md:flex-col">
<div class="max-w-[1500px] mx-auto">
<div class="grid grid-cols-4 max-md:grid-cols-2 items-center gap-10 md:px-20 py-5 justify-center" >
<h4 class="text-right">Quick Match</h4>
<stat-bar-box :title="'Win Rate'" :value=" data.qm_mmr_data ? data.qm_mmr_data.win_rate.toFixed(2) : 0 "></stat-bar-box>
<stat-box title="Rank Tier" :value="data.qm_mmr_data ? data.qm_mmr_data.rank_tier : ''"></stat-box>
<stat-box :title="'MMR'" :value="data.qm_mmr_data ? data.qm_mmr_data.mmr.toLocaleString('en-US') : 0 "></stat-box>
</div>

<div class="grid grid-cols-4 items-center gap-10 md:px-20 py-5 justify-center" >
<h4 class="text-right">Unranked Draft</h4>
<stat-bar-box :title="'Win Rate'" :value=" data.ud_mmr_data ? data.ud_mmr_data.win_rate.toFixed(2) : 0 " color="teal"></stat-bar-box>
<stat-box title="Rank Tier" :value="data.ud_mmr_data ? data.ud_mmr_data.rank_tier : ''" color="teal"></stat-box>
<stat-box :title="'MMR'" :value="data.ud_mmr_data ? data.ud_mmr_data.mmr.toLocaleString('en-US') : 0 " color="teal"></stat-box>
</div>
<div class="grid grid-cols-4 max-md:grid-cols-2 items-center gap-10 md:px-20 py-5 justify-center" >
<h4 class="text-right">Unranked Draft</h4>
<stat-bar-box :title="'Win Rate'" :value=" data.ud_mmr_data ? data.ud_mmr_data.win_rate.toFixed(2) : 0 " color="teal"></stat-bar-box>
<stat-box title="Rank Tier" :value="data.ud_mmr_data ? data.ud_mmr_data.rank_tier : ''" color="teal"></stat-box>
<stat-box :title="'MMR'" :value="data.ud_mmr_data ? data.ud_mmr_data.mmr.toLocaleString('en-US') : 0 " color="teal"></stat-box>
</div>

<div class=" grid grid-cols-4 items-center gap-10 md:px-20 py-5 justify-center" >
<h4 class="text-right">Hero league</h4>
<stat-bar-box :title="'Win Rate'" :value=" data.hl_mmr_data ? data.hl_mmr_data.win_rate.toFixed(2) : 0 " color="red"></stat-bar-box>
<stat-box title="Rank Tier" :value="data.hl_mmr_data ? data.hl_mmr_data.rank_tier : ''" color="red"></stat-box>
<stat-box :title="'MMR'" :value="data.hl_mmr_data ? data.hl_mmr_data.mmr.toLocaleString('en-US') : 0 " color="red"></stat-box>
</div>
<div class=" grid grid-cols-4 max-md:grid-cols-2 items-center gap-10 md:px-20 py-5 justify-center" >
<h4 class="text-right">Hero league</h4>
<stat-bar-box :title="'Win Rate'" :value=" data.hl_mmr_data ? data.hl_mmr_data.win_rate.toFixed(2) : 0 " color="red"></stat-bar-box>
<stat-box title="Rank Tier" :value="data.hl_mmr_data ? data.hl_mmr_data.rank_tier : ''" color="red"></stat-box>
<stat-box :title="'MMR'" :value="data.hl_mmr_data ? data.hl_mmr_data.mmr.toLocaleString('en-US') : 0 " color="red"></stat-box>
</div>


<div class="grid grid-cols-4 items-center gap-10 md:px-20 py-5 justify-center" >
<h4 class="text-right">Team league</h4>
<stat-bar-box :title="'Win Rate'" :value=" data.tl_mmr_data ? data.tl_mmr_data.win_rate.toFixed(2) : 0 " color="yellow"></stat-bar-box>
<stat-box title="Rank Tier" :value="data.tl_mmr_data ? data.tl_mmr_data.rank_tier : ''" color="yellow"></stat-box>
<stat-box :title="'MMR'" :value="data.tl_mmr_data ? data.tl_mmr_data.mmr.toLocaleString('en-US') : 0 " color="yellow"></stat-box>
</div>
<div class="grid grid-cols-4 max-md:grid-cols-2 items-center gap-10 md:px-20 py-5 justify-center" >
<h4 class="text-right">Team league</h4>
<stat-bar-box :title="'Win Rate'" :value=" data.tl_mmr_data ? data.tl_mmr_data.win_rate.toFixed(2) : 0 " color="yellow"></stat-bar-box>
<stat-box title="Rank Tier" :value="data.tl_mmr_data ? data.tl_mmr_data.rank_tier : ''" color="yellow"></stat-box>
<stat-box :title="'MMR'" :value="data.tl_mmr_data ? data.tl_mmr_data.mmr.toLocaleString('en-US') : 0 " color="yellow"></stat-box>
</div>

<div class="grid grid-cols-4 items-center gap-10 md:px-20 py-5 justify-center" >
<h4 class="text-right"> Storm league</h4>
<stat-bar-box :title="'Win Rate'" :value=" data.sl_mmr_data ? data.sl_mmr_data.win_rate.toFixed(2) : 0 " color="gray-dark"></stat-bar-box>
<stat-box title="Rank Tier" :value="data.sl_mmr_data ? data.sl_mmr_data.rank_tier : ''" color="gray-dark"></stat-box>
<stat-box :title="'MMR'" :value="data.sl_mmr_data ? data.sl_mmr_data.mmr.toLocaleString('en-US') : 0 " color="gray-dark"></stat-box>
</div>
<div class="grid grid-cols-4 max-md:grid-cols-2 items-center gap-10 md:px-20 py-5 justify-center" >
<h4 class="text-right"> Storm league</h4>
<stat-bar-box :title="'Win Rate'" :value=" data.sl_mmr_data ? data.sl_mmr_data.win_rate.toFixed(2) : 0 " color="gray-dark"></stat-bar-box>
<stat-box title="Rank Tier" :value="data.sl_mmr_data ? data.sl_mmr_data.rank_tier : ''" color="gray-dark"></stat-box>
<stat-box :title="'MMR'" :value="data.sl_mmr_data ? data.sl_mmr_data.mmr.toLocaleString('en-US') : 0 " color="gray-dark"></stat-box>
</div>

<div class="grid grid-cols-4 items-center gap-10 md:px-20 py-5 justify-center" >
<h4 class="text-right">ARAM</h4>
<stat-bar-box :title="'Win Rate'" :value=" data.ar_mmr_data ? data.ar_mmr_data.win_rate.toFixed(2) : 0 "></stat-bar-box>
<stat-box title="Rank Tier" :value="data.ar_mmr_data ? data.ar_mmr_data.rank_tier : ''"></stat-box>
<stat-box :title="'MMR'" :value="data.ar_mmr_data ? data.ar_mmr_data.mmr.toLocaleString('en-US') : 0 "></stat-box>
</div>
<div class="max-w-[1500px] mx-auto text-right my-2 pb-2">
<custom-button :href="'/Player/' + this.battletag + '/' + this.blizzid + '/' + this.region + '/MMR/Hero/' + heroobject.name" class=" " text="View MMR Breakdown"></custom-button>
</div>
</div>
<dynamic-square-ad :patreon-user="patreonUser" :index="1"></dynamic-square-ad>
</div>
<div class="grid grid-cols-4 max-md:grid-cols-2 items-center gap-10 md:px-20 py-5 justify-center" >
<h4 class="text-right">ARAM</h4>
<stat-bar-box :title="'Win Rate'" :value=" data.ar_mmr_data ? data.ar_mmr_data.win_rate.toFixed(2) : 0 "></stat-bar-box>
<stat-box title="Rank Tier" :value="data.ar_mmr_data ? data.ar_mmr_data.rank_tier : ''"></stat-box>
<stat-box :title="'MMR'" :value="data.ar_mmr_data ? data.ar_mmr_data.mmr.toLocaleString('en-US') : 0 "></stat-box>
</div>
<div class="flex justify-center max-w-[1500px] mx-auto items-center">
<div class="p-10 max-w-[90em] ml-auto mr-auto">




</div>

<dynamic-square-ad :patreon-user="patreonUser" :index="1"></dynamic-square-ad>
</div>
</div>
<div class="flex justify-center max-w-[1500px] mx-auto items-center max-md:flex-col">
<div class="p-10 max-w-[90em] ml-auto mr-auto">
<h2 class="text-3xl font-bold py-5">Party Size Win Rates</h2>
<div class="w-[1000px] items-center gap-10 md:px-20 py-5 justify-center" >
<div class="md:w-[1000px] items-center gap-10 md:px-20 py-5 justify-center" >
<div class="flex gap-10 text-s"><span>Solo</span><span>Total Games: {{ (data.stack_size_one_wins + data.stack_size_one_losses).toLocaleString('en-US') }} </span></div>
<stat-bar-box size="big" :value="data.stack_size_one_win_rate.toFixed(2) "></stat-bar-box>
</div>
<div class="w-[1000px] items-center gap-10 md:px-20 py-5 justify-center" >
<div class="md:w-[1000px] items-center gap-10 md:px-20 py-5 justify-center" >
<div class="flex gap-10 text-s"><span>Two Stack</span><span>Total Games: {{ (data.stack_size_two_wins + data.stack_size_two_losses).toLocaleString('en-US') }} </span></div>
<stat-bar-box size="big" :value="data.stack_size_two_win_rate.toFixed(2) " color="teal"></stat-bar-box>
</div>
<div class="w-[1000px] items-center gap-10 md:px-20 py-5 justify-center" >
<div class="md:w-[1000px] items-center gap-10 md:px-20 py-5 justify-center" >
<div class="flex gap-10 text-s"><span>Three Stack</span><span>Total Games: {{ (data.stack_size_three_wins + data.stack_size_three_losses).toLocaleString('en-US') }} </span></div>
<stat-bar-box size="big" :value="data.stack_size_three_win_rate.toFixed(2) " color="red"></stat-bar-box>
</div>
<div class="w-[1000px] items-center gap-10 md:px-20 py-5 justify-center" >
<div class="md:w-[1000px] items-center gap-10 md:px-20 py-5 justify-center" >
<div class="flex gap-10 text-s"><span>Four Stack</span><span>Total Games: {{ (data.stack_size_four_wins + data.stack_size_four_losses).toLocaleString('en-US') }} </span></div>
<stat-bar-box size="big" :value="data.stack_size_four_win_rate.toFixed(2) " color="yellow"></stat-bar-box>
</div>
<div class="w-[1000px] items-center gap-10 md:px-20 py-5 justify-center" >
<div class="md:w-[1000px] items-center gap-10 md:px-20 py-5 justify-center" >
<div class="flex gap-10 text-s"><span>Five Stack</span><span>Total Games: {{ (data.stack_size_five_wins + data.stack_size_five_losses).toLocaleString('en-US') }} </span></div>
<stat-bar-box size="big" :value="data.stack_size_five_win_rate.toFixed(2) "></stat-bar-box>
</div>
Expand All @@ -156,7 +161,7 @@

<div class="max-w-[1500px] mx-auto">
<h2 class="text-3xl font-bold py-5">Advanced Stats</h2>
<table v-for="(section, sectionIndex) in sections" :key="sectionIndex">
<table class="max-md:text-xs max-w-full" v-for="(section, sectionIndex) in sections" :key="sectionIndex">
<thead>
<tr>
<td class="teal">{{ section.title }}</td>
Expand All @@ -167,7 +172,7 @@
</thead>
<tbody>
<tr v-for="(row, rowIndex) in section.rows" :key="rowIndex">
<td width="25%">{{ row.label }}</td>
<td width="25%" style="max-width:25%">{{ row.label }}</td>
<td width="25%">{{ formatValue(row.key, this.data["sum_" + row.key])}}</td>
<td width="25%">{{ formatValue(row.key, this.data["avg_" + row.key]) }}</td>
<td width="25%">{{ formatValue(row.key, this.data["max_" + row.key]) }}</td>
Expand Down Expand Up @@ -214,6 +219,7 @@
isLoading: false,
modifiedgametype: null,
modifiedseason: null,
modifiedgamemap: null,
data: null,
disableFilterInput: null,
sections: [
Expand Down Expand Up @@ -273,7 +279,7 @@
],
},
{
title: 'Defense/Healing',
title: 'Defense/ Healing',
rows: [
{ label: 'Healing', key: 'healing' },
{ label: 'Self Healing', key: 'self_healing' },
Expand Down Expand Up @@ -320,6 +326,12 @@
updatedList.unshift(newValue);
return updatedList;
},
gameMapWithAll() {
const newValue = { code: 'All', name: 'All' };
const updatedList = [...this.filters.game_maps];
updatedList.unshift(newValue);
return updatedList;
},
isOwner(){
if(this.battletag == "Zemill" && this.blizzid == 67280 && this.region == 1){
return true;
Expand All @@ -346,6 +358,7 @@
region: this.region,
game_type: this.modifiedgametype,
season: this.modifiedseason,
game_map: this.modifiedgamemap,
hero: this.hero,
type: "single",
page: "hero",
Expand Down Expand Up @@ -384,6 +397,15 @@
this.modifiedseason = eventPayload.value;
}
}
if(eventPayload.field == "Game Map"){
if(eventPayload.value == "All"){
this.modifiedgamemap = null;
}else{
this.modifiedgamemap = eventPayload.value;
}
}
},
applyFilter(){
if(!this.isLoading){
Expand Down

0 comments on commit 9f4dc5b

Please sign in to comment.