本文整理汇总了PHP中SR_Player::msg方法的典型用法代码示例。如果您正苦于以下问题:PHP SR_Player::msg方法的具体用法?PHP SR_Player::msg怎么用?PHP SR_Player::msg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SR_Player
的用法示例。
在下文中一共展示了SR_Player::msg方法的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, 'givekp'));
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;
}
$place = $args[1];
$targets = array($target);
} else {
$place = $args[0];
$targets = $player->getParty()->getMembers();
}
if (false === ($tlc = Shadowcmd_goto::getTLCByArgMulticity($player, $place))) {
$player->msg('1023');
return false;
}
return self::giveKnow($player, $targets, 'places', $tlc);
}
示例2: on_challenge
public function on_challenge(SR_Player $player, array $args)
{
# No fight with party:
if ($player->isInParty()) {
$player->msg('1099');
// $player->message("You can't fight here when you are in a party. Use #part to leave your party.");
return false;
}
# Get current enemy
$key = 'SEATTLE_ARENA_N';
if (!$player->hasConst($key)) {
$player->setConst($key, 1);
}
$n = $player->getConst($key);
# Possible flags/enemies in Arena:
$enemies = array(array("Seattle_AToughGuy", $this->lang($player, 'e1')), array("Seattle_ASecOrk", $this->lang($player, 'e2')), array("Seattle_AToughTroll", $this->lang($player, 'e3')), array("Seattle_AMagician", $this->lang($player, 'e4')), array("Seattle_AElite", $this->lang($player, 'e5')));
# No more fights:
if ($n > count($enemies)) {
// $player->message("Sorry. You fought all the enemies here. Try #fight <player> then :P");
$player->msg('1098');
return false;
}
$n--;
$enemy = $enemies[$n];
$player->msg('5141', array($enemy[1]));
// $player->message("The Arena-Guy leads you to the locker room. After a few minutes you were guided into the arena and see your enemy: ".$enemy[1].". " );
SR_NPC::createEnemyParty($enemy[0])->fight($player->getParty(), true);
return true;
}
示例3: 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;
}
示例4: 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]);
}
示例5: 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);
}
示例6: 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);
}
示例7: 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;
}
示例8: getNPCLoot
public function getNPCLoot(SR_Player $player)
{
$nuyen = 1200;
$key = 'SEATTLE_ARENA_N';
$player->setConst($key, $player->getConst($key) + 1);
$player->msg('5125', array(Shadowfunc::displayNuyen($nuyen)));
// $player->message("The fight is over. The director hands you $nuyen Nuyen.");
$player->giveNuyen($nuyen);
return array();
}
示例9: giveItem
public static function giveItem(SR_Player $player, SR_Player $target, $id, $amt = 1)
{
if ($amt < 1) {
$player->msg('1038');
// $player->message('Please give a positive amount of items.');
return false;
}
if (false === ($item = $player->getInvItem($id))) {
$player->msg('1029');
// $player->message('You don`t have that item.');
return false;
}
// if (false === $item->isItemTradeable())
// {
// $player->message('You are not allowed to trade this item.');
// return false;
// }
if ($item->isItemStackable()) {
if ($amt > $item->getAmount()) {
$player->msg('1040', array($item->getItemName()));
// $player->message(sprintf('You only have %d %s.', $item->getAmount(), $item->getName()));
return false;
}
$giveItem = SR_Item::createByName($item->getItemName(), $amt, true);
$item->useAmount($player, $amt);
} else {
if ($amt !== 1) {
$player->message('Currently you can only give one equipment at a time.');
return false;
}
$player->removeFromInventory($item);
$giveItem = $item;
}
$busymsg = $player->isFighting() ? Shadowfunc::displayBusy($player->busy(SR_Player::GIVE_TIME)) : '';
self::rply($player, '5115', array($amt, $giveItem->displayFullName($player), $target->getName(), $busymsg));
// $player->message(sprintf('You gave %d %s to %s.%s', $amt, $giveItem->getName(), $target->getName(), $busymsg));
$target->giveItems(array($giveItem), $player->getName());
// if ($target instanceof SR_TalkingNPC)
// {
// $target->onNPCGive($player, $items);
// }
return true;
}
示例10: messagePartyFeelings
private static function messagePartyFeelings(SR_Player $player)
{
$party = $player->getParty();
$enum = 1;
$fmt = $player->lang('fmt_feel');
$out = '';
foreach ($party->getMembers() as $member) {
$member instanceof SR_Player;
$out .= vsprintf($fmt, self::argsForMember($member, $enum));
}
$player->msg('5312', array(ltrim($out, ',; ')));
}
示例11: 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;
}
示例12: onDealDamage
/**
* Poison the target.
* @see SR_Weapon::onDealDamage()
*/
public function onDealDamage(SR_Player $player, SR_Player $target, $hits, $damage)
{
$biotech = Common::clamp($target->getVar('biotech'), 0, 15);
$min = 0.1 - $biotech * 0.01;
$max = 0.3 - $biotech * 0.02;
$duration = rand(20, 40);
$per_sec = Shadowfunc::diceFloat($min, $max, 2);
if ($per_sec > 0) {
$modifiers = array('hp' => $per_sec);
$target->addEffects(new SR_Effect($duration, $modifiers));
$target->msg('5294', array(sprintf('%.02f', $per_sec), GWF_Time::humanDuration($duration)));
}
}
示例13: onTell
public static function onTell(SR_Player $player)
{
$pid = $player->getID();
$where = 'sr4tl_pid=' . $pid;
$table = self::table(__CLASS__);
if (false === ($result = $table->selectAll('sr4tl_time, sr4tl_msg', $where, 'sr4tl_time DESC', NULL, 10, 0, GDO::ARRAY_N))) {
return false;
}
foreach (array_reverse($result) as $row) {
$player->msg('5019', array($row[1]));
// $player->message('OldMessage: '.$row[1]);
}
return $table->deleteWhere($where);
}
示例14: onItemUse
public function onItemUse(SR_Player $player, array $args)
{
$p = $player->getParty();
if (false === ($l = $p->getLocationClass(SR_Party::ACTION_INSIDE))) {
$player->msg('hlp_cyberdeck');
// $player->message('This item only works inside locations with computers.');
return false;
}
$computers = $l->getComputers();
$bot = Shadowrap::instance($player);
if (count($computers) === 0) {
$player->msg('hlp_cyberdeck_targets');
// $bot->reply('You don\'t see any Computers with a Headcomputer interface here.');
return false;
}
if (count($args) !== 1) {
$i = 1;
$format = $player->lang('fmt_rawitems');
$out = '';
foreach ($computers as $pc) {
$out .= sprintf($format, $i++, $pc);
// $out .= sprintf(", \x02%s\x02-%s", $i++, $pc);
}
return $bot->rply('5202', array(substr($out, 2)));
// $bot->reply(sprintf('Possible targets: %s.', substr($out, 2)));
// return true;
}
if (false === ($computer = $this->getComputerTarget($player, $computers, $args[0]))) {
$bot->rply('1012');
# The target is unknown.
// $bot->reply('The target computer is invalid.');
return false;
}
if (false === ($computer = SR_Computer::getInstance($computer, $l))) {
$bot->reply('Database error.');
return false;
}
if (!$player->hasHeadcomputer()) {
$bot->rply('1050', array('headcomputer'));
// $bot->reply('You don\'t have a headcomputer.');
return false;
}
if ($player->getBase('computers') < 0) {
$bot->rply('1025', 'computers');
// $bot->reply('You need to learn the computers skill first.');
return false;
}
$computer->onHack($player, $this);
return true;
}
示例15: onChallengeB
private function onChallengeB(SR_Player $player, $bit, $name, $text, $nuyen)
{
$party = $player->getParty();
if (false === ($ep = SR_NPC::createEnemyParty($name))) {
$player->message('Database error!');
return false;
}
$player->msg('5141', array($text));
// $player->message(sprintf('You are guided into the arena and see your enemy: %s', $text));
$e = $ep->getLeader();
$e->setArenaKey($this->getArenaKey($player), $bit);
$e->setArenaNuyen($nuyen);
$ep->fight($party);
return true;
}