Skip to content

Commit

Permalink
SAI/Teleport
Browse files Browse the repository at this point in the history
 * fixed resolving teleport target for NPCs
  • Loading branch information
Sarjuuk committed Jun 10, 2022
1 parent 7e5659f commit f879b6e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion includes/smartAI.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,15 @@ private function action() : array
$a['param'][6] = $this->aiTemplate($a['param'][0]);
break;
case SAI_ACTION_TELEPORT: // 62 -> invoker [resolved coords already stored in areatrigger entry]
$a['param'][6] = $this->miscData['teleportA'];
if (isset($this->miscData['teleportA']))
$a['param'][6] = $this->miscData['teleportA'];
else if ($pos = Game::worldPosToZonePos($a['param'][0], $this->itr['target']['pos'][0], $this->itr['target']['pos'][1]))
$a['param'][6] = $pos['areaId'];
else if ($areaId = DB::Aowow()->selectCell('SELECT id FROM ?_zones WHERE mapId = ?d LIMIT 1', $a['param'][0]))
$a['param'][6] = $areaId;
else
trigger_error('SmartAI::action - could not resolve teleport target: map:'.$a['param'][0].' x:'.$this->itr['target']['pos'][0].' y:'.$this->itr['target']['pos'][1]);

$this->jsGlobals[Type::ZONE][] = $a['param'][6];
break;
case SAI_ACTION_SET_ORIENTATION: // 66 -> any target
Expand Down

0 comments on commit f879b6e

Please sign in to comment.