File tree Expand file tree Collapse file tree 1 file changed +2
-16
lines changed
src/Syntax/SteamApi/Containers/Player Expand file tree Collapse file tree 1 file changed +2
-16
lines changed Original file line number Diff line number Diff line change @@ -25,22 +25,8 @@ public function __construct($levelDetails)
2525 $ this ->currentLevelFloor = $ this ->xpForCurrentLevel ;
2626 $ this ->currentLevelCeiling = $ this ->playerXp + $ this ->xpToLevelUp ;
2727
28- $ levelRange = $ this ->currentLevelCeiling - $ this ->currentLevelFloor ;
29-
30- $ this ->percentThroughLevel = $ this ->percent ($ this ->xpToLevelUp , $ levelRange );
31- }
32-
33- private function percent ($ num_amount , $ num_total )
34- {
35- if ($ num_amount == 0 || $ num_total == 0 ){
36- return 0 ;
37- }
38- else {
39- $ count1 = $ num_amount / $ num_total ;
40- $ count2 = $ count1 * 100 ;
41- $ count = number_format ($ count2 , 0 );
42- return $ count ;
43- }
28+ // arbitrary range formula. n = value in the middle ( n - min ) / ( max - min ) * 100
29+ $ this ->percentThroughLevel = ( $ this ->playerXp - $ this ->currentLevelFloor ) / ( $ this ->currentLevelCeiling - $ this ->currentLevelFloor ) * 100 ;
4430 }
4531
4632}
You can’t perform that action at this time.
0 commit comments