-
Notifications
You must be signed in to change notification settings - Fork 6
/
cubes.php
executable file
·103 lines (93 loc) · 2.36 KB
/
cubes.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
<?php
require 'datafetch.php';
$cubes = $player_inventory['POWER_CUBE'];
$total =0;
?>
<div class="row">
<table class="table table-condensed cols-md-4">
<tbody>
<?php
foreach ($cubes as $lvl => $count){
if($count> 0 OR $last['player_inventory']['POWER_CUBE'][$lvl] >0){
$diff = $count - $last['player_inventory']['POWER_CUBE'][$lvl];
if($diff >0) $diff ='+'.$diff;
$total += $count;
echo '
<tr class=" level_'.$lvl.'">
<td>Power Cube Level '.$lvl.'</td>
<td>'.$count.($diff != 0? ' <span class=""> ['.($diff).']</span>' :'').'</td>
</tr>';
}
}
echo '<tr > <td colspan="2"> <hr /></td>';
echo '
<tr>
<td>Total </td>
<td>'.$total.'</td>
</tr>';
?>
</tbody>
</table>
</div>
<div id="chart" class="chart"> </div>
<?php
$series_res_data = array();
$categories = '';
foreach ($history as $date => $h){
$categories .= '\''.date('M j, Y H:i', $date).'\', ';
foreach ($h['player_inventory']['POWER_CUBE'] as $level =>$count){
$series_res_data[$level][] = $count;
}
}
krsort($series_res_data);
$categories = rtrim($categories,', ');
?>
<script type="text/javascript">
$(function () {
$('#chart').highcharts({
chart: {
type: 'area'
},
title: {
text: 'Cubes History'
},
xAxis: {
categories: [ <?php echo $categories ?> ],
tickmarkPlacement: 'on',
title: {
enabled: false
}
},
yAxis: {
title: {
text: 'Power Cubes'
}
},
tooltip: {
shared: true,
valueSuffix: ''
},
plotOptions: {
area: {
stacking: 'normal',
lineWidth: 1,
marker: {
enabled: false,
lineWidth: 0,
lineColor: '#666666',
symbol: "circle"
}
}
},
series: [
<?php
foreach ($series_res_data as $level => $counts){
echo '{
name: "LVL '.$level.'",marker: {enabled: false} ,color: "'. getLevelColor($level).'", data: ['. implode(',', $counts).']
},';
}
?>
]
});
});
</script>