forked from AtlasAR/A-Mining-Game
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgamestats.php
47 lines (39 loc) · 1.82 KB
/
gamestats.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
<?php
include('includes/config.php');
include('structure/database.php');
$db = new database($db_host, $db_name, $db_user, $db_password);
$players = $db->processQuery("SELECT `save`, `username` FROM `users`", array(), true);
$money = 0;
$curMoney = 0;
$bc = 0;
$scientists = 0;
$bossesDefeated = 0;
$OPMResearch = 0;
$mpt = 0;
$exp = 0;
$hLVL = array('username' => '', 'lvl' => 0);
foreach($players as $player){
$data = json_decode($player['save'], true);
$money += $data['totalMoneyEarned'];
$curMoney += $data['money'];
$bc += $data['bossCurrency'];
$scientists += $data['scientists']+$data['scientistsBC'];
$bossesDefeated += $data['bossesDefeated'];
$OPMResearch += $data['workerOPMResearch'];
$mpt += $data['moneyPerTick'];
$exp += $data['exp'];
$level = floor((sqrt(625+100*$data['exp'])-25)/50);
if($level > $hLVL['lvl']){
$hLVL['lvl'] = $level;
$hLVL['username'] = $player['username'];
}
}
?>
Players have earned a total amount of $<?=number_format($money)?> altogether.<br/>
There is currently $<?=number_format($curMoney)?> in the game.<br/>
There is currently <?=number_format($bc)?> BC in the game.<br/>
If all players were combined, we would have a money per tick of $<?=number_format($mpt)?><Br/>
Players have defeated a total of <?=number_format($bossesDefeated)?> random bosses.<br/>
Altogether players have purchased <?= number_format($scientists)?> scientists and researched the WorkerOPM research <?=number_format($OPMResearch)?> times.<br/>
Altogether players have earned a total of <?=number_format($exp)?> XP.<br/>
Currently, the highest character level is <?=number_format($hLVL['lvl'])?> (<?=$hLVL['username']?>).