From a028fd5594e157a0ae782603f267e4d2e8b1853f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Sep 2023 23:00:52 +0000 Subject: [PATCH 01/11] Bump google/cloud-logging from 1.28.0 to 1.28.1 Bumps [google/cloud-logging](https://github.com/googleapis/google-cloud-php-logging) from 1.28.0 to 1.28.1. - [Release notes](https://github.com/googleapis/google-cloud-php-logging/releases) - [Commits](https://github.com/googleapis/google-cloud-php-logging/compare/v1.28.0...v1.28.1) --- updated-dependencies: - dependency-name: google/cloud-logging dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/composer.lock b/composer.lock index 9f0ffd62..87d39e58 100644 --- a/composer.lock +++ b/composer.lock @@ -626,16 +626,16 @@ }, { "name": "google/cloud-core", - "version": "v1.52.3", + "version": "v1.52.4", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-core.git", - "reference": "2ae714abfbf979cb52de26227a87e42bfdfb6347" + "reference": "21c004745a32c71e03ab62effd7fbee0cf3ae7c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/2ae714abfbf979cb52de26227a87e42bfdfb6347", - "reference": "2ae714abfbf979cb52de26227a87e42bfdfb6347", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/21c004745a32c71e03ab62effd7fbee0cf3ae7c6", + "reference": "21c004745a32c71e03ab62effd7fbee0cf3ae7c6", "shasum": "" }, "require": { @@ -685,22 +685,22 @@ ], "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", "support": { - "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.52.3" + "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.52.4" }, - "time": "2023-08-25T20:04:15+00:00" + "time": "2023-09-15T20:50:36+00:00" }, { "name": "google/cloud-logging", - "version": "v1.28.0", + "version": "v1.28.1", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-logging.git", - "reference": "2ebaa460e0d41659ad1deccd6f12b164afafc437" + "reference": "818c654fa5cb01db8f8e625d43602683448e26b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-logging/zipball/2ebaa460e0d41659ad1deccd6f12b164afafc437", - "reference": "2ebaa460e0d41659ad1deccd6f12b164afafc437", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-logging/zipball/818c654fa5cb01db8f8e625d43602683448e26b1", + "reference": "818c654fa5cb01db8f8e625d43602683448e26b1", "shasum": "" }, "require": { @@ -752,9 +752,9 @@ ], "description": "Stackdriver Logging Client for PHP", "support": { - "source": "https://github.com/googleapis/google-cloud-php-logging/tree/v1.28.0" + "source": "https://github.com/googleapis/google-cloud-php-logging/tree/v1.28.1" }, - "time": "2023-07-07T20:46:38+00:00" + "time": "2023-09-15T20:50:36+00:00" }, { "name": "google/common-protos", @@ -810,16 +810,16 @@ }, { "name": "google/gax", - "version": "v1.22.1", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/googleapis/gax-php.git", - "reference": "2566bce7081f17e4f4c35a215864c6d4a62f010f" + "reference": "e5de66d5cec6e5d5a3ee6b629c7717e43a817b9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/gax-php/zipball/2566bce7081f17e4f4c35a215864c6d4a62f010f", - "reference": "2566bce7081f17e4f4c35a215864c6d4a62f010f", + "url": "https://api.github.com/repos/googleapis/gax-php/zipball/e5de66d5cec6e5d5a3ee6b629c7717e43a817b9a", + "reference": "e5de66d5cec6e5d5a3ee6b629c7717e43a817b9a", "shasum": "" }, "require": { @@ -859,9 +859,9 @@ ], "support": { "issues": "https://github.com/googleapis/gax-php/issues", - "source": "https://github.com/googleapis/gax-php/tree/v1.22.1" + "source": "https://github.com/googleapis/gax-php/tree/v1.23.0" }, - "time": "2023-08-04T14:32:15+00:00" + "time": "2023-09-14T18:30:51+00:00" }, { "name": "google/grpc-gcp", From 2c8a7a155f2ddb7d9f878461f25e9f419c42f974 Mon Sep 17 00:00:00 2001 From: Zemill <33404722+Zemill@users.noreply.github.com> Date: Sat, 16 Sep 2023 16:14:53 -0400 Subject: [PATCH 02/11] Fixed navigation flashing --- resources/js/app.js | 1 - resources/js/components/MainNav.vue | 128 -------------------------- resources/views/layouts/app.blade.php | 8 +- resources/views/nav.blade.php | 95 +++++++++++++++++++ 4 files changed, 101 insertions(+), 131 deletions(-) delete mode 100644 resources/js/components/MainNav.vue create mode 100644 resources/views/nav.blade.php diff --git a/resources/js/app.js b/resources/js/app.js index 24a1ed19..8b32b19b 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -16,7 +16,6 @@ import SearchPlayer from './components/Compare/SearchPlayer.vue'; //Random Pieces - rename later to what you want and place in folder -import MainNav from './components/MainNav.vue'; import PageHeading from './components/PageHeading.vue'; import Infobox from './components/Infobox.vue'; import TalentBox from './components/TalentBox.vue'; diff --git a/resources/js/components/MainNav.vue b/resources/js/components/MainNav.vue deleted file mode 100644 index 87f10b33..00000000 --- a/resources/js/components/MainNav.vue +++ /dev/null @@ -1,128 +0,0 @@ - - - \ No newline at end of file diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index b7c13e7a..4c5d8a0f 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -18,8 +18,12 @@
- -
+ + @include('nav', [ + 'isAuthenticated' => Auth::check(), + 'mainSearchAccount' => $main_search_account, + 'altSearchAccounts' => [$alt_search_account1, $alt_search_account2, $alt_search_account3], + ]) @yield('content')
diff --git a/resources/views/nav.blade.php b/resources/views/nav.blade.php new file mode 100644 index 00000000..30ab25aa --- /dev/null +++ b/resources/views/nav.blade.php @@ -0,0 +1,95 @@ +
+ + +
From 661285ebe897b57f052ca861927fddf815fbce6a Mon Sep 17 00:00:00 2001 From: Zemill <33404722+Zemill@users.noreply.github.com> Date: Sun, 17 Sep 2023 09:59:49 -0400 Subject: [PATCH 03/11] Hero Matchups page --- .../Player/PlayerMatchupsController.php | 121 ++++++++++++++++ resources/js/app.js | 1 + .../Global/Matchups/GlobalMatchupsStats.vue | 2 +- resources/js/components/Player/FriendFoe.vue | 2 +- .../js/components/Player/PlayerMatchup.vue | 134 ++++++++++++++++++ resources/js/components/SearchComponent.vue | 2 +- resources/views/Player/matchupData.blade.php | 8 ++ resources/views/nav.blade.php | 109 ++++++++++++++ routes/api.php | 5 + routes/web.php | 12 +- 10 files changed, 387 insertions(+), 9 deletions(-) create mode 100644 app/Http/Controllers/Player/PlayerMatchupsController.php create mode 100644 resources/js/components/Player/PlayerMatchup.vue create mode 100644 resources/views/Player/matchupData.blade.php create mode 100644 resources/views/nav.blade.php diff --git a/app/Http/Controllers/Player/PlayerMatchupsController.php b/app/Http/Controllers/Player/PlayerMatchupsController.php new file mode 100644 index 00000000..7b734e05 --- /dev/null +++ b/app/Http/Controllers/Player/PlayerMatchupsController.php @@ -0,0 +1,121 @@ +globalDataService = $globalDataService; + } + + public function show(Request $request, $battletag, $blizz_id, $region) + { + $validator = \Validator::make(compact('battletag', 'blizz_id', 'region'), [ + 'battletag' => 'required|string', + 'blizz_id' => 'required|integer', + 'region' => 'required|integer' + ]); + + if ($validator->fails()) { + return redirect('/'); + } + + + return view('Player.matchupData')->with([ + 'battletag' => $battletag, + 'blizz_id' => $blizz_id, + 'region' => $region, + 'filters' => $this->globalDataService->getFilterData(), + ]); + } + + public function getMatchupData(Request $request){ + //return response()->json($request->all()); + + $validator = \Validator::make($request->only(['blizz_id', 'region']), [ + 'blizz_id' => 'required|integer', + 'region' => 'required|integer', + ]); + + $blizz_id = $request['blizz_id']; + $region = $request['region']; + + $gameType = (new GameTypeInputValidation())->passes('game_type', $request["game_type"]); + $gameMap = (new GameMapInputValidation())->passes('map', $request["map"]); + $hero = (new HeroInputByIDValidation())->passes('statfilter', $request["hero"]); + $season = (new SeasonInputValidation())->passes('season', $request["season"]); + + $returnData = []; + + $heroData = $this->globalDataService->getHeroes(); + + foreach ($heroData as $hero) { + $returnData[$hero->id]['ally_wins'] = 0; + $returnData[$hero->id]['ally_losses'] = 0; + $returnData[$hero->id]['enemy_wins'] = 0; + $returnData[$hero->id]['enemy_losses'] = 0; + } + $heroData = $heroData->keyBy('id'); + + for($i = 0; $i <= 1; $i++){ + $subquery = DB::table('player') + ->join('replay', 'replay.replayID', '=', 'player.replayID') + ->where('blizz_id', $blizz_id) + ->where('region', $region) + ->where('team', $i) + ->where('replay.game_type', '<>', 0) + ->select('player.replayID'); + + $result = DB::table('player') + ->whereIn('replayID', $subquery) + ->where('blizz_id', '<>', $blizz_id) + ->groupBy('hero', 'team', 'winner') + ->select('hero', 'team', 'winner', DB::raw('COUNT(*) AS total')) + ->get(); + + foreach($result as $hero => $value) + { + $returnData[$value->hero]["heroData"] = $heroData[$value->hero]; + $returnData[$value->hero]["name"] = $heroData[$value->hero]["name"]; + if($value->team == $i){ + if($value->winner == 0){ + $returnData[$value->hero]["ally_losses"] += $value->total; + }else{ + $returnData[$value->hero]["ally_wins"] += $value->total; + } + $returnData[$value->hero]["ally_games_played"] = $returnData[$value->hero]["ally_wins"] + $returnData[$value->hero]["ally_losses"]; + $returnData[$value->hero]["ally_win_rate"] = $returnData[$value->hero]["ally_games_played"] ? round(($returnData[$value->hero]["ally_wins"] / $returnData[$value->hero]["ally_games_played"]) * 100, 2): 0; + }else{ + if($value->winner == 0){ + $returnData[$value->hero]["enemy_losses"] += $value->total; + }else{ + $returnData[$value->hero]["enemy_wins"] += $value->total; + } + $returnData[$value->hero]["enemy_games_played"] = $returnData[$value->hero]["enemy_wins"] + $returnData[$value->hero]["enemy_losses"]; + $returnData[$value->hero]["enemy_win_rate"] = $returnData[$value->hero]["enemy_games_played"] ? round(100 - ($returnData[$value->hero]["enemy_wins"] / $returnData[$value->hero]["enemy_games_played"]) * 100, 2): 0; + } + } + } + $returnData = array_values($returnData); + + usort($returnData, function ($a, $b) { + return strcmp($a['name'], $b['name']); + }); + + return $returnData; + } + +} diff --git a/resources/js/app.js b/resources/js/app.js index 24a1ed19..b463faab 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -63,6 +63,7 @@ import PlayerStats from './components/Player/PlayerStats.vue'; import FriendFoe from './components/Player/FriendFoe.vue'; import PlayerHeroesAllStats from './components/Player/Heroes/PlayerHeroesAllStats.vue'; import PlayerHeroSingleStats from './components/Player/Heroes/PlayerHeroSingleStats.vue'; +import PlayerMatchup from './components/Player/PlayerMatchup.vue'; // Automatically register Vue components diff --git a/resources/js/components/Global/Matchups/GlobalMatchupsStats.vue b/resources/js/components/Global/Matchups/GlobalMatchupsStats.vue index ad0df020..71fa2bd6 100644 --- a/resources/js/components/Global/Matchups/GlobalMatchupsStats.vue +++ b/resources/js/components/Global/Matchups/GlobalMatchupsStats.vue @@ -52,7 +52,7 @@ Win Rate as Ally % - Win Rate Against Abathur % + Win Rate Against {{ this.selectedHero.name }} % Games Played As Ally diff --git a/resources/js/components/Player/FriendFoe.vue b/resources/js/components/Player/FriendFoe.vue index 1eb06a87..1e5b7b69 100644 --- a/resources/js/components/Player/FriendFoe.vue +++ b/resources/js/components/Player/FriendFoe.vue @@ -8,7 +8,7 @@ :gametypedefault="gametypedefault" :includehero="true" :includegamemap="true" - :includegametype="true" + :includegametypefull="true" :includeseason="true" > diff --git a/resources/js/components/Player/PlayerMatchup.vue b/resources/js/components/Player/PlayerMatchup.vue new file mode 100644 index 00000000..e7c1e602 --- /dev/null +++ b/resources/js/components/Player/PlayerMatchup.vue @@ -0,0 +1,134 @@ + + + \ No newline at end of file diff --git a/resources/js/components/SearchComponent.vue b/resources/js/components/SearchComponent.vue index 4b2c3fa5..12c63d2c 100644 --- a/resources/js/components/SearchComponent.vue +++ b/resources/js/components/SearchComponent.vue @@ -2,7 +2,7 @@
- +
diff --git a/resources/views/Player/matchupData.blade.php b/resources/views/Player/matchupData.blade.php new file mode 100644 index 00000000..370c48de --- /dev/null +++ b/resources/views/Player/matchupData.blade.php @@ -0,0 +1,8 @@ +@extends('layouts.app') +@section('title', 'Heroes Profile') +@section('meta_keywords', '') +@section('meta_description', '') + +@section('content') + +@endsection diff --git a/resources/views/nav.blade.php b/resources/views/nav.blade.php new file mode 100644 index 00000000..e121e542 --- /dev/null +++ b/resources/views/nav.blade.php @@ -0,0 +1,109 @@ + + + + + + diff --git a/routes/api.php b/routes/api.php index 82b194a0..1a6205e2 100644 --- a/routes/api.php +++ b/routes/api.php @@ -17,6 +17,7 @@ use App\Http\Controllers\Player\PlayerController; use App\Http\Controllers\Player\FriendFoeController; use App\Http\Controllers\Player\PlayerHeroesController; +use App\Http\Controllers\Player\PlayerMatchupsController; @@ -98,4 +99,8 @@ Route::get('player/heroes/single', [PlayerHeroesController::class, 'getHeroData']); //testing Route::post('player/heroes/single', [PlayerHeroesController::class, 'getHeroData']); + Route::get('player/matchups', [PlayerMatchupsController::class, 'getMatchupData']); //testing + Route::post('player/matchups', [PlayerMatchupsController::class, 'getMatchupData']); + + }); \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index b399a863..ffbc8f20 100644 --- a/routes/web.php +++ b/routes/web.php @@ -5,17 +5,12 @@ use App\Http\Controllers\Auth\BattleNetController; use App\Http\Controllers\Auth\PatreonController; use App\Http\Controllers\ProfileController; -use App\Http\Controllers\Player\PlayerController; -use App\Http\Controllers\Player\FriendFoeController; -use App\Http\Controllers\Player\PlayerHeroesController; -use App\Http\Controllers\BattletagSearchController; +use App\Http\Controllers\BattletagSearchController; use App\Http\Controllers\MainPageController; use App\Http\Controllers\GamedataController; use App\Http\Controllers\CompareController; - - use App\Http\Controllers\Global\GlobalHeroStatsController; use App\Http\Controllers\Global\GlobalTalentStatsController; use App\Http\Controllers\Global\GlobalLeaderboardController; @@ -28,6 +23,10 @@ use App\Http\Controllers\Global\GlobalExtraStats; +use App\Http\Controllers\Player\PlayerController; +use App\Http\Controllers\Player\FriendFoeController; +use App\Http\Controllers\Player\PlayerHeroesController; +use App\Http\Controllers\Player\PlayerMatchupsController; /* |-------------------------------------------------------------------------- | Web Routes @@ -105,6 +104,7 @@ Route::get('Player/FriendFoe/{battletag}/{blizz_id}/{region}', [FriendFoeController::class, 'show']); Route::get('Player/Hero/All/{battletag}/{blizz_id}/{region}', [PlayerHeroesController::class, 'showAll']); Route::get('Player/Hero/Single/{battletag}/{blizz_id}/{region}/{hero}', [PlayerHeroesController::class, 'showSingle']); +Route::get('Player/Matchups/{battletag}/{blizz_id}/{region}', [PlayerMatchupsController::class, 'show']); From 055a9ff2ebb9917d164b49e2cf5064958ea8e3cc Mon Sep 17 00:00:00 2001 From: Zemill <33404722+Zemill@users.noreply.github.com> Date: Sun, 17 Sep 2023 10:49:34 -0400 Subject: [PATCH 04/11] Fixed small navigation issue --- resources/js/components/CustomButton.vue | 8 +++++++- resources/views/nav.blade.php | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/resources/js/components/CustomButton.vue b/resources/js/components/CustomButton.vue index 7e1a68cd..0d3ad868 100644 --- a/resources/js/components/CustomButton.vue +++ b/resources/js/components/CustomButton.vue @@ -41,6 +41,7 @@ default: 'blue' }, disabled: Boolean, + targetblank: Boolean, }, data(){ return { @@ -51,6 +52,7 @@ created(){ }, mounted() { + console.log(this.targetblank) }, computed: { colorClass() { @@ -69,7 +71,11 @@ methods: { handleClick() { if(!this.disabled) { - window.location.href = this.href; + if(this.targetblank){ + window.open(this.href, '_blank'); + }else{ + window.location.href = this.href; + } } } } diff --git a/resources/views/nav.blade.php b/resources/views/nav.blade.php index e121e542..7d2e2cc6 100644 --- a/resources/views/nav.blade.php +++ b/resources/views/nav.blade.php @@ -68,9 +68,9 @@ @if($isAuthenticated)
From d214d482e21a5b0506f40eaac05df75e66fc871a Mon Sep 17 00:00:00 2001 From: Zemill <33404722+Zemill@users.noreply.github.com> Date: Sun, 17 Sep 2023 13:18:44 -0400 Subject: [PATCH 05/11] Role pages mostly done --- .../Player/PlayerHeroesController.php | 531 --------------- .../PlayerHeroesMapsRolesController.php | 639 ++++++++++++++++++ .../Player/PlayerMatchupsController.php | 18 +- .../Player/PlayerRolesController.php | 71 ++ resources/js/app.js | 2 + resources/js/components/CustomButton.vue | 1 - .../Player/Heroes/PlayerHeroSingleStats.vue | 7 +- .../Player/Heroes/PlayerHeroesAllStats.vue | 1 + .../js/components/Player/PlayerMatchup.vue | 13 +- .../Player/Roles/PlayerRoleSingleStats.vue | 143 ++++ .../Player/Roles/PlayerRolesAllStats.vue | 294 ++++++++ .../views/Player/Roles/allRoleData.blade.php | 8 + .../Player/Roles/singleRoleData.blade.php | 8 + resources/views/nav.blade.php | 2 + routes/api.php | 18 +- routes/web.php | 8 + 16 files changed, 1220 insertions(+), 544 deletions(-) create mode 100644 app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php create mode 100644 app/Http/Controllers/Player/PlayerRolesController.php create mode 100644 resources/js/components/Player/Roles/PlayerRoleSingleStats.vue create mode 100644 resources/js/components/Player/Roles/PlayerRolesAllStats.vue create mode 100644 resources/views/Player/Roles/allRoleData.blade.php create mode 100644 resources/views/Player/Roles/singleRoleData.blade.php diff --git a/app/Http/Controllers/Player/PlayerHeroesController.php b/app/Http/Controllers/Player/PlayerHeroesController.php index d6582479..2a785544 100644 --- a/app/Http/Controllers/Player/PlayerHeroesController.php +++ b/app/Http/Controllers/Player/PlayerHeroesController.php @@ -78,535 +78,4 @@ public function showSingle(Request $request, $battletag, $blizz_id, $region, $he 'regions' => $this->globalDataService->getRegionIDtoString(), ]); } - - public function getHeroData(Request $request){ - //return response()->json($request->all()); - - $validator = \Validator::make($request->only(['blizz_id', 'region', 'minimumgames', 'type']), [ - 'blizz_id' => 'required|integer', - 'region' => 'required|integer', - 'minimumgames' => 'integer', - 'type' => 'required|in:all,single' - ]); - - $blizz_id = $request['blizz_id']; - $region = $request['region']; - $gameType = (new GameTypeInputValidation())->passes('game_type', $request["game_type"]); - $hero = (new HeroInputByIDValidation())->passes('statfilter', $request["hero"]); - $role = (new RoleInputValidation())->passes('role', $request["role"]); - $minimum_games = $request["minimumgames"]; - $type = $request["type"]; - - - if(count($gameType) == 6){ - $gameType = []; - } - - $result = Replay::join('player', 'player.replayID', '=', 'replay.replayID') - ->join('scores', function($join) { - $join->on('scores.replayID', '=', 'replay.replayID') - ->on('scores.battletag', '=', 'player.battletag'); - }) - ->join('talents', function($join) { - $join->on('talents.replayID', '=', 'replay.replayID') - ->on('talents.battletag', '=', 'player.battletag'); - }) - ->where('region', $region) - ->when(!empty($gameType), function ($query) use ($gameType) { - return $query->whereIn("game_type", $gameType); - }) - ->whereNot("game_type", 0) - ->where('blizz_id', $blizz_id) - ->when($type == "single", function ($query) use ($hero) { - return $query->where("hero", $hero); - }) - ->select([ - 'replay.replayID', - 'hero', - 'hero_level', - 'game_date', - 'game_map', - 'game_type', - 'stack_size', - 'mastery_taunt', - 'player_conservative_rating', - 'player_change', - 'hero_conservative_rating', - 'hero_change', - 'role_conservative_rating', - 'role_change', - 'winner', - 'kills', - 'assists', - 'takedowns', - 'deaths', - 'highest_kill_streak', - 'hero_damage', - 'siege_damage', - 'structure_damage', - 'minion_damage', - 'creep_damage', - 'summon_damage', - 'time_cc_enemy_heroes', - 'healing', - 'self_healing', - 'damage_taken', - 'experience_contribution', - 'town_kills', - 'time_spent_dead', - 'merc_camp_captures', - 'watch_tower_captures', - 'meta_experience', - 'match_award', - 'protection_allies', - 'silencing_enemies', - 'rooting_enemies', - 'stunning_enemies', - 'clutch_heals', - 'escapes', - 'vengeance', - 'outnumbered_deaths', - 'teamfight_escapes', - 'teamfight_healing', - 'teamfight_damage_taken', - 'teamfight_hero_damage', - 'multikill', - 'physical_damage', - 'spell_damage', - 'regen_globes', - 'first_to_ten', - 'time_on_fire', - 'level_one', 'level_four', 'level_seven', 'level_ten', 'level_thirteen', 'level_sixteen', 'level_twenty' - ]) - ->get(); - - - - - - $heroData = $this->globalDataService->getHeroes(); - $heroData = $heroData->keyBy('id'); - - $maps = Map::all(); - $maps = $maps->keyBy('map_id'); - - $talentData = HeroesDataTalent::all(); - $talentData = $talentData->keyBy('talent_id'); - - $gameTypes = $this->globalDataService->getGameTypeIDtoString(); - - $qm_mmr_data = null; - $ud_mmr_data = null; - $hl_mmr_data = null; - $tl_mmr_data = null; - $sl_mmr_data = null; - $ar_mmr_data = null; - - $seasonData = $this->globalDataService->getSeasonsData(); - $newSeasonData = null; - $latestGames = null; - $winRateFiltered = null; - $mapData = null; - - - if($type == "single"){ - $mapData = $result->groupBy('game_map'); - - $qm_mmr_data = MasterMMRDataQM::select("conservative_rating", "win", "loss")->filterByType($hero)->filterByGametype(1)->filterByBlizzID($blizz_id)->filterByRegion($region)->first(); - if($qm_mmr_data){ - $qm_mmr_data->rank_tier = $this->globalDataService->calculateSubTier($this->globalDataService->getRankTiers(1, $hero), $qm_mmr_data->mmr); - } - - $ud_mmr_data = MasterMMRDataUD::select("conservative_rating", "win", "loss")->filterByType($hero)->filterByGametype(2)->filterByBlizzID($blizz_id)->filterByRegion($region)->first(); - if($ud_mmr_data){ - $ud_mmr_data->rank_tier = $this->globalDataService->calculateSubTier($this->globalDataService->getRankTiers(2, $hero), $ud_mmr_data->mmr); - } - - $hl_mmr_data = MasterMMRDataHL::select("conservative_rating", "win", "loss")->filterByType($hero)->filterByGametype(3)->filterByBlizzID($blizz_id)->filterByRegion($region)->first(); - if($hl_mmr_data){ - $hl_mmr_data->rank_tier = $this->globalDataService->calculateSubTier($this->globalDataService->getRankTiers(3, $hero), $hl_mmr_data->mmr); - } - - $tl_mmr_data = MasterMMRDataTL::select("conservative_rating", "win", "loss")->filterByType($hero)->filterByGametype(4)->filterByBlizzID($blizz_id)->filterByRegion($region)->first(); - if($tl_mmr_data){ - $tl_mmr_data->rank_tier = $this->globalDataService->calculateSubTier($this->globalDataService->getRankTiers(4, $hero), $tl_mmr_data->mmr); - } - - $sl_mmr_data = MasterMMRDataSL::select("conservative_rating", "win", "loss")->filterByType($hero)->filterByGametype(5)->filterByBlizzID($blizz_id)->filterByRegion($region)->first(); - if($sl_mmr_data){ - $sl_mmr_data->rank_tier = $this->globalDataService->calculateSubTier($this->globalDataService->getRankTiers(5, $hero), $sl_mmr_data->mmr); - } - $ar_mmr_data = MasterMMRDataAR::select("conservative_rating", "win", "loss")->filterByType($hero)->filterByGametype(6)->filterByBlizzID($blizz_id)->filterByRegion($region)->first(); - if($ar_mmr_data){ - $ar_mmr_data->rank_tier = $this->globalDataService->calculateSubTier($this->globalDataService->getRankTiers(6, $hero), $ar_mmr_data->mmr); - } - - - - - $latestGames = $result->sortByDesc('game_date')->take(5)->values(); - $latestGames = $latestGames->map(function($game) use($heroData, $maps, $talentData, $gameTypes) { - unset( - $game['hero_level'], - $game['stack_size'], - $game['mastery_taunt'], - $game['kills'], - $game['assists'], - $game['takedowns'], - $game['deaths'], - $game['highest_kill_streak'], - $game['hero_damage'], - $game['siege_damage'], - $game['structure_damage'], - $game['minion_damage'], - $game['creep_damage'], - $game['summon_damage'], - $game['time_cc_enemy_heroes'], - $game['healing'], - $game['self_healing'], - $game['damage_taken'], - $game['experience_contribution'], - $game['town_kills'], - $game['time_spent_dead'], - $game['merc_camp_captures'], - $game['watch_tower_captures'], - $game['meta_experience'], - $game['match_award'], - $game['protection_allies'], - $game['silencing_enemies'], - $game['rooting_enemies'], - $game['stunning_enemies'], - $game['clutch_heals'], - $game['escapes'], - $game['vengeance'], - $game['outnumbered_deaths'], - $game['teamfight_escapes'], - $game['teamfight_healing'], - $game['teamfight_damage_taken'], - $game['teamfight_hero_damage'], - $game['multikill'], - $game['physical_damage'], - $game['spell_damage'], - $game['regen_globes'], - $game['first_to_ten'], - $game['time_on_fire'], - ); - - $game->game_type = $gameTypes[$game->game_type]; - $game->hero_object = $heroData[$game->hero]; - $game->game_map = $maps[$game->game_map]; - $game->level_one = $game->level_one ? $talentData[$game->level_one] : null; - $game->level_four = $game->level_four ? $talentData[$game->level_four] : null; - $game->level_seven = $game->level_seven ? $talentData[$game->level_seven] : null; - $game->level_ten = $game->level_ten ? $talentData[$game->level_ten] : null; - $game->level_thirteen = $game->level_thirteen ? $talentData[$game->level_thirteen] : null; - $game->level_sixteen = $game->level_sixteen ? $talentData[$game->level_sixteen] : null; - $game->level_twenty = $game->level_twenty ? $talentData[$game->level_twenty] : null; - - $game->player_conservative_rating = round(1800 + 40 * $game->player_conservative_rating); - $game->hero_conservative_rating = round(1800 + 40 * $game->hero_conservative_rating); - $game->role_conservative_rating = round(1800 + 40 * $game->role_conservative_rating); - - $game->player_change = round($game->player_change, 2); - $game->hero_change = round($game->hero_change, 2); - $game->role_change = round($game->role_change, 2); - - - return $game; - }); - - $newSeasonData = $result->map(function ($item) use ($seasonData) { - $gameDate = $item->game_date; - $season = null; - $id = null; - - foreach ($seasonData as $seasonItem) { - $startDate = $seasonItem->start_date; - $endDate = $seasonItem->end_date; - - if ($gameDate >= $startDate && $gameDate <= $endDate) { - $season = $seasonItem->season; - $id = $seasonItem->id; - break; - } - } - - $seasonData = [ - 'id' => $id, - 'season' => $season, - 'year' => $seasonItem->year, - 'wins' => $item->winner === 1 ? 1 : 0, - 'losses' => $item->winner === 0 ? 1 : 0, - 'games_played' => 1, - ]; - - return $seasonData; - }); - - $newSeasonData = $newSeasonData->groupBy('id')->map(function ($group) { - $wins = $group->sum('wins'); - $losses = $group->sum('losses'); - $gamesPlayed = $group->sum('games_played'); - - $winRate = ($wins / $gamesPlayed) * 100; - - return [ - 'id' => $group->first()['id'], - 'x_label' => $group->first()['year'] . " Season " . $group->first()['season'], - 'season' => $group->first()['season'], - 'year' => $group->first()['year'], - 'wins' => $wins, - 'losses' => $losses, - 'games_played' => $gamesPlayed, - 'win_rate' => round($winRate, 2), - ]; - })->sortBy('id'); - - - - - $mapData = $mapData->map(function($games, $map) use ($maps){ - $gamesPlayed = $games->count(); - $wins = $games->where('winner', 1)->count(); - $losses = $games->where('winner', 0)->count(); - $winRate = ($gamesPlayed > 0) ? ($wins / $gamesPlayed) * 100 : 0; - $latestGameDate = $games->max('game_date'); - - - - return [ - 'name' => $maps[$map]["name"], - 'game_map' => $maps[$map], - 'games_played' => $gamesPlayed, - 'latest_game' => $latestGameDate, - 'wins' => $wins, - 'losses' => $losses, - 'win_rate' => round($winRate, 2), - ]; - - }); - - - $winRateFiltered = $mapData->filter(function ($data) { - return $data['games_played'] > 5; - }); - - if ($winRateFiltered->count() < 3) { - $winRateFiltered = $mapData->filter(function ($data) { - return $data['games_played'] > 2; - }); - } - - if ($winRateFiltered->count() < 3) { - $winRateFiltered = $mapData->filter(function ($data) { - return $data['games_played'] > 0; - }); - } - } - - - - $returnData = $result->groupBy('hero')->map(function($heroStats) use ($heroData, $qm_mmr_data, $ud_mmr_data, $hl_mmr_data, $tl_mmr_data, $sl_mmr_data, $ar_mmr_data, $newSeasonData, $mapData, $winRateFiltered, $latestGames){ - $deaths = $heroStats->sum('deaths'); - $avg_kills = $heroStats->avg('kills'); - $avg_takedowns = $heroStats->avg('takedowns'); - - $wins = $heroStats->where('winner', 1)->count(); - $losses = $heroStats->where('winner', 0)->count(); - $games_played = $wins + $losses; - - $combined_healing = $heroStats->avg('healing') + $heroStats->avg('self_healing'); - - $stack_size_one_wins = $heroStats->whereNotNull('stack_size')->where('stack_size', 0)->where('winner', 1)->count(); - $stack_size_one_losses = $heroStats->whereNotNull('stack_size')->where('stack_size', 0)->where('winner', 0)->count(); - $stack_size_one_total = $stack_size_one_wins + $stack_size_one_losses; - - - $stack_size_two_wins = $heroStats->where('stack_size', 2)->where('winner', 1)->count(); - $stack_size_two_losses = $heroStats->where('stack_size', 2)->where('winner', 0)->count(); - $stack_size_two_total = $stack_size_two_wins + $stack_size_two_losses; - - $stack_size_three_wins = $heroStats->where('stack_size', 3)->where('winner', 1)->count(); - $stack_size_three_losses = $heroStats->where('stack_size', 3)->where('winner', 0)->count(); - $stack_size_three_total = $stack_size_three_wins + $stack_size_three_losses; - - $stack_size_four_wins = $heroStats->where('stack_size', 4)->where('winner', 1)->count(); - $stack_size_four_losses = $heroStats->where('stack_size', 4)->where('winner', 0)->count(); - $stack_size_four_total = $stack_size_four_wins + $stack_size_four_losses; - - $stack_size_five_wins = $heroStats->where('stack_size', 5)->where('winner', 1)->count(); - $stack_size_five_losses = $heroStats->where('stack_size', 5)->where('winner', 0)->count(); - $stack_size_five_total = $stack_size_five_wins + $stack_size_five_losses; - - return [ - "name" => $heroData[$heroStats->pluck('hero')->first()]["name"], - "hero" => $heroData[$heroStats->pluck('hero')->first()], - 'wins' => $wins, - 'losses' => $losses, - 'games_played' => $games_played, - 'kda' => $deaths > 0 ? round($heroStats->sum('takedowns') / $deaths, 2) : $heroStats->sum('takedowns'), - 'kdr' => $deaths > 0 ? round($heroStats->sum('kills') / $deaths, 2) : $heroStats->sum('kills'), - 'win_rate' => $games_played > 0 ? round(($wins / $games_played) * 100, 2) : 0, - 'qm_mmr_data' => $qm_mmr_data, - 'ud_mmr_data' => $ud_mmr_data, - 'hl_mmr_data' => $hl_mmr_data, - 'tl_mmr_data' => $tl_mmr_data, - 'sl_mmr_data' => $sl_mmr_data, - 'ar_mmr_data' => $ar_mmr_data, - - 'stack_size_one_wins' => $stack_size_one_wins, - 'stack_size_one_losses' => $stack_size_one_losses, - 'stack_size_one_total' => $stack_size_one_total, - 'stack_size_one_win_rate' => $stack_size_one_total > 0 ? round(($stack_size_one_wins / $stack_size_one_total) * 100, 2): 0, - - 'stack_size_two_wins' => $stack_size_two_wins, - 'stack_size_two_losses' => $stack_size_two_losses, - 'stack_size_two_total' => $stack_size_two_total, - 'stack_size_two_win_rate' => $stack_size_two_total > 0 ? round(($stack_size_two_wins / $stack_size_two_total) * 100, 2): 0, - - 'stack_size_three_wins' => $stack_size_three_wins, - 'stack_size_three_losses' => $stack_size_three_losses, - 'stack_size_three_total' => $stack_size_three_total, - 'stack_size_three_win_rate' => $stack_size_three_total > 0 ? round(($stack_size_three_wins / $stack_size_three_total) * 100, 2) : 0, - - 'stack_size_four_wins' => $stack_size_four_wins, - 'stack_size_four_losses' => $stack_size_four_losses, - 'stack_size_four_total' => $stack_size_four_total, - 'stack_size_four_win_rate' => $stack_size_four_total > 0 ? round(($stack_size_four_wins / $stack_size_four_total) * 100, 2) : 0, - - 'stack_size_five_wins' => $stack_size_five_wins, - 'stack_size_five_losses' => $stack_size_five_losses, - 'stack_size_five_total' => $stack_size_five_total, - 'stack_size_five_win_rate' => $stack_size_five_total > 0 ? round(($stack_size_five_wins / $stack_size_five_total) * 100, 2) : 0, - - 'max_kills' => $heroStats->max('kills'), - 'max_assists' => $heroStats->max('assists'), - 'max_takedowns' => $heroStats->max('takedowns'), - 'max_deaths' => $heroStats->max('deaths'), - 'max_highest_kill_streak' => $heroStats->max('highest_kill_streak'), - 'max_hero_damage' => $heroStats->max('hero_damage'), - 'max_siege_damage' => $heroStats->max('siege_damage'), - 'max_structure_damage' => $heroStats->max('structure_damage'), - 'max_minion_damage' => $heroStats->max('minion_damage'), - 'max_creep_damage' => $heroStats->max('creep_damage'), - 'max_summon_damage' => $heroStats->max('summon_damage'), - 'max_time_cc_enemy_heroes' => $heroStats->max('time_cc_enemy_heroes'), - 'max_healing' => $heroStats->max('healing'), - 'max_self_healing' => $heroStats->max('self_healing'), - 'max_damage_taken' => $heroStats->max('damage_taken'), - 'max_experience_contribution' => $heroStats->max('experience_contribution'), - 'max_town_kills' => $heroStats->max('town_kills'), - 'max_time_spent_dead' => $heroStats->max('time_spent_dead'), - 'max_merc_camp_captures' => $heroStats->max('merc_camp_captures'), - 'max_watch_tower_captures' => $heroStats->max('watch_tower_captures'), - 'max_protection_allies' => $heroStats->max('protection_allies'), - 'max_silencing_enemies' => $heroStats->max('silencing_enemies'), - 'max_rooting_enemies' => $heroStats->max('rooting_enemies'), - 'max_stunning_enemies' => $heroStats->max('stunning_enemies'), - 'max_clutch_heals' => $heroStats->max('clutch_heals'), - 'max_escapes' => $heroStats->max('escapes'), - 'max_vengeance' => $heroStats->max('vengeance'), - 'max_outnumbered_deaths' => $heroStats->max('outnumbered_deaths'), - 'max_teamfight_escapes' => $heroStats->max('teamfight_escapes'), - 'max_teamfight_healing' => $heroStats->max('teamfight_healing'), - 'max_teamfight_damage_taken' => $heroStats->max('teamfight_damage_taken'), - 'max_teamfight_hero_damage' => $heroStats->max('teamfight_hero_damage'), - 'max_multikill' => $heroStats->max('multikill'), - 'max_physical_damage' => $heroStats->max('physical_damage'), - 'max_spell_damage' => $heroStats->max('spell_damage'), - 'max_regen_globes' => $heroStats->max('regen_globes'), - 'max_first_to_ten' => $heroStats->max('first_to_ten'), - 'max_time_on_fire' => $heroStats->max('time_on_fire'), - - - 'combined_healing' => round($combined_healing, 2), - 'avg_assists' => round($avg_takedowns - $avg_kills, 2), - 'avg_kills' => round($avg_kills, 2), - 'avg_assists' => round($heroStats->avg('assists'), 2), - 'avg_takedowns' => round($avg_takedowns, 2), - 'avg_deaths' => round($heroStats->avg('deaths'), 2), - 'avg_highest_kill_streak' => round($heroStats->avg('highest_kill_streak'), 2), - 'avg_hero_damage' => round($heroStats->avg('hero_damage'), 2), - 'avg_siege_damage' => round($heroStats->avg('siege_damage'), 2), - 'avg_structure_damage' => round($heroStats->avg('structure_damage'), 2), - 'avg_minion_damage' => round($heroStats->avg('minion_damage'), 2), - 'avg_creep_damage' => round($heroStats->avg('creep_damage'), 2), - 'avg_summon_damage' => round($heroStats->avg('summon_damage'), 2), - 'avg_time_cc_enemy_heroes' => round($heroStats->avg('time_cc_enemy_heroes'), 2), - 'avg_healing' => round($heroStats->avg('healing'), 2), - 'avg_self_healing' => round($heroStats->avg('self_healing'), 2), - 'avg_damage_taken' => round($heroStats->avg('damage_taken'), 2), - 'avg_experience_contribution' => round($heroStats->avg('experience_contribution'), 2), - 'avg_town_kills' => round($heroStats->avg('town_kills'), 2), - 'avg_time_spent_dead' => round($heroStats->avg('time_spent_dead'), 2), - 'avg_merc_camp_captures' => round($heroStats->avg('merc_camp_captures'), 2), - 'avg_watch_tower_captures' => round($heroStats->avg('watch_tower_captures'), 2), - 'avg_protection_allies' => round($heroStats->avg('protection_allies'), 2), - 'avg_silencing_enemies' => round($heroStats->avg('silencing_enemies'), 2), - 'avg_rooting_enemies' => round($heroStats->avg('rooting_enemies'), 2), - 'avg_stunning_enemies' => round($heroStats->avg('stunning_enemies'), 2), - 'avg_clutch_heals' => round($heroStats->avg('clutch_heals'), 2), - 'avg_escapes' => round($heroStats->avg('escapes'), 2), - 'avg_vengeance' => round($heroStats->avg('vengeance'), 2), - 'avg_outnumbered_deaths' => round($heroStats->avg('outnumbered_deaths'), 2), - 'avg_teamfight_escapes' => round($heroStats->avg('teamfight_escapes'), 2), - 'avg_teamfight_healing' => round($heroStats->avg('teamfight_healing'), 2), - 'avg_teamfight_damage_taken' => round($heroStats->avg('teamfight_damage_taken'), 2), - 'avg_teamfight_hero_damage' => round($heroStats->avg('teamfight_hero_damage'), 2), - 'avg_multikill' => round($heroStats->avg('multikill'), 2), - 'avg_physical_damage' => round($heroStats->avg('physical_damage'), 2), - 'avg_spell_damage' => round($heroStats->avg('spell_damage'), 2), - 'avg_regen_globes' => round($heroStats->avg('regen_globes'), 2), - 'avg_first_to_ten' => round($heroStats->avg('first_to_ten'), 2), - 'avg_time_on_fire' => round($heroStats->avg('time_on_fire'), 2), - - 'sum_kills' => $heroStats->sum('kills'), - 'sum_assists' => $heroStats->sum('assists'), - 'sum_takedowns' => $heroStats->sum('takedowns'), - 'sum_deaths' => $heroStats->sum('deaths'), - 'sum_highest_kill_streak' => $heroStats->sum('highest_kill_streak'), - 'sum_hero_damage' => $heroStats->sum('hero_damage'), - 'sum_siege_damage' => $heroStats->sum('siege_damage'), - 'sum_structure_damage' => $heroStats->sum('structure_damage'), - 'sum_minion_damage' => $heroStats->sum('minion_damage'), - 'sum_creep_damage' => $heroStats->sum('creep_damage'), - 'sum_summon_damage' => $heroStats->sum('summon_damage'), - 'sum_time_cc_enemy_heroes' => $heroStats->sum('time_cc_enemy_heroes'), - 'sum_healing' => $heroStats->sum('healing'), - 'sum_self_healing' => $heroStats->sum('self_healing'), - 'sum_damage_taken' => $heroStats->sum('damage_taken'), - 'sum_experience_contribution' => $heroStats->sum('experience_contribution'), - 'sum_town_kills' => $heroStats->sum('town_kills'), - 'sum_time_spent_dead' => $heroStats->sum('time_spent_dead'), - 'sum_merc_camp_captures' => $heroStats->sum('merc_camp_captures'), - 'sum_watch_tower_captures' => $heroStats->sum('watch_tower_captures'), - 'sum_protection_allies' => $heroStats->sum('protection_allies'), - 'sum_silencing_enemies' => $heroStats->sum('silencing_enemies'), - 'sum_rooting_enemies' => $heroStats->sum('rooting_enemies'), - 'sum_stunning_enemies' => $heroStats->sum('stunning_enemies'), - 'sum_clutch_heals' => $heroStats->sum('clutch_heals'), - 'sum_escapes' => $heroStats->sum('escapes'), - 'sum_vengeance' => $heroStats->sum('vengeance'), - 'sum_outnumbered_deaths' => $heroStats->sum('outnumbered_deaths'), - 'sum_teamfight_escapes' => $heroStats->sum('teamfight_escapes'), - 'sum_teamfight_healing' => $heroStats->sum('teamfight_healing'), - 'sum_teamfight_damage_taken' => $heroStats->sum('teamfight_damage_taken'), - 'sum_teamfight_hero_damage' => $heroStats->sum('teamfight_hero_damage'), - 'sum_multikill' => $heroStats->sum('multikill'), - 'sum_physical_damage' => $heroStats->sum('physical_damage'), - 'sum_spell_damage' => $heroStats->sum('spell_damage'), - 'sum_regen_globes' => $heroStats->sum('regen_globes'), - 'sum_first_to_ten' => $heroStats->sum('first_to_ten'), - 'sum_time_on_fire' => $heroStats->sum('time_on_fire'), - 'season_win_rate_data' => $newSeasonData, - 'map_data' => $mapData ? $mapData->sortBy('name')->values() : null, - 'map_data_top5_played' => $mapData ? $mapData->sortByDesc('games_played')->take(3)->values() : null, - 'map_data_top5_win_rate' => $winRateFiltered ? $winRateFiltered->sortByDesc('win_rate')->take(3)->values() : null, - 'map_data_top5_latest_played' => $mapData ? $mapData->sortByDesc('game_date')->take(3)->values() : null, - 'latestGames' => $latestGames, - ]; - })->values()->sortBy('name')->values()->all(); - - return $returnData; - } } diff --git a/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php b/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php new file mode 100644 index 00000000..eb0478c9 --- /dev/null +++ b/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php @@ -0,0 +1,639 @@ +globalDataService = $globalDataService; + } + public function getData(Request $request){ + //return response()->json($request->all()); + + $validator = \Validator::make($request->only(['blizz_id', 'region', 'minimumgames', 'type']), [ + 'blizz_id' => 'required|integer', + 'region' => 'required|integer', + 'minimumgames' => 'integer', + 'type' => 'required|in:all,single', + 'page' => 'required|in:hero,map,role', + ]); + + $blizz_id = $request['blizz_id']; + $region = $request['region']; + $gameType = (new GameTypeInputValidation())->passes('game_type', $request["game_type"]); + $hero = (new HeroInputByIDValidation())->passes('statfilter', $request["hero"]); + $minimum_games = $request["minimumgames"]; + $type = $request["type"]; + $page = $request["page"]; + $role = (new RoleInputValidation())->passes('role', $request["role"]); + + if(count($gameType) == 6){ + $gameType = []; + } + + $result = Replay::join('player', 'player.replayID', '=', 'replay.replayID') + ->join('scores', function($join) { + $join->on('scores.replayID', '=', 'replay.replayID') + ->on('scores.battletag', '=', 'player.battletag'); + }) + ->join('talents', function($join) { + $join->on('talents.replayID', '=', 'replay.replayID') + ->on('talents.battletag', '=', 'player.battletag'); + }) + ->join('heroes', 'heroes.id', '=', 'player.hero') + ->where('region', $region) + ->when(!empty($gameType), function ($query) use ($gameType) { + return $query->whereIn("game_type", $gameType); + }) + ->whereNot("game_type", 0) + ->where('blizz_id', $blizz_id) + ->when($type == "single" && $page == "hero", function ($query) use ($hero) { + return $query->where("hero", $hero); + }) + ->when($type == "single" && $page == "role", function ($query) use ($role) { + return $query->where("new_role", $role); + }) + ->select([ + 'replay.replayID', + 'hero', + 'hero_level', + 'game_date', + 'game_map', + 'game_type', + 'stack_size', + 'mastery_taunt', + 'new_role', + 'player_conservative_rating', + 'player_change', + 'hero_conservative_rating', + 'hero_change', + 'role_conservative_rating', + 'role_change', + 'winner', + 'kills', + 'assists', + 'takedowns', + 'deaths', + 'highest_kill_streak', + 'hero_damage', + 'siege_damage', + 'structure_damage', + 'minion_damage', + 'creep_damage', + 'summon_damage', + 'time_cc_enemy_heroes', + 'healing', + 'self_healing', + 'damage_taken', + 'experience_contribution', + 'town_kills', + 'time_spent_dead', + 'merc_camp_captures', + 'watch_tower_captures', + 'meta_experience', + 'match_award', + 'protection_allies', + 'silencing_enemies', + 'rooting_enemies', + 'stunning_enemies', + 'clutch_heals', + 'escapes', + 'vengeance', + 'outnumbered_deaths', + 'teamfight_escapes', + 'teamfight_healing', + 'teamfight_damage_taken', + 'teamfight_hero_damage', + 'multikill', + 'physical_damage', + 'spell_damage', + 'regen_globes', + 'first_to_ten', + 'time_on_fire', + 'level_one', 'level_four', 'level_seven', 'level_ten', 'level_thirteen', 'level_sixteen', 'level_twenty' + ]) + ->get(); + + $heroData = $this->globalDataService->getHeroes(); + $heroData = $heroData->keyBy('id'); + + $maps = Map::all(); + $maps = $maps->keyBy('map_id'); + + $talentData = HeroesDataTalent::all(); + $talentData = $talentData->keyBy('talent_id'); + + $gameTypes = $this->globalDataService->getGameTypeIDtoString(); + + $qm_mmr_data = null; + $ud_mmr_data = null; + $hl_mmr_data = null; + $tl_mmr_data = null; + $sl_mmr_data = null; + $ar_mmr_data = null; + + $seasonData = $this->globalDataService->getSeasonsData(); + $newSeasonData = null; + $latestGames = null; + $winRateFiltered = null; + + + $mapData = null; + $heroDataStats = null; + + if($type == "single"){ + $mapData = $result->groupBy('game_map'); + $heroDataStats = $result->groupBy('hero'); + + + $filterByType = $hero; + if($page == "role"){ + $filterByType = MMRTypeID::select("mmr_type_id")->filterByName($role)->first()->mmr_type_id; + } + + $qm_mmr_data = MasterMMRDataQM::select("conservative_rating", "win", "loss")->filterByType($filterByType)->filterByGametype(1)->filterByBlizzID($blizz_id)->filterByRegion($region)->first(); + if($qm_mmr_data){ + $qm_mmr_data->rank_tier = $this->globalDataService->calculateSubTier($this->globalDataService->getRankTiers(1, $filterByType), $qm_mmr_data->mmr); + } + + $ud_mmr_data = MasterMMRDataUD::select("conservative_rating", "win", "loss")->filterByType($filterByType)->filterByGametype(2)->filterByBlizzID($blizz_id)->filterByRegion($region)->first(); + if($ud_mmr_data){ + $ud_mmr_data->rank_tier = $this->globalDataService->calculateSubTier($this->globalDataService->getRankTiers(2, $filterByType), $ud_mmr_data->mmr); + } + + $hl_mmr_data = MasterMMRDataHL::select("conservative_rating", "win", "loss")->filterByType($filterByType)->filterByGametype(3)->filterByBlizzID($blizz_id)->filterByRegion($region)->first(); + if($hl_mmr_data){ + $hl_mmr_data->rank_tier = $this->globalDataService->calculateSubTier($this->globalDataService->getRankTiers(3, $filterByType), $hl_mmr_data->mmr); + } + + $tl_mmr_data = MasterMMRDataTL::select("conservative_rating", "win", "loss")->filterByType($filterByType)->filterByGametype(4)->filterByBlizzID($blizz_id)->filterByRegion($region)->first(); + if($tl_mmr_data){ + $tl_mmr_data->rank_tier = $this->globalDataService->calculateSubTier($this->globalDataService->getRankTiers(4, $filterByType), $tl_mmr_data->mmr); + } + + $sl_mmr_data = MasterMMRDataSL::select("conservative_rating", "win", "loss")->filterByType($filterByType)->filterByGametype(5)->filterByBlizzID($blizz_id)->filterByRegion($region)->first(); + if($sl_mmr_data){ + $sl_mmr_data->rank_tier = $this->globalDataService->calculateSubTier($this->globalDataService->getRankTiers(5, $filterByType), $sl_mmr_data->mmr); + } + $ar_mmr_data = MasterMMRDataAR::select("conservative_rating", "win", "loss")->filterByType($filterByType)->filterByGametype(6)->filterByBlizzID($blizz_id)->filterByRegion($region)->first(); + if($ar_mmr_data){ + $ar_mmr_data->rank_tier = $this->globalDataService->calculateSubTier($this->globalDataService->getRankTiers(6, $filterByType), $ar_mmr_data->mmr); + } + + + + + $latestGames = $result->sortByDesc('game_date')->take(5)->values(); + $latestGames = $latestGames->map(function($game) use($heroData, $maps, $talentData, $gameTypes) { + unset( + $game['hero_level'], + $game['stack_size'], + $game['mastery_taunt'], + $game['kills'], + $game['assists'], + $game['takedowns'], + $game['deaths'], + $game['highest_kill_streak'], + $game['hero_damage'], + $game['siege_damage'], + $game['structure_damage'], + $game['minion_damage'], + $game['creep_damage'], + $game['summon_damage'], + $game['time_cc_enemy_heroes'], + $game['healing'], + $game['self_healing'], + $game['damage_taken'], + $game['experience_contribution'], + $game['town_kills'], + $game['time_spent_dead'], + $game['merc_camp_captures'], + $game['watch_tower_captures'], + $game['meta_experience'], + $game['match_award'], + $game['protection_allies'], + $game['silencing_enemies'], + $game['rooting_enemies'], + $game['stunning_enemies'], + $game['clutch_heals'], + $game['escapes'], + $game['vengeance'], + $game['outnumbered_deaths'], + $game['teamfight_escapes'], + $game['teamfight_healing'], + $game['teamfight_damage_taken'], + $game['teamfight_hero_damage'], + $game['multikill'], + $game['physical_damage'], + $game['spell_damage'], + $game['regen_globes'], + $game['first_to_ten'], + $game['time_on_fire'], + ); + + $game->game_type = $gameTypes[$game->game_type]; + $game->hero = $heroData[$game->hero]; + $game->game_map = $maps[$game->game_map]; + $game->level_one = $game->level_one ? $talentData[$game->level_one] : null; + $game->level_four = $game->level_four ? $talentData[$game->level_four] : null; + $game->level_seven = $game->level_seven ? $talentData[$game->level_seven] : null; + $game->level_ten = $game->level_ten ? $talentData[$game->level_ten] : null; + $game->level_thirteen = $game->level_thirteen ? $talentData[$game->level_thirteen] : null; + $game->level_sixteen = $game->level_sixteen ? $talentData[$game->level_sixteen] : null; + $game->level_twenty = $game->level_twenty ? $talentData[$game->level_twenty] : null; + + $game->player_conservative_rating = round(1800 + 40 * $game->player_conservative_rating); + $game->hero_conservative_rating = round(1800 + 40 * $game->hero_conservative_rating); + $game->role_conservative_rating = round(1800 + 40 * $game->role_conservative_rating); + + $game->player_change = round($game->player_change, 2); + $game->hero_change = round($game->hero_change, 2); + $game->role_change = round($game->role_change, 2); + + + return $game; + }); + + $newSeasonData = $result->map(function ($item) use ($seasonData) { + $gameDate = $item->game_date; + $season = null; + $id = null; + + foreach ($seasonData as $seasonItem) { + $startDate = $seasonItem->start_date; + $endDate = $seasonItem->end_date; + + if ($gameDate >= $startDate && $gameDate <= $endDate) { + $season = $seasonItem->season; + $id = $seasonItem->id; + break; + } + } + + $seasonData = [ + 'id' => $id, + 'season' => $season, + 'year' => $seasonItem->year, + 'wins' => $item->winner === 1 ? 1 : 0, + 'losses' => $item->winner === 0 ? 1 : 0, + 'games_played' => 1, + ]; + + return $seasonData; + }); + + $newSeasonData = $newSeasonData->groupBy('id')->map(function ($group) { + $wins = $group->sum('wins'); + $losses = $group->sum('losses'); + $gamesPlayed = $group->sum('games_played'); + + $winRate = ($wins / $gamesPlayed) * 100; + + return [ + 'id' => $group->first()['id'], + 'x_label' => $group->first()['year'] . " Season " . $group->first()['season'], + 'season' => $group->first()['season'], + 'year' => $group->first()['year'], + 'wins' => $wins, + 'losses' => $losses, + 'games_played' => $gamesPlayed, + 'win_rate' => round($winRate, 2), + ]; + })->sortBy('id'); + + + + + $mapData = $mapData->map(function($games, $map) use ($maps){ + $gamesPlayed = $games->count(); + $wins = $games->where('winner', 1)->count(); + $losses = $games->where('winner', 0)->count(); + $winRate = ($gamesPlayed > 0) ? ($wins / $gamesPlayed) * 100 : 0; + $latestGameDate = $games->max('game_date'); + + + + return [ + 'name' => $maps[$map]["name"], + 'game_map' => $maps[$map], + 'games_played' => $gamesPlayed, + 'latest_game' => $latestGameDate, + 'wins' => $wins, + 'losses' => $losses, + 'win_rate' => round($winRate, 2), + ]; + + }); + + $mapWinRateFiltered = $mapData->filter(function ($data) { + return $data['games_played'] > 5; + }); + + if ($mapWinRateFiltered->count() < 3) { + $mapWinRateFiltered = $mapData->filter(function ($data) { + return $data['games_played'] > 2; + }); + } + + if ($mapWinRateFiltered->count() < 3) { + $mapWinRateFiltered = $mapData->filter(function ($data) { + return $data['games_played'] > 0; + }); + } + + $heroDataStats = $heroDataStats->map(function($games, $hero) use ($heroData){ + $gamesPlayed = $games->count(); + $wins = $games->where('winner', 1)->count(); + $losses = $games->where('winner', 0)->count(); + $winRate = ($gamesPlayed > 0) ? ($wins / $gamesPlayed) * 100 : 0; + $latestGameDate = $games->max('game_date'); + + + + return [ + 'name' => $heroData[$hero]["name"], + 'hero' => $heroData[$hero], + 'games_played' => $gamesPlayed, + 'latest_game' => $latestGameDate, + 'wins' => $wins, + 'losses' => $losses, + 'win_rate' => round($winRate, 2), + ]; + + }); + + + + $heroWinRateFiltered = $heroDataStats->filter(function ($data) { + return $data['games_played'] > 5; + }); + + if ($heroWinRateFiltered->count() < 3) { + $heroWinRateFiltered = $heroDataStats->filter(function ($data) { + return $data['games_played'] > 2; + }); + } + + if ($heroWinRateFiltered->count() < 3) { + $heroWinRateFiltered = $heroDataStats->filter(function ($data) { + return $data['games_played'] > 0; + }); + } + + } + + + $groupBy = ""; + if($page == "hero"){ + $groupBy = 'hero'; + }else if($page == "map"){ + + }else if($page == "role"){ + $groupBy = 'new_role'; + } + + $returnData = $result->groupBy($groupBy)->map(function($heroStats) use ($heroData, $qm_mmr_data, $ud_mmr_data, $hl_mmr_data, $tl_mmr_data, $sl_mmr_data, $ar_mmr_data, $newSeasonData, $mapData, $mapWinRateFiltered, $latestGames, $page, $heroWinRateFiltered, $heroDataStats){ + $deaths = $heroStats->sum('deaths'); + $avg_kills = $heroStats->avg('kills'); + $avg_takedowns = $heroStats->avg('takedowns'); + + $wins = $heroStats->where('winner', 1)->count(); + $losses = $heroStats->where('winner', 0)->count(); + $games_played = $wins + $losses; + + $combined_healing = $heroStats->avg('healing') + $heroStats->avg('self_healing'); + + $stack_size_one_wins = $heroStats->whereNotNull('stack_size')->where('stack_size', 0)->where('winner', 1)->count(); + $stack_size_one_losses = $heroStats->whereNotNull('stack_size')->where('stack_size', 0)->where('winner', 0)->count(); + $stack_size_one_total = $stack_size_one_wins + $stack_size_one_losses; + + + $stack_size_two_wins = $heroStats->where('stack_size', 2)->where('winner', 1)->count(); + $stack_size_two_losses = $heroStats->where('stack_size', 2)->where('winner', 0)->count(); + $stack_size_two_total = $stack_size_two_wins + $stack_size_two_losses; + + $stack_size_three_wins = $heroStats->where('stack_size', 3)->where('winner', 1)->count(); + $stack_size_three_losses = $heroStats->where('stack_size', 3)->where('winner', 0)->count(); + $stack_size_three_total = $stack_size_three_wins + $stack_size_three_losses; + + $stack_size_four_wins = $heroStats->where('stack_size', 4)->where('winner', 1)->count(); + $stack_size_four_losses = $heroStats->where('stack_size', 4)->where('winner', 0)->count(); + $stack_size_four_total = $stack_size_four_wins + $stack_size_four_losses; + + $stack_size_five_wins = $heroStats->where('stack_size', 5)->where('winner', 1)->count(); + $stack_size_five_losses = $heroStats->where('stack_size', 5)->where('winner', 0)->count(); + $stack_size_five_total = $stack_size_five_wins + $stack_size_five_losses; + + + if($page == "hero"){ + $name = $heroData[$heroStats->pluck('hero')->first()]["name"]; + }else if($page == "map"){ + + }else if($page == "role"){ + $name = $heroStats->pluck('new_role')->first(); + } + return [ + "name" => $name, + "hero" => $heroData[$heroStats->pluck('hero')->first()], + 'wins' => $wins, + 'losses' => $losses, + 'games_played' => $games_played, + 'kda' => $deaths > 0 ? round($heroStats->sum('takedowns') / $deaths, 2) : $heroStats->sum('takedowns'), + 'kdr' => $deaths > 0 ? round($heroStats->sum('kills') / $deaths, 2) : $heroStats->sum('kills'), + 'win_rate' => $games_played > 0 ? round(($wins / $games_played) * 100, 2) : 0, + 'qm_mmr_data' => $qm_mmr_data, + 'ud_mmr_data' => $ud_mmr_data, + 'hl_mmr_data' => $hl_mmr_data, + 'tl_mmr_data' => $tl_mmr_data, + 'sl_mmr_data' => $sl_mmr_data, + 'ar_mmr_data' => $ar_mmr_data, + + 'stack_size_one_wins' => $stack_size_one_wins, + 'stack_size_one_losses' => $stack_size_one_losses, + 'stack_size_one_total' => $stack_size_one_total, + 'stack_size_one_win_rate' => $stack_size_one_total > 0 ? round(($stack_size_one_wins / $stack_size_one_total) * 100, 2): 0, + + 'stack_size_two_wins' => $stack_size_two_wins, + 'stack_size_two_losses' => $stack_size_two_losses, + 'stack_size_two_total' => $stack_size_two_total, + 'stack_size_two_win_rate' => $stack_size_two_total > 0 ? round(($stack_size_two_wins / $stack_size_two_total) * 100, 2): 0, + + 'stack_size_three_wins' => $stack_size_three_wins, + 'stack_size_three_losses' => $stack_size_three_losses, + 'stack_size_three_total' => $stack_size_three_total, + 'stack_size_three_win_rate' => $stack_size_three_total > 0 ? round(($stack_size_three_wins / $stack_size_three_total) * 100, 2) : 0, + + 'stack_size_four_wins' => $stack_size_four_wins, + 'stack_size_four_losses' => $stack_size_four_losses, + 'stack_size_four_total' => $stack_size_four_total, + 'stack_size_four_win_rate' => $stack_size_four_total > 0 ? round(($stack_size_four_wins / $stack_size_four_total) * 100, 2) : 0, + + 'stack_size_five_wins' => $stack_size_five_wins, + 'stack_size_five_losses' => $stack_size_five_losses, + 'stack_size_five_total' => $stack_size_five_total, + 'stack_size_five_win_rate' => $stack_size_five_total > 0 ? round(($stack_size_five_wins / $stack_size_five_total) * 100, 2) : 0, + + 'max_kills' => $heroStats->max('kills'), + 'max_assists' => $heroStats->max('assists'), + 'max_takedowns' => $heroStats->max('takedowns'), + 'max_deaths' => $heroStats->max('deaths'), + 'max_highest_kill_streak' => $heroStats->max('highest_kill_streak'), + 'max_hero_damage' => $heroStats->max('hero_damage'), + 'max_siege_damage' => $heroStats->max('siege_damage'), + 'max_structure_damage' => $heroStats->max('structure_damage'), + 'max_minion_damage' => $heroStats->max('minion_damage'), + 'max_creep_damage' => $heroStats->max('creep_damage'), + 'max_summon_damage' => $heroStats->max('summon_damage'), + 'max_time_cc_enemy_heroes' => $heroStats->max('time_cc_enemy_heroes'), + 'max_healing' => $heroStats->max('healing'), + 'max_self_healing' => $heroStats->max('self_healing'), + 'max_damage_taken' => $heroStats->max('damage_taken'), + 'max_experience_contribution' => $heroStats->max('experience_contribution'), + 'max_town_kills' => $heroStats->max('town_kills'), + 'max_time_spent_dead' => $heroStats->max('time_spent_dead'), + 'max_merc_camp_captures' => $heroStats->max('merc_camp_captures'), + 'max_watch_tower_captures' => $heroStats->max('watch_tower_captures'), + 'max_protection_allies' => $heroStats->max('protection_allies'), + 'max_silencing_enemies' => $heroStats->max('silencing_enemies'), + 'max_rooting_enemies' => $heroStats->max('rooting_enemies'), + 'max_stunning_enemies' => $heroStats->max('stunning_enemies'), + 'max_clutch_heals' => $heroStats->max('clutch_heals'), + 'max_escapes' => $heroStats->max('escapes'), + 'max_vengeance' => $heroStats->max('vengeance'), + 'max_outnumbered_deaths' => $heroStats->max('outnumbered_deaths'), + 'max_teamfight_escapes' => $heroStats->max('teamfight_escapes'), + 'max_teamfight_healing' => $heroStats->max('teamfight_healing'), + 'max_teamfight_damage_taken' => $heroStats->max('teamfight_damage_taken'), + 'max_teamfight_hero_damage' => $heroStats->max('teamfight_hero_damage'), + 'max_multikill' => $heroStats->max('multikill'), + 'max_physical_damage' => $heroStats->max('physical_damage'), + 'max_spell_damage' => $heroStats->max('spell_damage'), + 'max_regen_globes' => $heroStats->max('regen_globes'), + 'max_first_to_ten' => $heroStats->max('first_to_ten'), + 'max_time_on_fire' => $heroStats->max('time_on_fire'), + + + 'combined_healing' => round($combined_healing, 2), + 'avg_assists' => round($avg_takedowns - $avg_kills, 2), + 'avg_kills' => round($avg_kills, 2), + 'avg_assists' => round($heroStats->avg('assists'), 2), + 'avg_takedowns' => round($avg_takedowns, 2), + 'avg_deaths' => round($heroStats->avg('deaths'), 2), + 'avg_highest_kill_streak' => round($heroStats->avg('highest_kill_streak'), 2), + 'avg_hero_damage' => round($heroStats->avg('hero_damage'), 2), + 'avg_siege_damage' => round($heroStats->avg('siege_damage'), 2), + 'avg_structure_damage' => round($heroStats->avg('structure_damage'), 2), + 'avg_minion_damage' => round($heroStats->avg('minion_damage'), 2), + 'avg_creep_damage' => round($heroStats->avg('creep_damage'), 2), + 'avg_summon_damage' => round($heroStats->avg('summon_damage'), 2), + 'avg_time_cc_enemy_heroes' => round($heroStats->avg('time_cc_enemy_heroes'), 2), + 'avg_healing' => round($heroStats->avg('healing'), 2), + 'avg_self_healing' => round($heroStats->avg('self_healing'), 2), + 'avg_damage_taken' => round($heroStats->avg('damage_taken'), 2), + 'avg_experience_contribution' => round($heroStats->avg('experience_contribution'), 2), + 'avg_town_kills' => round($heroStats->avg('town_kills'), 2), + 'avg_time_spent_dead' => round($heroStats->avg('time_spent_dead'), 2), + 'avg_merc_camp_captures' => round($heroStats->avg('merc_camp_captures'), 2), + 'avg_watch_tower_captures' => round($heroStats->avg('watch_tower_captures'), 2), + 'avg_protection_allies' => round($heroStats->avg('protection_allies'), 2), + 'avg_silencing_enemies' => round($heroStats->avg('silencing_enemies'), 2), + 'avg_rooting_enemies' => round($heroStats->avg('rooting_enemies'), 2), + 'avg_stunning_enemies' => round($heroStats->avg('stunning_enemies'), 2), + 'avg_clutch_heals' => round($heroStats->avg('clutch_heals'), 2), + 'avg_escapes' => round($heroStats->avg('escapes'), 2), + 'avg_vengeance' => round($heroStats->avg('vengeance'), 2), + 'avg_outnumbered_deaths' => round($heroStats->avg('outnumbered_deaths'), 2), + 'avg_teamfight_escapes' => round($heroStats->avg('teamfight_escapes'), 2), + 'avg_teamfight_healing' => round($heroStats->avg('teamfight_healing'), 2), + 'avg_teamfight_damage_taken' => round($heroStats->avg('teamfight_damage_taken'), 2), + 'avg_teamfight_hero_damage' => round($heroStats->avg('teamfight_hero_damage'), 2), + 'avg_multikill' => round($heroStats->avg('multikill'), 2), + 'avg_physical_damage' => round($heroStats->avg('physical_damage'), 2), + 'avg_spell_damage' => round($heroStats->avg('spell_damage'), 2), + 'avg_regen_globes' => round($heroStats->avg('regen_globes'), 2), + 'avg_first_to_ten' => round($heroStats->avg('first_to_ten'), 2), + 'avg_time_on_fire' => round($heroStats->avg('time_on_fire'), 2), + + 'sum_kills' => $heroStats->sum('kills'), + 'sum_assists' => $heroStats->sum('assists'), + 'sum_takedowns' => $heroStats->sum('takedowns'), + 'sum_deaths' => $heroStats->sum('deaths'), + 'sum_highest_kill_streak' => $heroStats->sum('highest_kill_streak'), + 'sum_hero_damage' => $heroStats->sum('hero_damage'), + 'sum_siege_damage' => $heroStats->sum('siege_damage'), + 'sum_structure_damage' => $heroStats->sum('structure_damage'), + 'sum_minion_damage' => $heroStats->sum('minion_damage'), + 'sum_creep_damage' => $heroStats->sum('creep_damage'), + 'sum_summon_damage' => $heroStats->sum('summon_damage'), + 'sum_time_cc_enemy_heroes' => $heroStats->sum('time_cc_enemy_heroes'), + 'sum_healing' => $heroStats->sum('healing'), + 'sum_self_healing' => $heroStats->sum('self_healing'), + 'sum_damage_taken' => $heroStats->sum('damage_taken'), + 'sum_experience_contribution' => $heroStats->sum('experience_contribution'), + 'sum_town_kills' => $heroStats->sum('town_kills'), + 'sum_time_spent_dead' => $heroStats->sum('time_spent_dead'), + 'sum_merc_camp_captures' => $heroStats->sum('merc_camp_captures'), + 'sum_watch_tower_captures' => $heroStats->sum('watch_tower_captures'), + 'sum_protection_allies' => $heroStats->sum('protection_allies'), + 'sum_silencing_enemies' => $heroStats->sum('silencing_enemies'), + 'sum_rooting_enemies' => $heroStats->sum('rooting_enemies'), + 'sum_stunning_enemies' => $heroStats->sum('stunning_enemies'), + 'sum_clutch_heals' => $heroStats->sum('clutch_heals'), + 'sum_escapes' => $heroStats->sum('escapes'), + 'sum_vengeance' => $heroStats->sum('vengeance'), + 'sum_outnumbered_deaths' => $heroStats->sum('outnumbered_deaths'), + 'sum_teamfight_escapes' => $heroStats->sum('teamfight_escapes'), + 'sum_teamfight_healing' => $heroStats->sum('teamfight_healing'), + 'sum_teamfight_damage_taken' => $heroStats->sum('teamfight_damage_taken'), + 'sum_teamfight_hero_damage' => $heroStats->sum('teamfight_hero_damage'), + 'sum_multikill' => $heroStats->sum('multikill'), + 'sum_physical_damage' => $heroStats->sum('physical_damage'), + 'sum_spell_damage' => $heroStats->sum('spell_damage'), + 'sum_regen_globes' => $heroStats->sum('regen_globes'), + 'sum_first_to_ten' => $heroStats->sum('first_to_ten'), + 'sum_time_on_fire' => $heroStats->sum('time_on_fire'), + 'season_win_rate_data' => $newSeasonData, + 'map_data' => $mapData ? $mapData->sortBy('name')->values() : null, + 'map_data_top_played' => $mapData ? $mapData->sortByDesc('games_played')->values() : null, + 'map_data_top_win_rate' => $mapWinRateFiltered ? $mapWinRateFiltered->sortByDesc('win_rate')->values() : null, + 'map_data_top_latest_played' => $mapData ? $mapData->sortByDesc('game_date')->values() : null, + + 'hero_data_top_played' => $heroDataStats ? $heroDataStats->sortByDesc('games_played')->values() : null, + 'hero_data_top_win_rate' => $heroWinRateFiltered ? $heroWinRateFiltered->sortByDesc('win_rate')->values() : null, + 'hero_data_all_heroes' => $heroDataStats ? $heroDataStats->sortBy('name')->values() : null, + + + 'latestGames' => $latestGames, + ]; + })->values()->sortBy('name')->values()->all(); + + return $returnData; + } + +} + diff --git a/app/Http/Controllers/Player/PlayerMatchupsController.php b/app/Http/Controllers/Player/PlayerMatchupsController.php index 7b734e05..049bf795 100644 --- a/app/Http/Controllers/Player/PlayerMatchupsController.php +++ b/app/Http/Controllers/Player/PlayerMatchupsController.php @@ -88,7 +88,7 @@ public function getMatchupData(Request $request){ foreach($result as $hero => $value) { - $returnData[$value->hero]["heroData"] = $heroData[$value->hero]; + $returnData[$value->hero]["hero"] = $heroData[$value->hero]; $returnData[$value->hero]["name"] = $heroData[$value->hero]["name"]; if($value->team == $i){ if($value->winner == 0){ @@ -109,13 +109,27 @@ public function getMatchupData(Request $request){ } } } + $topFiveAllyHeroes = collect($returnData) + ->filter(function($value, $key) { + return $value['ally_games_played'] >= 5; + }) + ->sortByDesc('ally_win_rate') + ->take(5)->values(); + + $topFiveEnemyHeroes = collect($returnData) + ->filter(function($value, $key) { + return $value['enemy_games_played'] >= 5; + }) + ->sortBy('enemy_win_rate') + ->take(5)->values(); + $returnData = array_values($returnData); usort($returnData, function ($a, $b) { return strcmp($a['name'], $b['name']); }); - return $returnData; + return ["tabledata" => $returnData, "top_five_heroes" => $topFiveAllyHeroes , "top_five_enemies" => $topFiveEnemyHeroes]; } } diff --git a/app/Http/Controllers/Player/PlayerRolesController.php b/app/Http/Controllers/Player/PlayerRolesController.php new file mode 100644 index 00000000..906ddd5b --- /dev/null +++ b/app/Http/Controllers/Player/PlayerRolesController.php @@ -0,0 +1,71 @@ +globalDataService = $globalDataService; + } + + public function showAll(Request $request, $battletag, $blizz_id, $region) + { + $validator = \Validator::make(compact('battletag', 'blizz_id', 'region'), [ + 'battletag' => 'required|string', + 'blizz_id' => 'required|integer', + 'region' => 'required|integer' + ]); + + if ($validator->fails()) { + return redirect('/'); + } + + + return view('Player.Roles.allRoleData')->with([ + 'battletag' => $battletag, + 'blizz_id' => $blizz_id, + 'region' => $region, + 'filters' => $this->globalDataService->getFilterData(), + ]); + } + + public function showSingle(Request $request, $battletag, $blizz_id, $region, $role){ + $validator = \Validator::make(compact('battletag', 'blizz_id', 'region'), [ + 'battletag' => 'required|string', + 'blizz_id' => 'required|integer', + 'region' => 'required|integer' + ]); + + if ($validator->fails()) { + return redirect('/'); + } + $role = (new RoleInputValidation())->passes('role', $request["role"]); + + + return view('Player.Roles.singleRoleData')->with([ + 'battletag' => $battletag, + 'blizz_id' => $blizz_id, + 'region' => $region, + 'role' => $role, + 'filters' => $this->globalDataService->getFilterData(), + 'regions' => $this->globalDataService->getRegionIDtoString(), + ]); + } +} diff --git a/resources/js/app.js b/resources/js/app.js index db78e080..c097b1d9 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -63,6 +63,8 @@ import FriendFoe from './components/Player/FriendFoe.vue'; import PlayerHeroesAllStats from './components/Player/Heroes/PlayerHeroesAllStats.vue'; import PlayerHeroSingleStats from './components/Player/Heroes/PlayerHeroSingleStats.vue'; import PlayerMatchup from './components/Player/PlayerMatchup.vue'; +import PlayerRolesAllStats from './components/Player/Roles/PlayerRolesAllStats.vue'; +import PlayerRoleSingleStats from './components/Player/Roles/PlayerRoleSingleStats.vue'; // Automatically register Vue components diff --git a/resources/js/components/CustomButton.vue b/resources/js/components/CustomButton.vue index 0d3ad868..57a1a01b 100644 --- a/resources/js/components/CustomButton.vue +++ b/resources/js/components/CustomButton.vue @@ -52,7 +52,6 @@ created(){ }, mounted() { - console.log(this.targetblank) }, computed: { colorClass() { diff --git a/resources/js/components/Player/Heroes/PlayerHeroSingleStats.vue b/resources/js/components/Player/Heroes/PlayerHeroSingleStats.vue index 6116bb20..1f62a4b2 100644 --- a/resources/js/components/Player/Heroes/PlayerHeroSingleStats.vue +++ b/resources/js/components/Player/Heroes/PlayerHeroSingleStats.vue @@ -53,9 +53,9 @@
- - - + + +
@@ -137,6 +137,7 @@ export default { game_type: this.gametype, hero: this.hero, type: "single", + page: "hero", }); this.data = response.data[0]; diff --git a/resources/js/components/Player/Heroes/PlayerHeroesAllStats.vue b/resources/js/components/Player/Heroes/PlayerHeroesAllStats.vue index c95fc207..38cb52be 100644 --- a/resources/js/components/Player/Heroes/PlayerHeroesAllStats.vue +++ b/resources/js/components/Player/Heroes/PlayerHeroesAllStats.vue @@ -231,6 +231,7 @@ export default { role: this.role, minimumgames: this.minimumgames, type: "all", + page: "hero", }); this.data = response.data; diff --git a/resources/js/components/Player/PlayerMatchup.vue b/resources/js/components/Player/PlayerMatchup.vue index e7c1e602..27a27f2c 100644 --- a/resources/js/components/Player/PlayerMatchup.vue +++ b/resources/js/components/Player/PlayerMatchup.vue @@ -12,7 +12,8 @@ :includeseason="true" > - + + @@ -37,7 +38,7 @@
- {{ row.heroData.name }} + {{ row.hero.name }} {{ row.ally_win_rate }} @@ -77,6 +78,8 @@ data: [], sortKey: '', sortDir: 'asc', + topfiveheroes: [], + topfiveenemies: [], } }, created(){ @@ -112,7 +115,11 @@ season: this.season, hero: this.hero, }); - this.data = response.data; + this.data = response.data.tabledata; + this.topfiveheroes = response.data.top_five_heroes; + this.topfiveenemies = response.data.top_five_enemies; + + console.log(response.data); }catch(error){ console.log(error); } diff --git a/resources/js/components/Player/Roles/PlayerRoleSingleStats.vue b/resources/js/components/Player/Roles/PlayerRoleSingleStats.vue new file mode 100644 index 00000000..59bd5c0b --- /dev/null +++ b/resources/js/components/Player/Roles/PlayerRoleSingleStats.vue @@ -0,0 +1,143 @@ + + + \ No newline at end of file diff --git a/resources/js/components/Player/Roles/PlayerRolesAllStats.vue b/resources/js/components/Player/Roles/PlayerRolesAllStats.vue new file mode 100644 index 00000000..5cc085b7 --- /dev/null +++ b/resources/js/components/Player/Roles/PlayerRolesAllStats.vue @@ -0,0 +1,294 @@ + + + + + \ No newline at end of file diff --git a/resources/views/Player/Roles/allRoleData.blade.php b/resources/views/Player/Roles/allRoleData.blade.php new file mode 100644 index 00000000..9023ae6e --- /dev/null +++ b/resources/views/Player/Roles/allRoleData.blade.php @@ -0,0 +1,8 @@ +@extends('layouts.app') +@section('title', 'Heroes Profile') +@section('meta_keywords', '') +@section('meta_description', '') + +@section('content') + +@endsection diff --git a/resources/views/Player/Roles/singleRoleData.blade.php b/resources/views/Player/Roles/singleRoleData.blade.php new file mode 100644 index 00000000..8cf90f18 --- /dev/null +++ b/resources/views/Player/Roles/singleRoleData.blade.php @@ -0,0 +1,8 @@ +@extends('layouts.app') +@section('title', 'Heroes Profile') +@section('meta_keywords', '') +@section('meta_description', '') + +@section('content') + +@endsection diff --git a/resources/views/nav.blade.php b/resources/views/nav.blade.php index 7d2e2cc6..fc266209 100644 --- a/resources/views/nav.blade.php +++ b/resources/views/nav.blade.php @@ -52,6 +52,7 @@ Friends and Foes Heroes Matchups + Roles @endif @@ -101,6 +102,7 @@ class="card-img-top relative hover:opacity-75 w-12 h-12 rounded-full" Friends and Foes Heroes Matchups + Roles @endif diff --git a/routes/api.php b/routes/api.php index 1a6205e2..877dc439 100644 --- a/routes/api.php +++ b/routes/api.php @@ -18,6 +18,7 @@ use App\Http\Controllers\Player\FriendFoeController; use App\Http\Controllers\Player\PlayerHeroesController; use App\Http\Controllers\Player\PlayerMatchupsController; +use App\Http\Controllers\Player\PlayerHeroesMapsRolesController; @@ -93,14 +94,23 @@ Route::get('player/friendfoe', [FriendFoeController::class, 'getFriendFoeData']); //testing Route::post('player/friendfoe', [FriendFoeController::class, 'getFriendFoeData']); - Route::get('player/heroes/all', [PlayerHeroesController::class, 'getHeroData']); //testing - Route::post('player/heroes/all', [PlayerHeroesController::class, 'getHeroData']); - Route::get('player/heroes/single', [PlayerHeroesController::class, 'getHeroData']); //testing - Route::post('player/heroes/single', [PlayerHeroesController::class, 'getHeroData']); Route::get('player/matchups', [PlayerMatchupsController::class, 'getMatchupData']); //testing Route::post('player/matchups', [PlayerMatchupsController::class, 'getMatchupData']); + + Route::get('player/heroes/all', [PlayerHeroesMapsRolesController::class, 'getData']); //testing + Route::post('player/heroes/all', [PlayerHeroesMapsRolesController::class, 'getData']); + + Route::get('player/heroes/single', [PlayerHeroesMapsRolesController::class, 'getData']); //testing + Route::post('player/heroes/single', [PlayerHeroesMapsRolesController::class, 'getData']); + + Route::get('player/roles/all/', [PlayerHeroesMapsRolesController::class, 'getData']); //testing + Route::post('player/roles/all/', [PlayerHeroesMapsRolesController::class, 'getData']); + + + + }); \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index ffbc8f20..5cbcbe92 100644 --- a/routes/web.php +++ b/routes/web.php @@ -27,6 +27,10 @@ use App\Http\Controllers\Player\FriendFoeController; use App\Http\Controllers\Player\PlayerHeroesController; use App\Http\Controllers\Player\PlayerMatchupsController; +use App\Http\Controllers\Player\PlayerRolesController; + + + /* |-------------------------------------------------------------------------- | Web Routes @@ -107,6 +111,10 @@ Route::get('Player/Matchups/{battletag}/{blizz_id}/{region}', [PlayerMatchupsController::class, 'show']); +Route::get('Player/Roles/Single/{battletag}/{blizz_id}/{region}/{role}', [PlayerRolesController::class, 'showSingle']); +Route::get('Player/Roles/{battletag}/{blizz_id}/{region}', [PlayerRolesController::class, 'showAll']); + + Route::get('Player/{battletag}/{blizz_id}/{region}', [PlayerController::class, 'show']); From 76fd5b1b4829d5c4b683e7ae89b89cafbf80d4e7 Mon Sep 17 00:00:00 2001 From: Zemill <33404722+Zemill@users.noreply.github.com> Date: Sun, 17 Sep 2023 15:19:54 -0400 Subject: [PATCH 06/11] Switched up nav and started on maps page --- .../PlayerHeroesMapsRolesController.php | 13 +- .../Player/PlayerMapsController.php | 63 ++++ .../Player/PlayerRolesController.php | 7 - app/Rules/SingleGameMapInputValidation.php | 30 ++ app/Rules/SingleGameTypeInputValidation.php | 5 +- resources/js/app.js | 2 + .../Player/Maps/PlayerMapSingleStats.vue | 164 ++++++++++ .../Player/Maps/PlayerMapsAllStats.vue | 293 ++++++++++++++++++ .../views/Player/Maps/allMapData.blade.php | 8 + .../views/Player/Maps/singleMapData.blade.php | 8 + resources/views/nav.blade.php | 18 +- routes/api.php | 5 +- routes/web.php | 27 +- 13 files changed, 599 insertions(+), 44 deletions(-) create mode 100644 app/Http/Controllers/Player/PlayerMapsController.php create mode 100644 app/Rules/SingleGameMapInputValidation.php create mode 100644 resources/js/components/Player/Maps/PlayerMapSingleStats.vue create mode 100644 resources/js/components/Player/Maps/PlayerMapsAllStats.vue create mode 100644 resources/views/Player/Maps/allMapData.blade.php create mode 100644 resources/views/Player/Maps/singleMapData.blade.php diff --git a/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php b/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php index eb0478c9..31164fde 100644 --- a/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php +++ b/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php @@ -33,7 +33,7 @@ public function __construct(GlobalDataService $globalDataService) $this->globalDataService = $globalDataService; } public function getData(Request $request){ - //return response()->json($request->all()); + //return response()->json($request->all()); $validator = \Validator::make($request->only(['blizz_id', 'region', 'minimumgames', 'type']), [ 'blizz_id' => 'required|integer', @@ -160,8 +160,8 @@ public function getData(Request $request){ $seasonData = $this->globalDataService->getSeasonsData(); $newSeasonData = null; $latestGames = null; - $winRateFiltered = null; - + $mapWinRateFiltered= null; + $heroWinRateFiltered = null; $mapData = null; $heroDataStats = null; @@ -412,12 +412,12 @@ public function getData(Request $request){ if($page == "hero"){ $groupBy = 'hero'; }else if($page == "map"){ - + $groupBy = 'game_map'; }else if($page == "role"){ $groupBy = 'new_role'; } - $returnData = $result->groupBy($groupBy)->map(function($heroStats) use ($heroData, $qm_mmr_data, $ud_mmr_data, $hl_mmr_data, $tl_mmr_data, $sl_mmr_data, $ar_mmr_data, $newSeasonData, $mapData, $mapWinRateFiltered, $latestGames, $page, $heroWinRateFiltered, $heroDataStats){ + $returnData = $result->groupBy($groupBy)->map(function($heroStats) use ($heroData, $qm_mmr_data, $ud_mmr_data, $hl_mmr_data, $tl_mmr_data, $sl_mmr_data, $ar_mmr_data, $newSeasonData, $mapData, $mapWinRateFiltered, $latestGames, $page, $heroWinRateFiltered, $heroDataStats, $maps){ $deaths = $heroStats->sum('deaths'); $avg_kills = $heroStats->avg('kills'); $avg_takedowns = $heroStats->avg('takedowns'); @@ -453,13 +453,14 @@ public function getData(Request $request){ if($page == "hero"){ $name = $heroData[$heroStats->pluck('hero')->first()]["name"]; }else if($page == "map"){ - + $name = $maps[$heroStats->pluck('game_map')->first()]["name"]; }else if($page == "role"){ $name = $heroStats->pluck('new_role')->first(); } return [ "name" => $name, "hero" => $heroData[$heroStats->pluck('hero')->first()], + "game_map" => $maps[$heroStats->pluck('game_map')->first()], 'wins' => $wins, 'losses' => $losses, 'games_played' => $games_played, diff --git a/app/Http/Controllers/Player/PlayerMapsController.php b/app/Http/Controllers/Player/PlayerMapsController.php new file mode 100644 index 00000000..ca13ef97 --- /dev/null +++ b/app/Http/Controllers/Player/PlayerMapsController.php @@ -0,0 +1,63 @@ +globalDataService = $globalDataService; + } + + public function showAll(Request $request, $battletag, $blizz_id, $region) + { + $validator = \Validator::make(compact('battletag', 'blizz_id', 'region'), [ + 'battletag' => 'required|string', + 'blizz_id' => 'required|integer', + 'region' => 'required|integer' + ]); + + if ($validator->fails()) { + return redirect('/'); + } + + + return view('Player.Maps.allMapData')->with([ + 'battletag' => $battletag, + 'blizz_id' => $blizz_id, + 'region' => $region, + 'filters' => $this->globalDataService->getFilterData(), + ]); + } + + public function showSingle(Request $request, $battletag, $blizz_id, $region, $role){ + $validator = \Validator::make(compact('battletag', 'blizz_id', 'region'), [ + 'battletag' => 'required|string', + 'blizz_id' => 'required|integer', + 'region' => 'required|integer' + ]); + + if ($validator->fails()) { + return redirect('/'); + } + $map = (new SingleGameMapInputValidation())->passes('map', $request["map"]); + + + return view('Player.Maps.singleMapData')->with([ + 'battletag' => $battletag, + 'blizz_id' => $blizz_id, + 'region' => $region, + 'map' => $map, + 'filters' => $this->globalDataService->getFilterData(), + 'regions' => $this->globalDataService->getRegionIDtoString(), + ]); + } +} diff --git a/app/Http/Controllers/Player/PlayerRolesController.php b/app/Http/Controllers/Player/PlayerRolesController.php index 906ddd5b..2c7a9e67 100644 --- a/app/Http/Controllers/Player/PlayerRolesController.php +++ b/app/Http/Controllers/Player/PlayerRolesController.php @@ -6,15 +6,8 @@ use App\Http\Controllers\Controller; use Illuminate\Http\Request; -use App\Rules\GameTypeInputValidation; -use App\Rules\GameMapInputValidation; -use App\Rules\HeroInputByIDValidation; -use App\Rules\HeroInputValidation; use App\Rules\RoleInputValidation; -use App\Models\Replay; -use App\Models\Map; -use App\Models\HeroesDataTalent; class PlayerRolesController extends Controller { diff --git a/app/Rules/SingleGameMapInputValidation.php b/app/Rules/SingleGameMapInputValidation.php new file mode 100644 index 00000000..814b3fd8 --- /dev/null +++ b/app/Rules/SingleGameMapInputValidation.php @@ -0,0 +1,30 @@ +', 0) + ->pluck('name') + ->toArray(); + + if(!in_array($value, $validMaps)){ + return; + } + + $mapId = Map::where('name', $value) + ->pluck('map_id')->first(); + + return $mapId; + } + + public function message() + { + return 'The selected game types are invalid.'; + } +} diff --git a/app/Rules/SingleGameTypeInputValidation.php b/app/Rules/SingleGameTypeInputValidation.php index b9e534f2..7f139392 100644 --- a/app/Rules/SingleGameTypeInputValidation.php +++ b/app/Rules/SingleGameTypeInputValidation.php @@ -12,13 +12,12 @@ public function passes($attribute, $value) $validGameTypes = GameType::pluck('short_name')->toArray(); $validGameTypes = array_diff($validGameTypes, ['br', 'cu']); - if(!in_array($value, $validGameTypes)){ // corrected from $this->validGameTypes + if(!in_array($value, $validGameTypes)){ return 5; } - // Assume $filteredGameTypes is defined elsewhere or pass it as an argument $typeId = GameType::whereIn('short_name', $filteredGameTypes) - ->pluck('type_id')->first(); // corrected from ->type_id + ->pluck('type_id')->first(); return $typeId; } diff --git a/resources/js/app.js b/resources/js/app.js index c097b1d9..b7fc40a0 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -65,6 +65,8 @@ import PlayerHeroSingleStats from './components/Player/Heroes/PlayerHeroSingleSt import PlayerMatchup from './components/Player/PlayerMatchup.vue'; import PlayerRolesAllStats from './components/Player/Roles/PlayerRolesAllStats.vue'; import PlayerRoleSingleStats from './components/Player/Roles/PlayerRoleSingleStats.vue'; +import PlayerMapsAllStats from './components/Player/Maps/PlayerMapsAllStats.vue'; +import PlayerMapSingleStats from './components/Player/Maps/PlayerMapSingleStats.vue'; // Automatically register Vue components diff --git a/resources/js/components/Player/Maps/PlayerMapSingleStats.vue b/resources/js/components/Player/Maps/PlayerMapSingleStats.vue new file mode 100644 index 00000000..1f62a4b2 --- /dev/null +++ b/resources/js/components/Player/Maps/PlayerMapSingleStats.vue @@ -0,0 +1,164 @@ + + + \ No newline at end of file diff --git a/resources/js/components/Player/Maps/PlayerMapsAllStats.vue b/resources/js/components/Player/Maps/PlayerMapsAllStats.vue new file mode 100644 index 00000000..0aec7e00 --- /dev/null +++ b/resources/js/components/Player/Maps/PlayerMapsAllStats.vue @@ -0,0 +1,293 @@ +PlayerMapsAllStats.vue + + + + \ No newline at end of file diff --git a/resources/views/Player/Maps/allMapData.blade.php b/resources/views/Player/Maps/allMapData.blade.php new file mode 100644 index 00000000..30a334ae --- /dev/null +++ b/resources/views/Player/Maps/allMapData.blade.php @@ -0,0 +1,8 @@ +@extends('layouts.app') +@section('title', 'Heroes Profile') +@section('meta_keywords', '') +@section('meta_description', '') + +@section('content') + +@endsection diff --git a/resources/views/Player/Maps/singleMapData.blade.php b/resources/views/Player/Maps/singleMapData.blade.php new file mode 100644 index 00000000..3adb6aee --- /dev/null +++ b/resources/views/Player/Maps/singleMapData.blade.php @@ -0,0 +1,8 @@ +@extends('layouts.app') +@section('title', 'Heroes Profile') +@section('meta_keywords', '') +@section('meta_description', '') + +@section('content') + +@endsection diff --git a/resources/views/nav.blade.php b/resources/views/nav.blade.php index fc266209..0fc3c571 100644 --- a/resources/views/nav.blade.php +++ b/resources/views/nav.blade.php @@ -49,10 +49,11 @@ @if(isset($mainSearchAccount)) @endif @@ -99,10 +100,11 @@ class="card-img-top relative hover:opacity-75 w-12 h-12 rounded-full" {{ $account['battletag'] }} @endif diff --git a/routes/api.php b/routes/api.php index 877dc439..0d6cc2b6 100644 --- a/routes/api.php +++ b/routes/api.php @@ -106,11 +106,12 @@ Route::get('player/heroes/single', [PlayerHeroesMapsRolesController::class, 'getData']); //testing Route::post('player/heroes/single', [PlayerHeroesMapsRolesController::class, 'getData']); - + Route::get('player/roles/all/', [PlayerHeroesMapsRolesController::class, 'getData']); //testing Route::post('player/roles/all/', [PlayerHeroesMapsRolesController::class, 'getData']); - + Route::get('player/maps/all/', [PlayerHeroesMapsRolesController::class, 'getData']); //testing + Route::post('player/maps/all/', [PlayerHeroesMapsRolesController::class, 'getData']); }); \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 5cbcbe92..3b53bdc6 100644 --- a/routes/web.php +++ b/routes/web.php @@ -28,6 +28,7 @@ use App\Http\Controllers\Player\PlayerHeroesController; use App\Http\Controllers\Player\PlayerMatchupsController; use App\Http\Controllers\Player\PlayerRolesController; +use App\Http\Controllers\Player\PlayerMapsController; @@ -105,25 +106,15 @@ Route::get('Profile/Settings', [ProfileController::class, 'showSettings'])->middleware('ensureBattlenetAuth'); //Player data -Route::get('Player/FriendFoe/{battletag}/{blizz_id}/{region}', [FriendFoeController::class, 'show']); -Route::get('Player/Hero/All/{battletag}/{blizz_id}/{region}', [PlayerHeroesController::class, 'showAll']); -Route::get('Player/Hero/Single/{battletag}/{blizz_id}/{region}/{hero}', [PlayerHeroesController::class, 'showSingle']); -Route::get('Player/Matchups/{battletag}/{blizz_id}/{region}', [PlayerMatchupsController::class, 'show']); - - -Route::get('Player/Roles/Single/{battletag}/{blizz_id}/{region}/{role}', [PlayerRolesController::class, 'showSingle']); -Route::get('Player/Roles/{battletag}/{blizz_id}/{region}', [PlayerRolesController::class, 'showAll']); - - - Route::get('Player/{battletag}/{blizz_id}/{region}', [PlayerController::class, 'show']); - - - - - - - +Route::get('Player/{battletag}/{blizz_id}/{region}/FriendFoe', [FriendFoeController::class, 'show']); +Route::get('Player/{battletag}/{blizz_id}/{region}/Hero', [PlayerHeroesController::class, 'showAll']); +Route::get('Player/{battletag}/{blizz_id}/{region}/Hero/Single/{hero}', [PlayerHeroesController::class, 'showSingle']); +Route::get('Player/{battletag}/{blizz_id}/{region}/Matchups', [PlayerMatchupsController::class, 'show']); +Route::get('Player/{battletag}/{blizz_id}/{region}/Roles', [PlayerRolesController::class, 'showAll']); +Route::get('Player/{battletag}/{blizz_id}/{region}/{role}/Roles/Single', [PlayerRolesController::class, 'showSingle']); +Route::get('Player/{battletag}/{blizz_id}/{region}/Maps', [PlayerMapsController::class, 'showAll']); +Route::get('Player/{battletag}/{blizz_id}/{region}/Maps/Single/{map}', [PlayerMapsController::class, 'showSingle']); //Rewrite game data later Route::get('/Gamedata', [GamedataController::class, 'heroes']); From 6ec3c9b74fc4c79689597e6bc6786809a278b584 Mon Sep 17 00:00:00 2001 From: Zemill <33404722+Zemill@users.noreply.github.com> Date: Sun, 17 Sep 2023 15:26:02 -0400 Subject: [PATCH 07/11] Url fixes --- .../js/components/Player/Heroes/PlayerHeroSingleStats.vue | 2 +- .../js/components/Player/Heroes/PlayerHeroesAllStats.vue | 2 +- .../js/components/Player/Maps/PlayerMapSingleStats.vue | 8 -------- .../js/components/Player/Maps/PlayerMapsAllStats.vue | 4 ++-- resources/js/components/Player/PlayerMatchup.vue | 2 +- .../js/components/Player/Roles/PlayerRolesAllStats.vue | 2 +- 6 files changed, 6 insertions(+), 14 deletions(-) diff --git a/resources/js/components/Player/Heroes/PlayerHeroSingleStats.vue b/resources/js/components/Player/Heroes/PlayerHeroSingleStats.vue index 1f62a4b2..068f2883 100644 --- a/resources/js/components/Player/Heroes/PlayerHeroSingleStats.vue +++ b/resources/js/components/Player/Heroes/PlayerHeroSingleStats.vue @@ -157,7 +157,7 @@ export default { } }, getTalentPageUrl(){ - return "/Player/Talents/" + this.battletag + "/" + this.blizzid + "/" + this.region + "/" + this.heroname; + return "/Player/" + this.battletag + "/" + this.blizzid + "/" + this.region + "/Talents/" + "/" + this.heroname; }, } } diff --git a/resources/js/components/Player/Heroes/PlayerHeroesAllStats.vue b/resources/js/components/Player/Heroes/PlayerHeroesAllStats.vue index 38cb52be..3997467f 100644 --- a/resources/js/components/Player/Heroes/PlayerHeroesAllStats.vue +++ b/resources/js/components/Player/Heroes/PlayerHeroesAllStats.vue @@ -262,7 +262,7 @@ export default { return this.gametype.includes(game_type); }, getPlayerHeroPageUrl(hero){ - return "/Player/Hero/Single/" + this.battletag + "/" + this.blizzid + "/" + this.region + "/" + hero; + return "/Player/" + this.battletag + "/" + this.blizzid + "/" + this.region + "Hero/Single/" + "/" + hero; }, isDisabled(stat) { return this.selectedStatsCount >= 15 && !stat.selected; diff --git a/resources/js/components/Player/Maps/PlayerMapSingleStats.vue b/resources/js/components/Player/Maps/PlayerMapSingleStats.vue index 1f62a4b2..0ff82ca1 100644 --- a/resources/js/components/Player/Maps/PlayerMapSingleStats.vue +++ b/resources/js/components/Player/Maps/PlayerMapSingleStats.vue @@ -40,11 +40,6 @@ AR MMR = {{ data.ar_mmr_data ? data.ar_mmr_data.mmr : 0 }}
AR MMR Tier = {{ data.ar_mmr_data ? data.ar_mmr_data.rank_tier : "" }}
- - -
@@ -156,9 +151,6 @@ export default { history.pushState(null, null, this.heroname); } }, - getTalentPageUrl(){ - return "/Player/Talents/" + this.battletag + "/" + this.blizzid + "/" + this.region + "/" + this.heroname; - }, } } \ No newline at end of file diff --git a/resources/js/components/Player/Maps/PlayerMapsAllStats.vue b/resources/js/components/Player/Maps/PlayerMapsAllStats.vue index 0aec7e00..4271b85a 100644 --- a/resources/js/components/Player/Maps/PlayerMapsAllStats.vue +++ b/resources/js/components/Player/Maps/PlayerMapsAllStats.vue @@ -1,4 +1,4 @@ -PlayerMapsAllStats.vue