Exemple #1
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) !== 2) {
         $bot->reply(Shadowhelp::getHelp($player, 'gmloot'));
         return false;
     }
     $target = Shadowrun4::getPlayerByShortName($args[0]);
     if ($target === -1) {
         $player->message('The username is ambigious.');
         return false;
     }
     if ($target === false) {
         $player->message('The player is not in memory or unknown.');
         return false;
     }
     if (false === $target->isCreated()) {
         $bot->reply(sprintf('The player %s has not started a game yet.', $args[0]));
         return false;
     }
     if (Common::isNumeric($args[1])) {
         $target->giveItems(Shadowfunc::randLoot($target, $args[1]), 'gmloot');
     } else {
     }
     return true;
 }
Exemple #2
0
 public function onItemUse(SR_Player $player, array $args)
 {
     if ($player->isFighting()) {
         $player->message('You cannot use this item in combat.');
         return false;
     }
     $bot = Shadowrap::instance($player);
     $mods = $this->getItemModifiersB();
     $field = key($mods);
     $level = array_shift($mods);
     $key = "__SLMSCR_{$field}";
     if (false !== SR_PlayerVar::getVal($player, $key)) {
         return $bot->reply('You already read this master scroll.');
     }
     if ($player->getBase($field) < 0) {
         return $bot->reply("You have to learn {$field} in order to read a master scroll.");
     }
     if (!$this->useAmount($player, 1)) {
         return $bot->reply('Database error!');
     }
     if (false === $player->increaseField($field)) {
         return $bot->reply('Database error 2!');
     }
     if (false === SR_PlayerVar::setVal($player, $key, '1')) {
         return $bot->reply('Database error 3!');
     }
     $player->modify();
     return $bot->reply(sprintf('You read the %s and got your %s increased by 1.', $this->getItemName(), $field));
 }
Exemple #3
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     $numArgs = count($args);
     if ($numArgs < 1 || $numArgs > 2) {
         $bot->reply(Shadowhelp::getHelp($player, 'compare'));
         return false;
     }
     $item1 = self::getItem($bot, $player, $args[0]);
     if (!$item1) {
         self::rply($player, '1020', array($args[0]));
         // 			$bot->reply('I don`t know what item "'.$args[0].'" is.');
         return false;
     }
     if ($numArgs > 1) {
         $item2 = self::getItem($bot, $player, $args[1]);
         if (!$item2) {
             self::rply($player, '1020', array($args[1]));
             // 				$bot->reply('I don`t know what item "'.$args[1].'" is.');
             return false;
         }
     } else {
         $item2 = $player->getItem($item1->getItemType());
         if (!$item2) {
             self::rply($player, '1021', array($item1->getItemName()));
             // 				$bot->reply('You don`t have anything comparable to "'.$item1->getItemName().'" equipped');
             return false;
         }
     }
     if ($player->getLangISO() === 'bot') {
         // 			return self::replyBotTable(self::getComparisonMatrix($player, $item1, $item2));
     }
     $bot->replyTable(self::getComparisonMatrix($player, $item1, $item2), '5043');
     return true;
 }
Exemple #4
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) < 2 || count($args) > 3) {
         $bot->reply(Shadowhelp::getHelp($player, 'gmi'));
         return false;
     }
     $target = Shadowrun4::getPlayerByShortName($args[0]);
     if ($target === -1) {
         $player->message('The username is ambigious.');
         return false;
     }
     if ($target === false) {
         $player->message('The player is not in memory or unknown.');
         return false;
     }
     if (false === $target->isCreated()) {
         $bot->reply(sprintf('The player %s has not started a game yet.', $args[0]));
         return false;
     }
     if (false === ($item = SR_Item::createByName($args[1]))) {
         $bot->reply(sprintf('The item %s could not be created.', $args[1]));
         return false;
     }
     if (isset($args[2])) {
         if (!$item->isItemStackable()) {
             $bot->reply('No amount for equipment!');
             return false;
         }
         $item->saveVar('sr4it_amount', intval($args[2]));
     }
     $b = chr(2);
     $target->giveItems(array($item), sprintf("{$b}[GM]_%s{$b}", $player->getName()));
     return true;
 }
