-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathhome.php
executable file
·156 lines (137 loc) · 3.96 KB
/
home.php
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?php
require 'datafetch.php';
if(isset($error) AND $error)
return;
$total = 0;
$api = new API();
foreach ($player_inventory as $type => $arr){
if($type =='EMITTER_A' || $type== 'EMP_BURSTER' || $type =='POWER_CUBE'){
foreach ($arr as $v)
$total += $v;
} else if (in_array($type, array('RES_SHIELD','FORCE_AMP','HEATSINK' ,'LINK_AMPLIFIER','MULTIHACK','TURRET'))){
foreach ($arr as $v)
$total += $v;
} else {
foreach ($arr as $v){
$total += $v['count'];
}
}
}
if (isset($player_inventory['FLIP_CARD']['total'])) {
$total += $player_inventory['FLIP_CARD']['total'];
}
$ap_img = strtolower($player_data['team']).'_'.((int)($player_data['apPercent']/10)).'.png';
?>
<div class="row">
<div class="col-sm-6 col-sm-offset-4">
<div id="ap_icon" style="background-image: url(img/<?php echo $ap_img; ?>);">
<div id="level" class="level_<?php echo $player_data['level']; ?>"><?php echo $player_data['level']; ?></div>
</div>
<h2 class="player_name <?php echo strtolower($player_data['team']); ?>"><?php echo $player_data['name']; ?></h2>
</div>
<hr class="col-sm-10 col-sm-offset-1" />
</div>
<div class="row">
<div class="col-sm-4 col-sm-offset-4 ">
<table class="table table-condensed">
<tbody>
<tr>
<td>Agent AP</td>
<td><?php echo number_format($player_data['ap']); ?> AP</td>
</tr>
<?php if ($player_data['level'] <8){ ?>
<tr>
<td>AP to next level</td>
<td><?php echo $player_data['diffAp']; ?></td>
</tr>
<?php } ?>
<tr>
<td>Agent XM</td>
<td><?php echo number_format($player_data['energy']).' / '.number_format($api->getXmForLevel($player_data['level'])); ?></td>
</tr>
<tr>
<td>Total items</td>
<td><?php echo $total; ?></td>
</tr>
<tr>
<td>Invites</td>
<td><?php echo $player_data['invites']; ?></td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="chart" class="chart"> </div>
<?php
$series_ap_data = array();
$categories = '';
foreach ($history as $date => $h){
$categories .= '\''.date('M j, Y H:i', $date).'\', ';
$series_ap_data[] = $h['player_data']['ap'];
}
$categories = rtrim($categories,', ');
?>
<script type="text/javascript">
$(function () {
$('#chart').highcharts({
chart: {
type: 'area',
style: {
fontFamily: 'Coda, sans-serif',
}
},
title: {
text: 'AP history'
},
xAxis: {
categories: [ <?php echo $categories ?> ],
tickmarkPlacement: 'on',
title: {
enabled: false
}
},
yAxis: {
title: {
text: 'AP'
},
plotBands: [ <?php
for ($level = 1; $level<=8; $level++){
echo '
{
from: '.($level>1? $api->getApForLevel($level) : '0').',
to:'.(($level+1)>8? '10000000' : $api->getApForLevel($level+1)).',
color: "'.getLevelColor($level).'",
label: {
text: "L'.$level.'",
style: {
color: "#afafaf"
}
}
}';
if ($level <8) echo ',';
}
?>
]
},
tooltip: {
shared: true,
valueSuffix: ''
},
plotOptions: {
area: {
stacking: 'normal',
lineColor: '<?php echo getFactionColor($player_data['team'])?>',
lineWidth: 1,
marker: {
enabled: false
}
}
},
series: [{
name: 'AP',
data: [<?php echo implode(', ', $series_ap_data); ?>],
color: '<?php echo getFactionColor($player_data['team'])?>'
}]
});
});
</script>