本文整理汇总了PHP中SR_Player::getID方法的典型用法代码示例。如果您正苦于以下问题:PHP SR_Player::getID方法的具体用法?PHP SR_Player::getID怎么用?PHP SR_Player::getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SR_Player
的用法示例。
在下文中一共展示了SR_Player::getID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onNPCTalk
public function onNPCTalk(SR_Player $player, $word, array $args)
{
$key = 'Seattle_Citizen_Hire_' . $player->getID();
$key2 = 'Seattle_Citizen_Invite_' . $player->getID();
$b = chr(2);
switch ($word) {
case 'shadowrun':
if ($this->getGender() === 'male') {
$this->rply('job_male');
$player->giveKnowledge('words', 'Hire');
} else {
$this->rply('job_female');
}
return true;
case 'no':
return $this->rply('no_' . $this->getGender());
case 'hire':
if ($this->getGender() === 'female') {
return $this->rply('hire_female');
}
$ch = $player->get('charisma');
$re = $player->get('reputation');
if ($player->getParty()->hasHireling()) {
$this->rply('two_hirelings');
} elseif ($this->hasTemp($key) || rand(0, 32) > $ch + $re) {
$this->rply('not_skilled');
$this->setTemp($key, 1);
} else {
$this->rply('lets_go');
$time = 400 + $ch * 40 + $re * 20;
$p = $this->getParty();
$p->kickUser($this, true);
$this->onHireC($player, $time);
$p->popAction(true);
$player->getParty()->popAction(true);
}
return true;
case 'invite':
$quest = SR_Quest::getQuest($player, 'Vegas_Voices');
$quest instanceof Quest_Vegas_Voices;
$quest->onTryInvite($this, $player);
break;
default:
case 'hello':
$this->rply('hello' . $this->getGender());
$player->giveKnowledge('words', 'Yes');
$player->giveKnowledge('words', 'No');
$player->giveKnowledge('words', 'Shadowrun');
break;
}
return true;
}
示例2: onNPCTalk
public function onNPCTalk(SR_Player $player, $word, array $args)
{
$key = 'Seattle_Citizen_Hire_' . $player->getID();
$key2 = 'Seattle_Citizen_Invite_' . $player->getID();
$b = chr(2);
switch ($word) {
case 'shadowrun':
$quest = SR_Quest::getQuest($player, 'Delaware_Seraphim2');
if (!$quest->isInQuest($player)) {
$this->reply("I am looking for a job. Would you like to {$b}hire{$b} me?");
$player->giveKnowledge('words', 'Hire');
return true;
}
return $this->seraphimQuest($player, $word, $args);
case 'no':
return $this->reply("Yo chummer, you're on a run?");
case 'hire':
$ch = $player->get('charisma');
$re = $player->get('reputation');
if ($player->getParty()->hasHireling()) {
$this->reply('You already have a hireling. So I say no anway.');
} elseif ($this->hasTemp($key) || rand(0, 32) > $ch + $re) {
$this->reply('You don\'t look very skilled. I better follow my own way.');
$this->setTemp($key, 1);
} else {
$time = 400 + $ch * 40 + $re * 20;
$p = $this->getParty();
$p->kickUser($this, true);
$this->onHireC($player, $time);
$p->popAction(true);
$player->getParty()->popAction(true);
$this->reply("Ok, let's go!");
}
break;
case 'invite':
$quest = SR_Quest::getQuest($player, 'Seattle_Barkeeper');
$quest instanceof Quest_Seattle_Barkeeper;
$quest->onTryInvite($this, $player);
break;
default:
case 'hello':
$this->reply("Hello chummer. Are you on a {$b}Shadowrun{$b}?");
$player->giveKnowledge('words', 'Yes');
$player->giveKnowledge('words', 'No');
$player->giveKnowledge('words', 'Shadowrun');
break;
}
return true;
}
示例3: createStats
public static function createStats(SR_Player $player)
{
$stats = new self(array('sr4ps_pid' => $player->getID(), 'sr4ps_i_looted' => 0, 'sr4ps_i_sold' => 0, 'sr4ps_i_bought' => 0, 'sr4ps_i_dropped' => 0, 'sr4ps_i_given' => 0, 'sr4ps_i_received' => 0, 'sr4ps_ny_loot' => 0, 'sr4ps_ny_spent' => 0, 'sr4ps_ny_income' => 0, 'sr4ps_ny_given' => 0, 'sr4ps_ny_received' => 0, 'sr4ps_kill_mob' => 0, 'sr4ps_kill_npc' => 0, 'sr4ps_kill_human' => 0, 'sr4ps_kill_runner' => 0));
if (false === $stats->replace()) {
return false;
}
return $stats;
}
示例4: onWhispered
/**
* Set who whispered who to allow implementation of whisper_back.
* @param SR_Player $from
* @param SR_Player $to
*/
private static function onWhispered(SR_Player $from, SR_Player $to)
{
$pid = $to->getID();
if (!isset(self::$WHISPER[$pid])) {
self::$WHISPER[$pid] = array();
}
self::cleanupWhisper($pid);
self::$WHISPER[$pid][$from->getID()] = Shadowrun4::getTime();
}
示例5: getWBTarget
private static function getWBTarget(SR_Player $player)
{
$pid = $player->getID();
if (!isset(Shadowcmd_whisper::$WHISPER[$pid])) {
return -1;
}
$data = Shadowcmd_whisper::$WHISPER[$pid];
if (count($data) === 1) {
return Shadowrun4::getPlayerByPID(key($data));
}
return -2;
}
示例6: computeDistances
/**
* Compute the distances to an explosion.
* Imagaine the game like this
* A
* B E
* F
* CD
* ---0m---
* @param SR_Player $target
* @param unknown_type $radius
* @param unknown_type $atk
* @param unknown_type $atk_delta
*/
public static function computeDistances(SR_Player $target, $inaccuracy = 3)
{
$party = $target->getParty();
$members = $party->getMembers();
$coords = array();
foreach ($members as $m) {
$m instanceof SR_Player;
$coords[$m->getID()] = array($m->getX(), $m->getY());
}
# Point of impact.
$g_x = $coords[$target->getID()][0] + Shadowfunc::diceFloat(-$inaccuracy, +$inaccuracy);
$g_y = $coords[$target->getID()][1] + Shadowfunc::diceFloat(-$inaccuracy, +$inaccuracy);
// echo sprintf("Grenade has coords %.02f / %.02f\n", $g_x, $g_y);
$back = array();
foreach ($coords as $uid => $data) {
list($p_x, $p_y) = $data;
$d = Shadowfunc::calcDistanceB($g_x, $g_y, $p_x, $p_y);
$p = Shadowrun4::getPlayerByPID($uid);
$back[] = array($uid, $d);
// echo sprintf("%s has coords %.02f / %.02f (distance: %.02f)\n", $p->getName(), $p_x, $p_y, $d);
}
return $back;
}
示例7: 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);
}
示例8: onGMNS
private static function onGMNS(SR_Player $player, SR_Player $target, $arg)
{
$pid = $target->getID();
if (strtolower($arg) === 'on') {
if (false === SR_NoShout::setNoShout($pid, -1)) {
return false;
}
return $player->message(sprintf('Banned %s from shouting.', $target->getName()));
} elseif (strtolower($arg) === 'off') {
if (false === SR_NoShout::setShout($pid)) {
return false;
}
return $player->message(sprintf('Allowed %s to shout again.', $target->getName()));
} elseif (0 < ($seconds = GWF_TimeConvert::humanToSeconds($arg))) {
if (false === SR_NoShout::setNoShout($pid, $seconds)) {
return false;
}
return $player->message(sprintf('Banned %s from shouting for %s.', $target->getName(), GWF_TimeConvert::humanDuration($seconds)));
} else {
$player->message(Shadowhelp::getHelp($player, 'gmns'));
return false;
}
}
示例9: addPlayer
/**
* Add a player to memory.
* @param SR_Player $player
*/
public static function addPlayer(SR_Player $player)
{
self::$players[$player->getID()] = $player;
}
示例10: clearRequests
public static function clearRequests(SR_Player $player)
{
$pid = $player->getID();
return self::table(__CLASS__)->deleteWhere("sr4cr_pid={$pid}");
}
示例11: onKilled
public static function onKilled(SR_Player $killer, SR_Player $victim)
{
echo __METHOD__;
return self::table(__CLASS__)->insertAssoc(array('sr4kp_killer' => $killer->getID(), 'sr4kp_victim' => $victim->getID(), 'sr4kp_srtime' => Shadowrun4::getTime() + self::getKillTime($killer, $victim)));
}
示例12: setRemotePlayer
public function setRemotePlayer(SR_Player $player)
{
$this->remote_pid = $player->getID();
}
示例13: swapMembers
public function swapMembers(SR_Player $a, SR_Player $b)
{
$this->members = GWF_Array::swapAssoc($this->members, $a->getID(), $b->getID());
$this->recomputeEnums();
return $this->updateMembers();
}
示例14: deleteAllItems
public static function deleteAllItems(SR_Player $player)
{
$pid = $player->getID();
return self::table(__CLASS__)->deleteWhere("sr4it_uid={$pid}");
}
示例15: hasHacked
public function hasHacked(SR_Player $player)
{
$pid = $player->getID();
if (!isset($this->hackers[$pid])) {
$this->hackers[$pid] = 1;
} else {
$this->hackers[$pid]++;
}
return $this->hackers[$pid] > $this->getMaxAttempts();
}