Exemple #5
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) !== 1) {
         $bot->reply(Shadowhelp::getHelp($player, 'gmp'));
         return false;
     }
     if (false === ($target = Shadowrun4::getPlayerByShortName($args[0]))) {
         $bot->reply(sprintf('The user %s is unknown.', $args[0]));
         return false;
     } elseif ($target === -1) {
         $bot->reply('The player name is ambigious.');
         return false;
     }
     if (false === $target->isCreated()) {
         $bot->reply(sprintf('The player %s has not started a game yet.', $args[0]));
         return false;
     }
     $p = $target->getParty();
     $a = $p->getAction();
     if ($a !== SR_Party::ACTION_INSIDE && $a !== SR_Party::ACTION_OUTSIDE) {
         $bot->reply('The party with ' . $args[0] . ' is moving.');
         return false;
     }
     $p->pushAction(SR_Party::ACTION_INSIDE, 'Prison_Block1');
 }
Exemple #6
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (!$player->getParty()->isIdle()) {
         $player->msg('1033');
         return false;
         // 			return $player->message('Your party needs to be idle to request a new leader.');
     }
     if ($player->isLeader()) {
         $player->msg('1095');
         return false;
         // 			return $bot->reply('You are already leader of your party.');
     }
     $party = $player->getParty();
     $leader = $party->getLeader();
     $user = $leader->getUser();
     $last = $user->getVar('lusr_timestamp');
     $wait = $last + self::RL_TIME - time();
     if ($leader->isOptionEnabled(SR_Player::NO_RL)) {
         self::rply($player, '1096');
         return false;
         // 			return $bot->reply('Your leader does not allow to takeover the leadership.');
     }
     if ($wait > 0) {
         self::rply($player, '1097', array(GWF_Time::humanDuration($wait)));
         return false;
         // 			return $bot->reply(sprintf('Please wait %s and try again.', GWF_Time::humanDuration($wait)));
     }
     if (false === $party->setLeader($player)) {
         return $bot->reply('Database Error.');
     }
     return $party->ntice('5138', array($player->getName()));
     // 		return $party->notice(sprintf('%s is the new party leader.', $player->getName()));
 }
Exemple #7
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) !== 0) {
         $bot->reply(Shadowhelp::getHelp($player, 'part'));
         return false;
     }
     $p = $player->getParty();
     if ($p->getMemberCount() === 1) {
         self::rply($player, '1093');
         // 			$bot->reply('You are not in a party.');
         return false;
     }
     $p->ntice('5135', array($player->getName()));
     // 		$p->notice(sprintf('%s has left the party.', $player->getName()));
     $p->kickUser($player, true);
     $np = SR_Party::createParty();
     $np->addUser($player, true);
     $np->cloneAction($p);
     $np->clonePreviousAction($p);
     //		if ($np->isMoving())
     if (!$np->isIdle()) {
         Shadowcmd_stop::execute($player, $args);
     }
     return true;
 }
Exemple #8
0
 public static function executeLook(SR_Player $player, $command_mode = true)
 {
     $bot = Shadowrap::instance($player);
     $p = $player->getParty();
     $pid = $player->getPartyID();
     $format = $player->lang('fmt_list');
     $back = '';
     foreach (Shadowrun4::getParties() as $party) {
         $party instanceof SR_Party;
         if ($party->getID() === $pid) {
             continue;
         }
         if (!$party->sharesLocation($p)) {
             continue;
         }
         foreach ($party->getMembers() as $member) {
             $member instanceof SR_Player;
             $back .= sprintf($format, $member->getName());
         }
     }
     if ($back === '') {
         # You see no other players.
         return $command_mode ? self::rply($player, '5120') : true;
     }
     // 		$player->setOption(SR_Player::RESPONSE_PLAYERS);
     # You see these players: %s.
     if ($command_mode) {
         self::rply($player, '5121', array(ltrim($back, ',; ')));
     } else {
         $player->msg('5121', array(ltrim($back, ',; ')));
     }
     return true;
 }
