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


PHP SR_Player类代码示例

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


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

示例1: execute

 public static function execute(SR_Player $player, array $args)
 {
     if ($player->isFighting()) {
         $player->msg('1036');
         // 			$player->message('This does not work in combat');
         return false;
     }
     $argc = count($args);
     if ($argc < 1 || $argc > 2) {
         $player->message(Shadowhelp::getHelp($player, 'givekw'));
         return false;
     }
     if ($argc === 2) {
         if (false === ($target = Shadowfunc::getFriendlyTarget($player, $args[0]))) {
             $player->msg('1028', array($args[0]));
             #$player->message(sprintf('%s is not here or the name is ambigous.', $args[0]));
             return false;
         }
         $word = $args[1];
         $targets = array($target);
     } else {
         $word = $args[0];
         $targets = $player->getParty()->getMembers();
     }
     if (false === $player->hasKnowledge('words', $word)) {
         $player->msg('1023');
         # You don`t have this knowledge.
         return false;
     }
     return self::giveKnow($player, $targets, 'words', $args[1]);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:31,代码来源:givekw.php

示例2: onNPCTalk

 public function onNPCTalk(SR_Player $player, $word, array $args)
 {
     // 		$b = chr(2);
     switch ($word) {
         case 'magic':
             return $this->rply($word);
             // 				return $this->reply('Yeah, I even sell some magic potions and elixirs.');
         // 				return $this->reply('Yeah, I even sell some magic potions and elixirs.');
         case 'chemistry':
             $this->rply($word);
             // 				$this->reply("You can buy similar things here for chemistry or even {$b}magic{$b} potions.");
             $player->giveKnowledge('words', 'Magic');
             return true;
         case 'hello':
             return $this->rply($word, array($this->getName()));
             // 				return $this->reply("Hello, my name is ".$this->getName()." and I sell items for {$b}chemistry{$b} and similar stuff.");
         // 				return $this->reply("Hello, my name is ".$this->getName()." and I sell items for {$b}chemistry{$b} and similar stuff.");
         case 'gizmore':
         case 'somerandomnick':
             return $this->rply('brother', array($word));
             // 				return $this->reply(sprintf('Oh you mean my brother %s in Amerindian.', $word));
         // 				return $this->reply(sprintf('Oh you mean my brother %s in Amerindian.', $word));
         default:
             return $this->rply('default', array($word));
             // 				return $this->reply("What do you mean with $word?");
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:27,代码来源:Alchemist_NPC.php

示例3: getStoreItems

 public function getStoreItems(SR_Player $player)
 {
     $back = array();
     $rep = $player->get('reputation');
     $back[] = array('Headcomputer');
     $back[] = array('SmartGoggles');
     $back[] = array('Sporn');
     $back[] = array('Cybermuscles');
     $back[] = array('CybermusclesV2');
     $back[] = array('CybermusclesV3');
     $back[] = array('DermalPlates');
     if ($rep >= 1) {
         $back[] = array('DermalPlatesV2');
     }
     if ($rep >= 2) {
         $back[] = array('DermalPlatesV3');
     }
     $back[] = array('WiredReflexes');
     if ($rep >= 2) {
         $back[] = array('WiredReflexesV2');
     }
     if ($rep >= 3) {
         $back[] = array('WiredReflexesV3');
     }
     return $back;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:26,代码来源:Hospital.php

示例4: onSolveCrypto

 public function onSolveCrypto(SR_Player $player, $word, array $args)
 {
     if (count($args) !== 1) {
         $this->rply('crypto1');
         // 			$this->reply('I wrote down some message and cannot decipher it myself again -.- Please tell me the password with #talk crypto <password>.');
         $this->rply('crypto2');
         // 			$this->reply('eht swordsap ot ym fase si ont xenophi tub gimmuhnbrid.');
         $cry = $player->get('crypto');
         if ($cry >= 1) {
             $player->message($this->langNPC('skills1'));
             // 				$player->message('With your awesome crypto skills you can easily read the message: "the password to my safe is not phoenix but hummingbird."');
         } elseif ($cry >= 0) {
             $player->message($this->langNPC('skills2'));
             // 				$player->message('With your awesome crypto skills you immediately recognize it\'s a simple anagram for each word.');
         }
         return true;
     }
     $answer = $args[0];
     switch ($answer) {
         case 'hummingbird':
             return $this->onQuestSolved($player, $word, $args);
         case 'phoenix':
             return $this->rply('almost');
             // 				return $this->reply('Yeah this rings a bell ... Let me try ... Darn wrong!');
         // 				return $this->reply('Yeah this rings a bell ... Let me try ... Darn wrong!');
         default:
             return $this->rply('wrong');
             // 				return $this->reply('Sweet let me try it on my safe ... Darn wrong.');
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:30,代码来源:TomRiddle.php

示例5: calcNegPrice

 private function calcNegPrice(SR_Player $player)
 {
     $price = 10000;
     $try = $player->getTemp(self::TEMP_WORDN);
     $price -= $try * 1000;
     return $price;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:Hotelier.php

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

示例7: getPocketsTuneup

 public function getPocketsTuneup(SR_Player $player)
 {
     $bo = $player->get('body') * 0.02;
     $st = $player->get('strength') * 0.03;
     $qu = $player->get('quickness') * 0.05;
     return $bo + $st + $qu;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:Pockets.php

示例8: execute

 public static function execute(SR_Player $player, array $args)
 {
     $pp = Shadowrun4::getParties();
     foreach ($pp as $i => $p) {
         $p instanceof SR_Party;
         if (!$p->isHuman()) {
             unset($pp[$i]);
         }
     }
     $page = isset($args[0]) ? intval($args[0]) : 1;
     $nItems = count($pp);
     $nPages = GWF_PageMenu::getPagecount(self::PPP, $nItems);
     $page = Common::clamp($page, 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, self::PPP);
     $slice = array_slice($pp, $from, self::PPP);
     $out = '';
     $format = $player->lang('fmt_list');
     foreach ($slice as $p) {
         $p instanceof SR_Party;
         $leader = $p->getLeader()->displayName();
         $l = $p->getSum('level', true);
         $ll = $p->getSum('level', false);
         $mc = $p->getMemberCount();
         $item = sprintf('%s(L%s(%s))(M%s)', $leader, $l, $ll, $mc);
         $out .= sprintf($format, $item);
         // 			$out .= sprintf(', %s(L%s(%s))(M%s)', $leader, $l, $ll, $mc);
     }
     return self::rply($player, '5248', array($page, $nPages, ltrim($out, ',; ')));
     // 		$bot = Shadowrap::instance($player);
     // 		$bot->reply(sprintf('Parties page %s from %s: %s.', $page, $nPages, substr($out, 2)));
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:31,代码来源:parties.php

示例9: getRespawnLocation

 public function getRespawnLocation(SR_Player $player)
 {
     if ($player->getNuyen() > 100 && $player->hasKnowledge('places', 'Seattle_Hotel')) {
         return 'Seattle_Hotel';
     }
     return parent::getRespawnLocation($player);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:Seattle.php

示例10: checkQuest

 public function checkQuest(SR_NPC $npc, SR_Player $player)
 {
     $have = $this->getAmount();
     $need = $this->getNeededAmount();
     $give = 0;
     foreach ($player->getInventory() as $item) {
         if ($item instanceof SR_Rune) {
             $player->deleteFromInventory($item);
             $have++;
             $give++;
             if ($have >= $need) {
                 break;
             }
         }
     }
     if ($give > 0) {
         $this->increase('sr4qu_amount', $give);
         $player->message($this->lang('gave', array($give, $npc->getName())));
         // 			$player->message(sprintf('You gave %s %s to %s.', $give, 'Runes', $npc->getName()));
     }
     if ($have >= $need) {
         $npc->reply($this->lang('thanks1'));
         // 			$npc->reply('Thank you very much my friend. Now I can also craft some equipment again.');
         $this->onSolve($player);
         $npc->reply($this->lang('thanks2', array(self::REWARD_RUNES)));
         // 			$npc->reply('As a reward I let you create '.self::REWARD_RUNES.' new runes via #reward.');
         $player->increaseConst(Seattle_Blacksmith::REWARD_RUNES, self::REWARD_RUNES);
     } else {
         $npc->reply($this->lang('more', array($have, $need)));
         // 			$npc->reply(sprintf('You gave me %s of %s Runes... Give me a few more and I will reward you greatly :)', $have, $need));
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:32,代码来源:Seattle_BD2.php

示例11: onNPCQuestTalkB

 public function onNPCQuestTalkB(SR_TalkingNPC $npc, SR_Player $player, $word, array $args = NULL)
 {
     $need = $this->getNeededAmount();
     $dp = $this->displayRewardNuyen();
     switch ($word) {
         case 'shadowrun':
             $npc->reply("Haha ... you want to be a runner ... kill 20 bums and i reward your with {$dp}.");
             break;
         case 'confirm':
             $npc->reply("So?");
             break;
         case 'yes':
             $npc->reply('I was just kidding!');
             break;
         case 'no':
             $npc->reply('Hehe yeah, i was just kidding.');
             if (count($args) === 0 || $args[0] !== 'SURE') {
                 $player->message("Use #talk no SURE to decline this quest forever.");
             } else {
                 $this->decline($player);
             }
             break;
     }
     return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:25,代码来源:Chicago_RazorBarkeeper1.php

示例12: onThrow

 public function onThrow(SR_Player $player, SR_Player $target)
 {
     $firearms = $player->get('firearms');
     $atk = 20 + $firearms;
     $mindmg = 1;
     $maxdmg = 6;
     $out_dmg = '';
     $out_dmgep = '';
     $out_eff = '';
     $inaccuracy = rand(2, 4) - ($firearms ? 1 : 0);
     $targets = $this->computeDistances($target, $inaccuracy);
     foreach ($targets as $data) {
         list($t, $d) = $data;
         $t instanceof SR_Player;
         $a = $atk - $d + rand(-1, 2);
         $a = Common::clamp($a, 0, $atk);
         $def = $t->get('defense');
         $arm = $t->get('marm');
         $hits = Shadowfunc::diceHits($mindmg, $arm, $atk, $def, $player, $t);
         $hits -= $arm;
         $hits = Common::clamp($hits, 0);
         if ($hits == 0) {
             continue;
         }
         $dmg = round($mindmg + $hits / 10, 2);
         if ($dmg <= 0) {
             continue;
         }
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:30,代码来源:MolotovCocktail.php

示例13: onEnter

 public function onEnter(SR_Player $player)
 {
     $party = $player->getParty();
     $dice = rand(0, 6);
     if ($dice < 2) {
         $this->partyMessage($player, 'lucky');
         // 			$party->notice('You silently search the door and windows for an entrance. You were lucky and sneak in...');
         $this->teleportInside($player, 'Hideout_Exit');
     } else {
         if ($dice < 4) {
             $this->partyMessage($player, 'noluck');
             // 			$party->notice('You silently search the door and windows for an entrance. You have no luck, everything\'s closed.');
         } else {
             if ($dice < 6) {
                 $this->partyMessage($player, 'fight2');
                 // 			$party->notice('You silently search the door and windows for an entrance. Two punks notice you and attack!');
                 SR_NPC::createEnemyParty('Redmond_Cyberpunk', 'Redmond_Cyberpunk')->fight($party, true);
             } else {
                 $this->partyMessage($player, 'fight4');
                 // 			$party->notice('You take a look through the doors keyhole. A party of four punks opens the door and surprises you.');
                 SR_NPC::createEnemyParty('Redmond_Cyberpunk', 'Redmond_Cyberpunk', 'Redmond_Pinkhead', 'Redmond_Lamer')->fight($party, true);
             }
         }
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:25,代码来源:Hideout.php

示例14: getHelpText

 public function getHelpText(SR_Player $player)
 {
     return $player->lang('hlp_hotel', array($this->displaySleepPrice($player)));
     // 		$price = $this->calcPrice($player);
     // 		$c = Shadowrun4::SR_SHORTCUT;
     // 		return sprintf('You can pay %s to %ssleep here and restore your party`s HP/MP.', $price, $c);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:SR_Hotel.php

示例15: execute

 public static function execute(SR_Player $player, array $args)
 {
     $p = $player->getParty();
     if (false !== ($city = $p->getCityClass())) {
         if ($city->isDungeon()) {
             self::rply($player, '1035');
             return false;
             // 				Shadowrap::instance($player)->reply('In dungeons you don\'t have mounts.');
         }
     }
     //		$i = 1;
     $format = $player->lang('fmt_sumlist');
     $out = '';
     $total = 0.0;
     $total_max = 0.0;
     foreach ($p->getMembers() as $member) {
         $member instanceof SR_Player;
         $mount = $member->getMount();
         $we = $mount->calcMountWeight();
         $max = $mount->getMountWeightB();
         $total += $we;
         $total_max += $max;
         if ('' !== ($weight = $mount->displayWeight())) {
             // 				$weight = "({$weight})";
         }
         $out .= sprintf($format, $member->getEnum(), $mount->getName(), $weight);
         // 			$out .= sprintf(", \x02%s\x02-%s%s", $member->getEnum(), $mount->getName(), $weight);
     }
     return self::rply($player, '5083', array(Shadowfunc::displayWeight($total), Shadowfunc::displayWeight($total_max), ltrim($out, ',; ')));
     // 		$message = sprintf('Party Mounts(%s/%s): %s.', Shadowfunc::displayWeight($total), Shadowfunc::displayWeight($total_max), substr($out, 2));
     return Shadowrap::instance($player)->reply($message);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:32,代码来源:mounts.php


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