示例#1
0
 private function onBuyWealth(SR_Player $player, SR_Clan $clan, array $args)
 {
     $dadd = Shadowfunc::displayNuyen(self::ADD_WEALTH);
     $dcost = Shadowfunc::displayNuyen(self::COST_WEALTH);
     if (count($args) !== 2 || $args[1] !== self::CONFIRM_PHRASE) {
         return $player->msg('5170', array($clan->displayMaxNuyen(), $dadd, $dcost, self::CONFIRM_PHRASE));
         // 			$player->message(sprintf(
         // 				'Your clan currently can bank %s. Another %s would cost you %s. Please type #manage buywealth %s to confirm.',
         // 				$clan->displayMaxNuyen(), $dadd, $dcost, self::CONFIRM_PHRASE
         // 			));
         // 			return true;
     }
     if ($clan->isMaxWealth()) {
         $player->msg('5171', array($clan->displayNuyen(), $clan->displayMaxNuyen()));
         // 			$player->message(sprintf('Your clan has already reached the maximum of %s/%s.', $clan->displayNuyen(), $clan->displayMaxNuyen()));
         return false;
     }
     if (false === $player->hasNuyen(self::COST_WEALTH)) {
         $player->msg('1063', array($dcost, $player->displayNuyen()));
         // 			$player->message(sprintf('It would cost %s to buy another %s of clan wealth, but you only got %s.',
         // 				$dcost, $dadd, $player->displayNuyen()
         // 			));
         return false;
     }
     if (false === $player->giveNuyen(-self::COST_WEALTH)) {
         $player->message('DB ERROR 2');
         return false;
     }
     if (false === $clan->addWealth(self::ADD_WEALTH)) {
         $player->message('DB ERROR 2');
         return false;
     }
     $player->msg('5172', array($dcost, $clan->displayNuyen(), $clan->displayMaxNuyen()));
     // 		$player->message(sprintf(
     // 			'You paid %s and your clan now has a max wealth of %s/%s.',
     // 			$dcost, $clan->displayNuyen(), $clan->displayMaxNuyen()
     // 		));
     return SR_ClanHistory::onAddWealth($clan, $player);
 }