├── .gitattributes ├── updateJson.php ├── api ├── entitlements.php ├── email.php ├── store.php ├── storeledge.php ├── data │ ├── config.json │ └── champions-sumary.json ├── account.php ├── login.php ├── ledge.php ├── utils │ └── utils.php ├── userinfo.php ├── newaccount.php └── ledgeapi.php ├── api.php ├── LICENSE ├── css └── style.css ├── updateConfig.php ├── README.md └── index.php /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /updateJson.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /api/entitlements.php: -------------------------------------------------------------------------------- 1 | entitlementsToken = $result['entitlements_token']; 27 | } 28 | 29 | } 30 | 31 | 32 | ?> -------------------------------------------------------------------------------- /api/email.php: -------------------------------------------------------------------------------- 1 | emailData = array( 34 | "email" => $email, 35 | "verified" => $verified 36 | ); 37 | 38 | } 39 | } 40 | 41 | 42 | ?> -------------------------------------------------------------------------------- /api.php: -------------------------------------------------------------------------------- 1 | returnAccount("text"); 36 | } 37 | 38 | if($GLOBALS['debugMode']){ 39 | echo PHP_EOL.'Total time spent: '.time() - $GLOBALS['startTime'].' seconds'; 40 | } 41 | } catch(Exception $e){ 42 | echo $e->getMessage(); 43 | } 44 | 45 | ?> 46 | -------------------------------------------------------------------------------- /api/store.php: -------------------------------------------------------------------------------- 1 | token = $token; 13 | 14 | //$apiUrl = "https://".$storePrefix.".store.leagueoflegends.com/storefront/v3/history/purchase?language=en_US"; 15 | $apiUrl = "https://".$storePrefix.".lol.sgp.pvp.net/storefront/v3/history/purchase?language=en_US"; 16 | $header = array( 17 | "Accept: application/json", 18 | "User-Agent: RiotClient/18.0.0 (lol-store)", 19 | "Authorization: Bearer ".$this->token."" 20 | ); 21 | 22 | $ch = curl_init($apiUrl); 23 | curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 24 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 25 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 26 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 27 | 28 | $result = json_decode(curl_exec($ch), 1); 29 | curl_close($ch); 30 | 31 | $rp = $result['player']['rp']; 32 | $be = $result['player']['ip']; 33 | $level = $result['player']['summonerLevel']; 34 | $refunds = $result['refundCreditsRemaining']; 35 | 36 | $this->storeData = array( 37 | "rp" => $rp, 38 | "be" => $be, 39 | "level" => $level, 40 | "refunds" => $refunds 41 | ); 42 | 43 | } 44 | 45 | } 46 | 47 | 48 | 49 | ?> -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2024, Break xD 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | 3. Neither the name of the copyright holder nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #333; 3 | font-family: Arial, sans-serif; 4 | color: #fff; 5 | } 6 | 7 | .container { 8 | max-width: 800px; 9 | margin: 0 auto; 10 | padding: 30px; 11 | } 12 | 13 | .check-container { 14 | background-color: #555; 15 | padding: 20px; 16 | border-radius: 10px; 17 | margin-bottom: 20px; 18 | } 19 | 20 | .check-container h3 { 21 | margin-top: 0; 22 | } 23 | 24 | .form-group { 25 | margin-bottom: 20px; 26 | } 27 | 28 | .form-group label { 29 | display: block; 30 | font-size: 14px; 31 | font-weight: bold; 32 | } 33 | 34 | .form-group input[type="text"] { 35 | padding: 10px; 36 | font-size: 14px; 37 | width: 100%; 38 | border-radius: 10px; 39 | border: none; 40 | background-color: #fff; 41 | color: #333; 42 | } 43 | 44 | .btn { 45 | background-color: #0d47a1; 46 | color: #fff; 47 | padding: 10px 20px; 48 | border-radius: 10px; 49 | border: none; 50 | font-size: 14px; 51 | cursor: pointer; 52 | } 53 | 54 | .btn:hover { 55 | background-color: #0c2e6d; 56 | } 57 | 58 | .result-container { 59 | background-color: #555; 60 | padding: 20px; 61 | border-radius: 10px; 62 | margin-bottom: 20px; 63 | } 64 | 65 | .result-container h3 { 66 | margin-top: 0; 67 | } 68 | 69 | .status-container { 70 | background-color: #0d47a1; 71 | padding: 10px 20px; 72 | border-radius: 10px; 73 | color: #fff; 74 | font-weight: bold; 75 | text-align: center; 76 | display: inline-block; 77 | } 78 | 79 | .status-container.approve-30 { 80 | background-color: #1b5e20; 81 | } 82 | 83 | .status-container.approve-30- { 84 | background-color: #ff5722; 85 | } 86 | 87 | .status-container.rejected { 88 | background-color: #b71c1c; 89 | } -------------------------------------------------------------------------------- /api/storeledge.php: -------------------------------------------------------------------------------- 1 | apiBaseUrl = "https://".$ledgePrefix.".lol.sgp.pvp.net"; 15 | $this->accId = $accId; 16 | $this->token = $token; 17 | 18 | $headerStore = array( 19 | "Content-Type: application/json", 20 | "Accept: application/json", 21 | "authorization: Bearer ".$this->token 22 | ); 23 | 24 | $this->curl_options = array( 25 | CURLOPT_HTTPHEADER => $headerStore, 26 | CURLOPT_RETURNTRANSFER => 1, 27 | CURLOPT_SSL_VERIFYPEER => 0, 28 | CURLOPT_SSL_VERIFYHOST => 0 29 | ); 30 | 31 | self::getStoreData(); 32 | } 33 | 34 | private function ledgeBase($endpoint){ 35 | return curl_init($this->apiBaseUrl.$endpoint); 36 | } 37 | 38 | private function getStoreData(){ 39 | $ch = self::ledgeBase("/storefront/v3/history/purchase?language=en_US"); 40 | 41 | curl_setopt_array($ch, $this->curl_options); 42 | 43 | $result = json_decode(curl_exec($ch), 1); 44 | curl_close($ch); 45 | 46 | if(isset($result['player']['rp'])){ 47 | 48 | $rp = $result['player']['rp']; 49 | $be = $result['player']['ip']; 50 | $level = $result['player']['summonerLevel']; 51 | $refunds = $result['refundCreditsRemaining']; 52 | 53 | $this->storeData = array( 54 | "rp" => $rp, 55 | "be" => $be, 56 | "level" => $level, 57 | "refunds" => $refunds 58 | ); 59 | }else{ 60 | throw new \Exception(json_encode($result)); 61 | } 62 | 63 | } 64 | 65 | } 66 | 67 | 68 | 69 | ?> -------------------------------------------------------------------------------- /api/data/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "variable": { 3 | "hydra_key": "", 4 | "debug_mode": false, 5 | "return_mode": true, 6 | "exploit": false 7 | }, 8 | "endpoint": { 9 | "usw_region": { 10 | "BR1": "usw2-red", 11 | "LA1": "usw2-red", 12 | "LA2": "usw2-red", 13 | "NA1": "usw2-red", 14 | "OC1": "usw2-red", 15 | "RU": "euc1-red", 16 | "TR1": "euc1-red", 17 | "EUN1": "euc1-red", 18 | "EUW1": "euc1-red", 19 | "JP1": "apne1-red", 20 | "KR": "apne1-red" 21 | }, 22 | "ledge_region": { 23 | "BR1": "br-red", 24 | "EUN1": "eune-red", 25 | "EUW1": "euw-red", 26 | "JP1": "jp-red", 27 | "LA1": "las-red", 28 | "LA2": "lan-red", 29 | "NA1": "na-red", 30 | "OC1": "oce-red", 31 | "RU": "ru-blue", 32 | "TR1": "tr-blue", 33 | "KR": "kr-blue" 34 | }, 35 | "store_region": { 36 | "BR1": "br", 37 | "EUN1": "eun", 38 | "EUW1": "euw", 39 | "JP1": "jp", 40 | "LA1": "la1", 41 | "LA2": "la2", 42 | "NA1": "na", 43 | "OC1": "oc", 44 | "RU": "ru", 45 | "TR1": "tr", 46 | "KR": "kr" 47 | }, 48 | "loot_region": { 49 | "BR1": "lolriot.aws-usw2-prod.br1", 50 | "EUN1": "lolriot.euc1.eun1", 51 | "EUW1": "lolriot.ams1.euw1", 52 | "JP1": "lolriot.aws-apne1-prod.jp1", 53 | "LA1": "lolriot.aws-usw2-prod.la1", 54 | "LA2": "lolriot.aws-usw2-prod.la2", 55 | "NA1": "lolriot.aws-usw2-prod.na1", 56 | "OC1": "lolriot.aws-apse1-prod.oc1", 57 | "RU1": "lolriot.euc1.ru", 58 | "TR1": "lolriot.euc1.tr1" 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /updateConfig.php: -------------------------------------------------------------------------------- 1 | array(), "endpoint" => array()); 3 | $path = "api/data/config.json"; 4 | 5 | $usw_region = array( 6 | 'BR1' => 'usw2-red', 7 | 'LA1' => 'usw2-red', 8 | 'LA2' => 'usw2-red', 9 | 'NA1' => 'usw2-red', 10 | 'OC1' => 'usw2-red', 11 | 'RU' => 'euc1-red', 12 | 'TR1' => 'euc1-red', 13 | 'EUN1' => 'euc1-red', 14 | 'EUW1' => 'euc1-red', 15 | 'JP1' => 'apne1-red', 16 | 'KR' => 'apne1-red' 17 | ); 18 | 19 | $ledge_region = array( 20 | 'BR1' => 'br-red', 21 | 'EUN1' => 'eune-red', 22 | 'EUW1' => 'euw-red', 23 | 'JP1' => 'jp-red', 24 | 'LA1' => 'las-red', 25 | 'LA2' => 'lan-red', 26 | 'NA1' => 'na-red', 27 | 'OC1' => 'oce-red', 28 | 'RU' => 'ru-blue', 29 | 'TR1' => 'tr-blue', 30 | 'KR' => 'kr-blue' 31 | ); 32 | 33 | $store_region = array( 34 | "BR1" => "br", 35 | "EUN1" => "eun", 36 | "EUW1" => "euw", 37 | "JP1" => "jp", 38 | "LA1" => "la1", 39 | "LA2" => "la2", 40 | "NA1" => "na", 41 | "OC1" => "oc", 42 | "RU" => "ru", 43 | "TR1" => "tr", 44 | "KR" => "kr" 45 | ); 46 | 47 | $loot_region = array( 48 | "BR1" => "lolriot.aws-usw2-prod.br1", 49 | "EUN1" => "lolriot.euc1.eun1", 50 | "EUW1" => "lolriot.ams1.euw1", 51 | "JP1" => "lolriot.aws-apne1-prod.jp1", 52 | "LA1" => "lolriot.aws-usw2-prod.la1", 53 | "LA2" => "lolriot.aws-usw2-prod.la2", 54 | "NA1" => "lolriot.aws-usw2-prod.na1", 55 | "OC1" => "lolriot.aws-apse1-prod.oc1", 56 | "RU1" => "lolriot.euc1.ru", 57 | "TR1" => "lolriot.euc1.tr1" 58 | 59 | ); 60 | 61 | $hydraKey = ""; 62 | $debugMode = false; 63 | $returnMode = true; 64 | $exploit = false; 65 | 66 | $config['endpoint']['usw_region'] = $usw_region; 67 | $config['endpoint']['ledge_region'] = $ledge_region; 68 | $config['endpoint']['store_region'] = $store_region; 69 | $config['endpoint']['loot_region'] = $loot_region; 70 | 71 | $config['variable']['hydra_key'] = $hydraKey; 72 | $config['variable']['debug_mode'] = $debugMode; 73 | $config['variable']['return_mode'] = $returnMode; 74 | $config['variable']['exploit'] = $exploit; 75 | 76 | $configJson = json_encode($config, JSON_PRETTY_PRINT); 77 | 78 | $fp = fopen($path, "w"); 79 | $fResult = fwrite($fp, $configJson); 80 | fclose($fp); 81 | 82 | if(!$fResult){ 83 | echo 'Fail write in '.$path.PHP_EOL; 84 | }else{ 85 | echo 'Sucessfully write in '.$path.PHP_EOL; 86 | } 87 | 88 | 89 | 90 | 91 | 92 | ?> -------------------------------------------------------------------------------- /api/account.php: -------------------------------------------------------------------------------- 1 | header = array( 15 | "Accept: application/json", 16 | "User-Agent: RiotClient/18.0.0 (lol-store)", 17 | "Authorization: Bearer ".$token 18 | ); 19 | 20 | $this->curl_options = array( 21 | CURLOPT_HTTPHEADER => $this->header, 22 | CURLOPT_RETURNTRANSFER => 1, 23 | CURLOPT_SSL_VERIFYPEER => 0, 24 | CURLOPT_SSL_VERIFYHOST => 0 25 | ); 26 | 27 | $this->baseUrl = "https://api.account.riotgames.com"; 28 | 29 | self::riotIdChange(); 30 | } 31 | 32 | public function riotIdChange(){ 33 | $url = "{$this->baseUrl}/aliases/v1/eligibility"; 34 | 35 | $ch = curl_init($url); 36 | curl_setopt_array($ch, $this->curl_options); 37 | 38 | $result = curl_exec($ch); 39 | curl_close($ch); 40 | 41 | $result = json_decode($result,1); 42 | if(!isset($result['eligible'])){ 43 | $return['canChange'] = true; 44 | $return['changeDate'] = "01/33/7"; 45 | $this->riotIdChange = $return; 46 | 47 | return $this->riotIdChange; 48 | } 49 | 50 | $canChange = $result['eligible']; 51 | $elegibleAfterMS = intval($result['eligibleAfter'] / 1000); 52 | $eligibleAfter = date('d/m/Y', $elegibleAfterMS); 53 | 54 | $return['canChange'] = $canChange; 55 | $return['changeDate'] = $eligibleAfter; 56 | $this->riotIdChange = $return; 57 | 58 | return $this->riotIdChange; 59 | } 60 | 61 | public function submitRiotId($name, $tag){ 62 | if(!$this->riotIdChange['canChange']) return "Error during Riot ID change!"; 63 | 64 | $header = $this->header; 65 | array_push($header, "Content-Type: application/json"); 66 | 67 | $curl_option = $this->curl_options; 68 | 69 | $curl_option[CURLOPT_POSTFIELDS] = json_encode(array( 70 | "game_name" => $name, 71 | "tag_line" => $tag 72 | )); 73 | $curl_option[CURLOPT_HTTPHEADER] = $header; 74 | 75 | 76 | $url = "{$this->baseUrl}/aliases/v1/aliases"; 77 | 78 | $ch = curl_init($url); 79 | curl_setopt_array($ch, $curl_option); 80 | 81 | $result = curl_exec($ch); 82 | curl_close($ch); 83 | 84 | $result_json = json_decode($result,1); 85 | if(isset($result_json['game_name']) && $result_json['game_name'] == $name){ 86 | return "Riot ID now is $name\#$tag!"; 87 | }else{ 88 | return "Error during Riot ID change!: $result"; 89 | } 90 | } 91 | 92 | } 93 | 94 | 95 | 96 | 97 | ?> -------------------------------------------------------------------------------- /api/login.php: -------------------------------------------------------------------------------- 1 | key = $GLOBALS['config']['variable']['hydra_key']; 18 | 19 | $this->user = $u; 20 | $this->password = $p; 21 | 22 | $this->data = array( 23 | "login" => $this->user, 24 | "pass" => $this->password, 25 | "hnkey" => $this->key 26 | ); 27 | 28 | $this->client_id = array("lol", "riot-client"); 29 | 30 | self::getTokens(); 31 | } 32 | 33 | private static function curl_options($data){ 34 | $curl_options = array( 35 | CURLOPT_HTTPHEADER => self::$header, 36 | CURLOPT_RETURNTRANSFER => 1, 37 | CURLOPT_SSL_VERIFYPEER => 0, 38 | CURLOPT_SSL_VERIFYHOST => 0, 39 | CURLOPT_POSTFIELDS => $data 40 | ); 41 | 42 | return $curl_options; 43 | } 44 | 45 | private function getTokens(){ 46 | $ch = array(); 47 | $mh = curl_multi_init(); 48 | $resultArray = array(); 49 | 50 | for($i = 0; $i < 2; $i++){ 51 | 52 | $ch[$i] = curl_init($this->apiUrl); 53 | 54 | $this->data['client_id'] = $this->client_id[$i]; 55 | $data = json_encode($this->data); 56 | 57 | curl_setopt_array($ch[$i], self::curl_options($data)); 58 | 59 | curl_multi_add_handle($mh, $ch[$i]); 60 | } 61 | 62 | do{ 63 | curl_multi_exec($mh, $active); 64 | } while ($active); 65 | 66 | for($i = 0; $i < 2; $i++){ 67 | curl_multi_remove_handle($mh, $ch[$i]); 68 | 69 | $r = curl_multi_getcontent($ch[$i]); 70 | $result = json_decode($r, 1); 71 | 72 | $type = $i == 0 ? "lol" : "riot"; 73 | 74 | if($GLOBALS['debugMode']){ 75 | echo PHP_EOL.'getTokens('.$type.'): '.time() - $GLOBALS['startTime']; 76 | } 77 | 78 | if(!isset($result['status'])){ // CHECK FOR 429 OR OTHER ERROR 79 | $resultArray[$type] = array("status" => "unknown", "error" => $r); 80 | } 81 | 82 | if($result['status'] == "1"){ // CHECK IF ACCOUNT IS CORRECT 83 | $resultArray[$type] = array("status" => $result['status'], "token" => $result['token'] ); 84 | }else{ 85 | $resultArray[$type] = array("status" => $result['status'], "error" => $result['error'] ); 86 | } 87 | 88 | } 89 | 90 | curl_multi_close($mh); 91 | 92 | $this->response = $resultArray; 93 | 94 | } 95 | 96 | } 97 | 98 | 99 | 100 | 101 | ?> -------------------------------------------------------------------------------- /api/ledge.php: -------------------------------------------------------------------------------- 1 | tokenLol = $token; 17 | $this->userInfoJwt = $userInfoJwt; 18 | $this->uswPrefix = $uswPrefix; 19 | $this->ledgePrefix = $ledgePrefix; 20 | $this->region = $region; 21 | } 22 | 23 | public function getToken(){ 24 | $header = array( 25 | "Content-Type: application/json", 26 | "Accept: application/json", 27 | "User-Agent: LeagueOfLegendsClient/12.2.418.8114 (rcp-be-lol-login)", 28 | "Authorization: Bearer ".$this->sessionToken 29 | ); 30 | 31 | $data = json_encode(array( 32 | 'claims' => array( 33 | 'cname' => 'lcu' 34 | ), 35 | 'product' => 'lol', 36 | 'puuid' => $this->puuid, 37 | 'region' => strtolower($this->region) 38 | ) 39 | ); 40 | 41 | $apiUrl = 'https://'.$this->uswPrefix.'.pp.sgp.pvp.net/session-external/v1/session/create'; 42 | 43 | $ch = curl_init($apiUrl); 44 | curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 45 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 46 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 47 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 48 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 49 | 50 | $result = curl_exec($ch); 51 | curl_close($ch); 52 | 53 | $this->tokenLedge = str_replace('"','',$result); 54 | 55 | } 56 | 57 | public function getSession($banned){ 58 | $header = array( 59 | "Content-Type: application/json", 60 | "Accept: application/json", 61 | "User-Agent: LeagueOfLegendsClient/12.2.418.8114 (rcp-be-lol-login)", 62 | "Authorization: Bearer ".$this->tokenLol 63 | ); 64 | $data_array = array( 65 | 'clientName' => 'lcu', 66 | 'userinfo' => $this->userInfoJwt 67 | ); 68 | 69 | $apiUrl = 'https://'.$this->uswPrefix.'.pp.sgp.pvp.net/login-queue/v2/login/products/lol/regions/'.$this->region; 70 | $data = json_encode($data_array); 71 | 72 | $ch = curl_init($apiUrl); 73 | curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 74 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 75 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 76 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 77 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 78 | 79 | $result = json_decode(curl_exec($ch), 1); 80 | curl_close($ch); 81 | 82 | $this->sessionToken = $result['token']; 83 | } 84 | 85 | 86 | } 87 | 88 | 89 | ?> -------------------------------------------------------------------------------- /api/utils/utils.php: -------------------------------------------------------------------------------- 1 | 1, 25 | CURLOPT_SSL_VERIFYHOST => 0, 26 | CURLOPT_SSL_VERIFYPEER =>0 27 | ); 28 | 29 | if(!self::writeJsonFile(self::$pathChampions, "https://raw.communitydragon.org/latest/plugins/rcp-be-lol-game-data/global/en_gb/v1/champion-summary.json", $curl_options)){ 30 | echo 'Fail write in '.self::$pathChampions.PHP_EOL; 31 | }else{ 32 | echo 'Sucessfully write in '.self::$pathChampions.PHP_EOL; 33 | } 34 | 35 | if(!self::writeJsonFile(self::$pathSkins, "https://raw.communitydragon.org/latest/plugins/rcp-be-lol-game-data/global/default/v1/skins.json", $curl_options)){ 36 | echo 'Fail write in '.self::$pathSkins.PHP_EOL; 37 | }else{ 38 | echo 'Sucessfully write in '.self::$pathSkins.PHP_EOL; 39 | } 40 | } 41 | 42 | public static function writeJsonFile($path, $apiUrl, $curl_options){ 43 | $ch = curl_init($apiUrl); // INIT CURL TO APIURL 44 | curl_setopt_array($ch, $curl_options); // SET CURL OPTIONS TO $CH 45 | 46 | $fp = fopen($path, 'w'); // OPEN FILE 47 | $fResult = fwrite($fp, curl_exec($ch)); // WRITE JSON 48 | fclose($fp); // CLOSE FILE 49 | 50 | curl_close($ch); // CLOSE CURL 51 | 52 | return $fResult; 53 | } 54 | 55 | public static function champNameByID($id){ 56 | 57 | $json = file_get_contents(self::$pathChampions); 58 | 59 | $result = json_decode($json, 1); 60 | 61 | for($i = 0; $i < count($result); $i++){ 62 | if($id == $result[$i]['id']){ 63 | return $result[$i]['alias']; 64 | } 65 | } 66 | } 67 | 68 | public static function getSkinByID($id){ 69 | $json = file_get_contents(self::$pathSkins); 70 | 71 | $result = json_decode($json, 1); 72 | 73 | return isset($result[$id]) ? $result[$id]['name'] : "UNDEFINED"; 74 | } 75 | 76 | public static function array_sort($array, $on, $order=SORT_ASC){ 77 | $new_array = array(); 78 | $sortable_array = array(); 79 | 80 | if (count($array) > 0) { 81 | foreach ($array as $k => $v) { 82 | if (is_array($v)) { 83 | foreach ($v as $k2 => $v2) { 84 | if ($k2 == $on) { 85 | $sortable_array[$k] = $v2; 86 | } 87 | } 88 | } else { 89 | $sortable_array[$k] = $v; 90 | } 91 | } 92 | 93 | switch ($order) { 94 | case SORT_ASC: 95 | asort($sortable_array); 96 | break; 97 | case SORT_DESC: 98 | arsort($sortable_array); 99 | break; 100 | } 101 | 102 | foreach ($sortable_array as $k => $v) { 103 | $new_array[$k] = $array[$k]; 104 | } 105 | } 106 | 107 | return $new_array; 108 | } 109 | 110 | 111 | } 112 | 113 | 114 | ?> -------------------------------------------------------------------------------- /api/userinfo.php: -------------------------------------------------------------------------------- 1 | userInfoJwt = $result; 49 | //echo $result; 50 | }elseif($type == "riot"){ 51 | //echo $result; 52 | 53 | $r = json_decode($result, 1); 54 | 55 | $this->puuid = $r['sub']; 56 | $this->accId = $r['original_account_id']; 57 | $this->sumId = $r['lol_account']['summoner_id']; 58 | $this->level = (int)$r['lol_account']['summoner_level']; 59 | $this->riotId = $r['acct']['game_name']. '#' .$r['acct']['tag_line']; 60 | $this->nick = strlen($r['lol_account']['summoner_name']) >= 1 ? $r['lol_account']['summoner_name'] : "WITHOUT_NICK"; 61 | $this->createTime = date('d/m/Y', $r['acct']['created_at'] / 1000); 62 | 63 | for($i = 0; $i < count($r['lol_region']); $i++){ 64 | if($r['lol_region'][$i]['active']){ 65 | $this->region = $r['lol_region'][$i]['cpid']; 66 | break; 67 | } 68 | } 69 | 70 | $this->usw_region = $GLOBALS['config']['endpoint']['usw_region'][$this->region]; 71 | $this->ledge_region = $GLOBALS['config']['endpoint']['ledge_region'][$this->region]; 72 | $this->store_region = $GLOBALS['config']['endpoint']['store_region'][$this->region]; 73 | $this->loot_region = $GLOBALS['config']['endpoint']['loot_region'][$this->region]; 74 | 75 | //echo $r['ban']['exp'].' > '.time() * 1000; 76 | 77 | $this->totalBans = count($r['ban']['restrictions']); 78 | for($i = 0; $i < $this->totalBans; $i++){ 79 | $b = $r['ban']['restrictions'][$i]; 80 | $trigger_scope = array("lol", "riot"); 81 | $ignore_type = array("TEXT_CHAT_RESTRICTION"); 82 | 83 | if(in_array($b['scope'], $trigger_scope) && !in_array($b['type'], $ignore_type)){ 84 | $this->banned = true; 85 | $this->banInfo = $b['type']; 86 | $this->banReason = $b['reason']; 87 | $this->banGame = isset($b['dat']['gameData']['triggerGameId']) ? $b['dat']['gameData']['triggerGameId'] : "null"; 88 | 89 | if(isset($b['dat']['expirationMillis'])){ 90 | $banEnd = ($b['dat']['expirationMillis'] / 1000) - time(); 91 | $banEnd = (($banEnd / 60) / 60) / 24; 92 | 93 | if($banEnd > 1000){ 94 | $this->banEnd = 'PERMANENT_BAN'; 95 | }else{ 96 | $this->banEnd = $banEnd > 1 ? (int)$banEnd.' days LEFT' : (int)$banEnd.' day LEFT'; 97 | } 98 | 99 | }else{ 100 | $this->banEnd = 'PERMANENT_BAN'; 101 | } 102 | break; 103 | } 104 | } 105 | 106 | if($this->banned != true){ 107 | $this->banned = false; 108 | } 109 | } 110 | 111 | } 112 | 113 | } 114 | 115 | 116 | ?> -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # League of Legends Account Checker 3 | 4 | ## Introduction (EN) 5 | This API checks information of League of Legends accounts. It can be used via CLI or through a web interface. 6 | 7 |  8 | 9 | ## Prerequisites 10 | - PHP installed on the server. 11 | - Internet access for interaction with Riot Games APIs. 12 | - [Hydra API key](https://api.hydranetwork.org/discord) 13 | 14 | ## Configuration 15 | Clone the repository or download the files to a PHP server. 16 | Configure your Hydra API key in `api/data/config.json` 17 | 18 | ## Manual Updates 19 | 1. To update base endpoints, edit and run `updateConfig.php` 20 | 2. To update Champions & Skins data each patch, run `php updateJson.php` 21 | 22 | ## Usage 23 | 24 | ### Via CLI 25 | 1. Open `api.php`. 26 | 2. Enter the League of Legends account's username and password in the designated variables. 27 | 3. Run the script in the terminal with `php api.php`. 28 | 4. Account information will be processed and displayed. 29 | 30 | ### Via Browser 31 | 1. Open `index.html` in a browser. 32 | 2. Enter account information in the format `username:password` in the combobox. 33 | 3. Click on "Test". 34 | 4. Information will be processed and displayed in the web interface. 35 | 36 | ## Usage as an Independent API 37 | 1. Make GET requests to `api.php` with `user` and `pass` parameters. 38 | Example: `http://yourserver.com/api.php?user=username&pass=password`. 39 | 2. The API will process the information and return the account data. 40 | 41 | ## Available Information 42 | The system returns various account information, including: 43 | - Username and old nickname. 44 | - Riot ID and change status available. 45 | - Email (partially masked). 46 | - Account level. 47 | - Leavebuster status. 48 | - Account creation date. 49 | - Ranking data (SoloQ and Flex), including last season's ranking, win rate, and LP (for Master tier and above). 50 | - Date and inactivity since the last game. 51 | - Skin and champion count. 52 | - Blue Essence (BE) and Riot Points (RP). 53 | - Quantity of gems, chests, and keys. 54 | - Details of the first champions and skins acquired. 55 | 56 | --- 57 | 58 | ## Introdução (PT-BR) 59 | Esta API verifica informações de contas do League of Legends. Pode ser utilizado via CLI ou através de uma interface web. 60 | 61 | ## Pré-requisitos 62 | - PHP instalado no servidor. 63 | - Acesso à internet para interação com as APIs da Riot Games. 64 | - [Hydra API key](https://api.hydranetwork.org/discord) 65 | 66 | ## Configuração 67 | Clone o repositório ou baixe os arquivos em um servidor com PHP. 68 | Configure sua chave da Hydra API em `api/data/config.json` 69 | 70 | ## Atualizações Manuais 71 | 1. Para atualizar os endpoints base, edite e execute `updateConfig.php` 72 | 2. Para atualizar os dados de Campeões e Skins a cada atualização do jogo, execute `php updateJson.php` 73 | 74 | 75 | ## Uso 76 | 77 | ### Via CLI 78 | 1. Abra `api.php`. 79 | 2. Insira o nome de usuário e senha da conta de League of Legends nas variáveis designadas. 80 | 3. Execute o script no terminal com `php api.php`. 81 | 4. As informações da conta serão processadas e exibidas. 82 | 83 | ### Via Navegador 84 | 1. Abra `index.html` em um navegador. 85 | 2. Insira as informações da conta no formato `usuário:senha` na combobox. 86 | 3. Clique em "Testar". 87 | 4. As informações serão processadas e exibidas na interface web. 88 | 89 | ## Uso como API Independente 90 | 1. Faça requisições GET para `api.php` com parâmetros `user` e `pass`. 91 | Exemplo: `http://seuservidor.com/api.php?user=nomeDoUsuario&pass=senha`. 92 | 2. A API processará as informações e retornará os dados da conta. 93 | 94 | ## Informações Disponíveis 95 | O sistema retorna várias informações da conta, incluindo: 96 | - Nome de usuário e apelido antigo. 97 | - ID da Riot e status de mudança disponível. 98 | - E-mail (parcialmente mascarado). 99 | - Nível da conta. 100 | - Status de leavebuster. 101 | - Data de criação da conta. 102 | - Dados de classificação (SoloQ e Flex), incluindo a classificação da temporada anterior, taxa de vitória e PDL (para Mestre e acima). 103 | - Data e inatividade desde o último jogo. 104 | - Contagem de skins e campeões. 105 | - Essência Azul (BE) e Riot Points (RP). 106 | - Quantidade de gemas, baús e chaves. 107 | - Detalhes dos primeiros campeões e skins adquiridos. 108 | 109 | --- 110 | 111 | -------------------------------------------------------------------------------- /api/newaccount.php: -------------------------------------------------------------------------------- 1 | userInfo = new \userInfo\UserInfo($this->tokenRiot, "riot"); 30 | if($GLOBALS['debugMode']){ 31 | echo PHP_EOL.'new UserInfo(riot): '.time() - $GLOBALS['startTime']; 32 | } 33 | // LOL USERINFO (JWT) 34 | $userInfo = new \userInfo\UserInfo($this->tokenLol, "lol"); 35 | $this->userInfo->userInfoJwt = $userInfo->userInfoJwt; 36 | if($GLOBALS['debugMode']){ 37 | echo PHP_EOL.'new UserInfo(lol): '.time() - $GLOBALS['startTime']; 38 | } 39 | 40 | } 41 | 42 | public function __construct($u, $p){ 43 | if($GLOBALS['debugMode']){ 44 | echo PHP_EOL.'new StartCheck: '.time() - $GLOBALS['startTime']; 45 | } 46 | 47 | $this->user = $u; 48 | $this->password = $p; 49 | 50 | $user = new \login\Auth($this->user, $this->password); 51 | 52 | $tokenLol = $user->response['lol']; 53 | if(!isset($tokenLol['token'])){ 54 | throw new \Exception("Error to login in ".$u.": ".$tokenLol['error']."(".$tokenLol['status'].")"); 55 | } 56 | $this->tokenLol = $tokenLol['token']; 57 | 58 | $tokenRiot = $user->response['riot']; 59 | if(!isset($tokenRiot['token'])){ 60 | throw new \Exception("Error to login in ".$u.": ".$tokenRiot['error']."(".$tokenRiot['status'].")"); 61 | } 62 | $this->tokenRiot = $tokenRiot['token']; 63 | 64 | // USERINFO 65 | self::userInfo(); 66 | 67 | if($this->userInfo->banned){ 68 | $s = " | "; 69 | 70 | $r = "#breakcoder.org$s"; 71 | $r .= "$this->user $s"; 72 | if ($this->userInfo->banned) { 73 | $r .= "⚠️ BANNED [TYPE: {$this->userInfo->banInfo} > REASON: {$this->userInfo->banReason}"; 74 | if ($this->userInfo->banGame != "null" && $this->userInfo->banGame != "0") { 75 | $r .= " > GAME: {$this->userInfo->banGame}"; 76 | } 77 | $r .= " > EXP: {$this->userInfo->banEnd}"; 78 | $r .= " > BANS: {$this->userInfo->totalBans}]"; 79 | } 80 | 81 | throw new \Exception($r); 82 | } 83 | 84 | // ACCOUNT API 85 | $this->account = new \accountAPI\AccountApi($this->tokenRiot); 86 | if($GLOBALS['debugMode']){ 87 | echo PHP_EOL.'new AccountApi: '.time() - $GLOBALS['startTime']; 88 | } 89 | 90 | // CHANGE RIOT ID 91 | /*$changeStatus = $this->account->submitRiotId("name", "tag"); 92 | if($GLOBALS['debugMode']){ 93 | echo PHP_EOL."submitRiotId: $changeStatus: ".time() - $GLOBALS['startTime']; 94 | }*/ 95 | 96 | // STORE -> DEPRECATED, USING LOOT TO GET RP & BE, USERINFO FOR LEVEL 97 | /*$this->store = new \store\Store($this->tokenLol, $this->userInfo->ledge_region); // NOT USING $this->userInfo->store_region ANYMORE 98 | if($GLOBALS['debugMode']){ 99 | echo PHP_EOL.'new Store: '.time() - $GLOBALS['startTime']; 100 | } 101 | 102 | // STORE LEDGE 103 | $this->storeLedge = new \storeLedge\StoreLedge($this->tokenLol, $this->userInfo->accId, $this->userInfo->ledge_region); 104 | if($GLOBALS['debugMode']){ 105 | echo PHP_EOL.'new StoreLedge: '.time() - $GLOBALS['startTime']; 106 | }*/ 107 | 108 | // EMAIL 109 | $this->email = new \email\Email($this->tokenRiot); 110 | if($GLOBALS['debugMode']){ 111 | echo PHP_EOL.'new Email: '.time() - $GLOBALS['startTime']; 112 | } 113 | 114 | // LEDGE 115 | $ledge = new \ledge\Ledge($this->tokenLol, $this->userInfo->userInfoJwt, $this->userInfo->usw_region, $this->userInfo->ledge_region, $this->userInfo->region, $this->userInfo->puuid); 116 | if($GLOBALS['debugMode']){ 117 | echo PHP_EOL.'new Ledge: '.time() - $GLOBALS['startTime']; 118 | } 119 | 120 | $ledge->getSession($this->userInfo->banned); 121 | if($GLOBALS['debugMode']){ 122 | echo PHP_EOL.'$ledge->getSession(): '.time() - $GLOBALS['startTime']; 123 | } 124 | 125 | $ledge->getToken(); 126 | if($GLOBALS['debugMode']){ 127 | echo PHP_EOL.'$ledge->getToken(): '.time() - $GLOBALS['startTime']; 128 | } 129 | 130 | $this->tokenLedge = $ledge->tokenLedge; 131 | 132 | // LEDGE API 133 | if($GLOBALS['debugMode']){ 134 | echo PHP_EOL.'starting LedgeApi: '.time() - $GLOBALS['startTime']; 135 | } 136 | $ledgeApi = new \ledgeApi\LedgeApi($this->tokenLedge, $ledge->ledgePrefix, $ledge->region, $this->userInfo->nick, $this->userInfo->puuid, $this->userInfo->loot_region, $this->userInfo->sumId, $this->userInfo->accId); 137 | 138 | $this->history = $ledgeApi->history; 139 | $this->penalty = $ledgeApi->penalty; 140 | $this->rankedData = $ledgeApi->rankedData; 141 | $this->inventory = $ledgeApi->inventory; 142 | $this->loot = $ledgeApi->loot; 143 | 144 | if($GLOBALS['debugMode']){ 145 | echo PHP_EOL; 146 | } 147 | } 148 | 149 | public function returnAccount($mode = "text"){ 150 | 151 | if($mode == "text"){ 152 | // SEPARATOR 153 | $s = " | "; 154 | 155 | // CHECKER RETURN START 156 | $r = "#breakcoder.org$s"; 157 | 158 | if ($this->userInfo->banned) { 159 | $r .= "⚠️ BANNED [TYPE: {$this->userInfo->banInfo} > REASON: {$this->userInfo->banReason}"; 160 | if ($this->userInfo->banGame != "null" && $this->userInfo->banGame != "0") { 161 | $r .= " > GAME: {$this->userInfo->banGame}"; 162 | } 163 | $r .= " > EXP: {$this->userInfo->banEnd}"; 164 | $r .= " > BANS: {$this->userInfo->totalBans}]$s"; 165 | } 166 | 167 | // user:password 168 | $r .= "🔐 {$this->user}$s"; 169 | 170 | // nick 171 | $r .= "👴 OLD NICK: {$this->userInfo->nick}$s"; 172 | 173 | // riot id 174 | $r .= "🆔 RIOT ID: {$this->userInfo->riotId} "; 175 | $r .= $this->account->riotIdChange['canChange'] ? "(CAN CHANGE)$s" : "({$this->account->riotIdChange['changeDate']})$s"; 176 | 177 | // email 178 | $r .= "📧 E-MAIL: {$this->email->emailData['email']}$s"; 179 | 180 | // level 181 | $r .= "📖 LEVEL: {$this->userInfo->level}$s"; 182 | 183 | // penalty 184 | $r .= $this->penalty['hasPenalty'] == "false" ? "🕕 LEAVEBUSTER: {$this->penalty['hasPenalty']}$s" : "🕕 LEAVEBUSTER: {$this->penalty['hasPenalty']} [{$this->penalty['gamesRemaining']} LEFT]$s"; 185 | 186 | // create time 187 | $r .= "👶 CREATE TIME: {$this->userInfo->createTime}$s"; 188 | 189 | if ($this->userInfo->level >= 30) { 190 | // soloq 191 | $r .= "🥇 SOLOQ: {$this->rankedData['soloq']['tier']} [{$this->rankedData['soloq']['winrate']}] > LAST SEASON: {$this->rankedData['soloq']['lastSeason']}$s"; 192 | 193 | // flex 194 | $r .= "🥇 FLEX: {$this->rankedData['flex']['tier']} [{$this->rankedData['flex']['winrate']}] > LAST SEASON: {$this->rankedData['flex']['lastSeason']}$s"; 195 | } 196 | 197 | // iactivity 198 | $r .= "💤 LAST GAME: {$this->history['lastGameDate']} ({$this->history['inactiveTime']})$s"; 199 | 200 | // skin count 201 | $sCount = $this->inventory['skinsCount']; 202 | $r .= $sCount > 1 ? "👚 SKINS: {$sCount}$s" : "👚 SKIN: {$sCount}$s"; 203 | 204 | // champions 205 | $cCount = $this->inventory['championsCount']; 206 | $r .= $sCount > 1 ? "⚔ CHAMPIONS: {$cCount}$s" : "⚔ CHAMPION: {$cCount}$s"; 207 | 208 | // be 209 | $r .= "💰 BE: {$this->loot['be']}$s"; 210 | 211 | // rp 212 | $r .= "💰💰💰 RP: {$this->loot['rp']}$s"; 213 | 214 | // gem 215 | $r .= $this->loot['gem'] > 1 ? "💎 GEMS: {$this->loot['gem']}$s" : "💎 GEM: {$this->loot['gem']}$s"; 216 | 217 | // chest 218 | $r .= $this->loot['chest'] > 1 ? "🎁 CHESTS: {$this->loot['chest']}$s": "🎁 CHEST: {$this->loot['chest']}$s"; 219 | 220 | // key 221 | $r .= $this->loot['key'] > 1 ? "🗝 KEYS: {$this->loot['key']}$s" : "🗝 KEY: {$this->loot['key']}$s"; 222 | 223 | // first champions 224 | $r .= "⚔ FIRST CHAMPS: "; 225 | 226 | for($i = 0; $i < count($this->inventory['champions']); $i++){ 227 | $r .= "{$this->inventory['champions'][$i]['name']} ({$this->inventory['champions'][$i]['purchaseDate']})"; 228 | if($i != count($this->inventory['champions']) - 1){ 229 | $r .= " > "; 230 | } 231 | } 232 | $r .= $s; 233 | 234 | // first skins 235 | $r .= "👚 FIRST SKINS: "; 236 | 237 | for($i = 0; $i < count($this->inventory['skins']); $i++){ 238 | $r .= "{$this->inventory['skins'][$i]['name']} ({$this->inventory['skins'][$i]['purchaseDate']})"; 239 | if($i != count($this->inventory['skins']) - 1){ 240 | $r .= " > "; 241 | } 242 | } 243 | 244 | //$r .= " | JWT ( {$this->userInfo->userInfoJwt} )"; 245 | echo $r; 246 | }elseif($mode == "json"){ 247 | 248 | }else{ 249 | throw new \Exception("Error Invalid mode ($mode) called in returnAccount(mode)"); 250 | } 251 | 252 | 253 | 254 | } 255 | 256 | } 257 | 258 | 259 | 260 | 261 | ?> -------------------------------------------------------------------------------- /api/ledgeapi.php: -------------------------------------------------------------------------------- 1 | token = $token; 28 | $this->header = array( 29 | "Content-Type: application/json", 30 | "Accept: application/json", 31 | "User-Agent: LeagueOfLegendsClient/12.2.418.8114 (rcp-be-lol-login)", 32 | "authorization: Bearer ".$this->token 33 | ); 34 | 35 | $this->region = $region; 36 | $this->apiBaseUrl = "https://".$ledgePrefix.".lol.sgp.pvp.net"; 37 | $this->nick = str_replace(" ", "", $nick); 38 | $this->puuid = $puuid; 39 | $this->lootRegion = $lootRegion; 40 | $this->sumId = $sumId; 41 | $this->accId = $accId; 42 | 43 | $this->curl_options = array( 44 | CURLOPT_HTTPHEADER => $this->header, 45 | CURLOPT_RETURNTRANSFER => 1, 46 | CURLOPT_SSL_VERIFYPEER => 0, 47 | CURLOPT_SSL_VERIFYHOST => 0 48 | ); 49 | 50 | self::getAllData(); 51 | } 52 | 53 | private function getAllData(){ 54 | $ch = array(); 55 | $mh = curl_multi_init(); 56 | 57 | $api_array = array( 58 | "history" => "/summoner-ledge/v1/regions/".$this->region."/summoners/name/".$this->nick, 59 | "penalty" => "/leaverbuster-ledge/getEntry", 60 | "ranked" => "/leagues-ledge/v2/signedRankedStats", 61 | "inventory" => "/lolinventoryservice-ledge/v1/inventoriesWithLoyalty?puuid=".$this->puuid."&inventoryTypes=CHAMPION_SKIN&inventoryTypes=CHAMPION", 62 | "loot" => "/loot/v2/player/{$this->puuid}/loot/definitions?lastLootItemUpdate=".(time() * 1000)."&lastRecipeUpdate=".(time() * 1000)."&lastQueryUpdate=".(time() * 1000) 63 | ); 64 | 65 | for($i = 0; $i < count($api_array); $i++){ 66 | $ch[$i] = self::ledgeBase(array_values($api_array)[$i]); 67 | curl_setopt_array($ch[$i], $this->curl_options); 68 | 69 | curl_multi_add_handle($mh, $ch[$i]); 70 | } 71 | 72 | do{ 73 | curl_multi_exec($mh, $active); 74 | } while ($active); 75 | 76 | for($i = 0; $i < count($api_array); $i++){ 77 | curl_multi_remove_handle($mh, $ch[$i]); 78 | 79 | $result = json_decode(curl_multi_getcontent($ch[$i]), 1); 80 | switch($i){ 81 | case 0: 82 | $this->history = self::getHistory($result); 83 | break; 84 | case 1: 85 | $this->penalty = self::getPenalty($result); 86 | break; 87 | case 2: 88 | $this->rankedData = self::getRankedData($result); 89 | break; 90 | case 3: 91 | $this->inventory = self::getInventory($result); 92 | break; 93 | case 4: 94 | $this->loot = self::getLoot($result); 95 | break; 96 | 97 | } 98 | } 99 | 100 | curl_multi_close($mh); 101 | 102 | } 103 | 104 | private function ledgeBase($endpoint){ 105 | return curl_init($this->apiBaseUrl.$endpoint); 106 | } 107 | 108 | private function getHistory($result){ 109 | 110 | //var_dump($result); 111 | if($this->nick == "WITHOUT_NICK"){ 112 | $this->history = array( 113 | "inactiveTime" => "INACTIVE", 114 | "lastGameDate" => "INACTIVE" 115 | ); 116 | 117 | return $this->history; 118 | } 119 | 120 | $lastgamesec = intval($result['lastGameDate'] / 1000); 121 | $lastgamedate = date('d/m/Y', $lastgamesec); 122 | $inactiveTime = (int)((((time() - $lastgamesec) / 60) / 60) / 24); 123 | 124 | $inactiveTime <= 1 ? $inactiveTime .= " day" : $inactiveTime .= " days"; 125 | 126 | $this->history = array( 127 | "inactiveTime" => $inactiveTime, 128 | "lastGameDate" => $lastgamedate 129 | ); 130 | 131 | if($GLOBALS['debugMode']){ 132 | echo PHP_EOL.'getHistory(): '.time() - $GLOBALS['startTime']; 133 | } 134 | 135 | return $this->history; 136 | 137 | } 138 | 139 | private function getPenalty($result){ 140 | //echo $result; 141 | 142 | $this->penalty = array( 143 | "hasPenalty" => $result['leaverPenalty']['hasActivePenalty'] == 0 ? "false" : "true", 144 | "gamesRemaining" => $result['punishedGamesRemaining'] 145 | ); 146 | if($GLOBALS['debugMode']){ 147 | echo PHP_EOL.'getPenalty(): '.time() - $GLOBALS['startTime']; 148 | } 149 | 150 | return $this->penalty; 151 | 152 | } 153 | 154 | private function getRankedData($result){ 155 | $high_elo = array("MASTER", "GRANDMASTER", "CHALLENGER"); 156 | 157 | $soloq = $result['queues'][0]; 158 | $flex = $result['queues'][1]; 159 | 160 | // SOLOQ 161 | if(isset($soloq['tier']) && $soloq['tier'] != 'UNRANKED'){ 162 | $tier_soloq = in_array($soloq['tier'], $high_elo) ? $soloq['tier'].' '.$soloq['leaguePoints'].' LP' : $soloq['tier'].' '.$soloq['rank']; 163 | 164 | $wr_soloq = (($soloq['wins']) / ($soloq['wins'] + $soloq['losses']) * 100).'%'; 165 | $wr_soloq = number_format((float)$wr_soloq, 2, '.', '')."%"; 166 | }else{ 167 | $tier_soloq = 'UNRANKED'; 168 | $wr_soloq = '0%'; 169 | } 170 | $last_tier_soloq = isset($soloq['previousSeasonEndTier']) ? $soloq['previousSeasonEndTier'].' '.$soloq['previousSeasonEndRank'] : "UNRANKED"; 171 | 172 | //FLEX 173 | if(isset($flex['tier']) && $flex['tier'] != 'UNRANKED'){ 174 | $tier_flex = in_array($flex['tier'], $high_elo) ? $flex['tier'].' '.$flex['leaguePoints'].' LP' : $flex['tier'].' '.$flex['rank']; 175 | 176 | $wr_flex = (($flex['wins']) / ($flex['wins'] + $flex['losses']) * 100).'%'; 177 | $wr_flex = number_format((float)$wr_flex, 2, '.', '')."%"; 178 | }else{ 179 | $tier_flex = 'UNRANKED'; 180 | $wr_flex = '0%'; 181 | } 182 | $last_tier_flex = isset($flex['previousSeasonEndTier']) ? $flex['previousSeasonEndTier'].' '.$flex['previousSeasonEndRank'] : "UNRANKED"; 183 | 184 | $this->rankedData = array( 185 | "soloq" => array( 186 | "tier" => $tier_soloq, 187 | "winrate" => $wr_soloq, 188 | "lastSeason" => $last_tier_soloq 189 | ), 190 | "flex" => array( 191 | "tier" => $tier_flex, 192 | "winrate" => $wr_flex, 193 | "lastSeason" => $last_tier_flex 194 | ) 195 | ); 196 | 197 | if($GLOBALS['debugMode']){ 198 | echo PHP_EOL.'getRankedData(): '.time() - $GLOBALS['startTime']; 199 | } 200 | 201 | return $this->rankedData; 202 | 203 | } 204 | 205 | private function getInventory($result){ 206 | 207 | $championArray = $result['data']['items']['CHAMPION']; 208 | $skinArray = $result['data']['items']['CHAMPION_SKIN']; 209 | 210 | $totalChampions = count($championArray) >= 1 ? count($championArray) : 0; 211 | $totalSkins = count($skinArray) >= 1 ? count($skinArray) : 0; 212 | 213 | $sortedChampionsByDate = \utils\Utils::array_sort($championArray, "purchaseDate"); 214 | $sortedSkinByDate = \utils\Utils::array_sort($skinArray, "purchaseDate"); 215 | 216 | $fiveChampions = array_slice($sortedChampionsByDate, 0, 5); 217 | $fiveSkins = array_slice($sortedSkinByDate, 0, 5); 218 | 219 | //\utils\Utils::updateJsonFile(); // TO UPDATE CHAMPIONS & SKIN DATA 220 | 221 | for($i = 0; $i < count($fiveChampions); $i++){ 222 | $fiveChampions[$i]['name'] = \utils\Utils::champNameByID($fiveChampions[$i]['itemId']); 223 | 224 | $newDate = \DateTime::createFromFormat('Ymd\THis.u\Z', $fiveChampions[$i]['purchaseDate']); 225 | $fiveChampions[$i]['purchaseDate'] = $newDate->format("d/m/Y"); 226 | } 227 | 228 | for($i = 0; $i < count($fiveSkins); $i++){ 229 | $fiveSkins[$i]['name'] = \utils\Utils::getSkinByID($fiveSkins[$i]['itemId']); 230 | 231 | $newDate = \DateTime::createFromFormat('Ymd\THis.u\Z', $fiveSkins[$i]['purchaseDate']); 232 | $fiveSkins[$i]['purchaseDate'] = $newDate->format("d/m/Y"); 233 | 234 | } 235 | 236 | $this->inventory = array( 237 | "championsCount" => $totalChampions, 238 | "skinsCount" => $totalSkins, 239 | "champions" => $fiveChampions, 240 | "skins" => $fiveSkins 241 | ); 242 | 243 | if($GLOBALS['debugMode']){ 244 | echo PHP_EOL.'getInventory(): '.time() - $GLOBALS['startTime']; 245 | } 246 | 247 | return $this->inventory; 248 | 249 | } 250 | 251 | private function getLoot($result){ 252 | 253 | $playerLoot = $result['playerLoot']; 254 | 255 | $types = array( 256 | 'CURRENCY_mythic' => 0, 257 | 'MATERIAL_key' => 0, 258 | 'MATERIAL_key_fragment' => 0, 259 | 'CHEST_champion_mastery' => 0, 260 | 'CHEST_generic' => 0, 261 | 'CURRENCY_RP' => 0, 262 | 'CURRENCY_champion' => 0 263 | ); 264 | 265 | for($i = 0; $i < count($playerLoot); $i++){ 266 | $l = $playerLoot[$i]; 267 | 268 | if(isset($types[$l['lootName']])){ 269 | $types[$l['lootName']] += $l['count']; 270 | } 271 | } 272 | 273 | $gem = $types['CURRENCY_mythic']; 274 | $key = $types['MATERIAL_key'] + intdiv($types['MATERIAL_key_fragment'], 3); 275 | $chest = $types['CHEST_champion_mastery'] + $types['CHEST_generic']; 276 | 277 | $rp = $types['CURRENCY_RP']; 278 | $be = $types['CURRENCY_champion']; 279 | 280 | $this->loot = array( 281 | "gem" => $gem, 282 | "key" => $key, 283 | "chest" => $chest, 284 | "rp" => $rp, 285 | "be" => $be 286 | ); 287 | 288 | if($GLOBALS['debugMode']){ 289 | echo PHP_EOL.'getLoot(): '.time() - $GLOBALS['startTime']; 290 | } 291 | 292 | return $this->loot; 293 | 294 | } 295 | 296 | } 297 | 298 | 299 | ?> -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 |
3 |