Exemple #9
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (!$player->getParty()->isIdle()) {
         $player->msg('1033');
         // 			$player->message('Your party is moving. Try this command when idle.');
         return false;
     }
     if ($player->isRunner()) {
         self::rply($player, '5075');
         // 			$bot->reply('You are already playing running mode. Nice!');
     } elseif (count($args) === 0) {
         $bot->reply(Shadowhelp::getHelp($player, 'rm'));
         self::rply($player, '5076', array('#rm ' . self::WORD));
         // 			$bot->reply('Type "#rm '.self::WORD.' to confirm.');
     } elseif (count($args) !== 1 || $args[0] !== self::WORD) {
         $bot->reply(Shadowhelp::getHelp($player, 'rm'));
     } elseif ($player->getBase('level') > 2) {
         self::rply($player, '1034');
         // 			$bot->reply('You cannot switch to running mode when you passed level 2.');
     } else {
         $player->saveOption(SR_Player::RUNNING_MODE, true);
         self::rply($player, '5077');
         self::rply($player, '5078');
         // 			$bot->reply('You are now playing running mode. This means unlimited stats but instant death. Good luck!');
         // 			$bot->reply('It is advised you #enable norl now too, to prevent your char from beeing kidnapped with the #rl command!');
         return true;
     }
     return false;
 }
Exemple #10
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     # One arg is like examine.
     if (count($args) === 1) {
         return Shadowcmd_examine::execute($player, $args);
     }
     # Other than 2 args is error => help.
     if (count($args) !== 2) {
         $bot->reply(Shadowhelp::getHelp($player, 'show'));
         return false;
     }
     # Try to get target.
     if (false === ($target = Shadowfunc::getFriendlyTarget($player, $args[0]))) {
         $player->msg('1028', array($args[0]));
         // 			$player->message(sprintf('%s is not here or the name is ambigous.', $args[0]));
         return false;
     }
     # Show to yourself is like examine.
     if ($target->getID() === $player->getID()) {
         return Shadowcmd_examine::execute($player, array($args[1]));
     }
     # Try to get item.
     if (false === ($item = $player->getItem($args[1]))) {
         $player->msg('1029');
         // 			$bot->reply('You don`t have that item.');
         return false;
     }
     return $target->msg('5062', array($player->displayName(), $item->getItemInfo($target)));
     // 		$msg = sprintf('%s shows you: %s', $player->displayName(), $item->getItemInfo($player));
     // 		return $target->message($msg);
 }
Exemple #11
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) === 0) {
         return self::showDistances($player);
     }
     # err args
     if (count($args) !== 1 || !is_numeric($args[0])) {
         $bot->reply(Shadowhelp::getHelp($player, 'set_distance'));
         return false;
     }
     # Out of bounds
     $d = round(floatval($args[0]), 1);
     if ($d < 1 || $d > SR_Player::MAX_SD) {
         $bot->reply(Shadowhelp::getHelp($player, 'set_distance'));
         return false;
     }
     foreach ($player->getParty()->getMembers() as $member) {
         $member instanceof SR_Player;
         if ($member->getLangISO() === 'bot') {
             $member->msg('5278', array($player->getName(), $d));
         }
     }
     $player->updateField('distance', $d);
     return self::rply($player, '5122', array($d));
     // 		$player->message(sprintf("Your default combat distance has been set to %.01f meters.", $d));
     // 		return true;
 }
