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


PHP SR_Player::modify方法代码示例

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


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

示例1: DEBUGresetFeelings

 private static function DEBUGresetFeelings(SR_Player $player)
 {
     echo "Resetting!\n";
     foreach (SR_Player::$FEELINGS as $field) {
         $player->saveBase($field, '10000');
     }
     $player->modify();
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:8,代码来源:feel.php

示例2: onEnable

 protected static function onEnable(SR_Player $player, $bit, $bool, $name)
 {
     $text = $bool === true ? 'enabled' : 'disabled';
     $text = $player->lang($text);
     $old = $player->isOptionEnabled($bit);
     if ($bool === $old) {
         $player->msg('5070', array($name, $text));
         // 			$player->message(sprintf('%s has been already %s.', $name, $text));
         return true;
     }
     if (false === $player->saveOption($bit, $bool)) {
         return false;
     }
     $player->msg('5071', array($name, $text));
     // 		$player->message(sprintf('%s has been %s for your character.', $name, $text));
     $player->modify();
     return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:18,代码来源:enable.php

示例3: onReload

 public function onReload(SR_Player $player)
 {
     if (false === ($ammo = $player->getItemByName($this->getAmmoName()))) {
         $player->msg('5205');
         // 			$player->message('You are out of ammo!');
         $player->unequip($this);
         $player->modify();
         return true;
     }
     $p = $player->getParty();
     $now = $this->getAmmo();
     $max = $this->getBulletsMax();
     $avail = $ammo->getAmount();
     $put = Common::clamp($max - $now, 0, $avail);
     if ($put == 0) {
         $player->msg('1156');
         // 			$player->message('Your weapon is already loaded.');
         return false;
     }
     //		Dog_Log::debug(sprintf('%s reloads his %s: Nee'))
     $ammo->useAmount($player, $put);
     $this->increase('sr4it_ammo', $put);
     if ($p->isFighting()) {
         $ep = $p->getEnemyParty();
         $busy = $player->busy(round($this->getReloadTime() + rand(0, 10)));
         $p->ntice('5206', array($player->getName(), $put, $this->getName(), $busy));
         $ep->ntice('5206', array($player->getName(), $put, $this->getName(), $busy));
         // 			$message = sprintf(' load(s) %d bullet(s) into his %s. %s', $put, $this->getItemName(), Shadowfunc::displayBusy($busy));
         //			$message = sprintf(' load(s) %d bullet(s) into his %s. %s busy.', $put, $this->getItemName(), $player->busy(round($this->getReloadTime()+rand(0, 10))));
         // 			$p->message($player, $message);
         // 			$p->getEnemyParty()->message($player, $message);
     } else {
         // 			$message = sprintf('You load %d bullet(s) into your %s.', $put, $this->getItemName());
         // 			$bot = Shadowrap::instance($player);
         // 			$bot->rply('5207', array($put, $this->getName()));
         $player->msg('5207', array($put, $this->getName()));
         // 			$bot->reply($message);
     }
     return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:40,代码来源:SR_FireWeapon.php

示例4: onUsePotion

 public function onUsePotion(SR_Player $player, array $args)
 {
     // 		echo "Using potion".implode(',', $args).PHP_EOL;
     $receive_bottle = true;
     $mods = $this->getItemModifiersB();
     $spellname = key($mods);
     $level = array_shift($mods);
     if (false === ($spell = SR_Spell::getSpell($spellname))) {
         $player->message('Unknown spell');
         return false;
     }
     $spell->setCaster($player);
     $spell->setMode(SR_Spell::MODE_POTION);
     if (count($args) === 0) {
         $args[] = '';
     }
     if ($spell->isOffensive()) {
         $receive_bottle = false;
         if (!$player->isFighting()) {
             $player->msg('1180');
             // 				$player->message('This potion works in combat only.');
             return false;
         }
     }
     if (false !== ($target = $spell->getTarget($player, $args, false))) {
         if (!$spell->isOffensive() && $target->getID() !== $player->getID()) {
             $player->msg('1181');
             // 				$player->message('You cannot inject potions into other peoples mouth\'.');
             return false;
         }
     }
     // 		echo "Using potion 2222 ".implode(',', $args).PHP_EOL;
     # Dummy player
     $mods['magic'] = false === isset($mods['magic']) ? $player->getBase('magic') : $mods['magic'];
     $mods['intelligence'] = false === isset($mods['intelligence']) ? $player->getBase('intelligence') : $mods['intelligence'];
     $mods['wisdom'] = false === isset($mods['wisdom']) ? $player->getBase('wisdom') : $mods['wisdom'];
     $dummy = new SR_Player(SR_Player::getPlayerData(0));
     $dummy->setVar('sr4pl_magic', $mods['magic']);
     $dummy->setVar('sr4pl_intelligence', $mods['intelligence']);
     $dummy->setVar('sr4pl_wisdom', $mods['wisdom']);
     $dummy->setSpellData(array($spellname => $level));
     $dummy->modify();
     $spell->setCaster($dummy);
     if (false === $spell->onCast($player, $args, $level)) {
         return false;
     }
     if ($receive_bottle) {
         $player->giveItems(array(SR_Item::createByName('EmptyBottle')));
     }
     return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:51,代码来源:AlchemicPotion.php

示例5: 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

示例6: useAmount

 /**
  * Use the amount of an item. Delete item when empty.
  * @param SR_Player $player
  * @param int $amount
  * @return true|false
  */
 public function useAmount(SR_Player $player, $amount = 1, $modify = true)
 {
     if ($amount > $this->getAmount()) {
         Dog_Log::error(sprintf('Item %s(%d) has not %d amount to use!', $this->getItemName(), $this->getID(), $amount));
         return false;
     }
     if (false === $this->increase('sr4it_amount', -$amount)) {
         Dog_Log::error(sprintf('Item %s(%d) can not decrease amount %d!', $this->getItemName(), $this->getID(), $amount));
         return false;
     }
     if ($modify) {
         $player->modify();
     }
     return $this->getAmount() < 1 ? $this->deleteItem($player) : true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:21,代码来源:SR_Item.php

示例7: teachNinja

 private function teachNinja(SR_Player $player, $price)
 {
     $p = Shadowfunc::displayNuyen($price);
     if ($player->hasSkill('ninja')) {
         $this->rply('enough');
         // 			$this->reply('Thank you, but you already donated enough :)');
     } elseif ($player->hasNuyen($price)) {
         $player->pay($price);
         $player->levelupFieldTo('ninja', 0);
         // 			$player->updateField('ninja', 0);
         $this->rply('come');
         $player->message($this->langNPC('teaching'));
         // 			$this->reply("Thank you my friend. Come with me...");
         // 			$player->message('The monk teaches you the Ninja Skill. This will improve attack and damage for ninja weapons.');
         $player->modify();
     } else {
         $this->rply('sry', array($p));
         // 			$this->reply("I am sorry, but learning the ninja skill cost $p.");
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:20,代码来源:Ninja.php


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