예제 #1
0
파일: SR_ClanHQ.php 프로젝트: sinfocol/gwf3
 public static function onClanMessage(SR_Player $player, array $args)
 {
     if (false === ($clan = SR_Clan::getByPlayer($player))) {
         $player->msg('1019');
         // 			$player->message('You are not in a clan, chummer.');
         return false;
     }
     if ('' === ($message = implode(' ', $args))) {
         $player->message(Shadowhelp::getHelp($player, 'clan_message'));
         return false;
     }
     foreach (SR_ClanMembers::getOnlineMembers($clan->getID()) as $member) {
         $member instanceof SR_Player;
         $member->message($message);
     }
     return SR_ClanHistory::onMessage($clan, $player, $message);
 }
예제 #2
0
 public static function sendEvent(SR_Clan $clan, SR_ClanHistory $event)
 {
     foreach ($clan->getOnlineMembers() as $member) {
         $member instanceof SR_Player;
         $member->msg('5258', array($event->getMessage($member)));
     }
     return true;
 }
예제 #3
0
파일: SR_Clan.php 프로젝트: sinfocol/gwf3
 public static function create(SR_Player $player, $name)
 {
     $clan = new self(array('sr4cl_id' => '0', 'sr4cl_name' => $name, 'sr4cl_founder' => $player->getID(), 'sr4cl_slogan' => '', 'sr4cl_date' => GWF_Time::getDate(), 'sr4cl_members' => '0', 'sr4cl_max_members' => self::MIN_MEMBERCOUNT, 'sr4cl_storage' => '0', 'sr4cl_max_storage' => self::MIN_STORAGE, 'sr4cl_money' => '0', 'sr4cl_max_money' => self::MIN_MONEY, 'sr4cl_options' => '0'));
     if (false === $clan->insert()) {
         echo GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         return false;
     }
     if (false === $clan->join($player)) {
         echo GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         return false;
     }
     if (false === SR_ClanMembers::setClanOptions($clan->getID(), $player->getID(), SR_ClanMembers::FOUNDER)) {
         echo GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         return false;
     }
     if (false === SR_ClanHistory::onCreate($clan, $player)) {
         echo GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         return false;
     }
     return $clan;
 }
예제 #4
0
파일: clan.php 프로젝트: sinfocol/gwf3
 /**
  * Show one history page for your clan.
  * @param SR_Player $player
  * @param int $page
  */
 private static function showHistoryPage(SR_Player $player, $page)
 {
     // 		$bot = Shadowrap::instance($player);
     if (false === ($clan = SR_Clan::getByPlayer($player))) {
         return self::rply($player, '1019');
         // 			$bot->reply('You don\'t belong to a clan yet.');
         return false;
     }
     $ipp = 5;
     $table = GDO::table('SR_ClanHistory');
     $where = 'sr4ch_cid=' . $clan->getID();
     $nItems = $table->countRows($where);
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     if ($page > $nPages) {
         return self::rply($player, '1009');
         // 			$bot->reply('This page is empty.');
         return false;
     }
     $from = GWF_PageMenu::getFrom($page, $ipp);
     if (false === ($result = $table->selectAll('sr4ch_time,sr4ch_pname,sr4ch_action,sr4ch_iname,sr4ch_amt', $where, 'sr4ch_time DESC', NULL, $ipp, $from, GDO::ARRAY_N))) {
         $player->message('DB ERROR');
         // 			$bot->reply('DB ERROR');
         return false;
     }
     $b = 0;
     $out = array();
     foreach ($result as $row) {
         $b = 1 - $b;
         $b2 = $b === 0 ? '' : "";
         $out[] = $b2 . SR_ClanHistory::getHistMessage($player, $row[0], $row[1], $row[2], $row[3], $row[4]) . $b2;
     }
     return self::rply($player, '5041', array($page, $nPages, implode('  ', $out)));
     // 		$message = sprintf('ClanHistory page %d/%d: %s', $page, $nPages, implode('  ', $out));
     // 		return $bot->reply($message);
 }