コード例 #1
0
 public function onRoundtripShow(SR_Player $player, SR_TalkingNPC $johnson)
 {
     # Has crystal?
     if (false === ($crystal = $player->getInvItemByName('DataCrystal', false))) {
         return false;
     }
     # Is a johnson?
     $name = $johnson->getNPCClassName();
     if (!in_array($name, self::$JOHNSONS, true)) {
         echo "{$name} is NOT A JOHNSON!\n";
         return false;
     }
     # Already shown?
     $data = $this->getQuestData();
     if (in_array($name, $data, true)) {
         echo "ALREADY SHOWN TO A JOHNSON!\n";
         return false;
     }
     # Save it!
     $data[] = $name;
     $this->saveQuestData($data);
     $player->message(sprintf('You show Mr. Johnson the data crystal ...'));
     $johnson->reply('Thank you ... this was very important!');
     return true;
 }