示例#1
0
文件: world.php 项目: sinfocol/gwf3
 public static function execute(SR_Player $player, array $args)
 {
     return self::rply($player, '5241', array(SR_NPC::$NPC_COUNTER, Shadowrun4::getCityCount(), SR_Location::$LOCATION_COUNT, SR_Item::getTotalItemCount(), SR_Spell::getTotalSpellCount(), SR_Quest::getTotalQuestCount(), Shadowcmd::translate('stats')));
     // 		$bot = Shadowrap::instance($player);
     // 		$message = sprintf('In Shadowlamb v3 there are: %s different NPC in %s Areas with %s Locations. %s Items, %s Spells and %s Quests. Try #stats to show how many are playing.', SR_NPC::$NPC_COUNTER, Shadowrun4::getCityCount(), SR_Location::$LOCATION_COUNT, SR_Item::getTotalItemCount(), SR_Spell::getTotalSpellCount(), SR_Quest::getTotalQuestCount());
     // 		return $bot->reply($message);
 }
示例#2
0
 public function giveXP($xp)
 {
     $b = chr(2);
     if ($xp <= 0) {
         return false;
     }
     if (false === $this->alterField('xp', $xp)) {
         return false;
     }
     if (false === $this->alterField('xp_total', $xp)) {
         return false;
     }
     if (false === $this->alterField('xp_level', $xp)) {
         return false;
     }
     $level = 0;
     $karma = 0;
     while ($this->getBase('xp_level') >= ($xppl = $this->getXPPerLevel())) {
         $this->alterField('level', 1);
         $this->alterField('xp_level', -$xppl);
         $level++;
     }
     if ($level > 0) {
         $this->getParty()->notice(sprintf("{$b}%s{$b} reached {$b}level %s(+%d){$b}.", $this->getName(), $this->getBase('level'), $level));
         $karma += $this->getBase('level');
     }
     while ($this->getBase('xp') >= ($xppk = $this->getXPPerKarma())) {
         $this->alterField('xp', -$xppk);
         $karma++;
     }
     if ($karma > 0) {
         $this->giveKarma($karma);
         $this->msg('5251', array($this->getBase('karma'), $karma, Shadowcmd::translate('lvlup')));
         // 			$this->message(sprintf("You now have {$b}%d(+%d) karma{$b}. With karma you can #lvlup.", $this->getBase('karma'), $karma));
     }
     if ($karma > 0 || $level > 0) {
         $this->modify();
     }
 }
示例#3
0
 public function on_unpierce(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) > 1) {
         $bot->reply(Shadowhelp::getHelp($player, 'unpierce'));
         return false;
     }
     if (!$player->hasEquipment('piercing')) {
         $bot->rply('1182');
         return false;
     }
     if (false === ($piercing = $player->getEquipment('piercing'))) {
         $bot->reply('Database error 3');
         return false;
     }
     $price = Shadowfunc::calcBuyPrice($this->getPriceUnpierce(), $player);
     $dprice = Shadowfunc::displayNuyen($price);
     if (!isset($args[0]) || $args[0] !== self::CONFIRM_UNPIERCE) {
         return $bot->rply('5288', array($dprice, $piercing->displayFullName($player), Shadowcmd::translate('unpierce'), self::CONFIRM_UNPIERCE));
     }
     if (!$player->hasNuyen($price)) {
         $bot->rply('1063', array($dprice, $player->displayNuyen()));
         return false;
     }
     $player->unsetEquipment('piercing');
     // 		if (!$player->updateEquipment('piercing', NULL))
     // 		{
     // 			$bot->reply('Database error 1');
     // 			return false;
     // 		}
     if (!$piercing->deleteItem($player)) {
         $bot->reply('Database error 2');
         return false;
     }
     $player->modify();
     return $bot->rply('5289', array($dprice, $piercing->displayFullName($player)));
 }
示例#4
0
 private function onBuyslotInfo(SR_Player $player)
 {
     $pname = $player->getName();
     if (false === ($shop = SR_BazarShop::getShop($pname))) {
         $used_slots = 0;
     } else {
         $used_slots = SR_BazarItem::getUsedSlots($pname);
     }
     $avail_slots = $this->getBazarSlots($player);
     $price = $this->calcBuySlotPrice($player);
     $player->msg('5157', array($used_slots, $avail_slots, Shadowfunc::displayNuyen($price), Shadowcmd::translate('buyslot')));
     // 		return $player->message(sprintf('You currently have %d of %d bazar slots in use. Another slot would cost you %s. Type #buyslot yesplease to confirm.', $used_slots, $avail_slots, Shadowfunc::displayNuyen($price)));
 }