-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatusSC.php
More file actions
73 lines (66 loc) · 2.88 KB
/
statusSC.php
File metadata and controls
73 lines (66 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
header('Content-type: image/png;');
$name = $_GET['name'];
$jsonObj= json_decode(file_get_contents("http://gmt.star-conflict.com/pubapi/v1/userinfo.php?nickname={$name}"),true);
//array(3)
//{
//["result"]=>string()
//["code"]=>int()
//["data"]=>
//array(7)
//{
//["elo"]=>float()
//["karma"]=>int()
//["nickName"]=>string()
//["prestigeBonus"]=>float()
//["uid"]=>int()
//["pvp"]=>
//array(9)
//{
//["gamePlayed"]=>int()
//["gameWin"]=>int()
//["totalAssists"]=>int()
//["totalBattleTime"]=>int()
//["totalDeath"]=>int()
//["totalDmgDone"]=>float()
//["totalHealingDone"]=>float()
//["totalKill"]=>int()
//["totalVpDmgDone"]=>float()
//}
//["clan"]=>
//array(2)
//{
//["name"]=>string()
//["tag"]=>string()
//}
//}
//}
date_default_timezone_set("UTC");
$force = (int)($jsonObj['data']['prestigeBonus']*100);
$time = date("j.n.Y");
$winrate = round($jsonObj['data']['pvp']['gameWin']/($jsonObj['data']['pvp']['gamePlayed']-$jsonObj['data']['pvp']['gameWin']) ,2);
$killDR = round($jsonObj['data']['pvp']['totalKill']/$jsonObj['data']['pvp']['totalDeath'] ,2);
$assistDR = round($jsonObj['data']['pvp']['totalAssists']/$jsonObj['data']['pvp']['totalDeath'] ,2);
$killPG = round($jsonObj['data']['pvp']['totalKill']/$jsonObj['data']['pvp']['gamePlayed'] ,2);
$supportPG = round($jsonObj['data']['pvp']['totalAssists']/$jsonObj['data']['pvp']['gamePlayed'] ,2);
$deathPG = round($jsonObj['data']['pvp']['totalDeath']/$jsonObj['data']['pvp']['gamePlayed'] ,2);
$damagePG = round($jsonObj['data']['pvp']['totalDmgDone']/$jsonObj['data']['pvp']['gamePlayed']);
$healPG = round($jsonObj['data']['pvp']['totalHealingDone']/$jsonObj['data']['pvp']['gamePlayed']);
$status = "{$time} {$name}[{$jsonObj['data'][clan][tag]}]
в среднем: {$killPG} убийств, {$supportPG} помощи, {$deathPG} смертей
winrate {$winrate}, damage/game {$damagePG}, heal/game {$healPG}
kill/death {$killDR}, assists/death {$assistDR}";
$font = 'DejaVuSansMono.ttf';
$w = 400;
$h = 70;
$img = imagecreatetruecolor($w, $h);
$white = imagecolorallocatealpha($img, 255, 255, 255, 127);
$black = imagecolorallocatealpha($img, 0, 0, 0, 0);
imagefill($img, 0, 0, $white);
imagettftext ($img, 10, 0, 0, 12, $black, $font, $status);
imagealphablending($img, false);
imagesavealpha($img, true);
imagepng ($img);
imagedestroy($img);
//print $status;
?>