This repository has been archived on 2024-07-18. You can view files and clone it, but cannot push or open issues or pull requests.
lwb5/scripts/game/beta5/player/library/reorderAllies.inc

24 lines
502 B
PHP

<?php
class beta5_player_reorderAllies {
function beta5_player_reorderAllies($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
// Reorders the list of allies after it's been modified
function run($pid) {
$q = $this->db->query("SELECT level FROM trusted WHERE player=$pid ORDER BY level ASC");
$i = 0;
while ($r = dbFetchArray($q)) {
if ($r[0] != $i) {
$this->db->query("UPDATE trusted SET level=$i WHERE player=$pid AND level=".$r[0]);
}
$i ++;
}
}
}
?>