Skip to content

Commit

Permalink
First push
Browse files Browse the repository at this point in the history
Let’s go!
  • Loading branch information
AL-dot-debug committed Aug 26, 2016
0 parents commit 5da9bc7
Show file tree
Hide file tree
Showing 252 changed files with 7,155 additions and 0 deletions.
29 changes: 29 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* @file
* A single location to store configuration.
*/



# EDIT ME PLEASE

define('SYS_DB_NAME' ,''); // mysql db name
define('SYS_DB_USER' ,''); // mysql username
define('SYS_DB_PSWD' ,''); // mysql password
define('SYS_DB_HOST' ,''); // mysql server name
define('SYS_DB_PORT' ,3306); // mysql server port
define('TIME_DELAY' ,'+ 2 HOURS'); // Time diff between u and GMT Time (eg: Brussels is + 2 HOURS from GMT)


# Please, do not touch me, I'm fine ;)

define('SYS_PATH' ,realpath(dirname(__FILE__))); // full path
define('SYS_USESS_VAR' ,'usrSessVal'); // user session variable name
define('SYS_DEVELOPMENT_MODE' , false); // debug mode
define('HOST_URL' , $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST']); // Host



?>
90 changes: 90 additions & 0 deletions core/cron/pokemon.rarety.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?


// This file is loaded once every 24h by data the loader.
// ------------------------------------------------------


$pokemons = json_decode($pokemon_file);

$req = "SELECT pokemon_id, COUNT(1) as total FROM pokemon GROUP BY pokemon_id ORDER BY pokemon_id ASC";
$result = $mysqli->query($req);

$total_pokemons = 0;

while($data = $result->fetch_object()){

$pokemon_id = $data->pokemon_id;
$total_pokemons = $total_pokemons + $data->total;

$pokelist[$pokemon_id]['id'] = $pokemon_id;
$pokelist[$pokemon_id]['total'] = $data->total;



}


foreach($pokelist as $pokemon){

$key = $pokemon['id'];

$pourcent = ($pokemon['total']*100) / $total_pokemons;
$arrondis = round($pourcent , 4);
$pokelist[$key]['rate'] = $arrondis;


// + 1 = Very common
// + 0.25 = Common
// + 0.05 = Rare
// + 0.0001 = Mythic
// Unseen

if($arrondis >= 1){

$pokelist[$key]['status'] = 'Very common';

}elseif($arrondis >= 0.25){

$pokelist[$key]['status'] = 'Common';

}elseif($arrondis >= 0.05){

$pokelist[$key]['status'] = 'Rare';

}elseif($arrondis >= 0.0001){

$pokelist[$key]['status'] = 'Mythic';

}else{

$pokelist[$key]['status'] = 'Unseen';

}

}


foreach($pokemons as $pokemon_id => $pokemon_data){

if(isset($pokelist[$pokemon_id])){

$pokemon_data->rarity = $pokelist[$pokemon_id]['status'];
$pokemon_data->spawn_rate = $pokelist[$pokemon_id]['rate'];

}
else{
$pokemon_data->rarity = 'Unseen';
$pokemon_data->spawn_rate = 0.0000;

}


}

$file_content = json_encode($pokemons);

file_put_contents(SYS_PATH.'/core/json/pokelist_'.$lang.'.json', $file_content);


?>
6 changes: 6 additions & 0 deletions core/css/bootstrap.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/css/bootstrap.min.css.map

Large diffs are not rendered by default.

Loading

0 comments on commit 5da9bc7

Please sign in to comment.