Exemple #12
0
 public function on_write(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (false === ($chalk = $player->getInvItemByName('Chalk', false)) && false === ($pen = $player->getInvItemByName('Pen', false))) {
         $bot->reply('You don\'t have anything to write on the prison wall, chummer.');
         return false;
     }
     if (count($args) === 0) {
         $bot->reply('You succesfully wrote nothing on the wall ... does not look too bad, you think to yourself.');
         return false;
     }
     $key = self::KEY_WRITE;
     $message = implode(' ', $args);
     if (false === ($written = SR_PlayerVar::getVal($player, $key))) {
         $re = '';
     } else {
         $re = 'RE';
     }
     if ($message === self::MSG_CHAPTER_III) {
         $this->onChapterIIIDone($player);
     }
     if (false === SR_PlayerVar::setVal($player, $key, $message)) {
         $bot->reply('DB ERROR 1');
         return false;
     }
     $bot->reply(sprintf('You successfully %swrote "%s" on the prison wall', $re, $message));
     return true;
 }
Exemple #13
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) !== 1) {
         $bot->reply(Shadowhelp::getHelp($player, 'kick'));
         return false;
     }
     $p = $player->getParty();
     if (false === ($target = $p->getMemberByArg($args[0]))) {
         self::rply($player, '1089');
         // 			$bot->reply('This player is not in your party.');
         return false;
     }
     if ($target->getID() === $player->getID()) {
         self::rply($player, '1090');
         // 			$bot->reply('You can not kick yourself.');
         return false;
     }
     $p->ntice('5137', array($target->getName()));
     // 		$p->notice(sprintf('%s has been kicked off the party.', $target->getName()));
     if ($p->kickUser($target, false)) {
         $p->recomputeEnums();
         $p->updateMembers();
         $np = SR_Party::createParty();
         $np->cloneAction($p);
         $np->clonePreviousAction($p);
         $np->addUser($target, true);
         if (!$np->isIdle()) {
             $np->popAction(true);
         }
     }
     return true;
 }
Exemple #14
0
 public function on_sleep(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     $party = $player->getParty();
     $price = $this->calcPrice($player);
     if (!$party->needsToRest()) {
         return $bot->rply('1137');
         // 			return $bot->reply('You don`t need to rest.');
     }
     if (false === $player->pay($price)) {
         return $bot->rply('1063', array(Shadowfunc::displayNuyen($price), $player->displayNuyen()));
         // 			return $bot->reply(sprintf('To rent a room for your party, you need %s. You only got %s!', Shadowfunc::displayNuyen($price), $player->displayNuyen()));
     }
     if ($price > 0) {
         $player->msg('5143', array($price));
         // 			$player->message(sprintf('You pay %s nuyen.', $price));
     }
     $b = chr(2);
     $party->pushAction(SR_Party::ACTION_SLEEP);
     //		foreach ($party->getMembers() as $member)
     //		{
     //			$member instanceof SR_Player;
     //			$member->effectsReset();
     //		}
     return $party->ntice('5182');
     // 		$party->notice("The party goes to sleep. You go to your {$b}own{$b} bedroom.");
 }
Exemple #15
0
 public static function execute(SR_Player $player, array $args)
 {
     $p = $player->getParty();
     if (false !== ($city = $p->getCityClass())) {
         if ($city->isDungeon()) {
             self::rply($player, '1035');
             return false;
             // 				Shadowrap::instance($player)->reply('In dungeons you don\'t have mounts.');
         }
     }
     //		$i = 1;
     $format = $player->lang('fmt_sumlist');
     $out = '';
     $total = 0.0;
     $total_max = 0.0;
     foreach ($p->getMembers() as $member) {
         $member instanceof SR_Player;
         $mount = $member->getMount();
         $we = $mount->calcMountWeight();
         $max = $mount->getMountWeightB();
         $total += $we;
         $total_max += $max;
         if ('' !== ($weight = $mount->displayWeight())) {
             // 				$weight = "({$weight})";
         }
         $out .= sprintf($format, $member->getEnum(), $mount->getName(), $weight);
         // 			$out .= sprintf(", \x02%s\x02-%s%s", $member->getEnum(), $mount->getName(), $weight);
     }
     return self::rply($player, '5083', array(Shadowfunc::displayWeight($total), Shadowfunc::displayWeight($total_max), ltrim($out, ',; ')));
     // 		$message = sprintf('Party Mounts(%s/%s): %s.', Shadowfunc::displayWeight($total), Shadowfunc::displayWeight($total_max), substr($out, 2));
     return Shadowrap::instance($player)->reply($message);
 }
