From The Mana World
(initial revision)
 
m (Move page script moved page Dev:Units.xml to Development:Units.xml: Rename Dev: to Development: so the miraheze import works)
 
(8 intermediate revisions by 2 users not shown)
Line 8: Line 8:


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


===&lt;level&gt;===
===&lt;level&gt;===
Each unit can have multiple levels. <code>level</code>s have <code>symbol</code>s and <code>count</code>s. <code>symbol</code> is the symbol to use for this level. <code>count</code> describes how many of the previous level is needed to for this level.
Each unit can have multiple levels. <code>level</code>s have <code>symbol</code>s, <code>count</code>s, and <code>round</code>s. <code>symbol</code> is the symbol to use for this level. <code>count</code> describes how many of the previous level is needed to for this level. <code>round</code> is as above, except it only applies to this level.


==Example==
==Example==
Line 18: Line 18:
  &lt;units&gt;
  &lt;units&gt;
     &lt;unit type="currency" base="GP"/&gt;
     &lt;unit type="currency" base="GP"/&gt;
     &lt;unit tpye="weight" base="g" mixed="no"&gt;
     &lt;unit type="weight" base="g" mixed="no"&gt;
         &lt;level symbol="kg" count="1000"/&gt;
         &lt;level symbol="kg" count="1000"/&gt;
     &lt;/unit&gt;
     &lt;/unit&gt;
     ...
     ...
  &lt;/unitss&gt;
  &lt;/units&gt;
</code>
</code>


When <code>mixed,/code> is <code>no</code>, a decimal with the largest units needed is used (ex: 1.05kg). When <code>mixed,/code> is <code>yes</code>, all non-0 levels are shown (ex: 1kg, 1g). When <code>mixed,/code> is <code>all</code>, all levels up to the largest needed are show (ex: 1 Mg, 0 kg, 0g). When <code>mixed,/code> is <code>full</code> all levels defined are show (ex: 0Mg, 1kg, 0g).
When <code>mixed</code> is <code>no</code>, a decimal with the largest units needed is used (ex: 1.05kg). When <code>mixed</code> is <code>yes</code>, all non-0 levels are shown (ex: 1kg, 50g).

Latest revision as of 03:56, 27 March 2024

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).