Exemple #1
0
 function testSetClanInfo()
 {
     $clan = new Clan();
     $clan->setFounder('randomFounder');
     $clan->setName('AwesomeClan');
     $this->assertEquals('randomFounder', $clan->getFounder());
     $this->assertEquals('AwesomeClan', $clan->getName());
 }
Exemple #2
0
 /**
  * Get the clan that a member has, if any
  * @return Clan|null
  **/
 public static function clanOfMember($pc_or_id)
 {
     if ($pc_or_id instanceof Player) {
         $playerID = $pc_or_id->id();
     } else {
         $playerID = $pc_or_id;
     }
     $clan_info = query_row('select clan_id, clan_name, clan_created_date, clan_founder, clan_avatar_url, description from clan JOIN clan_player ON clan_id = _clan_id where _player_id = :pid', [':pid' => $playerID]);
     if (empty($clan_info)) {
         return null;
     } else {
         $clan = new Clan($clan_info['clan_id']);
         $clan->setFounder($clan_info['clan_founder']);
         $clan->setDescription($clan_info['description']);
         $clan->setName($clan_info['clan_name']);
         $clan->setAvatarUrl($clan_info['clan_avatar_url']);
         return $clan;
     }
 }