Exemple #16
0
 public static function execute(SR_Player $player, array $args)
 {
     $p = $player->getParty();
     if (false === ($location = $p->getLocationClass('outside'))) {
         return self::rply($player, '1031');
         // 			return $player->message('This command only works when you are outside a location.');
     }
     $bot = Shadowrap::instance($player);
     $loc = $location->getName();
     if (count($args) > 1) {
         return $bot->reply(Shadowhelp::getHelp($player, 'hijack'));
     }
     $victims = array();
     foreach (Shadowrun4::getParties() as $pa) {
         $pa instanceof SR_Party;
         if (false === ($city = $pa->getCityClass())) {
             continue;
             # not even city
         }
         # Hax!
         if ($city->isDungeon() && $city->getCityLocation() === $loc || $pa->getLocation('inside') === $loc) {
             foreach ($pa->getMembers() as $pl) {
                 $pl instanceof SR_Player;
                 if ($pl->hasEquipment('mount')) {
                     $victims[] = $pl;
                 }
             }
         }
     }
     if (count($victims) === 0) {
         self::rply($player, '5128');
         return false;
         // 			return $player->message('You see no mounts from other players to rob.');
     }
     $format = $player->lang('fmt_sumlist');
     if (count($args) === 0) {
         $out = '';
         foreach ($victims as $i => $victim) {
             $victim instanceof SR_Player;
             $mount = $victim->getMount();
             $out .= sprintf($format, $i + 1, $victim->getName(), $mount->getName());
             // 				$out .= sprintf(", \x02%s\x02-%s(%s)", ($i+1), $victim->getName(), $mount->getName());
         }
         return self::rply($player, '5130', array(ltrim($out, ',; ')));
         // 			return $bot->reply(substr($out, 2));
     }
     if (false === ($target = Shadowfunc::getTarget($victims, $args[0], true))) {
         self::rply($player, '5128');
         // 			$player->message('You see no mounts from other players to rob.');
         return false;
     }
     $mount = $target->getMount();
     if ($mount->getMountWeight() === 0) {
         self::rply($player, '1037');
         // 			$player->message('This mount cannot store anything.');
         return false;
     }
     return $mount->initHijackBy($player);
 }
Exemple #17
0
 public static function execute(SR_Player $player, array $args)
 {
     if (count($args) === 0) {
         Shadowrap::instance($player)->reply(Shadowhelp::getHelp($player, 'gmm'));
         return false;
     }
     return self::sendGlobalMessage("[Shadowlamb] " . implode(' ', $args));
 }
