ОСТОРОЖНО МАГИЯ МАГИ МАГИЯ stat_table_data stat_data SpacesStat coinsS

 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
// ОСТОРОЖНО, МАГИЯ МАГИ МАГИЯ
$stat_table_data = $stat_data = SpacesStat::coinsSpent($stat_output);
if ($stat_output == 'months' || $stat_output == 'months_p') {
foreach ($stat_data as $i => &$res) {
foreach (SpacesCoins::$prices as $k => $v) {
$legacy_cnt = 0;
if (isset(SpacesCoins::$legacy_prices[$k])) {
$total_cnt = $res[$k];
$last_nid = $res['min_nid'];
echo $res['dt']." | ".$res['min_nid']." | ".$res['max_nid'];
$res[$k] = 0;
foreach (SpacesCoins::$legacy_prices[$k] as $nid => $p) {
echo " | [$last_nid >= $nid] = ".(int)($last_nid >= $nid)."";
if ($last_nid <= $nid) {
echo " | <b style='color: red'>1 ($nid $last_nid)</b>";
if ($res['max_nid'] <= $nid) {
$legacy_cnt = $total_cnt;
$res[$k] = $legacy_cnt * $p;
echo " | <b style='color: blue'>1</b>";
break;
} else {
$cnt = SpacesStat::coinsSpentGetLegacyCount($k, $last_nid, $nid);
echo " | <b style='color: orange'>$cnt * $p</b>";
$last_nid = $nid;
$res[$k] += $cnt * $p;
$legacy_cnt += $cnt;
echo " | <b style='color: blue'>0!!!!!!!!!</b>";
}
} else
echo " | 0";
}
if ($legacy_cnt) {
echo " | $total_cnt - $legacy_cnt | ".$res[$k]." | ".(($total_cnt - $legacy_cnt) * SpacesCoins::$prices[$k]);
$res[$k] += ($total_cnt - $legacy_cnt) * SpacesCoins::$prices[$k];
}
echo "<br />";
}
if (!$legacy_cnt)
$res[$k] *= SpacesCoins::$prices[$k];
$stat_table_data[$i][$k] = $res[$k].' ('.$stat_table_data[$i][$k].')';
}
foreach (SpacesCoins::$calc_sum as $k => &$fields) {
$stat_table_data[$i][$k] = $res[$k] = 0;
foreach ($fields as $key)
$stat_table_data[$i][$k] = ($res[$k] += $res[$key]);
}
}
} else {
foreach ($stat_data as $i => &$res) {
foreach (SpacesCoins::$prices as $k => $v) {
$price = SpacesCoins::$prices[$k];
if (isset(SpacesCoins::$legacy_prices[$k])) {
foreach (SpacesCoins::$legacy_prices[$k] as $nid => $p) {
if ($res['nid'] <= $nid)
$price = $p;
}
}
$res[$k] *= $price;
$stat_table_data[$i][$k] = $res[$k].' ('.$stat_table_data[$i][$k].')';
}
foreach (SpacesCoins::$calc_sum as $k => &$fields) {
$stat_table_data[$i][$k] = $res[$k] = 0;
foreach ($fields as $key)
$stat_table_data[$i][$k] = ($res[$k] += $res[$key]);
}
}
}
$stat_table_data = array_reverse($stat_table_data);