Skip to content

Configure File.zone.xml

Ta Van Dung edited this page Jun 9, 2016 · 1 revision

To play an extension on Smartfox server you must create an file with suffix is .zone.xml for its, it's a heavy task and we must do carefully.

1. Create File

Let's say you you want to play the extension for VideoPoker game, you can create a file like [VideoPoker.zone.xml] (https://gist.github.com/tvd12/d6bacf096a17471a8f164c179463c919):

<zone>
  <name>video-poker</name>
  <isCustomLogin>true</isCustomLogin>
  <isForceLogout>false</isForceLogout>
  <applyWordsFilterToUserName>true</applyWordsFilterToUserName>
  <applyWordsFilterToRoomName>true</applyWordsFilterToRoomName>
  <applyWordsFilterToPrivateMessages>true</applyWordsFilterToPrivateMessages>
  <isFilterBuddyMessages>true</isFilterBuddyMessages>
  <maxUsers>1000</maxUsers>
  <maxUserVariablesAllowed>10</maxUserVariablesAllowed>
  <maxRoomVariablesAllowed>10</maxRoomVariablesAllowed>
  <minRoomNameChars>1</minRoomNameChars>
  <maxRoomNameChars>20</maxRoomNameChars>
  <maxRooms>500</maxRooms>
  <maxRoomsCreatedPerUser>10</maxRoomsCreatedPerUser>
  <userCountChangeUpdateInterval>1000</userCountChangeUpdateInterval>
  <userReconnectionSeconds>1</userReconnectionSeconds>
  <overrideMaxUserIdleTime>300</overrideMaxUserIdleTime>
  <allowGuestUsers>true</allowGuestUsers>
  <guestUserNamePrefix>Guest#</guestUserNamePrefix>
  <publicRoomGroups>default,games,chats</publicRoomGroups>
  <defaultRoomGroups>default,games,chats</defaultRoomGroups>
  <defaultPlayerIdGeneratorClass></defaultPlayerIdGeneratorClass>
  <wordsFilter active="false">
    <useWarnings>false</useWarnings>
    <warningsBeforeKick>3</warningsBeforeKick>
    <kicksBeforeBan>2</kicksBeforeBan>
    <banDuration>1440</banDuration>
    <maxBadWordsPerMessage>0</maxBadWordsPerMessage>
    <kicksBeforeBanMinutes>3</kicksBeforeBanMinutes>
    <secondsBeforeBanOrKick>5</secondsBeforeBanOrKick>
    <warningMessage>Stop swearing or you will be banned</warningMessage>
    <kickMessage>Swearing not allowed: you are being kicked</kickMessage>
    <banMessage>Too much swearing: you are banned</banMessage>
    <wordsFile>config/wordsFile.txt</wordsFile>
    <filterMode>BLACKLIST</filterMode>
    <banMode>NAME</banMode>
    <hideBadWordWithCharacter>*</hideBadWordWithCharacter>
  </wordsFilter>
  <floodFilter active="false">
    <banDurationMinutes>1440</banDurationMinutes>
    <maxFloodingAttempts>5</maxFloodingAttempts>
    <secondsBeforeBan>5</secondsBeforeBan>
    <banMode>NAME</banMode>
    <logFloodingAttempts>true</logFloodingAttempts>
    <banMessage>Too much flooding, you are banned</banMessage>
  </floodFilter>
  <rooms>
  </rooms>
  <disabledSystemEvents/>
  <privilegeManager active="false">
    <profiles>
      <profile id="0">
        <name>Guest</name>
        <deniedRequests/>
        <permissionFlags>
          <string>ExtensionCalls</string>
        </permissionFlags>
      </profile>
      <profile id="1">
        <name>Standard</name>
        <deniedRequests/>
        <permissionFlags>
          <string>ExtensionCalls</string>
        </permissionFlags>
      </profile>
      <profile id="2">
        <name>Moderator</name>
        <deniedRequests/>
        <permissionFlags>
          <string>ExtensionCalls</string>
          <string>SuperUser</string>
        </permissionFlags>
      </profile>
      <profile id="3">
        <name>Administrator</name>
        <deniedRequests/>
        <permissionFlags>
          <string>ExtensionCalls</string>
          <string>SuperUser</string>
        </permissionFlags>
      </profile>
    </profiles>
  </privilegeManager>
  <extension>
    <name>video-poker</name>
    <type>JAVA</type>
    <file>com.tvd12.example.videopoker.server.GameApplication</file>
    <propertiesFile>config/config.properties</propertiesFile>
    <reloadMode>AUTO</reloadMode>
  </extension>
  <buddyList active="true">
    <allowOfflineBuddyVariables>true</allowOfflineBuddyVariables>
    <maxItemsPerList>100</maxItemsPerList>
    <maxBuddyVariables>15</maxBuddyVariables>
    <offlineBuddyVariablesCacheSize>500</offlineBuddyVariablesCacheSize>
    <customStorageClass></customStorageClass>
    <useTempBuddies>true</useTempBuddies>
    <buddyStates>
      <string>Available</string>
      <string>Away</string>
      <string>Occupied</string>
    </buddyStates>
    <badWordsFilter isActive="true"/>
  </buddyList>
  <databaseManager active="false">
    <driverName></driverName>
    <connectionString></connectionString>
    <userName></userName>
    <password></password>
    <testSql></testSql>
    <maxActiveConnections>10</maxActiveConnections>
    <maxIdleConnections>10</maxIdleConnections>
    <exhaustedPoolAction>FAIL</exhaustedPoolAction>
    <blockTime>3000</blockTime>
  </databaseManager>
</zone>

2. Configure Custom Login

We almost need custom user's login event to verify username, password, game version e.t.c. But sometimes we don't, so we configure like this:

<isCustomLogin>true</isCustomLogin>

3. Configure Extension

Let's take a look <extension> tag. The value in <name> tag is name of your extension and it must same to your extension folder name in extensions folder. The value in <file> tag is qualified name of which class extends com.tvd12.ezyfox.sfs2x.extension.ZoneExtension.

Hello World

Clone this wiki locally