本文整理汇总了PHP中SR_Player::pay方法的典型用法代码示例。如果您正苦于以下问题:PHP SR_Player::pay方法的具体用法?PHP SR_Player::pay怎么用?PHP SR_Player::pay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SR_Player
的用法示例。
在下文中一共展示了SR_Player::pay方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onNPCTalk
public function onNPCTalk(SR_Player $player, $word, array $args)
{
$b = chr(2);
# bold
switch ($word) {
case 'seattle':
return $this->reply("I'm happy I'm out of there. Delaware is way more awesome.");
case 'shadowrun':
return $this->reply("So you are a Runner? Good for you.");
case 'cyberware':
return $this->reply("Cyberware? Its awesome. Just remember that enemy spells hurt you a lot with too much cyberware :(");
case 'magic':
return $this->reply("Magic sucks. Use cyberware :)");
case 'hire':
return $this->reply("Can't hire me. I like my job here, much better than back in Renraku.");
case 'blackmarket':
return $this->reply("Shhh! If my boss Andrew hears us he will fire me!");
case 'bounty':
return $this->reply("There's no bounty on me, go away!");
case 'alchemy':
return $this->reply("Are you from medieval times? There's no such thing as changing stone to gold!");
case 'invite':
return $this->reply("A party? It's not in an elevator, so I won't come.");
case 'renraku':
return $this->reply("Don't remind me of that, have been bad times.");
case 'malois':
return $this->reply("Hmm.. I heard this name before, but I don't remember...");
case 'bribe':
if (count($args) === 0) {
$this->reply("Please specify an amount to bribe Stephen");
return false;
} else {
if (!$player->hasNuyen($args[0])) {
return $this->reply("Don't try to fool me, you don't have enough ny");
} else {
$player->pay($args[0]);
return $this->reply("Thanks, but I don't have anything for you.");
}
}
case 'yes':
return $this->reply("Yes what? \"Yes sir!\" it is");
case 'no':
return $this->reply("...");
case 'negotiation':
return $this->reply("That won't work on me.");
case 'hello':
return $this->reply("Hello, I'm Stephen.");
default:
return $this->reply("I do not know anything about {$word}.");
}
}
示例2: 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.");
}
}
示例3: onNPCBountyTalk
public function onNPCBountyTalk(SR_Player $player, $word, array $args)
{
switch (count($args)) {
case 1:
$this->reply("Yes. Try #ttj bounty <player{server}> to see the bounty for a player. Try #ttj bounty <player{server}> <nuyen> to raise the bounty for a player.");
return true;
case 2:
if (false === ($target = Shadowrun4::loadPlayerByName($args[1]))) {
$this->reply("This player is unknown. Try #ttj <nickname{serverid}>.");
} else {
$this->reply(SR_Bounty::displayBountyPlayer($target));
}
return true;
case 3:
if (false === ($target = Shadowrun4::loadPlayerByName($args[1]))) {
$this->reply("This player is unknown. Try #ttj <nickname{serverid}>.");
return true;
}
$nuyen = (int) $args[2];
$min_nuyen = SR_Bounty::getMinNuyen($target);
if ($nuyen < $min_nuyen) {
$this->reply(sprintf('The minimum bounty for %s is %s.', $target->getName(), Shadowfunc::displayNuyen($min_nuyen)));
return true;
}
if (false === $player->pay($nuyen)) {
$this->reply(sprintf("You don't seem to have %s.", Shadowfunc::displayNuyen($nuyen)));
return false;
}
if (false === SR_Bounty::insertBounty($player, $target, $nuyen)) {
$this->reply(sprintf('Database error in %s line %s.', __FILE__, __LINE__));
return false;
}
$bounty = Shadowfunc::displayNuyen($nuyen);
$total = Shadowfunc::displayNuyen($target->getBase('bounty'));
$target->message(sprintf("%s put a bounty on you: +%s = %s!", $player->getName(), $bounty, $total));
$this->reply(sprintf('You put a bounty of %s on %s. This is valid for %s. Total bounty for this chummer is %s now.', $bounty, $target->getName(), GWF_TimeConvert::humanDuration(SR_Bounty::TIMEOUT), $total));
return true;
default:
return false;
}
}