lwb5-in-2025/scripts/game/beta5/player/library/moveAllyUp.inc

23 lines
576 B
PHP
Raw Normal View History

2016-01-10 11:01:49 +01:00
<?php
class beta5_player_moveAllyUp {
2024-12-31 10:42:58 +01:00
function __construct($lib) {
2016-01-10 11:01:49 +01:00
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
// Move an ally up the list
function run($pid, $it) {
$q = $this->db->query("SELECT COUNT(*) FROM trusted WHERE player=$pid");
list($all) = dbFetchArray($q);
$np = $it - 1;
$this->db->query("UPDATE trusted SET level=$all WHERE player=$pid AND level=$it");
$this->db->query("UPDATE trusted SET level=$it WHERE player=$pid AND level=$np");
$this->db->query("UPDATE trusted SET level=$np WHERE player=$pid AND level=$all");
}
}
?>