Ejemplo n.º 1
0
 private function onBuyStorage(SR_Player $player, SR_Clan $clan, array $args)
 {
     $dadd = Shadowfunc::displayWeight(self::ADD_STORAGE);
     $dcost = Shadowfunc::displayNuyen(self::COST_STORAGE);
     if (count($args) !== 2 || $args[1] !== self::CONFIRM_PHRASE) {
         return $player->msg('5170', array($clan->displayMaxStorage(), $dadd, $dcost, self::CONFIRM_PHRASE));
         // 			$player->message(sprintf(
         // 				'Your clan currently can store %s. Another %s would cost you %s. Please type #manage buystorage %s to confirm.',
         // 				$clan->displayMaxStorage(), $dadd, $dcost, self::CONFIRM_PHRASE
         // 			));
         // 			return true;
     }
     if ($clan->getMaxStorage() >= SR_Clan::MAX_STORAGE) {
         $player->msg('5171', array($clan->displayNuyen(), $clan->displayMaxNuyen()));
         // 			$player->message(sprintf('Your clan has already reached the maximum of %s/%s storage.', $clan->displayStorage(), $clan->displayMaxStorage()));
         return false;
     }
     if (false === $player->hasNuyen(self::COST_STORAGE)) {
         $player->msg('1063', array($dcost, $player->displayNuyen()));
         // 			$player->message(sprintf('It would cost %s to buy another %s of clan storage, but you only got %s.',
         // 				$dcost, $dadd, $player->displayNuyen()
         // 			));
         return false;
     }
     if (false === $player->giveNuyen(-self::COST_STORAGE)) {
         $player->message('DB ERROR 2');
         return false;
     }
     if (false === $clan->addStorage(self::ADD_STORAGE)) {
         $player->message('DB ERROR 2');
         return false;
     }
     $player->msg('5172', array($dcost, $clan->displayStorage(), $clan->displayMaxStorage()));
     // 		$player->message(sprintf(
     // 			'You paid %s and your clan has now a max storage of %s/%s.',
     // 			$dcost, $clan->displayStorage(), $clan->displayMaxStorage()
     // 		));
     return SR_ClanHistory::onAddStorage($clan, $player);
 }