Exemple #18
0
 public static function execute(SR_Player $player, array $args)
 {
     if (false === self::checkLeader($player)) {
         return false;
     }
     if (count($args) !== 1) {
         $player->message(Shadowhelp::getHelp($player, 'goto'));
         return false;
     }
     $party = $player->getParty();
     $cityname = $party->getCity();
     $cityclass = $party->getCityClass();
     $bot = Shadowrap::instance($player);
     if (false === self::checkMove($party)) {
         return false;
     }
     if (false === ($tlc = self::getTLCByArg($player, $args[0]))) {
         self::rply($player, '1069');
         // 			$player->message('This location is unknown or ambigious.');
         return false;
     }
     if (false === ($target = $cityclass->getLocation($tlc))) {
         self::rply($player, '1070', array($cityname));
         // 			$bot->reply(sprintf('The location %s does not exist in %s.', $tlc, $cityname));
         return false;
     }
     $tlc = $target->getName();
     if (!$player->hasKnowledge('places', $tlc)) {
         self::rply($player, '1023');
         // 			$bot->reply(sprintf('You don`t know where the %s is.', $tlc));
         return false;
     }
     if ($party->getLocation('inside') === $tlc) {
         self::rply($player, '1071', array($tlc));
         // 			$bot->reply(sprintf('You are already in %s.', $tlc));
         return false;
     }
     if ($party->getLocation('outside') === $tlc) {
         if ($party->getLocationClass()->isEnterAllowed($player)) {
             return $target->onEnter($player);
         } else {
             self::rply($player, '1118');
             return false;
         }
     }
     if ($party->getAction() === SR_Party::ACTION_GOTO && $party->getTarget() === $tlc) {
         self::rply($player, '5127', array($tlc, $party->displayETA()));
         // 			$bot->reply(sprintf('You are already going to %s. ETA: %s.', $tlc, $party->displayETA()));
         return false;
     }
     $cityclass = $party->getCityClass();
     $eta = $cityclass->getGotoETA($party);
     $party->pushAction(SR_Party::ACTION_GOTO, $tlc, $eta);
     $party->setContactEta(rand(5, 15));
     $party->ntice('5127', array($tlc, $party->displayETA()));
     // 		$party->notice(sprintf('You are going to %s. ETA: %s.', $tlc, GWF_Time::humanDuration($eta)));
     return true;
 }
Exemple #19
0
 public function onScanLevel4(SR_Player $player, SR_Player $target)
 {
     $message = Shadowfunc::getCyberware($target, '5306', $player);
     if ($player->isFighting()) {
         $player->message($message);
     } else {
         Shadowrap::instance($player)->reply($message);
     }
 }
Exemple #20
0
 protected function reply(SR_Player $player, $message)
 {
     if ($player->isFighting()) {
         $player->message($message);
     } else {
         Shadowrap::instance($player)->reply($message);
     }
     return true;
 }
Exemple #21
0
 public function onScanLevel5(SR_Player $player, SR_Player $target)
 {
     $message = Shadowfunc::getSpells($target, '5307');
     if ($player->isFighting()) {
         $player->message($message);
     } else {
         Shadowrap::instance($player)->reply($message);
     }
 }
Exemple #22
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) !== 1 || $args[0] !== 'DOIT!') {
         return $bot->reply(Shadowhelp::getHelp($player, 'Shadowcmd_gmlangfiles'));
     }
     if (false === SR_Install::onCreateLangFiles()) {
         return $bot->reply('An error occured!');
     }
     return $bot->reply('Lang files have been recreated. use .langflush to reload.');
 }
Exemple #23
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     $path = Shadowrun4::getShadowDir() . 'dog_module/Shadowlamb/shadowlamb_motd.txt';
     if (false === ($motd = @file_get_contents($path))) {
         $bot->reply('Can not read ' . $path);
     }
     return $bot->rply('5249', array($motd));
     // 		$bot->reply(sprintf('Message of the day: %s', $motd));
     // 		return true;
 }
Exemple #24
0
 public static function execute(SR_Player $player, array $args)
 {
     if (count($args) === 0) {
         Shadowrap::instance($player)->reply(Shadowhelp::getHelp($player, 'gmn'));
         return false;
     }
     $message = "[Shadowlamb] " . implode(' ', $args);
     foreach (Shadowrun4::getPlayers() as $player) {
         $player instanceof SR_Player;
         $player->message($message);
     }
     return true;
 }
Exemple #25
0
 public function onScanLevel1(SR_Player $player, SR_Player $target)
 {
     #$message = $target->getName().': '.Shadowfunc::getStatus($target);
     $message = Shadowfunc::getStatus($target, '5301');
     $message2 = Shadowfunc::getEquipment($target, '5303');
     if ($player->isFighting()) {
         $player->message($message);
         $player->message($message2);
     } else {
         Shadowrap::instance($player)->reply($message);
         Shadowrap::instance($player)->reply($message2);
     }
 }
