<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AGetUpdatedTargets</id>
	<title>API:GetUpdatedTargets - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AGetUpdatedTargets"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:GetUpdatedTargets&amp;action=history"/>
	<updated>2026-10-17T06:31:00Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.returnofreckoning.com/index.php?title=API:GetUpdatedTargets&amp;diff=30484&amp;oldid=prev</id>
		<title>Maintenance script: UI Lua API import (WAR 1.4.8)</title>
		<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:GetUpdatedTargets&amp;diff=30484&amp;oldid=prev"/>
		<updated>2026-10-16T19:45:18Z</updated>

		<summary type="html">&lt;p&gt;UI Lua API import (WAR 1.4.8)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{LuaApi|group=Target}}&lt;br /&gt;
Returns information about the player&amp;#039;s hostile, friendly and mouse-over targets.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
targets = GetUpdatedTargets()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
;targets : &amp;lt;code&amp;gt;table&amp;lt;/code&amp;gt; – Table keyed by target slot name. Nothing is returned if no target slot has an update.&lt;br /&gt;
&lt;br /&gt;
The keys are:&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;quot;selfhostiletarget&amp;quot;&amp;lt;/code&amp;gt; – the player&amp;#039;s hostile target.&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;quot;selffriendlytarget&amp;quot;&amp;lt;/code&amp;gt; – the player&amp;#039;s friendly target.&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;quot;mouseovertarget&amp;quot;&amp;lt;/code&amp;gt; – the object under the mouse.&lt;br /&gt;
&lt;br /&gt;
Each value is a target table with these fields:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Type !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;entityid&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Object id of the target. 0 when the slot is empty.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;wstring&amp;lt;/code&amp;gt; || Name of the target. &amp;lt;code&amp;gt;L&amp;quot;&amp;quot;&amp;lt;/code&amp;gt; when the slot is empty.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;healthPercent&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Health percentage.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Object type. The stock UI compares it with &amp;lt;code&amp;gt;SystemData.TargetObjectType&amp;lt;/code&amp;gt; values.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;level&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Level.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;battleLevel&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Battle (bolstered) level. For players, equal to &amp;lt;code&amp;gt;level&amp;lt;/code&amp;gt; when there is no separate battle level.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;tier&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || –&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;conType&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || –&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isPvP&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt; || –&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isNPC&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt; || –&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mapPinType&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || –&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;difficultyMask&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || –&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;career&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Career line of a player target. The stock UI reads it with &amp;lt;code&amp;gt;TargetInfo:UnitCareer&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;careerName&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;wstring&amp;lt;/code&amp;gt; || Career name of a player target.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;npcTitle&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;wstring&amp;lt;/code&amp;gt; || Title of an NPC target, from the &amp;lt;code&amp;gt;NPCTitles&amp;lt;/code&amp;gt; string table. &amp;lt;code&amp;gt;L&amp;quot;&amp;quot;&amp;lt;/code&amp;gt; otherwise.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;showHealthBar&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt; || –&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;sigilEntryId&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || –&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;relationshipColor&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;table&amp;lt;/code&amp;gt; || Table with &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt;, 0–255).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* The client keeps four target slots; three of them are reported. A slot is only included when the client has an update for it.&lt;br /&gt;
* When a target slot is empty, its table is still built, with &amp;lt;code&amp;gt;entityid&amp;lt;/code&amp;gt; 0 and an empty &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;. The stock UI tests &amp;lt;code&amp;gt;name ~= L&amp;quot;&amp;quot;&amp;lt;/code&amp;gt; to see whether a target exists.&lt;br /&gt;
* If no slot has an update, nothing is returned. The stock &amp;lt;code&amp;gt;TargetInfo:UpdateFromClient&amp;lt;/code&amp;gt; then clears all its cached units.&lt;br /&gt;
* If there is no player object, or the Lua state is not available, the function returns nothing.&lt;br /&gt;
* A comment in &amp;lt;code&amp;gt;easystem_targetinfo/source/targetinfo.lua&amp;lt;/code&amp;gt; says the function returns no data until the next &amp;lt;code&amp;gt;PLAYER_TARGET_UPDATED&amp;lt;/code&amp;gt; event.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
From &amp;lt;code&amp;gt;easystem_targetinfo/source/targetinfo.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TargetInfo:UpdateFromClient ()&lt;br /&gt;
    local targets = GetUpdatedTargets ()&lt;br /&gt;
&lt;br /&gt;
    if (targets ~= nil) then&lt;br /&gt;
        for unitId, targetData in pairs (targets) do&lt;br /&gt;
            self:SetUnitInfo (unitId, targetData)&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        self:ClearUnits ()&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:ClearTarget|ClearTarget]]&lt;br /&gt;
* [[API:GetTargetStatesData|GetTargetStatesData]]&lt;br /&gt;
* [[API:GetBuffs|GetBuffs]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>