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); }
/** * 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); }