/** * Create an NPC and set a valid partyid. * @param string $classname * @return SR_NPC */ private function createNPC($classname, SR_Party $party, SR_Party $attackers = NULL) { $data = $this->applyNPCStartData(self::getPlayerData(NULL)); $data['sr4pl_classname'] = $classname; $npc = new $classname($data); $npc->setNPCClassName($classname); $npc instanceof SR_NPC; $npc->setOption(self::CREATED, true); $npc->setVar('sr4pl_name', $npc->getNPCPlayerName()); if (false === $npc->insert()) { return false; } Shadowcmd_aslset::onASLSetRandom($npc); $party->addUser($npc, false); $npc->saveVar('sr4pl_partyid', $party->getID()); return self::reloadPlayer($npc); }