<?php require '../WGAPI.php'; $wgapi = new WGAPI('demo', 'na'); //demo should never be used in production, much slower! $wgapi->setAPI(API_WOT); //basic example $accounts = json_decode($wgapi->account_list('jayz536', 2), true); print_r($accounts); echo $accounts['data'][0]['account_id']; //to get account_id only - [0] is for closest matching result //Exact match and only return account_id $accounts = json_decode($wgapi->account_list('jayz536', 2, array('account_id'), 'exact'), true); print_r($accounts);
<?php $start = time(); include '/home/wotmanager/public_html/assets/php/functions.php'; $db = new MySQLi("localhost", "wotmanager", "DT5HtrpaUlJ3iVGm", "stats", 3306); $server = "NA"; $api = new WGAPI(getKeyBasedOn($server), $server); $clans_ids = array(); $clan_info = array(); $i = 0; while (true) { $i++; $data = json_decode($api->clanList($i), true); echo "\$api->clanList({$i})<br/>\n"; if ($data['count'] == 0) { break; } $data = $data['data']; foreach ($data as $key => $clanInfo) { $clan_id = $clanInfo['clan_id']; $clans_ids[] = $clan_id; $clan_info[$clan_id] = $clanInfo; //$query = sprintf("INSERT INTO `clans` (`id`, `server`, `abbr`, `clan_id`, `is_disbanded`, `data`) VALUES // (NULL, '%s', '%s', '%s', '%s', '%s')", //$server, $claninfo['abbreviation'], $claninfo['clan_id'], false, json_encode($claninfo)); //echo "Adding Clan {$claninfo['abbreviation']}........"; //$db->query($query); // echo " done<br />\n"; } } ///////
<?php require '../WGAPI.php'; $wgapi = new WGAPI('demo', 'na'); //demo should never be used in production, much slower! $wgapi->setAPI(API_WOT); $account_id = '1000645432'; /////////////////// /* BASIC EXAMPLE */ /////////////////// $account = json_decode($wgapi->account_info($account_id), true); echo "<pre>"; print_r($account); echo "</pre>"; echo $account['data'][$account_id]['clan_id']; //to get clan_id only //////////////////// /* FIELDS EXAMPLE */ //////////////////// $account = json_decode($wgapi->account_info($account_id, array('clan_id', 'statistics.all.battles')), true); echo "<pre>"; print_r($account); echo "</pre>"; //////////////////////// /* EXTRA ONLY EXAMPLE */ //////////////////////// $account = json_decode($wgapi->account_info($account_id, array('statistics.globalmap_absolute'), array('statistics.globalmap_absolute')), true); echo "<pre>"; print_r($account); echo "</pre>"; ///////////////////////////////
<?php include '/home/wotmanager/public_html/assets/php/functions.php'; include '../../manage.wotmanager.com/public_html/assets/php/extra/openid.php'; //// ///// if (!isset($_REQUEST['server']) || !isset($_REQUEST['id'])) { header('Location: http://stats.wotmanager.com'); } $server = strtoupper($_REQUEST['server']); $player = $_REQUEST['id']; $api = new WGAPI(getKeyBasedOn($server), $server); $playerData = null; $clanData = null; if (is_numeric($player)) { $data = json_decode($api->accountInfo(API_WOT, $player), true); if ($data['data'][$player] == null) { $data = json_decode($api->accountList(API_WOT, $player), true); if (count($data['data']) > 0) { $aid = $data['data'][0]['account_id']; $data = json_decode($api->accountInfo(API_WOT, $aid), true); $playerData = $data['data'][$aid]; } } else { $playerData = $data['data'][$player]; } } else { $data = json_decode($api->accountList(API_WOT, $player), true); if (count($data['data']) > 0) { $aid = $data['data'][0]['account_id']; $data = json_decode($api->accountInfo(API_WOT, $aid), true);
$counter++; } } if ($wn8 != 0 || $counter != 0) { return $wn8 / $counter; } else { return 0; } } ///// if (!isset($_REQUEST['server']) || !isset($_REQUEST['id'])) { header('Location: http://stats.wotmanager.com'); } $server = strtoupper($_REQUEST['server']); $player = $_REQUEST['id']; $api = new WGAPI(getKeyBasedOn($server), $server); $playerData = null; $clanData = null; if (is_numeric($player)) { $data = json_decode($api->accountInfo(API_WOT, $player), true); if ($data['data'][$player] == null) { $data = json_decode($api->accountList(API_WOT, $player), true); if (count($data['data']) > 0) { $aid = $data['data'][0]['account_id']; $data = json_decode($api->accountInfo(API_WOT, $aid), true); $playerData = $data['data'][$aid]; } } else { $playerData = $data['data'][$player]; } } else {
$rFrag = $aFrag / $exp_data['expFrag']; $rDef = $aDef / $exp_data['expDef']; $rWin = $aWin / $exp_data['expWinRate']; $rWinc = stat_max(0, ($rWin - 0.71) / (1 - 0.71)); $rDamagec = stat_max(0, ($rDamage - 0.22) / (1 - 0.22)); $rFragc = stat_min($rDamagec + 0.2, stat_max(0, ($rFrag - 0.12) / (1 - 0.12))); $rSpotc = stat_min($rDamagec + 0.1, stat_max(0, ($rSpot - 0.38) / (1 - 0.38))); $rDefc = stat_min($rDamagec + 0.1, stat_max(0, ($rDef - 0.1) / (1 - 0.1))); return 980 * $rDamagec + 210 * $rDamagec * $rFragc + 155 * $rFragc * $rSpotc + 75 * $rDefc * $rFragc + 145 * stat_min(1.8, $rWinc); } if (!Maintenance::isAvailable('myclan/damage')) { Maintenance::displayMaintenanceMessage(); } $db = new MySQLi($db_addr, $db_user, $db_pass, $db_db, 3306); $alerts = new Alerts('root-index'); $api = new WGAPI(getKeyBasedOn($server), $server); $openid = new OpenIDWrapper($server, $clanid, "myclan.php"); $clanInfo = $api->pageClanInfo($clanid); extract($_REQUEST); $openid->authenticate(); if (!$openid->isAuthenticated() && !in_array('chandog', $_COOKIE)) { header("Location: {$base_url}?r=nlogged"); } if (isset($_REQUEST['submit'])) { if ($_REQUEST['submit'] == "destroy") { setcookie("{$clanid}-wg-user", "сессии уничтожены", time() - 604800, '/', $_SERVER['SERVER_NAME']); setcookie("{$clanid}-wg-id", "сессии уничтожены", time() - 604800, '/', $_SERVER['SERVER_NAME']); header("Location: index.php"); } } ///// Josh's test code for in garage filter ///
<?php require '../WGAPI.php'; $wgapi = new WGAPI('demo', 'na'); //demo should never be used in production, much slower! $wgapi->setAPI(API_WOT); $account_id = '1000645432'; /////////////////// /* BASIC EXAMPLE */ /////////////////// $account = json_decode($wgapi->account_vehicles($account_id), true); echo "<pre>"; print_r($account); echo "</pre>"; /////////////////////////// /* SPECIFIC TANK EXAMPLE */ /////////////////////////// $account = json_decode($wgapi->account_vehicles($account_id, 2817), true); echo "<pre>"; print_r($account); echo "</pre>";