<?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%3AGetDyeMerchantData</id>
	<title>API:GetDyeMerchantData - 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%3AGetDyeMerchantData"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:GetDyeMerchantData&amp;action=history"/>
	<updated>2026-10-18T06:58:49Z</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:GetDyeMerchantData&amp;diff=30377&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:GetDyeMerchantData&amp;diff=30377&amp;oldid=prev"/>
		<updated>2026-10-16T19:43:35Z</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=Dye}}&lt;br /&gt;
Returns the colours offered by the dye merchant the player is talking to.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dyes = GetDyeMerchantData()&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;
;dyes : &amp;lt;code&amp;gt;table&amp;lt;/code&amp;gt; – Array of colour tables, indexed from 1, plus a &amp;lt;code&amp;gt;numColors&amp;lt;/code&amp;gt; field.&lt;br /&gt;
&lt;br /&gt;
The table has this extra field:&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;numColors&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Number of colours. The stock UI loops from 1 to this value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each colour table has 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;cost&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Price of the colour, in brass.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Position of the colour in the list, starting at 0 (one less than the array index).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dataIndex&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || – (the stock UI copies it to &amp;lt;code&amp;gt;GameData.DyeMerchant.tintA&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;tintB&amp;lt;/code&amp;gt; before buying).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;paletteIndex&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Index of the colour in the client&amp;#039;s dye palette. Pass it to [[API:DyeMerchantPreview|DyeMerchantPreview]]. The stock UI treats 0 as bleach.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Colour of the palette entry, 0–255 each.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* The data is the dye merchant list the client currently holds. A new table is built on every call.&lt;br /&gt;
* &amp;lt;code&amp;gt;numColors&amp;lt;/code&amp;gt; is a separate value the client keeps next to the list; it is not counted from the entries. The stock UI relies on it.&lt;br /&gt;
* The table can be passed straight to [[API:ColorPickerCreateWithColorTable|ColorPickerCreateWithColorTable]], which reads &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;, &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;.&lt;br /&gt;
* If the Lua state is not available, the function returns nothing.&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;default/ea_characterwindow/source/characterwindowdyes.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CharacterWindow.dyeColors = GetDyeMerchantData()&lt;br /&gt;
CharacterWindow.dyeColorsLookUp = {}&lt;br /&gt;
local bleachId = nil&lt;br /&gt;
for index = 1, CharacterWindow.dyeColors.numColors&lt;br /&gt;
do&lt;br /&gt;
    if( CharacterWindow.dyeColors[index].paletteIndex == 0 )&lt;br /&gt;
    then&lt;br /&gt;
        bleachId = CharacterWindow.dyeColors[index].id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    CharacterWindow.dyeColorsLookUp[ CharacterWindow.dyeColors[index].paletteIndex ] =  CharacterWindow.dyeColors[index]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
ColorPickerCreateWithColorTable(&amp;quot;DyeMerchantColorPicker&amp;quot;, CharacterWindow.dyeColors, 5, 10, 10)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:DyeMerchantPreview|DyeMerchantPreview]]&lt;br /&gt;
* [[API:DyeMerchantPreviewAll|DyeMerchantPreviewAll]]&lt;br /&gt;
* [[API:GetDyeName|GetDyeName]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>