<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/mmogame/db" VERSION="20190427" COMMENT="XMLDB file for Moodle mod/mmogame"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd">
  <TABLES>
    <TABLE NAME="mmogame" COMMENT="mmogame">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="intro" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="MMOGame introduction text."/>
        <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="MMOGame intro text format."/>
        <FIELD NAME="timeopen" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="timeclose" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="grade" TYPE="number" LENGTH="10" DECIMALS="5"  NOTNULL="true" DEFAULT="0" SEQUENCE="false" />
        <FIELD NAME="decimalpoints" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="completionpass" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="casesensitive" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="language" TYPE="char" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="qbank" TYPE="char" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="qbankparams" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="typeparams" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="modelparams" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="enablejson" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
    </TABLE>

    <TABLE NAME="mmogame_aa_instances" COMMENT="mmogame_aa_instance">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="mmogameid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="numgame" TYPE="int" LENGTH="10" NOTNULL="true"  SEQUENCE="false"/>
        <FIELD NAME="type" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="model" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="kinduser" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="auserid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="pin" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="enabled" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="timelimit" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="numattempt" TYPE="int" LENGTH="10" NOTNULL="true"  SEQUENCE="false"/>
        <FIELD NAME="typeparams" TYPE="text" NOTNULL="false"  SEQUENCE="false"/>
        <FIELD NAME="modelparams" TYPE="text" NOTNULL="false"  SEQUENCE="false"/>
        <FIELD NAME="fastjson" TYPE="char" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="timefastjson" TYPE="char" LENGTH="20" NOTNULL="false"  SEQUENCE="false"/>
		<FIELD NAME="striptags" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="pin" UNIQUE="true" FIELDS="pin"/>
      </INDEXES>
    </TABLE>

    <TABLE NAME="mmogame_aa_users" COMMENT="mmogame_aa_users">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="kind" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="instanceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="lastlogin" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="lastip" TYPE="char" LENGTH="15" NOTNULL="true" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
    </TABLE>

    <TABLE NAME="mmogame_aa_avatars" COMMENT="mmogame_aa_avatars">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="directory" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="filename" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="numused" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="randomkey" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
		<FIELD NAME="ishidden" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" SEQUENCE="false"/>        
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
    </TABLE>

    <TABLE NAME="mmogame_aa_users_guid" COMMENT="mmogame_aa_users_guid">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="guid" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
    <INDEXES>
        <INDEX NAME="guid" UNIQUE="true" FIELDS="guid"/>
    </INDEXES>
    </TABLE>

    <TABLE NAME="mmogame_aa_users_code" COMMENT="mmogame_aa_users_code">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="mmogameid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="ginstanceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="code" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="paramsplit" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="grade" TYPE="float" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="enabled" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
    <INDEXES>
        <INDEX NAME="ginstanceidcode" UNIQUE="true" FIELDS="ginstanceid,code"/>
        <INDEX NAME="code" UNIQUE="false" FIELDS="code"/>
    </INDEXES>
    </TABLE>

    <TABLE NAME="mmogame_aa_grades" COMMENT="mmogame_aa_grades">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="mmogameid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="ginstanceid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="numgame" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="auserid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="avatarid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="usercode" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="nickname" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="colorpaletteid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="sumscore" TYPE="float" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="countscore" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="score" TYPE="float" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="sumscore2" TYPE="float" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="numteam" TYPE="int" LENGTH="10" DEFAULT="0" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="history" TYPE="int" LENGTH="10" DEFAULT="0" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="historyscore" TYPE="float" DEFAULT="0" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="percentcompleted" TYPE="float" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="ginstanceidnumgameauserid" UNIQUE="true" FIELDS="ginstanceid,numgame,auserid"/>
        <INDEX NAME="mmogameid" UNIQUE="false" FIELDS="mmogameid"/>
      </INDEXES>
    </TABLE>

    <TABLE NAME="mmogame_aa_stats" COMMENT="mmogame_aa_stats">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="mmogameid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="ginstanceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="numgame" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="queryid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="auserid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="teamid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="counterror" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="timeerror" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="countcorrect" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="countused" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="position" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="count1" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="count2" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="percent" TYPE="float" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="countanswers" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="countcompleted" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="index_unique" UNIQUE="true" FIELDS="ginstanceid,numgame,queryid,auserid,teamid"/>
      </INDEXES>
    </TABLE>

    <TABLE NAME="mmogame_aa_colorpalettes" COMMENT="mmogame_aa_colorpalettes">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="category" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="name" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="color1" TYPE="int" LENGTH="9" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="color2" TYPE="int" LENGTH="9" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="color3" TYPE="int" LENGTH="9" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="color4" TYPE="int" LENGTH="9" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="color5" TYPE="int" LENGTH="9" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="colorsort1" TYPE="int" LENGTH="9" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="colorsort2" TYPE="int" LENGTH="9" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="colorsort3" TYPE="int" LENGTH="9" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="colorsort4" TYPE="int" LENGTH="9" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="colorsort5" TYPE="int" LENGTH="9" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="hue" TYPE="float" NOTNULL="false" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="categoryname" UNIQUE="false" FIELDS="category,name"/>
      </INDEXES>
    </TABLE>

    <TABLE NAME="mmogame_aa_states" COMMENT="mmogame_aa_states">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="mmogameid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="ginstanceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="numgame" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="state" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="param1" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="remark" TYPE="TEXT" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="param2" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
    </TABLE>

    <TABLE NAME="mmogame_am_aduel_pairs" COMMENT="mmogame_am_aduel_pairs">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="mmogameid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="ginstanceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="numgame" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="auserid1" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="auserid2" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="timestart1" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Time when the attempt started."/>
        <FIELD NAME="timestart2" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Time when the attempt started."/>
        <FIELD NAME="timeclose" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Time when the auser1 finished."/>
        <FIELD NAME="timelimit" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The time limit for attempts, in seconds."/>
        <FIELD NAME="isclosed1" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="isclosed2" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="tool1numattempt1" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="tool1numattempt2" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="tool2numattempt1" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="tool2numattempt2" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="tool3numattempt1" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="tool3numattempt2" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="intro" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="MMOGame introduction text."/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="ginstanceidnumgameauserid1isclosed1timestart1" UNIQUE="false" FIELDS="ginstanceid,numgame,auserid1,isclosed1,timestart1"/>
        <INDEX NAME="ginstanceidnumgameauserid2isclosed2timestart2" UNIQUE="false" FIELDS="ginstanceid,numgame,auserid2,isclosed2,timestart2"/>
      </INDEXES>
    </TABLE>
  </TABLES>
</XMLDB>