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

36 lines
749 B
PHP
Raw Normal View History

2016-01-10 11:01:49 +01:00
<?php
class beta5_player_checkAllies {
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;
}
// Checks players that have set a player as trusted allies in order to know whether the player can control their fleets
function run($pid) {
$allies = $this->lib->call('isAllyOf', $pid);
$res = array();
foreach ($allies as $ally => $crap) {
if ($this->lib->call('isOnline', $ally) || $this->lib->call('isOnVacation', $ally)) {
continue;
}
$aList = $this->lib->call('getAllies', $ally);
foreach ($aList as $aa) {
if ($aa['id'] == $pid) {
array_push($res, $ally);
break;
}
if ($this->lib->call('isOnline', $aa['id'])) {
break;
}
}
}
return $res;
}
}
?>