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

26 lines
700 B
PHP
Raw Normal View History

2016-01-10 11:01:49 +01:00
<?php
class beta5_player_getDiploSummary {
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;
}
// Returns a summary of the player's diplomatic relations
function run($pid) {
$q = $this->db->query("SELECT COUNT(*) FROM enemy_player WHERE player=$pid");
list($c0) = dbFetchArray($q);
$q = $this->db->query("SELECT COUNT(*) FROM enemy_alliance WHERE player=$pid");
list($c1) = dbFetchArray($q);
$q = $this->db->query("SELECT COUNT(*) FROM trusted WHERE player=$pid");
list($c2) = dbFetchArray($q);
$q = $this->db->query("SELECT COUNT(*) FROM trusted WHERE friend=$pid");
list($c3) = dbFetchArray($q);
return array($c0,$c1,$c2,$c3);
}
}
?>