Beispiel #1
0
 public static function getFood(SR_RealNPC $npc)
 {
     foreach ($npc->getInventory() as $item) {
         if ($item instanceof SR_Food) {
             return $item;
         }
     }
 }
Beispiel #2
0
 public function ai_goal(SR_RealNPC $npc)
 {
     echo __CLASS__ . __FUNCTION__ . ': ' . $npc->getClassName();
     if ($npc->ai_can('sell')) {
         foreach ($npc->getInventorySorted() as $i => $items) {
             if ($npc->realnpcfunc('needs_item', array($item)) < 5000) {
             }
         }
     }
 }
Beispiel #3
0
 public function ai_goal(SR_RealNPC $npc)
 {
     echo __CLASS__ . __FUNCTION__ . ': ' . $npc->getClassName();
     $cityname = $this->getCityname();
     $currcity = $npc->getParty(false)->getCity();
     if ($currcity === $cityname) {
         if (self::canExplore($cityname)) {
             SR_AIGoal::addGoal($npc, 'explore', new SR_AIGoal('exp'));
         }
     }
 }
Beispiel #4
0
 public static function sortItems(SR_RealNPC $npc, array $items, $function_name, $min = 0, $max = 100000, $asc = -1)
 {
     $back = array();
     foreach ($items as $item) {
         $v = $npc->realnpcfunc($function_name, $item);
         if ($v >= $min && $v <= $max) {
             $back[] = $item;
         }
     }
     uasort($back, function ($a, $b) {
         $va = $npc->realnpcfunc($function_name, $a);
         $vb = $npc->realnpcfunc($function_name, $b);
         $a->setVar('urgengy', $va);
         return $va - $vb * $asc;
     });
     return $back;
 }
Beispiel #5
0
 public function ai_goal(SR_RealNPC $npc)
 {
     echo __CLASS__ . __FUNCTION__ . ': ' . $npc->getClassName();
     parent::ai_goal($npc);
 }
Beispiel #6
0
 public function ai_on_whisper(SR_RealNPC $npc, array $args)
 {
     echo ":Ochatter.ai_on_whisper(): {$npc->getClassName()}\n";
     return self::onChatResponse($npc, $args);
 }
Beispiel #7
0
 public function pushChatTree(SR_RealNPC $npc, $word)
 {
     $classname = $npc->getClassName();
     return $this->chat_tree[$classname][] = $word;
 }
Beispiel #8
0
 public function getExtensions()
 {
     return SR_AIExtension::merge(parent::getExtensions(), array());
 }
Beispiel #9
0
 public static function isDropOverweight(SR_RealNPC $npc)
 {
     return $npc->get('weight') / $member->get('max_weight') > 1.2;
 }
Beispiel #10
0
 public static function ai_init(SR_RealNPC $npc)
 {
     $npc->ai_say_message('I´m alive! - Shark rule!');
 }
Beispiel #11
0
 public static function getFeelingUrgency(SR_RealNPC $npc, $field)
 {
     return 10000 - Common::clamp($npc->getInt($field) + 50000, -50000, 50000);
 }