Example #1
0
 public static function execute(SR_Player $player, array $args)
 {
     $p = $player->getParty();
     $a = $p->getAction();
     if (true === $p->isTalking()) {
         if (false === ($ep = $p->getEnemyParty())) {
             self::reply($player, 'Cannot get enemy party! (tell gizmore)');
             return false;
         }
         if (false === self::checkKillProtection($player, $ep)) {
             return false;
         }
         $p->popAction();
         $ep->popAction();
         $p->fight($ep, true);
         return true;
     }
     if ($a === SR_Party::ACTION_INSIDE || $a === SR_Party::ACTION_OUTSIDE) {
         $bot = Shadowrap::instance($player);
         if (count($args) !== 1) {
             $bot->reply(Shadowhelp::getHelp($player, 'fight'));
             return false;
         }
         if (false === ($target = Shadowfunc::getPlayerInLocation($player, $args[0]))) {
             self::rply($player, '1028', array($args[0]));
             // 				$bot->reply(sprintf('%s is not here.', $args[0]));
             return false;
         }
         if (false === ($ep = $target->getParty())) {
             self::reply($player, 'Cannot get enemy party! (tell gizmore)');
             return false;
         }
         if (false === self::checkKillProtection($player, $ep)) {
             return false;
         }
         $p->fight($ep, true);
         return true;
     }
     return false;
 }