Exemple #26
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) !== 1) {
         $bot->reply(Shadowhelp::getHelp($player, 'examine'));
         return false;
     }
     if (false === ($item = $player->getItem($args[0]))) {
         self::rply($player, '1020', array($args[0]));
         # don't know item
         return false;
     }
     return self::rply($player, '5049', array($item->getItemInfo($player)));
 }
Exemple #27
0
 public function onItemUse(SR_Player $player, array $args)
 {
     $p = $player->getParty();
     if (false === ($l = $p->getLocationClass(SR_Party::ACTION_INSIDE))) {
         $player->msg('hlp_cyberdeck');
         // 			$player->message('This item only works inside locations with computers.');
         return false;
     }
     $computers = $l->getComputers();
     $bot = Shadowrap::instance($player);
     if (count($computers) === 0) {
         $player->msg('hlp_cyberdeck_targets');
         // 			$bot->reply('You don\'t see any Computers with a Headcomputer interface here.');
         return false;
     }
     if (count($args) !== 1) {
         $i = 1;
         $format = $player->lang('fmt_rawitems');
         $out = '';
         foreach ($computers as $pc) {
             $out .= sprintf($format, $i++, $pc);
             // 				$out .= sprintf(", \x02%s\x02-%s", $i++, $pc);
         }
         return $bot->rply('5202', array(substr($out, 2)));
         // 			$bot->reply(sprintf('Possible targets: %s.', substr($out, 2)));
         // 			return true;
     }
     if (false === ($computer = $this->getComputerTarget($player, $computers, $args[0]))) {
         $bot->rply('1012');
         # The target is unknown.
         // 			$bot->reply('The target computer is invalid.');
         return false;
     }
     if (false === ($computer = SR_Computer::getInstance($computer, $l))) {
         $bot->reply('Database error.');
         return false;
     }
     if (!$player->hasHeadcomputer()) {
         $bot->rply('1050', array('headcomputer'));
         // 			$bot->reply('You don\'t have a headcomputer.');
         return false;
     }
     if ($player->getBase('computers') < 0) {
         $bot->rply('1025', 'computers');
         // 			$bot->reply('You need to learn the computers skill first.');
         return false;
     }
     $computer->onHack($player, $this);
     return true;
 }
Exemple #28
0
 public function on_learn(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) !== 1) {
         $this->on_courses($player, array());
         return false;
     }
     if (false !== ($data = $this->getFieldData($player, $args[0]))) {
         $price = Shadowfunc::calcBuyPrice($data[1], $player);
         return $this->onLearn($player, $data[0], $price);
     }
     $this->on_courses($player, array());
     return false;
 }
Exemple #29
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) !== 1) {
         $bot->reply(Shadowhelp::getHelp($player, 'debug'));
         return true;
     }
     $total_amt = 0;
     foreach ($player->getAllItems() as $item) {
         $item instanceof SR_Item;
         $total_amt += $item->getAmount();
         printf("%99s: %20s %10s\n", $item->getItemName(), $item->getAmount() . 'x' . $item->getItemWeight(), $item->getItemWeightStacked());
     }
     printf("%99s: %20s %10s\n", 'Total weight according to stats', $total_amt . ' items', $player->get('weight'));
 }
Exemple #30
0
 public static function execute(SR_Player $player, array $args)
 {
     if (count($args) === 0) {
         Shadowrap::instance($player)->reply(Shadowhelp::getHelp($player, 'shout'));
         return false;
     }
     $wait = SR_NoShout::isNoShout($player->getID());
     if ($wait > 0) {
         $player->msg('1044', array(GWF_Time::humanDuration($wait)));
         // 			$player->message(sprintf('Please wait %s before you shout again.', GWF_Time::humanDuration($wait)));
         return false;
     }
     Shadowshout::shout($player, implode(' ', $args));
     return true;
 }