public static function getFood(SR_RealNPC $npc) { foreach ($npc->getInventory() as $item) { if ($item instanceof SR_Food) { return $item; } } }
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) { } } } }
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')); } } }
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; }
public function ai_goal(SR_RealNPC $npc) { echo __CLASS__ . __FUNCTION__ . ': ' . $npc->getClassName(); parent::ai_goal($npc); }
public function ai_on_whisper(SR_RealNPC $npc, array $args) { echo ":Ochatter.ai_on_whisper(): {$npc->getClassName()}\n"; return self::onChatResponse($npc, $args); }
public function pushChatTree(SR_RealNPC $npc, $word) { $classname = $npc->getClassName(); return $this->chat_tree[$classname][] = $word; }
public function getExtensions() { return SR_AIExtension::merge(parent::getExtensions(), array()); }
public static function isDropOverweight(SR_RealNPC $npc) { return $npc->get('weight') / $member->get('max_weight') > 1.2; }
public static function ai_init(SR_RealNPC $npc) { $npc->ai_say_message('I´m alive! - Shark rule!'); }
public static function getFeelingUrgency(SR_RealNPC $npc, $field) { return 10000 - Common::clamp($npc->getInt($field) + 50000, -50000, 50000); }