avg and bugfix
This commit is contained in:
@ -9,12 +9,16 @@ if(!empty($progress)) {
|
||||
preg_match_all("/(?<task>.*): (?<act>.*) \/ (?<max>.*)/m", $progress, $tmp);
|
||||
|
||||
for($i = 0; $i < count($tmp[0]); $i++) {
|
||||
if(preg_match('/XP\:/', $tmp['task'][$i]))
|
||||
continue;
|
||||
|
||||
$list[$i] = (object)[
|
||||
'task' => trim($tmp['task'][$i]),
|
||||
'act' => (int)str_replace('.', '', $tmp['act'][$i]),
|
||||
'max' => (int)str_replace('.', '', $tmp['max'][$i])
|
||||
];
|
||||
$list[$i]->percent = round($list[$i]->act / $list[$i]->max * 100, 2);
|
||||
$list[$i]->left = $list[$i]->max - $list[$i]->act;
|
||||
}
|
||||
|
||||
usort($list, function($a, $b) { return $b->percent <=> $a->percent; });
|
||||
|
Reference in New Issue
Block a user