Пример #1
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;
 }
Пример #2
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;
 }
Пример #3
0
 public static function onFlee(SR_Player $player)
 {
     $party = $player->getParty();
     $ep = $party->getEnemyParty();
     $party->ntice('5113', array($player->getName()));
     $ep->ntice('5114', array($player->getName()));
     // 		$party->notice(sprintf('%s has fled from the enemy.', $player->getName()));
     // 		$ep->notice(sprintf('%s has fled from combat.', $player->getName()));
     $player->resetXP();
     $party->kickUser($player, true);
     $np = SR_Party::createParty();
     $np->addUser($player, true);
     $np->cloneAction($party);
     $np->clonePreviousAction($party);
     $np->popAction(true);
     if ($np->isInsideLocation()) {
         $np->pushAction(SR_Party::ACTION_OUTSIDE);
     }
 }
Пример #4
0
 public function respawn()
 {
     $this->sr4_effects = array();
     $this->updateEffects();
     $party = $this->getParty();
     $city = $party->getCityClass();
     $singleplayer = $party->getMemberCount() === 1;
     $party->kickUser($this, true);
     $oldlevel = $party->getPartyLevel();
     $newlevel = (int) round($oldlevel / 2);
     $new_party = SR_Party::createParty();
     $new_party->addUser($this, true);
     if ($singleplayer) {
         $new_party->savePartyLevel($newlevel);
     } else {
         $party->savePartyLevel($newlevel);
     }
     $location = $city === false ? 'Redmond_Hotel' : $city->getRespawnLocation($this);
     //		$location = $city->getRespawnLocation();
     $new_party->pushAction(SR_Party::ACTION_INSIDE, $location);
     $this->updateField('partyid', $new_party->getID());
     $this->msg('5252', array($location));
     // 		$this->message(sprintf('You respawn at %s.', $location));
     $this->heal('hp', 20);
     $this->heal('mp', 10);
 }
Пример #5
0
 /**
  * Create a single NPC, optionally make it join a party. Else create blank party.
  * @param string $classname
  * @param NULL|SR_Party $party
  * @return SR_NPC
  */
 public static function createEnemyNPC($classname, $party = NULL)
 {
     if (false === ($npc = Shadowrun4::getNPC($classname))) {
         return Dog_Log::error('Unknown NPC classname in createEnemyNPC: ' . $classname);
     }
     if ($party === NULL) {
         if (false === ($party = SR_Party::createParty())) {
             return Dog_Log::error('Cannot create party in createEnemyNPC.');
         }
     } elseif (!$party instanceof SR_Party) {
         return Dog_Log::error('WRONG ARG IN in createEnemyNPC: ' . $party);
     }
     if (false === ($npc = $npc->spawn($party))) {
         return Dog_Log::error('Failed to spawn NPC: ' . $npc->getNPCClassName());
     }
     if (false === $party->updateMembers()) {
         return Dog_Log::error('DB ERROR IN in createEnemyNPC.');
     }
     $party->recomputeEnums();
     return $npc;
 }
Пример #6
0
 private function onStealCombat(SR_Player $player, $itemname)
 {
     $bot = Shadowrap::instance($player);
     $bot->rply('5196');
     // 		$bot->reply('You are out of luck ... the shop owner silently called the cops ...');
     SR_BadKarma::addBadKarma($player, self::BAD_KARMA_STEAL_COMBAT);
     $p = $player->getParty();
     $p->kickUser($player);
     $np = SR_Party::createParty();
     $np->addUser($player, true);
     $np->cloneAction($p);
     $np->clonePreviousAction($p);
     $np->fight(SR_NPC::createEnemyParty('Prison_GrayOp', 'Prison_GrayOp', 'Prison_GrayOp'));
     return true;
 }