-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmods.php
executable file
·152 lines (125 loc) · 3.6 KB
/
mods.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
<?php
require 'datafetch.php';
$mods = array('RES_SHIELD','MULTIHACK','HEATSINK','FORCE_AMP','TURRET' ,'LINK_AMPLIFIER');
$shields = $player_inventory['RES_SHIELD'];
$mod_names = array('RES_SHIELD' => 'Portal Shield'
,'FORCE_AMP' =>'Force Amp'
,'HEATSINK' => 'Heat Sink'
,'LINK_AMPLIFIER' => 'Link Amp'
,'MULTIHACK' => 'Multi-hack'
,'TURRET'=> 'Turret');
$total =0;
?>
<div class="row">
<?php
foreach ($mods as $mod){
echo '<div class="col-xs-6 col-sm-3 col-md-2 col-lg-2 ">
<div class="thumbnail">
<img src="img/'.$mod.'_EXTRARE.png" width="100px" />
<div class="caption">
<h4> '.$mod_names[$mod].'</h4>
';
$has = false;
foreach ($player_inventory[$mod] as $rarity => $count){
if(!isset( $last['player_inventory'][$mod][$rarity])) $last['player_inventory'][$mod][$rarity] =0;
if($count> 0 OR (isset( $last['player_inventory'][$mod][$rarity]) AND $last['player_inventory'][$mod][$rarity] >0)){
$has = true;
if(isset( $last['player_inventory'][$mod][$rarity]))
$diff = $count - $last['player_inventory'][$mod][$rarity];
else
$diff = 0;
if($diff >0 ) $diff ='+'.$diff;
$total += $count;
echo '
<p class="clearfix '.strtolower($rarity).'">
<span class="pull-left">'.strtolower(str_replace("_", " ", $rarity)).'</span>
<span class="pull-right">'.$count.($diff != 0? ' <span class=""> ['.($diff).'] </span>' :'').'</span>
</p>';
} else {
echo '<p class="clearfix "> </p>';
}
}
if(!$has) echo '
<p class="clearfix "> </p><p class=""> none </p>
<p class="clearfix "> </p>';
echo '</div>
</div>
</div>';
}
//echo '<hr />';
//echo '
// <div class="info_row">
// <div>Total </div>
// <div>'.$total.'</div>
// </div>';
?>
</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 ($mods as $mod){
if(!isset($h['player_inventory'][$mod])){
$h['player_inventory'][$mod]['COMMON'] = 0;
$h['player_inventory'][$mod]['RARE'] = 0;
$h['player_inventory'][$mod]['VERY_RARE'] = 0;
}
foreach ($h['player_inventory'][$mod] as $level =>$count){
@$series_res_data[$level][ $date] += $count;
}
}
}
//krsort($series_res_data);
$categories = rtrim($categories,', ');
?>
<script type="text/javascript">
$(function () {
$('#chart').highcharts({
chart: {
type: 'area'
},
title: {
text: 'Mods History'
},
xAxis: {
categories: [ <?php echo $categories ?> ],
tickmarkPlacement: 'on',
title: {
enabled: false
}
},
yAxis: {
title: {
text: 'Mods'
}
},
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: "'.$level.'",marker: {enabled: false} ,color: "'. getRarityColor($level) .'", data: ['. implode(',', $counts).']
},';
}
?>
]
});
});
</script>