The mapping between CT/IT properties & MT properties is done by a single Java properties file called property/mtPropertyMap.properties. A Java properties file, as defined here, consists of name/value pairs separated by an equal sign. Each property name in the file is the name of an MT Property. Each property value can be the name of a CT property or a script used to convert any number of CT properties into a single MT property. If the mapping is done on a one MT property to one CT property basis, data changed in MT will be copied into CT when the token file is loaded. If a script is mapped to an MT property then CT will only add the value to the RPToken file and not read it back. As an example take a look at the file that maps CT's D&D 4e file to TK's old macro set here.
The other important part of integrating CT with MT is adding support for MT macros. These macros are stored in a property which is defined in the property/propertyDescriptorSet.xml file. The definition that I use is:
Code: Select all
<property name="rpSystemMacros" type="SCRIPT">
<description>Generate the list of macros for this character.</description>
<script>...</script>
</property>
This script assumes that the macros are stored in an RPData file. In general the properties defined for this file should look something like this:
Code: Select all
<rptools-data>
<property-set>
<type>macro</type>
<name>Macros</name>
<description>Macros that are attached to characters.</description>
<game>...</game>
<source>...</source>
<properties>
<property name="name" slot="modifiable"><description>Unique name for the macro.</description></property>
<property name="macroText" slot="modifiable" display="Macro Command"><description>The actual token macro.</description></property>
<property name="macroSetName"><description>The name of a macro set, if any.</description></property>
</properties>
</property-set>
</rptools-data>
Code: Select all
// Get core macros
var macros = new PropertyList();
var table = new PropertyTable(AppUtil.getAppName(), 'macro');
var condition = new SimpleCondition('MACRO_SET_NAME', SimpleCondition.Operator.EQUALS, 'core');
var list = table.selectRows(null, condition);
if (!list.isEmpty()) macros.addAll(list);
There can also be token specific macros defined for a character. To do this add a new property to property/propertyDescriptorSet.xml file named rpUserMacros. The definition should look like this:
Code: Select all
<property name="rpUserMacros" type="LIST">
<description>The list of user entered macros that are sent to MT.</description>
<property name="macro" type="SLOT" data="macro"/>
</property>