本文整理汇总了PHP中Shadowrun4::getPlayerByPID方法的典型用法代码示例。如果您正苦于以下问题:PHP Shadowrun4::getPlayerByPID方法的具体用法?PHP Shadowrun4::getPlayerByPID怎么用?PHP Shadowrun4::getPlayerByPID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shadowrun4
的用法示例。
在下文中一共展示了Shadowrun4::getPlayerByPID方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOnlineMembers
/**
* Get all online members for a clan.
* @param int $cid
* @return array
*/
public static function getOnlineMembers($cid)
{
$back = array();
$cid = (int) $cid;
foreach (self::table(__CLASS__)->selectColumn('sr4cm_pid', "sr4cm_cid={$cid}") as $playerid) {
if (false !== ($player = Shadowrun4::getPlayerByPID($playerid))) {
$back[] = $player;
}
}
return $back;
}
示例2: 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;
}
示例3: getRequest
/**
* Get the player for a join request.
* @param SR_Player $leader
* @param SR_Clan $clan
* @param string $pname
* @return SR_Player
*/
public static function getRequest(SR_Player $leader, SR_Clan $clan, $pname)
{
$ename = GDO::escape($pname);
if (false === ($pid = self::table(__CLASS__)->selectVar('sr4cr_pid', "sr4cr_pname='{$ename}'"))) {
return false;
}
if (false === ($player = Shadowrun4::getPlayerByPID($pid))) {
if (false === ($player = SR_Player::getByID($pid))) {
return false;
}
}
return $player;
}
示例4: execute
public static function execute(SR_Player $player, array $args)
{
$bot = Shadowrap::instance($player);
if (count($args) !== 1) {
$bot->reply(Shadowhelp::getHelp($player, 'gmstats'));
return false;
}
if (false !== ($npc = Shadowrun4::getPlayerByShortName($args[0]))) {
} elseif ($npc === -1) {
$bot->reply('The playername is ambigious.');
return false;
} elseif (false !== ($npc = Shadowrun4::getPlayerByPID($args[0]))) {
} else {
$bot->reply('The player ' . $args[0] . ' is not in memory.');
return false;
}
self::reply($player, Shadowfunc::getStatus($npc, '5301'));
self::reply($player, Shadowfunc::getEquipment($npc, '5303'));
self::reply($player, Shadowfunc::getAttributes($npc, '5304'));
self::reply($player, Shadowfunc::getSkills($npc, '5305'));
// $bot->reply(sprintf('Party: %s.', Shadowfunc::getPartyStatus($npc)));
return true;
}
示例5: 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;
}
示例6: getRemotePlayer
public function getRemotePlayer()
{
return $this->remote_pid === 0 ? false : Shadowrun4::getPlayerByPID($this->remote_pid);
}
示例7: getOwner
public function getOwner()
{
return Shadowrun4::getPlayerByPID($this->getOwnerID());
}
示例8: getLeader
/**
* Get the leader of this clan.
* @return SR_Player
*/
public function getLeader()
{
$lead_id = $this->getLeaderID();
if (false === ($leader = Shadowrun4::getPlayerByPID($lead_id))) {
if (false === ($leader = SR_Player::getByID($lead_id))) {
return false;
}
}
return $leader;
}
示例9: initMembers
public function initMembers()
{
$dist = explode(',', $this->getVar('sr4pa_distance'));
foreach (explode(',', $this->getVar('sr4pa_members')) as $i => $playerid) {
if (false !== ($player = Shadowrun4::getPlayerByPID($playerid))) {
$this->addUser($player, false);
$this->distance[$player->getID()] = $dist[$i];
}
}
$this->recomputeEnums();
if (false === $this->updateMembers()) {
return false;
}
$this->setupMaxDist();
return true;
}