Jump to content

php WorldofTrucks


Ewwe

Recommended Posts

  • Administrátor

Zdravím, již před nějakou dobou jsem psal tuto třídu protože jsem chtěl dále pracovat se statistikami z webu https://worldoftrucks.com

 

Včera jsem dopsal další verzi a troufám si říci, že je na mnohem lepší úrovni než ta předchozí

 

Třída má dvojí použití

 

1. Fetch statistik pro konkrétního hráče.

$wot = new WorldOfTrucks(96022);
$wot->fetchData();
$stat = $wot->getData("GLOBAL");
//or
$stat = $wot->getData("ATS");
//or
$stat = $wot->getData("ETS");

kde proměnná $stat obsahuje pole 

array (size=5)
  'TOTAL_JOBS' => int 98
  'TOTAL_MASS' => string '1393 t' (length=6)
  'TOTAL_DISTANCE' => string '62038 t' (length=7)
  'AVERAGE_DISTANCE' => string '633 km' (length=6)
  'TOTAL_TIME' => string '46 h 42 min' (length=11)

dále je možné zavolat 

$wot->userName

ve kterém je uložené jméno hráče

 

2. Porovnávání n hráčů

$data = WorldOfTrucks::compare(96022,7825,386356,"GLOBAL");
//or
$data = WorldOfTrucks::compare(96022,7825,386356,"ATS");
//or
$data = WorldOfTrucks::compare(96022,7825,386356,"ETS"); 

kde n argumentů jsou uid hráčů/uživatelů na webu a posledním argumentem musí být z jaké hry se mají data porovnávat a proměnná $data obsahuje

array (size=6)
  0 => 
    array (size=4)
      0 => string 'Staty' (length=5)
      1 => string 'Ewwe' (length=4)
      2 => string 'SilverMind' (length=10)
      3 => string 'Baumfalke73' (length=11)
  1 => 
    array (size=4)
      0 => string 'TOTAL_JOBS' (length=10)
      1 => int 98
      2 => int 27
      3 => int 57
  2 => 
    array (size=4)
      0 => string 'TOTAL_MASS' (length=10)
      1 => string '1393 t' (length=6)
      2 => string '359 t' (length=5)
      3 => string '800 t' (length=5)
  3 => 
    array (size=4)
      0 => string 'TOTAL_DISTANCE' (length=14)
      1 => string '62038 t' (length=7)
      2 => string '14256 t' (length=7)
      3 => string '26640 t' (length=7)
  4 => 
    array (size=4)
      0 => string 'AVERAGE_DISTANCE' (length=16)
      1 => string '633 km' (length=6)
      2 => string '528 km' (length=6)
      3 => string '467 km' (length=6)
  5 => 
    array (size=4)
      0 => string 'TOTAL_TIME' (length=10)
      1 => string '46 h 42 min' (length=11)
      2 => string '14 h 35 min' (length=11)
      3 => string '22 h 7 min' (length=10)

CODE https://github.com/Ewwe/WorldOfTrucks

  • Líbí se mi to! (+1) 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...