From The Mana World
m (User:Jaxad0127/Units moved to Units.xml: moving out of my namespace)
m (typo?)
Line 18: Line 18:
  <units>
  <units>
     <unit type="currency" base="GP"/>
     <unit type="currency" base="GP"/>
     <unit tpye="weight" base="g" mixed="no">
     <unit type="weight" base="g" mixed="no">
         <level symbol="kg" count="1000"/>
         <level symbol="kg" count="1000"/>
     </unit>
     </unit>

Revision as of 09:10, 17 February 2009

This file describes the various units used in the interface, like currency and weight.

Structure

Unit files are in XML format.

<units>

This is the root element of the file.

<unit>

And individual unit definition. units have types, bases, mixed, and round, and conversion values. The type describes the function of this unit, like "currency" or "weight". The base is the symbol of the base unit, like "gold" or "g" (gram). The optional mixed describes how to handle different units (described later; default tbd). round describes how many decimal places to round decimals (defaults to 2 places). conversion is the factor applied to the internal units to reach these units (defaults to 1).

<level>

Each unit can have multiple levels. levels have symbols, counts, and rounds. symbol is the symbol to use for this level. count describes how many of the previous level is needed to for this level. round is as above, except it only applies to this level.

Example

<units>
    <unit type="currency" base="GP"/>
    <unit type="weight" base="g" mixed="no">
        <level symbol="kg" count="1000"/>
    </unit>
    ...
</units>

When mixed is no, a decimal with the largest units needed is used (ex: 1.05kg). When mixed is yes, all non-0 levels are shown (ex: 1kg, 50g).