Beispiel #1
0
 public static function execute(SR_Player $player, array $args)
 {
     if ('' === ($message = trim(implode(' ', $args)))) {
         return false;
     }
     $p = $player->getParty();
     $ep = $p->getEnemyParty();
     $pname = $player->getName();
     if ($p->isTalking() && $ep !== false) {
         $p->ntice('5085', array($pname, $message));
         $ep->ntice('5085', array($pname, $message));
         $p->setContactEta(60);
         $el = $ep->getLeader();
         if ($el->isNPC()) {
             $ep->setContactEta(60);
             $el->onNPCTalkA($player, isset($args[0]) ? $args[0] : 'hello', $args);
         }
     } elseif ($p->isAtLocation()) {
         Shadowshout::onLocationGlobalMessage($player, '5085', array($pname, $message));
     } elseif ($p->isFighting()) {
         $p->ntice('5085', array($pname, $message));
         $ep->ntice('5085', array($pname, $message));
     } else {
         $p->ntice('5085', array($pname, $message));
     }
     return true;
 }
Beispiel #2
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;
 }
Beispiel #3
0
 private function announceKilled(SR_Player $killer)
 {
     $famous = $this->isRunner() ? 'famous' : 'newbie';
     $famous2 = $killer->isRunner() ? 'famous' : 'newbie';
     $npchuman = $killer->isHuman() ? 'runner' : 'NPC';
     $message = sprintf('[Shadowlamb] - The %s runner %s got killed by the %s %s %s', $famous, $this->getName(), $famous2, $npchuman, $killer->getName());
     Shadowshout::sendGlobalMessage($message);
 }
Beispiel #4
0
 public static function sendGlobalMessage($message)
 {
     return Shadowshout::sendGlobalMessage($message);
 }
Beispiel #5
0
 public function on_push(SR_Player $player, array $args)
 {
     if (count($args) < 2 || count($args) > 3) {
         $player->message(Shadowhelp::getHelp($player, 'bazar_push'));
         return false;
     }
     //		$nSlots = $this->getBazarSlots($player);
     $pname = $player->getName();
     $iname = $args[0];
     $price = round($args[1]);
     if ($price < self::MIN_PRICE) {
         $player->msg('1109', array(Shadowfunc::displayNuyen(self::MIN_PRICE)));
         // 			$player->message(sprintf('The minimum price for an item is %s.', Shadowfunc::displayNuyen(self::MIN_PRICE)));
         return false;
     }
     if ($price > self::MAX_PRICE) {
         $player->msg('1110');
         // 			$player->message("Your price exceeds the max price.");
         return false;
     }
     $amt = isset($args[2]) ? (int) $args[2] : 0;
     if ($amt < 0) {
         $player->msg('1038');
         // 			$player->message("Please push a positive amount into your bazar.");
         return false;
     }
     $amt = Common::clamp($amt, 1);
     if (false === ($item = $player->getInvItem($iname))) {
         $player->msg('1029');
         // 			$player->message("You don't have this item in your inventory.");
         return false;
     }
     $iname = $item->getItemName();
     $bitem = SR_BazarItem::getBazarItem($pname, $iname);
     if ($bitem === false) {
         if (!$this->hasFreeSlot($player)) {
             $player->msg('1111');
             // 				$player->message("All your bazar slots are in use. Try #pop or #buyslot.");
             return false;
         }
         if (false === SR_BazarShop::createShop($pname)) {
             $player->message('Database Error 6!');
             return false;
         }
         if (false === ($shop = SR_BazarShop::getShop($pname))) {
             $player->message('Database Error 10!');
             return false;
         }
         # Stacked
         if ($item->isItemStackable()) {
             if ($amt > $item->getAmount()) {
                 $player->msg('1040', array($item->getItemName()));
                 // 					$player->message(sprintf("You only have %d of %s but you want to push %d.", $item->getAmount(), $item->getItemName(), $amt));
                 return false;
             }
             if (false === $item->useAmount($player, $amt)) {
                 $player->message('Database Error 1!');
                 return false;
             }
             if (false === SR_BazarItem::insertBazarItem($player->getName(), $iname, $price, $amt)) {
                 $player->message('Database Error 2!');
                 return false;
             }
         } else {
             $items = $player->getInvItems($iname, $amt);
             if (count($items) < $amt) {
                 $player->msg('1040', array($item->getItemName()));
                 // 					$player->message(sprintf("You only have %d of %s but you want to push %d.", count($items), $iname, $amt));
                 return false;
             }
             foreach ($items as $item2) {
                 $item2 instanceof SR_Item;
                 $player->removeItem($item2);
                 $item2->delete();
             }
             if (false === SR_BazarItem::insertBazarItem($player->getName(), $iname, $price, $amt)) {
                 $player->message('Database Error 3!');
                 return false;
             }
         }
         //			if (false === ($shop->increase('sr4bs_itemcount', 1)))
         //			{
         //				$player->message('Database Error 12!');
         //				return false;
         //			}
         if (false === $shop->fixItemCount()) {
             $player->message('Database Error 21!');
         }
         $price2 = $this->calcBuyPrice($price);
         $dprice = Shadowfunc::displayNuyen($price2);
         $player->msg('5153', array($amt, $iname, $dprice));
         # Global shout.
         Shadowshout::sendGlobalMessage(sprintf('%s offers %d x %s for %s each in their bazaar.', $player->getName(), $amt, $iname, $dprice));
         return true;
         // 			return $player->message(sprintf('You now offer %d %s for %s each in your bazar.', $amt, $iname, $dprice));
     } else {
         if (false === ($shop = SR_BazarShop::getShop($pname))) {
             $player->message('Database Error 16!');
             return false;
         }
         # Stacked
         if ($item->isItemStackable()) {
             if ($item->getAmount() < $amt) {
                 $player->msg('1040', array($iname));
                 // 					$player->message(sprintf('You want to push %s %s, but you only have %s.', $amt, $iname, $item->getAmount()));
                 return false;
             }
             if (false === $item->useAmount($player, $amt)) {
                 $player->message('Database Error 4!');
                 return false;
             }
         } else {
             $items2 = $player->getInvItems($iname, $amt);
             if (count($items2) < $amt) {
                 $player->msg('1040', array($iname));
                 // 					$player->message(sprintf('You want to push %d %s but you only got %d.', $amt, $iname, count($items2)));
                 return false;
             }
             foreach ($items2 as $item2) {
                 $item2 instanceof SR_Item;
                 if (false === $item2->deleteItem($player)) {
                     $player->message('Database Error 6!');
                     return false;
                 }
             }
         }
         if (false === $bitem->increase('sr4ba_iamt', $amt)) {
             $player->message('Database Error 4!');
             return false;
         }
         if (false === $shop->fixItemCount()) {
             $player->message('Database Error 21!');
         }
         if (false === $bitem->saveVar('sr4ba_price', $price)) {
             $player->message('Database Error 5!');
             return false;
         }
         $amt = $bitem->getVar('sr4ba_iamt');
         $price2 = $this->calcBuyPrice($price);
         $dprice = Shadowfunc::displayNuyen($price2);
         $player->msg('5153', array($amt, $iname, $dprice));
         // 			return $player->message(sprintf('You now offer %d %s in your bazar for %s each.', $bitem->getVar('sr4ba_iamt'), $iname, Shadowfunc::displayNuyen($price2)));
     }
 }