当前位置: 首页>>代码示例>>PHP>>正文


PHP SR_Player::getBase方法代码示例

本文整理汇总了PHP中SR_Player::getBase方法的典型用法代码示例。如果您正苦于以下问题:PHP SR_Player::getBase方法的具体用法?PHP SR_Player::getBase怎么用?PHP SR_Player::getBase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SR_Player的用法示例。


在下文中一共展示了SR_Player::getBase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: giveNuyen

 public static function giveNuyen(SR_Player $player, SR_Player $target, $what, $amt)
 {
     if ($amt <= 0) {
         $player->msg('1062');
         // 			$player->message(sprintf('You can only give away a positive amount of %s.', $what));
         return false;
     }
     $have = $player->getBase($what);
     if ($amt > $have) {
         $player->msg('1063', array(Shadowfunc::displayNuyen($amt), Shadowfunc::displayNuyen($have)));
         // 			$player->message(sprintf('You only have %s %s.', $have, $what));
         return false;
     }
     # Thx jjk
     //		if (($have - $amt) <= SR_Player::START_NUYEN)
     //		{
     //			$player->message(sprintf('You can\'t give all your money away, you need at least %s', Shadowfunc::displayNuyen(SR_Player::START_NUYEN)));
     //			$player->message(sprintf('Maximum you can give is %s', Shadowfunc::displayNuyen($have-SR_Player::START_NUYEN)));
     //			return false;
     //		}
     if (false === $target->alterField($what, $amt)) {
         $player->message('Database error in giveNyKa()... 1');
         return false;
     }
     if (false === $player->alterField($what, -$amt)) {
         $player->message('Database error II in giveNyKa()... 2');
         return false;
     }
     $target->msg('5118', array(Shadowfunc::displayNuyen($amt), $player->getName()));
     $player->msg('5119', array(Shadowfunc::displayNuyen($amt), $target->getName()));
     // 		$target->message(sprintf('You received %s %s from %s.', $amt, $what, $player->getName()));
     // 		$player->message(sprintf('You gave %s %s %s.', $target->getName(), $amt, $what));
     return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:34,代码来源:giveny.php

示例2: onTrollReward

 private function onTrollReward(SR_NPC $npc, SR_Player $player)
 {
     $max = $player->isRunner() ? Shadowcmd_lvlup::MAX_VAL_ATTRIBUTE_RUNNER : Shadowcmd_lvlup::MAX_VAL_ATTRIBUTE;
     $base = $player->getBase('magic');
     if ($base >= $max) {
         $ny = 5000;
         $player->giveNuyen($ny);
         return $player->message($this->lang('reward_ny', array($ny)));
         // 			return $player->message('Larry hands you another 5000 nuyen!');
     }
     $player->message($this->lang('reward1'));
     // 		$player->message('Larry leads you to a shamane: "This is our shamane, Srando, he can help you."');
     $race = $player->getRace();
     if ($race === 'Ork' || $race === 'Troll') {
         $player->message($this->lang('reward2', array($race)));
         // 			$player->message('The shamane says: "You are a strong '.$race.'. You just need to calm down sometime."');
         $player->message($this->lang('reward3'));
         // 			$player->message('You are starting to argue, but the shamane continues: "If you calm you have more time to strengthen yourself. Focus yourself, and the path is clear."');
         $player->message($this->lang('reward4'));
         // 			$player->message('The shamane touches your head: "Your mind is now clear from anything. You can focus yourself from now on."');
         $player->message($this->lang('reward5'));
         // 			$player->message('Your character is now allowed to learn magic and spells.');
     } else {
         $player->message($this->lang('reward5'));
         // 			$player->message('The shamane mumbles some magic spells and raises your base value for magic by 1.');
     }
     $player->alterField('magic', 1);
     $player->modify();
     return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:30,代码来源:Troll_Maniac.php

示例3: execute

 public static function execute(SR_Player $player, array $args)
 {
     if ($player->getBase('age') > 0) {
         $player->msg('1016', array(Shadowfunc::displayASL($player)));
         // 			$player->message(sprintf("You already have your asl set to: %s.", Shadowfunc::displayASL($player)));
         return false;
     }
     if (count($args) === 0) {
         $player->message(self::getASLSetHelp($player));
         return false;
     }
     if (count($args) === 1 && $args[0] === 'RANDOM') {
         return self::onASLSetRandom($player);
     }
     $arg = implode(' ', $args);
     $age = round(self::parseValue($arg, 'y'));
     $bmi = round(self::parseValue($arg, 'kg') * 1000);
     $height = self::parseValue($arg, 'cm');
     if ($height > 1 && $height < 2) {
         // 			$player->message(sprintf('Auto corrected your height "%.03f" to "%dcm"', $height, round($height*100)));
         $height = round($height * 100);
     }
     $errors = '';
     $errors .= self::validateAge($player, $age);
     $errors .= self::validateHeight($player, $height);
     $errors .= self::validateBMI($player, $bmi, $height);
     if ($errors !== '') {
         $message = sprintf('Error: %s.', $errors);
         self::reply($player, $message);
         $player->message(self::getASLSetHelp($player));
         return false;
     }
     return self::onASLSetCustom($player, $age, $bmi, $height);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:34,代码来源:aslset.php

示例4: beamToRedmond

 private static function beamToRedmond(SR_Player $player)
 {
     $p = $player->getParty();
     $xp = $player->getBase('xp');
     $player->resetXP();
     $player->msg('5299', array(self::BEAM_TARGET));
     # Your XP stack got reset and you get beamed back to %s.
     $p->pushAction(SR_Party::ACTION_INSIDE, self::BEAM_TARGET);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:9,代码来源:redmond.php

示例5: alchemicFactory

 public static function alchemicFactory(SR_Player $player, $spellname, $level)
 {
     $ma = $player->get('magic');
     $in = $player->get('intelligence');
     $wi = $player->get('wisdom');
     $alc = $player->get('alchemy');
     # 10 - 80 percent randomness
     $randomness = 100 - ($wi + $alc * 2 + $in + $ma);
     $randomness = Common::clamp($randomness, 10, 80);
     $randomness = Shadowfunc::diceFloat(10, $randomness) * 0.01;
     # Dice!
     $minlevel = round($level - $level * $randomness, 1);
     $maxlevel = $level;
     $level = Shadowfunc::diceFloat($minlevel, $maxlevel, 1);
     $potion = SR_Item::createByName('AlchemicPotion');
     $potion->addModifiers(array($spellname => $level, 'magic' => $player->getBase('magic'), 'intelligence' => $player->getBase('intelligence'), 'wisdom' => $player->getBase('wisdom')));
     return $potion;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:18,代码来源:AlchemicPotion.php

示例6: getShoutWait

 private static function getShoutWait(SR_Player $player)
 {
     $range = self::MAX_DELAY - self::MIN_DELAY;
     $tpl = $range / self::MAX_LEVEL;
     $level = Common::clamp($player->getBase('level'), 0, self::MAX_LEVEL);
     $delay = self::MIN_DELAY + $tpl * (self::MAX_LEVEL - $level);
     $last = $player->hasTemp(self::TEMP_KEY) ? $player->getTemp(self::TEMP_KEY) : 0;
     $next = $last + $delay;
     return $next - time();
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:10,代码来源:Shadowshout.php

示例7: displayBountyPlayer

 public static function displayBountyPlayer(SR_Player $player)
 {
     $bounty = $player->getBase('bounty');
     if ($bounty <= 0) {
         return $player->lang('no_bounty');
         # This player has no bounty.
     }
     $total = Shadowfunc::displayNuyen($bounty);
     return $player->lang('total_bounty', array($total, $player->getName(), self::displayBountyPlayerDetails($player)));
     // 		return sprintf("There is a total {$b}bounty of %s{$b} for %s: %s.", $total, $player->getName(), self::displayBountyPlayerDetails($player));
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:11,代码来源:SR_Bounty.php

示例8: onASLShowPlayer

 public static function onASLShowPlayer(SR_Player $player, array $args)
 {
     $b = chr(2);
     if ($player->getBase('age') > 0) {
         return self::rply($player, '5012', array(Shadowfunc::displayASL($player), self::translate('asl')));
         // 			return self::reply($player, sprintf("Your asl: %s. Use #asl [<age|bmi|height>] for party sums.", Shadowfunc::displayASL($player)));
     } else {
         $player->msg('1011', array(self::translate('aslset')));
         // 			$player->message(sprintf("You did not setup your asl with {$b}#aslset{$b} yet. You need to do this to start moving in the game."));
         return false;
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:12,代码来源:asl.php

示例9: getReward

 public function getReward(SR_Player $player)
 {
     $possible = array(array('LO_Rune_of_attack:0.3', 'Rune_of_body:0.5'));
     if ($player->getBase('bows') >= 0) {
         $possible[] = array('SportBow_of_bows:1,attack:1', 'Ammo_Arrow', 'Ammo_Arrow');
     }
     if ($player->getBase('pistols') >= 0) {
         $possible[] = array('AresPredator_of_attack:1,max_dmg:1', 'Ammo_9mm');
     }
     if ($player->getBase('ninja') >= 0) {
         $possible[] = array('NinjaSword');
     }
     if ($player->getBase('magic') >= 0) {
         $possible[] = array('ElvenStaff_of_magic:2,max_hp:2');
     }
     $reward = $possible[array_rand($possible, 1)];
     $back = array();
     foreach ($reward as $itemname) {
         $back[] = SR_Item::createByName($itemname);
     }
     return $back;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:22,代码来源:Seattle_BD1.php

示例10: meleeSkill

 private function meleeSkill(SR_Player $player, $word)
 {
     if ($player->getBase('melee') >= 0) {
         return true;
     }
     $this->rply('unsure');
     // 		$this->reply('MMMh... You are unsure about your path...');
     $player->message($this->langNPC('confident'));
     // 		$player->message('The monk strengthens your self confidence... You have learned the melee skill!');
     $player->levelupFieldTo('melee', 0);
     // 		$player->updateField('melee', 0);
     // 		$player->modify();
     return false;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:14,代码来源:Ninja.php

示例11: onPraySins

 private function onPraySins(SR_Player $player, $price)
 {
     $nuyen = $player->getNuyen();
     $dp = Shadowfunc::displayNuyen($price);
     $dn = Shadowfunc::displayNuyen($nuyen);
     if ($price > $nuyen) {
         return $this->rply('cost', array($dp, $dn));
         // 			return $this->reply(sprintf('My son, it would cost %s to forgive your sins, but you have only %s.', $dp, $dn));
     }
     $player->giveNuyen(-$price);
     $dl = Shadowfunc::displayNuyen($nuyen - $price);
     $player->message($this->langNPC('pay', array($dp, $dl)));
     // 		$player->message("You pay the price of {$dp} and have {$dl} left.");
     $player->alterField('bad_karma', -1);
     $badkarma = $player->getBase('bad_karma');
     return $this->rply('thx', array($badkarma));
     // 		return $this->reply("Thank you my son. You now have only {$badkarma} bad karma left.");
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:18,代码来源:Priest.php

示例12: onSolveDuo

 public function onSolveDuo(SR_Player $player)
 {
     $this->msg('solve2a');
     $this->msg('solve2b');
     // 		$player->message('The dwarfs look very pleased.');
     // 		$player->message('"Thank you so much", Aron says, "For your help we have thought of a special reward..."');
     $max = $player->isRunner() ? Shadowcmd_lvlup::MAX_VAL_SKILL_RUNNER : Shadowcmd_lvlup::MAX_VAL_SKILL;
     if ($player->getBase('melee') > $max) {
         $this->msg('solve2c', array(Shadowfunc::displayNuyen(5000)));
         $player->giveNuyenEvent(5000);
         // 			$player->message('You received another 5000 nuyen!');
     } else {
         $this->msg('solve2d');
         // 			$player->message('Your melee skill has increased by 1.');
         $player->levelupField('melee', 1);
         // 			$player->modify();
     }
     return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:19,代码来源:Redmond_AresDwarf_II.php

示例13: checkQuest

 public function checkQuest(SR_NPC $npc, SR_Player $player)
 {
     if ($player->getBase('bad_karma') > 0) {
         $npc->reply($this->lang('thx1'));
         // 			$npc->reply('Excellent ... let me try to free you from your sins ...');
         $player->message($this->lang('thx2'));
         // 			$player->message('The shamane is praying and mumbling ... and you feel better!');
         $player->increaseField('bad_karma', -1);
         $npc->reply($this->lang('thx3'));
         // 			$npc->reply('It seems like i get better and better doing this ... let me teach you something!');
         $player->levelupSpell('bunny', 1);
         $player->message($this->lang('thx4'));
         // 			$player->message('You have learned the bunny spell, which allows you to flee from combats.');
         return $this->onSolve($player);
     } else {
         return $npc->reply($this->lang('more'));
         // 			return $npc->reply('You still have not enough bad karma.');
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:19,代码来源:Seattle_Temple.php

示例14: getCurrentCommands

 public static function getCurrentCommands(SR_Player $player, $show_hidden = true, $boldify = false, $long_versions = true, $translate = false, $filter_hidden = false, $hidden_only = false)
 {
     if ($player->isOptionEnabled(SR_Player::DEAD)) {
         return array_merge(self::$CMDS_ALWAYS_CREATE, array('reset'));
     }
     if (false === $player->isCreated()) {
         return self::$CMDS_ALWAYS_CREATE;
     }
     if (false === ($party = $player->getParty())) {
         return array();
     }
     $action = $party->getAction();
     $leader = $player->isLeader();
     $commands = array();
     # Allways commands
     if (!$hidden_only) {
         $commands = array_merge($commands, self::$CMDS_ALWAYS);
     }
     # Always
     if ($show_hidden) {
         $commands = array_merge($commands, self::$CMDS_ALWAYS_CREATE);
     }
     # GM commands
     if ($show_hidden && $player->isGM()) {
         $commands = array_merge($commands, self::$CMDS_GM);
     }
     # Hidden commands
     if ($show_hidden) {
         $commands = array_merge($commands, self::$CMDS_ALWAYS_HIDDEN);
     }
     # Player actions
     if (!$hidden_only) {
         $commands = array_merge($commands, self::$CMDS[$action]);
         if (false !== ($scanner = $player->getInvItemByName('Scanner_v6', false))) {
             $commands[] = 'spy';
         }
         if ($player->getBase('alchemy') >= 0) {
             $commands[] = 'brew';
         }
     }
     # Leader actions
     if ($leader) {
         if ($show_hidden) {
             $commands = array_merge($commands, self::$CMDS_LEADER_ALWAYS);
         }
         if (!$hidden_only) {
             # Outside location?
             if (false !== ($location = $party->getLocationClass('outside'))) {
                 if ($location->isEnterAllowed($player)) {
                     # We can enter
                     $commands[] = 'enter';
                 }
             }
             # Action
             $commands = array_merge($commands, self::$CMDS_LEADER[$action]);
         }
     }
     # Location commands
     if (!$hidden_only) {
         if (false !== ($location = $party->getLocationClass('inside'))) {
             # Leader
             if ($leader === true) {
                 // 				$commands = array_merge($commands, self::shortcutArray($location->getLeaderCommands($player)));
                 $commands = array_merge($commands, $location->getLeaderCommands($player));
                 if ($location->isPVP()) {
                     $commands[] = 'fight';
                 }
             }
             # Talk
             $commands = array_merge($commands, $location->getNPCTalkCommands($player));
             # Special
             // 			$commands = array_merge($commands, self::shortcutArray($location->getCommands($player)));
             $commands = array_merge($commands, $location->getCommands($player));
         } elseif (false !== ($location = $party->getLocationClass('outside'))) {
             if ($location->isHijackable()) {
                 $commands[] = 'hijack';
             }
             //			if ($location->isPVP())
             //			{
             $commands[] = 'fight';
             //			}
         }
     }
     // 		if ($long_versions === false)
     // 		{
     // 			$commands = array_map(array(__CLASS__, 'shortcut'), $commands);
     // 		}
     // 		if ($long_versions === true)
     // 		{
     // 			$commands = array_map(array(__CLASS__, 'unshortcut'), $commands);
     // 		}
     ##############
     ### FORMAT ###
     ##############
     if ($filter_hidden) {
         $commands = array_values(array_diff($commands, self::$REALLY_HIDDEN));
     }
     if ($boldify) {
         // 			if ($long_versions === true)
         // 			{
//.........这里部分代码省略.........
开发者ID:sinfocol,项目名称:gwf3,代码行数:101,代码来源:Shadowcmd.php

示例15: allowShopSteal

 public function allowShopSteal(SR_Player $player)
 {
     return $player->getBase('thief') > 0;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:4,代码来源:SR_Store.php


注:本文中的SR_Player::getBase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。