/** * @param SR_Player $player * @param string $name * @return SR_Player */ public static function getPlayerInLocation(SR_Player $player, $name) { if (false === ($back = Shadowrun4::getPlayerByName($name))) { return false; } # Same party if ($back->getPartyID() === $player->getPartyID()) { return $back; } if (self::sharesLocation($player, $back)) { return $back; } return false; }
public function setLeader(SR_Player $player) { if ($player->getPartyID() !== $this->getID()) { return false; } $pid = $player->getID(); $td = $this->distance[$pid]; unset($this->members[$pid]); unset($this->distance[$pid]); $t1 = array($pid => $player); $t2 = array($pid => $td); foreach ($this->members as $pid2 => $member) { $t1[$pid2] = $member; $t2[$pid2] = $this->distance[$pid2]; } $this->members = $t1; $this->distance = $t2; if (false === $this->updateMembers()) { return false; } $this->recomputeEnums(); return true; }