Skip to content

Commit

Permalink
fix skywars prestige calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Plancke committed Feb 18, 2021
1 parent 706b924 commit c4a3424
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/util/games/skywars/ExpCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ public function getTotalExpForLevel($level) {
* @param $level
* @return mixed
*/
public function getPrestigeForLevel($prestiges, $level) {
foreach ($prestiges as $i => $prestige) {
$nextPrestige = $prestiges[$i + 1];
if ($level >= $prestige["RequiredLevel"] && $level < $nextPrestige["RequiredLevel"]) {
public function getPrestigeForLevel(array $prestiges, $level) {
foreach (array_reverse($prestiges) as $prestige) {
if ($level >= $prestige["RequiredLevel"]) {
return $prestige;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/games/bedwars/LevelTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Plancke\Tests;
namespace Plancke\Tests\games\bedwars;

use PHPUnit\Framework\TestCase;
use Plancke\HypixelPHP\util\games\GameUtils;
Expand Down

0 comments on commit c4a3424

Please sign in to comment.