public function getHelpText(SR_Player $player) { $back = ''; if (count($this->getComputers()) > 0) { $back .= $player->lang('hlp_hack'); # You can use a Cyberdeck here to hack into a computer.'; } if ($this->isSearchable()) { $back .= $player->lang('hlp_search'); # ' You can use #search here to search the room for items.'; } return $back === '' ? false : substr($back, 1); }
public function getHelpText(SR_Player $player) { return $player->lang('hlp_hotel', array($this->displaySleepPrice($player))); // $price = $this->calcPrice($player); // $c = Shadowrun4::SR_SHORTCUT; // return sprintf('You can pay %s to %ssleep here and restore your party`s HP/MP.', $price, $c); }
protected static function onHPMP(SR_Player $player, $what, $key) { // $i = 1; $b = chr(2); // $bot = Shadowrap::instance($player); $party = $player->getParty(); $members = $party->getMembers(); $format = $player->lang('fmt_hp_mp'); $back = ''; foreach ($members as $member) { $member instanceof SR_Player; $hpmp = $member->getBase($what); $hpmmpm = $member->get('max_' . $what); $b2 = ''; $b1 = 0; if ($what === 'hp') { if ($member->needsHeal()) { $b2 = $b; $b1 = 1; } } elseif ($what === 'mp') { if ($member->getBase('magic') >= 0) { if ($member->needsEther()) { $b2 = $b; $b1 = 1; } } } $back .= sprintf($format, $member->getEnum(), $member->getName(), $hpmp, $hpmmpm, $b2, $b1); // $back .= sprintf(", %s-%s%s(%s/%s)%s", $b.($member->getEnum()).$b, $b2, $member->getName(), $hpmp, $hpmmpm, $b2); } return self::rply($player, $key, array(ltrim($back, ',; '))); // $bot->reply(sprintf('Your parties %s: %s.', $text, substr($back, 2))); // return true; }
public static function execute(SR_Player $player, array $args) { $pp = Shadowrun4::getParties(); foreach ($pp as $i => $p) { $p instanceof SR_Party; if (!$p->isHuman()) { unset($pp[$i]); } } $page = isset($args[0]) ? intval($args[0]) : 1; $nItems = count($pp); $nPages = GWF_PageMenu::getPagecount(self::PPP, $nItems); $page = Common::clamp($page, 1, $nPages); $from = GWF_PageMenu::getFrom($page, self::PPP); $slice = array_slice($pp, $from, self::PPP); $out = ''; $format = $player->lang('fmt_list'); foreach ($slice as $p) { $p instanceof SR_Party; $leader = $p->getLeader()->displayName(); $l = $p->getSum('level', true); $ll = $p->getSum('level', false); $mc = $p->getMemberCount(); $item = sprintf('%s(L%s(%s))(M%s)', $leader, $l, $ll, $mc); $out .= sprintf($format, $item); // $out .= sprintf(', %s(L%s(%s))(M%s)', $leader, $l, $ll, $mc); } return self::rply($player, '5248', array($page, $nPages, ltrim($out, ',; '))); // $bot = Shadowrap::instance($player); // $bot->reply(sprintf('Parties page %s from %s: %s.', $page, $nPages, substr($out, 2))); }
private static function messagePartyFeelings(SR_Player $player) { $party = $player->getParty(); $enum = 1; $fmt = $player->lang('fmt_feel'); $out = ''; foreach ($party->getMembers() as $member) { $member instanceof SR_Player; $out .= vsprintf($fmt, self::argsForMember($member, $enum)); } $player->msg('5312', array(ltrim($out, ',; '))); }
public static function execute(SR_Player $player, array $args) { $p = $player->getParty(); $back = ''; $format = $player->lang('fmt_xp'); # 1-gizmore L14(177/288xp) KA(5.4/12xp) foreach ($p->getMembers() as $member) { $member instanceof SR_Player; $back .= sprintf($format, $member->getEnum(), $member->getName(), $member->getBase('level'), round($member->getBase('xp_level'), 2), $member->getXPPerLevel(), round($member->getBase('xp'), 2), $member->getXPPerKarma()); } return self::rply($player, '5308', array(ltrim($back, '|,; '))); }
public static function displayBounties(SR_Player $player, $page = 1, $ipp = 10, $orderby = 'bounty DESC', $server = NULL) { // $gdo = gdo_db(); $bounties = self::table(__CLASS__); $numItems = $bounties->countRows('', NULL, 'sr4bo_victim'); $numPages = GWF_PageMenu::getPagecount($ipp, $numItems); $page = Common::clamp(intval($page, 10), 1, $numPages); $from = GWF_PageMenu::getFrom($page, $ipp); $bounties = $bounties->selectAll('concat(user_name, "{", user_sid, "}") name, SUM(sr4bo_bounty) bounty', '', $orderby, array('victim'), 10, $from, GDO::ARRAY_N, 'sr4bo_victim'); if (count($bounties) === 0) { return $player->lang('no_bounties'); // return 'There are no bounties at the moment.'; } $format = $player->lang('fmt_sumlist'); $out = ''; foreach ($bounties as $i => $data) { $ny = Shadowfunc::displayNuyen($data[1]); $out .= sprintf($format, $i + 1, $data[0], $ny); // $out .= sprintf(", \x02%s\X02-%s(%s)", $i+1, $data[0], $ny); } return $player->lang('bounty_page', array($page, $numPages, ltrim(',; ', 2))); // return sprintf('Bounties page %s/%s: %s.', $page, $numPages, substr($out, 2)); }
private static function showDistances(SR_Player $player) { $p = $player->getParty(); $format = $player->lang('fmt_sumlist'); $key = $player->isFighting() ? '5123' : '5124'; $out = ''; foreach ($p->getMembers() as $member) { $member instanceof SR_Player; $val = $player->isFighting() ? $p->getDistance($member) : $member->getBase('distance'); $out .= sprintf($format, $member->getEnum(), $member->getName(), $val); // $out .= sprintf(', %s:%s(%s)', $member->getName(), $member->getBase('distance'), $p->getDistance($member)); } return self::rply($player, $key, array(ltrim($out, ',; '))); }
public static function execute(SR_Player $player, array $args) { // $bot = Shadowrap::instance($player); $p = $player->getParty(); $out = ''; $format = $player->lang('fmt_sumlist'); foreach ($p->getMembers() as $member) { $member instanceof SR_Player; $summand = sprintf('L%s(%s)', $member->getBase('level'), $member->get('level')); $out .= sprintf($format, $member->getEnum(), $member->getName(), $summand); // $out .= sprintf(', %s(L%s(%s))', $member->getName(), $member->getBase('level'), $member->get('level')); } return self::rply($player, '5056', array($p->getPartyLevel(), $p->getPartyXP(), SR_Party::XP_PER_LEVEL, ltrim($out, ',; '))); // $bot->reply(sprintf('Your party has level %s(%s/%s): %s.', $p->getPartyLevel(), $p->getPartyXP(), SR_Party::XP_PER_LEVEL, substr($out, 2))); // return true; }
protected static function onEnable(SR_Player $player, $bit, $bool, $name) { $text = $bool === true ? 'enabled' : 'disabled'; $text = $player->lang($text); $old = $player->isOptionEnabled($bit); if ($bool === $old) { $player->msg('5070', array($name, $text)); // $player->message(sprintf('%s has been already %s.', $name, $text)); return true; } if (false === $player->saveOption($bit, $bool)) { return false; } $player->msg('5071', array($name, $text)); // $player->message(sprintf('%s has been %s for your character.', $name, $text)); $player->modify(); return true; }
public static function execute(SR_Player $player, array $args) { // $bot = Shadowrap::instance($player); $party = $player->getParty(); $members = $party->getMembers(); $total = 0; $format = $player->lang('fmt_sumlist'); $back = ''; foreach ($members as $member) { $member instanceof SR_Player; $karma = $member->getBase('karma'); $total += $karma; $back .= sprintf($format, $member->getEnum(), $member->getName(), $karma); // $back .= sprintf(', %s-%s(%s)', $b.($member->getEnum()).$b, $member->getName(), $karma); } return self::rply($player, '5052', array($total, ltrim($back, ',; '))); // $bot->reply(sprintf('Your party has %s karma: %s.', $total, substr($back, 2))); // return true; }
public function announceUsage(SR_Player $player, SR_Player $target, $message = '', $message2 = '', $useamt = 1) { if ($player->isFighting()) { $busy = $player->busy($this->getItemUsetime()); $busymsg = $player->lang('busy', array($busy)); #sprintf(' %ds busy.', $busy); } else { $busymsg = ''; } $player->getParty()->ntice('5228', array($player->displayNameNB(), $this->getName(), $target->displayNameNB(), $busymsg, $message)); // $player->getParty()->notice(sprintf('%s used %s on %s.%s%s', $player->getName(), $this->getName(), $target->getName(), $busymsg, $message)); if ($player->isFighting()) { $player->getEnemyParty()->ntice('5229', array($player->displayNameNB(), $this->getName(), $target->displayNameNB(), $busymsg, $message2)); // $player->getEnemyParty()->notice(sprintf('%s used %s on %s.%s', $player->getName(), $this->getName(), $target->getName(), $message2)); } if ($useamt > 0) { return $this->useAmount($player, $useamt); } return true; }
public static function execute(SR_Player $player, array $args) { // $bot = Shadowrap::instance($player); // $party = $player->getParty(); // $members = $party->getMembers(); $total = 0; $back = ''; $format = $player->lang('fmt_sumlist'); foreach ($player->getParty()->getMembers() as $member) { $member instanceof SR_Player; $we = $member->get('weight'); $mw = $member->get('max_weight'); $b = $we > $mw ? chr(2) : ''; $total += $we; $summand = sprintf('%s/%s', $b . Shadowfunc::displayWeight($we) . $b, Shadowfunc::displayWeight($mw)); $back .= sprintf($format, $member->getEnum(), $b . $member->getName() . $b, $summand); // $back .= sprintf(', %s(%s/%s)', $b.$member->getName().$b, $b.Shadowfunc::displayWeight($we).$b, Shadowfunc::displayWeight($mw)); } return self::rply($player, '5064', array(Shadowfunc::displayWeight($total), ltrim($back, ',; '))); // $bot->reply(sprintf('Your party carries %s: %s.', Shadowfunc::displayWeight($total), substr($back, 2))); // return true; }
public function on_view(SR_Player $player, array $args) { $items = $player->getBankItems(); $text = array('prefix' => $player->lang('bank'), 'code' => '5188'); return Shadowfunc::genericViewI($player, $items, $args, $text, false); }
public function getHelpText(SR_Player $player) { return $player->lang('hlp_elevator'); }
public static function getCyberware(SR_Player $player, $key = '5045', SR_Player $spectator) { $i = 1; $back = ''; $format = $player->lang('fmt_rawitems'); foreach ($player->getCyberware() as $item) { $item instanceof SR_Item; $back .= sprintf($format, $i++, $item->displayName($spectator)); // $back .= sprintf(', %d-:%s', $i++, $item->getItemName()); } $back = $back === '' ? Shadowrun4::lang('none') : substr($back, 2); $args = $key === '5045' ? array() : array($player->getName()); $args[] = $back; return Shadowrun4::lang($key, $args); }
public function onViewShop(SR_Player $player, $pname) { $i_table = GDO::table('SR_BazarItem'); if (false === ($shop = SR_BazarShop::getShop($pname))) { $player->msg('1106', array($pname)); // $player->message("{$pname} does not have a shop."); return false; } $epname = GDO::escape($pname); if (false === ($result = $i_table->select('sr4ba_iname, sr4ba_price, sr4ba_iamt', "sr4ba_pname='{$epname}'", 'sr4ba_price DESC'))) { $player->message('Database error!'); return false; } $itemcount = 0; $out = ''; $format = $player->lang('fmt_bazar_shop'); while (false !== ($row = $i_table->fetch($result, GDO::ARRAY_N))) { $out .= sprintf($format, $row[2], $row[0], Shadowfunc::displayNuyen($this->calcBuyPrice($row[1]))); // $amt = $row[2] < 2 ? '' : $row[2].'x'; // $out .= sprintf(", %s\X02%s\X02(%s)", $amt, $row[0], Shadowfunc::displayNuyen($this->calcBuyPrice($row[1]))); $itemcount++; } $i_table->free($result); if ($out === '') { return $player->msg('1107', array($pname)); // return $player->message(sprintf("%s's shop is empty.", $pname)); } $player->msg('5150', array($pname, $shop->getSlogan())); $player->msg('5151', array($itemcount, substr($out, 2))); // $player->message($shop->getSlogan()); // $player->message(sprintf("%d Items: %s.", $itemcount, substr($out, 2))); return true; }
public function getEnterText(SR_Player $player) { return $player->lang('stub_enter_subway'); }
public function getEnterText(SR_Player $player) { return $player->lang('stub_enter_blacksmith', array($this->getCity())); }
/** * Get text message for an event. * @param int $time * @param string $pname * @param int $action * @param string $iname * @param int $amt * @return string */ public static function getHistMessage(SR_Player $player, $time, $pname, $action, $iname, $amt) { $key = 'ch_' . $action; switch ($action) { case self::CREATE: $args = array($pname, $iname); break; case self::REQUEST: case self::JOIN: case self::PART: $args = array($pname, $amt); break; case self::MSG: $args = array($pname, $iname); break; case self::PUSHY: case self::POPY: $args = array($pname, Shadowfunc::displayNuyen($amt)); break; case self::PUSHI: case self::POPI: $args = array($pname, $amt, $iname); break; case self::ADD_MEMBERS: $args = array($pname, $amt); break; case self::ADD_WEALTH: $args = array($pname, Shadowfunc::displayNuyen($amt)); break; case self::ADD_STORAGE: $args = array($pname, Shadowfunc::displayWeight($amt)); break; // case self::CREATE: return sprintf('%s created the clan %s.', $pname, $iname); // case self::REQUEST: return sprintf('%s requested to join your clan as member #%s.', $pname, $amt); // case self::JOIN: return sprintf('%s has joined your clan as member #%s.', $pname, $amt); // case self::PART: return sprintf('%s has left your clan and it now holds %s members.', $pname, $amt); // case self::MSG: return sprintf("\X02%s\X02: \"%s\"", $pname, $iname); // case self::PUSHY: return sprintf('%s has pushed %s into the clanbank.', $pname, Shadowfunc::displayNuyen($amt)); // case self::POPY: return sprintf('%s has taken %s out of the clanbank.', $pname, Shadowfunc::displayNuyen($amt)); // case self::PUSHI: return sprintf('%s has put %s %s into the clanbank.', $pname, $amt, $iname); // case self::POPI: return sprintf('%s has taken %s %s out of the clanbank.', $pname, $amt, $iname); // case self::ADD_MEMBERS: return sprintf('%s has purchased more member slots and the clan can now hold up to %s.', $pname, $amt); // case self::ADD_WEALTH: return sprintf('%s has purchased more nuyen capacity and the clan can now hold up to %s.', $pname, Shadowfunc::displayNuyen($amt)); // case self::ADD_STORAGE: return sprintf('%s has purchased more storage room and the clan can now hold up to %s.', $pname, Shadowfunc::displayWeight($amt)); // case self::CREATE: return sprintf('%s created the clan %s.', $pname, $iname); // case self::REQUEST: return sprintf('%s requested to join your clan as member #%s.', $pname, $amt); // case self::JOIN: return sprintf('%s has joined your clan as member #%s.', $pname, $amt); // case self::PART: return sprintf('%s has left your clan and it now holds %s members.', $pname, $amt); // case self::MSG: return sprintf("\X02%s\X02: \"%s\"", $pname, $iname); // case self::PUSHY: return sprintf('%s has pushed %s into the clanbank.', $pname, Shadowfunc::displayNuyen($amt)); // case self::POPY: return sprintf('%s has taken %s out of the clanbank.', $pname, Shadowfunc::displayNuyen($amt)); // case self::PUSHI: return sprintf('%s has put %s %s into the clanbank.', $pname, $amt, $iname); // case self::POPI: return sprintf('%s has taken %s %s out of the clanbank.', $pname, $amt, $iname); // case self::ADD_MEMBERS: return sprintf('%s has purchased more member slots and the clan can now hold up to %s.', $pname, $amt); // case self::ADD_WEALTH: return sprintf('%s has purchased more nuyen capacity and the clan can now hold up to %s.', $pname, Shadowfunc::displayNuyen($amt)); // case self::ADD_STORAGE: return sprintf('%s has purchased more storage room and the clan can now hold up to %s.', $pname, Shadowfunc::displayWeight($amt)); default: return 'ERR ACTION: ' . $action; } return $player->lang($key, $args); }
private function displayActionB(SR_Player $player, $action, $display_eta) { $b = chr(2); // $action = $this->getAction(); switch ($action) { case 'delete': return $player->lang('pa_delete'); case 'talk': $ep = $this->getEnemyParty(); $epm = $ep === false ? $player->lang('empty_party') : $ep->displayMembers(); return $player->lang('pa_talk', array($epm, $this->displayContactETA(), $this->displayLastAction($player))); // return sprintf("{$b}talking{$b} to %s. %s remaining.%s", $epm, $this->displayContactETA(), $this->displayLastAction()); // return sprintf("{$b}talking{$b} to %s. %s remaining.%s", $epm, $this->displayContactETA(), $this->displayLastAction()); case 'fight': return $player->lang('pa_fight', array($this->getEnemyParty()->displayMembers(true, true), $this->displayLastAction($player))); // return sprintf("{$b}fighting{$b} against %s.%s", $this->getEnemyParty()->displayMembers(true), $this->displayLastAction()); // return sprintf("{$b}fighting{$b} against %s.%s", $this->getEnemyParty()->displayMembers(true), $this->displayLastAction()); case 'inside': return $player->lang('pa_inside', array($this->getLocation())); // return sprintf("{$b}inside{$b} %s.", $this->getLocation()); // return sprintf("{$b}inside{$b} %s.", $this->getLocation()); case 'outside': $city = $this->getCityClass(); if ($this->isAtLocation() || !$city->isDungeon()) { return $player->lang('pa_outside1', array($this->getLocation())); // return sprintf("{$b}outside{$b} of %s.", $this->getLocation()); } else { return $player->lang('pa_outside2', array($this->getLocation())); // return sprintf("somewhere inside %s.", $this->getLocation()); } case 'sleep': return $player->lang('pa_sleep', array($this->getLocation())); // return sprintf("{$b}sleeping{$b} inside %s.", $this->getLocation()); // return sprintf("{$b}sleeping{$b} inside %s.", $this->getLocation()); case 'travel': return $player->lang('pa_travel', array($this->getTarget(), $display_eta)); // return sprintf("{$b}travelling{$b} to %s. %s remaining.", $this->getTarget(), $this->displayETA()); // return sprintf("{$b}travelling{$b} to %s. %s remaining.", $this->getTarget(), $this->displayETA()); case 'explore': return $player->lang('pa_explore', array($this->getLocation(), $display_eta)); // return sprintf("{$b}exploring{$b} %s. %s remaining.", $this->getLocation(), $this->displayETA()); // return sprintf("{$b}exploring{$b} %s. %s remaining.", $this->getLocation(), $this->displayETA()); case 'goto': return $player->lang('pa_goto', array($this->getLocation(), $display_eta)); // return sprintf("{$b}going{$b} to %s. %s remaining.", $this->getLocation(), $this->displayETA()); // return sprintf("{$b}going{$b} to %s. %s remaining.", $this->getLocation(), $this->displayETA()); case 'hunt': return $player->lang('pa_hunt', array($this->getTarget(), $display_eta)); // return sprintf("{$b}hunting{$b} %s. %s remaining.", $this->getTarget(), $this->displayETA()); // return sprintf("{$b}hunting{$b} %s. %s remaining.", $this->getTarget(), $this->displayETA()); case 'hijack': return $player->lang('pa_hijack', array($this->getTarget(), $this->getLocation(), $display_eta)); // return sprintf("{$b}hijacking{$b} %s at %s. %s remaining.", $this->getTarget(), $this->getLocation(), $this->displayETA()); // return sprintf("{$b}hijacking{$b} %s at %s. %s remaining.", $this->getTarget(), $this->getLocation(), $this->displayETA()); default: return 'UNKNOWN PARTY ACTION IS UNKNOWN.'; } }
private function displayUseTime(SR_Player $player) { if ($this instanceof SR_Weapon) { $t = $this->getRealAttackTime(); return $t > 0 ? $player->lang('atk_time', array($t)) : ''; // return $t > 0 ? sprintf(" \X02UseTime\X02: %ss.", $t) : ''; } else { return ''; } }
public function getHelpText(SR_Player $player) { return $player->lang('hlp_second_hand'); }
private function displaySurgeryPricesB(SR_Player $player, $section, array $prices) { $out = ''; $format = $player->lang('fmt_rawitems'); $i = 1; foreach ($prices as $field => $price) { $out .= sprintf($format, $field, Shadowfunc::displayNuyen($price)); } if ($out === '') { $out = ', ' . $player->lang('none'); } return $player->msg('5262', array(substr($out, 2))); }
private function onViewPage(SR_Clan $clan, SR_Player $player, $page) { $ipp = 10; $cid = $clan->getID(); $table = GDO::table('SR_ClanBank'); $where = "sr4cb_cid={$cid}"; $nItems = $table->countRows($where); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); if ($page < 1 || $page > $nPages) { $player->msg('1009'); // $player->message('This page is empty.'); return false; } $from = GWF_PageMenu::getFrom($page, $ipp); $orderby = 'sr4cb_iamt ASC, sr4cb_iname ASC'; if (false === ($result = $table->selectAll('sr4cb_iname, sr4cb_iamt', $where, $orderby, NULL, $ipp, $from, GDO::ARRAY_N))) { $player->message('DB ERROR 1.'); return false; } $out = ''; $format = $player->lang('fmt_items'); foreach ($result as $row) { $from++; list($itemname, $amt) = $row; $damt = $amt === '1' ? '' : "({$amt})"; $out .= sprintf($format, $from, $itemname, $damt, $amt); // $out[] = sprintf('%d-%s%s', $from, $itemname, $amt); } $bot = Shadowrap::instance($player); return $bot->rply('5176', array($page, $nPages, substr($out, 2))); // $text = count($out) === 0 ? 'The bank is empty.' : implode(', ', $out); // return $bot->reply(sprintf('ClanBank page %d/%d: %s.', $page, $nPages, $text)); }
public function getEnterText(SR_Player $player) { return $player->lang('stub_enter', array($this->getName())); }