Formalize scenario schema

- Except ratings, those still need to be formalized
This commit is contained in:
2014-11-28 11:58:58 -05:00
parent 7d287769ab
commit fbb0b70626
2 changed files with 217 additions and 15 deletions

View File

@@ -10,6 +10,24 @@
<icon>8</icon>
<!-- For a custom icon, use
<icon custom="true" col="0" row="0">scenicon.png</icon>
where col=x and row=y are tile offsets to the TL corner of the icon
The icon is assumed to be 32x32 pixels on a graphics sheet containing
only 32x32 icons, and the row and col count tiles, not pixels.
Set split="true" if you want to put the scenario icon on your main
graphics sheet (of 28x36 icons), where it would need to be split in half
and take two slots like a talking graphics.
-->
<id>1359072240-14121234</id>
<!-- Unix time of creation, plus random number.
@@ -41,15 +59,15 @@
<name>Sylae Jiendra Corell</name><!-- Human-readable -->
<mail>sylae@calref.net</mail><!-- Human-readable -->
<email>sylae@calref.net</email><!-- Human-readable -->
</author>
<text>
<teaser1>Who wrote 1</teaser1><!-- Human-readable -->
<teaser>Who wrote 1</teaser><!-- Human-readable -->
<teaser2>Who wrote 2</teaser2><!-- Human-readable -->
<teaser>Who wrote 2</teaser><!-- Human-readable -->
</text>
@@ -79,7 +97,7 @@
<flags>
<adjust_difficulty>true</adjust_difficulty>
<adjust-difficulty>true</adjust-difficulty>
<legacy>none</legacy>
@@ -90,6 +108,8 @@
none: goes off of cboe version
-->
<custom-graphics>false</custom-graphics>
</flags>
@@ -104,16 +124,31 @@
<os>win7-x64</os>
</creator>
<icon>8</icon>
<!-- For a custom icon, use
<icon custom="true" x="0" y="0">scenicon.png</icon>
where x and y are offsets to the TL corner of the icon
-->
<game>
<!-- Number of towns in the scenario -->
<num-towns>1</num-towns>
<!-- Number of outdoor sections in the scenario -->
<out-width>1</out-width>
<out-height>1</out-height>
<!-- Number of the starting town -->
<start-town>0</start-town>
<!-- Where in town you start -->
<town-start x="20" y="20"/>
<!-- Which outdoor section you start in -->
<outdoor-start x="0" y="0"/>
<!-- Where in that outdoor section you start -->
<sector-start x="20" y="20"/>
<!-- Definitions of special items, if any -->
<specials/>
</game>
<editor>
<!-- Default ground terrain used by the editor for new towns -->
<default-ground>0</default-ground>
<!-- Last outdoor section edited -->
<last-out-section x="0" y="0"/>
<!-- Last town edited -->
<last-town>0</last-town>
</editor>
</scenario>

167
rsrc/boes/scenario.xsd Normal file
View File

@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="bool">
<xs:restriction base="xs:token">
<xs:enumeration value="true"/>
<xs:enumeration value="false"/>
</xs:restriction>
</xs:simpleType>
<xs:attributeGroup name="rect">
<xs:attribute name="top" use="required" type="xs:integer"/>
<xs:attribute name="left" use="required" type="xs:integer"/>
<xs:attribute name="width" type="xs:integer"/>
<xs:attribute name="height" type="xs:integer"/>
</xs:attributeGroup>
<xs:attributeGroup name="point">
<xs:attribute name="x" use="required" type="xs:integer"/>
<xs:attribute name="y" use="required" type="xs:integer"/>
</xs:attributeGroup>
<xs:element name="icon">
<xs:complexType mixed="true">
<xs:attribute name="custom" type="bool" default="false"/>
<xs:attribute name="split" type="bool" default="false"/>
<xs:attribute name="row" type="xs:integer" default="0"/>
<xs:attribute name="col" type="xs:integer" default="0"/>
</xs:complexType>
</xs:element>
<xs:element name="version" type="xs:string"/>
<xs:element name="author">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="email" type="xs:string"/>
</xs:sequence>
<xs:attribute name="id" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="text">
<xs:complexType>
<xs:sequence>
<xs:element name="teaser" minOccurs="0" maxOccurs="2" type="xs:string"/>
<xs:element ref="icon" minOccurs="0"/>
<xs:element name="intro-msg" minOccurs="0" maxOccurs="6" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ratings">
</xs:element>
<xs:element name="flags">
<xs:complexType>
<xs:sequence>
<xs:element name="adjust-difficulty" type="bool"/>
<xs:element name="legacy" type="xs:string"/>
<xs:element name="custom-graphics" type="bool"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="creator">
<xs:complexType>
<xs:sequence>
<xs:element name="type" type="xs:string"/>
<xs:element ref="version"/>
<xs:element name="os" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="game">
<xs:complexType>
<xs:sequence>
<xs:element name="num-towns" type="xs:integer"/>
<xs:element name="out-width" type="xs:integer"/>
<xs:element name="out-height" type="xs:integer"/>
<xs:element name="start-town" type="xs:integer"/>
<xs:element name="town-start">
<xs:complexType>
<xs:attributeGroup ref="point"/>
</xs:complexType>
</xs:element>
<xs:element name="outdoor-start">
<xs:complexType>
<xs:attributeGroup ref="point"/>
</xs:complexType>
</xs:element>
<xs:element name="sector-start">
<xs:complexType>
<xs:attributeGroup ref="point"/>
</xs:complexType>
</xs:element>
<xs:element name="store-items" minOccurs="0" maxOccurs="3">
<xs:complexType>
<xs:attributeGroup ref="rect"/>
<xs:attribute name="town" type="xs:integer" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="town-flags" minOccurs="0" maxOccurs="10">
<xs:complexType>
<xs:sequence>
<xs:element name="town-flag">
<xs:complexType>
<xs:attribute name="town" type="xs:integer"/>
<xs:attribute name="add" type="xs:integer"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="specials">
<xs:complexType>
<xs:sequence>
<xs:element name="item" minOccurs="0" maxOccurs="50">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
</xs:sequence>
<xs:attribute name="special" type="bool"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="timer" minOccurs="0" maxOccurs="20">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="time" type="xs:integer"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="editor">
<xs:complexType>
<xs:sequence>
<xs:element name="default-ground" type="xs:integer"/>
<xs:element name="last-out-section">
<xs:complexType>
<xs:attributeGroup ref="point"/>
</xs:complexType>
</xs:element>
<xs:element name="last-town" type="xs:integer"/>
<xs:element name="storage" minOccurs="0" maxOccurs="10">
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="scenario">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element ref="icon"/>
<xs:element name="id" type="xs:string"/>
<xs:element ref="version"/>
<xs:element name="language" type="xs:string"/>
<xs:element ref="author"/>
<xs:element ref="text"/>
<xs:element ref="ratings"/>
<xs:element ref="flags"/>
<xs:element ref="creator"/>
<xs:element ref="game"/>
<xs:element ref="editor"/>
</xs:sequence>
<xs:attribute name="boes" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>