mirror of
https://github.com/slawkens/myaac.git
synced 2026-01-10 08:31:30 +01:00
Fix for servers with promotion column (mostly tfs 0.3+)
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
use MyAAC\Forum;
|
use MyAAC\Forum;
|
||||||
use MyAAC\Models\Player;
|
use MyAAC\Models\Player;
|
||||||
|
use MyAAC\Server\XML\Vocations;
|
||||||
|
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
@@ -237,7 +238,30 @@ else if (isset($_REQUEST['search'])) {
|
|||||||
$player->setGroup($groups->getGroup($group));
|
$player->setGroup($groups->getGroup($group));
|
||||||
$player->setLevel($level);
|
$player->setLevel($level);
|
||||||
$player->setExperience($experience);
|
$player->setExperience($experience);
|
||||||
|
|
||||||
|
if ($db->hasColumn('players', 'promotion')) {
|
||||||
|
$promotion = 0;
|
||||||
|
|
||||||
|
$vocationOriginal = Vocations::getOriginal($vocation);
|
||||||
|
if ($vocation != $vocationOriginal) {
|
||||||
|
$tmpId = $vocationOriginal;
|
||||||
|
while($promoted = Vocations::getPromoted($tmpId)) {
|
||||||
|
$promotion++;
|
||||||
|
|
||||||
|
$tmpId = $promoted;
|
||||||
|
if ($promoted == $vocation) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$vocation = $vocationOriginal;
|
||||||
|
}
|
||||||
|
|
||||||
|
$player->setPromotion($promotion);
|
||||||
|
}
|
||||||
|
|
||||||
$player->setVocation($vocation);
|
$player->setVocation($vocation);
|
||||||
|
|
||||||
$player->setHealth($health);
|
$player->setHealth($health);
|
||||||
$player->setHealthMax($health_max);
|
$player->setHealthMax($health_max);
|
||||||
$player->setMagLevel($magic_level);
|
$player->setMagLevel($magic_level);
|
||||||
|
|||||||
@@ -77,7 +77,15 @@ class Vocations
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getOriginal(int $id): ?int {
|
public static function getOriginal(int $id): ?int {
|
||||||
return self::$vocationsFrom[$id] ?? null;
|
while ($tmpId = self::$vocationsFrom[$id]) {
|
||||||
|
if ($tmpId == $id) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $tmpId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getBase($includingRook = true): array {
|
public static function getBase($includingRook = true): array {
|
||||||
|
|||||||
Reference in New Issue
Block a user