示例#1
0
文件: givekp.php 项目: sinfocol/gwf3
 public static function execute(SR_Player $player, array $args)
 {
     if ($player->isFighting()) {
         $player->msg('1036');
         // 			$player->message('This does not work in combat');
         return false;
     }
     $argc = count($args);
     if ($argc < 1 || $argc > 2) {
         $player->message(Shadowhelp::getHelp($player, 'givekp'));
         return false;
     }
     if ($argc === 2) {
         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;
         }
         $place = $args[1];
         $targets = array($target);
     } else {
         $place = $args[0];
         $targets = $player->getParty()->getMembers();
     }
     if (false === ($tlc = Shadowcmd_goto::getTLCByArgMulticity($player, $place))) {
         $player->msg('1023');
         return false;
     }
     return self::giveKnow($player, $targets, 'places', $tlc);
 }
示例#2
0
文件: swapkp.php 项目: sinfocol/gwf3
 public static function execute(SR_Player $player, array $args)
 {
     if (count($args) !== 2) {
         $player->message(Shadowhelp::getHelp($player, 'swapkp'));
         return false;
     }
     if ('' === ($kp = $player->getKnowledge('places'))) {
         $player->msg('1023');
         // 			$player->message('You have no known places yet.');
         return false;
     }
     if (false === ($placeA = Shadowcmd_goto::getTLCByArg($player, $args[0]))) {
         $player->msg('1023');
         // 			$player->message(sprintf('The first place, %s, is unknown.', $args[0]));
         return false;
     }
     if (false === ($placeB = Shadowcmd_goto::getTLCByArg($player, $args[1]))) {
         $player->msg('1023');
         // 			$player->message(sprintf('The second place, %s, is unknown.', $args[1]));
         return false;
     }
     if ($placeA === $placeB) {
         $player->msg('1030');
         // 			$player->message('Swapping nothing, so bailout.');
         return false;
     }
     $all = explode(',', $kp);
     if (false === ($a = array_search($placeA, $all, true))) {
         $player->message('DB Error 1');
         return false;
     }
     if (false === ($b = array_search($placeB, $all, true))) {
         $player->message('DB Error 2');
         return false;
     }
     $all[$a] = $placeB;
     $all[$b] = $placeA;
     if (false === $player->saveBase('known_places', implode(',', $all))) {
         $player->message('DB Error 3');
         return false;
     }
     return Shadowcmd_known_places::execute($player, array());
 }
示例#3
0
 public function onCast(SR_Player $player, array $args, $wanted_level = true)
 {
     if ($this->isBrewMode()) {
         return $this->onBrew($player, 70, 4, 10);
     }
     $p = $player->getParty();
     if (!$p->isIdle()) {
         $player->msg('1033');
         // 			$player->message('This spell only works when your party is idle.');
         return false;
     }
     if (count($args) === 0) {
         $player->msg('1072');
         // 			$player->message('Please specify a target to teleport to.');
         return false;
     }
     $bot = Shadowrap::instance($player);
     if (false === ($tlc = Shadowcmd_goto::getTLCByArgMulticity($player, $args[0]))) {
         $player->msg('1069');
         // 			$player->message('The location does not exist or is ambigous.');
         return false;
     }
     $city = Common::substrUntil($tlc, '_');
     if (false === ($cityclass = Shadowrun4::getCity($city))) {
         $player->msg('1073');
         // 			$bot->reply('This city is unknown.');
         return false;
     }
     if ($cityclass->isDungeon()) {
         $player->msg('1079');
         // 			$bot->reply('You can not teleport into dungeons.');
         return false;
     }
     if (false === ($target = $cityclass->getLocation($tlc))) {
         $player->msg('1070', array($p->getCity()));
         // 			$bot->reply(sprintf('The location %s does not exist in %s.', $tlc, $city));
         return false;
     }
     $tlc = $target->getName();
     if (!$player->hasKnowledge('places', $tlc)) {
         $player->msg('1023');
         // 			$bot->reply(sprintf('You don`t know where the %s is.', $tlc));
         return false;
     }
     if ($p->getLocation() === $tlc) {
         $player->msg('1071', array($tlc));
         // 			$bot->reply(sprintf('You are already at the %s.', $tlc));
         return false;
     }
     # Imprisoned
     if (false !== ($loc = $p->getLocationClass('inside'))) {
         if (!$loc->isExitAllowed($player)) {
             $player->msg('1074');
             // 				$bot->reply('You cannot cast teleport inside this lcoation.');
             return false;
         }
     }
     # Minlevels (thx sabretooth)
     if (false === $this->checkCityTargetLimits($player, $target)) {
         return false;
     }
     $level = $this->getLevel($this->getCaster());
     $mc = $p->getMemberCount();
     $need_level = $mc / 2;
     if ($level < $need_level) {
         $player->msg('1076', array($this->getName(), $need_level, $mc));
         return false;
         // 			$bot->reply(sprintf('You need at least %s level %s to teleport %s party members.', $this->getName(), $need_level, $mc));
         // 			return false;
     }
     $need = $this->getManaCost($player, $need_level);
     $have = $player->getMP();
     if ($need > $have) {
         $player->msg('1055', array($need, $this->getName(), $need_level, $have));
         // 			$player->message(sprintf('You need %s MP to cast %s, but you only have %s.', $need, $this->getName(), $have));
         return false;
     }
     if (true === $this->isCastMode()) {
         $player->healMP(-$need);
     }
     $p->ntice('5133', array($player->getName(), $need, $this->getName(), $tlc));
     // 		$p->notice(sprintf('%s used %s MP to cast %s and your party is now outside of %s.', $player->getName(), $need, $this->getName(), $tlc));
     $p->pushAction('outside', $tlc);
     return true;
 }