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/getAllies.inc

26 lines
561 B
PHP
Raw Normal View History

2016-01-10 11:01:49 +01:00
<?php
class beta5_player_getAllies {
function beta5_player_getAllies($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
// Get the list of a player's trusted allies
function run($pid) {
$q = $this->db->query(
"SELECT l.friend,p.name,u.name FROM trusted l,player p,account u "
. "WHERE l.player=$pid AND p.id=l.friend AND u.id=p.userid "
. "ORDER BY level ASC"
);
$al = array();
while ($r = dbFetchArray($q)) {
array_push($al, array('id' => $r[0], 'name' => is_null($r[1]) ? $r[2] : $r[1]));
}
return $al;
}
}
?>